@tangle-network/agent-runtime 0.105.0 → 0.106.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 (218) hide show
  1. package/README.md +2 -2
  2. package/dist/activation-CRjVfOiy.js +203 -0
  3. package/dist/activation-CRjVfOiy.js.map +1 -0
  4. package/dist/activation-DyWB0K6E.d.ts +98 -0
  5. package/dist/agent.d.ts +216 -234
  6. package/dist/agent.js +615 -547
  7. package/dist/agent.js.map +1 -1
  8. package/dist/analyst-loop-DGdtVENg.js +517 -0
  9. package/dist/analyst-loop-DGdtVENg.js.map +1 -0
  10. package/dist/analyst-loop.d.ts +10 -43
  11. package/dist/analyst-loop.js +2 -11
  12. package/dist/backends-CiOCyRHb.js +743 -0
  13. package/dist/backends-CiOCyRHb.js.map +1 -0
  14. package/dist/candidate-execution/index.d.ts +4 -192
  15. package/dist/candidate-execution/index.js +5 -66
  16. package/dist/candidate-execution-DqMbv1rU.js +488 -0
  17. package/dist/candidate-execution-DqMbv1rU.js.map +1 -0
  18. package/dist/coder-yhVWbdWc.js +40 -0
  19. package/dist/coder-yhVWbdWc.js.map +1 -0
  20. package/dist/conversation-BpLQZGPH.js +1265 -0
  21. package/dist/conversation-BpLQZGPH.js.map +1 -0
  22. package/dist/conversation.d.ts +2 -804
  23. package/dist/conversation.js +2 -55
  24. package/dist/environment-provider-CfLUmKmf.js +1168 -0
  25. package/dist/environment-provider-CfLUmKmf.js.map +1 -0
  26. package/dist/environment-provider-IUGU3epE.d.ts +964 -0
  27. package/dist/environment-provider.d.ts +2 -78
  28. package/dist/environment-provider.js +2 -18
  29. package/dist/errors-DEAvWQPy.js +111 -0
  30. package/dist/errors-DEAvWQPy.js.map +1 -0
  31. package/dist/improvement-adapter-Cr5TBSji.d.ts +166 -0
  32. package/dist/improvement-cycle-C095kS_g.js +2624 -0
  33. package/dist/improvement-cycle-C095kS_g.js.map +1 -0
  34. package/dist/index-BGdxAwfO.d.ts +838 -0
  35. package/dist/index-C-FYUuFG.d.ts +193 -0
  36. package/dist/index-CbNM40xG.d.ts +140 -0
  37. package/dist/index-DruSKs3Z.d.ts +7224 -0
  38. package/dist/index-Efjb3nrQ.d.ts +671 -0
  39. package/dist/index.d.ts +14 -1058
  40. package/dist/index.js +2106 -2082
  41. package/dist/index.js.map +1 -1
  42. package/dist/intelligence.d.ts +768 -889
  43. package/dist/intelligence.js +1466 -1367
  44. package/dist/intelligence.js.map +1 -1
  45. package/dist/{kb-gate-CwHO0vz6.d.ts → kb-gate-C8z2juK8.d.ts} +33 -31
  46. package/dist/kb-gate-DpaSwXVx.js +80 -0
  47. package/dist/kb-gate-DpaSwXVx.js.map +1 -0
  48. package/dist/knowledge-Ku-mPP4f.js +433 -0
  49. package/dist/knowledge-Ku-mPP4f.js.map +1 -0
  50. package/dist/knowledge.d.ts +2 -150
  51. package/dist/knowledge.js +2 -40
  52. package/dist/local-harness-Dh8PJ0ot.d.ts +455 -0
  53. package/dist/loop-runner-bin-BXsFEUcf.d.ts +162 -0
  54. package/dist/loop-runner-bin-CRagyuNb.js +268 -0
  55. package/dist/loop-runner-bin-CRagyuNb.js.map +1 -0
  56. package/dist/loop-runner-bin.d.ts +2 -15
  57. package/dist/loop-runner-bin.js +2 -24
  58. package/dist/loops.d.ts +5 -4164
  59. package/dist/loops.js +8 -419
  60. package/dist/mcp/bin.d.ts +1 -1
  61. package/dist/mcp/bin.js +116 -146
  62. package/dist/mcp/bin.js.map +1 -1
  63. package/dist/mcp/index.d.ts +295 -436
  64. package/dist/mcp/index.js +1242 -1177
  65. package/dist/mcp/index.js.map +1 -1
  66. package/dist/mcp/memory-bin.d.ts +1 -1
  67. package/dist/mcp/memory-bin.js +37 -16
  68. package/dist/mcp/memory-bin.js.map +1 -1
  69. package/dist/memory-server-DL6cE2Ag.js +234 -0
  70. package/dist/memory-server-DL6cE2Ag.js.map +1 -0
  71. package/dist/model-resolution-Btd9iIKV.js +98 -0
  72. package/dist/model-resolution-Btd9iIKV.js.map +1 -0
  73. package/dist/openai-tools-B68JaOCx.d.ts +24 -0
  74. package/dist/openai-tools-CKLy1C7M.js +44 -0
  75. package/dist/openai-tools-CKLy1C7M.js.map +1 -0
  76. package/dist/otel-export-D34IQW1C.js +843 -0
  77. package/dist/otel-export-D34IQW1C.js.map +1 -0
  78. package/dist/platform.d.ts +188 -185
  79. package/dist/platform.js +185 -218
  80. package/dist/platform.js.map +1 -1
  81. package/dist/prepare-B53sPV7M.js +4292 -0
  82. package/dist/prepare-B53sPV7M.js.map +1 -0
  83. package/dist/primeintellect/index.d.ts +149 -145
  84. package/dist/primeintellect/index.js +626 -1003
  85. package/dist/primeintellect/index.js.map +1 -1
  86. package/dist/profiles.d.ts +296 -490
  87. package/dist/profiles.js +722 -749
  88. package/dist/profiles.js.map +1 -1
  89. package/dist/protected-model-port-BLPH5VVv.js +722 -0
  90. package/dist/protected-model-port-BLPH5VVv.js.map +1 -0
  91. package/dist/protected-model-port-BP6Z4eau.d.ts +283 -0
  92. package/dist/protected-redaction--F3v1oo8.js +200 -0
  93. package/dist/protected-redaction--F3v1oo8.js.map +1 -0
  94. package/dist/redact-D-u-rrcn.js +82 -0
  95. package/dist/redact-D-u-rrcn.js.map +1 -0
  96. package/dist/redact-kbIOjfjM.d.ts +452 -0
  97. package/dist/researcher-CoVqNhfI.js +433 -0
  98. package/dist/researcher-CoVqNhfI.js.map +1 -0
  99. package/dist/runtime-5zM5XxLr.js +5408 -0
  100. package/dist/runtime-5zM5XxLr.js.map +1 -0
  101. package/dist/sandbox-events-DeI5xX8P.js +316 -0
  102. package/dist/sandbox-events-DeI5xX8P.js.map +1 -0
  103. package/dist/spawn-journal-CwPvKUTa.js +456 -0
  104. package/dist/spawn-journal-CwPvKUTa.js.map +1 -0
  105. package/dist/structural-rollout-IXUEplky.js +1445 -0
  106. package/dist/structural-rollout-IXUEplky.js.map +1 -0
  107. package/dist/substrate-B0TYNrXn.js +27 -0
  108. package/dist/substrate-B0TYNrXn.js.map +1 -0
  109. package/dist/{substrate-Dyiqmd3o.d.ts → substrate-BcnuSHXm.d.ts} +57 -54
  110. package/dist/supervise-BiRutHS9.js +7321 -0
  111. package/dist/supervise-BiRutHS9.js.map +1 -0
  112. package/dist/supervisor-DTKhF-RV.js +3826 -0
  113. package/dist/supervisor-DTKhF-RV.js.map +1 -0
  114. package/dist/testing.d.ts +4 -3
  115. package/dist/testing.js +2478 -2637
  116. package/dist/testing.js.map +1 -1
  117. package/dist/tool-server-RcWgLIsL.js +141 -0
  118. package/dist/tool-server-RcWgLIsL.js.map +1 -0
  119. package/dist/trace-propagation-CJJC7SVB.js +57 -0
  120. package/dist/trace-propagation-CJJC7SVB.js.map +1 -0
  121. package/dist/types-BaIpb0XT.d.ts +492 -0
  122. package/dist/types-BevOjfTY.d.ts +765 -0
  123. package/dist/types-C9j4qg6l.d.ts +500 -0
  124. package/dist/types-Cja5OTGh.d.ts +190 -0
  125. package/dist/util-MVgdwuIS.js +145 -0
  126. package/dist/util-MVgdwuIS.js.map +1 -0
  127. package/dist/workspace-archive-BosQiotA.js +575 -0
  128. package/dist/workspace-archive-BosQiotA.js.map +1 -0
  129. package/package.json +44 -56
  130. package/skills/build-with-agent-runtime/SKILL.md +1 -0
  131. package/dist/activation-Cm-9MMX1.d.ts +0 -69
  132. package/dist/analyst-loop.js.map +0 -1
  133. package/dist/backends-BO4Jqoe2.d.ts +0 -134
  134. package/dist/candidate-execution/index.js.map +0 -1
  135. package/dist/chunk-2KGAN2HM.js +0 -1256
  136. package/dist/chunk-2KGAN2HM.js.map +0 -1
  137. package/dist/chunk-2VZYRB55.js +0 -834
  138. package/dist/chunk-2VZYRB55.js.map +0 -1
  139. package/dist/chunk-3MDZX7YU.js +0 -125
  140. package/dist/chunk-3MDZX7YU.js.map +0 -1
  141. package/dist/chunk-5IBQAPVB.js +0 -29
  142. package/dist/chunk-5IBQAPVB.js.map +0 -1
  143. package/dist/chunk-5QOB7H74.js +0 -387
  144. package/dist/chunk-5QOB7H74.js.map +0 -1
  145. package/dist/chunk-C5RTIBNZ.js +0 -48
  146. package/dist/chunk-C5RTIBNZ.js.map +0 -1
  147. package/dist/chunk-CTRA64LY.js +0 -680
  148. package/dist/chunk-CTRA64LY.js.map +0 -1
  149. package/dist/chunk-DPEUKJRO.js +0 -27
  150. package/dist/chunk-DPEUKJRO.js.map +0 -1
  151. package/dist/chunk-FD2MBMOH.js +0 -494
  152. package/dist/chunk-FD2MBMOH.js.map +0 -1
  153. package/dist/chunk-H5QPIZNX.js +0 -907
  154. package/dist/chunk-H5QPIZNX.js.map +0 -1
  155. package/dist/chunk-HLKC4UYB.js +0 -3514
  156. package/dist/chunk-HLKC4UYB.js.map +0 -1
  157. package/dist/chunk-HNP72PNU.js +0 -192
  158. package/dist/chunk-HNP72PNU.js.map +0 -1
  159. package/dist/chunk-ISPWRSEC.js +0 -408
  160. package/dist/chunk-ISPWRSEC.js.map +0 -1
  161. package/dist/chunk-KRBFHMV6.js +0 -1228
  162. package/dist/chunk-KRBFHMV6.js.map +0 -1
  163. package/dist/chunk-M22PL4GH.js +0 -171
  164. package/dist/chunk-M22PL4GH.js.map +0 -1
  165. package/dist/chunk-NURIQBJQ.js +0 -72
  166. package/dist/chunk-NURIQBJQ.js.map +0 -1
  167. package/dist/chunk-OPVWXJ2H.js +0 -75
  168. package/dist/chunk-OPVWXJ2H.js.map +0 -1
  169. package/dist/chunk-PZZKQVQV.js +0 -52
  170. package/dist/chunk-PZZKQVQV.js.map +0 -1
  171. package/dist/chunk-Q2JSAVQ3.js +0 -671
  172. package/dist/chunk-Q2JSAVQ3.js.map +0 -1
  173. package/dist/chunk-RDOAVVHY.js +0 -699
  174. package/dist/chunk-RDOAVVHY.js.map +0 -1
  175. package/dist/chunk-SGKPNBXE.js +0 -60
  176. package/dist/chunk-SGKPNBXE.js.map +0 -1
  177. package/dist/chunk-SMQXZGLZ.js +0 -351
  178. package/dist/chunk-SMQXZGLZ.js.map +0 -1
  179. package/dist/chunk-UHEZW5BU.js +0 -2918
  180. package/dist/chunk-UHEZW5BU.js.map +0 -1
  181. package/dist/chunk-UPWGXKXB.js +0 -254
  182. package/dist/chunk-UPWGXKXB.js.map +0 -1
  183. package/dist/chunk-VISA6CI3.js +0 -200
  184. package/dist/chunk-VISA6CI3.js.map +0 -1
  185. package/dist/chunk-WMTCUOQL.js +0 -474
  186. package/dist/chunk-WMTCUOQL.js.map +0 -1
  187. package/dist/chunk-WRTOVNN4.js +0 -4728
  188. package/dist/chunk-WRTOVNN4.js.map +0 -1
  189. package/dist/chunk-WSTRQZYQ.js +0 -5576
  190. package/dist/chunk-WSTRQZYQ.js.map +0 -1
  191. package/dist/chunk-XBG2W2VW.js +0 -6434
  192. package/dist/chunk-XBG2W2VW.js.map +0 -1
  193. package/dist/chunk-YEJR7IXO.js +0 -68
  194. package/dist/chunk-YEJR7IXO.js.map +0 -1
  195. package/dist/chunk-YJZA2BIK.js +0 -1338
  196. package/dist/chunk-YJZA2BIK.js.map +0 -1
  197. package/dist/completion-gate-BMy5LGoP.d.ts +0 -256
  198. package/dist/conversation.js.map +0 -1
  199. package/dist/coordination-BZZSVYpZ.d.ts +0 -2570
  200. package/dist/environment-provider.js.map +0 -1
  201. package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
  202. package/dist/knowledge.js.map +0 -1
  203. package/dist/local-harness-BDNcl6jI.d.ts +0 -175
  204. package/dist/loop-runner-bin-68aoM9-7.d.ts +0 -199
  205. package/dist/loop-runner-bin.js.map +0 -1
  206. package/dist/loops.js.map +0 -1
  207. package/dist/openai-tools-fnj6SRVg.d.ts +0 -46
  208. package/dist/protected-model-port-B4t-OQjL.d.ts +0 -271
  209. package/dist/redact-BuFjxBUJ.d.ts +0 -481
  210. package/dist/sanitize-DEbPNtyI.d.ts +0 -328
  211. package/dist/structural-rollout-DEh6CEsa.d.ts +0 -446
  212. package/dist/supervise-4_48wwvy.d.ts +0 -379
  213. package/dist/types-BCoemcXU.d.ts +0 -802
  214. package/dist/types-BwoZWq-i.d.ts +0 -510
  215. package/dist/types-Cbp72qyu.d.ts +0 -491
  216. package/dist/types-CmYCMbFT.d.ts +0 -203
  217. package/dist/types-CvNwMzQt.d.ts +0 -957
  218. package/dist/worktree-fanout-DxhAWr5Z.d.ts +0 -999
