stitchkit 0.90.0 → 0.90.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/agent-runtime/coding-tool-refusals.d.ts +31 -10
  3. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  4. package/dist/agent-runtime/spill.d.ts.map +1 -1
  5. package/dist/agent-runtime-coding-tools.js +4 -4
  6. package/dist/agent-runtime-harness.js +5 -5
  7. package/dist/agent-runtime-sandbox.js +5 -5
  8. package/dist/agent-runtime.js +17 -29
  9. package/dist/application-grammy.js +1 -1
  10. package/dist/application.js +2 -2
  11. package/dist/cli.js +7 -7
  12. package/dist/contract/errors.d.ts +3 -0
  13. package/dist/contract/errors.d.ts.map +1 -1
  14. package/dist/contract/index.js +2 -2
  15. package/dist/{index-qmgs7y68.js → index-1txvygak.js} +1 -1
  16. package/dist/{index-8c3a7m4g.js → index-2hrfpw2c.js} +1 -1
  17. package/dist/{index-7evdsyez.js → index-2hryh65w.js} +1 -1
  18. package/dist/{index-zyvby92n.js → index-44ht2790.js} +2 -2
  19. package/dist/{index-27gm3d6g.js → index-6q3zjwaz.js} +2 -2
  20. package/dist/{index-mnm4qp0p.js → index-79hb1wyh.js} +3 -3
  21. package/dist/{index-apn8repm.js → index-7gqx71yd.js} +2 -2
  22. package/dist/{index-7601qfg1.js → index-8dph3pw6.js} +4 -4
  23. package/dist/{index-90d7h2cr.js → index-bg8ypxzn.js} +3 -3
  24. package/dist/{index-vchzar7e.js → index-db51n3xr.js} +5 -5
  25. package/dist/{index-hw2chdvy.js → index-f475yj00.js} +1 -1
  26. package/dist/{index-q3ve2d1k.js → index-gbqjt8jz.js} +3 -3
  27. package/dist/index-gte38nbm.js +101 -0
  28. package/dist/{index-cp20z0n6.js → index-j7q0xj6d.js} +7 -55
  29. package/dist/{index-2bxcmqkb.js → index-kazec06k.js} +1 -1
  30. package/dist/{index-0w9abg87.js → index-scs3f1eg.js} +3 -0
  31. package/dist/{index-31jw8fjq.js → index-wb15909q.js} +1 -1
  32. package/dist/{index-p18f59zy.js → index-z78bjcxj.js} +1 -1
  33. package/dist/{index-t7fkyxcr.js → index-zkcqhxx8.js} +1 -1
  34. package/dist/index.js +6 -6
  35. package/dist/node.js +6 -6
  36. package/dist/observability/index.js +3 -3
  37. package/dist/primitives.js +2 -2
  38. package/dist/remote.js +5 -5
  39. package/dist/server/index.js +8 -8
  40. package/dist/testing.js +6 -6
  41. package/dist/tool-invoker.js +6 -6
  42. package/dist/tools.js +11 -11
  43. package/dist/tracking.js +2 -2
  44. package/llms-full.txt +13 -3
  45. package/package.json +1 -1
  46. package/dist/index-gskm1k5a.js +0 -50
