npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@inkeep/impulse-owned-process

v0.3.0

Published

A child process with a deadline and an owner, on effect/process: every piped stream drained under a stated disposition, one termination path with group-gone evidence, a bounded line sink, and a hand-off with start identity.

Readme

@inkeep/impulse-owned-process

A child process with a deadline and an owner, on effect 4.1's effect/process. Every run has a deadline and a termination grace, every piped stream is drained to its end, and the result is a ProcessRecord: the exit, what each stream carried, and how the run was ended. The interface is §7.1 of the CWS foundation note, revision 3 (design note, interface digest), plus capture(n, "keep-ends") and the omitted field it records, and termination.group, the evidence behind groupGone, both added for shared CI's check-affected, and an owner-loss tether.

Install

The package is public on npm. Install it with its peer, any effect 4.1.x from 4.1.2 (~4.1.2):

npm install @inkeep/impulse-owned-process [email protected]
pnpm add @inkeep/impulse-owned-process [email protected]
  • It is ESM with TypeScript declarations, for TypeScript 5.9 or later with strict, as effect requires. It declares no engines field. New-group runs require Node 26.10.0 or later; the owner checks this before spawning anything. The suite passed on Node 26.10.0 on macOS arm64; the nightly uses the repository pin, Node 26.12.1.
  • Its entry needs a ChildProcessSpawner: NodeServices.layer from @effect/platform-node 4.1.x provides it (below).
  • Inside this repository, a member depends on it with "@inkeep/impulse-owned-process": "workspace:*" instead.
  • Releases follow packages/README.md, "Publishing a member to npm". @inkeep/impulse-ssh depends on this package, so each of its versions is published here first.

Exports

| Export | What it is | | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | run(request, { stop }?) | Runs a child to its end and returns its ProcessRecord; a non-zero exit is data | | checked(request, { stop }?) | run, failing ExitFailed unless the exit code is 0 | | owned(request) | A scoped child: pid, await, stop(reason) and release | | processStartTime(pid), sameProcess(identity) | A process's start identity, and whether a pid is still that process (same, reused, gone) | | capture, forward, ignore, lines | What happens to stdout and stderr; lines is a Sink that splits on \n, \r\n or \r and cuts a line at maxLineBytes | | ProcessRecord, HandOff, ProcessIdentity, ProcessError | Effect Schemas, so a record or an error crosses a process boundary as data. The records are plain structs, so every schema-valid value encodes, a copy included; ProcessError is a tagged error class | | OutputRecord | Part of ProcessRecord: what happened to stdout or stderr. Captured holds the bytes kept, the total, whether it was truncated, where a cut was made and whether the stream closed; Forwarded holds how many bytes were passed on, the total, whether it was truncated and whether the stream closed; Ignored holds nothing | | ProcessExit | Part of ProcessRecord: Exited with its code, or Signaled with its signal | | StdinRecord | Part of ProcessRecord: None, or Fed with the bytes written and how stdin ended (source-done, child-closed or stopped) | | Termination | Part of ProcessRecord: what ended the child (deadline, stop, output-limit, or nothing), the reason and when, whether its process group was seen gone, and the evidence for that in group: the group's last answer and the members read | | ProcessErrorReason | The reason a ProcessError carries: SpawnFailed, DeadlineExceeded, OutputLimit, ExitFailed or ReleaseRefused, with the ProcessRecord where there is one |