package/dist/agent.d.ts CHANGED
@@ -1,13 +1,11 @@
1
- import * as _tangle_network_agent_eval from '@tangle-network/agent-eval';
2
- import { TraceAnalystKindSpec } from '@tangle-network/agent-eval';
3
- import { R as RuntimeStreamEvent } from './types-BwoZWq-i.js';
4
- import { A as AgentSurfaces } from './improvement-adapter-HAZz-7vK.js';
5
- export { C as CreateSurfaceImprovementProposerOptions, D as DraftPatchInput, a as DraftPatchOutput, R as ResolvedSurface, S as SurfaceImprovementEdit, b as SurfaceValidationIssue, c as createSurfaceImprovementProposer, r as renderSurfaceIssues, d as resolveSubjectPath, v as validateSurfaces } from './improvement-adapter-HAZz-7vK.js';
6
- import { AgentProfile, AgentProfileFileMount, AgentProfileMcpServer } from '@tangle-network/agent-interface';
7
- import { SandboxEvent } from '@tangle-network/sandbox';
8
- import { a as SandboxClient, O as OutputAdapter, A as AgentRunSpec } from './types-BCoemcXU.js';
9
- import './types-CmYCMbFT.js';
10
-
1
+ import { x as RuntimeStreamEvent } from "./types-C9j4qg6l.js";
2
+ import { a as createSurfaceImprovementProposer, c as SurfaceValidationIssue, d as validateSurfaces, i as SurfaceImprovementEdit, l as renderSurfaceIssues, n as DraftPatchInput, o as AgentSurfaces, r as DraftPatchOutput, s as ResolvedSurface, t as CreateSurfaceImprovementProposerOptions, u as resolveSubjectPath } from "./improvement-adapter-Cr5TBSji.js";
3
+ import { E as SandboxClient, t as AgentRunSpec, w as OutputAdapter } from "./types-BevOjfTY.js";
4
+ import "./index-DruSKs3Z.js";
5
+ import { TraceAnalystKindSpec } from "@tangle-network/agent-eval";
6
+ import { AgentProfile as AgentProfile$1, AgentProfileFileMount, AgentProfileMcpServer } from "@tangle-network/agent-interface";
7
+ import { SandboxEvent } from "@tangle-network/sandbox";
8
+ //#region src/agent/define-agent.d.ts
11
9
  /**
12
10
  * The full agent manifest. Each agent ships ONE of these.
13
11
  *
@@ -20,145 +18,145 @@ import './types-CmYCMbFT.js';
20
18
  * scorers and emitted into the trace.
21
19
  */
