stitchkit 0.122.2 → 0.123.0

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 (194) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/browser/client.d.ts.map +1 -1
  3. package/dist/browser/contract-identity.d.ts +21 -0
  4. package/dist/browser/contract-identity.d.ts.map +1 -0
  5. package/dist/browser/unknown-operation.d.ts +3 -0
  6. package/dist/browser/unknown-operation.d.ts.map +1 -0
  7. package/dist/contract/define.d.ts +6 -2
  8. package/dist/contract/define.d.ts.map +1 -1
  9. package/dist/contract/endpoint-capabilities.d.ts.map +1 -1
  10. package/dist/contract/errors.d.ts +4 -0
  11. package/dist/contract/errors.d.ts.map +1 -1
  12. package/dist/contract/fingerprint.d.ts +51 -0
  13. package/dist/contract/fingerprint.d.ts.map +1 -0
  14. package/dist/contract/identity.d.ts +21 -0
  15. package/dist/contract/identity.d.ts.map +1 -0
  16. package/dist/contract/stream.d.ts +32 -0
  17. package/dist/contract/stream.d.ts.map +1 -1
  18. package/dist/entrypoints/agent-runtime/browser.js +2 -2
  19. package/dist/entrypoints/agent-runtime/coding-tools.js +11 -11
  20. package/dist/entrypoints/agent-runtime/harness.js +12 -12
  21. package/dist/entrypoints/agent-runtime/openrouter.js +1 -1
  22. package/dist/entrypoints/agent-runtime/realtime.js +2 -2
  23. package/dist/entrypoints/agent-runtime/sandbox.js +11 -11
  24. package/dist/entrypoints/agent-runtime/sqlite/bun.js +15 -15
  25. package/dist/entrypoints/agent-runtime/sqlite/node.js +15 -15
  26. package/dist/entrypoints/agent-runtime/testing.js +15 -15
  27. package/dist/entrypoints/agent-runtime.js +22 -22
  28. package/dist/entrypoints/application/diagnostic-journal.js +5 -5
  29. package/dist/entrypoints/application/directory-inbox.js +5 -5
  30. package/dist/entrypoints/application/grammy.js +1 -1
  31. package/dist/entrypoints/application.js +7 -7
  32. package/dist/entrypoints/cli/publish.js +5 -5
  33. package/dist/entrypoints/cli.d.ts +1 -1
  34. package/dist/entrypoints/cli.d.ts.map +1 -1
  35. package/dist/entrypoints/cli.js +20 -17
  36. package/dist/entrypoints/contract.d.ts +2 -0
  37. package/dist/entrypoints/contract.d.ts.map +1 -1
  38. package/dist/entrypoints/contract.js +11 -5
  39. package/dist/entrypoints/files/packaging.d.ts +1 -0
  40. package/dist/entrypoints/files/packaging.d.ts.map +1 -1
  41. package/dist/entrypoints/files/packaging.js +230 -61
  42. package/dist/entrypoints/files.js +5 -5
  43. package/dist/entrypoints/geo.js +3 -3
  44. package/dist/entrypoints/http.js +3 -3
  45. package/dist/entrypoints/index.d.ts +1 -0
  46. package/dist/entrypoints/index.d.ts.map +1 -1
  47. package/dist/entrypoints/index.js +45 -24
  48. package/dist/entrypoints/live.js +2 -2
  49. package/dist/entrypoints/node.js +11 -11
  50. package/dist/entrypoints/observability.js +4 -4
  51. package/dist/entrypoints/primitives.js +1 -1
  52. package/dist/entrypoints/process/owner-loss.js +2 -2
  53. package/dist/entrypoints/process.d.ts +6 -1
  54. package/dist/entrypoints/process.d.ts.map +1 -1
  55. package/dist/entrypoints/process.js +370 -9
  56. package/dist/entrypoints/react.js +2 -2
  57. package/dist/entrypoints/realtime.js +3 -3
  58. package/dist/entrypoints/remote.js +20 -10
  59. package/dist/entrypoints/server.d.ts +1 -0
  60. package/dist/entrypoints/server.d.ts.map +1 -1
  61. package/dist/entrypoints/server.js +56 -20
  62. package/dist/entrypoints/telegram/screens.js +4 -4
  63. package/dist/entrypoints/telegram.js +6 -6
  64. package/dist/entrypoints/testing.js +10 -10
  65. package/dist/entrypoints/tools/agent.js +9 -9
  66. package/dist/entrypoints/tools/connections.js +7 -7
  67. package/dist/entrypoints/tools/contract.js +1 -1
  68. package/dist/entrypoints/tools/invoker.js +7 -7
  69. package/dist/entrypoints/tools/mcp.js +9 -9
  70. package/dist/entrypoints/tools/toolkit.js +15 -14
  71. package/dist/entrypoints/tools.js +17 -17
  72. package/dist/entrypoints/tracking/contract.js +2 -2
  73. package/dist/entrypoints/tracking.js +1 -1
  74. package/dist/files/client-artifact.d.ts +75 -0
  75. package/dist/files/client-artifact.d.ts.map +1 -0
  76. package/dist/{index-am1h8c9v.js → index-0d3sm0m9.js} +5 -5
  77. package/dist/{index-72xtvcvr.js → index-0ndz5r8z.js} +1 -1
  78. package/dist/index-0v9xb8pz.js +66 -0
  79. package/dist/{index-qcn84byh.js → index-0w0hxp7n.js} +4 -0
  80. package/dist/{index-3za04re9.js → index-1c945ten.js} +1 -1
  81. package/dist/{index-r6v4mc67.js → index-1d7s7da0.js} +1 -1
  82. package/dist/{index-zsvzhjtk.js → index-20hn8pbh.js} +1 -1
  83. package/dist/{index-f6pw75e1.js → index-2x2ch0bt.js} +2 -2
  84. package/dist/{index-61hve0ez.js → index-303qne11.js} +1 -1
  85. package/dist/{index-g149e9pk.js → index-3bzk2645.js} +1 -1
  86. package/dist/index-45dyex0j.js +119 -0
  87. package/dist/{index-nwm3ww60.js → index-64b2dxqz.js} +1 -1
  88. package/dist/{index-aqwg2dm5.js → index-6k47xdtt.js} +2 -2
  89. package/dist/index-7q05ag0z.js +10 -0
  90. package/dist/{index-kz9734jc.js → index-96yjwwgf.js} +6 -5
  91. package/dist/{index-ff39f9dr.js → index-993vtv1w.js} +3 -3
  92. package/dist/{index-4jpykzvw.js → index-99nnsz39.js} +2 -2
  93. package/dist/{index-pfvde2fz.js → index-9ypczvpj.js} +1 -1
  94. package/dist/{index-qch1vcaa.js → index-a7ebd769.js} +2 -2
  95. package/dist/{index-98hv3sba.js → index-aw6kx2e6.js} +1 -1
  96. package/dist/{index-yj6saztf.js → index-bz9cmnqq.js} +96 -14
  97. package/dist/{index-mtwh9hyp.js → index-cjzaj7ev.js} +1 -1
  98. package/dist/{index-gtx3eknx.js → index-dv7pa9w6.js} +2 -2
  99. package/dist/{index-sa99p98w.js → index-eabx6qjh.js} +3 -3
  100. package/dist/{index-8yxgcyt6.js → index-egg0yp2j.js} +1 -1
  101. package/dist/{index-h1j71dr1.js → index-enkc9pem.js} +1 -1
  102. package/dist/{index-aqmadanx.js → index-fa53vygr.js} +2 -2
  103. package/dist/{index-e6c2spsd.js → index-fpwbskp2.js} +1 -1
  104. package/dist/{index-m8a44e64.js → index-ftk3838x.js} +1 -1
  105. package/dist/{index-j95jp7ee.js → index-gdqawggb.js} +1 -1
  106. package/dist/{index-9dyd8xzf.js → index-hkw233vx.js} +2 -2
  107. package/dist/{index-9jfdm5tg.js → index-hkxgennw.js} +7 -1
  108. package/dist/{index-qaqxdbxf.js → index-j8rda9n6.js} +7 -7
  109. package/dist/{index-4tyt1qya.js → index-jc5xgkpk.js} +2 -2
  110. package/dist/{index-s9a0fjh3.js → index-kffm4r8w.js} +1 -1
  111. package/dist/{index-5w6t91ze.js → index-m8ddk770.js} +1 -1
  112. package/dist/{index-2fc1k9k2.js → index-mdyhr36s.js} +32 -122
  113. package/dist/{index-r7a7r7ha.js → index-mfntvj58.js} +6 -3
  114. package/dist/{index-gq3fnq3f.js → index-n90tkkcv.js} +2 -2
  115. package/dist/{index-k42ckyzx.js → index-ndjzbt2v.js} +2 -2
  116. package/dist/{index-ycqhyars.js → index-qc7tq0za.js} +3 -3
  117. package/dist/{index-9frf01t9.js → index-r0xr7y4m.js} +1 -1
  118. package/dist/{index-s3yxw6kt.js → index-s512scra.js} +9 -7
  119. package/dist/{index-1h2zv8rx.js → index-sqc6ezrb.js} +41 -1
  120. package/dist/{index-2bqf0a74.js → index-sqkttz7z.js} +1 -1
  121. package/dist/{index-rbzq0q16.js → index-t8jz0e20.js} +1 -1
  122. package/dist/{index-8ryydawp.js → index-tt3ej8r3.js} +1 -1
  123. package/dist/{index-x4p3kw1p.js → index-tynna0n4.js} +6 -6
  124. package/dist/{index-72r9k0av.js → index-v62cpkx3.js} +1 -1
  125. package/dist/{index-10rg78vf.js → index-v8xm2s9v.js} +2 -2
  126. package/dist/{index-y6ye582c.js → index-w0wy05gr.js} +10 -10
  127. package/dist/{index-kw1ws0cs.js → index-w3nv6kr8.js} +1 -1
  128. package/dist/{index-eeahxwvg.js → index-ww3gss55.js} +1 -1
  129. package/dist/{index-6j15ktag.js → index-wzqd6pen.js} +1 -1
  130. package/dist/{index-aswegq1r.js → index-xjb131sc.js} +367 -131
  131. package/dist/{index-1fyea34p.js → index-yebkpytc.js} +5 -5
  132. package/dist/{index-bgcwxhxh.js → index-yfpt7sxr.js} +24 -46
  133. package/dist/{index-69t14s4a.js → index-yt1gg11x.js} +3 -2
  134. package/dist/{index-jk29rwkr.js → index-zfncctjp.js} +1 -1
  135. package/dist/internal/stable-digest.d.ts +5 -0
  136. package/dist/internal/stable-digest.d.ts.map +1 -1
  137. package/dist/internal/typed.d.ts +2 -0
  138. package/dist/internal/typed.d.ts.map +1 -1
  139. package/dist/process/operation-child.d.ts +38 -0
  140. package/dist/process/operation-child.d.ts.map +1 -0
  141. package/dist/process/operation-wire.d.ts +68 -0
  142. package/dist/process/operation-wire.d.ts.map +1 -0
  143. package/dist/process/operation.d.ts +74 -0
  144. package/dist/process/operation.d.ts.map +1 -0
  145. package/dist/server/contract-identity.d.ts +10 -0
  146. package/dist/server/contract-identity.d.ts.map +1 -0
  147. package/dist/server/contract-stream.d.ts.map +1 -1
  148. package/dist/server/endpoint-response.d.ts.map +1 -1
  149. package/dist/server/error-hook.d.ts +1 -0
  150. package/dist/server/error-hook.d.ts.map +1 -1
  151. package/dist/tools/cli/args-route.d.ts.map +1 -1
  152. package/dist/tools/cli/args-tokens.d.ts.map +1 -1
  153. package/dist/tools/cli/command.d.ts +39 -18
  154. package/dist/tools/cli/command.d.ts.map +1 -1
  155. package/dist/tools/cli/format.d.ts.map +1 -1
  156. package/dist/tools/cli/help.d.ts.map +1 -1
  157. package/dist/tools/cli/invoke.d.ts +3 -1
  158. package/dist/tools/cli/invoke.d.ts.map +1 -1
  159. package/dist/tools/cli/io.d.ts +6 -0
  160. package/dist/tools/cli/io.d.ts.map +1 -1
  161. package/dist/tools/cli/managed-surface.d.ts +2 -0
  162. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  163. package/dist/tools/cli/policy.d.ts +14 -0
  164. package/dist/tools/cli/policy.d.ts.map +1 -1
  165. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  166. package/dist/tools/cli/run-native.d.ts.map +1 -1
  167. package/dist/tools/cli/run-stream.d.ts +23 -0
  168. package/dist/tools/cli/run-stream.d.ts.map +1 -0
  169. package/dist/tools/cli/session.d.ts +8 -0
  170. package/dist/tools/cli/session.d.ts.map +1 -1
  171. package/dist/tools/cli/stream-surface.d.ts +17 -0
  172. package/dist/tools/cli/stream-surface.d.ts.map +1 -0
  173. package/dist/tools/execute.d.ts +7 -1
  174. package/dist/tools/execute.d.ts.map +1 -1
  175. package/dist/tools/invoker.d.ts.map +1 -1
  176. package/dist/tools/remote.d.ts.map +1 -1
  177. package/llms/cli.2.txt +56 -1
  178. package/llms/cli.txt +68 -1
  179. package/llms/contract.txt +4 -1
  180. package/llms/files-packaging.txt +10 -0
  181. package/llms/process.2.txt +75 -1
  182. package/llms/process.txt +59 -25
  183. package/llms/server.4.txt +8 -4
  184. package/llms/server.5.txt +1 -0
  185. package/llms/stitchkit.2.txt +74 -0
  186. package/llms/stitchkit.txt +5 -5
  187. package/llms/tools.txt +1 -1
  188. package/llms/{upgrading-0.106.0-0.122.0.txt → upgrading-0.106.0-0.123.0.txt} +50 -3
  189. package/llms/upgrading.txt +1 -1
  190. package/llms-full.txt +379 -13
  191. package/llms.txt +7 -7
  192. package/package.json +1 -1
  193. package/dist/index-h2fhjqy7.js +0 -19
  194. package/dist/index-m5m9rmvt.js +0 -44
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadDarwinBinding
3
- } from "./index-m5m9rmvt.js";
3
+ } from "./index-sqc6ezrb.js";
4
4
  import {
5
5
  descriptorPath,
6
6
  NumericFileHandle
7
- } from "./index-eeahxwvg.js";
7
+ } from "./index-ww3gss55.js";
8
8
  import {
9
9
  stagingName
10
10
  } from "./index-tt30h7mr.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-zsarb5xp.js";
