stitchkit 0.103.12 → 0.104.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 (225) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/darwin-native.cjs +12 -0
  3. package/darwin-native.d.cts +2 -0
  4. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
  5. package/dist/application/directory-inbox-accept.d.ts +13 -0
  6. package/dist/application/directory-inbox-accept.d.ts.map +1 -0
  7. package/dist/application/directory-inbox-contract.d.ts +42 -5
  8. package/dist/application/directory-inbox-contract.d.ts.map +1 -1
  9. package/dist/application/directory-inbox-delivery.d.ts +14 -0
  10. package/dist/application/directory-inbox-delivery.d.ts.map +1 -0
  11. package/dist/application/directory-inbox-files.d.ts +28 -0
  12. package/dist/application/directory-inbox-files.d.ts.map +1 -0
  13. package/dist/application/directory-inbox-state.d.ts +14 -0
  14. package/dist/application/directory-inbox-state.d.ts.map +1 -0
  15. package/dist/application/directory-inbox.d.ts +2 -1
  16. package/dist/application/directory-inbox.d.ts.map +1 -1
  17. package/dist/application/file-state-store.d.ts +2 -8
  18. package/dist/application/file-state-store.d.ts.map +1 -1
  19. package/dist/application/state-store.d.ts +6 -1
  20. package/dist/application/state-store.d.ts.map +1 -1
  21. package/dist/browser/client-arguments.d.ts +4 -0
  22. package/dist/browser/client-arguments.d.ts.map +1 -0
  23. package/dist/browser/client-executors.d.ts.map +1 -1
  24. package/dist/browser/client.d.ts.map +1 -1
  25. package/dist/browser/contract-stream.d.ts.map +1 -1
  26. package/dist/browser/http.d.ts +2 -1
  27. package/dist/browser/http.d.ts.map +1 -1
  28. package/dist/browser/native-fetch.d.ts +8 -0
  29. package/dist/browser/native-fetch.d.ts.map +1 -0
  30. package/dist/contract/errors.d.ts +16 -12
  31. package/dist/contract/errors.d.ts.map +1 -1
  32. package/dist/contract/normalize.d.ts +5 -1
  33. package/dist/contract/normalize.d.ts.map +1 -1
  34. package/dist/contract/stream.d.ts +1 -0
  35. package/dist/contract/stream.d.ts.map +1 -1
  36. package/dist/entrypoints/agent-runtime/browser.js +3 -3
  37. package/dist/entrypoints/agent-runtime/coding-tools.js +8 -6
  38. package/dist/entrypoints/agent-runtime/harness-tools.js +8 -8
  39. package/dist/entrypoints/agent-runtime/harness.js +12 -11
  40. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  41. package/dist/entrypoints/agent-runtime/sandbox.js +8 -6
  42. package/dist/entrypoints/agent-runtime.js +13 -13
  43. package/dist/entrypoints/application/diagnostic-journal.js +3 -2
  44. package/dist/entrypoints/application/directory-inbox.js +424 -119
  45. package/dist/entrypoints/application/grammy.js +1 -1
  46. package/dist/entrypoints/application.d.ts +2 -2
  47. package/dist/entrypoints/application.d.ts.map +1 -1
  48. package/dist/entrypoints/application.js +7 -3
  49. package/dist/entrypoints/cli.d.ts +2 -0
  50. package/dist/entrypoints/cli.d.ts.map +1 -1
  51. package/dist/entrypoints/cli.js +757 -136
  52. package/dist/entrypoints/contract.js +3 -3
  53. package/dist/entrypoints/files.js +11 -107
  54. package/dist/entrypoints/index.js +7 -7
  55. package/dist/entrypoints/node.js +8 -8
  56. package/dist/entrypoints/observability.js +2 -2
  57. package/dist/entrypoints/process.js +2 -1
  58. package/dist/entrypoints/react.js +1 -1
  59. package/dist/entrypoints/remote.js +19 -6
  60. package/dist/entrypoints/server.d.ts +1 -1
  61. package/dist/entrypoints/server.d.ts.map +1 -1
  62. package/dist/entrypoints/server.js +20 -14
  63. package/dist/entrypoints/telegram.d.ts +1 -0
  64. package/dist/entrypoints/telegram.d.ts.map +1 -1
  65. package/dist/entrypoints/telegram.js +214 -98
  66. package/dist/entrypoints/testing.js +7 -7
  67. package/dist/entrypoints/tools/connections.d.ts +2 -2
  68. package/dist/entrypoints/tools/connections.d.ts.map +1 -1
  69. package/dist/entrypoints/tools/connections.js +427 -294
  70. package/dist/entrypoints/tools/invoker.js +6 -6
  71. package/dist/entrypoints/tools/mcp.d.ts +12 -0
  72. package/dist/entrypoints/tools/mcp.d.ts.map +1 -0
  73. package/dist/entrypoints/tools/mcp.js +45 -0
  74. package/dist/entrypoints/tools.d.ts +1 -0
  75. package/dist/entrypoints/tools.d.ts.map +1 -1
  76. package/dist/entrypoints/tools.js +82 -1147
  77. package/dist/entrypoints/tracking.js +1 -1
  78. package/dist/files/boundary.d.ts +2 -8
  79. package/dist/files/boundary.d.ts.map +1 -1
  80. package/dist/files/file-io.d.ts +0 -5
  81. package/dist/files/file-io.d.ts.map +1 -1
  82. package/dist/files/read.d.ts +2 -2
  83. package/dist/files/read.d.ts.map +1 -1
  84. package/dist/index-1a6jtnd9.js +88 -0
  85. package/dist/{index-fyphpknh.js → index-22rhg58f.js} +1 -1
  86. package/dist/index-269zqj8m.js +77 -0
  87. package/dist/{index-r34mvse1.js → index-27a2pj09.js} +1 -1
  88. package/dist/{index-r956rndn.js → index-2hyavjjj.js} +3 -3
  89. package/dist/{index-m2xqkv55.js → index-2vnh05w4.js} +83 -14
  90. package/dist/{index-pw99k9h5.js → index-43p08g7t.js} +1 -1
  91. package/dist/{index-xwq9j1sf.js → index-4e0ah203.js} +9 -7
  92. package/dist/{index-nybn2err.js → index-5csmzesf.js} +1 -1
  93. package/dist/{index-qapzv4p5.js → index-5z6jn897.js} +1 -1
  94. package/dist/{index-ahvsksw5.js → index-6d9xaxw1.js} +1 -1
  95. package/dist/{index-ahtnte39.js → index-6drst9sg.js} +46 -35
  96. package/dist/{index-x87j7csh.js → index-77nxk6ay.js} +2 -2
  97. package/dist/{index-dnn9z96q.js → index-a0zzh8ak.js} +3 -3
  98. package/dist/{index-kmpzj1cq.js → index-a3wma1hk.js} +1 -1
  99. package/dist/{index-j8aw2c0e.js → index-bakgedh8.js} +35 -7
  100. package/dist/index-bhb950qs.js +1145 -0
  101. package/dist/{index-tgzhq07n.js → index-cvda079a.js} +1 -1
  102. package/dist/{index-n2gre124.js → index-fa4wg312.js} +4 -4
  103. package/dist/{index-zp4jpkp0.js → index-fk18k56k.js} +2 -2
  104. package/dist/{index-afjvjyck.js → index-g2j7pnak.js} +2 -134
  105. package/dist/index-g95fk660.js +116 -0
  106. package/dist/{index-ej331hah.js → index-gxm9rc97.js} +1 -1
  107. package/dist/{index-r5c4fedv.js → index-h2fhjqy7.js} +2 -1
  108. package/dist/{index-sybedc8b.js → index-hbd32c6a.js} +23 -94
  109. package/dist/index-jd470k6q.js +109 -0
  110. package/dist/{index-b2bz0kdm.js → index-kb8styz3.js} +4 -3
  111. package/dist/{index-0c419yx7.js → index-kemm0ej5.js} +12 -9
  112. package/dist/{index-806d5phm.js → index-ptn0g0gj.js} +7 -7
  113. package/dist/{index-w575evhq.js → index-r4r70zmh.js} +1 -1
  114. package/dist/{index-12m2v2a9.js → index-s4evrmp5.js} +1 -1
  115. package/dist/{index-1khy8y7n.js → index-t1sr4aks.js} +3 -3
  116. package/dist/index-v5ee8ath.js +88 -0
  117. package/dist/{index-45tdvqa3.js → index-wh0ecvyk.js} +1 -1
  118. package/dist/{index-n53mswt3.js → index-x928baz2.js} +8 -1
  119. package/dist/index-yk4g8805.js +133 -0
  120. package/dist/{index-ygkka6zn.js → index-ywppsaby.js} +28 -5
  121. package/dist/{index-xvdd2rbb.js → index-za6j7nwy.js} +19 -5
  122. package/dist/internal/bounded-file-read.d.ts +41 -0
  123. package/dist/internal/bounded-file-read.d.ts.map +1 -0
  124. package/dist/internal/darwin-binding-error.d.ts +24 -0
  125. package/dist/internal/darwin-binding-error.d.ts.map +1 -0
  126. package/dist/internal/darwin-binding.d.ts.map +1 -1
  127. package/dist/internal/exclusive-lock.d.ts +2 -0
  128. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  129. package/dist/internal/with-exclusive-lock.d.ts +4 -2
  130. package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
  131. package/dist/telegram/broadcast-delivery.d.ts +23 -0
  132. package/dist/telegram/broadcast-delivery.d.ts.map +1 -0
  133. package/dist/telegram/broadcast-failure.d.ts +22 -0
  134. package/dist/telegram/broadcast-failure.d.ts.map +1 -0
  135. package/dist/telegram/broadcast-state.d.ts +6 -3
  136. package/dist/telegram/broadcast-state.d.ts.map +1 -1
  137. package/dist/telegram/broadcast.d.ts +10 -5
  138. package/dist/telegram/broadcast.d.ts.map +1 -1
  139. package/dist/tools/cli/args-fields.d.ts +2 -0
  140. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  141. package/dist/tools/cli/args.d.ts.map +1 -1
  142. package/dist/tools/cli/format.d.ts.map +1 -1
  143. package/dist/tools/cli/invoke.d.ts +2 -2
  144. package/dist/tools/cli/invoke.d.ts.map +1 -1
  145. package/dist/tools/cli/publication-assets.d.ts +10 -0
  146. package/dist/tools/cli/publication-assets.d.ts.map +1 -0
  147. package/dist/tools/cli/publication-contract.d.ts +75 -0
  148. package/dist/tools/cli/publication-contract.d.ts.map +1 -0
  149. package/dist/tools/cli/publication-control.d.ts +4 -0
  150. package/dist/tools/cli/publication-control.d.ts.map +1 -0
  151. package/dist/tools/cli/publication-storage.d.ts +32 -0
  152. package/dist/tools/cli/publication-storage.d.ts.map +1 -0
  153. package/dist/tools/cli/publication.d.ts +35 -0
  154. package/dist/tools/cli/publication.d.ts.map +1 -0
  155. package/dist/tools/cli/update.d.ts.map +1 -1
  156. package/dist/tools/connections/define.d.ts.map +1 -1
  157. package/dist/tools/connections/error-projection.d.ts +4 -0
  158. package/dist/tools/connections/error-projection.d.ts.map +1 -0
  159. package/dist/tools/connections/errors.d.ts +24 -8
  160. package/dist/tools/connections/errors.d.ts.map +1 -1
  161. package/dist/tools/connections/limits.d.ts +11 -31
  162. package/dist/tools/connections/limits.d.ts.map +1 -1
  163. package/dist/tools/connections/mcp-client.d.ts +6 -4
  164. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  165. package/dist/tools/connections/mcp.d.ts.map +1 -1
  166. package/dist/tools/connections/openapi.d.ts.map +1 -1
  167. package/dist/tools/connections/operation-limits.d.ts +25 -0
  168. package/dist/tools/connections/operation-limits.d.ts.map +1 -0
  169. package/dist/tools/connections/sse-frames.d.ts +11 -2
  170. package/dist/tools/connections/sse-frames.d.ts.map +1 -1
  171. package/dist/tools/connections/sse-session.d.ts +15 -2
  172. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  173. package/dist/tools/connections/types.d.ts +19 -1
  174. package/dist/tools/connections/types.d.ts.map +1 -1
  175. package/dist/tools/execute-result.d.ts.map +1 -1
  176. package/dist/tools/execute.d.ts.map +1 -1
  177. package/dist/tools/internal/observe-hook.d.ts +3 -0
  178. package/dist/tools/internal/observe-hook.d.ts.map +1 -0
  179. package/dist/tools/internal/surface-projector.d.ts +2 -1
  180. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  181. package/dist/tools/mcp/mount.d.ts +2 -2
  182. package/dist/tools/mcp/mount.d.ts.map +1 -1
  183. package/dist/tools/mcp/prepare.d.ts +4 -5
  184. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  185. package/dist/tools/mcp/register.d.ts +4 -1
  186. package/dist/tools/mcp/register.d.ts.map +1 -1
  187. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  188. package/dist/tools/remote.d.ts.map +1 -1
  189. package/dist/tools/runtime-tool-execution.d.ts +65 -0
  190. package/dist/tools/runtime-tool-execution.d.ts.map +1 -0
  191. package/dist/tools/runtime-tool-mcp.d.ts +27 -0
  192. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -0
  193. package/dist/tools/runtime-tool.d.ts +9 -60
  194. package/dist/tools/runtime-tool.d.ts.map +1 -1
  195. package/dist/tools/surface.d.ts +12 -14
  196. package/dist/tools/surface.d.ts.map +1 -1
  197. package/llms/application.2.txt +221 -44
  198. package/llms/application.3.txt +3 -1
  199. package/llms/application.txt +1 -1
  200. package/llms/cli.2.txt +144 -1
  201. package/llms/cli.txt +133 -104
  202. package/llms/contract.txt +1 -1
  203. package/llms/process.txt +34 -5
  204. package/llms/server.4.txt +4 -1
  205. package/llms/server.5.txt +1 -0
  206. package/llms/stitchkit.2.txt +14 -0
  207. package/llms/stitchkit.txt +5 -4
  208. package/llms/telegram.txt +64 -2
  209. package/llms/tools-connections.txt +3 -0
  210. package/llms/tools-mcp.txt +29 -0
  211. package/llms/tools.2.txt +59 -0
  212. package/llms/tools.3.txt +1 -0
  213. package/llms/tools.txt +11 -52
  214. package/llms/upgrading-0.37.0-0.44.0.txt +444 -0
  215. package/llms/{upgrading-0.44.0-0.60.0.txt → upgrading-0.44.0-0.61.0.txt} +140 -271
  216. package/llms/{upgrading-0.61.0-0.74.0.txt → upgrading-0.62.0-0.79.0.txt} +171 -140
  217. package/llms/{upgrading-0.75.0-0.103.0.txt → upgrading-0.80.0-0.104.0.txt} +120 -171
  218. package/llms/upgrading.txt +4 -4
  219. package/llms-full.txt +677 -64
  220. package/llms.txt +13 -12
  221. package/package.json +10 -1
  222. package/dist/index-d4pa2bgs.js +0 -42
  223. package/dist/index-wykebpn9.js +0 -221
  224. package/llms/upgrading-0.37.0.txt +0 -176
  225. package/dist/{index-69nvze1q.js → index-pptyv13k.js} +3 -3
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  validateDeclaredOutput
3
- } from "./index-b2bz0kdm.js";
3
+ } from "./index-kb8styz3.js";
4
4
  import {
5
5
  toolResultFromError,
6
6
  toolErrorFromResult
7
- } from "./index-m2xqkv55.js";
7
+ } from "./index-2vnh05w4.js";
8
8
  import {
9
9
  coerceJsonArgs2
10
10
  } from "./index-9pw0a51a.js";
