@tangle-network/agent-runtime 0.93.2 → 0.94.1

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 (80) hide show
  1. package/README.md +4 -3
  2. package/dist/agent.d.ts +1 -1
  3. package/dist/agent.js +5 -6
  4. package/dist/agent.js.map +1 -1
  5. package/dist/{agentic-generator-B8oeE2Yv.d.ts → agentic-generator-D9ZmAuiL.d.ts} +1 -1
  6. package/dist/analyst-loop.d.ts +1 -1
  7. package/dist/candidate-execution/index.d.ts +10 -3
  8. package/dist/candidate-execution/index.js +9 -3
  9. package/dist/{chunk-6K5CI33W.js → chunk-D336OZHK.js} +1232 -19
  10. package/dist/chunk-D336OZHK.js.map +1 -0
  11. package/dist/{chunk-TU73X3I6.js → chunk-HPCJBBLS.js} +2 -2
  12. package/dist/chunk-ISTDY47H.js +849 -0
  13. package/dist/chunk-ISTDY47H.js.map +1 -0
  14. package/dist/{chunk-RTVVH2KL.js → chunk-JEP2WM24.js} +2 -2
  15. package/dist/{chunk-Z7K5BPKZ.js → chunk-K7OPNHU4.js} +2 -2
  16. package/dist/{chunk-OX3QRJOA.js → chunk-KHLE3C5G.js} +281 -251
  17. package/dist/chunk-KHLE3C5G.js.map +1 -0
  18. package/dist/{chunk-XDSWWUKE.js → chunk-MZH4HORF.js} +6 -29
  19. package/dist/chunk-MZH4HORF.js.map +1 -0
  20. package/dist/chunk-PJNGPWTA.js +634 -0
  21. package/dist/chunk-PJNGPWTA.js.map +1 -0
  22. package/dist/{chunk-X5KJKS33.js → chunk-RTSZNYXM.js} +3 -3
  23. package/dist/{chunk-WGR6QJ5H.js → chunk-SJHFJOCY.js} +8 -161
  24. package/dist/chunk-SJHFJOCY.js.map +1 -0
  25. package/dist/{chunk-2BQMAZAB.js → chunk-URMJTSXB.js} +1378 -28
  26. package/dist/chunk-URMJTSXB.js.map +1 -0
  27. package/dist/{chunk-3D2RHC4K.js → chunk-WIPGQ4GT.js} +1 -1
  28. package/dist/{chunk-3D2RHC4K.js.map → chunk-WIPGQ4GT.js.map} +1 -1
  29. package/dist/{chunk-R5GWDTM3.js → chunk-ZEYAT33L.js} +2 -2
  30. package/dist/{completion-gate-BLaiN0-X.d.ts → completion-gate-BAj3dXeW.d.ts} +14 -2
  31. package/dist/{coordination-DxJ83oZA.d.ts → coordination-B3ZuApR_.d.ts} +7 -5
  32. package/dist/environment-provider.d.ts +2 -2
  33. package/dist/{improve-DDhQaaJT.d.ts → improve-r8SvIxYv.d.ts} +13 -16
  34. package/dist/index.d.ts +39 -110
  35. package/dist/index.js +92 -36
  36. package/dist/index.js.map +1 -1
  37. package/dist/intelligence.d.ts +24 -7
  38. package/dist/intelligence.js +114 -20
  39. package/dist/intelligence.js.map +1 -1
  40. package/dist/knowledge.d.ts +7 -7
  41. package/dist/knowledge.js +5 -5
  42. package/dist/lifecycle.d.ts +3 -3
  43. package/dist/lifecycle.js +2 -2
  44. package/dist/{local-harness-dcD5WTTr.d.ts → local-harness-B7bNuNJw.d.ts} +49 -1
  45. package/dist/{loop-runner-bin-kKUNGLyV.d.ts → loop-runner-bin-D4bMIxmB.d.ts} +2 -2
  46. package/dist/loop-runner-bin.d.ts +6 -6
  47. package/dist/loop-runner-bin.js +6 -7
  48. package/dist/loops.d.ts +457 -18
  49. package/dist/loops.js +39 -41
  50. package/dist/mcp/bin.js +5 -5
  51. package/dist/mcp/index.d.ts +10 -10
  52. package/dist/mcp/index.js +9 -8
  53. package/dist/{mcp-serve-verifier-Bg4C3p5S.d.ts → mcp-serve-verifier-BuXjaZDE.d.ts} +1 -1
  54. package/dist/{openai-tools-E3woykz9.d.ts → openai-tools-D0ZSRCC6.d.ts} +1 -1
  55. package/dist/{prepare-DiVGKcwS.d.ts → prepare-BKxAiUcH.d.ts} +1 -1
  56. package/dist/profiles.d.ts +1 -1
  57. package/dist/{sanitize-C9go6tXj.d.ts → sanitize-C2jicjNf.d.ts} +1 -1
  58. package/dist/{supervise-T2pazU3G.d.ts → supervise-DTNcLDl2.d.ts} +4 -4
  59. package/dist/{types-DAdIm4AC.d.ts → types-Bb-CqxJH.d.ts} +5 -2
  60. package/dist/{types-B00NtbCs.d.ts → types-DWA64rbJ.d.ts} +1 -1
  61. package/dist/{worktree-fanout-BUb2Ag02.d.ts → worktree-fanout-IMKqdV_E.d.ts} +244 -244
  62. package/package.json +4 -4
  63. package/skills/build-with-agent-runtime/SKILL.md +1 -1
  64. package/dist/chunk-2BQMAZAB.js.map +0 -1
  65. package/dist/chunk-6K5CI33W.js.map +0 -1
  66. package/dist/chunk-FDJ7AHXG.js +0 -1229
  67. package/dist/chunk-FDJ7AHXG.js.map +0 -1
  68. package/dist/chunk-J2K6WIG6.js +0 -2172
  69. package/dist/chunk-J2K6WIG6.js.map +0 -1
  70. package/dist/chunk-OX3QRJOA.js.map +0 -1
  71. package/dist/chunk-PX6SXX3M.js +0 -146
  72. package/dist/chunk-PX6SXX3M.js.map +0 -1
  73. package/dist/chunk-WGR6QJ5H.js.map +0 -1
  74. package/dist/chunk-XDSWWUKE.js.map +0 -1
  75. package/dist/structural-rollout-DHGDbhvR.d.ts +0 -446
  76. /package/dist/{chunk-TU73X3I6.js.map → chunk-HPCJBBLS.js.map} +0 -0
  77. /package/dist/{chunk-RTVVH2KL.js.map → chunk-JEP2WM24.js.map} +0 -0
  78. /package/dist/{chunk-Z7K5BPKZ.js.map → chunk-K7OPNHU4.js.map} +0 -0
  79. /package/dist/{chunk-X5KJKS33.js.map → chunk-RTSZNYXM.js.map} +0 -0
  80. /package/dist/{chunk-R5GWDTM3.js.map → chunk-ZEYAT33L.js.map} +0 -0
