@tangle-network/agent-runtime 0.94.0 → 0.94.2

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 (56) hide show
  1. package/dist/agent.js +4 -4
  2. package/dist/{agentic-generator-B8oeE2Yv.d.ts → agentic-generator-B7Cyl6cn.d.ts} +1 -1
  3. package/dist/candidate-execution/index.js +3 -3
  4. package/dist/{chunk-4GBT4WQ6.js → chunk-7ESP4C3O.js} +2 -2
  5. package/dist/{chunk-55P6V5JT.js → chunk-DNK3L7QB.js} +2 -2
  6. package/dist/chunk-JFAGXZKR.js +950 -0
  7. package/dist/chunk-JFAGXZKR.js.map +1 -0
  8. package/dist/{chunk-7I2AOKCI.js → chunk-KHLE3C5G.js} +2 -2
  9. package/dist/{chunk-OO4EK3JB.js → chunk-L4CACVIJ.js} +6 -3
  10. package/dist/chunk-L4CACVIJ.js.map +1 -0
  11. package/dist/{chunk-4E2GM63H.js → chunk-MZH4HORF.js} +2 -2
  12. package/dist/{chunk-RTVVH2KL.js → chunk-OAVVQAOQ.js} +2 -2
  13. package/dist/{chunk-MRYPFDHJ.js → chunk-PV6Q3OKU.js} +3 -3
  14. package/dist/{chunk-FHZHADIM.js → chunk-TTWMSNFZ.js} +64 -10
  15. package/dist/chunk-TTWMSNFZ.js.map +1 -0
  16. package/dist/{chunk-3D2RHC4K.js → chunk-WIPGQ4GT.js} +1 -1
  17. package/dist/{chunk-3D2RHC4K.js.map → chunk-WIPGQ4GT.js.map} +1 -1
  18. package/dist/{chunk-H2D3DCEB.js → chunk-ZLPKMFOE.js} +2 -2
  19. package/dist/{completion-gate-BDkEYB_-.d.ts → completion-gate-Bz7VYs7a.d.ts} +22 -2
  20. package/dist/{coordination-EGoRbbsd.d.ts → coordination-CdU8LyvB.d.ts} +7 -3
  21. package/dist/environment-provider.d.ts +1 -1
  22. package/dist/{improve-ZzTEkpF_.d.ts → improve-mrYmy_1e.d.ts} +2 -2
  23. package/dist/index.d.ts +11 -11
  24. package/dist/index.js +11 -11
  25. package/dist/intelligence.d.ts +3 -3
  26. package/dist/intelligence.js +5 -5
  27. package/dist/knowledge.d.ts +5 -5
  28. package/dist/knowledge.js +4 -4
  29. package/dist/lifecycle.d.ts +3 -3
  30. package/dist/lifecycle.js +2 -2
  31. package/dist/{local-harness-dcD5WTTr.d.ts → local-harness-C2HDGiOY.d.ts} +65 -1
  32. package/dist/{loop-runner-bin-BRXC1RwC.d.ts → loop-runner-bin-BSvtOPMv.d.ts} +2 -2
  33. package/dist/loop-runner-bin.d.ts +5 -5
  34. package/dist/loop-runner-bin.js +5 -5
  35. package/dist/loops.d.ts +11 -11
  36. package/dist/loops.js +4 -4
  37. package/dist/mcp/bin.js +3 -3
  38. package/dist/mcp/index.d.ts +7 -7
  39. package/dist/mcp/index.js +7 -5
  40. package/dist/mcp/index.js.map +1 -1
  41. package/dist/{mcp-serve-verifier-Bg4C3p5S.d.ts → mcp-serve-verifier-C65X30mY.d.ts} +1 -1
  42. package/dist/{supervise-Gmf709kn.d.ts → supervise-U6DTnQu6.d.ts} +3 -3
  43. package/dist/{types-Cg_teUPO.d.ts → types-Bb-CqxJH.d.ts} +3 -0
  44. package/dist/{worktree-fanout-BrB4att3.d.ts → worktree-fanout-DqzIBWMW.d.ts} +16 -13
  45. package/package.json +1 -1
  46. package/dist/chunk-FHZHADIM.js.map +0 -1
  47. package/dist/chunk-OO4EK3JB.js.map +0 -1
  48. package/dist/chunk-PX6SXX3M.js +0 -146
  49. package/dist/chunk-PX6SXX3M.js.map +0 -1
  50. /package/dist/{chunk-4GBT4WQ6.js.map → chunk-7ESP4C3O.js.map} +0 -0
  51. /package/dist/{chunk-55P6V5JT.js.map → chunk-DNK3L7QB.js.map} +0 -0
  52. /package/dist/{chunk-7I2AOKCI.js.map → chunk-KHLE3C5G.js.map} +0 -0
  53. /package/dist/{chunk-4E2GM63H.js.map → chunk-MZH4HORF.js.map} +0 -0
  54. /package/dist/{chunk-RTVVH2KL.js.map → chunk-OAVVQAOQ.js.map} +0 -0
  55. /package/dist/{chunk-MRYPFDHJ.js.map → chunk-PV6Q3OKU.js.map} +0 -0
  56. /package/dist/{chunk-H2D3DCEB.js.map → chunk-ZLPKMFOE.js.map} +0 -0