@@ -15,17 +15,17 @@ import {
15
15
  objectShapeKeys,
16
16
  assertUniqueToolName,
17
17
  buildToolPresentationSchema
18
- } from "./index-x87j7csh.js";
18
+ } from "./index-77nxk6ay.js";
19
19
  import {
20
20
  createToolRunner,
21
21
  formatToolError
22
- } from "./index-r956rndn.js";
22
+ } from "./index-2hyavjjj.js";
23
23
  import {
24
24
  isWithinDir2
25
25
  } from "./index-5cc6r990.js";
26
26
  import {
27
27
  collectToolSurface
28
- } from "./index-dnn9z96q.js";
28
+ } from "./index-a0zzh8ak.js";
29
29
  import {
30
30
  formatZodError2
31
31
  } from "./index-1eeqpadm.js";
@@ -120,6 +120,12 @@ var DEFAULT_EXIT_CODES2 = {
120
120
  CONFLICT: 5,
121
121
  RATE_LIMITED: 6,
122
122
  TIMEOUT: 7,
123
+ REQUEST_ABORTED: 130,
124
+ REQUEST_TIMEOUT: 7,
125
+ CONNECTION_TIMEOUT: 7,
126
+ CONNECTION_RESPONSE_TOO_LARGE: 1,
127
+ CONNECTION_REQUEST_FAILED: 1,
128
+ UPSTREAM_TOOL_ERROR: 1,
123
129
  WAIT_FAILED: 1,
124
130
  INTERNAL_SERVER_ERROR: 1
125
131
  };