package/CHANGELOG.md CHANGED
@@ -15,6 +15,70 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.90.2] — 2026-09-15
19
+
20
+ ### Fixed
21
+
22
+ - **The guide's list of stitchkit's own error codes is held against the
23
+ registry.** `docs/guide/auth-and-errors.md` enumerates `STITCH_ERROR_STATUS`
24
+ in prose so it can be read, and the guide warns about itself that the
25
+ enumeration is what goes stale — naming one drift that stopped a consumer's
26
+ map compiling. Nothing stood behind the warning, and the list had gone stale
27
+ again: five of thirty-one codes were missing (`STREAM_ITEM_INVALID`,
28
+ `STREAM_FRAME_TOO_LARGE`, `STREAM_TERMINAL_MISSING`,
29
+ `STREAM_LIFETIME_EXCEEDED`, `GRAMMY_WEBHOOK_NOT_ACCEPTING`) while every gate
30
+ in the repository, `error-registry-completeness` included, stayed green. The
31
+ list is now complete and checked for set equality in both directions: a
32
+ missing code sends a reader hunting for a vocabulary that is already
33
+ published, an invented one sends them to map a code the framework never
34
+ throws.
35
+
36
+ ## [0.90.1] — 2026-09-15
37
+
38
+ ### Fixed
39
+
40
+ - **An unknown spilled-output reference is a refusal, not a server fault.** The
41
+ SQLite spill store threw a bare `TypeError('Unknown spill reference')`, which
42
+ is not an `AppError`, so `toolResultFromError` scrubbed it to
43
+ `{"error":"INTERNAL_SERVER_ERROR","details":{"message":"Internal server
44
+ error"}}`. A model that passed the wrong identifier — a background terminal
45
+ session id where a spill reference was wanted — could not tell "fix the
46
+ argument" from "the store is broken"; in the run this was reported from, it
47
+ retried the same call three times and declared the tool broken. It now refuses
48
+ with `SPILL_REFERENCE_UNKNOWN` / 404, naming the reference and hinting at the
49
+ one the spilling command returned. Authorization, `read` and `search` shared
50
+ three copies of the lookup and its refusal; they now share one, so the answer
51
+ cannot differ by path. The lookup is scoped by conversation, so a reference
52
+ held by another conversation refuses identically and discloses nothing.
53
+
54
+ - **A coding-tool refusal keeps its declared status across a process boundary.**
55
+ Those refusals carried their own private `code → status` map, while
56
+ `toolErrorFromResult` — which rebuilds an envelope that reached another
57
+ process through MCP or the CLI — resolves the status from
58
+ `STITCH_ERROR_STATUS`. Every refusal code missing from that map came back
59
+ `500`: measured, `SANDBOX_UNAVAILABLE` → 500 against its declared 503, with
60
+ `NOT_FOUND` → 404 and `WAIT_TIMEOUT` → 408 as controls. `SANDBOX_UNAVAILABLE`,
61
+ `SANDBOX_INSUFFICIENT` and `SPILL_REFERENCE_UNKNOWN` join the framework
62
+ vocabulary, and the refusal list is now an allowlist of names typed against
63
+ it — a refusal code absent from the framework map is a compile error rather
64
+ than a 500 on the wire.
65
+
66
+ - **The mechanical refusal gate can see the artifact tools.** It enumerates
67
+ mounted coding tools and refuses one with no registered refusal, and
68
+ `read_output` / `search_output` are mounted only when an artifact store is —
69
+ which the gate's own profile did not do. "Every tool has a refusal" was
70
+ vacuously true for exactly the two tools that had none.
71
+ `packages/core/tests/coding-tool-refusals.test.ts` now mounts a real spill
72
+ store.
73
+
74
+ - **Heavy release lanes no longer count memory that swap cannot back.**
75
+ `verify --release` sized its lane concurrency from `MemAvailable` alone. On a
76
+ host whose swap was 97% consumed that read 9.2 GiB and chose two lanes, and
77
+ the pair was killed; with swap exhausted the reclaimable half of that figure
78
+ is not reclaimable. It now falls back to `MemFree` when free swap is under 5%
79
+ of swap total — 0.97 GiB and one lane on the host that prompted this — and
80
+ says `GiB affordable` rather than `GiB available`.
81
+
18
82
  ## [0.90.0] — 2026-09-15
19
83
 
20
84
  ### ⚠️ Breaking changes
@@ -16,16 +16,19 @@
16
16
  * knows; `contained-files.ts` stays `AppError`-free, and everything it throws
17
17
  * keeps being scrubbed. Default-deny: a cause with no case here is internal.
18
18
  */