22
20
  interface AgentManifest<TPersona = unknown, TRunOutput = unknown> {
23
- /**
24
- * Stable identifier — used as `projectId` in traces, as the analyst
25
- * loop's `runId` prefix, and as the namespace under which findings
26
- * are persisted. MUST match the agent's repo name to keep
27
- * cross-repo telemetry joinable.
28
- */
29
- id: string;
30
- /**
31
- * Filesystem root the substrate resolves surface paths against.
32
- * Typically `process.cwd()` or a fixed absolute path. Use an
33
- * absolute path when the agent's tests may run from subdirectories
34
- * (vitest sometimes shifts cwd).
35
- */
36
- repoRoot: string;
37
- /**
38
- * Map of mutable surfaces the self-improvement loop can edit. See
39
- * `AgentSurfaces` — required: `systemPrompt`, `tools`, `rubric`,
40
- * `knowledge`, `personas`. Optional: `scaffolding`, `memory`, `rag`,
41
- * `outputSchema`.
42
- *
43
- * Every required path is validated at `defineAgent` time. Missing
44
- * paths throw with the full list of offenders.
45
- */
46
- surfaces: AgentSurfaces;
47
- /**
48
- * Rubric the substrate uses to score each run. Dimensions × weights
49
- * × judges. The substrate computes the weighted composite and
50
- * stamps it into the RunRecord.
51
- */
52
- rubric: AgentRubric<TRunOutput>;
53
- /**
54
- * Runtime adapter — how the substrate INVOKES the agent against a
55
- * persona. The `act` function takes a persona + a context (with the
56
- * tracer the substrate threads through for span emission) and
57
- * returns the run output the rubric will score.
58
- *
59
- * The agent's existing production runtime goes in here; the
60
- * substrate is intentionally thin around it.
61
- */
62
- runtime: AgentRuntime<TPersona, TRunOutput>;
63
- /**
64
- * Persona discovery — the substrate loads personas via this function
65
- * at eval start. Can read from `surfaces.personas`, an API, or be
66
- * hardcoded. The substrate calls it once per `runAgentEval` call;
67
- * persona ordering is preserved.
68
- */
69
- personas: () => Promise<ReadonlyArray<TPersona>>;
70
- /**
71
- * Analyst kinds the substrate runs against each persona's trace.
72
- * Defaults to `DEFAULT_TRACE_ANALYST_KINDS` from agent-eval. Per-agent
73
- * authors can prune (e.g. skip `knowledge-poisoning` when there's no
74
- * knowledge base) or extend (custom domain kinds).
75
- *
76
- * Empty array disables the loop — useful for `pnpm eval --no-analyst`.
77
- */
78
- analystKinds: ReadonlyArray<TraceAnalystKindSpec>;
79
- /**
80
- * Analyst LLM configuration. The substrate uses these for all four
81
- * kinds (override per-kind via `analystKinds` if needed).
82
- */
83
- analyst: AnalystConfig;
21
+ /**
22
+ * Stable identifier — used as `projectId` in traces, as the analyst
23
+ * loop's `runId` prefix, and as the namespace under which findings
24
+ * are persisted. MUST match the agent's repo name to keep
25
+ * cross-repo telemetry joinable.
26
+ */
27
+ id: string;
28
+ /**
29
+ * Filesystem root the substrate resolves surface paths against.
30
+ * Typically `process.cwd()` or a fixed absolute path. Use an
31
+ * absolute path when the agent's tests may run from subdirectories
32
+ * (vitest sometimes shifts cwd).
33
+ */
34
+ repoRoot: string;
35
+ /**
36
+ * Map of mutable surfaces the self-improvement loop can edit. See
37
+ * `AgentSurfaces` — required: `systemPrompt`, `tools`, `rubric`,
38
+ * `knowledge`, `personas`. Optional: `scaffolding`, `memory`, `rag`,
39
+ * `outputSchema`.
40
+ *
41
+ * Every required path is validated at `defineAgent` time. Missing
42
+ * paths throw with the full list of offenders.
43
+ */
44
+ surfaces: AgentSurfaces;
45
+ /**
46
+ * Rubric the substrate uses to score each run. Dimensions × weights
47
+ * × judges. The substrate computes the weighted composite and
48
+ * stamps it into the RunRecord.
49
+ */
50
+ rubric: AgentRubric<TRunOutput>;
51
+ /**
52
+ * Runtime adapter — how the substrate INVOKES the agent against a
53
+ * persona. The `act` function takes a persona + a context (with the
54
+ * tracer the substrate threads through for span emission) and
55
+ * returns the run output the rubric will score.
56
+ *
57
+ * The agent's existing production runtime goes in here; the
58
+ * substrate is intentionally thin around it.
59
+ */
60
+ runtime: AgentRuntime<TPersona, TRunOutput>;
61
+ /**
62
+ * Persona discovery — the substrate loads personas via this function
63
+ * at eval start. Can read from `surfaces.personas`, an API, or be
64
+ * hardcoded. The substrate calls it once per `runAgentEval` call;
65
+ * persona ordering is preserved.
66
+ */
67
+ personas: () => Promise<ReadonlyArray<TPersona>>;
68
+ /**
69
+ * Analyst kinds the substrate runs against each persona's trace.
70
+ * Defaults to `DEFAULT_TRACE_ANALYST_KINDS` from agent-eval. Per-agent
71
+ * authors can prune (e.g. skip `knowledge-poisoning` when there's no
72
+ * knowledge base) or extend (custom domain kinds).
73
+ *
74
+ * Empty array disables the loop — useful for `pnpm eval --no-analyst`.
75
+ */
76
+ analystKinds: ReadonlyArray<TraceAnalystKindSpec>;
77
+ /**
78
+ * Analyst LLM configuration. The substrate uses these for all four
79
+ * kinds (override per-kind via `analystKinds` if needed).
80
+ */
81
+ analyst: AnalystConfig;
84
82
  }