@@ -152,6 +158,18 @@ class CliArgumentError2 extends Error {
152
158
 
153
159
  // src/tools/cli/args-fields.ts
154
160
  import { z } from "zod";
161
+ function appendCliOptionValue(raw, name, value, info) {
162
+ const existing = raw.get(name);
163
+ const repeatable = !name.includes(".") && (info === undefined || info.kind === "array");
164
+ if (existing !== undefined) {
165
+ if (!repeatable) {
166
+ throw new CliArgumentError2(`--${name} was passed ${existing.length + 1} times`);
167
+ }
168
+ existing.push(value);
169
+ } else {
170
+ raw.set(name, [value]);
171
+ }
172
+ }
155
173
  function unwrap(field) {
156
174
  if (field instanceof z.ZodOptional || field instanceof z.ZodNullable || field instanceof z.ZodDefault) {
157
175
  return unwrap(field.unwrap());
@@ -799,16 +817,13 @@ function readCliTokens(argv, fields, config) {
799
817
  help: false
800
818
  };
801
819
  const flags = new Map;
802
- const boolFlags = new Map;
820
+ const literalBooleanFlags = new Set;
821
+ const frameworkFlags = new Map;
803
822
  const viewFlags = new Map;
804
823
  let ascending = false;
805
824
  const positionals = [];
806
825
  const pushFlag = (name, value) => {
807
- const existing = flags.get(name);
808
- if (existing)
809
- existing.push(value);
810
- else
811
- flags.set(name, [value]);
826
+ appendCliOptionValue(flags, name, value, fields.get(name));
812
827
  };
813
828
  let optionsEnded = false;
814
829
  for (let i = 0;i < argv.length; i++) {
@@ -824,6 +839,7 @@ function readCliTokens(argv, fields, config) {
824
839
  continue;
825
840
  }
826
841
  if (tok === "-h") {
842
+ appendCliOptionValue(frameworkFlags, "help", "true", { kind: "boolean" });
827
843
  options.help = true;
828
844
  continue;
829
845
  }
@@ -839,7 +855,10 @@ function readCliTokens(argv, fields, config) {
839
855
  const separate = inline === undefined ? separateBoolValue(argv[i + 1]) : undefined;
840
856
  if (separate !== undefined)
841
857
  i++;
842
- boolFlags.set(field, inline === undefined ? separate ?? true : parseReservedBool(field, inline));
858
+ pushFlag(field, inline ?? String(separate ?? true));
859
+ if (inline !== undefined)
860
+ parseReservedBool(field, inline);
861
+ literalBooleanFlags.add(field);
843
862
  continue;
844
863
  }
845
864
  let value = inline;
@@ -866,6 +885,9 @@ function readCliTokens(argv, fields, config) {
866
885
  const separate = value === undefined ? separateBoolValue(argv[i + 1]) : undefined;
867
886
  if (separate !== undefined)
868
887
  i++;
888
+ appendCliOptionValue(frameworkFlags, name, value ?? String(separate ?? true), {
889
+ kind: "boolean"
890
+ });
869
891
  const enabled = value === undefined ? separate ?? true : parseReservedBool(name, value);
870
892
  if (name === "dry-run")
871
893
  options.dryRun = enabled;
@@ -889,6 +911,7 @@ function readCliTokens(argv, fields, config) {
889
911
  }
890
912
  if (!option.inline)
891
913
  i++;
914
+ appendCliOptionValue(frameworkFlags, name, value, { kind: "string" });
892
915
  if (name === "wait-timeout") {
893
916
  const timeout = Number(value);
894
917
  if (!Number.isFinite(timeout) || timeout <= 0) {
@@ -896,8 +919,6 @@ function readCliTokens(argv, fields, config) {
896
919
  }
897
920
  options.waitTimeout = timeout;
898
921
  } else if (VIEW_OPTIONS.has(name)) {
899
- if (viewFlags.has(name))
900
- throw new CliArgumentError2(`--${name} was given twice`);
901
922
  viewFlags.set(name, value);
902
923
  } else {
903
924
  options.outputDir = value;
@@ -905,7 +926,8 @@ function readCliTokens(argv, fields, config) {
905
926
  continue;
906
927
  }
907
928
  if (value === undefined && name.startsWith("no-") && fields.get(name.slice(3))?.kind === "boolean") {
908
- boolFlags.set(name.slice(3), false);
929
+ pushFlag(name.slice(3), "false");
930
+ literalBooleanFlags.add(name.slice(3));
909
931
  continue;
910
932
  }
911
933
  const unsafeSegment = name.split(".").find(isUnsafeKey);
@@ -922,7 +944,8 @@ function readCliTokens(argv, fields, config) {
922
944
  const separate = separateBoolValue(argv[i + 1]);
923
945
  if (separate !== undefined)
924
946
  i++;
925
- boolFlags.set(name, separate ?? true);
947
+ pushFlag(name, String(separate ?? true));
948
+ literalBooleanFlags.add(name);
926
949
  continue;
927
950
  }
928
951
  const next = argv[i + 1];
@@ -935,10 +958,10 @@ function readCliTokens(argv, fields, config) {
935
958
  }
936
959
  pushFlag(name, value);
937
960
  }
938
- return { options, flags, boolFlags, viewFlags, ascending, positionals };
961
+ return { options, flags, literalBooleanFlags, viewFlags, ascending, positionals };
939
962
  }
940
963
  function buildToolArgs(tokens, fields, declaredPositionals) {
941
- const { flags, boolFlags, positionals } = tokens;
964
+ const { flags, literalBooleanFlags, positionals } = tokens;
942
965
  const toolArgs = {};
943
966
  const fillable = declaredPositionals === undefined ? [...fields.entries()].filter(([, info]) => info.kind !== "boolean").map(([name]) => name) : [...declaredPositionals];
944
967
  const variadicTail = declaredPositionals !== undefined && fields.get(fillable[fillable.length - 1] ?? "")?.kind === "array" ? fillable[fillable.length - 1] : undefined;
@@ -964,14 +987,12 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
964
987
  if (pi < positionals.length) {
965
988
  throw new CliArgumentError2(`Unexpected positional argument "${positionals[pi]}"`);
966
989
  }
967
- for (const [key, value] of boolFlags) {
968
- toolArgs[key] = value;
969
- }
970
990
  const dottedRoots = new Map;
971
991
  for (const key of flags.keys()) {
972
992
  const dot = key.indexOf(".");
973
- if (dot > 0)
993
+ if (dot > 0 && !literalBooleanFlags.has(key)) {
974
994
  dottedRoots.set(key.slice(0, dot), key);
995
+ }
975
996
  }
976
997
  for (const [root, dotted] of dottedRoots) {
977
998
  if (flags.has(root)) {
@@ -979,17 +1000,11 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
979
1000
  }
980
1001
  }
981
1002
  for (const [key, values] of flags) {
982
- if (key.includes(".")) {
983
- if (values.length > 1) {
984
- throw new CliArgumentError2(`--${key} was passed ${values.length} times`);
985
- }
1003
+ const info = fields.get(key);
1004
+ if (key.includes(".") && !literalBooleanFlags.has(key)) {
986
1005
  setNested(toolArgs, key.split("."), looseCoerce(values[0] ?? ""));
987
1006
  continue;
988
1007
  }
989
- const info = fields.get(key);
990
- if (values.length > 1 && info !== undefined && info.kind !== "array" && info.kind !== "other") {
991
- throw new CliArgumentError2(`--${key} was passed ${values.length} times`);
992
- }
993
1008
  toolArgs[key] = coerceField(info, values, `--${key}`);
994
1009
  }
995
1010
  return toolArgs;
@@ -1041,11 +1056,7 @@ function extractCliGlobalOptions2(argv, schema) {
1041
1056
  throw new CliArgumentError2(`--${option.name} requires a value`);
1042
1057
  }
1043
1058
  }
1044
- const existing = raw.get(option.name);
1045
- if (existing)
1046
- existing.push(value);
1047
- else
1048
- raw.set(option.name, [value]);
1059
+ appendCliOptionValue(raw, option.name, value, info);
1049
1060
  }
1050
1061
  const args = {};
1051
1062
  for (const [name, values] of raw) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AppError2
3
- } from "./index-n53mswt3.js";
3
+ } from "./index-x928baz2.js";
4
4
  import {
5
5
  validateDeclaredOutput
6
- } from "./index-b2bz0kdm.js";
6
+ } from "./index-kb8styz3.js";
7
7
  import {
8
8
  toJsonSchema
9
9
  } from "./index-ct75c3at.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  projectToolSurface
3
- } from "./index-x87j7csh.js";
3
+ } from "./index-77nxk6ay.js";
4
4
  import {
5
5
  contractToolMountable
6
- } from "./index-r956rndn.js";
6
+ } from "./index-2hyavjjj.js";
7
7
  import {
8
8
  runtimeToolMountable
9
- } from "./index-tgzhq07n.js";
9
+ } from "./index-cvda079a.js";
10
10
 