package/dist/index.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  createProtectedAgentCandidateModelPort,
5
5
  disposePreparedAgentCandidateExecution,
6
6
  recoverExpiredAgentCandidateExecution
7
- } from "./chunk-XDSWWUKE.js";
7
+ } from "./chunk-MZH4HORF.js";
8
8
  import {
9
9
  mcpToolsForRuntimeMcp,
10
10
  mcpToolsForRuntimeMcpSubset
11
- } from "./chunk-Z7K5BPKZ.js";
11
+ } from "./chunk-K7OPNHU4.js";
12
12
  import {
13
13
  DEFAULT_ROUTER_BASE_URL,
14
14
  cleanModelId,
@@ -27,33 +27,29 @@ import {
27
27
  runLoopRunnerCli,
28
28
  selfImproveLoopRunner,
29
29
  worktreeLoopRunner
30
- } from "./chunk-X5KJKS33.js";
30
+ } from "./chunk-RTSZNYXM.js";
31
31
  import "./chunk-SGKPNBXE.js";
32
32
  import {
33
- ROLLOUT_POLICY_BOUNDS,
34
- ROLLOUT_POLICY_EXTENSION,
35
- applyRolloutPolicyToProfile,
36
- enumerateNeighborPolicies,
33
+ applyImprovementWinnerToProfile,
37
34
  improve,
38
35
  improvementDriver,
39
- normalizeRolloutPolicy,
40
- parseRolloutPolicy,
41
- rawTraceDistiller,
42
- rolloutPolicyProposer,
43
- serializeRolloutPolicy,
44
- structuralRolloutPolicyFromProfile
45
- } from "./chunk-WGR6QJ5H.js";
36
+ rawTraceDistiller
37
+ } from "./chunk-SJHFJOCY.js";
46
38
  import {
47
39
  CANDIDATE_TRACE_ENV,
48
40
  CANDIDATE_TRACE_TAGS,
49
41
  InMemoryAgentCandidateExecutionClaimStore,
42
+ applyExactAgentProfileDiff,
50
43
  candidateExecutionClaim,
44
+ canonicalCandidateDigest,
51
45
  executePreparedAgentCandidate,
46
+ parseExactAgentProfile,
47
+ parseExactAgentProfileDiff,
52
48
  persistCandidateOutputArtifact,
53
49
  prepareAgentCandidateExecution,
54
50
  sealAgentCandidateBundle,
55
51
  verifyAgentCandidateBundle
56
- } from "./chunk-OX3QRJOA.js";
52
+ } from "./chunk-KHLE3C5G.js";
57
53
  import {
58
54
  InMemoryRuntimeSessionStore,
59
55
  createIterableBackend,
@@ -63,8 +59,7 @@ import {
63
59
  normalizeBackendStreamEvent,
64
60
  nowIso,
65
61
  touchSession
66
- } from "./chunk-6K5CI33W.js";
67
- import "./chunk-FDJ7AHXG.js";
62
+ } from "./chunk-D336OZHK.js";
68
63
  import "./chunk-ZQZX77MM.js";
