stitchkit 0.91.1 → 0.92.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 (87) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/agent-runtime-coding-tools.js +3 -3
  3. package/dist/agent-runtime-harness.js +6 -6
  4. package/dist/agent-runtime-sandbox.js +3 -3
  5. package/dist/agent-runtime.js +9 -9
  6. package/dist/cli.d.ts +6 -3
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +371 -50
  9. package/dist/contract/define.d.ts +84 -2
  10. package/dist/contract/define.d.ts.map +1 -1
  11. package/dist/contract/index.d.ts +1 -1
  12. package/dist/contract/index.d.ts.map +1 -1
  13. package/dist/{index-qrbdq8jk.js → index-2c2bjw3s.js} +3 -3
  14. package/dist/{index-ya611vx3.js → index-7n145nbe.js} +183 -109
  15. package/dist/{index-bh70rk41.js → index-bx75zwt7.js} +3 -3
  16. package/dist/{index-709nh7z7.js → index-cxqhvq21.js} +2 -1
  17. package/dist/{index-13cjtmrw.js → index-e0znv5gn.js} +31 -8
  18. package/dist/{index-f4p4b8f6.js → index-e42wzzz5.js} +3 -3
  19. package/dist/{index-13e1k7v9.js → index-f477k430.js} +1 -1
  20. package/dist/{index-qjeyx5t2.js → index-fq77yfzc.js} +1 -1
  21. package/dist/{index-fenaekmk.js → index-h9etkkyk.js} +37 -27
  22. package/dist/{index-1qvdwnp2.js → index-mzvgxp0n.js} +2 -2
  23. package/dist/{index-zsqy3xfn.js → index-n0f51dfn.js} +4 -4
  24. package/dist/{index-bv7mytab.js → index-sr93cwf9.js} +1 -1
  25. package/dist/{index-vsbzgd7b.js → index-tmwcrptx.js} +1 -0
  26. package/dist/{index-b971qjes.js → index-v5573g1k.js} +1 -1
  27. package/dist/{index-8z9we758.js → index-vjpvjqpn.js} +1 -1
  28. package/dist/{index-bx6yq2m4.js → index-vk3kq9sb.js} +1 -1
  29. package/dist/{index-137jjs4v.js → index-yewwh1w4.js} +1 -1
  30. package/dist/{index-mqhjmadk.js → index-yn8remb1.js} +61 -57
  31. package/dist/index.js +4 -4
  32. package/dist/internal/atomic-file.d.ts +21 -0
  33. package/dist/internal/atomic-file.d.ts.map +1 -0
  34. package/dist/internal/errors.d.ts +10 -0
  35. package/dist/internal/errors.d.ts.map +1 -1
  36. package/dist/node.js +5 -5
  37. package/dist/observability/audit.d.ts +5 -1
  38. package/dist/observability/audit.d.ts.map +1 -1
  39. package/dist/observability/changes.d.ts.map +1 -1
  40. package/dist/observability/context.d.ts +27 -6
  41. package/dist/observability/context.d.ts.map +1 -1
  42. package/dist/observability/event.d.ts +34 -6
  43. package/dist/observability/event.d.ts.map +1 -1
  44. package/dist/observability/index.d.ts +2 -1
  45. package/dist/observability/index.d.ts.map +1 -1
  46. package/dist/observability/index.js +51 -7
  47. package/dist/observability/work.d.ts +55 -0
  48. package/dist/observability/work.d.ts.map +1 -0
  49. package/dist/remote.js +3 -3
  50. package/dist/server/context-contribution.d.ts.map +1 -1
  51. package/dist/server/index.js +7 -7
  52. package/dist/server/types.d.ts +20 -6
  53. package/dist/server/types.d.ts.map +1 -1
  54. package/dist/testing/surface-manifest.d.ts.map +1 -1
  55. package/dist/testing.js +9 -7
  56. package/dist/tool-invoker.js +6 -6
  57. package/dist/tools/cli-checkpoint.d.ts +24 -0
  58. package/dist/tools/cli-checkpoint.d.ts.map +1 -0
  59. package/dist/tools/cli-format.d.ts +10 -0
  60. package/dist/tools/cli-format.d.ts.map +1 -1
  61. package/dist/tools/cli-invoke.d.ts +118 -0
  62. package/dist/tools/cli-invoke.d.ts.map +1 -0
  63. package/dist/tools/cli-manifest.d.ts +6 -9
  64. package/dist/tools/cli-manifest.d.ts.map +1 -1
  65. package/dist/tools/cli-signature.d.ts +81 -0
  66. package/dist/tools/cli-signature.d.ts.map +1 -0
  67. package/dist/tools/cli-stream.d.ts +93 -0
  68. package/dist/tools/cli-stream.d.ts.map +1 -0
  69. package/dist/tools/cli-update.d.ts +62 -0
  70. package/dist/tools/cli-update.d.ts.map +1 -1
  71. package/dist/tools/cli.d.ts +4 -13
  72. package/dist/tools/cli.d.ts.map +1 -1
  73. package/dist/tools/connections/index.js +2 -2
  74. package/dist/tools/execute.d.ts +21 -0
  75. package/dist/tools/execute.d.ts.map +1 -1
  76. package/dist/tools/mcp-progress.d.ts +46 -0
  77. package/dist/tools/mcp-progress.d.ts.map +1 -0
  78. package/dist/tools/mcp-round-policy.d.ts +25 -1
  79. package/dist/tools/mcp-round-policy.d.ts.map +1 -1
  80. package/dist/tools/mcp-round.d.ts +20 -1
  81. package/dist/tools/mcp-round.d.ts.map +1 -1
  82. package/dist/tools/mcp-trace.d.ts +9 -1
  83. package/dist/tools/mcp-trace.d.ts.map +1 -1
  84. package/dist/tools/mount-wait.d.ts.map +1 -1
  85. package/dist/tools.js +160 -51
  86. package/llms-full.txt +358 -8
  87. package/package.json +1 -1
