stitchkit 0.108.4 → 0.109.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 (64) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/browser/cancellation.d.ts +4 -5
  3. package/dist/browser/cancellation.d.ts.map +1 -1
  4. package/dist/browser/client-executors.d.ts.map +1 -1
  5. package/dist/browser/http.d.ts.map +1 -1
  6. package/dist/entrypoints/agent-runtime/harness.js +4 -3
  7. package/dist/entrypoints/agent-runtime.js +7 -6
  8. package/dist/entrypoints/cli.js +6 -5
  9. package/dist/entrypoints/index.js +2 -2
  10. package/dist/entrypoints/react.js +1 -1
  11. package/dist/entrypoints/remote.js +2 -2
  12. package/dist/entrypoints/telegram.d.ts +2 -2
  13. package/dist/entrypoints/telegram.d.ts.map +1 -1
  14. package/dist/entrypoints/telegram.js +868 -137
  15. package/dist/entrypoints/testing.js +2 -2
  16. package/dist/entrypoints/tools/connections.js +6 -1
  17. package/dist/entrypoints/tools/contract.js +2 -1
  18. package/dist/entrypoints/tools/invoker.js +5 -4
  19. package/dist/entrypoints/tools/mcp.js +6 -5
  20. package/dist/entrypoints/tools.js +9 -8
  21. package/dist/{index-7jvwrjqa.js → index-00v1qz76.js} +20 -17
  22. package/dist/{index-cx2nh595.js → index-3wm2xp2a.js} +1 -1
  23. package/dist/{index-fgq4w9bf.js → index-5cw390s6.js} +100 -20
  24. package/dist/{index-h7qms8f9.js → index-68y3n9j3.js} +3 -3
  25. package/dist/{index-6yxhe58g.js → index-cykxpxz5.js} +7 -0
  26. package/dist/{index-p5kx5vqd.js → index-e32vy8jw.js} +22 -11
  27. package/dist/{index-dm2fv45z.js → index-k4v2kq4q.js} +1 -1
  28. package/dist/{index-6y9t2fwz.js → index-kvvpw1kq.js} +2 -2
  29. package/dist/{index-2s6fpehp.js → index-ryv32myz.js} +1 -1
  30. package/dist/index-t5sjh517.js +100 -0
  31. package/dist/{index-yz8x0hbx.js → index-tpk71wqn.js} +1 -1
  32. package/dist/{index-mep4sb48.js → index-x5xs71dw.js} +3 -3
  33. package/dist/telegram/update-intake-work.d.ts +39 -0
  34. package/dist/telegram/update-intake-work.d.ts.map +1 -0
  35. package/dist/telegram/update-intake.d.ts +47 -9
  36. package/dist/telegram/update-intake.d.ts.map +1 -1
  37. package/dist/telegram/update-store-check.d.ts.map +1 -1
  38. package/dist/telegram/update-store-postgres.d.ts +2 -2
  39. package/dist/telegram/update-store-postgres.d.ts.map +1 -1
  40. package/dist/telegram/update-store-sqlite.d.ts +2 -2
  41. package/dist/telegram/update-store-sqlite.d.ts.map +1 -1
  42. package/dist/telegram/update-store.d.ts +52 -3
  43. package/dist/telegram/update-store.d.ts.map +1 -1
  44. package/dist/tools/cli/args-fields.d.ts +7 -1
  45. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  46. package/dist/tools/cli/args.d.ts.map +1 -1
  47. package/dist/tools/connections/runtime.d.ts.map +1 -1
  48. package/dist/tools/schema/coerce.d.ts.map +1 -1
  49. package/dist/tools/schema/json-schema-origin.d.ts +14 -0
  50. package/dist/tools/schema/json-schema-origin.d.ts.map +1 -0
  51. package/llms/cli.2.txt +1 -1
  52. package/llms/cli.txt +12 -0
  53. package/llms/stitchkit.txt +10 -3
  54. package/llms/telegram.txt +59 -8
  55. package/llms/tools.3.txt +1 -1
  56. package/llms/{upgrading-0.100.0-0.108.0.txt → upgrading-0.101.0-0.109.0.txt} +70 -72
  57. package/llms/upgrading-0.37.0.txt +176 -0
  58. package/llms/{upgrading-0.37.0-0.58.0.txt → upgrading-0.44.0-0.60.0.txt} +229 -169
  59. package/llms/{upgrading-0.59.0-0.71.0.txt → upgrading-0.61.0-0.73.0.txt} +122 -229
  60. package/llms/{upgrading-0.72.0-0.99.0.txt → upgrading-0.74.0-0.100.0.txt} +72 -122
  61. package/llms/upgrading.txt +5 -4
  62. package/llms-full.txt +150 -13
  63. package/llms.txt +9 -8
  64. package/package.json +1 -1
