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.
Files changed (109) hide show
  1. package/dist/api.d.ts +127 -0
  2. package/dist/api.d.ts.map +1 -0
  3. package/dist/api.js +159 -0
  4. package/dist/api.js.map +1 -0
  5. package/dist/args.d.ts +24 -0
  6. package/dist/args.d.ts.map +1 -0
  7. package/dist/args.js +124 -0
  8. package/dist/args.js.map +1 -0
  9. package/dist/cli.d.ts +3 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +4 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/commands/compare.d.ts +27 -0
  14. package/dist/commands/compare.d.ts.map +1 -0
  15. package/dist/commands/compare.js +182 -0
  16. package/dist/commands/compare.js.map +1 -0
  17. package/dist/commands/doctor.d.ts +24 -0
  18. package/dist/commands/doctor.d.ts.map +1 -0
  19. package/dist/commands/doctor.js +358 -0
  20. package/dist/commands/doctor.js.map +1 -0
  21. package/dist/commands/gc.d.ts +24 -0
  22. package/dist/commands/gc.d.ts.map +1 -0
  23. package/dist/commands/gc.js +326 -0
  24. package/dist/commands/gc.js.map +1 -0
  25. package/dist/commands/inspect.d.ts +24 -0
  26. package/dist/commands/inspect.d.ts.map +1 -0
  27. package/dist/commands/inspect.js +262 -0
  28. package/dist/commands/inspect.js.map +1 -0
  29. package/dist/commands/record.d.ts +17 -0
  30. package/dist/commands/record.d.ts.map +1 -0
  31. package/dist/commands/record.js +497 -0
  32. package/dist/commands/record.js.map +1 -0
  33. package/dist/commands/replay.d.ts +43 -0
  34. package/dist/commands/replay.d.ts.map +1 -0
  35. package/dist/commands/replay.js +800 -0
  36. package/dist/commands/replay.js.map +1 -0
  37. package/dist/commands/scrub.d.ts +34 -0
  38. package/dist/commands/scrub.d.ts.map +1 -0
  39. package/dist/commands/scrub.js +452 -0
  40. package/dist/commands/scrub.js.map +1 -0
  41. package/dist/commands/setup.d.ts +23 -0
  42. package/dist/commands/setup.d.ts.map +1 -0
  43. package/dist/commands/setup.js +177 -0
  44. package/dist/commands/setup.js.map +1 -0
  45. package/dist/config.d.ts +80 -0
  46. package/dist/config.d.ts.map +1 -0
  47. package/dist/config.js +117 -0
  48. package/dist/config.js.map +1 -0
  49. package/dist/exchange-events.d.ts +72 -0
  50. package/dist/exchange-events.d.ts.map +1 -0
  51. package/dist/exchange-events.js +170 -0
  52. package/dist/exchange-events.js.map +1 -0
  53. package/dist/flags.d.ts +10 -0
  54. package/dist/flags.d.ts.map +1 -0
  55. package/dist/flags.js +83 -0
  56. package/dist/flags.js.map +1 -0
  57. package/dist/fs-events.d.ts +19 -0
  58. package/dist/fs-events.d.ts.map +1 -0
  59. package/dist/fs-events.js +53 -0
  60. package/dist/fs-events.js.map +1 -0
  61. package/dist/index.d.ts +18 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +18 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/main.d.ts +2 -0
  66. package/dist/main.d.ts.map +1 -0
  67. package/dist/main.js +282 -0
  68. package/dist/main.js.map +1 -0
  69. package/dist/mcp-server.d.ts +44 -0
  70. package/dist/mcp-server.d.ts.map +1 -0
  71. package/dist/mcp-server.js +245 -0
  72. package/dist/mcp-server.js.map +1 -0
  73. package/dist/mcp.d.ts +111 -0
  74. package/dist/mcp.d.ts.map +1 -0
  75. package/dist/mcp.js +221 -0
  76. package/dist/mcp.js.map +1 -0
  77. package/dist/out.d.ts +69 -0
  78. package/dist/out.d.ts.map +1 -0
  79. package/dist/out.js +138 -0
  80. package/dist/out.js.map +1 -0
  81. package/dist/rasterize.d.ts +62 -0
  82. package/dist/rasterize.d.ts.map +1 -0
  83. package/dist/rasterize.js +154 -0
  84. package/dist/rasterize.js.map +1 -0
  85. package/dist/serial.d.ts +19 -0
  86. package/dist/serial.d.ts.map +1 -0
  87. package/dist/serial.js +34 -0
  88. package/dist/serial.js.map +1 -0
  89. package/dist/share-card.d.ts +73 -0
  90. package/dist/share-card.d.ts.map +1 -0
  91. package/dist/share-card.js +413 -0
  92. package/dist/share-card.js.map +1 -0
  93. package/dist/snapshot.d.ts +30 -0
  94. package/dist/snapshot.d.ts.map +1 -0
  95. package/dist/snapshot.js +43 -0
  96. package/dist/snapshot.js.map +1 -0
  97. package/dist/tls-capture.d.ts +57 -0
  98. package/dist/tls-capture.d.ts.map +1 -0
  99. package/dist/tls-capture.js +198 -0
  100. package/dist/tls-capture.js.map +1 -0
  101. package/dist/upstream.d.ts +20 -0
  102. package/dist/upstream.d.ts.map +1 -0
  103. package/dist/upstream.js +31 -0
  104. package/dist/upstream.js.map +1 -0
  105. package/dist/version.d.ts +2 -0
  106. package/dist/version.d.ts.map +1 -0
  107. package/dist/version.js +2 -0
  108. package/dist/version.js.map +1 -0
  109. package/package.json +49 -0