7
7
  import {
8
8
  isRecord
9
- } from "./index-9jfdm5tg.js";
9
+ } from "./index-hkxgennw.js";
10
10
 
11
11
  // src/observability/sanitize.ts
12
12
  var SENSITIVE_WORDS = new Set([
@@ -6,7 +6,7 @@ import {
6
6
  realtimeRequestTraces,
7
7
  createRequestTracer,
8
8
  bindRealtimeClient2
9
- } from "./index-jk29rwkr.js";
9
+ } from "./index-zfncctjp.js";
10
10
  import {
11
11
  isModuleNotFound
12
12
  } from "./index-srs8hj9c.js";
@@ -11,7 +11,7 @@ import {
11
11
  spawnBunChild,
12
12
  spawnBunInheritedChild,
13
13
  ownerLossGuardEntry
14
- } from "./index-72xtvcvr.js";
14
+ } from "./index-0ndz5r8z.js";
15
15
  import {
16
16
  errnoOf
17
17
  } from "./index-jj9228tt.js";
@@ -10,10 +10,10 @@ import {
10
10
  } from "./index-zsarb5xp.js";
11
11
  import {
12
12
  unauthorized2
13
- } from "./index-qcn84byh.js";
13
+ } from "./index-0w0hxp7n.js";
14
14
  import {
15
15
  isRecord
16
- } from "./index-9jfdm5tg.js";
16
+ } from "./index-hkxgennw.js";
17
17
 
