@tangle-network/sandbox 0.19.4 → 0.19.5

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.
@@ -1,6 +1,6 @@
1
- import { C as CodeResultPart, S as CodeLanguage, b as CodeExecutionOptions, x as CodeExecutionResult } from "../types-BoFtM2qv.js";
2
- import { n as SandboxInstance } from "../sandbox-DT-VEfRp.js";
3
- import { i as Sandbox } from "../client-XDKeWJx6.js";
1
+ import { C as CodeResultPart, S as CodeLanguage, b as CodeExecutionOptions, x as CodeExecutionResult } from "../types-C7mxmAil.js";
2
+ import { n as SandboxInstance } from "../sandbox-BEsoO8Ux.js";
3
+ import { i as Sandbox } from "../client-BCwkh2kj.js";
4
4
  import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
5
5
 
6
6
  //#region src/agent/tools/_specs.d.ts
@@ -1,5 +1,5 @@
1
- import { $n as SandboxFleetCostEstimate, $t as ListSandboxFleetOptions, A as CreateSandboxFleetTokenOptions, An as PublishPublicTemplateVersionOptions, Cr as SandboxFleetWorkspaceSnapshotResult, Ct as FleetExecDispatchResult, D as CreateIntelligenceReportOptions, Dn as PublicTemplateInfo, Et as FleetPromptDispatchResult, Gt as IntelligenceReport, Kt as IntelligenceReportBudget, M as CreateSandboxOptions, Mn as ReapExpiredSandboxFleetsResult, Nn as ReconcileSandboxFleetsOptions, O as CreateRequestOptions, Oi as TokenRefreshHandler, On as PublicTemplateVersionInfo, Pi as UsageInfo, Pn as ReconcileSandboxFleetsResult, Qn as SandboxFleetArtifactSpec, Sn as PromptResult, Sr as SandboxFleetWorkspaceRestoreResult, St as FleetExecDispatchOptions, Tr as SandboxInfo, Tt as FleetPromptDispatchOptions, Xi as BatchEvent, Yn as SandboxEnvironment, Yr as SecretsManager, Yt as IntelligenceReportWindow, Zn as SandboxFleetArtifact, _i as SubscriptionInfo, _t as FleetDispatchResultBuffer, a as AttachSandboxFleetMachineOptions, bn as PromptInputPart, bt as FleetDriveTurnOutcome, cr as SandboxFleetMachineRecord, en as ListSandboxOptions, f as BatchResult, fr as SandboxFleetOperationsSummary, gt as FleetDispatchCancelResult, hr as SandboxFleetTraceBundle, ir as SandboxFleetInfo, j as CreateSandboxFleetWithCoordinatorOptions, jn as ReapExpiredSandboxFleetsOptions, k as CreateSandboxFleetOptions, kn as PublishPublicTemplateOptions, m as BatchRunRequest, mr as SandboxFleetToken, nr as SandboxFleetDriverCapability, nt as ExecResult, p as BatchRunOptions, pi as SshKeysManager, qn as SandboxConfig, qt as IntelligenceReportCompareTo, tr as SandboxFleetDispatchResponse, tt as ExecOptions, ur as SandboxFleetManifest, vr as SandboxFleetTraceOptions, vt as FleetDispatchResultBufferOptions, wr as SandboxIdentity, wt as FleetMachineId, xn as PromptOptions, xr as SandboxFleetWorkspaceReconcileResult, xt as FleetDriveTurnRequest, yr as SandboxFleetUsage, yt as FleetDispatchStreamOptions } from "./types-BoFtM2qv.js";
2
- import { c as TraceExportResult, l as TraceExportSink, n as SandboxInstance, t as HttpClient } from "./sandbox-DT-VEfRp.js";
1
+ import { $n as SandboxFleetCostEstimate, $t as ListSandboxFleetOptions, A as CreateSandboxFleetTokenOptions, An as PublishPublicTemplateVersionOptions, Cr as SandboxFleetWorkspaceSnapshotResult, Ct as FleetExecDispatchResult, D as CreateIntelligenceReportOptions, Dn as PublicTemplateInfo, Et as FleetPromptDispatchResult, Gt as IntelligenceReport, Kt as IntelligenceReportBudget, M as CreateSandboxOptions, Mn as ReapExpiredSandboxFleetsResult, Nn as ReconcileSandboxFleetsOptions, O as CreateRequestOptions, Oi as TokenRefreshHandler, On as PublicTemplateVersionInfo, Pi as UsageInfo, Pn as ReconcileSandboxFleetsResult, Qn as SandboxFleetArtifactSpec, Sn as PromptResult, Sr as SandboxFleetWorkspaceRestoreResult, St as FleetExecDispatchOptions, Tr as SandboxInfo, Tt as FleetPromptDispatchOptions, Xi as BatchEvent, Yn as SandboxEnvironment, Yr as SecretsManager, Yt as IntelligenceReportWindow, Zn as SandboxFleetArtifact, _i as SubscriptionInfo, _t as FleetDispatchResultBuffer, a as AttachSandboxFleetMachineOptions, bn as PromptInputPart, bt as FleetDriveTurnOutcome, cr as SandboxFleetMachineRecord, en as ListSandboxOptions, f as BatchResult, fr as SandboxFleetOperationsSummary, gt as FleetDispatchCancelResult, hr as SandboxFleetTraceBundle, ir as SandboxFleetInfo, j as CreateSandboxFleetWithCoordinatorOptions, jn as ReapExpiredSandboxFleetsOptions, k as CreateSandboxFleetOptions, kn as PublishPublicTemplateOptions, m as BatchRunRequest, mr as SandboxFleetToken, nr as SandboxFleetDriverCapability, nt as ExecResult, p as BatchRunOptions, pi as SshKeysManager, qn as SandboxConfig, qt as IntelligenceReportCompareTo, tr as SandboxFleetDispatchResponse, tt as ExecOptions, ur as SandboxFleetManifest, vr as SandboxFleetTraceOptions, vt as FleetDispatchResultBufferOptions, wr as SandboxIdentity, wt as FleetMachineId, xn as PromptOptions, xr as SandboxFleetWorkspaceReconcileResult, xt as FleetDriveTurnRequest, yr as SandboxFleetUsage, yt as FleetDispatchStreamOptions } from "./types-C7mxmAil.js";
2
+ import { c as TraceExportResult, l as TraceExportSink, n as SandboxInstance, t as HttpClient } from "./sandbox-BEsoO8Ux.js";
3
3
 
4
4
  //#region src/lib/sse-parser.d.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { c as combineAbortSignals, d as applyRequestedModel, f as assertCurrentBackendType, l as encodePromptForWire, m as backendTypeSchema, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, u as encodeTextForWire } from "./runtime-api-BQii48NT.js";