@@ -600,6 +600,42 @@ function mergeSchemas(paramsSchema, inputSchema) {
600
600
  return paramsObject ? z.intersection(paramsObject, inputSchema) : inputSchema;
601
601
  }
602
602
 
603
+ // src/tools/mcp-round-policy.ts
604
+ function staticInputRounds(policy) {
605
+ return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
606
+ }
607
+ function validateMcpRoundPolicy(tool, policy, runtime) {
608
+ if (!runtime?.stateConfigured) {
609
+ throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
610
+ }
611
+ const { maxRounds } = runtime;
612
+ if (!Number.isInteger(maxRounds) || maxRounds < 1) {
613
+ throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
614
+ }
615
+ const declared = staticInputRounds(policy);
616
+ if (!declared)
617
+ return;
618
+ if (declared.length === 0) {
619
+ throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
620
+ }
621
+ assertRoundShape(tool, declared, maxRounds);
622
+ }
623
+ function validateResolvedInputRounds(tool, resolved, maxRounds) {
624
+ assertRoundShape(tool, resolved, maxRounds);
625
+ }
626
+ function assertRoundShape(tool, rounds, maxRounds) {
627
+ if (rounds.length > maxRounds) {
628
+ throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
629
+ }
630
+ const keys = new Set;
631
+ for (const request of rounds) {
632
+ if (keys.has(request.key)) {
633
+ throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
634
+ }
635
+ keys.add(request.key);
636
+ }
637
+ }
638
+
603
639
  // src/tools/names.ts
