@tangle-network/agent-provider-tangle 0.13.3 → 0.14.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/README.md +92 -4
- package/dist/exact-process.js +5 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/tangle-capabilities.d.ts +14 -3
- package/dist/tangle-capabilities.js +46 -19
- package/dist/tangle-contract-safety.d.ts +2 -0
- package/dist/tangle-contract-safety.js +2 -0
- package/dist/tangle-environment.d.ts +2 -0
- package/dist/tangle-environment.js +18 -3
- package/dist/tangle-observation.js +1 -1
- package/dist/tangle-provider.js +51 -7
- package/dist/tangle-types.d.ts +115 -4
- package/dist/tangle-workspace-branching.d.ts +24 -0
- package/dist/tangle-workspace-branching.js +1287 -0
- package/package.json +6 -4
package/dist/tangle-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BackendRegistryEntry, BackendRegistryResponse, BackendType, CreateSandboxOptions, ExecResult as SandboxExecResult, PromptOptions, PromptResult, SandboxEvent } from "@tangle-network/sandbox";
|
|
2
|
-
import type { AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, AgentExecutionPreparationReceipt, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentProfile, InputPart, InteractionRequest, InteractionResponseCommand } from "@tangle-network/agent-interface";
|
|
2
|
+
import type { AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, AgentExecutionPreparationReceipt, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentProfile, ConfidentialAttestation, ConfidentialExecutionEnvironment, InputPart, InteractionRequest, InteractionResponseCommand } from "@tangle-network/agent-interface";
|
|
3
3
|
import type { AgentEnvironmentCapabilities, AgentEnvironmentProvider, CreateAgentEnvironmentInput } from "@tangle-network/agent-interface/environment-provider";
|
|
4
4
|
/**
|
|
5
5
|
* The platform verdict for the create call that returned a sandbox.
|
|
@@ -170,6 +170,86 @@ export interface SandboxProcessManagerLike {
|
|
|
170
170
|
export interface SandboxConnectionLike {
|
|
171
171
|
runtimeUrl?: string;
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* The keyed snapshot acknowledgement exposed by the Sandbox SDK.
|
|
175
|
+
*
|
|
176
|
+
* Every structural type below declares only the fields this adapter reads. A
|
|
177
|
+
* newer SDK may return more, and an unread field never becomes a contract.
|
|
178
|
+
*/
|
|
179
|
+
export interface SandboxSnapshotResultLike {
|
|
180
|
+
snapshotId: string;
|
|
181
|
+
createdAt: Date | string;
|
|
182
|
+
tags: string[];
|
|
183
|
+
idempotency?: {
|
|
184
|
+
outcome: "created" | "replayed";
|
|
185
|
+
requestDigest: string;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/** Snapshot metadata returned by the managed Sandbox storage service. */
|
|
189
|
+
export interface SandboxSnapshotInfoLike {
|
|
190
|
+
snapshotId: string;
|
|
191
|
+
sandboxId: string;
|
|
192
|
+
createdAt: Date | string;
|
|
193
|
+
tags: string[];
|
|
194
|
+
}
|
|
195
|
+
/** A deletion result must state what the platform actually did. */
|
|
196
|
+
export interface SandboxSnapshotDeleteAcknowledgementLike {
|
|
197
|
+
snapshotId: string;
|
|
198
|
+
outcome: "deleted" | "already_absent" | "unknown";
|
|
199
|
+
}
|
|
200
|
+
/** Result returned by the SDK's durable operation lookup route. */
|
|
201
|
+
export interface SandboxWorkspaceOperationLookupLike {
|
|
202
|
+
outcome: "found" | "not_found" | "conflict" | "unknown";
|
|
203
|
+
kind: "checkpoint" | "fork";
|
|
204
|
+
state?: "pending" | "succeeded" | "failed";
|
|
205
|
+
}
|
|
206
|
+
/** Fan-out acknowledgement returned by SandboxInstance.fork(). */
|
|
207
|
+
export interface SandboxForkAcknowledgementLike {
|
|
208
|
+
children: SandboxInstanceLike[];
|
|
209
|
+
requestedCount: number;
|
|
210
|
+
materializedCount: number;
|
|
211
|
+
complete: boolean;
|
|
212
|
+
idempotency?: {
|
|
213
|
+
outcome: "created" | "replayed";
|
|
214
|
+
requestDigest: string;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/** A forked Sandbox child can be destroyed with an explicit outcome. */
|
|
218
|
+
export interface SandboxDeleteAcknowledgementLike {
|
|
219
|
+
sandboxId: string;
|
|
220
|
+
outcome: "destroyed" | "already_absent" | "unknown";
|
|
221
|
+
}
|
|
222
|
+
/** Raw TEE evidence returned by Sandbox, before provider-key verification. */
|
|
223
|
+
export interface SandboxTeeAttestationReportLike {
|
|
224
|
+
tee_type: string;
|
|
225
|
+
evidence: number[];
|
|
226
|
+
measurement: number[];
|
|
227
|
+
timestamp: number;
|
|
228
|
+
}
|
|
229
|
+
export interface SandboxTeeAttestationResponseLike {
|
|
230
|
+
sandbox_id: string;
|
|
231
|
+
attestation: SandboxTeeAttestationReportLike;
|
|
232
|
+
attestationNonce?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Evidence returned by an external TEE verifier after it checks the raw quote.
|
|
236
|
+
* The provider never derives these fields from request metadata or the quote.
|
|
237
|
+
*/
|
|
238
|
+
export interface TangleConfidentialAttestationVerification {
|
|
239
|
+
providerKeyId: string;
|
|
240
|
+
providerSignature: string;
|
|
241
|
+
/** Optional verifier-normalized measurement, checked against raw evidence. */
|
|
242
|
+
measurement?: `sha256:${string}`;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Provider-owned trust boundary for TEE evidence.
|
|
246
|
+
* Return `null` when the quote, nonce, key, or policy is not trusted.
|
|
247
|
+
*/
|
|
248
|
+
export type TangleConfidentialAttestationVerifier = (input: {
|
|
249
|
+
report: SandboxTeeAttestationReportLike;
|
|
250
|
+
expected: ConfidentialExecutionEnvironment;
|
|
251
|
+
attestation: ConfidentialAttestation;
|
|
252
|
+
}) => TangleConfidentialAttestationVerification | null | Promise<TangleConfidentialAttestationVerification | null>;
|
|
173
253
|
/** Live cgroup sample for one sandbox. `null` fields mean the host reported none. */
|
|
174
254
|
export interface SandboxResourceUsageLike {
|
|
175
255
|
memoryCurrentMb: number;
|
|
@@ -316,6 +396,8 @@ export interface SandboxInstanceLike {
|
|
|
316
396
|
connection?: SandboxConnectionLike;
|
|
317
397
|
/** When the platform retires this sandbox, when it set a lifetime. */
|
|
318
398
|
expiresAt?: Date | string;
|
|
399
|
+
/** Stable platform creation time, returned by branch child descriptions. */
|
|
400
|
+
createdAt?: Date | string;
|
|
319
401
|
/** GPU lease attached at create time, when one was requested. */
|
|
320
402
|
gpuLease?: SandboxGpuLeaseLike;
|
|
321
403
|
streamPrompt(message: string | InputPart[], options?: PromptOptions): AsyncIterable<SandboxEvent>;
|
|
@@ -383,12 +465,39 @@ export interface SandboxInstanceLike {
|
|
|
383
465
|
* by id or when the platform reported no receipt.
|
|
384
466
|
*/
|
|
385
467
|
createReceipt?(): SandboxCreateReceiptLike | null;
|
|
386
|
-
refresh?(
|
|
387
|
-
signal?: AbortSignal;
|
|
388
|
-
}): Promise<void>;
|
|
468
|
+
refresh?(signal?: AbortSignal): Promise<void>;
|
|
389
469
|
delete?(options?: {
|
|
390
470
|
signal?: AbortSignal;
|
|
391
471
|
}): Promise<unknown>;
|
|
472
|
+
/** Managed whole-workspace checkpoint operation. */
|
|
473
|
+
snapshot?(options?: {
|
|
474
|
+
tags?: string[];
|
|
475
|
+
idempotencyKey?: string;
|
|
476
|
+
}): Promise<SandboxSnapshotResultLike>;
|
|
477
|
+
/** Recover checkpoint metadata after a provider process restart. */
|
|
478
|
+
listSnapshots?(): Promise<SandboxSnapshotInfoLike[]>;
|
|
479
|
+
/** Delete one managed checkpoint. */
|
|
480
|
+
deleteSnapshot?(snapshotId: string, options?: {
|
|
481
|
+
timeoutMs?: number;
|
|
482
|
+
}): Promise<SandboxSnapshotDeleteAcknowledgementLike>;
|
|
483
|
+
/** Ask the service for the state of a keyed checkpoint operation. */
|
|
484
|
+
getSnapshotOperation?(idempotencyKey: string, options?: {
|
|
485
|
+
tags?: string[];
|
|
486
|
+
}): Promise<SandboxWorkspaceOperationLookupLike>;
|
|
487
|
+
/** Managed copy-on-write fork operation. */
|
|
488
|
+
fork?(count: number, options?: {
|
|
489
|
+
metadata?: Record<string, unknown>;
|
|
490
|
+
idempotencyKey?: string;
|
|
491
|
+
}): Promise<SandboxForkAcknowledgementLike>;
|
|
492
|
+
/** Recover fork state after a provider process restart. */
|
|
493
|
+
getForkOperation?(idempotencyKey: string, options: {
|
|
494
|
+
count: number;
|
|
495
|
+
metadata?: Record<string, unknown>;
|
|
496
|
+
}): Promise<SandboxWorkspaceOperationLookupLike>;
|
|
497
|
+
/** Raw TEE quote and measurement; verification stays outside Sandbox. */
|
|
498
|
+
getTeeAttestation?(options?: {
|
|
499
|
+
attestationNonce?: string;
|
|
500
|
+
}): Promise<SandboxTeeAttestationResponseLike>;
|
|
392
501
|
}
|
|
393
502
|
export interface SandboxSessionLike {
|
|
394
503
|
readonly id: string;
|
|
@@ -463,4 +572,6 @@ export interface TangleProviderOptions {
|
|
|
463
572
|
validateProfile?: AgentEnvironmentProvider["validateProfile"];
|
|
464
573
|
mapCreateInput?: (input: CreateAgentEnvironmentInput) => CreateSandboxOptions;
|
|
465
574
|
exactProcess?: TangleExactProcessOptions;
|
|
575
|
+
/** External provider-key and measurement verifier for confidential forks. */
|
|
576
|
+
confidentialAttestationVerifier?: TangleConfidentialAttestationVerifier;
|
|
466
577
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentWorkspaceBranching } from "@tangle-network/agent-interface";
|
|
2
|
+
import type { SandboxClientLike, SandboxInstanceLike, TangleConfidentialAttestationVerifier } from "./tangle-types.js";
|
|
3
|
+
export interface TangleWorkspaceBranchingOptions {
|
|
4
|
+
box: SandboxInstanceLike;
|
|
5
|
+
client: SandboxClientLike;
|
|
6
|
+
provider: string;
|
|
7
|
+
confidentialAttestationVerifier?: TangleConfidentialAttestationVerifier;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Carry the verifier only when the caller supplied one. Every option type that
|
|
11
|
+
* accepts it is exact-optional, so an explicit `undefined` is not an absent key.
|
|
12
|
+
*/
|
|
13
|
+
export declare function confidentialVerifierOption(verifier: TangleConfidentialAttestationVerifier | undefined): {
|
|
14
|
+
confidentialAttestationVerifier?: TangleConfidentialAttestationVerifier;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Build the exact workspace contract over the managed Sandbox operations.
|
|
18
|
+
*
|
|
19
|
+
* The adapter requires list and lookup surfaces in addition to create and
|
|
20
|
+
* delete methods. Without recovery, it cannot safely claim durable branching.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createTangleWorkspaceBranching(options: TangleWorkspaceBranchingOptions): AgentWorkspaceBranching | undefined;
|
|
23
|
+
/** Capability support requires every operation used by recovery and cleanup. */
|
|
24
|
+
export declare function supportsWorkspaceBranching(box: SandboxInstanceLike, client: SandboxClientLike): boolean;
|