@@ -36,7 +36,7 @@ import {
36
36
  terminalRecord,
37
37
  usdToNanos,
38
38
  withinCandidateCleanupDeadline
39
- } from "./chunk-7I2AOKCI.js";
39
+ } from "./chunk-KHLE3C5G.js";
40
40
 
41
41
  // src/candidate-execution/builder.ts
42
42
  import { verifyCodeSurface } from "@tangle-network/agent-eval/campaign";
@@ -938,4 +938,4 @@ export {
938
938
  createProtectedAgentCandidateModelPort,
939
939
  recoverExpiredAgentCandidateExecution
940
940
  };
941
- //# sourceMappingURL=chunk-4E2GM63H.js.map
941
+ //# sourceMappingURL=chunk-MZH4HORF.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runLocalHarness
3
- } from "./chunk-PX6SXX3M.js";
3
+ } from "./chunk-JFAGXZKR.js";
4
4
 
5
5
  // src/improvement/agentic-generator.ts
6
6
  import { spawnSync } from "child_process";
@@ -207,4 +207,4 @@ export {
207
207
  agenticGenerator,
208
208
  commandVerifier
209
209
  };
210
- //# sourceMappingURL=chunk-RTVVH2KL.js.map
210
+ //# sourceMappingURL=chunk-OAVVQAOQ.js.map
@@ -5,13 +5,13 @@ import {
5
5
  definePersona,
6
6
  runPersonified,
7
7
  worktreeFanout
8
- } from "./chunk-OO4EK3JB.js";
8
+ } from "./chunk-L4CACVIJ.js";
9
9
  import {
10
10
  runAnalystLoop
11
11
  } from "./chunk-ZQZX77MM.js";
12
12
  import {
13
13
  createExecutorRegistry
14
- } from "./chunk-FHZHADIM.js";
14
+ } from "./chunk-TTWMSNFZ.js";
15
15
  import {
16
16
  ConfigError
17
17
  } from "./chunk-YEJR7IXO.js";
@@ -196,4 +196,4 @@ export {
196
196
  runLoopRunnerCli,
197
197
  parseLoopRunnerArgv
198
198
  };
