@tangle-network/sandbox 0.10.2 → 0.10.3

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/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2025 Tangle Network
2
+
3
+ All rights reserved.
4
+
5
+ This software and associated documentation files (the "Software") are proprietary
6
+ and confidential. No part of this Software may be reproduced, distributed, or
7
+ transmitted in any form or by any means, including photocopying, recording, or
8
+ other electronic or mechanical methods, without the prior written permission of
9
+ Tangle Network.
10
+
11
+ For licensing inquiries, contact: hello@tangle.tools
@@ -1,5 +1,6 @@
1
- import { $ as CodeExecutionResult, Q as CodeExecutionOptions, et as CodeLanguage, n as SandboxInstance, nt as CodeResultPart } from "../sandbox-Bm2C9Phd.js";
2
- import { i as SandboxClient } from "../client-8wOu9raV.js";
1
+ import { D as CodeLanguage, E as CodeExecutionResult, T as CodeExecutionOptions, k as CodeResultPart } from "../types-Cmpv-ox_.js";
2
+ import { n as SandboxInstance } from "../sandbox-BhYmj7L3.js";
3
+ import { i as SandboxClient } from "../client-Cr39zlgv.js";
3
4
  import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
4
5
 
5
6
  //#region src/agent/tools/_specs.d.ts
@@ -1,2 +1,2 @@
1
- import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-D-2pH_70.js";
1
+ import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-CyHojkuA.js";
2
2
  export { AnyTokenPayload, BatchScopedTokenPayload, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, unsafeDecodeToken, verifyToken };
@@ -1,4 +1,5 @@
1
- import { $n as ReconcileSandboxFleetsResult, Bn as PromptOptions, Bt as FleetDispatchResultBuffer, Dt as ExecOptions, G as BatchRunOptions, Gt as FleetMachineId, Ht as FleetDispatchStreamOptions, J as BatchTask, Jn as PublishPublicTemplateOptions, K as BatchRunRequest, Kn as PublicTemplateInfo, Kt as FleetPromptDispatchOptions, M as AttachSandboxFleetMachineOptions, Mr as SandboxFleetWorkspaceRestoreResult, Nr as SandboxFleetWorkspaceSnapshotResult, Or as SandboxFleetTraceOptions, Ot as ExecResult, Pr as SandboxInfo, Qn as ReconcileSandboxFleetsOptions, Ri as TokenRefreshHandler, Sr as SandboxFleetOperationsSummary, Ti as SubscriptionInfo, Tr as SandboxFleetTraceBundle, U as BatchOptions, Ut as FleetExecDispatchOptions, V as BatchEvent, Vn as PromptResult, Vt as FleetDispatchResultBufferOptions, W as BatchResult, Wi as UsageInfo, Wt as FleetExecDispatchResult, Xn as ReapExpiredSandboxFleetsOptions, Yn as PublishPublicTemplateVersionOptions, Zn as ReapExpiredSandboxFleetsResult, _n as IntelligenceReportWindow, a as TraceExportSink, ar as SandboxEnvironment, bn as ListSandboxFleetOptions, br as SandboxFleetManifest, cr as SandboxFleetArtifactSpec, ct as CreateSandboxFleetOptions, dr as SandboxFleetDispatchResponse, dt as CreateSandboxOptions, fr as SandboxFleetDriverCapability, hn as IntelligenceReportCompareTo, i as TraceExportResult, jr as SandboxFleetWorkspaceReconcileResult, kr as SandboxFleetUsage, lr as SandboxFleetCostEstimate, lt as CreateSandboxFleetTokenOptions, mn as IntelligenceReportBudget, mr as SandboxFleetInfo, n as SandboxInstance, oi as SecretsManager, ot as CreateIntelligenceReportOptions, pn as IntelligenceReport, qn as PublicTemplateVersionInfo, qt as FleetPromptDispatchResult, rr as SandboxClientConfig, sr as SandboxFleetArtifact, st as CreateRequestOptions, t as HttpClient, ut as CreateSandboxFleetWithCoordinatorOptions, vr as SandboxFleetMachineRecord, wr as SandboxFleetToken, xi as SshKeysManager, xn as ListSandboxOptions, zn as PromptInputPart, zr as SandboxProfileSummary, zt as FleetDispatchCancelResult } from "./sandbox-Bm2C9Phd.js";
1
+ import { Bt as IntelligenceReport, Cn as PublishPublicTemplateVersionOptions, Dn as ReconcileSandboxFleetsResult, En as ReconcileSandboxFleetsOptions, F as CreateSandboxFleetOptions, Fn as SandboxEnvironment, Hn as SandboxFleetDriverCapability, Ht as IntelligenceReportCompareTo, I as CreateSandboxFleetTokenOptions, Ir as SecretsManager, Jn as SandboxFleetMachineRecord, Jt as ListSandboxFleetOptions, L as CreateSandboxFleetWithCoordinatorOptions, Ln as SandboxFleetArtifact, N as CreateIntelligenceReportOptions, Nn as SandboxClientConfig, P as CreateRequestOptions, Qn as SandboxFleetOperationsSummary, R as CreateSandboxOptions, Rn as SandboxFleetArtifactSpec, Sn as PublishPublicTemplateOptions, Tn as ReapExpiredSandboxFleetsResult, Vn as SandboxFleetDispatchResponse, Vt as IntelligenceReportBudget, Wn as SandboxFleetInfo, Wt as IntelligenceReportWindow, Xn as SandboxFleetManifest, Yt as ListSandboxOptions, Zr as SshKeysManager, _ as BatchResult, _t as FleetExecDispatchResult, a as AttachSandboxFleetMachineOptions, ar as SandboxFleetUsage, bi as UsageInfo, bn as PublicTemplateInfo, bt as FleetPromptDispatchResult, cr as SandboxFleetWorkspaceRestoreResult, er as SandboxFleetToken, et as ExecOptions, ft as FleetDispatchCancelResult, g as BatchOptions, gt as FleetExecDispatchOptions, hn as PromptResult, hr as SandboxProfileSummary, ht as FleetDispatchStreamOptions, ir as SandboxFleetTraceOptions, lr as SandboxFleetWorkspaceSnapshotResult, m as BatchEvent, mi as TokenRefreshHandler, mn as PromptOptions, mt as FleetDispatchResultBufferOptions, pn as PromptInputPart, pt as FleetDispatchResultBuffer, sr as SandboxFleetWorkspaceReconcileResult, ti as SubscriptionInfo, tr as SandboxFleetTraceBundle, tt as ExecResult, ur as SandboxInfo, v as BatchRunOptions, vt as FleetMachineId, wn as ReapExpiredSandboxFleetsOptions, x as BatchTask, xn as PublicTemplateVersionInfo, y as BatchRunRequest, yt as FleetPromptDispatchOptions, zn as SandboxFleetCostEstimate } from "./types-Cmpv-ox_.js";
2
+ import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-BhYmj7L3.js";
2
3
 
