@tangle-network/agent-runtime 0.90.1 → 0.92.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 (86) hide show
  1. package/README.md +4 -2
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +88 -9
  4. package/dist/agent.js.map +1 -1
  5. package/dist/{mcp-serve-verifier-XsX8rkB9.d.ts → agentic-generator-B8oeE2Yv.d.ts} +6 -33
  6. package/dist/analyst-loop.d.ts +1 -1
  7. package/dist/candidate-execution/index.d.ts +104 -0
  8. package/dist/candidate-execution/index.js +34 -0
  9. package/dist/candidate-execution/index.js.map +1 -0
  10. package/dist/chunk-3BE7KTMU.js +1229 -0
  11. package/dist/chunk-3BE7KTMU.js.map +1 -0
  12. package/dist/chunk-3D2RHC4K.js +73 -0
  13. package/dist/chunk-3D2RHC4K.js.map +1 -0
  14. package/dist/chunk-3MDZX7YU.js +125 -0
  15. package/dist/chunk-3MDZX7YU.js.map +1 -0
  16. package/dist/{chunk-RYBVU4M3.js → chunk-6O5USWVH.js} +32 -1413
  17. package/dist/chunk-6O5USWVH.js.map +1 -0
  18. package/dist/chunk-6O73TRHW.js +142 -0
  19. package/dist/chunk-6O73TRHW.js.map +1 -0
  20. package/dist/{chunk-R2VAJGR3.js → chunk-7VJJJ2T2.js} +2 -2
  21. package/dist/chunk-A62TP7SK.js +4784 -0
  22. package/dist/chunk-A62TP7SK.js.map +1 -0
  23. package/dist/chunk-APVPRF4Y.js +2166 -0
  24. package/dist/chunk-APVPRF4Y.js.map +1 -0
  25. package/dist/{chunk-QK4DV5PR.js → chunk-AUEIDTR3.js} +2 -2
  26. package/dist/{chunk-OOL3675H.js → chunk-FRBHUNQ7.js} +2 -139
  27. package/dist/chunk-FRBHUNQ7.js.map +1 -0
  28. package/dist/{chunk-7ON74BQO.js → chunk-GDAQUFG6.js} +2 -2
  29. package/dist/{chunk-ZV4LXYCJ.js → chunk-I7WVPJBZ.js} +23 -1231
  30. package/dist/chunk-I7WVPJBZ.js.map +1 -0
  31. package/dist/{chunk-WRUSWK4F.js → chunk-IGGZGKJD.js} +3 -3
  32. package/dist/chunk-PH65PR4F.js +860 -0
  33. package/dist/chunk-PH65PR4F.js.map +1 -0
  34. package/dist/chunk-RSWM2ZKM.js +659 -0
  35. package/dist/chunk-RSWM2ZKM.js.map +1 -0
  36. package/dist/{chunk-BZF3KQ6G.js → chunk-VSWBYWFK.js} +4 -122
  37. package/dist/chunk-VSWBYWFK.js.map +1 -0
  38. package/dist/{completion-gate-DkAnUmpb.d.ts → completion-gate-BLaiN0-X.d.ts} +1 -1
  39. package/dist/{coordination-rRj5hjJK.d.ts → coordination-DxJ83oZA.d.ts} +12 -5
  40. package/dist/environment-provider.d.ts +2 -2
  41. package/dist/environment-provider.js +2 -1
  42. package/dist/improve-CUVCq7xg.d.ts +152 -0
  43. package/dist/{improvement-adapter-CDR8QNVM.d.ts → improvement-adapter-BieWeK5J.d.ts} +16 -0
  44. package/dist/index.d.ts +27 -291
  45. package/dist/index.js +70 -889
  46. package/dist/index.js.map +1 -1
  47. package/dist/intelligence.d.ts +160 -13
  48. package/dist/intelligence.js +535 -59
  49. package/dist/intelligence.js.map +1 -1
  50. package/dist/knowledge.d.ts +6 -6
  51. package/dist/knowledge.js +6 -4
  52. package/dist/lifecycle.d.ts +2 -1
  53. package/dist/lifecycle.js +5 -3
  54. package/dist/lifecycle.js.map +1 -1
  55. package/dist/{loop-runner-bin-DTbZVGfM.d.ts → loop-runner-bin-kKUNGLyV.d.ts} +2 -2
  56. package/dist/loop-runner-bin.d.ts +5 -5
  57. package/dist/loop-runner-bin.js +8 -5
  58. package/dist/loops.d.ts +16 -16
  59. package/dist/loops.js +47 -41
  60. package/dist/mcp/bin.js +6 -4
  61. package/dist/mcp/bin.js.map +1 -1
  62. package/dist/mcp/index.d.ts +8 -8
  63. package/dist/mcp/index.js +9 -6
  64. package/dist/mcp/index.js.map +1 -1
  65. package/dist/mcp-serve-verifier-Bg4C3p5S.d.ts +34 -0
  66. package/dist/{openai-tools-C4ZfUD4L.d.ts → openai-tools-E3woykz9.d.ts} +1 -1
  67. package/dist/prepare-Z08a4heC.d.ts +713 -0
  68. package/dist/profiles.d.ts +1 -1
  69. package/dist/{router-client-DJImUDlm.d.ts → sanitize-C9go6tXj.d.ts} +113 -1
  70. package/dist/{structural-rollout-MwlpgQ-6.d.ts → structural-rollout-DHGDbhvR.d.ts} +3 -3
  71. package/dist/{supervise-DPmYPk0j.d.ts → supervise-T2pazU3G.d.ts} +4 -4
  72. package/dist/{types-SyuwunY_.d.ts → types-B00NtbCs.d.ts} +1 -1
  73. package/dist/{types-eMNgWgFi.d.ts → types-DAdIm4AC.d.ts} +1 -1
  74. package/dist/{worktree-fanout-BDFQIO-Y.d.ts → worktree-fanout-BUb2Ag02.d.ts} +3 -3
  75. package/package.json +26 -36
  76. package/skills/build-with-agent-runtime/SKILL.md +1 -1
  77. package/dist/chunk-BZF3KQ6G.js.map +0 -1
  78. package/dist/chunk-IVGYLCFH.js +0 -381
  79. package/dist/chunk-IVGYLCFH.js.map +0 -1
  80. package/dist/chunk-OOL3675H.js.map +0 -1
  81. package/dist/chunk-RYBVU4M3.js.map +0 -1
  82. package/dist/chunk-ZV4LXYCJ.js.map +0 -1
  83. /package/dist/{chunk-R2VAJGR3.js.map → chunk-7VJJJ2T2.js.map} +0 -0
  84. /package/dist/{chunk-QK4DV5PR.js.map → chunk-AUEIDTR3.js.map} +0 -0
  85. /package/dist/{chunk-7ON74BQO.js.map → chunk-GDAQUFG6.js.map} +0 -0
  86. /package/dist/{chunk-WRUSWK4F.js.map → chunk-IGGZGKJD.js.map} +0 -0