18
18
  // src/server/middleware/jwt.ts
19
19
  var MAX_TOKEN_BYTES = 8192;
@@ -5,6 +5,12 @@ function typedEntries(value) {
5
5
  function isRecord(value) {
6
6
  return typeof value === "object" && value !== null && !Array.isArray(value);
7
7
  }
8
+ function isAsyncIterable(value) {
9
+ if (typeof value !== "object" && typeof value !== "function" || value === null) {
10
+ return false;
11
+ }
12
+ return typeof Reflect.get(value, Symbol.asyncIterator) === "function";
13
+ }
8
14
  function callRuntimeHandler(handler, context) {
9
15
  if (typeof handler !== "function") {
10
16
  throw new TypeError("Runtime handler must be a function");
@@ -27,4 +33,4 @@ function mapObjectTypeBoundary(source, mapper) {
27
33
  return mapObject(source, (key, value) => mapper(key, value));
28
34
  }
29
35
 
30
- export { typedEntries, isRecord, callRuntimeHandler, transportResult, mapObject, mapObjectTypeBoundary };
36
+ export { typedEntries, isRecord, isAsyncIterable, callRuntimeHandler, transportResult, mapObject, mapObjectTypeBoundary };
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  NativeCommandError2
3
- } from "./index-72xtvcvr.js";
3
+ } from "./index-0ndz5r8z.js";
4
4
  import {
5
5
  CommandStopped,
6
6
  startNativeCommand
7
- } from "./index-j95jp7ee.js";
7
+ } from "./index-gdqawggb.js";
8
8
  import {
9
9
  ScanStopped,
10
10
  ContainedScanBudget,
11
11
  readContainedUtf8Handle,
12
12
  scanContainedFiles
13
- } from "./index-s9a0fjh3.js";
13
+ } from "./index-kffm4r8w.js";
14
14
  import {
15
15
  writeContainedFile
16
- } from "./index-aqmadanx.js";
16
+ } from "./index-fa53vygr.js";
17
17
  import {
18
18
  openPinnedDirectory,
19
19
  openContainedDirectory,
@@ -27,13 +27,13 @@ import {
27
27
  assertContainedParentCurrent,
28
28
  containedEntryMetadata,
29
29
  openContainedParentFile
30
- } from "./index-eeahxwvg.js";
30
+ } from "./index-ww3gss55.js";
31
31
  import {
32
32
  withSignalDeadline
33
33
  } from "./index-9tqbxv5p.js";