3
4
  //#region src/lib/sse-parser.d.ts
4
5
  /**
@@ -1,5 +1,5 @@
1
- import { d as exportTraceBundle, g as parseSSEStream, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-CeimsfC8.js";
2
1
  import { a as NotFoundError, d as TimeoutError, f as ValidationError, i as NetworkError, p as parseErrorResponse, t as AuthError } from "./errors-DSz87Rkk.js";
2
+ import { d as exportTraceBundle, g as parseSSEStream, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-CxBHIBV1.js";
3
3
  //#region src/resources.ts
4
4
  /**
5
5
  * Compute tiers, ordered smallest → largest. Defined HERE (not imported from
@@ -1,2 +1,2 @@
1
- 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";
1
+ 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-DKzapw-9.js";
2
2
  export { CollaborationBootstrapRequest, CollaborationBootstrapResponse, CollaborationClient, CollaborationClientConfig, CollaborationDocumentAdapter, CollaborationDocumentChange, CollaborationDocumentRef, CollaborationFileBridge, CollaborationFileBridgeOptions, CollaborationFileEvent, CollaborationPermissions, CollaborationTokenRefreshRequest, CollaborationTokenRefreshResponse, CollaborationTransportConfig, SaveCollaborationSnapshotRequest, SaveCollaborationSnapshotResponse, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
@@ -1,2 +1,2 @@
1
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-D17lnOJX.js";
1
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-QZXrXdIb.js";
2
2
  export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
package/dist/core.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { An as PreviewLinkInfo, Dt as ExecOptions, Gr as SandboxStatus, Ot as ExecResult, Pr as SandboxInfo, Tn as NetworkConfig, dt as CreateSandboxOptions, jn as PreviewLinkManager, n as SandboxInstance, rr as SandboxClientConfig } from "./sandbox-Bm2C9Phd.js";
2
- import { i as SandboxClient } from "./client-8wOu9raV.js";
3
- import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-H9268M_g.js";
1
+ import { $t as NetworkConfig, Nn as SandboxClientConfig, R as CreateSandboxOptions, an as PreviewLinkManager, et as ExecOptions, in as PreviewLinkInfo, tt as ExecResult, ur as SandboxInfo, xr as SandboxStatus } from "./types-Cmpv-ox_.js";
2
+ import { n as SandboxInstance } from "./sandbox-BhYmj7L3.js";
3
+ import { i as SandboxClient } from "./client-Cr39zlgv.js";
4
+ import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors--P_nbLzM.js";
4
5
  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-CeimsfC8.js";
2
1
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-DSz87Rkk.js";
3
- import { n as SandboxClient } from "./client-B3oM6E-L.js";
2
+ import { t as SandboxInstance } from "./sandbox-CxBHIBV1.js";
3
+ import { n as SandboxClient } from "./client-Df1K1d_Q.js";
4
4
  export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
@@ -1,4 +1,5 @@
1
- import { dt as CreateSandboxOptions, n as SandboxInstance, t as HttpClient } from "./sandbox-Bm2C9Phd.js";
1
+ import { R as CreateSandboxOptions } from "./types-Cmpv-ox_.js";
2
+ import { n as SandboxInstance, t as HttpClient } from "./sandbox-BhYmj7L3.js";
2
3
 
3
4
  //#region src/tangle/abi.d.ts
4
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { $i as AgentProfileFileMount, $n as ReconcileSandboxFleetsResult, $r as SandboxTraceOptions, $t as GitDiff, A as AddUserOptions, Ai as TaskSessionFileChange, An as PreviewLinkInfo, Ar as SandboxFleetWorkspace, At as FileReadBatchOptions, B as BatchBackendStats, Bi as TurnDriveResult, Bn as PromptOptions, Br as SandboxResourceUsage, Bt as FleetDispatchResultBuffer, C as SandboxMcpConfig, Ci as StartupOperation, Cn as MintScopedTokenOptions, Cr as SandboxFleetPolicy, Ct as DriverType, D as buildSandboxMcpConfig, Di as TaskResult, Dn as NonHostAgentDriverConfig, Dr as SandboxFleetTraceExport, Dt as ExecOptions, E as buildControlPlaneMcpConfig, Ei as TaskOptions, En as NetworkManager, Er as SandboxFleetTraceEvent, Et as EventStreamOptions, F as BackendInfo, Fi as TeeAttestationResponse, Fn as ProcessManager, Fr as SandboxIntelligenceEnvelope, Ft as FileTreeFile, G as BatchRunOptions, Gi as WaitForOptions, Gn as ProvisionStep, Gr as SandboxStatus, Gt as FleetMachineId, H as BatchEventDataMap, Hi as UploadOptions, Hn as ProvisionEvent, Hr as SandboxRuntimeHealth, Ht as FleetDispatchStreamOptions, I as BackendManager, Ii as TeePublicKey, In as ProcessSignal, Ir as SandboxPermissionsConfig, It as FileTreeOptions, J as BatchTask, Ji as WriteManyOptions, Jn as PublishPublicTemplateOptions, Jr as SandboxTerminalManager, Jt as GPU_LEASE_PROVIDER_NAMES, K as BatchRunRequest, Ki as WriteFileOptions, Kn as PublicTemplateInfo, Kr as SandboxTerminalCreateOptions, Kt as FleetPromptDispatchOptions, L as BackendStatus, Li as TeePublicKeyResponse, Ln as ProcessSpawnOptions, Lr as SandboxPortBinding, Lt as FileTreeResult, M as AttachSandboxFleetMachineOptions, Mi as TaskSessionProfile, Mn as Process, Mr as SandboxFleetWorkspaceRestoreResult, Mt as FileReadError, N as BackendCapabilities, Ni as TeeAttestationOptions, Nn as ProcessInfo, Nr as SandboxFleetWorkspaceSnapshotResult, Nt as FileReadResult, O as AcceleratorKind, Oi as TaskSessionChanges, On as PermissionLevel, Or as SandboxFleetTraceOptions, Ot as ExecResult, P as BackendConfig, Pi as TeeAttestationReport, Pn as ProcessLogEntry, Pr as SandboxInfo, Pt as FileSystem, Qi as AgentProfileConnection, Qn as ReconcileSandboxFleetsOptions, Qr as SandboxTraceExport, Qt as GitConfig, R as BackendType, Ri as TokenRefreshHandler, Rn as ProcessStatus, Rr as SandboxPortPreviewLink, Rt as FileWriteResult, S as SANDBOX_MCP_SERVER_NAME, Si as StartupDiagnostics, Sn as McpServerConfig, Sr as SandboxFleetOperationsSummary, St as DriverInfo, T as SandboxMcpServerEntry, Ti as SubscriptionInfo, Tn as NetworkConfig, Tr as SandboxFleetTraceBundle, Tt as EgressPolicy, U as BatchOptions, Ui as UploadProgress, Un as ProvisionResult, Ur as SandboxRuntimeProfile, Ut as FleetExecDispatchOptions, V as BatchEvent, Vi as UpdateUserOptions, Vn as PromptResult, Vr as SandboxResources, Vt as FleetDispatchResultBufferOptions, W as BatchResult, Wi as UsageInfo, Wn as ProvisionStatus, Wr as SandboxRuntimeProfileList, X as BatchTaskUsage, Xi as AgentProfileCapabilities, Xn as ReapExpiredSandboxFleetsOptions, Xr as SandboxTraceBundle, Xt as GitBranch, Y as BatchTaskResult, Yi as AgentProfile, Yn as PublishPublicTemplateVersionOptions, Yr as SandboxTerminalRequestOptions, Yt as GitAuth, Z as BranchOptions, Zi as AgentProfileConfidential, Zn as ReapExpiredSandboxFleetsResult, Zr as SandboxTraceEvent, Zt as GitCommit, _ as RespondToPermissionOptions, _i as SessionStatus, _n as IntelligenceReportWindow, _r as SandboxFleetMachineMeteredUsage, _t as DispatchedSession, a as TraceExportSink, aa as AgentProfileResources, ai as SecretInfo, an as GpuLeaseExecResult, ar as SandboxEnvironment, at as CreateGpuLeaseOptions, b as BuildSandboxMcpConfigOptions, bi as SnapshotResult, bn as ListSandboxFleetOptions, br as SandboxFleetManifest, bt as DriveTurnOptions, c as otelTraceIdForTangleTrace, ca as AgentSubagentProfile, ci as SendSessionMessageRequest, cn as GpuLeaseStatus, cr as SandboxFleetArtifactSpec, ct as CreateSandboxFleetOptions, d as SandboxSession, da as defineInlineResource, di as SessionEventStreamOptions, dn as HostAgentRuntimeBackend, dr as SandboxFleetDispatchResponse, dt as CreateSandboxOptions, ea as AgentProfileMcpServer, ei as SandboxUser, en as GitStatus, er as RunCodeOptions, f as InteractiveAuthFile, fa as mergeAgentProfiles, fi as SessionForkOptions, fn as InstalledTool, fr as SandboxFleetDriverCapability, ft as CreateSessionOptions, g as InterruptResult, gi as SessionMessageInputPart, gn as IntelligenceReportSubjectType, gr as SandboxFleetMachine, gt as DispatchPromptOptions, h as InteractiveSessionInfo, hi as SessionMessage, hn as IntelligenceReportCompareTo, hr as SandboxFleetIntelligenceEnvelope, ht as DirectoryPermission, i as TraceExportResult, ia as AgentProfileResourceRef, ii as SearchOptions, in as GpuLeaseExecOptions, ir as SandboxConnection, it as CompletedTurnResult, j as AttachGpuLeaseOptions, ji as TaskSessionInfo, jn as PreviewLinkManager, jr as SandboxFleetWorkspaceReconcileResult, jt as FileReadBatchResult, k as AccessPolicyRule, ki as TaskSessionCommitResult, kn as PermissionsManager, kr as SandboxFleetUsage, kt as FileInfo, l as toOtelJson, la as defineAgentProfile, li as SentSessionMessage, ln as GpuType, lr as SandboxFleetCostEstimate, m as InteractiveSessionHost, mi as SessionListOptions, mn as IntelligenceReportBudget, mr as SandboxFleetInfo, mt as DeleteOptions, n as SandboxInstance, na as AgentProfilePermissionValue, ni as ScopedTokenScope, nn as GpuLeaseBilling, nr as SSHCredentials, o as buildTraceExportPayload, oa as AgentProfileValidationIssue, oi as SecretsManager, on as GpuLeaseManager, or as SandboxEvent, ot as CreateIntelligenceReportOptions, p as InteractiveSessionHandle, pi as SessionInfo, pn as IntelligenceReport, pr as SandboxFleetDriverTimings, pt as CreateTaskSessionOptions, q as BatchSidecarGroup, qi as WriteManyFile, qn as PublicTemplateVersionInfo, qr as SandboxTerminalInfo, r as TraceExportFormat, ra as AgentProfilePrompt, ri as SearchMatch, rn as GpuLeaseCommandResult, rr as SandboxClientConfig, rt as CommitTaskSessionOptions, s as exportTraceBundle, sa as AgentProfileValidationResult, si as SendSessionMessageOptions, sn as GpuLeaseProviderName, sr as SandboxFleetArtifact, ta as AgentProfileModelHints, ti as ScopedToken, tn as GpuLease, tr as SSHCommandDescriptor, tt as CodeResult, u as SandboxTaskSession, ua as defineGitHubResource, ui as SessionBackendCredentials, un as HostAgentDriverConfig, ur as SandboxFleetDispatchFailureClass, ut as CreateSandboxFleetWithCoordinatorOptions, v as StartInteractiveOptions, vi as SnapshotInfo, vn as ListMessagesOptions, vr as SandboxFleetMachineRecord, vt as DownloadOptions, w as SandboxMcpEndpoint, wi as StorageConfig, wn as MkdirOptions, wr as SandboxFleetToken, wt as EgressManager, x as CONTROL_PLANE_MCP_SERVER_NAME, xn as ListSandboxOptions, xr as SandboxFleetManifestMachine, xt as DriverConfig, y as BuildControlPlaneMcpConfigOptions, yi as SnapshotOptions, yn as ListOptions, yr as SandboxFleetMachineSpec, yt as DownloadProgress, z as BatchBackend, zi as ToolsConfig, zr as SandboxProfileSummary, zt as FleetDispatchCancelResult } from "./sandbox-Bm2C9Phd.js";
2
- import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-8wOu9raV.js";
3
- import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-D-2pH_70.js";
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
- import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-H9268M_g.js";
6
- import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-DS4SOkKG.js";
1
+ import { $ as EventStreamOptions, $n as SandboxFleetPolicy, $r as StartupOperation, $t as NetworkConfig, A as CommitTaskSessionOptions, Ai as AgentProfileMcpServer, An as RunCodeOptions, Ar as SandboxUser, At as GpuLeaseCommandResult, B as CreateTaskSessionOptions, Bi as defineGitHubResource, Bn as SandboxFleetDispatchFailureClass, Br as SessionBackendCredentials, Bt as IntelligenceReport, C as BatchTaskUsage, Ci as WriteManyFile, Cn as PublishPublicTemplateVersionOptions, Cr as SandboxTerminalInfo, Ct as GitBranch, Di as AgentProfileConfidential, Dn as ReconcileSandboxFleetsResult, Dr as SandboxTraceEvent, Dt as GitStatus, Ei as AgentProfileCapabilities, En as ReconcileSandboxFleetsOptions, Er as SandboxTraceBundle, Et as GitDiff, F as CreateSandboxFleetOptions, Fi as AgentProfileResources, Fn as SandboxEnvironment, Fr as SecretInfo, Ft as GpuLeaseStatus, G as DownloadOptions, Gn as SandboxFleetIntelligenceEnvelope, Gr as SessionMessage, H as DirectoryPermission, Hi as mergeAgentProfiles, Hn as SandboxFleetDriverCapability, Hr as SessionForkOptions, Ht as IntelligenceReportCompareTo, Ii as AgentProfileValidationIssue, In as SandboxEvent, Ir as SecretsManager, It as GpuType, J as DriverConfig, Jn as SandboxFleetMachineRecord, Jr as SnapshotInfo, Jt as ListSandboxFleetOptions, K as DownloadProgress, Kn as SandboxFleetMachine, Kr as SessionMessageInputPart, Kt as ListMessagesOptions, L as CreateSandboxFleetWithCoordinatorOptions, Li as AgentProfileValidationResult, Ln as SandboxFleetArtifact, Lr as SendSessionMessageOptions, Lt as HostAgentDriverConfig, M as CreateGpuLeaseOptions, Mi as AgentProfilePermissionValue, Mn as SSHCredentials, Mr as ScopedTokenScope, Mt as GpuLeaseExecResult, N as CreateIntelligenceReportOptions, Ni as AgentProfilePrompt, Nn as SandboxClientConfig, Nr as SearchMatch, Nt as GpuLeaseManager, O as CodeResult, Oi as AgentProfileConnection, Or as SandboxTraceExport, Ot as GpuLease, Pi as AgentProfileResourceRef, Pn as SandboxConnection, Pr as SearchOptions, Pt as GpuLeaseProviderName, Q as EgressPolicy, Qn as SandboxFleetOperationsSummary, Qr as StartupDiagnostics, Qt as MkdirOptions, R as CreateSandboxOptions, Ri as AgentSubagentProfile, Rn as SandboxFleetArtifactSpec, Rr as SendSessionMessageRequest, Rt as HostAgentRuntimeBackend, S as BatchTaskResult, Si as WriteFileOptions, Sn as PublishPublicTemplateOptions, Sr as SandboxTerminalCreateOptions, St as GitAuth, Ti as AgentProfile, Tn as ReapExpiredSandboxFleetsResult, Tr as SandboxTerminalRequestOptions, Tt as GitConfig, U as DispatchPromptOptions, Un as SandboxFleetDriverTimings, Ur as SessionInfo, Ut as IntelligenceReportSubjectType, V as DeleteOptions, Vi as defineInlineResource, Vn as SandboxFleetDispatchResponse, Vr as SessionEventStreamOptions, Vt as IntelligenceReportBudget, W as DispatchedSession, Wn as SandboxFleetInfo, Wr as SessionListOptions, Wt as IntelligenceReportWindow, X as DriverType, Xn as SandboxFleetManifest, Xr as SnapshotResult, Xt as McpServerConfig, Y as DriverInfo, Yn as SandboxFleetMachineSpec, Yr as SnapshotOptions, Yt as ListSandboxOptions, Z as EgressManager, Zn as SandboxFleetManifestMachine, Zt as MintScopedTokenOptions, _ as BatchResult, _i as UpdateUserOptions, _n as ProvisionResult, _r as SandboxResources, a as AttachSandboxFleetMachineOptions, ai as TaskSessionCommitResult, an as PreviewLinkManager, ar as SandboxFleetUsage, at as FileReadError, b as BatchSidecarGroup, bi as UsageInfo, bn as PublicTemplateInfo, br as SandboxRuntimeProfileList, c as BackendInfo, ci as TaskSessionProfile, cn as ProcessLogEntry, cr as SandboxFleetWorkspaceRestoreResult, ct as FileTreeFile, d as BackendType, di as TeeAttestationResponse, dn as ProcessSpawnOptions, dr as SandboxIntelligenceEnvelope, dt as FileWriteResult, ei as StorageConfig, en as NetworkManager, er as SandboxFleetToken, et as ExecOptions, f as BatchBackend, fi as TeePublicKey, fn as ProcessStatus, fr as SandboxPermissionsConfig, ft as FleetDispatchCancelResult, g as BatchOptions, gi as TurnDriveResult, gn as ProvisionEvent, gr as SandboxResourceUsage, gt as FleetExecDispatchOptions, h as BatchEventDataMap, hi as ToolsConfig, hn as PromptResult, hr as SandboxProfileSummary, ht as FleetDispatchStreamOptions, i as AttachGpuLeaseOptions, ii as TaskSessionChanges, in as PreviewLinkInfo, ir as SandboxFleetTraceOptions, it as FileReadBatchResult, j as CompletedTurnResult, ji as AgentProfileModelHints, jn as SSHCommandDescriptor, jr as ScopedToken, jt as GpuLeaseExecOptions, ki as AgentProfileFileMount, kr as SandboxTraceOptions, kt as GpuLeaseBilling, l as BackendManager, li as TeeAttestationOptions, ln as ProcessManager, lr as SandboxFleetWorkspaceSnapshotResult, lt as FileTreeOptions, m as BatchEvent, mi as TokenRefreshHandler, mn as PromptOptions, mr as SandboxPortPreviewLink, mt as FleetDispatchResultBufferOptions, n as AccessPolicyRule, ni as TaskOptions, nn as PermissionLevel, nr as SandboxFleetTraceEvent, nt as FileInfo, o as BackendCapabilities, oi as TaskSessionFileChange, on as Process, or as SandboxFleetWorkspace, ot as FileReadResult, p as BatchBackendStats, pi as TeePublicKeyResponse, pr as SandboxPortBinding, pt as FleetDispatchResultBuffer, q as DriveTurnOptions, qn as SandboxFleetMachineMeteredUsage, qr as SessionStatus, qt as ListOptions, r as AddUserOptions, ri as TaskResult, rn as PermissionsManager, rr as SandboxFleetTraceExport, rt as FileReadBatchOptions, s as BackendConfig, si as TaskSessionInfo, sn as ProcessInfo, sr as SandboxFleetWorkspaceReconcileResult, st as FileSystem, t as AcceleratorKind, ti as SubscriptionInfo, tn as NonHostAgentDriverConfig, tr as SandboxFleetTraceBundle, tt as ExecResult, u as BackendStatus, ui as TeeAttestationReport, un as ProcessSignal, ur as SandboxInfo, ut as FileTreeResult, v as BatchRunOptions, vi as UploadOptions, vn as ProvisionStatus, vr as SandboxRuntimeHealth, vt as FleetMachineId, w as BranchOptions, wi as WriteManyOptions, wn as ReapExpiredSandboxFleetsOptions, wr as SandboxTerminalManager, wt as GitCommit, x as BatchTask, xi as WaitForOptions, xn as PublicTemplateVersionInfo, xr as SandboxStatus, xt as GPU_LEASE_PROVIDER_NAMES, y as BatchRunRequest, yi as UploadProgress, yn as ProvisionStep, yr as SandboxRuntimeProfile, yt as FleetPromptDispatchOptions, z as CreateSessionOptions, zi as defineAgentProfile, zn as SandboxFleetCostEstimate, zr as SentSessionMessage, zt as InstalledTool } from "./types-Cmpv-ox_.js";
2
+ import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-BhYmj7L3.js";
3
+ import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-Cr39zlgv.js";
4
+ import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-CyHojkuA.js";
5
+ 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-DKzapw-9.js";
6
+ import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors--P_nbLzM.js";
7
+ import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-DzEUjav-.js";
7
8
 
8
9
  //#region src/attestation-heartbeat.d.ts
9
10
  interface TeeAttestationHeartbeatSample {
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { _ as normalizeRuntimeBackendConfig, a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, h as encodeTextForWire, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload, v as serializeForSidecar } from "./sandbox-CeimsfC8.js";
1
+ import { i as serializeForSidecar, r as normalizeRuntimeBackendConfig } from "./runtime-api-CYA2DUQw.js";
2
2
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-DSz87Rkk.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-B3oM6E-L.js";
4
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-D17lnOJX.js";
5
- import { t as TangleSandboxClient } from "./tangle-DayyZe-i.js";
3
+ import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, h as encodeTextForWire, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-CxBHIBV1.js";
4
+ 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-Df1K1d_Q.js";
5
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-QZXrXdIb.js";
6
+ import { t as TangleSandboxClient } from "./tangle-BdRRHMpX.js";
6
7
  import { defineAgentProfile, defineGitHubResource, defineInlineResource, mergeAgentProfiles } from "@tangle-network/agent-interface";
7
8
  //#region src/confidential.ts
8
9
  function generateAttestationNonce(bytes = 32) {
@@ -0,0 +1,434 @@
1
+ import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-DSz87Rkk.js";
2
+ //#region src/backend-config.ts
3
+ const LEGACY_QUESTION_ALIAS_KEY = ["question", "Channel"].join("");
4
+ function parseModelString(model) {
5
+ const parts = model.split("/");
6
+ if (parts.length >= 2) return {
7
+ provider: parts[0],
8
+ model: parts.slice(1).join("/")
9
+ };
10
+ return { model };
11
+ }
12
+ /**
13
+ * Normalize runtime backend config for the wire format.
14
+ *
15
+ * Callers set `backend.profile` (named string or portable AgentProfile).
16
+ * This function generates the native `inlineProfile` shim automatically.
17
+ */
18
+ function normalizeRuntimeBackendConfig(backend, options = {}) {
19
+ if (!backend && !options.model) return void 0;
20
+ if (backend && LEGACY_QUESTION_ALIAS_KEY in backend) throw new Error(`[sandbox-sdk] backend.${LEGACY_QUESTION_ALIAS_KEY} was removed. Use backend.interactions.question instead.`);
21
+ const portableProfile = backend?.profile && typeof backend.profile !== "string" ? backend.profile : void 0;
22
+ const inlineProfile = portableProfile ? toBackendProfile(portableProfile) : void 0;
23
+ const callerInlineProfile = backend?.inlineProfile;
24
+ if (callerInlineProfile && !inlineProfile) console.warn("[sandbox-sdk] backend.inlineProfile is deprecated. Use backend.profile (AgentPortableProfile) instead.");
25
+ if (inlineProfile && portableProfile) {
26
+ const reasoningEffort = portableProfile.model?.reasoningEffort ?? portableProfile.extensions?.[backend?.type ?? ""]?.reasoningEffort;
27
+ if (typeof reasoningEffort === "string" && reasoningEffort !== "auto" && reasoningEffort !== "none") inlineProfile.reasoningEffort = reasoningEffort;
28
+ }
29
+ return {
30
+ ...backend?.type ? { type: backend.type } : {},
31
+ ...typeof backend?.profile === "string" ? { profile: backend.profile } : {},
32
+ ...inlineProfile ? { inlineProfile } : callerInlineProfile ? { inlineProfile: callerInlineProfile } : {},
33
+ ...backend?.model ? { model: backend.model } : options.model ? { model: parseModelString(options.model) } : {},
34
+ ...backend?.server ? { server: backend.server } : {},
35
+ ...backend?.interactions !== void 0 ? { interactions: backend.interactions } : {},
36
+ ...backend?.metadata !== void 0 ? { metadata: backend.metadata } : {}
37
+ };
38
+ }
39
+ /**
40
+ * Permission keys the sidecar's strict `permission` schema accepts
41
+ * (apps/sidecar/src/schemas/agent-profile-schema.ts → permissionConfigSchema).
42
+ * Any other portable-permission key is a per-tool gate, not a permission, and
43
+ * is routed into `tools` instead of passed through — the sidecar's `.strict()`
44
+ * schema rejects unknown permission keys with `unrecognized_keys`.
45
+ *
46
+ * Name must not carry an UPPERCASE `SIDECAR_`/`ORCHESTRATOR_`-style prefix:
47
+ * obfuscate.sh runs `--rename-globals false`, so a module-global identifier
48
+ * ships verbatim in dist/, and verify-dist.sh bans those prefixes as
49
+ * closed-source leaks.
50
+ */
51
+ const CANONICAL_PERMISSION_KEYS = new Set([
52
+ "edit",
53
+ "bash",
54
+ "webfetch",
55
+ "mcp",
56
+ "doom_loop",
57
+ "external_directory"
58
+ ]);
59
+ function hasAnyProfileResource(resources) {
60
+ return !!(resources.files?.length || resources.tools?.length || resources.skills?.length || resources.agents?.length || resources.commands?.length || resources.instructions);
61
+ }
62
+ function validateProfileResources(profile) {
63
+ if (profile.resources !== void 0 && (profile.resources === null || typeof profile.resources !== "object" || Array.isArray(profile.resources))) throw new Error("backend.profile.resources must be an object when provided");
64
+ if (profile.resources?.plugins?.length) throw new Error("backend.profile.resources.plugins is not supported by the sandbox SDK profile contract; use backend-specific provider profiles for OpenCode plugin resources");
65
+ }
66
+ function toBackendProfile(profile) {
67
+ validateProfileResources(profile);
68
+ const permission = {};
69
+ const derivedTools = {};
70
+ for (const [rawKey, value] of Object.entries(profile.permissions ?? {})) {
71
+ const key = rawKey === "network" ? "webfetch" : rawKey;
72
+ if (CANONICAL_PERMISSION_KEYS.has(key)) permission[key] = value;
73
+ else if (typeof value === "string") derivedTools[key] = value !== "deny";
74
+ else console.warn(`[sandbox-sdk] dropping unsupported permission key "${rawKey}": not a canonical sidecar permission and not a string tool gate`);
75
+ }
76
+ const tools = {
77
+ ...derivedTools,
78
+ ...profile.tools ?? {}
79
+ };
80
+ const mcp = profile.mcp ? Object.fromEntries(Object.entries(profile.mcp).map(([name, config]) => {
81
+ const c = config;
82
+ const transport = c.transport;
83
+ const command = c.command;
84
+ const hasCommand = Array.isArray(command) ? command.length > 0 : typeof command === "string" && command.trim().length > 0;
85
+ const isRemote = transport === "http" || transport === "sse" || typeof c.url === "string" && !hasCommand;
86
+ const enabled = c.enabled;
87
+ const timeout = c.timeout;
88
+ if (isRemote) return [name, {
89
+ type: "remote",
90
+ url: c.url,
91
+ ...c.headers ? { headers: c.headers } : {},
92
+ ...enabled !== void 0 ? { enabled } : {},
93
+ ...timeout !== void 0 ? { timeout } : {}
94
+ }];
95
+ return [name, {
96
+ type: "local",
97
+ command: [...Array.isArray(command) ? command : typeof command === "string" ? command.trim().split(/\s+/).filter(Boolean) : [], ...c.args ?? []],
98
+ ...c.env ? { environment: c.env } : {},
99
+ ...enabled !== void 0 ? { enabled } : {},
100
+ ...timeout !== void 0 ? { timeout } : {}
101
+ }];
102
+ })) : void 0;
103
+ const openCodeExtension = profile.extensions?.opencode;
104
+ const plugins = openCodeExtension?.plugins;
105
+ if (plugins !== void 0 && (!Array.isArray(plugins) || plugins.some((plugin) => typeof plugin !== "string" || !plugin.trim()))) throw new Error("backend.profile.extensions.opencode.plugins must be an array of non-empty package names");
106
+ const commands = openCodeExtension?.commands;
107
+ if (commands !== void 0 && (commands === null || typeof commands !== "object" || Array.isArray(commands))) throw new Error("backend.profile.extensions.opencode.commands must be an object");
108
+ const profileExtends = openCodeExtension?.extends;
109
+ if (profileExtends !== void 0 && typeof profileExtends !== "string" && (!Array.isArray(profileExtends) || profileExtends.some((entry) => typeof entry !== "string" || !entry.trim()))) throw new Error("backend.profile.extensions.opencode.extends must be a profile name or array of profile names");
110
+ const agents = profile.subagents ? Object.fromEntries(Object.entries(profile.subagents).map(([name, subagent]) => [name, {
111
+ description: subagent.description,
112
+ prompt: subagent.prompt,
113
+ model: subagent.model,
114
+ tools: subagent.tools,
115
+ permission: subagent.permissions,
116
+ maxSteps: subagent.maxSteps,
117
+ ...subagent.metadata ?? {}
118
+ }])) : void 0;
119
+ return {
120
+ name: profile.name,
121
+ description: profile.description,
122
+ version: profile.version,
123
+ tags: profile.tags,
124
+ ...profileExtends ? { extends: profileExtends } : {},
125
+ model: profile.model?.default,
126
+ small_model: profile.model?.small,
127
+ ...profile.prompt?.systemPrompt ? { systemPrompt: profile.prompt.systemPrompt } : {},
128
+ ...Object.keys(tools).length > 0 ? { tools } : {},
129
+ ...profile.prompt?.instructions?.length ? { instructions: profile.prompt.instructions } : {},
130
+ ...Object.keys(permission).length > 0 ? { permission } : {},
131
+ ...mcp ? { mcp } : {},
132
+ ...profile.connections?.length ? { connections: profile.connections } : {},
133
+ ...agents ? { agent: agents } : {},
134
+ ...profile.resources && hasAnyProfileResource(profile.resources) ? { resources: profile.resources } : {},
135
+ ...profile.hooks ? { hooks: profile.hooks } : {},
136
+ ...profile.modes ? { modes: profile.modes } : {},
137
+ ...commands ? { command: commands } : {},
138
+ ...plugins?.length ? { plugin: plugins } : {},
139
+ ...profile.extensions ? { extensions: profile.extensions } : {}
140
+ };
141
+ }
142
+ /**
143
+ * Serialize a portable AgentProfile into the sidecar's canonical inline-profile
144
+ * wire shape (validated by inlineProfileSchema in
145
+ * apps/sidecar/src/schemas/agent-profile-schema.ts).
146
+ *
147
+ * Single choke point every product shares: streamPrompt →
148
+ * normalizeRuntimeBackendConfig → toBackendProfile. Exported so callers and the
149
+ * drift-guard test target one contract — the test parses this output with the
150
+ * sidecar's own schema, so any future schema tightening fails here first.
151
+ */
152
+ function serializeForSidecar(profile) {
153
+ return toBackendProfile(profile);
154
+ }
155
+ //#endregion
156
+ //#region src/runtime-api.ts
157
+ /** Internal typed client for routes served by a sandbox runtime. */
158
+ var SandboxRuntimeApi = class {
159
+ terminals;
160
+ constructor(transport) {
161
+ this.transport = transport;
162
+ this.terminals = {
163
+ create: (options, request) => this.createTerminal(options, request),
164
+ input: (terminalId, data, request) => this.writeTerminal(terminalId, data, request),
165
+ list: () => this.listTerminals(),
166
+ get: (terminalId) => this.getTerminal(terminalId)
167
+ };
168
+ }
169
+ async health() {
170
+ await this.transport.ensureRunning();
171
+ return this.json("/health", { method: "GET" });
172
+ }
173
+ async ports() {
174
+ await this.transport.ensureRunning();
175
+ return (await this.json("/ports", { method: "GET" })).data?.ports ?? [];
176
+ }
177
+ async profiles() {
178
+ await this.transport.ensureRunning();
179
+ return this.json("/profiles", { method: "GET" });
180
+ }
181
+ async readFiles(paths, options = {}) {
182
+ if (paths.length === 0) return {
183
+ files: [],
184
+ errors: [],
185
+ stats: {
186
+ requested: 0,
187
+ succeeded: 0,
188
+ failed: 0
189
+ }
190
+ };
191
+ await this.transport.ensureRunning();
192
+ const files = [];
193
+ const errors = [];
194
+ let requested = 0;
195
+ let succeeded = 0;
196
+ let failed = 0;
197
+ for (let offset = 0; offset < paths.length; offset += 100) {
198
+ const chunk = paths.slice(offset, offset + 100);
199
+ const params = new URLSearchParams();
200
+ if (options.sessionId) params.set("sessionId", options.sessionId);
201
+ const query = params.toString();
202
+ const payload = await this.json(`/files/read-batch${query ? `?${query}` : ""}`, {
203
+ method: "POST",
204
+ body: JSON.stringify({
205
+ paths: chunk,
206
+ ...options.encoding ? { encoding: options.encoding } : {}
207
+ })
208
+ });
209
+ for (const [path, result] of Object.entries(payload.data.files)) if (result.success) files.push({
210
+ path,
211
+ content: result.content,
212
+ encoding: result.encoding,
213
+ hash: result.hash,
214
+ size: result.size,
215
+ mtime: result.mtime
216
+ });
217
+ else errors.push({
218
+ path,
219
+ error: result.error,
220
+ code: result.code
221
+ });
222
+ const results = Object.values(payload.data.files);
223
+ requested += payload.data.stats?.requested ?? chunk.length;
224
+ succeeded += payload.data.stats?.succeeded ?? results.filter((entry) => entry.success).length;
225
+ failed += payload.data.stats?.failed ?? results.filter((entry) => !entry.success).length;
226
+ }
227
+ return {
228
+ files,
229
+ errors,
230
+ stats: {
231
+ requested,
232
+ succeeded,
233
+ failed
234
+ }
235
+ };
236
+ }
237
+ async writeFile(path, content, options = {}) {
238
+ await this.transport.ensureRunning();
239
+ const params = new URLSearchParams();
240
+ if (options.sessionId) params.set("sessionId", options.sessionId);
241
+ const query = params.toString();
242
+ return (await this.json(`/files/write${query ? `?${query}` : ""}`, {
243
+ method: "POST",
244
+ body: JSON.stringify({
245
+ path,
246
+ content,
247
+ ...options.encoding !== void 0 ? { encoding: options.encoding } : {},
248
+ ...options.mode !== void 0 ? { mode: options.mode } : {}
249
+ })
250
+ })).data;
251
+ }
252
+ async deleteFile(path, options = {}) {
253
+ await this.transport.ensureRunning();
254
+ const params = new URLSearchParams();
255
+ if (options.sessionId) params.set("sessionId", options.sessionId);
256
+ const query = params.toString();
257
+ await this.request(`/files/delete${query ? `?${query}` : ""}`, {
258
+ method: "POST",
259
+ body: JSON.stringify({ path })
260
+ });
261
+ }
262
+ async fileTree(path, options = {}) {
263
+ if (options.maxDepth !== void 0 && (!Number.isInteger(options.maxDepth) || options.maxDepth < 1 || options.maxDepth > 20)) throw new ValidationError("maxDepth must be an integer between 1 and 20");
264
+ await this.transport.ensureRunning();
265
+ const params = new URLSearchParams({ path });
266
+ if (options.maxDepth !== void 0) params.set("maxDepth", String(options.maxDepth));
267
+ if (options.sessionId) params.set("sessionId", options.sessionId);
268
+ return (await this.json(`/files/tree?${params}`, { method: "GET" })).data;
269
+ }
270
+ async createSession(options) {
271
+ await this.transport.ensureRunning();
272
+ const info = normalizeSessionInfo(await this.json("/agents/sessions", {
273
+ method: "POST",
274
+ body: JSON.stringify({
275
+ ...options.title !== void 0 ? { title: options.title } : {},
276
+ ...options.parentId !== void 0 ? { parentID: options.parentId } : {},
277
+ backend: normalizeRuntimeBackendConfig(options.backend)
278
+ })
279
+ }));
280
+ if (!info) throw new ServerError("Session creation response missing session id", 502, {
281
+ endpoint: "/agents/sessions",
282
+ origin: "runtime"
283
+ });
284
+ return info;
285
+ }
286
+ async messages(id, options = {}) {
287
+ await this.transport.ensureRunning();
288
+ const params = new URLSearchParams({ sessionId: id });
289
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
290
+ if (options.offset !== void 0) params.set("offset", String(options.offset));
291
+ if (options.since !== void 0) params.set("since", String(options.since));
292
+ const query = params.toString();
293
+ return (await this.json(`/messages${query ? `?${query}` : ""}`, { method: "GET" })).map((message) => ({
294
+ id: message.info.id,
295
+ role: message.info.role,
296
+ timestamp: message.info.timestamp,
297
+ parts: message.parts,
298
+ metadata: message.info.metadata
299
+ }));
300
+ }
301
+ async createTaskSession(options) {
302
+ await this.transport.ensureRunning();
303
+ const info = await this.json("/tasks", {
304
+ method: "POST",
305
+ body: JSON.stringify({
306
+ sessionId: options.sessionId,
307
+ backend: normalizeRuntimeBackendConfig(options.backend),
308
+ title: options.title,
309
+ ...options.parentSessionId !== void 0 ? { parentSessionId: options.parentSessionId } : {},
310
+ ...options.profile !== void 0 ? { profile: options.profile } : {},
311
+ ...options.isolateFileWrites !== void 0 ? { isolateFileWrites: options.isolateFileWrites } : {}
312
+ })
313
+ });
314
+ if (!info.id) throw new ServerError("Task session creation response missing session id", 502, {
315
+ endpoint: "/tasks",
316
+ origin: "runtime"
317
+ });
318
+ return info;
319
+ }
320
+ async sendSessionMessage(id, request, options = {}) {
321
+ if (options.timeoutMs !== void 0 && options.timeoutMs <= 0) throw new ValidationError("timeoutMs must be greater than zero");
322
+ await this.transport.ensureRunning();
323
+ const headers = new Headers({ "x-no-retry": "true" });
324
+ if (options.credentials?.apiKey) headers.set("X-Backend-Api-Key", options.credentials.apiKey);
325
+ if (options.credentials?.baseUrl) headers.set("X-Backend-Base-Url", options.credentials.baseUrl);
326
+ const timeoutSignal = options.timeoutMs !== void 0 ? AbortSignal.timeout(options.timeoutMs) : void 0;
327
+ const signal = options.signal && timeoutSignal ? AbortSignal.any([options.signal, timeoutSignal]) : options.signal ?? timeoutSignal;
328
+ return this.json(`/agents/sessions/${encodeURIComponent(id)}/messages`, {
329
+ method: "POST",
330
+ headers,
331
+ signal,
332
+ body: JSON.stringify({
333
+ ...request.messageId !== void 0 ? { messageID: request.messageId } : {},
334
+ parts: request.parts,
335
+ ...request.system !== void 0 ? { system: request.system } : {},
336
+ ...request.agent !== void 0 ? { agent: request.agent } : {},
337
+ ...request.model !== void 0 ? { model: {
338
+ providerID: request.model.providerId,
339
+ modelID: request.model.modelId
340
+ } } : {},
341
+ ...request.reasoningEffort !== void 0 ? { reasoningEffort: request.reasoningEffort } : {},
342
+ ...request.turnId !== void 0 ? { turnId: request.turnId } : {},
343
+ ...request.interactions !== void 0 ? { interactions: request.interactions } : {}
344
+ })
345
+ });
346
+ }
347
+ async deleteSession(id) {
348
+ await this.transport.ensureRunning();
349
+ await this.request(`/agents/sessions/${encodeURIComponent(id)}`, { method: "DELETE" });
350
+ }
351
+ async taskSessionChanges(id) {
352
+ await this.transport.ensureRunning();
353
+ return this.json(`/tasks/${encodeURIComponent(id)}/changes`, { method: "GET" });
354
+ }
355
+ async commitTaskSession(id, options = {}) {
356
+ await this.transport.ensureRunning();
357
+ return this.json(`/tasks/${encodeURIComponent(id)}/changes`, {
358
+ method: "POST",
359
+ body: JSON.stringify({
360
+ ...options.message !== void 0 ? { message: options.message } : {},
361
+ ...options.files !== void 0 ? { files: options.files } : {}
362
+ })
363
+ });
364
+ }
365
+ async createTerminal(options = {}, request = {}) {
366
+ await this.transport.ensureRunning();
367
+ const params = new URLSearchParams();
368
+ if (request.sessionId) params.set("sessionId", request.sessionId);
369
+ const query = params.toString();
370
+ return (await this.json(`/terminals${query ? `?${query}` : ""}`, {
371
+ method: "POST",
372
+ body: JSON.stringify(options)
373
+ })).data;
374
+ }
375
+ async writeTerminal(terminalId, data, request = {}) {
376
+ await this.transport.ensureRunning();
377
+ const params = new URLSearchParams();
378
+ if (request.sessionId) params.set("sessionId", request.sessionId);
379
+ const query = params.toString();
380
+ await this.request(`/terminals/${encodeURIComponent(terminalId)}/input${query ? `?${query}` : ""}`, {
381
+ method: "POST",
382
+ body: JSON.stringify({ data })
383
+ });
384
+ }
385
+ async listTerminals() {
386
+ await this.transport.ensureRunning();
387
+ return (await this.json("/terminals", { method: "GET" })).data ?? [];
388
+ }
389
+ async getTerminal(terminalId) {
390
+ await this.transport.ensureRunning();
391
+ const response = await this.transport.fetch(`/terminals/${encodeURIComponent(terminalId)}`, { method: "GET" });
392
+ if (response.status === 404) return null;
393
+ await this.assertOk(response);
394
+ return (await response.json()).data;
395
+ }
396
+ async json(path, init) {
397
+ return await (await this.request(path, init)).json();
398
+ }
399
+ async request(path, init) {
400
+ const response = await this.transport.fetch(path, init);
401
+ await this.assertOk(response);
402
+ return response;
403
+ }
404
+ async assertOk(response) {
405
+ if (response.ok) return;
406
+ const body = await response.text();
407
+ throw parseErrorResponse(response.status, body, void 0, response.headers);
408
+ }
409
+ };
410
+ function normalizeSessionInfo(raw) {
411
+ const id = raw.id;
412
+ if (typeof id !== "string") return null;
413
+ const status = raw.status || "running";
414
+ return {
415
+ id,
416
+ parentId: typeof raw.parentID === "string" ? raw.parentID : typeof raw.parentId === "string" ? raw.parentId : void 0,
417
+ status: [
418
+ "queued",
419
+ "running",
420
+ "completed",
421
+ "failed",
422
+ "cancelled"
423
+ ].includes(status) ? status : "running",
424
+ backend: typeof raw.backendType === "string" ? raw.backendType : typeof raw.backend === "string" ? raw.backend : void 0,
425
+ model: typeof raw.model === "string" ? raw.model : void 0,
426
+ promptCount: typeof raw.promptCount === "number" ? raw.promptCount : void 0,
427
+ createdAt: raw.createdAt ? new Date(raw.createdAt) : void 0,
428
+ startedAt: raw.startedAt ? new Date(raw.startedAt) : void 0,
429
+ endedAt: raw.endedAt ? new Date(raw.endedAt) : void 0,
430
+ raw
431
+ };
432
+ }
433
+ //#endregion
434
+ export { serializeForSidecar as i, normalizeSessionInfo as n, normalizeRuntimeBackendConfig as r, SandboxRuntimeApi as t };