stitchkit 0.105.1 → 0.105.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +2 -2
- package/dist/entrypoints/agent-runtime/sandbox.js +2 -2
- package/dist/entrypoints/process.js +1 -1
- package/dist/{index-5c26631f.js → index-3s86a7kf.js} +6 -1
- package/dist/{index-y7k2cdgv.js → index-sevbwsnn.js} +1 -1
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/contract.d.ts +6 -0
- package/dist/process/contract.d.ts.map +1 -1
- package/llms/process.txt +13 -9
- package/llms-full.txt +13 -9
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,21 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.105.2] - 2026-10-06
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `stitchkit/process` — `runNativeCommand` takes `onLeaderStarted({ pid })`, called once right
|
|
23
|
+
after the leader exists (a throw stops the command with that error), and `drainTimeoutMs`,
|
|
24
|
+
which bounds how long the output pipes may stay open after the leader exited: a holder that
|
|
25
|
+
left the group with `setsid` otherwise keeps the command waiting until `timeoutMs` or the
|
|
26
|
+
signal, and with the bound it ends with `COMMAND_CLEANUP`.
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
|
|
30
|
+
- `stitchkit/process` — the native IO guide no longer says that `cleanupTimeoutMs` bounds the drain
|
|
31
|
+
after the leader exited; it bounds the wait after a stop, and `drainTimeoutMs` bounds the drain.
|
|
32
|
+
|
|
18
33
|
## [0.105.1] - 2026-10-06
|
|
19
34
|
|
|
20
35
|
### Added
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
AgentCodingToolAuthorizationSchema2,
|
|
8
8
|
AgentCodingToolPathAuthorizationSchema2,
|
|
9
9
|
createAgentCodingTools2
|
|
10
|
-
} from "../../index-
|
|
10
|
+
} from "../../index-sevbwsnn.js";
|
|
11
11
|
import"../../index-v5ee8ath.js";
|
|
12
12
|
import"../../index-j4zh647a.js";
|
|
13
|
-
import"../../index-
|
|
13
|
+
import"../../index-3s86a7kf.js";
|
|
14
14
|
import"../../index-8ks9b85e.js";
|
|
15
15
|
import"../../index-gxm9rc97.js";
|
|
16
16
|
import"../../index-yvfk3y36.js";
|
|
@@ -9,7 +9,7 @@ import"../../index-r393tnfp.js";
|
|
|
9
9
|
import"../../index-rpzewktb.js";
|
|
10
10
|
import {
|
|
11
11
|
createAgentCodingTools2
|
|
12
|
-
} from "../../index-
|
|
12
|
+
} from "../../index-sevbwsnn.js";
|
|
13
13
|
import"../../index-v5ee8ath.js";
|
|
14
14
|
import"../../index-j4zh647a.js";
|
|
15
15
|
import {
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
nativeCommandOwner,
|
|
20
20
|
terminateOwnedGroup,
|
|
21
21
|
startNativeCommand
|
|
22
|
-
} from "../../index-
|
|
22
|
+
} from "../../index-3s86a7kf.js";
|
|
23
23
|
import"../../index-gxm9rc97.js";
|
|
24
24
|
import {
|
|
25
25
|
MAX_TIMER_MS
|
|
@@ -51,6 +51,8 @@ var NativeCommandOptionsSchema = z.strictObject({
|
|
|
51
51
|
maxStdinBytes: z.number().int().positive().default(1024 * 1024),
|
|
52
52
|
onOutput: z.custom((v) => typeof v === "function").optional(),
|
|
53
53
|
onLeaderSettled: z.custom((v) => typeof v === "function").optional(),
|
|
54
|
+
onLeaderStarted: z.custom((v) => typeof v === "function").optional(),
|
|
55
|
+
drainTimeoutMs: z.number().int().positive().max(MAX_TIMER_MS).optional(),
|
|
54
56
|
stop: NativeCommandStopPolicySchema.default({
|
|
55
57
|
target: "group",
|
|
56
58
|
signal: "SIGTERM",
|
|
@@ -748,7 +750,7 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
748
750
|
const stderr = [];
|
|
749
751
|
let total = 0;
|
|
750
752
|
const { stdout: output, stderr: errorOutput, leader, closed } = launched;
|
|
751
|
-
const cancelCloseDeadline = createLeaderCloseDeadline(leader, driver?.closeTimeoutMs, controller);
|
|
753
|
+
const cancelCloseDeadline = createLeaderCloseDeadline(leader, driver?.closeTimeoutMs ?? options.drainTimeoutMs, controller);
|
|
752
754
|
const drain = async (stream, channel, captured) => {
|
|
753
755
|
for await (const chunk of stream) {
|
|
754
756
|
if (controller.signal.aborted)
|
|
@@ -790,6 +792,9 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
790
792
|
const run = (async () => {
|
|
791
793
|
try {
|
|
792
794
|
launched.start();
|
|
795
|
+
const pid = acquired?.child.pid;
|
|
796
|
+
if (pid !== undefined)
|
|
797
|
+
options.onLeaderStarted?.({ pid });
|
|
793
798
|
const drains = Promise.all([
|
|
794
799
|
drain(output, "stdout", stdout),
|
|
795
800
|
drain(errorOutput, "stderr", stderr)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAIzE,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;AAMlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,EACzD,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAIzE,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;AAMlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,EACzD,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;EAiMnC"}
|
|
@@ -58,6 +58,12 @@ export declare const NativeCommandOptionsSchema: z.ZodObject<{
|
|
|
58
58
|
maxStdinBytes: z.ZodDefault<z.ZodNumber>;
|
|
59
59
|
onOutput: z.ZodOptional<z.ZodCustom<(bytes: Uint8Array, channel: 'stdout' | 'stderr', signal: AbortSignal) => void | Promise<void>, (bytes: Uint8Array, channel: 'stdout' | 'stderr', signal: AbortSignal) => void | Promise<void>>>;
|
|
60
60
|
onLeaderSettled: z.ZodOptional<z.ZodCustom<(event: NativeCommandSettlement, signal: AbortSignal) => void | Promise<void>, (event: NativeCommandSettlement, signal: AbortSignal) => void | Promise<void>>>;
|
|
61
|
+
onLeaderStarted: z.ZodOptional<z.ZodCustom<(event: {
|
|
62
|
+
pid: number;
|
|
63
|
+
}) => void, (event: {
|
|
64
|
+
pid: number;
|
|
65
|
+
}) => void>>;
|
|
66
|
+
drainTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
61
67
|
stop: z.ZodDefault<z.ZodObject<{
|
|
62
68
|
target: z.ZodEnum<{
|
|
63
69
|
group: "group";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/process/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,QAAA,MAAM,6BAA6B;;;;;;;2BAOjC,CAAC;AACH;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC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 +298,18 @@ decoder and the operator sink stay with the application. Long signal-only comman
|
|
|
298
298
|
bounded tar or capture commands get their own explicit limits.
|
|
299
299
|
|
|
300
300
|
A child the caller holds until it exits is the same call. A guardian that forwards its own SIGTERM
|
|
301
|
-
passes an abort signal and `stop: { target: 'leader', signal: 'SIGTERM', graceMs }
|
|
302
|
-
|
|
303
|
-
with
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
group.
|
|
301
|
+
passes an abort signal and `stop: { target: 'leader', signal: 'SIGTERM', graceMs }`. It records the
|
|
302
|
+
pid in `onLeaderStarted({ pid })`, which runs once right after the leader exists (a throw stops the
|
|
303
|
+
command with that error), reads the exit code and signal in `onLeaderSettled` before the pipes
|
|
304
|
+
drain, and reads stderr through `onOutput` or `capture` with `maxOutputBytes`. `drainTimeoutMs`
|
|
305
|
+
bounds how long the output pipes may stay open after the leader exited: a holder that left the
|
|
306
|
+
group with `setsid` keeps them open, and without the option the command waits for it until
|
|
307
|
+
`timeoutMs` or the signal; with it the command ends with `COMMAND_CLEANUP` (a holder inside the
|
|
308
|
+
group is already stopped by `descendants`). A worker whose whole group must stop on abort is the
|
|
309
|
+
default `target: 'group'`. A child that inherits the caller's terminal is outside this
|
|
310
|
+
capability: every command runs in a group of its own, and a background group that reads the
|
|
311
|
+
terminal is stopped by the kernel (`SIGTTIN`), so an interactive re-execution stays a plain
|
|
312
|
+
spawn in the caller's group. Importing one leaf does not make
|
|
309
313
|
installing the whole npm package smaller; choose a dependency after measuring packed size and its
|
|
310
314
|
dependency closure.
|
|
311
315
|
|
|
@@ -570,7 +574,7 @@ Native POSIX Bun/Node one-shot command execution. See [native IO](../guide/nativ
|
|
|
570
574
|
| Export | Kind | Purpose |
|
|
571
575
|
|---|---|---|
|
|
572
576
|
| `runNativeCommand` | function | caller-lifetime streaming or explicitly bounded binary capture |
|
|
573
|
-
| `NativeCommandOptions` | type | executable/args, env policy, signal/deadline, bytes sink, finite cleanup limits, the `stop` policy and `descendants` (`'terminate-after-leader'`, the default: stop the group after the leader exits, or `'leave'`); an unknown key is refused by name, a removed one (`killGraceMs`) with its replacement |
|
|
577
|
+
| `NativeCommandOptions` | type | executable/args, env policy, signal/deadline, bytes sink, finite cleanup limits, the `stop` policy and `descendants` (`'terminate-after-leader'`, the default: stop the group after the leader exits, or `'leave'`); `onLeaderStarted({ pid })` (once, after the leader exists), `drainTimeoutMs` (bound on the pipes staying open after the leader exited, `COMMAND_CLEANUP`); an unknown key is refused by name, a removed one (`killGraceMs`) with its replacement |
|
|
574
578
|
| `NativeCommandStopPolicy` | type | how a cancelled command stops: `target` `'group'` (signal every member) or `'leader'` (signal only the leader; its exit ends the grace), `signal` (default `SIGTERM`), `graceMs` (at most one hour) before KILL to the group, and `killOn`, an `AbortSignal` that skips the grace; default `{ target: 'group', signal: 'SIGTERM', graceMs: 100 }` |
|
|
575
579
|
| `NativeCommandResult` | type | observed nullable exit code/signal, `descendantsStopped` (members left in the group after the leader exited were stopped) and captured stdout/stderr bytes |
|
|
576
580
|
| `NativeCommandError` | class | COMMAND_LIMIT with machine reason `deadline` or `output-budget`; COMMAND_UNAVAILABLE / COMMAND_CLEANUP have no limit reason. Preserves internal cause and existing constructor; caller-created limits without supplied reason remain unclassified |
|
package/llms-full.txt
CHANGED
|
@@ -8440,14 +8440,18 @@ decoder and the operator sink stay with the application. Long signal-only comman
|
|
|
8440
8440
|
bounded tar or capture commands get their own explicit limits.
|
|
8441
8441
|
|
|
8442
8442
|
A child the caller holds until it exits is the same call. A guardian that forwards its own SIGTERM
|
|
8443
|
-
passes an abort signal and `stop: { target: 'leader', signal: 'SIGTERM', graceMs }
|
|
8444
|
-
|
|
8445
|
-
with
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
group.
|
|
8443
|
+
passes an abort signal and `stop: { target: 'leader', signal: 'SIGTERM', graceMs }`. It records the
|
|
8444
|
+
pid in `onLeaderStarted({ pid })`, which runs once right after the leader exists (a throw stops the
|
|
8445
|
+
command with that error), reads the exit code and signal in `onLeaderSettled` before the pipes
|
|
8446
|
+
drain, and reads stderr through `onOutput` or `capture` with `maxOutputBytes`. `drainTimeoutMs`
|
|
8447
|
+
bounds how long the output pipes may stay open after the leader exited: a holder that left the
|
|
8448
|
+
group with `setsid` keeps them open, and without the option the command waits for it until
|
|
8449
|
+
`timeoutMs` or the signal; with it the command ends with `COMMAND_CLEANUP` (a holder inside the
|
|
8450
|
+
group is already stopped by `descendants`). A worker whose whole group must stop on abort is the
|
|
8451
|
+
default `target: 'group'`. A child that inherits the caller's terminal is outside this
|
|
8452
|
+
capability: every command runs in a group of its own, and a background group that reads the
|
|
8453
|
+
terminal is stopped by the kernel (`SIGTTIN`), so an interactive re-execution stays a plain
|
|
8454
|
+
spawn in the caller's group. Importing one leaf does not make
|
|
8451
8455
|
installing the whole npm package smaller; choose a dependency after measuring packed size and its
|
|
8452
8456
|
dependency closure.
|
|
8453
8457
|
|
|
@@ -22642,7 +22646,7 @@ Native POSIX Bun/Node one-shot command execution. See [native IO](../guide/nativ
|
|
|
22642
22646
|
| Export | Kind | Purpose |
|
|
22643
22647
|
|---|---|---|
|
|
22644
22648
|
| `runNativeCommand` | function | caller-lifetime streaming or explicitly bounded binary capture |
|
|
22645
|
-
| `NativeCommandOptions` | type | executable/args, env policy, signal/deadline, bytes sink, finite cleanup limits, the `stop` policy and `descendants` (`'terminate-after-leader'`, the default: stop the group after the leader exits, or `'leave'`); an unknown key is refused by name, a removed one (`killGraceMs`) with its replacement |
|
|
22649
|
+
| `NativeCommandOptions` | type | executable/args, env policy, signal/deadline, bytes sink, finite cleanup limits, the `stop` policy and `descendants` (`'terminate-after-leader'`, the default: stop the group after the leader exits, or `'leave'`); `onLeaderStarted({ pid })` (once, after the leader exists), `drainTimeoutMs` (bound on the pipes staying open after the leader exited, `COMMAND_CLEANUP`); an unknown key is refused by name, a removed one (`killGraceMs`) with its replacement |
|
|
22646
22650
|
| `NativeCommandStopPolicy` | type | how a cancelled command stops: `target` `'group'` (signal every member) or `'leader'` (signal only the leader; its exit ends the grace), `signal` (default `SIGTERM`), `graceMs` (at most one hour) before KILL to the group, and `killOn`, an `AbortSignal` that skips the grace; default `{ target: 'group', signal: 'SIGTERM', graceMs: 100 }` |
|
|
22647
22651
|
| `NativeCommandResult` | type | observed nullable exit code/signal, `descendantsStopped` (members left in the group after the leader exited were stopped) and captured stdout/stderr bytes |
|
|
22648
22652
|
| `NativeCommandError` | class | COMMAND_LIMIT with machine reason `deadline` or `output-budget`; COMMAND_UNAVAILABLE / COMMAND_CLEANUP have no limit reason. Preserves internal cause and existing constructor; caller-created limits without supplied reason remain unclassified |
|
package/llms.txt
CHANGED
|
@@ -56,7 +56,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
56
56
|
- **stitchkit/node**: [llms/node.txt](llms/node.txt) 3.1 KB
|
|
57
57
|
- **stitchkit/agent-runtime/react**: [llms/agent-runtime-react.txt](llms/agent-runtime-react.txt) 1.0 KB
|
|
58
58
|
- **stitchkit/agent-runtime/realtime**: [llms/agent-runtime-realtime.txt](llms/agent-runtime-realtime.txt) 2.6 KB
|
|
59
|
-
- **stitchkit/process**: [llms/process.txt](llms/process.txt)
|
|
59
|
+
- **stitchkit/process**: [llms/process.txt](llms/process.txt) 36.2 KB
|
|
60
60
|
- **stitchkit/files/packaging**: [llms/files-packaging.txt](llms/files-packaging.txt) 2.8 KB
|
|
61
61
|
|
|
62
62
|
## Upgrading slices
|
package/package.json
CHANGED