19
- /** Codes a coding tool may hand a model, with the status each one carries. */
20
- declare const REFUSAL_STATUS: {
21
- readonly BAD_REQUEST: 400;
22
- readonly FORBIDDEN: 403;
23
- readonly NOT_FOUND: 404;
24
- readonly CONFLICT: 409;
25
- readonly SANDBOX_UNAVAILABLE: 503;
26
- readonly SANDBOX_INSUFFICIENT: 503;
27
- };
28
- export type CodingRefusalCode = keyof typeof REFUSAL_STATUS;
19
+ /**
20
+ * The codes a coding tool may hand a model — an allowlist of names, not a
21
+ * second status map.
22
+ *
23
+ * It used to carry its own `code → status` object, and the two maps disagreed
24
+ * where it mattered: `toolErrorFromResult` rebuilds an envelope that crossed a
25
+ * process boundary and reads the status from `STITCH_ERROR_STATUS`, so a
26
+ * refusal missing there arrived as a 500 no matter what this file declared.
27
+ * `satisfies readonly StitchErrorCode[]` now makes that unrepresentable — a
28
+ * refusal code absent from the framework vocabulary is a compile error here.
29
+ */
30
+ declare const REFUSAL_CODES: readonly ["BAD_REQUEST", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "SANDBOX_UNAVAILABLE", "SANDBOX_INSUFFICIENT", "SPILL_REFERENCE_UNKNOWN"];
31
+ export type CodingRefusalCode = (typeof REFUSAL_CODES)[number];
29
32
  /**
30
33
  * Refuse with a reason the model actually receives.
31
34
  *
@@ -57,5 +60,23 @@ export declare function codingPathRefusal(code: CodingRefusalCode, message: stri
57
60
  * model can do about it, and keeps being scrubbed. Default-deny by omission.
58
61
  */
59
62
  export declare function refuseMissingCodingPath(error: unknown, relative: string): never;
63
+ /**
64
+ * Refuse a spill reference the store does not hold.
65
+ *
66
+ * The same failure this module was written for, one layer down. The SQLite
67
+ * spill store threw a bare `TypeError('Unknown spill reference')`, which is not
68
+ * an `AppError`, so `toolResultFromError` scrubbed it to an empty
69
+ * `INTERNAL_SERVER_ERROR`: a model that passed the wrong identifier — a
70
+ * background terminal session id instead of a spill reference — could not tell
71
+ * "fix the argument" from "the store is broken". Observed: it retried the same
72
+ * call three times and declared the tool broken.
73
+ *
74
+ * The reference is echoed back because it is the model's own input: naming it
75
+ * tells the model which of its arguments to replace, and leaks nothing it did
76
+ * not already send. A reference belonging to ANOTHER conversation refuses
77
+ * through this same path — the lookup is scoped by conversation, so a foreign
78
+ * reference is simply absent, and the refusal cannot distinguish the two.
79
+ */
80
+ export declare function refuseUnknownSpillReference(reference: string): never;
60
81
  export {};
61
82
  //# sourceMappingURL=coding-tool-refusals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coding-tool-refusals.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-refusals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,8EAA8E;AAC9E,QAAA,MAAM,cAAc;aAClB,WAAW,EAAE,GAAG;aAChB,SAAS,EAAE,GAAG;aACd,SAAS,EAAE,GAAG;aACd,QAAQ,EAAE,GAAG;aACb,mBAAmB,EAAE,GAAG;aACxB,oBAAoB,EAAE,GAAG;CACjB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACjE,KAAK,CAQP;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CA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;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CASpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"spill.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/spill.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAkBxD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,uBAAuB,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB,GAAG,wBAAwB,GAAG;IAC7B,MAAM,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;QAClF,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,OAAO,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD,CAqHA"}
1
+ {"version":3,"file":"spill.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/spill.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAkBxD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,uBAAuB,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB,GAAG,wBAAwB,GAAG;IAC7B,MAAM,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;QAClF,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,OAAO,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD,CAgHA"}
@@ -3,12 +3,12 @@ import {
3
3
  AgentCodingToolLimitsSchema,
4
4
  AgentCodingToolPathAuthorizationSchema,
5
5
  createAgentCodingTools
6
- } from "./index-cp20z0n6.js";
6
+ } from "./index-j7q0xj6d.js";
7
7
  import"./index-bn2cjajt.js";
8
- import"./index-gskm1k5a.js";
9
- import"./index-2bxcmqkb.js";
8
+ import"./index-gte38nbm.js";
9
+ import"./index-kazec06k.js";
10
10
  import"./index-6k1937bx.js";
11
- import"./index-0w9abg87.js";
11
+ import"./index-scs3f1eg.js";
12
12
  import"./index-kzfs85xp.js";
13
13
  import"./index-kc6h6hg0.js";
14
14
  import"./index-r159gjwy.js";
@@ -6,7 +6,7 @@ import {
6
6
  composeAgentPrompt,
7
7
  createAgentRuntime,
8
8
  createAgentRuntimeEventSink
9
- } from "./index-hw2chdvy.js";
9
+ } from "./index-f475yj00.js";
10
10
  import"./index-p13mwz16.js";
11
11
  import"./index-y64k3s0h.js";
