@tangle-network/sandbox 0.55.3 → 0.58.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 +21 -2
- package/dist/agent/index.d.ts +59 -19
- package/dist/agent/index.js +39 -357
- 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-DV-9cNsk.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-B1I66sl_.d.ts} +10 -4
- package/dist/{client-B6Jo-v5w.js → client-BMdV_CeM.js} +30 -7
- 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-CGnI-q1g.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-DXO-9rtB.js +440 -0
- package/dist/preview-Bz7TXYSf.d.ts +72 -0
- package/dist/preview-operations-Dgbi46FH.js +212 -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-C7KqjY6Y.d.ts → sandbox-BMSWYvdP.d.ts} +144 -10
- package/dist/{sandbox-DzSE1u7d.js → sandbox-DyrDBnjp.js} +130 -10
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CmpR_07-.js → tangle-BtQkJqfz.js} +2 -2
- package/dist/{types-UOIM3RS6.d.ts → types-DRyvWIJf.d.ts} +24 -2
- package/package.json +11 -6
- /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
package/README.md
CHANGED
|
@@ -308,6 +308,10 @@ Renew application credentials before dispatch when reusing a sandbox:
|
|
|
308
308
|
await box.setRuntimeEnv({ APP_CAPABILITY_TOKEN: freshWorkspaceToken });
|
|
309
309
|
```
|
|
310
310
|
|
|
311
|
+
Pass `{ ttlMs }` for short-lived credentials. The runtime removes each injected
|
|
312
|
+
key after that duration; refreshing the key starts a new lifetime. Older
|
|
313
|
+
runtimes reject expiring credentials before injection.
|
|
314
|
+
|
|
311
315
|
New child processes and profile secret references use the updated values.
|
|
312
316
|
Existing processes retain their environment.
|
|
313
317
|
Updates do not change durable creation configuration, so repeat renewal after resume.
|
|
@@ -427,6 +431,9 @@ Use `fs.upload()` for local files or `fs.uploadData()` for in-memory content lar
|
|
|
427
431
|
|
|
428
432
|
The instance also exposes `git`, `tools`, `process`, `terminals`, `network`, `egress`, `previewLinks`, `images`, and `backend` capability clients.
|
|
429
433
|
Unsupported capabilities fail with a typed SDK error.
|
|
434
|
+
`box.images.publish()` uses an admitted image builder for the sandbox runtime.
|
|
435
|
+
A hardened runc box can publish through an isolated Firecracker builder when the cell enables that capability.
|
|
436
|
+
Without a qualified builder, publication fails with `IN_BOX_DOCKER_UNAVAILABLE` or `WORKSPACE_IMAGE_BUILDER_UNAVAILABLE`.
|
|
430
437
|
|
|
431
438
|
## Prompts
|
|
432
439
|
|
|
@@ -652,7 +659,7 @@ Deleting the base sandbox remains a separate cleanup step.
|
|
|
652
659
|
|
|
653
660
|
## Phone lines
|
|
654
661
|
|
|
655
|
-
A line gives a sandbox a messaging address that Tangle Hub receives on
|
|
662
|
+
A line gives a sandbox a messaging address that Tangle Hub receives on through an owned provider connection.
|
|
656
663
|
Hub routes each message to the attached sandbox, runs one agent session per member, handles STOP and START, and answers on the same line.
|
|
657
664
|
|
|
658
665
|
```typescript
|
|
@@ -677,6 +684,11 @@ Later mail in that thread runs at once, because every Hub mail carries the membe
|
|
|
677
684
|
That token works like a password for 30 to 60 days: anyone who receives a forwarded Hub mail can write as that member.
|
|
678
685
|
Forged mail can also use up a member's daily confirmation notices, but it cannot run a turn.
|
|
679
686
|
|
|
687
|
+
Other numbered connections select their provider-owned endpoint with `phoneNumberId`.
|
|
688
|
+
Use `transport: "sms"` for SMS, MMS, or RCS messages, and `transport: "whatsapp"` for Linq WhatsApp.
|
|
689
|
+
Resend email lines set `address` on a verified domain that can send and receive mail.
|
|
690
|
+
Configure the connection's signed inbound webhook before creating a Resend line.
|
|
691
|
+
|
|
680
692
|
Use `mode: "shared"` with `roles` and several `members` for one agent that many people text.
|
|
681
693
|
Each member gets their own thread; a `shared`-context role sees other shared members' recent exchanges, and an `own`-context role sees none.
|
|
682
694
|
Unknown senders are rejected unless `unknownSenders: "guest"` admits them with the `guest` role.
|
|
@@ -742,7 +754,10 @@ A gated attachment must reject unknown senders.
|
|
|
742
754
|
|
|
743
755
|
Members can also call an Inkbox iMessage line.
|
|
744
756
|
Connect your ph0ny key in Hub, then name the ph0ny agent that voices the calls.
|
|
745
|
-
|
|
757
|
+
That ph0ny agent is a second agent, with its own prompt, model and voice: it hears the caller and speaks every word.
|
|
758
|
+
Hub answers only the attachment's members.
|
|
759
|
+
Each question the ph0ny agent asks with its `ask_workspace` tool runs in the caller's own thread session, so your sandbox agent sees the call's questions next to the member's texts.
|
|
760
|
+
The ph0ny agent does not see those texts; it knows only what `ask_workspace` returns.
|
|
746
761
|
|
|
747
762
|
```typescript
|
|
748
763
|
await client.lines.enableVoice(line.id, {
|
|
@@ -753,6 +768,10 @@ await client.lines.enableVoice(line.id, {
|
|
|
753
768
|
```
|
|
754
769
|
|
|
755
770
|
A gated line takes no calls, because a spoken answer cannot pass the reply gate.
|
|
771
|
+
Hub knows a caller only by caller ID, which can be spoofed, so give a voice line `chat` roles when a call must not reach the member's tools.
|
|
772
|
+
|
|
773
|
+
Hub sends the agent's visible text as the reply, unchanged; no other model rewrites it.
|
|
774
|
+
[Hub lines](../../../docs/hub/lines.md) explains the text and voice paths, the notices a member gets, and measured reply times.
|
|
756
775
|
|
|
757
776
|
Runnable examples: [`lines-email.ts`](./examples/lines-email.ts) (an email line with a sandbox per member), [`lines-shared.ts`](./examples/lines-shared.ts) (two members on one sandbox) and [`lines-voice.ts`](./examples/lines-voice.ts) (voice on an iMessage line).
|
|
758
777
|
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as CodeExecutionResult, E as CodeExecutionOptions, Gr as SandboxFleetParent, Ki as SessionListOptions, O as CodeLanguage, Wi as SessionInfo, d as BackendConfig, k as CodeResultPart, za as BackendType } from "../types-
|
|
3
|
-
import { i as Sandbox } from "../client-
|
|
1
|
+
import { h as SandboxTaskSession, r as SandboxInstance, v as SandboxSession } from "../sandbox-BMSWYvdP.js";
|
|
2
|
+
import { D as CodeExecutionResult, E as CodeExecutionOptions, Gr as SandboxFleetParent, Ki as SessionListOptions, O as CodeLanguage, Wi as SessionInfo, d as BackendConfig, k as CodeResultPart, za as BackendType } from "../types-DRyvWIJf.js";
|
|
3
|
+
import { i as Sandbox } from "../client-B1I66sl_.js";
|
|
4
|
+
import { o as PreviewAuthorizer } from "../preview-Bz7TXYSf.js";
|
|
4
5
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
6
|
import { JSONSchema } from "zod/v4/core";
|
|
7
|
+
import { ToolSet } from "ai";
|
|
6
8
|
|
|
7
9
|
//#region src/agent/instances.d.ts
|
|
8
10
|
/**
|
|
@@ -94,7 +96,7 @@ declare module "../sandbox.js" {
|
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
//#endregion
|
|
97
|
-
//#region src/agent/tools/
|
|
99
|
+
//#region src/agent/tools/types.d.ts
|
|
98
100
|
/** JSON-schema-ish object describing tool inputs. Plain object literal — no Zod required. */
|
|
99
101
|
type ToolJSONSchema = {
|
|
100
102
|
type: "object";
|
|
@@ -109,18 +111,26 @@ interface ToolHandlerContext {
|
|
|
109
111
|
* When unset, the bare-session kernel and the sandbox root workspace are used.
|
|
110
112
|
*/
|
|
111
113
|
sessionId?: string;
|
|
114
|
+
/** Host-only preview authorization. Not part of tool arguments. */
|
|
115
|
+
previewAuthorize?: PreviewAuthorizer;
|
|
116
|
+
signal?: AbortSignal;
|
|
112
117
|
}
|
|
118
|
+
/** Values returned by built-in sandbox tools before framework serialization. */
|
|
119
|
+
type ToolHandlerResult = object | string | number | boolean | null | undefined;
|
|
113
120
|
/**
|
|
114
|
-
* Pack-agnostic tool definition. The handler returns
|
|
115
|
-
*
|
|
116
|
-
* framework-appropriate tool-result payload.
|
|
121
|
+
* Pack-agnostic tool definition. The handler returns the underlying SDK
|
|
122
|
+
* result; each pack serializes it into its framework tool-result payload.
|
|
117
123
|
*/
|
|
118
|
-
interface ToolSpec<TArgs = Record<string, unknown>, TResult =
|
|
124
|
+
interface ToolSpec<TArgs = Record<string, unknown>, TResult = ToolHandlerResult> {
|
|
119
125
|
name: string;
|
|
120
126
|
description: string;
|
|
121
127
|
inputSchema: ToolJSONSchema;
|
|
128
|
+
/** False for capabilities that require an explicit host grant. */
|
|
129
|
+
enabledByDefault?: boolean;
|
|
122
130
|
makeHandler: (ctx: ToolHandlerContext) => (args: TArgs) => Promise<TResult>;
|
|
123
131
|
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/agent/tools/_specs.d.ts
|
|
124
134
|
/** All canonical tool names — derived from the keyed registry below. */
|
|
125
135
|
type ToolName = keyof typeof TOOL_SPECS;
|
|
126
136
|
/**
|
|
@@ -137,29 +147,48 @@ declare const TOOL_SPECS: {
|
|
|
137
147
|
language: "python" | "node" | "typescript" | "bash";
|
|
138
148
|
source: string;
|
|
139
149
|
timeout_ms?: number;
|
|
140
|
-
},
|
|
150
|
+
}, ToolHandlerResult>;
|
|
141
151
|
readonly sandbox_exec: ToolSpec<{
|
|
142
152
|
command: string;
|
|
143
153
|
cwd?: string;
|
|
144
154
|
timeout_ms?: number;
|
|
145
|
-
},
|
|
155
|
+
}, ToolHandlerResult>;
|
|
146
156
|
readonly sandbox_read: ToolSpec<{
|
|
147
157
|
path: string;
|
|
148
|
-
},
|
|
158
|
+
}, ToolHandlerResult>;
|
|
149
159
|
readonly sandbox_write: ToolSpec<{
|
|
150
160
|
path: string;
|
|
151
161
|
content: string;
|
|
152
|
-
},
|
|
162
|
+
}, ToolHandlerResult>;
|
|
153
163
|
readonly sandbox_list: ToolSpec<{
|
|
154
164
|
path: string;
|
|
155
|
-
},
|
|
165
|
+
}, ToolHandlerResult>;
|
|
156
166
|
readonly sandbox_search: ToolSpec<{
|
|
157
167
|
pattern: string;
|
|
158
168
|
path?: string;
|
|
159
169
|
max_results?: number;
|
|
160
|
-
},
|
|
170
|
+
}, ToolHandlerResult>;
|
|
171
|
+
readonly sandbox_preview: ToolSpec<{
|
|
172
|
+
cwd?: string;
|
|
173
|
+
name?: string;
|
|
174
|
+
}, ToolHandlerResult>;
|
|
175
|
+
readonly sandbox_preview_get: ToolSpec<{
|
|
176
|
+
previewId: string;
|
|
177
|
+
}, ToolHandlerResult>;
|
|
178
|
+
readonly sandbox_preview_publish: ToolSpec<{
|
|
179
|
+
port: number;
|
|
180
|
+
name?: string;
|
|
181
|
+
}, ToolHandlerResult>;
|
|
182
|
+
readonly sandbox_preview_list: ToolSpec<Record<string, unknown>, ToolHandlerResult>;
|
|
183
|
+
readonly sandbox_preview_remove: ToolSpec<{
|
|
184
|
+
previewId: string;
|
|
185
|
+
}, ToolHandlerResult>;
|
|
161
186
|
};
|
|
162
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* The legacy default tool set. Kept stable for callers that pass this exported
|
|
189
|
+
* array directly as well as for framework packs. Preview publishing is opt-in
|
|
190
|
+
* through TOOL_SPECS or a pack's explicit tools allow-list.
|
|
191
|
+
*/
|
|
163
192
|
declare const ALL_TOOL_SPECS: ToolSpec[];
|
|
164
193
|
//#endregion
|
|
165
194
|
//#region src/agent/mcp-local.d.ts
|
|
@@ -168,6 +197,8 @@ interface McpServerOptions {
|
|
|
168
197
|
allow?: ToolName[];
|
|
169
198
|
/** Session scope passed to handlers. */
|
|
170
199
|
sessionId?: string;
|
|
200
|
+
previewAuthorize?: PreviewAuthorizer;
|
|
201
|
+
signal?: AbortSignal;
|
|
171
202
|
/** Override the MCP server's reported name. Defaults to "tangle-sandbox". */
|
|
172
203
|
name?: string;
|
|
173
204
|
/** Override the reported version string. Defaults to the SDK package version. */
|
|
@@ -175,11 +206,12 @@ interface McpServerOptions {
|
|
|
175
206
|
}
|
|
176
207
|
type McpSdkServerModule = typeof _$_modelcontextprotocol_sdk_server_index_js0;
|
|
177
208
|
type AnyMcpServer = InstanceType<McpSdkServerModule["Server"]>;
|
|
209
|
+
type McpTransport = Parameters<AnyMcpServer["connect"]>[0];
|
|
178
210
|
interface McpServerHandle {
|
|
179
211
|
/** The underlying MCP Server instance (typed loosely to avoid a hard dep). */
|
|
180
212
|
server: AnyMcpServer;
|
|
181
213
|
/** Connect over a transport (typically StdioServerTransport). */
|
|
182
|
-
connect: (transport:
|
|
214
|
+
connect: (transport: McpTransport) => Promise<void>;
|
|
183
215
|
/** Shut the server down. */
|
|
184
216
|
close: () => Promise<void>;
|
|
185
217
|
}
|
|
@@ -271,6 +303,8 @@ interface AnthropicToolPackOptions {
|
|
|
271
303
|
allow?: ToolName[];
|
|
272
304
|
/** Session scope passed to handlers (kernel persistence, file routing). */
|
|
273
305
|
sessionId?: string;
|
|
306
|
+
previewAuthorize?: PreviewAuthorizer;
|
|
307
|
+
signal?: AbortSignal;
|
|
274
308
|
}
|
|
275
309
|
interface AnthropicToolPack {
|
|
276
310
|
/** Tools array — pass directly to `messages.create({ tools })`. */
|
|
@@ -527,6 +561,8 @@ declare function openaiLifecycleTools(client: Sandbox, options?: LifecycleToolPa
|
|
|
527
561
|
interface MastraToolPackOptions {
|
|
528
562
|
allow?: ToolName[];
|
|
529
563
|
sessionId?: string;
|
|
564
|
+
previewAuthorize?: PreviewAuthorizer;
|
|
565
|
+
signal?: AbortSignal;
|
|
530
566
|
}
|
|
531
567
|
/**
|
|
532
568
|
* Build a Mastra tool pack bound to one sandbox.
|
|
@@ -573,6 +609,8 @@ interface OpenAIToolResultMessage {
|
|
|
573
609
|
interface OpenAIToolPackOptions {
|
|
574
610
|
allow?: ToolName[];
|
|
575
611
|
sessionId?: string;
|
|
612
|
+
previewAuthorize?: PreviewAuthorizer;
|
|
613
|
+
signal?: AbortSignal;
|
|
576
614
|
}
|
|
577
615
|
interface OpenAIToolPack {
|
|
578
616
|
tools: OpenAITool[];
|
|
@@ -614,8 +652,10 @@ declare function openaiTools(box: SandboxInstance, options?: OpenAIToolPackOptio
|
|
|
614
652
|
interface VercelAiToolPackOptions {
|
|
615
653
|
allow?: ToolName[];
|
|
616
654
|
sessionId?: string;
|
|
655
|
+
previewAuthorize?: PreviewAuthorizer;
|
|
656
|
+
signal?: AbortSignal;
|
|
617
657
|
}
|
|
618
|
-
type
|
|
658
|
+
type VercelAiTool = ToolSet[string];
|
|
619
659
|
/**
|
|
620
660
|
* Build a Vercel AI SDK tool pack bound to one sandbox. The returned object
|
|
621
661
|
* is a `Record<toolName, ai.Tool>` ready for `generateText({ tools })`.
|
|
@@ -635,6 +675,6 @@ type AnyTool = unknown;
|
|
|
635
675
|
* });
|
|
636
676
|
* ```
|
|
637
677
|
*/
|
|
638
|
-
declare function vercelAiTools(box: SandboxInstance, options?: VercelAiToolPackOptions): Promise<
|
|
678
|
+
declare function vercelAiTools(box: SandboxInstance, options?: VercelAiToolPackOptions): Promise<ToolSet>;
|
|
639
679
|
//#endregion
|
|
640
|
-
export { ALL_FLEET_TOOL_SPECS, ALL_LIFECYCLE_TOOL_SPECS, ALL_TOOL_SPECS, type AnthropicFleetTool, type AnthropicFleetToolPack, type AnthropicLifecycleTool, type AnthropicLifecycleToolPack, type AnthropicTool, type AnthropicToolPack, type AnthropicToolPackOptions, type AnthropicToolResultBlock, type AnthropicToolUseBlock, type CodeExecutionOptions, type CodeExecutionResult, type CodeLanguage, type CodeResultPart, FLEET_TOOL_SPECS, type FleetToolHandlerContext, type FleetToolName, type FleetToolPackOptions, type FleetToolSpec, LIFECYCLE_TOOL_SPECS, type LifecycleToolHandlerContext, type LifecycleToolName, type LifecycleToolPackOptions, type LifecycleToolSpec, type MastraToolPackOptions, type McpServerHandle, type McpServerOptions, type OpenAIFleetTool, type OpenAIFleetToolPack, type OpenAILifecycleTool, type OpenAILifecycleToolPack, type OpenAITool, type OpenAIToolCall, type OpenAIToolPack, type OpenAIToolPackOptions, type OpenAIToolResultMessage, Sandbox, type SandboxAgent, type SandboxAgentForSpec, SandboxAgentManager, type SandboxAgentSpec, type SandboxAgentStopAcknowledgement, type SandboxAgentWorkspace, TOOL_SPECS, type ToolHandlerContext, type ToolName, type ToolSpec, type VercelAiToolPackOptions, anthropicFleetTools, anthropicLifecycleTools, anthropicTools, createMcpServer, mastraFleetTools, mastraTools, openaiFleetTools, openaiLifecycleTools, openaiTools, runCode, vercelAiFleetTools, vercelAiTools };
|
|
680
|
+
export { ALL_FLEET_TOOL_SPECS, ALL_LIFECYCLE_TOOL_SPECS, ALL_TOOL_SPECS, type AnthropicFleetTool, type AnthropicFleetToolPack, type AnthropicLifecycleTool, type AnthropicLifecycleToolPack, type AnthropicTool, type AnthropicToolPack, type AnthropicToolPackOptions, type AnthropicToolResultBlock, type AnthropicToolUseBlock, type CodeExecutionOptions, type CodeExecutionResult, type CodeLanguage, type CodeResultPart, FLEET_TOOL_SPECS, type FleetToolHandlerContext, type FleetToolName, type FleetToolPackOptions, type FleetToolSpec, LIFECYCLE_TOOL_SPECS, type LifecycleToolHandlerContext, type LifecycleToolName, type LifecycleToolPackOptions, type LifecycleToolSpec, type MastraToolPackOptions, type McpServerHandle, type McpServerOptions, type OpenAIFleetTool, type OpenAIFleetToolPack, type OpenAILifecycleTool, type OpenAILifecycleToolPack, type OpenAITool, type OpenAIToolCall, type OpenAIToolPack, type OpenAIToolPackOptions, type OpenAIToolResultMessage, Sandbox, type SandboxAgent, type SandboxAgentForSpec, SandboxAgentManager, type SandboxAgentSpec, type SandboxAgentStopAcknowledgement, type SandboxAgentWorkspace, TOOL_SPECS, type ToolHandlerContext, type ToolName, type ToolSpec, type VercelAiTool, type VercelAiToolPackOptions, anthropicFleetTools, anthropicLifecycleTools, anthropicTools, createMcpServer, mastraFleetTools, mastraTools, openaiFleetTools, openaiLifecycleTools, openaiTools, runCode, vercelAiFleetTools, vercelAiTools };
|