@tangle-network/sandbox 0.60.61 → 0.60.74
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 +4 -4
- package/dist/agent/index.js +4 -4
- package/dist/agent/preview.d.ts +1 -1
- package/dist/{agent-run-outcome-jmKaXys4.d.ts → agent-run-outcome-eZF8RuUN.d.ts} +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/backend-types-D6bYbvMB.js +42 -0
- package/dist/{browser-interactive-control-controller-JUW3gOGH.d.ts → browser-interactive-control-controller-rpTbyvAS.d.ts} +1 -1
- package/dist/{chunked-upload-BklCn3Li.js → chunked-upload-CDrLMO8N.js} +1 -1
- package/dist/{chunked-upload-file-Cp-iWsWN.js → chunked-upload-file-BwbqHWUX.js} +1 -1
- package/dist/cli-auth-bundle-cSJjPeFF.js +1543 -0
- package/dist/{client-4G99U4L2.d.ts → client-BujziOIc.d.ts} +10 -6
- package/dist/{client-BuWj2tMd.js → client-C7Y6waVg.js} +29 -10
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-B2g1j2ey.js → collaboration-CTbq2OYh.js} +1 -1
- package/dist/core.d.ts +7 -7
- package/dist/core.js +3 -3
- package/dist/{errors-CBy-dqOv.d.ts → errors-Bj5DL2ge.d.ts} +61 -2
- package/dist/{errors-iWIsey1D.js → errors-C8YcR1BL.js} +31 -1
- package/dist/{index-ClxFpHIl.d.ts → index-CP9a77KP.d.ts} +2 -2
- package/dist/index.d.ts +14 -15
- package/dist/index.js +9 -9
- package/dist/intelligence/index.js +1 -1
- package/dist/interactive-control.d.ts +1 -1
- package/dist/{interactive-controller-DaYmUCO_.js → interactive-controller-BFbCkMq4.js} +213 -21
- package/dist/{lines-Bm8NULkl.d.ts → lines-_rRdwxof.d.ts} +10 -2
- package/dist/lines.d.ts +2 -2
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-CZjO7FeG.js → local-cli-auth-CBV7Vjk5.js} +1 -1
- package/dist/{managed-process-Ddx8dULu.d.ts → managed-process-CPHeQONO.d.ts} +1 -1
- package/dist/{preview-DqKY0kxQ.d.ts → preview-n41aOXde.d.ts} +3 -3
- package/dist/runtime.d.ts +5 -6
- package/dist/runtime.js +3 -3
- package/dist/{sandbox-C6BLOrcg.js → sandbox-DGoQMthD.js} +678 -69
- package/dist/{sandbox-CIK4LMS-.d.ts → sandbox-DfSqEr3f.d.ts} +70 -17
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CvB_QTGV.js → tangle-vyeLQFFg.js} +2 -2
- package/dist/{terminal-stream-CV1pMSKC.d.ts → terminal-stream-jdYomM1m.d.ts} +123 -4
- package/dist/{types-CS_FytQM.d.ts → types-Mi83KD0D.d.ts} +194 -21
- package/package.json +5 -5
- package/dist/backend-types-C7b_Gpa0.js +0 -59
- package/dist/cli-auth-bundle-BWNakb5F.js +0 -1007
- package/dist/interactive-controller-DNbLzamS.d.ts +0 -40
- /package/dist/{index-BgmgfYZZ.d.ts → index-DO7GVpk_.d.ts} +0 -0
- /package/dist/{index-DHuHjNie.d.ts → index-DZ27pdB8.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { i as parseBackendType, r as backendTypeSchema, t as ALL_BACKEND_TYPES } from "./backend-types-
|
|
2
|
-
import { A as
|
|
3
|
-
import { _ as
|
|
4
|
-
import { _ as parseBackendRegistryResponse, a as InstanceRestartingError, c as SandboxFleetClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as HostedInstance, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, o as InstancesClient, p as backendRegistryEntrySchema, r as RunsClient, s as SandboxFleet, t as IntelligenceClient, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-
|
|
1
|
+
import { i as parseBackendType, r as backendTypeSchema, t as ALL_BACKEND_TYPES } from "./backend-types-D6bYbvMB.js";
|
|
2
|
+
import { A as normalizeRuntimeBackendConfig, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, T as parseSSEStream, a as terminalUpgradeHeadersSupported, i as TerminalStreamError, j as requestedPublicProfileDigest, n as InteractiveSessionController, o as TERMINAL_WS_ECHO_SUBPROTOCOL, r as TerminalStream, t as BrowserInteractiveSessionController } from "./interactive-controller-BFbCkMq4.js";
|
|
3
|
+
import { _ as StreamInterruptedError, a as EgressProxyRecoveryError, d as PartialFailureError, f as QuotaError, g as StateError, h as ServerError, i as EdgeNotReadyError, l as NetworkError, m as SandboxError, n as BranchFanoutExceedsHostError, o as FileWriteConflictError, p as ResumeEnvRequiredError, r as CapabilityError, s as KeyBudgetExhaustedError, t as AuthError, u as NotFoundError, v as TimeoutError, y as ValidationError } from "./errors-C8YcR1BL.js";
|
|
4
|
+
import { _ as parseBackendRegistryResponse, a as InstanceRestartingError, c as SandboxFleetClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as HostedInstance, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, o as InstancesClient, p as backendRegistryEntrySchema, r as RunsClient, s as SandboxFleet, t as IntelligenceClient, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-C7Y6waVg.js";
|
|
5
5
|
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-BJf0P_J4.js";
|
|
6
|
-
import {
|
|
6
|
+
import { C as ManagedProcessClient, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as toOtelJson, M as buildTraceExportPayload, N as exportTraceBundle, P as otelTraceIdForTangleTrace, S as isToolBearingEvent, T as splitInlineProfileFileMounts, _ as SandboxOperationFailedError, b as collectAgentResponseText, c as MAX_EGRESS_DENIALS_LIMIT, d as InteractiveSessionHandle, f as agentInteractiveSessionPromptRequestDigest, g as SandboxOperation, h as createInteractiveTerminalSession, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as WorkspaceImages, p as InteractiveTerminalFrameLog, s as GPU_LEASE_PROVIDER_NAMES, t as SandboxInstance, u as SandboxSession, v as applySandboxEventText, w as materializeProfileFileMounts, x as getSandboxEventText, y as collectAgentFinalMessageText } from "./sandbox-DGoQMthD.js";
|
|
7
7
|
import { LinesClient, SandboxLines, lineInstanceKey, profileChannelReference } from "./lines.js";
|
|
8
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-
|
|
8
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CTbq2OYh.js";
|
|
9
9
|
import { i as parseLineApplicationResult, n as LINE_APPLICATION_REQUEST_MAX_BYTES, r as parseLineApplicationRequest, t as LINE_APPLICATION_REPLY_MAX_CHARS } from "./line-application-Cq6dJLBD.js";
|
|
10
|
-
import { s as TangleSandboxClient } from "./tangle-
|
|
11
|
-
import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
|
|
10
|
+
import { s as TangleSandboxClient } from "./tangle-vyeLQFFg.js";
|
|
12
11
|
import { z } from "zod";
|
|
12
|
+
import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
|
|
13
13
|
//#region src/confidential.ts
|
|
14
14
|
function generateAttestationNonce(bytes = 32) {
|
|
15
15
|
const buffer = new Uint8Array(bytes);
|
|
@@ -1482,4 +1482,4 @@ function stripUndefined(value) {
|
|
|
1482
1482
|
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0).map(([k, v]) => [k, stripUndefined(v)]));
|
|
1483
1483
|
}
|
|
1484
1484
|
//#endregion
|
|
1485
|
-
export { ALL_BACKEND_TYPES, AuthError, BrowserInteractiveSessionControlController, BrowserInteractiveSessionController, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, CollaborationClient, CollaborationFileBridge, DEFAULT_SANDBOX_SIZE, EdgeNotReadyError, EgressProxyRecoveryError, FileWriteConflictError, GPU_LEASE_PROVIDER_NAMES, HostedInstance, INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, Image, ImageBuilder, InstanceRestartingError, InstancesClient, IntelligenceClient, InteractiveSessionControlController, InteractiveSessionController, InteractiveSessionHandle, InteractiveSessionNotRunningError, InteractiveTerminalFrameLog, KeyBudgetExhaustedError, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, MAX_EGRESS_DENIALS_LIMIT, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, QuotaError, ResumeEnvRequiredError, RunsClient, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, Sandbox, SandboxError, SandboxFleet, SandboxFleetClient, SandboxInstance, SandboxLines, SandboxSession, SandboxTaskSession, ServerError, StateError, StreamInterruptedError, TERMINAL_WS_ECHO_SUBPROTOCOL, TangleSandboxClient, TerminalStream, TerminalStreamError, TimeoutError, ValidationError, WorkspaceImages, applySandboxEventText, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, browserInteractiveControlHolderId, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentFinalMessageText, collectAgentResponseText, createAgentRunOutcomeTracker, createBatchResultAccumulator, createConfidentialSandbox, createInteractiveControlHolderId, createInteractiveTerminalCapture, createInteractiveTerminalSession, createManageSandboxesTool, deriveAgentResultOutcome, deriveAgentRunOutcome, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, agentInteractiveSessionPromptRequestDigest as interactivePromptRequestDigest, interactiveSessionIdentityDigest, isBackendRegistryInteractionKind, isToolBearingEvent, lineInstanceKey, manageSandboxesInputSchema, materializeProfileFileMounts, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseBackendType, parseCollaborationDocumentId, parseLineApplicationRequest, parseLineApplicationResult, parseSSEStream, profileChannelReference, projectAgentTerminalRecord, requestedPublicProfileDigest, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, splitInlineProfileFileMounts, splitInlineProfileSkills, startTeeAttestationHeartbeat, toOtelJson, validateBatchRunRequest, validateDeferredProfileFileMounts };
|
|
1485
|
+
export { ALL_BACKEND_TYPES, AuthError, BranchFanoutExceedsHostError, BrowserInteractiveSessionControlController, BrowserInteractiveSessionController, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, CollaborationClient, CollaborationFileBridge, DEFAULT_SANDBOX_SIZE, EdgeNotReadyError, EgressProxyRecoveryError, FileWriteConflictError, GPU_LEASE_PROVIDER_NAMES, HostedInstance, INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, Image, ImageBuilder, InstanceRestartingError, InstancesClient, IntelligenceClient, InteractiveSessionControlController, InteractiveSessionController, InteractiveSessionHandle, InteractiveSessionNotRunningError, InteractiveTerminalFrameLog, KeyBudgetExhaustedError, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, MAX_EGRESS_DENIALS_LIMIT, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, QuotaError, ResumeEnvRequiredError, RunsClient, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, Sandbox, SandboxError, SandboxFleet, SandboxFleetClient, SandboxInstance, SandboxLines, SandboxOperation, SandboxOperationFailedError, SandboxSession, SandboxTaskSession, ServerError, StateError, StreamInterruptedError, TERMINAL_WS_ECHO_SUBPROTOCOL, TangleSandboxClient, TerminalStream, TerminalStreamError, TimeoutError, ValidationError, WorkspaceImages, applySandboxEventText, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, browserInteractiveControlHolderId, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentFinalMessageText, collectAgentResponseText, createAgentRunOutcomeTracker, createBatchResultAccumulator, createConfidentialSandbox, createInteractiveControlHolderId, createInteractiveTerminalCapture, createInteractiveTerminalSession, createManageSandboxesTool, deriveAgentResultOutcome, deriveAgentRunOutcome, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, agentInteractiveSessionPromptRequestDigest as interactivePromptRequestDigest, interactiveSessionIdentityDigest, isBackendRegistryInteractionKind, isToolBearingEvent, lineInstanceKey, manageSandboxesInputSchema, materializeProfileFileMounts, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseBackendType, parseCollaborationDocumentId, parseLineApplicationRequest, parseLineApplicationResult, parseSSEStream, profileChannelReference, projectAgentTerminalRecord, requestedPublicProfileDigest, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, splitInlineProfileFileMounts, splitInlineProfileSkills, startTeeAttestationHeartbeat, terminalUpgradeHeadersSupported, toOtelJson, validateBatchRunRequest, validateDeferredProfileFileMounts };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as parseErrorResponse, l as NetworkError, v as TimeoutError } from "../errors-C8YcR1BL.js";
|
|
2
2
|
//#region src/intelligence/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-
|
|
1
|
+
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-rpTbyvAS.js";
|
|
2
2
|
export { BrowserInteractiveSessionControlController, type BrowserInteractiveSessionControlControllerOptions, type InteractiveSessionIdentity, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as backendTypeSchema } from "./backend-types-
|
|
2
|
-
import {
|
|
1
|
+
import { r as backendTypeSchema } from "./backend-types-D6bYbvMB.js";
|
|
2
|
+
import { h as ServerError, l as NetworkError, m as SandboxError, r as CapabilityError, x as parseResponseError, y as ValidationError } from "./errors-C8YcR1BL.js";
|
|
3
3
|
import { c as assertInteractiveSessionRef, d as awaitWithAbort, f as combineAbortSignals, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint } from "./browser-interactive-control-controller-BJf0P_J4.js";
|
|
4
|
-
import { s as uploadChunked } from "./chunked-upload-
|
|
5
|
-
import { AgentExactRunControlRefSchema, AgentExecutionOutcomeSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionRefSchema, AgentRuntimeAttachmentsSchema, DurablePlanSchema, InteractionRequestSchema, agentInteractiveSessionControlClaimMatchesRef, agentProfileSchema, canonicalCandidateDigest } from "@tangle-network/agent-interface";
|
|
4
|
+
import { s as uploadChunked } from "./chunked-upload-CDrLMO8N.js";
|
|
6
5
|
import { z } from "zod";
|
|
6
|
+
import { AgentExactRunControlRefSchema, AgentExecutionOutcomeSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionRefSchema, AgentRuntimeAttachmentsSchema, DurablePlanSchema, InteractionRequestSchema, agentInteractiveSessionControlClaimMatchesRef, agentProfileSchema, canonicalCandidateDigest } from "@tangle-network/agent-interface";
|
|
7
7
|
//#region src/agent-run-outcome-inspection.ts
|
|
8
8
|
const HUB_APPROVAL_REQUIRED = "HUB_APPROVAL_REQUIRED";
|
|
9
9
|
const MAX_SERIALIZED_TOOL_VALUE_BYTES = 4 * 1024 * 1024;
|
|
@@ -1718,6 +1718,21 @@ const TERMINAL_WS_EDGE_BEARER_SUBPROTOCOL_PREFIX = "bearer.";
|
|
|
1718
1718
|
const TERMINAL_WS_SIDECAR_BEARER_SUBPROTOCOL_PREFIX = "tangle.bearer.";
|
|
1719
1719
|
/** Non-credential protocol selected during a successful terminal handshake. */
|
|
1720
1720
|
const TERMINAL_WS_ECHO_SUBPROTOCOL = "tangle.terminal.v1";
|
|
1721
|
+
/**
|
|
1722
|
+
* Encode the upgrade URL's query (no leading `?`): the size of a
|
|
1723
|
+
* default-shell attach with its flag, and the trace id. Nothing else rides the
|
|
1724
|
+
* URL.
|
|
1725
|
+
*/
|
|
1726
|
+
function encodeTerminalUpgradeQuery(input) {
|
|
1727
|
+
const params = new URLSearchParams();
|
|
1728
|
+
if (input.defaultShell !== void 0) {
|
|
1729
|
+
params.set("cols", String(input.defaultShell.cols));
|
|
1730
|
+
params.set("rows", String(input.defaultShell.rows));
|
|
1731
|
+
params.set("defaultShell", "1");
|
|
1732
|
+
}
|
|
1733
|
+
if (input.traceId !== void 0) params.set("traceId", input.traceId);
|
|
1734
|
+
return params.toString();
|
|
1735
|
+
}
|
|
1721
1736
|
const terminalGeometry = {
|
|
1722
1737
|
cols: z.number().int().min(1).max(TERMINAL_WS_MAX_DIMENSION),
|
|
1723
1738
|
rows: z.number().int().min(1).max(TERMINAL_WS_MAX_DIMENSION)
|
|
@@ -1733,7 +1748,12 @@ const terminalInitMessageSchema = z.object({
|
|
|
1733
1748
|
env: z.record(z.string(), z.string()).optional(),
|
|
1734
1749
|
sessionId: z.string().min(1).optional(),
|
|
1735
1750
|
/** Canonical control claim for an interactive-agent PTY. */
|
|
1736
|
-
control: AgentInteractiveSessionControlClaimSchema.optional()
|
|
1751
|
+
control: AgentInteractiveSessionControlClaimSchema.optional(),
|
|
1752
|
+
/**
|
|
1753
|
+
* Caller trace id for a browser, which cannot set `x-tangle-trace-id` on
|
|
1754
|
+
* the upgrade. The server adopts it only when it is a well-formed id.
|
|
1755
|
+
*/
|
|
1756
|
+
traceId: z.string().max(200).optional()
|
|
1737
1757
|
}).superRefine((message, refinement) => {
|
|
1738
1758
|
if (message.incarnationId !== void 0 && message.control === void 0) refinement.addIssue({
|
|
1739
1759
|
code: "custom",
|
|
@@ -1763,6 +1783,39 @@ z.union([
|
|
|
1763
1783
|
terminalRenewMessageSchema,
|
|
1764
1784
|
terminalCloseMessageSchema
|
|
1765
1785
|
]);
|
|
1786
|
+
/**
|
|
1787
|
+
* Server stamps for one attach, in epoch milliseconds on the sidecar's clock.
|
|
1788
|
+
* They are absolute so a caller can lay them against its own marks and read
|
|
1789
|
+
* each leg (client clock skew is the only error). `spawn*` and `initPersistAt`
|
|
1790
|
+
* are absent when the attach adopted a PTY that already existed.
|
|
1791
|
+
*/
|
|
1792
|
+
const terminalReadyTimingsSchema = z.object({
|
|
1793
|
+
/** The upgrade request reached the sidecar's upgrade handler. */
|
|
1794
|
+
upgradeAt: z.number(),
|
|
1795
|
+
/** The bearer was verified (`ws.auth` ends). */
|
|
1796
|
+
authAt: z.number(),
|
|
1797
|
+
/** The init parameters were in hand: at the upgrade for `via: "upgrade"`, on the init frame otherwise. */
|
|
1798
|
+
initAt: z.number(),
|
|
1799
|
+
/** `loadOrCreateConnection` started. */
|
|
1800
|
+
loadAt: z.number(),
|
|
1801
|
+
/** The PTY process was spawned (`pty.spawn` ends). */
|
|
1802
|
+
spawnAt: z.number().optional(),
|
|
1803
|
+
/** The `session.init` event was persisted (`session.init.persist` ends). */
|
|
1804
|
+
initPersistAt: z.number().optional(),
|
|
1805
|
+
/** `loadOrCreateConnection` returned. */
|
|
1806
|
+
loadedAt: z.number(),
|
|
1807
|
+
/** The retained history was read (`history.read` ends). */
|
|
1808
|
+
historyAt: z.number(),
|
|
1809
|
+
/** Retained events and bytes the replay will carry. */
|
|
1810
|
+
historyEvents: z.number().int().nonnegative(),
|
|
1811
|
+
historyBytes: z.number().int().nonnegative(),
|
|
1812
|
+
/** The `ready` frame was sent. */
|
|
1813
|
+
readyAt: z.number(),
|
|
1814
|
+
/** How the init parameters reached the server. */
|
|
1815
|
+
via: z.enum(["upgrade", "frame"]),
|
|
1816
|
+
/** Correlation id of this attach (`terminal_attach` spans share it). */
|
|
1817
|
+
ptid: z.string().optional()
|
|
1818
|
+
});
|
|
1766
1819
|
const terminalReadyMessageSchema = z.object({
|
|
1767
1820
|
type: z.literal("ready"),
|
|
1768
1821
|
connectionId: z.string(),
|
|
@@ -1775,7 +1828,9 @@ const terminalReadyMessageSchema = z.object({
|
|
|
1775
1828
|
cursors: z.object({
|
|
1776
1829
|
earliest: z.number().int().nonnegative(),
|
|
1777
1830
|
latest: z.number().int().nonnegative()
|
|
1778
|
-
}).optional()
|
|
1831
|
+
}).optional(),
|
|
1832
|
+
/** Server stamps for this attach; absent from a sidecar that predates them. */
|
|
1833
|
+
timings: terminalReadyTimingsSchema.optional()
|
|
1779
1834
|
});
|
|
1780
1835
|
/** One sequenced output frame for an exact interactive terminal. */
|
|
1781
1836
|
const terminalOutputMessageSchema = z.object({
|
|
@@ -1835,6 +1890,14 @@ const terminalServerMessageSchema = z.union([
|
|
|
1835
1890
|
* capture consumer; not part of the client surface
|
|
1836
1891
|
* server → client (BINARY): raw PTY output bytes
|
|
1837
1892
|
*
|
|
1893
|
+
* A default-shell attach (no `command`, `cwd`, `env` or interactive identity)
|
|
1894
|
+
* also puts `cols`, `rows` and `defaultShell=1` on the upgrade URL. A server
|
|
1895
|
+
* that reads them starts the PTY when it accepts the upgrade and sends `ready`
|
|
1896
|
+
* without waiting for `init`; the `init` frame is still sent, first, and that
|
|
1897
|
+
* server ignores it. A server that does not read them waits for `init` exactly
|
|
1898
|
+
* as before. `command` and `cwd` travel only in the `init` frame, inside the
|
|
1899
|
+
* WebSocket: the URL and the request headers reach access logs.
|
|
1900
|
+
*
|
|
1838
1901
|
* Detach/reconnect: the server keeps the PTY alive for `detachTimeoutMs`
|
|
1839
1902
|
* (5 minutes today) after the socket closes; re-dialing with the SAME
|
|
1840
1903
|
* connectionId reattaches and replays the buffered output history, so a
|
|
@@ -1848,10 +1911,18 @@ const terminalServerMessageSchema = z.union([
|
|
|
1848
1911
|
var TerminalStreamError = class extends Error {
|
|
1849
1912
|
/** Protocol error code (e.g. `INIT_FAILED`) or `TRANSPORT` for socket faults. */
|
|
1850
1913
|
code;
|
|
1851
|
-
|
|
1914
|
+
/**
|
|
1915
|
+
* True when the socket never reached OPEN: the upgrade was refused (a
|
|
1916
|
+
* WebSocket client cannot read the HTTP status, so a 401 and a network drop
|
|
1917
|
+
* look alike) or the runtime rejected the dial's options. No PTY work had
|
|
1918
|
+
* started on the client's side of that dial.
|
|
1919
|
+
*/
|
|
1920
|
+
beforeOpen;
|
|
1921
|
+
constructor(message, code, options = {}) {
|
|
1852
1922
|
super(message);
|
|
1853
1923
|
this.name = "TerminalStreamError";
|
|
1854
1924
|
this.code = code;
|
|
1925
|
+
this.beforeOpen = options.beforeOpen === true;
|
|
1855
1926
|
}
|
|
1856
1927
|
};
|
|
1857
1928
|
/**
|
|
@@ -1900,6 +1971,77 @@ async function resolveTerminalToken(token, signal) {
|
|
|
1900
1971
|
if (typeof value !== "string" || !value.trim()) throw new TerminalStreamError(typeof token === "function" ? "Terminal stream token provider returned an empty token" : "Terminal stream token must not be empty", "INVALID_TOKEN");
|
|
1901
1972
|
return value;
|
|
1902
1973
|
}
|
|
1974
|
+
function isApiKeyToken(token) {
|
|
1975
|
+
return typeof token === "object" && token !== null && "apiKey" in token && typeof token.apiKey === "string";
|
|
1976
|
+
}
|
|
1977
|
+
async function resolveDialCredential(token, authFormat, signal) {
|
|
1978
|
+
if (!isApiKeyToken(token)) return {
|
|
1979
|
+
kind: "subprotocol",
|
|
1980
|
+
token: await resolveTerminalToken(token, signal)
|
|
1981
|
+
};
|
|
1982
|
+
if (!token.apiKey.trim()) throw new TerminalStreamError("Terminal stream API key must not be empty", "INVALID_TOKEN");
|
|
1983
|
+
if (authFormat === "sidecar-direct") throw new TerminalStreamError("An API key authenticates the public API proxy, not a direct sidecar dial", "INVALID_TOKEN");
|
|
1984
|
+
if (!terminalUpgradeHeadersSupported()) throw new TerminalStreamError("This runtime cannot set headers on a WebSocket upgrade; dial with a scoped token", "ENVIRONMENT", { beforeOpen: true });
|
|
1985
|
+
return {
|
|
1986
|
+
kind: "apiKey",
|
|
1987
|
+
apiKey: token.apiKey
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Whether this runtime's global `WebSocket` accepts request headers on the
|
|
1992
|
+
* upgrade (Node >= 22 through undici, and Bun): the condition for dialing with
|
|
1993
|
+
* the API key and for sending `x-tangle-trace-id` as a header. Browsers and
|
|
1994
|
+
* Workers cannot. A runtime that is judged able but ignores the headers is
|
|
1995
|
+
* still safe: the upgrade is refused, and the caller dials with a scoped token.
|
|
1996
|
+
*/
|
|
1997
|
+
function terminalUpgradeHeadersSupported() {
|
|
1998
|
+
const runtime = globalThis;
|
|
1999
|
+
if (typeof runtime.process?.versions?.node !== "string") return false;
|
|
2000
|
+
if (runtime.navigator?.userAgent?.startsWith("Cloudflare-Workers")) return false;
|
|
2001
|
+
return typeof globalThis.WebSocket === "function";
|
|
2002
|
+
}
|
|
2003
|
+
function buildUpgradeRequest(options, credential, identity, traceId) {
|
|
2004
|
+
const canSetHeaders = terminalUpgradeHeadersSupported();
|
|
2005
|
+
const initOnUpgrade = identity === void 0 && options.env === void 0 && options.command === void 0 && options.cwd === void 0;
|
|
2006
|
+
const query = encodeTerminalUpgradeQuery({
|
|
2007
|
+
...initOnUpgrade ? { defaultShell: {
|
|
2008
|
+
cols: options.cols ?? DEFAULT_COLS,
|
|
2009
|
+
rows: options.rows ?? DEFAULT_ROWS
|
|
2010
|
+
} } : {},
|
|
2011
|
+
traceId
|
|
2012
|
+
});
|
|
2013
|
+
const url = new URL(toWebSocketUrl(options.url));
|
|
2014
|
+
for (const [key, value] of new URLSearchParams(query)) url.searchParams.set(key, value);
|
|
2015
|
+
return {
|
|
2016
|
+
url: url.toString(),
|
|
2017
|
+
protocols: credential.kind === "apiKey" ? [TERMINAL_WS_ECHO_SUBPROTOCOL] : buildAuthSubprotocols(options.authFormat ?? "edge", credential.token),
|
|
2018
|
+
headers: {
|
|
2019
|
+
...canSetHeaders ? { [TRACE_ID_HEADER]: traceId } : {},
|
|
2020
|
+
...credential.kind === "apiKey" ? { Authorization: `Bearer ${credential.apiKey}` } : {}
|
|
2021
|
+
},
|
|
2022
|
+
initOnUpgrade
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
function openWebSocket(request, credential) {
|
|
2026
|
+
const WebSocketCtor = globalThis.WebSocket;
|
|
2027
|
+
if (typeof WebSocketCtor !== "function") throw new TerminalStreamError("global WebSocket is unavailable in this environment (Node >= 22 or a browser is required)", "ENVIRONMENT");
|
|
2028
|
+
if (Object.keys(request.headers).length === 0) return new WebSocketCtor(request.url, request.protocols);
|
|
2029
|
+
const WebSocketWithHeaders = WebSocketCtor;
|
|
2030
|
+
try {
|
|
2031
|
+
return new WebSocketWithHeaders(request.url, {
|
|
2032
|
+
protocols: request.protocols,
|
|
2033
|
+
headers: request.headers
|
|
2034
|
+
});
|
|
2035
|
+
} catch (cause) {
|
|
2036
|
+
if (credential.kind === "apiKey") throw new TerminalStreamError(`This runtime rejected WebSocket upgrade headers: ${cause instanceof Error ? cause.message : String(cause)}`, "ENVIRONMENT", { beforeOpen: true });
|
|
2037
|
+
return new WebSocketCtor(request.url, request.protocols);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
function resolveStreamTraceId(requested) {
|
|
2041
|
+
if (requested === void 0) return mintTraceId();
|
|
2042
|
+
if (!isTraceId(requested)) throw new TerminalStreamError("Terminal stream traceId must be 8-200 characters of letters, digits, '_' or '-'", "INVALID_TRACE_ID");
|
|
2043
|
+
return requested;
|
|
2044
|
+
}
|
|
1903
2045
|
function terminalAbortReason(signal) {
|
|
1904
2046
|
return signal.reason instanceof Error ? signal.reason : new DOMException("Terminal attach was aborted", "AbortError");
|
|
1905
2047
|
}
|
|
@@ -1977,7 +2119,7 @@ function interactiveInitFields(identity) {
|
|
|
1977
2119
|
control: identity.control
|
|
1978
2120
|
};
|
|
1979
2121
|
}
|
|
1980
|
-
function buildTerminalInitMessage(options, identity) {
|
|
2122
|
+
function buildTerminalInitMessage(options, identity, traceId) {
|
|
1981
2123
|
if (typeof options.connectionId !== "string" || !options.connectionId.trim()) throw new TerminalStreamError("Terminal stream connectionId must not be empty", "INVALID_CONNECTION_ID");
|
|
1982
2124
|
if (options.cols !== void 0) assertDimension("cols", options.cols);
|
|
1983
2125
|
if (options.rows !== void 0) assertDimension("rows", options.rows);
|
|
@@ -1989,7 +2131,8 @@ function buildTerminalInitMessage(options, identity) {
|
|
|
1989
2131
|
...options.command !== void 0 ? { command: options.command } : {},
|
|
1990
2132
|
...options.cwd !== void 0 ? { cwd: options.cwd } : {},
|
|
1991
2133
|
...options.env !== void 0 ? { env: options.env } : {},
|
|
1992
|
-
...interactiveInitFields(identity)
|
|
2134
|
+
...interactiveInitFields(identity),
|
|
2135
|
+
...terminalUpgradeHeadersSupported() ? {} : { traceId }
|
|
1993
2136
|
});
|
|
1994
2137
|
if (!parsed.success) throw new TerminalStreamError("Terminal stream init does not match the shared terminal protocol", "INVALID_INIT");
|
|
1995
2138
|
return parsed.data;
|
|
@@ -2031,6 +2174,14 @@ var TerminalStream = class TerminalStream {
|
|
|
2031
2174
|
interactiveIdentity;
|
|
2032
2175
|
initMessage;
|
|
2033
2176
|
handlers;
|
|
2177
|
+
attachTraceId;
|
|
2178
|
+
initOnUpgrade;
|
|
2179
|
+
dialStartedAt = performance.now();
|
|
2180
|
+
openedAt;
|
|
2181
|
+
readyAt;
|
|
2182
|
+
firstByteAt;
|
|
2183
|
+
firstWriteAt;
|
|
2184
|
+
echoRttMs;
|
|
2034
2185
|
readyInfo = null;
|
|
2035
2186
|
closed = false;
|
|
2036
2187
|
closeWaiters = [];
|
|
@@ -2047,19 +2198,18 @@ var TerminalStream = class TerminalStream {
|
|
|
2047
2198
|
static async connect(options) {
|
|
2048
2199
|
const interactiveIdentity = normalizeInteractiveSessionIdentity(options.incarnationId, options.control);
|
|
2049
2200
|
options.signal?.throwIfAborted();
|
|
2050
|
-
const
|
|
2051
|
-
const
|
|
2201
|
+
const traceId = resolveStreamTraceId(options.traceId);
|
|
2202
|
+
const initMessage = buildTerminalInitMessage(options, interactiveIdentity, traceId);
|
|
2203
|
+
const credential = await awaitTerminalOperation(resolveDialCredential(options.token, options.authFormat ?? "edge", options.signal), options.signal);
|
|
2052
2204
|
options.signal?.throwIfAborted();
|
|
2053
|
-
return new TerminalStream(options,
|
|
2205
|
+
return new TerminalStream(options, credential, interactiveIdentity, initMessage, traceId).establish(options.signal);
|
|
2054
2206
|
}
|
|
2055
|
-
constructor(options,
|
|
2207
|
+
constructor(options, credential, interactiveIdentity, initMessage, traceId) {
|
|
2056
2208
|
const exactOptions = interactiveIdentity === void 0 ? options : {
|
|
2057
2209
|
...options,
|
|
2058
2210
|
incarnationId: interactiveIdentity.incarnationId,
|
|
2059
2211
|
control: interactiveIdentity.control
|
|
2060
2212
|
};
|
|
2061
|
-
const WebSocketCtor = globalThis.WebSocket;
|
|
2062
|
-
if (typeof WebSocketCtor !== "function") throw new TerminalStreamError("global WebSocket is unavailable in this environment (Node >= 22 or a browser is required)", "ENVIRONMENT");
|
|
2063
2213
|
this.options = {
|
|
2064
2214
|
...exactOptions,
|
|
2065
2215
|
signal: void 0
|
|
@@ -2067,12 +2217,16 @@ var TerminalStream = class TerminalStream {
|
|
|
2067
2217
|
this.interactiveIdentity = interactiveIdentity;
|
|
2068
2218
|
this.initMessage = initMessage;
|
|
2069
2219
|
this.handlers = exactOptions.handlers ?? {};
|
|
2070
|
-
this.
|
|
2220
|
+
this.attachTraceId = traceId;
|
|
2221
|
+
const request = buildUpgradeRequest(exactOptions, credential, interactiveIdentity, traceId);
|
|
2222
|
+
this.initOnUpgrade = request.initOnUpgrade;
|
|
2223
|
+
this.ws = openWebSocket(request, credential);
|
|
2071
2224
|
this.ws.binaryType = "arraybuffer";
|
|
2072
2225
|
}
|
|
2073
2226
|
establish(signal) {
|
|
2074
2227
|
return new Promise((resolve, reject) => {
|
|
2075
2228
|
let settled = false;
|
|
2229
|
+
let opened = false;
|
|
2076
2230
|
const timeoutMs = this.options.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
|
|
2077
2231
|
const timer = setTimeout(() => {
|
|
2078
2232
|
fail(new TerminalStreamError(`Terminal attach timed out after ${timeoutMs}ms waiting for ready`, "CONNECT_TIMEOUT"));
|
|
@@ -2105,6 +2259,8 @@ var TerminalStream = class TerminalStream {
|
|
|
2105
2259
|
return;
|
|
2106
2260
|
}
|
|
2107
2261
|
this.ws.addEventListener("open", () => {
|
|
2262
|
+
opened = true;
|
|
2263
|
+
this.openedAt = performance.now();
|
|
2108
2264
|
if (settled) return;
|
|
2109
2265
|
try {
|
|
2110
2266
|
assertInteractiveControlActive(this.interactiveIdentity);
|
|
@@ -2122,11 +2278,11 @@ var TerminalStream = class TerminalStream {
|
|
|
2122
2278
|
});
|
|
2123
2279
|
});
|
|
2124
2280
|
this.ws.addEventListener("error", () => {
|
|
2125
|
-
fail(new TerminalStreamError("Terminal WebSocket transport failed before ready", "TRANSPORT"));
|
|
2281
|
+
fail(new TerminalStreamError("Terminal WebSocket transport failed before ready", "TRANSPORT", { beforeOpen: !opened }));
|
|
2126
2282
|
});
|
|
2127
2283
|
this.ws.addEventListener("close", (event) => {
|
|
2128
2284
|
this.closed = true;
|
|
2129
|
-
fail(new TerminalStreamError(`Terminal WebSocket closed before ready (code ${event.code}${event.reason ? `: ${event.reason}` : ""})`, "CLOSED_BEFORE_READY"));
|
|
2285
|
+
fail(new TerminalStreamError(`Terminal WebSocket closed before ready (code ${event.code}${event.reason ? `: ${event.reason}` : ""})`, "CLOSED_BEFORE_READY", { beforeOpen: !opened }));
|
|
2130
2286
|
for (const waiter of this.closeWaiters) waiter();
|
|
2131
2287
|
this.closeWaiters = [];
|
|
2132
2288
|
this.handlers.onClose?.(event.code, event.reason);
|
|
@@ -2135,7 +2291,10 @@ var TerminalStream = class TerminalStream {
|
|
|
2135
2291
|
}
|
|
2136
2292
|
handleMessage(raw, connectPhase) {
|
|
2137
2293
|
if (typeof raw !== "string") {
|
|
2138
|
-
if (raw instanceof ArrayBuffer)
|
|
2294
|
+
if (raw instanceof ArrayBuffer) {
|
|
2295
|
+
this.noteOutput();
|
|
2296
|
+
this.handlers.onData?.(new Uint8Array(raw));
|
|
2297
|
+
}
|
|
2139
2298
|
return;
|
|
2140
2299
|
}
|
|
2141
2300
|
const failProtocolFrame = () => {
|
|
@@ -2172,9 +2331,11 @@ var TerminalStream = class TerminalStream {
|
|
|
2172
2331
|
restored: parsed.data.restored,
|
|
2173
2332
|
detachTimeoutMs: parsed.data.detachTimeoutMs,
|
|
2174
2333
|
...parsed.data.attachCount === void 0 ? {} : { attachCount: parsed.data.attachCount },
|
|
2175
|
-
...parsed.data.cursors === void 0 ? {} : { cursors: parsed.data.cursors }
|
|
2334
|
+
...parsed.data.cursors === void 0 ? {} : { cursors: parsed.data.cursors },
|
|
2335
|
+
...parsed.data.timings === void 0 ? {} : { timings: parsed.data.timings }
|
|
2176
2336
|
};
|
|
2177
2337
|
this.readyInfo = info;
|
|
2338
|
+
this.readyAt ??= performance.now();
|
|
2178
2339
|
connectPhase.succeed();
|
|
2179
2340
|
this.handlers.onReady?.(info);
|
|
2180
2341
|
return;
|
|
@@ -2182,6 +2343,7 @@ var TerminalStream = class TerminalStream {
|
|
|
2182
2343
|
case "output":
|
|
2183
2344
|
try {
|
|
2184
2345
|
const bytes = decodeBase64(parsed.data.data);
|
|
2346
|
+
this.noteOutput();
|
|
2185
2347
|
this.handlers.onOutput?.(parsed.data.seq, bytes);
|
|
2186
2348
|
if (this.handlers.onOutput === void 0) this.handlers.onData?.(bytes);
|
|
2187
2349
|
} catch (error) {
|
|
@@ -2218,6 +2380,34 @@ var TerminalStream = class TerminalStream {
|
|
|
2218
2380
|
if (!this.readyInfo) throw new TerminalStreamError("Terminal stream is not ready yet", "NOT_READY");
|
|
2219
2381
|
return this.readyInfo;
|
|
2220
2382
|
}
|
|
2383
|
+
/** Correlation id of this attach (`x-tangle-trace-id` / `traceId`). */
|
|
2384
|
+
get traceId() {
|
|
2385
|
+
return this.attachTraceId;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Timings of this attach. `firstByteMs` and `echoRttMs` appear once the
|
|
2389
|
+
* stream has produced the output they measure.
|
|
2390
|
+
*/
|
|
2391
|
+
get timings() {
|
|
2392
|
+
const opened = this.openedAt ?? this.dialStartedAt;
|
|
2393
|
+
const ready = this.readyAt ?? opened;
|
|
2394
|
+
return {
|
|
2395
|
+
...this.options.mintMs === void 0 ? {} : { mintMs: this.options.mintMs },
|
|
2396
|
+
wsOpenMs: opened - this.dialStartedAt,
|
|
2397
|
+
initToReadyMs: ready - opened,
|
|
2398
|
+
...this.firstByteAt === void 0 ? {} : { firstByteMs: this.firstByteAt - ready },
|
|
2399
|
+
...this.echoRttMs === void 0 ? {} : { echoRttMs: this.echoRttMs },
|
|
2400
|
+
init: this.initOnUpgrade ? "upgrade" : "frame",
|
|
2401
|
+
...this.readyInfo?.timings === void 0 ? {} : { server: this.readyInfo.timings }
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
/** Stamp the first output byte after `ready`, and the first one after the first write. */
|
|
2405
|
+
noteOutput() {
|
|
2406
|
+
if (this.readyAt === void 0) return;
|
|
2407
|
+
const now = performance.now();
|
|
2408
|
+
this.firstByteAt ??= now;
|
|
2409
|
+
if (this.firstWriteAt !== void 0 && this.echoRttMs === void 0) this.echoRttMs = now - this.firstWriteAt;
|
|
2410
|
+
}
|
|
2221
2411
|
/** True while the socket is open. */
|
|
2222
2412
|
get isOpen() {
|
|
2223
2413
|
return !this.closed && this.ws.readyState === WebSocket.OPEN;
|
|
@@ -2232,6 +2422,7 @@ var TerminalStream = class TerminalStream {
|
|
|
2232
2422
|
this.assertOpen("write");
|
|
2233
2423
|
assertInteractiveControlActive(this.interactiveIdentity);
|
|
2234
2424
|
const text = typeof data === "string" ? data : this.textDecoder.decode(data);
|
|
2425
|
+
if (this.readyAt !== void 0) this.firstWriteAt ??= performance.now();
|
|
2235
2426
|
for (const chunk of chunkInput(text)) this.ws.send(JSON.stringify({
|
|
2236
2427
|
type: "input",
|
|
2237
2428
|
data: chunk
|
|
@@ -2292,6 +2483,7 @@ var TerminalStream = class TerminalStream {
|
|
|
2292
2483
|
control: binding.control
|
|
2293
2484
|
},
|
|
2294
2485
|
token: overrides?.token ?? this.options.token,
|
|
2486
|
+
mintMs: void 0,
|
|
2295
2487
|
handlers: this.handlersForReconnect(overrides?.handlers),
|
|
2296
2488
|
cols: overrides?.cols ?? this.options.cols,
|
|
2297
2489
|
rows: overrides?.rows ?? this.options.rows,
|
|
@@ -2457,4 +2649,4 @@ var BrowserInteractiveSessionController = class extends InteractiveSessionContro
|
|
|
2457
2649
|
}
|
|
2458
2650
|
};
|
|
2459
2651
|
//#endregion
|
|
2460
|
-
export {
|
|
2652
|
+
export { normalizeRuntimeBackendConfig as A, encodePromptForWire as C, assertCurrentBackendType as D, applyRequestedModel as E, createAgentRunOutcomeTracker as F, deriveAgentResultOutcome as I, deriveAgentRunOutcome as L, requestedSecretProfilePublicDigest as M, withProfileHarness as N, foldModelRoutingFields as O, withoutRuntimeSecrets as P, projectAgentTerminalRecord as R, validateAcceptedDispatchRunRef as S, parseSSEStream as T, mintTraceId as _, terminalUpgradeHeadersSupported as a, sessionHeaders as b, requestInteractiveSessionToken as c, isRetryableCredentialRefusal as d, normalizeSessionInfo as f, isTraceId as g, TRACE_ID_HEADER as h, TerminalStreamError as i, requestedPublicProfileDigest as j, mergeRuntimeBackendConfig as k, requestScopedToken as l, waitForRetryAfter as m, InteractiveSessionController as n, TERMINAL_WS_ECHO_SUBPROTOCOL as o, sessionMessageRequestBody as p, TerminalStream as r, assertScopedTokenActive as s, BrowserInteractiveSessionController as t, SandboxRuntimeApi as u, resolveTraceId as v, encodeTextForWire as w, resolveDispatchRunIdentity as x, appendSessionIdQuery as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as CreateSandboxOptions, d as BackendConfig } from "./types-
|
|
1
|
+
import { B as CreateSandboxOptions, d as BackendConfig } from "./types-Mi83KD0D.js";
|
|
2
2
|
|
|
3
3
|
//#region src/line-application.d.ts
|
|
4
4
|
/** Bounded callback request bytes after canonicalization, including JSON framing. */
|
|
@@ -381,9 +381,16 @@ type LineFromConnectionInput = LineFromConnectionCommon & ({
|
|
|
381
381
|
phoneNumberId?: never;
|
|
382
382
|
});
|
|
383
383
|
/** Fields a member update may change. */
|
|
384
|
+
/** An asset URL safe to share with the recipient and provider. Hub never fetches it.
|
|
385
|
+
* Meta WhatsApp API-key lines send it with `text` as the caption. Other transports refuse it.
|
|
386
|
+
* Use public HTTPS without a query, fragment or credentials. */
|
|
387
|
+
interface LineImage {
|
|
388
|
+
url: string;
|
|
389
|
+
}
|
|
384
390
|
interface LineSendInput {
|
|
385
391
|
memberId: string;
|
|
386
392
|
text: string;
|
|
393
|
+
image?: LineImage;
|
|
387
394
|
idempotencyKey: string;
|
|
388
395
|
/** Optional ISO instant less than seven days away. Workflows own schedules. */
|
|
389
396
|
notBefore?: string;
|
|
@@ -555,6 +562,7 @@ interface LineMessage {
|
|
|
555
562
|
/** The sandbox turn receipt, when an inbound row reached a turn. */
|
|
556
563
|
turnId: string | null;
|
|
557
564
|
text: string | null;
|
|
565
|
+
image?: LineImage;
|
|
558
566
|
status: string;
|
|
559
567
|
errorCode: string | null;
|
|
560
568
|
/** Latency marks in milliseconds after the message arrived. */
|
|
@@ -677,4 +685,4 @@ declare class SandboxLines {
|
|
|
677
685
|
detach(number: string): Promise<void>;
|
|
678
686
|
}
|
|
679
687
|
//#endregion
|
|
680
|
-
export {
|
|
688
|
+
export { LineSendReceipt as A, lineInstanceKey as B, LineReplyCode as C, LineRespondView as D, LineRespondAgent as E, LineVoice as F, LineApplicationRequest as G, LINE_APPLICATION_REPLY_MAX_CHARS as H, LineVoiceOptions as I, LineApplicationView as J, LineApplicationResult as K, LinesClient as L, LineSenderVerificationStart as M, LineThread as N, LineRole as O, LineTransport as P, LinesHttpClient as R, LineReminderPreferences as S, LineReplyGate as T, LINE_APPLICATION_REQUEST_MAX_BYTES as U, profileChannelReference as V, LineApplication as W, parseLineApplicationResult as X, parseLineApplicationRequest as Y, LineMemberPatch as _, LineApplicationAttachOptions as a, LineNumberInventory as b, LineAttachmentReauthorization as c, LineImage as d, LineInstanceAttachOptions as f, LineMemberInstance as g, LineMember as h, LineAllowanceSubject as i, LineSenderVerification as j, LineSendInput as k, LineExecutionKey as l, LineLimits as m, LineAgentRolePolicy as n, LineAttachOptions as o, LineInstanceCreate as p, LineApplicationState as q, LineAllowance as r, LineAttachment as s, Line as t, LineFromConnectionInput as u, LineMemberSpec as v, LineReplyCodeInput as w, LineProvider as x, LineMessage as y, SandboxLines as z };
|
package/dist/lines.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineApplicationAttachOptions, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
|
|
1
|
+
import { A as LineSendReceipt, B as lineInstanceKey, C as LineReplyCode, D as LineRespondView, E as LineRespondAgent, F as LineVoice, I as LineVoiceOptions, L as LinesClient, M as LineSenderVerificationStart, N as LineThread, O as LineRole, P as LineTransport, R as LinesHttpClient, S as LineReminderPreferences, T as LineReplyGate, V as profileChannelReference, _ as LineMemberPatch, a as LineApplicationAttachOptions, b as LineNumberInventory, c as LineAttachmentReauthorization, d as LineImage, f as LineInstanceAttachOptions, g as LineMemberInstance, h as LineMember, i as LineAllowanceSubject, j as LineSenderVerification, k as LineSendInput, l as LineExecutionKey, m as LineLimits, n as LineAgentRolePolicy, o as LineAttachOptions, p as LineInstanceCreate, r as LineAllowance, s as LineAttachment, t as Line, u as LineFromConnectionInput, v as LineMemberSpec, w as LineReplyCodeInput, x as LineProvider, y as LineMessage, z as SandboxLines } from "./lines-_rRdwxof.js";
|
|
2
|
+
export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineApplicationAttachOptions, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineImage, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
|
package/dist/lines.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-
|
|
1
|
+
import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-cSJjPeFF.js";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { homedir } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { An as
|
|
1
|
+
import { An as ManagedProcessOptions, Mn as ManagedProcessResumeOptions, Nn as ManagedProcessSpec, jn as ManagedProcessRecord, kn as ManagedProcessJobs } from "./types-Mi83KD0D.js";
|
|
2
2
|
|
|
3
3
|
//#region src/managed-process.d.ts
|
|
4
4
|
declare class ManagedProcessClient implements ManagedProcessJobs {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as Sandbox } from "./client-
|
|
1
|
+
import { n as SandboxInstance } from "./sandbox-DfSqEr3f.js";
|
|
2
|
+
import { Hn as PreviewLinkInfo, ht as EnsureDevServerOptions } from "./types-Mi83KD0D.js";
|
|
3
|
+
import { i as Sandbox } from "./client-BujziOIc.js";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/preview-operations.d.ts
|
|
6
6
|
type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-jmKaXys4.js";
|
|
1
|
+
import { $i as SessionExecutionStatus, A as CommitTaskSessionOptions, At as FileUsageOptions, Da as TaskSessionInfo, Di as SandboxRuntimeHealth, Fi as SandboxTerminalManager, H as CreateTaskSessionOptions, Ii as SandboxTerminalRequestOptions, Ji as SendSessionMessageRequest, Mt as FileWriteResult, Ni as SandboxTerminalCreateOptions, Ot as FileTreeOptions, Pi as SandboxTerminalInfo, Pr as SandboxEvent, Qi as SessionExecutionInfo, St as FileReadBatchResult, T as ChunkedUploadResult, Ta as TaskSessionCommitResult, Tt as FileRenameResult, V as CreateSessionOptions, Wa as WriteFileOptions, Yi as SentSessionMessage, Zi as SessionEventStreamOptions, aa as SessionMessage, bi as SandboxPortBinding, hr as RenameOptions, jt as FileUsageResult, kt as FileTreeResult, na as SessionInfo, oa as SessionMessageAdmission, qi as SendSessionMessageOptions, w as ChunkedUploadOptions, wa as TaskSessionChanges, wn as ListMessagesOptions, xt as FileReadBatchOptions, za as UploadProgress } from "./types-Mi83KD0D.js";
|
|
2
|
+
import { n as TerminalStream, p as ScopedToken } from "./terminal-stream-jdYomM1m.js";
|
|
3
|
+
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-rpTbyvAS.js";
|
|
4
|
+
import { S as BrowserInteractiveSessionController, _ as StateError, b as TimeoutError, c as NetworkError, d as QuotaError, g as ServerError, h as SandboxFailureDetail, l as NotFoundError, m as SandboxErrorJson, o as FileWriteConflictError, p as SandboxError, r as CapabilityError, t as AuthError, u as PartialFailureError, x as ValidationError } from "./errors-Bj5DL2ge.js";
|
|
5
|
+
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-eZF8RuUN.js";
|
|
7
6
|
|
|
8
7
|
//#region src/lib/chunked-upload.d.ts
|
|
9
8
|
/** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
|
package/dist/runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F as
|
|
2
|
-
import {
|
|
1
|
+
import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, t as BrowserInteractiveSessionController, u as SandboxRuntimeApi } from "./interactive-controller-BFbCkMq4.js";
|
|
2
|
+
import { d as PartialFailureError, f as QuotaError, g as StateError, h as ServerError, l as NetworkError, m as SandboxError, o as FileWriteConflictError, r as CapabilityError, t as AuthError, u as NotFoundError, v as TimeoutError, y as ValidationError } from "./errors-C8YcR1BL.js";
|
|
3
3
|
import { f as combineAbortSignals, n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BJf0P_J4.js";
|
|
4
|
-
import { s as uploadChunked } from "./chunked-upload-
|
|
4
|
+
import { s as uploadChunked } from "./chunked-upload-CDrLMO8N.js";
|
|
5
5
|
//#region src/runtime-client.ts
|
|
6
6
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
7
7
|
function requireToken(token) {
|