@tangle-network/agent-runtime 0.73.0 → 0.75.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 (44) hide show
  1. package/dist/agent.d.ts +34 -2
  2. package/dist/agent.js +3 -2
  3. package/dist/agent.js.map +1 -1
  4. package/dist/analyst-loop.d.ts +1 -1
  5. package/dist/chunk-JPURCA2O.js +266 -0
  6. package/dist/chunk-JPURCA2O.js.map +1 -0
  7. package/dist/{chunk-7ODB76J5.js → chunk-MRWXCFV5.js} +2 -2
  8. package/dist/chunk-O2UPHN7X.js +114 -0
  9. package/dist/chunk-O2UPHN7X.js.map +1 -0
  10. package/dist/{chunk-U56XGKVY.js → chunk-QKNBYHMK.js} +3 -3
  11. package/dist/{chunk-HPYWEFVY.js → chunk-SA5GCF2X.js} +2 -2
  12. package/dist/{chunk-NCH4XUZ7.js → chunk-ZKMOIEOB.js} +13 -119
  13. package/dist/chunk-ZKMOIEOB.js.map +1 -0
  14. package/dist/{coordination-DU0saWeg.d.ts → coordination-DEVknvQo.d.ts} +3 -2
  15. package/dist/generator-YkAQrOoD.d.ts +382 -0
  16. package/dist/index.d.ts +13 -167
  17. package/dist/index.js +16 -264
  18. package/dist/index.js.map +1 -1
  19. package/dist/intelligence.d.ts +1 -1
  20. package/dist/lifecycle.d.ts +788 -200
  21. package/dist/lifecycle.js +814 -9
  22. package/dist/lifecycle.js.map +1 -1
  23. package/dist/local-harness-BE_h8szs.d.ts +93 -0
  24. package/dist/{loop-runner-bin-eD3m0rHW.d.ts → loop-runner-bin-BPthX22l.d.ts} +2 -2
  25. package/dist/loop-runner-bin.d.ts +6 -5
  26. package/dist/loop-runner-bin.js +4 -3
  27. package/dist/loops.d.ts +10 -9
  28. package/dist/loops.js +3 -2
  29. package/dist/mcp/bin.js +2 -1
  30. package/dist/mcp/bin.js.map +1 -1
  31. package/dist/mcp/index.d.ts +8 -6
  32. package/dist/mcp/index.js +6 -4
  33. package/dist/mcp/index.js.map +1 -1
  34. package/dist/mcp-serve-verifier-CT1KLTG_.d.ts +162 -0
  35. package/dist/{openai-tools-CBurv8Cu.d.ts → openai-tools-D-VCAEmw.d.ts} +1 -1
  36. package/dist/profiles.d.ts +1 -1
  37. package/dist/{types-JufmXF2a.d.ts → types-YimN9PQP.d.ts} +1 -1
  38. package/dist/{worktree-DaxOvw-C.d.ts → worktree-CtuEQ7bZ.d.ts} +2 -93
  39. package/dist/{worktree-fanout-DIffZohV.d.ts → worktree-fanout-Cdez8GR7.d.ts} +3 -2
  40. package/package.json +3 -3
  41. package/dist/chunk-NCH4XUZ7.js.map +0 -1
  42. /package/dist/{chunk-7ODB76J5.js.map → chunk-MRWXCFV5.js.map} +0 -0
  43. /package/dist/{chunk-U56XGKVY.js.map → chunk-QKNBYHMK.js.map} +0 -0
  44. /package/dist/{chunk-HPYWEFVY.js.map → chunk-SA5GCF2X.js.map} +0 -0
