@tangle-network/agent-runtime 0.115.1 → 0.117.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +7 -1
  2. package/dist/{activation-Bt_XVkjK.js → activation-BZ2FyX0O.js} +3 -3
  3. package/dist/{activation-Bt_XVkjK.js.map → activation-BZ2FyX0O.js.map} +1 -1
  4. package/dist/agent.d.ts +3 -64
  5. package/dist/agent.js +5 -207
  6. package/dist/agent.js.map +1 -1
  7. package/dist/{analyst-loop-BoNIG2hA.js → analyst-loop-DvSciOfB.js} +2 -2
  8. package/dist/{analyst-loop-BoNIG2hA.js.map → analyst-loop-DvSciOfB.js.map} +1 -1
  9. package/dist/analyst-loop.js +1 -1
  10. package/dist/candidate-execution/index.d.ts +3 -3
  11. package/dist/candidate-execution/index.js +5 -5
  12. package/dist/{candidate-execution-CfpJrd3o.js → candidate-execution-PX61zXd2.js} +4 -4
  13. package/dist/{candidate-execution-CfpJrd3o.js.map → candidate-execution-PX61zXd2.js.map} +1 -1
  14. package/dist/{environment-provider-Cygthiy3.d.ts → environment-provider-CTZjdIUg.d.ts} +661 -34
  15. package/dist/{environment-provider-CCaEhA-l.js → environment-provider-CzcEyRL7.js} +140 -31
  16. package/dist/environment-provider-CzcEyRL7.js.map +1 -0
  17. package/dist/environment-provider.d.ts +1 -1
  18. package/dist/environment-provider.js +1 -1
  19. package/dist/{improvement-cycle-tEswzEPr.js → improvement-cycle-Bcqz8rZI.js} +160 -19
  20. package/dist/improvement-cycle-Bcqz8rZI.js.map +1 -0
  21. package/dist/{index-DZukewLl.d.ts → index-BHSYaWrC.d.ts} +3 -3
  22. package/dist/{index-K7nucOmw.d.ts → index-BTUG4Xln.d.ts} +8 -7
  23. package/dist/{index-BUWd8QJq.d.ts → index-DPWJxSRa.d.ts} +884 -497
  24. package/dist/{index-C-FYUuFG.d.ts → index-X2YwyWkc.d.ts} +2 -2
  25. package/dist/index.d.ts +9 -10
  26. package/dist/index.js +12 -13
  27. package/dist/index.js.map +1 -1
  28. package/dist/intelligence.d.ts +10 -9
  29. package/dist/intelligence.js +15 -9
  30. package/dist/intelligence.js.map +1 -1
  31. package/dist/kernel.d.ts +4 -4
  32. package/dist/kernel.js +8 -8
  33. package/dist/{knowledge-CUXQE8Sq.js → knowledge-CDlrayRc.js} +7 -7
  34. package/dist/knowledge-CDlrayRc.js.map +1 -0
  35. package/dist/knowledge.d.ts +1 -1
  36. package/dist/knowledge.js +1 -1
  37. package/dist/{local-harness-BnB1E9nM.d.ts → local-harness-t6cDWDQ2.d.ts} +3 -105
  38. package/dist/{loop-runner-bin-DzJz48Fb.js → loop-runner-bin-BxhhDtmG.js} +4 -4
  39. package/dist/{loop-runner-bin-DzJz48Fb.js.map → loop-runner-bin-BxhhDtmG.js.map} +1 -1
  40. package/dist/{loop-runner-bin-BZl5vp7t.d.ts → loop-runner-bin-oyL7it5O.d.ts} +3 -3
  41. package/dist/loop-runner-bin.d.ts +1 -1
  42. package/dist/loop-runner-bin.js +1 -1
  43. package/dist/mcp/bin.js +43 -10
  44. package/dist/mcp/bin.js.map +1 -1
  45. package/dist/mcp/index.d.ts +4 -43
  46. package/dist/mcp/index.js +5 -205
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/{openai-tools-CynwZMZd.js → openai-tools-CO9X36zy.js} +2 -2
  49. package/dist/{openai-tools-CynwZMZd.js.map → openai-tools-CO9X36zy.js.map} +1 -1
  50. package/dist/{prepare-BHQBb02e.js → prepare-BbI6qGOW.js} +5 -2
  51. package/dist/prepare-BbI6qGOW.js.map +1 -0
  52. package/dist/primeintellect/index.d.ts +1 -1
  53. package/dist/{protected-model-port-BP6Z4eau.d.ts → protected-model-port-B0yXMpLL.d.ts} +10 -2
  54. package/dist/{protected-model-port-DqAH1Z2M.js → protected-model-port-COnyZfML.js} +2 -2
  55. package/dist/{protected-model-port-DqAH1Z2M.js.map → protected-model-port-COnyZfML.js.map} +1 -1
  56. package/dist/{redact-BRaHUFMf.d.ts → redact-BEtQtvd6.d.ts} +2 -2
  57. package/dist/{runtime-BatQajPB.js → runtime-Ce39zfqn.js} +145 -53
  58. package/dist/runtime-Ce39zfqn.js.map +1 -0
  59. package/dist/{sandbox-events-DeI5xX8P.js → sandbox-events-Yhd1GYWl.js} +4 -2
  60. package/dist/sandbox-events-Yhd1GYWl.js.map +1 -0
  61. package/dist/spawn-journal-B_mu_oH2.js +857 -0
  62. package/dist/spawn-journal-B_mu_oH2.js.map +1 -0
  63. package/dist/{structural-rollout-DEf37yQy.js → structural-rollout-DLwW69R4.js} +4 -4
  64. package/dist/structural-rollout-DLwW69R4.js.map +1 -0
  65. package/dist/{supervise-B7TIJR3D.js → supervise-U7_K5yuV.js} +2645 -829
  66. package/dist/supervise-U7_K5yuV.js.map +1 -0
  67. package/dist/{supervisor-DzQu5Ydu.js → supervisor-CAXiCKnX.js} +3802 -967
  68. package/dist/supervisor-CAXiCKnX.js.map +1 -0
  69. package/dist/testing.js +98 -76
  70. package/dist/testing.js.map +1 -1
  71. package/dist/{workspace-archive-DXzJq7WP.js → workspace-archive-CqPIijFA.js} +2 -2
  72. package/dist/{workspace-archive-DXzJq7WP.js.map → workspace-archive-CqPIijFA.js.map} +1 -1
  73. package/package.json +1 -1
  74. package/dist/environment-provider-CCaEhA-l.js.map +0 -1
  75. package/dist/improvement-cycle-tEswzEPr.js.map +0 -1
  76. package/dist/knowledge-CUXQE8Sq.js.map +0 -1
  77. package/dist/otel-export-CPZTSADj.js +0 -852
  78. package/dist/otel-export-CPZTSADj.js.map +0 -1
  79. package/dist/prepare-BHQBb02e.js.map +0 -1
  80. package/dist/runtime-BatQajPB.js.map +0 -1
  81. package/dist/sandbox-events-DeI5xX8P.js.map +0 -1
  82. package/dist/spawn-journal-DCPbicXB.js +0 -457
  83. package/dist/spawn-journal-DCPbicXB.js.map +0 -1
  84. package/dist/structural-rollout-DEf37yQy.js.map +0 -1
  85. package/dist/supervise-B7TIJR3D.js.map +0 -1
  86. package/dist/supervisor-DzQu5Ydu.js.map +0 -1
  87. package/dist/trace-propagation-B-pL7xn_.js +0 -57
  88. package/dist/trace-propagation-B-pL7xn_.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { n as AnalystError, r as BackendTransportError, s as PlannerError, u as ValidationError } from "./errors-DEAvWQPy.js";
