agentfootprint 11.2.0 → 11.3.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/AGENTS.md +1 -1
- package/CAPABILITIES.md +2 -0
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/identity/verify/claims.js +3 -3
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js +3 -2
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +6 -5
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +8 -6
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +1 -1
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/evidence/evidenceIndex.js +30 -2
- package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/core/agent/evidence/extract.js +34 -5
- package/dist/core/agent/evidence/extract.js.map +1 -1
- package/dist/core/agent/evidence/figures.js +31 -3
- package/dist/core/agent/evidence/figures.js.map +1 -1
- package/dist/core/agent/evidence/numberPrecision.js +58 -2
- package/dist/core/agent/evidence/numberPrecision.js.map +1 -1
- package/dist/core/agent/stages/route.js +2 -1
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +14 -1
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +1 -1
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/adapters/identity/jwks.d.ts +2 -2
- package/dist/esm/adapters/identity/verify/claims.d.ts +3 -3
- package/dist/esm/adapters/identity/verify/claims.js +3 -3
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +3 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +3 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +6 -5
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +6 -5
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.d.ts +3 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +9 -7
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.js +1 -1
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +12 -2
- package/dist/esm/core/agent/evidence/evidenceIndex.js +30 -2
- package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/esm/core/agent/evidence/extract.js +35 -6
- package/dist/esm/core/agent/evidence/extract.js.map +1 -1
- package/dist/esm/core/agent/evidence/figures.d.ts +6 -0
- package/dist/esm/core/agent/evidence/figures.js +32 -4
- package/dist/esm/core/agent/evidence/figures.js.map +1 -1
- package/dist/esm/core/agent/evidence/numberPrecision.d.ts +28 -1
- package/dist/esm/core/agent/evidence/numberPrecision.js +56 -1
- package/dist/esm/core/agent/evidence/numberPrecision.js.map +1 -1
- package/dist/esm/core/agent/stages/route.js +2 -1
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.js +14 -1
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +185 -0
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/hosting/doorGuard.d.ts +3 -3
- package/dist/esm/hosting/doorGuard.js +2 -2
- package/dist/esm/hosting/nodeHost.d.ts +1 -1
- package/dist/esm/mcp/callLifetime.d.ts +49 -0
- package/dist/esm/mcp/callLifetime.js +99 -0
- package/dist/esm/mcp/callLifetime.js.map +1 -0
- package/dist/esm/mcp/mcpClient.d.ts +4 -1
- package/dist/esm/mcp/mcpClient.js +70 -28
- package/dist/esm/mcp/mcpClient.js.map +1 -1
- package/dist/esm/mcp/requestLedger.d.ts +97 -0
- package/dist/esm/mcp/requestLedger.js +192 -0
- package/dist/esm/mcp/requestLedger.js.map +1 -0
- package/dist/esm/mcp/seriesEvidence.d.ts +102 -0
- package/dist/esm/mcp/seriesEvidence.js +246 -0
- package/dist/esm/mcp/seriesEvidence.js.map +1 -0
- package/dist/esm/mcp/throttleRetry.d.ts +70 -35
- package/dist/esm/mcp/throttleRetry.js +181 -54
- package/dist/esm/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/mcp/types.d.ts +12 -7
- package/dist/esm/redaction/knownStrings.js +29 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/security/PermissionPolicy.d.ts +1 -1
- package/dist/esm/security/PermissionPolicy.js +1 -1
- package/dist/esm/strategies/defaults/chatBubbleLiveStatus.d.ts +1 -1
- package/dist/esm/strategies/defaults/chatBubbleLiveStatus.js +1 -1
- package/dist/esm/tool-lint/analyze.d.ts +1 -1
- package/dist/esm/tool-lint/analyze.js +1 -1
- package/dist/esm/tool-lint/rules.d.ts +3 -3
- package/dist/esm/tool-lint/rules.js +3 -3
- package/dist/esm/tools/requestEvidence.d.ts +78 -0
- package/dist/esm/tools/requestEvidence.js +331 -0
- package/dist/esm/tools/requestEvidence.js.map +1 -0
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/doorGuard.js +2 -2
- package/dist/mcp/callLifetime.js +103 -0
- package/dist/mcp/callLifetime.js.map +1 -0
- package/dist/mcp/mcpClient.js +69 -27
- package/dist/mcp/mcpClient.js.map +1 -1
- package/dist/mcp/requestLedger.js +196 -0
- package/dist/mcp/requestLedger.js.map +1 -0
- package/dist/mcp/seriesEvidence.js +251 -0
- package/dist/mcp/seriesEvidence.js.map +1 -0
- package/dist/mcp/throttleRetry.js +184 -55
- package/dist/mcp/throttleRetry.js.map +1 -1
- package/dist/redaction/knownStrings.js +29 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/security/PermissionPolicy.js +1 -1
- package/dist/strategies/defaults/chatBubbleLiveStatus.js +1 -1
- package/dist/tool-lint/analyze.js +1 -1
- package/dist/tool-lint/rules.js +3 -3
- package/dist/tools/requestEvidence.js +337 -0
- package/dist/tools/requestEvidence.js.map +1 -0
- package/dist/types/adapters/identity/jwks.d.ts +2 -2
- package/dist/types/adapters/identity/verify/claims.d.ts +3 -3
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +3 -2
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +6 -5
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts +3 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts +12 -2
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/extract.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/figures.d.ts +6 -0
- package/dist/types/core/agent/evidence/figures.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/numberPrecision.d.ts +28 -1
- package/dist/types/core/agent/evidence/numberPrecision.d.ts.map +1 -1
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +185 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/hosting/doorGuard.d.ts +3 -3
- package/dist/types/hosting/nodeHost.d.ts +1 -1
- package/dist/types/mcp/callLifetime.d.ts +50 -0
- package/dist/types/mcp/callLifetime.d.ts.map +1 -0
- package/dist/types/mcp/mcpClient.d.ts +4 -1
- package/dist/types/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/mcp/requestLedger.d.ts +98 -0
- package/dist/types/mcp/requestLedger.d.ts.map +1 -0
- package/dist/types/mcp/seriesEvidence.d.ts +103 -0
- package/dist/types/mcp/seriesEvidence.d.ts.map +1 -0
- package/dist/types/mcp/throttleRetry.d.ts +70 -35
- package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/mcp/types.d.ts +12 -7
- package/dist/types/mcp/types.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/security/PermissionPolicy.d.ts +1 -1
- package/dist/types/strategies/defaults/chatBubbleLiveStatus.d.ts +1 -1
- package/dist/types/tool-lint/analyze.d.ts +1 -1
- package/dist/types/tool-lint/rules.d.ts +3 -3
- package/dist/types/tools/requestEvidence.d.ts +79 -0
- package/dist/types/tools/requestEvidence.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* requestEvidence — the door a tool call's REQUEST attempts enter its run by.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: a per-dispatch port (the `LLMCallHooks` precedent) + one allow-list.
|
|
5
|
+
* Role: The seam between a retry series that runs BELOW a tool — inside
|
|
6
|
+
* `mcpClient`'s transport, built before any run existed — and the run
|
|
7
|
+
* that dispatched the call. The dispatcher builds the port for each
|
|
8
|
+
* call (`requestEvidenceFor`) and puts it on the call's context under
|
|
9
|
+
* an internal symbol; the MCP tool hands it down to the series that
|
|
10
|
+
* sends its request (`mcp/requestLedger.ts`); the series files ONE
|
|
11
|
+
* record when the request ends. Nothing here retries anything.
|
|
12
|
+
* Emits: agentfootprint.tools.request_attempts
|
|
13
|
+
*
|
|
14
|
+
* Why a port and not a scope: a decorator constructed by the consumer before
|
|
15
|
+
* any run exists can never reach a scope (`resilienceHooks` says the same of
|
|
16
|
+
* the provider decorators). The call is the one thing both sides share, so the
|
|
17
|
+
* port rides the call — and the identity on the event (`toolCallId`,
|
|
18
|
+
* `toolName`, `iteration`, the run's ids in the meta) is stamped HERE, from the
|
|
19
|
+
* dispatch, never by whatever files: a filing cannot claim another call.
|
|
20
|
+
*
|
|
21
|
+
* Why an internal symbol and not a public `ctx` field: this is the evidence
|
|
22
|
+
* path for the library's own retry series, not a retry API. A public member
|
|
23
|
+
* would invite every tool to file attempts the library cannot vouch for. The
|
|
24
|
+
* symbol is enumerable, so a wrapper that copies the context (`{ ...ctx }`)
|
|
25
|
+
* keeps it; a filing from anyone else still passes the allow-list below.
|
|
26
|
+
*
|
|
27
|
+
* The port only FILES. What cancels a call is the call's own context signal
|
|
28
|
+
* (`ctx.signal`), read by the MCP tool whether or not a port rides along — a
|
|
29
|
+
* cancellation must never depend on evidence being attributable.
|
|
30
|
+
*
|
|
31
|
+
* THE ALLOW-LIST is the whole record: numbers, the library's own words, the
|
|
32
|
+
* endpoint label the app declared or else the endpoint's ORIGIN. A filing with
|
|
33
|
+
* anything else in it — a field nobody listed, a word outside its set, a URL
|
|
34
|
+
* with a path, an array that is not a plain one — is refused whole, never
|
|
35
|
+
* trimmed into something it did not say. Values are read as DATA, through own
|
|
36
|
+
* property descriptors, so no getter, `toJSON` or array subclass a filing
|
|
37
|
+
* carries ever runs or reaches the record.
|
|
38
|
+
*/
|
|
39
|
+
import { isDevMode } from 'footprintjs';
|
|
40
|
+
import { typedEmit } from '../recorders/core/typedEmit.js';
|
|
41
|
+
/** At most this many attempts are listed per request; the rest are counted (`omitted`). */
|
|
42
|
+
export const MAX_REQUEST_ATTEMPT_ROWS = 100;
|
|
43
|
+
/** @internal The context key the dispatcher puts a call's sink under. */
|
|
44
|
+
export const REQUEST_EVIDENCE = Symbol('agentfootprint.request-evidence');
|
|
45
|
+
/**
|
|
46
|
+
* The port for one dispatch: files `agentfootprint.tools.request_attempts`
|
|
47
|
+
* mid-stage through `typedEmit` (so the run's redaction rule serves it, and the
|
|
48
|
+
* meta carries the real `runtimeStageId`), stamped with `call`.
|
|
49
|
+
*/
|
|
50
|
+
export function requestEvidenceFor(scope, call) {
|
|
51
|
+
const sink = {
|
|
52
|
+
file: (evidence) => {
|
|
53
|
+
const served = servedRequestEvidence(evidence);
|
|
54
|
+
if (served === undefined) {
|
|
55
|
+
warnOnce(call.toolName, 'a filing outside the allow-list was refused');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
typedEmit(scope, 'agentfootprint.tools.request_attempts', {
|
|
60
|
+
toolCallId: call.toolCallId,
|
|
61
|
+
toolName: call.toolName,
|
|
62
|
+
iteration: call.iteration,
|
|
63
|
+
...served,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
// Evidence is not the work: a sink that dies must not fail the call.
|
|
68
|
+
warnOnce(call.toolName, err instanceof Error ? err.message : String(err));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
return { [REQUEST_EVIDENCE]: sink };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The sink a call's context carries, or `undefined` — a context from a door with
|
|
76
|
+
* no run (`mcpServe`, a direct `execute`), or one a wrapper rebuilt without it.
|
|
77
|
+
* Never throws, whatever `ctx` is.
|
|
78
|
+
*/
|
|
79
|
+
export function requestEvidenceOf(ctx) {
|
|
80
|
+
if (ctx === null || typeof ctx !== 'object')
|
|
81
|
+
return undefined;
|
|
82
|
+
let port;
|
|
83
|
+
try {
|
|
84
|
+
port = ctx[REQUEST_EVIDENCE];
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
if (port === null || typeof port !== 'object')
|
|
90
|
+
return undefined;
|
|
91
|
+
let file;
|
|
92
|
+
try {
|
|
93
|
+
file = port.file;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (typeof file !== 'function')
|
|
99
|
+
return undefined;
|
|
100
|
+
return port;
|
|
101
|
+
}
|
|
102
|
+
const ATTEMPT_OUTCOMES = {
|
|
103
|
+
answered: true,
|
|
104
|
+
refused: true,
|
|
105
|
+
failed: true,
|
|
106
|
+
'timed-out': true,
|
|
107
|
+
cut: true,
|
|
108
|
+
};
|
|
109
|
+
/** An end may also be `cancelled`: no request was in flight. A row never is — a sent request is `cut`. */
|
|
110
|
+
const END_OUTCOMES = { ...ATTEMPT_OUTCOMES, cancelled: true };
|
|
111
|
+
const REMOTE = { unknown: true };
|
|
112
|
+
const REASONS = {
|
|
113
|
+
retryable: true,
|
|
114
|
+
answered: true,
|
|
115
|
+
exhausted: true,
|
|
116
|
+
'wait-limit': true,
|
|
117
|
+
'no-time-left': true,
|
|
118
|
+
'not-replayable': true,
|
|
119
|
+
'not-retryable': true,
|
|
120
|
+
cancelled: true,
|
|
121
|
+
};
|
|
122
|
+
const KINDS = {
|
|
123
|
+
throttle: true,
|
|
124
|
+
'session-busy': true,
|
|
125
|
+
};
|
|
126
|
+
const CATEGORIES = {
|
|
127
|
+
timeout: true,
|
|
128
|
+
'rate-limited': true,
|
|
129
|
+
server: true,
|
|
130
|
+
network: true,
|
|
131
|
+
auth: true,
|
|
132
|
+
permanent: true,
|
|
133
|
+
unknown: true,
|
|
134
|
+
};
|
|
135
|
+
const SENTENCES = {
|
|
136
|
+
'The request failed before an answer arrived. Its error is not kept.': true,
|
|
137
|
+
'The call ran out of time before an answer arrived.': true,
|
|
138
|
+
};
|
|
139
|
+
const DURING = { request: true, wait: true };
|
|
140
|
+
const ATTEMPT_FIELDS = new Set([
|
|
141
|
+
'attempt',
|
|
142
|
+
'outcome',
|
|
143
|
+
'reason',
|
|
144
|
+
'status',
|
|
145
|
+
'kind',
|
|
146
|
+
'failure',
|
|
147
|
+
'waitMs',
|
|
148
|
+
'retryAfterMs',
|
|
149
|
+
'error',
|
|
150
|
+
'remote',
|
|
151
|
+
]);
|
|
152
|
+
const END_FIELDS = new Set([
|
|
153
|
+
'outcome',
|
|
154
|
+
'reason',
|
|
155
|
+
'status',
|
|
156
|
+
'kind',
|
|
157
|
+
'failure',
|
|
158
|
+
'during',
|
|
159
|
+
'error',
|
|
160
|
+
'remote',
|
|
161
|
+
]);
|
|
162
|
+
const EVIDENCE_FIELDS = new Set(['endpoint', 'origin', 'attempts', 'omitted', 'end']);
|
|
163
|
+
/** Thrown inside the walk when a filing leaves the allow-list; caught at its root. */
|
|
164
|
+
class Refused extends Error {
|
|
165
|
+
name = 'Refused';
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* `raw` rebuilt from allow-listed fields — a fresh plain object — or
|
|
169
|
+
* `undefined` when anything in it is outside the list.
|
|
170
|
+
*/
|
|
171
|
+
export function servedRequestEvidence(raw) {
|
|
172
|
+
try {
|
|
173
|
+
const evidence = record(raw, EVIDENCE_FIELDS);
|
|
174
|
+
const { endpoint, origin } = evidence;
|
|
175
|
+
if (endpoint !== undefined && origin !== undefined)
|
|
176
|
+
throw new Refused();
|
|
177
|
+
return {
|
|
178
|
+
...(endpoint !== undefined && { endpoint: label(endpoint) }),
|
|
179
|
+
...(origin !== undefined && { origin: originOnly(origin) }),
|
|
180
|
+
attempts: plainArray(evidence.attempts, MAX_REQUEST_ATTEMPT_ROWS).map(servedAttempt),
|
|
181
|
+
omitted: count(evidence.omitted),
|
|
182
|
+
end: servedEnd(evidence.end),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// `Refused`, or anything a hostile value threw while it was read: this door
|
|
187
|
+
// never throws, whatever it is handed.
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function servedAttempt(raw) {
|
|
192
|
+
const row = record(raw, ATTEMPT_FIELDS);
|
|
193
|
+
const attempt = count(row.attempt);
|
|
194
|
+
if (attempt < 1)
|
|
195
|
+
throw new Refused();
|
|
196
|
+
return {
|
|
197
|
+
attempt,
|
|
198
|
+
outcome: word(ATTEMPT_OUTCOMES, row.outcome),
|
|
199
|
+
reason: word(REASONS, row.reason),
|
|
200
|
+
...(row.status !== undefined && { status: status(row.status) }),
|
|
201
|
+
...(row.kind !== undefined && { kind: word(KINDS, row.kind) }),
|
|
202
|
+
...(row.failure !== undefined && { failure: word(CATEGORIES, row.failure) }),
|
|
203
|
+
...(row.waitMs !== undefined && { waitMs: duration(row.waitMs) }),
|
|
204
|
+
...(row.retryAfterMs !== undefined && { retryAfterMs: duration(row.retryAfterMs) }),
|
|
205
|
+
...(row.error !== undefined && { error: servedError(row.error) }),
|
|
206
|
+
...(row.remote !== undefined && { remote: word(REMOTE, row.remote) }),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function servedEnd(raw) {
|
|
210
|
+
const end = record(raw, END_FIELDS);
|
|
211
|
+
return {
|
|
212
|
+
outcome: word(END_OUTCOMES, end.outcome),
|
|
213
|
+
reason: word(REASONS, end.reason),
|
|
214
|
+
...(end.status !== undefined && { status: status(end.status) }),
|
|
215
|
+
...(end.kind !== undefined && { kind: word(KINDS, end.kind) }),
|
|
216
|
+
...(end.failure !== undefined && { failure: word(CATEGORIES, end.failure) }),
|
|
217
|
+
...(end.during !== undefined && { during: word(DURING, end.during) }),
|
|
218
|
+
...(end.error !== undefined && { error: servedError(end.error) }),
|
|
219
|
+
...(end.remote !== undefined && { remote: word(REMOTE, end.remote) }),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function servedError(raw) {
|
|
223
|
+
const error = record(raw, new Set(['message', 'code']));
|
|
224
|
+
return { message: word(SENTENCES, error.message), code: word(CATEGORIES, error.code) };
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* A PLAIN array's elements, copied by index into a fresh array: its prototype
|
|
228
|
+
* exactly `Array.prototype` (no subclass, so no `toJSON` or species of its own),
|
|
229
|
+
* every index from 0 to `length - 1` an own data property (no hole, no getter),
|
|
230
|
+
* and no other own key — a property riding on the array is refused, not
|
|
231
|
+
* dropped. At most `max` elements.
|
|
232
|
+
*/
|
|
233
|
+
function plainArray(raw, max) {
|
|
234
|
+
if (!Array.isArray(raw) || Object.getPrototypeOf(raw) !== Array.prototype)
|
|
235
|
+
throw new Refused();
|
|
236
|
+
const length = Object.getOwnPropertyDescriptor(raw, 'length')?.value;
|
|
237
|
+
if (typeof length !== 'number' || !Number.isSafeInteger(length) || length > max) {
|
|
238
|
+
throw new Refused();
|
|
239
|
+
}
|
|
240
|
+
const keys = Reflect.ownKeys(raw);
|
|
241
|
+
if (keys.length !== length + 1)
|
|
242
|
+
throw new Refused();
|
|
243
|
+
const out = [];
|
|
244
|
+
for (let i = 0; i < length; i++) {
|
|
245
|
+
const descriptor = Object.getOwnPropertyDescriptor(raw, String(i));
|
|
246
|
+
if (descriptor === undefined || !('value' in descriptor))
|
|
247
|
+
throw new Refused();
|
|
248
|
+
out.push(descriptor.value);
|
|
249
|
+
}
|
|
250
|
+
return out;
|
|
251
|
+
}
|
|
252
|
+
/** A plain object whose every own key is listed; read once, by key. */
|
|
253
|
+
function record(raw, fields) {
|
|
254
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
|
|
255
|
+
throw new Refused();
|
|
256
|
+
const proto = Object.getPrototypeOf(raw);
|
|
257
|
+
if (proto !== Object.prototype && proto !== null)
|
|
258
|
+
throw new Refused();
|
|
259
|
+
const out = {};
|
|
260
|
+
for (const key of Reflect.ownKeys(raw)) {
|
|
261
|
+
if (typeof key !== 'string' || !fields.has(key))
|
|
262
|
+
throw new Refused();
|
|
263
|
+
const descriptor = Object.getOwnPropertyDescriptor(raw, key);
|
|
264
|
+
if (descriptor === undefined || !('value' in descriptor))
|
|
265
|
+
throw new Refused();
|
|
266
|
+
out[key] = descriptor.value;
|
|
267
|
+
}
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
function word(words, value) {
|
|
271
|
+
if (typeof value === 'string' && Object.prototype.hasOwnProperty.call(words, value)) {
|
|
272
|
+
return value;
|
|
273
|
+
}
|
|
274
|
+
throw new Refused();
|
|
275
|
+
}
|
|
276
|
+
/** A whole number ≥ 0. */
|
|
277
|
+
function count(value) {
|
|
278
|
+
if (typeof value === 'number' && Number.isSafeInteger(value) && value >= 0)
|
|
279
|
+
return value;
|
|
280
|
+
throw new Refused();
|
|
281
|
+
}
|
|
282
|
+
/** An HTTP status. */
|
|
283
|
+
function status(value) {
|
|
284
|
+
if (typeof value === 'number' && Number.isInteger(value) && value >= 100 && value <= 599) {
|
|
285
|
+
return value;
|
|
286
|
+
}
|
|
287
|
+
throw new Refused();
|
|
288
|
+
}
|
|
289
|
+
/** A finite length of time in ms, ≥ 0. */
|
|
290
|
+
function duration(value) {
|
|
291
|
+
if (typeof value === 'number' && Number.isFinite(value) && value >= 0)
|
|
292
|
+
return value;
|
|
293
|
+
throw new Refused();
|
|
294
|
+
}
|
|
295
|
+
/** An app-declared label: 1–128 characters, none of them control characters. */
|
|
296
|
+
function label(value) {
|
|
297
|
+
if (typeof value !== 'string' || value.length < 1 || value.length > 128)
|
|
298
|
+
throw new Refused();
|
|
299
|
+
for (let i = 0; i < value.length; i++) {
|
|
300
|
+
const code = value.charCodeAt(i);
|
|
301
|
+
if (code < 0x20 || (code >= 0x7f && code <= 0x9f))
|
|
302
|
+
throw new Refused();
|
|
303
|
+
}
|
|
304
|
+
return value;
|
|
305
|
+
}
|
|
306
|
+
/** An origin and nothing more: what `new URL(it)` reads back as scheme, host and port. */
|
|
307
|
+
function originOnly(value) {
|
|
308
|
+
if (typeof value !== 'string' || value.length > 2048)
|
|
309
|
+
throw new Refused();
|
|
310
|
+
let url;
|
|
311
|
+
try {
|
|
312
|
+
url = new URL(value);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
throw new Refused();
|
|
316
|
+
}
|
|
317
|
+
if (url.host === '' || `${url.protocol}//${url.host}` !== value)
|
|
318
|
+
throw new Refused();
|
|
319
|
+
return value;
|
|
320
|
+
}
|
|
321
|
+
const warned = new Set();
|
|
322
|
+
/** Named in dev mode, once per tool — evidence is telemetry, never the call's failure. */
|
|
323
|
+
function warnOnce(toolName, why) {
|
|
324
|
+
if (!isDevMode() || warned.has(toolName))
|
|
325
|
+
return;
|
|
326
|
+
warned.add(toolName);
|
|
327
|
+
// eslint-disable-next-line no-console
|
|
328
|
+
console.warn(`[agentfootprint] tool '${toolName}': its request attempts were not recorded (${why}). ` +
|
|
329
|
+
'The call itself is unaffected.');
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=requestEvidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestEvidence.js","sourceRoot":"","sources":["../../../src/tools/requestEvidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQxC,OAAO,EAAE,SAAS,EAAsB,MAAM,gCAAgC,CAAC;AAE/E,2FAA2F;AAC3F,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAc5C,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAczF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAoB,EACpB,IAAyB;IAEzB,MAAM,IAAI,GAAwB;QAChC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;YACjB,MAAM,MAAM,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,6CAA6C,CAAC,CAAC;gBACvE,OAAO;YACT,CAAC;YACD,IAAI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GAAG,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,OAAO,EAAE,CAAC;IACtB,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,IAAI,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK;QAAE,MAAM,IAAI,OAAO,EAAE,CAAC;IACrF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC,0FAA0F;AAC1F,SAAS,QAAQ,CAAC,QAAgB,EAAE,GAAW;IAC7C,IAAI,CAAC,SAAS,EAAE,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO;IACjD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrB,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,0BAA0B,QAAQ,8CAA8C,GAAG,KAAK;QACtF,gCAAgC,CACnC,CAAC;AACJ,CAAC"}
|
package/dist/events/registry.js
CHANGED
|
@@ -94,6 +94,7 @@ exports.EVENT_NAMES = {
|
|
|
94
94
|
coverageDeclared: 'agentfootprint.tools.coverage_declared',
|
|
95
95
|
semanticsDeclared: 'agentfootprint.tools.semantics_declared',
|
|
96
96
|
codeRun: 'agentfootprint.tools.code_run',
|
|
97
|
+
requestAttempts: 'agentfootprint.tools.request_attempts',
|
|
97
98
|
},
|
|
98
99
|
skill: {
|
|
99
100
|
activated: 'agentfootprint.skill.activated',
|
|
@@ -269,6 +270,7 @@ exports.ALL_EVENT_TYPES = [
|
|
|
269
270
|
'agentfootprint.tools.repeated_call',
|
|
270
271
|
'agentfootprint.tools.absent',
|
|
271
272
|
'agentfootprint.tools.code_run',
|
|
273
|
+
'agentfootprint.tools.request_attempts',
|
|
272
274
|
'agentfootprint.tools.coverage_declared',
|
|
273
275
|
'agentfootprint.tools.semantics_declared',
|
|
274
276
|
'agentfootprint.validation.args_invalid',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/events/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/events/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAoIH,yEAAyE;AACzE,gEAAgE;AAChE,wEAAwE;AAC3D,QAAA,WAAW,GAAG;IACzB,WAAW,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,IAAI,EAAE,iCAAiC;QACvC,SAAS,EAAE,uCAAuC;QAClD,cAAc,EAAE,4CAA4C;QAC5D,QAAQ,EAAE,sCAAsC;QAChD,YAAY,EAAE,0CAA0C;QACxD,cAAc,EAAE,4CAA4C;QAC5D,aAAa,EAAE,2CAA2C;KAC3D;IACD,KAAK,EAAE;QACL,SAAS,EAAE,iCAAiC;QAC5C,OAAO,EAAE,+BAA+B;QACxC,cAAc,EAAE,sCAAsC;QACtD,YAAY,EAAE,oCAAoC;QAClD,YAAY,EAAE,oCAAoC;QAClD,OAAO,EAAE,8BAA8B;QACvC,4BAA4B,EAAE,sDAAsD;QACpF,iBAAiB,EAAE,0CAA0C;QAC7D,mBAAmB,EAAE,4CAA4C;QACjE,eAAe,EAAE,uCAAuC;QACxD,eAAe,EAAE,uCAAuC;QACxD,aAAa,EAAE,qCAAqC;QACpD,mBAAmB,EAAE,4CAA4C;QACjE,eAAe,EAAE,uCAAuC;QACxD,eAAe,EAAE,uCAAuC;KACzD;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,iCAAiC;QAC3C,MAAM,EAAE,+BAA+B;QACvC,KAAK,EAAE,6BAA6B;QACpC,SAAS,EAAE,kCAAkC;QAC7C,YAAY,EAAE,qCAAqC;QACnD,OAAO,EAAE,gCAAgC;QACzC,aAAa,EAAE,sCAAsC;QACrD,WAAW,EAAE,oCAAoC;KAClD;I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CAAiC;IACjC,mCAAmC;IACnC,kCAAkC;IAClC,kCAAkC;IAClC,oCAAoC;IACpC,2CAA2C;IAC3C,4BAA4B;IAC5B,2BAA2B;IAC3B,wCAAwC;IACxC,sCAAsC;IACtC,+CAA+C;CACvC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* hosting/doorGuard — what a request has to be before any handler sees it.
|
|
4
4
|
*
|
|
5
|
-
* const guard = doorGuard({ name: 'auth', allowedHosts: ['
|
|
5
|
+
* const guard = doorGuard({ name: 'auth', allowedHosts: ['bot.corp.example'] });
|
|
6
6
|
* const refusal = guard.check(req); // an IncomingMessage works as-is
|
|
7
7
|
* if (refusal) return answer(refusal.status, refusal.message, refusal.code);
|
|
8
8
|
*
|
|
@@ -205,7 +205,7 @@ exports.checkSessionId = checkSessionId;
|
|
|
205
205
|
* - **A reverse proxy on the same machine that forwards the PUBLIC name** in
|
|
206
206
|
* `Host` (nginx `proxy_set_header Host $host`) — the common case, and the
|
|
207
207
|
* recommended "bind 127.0.0.1 behind nginx" setup. The proxy's requests
|
|
208
|
-
* arrive on loopback carrying `
|
|
208
|
+
* arrive on loopback carrying `bot.corp.example`, which the socket cannot
|
|
209
209
|
* tell from a rebinding page. List that name in `allowedHosts`; the 421
|
|
210
210
|
* says so, naming this default (`HostNotAllowedError` · `rule`).
|
|
211
211
|
* - A hosts-file alias for a loopback address — the same fix.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* callLifetime — one MCP tool call, from the moment it is sent until it settles:
|
|
4
|
+
* what cancels it while it runs, and what its settling stops.
|
|
5
|
+
*
|
|
6
|
+
* Pattern: open / close around `callTool` (`mcpClient.ts` · `wrapMcpTool`).
|
|
7
|
+
* Role: The call's side of the evidence seam (`requestLedger.ts` is the
|
|
8
|
+
* transport's). Three things are true of a call while it runs, and
|
|
9
|
+
* none of them may outlive it:
|
|
10
|
+
*
|
|
11
|
+
* 1. ITS CANCELLATION reaches the SDK. The call's context signal (the run's,
|
|
12
|
+
* for a call the agent dispatched) and the client's own `signal` are linked
|
|
13
|
+
* into one signal the SDK request is given — so a cancelled run makes the
|
|
14
|
+
* SDK reject the call, drop its response handler and send the server
|
|
15
|
+
* `notifications/cancelled`, whether or not the request could be matched to
|
|
16
|
+
* the call. The link is undone when the call settles: the SDK keeps its
|
|
17
|
+
* abort listener on the signal it was given, and a link that outlived the
|
|
18
|
+
* call would cancel a request that had already finished.
|
|
19
|
+
* 2. ITS TICKET is issued, when the call carries the run's evidence port and
|
|
20
|
+
* the connection has a ledger, keyed by the request's params object.
|
|
21
|
+
* 3. ITS SETTLING ENDS ITS SERIES. However `callTool` settles — answered,
|
|
22
|
+
* failed, or given up by the SDK (its own timeout) — a retry series still
|
|
23
|
+
* sending the request is cut there and then, inside the call: it files
|
|
24
|
+
* `cancelled` before the call's result is read, and sends nothing more.
|
|
25
|
+
*
|
|
26
|
+
* In dev mode, a ticket that no request was bound to by the time the call
|
|
27
|
+
* settled, when a `tools/call` request DID go out, is named once per connection: the SDK copied
|
|
28
|
+
* the params, so the call's attempts could not be matched to it. Its
|
|
29
|
+
* cancellation still reached the request (1, and the ledger's own watch on
|
|
30
|
+
* `notifications/cancelled`).
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.openCall = void 0;
|
|
34
|
+
const footprintjs_1 = require("footprintjs");
|
|
35
|
+
const abort_js_1 = require("../lib/abort.js");
|
|
36
|
+
const requestEvidence_js_1 = require("../tools/requestEvidence.js");
|
|
37
|
+
/**
|
|
38
|
+
* Open one call.
|
|
39
|
+
*
|
|
40
|
+
* @param params the request's params object — the SDK hands this very object to
|
|
41
|
+
* the transport, which is how the ledger knows the request is this call's.
|
|
42
|
+
* @param ctx the call's context: its signal, and the run's evidence port if any.
|
|
43
|
+
* @param clientSignal the client's own `signal` (`McpClientOptions.signal`).
|
|
44
|
+
* @param ledger the connection's ledger, when the library built its transport.
|
|
45
|
+
* @param server the client's name, for the dev-mode note.
|
|
46
|
+
*/
|
|
47
|
+
function openCall(params, ctx, clientSignal, ledger, server) {
|
|
48
|
+
const own = signalOf(ctx);
|
|
49
|
+
const link = own === undefined ? undefined : (0, abort_js_1.linkedController)(own, clientSignal);
|
|
50
|
+
const signal = link?.controller.signal ?? clientSignal;
|
|
51
|
+
const sink = ledger === undefined ? undefined : (0, requestEvidence_js_1.requestEvidenceOf)(ctx);
|
|
52
|
+
const settled = sink === undefined ? undefined : new AbortController();
|
|
53
|
+
const ticket = sink === undefined
|
|
54
|
+
? undefined
|
|
55
|
+
: { sink, signal: (0, abort_js_1.eitherSignal)(signal, settled?.signal) };
|
|
56
|
+
const sentBefore = ledger?.toolCallsSent ?? 0;
|
|
57
|
+
if (ticket !== undefined)
|
|
58
|
+
ledger?.issue(params, ticket);
|
|
59
|
+
return {
|
|
60
|
+
...(signal !== undefined && { signal }),
|
|
61
|
+
close: () => {
|
|
62
|
+
settled?.abort(callSettled());
|
|
63
|
+
link?.unlink();
|
|
64
|
+
if (ticket !== undefined && ledger !== undefined) {
|
|
65
|
+
noteUnbound(ledger, ticket, sentBefore, server);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
exports.openCall = openCall;
|
|
71
|
+
/** The call's own signal, when its context carries a real one. */
|
|
72
|
+
function signalOf(ctx) {
|
|
73
|
+
if (ctx === null || typeof ctx !== 'object' || typeof AbortSignal === 'undefined') {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
let signal;
|
|
77
|
+
try {
|
|
78
|
+
signal = ctx.signal;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return signal instanceof AbortSignal ? signal : undefined;
|
|
84
|
+
}
|
|
85
|
+
/** Why a series is cut when its call settled first — a fixed sentence. */
|
|
86
|
+
function callSettled() {
|
|
87
|
+
return Object.assign(new Error('The tool call settled before its MCP request series did.'), {
|
|
88
|
+
name: 'AbortError',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** Dev mode, once per connection: a request went out for this call, but the ledger never matched it. */
|
|
92
|
+
function noteUnbound(ledger, ticket, sentBefore, server) {
|
|
93
|
+
if (!(0, footprintjs_1.isDevMode)() || ledger.wasBound(ticket) || ledger.toolCallsSent <= sentBefore)
|
|
94
|
+
return;
|
|
95
|
+
if (!ledger.firstUnbound())
|
|
96
|
+
return;
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.warn(`[agentfootprint] mcpClient[${server}]: a tool call's request could not be matched to ` +
|
|
99
|
+
'the call, so its retry attempts were not recorded in the run. The MCP SDK copied the ' +
|
|
100
|
+
"request's params before sending them. The call itself is unaffected, and its " +
|
|
101
|
+
'cancellation still reached the request.');
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=callLifetime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callLifetime.js","sourceRoot":"","sources":["../../src/mcp/callLifetime.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,6CAAwC;AAExC,8CAAiE;AACjE,oEAAgE;AAWhE;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CACtB,MAAc,EACd,GAAY,EACZ,YAAqC,EACrC,MAAiC,EACjC,MAAc;IAEd,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,2BAAgB,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACjF,MAAM,MAAM,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,IAAI,YAAY,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC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