@tangle-network/agent-runtime 0.50.0 → 0.52.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 (43) hide show
  1. package/dist/agent.js +1 -1
  2. package/dist/{chunk-CM2IK7VS.js → chunk-2OU7ZQPD.js} +38 -8
  3. package/dist/chunk-2OU7ZQPD.js.map +1 -0
  4. package/dist/{chunk-OM3YNZIW.js → chunk-4JI4BCBI.js} +5 -360
  5. package/dist/chunk-4JI4BCBI.js.map +1 -0
  6. package/dist/{chunk-NDM5VXZW.js → chunk-7SP2OVYZ.js} +7 -5
  7. package/dist/{chunk-NDM5VXZW.js.map → chunk-7SP2OVYZ.js.map} +1 -1
  8. package/dist/{chunk-RHW75JW5.js → chunk-BERLUBAP.js} +2 -2
  9. package/dist/{chunk-BKAIVNFA.js → chunk-COAVO6QB.js} +3 -3
  10. package/dist/chunk-G3RGMA7C.js +361 -0
  11. package/dist/chunk-G3RGMA7C.js.map +1 -0
  12. package/dist/{chunk-ML4IXGTV.js → chunk-V2K35HF2.js} +2 -2
  13. package/dist/improvement.d.ts +96 -8
  14. package/dist/improvement.js +191 -9
  15. package/dist/improvement.js.map +1 -1
  16. package/dist/index.d.ts +114 -4
  17. package/dist/index.js +144 -18
  18. package/dist/index.js.map +1 -1
  19. package/dist/intelligence.d.ts +423 -0
  20. package/dist/intelligence.js +427 -0
  21. package/dist/intelligence.js.map +1 -0
  22. package/dist/loop-runner-bin.js +4 -3
  23. package/dist/loops.d.ts +2 -1
  24. package/dist/loops.js +3 -1
  25. package/dist/mcp/bin.js +5 -4
  26. package/dist/mcp/bin.js.map +1 -1
  27. package/dist/mcp/index.js +6 -5
  28. package/dist/mcp/index.js.map +1 -1
  29. package/dist/platform.d.ts +120 -62
  30. package/dist/platform.js +68 -26
  31. package/dist/platform.js.map +1 -1
  32. package/dist/runtime.d.ts +47 -8
  33. package/dist/runtime.js +3 -1
  34. package/dist/workflow.js +1 -1
  35. package/package.json +6 -1
  36. package/skills/agent-runtime-adoption/SKILL.md +41 -26
  37. package/skills/build-with-agent-runtime/SKILL.md +143 -0
  38. package/skills/loop-writer/SKILL.md +6 -7
  39. package/dist/chunk-CM2IK7VS.js.map +0 -1
  40. package/dist/chunk-OM3YNZIW.js.map +0 -1
  41. /package/dist/{chunk-RHW75JW5.js.map → chunk-BERLUBAP.js.map} +0 -0
  42. /package/dist/{chunk-BKAIVNFA.js.map → chunk-COAVO6QB.js.map} +0 -0
  43. /package/dist/{chunk-ML4IXGTV.js.map → chunk-V2K35HF2.js.map} +0 -0
package/dist/agent.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7JITYN6T.js";
4
4
  import {
5
5
  createSandboxForSpec
6
- } from "./chunk-CM2IK7VS.js";
6
+ } from "./chunk-2OU7ZQPD.js";
7
7
  import {
8
8
  mapSandboxEvent
9
9
  } from "./chunk-GSUO5QS6.js";
@@ -710,6 +710,17 @@ function readAnalystFindings(settled) {
710
710
  }
711
711
  return out;
712
712
  }
