stitchkit 0.108.4 → 0.108.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -15,6 +15,16 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.108.5] - 2026-10-10
19
+
20
+ ### Fixed
21
+
22
+ - `stitchkit/cli` — JSON object and record flags now keep working after an MCP input schema is
23
+ restored through `z.fromJSONSchema`, including schemas with `propertyNames`, `minProperties` or
24
+ `maxProperties`. The CLI accepts both `--data '{"code":"007"}'` and
25
+ `--data='{"code":"007"}'`, preserves lexical strings and nested values, and still applies the
26
+ restored object guards before remote dispatch. Application transform pipes remain untouched.
27
+
18
28
  ## [0.108.4] - 2026-10-09
19
29
 
20
30
  ### Fixed
@@ -5,14 +5,15 @@ import"../../index-8kzct1d6.js";
5
5
  import {
6
6
  composeAgentPrompt2,
7
7
  createAgentRuntime2
8
- } from "../../index-yz8x0hbx.js";
8
+ } from "../../index-tpk71wqn.js";
9
9
  import"../../index-qaet40b2.js";
10
10
  import"../../index-mnkk1ffz.js";
11
11
  import"../../index-fynr93w4.js";
12
- import"../../index-6yxhe58g.js";
12
+ import"../../index-t5sjh517.js";
13
+ import"../../index-cykxpxz5.js";
13
14
  import"../../index-ct75c3at.js";
14
15
  import"../../index-q6crhe1n.js";
15
- import"../../index-dm2fv45z.js";
16
+ import"../../index-k4v2kq4q.js";
16
17
  import"../../index-c17xcx4k.js";
17
18
  import"../../index-0gs4ymfj.js";
18
19
  import"../../index-5w6t91ze.js";
@@ -111,22 +111,23 @@ import {
111
111
  agentGoalStateSlot2,
112
112
  agentTodoStateSlot2,
113
113
  createAgentRuntime2
114
- } from "../index-yz8x0hbx.js";
114
+ } from "../index-tpk71wqn.js";
115
115
  import {
116
116
  AgentConversationSummarySchema2,
117
117
  AgentConversationPageSchema2,
118
118
  AgentConversationMessagePageSchema2
119
119
  } from "../index-kqnd6a85.js";
120
120
  import"../index-fynr93w4.js";
121
- import"../index-6yxhe58g.js";
121
+ import"../index-t5sjh517.js";
122
+ import"../index-cykxpxz5.js";
122
123
  import"../index-ct75c3at.js";
123
124
  import"../index-q6crhe1n.js";
124
- import"../index-dm2fv45z.js";
125
- import"../index-2s6fpehp.js";
125
+ import"../index-k4v2kq4q.js";
126
+ import"../index-ryv32myz.js";
126
127
  import {
127
128
  mountAgent2,
128
129
  buildToolManifest2
129
- } from "../index-h7qms8f9.js";
130
+ } from "../index-68y3n9j3.js";
130
131
  import {
131
132
  createBoundedSinkManager
132
133
  } from "../index-qaet40b2.js";
