@tangle-network/agent-runtime 0.103.1 → 0.104.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 (67) hide show
  1. package/README.md +4 -0
  2. package/dist/agent.d.ts +1 -1
  3. package/dist/agent.js +5 -5
  4. package/dist/analyst-loop.d.ts +1 -1
  5. package/dist/{chunk-TUSOOIDV.js → chunk-2QJSNOGK.js} +2 -2
  6. package/dist/{chunk-ZOYN3JR5.js → chunk-2UABGGUB.js} +3 -3
  7. package/dist/{chunk-6WZZXQV5.js → chunk-2X65HYMI.js} +1 -1
  8. package/dist/chunk-2X65HYMI.js.map +1 -0
  9. package/dist/{chunk-AAN2MB2X.js → chunk-3PPVCS75.js} +3 -3
  10. package/dist/chunk-3PPVCS75.js.map +1 -0
  11. package/dist/{chunk-EAQ5YRRY.js → chunk-5HNDYWUT.js} +39 -22
  12. package/dist/chunk-5HNDYWUT.js.map +1 -0
  13. package/dist/{chunk-3LJF5XSE.js → chunk-ATDFUJYI.js} +6 -6
  14. package/dist/chunk-ATDFUJYI.js.map +1 -0
  15. package/dist/{chunk-LFM4JBRW.js → chunk-FJI3EXU3.js} +46 -5
  16. package/dist/chunk-FJI3EXU3.js.map +1 -0
  17. package/dist/{chunk-5AITUUHO.js → chunk-HAO4CXHP.js} +2 -2
  18. package/dist/{chunk-M6MD6JBS.js → chunk-KRBFHMV6.js} +429 -1
  19. package/dist/chunk-KRBFHMV6.js.map +1 -0
  20. package/dist/{chunk-AYU35OTU.js → chunk-PZZKQVQV.js} +1 -1
  21. package/dist/chunk-PZZKQVQV.js.map +1 -0
  22. package/dist/{chunk-QYCKIV6C.js → chunk-STJEHM5F.js} +2 -2
  23. package/dist/{completion-gate-DLINnrkM.d.ts → completion-gate-Bv47cOnn.d.ts} +2 -2
  24. package/dist/{coordination-DTehA977.d.ts → coordination-CxtzMxSM.d.ts} +27 -27
  25. package/dist/environment-provider.d.ts +18 -7
  26. package/dist/environment-provider.js +3 -1
  27. package/dist/{improve-B40dRu0X.d.ts → improve--2A0gK1-.d.ts} +10 -4
  28. package/dist/index.d.ts +13 -13
  29. package/dist/index.js +10 -10
  30. package/dist/index.js.map +1 -1
  31. package/dist/intelligence.d.ts +46 -9
  32. package/dist/intelligence.js +117 -20
  33. package/dist/intelligence.js.map +1 -1
  34. package/dist/knowledge.d.ts +5 -5
  35. package/dist/knowledge.js +7 -7
  36. package/dist/{loop-runner-bin-DhIXsLAd.d.ts → loop-runner-bin-DUOGtvOl.d.ts} +3 -3
  37. package/dist/loop-runner-bin.d.ts +5 -5
  38. package/dist/loop-runner-bin.js +6 -6
  39. package/dist/loops.d.ts +66 -41
  40. package/dist/loops.js +9 -5
  41. package/dist/mcp/bin.js +4 -4
  42. package/dist/mcp/index.d.ts +6 -6
  43. package/dist/mcp/index.js +10 -10
  44. package/dist/mcp/index.js.map +1 -1
  45. package/dist/primeintellect/index.d.ts +1 -1
  46. package/dist/primeintellect/index.js.map +1 -1
  47. package/dist/profiles.d.ts +6 -6
  48. package/dist/profiles.js.map +1 -1
  49. package/dist/{structural-rollout-BFPIy3iw.d.ts → structural-rollout-C4mabf87.d.ts} +3 -3
  50. package/dist/{supervise-Cp8bNcJi.d.ts → supervise-7q9F5brx.d.ts} +3 -3
  51. package/dist/testing.js +8 -8
  52. package/dist/testing.js.map +1 -1
  53. package/dist/{types-DK11_O4L.d.ts → types-BCoemcXU.d.ts} +4 -4
  54. package/dist/{types-lZTE_LBd.d.ts → types-CvNwMzQt.d.ts} +4 -4
  55. package/dist/{worktree-fanout-DiiJWjJO.d.ts → worktree-fanout-WsOzt8qu.d.ts} +5 -5
  56. package/package.json +3 -3
  57. package/dist/chunk-3LJF5XSE.js.map +0 -1
  58. package/dist/chunk-6WZZXQV5.js.map +0 -1
  59. package/dist/chunk-AAN2MB2X.js.map +0 -1
  60. package/dist/chunk-AYU35OTU.js.map +0 -1
  61. package/dist/chunk-EAQ5YRRY.js.map +0 -1
  62. package/dist/chunk-LFM4JBRW.js.map +0 -1
  63. package/dist/chunk-M6MD6JBS.js.map +0 -1
  64. /package/dist/{chunk-TUSOOIDV.js.map → chunk-2QJSNOGK.js.map} +0 -0
  65. /package/dist/{chunk-ZOYN3JR5.js.map → chunk-2UABGGUB.js.map} +0 -0
  66. /package/dist/{chunk-5AITUUHO.js.map → chunk-HAO4CXHP.js.map} +0 -0
  67. /package/dist/{chunk-QYCKIV6C.js.map → chunk-STJEHM5F.js.map} +0 -0