69
64
  import {
70
65
  mcpBuildPrompt,
@@ -74,7 +69,7 @@ import {
74
69
  import {
75
70
  agenticGenerator,
76
71
  commandVerifier
77
- } from "./chunk-RTVVH2KL.js";
72
+ } from "./chunk-JEP2WM24.js";
78
73
  import {
79
74
  RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
80
75
  createAgentKnowledgeReadinessCheck,
@@ -83,33 +78,34 @@ import {
83
78
  knowledgeReadinessDeliverable,
84
79
  runKnowledgeImprovementJob,
85
80
  runSupervisedKnowledgeUpdate
86
- } from "./chunk-TU73X3I6.js";
81
+ } from "./chunk-HPCJBBLS.js";
87
82
  import "./chunk-5QOB7H74.js";
88
- import "./chunk-2BQMAZAB.js";
83
+ import {
84
+ composeRuntimeHooks,
85
+ defineRuntimeHooks,
86
+ notifyRuntimeDecisionPoint,
87
+ notifyRuntimeHookEvent
88
+ } from "./chunk-URMJTSXB.js";
89
89
  import "./chunk-DPEUKJRO.js";
90
90
  import {
91
91
  INTELLIGENCE_WIRE_VERSION,
92
92
  buildLoopOtelSpans,
93
93
  buildLoopSpanNodes,
94
94
  buildRuntimeEventOtelSpans,
95
- composeRuntimeHooks,
96
95
  createOtelExporter,
97
96
  createRuntimeEventCollector,
98
97
  createRuntimeStreamEventCollector,
99
- defineRuntimeHooks,
100
98
  exportEvalRuns,
101
99
  loopEventToOtelSpan,
102
- notifyRuntimeDecisionPoint,
103
- notifyRuntimeHookEvent,
104
100
  sanitizeAgentRuntimeEvent,
105
101
  sanitizeKnowledgeReadinessReport,
106
102
  sanitizeRuntimeStreamEvent
107
- } from "./chunk-J2K6WIG6.js";
108
- import "./chunk-3D2RHC4K.js";
103
+ } from "./chunk-ISTDY47H.js";
104
+ import "./chunk-WIPGQ4GT.js";
109
105
  import "./chunk-VSWBYWFK.js";
110
106
  import "./chunk-3MDZX7YU.js";
111
107
  import "./chunk-FVJ7M3DA.js";
