@tangle-network/agent-runtime 0.337.2 → 0.339.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/{activation-DRHM55Oo.d.ts → activation-CJIIl_Ey.d.ts} +90 -22
- package/dist/activation-CVSFxis9.js +876 -0
- package/dist/activation-CVSFxis9.js.map +1 -0
- package/dist/agent.d.ts +4 -4
- package/dist/agent.js +4 -7
- package/dist/agent.js.map +1 -1
- package/dist/{bundle-BPGjESee.js → bundle-DVOhBTic.js} +2 -2
- package/dist/{bundle-BPGjESee.js.map → bundle-DVOhBTic.js.map} +1 -1
- package/dist/candidate-execution/index.d.ts +4 -63
- package/dist/candidate-execution/index.js +6 -146
- package/dist/candidate-execution/index.js.map +1 -1
- package/dist/content-digest-sBTLujlK.js +9 -0
- package/dist/content-digest-sBTLujlK.js.map +1 -0
- package/dist/{delegate-B-T_ZB50.js → delegate-CCWE_AkU.js} +2 -2
- package/dist/{delegate-B-T_ZB50.js.map → delegate-CCWE_AkU.js.map} +1 -1
- package/dist/{coordination-driver-BHkFVqIq.js → driver-control-acknowledgers-C53ggdJ6.js} +4520 -4442
- package/dist/driver-control-acknowledgers-C53ggdJ6.js.map +1 -0
- package/dist/{durable-file-B_eJr6Mb.js → durable-file-gNI9ILAn.js} +1 -3
- package/dist/durable-file-gNI9ILAn.js.map +1 -0
- package/dist/durable.d.ts +3 -35
- package/dist/durable.js +225 -229
- package/dist/durable.js.map +1 -1
- package/dist/{graph-C4RFlWAJ.js → graph-CI9JXKqO.js} +65 -18
- package/dist/graph-CI9JXKqO.js.map +1 -0
- package/dist/{graph-registry-DAI6KNXB.js → graph-registry-BnO64cn8.js} +18 -17
- package/dist/graph-registry-BnO64cn8.js.map +1 -0
- package/dist/{improvement-cycle-D1I4hQvf.js → improve-BOXTLWJ3.js} +76 -1248
- package/dist/improve-BOXTLWJ3.js.map +1 -0
- package/dist/{improvement-adapter-D5gwwoXQ.d.ts → improvement-adapter-HUt_-cWA.d.ts} +2 -20
- package/dist/index.d.ts +10 -207
- package/dist/index.js +91 -305
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +10 -229
- package/dist/intelligence.js +506 -88
- package/dist/intelligence.js.map +1 -1
- package/dist/{jsonl-file-DBv31uPi.js → jsonl-file-C9Kde_0Z.js} +2 -2
- package/dist/{jsonl-file-DBv31uPi.js.map → jsonl-file-C9Kde_0Z.js.map} +1 -1
- package/dist/kernel.d.ts +4 -3
- package/dist/kernel.js +12 -13
- package/dist/loop-runner-CWzG1bH4.d.ts +32 -0
- package/dist/loop-runner-bin.d.ts +32 -2
- package/dist/loop-runner-bin.js +93 -1
- package/dist/loop-runner-bin.js.map +1 -0
- package/dist/loop-runner-pmPIHFVY.js +59 -0
- package/dist/loop-runner-pmPIHFVY.js.map +1 -0
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +101 -416
- package/dist/mcp/index.js +122 -206
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.js +231 -1
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/model-policy-CyCUwHed.js.map +1 -1
- package/dist/placement.d.ts +2 -9
- package/dist/placement.js +1 -1
- package/dist/placement.js.map +1 -1
- package/dist/platform.d.ts +194 -2
- package/dist/platform.js +145 -9
- package/dist/platform.js.map +1 -1
- package/dist/{prepare-CER-ZkPp.js → prepare-bXkvPMJA.js} +1213 -710
- package/dist/prepare-bXkvPMJA.js.map +1 -0
- package/dist/{profile-gNUsHNIJ.js → profile-Dpei_Sq0.js} +89 -3
- package/dist/profile-Dpei_Sq0.js.map +1 -0
- package/dist/{profile-materialization-BnoEf1co.d.ts → profile-materialization-B1wm2SPT.d.ts} +3 -5
- package/dist/profiles.d.ts +2 -2
- package/dist/profiles.js +4 -43
- package/dist/profiles.js.map +1 -1
- package/dist/{protected-model-port-BhpQRTw-.d.ts → protected-model-port-BGgpy2r9.d.ts} +4 -30
- package/dist/protected-redaction-DFCeo4vg.js.map +1 -1
- package/dist/{provision-supervisor-DGegCUH4.js → provision-supervisor-CJ6Zz6dz.js} +13 -10
- package/dist/provision-supervisor-CJ6Zz6dz.js.map +1 -0
- package/dist/record-value-B6bwJxLa.js +12 -0
- package/dist/record-value-B6bwJxLa.js.map +1 -0
- package/dist/{run-layout-Cu8H7aeh.js → run-cancellation-C9oL62sW.js} +175 -100
- package/dist/run-cancellation-C9oL62sW.js.map +1 -0
- package/dist/{runtime-BOGpotnH.js → runtime-B2fjL9Oi.js} +2639 -3187
- package/dist/runtime-B2fjL9Oi.js.map +1 -0
- package/dist/{runtime-hooks-Bj6wJHlH.d.ts → runtime-hooks-nsqxSUFL.d.ts} +2 -6
- package/dist/{sandbox-profile-compat-QTkLe1Z6.js → sandbox-profile-compat-BzVBFqrz.js} +690 -699
- package/dist/sandbox-profile-compat-BzVBFqrz.js.map +1 -0
- package/dist/search-executor-zMumiak_.js +1916 -0
- package/dist/search-executor-zMumiak_.js.map +1 -0
- package/dist/{server-hZWM-G8w.js → server-_4voDNrl.js} +362 -67
- package/dist/server-_4voDNrl.js.map +1 -0
- package/dist/{search-executor-Cm1WZmL-.js → structural-rollout-DpLCXzaL.js} +1680 -3403
- package/dist/structural-rollout-DpLCXzaL.js.map +1 -0
- package/dist/{substrate-B0TYNrXn.js → substrate-CGDFTSRh.js} +2 -9
- package/dist/substrate-CGDFTSRh.js.map +1 -0
- package/dist/{supervise-CvAKVfue.js → supervise-qAwXmPtD.js} +7768 -5360
- package/dist/supervise-qAwXmPtD.js.map +1 -0
- package/dist/{supervisor-Rz8AGpYb.js → supervisor-DHrUJhEZ.js} +26301 -26964
- package/dist/supervisor-DHrUJhEZ.js.map +1 -0
- package/dist/testing.d.ts +227 -2
- package/dist/testing.js +13 -14
- package/dist/testing.js.map +1 -1
- package/dist/tool-loop.d.ts +1 -1
- package/dist/{tool-server-Dqer2M4_.js → tool-server-XV4aJwoQ.js} +2 -2
- package/dist/tool-server-XV4aJwoQ.js.map +1 -0
- package/dist/top-snapshot-CbZE1JsU.js +502 -0
- package/dist/top-snapshot-CbZE1JsU.js.map +1 -0
- package/dist/tui/bin.js +711 -1
- package/dist/tui/bin.js.map +1 -1
- package/dist/tui/index.d.ts +5 -71
- package/dist/tui/index.js +3 -3
- package/dist/{types-Dl5L4r8Z.d.ts → types-CaOXqRTq.d.ts} +16230 -17376
- package/dist/workspace-store/index.d.ts +2 -27
- package/dist/workspace-store/index.js +2 -2
- package/dist/workspace-store/index.js.map +1 -1
- package/dist/{workspace-streams-JLjh5DC6.d.ts → workspace-streams-BiS4ABah.d.ts} +19 -32
- package/package.json +2 -2
- package/skills/agent-graphs/SKILL.md +10 -3
- package/skills/agent-graphs/references/authoring.md +18 -0
- package/skills/profile-authoring/SKILL.md +3 -3
- package/skills/supervise/SKILL.md +2 -2
- package/dist/activation-BDP6Eivv.js +0 -234
- package/dist/activation-BDP6Eivv.js.map +0 -1
- package/dist/coder-yhVWbdWc.js +0 -40
- package/dist/coder-yhVWbdWc.js.map +0 -1
- package/dist/coordination-driver-BHkFVqIq.js.map +0 -1
- package/dist/delegation-status-CF4D0NZ_.js +0 -358
- package/dist/delegation-status-CF4D0NZ_.js.map +0 -1
- package/dist/durable-file-B_eJr6Mb.js.map +0 -1
- package/dist/graph-C4RFlWAJ.js.map +0 -1
- package/dist/graph-registry-DAI6KNXB.js.map +0 -1
- package/dist/improvement-cycle-D1I4hQvf.js.map +0 -1
- package/dist/integrations-DopfCC2a.d.ts +0 -190
- package/dist/integrations-dFi-ALk7.js +0 -132
- package/dist/integrations-dFi-ALk7.js.map +0 -1
- package/dist/kb-gate-C8z2juK8.d.ts +0 -80
- package/dist/kb-gate-DpaSwXVx.js +0 -80
- package/dist/kb-gate-DpaSwXVx.js.map +0 -1
- package/dist/loop-runner-bin-DOuBIJ2O.d.ts +0 -164
- package/dist/loop-runner-bin-Dv5QvYDH.js +0 -246
- package/dist/loop-runner-bin-Dv5QvYDH.js.map +0 -1
- package/dist/memory-server-DXQ8IxGR.js +0 -234
- package/dist/memory-server-DXQ8IxGR.js.map +0 -1
- package/dist/openai-tools-DoQ32vpe.js +0 -44
- package/dist/openai-tools-DoQ32vpe.js.map +0 -1
- package/dist/openai-tools-Oxk4KQrY.d.ts +0 -24
- package/dist/prepare-CER-ZkPp.js.map +0 -1
- package/dist/profile-gNUsHNIJ.js.map +0 -1
- package/dist/protected-model-port-BuRsviSL.js +0 -766
- package/dist/protected-model-port-BuRsviSL.js.map +0 -1
- package/dist/provision-supervisor-DGegCUH4.js.map +0 -1
- package/dist/run-layout-Cu8H7aeh.js.map +0 -1
- package/dist/runtime-BOGpotnH.js.map +0 -1
- package/dist/sandbox-profile-compat-QTkLe1Z6.js.map +0 -1
- package/dist/search-executor-Cm1WZmL-.js.map +0 -1
- package/dist/server-hZWM-G8w.js.map +0 -1
- package/dist/substrate-B0TYNrXn.js.map +0 -1
- package/dist/supervise-CvAKVfue.js.map +0 -1
- package/dist/supervisor-Rz8AGpYb.js.map +0 -1
- package/dist/tool-server-Dqer2M4_.js.map +0 -1
- package/dist/top-app-BaMw1W2z.js +0 -1212
- package/dist/top-app-BaMw1W2z.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as
|
|
3
|
-
import { AgentCandidateArtifactRef, AgentCandidateBundle, AgentCandidateCapturedArtifact, AgentCandidateCodeDisabled, AgentCandidateCodeNoOp, AgentCandidateExecution, AgentCandidateGitHubRepository, AgentCandidateKnowledge, AgentCandidateMemoryPolicy, AgentCandidateProfile, AgentCandidateResolvedModel,
|
|
4
|
-
import { TraceStore } from "@tangle-network/agent-eval";
|
|
1
|
+
import { $ as VerifiedAgentCandidate, A as AgentCandidateMemoryResetResult, B as AgentCandidateRepositoryPort, C as AgentCandidateExecutorProfileFile, D as AgentCandidateExecutorWorkspaceFile, E as AgentCandidateExecutorTaskOutcomeCapture, F as AgentCandidateProtectedModelActivation, G as CanonicalCandidateDocument, H as AgentCandidateTaskExecution, I as AgentCandidateProtectedModelReservation, J as PreparedAgentCandidateInstruction, K as PersistedTaskOutcomeEvidence, L as AgentCandidateProtectedModelSettlement, M as AgentCandidateModelPort, N as AgentCandidateOutputArtifactPort, O as AgentCandidateExecutorWorkspaceInput, P as AgentCandidateOutputPurpose, Q as ResolvedAgentCandidateContainer, R as AgentCandidateProtectedModelSettlementCall, S as AgentCandidateExecutorPort, T as AgentCandidateExecutorStopRequest, U as AgentCandidateVerificationPorts, V as AgentCandidateRunFinalization, W as AgentCandidateWorkspacePort, X as PreparedAgentCandidateLaunch, Y as PreparedAgentCandidateKnowledge, Z as PreparedAgentCandidateTrace, _ as AgentCandidateBenchmarkGraderPort, a as captureAgentCandidateWorkspaceTreeToArtifacts, b as AgentCandidateExecutorFinalCapture, c as verifyAgentCandidateWorkspaceTree, d as captureAgentCandidateWorkspaceFiles, et as VerifiedAgentCandidateTaskOutcome, f as CaptureAgentCandidateWorkspaceOptions, g as AgentCandidateArtifactPort, h as createAgentCandidateWorkspacePort, i as captureAgentCandidateWorkspaceToArtifacts, j as AgentCandidateModelLimits, k as AgentCandidateMemoryPort, l as AgentCandidateWorkspaceArchiveLimits, m as captureAgentCandidateWorkspace, n as AgentCandidateWorkspaceTree, o as materializeAgentCandidateWorkspaceFromArtifacts, p as CreateAgentCandidateWorkspacePortOptions, q as PreparedAgentCandidateExecution, r as CaptureAgentCandidateWorkspaceToArtifactsOptions, s as verifyAgentCandidateWorkspaceArtifacts, t as AgentCandidateWorkspaceArtifactsOptions, tt as AgentCandidateExecutionRoots, u as CapturedAgentCandidateWorkspace, v as AgentCandidateContainerPort, w as AgentCandidateExecutorRequest, x as AgentCandidateExecutorMemoryCapture, y as AgentCandidateExecutionPorts, z as AgentCandidateProtectedRunCapture } from "../workspace-streams-BiS4ABah.js";
|
|
2
|
+
import { A as AgentCandidateExecutionStageResult, C as AgentCandidateExecutionCleanupHandles, D as AgentCandidateExecutionPhase, E as AgentCandidateExecutionLease, M as AgentCandidateExecutionTerminalResult, N as AgentCandidateRetryRejection, O as AgentCandidateExecutionPhaseResult, P as AgentCandidatePreparationEvidence, S as AgentCandidateExecutionClaimStore, T as AgentCandidateExecutionFinishResult, _ as executePreparedAgentCandidate, a as createProtectedAgentCandidateModelPort, b as AgentCandidateExecutionClaim, c as assertCandidateProfileBinding, f as parseExactAgentProfileDiff, g as ExecutePreparedAgentCandidateOptions, h as prepareAgentCandidateExecution, i as CreateProtectedAgentCandidateModelPortOptions, j as AgentCandidateExecutionTerminalRecord, k as AgentCandidateExecutionRecoveryEvidence, l as freezeGenericAgentCandidateProfile, n as AgentCandidateModelGrantClient, o as agentCandidateProfileAsAgentProfile, p as parseExactCandidateProfile, r as AgentCandidateModelGrantReserveInput, s as applyExactAgentProfileDiff, t as AgentCandidateModelGrantActivateInput, u as omitUndefinedObjectFields, v as AgentCandidateExecutionAttemptRecord, w as AgentCandidateExecutionFailureClass, x as AgentCandidateExecutionClaimResult, y as AgentCandidateExecutionAttemptRef } from "../protected-model-port-BGgpy2r9.js";
|
|
3
|
+
import { AgentCandidateArtifactRef, AgentCandidateBundle, AgentCandidateCapturedArtifact, AgentCandidateCodeDisabled, AgentCandidateCodeNoOp, AgentCandidateExecution, AgentCandidateGitHubRepository, AgentCandidateKnowledge, AgentCandidateMemoryPolicy, AgentCandidateProfile, AgentCandidateResolvedModel, AgentCandidateWorkspaceManifestMaterial, AgentCandidateWorkspaceSnapshotEvidence, AgentProfile, AgentProfileDiff, Sha256Digest } from "@tangle-network/agent-interface";
|
|
5
4
|
import { CodeSurface } from "@tangle-network/agent-eval/campaign";
|
|
6
5
|
import { AgentEnvironmentProvider, AgentExactProcessResources } from "@tangle-network/agent-interface/environment-provider";
|
|
7
6
|
//#region src/candidate-execution/artifacts.d.ts
|
|
@@ -35,14 +34,6 @@ interface WorkspaceScanOptions {
|
|
|
35
34
|
*/
|
|
36
35
|
readonly portableTree?: boolean;
|
|
37
36
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Refuse a materialized workspace whose files, modes, or bytes are not the signed manifest.
|
|
40
|
-
*
|
|
41
|
-
* The scan streams, so the size of the largest file does not decide whether the check can run, and
|
|
42
|
-
* the refusal names the one mismatch a caller can produce on its own: a capture and a verify that
|
|
43
|
-
* disagree about `portableTree`.
|
|
44
|
-
*/
|
|
45
|
-
declare function verifyMaterializedWorkspace(root: string, expected: AgentCandidateWorkspaceManifestMaterial, options?: Omit<WorkspaceScanOptions, 'limits'>): Promise<void>;
|
|
46
37
|
/**
|
|
47
38
|
* The canonical manifest of one materialized workspace, read without holding any file.
|
|
48
39
|
*
|
|
@@ -161,26 +152,6 @@ interface ExactProcessCandidateExecutorOptions {
|
|
|
161
152
|
/** Adapt one neutral exact-process provider to Runtime's trusted candidate boundary. */
|
|
162
153
|
declare function exactProcessProviderAsCandidateExecutor(options: ExactProcessCandidateExecutorOptions): AgentCandidateExecutorPort;
|
|
163
154
|
//#endregion
|
|
164
|
-
//#region src/candidate-execution/knowledge.d.ts
|
|
165
|
-
/** Environment variable containing the materialized candidate knowledge root. */
|
|
166
|
-
declare const CANDIDATE_KNOWLEDGE_ROOT_ENV = "TANGLE_CANDIDATE_KNOWLEDGE_ROOT";
|
|
167
|
-
/** Environment variable containing the materialized retrieval configuration path. */
|
|
168
|
-
declare const CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV = "TANGLE_CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG";
|
|
169
|
-
/** Deterministic, signed locations used by every candidate executor. */
|
|
170
|
-
declare function candidateKnowledgeExecutionPaths(taskRoot: string, hasRetrievalConfig: boolean): {
|
|
171
|
-
root: string;
|
|
172
|
-
retrievalConfig?: string;
|
|
173
|
-
};
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/candidate-execution/output-artifacts.d.ts
|
|
176
|
-
/** Persist evaluator evidence, read it back, and bind the returned locator to the exact bytes. */
|
|
177
|
-
declare function persistCandidateOutputArtifact(port: AgentCandidateOutputArtifactPort, input: {
|
|
178
|
-
executionId: string;
|
|
179
|
-
purpose: AgentCandidateOutputPurpose;
|
|
180
|
-
bytes: Uint8Array;
|
|
181
|
-
signal?: AbortSignal;
|
|
182
|
-
}): Promise<AgentCandidateArtifactRef>;
|
|
183
|
-
//#endregion
|
|
184
155
|
//#region src/candidate-execution/protected-model-grant.d.ts
|
|
185
156
|
/** Reservation fields supplied by a caller before Runtime resolves the model. */
|
|
186
157
|
type AgentCandidateModelGrantRunReservationInput = Omit<AgentCandidateModelGrantReserveInput, 'resolved'>;
|
|
@@ -220,37 +191,7 @@ interface RunProtectedAgentCandidateModelGrantResult<TResult> {
|
|
|
220
191
|
*/
|
|
221
192
|
declare function runProtectedAgentCandidateModelGrant<TResult>(options: RunProtectedAgentCandidateModelGrantOptions<TResult>): Promise<RunProtectedAgentCandidateModelGrantResult<TResult>>;
|
|
222
193
|
//#endregion
|
|
223
|
-
//#region src/candidate-execution/recover.d.ts
|
|
224
|
-
interface RecoverExpiredAgentCandidateOptions {
|
|
225
|
-
attempt: AgentCandidateExecutionAttemptRef;
|
|
226
|
-
claimStore: AgentCandidateExecutionClaimStore;
|
|
227
|
-
executor: AgentCandidateExecutorPort;
|
|
228
|
-
traceStore: TraceStore;
|
|
229
|
-
ports: Pick<AgentCandidateExecutionPorts, 'models' | 'memory'>;
|
|
230
|
-
outputArtifacts: AgentCandidateOutputArtifactPort;
|
|
231
|
-
cleanupTimeoutMs?: number;
|
|
232
|
-
/** Evaluator clock; must be the same clock used by the claim store. */
|
|
233
|
-
now?: () => number;
|
|
234
|
-
}
|
|
235
|
-
/** Close an expired crashed attempt from persisted non-secret handles, then record failure. */
|
|
236
|
-
declare function recoverExpiredAgentCandidateExecution(options: RecoverExpiredAgentCandidateOptions): Promise<AgentCandidateExecutionFinishResult>;
|
|
237
|
-
//#endregion
|
|
238
194
|
//#region src/candidate-execution/verify.d.ts
|
|
239
|
-
/** Surfaces admitted by Runtime's verifier before an environment adapter is selected. */
|
|
240
|
-
declare const AGENT_CANDIDATE_EXECUTION_SUPPORT: Readonly<{
|
|
241
|
-
outcomes: readonly ["workspace", "output"];
|
|
242
|
-
code: readonly ["disabled", "no-op", "git-patch"];
|
|
243
|
-
memory: readonly ["disabled", "isolated"];
|
|
244
|
-
knowledge: true;
|
|
245
|
-
profile: Readonly<{
|
|
246
|
-
mcpTransports: readonly ["stdio"];
|
|
247
|
-
remoteMcp: false;
|
|
248
|
-
tools: false;
|
|
249
|
-
permissions: false;
|
|
250
|
-
modes: false;
|
|
251
|
-
confidential: false;
|
|
252
|
-
}>;
|
|
253
|
-
}>;
|
|
254
195
|
/** Verifies every digest, resource, workspace, and Git object in a candidate bundle. */
|
|
255
196
|
declare function verifyAgentCandidateBundle(input: unknown, ports: AgentCandidateVerificationPorts): Promise<VerifiedAgentCandidate>;
|
|
256
197
|
//#endregion
|
|
@@ -375,5 +316,5 @@ declare function describeWorkspaceTree(directory: string, options?: DescribeWork
|
|
|
375
316
|
*/
|
|
376
317
|
declare function seedWorkspaceTree(input: SeedWorkspaceTreeInput): Promise<WorkspaceTreeDescriptor>;
|
|
377
318
|
//#endregion
|
|
378
|
-
export {
|
|
319
|
+
export { type AgentCandidateArtifactPort, type AgentCandidateBenchmarkGraderPort, type AgentCandidateBundleInput, type AgentCandidateCodeSource, type AgentCandidateCodeSurfaceSource, type AgentCandidateContainerPort, type AgentCandidateExecutionAttemptRecord, type AgentCandidateExecutionAttemptRef, type AgentCandidateExecutionClaim, type AgentCandidateExecutionClaimResult, type AgentCandidateExecutionClaimStore, type AgentCandidateExecutionCleanupHandles, type AgentCandidateExecutionFailureClass, type AgentCandidateExecutionFinishResult, type AgentCandidateExecutionLease, type AgentCandidateExecutionPhase, type AgentCandidateExecutionPhaseResult, type AgentCandidateExecutionPorts, type AgentCandidateExecutionRecoveryEvidence, type AgentCandidateExecutionRoots, type AgentCandidateExecutionStageResult, type AgentCandidateExecutionTerminalRecord, type AgentCandidateExecutionTerminalResult, type AgentCandidateExecutorFinalCapture, type AgentCandidateExecutorMemoryCapture, type AgentCandidateExecutorPort, type AgentCandidateExecutorProfileFile, type AgentCandidateExecutorRequest, type AgentCandidateExecutorStopRequest, type AgentCandidateExecutorTaskOutcomeCapture, type AgentCandidateExecutorWorkspaceFile, type AgentCandidateExecutorWorkspaceInput, type AgentCandidateMemoryPort, type AgentCandidateMemoryResetResult, type AgentCandidateModelGrantClient, type AgentCandidateModelGrantReserveInput, type AgentCandidateModelGrantRunReservationInput, type AgentCandidateModelLimits, type AgentCandidateModelPort, type AgentCandidateOutputArtifactPort, type AgentCandidateOutputPurpose, type AgentCandidatePreparationEvidence, type AgentCandidateProfileSource, type AgentCandidateProtectedModelActivation, type AgentCandidateProtectedModelReservation, type AgentCandidateProtectedModelSettlement, type AgentCandidateProtectedModelSettlementCall, type AgentCandidateProtectedRunCapture, type AgentCandidateRepositoryPort, type AgentCandidateRetryRejection, type AgentCandidateRunFinalization, type AgentCandidateTaskExecution, type AgentCandidateVerificationPorts, type AgentCandidateWorkspaceArtifactsOptions, type AgentCandidateWorkspacePort, type AgentCandidateWorkspaceSnapshotReferences, type AgentCandidateWorkspaceTree, type BuildAgentCandidateBundleInput, type CanonicalCandidateDocument, type CaptureAgentCandidateWorkspaceOptions, type CaptureAgentCandidateWorkspaceToArtifactsOptions, type CaptureAgentWorkspaceSnapshotOptions, type CapturedAgentCandidateWorkspace, type CreateAgentCandidateWorkspacePortOptions, type CreateProtectedAgentCandidateModelPortOptions, type DescribeWorkspaceTreeOptions, type DisposePreparedAgentCandidateOptions, type ExactProcessCandidateExecutorOptions, type ExecutePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, type FileAgentCandidateExecutionClaimStoreOptions, type MaterializeAgentWorkspaceSnapshotOptions, type PersistedTaskOutcomeEvidence, type PreparedAgentCandidateExecution, type PreparedAgentCandidateInstruction, type PreparedAgentCandidateKnowledge, type PreparedAgentCandidateLaunch, type PreparedAgentCandidateTrace, type ProtectedAgentCandidateModelGrantContext, type ResolvedAgentCandidateContainer, type RunProtectedAgentCandidateModelGrantOptions, type RunProtectedAgentCandidateModelGrantResult, type SeedWorkspaceTreeInput, type VerifiedAgentCandidate, type VerifiedAgentCandidateTaskOutcome, type WorkspaceScanLimits, type WorkspaceScanOptions, type WorkspaceTreeAlgorithm, type WorkspaceTreeDescriptor, type WorkspaceTreeEntryPolicy, type WorkspaceTreeExclusion, type WorkspaceTreeExclusionReason, agentCandidateProfileAsAgentProfile, applyExactAgentProfileDiff, assertCandidateProfileBinding, buildAgentCandidateBundle, candidateWorkspaceManifest, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, captureAgentCandidateWorkspaceToArtifacts, captureAgentCandidateWorkspaceTreeToArtifacts, captureAgentWorkspaceSnapshot, createAgentCandidateWorkspacePort, createProtectedAgentCandidateModelPort, describeWorkspaceTree, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, freezeGenericAgentCandidateProfile, materializeAgentCandidateWorkspaceFromArtifacts, materializeAgentWorkspaceSnapshot, omitUndefinedObjectFields, parseExactAgentProfileDiff, parseExactCandidateProfile, prepareAgentCandidateExecution, runProtectedAgentCandidateModelGrant, scanMaterializedWorkspaceManifest, sealAgentCandidateBundle, seedWorkspaceTree, verifyAgentCandidateBundle, verifyAgentCandidateWorkspaceArtifacts, verifyAgentCandidateWorkspaceTree };
|
|
379
320
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { agentCandidateArtifactRefSchema, agentCandidateExecutionPlanMaterialSchema, agentCandidateMaterializationReceiptSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema } from "@tangle-network/agent-interface";
|
|
1
|
+
import { C as candidateWorkspaceManifest, D as scanMaterializedWorkspaceManifest, L as deepFreezeCandidate, N as verifiedArtifactChunks, P as canonicalCandidateBytes$1, R as embeddedCandidateArtifact, _ as workspaceLimits, a as materializeAgentCandidateWorkspaceFromArtifacts, c as verifyAgentCandidateWorkspaceTree, h as captureAgentCandidateWorkspaceFiles, i as captureAgentCandidateWorkspaceTreeToArtifacts, l as captureAgentCandidateWorkspace, r as captureAgentCandidateWorkspaceToArtifacts, s as verifyAgentCandidateWorkspaceArtifacts, u as createAgentCandidateWorkspacePort } from "../sandbox-profile-compat-BzVBFqrz.js";
|
|
2
|
+
import { a as applyExactAgentProfileDiff, b as parseExactCandidateProfile, g as omitUndefinedObjectFields, i as agentCandidateProfileAsAgentProfile, o as assertCandidateProfileBinding, p as freezeGenericAgentCandidateProfile, v as parseExactAgentProfile, y as parseExactAgentProfileDiff } from "../profile-Dpei_Sq0.js";
|
|
3
|
+
import { t as sealAgentCandidateBundle } from "../bundle-DVOhBTic.js";
|
|
4
|
+
import { _ as sealTerminalDigest, a as consumePreparedCandidateExecution, b as sealAgentCandidateModelSettlement, c as withinCandidateCleanupDeadline, d as assertTerminalMatchesClaim, f as assertTerminalMatchesStaged, g as requireStagedTerminal, h as rejectedStage, i as beginPreparedCandidateDisposal, l as assertRecoveryMatchesStaged, m as rejectedFinish, n as executePreparedAgentCandidate, o as candidateClaimFileInternals, p as recoveredTerminalRecord, r as assertPreparedCandidateIntegrity, s as candidateCleanupDeadline, t as prepareAgentCandidateExecution, u as assertTerminalAllowedInPhase, v as terminalRecord, w as verifyAgentCandidateBundle, x as exactProcessProviderAsCandidateExecutor, y as createProtectedAgentCandidateModelPort } from "../prepare-bXkvPMJA.js";
|
|
5
|
+
import { agentCandidateArtifactRefSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema } from "@tangle-network/agent-interface";
|
|
7
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
7
|
import { constants, linkSync } from "node:fs";
|
|
9
8
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
@@ -440,145 +439,6 @@ function isCandidateGrantDrainingError(error) {
|
|
|
440
439
|
return typeof candidate.message === "string" && /\bcandidate_grant_draining\b/u.test(candidate.message);
|
|
441
440
|
}
|
|
442
441
|
//#endregion
|
|
443
|
-
//#region src/candidate-execution/recover.ts
|
|
444
|
-
/** Close an expired crashed attempt from persisted non-secret handles, then record failure. */
|
|
445
|
-
async function recoverExpiredAgentCandidateExecution(options) {
|
|
446
|
-
const record = await options.claimStore.getAttempt(options.attempt);
|
|
447
|
-
if (!record) throw new Error("candidate execution recovery attempt is missing");
|
|
448
|
-
if (record.terminal) return Object.freeze({
|
|
449
|
-
finished: false,
|
|
450
|
-
terminal: record.terminal,
|
|
451
|
-
exactReplay: true
|
|
452
|
-
});
|
|
453
|
-
const cleanupTimeoutMs = candidateCleanupTimeout(options.cleanupTimeoutMs ?? record.claim.cleanup.cleanupTimeoutMs);
|
|
454
|
-
if (cleanupTimeoutMs > record.claim.cleanup.cleanupTimeoutMs) throw new Error("recovery cleanup timeout exceeds the frozen preparation bound");
|
|
455
|
-
if ((options.now ?? Date.now)() < record.claim.leaseExpiresAtMs) throw new Error("candidate execution lease has not expired");
|
|
456
|
-
const cleanupDeadlineAtMs = candidateCleanupDeadline(cleanupTimeoutMs);
|
|
457
|
-
const recoveryTraceStore = new RecoveryAgentCandidateTraceStore(options.traceStore);
|
|
458
|
-
const preparation = withinCandidateCleanupDeadline(() => readRecoveryPreparation(record.claim, options.outputArtifacts), cleanupDeadlineAtMs, "expired candidate preparation evidence read");
|
|
459
|
-
const processClosure = withinCandidateCleanupDeadline(async (cleanupSignal) => {
|
|
460
|
-
sealAgentCandidateExecutorStopAcknowledgement(await options.executor.stop({
|
|
461
|
-
executionId: record.claim.executionId,
|
|
462
|
-
executionPlanDigest: record.claim.executionPlanDigest
|
|
463
|
-
}, {
|
|
464
|
-
traceStore: recoveryTraceStore,
|
|
465
|
-
reason: "failed",
|
|
466
|
-
signal: cleanupSignal,
|
|
467
|
-
deadlineAtMs: cleanupDeadlineAtMs
|
|
468
|
-
}));
|
|
469
|
-
if (options.executor.dispose) {
|
|
470
|
-
const disposed = await options.executor.dispose({
|
|
471
|
-
executionId: record.claim.executionId,
|
|
472
|
-
executionPlanDigest: record.claim.executionPlanDigest
|
|
473
|
-
}, { signal: cleanupSignal });
|
|
474
|
-
if (disposed.disposed !== true || Object.keys(disposed).some((key) => key !== "disposed")) throw new Error("expired candidate executor did not acknowledge resource disposal");
|
|
475
|
-
}
|
|
476
|
-
return { stopped: true };
|
|
477
|
-
}, cleanupDeadlineAtMs, "expired candidate process termination");
|
|
478
|
-
const modelClosure = withinCandidateCleanupDeadline(async () => sealAgentCandidateModelSettlement(await options.ports.models.settleGrant({
|
|
479
|
-
executionId: record.claim.executionId,
|
|
480
|
-
preparationId: record.claim.cleanup.preparationId,
|
|
481
|
-
grantDigest: record.claim.cleanup.modelGrantDigest,
|
|
482
|
-
resolved: record.claim.cleanup.resolvedModel,
|
|
483
|
-
reason: "failed"
|
|
484
|
-
}), {
|
|
485
|
-
preparationId: record.claim.cleanup.preparationId,
|
|
486
|
-
grantDigest: record.claim.cleanup.modelGrantDigest,
|
|
487
|
-
model: record.claim.cleanup.resolvedModel.model
|
|
488
|
-
}), cleanupDeadlineAtMs, "expired candidate model settlement");
|
|
489
|
-
const memoryClosure = record.claim.cleanup.memory ? withinCandidateCleanupDeadline(async () => {
|
|
490
|
-
const memory = record.claim.cleanup.memory;
|
|
491
|
-
if (!memory) throw new Error("expired candidate memory handle is missing");
|
|
492
|
-
const closed = await options.ports.memory.close({
|
|
493
|
-
executionId: record.claim.executionId,
|
|
494
|
-
preparationId: record.claim.cleanup.preparationId,
|
|
495
|
-
accessDigest: memory.accessDigest,
|
|
496
|
-
effectiveNamespace: memory.effectiveNamespace,
|
|
497
|
-
reason: "failed"
|
|
498
|
-
});
|
|
499
|
-
if (closed.closed !== true || Object.keys(closed).some((key) => key !== "closed")) throw new Error("expired candidate memory did not acknowledge closure");
|
|
500
|
-
return { closed: true };
|
|
501
|
-
}, cleanupDeadlineAtMs, "expired candidate memory closure") : void 0;
|
|
502
|
-
const closureOutcomes = Promise.allSettled([modelClosure, memoryClosure ?? Promise.resolve(void 0)]);
|
|
503
|
-
const [preparationOutcome, processOutcome] = await Promise.allSettled([preparation, processClosure]);
|
|
504
|
-
const failures = [preparationOutcome, processOutcome].filter((outcome) => outcome.status === "rejected").map((outcome) => outcome.reason);
|
|
505
|
-
const [modelOutcome, memoryOutcome] = await closureOutcomes;
|
|
506
|
-
for (const outcome of [modelOutcome, memoryOutcome]) if (outcome.status === "rejected") failures.push(outcome.reason);
|
|
507
|
-
if (failures.length > 0) throw new AggregateError(failures, "expired candidate cleanup could not be proven");
|
|
508
|
-
if (modelOutcome.status !== "fulfilled") throw new Error("expired candidate model settlement was not recovered");
|
|
509
|
-
const model = modelOutcome.value;
|
|
510
|
-
const modelSettlement = await withinCandidateCleanupDeadline(() => persistCandidateModelSettlementEvidence({
|
|
511
|
-
executionId: record.claim.executionId,
|
|
512
|
-
executionPlanDigest: record.claim.executionPlanDigest,
|
|
513
|
-
resolvedModel: record.claim.cleanup.resolvedModel
|
|
514
|
-
}, model, options.outputArtifacts), cleanupDeadlineAtMs, "expired candidate model-settlement persistence");
|
|
515
|
-
const failureClass = record.phase === "claimed" && model.usage.modelCalls === 0 ? "pre-model-infrastructure" : "unknown";
|
|
516
|
-
const failureEvidence = await withinCandidateCleanupDeadline(() => persistCandidateOutputArtifact(options.outputArtifacts, {
|
|
517
|
-
executionId: record.claim.executionId,
|
|
518
|
-
purpose: "failure-evidence",
|
|
519
|
-
bytes: canonicalCandidateBytes$1({
|
|
520
|
-
kind: "agent-candidate-recovery-failure",
|
|
521
|
-
executionId: record.claim.executionId,
|
|
522
|
-
attempt: record.claim.attempt,
|
|
523
|
-
bundleDigest: record.claim.bundleDigest,
|
|
524
|
-
executionPlanDigest: record.claim.executionPlanDigest,
|
|
525
|
-
materializationReceiptDigest: record.claim.preparationEvidence.materializationReceipt.sha256,
|
|
526
|
-
failureClass,
|
|
527
|
-
processStopped: true,
|
|
528
|
-
modelSettlementDigest: modelSettlement.digest,
|
|
529
|
-
memoryClosed: record.claim.cleanup.memory !== void 0
|
|
530
|
-
})
|
|
531
|
-
}), cleanupDeadlineAtMs, "expired candidate failure-evidence persistence");
|
|
532
|
-
const memory = record.claim.cleanup.memory;
|
|
533
|
-
return await options.claimStore.recoverExpired(options.attempt, {
|
|
534
|
-
failureClass,
|
|
535
|
-
usage: model.usage,
|
|
536
|
-
modelSettlement: modelSettlement.artifact,
|
|
537
|
-
failureEvidence,
|
|
538
|
-
process: {
|
|
539
|
-
stopped: true,
|
|
540
|
-
executionPlanDigest: record.claim.executionPlanDigest
|
|
541
|
-
},
|
|
542
|
-
model: {
|
|
543
|
-
closed: true,
|
|
544
|
-
preparationId: record.claim.cleanup.preparationId,
|
|
545
|
-
grantDigest: record.claim.cleanup.modelGrantDigest
|
|
546
|
-
},
|
|
547
|
-
...memory ? { memory: {
|
|
548
|
-
closed: true,
|
|
549
|
-
preparationId: record.claim.cleanup.preparationId,
|
|
550
|
-
accessDigest: memory.accessDigest,
|
|
551
|
-
effectiveNamespace: memory.effectiveNamespace
|
|
552
|
-
} } : {}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
async function readRecoveryPreparation(claim, artifacts) {
|
|
556
|
-
const [planBytes, receiptBytes] = await Promise.all([readVerifiedArtifact(claim.preparationEvidence.executionPlan, artifacts), readVerifiedArtifact(claim.preparationEvidence.materializationReceipt, artifacts)]);
|
|
557
|
-
const plan = agentCandidateExecutionPlanMaterialSchema.parse(parseCanonicalBytes(planBytes, "plan"));
|
|
558
|
-
if (claim.preparationEvidence.executionPlan.sha256 !== claim.executionPlanDigest) throw new Error("recovery execution plan artifact does not match the claimed digest");
|
|
559
|
-
const receiptMaterial = parseCanonicalBytes(receiptBytes, "materialization receipt");
|
|
560
|
-
const receipt = agentCandidateMaterializationReceiptSchema.parse({
|
|
561
|
-
...receiptMaterial,
|
|
562
|
-
digest: claim.preparationEvidence.materializationReceipt.sha256
|
|
563
|
-
});
|
|
564
|
-
if (receipt.bundleDigest !== claim.bundleDigest || receipt.executionPlan.digest !== claim.executionPlanDigest || plan.runCell.bundleDigest !== claim.bundleDigest || plan.executionId !== claim.executionId) throw new Error("recovery preparation evidence does not match the durable claim");
|
|
565
|
-
return {
|
|
566
|
-
plan,
|
|
567
|
-
receipt
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
function parseCanonicalBytes(bytes, label) {
|
|
571
|
-
let parsed;
|
|
572
|
-
try {
|
|
573
|
-
parsed = JSON.parse(Buffer.from(bytes).toString("utf8"));
|
|
574
|
-
} catch (error) {
|
|
575
|
-
throw new Error(`candidate recovery ${label} is not JSON`, { cause: error });
|
|
576
|
-
}
|
|
577
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`candidate recovery ${label} must be an object`);
|
|
578
|
-
if (!Buffer.from(canonicalCandidateBytes$1(parsed)).equals(Buffer.from(bytes))) throw new Error(`candidate recovery ${label} bytes are not canonical`);
|
|
579
|
-
return parsed;
|
|
580
|
-
}
|
|
581
|
-
//#endregion
|
|
582
442
|
//#region src/candidate-execution/workspace-transfer.ts
|
|
583
443
|
/**
|
|
584
444
|
* Capture through the canonical archive owner and return references only.
|
|
@@ -904,6 +764,6 @@ async function lstatIfPresent(path) {
|
|
|
904
764
|
}
|
|
905
765
|
}
|
|
906
766
|
//#endregion
|
|
907
|
-
export {
|
|
767
|
+
export { FileAgentCandidateExecutionClaimStore, agentCandidateProfileAsAgentProfile, applyExactAgentProfileDiff, assertCandidateProfileBinding, buildAgentCandidateBundle, candidateWorkspaceManifest, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, captureAgentCandidateWorkspaceToArtifacts, captureAgentCandidateWorkspaceTreeToArtifacts, captureAgentWorkspaceSnapshot, createAgentCandidateWorkspacePort, createProtectedAgentCandidateModelPort, describeWorkspaceTree, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, freezeGenericAgentCandidateProfile, materializeAgentCandidateWorkspaceFromArtifacts, materializeAgentWorkspaceSnapshot, omitUndefinedObjectFields, parseExactAgentProfileDiff, parseExactCandidateProfile, prepareAgentCandidateExecution, runProtectedAgentCandidateModelGrant, scanMaterializedWorkspaceManifest, sealAgentCandidateBundle, seedWorkspaceTree, verifyAgentCandidateBundle, verifyAgentCandidateWorkspaceArtifacts, verifyAgentCandidateWorkspaceTree };
|
|
908
768
|
|
|
909
769
|
//# sourceMappingURL=index.js.map
|