199
- //# sourceMappingURL=chunk-MRYPFDHJ.js.map
199
+ //# sourceMappingURL=chunk-PV6Q3OKU.js.map
@@ -9,7 +9,7 @@ import {
9
9
  InMemoryResultBlobStore,
10
10
  InMemorySpawnJournal,
11
11
  contentAddress
12
- } from "./chunk-3D2RHC4K.js";
12
+ } from "./chunk-WIPGQ4GT.js";
13
13
  import {
14
14
  providerAsExecutor,
15
15
  resolveAgentEnvironmentProvider
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  harnessInvocation,
35
35
  runLocalHarness
36
- } from "./chunk-PX6SXX3M.js";
36
+ } from "./chunk-JFAGXZKR.js";
37
37
  import {
38
38
  AgentEvalError,
39
39
  ConfigError,
@@ -620,6 +620,7 @@ function clampSpend(spend, budget) {
620
620
  output: Math.floor(spend.tokens.output * ratio)
621
621
  } : spend.tokens,
622
622
  usd: budget.maxUsd === void 0 ? spend.usd : Math.min(spend.usd, budget.maxUsd),
623
+ ...spend.usdKnown === false ? { usdKnown: false } : {},
623
624
  ms: spend.ms
624
625
  };
625
626
  }
@@ -1980,13 +1981,16 @@ async function runWorktreeHarness(opts) {
1980
1981
  const { command, args } = harnessInvocation(opts.harness, opts.profile, opts.taskPrompt, {
1981
1982
  // This helper created the candidate worktree above; autonomous Claude
1982
1983
  // edits are permitted only inside that isolated checkout.
1983
- dangerouslySkipPermissions: opts.harness === "claude"
1984
+ dangerouslySkipPermissions: opts.harness === "claude",
1985
+ ...opts.codexReproducible ? { codexReproducible: true } : {}
1984
1986
  });
1985
1987
  const harnessResult = await runHarness({
1986
1988
  harness: opts.harness,
1987
1989
  cwd: worktree.path,
1988
1990
  taskPrompt: opts.taskPrompt,
1989
1991
  invocation: { command, args },
1992
+ ...opts.codexReproducible ? { codexReproducible: true } : {},
1993
+ ...opts.codexReadDeniedPaths ? { codexReadDeniedPaths: opts.codexReadDeniedPaths } : {},
1990
1994
  ...opts.harnessTimeoutMs !== void 0 ? { timeoutMs: opts.harnessTimeoutMs } : {},
1991
1995
  ...opts.signal ? { signal: opts.signal } : {}
1992
1996
  });
@@ -2014,7 +2018,19 @@ async function runWorktreeHarness(opts) {
2014
2018
  killedBySignal: harnessResult.killedBySignal,
2015
2019
  durationMs: harnessResult.durationMs,
2016
2020
  stdout: harnessResult.stdout,
2017
- stderr: harnessResult.stderr
2021
+ stderr: harnessResult.stderr,
2022
+ ...harnessResult.usage ? { usage: harnessResult.usage } : {},
2023
+ ...harnessResult.evidence ? {
2024
+ cliVersion: harnessResult.evidence.cliVersion,
2025
+ executableSha256: harnessResult.evidence.executableSha256,
2026
+ effectivePromptSha256: harnessResult.evidence.effectivePromptSha256,
2027
+ nonPromptArgsSha256: harnessResult.evidence.nonPromptArgsSha256,
2028
+ controlledConfigSha256: harnessResult.evidence.controlledConfigSha256,
2029
+ readDeniedPaths: [...harnessResult.evidence.readDeniedPaths],
2030
+ readDeniedPathsSha256: harnessResult.evidence.readDeniedPathsSha256,
2031
+ readDeniedPathCount: harnessResult.evidence.readDeniedPathCount,
2032
+ executionPolicy: harnessResult.evidence.policy
2033
+ } : {}
2018
2034
  },
2019
2035
  ...checks ? { checks } : {}
2020
2036
  };