34
34
  import {
35
35
  defineRuntimeTool2
36
- } from "./index-aqwg2dm5.js";
36
+ } from "./index-6k47xdtt.js";
37
37
  import {
38
38
  errnoOf
39
39
  } from "./index-jj9228tt.js";
@@ -45,7 +45,7 @@ import {
45
45
  forbidden2,
46
46
  conflict2,
47
47
  STITCH_ERROR_STATUS2
48
- } from "./index-qcn84byh.js";
48
+ } from "./index-0w0hxp7n.js";
49
49
 
50
50
  // src/agent-runtime/coding-tool-contract.ts
51
51
  import { z as z2 } from "zod";
@@ -10,12 +10,12 @@ import {
10
10
  AgentAdmissionReceiptSchema2,
11
11
  AgentSeedReceiptSchema2,
12
12
  AgentHistoryMutationSchema2
13
- } from "./index-8yxgcyt6.js";
13
+ } from "./index-egg0yp2j.js";
14
14
  import {
15
15
  appendEventIn,
16
16
  ArchiveProjectionSchema,
17
17
  createAgentRuntimeStore2
18
- } from "./index-10rg78vf.js";
18
+ } from "./index-v8xm2s9v.js";
19
19
  import {
20
20
  AgentMessageSchema2,
21
21
  AgentRunSchema2
@@ -3,7 +3,7 @@ import {
3
3
  openPinnedDirectory,
4
4
  openFileAt,
5
5
  listAt
6
- } from "./index-eeahxwvg.js";
6
+ } from "./index-ww3gss55.js";
7
7
  import {
8
8
  errnoOf
9
9
  } from "./index-jj9228tt.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-m6w6jtda.js";
