@tangle-network/sandbox 0.55.2 → 0.57.0
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/README.md +25 -2
- package/dist/agent/index.d.ts +59 -19
- package/dist/agent/index.js +26 -306
- package/dist/agent/preview.d.ts +2 -0
- package/dist/agent/preview.js +74 -0
- package/dist/{agent-run-outcome-CWo6e5lW.d.ts → agent-run-outcome-B8PjRMLE.d.ts} +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/{browser-interactive-control-controller-Dv0gbFMu.js → browser-interactive-control-controller-CVGqjPgs.js} +1 -1
- package/dist/{browser-interactive-control-controller-BELrFH4f.d.ts → browser-interactive-control-controller-knjCl8Zp.d.ts} +1 -1
- package/dist/{client-B-LZQQ51.d.ts → client-BHGieo06.d.ts} +10 -4
- package/dist/{client-Bd8nskJA.js → client-CdbHGWiu.js} +23 -10
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-DLPFc9-W.js → collaboration-CSHswAOI.js} +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/core.js +3 -3
- package/dist/{index-ATSSTK2A.d.ts → index-C1sVorE5.d.ts} +2 -2
- package/dist/index.d.ts +11 -11
- package/dist/index.js +7 -7
- package/dist/intelligence/index.js +1 -1
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{local-cli-auth-BAJuMBZU.js → local-cli-auth-DfuFJCcs.js} +1 -1
- package/dist/mcp-local-DUT2U_y8.js +429 -0
- package/dist/preview-operations-Dgbi46FH.js +212 -0
- package/dist/preview-wJJxG42-.d.ts +72 -0
- package/dist/{runtime-api-DoZsOiOR.js → runtime-api-BZg34WGd.js} +10 -5
- package/dist/runtime.d.ts +6 -4
- package/dist/runtime.js +3 -3
- package/dist/{sandbox-DzSE1u7d.js → sandbox-C9VLoJAb.js} +107 -8
- package/dist/{sandbox-C7KqjY6Y.d.ts → sandbox-DWDqWnsJ.d.ts} +139 -10
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CmpR_07-.js → tangle-Bm6H-xIM.js} +2 -2
- package/dist/{types-UOIM3RS6.d.ts → types-CFmeauzy.d.ts} +12 -2
- package/package.json +9 -4
- /package/dist/{abort-signal-si1WMfJb.js → abort-signal-CgFhjY_v.js} +0 -0
- /package/dist/{cli-auth-bundle-DUsK57rK.js → cli-auth-bundle-bRJOyaJO.js} +0 -0
- /package/dist/{errors-CmYPVl-k.js → errors-BkhlSDW-.js} +0 -0
- /package/dist/{errors-Cz23YNu2.d.ts → errors-CNsmhCen.d.ts} +0 -0
- /package/dist/{index-BWiG3Vcw.d.ts → index-BN7zNEUB.d.ts} +0 -0
- /package/dist/{index-BfVsF6yU.d.ts → index-X4EEZlMi.d.ts} +0 -0
- /package/dist/{terminal-stream-CcaBTVg3.d.ts → terminal-stream-BW4veIsI.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { r as SandboxInstance } from "./sandbox-DWDqWnsJ.js";
|
|
2
|
+
import { Pn as PreviewLinkInfo, mt as EnsureDevServerOptions } from "./types-CFmeauzy.js";
|
|
3
|
+
import { i as Sandbox } from "./client-BHGieo06.js";
|
|
4
|
+
|
|
5
|
+
//#region src/agent/preview-operations.d.ts
|
|
6
|
+
type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {
|
|
7
|
+
/** Human-readable service label. Does not change routing or authorization. */name?: string;
|
|
8
|
+
};
|
|
9
|
+
interface PublishAgentPreviewOptions {
|
|
10
|
+
/** Existing HTTP service. Publishing never starts or replaces it. */
|
|
11
|
+
port: number;
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PreviewAuthorizationRequest {
|
|
15
|
+
operation: "start" | "publish" | "list" | "get" | "remove";
|
|
16
|
+
phase: "before" | "publish" | "after";
|
|
17
|
+
sessionId?: string;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
port?: number;
|
|
20
|
+
previewId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Host-supplied authority, never accepted from model/tool input. Throw to deny.
|
|
23
|
+
* Invoked again after slow startup and before returning data. */
|
|
24
|
+
type PreviewAuthorizer = (request: PreviewAuthorizationRequest) => Promise<void>;
|
|
25
|
+
interface PreviewExecutionContext {
|
|
26
|
+
authorize?: PreviewAuthorizer;
|
|
27
|
+
/** Trusted cancellation signal from the host or incoming request. */
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
declare function assertPreviewId(id: string): void;
|
|
31
|
+
/** A failed preview never becomes a fabricated URL or an account-wide lookup. */
|
|
32
|
+
declare class AgentPreviewError extends Error {
|
|
33
|
+
readonly code: "PREVIEW_INVALID_INPUT" | "PREVIEW_INVALID_RESPONSE" | "PREVIEW_NOT_READY" | "SANDBOX_SELF_REFUSED" | "SANDBOX_SELF_INVALID_RESPONSE";
|
|
34
|
+
readonly status?: number | undefined;
|
|
35
|
+
constructor(code: "PREVIEW_INVALID_INPUT" | "PREVIEW_INVALID_RESPONSE" | "PREVIEW_NOT_READY" | "SANDBOX_SELF_REFUSED" | "SANDBOX_SELF_INVALID_RESPONSE", message: string, status?: number | undefined);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve only the sandbox bound to this credential. No list/name lookup, env
|
|
39
|
+
* id, owner fallback, or key delegation is allowed on this path. An ordinary
|
|
40
|
+
* owner client should select a sandbox explicitly instead.
|
|
41
|
+
*/
|
|
42
|
+
declare function resolveSelfSandbox(client: Pick<Sandbox, "fetch" | "get">): Promise<SandboxInstance>;
|
|
43
|
+
/**
|
|
44
|
+
* Start/reuse the selected workspace's managed server and publish its preview.
|
|
45
|
+
* This is an explicit publishing operation, not a background post-turn hook.
|
|
46
|
+
* The returned URL has passed the existing routing readiness check; that is
|
|
47
|
+
* not proof of application correctness or per-recipient access control.
|
|
48
|
+
*/
|
|
49
|
+
declare function ensureAgentPreview(box: Pick<SandboxInstance, "process" | "previewLinks">, options?: AgentPreviewOptions, context?: PreviewExecutionContext): Promise<PreviewLinkInfo>;
|
|
50
|
+
/** Publish an already-running service, including multiple services in one repo. */
|
|
51
|
+
declare function publishAgentPreview(box: Pick<SandboxInstance, "previewLinks">, options: PublishAgentPreviewOptions, context?: PreviewExecutionContext): Promise<PreviewLinkInfo>;
|
|
52
|
+
/** Lists recorded publications, not every listening port. Never auto-publishes. */
|
|
53
|
+
declare function listAgentPreviews(box: Pick<SandboxInstance, "previewLinks">, context?: PreviewExecutionContext): Promise<PreviewLinkInfo[]>;
|
|
54
|
+
declare function getAgentPreview(box: Pick<SandboxInstance, "previewLinks">, previewId: string, context?: PreviewExecutionContext): Promise<PreviewLinkInfo>;
|
|
55
|
+
/** Unpublishes one service; does not stop it or affect other app URLs. */
|
|
56
|
+
declare function removeAgentPreview(box: Pick<SandboxInstance, "previewLinks">, previewId: string, context?: PreviewExecutionContext): Promise<void>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/agent/preview-mcp.d.ts
|
|
59
|
+
declare const PREVIEW_TOOLS: readonly ["sandbox_preview", "sandbox_preview_publish", "sandbox_preview_list", "sandbox_preview_get", "sandbox_preview_remove"];
|
|
60
|
+
/** Host-side bridge for native agents, custom apps and isolated computers.
|
|
61
|
+
* Authenticate the request before calling this function. The host keeps its
|
|
62
|
+
* Sandbox credential; the agent receives only the host's limited capability.
|
|
63
|
+
* Revalidation belongs in authorize, which also runs after slow startup.
|
|
64
|
+
*/
|
|
65
|
+
declare function servePreviewMcp(request: Request, config: {
|
|
66
|
+
box: SandboxInstance;
|
|
67
|
+
sessionId?: string;
|
|
68
|
+
authorize: PreviewAuthorizer;
|
|
69
|
+
tools?: readonly (typeof PREVIEW_TOOLS)[number][];
|
|
70
|
+
}): Promise<Response>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { PreviewAuthorizationRequest as a, PublishAgentPreviewOptions as c, getAgentPreview as d, listAgentPreviews as f, resolveSelfSandbox as h, AgentPreviewOptions as i, assertPreviewId as l, removeAgentPreview as m, servePreviewMcp as n, PreviewAuthorizer as o, publishAgentPreview as p, AgentPreviewError as r, PreviewExecutionContext as s, PREVIEW_TOOLS as t, ensureAgentPreview as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as parseErrorResponse, f as SandboxError, g as ValidationError, h as TimeoutError, n as CapabilityError, p as ServerError, s as NetworkError, u as QuotaError } from "./errors-
|
|
2
|
-
import { n as combineAbortSignals } from "./abort-signal-
|
|
1
|
+
import { _ as parseErrorResponse, f as SandboxError, g as ValidationError, h as TimeoutError, n as CapabilityError, p as ServerError, s as NetworkError, u as QuotaError } from "./errors-BkhlSDW-.js";
|
|
2
|
+
import { n as combineAbortSignals } from "./abort-signal-CgFhjY_v.js";
|
|
3
3
|
import { AgentExactRunControlRefSchema, AgentExecutionOutcomeSchema, AgentRuntimeAttachmentsSchema, DurablePlanSchema, InteractionRequestSchema, agentProfileSchema, canonicalCandidateDigest, harnessTypeSchema } from "@tangle-network/agent-interface";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region ../../../packages/runtime-contracts/dist/backend-types.js
|
|
@@ -1183,13 +1183,16 @@ var SandboxRuntimeApi = class {
|
|
|
1183
1183
|
await this.transport.ensureRunning();
|
|
1184
1184
|
return this.json("/health", { method: "GET" });
|
|
1185
1185
|
}
|
|
1186
|
-
async setRuntimeEnv(env) {
|
|
1186
|
+
async setRuntimeEnv(env, options = {}) {
|
|
1187
1187
|
const count = Object.keys(env).length;
|
|
1188
1188
|
if (count === 0) throw new ValidationError("No environment variables provided");
|
|
1189
1189
|
await this.transport.ensureRunning();
|
|
1190
|
-
if ((await this.json("/config/config/app-env", {
|
|
1190
|
+
if ((await this.json(options.ttlMs === void 0 ? "/config/config/app-env" : "/config/config/app-env/ttl", {
|
|
1191
1191
|
method: "POST",
|
|
1192
|
-
body: JSON.stringify({
|
|
1192
|
+
body: JSON.stringify({
|
|
1193
|
+
env,
|
|
1194
|
+
...options
|
|
1195
|
+
})
|
|
1193
1196
|
})).injected !== count) throw new NetworkError("Runtime did not acknowledge every environment variable");
|
|
1194
1197
|
}
|
|
1195
1198
|
async ports() {
|
|
@@ -1674,8 +1677,10 @@ function normalizeSessionInfo(raw) {
|
|
|
1674
1677
|
}
|
|
1675
1678
|
/** The admission check must hash the same wire request as dispatch. */
|
|
1676
1679
|
function sessionMessageRequestBody(request) {
|
|
1680
|
+
if (request.managedQuoteVersion !== void 0 && !/^mmq_[a-f0-9]{40}$/.test(request.managedQuoteVersion)) throw new ValidationError("managedQuoteVersion is invalid");
|
|
1677
1681
|
return {
|
|
1678
1682
|
...request.backend !== void 0 ? { backend: normalizeRuntimeBackendConfig(request.backend) } : {},
|
|
1683
|
+
...request.managedQuoteVersion !== void 0 ? { managedQuoteVersion: request.managedQuoteVersion } : {},
|
|
1679
1684
|
...request.runControlRef !== void 0 ? { runControlRef: AgentExactRunControlRefSchema.parse(request.runControlRef) } : {},
|
|
1680
1685
|
...request.messageId !== void 0 ? { messageID: request.messageId } : {},
|
|
1681
1686
|
parts: request.parts.map((part) => part.type === "text" ? {
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as CommitTaskSessionOptions, At as FileUsageResult, Bi as SessionExecutionInfo, Ci as SandboxTerminalManager, Dt as FileTreeOptions, Er as SandboxEvent, Fi as SendSessionMessageOptions, H as CreateTaskSessionOptions, Ii as SendSessionMessageRequest, Ji as SessionMessageAdmission, Li as SentSessionMessage, Ot as FileTreeResult, Si as SandboxTerminalInfo, Sn as ListMessagesOptions, T as ChunkedUploadResult, V as CreateSessionOptions, Vi as SessionExecutionStatus, Wi as SessionInfo, bt as FileReadBatchOptions, fa as TaskSessionInfo, hi as SandboxRuntimeHealth, jt as FileWriteResult, ka as WriteFileOptions, kt as FileUsageOptions, la as TaskSessionChanges, li as SandboxPortBinding, or as RenameOptions, qi as SessionMessage, ua as TaskSessionCommitResult, w as ChunkedUploadOptions, wa as UploadProgress, wi as SandboxTerminalRequestOptions, wt as FileRenameResult, xi as SandboxTerminalCreateOptions, xt as FileReadBatchResult, zi as SessionEventStreamOptions } from "./types-
|
|
2
|
-
import { _ as TimeoutError, a as FileWriteConflictError, c as NotFoundError, f as SandboxError, g as StateError, h as ServerError, l as PartialFailureError, m as SandboxFailureDetail, n as CapabilityError, p as SandboxErrorJson, s as NetworkError, t as AuthError, u as QuotaError, v as ValidationError } from "./errors-
|
|
3
|
-
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-
|
|
1
|
+
import { A as CommitTaskSessionOptions, At as FileUsageResult, Bi as SessionExecutionInfo, Ci as SandboxTerminalManager, Dt as FileTreeOptions, Er as SandboxEvent, Fi as SendSessionMessageOptions, H as CreateTaskSessionOptions, Ii as SendSessionMessageRequest, Ji as SessionMessageAdmission, Li as SentSessionMessage, Ot as FileTreeResult, Si as SandboxTerminalInfo, Sn as ListMessagesOptions, T as ChunkedUploadResult, V as CreateSessionOptions, Vi as SessionExecutionStatus, Wi as SessionInfo, bt as FileReadBatchOptions, fa as TaskSessionInfo, hi as SandboxRuntimeHealth, jt as FileWriteResult, ka as WriteFileOptions, kt as FileUsageOptions, la as TaskSessionChanges, li as SandboxPortBinding, or as RenameOptions, qi as SessionMessage, ua as TaskSessionCommitResult, w as ChunkedUploadOptions, wa as UploadProgress, wi as SandboxTerminalRequestOptions, wt as FileRenameResult, xi as SandboxTerminalCreateOptions, xt as FileReadBatchResult, zi as SessionEventStreamOptions } from "./types-CFmeauzy.js";
|
|
2
|
+
import { _ as TimeoutError, a as FileWriteConflictError, c as NotFoundError, f as SandboxError, g as StateError, h as ServerError, l as PartialFailureError, m as SandboxFailureDetail, n as CapabilityError, p as SandboxErrorJson, s as NetworkError, t as AuthError, u as QuotaError, v as ValidationError } from "./errors-CNsmhCen.js";
|
|
3
|
+
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-B8PjRMLE.js";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/chunked-upload.d.ts
|
|
6
6
|
/** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
|
|
@@ -39,7 +39,9 @@ declare class SandboxRuntimeApi {
|
|
|
39
39
|
readonly terminals: SandboxTerminalManager;
|
|
40
40
|
constructor(transport: RuntimeTransport);
|
|
41
41
|
health(): Promise<SandboxRuntimeHealth>;
|
|
42
|
-
setRuntimeEnv(env: Record<string, string
|
|
42
|
+
setRuntimeEnv(env: Record<string, string>, options?: {
|
|
43
|
+
ttlMs?: number;
|
|
44
|
+
}): Promise<void>;
|
|
43
45
|
ports(): Promise<SandboxPortBinding[]>;
|
|
44
46
|
/**
|
|
45
47
|
* Subscribe to a session's agent event stream (`/agents/events`).
|
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as deriveAgentRunOutcome, T as deriveAgentResultOutcome, f as uploadChunked, t as SandboxRuntimeApi, w as createAgentRunOutcomeTracker } from "./runtime-api-
|
|
2
|
-
import { a as FileWriteConflictError, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, l as PartialFailureError, m as StateError, n as CapabilityError, p as ServerError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-
|
|
3
|
-
import { n as combineAbortSignals } from "./abort-signal-
|
|
1
|
+
import { E as deriveAgentRunOutcome, T as deriveAgentResultOutcome, f as uploadChunked, t as SandboxRuntimeApi, w as createAgentRunOutcomeTracker } from "./runtime-api-BZg34WGd.js";
|
|
2
|
+
import { a as FileWriteConflictError, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, l as PartialFailureError, m as StateError, n as CapabilityError, p as ServerError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-BkhlSDW-.js";
|
|
3
|
+
import { n as combineAbortSignals } from "./abort-signal-CgFhjY_v.js";
|
|
4
4
|
//#region src/runtime-client.ts
|
|
5
5
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
6
6
|
function requireToken(token) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as normalizeRuntimeBackendConfig, S as mergeRuntimeBackendConfig, T as deriveAgentResultOutcome, _ as encodePromptForWire, a as waitForRetryAfter, b as applyRequestedModel, c as mintTraceId, d as sessionHeaders, f as uploadChunked, h as SANDBOX_PROXY_REQUEST_MAX_BYTES, i as sessionMessageRequestBody, l as resolveTraceId, m as validateAcceptedDispatchRunRef, n as isRetryableCredentialRefusal, o as TRACE_ID_HEADER, p as resolveDispatchRunIdentity, r as normalizeSessionInfo, s as isTraceId, t as SandboxRuntimeApi, u as appendSessionIdQuery, w as createAgentRunOutcomeTracker, x as assertCurrentBackendType, y as parseSSEStream } from "./runtime-api-
|
|
2
|
-
import { _ as parseErrorResponse, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, m as StateError, n as CapabilityError, p as ServerError, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-
|
|
3
|
-
import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionControlValidationResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, p as interactiveSessionStatusResponseSchema, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-
|
|
4
|
-
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-
|
|
1
|
+
import { C as normalizeRuntimeBackendConfig, S as mergeRuntimeBackendConfig, T as deriveAgentResultOutcome, _ as encodePromptForWire, a as waitForRetryAfter, b as applyRequestedModel, c as mintTraceId, d as sessionHeaders, f as uploadChunked, h as SANDBOX_PROXY_REQUEST_MAX_BYTES, i as sessionMessageRequestBody, l as resolveTraceId, m as validateAcceptedDispatchRunRef, n as isRetryableCredentialRefusal, o as TRACE_ID_HEADER, p as resolveDispatchRunIdentity, r as normalizeSessionInfo, s as isTraceId, t as SandboxRuntimeApi, u as appendSessionIdQuery, w as createAgentRunOutcomeTracker, x as assertCurrentBackendType, y as parseSSEStream } from "./runtime-api-BZg34WGd.js";
|
|
2
|
+
import { _ as parseErrorResponse, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, m as StateError, n as CapabilityError, p as ServerError, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-BkhlSDW-.js";
|
|
3
|
+
import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionControlValidationResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, p as interactiveSessionStatusResponseSchema, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-CVGqjPgs.js";
|
|
4
|
+
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-CgFhjY_v.js";
|
|
5
5
|
import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { AgentInteractiveSessionControlClaimSchema as AgentInteractiveSessionControlClaimSchema$1, AgentInteractiveSessionPromptAcknowledgementSchema as AgentInteractiveSessionPromptAcknowledgementSchema$1, AgentInteractiveSessionRefSchema as AgentInteractiveSessionRefSchema$1, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema as AgentInteractiveSessionStopAcknowledgementSchema$1 } from "@tangle-network/agent-interface/environment-interactive-control";
|
|
@@ -341,6 +341,15 @@ var LinesClient = class {
|
|
|
341
341
|
return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, { method: "DELETE" }))).detached;
|
|
342
342
|
}
|
|
343
343
|
/**
|
|
344
|
+
* Retire a detached line's Hub routing and free its workspace transport slot.
|
|
345
|
+
* Hub refuses an attached or voice-enabled line. A retry by line id returns
|
|
346
|
+
* false; the provider connection and message history remain.
|
|
347
|
+
*/
|
|
348
|
+
async release(number) {
|
|
349
|
+
const lineId = await this.resolve(number);
|
|
350
|
+
return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, { method: "DELETE" }))).released;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
344
353
|
* Take calls on a line (Inkbox iMessage lines). Hub points the identity's
|
|
345
354
|
* incoming calls at itself, binds the ph0ny agent to the line and adds the
|
|
346
355
|
* agent's `ask_workspace` tool. Enabling again replaces every credential.
|
|
@@ -358,6 +367,22 @@ var LinesClient = class {
|
|
|
358
367
|
async disableVoice(lineId) {
|
|
359
368
|
return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: { enabled: false } })))).line;
|
|
360
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Queue a proactive message to an active, consenting member. Hub reuses the
|
|
372
|
+
* member's authenticated provider conversation, rechecks STOP immediately
|
|
373
|
+
* before delivery, and defers delivery during the recipient's saved quiet hours.
|
|
374
|
+
*/
|
|
375
|
+
async send(lineId, input) {
|
|
376
|
+
return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/send`, json("POST", input)));
|
|
377
|
+
}
|
|
378
|
+
/** Read the native outbox receipt. Queued is not a delivery confirmation. */
|
|
379
|
+
async sentMessage(lineId, messageId) {
|
|
380
|
+
return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/outbox/${encodeURIComponent(messageId)}`));
|
|
381
|
+
}
|
|
382
|
+
/** Only the recipient's proven message can enable reminders or choose quiet hours. */
|
|
383
|
+
async reminders(lineId, memberId) {
|
|
384
|
+
return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/members/${encodeURIComponent(memberId)}/reminders`));
|
|
385
|
+
}
|
|
361
386
|
/** Members of the line's active attachment. */
|
|
362
387
|
members(lineId) {
|
|
363
388
|
const base = `/v1/lines/${encodeURIComponent(lineId)}/members`;
|
|
@@ -537,6 +562,7 @@ function parseSandboxRuntimeCapabilities(raw) {
|
|
|
537
562
|
const interactionsValue = record.interactions;
|
|
538
563
|
if (interactionsValue === null || typeof interactionsValue !== "object" || Array.isArray(interactionsValue)) invalidCapabilities("a malformed 'interactions' group");
|
|
539
564
|
const interactionsRecord = interactionsValue;
|
|
565
|
+
if ("exactBeforeToolApproval" in interactionsRecord && typeof interactionsRecord.exactBeforeToolApproval !== "boolean") invalidCapabilities("a non-boolean 'interactions.exactBeforeToolApproval' flag");
|
|
540
566
|
if ("responseDedupe" in interactionsRecord && typeof interactionsRecord.responseDedupe !== "boolean") invalidCapabilities("a non-boolean 'interactions.responseDedupe' flag");
|
|
541
567
|
const interactiveAgentValue = record.interactiveAgent;
|
|
542
568
|
let interactiveAgent;
|
|
@@ -563,7 +589,10 @@ function parseSandboxRuntimeCapabilities(raw) {
|
|
|
563
589
|
"idempotent"
|
|
564
590
|
]),
|
|
565
591
|
runs: readFlagGroup(record, "runs", ["executionScopedStatus", "eventReplay"]),
|
|
566
|
-
interactions:
|
|
592
|
+
interactions: {
|
|
593
|
+
...typeof interactionsRecord.responseDedupe === "boolean" ? { responseDedupe: interactionsRecord.responseDedupe } : {},
|
|
594
|
+
...typeof interactionsRecord.exactBeforeToolApproval === "boolean" ? { exactBeforeToolApproval: interactionsRecord.exactBeforeToolApproval } : {}
|
|
595
|
+
},
|
|
567
596
|
...interactiveAgent === void 0 ? {} : { interactiveAgent }
|
|
568
597
|
};
|
|
569
598
|
}
|
|
@@ -3206,6 +3235,14 @@ var SandboxSession = class SandboxSession {
|
|
|
3206
3235
|
async runs() {
|
|
3207
3236
|
return this.box._sessionRuns(this.id);
|
|
3208
3237
|
}
|
|
3238
|
+
/** Export the exact provider session before this sandbox is deleted. */
|
|
3239
|
+
async nativeRollout() {
|
|
3240
|
+
return this.box._sessionNativeRollout(this.id);
|
|
3241
|
+
}
|
|
3242
|
+
/** Capture the complete attributed native store and process stream before deletion. */
|
|
3243
|
+
async rawEvidence() {
|
|
3244
|
+
return this.box._sessionRawEvidence(this.id);
|
|
3245
|
+
}
|
|
3209
3246
|
/** Read the exact execution admitted for a turn, including server-owned plan follow-ups.
|
|
3210
3247
|
* This never admits work or verifies the input of a proposed retry.
|
|
3211
3248
|
*/
|
|
@@ -5444,8 +5481,8 @@ var SandboxInstance = class SandboxInstance {
|
|
|
5444
5481
|
* Older runtimes without app-variable registration fail this call.
|
|
5445
5482
|
* Credential values must stay outside profiles, receipts, and logs.
|
|
5446
5483
|
*/
|
|
5447
|
-
async setRuntimeEnv(env) {
|
|
5448
|
-
return this.runtime.setRuntimeEnv(env);
|
|
5484
|
+
async setRuntimeEnv(env, options = {}) {
|
|
5485
|
+
return this.runtime.setRuntimeEnv(env, options);
|
|
5449
5486
|
}
|
|
5450
5487
|
/**
|
|
5451
5488
|
* Return the runtime's current listening-port snapshot.
|
|
@@ -6851,7 +6888,12 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6851
6888
|
const body = await response.text();
|
|
6852
6889
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
6853
6890
|
}
|
|
6854
|
-
|
|
6891
|
+
const data = await response.json();
|
|
6892
|
+
if (response.status !== 200 && response.status !== 201) throw new Error("Preview creation returned an unexpected success status");
|
|
6893
|
+
return {
|
|
6894
|
+
...normalizePreviewLink(data.previewLink),
|
|
6895
|
+
created: response.status === 201
|
|
6896
|
+
};
|
|
6855
6897
|
}
|
|
6856
6898
|
async previewLinkList() {
|
|
6857
6899
|
const response = await this.runtimeFetch("/preview-links");
|
|
@@ -8388,6 +8430,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
8388
8430
|
text: message
|
|
8389
8431
|
}] : [...message],
|
|
8390
8432
|
turnId: opts.turnId,
|
|
8433
|
+
...opts.managedQuoteVersion !== void 0 ? { managedQuoteVersion: opts.managedQuoteVersion } : {},
|
|
8391
8434
|
...backend !== void 0 ? { backend } : {},
|
|
8392
8435
|
...opts.runControlRef !== void 0 ? { runControlRef: opts.runControlRef } : {}
|
|
8393
8436
|
};
|
|
@@ -8511,6 +8554,62 @@ var SandboxInstance = class SandboxInstance {
|
|
|
8511
8554
|
}
|
|
8512
8555
|
return normalizeSessionInfo(await response.json());
|
|
8513
8556
|
}
|
|
8557
|
+
/** @internal — invoked before the sandbox is deleted. */
|
|
8558
|
+
async _sessionNativeRollout(id) {
|
|
8559
|
+
await this.ensureRunning();
|
|
8560
|
+
const response = await this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/native-rollout`);
|
|
8561
|
+
if (!response.ok && response.status !== 404) throw parseErrorResponse(response.status, await response.text(), void 0, response.headers);
|
|
8562
|
+
const decoded = await response.json();
|
|
8563
|
+
if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded)) throw new ServerError("Malformed native rollout response");
|
|
8564
|
+
const raw = decoded;
|
|
8565
|
+
if (raw.status === "unavailable") {
|
|
8566
|
+
if (typeof raw.reason !== "string" || raw.reason.length === 0 || raw.sessionId !== id || typeof raw.backendType !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(raw.backendType) || raw.nativeSessionId !== void 0 && (typeof raw.nativeSessionId !== "string" || !/^ses_[A-Za-z0-9_-]{1,124}$/.test(raw.nativeSessionId))) throw new ServerError("Malformed native rollout unavailable response");
|
|
8567
|
+
return raw;
|
|
8568
|
+
}
|
|
8569
|
+
if (raw.status !== "captured" || raw.sessionId !== id || raw.backendType !== "opencode" || raw.format !== "opencode-session-export-json" || typeof raw.contentBase64 !== "string" || !Number.isSafeInteger(raw.sizeBytes) || Number(raw.sizeBytes) < 1 || Number(raw.sizeBytes) > 128 * 1024 * 1024 || typeof raw.sha256 !== "string" || !/^sha256:[a-f0-9]{64}$/.test(raw.sha256) || typeof raw.nativeSessionId !== "string" || !/^ses_[A-Za-z0-9_-]{1,124}$/.test(raw.nativeSessionId)) throw new ServerError("Malformed native rollout response");
|
|
8570
|
+
let binary;
|
|
8571
|
+
try {
|
|
8572
|
+
binary = atob(raw.contentBase64);
|
|
8573
|
+
} catch {
|
|
8574
|
+
throw new ServerError("Malformed native rollout base64 content");
|
|
8575
|
+
}
|
|
8576
|
+
const content = new Uint8Array(binary.length);
|
|
8577
|
+
for (let index = 0; index < binary.length; index += 1) content[index] = binary.charCodeAt(index);
|
|
8578
|
+
if (content.length !== raw.sizeBytes) throw new ServerError("Native rollout byte count mismatch");
|
|
8579
|
+
const subtle = globalThis.crypto?.subtle;
|
|
8580
|
+
if (!subtle) throw new ServerError("Native rollout verification requires Web Crypto");
|
|
8581
|
+
const digest = await subtle.digest("SHA-256", content);
|
|
8582
|
+
if (`sha256:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("")}` !== raw.sha256) throw new ServerError("Native rollout SHA-256 mismatch");
|
|
8583
|
+
let exported;
|
|
8584
|
+
try {
|
|
8585
|
+
exported = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(content));
|
|
8586
|
+
} catch {
|
|
8587
|
+
throw new ServerError("Malformed native rollout content");
|
|
8588
|
+
}
|
|
8589
|
+
const native = typeof exported === "object" && exported !== null && !Array.isArray(exported) ? exported : void 0;
|
|
8590
|
+
const info = native?.info;
|
|
8591
|
+
if (typeof info !== "object" || info === null || Array.isArray(info) || info.id !== raw.nativeSessionId || !Array.isArray(native?.messages)) throw new ServerError("Native rollout session ID mismatch");
|
|
8592
|
+
return {
|
|
8593
|
+
...raw,
|
|
8594
|
+
content
|
|
8595
|
+
};
|
|
8596
|
+
}
|
|
8597
|
+
/** @internal — invoked before the sandbox is deleted. */
|
|
8598
|
+
async _sessionRawEvidence(id) {
|
|
8599
|
+
await this.ensureRunning();
|
|
8600
|
+
const response = await this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence`);
|
|
8601
|
+
if (!response.ok && response.status !== 404) throw parseErrorResponse(response.status, await response.text(), void 0, response.headers);
|
|
8602
|
+
const raw = await response.json();
|
|
8603
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new ServerError("Malformed raw evidence response");
|
|
8604
|
+
const record = raw;
|
|
8605
|
+
if (record.status === "unavailable") {
|
|
8606
|
+
if (record.sessionId !== id || typeof record.backendType !== "string" || typeof record.reason !== "string" || record.reason.length === 0) throw new ServerError("Malformed raw evidence unavailable response");
|
|
8607
|
+
return record;
|
|
8608
|
+
}
|
|
8609
|
+
const completeness = record.completeness;
|
|
8610
|
+
if (record.status !== "captured" || record.sessionId !== id || typeof record.backendType !== "string" || typeof record.nativeSessionId !== "string" || typeof record.sidecarImageDigest !== "string" || !/^sha256:[a-f0-9]{64}$/.test(record.sidecarImageDigest) || typeof record.sidecarBundleRevision !== "string" || !/^[a-f0-9]{40}$/.test(record.sidecarBundleRevision) || !Array.isArray(record.nativeRoots) || !Array.isArray(record.files) || !Array.isArray(record.excluded) || !Array.isArray(record.processIo) || !Array.isArray(record.processTerminals) || !Array.isArray(record.events) || typeof record.inventory !== "object" || record.inventory === null || completeness?.nativeStore !== true || completeness.processIo !== true || completeness.events !== true || record.coverageComplete !== true) throw new ServerError("Malformed raw evidence response");
|
|
8611
|
+
return record;
|
|
8612
|
+
}
|
|
8514
8613
|
/** @internal — invoked by SandboxSession.runs(). */
|
|
8515
8614
|
async _sessionRuns(id) {
|
|
8516
8615
|
return this.runtime.runs(id);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-
|
|
2
|
-
import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, d as InteractiveAttachOptions, f as InteractiveControlClaimAcknowledgement, h as InteractiveSessionStatus, m as InteractiveRequestOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, p as InteractiveControlClaimOptions, s as InteractiveSessionControlTransport } from "./browser-interactive-control-controller-
|
|
3
|
-
import { A as CommitTaskSessionOptions, Aa as WriteManyFile, An as NetworkManager, B as CreateSandboxOptions, Bi as SessionExecutionInfo, C as BranchOptions, Cr as SandboxDeleteOptions, D as CodeExecutionResult, Da as WaitForRolloutOptions, E as CodeExecutionOptions, Ea as WaitForOptions, Ei as SandboxTraceBundle, Er as SandboxEvent, Fi as SendSessionMessageOptions, Fn as PreviewLinkManager, Gi as SessionInterruptOptions, Gn as PromptInputPart, H as CreateTaskSessionOptions, Ii as SendSessionMessageRequest, Ji as SessionMessageAdmission, Jn as ProvisionEvent, Ki as SessionListOptions, Kn as PromptOptions, Li as SentSessionMessage, M as ConversationTurnOptions, Mi as SearchOptions, N as ConversationTurnResult, Nn as PermissionsManager, O as CodeLanguage, Oa as WorkspaceOperationLookup, Q as DispatchedSession, Qi as SnapshotDeleteAcknowledgement, Sn as ListMessagesOptions, Sr as SandboxDeleteAcknowledgement, Ti as SandboxTerminals, Tt as FileSystem, Ui as SessionForkOptions, V as CreateSessionOptions, Vn as ProcessManager, Wi as SessionInfo, Xi as SessionResultOptions, Xt as ForkIdempotency, Yn as ProvisionResult, Yt as ForkCounts, Z as DispatchPromptOptions, Zr as SandboxFleetTraceBundle, Zt as ForkLookupOptions, _n as IntelligenceReportBudget, _r as SSHCredentials, _t as ExecOptions, aa as StartupDiagnostics, an as GpuLease, at as DurablePlan, bi as SandboxTerminalAttachOptions, bn as IntelligenceReportWindow, cr as ResumeOptions, d as BackendConfig, dr as RolloutOptions, en as GitBranch, fa as TaskSessionInfo, fi as SandboxResourceUsage, ft as EgressManager, ga as TeeAttestationResponse, gi as SandboxShape, gn as IntelligenceReport, gr as SSHCommandDescriptor, hi as SandboxRuntimeHealth, hn as InstalledTool, ht as EventStreamOptions, in as GitStatus, j as CompletedTurnResult, ja as WriteManyOptions, ji as SearchMatch, jt as FileWriteResult, ka as WriteFileOptions, ki as SandboxTraceOptions, la as TaskSessionChanges, li as SandboxPortBinding, lr as Rollout, ma as TeeAttestationOptions, mi as SandboxRuntimeCapabilities, na as SnapshotOptions, ot as DurablePlanDecisionResult, p as BackendManager, pr as RolloutStartResult, qi as SessionMessage, qn as PromptResult, ra as SnapshotResult, rn as GitDiff, rt as DriverInfo, si as SandboxInfo, sr as RestoreSnapshotOptions, ta as SnapshotInfo, tn as GitCommit, tt as DriveTurnOptions, ua as TaskSessionCommitResult, un as GpuLeaseManager, va as TeePublicKeyResponse, vn as IntelligenceReportCompareTo, vt as ExecResult, xa as TurnDriveResult, xn as JsonValue, xr as SandboxCreateReceipt, yi as SandboxStatus, yr as SandboxConnection, zi as SessionEventStreamOptions } from "./types-
|
|
1
|
+
import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-BW4veIsI.js";
|
|
2
|
+
import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, d as InteractiveAttachOptions, f as InteractiveControlClaimAcknowledgement, h as InteractiveSessionStatus, m as InteractiveRequestOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, p as InteractiveControlClaimOptions, s as InteractiveSessionControlTransport } from "./browser-interactive-control-controller-knjCl8Zp.js";
|
|
3
|
+
import { A as CommitTaskSessionOptions, Aa as WriteManyFile, An as NetworkManager, B as CreateSandboxOptions, Bi as SessionExecutionInfo, C as BranchOptions, Cr as SandboxDeleteOptions, D as CodeExecutionResult, Da as WaitForRolloutOptions, E as CodeExecutionOptions, Ea as WaitForOptions, Ei as SandboxTraceBundle, Er as SandboxEvent, Fi as SendSessionMessageOptions, Fn as PreviewLinkManager, Gi as SessionInterruptOptions, Gn as PromptInputPart, H as CreateTaskSessionOptions, Ii as SendSessionMessageRequest, Ji as SessionMessageAdmission, Jn as ProvisionEvent, Ki as SessionListOptions, Kn as PromptOptions, Li as SentSessionMessage, M as ConversationTurnOptions, Mi as SearchOptions, N as ConversationTurnResult, Nn as PermissionsManager, O as CodeLanguage, Oa as WorkspaceOperationLookup, Q as DispatchedSession, Qi as SnapshotDeleteAcknowledgement, Sn as ListMessagesOptions, Sr as SandboxDeleteAcknowledgement, Ti as SandboxTerminals, Tt as FileSystem, Ui as SessionForkOptions, V as CreateSessionOptions, Vn as ProcessManager, Wi as SessionInfo, Xi as SessionResultOptions, Xt as ForkIdempotency, Yn as ProvisionResult, Yt as ForkCounts, Z as DispatchPromptOptions, Zr as SandboxFleetTraceBundle, Zt as ForkLookupOptions, _n as IntelligenceReportBudget, _r as SSHCredentials, _t as ExecOptions, aa as StartupDiagnostics, an as GpuLease, at as DurablePlan, bi as SandboxTerminalAttachOptions, bn as IntelligenceReportWindow, cr as ResumeOptions, d as BackendConfig, dr as RolloutOptions, en as GitBranch, fa as TaskSessionInfo, fi as SandboxResourceUsage, ft as EgressManager, ga as TeeAttestationResponse, gi as SandboxShape, gn as IntelligenceReport, gr as SSHCommandDescriptor, hi as SandboxRuntimeHealth, hn as InstalledTool, ht as EventStreamOptions, in as GitStatus, j as CompletedTurnResult, ja as WriteManyOptions, ji as SearchMatch, jt as FileWriteResult, ka as WriteFileOptions, ki as SandboxTraceOptions, la as TaskSessionChanges, li as SandboxPortBinding, lr as Rollout, ma as TeeAttestationOptions, mi as SandboxRuntimeCapabilities, na as SnapshotOptions, ot as DurablePlanDecisionResult, p as BackendManager, pr as RolloutStartResult, qi as SessionMessage, qn as PromptResult, ra as SnapshotResult, rn as GitDiff, rt as DriverInfo, si as SandboxInfo, sr as RestoreSnapshotOptions, ta as SnapshotInfo, tn as GitCommit, tt as DriveTurnOptions, ua as TaskSessionCommitResult, un as GpuLeaseManager, va as TeePublicKeyResponse, vn as IntelligenceReportCompareTo, vt as ExecResult, xa as TurnDriveResult, xn as JsonValue, xr as SandboxCreateReceipt, yi as SandboxStatus, yr as SandboxConnection, zi as SessionEventStreamOptions } from "./types-CFmeauzy.js";
|
|
4
4
|
import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, AgentInteractiveTerminalSession as AgentInteractiveTerminalSession$1, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, InteractionAcknowledgement, InteractionData, InteractionRequest, InteractionResponseCommand, TerminalOutputEvent, TerminalReplayWindow, agentInteractiveSessionPromptRequestDigest } from "@tangle-network/agent-interface";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
@@ -412,6 +412,27 @@ interface LineRole {
|
|
|
412
412
|
/** `chat`: the member's session has no shell, cannot read, search or change files, starts no subagents, and gets none of the backend's MCP servers, connections or hooks. */
|
|
413
413
|
tools: "act" | "chat";
|
|
414
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* An opt-in, fail-closed role boundary for a general hosted agent. Hub resolves
|
|
417
|
+
* roles from its authenticated member record, never from message text.
|
|
418
|
+
*
|
|
419
|
+
* General access is reserved for owner and manager. Every other role names
|
|
420
|
+
* only its product MCP servers and needs an explicit member backend. Product
|
|
421
|
+
* servers still authorize the enrolled actor; an MCP name grants no authority.
|
|
422
|
+
*/
|
|
423
|
+
interface LineAgentRolePolicy {
|
|
424
|
+
version: 1;
|
|
425
|
+
roles: Record<string, {
|
|
426
|
+
kind: "general";
|
|
427
|
+
} | {
|
|
428
|
+
kind: "scoped";
|
|
429
|
+
mcpServers: string[];
|
|
430
|
+
}>;
|
|
431
|
+
/** Normalized member address -> actor-scoped backend; no shared fallback. */
|
|
432
|
+
members: Record<string, {
|
|
433
|
+
backend: Partial<BackendConfig>;
|
|
434
|
+
}>;
|
|
435
|
+
}
|
|
415
436
|
/** A sender an attachment admits. */
|
|
416
437
|
interface LineMemberSpec {
|
|
417
438
|
/** E.164 number, or the email / Apple ID the sender texts from. */
|
|
@@ -481,15 +502,20 @@ interface LineRespondAgent {
|
|
|
481
502
|
kind: "agent";
|
|
482
503
|
/** Backend for member sessions. Omit to use the sandbox's default. */
|
|
483
504
|
backend?: Partial<BackendConfig>;
|
|
505
|
+
rolePolicy?: LineAgentRolePolicy;
|
|
484
506
|
gate?: LineReplyGate;
|
|
507
|
+
/** Default true. Set false to disable tapbacks and typing. */
|
|
508
|
+
acknowledgement?: boolean;
|
|
485
509
|
}
|
|
486
510
|
/** The stored respond config; the gate's secret is never returned. */
|
|
487
511
|
interface LineRespondView {
|
|
488
512
|
kind: "agent";
|
|
489
513
|
backend?: Partial<BackendConfig>;
|
|
514
|
+
rolePolicy?: LineAgentRolePolicy;
|
|
490
515
|
gate?: Omit<LineReplyGate, "secret"> & {
|
|
491
516
|
audience: "owner" | "members";
|
|
492
517
|
};
|
|
518
|
+
acknowledgement: boolean;
|
|
493
519
|
}
|
|
494
520
|
interface LineAttachOptions {
|
|
495
521
|
/** A line id (`ln_...`) or an address of one of your lines. */
|
|
@@ -511,7 +537,7 @@ interface LineAttachOptions {
|
|
|
511
537
|
clientReference?: string;
|
|
512
538
|
}
|
|
513
539
|
/** The sandbox options a member's own sandbox is created with. */
|
|
514
|
-
type LineInstanceCreate = Pick<CreateSandboxOptions, "name" | "environment" | "resources" | "egressPolicy" | "idleTimeoutSeconds" | "maxLifetimeSeconds" | "deleteAfterStoppedSeconds"> & {
|
|
540
|
+
type LineInstanceCreate = Pick<CreateSandboxOptions, "name" | "environment" | "ownerContext" | "capabilities" | "resources" | "egressPolicy" | "idleTimeoutSeconds" | "maxLifetimeSeconds" | "deleteAfterStoppedSeconds"> & {
|
|
515
541
|
metadata?: Record<string, string>;
|
|
516
542
|
};
|
|
517
543
|
/**
|
|
@@ -544,18 +570,42 @@ interface LineFromConnectionCommon {
|
|
|
544
570
|
/** Your idempotency reference: the same value returns the same line. */
|
|
545
571
|
clientReference?: string;
|
|
546
572
|
}
|
|
547
|
-
/** Input to `client.lines.fromConnection()`.
|
|
573
|
+
/** Input to `client.lines.fromConnection()`. Phone connections select an owned number. */
|
|
548
574
|
type LineFromConnectionInput = LineFromConnectionCommon & ({
|
|
549
|
-
transport: "imessage";
|
|
550
|
-
phoneNumberId?:
|
|
551
|
-
} /**
|
|
575
|
+
transport: "imessage" /** Required for a numbered provider; omit for Inkbox identity. */;
|
|
576
|
+
phoneNumberId?: string;
|
|
577
|
+
} /** Inkbox discovers its mailbox; Resend requires an address on a verified domain. */ | {
|
|
552
578
|
transport: "email";
|
|
579
|
+
address?: string;
|
|
553
580
|
phoneNumberId?: never;
|
|
581
|
+
} | {
|
|
582
|
+
transport: "sms";
|
|
583
|
+
phoneNumberId: string;
|
|
554
584
|
} | {
|
|
555
585
|
transport: "whatsapp";
|
|
556
586
|
phoneNumberId: string;
|
|
557
587
|
});
|
|
558
588
|
/** Fields a member update may change. */
|
|
589
|
+
interface LineSendInput {
|
|
590
|
+
memberId: string;
|
|
591
|
+
text: string;
|
|
592
|
+
idempotencyKey: string;
|
|
593
|
+
/** Optional ISO instant less than seven days away. Workflows own schedules. */
|
|
594
|
+
notBefore?: string;
|
|
595
|
+
}
|
|
596
|
+
interface LineSendReceipt {
|
|
597
|
+
message: LineMessage;
|
|
598
|
+
eligibleAt: string | null;
|
|
599
|
+
expiresAt: string;
|
|
600
|
+
}
|
|
601
|
+
interface LineReminderPreferences {
|
|
602
|
+
enabled: boolean;
|
|
603
|
+
timezone: string | null;
|
|
604
|
+
quietStart: string | null;
|
|
605
|
+
quietEnd: string | null;
|
|
606
|
+
consentMessageId: string | null;
|
|
607
|
+
updatedAt: string | null;
|
|
608
|
+
}
|
|
559
609
|
interface LineMemberPatch {
|
|
560
610
|
role?: string;
|
|
561
611
|
label?: string;
|
|
@@ -626,6 +676,11 @@ interface Line {
|
|
|
626
676
|
connectionId: string;
|
|
627
677
|
/** The provider's phone number id, or null for a line without a pinned number. */
|
|
628
678
|
providerNumberId: string | null;
|
|
679
|
+
/** Null means Hub has no verified workspace binding for this line. */
|
|
680
|
+
workspace: {
|
|
681
|
+
resourceType: "workspace";
|
|
682
|
+
resourceId: string;
|
|
683
|
+
} | null;
|
|
629
684
|
label: string | null;
|
|
630
685
|
clientReference: string | null;
|
|
631
686
|
status: "active" | "suspended" | "released";
|
|
@@ -699,6 +754,12 @@ declare class LinesClient {
|
|
|
699
754
|
* false when the line was not attached.
|
|
700
755
|
*/
|
|
701
756
|
detach(number: string): Promise<boolean>;
|
|
757
|
+
/**
|
|
758
|
+
* Retire a detached line's Hub routing and free its workspace transport slot.
|
|
759
|
+
* Hub refuses an attached or voice-enabled line. A retry by line id returns
|
|
760
|
+
* false; the provider connection and message history remain.
|
|
761
|
+
*/
|
|
762
|
+
release(number: string): Promise<boolean>;
|
|
702
763
|
/**
|
|
703
764
|
* Take calls on a line (Inkbox iMessage lines). Hub points the identity's
|
|
704
765
|
* incoming calls at itself, binds the ph0ny agent to the line and adds the
|
|
@@ -707,6 +768,16 @@ declare class LinesClient {
|
|
|
707
768
|
enableVoice(lineId: string, options: LineVoiceOptions): Promise<Line>;
|
|
708
769
|
/** Stop taking calls on a line: Hub refuses them and Inkbox rejects them. */
|
|
709
770
|
disableVoice(lineId: string): Promise<Line>;
|
|
771
|
+
/**
|
|
772
|
+
* Queue a proactive message to an active, consenting member. Hub reuses the
|
|
773
|
+
* member's authenticated provider conversation, rechecks STOP immediately
|
|
774
|
+
* before delivery, and defers delivery during the recipient's saved quiet hours.
|
|
775
|
+
*/
|
|
776
|
+
send(lineId: string, input: LineSendInput): Promise<LineSendReceipt>;
|
|
777
|
+
/** Read the native outbox receipt. Queued is not a delivery confirmation. */
|
|
778
|
+
sentMessage(lineId: string, messageId: string): Promise<LineSendReceipt>;
|
|
779
|
+
/** Only the recipient's proven message can enable reminders or choose quiet hours. */
|
|
780
|
+
reminders(lineId: string, memberId: string): Promise<LineReminderPreferences>;
|
|
710
781
|
/** Members of the line's active attachment. */
|
|
711
782
|
members(lineId: string): {
|
|
712
783
|
list(): Promise<LineMember[]>;
|
|
@@ -739,6 +810,52 @@ declare class SandboxLines {
|
|
|
739
810
|
}
|
|
740
811
|
//#endregion
|
|
741
812
|
//#region src/session.d.ts
|
|
813
|
+
type RawEvidenceExport = {
|
|
814
|
+
status: "captured";
|
|
815
|
+
sessionId: string;
|
|
816
|
+
backendType: string;
|
|
817
|
+
nativeSessionId: string;
|
|
818
|
+
sidecarImageDigest: string;
|
|
819
|
+
sidecarBundleRevision: string;
|
|
820
|
+
nativeRoots: Array<{
|
|
821
|
+
rootScope: "session-home" | "workspace-session";
|
|
822
|
+
path: string;
|
|
823
|
+
}>;
|
|
824
|
+
files: Array<Record<string, unknown>>;
|
|
825
|
+
excluded: Array<Record<string, unknown>>;
|
|
826
|
+
inventory: Record<string, number>;
|
|
827
|
+
processIo: Array<Record<string, unknown>>;
|
|
828
|
+
processTerminals: Array<Record<string, unknown>>;
|
|
829
|
+
events: Array<Record<string, unknown>>;
|
|
830
|
+
completeness: {
|
|
831
|
+
nativeStore: true;
|
|
832
|
+
processIo: true;
|
|
833
|
+
events: true;
|
|
834
|
+
};
|
|
835
|
+
coverageComplete: true;
|
|
836
|
+
} | {
|
|
837
|
+
status: "unavailable";
|
|
838
|
+
sessionId: string;
|
|
839
|
+
backendType: string;
|
|
840
|
+
reason: string;
|
|
841
|
+
};
|
|
842
|
+
type NativeRolloutExport = {
|
|
843
|
+
status: "captured";
|
|
844
|
+
sessionId: string;
|
|
845
|
+
backendType: "opencode";
|
|
846
|
+
nativeSessionId: string;
|
|
847
|
+
format: "opencode-session-export-json";
|
|
848
|
+
sizeBytes: number;
|
|
849
|
+
sha256: string;
|
|
850
|
+
contentBase64: string;
|
|
851
|
+
content: Uint8Array;
|
|
852
|
+
} | {
|
|
853
|
+
status: "unavailable";
|
|
854
|
+
sessionId: string;
|
|
855
|
+
backendType: string;
|
|
856
|
+
nativeSessionId?: string;
|
|
857
|
+
reason: string;
|
|
858
|
+
};
|
|
742
859
|
/**
|
|
743
860
|
* The subset of `SandboxInstance` a `SandboxSession` drives. Declared here
|
|
744
861
|
* (rather than importing the concrete class) so `session.ts` stays a leaf
|
|
@@ -750,6 +867,8 @@ interface SandboxSessionHost extends InteractiveSessionHost {
|
|
|
750
867
|
_sessionStatus(id: string): Promise<SessionInfo | null>;
|
|
751
868
|
_sessionEvents(id: string, opts?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
|
|
752
869
|
_sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
|
|
870
|
+
_sessionNativeRollout(id: string): Promise<NativeRolloutExport>;
|
|
871
|
+
_sessionRawEvidence(id: string): Promise<RawEvidenceExport>;
|
|
753
872
|
_sessionAdmission(id: string, turnId: string, options?: {
|
|
754
873
|
signal?: AbortSignal;
|
|
755
874
|
}): Promise<SessionMessageAdmission | null>;
|
|
@@ -820,6 +939,10 @@ declare class SandboxSession {
|
|
|
820
939
|
* count provider runs without inferring execution from model-written files.
|
|
821
940
|
*/
|
|
822
941
|
runs(): Promise<SessionExecutionInfo[]>;
|
|
942
|
+
/** Export the exact provider session before this sandbox is deleted. */
|
|
943
|
+
nativeRollout(): Promise<NativeRolloutExport>;
|
|
944
|
+
/** Capture the complete attributed native store and process stream before deletion. */
|
|
945
|
+
rawEvidence(): Promise<RawEvidenceExport>;
|
|
823
946
|
/** Read the exact execution admitted for a turn, including server-owned plan follow-ups.
|
|
824
947
|
* This never admits work or verifies the input of a proposed retry.
|
|
825
948
|
*/
|
|
@@ -1553,7 +1676,9 @@ declare class SandboxInstance {
|
|
|
1553
1676
|
* Older runtimes without app-variable registration fail this call.
|
|
1554
1677
|
* Credential values must stay outside profiles, receipts, and logs.
|
|
1555
1678
|
*/
|
|
1556
|
-
setRuntimeEnv(env: Record<string, string
|
|
1679
|
+
setRuntimeEnv(env: Record<string, string>, options?: {
|
|
1680
|
+
ttlMs?: number;
|
|
1681
|
+
}): Promise<void>;
|
|
1557
1682
|
/**
|
|
1558
1683
|
* Return the runtime's current listening-port snapshot.
|
|
1559
1684
|
*
|
|
@@ -2394,6 +2519,10 @@ declare class SandboxInstance {
|
|
|
2394
2519
|
mintScopedToken(opts: MintScopedTokenOptions): Promise<ScopedToken>;
|
|
2395
2520
|
/** @internal — invoked by SandboxSession.status(). */
|
|
2396
2521
|
_sessionStatus(id: string): Promise<SessionInfo | null>;
|
|
2522
|
+
/** @internal — invoked before the sandbox is deleted. */
|
|
2523
|
+
_sessionNativeRollout(id: string): Promise<NativeRolloutExport>;
|
|
2524
|
+
/** @internal — invoked before the sandbox is deleted. */
|
|
2525
|
+
_sessionRawEvidence(id: string): Promise<RawEvidenceExport>;
|
|
2397
2526
|
/** @internal — invoked by SandboxSession.runs(). */
|
|
2398
2527
|
_sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
|
|
2399
2528
|
/** @internal — invoked by SandboxSession.admission(). */
|
|
@@ -2460,4 +2589,4 @@ declare class SandboxInstance {
|
|
|
2460
2589
|
}): Promise<DurablePlanDecisionResult>;
|
|
2461
2590
|
}
|
|
2462
2591
|
//#endregion
|
|
2463
|
-
export {
|
|
2592
|
+
export { InteractiveSessionHost as $, LineMemberPatch as A, SandboxMcpServerEntry as At, LineThread as B, LineAttachment as C, SandboxInteractionResult as Ct, LineLimits as D, SANDBOX_MCP_SERVER_NAME as Dt, LineInstanceCreate as E, CONTROL_PLANE_MCP_SERVER_NAME as Et, LineRespondAgent as F, SandboxLines as G, LineVoice as H, LineRespondView as I, InteractiveControlClaimRequest as J, lineInstanceKey as K, LineRole as L, LineMessage as M, buildSandboxMcpConfig as Mt, LineReminderPreferences as N, LineMember as O, SandboxMcpConfig as Ot, LineReplyGate as P, InteractiveSessionHandleOptions as Q, LineSendInput as R, LineAttachOptions as S, SandboxInteractionResolution as St, LineInstanceAttachOptions as T, BuildSandboxMcpConfigOptions as Tt, LineVoiceOptions as U, LineTransport as V, LinesClient as W, InteractiveSessionControlClaim as X, InteractivePromptCommand as Y, InteractiveSessionHandle as Z, RawEvidenceExport as _, InteractiveSessionController as _t, WorkspaceImagePublishRequestOptions as a, InteractiveStopCommand as at, LineAgentRolePolicy as b, SandboxInteractionCommandResult as bt, TraceExportFormat as c, agentInteractiveSessionPromptRequestDigest as ct, buildTraceExportPayload as d, InteractiveTerminalMetadata as dt, InteractiveSessionIncarnationId as et, exportTraceBundle as f, createInteractiveTerminalCapture as ft, NativeRolloutExport as g, InteractiveAttachRequest as gt, SandboxTaskSession as h, BrowserInteractiveSessionControllerOptions as ht, WorkspaceImagePublishInput as i, InteractiveSessionStartResult as it, LineMemberSpec as j, buildControlPlaneMcpConfig as jt, LineMemberInstance as k, SandboxMcpEndpoint as kt, TraceExportResult as l, InteractiveTerminalCapture as lt, toOtelJson as m, BrowserInteractiveSessionController as mt, HttpClient as n, InteractiveSessionRef as nt, WorkspaceImagePublishResult as o, InterruptResult as ot, otelTraceIdForTangleTrace as p, createInteractiveTerminalSession as pt, AgentInteractiveTerminalSession$1 as q, SandboxInstance as r, InteractiveSessionStartOptions as rt, WorkspaceImages as s, RespondToPermissionOptions as st, ForkAcknowledgement as t, InteractiveSessionInfo as tt, TraceExportSink as u, InteractiveTerminalFrameLog as ut, SandboxSession as v, InteractiveSessionControllerOptions as vt, LineFromConnectionInput as w, BuildControlPlaneMcpConfigOptions as wt, LineAllowance as x, SandboxInteractionConflict as xt, Line as y, InteractiveSessionControllerTransport as yt, LineSendReceipt as z };
|
package/dist/tangle/index.d.ts
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 TangleSandboxClientConfig, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../index-
|
|
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 TangleSandboxClientConfig, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../index-C1sVorE5.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-Bm6H-xIM.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as parseErrorResponse } from "./errors-
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { _ as parseErrorResponse } from "./errors-BkhlSDW-.js";
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-C9VLoJAb.js";
|
|
3
3
|
//#region src/tangle/abi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tangle Contract ABI Definitions
|