@@ -2082,9 +2098,22 @@ function createWorktreeCliExecutor(options) {
2082
2098
  if (typeof options.taskPrompt !== "string" || options.taskPrompt.length === 0) {
2083
2099
  throw new ValidationError("createWorktreeCliExecutor: taskPrompt required");
2084
2100
  }
2101
+ if (options.codexReproducible && options.harness !== "codex") {
2102
+ throw new ValidationError(
2103
+ 'createWorktreeCliExecutor: codexReproducible requires harness "codex"'
2104
+ );
2105
+ }
2106
+ if (options.codexReproducible && options.budgetExempt === true) {
2107
+ throw new ValidationError("createWorktreeCliExecutor: codexReproducible cannot be budgetExempt");
2108
+ }
2109
+ if (options.codexReadDeniedPaths !== void 0 && !options.codexReproducible) {
2110
+ throw new ValidationError(
2111
+ "createWorktreeCliExecutor: codexReadDeniedPaths requires codexReproducible"
2112
+ );
2113
+ }
2085
2114
  const runId = options.runId ?? randomUUID();
2086
2115
  const controller = new AbortController();
2087
- const budgetExempt = options.budgetExempt ?? true;
2116
+ const budgetExempt = options.budgetExempt ?? !options.codexReproducible;
2088
2117
  let run;
2089
2118
  let artifact;
2090
2119
  return {
@@ -2103,6 +2132,8 @@ function createWorktreeCliExecutor(options) {
2103
2132
  ...options.testCmd !== void 0 ? { testCmd: options.testCmd } : {},
2104
2133
  ...options.typecheckCmd !== void 0 ? { typecheckCmd: options.typecheckCmd } : {},
2105
2134
  ...options.harnessTimeoutMs !== void 0 ? { harnessTimeoutMs: options.harnessTimeoutMs } : {},
2135
+ ...options.codexReproducible ? { codexReproducible: true } : {},
2136
+ ...options.codexReadDeniedPaths ? { codexReadDeniedPaths: options.codexReadDeniedPaths } : {},
2106
2137
  ...options.checkTimeoutMs !== void 0 ? { checkTimeoutMs: options.checkTimeoutMs } : {},
2107
2138
  ...options.checkOutputCap !== void 0 ? { checkOutputCap: options.checkOutputCap } : {},
2108
2139
  ...linked ? { signal: linked } : {},
@@ -2110,13 +2141,20 @@ function createWorktreeCliExecutor(options) {
2110
2141
  ...options.runHarness ? { runHarness: options.runHarness } : {},
2111
2142
  ...options.runCommand ? { runCommand: options.runCommand } : {}
2112
2143
  });
2144
+ const usage = run.result.harness.usage;
2145
+ if (!budgetExempt && !usage) {
2146
+ const completed = run;
2147
+ run = void 0;
2148
+ await completed.cleanup();
2149
+ throw new ValidationError(
2150
+ "createWorktreeCliExecutor: metered harness run returned no token usage"
2151
+ );
2152
+ }
2113
2153
  const spent = {
2114
2154
  iterations: 1,
2115
- // The worktree-harness core surfaces no token/usd usage, so tokens/usd are a genuine zero
2116
- // (NOT a fabricated cost). When budgetExempt is true the pool ignores this spend entirely;
2117
- // when explicitly false the scope debits exactly this captured spend — the real iteration.
2118
- tokens: zeroTokenUsage(),
2155
+ tokens: usage ? { input: usage.inputTokens, output: usage.outputTokens } : { input: 0, output: 0 },
2119
2156
  usd: 0,
2157
+ ...usage ? { usdKnown: false } : {},
2120
2158
  ms: Date.now() - started
2121
2159
  };
2122
2160
  artifact = { outRef: contentAddress(run.result), out: run.result, spent };
@@ -3090,6 +3128,8 @@ var cliWorktreeExecutor = (spec, ctx) => {
3090
3128
  ...seam.runId ? { runId: seam.runId } : {},
3091
3129
  ...seam.baseRef ? { baseRef: seam.baseRef } : {},
3092
3130
  ...seam.harnessTimeoutMs !== void 0 ? { harnessTimeoutMs: seam.harnessTimeoutMs } : {},
3131
+ ...seam.codexReproducible ? { codexReproducible: true } : {},
3132
+ ...seam.codexReadDeniedPaths ? { codexReadDeniedPaths: seam.codexReadDeniedPaths } : {},
3093
3133
  ...seam.testCmd !== void 0 ? { testCmd: seam.testCmd } : {},
3094
3134
  ...seam.typecheckCmd !== void 0 ? { typecheckCmd: seam.typecheckCmd } : {},
3095
3135
  ...seam.checkTimeoutMs !== void 0 ? { checkTimeoutMs: seam.checkTimeoutMs } : {},
@@ -3332,6 +3372,7 @@ function sumSpend(settled) {
3332
3372
  total.tokens.input += ev.spent.tokens.input;
3333
3373
  total.tokens.output += ev.spent.tokens.output;
3334
3374
  total.usd += ev.spent.usd;
3375
+ if (ev.spent.usdKnown === false) total.usdKnown = false;
3335
3376
  total.ms += ev.spent.ms;
3336
3377
  }
3337
3378
  return total;
@@ -3344,6 +3385,7 @@ function sumMetered(events) {
3344
3385
  total.tokens.input += ev.spend.tokens.input;
3345
3386
  total.tokens.output += ev.spend.tokens.output;
3346
3387
  total.usd += ev.spend.usd;
3388
+ if (ev.spend.usdKnown === false) total.usdKnown = false;
3347
3389
  total.ms += ev.spend.ms;
3348
3390
  }
3349
3391
  return total;
@@ -3488,6 +3530,11 @@ function createBudgetPool(root, now = Date.now) {
3488
3530
  }
3489
3531
  open.delete(ticket.id);
3490
3532
  const { tokens: rTokens, usd: rUsd, iterations: rIterations } = ticket.reserved;
3533
+ if (usdCapped && spent.usdKnown === false) {
3534
+ throw new Error(
3535
+ `budget pool: ticket ${ticket.id} reported unknown dollar cost under a dollar-capped budget`
3536
+ );
3537
+ }
3491
3538
  const spentTokens = totalTokens(spent.tokens);
3492
3539
  if (spentTokens > rTokens) {
3493
3540
  throw new Error(
@@ -3517,6 +3564,11 @@ function createBudgetPool(root, now = Date.now) {
3517
3564
  }
3518
3565
  }
3519
3566
  function observe(spend) {
3567
+ if (usdCapped && spend.usdKnown === false) {
3568
+ throw new Error(
3569
+ "budget pool: cannot observe unknown dollar cost under a dollar-capped budget"
3570
+ );
3571
+ }
3520
3572
  const tokens = totalTokens(spend.tokens);
3521
3573
  freeTokens -= tokens;
3522
3574
  committedTokens += tokens;
@@ -3741,6 +3793,7 @@ function accumulate(a, b) {
3741
3793
  a.tokens.input += b.tokens.input;
3742
3794
  a.tokens.output += b.tokens.output;
3743
3795
  a.usd += b.usd;
3796
+ if (b.usdKnown === false) a.usdKnown = false;
3744
3797
  a.ms += b.ms;
3745
3798
  }
3746
3799
  function addSpend(a, b) {
@@ -3748,6 +3801,7 @@ function addSpend(a, b) {
3748
3801
  iterations: a.iterations + b.iterations,
3749
3802
  tokens: { input: a.tokens.input + b.tokens.input, output: a.tokens.output + b.tokens.output },
3750
3803
  usd: a.usd + b.usd,
3804
+ ...a.usdKnown === false || b.usdKnown === false ? { usdKnown: false } : {},
3751
3805
  ms: a.ms + b.ms
3752
3806
  };
3753
3807
  }
@@ -6571,4 +6625,4 @@ export {
6571
6625
  workerFromBackend,
6572
6626
  supervise
6573
6627
  };
6574
- //# sourceMappingURL=chunk-FHZHADIM.js.map
6628
+ //# sourceMappingURL=chunk-TTWMSNFZ.js.map