85
83
  interface AgentRubric<TRunOutput> {
86
- /** Dimensions composing the weighted score. Weights sum to 1.0 by convention. */
87
- dimensions: ReadonlyArray<RubricDimension<TRunOutput>>;
88
- /**
89
- * Optional judges layered on top of deterministic dimensions. Each
90
- * judge returns a score per dimension; the substrate averages judges
91
- * (mean by default) for the LLM contribution.
92
- */
93
- judges?: ReadonlyArray<JudgeConfig<TRunOutput>>;
84
+ /** Dimensions composing the weighted score. Weights sum to 1.0 by convention. */
85
+ dimensions: ReadonlyArray<RubricDimension<TRunOutput>>;
86
+ /**
87
+ * Optional judges layered on top of deterministic dimensions. Each
88
+ * judge returns a score per dimension; the substrate averages judges
89
+ * (mean by default) for the LLM contribution.
90
+ */
91
+ judges?: ReadonlyArray<JudgeConfig<TRunOutput>>;
94
92
  }
95
93
  interface RubricDimension<TRunOutput> {
96
- /** Unique identifier — appears in finding subjects (`rubric:<id>`). */
97
- id: string;
98
- /** 0..1 — weight in the composite. */
99
- weight: number;
100
- /**
101
- * Deterministic scorer: given the persona + run output, returns a
102
- * 0..1 score. The substrate sums weight × score across dimensions
103
- * for the deterministic composite; judges supplement subjective dims.
104
- */
105
- score: (input: {
106
- persona: unknown;
107
- output: TRunOutput;
108
- }) => number;
109
- /** Optional human-readable label for reports. */
110
- label?: string;
94
+ /** Unique identifier — appears in finding subjects (`rubric:<id>`). */
95
+ id: string;
96
+ /** 0..1 — weight in the composite. */
97
+ weight: number;
98
+ /**
99
+ * Deterministic scorer: given the persona + run output, returns a
100
+ * 0..1 score. The substrate sums weight × score across dimensions
101
+ * for the deterministic composite; judges supplement subjective dims.
102
+ */
103
+ score: (input: {
104
+ persona: unknown;
105
+ output: TRunOutput;
106
+ }) => number;
107
+ /** Optional human-readable label for reports. */
108
+ label?: string;
111
109
  }