@@ -2,7 +2,7 @@ import {
2
2
  joinRoutePath
3
3
  } from "../index-m38ej7e5.js";
4
4
  import"../index-h2fhjqy7.js";
5
- import"../index-7jvwrjqa.js";
5
+ import"../index-00v1qz76.js";
6
6
  import"../index-q0th8q0z.js";
7
7
  import {
8
8
  createApplication2
@@ -35,7 +35,7 @@ import"../index-fynr93w4.js";
35
35
  import {
36
36
  createClient2,
37
37
  createClients2
38
- } from "../index-p5kx5vqd.js";
38
+ } from "../index-e32vy8jw.js";
39
39
  import {
40
40
  assertPositiveSafeInteger
41
41
  } from "../index-0s4xebbg.js";
@@ -4,6 +4,9 @@ import {
4
4
  withDefsDialect
5
5
  } from "../../index-q6crhe1n.js";
6
6
  import"../../index-fynr93w4.js";
7
+ import {
8
+ markJsonSchemaObjectGuards
9
+ } from "../../index-t5sjh517.js";
7
10
  import {
8
11
  withSignalDeadline
9
12
  } from "../../index-9tqbxv5p.js";
@@ -856,8 +859,10 @@ function zodObjectFromJsonSchema(schema) {
856
859
  if (!schema || Object.keys(schema).length === 0)
857
860
  return z.looseObject({});
858
861
  const parsed = z.fromJSONSchema(reconcileDefinitionKeyword(schema));
859
- if (parsed instanceof z.ZodObject)
862
+ if (parsed instanceof z.ZodObject) {
863
+ markJsonSchemaObjectGuards(parsed);
860
864
  return parsed;
865
+ }
861
866
  return z.looseObject({});
862
867
  }
863
868
  function reconcileDefinitionKeyword(schema) {
@@ -9,7 +9,8 @@ import {
9
9
  } from "../../index-0gxvns6s.js";
10
10
  import {
11
11
  coerceJsonArgs2
12
- } from "../../index-6yxhe58g.js";
12
+ } from "../../index-cykxpxz5.js";
13
+ import"../../index-t5sjh517.js";
13
14
  export {
14
15
  AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
15
16
  McpAnnotationsSchema2 as McpAnnotationsSchema,
@@ -1,12 +1,13 @@
1
1
  import"../../index-fynr93w4.js";
2
- import"../../index-6yxhe58g.js";
2
+ import"../../index-t5sjh517.js";
3
+ import"../../index-cykxpxz5.js";
3
4
  import"../../index-ct75c3at.js";
4
5
  import"../../index-q6crhe1n.js";
5
- import"../../index-dm2fv45z.js";
6
- import"../../index-2s6fpehp.js";
6
+ import"../../index-k4v2kq4q.js";
7
+ import"../../index-ryv32myz.js";
7
8
  import {
8
9
  createToolInvoker2
9
- } from "../../index-6y9t2fwz.js";
10
+ } from "../../index-kvvpw1kq.js";
10
11
  export {
11
12
  createToolInvoker2 as createToolInvoker
12
13
  };
@@ -1,9 +1,10 @@
1
1
  import"../../index-ct75c3at.js";
2
2
  import"../../index-fynr93w4.js";
3
- import"../../index-6yxhe58g.js";
3
+ import"../../index-t5sjh517.js";
4
+ import"../../index-cykxpxz5.js";
4
5
  import"../../index-q6crhe1n.js";