@@ -65,8 +65,12 @@ interface ImprovementDriverOptions {
65
65
  /** Base ref candidate worktrees fork from. Default `main`. */
66
66
  baseRef?: string;
67
67
  }
68
+ interface ManagedImprovementDriver extends SurfaceProposer<AnalystFinding> {
69
+ /** Remove every finalized candidate except explicitly retained winners. */
70
+ cleanup(retainWorktreeRefs?: readonly string[]): Promise<void>;
71
+ }
68
72
  /** The one reflective/agentic improvement proposer (`SurfaceProposer`): owns the candidate worktree lifecycle and delegates HOW a change is produced to a pluggable `CandidateGenerator`. */
69
- declare function improvementDriver(opts: ImprovementDriverOptions): SurfaceProposer<AnalystFinding>;
73
+ declare function improvementDriver(opts: ImprovementDriverOptions): ManagedImprovementDriver;
70
74
 
71
75
  /**
72
76
  *
@@ -144,35 +148,4 @@ declare function agenticGenerator(opts?: AgenticGeneratorOptions): CandidateGene
144
148
  * silent fallback). */
145
149
  declare function commandVerifier(command: string, args?: string[], timeoutMs?: number): Verifier;
146
150
 
147
- /**
148
- * `mcpServeVerifier` — the intrinsic verifier for a built MCP server: the
149
- * boot-and-probe checker named in docs/artifact-lifecycle-frontier.md. A
150
- * generated MCP server is only a candidate if it actually *serves* — so this
151
- * boots it over stdio (the default local MCP transport) and runs the real
152
- * handshake: `initialize` → `notifications/initialized` → `tools/list`, and
153
- * asserts the server answers with at least `minTools` tools.
154
- *
155
- * Outcomes follow the `Verifier` contract: a server that fails to start, exits
156
- * early, errors the handshake, times out, or exposes no tools is a FAILED
157
- * candidate (`{ok:false}`, fed back into the next generation shot); a missing
158
- * start binary or spawn fault THROWS (a setup bug, never a silent fallback).
159
- *
160
- * Protocol matches the runtime's own stdio MCP server (src/mcp/server.ts):
161
- * newline-delimited JSON-RPC 2.0, protocol version 2024-11-05.
162
- */
163
-
164
- interface McpServeSpec {
165
- /** Command that starts the built MCP server in the worktree (stdio transport). */
166
- command: string;
167
- args?: string[];
168
- /** Extra env for the server process (merged over `process.env`). */
169
- env?: Record<string, string>;
170
- /** Handshake timeout (ms). Default 30s. */
171
- timeoutMs?: number;
172
- /** Minimum tools the server must expose to pass. Default 1. */
173
- minTools?: number;
174
- }
175
- /** Build a `Verifier` that boots a generated MCP server over stdio and checks it exposes tools. */
176
- declare function mcpServeVerifier(spec: McpServeSpec): Verifier;
177
-
178
- export { type AgenticGeneratorOptions as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type McpServeSpec as M, type Verifier as V, type VerifyResult as a, agenticGenerator as b, commandVerifier as c, improvementDriver as i, mcpServeVerifier as m };
151
+ export { type AgenticGeneratorOptions as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type VerifyResult as a, agenticGenerator as b, commandVerifier as c, improvementDriver as i };
@@ -1,5 +1,5 @@
1
1
  import { TraceAnalystByteBudgets, TraceAnalysisStore } from '@tangle-network/agent-eval';