112
110
  interface JudgeConfig<TRunOutput> {
113
- /** Judge identifier — appears in trace spans + manifest. */
114
- id: string;
115
- /** Model snapshot to invoke. Pin the snapshot (`claude-sonnet-4-6@2025-04-15`); the validator rejects bare aliases. */
116
- model: string;
117
- /** Dimensions this judge scores. */
118
- dimensions: ReadonlyArray<string>;
119
- /**
120
- * Optional rubric anchors — text examples the judge sees as a
121
- * few-shot prompt to calibrate. STRONGLY recommended for subjective
122
- * dimensions; required by the calibration gate (Pearson ≥0.7).
123
- */
124
- anchors?: ReadonlyArray<{
125
- input: string;
126
- output: TRunOutput;
127
- expected: Record<string, number>;
128
- }>;
111
+ /** Judge identifier — appears in trace spans + manifest. */
112
+ id: string;
113
+ /** Model snapshot to invoke. Pin the snapshot (`claude-sonnet-4-6@2025-04-15`); the validator rejects bare aliases. */
114
+ model: string;
115
+ /** Dimensions this judge scores. */
116
+ dimensions: ReadonlyArray<string>;
117
+ /**
118
+ * Optional rubric anchors — text examples the judge sees as a
119
+ * few-shot prompt to calibrate. STRONGLY recommended for subjective
120
+ * dimensions; required by the calibration gate (Pearson ≥0.7).
121
+ */
122
+ anchors?: ReadonlyArray<{
123
+ input: string;
124
+ output: TRunOutput;
125
+ expected: Record<string, number>;
126
+ }>;
129
127
  }
130
128
  interface AgentRuntime<TPersona, TRunOutput> {
131
- /**
132
- * Invoke the agent against one persona. Returns BOTH:
133
- * - `events`: an `AsyncIterable<RuntimeStreamEvent>` the chat-centric
134
- * product consumes verbatim (SSE / WebSocket / inline render).
135
- * **Streaming is mandatory — never collapse this to a single Promise.**
136
- * The agent's existing `runChatTurn` (or equivalent async generator)
137
- * plugs in here directly.
138
- * - `output`: a `Promise<TRunOutput>` resolved AFTER the event stream
139
- * drains. The eval substrate awaits this for rubric scoring; chat
140
- * products usually ignore it (they already rendered incrementally).
141
- *
142
- * Implementation contract:
143
- * 1. `act` MUST return immediately (synchronous construction of the
144
- * `events` iterator + the `output` promise).
145
- * 2. Iterating `events` drives the underlying LLM/tool calls — the
146
- * caller chooses when to consume.
147
- * 3. `output` resolves only after the iterator yields its terminal
148
- * event (typically `task_end`); see `collectAgentRun` helper.
149
- *
150
- * `ctx.emitter` is the substrate-threaded `TraceEmitter` — runtimes
151
- * SHOULD record LLM/tool spans through it for capture integrity.
152
- * `ctx.deadlineMs` is wall-clock; the runtime SHOULD honour for graceful
153
- * cancel. `ctx.signal` is the standard abort signal.
154
- */
155
- act: (persona: TPersona, ctx: AgentRunContext) => AgentRunInvocation<TRunOutput>;
129
+ /**
130
+ * Invoke the agent against one persona. Returns BOTH:
131
+ * - `events`: an `AsyncIterable<RuntimeStreamEvent>` the chat-centric
132
+ * product consumes verbatim (SSE / WebSocket / inline render).
133
+ * **Streaming is mandatory — never collapse this to a single Promise.**
134
+ * The agent's existing `runChatTurn` (or equivalent async generator)
135
+ * plugs in here directly.
136
+ * - `output`: a `Promise<TRunOutput>` resolved AFTER the event stream
137
+ * drains. The eval substrate awaits this for rubric scoring; chat
138
+ * products usually ignore it (they already rendered incrementally).
139
+ *
140
+ * Implementation contract:
141
+ * 1. `act` MUST return immediately (synchronous construction of the
142
+ * `events` iterator + the `output` promise).
143
+ * 2. Iterating `events` drives the underlying LLM/tool calls — the
144
+ * caller chooses when to consume.
145
+ * 3. `output` resolves only after the iterator yields its terminal
146
+ * event (typically `task_end`); see `collectAgentRun` helper.
147
+ *
148
+ * `ctx.emitter` is the substrate-threaded `TraceEmitter` — runtimes
149
+ * SHOULD record LLM/tool spans through it for capture integrity.
150
+ * `ctx.deadlineMs` is wall-clock; the runtime SHOULD honour for graceful
151
+ * cancel. `ctx.signal` is the standard abort signal.
152
+ */
153
+ act: (persona: TPersona, ctx: AgentRunContext) => AgentRunInvocation<TRunOutput>;
156
154
  }
