@tangle-network/sandbox 0.30.0-develop.20260820014051.e2dc4fb → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/{client-BnhE_gUq.js → client-Bg9vBEfL.js} +1 -1
- package/dist/{client-DyFI5GnE.d.ts → client-DRV5bzRc.d.ts} +9 -6
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/{sandbox-BwIaQcE7.js → sandbox-4F9CNqdR.js} +171 -88
- package/dist/session-gateway/index.d.ts +56 -2
- package/dist/session-gateway/index.js +25 -3
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CGzEfYFL.js → tangle-CHpXtqlI.js} +1 -1
- package/package.json +3 -2
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as SandboxSession, h as SandboxTaskSession, r as SandboxInstance } from "../sandbox-B49ZGQv7.js";
|
|
2
2
|
import { C as CodeResultPart, S as CodeLanguage, b as CodeExecutionOptions, gi as SessionListOptions, mi as SessionInfo, s as BackendConfig, x as CodeExecutionResult } from "../types-Qn3x7R8O.js";
|
|
3
|
-
import { i as Sandbox } from "../client-
|
|
3
|
+
import { i as Sandbox } from "../client-DRV5bzRc.js";
|
|
4
4
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
|
|
6
6
|
//#region src/agent/instances.d.ts
|
package/dist/agent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as assertCurrentBackendType } from "../runtime-api-CK-4S7oA.js";
|
|
2
2
|
import { d as StateError, o as NotFoundError, p as ValidationError } from "../errors-C6kn-3zt.js";
|
|
3
|
-
import { n as Sandbox } from "../client-
|
|
4
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
3
|
+
import { n as Sandbox } from "../client-Bg9vBEfL.js";
|
|
4
|
+
import { t as SandboxInstance } from "../sandbox-4F9CNqdR.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
//#region src/agent/instances.ts
|
|
7
7
|
const managers = /* @__PURE__ */ new WeakMap();
|
|
@@ -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-CK-4S7oA.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-C6kn-3zt.js";
|
|
3
|
-
import { i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt, w as parseSSEStream, x as exportTraceBundle, y as normalizeConnection } from "./sandbox-
|
|
3
|
+
import { i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt, w as parseSSEStream, x as exportTraceBundle, y as normalizeConnection } from "./sandbox-4F9CNqdR.js";
|
|
4
4
|
import { agentProfileSchema } from "@tangle-network/agent-interface";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/backend-registry.ts
|
|
@@ -79,12 +79,15 @@ declare function parseBackendRegistryResponseBody(body: string): BackendRegistry
|
|
|
79
79
|
/**
|
|
80
80
|
* SSE Stream Parser
|
|
81
81
|
*
|
|
82
|
-
* EventSource stream parsing for SDK consumers.
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
82
|
+
* EventSource stream parsing for SDK consumers. Framing — buffering
|
|
83
|
+
* chunk-straddling frames, LF/CRLF terminators, multi-line `data:` joins,
|
|
84
|
+
* comment heartbeats, BOM — lives in `@tangle-network/sse-core`, the one
|
|
85
|
+
* wire-format implementation shared across the repo (bundled into this
|
|
86
|
+
* package's dist, so the SDK stays dependency-free at runtime). This
|
|
87
|
+
* module owns the SDK's payload contract on top of it: JSON parsing, the
|
|
88
|
+
* `"message"` default event type, and the malformed-frame policy. Used by
|
|
89
|
+
* `Sandbox.streamBatch` and by the web dashboard's batch page; exported
|
|
90
|
+
* so downstream surfaces don't maintain their own copies.
|
|
88
91
|
*
|
|
89
92
|
* Guarantees:
|
|
90
93
|
* - Correctly buffers frames that straddle chunk boundaries.
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages } from "./sandbox-B49ZGQv7.js";
|
|
2
2
|
import { $n as SandboxConfig, En as PromptInputPart, Fr as SandboxInfo, M as CreateSandboxOptions, Ur as SandboxStatus, _n as PreviewLinkWaitOptions, gn as PreviewLinkManager, hn as PreviewLinkInfo, it as ExecResult, rt as ExecOptions, un as NetworkConfig } from "./types-Qn3x7R8O.js";
|
|
3
|
-
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, b as backendRegistryEntrySchema, g as BackendRegistryEntry, h as BackendRegistryCapabilities, i as Sandbox, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-
|
|
3
|
+
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, b as backendRegistryEntrySchema, g as BackendRegistryEntry, h as BackendRegistryCapabilities, i as Sandbox, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-DRV5bzRc.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, type BackendRegistryCapabilities, type BackendRegistryEntry, type BackendRegistryInteractionKind, type BackendRegistryResponse, 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, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
|
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-C6kn-3zt.js";
|
|
2
|
-
import { _ as parseBackendRegistryResponseBody, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, m as backendRegistryResponseSchema, n as Sandbox, p as backendRegistryInteractionKindSchema } from "./client-
|
|
3
|
-
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-
|
|
2
|
+
import { _ as parseBackendRegistryResponseBody, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, m as backendRegistryResponseSchema, n as Sandbox, p as backendRegistryInteractionKindSchema } from "./client-Bg9vBEfL.js";
|
|
3
|
+
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-4F9CNqdR.js";
|
|
4
4
|
export { AuthError, CapabilityError, FileWriteConflictError, NetworkError, NotFoundError, PartialFailureError, QuotaError, Sandbox, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as BuildControlPlaneMcpConfigOptions, C as InterruptResult, D as SandboxInteractionConflict, E as SandboxInteractionCommandResult, F as SandboxMcpEndpoint, I as SandboxMcpServerEntry, L as buildControlPlaneMcpConfig, M as CONTROL_PLANE_MCP_SERVER_NAME, N as SANDBOX_MCP_SERVER_NAME, O as SandboxInteractionResolution, P as SandboxMcpConfig, R as buildSandboxMcpConfig, S as InteractiveSessionStatus, T as StartInteractiveOptions, _ as InteractiveAttachOptions, a as WorkspaceImagePublishRequestOptions, b as InteractiveSessionHost, c as TraceExportFormat, d as buildTraceExportPayload, f as exportTraceBundle, g as SandboxSession, h as SandboxTaskSession, i as WorkspaceImagePublishInput, j as BuildSandboxMcpConfigOptions, k as SandboxInteractionResult, l as TraceExportResult, m as toOtelJson, o as WorkspaceImagePublishResult, p as otelTraceIdForTangleTrace, r as SandboxInstance, s as WorkspaceImages, t as ForkAcknowledgement, u as TraceExportSink, v as InteractiveAuthFile, w as RespondToPermissionOptions, x as InteractiveSessionInfo, y as InteractiveSessionHandle } from "./sandbox-B49ZGQv7.js";
|
|
2
2
|
import { $ as EgressPolicy, $i as WriteManyFile, $n as SandboxConfig, $r as SandboxTraceOptions, $t as IntelligenceReportSubjectType, Ai as StorageConfig, An as ProvisionResult, Ar as SandboxFleetWorkspace, At as ForkIdempotency, B as DownloadOptions, Bi as TeePublicKey, Bn as ReconcileSandboxFleetsResult, Br as SandboxResources, Bt as GpuLeaseBilling, Ci as SnapshotIdempotency, Cn as ProcessSignal, Cr as SandboxFleetPolicy, Ct as FleetDriveTurnRequest, D as CreateIntelligenceReportOptions, Dn as PromptOptions, Dr as SandboxFleetTraceExport, Dt as FleetPromptDispatchOptions, E as CreateGpuLeaseOptions, Ei as SnapshotResult, En as PromptInputPart, Er as SandboxFleetTraceEvent, Et as FleetMachineId, F as DeleteOptions, Fi as TaskSessionInfo, Fn as PublishPublicTemplateOptions, Fr as SandboxInfo, Ft as GitCommit, G as DriverType, Gi as UpdateUserOptions, Gn as RolloutChildResult, Gr as SandboxTerminalCreateOptions, Gt as GpuLeaseProviderName, H as DriveTurnOptions, Hi as TokenRefreshHandler, Hr as SandboxRuntimeHealth, Ht as GpuLeaseExecOptions, I as DevServerInfo, Ii as TaskSessionProfile, In as PublishPublicTemplateVersionOptions, Ir as SandboxIntelligenceEnvelope, It as GitConfig, J as EffectiveBackend, Ji as UsageInfo, Jn as RolloutStartResult, Jr as SandboxTerminalRequestOptions, Jt as HostAgentRuntimeBackend, K as DurablePlan, Ki as UploadOptions, Kn as RolloutOptions, Kr as SandboxTerminalInfo, Kt as GpuLeaseStatus, L as DirectoryPermission, Li as TeeAttestationOptions, Ln as ReapExpiredSandboxFleetsOptions, Lr as SandboxPortBinding, Lt as GitDiff, M as CreateSandboxOptions, Mi as TaskSessionChanges, Mn as ProvisionStep, Mr as SandboxFleetWorkspaceRestoreResult, Mt as GPU_LEASE_PROVIDER_NAMES, N as CreateSessionOptions, Ni as TaskSessionCommitResult, Nn as PublicTemplateInfo, Nr as SandboxFleetWorkspaceSnapshotResult, Nt as GitAuth, O as CreateRequestOptions, Oi as StartupDiagnostics, On as PromptResult, Or as SandboxFleetTraceOptions, P as CreateTaskSessionOptions, Pi as TaskSessionFileChange, Pn as PublicTemplateVersionInfo, Pr as SandboxIdentity, Pt as GitBranch, Q as EgressManager, Qi as WriteFileOptions, Qn as SSHCredentials, Qr as SandboxTraceExport, Qt as IntelligenceReportCompareTo, R as DispatchPromptOptions, Ri as TeeAttestationReport, Rn as ReapExpiredSandboxFleetsResult, Rr as SandboxPortPreviewLink, Rt as GitStatus, Si as SnapshotDeleteOutcome, Sn as ProcessManager, Sr as SandboxFleetOperationsSummary, St as FleetDriveTurnOutcome, T as CompletedTurnResult, Ti as SnapshotOptions, Tn as ProcessStatus, Tr as SandboxFleetTraceBundle, U as DriverConfig, Ui as TokenUsage, Ur as SandboxStatus, Ut as GpuLeaseExecResult, V as DownloadProgress, Vi as TeePublicKeyResponse, Vn as RenameOptions, Vr as SandboxRuntimeCapabilities, Vt as GpuLeaseCommandResult, W as DriverInfo, Wi as TurnDriveResult, Wn as Rollout, Wr as SandboxTerminalAttachOptions, Wt as GpuLeaseManager, X as EffectiveBackendSource, Xi as WaitForRolloutOptions, Xn as RolloutTurnPart, Xr as SandboxTraceBundle, Xt as IntelligenceReport, Y as EffectiveBackendProfile, Yi as WaitForOptions, Yn as RolloutStatus, Yr as SandboxTerminals, Yt as InstalledTool, Z as EgressDenial, Zi as WorkspaceOperationLookup, Zn as SSHCommandDescriptor, Zr as SandboxTraceEvent, Zt as IntelligenceReportBudget, _ as BranchOptions, _a as TerminalStreamToken, _i as SessionMessage, _n as PreviewLinkWaitOptions, _r as SandboxFleetMachineMeteredUsage, _t as FileWriteResult, a as AttachSandboxFleetMachineOptions, aa as BatchTaskUsage, ai as SecretInfo, an as ListSandboxOptions, ar as SandboxEnvironment, at as FileInfo, bi as SessionStatus, bn as ProcessListOptions, br as SandboxFleetManifest, bt as FleetDispatchResultBufferOptions, c as BackendInfo, ca as parseBackendType, ci as SendSessionMessageRequest, cn as MintScopedTokenOptions, cr as SandboxFleetArtifactSpec, ct as FileReadError, d as BatchBackend, da as TerminalReadyInfo, di as SessionEventStreamOptions, dn as NetworkManager, dr as SandboxFleetDispatchResponse, dt as FileSystem, ea as WriteManyOptions, ei as SandboxUser, en as IntelligenceReportWindow, er as SandboxConnection, et as EnsureDevServerOptions, f as BatchResult, fa as TerminalStream, fi as SessionFailureReason, fn as NonHostAgentDriverConfig, fr as SandboxFleetDriverCapability, ft as FileTreeFile, g as BatchTaskResult, ga as TerminalStreamOptions, gi as SessionListOptions, gn as PreviewLinkManager, gr as SandboxFleetMachine, gt as FileUsageResult, h as BatchTask, ha as TerminalStreamHandlers, hi as SessionInterruptOptions, hn as PreviewLinkInfo, hr as SandboxFleetIntelligenceEnvelope, ht as FileUsageOptions, i as AttachGpuLeaseOptions, ia as BatchSidecarGroup, ii as SearchOptions, in as ListSandboxFleetOptions, ir as SandboxDeleteOutcome, it as ExecResult, j as CreateSandboxFleetWithCoordinatorOptions, ji as SubscriptionInfo, jn as ProvisionStatus, jr as SandboxFleetWorkspaceReconcileResult, jt as ForkLookupOptions, k as CreateSandboxFleetOptions, ki as StartupOperation, kn as ProvisionEvent, kr as SandboxFleetUsage, kt as ForkCounts, l as BackendManager, la as TERMINAL_WS_ECHO_SUBPROTOCOL, li as SentSessionMessage, ln as MkdirOptions, lr as SandboxFleetCostEstimate, lt as FileReadResult, m as BatchRunRequest, ma as TerminalStreamError, mi as SessionInfo, mn as PermissionsManager, mr as SandboxFleetInfo, mt as FileTreeResult, n as AccessPolicyRule, na as BatchEvent, ni as ScopedTokenScope, nn as ListMessagesOptions, nr as SandboxCreateReceipt, nt as ExactProcessSpawnOptions, o as BackendCapabilities, oa as PublicBatchRunRequest, oi as SecretsManager, on as MAX_EGRESS_DENIALS_LIMIT, or as SandboxEvent, ot as FileReadBatchOptions, p as BatchRunOptions, pa as TerminalStreamAuthFormat, pi as SessionForkOptions, pn as PermissionLevel, pr as SandboxFleetDriverTimings, pt as FileTreeOptions, q as DurablePlanDecisionResult, qi as UploadProgress, qn as RolloutScorer, qr as SandboxTerminalManager, qt as HostAgentDriverConfig, r as AddUserOptions, ra as BatchEventDataMap, ri as SearchMatch, rn as ListOptions, rr as SandboxDeleteAcknowledgement, rt as ExecOptions, s as BackendConfig, sa as BackendType, si as SendSessionMessageOptions, sn as McpServerConfig, sr as SandboxFleetArtifact, st as FileReadBatchResult, t as AcceleratorKind, ta as BatchBackendStats, ti as ScopedToken, tr as SandboxCreateOutcome, tt as EventStreamOptions, u as BackendStatus, ua as TerminalExitInfo, ui as SessionBackendCredentials, un as NetworkConfig, ur as SandboxFleetDispatchFailureClass, ut as FileRenameResult, v as ChunkedUploadOptions, vi as SessionMessageInputPart, vn as Process, vr as SandboxFleetMachineRecord, vt as FleetDispatchCancelResult, w as CommitTaskSessionOptions, wi as SnapshotInfo, wn as ProcessSpawnOptions, wr as SandboxFleetToken, wt as FleetExecDispatchOptions, xi as SnapshotDeleteAcknowledgement, xn as ProcessLogEntry, xr as SandboxFleetManifestMachine, xt as FleetDispatchStreamOptions, y as ChunkedUploadResult, yi as SessionResultOptions, yn as ProcessInfo, yr as SandboxFleetMachineSpec, yt as FleetDispatchResultBuffer, z as DispatchedSession, zi as TeeAttestationResponse, zn as ReconcileSandboxFleetsOptions, zr as SandboxResourceUsage, zt as GpuLease } from "./types-Qn3x7R8O.js";
|
|
3
|
-
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, a as Team, b as backendRegistryEntrySchema, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, g as BackendRegistryEntry, h as BackendRegistryCapabilities, 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, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-
|
|
3
|
+
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, a as Team, b as backendRegistryEntrySchema, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, g as BackendRegistryEntry, h as BackendRegistryCapabilities, 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, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-DRV5bzRc.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";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { h as parseBackendType, m as backendTypeSchema, p as normalizeRuntimeBackendConfig } from "./runtime-api-CK-4S7oA.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-C6kn-3zt.js";
|
|
3
|
-
import { _ as parseBackendRegistryResponseBody, a as splitInlineProfileSkills, c as SandboxFleetClient, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, i as splitInlineProfileFileMounts, l as createBatchResultAccumulator, m as backendRegistryResponseSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryInteractionKindSchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as validateBatchRunRequest } from "./client-
|
|
4
|
-
import { C as toOtelJson, S as otelTraceIdForTangleTrace, _ as getSandboxEventText, a as WorkspaceImages, b as buildTraceExportPayload, c as TERMINAL_WS_ECHO_SUBPROTOCOL, d as SandboxTaskSession, f as SandboxSession, g as collectAgentResponseText, h as collectAgentFinalMessageText, l as TerminalStream, m as applySandboxEventText, o as GPU_LEASE_PROVIDER_NAMES, p as InteractiveSessionHandle, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as TerminalStreamError, v as isToolBearingEvent, w as parseSSEStream, x as exportTraceBundle } from "./sandbox-
|
|
3
|
+
import { _ as parseBackendRegistryResponseBody, a as splitInlineProfileSkills, c as SandboxFleetClient, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, i as splitInlineProfileFileMounts, l as createBatchResultAccumulator, m as backendRegistryResponseSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryInteractionKindSchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as validateBatchRunRequest } from "./client-Bg9vBEfL.js";
|
|
4
|
+
import { C as toOtelJson, S as otelTraceIdForTangleTrace, _ as getSandboxEventText, a as WorkspaceImages, b as buildTraceExportPayload, c as TERMINAL_WS_ECHO_SUBPROTOCOL, d as SandboxTaskSession, f as SandboxSession, g as collectAgentResponseText, h as collectAgentFinalMessageText, l as TerminalStream, m as applySandboxEventText, o as GPU_LEASE_PROVIDER_NAMES, p as InteractiveSessionHandle, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as TerminalStreamError, v as isToolBearingEvent, w as parseSSEStream, x as exportTraceBundle } from "./sandbox-4F9CNqdR.js";
|
|
5
5
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-COCXdRrk.js";
|
|
6
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
6
|
+
import { t as TangleSandboxClient } from "./tangle-CHpXtqlI.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
|
|
@@ -3,8 +3,162 @@ import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError,
|
|
|
3
3
|
import { AgentExactRunControlRefSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, sha256DigestSchema } from "@tangle-network/agent-interface";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
|
|
6
|
+
//#region ../../../packages/sse-core/dist/index.js
|
|
7
|
+
/**
|
|
8
|
+
* Incremental SSE frame parser. Feed decoded text via `push()`; call
|
|
9
|
+
* `flush()` when the stream ends.
|
|
10
|
+
*/
|
|
11
|
+
var SSEFrameParser = class {
|
|
12
|
+
buffer = "";
|
|
13
|
+
frameEvent = "";
|
|
14
|
+
frameId;
|
|
15
|
+
frameDataLines = null;
|
|
16
|
+
bomChecked = false;
|
|
17
|
+
/**
|
|
18
|
+
* Append a decoded text chunk and return every frame the chunk
|
|
19
|
+
* completes. Frame state survives across calls: one frame can
|
|
20
|
+
* straddle any number of chunks.
|
|
21
|
+
*/
|
|
22
|
+
push(chunk) {
|
|
23
|
+
let text = chunk;
|
|
24
|
+
if (!this.bomChecked && text.length > 0) {
|
|
25
|
+
this.bomChecked = true;
|
|
26
|
+
if (text.charCodeAt(0) === 65279) text = text.slice(1);
|
|
27
|
+
}
|
|
28
|
+
this.buffer += text;
|
|
29
|
+
const lines = this.buffer.split("\n");
|
|
30
|
+
this.buffer = lines.pop() ?? "";
|
|
31
|
+
return this.processLines(lines);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* End-of-stream: process the unterminated trailing line, then
|
|
35
|
+
* dispatch a dangling frame that never got its blank line.
|
|
36
|
+
* Well-behaved servers end frames with "\n\n", but some close early.
|
|
37
|
+
*/
|
|
38
|
+
flush() {
|
|
39
|
+
const rest = this.buffer;
|
|
40
|
+
this.buffer = "";
|
|
41
|
+
const frames = rest.length > 0 ? this.processLines([rest]) : [];
|
|
42
|
+
const dangling = this.dispatch();
|
|
43
|
+
if (dangling) frames.push(dangling);
|
|
44
|
+
return frames;
|
|
45
|
+
}
|
|
46
|
+
processLines(lines) {
|
|
47
|
+
const frames = [];
|
|
48
|
+
for (const rawLine of lines) {
|
|
49
|
+
const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
|
|
50
|
+
if (line === "") {
|
|
51
|
+
const frame = this.dispatch();
|
|
52
|
+
if (frame) frames.push(frame);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (line.startsWith(":")) continue;
|
|
56
|
+
if (line.startsWith("data:")) {
|
|
57
|
+
let value = line.slice(5);
|
|
58
|
+
if (value.startsWith(" ")) value = value.slice(1);
|
|
59
|
+
if (this.frameDataLines === null) this.frameDataLines = [];
|
|
60
|
+
this.frameDataLines.push(value);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (line.startsWith("event:")) {
|
|
64
|
+
this.frameEvent = line.slice(6).trim();
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (line.startsWith("id:")) this.frameId = line.slice(3).trim();
|
|
68
|
+
}
|
|
69
|
+
return frames;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Dispatch the accumulated frame. A frame with no `data:` field (an
|
|
73
|
+
* `event:`/`id:`-only frame, or a bare comment) produces nothing, and
|
|
74
|
+
* its field state is consumed and reset either way.
|
|
75
|
+
*/
|
|
76
|
+
dispatch() {
|
|
77
|
+
const dataLines = this.frameDataLines;
|
|
78
|
+
const frame = dataLines ? {
|
|
79
|
+
event: this.frameEvent,
|
|
80
|
+
data: dataLines.join("\n"),
|
|
81
|
+
id: this.frameId || void 0
|
|
82
|
+
} : null;
|
|
83
|
+
this.frameEvent = "";
|
|
84
|
+
this.frameId = void 0;
|
|
85
|
+
this.frameDataLines = null;
|
|
86
|
+
return frame;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Read a streaming SSE response body into parsed frames.
|
|
91
|
+
*
|
|
92
|
+
* @throws `TypeError` when the body is missing.
|
|
93
|
+
* @throws `DOMException` with `name === "AbortError"` on cancellation —
|
|
94
|
+
* including the WHATWG-fetch variant where an aborted body resolves
|
|
95
|
+
* `done: true` instead of rejecting the read.
|
|
96
|
+
*/
|
|
97
|
+
async function* streamSSEFrames(body, options) {
|
|
98
|
+
if (!body) throw new TypeError("SSE stream has no response body");
|
|
99
|
+
const reader = body.getReader();
|
|
100
|
+
const decoder = new TextDecoder();
|
|
101
|
+
const parser = new SSEFrameParser();
|
|
102
|
+
const { signal } = options ?? {};
|
|
103
|
+
let completed = false;
|
|
104
|
+
try {
|
|
105
|
+
for (;;) {
|
|
106
|
+
if (signal?.aborted) throw new DOMException("SSE stream aborted", "AbortError");
|
|
107
|
+
const { done, value } = await reader.read();
|
|
108
|
+
if (done) {
|
|
109
|
+
if (signal?.aborted) throw new DOMException("SSE stream aborted", "AbortError");
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
for (const frame of parser.push(decoder.decode(value, { stream: true }))) yield frame;
|
|
113
|
+
}
|
|
114
|
+
for (const frame of parser.push(decoder.decode())) yield frame;
|
|
115
|
+
for (const frame of parser.flush()) yield frame;
|
|
116
|
+
completed = true;
|
|
117
|
+
} finally {
|
|
118
|
+
if (!completed) await reader.cancel().catch(() => void 0);
|
|
119
|
+
reader.releaseLock();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
6
123
|
//#region src/lib/sse-parser.ts
|
|
7
124
|
/**
|
|
125
|
+
* SSE Stream Parser
|
|
126
|
+
*
|
|
127
|
+
* EventSource stream parsing for SDK consumers. Framing — buffering
|
|
128
|
+
* chunk-straddling frames, LF/CRLF terminators, multi-line `data:` joins,
|
|
129
|
+
* comment heartbeats, BOM — lives in `@tangle-network/sse-core`, the one
|
|
130
|
+
* wire-format implementation shared across the repo (bundled into this
|
|
131
|
+
* package's dist, so the SDK stays dependency-free at runtime). This
|
|
132
|
+
* module owns the SDK's payload contract on top of it: JSON parsing, the
|
|
133
|
+
* `"message"` default event type, and the malformed-frame policy. Used by
|
|
134
|
+
* `Sandbox.streamBatch` and by the web dashboard's batch page; exported
|
|
135
|
+
* so downstream surfaces don't maintain their own copies.
|
|
136
|
+
*
|
|
137
|
+
* Guarantees:
|
|
138
|
+
* - Correctly buffers frames that straddle chunk boundaries.
|
|
139
|
+
* - Accepts LF- and CRLF-terminated streams interchangeably.
|
|
140
|
+
* - Joins multi-line `data:` per the spec (dispatch joins with
|
|
141
|
+
* "\n" before JSON parse).
|
|
142
|
+
* - Defaults event type to `"message"` when a frame carries
|
|
143
|
+
* `data:` but no `event:` field (SSE spec §9.2.6 step 3).
|
|
144
|
+
* - Surfaces optional `id:` so callers can implement reconnection.
|
|
145
|
+
* - Flushes a dangling event when the stream closes without a
|
|
146
|
+
* terminating blank line (well-behaved servers emit `\n\n`, but
|
|
147
|
+
* some close early).
|
|
148
|
+
* - Throws `AbortError` when the caller-supplied signal fires, so
|
|
149
|
+
* consumers can distinguish "ran to completion" from "cancelled"
|
|
150
|
+
* without peeking at signal state.
|
|
151
|
+
* - Rejects malformed JSON by default. Callers handling recoverable output
|
|
152
|
+
* streams can explicitly warn and skip one invalid frame.
|
|
153
|
+
*
|
|
154
|
+
* What it does NOT do:
|
|
155
|
+
* - CR-only (legacy Mac) line terminators. No known emitter uses
|
|
156
|
+
* them; supporting them would risk splitting payloads that
|
|
157
|
+
* legitimately contain CR.
|
|
158
|
+
* - Retry/reconnect (caller's responsibility).
|
|
159
|
+
* - Event-type filtering (caller's responsibility).
|
|
160
|
+
*/
|
|
161
|
+
/**
|
|
8
162
|
* Parse a streaming SSE response body into an async iterable of
|
|
9
163
|
* structured events.
|
|
10
164
|
*
|
|
@@ -12,81 +166,31 @@ import { readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
|
|
|
12
166
|
* @throws `DOMException` with `name === "AbortError"` on cancellation.
|
|
13
167
|
*/
|
|
14
168
|
async function* parseSSEStream(body, options) {
|
|
15
|
-
if (!body) throw new TypeError("SSE stream has no response body");
|
|
16
|
-
const reader = body.getReader();
|
|
17
|
-
const decoder = new TextDecoder();
|
|
18
169
|
const { signal, invalidEvent = "throw" } = options ?? {};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let dataLines = [];
|
|
22
|
-
let currentId = "";
|
|
23
|
-
let completed = false;
|
|
24
|
-
const flush = function* () {
|
|
25
|
-
if (dataLines.length === 0) {
|
|
26
|
-
currentEvent = "";
|
|
27
|
-
currentId = "";
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const effectiveEvent = currentEvent || "message";
|
|
31
|
-
const joined = dataLines.join("\n");
|
|
170
|
+
for await (const frame of streamSSEFrames(body, { signal })) {
|
|
171
|
+
const effectiveEvent = frame.event || "message";
|
|
32
172
|
let data;
|
|
33
173
|
try {
|
|
34
|
-
data = JSON.parse(
|
|
174
|
+
data = JSON.parse(frame.data);
|
|
35
175
|
} catch (error) {
|
|
36
176
|
if (invalidEvent === "warn-and-skip") {
|
|
37
|
-
console.warn(`[sandbox-sdk] Malformed SSE JSON for event "${effectiveEvent}": ${
|
|
38
|
-
|
|
39
|
-
dataLines = [];
|
|
40
|
-
currentId = "";
|
|
41
|
-
return;
|
|
177
|
+
console.warn(`[sandbox-sdk] Malformed SSE JSON for event "${effectiveEvent}": ${frame.data.slice(0, 200)}`);
|
|
178
|
+
continue;
|
|
42
179
|
}
|
|
43
180
|
throw new SyntaxError(`Malformed SSE JSON for event "${effectiveEvent}"`, { cause: error });
|
|
44
181
|
}
|
|
45
182
|
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
46
183
|
if (invalidEvent === "warn-and-skip") {
|
|
47
184
|
console.warn(`[sandbox-sdk] SSE event "${effectiveEvent}" data must be a JSON object`);
|
|
48
|
-
|
|
49
|
-
dataLines = [];
|
|
50
|
-
currentId = "";
|
|
51
|
-
return;
|
|
185
|
+
continue;
|
|
52
186
|
}
|
|
53
187
|
throw new TypeError(`SSE event "${effectiveEvent}" data must be a JSON object`);
|
|
54
188
|
}
|
|
55
189
|
yield {
|
|
56
190
|
type: effectiveEvent,
|
|
57
191
|
data,
|
|
58
|
-
id:
|
|
192
|
+
id: frame.id
|
|
59
193
|
};
|
|
60
|
-
currentEvent = "";
|
|
61
|
-
dataLines = [];
|
|
62
|
-
currentId = "";
|
|
63
|
-
};
|
|
64
|
-
const processLine = (line) => {
|
|
65
|
-
if (line.startsWith("event:")) currentEvent = line.slice(6).trim();
|
|
66
|
-
else if (line.startsWith("data:")) dataLines.push(line.slice(5).trim());
|
|
67
|
-
else if (line.startsWith("id:")) currentId = line.slice(3).trim();
|
|
68
|
-
};
|
|
69
|
-
try {
|
|
70
|
-
while (true) {
|
|
71
|
-
if (signal?.aborted) throw new DOMException("SSE stream aborted", "AbortError");
|
|
72
|
-
const { done, value } = await reader.read();
|
|
73
|
-
if (done) {
|
|
74
|
-
if (signal?.aborted) throw new DOMException("SSE stream aborted", "AbortError");
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
buffer += decoder.decode(value, { stream: true });
|
|
78
|
-
const lines = buffer.split(/\r?\n/);
|
|
79
|
-
buffer = lines.pop() ?? "";
|
|
80
|
-
for (const line of lines) if (line === "") yield* flush();
|
|
81
|
-
else processLine(line);
|
|
82
|
-
}
|
|
83
|
-
buffer += decoder.decode();
|
|
84
|
-
if (buffer.length > 0) processLine(buffer);
|
|
85
|
-
yield* flush();
|
|
86
|
-
completed = true;
|
|
87
|
-
} finally {
|
|
88
|
-
if (!completed) await reader.cancel().catch(() => void 0);
|
|
89
|
-
reader.releaseLock();
|
|
90
194
|
}
|
|
91
195
|
}
|
|
92
196
|
//#endregion
|
|
@@ -4578,37 +4682,16 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4578
4682
|
};
|
|
4579
4683
|
}
|
|
4580
4684
|
async *parseProcessLogStream(response) {
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
buffer += decoder.decode(value, { stream: true });
|
|
4592
|
-
const lines = buffer.split("\n");
|
|
4593
|
-
buffer = lines.pop() ?? "";
|
|
4594
|
-
for (const line of lines) if (line.startsWith("event:")) currentEvent = line.slice(6).trim();
|
|
4595
|
-
else if (line.startsWith("data:")) currentData = line.slice(5).trim();
|
|
4596
|
-
else if (line === "" && currentEvent && currentData) {
|
|
4597
|
-
if (currentEvent === "stdout" || currentEvent === "stderr") try {
|
|
4598
|
-
const parsed = JSON.parse(currentData);
|
|
4599
|
-
yield {
|
|
4600
|
-
type: currentEvent,
|
|
4601
|
-
data: parsed.data,
|
|
4602
|
-
timestamp: parsed.timestamp
|
|
4603
|
-
};
|
|
4604
|
-
} catch {}
|
|
4605
|
-
else if (currentEvent === "exit") return;
|
|
4606
|
-
currentEvent = "";
|
|
4607
|
-
currentData = "";
|
|
4608
|
-
}
|
|
4609
|
-
}
|
|
4610
|
-
} finally {
|
|
4611
|
-
reader.releaseLock();
|
|
4685
|
+
if (!response.body) throw new NetworkError("No response body");
|
|
4686
|
+
for await (const event of parseSSEStream(response.body, { invalidEvent: "warn-and-skip" })) {
|
|
4687
|
+
if (event.type === "exit") return;
|
|
4688
|
+
if (event.type !== "stdout" && event.type !== "stderr") continue;
|
|
4689
|
+
if (typeof event.data.data !== "string" || typeof event.data.timestamp !== "number") continue;
|
|
4690
|
+
yield {
|
|
4691
|
+
type: event.type,
|
|
4692
|
+
data: event.data.data,
|
|
4693
|
+
timestamp: event.data.timestamp
|
|
4694
|
+
};
|
|
4612
4695
|
}
|
|
4613
4696
|
}
|
|
4614
4697
|
/**
|
|
@@ -23,7 +23,12 @@ type ClientMessage = {
|
|
|
23
23
|
} | {
|
|
24
24
|
type: "replay";
|
|
25
25
|
id?: string;
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Timestamp to replay from.
|
|
28
|
+
* @deprecated Timestamps are not a stable cursor. Use `sinceSeq`.
|
|
29
|
+
*/
|
|
30
|
+
since?: number; /** Replay events with a per-session seq above this value. */
|
|
31
|
+
sinceSeq?: number;
|
|
27
32
|
} | {
|
|
28
33
|
type: "terminal.input";
|
|
29
34
|
id?: string;
|
|
@@ -156,6 +161,25 @@ type ServerMessage = (ServerMessageBase & {
|
|
|
156
161
|
}) | (ServerMessageBase & {
|
|
157
162
|
type: "replay.complete";
|
|
158
163
|
total: number;
|
|
164
|
+
}) | (ServerMessageBase & {
|
|
165
|
+
type: "replay.truncated";
|
|
166
|
+
data: {
|
|
167
|
+
/** Why the replay is incomplete (e.g. "cursor_evicted") */reason: string; /** Seq cursor the client requested */
|
|
168
|
+
requestedSeq?: number; /** Oldest seq still retained by the gateway buffer */
|
|
169
|
+
firstAvailableSeq?: number;
|
|
170
|
+
};
|
|
171
|
+
}) | (ServerMessageBase & {
|
|
172
|
+
type: "stream.gap";
|
|
173
|
+
data: {
|
|
174
|
+
sandboxId?: string; /** Events the sidecar dropped before the gateway saw them */
|
|
175
|
+
droppedCount?: number;
|
|
176
|
+
};
|
|
177
|
+
}) | (ServerMessageBase & {
|
|
178
|
+
type: "stream.dead";
|
|
179
|
+
data: {
|
|
180
|
+
sandboxId?: string; /** Why the upstream subscription stopped */
|
|
181
|
+
error?: string;
|
|
182
|
+
};
|
|
159
183
|
}) | (ServerMessageBase & {
|
|
160
184
|
type: "error";
|
|
161
185
|
message: string;
|
|
@@ -295,13 +319,38 @@ interface SessionGatewayEventHandlers {
|
|
|
295
319
|
}) => void;
|
|
296
320
|
onPortOpened?: (port: number, protocol: string, processName?: string) => void;
|
|
297
321
|
onPortClosed?: (port: number) => void;
|
|
298
|
-
onAgentEvent?: (channel: string,
|
|
322
|
+
onAgentEvent?: (channel: string, raw: unknown, seq?: number) => void;
|
|
299
323
|
onError?: (message: string, code?: string) => void;
|
|
300
324
|
onStateChange?: (state: ConnectionState) => void;
|
|
301
325
|
onMetricsChange?: (metrics: ConnectionMetrics) => void;
|
|
302
326
|
onReplayStart?: (total: number) => void;
|
|
303
327
|
onReplayProgress?: (received: number, total: number) => void;
|
|
304
328
|
onReplayComplete?: (total: number) => void;
|
|
329
|
+
/**
|
|
330
|
+
* Called when the gateway buffer evicted events the client requested.
|
|
331
|
+
* The replay that follows starts at firstAvailableSeq.
|
|
332
|
+
*/
|
|
333
|
+
onReplayTruncated?: (data: {
|
|
334
|
+
reason: string;
|
|
335
|
+
requestedSeq?: number;
|
|
336
|
+
firstAvailableSeq?: number;
|
|
337
|
+
}) => void;
|
|
338
|
+
/**
|
|
339
|
+
* Called when the sidecar dropped events upstream of the gateway.
|
|
340
|
+
* The live stream has a gap; request a replay to recover.
|
|
341
|
+
*/
|
|
342
|
+
onStreamGap?: (data: {
|
|
343
|
+
sandboxId?: string;
|
|
344
|
+
droppedCount?: number;
|
|
345
|
+
}) => void;
|
|
346
|
+
/**
|
|
347
|
+
* Called when the gateway gave up reconnecting to the sidecar.
|
|
348
|
+
* No further events arrive on this stream.
|
|
349
|
+
*/
|
|
350
|
+
onStreamDead?: (data: {
|
|
351
|
+
sandboxId?: string;
|
|
352
|
+
error?: string;
|
|
353
|
+
}) => void;
|
|
305
354
|
onTokenExpiring?: (secondsRemaining: number) => void;
|
|
306
355
|
onTokenExpired?: () => void;
|
|
307
356
|
onBackpressureWarning?: (droppedCount: number, since: number, totalDropped: number) => void;
|
|
@@ -449,8 +498,13 @@ declare class SessionGatewayClient {
|
|
|
449
498
|
ping(): Promise<number>;
|
|
450
499
|
/**
|
|
451
500
|
* Request replay of events since a timestamp.
|
|
501
|
+
* @deprecated Timestamps are not a stable cursor. Use replaySinceSeq().
|
|
452
502
|
*/
|
|
453
503
|
replay(since: number): Promise<void>;
|
|
504
|
+
/**
|
|
505
|
+
* Request replay of events with a per-session seq above the cursor.
|
|
506
|
+
*/
|
|
507
|
+
replaySinceSeq(sinceSeq: number): Promise<void>;
|
|
454
508
|
/**
|
|
455
509
|
* Send terminal input via WebSocket.
|
|
456
510
|
*/
|
|
@@ -82,6 +82,7 @@ const CONTROL_MESSAGE_TYPES = new Set([
|
|
|
82
82
|
"replay.start",
|
|
83
83
|
"replay.progress",
|
|
84
84
|
"replay.complete",
|
|
85
|
+
"replay.truncated",
|
|
85
86
|
"error",
|
|
86
87
|
"token.expiring",
|
|
87
88
|
"token.expired",
|
|
@@ -374,6 +375,7 @@ var SessionGatewayClient = class {
|
|
|
374
375
|
}
|
|
375
376
|
/**
|
|
376
377
|
* Request replay of events since a timestamp.
|
|
378
|
+
* @deprecated Timestamps are not a stable cursor. Use replaySinceSeq().
|
|
377
379
|
*/
|
|
378
380
|
async replay(since) {
|
|
379
381
|
if (!this.connectionEstablishedForSocket || !this.isConnected()) await this.waitForConnectionEstablished();
|
|
@@ -384,6 +386,17 @@ var SessionGatewayClient = class {
|
|
|
384
386
|
});
|
|
385
387
|
}
|
|
386
388
|
/**
|
|
389
|
+
* Request replay of events with a per-session seq above the cursor.
|
|
390
|
+
*/
|
|
391
|
+
async replaySinceSeq(sinceSeq) {
|
|
392
|
+
if (!this.connectionEstablishedForSocket || !this.isConnected()) await this.waitForConnectionEstablished();
|
|
393
|
+
if (!this.connectionEstablishedForSocket || !this.isConnected()) throw new Error("Connection closed before replay could be requested");
|
|
394
|
+
this.send({
|
|
395
|
+
type: "replay",
|
|
396
|
+
sinceSeq
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
387
400
|
* Send terminal input via WebSocket.
|
|
388
401
|
*/
|
|
389
402
|
sendTerminalInput(terminalId, input) {
|
|
@@ -650,6 +663,15 @@ var SessionGatewayClient = class {
|
|
|
650
663
|
this.isReplaying = false;
|
|
651
664
|
this.handlers.onReplayComplete?.(message.total);
|
|
652
665
|
break;
|
|
666
|
+
case "replay.truncated":
|
|
667
|
+
this.handlers.onReplayTruncated?.(message.data);
|
|
668
|
+
break;
|
|
669
|
+
case "stream.gap":
|
|
670
|
+
this.handlers.onStreamGap?.(message.data);
|
|
671
|
+
break;
|
|
672
|
+
case "stream.dead":
|
|
673
|
+
this.handlers.onStreamDead?.(message.data);
|
|
674
|
+
break;
|
|
653
675
|
case "error":
|
|
654
676
|
this.handlers.onError?.(message.message, message.code);
|
|
655
677
|
break;
|
|
@@ -669,9 +691,9 @@ var SessionGatewayClient = class {
|
|
|
669
691
|
invokeClientCallback("message dispatch", () => this.dispatchMessage(message), this.handlers.onError);
|
|
670
692
|
invokeClientCallback("onMessage", () => this.handlers.onMessage?.(message), this.handlers.onError);
|
|
671
693
|
}
|
|
672
|
-
trackExecutionContext(
|
|
673
|
-
if (typeof
|
|
674
|
-
const eventData =
|
|
694
|
+
trackExecutionContext(raw) {
|
|
695
|
+
if (typeof raw !== "object" || raw === null) return;
|
|
696
|
+
const eventData = raw;
|
|
675
697
|
if (eventData.executionId) {
|
|
676
698
|
this.currentExecutionId = eventData.executionId;
|
|
677
699
|
this.saveReplayState();
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-CHpXtqlI.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-C6kn-3zt.js";
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-4F9CNqdR.js";
|
|
3
3
|
//#region src/tangle/abi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tangle Contract ABI Definitions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -130,8 +130,9 @@
|
|
|
130
130
|
"vitest": "^4.1.5",
|
|
131
131
|
"ws": "^8.20.0",
|
|
132
132
|
"yjs": "13.6.30",
|
|
133
|
-
"@tangle-network/cli-agent-registry": "0.3.10",
|
|
134
133
|
"@repo/shared": "0.0.0",
|
|
134
|
+
"@tangle-network/cli-agent-registry": "0.3.10",
|
|
135
|
+
"@tangle-network/sse-core": "0.0.0",
|
|
135
136
|
"@tangle-network/runtime-contracts": "0.6.1"
|
|
136
137
|
},
|
|
137
138
|
"scripts": {
|