Using it

  • The environment is complete. env is everything the child sees; nothing is inherited, and the package adds nothing. Under offload, carry OT_RUN_ID, OT_OWNER and the PATH that puts offload's labelling docker first through the env you pass. A caller that leaves them out loses the run's attribution for any docker its child runs.
  • Provide ChildProcessSpawner at your entry, with NodeServices.layer from @effect/platform-node, never inside a layer. Import it from @effect/platform-node/NodeServices: the package root reaches effect/rpc, whose declarations name the DOM-only Transferable, so a Node project with skipLibCheck: false and no DOM library fails to type-check (Effect ledger, Effect-TS/effect#9785).
  • Say what each stream does. stdout and stderr have no default. Data that must arrive whole takes an uncapped forward or capture(n, "terminate"); capture(n, "keep-tail") and a capped forward are for logs and stderr tails. capture(n, "keep-ends") keeps the first half of n, rounded down, and the last half, rounded up, for output whose first lines say what went wrong. When it drops bytes, its record says where: omitted: { at, bytes } is the offset in bytes where the head ends and the tail begins, and how many bytes were dropped there. Only a keep-ends record that dropped bytes carries omitted.
  • A stdin source that fails never reaches the child as EOF. The run fails with the source's own error, and the package holds the child's stdin open until the stop has ended the child, so a child never reads truncated input as complete. Effect's own stdin stream option would destroy the pipe at once, and report the failure nowhere. A run the caller interrupts keeps the same promise: the child is stopped before its feed is interrupted, because from effect 4.0.6 an interrupted feed destroys the pipe too.
  • One termination path. A deadline, a stop and a terminate overflow all send SIGTERM to the child's process group under one terminationGrace deadline when that grace covers the spawner's documented final one-second wait. The spawner receives the time remaining after that wait, then the same deadline bounds group confirmation. A shorter grace reserves the configured grace for SIGKILL and may include the platform tail. termination.by says which one ended the run. A stop effect that dies stops the child the same way, and the run fails with that defect. Interrupting the fiber stops the child the same way and returns no record. Under processGroup: "inherit" the signals go to the child's pid, groupGone reads not-applicable and termination.group is null.
  • Confirming the group gone. The probe, kill(-pgid, 0), repeats until the group answers ESRCH (observed) or the shared terminationGrace deadline is spent, so a zombie member reaped within it reads as gone. A group that still answers then has its members read once, and is probed once more. It reads observed when that probe answers ESRCH, or when the read listed at least one member and every one of them is a zombie, its state starting with Z. Otherwise it reads not-observed when the probe succeeded and unknown when it failed, so a member that is not a zombie, or a read that fails, keeps the group unconfirmed, and EPERM alone never reads as gone. A group of zombies answers EPERM on macOS and success on Linux. The confirmation runs as the run's last finalizer, after the spawner's release, so no interruption cuts it short, one that arrives while a stopped run confirms its group included: it returns once the group answers ESRCH, or once the shared terminationGrace deadline is spent and the members have been read with the remaining allowance; if no allowance remains, the evidence is Unreadable.
  • termination.group is the evidence. lastProbe is the last probe's answer: Succeeded, or Failed with its errno code. members is NotRead when the group answered ESRCH in time, Read with each listed member's pid and state, or Unreadable with why. The read is /bin/ps -A -o pid=,pgid=,stat= under LC_ALL=C, a run with terminationGrace as both its deadline and its grace. It sees what ps lists; on Linux that is what /proc shows, and a /proc mounted with hidepid does not show another user's processes.
  • An owner-loss tether. If the owning process dies without interrupting the run (SIGKILL, a crash, process.exit), the child's group is still stopped the one way. Each run with its own group starts a tether: /bin/sh, in a session of its own, blocked reading a pipe that only the owner holds. When the owner dies, the pipe reaches end of file, and the tether sends SIGTERM to the group, waits terminationGrace, sends SIGKILL to a group that still answers, probes until it no longer answers or terminationGrace is spent again, and exits. Any failed probe counts as gone: ESRCH, or EPERM, which macOS answers for a group left with only zombies.
    • Acquisition is protected too. A new group's first process waits on a private startup pipe. Only after its tether has started does the owner send the executable, arguments and complete environment through that pipe. The waiting process uses Node's POSIX process.execve to become the command without changing its PID or streams. Owner loss before the startup message closes the pipe, so the command never starts; after it, the tether stops the group. A partial message never executes. New-group runs require Node 26.10.0 or newer. The owner checks the exact semantic version and availability of process.execve before spawning the launcher or the tether. A runtime below the floor or without process.execve fails with typed SpawnFailed / ENOSYS at the call. Node 22 and 24 abort on a failed exec instead of returning its errno. The repository and the O6 and offload consumers pin Node 26.12.1.
    • Only end of file makes it signal. A line disarms it: the tether reads it and exits without signalling. When the run ends, after the group is confirmed gone, and when a child is released, before release returns, the package writes the tether one line before closing its pipe. So the tether never signals the group's ID once the group has gone, whatever order the pipe and the tether end in.
    • The SIGKILL lands slightly after the grace: about 1.1 s for a 1 s grace on macOS and 1.0 s on Linux. The tether counts the grace in 100 ms polls, and each poll forks a sleep.
    • How the tether is owned and reaped. While the owner lives, the tether belongs to the run. After its disarming line the package waits up to terminationGrace for it to exit, and stops one still running with SIGTERM. After the owner dies, init or the nearest subreaper reaps it, at most about twice terminationGrace later. It starts nothing that outlives it.
    • A child handed off by release is exempt. The hand-off is how a child outlives its owner on purpose.
    • Under processGroup: "inherit" there is no tether. The child shares the owner's group, and a carrier lease in @inkeep/impulse-ssh relies on such a child outliving its owner.
    • A tether that cannot be started fails the run as SpawnFailed, once the child has been stopped.
    • A spawner you substitute sees the tether too. It is spawned through your ChildProcessSpawner as /bin/sh -c <script> owned-process-tether <pgid> <polls>, so a double must answer it: a process that ends when its stdin receives a line, or when it is killed, is enough. One that ignores its stdin holds each run's end for up to terminationGrace. The command itself first appears as Node running internal/launch, with fd 3 carrying the startup message and fd 4 reporting exec errors. Node marks inherited descriptors close-on-exec during startup, so neither startup descriptor reaches the command; a failed exec leaves fd 4 open to report the errno. A replacement spawner must consume fd 3 and close fd 4 for a successful startup, or report a JSON object with a code on fd 4. Executable and environment values travel in the pipe, never argv.
  • release hands a child off. It takes only a child with no pipe (no stdin, ignore on both outputs), reads its start identity while the package still holds it, and returns a HandOff. Signal a released pid only after sameProcess(identity) answers same.
  • The start identity is /bin/ps -o lstart= -p <pid> under LC_ALL=C and TZ=UTC. Its checks pass on macOS and on Linux (Ubuntu 26.04.1, procps-ng 4.0.4, run on O6-H1 on 2026-10-22). gone means the pid answered ESRCH; a ps read that fails while the pid lives is a ProcessError, never gone.

Checks

pnpm test runs the Vitest suite against real child processes: process groups, signals, deadlines, output caps, stdin, lines, identity and release, plus the effect/process behaviours the package relies on (test/effect-contract.test.ts). The descriptor-inheritance check uses /usr/bin/python3 to call fstat without Node opening new descriptors at the same numbers. The packages suite in scripts/ci/suites.mjs runs it nightly.

The repository pins effect, @effect/platform-node and @effect/vitest to 4.1.2. The contract tests select their expectations from the installed @effect/platform-node-shared version, including the process-group behavior introduced in 4.0.7.