4
4
  import {
5
5
  serializeCanonicalJson
6
- } from "./index-zsvzhjtk.js";
6
+ } from "./index-20hn8pbh.js";
7
7
 
8
8
  // src/primitives/canonical-json.ts
9
9
  import { z } from "zod";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
6
6
  ContractStreamFrameSchema2
7
- } from "./index-h2fhjqy7.js";
7
+ } from "./index-0v9xb8pz.js";
8
8
  import {
9
9
  RequestCancellationError,
10
10
  createRequestCancellation,
@@ -13,7 +13,12 @@ import {
13
13
  uploadProgressRoute,
14
14
  withUploadProgress,
15
15
  parseApiErrorBody
16
- } from "./index-9frf01t9.js";
16
+ } from "./index-r0xr7y4m.js";
17
+ import {
18
+ DEFAULT_STREAM_LINE_BYTES,
19
+ createBoundedLineDecoder,
20
+ readBoundedUtf8Lines
21
+ } from "./index-45dyex0j.js";
17
22
  import {
18
23
  inputIsQuery
19
24
  } from "./index-xhzq2qvj.js";
@@ -21,17 +26,11 @@ import {
21
26
  ApiError2,
22
27
  refuseLocally
23
28
  } from "./index-kfjkb396.js";
24
- import {
25
- chunksOf
26
- } from "./index-cjbn98zt.js";
27
- import {
28
- assertPositiveSafeInteger
29
- } from "./index-0s4xebbg.js";
30
29
  import {
31
30
  typedEntries,
32
31
  isRecord,
33
32
  mapObject
34
- } from "./index-9jfdm5tg.js";
33
+ } from "./index-hkxgennw.js";
35
34
 
36
35
  // src/browser/client-arguments.ts
37
36
  function endpointHasArguments(endpoint) {
@@ -259,117 +258,6 @@ function joinClientBaseUrl(baseUrl, relativeUrl) {
259
258
  return `${base}${path}`;
260
259
  }
261
260
 
262
- // src/internal/bounded-lines.ts
263
- var DEFAULT_STREAM_LINE_BYTES = 1024 * 1024;
264
-
265
- class StreamLineLimitError2 extends RangeError {
266
- limitBytes;
267
- lineBytes;
268
- name = "StreamLineLimitError";
269
- constructor(limitBytes, lineBytes) {
270
- super(`Stream line exceeds the ${limitBytes} byte limit (${lineBytes} bytes so far)`);
271
- this.limitBytes = limitBytes;
272
- this.lineBytes = lineBytes;
273
- }
274
- }
275
-
276
- class StreamTruncatedLineError2 extends SyntaxError {
277
- lineBytes;
278
- name = "StreamTruncatedLineError";
279
- constructor(lineBytes) {
280
- super(`Stream ended with an unterminated final line (${lineBytes} bytes)`);
281
- this.lineBytes = lineBytes;
282
- }
283
- }
284
- function lineLimit(value) {
285
- const resolved = value ?? DEFAULT_STREAM_LINE_BYTES;
286
- assertPositiveSafeInteger("maxLineBytes", resolved);
287
- return resolved;
288
- }
289
- function createLineSplitter(maxLineBytes, requireFinalNewline = false) {
290
- const limit = lineLimit(maxLineBytes);
291
- const decoder = new TextDecoder("utf-8", { fatal: true });
292
- let parts = [];
293
- let pendingBytes = 0;
294
- let ended = false;
295
- let failed = false;
296
- const drop = () => {
297
- parts = [];
298
- pendingBytes = 0;
299
- };
300
- const retain = (bytes) => {
301
- if (bytes.byteLength === 0)
302
- return;
303
- pendingBytes += bytes.byteLength;
304
- if (pendingBytes > limit) {
305
- const seen = pendingBytes;
306
- drop();
307
- throw new StreamLineLimitError2(limit, seen);
308
- }
309
- parts.push(new Uint8Array(bytes));
310
- };
311
- const take = () => {
312
- const line = new Uint8Array(pendingBytes);
313
- let at = 0;
314
- for (const part of parts) {
315
- line.set(part, at);
316
- at += part.byteLength;
317
- }
318
- drop();
319
- return decoder.decode(line);
320
- };
321
- function* lines(chunk) {
322
- if (ended)
323
- throw new Error("Line decoder received bytes after end()");
324
- if (failed)
325
- throw new Error("Line decoder stopped at an earlier error; read the source again");
326
- try {
327
- let start = 0;
328
- for (let index = chunk.indexOf(10);index !== -1; index = chunk.indexOf(10, start)) {
329
- retain(chunk.subarray(start, index));
330
- yield take();
331
- start = index + 1;
332
- }
333
- retain(chunk.subarray(start));
334
- } catch (error) {
335
- failed = true;
336
- throw error;
337
- }
338
- }
339
- return {
340
- lines,
341
- push: (chunk) => [...lines(chunk)],
342
- end() {
343
- ended = true;
344
- if (pendingBytes === 0)
345
- return [];
346
- if (requireFinalNewline) {
347
- const seen = pendingBytes;
348
- drop();
349
- throw new StreamTruncatedLineError2(seen);
350
- }
351
- return [take()];
352
- }
353
- };
354
- }
355
- function createBoundedLineDecoder(maxLineBytes, requireFinalNewline = false) {
356
- const { push, end } = createLineSplitter(maxLineBytes, requireFinalNewline);
357
- return { push, end };
358
- }
359
- async function* readBoundedUtf8Lines(source, maxLineBytes, requireFinalNewline = false, signal) {
360
- const splitter = createLineSplitter(maxLineBytes, requireFinalNewline);
361
- for await (const chunk of chunksOf(source, signal)) {
362
- for (const line of splitter.lines(chunk)) {
363
- signal?.throwIfAborted();
364
- yield line;
365
- }
366
- }
367
- for (const line of splitter.end()) {
368
- signal?.throwIfAborted();
369
- yield line;
370
- }
371
- }
372
-
373
261
  // src/browser/stream.ts
374
262
  function ndjsonLine(rawLine) {
375
263
  return (rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine).trim();
@@ -765,6 +653,28 @@ async function throwForErrorResponse(res, config, fallbackBody) {
765
653
  });
766
654
  }