2
- import { I as Iteration } from './types-SyuwunY_.js';
2
+ import { I as Iteration } from './types-B00NtbCs.js';
3
3
  import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
4
4
  export { A as AnalystLoopEvent, b as AnalystRegistryLike, c as AnalystRegistryStreamingLike, d as AutoApplyPolicy, F as FindingsStoreLike, I as ImprovementAdapter, e as ImprovementEditBatch, f as ImprovementReport, K as KnowledgeAdapter, g as KnowledgeProposalBatch, h as KnowledgeReport } from './types-BC3bZpH0.js';
5
5
  import '@tangle-network/sandbox';
@@ -0,0 +1,104 @@
1
+ import { $ as PreparedAgentCandidateExecution, i as AgentCandidateExecutionClaim, k as AgentCandidateExecutionClaimStore, j as AgentCandidateExecutionClaimResult, h as AgentCandidateExecutionAttemptRef, g as AgentCandidateExecutionAttemptRecord, o as AgentCandidateExecutionLease, q as AgentCandidateExecutionPhaseResult, u as AgentCandidateExecutionTerminalResult, s as AgentCandidateExecutionStageResult, n as AgentCandidateExecutionFinishResult, r as AgentCandidateExecutionRecoveryEvidence, L as AgentCandidateOutputArtifactPort, M as AgentCandidateOutputPurpose, K as AgentCandidateModelPort, Q as AgentCandidateProtectedModelReservation, N as AgentCandidateProtectedModelActivation, R as AgentCandidateProtectedModelSettlement, y as AgentCandidateExecutorPort, a as AgentCandidateExecutionPorts, V as AgentCandidateVerificationPorts, a4 as VerifiedAgentCandidate } from '../prepare-Z08a4heC.js';
2
+ export { c as AgentCandidateArtifactPort, d as AgentCandidateBenchmarkGraderIdentity, e as AgentCandidateBenchmarkGraderPort, f as AgentCandidateContainerPort, l as AgentCandidateExecutionCleanupHandles, m as AgentCandidateExecutionFailureClass, p as AgentCandidateExecutionPhase, t as AgentCandidateExecutionTerminalRecord, v as AgentCandidateExecutionUsage, w as AgentCandidateExecutorFinalCapture, x as AgentCandidateExecutorMemoryCapture, z as AgentCandidateExecutorProfileFile, B as AgentCandidateExecutorRequest, C as AgentCandidateExecutorStopRequest, D as AgentCandidateExecutorTaskOutcomeCapture, F as AgentCandidateExecutorWorkspaceFile, G as AgentCandidateExecutorWorkspaceInput, H as AgentCandidateMemoryPort, I as AgentCandidateMemoryResetResult, J as AgentCandidateModelLimits, O as AgentCandidateProtectedModelCall, S as AgentCandidateProtectedRunCapture, T as AgentCandidateRepositoryPort, U as AgentCandidateRetryRejection, b as AgentCandidateRunFinalization, A as AgentCandidateTaskExecution, W as AgentCandidateWorkspacePort, X as CANDIDATE_TRACE_ENV, Y as CANDIDATE_TRACE_TAGS, Z as CanonicalCandidateDocument, E as ExecutePreparedAgentCandidateOptions, _ as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, a0 as PreparedAgentCandidateInstruction, a1 as PreparedAgentCandidateLaunch, a2 as PreparedAgentCandidateTrace, a3 as ResolvedAgentCandidateContainer, a5 as VerifiedAgentCandidateTaskOutcome, a6 as executePreparedAgentCandidate, a7 as prepareAgentCandidateExecution } from '../prepare-Z08a4heC.js';
3
+ import { Sha256Digest, AgentCandidateArtifactRef } from '@tangle-network/agent-interface';
4
+ import { TraceStore } from '@tangle-network/agent-eval';
5
+
6
+ /** Extract the complete durable claim from a prepared execution. */
7
+ declare function candidateExecutionClaim(prepared: PreparedAgentCandidateExecution): AgentCandidateExecutionClaim;
8
+
9
+ interface FileAgentCandidateExecutionClaimStoreOptions {
10
+ /** Evaluator-owned directory shared by every process allowed to execute candidates. */
11
+ directory: string;
12
+ /** Testable evaluator clock; defaults to `Date.now`. */
13
+ now?: () => number;
14
+ }
15
+ /** Cross-process lifecycle implemented as fsynced, create-if-absent records. */
16
+ declare class FileAgentCandidateExecutionClaimStore implements AgentCandidateExecutionClaimStore {
17
+ private readonly directory;
18
+ private readonly now;
19
+ constructor(options: FileAgentCandidateExecutionClaimStoreOptions);
20
+ tryClaim(requested: AgentCandidateExecutionClaim): Promise<AgentCandidateExecutionClaimResult>;
21
+ getAttempt(requestedAttempt: AgentCandidateExecutionAttemptRef): Promise<AgentCandidateExecutionAttemptRecord | undefined>;
22
+ markCandidateMayRun(requestedLease: AgentCandidateExecutionLease): Promise<AgentCandidateExecutionPhaseResult>;
23
+ stageTerminal(requestedLease: AgentCandidateExecutionLease, result: AgentCandidateExecutionTerminalResult): Promise<AgentCandidateExecutionStageResult>;
24
+ finish(requestedLease: AgentCandidateExecutionLease, requestedTerminalDigest: Sha256Digest): Promise<AgentCandidateExecutionFinishResult>;
25
+ recoverExpired(requestedAttempt: AgentCandidateExecutionAttemptRef, evidence: AgentCandidateExecutionRecoveryEvidence): Promise<AgentCandidateExecutionFinishResult>;
26
+ private storedAttempt;
27
+ private transitionState;
28
+ private retryFailure;
29
+ private ownerPublication;
30
+ private claimPath;
31
+ private terminalPath;
32
+ private transitionPath;
33
+ }
34
+
35
+ interface DisposePreparedAgentCandidateOptions {
36
+ cleanupTimeoutMs?: number;
37
+ }
38
+ /** Revoke reservations held by a prepared candidate that will not be executed. */
39
+ declare function disposePreparedAgentCandidateExecution(prepared: PreparedAgentCandidateExecution, options?: DisposePreparedAgentCandidateOptions): Promise<{
40
+ disposed: true;
41
+ }>;
42
+
43
+ /** Persist evaluator evidence, read it back, and bind the returned locator to the exact bytes. */
44
+ declare function persistCandidateOutputArtifact(port: AgentCandidateOutputArtifactPort, input: {
45
+ executionId: string;
46
+ purpose: AgentCandidateOutputPurpose;
47
+ bytes: Uint8Array;
48
+ signal?: AbortSignal;
49
+ }): Promise<AgentCandidateArtifactRef>;
50
+
51
+ type AgentCandidateModelGrantReserveInput = Parameters<AgentCandidateModelPort['reserveGrant']>[0];
52
+ type AgentCandidateModelGrantActivateInput = Parameters<AgentCandidateModelPort['activateGrant']>[0];
53
+ type AgentCandidateModelGrantSettleInput = Parameters<AgentCandidateModelPort['settleGrant']>[0];
54
+ /** Secret-free response from the service's reservation endpoint. */
55
+ type AgentCandidateModelGrantReservation = AgentCandidateProtectedModelReservation;
56
+ /**
57
+ * Narrow transport contract for a service that owns scoped model credentials
58
+ * and the authoritative per-call usage ledger.
59
+ *
60
+ * An HTTP client can bind these methods to control-plane endpoints. Keeping
61
+ * transport out of the runtime prevents parent credentials, endpoint paths,
62
+ * and retry policy from becoming part of the portable candidate contract.
63
+ */
64
+ interface AgentCandidateModelGrantClient {
65
+ reserve(input: AgentCandidateModelGrantReserveInput): Promise<AgentCandidateModelGrantReservation>;
66
+ activate(input: AgentCandidateModelGrantActivateInput): Promise<AgentCandidateProtectedModelActivation>;
67
+ settle(input: AgentCandidateModelGrantSettleInput): Promise<AgentCandidateProtectedModelSettlement>;
68
+ }
69
+ interface CreateProtectedAgentCandidateModelPortOptions {
70
+ client: AgentCandidateModelGrantClient;
71
+ /** Catalog/snapshot resolution stays separate from credential issuance. */
72
+ resolveModel: AgentCandidateModelPort['resolve'];
73
+ /** The only public DNS name candidate processes may reach for inference. */
74
+ gatewayDomain: string;
75
+ /** Exact environment names the activation endpoint must return, no more or fewer. */
76
+ activationEnvNames: readonly string[];
77
+ }
78
+ /**
79
+ * Bind a protected model-grant service to the immutable candidate runtime.
80
+ *
81
+ * The service remains the authority for expiry, admission, revocation, and
82
+ * metering. This adapter independently checks every response before allowing
83
+ * it to cross into candidate execution or durable receipt finalization.
84
+ */
85
+ declare function createProtectedAgentCandidateModelPort(options: CreateProtectedAgentCandidateModelPortOptions): AgentCandidateModelPort;
86
+
87
+ interface RecoverExpiredAgentCandidateOptions {
88
+ attempt: AgentCandidateExecutionAttemptRef;
89
+ claimStore: AgentCandidateExecutionClaimStore;
90
+ executor: AgentCandidateExecutorPort;
91
+ traceStore: TraceStore;
92
+ ports: Pick<AgentCandidateExecutionPorts, 'models' | 'memory'>;
93
+ outputArtifacts: AgentCandidateOutputArtifactPort;
94
+ cleanupTimeoutMs?: number;
95
+ /** Evaluator clock; must be the same clock used by the claim store. */
96
+ now?: () => number;
97
+ }
98
+ /** Close an expired crashed attempt from persisted non-secret handles, then record failure. */
99
+ declare function recoverExpiredAgentCandidateExecution(options: RecoverExpiredAgentCandidateOptions): Promise<AgentCandidateExecutionFinishResult>;
100
+
101
+ /** Verifies every digest, resource, workspace, and Git object in a candidate bundle. */
102
+ declare function verifyAgentCandidateBundle(input: unknown, ports: AgentCandidateVerificationPorts): Promise<VerifiedAgentCandidate>;
103
+
104
+ export { AgentCandidateExecutionAttemptRecord, AgentCandidateExecutionAttemptRef, AgentCandidateExecutionClaim, AgentCandidateExecutionClaimResult, AgentCandidateExecutionClaimStore, AgentCandidateExecutionFinishResult, AgentCandidateExecutionLease, AgentCandidateExecutionPhaseResult, AgentCandidateExecutionPorts, AgentCandidateExecutionRecoveryEvidence, AgentCandidateExecutionStageResult, AgentCandidateExecutionTerminalResult, AgentCandidateExecutorPort, type AgentCandidateModelGrantActivateInput, type AgentCandidateModelGrantClient, type AgentCandidateModelGrantReservation, type AgentCandidateModelGrantReserveInput, type AgentCandidateModelGrantSettleInput, AgentCandidateModelPort, AgentCandidateOutputArtifactPort, AgentCandidateOutputPurpose, AgentCandidateProtectedModelActivation, AgentCandidateProtectedModelReservation, AgentCandidateProtectedModelSettlement, AgentCandidateVerificationPorts, type CreateProtectedAgentCandidateModelPortOptions, type DisposePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, type FileAgentCandidateExecutionClaimStoreOptions, PreparedAgentCandidateExecution, type RecoverExpiredAgentCandidateOptions, VerifiedAgentCandidate, candidateExecutionClaim, createProtectedAgentCandidateModelPort, disposePreparedAgentCandidateExecution, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, verifyAgentCandidateBundle };
@@ -0,0 +1,34 @@
1
+ import {
2
+ FileAgentCandidateExecutionClaimStore,
3
+ createProtectedAgentCandidateModelPort,
4
+ disposePreparedAgentCandidateExecution,
5
+ recoverExpiredAgentCandidateExecution
6
+ } from "../chunk-PH65PR4F.js";
7
+ import {
8
+ CANDIDATE_TRACE_ENV,
9
+ CANDIDATE_TRACE_TAGS,
10
+ InMemoryAgentCandidateExecutionClaimStore,
11
+ candidateExecutionClaim,
12
+ executePreparedAgentCandidate,
13
+ persistCandidateOutputArtifact,
14
+ prepareAgentCandidateExecution,
15
+ verifyAgentCandidateBundle
16
+ } from "../chunk-A62TP7SK.js";
17
+ import "../chunk-3D2RHC4K.js";
18
+ import "../chunk-3MDZX7YU.js";
19
+ import "../chunk-DGUM43GV.js";
20
+ export {
21
+ CANDIDATE_TRACE_ENV,
22
+ CANDIDATE_TRACE_TAGS,
23
+ FileAgentCandidateExecutionClaimStore,
24
+ InMemoryAgentCandidateExecutionClaimStore,
25
+ candidateExecutionClaim,
26
+ createProtectedAgentCandidateModelPort,
27
+ disposePreparedAgentCandidateExecution,
28
+ executePreparedAgentCandidate,
29
+ persistCandidateOutputArtifact,
30
+ prepareAgentCandidateExecution,
31
+ recoverExpiredAgentCandidateExecution,
32
+ verifyAgentCandidateBundle
33
+ };
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}