agentfootprint 9.62.0 → 9.63.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 (34) hide show
  1. package/dist/core/agent/evidence/gate.js +13 -0
  2. package/dist/core/agent/evidence/gate.js.map +1 -1
  3. package/dist/core/agent/stages/callLLM.js +47 -0
  4. package/dist/core/agent/stages/callLLM.js.map +1 -1
  5. package/dist/esm/core/agent/evidence/gate.d.ts +13 -0
  6. package/dist/esm/core/agent/evidence/gate.js +13 -0
  7. package/dist/esm/core/agent/evidence/gate.js.map +1 -1
  8. package/dist/esm/core/agent/stages/callLLM.d.ts +7 -1
  9. package/dist/esm/core/agent/stages/callLLM.js +47 -0
  10. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  11. package/dist/esm/integrity/disposition/lifecycle.d.ts +13 -2
  12. package/dist/esm/integrity/disposition/lifecycle.js +27 -5
  13. package/dist/esm/integrity/disposition/lifecycle.js.map +1 -1
  14. package/dist/esm/integrity/unsupported-argument/check.d.ts +95 -0
  15. package/dist/esm/integrity/unsupported-argument/check.js +190 -0
  16. package/dist/esm/integrity/unsupported-argument/check.js.map +1 -0
  17. package/dist/esm/lib/trace-toolpack/traceToolpack.js +7 -5
  18. package/dist/esm/lib/trace-toolpack/traceToolpack.js.map +1 -1
  19. package/dist/integrity/disposition/lifecycle.js +29 -7
  20. package/dist/integrity/disposition/lifecycle.js.map +1 -1
  21. package/dist/integrity/unsupported-argument/check.js +195 -0
  22. package/dist/integrity/unsupported-argument/check.js.map +1 -0
  23. package/dist/lib/trace-toolpack/traceToolpack.js +7 -5
  24. package/dist/lib/trace-toolpack/traceToolpack.js.map +1 -1
  25. package/dist/types/core/agent/evidence/gate.d.ts +13 -0
  26. package/dist/types/core/agent/evidence/gate.d.ts.map +1 -1
  27. package/dist/types/core/agent/stages/callLLM.d.ts +7 -1
  28. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  29. package/dist/types/integrity/disposition/lifecycle.d.ts +13 -2
  30. package/dist/types/integrity/disposition/lifecycle.d.ts.map +1 -1
  31. package/dist/types/integrity/unsupported-argument/check.d.ts +96 -0
  32. package/dist/types/integrity/unsupported-argument/check.d.ts.map +1 -0
  33. package/dist/types/lib/trace-toolpack/traceToolpack.d.ts.map +1 -1
  34. package/package.json +1 -1
@@ -9,8 +9,11 @@
9
9
  * Role: a check is registered exactly when its preconditions exist on
10
10
  * THIS agent (wire: always — every run calls the model;
11
11
  * compose-invariant: a mount kernel is configured; dangling: at
12
- * least one tool declared `argumentsFrom`). Registration is what
13
- * makes silence auditable — an unregistered check is honest
12
+ * least one tool declared `argumentsFrom`, which arms BOTH the
13
+ * compose-seam dangling-reference check and the choice-seam
14
+ * unsupported-argument check off the same declaration).
15
+ * Registration is what makes silence auditable — an unregistered
16
+ * check is honest
14
17
  * absence, a registered one that never notes is the wiring rot
15
18
  * `assertAlive` exists to name.
16
19
  *
@@ -27,7 +30,8 @@ const ledger_js_1 = require("./ledger.js");
27
30
  const check_js_1 = require("../invariant-violation/check.js");
28
31
  const wire_js_1 = require("../invariant-violation/wire.js");
29
32
  const check_js_2 = require("../dangling-reference/check.js");
