stitchkit 0.103.1 → 0.103.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  3. package/dist/entrypoints/agent-runtime/harness-tools.js +6 -6
  4. package/dist/entrypoints/agent-runtime/harness.js +4 -4
  5. package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
  6. package/dist/entrypoints/agent-runtime.js +8 -8
  7. package/dist/entrypoints/cli.js +6 -6
  8. package/dist/entrypoints/testing.js +1 -1
  9. package/dist/entrypoints/tools/connections.js +2 -2
  10. package/dist/entrypoints/tools/invoker.js +4 -4
  11. package/dist/entrypoints/tools.js +9 -9
  12. package/dist/{index-kkk1wzsq.js → index-1br6gwhf.js} +4 -4
  13. package/dist/{index-xgc94hy6.js → index-1khy8y7n.js} +3 -3
  14. package/dist/{index-z3pqcy7r.js → index-90ppdx3q.js} +1 -1
  15. package/dist/{index-djjhhgjk.js → index-a4ajxwmb.js} +1 -1
  16. package/dist/{index-x1dkwx5x.js → index-dnn9z96q.js} +3 -3
  17. package/dist/{index-860vjkgm.js → index-kmpzj1cq.js} +1 -1
  18. package/dist/{index-0efgsyav.js → index-m2xqkv55.js} +1 -1
  19. package/dist/{index-ds7jdhep.js → index-n2gre124.js} +3 -3
  20. package/dist/{index-kgmh97hf.js → index-r956rndn.js} +2 -2
  21. package/dist/{index-jzczzcsb.js → index-tgzhq07n.js} +1 -1
  22. package/dist/{index-7z9ym7t8.js → index-x87j7csh.js} +35 -14
  23. package/dist/tools/schema/flatten-join.d.ts +1 -1
  24. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  25. package/dist/tools/schema/flatten.d.ts.map +1 -1
  26. package/llms/tools.3.txt +1 -1
  27. package/llms/tools.txt +19 -1
  28. package/llms-full.txt +20 -2
  29. package/llms.txt +1 -1
  30. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -15,6 +15,15 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.103.2] — 2026-10-01
19
+
20
+ ### Fixed
21
+
22
+ - Flattened tool schemas retain distinct field descriptions with their discriminator
23
+ labels, and advertise both availability and conditional requiredness. Structural
24
+ deduplication keeps explanations separate from validation constraints; MCP, agent
25
+ tools and manifests share the same projection. Runtime Zod validation is unchanged.
26
+
18
27
  ## [0.103.1] — 2026-09-30
19
28
 
20
29
  ### Added
@@ -1,5 +1,5 @@
1
1
  import"../../index-ct75c3at.js";
2
- import"../../index-7z9ym7t8.js";
2
+ import"../../index-x87j7csh.js";
3
3
  import"../../index-n53mswt3.js";
4
4
  import"../../index-b2bz0kdm.js";
5
5
  import {
@@ -7,9 +7,9 @@ import {
7
7
  AgentCodingToolAuthorizationSchema2,
8
8
  AgentCodingToolPathAuthorizationSchema2,
9
9
  createAgentCodingTools2
10
- } from "../../index-djjhhgjk.js";
10
+ } from "../../index-a4ajxwmb.js";
11
11
  import"../../index-ahvsksw5.js";
12
- import"../../index-jzczzcsb.js";
12
+ import"../../index-tgzhq07n.js";
13
13
  export {
14
14
  AgentCodingToolAuthorizationSchema2 as AgentCodingToolAuthorizationSchema,
15
15
  AgentCodingToolLimitsSchema2 as AgentCodingToolLimitsSchema,
@@ -4,18 +4,18 @@ import"../../index-b2bz0kdm.js";
4
4
  import"../../index-yex7eg1v.js";
5
5
  import"../../index-9pw0a51a.js";
6
6
  import"../../index-ct75c3at.js";
7
- import"../../index-7z9ym7t8.js";
8
- import"../../index-0efgsyav.js";
9
- import"../../index-kgmh97hf.js";
7
+ import"../../index-x87j7csh.js";
8
+ import"../../index-m2xqkv55.js";
9
+ import"../../index-r956rndn.js";
10
10
  import {
11
11
  mountAgent2
12
- } from "../../index-xgc94hy6.js";
12
+ } from "../../index-1khy8y7n.js";
13
13
  import {
14
14
  composeToolLifecycle2
15
15
  } from "../../index-ze1eph1k.js";