12
12
  import {
@@ -19,13 +19,13 @@ import {
19
19
  walkContainedFiles
20
20
  } from "./index-bn2cjajt.js";
21
21
  import"./index-7rkhw9ec.js";
22
- import"./index-zyvby92n.js";
22
+ import"./index-44ht2790.js";
23
23
  import"./index-vsbzgd7b.js";
24
24
  import"./index-f9mb610r.js";
25
- import"./index-7evdsyez.js";
26
- import"./index-2bxcmqkb.js";
25
+ import"./index-2hryh65w.js";
26
+ import"./index-kazec06k.js";
27
27
  import"./index-6k1937bx.js";
28
- import"./index-0w9abg87.js";
28
+ import"./index-scs3f1eg.js";
29
29
  import"./index-zcgf3gqf.js";
30
30
  import"./index-7zbps32p.js";
31
31
  import"./index-kzfs85xp.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
- codingRefusal,
3
2
  createAgentCodingTools
4
- } from "./index-cp20z0n6.js";
3
+ } from "./index-j7q0xj6d.js";
5
4
  import"./index-bn2cjajt.js";
6
5
  import {
6
+ codingRefusal,
7
7
  missingSandboxRestrictions,
8
8
  probeAgentProcessSandbox
9
- } from "./index-gskm1k5a.js";
10
- import"./index-2bxcmqkb.js";
9
+ } from "./index-gte38nbm.js";
10
+ import"./index-kazec06k.js";
11
11
  import"./index-6k1937bx.js";
12
- import"./index-0w9abg87.js";
12
+ import"./index-scs3f1eg.js";
13
13
  import"./index-kzfs85xp.js";
14
14
  import"./index-kc6h6hg0.js";
15
15
  import"./index-r159gjwy.js";
@@ -31,7 +31,7 @@ import {
31
31
  renderAgentStateSlots,
32
32
  repairedSearchCall,
33
33
  selectAgentHistory
34
- } from "./index-hw2chdvy.js";
34
+ } from "./index-f475yj00.js";
35
35
  import"./index-p13mwz16.js";
36
36
  import {
37
37
  AgentAdmissionEventSchema,
@@ -163,22 +163,23 @@ import {
163
163
  AgentSandboxRestrictionSchema,
164
164
  missingSandboxRestrictions,
165
165
  probeAgentProcessSandbox,
166
- recordAgentSandboxProbe
167
- } from "./index-gskm1k5a.js";
166
+ recordAgentSandboxProbe,
167
+ refuseUnknownSpillReference
168
+ } from "./index-gte38nbm.js";
168
169
  import {
169
170
  buildToolManifest,
170
171
  mountAgent
171
- } from "./index-q3ve2d1k.js";
172
+ } from "./index-gbqjt8jz.js";
172
173
  import"./index-7rkhw9ec.js";
173
- import"./index-31jw8fjq.js";
174
- import"./index-8c3a7m4g.js";
175
- import"./index-zyvby92n.js";
174
+ import"./index-wb15909q.js";
175
+ import"./index-2hrfpw2c.js";
176
+ import"./index-44ht2790.js";
176
177
  import"./index-vsbzgd7b.js";
177
178
  import"./index-f9mb610r.js";
178
- import"./index-7evdsyez.js";
179
- import"./index-2bxcmqkb.js";
179
+ import"./index-2hryh65w.js";
180
+ import"./index-kazec06k.js";
180
181
  import"./index-6k1937bx.js";
