@tangle-network/agent-runtime 0.105.0 → 0.106.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 (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-Dy8NujB4.js +713 -0
  13. package/dist/backends-Dy8NujB4.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-XucG_K3l.js +1265 -0
  21. package/dist/conversation-XucG_K3l.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-BwjQ1NfH.js +268 -0
  55. package/dist/loop-runner-bin-BwjQ1NfH.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-BG0BziaP.js +5408 -0
  100. package/dist/runtime-BG0BziaP.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 +43 -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
@@ -1,78 +1,2 @@
1
- import { AgentProfile, AgentProfileValidationResult } from '@tangle-network/agent-interface';
2
- import { AgentEnvironmentProvider, CreateAgentEnvironmentInput, AgentTurnInput, AgentEnvironmentCapabilities, AgentProfileRef } from '@tangle-network/agent-interface/environment-provider';
3
- export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
4
- import { SandboxClient, CreateSandboxOptions, BackendType } from '@tangle-network/sandbox';
5
- import { R as Runtime, E as ExecutorFactory } from './types-CvNwMzQt.js';
6
- import { a as SandboxClient$1 } from './types-BCoemcXU.js';
7
- import '@tangle-network/agent-eval';
8
- import './types-BwoZWq-i.js';
9
-
10
- interface CreateTangleSandboxExactProcessProviderOptions {
11
- name?: string;
12
- }
13
- /**
14
- * Adapt Tangle Sandbox's managed control runtime to Runtime's exact-process provider.
15
- *
16
- * The adapter deliberately exposes no ordinary agent environment: an exact experiment
17
- * must start a fresh Sandbox with no managed agent and launch its declared argv directly.
18
- */
19
- declare function createTangleSandboxExactProcessProvider(client: SandboxClient, options?: CreateTangleSandboxExactProcessProviderOptions): AgentEnvironmentProvider;
20
-
21
- /** Provider object or registry name accepted by runtime provider adapters.
22
- * @experimental */
23
- type AgentEnvironmentProviderRef = AgentEnvironmentProvider | string;
24
- /** In-memory registry for named `AgentEnvironmentProvider` instances.
25
- * @experimental */
26
- interface AgentEnvironmentProviderRegistry {
27
- register(provider: AgentEnvironmentProvider, options?: {
28
- replace?: boolean;
29
- }): void;
30
- has(name: string): boolean;
31
- get(name: string): AgentEnvironmentProvider | undefined;
32
- require(name: string): AgentEnvironmentProvider;
33
- names(): string[];
34
- providers(): AgentEnvironmentProvider[];
35
- capabilities(name: string): Promise<AgentEnvironmentCapabilities>;
36
- }
37
- /** Create a registry that resolves provider names to concrete provider instances.
38
- * @experimental */
39
- declare function createAgentEnvironmentProviderRegistry(providers?: Iterable<AgentEnvironmentProvider>): AgentEnvironmentProviderRegistry;
40
- /** Resolve a provider instance or registry name, failing loudly when a name is unknown.
41
- * @experimental */
42
- declare function resolveAgentEnvironmentProvider(provider: AgentEnvironmentProviderRef, registry?: AgentEnvironmentProviderRegistry): AgentEnvironmentProvider;
43
- /** Options for exposing an `AgentEnvironmentProvider` through the legacy sandbox client port.
44
- * @experimental */
45
- interface ProviderAsSandboxClientOptions {
46
- defaults?: Partial<CreateAgentEnvironmentInput>;
47
- requireTerminalEvent?: boolean;
48
- mapCreateOptions?: (options: CreateSandboxOptions | undefined) => Partial<CreateAgentEnvironmentInput>;
49
- }
50
- /** Adapt a neutral environment provider to the `SandboxClient` interface used by existing loop paths.
51
- * @experimental */
52
- declare function providerAsSandboxClient(provider: AgentEnvironmentProvider, options?: ProviderAsSandboxClientOptions): SandboxClient$1;
53
- /** Options for wrapping the current Tangle sandbox client as an environment provider.
54
- * @experimental */
55
- interface SandboxClientProviderOptions {
56
- name?: string;
57
- defaultBackend?: BackendType;
58
- capabilities?: AgentEnvironmentCapabilities | (() => AgentEnvironmentCapabilities | Promise<AgentEnvironmentCapabilities>);
59
- validateProfile?: (profile: AgentProfileRef) => AgentProfileValidationResult | Promise<AgentProfileValidationResult>;
60
- mapCreateInput?: (input: CreateAgentEnvironmentInput) => CreateSandboxOptions;
61
- }
62
- /** Adapt a `SandboxClient` into the shared `AgentEnvironmentProvider` contract.
63
- * @experimental */
64
- declare function sandboxClientAsProvider(client: SandboxClient$1, options?: SandboxClientProviderOptions): AgentEnvironmentProvider;
65
- /** Options for running a provider as a supervise-mode executor.
66
- * @experimental */
67
- interface ProviderExecutorOptions {
68
- defaults?: Partial<CreateAgentEnvironmentInput>;
69
- runtime?: Runtime;
70
- destroyOnSettle?: boolean;
71
- requireTerminalEvent?: boolean;
72
- taskToTurn?: (task: unknown, specProfile: AgentProfile) => AgentTurnInput;
73
- }
74
- /** Adapt an environment provider into an `ExecutorFactory` for `createExecutor`.
75
- * @experimental */
76
- declare function providerAsExecutor(provider: AgentEnvironmentProvider, options?: ProviderExecutorOptions): ExecutorFactory<unknown>;
77
-
78
- export { type AgentEnvironmentProviderRef, type AgentEnvironmentProviderRegistry, type CreateTangleSandboxExactProcessProviderOptions, type ProviderAsSandboxClientOptions, type ProviderExecutorOptions, type SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, createTangleSandboxExactProcessProvider, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider };
1
+ import { A as providerAsSandboxClient, C as ProviderAsSandboxClientOptions, D as WorkspaceRequest, E as SandboxClientProviderOptions, F as createTangleSandboxExactProcessProvider, M as sandboxClientAsProvider, N as CreateTangleSandboxExactProcessProviderOptions, O as createAgentEnvironmentProviderRegistry, S as PlacementInfo, T as ResourceRequest, _ as CheckpointRequest, a as AgentEnvironmentProviderRef, b as ExecResult, c as AgentEnvironmentStatus, d as AgentSession, f as AgentSessionRef, g as CheckpointRef, h as AgentTurnResult, i as AgentEnvironmentProvider, j as resolveAgentEnvironmentProvider, k as providerAsExecutor, l as AgentEnvironmentSummary, m as AgentTurnInput, n as AgentEnvironmentCapabilities, o as AgentEnvironmentProviderRegistry, p as AgentSessionStatus, r as AgentEnvironmentEvent, s as AgentEnvironmentQuery, t as AgentEnvironment, u as AgentProfileRef, v as CreateAgentEnvironmentInput, w as ProviderExecutorOptions, x as ForkRequest, y as ExecRequest } from "./environment-provider-IUGU3epE.js";
2
+ export { type AgentEnvironment, type AgentEnvironmentCapabilities, type AgentEnvironmentEvent, type AgentEnvironmentProvider, AgentEnvironmentProviderRef, AgentEnvironmentProviderRegistry, type AgentEnvironmentQuery, type AgentEnvironmentStatus, type AgentEnvironmentSummary, type AgentProfileRef, type AgentSession, type AgentSessionRef, type AgentSessionStatus, type AgentTurnInput, type AgentTurnResult, type CheckpointRef, type CheckpointRequest, type CreateAgentEnvironmentInput, type CreateTangleSandboxExactProcessProviderOptions, type ExecRequest, type ExecResult, type ForkRequest, type PlacementInfo, ProviderAsSandboxClientOptions, ProviderExecutorOptions, type ResourceRequest, SandboxClientProviderOptions, type WorkspaceRequest, createAgentEnvironmentProviderRegistry, createTangleSandboxExactProcessProvider, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider };
@@ -1,18 +1,2 @@
1
- import {
2
- createAgentEnvironmentProviderRegistry,
3
- createTangleSandboxExactProcessProvider,
4
- providerAsExecutor,
5
- providerAsSandboxClient,
6
- resolveAgentEnvironmentProvider,
7
- sandboxClientAsProvider
8
- } from "./chunk-KRBFHMV6.js";
9
- import "./chunk-3MDZX7YU.js";
10
- export {
11
- createAgentEnvironmentProviderRegistry,
12
- createTangleSandboxExactProcessProvider,
13
- providerAsExecutor,
14
- providerAsSandboxClient,
15
- resolveAgentEnvironmentProvider,
16
- sandboxClientAsProvider
17
- };
18
- //# sourceMappingURL=environment-provider.js.map
1
+ import { a as sandboxClientAsProvider, i as resolveAgentEnvironmentProvider, n as providerAsExecutor, o as createTangleSandboxExactProcessProvider, r as providerAsSandboxClient, t as createAgentEnvironmentProviderRegistry } from "./environment-provider-CfLUmKmf.js";
2
+ export { createAgentEnvironmentProviderRegistry, createTangleSandboxExactProcessProvider, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider };
@@ -0,0 +1,111 @@
1
+ import { AgentEvalError, AgentEvalError as AgentEvalError$1, ConfigError, JudgeError, NotFoundError, ValidationError } from "@tangle-network/agent-eval";
2
+ //#region src/errors.ts
3
+ /**
4
+ *
5
+ * Error taxonomy for `@tangle-network/agent-runtime`.
6
+ *
7
+ * Public contract: every error this package throws as part of its consumer-
8
+ * facing API either extends `AgentEvalError` (re-exported here for ergonomic
9
+ * `instanceof` checks at the runtime boundary) or extends one of the
10
+ * runtime-specific subclasses below.
11
+ *
12
+ * Internal invariant guards (`throw new Error('this should never happen')`)
13
+ * remain plain `Error` — they are programmer-mistake assertions, not
14
+ * consumer-catchable contract failures.
15
+ *
16
+ * Subclassing strategy: where a runtime-specific failure maps cleanly to an
17
+ * agent-eval code (validation, config, not_found), we re-use the agent-eval
18
+ * subclass. Runtime-only failure modes (session resume against the wrong
19
+ * backend, backend transport errors) get fresh subclasses that still carry an
20
+ * `AgentEvalErrorCode` so cross-package handlers can pattern-match without
21
+ * importing the runtime.
22
+ *
23
+ * @stable
24
+ */
25
+ /**
26
+ *
27
+ * Caller asked to resume a session against a backend whose `kind` does not
28
+ * match the session's recorded backend. This is a routing bug — the same
29
+ * session id was reused across two different backend implementations — and
30
+ * is not retryable without picking the right backend.
31
+ *
32
+ * @stable
33
+ */
34
+ var SessionMismatchError = class extends AgentEvalError {
35
+ sessionBackend;
36
+ requestedBackend;
37
+ constructor(sessionBackend, requestedBackend, options) {
38
+ super("validation", `Cannot resume ${sessionBackend} session with ${requestedBackend} backend`, options);
39
+ this.sessionBackend = sessionBackend;
40
+ this.requestedBackend = requestedBackend;
41
+ }
42
+ };
43
+ /**
44
+ *
45
+ * A backend transport call (HTTP, gRPC, sidecar IPC) failed with a non-success
46
+ * status. Distinct from `JudgeError` (which is structural / unrecoverable)
47
+ * because backend failures are sometimes retryable and consumers may want to
48
+ * branch on the upstream status code.
49
+ *
50
+ * @stable
51
+ */
52
+ var BackendTransportError = class extends AgentEvalError {
53
+ backend;
54
+ status;
55
+ /**
56
+ * Truncated upstream response body (≤2 KiB) when available. Diagnostic
57
+ * only — surfaces in `backend_error.error.body` and `final.error.body`
58
+ * so operators can see "free_tier_limit", "invalid_api_key", etc. without
59
+ * cracking the log line open.
60
+ */
61
+ body;
62
+ constructor(backend, message, options) {
63
+ super("config", message, options);
64
+ this.backend = backend;
65
+ this.status = options?.status;
66
+ this.body = options?.body;
67
+ }
68
+ };
69
+ /**
70
+ *
71
+ * A runtime-run lifecycle method was called in an order the state machine does
72
+ * not allow: `persist()` before `complete()`, `complete()` twice, etc.
73
+ *
74
+ * @stable
75
+ */
76
+ var RuntimeRunStateError = class extends AgentEvalError {
77
+ constructor(message, options) {
78
+ super("validation", message, options);
79
+ }
80
+ };
81
+ /**
82
+ *
83
+ * The dynamic-loop planner returned an unusable topology move — the LLM emitted
84
+ * no parseable envelope, an unknown `kind`, or a structurally-invalid move
85
+ * (e.g. a fanout with zero tasks). This is a structural failure of the
86
+ * agent-authored topology, not a config mistake: the planner ran but its output
87
+ * cannot drive the kernel. Carries `validation` so cross-package handlers can
88
+ * pattern-match without importing the runtime. Fail loud — never substitute a
89
+ * default move, or the loop silently runs a topology nobody chose.
90
+ *
91
+ * @stable
92
+ */
93
+ var PlannerError = class extends AgentEvalError {
94
+ constructor(message, options) {
95
+ super("validation", message, options);
96
+ }
97
+ };
98
+ /**
99
+ * The analyst loop could not read or run over a round's trace — e.g. an empty round
100
+ * (no iterations to analyze) or a malformed trace projection. Fail loud: a silent empty
101
+ * store would mask a broken capture path and the driver would steer on nothing.
102
+ */
103
+ var AnalystError = class extends AgentEvalError {
104
+ constructor(message, options) {
105
+ super("validation", message, options);
106
+ }
107
+ };
108
+ //#endregion
109
+ export { JudgeError as a, RuntimeRunStateError as c, ConfigError as i, SessionMismatchError as l, AnalystError as n, NotFoundError as o, BackendTransportError as r, PlannerError as s, AgentEvalError$1 as t, ValidationError as u };
110
+
111
+ //# sourceMappingURL=errors-DEAvWQPy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-DEAvWQPy.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/**\n *\n * Error taxonomy for `@tangle-network/agent-runtime`.\n *\n * Public contract: every error this package throws as part of its consumer-\n * facing API either extends `AgentEvalError` (re-exported here for ergonomic\n * `instanceof` checks at the runtime boundary) or extends one of the\n * runtime-specific subclasses below.\n *\n * Internal invariant guards (`throw new Error('this should never happen')`)\n * remain plain `Error` — they are programmer-mistake assertions, not\n * consumer-catchable contract failures.\n *\n * Subclassing strategy: where a runtime-specific failure maps cleanly to an\n * agent-eval code (validation, config, not_found), we re-use the agent-eval\n * subclass. Runtime-only failure modes (session resume against the wrong\n * backend, backend transport errors) get fresh subclasses that still carry an\n * `AgentEvalErrorCode` so cross-package handlers can pattern-match without\n * importing the runtime.\n *\n * @stable\n */\n\nimport { AgentEvalError } from '@tangle-network/agent-eval'\n\nexport {\n AgentEvalError,\n type AgentEvalErrorCode,\n ConfigError,\n JudgeError,\n NotFoundError,\n ValidationError,\n} from '@tangle-network/agent-eval'\n\n/**\n *\n * Caller asked to resume a session against a backend whose `kind` does not\n * match the session's recorded backend. This is a routing bug — the same\n * session id was reused across two different backend implementations — and\n * is not retryable without picking the right backend.\n *\n * @stable\n */\nexport class SessionMismatchError extends AgentEvalError {\n readonly sessionBackend: string\n readonly requestedBackend: string\n\n constructor(sessionBackend: string, requestedBackend: string, options?: { cause?: unknown }) {\n super(\n 'validation',\n `Cannot resume ${sessionBackend} session with ${requestedBackend} backend`,\n options,\n )\n this.sessionBackend = sessionBackend\n this.requestedBackend = requestedBackend\n }\n}\n\n/**\n *\n * A backend transport call (HTTP, gRPC, sidecar IPC) failed with a non-success\n * status. Distinct from `JudgeError` (which is structural / unrecoverable)\n * because backend failures are sometimes retryable and consumers may want to\n * branch on the upstream status code.\n *\n * @stable\n */\nexport class BackendTransportError extends AgentEvalError {\n readonly backend: string\n readonly status?: number\n /**\n * Truncated upstream response body (≤2 KiB) when available. Diagnostic\n * only — surfaces in `backend_error.error.body` and `final.error.body`\n * so operators can see \"free_tier_limit\", \"invalid_api_key\", etc. without\n * cracking the log line open.\n */\n readonly body?: string\n\n constructor(\n backend: string,\n message: string,\n options?: { cause?: unknown; status?: number; body?: string },\n ) {\n super('config', message, options)\n this.backend = backend\n this.status = options?.status\n this.body = options?.body\n }\n}\n\n/**\n *\n * A runtime-run lifecycle method was called in an order the state machine does\n * not allow: `persist()` before `complete()`, `complete()` twice, etc.\n *\n * @stable\n */\nexport class RuntimeRunStateError extends AgentEvalError {\n constructor(message: string, options?: { cause?: unknown }) {\n super('validation', message, options)\n }\n}\n\n/**\n *\n * The dynamic-loop planner returned an unusable topology move — the LLM emitted\n * no parseable envelope, an unknown `kind`, or a structurally-invalid move\n * (e.g. a fanout with zero tasks). This is a structural failure of the\n * agent-authored topology, not a config mistake: the planner ran but its output\n * cannot drive the kernel. Carries `validation` so cross-package handlers can\n * pattern-match without importing the runtime. Fail loud — never substitute a\n * default move, or the loop silently runs a topology nobody chose.\n *\n * @stable\n */\nexport class PlannerError extends AgentEvalError {\n constructor(message: string, options?: { cause?: unknown }) {\n super('validation', message, options)\n }\n}\n\n/**\n * The analyst loop could not read or run over a round's trace — e.g. an empty round\n * (no iterations to analyze) or a malformed trace projection. Fail loud: a silent empty\n * store would mask a broken capture path and the driver would steer on nothing.\n */\nexport class AnalystError extends AgentEvalError {\n constructor(message: string, options?: { cause?: unknown }) {\n super('validation', message, options)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,uBAAb,cAA0C,eAAe;CACvD;CACA;CAEA,YAAY,gBAAwB,kBAA0B,SAA+B;EAC3F,MACE,cACA,iBAAiB,eAAe,gBAAgB,iBAAiB,WACjE,OACF;EACA,KAAK,iBAAiB;EACtB,KAAK,mBAAmB;CAC1B;AACF;;;;;;;;;;AAWA,IAAa,wBAAb,cAA2C,eAAe;CACxD;CACA;;;;;;;CAOA;CAEA,YACE,SACA,SACA,SACA;EACA,MAAM,UAAU,SAAS,OAAO;EAChC,KAAK,UAAU;EACf,KAAK,SAAS,SAAS;EACvB,KAAK,OAAO,SAAS;CACvB;AACF;;;;;;;;AASA,IAAa,uBAAb,cAA0C,eAAe;CACvD,YAAY,SAAiB,SAA+B;EAC1D,MAAM,cAAc,SAAS,OAAO;CACtC;AACF;;;;;;;;;;;;;AAcA,IAAa,eAAb,cAAkC,eAAe;CAC/C,YAAY,SAAiB,SAA+B;EAC1D,MAAM,cAAc,SAAS,OAAO;CACtC;AACF;;;;;;AAOA,IAAa,eAAb,cAAkC,eAAe;CAC/C,YAAY,SAAiB,SAA+B;EAC1D,MAAM,cAAc,SAAS,OAAO;CACtC;AACF"}
@@ -0,0 +1,166 @@
1
+ import { o as ImprovementProposalSource } from "./types-Cja5OTGh.js";
2
+ import { AnalystFinding, FindingSubject } from "@tangle-network/agent-eval";
3
+ //#region src/agent/surfaces.d.ts
4
+ /**
5
+ * Surface declarations. Every path is repo-relative (or absolute) at
6
+ * `defineAgent` time. At resolution time, paths are joined against the
7
+ * agent's `repoRoot`.
8
+ *
9
+ * `systemPrompt`, `tools`, `personas` are DIRECTORIES; the loop appends
10
+ * `<section>.md`, `<tool>/README.md`, `<persona-id>.yaml` etc.
11
+ * `rubric`, `outputSchema` are SINGLE FILES; the loop edits them in
12
+ * place.
13
+ *
14
+ * `knowledge` is the agent-knowledge root (typically `.agent-knowledge`);
15
+ * `applyKnowledgeWriteBlocks` writes pages relative to it.
16
+ *
17
+ * Optional surfaces (`scaffolding`, `memory`, `rag`, `outputSchema`)
18
+ * can be omitted — the loop will reject findings targeting them with a
19
+ * clear log message instead of fabricating a path.
20
+ */
21
+ interface AgentSurfaces {
22
+ /** Directory containing one markdown file per system-prompt section. */
23
+ systemPrompt: string;
24
+ /** Directory containing one subdir per tool (`<tool>/README.md`). */
25
+ tools: string;
26
+ /** Single file (TypeScript module) defining the rubric weights + dimensions. */
27
+ rubric: string;
28
+ /** Knowledge-base root; typically `.agent-knowledge`. */
29
+ knowledge: string;
30
+ /** Directory containing one YAML/JSON file per persona. */
31
+ personas: string;
32
+ /** Optional: directory containing scaffolding rules (precondition checks, retry policies). */
33
+ scaffolding?: string;
34
+ /** Optional: memory store path (JSONL / SQLite / DB). */
35
+ memory?: string;
36
+ /** Optional: directory containing RAG corpora (`<corpus>/<doc-id>.md`). */
37
+ rag?: string;
38
+ /** Optional: single file defining the output schema (Zod / JSON Schema). */
39
+ outputSchema?: string;
40
+ /** Optional: directory containing Agent Skill packages. */
41
+ skills?: string;
42
+ /** Optional: directory containing MCP server/tool configuration. */
43
+ mcp?: string;
44
+ /** Optional: directory containing hook definitions. */
45
+ hooks?: string;
46
+ /** Optional: directory containing subagent definitions. */
47
+ subagents?: string;
48
+ /** Optional: directory containing orchestration/workflow policies. */
49
+ workflows?: string;
50
+ /** Optional: single file containing rollout-policy settings. */
51
+ rolloutPolicy?: string;
52
+ /** Optional: single canonical AgentProfile file. */
53
+ agentProfile?: string;
54
+ /** Optional: source root for code findings. */
55
+ code?: string;
56
+ }
57
+ interface ResolvedSurface {
58
+ /** Absolute filesystem path the operator can `cat` / `vim`. */
59
+ absolutePath: string;
60
+ /** Repo-relative path for PR descriptions, diffs, audit logs. */
61
+ repoRelativePath: string;
62
+ /** Whether the path currently exists on disk. */
63
+ exists: boolean;
64
+ /** The substrate's intent: edit an existing file or create a new one. */
65
+ intent: 'edit-existing' | 'create-new';
66
+ }
67
+ /**
68
+ * Resolve a parsed `FindingSubject` to the file path the substrate
69
+ * should edit (or create) on disk.
70
+ *
71
+ * Returns `null` when:
72
+ * - the subject targets a surface the agent didn't declare
73
+ * (e.g. `rag:*` when `surfaces.rag` is undefined), OR
74
+ * - the subject is a `cluster` (failure-mode emits these as evidence,
75
+ * not actionable mutations — they don't route to a file).
76
+ *
77
+ * Returns a `ResolvedSurface` with `intent: 'create-new'` when the
78
+ * subject names a path that doesn't yet exist (e.g. a new wiki page).
79
+ * The caller chooses whether to honour the create — for tightly-managed
80
+ * surfaces like `systemPrompt` it's usually a contract violation
81
+ * (the analyst named a section that doesn't exist); for `knowledge`
82
+ * it's the whole point.
83
+ */
84
+ declare function resolveSubjectPath(subject: FindingSubject, surfaces: AgentSurfaces, repoRoot: string): ResolvedSurface | null;
85
+ /**
86
+ * Validate that every declared surface exists on disk under `repoRoot`.
87
+ *
88
+ * Returns an array of `SurfaceValidationIssue` — empty when all required
89
+ * surfaces resolve. `defineAgent` throws with the issues rendered, so
90
+ * a misconfigured manifest fails at startup (not at the first finding
91
+ * the loop produces 20 minutes later).
92
+ */
93
+ interface SurfaceValidationIssue {
94
+ surface: keyof AgentSurfaces;
95
+ path: string;
96
+ reason: 'missing' | 'not-directory' | 'not-file';
97
+ }
98
+ /** Validate an `AgentSurfaces` map on disk — missing paths fail loud at `defineAgent` time instead of silently skipping self-improvement edits. */
99
+ declare function validateSurfaces(surfaces: AgentSurfaces, repoRoot: string): ReadonlyArray<SurfaceValidationIssue>;
100
+ /** Format a list of surface validation issues into a human-readable error string. */
101
+ declare function renderSurfaceIssues(issues: ReadonlyArray<SurfaceValidationIssue>, repoRoot: string): string;
102
+ //#endregion
103
+ //#region src/agent/improvement-adapter.d.ts
104
+ interface SurfaceImprovementEdit {
105
+ /** Stable id derived from the source finding so re-proposals are idempotent. */
106
+ id: string;
107
+ /** The finding that produced this edit — for revert + audit trail. */
108
+ sourceFindingId: string;
109
+ /** Parsed subject; included so the apply step doesn't re-parse. */
110
+ subject: FindingSubject;
111
+ /** Resolved on-disk target. */
112
+ target: ResolvedSurface;
113
+ /** SHA-256 of the current file content the patch was drafted against. */
114
+ baseSha256: string;
115
+ /** Unified-diff patch the LLM drafted (relative to `target.absolutePath`). */
116
+ patch: string;
117
+ /** One-line summary the operator sees in the report / PR title. */
118
+ summary: string;
119
+ /** Multi-line rationale for the PR body — finding context + LLM reasoning. */
120
+ rationale: string;
121
+ /** Carry-forward from the finding so the apply gate can check the threshold. */
122
+ confidence: number;
123
+ /** Carry-forward severity for prioritization. */
124
+ severity: AnalystFinding['severity'];
125
+ }
126
+ interface CreateSurfaceImprovementProposerOptions {
127
+ surfaces: AgentSurfaces;
128
+ repoRoot: string;
129
+ /**
130
+ * LLM-draft callback. Given a finding + current file content + the
131
+ * resolved target, returns a unified-diff patch + summary + rationale.
132
+ *
133
+ * Required — the substrate doesn't ship a hardcoded prompt; the agent
134
+ * author picks the model (Haiku for cheap routine drafts, Sonnet for
135
+ * substantive prompt rewrites, etc.) via this callback.
136
+ */
137
+ draftPatch: (input: DraftPatchInput) => Promise<DraftPatchOutput>;
138
+ /**
139
+ * When the resolved target doesn't exist, allow the substrate to
140
+ * CREATE the file (for `knowledge.wiki`, `new-tool` subjects). Default
141
+ * true for those kinds, false for `system-prompt` / `rubric` / etc.
142
+ * (named sections that don't exist are a contract violation, not a
143
+ * scaffolding opportunity).
144
+ */
145
+ allowCreateForKinds?: ReadonlyArray<FindingSubject['kind']>;
146
+ }
147
+ interface DraftPatchInput {
148
+ finding: AnalystFinding;
149
+ subject: FindingSubject;
150
+ target: ResolvedSurface;
151
+ /** Current file content (empty string when `intent === 'create-new'`). */
152
+ currentContent: string;
153
+ }
154
+ interface DraftPatchOutput {
155
+ /** Unified diff against the current file content. Empty string skips this finding. */
156
+ patch: string;
157
+ /** One-line summary for the operator. */
158
+ summary: string;
159
+ /** Multi-line rationale for the PR body. */
160
+ rationale: string;
161
+ }
162
+ /** Resolve each finding to a real surface and draft a detached patch candidate. */
163
+ declare function createSurfaceImprovementProposer(opts: CreateSurfaceImprovementProposerOptions): ImprovementProposalSource<SurfaceImprovementEdit>;
164
+ //#endregion
165
+ export { createSurfaceImprovementProposer as a, SurfaceValidationIssue as c, validateSurfaces as d, SurfaceImprovementEdit as i, renderSurfaceIssues as l, DraftPatchInput as n, AgentSurfaces as o, DraftPatchOutput as r, ResolvedSurface as s, CreateSurfaceImprovementProposerOptions as t, resolveSubjectPath as u };
166
+ //# sourceMappingURL=improvement-adapter-Cr5TBSji.d.ts.map