157
155
  interface AgentRunInvocation<TRunOutput> {
158
- /** Live stream of typed runtime events. Consumed by chat UX directly. */
159
- events: AsyncIterable<RuntimeStreamEvent>;
160
- /** Final structured output the rubric scores. Resolves after `events` drains. */
161
- output: Promise<TRunOutput>;
156
+ /** Live stream of typed runtime events. Consumed by chat UX directly. */
157
+ events: AsyncIterable<RuntimeStreamEvent>;
158
+ /** Final structured output the rubric scores. Resolves after `events` drains. */
159
+ output: Promise<TRunOutput>;
162
160
  }
163
161
  /**
164
162
  * Stub for agents whose `runtime.act` is not yet wired to the substrate's
@@ -181,38 +179,38 @@ declare function unimplementedAgentRun<TRunOutput = unknown>(reason?: string): A
181
179
  * directly in the chat surface.
182
180
  */
183
181
  declare function collectAgentRun<TRunOutput>(invocation: AgentRunInvocation<TRunOutput>): Promise<{
184
- events: ReadonlyArray<RuntimeStreamEvent>;
185
- output: TRunOutput;
182
+ events: ReadonlyArray<RuntimeStreamEvent>;
183
+ output: TRunOutput;
186
184
  }>;
187
185
  interface AgentRunContext {
188
- /** Substrate-managed trace emitter. */
189
- emitter: _tangle_network_agent_eval.TraceEmitter;
190
- /** Stable run id for this persona × variant cell. */
191
- runId: string;
192
- /** Variant the runtime is exercising (e.g. `'baseline'`, `'source-grounded'`). */
193
- variantId?: string;
194
- /** Wall-clock deadline (epoch ms). The runtime SHOULD honour for graceful cancel. */
195
- deadlineMs?: number;
196
- /** Optional abort signal. */
197
- signal?: AbortSignal;
186
+ /** Substrate-managed trace emitter. */
187
+ emitter: import('@tangle-network/agent-eval').TraceEmitter;
188
+ /** Stable run id for this persona × variant cell. */
189
+ runId: string;
190
+ /** Variant the runtime is exercising (e.g. `'baseline'`, `'source-grounded'`). */
191
+ variantId?: string;
192
+ /** Wall-clock deadline (epoch ms). The runtime SHOULD honour for graceful cancel. */
193
+ deadlineMs?: number;
194
+ /** Optional abort signal. */
195
+ signal?: AbortSignal;
198
196
  }
199
197
  interface AnalystConfig {
200
- /** Model the analyst kinds use. Override per-kind via `analystKinds[i].cost.models`. */
201
- model: string;
202
- /** Optional total budget across all kinds for one run. Substrate enforces via `BudgetGuard`. */
203
- budgetUsd?: number;
204
- /** Backend hint for the AxAIService factory — same shape every kind uses. */
205
- backend?: {
206
- name?: 'openai' | 'router';
207
- apiKey?: string;
208
- baseUrl?: string;
209
- };
198
+ /** Model the analyst kinds use. Override per-kind via `analystKinds[i].cost.models`. */
199
+ model: string;
200
+ /** Optional total budget across all kinds for one run. Substrate enforces via `BudgetGuard`. */
201
+ budgetUsd?: number;
202
+ /** Backend hint for the AxAIService factory — same shape every kind uses. */
203
+ backend?: {
204
+ name?: 'openai' | 'router';
205
+ apiKey?: string;
206
+ baseUrl?: string;
207
+ };
210
208
  }
211
209
  /** Thrown when `defineAgent` finds a required surface missing on disk. */
212
210
  declare class AgentManifestError extends Error {
213
- readonly agentId: string;
214
- readonly issues: ReadonlyArray<unknown>;
215
- constructor(message: string, agentId: string, issues?: ReadonlyArray<unknown>);
211
+ readonly agentId: string;
212
+ readonly issues: ReadonlyArray<unknown>;
213
+ constructor(message: string, agentId: string, issues?: ReadonlyArray<unknown>);
216
214
  }
217
215
  /**
218
216
  * Construct a validated agent manifest. Throws `AgentManifestError`
@@ -228,7 +226,8 @@ declare class AgentManifestError extends Error {
228
226
  * the call site.
229
227
  */
230
228
  declare function defineAgent<TPersona = unknown, TRunOutput = unknown>(manifest: AgentManifest<TPersona, TRunOutput>): AgentManifest<TPersona, TRunOutput>;
231
-
229
+ //#endregion
230
+ //#region src/agent/profile-materialization.d.ts
232
231
  /** Known AgentProfile axes a run path may or may not carry into execution. */
233
232
  declare const AGENT_PROFILE_MATERIALIZATION_AXES: readonly ["identity", "name", "model", "prompt", "systemPrompt", "instructions", "resources", "files", "resourceInstructions", "skills", "resourceTools", "resourceAgents", "commands", "tools", "permissions", "mcp", "mcpConnections", "connections", "subagents", "hooks", "modes", "confidential", "metadata", "extensions"];