767
655
 
656
+ // src/browser/unknown-operation.ts
657
+ function isRoutingRefusal(error) {
658
+ if (error.code === "UNKNOWN_OPERATION")
659
+ return true;
660
+ return error.code === "METHOD_NOT_ALLOWED" && isRecord(error.details) && Array.isArray(error.details.allow);
661
+ }
662
+ function namedOperation(execute, operation) {
663
+ return (requestArgs, options) => execute(requestArgs, options).catch((error) => {
664
+ if (!(error instanceof ApiError2) || !isRoutingRefusal(error))
665
+ throw error;
666
+ throw new ApiError2("UNKNOWN_OPERATION", {
667
+ status: error.status,
668
+ message: error.message,
669
+ details: { ...isRecord(error.details) ? error.details : {}, operation },
670
+ hint: error.hint,
671
+ traceId: error.traceId,
672
+ retryable: error.retryable,
673
+ cause: error
674
+ });
675
+ });
676
+ }
677
+
768
678
  // src/browser/client.ts
769
679
  function contractEndpointMatchers2(contract, endpointNames, contractConfig) {
770
680
  const selected = endpointNames ? new Set(endpointNames) : null;
@@ -791,7 +701,7 @@ function createClient2(contract, configOrClient, contractConfig) {
791
701
  for (const [key, endpoint] of typedEntries(contract.endpoints)) {
792
702
  if (endpoint.expose && !endpoint.expose.includes("HTTP"))
793
703
  continue;
794
- setClientMethod(client, key, createEndpointMethod(endpoint, makeExecutor(endpoint), contractConfig));
704
+ setClientMethod(client, key, createEndpointMethod(endpoint, namedOperation(makeExecutor(endpoint), `${contract.meta.prefix}.${String(key)}`), contractConfig));
795
705
  }
796
706
  return client;
797
707
  }
@@ -921,4 +831,4 @@ function createScopedUrlBuilders2(contracts, source, scopeConfigs) {
921
831
  return buildScopedRegistry(contracts, scopeConfigs, "URL builder", (contract, config) => createUrlBuilder2(contract, source, config));
922
832
  }
923
833
 
924
- export { endpointHasArguments, StreamLineLimitError2, StreamTruncatedLineError2, parseNDJSON2, createNDJSONDecoder2, parseSSE2, contractEndpointMatchers2, createClient2, createClients2, createScopedClients2, createUrlBuilder2, createUrlBuilders2, createScopedUrlBuilders2 };
834
+ export { endpointHasArguments, parseNDJSON2, createNDJSONDecoder2, parseSSE2, contractEndpointMatchers2, createClient2, createClients2, createScopedClients2, createUrlBuilder2, createUrlBuilders2, createScopedUrlBuilders2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serializeCanonicalJson
3
- } from "./index-zsvzhjtk.js";
3
+ } from "./index-20hn8pbh.js";
4
4
 
5
5
  // src/internal/stable-digest.ts
6
6
  function mix128(input) {
@@ -31,8 +31,11 @@ function mix128(input) {
31
31
  ];
32
32
  }
33
33
  function argumentsDigest(args) {
34
- const lanes = mix128(serializeCanonicalJson(args));
34
+ return canonicalDigest(args);
35
+ }
36
+ function canonicalDigest(value) {
37
+ const lanes = mix128(serializeCanonicalJson(value));
35
38
  return lanes.map((lane) => lane.toString(16).padStart(8, "0")).join("");
36
39
  }
