@tangle-network/agent-runtime 0.94.10 → 0.94.11
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/{agentic-generator-1g7GDba7.d.ts → agentic-generator-JT47GnAp.d.ts} +44 -4
- package/dist/{chunk-7NCP74SL.js → chunk-5LIOH5DR.js} +2 -2
- package/dist/{chunk-GHXW56PO.js → chunk-OLZ6ZZQ2.js} +126 -29
- package/dist/chunk-OLZ6ZZQ2.js.map +1 -0
- package/dist/{completion-gate-BB4IZwyh.d.ts → completion-gate-Bn4AZ_Kw.d.ts} +1 -1
- package/dist/{coordination-CyVQ61My.d.ts → coordination-DzwagV_s.d.ts} +2 -2
- package/dist/{improve-DZeatcs7.d.ts → improve-BucbjddC.d.ts} +2 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.js +2 -2
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +2 -2
- package/dist/knowledge.d.ts +4 -4
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +1 -1
- package/dist/{local-harness-ZLMkKdZc.d.ts → local-harness-ZqCx51u7.d.ts} +1 -1
- package/dist/{loop-runner-bin-DA3ccCAs.d.ts → loop-runner-bin-D6K_C6op.d.ts} +1 -1
- package/dist/loop-runner-bin.d.ts +4 -4
- package/dist/loops.d.ts +9 -9
- package/dist/mcp/index.d.ts +6 -6
- package/dist/{mcp-serve-verifier-BO4MEsR3.d.ts → mcp-serve-verifier-i6nTNSnu.d.ts} +1 -1
- package/dist/{supervise-BaEsCHNh.d.ts → supervise-CzyytS-o.d.ts} +2 -2
- package/dist/{worktree-fanout-Do2YbtFD.d.ts → worktree-fanout-Bn7w_1bM.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-GHXW56PO.js.map +0 -1
- /package/dist/{chunk-7NCP74SL.js.map → chunk-5LIOH5DR.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalystFinding, CostLedger, MaximumCharge } from '@tangle-network/agent-eval';
|
|
2
2
|
import { AgentProfile, ReasoningEffort } from '@tangle-network/agent-interface';
|
|
3
|
-
import { L as LocalHarness, C as CodexTokenUsage, a as CodexExecutionEvidence, r as runLocalHarness } from './local-harness-
|
|
3
|
+
import { L as LocalHarness, C as CodexTokenUsage, a as CodexExecutionEvidence, b as LocalHarnessResult, r as runLocalHarness } from './local-harness-ZqCx51u7.js';
|
|
4
4
|
import { LabeledScenarioStore, WorktreeAdapter, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -166,6 +166,41 @@ interface AgenticGeneratorShotReceipt {
|
|
|
166
166
|
readonly message: string;
|
|
167
167
|
} | null;
|
|
168
168
|
}
|
|
169
|
+
/** Frozen exact harness result for an author shot: full streams, process state,
|
|
170
|
+
* token usage, and execution-policy evidence.
|
|
171
|
+
* The `onShotCompleted` callback receives `null` when execution failed before
|
|
172
|
+
* the harness returned. */
|
|
173
|
+
type AgenticGeneratorShotExecution = Readonly<Omit<LocalHarnessResult, 'usage' | 'evidence'> & {
|
|
174
|
+
readonly usage?: Readonly<CodexTokenUsage>;
|
|
175
|
+
readonly evidence?: Readonly<Omit<CodexExecutionEvidence, 'readDeniedPaths' | 'policy'>> & {
|
|
176
|
+
readonly readDeniedPaths: ReadonlyArray<string>;
|
|
177
|
+
readonly policy: Readonly<CodexExecutionEvidence['policy']>;
|
|
178
|
+
};
|
|
179
|
+
}>;
|
|
180
|
+
/** Worktree decision emitted before a completed shot is retried, accepted, or
|
|
181
|
+
* discarded. The callback runs while `worktreePath` is still available, so
|
|
182
|
+
* callers can persist the exact diff. */
|
|
183
|
+
type AgenticGeneratorShotDisposition = {
|
|
184
|
+
readonly kind: 'clean';
|
|
185
|
+
readonly worktreePath: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: 'rejected';
|
|
188
|
+
readonly worktreePath: string;
|
|
189
|
+
readonly stage: 'raw-trace-evidence' | 'verification';
|
|
190
|
+
readonly feedback: string | null;
|
|
191
|
+
} | {
|
|
192
|
+
readonly kind: 'accepted';
|
|
193
|
+
readonly worktreePath: string;
|
|
194
|
+
readonly verified: boolean;
|
|
195
|
+
} | {
|
|
196
|
+
readonly kind: 'setup-error';
|
|
197
|
+
readonly worktreePath: string;
|
|
198
|
+
readonly stage: 'worktree-inspection' | 'raw-trace-evidence' | 'verification';
|
|
199
|
+
readonly error: {
|
|
200
|
+
readonly name: string;
|
|
201
|
+
readonly message: string;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
169
204
|
interface AgenticGeneratorOptions {
|
|
170
205
|
/** Local coding harness to run in the worktree. Default `claude`. */
|
|
171
206
|
harness?: LocalHarness;
|
|
@@ -179,8 +214,13 @@ interface AgenticGeneratorOptions {
|
|
|
179
214
|
* candidate-specific paths after the driver creates its worktree. */
|
|
180
215
|
codexReadDeniedPaths?: ReadonlyArray<string> | ((worktreePath: string) => ReadonlyArray<string>);
|
|
181
216
|
/** Awaited once for every attempted author shot, including process failures.
|
|
182
|
-
*
|
|
183
|
-
|
|
217
|
+
* The second argument preserves the exact harness result, including stdout
|
|
218
|
+
* and stderr, before worktree inspection or verification can reject the
|
|
219
|
+
* shot. Throwing aborts the candidate so evidence persistence fails closed. */
|
|
220
|
+
onShotCompleted?: (receipt: AgenticGeneratorShotReceipt, execution: AgenticGeneratorShotExecution | null) => void | Promise<void>;
|
|
221
|
+
/** Awaited after worktree inspection and before the shot is accepted,
|
|
222
|
+
* retried, or discarded. Throwing aborts the candidate. */
|
|
223
|
+
onShotDisposition?: (receipt: AgenticGeneratorShotReceipt, disposition: AgenticGeneratorShotDisposition) => void | Promise<void>;
|
|
184
224
|
/** Optional hard upper bound passed to the run-wide CostLedger before each
|
|
185
225
|
* author shot. This MUST be enforced by the provider or executor; a planning
|
|
186
226
|
* estimate is not an admissible bound. Omit for an uncapped ledger. A capped
|
|
@@ -215,4 +255,4 @@ declare function agenticGenerator(opts?: AgenticGeneratorOptions): CandidateGene
|
|
|
215
255
|
* silent fallback). */
|
|
216
256
|
declare function commandVerifier(command: string, args?: string[], timeoutMs?: number): Verifier;
|
|
217
257
|
|
|
218
|
-
export { AGENTIC_PROFILE_RESOURCE_ROOT as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type AgenticGeneratorOptions as a, type
|
|
258
|
+
export { AGENTIC_PROFILE_RESOURCE_ROOT as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type AgenticGeneratorOptions as a, type AgenticGeneratorShotDisposition as b, type AgenticGeneratorShotExecution as c, type AgenticGeneratorShotReceipt as d, type VerifyResult as e, agenticGenerator as f, commandVerifier as g, improvementDriver as i };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
agenticGenerator
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OLZ6ZZQ2.js";
|
|
4
4
|
import {
|
|
5
5
|
assertModelAllowed
|
|
6
6
|
} from "./chunk-ISTDY47H.js";
|
|
@@ -658,4 +658,4 @@ export {
|
|
|
658
658
|
applyImprovementWinnerToProfile,
|
|
659
659
|
improve
|
|
660
660
|
};
|
|
661
|
-
//# sourceMappingURL=chunk-
|
|
661
|
+
//# sourceMappingURL=chunk-5LIOH5DR.js.map
|
|
@@ -88,8 +88,8 @@ ${attemptNote}` : basePrompt;
|
|
|
88
88
|
harnessResult = await withAuthorProfileResources(
|
|
89
89
|
profileResourcePlan,
|
|
90
90
|
worktreePath,
|
|
91
|
-
async (
|
|
92
|
-
profileWorkspaceReceipt =
|
|
91
|
+
async (receipt2) => {
|
|
92
|
+
profileWorkspaceReceipt = receipt2;
|
|
93
93
|
const result2 = await run({
|
|
94
94
|
harness,
|
|
95
95
|
cwd: worktreePath,
|
|
@@ -144,47 +144,105 @@ ${attemptNote}` : basePrompt;
|
|
|
144
144
|
} catch (cause) {
|
|
145
145
|
shotError = cause instanceof Error ? cause : new Error(String(cause));
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
);
|
|
167
|
-
if (!harnessResult) {
|
|
147
|
+
const execution = shotExecutionSnapshot(harnessResult);
|
|
148
|
+
const receipt = shotReceipt({
|
|
149
|
+
generation,
|
|
150
|
+
candidateIndex,
|
|
151
|
+
shot,
|
|
152
|
+
maxShots: shots,
|
|
153
|
+
harness,
|
|
154
|
+
profile: opts.profile,
|
|
155
|
+
prompt: exactPrompt,
|
|
156
|
+
startedAt,
|
|
157
|
+
completedAt: /* @__PURE__ */ new Date(),
|
|
158
|
+
result: execution,
|
|
159
|
+
profileWorkspaceReceipt,
|
|
160
|
+
costCallId,
|
|
161
|
+
costReceipt,
|
|
162
|
+
error: shotError
|
|
163
|
+
});
|
|
164
|
+
await emitShotReceipt(opts.onShotCompleted, receipt, execution, shotError);
|
|
165
|
+
if (!execution) {
|
|
168
166
|
throw new Error("agenticGenerator: author shot completed without a harness result");
|
|
169
167
|
}
|
|
170
|
-
|
|
168
|
+
let worktreeChanged;
|
|
169
|
+
try {
|
|
170
|
+
worktreeChanged = dirty(worktreePath);
|
|
171
|
+
} catch (cause) {
|
|
172
|
+
return rethrowShotSetupError(
|
|
173
|
+
opts.onShotDisposition,
|
|
174
|
+
receipt,
|
|
175
|
+
worktreePath,
|
|
176
|
+
"worktree-inspection",
|
|
177
|
+
cause
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (!worktreeChanged) {
|
|
181
|
+
await emitShotDisposition(opts.onShotDisposition, receipt, {
|
|
182
|
+
kind: "clean",
|
|
183
|
+
worktreePath
|
|
184
|
+
});
|
|
171
185
|
attemptNote = EMPTY_TREE_NOTE;
|
|
172
186
|
continue;
|
|
173
187
|
}
|
|
174
188
|
if (needsRawTraceEvidence) {
|
|
175
|
-
|
|
189
|
+
let problem;
|
|
190
|
+
try {
|
|
191
|
+
problem = rawTraceEvidenceProblem(worktreePath, findings);
|
|
192
|
+
} catch (cause) {
|
|
193
|
+
return rethrowShotSetupError(
|
|
194
|
+
opts.onShotDisposition,
|
|
195
|
+
receipt,
|
|
196
|
+
worktreePath,
|
|
197
|
+
"raw-trace-evidence",
|
|
198
|
+
cause
|
|
199
|
+
);
|
|
200
|
+
}
|
|
176
201
|
if (problem) {
|
|
202
|
+
await emitShotDisposition(opts.onShotDisposition, receipt, {
|
|
203
|
+
kind: "rejected",
|
|
204
|
+
worktreePath,
|
|
205
|
+
stage: "raw-trace-evidence",
|
|
206
|
+
feedback: problem
|
|
207
|
+
});
|
|
177
208
|
attemptNote = problem;
|
|
178
209
|
continue;
|
|
179
210
|
}
|
|
180
211
|
}
|
|
181
212
|
if (!verify) {
|
|
213
|
+
await emitShotDisposition(opts.onShotDisposition, receipt, {
|
|
214
|
+
kind: "accepted",
|
|
215
|
+
worktreePath,
|
|
216
|
+
verified: false
|
|
217
|
+
});
|
|
182
218
|
return { applied: true, summary: summarize(findings) };
|
|
183
219
|
}
|
|
184
|
-
|
|
220
|
+
let result;
|
|
221
|
+
try {
|
|
222
|
+
result = await verify(worktreePath);
|
|
223
|
+
} catch (cause) {
|
|
224
|
+
return rethrowShotSetupError(
|
|
225
|
+
opts.onShotDisposition,
|
|
226
|
+
receipt,
|
|
227
|
+
worktreePath,
|
|
228
|
+
"verification",
|
|
229
|
+
cause
|
|
230
|
+
);
|
|
231
|
+
}
|
|
185
232
|
if (result.ok) {
|
|
233
|
+
await emitShotDisposition(opts.onShotDisposition, receipt, {
|
|
234
|
+
kind: "accepted",
|
|
235
|
+
worktreePath,
|
|
236
|
+
verified: true
|
|
237
|
+
});
|
|
186
238
|
return { applied: true, summary: summarize(findings) };
|
|
187
239
|
}
|
|
240
|
+
await emitShotDisposition(opts.onShotDisposition, receipt, {
|
|
241
|
+
kind: "rejected",
|
|
242
|
+
worktreePath,
|
|
243
|
+
stage: "verification",
|
|
244
|
+
feedback: result.feedback ?? null
|
|
245
|
+
});
|
|
188
246
|
attemptNote = failureNote(result.feedback);
|
|
189
247
|
}
|
|
190
248
|
return { applied: false, summary: "" };
|
|
@@ -284,9 +342,9 @@ async function withAuthorProfileResources(plan, worktreePath, run) {
|
|
|
284
342
|
if (cleanupError !== void 0) throw cleanupError;
|
|
285
343
|
return value;
|
|
286
344
|
}
|
|
287
|
-
async function emitShotReceipt(callback, receipt, primaryError) {
|
|
345
|
+
async function emitShotReceipt(callback, receipt, execution, primaryError) {
|
|
288
346
|
try {
|
|
289
|
-
await callback?.(receipt);
|
|
347
|
+
await callback?.(receipt, execution);
|
|
290
348
|
} catch (callbackError) {
|
|
291
349
|
if (primaryError !== null) {
|
|
292
350
|
throw new AggregateError(
|
|
@@ -298,6 +356,45 @@ async function emitShotReceipt(callback, receipt, primaryError) {
|
|
|
298
356
|
}
|
|
299
357
|
if (primaryError !== null) throw primaryError;
|
|
300
358
|
}
|
|
359
|
+
async function emitShotDisposition(callback, receipt, disposition) {
|
|
360
|
+
await callback?.(receipt, disposition);
|
|
361
|
+
}
|
|
362
|
+
async function rethrowShotSetupError(callback, receipt, worktreePath, stage, cause) {
|
|
363
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
364
|
+
try {
|
|
365
|
+
await emitShotDisposition(callback, receipt, {
|
|
366
|
+
kind: "setup-error",
|
|
367
|
+
worktreePath,
|
|
368
|
+
stage,
|
|
369
|
+
error: { name: error.name, message: error.message }
|
|
370
|
+
});
|
|
371
|
+
} catch (callbackError) {
|
|
372
|
+
throw new AggregateError(
|
|
373
|
+
[cause, callbackError],
|
|
374
|
+
"agenticGenerator: shot processing failed and its worktree disposition could not be persisted"
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
throw cause;
|
|
378
|
+
}
|
|
379
|
+
function shotExecutionSnapshot(result) {
|
|
380
|
+
if (result === null) return null;
|
|
381
|
+
const usage = result.usage ? Object.freeze({ ...result.usage }) : void 0;
|
|
382
|
+
const evidence = result.evidence ? Object.freeze({
|
|
383
|
+
...result.evidence,
|
|
384
|
+
readDeniedPaths: Object.freeze([...result.evidence.readDeniedPaths]),
|
|
385
|
+
policy: Object.freeze({ ...result.evidence.policy })
|
|
386
|
+
}) : void 0;
|
|
387
|
+
return Object.freeze({
|
|
388
|
+
exitCode: result.exitCode,
|
|
389
|
+
stdout: result.stdout,
|
|
390
|
+
stderr: result.stderr,
|
|
391
|
+
killedBySignal: result.killedBySignal,
|
|
392
|
+
durationMs: result.durationMs,
|
|
393
|
+
timedOut: result.timedOut,
|
|
394
|
+
...usage ? { usage } : {},
|
|
395
|
+
...evidence ? { evidence } : {}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
301
398
|
function shotReceipt(input) {
|
|
302
399
|
const error = input.error ? {
|
|
303
400
|
name: input.error instanceof Error ? input.error.name : "Error",
|
|
@@ -523,4 +620,4 @@ export {
|
|
|
523
620
|
agenticGenerator,
|
|
524
621
|
commandVerifier
|
|
525
622
|
};
|
|
526
|
-
//# sourceMappingURL=chunk-
|
|
623
|
+
//# sourceMappingURL=chunk-OLZ6ZZQ2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/improvement/agentic-generator.ts"],"sourcesContent":["/**\n *\n * `agenticGenerator` — the full-agentic `CandidateGenerator`: the\n * `shots=N, sandbox=on` setting of the one `improvementDriver`. It runs a real\n * coding harness (claude / codex / opencode) inside the candidate worktree the\n * driver already created, letting the agent read the codebase + the research\n * report and make the change in place. The driver then commits the worktree\n * into a `CodeSurface`.\n *\n * Mechanism: identical to the proven Phase-2.8 in-process executor — spawn the\n * harness as a subprocess with `cwd` = the worktree, on the same filesystem,\n * so edits land in place (no sandbox-mount round-trip). `runLocalHarness` is\n * the verified primitive. The OUTER sandbox is the improvement loop's own\n * execution context; the generator does not nest a second sandbox per\n * candidate (which would reintroduce a host↔sandbox worktree-transport\n * problem that does not need solving here).\n *\n * `maxShots` is the DEPTH dial — a multi-shot verify-in-session loop, NOT the\n * kernel `runLoop`. Each shot runs one full harness session in the (persistent)\n * worktree; between shots the loop refines based on what the last shot produced:\n * - empty tree → \"you changed nothing, make the edits\" → retry\n * - dirty + `verify` fails → feed the verifier's failure into the next shot\n * (the worktree persists, so the harness RESUMES atop its own failing\n * edits with the error in hand — no `--resume` session plumbing needed,\n * and harness-agnostic across claude/codex/opencode)\n * - dirty + `verify` ok (or no verifier configured) → return the candidate\n * A candidate that never verifies within `maxShots` is discarded (`applied:\n * false`), never shipped — if you configured a verifier, a non-passing tree is\n * not a candidate. With no verifier the legacy behavior holds: first dirty shot\n * is the candidate.\n *\n * @experimental\n */\n\nimport { spawnSync } from 'node:child_process'\nimport { createHash } from 'node:crypto'\nimport { existsSync, readFileSync, rmSync } from 'node:fs'\nimport { join, resolve, sep } from 'node:path'\nimport type {\n AnalystFinding,\n CostLedger,\n CostReceipt,\n CostReceiptInput,\n MaximumCharge,\n} from '@tangle-network/agent-eval'\nimport type { AgentProfile, ReasoningEffort } from '@tangle-network/agent-interface'\nimport {\n applyWorkspacePlan,\n materializeProfile,\n type WorkspacePlan,\n type WorkspacePlanReceipt,\n} from '@tangle-network/agent-profile-materialize'\nimport {\n type CodexExecutionEvidence,\n type CodexTokenUsage,\n harnessInvocation,\n type LocalHarness,\n type LocalHarnessResult,\n runLocalHarness,\n} from '../mcp/local-harness'\nimport type { CandidateGenerator } from './improvement-driver'\n\nconst RAW_TRACE_ANALYST_ID = 'raw-trace-distiller'\nconst RAW_TRACE_AREA = 'raw-trace-context'\nconst RAW_TRACE_DIAGNOSIS_PATH = '.improve/raw-trace-diagnosis.md'\n\n/** Dedicated ephemeral root for generic author-profile files. Every declared\n * file must live below this root so cleanup cannot alter candidate-owned files. */\nexport const AGENTIC_PROFILE_RESOURCE_ROOT = '.agent-runtime-profile-resources'\n\n/** Outcome of verifying a candidate worktree. `feedback` (compiler errors,\n * failing test output) is fed into the next shot when `ok` is false. */\nexport interface VerifyResult {\n ok: boolean\n feedback?: string\n}\n\n/** Verifies the edited worktree. Sync or async; throws only on a setup fault\n * (a candidate that fails verification returns `{ok:false}`, it does not\n * throw). */\nexport type Verifier = (worktreePath: string) => Promise<VerifyResult> | VerifyResult\n\nexport interface AgenticGeneratorShotReceipt {\n readonly schemaVersion: 1\n readonly generation: number | null\n readonly candidateIndex: number | null\n /** One-based shot number within this candidate. */\n readonly shot: number\n readonly maxShots: number\n readonly harness: LocalHarness\n readonly model: string | null\n readonly reasoningEffort: ReasoningEffort | null\n readonly promptSha256: `sha256:${string}`\n readonly startedAt: string\n readonly completedAt: string\n readonly durationMs: number\n readonly exitCode: number | null\n readonly timedOut: boolean\n readonly killedBySignal: NodeJS.Signals | null\n readonly stdoutBytes: number | null\n readonly stdoutSha256: `sha256:${string}` | null\n readonly stderrBytes: number | null\n readonly stderrSha256: `sha256:${string}` | null\n readonly usage: CodexTokenUsage | null\n /** Digest of the exact profile-file workspace plan applied for this shot. */\n readonly profileWorkspacePlanDigest: string | null\n readonly profileWorkspaceFileCount: number\n /** Shared run-ledger call id for this exact shot. */\n readonly costCallId: string | null\n /** Whether dollars came from the provider, the pricing table, or are unknown. */\n readonly costBasis: 'provider-reported' | 'estimated-pricing' | 'unknown'\n readonly costUsd: number | null\n /** True only for a provider-reported amount, never for a pricing estimate. */\n readonly costUsdKnown: boolean\n readonly evidence: CodexExecutionEvidence | null\n readonly error: { readonly name: string; readonly message: string } | null\n}\n\n/** Frozen exact harness result for an author shot: full streams, process state,\n * token usage, and execution-policy evidence.\n * The `onShotCompleted` callback receives `null` when execution failed before\n * the harness returned. */\nexport type AgenticGeneratorShotExecution = Readonly<\n Omit<LocalHarnessResult, 'usage' | 'evidence'> & {\n readonly usage?: Readonly<CodexTokenUsage>\n readonly evidence?: Readonly<Omit<CodexExecutionEvidence, 'readDeniedPaths' | 'policy'>> & {\n readonly readDeniedPaths: ReadonlyArray<string>\n readonly policy: Readonly<CodexExecutionEvidence['policy']>\n }\n }\n>\n\n/** Worktree decision emitted before a completed shot is retried, accepted, or\n * discarded. The callback runs while `worktreePath` is still available, so\n * callers can persist the exact diff. */\nexport type AgenticGeneratorShotDisposition =\n | {\n readonly kind: 'clean'\n readonly worktreePath: string\n }\n | {\n readonly kind: 'rejected'\n readonly worktreePath: string\n readonly stage: 'raw-trace-evidence' | 'verification'\n readonly feedback: string | null\n }\n | {\n readonly kind: 'accepted'\n readonly worktreePath: string\n readonly verified: boolean\n }\n | {\n readonly kind: 'setup-error'\n readonly worktreePath: string\n readonly stage: 'worktree-inspection' | 'raw-trace-evidence' | 'verification'\n readonly error: { readonly name: string; readonly message: string }\n }\n\nexport interface AgenticGeneratorOptions {\n /** Local coding harness to run in the worktree. Default `claude`. */\n harness?: LocalHarness\n /** Author profile rendered through the canonical harness mapper. Required\n * for reproducible Codex so model and reasoning settings are explicit. */\n profile?: AgentProfile\n /** Run Codex with isolated configuration, exact prompt evidence, and required\n * terminal token usage. Requires `harness: 'codex'` and `profile`. */\n codexReproducible?: boolean\n /** Absolute paths reproducible Codex must not read. A function can derive\n * candidate-specific paths after the driver creates its worktree. */\n codexReadDeniedPaths?: ReadonlyArray<string> | ((worktreePath: string) => ReadonlyArray<string>)\n /** Awaited once for every attempted author shot, including process failures.\n * The second argument preserves the exact harness result, including stdout\n * and stderr, before worktree inspection or verification can reject the\n * shot. Throwing aborts the candidate so evidence persistence fails closed. */\n onShotCompleted?: (\n receipt: AgenticGeneratorShotReceipt,\n execution: AgenticGeneratorShotExecution | null,\n ) => void | Promise<void>\n /** Awaited after worktree inspection and before the shot is accepted,\n * retried, or discarded. Throwing aborts the candidate. */\n onShotDisposition?: (\n receipt: AgenticGeneratorShotReceipt,\n disposition: AgenticGeneratorShotDisposition,\n ) => void | Promise<void>\n /** Optional hard upper bound passed to the run-wide CostLedger before each\n * author shot. This MUST be enforced by the provider or executor; a planning\n * estimate is not an admissible bound. Omit for an uncapped ledger. A capped\n * ledger rejects before model dispatch when this is absent. */\n maximumCharge?: MaximumCharge\n /** Per-shot wall-clock timeout (ms). Default = `runLocalHarness` default (5m). */\n timeoutMs?: number\n /** Build the harness task prompt from the report + findings. Override for\n * domain phrasing; the default turns findings into a concrete coder task. */\n buildPrompt?: (args: { report: unknown; findings: AnalystFinding[] }) => string\n /** Verify the worktree after each dirtying shot. When set, a candidate that\n * fails verification is NOT returned — the failure feeds the next shot\n * (verify-in-session), up to `maxShots`; a candidate that never verifies is\n * discarded (`applied:false`), never shipped. Omitted ⇒ legacy behavior:\n * the first dirty shot is the candidate. See `commandVerifier`. */\n verify?: Verifier\n /** Test seam — inject the harness runner (defaults to `runLocalHarness`). */\n runHarness?: typeof runLocalHarness\n /** Test seam — inject the worktree-dirty check (defaults to `git status`). */\n isDirty?: (worktreePath: string) => boolean\n}\n\n/** Full-agentic `CandidateGenerator` (the `shots=N, sandbox=on` setting): run a real coding harness inside the candidate worktree so the agent makes the change in place. */\nexport function agenticGenerator(opts: AgenticGeneratorOptions = {}): CandidateGenerator {\n const harness = opts.harness ?? 'claude'\n if (opts.codexReproducible && harness !== 'codex') {\n throw new Error(\"agenticGenerator: codexReproducible requires harness 'codex'\")\n }\n if (opts.codexReproducible && !opts.profile) {\n throw new Error('agenticGenerator: codexReproducible requires an explicit author profile')\n }\n if (opts.codexReadDeniedPaths && !opts.codexReproducible) {\n throw new Error('agenticGenerator: codexReadDeniedPaths requires codexReproducible')\n }\n if (opts.maximumCharge && !opts.codexReproducible) {\n throw new Error('agenticGenerator: maximumCharge requires codexReproducible')\n }\n const profileResourcePlan = opts.codexReproducible\n ? authorProfileResourcePlan(opts.profile as AgentProfile)\n : null\n const buildPrompt = opts.buildPrompt ?? defaultBuildPrompt\n const run = opts.runHarness ?? runLocalHarness\n const dirty = opts.isDirty ?? worktreeDirty\n const verify = opts.verify\n\n return {\n kind: `agentic:${harness}`,\n // The seed repo + (in rawTraceContext mode) the raw-trace filesystem context\n // are the change signal — an agentic coder proposes from them even when the\n // distiller yielded zero findings. Without this, the improvementDriver's\n // empty-findings guard short-circuits and generates ZERO candidates on the\n // first (and, for a single-generation run, only) proposal round.\n proposesWithoutFindings: true,\n async generate({\n worktreePath,\n report,\n findings,\n maxShots,\n signal,\n generation,\n candidateIndex,\n costLedger,\n costPhase,\n }) {\n if (opts.codexReproducible && !costLedger) {\n throw new Error(\n 'agenticGenerator: reproducible Codex requires the run-wide CostLedger supplied by agent-eval 0.117+',\n )\n }\n const basePrompt = appendProfileResourcePaths(\n buildPrompt({ report, findings }),\n profileResourcePlan,\n )\n const needsRawTraceEvidence = requiresRawTraceEvidence(findings)\n const shots = Math.max(1, maxShots)\n // Feedback appended to the base prompt for the NEXT shot — empty on shot 0.\n let attemptNote = ''\n\n for (let shot = 0; shot < shots; shot++) {\n if (signal.aborted) break\n const taskPrompt = attemptNote ? `${basePrompt}\\n\\n${attemptNote}` : basePrompt\n const invocation = opts.profile\n ? harnessInvocation(harness, opts.profile, taskPrompt, {\n dangerouslySkipPermissions: harness === 'claude',\n ...(opts.codexReproducible ? { codexReproducible: true } : {}),\n })\n : undefined\n const exactPrompt = invocation?.prompt ?? taskPrompt\n const readDeniedPaths =\n typeof opts.codexReadDeniedPaths === 'function'\n ? opts.codexReadDeniedPaths(worktreePath)\n : opts.codexReadDeniedPaths\n const startedAt = new Date()\n let harnessResult: LocalHarnessResult | null = null\n let profileWorkspaceReceipt: WorkspacePlanReceipt | null = null\n let costReceipt: CostReceipt | null = null\n let costCallId: string | null = null\n let shotError: Error | null = null\n try {\n const execute = async (executionSignal: AbortSignal): Promise<LocalHarnessResult> => {\n harnessResult = await withAuthorProfileResources(\n profileResourcePlan,\n worktreePath,\n async (receipt) => {\n profileWorkspaceReceipt = receipt\n const result = await run({\n harness,\n cwd: worktreePath,\n taskPrompt,\n ...(invocation\n ? { invocation: { command: invocation.command, args: invocation.args } }\n : {}),\n // The candidate worktree is isolated and must be editable without an\n // interactive permission prompt. Other runLocalHarness callers remain\n // permission-safe by default.\n dangerouslySkipPermissions: harness === 'claude',\n ...(opts.codexReproducible ? { codexReproducible: true } : {}),\n ...(readDeniedPaths ? { codexReadDeniedPaths: readDeniedPaths } : {}),\n timeoutMs: opts.timeoutMs,\n signal: executionSignal,\n })\n // Assign before profile cleanup so a cleanup failure still\n // settles the model usage already returned by the harness.\n harnessResult = result\n return result\n },\n )\n const failure = shotFailure(harnessResult, exactPrompt, opts.codexReproducible === true)\n if (failure) throw failure\n return harnessResult\n }\n\n if (opts.codexReproducible) {\n const ledger = costLedger as CostLedger\n const model = opts.profile?.model?.default\n if (!model) {\n throw new Error('agenticGenerator: reproducible Codex requires profile.model.default')\n }\n const paid = await ledger.runPaidCall({\n channel: 'driver',\n phase: costPhase ?? 'search.proposal',\n actor: `agentic-generator:${harness}`,\n model,\n tags: {\n generation: String(generation ?? -1),\n candidateIndex: String(candidateIndex ?? -1),\n shot: String(shot + 1),\n },\n signal,\n ...(opts.maximumCharge ? { maximumCharge: opts.maximumCharge } : {}),\n execute,\n receipt: (result) => costReceiptFromHarness(result, model),\n receiptFromError: () =>\n harnessResult?.usage ? costReceiptFromHarness(harnessResult, model) : undefined,\n })\n costCallId = paid.callId ?? null\n costReceipt = paid.receipt ?? null\n if (!paid.succeeded) throw paid.error\n harnessResult = paid.value\n } else {\n harnessResult = await execute(signal)\n }\n } catch (cause) {\n shotError = cause instanceof Error ? cause : new Error(String(cause))\n }\n const execution = shotExecutionSnapshot(harnessResult)\n const receipt = shotReceipt({\n generation,\n candidateIndex,\n shot,\n maxShots: shots,\n harness,\n profile: opts.profile,\n prompt: exactPrompt,\n startedAt,\n completedAt: new Date(),\n result: execution,\n profileWorkspaceReceipt,\n costCallId,\n costReceipt,\n error: shotError,\n })\n await emitShotReceipt(opts.onShotCompleted, receipt, execution, shotError)\n\n if (!execution) {\n throw new Error('agenticGenerator: author shot completed without a harness result')\n }\n\n let worktreeChanged: boolean\n try {\n worktreeChanged = dirty(worktreePath)\n } catch (cause) {\n return rethrowShotSetupError(\n opts.onShotDisposition,\n receipt,\n worktreePath,\n 'worktree-inspection',\n cause,\n )\n }\n\n // The worktree IS the signal: no edits ⇒ tell the next shot to act.\n if (!worktreeChanged) {\n await emitShotDisposition(opts.onShotDisposition, receipt, {\n kind: 'clean',\n worktreePath,\n })\n attemptNote = EMPTY_TREE_NOTE\n continue\n }\n\n if (needsRawTraceEvidence) {\n let problem: string | null\n try {\n problem = rawTraceEvidenceProblem(worktreePath, findings)\n } catch (cause) {\n return rethrowShotSetupError(\n opts.onShotDisposition,\n receipt,\n worktreePath,\n 'raw-trace-evidence',\n cause,\n )\n }\n if (problem) {\n await emitShotDisposition(opts.onShotDisposition, receipt, {\n kind: 'rejected',\n worktreePath,\n stage: 'raw-trace-evidence',\n feedback: problem,\n })\n attemptNote = problem\n continue\n }\n }\n\n // Dirty: with no verifier the diff IS the candidate (we trust the diff,\n // not the harness's stdout). With a verifier the candidate must pass it.\n if (!verify) {\n await emitShotDisposition(opts.onShotDisposition, receipt, {\n kind: 'accepted',\n worktreePath,\n verified: false,\n })\n return { applied: true, summary: summarize(findings) }\n }\n let result: VerifyResult\n try {\n result = await verify(worktreePath)\n } catch (cause) {\n return rethrowShotSetupError(\n opts.onShotDisposition,\n receipt,\n worktreePath,\n 'verification',\n cause,\n )\n }\n if (result.ok) {\n await emitShotDisposition(opts.onShotDisposition, receipt, {\n kind: 'accepted',\n worktreePath,\n verified: true,\n })\n return { applied: true, summary: summarize(findings) }\n }\n await emitShotDisposition(opts.onShotDisposition, receipt, {\n kind: 'rejected',\n worktreePath,\n stage: 'verification',\n feedback: result.feedback ?? null,\n })\n // Dirty but failing — resume next shot atop these edits with the error.\n attemptNote = failureNote(result.feedback)\n }\n\n // Shots exhausted: no verified candidate (or, sans verifier, no edits).\n return { applied: false, summary: '' }\n },\n }\n}\n\nfunction authorProfileResourcePlan(profile: AgentProfile): WorkspacePlan | null {\n const resources = profile.resources\n if (!resources) return null\n const unsupportedKinds = [\n resources.tools?.length ? 'tools' : null,\n resources.skills?.length ? 'skills' : null,\n resources.agents?.length ? 'agents' : null,\n ].filter((kind): kind is string => kind !== null)\n if (unsupportedKinds.length > 0) {\n throw new Error(\n `agenticGenerator: reproducible Codex author resources support files only; unsupported: ${unsupportedKinds.join(', ')}`,\n )\n }\n if (!resources.files || resources.files.length === 0) return null\n\n const plan = materializeProfile(\n {\n name: profile.name,\n resources: { files: resources.files },\n },\n 'codex',\n )\n if (plan.unsupported.length > 0) {\n throw new Error(\n `agenticGenerator: author profile files could not be materialized: ${plan.unsupported.map((item) => item.reason).join('; ')}`,\n )\n }\n if (Object.keys(plan.env).length > 0 || plan.flags.length > 0) {\n throw new Error(\n 'agenticGenerator: generic author profile files unexpectedly changed spawn values',\n )\n }\n\n const virtualRoot = resolve('/', AGENTIC_PROFILE_RESOURCE_ROOT)\n const seen = new Set<string>()\n for (const file of plan.files) {\n const target = resolve('/', file.relPath)\n if (!target.startsWith(`${virtualRoot}${sep}`)) {\n throw new Error(\n `agenticGenerator: author profile file must be below ${AGENTIC_PROFILE_RESOURCE_ROOT}: ${file.relPath}`,\n )\n }\n if (seen.has(target)) {\n throw new Error(`agenticGenerator: duplicate author profile file path: ${file.relPath}`)\n }\n seen.add(target)\n }\n return plan\n}\n\nfunction appendProfileResourcePaths(prompt: string, plan: WorkspacePlan | null): string {\n if (!plan) return prompt\n return [\n prompt,\n '',\n 'Profile resource files available for this shot:',\n ...plan.files.map((file) => `- ${file.relPath}`),\n ].join('\\n')\n}\n\nasync function withAuthorProfileResources<T>(\n plan: WorkspacePlan | null,\n worktreePath: string,\n run: (receipt: WorkspacePlanReceipt | null) => Promise<T>,\n): Promise<T> {\n if (!plan) return run(null)\n\n const rootPath = resolve(worktreePath, AGENTIC_PROFILE_RESOURCE_ROOT)\n if (existsSync(rootPath)) {\n throw new Error(\n `agenticGenerator: ephemeral author profile root already exists: ${AGENTIC_PROFILE_RESOURCE_ROOT}`,\n )\n }\n\n let value: T | undefined\n let primaryError: unknown\n try {\n const receipt = applyWorkspacePlan(plan, worktreePath)\n value = await run(receipt)\n } catch (cause) {\n primaryError = cause\n }\n\n let cleanupError: unknown\n try {\n rmSync(rootPath, { recursive: true, force: true })\n if (existsSync(rootPath)) {\n throw new Error(\n `agenticGenerator: ephemeral author profile root survived cleanup: ${AGENTIC_PROFILE_RESOURCE_ROOT}`,\n )\n }\n } catch (cause) {\n cleanupError = cause\n }\n\n if (primaryError !== undefined && cleanupError !== undefined) {\n throw new AggregateError(\n [primaryError, cleanupError],\n 'agenticGenerator: author shot and profile resource cleanup both failed',\n )\n }\n if (primaryError !== undefined) throw primaryError\n if (cleanupError !== undefined) throw cleanupError\n return value as T\n}\n\nasync function emitShotReceipt(\n callback: AgenticGeneratorOptions['onShotCompleted'],\n receipt: AgenticGeneratorShotReceipt,\n execution: AgenticGeneratorShotExecution | null,\n primaryError: Error | null,\n): Promise<void> {\n try {\n await callback?.(receipt, execution)\n } catch (callbackError) {\n if (primaryError !== null) {\n throw new AggregateError(\n [primaryError, callbackError],\n 'agenticGenerator: author shot failed and its receipt could not be persisted',\n )\n }\n throw callbackError\n }\n if (primaryError !== null) throw primaryError\n}\n\nasync function emitShotDisposition(\n callback: AgenticGeneratorOptions['onShotDisposition'],\n receipt: AgenticGeneratorShotReceipt,\n disposition: AgenticGeneratorShotDisposition,\n): Promise<void> {\n await callback?.(receipt, disposition)\n}\n\nasync function rethrowShotSetupError(\n callback: AgenticGeneratorOptions['onShotDisposition'],\n receipt: AgenticGeneratorShotReceipt,\n worktreePath: string,\n stage: Extract<AgenticGeneratorShotDisposition, { kind: 'setup-error' }>['stage'],\n cause: unknown,\n): Promise<never> {\n const error = cause instanceof Error ? cause : new Error(String(cause))\n try {\n await emitShotDisposition(callback, receipt, {\n kind: 'setup-error',\n worktreePath,\n stage,\n error: { name: error.name, message: error.message },\n })\n } catch (callbackError) {\n throw new AggregateError(\n [cause, callbackError],\n 'agenticGenerator: shot processing failed and its worktree disposition could not be persisted',\n )\n }\n throw cause\n}\n\nfunction shotExecutionSnapshot(\n result: LocalHarnessResult | null,\n): AgenticGeneratorShotExecution | null {\n if (result === null) return null\n const usage = result.usage ? Object.freeze({ ...result.usage }) : undefined\n const evidence = result.evidence\n ? Object.freeze({\n ...result.evidence,\n readDeniedPaths: Object.freeze([...result.evidence.readDeniedPaths]),\n policy: Object.freeze({ ...result.evidence.policy }),\n })\n : undefined\n return Object.freeze({\n exitCode: result.exitCode,\n stdout: result.stdout,\n stderr: result.stderr,\n killedBySignal: result.killedBySignal,\n durationMs: result.durationMs,\n timedOut: result.timedOut,\n ...(usage ? { usage } : {}),\n ...(evidence ? { evidence } : {}),\n })\n}\n\nfunction shotReceipt(input: {\n readonly generation: number | undefined\n readonly candidateIndex: number | undefined\n readonly shot: number\n readonly maxShots: number\n readonly harness: LocalHarness\n readonly profile: AgentProfile | undefined\n readonly prompt: string\n readonly startedAt: Date\n readonly completedAt: Date\n readonly result: AgenticGeneratorShotExecution | null\n readonly profileWorkspaceReceipt: WorkspacePlanReceipt | null\n readonly costCallId: string | null\n readonly costReceipt: CostReceipt | null\n readonly error: unknown\n}): AgenticGeneratorShotReceipt {\n const error = input.error\n ? {\n name: input.error instanceof Error ? input.error.name : 'Error',\n message: input.error instanceof Error ? input.error.message : String(input.error),\n }\n : null\n const result = input.result\n const costBasis = costBasisFor(input.costReceipt)\n return {\n schemaVersion: 1,\n generation: input.generation ?? null,\n candidateIndex: input.candidateIndex ?? null,\n shot: input.shot + 1,\n maxShots: input.maxShots,\n harness: input.harness,\n model: input.profile?.model?.default ?? null,\n reasoningEffort: input.profile?.model?.reasoningEffort ?? null,\n promptSha256: sha256(input.prompt),\n startedAt: input.startedAt.toISOString(),\n completedAt: input.completedAt.toISOString(),\n durationMs: result?.durationMs ?? input.completedAt.getTime() - input.startedAt.getTime(),\n exitCode: result?.exitCode ?? null,\n timedOut: result?.timedOut ?? false,\n killedBySignal: result?.killedBySignal ?? null,\n stdoutBytes: result ? Buffer.byteLength(result.stdout) : null,\n stdoutSha256: result ? sha256(result.stdout) : null,\n stderrBytes: result ? Buffer.byteLength(result.stderr) : null,\n stderrSha256: result ? sha256(result.stderr) : null,\n usage: result?.usage ? { ...result.usage } : null,\n profileWorkspacePlanDigest: input.profileWorkspaceReceipt?.workspacePlanDigest ?? null,\n profileWorkspaceFileCount: input.profileWorkspaceReceipt?.written.length ?? 0,\n costCallId: input.costCallId,\n costBasis,\n costUsd: costBasis === 'unknown' ? null : (input.costReceipt?.costUsd ?? null),\n costUsdKnown: costBasis === 'provider-reported',\n evidence: result?.evidence\n ? {\n ...result.evidence,\n readDeniedPaths: [...result.evidence.readDeniedPaths],\n policy: { ...result.evidence.policy },\n }\n : null,\n error,\n }\n}\n\nfunction costBasisFor(receipt: CostReceipt | null): AgenticGeneratorShotReceipt['costBasis'] {\n if (receipt === null || receipt.costUnknown) return 'unknown'\n return receipt.actualCostUsd === undefined ? 'estimated-pricing' : 'provider-reported'\n}\n\nfunction shotFailure(\n result: LocalHarnessResult,\n exactPrompt: string,\n codexReproducible: boolean,\n): Error | null {\n if (result.timedOut) {\n return new Error('agenticGenerator: author shot timed out')\n }\n if (result.killedBySignal) {\n return new Error(`agenticGenerator: author shot was killed by ${result.killedBySignal}`)\n }\n if (result.exitCode !== 0) {\n return new Error(`agenticGenerator: author shot exited with code ${String(result.exitCode)}`)\n }\n if (!codexReproducible) return null\n if (!result.usage || !result.evidence) {\n return new Error(\n 'agenticGenerator: reproducible Codex shot completed without usage or execution evidence',\n )\n }\n const expectedPromptSha256 = sha256(exactPrompt).slice('sha256:'.length)\n if (result.evidence.requestedPromptSha256 !== expectedPromptSha256) {\n return new Error(\n 'agenticGenerator: reproducible Codex prompt evidence does not match the exact authored prompt',\n )\n }\n return null\n}\n\nfunction costReceiptFromHarness(result: LocalHarnessResult, model: string): CostReceiptInput {\n if (!result.usage) {\n throw new Error('agenticGenerator: author shot did not report terminal token usage')\n }\n return {\n model,\n inputTokens: result.usage.inputTokens - result.usage.cachedInputTokens,\n outputTokens: result.usage.outputTokens,\n ...(result.usage.cachedInputTokens > 0 ? { cachedTokens: result.usage.cachedInputTokens } : {}),\n }\n}\n\nfunction sha256(value: string): `sha256:${string}` {\n return `sha256:${createHash('sha256').update(value).digest('hex')}`\n}\n\n/** Turn the analyst's findings (+ optional report) into a concrete coder task. */\nfunction defaultBuildPrompt(args: { report: unknown; findings: AnalystFinding[] }): string {\n const lines: string[] = [\n 'You are improving this codebase based on an evaluation analysis.',\n 'Make the smallest set of edits that addresses the findings below, then stop.',\n 'Do not change unrelated code. Do not commit — leave changes in the working tree.',\n '',\n 'Findings:',\n ]\n for (const f of args.findings) {\n const where = f.subject ? ` [${f.subject}]` : ''\n lines.push(`- (${f.severity})${where} ${f.claim}`)\n if (f.recommended_action) lines.push(` → ${f.recommended_action}`)\n }\n if (requiresRawTraceEvidence(args.findings)) {\n lines.push(\n '',\n 'Raw trace evidence requirement:',\n `- Inspect at least one raw trace path named above before editing.`,\n `- Write ${RAW_TRACE_DIAGNOSIS_PATH} in this worktree.`,\n '- Include the exact trace path(s) inspected, the failure mechanism, and the code change made.',\n '- A candidate without this file, or with only this file changed, is discarded.',\n )\n }\n return lines.join('\\n')\n}\n\nconst EMPTY_TREE_NOTE =\n 'NOTE: your previous attempt left the working tree unchanged. Make the concrete file edits now.'\n\n/** Next-shot feedback when the worktree is dirty but failed verification. The\n * edits persist on disk, so the harness resumes atop them — tell it to fix in\n * place, not start over. Verifier detail is truncated to keep the prompt bounded. */\nfunction failureNote(feedback?: string): string {\n const detail = feedback?.trim()\n return [\n 'NOTE: your edits are in the working tree but verification FAILED.',\n 'Fix the problem in place — build on your existing edits, do not revert them.',\n detail ? `Verifier output:\\n${truncate(detail, 4000)}` : 'No verifier detail was captured.',\n ].join('\\n')\n}\n\nfunction rawTraceEvidenceProblem(worktreePath: string, findings: AnalystFinding[]): string | null {\n const changedPaths = worktreeChangedPaths(worktreePath)\n const substantive = changedPaths.filter((path) => path !== RAW_TRACE_DIAGNOSIS_PATH)\n if (substantive.length === 0) {\n return [\n `NOTE: raw-trace mode requires a real code/config edit in addition to ${RAW_TRACE_DIAGNOSIS_PATH}.`,\n 'Your previous attempt only changed the diagnosis artifact. Inspect the cited traces and make the causal code change.',\n ].join('\\n')\n }\n\n const diagnosisPath = join(worktreePath, RAW_TRACE_DIAGNOSIS_PATH)\n if (!existsSync(diagnosisPath)) {\n return [\n `NOTE: raw-trace mode requires ${RAW_TRACE_DIAGNOSIS_PATH}.`,\n 'Before retrying, inspect at least one cited spans.jsonl/cached-result.json/artifact path, then write the diagnosis file with the exact path, failure mechanism, and code change.',\n ].join('\\n')\n }\n\n const body = readFileSync(diagnosisPath, 'utf8')\n const evidencePaths = traceEvidencePaths(findings)\n if (evidencePaths.length > 0 && !evidencePaths.some((path) => body.includes(path))) {\n return [\n `${RAW_TRACE_DIAGNOSIS_PATH} exists, but it does not cite any exact raw trace path from the findings.`,\n `Cite at least one of these inspected paths exactly: ${evidencePaths.slice(0, 5).join(', ')}`,\n ].join('\\n')\n }\n\n return null\n}\n\nfunction requiresRawTraceEvidence(findings: AnalystFinding[]): boolean {\n return findings.some((finding) => {\n const f = finding as unknown as Record<string, unknown>\n return f.analyst_id === RAW_TRACE_ANALYST_ID || f.area === RAW_TRACE_AREA\n })\n}\n\nfunction traceEvidencePaths(findings: AnalystFinding[]): string[] {\n const out: string[] = []\n for (const finding of findings) {\n const refs = (finding as unknown as { evidence_refs?: unknown }).evidence_refs\n if (!Array.isArray(refs)) continue\n for (const ref of refs) {\n if (!ref || typeof ref !== 'object') continue\n const uri = (ref as { uri?: unknown }).uri\n if (typeof uri === 'string' && uri.length > 0) out.push(uri)\n }\n }\n return [...new Set(out)]\n}\n\n/** A `Verifier` that runs a command in the worktree: exit 0 ⇒ ok, any other\n * exit ⇒ failed with stdout+stderr as feedback. The common case — verify by\n * `tsc --noEmit`, `pnpm build`, or a test command. A timeout is treated as a\n * FAILED candidate (a change that hangs the build is a bad change); a missing\n * binary or spawn fault throws (a setup bug, not a failed candidate — no\n * silent fallback). */\nexport function commandVerifier(\n command: string,\n args: string[] = [],\n timeoutMs = 300_000,\n): Verifier {\n return (worktreePath: string): VerifyResult => {\n const result = spawnSync(command, args, {\n cwd: worktreePath,\n encoding: 'utf-8',\n timeout: timeoutMs,\n })\n if (result.signal) {\n return {\n ok: false,\n feedback: `verifier '${command}' killed by ${result.signal} (likely timeout after ${timeoutMs}ms)`,\n }\n }\n if (result.error) {\n const code = (result.error as NodeJS.ErrnoException).code\n if (code === 'ENOENT') {\n throw new Error(\n `commandVerifier: '${command}' not found in PATH (setup bug, not a failed candidate)`,\n )\n }\n throw new Error(`commandVerifier: '${command}' failed to spawn: ${result.error.message}`)\n }\n if (result.status === 0) return { ok: true }\n const out = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim()\n return { ok: false, feedback: out.length > 0 ? out : `exit ${result.status}` }\n }\n}\n\n/** A one-line summary for the commit message, derived from the findings. */\nfunction summarize(findings: AnalystFinding[]): string {\n if (findings.length === 0) return 'agentic improvement'\n if (findings.length === 1) return `agentic: ${truncate(findings[0]!.claim, 64)}`\n return `agentic: ${findings.length} findings addressed`\n}\n\nfunction truncate(s: string, n: number): string {\n return s.length <= n ? s : `${s.slice(0, n - 1)}…`\n}\n\n/** Non-empty `git status --porcelain` ⇒ the harness changed the worktree.\n * Fails loud: the worktree is a fresh checkout, so a git error here means\n * something is genuinely broken (git missing, corrupt index, killed mid-run).\n * Folding that into `false` would silently discard a candidate and mask the\n * real failure — forbidden by the no-silent-fallbacks doctrine. */\nfunction worktreeDirty(worktreePath: string): boolean {\n return worktreeChangedPaths(worktreePath).length > 0\n}\n\nfunction worktreeChangedPaths(worktreePath: string): string[] {\n const result = spawnSync('git', ['status', '--porcelain', '--untracked-files=all'], {\n cwd: worktreePath,\n encoding: 'utf-8',\n })\n if (result.error) {\n throw new Error(\n `agenticGenerator: git status failed to spawn in ${worktreePath}: ${result.error.message}`,\n )\n }\n if (result.status !== 0) {\n throw new Error(\n `agenticGenerator: git status exited ${result.status} in ${worktreePath}: ${result.stderr.trim()}`,\n )\n }\n return result.stdout\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .map((line) => line.slice(3).trim())\n}\n"],"mappings":";;;;;;AAkCA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,YAAY,cAAc,cAAc;AACjD,SAAS,MAAM,SAAS,WAAW;AASnC;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAWP,IAAM,uBAAuB;AAC7B,IAAM,iBAAiB;AACvB,IAAM,2BAA2B;AAI1B,IAAM,gCAAgC;AA2ItC,SAAS,iBAAiB,OAAgC,CAAC,GAAuB;AACvF,QAAM,UAAU,KAAK,WAAW;AAChC,MAAI,KAAK,qBAAqB,YAAY,SAAS;AACjD,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACA,MAAI,KAAK,qBAAqB,CAAC,KAAK,SAAS;AAC3C,UAAM,IAAI,MAAM,yEAAyE;AAAA,EAC3F;AACA,MAAI,KAAK,wBAAwB,CAAC,KAAK,mBAAmB;AACxD,UAAM,IAAI,MAAM,mEAAmE;AAAA,EACrF;AACA,MAAI,KAAK,iBAAiB,CAAC,KAAK,mBAAmB;AACjD,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACA,QAAM,sBAAsB,KAAK,oBAC7B,0BAA0B,KAAK,OAAuB,IACtD;AACJ,QAAM,cAAc,KAAK,eAAe;AACxC,QAAM,MAAM,KAAK,cAAc;AAC/B,QAAM,QAAQ,KAAK,WAAW;AAC9B,QAAM,SAAS,KAAK;AAEpB,SAAO;AAAA,IACL,MAAM,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMxB,yBAAyB;AAAA,IACzB,MAAM,SAAS;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;A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AU,UAAoC;AACrD,MAAI,SAAS,WAAW,EAAG,QAAO;AAClC,MAAI,SAAS,WAAW,EAAG,QAAO,YAAY,SAAS,SAAS,CAAC,EAAG,OAAO,EAAE,CAAC;AAC9E,SAAO,YAAY,SAAS,MAAM;AACpC;AAEA,SAAS,SAAS,GAAW,GAAmB;AAC9C,SAAO,EAAE,UAAU,IAAI,IAAI,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AACjD;AAOA,SAAS,cAAc,cAA+B;AACpD,SAAO,qBAAqB,YAAY,EAAE,SAAS;AACrD;AAEA,SAAS,qBAAqB,cAAgC;AAC5D,QAAM,SAAS,UAAU,OAAO,CAAC,UAAU,eAAe,uBAAuB,GAAG;AAAA,IAClF,KAAK;AAAA,IACL,UAAU;AAAA,EACZ,CAAC;AACD,MAAI,OAAO,OAAO;AAChB,UAAM,IAAI;AAAA,MACR,mDAAmD,YAAY,KAAK,OAAO,MAAM,OAAO;AAAA,IAC1F;AAAA,EACF;AACA,MAAI,OAAO,WAAW,GAAG;AACvB,UAAM,IAAI;AAAA,MACR,uCAAuC,OAAO,MAAM,OAAO,YAAY,KAAK,OAAO,OAAO,KAAK,CAAC;AAAA,IAClG;AAAA,EACF;AACA,SAAO,OAAO,OACX,MAAM,IAAI,EACV,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,EAChC,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC;AACvC;","names":["receipt","result"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkspacePlanReceipt } from '@tangle-network/agent-profile-materialize';
|
|
2
|
-
import { L as LocalHarness, C as CodexTokenUsage,
|
|
2
|
+
import { L as LocalHarness, C as CodexTokenUsage, c as CodexExecutionPolicy } from './local-harness-ZqCx51u7.js';
|
|
3
3
|
import { c as Executor } from './types-CogNCaw7.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -5,8 +5,8 @@ import { S as SandboxClient, E as ExecCtx, g as LoopTraceEmitter, e as LoopTrace
|
|
|
5
5
|
import { BackendType, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
6
6
|
import { AgentEvalError } from '@tangle-network/agent-eval';
|
|
7
7
|
import { b as ToolSpec, c as RuntimeTelemetryOptions, R as RouterConfig } from './sanitize-Dcbjp0tU.js';
|
|
8
|
-
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
9
|
-
import { L as LocalHarness } from './local-harness-
|
|
8
|
+
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-Bn4AZ_Kw.js';
|
|
9
|
+
import { L as LocalHarness } from './local-harness-ZqCx51u7.js';
|
|
10
10
|
import { ProviderExecutorOptions, AgentEnvironmentProviderRegistry } from './environment-provider.js';
|
|
11
11
|
import { AgentEnvironmentProvider } from '@tangle-network/agent-interface/environment-provider';
|
|
12
12
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WorktreeAdapter } from '@tangle-network/agent-eval/campaign';
|
|
2
2
|
import { Scenario, SelfImproveOptions, SurfaceProposer, SelfImproveResult, MutableSurface } from '@tangle-network/agent-eval/contract';
|
|
3
3
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
4
|
-
import { L as LocalHarness } from './local-harness-
|
|
5
|
-
import { V as Verifier, C as CandidateGenerator } from './agentic-generator-
|
|
4
|
+
import { L as LocalHarness } from './local-harness-ZqCx51u7.js';
|
|
5
|
+
import { V as Verifier, C as CandidateGenerator } from './agentic-generator-JT47GnAp.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -5,30 +5,30 @@ export { r as AgentAdapter, s as AgentKnowledgeProvider, A as AgentRuntimeEvent,
|
|
|
5
5
|
export { AgentCandidateCodeSource, AgentCandidateCodeSurfaceSource, AgentCandidateModelGrantActivateInput, AgentCandidateModelGrantClient, AgentCandidateModelGrantReservation, AgentCandidateModelGrantReserveInput, AgentCandidateModelGrantSettleInput, AgentCandidateProfileSource, AgentCandidateWorkspaceArchiveLimits, BuildAgentCandidateBundleInput, CaptureAgentCandidateWorkspaceOptions, CapturedAgentCandidateWorkspace, CreateAgentCandidateWorkspacePortOptions, CreateProtectedAgentCandidateModelPortOptions, DisposePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, FileAgentCandidateExecutionClaimStoreOptions, RecoverExpiredAgentCandidateOptions, applyExactAgentProfileDiff, buildAgentCandidateBundle, candidateExecutionClaim, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, createAgentCandidateWorkspacePort, createProtectedAgentCandidateModelPort, disposePreparedAgentCandidateExecution, parseExactAgentProfile, parseExactAgentProfileDiff, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, verifyAgentCandidateBundle } from './candidate-execution/index.js';
|
|
6
6
|
export { d as AgentCandidateArtifactPort, e as AgentCandidateBenchmarkGraderIdentity, f as AgentCandidateBenchmarkGraderPort, A as AgentCandidateBundleInput, g as AgentCandidateContainerPort, h as AgentCandidateExecutionAttemptRecord, i as AgentCandidateExecutionAttemptRef, j as AgentCandidateExecutionClaim, k as AgentCandidateExecutionClaimResult, l as AgentCandidateExecutionClaimStore, m as AgentCandidateExecutionCleanupHandles, n as AgentCandidateExecutionFailureClass, o as AgentCandidateExecutionFinishResult, p as AgentCandidateExecutionLease, q as AgentCandidateExecutionPhase, r as AgentCandidateExecutionPhaseResult, b as AgentCandidateExecutionPorts, s as AgentCandidateExecutionRecoveryEvidence, t as AgentCandidateExecutionStageResult, u as AgentCandidateExecutionTerminalRecord, v as AgentCandidateExecutionTerminalResult, w as AgentCandidateExecutionUsage, x as AgentCandidateExecutorFinalCapture, y as AgentCandidateExecutorMemoryCapture, z as AgentCandidateExecutorPort, B as AgentCandidateExecutorProfileFile, C as AgentCandidateExecutorRequest, D as AgentCandidateExecutorStopRequest, F as AgentCandidateExecutorTaskOutcomeCapture, G as AgentCandidateExecutorWorkspaceFile, H as AgentCandidateExecutorWorkspaceInput, I as AgentCandidateMemoryPort, J as AgentCandidateMemoryResetResult, K as AgentCandidateModelLimits, L as AgentCandidateModelPort, M as AgentCandidateOutputArtifactPort, N as AgentCandidateOutputPurpose, O as AgentCandidateProtectedModelActivation, Q as AgentCandidateProtectedModelCall, R as AgentCandidateProtectedModelReservation, S as AgentCandidateProtectedModelSettlement, T as AgentCandidateProtectedRunCapture, U as AgentCandidateRepositoryPort, V as AgentCandidateRetryRejection, c as AgentCandidateRunFinalization, a as AgentCandidateTaskExecution, W as AgentCandidateVerificationPorts, X as AgentCandidateWorkspacePort, Y as CANDIDATE_TRACE_ENV, Z as CANDIDATE_TRACE_TAGS, _ as CanonicalCandidateDocument, E as ExecutePreparedAgentCandidateOptions, $ as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, a0 as PreparedAgentCandidateExecution, a1 as PreparedAgentCandidateInstruction, a2 as PreparedAgentCandidateLaunch, a3 as PreparedAgentCandidateTrace, a4 as ResolvedAgentCandidateContainer, a5 as VerifiedAgentCandidate, a6 as VerifiedAgentCandidateTaskOutcome, a7 as executePreparedAgentCandidate, a8 as prepareAgentCandidateExecution, a9 as sealAgentCandidateBundle } from './prepare-DIeVgQG3.js';
|
|
7
7
|
import { Scenario, ProfileDispatchFn, ProposeContext, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
|
|
8
|
-
import { C as CandidateGenerator } from './agentic-generator-
|
|
9
|
-
export { A as AGENTIC_PROFILE_RESOURCE_ROOT, a as AgenticGeneratorOptions, b as AgenticGeneratorShotReceipt, I as ImprovementDriverOptions, M as ManagedImprovementDriver, V as Verifier,
|
|
10
|
-
export { c as ImproveCodeOptions, d as ImproveMemoryOptions, a as ImproveOptions, b as ImproveResult, e as ImproveSkillsOptions, I as ImproveSurface, f as applyImprovementWinnerToProfile, i as improve } from './improve-
|
|
11
|
-
export { M as McpServeSpec, m as mcpServeVerifier } from './mcp-serve-verifier-
|
|
8
|
+
import { C as CandidateGenerator } from './agentic-generator-JT47GnAp.js';
|
|
9
|
+
export { A as AGENTIC_PROFILE_RESOURCE_ROOT, a as AgenticGeneratorOptions, b as AgenticGeneratorShotDisposition, c as AgenticGeneratorShotExecution, d as AgenticGeneratorShotReceipt, I as ImprovementDriverOptions, M as ManagedImprovementDriver, V as Verifier, e as VerifyResult, f as agenticGenerator, g as commandVerifier, i as improvementDriver } from './agentic-generator-JT47GnAp.js';
|
|
10
|
+
export { c as ImproveCodeOptions, d as ImproveMemoryOptions, a as ImproveOptions, b as ImproveResult, e as ImproveSkillsOptions, I as ImproveSurface, f as applyImprovementWinnerToProfile, i as improve } from './improve-BucbjddC.js';
|
|
11
|
+
export { M as McpServeSpec, m as mcpServeVerifier } from './mcp-serve-verifier-i6nTNSnu.js';
|
|
12
12
|
import { AgentProfileDiff, AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
13
13
|
import { Scenario as Scenario$1, SelfImproveOptions } from '@tangle-network/agent-eval/contract';
|
|
14
14
|
import { S as SurfaceImprovementEdit } from './improvement-adapter-BieWeK5J.js';
|
|
15
15
|
import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
|
|
16
16
|
export { AgentKnowledgeReadinessCheckOptions, KnowledgeImprovementJobMeasurement, KnowledgeImprovementJobResult, KnowledgeReadinessCheck, KnowledgeReadinessCheckInput, KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, RunKnowledgeImprovementJobOptions, SupervisedKnowledgeUpdateInput, SupervisedKnowledgeUpdateOptions, SupervisedKnowledgeUpdateResult, SupervisedKnowledgeUpdater, createAgentKnowledgeReadinessCheck, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate } from './knowledge.js';
|
|
17
|
-
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-
|
|
17
|
+
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-D6K_C6op.js';
|
|
18
18
|
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-0wACz8f8.js';
|
|
19
|
-
export { b0 as EvalRunEvent, b1 as EvalRunGeneration, b2 as EvalRunsExportConfig, b3 as EvalRunsExportResult, b4 as INTELLIGENCE_WIRE_VERSION, b5 as LoopSpanNode, b6 as OtelAttribute, b7 as OtelExportConfig, b8 as OtelExporter, b9 as OtelSpan, ba as RuntimeEventOtelOptions, bb as buildLoopOtelSpans, bc as buildLoopSpanNodes, bd as buildRuntimeEventOtelSpans, be as createOtelExporter, bf as exportEvalRuns, bg as loopEventToOtelSpan } from './coordination-
|
|
19
|
+
export { b0 as EvalRunEvent, b1 as EvalRunGeneration, b2 as EvalRunsExportConfig, b3 as EvalRunsExportResult, b4 as INTELLIGENCE_WIRE_VERSION, b5 as LoopSpanNode, b6 as OtelAttribute, b7 as OtelExportConfig, b8 as OtelExporter, b9 as OtelSpan, ba as RuntimeEventOtelOptions, bb as buildLoopOtelSpans, bc as buildLoopSpanNodes, bd as buildRuntimeEventOtelSpans, be as createOtelExporter, bf as exportEvalRuns, bg as loopEventToOtelSpan } from './coordination-DzwagV_s.js';
|
|
20
20
|
import { c as RuntimeTelemetryOptions } from './sanitize-Dcbjp0tU.js';
|
|
21
21
|
export { d as RuntimeEventCollector, e as RuntimeStreamEventCollector, S as SanitizedKnowledgeReadinessReport, f as createRuntimeEventCollector, g as createRuntimeStreamEventCollector, s as sanitizeAgentRuntimeEvent, h as sanitizeKnowledgeReadinessReport, i as sanitizeRuntimeStreamEvent } from './sanitize-Dcbjp0tU.js';
|
|
22
22
|
import '@tangle-network/sandbox';
|
|
23
|
-
import './local-harness-
|
|
23
|
+
import './local-harness-ZqCx51u7.js';
|
|
24
24
|
import 'node:child_process';
|
|
25
25
|
import '@tangle-network/agent-knowledge';
|
|
26
|
-
import './supervise-
|
|
26
|
+
import './supervise-CzyytS-o.js';
|
|
27
27
|
import './types-CogNCaw7.js';
|
|
28
|
-
import './completion-gate-
|
|
28
|
+
import './completion-gate-Bn4AZ_Kw.js';
|
|
29
29
|
import '@tangle-network/agent-profile-materialize';
|
|
30
30
|
import './kb-gate-CwHO0vz6.js';
|
|
31
|
-
import './worktree-fanout-
|
|
31
|
+
import './worktree-fanout-Bn7w_1bM.js';
|
|
32
32
|
import './substrate-DO2GHNg2.js';
|
|
33
33
|
import './environment-provider.js';
|
|
34
34
|
import '@tangle-network/agent-interface/environment-provider';
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
improve,
|
|
38
38
|
improvementDriver,
|
|
39
39
|
rawTraceDistiller
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-5LIOH5DR.js";
|
|
41
41
|
import {
|
|
42
42
|
CANDIDATE_TRACE_ENV,
|
|
43
43
|
CANDIDATE_TRACE_TAGS,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
AGENTIC_PROFILE_RESOURCE_ROOT,
|
|
74
74
|
agenticGenerator,
|
|
75
75
|
commandVerifier
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-OLZ6ZZQ2.js";
|
|
77
77
|
import {
|
|
78
78
|
RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
|
|
79
79
|
createAgentKnowledgeReadinessCheck,
|
package/dist/intelligence.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import { AnalystFinding } from '@tangle-network/agent-eval/analyst';
|
|
|
5
5
|
import { Scenario, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
6
6
|
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
|
|
7
7
|
import { A as AgentCandidateBundleInput, a as AgentCandidateTaskExecution, b as AgentCandidateExecutionPorts, P as PrepareAgentCandidateExecutionOptions, E as ExecutePreparedAgentCandidateOptions, c as AgentCandidateRunFinalization } from './prepare-DIeVgQG3.js';
|
|
8
|
-
import { I as ImproveSurface, a as ImproveOptions, b as ImproveResult } from './improve-
|
|
8
|
+
import { I as ImproveSurface, a as ImproveOptions, b as ImproveResult } from './improve-BucbjddC.js';
|
|
9
9
|
import '@tangle-network/agent-eval';
|
|
10
10
|
import '@tangle-network/sandbox';
|
|
11
11
|
import '@tangle-network/agent-eval/campaign';
|
|
12
|
-
import './local-harness-
|
|
12
|
+
import './local-harness-ZqCx51u7.js';
|
|
13
13
|
import 'node:child_process';
|
|
14
|
-
import './agentic-generator-
|
|
14
|
+
import './agentic-generator-JT47GnAp.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
package/dist/intelligence.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyImprovementWinnerToProfile,
|
|
3
3
|
improve
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5LIOH5DR.js";
|
|
5
5
|
import {
|
|
6
6
|
assertCandidateProfileBinding,
|
|
7
7
|
canonicalCandidateDigest,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
runAnalystLoop
|
|
19
19
|
} from "./chunk-QDSOD7RC.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-OLZ6ZZQ2.js";
|
|
21
21
|
import {
|
|
22
22
|
buildLoopOtelSpans,
|
|
23
23
|
buildRuntimeEventOtelSpans,
|
package/dist/knowledge.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { KnowledgeReadinessSpec, BuildEvalKnowledgeBundleOptions, KnowledgeBaseQualityOptions, KnowledgeImprovementResult, KnowledgeImprovementOptions } from '@tangle-network/agent-knowledge';
|
|
2
|
-
import { E as ExecutorConfig } from './coordination-
|
|
3
|
-
import { a as SuperviseOptions, S as SupervisorProfile } from './supervise-
|
|
2
|
+
import { E as ExecutorConfig } from './coordination-DzwagV_s.js';
|
|
3
|
+
import { a as SuperviseOptions, S as SupervisorProfile } from './supervise-CzyytS-o.js';
|
|
4
4
|
import { B as Budget, b as SupervisedResult } from './types-CogNCaw7.js';
|
|
5
|
-
import { D as DeliverableSpec } from './completion-gate-
|
|
5
|
+
import { D as DeliverableSpec } from './completion-gate-Bn4AZ_Kw.js';
|
|
6
6
|
import '@tangle-network/agent-interface';
|
|
7
7
|
import './substrate-DO2GHNg2.js';
|
|
8
8
|
import './types-CKmyZ9TP.js';
|
|
9
9
|
import '@tangle-network/agent-eval';
|
|
10
10
|
import '@tangle-network/sandbox';
|
|
11
11
|
import './sanitize-Dcbjp0tU.js';
|
|
12
|
-
import './local-harness-
|
|
12
|
+
import './local-harness-ZqCx51u7.js';
|
|
13
13
|
import 'node:child_process';
|
|
14
14
|
import './environment-provider.js';
|
|
15
15
|
import '@tangle-network/agent-interface/environment-provider';
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { AgentProfile } from '@tangle-network/agent-interface';
|
|
|
2
2
|
import { a as ProfileArtifact, A as ArtifactKind, b as ArtifactStatus, c as ArtifactInput, E as EvalRunner, d as EvalResult, G as GenerateContext, C as CandidateGenerator, e as PromotionVerdict, P as PromotionGate } from './generator-YkAQrOoD.js';
|
|
3
3
|
export { f as ArtifactPayloads, H as HeldOutPromotionGateOptions, M as MarginalLift, g as MeasureMarginalLiftOptions, h as heldOutPromotionGate, m as measureMarginalLift, t as thresholdPromotionGate } from './generator-YkAQrOoD.js';
|
|
4
4
|
import { LlmClientOptions, AnalystFinding } from '@tangle-network/agent-eval';
|
|
5
|
-
import { M as McpServeSpec } from './mcp-serve-verifier-
|
|
6
|
-
import { L as LocalHarness } from './local-harness-
|
|
7
|
-
import './agentic-generator-
|
|
5
|
+
import { M as McpServeSpec } from './mcp-serve-verifier-i6nTNSnu.js';
|
|
6
|
+
import { L as LocalHarness } from './local-harness-ZqCx51u7.js';
|
|
7
|
+
import './agentic-generator-JT47GnAp.js';
|
|
8
8
|
import '@tangle-network/agent-eval/campaign';
|
|
9
9
|
import 'node:child_process';
|
|
10
10
|
|
package/dist/lifecycle.js
CHANGED
|
@@ -160,4 +160,4 @@ declare function runLocalHarness(options: RunLocalHarnessOptions): Promise<Local
|
|
|
160
160
|
/** Parse and validate the one terminal usage event emitted by `codex exec --json`. */
|
|
161
161
|
declare function parseCodexTokenUsage(stdout: string): CodexTokenUsage;
|
|
162
162
|
|
|
163
|
-
export { type CodexTokenUsage as C, type LocalHarness as L, type RunLocalHarnessOptions as R, type CodexExecutionEvidence as a, type
|
|
163
|
+
export { type CodexTokenUsage as C, type LocalHarness as L, type RunLocalHarnessOptions as R, type CodexExecutionEvidence as a, type LocalHarnessResult as b, type CodexExecutionPolicy as c, parseCodexTokenUsage as p, runLocalHarness as r };
|
|
@@ -3,7 +3,7 @@ import { SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eva
|
|
|
3
3
|
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
|
|
4
4
|
import { F as FactCandidate, C as CreateKbGateOptions } from './kb-gate-CwHO0vz6.js';
|
|
5
5
|
import { B as Budget } from './types-CogNCaw7.js';
|
|
6
|
-
import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-
|
|
6
|
+
import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-Bn7w_1bM.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, k as runLoopRunnerCli } from './loop-runner-bin-
|
|
2
|
+
export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, k as runLoopRunnerCli } from './loop-runner-bin-D6K_C6op.js';
|
|
3
3
|
import '@tangle-network/agent-eval/campaign';
|
|
4
4
|
import '@tangle-network/agent-eval/contract';
|
|
5
5
|
import './types-BC3bZpH0.js';
|
|
@@ -9,8 +9,8 @@ import './types-CogNCaw7.js';
|
|
|
9
9
|
import '@tangle-network/agent-interface';
|
|
10
10
|
import '@tangle-network/sandbox';
|
|
11
11
|
import './types-CKmyZ9TP.js';
|
|
12
|
-
import './worktree-fanout-
|
|
13
|
-
import './completion-gate-
|
|
12
|
+
import './worktree-fanout-Bn7w_1bM.js';
|
|
13
|
+
import './completion-gate-Bn4AZ_Kw.js';
|
|
14
14
|
import '@tangle-network/agent-profile-materialize';
|
|
15
|
-
import './local-harness-
|
|
15
|
+
import './local-harness-ZqCx51u7.js';
|
|
16
16
|
import 'node:child_process';
|
package/dist/loops.d.ts
CHANGED
|
@@ -4,26 +4,26 @@ import { SandboxEvent, SandboxInstance, CreateSandboxOptions, PromptOptions, Tas
|
|
|
4
4
|
export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
5
5
|
import { a as ResultBlobStore, f as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, A as Agent, B as Budget, S as Scope, h as Settled, b as SupervisedResult, i as Spend, U as UsageEvent, e as ExecutorRegistry, k as Supervisor } from './types-CogNCaw7.js';
|
|
6
6
|
export { d as AgentSpec, c as Executor, l as ExecutorContext, m as ExecutorResult, R as Runtime, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-CogNCaw7.js';
|
|
7
|
-
import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, as as QuestionPolicy, E as ExecutorConfig } from './coordination-
|
|
8
|
-
export { bh as BusEvent, bi as BusRecord, bj as BusStats, bk as EventBus, bl as ProviderSeam, bm as PublishOptions, bn as cliWorktreeExecutor, bo as createEventBus, bp as createExecutor, bq as createExecutorRegistry } from './coordination-
|
|
7
|
+
import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, as as QuestionPolicy, E as ExecutorConfig } from './coordination-DzwagV_s.js';
|
|
8
|
+
export { bh as BusEvent, bi as BusRecord, bj as BusStats, bk as EventBus, bl as ProviderSeam, bm as PublishOptions, bn as cliWorktreeExecutor, bo as createEventBus, bp as createExecutor, bq as createExecutorRegistry } from './coordination-DzwagV_s.js';
|
|
9
9
|
import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, d as AgentRunSpec, c as OutputAdapter, V as Validator, E as ExecCtx, X as LoopWinner, Y as LoopLineageOptions, Z as LoopResult, L as LoopTokenUsage, a as RuntimeStreamEvent, _ as MountRecorder, k as AgentExecutionBackend, b as AgentTaskStatus, B as BackendErrorDetail, $ as SelectionReceipt } from './types-CKmyZ9TP.js';
|
|
10
10
|
export { a0 as LoopDecisionPayload, a1 as LoopEndedPayload, a2 as LoopIterationDispatchPayload, a3 as LoopIterationEndedPayload, a4 as LoopIterationStartedPayload, a5 as LoopPlanDescription, a6 as LoopPlanPayload, f as LoopSandboxPlacement, a7 as LoopStartedPayload, a8 as LoopTeardownFailedPayload, g as LoopTraceEmitter, e as LoopTraceEvent, a9 as MountManifestEntry, aa as RunProvenance, ab as ValidationCtx } from './types-CKmyZ9TP.js';
|
|
11
11
|
import { RunProfileMatrixResult, Scenario, ProfileDispatchFn, JudgeConfig, RunProfileMatrixOptions, DispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
12
12
|
export { AgentEnvironmentProviderRef, AgentEnvironmentProviderRegistry, ProviderAsSandboxClientOptions, ProviderExecutorOptions, SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider } from './environment-provider.js';
|
|
13
|
-
import { C as CorpusRecord, c as Corpus, O as Outcome, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-
|
|
14
|
-
export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-
|
|
13
|
+
import { C as CorpusRecord, c as Corpus, O as Outcome, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-Bn7w_1bM.js';
|
|
14
|
+
export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-Bn7w_1bM.js';
|
|
15
15
|
import { b as AnalystRegistryLike } from './types-BC3bZpH0.js';
|
|
16
16
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
17
17
|
import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-Dcbjp0tU.js';
|
|
18
18
|
export { j as RouterChatResult, k as RouterChatToolsResult, l as RouterToolCall, m as RouterToolLoopResult, n as ToolLoopCompaction, b as ToolSpec, r as routerBrain, o as routerChatWithTools, p as routerChatWithUsage, q as routerToolLoop } from './sanitize-Dcbjp0tU.js';
|
|
19
|
-
import { D as DeliverableSpec } from './completion-gate-
|
|
20
|
-
export { g as WorktreeCommandResult, h as WorktreeProfileMaterializationReceipt, i as gateOnDeliverable } from './completion-gate-
|
|
21
|
-
import { S as SupervisorProfile } from './supervise-
|
|
22
|
-
export { D as DriveHarness, a as SuperviseOptions, b as SupervisorAgentDeps, s as supervise, c as supervisorAgent, w as workerFromBackend } from './supervise-
|
|
19
|
+
import { D as DeliverableSpec } from './completion-gate-Bn4AZ_Kw.js';
|
|
20
|
+
export { g as WorktreeCommandResult, h as WorktreeProfileMaterializationReceipt, i as gateOnDeliverable } from './completion-gate-Bn4AZ_Kw.js';
|
|
21
|
+
import { S as SupervisorProfile } from './supervise-CzyytS-o.js';
|
|
22
|
+
export { D as DriveHarness, a as SuperviseOptions, b as SupervisorAgentDeps, s as supervise, c as supervisorAgent, w as workerFromBackend } from './supervise-CzyytS-o.js';
|
|
23
23
|
import { stuckLoopView, toolWasteView } from '@tangle-network/agent-eval/pipelines';
|
|
24
24
|
export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
|
|
25
25
|
import './substrate-DO2GHNg2.js';
|
|
26
|
-
import './local-harness-
|
|
26
|
+
import './local-harness-ZqCx51u7.js';
|
|
27
27
|
import 'node:child_process';
|
|
28
28
|
import '@tangle-network/agent-profile-materialize';
|
|
29
29
|
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { S as SandboxClient, f as LoopSandboxPlacement } from '../types-CKmyZ9TP.js';
|
|
2
|
-
import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-
|
|
3
|
-
export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, G as DelegateResearchConfig, H as DelegateResearchResult, I as DelegateResult, J as DelegateRunCtx, K as DelegateUiAuditConfig, L as DelegateUiAuditRoute, N as DelegationError, O as DelegationFeedbackSnapshot, P as DelegationHistoryEntry, Q as DelegationPersistenceError, R as DelegationProfile, S as DelegationProgress, T as DelegationRecord, V as DelegationResultPayload, W as DelegationResumeContext, X as DelegationResumeDriver, Y as DelegationResumeTick, Z as DelegationRunContext, _ as DelegationStateCorruptError, $ as DelegationStatus, a0 as DelegationStore, a1 as DelegationTaskQueueOptions, a2 as DelegationTraceCaps, a3 as DelegationTraceCollector, a4 as DelegationTraceSpan, a5 as DetachedSessionDelegateOptions, a6 as DetachedSessionRefParts, a7 as DetachedTurn, a8 as DetachedTurnResumeDriverOptions, a9 as DetachedWinnerSelection, aa as DriveTurnCapableBox, ab as DriveTurnTick, ac as FeedbackEvent, ad as FeedbackRating, ae as FeedbackRefersTo, af as FileDelegationStore, ag as FileDelegationStoreOptions, ah as FleetWorkspaceExecutorOptions, ai as InMemoryDelegationStore, aj as InMemoryFeedbackStore, ak as JsonRpcMessage, al as JsonRpcResponse, M as MakeWorkerAgent, am as McpServer, an as McpServerOptions, ao as McpToolDescriptor, ap as McpTransport, aq as Question, ar as QuestionDecision, as as QuestionPolicy, at as QuestionRecord, au as ResearchOutputShape, av as ResearchSource, aw as RunDetachedTurnOptions, ax as SettleDetachedCoderTurnOptions, ay as SettledWorker, az as SiblingSandboxExecutorOptions, aA as SubmitInput, aB as SubmitOutput, aC as TraceContext, aD as UiAuditorDelegationOutput, aE as buildDelegationTraceSpans, aF as capDelegationTrace, aG as coderTaskFromArgs, aH as composeLoopTraceEmitters, aI as createCoordinationTools, aJ as createDelegateHandler, aK as createDelegationTraceCollector, aL as createDetachedTurnResumeDriver, aM as createFleetWorkspaceExecutor, aN as createInProcessTransport, aO as createMcpServer, aP as createPropagatingTraceEmitter, aQ as createSiblingSandboxExecutor, aR as detachedSessionDelegate, aS as detachedTurnEvents, aT as eventToSnapshot, aU as formatDetachedSessionRef, aV as hashIdempotencyInput, aW as parseDetachedSessionRef, aX as readTraceContextFromEnv, aY as runDetachedTurn, aZ as settleDetachedCoderTurn, a_ as traceContextToEnv, a$ as validateDelegateArgs } from '../coordination-
|
|
4
|
-
import { L as LocalHarness, r as runLocalHarness } from '../local-harness-
|
|
5
|
-
export { a as CodexExecutionEvidence,
|
|
6
|
-
import { G as GitRunner } from '../completion-gate-
|
|
7
|
-
export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../completion-gate-
|
|
2
|
+
import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-DzwagV_s.js';
|
|
3
|
+
export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, G as DelegateResearchConfig, H as DelegateResearchResult, I as DelegateResult, J as DelegateRunCtx, K as DelegateUiAuditConfig, L as DelegateUiAuditRoute, N as DelegationError, O as DelegationFeedbackSnapshot, P as DelegationHistoryEntry, Q as DelegationPersistenceError, R as DelegationProfile, S as DelegationProgress, T as DelegationRecord, V as DelegationResultPayload, W as DelegationResumeContext, X as DelegationResumeDriver, Y as DelegationResumeTick, Z as DelegationRunContext, _ as DelegationStateCorruptError, $ as DelegationStatus, a0 as DelegationStore, a1 as DelegationTaskQueueOptions, a2 as DelegationTraceCaps, a3 as DelegationTraceCollector, a4 as DelegationTraceSpan, a5 as DetachedSessionDelegateOptions, a6 as DetachedSessionRefParts, a7 as DetachedTurn, a8 as DetachedTurnResumeDriverOptions, a9 as DetachedWinnerSelection, aa as DriveTurnCapableBox, ab as DriveTurnTick, ac as FeedbackEvent, ad as FeedbackRating, ae as FeedbackRefersTo, af as FileDelegationStore, ag as FileDelegationStoreOptions, ah as FleetWorkspaceExecutorOptions, ai as InMemoryDelegationStore, aj as InMemoryFeedbackStore, ak as JsonRpcMessage, al as JsonRpcResponse, M as MakeWorkerAgent, am as McpServer, an as McpServerOptions, ao as McpToolDescriptor, ap as McpTransport, aq as Question, ar as QuestionDecision, as as QuestionPolicy, at as QuestionRecord, au as ResearchOutputShape, av as ResearchSource, aw as RunDetachedTurnOptions, ax as SettleDetachedCoderTurnOptions, ay as SettledWorker, az as SiblingSandboxExecutorOptions, aA as SubmitInput, aB as SubmitOutput, aC as TraceContext, aD as UiAuditorDelegationOutput, aE as buildDelegationTraceSpans, aF as capDelegationTrace, aG as coderTaskFromArgs, aH as composeLoopTraceEmitters, aI as createCoordinationTools, aJ as createDelegateHandler, aK as createDelegationTraceCollector, aL as createDetachedTurnResumeDriver, aM as createFleetWorkspaceExecutor, aN as createInProcessTransport, aO as createMcpServer, aP as createPropagatingTraceEmitter, aQ as createSiblingSandboxExecutor, aR as detachedSessionDelegate, aS as detachedTurnEvents, aT as eventToSnapshot, aU as formatDetachedSessionRef, aV as hashIdempotencyInput, aW as parseDetachedSessionRef, aX as readTraceContextFromEnv, aY as runDetachedTurn, aZ as settleDetachedCoderTurn, a_ as traceContextToEnv, a$ as validateDelegateArgs } from '../coordination-DzwagV_s.js';
|
|
4
|
+
import { L as LocalHarness, r as runLocalHarness } from '../local-harness-ZqCx51u7.js';
|
|
5
|
+
export { a as CodexExecutionEvidence, c as CodexExecutionPolicy, C as CodexTokenUsage, b as LocalHarnessResult, R as RunLocalHarnessOptions, p as parseCodexTokenUsage } from '../local-harness-ZqCx51u7.js';
|
|
6
|
+
import { G as GitRunner } from '../completion-gate-Bn4AZ_Kw.js';
|
|
7
|
+
export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../completion-gate-Bn4AZ_Kw.js';
|
|
8
8
|
export { C as CreateKbGateOptions, F as FactCandidate, a as FactJudge, b as FactJudgeVerdict, K as KbGateResult, c as createKbGate } from '../kb-gate-CwHO0vz6.js';
|
|
9
9
|
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-0wACz8f8.js';
|
|
10
10
|
import { AnalystFinding } from '@tangle-network/agent-eval';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as Scope, a as ResultBlobStore, B as Budget, A as Agent, b as SupervisedResult } from './types-CogNCaw7.js';
|
|
2
|
-
import { M as MakeWorkerAgent, A as AnalystRegistry, E as ExecutorConfig } from './coordination-
|
|
2
|
+
import { M as MakeWorkerAgent, A as AnalystRegistry, E as ExecutorConfig } from './coordination-DzwagV_s.js';
|
|
3
3
|
import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-Dcbjp0tU.js';
|
|
4
|
-
import { D as DeliverableSpec } from './completion-gate-
|
|
4
|
+
import { D as DeliverableSpec } from './completion-gate-Bn4AZ_Kw.js';
|
|
5
5
|
|
|
6
6
|
/** The supervisor's profile — the subset of an `AgentProfile` that selects + shapes its brain.
|
|
7
7
|
* `harness` is the backend-as-data discriminant; `systemPrompt` is the standing instruction. */
|
|
@@ -3,8 +3,8 @@ import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
|
|
|
3
3
|
import { d as AgentSpec, e as ExecutorRegistry, B as Budget, A as Agent, f as SpawnJournal, a as ResultBlobStore, g as RootHandle, b as SupervisedResult, N as NodeId, h as Settled, i as Spend, S as Scope, c as Executor } from './types-CogNCaw7.js';
|
|
4
4
|
import { R as RuntimeHooks, I as Iteration } from './types-CKmyZ9TP.js';
|
|
5
5
|
import { BackendType } from '@tangle-network/sandbox';
|
|
6
|
-
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
7
|
-
import { L as LocalHarness, r as runLocalHarness } from './local-harness-
|
|
6
|
+
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-Bn4AZ_Kw.js';
|
|
7
|
+
import { L as LocalHarness, r as runLocalHarness } from './local-harness-ZqCx51u7.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.11",
|
|
4
4
|
"description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
6
|
"repository": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/improvement/agentic-generator.ts"],"sourcesContent":["/**\n *\n * `agenticGenerator` — the full-agentic `CandidateGenerator`: the\n * `shots=N, sandbox=on` setting of the one `improvementDriver`. It runs a real\n * coding harness (claude / codex / opencode) inside the candidate worktree the\n * driver already created, letting the agent read the codebase + the research\n * report and make the change in place. The driver then commits the worktree\n * into a `CodeSurface`.\n *\n * Mechanism: identical to the proven Phase-2.8 in-process executor — spawn the\n * harness as a subprocess with `cwd` = the worktree, on the same filesystem,\n * so edits land in place (no sandbox-mount round-trip). `runLocalHarness` is\n * the verified primitive. The OUTER sandbox is the improvement loop's own\n * execution context; the generator does not nest a second sandbox per\n * candidate (which would reintroduce a host↔sandbox worktree-transport\n * problem that does not need solving here).\n *\n * `maxShots` is the DEPTH dial — a multi-shot verify-in-session loop, NOT the\n * kernel `runLoop`. Each shot runs one full harness session in the (persistent)\n * worktree; between shots the loop refines based on what the last shot produced:\n * - empty tree → \"you changed nothing, make the edits\" → retry\n * - dirty + `verify` fails → feed the verifier's failure into the next shot\n * (the worktree persists, so the harness RESUMES atop its own failing\n * edits with the error in hand — no `--resume` session plumbing needed,\n * and harness-agnostic across claude/codex/opencode)\n * - dirty + `verify` ok (or no verifier configured) → return the candidate\n * A candidate that never verifies within `maxShots` is discarded (`applied:\n * false`), never shipped — if you configured a verifier, a non-passing tree is\n * not a candidate. With no verifier the legacy behavior holds: first dirty shot\n * is the candidate.\n *\n * @experimental\n */\n\nimport { spawnSync } from 'node:child_process'\nimport { createHash } from 'node:crypto'\nimport { existsSync, readFileSync, rmSync } from 'node:fs'\nimport { join, resolve, sep } from 'node:path'\nimport type {\n AnalystFinding,\n CostLedger,\n CostReceipt,\n CostReceiptInput,\n MaximumCharge,\n} from '@tangle-network/agent-eval'\nimport type { AgentProfile, ReasoningEffort } from '@tangle-network/agent-interface'\nimport {\n applyWorkspacePlan,\n materializeProfile,\n type WorkspacePlan,\n type WorkspacePlanReceipt,\n} from '@tangle-network/agent-profile-materialize'\nimport {\n type CodexExecutionEvidence,\n type CodexTokenUsage,\n harnessInvocation,\n type LocalHarness,\n type LocalHarnessResult,\n runLocalHarness,\n} from '../mcp/local-harness'\nimport type { CandidateGenerator } from './improvement-driver'\n\nconst RAW_TRACE_ANALYST_ID = 'raw-trace-distiller'\nconst RAW_TRACE_AREA = 'raw-trace-context'\nconst RAW_TRACE_DIAGNOSIS_PATH = '.improve/raw-trace-diagnosis.md'\n\n/** Dedicated ephemeral root for generic author-profile files. Every declared\n * file must live below this root so cleanup cannot alter candidate-owned files. */\nexport const AGENTIC_PROFILE_RESOURCE_ROOT = '.agent-runtime-profile-resources'\n\n/** Outcome of verifying a candidate worktree. `feedback` (compiler errors,\n * failing test output) is fed into the next shot when `ok` is false. */\nexport interface VerifyResult {\n ok: boolean\n feedback?: string\n}\n\n/** Verifies the edited worktree. Sync or async; throws only on a setup fault\n * (a candidate that fails verification returns `{ok:false}`, it does not\n * throw). */\nexport type Verifier = (worktreePath: string) => Promise<VerifyResult> | VerifyResult\n\nexport interface AgenticGeneratorShotReceipt {\n readonly schemaVersion: 1\n readonly generation: number | null\n readonly candidateIndex: number | null\n /** One-based shot number within this candidate. */\n readonly shot: number\n readonly maxShots: number\n readonly harness: LocalHarness\n readonly model: string | null\n readonly reasoningEffort: ReasoningEffort | null\n readonly promptSha256: `sha256:${string}`\n readonly startedAt: string\n readonly completedAt: string\n readonly durationMs: number\n readonly exitCode: number | null\n readonly timedOut: boolean\n readonly killedBySignal: NodeJS.Signals | null\n readonly stdoutBytes: number | null\n readonly stdoutSha256: `sha256:${string}` | null\n readonly stderrBytes: number | null\n readonly stderrSha256: `sha256:${string}` | null\n readonly usage: CodexTokenUsage | null\n /** Digest of the exact profile-file workspace plan applied for this shot. */\n readonly profileWorkspacePlanDigest: string | null\n readonly profileWorkspaceFileCount: number\n /** Shared run-ledger call id for this exact shot. */\n readonly costCallId: string | null\n /** Whether dollars came from the provider, the pricing table, or are unknown. */\n readonly costBasis: 'provider-reported' | 'estimated-pricing' | 'unknown'\n readonly costUsd: number | null\n /** True only for a provider-reported amount, never for a pricing estimate. */\n readonly costUsdKnown: boolean\n readonly evidence: CodexExecutionEvidence | null\n readonly error: { readonly name: string; readonly message: string } | null\n}\n\nexport interface AgenticGeneratorOptions {\n /** Local coding harness to run in the worktree. Default `claude`. */\n harness?: LocalHarness\n /** Author profile rendered through the canonical harness mapper. Required\n * for reproducible Codex so model and reasoning settings are explicit. */\n profile?: AgentProfile\n /** Run Codex with isolated configuration, exact prompt evidence, and required\n * terminal token usage. Requires `harness: 'codex'` and `profile`. */\n codexReproducible?: boolean\n /** Absolute paths reproducible Codex must not read. A function can derive\n * candidate-specific paths after the driver creates its worktree. */\n codexReadDeniedPaths?: ReadonlyArray<string> | ((worktreePath: string) => ReadonlyArray<string>)\n /** Awaited once for every attempted author shot, including process failures.\n * Throwing aborts the candidate so receipt persistence can fail closed. */\n onShotCompleted?: (receipt: AgenticGeneratorShotReceipt) => void | Promise<void>\n /** Optional hard upper bound passed to the run-wide CostLedger before each\n * author shot. This MUST be enforced by the provider or executor; a planning\n * estimate is not an admissible bound. Omit for an uncapped ledger. A capped\n * ledger rejects before model dispatch when this is absent. */\n maximumCharge?: MaximumCharge\n /** Per-shot wall-clock timeout (ms). Default = `runLocalHarness` default (5m). */\n timeoutMs?: number\n /** Build the harness task prompt from the report + findings. Override for\n * domain phrasing; the default turns findings into a concrete coder task. */\n buildPrompt?: (args: { report: unknown; findings: AnalystFinding[] }) => string\n /** Verify the worktree after each dirtying shot. When set, a candidate that\n * fails verification is NOT returned — the failure feeds the next shot\n * (verify-in-session), up to `maxShots`; a candidate that never verifies is\n * discarded (`applied:false`), never shipped. Omitted ⇒ legacy behavior:\n * the first dirty shot is the candidate. See `commandVerifier`. */\n verify?: Verifier\n /** Test seam — inject the harness runner (defaults to `runLocalHarness`). */\n runHarness?: typeof runLocalHarness\n /** Test seam — inject the worktree-dirty check (defaults to `git status`). */\n isDirty?: (worktreePath: string) => boolean\n}\n\n/** Full-agentic `CandidateGenerator` (the `shots=N, sandbox=on` setting): run a real coding harness inside the candidate worktree so the agent makes the change in place. */\nexport function agenticGenerator(opts: AgenticGeneratorOptions = {}): CandidateGenerator {\n const harness = opts.harness ?? 'claude'\n if (opts.codexReproducible && harness !== 'codex') {\n throw new Error(\"agenticGenerator: codexReproducible requires harness 'codex'\")\n }\n if (opts.codexReproducible && !opts.profile) {\n throw new Error('agenticGenerator: codexReproducible requires an explicit author profile')\n }\n if (opts.codexReadDeniedPaths && !opts.codexReproducible) {\n throw new Error('agenticGenerator: codexReadDeniedPaths requires codexReproducible')\n }\n if (opts.maximumCharge && !opts.codexReproducible) {\n throw new Error('agenticGenerator: maximumCharge requires codexReproducible')\n }\n const profileResourcePlan = opts.codexReproducible\n ? authorProfileResourcePlan(opts.profile as AgentProfile)\n : null\n const buildPrompt = opts.buildPrompt ?? defaultBuildPrompt\n const run = opts.runHarness ?? runLocalHarness\n const dirty = opts.isDirty ?? worktreeDirty\n const verify = opts.verify\n\n return {\n kind: `agentic:${harness}`,\n // The seed repo + (in rawTraceContext mode) the raw-trace filesystem context\n // are the change signal — an agentic coder proposes from them even when the\n // distiller yielded zero findings. Without this, the improvementDriver's\n // empty-findings guard short-circuits and generates ZERO candidates on the\n // first (and, for a single-generation run, only) proposal round.\n proposesWithoutFindings: true,\n async generate({\n worktreePath,\n report,\n findings,\n maxShots,\n signal,\n generation,\n candidateIndex,\n costLedger,\n costPhase,\n }) {\n if (opts.codexReproducible && !costLedger) {\n throw new Error(\n 'agenticGenerator: reproducible Codex requires the run-wide CostLedger supplied by agent-eval 0.117+',\n )\n }\n const basePrompt = appendProfileResourcePaths(\n buildPrompt({ report, findings }),\n profileResourcePlan,\n )\n const needsRawTraceEvidence = requiresRawTraceEvidence(findings)\n const shots = Math.max(1, maxShots)\n // Feedback appended to the base prompt for the NEXT shot — empty on shot 0.\n let attemptNote = ''\n\n for (let shot = 0; shot < shots; shot++) {\n if (signal.aborted) break\n const taskPrompt = attemptNote ? `${basePrompt}\\n\\n${attemptNote}` : basePrompt\n const invocation = opts.profile\n ? harnessInvocation(harness, opts.profile, taskPrompt, {\n dangerouslySkipPermissions: harness === 'claude',\n ...(opts.codexReproducible ? { codexReproducible: true } : {}),\n })\n : undefined\n const exactPrompt = invocation?.prompt ?? taskPrompt\n const readDeniedPaths =\n typeof opts.codexReadDeniedPaths === 'function'\n ? opts.codexReadDeniedPaths(worktreePath)\n : opts.codexReadDeniedPaths\n const startedAt = new Date()\n let harnessResult: LocalHarnessResult | null = null\n let profileWorkspaceReceipt: WorkspacePlanReceipt | null = null\n let costReceipt: CostReceipt | null = null\n let costCallId: string | null = null\n let shotError: Error | null = null\n try {\n const execute = async (executionSignal: AbortSignal): Promise<LocalHarnessResult> => {\n harnessResult = await withAuthorProfileResources(\n profileResourcePlan,\n worktreePath,\n async (receipt) => {\n profileWorkspaceReceipt = receipt\n const result = await run({\n harness,\n cwd: worktreePath,\n taskPrompt,\n ...(invocation\n ? { invocation: { command: invocation.command, args: invocation.args } }\n : {}),\n // The candidate worktree is isolated and must be editable without an\n // interactive permission prompt. Other runLocalHarness callers remain\n // permission-safe by default.\n dangerouslySkipPermissions: harness === 'claude',\n ...(opts.codexReproducible ? { codexReproducible: true } : {}),\n ...(readDeniedPaths ? { codexReadDeniedPaths: readDeniedPaths } : {}),\n timeoutMs: opts.timeoutMs,\n signal: executionSignal,\n })\n // Assign before profile cleanup so a cleanup failure still\n // settles the model usage already returned by the harness.\n harnessResult = result\n return result\n },\n )\n const failure = shotFailure(harnessResult, exactPrompt, opts.codexReproducible === true)\n if (failure) throw failure\n return harnessResult\n }\n\n if (opts.codexReproducible) {\n const ledger = costLedger as CostLedger\n const model = opts.profile?.model?.default\n if (!model) {\n throw new Error('agenticGenerator: reproducible Codex requires profile.model.default')\n }\n const paid = await ledger.runPaidCall({\n channel: 'driver',\n phase: costPhase ?? 'search.proposal',\n actor: `agentic-generator:${harness}`,\n model,\n tags: {\n generation: String(generation ?? -1),\n candidateIndex: String(candidateIndex ?? -1),\n shot: String(shot + 1),\n },\n signal,\n ...(opts.maximumCharge ? { maximumCharge: opts.maximumCharge } : {}),\n execute,\n receipt: (result) => costReceiptFromHarness(result, model),\n receiptFromError: () =>\n harnessResult?.usage ? costReceiptFromHarness(harnessResult, model) : undefined,\n })\n costCallId = paid.callId ?? null\n costReceipt = paid.receipt ?? null\n if (!paid.succeeded) throw paid.error\n harnessResult = paid.value\n } else {\n harnessResult = await execute(signal)\n }\n } catch (cause) {\n shotError = cause instanceof Error ? cause : new Error(String(cause))\n }\n await emitShotReceipt(\n opts.onShotCompleted,\n shotReceipt({\n generation,\n candidateIndex,\n shot,\n maxShots: shots,\n harness,\n profile: opts.profile,\n prompt: exactPrompt,\n startedAt,\n completedAt: new Date(),\n result: harnessResult,\n profileWorkspaceReceipt,\n costCallId,\n costReceipt,\n error: shotError,\n }),\n shotError,\n )\n\n if (!harnessResult) {\n throw new Error('agenticGenerator: author shot completed without a harness result')\n }\n\n // The worktree IS the signal: no edits ⇒ tell the next shot to act.\n if (!dirty(worktreePath)) {\n attemptNote = EMPTY_TREE_NOTE\n continue\n }\n\n if (needsRawTraceEvidence) {\n const problem = rawTraceEvidenceProblem(worktreePath, findings)\n if (problem) {\n attemptNote = problem\n continue\n }\n }\n\n // Dirty: with no verifier the diff IS the candidate (we trust the diff,\n // not the harness's stdout). With a verifier the candidate must pass it.\n if (!verify) {\n return { applied: true, summary: summarize(findings) }\n }\n const result = await verify(worktreePath)\n if (result.ok) {\n return { applied: true, summary: summarize(findings) }\n }\n // Dirty but failing — resume next shot atop these edits with the error.\n attemptNote = failureNote(result.feedback)\n }\n\n // Shots exhausted: no verified candidate (or, sans verifier, no edits).\n return { applied: false, summary: '' }\n },\n }\n}\n\nfunction authorProfileResourcePlan(profile: AgentProfile): WorkspacePlan | null {\n const resources = profile.resources\n if (!resources) return null\n const unsupportedKinds = [\n resources.tools?.length ? 'tools' : null,\n resources.skills?.length ? 'skills' : null,\n resources.agents?.length ? 'agents' : null,\n ].filter((kind): kind is string => kind !== null)\n if (unsupportedKinds.length > 0) {\n throw new Error(\n `agenticGenerator: reproducible Codex author resources support files only; unsupported: ${unsupportedKinds.join(', ')}`,\n )\n }\n if (!resources.files || resources.files.length === 0) return null\n\n const plan = materializeProfile(\n {\n name: profile.name,\n resources: { files: resources.files },\n },\n 'codex',\n )\n if (plan.unsupported.length > 0) {\n throw new Error(\n `agenticGenerator: author profile files could not be materialized: ${plan.unsupported.map((item) => item.reason).join('; ')}`,\n )\n }\n if (Object.keys(plan.env).length > 0 || plan.flags.length > 0) {\n throw new Error(\n 'agenticGenerator: generic author profile files unexpectedly changed spawn values',\n )\n }\n\n const virtualRoot = resolve('/', AGENTIC_PROFILE_RESOURCE_ROOT)\n const seen = new Set<string>()\n for (const file of plan.files) {\n const target = resolve('/', file.relPath)\n if (!target.startsWith(`${virtualRoot}${sep}`)) {\n throw new Error(\n `agenticGenerator: author profile file must be below ${AGENTIC_PROFILE_RESOURCE_ROOT}: ${file.relPath}`,\n )\n }\n if (seen.has(target)) {\n throw new Error(`agenticGenerator: duplicate author profile file path: ${file.relPath}`)\n }\n seen.add(target)\n }\n return plan\n}\n\nfunction appendProfileResourcePaths(prompt: string, plan: WorkspacePlan | null): string {\n if (!plan) return prompt\n return [\n prompt,\n '',\n 'Profile resource files available for this shot:',\n ...plan.files.map((file) => `- ${file.relPath}`),\n ].join('\\n')\n}\n\nasync function withAuthorProfileResources<T>(\n plan: WorkspacePlan | null,\n worktreePath: string,\n run: (receipt: WorkspacePlanReceipt | null) => Promise<T>,\n): Promise<T> {\n if (!plan) return run(null)\n\n const rootPath = resolve(worktreePath, AGENTIC_PROFILE_RESOURCE_ROOT)\n if (existsSync(rootPath)) {\n throw new Error(\n `agenticGenerator: ephemeral author profile root already exists: ${AGENTIC_PROFILE_RESOURCE_ROOT}`,\n )\n }\n\n let value: T | undefined\n let primaryError: unknown\n try {\n const receipt = applyWorkspacePlan(plan, worktreePath)\n value = await run(receipt)\n } catch (cause) {\n primaryError = cause\n }\n\n let cleanupError: unknown\n try {\n rmSync(rootPath, { recursive: true, force: true })\n if (existsSync(rootPath)) {\n throw new Error(\n `agenticGenerator: ephemeral author profile root survived cleanup: ${AGENTIC_PROFILE_RESOURCE_ROOT}`,\n )\n }\n } catch (cause) {\n cleanupError = cause\n }\n\n if (primaryError !== undefined && cleanupError !== undefined) {\n throw new AggregateError(\n [primaryError, cleanupError],\n 'agenticGenerator: author shot and profile resource cleanup both failed',\n )\n }\n if (primaryError !== undefined) throw primaryError\n if (cleanupError !== undefined) throw cleanupError\n return value as T\n}\n\nasync function emitShotReceipt(\n callback: AgenticGeneratorOptions['onShotCompleted'],\n receipt: AgenticGeneratorShotReceipt,\n primaryError: Error | null,\n): Promise<void> {\n try {\n await callback?.(receipt)\n } catch (callbackError) {\n if (primaryError !== null) {\n throw new AggregateError(\n [primaryError, callbackError],\n 'agenticGenerator: author shot failed and its receipt could not be persisted',\n )\n }\n throw callbackError\n }\n if (primaryError !== null) throw primaryError\n}\n\nfunction shotReceipt(input: {\n readonly generation: number | undefined\n readonly candidateIndex: number | undefined\n readonly shot: number\n readonly maxShots: number\n readonly harness: LocalHarness\n readonly profile: AgentProfile | undefined\n readonly prompt: string\n readonly startedAt: Date\n readonly completedAt: Date\n readonly result: LocalHarnessResult | null\n readonly profileWorkspaceReceipt: WorkspacePlanReceipt | null\n readonly costCallId: string | null\n readonly costReceipt: CostReceipt | null\n readonly error: unknown\n}): AgenticGeneratorShotReceipt {\n const error = input.error\n ? {\n name: input.error instanceof Error ? input.error.name : 'Error',\n message: input.error instanceof Error ? input.error.message : String(input.error),\n }\n : null\n const result = input.result\n const costBasis = costBasisFor(input.costReceipt)\n return {\n schemaVersion: 1,\n generation: input.generation ?? null,\n candidateIndex: input.candidateIndex ?? null,\n shot: input.shot + 1,\n maxShots: input.maxShots,\n harness: input.harness,\n model: input.profile?.model?.default ?? null,\n reasoningEffort: input.profile?.model?.reasoningEffort ?? null,\n promptSha256: sha256(input.prompt),\n startedAt: input.startedAt.toISOString(),\n completedAt: input.completedAt.toISOString(),\n durationMs: result?.durationMs ?? input.completedAt.getTime() - input.startedAt.getTime(),\n exitCode: result?.exitCode ?? null,\n timedOut: result?.timedOut ?? false,\n killedBySignal: result?.killedBySignal ?? null,\n stdoutBytes: result ? Buffer.byteLength(result.stdout) : null,\n stdoutSha256: result ? sha256(result.stdout) : null,\n stderrBytes: result ? Buffer.byteLength(result.stderr) : null,\n stderrSha256: result ? sha256(result.stderr) : null,\n usage: result?.usage ? { ...result.usage } : null,\n profileWorkspacePlanDigest: input.profileWorkspaceReceipt?.workspacePlanDigest ?? null,\n profileWorkspaceFileCount: input.profileWorkspaceReceipt?.written.length ?? 0,\n costCallId: input.costCallId,\n costBasis,\n costUsd: costBasis === 'unknown' ? null : (input.costReceipt?.costUsd ?? null),\n costUsdKnown: costBasis === 'provider-reported',\n evidence: result?.evidence\n ? {\n ...result.evidence,\n readDeniedPaths: [...result.evidence.readDeniedPaths],\n policy: { ...result.evidence.policy },\n }\n : null,\n error,\n }\n}\n\nfunction costBasisFor(receipt: CostReceipt | null): AgenticGeneratorShotReceipt['costBasis'] {\n if (receipt === null || receipt.costUnknown) return 'unknown'\n return receipt.actualCostUsd === undefined ? 'estimated-pricing' : 'provider-reported'\n}\n\nfunction shotFailure(\n result: LocalHarnessResult,\n exactPrompt: string,\n codexReproducible: boolean,\n): Error | null {\n if (result.timedOut) {\n return new Error('agenticGenerator: author shot timed out')\n }\n if (result.killedBySignal) {\n return new Error(`agenticGenerator: author shot was killed by ${result.killedBySignal}`)\n }\n if (result.exitCode !== 0) {\n return new Error(`agenticGenerator: author shot exited with code ${String(result.exitCode)}`)\n }\n if (!codexReproducible) return null\n if (!result.usage || !result.evidence) {\n return new Error(\n 'agenticGenerator: reproducible Codex shot completed without usage or execution evidence',\n )\n }\n const expectedPromptSha256 = sha256(exactPrompt).slice('sha256:'.length)\n if (result.evidence.requestedPromptSha256 !== expectedPromptSha256) {\n return new Error(\n 'agenticGenerator: reproducible Codex prompt evidence does not match the exact authored prompt',\n )\n }\n return null\n}\n\nfunction costReceiptFromHarness(result: LocalHarnessResult, model: string): CostReceiptInput {\n if (!result.usage) {\n throw new Error('agenticGenerator: author shot did not report terminal token usage')\n }\n return {\n model,\n inputTokens: result.usage.inputTokens - result.usage.cachedInputTokens,\n outputTokens: result.usage.outputTokens,\n ...(result.usage.cachedInputTokens > 0 ? { cachedTokens: result.usage.cachedInputTokens } : {}),\n }\n}\n\nfunction sha256(value: string): `sha256:${string}` {\n return `sha256:${createHash('sha256').update(value).digest('hex')}`\n}\n\n/** Turn the analyst's findings (+ optional report) into a concrete coder task. */\nfunction defaultBuildPrompt(args: { report: unknown; findings: AnalystFinding[] }): string {\n const lines: string[] = [\n 'You are improving this codebase based on an evaluation analysis.',\n 'Make the smallest set of edits that addresses the findings below, then stop.',\n 'Do not change unrelated code. Do not commit — leave changes in the working tree.',\n '',\n 'Findings:',\n ]\n for (const f of args.findings) {\n const where = f.subject ? ` [${f.subject}]` : ''\n lines.push(`- (${f.severity})${where} ${f.claim}`)\n if (f.recommended_action) lines.push(` → ${f.recommended_action}`)\n }\n if (requiresRawTraceEvidence(args.findings)) {\n lines.push(\n '',\n 'Raw trace evidence requirement:',\n `- Inspect at least one raw trace path named above before editing.`,\n `- Write ${RAW_TRACE_DIAGNOSIS_PATH} in this worktree.`,\n '- Include the exact trace path(s) inspected, the failure mechanism, and the code change made.',\n '- A candidate without this file, or with only this file changed, is discarded.',\n )\n }\n return lines.join('\\n')\n}\n\nconst EMPTY_TREE_NOTE =\n 'NOTE: your previous attempt left the working tree unchanged. Make the concrete file edits now.'\n\n/** Next-shot feedback when the worktree is dirty but failed verification. The\n * edits persist on disk, so the harness resumes atop them — tell it to fix in\n * place, not start over. Verifier detail is truncated to keep the prompt bounded. */\nfunction failureNote(feedback?: string): string {\n const detail = feedback?.trim()\n return [\n 'NOTE: your edits are in the working tree but verification FAILED.',\n 'Fix the problem in place — build on your existing edits, do not revert them.',\n detail ? `Verifier output:\\n${truncate(detail, 4000)}` : 'No verifier detail was captured.',\n ].join('\\n')\n}\n\nfunction rawTraceEvidenceProblem(worktreePath: string, findings: AnalystFinding[]): string | null {\n const changedPaths = worktreeChangedPaths(worktreePath)\n const substantive = changedPaths.filter((path) => path !== RAW_TRACE_DIAGNOSIS_PATH)\n if (substantive.length === 0) {\n return [\n `NOTE: raw-trace mode requires a real code/config edit in addition to ${RAW_TRACE_DIAGNOSIS_PATH}.`,\n 'Your previous attempt only changed the diagnosis artifact. Inspect the cited traces and make the causal code change.',\n ].join('\\n')\n }\n\n const diagnosisPath = join(worktreePath, RAW_TRACE_DIAGNOSIS_PATH)\n if (!existsSync(diagnosisPath)) {\n return [\n `NOTE: raw-trace mode requires ${RAW_TRACE_DIAGNOSIS_PATH}.`,\n 'Before retrying, inspect at least one cited spans.jsonl/cached-result.json/artifact path, then write the diagnosis file with the exact path, failure mechanism, and code change.',\n ].join('\\n')\n }\n\n const body = readFileSync(diagnosisPath, 'utf8')\n const evidencePaths = traceEvidencePaths(findings)\n if (evidencePaths.length > 0 && !evidencePaths.some((path) => body.includes(path))) {\n return [\n `${RAW_TRACE_DIAGNOSIS_PATH} exists, but it does not cite any exact raw trace path from the findings.`,\n `Cite at least one of these inspected paths exactly: ${evidencePaths.slice(0, 5).join(', ')}`,\n ].join('\\n')\n }\n\n return null\n}\n\nfunction requiresRawTraceEvidence(findings: AnalystFinding[]): boolean {\n return findings.some((finding) => {\n const f = finding as unknown as Record<string, unknown>\n return f.analyst_id === RAW_TRACE_ANALYST_ID || f.area === RAW_TRACE_AREA\n })\n}\n\nfunction traceEvidencePaths(findings: AnalystFinding[]): string[] {\n const out: string[] = []\n for (const finding of findings) {\n const refs = (finding as unknown as { evidence_refs?: unknown }).evidence_refs\n if (!Array.isArray(refs)) continue\n for (const ref of refs) {\n if (!ref || typeof ref !== 'object') continue\n const uri = (ref as { uri?: unknown }).uri\n if (typeof uri === 'string' && uri.length > 0) out.push(uri)\n }\n }\n return [...new Set(out)]\n}\n\n/** A `Verifier` that runs a command in the worktree: exit 0 ⇒ ok, any other\n * exit ⇒ failed with stdout+stderr as feedback. The common case — verify by\n * `tsc --noEmit`, `pnpm build`, or a test command. A timeout is treated as a\n * FAILED candidate (a change that hangs the build is a bad change); a missing\n * binary or spawn fault throws (a setup bug, not a failed candidate — no\n * silent fallback). */\nexport function commandVerifier(\n command: string,\n args: string[] = [],\n timeoutMs = 300_000,\n): Verifier {\n return (worktreePath: string): VerifyResult => {\n const result = spawnSync(command, args, {\n cwd: worktreePath,\n encoding: 'utf-8',\n timeout: timeoutMs,\n })\n if (result.signal) {\n return {\n ok: false,\n feedback: `verifier '${command}' killed by ${result.signal} (likely timeout after ${timeoutMs}ms)`,\n }\n }\n if (result.error) {\n const code = (result.error as NodeJS.ErrnoException).code\n if (code === 'ENOENT') {\n throw new Error(\n `commandVerifier: '${command}' not found in PATH (setup bug, not a failed candidate)`,\n )\n }\n throw new Error(`commandVerifier: '${command}' failed to spawn: ${result.error.message}`)\n }\n if (result.status === 0) return { ok: true }\n const out = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim()\n return { ok: false, feedback: out.length > 0 ? out : `exit ${result.status}` }\n }\n}\n\n/** A one-line summary for the commit message, derived from the findings. */\nfunction summarize(findings: AnalystFinding[]): string {\n if (findings.length === 0) return 'agentic improvement'\n if (findings.length === 1) return `agentic: ${truncate(findings[0]!.claim, 64)}`\n return `agentic: ${findings.length} findings addressed`\n}\n\nfunction truncate(s: string, n: number): string {\n return s.length <= n ? s : `${s.slice(0, n - 1)}…`\n}\n\n/** Non-empty `git status --porcelain` ⇒ the harness changed the worktree.\n * Fails loud: the worktree is a fresh checkout, so a git error here means\n * something is genuinely broken (git missing, corrupt index, killed mid-run).\n * Folding that into `false` would silently discard a candidate and mask the\n * real failure — forbidden by the no-silent-fallbacks doctrine. */\nfunction worktreeDirty(worktreePath: string): boolean {\n return worktreeChangedPaths(worktreePath).length > 0\n}\n\nfunction worktreeChangedPaths(worktreePath: string): string[] {\n const result = spawnSync('git', ['status', '--porcelain', '--untracked-files=all'], {\n cwd: worktreePath,\n encoding: 'utf-8',\n })\n if (result.error) {\n throw new Error(\n `agenticGenerator: git status failed to spawn in ${worktreePath}: ${result.error.message}`,\n )\n }\n if (result.status !== 0) {\n throw new Error(\n `agenticGenerator: git status exited ${result.status} in ${worktreePath}: ${result.stderr.trim()}`,\n )\n }\n return result.stdout\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .map((line) => line.slice(3).trim())\n}\n"],"mappings":";;;;;;AAkCA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,YAAY,cAAc,cAAc;AACjD,SAAS,MAAM,SAAS,WAAW;AASnC;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAWP,IAAM,uBAAuB;AAC7B,IAAM,iBAAiB;AACvB,IAAM,2BAA2B;AAI1B,IAAM,gCAAgC;AAwFtC,SAAS,iBAAiB,OAAgC,CAAC,GAAuB;AACvF,QAAM,UAAU,KAAK,WAAW;AAChC,MAAI,KAAK,qBAAqB,YAAY,SAAS;AACjD,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACA,MAAI,KAAK,qBAAqB,CAAC,KAAK,SAAS;AAC3C,UAAM,IAAI,MAAM,yEAAyE;AAAA,EAC3F;AACA,MAAI,KAAK,wBAAwB,CAAC,KAAK,mBAAmB;AACxD,UAAM,IAAI,MAAM,mEAAmE;AAAA,EACrF;AACA,MAAI,KAAK,iBAAiB,CAAC,KAAK,mBAAmB;AACjD,UA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