713
+ function registryScopeAnalyst(registry, buildInputs) {
714
+ return {
715
+ async analyze(input) {
716
+ const projection = buildInputs(input);
717
+ const result = await registry.run(projection.runId, projection.inputs, projection.opts);
718
+ const findings = result.findings;
719
+ assertTraceDerivedFindings(findings);
720
+ return findings;
721
+ }
722
+ };
723
+ }
713
724
  function buildSteerContext(findings, settledSoFar) {
714
725
  assertTraceDerivedFindings(findings);
715
726
  const lastValidScore = observedBestScore(settledSoFar);
@@ -1112,15 +1123,24 @@ function inlineSandboxClient(factory) {
1112
1123
  try {
1113
1124
  const artifact = await settle(exec, message, controller.signal);
1114
1125
  const out = artifact.out;
1126
+ const tokensIn = artifact.spent.tokens.input;
1127
+ const tokensOut = artifact.spent.tokens.output;
1128
+ const costUsd = artifact.spent.usd;
1129
+ if (tokensIn || tokensOut || costUsd) {
1130
+ yield {
1131
+ type: "llm_call",
1132
+ data: { tokensIn, tokensOut, costUsd }
1133
+ };
1134
+ }
1115
1135
  yield {
1116
1136
  type: "result",
1117
1137
  data: {
1118
1138
  finalText: out?.content ?? "",
1119
1139
  tokenUsage: {
1120
- inputTokens: artifact.spent.tokens.input,
1121
- outputTokens: artifact.spent.tokens.output
1140
+ inputTokens: tokensIn,
1141
+ outputTokens: tokensOut
1122
1142
  },
1123
- costUsd: artifact.spent.usd
1143
+ costUsd
1124
1144
  }
1125
1145
  };
1126
1146
  } finally {
@@ -2682,6 +2702,7 @@ function loopUntil(seed, spec) {
2682
2702
  async act(task, scope) {
2683
2703
  let state = { round: 0, value: seed };
2684
2704
  const blockers = [];
2705
+ const settledSoFar = [];
2685
2706
  for (; ; ) {
2686
2707
  const label = spec.label ? spec.label(state.round) : `step:${state.round}`;
2687
2708
  const child = ctx.spawnChild(label, ctx.persona.root);
@@ -2695,8 +2716,10 @@ function loopUntil(seed, spec) {
2695
2716
  }
2696
2717
  const settled = await drainOne(scope, label);
2697
2718
  if (settled.kind === "down") blockers.push(blockerFromDown(settled));
2719
+ settledSoFar.push(settled);
2698
2720
  state = spec.fold(state, settled);
2699
- const reached = spec.until(state, []);
2721
+ const findings = ctx.analyst ? await ctx.analyst.analyze({ task, settledSoFar, nodeId: scope.view.root }) : [];
2722
+ const reached = spec.until(state, findings);
2700
2723
  if (reached) return reached;
2701
2724
  state = { round: state.round + 1, value: state.value };
2702
2725
  }
@@ -2808,7 +2831,12 @@ function widen(spec) {
2808
2831
  let widenIndex = 0;
2809
2832
  for (let s = await scope.next(); s !== null; s = await scope.next()) {
2810
2833
  gathered.push(s);
2811
- const decision = spec.gate.decide(s, [], scope.budget);
2834
+ const findings = ctx.analyst ? await ctx.analyst.analyze({
2835
+ task: _task,
2836
+ settledSoFar: gathered,
2837
+ nodeId: scope.view.root
2838
+ }) : [];
2839
+ const decision = spec.gate.decide(s, findings, scope.budget);
2812
2840
  if (decision.kind !== "widen") continue;
2813
2841
  const label = `widen:${widenIndex}`;
2814
2842
  widenIndex += 1;
@@ -4206,10 +4234,11 @@ function definePersona(input) {
4206
4234
  ...input.extensions ? { extensions: input.extensions } : {}
4207
4235
  });
4208
4236
  }
4209
- function createShapeContext(persona, budget) {
4237
+ function createShapeContext(persona, budget, analyst) {
4210
4238
  return {
4211
4239
  persona,
4212
4240
  budget,
4241
+ ...analyst ? { analyst } : {},
4213
4242
  spawnChild(name, spec) {
4214
4243
  const agent = {
4215
4244
  name,
@@ -4235,7 +4264,7 @@ async function runPersonified(options) {
4235
4264
  const { persona } = options;
4236
4265
  const shape = resolveShape(options.shape);
4237
4266
  const shapeBudget = resolveShapeBudget(options.budget, options.shapeBudget);
4238
- const ctx = createShapeContext(persona, shapeBudget);
4267
+ const ctx = createShapeContext(persona, shapeBudget, options.analyst);
4239
4268
  const rootAgent = shape(ctx);
4240
4269
  const executors = personaRegistry(persona);
4241
4270
  const supervisor = createSupervisor();
@@ -6444,6 +6473,7 @@ export {
6444
6473
  deterministicCompletion,
6445
6474
  assertTraceDerivedFindings,
6446
6475
  createScopeAnalyst,
6476
+ registryScopeAnalyst,
6447
6477
  buildSteerContext,
6448
6478
  createDriver,
6449
6479
  renderAnalyses,
@@ -6519,4 +6549,4 @@ export {
6519
6549
  gitWorkspace,
6520
6550
  jjWorkspace
6521
6551
  };
6522
- //# sourceMappingURL=chunk-CM2IK7VS.js.map
6552
+ //# sourceMappingURL=chunk-2OU7ZQPD.js.map