112
- import "./chunk-PX6SXX3M.js";
108
+ import "./chunk-PJNGPWTA.js";
113
109
  import {
114
110
  AgentEvalError,
115
111
  BackendTransportError,
@@ -1322,6 +1318,70 @@ function deriveExecutionId(input) {
1322
1318
  return `${input.projectId}:${input.sessionId}:${input.turnIndex}`;
1323
1319
  }
1324
1320
 
1321
+ // src/improvement/profile-diff-proposer.ts
1322
+ import { canonicalJson } from "@tangle-network/agent-eval";
1323
+ import {
1324
+ changedAgentProfileAxes
1325
+ } from "@tangle-network/agent-interface";
1326
+ function profileDiffProposer(options) {
1327
+ return {
1328
+ kind: "agent-profile-diff",
1329
+ async propose(ctx) {
1330
+ if (typeof ctx.currentSurface !== "string") {
1331
+ throw new Error("profileDiffProposer requires a serialized AgentProfile surface");
1332
+ }
1333
+ const profile = parseSerializedProfile(ctx.currentSurface);
1334
+ const proposals = await options.proposeDiffs({
1335
+ ...ctx,
1336
+ profile
1337
+ });
1338
+ const candidates = [];
1339
+ const normalizedBaseline = applyExactAgentProfileDiff(
1340
+ profile,
1341
+ { schemaVersion: 1, kind: "agent-profile-diff" },
1342
+ "profile diff baseline"
1343
+ );
1344
+ const seen = /* @__PURE__ */ new Set([canonicalJson(normalizedBaseline)]);
1345
+ for (const [index, proposal] of proposals.entries()) {
1346
+ if (candidates.length >= ctx.populationSize || ctx.signal.aborted) break;
1347
+ const diff = parseExactAgentProfileDiff(proposal.diff, `profile diff proposal ${index}`);
1348
+ const axes = changedAgentProfileAxes(diff);
1349
+ if (axes.length === 0) continue;
1350
+ const candidate = applyExactAgentProfileDiff(
1351
+ profile,
1352
+ diff,
1353
+ `profile diff candidate ${index}`
1354
+ );
1355
+ const surface = canonicalJson(candidate);
1356
+ if (seen.has(surface)) continue;
1357
+ seen.add(surface);
1358
+ candidates.push({
1359
+ surface,
1360
+ label: proposal.label ?? diff.title ?? diff.id ?? `Change ${axes.join(", ")}`,
1361
+ rationale: candidateRationale(proposal, diff, axes)
1362
+ });
1363
+ }
1364
+ return candidates;
1365
+ }
1366
+ };
1367
+ }
1368
+ function candidateRationale(proposal, diff, axes) {
1369
+ const reason = proposal.rationale ?? diff.rationale ?? `Changes profile axes: ${axes.join(", ")}.`;
1370
+ const source = diff.source ? [diff.source.kind, ...diff.source.artifacts ?? []].join(" \xB7 ") : "source unspecified";
1371
+ return `${reason} Source: ${source}. Diff: ${canonicalCandidateDigest(diff)}.`;
1372
+ }
1373
+ function parseSerializedProfile(surface) {
1374
+ let raw;
1375
+ try {
1376
+ raw = JSON.parse(surface);
1377
+ } catch (cause) {
1378
+ throw new Error("profileDiffProposer current surface is not valid AgentProfile JSON", {
1379
+ cause
1380
+ });
1381
+ }
1382
+ return parseExactAgentProfile(raw, "profileDiffProposer current profile");
1383
+ }
1384
+
1325
1385
  // src/improvement/reflective-generator.ts
1326
1386
  import { spawnSync } from "child_process";
1327
1387
  function reflectiveGenerator(opts) {
@@ -2437,13 +2497,12 @@ export {
2437
2497
  NotFoundError,
2438
2498
  PlannerError,
2439
2499
  RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
2440
- ROLLOUT_POLICY_BOUNDS,
2441
- ROLLOUT_POLICY_EXTENSION,
2442
2500
  RuntimeRunStateError,
2443
2501
  SqlConversationJournal,
2444
2502
  ValidationError,
2445
2503
  agenticGenerator,
2446
- applyRolloutPolicyToProfile,
2504
+ applyExactAgentProfileDiff,
2505
+ applyImprovementWinnerToProfile,
2447
2506
  applyRunRecordDefaults,
2448
2507
  auditLoopRunner,
2449
2508
  buildAgentCandidateBundle,
@@ -2473,7 +2532,6 @@ export {
2473
2532
  defineRuntimeHooks,
2474
2533
  deriveExecutionId,
2475
2534
  disposePreparedAgentCandidateExecution,
2476
- enumerateNeighborPolicies,
2477
2535
  executePreparedAgentCandidate,
2478
2536
  exportEvalRuns,
2479
2537
  formatSupervisedKnowledgeTask,
@@ -2490,13 +2548,14 @@ export {
2490
2548
  mcpServeVerifier,
2491
2549
  mcpToolsForRuntimeMcp,
2492
2550
  mcpToolsForRuntimeMcpSubset,
2493
- normalizeRolloutPolicy,
2494
2551
  notifyRuntimeDecisionPoint,
2495
2552
  notifyRuntimeHookEvent,
2553
+ parseExactAgentProfile,
2554
+ parseExactAgentProfileDiff,
2496
2555
  parseLoopRunnerArgv,
2497
- parseRolloutPolicy,
2498
2556
  persistCandidateOutputArtifact,
2499
2557
  prepareAgentCandidateExecution,
2558
+ profileDiffProposer,
2500
2559
  rawTraceDistiller,
2501
2560
  readDepth,
2502
2561
  readinessServerSentEvent,
@@ -2506,7 +2565,6 @@ export {
2506
2565
  resolveAgentBackend,
2507
2566
  resolveChatModel,
2508
2567
  resolveRouterBaseUrl,
2509
- rolloutPolicyProposer,
2510
2568
  runAgentTask,
2511
2569
  runAgentTaskStream,
2512
2570
  runConversation,
@@ -2524,12 +2582,10 @@ export {
2524
2582
  sanitizeRuntimeStreamEvent,
2525
2583
  sealAgentCandidateBundle,
2526
2584
  selfImproveLoopRunner,
2527
- serializeRolloutPolicy,
2528
2585
  sleep,
2529
2586
  slugifySpeaker,
2530
2587
  startRuntimeRun,
2531
2588
  streamToolLoop,
2532
- structuralRolloutPolicyFromProfile,
2533
2589
  toolBuildPrompt,
2534
2590
  turnId,
2535
2591
  validateChatModelId,