16
- import"../../index-x1dkwx5x.js";
16
+ import"../../index-dnn9z96q.js";
17
17
  import"../../index-7n68nmc6.js";
18
- import"../../index-jzczzcsb.js";
18
+ import"../../index-tgzhq07n.js";
19
19
 
20
20
  // src/agent-runtime/harness-tools.ts
21
21
  function createAgentHarnessTools(resolve) {
@@ -5,7 +5,7 @@ import"../../index-8kzct1d6.js";
5
5
  import {
6
6
  composeAgentPrompt2,
7
7
  createAgentRuntime2
8
- } from "../../index-z3pqcy7r.js";
8
+ } from "../../index-90ppdx3q.js";
9
9
  import"../../index-h97tqqp1.js";
10
10
  import"../../index-mnkk1ffz.js";
11
11
  import"../../index-n53mswt3.js";
@@ -13,8 +13,8 @@ import"../../index-b2bz0kdm.js";
13
13
  import"../../index-yex7eg1v.js";
14
14
  import"../../index-9pw0a51a.js";
15
15
  import"../../index-ct75c3at.js";
16
- import"../../index-7z9ym7t8.js";
17
- import"../../index-0efgsyav.js";
16
+ import"../../index-x87j7csh.js";
17
+ import"../../index-m2xqkv55.js";
18
18
  import"../../index-5vyd0fkb.js";
19
19
  import"../../index-nggfa2yn.js";
20
20
  import"../../index-r5hsgkz5.js";
@@ -29,7 +29,7 @@ import {
29
29
  import"../../index-7n68nmc6.js";
30
30
  import {
31
31
  defineRuntimeTool2
32
- } from "../../index-jzczzcsb.js";
32
+ } from "../../index-tgzhq07n.js";
33
33
 
34
34
  // src/agent-runtime/harness-contract.ts
35
35
  import { z } from "zod";
@@ -5,12 +5,12 @@ import {
5
5
  } from "../../index-ahvsksw5.js";
6
6
  import"../../index-n53mswt3.js";
7
7
  import"../../index-ct75c3at.js";
8
- import"../../index-7z9ym7t8.js";
8
+ import"../../index-x87j7csh.js";
9
9
  import"../../index-b2bz0kdm.js";
10
10
  import {
11
11
  createAgentCodingTools2
12
- } from "../../index-djjhhgjk.js";
13
- import"../../index-jzczzcsb.js";
12
+ } from "../../index-a4ajxwmb.js";
13
+ import"../../index-tgzhq07n.js";
14
14
 
15
15
  // src/agent-runtime/sandbox-bubblewrap.ts
16
16
  import { mkdir as mkdir2, mkdtemp, realpath, rm as rm2 } from "node:fs/promises";
@@ -110,7 +110,7 @@ import {
110
110
  agentGoalStateSlot2,
111
111
  agentTodoStateSlot2,
112
112
  createAgentRuntime2
113
- } from "../index-z3pqcy7r.js";
113
+ } from "../index-90ppdx3q.js";
114
114
  import {
115
115
  AgentConversationSummarySchema2,
116
116
  AgentConversationPageSchema2,
@@ -125,12 +125,12 @@ import {
125
125
  } from "../index-yex7eg1v.js";
126
126
  import"../index-9pw0a51a.js";
127
127
  import"../index-ct75c3at.js";
128
- import"../index-7z9ym7t8.js";
129
- import"../index-0efgsyav.js";
130
- import"../index-kgmh97hf.js";
128
+ import"../index-x87j7csh.js";
129
+ import"../index-m2xqkv55.js";
130
+ import"../index-r956rndn.js";
131
131
  import {
132
132
  mountAgent2
133
- } from "../index-xgc94hy6.js";
133
+ } from "../index-1khy8y7n.js";
134
134
  import {
135
135
  createBoundedSinkManager
136
136
  } from "../index-h97tqqp1.js";
@@ -192,13 +192,13 @@ import {
192
192
  } from "../index-vgkbcnkc.js";
