@tangle-network/sandbox 0.9.4-develop.20260706173746.524da5c → 0.9.4-develop.20260708064110.11c25f9
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/index.d.ts +2 -2
- package/dist/{client-IVFN239a.js → client-13KFLnXC.js} +3 -2
- package/dist/{client-CKM1dsk7.d.ts → client-AUfz_t4l.d.ts} +1 -1
- package/dist/core.d.ts +2 -2
- package/dist/core.js +2 -2
- package/dist/{index-8IkXi8y9.d.ts → index-BRq19VvF.d.ts} +6 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{sandbox-J7ZJIpTI.js → sandbox-B6-5VUWS.js} +49 -2
- package/dist/{sandbox-fNryFSXI.d.ts → sandbox-BL2LosMy.d.ts} +43 -0
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-BR-mu2qI.js → tangle-CaIGtgCR.js} +111 -33
- package/package.json +1 -1
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as CodeExecutionResult, J as CodeResultPart, K as CodeLanguage, W as CodeExecutionOptions, n as SandboxInstance } from "../sandbox-
|
|
2
|
-
import { i as SandboxClient } from "../client-
|
|
1
|
+
import { G as CodeExecutionResult, J as CodeResultPart, K as CodeLanguage, W as CodeExecutionOptions, n as SandboxInstance } from "../sandbox-BL2LosMy.js";
|
|
2
|
+
import { i as SandboxClient } from "../client-AUfz_t4l.js";
|
|
3
3
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/tools/_specs.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as normalizeConnection, h as parseSSEStream, n as normalizeStartupDiagnostics, p as encodePromptForWire, t as SandboxInstance, u as exportTraceBundle } from "./sandbox-B6-5VUWS.js";
|
|
2
2
|
import { d as ValidationError, f as parseErrorResponse, i as NotFoundError, r as NetworkError, t as AuthError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
3
3
|
//#region src/resources.ts
|
|
4
4
|
/**
|
|
@@ -1677,7 +1677,8 @@ var SandboxClient = class {
|
|
|
1677
1677
|
lastActivityAt: data.lastActivityAt ? new Date(data.lastActivityAt) : void 0,
|
|
1678
1678
|
expiresAt: data.expiresAt ? new Date(data.expiresAt) : void 0,
|
|
1679
1679
|
error: data.error,
|
|
1680
|
-
gpuLease: data.gpuLease
|
|
1680
|
+
gpuLease: data.gpuLease,
|
|
1681
|
+
startupDiagnostics: normalizeStartupDiagnostics(data.startupDiagnostics) ?? void 0
|
|
1681
1682
|
};
|
|
1682
1683
|
}
|
|
1683
1684
|
_tokenRefreshHandlers = /* @__PURE__ */ new Set();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CreateSandboxFleetOptions, $n as SandboxFleetMachineRecord, An as PublishPublicTemplateVersionOptions, B as BatchResult, Bn as SandboxEnvironment, Br as SshKeysManager, Ct as FleetDispatchStreamOptions, Dn as PublicTemplateInfo, Dt as FleetPromptDispatchOptions, Et as FleetMachineId, Hn as SandboxFleetArtifact, Jt as IntelligenceReport, Kn as SandboxFleetDispatchResponse, Mn as ReapExpiredSandboxFleetsResult, Nn as ReconcileSandboxFleetsOptions, On as PublicTemplateVersionInfo, Ot as FleetPromptDispatchResult, Pn as ReconcileSandboxFleetsResult, Q as CreateRequestOptions, Qr as TokenRefreshHandler, Qt as IntelligenceReportWindow, R as BatchEvent, Rn as SandboxClientConfig, Sn as PromptResult, St as FleetDispatchResultBufferOptions, Tt as FleetExecDispatchResult, Un as SandboxFleetArtifactSpec, V as BatchTask, Wn as SandboxFleetCostEstimate, Wr as SubscriptionInfo, Xt as IntelligenceReportCompareTo, Yn as SandboxFleetInfo, Yt as IntelligenceReportBudget, Z as CreateIntelligenceReportOptions, _t as ExecResult, a as TraceExportSink, ar as SandboxFleetToken, bn as PromptInputPart, bt as FleetDispatchCancelResult, et as CreateSandboxFleetTokenOptions, fr as SandboxFleetWorkspaceReconcileResult, gt as ExecOptions, hr as SandboxInfo, i as TraceExportResult, ii as UsageInfo, j as AttachSandboxFleetMachineOptions, jn as ReapExpiredSandboxFleetsOptions, jr as SecretsManager, kn as PublishPublicTemplateOptions, lr as SandboxFleetTraceOptions, mr as SandboxFleetWorkspaceSnapshotResult, n as SandboxInstance, nn as ListSandboxOptions, nt as CreateSandboxOptions, or as SandboxFleetTraceBundle, pr as SandboxFleetWorkspaceRestoreResult, qn as SandboxFleetDriverCapability, rr as SandboxFleetOperationsSummary, t as HttpClient, tn as ListSandboxFleetOptions, tr as SandboxFleetManifest, tt as CreateSandboxFleetWithCoordinatorOptions, ur as SandboxFleetUsage, wt as FleetExecDispatchOptions, xn as PromptOptions, xt as FleetDispatchResultBuffer, z as BatchOptions } from "./sandbox-
|
|
1
|
+
import { $ as CreateSandboxFleetOptions, $n as SandboxFleetMachineRecord, An as PublishPublicTemplateVersionOptions, B as BatchResult, Bn as SandboxEnvironment, Br as SshKeysManager, Ct as FleetDispatchStreamOptions, Dn as PublicTemplateInfo, Dt as FleetPromptDispatchOptions, Et as FleetMachineId, Hn as SandboxFleetArtifact, Jt as IntelligenceReport, Kn as SandboxFleetDispatchResponse, Mn as ReapExpiredSandboxFleetsResult, Nn as ReconcileSandboxFleetsOptions, On as PublicTemplateVersionInfo, Ot as FleetPromptDispatchResult, Pn as ReconcileSandboxFleetsResult, Q as CreateRequestOptions, Qr as TokenRefreshHandler, Qt as IntelligenceReportWindow, R as BatchEvent, Rn as SandboxClientConfig, Sn as PromptResult, St as FleetDispatchResultBufferOptions, Tt as FleetExecDispatchResult, Un as SandboxFleetArtifactSpec, V as BatchTask, Wn as SandboxFleetCostEstimate, Wr as SubscriptionInfo, Xt as IntelligenceReportCompareTo, Yn as SandboxFleetInfo, Yt as IntelligenceReportBudget, Z as CreateIntelligenceReportOptions, _t as ExecResult, a as TraceExportSink, ar as SandboxFleetToken, bn as PromptInputPart, bt as FleetDispatchCancelResult, et as CreateSandboxFleetTokenOptions, fr as SandboxFleetWorkspaceReconcileResult, gt as ExecOptions, hr as SandboxInfo, i as TraceExportResult, ii as UsageInfo, j as AttachSandboxFleetMachineOptions, jn as ReapExpiredSandboxFleetsOptions, jr as SecretsManager, kn as PublishPublicTemplateOptions, lr as SandboxFleetTraceOptions, mr as SandboxFleetWorkspaceSnapshotResult, n as SandboxInstance, nn as ListSandboxOptions, nt as CreateSandboxOptions, or as SandboxFleetTraceBundle, pr as SandboxFleetWorkspaceRestoreResult, qn as SandboxFleetDriverCapability, rr as SandboxFleetOperationsSummary, t as HttpClient, tn as ListSandboxFleetOptions, tr as SandboxFleetManifest, tt as CreateSandboxFleetWithCoordinatorOptions, ur as SandboxFleetUsage, wt as FleetExecDispatchOptions, xn as PromptOptions, xt as FleetDispatchResultBuffer, z as BatchOptions } from "./sandbox-BL2LosMy.js";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/sse-parser.d.ts
|
|
4
4
|
/**
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rn as SandboxClientConfig, _t as ExecResult, br as SandboxStatus, dn as PreviewLinkInfo, fn as PreviewLinkManager, gt as ExecOptions, hr as SandboxInfo, n as SandboxInstance, nt as CreateSandboxOptions, on as NetworkConfig } from "./sandbox-
|
|
2
|
-
import { i as SandboxClient } from "./client-
|
|
1
|
+
import { Rn as SandboxClientConfig, _t as ExecResult, br as SandboxStatus, dn as PreviewLinkInfo, fn as PreviewLinkManager, gt as ExecOptions, hr as SandboxInfo, n as SandboxInstance, nt as CreateSandboxOptions, on as NetworkConfig } from "./sandbox-BL2LosMy.js";
|
|
2
|
+
import { i as SandboxClient } from "./client-AUfz_t4l.js";
|
|
3
3
|
import { a as PartialFailureError, c as SandboxErrorJson, d as StateError, f as TimeoutError, i as NotFoundError, l as SandboxFailureDetail, n as CapabilityError, o as QuotaError, p as ValidationError, r as NetworkError, s as SandboxError, t as AuthError, u as ServerError } from "./errors-1Se5ATyZ.js";
|
|
4
4
|
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SandboxInstance } from "./sandbox-
|
|
1
|
+
import { t as SandboxInstance } from "./sandbox-B6-5VUWS.js";
|
|
2
2
|
import { a as PartialFailureError, c as ServerError, d as ValidationError, i as NotFoundError, l as StateError, n as CapabilityError, o as QuotaError, r as NetworkError, s as SandboxError, t as AuthError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
3
|
-
import { n as SandboxClient } from "./client-
|
|
3
|
+
import { n as SandboxClient } from "./client-13KFLnXC.js";
|
|
4
4
|
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SandboxInstance, nt as CreateSandboxOptions, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { n as SandboxInstance, nt as CreateSandboxOptions, t as HttpClient } from "./sandbox-BL2LosMy.js";
|
|
2
2
|
|
|
3
3
|
//#region src/tangle/abi.d.ts
|
|
4
4
|
/**
|
|
@@ -341,6 +341,11 @@ declare class TangleSandboxClient implements HttpClient {
|
|
|
341
341
|
* Create a sandbox via on-chain job submission.
|
|
342
342
|
*/
|
|
343
343
|
create(options?: CreateSandboxOptions): Promise<SandboxInstance>;
|
|
344
|
+
/**
|
|
345
|
+
* Get a sandbox by id. Rehydrates from the operator API when configured so
|
|
346
|
+
* app servers can resolve sandboxes created by earlier requests.
|
|
347
|
+
*/
|
|
348
|
+
get(id: string): Promise<SandboxInstance | null>;
|
|
344
349
|
/**
|
|
345
350
|
* Route interception for SandboxInstance lifecycle calls.
|
|
346
351
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as CreateSandboxFleetOptions, $n as SandboxFleetMachineRecord, $r as ToolsConfig, $t as ListMessagesOptions, A as AttachGpuLeaseOptions, An as PublishPublicTemplateVersionOptions, Ar as SecretInfo, At as GitAuth, B as BatchResult, Bn as SandboxEnvironment, Bt as GpuLeaseExecResult, C as SandboxMcpEndpoint, Ci as defineAgentProfile, Cn as ProvisionEvent, Cr as SandboxTraceExport, Ct as FleetDispatchStreamOptions, D as AcceleratorKind, Dn as PublicTemplateInfo, Dr as ScopedTokenScope, Dt as FleetPromptDispatchOptions, E as buildSandboxMcpConfig, Ei as mergeAgentProfiles, En as ProvisionStep, Er as ScopedToken, Et as FleetMachineId, F as BackendManager, Fn as RunCodeOptions, Fr as SessionMessage, Ft as GitStatus, Gn as SandboxFleetDispatchFailureClass, Gr as TaskOptions, Gt as HostAgentDriverConfig, H as BatchTaskResult, Hn as SandboxFleetArtifact, Hr as StartupOperation, Ht as GpuLeaseProviderName, I as BackendStatus, In as SSHCommandDescriptor, Ir as SessionStatus, It as GpuLease, Jn as SandboxFleetDriverTimings, Jr as TeeAttestationReport, Jt as IntelligenceReport, Kn as SandboxFleetDispatchResponse, Kr as TaskResult, Kt as HostAgentRuntimeBackend, L as BackendType, Ln as SSHCredentials, Lr as SnapshotInfo, Lt as GpuLeaseBilling, M as BackendCapabilities, Mn as ReapExpiredSandboxFleetsResult, Mr as SessionEventStreamOptions, Mt as GitCommit, N as BackendConfig, Nn as ReconcileSandboxFleetsOptions, Nr as SessionInfo, Nt as GitConfig, O as AccessPolicyRule, On as PublicTemplateVersionInfo, Or as SearchMatch, P as BackendInfo, Pn as ReconcileSandboxFleetsResult, Pr as SessionListOptions, Pt as GitDiff, Qn as SandboxFleetMachineMeteredUsage, Qr as TokenRefreshHandler, Qt as IntelligenceReportWindow, R as BatchEvent, Rn as SandboxClientConfig, Rr as SnapshotOptions, Rt as GpuLeaseCommandResult, S as SandboxMcpConfig, Si as AgentSubagentProfile, Sn as PromptResult, Sr as SandboxTraceEvent, St as FleetDispatchResultBufferOptions, T as buildControlPlaneMcpConfig, Ti as defineInlineResource, Tn as ProvisionStatus, Tr as SandboxUser, U as BranchOptions, Un as SandboxFleetArtifactSpec, Ur as StorageConfig, Ut as GpuLeaseStatus, V as BatchTask, Vn as SandboxEvent, Vr as StartupDiagnostics, Vt as GpuLeaseManager, Wn as SandboxFleetCostEstimate, Wr as SubscriptionInfo, Wt as GpuType, X as CreateGpuLeaseOptions, Xn as SandboxFleetIntelligenceEnvelope, Xr as TeePublicKey, Xt as IntelligenceReportCompareTo, Y as CompletedTurnResult, Yn as SandboxFleetInfo, Yr as TeeAttestationResponse, Yt as IntelligenceReportBudget, Z as CreateIntelligenceReportOptions, Zn as SandboxFleetMachine, Zr as TeePublicKeyResponse, Zt as IntelligenceReportSubjectType, _ as StartInteractiveOptions, _i as AgentProfilePrompt, _n as ProcessSignal, _r as SandboxPermissionsConfig, _t as ExecResult, a as TraceExportSink, ai as WaitForOptions, an as MkdirOptions, ar as SandboxFleetToken, at as DispatchPromptOptions, b as CONTROL_PLANE_MCP_SERVER_NAME, bi as AgentProfileValidationIssue, br as SandboxStatus, bt as FleetDispatchCancelResult, c as otelTraceIdForTangleTrace, ci as WriteManyOptions, cn as NonHostAgentDriverConfig, cr as SandboxFleetTraceExport, ct as DownloadProgress, d as InteractiveAuthFile, di as AgentProfileConfidential, dn as PreviewLinkInfo, dr as SandboxFleetWorkspace, dt as DriverInfo, ei as TurnDriveResult, en as ListOptions, er as SandboxFleetMachineSpec, f as InteractiveSessionHandle, fi as AgentProfileConnection, fn as PreviewLinkManager, fr as SandboxFleetWorkspaceReconcileResult, ft as DriverType, g as RespondToPermissionOptions, gi as AgentProfilePermissionValue, gn as ProcessManager, gr as SandboxIntelligenceEnvelope, gt as ExecOptions, h as InterruptResult, hi as AgentProfileModelHints, hn as ProcessLogEntry, hr as SandboxInfo, ht as EventStreamOptions, i as TraceExportResult, ii as UsageInfo, in as MintScopedTokenOptions, ir as SandboxFleetPolicy, it as DirectoryPermission, j as AttachSandboxFleetMachineOptions, jn as ReapExpiredSandboxFleetsOptions, jr as SecretsManager, jt as GitBranch, k as AddUserOptions, kn as PublishPublicTemplateOptions, kr as SearchOptions, kt as GPU_LEASE_PROVIDER_NAMES, l as toOtelJson, li as AgentProfile, ln as PermissionLevel, lr as SandboxFleetTraceOptions, lt as DriveTurnOptions, m as InteractiveSessionInfo, mi as AgentProfileMcpServer, mn as ProcessInfo, mr as SandboxFleetWorkspaceSnapshotResult, mt as EgressPolicy, n as SandboxInstance, ni as UploadOptions, nn as ListSandboxOptions, nr as SandboxFleetManifestMachine, nt as CreateSandboxOptions, o as buildTraceExportPayload, oi as WriteFileOptions, on as NetworkConfig, or as SandboxFleetTraceBundle, ot as DispatchedSession, p as InteractiveSessionHost, pi as AgentProfileFileMount, pn as Process, pr as SandboxFleetWorkspaceRestoreResult, pt as EgressManager, q as CodeResult, qn as SandboxFleetDriverCapability, qr as TeeAttestationOptions, qt as InstalledTool, r as TraceExportFormat, ri as UploadProgress, rn as McpServerConfig, rr as SandboxFleetOperationsSummary, rt as DeleteOptions, s as exportTraceBundle, si as WriteManyFile, sn as NetworkManager, sr as SandboxFleetTraceEvent, st as DownloadOptions, ti as UpdateUserOptions, tn as ListSandboxFleetOptions, tr as SandboxFleetManifest, tt as CreateSandboxFleetWithCoordinatorOptions, u as SandboxSession, ui as AgentProfileCapabilities, un as PermissionsManager, ur as SandboxFleetUsage, ut as DriverConfig, v as BuildControlPlaneMcpConfigOptions, vi as AgentProfileResourceRef, vn as ProcessSpawnOptions, vr as SandboxResourceUsage, vt as FileInfo, w as SandboxMcpServerEntry, wi as defineGitHubResource, wn as ProvisionResult, wr as SandboxTraceOptions, wt as FleetExecDispatchOptions, x as SANDBOX_MCP_SERVER_NAME, xi as AgentProfileValidationResult, xn as PromptOptions, xr as SandboxTraceBundle, xt as FleetDispatchResultBuffer, y as BuildSandboxMcpConfigOptions, yi as AgentProfileResources, yn as ProcessStatus, yr as SandboxResources, yt as FileSystem, z as BatchOptions, zn as SandboxConnection, zr as SnapshotResult, zt as GpuLeaseExecOptions } from "./sandbox-
|
|
2
|
-
import { a as Team, c as SandboxFleet, d as ParsedSSEEvent, f as parseSSEStream, i as SandboxClient, l as SandboxFleetClient, n as IntelligenceClient, o as TeamInvitation, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as ParseSSEStreamOptions } from "./client-
|
|
1
|
+
import { $ as CreateSandboxFleetOptions, $n as SandboxFleetMachineRecord, $r as ToolsConfig, $t as ListMessagesOptions, A as AttachGpuLeaseOptions, An as PublishPublicTemplateVersionOptions, Ar as SecretInfo, At as GitAuth, B as BatchResult, Bn as SandboxEnvironment, Bt as GpuLeaseExecResult, C as SandboxMcpEndpoint, Ci as defineAgentProfile, Cn as ProvisionEvent, Cr as SandboxTraceExport, Ct as FleetDispatchStreamOptions, D as AcceleratorKind, Dn as PublicTemplateInfo, Dr as ScopedTokenScope, Dt as FleetPromptDispatchOptions, E as buildSandboxMcpConfig, Ei as mergeAgentProfiles, En as ProvisionStep, Er as ScopedToken, Et as FleetMachineId, F as BackendManager, Fn as RunCodeOptions, Fr as SessionMessage, Ft as GitStatus, Gn as SandboxFleetDispatchFailureClass, Gr as TaskOptions, Gt as HostAgentDriverConfig, H as BatchTaskResult, Hn as SandboxFleetArtifact, Hr as StartupOperation, Ht as GpuLeaseProviderName, I as BackendStatus, In as SSHCommandDescriptor, Ir as SessionStatus, It as GpuLease, Jn as SandboxFleetDriverTimings, Jr as TeeAttestationReport, Jt as IntelligenceReport, Kn as SandboxFleetDispatchResponse, Kr as TaskResult, Kt as HostAgentRuntimeBackend, L as BackendType, Ln as SSHCredentials, Lr as SnapshotInfo, Lt as GpuLeaseBilling, M as BackendCapabilities, Mn as ReapExpiredSandboxFleetsResult, Mr as SessionEventStreamOptions, Mt as GitCommit, N as BackendConfig, Nn as ReconcileSandboxFleetsOptions, Nr as SessionInfo, Nt as GitConfig, O as AccessPolicyRule, On as PublicTemplateVersionInfo, Or as SearchMatch, P as BackendInfo, Pn as ReconcileSandboxFleetsResult, Pr as SessionListOptions, Pt as GitDiff, Qn as SandboxFleetMachineMeteredUsage, Qr as TokenRefreshHandler, Qt as IntelligenceReportWindow, R as BatchEvent, Rn as SandboxClientConfig, Rr as SnapshotOptions, Rt as GpuLeaseCommandResult, S as SandboxMcpConfig, Si as AgentSubagentProfile, Sn as PromptResult, Sr as SandboxTraceEvent, St as FleetDispatchResultBufferOptions, T as buildControlPlaneMcpConfig, Ti as defineInlineResource, Tn as ProvisionStatus, Tr as SandboxUser, U as BranchOptions, Un as SandboxFleetArtifactSpec, Ur as StorageConfig, Ut as GpuLeaseStatus, V as BatchTask, Vn as SandboxEvent, Vr as StartupDiagnostics, Vt as GpuLeaseManager, Wn as SandboxFleetCostEstimate, Wr as SubscriptionInfo, Wt as GpuType, X as CreateGpuLeaseOptions, Xn as SandboxFleetIntelligenceEnvelope, Xr as TeePublicKey, Xt as IntelligenceReportCompareTo, Y as CompletedTurnResult, Yn as SandboxFleetInfo, Yr as TeeAttestationResponse, Yt as IntelligenceReportBudget, Z as CreateIntelligenceReportOptions, Zn as SandboxFleetMachine, Zr as TeePublicKeyResponse, Zt as IntelligenceReportSubjectType, _ as StartInteractiveOptions, _i as AgentProfilePrompt, _n as ProcessSignal, _r as SandboxPermissionsConfig, _t as ExecResult, a as TraceExportSink, ai as WaitForOptions, an as MkdirOptions, ar as SandboxFleetToken, at as DispatchPromptOptions, b as CONTROL_PLANE_MCP_SERVER_NAME, bi as AgentProfileValidationIssue, br as SandboxStatus, bt as FleetDispatchCancelResult, c as otelTraceIdForTangleTrace, ci as WriteManyOptions, cn as NonHostAgentDriverConfig, cr as SandboxFleetTraceExport, ct as DownloadProgress, d as InteractiveAuthFile, di as AgentProfileConfidential, dn as PreviewLinkInfo, dr as SandboxFleetWorkspace, dt as DriverInfo, ei as TurnDriveResult, en as ListOptions, er as SandboxFleetMachineSpec, f as InteractiveSessionHandle, fi as AgentProfileConnection, fn as PreviewLinkManager, fr as SandboxFleetWorkspaceReconcileResult, ft as DriverType, g as RespondToPermissionOptions, gi as AgentProfilePermissionValue, gn as ProcessManager, gr as SandboxIntelligenceEnvelope, gt as ExecOptions, h as InterruptResult, hi as AgentProfileModelHints, hn as ProcessLogEntry, hr as SandboxInfo, ht as EventStreamOptions, i as TraceExportResult, ii as UsageInfo, in as MintScopedTokenOptions, ir as SandboxFleetPolicy, it as DirectoryPermission, j as AttachSandboxFleetMachineOptions, jn as ReapExpiredSandboxFleetsOptions, jr as SecretsManager, jt as GitBranch, k as AddUserOptions, kn as PublishPublicTemplateOptions, kr as SearchOptions, kt as GPU_LEASE_PROVIDER_NAMES, l as toOtelJson, li as AgentProfile, ln as PermissionLevel, lr as SandboxFleetTraceOptions, lt as DriveTurnOptions, m as InteractiveSessionInfo, mi as AgentProfileMcpServer, mn as ProcessInfo, mr as SandboxFleetWorkspaceSnapshotResult, mt as EgressPolicy, n as SandboxInstance, ni as UploadOptions, nn as ListSandboxOptions, nr as SandboxFleetManifestMachine, nt as CreateSandboxOptions, o as buildTraceExportPayload, oi as WriteFileOptions, on as NetworkConfig, or as SandboxFleetTraceBundle, ot as DispatchedSession, p as InteractiveSessionHost, pi as AgentProfileFileMount, pn as Process, pr as SandboxFleetWorkspaceRestoreResult, pt as EgressManager, q as CodeResult, qn as SandboxFleetDriverCapability, qr as TeeAttestationOptions, qt as InstalledTool, r as TraceExportFormat, ri as UploadProgress, rn as McpServerConfig, rr as SandboxFleetOperationsSummary, rt as DeleteOptions, s as exportTraceBundle, si as WriteManyFile, sn as NetworkManager, sr as SandboxFleetTraceEvent, st as DownloadOptions, ti as UpdateUserOptions, tn as ListSandboxFleetOptions, tr as SandboxFleetManifest, tt as CreateSandboxFleetWithCoordinatorOptions, u as SandboxSession, ui as AgentProfileCapabilities, un as PermissionsManager, ur as SandboxFleetUsage, ut as DriverConfig, v as BuildControlPlaneMcpConfigOptions, vi as AgentProfileResourceRef, vn as ProcessSpawnOptions, vr as SandboxResourceUsage, vt as FileInfo, w as SandboxMcpServerEntry, wi as defineGitHubResource, wn as ProvisionResult, wr as SandboxTraceOptions, wt as FleetExecDispatchOptions, x as SANDBOX_MCP_SERVER_NAME, xi as AgentProfileValidationResult, xn as PromptOptions, xr as SandboxTraceBundle, xt as FleetDispatchResultBuffer, y as BuildSandboxMcpConfigOptions, yi as AgentProfileResources, yn as ProcessStatus, yr as SandboxResources, yt as FileSystem, z as BatchOptions, zn as SandboxConnection, zr as SnapshotResult, zt as GpuLeaseExecOptions } from "./sandbox-BL2LosMy.js";
|
|
2
|
+
import { a as Team, c as SandboxFleet, d as ParsedSSEEvent, f as parseSSEStream, i as SandboxClient, l as SandboxFleetClient, n as IntelligenceClient, o as TeamInvitation, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as ParseSSEStreamOptions } from "./client-AUfz_t4l.js";
|
|
3
3
|
import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-D-2pH_70.js";
|
|
4
4
|
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "./index-D7bwmNs8.js";
|
|
5
5
|
import { a as PartialFailureError, c as SandboxErrorJson, d as StateError, f as TimeoutError, i as NotFoundError, l as SandboxFailureDetail, n as CapabilityError, o as QuotaError, p as ValidationError, r as NetworkError, s as SandboxError, t as AuthError, u as ServerError } from "./errors-1Se5ATyZ.js";
|
|
6
|
-
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-
|
|
6
|
+
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-BRq19VvF.js";
|
|
7
7
|
|
|
8
8
|
//#region src/attestation-heartbeat.d.ts
|
|
9
9
|
interface TeeAttestationHeartbeatSample {
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as serializeForSidecar, a as applySandboxEventText, d as otelTraceIdForTangleTrace, f as toOtelJson, g as normalizeRuntimeBackendConfig, h as parseSSEStream, i as InteractiveSessionHandle, l as buildTraceExportPayload, m as encodeTextForWire, o as collectAgentResponseText, r as SandboxSession, s as getSandboxEventText, t as SandboxInstance, u as exportTraceBundle } from "./sandbox-B6-5VUWS.js";
|
|
2
2
|
import { a as PartialFailureError, c as ServerError, d as ValidationError, i as NotFoundError, l as StateError, n as CapabilityError, o as QuotaError, r as NetworkError, s as SandboxError, t as AuthError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
3
|
-
import { a as DEFAULT_SANDBOX_SIZE, c as resolveSandboxResources, i as SandboxFleetClient, l as sandboxResourcesForSize, n as SandboxClient, o as SANDBOX_SIZE_PRESETS, r as SandboxFleet, s as SANDBOX_SIZE_PRESET_NAMES, t as IntelligenceClient } from "./client-
|
|
3
|
+
import { a as DEFAULT_SANDBOX_SIZE, c as resolveSandboxResources, i as SandboxFleetClient, l as sandboxResourcesForSize, n as SandboxClient, o as SANDBOX_SIZE_PRESETS, r as SandboxFleet, s as SANDBOX_SIZE_PRESET_NAMES, t as IntelligenceClient } from "./client-13KFLnXC.js";
|
|
4
4
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-BxlfZ2Uh.js";
|
|
5
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
5
|
+
import { t as TangleSandboxClient } from "./tangle-CaIGtgCR.js";
|
|
6
6
|
import { defineAgentProfile, defineGitHubResource, defineInlineResource, mergeAgentProfiles } from "@tangle-network/agent-interface";
|
|
7
7
|
//#region src/confidential.ts
|
|
8
8
|
function generateAttestationNonce(bytes = 32) {
|
|
@@ -632,7 +632,7 @@ var InteractiveSessionHandle = class {
|
|
|
632
632
|
* A single agent session inside a sandbox. Created via
|
|
633
633
|
* `box.session(id)` — does not hit the network until a method is called.
|
|
634
634
|
*/
|
|
635
|
-
var SandboxSession = class {
|
|
635
|
+
var SandboxSession = class SandboxSession {
|
|
636
636
|
/**
|
|
637
637
|
* @internal SDK-internal constructor — apps should call `box.session(id)`.
|
|
638
638
|
*/
|
|
@@ -675,6 +675,16 @@ var SandboxSession = class {
|
|
|
675
675
|
return this.box._sessionResult(this.id);
|
|
676
676
|
}
|
|
677
677
|
/**
|
|
678
|
+
* List persisted messages for this session, including in-flight assistant
|
|
679
|
+
* content when the runtime has flushed partial output.
|
|
680
|
+
*/
|
|
681
|
+
async messages(opts = {}) {
|
|
682
|
+
return this.box.messages({
|
|
683
|
+
...opts,
|
|
684
|
+
sessionId: this.id
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
678
688
|
* Continue this session with an additional prompt. Equivalent to
|
|
679
689
|
* `box.prompt(message, { ...opts, sessionId: this.id })` but reads
|
|
680
690
|
* naturally on a Session reference.
|
|
@@ -697,6 +707,18 @@ var SandboxSession = class {
|
|
|
697
707
|
return this.box._sessionCancel(this.id);
|
|
698
708
|
}
|
|
699
709
|
/**
|
|
710
|
+
* Fork this session into a new queued session. The fork shares the
|
|
711
|
+
* parent workspace and copies conversation history up to `messageId`
|
|
712
|
+
* when supplied.
|
|
713
|
+
*/
|
|
714
|
+
async fork(opts) {
|
|
715
|
+
const info = await this.box._sessionFork(this.id, opts);
|
|
716
|
+
return {
|
|
717
|
+
session: new SandboxSession(this.box, info.id),
|
|
718
|
+
info
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
700
722
|
* Drive this session's harness in INTERACTIVE mode: spawn its native TUI,
|
|
701
723
|
* stream the live framebuffer, and inject prompts as keystrokes. Distinct
|
|
702
724
|
* from the headless `prompt()`/`events()` surface above. Lazy — does not hit
|
|
@@ -1648,6 +1670,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
1648
1670
|
turnId: options?.turnId,
|
|
1649
1671
|
metadata: options?.context,
|
|
1650
1672
|
requireVisibleAssistantOutput: options?.requireVisibleAssistantOutput,
|
|
1673
|
+
...timeoutMs ? { timeoutMs } : {},
|
|
1651
1674
|
...options?.detach ? { detach: true } : {},
|
|
1652
1675
|
backend: normalizeRuntimeBackendConfig(options?.backend ?? this.defaultRuntimeBackend, { model: options?.model })
|
|
1653
1676
|
})
|
|
@@ -2480,6 +2503,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
2480
2503
|
const params = new URLSearchParams();
|
|
2481
2504
|
if (options?.all) params.set("all", "true");
|
|
2482
2505
|
if (options?.long) params.set("long", "true");
|
|
2506
|
+
if (options?.sessionId) params.set("sessionId", options.sessionId);
|
|
2483
2507
|
const query = params.toString();
|
|
2484
2508
|
const url = query ? `/fs/list${path}?${query}` : `/fs/list${path}`;
|
|
2485
2509
|
const response = await this.runtimeFetch(url, { method: "GET" });
|
|
@@ -4179,6 +4203,28 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4179
4203
|
metadata: m.info.metadata
|
|
4180
4204
|
}));
|
|
4181
4205
|
}
|
|
4206
|
+
async _sessionFork(id, opts = {}) {
|
|
4207
|
+
await this.ensureRunning();
|
|
4208
|
+
const body = {};
|
|
4209
|
+
if (opts.messageId !== void 0) body.messageID = opts.messageId;
|
|
4210
|
+
if (opts.targetBackend !== void 0) body.targetBackend = opts.targetBackend;
|
|
4211
|
+
if (opts.targetModel !== void 0) body.targetModel = opts.targetModel;
|
|
4212
|
+
if (opts.files !== void 0) body.files = opts.files;
|
|
4213
|
+
const response = await this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/forks`, {
|
|
4214
|
+
method: "POST",
|
|
4215
|
+
body: JSON.stringify(body)
|
|
4216
|
+
});
|
|
4217
|
+
if (!response.ok) {
|
|
4218
|
+
const responseBody = await response.text();
|
|
4219
|
+
throw parseErrorResponse(response.status, responseBody, void 0, response.headers);
|
|
4220
|
+
}
|
|
4221
|
+
const info = normalizeSessionInfo(await response.json());
|
|
4222
|
+
if (!info) throw new ServerError("Session fork response missing session id", 502, {
|
|
4223
|
+
origin: "runtime",
|
|
4224
|
+
endpoint: `/agents/sessions/${encodeURIComponent(id)}/forks`
|
|
4225
|
+
});
|
|
4226
|
+
return info;
|
|
4227
|
+
}
|
|
4182
4228
|
/**
|
|
4183
4229
|
* Look up a cached turn result by idempotency key. Returns the cached
|
|
4184
4230
|
* payload if a turn with this `turnId` previously completed on the
|
|
@@ -4527,6 +4573,7 @@ function normalizeSessionInfo(raw) {
|
|
|
4527
4573
|
const status = raw.status || "running";
|
|
4528
4574
|
return {
|
|
4529
4575
|
id,
|
|
4576
|
+
parentId: typeof raw.parentID === "string" ? raw.parentID : typeof raw.parentId === "string" ? raw.parentId : void 0,
|
|
4530
4577
|
status: [
|
|
4531
4578
|
"queued",
|
|
4532
4579
|
"running",
|
|
@@ -4609,4 +4656,4 @@ function quoteForShell(value) {
|
|
|
4609
4656
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
4610
4657
|
}
|
|
4611
4658
|
//#endregion
|
|
4612
|
-
export {
|
|
4659
|
+
export { serializeForSidecar as _, applySandboxEventText as a, normalizeConnection as c, otelTraceIdForTangleTrace as d, toOtelJson as f, normalizeRuntimeBackendConfig as g, parseSSEStream as h, InteractiveSessionHandle as i, buildTraceExportPayload as l, encodeTextForWire as m, normalizeStartupDiagnostics as n, collectAgentResponseText as o, encodePromptForWire as p, SandboxSession as r, getSandboxEventText as s, SandboxInstance as t, exportTraceBundle as u };
|
|
@@ -1589,6 +1589,8 @@ type SessionStatus = "queued" | "running" | "completed" | "failed" | "cancelled"
|
|
|
1589
1589
|
interface SessionInfo {
|
|
1590
1590
|
/** Stable session id assigned by the sandbox runtime. */
|
|
1591
1591
|
id: string;
|
|
1592
|
+
/** Parent session id when this session was forked from another session. */
|
|
1593
|
+
parentId?: string;
|
|
1592
1594
|
/** Current lifecycle state. */
|
|
1593
1595
|
status: SessionStatus;
|
|
1594
1596
|
/** Backend identifier (e.g. provider name). */
|
|
@@ -1650,6 +1652,28 @@ interface ListMessagesOptions {
|
|
|
1650
1652
|
/** Only return messages newer than this Unix-ms timestamp. */
|
|
1651
1653
|
since?: number;
|
|
1652
1654
|
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Options for `box.session(id).fork()` — create a new session from an
|
|
1657
|
+
* existing conversation, optionally at a message boundary.
|
|
1658
|
+
*/
|
|
1659
|
+
interface SessionForkOptions {
|
|
1660
|
+
/** Fork at this message boundary. */
|
|
1661
|
+
messageId?: string;
|
|
1662
|
+
/** Target backend type for cross-backend forks. Defaults to parent backend. */
|
|
1663
|
+
targetBackend?: BackendType;
|
|
1664
|
+
/** Model override for the target backend. */
|
|
1665
|
+
targetModel?: {
|
|
1666
|
+
provider?: string;
|
|
1667
|
+
model?: string;
|
|
1668
|
+
apiKey?: string;
|
|
1669
|
+
baseUrl?: string;
|
|
1670
|
+
};
|
|
1671
|
+
/**
|
|
1672
|
+
* Files to include. The runtime currently rejects non-empty file lists;
|
|
1673
|
+
* exposed here so the SDK type tracks the wire contract exactly.
|
|
1674
|
+
*/
|
|
1675
|
+
files?: string[];
|
|
1676
|
+
}
|
|
1653
1677
|
/**
|
|
1654
1678
|
* One message on a session — user, assistant, or system. The metadata
|
|
1655
1679
|
* field carries the durability marker set by the sidecar:
|
|
@@ -3868,6 +3892,8 @@ interface ListOptions {
|
|
|
3868
3892
|
all?: boolean;
|
|
3869
3893
|
/** Include full metadata (like ls -l) */
|
|
3870
3894
|
long?: boolean;
|
|
3895
|
+
/** Task session id for session-specific workspace isolation. */
|
|
3896
|
+
sessionId?: string;
|
|
3871
3897
|
}
|
|
3872
3898
|
/**
|
|
3873
3899
|
* Options for creating directories.
|
|
@@ -4444,6 +4470,8 @@ interface SandboxSessionHost extends InteractiveSessionHost {
|
|
|
4444
4470
|
_sessionEvents(id: string, opts?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
|
|
4445
4471
|
_sessionResult(id: string): Promise<PromptResult>;
|
|
4446
4472
|
_sessionCancel(id: string): Promise<void>;
|
|
4473
|
+
messages(opts: ListMessagesOptions): Promise<SessionMessage[]>;
|
|
4474
|
+
_sessionFork(id: string, opts?: SessionForkOptions): Promise<SessionInfo>;
|
|
4447
4475
|
_respondToPermission(id: string, permissionID: string, options: RespondToPermissionOptions): Promise<void>;
|
|
4448
4476
|
_interrupt(id: string): Promise<InterruptResult>;
|
|
4449
4477
|
_answerQuestion(id: string, answers: Record<string, string[]>): Promise<void>;
|
|
@@ -4490,6 +4518,11 @@ declare class SandboxSession {
|
|
|
4490
4518
|
* (e.g. `dispatchPrompt`).
|
|
4491
4519
|
*/
|
|
4492
4520
|
result(): Promise<PromptResult>;
|
|
4521
|
+
/**
|
|
4522
|
+
* List persisted messages for this session, including in-flight assistant
|
|
4523
|
+
* content when the runtime has flushed partial output.
|
|
4524
|
+
*/
|
|
4525
|
+
messages(opts?: Omit<ListMessagesOptions, "sessionId">): Promise<SessionMessage[]>;
|
|
4493
4526
|
/**
|
|
4494
4527
|
* Continue this session with an additional prompt. Equivalent to
|
|
4495
4528
|
* `box.prompt(message, { ...opts, sessionId: this.id })` but reads
|
|
@@ -4505,6 +4538,15 @@ declare class SandboxSession {
|
|
|
4505
4538
|
* aborting a session with nothing in flight is a no-op.
|
|
4506
4539
|
*/
|
|
4507
4540
|
cancel(): Promise<void>;
|
|
4541
|
+
/**
|
|
4542
|
+
* Fork this session into a new queued session. The fork shares the
|
|
4543
|
+
* parent workspace and copies conversation history up to `messageId`
|
|
4544
|
+
* when supplied.
|
|
4545
|
+
*/
|
|
4546
|
+
fork(opts?: SessionForkOptions): Promise<{
|
|
4547
|
+
session: SandboxSession;
|
|
4548
|
+
info: SessionInfo;
|
|
4549
|
+
}>;
|
|
4508
4550
|
/**
|
|
4509
4551
|
* Drive this session's harness in INTERACTIVE mode: spawn its native TUI,
|
|
4510
4552
|
* stream the live framebuffer, and inject prompts as keystrokes. Distinct
|
|
@@ -5528,6 +5570,7 @@ declare class SandboxInstance {
|
|
|
5528
5570
|
* abort stamps `interrupted: true` explicitly.
|
|
5529
5571
|
*/
|
|
5530
5572
|
messages(opts: ListMessagesOptions): Promise<SessionMessage[]>;
|
|
5573
|
+
_sessionFork(id: string, opts?: SessionForkOptions): Promise<SessionInfo>;
|
|
5531
5574
|
/**
|
|
5532
5575
|
* Look up a cached turn result by idempotency key. Returns the cached
|
|
5533
5576
|
* payload if a turn with this `turnId` previously completed on the
|
package/dist/tangle/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-BRq19VvF.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient, TangleSandboxClientConfig };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-CaIGtgCR.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as SandboxInstance } from "./sandbox-
|
|
1
|
+
import { t as SandboxInstance } from "./sandbox-B6-5VUWS.js";
|
|
2
|
+
import { f as parseErrorResponse } from "./errors-DZsfJUuc.js";
|
|
2
3
|
//#region src/tangle/abi.ts
|
|
3
4
|
/**
|
|
4
5
|
* Tangle Contract ABI Definitions
|
|
@@ -572,6 +573,14 @@ var TangleChainClient = class {
|
|
|
572
573
|
};
|
|
573
574
|
//#endregion
|
|
574
575
|
//#region src/tangle/client.ts
|
|
576
|
+
/**
|
|
577
|
+
* TangleSandboxClient — on-chain sandbox lifecycle via EVM calls.
|
|
578
|
+
*
|
|
579
|
+
* Implements HttpClient so `SandboxInstance` works unchanged. Lifecycle
|
|
580
|
+
* operations (create/stop/resume/delete) go on-chain via Tangle jobs, and
|
|
581
|
+
* runtime operations are routed directly to the sandbox runtime URL
|
|
582
|
+
* returned by the on-chain job result.
|
|
583
|
+
*/
|
|
575
584
|
function randomHexToken(bytes) {
|
|
576
585
|
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.getRandomValues !== "function") throw new Error("randomHexToken: globalThis.crypto.getRandomValues is unavailable; this runtime cannot generate cryptographically secure nonces. Run on a host with WebCrypto support (Node 20+, browsers, Workers).");
|
|
577
586
|
const buf = new Uint8Array(bytes);
|
|
@@ -613,6 +622,81 @@ function requirePathGroup(match, index) {
|
|
|
613
622
|
if (value === void 0) throw new Error(`Path matcher missing group ${index}`);
|
|
614
623
|
return value;
|
|
615
624
|
}
|
|
625
|
+
function asRecord(value) {
|
|
626
|
+
return value && typeof value === "object" ? value : void 0;
|
|
627
|
+
}
|
|
628
|
+
function readString(record, keys) {
|
|
629
|
+
if (!record) return void 0;
|
|
630
|
+
for (const key of keys) {
|
|
631
|
+
const value = record[key];
|
|
632
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function entryMetadata(entry) {
|
|
636
|
+
const metadata = {
|
|
637
|
+
...entry.metadata ?? {},
|
|
638
|
+
...entry.teeAttestationJson ? { teeAttestationJson: entry.teeAttestationJson } : {},
|
|
639
|
+
...entry.teePublicKeyJson ? { teePublicKeyJson: entry.teePublicKeyJson } : {},
|
|
640
|
+
...entry.attestationNonce ? { attestationNonce: entry.attestationNonce } : {}
|
|
641
|
+
};
|
|
642
|
+
return Object.keys(metadata).length > 0 ? metadata : void 0;
|
|
643
|
+
}
|
|
644
|
+
function sandboxInfoFromEntry(entry) {
|
|
645
|
+
return {
|
|
646
|
+
id: entry.id,
|
|
647
|
+
name: entry.name,
|
|
648
|
+
status: entry.status === "deleted" ? "stopped" : entry.status,
|
|
649
|
+
connection: entry.runtimeUrl ? {
|
|
650
|
+
runtimeUrl: entry.runtimeUrl,
|
|
651
|
+
authToken: entry.runtimeToken
|
|
652
|
+
} : void 0,
|
|
653
|
+
metadata: entryMetadata(entry),
|
|
654
|
+
createdAt: entry.createdAt
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
function sandboxEntryFromWire(fallbackId, raw) {
|
|
658
|
+
const connection = asRecord(raw.connection);
|
|
659
|
+
const metadata = asRecord(raw.metadata);
|
|
660
|
+
const id = readString(raw, [
|
|
661
|
+
"id",
|
|
662
|
+
"sandboxId",
|
|
663
|
+
"sandbox_id"
|
|
664
|
+
]) ?? fallbackId;
|
|
665
|
+
const runtimeUrl = readString(connection, [
|
|
666
|
+
"runtimeUrl",
|
|
667
|
+
"sidecarUrl",
|
|
668
|
+
"sidecar_url"
|
|
669
|
+
]) ?? readString(raw, [
|
|
670
|
+
"runtimeUrl",
|
|
671
|
+
"sidecarUrl",
|
|
672
|
+
"sidecar_url"
|
|
673
|
+
]) ?? "";
|
|
674
|
+
const runtimeToken = readString(connection, [
|
|
675
|
+
"authToken",
|
|
676
|
+
"runtimeToken",
|
|
677
|
+
"sidecarToken"
|
|
678
|
+
]) ?? readString(raw, [
|
|
679
|
+
"authToken",
|
|
680
|
+
"runtimeToken",
|
|
681
|
+
"sidecarToken",
|
|
682
|
+
"token"
|
|
683
|
+
]) ?? "";
|
|
684
|
+
const rawStatus = readString(raw, ["status"]) ?? "running";
|
|
685
|
+
const createdAtRaw = readString(raw, ["createdAt", "created_at"]);
|
|
686
|
+
const createdAt = createdAtRaw ? new Date(createdAtRaw) : /* @__PURE__ */ new Date();
|
|
687
|
+
return {
|
|
688
|
+
id,
|
|
689
|
+
name: readString(raw, ["name"]),
|
|
690
|
+
runtimeUrl,
|
|
691
|
+
runtimeToken,
|
|
692
|
+
status: rawStatus === "stopped" || rawStatus === "deleted" || rawStatus === "running" ? rawStatus : "running",
|
|
693
|
+
createdAt,
|
|
694
|
+
metadata,
|
|
695
|
+
teeAttestationJson: readString(raw, ["teeAttestationJson"]),
|
|
696
|
+
teePublicKeyJson: readString(raw, ["teePublicKeyJson"]),
|
|
697
|
+
attestationNonce: readString(raw, ["attestationNonce"])
|
|
698
|
+
};
|
|
699
|
+
}
|
|
616
700
|
var TangleSandboxClient = class {
|
|
617
701
|
chain;
|
|
618
702
|
sandboxes = /* @__PURE__ */ new Map();
|
|
@@ -649,32 +733,32 @@ var TangleSandboxClient = class {
|
|
|
649
733
|
if (runtimeUrl && !runtimeToken) throw new Error("Create job returned a runtime URL without an auth token");
|
|
650
734
|
const entry = {
|
|
651
735
|
id: sandboxId,
|
|
736
|
+
name: options?.name,
|
|
652
737
|
runtimeUrl,
|
|
653
738
|
runtimeToken,
|
|
654
739
|
status: "running",
|
|
655
740
|
createdAt: /* @__PURE__ */ new Date(),
|
|
741
|
+
metadata: createOptions.metadata,
|
|
656
742
|
teeAttestationJson: responseJson.teeAttestationJson,
|
|
657
743
|
teePublicKeyJson: responseJson.teePublicKeyJson,
|
|
658
744
|
attestationNonce: attestationNonceFromOptions(createOptions)
|
|
659
745
|
};
|
|
660
746
|
this.sandboxes.set(sandboxId, entry);
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
};
|
|
677
|
-
return new SandboxInstance(this, info);
|
|
747
|
+
return new SandboxInstance(this, sandboxInfoFromEntry(entry));
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Get a sandbox by id. Rehydrates from the operator API when configured so
|
|
751
|
+
* app servers can resolve sandboxes created by earlier requests.
|
|
752
|
+
*/
|
|
753
|
+
async get(id) {
|
|
754
|
+
const response = await this.fetch(`/v1/sandboxes/${encodeURIComponent(id)}`);
|
|
755
|
+
if (response.status === 404) return null;
|
|
756
|
+
if (!response.ok) {
|
|
757
|
+
const body = await response.text();
|
|
758
|
+
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
759
|
+
}
|
|
760
|
+
const data = await response.json();
|
|
761
|
+
return new SandboxInstance(this, sandboxInfoFromEntry(sandboxEntryFromWire(id, data)));
|
|
678
762
|
}
|
|
679
763
|
/**
|
|
680
764
|
* Route interception for SandboxInstance lifecycle calls.
|
|
@@ -696,22 +780,16 @@ var TangleSandboxClient = class {
|
|
|
696
780
|
const getMatch = path.match(/^\/v1\/sandboxes\/([^/]+)$/);
|
|
697
781
|
if (getMatch && method === "GET") {
|
|
698
782
|
const id = decodeURIComponent(requirePathGroup(getMatch, 1));
|
|
699
|
-
|
|
783
|
+
let entry = this.sandboxes.get(id);
|
|
784
|
+
if (!entry && this.operatorApiUrl) {
|
|
785
|
+
const operatorResponse = await this.fetchOperatorApi(`/api/sandboxes/${encodeURIComponent(id)}`, { method: "GET" });
|
|
786
|
+
if (!operatorResponse.ok) return operatorResponse;
|
|
787
|
+
entry = sandboxEntryFromWire(id, await operatorResponse.json());
|
|
788
|
+
this.sandboxes.set(entry.id, entry);
|
|
789
|
+
}
|
|
700
790
|
if (!entry) return new Response(JSON.stringify({ error: "Not found" }), { status: 404 });
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
status: entry.status,
|
|
704
|
-
connection: entry.runtimeUrl ? {
|
|
705
|
-
runtimeUrl: entry.runtimeUrl,
|
|
706
|
-
authToken: entry.runtimeToken
|
|
707
|
-
} : void 0,
|
|
708
|
-
metadata: {
|
|
709
|
-
...entry.teeAttestationJson ? { teeAttestationJson: entry.teeAttestationJson } : {},
|
|
710
|
-
...entry.teePublicKeyJson ? { teePublicKeyJson: entry.teePublicKeyJson } : {},
|
|
711
|
-
...entry.attestationNonce ? { attestationNonce: entry.attestationNonce } : {}
|
|
712
|
-
},
|
|
713
|
-
createdAt: entry.createdAt.toISOString()
|
|
714
|
-
}), {
|
|
791
|
+
const info = sandboxInfoFromEntry(entry);
|
|
792
|
+
return new Response(JSON.stringify(info), {
|
|
715
793
|
status: 200,
|
|
716
794
|
headers: { "Content-Type": "application/json" }
|
|
717
795
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "0.9.4-develop.
|
|
3
|
+
"version": "0.9.4-develop.20260708064110.11c25f9",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|