@criogaid/pi-hashline-edit 0.7.0 → 0.8.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 (118) hide show
  1. package/README.md +74 -222
  2. package/README.zh-CN.md +162 -0
  3. package/package.json +2 -1
  4. package/src/core/AGENTS.md +1 -1
  5. package/src/core/apply.test.ts +172 -134
  6. package/src/core/apply.ts +28 -30
  7. package/src/core/case-fold.test.ts +11 -7
  8. package/src/core/case-fold.ts +2 -6
  9. package/src/core/character-set.ts +14 -0
  10. package/src/core/hash.test.ts +1 -25
  11. package/src/core/hash.ts +0 -5
  12. package/src/core/lines.ts +25 -7
  13. package/src/core/ranges.test.ts +41 -9
  14. package/src/core/ranges.ts +11 -4
  15. package/src/core/regex.ts +36 -6
  16. package/src/core/replace-schema.ts +18 -11
  17. package/src/core/replace.test.ts +90 -0
  18. package/src/core/replace.ts +6 -5
  19. package/src/core/search-analysis.test.ts +9 -0
  20. package/src/core/search-analysis.ts +35 -31
  21. package/src/core/search.ts +1 -1
  22. package/src/core/types.ts +5 -7
  23. package/src/index.ts +2 -4
  24. package/src/integration/config-registration.test.ts +16 -8
  25. package/src/integration/fusion-dispatch.test.ts +41 -22
  26. package/src/integration/grep-flags.test.ts +6 -13
  27. package/src/integration/grep-js-completeness.test.ts +41 -31
  28. package/src/integration/grep-order.test.ts +78 -0
  29. package/src/integration/grep-path-matrix.test.ts +4 -3
  30. package/src/integration/grep-regex.test.ts +13 -16
  31. package/src/integration/grep-rg.test.ts +127 -87
  32. package/src/integration/grep-scan-budget.test.ts +27 -5
  33. package/src/integration/large-text.test.ts +3 -4
  34. package/src/integration/model-budget-lifecycle.test.ts +15 -6
  35. package/src/integration/mutation-file-types.test.ts +0 -1
  36. package/src/integration/mutation-file-types.testing.ts +1 -1
  37. package/src/integration/npm-package.testing.ts +6 -32
  38. package/src/integration/publication-read-changes.test.ts +58 -26
  39. package/src/integration/replace-package.testing.ts +4 -1
  40. package/src/integration/replace-worker-boundary.test.ts +34 -24
  41. package/src/integration/report-replay.test.ts +2 -2
  42. package/src/integration/utf8-errors.test.ts +2 -2
  43. package/src/pi/AGENTS.md +12 -13
  44. package/src/pi/action-fusion.test.ts +71 -216
  45. package/src/pi/action-fusion.ts +37 -74
  46. package/src/pi/anchor-format.test.ts +16 -0
  47. package/src/pi/anchor-format.ts +7 -3
  48. package/src/pi/argument-diagnostics.ts +1 -1
  49. package/src/pi/argument-error.testing.ts +7 -4
  50. package/src/pi/argument-error.ts +5 -7
  51. package/src/pi/argument-format.test.ts +5 -16
  52. package/src/pi/argument-validation.test.ts +59 -25
  53. package/src/pi/argument-validation.ts +4 -5
  54. package/src/pi/budgets.ts +5 -7
  55. package/src/pi/config.test.ts +15 -5
  56. package/src/pi/config.ts +6 -6
  57. package/src/pi/diagnostic-buffer.test.ts +2 -3
  58. package/src/pi/diagnostic-buffer.ts +2 -2
  59. package/src/pi/edit-tool.ts +9 -12
  60. package/src/pi/execute.test.ts +80 -149
  61. package/src/pi/failure-context.test.ts +61 -16
  62. package/src/pi/failure-context.ts +12 -9
  63. package/src/pi/failure-path.test.ts +115 -50
  64. package/src/pi/file-commit.test.ts +30 -46
  65. package/src/pi/file-commit.ts +11 -40
  66. package/src/pi/file-revision.ts +25 -0
  67. package/src/pi/fusion-card-interaction.test.ts +143 -0
  68. package/src/pi/fusion-card.test.ts +193 -37
  69. package/src/pi/fusion-card.ts +186 -116
  70. package/src/pi/grep-candidates.ts +25 -27
  71. package/src/pi/grep-matrix.test.ts +1 -1
  72. package/src/pi/grep-order.test.ts +323 -0
  73. package/src/pi/grep-output.testing.ts +24 -0
  74. package/src/pi/grep-output.ts +62 -69
  75. package/src/pi/grep-render.ts +4 -1
  76. package/src/pi/grep-scope.ts +1 -1
  77. package/src/pi/grep-search.ts +85 -56
  78. package/src/pi/grep-tool.ts +17 -48
  79. package/src/pi/grep.test.ts +270 -169
  80. package/src/pi/mutation-outcome.testing.ts +2 -3
  81. package/src/pi/mutation-result.test.ts +26 -19
  82. package/src/pi/mutation-result.ts +25 -40
  83. package/src/pi/mutation-runner.ts +9 -17
  84. package/src/pi/output-budgets.test.ts +25 -16
  85. package/src/pi/path.ts +3 -1
  86. package/src/pi/pi.test.ts +4 -5
  87. package/src/pi/read-tool.ts +32 -80
  88. package/src/pi/read.test.ts +145 -92
  89. package/src/pi/regex-worker-contract.ts +5 -23
  90. package/src/pi/regex-worker.ts +4 -10
  91. package/src/pi/registration.test.ts +54 -49
  92. package/src/pi/render.test.ts +196 -93
  93. package/src/pi/render.ts +32 -22
  94. package/src/pi/replace-regex.ts +3 -5
  95. package/src/pi/replace-tool.ts +27 -26
  96. package/src/pi/replace-worker-contract.ts +3 -12
  97. package/src/pi/replace.test.ts +144 -226
  98. package/src/pi/report-cause.ts +23 -19
  99. package/src/pi/report-failure.testing.ts +2 -2
  100. package/src/pi/report-schema.ts +55 -43
  101. package/src/pi/report.test.ts +138 -71
  102. package/src/pi/report.ts +40 -43
  103. package/src/pi/result-safety.test.ts +157 -117
  104. package/src/pi/rg-process.test.ts +36 -10
  105. package/src/pi/rg-process.ts +9 -3
  106. package/src/pi/rg-regex.test.ts +17 -0
  107. package/src/pi/rg-regex.ts +28 -22
  108. package/src/pi/text-stream.test.ts +35 -36
  109. package/src/pi/text-stream.ts +14 -14
  110. package/src/pi/tool-call.testing.ts +17 -7
  111. package/src/pi/write-tool.ts +9 -11
  112. package/src/pi/write.test.ts +43 -75
  113. package/src/testing/regex-translation-corpus.ts +16 -0
  114. package/src/testing/rg-line-listing.fixture.mjs +1 -1
  115. package/src/integration/forget-grep.test.ts +0 -148
  116. package/src/pi/forget-tool.ts +0 -367
  117. package/src/pi/forget.test.ts +0 -630
  118. package/src/pi/forget.testing.ts +0 -201