2
2
  import { a as NetworkError, f as TimeoutError, l as SandboxError, m as parseErrorResponse, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-Bf-A-4SA.js";
3
- import { g as normalizeConnection, n as createSandboxInstanceFromResponse, r as normalizeStartupDiagnostics, v as exportTraceBundle, x as parseSSEStream } from "./sandbox-Clsvx8OO.js";
3
+ import { g as normalizeConnection, n as createSandboxInstanceFromResponse, r as normalizeStartupDiagnostics, v as exportTraceBundle, x as parseSSEStream } from "./sandbox-DVwPvdG_.js";
4
4
  import { agentProfileSchema } from "@tangle-network/agent-interface";
5
5
  import { z } from "zod";
6
6
  //#region ../../../packages/runtime-contracts/dist/git-policy.js
@@ -1885,8 +1885,9 @@ const PROFILE_FILE_MOUNT_MAX_RETRIES = 4;
1885
1885
  const PROFILE_FILE_MOUNT_RETRY_BASE_MS = 250;
1886
1886
  const PROFILE_FILE_MOUNT_RETRY_MAX_MS = 2e3;
1887
1887
  const PROFILE_FILE_MOUNT_EXEC_TIMEOUT_MS = 3e4;
1888
- const PROFILE_FILE_MOUNT_PACE_MS = 150;
1888
+ const PROFILE_FILE_MOUNT_PACE_MS = 0;
1889
1889
  const PROFILE_BIN_DIR_RE = /(^|\/)(s?bin)\//;
1890
+ const PROFILE_AGENT_HOME = ["/home", "agent"].join("/");
1890
1891
  /**
1891
1892
  * Wire budget for a single-shot `POST /files/write` of a mount.
1892
1893
  * Materialization runs over whatever connection the box has — on the
@@ -1906,7 +1907,7 @@ function fitsSingleShotWrite(content, contentBytes) {
1906
1907
  return new TextEncoder().encode(JSON.stringify(content)).byteLength <= PROFILE_FILE_WRITE_WIRE_BUDGET_BYTES;
1907
1908
  }
1908
1909
  const DEFAULT_PROFILE_FILE_API_ABSOLUTE_PREFIXES = [
1909
- ["/home", "agent"].join("/"),
1910
+ PROFILE_AGENT_HOME,
1910
1911
  ["/home", "user"].join("/"),
1911
1912
  "/tmp",
1912
1913
  "/output"
@@ -2021,7 +2022,10 @@ function isAllowedAbsoluteFileApiPath(path, prefixes) {
2021
2022
  return false;
2022
2023
  }
2023
2024
  function fileApiTarget(mount, absolutePrefixes) {
2024
- if (mount.path.startsWith("~/")) return null;
2025
+ if (mount.path.startsWith("~/")) {
2026
+ const homePath = `${PROFILE_AGENT_HOME}/${mount.path.slice(2)}`;
2027
+ return isAllowedAbsoluteFileApiPath(homePath, absolutePrefixes) ? homePath : null;
2028
+ }
2025
2029
  if (mount.path.startsWith("/")) return isAllowedAbsoluteFileApiPath(mount.path, absolutePrefixes) ? mount.path : null;
2026
2030
  if (mount.path.startsWith("~")) return null;
2027
2031
  if (mount.path.length === 0) return null;
@@ -2036,6 +2040,9 @@ function profileFileMode(mount) {
2036
2040
  function fileApiSupportsMode(box) {
2037
2041
  return box.fs?.supportsWriteMode === true;
2038
2042
  }
2043
+ function isFileApiRootOnlyError(error) {
2044
+ return error instanceof SandboxError && error.status === 403 && error.message.includes("Absolute path is outside allowed roots");
2045
+ }
2039
2046
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2040
2047
  var ProfileFileMountExecTimeoutError = class extends Error {
2041
2048
  constructor(timeoutMs) {
@@ -2176,6 +2183,7 @@ async function materializeProfileFileMounts(box, files, options = {}) {
2176
2183
  const modeAwareFileApi = fileApiSupportsMode(box);
2177
2184
  const uploadDataFn = fs?.uploadData;
2178
2185
  const viaFileApi = [];
2186
+ const viaHomeFileApi = [];
2179
2187
  const viaExec = [];
2180
2188
  const viaUpload = [];
2181
2189
  for (const mount of files) {
@@ -2195,11 +2203,16 @@ async function materializeProfileFileMounts(box, files, options = {}) {
2195
2203
  });
2196
2204
  continue;
2197
2205
  }
2198
- viaFileApi.push({
2206
+ const write = {
2199
2207
  path: target,
2200
2208
  content,
2201
2209
  ...mode !== void 0 ? { mode } : {}
2210
+ };
2211
+ if (mount.path.startsWith("~/")) viaHomeFileApi.push({
2212
+ mount,
2213
+ ...write
2202
2214
  });
2215
+ else viaFileApi.push(write);
2203
2216
  } else viaExec.push({
2204
2217
  mount,
2205
2218
  content
@@ -2213,6 +2226,24 @@ async function materializeProfileFileMounts(box, files, options = {}) {
2213
2226
  } catch (err) {
2214
2227
  throw new Error("materializeProfileFileMounts: file API batch write failed", { cause: err });
2215
2228
  }
2229
+ let homeFilesWrittenByApi = 0;
2230
+ if (viaHomeFileApi.length > 0) try {
2231
+ await fs?.writeMany(viaHomeFileApi.map(({ path, content, mode }) => ({
2232
+ path,
2233
+ content,
2234
+ ...mode !== void 0 ? { mode } : {}
2235
+ })), {
2236
+ paceMs,
2237
+ maxRetries
2238
+ });
2239
+ homeFilesWrittenByApi = viaHomeFileApi.length;
2240
+ } catch (err) {
2241
+ if (!isFileApiRootOnlyError(err)) throw new Error("materializeProfileFileMounts: home file API batch write failed", { cause: err });
2242
+ viaExec.push(...viaHomeFileApi.map(({ mount, content }) => ({
2243
+ mount,
2244
+ content
2245
+ })));
2246
+ }
2216
2247
  if (viaUpload.length > 0) {
2217
2248
  if (typeof uploadDataFn !== "function") throw new Error("materializeProfileFileMounts: viaUpload entries exist but fs.uploadData is unavailable");
2218
2249
  for (const item of viaUpload) try {
@@ -2232,8 +2263,8 @@ async function materializeProfileFileMounts(box, files, options = {}) {
2232
2263
  maxRetries
2233
2264
  }, execState);
2234
2265
  return {
2235
- written: viaFileApi.length + viaExec.length + viaUpload.length,
2236
- viaFileApi: viaFileApi.length,
2266
+ written: viaFileApi.length + homeFilesWrittenByApi + viaExec.length + viaUpload.length,
2267
+ viaFileApi: viaFileApi.length + homeFilesWrittenByApi,
2237
2268
  viaExec: viaExec.length,
2238
2269
  viaUpload: viaUpload.length
2239
2270
  };
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as CreateSandboxOptions, Mr as SandboxStatus, Tr as SandboxInfo, bn as PromptInputPart, dn as PreviewLinkWaitOptions, in as NetworkConfig, ln as PreviewLinkInfo, nt as ExecResult, qn as SandboxConfig, tt as ExecOptions, un as PreviewLinkManager } from "./types-BoFtM2qv.js";
2
- import { a as WorkspaceImagePublishResult, i as WorkspaceImagePublishRequestOptions, n as SandboxInstance, o as WorkspaceImages, r as WorkspaceImagePublishInput } from "./sandbox-DT-VEfRp.js";
3
- import { i as Sandbox } from "./client-XDKeWJx6.js";
1
+ import { M as CreateSandboxOptions, Mr as SandboxStatus, Tr as SandboxInfo, bn as PromptInputPart, dn as PreviewLinkWaitOptions, in as NetworkConfig, ln as PreviewLinkInfo, nt as ExecResult, qn as SandboxConfig, tt as ExecOptions, un as PreviewLinkManager } from "./types-C7mxmAil.js";
2
+ import { a as WorkspaceImagePublishResult, i as WorkspaceImagePublishRequestOptions, n as SandboxInstance, o as WorkspaceImages, r as WorkspaceImagePublishInput } from "./sandbox-BEsoO8Ux.js";
3
+ import { i as Sandbox } from "./client-BCwkh2kj.js";
4
4
  import { a as NetworkError, c as QuotaError, d as SandboxFailureDetail, f as ServerError, h as ValidationError, i as FileWriteConflictError, l as SandboxError, m as TimeoutError, n as CapabilityError, o as NotFoundError, p as StateError, s as PartialFailureError, t as AuthError, u as SandboxErrorJson } from "./errors-Bdy5jXzc.js";
5
5
  export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, FileWriteConflictError, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, type PreviewLinkWaitOptions, type PromptInputPart, QuotaError, Sandbox, type SandboxConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError, type WorkspaceImagePublishInput, type WorkspaceImagePublishRequestOptions, type WorkspaceImagePublishResult, WorkspaceImages };
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-Bf-A-4SA.js";
2
- import { n as Sandbox } from "./client-aY82P7Ho.js";
3
- import { i as WorkspaceImages, t as SandboxInstance } from "./sandbox-Clsvx8OO.js";
2
+ import { n as Sandbox } from "./client-CPSJHnNS.js";
3
+ import { i as WorkspaceImages, t as SandboxInstance } from "./sandbox-DVwPvdG_.js";
4
4
  export { AuthError, CapabilityError, FileWriteConflictError, NetworkError, NotFoundError, PartialFailureError, QuotaError, Sandbox, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages };
@@ -1,5 +1,5 @@
1
- import { M as CreateSandboxOptions } from "./types-BoFtM2qv.js";
2
- import { n as SandboxInstance, t as HttpClient } from "./sandbox-DT-VEfRp.js";
1
+ import { M as CreateSandboxOptions } from "./types-C7mxmAil.js";
2
+ import { n as SandboxInstance, t as HttpClient } from "./sandbox-BEsoO8Ux.js";
3
3
 
4
4
  //#region src/tangle/abi.d.ts
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { $ as EventStreamOptions, $i as BatchTaskUsage, $n as SandboxFleetCostEstimate, $r as SessionBackendCredentials, $t as ListSandboxFleetOptions, Ai as TurnDriveResult, An as PublishPublicTemplateVersionOptions, Ar as SandboxResources, At as GitCommit, B as DownloadOptions, Bi as TERMINAL_WS_ECHO_SUBPROTOCOL, Bn as RolloutOptions, Br as SandboxTraceEvent, Bt as GpuLeaseProviderName, Ci as TeeAttestationOptions, Cn as ProvisionEvent, Cr as SandboxFleetWorkspaceSnapshotResult, D as CreateIntelligenceReportOptions, Di as TeePublicKeyResponse, Dn as PublicTemplateInfo, Dr as SandboxPortBinding, Dt as GPU_LEASE_PROVIDER_NAMES, E as CreateGpuLeaseOptions, Ei as TeePublicKey, En as ProvisionStep, Er as SandboxIntelligenceEnvelope, F as DeleteOptions, Fi as WaitForOptions, Fn as RenameOptions, Fr as SandboxTerminalInfo, Ft as GpuLeaseBilling, G as DriverType, Gi as TerminalStreamError, Gn as SSHCommandDescriptor, Gr as ScopedTokenScope, Gt as IntelligenceReport, H as DriveTurnOptions, Hi as TerminalReadyInfo, Hn as RolloutStartResult, Hr as SandboxTraceOptions, Ht as HostAgentDriverConfig, I as DevServerInfo, Ii as WaitForRolloutOptions, Ir as SandboxTerminalManager, It as GpuLeaseCommandResult, J as EffectiveBackendProfile, Ji as TerminalStreamToken, Jn as SandboxConnection, Jr as SecretInfo, Jt as IntelligenceReportSubjectType, Ki as TerminalStreamHandlers, Kn as SSHCredentials, Kr as SearchMatch, Kt as IntelligenceReportBudget, L as DirectoryPermission, Li as WriteFileOptions, Lr as SandboxTerminalRequestOptions, Lt as GpuLeaseExecOptions, M as CreateSandboxOptions, Mi as UploadOptions, Mn as ReapExpiredSandboxFleetsResult, Mr as SandboxStatus, Mt as GitDiff, N as CreateSessionOptions, Ni as UploadProgress, Nn as ReconcileSandboxFleetsOptions, Nr as SandboxTerminalAttachOptions, Nt as GitStatus, O as CreateRequestOptions, Oi as TokenRefreshHandler, On as PublicTemplateVersionInfo, Or as SandboxPortPreviewLink, Ot as GitAuth, P as CreateTaskSessionOptions, Pi as UsageInfo, Pn as ReconcileSandboxFleetsResult, Pr as SandboxTerminalCreateOptions, Pt as GpuLease, Q as EnsureDevServerOptions, Qi as BatchSidecarGroup, Qn as SandboxFleetArtifactSpec, Qr as SentSessionMessage, Qt as ListOptions, R as DispatchPromptOptions, Ri as WriteManyFile, Rn as Rollout, Rr as SandboxTerminals, Rt as GpuLeaseExecResult, Si as TaskSessionProfile, Sn as PromptResult, Sr as SandboxFleetWorkspaceRestoreResult, St as FleetExecDispatchOptions, T as CompletedTurnResult, Ti as TeeAttestationResponse, Tn as ProvisionStatus, Tr as SandboxInfo, Tt as FleetPromptDispatchOptions, U as DriverConfig, Ui as TerminalStream, Un as RolloutStatus, Ur as SandboxUser, Ut as HostAgentRuntimeBackend, V as DownloadProgress, Vi as TerminalExitInfo, Vn as RolloutScorer, Vr as SandboxTraceExport, Vt as GpuLeaseStatus, W as DriverInfo, Wi as TerminalStreamAuthFormat, Wn as RolloutTurnPart, Wr as ScopedToken, Wt as InstalledTool, X as EgressManager, Xi as BatchEvent, Xn as SandboxEvent, Xr as SendSessionMessageOptions, Y as EffectiveBackendSource, Yi as BatchBackendStats, Yn as SandboxEnvironment, Yr as SecretsManager, Yt as IntelligenceReportWindow, Z as EgressPolicy, Zi as BatchEventDataMap, Zn as SandboxFleetArtifact, Zr as SendSessionMessageRequest, Zt as ListMessagesOptions, _ as BranchOptions, _i as SubscriptionInfo, _n as ProcessSignal, _r as SandboxFleetTraceExport, _t as FleetDispatchResultBuffer, a as AttachSandboxFleetMachineOptions, ai as SessionListOptions, an as NetworkManager, ar as SandboxFleetIntelligenceEnvelope, at as FileReadBatchResult, bi as TaskSessionFileChange, bn as PromptInputPart, br as SandboxFleetWorkspace, bt as FleetDriveTurnOutcome, c as BackendInfo, ci as SessionResultOptions, cn as PermissionsManager, cr as SandboxFleetMachineRecord, ct as FileRenameResult, d as BatchBackend, di as SnapshotOptions, dn as PreviewLinkWaitOptions, dr as SandboxFleetManifestMachine, dt as FileTreeOptions, ea as PublicBatchRunRequest, ei as SessionEventStreamOptions, en as ListSandboxOptions, er as SandboxFleetDispatchFailureClass, et as ExactProcessSpawnOptions, f as BatchResult, fi as SnapshotResult, fn as Process, fr as SandboxFleetOperationsSummary, ft as FileTreeResult, g as BatchTaskResult, gi as StorageConfig, gn as ProcessManager, gr as SandboxFleetTraceEvent, gt as FleetDispatchCancelResult, h as BatchTask, hi as StartupOperation, hn as ProcessLogEntry, hr as SandboxFleetTraceBundle, ht as FileWriteResult, i as AttachGpuLeaseOptions, ii as SessionInterruptOptions, in as NetworkConfig, ir as SandboxFleetInfo, it as FileReadBatchOptions, j as CreateSandboxFleetWithCoordinatorOptions, ji as UpdateUserOptions, jn as ReapExpiredSandboxFleetsOptions, jr as SandboxRuntimeHealth, jt as GitConfig, k as CreateSandboxFleetOptions, ki as TokenUsage, kn as PublishPublicTemplateOptions, kr as SandboxResourceUsage, kt as GitBranch, l as BackendManager, li as SessionStatus, ln as PreviewLinkInfo, lr as SandboxFleetMachineSpec, lt as FileSystem, m as BatchRunRequest, mi as StartupDiagnostics, mn as ProcessListOptions, mr as SandboxFleetToken, mt as FileUsageResult, n as AccessPolicyRule, na as parseBackendType, ni as SessionForkOptions, nn as MintScopedTokenOptions, nr as SandboxFleetDriverCapability, nt as ExecResult, o as BackendCapabilities, oi as SessionMessage, on as NonHostAgentDriverConfig, or as SandboxFleetMachine, ot as FileReadError, p as BatchRunOptions, pn as ProcessInfo, pr as SandboxFleetPolicy, pt as FileUsageOptions, q as EffectiveBackend, qi as TerminalStreamOptions, qn as SandboxConfig, qr as SearchOptions, qt as IntelligenceReportCompareTo, r as AddUserOptions, ri as SessionInfo, rn as MkdirOptions, rr as SandboxFleetDriverTimings, rt as FileInfo, s as BackendConfig, si as SessionMessageInputPart, sn as PermissionLevel, sr as SandboxFleetMachineMeteredUsage, st as FileReadResult, t as AcceleratorKind, ta as BackendType, ti as SessionFailureReason, tn as McpServerConfig, tr as SandboxFleetDispatchResponse, tt as ExecOptions, u as BackendStatus, ui as SnapshotInfo, un as PreviewLinkManager, ur as SandboxFleetManifest, ut as FileTreeFile, v as ChunkedUploadOptions, vi as TaskSessionChanges, vn as ProcessSpawnOptions, vr as SandboxFleetTraceOptions, vt as FleetDispatchResultBufferOptions, w as CommitTaskSessionOptions, wi as TeeAttestationReport, wn as ProvisionResult, wr as SandboxIdentity, wt as FleetMachineId, xi as TaskSessionInfo, xn as PromptOptions, xr as SandboxFleetWorkspaceReconcileResult, xt as FleetDriveTurnRequest, y as ChunkedUploadResult, yi as TaskSessionCommitResult, yn as ProcessStatus, yr as SandboxFleetUsage, yt as FleetDispatchStreamOptions, z as DispatchedSession, zi as WriteManyOptions, zn as RolloutChildResult, zr as SandboxTraceBundle, zt as GpuLeaseManager } from "./types-BoFtM2qv.js";
2
- import { A as SandboxMcpEndpoint, C as RespondToPermissionOptions, D as CONTROL_PLANE_MCP_SERVER_NAME, E as BuildSandboxMcpConfigOptions, M as buildControlPlaneMcpConfig, N as buildSandboxMcpConfig, O as SANDBOX_MCP_SERVER_NAME, S as InterruptResult, T as BuildControlPlaneMcpConfigOptions, _ as InteractiveAuthFile, a as WorkspaceImagePublishResult, b as InteractiveSessionInfo, c as TraceExportResult, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as InteractiveAttachOptions, h as SandboxSession, i as WorkspaceImagePublishRequestOptions, j as SandboxMcpServerEntry, k as SandboxMcpConfig, l as TraceExportSink, m as SandboxTaskSession, n as SandboxInstance, o as WorkspaceImages, p as toOtelJson, r as WorkspaceImagePublishInput, s as TraceExportFormat, u as buildTraceExportPayload, v as InteractiveSessionHandle, w as StartInteractiveOptions, x as InteractiveSessionStatus, y as InteractiveSessionHost } from "./sandbox-DT-VEfRp.js";
3
- import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as Sandbox, 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-XDKeWJx6.js";
1
+ import { $ as EventStreamOptions, $i as BatchTaskUsage, $n as SandboxFleetCostEstimate, $r as SessionBackendCredentials, $t as ListSandboxFleetOptions, Ai as TurnDriveResult, An as PublishPublicTemplateVersionOptions, Ar as SandboxResources, At as GitCommit, B as DownloadOptions, Bi as TERMINAL_WS_ECHO_SUBPROTOCOL, Bn as RolloutOptions, Br as SandboxTraceEvent, Bt as GpuLeaseProviderName, Ci as TeeAttestationOptions, Cn as ProvisionEvent, Cr as SandboxFleetWorkspaceSnapshotResult, D as CreateIntelligenceReportOptions, Di as TeePublicKeyResponse, Dn as PublicTemplateInfo, Dr as SandboxPortBinding, Dt as GPU_LEASE_PROVIDER_NAMES, E as CreateGpuLeaseOptions, Ei as TeePublicKey, En as ProvisionStep, Er as SandboxIntelligenceEnvelope, F as DeleteOptions, Fi as WaitForOptions, Fn as RenameOptions, Fr as SandboxTerminalInfo, Ft as GpuLeaseBilling, G as DriverType, Gi as TerminalStreamError, Gn as SSHCommandDescriptor, Gr as ScopedTokenScope, Gt as IntelligenceReport, H as DriveTurnOptions, Hi as TerminalReadyInfo, Hn as RolloutStartResult, Hr as SandboxTraceOptions, Ht as HostAgentDriverConfig, I as DevServerInfo, Ii as WaitForRolloutOptions, Ir as SandboxTerminalManager, It as GpuLeaseCommandResult, J as EffectiveBackendProfile, Ji as TerminalStreamToken, Jn as SandboxConnection, Jr as SecretInfo, Jt as IntelligenceReportSubjectType, Ki as TerminalStreamHandlers, Kn as SSHCredentials, Kr as SearchMatch, Kt as IntelligenceReportBudget, L as DirectoryPermission, Li as WriteFileOptions, Lr as SandboxTerminalRequestOptions, Lt as GpuLeaseExecOptions, M as CreateSandboxOptions, Mi as UploadOptions, Mn as ReapExpiredSandboxFleetsResult, Mr as SandboxStatus, Mt as GitDiff, N as CreateSessionOptions, Ni as UploadProgress, Nn as ReconcileSandboxFleetsOptions, Nr as SandboxTerminalAttachOptions, Nt as GitStatus, O as CreateRequestOptions, Oi as TokenRefreshHandler, On as PublicTemplateVersionInfo, Or as SandboxPortPreviewLink, Ot as GitAuth, P as CreateTaskSessionOptions, Pi as UsageInfo, Pn as ReconcileSandboxFleetsResult, Pr as SandboxTerminalCreateOptions, Pt as GpuLease, Q as EnsureDevServerOptions, Qi as BatchSidecarGroup, Qn as SandboxFleetArtifactSpec, Qr as SentSessionMessage, Qt as ListOptions, R as DispatchPromptOptions, Ri as WriteManyFile, Rn as Rollout, Rr as SandboxTerminals, Rt as GpuLeaseExecResult, Si as TaskSessionProfile, Sn as PromptResult, Sr as SandboxFleetWorkspaceRestoreResult, St as FleetExecDispatchOptions, T as CompletedTurnResult, Ti as TeeAttestationResponse, Tn as ProvisionStatus, Tr as SandboxInfo, Tt as FleetPromptDispatchOptions, U as DriverConfig, Ui as TerminalStream, Un as RolloutStatus, Ur as SandboxUser, Ut as HostAgentRuntimeBackend, V as DownloadProgress, Vi as TerminalExitInfo, Vn as RolloutScorer, Vr as SandboxTraceExport, Vt as GpuLeaseStatus, W as DriverInfo, Wi as TerminalStreamAuthFormat, Wn as RolloutTurnPart, Wr as ScopedToken, Wt as InstalledTool, X as EgressManager, Xi as BatchEvent, Xn as SandboxEvent, Xr as SendSessionMessageOptions, Y as EffectiveBackendSource, Yi as BatchBackendStats, Yn as SandboxEnvironment, Yr as SecretsManager, Yt as IntelligenceReportWindow, Z as EgressPolicy, Zi as BatchEventDataMap, Zn as SandboxFleetArtifact, Zr as SendSessionMessageRequest, Zt as ListMessagesOptions, _ as BranchOptions, _i as SubscriptionInfo, _n as ProcessSignal, _r as SandboxFleetTraceExport, _t as FleetDispatchResultBuffer, a as AttachSandboxFleetMachineOptions, ai as SessionListOptions, an as NetworkManager, ar as SandboxFleetIntelligenceEnvelope, at as FileReadBatchResult, bi as TaskSessionFileChange, bn as PromptInputPart, br as SandboxFleetWorkspace, bt as FleetDriveTurnOutcome, c as BackendInfo, ci as SessionResultOptions, cn as PermissionsManager, cr as SandboxFleetMachineRecord, ct as FileRenameResult, d as BatchBackend, di as SnapshotOptions, dn as PreviewLinkWaitOptions, dr as SandboxFleetManifestMachine, dt as FileTreeOptions, ea as PublicBatchRunRequest, ei as SessionEventStreamOptions, en as ListSandboxOptions, er as SandboxFleetDispatchFailureClass, et as ExactProcessSpawnOptions, f as BatchResult, fi as SnapshotResult, fn as Process, fr as SandboxFleetOperationsSummary, ft as FileTreeResult, g as BatchTaskResult, gi as StorageConfig, gn as ProcessManager, gr as SandboxFleetTraceEvent, gt as FleetDispatchCancelResult, h as BatchTask, hi as StartupOperation, hn as ProcessLogEntry, hr as SandboxFleetTraceBundle, ht as FileWriteResult, i as AttachGpuLeaseOptions, ii as SessionInterruptOptions, in as NetworkConfig, ir as SandboxFleetInfo, it as FileReadBatchOptions, j as CreateSandboxFleetWithCoordinatorOptions, ji as UpdateUserOptions, jn as ReapExpiredSandboxFleetsOptions, jr as SandboxRuntimeHealth, jt as GitConfig, k as CreateSandboxFleetOptions, ki as TokenUsage, kn as PublishPublicTemplateOptions, kr as SandboxResourceUsage, kt as GitBranch, l as BackendManager, li as SessionStatus, ln as PreviewLinkInfo, lr as SandboxFleetMachineSpec, lt as FileSystem, m as BatchRunRequest, mi as StartupDiagnostics, mn as ProcessListOptions, mr as SandboxFleetToken, mt as FileUsageResult, n as AccessPolicyRule, na as parseBackendType, ni as SessionForkOptions, nn as MintScopedTokenOptions, nr as SandboxFleetDriverCapability, nt as ExecResult, o as BackendCapabilities, oi as SessionMessage, on as NonHostAgentDriverConfig, or as SandboxFleetMachine, ot as FileReadError, p as BatchRunOptions, pn as ProcessInfo, pr as SandboxFleetPolicy, pt as FileUsageOptions, q as EffectiveBackend, qi as TerminalStreamOptions, qn as SandboxConfig, qr as SearchOptions, qt as IntelligenceReportCompareTo, r as AddUserOptions, ri as SessionInfo, rn as MkdirOptions, rr as SandboxFleetDriverTimings, rt as FileInfo, s as BackendConfig, si as SessionMessageInputPart, sn as PermissionLevel, sr as SandboxFleetMachineMeteredUsage, st as FileReadResult, t as AcceleratorKind, ta as BackendType, ti as SessionFailureReason, tn as McpServerConfig, tr as SandboxFleetDispatchResponse, tt as ExecOptions, u as BackendStatus, ui as SnapshotInfo, un as PreviewLinkManager, ur as SandboxFleetManifest, ut as FileTreeFile, v as ChunkedUploadOptions, vi as TaskSessionChanges, vn as ProcessSpawnOptions, vr as SandboxFleetTraceOptions, vt as FleetDispatchResultBufferOptions, w as CommitTaskSessionOptions, wi as TeeAttestationReport, wn as ProvisionResult, wr as SandboxIdentity, wt as FleetMachineId, xi as TaskSessionInfo, xn as PromptOptions, xr as SandboxFleetWorkspaceReconcileResult, xt as FleetDriveTurnRequest, y as ChunkedUploadResult, yi as TaskSessionCommitResult, yn as ProcessStatus, yr as SandboxFleetUsage, yt as FleetDispatchStreamOptions, z as DispatchedSession, zi as WriteManyOptions, zn as RolloutChildResult, zr as SandboxTraceBundle, zt as GpuLeaseManager } from "./types-C7mxmAil.js";
2
+ import { A as SandboxMcpEndpoint, C as RespondToPermissionOptions, D as CONTROL_PLANE_MCP_SERVER_NAME, E as BuildSandboxMcpConfigOptions, M as buildControlPlaneMcpConfig, N as buildSandboxMcpConfig, O as SANDBOX_MCP_SERVER_NAME, S as InterruptResult, T as BuildControlPlaneMcpConfigOptions, _ as InteractiveAuthFile, a as WorkspaceImagePublishResult, b as InteractiveSessionInfo, c as TraceExportResult, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as InteractiveAttachOptions, h as SandboxSession, i as WorkspaceImagePublishRequestOptions, j as SandboxMcpServerEntry, k as SandboxMcpConfig, l as TraceExportSink, m as SandboxTaskSession, n as SandboxInstance, o as WorkspaceImages, p as toOtelJson, r as WorkspaceImagePublishInput, s as TraceExportFormat, u as buildTraceExportPayload, v as InteractiveSessionHandle, w as StartInteractiveOptions, x as InteractiveSessionStatus, y as InteractiveSessionHost } from "./sandbox-BEsoO8Ux.js";
3
+ import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as Sandbox, 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-BCwkh2kj.js";
4
4
  import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-DtRFVx5U.js";
5
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-Cp1KYanB.js";
6
6
  import { a as NetworkError, c as QuotaError, d as SandboxFailureDetail, f as ServerError, h as ValidationError, i as FileWriteConflictError, l as SandboxError, m as TimeoutError, n as CapabilityError, o as NotFoundError, p as StateError, r as EgressProxyRecoveryError, s as PartialFailureError, t as AuthError, u as SandboxErrorJson } from "./errors-Bdy5jXzc.js";
7
- import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-CnsaBf_U.js";
7
+ import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-CpRq1GR5.js";
8
8
  import * as _$_tangle_network_agent_interface0 from "@tangle-network/agent-interface";
9
9
  import { AgentProfile, AgentProfile as AgentProfile$1, AgentProfileCapabilities, AgentProfileConfidential, AgentProfileConfigValue, AgentProfileConnection, AgentProfileFileMount, AgentProfileFileMount as AgentProfileFileMount$1, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResourceRef, AgentProfileResources, AgentProfileSecurityPolicy, AgentProfileValidationIssue, AgentProfileValidationResult, AgentSubagentProfile, Capability, SANDBOX_SIZE_PRESET_NAMES, SandboxSizePreset } from "@tangle-network/agent-interface";
10
10
  import { z } from "zod";
@@ -4051,7 +4051,8 @@ interface MaterializeProfileFileMountsOptions extends WriteManyOptions {
4051
4051
  execTimeoutMs?: number;
4052
4052
  /**
4053
4053
  * Absolute sandbox paths the file API may write directly. Relative paths are
4054
- * file API eligible when safe; `~/...` and other absolute paths use exec.
4054
+ * file API eligible when safe. `~/...` resolves through the fixed agent home
4055
+ * when that prefix is allowed. Other absolute paths use exec.
4055
4056
  */
4056
4057
  fileApiAbsolutePrefixes?: readonly string[];
4057
4058
  }
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { h as parseBackendType, m as backendTypeSchema, p as normalizeRuntimeBackendConfig } from "./runtime-api-BQii48NT.js";
2
2
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, r as EgressProxyRecoveryError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-Bf-A-4SA.js";
3
- import { a as splitInlineProfileSkills, c as SandboxFleetClient, i as splitInlineProfileFileMounts, l as createBatchResultAccumulator, n as Sandbox, o as validateDeferredProfileFileMounts, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as validateBatchRunRequest } from "./client-aY82P7Ho.js";
4
- import { _ as buildTraceExportPayload, a as TERMINAL_WS_ECHO_SUBPROTOCOL, b as toOtelJson, c as SandboxTaskSession, d as applySandboxEventText, f as collectAgentFinalMessageText, h as isToolBearingEvent, i as WorkspaceImages, l as SandboxSession, m as getSandboxEventText, o as TerminalStream, p as collectAgentResponseText, s as TerminalStreamError, t as SandboxInstance, u as InteractiveSessionHandle, v as exportTraceBundle, x as parseSSEStream, y as otelTraceIdForTangleTrace } from "./sandbox-Clsvx8OO.js";
3
+ import { a as splitInlineProfileSkills, c as SandboxFleetClient, i as splitInlineProfileFileMounts, l as createBatchResultAccumulator, n as Sandbox, o as validateDeferredProfileFileMounts, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as validateBatchRunRequest } from "./client-CPSJHnNS.js";
4
+ import { _ as buildTraceExportPayload, a as TERMINAL_WS_ECHO_SUBPROTOCOL, b as toOtelJson, c as SandboxTaskSession, d as applySandboxEventText, f as collectAgentFinalMessageText, h as isToolBearingEvent, i as WorkspaceImages, l as SandboxSession, m as getSandboxEventText, o as TerminalStream, p as collectAgentResponseText, s as TerminalStreamError, t as SandboxInstance, u as InteractiveSessionHandle, v as exportTraceBundle, x as parseSSEStream, y as otelTraceIdForTangleTrace } from "./sandbox-DVwPvdG_.js";
5
5
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CVdLf_4n.js";
6
- import { t as TangleSandboxClient } from "./tangle-hntZfGZ7.js";
6
+ import { t as TangleSandboxClient } from "./tangle-CNd36MoA.js";
7
7
  import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