@@ -4,6 +4,10 @@ import {
4
4
  import {
5
5
  extractLlmCallEvent
6
6
  } from "./chunk-T2HVQVB4.js";
7
+ import {
8
+ harnessInvocation,
9
+ runLocalHarness
10
+ } from "./chunk-O2UPHN7X.js";
7
11
  import {
8
12
  AgentEvalError,
9
13
  ConfigError,
@@ -15,115 +19,6 @@ import {
15
19
  UI_LENSES
16
20
  } from "./chunk-WIR4HOOJ.js";
17
21
 
18
- // src/mcp/local-harness.ts
19
- import { spawn } from "child_process";
20
- var HARNESS_INVOCATIONS = {
21
- claude: {
22
- command: "claude",
23
- buildArgs: (taskPrompt) => ["--headless", "-p", taskPrompt],
24
- modelArgs: (model) => ["-m", model]
25
- },
26
- codex: {
27
- command: "codex",
28
- buildArgs: (taskPrompt) => ["run", taskPrompt],
29
- modelArgs: (model) => ["-m", model]
30
- },
31
- opencode: {
32
- command: "opencode",
33
- buildArgs: (taskPrompt) => ["run", taskPrompt],
34
- modelArgs: (model) => ["-m", model]
35
- }
36
- };
37
- function harnessInvocation(harness, profile, taskPrompt) {
38
- const invocation = HARNESS_INVOCATIONS[harness];
39
- if (!invocation) {
40
- throw new Error(`harnessInvocation: unknown harness ${String(harness)}`);
41
- }
42
- const systemPrompt = profile.prompt?.systemPrompt;
43
- const composedPrompt = typeof systemPrompt === "string" && systemPrompt.trim().length > 0 ? `${systemPrompt}
44
-
45
- ${taskPrompt}` : taskPrompt;
46
- const args = invocation.buildArgs(composedPrompt);
47
- const model = profile.model?.default;
48
- if (typeof model === "string" && model.length > 0) {
49
- args.push(...invocation.modelArgs(model));
50
- }
51
- return { command: invocation.command, args };
52
- }
53
- var DEFAULT_TIMEOUT_MS = 5 * 60 * 1e3;
54
- function runLocalHarness(options) {
55
- const { harness, cwd, taskPrompt } = options;
56
- const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
57
- const env = options.env ?? process.env;
58
- const spawnImpl = options.spawn ?? spawn;
59
- const invocation = HARNESS_INVOCATIONS[harness];
60
- if (!invocation) {
61
- return Promise.reject(new Error(`runLocalHarness: unknown harness ${String(harness)}`));
62
- }
63
- const startedAt = Date.now();
64
- const command = options.invocation?.command ?? invocation.command;
65
- const args = options.invocation ? [...options.invocation.args] : invocation.buildArgs(taskPrompt);
66
- return new Promise((resolve, reject) => {
67
- let child;
68
- try {
69
- child = spawnImpl(command, args, { cwd, env, stdio: "pipe" });
70
- } catch (err) {
71
- reject(err instanceof Error ? err : new Error(String(err)));
72
- return;
73
- }
74
- child.stdin?.end();
75
- let stdout = "";
76
- let stderr = "";
77
- let timedOut = false;
78
- let settled = false;
79
- const timer = timeoutMs > 0 ? setTimeout(() => {
80
- timedOut = true;
81
- if (!child.killed) child.kill("SIGTERM");
82
- }, timeoutMs) : null;
83
- if (timer && typeof timer.unref === "function") {
84
- ;
85
- timer.unref();
86
- }
87
- const onAbort = () => {
88
- if (!child.killed) child.kill("SIGTERM");
89
- };
90
- if (options.signal) {
91
- if (options.signal.aborted) onAbort();
92
- else options.signal.addEventListener("abort", onAbort, { once: true });
93
- }
94
- child.stdout?.on("data", (chunk) => {
95
- stdout += String(chunk);
96
- });
97
- child.stderr?.on("data", (chunk) => {
98
- stderr += String(chunk);
99
- });
100
- const finalize3 = (result) => {
101
- if (settled) return;
102
- settled = true;
103
- if (timer) clearTimeout(timer);
104
- options.signal?.removeEventListener("abort", onAbort);
105
- resolve(result);
106
- };
107
- child.on("error", (err) => {
108
- if (settled) return;
109
- settled = true;
110
- if (timer) clearTimeout(timer);
111
- options.signal?.removeEventListener("abort", onAbort);
112
- reject(err);
113
- });
114
- child.on("close", (code, signal) => {
115
- finalize3({
116
- exitCode: code,
117
- stdout,
118
- stderr,
119
- killedBySignal: signal,
120
- durationMs: Date.now() - startedAt,
121
- timedOut
122
- });
123
- });
124
- });
125
- }
126
-
127
22
  // src/runtime/supervise/model-policy.ts
128
23
  function assertModelAllowed(model, allowed) {
129
24
  if (!allowed || model === void 0) return;
@@ -1359,7 +1254,7 @@ function createScope(args) {
1359
1254
  let cursorSeq = 0;
1360
1255
  let meterSeq = 0;
1361
1256
  const now = args.now ?? Date.now;
1362
- function spawn5(agent, task, opts) {
1257
+ function spawn4(agent, task, opts) {
1363
1258
  if (args.maxDepth !== void 0 && args.depth >= args.maxDepth) {
1364
1259
  return { ok: false, reason: "depth-exceeded" };
1365
1260
  }
@@ -1510,7 +1405,7 @@ function createScope(args) {
1510
1405
  );
1511
1406
  }
1512
1407
  return {
1513
- spawn: spawn5,
1408
+ spawn: spawn4,
1514
1409
  next,
1515
1410
  send,
1516
1411
  signal: args.signal,
@@ -1982,11 +1877,11 @@ ${lines.join("\n")}`;
1982
1877
  }
1983
1878
 
1984
1879
  // src/mcp/worktree.ts
1985
- import { spawn as spawn2 } from "child_process";
1880
+ import { spawn } from "child_process";
1986
1881
  async function runGitAsync(args, cwd, runner) {
1987
1882
  if (runner) return runner(args, { cwd });
1988
1883
  return new Promise((resolve, reject) => {
1989
- const proc = spawn2("git", args, { cwd, stdio: "pipe" });
1884
+ const proc = spawn("git", args, { cwd, stdio: "pipe" });
1990
1885
  let stdout = "";
1991
1886
  let stderr = "";
1992
1887
  proc.stdout?.on("data", (c) => {
@@ -2071,7 +1966,7 @@ async function removeWorktree(options) {
2071
1966
  import { randomUUID } from "crypto";
2072
1967
 
2073
1968
  // src/mcp/worktree-harness.ts
2074
- import { spawn as spawn3 } from "child_process";
1969
+ import { spawn as spawn2 } from "child_process";
2075
1970
  var defaultCheckOutputCap = 16e3;
2076
1971
  async function runWorktreeHarness(opts) {
2077
1972
  const runHarness = opts.runHarness ?? runLocalHarness;
@@ -2156,7 +2051,7 @@ async function runChecks(opts) {
2156
2051
  }
2157
2052
  function defaultRunCommand(opts) {
2158
2053
  return new Promise((resolve, reject) => {
2159
- const child = spawn3("/bin/sh", ["-c", opts.command], {
2054
+ const child = spawn2("/bin/sh", ["-c", opts.command], {
2160
2055
  cwd: opts.cwd,
2161
2056
  stdio: ["ignore", "pipe", "pipe"]
2162
2057
  });
@@ -2262,7 +2157,7 @@ function linkSignals(a, b) {
2262
2157
  }
2263
2158
 
2264
2159
  // src/runtime/supervise/runtime.ts
2265
- import { spawn as spawn4 } from "child_process";
2160
+ import { spawn as spawn3 } from "child_process";
2266
2161
  import { randomUUID as randomUUID2 } from "crypto";
2267
2162
  import { estimateCost as estimateCost2, isModelPriced as isModelPriced2 } from "@tangle-network/agent-eval";
2268
2163
  var routerSeamKey = "router";
@@ -2653,7 +2548,7 @@ var cliExecutor = (_spec, ctx) => {
2653
2548
  };
2654
2549
  async function* streamCliLeaf(args) {
2655
2550
  const prompt = taskToPrompt(args.task);
2656
- const proc = spawn4(args.seam.bin, args.seam.args ?? [], {
2551
+ const proc = spawn3(args.seam.bin, args.seam.args ?? [], {
2657
2552
  ...args.seam.cwd ? { cwd: args.seam.cwd } : {},
2658
2553
  env: { ...process.env, ...args.seam.env ?? {} },
2659
2554
  stdio: ["pipe", "pipe", "pipe"]
@@ -6230,7 +6125,6 @@ function routerBrainFromProfile(profile, deps) {
6230
6125
  }
6231
6126
 
6232
6127
  export {
6233
- runLocalHarness,
6234
6128
  assertModelAllowed,
6235
6129
  deleteBoxSafe,
6236
6130
  randomSuffix,
@@ -6333,4 +6227,4 @@ export {
6333
6227
  createInProcessTransport,
6334
6228
  serveCoordinationMcp
6335
6229
  };
6336
- //# sourceMappingURL=chunk-NCH4XUZ7.js.map
6230
+ //# sourceMappingURL=chunk-ZKMOIEOB.js.map