5
- import"../../index-dm2fv45z.js";
6
- import"../../index-2s6fpehp.js";
6
+ import"../../index-k4v2kq4q.js";
7
+ import"../../index-ryv32myz.js";
7
8
  import {
8
9
  RESOURCE_MIME_TYPE2,
9
10
  EXT_APPS_BUNDLE_PLACEHOLDER2,
@@ -19,8 +20,8 @@ import {
19
20
  createMcpHttpRoute2,
20
21
  createStdioMcpServer2,
21
22
  bindStdioProcessSignals2
22
- } from "../../index-mep4sb48.js";
23
- import"../../index-cx2nh595.js";
23
+ } from "../../index-x5xs71dw.js";
24
+ import"../../index-3wm2xp2a.js";
24
25
  import"../../index-636mggad.js";
25
26
  export {
26
27
  EXT_APPS_BUNDLE_PLACEHOLDER2 as EXT_APPS_BUNDLE_PLACEHOLDER,
@@ -7,9 +7,10 @@ import {
7
7
  import {
8
8
  normalizeError2
9
9
  } from "../index-fynr93w4.js";
10
+ import"../index-t5sjh517.js";
10
11
  import {
11
12
  coerceJsonArgs2
12
- } from "../index-6yxhe58g.js";
13
+ } from "../index-cykxpxz5.js";
13
14
  import"../index-ct75c3at.js";
14
15
  import {
15
16
  assertToolName,
@@ -22,15 +23,15 @@ import {
22
23
  import {
23
24
  ToolExecutionControlError2,
24
25
  isToolExecutionControlError2
25
- } from "../index-dm2fv45z.js";
26
+ } from "../index-k4v2kq4q.js";
26
27
  import {
27
28
  collectTools2
28
- } from "../index-2s6fpehp.js";
29
+ } from "../index-ryv32myz.js";
29
30
  import {
30
31
  mountAgent2,
31
32
  describeToolCatalog2,
32
33
  buildToolManifest2
33
- } from "../index-h7qms8f9.js";
34
+ } from "../index-68y3n9j3.js";
34
35
  import"../index-m38ej7e5.js";
