@tangle-network/agent-runtime 0.94.12 → 0.95.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.
- package/dist/agent.d.ts +2 -25
- package/dist/agent.js +9 -12
- package/dist/agent.js.map +1 -1
- package/dist/{agentic-generator-DDMM45kZ.d.ts → agentic-generator-hCaQRAes.d.ts} +0 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/candidate-execution/index.d.ts +43 -16
- package/dist/candidate-execution/index.js +18 -8
- package/dist/{chunk-VYA2YEKA.js → chunk-2KGAN2HM.js} +83 -14
- package/dist/chunk-2KGAN2HM.js.map +1 -0
- package/dist/{chunk-FTXM7Q7P.js → chunk-6YBA64Z2.js} +120 -724
- package/dist/chunk-6YBA64Z2.js.map +1 -0
- package/dist/{chunk-HGRW27YY.js → chunk-AP7CPGMZ.js} +139 -19
- package/dist/chunk-AP7CPGMZ.js.map +1 -0
- package/dist/{chunk-XP5KDM3R.js → chunk-BPGXIKK7.js} +3 -3
- package/dist/{chunk-D3H7F6L2.js → chunk-DHCHL6OG.js} +2 -3
- package/dist/chunk-DHCHL6OG.js.map +1 -0
- package/dist/{chunk-PCURO3DL.js → chunk-G55QE4IQ.js} +512 -36
- package/dist/chunk-G55QE4IQ.js.map +1 -0
- package/dist/{chunk-C3UKLQ54.js → chunk-IADLKE7I.js} +14 -4
- package/dist/chunk-IADLKE7I.js.map +1 -0
- package/dist/{chunk-WIPGQ4GT.js → chunk-IMSNJSXH.js} +1 -1
- package/dist/{chunk-WIPGQ4GT.js.map → chunk-IMSNJSXH.js.map} +1 -1
- package/dist/{chunk-VSWBYWFK.js → chunk-M6MD6JBS.js} +20 -27
- package/dist/chunk-M6MD6JBS.js.map +1 -0
- package/dist/chunk-MKGRLDWB.js +684 -0
- package/dist/chunk-MKGRLDWB.js.map +1 -0
- package/dist/{chunk-AEG3NGJ2.js → chunk-Q2JSAVQ3.js} +34 -2
- package/dist/chunk-Q2JSAVQ3.js.map +1 -0
- package/dist/{chunk-37V4KQDC.js → chunk-WTZ37EQY.js} +1021 -514
- package/dist/chunk-WTZ37EQY.js.map +1 -0
- package/dist/{chunk-U33YZ7B2.js → chunk-YLUOTX6U.js} +4 -4
- package/dist/{chunk-33OG2NN3.js → chunk-Z5I642SY.js} +2 -2
- package/dist/{completion-gate-D1gX1-hg.d.ts → completion-gate-C80jiRfN.d.ts} +1 -1
- package/dist/conversation.d.ts +12 -1
- package/dist/conversation.js +2 -2
- package/dist/{coordination-Dr_axlAf.d.ts → coordination-BFE3Den7.d.ts} +10 -11
- package/dist/environment-provider.d.ts +2 -2
- package/dist/environment-provider.js +1 -1
- package/dist/{improve-BN3HyXIO.d.ts → improve-B-UYaEH5.d.ts} +3 -3
- package/dist/index.d.ts +22 -25
- package/dist/index.js +45 -50
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +177 -119
- package/dist/intelligence.js +501 -342
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +22 -11
- package/dist/knowledge.js +9 -4
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.js +1 -1
- package/dist/{loop-runner-bin-BRQSQdHa.d.ts → loop-runner-bin-BIQldFS8.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +6 -6
- package/dist/loops.d.ts +12 -12
- package/dist/loops.js +5 -5
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +6 -6
- package/dist/{mcp-serve-verifier-DQQDbuyz.d.ts → mcp-serve-verifier-Bs_n0xPc.d.ts} +1 -1
- package/dist/primeintellect/index.js +1 -1
- package/dist/profile-DbfaMTdk.d.ts +233 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/{supervise-DmYOug5f.d.ts → supervise-BLPI50-w.d.ts} +3 -3
- package/dist/{types-ByAYqlVb.d.ts → types-B3vAW0Oq.d.ts} +1 -1
- package/dist/types-CWqfCO8s.d.ts +491 -0
- package/dist/{types-1d5QGK3t.d.ts → types-CmnA2iL3.d.ts} +3 -3
- package/dist/{worktree-fanout-CPprU-qI.d.ts → worktree-fanout-DCA3G4bO.d.ts} +3 -3
- package/package.json +13 -10
- package/dist/chunk-37V4KQDC.js.map +0 -1
- package/dist/chunk-AEG3NGJ2.js.map +0 -1
- package/dist/chunk-C3UKLQ54.js.map +0 -1
- package/dist/chunk-D3H7F6L2.js.map +0 -1
- package/dist/chunk-FTXM7Q7P.js.map +0 -1
- package/dist/chunk-HGRW27YY.js.map +0 -1
- package/dist/chunk-PCURO3DL.js.map +0 -1
- package/dist/chunk-VSWBYWFK.js.map +0 -1
- package/dist/chunk-VYA2YEKA.js.map +0 -1
- package/dist/prepare-DIeVgQG3.d.ts +0 -718
- /package/dist/{chunk-XP5KDM3R.js.map → chunk-BPGXIKK7.js.map} +0 -0
- /package/dist/{chunk-U33YZ7B2.js.map → chunk-YLUOTX6U.js.map} +0 -0
- /package/dist/{chunk-33OG2NN3.js.map → chunk-Z5I642SY.js.map} +0 -0
|
@@ -1,718 +0,0 @@
|
|
|
1
|
-
import { AgentCandidateBundle, AgentCandidateArtifactRef, AgentCandidateTermination, AgentCandidateTaskOutcomeEvidence, Sha256Digest, AgentCandidateContainer, AgentCandidateOciPlatform, AgentCandidateGitHubRepository, AgentCandidateWorkspaceSnapshotEvidence, AgentCandidateResolvedModel, AgentCandidateAttemptPolicy, AgentCandidateExecutionLimits, AgentCandidateModelAccessNetwork, AgentCandidateCapturedArtifact, AgentCandidateWorkspaceManifestMaterialV1, AgentCandidateProfilePlanEvidence, AgentCandidateExecutionPlanEvidence, AgentCandidateMaterializationReceipt, AgentCandidateInstructionDelivery, AgentCandidateEffectiveMemory, AgentCandidateRunReceiptV2, AgentCandidateSpend, ReasoningEffort } from '@tangle-network/agent-interface';
|
|
2
|
-
import { BenchmarkEvaluation, TraceStore } from '@tangle-network/agent-eval';
|
|
3
|
-
|
|
4
|
-
/** Exact candidate wire shape before the runtime computes its canonical digest. */
|
|
5
|
-
type AgentCandidateBundleInput = Omit<AgentCandidateBundle, 'digest'>;
|
|
6
|
-
/** Validate and content-address a candidate bundle before it crosses an approval boundary. */
|
|
7
|
-
declare function sealAgentCandidateBundle(input: AgentCandidateBundleInput): AgentCandidateBundle;
|
|
8
|
-
|
|
9
|
-
declare const verifiedCandidateBrand: unique symbol;
|
|
10
|
-
declare const preparedCandidateBrand: unique symbol;
|
|
11
|
-
declare const verifiedTaskOutcomeBrand: unique symbol;
|
|
12
|
-
/** Reads one content-addressed object from the closed S3/IPFS locator set. */
|
|
13
|
-
interface AgentCandidateArtifactPort {
|
|
14
|
-
read(ref: AgentCandidateArtifactRef): Promise<Uint8Array>;
|
|
15
|
-
}
|
|
16
|
-
type AgentCandidateOutputPurpose = 'candidate-workspace-manifest' | 'candidate-workspace-archive' | 'task-manifest' | 'task-archive' | 'task-patch' | 'task-outcome' | 'memory-after-manifest' | 'memory-after-archive' | 'grader-evidence' | 'benchmark-result' | 'model-settlement' | 'trace' | 'run-receipt' | 'failure-evidence';
|
|
17
|
-
/** Durable content-addressed evidence store controlled only by the evaluator. */
|
|
18
|
-
interface AgentCandidateOutputArtifactPort extends AgentCandidateArtifactPort {
|
|
19
|
-
/** Must be idempotent for identical bytes and return only a durable S3/IPFS locator. */
|
|
20
|
-
put(input: {
|
|
21
|
-
executionId: string;
|
|
22
|
-
purpose: AgentCandidateOutputPurpose;
|
|
23
|
-
bytes: Uint8Array;
|
|
24
|
-
/** Abort must prevent durable publication when it happens before resolution. */
|
|
25
|
-
signal?: AbortSignal;
|
|
26
|
-
}): Promise<AgentCandidateArtifactRef>;
|
|
27
|
-
}
|
|
28
|
-
/** Resolves a declared GitHub repository to an already-present local Git object store. */
|
|
29
|
-
interface AgentCandidateRepositoryPort {
|
|
30
|
-
resolve(repository: AgentCandidateGitHubRepository): Promise<string>;
|
|
31
|
-
}
|
|
32
|
-
interface AgentCandidateVerificationPorts {
|
|
33
|
-
artifacts: AgentCandidateArtifactPort;
|
|
34
|
-
repositories: AgentCandidateRepositoryPort;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Materializes an already-verified workspace archive.
|
|
38
|
-
*
|
|
39
|
-
* The runtime independently scans every resulting byte, mode, and path against
|
|
40
|
-
* the signed manifest after this returns. Implementations may therefore unpack
|
|
41
|
-
* any archive encoding, or no-op when the exact workspace is already present.
|
|
42
|
-
*/
|
|
43
|
-
interface AgentCandidateWorkspacePort {
|
|
44
|
-
materialize(input: {
|
|
45
|
-
role: 'task' | 'candidate' | 'memory';
|
|
46
|
-
snapshot: AgentCandidateWorkspaceSnapshotEvidence;
|
|
47
|
-
archive: Uint8Array;
|
|
48
|
-
destination: string;
|
|
49
|
-
}): Promise<void>;
|
|
50
|
-
}
|
|
51
|
-
interface ResolvedAgentCandidateContainer {
|
|
52
|
-
source: 'pinned-container' | 'evaluator-task-container';
|
|
53
|
-
image: string;
|
|
54
|
-
indexDigest: Sha256Digest;
|
|
55
|
-
manifestDigest: Sha256Digest;
|
|
56
|
-
platform: AgentCandidateOciPlatform;
|
|
57
|
-
}
|
|
58
|
-
interface AgentCandidateContainerPort {
|
|
59
|
-
resolve(input: {
|
|
60
|
-
candidate: AgentCandidateContainer | undefined;
|
|
61
|
-
evaluatorTaskContainer: ResolvedAgentCandidateContainer | undefined;
|
|
62
|
-
}): Promise<ResolvedAgentCandidateContainer>;
|
|
63
|
-
}
|
|
64
|
-
interface AgentCandidateModelPort {
|
|
65
|
-
resolve(input: {
|
|
66
|
-
requested: string;
|
|
67
|
-
harness: AgentCandidateBundle['execution']['harness'];
|
|
68
|
-
reasoningEffort: NonNullable<AgentCandidateBundle['profile']['model']>['reasoningEffort'];
|
|
69
|
-
}): Promise<AgentCandidateResolvedModel>;
|
|
70
|
-
/**
|
|
71
|
-
* Reserve a stable access identity without creating a live credential.
|
|
72
|
-
* The reservation is scoped to `preparationId` and must automatically expire
|
|
73
|
-
* at `expiresAtMs`, even if this call returns ambiguously to the runtime.
|
|
74
|
-
*/
|
|
75
|
-
reserveGrant(input: {
|
|
76
|
-
executionId: string;
|
|
77
|
-
preparationId: string;
|
|
78
|
-
expiresAtMs: number;
|
|
79
|
-
attempt: AgentCandidateAttemptPolicy;
|
|
80
|
-
bundleDigest: Sha256Digest;
|
|
81
|
-
resolved: AgentCandidateResolvedModel;
|
|
82
|
-
limits: AgentCandidateModelLimits;
|
|
83
|
-
}): Promise<AgentCandidateProtectedModelReservation>;
|
|
84
|
-
/** Create the live scoped credential only after the execution attempt is durably claimed. */
|
|
85
|
-
activateGrant(input: {
|
|
86
|
-
executionId: string;
|
|
87
|
-
preparationId: string;
|
|
88
|
-
grantDigest: Sha256Digest;
|
|
89
|
-
resolved: AgentCandidateResolvedModel;
|
|
90
|
-
deadlineAtMs: number;
|
|
91
|
-
}): Promise<AgentCandidateProtectedModelActivation>;
|
|
92
|
-
/**
|
|
93
|
-
* Atomically revoke the grant, drain in-flight calls, and return its immutable final ledger.
|
|
94
|
-
* This operation must be idempotent for the exact preparation and must also
|
|
95
|
-
* settle a reservation that was never activated. It must never affect a
|
|
96
|
-
* different preparation, even when both reservations report the same digest.
|
|
97
|
-
*/
|
|
98
|
-
settleGrant(input: {
|
|
99
|
-
executionId: string;
|
|
100
|
-
preparationId: string;
|
|
101
|
-
grantDigest: Sha256Digest;
|
|
102
|
-
resolved: AgentCandidateResolvedModel;
|
|
103
|
-
reason: 'completed' | 'failed' | 'timeout' | 'replayed' | 'preparation-failed' | 'abandoned';
|
|
104
|
-
}): Promise<AgentCandidateProtectedModelSettlement>;
|
|
105
|
-
}
|
|
106
|
-
/** Limits mechanically enforced by the evaluator-owned model gateway. */
|
|
107
|
-
type AgentCandidateModelLimits = Pick<AgentCandidateExecutionLimits, 'maxModelCalls' | 'maxInputTokens' | 'maxOutputTokens' | 'maxCostUsd'>;
|
|
108
|
-
interface AgentCandidateBenchmarkGraderIdentity {
|
|
109
|
-
name: string;
|
|
110
|
-
version: string;
|
|
111
|
-
artifact: AgentCandidateArtifactRef;
|
|
112
|
-
}
|
|
113
|
-
interface AgentCandidateProtectedModelReservation {
|
|
114
|
-
preparationId: string;
|
|
115
|
-
digest: Sha256Digest;
|
|
116
|
-
/** Evaluator service must expire and revoke this reservation at this epoch millisecond. */
|
|
117
|
-
expiresAtMs: number;
|
|
118
|
-
/** The gateway must stop calls before any one of these limits is exceeded. */
|
|
119
|
-
enforcedLimits: AgentCandidateModelLimits;
|
|
120
|
-
/** Exact public endpoint exception; every other candidate destination stays blocked. */
|
|
121
|
-
network: AgentCandidateModelAccessNetwork;
|
|
122
|
-
}
|
|
123
|
-
interface AgentCandidateProtectedModelActivation {
|
|
124
|
-
/** Injected only into the trusted executor after all pre-launch checks pass. */
|
|
125
|
-
env: Readonly<Record<string, string>>;
|
|
126
|
-
}
|
|
127
|
-
/** One evaluator-gateway call in the final, revoked model-access ledger. */
|
|
128
|
-
interface AgentCandidateProtectedModelCall {
|
|
129
|
-
callId: string;
|
|
130
|
-
/** Router-generated public response identity. */
|
|
131
|
-
generationId: string;
|
|
132
|
-
/** Exact protected agent-eval LLM span produced from the router ledger. */
|
|
133
|
-
traceSpanId: string;
|
|
134
|
-
status: 'succeeded' | 'failed';
|
|
135
|
-
model: string;
|
|
136
|
-
startedAtMs: number;
|
|
137
|
-
endedAtMs: number;
|
|
138
|
-
inputTokens: number;
|
|
139
|
-
outputTokens: number;
|
|
140
|
-
cachedInputTokens: number;
|
|
141
|
-
reasoningTokens: number;
|
|
142
|
-
/** Integer billionths of one US dollar; avoids floating-point ledger drift. */
|
|
143
|
-
costUsdNanos: number;
|
|
144
|
-
}
|
|
145
|
-
interface AgentCandidateProtectedModelSettlement {
|
|
146
|
-
preparationId: string;
|
|
147
|
-
grantDigest: Sha256Digest;
|
|
148
|
-
closed: true;
|
|
149
|
-
calls: readonly AgentCandidateProtectedModelCall[];
|
|
150
|
-
}
|
|
151
|
-
interface AgentCandidateMemoryResetResult {
|
|
152
|
-
preparationId: string;
|
|
153
|
-
accessDigest: Sha256Digest;
|
|
154
|
-
expiresAtMs: number;
|
|
155
|
-
evidence: AgentCandidateCapturedArtifact;
|
|
156
|
-
emptyStateDigest: Sha256Digest;
|
|
157
|
-
beforeState: AgentCandidateWorkspaceSnapshotEvidence;
|
|
158
|
-
}
|
|
159
|
-
interface AgentCandidateMemoryPort {
|
|
160
|
-
/**
|
|
161
|
-
* Reset and reserve exact task memory without returning live access.
|
|
162
|
-
* The service must scope the reservation to `preparationId`, automatically
|
|
163
|
-
* revoke it at `expiresAtMs`, and never reuse it for another preparation.
|
|
164
|
-
*/
|
|
165
|
-
reset(input: {
|
|
166
|
-
executionId: string;
|
|
167
|
-
preparationId: string;
|
|
168
|
-
expiresAtMs: number;
|
|
169
|
-
effectiveNamespace: string;
|
|
170
|
-
seed?: Uint8Array;
|
|
171
|
-
seedDigest?: Sha256Digest;
|
|
172
|
-
}): Promise<AgentCandidateMemoryResetResult>;
|
|
173
|
-
/**
|
|
174
|
-
* Create live scoped access only after the execution attempt is durably claimed.
|
|
175
|
-
* Activation must match the exact preparation/access pair and may not extend expiry.
|
|
176
|
-
*/
|
|
177
|
-
activate(input: {
|
|
178
|
-
executionId: string;
|
|
179
|
-
preparationId: string;
|
|
180
|
-
accessDigest: Sha256Digest;
|
|
181
|
-
effectiveNamespace: string;
|
|
182
|
-
deadlineAtMs: number;
|
|
183
|
-
}): Promise<{
|
|
184
|
-
env: Readonly<Record<string, string>>;
|
|
185
|
-
}>;
|
|
186
|
-
/**
|
|
187
|
-
* Revoke evaluator-owned access after process death or a failed preparation.
|
|
188
|
-
* Must be idempotent and concurrency-safe for the exact preparation/access
|
|
189
|
-
* pair and must never close a different preparation.
|
|
190
|
-
*/
|
|
191
|
-
close(input: {
|
|
192
|
-
executionId: string;
|
|
193
|
-
preparationId: string;
|
|
194
|
-
accessDigest: Sha256Digest;
|
|
195
|
-
effectiveNamespace: string;
|
|
196
|
-
reason: 'completed' | 'failed' | 'timeout' | 'replayed' | 'preparation-failed' | 'abandoned';
|
|
197
|
-
}): Promise<{
|
|
198
|
-
closed: true;
|
|
199
|
-
}>;
|
|
200
|
-
}
|
|
201
|
-
interface AgentCandidateExecutionPorts extends AgentCandidateVerificationPorts {
|
|
202
|
-
workspaces: AgentCandidateWorkspacePort;
|
|
203
|
-
containers: AgentCandidateContainerPort;
|
|
204
|
-
models: AgentCandidateModelPort;
|
|
205
|
-
memory: AgentCandidateMemoryPort;
|
|
206
|
-
}
|
|
207
|
-
interface AgentCandidateTaskExecution {
|
|
208
|
-
executionId: string;
|
|
209
|
-
benchmark: string;
|
|
210
|
-
benchmarkVersion: string;
|
|
211
|
-
taskId: string;
|
|
212
|
-
splitDigest: Sha256Digest;
|
|
213
|
-
/** Exact agent-visible task instruction. The runtime rejects malformed Unicode. */
|
|
214
|
-
instruction: string;
|
|
215
|
-
repository: {
|
|
216
|
-
identity: string;
|
|
217
|
-
rootIdentity: string;
|
|
218
|
-
baseCommit: string;
|
|
219
|
-
baseTree: string;
|
|
220
|
-
};
|
|
221
|
-
attempt: AgentCandidateAttemptPolicy;
|
|
222
|
-
model: {
|
|
223
|
-
requested: string;
|
|
224
|
-
reasoningEffort: ReasoningEffort;
|
|
225
|
-
};
|
|
226
|
-
grader: AgentCandidateBenchmarkGraderIdentity;
|
|
227
|
-
/** Absolute paths inside the evaluator-owned execution environment. */
|
|
228
|
-
executionRoots: {
|
|
229
|
-
taskRoot: string;
|
|
230
|
-
candidateRoot?: string;
|
|
231
|
-
};
|
|
232
|
-
/** Host-side staging roots. These are verified but never signed as container paths. */
|
|
233
|
-
stagingRoots: {
|
|
234
|
-
taskRoot: string;
|
|
235
|
-
candidateRoot?: string;
|
|
236
|
-
profileRoot: string;
|
|
237
|
-
};
|
|
238
|
-
workspace: AgentCandidateWorkspaceSnapshotEvidence;
|
|
239
|
-
evaluatorTaskContainer?: ResolvedAgentCandidateContainer;
|
|
240
|
-
limits: AgentCandidateExecutionLimits;
|
|
241
|
-
}
|
|
242
|
-
interface VerifiedAgentCandidate {
|
|
243
|
-
readonly bundle: AgentCandidateBundle;
|
|
244
|
-
readonly materializedTree?: string;
|
|
245
|
-
readonly [verifiedCandidateBrand]: true;
|
|
246
|
-
}
|
|
247
|
-
interface CanonicalCandidateDocument<T> {
|
|
248
|
-
readonly value: T;
|
|
249
|
-
/** Canonical UTF-8 bytes of `value` with its top-level digest omitted. */
|
|
250
|
-
readonly bytes: Uint8Array;
|
|
251
|
-
readonly digest: Sha256Digest;
|
|
252
|
-
}
|
|
253
|
-
interface PreparedAgentCandidateLaunch {
|
|
254
|
-
executable: string;
|
|
255
|
-
/** Complete fixed argv, including profile materializer flags but excluding task delivery. */
|
|
256
|
-
args: readonly string[];
|
|
257
|
-
env: Readonly<Record<string, string>>;
|
|
258
|
-
/** Informational subset already present at the tail of `args`; executors must not append twice. */
|
|
259
|
-
flags: readonly string[];
|
|
260
|
-
cwd: string;
|
|
261
|
-
}
|
|
262
|
-
interface PreparedAgentCandidateInstruction {
|
|
263
|
-
bytes: Uint8Array;
|
|
264
|
-
delivery: AgentCandidateInstructionDelivery;
|
|
265
|
-
}
|
|
266
|
-
interface PreparedAgentCandidateTrace {
|
|
267
|
-
runId: string;
|
|
268
|
-
tags: Readonly<Record<string, string>>;
|
|
269
|
-
env: Readonly<Record<string, string>>;
|
|
270
|
-
}
|
|
271
|
-
interface PreparedAgentCandidateExecution {
|
|
272
|
-
readonly bundle: AgentCandidateBundle;
|
|
273
|
-
readonly executionId: string;
|
|
274
|
-
readonly roots: {
|
|
275
|
-
execution: {
|
|
276
|
-
taskRoot: string;
|
|
277
|
-
candidateRoot?: string;
|
|
278
|
-
};
|
|
279
|
-
staging: {
|
|
280
|
-
taskRoot: string;
|
|
281
|
-
candidateRoot?: string;
|
|
282
|
-
profileRoot: string;
|
|
283
|
-
};
|
|
284
|
-
};
|
|
285
|
-
readonly profilePlan: {
|
|
286
|
-
value: AgentCandidateProfilePlanEvidence;
|
|
287
|
-
bytes: Uint8Array;
|
|
288
|
-
written: readonly string[];
|
|
289
|
-
};
|
|
290
|
-
readonly executionPlan: {
|
|
291
|
-
value: AgentCandidateExecutionPlanEvidence;
|
|
292
|
-
bytes: Uint8Array;
|
|
293
|
-
};
|
|
294
|
-
readonly materializationReceipt: CanonicalCandidateDocument<AgentCandidateMaterializationReceipt>;
|
|
295
|
-
readonly launch: PreparedAgentCandidateLaunch;
|
|
296
|
-
readonly instruction: PreparedAgentCandidateInstruction;
|
|
297
|
-
readonly resolvedModel: AgentCandidateResolvedModel;
|
|
298
|
-
readonly knowledge?: {
|
|
299
|
-
snapshotId: string;
|
|
300
|
-
manifestDigest: Sha256Digest;
|
|
301
|
-
manifest: Uint8Array;
|
|
302
|
-
};
|
|
303
|
-
readonly trace: PreparedAgentCandidateTrace;
|
|
304
|
-
readonly memory: AgentCandidateEffectiveMemory;
|
|
305
|
-
readonly [preparedCandidateBrand]: true;
|
|
306
|
-
}
|
|
307
|
-
interface AgentCandidateProtectedRunCapture {
|
|
308
|
-
executionId: string;
|
|
309
|
-
termination: AgentCandidateTermination;
|
|
310
|
-
}
|
|
311
|
-
/** Raw evaluator capture made only after the candidate process is dead. */
|
|
312
|
-
interface AgentCandidateExecutorTaskOutcomeCapture {
|
|
313
|
-
/** Claimed final tree. The runtime recomputes it independently from `gitDiff`. */
|
|
314
|
-
resultTree: string;
|
|
315
|
-
/** Complete evaluator-captured workspace description after candidate execution. */
|
|
316
|
-
afterState: AgentCandidateWorkspaceManifestMaterialV1;
|
|
317
|
-
/** Reproducible workspace archive corresponding to `afterState`. */
|
|
318
|
-
archive: Uint8Array;
|
|
319
|
-
/** Exact binary patch from the signed task base to `afterState`. */
|
|
320
|
-
gitDiff: Uint8Array;
|
|
321
|
-
}
|
|
322
|
-
/** Raw isolated-memory capture made only after access has been revoked. */
|
|
323
|
-
interface AgentCandidateExecutorMemoryCapture {
|
|
324
|
-
readonly afterState: AgentCandidateWorkspaceManifestMaterialV1;
|
|
325
|
-
readonly archive: Uint8Array;
|
|
326
|
-
}
|
|
327
|
-
/** Idempotent executor result after process death and trace drain. */
|
|
328
|
-
interface AgentCandidateExecutorFinalCapture {
|
|
329
|
-
readonly stopped: true;
|
|
330
|
-
readonly taskOutcome?: AgentCandidateExecutorTaskOutcomeCapture;
|
|
331
|
-
/** Required only when the prepared candidate uses isolated task memory. */
|
|
332
|
-
readonly memoryAfter?: AgentCandidateExecutorMemoryCapture;
|
|
333
|
-
}
|
|
334
|
-
/** Branded task outcome that has survived independent patch and tree verification. */
|
|
335
|
-
interface VerifiedAgentCandidateTaskOutcome {
|
|
336
|
-
readonly evidence: AgentCandidateTaskOutcomeEvidence & {
|
|
337
|
-
readonly artifact: AgentCandidateArtifactRef;
|
|
338
|
-
};
|
|
339
|
-
readonly patch: Uint8Array;
|
|
340
|
-
readonly [verifiedTaskOutcomeBrand]: true;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Evaluator-owned executable grader, pinned by immutable implementation bytes.
|
|
344
|
-
*
|
|
345
|
-
* `run` is an isolation boundary, not an arbitrary scoring callback. The
|
|
346
|
-
* implementation admitted to that boundary is supplied by the runtime after
|
|
347
|
-
* artifact verification. Implementations must derive every returned binding
|
|
348
|
-
* digest from the bytes and task outcome they actually admitted, rather than
|
|
349
|
-
* copying an expected digest from ambient configuration.
|
|
350
|
-
*/
|
|
351
|
-
interface AgentCandidateBenchmarkGraderPort {
|
|
352
|
-
readonly name: string;
|
|
353
|
-
readonly version: string;
|
|
354
|
-
readonly artifact: AgentCandidateArtifactRef;
|
|
355
|
-
run(input: {
|
|
356
|
-
readonly executionId: string;
|
|
357
|
-
readonly termination: AgentCandidateTermination;
|
|
358
|
-
readonly outcome: VerifiedAgentCandidateTaskOutcome;
|
|
359
|
-
/** Exact verified artifact bytes. Each read returns a detached copy. */
|
|
360
|
-
readonly implementation: {
|
|
361
|
-
readonly byteLength: number;
|
|
362
|
-
readonly bytes: Uint8Array;
|
|
363
|
-
};
|
|
364
|
-
/** Frozen result deadline; runners must stop work and side effects when aborted. */
|
|
365
|
-
readonly signal: AbortSignal;
|
|
366
|
-
}): Promise<{
|
|
367
|
-
readonly evaluation: BenchmarkEvaluation;
|
|
368
|
-
/** Raw grader output needed to audit or reproduce the normalized result. */
|
|
369
|
-
readonly evidence: Uint8Array;
|
|
370
|
-
/** Runtime-checked binding between admitted code, task input, and raw output. */
|
|
371
|
-
readonly binding: {
|
|
372
|
-
/** Digest computed from the implementation bytes admitted to execution. */
|
|
373
|
-
readonly implementationDigest: Sha256Digest;
|
|
374
|
-
/** Digest of the exact runtime-verified task outcome graded by this run. */
|
|
375
|
-
readonly taskOutcomeDigest: Sha256Digest;
|
|
376
|
-
/** Digest computed from `evidence` before it leaves the execution boundary. */
|
|
377
|
-
readonly outputDigest: Sha256Digest;
|
|
378
|
-
};
|
|
379
|
-
}>;
|
|
380
|
-
}
|
|
381
|
-
/** One detached request passed to the trusted environment-specific executor. */
|
|
382
|
-
interface AgentCandidateExecutorRequest {
|
|
383
|
-
readonly executionId: string;
|
|
384
|
-
/** Immutable bytes from which the executor creates fresh isolated workspaces. */
|
|
385
|
-
readonly inputs: {
|
|
386
|
-
readonly task: AgentCandidateExecutorWorkspaceInput;
|
|
387
|
-
readonly candidate?: AgentCandidateExecutorWorkspaceInput;
|
|
388
|
-
readonly profile: {
|
|
389
|
-
readonly files: readonly AgentCandidateExecutorProfileFile[];
|
|
390
|
-
};
|
|
391
|
-
};
|
|
392
|
-
readonly roots: PreparedAgentCandidateExecution['roots']['execution'];
|
|
393
|
-
readonly profilePlan: PreparedAgentCandidateExecution['profilePlan'];
|
|
394
|
-
readonly executionPlan: PreparedAgentCandidateExecution['executionPlan'];
|
|
395
|
-
readonly materializationReceipt: CanonicalCandidateDocument<AgentCandidateMaterializationReceipt>;
|
|
396
|
-
readonly launch: PreparedAgentCandidateLaunch;
|
|
397
|
-
readonly instruction: PreparedAgentCandidateInstruction;
|
|
398
|
-
readonly resolvedModel: AgentCandidateResolvedModel;
|
|
399
|
-
/** Mechanically enforced by the runtime plus executor process-death acknowledgement. */
|
|
400
|
-
readonly hardLimits: Pick<AgentCandidateExecutionLimits, 'timeoutMs'>;
|
|
401
|
-
/** Validity bound checked against protected traces; generic black-box executors cannot preempt it. */
|
|
402
|
-
readonly observedLimits: Pick<AgentCandidateExecutionLimits, 'maxSteps'>;
|
|
403
|
-
readonly knowledge?: PreparedAgentCandidateExecution['knowledge'];
|
|
404
|
-
readonly trace: PreparedAgentCandidateTrace;
|
|
405
|
-
readonly memory: AgentCandidateEffectiveMemory;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Executes one prepared request inside an evaluator-owned isolation boundary.
|
|
409
|
-
*
|
|
410
|
-
* `request.launch.env` is the complete allowlisted environment, including
|
|
411
|
-
* protected model, memory, and trace bindings. Implementations must not merge
|
|
412
|
-
* ambient host variables into it. The returned capture deliberately contains
|
|
413
|
-
* no candidate-authored usage or score fields.
|
|
414
|
-
*/
|
|
415
|
-
interface AgentCandidateExecutorPort {
|
|
416
|
-
execute(request: AgentCandidateExecutorRequest, context: {
|
|
417
|
-
traceStore: TraceStore;
|
|
418
|
-
/** Aborted by the runtime at the exact frozen wall-time deadline. */
|
|
419
|
-
signal: AbortSignal;
|
|
420
|
-
/** Absolute epoch-millisecond deadline owned by the runtime. */
|
|
421
|
-
deadlineAtMs: number;
|
|
422
|
-
}): Promise<AgentCandidateProtectedRunCapture>;
|
|
423
|
-
/**
|
|
424
|
-
* Kill any process/container still associated with the request, drain trace
|
|
425
|
-
* writes, and capture the final task workspace before teardown.
|
|
426
|
-
* The runtime calls this on success, failure, and timeout before model settlement.
|
|
427
|
-
* Implementations must be idempotent and concurrency-safe for this exact
|
|
428
|
-
* execution/plan pair because a fresh worker may repeat crash recovery.
|
|
429
|
-
*/
|
|
430
|
-
stopAndCapture(request: AgentCandidateExecutorStopRequest, context: {
|
|
431
|
-
traceStore: TraceStore;
|
|
432
|
-
reason: 'completed' | 'failed' | 'timeout';
|
|
433
|
-
/** Aborted at the frozen execution deadline or evaluator cleanup deadline. */
|
|
434
|
-
signal: AbortSignal;
|
|
435
|
-
/** Absolute execution deadline; a later stop acknowledgement cannot produce success. */
|
|
436
|
-
deadlineAtMs: number;
|
|
437
|
-
}): Promise<AgentCandidateExecutorFinalCapture>;
|
|
438
|
-
}
|
|
439
|
-
/** Opaque process identity used for termination without re-exposing launch credentials. */
|
|
440
|
-
interface AgentCandidateExecutorStopRequest {
|
|
441
|
-
readonly executionId: string;
|
|
442
|
-
readonly executionPlanDigest: Sha256Digest;
|
|
443
|
-
}
|
|
444
|
-
interface AgentCandidateExecutorWorkspaceInput {
|
|
445
|
-
readonly snapshot: AgentCandidateWorkspaceSnapshotEvidence;
|
|
446
|
-
readonly files: readonly AgentCandidateExecutorWorkspaceFile[];
|
|
447
|
-
}
|
|
448
|
-
interface AgentCandidateExecutorWorkspaceFile {
|
|
449
|
-
readonly path: string;
|
|
450
|
-
readonly mode: 0o644 | 0o755;
|
|
451
|
-
readonly bytes: Uint8Array;
|
|
452
|
-
}
|
|
453
|
-
interface AgentCandidateExecutorProfileFile {
|
|
454
|
-
readonly path: string;
|
|
455
|
-
readonly mode: 0o644 | 0o755;
|
|
456
|
-
readonly bytes: Uint8Array;
|
|
457
|
-
}
|
|
458
|
-
type AgentCandidateRunFinalization = {
|
|
459
|
-
succeeded: true;
|
|
460
|
-
receipt: CanonicalCandidateDocument<AgentCandidateRunReceiptV2>;
|
|
461
|
-
artifacts: {
|
|
462
|
-
modelSettlement: AgentCandidateArtifactRef;
|
|
463
|
-
taskOutcome: AgentCandidateArtifactRef;
|
|
464
|
-
benchmarkResult: AgentCandidateArtifactRef;
|
|
465
|
-
runReceipt: AgentCandidateArtifactRef;
|
|
466
|
-
};
|
|
467
|
-
} | {
|
|
468
|
-
succeeded: false;
|
|
469
|
-
reason: string;
|
|
470
|
-
partial: {
|
|
471
|
-
executionId: string;
|
|
472
|
-
bundleDigest: Sha256Digest;
|
|
473
|
-
executionPlanDigest: Sha256Digest;
|
|
474
|
-
materializationReceiptDigest: Sha256Digest;
|
|
475
|
-
termination?: AgentCandidateTermination;
|
|
476
|
-
};
|
|
477
|
-
/** Independent evaluator-gateway usage, even when execution or trace capture failed. */
|
|
478
|
-
usage: AgentCandidateSpend | null;
|
|
479
|
-
};
|
|
480
|
-
/** Protected trace tags that bind a run to one prepared candidate execution. */
|
|
481
|
-
declare const CANDIDATE_TRACE_TAGS: {
|
|
482
|
-
readonly executionId: "tangle.candidate.execution_id";
|
|
483
|
-
readonly bundleDigest: "tangle.candidate.bundle_digest";
|
|
484
|
-
readonly executionPlanDigest: "tangle.candidate.execution_plan_digest";
|
|
485
|
-
readonly materializationReceiptDigest: "tangle.candidate.materialization_receipt_digest";
|
|
486
|
-
};
|
|
487
|
-
/** Environment keys used to propagate immutable candidate trace identity. */
|
|
488
|
-
declare const CANDIDATE_TRACE_ENV: {
|
|
489
|
-
readonly executionId: "TANGLE_CANDIDATE_EXECUTION_ID";
|
|
490
|
-
readonly bundleDigest: "TANGLE_CANDIDATE_BUNDLE_DIGEST";
|
|
491
|
-
readonly executionPlanDigest: "TANGLE_CANDIDATE_EXECUTION_PLAN_DIGEST";
|
|
492
|
-
readonly materializationReceiptDigest: "TANGLE_CANDIDATE_MATERIALIZATION_RECEIPT_DIGEST";
|
|
493
|
-
readonly traceRunId: "TANGLE_TRACE_RUN_ID";
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
/** Durable one-shot lifecycle for candidate execution attempts. */
|
|
497
|
-
|
|
498
|
-
/** Non-secret identities a trusted recovery worker needs to close an abandoned attempt. */
|
|
499
|
-
interface AgentCandidateExecutionCleanupHandles {
|
|
500
|
-
readonly preparationId: string;
|
|
501
|
-
readonly modelGrantDigest: Sha256Digest;
|
|
502
|
-
readonly resolvedModel: AgentCandidateResolvedModel;
|
|
503
|
-
readonly traceRunId: string;
|
|
504
|
-
readonly cleanupTimeoutMs: number;
|
|
505
|
-
readonly memory?: {
|
|
506
|
-
readonly accessDigest: Sha256Digest;
|
|
507
|
-
readonly effectiveNamespace: string;
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
/** Immutable signed identity stored for one execution attempt. */
|
|
511
|
-
interface AgentCandidateExecutionClaim {
|
|
512
|
-
readonly executionId: string;
|
|
513
|
-
readonly attempt: number;
|
|
514
|
-
readonly maxAttempts: number;
|
|
515
|
-
readonly retryPolicy: AgentCandidateAttemptPolicy['retryPolicy'];
|
|
516
|
-
readonly bundleDigest: Sha256Digest;
|
|
517
|
-
readonly executionPlanDigest: Sha256Digest;
|
|
518
|
-
/** Frozen plan identity with only attempt number and per-attempt grant identity normalized. */
|
|
519
|
-
readonly retryLineageDigest: Sha256Digest;
|
|
520
|
-
/** The winning lease stops authorizing a new terminal write at this instant. */
|
|
521
|
-
readonly leaseExpiresAtMs: number;
|
|
522
|
-
/** Frozen budget for task verification, executable grading, and receipt construction. */
|
|
523
|
-
readonly resultTimeoutMs: number;
|
|
524
|
-
/** Non-secret handles retained so an expired attempt can be closed and reconciled. */
|
|
525
|
-
readonly cleanup: AgentCandidateExecutionCleanupHandles;
|
|
526
|
-
}
|
|
527
|
-
/** Secret capability required to finish the acquired attempt. */
|
|
528
|
-
interface AgentCandidateExecutionLease {
|
|
529
|
-
readonly executionId: string;
|
|
530
|
-
readonly attempt: number;
|
|
531
|
-
readonly token: string;
|
|
532
|
-
readonly expiresAtMs: number;
|
|
533
|
-
}
|
|
534
|
-
/** Only the first class is retryable, and only when the closed model ledger has zero calls. */
|
|
535
|
-
type AgentCandidateExecutionFailureClass = 'pre-model-infrastructure' | 'execution' | 'post-model-infrastructure' | 'unknown';
|
|
536
|
-
/** Exact fixed-point usage proven by the closed evaluator model ledger. */
|
|
537
|
-
interface AgentCandidateExecutionUsage {
|
|
538
|
-
readonly costUsdNanos: number;
|
|
539
|
-
readonly inputTokens: number;
|
|
540
|
-
readonly outputTokens: number;
|
|
541
|
-
readonly cachedInputTokens: number;
|
|
542
|
-
readonly reasoningTokens: number;
|
|
543
|
-
readonly modelCalls: number;
|
|
544
|
-
}
|
|
545
|
-
/** Evaluator-owned terminal facts staged durably before the terminal CAS. */
|
|
546
|
-
type AgentCandidateExecutionTerminalResult = {
|
|
547
|
-
readonly schemaVersion: 1;
|
|
548
|
-
readonly status: 'succeeded';
|
|
549
|
-
readonly usage: AgentCandidateExecutionUsage;
|
|
550
|
-
readonly modelSettlement: AgentCandidateArtifactRef;
|
|
551
|
-
readonly taskOutcome: AgentCandidateArtifactRef;
|
|
552
|
-
readonly benchmarkResult: AgentCandidateArtifactRef;
|
|
553
|
-
readonly runReceipt: AgentCandidateArtifactRef;
|
|
554
|
-
} | {
|
|
555
|
-
readonly schemaVersion: 1;
|
|
556
|
-
readonly status: 'failed';
|
|
557
|
-
readonly failureClass: AgentCandidateExecutionFailureClass;
|
|
558
|
-
readonly usage: AgentCandidateExecutionUsage;
|
|
559
|
-
readonly modelSettlement: AgentCandidateArtifactRef;
|
|
560
|
-
readonly failureEvidence?: AgentCandidateArtifactRef;
|
|
561
|
-
};
|
|
562
|
-
/** Durable terminal record for one acquired execution attempt. */
|
|
563
|
-
type AgentCandidateExecutionTerminalRecord = AgentCandidateExecutionTerminalResult & {
|
|
564
|
-
readonly executionId: string;
|
|
565
|
-
readonly attempt: number;
|
|
566
|
-
readonly bundleDigest: Sha256Digest;
|
|
567
|
-
readonly executionPlanDigest: Sha256Digest;
|
|
568
|
-
/** RFC 8785 SHA-256 of this record with `terminalDigest` omitted. */
|
|
569
|
-
readonly terminalDigest: Sha256Digest;
|
|
570
|
-
};
|
|
571
|
-
/** Monotonic durable phase: the second value means candidate code could have started. */
|
|
572
|
-
type AgentCandidateExecutionPhase = 'claimed' | 'candidate-may-run';
|
|
573
|
-
/** Trusted, independently observed closure facts for one expired winning lease. */
|
|
574
|
-
interface AgentCandidateExecutionRecoveryEvidence {
|
|
575
|
-
readonly failureClass: AgentCandidateExecutionFailureClass;
|
|
576
|
-
readonly usage: AgentCandidateExecutionUsage;
|
|
577
|
-
readonly modelSettlement: AgentCandidateArtifactRef;
|
|
578
|
-
readonly failureEvidence?: AgentCandidateArtifactRef;
|
|
579
|
-
readonly process: {
|
|
580
|
-
readonly stopped: true;
|
|
581
|
-
readonly executionPlanDigest: Sha256Digest;
|
|
582
|
-
};
|
|
583
|
-
readonly model: {
|
|
584
|
-
readonly closed: true;
|
|
585
|
-
readonly preparationId: string;
|
|
586
|
-
readonly grantDigest: Sha256Digest;
|
|
587
|
-
};
|
|
588
|
-
readonly memory?: {
|
|
589
|
-
readonly closed: true;
|
|
590
|
-
readonly preparationId: string;
|
|
591
|
-
readonly accessDigest: Sha256Digest;
|
|
592
|
-
readonly effectiveNamespace: string;
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
interface AgentCandidateExecutionAttemptRef {
|
|
596
|
-
readonly executionId: string;
|
|
597
|
-
readonly attempt: number;
|
|
598
|
-
}
|
|
599
|
-
/** Persisted state available to a fresh trusted recovery worker after a crash. */
|
|
600
|
-
interface AgentCandidateExecutionAttemptRecord {
|
|
601
|
-
readonly claim: AgentCandidateExecutionClaim;
|
|
602
|
-
readonly phase: AgentCandidateExecutionPhase;
|
|
603
|
-
/** Durable outbox content written before the terminal compare-and-set. */
|
|
604
|
-
readonly staged?: AgentCandidateExecutionTerminalRecord;
|
|
605
|
-
readonly terminal?: AgentCandidateExecutionTerminalRecord;
|
|
606
|
-
}
|
|
607
|
-
/** Result of atomically claiming one execution attempt. */
|
|
608
|
-
type AgentCandidateExecutionClaimResult = {
|
|
609
|
-
readonly acquired: true;
|
|
610
|
-
readonly claim: AgentCandidateExecutionClaim;
|
|
611
|
-
readonly lease: AgentCandidateExecutionLease;
|
|
612
|
-
} | {
|
|
613
|
-
readonly acquired: false;
|
|
614
|
-
readonly reason: 'already-claimed';
|
|
615
|
-
/** The durable winner already occupying this execution-attempt slot. */
|
|
616
|
-
readonly claim: AgentCandidateExecutionClaim;
|
|
617
|
-
/** True only when every signed claim field matches the durable winner. */
|
|
618
|
-
readonly exactReplay: boolean;
|
|
619
|
-
} | {
|
|
620
|
-
readonly acquired: false;
|
|
621
|
-
readonly reason: 'retry-not-eligible';
|
|
622
|
-
readonly claim: AgentCandidateExecutionClaim;
|
|
623
|
-
readonly detail: AgentCandidateRetryRejection;
|
|
624
|
-
};
|
|
625
|
-
/** Result of atomically recording an attempt's terminal facts. */
|
|
626
|
-
type AgentCandidateExecutionFinishResult = {
|
|
627
|
-
readonly finished: true;
|
|
628
|
-
readonly terminal: AgentCandidateExecutionTerminalRecord;
|
|
629
|
-
} | {
|
|
630
|
-
readonly finished: false;
|
|
631
|
-
readonly terminal: AgentCandidateExecutionTerminalRecord;
|
|
632
|
-
/** True when a repeated finish supplied the same terminal digest. */
|
|
633
|
-
readonly exactReplay: boolean;
|
|
634
|
-
};
|
|
635
|
-
/** Result of durably staging the one immutable terminal outbox entry. */
|
|
636
|
-
type AgentCandidateExecutionStageResult = {
|
|
637
|
-
readonly staged: true;
|
|
638
|
-
readonly terminal: AgentCandidateExecutionTerminalRecord;
|
|
639
|
-
} | {
|
|
640
|
-
readonly staged: false;
|
|
641
|
-
readonly terminal: AgentCandidateExecutionTerminalRecord;
|
|
642
|
-
readonly exactReplay: boolean;
|
|
643
|
-
};
|
|
644
|
-
/** Result of crossing the irreversible candidate-may-run boundary. */
|
|
645
|
-
type AgentCandidateExecutionPhaseResult = {
|
|
646
|
-
readonly marked: true;
|
|
647
|
-
readonly phase: 'candidate-may-run';
|
|
648
|
-
} | {
|
|
649
|
-
readonly marked: false;
|
|
650
|
-
readonly phase: 'candidate-may-run';
|
|
651
|
-
};
|
|
652
|
-
type AgentCandidateRetryRejection = 'prior-attempt-missing' | 'prior-attempt-running' | 'prior-attempt-succeeded' | 'prior-attempt-spent-model-calls' | 'prior-attempt-not-pre-model-infrastructure' | 'retry-lineage-mismatch';
|
|
653
|
-
/**
|
|
654
|
-
* Atomic one-shot store for candidate execution attempts.
|
|
655
|
-
*
|
|
656
|
-
* Implementations must linearize both methods across every process sharing the
|
|
657
|
-
* store. Terminal publication is deliberately two-step: `stageTerminal`
|
|
658
|
-
* fsyncs the complete immutable outbox record, then `finish` publishes exactly
|
|
659
|
-
* those staged bytes by digest. A crash between the two leaves recoverable
|
|
660
|
-
* evidence rather than an ambiguous completed run.
|
|
661
|
-
*/
|
|
662
|
-
interface AgentCandidateExecutionClaimStore {
|
|
663
|
-
tryClaim(claim: AgentCandidateExecutionClaim): Promise<AgentCandidateExecutionClaimResult>;
|
|
664
|
-
getAttempt(attempt: AgentCandidateExecutionAttemptRef): Promise<AgentCandidateExecutionAttemptRecord | undefined>;
|
|
665
|
-
/** Persist the point after which candidate code may have run. */
|
|
666
|
-
markCandidateMayRun(lease: AgentCandidateExecutionLease): Promise<AgentCandidateExecutionPhaseResult>;
|
|
667
|
-
/** Fsync the complete terminal record into the durable outbox. */
|
|
668
|
-
stageTerminal(lease: AgentCandidateExecutionLease, result: AgentCandidateExecutionTerminalResult): Promise<AgentCandidateExecutionStageResult>;
|
|
669
|
-
/** Publish exactly the staged terminal identified by `terminalDigest`. */
|
|
670
|
-
finish(lease: AgentCandidateExecutionLease, terminalDigest: Sha256Digest): Promise<AgentCandidateExecutionFinishResult>;
|
|
671
|
-
/**
|
|
672
|
-
* Write a failed terminal only after the lease expired and a trusted worker
|
|
673
|
-
* independently proved process death plus model and memory closure.
|
|
674
|
-
*/
|
|
675
|
-
recoverExpired(attempt: AgentCandidateExecutionAttemptRef, evidence: AgentCandidateExecutionRecoveryEvidence): Promise<AgentCandidateExecutionFinishResult>;
|
|
676
|
-
}
|
|
677
|
-
interface InMemoryAgentCandidateExecutionClaimStoreOptions {
|
|
678
|
-
/** Testable evaluator clock; defaults to `Date.now`. */
|
|
679
|
-
now?: () => number;
|
|
680
|
-
}
|
|
681
|
-
/** Single-process lifecycle implementation. */
|
|
682
|
-
declare class InMemoryAgentCandidateExecutionClaimStore implements AgentCandidateExecutionClaimStore {
|
|
683
|
-
private readonly claims;
|
|
684
|
-
private readonly now;
|
|
685
|
-
constructor(options?: InMemoryAgentCandidateExecutionClaimStoreOptions);
|
|
686
|
-
tryClaim(requested: AgentCandidateExecutionClaim): Promise<AgentCandidateExecutionClaimResult>;
|
|
687
|
-
getAttempt(requestedAttempt: AgentCandidateExecutionAttemptRef): Promise<AgentCandidateExecutionAttemptRecord | undefined>;
|
|
688
|
-
markCandidateMayRun(requestedLease: AgentCandidateExecutionLease): Promise<AgentCandidateExecutionPhaseResult>;
|
|
689
|
-
stageTerminal(requestedLease: AgentCandidateExecutionLease, result: AgentCandidateExecutionTerminalResult): Promise<AgentCandidateExecutionStageResult>;
|
|
690
|
-
finish(requestedLease: AgentCandidateExecutionLease, requestedTerminalDigest: Sha256Digest): Promise<AgentCandidateExecutionFinishResult>;
|
|
691
|
-
recoverExpired(requestedAttempt: AgentCandidateExecutionAttemptRef, evidence: AgentCandidateExecutionRecoveryEvidence): Promise<AgentCandidateExecutionFinishResult>;
|
|
692
|
-
private requireClaim;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
interface ExecutePreparedAgentCandidateOptions {
|
|
696
|
-
executor: AgentCandidateExecutorPort;
|
|
697
|
-
grader: AgentCandidateBenchmarkGraderPort;
|
|
698
|
-
outputArtifacts: AgentCandidateOutputArtifactPort;
|
|
699
|
-
traceStore: TraceStore;
|
|
700
|
-
/** Long-lived evaluator-owned store shared by every process that can run this benchmark. */
|
|
701
|
-
claimStore: AgentCandidateExecutionClaimStore;
|
|
702
|
-
/** Maximum time to prove process death and revoke protected access after a run ends. */
|
|
703
|
-
cleanupTimeoutMs?: number;
|
|
704
|
-
/** Maximum time for task verification, executable grading, and receipt construction. */
|
|
705
|
-
resultTimeoutMs?: number;
|
|
706
|
-
}
|
|
707
|
-
/** Executes and finalizes one durably claimed candidate without exposing an unproven result. */
|
|
708
|
-
declare function executePreparedAgentCandidate(prepared: PreparedAgentCandidateExecution, options: ExecutePreparedAgentCandidateOptions): Promise<AgentCandidateRunFinalization>;
|
|
709
|
-
|
|
710
|
-
interface PrepareAgentCandidateExecutionOptions {
|
|
711
|
-
cleanupTimeoutMs?: number;
|
|
712
|
-
/** Maximum time for task verification, executable grading, and receipt construction. */
|
|
713
|
-
resultTimeoutMs?: number;
|
|
714
|
-
}
|
|
715
|
-
/** Materializes a verified candidate into one immutable evaluator-owned execution plan. */
|
|
716
|
-
declare function prepareAgentCandidateExecution(candidate: VerifiedAgentCandidate, task: AgentCandidateTaskExecution, ports: AgentCandidateExecutionPorts, options?: PrepareAgentCandidateExecutionOptions): Promise<PreparedAgentCandidateExecution>;
|
|
717
|
-
|
|
718
|
-
export { InMemoryAgentCandidateExecutionClaimStore as $, type AgentCandidateBundleInput as A, type AgentCandidateExecutorProfileFile as B, type AgentCandidateExecutorRequest as C, type AgentCandidateExecutorStopRequest as D, type ExecutePreparedAgentCandidateOptions as E, type AgentCandidateExecutorTaskOutcomeCapture as F, type AgentCandidateExecutorWorkspaceFile as G, type AgentCandidateExecutorWorkspaceInput as H, type AgentCandidateMemoryPort as I, type AgentCandidateMemoryResetResult as J, type AgentCandidateModelLimits as K, type AgentCandidateModelPort as L, type AgentCandidateOutputArtifactPort as M, type AgentCandidateOutputPurpose as N, type AgentCandidateProtectedModelActivation as O, type PrepareAgentCandidateExecutionOptions as P, type AgentCandidateProtectedModelCall as Q, type AgentCandidateProtectedModelReservation as R, type AgentCandidateProtectedModelSettlement as S, type AgentCandidateProtectedRunCapture as T, type AgentCandidateRepositoryPort as U, type AgentCandidateRetryRejection as V, type AgentCandidateVerificationPorts as W, type AgentCandidateWorkspacePort as X, CANDIDATE_TRACE_ENV as Y, CANDIDATE_TRACE_TAGS as Z, type CanonicalCandidateDocument as _, type AgentCandidateTaskExecution as a, type PreparedAgentCandidateExecution as a0, type PreparedAgentCandidateInstruction as a1, type PreparedAgentCandidateLaunch as a2, type PreparedAgentCandidateTrace as a3, type ResolvedAgentCandidateContainer as a4, type VerifiedAgentCandidate as a5, type VerifiedAgentCandidateTaskOutcome as a6, executePreparedAgentCandidate as a7, prepareAgentCandidateExecution as a8, sealAgentCandidateBundle as a9, type AgentCandidateExecutionPorts as b, type AgentCandidateRunFinalization as c, type AgentCandidateArtifactPort as d, type AgentCandidateBenchmarkGraderIdentity as e, type AgentCandidateBenchmarkGraderPort as f, type AgentCandidateContainerPort as g, type AgentCandidateExecutionAttemptRecord as h, type AgentCandidateExecutionAttemptRef as i, type AgentCandidateExecutionClaim as j, type AgentCandidateExecutionClaimResult as k, type AgentCandidateExecutionClaimStore as l, type AgentCandidateExecutionCleanupHandles as m, type AgentCandidateExecutionFailureClass as n, type AgentCandidateExecutionFinishResult as o, type AgentCandidateExecutionLease as p, type AgentCandidateExecutionPhase as q, type AgentCandidateExecutionPhaseResult as r, type AgentCandidateExecutionRecoveryEvidence as s, type AgentCandidateExecutionStageResult as t, type AgentCandidateExecutionTerminalRecord as u, type AgentCandidateExecutionTerminalResult as v, type AgentCandidateExecutionUsage as w, type AgentCandidateExecutorFinalCapture as x, type AgentCandidateExecutorMemoryCapture as y, type AgentCandidateExecutorPort as z };
|