2
2
  import { i as normalizeBackendStreamEvent, o as newRuntimeSession, s as nowIso } from "./backends-CiOCyRHb.js";
3
+ import { i as InMemorySpawnJournal, r as InMemoryResultBlobStore, v as isTraceAnalysisStore } from "./spawn-journal-B_mu_oH2.js";
3
4
  import { c as sleep, i as isAbortError, l as stringifySafe, n as addTokenUsage, o as randomSuffix, p as zeroTokenUsage } from "./util-Cc9g9Y-o.js";
4
- import { i as InMemorySpawnJournal, r as InMemoryResultBlobStore } from "./spawn-journal-DCPbicXB.js";
5
5
  import { i as redactProtectedValue, r as redactProtectedReason } from "./protected-redaction--F3v1oo8.js";
6
- import { C as routerChatWithUsage, E as runBrainLoop, d as settledToIteration, l as withDriverExecutor, t as createSupervisor, x as routerBrain } from "./supervisor-DzQu5Ydu.js";
7
- import { C as observe, O as strategyAuthorMethod, b as sample, v as refine, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-DEf37yQy.js";
6
+ import { Y as rollingDispatch, ct as routerBrain, l as withDriverExecutor, m as settledToIteration, n as createSupervisor, pt as runBrainLoop, ut as routerChatWithUsage } from "./supervisor-CAXiCKnX.js";
7
+ import { C as observe, O as strategyAuthorMethod, b as sample, v as refine, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-DLwW69R4.js";
8
8
  import { i as notifyRuntimeHookEvent } from "./runtime-hooks-C7iJOWm3.js";
9
- import { a as notifySandboxEventObserver, i as mapSandboxToolEvent, r as mapSandboxEvent, t as createSandboxToolPartState } from "./sandbox-events-DeI5xX8P.js";
10
- import { At as createWorktreeCliExecutor, Jt as runAgentRounds, Ot as createExecutor, St as rollingDispatch, Xt as createSandboxLineage, Zt as probeSandboxCapabilities, kt as createExecutorRegistry, nn as gateOnDeliverable, qt as defaultSelectWinner, t as supervise } from "./supervise-B7TIJR3D.js";
11
- import { CODING_HARNESSES, InMemoryTraceStore, benjaminiHochberg, buildTrajectory, computeFindingId as computeFindingId$1, confidenceInterval, expandProfileAxes, harnessAxisOf, makeFinding as makeFinding$1, pairedBootstrap, paretoFrontier, scoreKnowledgeReadiness, wilcoxonSignedRank, wilson } from "@tangle-network/agent-eval";
9
+ import { a as notifySandboxEventObserver, i as mapSandboxToolEvent, r as mapSandboxEvent, t as createSandboxToolPartState } from "./sandbox-events-Yhd1GYWl.js";
10
+ import { Dt as createPushTraceSource, Ht as probeSandboxCapabilities, Rt as defaultSelectWinner, Vt as createSandboxLineage, bt as createExecutorRegistry, n as supervise, tn as gateOnDeliverable, xt as createWorktreeCliExecutor, yt as createExecutor, zt as runAgentRounds } from "./supervise-U7_K5yuV.js";
11
+ import { CODING_HARNESSES, InMemoryTraceStore, OUTPUT_VALUE, benjaminiHochberg, buildTrajectory, computeFindingId as computeFindingId$1, confidenceInterval, expandProfileAxes, harnessAxisOf, makeFinding as makeFinding$1, pairedBootstrap, paretoFrontier, scoreKnowledgeReadiness, wilcoxonSignedRank, wilson } from "@tangle-network/agent-eval";
12
12
  import { heldoutSignificance, runProfileMatrix } from "@tangle-network/agent-eval/campaign";
13
13
  import { canonicalCandidateDigest, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
14
14
  import { randomUUID } from "node:crypto";
@@ -2905,7 +2905,7 @@ async function trajectoryReport(journal, blobs, root, options = {}) {
2905
2905
  const events = await journal.loadTree(root);
2906
2906
  if (events === void 0) throw new Error(`trajectoryReport: no journaled tree for root '${root}'`);
2907
2907
  const spawns = events.filter(isNodeCreation).sort(bySeq);
2908
- const closes = events.filter((ev) => ev.kind !== "spawned" && ev.kind !== "waiting" && ev.kind !== "metered").sort(bySeq);
2908
+ const closes = events.filter((ev) => ev.kind !== "spawned" && ev.kind !== "waiting" && ev.kind !== "metered" && ev.kind !== "materialized" && ev.kind !== "execution-bound").sort(bySeq);
2909
2909
  const nodes = /* @__PURE__ */ new Map();
2910
2910
  for (const ev of spawns) nodes.set(ev.id, {
2911
2911
  id: ev.id,
@@ -3068,6 +3068,7 @@ function addNodeSpend(a, b) {
3068
3068
  input: a.tokens.input + b.tokens.input,
3069
3069
  output: a.tokens.output + b.tokens.output
3070
3070
  },
3071
+ ...a.tokensKnown === false || b.tokensKnown === false ? { tokensKnown: false } : {},
3071
3072
  usd: a.usd + b.usd,
3072
3073
  ...a.tokensKnown === false || b.tokensKnown === false ? { tokensKnown: false } : {},
3073
3074
  ...a.usdKnown === false || b.usdKnown === false ? { usdKnown: false } : {},
@@ -3081,6 +3082,7 @@ function cloneSpend(spend) {
3081
3082
  input: spend.tokens.input,
3082
3083
  output: spend.tokens.output
3083
3084
  },
3085
+ ...spend.tokensKnown === false ? { tokensKnown: false } : {},
3084
3086
  usd: spend.usd,
3085
3087
  ...spend.tokensKnown === false ? { tokensKnown: false } : {},
3086
3088
  ...spend.usdKnown === false ? { usdKnown: false } : {},
@@ -3091,6 +3093,7 @@ function cloneSpend(spend) {
3091
3093
  function addSpend(acc, delta) {
3092
3094
  acc.iterations += delta.iterations;
3093
3095
  addTokenUsage(acc.tokens, delta.tokens);
3096
+ if (delta.tokensKnown === false) acc.tokensKnown = false;
3094
3097
  acc.usd += delta.usd;
3095
3098
  if (delta.tokensKnown === false) acc.tokensKnown = false;
3096
3099
  if (delta.usdKnown === false) acc.usdKnown = false;
@@ -5213,24 +5216,31 @@ function worktreeFanout(options) {
5213
5216
  ...options.require !== void 0 ? { require: options.require } : {}
5214
5217
  });
5215
5218
  const itemSpec = (item) => {
5216
- const executor = gateOnDeliverable(createWorktreeCliExecutor({
5217
- repoRoot: options.repoRoot,
5218
- profile: item.profile,
5219
- harness: item.harness,
5220
- taskPrompt: options.taskPrompt,
5221
- ...item.runId ? { runId: item.runId } : {},
5222
- ...item.baseRef ? { baseRef: item.baseRef } : {},
5223
- ...options.testCmd !== void 0 ? { testCmd: options.testCmd } : {},
5224
- ...options.typecheckCmd !== void 0 ? { typecheckCmd: options.typecheckCmd } : {},
5225
- ...options.harnessTimeoutMs !== void 0 ? { harnessTimeoutMs: options.harnessTimeoutMs } : {},
5226
- ...options.runGit ? { runGit: options.runGit } : {},
5227
- ...options.runHarness ? { runHarness: options.runHarness } : {},
5228
- ...options.runCommand ? { runCommand: options.runCommand } : {}
5229
- }), deliverable);
5219
+ const executorFactory = (_spec, ctx) => {
5220
+ if (!ctx.node) throw new Error("worktreeFanout: supervised node context required");
5221
+ return gateOnDeliverable(createWorktreeCliExecutor({
5222
+ repoRoot: options.repoRoot,
5223
+ profile: item.profile,
5224
+ harness: item.harness,
5225
+ taskPrompt: options.taskPrompt,
5226
+ executionAttemptId: ctx.node.attemptId,
5227
+ ...item.budgetExempt !== void 0 ? { budgetExempt: item.budgetExempt } : {},
5228
+ ...item.codexReproducible !== void 0 ? { codexReproducible: item.codexReproducible } : {},
5229
+ ...item.codexReadDeniedPaths !== void 0 ? { codexReadDeniedPaths: item.codexReadDeniedPaths } : {},
5230
+ ...item.runId ? { runId: item.runId } : {},
5231
+ ...item.baseRef ? { baseRef: item.baseRef } : {},
5232
+ ...options.testCmd !== void 0 ? { testCmd: options.testCmd } : {},
5233
+ ...options.typecheckCmd !== void 0 ? { typecheckCmd: options.typecheckCmd } : {},
5234
+ ...options.harnessTimeoutMs !== void 0 ? { harnessTimeoutMs: options.harnessTimeoutMs } : {},
5235
+ ...options.runGit ? { runGit: options.runGit } : {},
5236
+ ...options.runHarness ? { runHarness: options.runHarness } : {},
5237
+ ...options.runCommand ? { runCommand: options.runCommand } : {}
5238
+ }), deliverable);
5239
+ };
5230
5240
  return {
5231
5241
  profile: item.profile,
5232
5242
  harness: null,
5233
- executor
5243
+ executorFactory
5234
5244
  };
5235
5245
  };
5236
5246
  const selectWinner = selectValidWinner({
@@ -5246,29 +5256,63 @@ function worktreeFanout(options) {
5246
5256
  }
5247
5257
  //#endregion
5248
5258
  //#region src/runtime/supervise-surface.ts
5249
- /** Remember the worker's LAST `run_tests` output so the analyst can name the still-failing tests — a
5250
- * transparent passthrough for every other surface call. Local to this module (no surface-zoo concept). */
5251
- function captureFailures(base) {
5259
+ /**
5260
+ * superviseSurface drive a team of agents to solve a graded `AgenticSurface` task. ONE capability that
5261
+ * replaces the worker-seam + "self-improving supervisor" wrapper pair: the driver (`profile`) spawns
5262
+ * workers that each run `runAgentic` over the surface (`refine` by default), settle on the surface's OWN
5263
+ * check (settled ⟺ resolved — a worker that ran but didn't pass settles invalid, so a keep-best driver
5264
+ * never counts it done), and feed the driver a self-improvement lens (the still-FAILING tests, by default)
5265
+ * so the next spawn targets the persistently-hard cases. Returns the deployable outcome + the full
5266
+ * conserved spend.
5267
+ *
5268
+ * WHY this lives here and not as a `supervise()` backend: `runAgentic` depends on the supervise core
5269
+ * (`strategy.ts` → `supervise/`), so a surface-solving worker cannot be a supervise built-in without an
5270
+ * import cycle. It is therefore a COMPOSITION of `supervise()` + `runAgentic` at the layer above both —
5271
+ * the right home for "supervise over a graded surface". The within-run self-improvement is the analyst
5272
+ * (authored content, swap `analysts`); the across-run kind wraps this call in `improve()`.
5273
+ */
5274
+ /** Instrument every real surface call with the shared push trace source. The last test report remains
5275
+ * available on `SurfaceWorkerOut` for compatibility, but analysts read only the persisted spans. */
5276
+ function traceSurfaceCalls(base) {
5252
5277
  let lastReport = "";
5253
- const surface = {
5254
- name: base.name,
5255
- open: (t) => base.open(t),
5256
- tools: (t, h) => base.tools(t, h),
5257
- async call(h, name, args) {
5258
- const out = await base.call(h, name, args);
5259
- if (name === "run_tests") lastReport = out;
5260
- return out;
5261
- },
5262
- score: (t, h) => base.score(t, h),
5263
- close: (h) => base.close(h)
5264
- };
5265
- const failing = () => {
5266
- const body = /FAILING:\s*(.+)/i.exec(lastReport)?.[1];
5267
- return body ? body.split(",").map((s) => s.trim()).filter(Boolean) : [];
5268
- };
5278
+ const trace = createPushTraceSource();
5269
5279
  return {
5270
- surface,
5271
- failing
5280
+ surface: {
5281
+ name: base.name,
5282
+ open: (t) => base.open(t),
5283
+ tools: (t, h) => base.tools(t, h),
5284
+ async call(h, name, args) {
5285
+ const startedAt = Date.now();
5286
+ const recordedArgs = structuredClone(args);
5287
+ try {
5288
+ const out = await base.call(h, name, args);
5289
+ trace.record({
5290
+ toolName: name,
5291
+ args: recordedArgs,
5292
+ result: out,
5293
+ status: out.startsWith("ERROR:") ? "error" : "ok",
5294
+ startedAt,
5295
+ endedAt: Date.now()
5296
+ });
5297
+ if (name === "run_tests") lastReport = out;
5298
+ return out;
5299
+ } catch (error) {
5300
+ trace.record({
5301
+ toolName: name,
5302
+ args: recordedArgs,
5303
+ result: `ERROR: ${error instanceof Error ? error.message : String(error)}`,
5304
+ status: "error",
5305
+ startedAt,
5306
+ endedAt: Date.now()
5307
+ });
5308
+ throw error;
5309
+ }
5310
+ },
5311
+ score: (t, h) => base.score(t, h),
5312
+ close: (h) => base.close(h)
5313
+ },
5314
+ failing: () => failingTestNames(lastReport),
5315
+ traceSource: trace.source
5272
5316
  };
5273
5317
  }
5274
5318
  /** The default self-improvement LENS — authored content, not a code path. On each settled worker it hands
@@ -5282,20 +5326,68 @@ function failuresAnalyst() {
5282
5326
  area: "progress"
5283
5327
  }],
5284
5328
  run: async (_kindId, trace) => {
5285
- const w = trace ?? {};
5286
- if (!(typeof w === "object" && w !== null && "resolved" in w)) return { summary: `worker produced: ${JSON.stringify(trace).slice(0, 300)}` };
5287
- if (w.resolved) return { summary: "worker RESOLVED — every check passed; stop." };
5288
- const failing = w.failing ?? [];
5289
- const head = `worker did NOT resolve score ${(100 * (w.score ?? 0)).toFixed(0)}%, ${w.shots ?? "?"} shot(s)`;
5290
- return { summary: failing.length ? `${head}. STILL FAILING (${failing.length}): ${failing.slice(0, 12).join(", ")}. Spawn the next worker to fix exactly these; if a test keeps failing across workers, give it concrete guidance about that case.` : `${head}. (no failing-test list available this round)` };
5329
+ if (!isTraceAnalysisStore(trace)) return missingRunTestsEvidence();
5330
+ const report = await latestRunTestsReport(trace);
5331
+ if (report === void 0) return missingRunTestsEvidence();
5332
+ const failing = failingTestNames(report);
5333
+ return { summary: failing.length ? `Latest structured run_tests evidence reports STILL FAILING (${failing.length}): ${failing.join(", ")}. Spawn the next worker to fix exactly these; if a test keeps failing across workers, give it concrete guidance about that case.` : allTestsPassed(report) ? "Latest structured run_tests evidence reports every test passed; stop." : `Latest structured run_tests evidence contains no parseable failing-test names. Refusing to infer them from worker prose. run_tests output: ${report.slice(0, 300)}` };
5291
5334
  }
5292
5335
  };
5293
5336
  }
5337
+ async function latestRunTestsReport(store) {
5338
+ const overview = await store.getOverview({ tool_names: ["run_tests"] });
5339
+ const candidates = [];
5340
+ let ordinal = 0;
5341
+ for (const traceId of overview.sample_trace_ids) {
5342
+ let spans = (await store.viewTrace({
5343
+ trace_id: traceId,
5344
+ per_attribute_byte_cap: 16384
5345
+ })).spans;
5346
+ if (spans === void 0) {
5347
+ const matches = await store.searchTrace({
5348
+ trace_id: traceId,
5349
+ regex_pattern: "run_tests",
5350
+ max_matches: 100
5351
+ });
5352
+ const spanIds = [...new Set(matches.hits.filter((hit) => hit.span_name === "run_tests").map((hit) => hit.span_id))];
5353
+ spans = spanIds.length ? (await store.viewSpans({
5354
+ trace_id: traceId,
5355
+ span_ids: spanIds,
5356
+ per_attribute_byte_cap: 16384
5357
+ })).spans : [];
5358
+ }
5359
+ for (const span of spans) {
5360
+ if (span.tool_name !== "run_tests") continue;
5361
+ const output = span.attributes[OUTPUT_VALUE];
5362
+ if (typeof output !== "string") continue;
5363
+ candidates.push({
5364
+ output,
5365
+ endedAt: span.end_time,
5366
+ ordinal: ordinal++
5367
+ });
5368
+ }
5369
+ }
5370
+ candidates.sort((left, right) => Date.parse(left.endedAt) - Date.parse(right.endedAt) || left.ordinal - right.ordinal);
5371
+ return candidates.at(-1)?.output;
5372
+ }
5373
+ function failingTestNames(report) {
5374
+ const body = /FAILING:\s*([^\n]+)/iu.exec(report)?.[1];
5375
+ if (body === void 0) return [];
5376
+ return body.replace(/\.\s+COLLECTION-BLOCKED:.*$/iu, "").replace(/\s*\(\+\d+\s+more\)\s*$/iu, "").split(",").map((name) => name.trim()).filter(Boolean);
5377
+ }
5378
+ function allTestsPassed(report) {
5379
+ const fraction = /(\d+)\s*\/\s*(\d+)\s+tests?\s+passed/iu.exec(report);
5380
+ return fraction !== null && Number(fraction[1]) === Number(fraction[2]);
5381
+ }
5382
+ function missingRunTestsEvidence() {
5383
+ return { summary: "Missing structured run_tests span evidence. Refusing to infer failing-test names from worker prose." };
5384
+ }
5294
5385
  /** One spawned worker = one `runAgentic` attempt over the surface task. The driver's brief is threaded
5295
5386
  * into the attempt (so a re-spawn can take a targeted angle, not an identical retry); `runAgentic` stamps
5296
5387
  * real tokens/usd/ms, forwarded as `Spend`; the still-failing tests are captured for the analyst. */
5297
5388
  function surfaceWorkerExecutor(surface, task, worker, strategy) {
5298
5389
  let artifact;
5390
+ const traced = traceSurfaceCalls(surface);
5299
5391
  return {
5300
5392
  runtime: "surface-worker",
5301
5393
  async execute(brief) {
@@ -5304,9 +5396,8 @@ function surfaceWorkerExecutor(surface, task, worker, strategy) {
5304
5396
  ...task,
5305
5397
  systemPrompt: `${task.systemPrompt ?? ""}\n\n— Supervisor guidance for THIS attempt (incorporate it; do not just repeat a prior approach) —\n${guidance}`
5306
5398
  } : task;
5307
- const cap = captureFailures(surface);
5308
5399
  const r = await runAgentic({
5309
- surface: cap.surface,
5400
+ surface: traced.surface,
5310
5401
  task: attemptTask,
5311
5402
  strategy,
5312
5403
  budget: worker.budget ?? 1,
@@ -5321,7 +5412,7 @@ function surfaceWorkerExecutor(surface, task, worker, strategy) {
5321
5412
  score: r.score,
5322
5413
  shots: r.shots,
5323
5414
  summary: `${strategy.name} ${r.shots} shot(s) → ${(100 * r.score).toFixed(0)}% (${r.resolved ? "resolved" : "unresolved"})`,
5324
- failing: r.resolved ? [] : cap.failing()
5415
+ failing: r.resolved ? [] : traced.failing()
5325
5416
  };
5326
5417
  const spent = {
5327
5418
  iterations: r.completions,
@@ -5340,6 +5431,7 @@ function surfaceWorkerExecutor(surface, task, worker, strategy) {
5340
5431
  };
5341
5432
  return artifact;
5342
5433
  },
5434
+ traceSource: () => traced.traceSource,
5343
5435
  teardown: () => Promise.resolve({ destroyed: true }),
5344
5436
  resultArtifact() {
5345
5437
  if (!artifact) throw new Error("surfaceWorkerExecutor: resultArtifact before execute");
@@ -5822,4 +5914,4 @@ function tail(s) {
5822
5914
  //#endregion
5823
5915
  export { InMemoryCorpus as $, runCoderChecks as A, renderLeaderboardMarkdown as At, SandboxRunAbortError as B, envKeyProvider as Bt, safeWorkerFile as C, completionAuthorizes as Ct, workerInboxFileFromEventDir as D, leaderboard as Dt, workerInboxFile as E, stopSentinel as Et, runStrategyEvolution as F, McpSpawnFault as Ft, equalKOnCost as G, printBenchmarkReport as H, resolveMcpServerLaunch as Ht, selectChampion as I, connectStdioMcp as It, runPersonified as J, trajectoryReport as K, assertStrategyContract as L, materializeLocalMcp as Lt, streamAgentTurn as M, renderPairwiseMarkdown as Mt, discriminatingMeans as N, auditIntent as Nt, writeWorkerSteer as O, pairwiseSignificance as Ot, pickChampion as P, defaultAuditorInstruction as Pt, FileCorpus as Q, authorStrategy as R, createMcpEnvironment as Rt, readWorkerSteerRequests as S, loopDispatch as St, supervisorRunsRoot as T, sentinelCompletion as Tt, runBenchmark as U, resolveSecretEnv as Ut, openSandboxRun as V, mcpSecretEnvMetadataKey as Vt, promotionGate as W, secretEnvOfMcpServer as Wt, createShapeRegistry as X, builtinShapes as Y, registerShape as Z, settledWorkerOut as _, naiveDriver as _t, localShell as a, pipeline as at, analyzeTrace as b, inlineSandboxClient as bt, createVerifierEnvironment as c, widen as ct, worktreeFanout as d, createScopeAnalyst as dt, renderCorpusToInstructions as et, EVIDENCE_MAX_CHARS as f, registryScopeAnalyst as ft, composeWorkerEvidence as g, dumbDriver as gt, closingWorkerNote as h, defineLeaderboard as ht, jjWorkspace as i, panel as it, collectAgentTurn as j, renderLeaderboardSvg as jt, patchDelivered as k, renderLeaderboardHtml as kt, failuresAnalyst as l, assertTraceDerivedFindings as lt, VERIFY_TAIL_CHARS as m, harvestCorpus as mt, makeFinding$1 as n, flatWidenGate as nt, runInWorkspace as o, selectValidWinner as ot, NOTE_MAX_CHARS as p, inProcessSandboxClient as pt, definePersona as q, gitWorkspace as r, loopUntil as rt, createWaterfallCollector as s, verify as st, computeFindingId$1 as t, fanout as tt, superviseSurface as u, buildSteerContext as ut, copyUntrackedIntoClone as v, resolveSandboxClient as vt, supervisorRunDir as w, deterministicCompletion as wt, legacySupervisorRunDir as x, loopCampaignDispatch as xt, withUntrackedArtifacts as y, localSandboxClient as yt, strategyAuthorContract as z, sanitizeMcpToolSchema as zt };
5824
5916
 
5825
- //# sourceMappingURL=runtime-BatQajPB.js.map
5917
+ //# sourceMappingURL=runtime-Ce39zfqn.js.map