193
193
  import {
194
194
  buildToolManifest2
195
- } from "../index-860vjkgm.js";
196
- import"../index-x1dkwx5x.js";
195
+ } from "../index-kmpzj1cq.js";
196
+ import"../index-dnn9z96q.js";
197
197
  import"../index-7n68nmc6.js";
198
198
  import {
199
199
  defineRuntimeTool2,
200
200
  executableAgentRuntimeTools
201
- } from "../index-jzczzcsb.js";
201
+ } from "../index-tgzhq07n.js";
202
202
 
203
203
  // src/agent-runtime/child-tools.ts
204
204
  import { z as z2 } from "zod";
@@ -18,25 +18,25 @@ import {
18
18
  renderCliView2,
19
19
  pollUntilDone2,
20
20
  createCli2
21
- } from "../index-kkk1wzsq.js";
21
+ } from "../index-1br6gwhf.js";
22
22
  import {
23
23
  AppError2
24
24
  } from "../index-n53mswt3.js";
25
25
  import"../index-b2bz0kdm.js";
26
- import"../index-0efgsyav.js";
26
+ import"../index-m2xqkv55.js";
27
27
  import"../index-ct75c3at.js";
28
- import"../index-7z9ym7t8.js";
28
+ import"../index-x87j7csh.js";
29
29
  import"../index-yex7eg1v.js";
30
- import"../index-kgmh97hf.js";
30
+ import"../index-r956rndn.js";
31
31
  import {
32
32
  writeFileAtomicSync2
33
33
  } from "../index-aan6hqb9.js";
34
- import"../index-x1dkwx5x.js";
34
+ import"../index-dnn9z96q.js";
35
35
  import {
36
36
  argumentsDigest
37
37
  } from "../index-r7a7r7ha.js";
38
38
  import"../index-7n68nmc6.js";
39
- import"../index-jzczzcsb.js";
39
+ import"../index-tgzhq07n.js";
40
40
  import {
41
41
  serializeCanonicalJson
42
42
  } from "../index-zsvzhjtk.js";
@@ -36,7 +36,7 @@ import {
36
36
  projectToolSurface,
37
37
  mcpProjectionCandidate,
38
38
  prepareProjectedMcpTools
39
- } from "../index-7z9ym7t8.js";
39
+ } from "../index-x87j7csh.js";
40
40
  import"../index-b2bz0kdm.js";
41
41
  import {
42
42
  compareCodeUnits,
@@ -2,14 +2,14 @@ import"../../index-ct75c3at.js";
2
2
  import {
3
3
  declaresDraft07,
4
4
  withDefsDialect
5
- } from "../../index-7z9ym7t8.js";
5
+ } from "../../index-x87j7csh.js";
6
6
  import {
7
7
  AppError2
8
8
  } from "../../index-n53mswt3.js";
9
9
  import"../../index-b2bz0kdm.js";
10
10
  import {
11
11
  defineRuntimeTool2
12
- } from "../../index-jzczzcsb.js";
12
+ } from "../../index-tgzhq07n.js";
13
13
  import {
14
14
  safeJsonParse
15
15
  } from "../../index-zsarb5xp.js";
@@ -1,14 +1,14 @@
1
1
  import"../../index-n53mswt3.js";
2
2
  import"../../index-b2bz0kdm.js";
3
- import"../../index-0efgsyav.js";
3
+ import"../../index-m2xqkv55.js";
4
4
  import"../../index-yex7eg1v.js";
5
5
  import"../../index-9pw0a51a.js";
6
6
  import"../../index-ct75c3at.js";
7
- import"../../index-7z9ym7t8.js";
8
- import"../../index-kgmh97hf.js";
7
+ import"../../index-x87j7csh.js";
8
+ import"../../index-r956rndn.js";
9
9
  import {
10
10
  createToolInvoker2
11
- } from "../../index-ds7jdhep.js";
11
+ } from "../../index-n2gre124.js";
12
12
  import"../../index-7n68nmc6.js";
