agentfootprint 9.62.0 → 9.64.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.
- package/dist/adapters/observability/otel.js +5 -2
- package/dist/adapters/observability/otel.js.map +1 -1
- package/dist/core/agent/coverage/absent.js +14 -11
- package/dist/core/agent/coverage/absent.js.map +1 -1
- package/dist/core/agent/coverage/evidence.js +77 -34
- package/dist/core/agent/coverage/evidence.js.map +1 -1
- package/dist/core/agent/evidence/evidenceIndex.js +15 -14
- package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/core/agent/evidence/gate.js +13 -0
- package/dist/core/agent/evidence/gate.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +47 -0
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/toolArgsValidation.js +142 -18
- package/dist/core/agent/toolArgsValidation.js.map +1 -1
- package/dist/esm/adapters/observability/otel.js +5 -2
- package/dist/esm/adapters/observability/otel.js.map +1 -1
- package/dist/esm/core/agent/coverage/absent.d.ts +14 -11
- package/dist/esm/core/agent/coverage/absent.js +14 -11
- package/dist/esm/core/agent/coverage/absent.js.map +1 -1
- package/dist/esm/core/agent/coverage/evidence.d.ts +52 -28
- package/dist/esm/core/agent/coverage/evidence.js +77 -34
- package/dist/esm/core/agent/coverage/evidence.js.map +1 -1
- package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +8 -7
- package/dist/esm/core/agent/evidence/evidenceIndex.js +15 -14
- package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/esm/core/agent/evidence/gate.d.ts +13 -0
- package/dist/esm/core/agent/evidence/gate.js +13 -0
- package/dist/esm/core/agent/evidence/gate.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.d.ts +7 -1
- package/dist/esm/core/agent/stages/callLLM.js +47 -0
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/toolArgsValidation.d.ts +62 -17
- package/dist/esm/core/agent/toolArgsValidation.js +142 -18
- package/dist/esm/core/agent/toolArgsValidation.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +9 -4
- package/dist/esm/events/payloads.d.ts +9 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integrity/disposition/lifecycle.d.ts +13 -2
- package/dist/esm/integrity/disposition/lifecycle.js +27 -5
- package/dist/esm/integrity/disposition/lifecycle.js.map +1 -1
- package/dist/esm/integrity/unsupported-argument/check.d.ts +95 -0
- package/dist/esm/integrity/unsupported-argument/check.js +190 -0
- package/dist/esm/integrity/unsupported-argument/check.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/traceToolpack.js +7 -5
- package/dist/esm/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrity/disposition/lifecycle.js +29 -7
- package/dist/integrity/disposition/lifecycle.js.map +1 -1
- package/dist/integrity/unsupported-argument/check.js +195 -0
- package/dist/integrity/unsupported-argument/check.js.map +1 -0
- package/dist/lib/trace-toolpack/traceToolpack.js +7 -5
- package/dist/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/types/adapters/observability/otel.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/absent.d.ts +14 -11
- package/dist/types/core/agent/coverage/absent.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/evidence.d.ts +52 -28
- package/dist/types/core/agent/coverage/evidence.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts +8 -7
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/gate.d.ts +13 -0
- package/dist/types/core/agent/evidence/gate.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts +7 -1
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/toolArgsValidation.d.ts +62 -17
- package/dist/types/core/agent/toolArgsValidation.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +9 -4
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +9 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrity/disposition/lifecycle.d.ts +13 -2
- package/dist/types/integrity/disposition/lifecycle.d.ts.map +1 -1
- package/dist/types/integrity/unsupported-argument/check.d.ts +96 -0
- package/dist/types/integrity/unsupported-argument/check.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/traceToolpack.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* toolArgsValidation — validate LLM-produced tool args against the tool's
|
|
3
3
|
* declared `inputSchema` BEFORE dispatch (backlog #9).
|
|
4
4
|
*
|
|
5
|
-
* Pattern: pure function module — no
|
|
6
|
-
*
|
|
5
|
+
* Pattern: pure function module — no events, and no state beyond one compiled-
|
|
6
|
+
* regex cache (which doubles as the warn-once ledger for `pattern`s
|
|
7
|
+
* that do not compile); the toolCalls stage owns when to call it and
|
|
8
|
+
* what to do with the verdict.
|
|
7
9
|
* Role: The model writes tool args as free-form JSON; nothing guaranteed
|
|
8
10
|
* they match the schema the tool advertised. Dispatching garbage
|
|
9
11
|
* surfaced as deep tool stack traces (or worse, silent misbehavior).
|
|
@@ -14,25 +16,136 @@
|
|
|
14
16
|
* ── Honest-subset contract ────────────────────────────────────────────────
|
|
15
17
|
* This is NOT a full JSON Schema implementation. It enforces the core that
|
|
16
18
|
* tool schemas in the wild actually use, and IGNORES everything else
|
|
17
|
-
* (permissive on unknown keywords — a schema using `
|
|
18
|
-
*
|
|
19
|
+
* (permissive on unknown keywords — a schema using `oneOf`/`$ref` still
|
|
20
|
+
* validates the supported core, never false-rejects on the rest):
|
|
19
21
|
*
|
|
20
22
|
* ENFORCED: `type` (object/array/string/number/integer/boolean/null,
|
|
21
23
|
* union arrays), `required`, `properties` (recursive),
|
|
22
24
|
* `items` (single-schema, recursive), `enum` (primitives),
|
|
23
|
-
* `additionalProperties: false` ONLY when explicitly set
|
|
24
|
-
*
|
|
25
|
+
* `additionalProperties: false` ONLY when explicitly set,
|
|
26
|
+
* and the STRING SHAPE keywords `pattern` / `minLength` /
|
|
27
|
+
* `maxLength`.
|
|
28
|
+
* IGNORED: format, numeric min/max, oneOf/anyOf/allOf/not, $ref,
|
|
25
29
|
* const, dependencies, …
|
|
26
30
|
*
|
|
27
|
-
* ──
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* ── Why string SHAPE joined the subset ────────────────────────────────────
|
|
32
|
+
* A tool result ended with an offer ("I can also map these ids to volume
|
|
33
|
+
* names"); the person answered "yes please"; the model bound that sentence as
|
|
34
|
+
* the IDENTIFIER argument and dispatched. The tool's schema declared the
|
|
35
|
+
* identifier's shape and this boundary did not read it, so a call that could
|
|
36
|
+
* never succeed cost a round trip — and the consumer hand-rolled an
|
|
37
|
+
* affirmative blocklist to do what the declaration already said. A declared
|
|
38
|
+
* shape a boundary ignores is worse than no declaration: the author believes
|
|
39
|
+
* it is enforced.
|
|
40
|
+
*
|
|
41
|
+
* `pattern` is JSON Schema's own semantics — UNANCHORED, ECMA-262, applied to
|
|
42
|
+
* strings only. A regex the schema author got wrong must never take dispatch
|
|
43
|
+
* with it: it is compiled once, and a compile failure degrades to no-pattern
|
|
44
|
+
* plus one developer warning.
|
|
45
|
+
*
|
|
46
|
+
* ── Security: what an issue may echo ──────────────────────────────────────
|
|
47
|
+
* `type` / `enum` / `required` / `additionalProperties` issues name the PATH,
|
|
48
|
+
* the EXPECTED shape, and the TYPE of what arrived — never the supplied value.
|
|
49
|
+
* Enum expectations echo SCHEMA values only (already LLM-visible in the tools
|
|
50
|
+
* block).
|
|
51
|
+
*
|
|
52
|
+
* String-SHAPE issues are the one exception, and it is a narrow one: the
|
|
53
|
+
* complaint IS the value's shape, so `expected string, got string` teaches
|
|
54
|
+
* nothing and the correction cannot converge. They carry `value` — a capped
|
|
55
|
+
* excerpt ({@link MAX_VALUE_CHARS}) of the offending string — plus `hint`, the
|
|
56
|
+
* parameter's own `description`, which is where an author writes what the
|
|
57
|
+
* identifier looks like. Neither adds exposure: the value is the model's own
|
|
58
|
+
* tool-call argument, already verbatim in the history this message is appended
|
|
59
|
+
* to. The OTel adapter renders `path`/`expected`/`got` only, so third-party
|
|
60
|
+
* telemetry stays value-free either way.
|
|
33
61
|
*/
|
|
34
62
|
/** Cap so a pathological schema/args pair can't flood history or events. */
|
|
35
63
|
const MAX_ISSUES = 10;
|
|
64
|
+
/** Ceiling on the echoed excerpt of an offending string. Enough to recognize
|
|
65
|
+
* a sentence bound where an identifier belonged; short enough that a 5 MB
|
|
66
|
+
* argument cannot ride the message into history. */
|
|
67
|
+
const MAX_VALUE_CHARS = 80;
|
|
68
|
+
/**
|
|
69
|
+
* Ceiling on compiled `pattern`s held. Schemas are finite in a process, so
|
|
70
|
+
* this is a fence against dynamically-minted ones rather than a tuning knob:
|
|
71
|
+
* past it, patterns compile per call (and a broken one warns again) instead of
|
|
72
|
+
* the map growing without bound.
|
|
73
|
+
*/
|
|
74
|
+
const MAX_CACHED_PATTERNS = 256;
|
|
75
|
+
/**
|
|
76
|
+
* Compiled `pattern`s, and the warn-once ledger for the broken ones. A `null`
|
|
77
|
+
* entry means "this pattern does not compile" — recorded so a schema bug is
|
|
78
|
+
* reported once to the developer rather than once per dispatch.
|
|
79
|
+
*/
|
|
80
|
+
const patternCache = new Map();
|
|
81
|
+
function compilePattern(pattern) {
|
|
82
|
+
const cached = patternCache.get(pattern);
|
|
83
|
+
if (cached !== undefined)
|
|
84
|
+
return cached;
|
|
85
|
+
let compiled = null;
|
|
86
|
+
try {
|
|
87
|
+
// No flags: JSON Schema `pattern` is an unanchored ECMA-262 match, and a
|
|
88
|
+
// `g` flag would make the RegExp stateful across calls.
|
|
89
|
+
compiled = new RegExp(pattern);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
console.warn(`[agentfootprint] a tool inputSchema declares a \`pattern\` that is not a valid regular ` +
|
|
93
|
+
`expression (${pattern}) — it is IGNORED, so this argument's shape is NOT enforced. ` +
|
|
94
|
+
`Fix the expression or drop the keyword.`);
|
|
95
|
+
}
|
|
96
|
+
if (patternCache.size < MAX_CACHED_PATTERNS)
|
|
97
|
+
patternCache.set(pattern, compiled);
|
|
98
|
+
return compiled;
|
|
99
|
+
}
|
|
100
|
+
/** A length bound this validator will act on: a non-negative integer. Anything
|
|
101
|
+
* else is outside the honest subset and ignored rather than guessed at. */
|
|
102
|
+
function lengthBound(raw) {
|
|
103
|
+
return typeof raw === 'number' && Number.isInteger(raw) && raw >= 0 ? raw : undefined;
|
|
104
|
+
}
|
|
105
|
+
function excerptOf(value) {
|
|
106
|
+
return value.length <= MAX_VALUE_CHARS ? value : `${value.slice(0, MAX_VALUE_CHARS)}…`;
|
|
107
|
+
}
|
|
108
|
+
function descriptionOf(schema) {
|
|
109
|
+
const raw = schema.description;
|
|
110
|
+
if (typeof raw !== 'string')
|
|
111
|
+
return undefined;
|
|
112
|
+
const trimmed = raw.trim();
|
|
113
|
+
return trimmed === '' ? undefined : trimmed;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The string SHAPE keywords. At most ONE issue per argument: `pattern`
|
|
117
|
+
* describes the value completely, so adding "and it is too short" is a second
|
|
118
|
+
* sentence about one mistake.
|
|
119
|
+
*/
|
|
120
|
+
function checkStringShape(value, schema, path, issues) {
|
|
121
|
+
const hint = descriptionOf(schema);
|
|
122
|
+
const teach = (expected, got) => {
|
|
123
|
+
issues.push({
|
|
124
|
+
path,
|
|
125
|
+
expected,
|
|
126
|
+
got,
|
|
127
|
+
value: excerptOf(value),
|
|
128
|
+
...(hint !== undefined && { hint }),
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
const pattern = schema.pattern;
|
|
132
|
+
if (typeof pattern === 'string') {
|
|
133
|
+
const regex = compilePattern(pattern);
|
|
134
|
+
if (regex !== null && !regex.test(value)) {
|
|
135
|
+
teach(`a string matching ${pattern}`, 'string');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const min = lengthBound(schema.minLength);
|
|
140
|
+
if (min !== undefined && value.length < min) {
|
|
141
|
+
teach(`a string of at least ${min} characters`, `string of length ${value.length}`);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const max = lengthBound(schema.maxLength);
|
|
145
|
+
if (max !== undefined && value.length > max) {
|
|
146
|
+
teach(`a string of at most ${max} characters`, `string of length ${value.length}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
36
149
|
function typeNameOf(value) {
|
|
37
150
|
if (value === null)
|
|
38
151
|
return 'null';
|
|
@@ -94,6 +207,12 @@ function validateNode(value, schema, path, issues) {
|
|
|
94
207
|
return;
|
|
95
208
|
}
|
|
96
209
|
}
|
|
210
|
+
// String SHAPE — same place, same dial, same result shape as `type`/`enum`
|
|
211
|
+
// above. Applies to strings only, which is JSON Schema's own rule.
|
|
212
|
+
if (typeof value === 'string') {
|
|
213
|
+
checkStringShape(value, schema, path, issues);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
97
216
|
// Object keywords.
|
|
98
217
|
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
99
218
|
const record = value;
|
|
@@ -169,17 +288,22 @@ export function validateToolArgs(args, inputSchema) {
|
|
|
169
288
|
return { ok: issues.length === 0, issues };
|
|
170
289
|
}
|
|
171
290
|
/**
|
|
172
|
-
* Render the MODEL-VISIBLE tool result for a rejected call. Names paths
|
|
173
|
-
* expectations
|
|
174
|
-
*
|
|
175
|
-
* is
|
|
291
|
+
* Render the MODEL-VISIBLE tool result for a rejected call. Names paths and
|
|
292
|
+
* expectations; reports received TYPES for structural issues and the capped
|
|
293
|
+
* offending VALUE for string-shape ones, because a shape complaint that will
|
|
294
|
+
* not say which string it is about cannot be acted on. `JSON.stringify` quotes
|
|
295
|
+
* and escapes the excerpt, so a multi-line argument stays one line.
|
|
296
|
+
*
|
|
297
|
+
* The parameter's own `description` follows on its own line when the schema
|
|
298
|
+
* declares one: that sentence is usually the whole correction.
|
|
176
299
|
*/
|
|
177
300
|
export function formatToolArgIssues(toolName, issues) {
|
|
178
301
|
const lines = issues.map((issue) => {
|
|
179
302
|
const where = issue.path === '' ? 'arguments' : `'${issue.path}'`;
|
|
180
|
-
|
|
303
|
+
const head = issue.expected === 'required'
|
|
181
304
|
? `- ${where} is required but missing`
|
|
182
|
-
: `- ${where}: expected ${issue.expected}, got ${issue.got}`;
|
|
305
|
+
: `- ${where}: expected ${issue.expected}, got ${issue.value === undefined ? issue.got : JSON.stringify(issue.value)}`;
|
|
306
|
+
return issue.hint === undefined ? head : `${head}\n ${where} is described as: ${issue.hint}`;
|
|
183
307
|
});
|
|
184
308
|
return (`Invalid arguments for tool '${toolName}' — the call was not executed.\n` +
|
|
185
309
|
`${lines.join('\n')}\n` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolArgsValidation.js","sourceRoot":"","sources":["../../../../src/core/agent/toolArgsValidation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toolArgsValidation.js","sourceRoot":"","sources":["../../../../src/core/agent/toolArgsValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAgCH,4EAA4E;AAC5E,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB;;qDAEqD;AACrD,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAIhC;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;AAEtD,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAA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AAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CACpE,EAAE,CAAC;QACT,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,KAAK,qBAAqB,KAAK,CAAC,IAAI,EAAE,CAAC;IAChG,CAAC,CAAC,CAAC;IACH,OAAO,CACL,+BAA+B,QAAQ,kCAAkC;QACzE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QACvB,uEAAuE,CACxE,CAAC;AACJ,CAAC"}
|
|
@@ -204,12 +204,17 @@ export interface AgentOptions {
|
|
|
204
204
|
* are validated against the tool's declared `inputSchema` BEFORE dispatch.
|
|
205
205
|
* On mismatch the tool is NOT executed — the model receives a structured
|
|
206
206
|
* retry message as the tool result (paths + expected shapes + received
|
|
207
|
-
* TYPES
|
|
208
|
-
*
|
|
207
|
+
* TYPES) and corrects itself on the next iteration. Emits
|
|
208
|
+
* `agentfootprint.validation.args_invalid`.
|
|
209
209
|
* `'warn'` emits the event but executes anyway; `'off'` disables.
|
|
210
210
|
* Validation is an honest JSON-Schema subset (type/required/properties/
|
|
211
|
-
* items/enum/explicit additionalProperties:false
|
|
212
|
-
*
|
|
211
|
+
* items/enum/explicit additionalProperties:false, plus the string SHAPE
|
|
212
|
+
* keywords pattern/minLength/maxLength) — unsupported keywords are
|
|
213
|
+
* ignored, never false-rejecting.
|
|
214
|
+
*
|
|
215
|
+
* A string-shape refusal quotes a CAPPED excerpt of the offending value
|
|
216
|
+
* and the parameter's own `description`, because "expected string, got
|
|
217
|
+
* string" cannot be acted on; every other issue still names types only.
|
|
213
218
|
*/
|
|
214
219
|
readonly toolArgValidation?: ToolArgValidationMode;
|
|
215
220
|
/**
|
|
@@ -951,6 +951,15 @@ export interface ValidationArgsInvalidPayload {
|
|
|
951
951
|
readonly path: string;
|
|
952
952
|
readonly expected: string;
|
|
953
953
|
readonly got: string;
|
|
954
|
+
/**
|
|
955
|
+
* A capped excerpt of the offending STRING — present on string-shape
|
|
956
|
+
* issues (`pattern` / `minLength` / `maxLength`) only, where the
|
|
957
|
+
* complaint IS the value's shape. Structural issues (type, enum,
|
|
958
|
+
* required, additionalProperties) still carry no value at all.
|
|
959
|
+
*/
|
|
960
|
+
readonly value?: string;
|
|
961
|
+
/** The parameter's own schema `description`, when it declares one. */
|
|
962
|
+
readonly hint?: string;
|
|
954
963
|
}>;
|
|
955
964
|
readonly enforced: boolean;
|
|
956
965
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export { defaultCommentaryTemplates, extractAgentName, extractCommentaryVars, re
|
|
|
32
32
|
export { LLMCall, LLMCallBuilder, type LLMCallInput, type LLMCallOptions, type LLMCallOutput, } from './core/LLMCall.js';
|
|
33
33
|
export { type MessageApiChartDeps } from './core/agent/buildMessageApiChart.js';
|
|
34
34
|
export { buildAgentMessageApiChart, type AgentMessageApiChartDeps, } from './core/agent/buildAgentMessageApiChart.js';
|
|
35
|
-
export { Agent, AgentBuilder, type AgentArtifactsOptions, type AgentRecordingsOptions, type AgentInput, type AgentOptions, type AgentOutput, type ObserverDeliveryOptions, type SkillGraphOptions, type ProviderChoice, type EscalationPolicy, } from './core/Agent.js';
|
|
35
|
+
export { Agent, AgentBuilder, type AgentArtifactsOptions, type AgentRecordingsOptions, type AgentInput, type AgentOptions, type AgentOutput, type ObserverDeliveryOptions, type RunConfig, type RunConfigContext, type RunConfigFn, type SkillGraphOptions, type ProviderChoice, type EscalationPolicy, } from './core/Agent.js';
|
|
36
36
|
export { CompactionUnmeasurableError, COMPACTED_FRAME_PREFIX, DROP_NOTICE_PREFIX, foldedMessages, foldedSpanFor, isCompactedSummary, isDropNotice, slidingWindow, summarizeOldest, tokenBudget, type CompactionOptions, type CompactionRecord, type CompactionRetention, type FoldedConversation, type FoldedSpan, type RemovalFacts, type RemovalPlan, type SlidingWindowOptions, type SlidingWindowRecord, type TokenBudgetOptions, type TokenBudgetRecord, type Turn, type WindowEviction, type WindowObservations, type WindowRecord, type WindowRefusal, type WindowRefusalReason, type WindowStrategy, type WindowStrategyInput, type WindowStrategyResult, } from './core/agent/window/index.js';
|
|
37
37
|
export type { SelfExplainInclude, SelfExplainOptions } from './lib/trace-toolpack/selfExplain.js';
|
|
38
38
|
export type { ObserverDrainResult, ObserverStats } from 'footprintjs';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oEAAoE;AACpE,8DAA8D;AAC9D,uEAAuE;AACvE,kEAAkE;AAClE,sEAAsE;AACtE,sDAAsD;AACtD,OAAO,8CAA8C,CAAC;AACtD,OAAO,2CAA2C,CAAC;AACnD,OAAO,4CAA4C,CAAC;AAsCpD,6BAA6B;AAC7B,cAAc,qBAAqB,CAAC;AAEpC,yEAAyE;AACzE,uDAAuD;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc;AAEd,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,gBAAgB;AAChB,SAAS;AAET,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,6DAA6D;AAC7D,YAAY;AAGZ,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,4EAA4E;AAC5E,uCAAuC;AACvC,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,qEAAqE;AACrE,kDAAkD;AAClD,OAAO,EACL,gBAAgB,GAMjB,MAAM,2BAA2B,CAAC;AAKnC,yCAAyC;AACzC,EAAE;AACF,yEAAyE;AACzE,kEAAkE;AAClE,oEAAoE;AACpE,qEAA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AuE;AACvE,uEAAuE;AACvE,oEAAoE;AACpE,sEAAsE;AACtE,8CAA8C;AAE9C,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,OAAO,EACL,SAAS,EACT,uBAAuB,EAEvB,cAAc,GAGf,MAAM,oBAAoB,CAAC;AAE5B,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AACrE,iEAAiE;AACjE,OAAO,EACL,IAAI,GAML,MAAM,6BAA6B,CAAC;AAErC,qEAAqE;AACrE,wEAAwE;AACxE,uEAAuE;AACvE,oEAAoE;AACpE,yDAAyD;AACzD,wEAAwE;AACxE,gDAAgD;AAChD,wEAAwE;AACxE,gEAAgE;AAEhE,wEAAwE;AACxE,wEAAwE;AACxE,uDAAuD;AAEvD,mEAAmE;AACnE,oEAAoE;AACpE,sDAAsD"}
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
* Role: a check is registered exactly when its preconditions exist on
|
|
9
9
|
* THIS agent (wire: always — every run calls the model;
|
|
10
10
|
* compose-invariant: a mount kernel is configured; dangling: at
|
|
11
|
-
* least one tool declared `argumentsFrom
|
|
12
|
-
*
|
|
11
|
+
* least one tool declared `argumentsFrom`, which arms BOTH the
|
|
12
|
+
* compose-seam dangling-reference check and the choice-seam
|
|
13
|
+
* unsupported-argument check off the same declaration).
|
|
14
|
+
* Registration is what makes silence auditable — an unregistered
|
|
15
|
+
* check is honest
|
|
13
16
|
* absence, a registered one that never notes is the wiring rot
|
|
14
17
|
* `assertAlive` exists to name.
|
|
15
18
|
*
|
|
@@ -26,6 +29,14 @@ export type IntegrityPosture = 'observe' | 'dev';
|
|
|
26
29
|
export interface IntegrityChecksPresent {
|
|
27
30
|
readonly wire: boolean;
|
|
28
31
|
readonly composeInvariant: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* At least one tool declared `Tool.argumentsFrom`. ONE FLAG, TWO CHECKS
|
|
34
|
+
* (9.63.0): the same declaration arms `dangling-reference` at the compose
|
|
35
|
+
* seam and `unsupported-argument` at the choice seam — one asks whether the
|
|
36
|
+
* ground is still in reach while the tool is offered, the other whether the
|
|
37
|
+
* value the model chose came from that ground when it was called. They are
|
|
38
|
+
* not separated here because nothing can arm one without arming the other.
|
|
39
|
+
*/
|
|
29
40
|
readonly dangling: boolean;
|
|
30
41
|
/** A `.claims()` contract is declared (9.61.0). */
|
|
31
42
|
readonly claim?: boolean;
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
* Role: a check is registered exactly when its preconditions exist on
|
|
9
9
|
* THIS agent (wire: always — every run calls the model;
|
|
10
10
|
* compose-invariant: a mount kernel is configured; dangling: at
|
|
11
|
-
* least one tool declared `argumentsFrom
|
|
12
|
-
*
|
|
11
|
+
* least one tool declared `argumentsFrom`, which arms BOTH the
|
|
12
|
+
* compose-seam dangling-reference check and the choice-seam
|
|
13
|
+
* unsupported-argument check off the same declaration).
|
|
14
|
+
* Registration is what makes silence auditable — an unregistered
|
|
15
|
+
* check is honest
|
|
13
16
|
* absence, a registered one that never notes is the wiring rot
|
|
14
17
|
* `assertAlive` exists to name.
|
|
15
18
|
*
|
|
@@ -24,6 +27,7 @@ import { dispositionLedger } from './ledger.js';
|
|
|
24
27
|
import { invariantViolationsOf } from '../invariant-violation/check.js';
|
|
25
28
|
import { wireViolationsOf } from '../invariant-violation/wire.js';
|
|
26
29
|
import { danglingReferencesOf } from '../dangling-reference/check.js';
|
|
30
|
+
import { unsupportedArgumentsOf } from '../unsupported-argument/check.js';
|
|
27
31
|
import { unsupportedClaimsOf } from '../unsupported-claim/check.js';
|
|
28
32
|
/**
|
|
29
33
|
* Start one run's ledger: register the present checks and, in dev posture,
|
|
@@ -47,8 +51,9 @@ export function beginIntegrityRun(present, posture) {
|
|
|
47
51
|
//
|
|
48
52
|
// Per check, deliberately, rather than one all-or-nothing block for the
|
|
49
53
|
// case where the app armed none of them. The common shape in the field is
|
|
50
|
-
// PARTIAL: a consumer declares `argumentsFrom`, arms
|
|
51
|
-
// learns that the
|
|
54
|
+
// PARTIAL: a consumer declares `argumentsFrom`, arms the two checks that
|
|
55
|
+
// field carries, and never learns that the rest never ran. An
|
|
56
|
+
// all-or-nothing block goes quiet
|
|
52
57
|
// the moment one check is armed, which is precisely when the remaining
|
|
53
58
|
// blind spots start to matter.
|
|
54
59
|
//
|
|
@@ -66,13 +71,14 @@ export function beginIntegrityRun(present, posture) {
|
|
|
66
71
|
};
|
|
67
72
|
armed('invariant-violation', 'compose', present.composeInvariant === true);
|
|
68
73
|
armed('dangling-reference', 'compose', present.dangling === true);
|
|
74
|
+
armed('unsupported-argument', 'choice', present.dangling === true);
|
|
69
75
|
armed('unsupported-claim', 'claim', present.claim === true);
|
|
70
76
|
if (posture !== 'dev')
|
|
71
77
|
return ledger;
|
|
72
78
|
// The canaries — one known-bad fixture per REGISTERED check, through the
|
|
73
79
|
// REAL pure function. Epoch -1 marks them as no run iteration's business.
|
|
74
80
|
//
|
|
75
|
-
// Registered, note, and no longer only armed. The
|
|
81
|
+
// Registered, note, and no longer only armed. The four optional checks now
|
|
76
82
|
// file a row whether or not this run had a subject for them, and a
|
|
77
83
|
// `not-applicable` row with no canary beside it is the exact ambiguity this
|
|
78
84
|
// whole change set exists to remove: a checker that has ROTTED and a checker
|
|
@@ -104,6 +110,22 @@ export function beginIntegrityRun(present, posture) {
|
|
|
104
110
|
if (caught.length > 0)
|
|
105
111
|
ledger.noteSynthetic('dangling-reference', 'compose', 'caught');
|
|
106
112
|
}
|
|
113
|
+
{
|
|
114
|
+
// The choice-seam canary: an ARMED call carrying a value the corpus does
|
|
115
|
+
// not contain. The fixture's corpus deliberately says nothing that could
|
|
116
|
+
// match, so a check that still finds nothing is a check that cannot fire.
|
|
117
|
+
ledger.noteSynthetic('unsupported-argument', 'choice', 'minted');
|
|
118
|
+
const caught = unsupportedArgumentsOf([
|
|
119
|
+
{
|
|
120
|
+
toolName: 'canary_tool',
|
|
121
|
+
toolCallId: 'canary',
|
|
122
|
+
args: { id: 'canary-fabricated-id' },
|
|
123
|
+
argumentsFrom: ['canary_ground'],
|
|
124
|
+
},
|
|
125
|
+
], { grounded: ['canary: this frame served no identifiers'], assistant: [] }, -1);
|
|
126
|
+
if (caught.length > 0)
|
|
127
|
+
ledger.noteSynthetic('unsupported-argument', 'choice', 'caught');
|
|
128
|
+
}
|
|
107
129
|
{
|
|
108
130
|
ledger.noteSynthetic('unsupported-claim', 'claim', 'minted');
|
|
109
131
|
const caught = unsupportedClaimsOf([{ answerField: 'canary', entity: 'canary-entity', field: 'canary-field' }], [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../../src/integrity/disposition/lifecycle.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../../src/integrity/disposition/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AAGxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAqBpE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA+B,EAC/B,OAAyB;IAEzB,MAAM,MAAM,GAAG,iBAAiB,EAAE,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;IAC3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F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* unsupported-argument — the model ACTED on a value nothing served, at the
|
|
3
|
+
* CHOICE seam.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over (the calls, the frame they were chosen from);
|
|
6
|
+
* the domain check.
|
|
7
|
+
* Role: the decidable fragment of "did the model bind this reference to
|
|
8
|
+
* something the run actually served?". The measured failure: on the
|
|
9
|
+
* second turn of a triage conversation the window had dropped the
|
|
10
|
+
* user message carrying the true entity id and kept the assistant's
|
|
11
|
+
* own rendered answer. Asked for the status of "that machine", the
|
|
12
|
+
* model resolved the reference out of its OWN prior prose, took a
|
|
13
|
+
* truncated job-name fragment for a machine name, called the lookup
|
|
14
|
+
* tool with it, got an honest "nothing found", and told the person
|
|
15
|
+
* their protected machine had no backup record. Every shipped rail
|
|
16
|
+
* passed honestly — the coverage envelope, the absence envelope and
|
|
17
|
+
* the evidence gate all held, because every value in the answer
|
|
18
|
+
* really WAS grounded. The defect was the REFERENT, bound wrong at
|
|
19
|
+
* the argument, and the argument was the one seam with no check.
|
|
20
|
+
*
|
|
21
|
+
* DECLARED, NEVER INFERRED — the `argumentsFrom` precedent, second use. A
|
|
22
|
+
* tool is this check's subject only because its author said its arguments
|
|
23
|
+
* come from another tool's results; a tool that declares nothing is never
|
|
24
|
+
* examined, which is the whole zero-delta story. One declaration now arms two
|
|
25
|
+
* seams: `dangling-reference` asks whether the ground is still in reach when
|
|
26
|
+
* the tool is OFFERED, this asks whether the value the model chose came from
|
|
27
|
+
* that ground when the tool is CALLED.
|
|
28
|
+
*
|
|
29
|
+
* ASSISTANT TEXT IS NOT GROUND, and that is the entire idea. The system
|
|
30
|
+
* prompt, the user's messages and every tool result are things the RUN put in
|
|
31
|
+
* front of the model. Its own earlier turns are things it wrote. A value whose
|
|
32
|
+
* only source is the model's own rendered prose has been re-derived from a
|
|
33
|
+
* rendering rather than read from evidence, and re-deriving is exactly how a
|
|
34
|
+
* truncated job name becomes a machine name.
|
|
35
|
+
*
|
|
36
|
+
* THE FENCES, stated because they are the check's honesty:
|
|
37
|
+
* - NON-STRINGS ARE NEVER CHECKED. Numbers, booleans and null are not
|
|
38
|
+
* identifier-shaped, and substring-grounding them would accuse every
|
|
39
|
+
* literal the model legitimately computed.
|
|
40
|
+
* - VALUES UNDER FOUR CHARACTERS ARE NEVER CHECKED. Below that, substring
|
|
41
|
+
* matching is noise in both directions — 'up' and 'a1' land inside
|
|
42
|
+
* unrelated words in any corpus.
|
|
43
|
+
* - SERVED ANYWHERE PASSES, case-insensitively. The value need only appear
|
|
44
|
+
* inside SOME served string; see the README's stated leniency.
|
|
45
|
+
* - DECLARED VOCABULARY PASSES. A value the tool's own `inputSchema` lists in
|
|
46
|
+
* an `enum` was served BY THE SCHEMA — the model read it off the tool
|
|
47
|
+
* definition, not out of its own prose.
|
|
48
|
+
* Two states remain, and they file DIFFERENT messages because they call for
|
|
49
|
+
* different fixes: grounded only in the model's own prose (re-fetch the real
|
|
50
|
+
* ground), and grounded nowhere in the window at all (nothing served it).
|
|
51
|
+
*
|
|
52
|
+
* Detection only. Nothing here blocks, rewrites or delays a call.
|
|
53
|
+
*/
|
|
54
|
+
import type { ContextError } from '../finding/types.js';
|
|
55
|
+
/** One tool call the model chose to make, with the arming that makes it checkable. */
|
|
56
|
+
export interface ArgumentChoice {
|
|
57
|
+
readonly toolName: string;
|
|
58
|
+
/** The provider's id for this call — what the witness points a reader at. */
|
|
59
|
+
readonly toolCallId: string;
|
|
60
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
61
|
+
/** `Tool.argumentsFrom` — the tools whose results were meant to ground these arguments. */
|
|
62
|
+
readonly argumentsFrom: readonly string[];
|
|
63
|
+
/**
|
|
64
|
+
* Values the tool's own `inputSchema` declares in an `enum`. Best-effort and
|
|
65
|
+
* FLAT (see {@link declaredEnumValuesOf}): a value declared for one field
|
|
66
|
+
* excuses that value at any field of the same tool. Deliberately lenient on
|
|
67
|
+
* an accusation boundary.
|
|
68
|
+
*/
|
|
69
|
+
readonly declaredEnums?: ReadonlySet<string>;
|
|
70
|
+
}
|
|
71
|
+
/** The frame the model chose from, split by whether it can GROUND anything. */
|
|
72
|
+
export interface ChoiceCorpus {
|
|
73
|
+
/** System prompt, user messages, tool results — everything the RUN served. */
|
|
74
|
+
readonly grounded: readonly string[];
|
|
75
|
+
/** The model's own earlier turns. Never ground: this is what the defect is made of. */
|
|
76
|
+
readonly assistant: readonly string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Best-effort: every string an `enum` array declares anywhere in a tool's
|
|
80
|
+
* `inputSchema`. Flat by design — a per-path map would be more precise, and on
|
|
81
|
+
* an accusation boundary the lenient direction is the safe one. An absent or
|
|
82
|
+
* non-object schema yields an empty set, which simply means no enum fence.
|
|
83
|
+
*/
|
|
84
|
+
export declare function declaredEnumValuesOf(schema: unknown): ReadonlySet<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Check every armed call's identifier-like string arguments against the frame
|
|
87
|
+
* the model chose from.
|
|
88
|
+
*
|
|
89
|
+
* @param calls the ARMED tool calls of one response — a caller filters by
|
|
90
|
+
* `argumentsFrom` before calling; nothing here re-decides who is a subject.
|
|
91
|
+
* @param corpus the exact request this response was assembled from, split into
|
|
92
|
+
* what the run served and what the model itself wrote.
|
|
93
|
+
* @param epoch the run iteration, stamped on every witness.
|
|
94
|
+
*/
|
|
95
|
+
export declare function unsupportedArgumentsOf(calls: readonly ArgumentChoice[], corpus: ChoiceCorpus, epoch: number): readonly ContextError[];
|