181
- import"./index-0w9abg87.js";
182
+ import"./index-scs3f1eg.js";
182
183
  import {
183
184
  childSpan,
184
185
  createTraceContext
@@ -2258,16 +2259,17 @@ function decodeAuthorization(value) {
2258
2259
  function createSqliteAgentSpillStore(input) {
2259
2260
  const now = input.now ?? (() => new Date);
2260
2261
  const database = input.sqlite.database;
2261
- const authorization = (reference) => {
2262
+ const rowFor = (reference) => {
2262
2263
  const raw = database.prepare(`
2263
2264
  SELECT payload, bytes, authorization_payload
2264
2265
  FROM stitchkit_agent_runtime_spills
2265
2266
  WHERE reference_id = ? AND conversation_id = ?
2266
2267
  `).get(reference, input.conversationId);
2267
2268
  if (raw === null || raw === undefined)
2268
- throw new TypeError("Unknown spill reference");
2269
- return decodeAuthorization(SpillRowSchema.parse(raw).authorization_payload);
2269
+ refuseUnknownSpillReference(reference);
2270
+ return SpillRowSchema.parse(raw);
2270
2271
  };
2272
+ const authorization = (reference) => decodeAuthorization(rowFor(reference).authorization_payload);
2271
2273
  const write = async (request) => {
2272
2274
  const reference = randomUUID3();
2273
2275
  const createdAt = now();
@@ -2290,14 +2292,7 @@ function createSqliteAgentSpillStore(input) {
2290
2292
  return { reference };
2291
2293
  };
2292
2294
  const read = async (request) => {
2293
- const raw = database.prepare(`
2294
- SELECT payload, bytes, authorization_payload
2295
- FROM stitchkit_agent_runtime_spills
2296
- WHERE reference_id = ? AND conversation_id = ?
2297
- `).get(request.reference, input.conversationId);
2298
- if (raw === null || raw === undefined)
2299
- throw new TypeError("Unknown spill reference");
2300
- const row = SpillRowSchema.parse(raw);
2295
+ const row = rowFor(request.reference);
2301
2296
  return {
2302
2297
  data: row.payload.slice(request.offset, request.offset + request.maxBytes),
2303
2298
  totalBytes: row.bytes,
@@ -2307,14 +2302,7 @@ function createSqliteAgentSpillStore(input) {
2307
2302
  };
2308
2303
  };
2309
2304
  const search = (request) => {
2310
- const raw = database.prepare(`
2311
- SELECT payload, bytes, authorization_payload
2312
- FROM stitchkit_agent_runtime_spills
2313
- WHERE reference_id = ? AND conversation_id = ?
2314
- `).get(request.reference, input.conversationId);
2315
- if (raw === null || raw === undefined)
2316
- throw new TypeError("Unknown spill reference");
2317
- const row = SpillRowSchema.parse(raw);
2305
+ const row = rowFor(request.reference);
2318
2306
  const matches = [];
2319
2307
  new TextDecoder("utf-8", { fatal: true }).decode(row.payload).split(`
2320
2308
  `).forEach((text, index) => {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-2k4yrqkc.js";
4
4
  import {
5
5
  AppError
6
- } from "./index-0w9abg87.js";
6
+ } from "./index-scs3f1eg.js";
7
7
 
8
8
  // src/application/grammy.ts
9
9
  import { Context } from "grammy";
@@ -36,7 +36,7 @@ import {
36
36
  ApplicationShutdownBudgetSchema,
37
37
  ApplicationShutdownOptionsSchema,
38
38
  createApplication
39
- } from "./index-t7fkyxcr.js";
39
+ } from "./index-zkcqhxx8.js";
40
40
  import {
41
41
  ApplicationAdmissionSnapshotSchema,
42
42
  ApplicationHealthSchema,
@@ -87,7 +87,7 @@ import {
87
87
  argumentsDigest,
88
88
  stableValue
89
89
  } from "./index-a916km3r.js";
90
- import"./index-0w9abg87.js";
90
+ import"./index-scs3f1eg.js";
91
91
  import"./index-kzfs85xp.js";
92
92
  import"./index-77fekveh.js";
93
93
  // src/application/admission.ts
package/dist/cli.js CHANGED
@@ -5,17 +5,17 @@ import {
5
5
  emitResult,
6
6
  parseCliArgs,
7
7
  pollUntilDone
8
- } from "./index-7601qfg1.js";
8
+ } from "./index-8dph3pw6.js";
9
9
  import"./index-sbdmyz75.js";
10
- import"./index-31jw8fjq.js";
11
- import"./index-8c3a7m4g.js";
12
- import"./index-zyvby92n.js";
10
+ import"./index-wb15909q.js";
11
+ import"./index-2hrfpw2c.js";
12
+ import"./index-44ht2790.js";
13
13
  import"./index-vsbzgd7b.js";
14
14
  import"./index-f9mb610r.js";
15
- import"./index-7evdsyez.js";
16
- import"./index-2bxcmqkb.js";
15
+ import"./index-2hryh65w.js";
16
+ import"./index-kazec06k.js";
17
17
  import"./index-6k1937bx.js";
18
- import"./index-0w9abg87.js";
18
+ import"./index-scs3f1eg.js";
19
19
  import"./index-zcgf3gqf.js";
20
20
  import"./index-7zbps32p.js";
21
21
  import"./index-kzfs85xp.js";
@@ -92,6 +92,9 @@ export declare const STITCH_ERROR_STATUS: {
92
92
  STREAM_FRAME_TOO_LARGE: number;
93
93
  STREAM_TERMINAL_MISSING: number;
94
94
  STREAM_LIFETIME_EXCEEDED: number;
95
+ SANDBOX_UNAVAILABLE: number;
96
+ SANDBOX_INSUFFICIENT: number;
97
+ SPILL_REFERENCE_UNKNOWN: number;
95
98
  INTERNAL_SERVER_ERROR: number;
96
99
  };
97
100
  /** A code stitchkit itself emits — derived from `STITCH_ERROR_STATUS` (no dup). */
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/contract/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,2CAA2C;QAC3C,IAAI,EAAE,MAAM,CAAC;QACb,8BAA8B;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,gCAAgC;QAChC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,0BAA0B;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAcD;;;;GAIG;AACH,qBAAa,QAAQ,CACnB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAA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+ } from "../index-kazec06k.js";
12
12
  import {
13
13
  ManagedFilePathSchema,
14
14
  ManagedFileRefSchema
@@ -24,7 +24,7 @@ import {
24
24
  notFound,
25
25
  rateLimited,
26
26
  unauthorized
27
- } from "../index-0w9abg87.js";
27
+ } from "../index-scs3f1eg.js";
28
28
  import"../index-kzfs85xp.js";
29
29
  import"../index-77fekveh.js";
30
30
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeError
3
- } from "./index-7evdsyez.js";
3
+ } from "./index-2hryh65w.js";
4
4
 
5
5
  // src/internal/bounded-lines.ts
6
6
  var DEFAULT_STREAM_LINE_BYTES = 1024 * 1024;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  executeToolMethod
3
- } from "./index-zyvby92n.js";
3
+ } from "./index-44ht2790.js";
4
4
  import {
5
5
  assertToolExtensionCompatible,
6
6
  mergeSchemas,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AppError
3
- } from "./index-0w9abg87.js";
3
+ } from "./index-scs3f1eg.js";
4
4
  import {
5
5
  isRecord
6
6
  } from "./index-77fekveh.js";
@@ -6,12 +6,12 @@ import {
6
6
  formatZodError,
7
7
  normalizeError,
8
8
  validateDeclaredOutput
9
- } from "./index-7evdsyez.js";
9
+ } from "./index-2hryh65w.js";
10
10
  import {
11
11
  AppError,
12
12
  STITCH_ERROR_STATUS,
13
13
  isStitchErrorCode
14
- } from "./index-0w9abg87.js";
14
+ } from "./index-scs3f1eg.js";
15
15
  import {
16
16
  coerceJsonArgs
17
17
  } from "./index-7zbps32p.js";
