evalbuff 0.0.1
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 +79 -0
- package/dist/carve-features.d.ts +42 -0
- package/dist/carve-features.d.ts.map +1 -0
- package/dist/carve-features.js +305 -0
- package/dist/carve-features.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +42 -0
- package/dist/cli.js.map +1 -0
- package/dist/docs-refactor.d.ts +4 -0
- package/dist/docs-refactor.d.ts.map +1 -0
- package/dist/docs-refactor.js +122 -0
- package/dist/docs-refactor.js.map +1 -0
- package/dist/docs-writer.d.ts +4 -0
- package/dist/docs-writer.d.ts.map +1 -0
- package/dist/docs-writer.js +122 -0
- package/dist/docs-writer.js.map +1 -0
- package/dist/eval-helpers.d.ts +19 -0
- package/dist/eval-helpers.d.ts.map +1 -0
- package/dist/eval-helpers.js +327 -0
- package/dist/eval-helpers.js.map +1 -0
- package/dist/eval-runner.d.ts +42 -0
- package/dist/eval-runner.d.ts.map +1 -0
- package/dist/eval-runner.js +193 -0
- package/dist/eval-runner.js.map +1 -0
- package/dist/judge.d.ts +22 -0
- package/dist/judge.d.ts.map +1 -0
- package/dist/judge.js +284 -0
- package/dist/judge.js.map +1 -0
- package/dist/perfect-feature.d.ts +2 -0
- package/dist/perfect-feature.d.ts.map +1 -0
- package/dist/perfect-feature.js +666 -0
- package/dist/perfect-feature.js.map +1 -0
- package/dist/report.d.ts +31 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +249 -0
- package/dist/report.js.map +1 -0
- package/dist/run-evalbuff.d.ts +12 -0
- package/dist/run-evalbuff.d.ts.map +1 -0
- package/dist/run-evalbuff.js +383 -0
- package/dist/run-evalbuff.js.map +1 -0
- package/dist/runners/claude.d.ts +10 -0
- package/dist/runners/claude.d.ts.map +1 -0
- package/dist/runners/claude.js +80 -0
- package/dist/runners/claude.js.map +1 -0
- package/dist/runners/codebuff.d.ts +24 -0
- package/dist/runners/codebuff.d.ts.map +1 -0
- package/dist/runners/codebuff.js +88 -0
- package/dist/runners/codebuff.js.map +1 -0
- package/dist/runners/codex.d.ts +8 -0
- package/dist/runners/codex.d.ts.map +1 -0
- package/dist/runners/codex.js +131 -0
- package/dist/runners/codex.js.map +1 -0
- package/dist/runners/index.d.ts +5 -0
- package/dist/runners/index.d.ts.map +1 -0
- package/dist/runners/index.js +4 -0
- package/dist/runners/index.js.map +1 -0
- package/dist/runners/runner.d.ts +11 -0
- package/dist/runners/runner.d.ts.map +1 -0
- package/dist/runners/runner.js +2 -0
- package/dist/runners/runner.js.map +1 -0
- package/dist/test-repo-utils.d.ts +21 -0
- package/dist/test-repo-utils.d.ts.map +1 -0
- package/dist/test-repo-utils.js +109 -0
- package/dist/test-repo-utils.js.map +1 -0
- package/dist/trace-compressor.d.ts +130 -0
- package/dist/trace-compressor.d.ts.map +1 -0
- package/dist/trace-compressor.js +680 -0
- package/dist/trace-compressor.js.map +1 -0
- package/dist/tui/data.d.ts +84 -0
- package/dist/tui/data.d.ts.map +1 -0
- package/dist/tui/data.js +80 -0
- package/dist/tui/data.js.map +1 -0
- package/dist/tui/events.d.ts +86 -0
- package/dist/tui/events.d.ts.map +1 -0
- package/dist/tui/events.js +52 -0
- package/dist/tui/events.js.map +1 -0
- package/dist/vendor/error.d.ts +18 -0
- package/dist/vendor/error.d.ts.map +1 -0
- package/dist/vendor/error.js +64 -0
- package/dist/vendor/error.js.map +1 -0
- package/dist/vendor/print-mode.d.ts +75 -0
- package/dist/vendor/print-mode.d.ts.map +1 -0
- package/dist/vendor/print-mode.js +2 -0
- package/dist/vendor/print-mode.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Runner, RunnerResult } from './runner';
|
|
2
|
+
export declare class CodexRunner implements Runner {
|
|
3
|
+
private cwd;
|
|
4
|
+
private env;
|
|
5
|
+
constructor(cwd: string, env?: Record<string, string>);
|
|
6
|
+
run(prompt: string): Promise<RunnerResult>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/runners/codex.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAa,MAAM,UAAU,CAAA;AAG/D,qBAAa,WAAY,YAAW,MAAM;IACxC,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,GAAG,CAAwB;gBAEvB,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAKnD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CA6DjD"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { Codex } from '@openai/codex-sdk';
|
|
3
|
+
import { captureGitDiff } from '../eval-helpers';
|
|
4
|
+
export class CodexRunner {
|
|
5
|
+
cwd;
|
|
6
|
+
env;
|
|
7
|
+
constructor(cwd, env = {}) {
|
|
8
|
+
this.cwd = cwd;
|
|
9
|
+
this.env = env;
|
|
10
|
+
}
|
|
11
|
+
async run(prompt) {
|
|
12
|
+
const steps = [];
|
|
13
|
+
const baseSha = execSync('git rev-parse HEAD', {
|
|
14
|
+
cwd: this.cwd,
|
|
15
|
+
encoding: 'utf-8',
|
|
16
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
17
|
+
}).trim();
|
|
18
|
+
const codex = new Codex({
|
|
19
|
+
apiKey: process.env.OPENAI_API_KEY || this.env.OPENAI_API_KEY,
|
|
20
|
+
});
|
|
21
|
+
const thread = codex.startThread({
|
|
22
|
+
model: 'gpt-5.4',
|
|
23
|
+
workingDirectory: this.cwd,
|
|
24
|
+
approvalPolicy: 'never',
|
|
25
|
+
sandboxMode: 'workspace-write',
|
|
26
|
+
webSearchMode: 'live',
|
|
27
|
+
});
|
|
28
|
+
console.log(`[CodexRunner] Starting thread in ${this.cwd}`);
|
|
29
|
+
const { events } = await thread.runStreamed(prompt);
|
|
30
|
+
let usage = null;
|
|
31
|
+
for await (const event of events) {
|
|
32
|
+
switch (event.type) {
|
|
33
|
+
case 'item.completed':
|
|
34
|
+
processItem(event.item, steps);
|
|
35
|
+
break;
|
|
36
|
+
case 'turn.completed':
|
|
37
|
+
usage = event.usage;
|
|
38
|
+
break;
|
|
39
|
+
case 'turn.failed':
|
|
40
|
+
console.error(`[CodexRunner] Turn failed: ${event.error.message}`);
|
|
41
|
+
break;
|
|
42
|
+
case 'error':
|
|
43
|
+
console.error(`[CodexRunner] Error: ${event.message}`);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Get git diff after Codex has made changes
|
|
48
|
+
let diff = '';
|
|
49
|
+
try {
|
|
50
|
+
diff = captureGitDiff(this.cwd, { baseRef: baseSha });
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Ignore git errors
|
|
54
|
+
}
|
|
55
|
+
// Estimate cost from token usage (rough GPT-5.1-codex pricing)
|
|
56
|
+
const totalCostUsd = usage
|
|
57
|
+
? (usage.input_tokens * 2 + usage.output_tokens * 8) / 1_000_000
|
|
58
|
+
: 0;
|
|
59
|
+
return {
|
|
60
|
+
steps,
|
|
61
|
+
totalCostUsd,
|
|
62
|
+
diff,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function processItem(item, steps) {
|
|
67
|
+
switch (item.type) {
|
|
68
|
+
case 'agent_message':
|
|
69
|
+
steps.push({ type: 'text', text: item.text });
|
|
70
|
+
process.stdout.write(item.text);
|
|
71
|
+
break;
|
|
72
|
+
case 'command_execution':
|
|
73
|
+
steps.push({
|
|
74
|
+
type: 'tool_call',
|
|
75
|
+
toolName: 'shell',
|
|
76
|
+
toolCallId: item.id,
|
|
77
|
+
input: { command: item.command },
|
|
78
|
+
});
|
|
79
|
+
if (item.aggregated_output) {
|
|
80
|
+
steps.push({
|
|
81
|
+
type: 'tool_result',
|
|
82
|
+
toolName: 'shell',
|
|
83
|
+
toolCallId: item.id,
|
|
84
|
+
output: [{ type: 'json', value: item.aggregated_output }],
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'file_change':
|
|
89
|
+
steps.push({
|
|
90
|
+
type: 'tool_call',
|
|
91
|
+
toolName: 'file_change',
|
|
92
|
+
toolCallId: item.id,
|
|
93
|
+
input: { changes: item.changes },
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
case 'mcp_tool_call':
|
|
97
|
+
steps.push({
|
|
98
|
+
type: 'tool_call',
|
|
99
|
+
toolName: `mcp:${item.server}:${item.tool}`,
|
|
100
|
+
toolCallId: item.id,
|
|
101
|
+
input: item.arguments,
|
|
102
|
+
});
|
|
103
|
+
if (item.result || item.error) {
|
|
104
|
+
steps.push({
|
|
105
|
+
type: 'tool_result',
|
|
106
|
+
toolName: `mcp:${item.server}:${item.tool}`,
|
|
107
|
+
toolCallId: item.id,
|
|
108
|
+
output: [{ type: 'json', value: item.result || item.error }],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
break;
|
|
112
|
+
case 'web_search':
|
|
113
|
+
steps.push({
|
|
114
|
+
type: 'tool_call',
|
|
115
|
+
toolName: 'web_search',
|
|
116
|
+
toolCallId: item.id,
|
|
117
|
+
input: { query: item.query },
|
|
118
|
+
});
|
|
119
|
+
break;
|
|
120
|
+
case 'reasoning':
|
|
121
|
+
// Skip reasoning items, they're internal
|
|
122
|
+
break;
|
|
123
|
+
case 'todo_list':
|
|
124
|
+
// Skip todo lists
|
|
125
|
+
break;
|
|
126
|
+
case 'error':
|
|
127
|
+
console.error(`[CodexRunner] Item error: ${item.message}`);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=codex.js.map
|
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AQ,EAAE,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;oBAC3C,UAAU,EAAE,IAAI,CAAC,EAAE;oBACnB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;iBAC7D,CAAC,CAAA;YACJ,CAAC;YACD,MAAK;QACP,KAAK,YAAY;YACf,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,WAAW;gBACjB,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE,IAAI,CAAC,EAAE;gBACnB,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;aAC7B,CAAC,CAAA;YACF,MAAK;QACP,KAAK,WAAW;YACd,yCAAyC;YACzC,MAAK;QACP,KAAK,WAAW;YACd,kBAAkB;YAClB,MAAK;QACP,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,CAAC,6BAA6B,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;YAC1D,MAAK;IACT,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runners/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runners/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PrintModeEvent } from '../vendor/print-mode';
|
|
2
|
+
export type AgentStep = PrintModeEvent;
|
|
3
|
+
export type RunnerResult = {
|
|
4
|
+
steps: AgentStep[];
|
|
5
|
+
totalCostUsd: number;
|
|
6
|
+
diff: string;
|
|
7
|
+
};
|
|
8
|
+
export interface Runner {
|
|
9
|
+
run: (prompt: string) => Promise<RunnerResult>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runners/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,cAAc,CAAA;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runners/runner.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to manage test repository lifecycle
|
|
3
|
+
* Sets up a test repo, runs a function with the repo cwd, then cleans up.
|
|
4
|
+
*
|
|
5
|
+
* When localRepoPath is provided, uses a local clone (near-instant via hardlinks)
|
|
6
|
+
* instead of a remote clone (5-30s per clone). This is the single biggest
|
|
7
|
+
* speedup in evalbuff — with parallelism=5, saves 10-30 remote clones per commit.
|
|
8
|
+
*/
|
|
9
|
+
export declare const withTestRepo: <T>(repoConfig: {
|
|
10
|
+
repoUrl: string;
|
|
11
|
+
localRepoPath?: string;
|
|
12
|
+
parentSha: string;
|
|
13
|
+
initCommand?: string;
|
|
14
|
+
env?: Record<string, string>;
|
|
15
|
+
}, fn: (cwd: string) => Promise<T>) => Promise<T>;
|
|
16
|
+
export declare const withTestRepoAndParent: <T>(repoConfig: {
|
|
17
|
+
repoUrl: string;
|
|
18
|
+
commitSha: string;
|
|
19
|
+
initCommand?: string;
|
|
20
|
+
}, fn: (cwd: string, commitSha: string, parentSha: string) => Promise<T>) => Promise<T | null>;
|
|
21
|
+
//# sourceMappingURL=test-repo-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-repo-utils.d.ts","sourceRoot":"","sources":["../src/test-repo-utils.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,EAClC,YAAY;IACV,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B,EACD,IAAI,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAC9B,OAAO,CAAC,CAAC,CAgDX,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAU,CAAC,EAC3C,YAAY;IACV,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,EACD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KACpE,OAAO,CAAC,CAAC,GAAG,IAAI,CA4DlB,CAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { getErrorObject } from './vendor/error';
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to manage test repository lifecycle
|
|
8
|
+
* Sets up a test repo, runs a function with the repo cwd, then cleans up.
|
|
9
|
+
*
|
|
10
|
+
* When localRepoPath is provided, uses a local clone (near-instant via hardlinks)
|
|
11
|
+
* instead of a remote clone (5-30s per clone). This is the single biggest
|
|
12
|
+
* speedup in evalbuff — with parallelism=5, saves 10-30 remote clones per commit.
|
|
13
|
+
*/
|
|
14
|
+
export const withTestRepo = async (repoConfig, fn) => {
|
|
15
|
+
const { repoUrl, localRepoPath, parentSha, initCommand, env } = repoConfig;
|
|
16
|
+
// Create a temporary directory for the test repo
|
|
17
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codebuff-eval-'));
|
|
18
|
+
const repoDir = path.join(tempDir, 'repo');
|
|
19
|
+
try {
|
|
20
|
+
if (localRepoPath) {
|
|
21
|
+
// Local clone: uses hardlinks for objects, nearly instant
|
|
22
|
+
execSync(`git clone --no-checkout "${localRepoPath}" "${repoDir}"`, { stdio: 'ignore' });
|
|
23
|
+
execSync(`git checkout ${parentSha}`, { cwd: repoDir, stdio: 'ignore' });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Remote clone: slow but works without local repo
|
|
27
|
+
execSync(`git clone --depth 1 ${repoUrl} ${repoDir}`, { stdio: 'ignore' });
|
|
28
|
+
execSync(`git fetch --depth 1 origin ${parentSha}`, {
|
|
29
|
+
cwd: repoDir,
|
|
30
|
+
stdio: 'ignore',
|
|
31
|
+
});
|
|
32
|
+
execSync(`git checkout ${parentSha}`, { cwd: repoDir, stdio: 'ignore' });
|
|
33
|
+
}
|
|
34
|
+
if (initCommand) {
|
|
35
|
+
console.log(`Running init command: ${initCommand}...`);
|
|
36
|
+
try {
|
|
37
|
+
execSync(initCommand, {
|
|
38
|
+
cwd: repoDir,
|
|
39
|
+
stdio: 'ignore',
|
|
40
|
+
env: { ...process.env, ...env },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error(`Error running init command: ${getErrorObject(error).message}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Run the provided function with the repo directory
|
|
48
|
+
return await fn(repoDir);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
// Clean up the temporary directory
|
|
52
|
+
try {
|
|
53
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.warn(`Failed to clean up temporary directory: ${error}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export const withTestRepoAndParent = async (repoConfig, fn) => {
|
|
61
|
+
const { repoUrl, commitSha, initCommand } = repoConfig;
|
|
62
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codebuff-eval-'));
|
|
63
|
+
const repoDir = path.join(tempDir, 'repo');
|
|
64
|
+
try {
|
|
65
|
+
execSync(`git clone --depth 1 ${repoUrl} ${repoDir}`, { stdio: 'ignore' });
|
|
66
|
+
execSync(`git fetch --depth 2 origin ${commitSha}`, {
|
|
67
|
+
cwd: repoDir,
|
|
68
|
+
stdio: 'ignore',
|
|
69
|
+
});
|
|
70
|
+
execSync(`git checkout ${commitSha}`, { cwd: repoDir, stdio: 'ignore' });
|
|
71
|
+
let parentSha;
|
|
72
|
+
try {
|
|
73
|
+
const parents = execSync(`git log --pretty=%P -n 1 ${commitSha}`, {
|
|
74
|
+
cwd: repoDir,
|
|
75
|
+
encoding: 'utf-8',
|
|
76
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
77
|
+
}).trim();
|
|
78
|
+
if (!parents) {
|
|
79
|
+
console.warn(`Commit ${commitSha.slice(0, 8)} has no parent (initial commit)`);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const parentList = parents.split(' ');
|
|
83
|
+
if (parentList.length > 1) {
|
|
84
|
+
console.warn(`Commit ${commitSha.slice(0, 8)} is a merge commit (${parentList.length} parents)`);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
parentSha = parentList[0];
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error(`Error getting parent for ${commitSha.slice(0, 8)}:`, error);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
execSync(`git checkout ${parentSha}`, { cwd: repoDir, stdio: 'ignore' });
|
|
94
|
+
if (initCommand) {
|
|
95
|
+
console.log(`Running init command: ${initCommand}...`);
|
|
96
|
+
execSync(initCommand, { cwd: repoDir, stdio: 'ignore' });
|
|
97
|
+
}
|
|
98
|
+
return await fn(repoDir, commitSha, parentSha);
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
try {
|
|
102
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.warn(`Failed to clean up temporary directory: ${error}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=test-repo-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-repo-utils.js","sourceRoot":"","sources":["../src/test-repo-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,UAOC,EACD,EAA+B,EACnB,EAAE;IACd,MAAM,EAAE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E,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC1D,CAAC;QAED,OAAO,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;IAChD,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,2CAA2C,KAAK,EAAE,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* trace-compressor.ts — Compress verbose agent traces by extracting large
|
|
3
|
+
* tool outputs into sidecar files, keeping an inline trace with stable
|
|
4
|
+
* content-hash pointers and human-readable summaries.
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - JSON-lines (JSONL) streams — PrintModeEvent lines from the Claude runner
|
|
8
|
+
* - Plain-text traces — free-form text with fenced / tagged blocks
|
|
9
|
+
*
|
|
10
|
+
* Sidecar IDs are derived from SHA-256(content), so identical content across
|
|
11
|
+
* different trace runs always produces the same pointer and only one file.
|
|
12
|
+
*
|
|
13
|
+
* Usage (programmatic):
|
|
14
|
+
* import { compressTrace, restoreTrace } from './trace-compressor'
|
|
15
|
+
*
|
|
16
|
+
* const { compressed, manifest, stats } = await compressTrace(rawTrace, {
|
|
17
|
+
* sidecarDir: '/tmp/run/trace.sidecars',
|
|
18
|
+
* threshold: 2048,
|
|
19
|
+
* summarize: 'heuristic',
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* Usage (CLI):
|
|
23
|
+
* bun run src/trace-compressor.ts trace.txt [options]
|
|
24
|
+
*/
|
|
25
|
+
/** A stable pointer embedded in the compressed trace in place of large content. */
|
|
26
|
+
export interface SidecarRef {
|
|
27
|
+
/** Sentinel so consumers can detect this quickly. */
|
|
28
|
+
__sidecar__: true;
|
|
29
|
+
/** 12-char hex SHA-256 prefix of the original content — stable across runs. */
|
|
30
|
+
sidecarId: string;
|
|
31
|
+
/** Filename within the sidecar directory, e.g. "sidecar_abc123def456.json" */
|
|
32
|
+
file: string;
|
|
33
|
+
/** Original byte count of the extracted content. */
|
|
34
|
+
byteCount: number;
|
|
35
|
+
/** One-line human-readable summary of the content. */
|
|
36
|
+
summary: string;
|
|
37
|
+
/** How to interpret the sidecar file when restoring: 'text' | 'json' */
|
|
38
|
+
contentType: SidecarContentType;
|
|
39
|
+
}
|
|
40
|
+
export type SidecarContentType = 'text' | 'json';
|
|
41
|
+
/** One entry in the manifest index written alongside all sidecars. */
|
|
42
|
+
export interface ManifestEntry {
|
|
43
|
+
sidecarId: string;
|
|
44
|
+
file: string;
|
|
45
|
+
byteCount: number;
|
|
46
|
+
summary: string;
|
|
47
|
+
contentType: SidecarContentType;
|
|
48
|
+
/** Human-readable hint about the original location, e.g. "tool_result:Read:line 12" */
|
|
49
|
+
hint: string;
|
|
50
|
+
}
|
|
51
|
+
/** Written to <sidecarDir>/manifest.json */
|
|
52
|
+
export interface SidecarManifest {
|
|
53
|
+
version: 1;
|
|
54
|
+
created: string;
|
|
55
|
+
threshold: number;
|
|
56
|
+
format: 'jsonl' | 'text';
|
|
57
|
+
entries: ManifestEntry[];
|
|
58
|
+
}
|
|
59
|
+
export interface CompressOptions {
|
|
60
|
+
/** Path to directory where sidecar files are written (created if absent). */
|
|
61
|
+
sidecarDir: string;
|
|
62
|
+
/**
|
|
63
|
+
* Byte length above which content is extracted to a sidecar.
|
|
64
|
+
* Default: 2 048 (2 KiB).
|
|
65
|
+
*/
|
|
66
|
+
threshold?: number;
|
|
67
|
+
/**
|
|
68
|
+
* How to produce inline summaries:
|
|
69
|
+
* 'heuristic' (default) — no API call, uses first-line + stats
|
|
70
|
+
* 'claude' — calls claude-haiku-4-5 for a one-sentence summary
|
|
71
|
+
* 'none' — summary is just the byte count
|
|
72
|
+
*/
|
|
73
|
+
summarize?: 'heuristic' | 'claude' | 'none';
|
|
74
|
+
/**
|
|
75
|
+
* Force the input format. Default 'auto' detects from content.
|
|
76
|
+
*/
|
|
77
|
+
format?: 'auto' | 'jsonl' | 'text';
|
|
78
|
+
/** Anthropic API key when summarize='claude'. Falls back to ANTHROPIC_API_KEY env var. */
|
|
79
|
+
anthropicApiKey?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CompressResult {
|
|
82
|
+
/** The compressed trace text ready to write to disk. */
|
|
83
|
+
compressed: string;
|
|
84
|
+
/** Index of all extracted sidecars. */
|
|
85
|
+
manifest: SidecarManifest;
|
|
86
|
+
stats: {
|
|
87
|
+
format: 'jsonl' | 'text';
|
|
88
|
+
originalBytes: number;
|
|
89
|
+
compressedBytes: number;
|
|
90
|
+
sidecarCount: number;
|
|
91
|
+
reductionPct: number;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Auto-detect whether a trace is JSONL or plain text.
|
|
96
|
+
* Votes based on whether ≥60 % of sampled lines parse as JSON objects.
|
|
97
|
+
*/
|
|
98
|
+
export declare function detectFormat(content: string): 'jsonl' | 'text';
|
|
99
|
+
/** Type-guard: detects a string sidecar pointer, e.g. "[[sidecar:abc123|…]]". */
|
|
100
|
+
export declare function isStrSidecarPointer(v: unknown): v is string;
|
|
101
|
+
/** Type-guard: detects a SidecarRef object embedded in a parsed JSON value. */
|
|
102
|
+
export declare function isSidecarRef(v: unknown): v is SidecarRef;
|
|
103
|
+
/**
|
|
104
|
+
* Compress a trace string, extracting all large blocks to sidecar files.
|
|
105
|
+
*
|
|
106
|
+
* @param traceContent Raw trace (JSONL or plain text)
|
|
107
|
+
* @param opts Options — only `sidecarDir` is required
|
|
108
|
+
* @returns Compressed text, manifest metadata, and statistics
|
|
109
|
+
*/
|
|
110
|
+
export declare function compressTrace(traceContent: string, opts: CompressOptions): Promise<CompressResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Restore a compressed trace to its original form by expanding all sidecar
|
|
113
|
+
* references.
|
|
114
|
+
*
|
|
115
|
+
* @param compressedContent Text produced by `compressTrace`
|
|
116
|
+
* @param sidecarDir Directory containing the sidecar files
|
|
117
|
+
* @param format 'auto' (default) to detect, or 'jsonl' / 'text'
|
|
118
|
+
* @returns Original trace text
|
|
119
|
+
*/
|
|
120
|
+
export declare function restoreTrace(compressedContent: string, sidecarDir: string, format?: 'auto' | 'jsonl' | 'text'): string;
|
|
121
|
+
/**
|
|
122
|
+
* Compress a trace and write both the compressed file and sidecars to disk in
|
|
123
|
+
* one call. Returns the paths for downstream use.
|
|
124
|
+
*/
|
|
125
|
+
export declare function compressAndSave(tracePath: string, content: string, threshold?: number, summarize?: CompressOptions['summarize']): Promise<{
|
|
126
|
+
compressedPath: string;
|
|
127
|
+
sidecarDir: string;
|
|
128
|
+
stats: CompressResult['stats'];
|
|
129
|
+
}>;
|
|
130
|
+
//# sourceMappingURL=trace-compressor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-compressor.d.ts","sourceRoot":"","sources":["../src/trace-compressor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAYH,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,WAAW,EAAE,IAAI,CAAA;IACjB,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAA;IACjB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,WAAW,EAAE,kBAAkB,CAAA;CAChC;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAA;AAEhD,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,I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