30
- const check_js_3 = require("../unsupported-claim/check.js");
33
+ const check_js_3 = require("../unsupported-argument/check.js");
34
+ const check_js_4 = require("../unsupported-claim/check.js");
31
35
  /**
32
36
  * Start one run's ledger: register the present checks and, in dev posture,
33
37
  * prove each can still catch its own synthetic defect.
@@ -50,8 +54,9 @@ function beginIntegrityRun(present, posture) {
50
54
  //
51
55
  // Per check, deliberately, rather than one all-or-nothing block for the
52
56
  // case where the app armed none of them. The common shape in the field is
53
- // PARTIAL: a consumer declares `argumentsFrom`, arms grounding, and never
54
- // learns that the other two never ran. An all-or-nothing block goes quiet
57
+ // PARTIAL: a consumer declares `argumentsFrom`, arms the two checks that
58
+ // field carries, and never learns that the rest never ran. An
59
+ // all-or-nothing block goes quiet
55
60
  // the moment one check is armed, which is precisely when the remaining
56
61
  // blind spots start to matter.
57
62
  //
@@ -69,13 +74,14 @@ function beginIntegrityRun(present, posture) {
69
74
  };
70
75
  armed('invariant-violation', 'compose', present.composeInvariant === true);
71
76
  armed('dangling-reference', 'compose', present.dangling === true);
77
+ armed('unsupported-argument', 'choice', present.dangling === true);
72
78
  armed('unsupported-claim', 'claim', present.claim === true);
73
79
  if (posture !== 'dev')
74
80
  return ledger;
75
81
  // The canaries — one known-bad fixture per REGISTERED check, through the
76
82
  // REAL pure function. Epoch -1 marks them as no run iteration's business.
77
83
  //
78
- // Registered, note, and no longer only armed. The three optional checks now
84
+ // Registered, note, and no longer only armed. The four optional checks now
79
85
  // file a row whether or not this run had a subject for them, and a
80
86
  // `not-applicable` row with no canary beside it is the exact ambiguity this
81
87
  // whole change set exists to remove: a checker that has ROTTED and a checker
@@ -107,9 +113,25 @@ function beginIntegrityRun(present, posture) {
107
113
  if (caught.length > 0)
108
114
  ledger.noteSynthetic('dangling-reference', 'compose', 'caught');
109
115
  }
116
+ {
117
+ // The choice-seam canary: an ARMED call carrying a value the corpus does
118
+ // not contain. The fixture's corpus deliberately says nothing that could
119
+ // match, so a check that still finds nothing is a check that cannot fire.
120
+ ledger.noteSynthetic('unsupported-argument', 'choice', 'minted');
121
+ const caught = (0, check_js_3.unsupportedArgumentsOf)([
122
+ {
123
+ toolName: 'canary_tool',
124
+ toolCallId: 'canary',
125
+ args: { id: 'canary-fabricated-id' },
126
+ argumentsFrom: ['canary_ground'],
127
+ },
128
+ ], { grounded: ['canary: this frame served no identifiers'], assistant: [] }, -1);
129
+ if (caught.length > 0)
130
+ ledger.noteSynthetic('unsupported-argument', 'choice', 'caught');
131
+ }
110
132
  {
111
133
  ledger.noteSynthetic('unsupported-claim', 'claim', 'minted');
112
- const caught = (0, check_js_3.unsupportedClaimsOf)([{ answerField: 'canary', entity: 'canary-entity', field: 'canary-field' }], [
134
+ const caught = (0, check_js_4.unsupportedClaimsOf)([{ answerField: 'canary', entity: 'canary-entity', field: 'canary-field' }], [
113
135
  {
114
136
  entity: 'canary-entity',
115
137
  field: 'canary-field',
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../src/integrity/disposition/lifecycle.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,2CAAwE;AAGxE,8DAAwE;AACxE,4DAAkE;AAClE,6DAAsE;AACtE,4DAAoE;AAapE;;;GAGG;AACH,SAAgB,iBAAiB,CAC/B,OAA+B,EAC/B,OAAyB;IAEzB,MAAM,MAAM,GAAG,IAAA,6BAAiB,GAAE,CAAC;IACnC,IAAI,OAAO,CAAC,IAAI;QAAE,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACjE,4CAA4C;IAC5C,EAAE;IACF,2EAA2E;IAC3E,uEAAuE;IACvE,uEAAuE;IACvE,0EAA0E;IAC1E,uEAAuE;IACvE,2EAA2E;IAC3E,2EAA2E;IAC3E,yEAAyE;IACzE,UAAU;IACV,EAAE;IACF,wEAAwE;IACxE,0EAA0E;IAC1E,0EAA0E;IAC1E,0EAA0E;IAC1E,uEAAuE;IACvE,+BAA+B;IAC/B,EAAE;IACF,4EAA4E;IAC5E,+DAA+D;IAC/D,2EAA2E;IAC3E,gEAAgE;IAChE,sEAAsE;IACtE,2EAA2E;IAC3E,wDAAwD;IACxD,MAAM,KAAK,GAAG,CAAC,IAAsB,EAAE,IAAmB,EAAE,OAAgB,EAAQ,EAAE;QACpF,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC1D,CAAC,CAAC;IACF,KAAK,CAAC,qBAAqB,EAAE,SAAS,EAAE,OAAO,CAAC,gBAAgB,KAAK,IAAI,CAAC,CAAC;IAC3E,KAAK,CAAC,oBAAoB,EAAE,SAAS,EAAE,OAA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CAAC;IACD,CAAC;QACC,MAAM,CAAC,aAAa,CAAC,mBAAmB,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAA,8BAAmB,EAChC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,EAC3E;YACE;gBACE,MAAM,EAAE,eAAe;gBACvB,KAAK,EAAE,cAAc;gBACrB,KAAK,EAAE,SAAS;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,UAAU,EAAE,QAAQ;gBACpB,SAAS,EAAE,CAAC,CAAC;aACd;SACF,EACD,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAC/B,CAAC,CAAC,CACH,CAAC;QACF,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,CAAC,aAAa,CAAC,mBAAmB,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AA/HD,8CA+HC"}
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ /**
3
+ * unsupported-argument — the model ACTED on a value nothing served, at the
4
+ * CHOICE seam.
5
+ *
6
+ * Pattern: pure function over (the calls, the frame they were chosen from);
7
+ * the domain check.
8
+ * Role: the decidable fragment of "did the model bind this reference to
9
+ * something the run actually served?". The measured failure: on the
10
+ * second turn of a triage conversation the window had dropped the
11
+ * user message carrying the true entity id and kept the assistant's
12
+ * own rendered answer. Asked for the status of "that machine", the
13
+ * model resolved the reference out of its OWN prior prose, took a
14
+ * truncated job-name fragment for a machine name, called the lookup
15
+ * tool with it, got an honest "nothing found", and told the person
16
+ * their protected machine had no backup record. Every shipped rail
17
+ * passed honestly — the coverage envelope, the absence envelope and
18
+ * the evidence gate all held, because every value in the answer
19
+ * really WAS grounded. The defect was the REFERENT, bound wrong at
20
+ * the argument, and the argument was the one seam with no check.
21
+ *
22
+ * DECLARED, NEVER INFERRED — the `argumentsFrom` precedent, second use. A
23
+ * tool is this check's subject only because its author said its arguments
24
+ * come from another tool's results; a tool that declares nothing is never
25
+ * examined, which is the whole zero-delta story. One declaration now arms two
26
+ * seams: `dangling-reference` asks whether the ground is still in reach when
27
+ * the tool is OFFERED, this asks whether the value the model chose came from
28
+ * that ground when the tool is CALLED.
29
+ *
30
+ * ASSISTANT TEXT IS NOT GROUND, and that is the entire idea. The system
31
+ * prompt, the user's messages and every tool result are things the RUN put in
32
+ * front of the model. Its own earlier turns are things it wrote. A value whose
33
+ * only source is the model's own rendered prose has been re-derived from a
34
+ * rendering rather than read from evidence, and re-deriving is exactly how a
35
+ * truncated job name becomes a machine name.
36
+ *
37
+ * THE FENCES, stated because they are the check's honesty:
38
+ * - NON-STRINGS ARE NEVER CHECKED. Numbers, booleans and null are not
39
+ * identifier-shaped, and substring-grounding them would accuse every
40
+ * literal the model legitimately computed.
41
+ * - VALUES UNDER FOUR CHARACTERS ARE NEVER CHECKED. Below that, substring
42
+ * matching is noise in both directions — 'up' and 'a1' land inside
43
+ * unrelated words in any corpus.
44
+ * - SERVED ANYWHERE PASSES, case-insensitively. The value need only appear
45
+ * inside SOME served string; see the README's stated leniency.
46
+ * - DECLARED VOCABULARY PASSES. A value the tool's own `inputSchema` lists in
47
+ * an `enum` was served BY THE SCHEMA — the model read it off the tool
48
+ * definition, not out of its own prose.
49
+ * Two states remain, and they file DIFFERENT messages because they call for
50
+ * different fixes: grounded only in the model's own prose (re-fetch the real
51
+ * ground), and grounded nowhere in the window at all (nothing served it).
52
+ *
53
+ * Detection only. Nothing here blocks, rewrites or delays a call.
54
+ */
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.unsupportedArgumentsOf = exports.declaredEnumValuesOf = void 0;
57
+ /** Below this, substring matching says nothing. */
58
+ const MIN_CHECKED_LENGTH = 4;
59
+ /** Longest a single value is quoted at inside a message. */
60
+ const MAX_QUOTED_CHARS = 80;
61
+ /** Deepest a schema is walked for `enum` declarations. */
62
+ const MAX_SCHEMA_DEPTH = 8;
63
+ function clip(value) {
64
+ return value.length <= MAX_QUOTED_CHARS ? value : `${value.slice(0, MAX_QUOTED_CHARS - 1)}…`;
65
+ }
66
+ /** Every string leaf of an arguments object, with its dot-path. */
67
+ function* stringLeaves(node, path) {
68
+ if (typeof node === 'string') {
69
+ yield { path, value: node };
70
+ return;
71
+ }
72
+ if (Array.isArray(node)) {
73
+ for (let i = 0; i < node.length; i++) {
74
+ yield* stringLeaves(node[i], path === '' ? String(i) : `${path}.${String(i)}`);
75
+ }
76
+ return;
77
+ }
78
+ if (node !== null && typeof node === 'object') {
79
+ for (const [key, value] of Object.entries(node)) {
80
+ yield* stringLeaves(value, path === '' ? key : `${path}.${key}`);
81
+ }
82
+ }
83
+ }
84
+ /**
85
+ * Best-effort: every string an `enum` array declares anywhere in a tool's
86
+ * `inputSchema`. Flat by design — a per-path map would be more precise, and on
87
+ * an accusation boundary the lenient direction is the safe one. An absent or
88
+ * non-object schema yields an empty set, which simply means no enum fence.
89
+ */
90
+ function declaredEnumValuesOf(schema) {
91
+ const values = new Set();
92
+ const walk = (node, depth) => {
93
+ if (depth > MAX_SCHEMA_DEPTH || node === null || typeof node !== 'object')
94
+ return;
95
+ if (Array.isArray(node)) {
96
+ for (const item of node)
97
+ walk(item, depth + 1);
98
+ return;
99
+ }
100
+ const obj = node;
101
+ if (Array.isArray(obj.enum)) {
102
+ for (const declared of obj.enum)
103
+ if (typeof declared === 'string')
104
+ values.add(declared);
105
+ }
106
+ for (const value of Object.values(obj))
107
+ walk(value, depth + 1);
108
+ };
109
+ walk(schema, 0);
110
+ return values;
111
+ }
112
+ exports.declaredEnumValuesOf = declaredEnumValuesOf;
113
+ /**
114
+ * Check every armed call's identifier-like string arguments against the frame
115
+ * the model chose from.
116
+ *
117
+ * @param calls the ARMED tool calls of one response — a caller filters by
118
+ * `argumentsFrom` before calling; nothing here re-decides who is a subject.
119
+ * @param corpus the exact request this response was assembled from, split into
120
+ * what the run served and what the model itself wrote.
121
+ * @param epoch the run iteration, stamped on every witness.
122
+ */
123
+ function unsupportedArgumentsOf(calls, corpus, epoch) {
124
+ const findings = [];
125
+ if (calls.length === 0)
126
+ return findings;
127
+ const served = corpus.grounded.map((text) => text.toLowerCase());
128
+ const written = corpus.assistant.map((text) => text.toLowerCase());
129
+ const frame = `frame this call was assembled from: ${String(served.length)} served string(s) ` +
130
+ `(system prompt, user messages, tool results) and ${String(written.length)} assistant turn(s)`;
131
+ for (const call of calls) {
132
+ const subject = { kind: 'tool', id: call.toolName };
133
+ const declared = new Set([...(call.declaredEnums ?? [])].map((v) => v.toLowerCase()));
134
+ const grounds = call.argumentsFrom.join(' or ');
135
+ const refetch = grounds.length > 0
136
+ ? `call ${grounds} again and use a value it returns`
137
+ : 're-read the value from the tool that serves it';
138
+ for (const leaf of stringLeaves(call.args, '')) {
139
+ const value = leaf.value.trim();
140
+ if (value.length < MIN_CHECKED_LENGTH)
141
+ continue;
142
+ const needle = value.toLowerCase();
143
+ if (declared.has(needle))
144
+ continue;
145
+ if (served.some((text) => text.includes(needle)))
146
+ continue;
147
+ const selfReferenced = written.some((text) => text.includes(needle));
148
+ const witnesses = [
149
+ {
150
+ subject,
151
+ predicate: leaf.path,
152
+ value: leaf.value,
153
+ epoch,
154
+ stratum: 'asserted',
155
+ provenance: `tool call ${call.toolCallId}: argument '${leaf.path}' as the model chose it`,
156
+ },
157
+ {
158
+ subject,
159
+ predicate: leaf.path,
160
+ value: selfReferenced
161
+ ? 'served by nothing — present only in the model’s own earlier answer'
162
+ : 'served by nothing in the window the model saw',
163
+ epoch,
164
+ stratum: 'asserted',
165
+ provenance: frame,
166
+ },
167
+ ];
168
+ findings.push({
169
+ kind: 'unsupported-argument',
170
+ seam: 'choice',
171
+ subjects: [subject],
172
+ // The dot-path IS the discriminator: two arguments of one call are two
173
+ // defects, and without it the second collapses into the first (the
174
+ // `unsupported-claim` per-field lesson, same substrate rule).
175
+ predicate: leaf.path,
176
+ witnesses,
177
+ epoch,
178
+ message: selfReferenced
179
+ ? `'${call.toolName}' was called with ${leaf.path} = "${clip(value)}", and the only ` +
180
+ `place that value appears in the frame the model chose from is the model’s own ` +
181
+ `earlier answer. Rendered text is not evidence — a value re-read out of prose can ` +
182
+ `be a fragment of something else entirely. To ground it, ${refetch}. Nothing here ` +
183
+ `blocked the call.`
184
+ : `'${call.toolName}' was called with ${leaf.path} = "${clip(value)}", and that value ` +
185
+ `appears nowhere in the frame the model chose from — not in the instructions, not ` +
186
+ `in any message from the user, not in any tool result. Nothing served it, so ` +
187
+ `nothing in this run can say what it refers to. To ground it, ${refetch}. Nothing ` +
188
+ `here blocked the call.`,
189
+ });
190
+ }
191
+ }
192
+ return findings;
193
+ }
194
+ exports.unsupportedArgumentsOf = unsupportedArgumentsOf;
195
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/integrity/unsupported-argument/check.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;;;AA8BH,mDAAmD;AACnD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,4DAA4D;AAC5D,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,0DAA0D;AAC1D,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,KAAK,CAAC,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAAC,GAAG,CAAC;AAC/F,CAAC;AAED,mEAAmE;AACnE,QAAQ,CAAC,CAAC,YAAY,CAAC,IAAa,EAAE,IAAY;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,EAAE,IAAI,EAAE,KAA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iBAC1F;gBACD;oBACE,OAAO;oBACP,SAAS,EAAE,IAAI,CAAC,IAAI;oBACpB,KAAK,EAAE,cAAc;wBACnB,CAAC,CAAC,oEAAoE;wBACtE,CAAC,CAAC,+CAA+C;oBACnD,KAAK;oBACL,OAAO,EAAE,UAAU;oBACnB,UAAU,EAAE,KAAK;iBAClB;aACF,CAAC;YAEF,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,sBAAsB;gBAC5B,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,uEAAuE;gBACvE,mEAAmE;gBACnE,8DAA8D;gBAC9D,SAAS,EAAE,IAAI,CAAC,IAAI;gBACpB,SAAS;gBACT,KAAK;gBACL,OAAO,EAAE,cAAc;oBACrB,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,qBAAqB,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB;wBACnF,gFAAgF;wBAChF,mFAAmF;wBACnF,2DAA2D,OAAO,iBAAiB;wBACnF,mBAAmB;oBACrB,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,qBAAqB,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,oBAAoB;wBACrF,mFAAmF;wBACnF,8EAA8E;wBAC9E,gEAAgE,OAAO,YAAY;wBACnF,wBAAwB;aAC7B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AA5ED,wDA4EC"}
@@ -456,7 +456,7 @@ function buildRunOverview(artifacts, index) {
456
456
  * compile HERE, rather than becoming a value the tool's enum silently
457
457
  * rejects at run time.
458
458
  * - the honesty gate. `ContextErrorKind` names five defect classes;
459
- * `src/integrity/` ships three checks. Offering the other two in the
459
+ * `src/integrity/` ships four checks. Offering the fifth in the
460
460
  * schema enum invites a query whose only possible answer is a negative
461
461
  * verdict about a class nothing in the library could have filed — the
462
462
  * tool telling a model "no duplicate-execution errors" when nothing on
@@ -466,7 +466,7 @@ function buildRunOverview(artifacts, index) {
466
466
  */
467
467
  const CONTEXT_ERROR_KIND_CHECKS = {
468
468
  'invariant-violation': 'src/integrity/invariant-violation (write + wire)',
469
- 'unsupported-argument': false,
469
+ 'unsupported-argument': 'src/integrity/unsupported-argument (choice)',
470
470
  'dangling-reference': 'src/integrity/dangling-reference (compose)',
471
471
  'duplicate-execution': false,
472
472
  'unsupported-claim': 'src/integrity/unsupported-claim (claim)',
@@ -758,12 +758,14 @@ function buildFindContextErrors(artifacts, index, reader, opts) {
758
758
  name: 'find_context_errors',
759
759
  description: 'What did this run CONTRADICT ITSELF about? Lists the Context Integrity findings the ' +
760
760
  'library already caught — an invariant violated, an offered action whose inputs left ' +
761
- 'scope, a claim the record does not support — each with the step it was filed at and the ' +
761
+ 'scope, an argument nothing served, a claim the record does not support — each with the ' +
762
+ 'step it was filed at and the ' +
762
763
  'exact drill that opens the state behind it. Call it EARLY when an answer looks wrong: a ' +
763
764
  'contradiction the library already caught beats re-deriving one. Reads only; nothing is ' +
764
765
  're-checked or re-judged. When no finding evidence was captured it says so plainly rather ' +
765
- `than reporting a clean run. The finding type also names ${UNFILABLE_CONTEXT_ERROR_KINDS.map((kind) => `'${kind}'`).join(' and ')}, and no check in this build files them — this tool cannot report on ` +
766
- 'those classes at all, so its silence about them is not evidence. ' +
766
+ `than reporting a clean run. The finding type also names ${UNFILABLE_CONTEXT_ERROR_KINDS.map((kind) => `'${kind}'`).join(' and ')}, and no check in this build files ${UNFILABLE_CONTEXT_ERROR_KINDS.length === 1 ? 'it' : 'them'} — this tool cannot report on ` +
767
+ `that class${UNFILABLE_CONTEXT_ERROR_KINDS.length === 1 ? '' : 'es'} at all, so its ` +
768
+ 'silence about it is not evidence. ' +
767
769
  `Bounded by limit (default ${FINDINGS_DEFAULT}, hard cap ${types_js_2.TOOLPACK_HARD_CAPS.contextErrorsMax}).`,
768
770
  inputSchema: {
769
771
  type: 'object',