@@ -4,10 +4,14 @@
4
4
  * mapping, so it must not import typebox at runtime.
5
5
  * External boundaries validate cause data before restoreCause.
6
6
  */
7
- import { errnoCode, errorMessage, HashlineError } from "../core/errors.ts";
8
- import { DEFAULT_OUTPUT_BUDGETS } from "./budgets.ts";
7
+ import {
8
+ errnoCode,
9
+ errorMessage,
10
+ HashlineError,
11
+ type HashlineErrorOptions,
12
+ } from "../core/errors.ts";
9
13
  import { DiagnosticBuffer } from "./diagnostic-buffer.ts";
10
- import type { Cause } from "./report-schema.ts";
14
+ import type { Cause, ErrorCode } from "./report-schema.ts";
11
15
 
12
16
  class RestoredCause extends Error {
13
17
  readonly data: Cause;
@@ -23,7 +27,7 @@ export function restoreCause(data: Cause | undefined): Error | undefined {
23
27
  }
24
28
 
25
29
  /** One free-text value within its budget, keeping the opening and the final cause. */
26
- export function boundedText(text: string, maxBytes = DEFAULT_OUTPUT_BUDGETS.fieldBytes): string {
30
+ export function boundedText(text: string, maxBytes: number): string {
27
31
  if (Buffer.byteLength(text) <= maxBytes) return text;
28
32
  const buffer = new DiagnosticBuffer(maxBytes);
29
33
  buffer.append(text);
@@ -38,31 +42,31 @@ function boundedCause(data: Cause, maxBytes: number): Cause {
38
42
  ...(data.errors ? { errors: data.errors.map((inner) => boundedCause(inner, maxBytes)) } : {}),
39
43
  };
40
44
  }
41
- /** A worker reply error before schema validation; report-cause keeps its transport.
42
- *
43
- * Defined here, not in regex-worker-contract.ts, so the worker's runtime graph
44
- * stays free of typebox: the contract module imports typebox to validate replies,
45
- * and the worker runs on plain jiti without the host's module mapping.
45
+ /**
46
+ * A failure a regex worker transports: its code ties the facts that code requires.
47
+ * The host still validates every reply (regex-worker-contract.ts) before trusting it.
46
48
  */
47
- export interface WorkerError {
48
- readonly code: string;
49
- readonly message: string;
50
- readonly facts?: unknown;
51
- readonly cause?: Cause;
52
- }
53
- export type WorkerFailure = { readonly error: WorkerError };
49
+ export type WorkerError = {
50
+ [C in ErrorCode]: {
51
+ readonly code: C;
52
+ readonly message: string;
53
+ readonly cause?: Cause;
54
+ } & Pick<HashlineErrorOptions<C>, "facts">;
55
+ }[ErrorCode];
56
+ type WorkerFailure = { readonly error: WorkerError };
54
57
 
55
58
  /** Transport full failures; the receiving tool applies its model-budget snapshot. */
56
59
  export function workerFailure(caught: unknown): WorkerFailure {
57
60
  if (caught instanceof HashlineError) {
58
- // Its constructor enforced the code/facts relationship before crossing the boundary.
61
+ // Its constructor enforced the code/facts relationship; TypeScript cannot carry that link
62
+ // through the generic errorCode.
59
63
  return {
60
64
  error: {
61
65
  code: caught.errorCode,
62
66
  message: caught.message,
63
67
  ...(caught.facts === undefined ? {} : { facts: caught.facts }),
64
68
  ...(caught.cause === undefined ? {} : { cause: causeOf(caught.cause, Infinity) }),
65
- },
69
+ } as WorkerError,
66
70
  };
67
71
  }
68
72
  return {
@@ -77,7 +81,7 @@ export function workerFailure(caught: unknown): WorkerFailure {
77
81
  /** Preserve underlying failures; visit each native error once to avoid cycles and repeats. */
78
82
  export function causeOf(
79
83
  error: unknown,
80
- maxBytes = DEFAULT_OUTPUT_BUDGETS.fieldBytes,
84
+ maxBytes: number,
81
85
  seen = new Set<unknown>(),
82
86
  ): Cause | undefined {
83
87
  if (error === undefined || seen.has(error)) return undefined;
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
2
2
  import type { AgentToolResult } from "@earendil-works/pi-agent-core";
3
3
  import type { ErrorCode } from "../core/errors.ts";
4
4
  import type { Report } from "./report-schema.ts";
5
- import { reportOf } from "./report.ts";
5
+ import { detailsReport } from "./report.ts";
6
6
 
7
7
  /** Assert execution failures through the returned model/TUI report, without changing tool semantics. */
8
8
  export async function expectToolFailure(
@@ -12,7 +12,7 @@ export async function expectToolFailure(
12
12
  ): Promise<Report> {
13
13
  const result = await pending;
14
14
  assert.equal(result.isError, true);
15
- const report = reportOf(result);
15
+ const report = detailsReport(result.details);
16
16
  assert.ok(report);
17
17
  assert.equal(report.error, code);
18
18
  inspect?.(report);
@@ -7,7 +7,7 @@
7
7
  * failure report is the entire result; a success report follows the tool's
8
8
  * content payload (read rows, grep rows). Each field has one
9
9
  * owning layer (README "Reports"), so no fact can be stated twice. report.ts
10
- * omits tool and path from success text; render.ts uses the full report for the TUI.
10
+ * omits the call's tool and path from result text; render.ts uses the full report for the TUI.
11
11
  *
12
12
  * Types derive from these schemas. src/core imports only types from this module,
13
13
  * so engines stay independent of Pi. The worker loads TypeBox at its data boundary.
@@ -38,21 +38,21 @@ export const CAUSE_SCHEMA = Type.Cyclic(
38
38
  );
39
39
  export type Cause = Static<typeof CAUSE_SCHEMA>;
40
40
 
41
- export const PUBLICATION_SCHEMA = Type.Union([
41
+ const PUBLICATION_SCHEMA = Type.Union([
42
42
  Type.Literal("NOT_PUBLISHED"),
43
43
  Type.Literal("PUBLISHED"),
44
44
  Type.Literal("UNKNOWN"),
45
45
  ]);
46
46
  export type PublicationStatus = Static<typeof PUBLICATION_SCHEMA>;
47
47
 
48
- export const STAGE_SCHEMA = Type.Union([
48
+ const STAGE_SCHEMA = Type.Union([
49
49
  Type.Literal("prepare"),
50
50
  Type.Literal("commit"),
51
51
  Type.Literal("post_process"),
52
52
  ]);
53
53
  export type MutationStage = Static<typeof STAGE_SCHEMA>;
54
54
 
55
- export const FRESHNESS_SCHEMA = Type.Union([
55
+ const FRESHNESS_SCHEMA = Type.Union([
56
56
  Type.Literal("unchanged"),
57
57
  Type.Literal("changed"),
58
58
  Type.Literal("missing"),
@@ -61,7 +61,7 @@ export const FRESHNESS_SCHEMA = Type.Union([
61
61
  export type Freshness = Static<typeof FRESHNESS_SCHEMA>;
62
62
 
63
63
  /** A then_run command's final status; `skipped` never started, `cancelled` may have. */
64
- export const COMMAND_STATUS_SCHEMA = Type.Union([
64
+ const COMMAND_STATUS_SCHEMA = Type.Union([
65
65
  Type.Literal("succeeded"),
66
66
  Type.Literal("failed"),
67
67
  Type.Literal("timeout"),
@@ -70,16 +70,39 @@ export const COMMAND_STATUS_SCHEMA = Type.Union([
70
70
  ]);
71
71
  export type CommandStatus = Static<typeof COMMAND_STATUS_SCHEMA>;
72
72
 
73
+ /** A then_run command's session tool result, as the TUI renders it. */
74
+ const COMMAND_RESULT_SCHEMA = Type.Object(
75
+ {
76
+ content: Type.Array(
77
+ Type.Union([
78
+ Type.Object(
79
+ {
80
+ type: Type.Literal("text"),
81
+ text: Type.String(),
82
+ textSignature: opt(Type.String()),
83
+ },
84
+ { additionalProperties: false },
85
+ ),
86
+ Type.Object(
87
+ { type: Type.Literal("image"), data: Type.String(), mimeType: Type.String() },
88
+ { additionalProperties: false },
89
+ ),
90
+ ]),
91
+ ),
92
+ details: opt(Type.Unknown()),
93
+ },
94
+ { additionalProperties: false },
95
+ );
96
+ export type CommandResult = Static<typeof COMMAND_RESULT_SCHEMA>;
97
+
73
98
  /** Fusion updates cross RPC and transcript boundaries before a final tool report exists. */
74
99
  export const ACTION_FUSION_PROGRESS_SCHEMA = Type.Object(
75
100
  {
76
101
  toolCallId: Type.String(),
77
- path: Type.String(),
78
102
  commandText: Type.String(),
79
103
  command: Type.Union([COMMAND_STATUS_SCHEMA, Type.Literal("waiting"), Type.Literal("running")]),
80
- publication: PUBLICATION_SCHEMA,
81
104
  freshness: FRESHNESS_SCHEMA,
82
- output: Type.String(),
105
+ result: opt(COMMAND_RESULT_SCHEMA),
83
106
  mutationCompleted: Type.Boolean(),
84
107
  timing: opt(
85
108
  Type.Object(
@@ -108,17 +131,18 @@ const ANCHOR_FAILURE_SCHEMA = Type.Object(
108
131
  search: opt(Type.Union([Type.Literal("local window"), Type.Literal("full file")])),
109
132
  candidate: opt(Type.String()),
110
133
  content: opt(Type.String()),
111
- contentOmitted: opt(Type.String()),
112
134
  candidates: opt(Type.Array(Type.String())),
113
135
  omittedCandidates: opt(Type.Integer({ minimum: 1 })),
114
136
  observed: opt(Type.String()),
115
- observedOmitted: opt(Type.String()),
137
+ omitted: opt(
138
+ Type.String({ description: "Why content (shifted) or observed (unresolved) is absent." }),
139
+ ),
116
140
  },
117
141
  { additionalProperties: false },
118
142
  );
119
143
  export type AnchorFailureFact = Static<typeof ANCHOR_FAILURE_SCHEMA>;
120
144
 
121
- export const ARGUMENT_ISSUE_SCHEMA = Type.Object(
145
+ const ARGUMENT_ISSUE_SCHEMA = Type.Object(
122
146
  {
123
147
  field: Type.String({
124
148
  description: "Path of the field in Pi's prepared arguments; `$` for none.",
@@ -134,9 +158,9 @@ export type ArgumentIssue = Static<typeof ARGUMENT_ISSUE_SCHEMA>;
134
158
 
135
159
  /**
136
160
  * Every fact a report can carry beside the envelope, in output order: failure
137
- * facts first, then each tool's outcome, freshness, the command, and forget.
161
+ * facts first, then each tool's outcome, freshness, and the command.
138
162
  */
139
- export const FACT_FIELDS = {
163
+ const FACT_FIELDS = {
140
164
  // Argument rejection (argument-error.ts).
141
165
  issues: Type.Array(ARGUMENT_ISSUE_SCHEMA),
142
166
  omittedIssues: count("Issues omitted from the byte budget."),
@@ -163,7 +187,7 @@ export const FACT_FIELDS = {
163
187
  offset: Type.Integer({ minimum: 0 }),
164
188
  timeoutMs: Type.Integer({ minimum: 1 }),
165
189
  exitCode: Type.Union([Type.Integer(), Type.Null()]),
166
- // read outcome.
190
+ // read outcome; `outputLimit` below is shared with grep.
167
191
  pagination: Type.Object(
168
192
  {
169
193
  start: Type.Integer(),
@@ -173,7 +197,6 @@ export const FACT_FIELDS = {
173
197
  },
174
198
  { additionalProperties: false },
175
199
  ),
176
- truncatedAt: Type.String({ description: "The byte budget that stopped the output." }),
177
200
  lineTooLong: Type.Object(
178
201
  { line: Type.Integer(), limit: Type.String() },
179
202
  { additionalProperties: false },
@@ -190,12 +213,15 @@ export const FACT_FIELDS = {
190
213
  description:
191
214
  "Bytes of files read when every file was a candidate; later files were not searched.",
192
215
  }),
193
- outputLimit: Type.String({ description: "Pi's output byte limit that cut the result." }),
216
+ outputLimit: Type.String({ description: "The output byte budget that cut the result." }),
194
217
  linePreviewLimit: Type.Integer({ description: "UTF-16 units kept in a cut line preview." }),
195
218
  invalidUtf8: Type.Array(Type.String(), {
196
219
  description: "Files shown as plain previews; their rows are not edit anchors.",
197
220
  }),
198
221
  diagnostics: Type.String({ description: "Search diagnostics; results cover confirmed matches." }),
222
+ literalPipe: Type.Literal(true, {
223
+ description: "A literal pattern contains |, which matches only the | character.",
224
+ }),
199
225
  // Mutation outcome.
200
226
  created: Type.Literal(true),
201
227
  // Commit-layer observation after publication.
@@ -207,14 +233,6 @@ export const FACT_FIELDS = {
207
233
  { additionalProperties: false },
208
234
  ),
209
235
  progressError: CAUSE_SCHEMA,
210
- // forget.
211
- forgotten: Type.Array(Type.String()),
212
- notForgettable: Type.Array(Type.String(), {
213
- description: "Named ids that are not tagged results of the previous response.",
214
- }),
215
- resultId: Type.String({ description: "Id to pass to forget." }),
216
- forgetScope: Type.String(),
217
- contentForgotten: Type.Literal(true),
218
236
  } satisfies TProperties;
219
237
 
220
238
  type FactName = keyof typeof FACT_FIELDS;
@@ -240,10 +258,6 @@ function facts<const R extends readonly FactName[], const O extends readonly Fac
240
258
  const NONE = facts([]);
241
259
  const MATCHED = ["matched", "omittedMatched"] as const;
242
260
 
243
- /** Text shared by forget's failure and partial success: a later response cannot forget them either. */
244
- const NOT_FORGETTABLE_NEXT =
245
- "Do not call forget again for the notForgettable ids; those results stay in context.";
246
-
247
261
  /**
248
262
  * Each error code: its facts and its recovery. `next.default` is the code's
249
263
  * recovery; other keys are the only alternatives a throw site may select.
@@ -307,7 +321,10 @@ export const ERROR_DEFINITIONS = {
307
321
  },
308
322
  TARGET_EXISTS: {
309
323
  facts: NONE,
310
- next: { default: 'Use mode "overwrite" to replace the existing file.' },
324
+ next: {
325
+ default:
326
+ 'Check the path and read the existing file. Use mode "overwrite" only if replacing that file is intended.',
327
+ },
311
328
  },
312
329
  NOT_REGULAR_FILE: { facts: NONE },
313
330
  MULTIPLE_HARD_LINKS: { facts: NONE },
@@ -327,10 +344,6 @@ export const ERROR_DEFINITIONS = {
327
344
  UNSUPPORTED_PATH: {
328
345
  facts: NONE,
329
346
  },
330
- NOT_FORGETTABLE: {
331
- facts: facts(["notForgettable"]),
332
- next: { default: NOT_FORGETTABLE_NEXT },
333
- },
334
347
  UNCLASSIFIED: { facts: NONE },
335
348
  } as const satisfies Record<
336
349
  string,
@@ -376,16 +389,18 @@ export const OUTCOME_NEXT = [
376
389
  "lineTooLong",
377
390
  "Inspect the line in chunks with bash, or use replace for a known literal or regex change; a smaller limit cannot split a line.",
378
391
  ],
379
- ["pagination", "Continue with offset set to pagination.nextOffset."],
380
- ["matchLimit", "Raise limit or refine the pattern for more matches."],
392
+ ["pagination", "If you need more lines, set offset to pagination.nextOffset."],
393
+ ["matchLimit", "If you need more matches, raise limit to include rows after the last one shown."],
394
+ [
395
+ "literalPipe",
396
+ "If you meant alternatives, pass them as a pattern array. Otherwise, keep literal matching.",
397
+ ],
381
398
  [
382
399
  "scanLimit",
383
400
  "Narrow path or glob, or add text every match must contain, to search the remaining files.",
384
401
  ],
385
402
  ["outputLimit", "Narrow path, glob, or pattern to see the omitted output."],
386
403
  ["linePreviewLimit", "Read the full line before rewriting it from a partial preview."],
387
- ["notForgettable", NOT_FORGETTABLE_NEXT],
388
- ["contentForgotten", "Rerun the call to see it again."],
389
404
  ] as const satisfies readonly (readonly [FactName, string])[];
390
405
 
391
406
  /** The report envelope and facts, in output order; `next` is always last. */
@@ -405,7 +420,7 @@ export const REPORT_SCHEMA = Type.Object({
405
420
  type ReportFields = Omit<Static<typeof REPORT_SCHEMA>, "error"> & { error?: ErrorCode };
406
421
 
407
422
  const SUCCESS_DEFINITIONS = {
408
- read: facts([], ["pagination", "truncatedAt", "lineTooLong", "resultId", "contentForgotten"]),
423
+ read: facts([], ["pagination", "outputLimit", "lineTooLong"]),
409
424
  grep: facts(
410
425
  [],
411
426
  [
@@ -418,15 +433,12 @@ const SUCCESS_DEFINITIONS = {
418
433
  "linePreviewLimit",
419
434
  "invalidUtf8",
420
435
  "diagnostics",
421
- "resultId",
422
- "contentForgotten",
436
+ "literalPipe",
423
437
  ],
424
438
  ),
425
439
  edit: facts([]),
426
440
  replace: facts([], ["matches"]),
427
441
  write: facts([], ["created"]),
428
- forget: facts(["forgotten"], ["notForgettable"]),
429
- codemode: facts([], ["resultId", "forgetScope", "contentForgotten"]),
430
442
  } as const;
431
443
  export type ReportTool = keyof typeof SUCCESS_DEFINITIONS;
432
444
  /** Tools whose reports carry publication, freshness, and the then_run outcome. */
@@ -476,7 +488,7 @@ const SUCCESS_SCHEMAS = Object.entries(SUCCESS_DEFINITIONS).map(([tool, schema])
476
488
  { additionalProperties: false },
477
489
  ),
478
490
  );
479
- /** Closed records after call context supplies a missing success tool; failure facts remain code-specific. */
491
+ /** Closed records after the originating call supplies the tool; failure facts remain code-specific. */
480
492
  export const WIRE_REPORT_SCHEMA = Type.Union([...FAILURE_SCHEMAS, ...SUCCESS_SCHEMAS]);
481
493
 
482
494
  // Static counterparts of the per-tool and per-code wire schemas above, built from the same fields.