@@ -3,7 +3,7 @@ import {
3
3
  inputIsQuery,
4
4
  parseSSE,
5
5
  readBoundedUtf8Lines
6
- } from "./index-qmgs7y68.js";
6
+ } from "./index-1txvygak.js";
7
7
  import {
8
8
  ApiError,
9
9
  RequestCancellationError,
@@ -16,7 +16,7 @@ import {
16
16
  ContractStreamFrameSchema,
17
17
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
18
18
  parseTrailingWildcard
19
- } from "./index-2bxcmqkb.js";
19
+ } from "./index-kazec06k.js";
20
20
  import {
21
21
  isRecord,
22
22
  mapObject,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  collectTools,
3
3
  createToolRunner
4
- } from "./index-8c3a7m4g.js";
4
+ } from "./index-2hrfpw2c.js";
5
5
  import {
6
6
  toolErrorFromResult
7
- } from "./index-zyvby92n.js";
7
+ } from "./index-44ht2790.js";
8
8
  import {
9
9
  AppError
10
- } from "./index-0w9abg87.js";
10
+ } from "./index-scs3f1eg.js";
11
11
  import {
12
12
  assertUniqueToolName
13
13
  } from "./index-r159gjwy.js";
@@ -4,10 +4,10 @@ import {
4
4
  } from "./index-2qzskm8h.js";
5
5
  import {
6
6
  zodIssues
7
- } from "./index-7evdsyez.js";
7
+ } from "./index-2hryh65w.js";
8
8
  import {
9
9
  AppError
10
- } from "./index-0w9abg87.js";
10
+ } from "./index-scs3f1eg.js";
11
11
 