37
40
 
38
- export { argumentsDigest };
41
+ export { argumentsDigest, canonicalDigest };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  loadDarwinBinding
3
- } from "./index-m5m9rmvt.js";
3
+ } from "./index-sqc6ezrb.js";
4
4
  import {
5
5
  errnoOf
6
6
  } from "./index-jj9228tt.js";
7
7
  import {
8
8
  isRecord
9
- } from "./index-9jfdm5tg.js";
9
+ } from "./index-hkxgennw.js";
10
10
 
11
11
  // src/internal/process-identity.ts
12
12
  import { execFile } from "node:child_process";
@@ -4,10 +4,10 @@ import {
4
4
  } from "./index-1eeqpadm.js";
5
5
  import {
6
6
  AppError2
7
- } from "./index-qcn84byh.js";
7
+ } from "./index-0w0hxp7n.js";
8
8
  import {
9
9
  isRecord
10
- } from "./index-9jfdm5tg.js";
10
+ } from "./index-hkxgennw.js";
11
11
 
12
12
  // src/contract/normalize.ts
13
13
  import { z } from "zod";
@@ -3,14 +3,14 @@ import {
3
3
  mergeSchemas,
4
4
  assertToolExtensionCompatible,
5
5
  projectToolSurface
6
- } from "./index-x4p3kw1p.js";
6
+ } from "./index-tynna0n4.js";
7
7
  import {
8
8
  toolErrorFromResult,
9
9
  executeToolMethod
10
- } from "./index-s3yxw6kt.js";
10
+ } from "./index-s512scra.js";
11
11
  import {
12
12
  isRetryableStatus2
13
- } from "./index-qcn84byh.js";
13
+ } from "./index-0w0hxp7n.js";
14
14
 
15
15
  // src/tools/mount.ts
16
16
  import { z } from "zod";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  isRecord,
10
10
  transportResult
11
- } from "./index-9jfdm5tg.js";
11
+ } from "./index-hkxgennw.js";
12
12
 
13
13
  // src/browser/cancellation.ts
14
14
  class RequestCancellationError extends Error {
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  normalizeError2,
3
3
  validateDeclaredOutput
4
- } from "./index-k42ckyzx.js";
4
+ } from "./index-ndjzbt2v.js";
5
5
  import {
6
6
  localVerdict
7
7
  } from "./index-dsa676h8.js";
8
8
  import {
9
9
  coerceJsonArgs2
10
- } from "./index-rbzq0q16.js";
10
+ } from "./index-t8jz0e20.js";
11
11
  import {
12
12
  applyToolViewDefaults,
13
13
  projectToolView,
14
14
  objectShapeKeys
15
- } from "./index-x4p3kw1p.js";
15
+ } from "./index-tynna0n4.js";
16
16
  import {
17
17
  runWithRequestContext2,
18
18
  getRequestContext2
19
- } from "./index-r6v4mc67.js";
19
+ } from "./index-1d7s7da0.js";
20
20
  import {
21
21
  projectedToolError
22
- } from "./index-98hv3sba.js";
22
+ } from "./index-aw6kx2e6.js";
23
23
  import {
24
24
  isUnsafeKey
25
25
  } from "./index-zsarb5xp.js";
@@ -31,10 +31,10 @@ import {
31
31
  STITCH_ERROR_STATUS2,
32
32
  isRetryableStatus2,
33
33
  isStitchErrorCode2
34
- } from "./index-qcn84byh.js";
34
+ } from "./index-0w0hxp7n.js";
35
35
  import {
36
36
  isRecord
37
- } from "./index-9jfdm5tg.js";
37
+ } from "./index-hkxgennw.js";
38
38
 
39
39
  // src/tools/execute-args.ts
40
40
  import { z } from "zod";