8
8
  import { z } from "zod";
9
9
  //#region src/confidential.ts
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Dr as SandboxPortBinding, Fn as RenameOptions, Fr as SandboxTerminalInfo, Ir as SandboxTerminalManager, Li as WriteFileOptions, Lr as SandboxTerminalRequestOptions, N as CreateSessionOptions, Ni as UploadProgress, P as CreateTaskSessionOptions, Pr as SandboxTerminalCreateOptions, Qr as SentSessionMessage, Xr as SendSessionMessageOptions, Zr as SendSessionMessageRequest, Zt as ListMessagesOptions, at as FileReadBatchResult, ct as FileRenameResult, dt as FileTreeOptions, ft as FileTreeResult, ht as FileWriteResult, it as FileReadBatchOptions, jr as SandboxRuntimeHealth, mt as FileUsageResult, oi as SessionMessage, pt as FileUsageOptions, ri as SessionInfo, v as ChunkedUploadOptions, vi as TaskSessionChanges, w as CommitTaskSessionOptions, xi as TaskSessionInfo, y as ChunkedUploadResult, yi as TaskSessionCommitResult } from "./types-BoFtM2qv.js";
1
+ import { Dr as SandboxPortBinding, Fn as RenameOptions, Fr as SandboxTerminalInfo, Ir as SandboxTerminalManager, Li as WriteFileOptions, Lr as SandboxTerminalRequestOptions, N as CreateSessionOptions, Ni as UploadProgress, P as CreateTaskSessionOptions, Pr as SandboxTerminalCreateOptions, Qr as SentSessionMessage, Xr as SendSessionMessageOptions, Zr as SendSessionMessageRequest, Zt as ListMessagesOptions, at as FileReadBatchResult, ct as FileRenameResult, dt as FileTreeOptions, ft as FileTreeResult, ht as FileWriteResult, it as FileReadBatchOptions, jr as SandboxRuntimeHealth, mt as FileUsageResult, oi as SessionMessage, pt as FileUsageOptions, ri as SessionInfo, v as ChunkedUploadOptions, vi as TaskSessionChanges, w as CommitTaskSessionOptions, xi as TaskSessionInfo, y as ChunkedUploadResult, yi as TaskSessionCommitResult } from "./types-C7mxmAil.js";
2
2
  import { a as NetworkError, c as QuotaError, d as SandboxFailureDetail, f as ServerError, h as ValidationError, i as FileWriteConflictError, l as SandboxError, m as TimeoutError, n as CapabilityError, o as NotFoundError, p as StateError, s as PartialFailureError, t as AuthError, u as SandboxErrorJson } from "./errors-Bdy5jXzc.js";