13
13
  export {
14
14
  createToolInvoker2 as createToolInvoker
@@ -35,21 +35,21 @@ import {
35
35
  presentationMetadata,
36
36
  findUntypedProperties2,
37
37
  prepareProjectedMcpTools
38
- } from "../index-7z9ym7t8.js";
38
+ } from "../index-x87j7csh.js";
39
39
  import {
40
40
  parseToolCallArguments,
41
41
  toolResultFromError,
42
42
  ToolExecutionControlError2,
43
43
  isToolExecutionControlError2
44
- } from "../index-0efgsyav.js";
44
+ } from "../index-m2xqkv55.js";
45
45
  import {
46
46
  collectTools2,
47
47
  createToolRunner,
48
48
  formatToolError
49
- } from "../index-kgmh97hf.js";
49
+ } from "../index-r956rndn.js";
50
50
  import {
51
51
  mountAgent2
52
- } from "../index-xgc94hy6.js";
52
+ } from "../index-1khy8y7n.js";
53
53
  import"../index-m38ej7e5.js";
54
54
  import {
55
55
  ALL_TRANSPORTS2,
@@ -77,7 +77,7 @@ import {
77
77
  WaitTimeoutError,
78
78
  runWaitOperation,
79
79
  createCli2
80
- } from "../index-kkk1wzsq.js";
80
+ } from "../index-1br6gwhf.js";
81
81
  import {
82
82
  ManagedFilePathSchema2,
83
83
  ManagedFileRefSchema2
@@ -104,16 +104,16 @@ import {
104
104
  import {
105
105
  describeToolCatalog2,
106
106
  buildToolManifest2
107
- } from "../index-860vjkgm.js";
107
+ } from "../index-kmpzj1cq.js";
108
108
  import {
109
109
  collectToolSurface
110
- } from "../index-x1dkwx5x.js";
110
+ } from "../index-dnn9z96q.js";
111
111
  import {
112
112
  argumentsDigest
113
113
  } from "../index-r7a7r7ha.js";
114
114
  import {
115
115
  createToolInvoker2
116
- } from "../index-ds7jdhep.js";
116
+ } from "../index-n2gre124.js";
117
117
  import {
118
118
  runWithRequestContext2,
119
119
  getRequestContext2,
@@ -122,7 +122,7 @@ import {
122
122
  import {
123
123
  defineRuntimeTool2,
124
124
  createRuntimeToolFactory2
125
- } from "../index-jzczzcsb.js";
125
+ } from "../index-tgzhq07n.js";
126
126
  import {
127
127
  compareCodeUnits,
128
128
  serializeCanonicalJson
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  toolResultFromError,
6
6
  toolErrorFromResult
7
- } from "./index-0efgsyav.js";
7
+ } from "./index-m2xqkv55.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-7z9ym7t8.js";
18
+ } from "./index-x87j7csh.js";
19
19
  import {
20
20
  createToolRunner,
21
21
  formatToolError
22
- } from "./index-kgmh97hf.js";
22
+ } from "./index-r956rndn.js";
23
23
  import {
24
24
  isWithinDir2
25
25
  } from "./index-5cc6r990.js";
26
26
  import {
27
27
  collectToolSurface
28
- } from "./index-x1dkwx5x.js";
28
+ } from "./index-dnn9z96q.js";
29
29
  import {
30
30
  formatZodError2
31
31
  } from "./index-1eeqpadm.js";
@@ -6,14 +6,14 @@ import {
6
6
  toolResultFromError,
7
7
  toolCauseFromResult,
8
8
  isToolExecutionControlError2
9
- } from "./index-0efgsyav.js";
9
+ } from "./index-m2xqkv55.js";
10
10
  import {
11
11
  createToolRunner,
12
12
  formatToolError
13
- } from "./index-kgmh97hf.js";
13
+ } from "./index-r956rndn.js";
14
14
  import {
15
15
  collectToolSurface
16
- } from "./index-x1dkwx5x.js";
16
+ } from "./index-dnn9z96q.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./index-9jfdm5tg.js";
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  ToolExecutionControlError2,
16
16
  isToolExecutionControlError2
17
- } from "./index-0efgsyav.js";
17
+ } from "./index-m2xqkv55.js";
18
18
  import {
19
19
  agentDurableEventId2
20
20
  } from "./index-mnkk1ffz.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "./index-d4pa2bgs.js";
29
29
  import {
30
30
  defineRuntimeTool2
31
- } from "./index-jzczzcsb.js";
31
+ } from "./index-tgzhq07n.js";
32
32
 