234
233
  type KnownAgentProfileMaterializationAxis = (typeof AGENT_PROFILE_MATERIALIZATION_AXES)[number];
@@ -236,32 +235,32 @@ type KnownAgentProfileMaterializationAxis = (typeof AGENT_PROFILE_MATERIALIZATIO
236
235
  type AgentProfileMaterializationAxis = KnownAgentProfileMaterializationAxis | `custom:${string}`;
237
236
  /** Declares which AgentProfile axes a concrete run path really carries. */
238
237
  interface ProfileMaterializationContract {
239
- /** Human-readable run path, e.g. `createSandboxAct` or `prompt-only-message`. */
240
- name: string;
241
- /** Profile axes this run path actually carries into execution. */
242
- axes: readonly AgentProfileMaterializationAxis[];
238
+ /** Human-readable run path, e.g. `createSandboxAct` or `prompt-only-message`. */
239
+ name: string;
240
+ /** Profile axes this run path actually carries into execution. */
241
+ axes: readonly AgentProfileMaterializationAxis[];
243
242
  }
244
243
  /** One changed AgentProfile axis that would be dropped by a run path. */
245
244
  interface ProfileMaterializationIssue {
246
- contract: string;
247
- axis: AgentProfileMaterializationAxis;
248
- reason: 'unsupported-axis';
249
- supportedAxes: readonly AgentProfileMaterializationAxis[];
245
+ contract: string;
246
+ axis: AgentProfileMaterializationAxis;
247
+ reason: 'unsupported-axis';
248
+ supportedAxes: readonly AgentProfileMaterializationAxis[];
250
249
  }
251
250
  /** Input for declaring a run path's profile-axis support. */
252
251
  interface DefineProfileMaterializationContractOptions {
253
- name: string;
254
- axes: readonly AgentProfileMaterializationAxis[];
252
+ name: string;
253
+ axes: readonly AgentProfileMaterializationAxis[];
255
254
  }
256
255
  /** Input for checking a candidate diff against a run path. */
257
256
  interface ValidateProfileMaterializationOptions {
258
- contract: ProfileMaterializationContract;
259
- changedAxes: readonly AgentProfileMaterializationAxis[];
257
+ contract: ProfileMaterializationContract;
258
+ changedAxes: readonly AgentProfileMaterializationAxis[];
260
259
  }
261
260
  /** Input for throwing on dropped profile axes. */
262
261
  interface AssertProfileMaterializationOptions extends ValidateProfileMaterializationOptions {
263
- /** Extra label included in the thrown error, usually the caller or run id. */
264
- context?: string;
262
+ /** Extra label included in the thrown error, usually the caller or run id. */
263
+ context?: string;
265
264
  }
266
265
  /** Materialization contract for `createSandboxAct`, which forwards the full AgentProfile. */
267
266
  declare const sandboxActProfileMaterialization: ProfileMaterializationContract;
@@ -277,64 +276,46 @@ declare function validateProfileMaterialization(options: ValidateProfileMaterial
277
276
  declare function assertProfileMaterialization(options: AssertProfileMaterializationOptions): void;
278
277
  /** Format profile-axis drop issues into a concise operator-facing error. */
279
278
  declare function renderProfileMaterializationIssues(issues: readonly ProfileMaterializationIssue[], context?: string): string;
280
-
281
- /**
282
- * Sandbox bridge for `AgentRuntime.act` — prod-faithful eval execution.
283
- *
284
- * The point of this adapter is parity: the eval substrate must run the agent
285
- * through the SAME profile the production chat turn uses, or scorecard numbers
286
- * grade a profile that never ships. `createSandboxAct` boots a sandbox with the
287
- * agent's profile (the caller's `baseProfile`, with optional per-persona
288
- * overrides) through the loop kernel's own {@link createSandboxForSpec},
289
- * streams the `streamPrompt` events mapped to the `RuntimeStreamEvent`
290
- * vocabulary, and resolves the `OutputAdapter`-parsed output for rubric scoring
291
- * — satisfying the `act` streaming contract with one code path shared by chat
292
- * and eval.
293
- *
294
- * Agents with a bespoke streaming chat turn should wire THAT into `act`
295
- * directly (the contract is designed for it); this adapter is the default for
296
- * agents whose turn is a plain prod-profile sandbox dispatch — notably the
297
- * agents agent-builder generates.
298
- */
299
-
279
+ //#endregion
280
+ //#region src/agent/sandbox-act.d.ts
300
281
  /** Per-persona profile-merge slots applied over the base profile (§1.5: the caller authors the
301
282
  * per-persona profile). Each slot overlays the base; an absent slot leaves the base untouched. */
302
283
  interface SandboxActComposeOverrides {
303
- /** Replace the base profile's system prompt (e.g. a workspace-augmented prompt). */
304
- systemPrompt?: string;
305
- /** Extra file mounts layered after the base profile's `resources.files`. */
306
- extraFiles?: AgentProfileFileMount[];
307
- /** Override the profile `name`. Defaults to the base profile's name. */
308
- name?: string;
309
- /** Box built-in tool ON/OFF flags merged over the base profile's `tools` (overlay wins per key). */
310
- tools?: Record<string, boolean>;
311
- /** MCP connections merged over the base profile's `mcp` (overlay wins per key). */
312
- mcpConnections?: Record<string, AgentProfileMcpServer>;
284
+ /** Replace the base profile's system prompt (e.g. a workspace-augmented prompt). */
285
+ systemPrompt?: string;
286
+ /** Extra file mounts layered after the base profile's `resources.files`. */
287
+ extraFiles?: AgentProfileFileMount[];
288
+ /** Override the profile `name`. Defaults to the base profile's name. */
289
+ name?: string;
290
+ /** Box built-in tool ON/OFF flags merged over the base profile's `tools` (overlay wins per key). */
291
+ tools?: Record<string, boolean>;
292
+ /** MCP connections merged over the base profile's `mcp` (overlay wins per key). */
293
+ mcpConnections?: Record<string, AgentProfileMcpServer>;
313
294
  }
314
295
  interface CreateSandboxActOptions<TPersona, TRunOutput> {
315
- /** Canonical agent profile — the same one the prod chat turn uses. */
316
- baseProfile: AgentProfile;
317
- /** Sandbox client used to boot the per-run sandbox. */
318
- sandboxClient: SandboxClient;
319
- /** Persona → prompt. Pure; the eval cell's input. */
320
- buildPrompt: (persona: TPersona) => string;
321
- /** Sandbox event stream → typed output the rubric scores. */
322
- output: OutputAdapter<TRunOutput>;
323
- /**
324
- * Per-persona profile overrides (workspace-augmented system prompt, extra
325
- * file mounts, tool flags, MCP connections). Overlaid onto `baseProfile`.
326
- */
327
- compose?: (persona: TPersona) => SandboxActComposeOverrides;
328
- /** Sandbox-SDK overrides forwarded to `createSandboxForSpec`. */
329
- sandboxOverrides?: AgentRunSpec<unknown>['sandboxOverrides'];
330
- /** Optional changed axes the caller expects this path to carry. */
331
- requiredProfileAxes?: readonly AgentProfileMaterializationAxis[];
332
- /** Stable run name surfaced in mapped `llm_call` events. */
333
- name?: string;
334
- /** Override the `SandboxEvent → RuntimeStreamEvent` mapper. */
335
- mapEvent?: (event: SandboxEvent, opts: {
336
- agentRunName?: string;
337
- }) => RuntimeStreamEvent | undefined;
296
+ /** Canonical agent profile — the same one the prod chat turn uses. */
297
+ baseProfile: AgentProfile$1;
298
+ /** Sandbox client used to boot the per-run sandbox. */
299
+ sandboxClient: SandboxClient;
300
+ /** Persona → prompt. Pure; the eval cell's input. */
301
+ buildPrompt: (persona: TPersona) => string;
302
+ /** Sandbox event stream → typed output the rubric scores. */
303
+ output: OutputAdapter<TRunOutput>;
304
+ /**
305
+ * Per-persona profile overrides (workspace-augmented system prompt, extra
306
+ * file mounts, tool flags, MCP connections). Overlaid onto `baseProfile`.
307
+ */
308
+ compose?: (persona: TPersona) => SandboxActComposeOverrides;
309
+ /** Sandbox-SDK overrides forwarded to `createSandboxForSpec`. */
310
+ sandboxOverrides?: AgentRunSpec<unknown>['sandboxOverrides'];
311
+ /** Optional changed axes the caller expects this path to carry. */
312
+ requiredProfileAxes?: readonly AgentProfileMaterializationAxis[];
313
+ /** Stable run name surfaced in mapped `llm_call` events. */
314
+ name?: string;
315
+ /** Override the `SandboxEvent → RuntimeStreamEvent` mapper. */
316
+ mapEvent?: (event: SandboxEvent, opts: {
317
+ agentRunName?: string;
318
+ }) => RuntimeStreamEvent | undefined;
338
319
  }
339
320
  /**
340
321
  * Build an `AgentRuntime.act` implementation backed by a single prod-profile
@@ -343,5 +324,6 @@ interface CreateSandboxActOptions<TPersona, TRunOutput> {
343
324
  * resolves only after the iterator drains.
344
325
  */
345
326
  declare function createSandboxAct<TPersona, TRunOutput>(options: CreateSandboxActOptions<TPersona, TRunOutput>): (persona: TPersona, ctx: AgentRunContext) => AgentRunInvocation<TRunOutput>;
346
-
347
- export { AGENT_PROFILE_MATERIALIZATION_AXES, type AgentManifest, AgentManifestError, type AgentProfileMaterializationAxis, type AgentRubric, type AgentRunContext, type AgentRunInvocation, type AgentRuntime, AgentSurfaces, type AnalystConfig, type AssertProfileMaterializationOptions, type CreateSandboxActOptions, type DefineProfileMaterializationContractOptions, type JudgeConfig, type KnownAgentProfileMaterializationAxis, type ProfileMaterializationContract, type ProfileMaterializationIssue, type RubricDimension, type ValidateProfileMaterializationOptions, assertProfileMaterialization, collectAgentRun, createSandboxAct, defineAgent, defineProfileMaterializationContract, promptOnlyProfileMaterialization, promptResourceProfileMaterialization, renderProfileMaterializationIssues, sandboxActProfileMaterialization, unimplementedAgentRun, validateProfileMaterialization };
327
+ //#endregion
328
+ export { AGENT_PROFILE_MATERIALIZATION_AXES, type AgentManifest, AgentManifestError, type AgentProfileMaterializationAxis, type AgentRubric, type AgentRunContext, type AgentRunInvocation, type AgentRuntime, type AgentSurfaces, type AnalystConfig, type AssertProfileMaterializationOptions, type CreateSandboxActOptions, type CreateSurfaceImprovementProposerOptions, type DefineProfileMaterializationContractOptions, type DraftPatchInput, type DraftPatchOutput, type JudgeConfig, type KnownAgentProfileMaterializationAxis, type ProfileMaterializationContract, type ProfileMaterializationIssue, type ResolvedSurface, type RubricDimension, type SandboxActComposeOverrides, type SurfaceImprovementEdit, type SurfaceValidationIssue, type ValidateProfileMaterializationOptions, assertProfileMaterialization, collectAgentRun, createSandboxAct, createSurfaceImprovementProposer, defineAgent, defineProfileMaterializationContract, promptOnlyProfileMaterialization, promptResourceProfileMaterialization, renderProfileMaterializationIssues, renderSurfaceIssues, resolveSubjectPath, sandboxActProfileMaterialization, unimplementedAgentRun, validateProfileMaterialization, validateSurfaces };
329
+ //# sourceMappingURL=agent.d.ts.map