35
36
  import {
36
37
  ALL_TRANSPORTS2,
@@ -57,7 +58,7 @@ import {
57
58
  createMcpHttpRoute2,
58
59
  createStdioMcpServer2,
59
60
  bindStdioProcessSignals2
60
- } from "../index-mep4sb48.js";
61
+ } from "../index-x5xs71dw.js";
61
62
  import {
62
63
  AsyncOperationCancelResultSchema2,
63
64
  createAsyncOperationSnapshotSchema2,
@@ -71,7 +72,7 @@ import {
71
72
  WaitTimeoutError,
72
73
  runWaitOperation,
73
74
  createCli2
74
- } from "../index-fgq4w9bf.js";
75
+ } from "../index-5cw390s6.js";
75
76
  import {
76
77
  ManagedFilePathSchema2,
77
78
  ManagedFileRefSchema2
@@ -95,7 +96,7 @@ import {
95
96
  import"../index-1bx1xv1k.js";
96
97
  import {
97
98
  collectToolSurface
98
- } from "../index-cx2nh595.js";
99
+ } from "../index-3wm2xp2a.js";
99
100
  import {
100
101
  defineRuntimeTool2,
101
102
  createRuntimeToolFactory2
@@ -105,7 +106,7 @@ import {
105
106
  } from "../index-yk4g8805.js";
106
107
  import {
107
108
  createToolInvoker2
108
- } from "../index-6y9t2fwz.js";
109
+ } from "../index-kvvpw1kq.js";
109
110
  import {
110
111
  getTraceId2
111
112
  } from "../index-y3nemndz.js";
@@ -19,10 +19,10 @@ import ky, {
19
19
 
20
20
  // src/browser/cancellation.ts
21
21
  class RequestCancellationError extends Error {
22
- cause;
23
- constructor(cause) {
24
- super(cause === "caller" ? "Request was aborted" : "Request timed out");
25
- this.cause = cause;
22
+ origin;
23
+ constructor(origin, cause) {
24
+ super(origin === "caller" ? "Request was aborted" : "Request timed out", cause === undefined ? undefined : { cause });
25
+ this.origin = origin;
26
26
  this.name = "RequestCancellationError";
27
27
  }
28
28
  }
@@ -32,12 +32,12 @@ function createRequestCancellation(caller, timeoutMs) {
32
32
  }
33
33
  const timeoutController = timeoutMs === undefined ? undefined : new AbortController;
34
34
  const signal = caller && timeoutController ? AbortSignal.any([caller, timeoutController.signal]) : caller ?? timeoutController?.signal;
35
- let cause;
35
+ let origin;
36
36
  let timer;
37
37
  const abortFromCaller = () => {
38
- if (cause)
38
+ if (origin)
39
39
  return;
40
- cause = "caller";
40
+ origin = "caller";
41
41
  };
42
42
  if (caller?.aborted)
43
43
  abortFromCaller();
@@ -45,9 +45,9 @@ function createRequestCancellation(caller, timeoutMs) {
45
45
  caller?.addEventListener("abort", abortFromCaller, { once: true });
46
46
  if (timeoutMs !== undefined && timeoutController) {
47
47
  timer = setTimeout(() => {
48
- if (cause)
48
+ if (origin)
49
49
  return;
50
- cause = "timeout";
50
+ origin = "timeout";
51
51
  timeoutController.abort(new DOMException("Request timed out", "TimeoutError"));
52
52
  }, timeoutMs);
53
53
  }
@@ -55,12 +55,14 @@ function createRequestCancellation(caller, timeoutMs) {
55
55
  signal,
56
56
  async run(operation) {
57
57
  try {
58
- if (cause === "caller")
59
- throw cancellationError(cause);
58
+ if (origin === "caller")
59
+ throw cancellationError(origin);
60
60
  return await operation(signal);
61
61
  } catch (error) {
62
- if (cause)
63
- throw cancellationError(cause);
62
+ if (error instanceof RequestCancellationError)
63
+ throw error;
64
+ if (origin)
65
+ throw cancellationError(origin, error);
64
66
  throw error;
65
67
  } finally {
66
68
  if (timer !== undefined)
@@ -70,8 +72,8 @@ function createRequestCancellation(caller, timeoutMs) {
70
72
  }
71
73
  };
72
74
  }
73
- function cancellationError(cause) {
74
- return new RequestCancellationError(cause);
75
+ function cancellationError(origin, cause) {
76
+ return new RequestCancellationError(origin, cause);
75
77
  }
76
78
 
77
79
  // src/browser/http-fetch.ts
@@ -412,9 +414,10 @@ function assertTransportChoice(config) {
412
414
  }
413
415
  function requestFailure(error, emit) {
414
416
  if (error instanceof RequestCancellationError) {
415
- return new ApiError2(error.cause === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
417
+ return new ApiError2(error.origin === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
416
418
  status: 0,
417
- message: error.message
419
+ message: error.message,
420
+ ...error.cause !== undefined && { cause: error.cause }
418
421
  });
419
422
  }
420
423
  if (ApiError2.is(error))
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  contractToolMountable
6
- } from "./index-2s6fpehp.js";
6
+ } from "./index-ryv32myz.js";
7
7
  import {
8
8
  runtimeToolMountable
9
9
  } from "./index-636mggad.js";
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  validateDeclaredOutput
3
3
  } from "./index-fynr93w4.js";
4
+ import {
5
+ jsonSchemaObjectCoercionMembers
6
+ } from "./index-t5sjh517.js";
4
7
  import {
5
8
  coerceJsonArgs2
6
- } from "./index-6yxhe58g.js";
9
+ } from "./index-cykxpxz5.js";
7
10
  import {
8
11
  jsonSchemaFields
9
12
  } from "./index-ct75c3at.js";
@@ -15,11 +18,11 @@ import {
15
18
  import {
16
19
  toolResultFromError,
17
20
  toolErrorFromResult
18
- } from "./index-dm2fv45z.js";
21
+ } from "./index-k4v2kq4q.js";
19
22
  import {
20
23
  createToolRunner,
21
24
  formatToolError
22
- } from "./index-2s6fpehp.js";
25
+ } from "./index-ryv32myz.js";
23
26
  import {
24
27
  fetchGuarded,
25
28
  readCapped
@@ -32,7 +35,7 @@ import {
32
35
  } from "./index-eemvahkc.js";
33
36
  import {
34
37
  collectToolSurface
35
- } from "./index-cx2nh595.js";
38
+ } from "./index-3wm2xp2a.js";
36
39
  import {
37
40
  formatZodError2
38
41
  } from "./index-1eeqpadm.js";
@@ -167,7 +170,7 @@ class CliArgumentError2 extends Error {
167
170
  import { z } from "zod";
168
171
  function appendCliOptionValue(raw, name, value, info) {
169
172
  const existing = raw.get(name);
170
- const repeatable = !name.includes(".") && (info === undefined || info.kind === "array");
173
+ const repeatable = info?.kind === "array" || !name.includes(".") && info === undefined;
171
174
  if (existing !== undefined) {
172
175
  if (!repeatable) {
173
176
  throw new CliArgumentError2(`--${name} was passed ${existing.length + 1} times`);
@@ -230,8 +233,12 @@ function mergeField(fields, name, info) {
230
233
  fields.set(name, info);
231
234
  return;
232
235
  }
233
- if (existing.kind === info.kind)
236
+ if (existing.kind === info.kind) {
237
+ if (existing.kind === "array" && existing.elementKind !== info.elementKind) {
238
+ fields.set(name, { kind: "array", elementKind: "other" });
239
+ }
234
240
  return;
241
+ }
235
242
  if (existing.kind === "boolean" || info.kind === "boolean") {
236
243
  fields.set(name, { kind: "boolean" });
237
244
  return;
@@ -275,6 +282,71 @@ function describeSchemaFields(schema) {
275
282
  collectSchemaFields(schema, fields);
276
283
  return fields;
277
284
  }
285
+ function infoOf(field) {
286
+ const base = unwrap(field);
287
+ const kind = classify(base);
288
+ if (kind === "array" && base instanceof z.ZodArray) {
289
+ return { kind, elementKind: classify(unwrap(base.element)) };
290
+ }
291
+ return {
292
+ kind,
293
+ ...base instanceof z.ZodNumber && base.isInt && { integer: true }
294
+ };
295
+ }
296
+ function mergePathInfos(infos, composition) {
297
+ const present = infos.filter((info) => info !== undefined);
298
+ if (present.length === 0)
299
+ return;
300
+ if (composition === "union" && present.some((info) => info.kind === "other")) {
301
+ return { kind: "other" };
302
+ }
303
+ const concrete = present.filter((info) => info.kind !== "other");
304
+ const candidates = composition === "intersection" && concrete.length > 0 ? concrete : present;
305
+ const first = candidates[0];
306
+ if (!first)
307
+ return;
308
+ if (candidates.every((info) => info.kind === first.kind)) {
309
+ const elementKind = first.kind === "array" ? candidates.every((info) => info.elementKind === first.elementKind) ? first.elementKind : "other" : undefined;
310
+ return {
311
+ kind: first.kind,
312
+ ...elementKind && { elementKind },
313
+ ...first.integer && candidates.every((info) => info.integer) && { integer: true }
314
+ };
315
+ }
316
+ return candidates.some((info) => info.kind === "boolean") ? { kind: "boolean" } : { kind: "other" };
317
+ }
318
+ function pathInfo(schema, path) {
319
+ const guarded = jsonSchemaObjectCoercionMembers(schema);
320
+ if (guarded) {
321
+ return mergePathInfos(guarded.map((member) => pathInfo(member, path)), "intersection");
322
+ }
323
+ const base = unwrap(schema);
324
+ if (base !== schema)
325
+ return pathInfo(base, path);
326
+ if (base instanceof z.ZodUnion) {
327
+ return mergePathInfos(base.def.options.map((member) => pathInfo(member, path)), "union");
328
+ }
329
+ if (base instanceof z.ZodIntersection) {
330
+ return mergePathInfos([pathInfo(base.def.left, path), pathInfo(base.def.right, path)], "intersection");
331
+ }
332
+ if (path.length === 0)
333
+ return infoOf(base);
334
+ const [name, ...rest] = path;
335
+ if (name === undefined)
336
+ return infoOf(base);
337
+ if (base instanceof z.ZodObject) {
338
+ const member = base.shape[name] ?? base.def.catchall;
339
+ return member ? pathInfo(member, rest) : undefined;
340
+ }
341
+ if (base instanceof z.ZodRecord)
342
+ return pathInfo(base.valueType, rest);
343
+ return;
344
+ }
345
+ function describeSchemaPath(schema, path) {
346
+ if (!schema || path.length === 0)
347
+ return;
348
+ return pathInfo(schema, path);
349
+ }
278
350
  var TRUE_WORDS = new Set(["true", "1", "yes", "on"]);
279
351
  var FALSE_WORDS = new Set(["false", "0", "no", "off"]);
280
352
  function separateBoolValue(next) {
@@ -329,8 +401,8 @@ function looseCoerce(value) {
329
401
  return true;
330
402
  if (value === "false")
331
403
  return false;
332
- const n = Number(value);
333
- return value.trim() !== "" && !Number.isNaN(n) ? n : value;
404
+ const number = Number(value);
405
+ return value.trim() !== "" && !Number.isNaN(number) ? number : value;
334
406
  }
335
407
  function looksLikeJson(value) {
336
408
  const t = value.trim();
@@ -840,7 +912,7 @@ function resolveCliView(flags, ascending) {
840
912
  }
841
913
 
842
914
  // src/tools/cli/args.ts
843
- function readCliTokens(argv, fields, config) {
915
+ function readCliTokens(argv, fields, fieldFor, config) {
844
916
  const options = {
845
917
  json: false,
846
918
  wait: false,
@@ -855,7 +927,7 @@ function readCliTokens(argv, fields, config) {
855
927
  let ascending = false;
856
928
  const positionals = [];
857
929
  const pushFlag = (name, value) => {
858
- appendCliOptionValue(flags, name, value, fields.get(name));
930
+ appendCliOptionValue(flags, name, value, fieldFor(name));
859
931
  };
860
932
  let optionsEnded = false;
861
933
  for (let i = 0;i < argv.length; i++) {
@@ -881,7 +953,7 @@ function readCliTokens(argv, fields, config) {
881
953
  if (!alias || !field)
882
954
  throw new CliArgumentError2(`Unknown option "${tok}"`);
883
955
  const inline = match?.[2];
884
- const info = fields.get(field);
956
+ const info = fieldFor(field);
885
957
  if (info?.kind === "boolean") {
886
958
  const separate = inline === undefined ? separateBoolValue(argv[i + 1]) : undefined;
887
959
  if (separate !== undefined)
@@ -958,7 +1030,7 @@ function readCliTokens(argv, fields, config) {
958
1030
  }
959
1031
  continue;
960
1032
  }
961
- if (value === undefined && name.startsWith("no-") && fields.get(name.slice(3))?.kind === "boolean") {
1033
+ if (value === undefined && name.startsWith("no-") && fieldFor(name.slice(3))?.kind === "boolean") {
962
1034
  pushFlag(name.slice(3), "false");
963
1035
  literalBooleanFlags.add(name.slice(3));
964
1036
  continue;
@@ -967,7 +1039,7 @@ function readCliTokens(argv, fields, config) {
967
1039
  if (unsafeSegment !== undefined) {
968
1040
  throw new CliArgumentError2(`Unsafe option name "--${name}"`);
969
1041
  }
970
- const info = fields.get(name);
1042
+ const info = fieldFor(name);
971
1043
  const rootName = name.split(".")[0] ?? name;
972
1044
  if (!fields.has(rootName) && !config.allowUnknown) {
973
1045
  throw new CliArgumentError2(`Unknown option "--${name}"`);
@@ -993,7 +1065,7 @@ function readCliTokens(argv, fields, config) {
993
1065
  }
994
1066
  return { options, flags, literalBooleanFlags, viewFlags, ascending, positionals };
995
1067
  }
996
- function buildToolArgs(tokens, fields, declaredPositionals) {
1068
+ function buildToolArgs(tokens, fields, fieldFor, declaredPositionals, allowUnknown) {
997
1069
  const { flags, literalBooleanFlags, positionals } = tokens;
998
1070
  const toolArgs = {};
999
1071
  const fillable = declaredPositionals === undefined ? [...fields.entries()].filter(([, info]) => info.kind !== "boolean").map(([name]) => name) : [...declaredPositionals];
@@ -1023,7 +1095,8 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
1023
1095
  const dottedRoots = new Map;
1024
1096
  for (const key of flags.keys()) {
1025
1097
  const dot = key.indexOf(".");
1026
- if (dot > 0 && !literalBooleanFlags.has(key)) {
1098
+ const exactLiteralBoolean = literalBooleanFlags.has(key) && fields.has(key);
1099
+ if (dot > 0 && !exactLiteralBoolean) {
1027
1100
  dottedRoots.set(key.slice(0, dot), key);
1028
1101
  }
1029
1102
  }
@@ -1033,9 +1106,12 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
1033
1106
  }
1034
1107
  }
1035
1108
  for (const [key, values] of flags) {
1036
- const info = fields.get(key);
1037
- if (key.includes(".") && !literalBooleanFlags.has(key)) {
1038
- setNested(toolArgs, key.split("."), looseCoerce(values[0] ?? ""));
1109
+ const info = fieldFor(key);
1110
+ const exactLiteralBoolean = literalBooleanFlags.has(key) && fields.has(key);
1111
+ if (key.includes(".") && !exactLiteralBoolean) {
1112
+ const root = key.split(".")[0] ?? key;
1113
+ const value = info === undefined && allowUnknown && !fields.has(root) ? looseCoerce(values[0] ?? "") : coerceField(info, values, `--${key}`);
1114
+ setNested(toolArgs, key.split("."), value);
1039
1115
  continue;
1040
1116
  }
1041
1117
  toolArgs[key] = coerceField(info, values, `--${key}`);
@@ -1048,12 +1124,16 @@ function parseCliArgs2(argv, schema, config = {}) {
1048
1124
  if (!fields.has(name))
1049
1125
  fields.set(name, { kind: "other" });
1050
1126
  }
1051
- const tokens = readCliTokens(argv, fields, config);
1127
+ const fieldFor = (name) => fields.get(name) ?? (name.includes(".") ? describeSchemaPath(schema, name.split(".")) : undefined);
1128
+ const tokens = readCliTokens(argv, fields, fieldFor, config);
1052
1129
  const { options } = tokens;
1053
1130
  const view = resolveCliView(tokens.viewFlags, tokens.ascending);
1054
1131
  if (view)
1055
1132
  options.view = view;
1056
- return { toolArgs: buildToolArgs(tokens, fields, config.positionals), options };
1133
+ return {
1134
+ toolArgs: buildToolArgs(tokens, fields, fieldFor, config.positionals, config.allowUnknown === true),
1135
+ options
1136
+ };
1057
1137
  }
1058
1138
  function refuseGlobalOption(issue) {
1059
1139
  const field = issue?.path[0];
@@ -2,18 +2,18 @@ import {
2
2
  toolResultFromError,
3
3
  toolCauseFromResult,
4
4
  isToolExecutionControlError2
5
- } from "./index-dm2fv45z.js";
5
+ } from "./index-k4v2kq4q.js";
6
6
  import {
7
7
  createToolRunner,
8
8
  formatToolError
9
- } from "./index-2s6fpehp.js";
9
+ } from "./index-ryv32myz.js";
10
10
  import {
11
11
  AgentToolError2,
12
12
  resolveToolDurability
13
13
  } from "./index-c17xcx4k.js";
14
14
  import {
15
15
  collectToolSurface
16
- } from "./index-cx2nh595.js";
16
+ } from "./index-3wm2xp2a.js";
17
17
  import {
18
18
  agentPresenterOf
19
19
  } from "./index-636mggad.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ jsonSchemaObjectCoercionMembers
3
+ } from "./index-t5sjh517.js";
1
4
  import {
2
5
  safeJsonParse
3
6
  } from "./index-zsarb5xp.js";
@@ -76,6 +79,10 @@ function coerceValue(value, schema, path) {
76
79
  if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable || schema instanceof z.ZodDefault) {
77
80
  return coerceValue(value, schema.unwrap(), path);
78
81
  }
82
+ const guardedMembers = jsonSchemaObjectCoercionMembers(schema);
83
+ if (guardedMembers) {
84
+ return guardedMembers.reduce((current, member) => coerceValue(current, member, path), value);
85
+ }
79
86
  let current = value;
80
87
  if (typeof current === "string" && needsJsonCoercion(schema)) {
81
88
  if (acceptsRawString(schema)) {
@@ -13,7 +13,7 @@ import {
13
13
  uploadProgressRoute,
14
14
  withUploadProgress,
15
15
  parseApiErrorBody
16
- } from "./index-7jvwrjqa.js";
16
+ } from "./index-00v1qz76.js";
17
17
  import {
18
18
  abortReason,
19
19
  untilAborted
@@ -702,23 +702,33 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
702
702
  const cancellation = streamAbort ? {
703
703
  signal: requestSignal,
704
704
  async run(operation) {
705
- let timedOut = false;
705
+ let origin;
706
+ const abortFromCaller = () => {
707
+ origin ??= "caller";
708
+ };
709
+ if (options?.signal?.aborted)
710
+ abortFromCaller();
711
+ else
712
+ options?.signal?.addEventListener("abort", abortFromCaller, { once: true });
706
713
  const timer = setTimeout(() => {
707
- timedOut = true;
714
+ if (origin)
715
+ return;
716
+ origin = "timeout";
708
717
  streamAbort.abort(new DOMException("Request timed out", "TimeoutError"));
709
718
  }, openTimeoutMs);
710
719
  try {
711
- if (options?.signal?.aborted)
712
- throw new RequestCancellationError("caller");
720
+ if (origin === "caller")
721
+ throw new RequestCancellationError(origin);
713
722
  return await operation(requestSignal);
714
723
  } catch (error) {
715
- if (timedOut)
716
- throw new RequestCancellationError("timeout");
717
- if (options?.signal?.aborted)
718
- throw new RequestCancellationError("caller");
724
+ if (error instanceof RequestCancellationError)
725
+ throw error;
726
+ if (origin)
727
+ throw new RequestCancellationError(origin, error);
719
728
  throw error;
720
729
  } finally {
721
730
  clearTimeout(timer);
731
+ options?.signal?.removeEventListener("abort", abortFromCaller);
722
732
  }
723
733
  }
724
734
  } : createRequestCancellation(requestSignal, openTimeoutMs);
@@ -758,9 +768,10 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
758
768
  });
759
769
  } catch (error) {
760
770
  if (error instanceof RequestCancellationError) {
761
- throw new ApiError2(error.cause === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
771
+ throw new ApiError2(error.origin === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
762
772
  status: 0,
763
- message: error.message
773
+ message: error.message,
774
+ ...error.cause !== undefined && { cause: error.cause }
764
775
  });
765
776
  }
766
777
  if (ApiError2.is(error))
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-fynr93w4.js";
5
5
  import {
6
6
  coerceJsonArgs2
7
- } from "./index-6yxhe58g.js";
7
+ } from "./index-cykxpxz5.js";
8
8
  import {
9
9
  applyToolViewDefaults,
10
10
  projectToolView,
@@ -3,11 +3,11 @@ import {
3
3
  } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  toolErrorFromResult
6
- } from "./index-dm2fv45z.js";
6
+ } from "./index-k4v2kq4q.js";
7
7
  import {
8
8
  collectTools2,
9
9
  createToolRunner
10
- } from "./index-2s6fpehp.js";
10
+ } from "./index-ryv32myz.js";
11
11
  import {
12
12
  AppError2
13
13
  } from "./index-j9gxbztg.js";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  toolErrorFromResult,
9
9
  executeToolMethod
10
- } from "./index-dm2fv45z.js";
10
+ } from "./index-k4v2kq4q.js";
11
11
  import {
12
12
  isRetryableStatus2
13
13
  } from "./index-j9gxbztg.js";