orcareplay 0.1.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/api.d.ts +127 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +159 -0
- package/dist/api.js.map +1 -0
- package/dist/args.d.ts +24 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +124 -0
- package/dist/args.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/compare.d.ts +27 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +182 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/doctor.d.ts +24 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +358 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/gc.d.ts +24 -0
- package/dist/commands/gc.d.ts.map +1 -0
- package/dist/commands/gc.js +326 -0
- package/dist/commands/gc.js.map +1 -0
- package/dist/commands/inspect.d.ts +24 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +262 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/record.d.ts +17 -0
- package/dist/commands/record.d.ts.map +1 -0
- package/dist/commands/record.js +497 -0
- package/dist/commands/record.js.map +1 -0
- package/dist/commands/replay.d.ts +43 -0
- package/dist/commands/replay.d.ts.map +1 -0
- package/dist/commands/replay.js +800 -0
- package/dist/commands/replay.js.map +1 -0
- package/dist/commands/scrub.d.ts +34 -0
- package/dist/commands/scrub.d.ts.map +1 -0
- package/dist/commands/scrub.js +452 -0
- package/dist/commands/scrub.js.map +1 -0
- package/dist/commands/setup.d.ts +23 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +177 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +117 -0
- package/dist/config.js.map +1 -0
- package/dist/exchange-events.d.ts +72 -0
- package/dist/exchange-events.d.ts.map +1 -0
- package/dist/exchange-events.js +170 -0
- package/dist/exchange-events.js.map +1 -0
- package/dist/flags.d.ts +10 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +83 -0
- package/dist/flags.js.map +1 -0
- package/dist/fs-events.d.ts +19 -0
- package/dist/fs-events.d.ts.map +1 -0
- package/dist/fs-events.js +53 -0
- package/dist/fs-events.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +282 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp-server.d.ts +44 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +245 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp.d.ts +111 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +221 -0
- package/dist/mcp.js.map +1 -0
- package/dist/out.d.ts +69 -0
- package/dist/out.d.ts.map +1 -0
- package/dist/out.js +138 -0
- package/dist/out.js.map +1 -0
- package/dist/rasterize.d.ts +62 -0
- package/dist/rasterize.d.ts.map +1 -0
- package/dist/rasterize.js +154 -0
- package/dist/rasterize.js.map +1 -0
- package/dist/serial.d.ts +19 -0
- package/dist/serial.d.ts.map +1 -0
- package/dist/serial.js +34 -0
- package/dist/serial.js.map +1 -0
- package/dist/share-card.d.ts +73 -0
- package/dist/share-card.d.ts.map +1 -0
- package/dist/share-card.js +413 -0
- package/dist/share-card.js.map +1 -0
- package/dist/snapshot.d.ts +30 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +43 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/tls-capture.d.ts +57 -0
- package/dist/tls-capture.d.ts.map +1 -0
- package/dist/tls-capture.js +198 -0
- package/dist/tls-capture.js.map +1 -0
- package/dist/upstream.d.ts +20 -0
- package/dist/upstream.d.ts.map +1 -0
- package/dist/upstream.js +31 -0
- package/dist/upstream.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-events.js","sourceRoot":"","sources":["../src/exchange-events.ts"],"names":[],"mappings":"AA6CA,MAAM,OAAO,oBAAoB;IACtB,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;IACvD;;;;OAIG;IACM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,oEAAoE;IACpE,UAAU;QACR,2FAA2F;QAC3F,+FAA+F;QAC/F,0FAA0F;QAC1F,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAA0B,EAAE,IAAY;QAC7C,MAAM,MAAM,GAAmB,EAAE,CAAC;QAClC,oFAAoF;QACpF,MAAM,SAAS,GAAa,EAAE,CAAC;QAE/B,KAAK,MAAM,MAAM,IAAI,kBAAkB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACnE,6FAA6F;YAC7F,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;gBAAE,SAAS;YACnD,wFAAwF;YACxF,oEAAoE;YACpE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,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,GAAG,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/flags.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ParsedArgs } from './args.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reject a flag this command does not have.
|
|
4
|
+
*
|
|
5
|
+
* Throws rather than warns. A flag is an instruction, and carrying on having ignored one produces
|
|
6
|
+
* a run that did something other than what was asked while reporting success — which is the
|
|
7
|
+
* failure this whole tool exists to make visible.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertKnownFlags(args: ParsedArgs): void;
|
|
10
|
+
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAkE5C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAevD"}
|
package/dist/flags.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which flags each command accepts.
|
|
3
|
+
*
|
|
4
|
+
* The parser takes any flag it is given, which is right for parsing and wrong for a CLI: a
|
|
5
|
+
* mistyped or invented flag was accepted in silence and simply had no effect, so a run that did
|
|
6
|
+
* something other than what was asked reported success.
|
|
7
|
+
*
|
|
8
|
+
* Every entry below is a flag the code actually reads — collected from the `args.bool/str/num/list`
|
|
9
|
+
* calls in each command and in the helpers it shares — not from what the documentation describes.
|
|
10
|
+
* Building it the other way round is how a flag that never existed came to be recommended in the
|
|
11
|
+
* first place, and a list that allows more than the code understands would rebuild exactly that.
|
|
12
|
+
*/
|
|
13
|
+
const GLOBAL = ['ci', 'json', 'verbose', 'color', 'help', 'version', 'h'];
|
|
14
|
+
/** Read by `config.ts` for any command that can reach a provider. */
|
|
15
|
+
const UPSTREAM = ['upstream-anthropic', 'upstream-openai'];
|
|
16
|
+
/** Read by `tls-capture.ts`, which record, replay and compare all set up. */
|
|
17
|
+
const TLS = ['tls-intercept', 'tls-hosts'];
|
|
18
|
+
const BY_COMMAND = {
|
|
19
|
+
record: ['fs', 'shell', 'mcp-config', ...TLS, ...UPSTREAM],
|
|
20
|
+
replay: [
|
|
21
|
+
'from',
|
|
22
|
+
'model',
|
|
23
|
+
'fs',
|
|
24
|
+
'in-place',
|
|
25
|
+
'worktree',
|
|
26
|
+
'loose',
|
|
27
|
+
'trace',
|
|
28
|
+
'port',
|
|
29
|
+
'ui',
|
|
30
|
+
'mcp-config',
|
|
31
|
+
...TLS,
|
|
32
|
+
...UPSTREAM,
|
|
33
|
+
],
|
|
34
|
+
compare: ['from', 'models', 'verify', 'share', 'loose', ...TLS, ...UPSTREAM],
|
|
35
|
+
show: [],
|
|
36
|
+
checkpoints: [],
|
|
37
|
+
export: ['o', 'out'],
|
|
38
|
+
ui: ['port'],
|
|
39
|
+
scrub: ['match', 'matches', 'dry-run', 'drop-fs'],
|
|
40
|
+
list: [],
|
|
41
|
+
gc: ['older-than', 'keep', 'dry-run'],
|
|
42
|
+
doctor: [],
|
|
43
|
+
setup: ['gateway', 'key', 'key-env', 'models'],
|
|
44
|
+
models: [],
|
|
45
|
+
mcp: [],
|
|
46
|
+
help: [],
|
|
47
|
+
};
|
|
48
|
+
/** The closest known flag, for a name that is probably a typo rather than an invention. */
|
|
49
|
+
function nearest(name, known) {
|
|
50
|
+
let best;
|
|
51
|
+
for (const candidate of known) {
|
|
52
|
+
// Prefix and containment both catch the realistic slips: `--worktre`, `--model-s`.
|
|
53
|
+
const prefix = candidate.startsWith(name) || name.startsWith(candidate) ? 2 : 0;
|
|
54
|
+
const contains = candidate.includes(name) || name.includes(candidate) ? 1 : 0;
|
|
55
|
+
const score = Math.max(prefix, contains);
|
|
56
|
+
if (score > 0 && (best === undefined || score > best.score))
|
|
57
|
+
best = { name: candidate, score };
|
|
58
|
+
}
|
|
59
|
+
return best?.name;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Reject a flag this command does not have.
|
|
63
|
+
*
|
|
64
|
+
* Throws rather than warns. A flag is an instruction, and carrying on having ignored one produces
|
|
65
|
+
* a run that did something other than what was asked while reporting success — which is the
|
|
66
|
+
* failure this whole tool exists to make visible.
|
|
67
|
+
*/
|
|
68
|
+
export function assertKnownFlags(args) {
|
|
69
|
+
const allowed = BY_COMMAND[args.command];
|
|
70
|
+
// An unknown command is reported by the dispatcher, which can say more about it than this can.
|
|
71
|
+
if (allowed === undefined)
|
|
72
|
+
return;
|
|
73
|
+
const known = [...allowed, ...GLOBAL];
|
|
74
|
+
const unknown = Object.keys(args.flags).filter((name) => !known.includes(name));
|
|
75
|
+
if (unknown.length === 0)
|
|
76
|
+
return;
|
|
77
|
+
const [first] = unknown;
|
|
78
|
+
const suggestion = nearest(first, known);
|
|
79
|
+
throw new Error(`unknown flag --${first} for "orca ${args.command}"` +
|
|
80
|
+
(suggestion === undefined ? '' : `\n did you mean --${suggestion}?`) +
|
|
81
|
+
`\n flags for this command: ${allowed.length === 0 ? '(none)' : allowed.map((f) => `--${f}`).join(' ')}`);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAU,CAAC;AAEnF,qEAAqE;AACrE,MAAM,QAAQ,GAAG,CAAC,oBAAoB,EAAE,iBAAiB,CAAU,CAAC;AAEpE,6EAA6E;AAC7E,MAAM,GAAG,GAAG,CAAC,eAAe,EAAE,WAAW,CAAU,CAAC;AAEpD,MAAM,UAAU,GAAsC;IACpD,MAAM,EAAE,CAAC,IAAI,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CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC5G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TraceWriter } from '@orcareplay/core';
|
|
2
|
+
import type { FsCapture } from '@orcareplay/fs-capture';
|
|
3
|
+
import type { Output } from './out.js';
|
|
4
|
+
/**
|
|
5
|
+
* Snapshot the workspace and write what changed.
|
|
6
|
+
*
|
|
7
|
+
* Shared by `orca record` and by a fork, which had none of this: a fork ran a live agent in a
|
|
8
|
+
* worktree and recorded only the conversation, so its trace carried no `fs.snapshot` at all — and a
|
|
9
|
+
* checkpoint is *derived* from a snapshot (spec §3). A run with no checkpoints cannot be forked, so
|
|
10
|
+
* you could not fork a fork, and `orca compare last` straight after a fork failed with "this run
|
|
11
|
+
* has no checkpoints" because `last` had resolved to the fork.
|
|
12
|
+
*
|
|
13
|
+
* Degrade, never abort: losing a snapshot costs one checkpoint, whereas throwing here would cost
|
|
14
|
+
* the user the run they were in the middle of.
|
|
15
|
+
*/
|
|
16
|
+
export declare function appendSnapshot(fs: FsCapture, writer: TraceWriter, out: Output, turn: number, options?: {
|
|
17
|
+
initial?: boolean;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=fs-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-events.d.ts","sourceRoot":"","sources":["../src/fs-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,OAAO,CAAC,IAAI,CAAC,CAuCf"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { snapshotWithRetry } from './snapshot.js';
|
|
2
|
+
/**
|
|
3
|
+
* Snapshot the workspace and write what changed.
|
|
4
|
+
*
|
|
5
|
+
* Shared by `orca record` and by a fork, which had none of this: a fork ran a live agent in a
|
|
6
|
+
* worktree and recorded only the conversation, so its trace carried no `fs.snapshot` at all — and a
|
|
7
|
+
* checkpoint is *derived* from a snapshot (spec §3). A run with no checkpoints cannot be forked, so
|
|
8
|
+
* you could not fork a fork, and `orca compare last` straight after a fork failed with "this run
|
|
9
|
+
* has no checkpoints" because `last` had resolved to the fork.
|
|
10
|
+
*
|
|
11
|
+
* Degrade, never abort: losing a snapshot costs one checkpoint, whereas throwing here would cost
|
|
12
|
+
* the user the run they were in the middle of.
|
|
13
|
+
*/
|
|
14
|
+
export async function appendSnapshot(fs, writer, out, turn, options = {}) {
|
|
15
|
+
const outcome = await snapshotWithRetry(fs, turn);
|
|
16
|
+
if (!outcome.ok || !outcome.snapshot) {
|
|
17
|
+
out.warn('fs.snapshot_failed', { turn, attempts: outcome.attempts, error: outcome.error });
|
|
18
|
+
await writer.append({
|
|
19
|
+
type: 'note',
|
|
20
|
+
actor: 'orca',
|
|
21
|
+
turn,
|
|
22
|
+
attrs: { rule: 'fs_snapshot_skipped', attempts: outcome.attempts, error: outcome.error },
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const snap = outcome.snapshot;
|
|
27
|
+
await writer.append({
|
|
28
|
+
type: 'fs.snapshot',
|
|
29
|
+
actor: 'orca',
|
|
30
|
+
turn,
|
|
31
|
+
attrs: {
|
|
32
|
+
tree: snap.tree,
|
|
33
|
+
changes: snap.changes.length,
|
|
34
|
+
...(options.initial === true ? { initial: true } : {}),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
for (const change of snap.changes) {
|
|
38
|
+
await writer.append({
|
|
39
|
+
type: 'fs.change',
|
|
40
|
+
actor: 'orca',
|
|
41
|
+
turn,
|
|
42
|
+
attrs: {
|
|
43
|
+
path: change.path,
|
|
44
|
+
status: change.status,
|
|
45
|
+
insertions: change.insertions,
|
|
46
|
+
deletions: change.deletions,
|
|
47
|
+
// Only when true, so a trace is not littered with a false on every unremarkable change.
|
|
48
|
+
...(change.eolOnly === true ? { eol_only: true } : {}),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=fs-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-events.js","sourceRoot":"","sources":["../src/fs-events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,EAAa,EACb,MAAmB,EACnB,GAAW,EACX,IAAY,EACZ,UAAiC,EAAE;IAEnC,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3F,MAAM,MAAM,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;YACb,IAAI;YACJ,KAAK,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE;SACzF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC9B,MAAM,MAAM,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,MAAM;QACb,IAAI;QACJ,KAAK,EAAE;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC5B,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD;KACF,CAAC,CAAC;IACH,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,MAAM,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,MAAM;YACb,IAAI;YACJ,KAAK,EAAE;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,wFAAwF;gBACxF,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACvD;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './api.js';
|
|
2
|
+
export * from './args.js';
|
|
3
|
+
export * from './out.js';
|
|
4
|
+
export * from './main.js';
|
|
5
|
+
export * from './exchange-events.js';
|
|
6
|
+
export * from './mcp.js';
|
|
7
|
+
export * from './serial.js';
|
|
8
|
+
export * from './snapshot.js';
|
|
9
|
+
export * from './share-card.js';
|
|
10
|
+
export * from './commands/record.js';
|
|
11
|
+
export * from './commands/replay.js';
|
|
12
|
+
export * from './commands/compare.js';
|
|
13
|
+
export * from './commands/inspect.js';
|
|
14
|
+
export * from './commands/scrub.js';
|
|
15
|
+
export * from './commands/gc.js';
|
|
16
|
+
export * from './commands/doctor.js';
|
|
17
|
+
export * from './version.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './api.js';
|
|
2
|
+
export * from './args.js';
|
|
3
|
+
export * from './out.js';
|
|
4
|
+
export * from './main.js';
|
|
5
|
+
export * from './exchange-events.js';
|
|
6
|
+
export * from './mcp.js';
|
|
7
|
+
export * from './serial.js';
|
|
8
|
+
export * from './snapshot.js';
|
|
9
|
+
export * from './share-card.js';
|
|
10
|
+
export * from './commands/record.js';
|
|
11
|
+
export * from './commands/replay.js';
|
|
12
|
+
export * from './commands/compare.js';
|
|
13
|
+
export * from './commands/inspect.js';
|
|
14
|
+
export * from './commands/scrub.js';
|
|
15
|
+
export * from './commands/gc.js';
|
|
16
|
+
export * from './commands/doctor.js';
|
|
17
|
+
export * from './version.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAwGA,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,SAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkG/E"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { assertKnownFlags } from './flags.js';
|
|
2
|
+
import { parseArgs } from './args.js';
|
|
3
|
+
import { Orca } from './api.js';
|
|
4
|
+
import { serveMcp } from './mcp-server.js';
|
|
5
|
+
import { Output } from './out.js';
|
|
6
|
+
import { recordCommand } from './commands/record.js';
|
|
7
|
+
import { replayCommand } from './commands/replay.js';
|
|
8
|
+
import { checkpointsCommand, graphCommand, exportCommand, listCommand, showCommand, uiCommand, } from './commands/inspect.js';
|
|
9
|
+
import { compareCommand } from './commands/compare.js';
|
|
10
|
+
import { scrubCommand } from './commands/scrub.js';
|
|
11
|
+
import { gcCommand } from './commands/gc.js';
|
|
12
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
13
|
+
import { modelsCommand, setupCommand } from './commands/setup.js';
|
|
14
|
+
import { ORCA_VERSION } from './version.js';
|
|
15
|
+
const HELP = `orca ${ORCA_VERSION} — record, replay and fork debugger for AI agents
|
|
16
|
+
|
|
17
|
+
orca record <agent> run an agent and capture everything
|
|
18
|
+
orca replay [run] reproduce a run exactly, network off
|
|
19
|
+
--ui open the timeline when it finishes
|
|
20
|
+
orca replay [run] --from N fork from a checkpoint and continue live
|
|
21
|
+
--model <id> continue on a different model
|
|
22
|
+
orca compare [run] --models a,b,c
|
|
23
|
+
fork the same checkpoint onto several models
|
|
24
|
+
--from N checkpoint to fork every model from
|
|
25
|
+
--verify <cmd> run this in each fork; its exit code is the verdict
|
|
26
|
+
--share [f.svg|png] write the verdict table as a shareable card
|
|
27
|
+
orca show [run] the timeline, in the terminal
|
|
28
|
+
orca checkpoints [run] where you can fork from
|
|
29
|
+
orca graph [run] what caused what — recorded edges and derived ones
|
|
30
|
+
--to N just the chain that produced event N
|
|
31
|
+
orca export [run] -o file.html a single self-contained file you can attach
|
|
32
|
+
--card [f.svg|png|gif] one causal chain as a picture, ready to paste
|
|
33
|
+
--graph-card [f.svg|png] the whole run as a graph, with the chain lit
|
|
34
|
+
--to N which event the card is about (default: the failure)
|
|
35
|
+
orca scrub [run] --match X remove something from a recorded trace
|
|
36
|
+
--dry-run say what would go, and write nothing
|
|
37
|
+
--drop-fs delete the filesystem snapshots, which cannot be scrubbed
|
|
38
|
+
orca ui [run] serve the viewer locally
|
|
39
|
+
orca list runs recorded here
|
|
40
|
+
orca gc --older-than 7d reclaim space, forks' scratch worktrees included
|
|
41
|
+
--keep N, --dry-run
|
|
42
|
+
orca doctor check this machine can record at all
|
|
43
|
+
orca setup point orca at a gateway once, to compare many models
|
|
44
|
+
defaults to OrcaRouter; --gateway for any other
|
|
45
|
+
--gateway <url> origin that serves the model APIs
|
|
46
|
+
--key <k> | --key-env V store the key, or read it from an environment variable
|
|
47
|
+
--models a,b,c default model list, so compare needs no flags
|
|
48
|
+
orca models what the configured gateway serves, and what it costs
|
|
49
|
+
|
|
50
|
+
[run] is a run id, or "last" (the default).
|
|
51
|
+
|
|
52
|
+
Flags
|
|
53
|
+
--loose on replay, continue live past an unmatched request
|
|
54
|
+
--in-place replay against this directory as it stands, restoring nothing
|
|
55
|
+
--worktree replay in a scratch copy; never touches your files
|
|
56
|
+
--no-trace do not record the exact replay itself as a run of its own
|
|
57
|
+
--no-fs skip filesystem capture
|
|
58
|
+
--no-shell skip shell capture (PATH shim in front of sh/bash)
|
|
59
|
+
--mcp-config <path> instrument MCP servers from this config
|
|
60
|
+
--ci machine-readable output, no progress
|
|
61
|
+
--verbose more detail
|
|
62
|
+
--no-color also honours NO_COLOR
|
|
63
|
+
--port <n> port for --ui and orca ui (default: any free port)
|
|
64
|
+
|
|
65
|
+
A harness that reads no base-URL variable cannot be captured that way at all — a Codex CLI signed
|
|
66
|
+
in with a ChatGPT subscription is the case. For that, and only for that:
|
|
67
|
+
|
|
68
|
+
--tls-intercept decrypt HTTPS for the hosts below, for this run only
|
|
69
|
+
--tls-hosts a,b,c which hosts to decrypt (default: model API hosts)
|
|
70
|
+
everything else is tunnelled unread; "*" is refused
|
|
71
|
+
|
|
72
|
+
It mints a certificate authority in the run directory, trusts it to the agent through that
|
|
73
|
+
child's environment alone, and deletes it when the run ends. It installs nothing, anywhere.
|
|
74
|
+
If a machine is already behind a TLS-inspecting proxy, name its root in ORCA_TLS_UPSTREAM_CA.
|
|
75
|
+
|
|
76
|
+
Sending traffic somewhere other than the vendor — a gateway, a proxy, a local model — is what
|
|
77
|
+
these two are for. They apply to record, replay, fork and compare alike:
|
|
78
|
+
|
|
79
|
+
--upstream-anthropic <url> origin for /v1/messages (env ORCA_UPSTREAM_ANTHROPIC)
|
|
80
|
+
--upstream-openai <url> origin for /chat/completions (env ORCA_UPSTREAM_OPENAI)
|
|
81
|
+
|
|
82
|
+
Everything after -- goes to the agent:
|
|
83
|
+
orca record claude -- -p "fix the failing test"
|
|
84
|
+
|
|
85
|
+
For a script, an agent, or CI — every command below also answers as data:
|
|
86
|
+
|
|
87
|
+
--json one JSON document on stdout, diagnostics on stderr
|
|
88
|
+
list · show · events · checkpoints · graph · record · replay · compare
|
|
89
|
+
· doctor
|
|
90
|
+
|
|
91
|
+
orca mcp serve orca to an agent over MCP on stdio, so it can read its own runs:
|
|
92
|
+
{"command": "orca", "args": ["mcp"]}
|
|
93
|
+
|
|
94
|
+
Docs: https://github.com/Continuum-AI-Corp/OrcaReplay
|
|
95
|
+
`;
|
|
96
|
+
export async function main(argv, cwd = process.cwd()) {
|
|
97
|
+
const args = parseArgs(argv);
|
|
98
|
+
if (args.bool('json'))
|
|
99
|
+
return jsonMain(args, cwd);
|
|
100
|
+
// Under `orca mcp`, stdout is the JSON-RPC transport. A single info line on it corrupts the
|
|
101
|
+
// stream and the client drops the session with no useful error.
|
|
102
|
+
const toStderr = args.command === 'mcp';
|
|
103
|
+
const out = new Output({
|
|
104
|
+
write: (s) => void (toStderr ? process.stderr : process.stdout).write(s),
|
|
105
|
+
isTTY: Boolean(process.stdout.isTTY),
|
|
106
|
+
env: process.env,
|
|
107
|
+
verbose: args.bool('verbose'),
|
|
108
|
+
ci: args.bool('ci') || process.env.CI === 'true',
|
|
109
|
+
// `--no-color` parses to `color: false`. The `true` fallback is what separates that from an
|
|
110
|
+
// unset flag — `bool('color')` alone returns false for both, which would disable colour for
|
|
111
|
+
// everyone.
|
|
112
|
+
...(args.bool('color', true) ? {} : { color: false }),
|
|
113
|
+
});
|
|
114
|
+
if (args.bool('version') || args.command === 'version') {
|
|
115
|
+
out.plain(ORCA_VERSION);
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
if (args.command === 'help' || args.bool('help') || args.bool('h')) {
|
|
119
|
+
out.plain(HELP);
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
// Before anything runs: a flag the command does not have is an instruction that would be
|
|
124
|
+
// silently ignored, and a run that quietly did something else is the failure orca exists to
|
|
125
|
+
// surface. Inside the try so it is reported the same way every other failure is.
|
|
126
|
+
assertKnownFlags(args);
|
|
127
|
+
switch (args.command) {
|
|
128
|
+
case 'record':
|
|
129
|
+
return (await recordCommand(args, out, cwd)).exitCode;
|
|
130
|
+
case 'replay':
|
|
131
|
+
return (await replayCommand(args, out, cwd)).exitCode;
|
|
132
|
+
case 'compare':
|
|
133
|
+
await compareCommand(args, out, cwd);
|
|
134
|
+
return 0;
|
|
135
|
+
case 'show':
|
|
136
|
+
await showCommand(args, out, cwd);
|
|
137
|
+
return 0;
|
|
138
|
+
case 'checkpoints':
|
|
139
|
+
await checkpointsCommand(args, out, cwd);
|
|
140
|
+
return 0;
|
|
141
|
+
case 'graph':
|
|
142
|
+
await graphCommand(args, out, cwd);
|
|
143
|
+
return 0;
|
|
144
|
+
case 'export':
|
|
145
|
+
await exportCommand(args, out, cwd);
|
|
146
|
+
return 0;
|
|
147
|
+
case 'ui':
|
|
148
|
+
await uiCommand(args, out, cwd);
|
|
149
|
+
return 0;
|
|
150
|
+
case 'scrub':
|
|
151
|
+
await scrubCommand(args, out, cwd);
|
|
152
|
+
return 0;
|
|
153
|
+
case 'list':
|
|
154
|
+
await listCommand(args, out, cwd);
|
|
155
|
+
return 0;
|
|
156
|
+
case 'gc':
|
|
157
|
+
await gcCommand(args, out, cwd);
|
|
158
|
+
return 0;
|
|
159
|
+
case 'doctor':
|
|
160
|
+
// A failed check is the whole point of running this in CI, so it has to be visible in $?.
|
|
161
|
+
return (await doctorCommand(args, out, cwd)).ok ? 0 : 1;
|
|
162
|
+
case 'setup':
|
|
163
|
+
await setupCommand(args, out);
|
|
164
|
+
return 0;
|
|
165
|
+
case 'models':
|
|
166
|
+
await modelsCommand(args, out);
|
|
167
|
+
return 0;
|
|
168
|
+
case 'mcp':
|
|
169
|
+
// stdout is the transport here, so nothing else may touch it: `out` already writes to
|
|
170
|
+
// stderr under this command, and the server owns the stream until stdin closes.
|
|
171
|
+
await serveMcp({ orca: new Orca({ cwd }), input: process.stdin, output: process.stdout });
|
|
172
|
+
return 0;
|
|
173
|
+
default:
|
|
174
|
+
out.failure({
|
|
175
|
+
event: 'unknown_command',
|
|
176
|
+
what: `there is no "${args.command}" command`,
|
|
177
|
+
next: 'orca help',
|
|
178
|
+
});
|
|
179
|
+
return 2;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
184
|
+
const [first, ...rest] = message.split('\n');
|
|
185
|
+
out.failure({
|
|
186
|
+
event: `${args.command}.failed`,
|
|
187
|
+
what: first ?? message,
|
|
188
|
+
why: rest.join('\n').trim() || undefined,
|
|
189
|
+
});
|
|
190
|
+
if (out.isVerbose && err instanceof Error && err.stack)
|
|
191
|
+
out.plain(err.stack);
|
|
192
|
+
return 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* `--json`: one JSON document on stdout, diagnostics on stderr.
|
|
197
|
+
*
|
|
198
|
+
* The split is the whole design. A caller wants the answer, so stdout is one document rather than
|
|
199
|
+
* a stream of log objects — `orca show last --json | jq .events` works with nothing in front of
|
|
200
|
+
* it. And a run that warns must not corrupt that document, so every `info`/`warn` line goes to
|
|
201
|
+
* stderr, where a human still reads it and a parser never sees it.
|
|
202
|
+
*
|
|
203
|
+
* Failures come back as JSON too. An agent that only handles the happy path is an agent that
|
|
204
|
+
* hangs on the first bad run, so an error is a document with an `error` key and a non-zero exit,
|
|
205
|
+
* never prose.
|
|
206
|
+
*/
|
|
207
|
+
async function jsonMain(args, cwd) {
|
|
208
|
+
const out = new Output({
|
|
209
|
+
// Diagnostics only. Nothing here may reach stdout.
|
|
210
|
+
write: (s) => void process.stderr.write(s),
|
|
211
|
+
env: process.env,
|
|
212
|
+
verbose: args.bool('verbose'),
|
|
213
|
+
ci: true,
|
|
214
|
+
color: false,
|
|
215
|
+
});
|
|
216
|
+
const emit = (doc) => void process.stdout.write(`${JSON.stringify(doc)}\n`);
|
|
217
|
+
try {
|
|
218
|
+
const orca = new Orca({ cwd });
|
|
219
|
+
const selector = args.positionals[0] ?? 'last';
|
|
220
|
+
switch (args.command) {
|
|
221
|
+
case 'list':
|
|
222
|
+
emit(await orca.list());
|
|
223
|
+
return 0;
|
|
224
|
+
case 'show':
|
|
225
|
+
emit(await orca.show(selector));
|
|
226
|
+
return 0;
|
|
227
|
+
case 'events':
|
|
228
|
+
emit(await orca.events(selector));
|
|
229
|
+
return 0;
|
|
230
|
+
case 'checkpoints':
|
|
231
|
+
emit(await orca.checkpoints(selector));
|
|
232
|
+
return 0;
|
|
233
|
+
case 'graph':
|
|
234
|
+
emit(await orca.graph(selector, {
|
|
235
|
+
...(args.num('to') === undefined ? {} : { to: args.num('to') }),
|
|
236
|
+
}));
|
|
237
|
+
return 0;
|
|
238
|
+
case 'record': {
|
|
239
|
+
const result = await recordCommand(args, out, cwd);
|
|
240
|
+
emit(result);
|
|
241
|
+
return result.exitCode;
|
|
242
|
+
}
|
|
243
|
+
case 'replay': {
|
|
244
|
+
const result = await replayCommand(args, out, cwd);
|
|
245
|
+
emit(result);
|
|
246
|
+
return result.exitCode;
|
|
247
|
+
}
|
|
248
|
+
case 'compare':
|
|
249
|
+
emit(await compareCommand(args, out, cwd));
|
|
250
|
+
return 0;
|
|
251
|
+
case 'doctor': {
|
|
252
|
+
const result = await doctorCommand(args, out, cwd);
|
|
253
|
+
emit(result);
|
|
254
|
+
return result.ok ? 0 : 1;
|
|
255
|
+
}
|
|
256
|
+
default:
|
|
257
|
+
emit({
|
|
258
|
+
error: {
|
|
259
|
+
message: `--json does not cover '${args.command}'`,
|
|
260
|
+
// Naming what it does cover beats making someone try them one at a time.
|
|
261
|
+
supported: [
|
|
262
|
+
'list',
|
|
263
|
+
'show',
|
|
264
|
+
'events',
|
|
265
|
+
'checkpoints',
|
|
266
|
+
'graph',
|
|
267
|
+
'record',
|
|
268
|
+
'replay',
|
|
269
|
+
'compare',
|
|
270
|
+
'doctor',
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
return 2;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch (err) {
|
|
278
|
+
emit({ error: { message: err instanceof Error ? err.message : String(err) } });
|
|
279
|
+
return 1;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAmB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAA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Tool {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object';
|
|
8
|
+
properties: Record<string, unknown>;
|
|
9
|
+
required?: string[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const MCP_TOOLS: McpTool[];
|
|
13
|
+
type JsonRpcId = string | number;
|
|
14
|
+
interface JsonRpcResponse {
|
|
15
|
+
jsonrpc: '2.0';
|
|
16
|
+
id: JsonRpcId;
|
|
17
|
+
result?: unknown;
|
|
18
|
+
error?: {
|
|
19
|
+
code: number;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Handle one message.
|
|
25
|
+
*
|
|
26
|
+
* Returns `undefined` for a notification, which by definition has no id to answer — replying to
|
|
27
|
+
* one is a protocol error that some clients treat as fatal.
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleMcpMessage(orca: Orca, message: unknown): Promise<JsonRpcResponse | undefined>;
|
|
30
|
+
export interface ServeMcpOptions {
|
|
31
|
+
orca: Orca;
|
|
32
|
+
input: Readable;
|
|
33
|
+
output: Writable;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Serve MCP over a stream pair until the input ends.
|
|
37
|
+
*
|
|
38
|
+
* Messages are handled one at a time. Concurrency would buy nothing — every tool here is either a
|
|
39
|
+
* file read or a subprocess that owns the working tree — and it would let two replays fight over
|
|
40
|
+
* the same checkout.
|
|
41
|
+
*/
|
|
42
|
+
export declare function serveMcp({ orca, input, output }: ServeMcpOptions): Promise<void>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=mcp-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,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