3
3
 
4
4
  //#region src/lib/chunked-upload.d.ts
@@ -1,4 +1,4 @@
1
- import { $ as EventStreamOptions, Ai as TurnDriveResult, At as GitCommit, Bn as RolloutOptions, Ci as TeeAttestationOptions, Cn as ProvisionEvent, Di as TeePublicKeyResponse, Dr as SandboxPortBinding, Fi as WaitForOptions, Gn as SSHCommandDescriptor, Gt as IntelligenceReport, H as DriveTurnOptions, Hn as RolloutStartResult, Hr as SandboxTraceOptions, Ii as WaitForRolloutOptions, In as RestoreSnapshotOptions, Jn as SandboxConnection, K as DurablePlan, Ki as TerminalStreamHandlers, Kn as SSHCredentials, Kr as SearchMatch, Kt as IntelligenceReportBudget, Li as WriteFileOptions, Ln as ResumeOptions, Mr as SandboxStatus, Mt as GitDiff, N as CreateSessionOptions, Nr as SandboxTerminalAttachOptions, Nt as GitStatus, P as CreateTaskSessionOptions, Pt as GpuLease, Qr as SentSessionMessage, R as DispatchPromptOptions, Ri as WriteManyFile, Rn as Rollout, Rr as SandboxTerminals, S as CodeLanguage, Sn as PromptResult, T as CompletedTurnResult, Ti as TeeAttestationResponse, Tr as SandboxInfo, Ui as TerminalStream, W as DriverInfo, Wr as ScopedToken, Wt as InstalledTool, X as EgressManager, Xn as SandboxEvent, Xr as SendSessionMessageOptions, Xt as JsonValue, Yt as IntelligenceReportWindow, Zr as SendSessionMessageRequest, Zt as ListMessagesOptions, _ as BranchOptions, ai as SessionListOptions, an as NetworkManager, b as CodeExecutionOptions, bn as PromptInputPart, ci as SessionResultOptions, cn as PermissionsManager, di as SnapshotOptions, ei as SessionEventStreamOptions, fi as SnapshotResult, gn as ProcessManager, hr as SandboxFleetTraceBundle, ht as FileWriteResult, ii as SessionInterruptOptions, jr as SandboxRuntimeHealth, kr as SandboxResourceUsage, kt as GitBranch, l as BackendManager, lt as FileSystem, mi as StartupDiagnostics, ni as SessionForkOptions, nn as MintScopedTokenOptions, nt as ExecResult, oi as SessionMessage, qr as SearchOptions, qt as IntelligenceReportCompareTo, ri as SessionInfo, s as BackendConfig, ta as BackendType, tt as ExecOptions, ui as SnapshotInfo, un as PreviewLinkManager, vi as TaskSessionChanges, w as CommitTaskSessionOptions, wn as ProvisionResult, x as CodeExecutionResult, xi as TaskSessionInfo, xn as PromptOptions, yi as TaskSessionCommitResult, z as DispatchedSession, zi as WriteManyOptions, zr as SandboxTraceBundle, zt as GpuLeaseManager } from "./types-BoFtM2qv.js";
1
+ import { $ as EventStreamOptions, Ai as TurnDriveResult, At as GitCommit, Bn as RolloutOptions, Ci as TeeAttestationOptions, Cn as ProvisionEvent, Di as TeePublicKeyResponse, Dr as SandboxPortBinding, Fi as WaitForOptions, Gn as SSHCommandDescriptor, Gt as IntelligenceReport, H as DriveTurnOptions, Hn as RolloutStartResult, Hr as SandboxTraceOptions, Ii as WaitForRolloutOptions, In as RestoreSnapshotOptions, Jn as SandboxConnection, K as DurablePlan, Ki as TerminalStreamHandlers, Kn as SSHCredentials, Kr as SearchMatch, Kt as IntelligenceReportBudget, Li as WriteFileOptions, Ln as ResumeOptions, Mr as SandboxStatus, Mt as GitDiff, N as CreateSessionOptions, Nr as SandboxTerminalAttachOptions, Nt as GitStatus, P as CreateTaskSessionOptions, Pt as GpuLease, Qr as SentSessionMessage, R as DispatchPromptOptions, Ri as WriteManyFile, Rn as Rollout, Rr as SandboxTerminals, S as CodeLanguage, Sn as PromptResult, T as CompletedTurnResult, Ti as TeeAttestationResponse, Tr as SandboxInfo, Ui as TerminalStream, W as DriverInfo, Wr as ScopedToken, Wt as InstalledTool, X as EgressManager, Xn as SandboxEvent, Xr as SendSessionMessageOptions, Xt as JsonValue, Yt as IntelligenceReportWindow, Zr as SendSessionMessageRequest, Zt as ListMessagesOptions, _ as BranchOptions, ai as SessionListOptions, an as NetworkManager, b as CodeExecutionOptions, bn as PromptInputPart, ci as SessionResultOptions, cn as PermissionsManager, di as SnapshotOptions, ei as SessionEventStreamOptions, fi as SnapshotResult, gn as ProcessManager, hr as SandboxFleetTraceBundle, ht as FileWriteResult, ii as SessionInterruptOptions, jr as SandboxRuntimeHealth, kr as SandboxResourceUsage, kt as GitBranch, l as BackendManager, lt as FileSystem, mi as StartupDiagnostics, ni as SessionForkOptions, nn as MintScopedTokenOptions, nt as ExecResult, oi as SessionMessage, qr as SearchOptions, qt as IntelligenceReportCompareTo, ri as SessionInfo, s as BackendConfig, ta as BackendType, tt as ExecOptions, ui as SnapshotInfo, un as PreviewLinkManager, vi as TaskSessionChanges, w as CommitTaskSessionOptions, wn as ProvisionResult, x as CodeExecutionResult, xi as TaskSessionInfo, xn as PromptOptions, yi as TaskSessionCommitResult, z as DispatchedSession, zi as WriteManyOptions, zr as SandboxTraceBundle, zt as GpuLeaseManager } from "./types-C7mxmAil.js";
2
2
  import { AgentProfile } from "@tangle-network/agent-interface";