@@ -201,6 +201,8 @@ async function invokeToolHandler(method, ctx, input, source, {
201
201
  await lifecycle.beforeHandle(ctx, method);
202
202
  }
203
203
  let data = await method.handler(ctx);
204
+ if (method.stream !== undefined)
205
+ return { ok: true, data };
204
206
  if (lifecycle?.afterHandle) {
205
207
  const transformed = await lifecycle.afterHandle(ctx, data, method);
206
208
  if (transformed !== undefined)
@@ -1,3 +1,6 @@
1
+ // src/internal/darwin-binding.ts
2
+ import loadDarwinAddon from "#stitchkit-darwin-native";
3
+
1
4
  // src/internal/darwin-binding-error.ts
2
5
  var NATIVE_NOT_PACKAGED = "STITCHKIT_NATIVE_NOT_PACKAGED";
3
6
  var messages = {
@@ -55,4 +58,41 @@ class DarwinBackendError extends Error {
55
58
  }
56
59
  }
57
60
 
58
- export { NATIVE_NOT_PACKAGED, darwinLoadStage, DarwinBackendError };
61
+ // src/internal/darwin-binding.ts
62
+ function hasFunctions(value, names) {
63
+ return typeof value === "object" && value !== null && names.every((name) => typeof Reflect.get(value, name) === "function");
64
+ }
65
+ var darwinBinding;
66
+ function loadDarwinBinding() {
67
+ if (darwinBinding)
68
+ return darwinBinding;
69
+ if (process.arch !== "arm64" && process.arch !== "x64") {
70
+ throw new DarwinBackendError("architecture");
71
+ }
72
+ let loaded;
73
+ try {
74
+ loaded = loadDarwinAddon();
75
+ } catch (cause) {
76
+ throw new DarwinBackendError(darwinLoadStage(cause), cause);
77
+ }
78
+ const methods = [
79
+ "openDirectoryAt",
80
+ "reopenDirectory",
81
+ "changeDirectory",
82
+ "openFileAt",
83
+ "createFileAt",
84
+ "createDirectoryAt",
85
+ "statAt",
86
+ "listAt",
87
+ "renameAt",
88
+ "unlinkAt",
89
+ "processIdentity"
90
+ ];
91
+ if (!hasFunctions(loaded, methods)) {
92
+ throw new DarwinBackendError("surface");
93
+ }
94
+ darwinBinding = loaded;
95
+ return darwinBinding;
96
+ }
97
+
98
+ export { NATIVE_NOT_PACKAGED, loadDarwinBinding };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createValidatedRealtimeSocket
3
- } from "./index-3za04re9.js";
3
+ } from "./index-1c945ten.js";
4
4
 
5
5
  // src/server/realtime.ts
6
6
  function bindRealtimeServer2(contract, handle, options = {}) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-zsarb5xp.js";
7
7
  import {
8
8
  isRecord
9
- } from "./index-9jfdm5tg.js";
9
+ } from "./index-hkxgennw.js";
10
10
 
11
11
  // src/tools/schema/coerce.ts
12
12
  import { z } from "zod";
@@ -17,7 +17,7 @@ import {
17
17
  } from "./index-0s4xebbg.js";
18
18
  import {
19
19
  serializeCanonicalJson
20
- } from "./index-zsvzhjtk.js";
20
+ } from "./index-20hn8pbh.js";
21
21
 
22
22
  // src/tools/cli/manifest.ts
23
23
  import { z as z2 } from "zod";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  validateDeclaredOutput
3
- } from "./index-k42ckyzx.js";
3
+ } from "./index-ndjzbt2v.js";
4
4
  import {
5
5
  toJsonSchema
6
6
  } from "./index-ct75c3at.js";
7
7
  import {
8
8
  isHttpOnlyEndpoint
9
- } from "./index-69t14s4a.js";
9
+ } from "./index-yt1gg11x.js";
10
10
  import {
11
11
  AppError2
12
- } from "./index-qcn84byh.js";
12
+ } from "./index-0w0hxp7n.js";
13
13
  import {
14
14
  serializeCanonicalJson
15
- } from "./index-zsvzhjtk.js";
15
+ } from "./index-20hn8pbh.js";
16
16
  import {
17
17
  isRecord
18
- } from "./index-9jfdm5tg.js";
18
+ } from "./index-hkxgennw.js";
19
19
 
20
20
  // src/tools/internal/tool-view.ts
21
21
  function toolSurfaceOutputSchema(operation) {
@@ -1307,4 +1307,4 @@ function prepareProjectedMcpTools(tools, config = {}) {
1307
1307
  return prepared;
1308
1308
  }
1309
1309
 
1310
- export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView, objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS2, findNonPortableFormats2, declaresDraft07, withDraft2020Keywords, flattenToolJsonSchema2, buildToolPresentationSchema, presentationMetadata, findUntypedProperties2, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
1310
+ export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView, objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, toToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS2, findNonPortableFormats2, declaresDraft07, withDraft2020Keywords, flattenToolJsonSchema2, buildToolPresentationSchema, presentationMetadata, findUntypedProperties2, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isRecord
3
- } from "./index-9jfdm5tg.js";
3
+ } from "./index-hkxgennw.js";
4
4
 
5
5
  // src/application/diagnostic-journal-contract.ts
6
6
  import { z as z3 } from "zod";
@@ -4,7 +4,7 @@ import {
4
4
  AgentSandboxRestrictionSchema2,
5
5
  AgentSandboxGradeSchema2,
6
6
  AGENT_CODING_TOOL_NAMES
7
- } from "./index-qaqxdbxf.js";
7
+ } from "./index-j8rda9n6.js";
8
8
  import {
9
9
  AgentRecordIdSchema2,
10
10
  AgentRecordVersionSchema2,
@@ -45,7 +45,7 @@ import {
45
45
  AgentSeedReceiptSchema2,
46
46
  isActiveRunState,
47
47
  emptyHead
48
- } from "./index-8yxgcyt6.js";
48
+ } from "./index-egg0yp2j.js";
49
49
  import {
50
50
  StepEventPayloadSchema,
51
51
  ParkEventPayloadSchema,