12
12
  // src/realtime/rejected-frame.ts
13
13
  var REALTIME_REJECTION_KEY = "@stitchkit/realtime-rejected";
@@ -3,18 +3,18 @@ import {
3
3
  } from "./index-sbdmyz75.js";
4
4
  import {
5
5
  collectToolSurface
6
- } from "./index-31jw8fjq.js";
6
+ } from "./index-wb15909q.js";
7
7
  import {
8
8
  createToolRunner,
9
9
  formatToolError
10
- } from "./index-8c3a7m4g.js";
10
+ } from "./index-2hrfpw2c.js";
11
11
  import {
12
12
  toolResultFromError
13
- } from "./index-zyvby92n.js";
13
+ } from "./index-44ht2790.js";
14
14
  import {
15
15
  formatZodError,
16
16
  validateDeclaredOutput
17
- } from "./index-7evdsyez.js";
17
+ } from "./index-2hryh65w.js";
18
18
  import {
19
19
  coerceJsonArgs
20
20
  } from "./index-7zbps32p.js";
@@ -2,15 +2,15 @@ import {
2
2
  contextContributionDelta,
3
3
  mergeContextContribution,
4
4
  prepareContextContribution
5
- } from "./index-p18f59zy.js";
5
+ } from "./index-z78bjcxj.js";
6
6
  import {
7
7
  base64UrlToBytes,
8
8
  bytesToBase64Url
9
- } from "./index-2bxcmqkb.js";
9
+ } from "./index-kazec06k.js";
10
10
  import {
11
11
  forbidden,
12
12
  unauthorized
13
- } from "./index-0w9abg87.js";
13
+ } from "./index-scs3f1eg.js";
14
14
  import {
15
15
  isUnsafeKey,
16
16
  safeJsonParse
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  createValidatedRealtimeSocket,
12
12
  isModuleNotFound
13
- } from "./index-apn8repm.js";
13
+ } from "./index-7gqx71yd.js";
14
14
  import {
15
15
  DEFAULT_PROCESS_SIGNALS,
16
16
  RUNTIME_CONTEXT_RESERVED_KEYS,
@@ -22,7 +22,7 @@ import {
22
22
  isOriginAllowed,
23
23
  mediaTypeEssence,
24
24
  reportSignalError
25
- } from "./index-p18f59zy.js";
25
+ } from "./index-z78bjcxj.js";
26
26
  import {
27
27
  getRequestContext,
28
28
  runWithRequestContext,
@@ -41,17 +41,17 @@ import {
41
41
  normalizeError,
42
42
  recordedErrorMessage,
43
43
  validateDeclaredOutput
44
- } from "./index-7evdsyez.js";
44
+ } from "./index-2hryh65w.js";
45
45
  import {
46
46
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
47
47
  joinRoutePath,
48
48
  parseTrailingWildcard
49
- } from "./index-2bxcmqkb.js";
49
+ } from "./index-kazec06k.js";
50
50
  import {
51
51
  AppError,
52
52
  badRequest,
53
53
  forbidden
54
- } from "./index-0w9abg87.js";
54
+ } from "./index-scs3f1eg.js";
55
55
  import {
56
56
  resolveTraceContext
57
57
  } from "./index-zcgf3gqf.js";
@@ -36,7 +36,7 @@ import {
36
36
  import {
37
37
  ToolExecutionControlError,
38
38
  isToolExecutionControlError
39
- } from "./index-zyvby92n.js";
39
+ } from "./index-44ht2790.js";
40
40
  import {
41
41
  isRecord,
42
42
  transportResult
@@ -4,16 +4,16 @@ import {
4
4
  } from "./index-7rkhw9ec.js";
5
5
  import {
6
6
  collectToolSurface
7
- } from "./index-31jw8fjq.js";
7
+ } from "./index-wb15909q.js";
8
8
  import {
9
9
  createToolRunner,
10
10
  formatToolError
11
- } from "./index-8c3a7m4g.js";
11
+ } from "./index-2hrfpw2c.js";
12
12
  import {
13
13
  isToolExecutionControlError,
14
14
  toolCauseFromResult,
15
15
  toolResultFromError
16
- } from "./index-zyvby92n.js";
16
+ } from "./index-44ht2790.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./index-77fekveh.js";