agenticreplay 0.1.3 → 0.1.5
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/README.md +36 -912
- package/node_modules/@agenticreplay/adapters/dist/claude-code.d.ts.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/claude-code.js +7 -9
- package/node_modules/@agenticreplay/adapters/dist/claude-code.js.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/codex.d.ts.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/codex.js +0 -18
- package/node_modules/@agenticreplay/adapters/dist/codex.js.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/contract.d.ts +1 -1
- package/node_modules/@agenticreplay/adapters/dist/contract.d.ts.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/contract.js +0 -46
- package/node_modules/@agenticreplay/adapters/dist/contract.js.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/indexrag.d.ts.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/indexrag.js +0 -6
- package/node_modules/@agenticreplay/adapters/dist/indexrag.js.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/session.d.ts +2 -0
- package/node_modules/@agenticreplay/adapters/dist/session.d.ts.map +1 -1
- package/node_modules/@agenticreplay/adapters/dist/session.js +7 -1
- package/node_modules/@agenticreplay/adapters/dist/session.js.map +1 -1
- package/node_modules/@agenticreplay/adapters/package.json +6 -6
- package/node_modules/@agenticreplay/core/dist/graph.d.ts +0 -24
- package/node_modules/@agenticreplay/core/dist/graph.d.ts.map +1 -1
- package/node_modules/@agenticreplay/core/dist/graph.js +0 -68
- package/node_modules/@agenticreplay/core/dist/graph.js.map +1 -1
- package/node_modules/@agenticreplay/core/dist/index.d.ts +1 -0
- package/node_modules/@agenticreplay/core/dist/index.d.ts.map +1 -1
- package/node_modules/@agenticreplay/core/dist/index.js +1 -0
- package/node_modules/@agenticreplay/core/dist/index.js.map +1 -1
- package/node_modules/@agenticreplay/core/dist/paths.d.ts +1 -12
- package/node_modules/@agenticreplay/core/dist/paths.d.ts.map +1 -1
- package/node_modules/@agenticreplay/core/dist/paths.js +9 -26
- package/node_modules/@agenticreplay/core/dist/paths.js.map +1 -1
- package/node_modules/@agenticreplay/core/dist/run-names.d.ts +7 -0
- package/node_modules/@agenticreplay/core/dist/run-names.d.ts.map +1 -0
- package/node_modules/@agenticreplay/core/dist/run-names.js +79 -0
- package/node_modules/@agenticreplay/core/dist/run-names.js.map +1 -0
- package/node_modules/@agenticreplay/core/dist/writer.d.ts +5 -9
- package/node_modules/@agenticreplay/core/dist/writer.d.ts.map +1 -1
- package/node_modules/@agenticreplay/core/dist/writer.js +38 -11
- package/node_modules/@agenticreplay/core/dist/writer.js.map +1 -1
- package/node_modules/@agenticreplay/core/package.json +4 -3
- package/node_modules/@agenticreplay/fs-capture/dist/capture.d.ts +4 -15
- package/node_modules/@agenticreplay/fs-capture/dist/capture.d.ts.map +1 -1
- package/node_modules/@agenticreplay/fs-capture/dist/capture.js +22 -33
- package/node_modules/@agenticreplay/fs-capture/dist/capture.js.map +1 -1
- package/node_modules/@agenticreplay/fs-capture/dist/shadow.d.ts +0 -39
- package/node_modules/@agenticreplay/fs-capture/dist/shadow.d.ts.map +1 -1
- package/node_modules/@agenticreplay/fs-capture/dist/shadow.js +0 -63
- package/node_modules/@agenticreplay/fs-capture/dist/shadow.js.map +1 -1
- package/node_modules/@agenticreplay/fs-capture/package.json +2 -2
- package/node_modules/@agenticreplay/mcp-shim/dist/cli.d.ts +0 -2
- package/node_modules/@agenticreplay/mcp-shim/dist/cli.d.ts.map +1 -1
- package/node_modules/@agenticreplay/mcp-shim/dist/cli.js +2 -92
- package/node_modules/@agenticreplay/mcp-shim/dist/cli.js.map +1 -1
- package/node_modules/@agenticreplay/mcp-shim/dist/index.d.ts +0 -1
- package/node_modules/@agenticreplay/mcp-shim/dist/index.d.ts.map +1 -1
- package/node_modules/@agenticreplay/mcp-shim/dist/index.js +0 -1
- package/node_modules/@agenticreplay/mcp-shim/dist/index.js.map +1 -1
- package/node_modules/@agenticreplay/mcp-shim/package.json +1 -1
- package/node_modules/@agenticreplay/node-instrument/package.json +1 -1
- package/node_modules/@agenticreplay/plugin-api/dist/plugins.d.ts +10 -212
- package/node_modules/@agenticreplay/plugin-api/dist/plugins.d.ts.map +1 -1
- package/node_modules/@agenticreplay/plugin-api/package.json +1 -1
- package/node_modules/@agenticreplay/providers/package.json +3 -3
- package/node_modules/@agenticreplay/proxy/dist/dialects.d.ts +3 -29
- package/node_modules/@agenticreplay/proxy/dist/dialects.d.ts.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/dialects.js +3 -69
- package/node_modules/@agenticreplay/proxy/dist/dialects.js.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/index.d.ts +0 -2
- package/node_modules/@agenticreplay/proxy/dist/index.d.ts.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/index.js +0 -2
- package/node_modules/@agenticreplay/proxy/dist/index.js.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/intercept.d.ts +0 -48
- package/node_modules/@agenticreplay/proxy/dist/intercept.d.ts.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/intercept.js +32 -157
- package/node_modules/@agenticreplay/proxy/dist/intercept.js.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/server.d.ts +2 -148
- package/node_modules/@agenticreplay/proxy/dist/server.d.ts.map +1 -1
- package/node_modules/@agenticreplay/proxy/dist/server.js +25 -874
- package/node_modules/@agenticreplay/proxy/dist/server.js.map +1 -1
- package/node_modules/@agenticreplay/proxy/package.json +5 -5
- package/node_modules/@agenticreplay/schema/package.json +1 -1
- package/node_modules/@agenticreplay/shell-shim/dist/install.d.ts.map +1 -1
- package/node_modules/@agenticreplay/shell-shim/dist/install.js +5 -2
- package/node_modules/@agenticreplay/shell-shim/dist/install.js.map +1 -1
- package/node_modules/@agenticreplay/shell-shim/package.json +3 -3
- package/node_modules/@agenticreplay/viewer/package.json +2 -2
- package/node_modules/any-ascii/LICENSE +15 -0
- package/node_modules/any-ascii/README.md +20 -0
- package/node_modules/any-ascii/any-ascii.d.ts +4 -0
- package/node_modules/any-ascii/any-ascii.js +30 -0
- package/node_modules/any-ascii/block.js +645 -0
- package/node_modules/any-ascii/package.json +32 -0
- package/node_modules/any-ascii/test.js +83 -0
- package/package.json +13 -14
- package/packages/cli/dist/api.d.ts +1 -27
- package/packages/cli/dist/api.d.ts.map +1 -1
- package/packages/cli/dist/api.js +2 -31
- package/packages/cli/dist/api.js.map +1 -1
- package/packages/cli/dist/args.d.ts.map +1 -1
- package/packages/cli/dist/args.js +0 -7
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/commands/attach.d.ts +1 -4
- package/packages/cli/dist/commands/attach.d.ts.map +1 -1
- package/packages/cli/dist/commands/attach.js +24 -109
- package/packages/cli/dist/commands/attach.js.map +1 -1
- package/packages/cli/dist/commands/cost.d.ts +3 -0
- package/packages/cli/dist/commands/cost.d.ts.map +1 -0
- package/packages/cli/dist/commands/cost.js +13 -0
- package/packages/cli/dist/commands/cost.js.map +1 -0
- package/packages/cli/dist/commands/gc.d.ts +0 -2
- package/packages/cli/dist/commands/gc.d.ts.map +1 -1
- package/packages/cli/dist/commands/gc.js +3 -47
- package/packages/cli/dist/commands/gc.js.map +1 -1
- package/packages/cli/dist/commands/inspect.d.ts +0 -2
- package/packages/cli/dist/commands/inspect.d.ts.map +1 -1
- package/packages/cli/dist/commands/inspect.js +4 -30
- package/packages/cli/dist/commands/inspect.js.map +1 -1
- package/packages/cli/dist/commands/quickstart.d.ts +2 -34
- package/packages/cli/dist/commands/quickstart.d.ts.map +1 -1
- package/packages/cli/dist/commands/quickstart.js +32 -340
- package/packages/cli/dist/commands/quickstart.js.map +1 -1
- package/packages/cli/dist/commands/record.d.ts.map +1 -1
- package/packages/cli/dist/commands/record.js +27 -101
- package/packages/cli/dist/commands/record.js.map +1 -1
- package/packages/cli/dist/commands/setup.d.ts.map +1 -1
- package/packages/cli/dist/commands/setup.js +1 -30
- package/packages/cli/dist/commands/setup.js.map +1 -1
- package/packages/cli/dist/commands/sync.d.ts.map +1 -1
- package/packages/cli/dist/commands/sync.js +18 -4
- package/packages/cli/dist/commands/sync.js.map +1 -1
- package/packages/cli/dist/config.d.ts +1 -4
- package/packages/cli/dist/config.d.ts.map +1 -1
- package/packages/cli/dist/config.js.map +1 -1
- package/packages/cli/dist/flags.d.ts.map +1 -1
- package/packages/cli/dist/flags.js +4 -45
- package/packages/cli/dist/flags.js.map +1 -1
- package/packages/cli/dist/fs-events.d.ts +2 -13
- package/packages/cli/dist/fs-events.d.ts.map +1 -1
- package/packages/cli/dist/fs-events.js +5 -64
- package/packages/cli/dist/fs-events.js.map +1 -1
- package/packages/cli/dist/index.d.ts +0 -2
- package/packages/cli/dist/index.d.ts.map +1 -1
- package/packages/cli/dist/index.js +0 -2
- package/packages/cli/dist/index.js.map +1 -1
- package/packages/cli/dist/main.d.ts.map +1 -1
- package/packages/cli/dist/main.js +12 -67
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/mcp-server.d.ts.map +1 -1
- package/packages/cli/dist/mcp-server.js +3 -86
- package/packages/cli/dist/mcp-server.js.map +1 -1
- package/packages/cli/dist/mcp.d.ts +1 -73
- package/packages/cli/dist/mcp.d.ts.map +1 -1
- package/packages/cli/dist/mcp.js +3 -113
- package/packages/cli/dist/mcp.js.map +1 -1
- package/packages/cli/dist/share-card.d.ts +0 -20
- package/packages/cli/dist/share-card.d.ts.map +1 -1
- package/packages/cli/dist/share-card.js +0 -63
- package/packages/cli/dist/share-card.js.map +1 -1
- package/packages/cli/dist/snapshot.d.ts +2 -5
- package/packages/cli/dist/snapshot.d.ts.map +1 -1
- package/packages/cli/dist/snapshot.js +2 -3
- package/packages/cli/dist/snapshot.js.map +1 -1
- package/packages/cli/dist/tls-capture.d.ts +1 -17
- package/packages/cli/dist/tls-capture.d.ts.map +1 -1
- package/packages/cli/dist/tls-capture.js +7 -77
- package/packages/cli/dist/tls-capture.js.map +1 -1
- package/packages/cli/package.json +11 -11
|
@@ -6,22 +6,19 @@ import { Output } from './out.js';
|
|
|
6
6
|
import { attachCommand } from './commands/attach.js';
|
|
7
7
|
import { quickstartCommand } from './commands/quickstart.js';
|
|
8
8
|
import { recordCommand } from './commands/record.js';
|
|
9
|
-
import {
|
|
10
|
-
import { checkpointsCommand, graphCommand, exportCommand, gatewayRunsFor, listCommand, showCommand, uiCommand, } from './commands/inspect.js';
|
|
9
|
+
import { graphCommand, exportCommand, gatewayRunsFor, listCommand, showCommand, uiCommand, } from './commands/inspect.js';
|
|
11
10
|
import { pullCommand, pushCommand } from './commands/sync.js';
|
|
12
|
-
import { compareCommand } from './commands/compare.js';
|
|
13
11
|
import { scrubCommand } from './commands/scrub.js';
|
|
14
12
|
import { gcCommand } from './commands/gc.js';
|
|
15
13
|
import { doctorCommand } from './commands/doctor.js';
|
|
16
14
|
import { modelsCommand, setupCommand } from './commands/setup.js';
|
|
17
15
|
import { withoutCredentials } from '@agenticreplay/proxy';
|
|
18
16
|
import { AGENTICREPLAY_VERSION } from './version.js';
|
|
19
|
-
const HELP = `agenticreplay ${AGENTICREPLAY_VERSION} — record
|
|
17
|
+
const HELP = `agenticreplay ${AGENTICREPLAY_VERSION} — record and inspect AI agent activity
|
|
20
18
|
|
|
21
|
-
agenticreplay quickstart a project
|
|
22
|
-
no key, no agent installed, no network
|
|
19
|
+
agenticreplay quickstart a project and a recorded run — no key, no network
|
|
23
20
|
--dir <path> where to put it (default: ./agenticreplay-quickstart)
|
|
24
|
-
--full
|
|
21
|
+
--full show the complete recorded timeline
|
|
25
22
|
agenticreplay record <agent> run an agent and capture supported API traffic
|
|
26
23
|
agenticreplay attach record an agent agenticreplay does not launch — one in a sandbox,
|
|
27
24
|
a container, or on another machine
|
|
@@ -29,23 +26,7 @@ const HELP = `agenticreplay ${AGENTICREPLAY_VERSION} — record, replay and fork
|
|
|
29
26
|
--bind <addr> address to listen on (default: 127.0.0.1)
|
|
30
27
|
--advertise <host> how the sandbox reaches this machine, when they differ
|
|
31
28
|
--remote-ca-path <p> where the CA will live over there (default: /tmp/agenticreplay-ca.crt)
|
|
32
|
-
--replay <run> serve a recording back to that agent instead of recording,
|
|
33
|
-
for a run whose agent is not on this machine
|
|
34
|
-
agenticreplay replay [run] reproduce a run exactly, network off
|
|
35
|
-
--quiet discard the replayed agent's own output, keep the verdict
|
|
36
|
-
--ui open the timeline when it finishes
|
|
37
|
-
agenticreplay replay [run] --from N fork from a checkpoint and continue live
|
|
38
|
-
--model <id> continue on a different model
|
|
39
|
-
--no-fs fork the conversation only — do not restore the workspace,
|
|
40
|
-
which a pulled run lacks unless it was pushed with --fs
|
|
41
|
-
agenticreplay compare [run] --models a,b,c
|
|
42
|
-
fork the same checkpoint onto several models
|
|
43
|
-
--from N checkpoint to fork every model from
|
|
44
|
-
--verify <cmd> run this in each fork; its exit code is the verdict
|
|
45
|
-
--no-fs as for replay: fork without the workspace
|
|
46
|
-
--share [f.svg|png] write the verdict table as a shareable card
|
|
47
29
|
agenticreplay show [run] the timeline, in the terminal
|
|
48
|
-
agenticreplay checkpoints [run] where you can fork from
|
|
49
30
|
agenticreplay graph [run] what caused what — recorded edges and derived ones
|
|
50
31
|
--to N just the chain that produced event N
|
|
51
32
|
agenticreplay export [run] -o file.html a single self-contained file you can attach
|
|
@@ -68,23 +49,18 @@ const HELP = `agenticreplay ${AGENTICREPLAY_VERSION} — record, replay and fork
|
|
|
68
49
|
--gateway <url> with --remote: where to look (a gateway you named)
|
|
69
50
|
--source gateway|upload with --remote: what it recorded, or what was pushed
|
|
70
51
|
--limit N with --remote: how many (default 20)
|
|
71
|
-
agenticreplay gc --older-than 7d reclaim
|
|
52
|
+
agenticreplay gc --older-than 7d reclaim old recording data
|
|
72
53
|
--keep N, --dry-run
|
|
73
54
|
agenticreplay doctor check this machine can record at all
|
|
74
|
-
agenticreplay setup point
|
|
55
|
+
agenticreplay setup point recording at an API gateway
|
|
75
56
|
requires an explicit --gateway URL
|
|
76
57
|
--gateway <url> origin that serves the model APIs
|
|
77
58
|
--key <k> | --key-env V store the key, or read it from an environment variable
|
|
78
|
-
--models a,b,c default model list, so compare needs no flags
|
|
79
59
|
agenticreplay models what the configured gateway serves, and what it costs
|
|
80
60
|
|
|
81
61
|
[run] is a run id, or "last" (the default).
|
|
82
62
|
|
|
83
63
|
Flags
|
|
84
|
-
--loose on replay, continue live past an unmatched request
|
|
85
|
-
--in-place replay against this directory as it stands, restoring nothing
|
|
86
|
-
--worktree replay in a scratch copy; never touches your files
|
|
87
|
-
--no-trace do not record the exact replay itself as a run of its own
|
|
88
64
|
--no-fs skip filesystem capture
|
|
89
65
|
--no-shell skip shell capture (PATH shim in front of sh/bash)
|
|
90
66
|
--no-agent-spans skip the agent-structure layer (OpenAI Agents SDK)
|
|
@@ -108,8 +84,7 @@ capture.
|
|
|
108
84
|
--max-body-bytes <n> capture ceiling per body (default 67108864); overflow fails capture
|
|
109
85
|
--max-buffered-bytes <n> aggregate retained-body budget (default 268435456)
|
|
110
86
|
--tls-intercept decrypt HTTPS for the hosts below, for this run only
|
|
111
|
-
|
|
112
|
-
hosts the recording names; --no-tls-intercept refuses
|
|
87
|
+
decrypt only the selected hosts for this recording
|
|
113
88
|
--tls-hosts a,b,c decrypt exactly these, replacing the default list
|
|
114
89
|
--tls-hosts +a,+b decrypt these *as well as* the default model API hosts
|
|
115
90
|
everything else is tunnelled unread; "*" is refused
|
|
@@ -119,7 +94,7 @@ capture.
|
|
|
119
94
|
If a machine is already behind a TLS-inspecting proxy, name its root in AGENTICREPLAY_TLS_UPSTREAM_CA.
|
|
120
95
|
|
|
121
96
|
Sending traffic somewhere other than the vendor — a gateway, a proxy, a local model — is what
|
|
122
|
-
these two are for
|
|
97
|
+
these two are for:
|
|
123
98
|
|
|
124
99
|
--upstream-anthropic <url> origin for /v1/messages (env AGENTICREPLAY_UPSTREAM_ANTHROPIC)
|
|
125
100
|
--upstream-openai <url> origin for /chat/completions (env AGENTICREPLAY_UPSTREAM_OPENAI)
|
|
@@ -130,7 +105,7 @@ Everything after -- goes to the agent:
|
|
|
130
105
|
For a script, an agent, or CI — every command below also answers as data:
|
|
131
106
|
|
|
132
107
|
--json one JSON document on stdout, diagnostics on stderr
|
|
133
|
-
list · show · events ·
|
|
108
|
+
list · show · events · graph · record
|
|
134
109
|
· doctor
|
|
135
110
|
|
|
136
111
|
agenticreplay mcp serve agenticreplay to an agent over MCP on stdio, so it can read its own runs:
|
|
@@ -183,24 +158,15 @@ export async function main(argv, cwd = process.cwd()) {
|
|
|
183
158
|
assertNoStrayPositionals(args);
|
|
184
159
|
switch (args.command) {
|
|
185
160
|
case 'quickstart':
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return (await quickstartCommand(args, out, cwd)).ok ? 0 : 1;
|
|
161
|
+
await quickstartCommand(args, out, cwd);
|
|
162
|
+
return 0;
|
|
189
163
|
case 'record':
|
|
190
164
|
return (await recordCommand(args, out, cwd)).exitCode;
|
|
191
165
|
case 'attach':
|
|
192
166
|
return (await attachCommand(args, out, cwd)).exitCode;
|
|
193
|
-
case 'replay':
|
|
194
|
-
return (await replayCommand(args, out, cwd)).exitCode;
|
|
195
|
-
case 'compare':
|
|
196
|
-
await compareCommand(args, out, cwd);
|
|
197
|
-
return 0;
|
|
198
167
|
case 'show':
|
|
199
168
|
await showCommand(args, out, cwd);
|
|
200
169
|
return 0;
|
|
201
|
-
case 'checkpoints':
|
|
202
|
-
await checkpointsCommand(args, out, cwd);
|
|
203
|
-
return 0;
|
|
204
170
|
case 'graph':
|
|
205
171
|
await graphCommand(args, out, cwd);
|
|
206
172
|
return 0;
|
|
@@ -340,9 +306,6 @@ async function jsonMain(args, cwd) {
|
|
|
340
306
|
case 'events':
|
|
341
307
|
emit(await agenticreplay.events(selector));
|
|
342
308
|
return 0;
|
|
343
|
-
case 'checkpoints':
|
|
344
|
-
emit(await agenticreplay.checkpoints(selector));
|
|
345
|
-
return 0;
|
|
346
309
|
case 'graph':
|
|
347
310
|
emit(await agenticreplay.graph(selector, {
|
|
348
311
|
...(args.num('to') === undefined ? {} : { to: args.num('to') }),
|
|
@@ -358,14 +321,6 @@ async function jsonMain(args, cwd) {
|
|
|
358
321
|
emit(result);
|
|
359
322
|
return result.exitCode;
|
|
360
323
|
}
|
|
361
|
-
case 'replay': {
|
|
362
|
-
const result = await replayCommand(args, out, cwd);
|
|
363
|
-
emit(result);
|
|
364
|
-
return result.exitCode;
|
|
365
|
-
}
|
|
366
|
-
case 'compare':
|
|
367
|
-
emit(await compareCommand(args, out, cwd));
|
|
368
|
-
return 0;
|
|
369
324
|
case 'doctor': {
|
|
370
325
|
const result = await doctorCommand(args, out, cwd);
|
|
371
326
|
emit(result);
|
|
@@ -376,17 +331,7 @@ async function jsonMain(args, cwd) {
|
|
|
376
331
|
error: {
|
|
377
332
|
message: `--json does not cover '${args.command}'`,
|
|
378
333
|
// Naming what it does cover beats making someone try them one at a time.
|
|
379
|
-
supported: [
|
|
380
|
-
'list',
|
|
381
|
-
'show',
|
|
382
|
-
'events',
|
|
383
|
-
'checkpoints',
|
|
384
|
-
'graph',
|
|
385
|
-
'record',
|
|
386
|
-
'replay',
|
|
387
|
-
'compare',
|
|
388
|
-
'doctor',
|
|
389
|
-
],
|
|
334
|
+
supported: ['list', 'show', 'events', 'graph', 'record', 'doctor'],
|
|
390
335
|
},
|
|
391
336
|
});
|
|
392
337
|
return 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,SAAS,EAAmB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAA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eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAW/F"}
|
|
@@ -24,15 +24,14 @@ const METHOD_NOT_FOUND = -32601;
|
|
|
24
24
|
const RUN_ARG = {
|
|
25
25
|
run: {
|
|
26
26
|
type: 'string',
|
|
27
|
-
description: 'Run id, or "last" for the newest recording. Defaults to "last".
|
|
28
|
-
'skipped when resolving "last", so it means the newest run you actually recorded.',
|
|
27
|
+
description: 'Run id, or "last" for the newest recording. Defaults to "last".',
|
|
29
28
|
},
|
|
30
29
|
};
|
|
31
30
|
export const MCP_TOOLS = [
|
|
32
31
|
{
|
|
33
32
|
name: 'agenticreplay_list_runs',
|
|
34
|
-
description: 'List every agent run recorded in this project, newest first
|
|
35
|
-
'
|
|
33
|
+
description: 'List every agent run recorded in this project, newest first. Start here when you do not ' +
|
|
34
|
+
'already know which run to inspect.',
|
|
36
35
|
inputSchema: { type: 'object', properties: {} },
|
|
37
36
|
},
|
|
38
37
|
{
|
|
@@ -43,12 +42,6 @@ export const MCP_TOOLS = [
|
|
|
43
42
|
'rather than what it cost.',
|
|
44
43
|
inputSchema: { type: 'object', properties: { ...RUN_ARG } },
|
|
45
44
|
},
|
|
46
|
-
{
|
|
47
|
-
name: 'agenticreplay_checkpoints',
|
|
48
|
-
description: 'The points in a run a fork can start from — where the conversation prefix is complete and ' +
|
|
49
|
-
'the workspace was snapshotted. Use before agenticreplay_compare to pick a fork point.',
|
|
50
|
-
inputSchema: { type: 'object', properties: { ...RUN_ARG } },
|
|
51
|
-
},
|
|
52
45
|
{
|
|
53
46
|
name: 'agenticreplay_graph',
|
|
54
47
|
description: 'What caused what in a run, as a list of edges. Each edge says which event produced which, ' +
|
|
@@ -67,51 +60,6 @@ export const MCP_TOOLS = [
|
|
|
67
60
|
},
|
|
68
61
|
},
|
|
69
62
|
},
|
|
70
|
-
{
|
|
71
|
-
name: 'agenticreplay_replay',
|
|
72
|
-
description: 'Re-run a recording exactly, with the network blocked and no tokens spent, and report what ' +
|
|
73
|
-
'could not be reproduced: divergences, and requests the recording could not serve. Free ' +
|
|
74
|
-
'and repeatable. It shows the recorded decisions still reproduce; it cannot show a fresh ' +
|
|
75
|
-
'run would fail the same way, because the model is not asked again — its recorded ' +
|
|
76
|
-
'responses are served back.',
|
|
77
|
-
inputSchema: {
|
|
78
|
-
type: 'object',
|
|
79
|
-
properties: {
|
|
80
|
-
...RUN_ARG,
|
|
81
|
-
worktree: {
|
|
82
|
-
type: 'boolean',
|
|
83
|
-
description: 'Replay in a scratch copy instead of over the working tree. Slower, and leaves the ' +
|
|
84
|
-
'files you are looking at untouched.',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'agenticreplay_compare',
|
|
91
|
-
description: 'Fork one recorded run onto several models from the same checkpoint — same files, same ' +
|
|
92
|
-
'conversation prefix — and grade each with a command you choose. SPENDS REAL TOKENS and ' +
|
|
93
|
-
'reaches the network: every model named is actually called. Ask before using it.',
|
|
94
|
-
inputSchema: {
|
|
95
|
-
type: 'object',
|
|
96
|
-
properties: {
|
|
97
|
-
...RUN_ARG,
|
|
98
|
-
models: {
|
|
99
|
-
type: 'array',
|
|
100
|
-
items: { type: 'string' },
|
|
101
|
-
description: 'Model ids to compare. Required.',
|
|
102
|
-
},
|
|
103
|
-
from: {
|
|
104
|
-
type: 'number',
|
|
105
|
-
description: 'Checkpoint seq to fork at, from agenticreplay_checkpoints.',
|
|
106
|
-
},
|
|
107
|
-
verify: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
description: 'Shell command whose exit code is the verdict, e.g. "npm test".',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
required: ['models'],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
63
|
];
|
|
116
64
|
function asRecord(value) {
|
|
117
65
|
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
@@ -180,8 +128,6 @@ async function callTool(agenticreplay, params) {
|
|
|
180
128
|
return ok(await agenticreplay.list());
|
|
181
129
|
case 'agenticreplay_show_run':
|
|
182
130
|
return ok(await agenticreplay.show(run));
|
|
183
|
-
case 'agenticreplay_checkpoints':
|
|
184
|
-
return ok(await agenticreplay.checkpoints(run));
|
|
185
131
|
case 'agenticreplay_graph': {
|
|
186
132
|
const to = args['to'];
|
|
187
133
|
if (to !== undefined && typeof to !== 'number') {
|
|
@@ -189,35 +135,6 @@ async function callTool(agenticreplay, params) {
|
|
|
189
135
|
}
|
|
190
136
|
return ok(await agenticreplay.graph(run, to === undefined ? {} : { to }));
|
|
191
137
|
}
|
|
192
|
-
case 'agenticreplay_replay': {
|
|
193
|
-
const worktree = args['worktree'];
|
|
194
|
-
if (worktree !== undefined && typeof worktree !== 'boolean') {
|
|
195
|
-
return content('worktree must be a boolean', true);
|
|
196
|
-
}
|
|
197
|
-
return ok(await agenticreplay.replay(run, worktree === true ? { worktree: true } : {}));
|
|
198
|
-
}
|
|
199
|
-
case 'agenticreplay_compare': {
|
|
200
|
-
const models = Array.isArray(args['models'])
|
|
201
|
-
? args['models'].filter((m) => typeof m === 'string')
|
|
202
|
-
: [];
|
|
203
|
-
if (models.length === 0)
|
|
204
|
-
return content('compare needs at least one model id', true);
|
|
205
|
-
const from = args['from'];
|
|
206
|
-
// Coercing a string here would silently fork from checkpoint 0 and produce a comparison
|
|
207
|
-
// whose one variable was not the model.
|
|
208
|
-
if (from !== undefined && typeof from !== 'number') {
|
|
209
|
-
return content(`from must be a number, got ${JSON.stringify(from)}`, true);
|
|
210
|
-
}
|
|
211
|
-
const verify = args['verify'];
|
|
212
|
-
if (verify !== undefined && typeof verify !== 'string') {
|
|
213
|
-
return content('verify must be a string', true);
|
|
214
|
-
}
|
|
215
|
-
return ok(await agenticreplay.compare(run, {
|
|
216
|
-
models,
|
|
217
|
-
...(typeof from === 'number' ? { from } : {}),
|
|
218
|
-
...(typeof verify === 'string' ? { verify } : {}),
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
138
|
default:
|
|
222
139
|
return content(`no such tool '${name}'`, true);
|
|
223
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AAEH,iEAAiE;AACjE,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC;AAYhC,0FAA0F;AAC1F,MAAM,OAAO,GAAG;IACd,GAAG,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,WAAW,
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AAEH,iEAAiE;AACjE,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC;AAYhC,0FAA0F;AAC1F,MAAM,OAAO,GAAG;IACd,GAAG,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,iEAAiE;KAC/E;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC;QACE,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EACT,0FAA0F;YAC1F,oCAAoC;QACtC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,wFAAwF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AE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC5E,CAAC;YACD;gBACE,OAAO,OAAO,CAAC,iBAAiB,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,OAAO,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAQD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAmB;IAC9E,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IACnC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAmB,CAAC,EAAE,CAAC;YACrD,6FAA6F;YAC7F,sEAAsE;YACtE,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;gBAAE,SAAS;YAC1C,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACtE,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TraceWriter } from '@agenticreplay/core';
|
|
2
1
|
import type { McpFrameRecord } from '@agenticreplay/mcp-shim';
|
|
2
|
+
import type { TraceWriter } from '@agenticreplay/core';
|
|
3
3
|
import type { Output } from './out.js';
|
|
4
4
|
export interface McpCapture {
|
|
5
5
|
/** Path to the rewritten config the agent should be pointed at. */
|
|
@@ -19,68 +19,6 @@ export interface McpCapture {
|
|
|
19
19
|
* was recorded as a response. A format has one owner, and it is the thing that writes it.
|
|
20
20
|
*/
|
|
21
21
|
export type { McpFrameRecord };
|
|
22
|
-
/**
|
|
23
|
-
* The recording's own copy of the config it was given, kept beside the frames it produced.
|
|
24
|
-
*
|
|
25
|
-
* A replay used to find the source by reading the path out of the `mcp_instrumented` note, and a
|
|
26
|
-
* path is a poor thing to depend on. It has to survive the trace's redactor — `mkdtemp` and every
|
|
27
|
-
* CI workspace end in a random segment, and `agenticreplay-int-mcp-stdio-feH8gJ` is 25 characters of
|
|
28
|
-
* mixed-case base62, so roughly one in seven cleared the entropy sweep's threshold and reached the
|
|
29
|
-
* trace as `<secret:high_entropy:…>`. `stat` then failed, MCP was dropped for the replay, and the
|
|
30
|
-
* agent was launched with no `MCP_CONFIG_PATH`: `KeyError` from a recording that was perfectly
|
|
31
|
-
* good, intermittently, according to what `mkdtemp` picked.
|
|
32
|
-
*
|
|
33
|
-
* It also has to still be there, and mean the same thing. Deleting the config, moving it, or
|
|
34
|
-
* editing a server's command between the recording and the replay all changed what the replay ran
|
|
35
|
-
* — for a file the operator has no reason to think of as part of the run.
|
|
36
|
-
*
|
|
37
|
-
* Keeping the bytes removes both. Nothing has to survive redaction, because this is not in the
|
|
38
|
-
* trace; nothing outside the run directory has to still exist. It carries the same material as the
|
|
39
|
-
* rewritten `mcp-config.json` written next to it — same directory, same `0600` — so it is not a
|
|
40
|
-
* new kind of thing to protect.
|
|
41
|
-
*/
|
|
42
|
-
export declare const MCP_SOURCE_FILENAME = "mcp-source.json";
|
|
43
|
-
/**
|
|
44
|
-
* The MCP config a *replay* should instrument: the flag if one was given, else whatever the
|
|
45
|
-
* recording itself used.
|
|
46
|
-
*
|
|
47
|
-
* Replay and fork launch the same agent the recording did, so they hit the same blind spot record
|
|
48
|
-
* had before `--mcp-config` existed: without a config the harness either talks to servers agenticreplay
|
|
49
|
-
* cannot see, or — for one that requires the variable — does not start at all. The recording knows
|
|
50
|
-
* the answer; it just had nowhere to write it down, since `manifest.argv` holds only the agent's
|
|
51
|
-
* own arguments and `--mcp-config` is agenticreplay's.
|
|
52
|
-
*
|
|
53
|
-
* The path is read back from the run's own `mcp_instrumented` note. Nothing is re-instrumented from
|
|
54
|
-
* the *rewritten* config in the parent run directory: its servers already point at the parent's
|
|
55
|
-
* frames file, so reusing it would append this replay's traffic to the recording it is replaying.
|
|
56
|
-
*/
|
|
57
|
-
export declare function mcpSourceFrom(flagValue: string | undefined, events: {
|
|
58
|
-
type: string;
|
|
59
|
-
attrs?: Record<string, unknown>;
|
|
60
|
-
}[]): string | undefined;
|
|
61
|
-
/** Did this run capture MCP at all? Decides whether a replay without a config is worth warning about. */
|
|
62
|
-
export declare function usedMcp(events: {
|
|
63
|
-
type: string;
|
|
64
|
-
}[]): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Set up MCP capture for a replay or a fork, from the flag or from what the recording used.
|
|
67
|
-
*
|
|
68
|
-
* Returns undefined — quietly — when the run never had MCP, which is most runs. When it did and the
|
|
69
|
-
* source config has since moved or been deleted, that is said out loud rather than silently
|
|
70
|
-
* dropping a capture layer: an absent `mcp.*` in the replay would otherwise read as "the agent made
|
|
71
|
-
* no MCP calls" instead of "agenticreplay was not looking".
|
|
72
|
-
*/
|
|
73
|
-
export declare function mcpForReplay(args: {
|
|
74
|
-
str(name: string): string | undefined;
|
|
75
|
-
bool?(name: string, dflt?: boolean): boolean;
|
|
76
|
-
}, events: {
|
|
77
|
-
type: string;
|
|
78
|
-
attrs?: Record<string, unknown>;
|
|
79
|
-
}[], writer: TraceWriter, out: Output,
|
|
80
|
-
/** The recording's own frames, so the servers are answered from rather than started. */
|
|
81
|
-
recordedFrames?: string,
|
|
82
|
-
/** The recording's directory, which holds its own copy of the config it was given. */
|
|
83
|
-
recordedRunDir?: string): Promise<McpCapture | undefined>;
|
|
84
22
|
/**
|
|
85
23
|
* Point the launched agent at the instrumented config.
|
|
86
24
|
*
|
|
@@ -103,16 +41,6 @@ export declare function setupMcpCapture(opts: {
|
|
|
103
41
|
sourceConfigPath: string;
|
|
104
42
|
runDir: string;
|
|
105
43
|
out: Output;
|
|
106
|
-
/**
|
|
107
|
-
* Frames to answer from instead of starting the servers.
|
|
108
|
-
*
|
|
109
|
-
* Capture was only half of what this layer is for. The reason to record a server's traffic is
|
|
110
|
-
* that the run stays reproducible once the server is not — the token revoked, the repository
|
|
111
|
-
* moved, the service retired. Replay re-instrumented the same config and started the real server
|
|
112
|
-
* again, so an MCP recording could be read but not reproduced, and came apart on the first call
|
|
113
|
-
* when the server had gone. Pointed at a capture, the shim serves from it and launches nothing.
|
|
114
|
-
*/
|
|
115
|
-
replayFrames?: string;
|
|
116
44
|
}): Promise<McpCapture | undefined>;
|
|
117
45
|
/**
|
|
118
46
|
* Exposed for the doctor command: is the shim runnable at all?
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,uDAAuD;IACvD,KAAK,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAItF;AAqCD,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,EAC9B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA+ClC;AAwBD;;;;;;;GAOG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAqBvD"}
|
package/packages/cli/dist/mcp.js
CHANGED
|
@@ -1,112 +1,10 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import { readFile,
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { rewriteMcpConfig } from '@agenticreplay/adapters';
|
|
6
6
|
import { EARLIEST_TS_MS, LATEST_TS_MS } from '@agenticreplay/schema';
|
|
7
7
|
import { isMcpFrameRecord, objectsOnLine, MCP_RECORD_START } from '@agenticreplay/mcp-shim';
|
|
8
|
-
/**
|
|
9
|
-
* The recording's own copy of the config it was given, kept beside the frames it produced.
|
|
10
|
-
*
|
|
11
|
-
* A replay used to find the source by reading the path out of the `mcp_instrumented` note, and a
|
|
12
|
-
* path is a poor thing to depend on. It has to survive the trace's redactor — `mkdtemp` and every
|
|
13
|
-
* CI workspace end in a random segment, and `agenticreplay-int-mcp-stdio-feH8gJ` is 25 characters of
|
|
14
|
-
* mixed-case base62, so roughly one in seven cleared the entropy sweep's threshold and reached the
|
|
15
|
-
* trace as `<secret:high_entropy:…>`. `stat` then failed, MCP was dropped for the replay, and the
|
|
16
|
-
* agent was launched with no `MCP_CONFIG_PATH`: `KeyError` from a recording that was perfectly
|
|
17
|
-
* good, intermittently, according to what `mkdtemp` picked.
|
|
18
|
-
*
|
|
19
|
-
* It also has to still be there, and mean the same thing. Deleting the config, moving it, or
|
|
20
|
-
* editing a server's command between the recording and the replay all changed what the replay ran
|
|
21
|
-
* — for a file the operator has no reason to think of as part of the run.
|
|
22
|
-
*
|
|
23
|
-
* Keeping the bytes removes both. Nothing has to survive redaction, because this is not in the
|
|
24
|
-
* trace; nothing outside the run directory has to still exist. It carries the same material as the
|
|
25
|
-
* rewritten `mcp-config.json` written next to it — same directory, same `0600` — so it is not a
|
|
26
|
-
* new kind of thing to protect.
|
|
27
|
-
*/
|
|
28
|
-
export const MCP_SOURCE_FILENAME = 'mcp-source.json';
|
|
29
|
-
/**
|
|
30
|
-
* The MCP config a *replay* should instrument: the flag if one was given, else whatever the
|
|
31
|
-
* recording itself used.
|
|
32
|
-
*
|
|
33
|
-
* Replay and fork launch the same agent the recording did, so they hit the same blind spot record
|
|
34
|
-
* had before `--mcp-config` existed: without a config the harness either talks to servers agenticreplay
|
|
35
|
-
* cannot see, or — for one that requires the variable — does not start at all. The recording knows
|
|
36
|
-
* the answer; it just had nowhere to write it down, since `manifest.argv` holds only the agent's
|
|
37
|
-
* own arguments and `--mcp-config` is agenticreplay's.
|
|
38
|
-
*
|
|
39
|
-
* The path is read back from the run's own `mcp_instrumented` note. Nothing is re-instrumented from
|
|
40
|
-
* the *rewritten* config in the parent run directory: its servers already point at the parent's
|
|
41
|
-
* frames file, so reusing it would append this replay's traffic to the recording it is replaying.
|
|
42
|
-
*/
|
|
43
|
-
export function mcpSourceFrom(flagValue, events) {
|
|
44
|
-
if (flagValue)
|
|
45
|
-
return flagValue;
|
|
46
|
-
for (const event of events) {
|
|
47
|
-
if (event.type !== 'note' || event.attrs?.rule !== 'mcp_instrumented')
|
|
48
|
-
continue;
|
|
49
|
-
const source = event.attrs.source;
|
|
50
|
-
if (typeof source === 'string' && source !== '')
|
|
51
|
-
return source;
|
|
52
|
-
}
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
/** Did this run capture MCP at all? Decides whether a replay without a config is worth warning about. */
|
|
56
|
-
export function usedMcp(events) {
|
|
57
|
-
return events.some((e) => e.type === 'mcp.request' || e.type === 'mcp.response');
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Set up MCP capture for a replay or a fork, from the flag or from what the recording used.
|
|
61
|
-
*
|
|
62
|
-
* Returns undefined — quietly — when the run never had MCP, which is most runs. When it did and the
|
|
63
|
-
* source config has since moved or been deleted, that is said out loud rather than silently
|
|
64
|
-
* dropping a capture layer: an absent `mcp.*` in the replay would otherwise read as "the agent made
|
|
65
|
-
* no MCP calls" instead of "agenticreplay was not looking".
|
|
66
|
-
*/
|
|
67
|
-
export async function mcpForReplay(args, events, writer, out,
|
|
68
|
-
/** The recording's own frames, so the servers are answered from rather than started. */
|
|
69
|
-
recordedFrames,
|
|
70
|
-
/** The recording's directory, which holds its own copy of the config it was given. */
|
|
71
|
-
recordedRunDir) {
|
|
72
|
-
// The recording's copy first, and only then the path it wrote down. The copy cannot have been
|
|
73
|
-
// redacted, moved or edited since; the path can have been all three.
|
|
74
|
-
const kept = recordedRunDir === undefined ? undefined : join(recordedRunDir, MCP_SOURCE_FILENAME);
|
|
75
|
-
if (kept !== undefined && (await stat(kept).catch(() => null))) {
|
|
76
|
-
return setupMcpCapture({
|
|
77
|
-
sourceConfigPath: kept,
|
|
78
|
-
runDir: writer.runDir,
|
|
79
|
-
out,
|
|
80
|
-
...(recordedFrames === undefined ? {} : { replayFrames: recordedFrames }),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
const source = mcpSourceFrom(args.str('mcp-config'), events);
|
|
84
|
-
if (source === undefined) {
|
|
85
|
-
if (usedMcp(events)) {
|
|
86
|
-
out.warn('mcp.not_instrumented', {
|
|
87
|
-
why: 'the recording captured MCP but did not record which config it came from',
|
|
88
|
-
next: 'pass --mcp-config <path> to capture it here too',
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
if (!(await stat(source).catch(() => null))) {
|
|
94
|
-
out.warn('mcp.source_missing', {
|
|
95
|
-
path: source,
|
|
96
|
-
note: 'the config the recording used is no longer there; MCP will not be captured',
|
|
97
|
-
});
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
return setupMcpCapture({
|
|
101
|
-
sourceConfigPath: source,
|
|
102
|
-
runDir: writer.runDir,
|
|
103
|
-
out,
|
|
104
|
-
// A replay that starts the real servers is not a replay of them: it is a second live run whose
|
|
105
|
-
// answers happen to be read back through the same shim. Answering from the recording is what
|
|
106
|
-
// makes an MCP run reproducible after the server it talked to is gone.
|
|
107
|
-
...(recordedFrames === undefined ? {} : { replayFrames: recordedFrames }),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
8
|
/**
|
|
111
9
|
* Point the launched agent at the instrumented config.
|
|
112
10
|
*
|
|
@@ -188,9 +86,6 @@ export async function setupMcpCapture(opts) {
|
|
|
188
86
|
opts.out.warn('mcp.config_unreadable', { path: opts.sourceConfigPath });
|
|
189
87
|
return undefined;
|
|
190
88
|
}
|
|
191
|
-
// Kept before it is parsed, so a later run reads back what this run was handed — byte for byte,
|
|
192
|
-
// key order and all. See {@link MCP_SOURCE_FILENAME} for why a path was not good enough.
|
|
193
|
-
await writeFile(join(opts.runDir, MCP_SOURCE_FILENAME), raw, { mode: 0o600 }).catch(() => undefined);
|
|
194
89
|
let parsed;
|
|
195
90
|
try {
|
|
196
91
|
parsed = JSON.parse(raw);
|
|
@@ -201,19 +96,14 @@ export async function setupMcpCapture(opts) {
|
|
|
201
96
|
}
|
|
202
97
|
const framesPath = join(opts.runDir, 'mcp-frames.jsonl');
|
|
203
98
|
const shim = resolveShimEntry();
|
|
204
|
-
|
|
205
|
-
// servers say, `--replay` says it back. Both keep `--out` so a replay records its own frames and
|
|
206
|
-
// is itself a run that can be read.
|
|
207
|
-
const shimArgs = opts.replayFrames === undefined
|
|
208
|
-
? [shim, '--out', framesPath]
|
|
209
|
-
: [shim, '--out', framesPath, '--replay', opts.replayFrames];
|
|
99
|
+
const shimArgs = [shim, '--out', framesPath];
|
|
210
100
|
const { config, rewritten, skipped } = rewriteMcpConfig(parsed, process.execPath, shimArgs);
|
|
211
101
|
const configPath = join(opts.runDir, 'mcp-config.json');
|
|
212
102
|
await writeFile(configPath, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
|
|
213
103
|
opts.out.info('mcp.instrumented', {
|
|
214
104
|
servers: rewritten.length,
|
|
215
105
|
skipped: skipped.length,
|
|
216
|
-
mode:
|
|
106
|
+
mode: 'record',
|
|
217
107
|
config: configPath,
|
|
218
108
|
});
|
|
219
109
|
return {
|