11
11
  // src/tools/surface.ts
12
12
  function collectToolSurface({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  collectToolSurface
3
- } from "./index-dnn9z96q.js";
3
+ } from "./index-a0zzh8ak.js";
4
4
 
5
5
  // src/tools/manifest.ts
6
6
  function utf8Length(value) {
@@ -2,6 +2,8 @@
2
2
  import { z } from "zod";
3
3
  var timestamp = z.string().datetime({ offset: true });
4
4
  var key = z.string().min(1).max(255);
5
+ var DirectoryInboxIdentitySchema2 = z.object({ source: z.string().min(1).max(128), key: z.string().min(1).max(1024) }).strict();
6
+ var DirectoryInboxAcceptResultSchema2 = z.object({ status: z.enum(["accepted", "duplicate"]), filename: key }).strict();
5
7
  var DirectoryInboxRejectionReasonSchema2 = z.enum([
6
8
  "invalid",
7
9
  "too-large",
@@ -11,14 +13,20 @@ var DirectoryInboxStateSchema2 = z.object({
11
13
  schemaVersion: z.literal(1),
12
14
  claims: z.array(z.object({
13
15
  key,
16
+ identity: DirectoryInboxIdentitySchema2.optional(),
14
17
  attempts: z.number().int().positive(),
15
18
  nextAttemptAt: timestamp,
16
19
  leaseId: z.string().min(1).max(128).nullable(),
17
20
  leaseUntil: timestamp.nullable()
18
21
  }).strict()),
19
- receipts: z.array(z.object({ key, completedAt: timestamp }).strict()),
22
+ receipts: z.array(z.object({
23
+ key,
24
+ identity: DirectoryInboxIdentitySchema2.optional(),
25
+ completedAt: timestamp
26
+ }).strict()),
20
27
  rejected: z.array(z.object({
21
28
  key,
29
+ identity: DirectoryInboxIdentitySchema2.optional(),
22
30
  reason: DirectoryInboxRejectionReasonSchema2,
23
31
  detail: z.string().max(1000),
24
32
  rejectedAt: timestamp
@@ -57,6 +65,7 @@ function claimEntry(state, input) {
57
65
  if (claim.attempts >= input.maxAttempts) {
58
66
  const rejection = {
59
67
  key: input.key,
68
+ ...claim.identity && { identity: claim.identity },
60
69
  reason: "attempt-limit",
61
70
  detail: `taken ${claim.attempts} times without completing`,
62
71
  rejectedAt: iso(now)
@@ -82,17 +91,25 @@ function claimEntry(state, input) {
82
91
  step: { kind: "deliver", claim: taken }
83
92
  };
84
93
  }
85
- function completeEntry(state, entryKey, now, retain) {
94
+ function completeEntry(state, claim, now, retain) {
95
+ if (!ownsClaim(state, claim, now))
96
+ return state;
86
97
  return {
87
98
  ...state,
88
- claims: state.claims.filter((claim) => claim.key !== entryKey),
99
+ claims: state.claims.filter((candidate) => candidate.key !== claim.key),
89
100
  receipts: [
90
- { key: entryKey, completedAt: now.toISOString() },
91
- ...state.receipts.filter((receipt) => receipt.key !== entryKey)
101
+ {
102
+ key: claim.key,
103
+ ...claim.identity && { identity: claim.identity },
104
+ completedAt: now.toISOString()
105
+ },
106
+ ...state.receipts.filter((receipt) => receipt.key !== claim.key)
92
107
  ].slice(0, retain)
93
108
  };
94
109
  }
95
- function releaseEntry(state, claim, retryAt) {
110
+ function releaseEntry(state, claim, now, retryAt) {
111
+ if (!ownsClaim(state, claim, now))
112
+ return state;
96
113
  return {
97
114
  ...state,
98
115
  claims: state.claims.map((candidate) => candidate.key === claim.key && candidate.leaseId === claim.leaseId ? {
@@ -103,6 +120,17 @@ function releaseEntry(state, claim, retryAt) {
103
120
  } : candidate)
104
121
  };
105
122
  }
123
+ function ownsClaim(state, claim, now) {
124
+ return claim.leaseId !== null && state.claims.some((candidate) => candidate.key === claim.key && candidate.leaseId === claim.leaseId && candidate.leaseUntil !== null && Date.parse(candidate.leaseUntil) > now.getTime());
125
+ }
126
+ function renewEntry(state, claim, now, leaseMs) {
127
+ if (!ownsClaim(state, claim, now))
128
+ return state;
129
+ return {
130
+ ...state,
131
+ claims: state.claims.map((candidate) => candidate.key === claim.key ? { ...candidate, leaseUntil: iso(now.getTime() + leaseMs) } : candidate)
132
+ };
133
+ }
106
134
  function forgetMissing(state, present, now) {
107
135
  const live = (claim) => claim.leaseUntil !== null && Date.parse(claim.leaseUntil) > now.getTime();
108
136
  return {
@@ -111,4 +139,4 @@ function forgetMissing(state, present, now) {
111
139
  };
112
140
  }
113
141
 
114
- export { DirectoryInboxRejectionReasonSchema2, DirectoryInboxStateSchema2, emptyDirectoryInboxState, withRejection, claimEntry, completeEntry, releaseEntry, forgetMissing };
142
+ export { DirectoryInboxIdentitySchema2, DirectoryInboxAcceptResultSchema2, DirectoryInboxRejectionReasonSchema2, DirectoryInboxStateSchema2, emptyDirectoryInboxState, withRejection, claimEntry, completeEntry, releaseEntry, ownsClaim, renewEntry, forgetMissing };