@@ -192,7 +193,7 @@ import {
192
193
  import {
193
194
  assertPositiveSafeInteger
194
195
  } from "../index-0s4xebbg.js";
195
- import"../index-cx2nh595.js";
196
+ import"../index-3wm2xp2a.js";
196
197
  import {
197
198
  defineRuntimeTool2,
198
199
  executableAgentRuntimeTools
@@ -1,6 +1,7 @@
1
+ import"../index-t5sjh517.js";
1
2
  import {
2
3
  coerceJsonArgs2
3
- } from "../index-6yxhe58g.js";
4
+ } from "../index-cykxpxz5.js";
4
5
  import {
5
6
  defineCliCommand2,
6
7
  DEFAULT_EXIT_CODES2,
@@ -15,12 +16,12 @@ import {
15
16
  renderCliView2,
16
17
  pollUntilDone2,
17
18
  createCli2
18
- } from "../index-fgq4w9bf.js";
19
+ } from "../index-05s01c94.js";
19
20
  import"../index-fynr93w4.js";
20
21
  import"../index-ct75c3at.js";
21
22
  import"../index-q6crhe1n.js";
22
- import"../index-dm2fv45z.js";
23
- import"../index-2s6fpehp.js";
23
+ import"../index-k4v2kq4q.js";
24
+ import"../index-ryv32myz.js";
24
25
  import {
25
26
  CliBuildSignatureSchema2,
26
27
  cliManifestSigningPayload2,
@@ -43,7 +44,7 @@ import {
43
44
  import {
44
45
  writeFileAtomicSync2
45
46
  } from "../index-07dcf2yn.js";
46
- import"../index-cx2nh595.js";
47
+ import"../index-3wm2xp2a.js";
47
48
  import"../index-636mggad.js";
48
49
  import {
49
50
  argumentsDigest
@@ -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-05s01c94.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";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-fynr93w4.js";
4
4
  import {
5
5
  coerceJsonArgs2
6
- } from "./index-6yxhe58g.js";
6
+ } from "./index-cykxpxz5.js";
7
7
  import {
8
8
  jsonSchemaFields
9
9
  } from "./index-ct75c3at.js";
@@ -15,11 +15,11 @@ import {
15
15
  import {
16
16
  toolResultFromError,
17
17
  toolErrorFromResult
18
- } from "./index-dm2fv45z.js";
18
+ } from "./index-k4v2kq4q.js";
19
19
  import {
20
20
  createToolRunner,
21
21
  formatToolError
22
- } from "./index-2s6fpehp.js";
22
+ } from "./index-ryv32myz.js";
23
23
  import {
24
24
  fetchGuarded,
25
25
  readCapped
@@ -32,7 +32,7 @@ import {
32
32
  } from "./index-eemvahkc.js";
33
33
  import {
34
34
  collectToolSurface
35
- } from "./index-cx2nh595.js";
35
+ } from "./index-3wm2xp2a.js";
36
36
  import {
37
37
  formatZodError2
38
38
  } from "./index-1eeqpadm.js";
@@ -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";
@@ -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)) {
@@ -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";
@@ -0,0 +1,100 @@
1
+ // src/tools/schema/json-schema-origin.ts
2
+ import { z } from "zod";
3
+ var JSON_SCHEMA_OBJECT_GUARD = Symbol.for("stitchkit.tools.json-schema-object-guard-origin.v1");
4
+ function mark(schema) {
5
+ if (Reflect.get(schema, JSON_SCHEMA_OBJECT_GUARD) === true)
6
+ return;
7
+ const marked = Reflect.defineProperty(schema, JSON_SCHEMA_OBJECT_GUARD, {
8
+ configurable: false,
9
+ enumerable: false,
10
+ value: true,
11
+ writable: false
12
+ });
13
+ if (!marked)
14
+ throw new Error("Cannot mark a restored JSON Schema object guard");
15
+ }
16
+ function markObjectGuard(schema) {
17
+ if (schema.in instanceof z.ZodTransform && schema.out instanceof z.ZodObject && schema.in.def.checks?.length) {
18
+ mark(schema);
19
+ return true;
20
+ }
21
+ return false;
22
+ }
23
+ function markJsonSchemaObjectGuards(schema) {
24
+ const visited = new WeakMap;
25
+ const visit = (current) => {
26
+ const known = visited.get(current);
27
+ if (known !== undefined)
28
+ return known;
29
+ visited.set(current, false);
30
+ if (current instanceof z.ZodPipe) {
31
+ const guarded = markObjectGuard(current);
32
+ visit(current.out);
33
+ visited.set(current, guarded);
34
+ return guarded;
35
+ }
36
+ if (current instanceof z.ZodObject) {
37
+ for (const field of Object.values(current.shape))
38
+ visit(field);
39
+ const catchall = current.def.catchall;
40
+ if (catchall)
41
+ visit(catchall);
42
+ return false;
43
+ }
44
+ if (current instanceof z.ZodArray) {
45
+ visit(current.element);
46
+ return false;
47
+ }
48
+ if (current instanceof z.ZodTuple) {
49
+ for (const item of current.def.items)
50
+ visit(item);
51
+ if (current.def.rest)
52
+ visit(current.def.rest);
53
+ return false;
54
+ }
55
+ if (current instanceof z.ZodRecord) {
56
+ visit(current.keyType);
57
+ visit(current.valueType);
58
+ return false;
59
+ }
60
+ if (current instanceof z.ZodUnion) {
61
+ for (const option of current.def.options)
62
+ visit(option);
63
+ return false;
64
+ }
65
+ if (current instanceof z.ZodIntersection) {
66
+ const leftGuarded = visit(current.def.left);
67
+ const rightGuarded = visit(current.def.right);
68
+ const guarded = leftGuarded || rightGuarded;
69
+ if (guarded)
70
+ mark(current);
71
+ visited.set(current, guarded);
72
+ return guarded;
73
+ }
74
+ if (current instanceof z.ZodOptional || current instanceof z.ZodExactOptional || current instanceof z.ZodNullable || current instanceof z.ZodDefault || current instanceof z.ZodPrefault || current instanceof z.ZodNonOptional || current instanceof z.ZodCatch || current instanceof z.ZodReadonly || current instanceof z.ZodLazy) {
75
+ const guarded = visit(current.unwrap());
76
+ if (guarded)
77
+ mark(current);
78
+ visited.set(current, guarded);
79
+ return guarded;
80
+ }
81
+ return false;
82
+ };
83
+ visit(schema);
84
+ }
85
+ function jsonSchemaObjectCoercionMembers(schema) {
86
+ if (Reflect.get(schema, JSON_SCHEMA_OBJECT_GUARD) !== true)
87
+ return;
88
+ if (schema instanceof z.ZodPipe && schema.out instanceof z.ZodObject) {
89
+ return [schema.out];
90
+ }
91
+ if (schema instanceof z.ZodIntersection) {
92
+ return [schema.def.left, schema.def.right];
93
+ }
94
+ if (schema instanceof z.ZodOptional || schema instanceof z.ZodExactOptional || schema instanceof z.ZodNullable || schema instanceof z.ZodDefault || schema instanceof z.ZodPrefault || schema instanceof z.ZodNonOptional || schema instanceof z.ZodCatch || schema instanceof z.ZodReadonly || schema instanceof z.ZodLazy) {
95
+ return [schema.unwrap()];
96
+ }
97
+ return;
98
+ }
99
+
100
+ export { markJsonSchemaObjectGuards, jsonSchemaObjectCoercionMembers };
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  ToolExecutionControlError2,
16
16
  isToolExecutionControlError2
17
- } from "./index-dm2fv45z.js";
17
+ } from "./index-k4v2kq4q.js";
18
18
  import {
19
19
  agentDurableEventId2
20
20
  } from "./index-mnkk1ffz.js";