3
3
 
4
4
  //#region src/mcp.d.ts
@@ -837,13 +837,13 @@ declare class SandboxInstance {
837
837
  * ```
838
838
  */
839
839
  write(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
840
+ private writeFileRequest;
841
+ private assertWritePreconditions;
842
+ private writeBatchRequest;
843
+ private writeManySequential;
840
844
  /**
841
- * Write many files in one paced, retry-aware batch see
842
- * {@link FileSystem.writeMany}. Each file goes through {@link write}; a small
843
- * pace between writes keeps a large corpus under the file-write rate limit,
844
- * and transient failures (quota / server / network / timeout) retry with
845
- * exponential backoff (honoring a server `retryAfterMs`). Fail-loud on the
846
- * first file that cannot be written after its retries.
845
+ * Write many files through the runtime batch endpoint. Older runtimes that
846
+ * return 404 use the sequential write path with the same retry policy.
847
847
  */
848
848
  writeMany(files: WriteManyFile[], options?: WriteManyOptions): Promise<void>;
849
849
  /**
@@ -1,4 +1,4 @@
1
- import { a as uploadChunked, c as combineAbortSignals, d as applyRequestedModel, f as assertCurrentBackendType, i as sessionHeaders, l as encodePromptForWire, n as normalizeSessionInfo, p as normalizeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi } from "./runtime-api-BQii48NT.js";
1
+ import { a as uploadChunked, c as combineAbortSignals, d as applyRequestedModel, f as assertCurrentBackendType, i as sessionHeaders, l as encodePromptForWire, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi } from "./runtime-api-BQii48NT.js";
2
2
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, l as SandboxError, m as parseErrorResponse, n as CapabilityError, o as NotFoundError, p as ValidationError, t as AuthError, u as ServerError } from "./errors-Bf-A-4SA.js";
3
3
  import { readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
4
4
  //#region src/lib/sse-parser.ts
@@ -1653,10 +1653,50 @@ function toStreamErrorEvent(err) {
1653
1653
  }
1654
1654
  };
1655
1655
  }
1656
- const WRITE_MANY_DEFAULT_PACE_MS = 150;
1656
+ const WRITE_MANY_DEFAULT_PACE_MS = 0;
1657
1657
  const WRITE_MANY_DEFAULT_MAX_RETRIES = 4;
1658
1658
  const WRITE_MANY_RETRY_BASE_MS = 250;
1659
1659
  const WRITE_MANY_RETRY_MAX_MS = 2e3;
1660
+ const WRITE_MANY_BATCH_MAX_FILES = 100;
1661
+ const WRITE_MANY_BATCH_WIRE_BUDGET_BYTES = SANDBOX_PROXY_REQUEST_MAX_BYTES - 8 * 1024;
1662
+ function toWriteManyWireFile(file) {
1663
+ return {
1664
+ path: file.path,
1665
+ content: file.content,
1666
+ ...file.mode !== void 0 ? { mode: file.mode } : {},
1667
+ ...file.encoding !== void 0 ? { encoding: file.encoding } : {},
1668
+ ...file.ifHash !== void 0 ? { expectedHash: file.ifHash } : {},
1669
+ ...file.ifAbsent !== void 0 ? { ifAbsent: file.ifAbsent } : {}
1670
+ };
1671
+ }
1672
+ function serializeWriteManyBatch(files) {
1673
+ return JSON.stringify({ files });
1674
+ }
1675
+ function splitWriteManyBatches(files) {
1676
+ const batches = [];
1677
+ let current = [];
1678
+ for (const file of files) {
1679
+ const candidate = [...current, file];
1680
+ const candidateBody = serializeWriteManyBatch(candidate);
1681
+ const exceedsCount = candidate.length > WRITE_MANY_BATCH_MAX_FILES;
1682
+ const exceedsWireBudget = new TextEncoder().encode(candidateBody).byteLength > WRITE_MANY_BATCH_WIRE_BUDGET_BYTES;
1683
+ if (current.length > 0 && (exceedsCount || exceedsWireBudget)) {
1684
+ batches.push({
1685
+ files: current,
1686
+ body: serializeWriteManyBatch(current)
1687
+ });
1688
+ current = [file];
1689
+ } else current = candidate;
1690
+ }
1691
+ if (current.length > 0) batches.push({
1692
+ files: current,
1693
+ body: serializeWriteManyBatch(current)
1694
+ });
1695
+ return batches;
1696
+ }
1697
+ function hasDuplicateWriteManyPaths(files) {
1698
+ return new Set(files.map((file) => file.path)).size !== files.length;
1699
+ }
1660
1700
  function parseTextFileReadResponse(body) {
1661
1701
  let payload;
1662
1702
  try {
@@ -2210,9 +2250,12 @@ var SandboxInstance = class SandboxInstance {
2210
2250
  * ```
2211
2251
  */
2212
2252
  async write(path, content, options) {
2253
+ await this.ensureRunning();
2254
+ return this.writeFileRequest(path, content, options);
2255
+ }
2256
+ async writeFileRequest(path, content, options) {
2213
2257
  const params = new URLSearchParams();
2214
2258
  appendSessionIdQuery(params, options?.sessionId);
2215
- await this.ensureRunning();
2216
2259
  const query = params.toString();
2217
2260
  const response = await this.runtimeFetch(`/files/write${query ? `?${query}` : ""}`, {
2218
2261
  method: "POST",
@@ -2230,27 +2273,65 @@ var SandboxInstance = class SandboxInstance {
2230
2273
  throw parseErrorResponse(response.status, body, void 0, response.headers);
2231
2274
  }
2232
2275
  const data = await response.json();
2233
- if ([...options?.ifHash !== void 0 ? ["ifHash"] : [], ...options?.ifAbsent ? ["ifAbsent"] : []].some((precondition) => !data.data?.preconditionsApplied?.includes(precondition))) throw new CapabilityError("sidecar does not support write preconditions");
2234
2276
  if (!data.data) throw new ServerError("Invalid file write response: missing data", 502);
2277
+ this.assertWritePreconditions(data.data, {
2278
+ expectedHash: options?.ifHash,
2279
+ ifAbsent: options?.ifAbsent
2280
+ });
2235
2281
  return data.data;
2236
2282
  }
2237
- /**
2238
- * Write many files in one paced, retry-aware batch see
2239
- * {@link FileSystem.writeMany}. Each file goes through {@link write}; a small
2240
- * pace between writes keeps a large corpus under the file-write rate limit,
2241
- * and transient failures (quota / server / network / timeout) retry with
2242
- * exponential backoff (honoring a server `retryAfterMs`). Fail-loud on the
2243
- * first file that cannot be written after its retries.
2244
- */
2245
- async writeMany(files, options = {}) {
2246
- const paceMs = options.paceMs ?? WRITE_MANY_DEFAULT_PACE_MS;
2247
- const maxRetries = options.maxRetries ?? WRITE_MANY_DEFAULT_MAX_RETRIES;
2283
+ assertWritePreconditions(result, requested) {
2284
+ if ([...requested.expectedHash !== void 0 ? ["ifHash"] : [], ...requested.ifAbsent ? ["ifAbsent"] : []].some((precondition) => !result.preconditionsApplied?.includes(precondition))) throw new CapabilityError("sidecar does not support write preconditions");
2285
+ }
2286
+ async writeBatchRequest(files, body) {
2287
+ const response = await this.runtimeFetch("/files/write-batch", {
2288
+ method: "POST",
2289
+ body
2290
+ });
2291
+ if (response.status === 404) return false;
2292
+ if (!response.ok) {
2293
+ const errorBody = await response.text();
2294
+ throw parseErrorResponse(response.status, errorBody, {
2295
+ method: "POST",
2296
+ path: "/files/write-batch"
2297
+ }, response.headers);
2298
+ }
2299
+ const payload = await response.json().catch(() => null);
2300
+ if (!payload?.data?.files || typeof payload.data.files !== "object") throw new ServerError("Invalid file batch write response: missing data.files", 502);
2301
+ for (const file of files) {
2302
+ const result = payload.data.files[file.path];
2303
+ if (!result || typeof result !== "object") throw new ServerError(`Invalid file batch write response: missing result for ${file.path}`, 502);
2304
+ if (result.success === false) {
2305
+ if (typeof result.status !== "number" || typeof result.error !== "string" && (typeof result.error !== "object" || result.error === null)) throw new ServerError(`Invalid file batch write failure for ${file.path}`, 502);
2306
+ throw parseErrorResponse(result.status, JSON.stringify({
2307
+ success: false,
2308
+ error: result.error
2309
+ }), {
2310
+ method: "POST",
2311
+ path: "/files/write-batch"
2312
+ }, response.headers);
2313
+ }
2314
+ if (result.success !== true || typeof result.path !== "string" || typeof result.hash !== "string" || typeof result.size !== "number" || typeof result.mtime !== "number" || result.preconditionsApplied !== void 0 && (!Array.isArray(result.preconditionsApplied) || !result.preconditionsApplied.every((value) => value === "ifHash" || value === "ifAbsent"))) throw new ServerError(`Invalid file batch write result for ${file.path}`, 502);
2315
+ this.assertWritePreconditions({
2316
+ path: result.path,
2317
+ hash: result.hash,
2318
+ size: result.size,
2319
+ mtime: result.mtime,
2320
+ ...result.preconditionsApplied !== void 0 ? { preconditionsApplied: result.preconditionsApplied } : {}
2321
+ }, {
2322
+ expectedHash: file.expectedHash,
2323
+ ifAbsent: file.ifAbsent
2324
+ });
2325
+ }
2326
+ return true;
2327
+ }
2328
+ async writeManySequential(files, paceMs, maxRetries) {
2248
2329
  let started = false;
2249
2330
  for (const file of files) for (let attempt = 0;; attempt++) {
2250
2331
  if (started && paceMs > 0) await delay(paceMs);
2251
2332
  started = true;
2252
2333
  try {
2253
- await this.write(file.path, file.content, {
2334
+ await this.writeFileRequest(file.path, file.content, {
2254
2335
  mode: file.mode,
2255
2336
  encoding: file.encoding,
2256
2337
  ifHash: file.ifHash,
@@ -2268,6 +2349,29 @@ var SandboxInstance = class SandboxInstance {
2268
2349
  }
2269
2350
  }
2270
2351
  /**
2352
+ * Write many files through the runtime batch endpoint. Older runtimes that
2353
+ * return 404 use the sequential write path with the same retry policy.
2354
+ */
2355
+ async writeMany(files, options = {}) {
2356
+ if (files.length === 0) return;
2357
+ const paceMs = options.paceMs ?? WRITE_MANY_DEFAULT_PACE_MS;
2358
+ const maxRetries = options.maxRetries ?? WRITE_MANY_DEFAULT_MAX_RETRIES;
2359
+ await this.ensureRunning();
2360
+ if (hasDuplicateWriteManyPaths(files)) {
2361
+ await this.writeManySequential(files, paceMs, maxRetries);
2362
+ return;
2363
+ }
2364
+ const batches = splitWriteManyBatches(files.map(toWriteManyWireFile));
2365
+ for (const [index, batch] of batches.entries()) {
2366
+ if (index > 0 && paceMs > 0) await delay(paceMs);
2367
+ if (!await this.writeBatchRequest(batch.files, batch.body)) {
2368
+ if (index > 0) throw new ServerError("Runtime removed file batch support during writeMany", 502);
2369
+ await this.writeManySequential(files, paceMs, maxRetries);
2370
+ return;
2371
+ }
2372
+ }
2373
+ }
2374
+ /**
2271
2375
  * Send a prompt to the agent running in the sandbox.
2272
2376
  * Returns the complete response after the agent finishes.
2273
2377
  */
@@ -5047,8 +5151,11 @@ var SandboxInstance = class SandboxInstance {
5047
5151
  this.assertFilesystemIncarnationReady();
5048
5152
  const url = `/v1/sandboxes/${encodeURIComponent(this.id)}/runtime${path}`;
5049
5153
  try {
5050
- if (fetchOptions) return await this.client.fetch(url, options, fetchOptions);
5051
- return options ? await this.client.fetch(url, options) : await this.client.fetch(url);
5154
+ let response;
5155
+ if (fetchOptions) response = await this.client.fetch(url, options, fetchOptions);
5156
+ else response = options ? await this.client.fetch(url, options) : await this.client.fetch(url);
5157
+ if (response.ok) sandboxStatusObservedAt.set(this, Date.now());
5158
+ return response;
5052
5159
  } catch (err) {
5053
5160
  throw new NetworkError(`Failed to connect to sandbox: ${err instanceof Error ? err.message : String(err)}`, err instanceof Error ? err : void 0, {
5054
5161
  endpoint: path,
@@ -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-CnsaBf_U.js";
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-CpRq1GR5.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 };
@@ -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-hntZfGZ7.js";
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-CNd36MoA.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,5 +1,5 @@
1
1
  import { m as parseErrorResponse } from "./errors-Bf-A-4SA.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-Clsvx8OO.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-DVwPvdG_.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
@@ -5911,10 +5911,9 @@ interface WriteFileOptions {
5911
5911
  }
5912
5912
  /** Options for {@link FileSystem.writeMany}. */
5913
5913
  interface WriteManyOptions {
5914
- /** Delay between writes (ms) to stay under the file-write rate limit.
5915
- * Default 150; 0 disables pacing. */
5914
+ /** Delay between batch requests or compatibility writes. Default 0. */
5916
5915
  paceMs?: number;
5917
- /** Max retries per file on a transient error before failing loud. Default 4. */
5916
+ /** Max retries per compatibility write on a transient error. Default 4. */
5918
5917
  maxRetries?: number;
5919
5918
  }
5920
5919
  interface FileSystem {
@@ -5950,16 +5949,16 @@ interface FileSystem {
5950
5949
  */
5951
5950
  write(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
5952
5951
  /**
5953
- * Write many files in one paced, retry-aware batch.
5952
+ * Write many files through bounded runtime batch requests.
5954
5953
  *
5955
5954
  * For materializing a large file corpus (skills, tool scripts, config) into
5956
- * the sandbox without tripping the file-write rate limit. Each file goes
5957
- * through the same `/files/write` endpoint as {@link FileSystem.write}, with a
5958
- * small pace between writes and exponential-backoff retry on transient errors
5959
- * (quota / server / network / timeout, honoring a server `retryAfterMs`).
5960
- * Fail-loud: the first file that cannot be written after its retries throws,
5961
- * and the rest are not attempted. Relative paths resolve from the workspace
5962
- * root. Pass `mode: 0o755` on files that should be executable.
5955
+ * the sandbox without one network round trip per file. The SDK splits large
5956
+ * corpora by runtime count and gateway wire limits. An older runtime that
5957
+ * returns 404 uses sequential `/files/write` requests with retry. Batch writes
5958
+ * are not atomic. A per-file failure throws after the runtime reports all
5959
+ * results for that request, so sibling files can already be written. Relative
5960
+ * paths resolve from the workspace root. Pass `mode: 0o755` on executable
5961
+ * files.
5963
5962
  *
5964
5963
  * @example
5965
5964
  * ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.19.4",
3
+ "version": "0.19.5",
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",
@@ -87,8 +87,8 @@
87
87
  "url": "https://github.com/tangle-network/agent-dev-container/issues"
88
88
  },
89
89
  "dependencies": {
90
- "@tangle-network/agent-core": "0.5.4",
91
- "@tangle-network/agent-interface": "0.46.1",
90
+ "@tangle-network/agent-core": "0.6.0",
91
+ "@tangle-network/agent-interface": "0.47.0",
92
92
  "zod": "4.4.3"
93
93
  },
94
94
  "peerDependencies": {