33
33
  // src/agent-runtime/coding-tool-contract.ts
34
34
  import { z } from "zod";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  projectToolSurface
3
- } from "./index-7z9ym7t8.js";
3
+ } from "./index-x87j7csh.js";
4
4
  import {
5
5
  contractToolMountable
6
- } from "./index-kgmh97hf.js";
6
+ } from "./index-r956rndn.js";
7
7
  import {
8
8
  runtimeToolMountable
9
- } from "./index-jzczzcsb.js";
9
+ } from "./index-tgzhq07n.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-x1dkwx5x.js";
3
+ } from "./index-dnn9z96q.js";
4
4
 
5
5
  // src/tools/manifest.ts
6
6
  function utf8Length(value) {
@@ -15,7 +15,7 @@ import {
15
15
  applyToolViewDefaults,
16
16
  projectToolView,
17
17
  objectShapeKeys
18
- } from "./index-7z9ym7t8.js";
18
+ } from "./index-x87j7csh.js";
19
19
  import {
20
20
  runWithRequestContext2,
21
21
  getRequestContext2
@@ -3,14 +3,14 @@ import {
3
3
  } from "./index-n53mswt3.js";
4
4
  import {
5
5
  toolErrorFromResult
6
- } from "./index-0efgsyav.js";
6
+ } from "./index-m2xqkv55.js";
7
7
  import {
8
8
  assertUniqueToolName
9
- } from "./index-7z9ym7t8.js";
9
+ } from "./index-x87j7csh.js";
10
10
  import {
11
11
  collectTools2,
12
12
  createToolRunner
13
- } from "./index-kgmh97hf.js";
13
+ } from "./index-r956rndn.js";
14
14
 
15
15
  // src/tools/invoker.ts
16
16
  function createToolInvoker2(services, config) {
@@ -6,11 +6,11 @@ import {
6
6
  mergeSchemas,
7
7
  assertToolExtensionCompatible,
8
8
  projectToolSurface
9
- } from "./index-7z9ym7t8.js";
9
+ } from "./index-x87j7csh.js";
10
10
  import {
11
11
  toolErrorFromResult,
12
12
  executeToolMethod
13
- } from "./index-0efgsyav.js";
13
+ } from "./index-m2xqkv55.js";
14
14
 
15
15
  // src/tools/mount.ts
16
16
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  projectRuntimeTool
3
- } from "./index-7z9ym7t8.js";
3
+ } from "./index-x87j7csh.js";
4
4
 
5
5
  // src/tools/runtime-tool.ts
6
6
  function defineRuntimeTool2(definition) {
@@ -308,7 +308,26 @@ function commonBaseType(schemas) {
308
308
  const types = normalizeTypes(nullable ? [...bases, "null"] : bases);
309
309
  return types.length > 0 ? { type: types } : {};
310
310
  }
311
- function mergePropertySchemas(properties) {
311
+ function describeVariants(properties, discriminator) {
312
+ const groups = new Map;
313
+ for (const { schema, labels } of properties) {
314
+ if (typeof schema.description !== "string")
315
+ continue;
316
+ const group = groups.get(schema.description) ?? [];
317
+ group.push(...labels);
318
+ groups.set(schema.description, group);
319
+ }
320
+ if (groups.size === 0)
321
+ return;
322
+ if (groups.size === 1 && properties.every(({ schema }) => typeof schema.description === "string")) {
323
+ return groups.keys().next().value;
324
+ }
325
+ return [...groups].map(([description, labels]) => ({
326
+ description,
327
+ labels: [...new Set(labels)].sort().join(" | ")
328
+ })).sort((left, right) => left.labels < right.labels ? -1 : left.labels > right.labels ? 1 : 0).map(({ description, labels }) => `When ${discriminator} = ${labels}: ${description}`).join(" ");
329
+ }
330
+ function mergePropertySchemas(properties, discriminator) {
312
331
  const schemas = properties.map((property) => nullableProjection(property.schema));
313
332
  const structural = schemas.map(withoutAnnotations);
314
333
  const [first] = structural;
@@ -318,13 +337,14 @@ function mergePropertySchemas(properties) {
318
337
  } else {
319
338
  const values = schemas.map(stringValues);
320
339
  const allStrings = values.every((value) => value !== null);
321
- merged = allStrings ? { type: "string", enum: [...new Set(values.flatMap((value) => value ?? []))] } : commonBaseType(structural);
322
- }
323
- const descriptions = [
324
- ...new Set(schemas.map((schema) => schema.description).filter((value) => typeof value === "string"))
325
- ];
326
- if (descriptions.length === 1)
327
- merged.description = descriptions[0];
340
+ merged = allStrings ? { type: "string", enum: [...new Set(values.flatMap((value) => value ?? []))].sort() } : commonBaseType(structural);
341
+ }
342
+ const description = describeVariants(properties.map((property, index) => ({
343
+ ...property,
344
+ schema: typeof property.schema.description === "string" ? property.schema : schemas[index] ?? property.schema
345
+ })), discriminator);
346
+ if (description !== undefined)
347
+ merged.description = description;
328
348
  return merged;
329
349
  }
330
350
 
@@ -434,20 +454,21 @@ function flattenNode(node) {
434
454
  });