@@ -13,15 +13,15 @@ import {
13
13
  parseToolCallArguments,
14
14
  toolResultFromError,
15
15
  observed
16
- } from "./index-dm2fv45z.js";
16
+ } from "./index-k4v2kq4q.js";
17
17
  import {
18
18
  collectTools2,
19
19
  createToolRunner,
20
20
  formatToolError
21
- } from "./index-2s6fpehp.js";
21
+ } from "./index-ryv32myz.js";
22
22
  import {
23
23
  collectToolSurface
24
- } from "./index-cx2nh595.js";
24
+ } from "./index-3wm2xp2a.js";
25
25
  import {
26
26
  DEFAULT_CORS_ALLOW_HEADERS2,
27
27
  DEFAULT_PROCESS_SIGNALS,
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAK,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG7D,oEAAoE;AACpE,MAAM,MAAM,uBAAuB,GAAG,CACpC,OAAO,CAAC,EAAE,cAAc,KACrB,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD,UAAU,cAAc;IACtB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,MAAM,EAAE;IAC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AC,KAAK,EAAE,MAAM,KAAK,MAAM,EACjC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,qBAAqB,EAC/C,SAAS,EAAE,0BAA0B,GACpC,qBAAqB,EAAE,CAczB"}
@@ -1 +1 @@
1
- {"version":3,"file":"coerce.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/coerce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2KxB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGzB"}
1
+ {"version":3,"file":"coerce.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/coerce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoLxB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGzB"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Record which structural pipes came from the one foreign JSON Schema boundary.
4
+ * The walk runs once after `z.fromJSONSchema`; coercion later reads only this
5
+ * provenance and never guesses from a transform's public shape or metadata.
6
+ */
7
+ export declare function markJsonSchemaObjectGuards(schema: z.core.$ZodType): void;
8
+ /**
9
+ * Schemas that can guide coercion at a proven foreign object boundary.
10
+ * Intersections need both branches: one carries the key guard, while another
11
+ * can carry nested object fields that also need recursive coercion.
12
+ */
13
+ export declare function jsonSchemaObjectCoercionMembers(schema: z.core.$ZodType): readonly z.core.$ZodType[] | undefined;
14
+ //# sourceMappingURL=json-schema-origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema-origin.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/json-schema-origin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAiExE;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GACtB,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,SAAS,CAsBxC"}
package/llms/cli.2.txt CHANGED
@@ -269,7 +269,7 @@ SDK nor the `ai` peer.
269
269
  | `parseCliArgs` | function | argv → typed tool args against a schema (advanced) |
270
270
  | `routeCliArgv` | function | select the command out of argv without duplicating the global-option grammar (advanced) |
271
271
  | `extractCliGlobalOptions` | function | lift the application's own global options out of argv before routing (advanced) |
272
- | `coerceJsonArgs` | function | the second half of `parseCliArgs` — parse array/object values a consumer sends itself, without the `stitchkit/tools` barrel |
272
+ | `coerceJsonArgs` | function | the second half of `parseCliArgs` — parse array/object values a consumer sends itself, including discovered MCP object guards restored from JSON Schema, without the `stitchkit/tools` barrel |
273
273
  | `CliArgumentError` | class | the refusal `parseCliArgs` and the view flags raise; a CLI reports it and exits `2` |
274
274
  | `renderCliView` | function | compute an aggregate over a result (`--count-by`, `--sum`, `--top`, `--table`) — [guide](../guide/cli.md#aggregate-views) |
275
275
  | `createCliProfileStore` | function | named `0600` credential profiles resolved by name, with the never-substitute rule built in — [guide](../guide/cli.md#named-profiles) |
package/llms/cli.txt CHANGED
@@ -244,12 +244,16 @@ string, the schema says what it should be:
244
244
  | `z.enum([...])` | `--size large` |
245
245
  | `z.array(z.string())`| `--tag a --tag b` → `["a","b"]` |
246
246
  | `z.object({...})` | `--opts '{"k":"v"}'` (JSON) or `--opts.k v` |
247
+ | `z.record(z.string(), z.unknown())` | `--data '{"code":"007"}'` (JSON) |
247
248
  | `.optional()` / `.default()` | not required |
248
249
 
249
250
  Primitive literals use the same coercion through optional, nullable and default wrappers and as
250
251
  array elements. A literal set whose members have different primitive types stays lexical because
251
252
  argv has no type tag: for `z.literal([7, '007'])`, `--value 007` remains the string `"007"` rather
252
253
  than being guessed as the number `7`. The unchanged Zod schema makes the final admission decision.
254
+ Object and record JSON keeps the same behavior when a CLI discovers a tool through MCP. Restored
255
+ `propertyNames`, `minProperties` and `maxProperties` constraints still run before dispatch; CLI
256
+ coercion does not execute application transforms.
253
257
 
254
258
  After a bare boolean flag, the next token is its value when it is exactly
255
259
  `true` or `false` — `--active false` turns it off, as it reads. Any other word
package/llms/tools.3.txt CHANGED
@@ -279,7 +279,7 @@ Advanced building blocks — the shared machinery the mounts are built on.
279
279
  | `TransportCounts` | _type_ | per-transport counts (`{ HTTP, MCP, AGENT, CLI }`) |
280
280
  | `ToolSurfaceProjection` | _type_ | the one readonly `{ services?, runtimeTools? }` container shared by full, MCP-only and introspection surfaces (`buildToolManifest`, `listToolNames`, `summarizeTransports` take `ToolSurfaceProjection<RuntimeToolDefinition>`) |
281
281
  | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
282
- | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments; throws a `ZodError` naming the field when a union that keeps a string member receives a string that parses to an array its array member accepts |
282
+ | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments, including object guards restored from JSON Schema; arbitrary transform pipes stay untouched; throws a `ZodError` naming the field when a union that keeps a string member receives a string that parses to an array its array member accepts |
283
283
  | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; scalar collisions retain provable types, object/array collisions retain structural alternatives, and field descriptions retain discriminator labels plus availability/requiredness hints; the projection never executes validation |
284
284
  | `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
285
285
  | `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
package/llms-full.txt CHANGED
@@ -9648,12 +9648,16 @@ string, the schema says what it should be:
9648
9648
  | `z.enum([...])` | `--size large` |
9649
9649
  | `z.array(z.string())`| `--tag a --tag b` → `["a","b"]` |
9650
9650
  | `z.object({...})` | `--opts '{"k":"v"}'` (JSON) or `--opts.k v` |
9651
+ | `z.record(z.string(), z.unknown())` | `--data '{"code":"007"}'` (JSON) |
9651
9652
  | `.optional()` / `.default()` | not required |
9652
9653
 
9653
9654
  Primitive literals use the same coercion through optional, nullable and default wrappers and as
9654
9655
  array elements. A literal set whose members have different primitive types stays lexical because
9655
9656
  argv has no type tag: for `z.literal([7, '007'])`, `--value 007` remains the string `"007"` rather
9656
9657
  than being guessed as the number `7`. The unchanged Zod schema makes the final admission decision.
9658
+ Object and record JSON keeps the same behavior when a CLI discovers a tool through MCP. Restored
9659
+ `propertyNames`, `minProperties` and `maxProperties` constraints still run before dispatch; CLI
9660
+ coercion does not execute application transforms.
9657
9661
 
9658
9662
  After a bare boolean flag, the next token is its value when it is exactly
9659
9663
  `true` or `false` — `--active false` turns it off, as it reads. Any other word
@@ -22369,7 +22373,7 @@ Advanced building blocks — the shared machinery the mounts are built on.
22369
22373
  | `TransportCounts` | _type_ | per-transport counts (`{ HTTP, MCP, AGENT, CLI }`) |
22370
22374
  | `ToolSurfaceProjection` | _type_ | the one readonly `{ services?, runtimeTools? }` container shared by full, MCP-only and introspection surfaces (`buildToolManifest`, `listToolNames`, `summarizeTransports` take `ToolSurfaceProjection<RuntimeToolDefinition>`) |
22371
22375
  | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
22372
- | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments; throws a `ZodError` naming the field when a union that keeps a string member receives a string that parses to an array its array member accepts |
22376
+ | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments, including object guards restored from JSON Schema; arbitrary transform pipes stay untouched; throws a `ZodError` naming the field when a union that keeps a string member receives a string that parses to an array its array member accepts |
22373
22377
  | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; scalar collisions retain provable types, object/array collisions retain structural alternatives, and field descriptions retain discriminator labels plus availability/requiredness hints; the projection never executes validation |
22374
22378
  | `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
22375
22379
  | `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
@@ -22888,7 +22892,7 @@ SDK nor the `ai` peer.
22888
22892
  | `parseCliArgs` | function | argv → typed tool args against a schema (advanced) |
22889
22893
  | `routeCliArgv` | function | select the command out of argv without duplicating the global-option grammar (advanced) |
22890
22894
  | `extractCliGlobalOptions` | function | lift the application's own global options out of argv before routing (advanced) |
22891
- | `coerceJsonArgs` | function | the second half of `parseCliArgs` — parse array/object values a consumer sends itself, without the `stitchkit/tools` barrel |
22895
+ | `coerceJsonArgs` | function | the second half of `parseCliArgs` — parse array/object values a consumer sends itself, including discovered MCP object guards restored from JSON Schema, without the `stitchkit/tools` barrel |
22892
22896
  | `CliArgumentError` | class | the refusal `parseCliArgs` and the view flags raise; a CLI reports it and exits `2` |
22893
22897
  | `renderCliView` | function | compute an aggregate over a result (`--count-by`, `--sum`, `--top`, `--table`) — [guide](../guide/cli.md#aggregate-views) |
22894
22898
  | `createCliProfileStore` | function | named `0600` credential profiles resolved by name, with the never-substitute rule built in — [guide](../guide/cli.md#named-profiles) |
package/llms.txt CHANGED
@@ -18,7 +18,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
18
18
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
19
19
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
20
20
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.7 KB
21
- - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 42.8 KB → [llms/cli.2.txt](llms/cli.2.txt) 20.1 KB
21
+ - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 43.1 KB → [llms/cli.2.txt](llms/cli.2.txt) 20.2 KB
22
22
  - **stitchkit/cli/publish**: [llms/cli-publish.txt](llms/cli-publish.txt) 1.5 KB
23
23
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
24
24
  - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 31.9 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.108.4",
3
+ "version": "0.108.5",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",