@bradtaylorsf/alpha-loop 1.2.0 → 1.4.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/README.md +60 -19
- package/dist/cli.js +83 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/auth.js +1 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/eval.d.ts +53 -0
- package/dist/commands/eval.js +538 -0
- package/dist/commands/eval.js.map +1 -0
- package/dist/commands/evolve.d.ts +25 -0
- package/dist/commands/evolve.js +270 -0
- package/dist/commands/evolve.js.map +1 -0
- package/dist/commands/history.d.ts +1 -1
- package/dist/commands/history.js +4 -4
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.js +199 -30
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/resume.js +1 -0
- package/dist/commands/resume.js.map +1 -1
- package/dist/commands/run.js +170 -12
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/scan.d.ts +1 -1
- package/dist/commands/scan.js +12 -9
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/sync.d.ts +5 -0
- package/dist/commands/sync.js +24 -5
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/vision.js +5 -3
- package/dist/commands/vision.js.map +1 -1
- package/dist/engine/agents.d.ts +6 -1
- package/dist/engine/agents.js +14 -12
- package/dist/engine/agents.js.map +1 -1
- package/dist/engine/prerequisites.d.ts +4 -7
- package/dist/engine/prerequisites.js +12 -36
- package/dist/engine/prerequisites.js.map +1 -1
- package/dist/lib/agent.d.ts +18 -0
- package/dist/lib/agent.js +211 -30
- package/dist/lib/agent.js.map +1 -1
- package/dist/lib/config.d.ts +25 -2
- package/dist/lib/config.js +80 -7
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/eval-checks.d.ts +91 -0
- package/dist/lib/eval-checks.js +254 -0
- package/dist/lib/eval-checks.js.map +1 -0
- package/dist/lib/eval-runner.d.ts +29 -0
- package/dist/lib/eval-runner.js +439 -0
- package/dist/lib/eval-runner.js.map +1 -0
- package/dist/lib/eval.d.ts +170 -0
- package/dist/lib/eval.js +507 -0
- package/dist/lib/eval.js.map +1 -0
- package/dist/lib/learning.js +2 -2
- package/dist/lib/learning.js.map +1 -1
- package/dist/lib/pipeline.d.ts +44 -0
- package/dist/lib/pipeline.js +607 -138
- package/dist/lib/pipeline.js.map +1 -1
- package/dist/lib/prompts.d.ts +19 -0
- package/dist/lib/prompts.js +56 -5
- package/dist/lib/prompts.js.map +1 -1
- package/dist/lib/score.d.ts +80 -0
- package/dist/lib/score.js +172 -0
- package/dist/lib/score.js.map +1 -0
- package/dist/lib/session.d.ts +2 -1
- package/dist/lib/session.js +70 -19
- package/dist/lib/session.js.map +1 -1
- package/dist/lib/traces.d.ts +173 -0
- package/dist/lib/traces.js +272 -0
- package/dist/lib/traces.js.map +1 -0
- package/dist/lib/verify.d.ts +7 -1
- package/dist/lib/verify.js +109 -157
- package/dist/lib/verify.js.map +1 -1
- package/dist/lib/worktree.d.ts +1 -0
- package/dist/lib/worktree.js +9 -1
- package/dist/lib/worktree.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/implementer.md +1 -1
- package/templates/agents/reviewer.md +1 -1
- package/dist/engine/config.d.ts +0 -71
- package/dist/engine/config.js +0 -73
- package/dist/engine/config.js.map +0 -1
package/dist/lib/session.js
CHANGED
|
@@ -5,7 +5,7 @@ import { mkdirSync, writeFileSync } from 'node:fs';
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { log } from './logger.js';
|
|
7
7
|
import { exec, formatTimestamp } from './shell.js';
|
|
8
|
-
import { createPR } from './github.js';
|
|
8
|
+
import { createPR, updateProjectStatus } from './github.js';
|
|
9
9
|
/**
|
|
10
10
|
* Create a new session context with timestamp-based name.
|
|
11
11
|
* Optionally creates a session branch when autoMerge is enabled.
|
|
@@ -142,25 +142,70 @@ export async function finalizeSession(session, config) {
|
|
|
142
142
|
exec(`git push origin "${session.branch}"`, { cwd: projectDir });
|
|
143
143
|
}
|
|
144
144
|
// Create or update session PR
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
145
|
+
const successes = session.results.filter((r) => r.status === 'success');
|
|
146
|
+
const permanentFailures = session.results.filter((r) => r.status === 'failure' && r.failureReason !== 'transient');
|
|
147
|
+
const transientFailures = session.results.filter((r) => r.status === 'failure' && r.failureReason === 'transient');
|
|
148
148
|
const totalDuration = session.results.reduce((sum, r) => sum + r.duration, 0);
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
149
|
+
// Only count completed issues (not transient failures that were re-queued)
|
|
150
|
+
const completedCount = successes.length + permanentFailures.length;
|
|
151
|
+
const prTitle = `Session: ${session.name} — ${successes.length}/${completedCount} succeeded`;
|
|
152
|
+
const prLines = [
|
|
153
|
+
'## Session Summary',
|
|
154
|
+
'',
|
|
155
|
+
`**Branch:** ${session.branch}`,
|
|
156
|
+
`**Issues completed:** ${completedCount} (${successes.length} succeeded, ${permanentFailures.length} failed)`,
|
|
157
|
+
`**Total duration:** ${Math.round(totalDuration / 60)} minutes`,
|
|
158
|
+
`**Completed:** ${new Date().toISOString()}`,
|
|
159
|
+
'',
|
|
160
|
+
];
|
|
161
|
+
// Successes — the main content
|
|
162
|
+
if (successes.length > 0) {
|
|
163
|
+
prLines.push('### Issues');
|
|
164
|
+
for (const r of successes) {
|
|
165
|
+
prLines.push(`- #${r.issueNum}: ${r.title} — SUCCESS${r.prUrl ? ` ([PR](${r.prUrl}))` : ''}`);
|
|
166
|
+
}
|
|
167
|
+
prLines.push('');
|
|
168
|
+
prLines.push(...successes.map((r) => `Closes #${r.issueNum}`));
|
|
169
|
+
prLines.push('');
|
|
170
|
+
}
|
|
171
|
+
// Permanent failures — collapsed
|
|
172
|
+
if (permanentFailures.length > 0) {
|
|
173
|
+
prLines.push('<details>');
|
|
174
|
+
prLines.push(`<summary>Failed Issues (${permanentFailures.length})</summary>`);
|
|
175
|
+
prLines.push('');
|
|
176
|
+
for (const r of permanentFailures) {
|
|
177
|
+
prLines.push(`- #${r.issueNum}: ${r.title} — FAILURE`);
|
|
178
|
+
}
|
|
179
|
+
prLines.push('');
|
|
180
|
+
prLines.push('</details>');
|
|
181
|
+
prLines.push('');
|
|
182
|
+
}
|
|
183
|
+
// Transient failures — brief note, these were re-queued
|
|
184
|
+
if (transientFailures.length > 0) {
|
|
185
|
+
prLines.push(`*${transientFailures.length} issue(s) were re-queued due to agent rate limits.*`);
|
|
186
|
+
prLines.push('');
|
|
187
|
+
}
|
|
188
|
+
// Session review findings
|
|
189
|
+
if (session.sessionReviewFindings) {
|
|
190
|
+
const gate = session.sessionReviewFindings;
|
|
191
|
+
prLines.push('### Session Review');
|
|
192
|
+
prLines.push('');
|
|
193
|
+
prLines.push(`**Status:** ${gate.passed ? 'PASSED' : 'NEEDS ATTENTION'}`);
|
|
194
|
+
prLines.push(`**Summary:** ${gate.summary || 'No summary'}`);
|
|
195
|
+
if (gate.findings.length > 0) {
|
|
196
|
+
prLines.push('');
|
|
197
|
+
for (const f of gate.findings) {
|
|
198
|
+
const fixedTag = f.fixed ? ' (fixed)' : '';
|
|
199
|
+
prLines.push(`- [${f.severity.toUpperCase()}] ${f.description}${fixedTag}${f.file ? ` — \`${f.file}\`` : ''}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
prLines.push('');
|
|
203
|
+
}
|
|
204
|
+
prLines.push('---');
|
|
205
|
+
prLines.push(`This PR collects all changes from this session for final review before merging to ${config.baseBranch}.`);
|
|
206
|
+
prLines.push('');
|
|
207
|
+
prLines.push('Automated by alpha-loop');
|
|
208
|
+
const prBody = prLines.join('\n');
|
|
164
209
|
try {
|
|
165
210
|
const prUrl = createPR({
|
|
166
211
|
repo: config.repo,
|
|
@@ -171,6 +216,12 @@ Automated by alpha-loop`;
|
|
|
171
216
|
cwd: projectDir,
|
|
172
217
|
});
|
|
173
218
|
log.success(`Session PR: ${prUrl}`);
|
|
219
|
+
// Mark all successful issues as Done on the project board
|
|
220
|
+
for (const r of session.results) {
|
|
221
|
+
if (r.status === 'success' && config.project > 0) {
|
|
222
|
+
updateProjectStatus(config.repo, config.project, config.repoOwner, r.issueNum, 'Done');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
174
225
|
return prUrl;
|
|
175
226
|
}
|
|
176
227
|
catch (err) {
|
package/dist/lib/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAa5D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;I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*/
|
|
2
|
+
export type TraceFile = 'agent-output.txt' | 'diff.patch' | 'test-output.txt' | 'review-output.json' | 'verify-output.json' | 'plan.json' | 'metadata.json';
|
|
3
|
+
/** Pipeline metadata stored alongside traces. */
|
|
4
|
+
export type TraceMetadata = {
|
|
5
|
+
issueNum: number;
|
|
6
|
+
title: string;
|
|
7
|
+
status: 'success' | 'failure';
|
|
8
|
+
failureReason?: 'transient' | 'permanent';
|
|
9
|
+
duration: number;
|
|
10
|
+
retries: number;
|
|
11
|
+
testsPassing: boolean;
|
|
12
|
+
verifyPassing: boolean;
|
|
13
|
+
verifySkipped: boolean;
|
|
14
|
+
filesChanged: number;
|
|
15
|
+
prUrl?: string;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
agent: string;
|
|
18
|
+
model: string;
|
|
19
|
+
};
|
|
20
|
+
/** A complete trace for one issue run. */
|
|
21
|
+
export type Trace = {
|
|
22
|
+
session: string;
|
|
23
|
+
issueNum: number;
|
|
24
|
+
dir: string;
|
|
25
|
+
metadata: TraceMetadata;
|
|
26
|
+
};
|
|
27
|
+
/** Run-level manifest with metadata about the entire run. */
|
|
28
|
+
export type RunManifest = {
|
|
29
|
+
runId: string;
|
|
30
|
+
startedAt: string;
|
|
31
|
+
completedAt: string;
|
|
32
|
+
issues: number[];
|
|
33
|
+
config: {
|
|
34
|
+
agent: string;
|
|
35
|
+
model: string;
|
|
36
|
+
reviewModel: string;
|
|
37
|
+
testCommand: string;
|
|
38
|
+
baseBranch: string;
|
|
39
|
+
};
|
|
40
|
+
gitState: {
|
|
41
|
+
branch: string;
|
|
42
|
+
commit: string;
|
|
43
|
+
};
|
|
44
|
+
totalDuration: number;
|
|
45
|
+
};
|
|
46
|
+
/** Per-issue score in scores.json. */
|
|
47
|
+
export type IssueScore = {
|
|
48
|
+
status: 'success' | 'failure';
|
|
49
|
+
tests_passed: boolean;
|
|
50
|
+
verify_passed: boolean;
|
|
51
|
+
retries: number;
|
|
52
|
+
duration_seconds: number;
|
|
53
|
+
files_changed: number;
|
|
54
|
+
steps_completed: string[];
|
|
55
|
+
};
|
|
56
|
+
/** Run-level scores.json format. */
|
|
57
|
+
export type ScoresJson = {
|
|
58
|
+
composite_score: number;
|
|
59
|
+
issues: Record<string, IssueScore>;
|
|
60
|
+
aggregate: {
|
|
61
|
+
pass_rate: number;
|
|
62
|
+
avg_retries: number;
|
|
63
|
+
avg_duration: number;
|
|
64
|
+
total_issues: number;
|
|
65
|
+
issues_passed: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/** Per-step cost entry. */
|
|
69
|
+
export type StepCost = {
|
|
70
|
+
step: string;
|
|
71
|
+
issueNum: number;
|
|
72
|
+
model: string;
|
|
73
|
+
input_tokens: number;
|
|
74
|
+
output_tokens: number;
|
|
75
|
+
cost_usd: number;
|
|
76
|
+
};
|
|
77
|
+
/** Run-level costs.json format. */
|
|
78
|
+
export type CostsJson = {
|
|
79
|
+
total_cost_usd: number;
|
|
80
|
+
by_step: Record<string, {
|
|
81
|
+
model: string;
|
|
82
|
+
input_tokens: number;
|
|
83
|
+
output_tokens: number;
|
|
84
|
+
cost_usd: number;
|
|
85
|
+
}>;
|
|
86
|
+
by_issue: Record<string, {
|
|
87
|
+
cost_usd: number;
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
/** Pipeline result used to compute scores. */
|
|
91
|
+
export type PipelineResultForScores = {
|
|
92
|
+
issueNum: number;
|
|
93
|
+
status: 'success' | 'failure';
|
|
94
|
+
testsPassing: boolean;
|
|
95
|
+
verifyPassing: boolean;
|
|
96
|
+
verifySkipped: boolean;
|
|
97
|
+
retries: number;
|
|
98
|
+
duration: number;
|
|
99
|
+
filesChanged: number;
|
|
100
|
+
stepsCompleted: string[];
|
|
101
|
+
};
|
|
102
|
+
/** Get the base traces directory. */
|
|
103
|
+
export declare function tracesDir(projectDir?: string): string;
|
|
104
|
+
/** Get the run directory for a session. */
|
|
105
|
+
export declare function runDir(session: string, projectDir?: string): string;
|
|
106
|
+
/** Get the directory for a specific issue trace within a session. */
|
|
107
|
+
export declare function traceDir(session: string, issueNum: number, projectDir?: string): string;
|
|
108
|
+
/**
|
|
109
|
+
* Write a trace file for an issue.
|
|
110
|
+
* Creates the directory structure if it doesn't exist.
|
|
111
|
+
*/
|
|
112
|
+
export declare function writeTrace(session: string, issueNum: number, file: TraceFile, content: string, projectDir?: string): void;
|
|
113
|
+
/**
|
|
114
|
+
* Write trace metadata for an issue.
|
|
115
|
+
*/
|
|
116
|
+
export declare function writeTraceMetadata(session: string, issueNum: number, metadata: TraceMetadata, projectDir?: string): void;
|
|
117
|
+
/**
|
|
118
|
+
* Write a file into a named subdirectory of the run (prompts/, outputs/, diffs/, tests/, verify/).
|
|
119
|
+
*/
|
|
120
|
+
export declare function writeTraceToSubdir(session: string, subdir: string, filename: string, content: string, projectDir?: string): void;
|
|
121
|
+
/**
|
|
122
|
+
* Write the run-level manifest.json.
|
|
123
|
+
*/
|
|
124
|
+
export declare function writeRunManifest(session: string, manifest: RunManifest, projectDir?: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Write the config snapshot for the run.
|
|
127
|
+
*/
|
|
128
|
+
export declare function writeConfigSnapshot(session: string, configYaml: string, projectDir?: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Write scores.json for the run.
|
|
131
|
+
*/
|
|
132
|
+
export declare function writeScores(session: string, scores: ScoresJson, projectDir?: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Write costs.json for the run.
|
|
135
|
+
*/
|
|
136
|
+
export declare function writeCosts(session: string, costs: CostsJson, projectDir?: string): void;
|
|
137
|
+
/**
|
|
138
|
+
* Compute scores.json from pipeline results.
|
|
139
|
+
*/
|
|
140
|
+
export declare function computeScores(results: PipelineResultForScores[]): ScoresJson;
|
|
141
|
+
/**
|
|
142
|
+
* Compute costs.json from per-step cost entries.
|
|
143
|
+
*/
|
|
144
|
+
export declare function computeCosts(stepCosts: StepCost[]): CostsJson;
|
|
145
|
+
/**
|
|
146
|
+
* Read a trace file. Returns null if it doesn't exist.
|
|
147
|
+
*/
|
|
148
|
+
export declare function readTrace(session: string, issueNum: number, file: TraceFile, projectDir?: string): string | null;
|
|
149
|
+
/**
|
|
150
|
+
* Read trace metadata for an issue. Returns null if it doesn't exist.
|
|
151
|
+
*/
|
|
152
|
+
export declare function readTraceMetadata(session: string, issueNum: number, projectDir?: string): TraceMetadata | null;
|
|
153
|
+
/**
|
|
154
|
+
* List all sessions that have traces.
|
|
155
|
+
*/
|
|
156
|
+
export declare function listTraceSessions(projectDir?: string): string[];
|
|
157
|
+
/**
|
|
158
|
+
* List all issue numbers with traces in a session.
|
|
159
|
+
*/
|
|
160
|
+
export declare function listTraceIssues(session: string, projectDir?: string): number[];
|
|
161
|
+
/**
|
|
162
|
+
* List all traces across all sessions.
|
|
163
|
+
* Returns them newest-first by session name (which is timestamp-based).
|
|
164
|
+
*/
|
|
165
|
+
export declare function listTraces(projectDir?: string): Trace[];
|
|
166
|
+
/**
|
|
167
|
+
* Get the full filesystem path context for a trace.
|
|
168
|
+
* Returns all trace files and their sizes for Meta-Harness-style filesystem access.
|
|
169
|
+
*/
|
|
170
|
+
export declare function getTraceFiles(session: string, issueNum: number, projectDir?: string): Array<{
|
|
171
|
+
file: string;
|
|
172
|
+
size: number;
|
|
173
|
+
}>;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trace Storage — Meta-Harness style full execution traces per run.
|
|
3
|
+
*
|
|
4
|
+
* Stores raw prompts, agent outputs, diffs, test output, verify output,
|
|
5
|
+
* and pipeline metadata as separate files in a navigable filesystem:
|
|
6
|
+
* .alpha-loop/traces/{run}/
|
|
7
|
+
* manifest.json, config.snapshot.yaml, scores.json, costs.json
|
|
8
|
+
* prompts/issue-{N}-{step}.md
|
|
9
|
+
* outputs/issue-{N}-{step}.log
|
|
10
|
+
* diffs/issue-{N}-{step}.patch
|
|
11
|
+
* tests/issue-{N}-test-{attempt}.txt
|
|
12
|
+
* verify/issue-{N}-verify-{attempt}.txt
|
|
13
|
+
* {issueNum}/metadata.json (backward compat)
|
|
14
|
+
*
|
|
15
|
+
* Key insight from Meta-Harness (Lee et al., 2026): full trace access
|
|
16
|
+
* outperforms summaries by 15+ points. We store everything raw.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { log } from './logger.js';
|
|
21
|
+
import { computeCompositeScore } from './score.js';
|
|
22
|
+
const TRACES_ROOT = '.alpha-loop/traces';
|
|
23
|
+
/** Get the base traces directory. */
|
|
24
|
+
export function tracesDir(projectDir) {
|
|
25
|
+
return join(projectDir ?? process.cwd(), TRACES_ROOT);
|
|
26
|
+
}
|
|
27
|
+
/** Get the run directory for a session. */
|
|
28
|
+
export function runDir(session, projectDir) {
|
|
29
|
+
return join(tracesDir(projectDir), session.replace(/\//g, '-'));
|
|
30
|
+
}
|
|
31
|
+
/** Get the directory for a specific issue trace within a session. */
|
|
32
|
+
export function traceDir(session, issueNum, projectDir) {
|
|
33
|
+
return join(runDir(session, projectDir), String(issueNum));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Write a trace file for an issue.
|
|
37
|
+
* Creates the directory structure if it doesn't exist.
|
|
38
|
+
*/
|
|
39
|
+
export function writeTrace(session, issueNum, file, content, projectDir) {
|
|
40
|
+
const dir = traceDir(session, issueNum, projectDir);
|
|
41
|
+
mkdirSync(dir, { recursive: true });
|
|
42
|
+
const filePath = join(dir, file);
|
|
43
|
+
writeFileSync(filePath, content);
|
|
44
|
+
log.info(`Trace written: ${filePath}`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Write trace metadata for an issue.
|
|
48
|
+
*/
|
|
49
|
+
export function writeTraceMetadata(session, issueNum, metadata, projectDir) {
|
|
50
|
+
writeTrace(session, issueNum, 'metadata.json', JSON.stringify(metadata, null, 2) + '\n', projectDir);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Write a file into a named subdirectory of the run (prompts/, outputs/, diffs/, tests/, verify/).
|
|
54
|
+
*/
|
|
55
|
+
export function writeTraceToSubdir(session, subdir, filename, content, projectDir) {
|
|
56
|
+
const dir = join(runDir(session, projectDir), subdir);
|
|
57
|
+
mkdirSync(dir, { recursive: true });
|
|
58
|
+
const filePath = join(dir, filename);
|
|
59
|
+
writeFileSync(filePath, content);
|
|
60
|
+
log.info(`Trace written: ${filePath}`);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Write the run-level manifest.json.
|
|
64
|
+
*/
|
|
65
|
+
export function writeRunManifest(session, manifest, projectDir) {
|
|
66
|
+
const dir = runDir(session, projectDir);
|
|
67
|
+
mkdirSync(dir, { recursive: true });
|
|
68
|
+
const filePath = join(dir, 'manifest.json');
|
|
69
|
+
writeFileSync(filePath, JSON.stringify(manifest, null, 2) + '\n');
|
|
70
|
+
log.info(`Run manifest written: ${filePath}`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Write the config snapshot for the run.
|
|
74
|
+
*/
|
|
75
|
+
export function writeConfigSnapshot(session, configYaml, projectDir) {
|
|
76
|
+
const dir = runDir(session, projectDir);
|
|
77
|
+
mkdirSync(dir, { recursive: true });
|
|
78
|
+
const filePath = join(dir, 'config.snapshot.yaml');
|
|
79
|
+
writeFileSync(filePath, configYaml);
|
|
80
|
+
log.info(`Config snapshot written: ${filePath}`);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Write scores.json for the run.
|
|
84
|
+
*/
|
|
85
|
+
export function writeScores(session, scores, projectDir) {
|
|
86
|
+
const dir = runDir(session, projectDir);
|
|
87
|
+
mkdirSync(dir, { recursive: true });
|
|
88
|
+
const filePath = join(dir, 'scores.json');
|
|
89
|
+
writeFileSync(filePath, JSON.stringify(scores, null, 2) + '\n');
|
|
90
|
+
log.info(`Scores written: ${filePath}`);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Write costs.json for the run.
|
|
94
|
+
*/
|
|
95
|
+
export function writeCosts(session, costs, projectDir) {
|
|
96
|
+
const dir = runDir(session, projectDir);
|
|
97
|
+
mkdirSync(dir, { recursive: true });
|
|
98
|
+
const filePath = join(dir, 'costs.json');
|
|
99
|
+
writeFileSync(filePath, JSON.stringify(costs, null, 2) + '\n');
|
|
100
|
+
log.info(`Costs written: ${filePath}`);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Compute scores.json from pipeline results.
|
|
104
|
+
*/
|
|
105
|
+
export function computeScores(results) {
|
|
106
|
+
const issues = {};
|
|
107
|
+
for (const r of results) {
|
|
108
|
+
issues[String(r.issueNum)] = {
|
|
109
|
+
status: r.status,
|
|
110
|
+
tests_passed: r.testsPassing,
|
|
111
|
+
verify_passed: r.verifyPassing,
|
|
112
|
+
retries: r.retries,
|
|
113
|
+
duration_seconds: r.duration,
|
|
114
|
+
files_changed: r.filesChanged,
|
|
115
|
+
steps_completed: r.stepsCompleted,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const total = results.length;
|
|
119
|
+
const passed = results.filter((r) => r.status === 'success').length;
|
|
120
|
+
const passRate = total > 0 ? passed / total : 0;
|
|
121
|
+
const avgRetries = total > 0 ? results.reduce((sum, r) => sum + r.retries, 0) / total : 0;
|
|
122
|
+
const avgDuration = total > 0 ? results.reduce((sum, r) => sum + r.duration, 0) / total : 0;
|
|
123
|
+
// Use the canonical composite score formula from score.ts
|
|
124
|
+
const caseResults = results.map((r) => ({
|
|
125
|
+
caseId: String(r.issueNum),
|
|
126
|
+
passed: r.status === 'success',
|
|
127
|
+
partialCredit: r.status === 'success' ? 1 : 0,
|
|
128
|
+
retries: r.retries,
|
|
129
|
+
duration: r.duration,
|
|
130
|
+
}));
|
|
131
|
+
const compositeScore = computeCompositeScore(caseResults);
|
|
132
|
+
return {
|
|
133
|
+
composite_score: compositeScore,
|
|
134
|
+
issues,
|
|
135
|
+
aggregate: {
|
|
136
|
+
pass_rate: Math.round(passRate * 1000) / 1000,
|
|
137
|
+
avg_retries: Math.round(avgRetries * 10) / 10,
|
|
138
|
+
avg_duration: Math.round(avgDuration),
|
|
139
|
+
total_issues: total,
|
|
140
|
+
issues_passed: passed,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Compute costs.json from per-step cost entries.
|
|
146
|
+
*/
|
|
147
|
+
export function computeCosts(stepCosts) {
|
|
148
|
+
const byStep = {};
|
|
149
|
+
const byIssue = {};
|
|
150
|
+
let totalCost = 0;
|
|
151
|
+
for (const sc of stepCosts) {
|
|
152
|
+
// Aggregate by step name
|
|
153
|
+
if (!byStep[sc.step]) {
|
|
154
|
+
byStep[sc.step] = {
|
|
155
|
+
model: sc.model,
|
|
156
|
+
input_tokens: 0,
|
|
157
|
+
output_tokens: 0,
|
|
158
|
+
cost_usd: 0,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
byStep[sc.step].input_tokens += sc.input_tokens;
|
|
162
|
+
byStep[sc.step].output_tokens += sc.output_tokens;
|
|
163
|
+
byStep[sc.step].cost_usd += sc.cost_usd;
|
|
164
|
+
// Aggregate by issue
|
|
165
|
+
const issueKey = String(sc.issueNum);
|
|
166
|
+
if (!byIssue[issueKey]) {
|
|
167
|
+
byIssue[issueKey] = { cost_usd: 0 };
|
|
168
|
+
}
|
|
169
|
+
byIssue[issueKey].cost_usd += sc.cost_usd;
|
|
170
|
+
totalCost += sc.cost_usd;
|
|
171
|
+
}
|
|
172
|
+
// Round all cost values
|
|
173
|
+
for (const step of Object.values(byStep)) {
|
|
174
|
+
step.cost_usd = Math.round(step.cost_usd * 10000) / 10000;
|
|
175
|
+
}
|
|
176
|
+
for (const issue of Object.values(byIssue)) {
|
|
177
|
+
issue.cost_usd = Math.round(issue.cost_usd * 10000) / 10000;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
total_cost_usd: Math.round(totalCost * 10000) / 10000,
|
|
181
|
+
by_step: byStep,
|
|
182
|
+
by_issue: byIssue,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Read a trace file. Returns null if it doesn't exist.
|
|
187
|
+
*/
|
|
188
|
+
export function readTrace(session, issueNum, file, projectDir) {
|
|
189
|
+
const filePath = join(traceDir(session, issueNum, projectDir), file);
|
|
190
|
+
if (!existsSync(filePath))
|
|
191
|
+
return null;
|
|
192
|
+
return readFileSync(filePath, 'utf-8');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Read trace metadata for an issue. Returns null if it doesn't exist.
|
|
196
|
+
*/
|
|
197
|
+
export function readTraceMetadata(session, issueNum, projectDir) {
|
|
198
|
+
const raw = readTrace(session, issueNum, 'metadata.json', projectDir);
|
|
199
|
+
if (!raw)
|
|
200
|
+
return null;
|
|
201
|
+
try {
|
|
202
|
+
return JSON.parse(raw);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* List all sessions that have traces.
|
|
210
|
+
*/
|
|
211
|
+
export function listTraceSessions(projectDir) {
|
|
212
|
+
const root = tracesDir(projectDir);
|
|
213
|
+
if (!existsSync(root))
|
|
214
|
+
return [];
|
|
215
|
+
return readdirSync(root, { withFileTypes: true })
|
|
216
|
+
.filter((d) => d.isDirectory())
|
|
217
|
+
.map((d) => d.name)
|
|
218
|
+
.sort();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* List all issue numbers with traces in a session.
|
|
222
|
+
*/
|
|
223
|
+
export function listTraceIssues(session, projectDir) {
|
|
224
|
+
const sessionDir = runDir(session, projectDir);
|
|
225
|
+
if (!existsSync(sessionDir))
|
|
226
|
+
return [];
|
|
227
|
+
return readdirSync(sessionDir, { withFileTypes: true })
|
|
228
|
+
.filter((d) => d.isDirectory() && /^\d+$/.test(d.name))
|
|
229
|
+
.map((d) => parseInt(d.name, 10))
|
|
230
|
+
.filter((n) => !isNaN(n))
|
|
231
|
+
.sort((a, b) => a - b);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* List all traces across all sessions.
|
|
235
|
+
* Returns them newest-first by session name (which is timestamp-based).
|
|
236
|
+
*/
|
|
237
|
+
export function listTraces(projectDir) {
|
|
238
|
+
const traces = [];
|
|
239
|
+
const sessions = listTraceSessions(projectDir);
|
|
240
|
+
for (const session of sessions.reverse()) {
|
|
241
|
+
const issues = listTraceIssues(session, projectDir);
|
|
242
|
+
for (const issueNum of issues) {
|
|
243
|
+
const metadata = readTraceMetadata(session, issueNum, projectDir);
|
|
244
|
+
if (metadata) {
|
|
245
|
+
traces.push({
|
|
246
|
+
session,
|
|
247
|
+
issueNum,
|
|
248
|
+
dir: traceDir(session, issueNum, projectDir),
|
|
249
|
+
metadata,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return traces;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get the full filesystem path context for a trace.
|
|
258
|
+
* Returns all trace files and their sizes for Meta-Harness-style filesystem access.
|
|
259
|
+
*/
|
|
260
|
+
export function getTraceFiles(session, issueNum, projectDir) {
|
|
261
|
+
const dir = traceDir(session, issueNum, projectDir);
|
|
262
|
+
if (!existsSync(dir))
|
|
263
|
+
return [];
|
|
264
|
+
return readdirSync(dir)
|
|
265
|
+
.map((file) => {
|
|
266
|
+
const filePath = join(dir, file);
|
|
267
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
268
|
+
return { file, size: content.length };
|
|
269
|
+
})
|
|
270
|
+
.sort((a, b) => a.file.localeCompare(b.file));
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=traces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traces.js","sourceRoot":"","sources":["../../src/lib/traces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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AC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC;oBAC5C,QAAQ;iBACT,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,QAAgB,EAAE,UAAmB;IAClF,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAEhC,OAAO,WAAW,CAAC,GAAG,CAAC;SACpB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IACxC,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/lib/verify.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { Config } from './config.js';
|
|
2
2
|
export type VerifyResult = {
|
|
3
3
|
passed: boolean;
|
|
4
|
+
skipped: boolean;
|
|
4
5
|
output: string;
|
|
5
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Check if a diff only touches non-UI files.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isNonUiChange(diffStat: string): boolean;
|
|
6
11
|
/**
|
|
7
12
|
* Run live verification using playwright-cli.
|
|
8
|
-
*
|
|
13
|
+
* The agent starts the dev server, tests the app, and reports results.
|
|
9
14
|
*/
|
|
10
15
|
export declare function runVerify(options: {
|
|
11
16
|
worktree: string;
|
|
@@ -15,4 +20,5 @@ export declare function runVerify(options: {
|
|
|
15
20
|
body: string;
|
|
16
21
|
config: Config;
|
|
17
22
|
sessionDir: string;
|
|
23
|
+
verifyInstructions?: string;
|
|
18
24
|
}): Promise<VerifyResult>;
|