435
455
  }
436
456
  const properties = {
437
- [discriminator.key]: mergePropertySchemas(discriminatorProperties)
457
+ [discriminator.key]: mergePropertySchemas(discriminatorProperties, discriminator.key)
438
458
  };
439
459
  const required = [discriminator.key];
440
- for (const [key, entries] of perKey) {
441
- let merged = mergePropertySchemas(entries);
460
+ for (const [key, entries] of [...perKey].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0)) {
461
+ let merged = mergePropertySchemas(entries, discriminator.key);
442
462
  const requiredEverywhere = entries.length === variants.length && entries.every((entry) => entry.required);
443
463
  if (requiredEverywhere) {
444
464
  required.push(key);
445
465
  } else {
446
466
  const requiredLabels = entries.filter((entry) => entry.required).flatMap((entry) => entry.labels);
447
467
  const presentLabels = entries.flatMap((entry) => entry.labels);
448
- const labels = requiredLabels.length > 0 ? requiredLabels : presentLabels;
449
- const verb = requiredLabels.length > 0 ? "Required" : "Available";
450
- merged = appendHint(merged, `${verb} if ${discriminator.key} = ${[...new Set(labels)].join(" | ")}`);
468
+ merged = appendHint(merged, `Available if ${discriminator.key} = ${[...new Set(presentLabels)].sort().join(" | ")}.`);
469
+ if (requiredLabels.length > 0) {
470
+ merged = appendHint(merged, `Required if ${discriminator.key} = ${[...new Set(requiredLabels)].sort().join(" | ")}`);
471
+ }
451
472
  }
452
473
  properties[key] = merged;
453
474
  }
@@ -6,5 +6,5 @@ export interface VariantProperty {
6
6
  }
7
7
  /** The string members of a `const`/`enum`, or `null` when any member is not one. */
8
8
  export declare function stringValues(schema: ToolPresentationSchema): string[] | null;
9
- export declare function mergePropertySchemas(properties: VariantProperty[]): ToolPresentationSchema;
9
+ export declare function mergePropertySchemas(properties: VariantProperty[], discriminator: string): ToolPresentationSchema;
10
10
  //# sourceMappingURL=flatten-join.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flatten-join.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/flatten-join.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAsED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,GAAG,IAAI,CAK5E;AAuID,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,sBAAsB,CA4B1F"}
1
+ {"version":3,"file":"flatten-join.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/flatten-join.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAsED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,GAAG,IAAI,CAK5E;AAsKD,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,eAAe,EAAE,EAC7B,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAiCxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/flatten.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAsJ7D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB,CAG5F;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB,CAG3F"}
1
+ {"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/tools/schema/flatten.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA4J7D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB,CAG5F;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB,CAG3F"}
package/llms/tools.3.txt CHANGED
@@ -280,7 +280,7 @@ Advanced building blocks — the shared machinery the mounts are built on.
280
280
  | `ToolSurfaceDefinition` | _type_ | shared object-shaped `{ services?, runtimeTools? }` introspection surface |
281
281
  | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
282
282
  | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments |
283
- | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; divergent fields retain every provable base kind in a deterministic `type` array, and the projection never executes validation |
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 |
286
286
  | `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
package/llms/tools.txt CHANGED
@@ -714,7 +714,25 @@ Capable models (Claude, Gemini, GPT) handle that; weaker / cheaper ones can drop
714
714
  the field or mangle its strings. Set `flattenUnionInput: true` (on
715
715
  `createMcpHandler` / `mountMcp` / `mountAgent`) to advertise each discriminated
716
716
  union as a **single flat object** instead — the discriminator becomes an enum and
717
- each variant's fields become optional with a `Required if <disc> = …` hint.
717
+ each field required by every variant stays required. Other fields become optional
718
+ with `Available if <disc> = …` and, where applicable, `Required if <disc> = …` hints.
719
+
720
+ **Branch explanations keep their meaning.** A shared description appears once;
721
+ different descriptions are grouped by text and qualified with `When <disc> = …:`.
722
+ A branch without a description does not inherit another branch's explanation.
723
+ For example, an optional object `value` in `single` and a required array `value`
724
+ in `group` advertise:
725
+
726
+ ```text
727
+ When kind = group: Two to ten references.
728
+ When kind = single: One reference.
729
+ Available if kind = group | single. Required if kind = group
730
+ ```
731
+
732
+ A third branch without `value` is absent from those labels. The object and array
733
+ retain their separate shapes; the array's minimum length does not apply to the object.
734
+ Discriminator values, branch explanation labels and joined property order are
735
+ deterministic under branch reordering. → ADR [0221](../decisions/0221-flat-field-explanations-retain-branch-meaning.md).
718
736
 
719
737
  **A field several variants declare keeps its type.** Flattening puts every
720
738
  variant's fields side by side, so a key two variants share has to be advertised
package/llms-full.txt CHANGED
@@ -4177,7 +4177,25 @@ Capable models (Claude, Gemini, GPT) handle that; weaker / cheaper ones can drop
4177
4177
  the field or mangle its strings. Set `flattenUnionInput: true` (on
4178
4178
  `createMcpHandler` / `mountMcp` / `mountAgent`) to advertise each discriminated
4179
4179
  union as a **single flat object** instead — the discriminator becomes an enum and
4180
- each variant's fields become optional with a `Required if <disc> = …` hint.
4180
+ each field required by every variant stays required. Other fields become optional
4181
+ with `Available if <disc> = …` and, where applicable, `Required if <disc> = …` hints.
4182
+
4183
+ **Branch explanations keep their meaning.** A shared description appears once;
4184
+ different descriptions are grouped by text and qualified with `When <disc> = …:`.
4185
+ A branch without a description does not inherit another branch's explanation.
4186
+ For example, an optional object `value` in `single` and a required array `value`
4187
+ in `group` advertise:
4188
+
4189
+ ```text
4190
+ When kind = group: Two to ten references.
4191
+ When kind = single: One reference.
4192
+ Available if kind = group | single. Required if kind = group
4193
+ ```
4194
+
4195
+ A third branch without `value` is absent from those labels. The object and array
4196
+ retain their separate shapes; the array's minimum length does not apply to the object.
4197
+ Discriminator values, branch explanation labels and joined property order are
4198
+ deterministic under branch reordering. → ADR [0221](../decisions/0221-flat-field-explanations-retain-branch-meaning.md).
4181
4199
 
4182
4200
  **A field several variants declare keeps its type.** Flattening puts every
4183
4201
  variant's fields side by side, so a key two variants share has to be advertised
@@ -20216,7 +20234,7 @@ Advanced building blocks — the shared machinery the mounts are built on.
20216
20234
  | `ToolSurfaceDefinition` | _type_ | shared object-shaped `{ services?, runtimeTools? }` introspection surface |
20217
20235
  | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
20218
20236
  | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments |
20219
- | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; divergent fields retain every provable base kind in a deterministic `type` array, and the projection never executes validation |
20237
+ | `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 |
20220
20238
  | `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
20221
20239
  | `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
20222
20240
  | `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
package/llms.txt CHANGED
@@ -13,7 +13,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.6 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 9.0 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 9.4 KB
16
- - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.0 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.9 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.4 KB
16
+ - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.9 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.9 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.5 KB
17
17
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
18
18
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
19
19
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.1 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.103.1",
3
+ "version": "0.103.2",
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",