@@ -20,13 +20,13 @@ import {
20
20
  import {
21
21
  defaultStructuralRolloutPolicy,
22
22
  optimizerMethod
23
- } from "./chunk-QYCKIV6C.js";
23
+ } from "./chunk-STJEHM5F.js";
24
24
  import {
25
25
  assertModelAllowed,
26
26
  harnessInvocation,
27
27
  runLocalHarness,
28
28
  runSettledCommand
29
- } from "./chunk-6WZZXQV5.js";
29
+ } from "./chunk-2X65HYMI.js";
30
30
  import {
31
31
  runAnalystLoop
32
32
  } from "./chunk-FD2MBMOH.js";
@@ -1466,6 +1466,23 @@ function materializeImprovementProfileCandidate(profile, surface, winner, skills
1466
1466
  }
1467
1467
  return immutableCandidateValue(parsed.data);
1468
1468
  }
1469
+ function profileImprovementAgent(input) {
1470
+ return (surfaceValue, scenario, ctx) => {
1471
+ const profile = materializeImprovementProfileCandidate(
1472
+ input.baselineProfile,
1473
+ input.surface,
1474
+ surfaceValue,
1475
+ input.skills
1476
+ );
1477
+ const dispatchedProfile = profile ?? (input.surface === "rollout-policy" && surfaceValue === "" ? input.baselineProfile : void 0);
1478
+ if (!dispatchedProfile) {
1479
+ throw new ConfigError(
1480
+ `improve(): surface '${input.surface}' cannot run through profileDispatch; use opts.agent for a non-profile surface`
1481
+ );
1482
+ }
1483
+ return input.dispatch(dispatchedProfile, scenario, ctx);
1484
+ };
1485
+ }
1469
1486
  function inlineSkill(profile, options) {
1470
1487
  const resourceName = options?.resourceName.trim();
1471
1488
  if (!resourceName) {
@@ -1515,6 +1532,8 @@ async function improve(profile, findings, opts) {
1515
1532
  const {
1516
1533
  surface = "prompt",
1517
1534
  gate = "holdout",
1535
+ agent,
1536
+ profileDispatch,
1518
1537
  generator,
1519
1538
  allowedModels,
1520
1539
  rawTraceContext,
@@ -1530,6 +1549,18 @@ async function improve(profile, findings, opts) {
1530
1549
  `improve(): input is not a valid AgentProfile: ${parsedProfile.error.message}`
1531
1550
  );
1532
1551
  }
1552
+ if (agent !== void 0 && profileDispatch !== void 0) {
1553
+ throw new ConfigError("improve(): provide exactly one of opts.agent or opts.profileDispatch");
1554
+ }
1555
+ if (agent === void 0 && profileDispatch === void 0) {
1556
+ throw new ConfigError("improve(): provide exactly one of opts.agent or opts.profileDispatch");
1557
+ }
1558
+ const baselineProfile = immutableCandidateValue(parsedProfile.data);
1559
+ if (profileDispatch && surface === "code") {
1560
+ throw new ConfigError(
1561
+ "improve(): surface 'code' cannot use profileDispatch because code candidates require isolated worktree execution; use opts.agent"
1562
+ );
1563
+ }
1533
1564
  if (surface === "code" && generator) {
1534
1565
  throw new ConfigError(
1535
1566
  "improve(): surface 'code' forbids opts.generator because an external SurfaceProposer cannot transfer checkout ownership; pass opts.code.generator instead"
@@ -1555,11 +1586,21 @@ async function improve(profile, findings, opts) {
1555
1586
  );
1556
1587
  }
1557
1588
  const budget = gate === "none" ? { ...sharedOptions.budget, generations: 0 } : { ...sharedOptions.budget };
1589
+ const effectiveAgent = profileDispatch === void 0 ? agent : profileImprovementAgent({
1590
+ baselineProfile,
1591
+ surface,
1592
+ ...skills === void 0 ? {} : { skills },
1593
+ dispatch: profileDispatch
1594
+ });
1595
+ if (!effectiveAgent) {
1596
+ throw new ConfigError("improve(): provide exactly one of opts.agent or opts.profileDispatch");
1597
+ }
1558
1598
  let raw;
1559
1599
  try {
1560
1600
  raw = await selfImprove({
1561
1601
  ...sharedOptions,
1562
- baselineSurface: preparedCode?.baseline ?? baselineSurfaceFor(parsedProfile.data, surface, skills),
1602
+ agent: effectiveAgent,
1603
+ baselineSurface: preparedCode?.baseline ?? baselineSurfaceFor(baselineProfile, surface, skills),
1563
1604
  proposer,
1564
1605
  budget,
1565
1606
  findings,
@@ -1598,7 +1639,7 @@ async function improve(profile, findings, opts) {
1598
1639
  }
1599
1640
  const dispose = idempotentDispose(async () => preparedCode?.cleanup());
1600
1641
  const candidateProfile = materializeImprovementProfileCandidate(
1601
- parsedProfile.data,
1642
+ baselineProfile,
1602
1643
  surface,
1603
1644
  winnerSurface,
1604
1645
  skills
@@ -2358,4 +2399,4 @@ export {
2358
2399
  verifyAgentImprovementActivation,
2359
2400
  verifyCandidateExecutionEvidence
2360
2401
  };
2361
- //# sourceMappingURL=chunk-LFM4JBRW.js.map
2402
+ //# sourceMappingURL=chunk-FJI3EXU3.js.map