604
640
  var SINGULAR_EXCEPTIONS = new Set([
605
641
  "analytics",
@@ -868,32 +904,6 @@ function presentationMetadata(schema) {
868
904
 
869
905
  // src/tools/internal/surface-projector.ts
870
906
  import { z as z3 } from "zod";
871
-
872
- // src/tools/mcp-round-policy.ts
873
- function validateMcpRoundPolicy(tool, policy, runtime) {
874
- if (!runtime?.stateConfigured) {
875
- throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
876
- }
877
- const { maxRounds } = runtime;
878
- if (!Number.isInteger(maxRounds) || maxRounds < 1) {
879
- throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
880
- }
881
- if (policy.inputRequired.length === 0) {
882
- throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
883
- }
884
- if (policy.inputRequired.length > maxRounds) {
885
- throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${policy.inputRequired.length} input rounds, exceeding maxRounds ${maxRounds}`);
886
- }
887
- const keys = new Set;
888
- for (const request of policy.inputRequired) {
889
- if (keys.has(request.key)) {
890
- throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
891
- }
892
- keys.add(request.key);
893
- }
894
- }
895
-
896
- // src/tools/internal/surface-projector.ts
897
907
  function assertToolExtensionCompatible(base, extra) {
898
908
  if (!(base instanceof z3.ZodObject))
899
909
  return;
@@ -1113,4 +1123,4 @@ function prepareProjectedMcpTools(tools, config = {}) {
1113
1123
  return prepared;
1114
1124
  }
1115
1125
 
1116
- export { objectShapeKeys, rebuildObject, mergeSchemas, validateMcpRoundPolicy, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, flattenToolJsonSchema, declaresDraft07, withDefsDialect, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
1126
+ export { objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, flattenToolJsonSchema, declaresDraft07, withDefsDialect, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  executeToolMethod,
3
3
  toolErrorFromResult
4
- } from "./index-mqhjmadk.js";
4
+ } from "./index-yn8remb1.js";
5
5
  import {
6
6
  assertToolExtensionCompatible,
7
7
  mergeSchemas,
8
8
  projectToolSurface,
9
9
  rebuildObject
10
- } from "./index-fenaekmk.js";
10
+ } from "./index-h9etkkyk.js";
11
11
  import {
12
12
  isRetryableStatus
13
13
  } from "./index-2vtcmrj9.js";
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  createValidatedRealtimeSocket,
12
12
  isModuleNotFound
13
- } from "./index-13e1k7v9.js";
13
+ } from "./index-f477k430.js";
14
14
  import {
15
15
  DEFAULT_PROCESS_SIGNALS,
16
16
  RUNTIME_CONTEXT_RESERVED_KEYS,
@@ -22,13 +22,13 @@ import {
22
22
  isOriginAllowed,
23
23
  mediaTypeEssence,
24
24
  reportSignalError
25
- } from "./index-709nh7z7.js";
25
+ } from "./index-cxqhvq21.js";
26
26
  import {
27
27
  getRequestContext,
28
28
  runWithRequestContext,
29
29
  setRequestEndpoint,
30
30
  setRequestError
31
- } from "./index-vsbzgd7b.js";
31
+ } from "./index-tmwcrptx.js";
32
32
  import {
33
33
  extractIp,
34
34
  getClientInfo,
@@ -41,7 +41,7 @@ import {
41
41
  normalizeError,
42
42
  recordedErrorMessage,
43
43
  validateDeclaredOutput
44
- } from "./index-13cjtmrw.js";
44
+ } from "./index-e0znv5gn.js";
45
45
  import {
46
46
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
47
47
  joinRoutePath,
@@ -5,7 +5,7 @@ import {
5
5
  contextContributionDelta,
6
6
  mergeContextContribution,
7
7
  prepareContextContribution
8
- } from "./index-709nh7z7.js";
8
+ } from "./index-cxqhvq21.js";
9
9
  import {
10
10
  base64UrlToBytes,
11
11
  bytesToBase64Url
@@ -69,6 +69,7 @@ function wrapInRequestContext(handler, options = {}) {
69
69
  const ctx = {
70
70
  trace: resolveTraceContext(req),
71
71
  source: "http",
72
+ kind: "request",
72
73
  method: req.method,
73
74
  path: new URL(req.url, "http://localhost").pathname,
74
75
  startedAt: process.hrtime.bigint(),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeError
3
- } from "./index-13cjtmrw.js";
3
+ } from "./index-e0znv5gn.js";
4
4
 
5
5
  // src/internal/bounded-lines.ts
6
6
  var DEFAULT_STREAM_LINE_BYTES = 1024 * 1024;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  projectRuntimeTool
3
- } from "./index-fenaekmk.js";
3
+ } from "./index-h9etkkyk.js";
4
4
 
5
5
  // src/tools/runtime-tool.ts
6
6
  function defineRuntimeTool(definition) {
@@ -37,7 +37,7 @@ import {
37
37
  import {
38
38
  ToolExecutionControlError,
39
39
  isToolExecutionControlError
40
- } from "./index-mqhjmadk.js";
40
+ } from "./index-yn8remb1.js";
41
41
  import {
42
42
  isRecord,
43
43
  transportResult
@@ -3,7 +3,7 @@ import {
3
3
  inputIsQuery,
4
4
  parseSSE,
5
5
  readBoundedUtf8Lines
6
- } from "./index-b971qjes.js";
6
+ } from "./index-v5573g1k.js";
7
7
  import {
8
8
  ApiError,
9
9
  RequestCancellationError,
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  getRequestContext,
3
3
  runWithRequestContext
4
- } from "./index-vsbzgd7b.js";
4
+ } from "./index-tmwcrptx.js";
5
5
  import {
6
6
  formatZodError,
7
7
  normalizeError,
8
8
  validateDeclaredOutput
9
- } from "./index-13cjtmrw.js";
9
+ } from "./index-e0znv5gn.js";
10
10
  import {
11
11
  coerceJsonArgs
12
12
  } from "./index-7zbps32p.js";
13
13
  import {
14
14
  objectShapeKeys
15
- } from "./index-fenaekmk.js";
15
+ } from "./index-h9etkkyk.js";
16
16
  import {
17
17
  AppError,
18
18
  STITCH_ERROR_STATUS,
@@ -45,6 +45,53 @@ function isToolExecutionControlError(value) {
45
45
  return value instanceof ToolExecutionControlError;
46
46
  }
47
47
  var normalizedToolErrors = new WeakMap;
48
+ function parseToolCallArguments(method, callArgs, coerceJson) {
49
+ const paramKeys = new Set(objectShapeKeys(method.paramsSchema));
50
+ let paramArgs = {};
51
+ let inputArgs = {};
52
+ for (const [key, value] of Object.entries(callArgs)) {
53
+ if (isUnsafeKey(key))
54
+ continue;
55
+ if (paramKeys.has(key))
56
+ paramArgs[key] = value;
57
+ else
58
+ inputArgs[key] = value;
59
+ }
60
+ if (coerceJson) {
61
+ paramArgs = coerceJsonArgs(paramArgs, method.paramsSchema);
62
+ inputArgs = coerceJsonArgs(inputArgs, method.inputSchema);
63
+ }
64
+ let params;
65
+ if (method.paramsSchema) {
66
+ let result;
67
+ try {
68
+ result = method.paramsSchema.safeParse(paramArgs);
69
+ } catch (err) {
70
+ return { ok: false, message: "Invalid params", thrown: err };
71
+ }
72
+ if (!result.success) {
73
+ return { ok: false, message: `Invalid params: ${formatZodError(result.error)}` };
74
+ }
75
+ params = result.data;
76
+ }
77
+ let input;
78
+ if (method.inputSchema) {
79
+ let result;
80
+ try {
81
+ result = method.inputSchema.safeParse(inputArgs);
82
+ } catch (err) {
83
+ return { ok: false, message: "Invalid input", thrown: err };
84
+ }
85
+ if (!result.success) {
86
+ return { ok: false, message: `Invalid input: ${formatZodError(result.error)}` };
87
+ }
88
+ input = result.data;
89
+ }
90
+ return { ok: true, params, input };
91
+ }
92
+ var noProgress = async () => {
93
+ return;
94
+ };
48
95
  function toolResultFromError(err) {
49
96
  const appErr = normalizeError(err);
50
97
  const result = {
@@ -160,24 +207,24 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
160
207
  const keys = new Set(Object.keys(extension.schema.shape));
161
208
  extensionKeys = keys;
162
209
  const extensionArgs = Object.fromEntries(Object.entries(rawArgs).filter(([key]) => keys.has(key)));
163
- let parsed;
210
+ let parsed2;
164
211
  try {
165
- parsed = extension.schema.safeParse(extensionArgs);
212
+ parsed2 = extension.schema.safeParse(extensionArgs);
166
213
  } catch (err) {
167
214
  return finishThrown(err);
168
215
  }
169
- if (!parsed.success) {
216
+ if (!parsed2.success) {
170
217
  const before2 = await runBefore();
171
218
  if (before2?.kind === "failure")
172
219
  return before2.result;
173
220
  return finish({
174
221
  ok: false,
175
222
  code: "VALIDATION_ERROR",
176
- details: { message: `Invalid tool extension: ${formatZodError(parsed.error)}` }
223
+ details: { message: `Invalid tool extension: ${formatZodError(parsed2.error)}` }
177
224
  });
178
225
  }
179
226
  try {
180
- const resolved = await extension.resolve({ ...rawArgs, ...parsed.data });
227
+ const resolved = await extension.resolve({ ...rawArgs, ...parsed2.data });
181
228
  callContext = {
182
229
  ...context,
183
230
  ...resolved,
@@ -198,57 +245,14 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
198
245
  callArgs = extensionKeys ? Object.fromEntries(Object.entries(rewrittenArgs).filter(([key]) => !extensionKeys.has(key))) : rewrittenArgs;
199
246
  rewrittenArgsApplied = true;
200
247
  }
201
- const paramKeys = new Set(objectShapeKeys(method.paramsSchema));
202
- let paramArgs = {};
203
- let inputArgs = {};
204
- for (const [key, value] of Object.entries(callArgs)) {
205
- if (isUnsafeKey(key))
206
- continue;
207
- if (paramKeys.has(key))
208
- paramArgs[key] = value;
209
- else
210
- inputArgs[key] = value;
211
- }
212
- if (coerceJson) {
213
- paramArgs = coerceJsonArgs(paramArgs, method.paramsSchema);
214
- inputArgs = coerceJsonArgs(inputArgs, method.inputSchema);
215
- }
216
- let params;
217
- if (method.paramsSchema) {
218
- let result;
219
- try {
220
- result = method.paramsSchema.safeParse(paramArgs);
221
- } catch (err) {
222
- return finishThrown(err);
223
- }
224
- if (!result.success) {
225
- return finish({
226
- ok: false,
227
- code: "VALIDATION_ERROR",
228
- details: { message: `Invalid params: ${formatZodError(result.error)}` }
229
- });
230
- }
231
- params = result.data;
232
- }
233
- let input;
234
- if (method.inputSchema) {
235
- let result;
236
- try {
237
- result = method.inputSchema.safeParse(inputArgs);
238
- } catch (err) {
239
- return finishThrown(err);
240
- }
241
- if (!result.success) {
242
- return finish({
243
- ok: false,
244
- code: "VALIDATION_ERROR",
245
- details: { message: `Invalid input: ${formatZodError(result.error)}` }
246
- });
247
- }
248
- input = result.data;
248
+ const parsed = parseToolCallArguments(method, callArgs, coerceJson);
249
+ if (!parsed.ok) {
250
+ return parsed.thrown !== undefined ? finishThrown(parsed.thrown) : finish({ ok: false, code: "VALIDATION_ERROR", details: { message: parsed.message } });
249
251
  }
252
+ const { params, input } = parsed;
250
253
  try {
251
254
  const ctx = {
255
+ reportProgress: noProgress,
252
256
  ...callContext,
253
257
  params,
254
258
  input,
@@ -283,4 +287,4 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
283
287
  }
284
288
  }
285
289
 
286
- export { ToolExecutionControlError, isToolExecutionControlError, toolResultFromError, toolErrorFromResult, toolCauseFromResult, executeToolMethod };
290
+ export { ToolExecutionControlError, isToolExecutionControlError, parseToolCallArguments, toolResultFromError, toolErrorFromResult, toolCauseFromResult, executeToolMethod };
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  createUrlBuilder,
16
16
  createUrlBuilders,
17
17
  parseNDJSON
18
- } from "./index-137jjs4v.js";
18
+ } from "./index-yewwh1w4.js";
19
19
  import {
20
20
  REALTIME_REJECTION_KEY,
21
21
  asRealtimeRejection,
@@ -23,7 +23,7 @@ import {
23
23
  isModuleNotFound,
24
24
  parseRealtimeRequestAcknowledgement,
25
25
  parseRealtimeRequestArguments
26
- } from "./index-13e1k7v9.js";
26
+ } from "./index-f477k430.js";
27
27
  import {
28
28
  RealtimeRequestDisconnectedError,
29
29
  RealtimeRequestInvalidAcknowledgementError,
@@ -34,7 +34,7 @@ import {
34
34
  } from "./index-2qzskm8h.js";
35
35
  import {
36
36
  parseSSE
37
- } from "./index-b971qjes.js";
37
+ } from "./index-v5573g1k.js";
38
38
  import {
39
39
  LiveStateControllerStatusSchema,
40
40
  LiveStatePhaseSchema,
@@ -49,7 +49,7 @@ import {
49
49
  import {
50
50
  formatZodError,
51
51
  zodIssues
52
- } from "./index-13cjtmrw.js";
52
+ } from "./index-e0znv5gn.js";
53
53
  import {
54
54
  ALL_TRANSPORTS,
55
55
  ContractStreamFrameSchema,
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Replace a file without ever leaving half of one behind, and without handing
3
+ * a writable directory to whoever guessed the staging name.
4
+ *
5
+ * Write beside the target, then rename onto it: the rename is atomic within a
6
+ * filesystem, so a reader sees the old bytes or the new ones and never a
7
+ * partial write. The staging path has to be in the target's own directory for
8
+ * that to hold — a rename across filesystems is a copy, and a copy is exactly
9
+ * the window this avoids.
10
+ *
11
+ * The staging name is random and the file is created exclusively. A name built
12
+ * from pid and clock is guessable, and `writeFileSync` follows a symlink: an
13
+ * attacker who can write to the directory plants `.app.1234.1700000000000` →
14
+ * `/etc/something`, and the update writes its bytes through the link, chmods
15
+ * the target 0o755 and then renames the link itself into place, so every later
16
+ * write goes there too. `wx` refuses to open anything that already exists,
17
+ * link or file, which closes it.
18
+ */
19
+ /** Write `bytes` to `target` atomically, with an explicit mode. */
20
+ export declare function writeFileAtomic(target: string, bytes: Uint8Array, mode: number): void;
21
+ //# sourceMappingURL=atomic-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atomic-file.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAmBrF"}
@@ -25,6 +25,16 @@ export interface ZodIssueSummary {
25
25
  * the refusal names the branch and the path instead of only `(root)`.
26
26
  */
27
27
  export declare function zodIssues(error: z.ZodError): ZodIssueSummary[];
28
+ /**
29
+ * The text a person reads, which is a different job from the structured list.
30
+ *
31
+ * `zodIssues` keeps every branch failure, including the several that sit at the
32
+ * union's own path — a machine addresses them by branch number and wants them
33
+ * all. A reader gains nothing from the same path twice: the union's own line
34
+ * already quotes those reasons, and each repeat costs one of the few lines the
35
+ * cap allows. So the text keeps the first issue at each path and drops the
36
+ * rest, which is what leaves room for the line naming the field.
37
+ */
28
38
  export declare function formatZodError(error: z.ZodError): string;
29
39
  /**
30
40
  * The stable error code for a thrown value — `AppError.code`, `VALIDATION_ERROR`
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAyED;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U,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D"}
package/dist/node.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  createHandler,
6
6
  createSocketIOServer,
7
7
  createUnixClientTransport
8
- } from "./index-zsqy3xfn.js";
8
+ } from "./index-n0f51dfn.js";
9
9
  import"./index-y91ry9h2.js";
10
10
  import {
11
11
  ShutdownOptionsSchema,
@@ -14,7 +14,7 @@ import {
14
14
  ShutdownStatusSchema,
15
15
  createServerLifecycle
16
16
  } from "./index-3z73fh2c.js";
17
- import"./index-13e1k7v9.js";
17
+ import"./index-f477k430.js";
18
18
  import"./index-2qzskm8h.js";
19
19
  import {
20
20
  createImplement,
@@ -24,10 +24,10 @@ import {
24
24
  createScopedImplementRegistry,
25
25
  implement,
26
26
  implementRegistry
27
- } from "./index-709nh7z7.js";
28
- import"./index-vsbzgd7b.js";
27
+ } from "./index-cxqhvq21.js";
28
+ import"./index-tmwcrptx.js";
29
29
  import"./index-f9mb610r.js";
30
- import"./index-13cjtmrw.js";
30
+ import"./index-e0znv5gn.js";
31
31
  import"./index-0a349c33.js";
32
32
  import"./index-rxfy4cq7.js";
33
33
  import"./index-6k1937bx.js";
@@ -52,7 +52,11 @@ export interface ObservabilityConfig {
52
52
  /** The one HTTP completion snapshot produced by the handler. */
53
53
  export interface HttpRequestCompletion {
54
54
  context: RequestContext;
55
- statusCode: number;
55
+ /**
56
+ * The transport's status, when there is a transport. Absent for a unit of
57
+ * work that never had one — `ok` and `errorCode` carry its outcome instead.
58
+ */
59
+ statusCode?: number;
56
60
  durationMs: number;
57
61
  payload?: Promise<unknown>;
58
62
  /** Framework-owned neutral cancellation; currently paired with HTTP 499. */
@@ -1 +1 @@
1
- {"version":3,"file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+1 @@
1
- {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/observability/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAIzD"}
1
+ {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/observability/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CASzD"}
@@ -1,15 +1,36 @@
1
1
  import type { TransportSource } from '../contract/index.js';
2
2
  import { type TraceContext } from './trace.js';
3
- /** Everything known about the request in flight. */
3
+ /** What a unit of work is: a call that arrived, or work that runs on its own. */
4
+ export type RequestContextKind = 'request' | 'job';
5
+ /** Everything known about the unit of work in flight. */
4
6
  export interface RequestContext {
5
- /** W3C trace ids for this request. */
7
+ /** W3C trace ids for this unit of work. */
6
8
  trace: TraceContext;
7
9
  /** Which surface the request arrived on. */
8
10
  source: TransportSource;
9
- /** HTTP verb. */
10
- method: string;
11
- /** Request path. */
12
- path: string;
11
+ /**
12
+ * What this is. Absent means `request`, so every context written before this
13
+ * existed still reads correctly and no caller has to start declaring it.
14
+ */
15
+ kind?: RequestContextKind;
16
+ /**
17
+ * What the work is, for work that has no route to name it — `agent-loop`,
18
+ * `broadcast-send`. A request is named by its method and path; a job is named
19
+ * by what it does.
20
+ */
21
+ name?: string;
22
+ /**
23
+ * HTTP verb — absent for work that did not arrive over a transport.
24
+ *
25
+ * It was required, and work without a transport therefore had to invent one:
26
+ * a background loop wrote `method: 'AGENT'`, which is not a verb, it is the
27
+ * absence of one recorded in the field for verbs. An absent field says the
28
+ * same thing and says it truthfully, which is the difference between a filter
29
+ * that can exclude jobs and a filter that silently counts them as writes.
30
+ */
31
+ method?: string;
32
+ /** Request path — absent for work that did not arrive over a transport. */
33
+ path?: string;
13
34
  /** Monotonic start, for duration — `process.hrtime.bigint()`. */
14
35
  startedAt: bigint;
15
36
  /** Client IP, when resolvable. */
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/observability/context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;8EAC0E;IAC1E,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAChE;AAmBD,yDAAyD;AACzD,wBA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AM,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EACvD,OAAO,GAAE,yBAA8B,GACtC,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAkBhD"}
@@ -1,4 +1,5 @@
1
1
  import type { HttpMethod, McpCallContext, TransportSource } from '../contract/index.js';
2
+ import type { RequestContextKind } from './context.js';
2
3
  import type { JsonValue } from './sanitize.js';
3
4
  /**
4
5
  * A normalised audit event — one shape for a completed call on any surface
@@ -9,8 +10,24 @@ import type { JsonValue } from './sanitize.js';
9
10
  export interface RequestEvent {
10
11
  /** Surface the call arrived on. */
11
12
  source: TransportSource;
12
- /** HTTP verb, or `TOOL` for a tool call. */
13
- method: string;
13
+ /**
14
+ * A call that arrived, or work that ran on its own. Always written, including
15
+ * on requests: a filter that has to read "the absence of `method` means a
16
+ * job" is carrying the same implicit knowledge this field exists to remove.
17
+ */
18
+ kind: RequestContextKind;
19
+ /**
20
+ * What the work is, for work no route names — `agent-loop`, `broadcast-send`.
21
+ * Absent on requests, which are named by method and path.
22
+ */
23
+ name?: string;
24
+ /**
25
+ * HTTP verb, `TOOL` for a tool call, and **absent** for work that did not
26
+ * arrive over a transport. It was required, so a background loop had to write
27
+ * something, and what it wrote was `AGENT` — not a verb, but the absence of
28
+ * one recorded in the field for verbs.
29
+ */
30
+ method?: string;
14
31
  /**
15
32
  * The operation's contract verb (`GET` / `POST` / …). Set on **tool** events
16
33
  * (whose `method` is `TOOL`) so a single filter can tell a read from a write
@@ -18,8 +35,11 @@ export interface RequestEvent {
18
35
  * Omitted on HTTP events, where `method` already is the verb. → ADR 0030.
19
36
  */
20
37
  httpMethod?: HttpMethod;
21
- /** Request path — `/api/...` for HTTP, `/{source}/{tool}` for a tool call. */
22
- path: string;
38
+ /**
39
+ * Request path — `/api/...` for HTTP, `/{source}/{tool}` for a tool call, and
40
+ * absent for work with no transport to have a path on.
41
+ */
42
+ path?: string;
23
43
  /**
24
44
  * Stable owning-contract identity of the matched operation — the "service"
25
45
  * (contract prefix) and "action" (endpoint key) halves. Set on every surface
@@ -53,8 +73,16 @@ export interface RequestEvent {
53
73
  * into; ordinary success/failure rows retain their released shape.
54
74
  */
55
75
  outcome?: 'cancelled';
56
- /** HTTP status — the real status for HTTP, `200` / `400` for a tool call. */
57
- statusCode: number;
76
+ /**
77
+ * HTTP status — the real status for HTTP, `200` / `400` for a tool call, and
78
+ * absent for work that has no transport to have a status on.
79
+ *
80
+ * This one is the trap the rest of this change would otherwise have walked
81
+ * into. Dropping `method: 'AGENT'` while still demanding a status would have
82
+ * replaced one fabricated transport field with another, in the same row, for
83
+ * the same reason. A job's outcome is `ok`, and `errorCode` when it failed.
84
+ */
85
+ statusCode?: number;
58
86
  /** Wall-clock duration. */
59
87
  durationMs: number;
60
88
  /** Error code — failures only. */
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/observability/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,SAAS,CAAC,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