package/dist/api.d.ts ADDED
@@ -0,0 +1,127 @@
1
+ import { type Checkpoint, type RunGraph, type RunRef } from '@orcareplay/core';
2
+ import type { TraceEvent } from '@orcareplay/schema';
3
+ import { type LogEntry } from './out.js';
4
+ import { type RecordResult } from './commands/record.js';
5
+ import { type ReplayResult } from './commands/replay.js';
6
+ import { type CompareRow } from './commands/compare.js';
7
+ /**
8
+ * Driving orca from code.
9
+ *
10
+ * Everything orca knew was reachable only by running a command and reading a terminal: `orca show`
11
+ * computed a timeline and formatted it away, `orca list` returned `void`. Anyone who wanted to ask
12
+ * "what diverged when I replayed that run?" — a script, a CI job, an agent debugging its own
13
+ * failure — had to parse `info replay.done reused=2/2 exact=2 divergences=0` out of stdout.
14
+ *
15
+ * This returns the same work as data. The commands render what it returns, so the terminal is a
16
+ * view of one source of truth rather than the only place the truth exists. Two rules follow from
17
+ * that and are asserted in the tests:
18
+ *
19
+ * - Nothing here writes to the embedding process's stdout. A library that prints over its
20
+ * caller's output cannot be built on, and it breaks every JSON consumer downstream.
21
+ * - Nothing here calls `process.exit`. Failures throw errors that name the run.
22
+ */
23
+ export interface OrcaOptions {
24
+ /** Project whose `.orca/runs` is being read. Defaults to the current directory. */
25
+ cwd?: string;
26
+ /** Receives orca's own log lines as structured records, for a caller that wants progress. */
27
+ onLog?: (entry: LogEntry) => void;
28
+ }
29
+ /** One row of `orca show`, as data rather than a formatted line. */
30
+ export interface TimelineRow {
31
+ seq: number;
32
+ turn?: number;
33
+ kind: string;
34
+ label: string;
35
+ detail?: string;
36
+ meta?: string;
37
+ }
38
+ export interface Timeline {
39
+ runId: string;
40
+ adapter: string;
41
+ eventCount: number;
42
+ /** `null` where the run has no exit code — a trace cut short, not an exit of zero. */
43
+ exitCode: number | null;
44
+ /** Present when this run came from another — a fork, or an exact replay's own trace. */
45
+ parentRun?: string;
46
+ forkPoint?: number;
47
+ forkModel?: string;
48
+ usage: {
49
+ input: number;
50
+ output: number;
51
+ };
52
+ events: TimelineRow[];
53
+ /** Runs where the agent repeated itself rather than making progress. */
54
+ loops: {
55
+ turns: number[];
56
+ kind: 'repeated-action' | 'error-spin';
57
+ signature?: string;
58
+ repeats?: number;
59
+ tree?: string;
60
+ }[];
61
+ }
62
+ export interface RecordOptions {
63
+ /** Adapter id or alias, e.g. `claude`, `codex`, `node`, `generic-openai`. */
64
+ adapter: string;
65
+ /** The command to launch, for adapters that take one. */
66
+ command?: string[];
67
+ /** Origin overrides by dialect id, as `--upstream-anthropic` / `--upstream-openai` would set. */
68
+ upstream?: Record<string, string>;
69
+ /** Extra flags, passed through verbatim — the escape hatch for anything not modelled here. */
70
+ flags?: string[];
71
+ }
72
+ export interface RecordOutcome extends RecordResult {
73
+ /** Everything orca warned about during the run, so a caller with no terminal still sees it. */
74
+ warnings: LogEntry[];
75
+ }
76
+ export interface ReplayOptions {
77
+ /** Checkpoint to fork from. Omit for an exact replay. */
78
+ from?: number;
79
+ /** Model to run from the fork point onward. */
80
+ model?: string;
81
+ /** Run in a scratch worktree instead of over the working tree. */
82
+ worktree?: boolean;
83
+ flags?: string[];
84
+ }
85
+ export interface CompareOptions {
86
+ from?: number;
87
+ models: string[];
88
+ /** Command whose exit code is the verdict. */
89
+ verify?: string;
90
+ flags?: string[];
91
+ }
92
+ export declare class Orca {
93
+ #private;
94
+ readonly cwd: string;
95
+ constructor(options?: OrcaOptions);
96
+ /** Every run in this project, newest first. Empty rather than an error when there are none. */
97
+ list(): Promise<RunRef[]>;
98
+ /** The raw event stream. A rendered row is a view; this is the thing itself. */
99
+ events(selector?: string): Promise<TraceEvent[]>;
100
+ /** What `orca show` prints, as objects. */
101
+ show(selector?: string): Promise<Timeline>;
102
+ /** Where a fork can start: points whose conversation prefix is complete and tree was snapshotted. */
103
+ checkpoints(selector?: string): Promise<Checkpoint[]>;
104
+ /**
105
+ * What caused what in a run, as nodes and typed edges.
106
+ *
107
+ * `to` narrows it to the chain that produced one event, which is the shape of an answer to
108
+ * "why did this fail" rather than "what happened". Every edge says whether the trace recorded
109
+ * it or this derived it, so a caller can weigh the two differently.
110
+ */
111
+ graph(selector?: string, options?: {
112
+ to?: number;
113
+ }): Promise<RunGraph>;
114
+ /** The absolute path of a run's directory, for a caller that wants to read it directly. */
115
+ runDir(selector?: string): Promise<string>;
116
+ record(options: RecordOptions): Promise<RecordOutcome>;
117
+ replay(selector?: string, options?: ReplayOptions): Promise<ReplayResult>;
118
+ compare(selector: string | undefined, options: CompareOptions): Promise<CompareRow[]>;
119
+ /** Write the run as one self-contained HTML file. */
120
+ export(selector: string | undefined, options: {
121
+ out: string;
122
+ }): Promise<{
123
+ path: string;
124
+ bytes: number;
125
+ }>;
126
+ }
127
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACjD,O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ACG,KAAK,CAAC,QAAQ,SAAS,EAAE,OAAO,GAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKhF,2FAA2F;IACrF,MAAM,CAAC,QAAQ,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ1C,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBtD,MAAM,CAAC,QAAQ,SAAS,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAS7E,OAAO,CAAC,QAAQ,oBAAS,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAQhF,qDAAqD;IAC/C,MAAM,CACV,QAAQ,oBAAS,EACjB,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GACvB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CA6B5C"}
package/dist/api.js ADDED
@@ -0,0 +1,159 @@
1
+ import { resolve } from 'node:path';
2
+ import { TraceReader, chainTo, deriveCheckpoints, listRuns, resolveRunSelector, runGraph, } from '@orcareplay/core';
3
+ import { buildTimeline, detectLoops, exportTraceHtml, summarize } from '@orcareplay/viewer';
4
+ import { parseArgs } from './args.js';
5
+ import { Output } from './out.js';
6
+ import { recordCommand } from './commands/record.js';
7
+ import { replayCommand } from './commands/replay.js';
8
+ import { compareCommand } from './commands/compare.js';
9
+ /**
10
+ * What every command run through this API is told: orca's stdout belongs to someone else.
11
+ *
12
+ * `record`, `replay` and `compare` all spawn a real agent, and they spawn it with
13
+ * `stdio: 'inherit'` — the file descriptor, which no in-process substitution can intercept. So an
14
+ * embedded caller got the agent's output written over its own, and under `orca mcp` that
15
+ * descriptor *is* the JSON-RPC transport: one line of agent chatter ends the session.
16
+ *
17
+ * `--json` is the existing spelling of "stdout is not a terminal here". The commands read it only
18
+ * to route the child's stdout to stderr; the document itself is written by `jsonMain`, which this
19
+ * path never reaches.
20
+ */
21
+ const QUIET = ['--json'];
22
+ export class Orca {
23
+ cwd;
24
+ #onLog;
25
+ constructor(options = {}) {
26
+ this.cwd = options.cwd ?? process.cwd();
27
+ this.#onLog = options.onLog;
28
+ }
29
+ // -------------------------------------------------------------------------
30
+ // reading
31
+ // -------------------------------------------------------------------------
32
+ /** Every run in this project, newest first. Empty rather than an error when there are none. */
33
+ async list() {
34
+ return listRuns(this.cwd);
35
+ }
36
+ /** The raw event stream. A rendered row is a view; this is the thing itself. */
37
+ async events(selector = 'last') {
38
+ return (await this.#reader(selector)).events();
39
+ }
40
+ /** What `orca show` prints, as objects. */
41
+ async show(selector = 'last') {
42
+ const reader = await this.#reader(selector);
43
+ const manifest = reader.manifest();
44
+ const events = await reader.events();
45
+ const summary = summarize(manifest, events);
46
+ return {
47
+ runId: summary.runId,
48
+ adapter: summary.adapter,
49
+ eventCount: summary.eventCount,
50
+ exitCode: summary.exitCode,
51
+ parentRun: manifest.parent_run,
52
+ forkPoint: manifest.fork_point,
53
+ forkModel: manifest.fork_model,
54
+ usage: { input: summary.totalUsage.input, output: summary.totalUsage.output },
55
+ events: buildTimeline(events).map((row) => ({
56
+ seq: row.seq,
57
+ turn: row.turn,
58
+ kind: row.kind,
59
+ label: row.label,
60
+ detail: row.detail,
61
+ meta: row.meta,
62
+ })),
63
+ loops: detectLoops(events).map((loop) => ({
64
+ turns: loop.turns,
65
+ kind: loop.kind,
66
+ signature: loop.signature,
67
+ repeats: loop.repeats,
68
+ tree: loop.tree,
69
+ })),
70
+ };
71
+ }
72
+ /** Where a fork can start: points whose conversation prefix is complete and tree was snapshotted. */
73
+ async checkpoints(selector = 'last') {
74
+ return deriveCheckpoints(await this.events(selector));
75
+ }
76
+ /**
77
+ * What caused what in a run, as nodes and typed edges.
78
+ *
79
+ * `to` narrows it to the chain that produced one event, which is the shape of an answer to
80
+ * "why did this fail" rather than "what happened". Every edge says whether the trace recorded
81
+ * it or this derived it, so a caller can weigh the two differently.
82
+ */
83
+ async graph(selector = 'last', options = {}) {
84
+ const graph = runGraph(await this.events(selector));
85
+ return options.to === undefined ? graph : chainTo(graph, options.to);
86
+ }
87
+ /** The absolute path of a run's directory, for a caller that wants to read it directly. */
88
+ async runDir(selector = 'last') {
89
+ return (await resolveRunSelector(this.cwd, selector)).dir;
90
+ }
91
+ // -------------------------------------------------------------------------
92
+ // doing
93
+ // -------------------------------------------------------------------------
94
+ async record(options) {
95
+ const argv = ['record', options.adapter];
96
+ for (const [dialect, origin] of Object.entries(options.upstream ?? {})) {
97
+ // Flags are named for the provider, not the dialect: `openai-responses` shares
98
+ // `--upstream-openai` with chat completions, because it is one origin serving both.
99
+ argv.push(`--upstream-${dialect.replace(/-responses$/, '')}`, origin);
100
+ }
101
+ argv.push(...QUIET, ...(options.flags ?? []));
102
+ if (options.command && options.command.length > 0)
103
+ argv.push('--', ...options.command);
104
+ const { out, entries } = this.#collect();
105
+ const result = await recordCommand(parseArgs(argv), out, this.cwd);
106
+ return {
107
+ ...result,
108
+ warnings: entries.filter((e) => e.level === 'warn' || e.level === 'error'),
109
+ };
110
+ }
111
+ async replay(selector = 'last', options = {}) {
112
+ const argv = ['replay', selector];
113
+ if (options.from !== undefined)
114
+ argv.push('--from', String(options.from));
115
+ if (options.model !== undefined)
116
+ argv.push('--model', options.model);
117
+ if (options.worktree === true)
118
+ argv.push('--worktree');
119
+ argv.push(...QUIET, ...(options.flags ?? []));
120
+ return replayCommand(parseArgs(argv), this.#collect().out, this.cwd);
121
+ }
122
+ async compare(selector = 'last', options) {
123
+ const argv = ['compare', selector, '--models', options.models.join(',')];
124
+ if (options.from !== undefined)
125
+ argv.push('--from', String(options.from));
126
+ if (options.verify !== undefined)
127
+ argv.push('--verify', options.verify);
128
+ argv.push(...QUIET, ...(options.flags ?? []));
129
+ return compareCommand(parseArgs(argv), this.#collect().out, this.cwd);
130
+ }
131
+ /** Write the run as one self-contained HTML file. */
132
+ async export(selector = 'last', options) {
133
+ return exportTraceHtml(await this.runDir(selector), resolve(this.cwd, options.out));
134
+ }
135
+ // -------------------------------------------------------------------------
136
+ async #reader(selector) {
137
+ return TraceReader.open((await resolveRunSelector(this.cwd, selector)).dir);
138
+ }
139
+ /**
140
+ * An `Output` that goes nowhere near a terminal.
141
+ *
142
+ * The commands were written to print, and rewriting all of them to return data instead would be
143
+ * a much larger change than the one that is actually needed — so the API gives them a sink that
144
+ * keeps the facts and drops the formatting.
145
+ */
146
+ #collect() {
147
+ const entries = [];
148
+ const onLog = this.#onLog;
149
+ const out = new Output({
150
+ write: () => { },
151
+ sink: (entry) => {
152
+ entries.push(entry);
153
+ onLog?.(entry);
154
+ },
155
+ });
156
+ return { out, entries };
157
+ }
158
+ }
159
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,WAAW,EACX,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,QAAQ,GAIT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAmB,MAAM,uBAAuB,CAAC;AA4FxE;;;;;;;;;;;GAWG;AACH,MAAM,KAAK,GAAG,CAAC,QAAQ,CAAU,CAAC;AAElC,MAAM,OAAO,IAAI;IACN,GAAG,CAAS;IACZ,MAAM,CAA0C;IA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AC,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACxE,CAAC;IAED,qDAAqD;IACrD,KAAK,CAAC,MAAM,CACV,QAAQ,GAAG,MAAM,EACjB,OAAwB;QAExB,OAAO,eAAe,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,4EAA4E;IAE5E,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;OAMG;IACH,QAAQ;QACN,MAAM,OAAO,GAAe,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC;YACrB,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;YACf,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;gBACd,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACpB,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IAC1B,CAAC;CACF"}
package/dist/args.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Argument parsing.
3
+ *
4
+ * Hand-rolled on purpose: a debugger you install to diagnose a broken environment should not drag
5
+ * in a dependency tree of its own. The one rule worth stating is that everything after a bare
6
+ * `--` belongs to the child agent, never to us — `orca record claude -- -p "fix the test"` has to
7
+ * forward those bytes untouched.
8
+ */
9
+ export type FlagValue = string | number | boolean;
10
+ export interface ParsedArgs {
11
+ command: string;
12
+ positionals: string[];
13
+ flags: Record<string, FlagValue>;
14
+ /** Everything after a bare `--`, forwarded verbatim to the agent. */
15
+ passthrough: string[];
16
+ /** Read a flag as a comma-separated list. */
17
+ list(name: string): string[];
18
+ has(name: string): boolean;
19
+ str(name: string, fallback?: string): string | undefined;
20
+ num(name: string, fallback?: number): number | undefined;
21
+ bool(name: string, fallback?: boolean): boolean;
22
+ }
23
+ export declare function parseArgs(argv: string[]): ParsedArgs;
24
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,qEAAqE;IACrE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,6CAA6C;IAC7C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CACjD;AA+CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAwEpD"}
package/dist/args.js ADDED
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Argument parsing.
3
+ *
4
+ * Hand-rolled on purpose: a debugger you install to diagnose a broken environment should not drag
5
+ * in a dependency tree of its own. The one rule worth stating is that everything after a bare
6
+ * `--` belongs to the child agent, never to us — `orca record claude -- -p "fix the test"` has to
7
+ * forward those bytes untouched.
8
+ */
9
+ /**
10
+ * Flags that never take a value.
11
+ *
12
+ * Without this list any flag followed by a non-flag token swallowed it, so the flag read as false
13
+ * *and* the positional vanished. `orca replay --worktree last` then restored the recorded tree over
14
+ * the working directory — the exact opposite of what `--worktree` promises — and
15
+ * `orca record --tls-intercept codex` turned interception off while losing the agent name, so
16
+ * record auto-detected and could capture a different harness. Neither said anything.
17
+ *
18
+ * A list rather than a heuristic, because the alternative is guessing from the shape of the next
19
+ * token, and `orca compare --models last` would guess wrong. `--flag=value` and `--no-flag` still
20
+ * work for these; they are handled before this point.
21
+ */
22
+ const VALUELESS = new Set([
23
+ 'ui',
24
+ 'json',
25
+ 'loose',
26
+ 'in-place',
27
+ 'worktree',
28
+ 'trace',
29
+ 'fs',
30
+ 'shell',
31
+ 'ci',
32
+ 'verbose',
33
+ 'color',
34
+ 'dry-run',
35
+ 'drop-fs',
36
+ 'tls-intercept',
37
+ 'version',
38
+ 'help',
39
+ ]);
40
+ function coerce(raw) {
41
+ if (raw === 'true')
42
+ return true;
43
+ if (raw === 'false')
44
+ return false;
45
+ // Only a complete numeric literal becomes a number; "5.3-flash" must stay a string.
46
+ if (/^-?\d+(\.\d+)?$/.test(raw))
47
+ return Number(raw);
48
+ return raw;
49
+ }
50
+ /** A token is a flag only if it is not a negative number: `--from -1` passes -1 as a value. */
51
+ function isFlag(token) {
52
+ return token.startsWith('-') && token !== '-' && !/^-?\d+(\.\d+)?$/.test(token);
53
+ }
54
+ export function parseArgs(argv) {
55
+ const flags = {};
56
+ const positionals = [];
57
+ let passthrough = [];
58
+ const separator = argv.indexOf('--');
59
+ const own = separator === -1 ? argv.slice() : argv.slice(0, separator);
60
+ if (separator !== -1)
61
+ passthrough = argv.slice(separator + 1);
62
+ for (let i = 0; i < own.length; i += 1) {
63
+ const token = own[i];
64
+ if (!isFlag(token)) {
65
+ positionals.push(token);
66
+ continue;
67
+ }
68
+ const isLong = token.startsWith('--');
69
+ const body = isLong ? token.slice(2) : token.slice(1);
70
+ const eq = body.indexOf('=');
71
+ if (eq !== -1) {
72
+ flags[body.slice(0, eq)] = coerce(body.slice(eq + 1));
73
+ continue;
74
+ }
75
+ if (isLong && body.startsWith('no-')) {
76
+ flags[body.slice(3)] = false;
77
+ continue;
78
+ }
79
+ const next = own[i + 1];
80
+ if (!VALUELESS.has(body) && next !== undefined && !isFlag(next)) {
81
+ flags[body] = coerce(next);
82
+ i += 1;
83
+ }
84
+ else {
85
+ flags[body] = true;
86
+ }
87
+ }
88
+ const command = positionals.shift() ?? 'help';
89
+ return {
90
+ command,
91
+ positionals,
92
+ flags,
93
+ passthrough,
94
+ list(name) {
95
+ const v = flags[name];
96
+ if (v === undefined || typeof v === 'boolean')
97
+ return [];
98
+ return String(v)
99
+ .split(',')
100
+ .map((s) => s.trim())
101
+ .filter(Boolean);
102
+ },
103
+ has(name) {
104
+ return name in flags;
105
+ },
106
+ str(name, fallback) {
107
+ const v = flags[name];
108
+ return v === undefined || typeof v === 'boolean' ? fallback : String(v);
109
+ },
110
+ num(name, fallback) {
111
+ const v = flags[name];
112
+ if (typeof v === 'number')
113
+ return v;
114
+ if (typeof v === 'string' && /^-?\d+(\.\d+)?$/.test(v))
115
+ return Number(v);
116
+ return fallback;
117
+ },
118
+ bool(name, fallback = false) {
119
+ const v = flags[name];
120
+ return typeof v === 'boolean' ? v : fallback;
121
+ },
122
+ };
123
+ }
124
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH;;;;;;;;;;;;GAYG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,IAA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CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { main } from './main.js';
3
+ process.exitCode = await main(process.argv.slice(2));
4
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type ParsedArgs } from '../args.js';
2
+ import type { Output } from '../out.js';
3
+ export interface CompareRow {
4
+ /** Exit code of --verify, when one was given. This, not the agent's exit code, is the verdict. */
5
+ verifyExitCode?: number;
6
+ model: string;
7
+ verdict: 'pass' | 'fail';
8
+ exitCode: number;
9
+ divergences: number;
10
+ inputTokens: number;
11
+ outputTokens: number;
12
+ cost: number | null;
13
+ wallMs: number;
14
+ forkRunId?: string;
15
+ error?: string;
16
+ }
17
+ /**
18
+ * `orca compare <run> --models a,b,c`
19
+ *
20
+ * N forks from one checkpoint. The comparison only means anything because every branch starts
21
+ * from an identical filesystem tree and conversation prefix — the model is the only variable, so
22
+ * the difference in outcome is attributable to it rather than to drift.
23
+ */
24
+ export declare function compareCommand(args: ParsedArgs, out: Output, cwd?: string): Promise<CompareRow[]>;
25
+ /** Dash for unknown. Otherwise enough precision that a genuinely cheap model does not read $0. */
26
+ export declare function formatCost(amount: number | null): string;
27
+ //# sourceMappingURL=compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/commands/compare.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA6BxC,MAAM,WAAW,UAAU;IACzB,kGAAkG;IAClG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,SAAgB,GAClB,OAAO,CAAC,UAAU,EAAE,CAAC,CAqIvB;AAED,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAMxD"}