@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.
Files changed (44) hide show
  1. package/README.md +21 -2
  2. package/dist/agent/index.d.ts +59 -19
  3. package/dist/agent/index.js +39 -357
  4. package/dist/agent/preview.d.ts +2 -0
  5. package/dist/agent/preview.js +74 -0
  6. package/dist/{agent-run-outcome-CWo6e5lW.d.ts → agent-run-outcome-DV-9cNsk.d.ts} +1 -1
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.js +1 -1
  9. package/dist/{browser-interactive-control-controller-Dv0gbFMu.js → browser-interactive-control-controller-CVGqjPgs.js} +1 -1
  10. package/dist/{browser-interactive-control-controller-BELrFH4f.d.ts → browser-interactive-control-controller-knjCl8Zp.d.ts} +1 -1
  11. package/dist/{client-B-LZQQ51.d.ts → client-B1I66sl_.d.ts} +10 -4
  12. package/dist/{client-B6Jo-v5w.js → client-BMdV_CeM.js} +30 -7
  13. package/dist/collaboration/index.d.ts +1 -1
  14. package/dist/collaboration/index.js +1 -1
  15. package/dist/{collaboration-DLPFc9-W.js → collaboration-CSHswAOI.js} +1 -1
  16. package/dist/core.d.ts +5 -5
  17. package/dist/core.js +3 -3
  18. package/dist/{index-ATSSTK2A.d.ts → index-CGnI-q1g.d.ts} +2 -2
  19. package/dist/index.d.ts +11 -11
  20. package/dist/index.js +7 -7
  21. package/dist/intelligence/index.js +1 -1
  22. package/dist/interactive-control.d.ts +1 -1
  23. package/dist/interactive-control.js +1 -1
  24. package/dist/{local-cli-auth-BAJuMBZU.js → local-cli-auth-DfuFJCcs.js} +1 -1
  25. package/dist/mcp-local-DXO-9rtB.js +440 -0
  26. package/dist/preview-Bz7TXYSf.d.ts +72 -0
  27. package/dist/preview-operations-Dgbi46FH.js +212 -0
  28. package/dist/{runtime-api-DoZsOiOR.js → runtime-api-BZg34WGd.js} +10 -5
  29. package/dist/runtime.d.ts +6 -4
  30. package/dist/runtime.js +3 -3
  31. package/dist/{sandbox-C7KqjY6Y.d.ts → sandbox-BMSWYvdP.d.ts} +144 -10
  32. package/dist/{sandbox-DzSE1u7d.js → sandbox-DyrDBnjp.js} +130 -10
  33. package/dist/tangle/index.d.ts +1 -1
  34. package/dist/tangle/index.js +1 -1
  35. package/dist/{tangle-CmpR_07-.js → tangle-BtQkJqfz.js} +2 -2
  36. package/dist/{types-UOIM3RS6.d.ts → types-DRyvWIJf.d.ts} +24 -2
  37. package/package.json +11 -6
  38. /package/dist/{abort-signal-si1WMfJb.js → abort-signal-CgFhjY_v.js} +0 -0
  39. /package/dist/{cli-auth-bundle-DUsK57rK.js → cli-auth-bundle-bRJOyaJO.js} +0 -0
  40. /package/dist/{errors-CmYPVl-k.js → errors-BkhlSDW-.js} +0 -0
  41. /package/dist/{errors-Cz23YNu2.d.ts → errors-CNsmhCen.d.ts} +0 -0
  42. /package/dist/{index-BWiG3Vcw.d.ts → index-BN7zNEUB.d.ts} +0 -0
  43. /package/dist/{index-BfVsF6yU.d.ts → index-X4EEZlMi.d.ts} +0 -0
  44. /package/dist/{terminal-stream-CcaBTVg3.d.ts → terminal-stream-BW4veIsI.d.ts} +0 -0
@@ -0,0 +1,440 @@
1
+ import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-Dgbi46FH.js";
2
+ import { createRequire } from "node:module";
3
+ //#region \0rolldown/runtime.js
4
+ var __defProp = Object.defineProperty;
5
+ var __exportAll = (all, no_symbols) => {
6
+ let target = {};
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
12
+ return target;
13
+ };
14
+ //#endregion
15
+ //#region src/agent/tools/preview.ts
16
+ function input(args, keys) {
17
+ if (!args || typeof args !== "object" || Array.isArray(args) || Object.keys(args).some((key) => !keys.includes(key))) throw new AgentPreviewError("PREVIEW_INVALID_INPUT", `Accepted fields: ${keys.join(", ") || "none"}; the host binds sandbox/session`);
18
+ }
19
+ const execution = (ctx) => ({
20
+ authorize: ctx.previewAuthorize,
21
+ signal: ctx.signal
22
+ });
23
+ const name = {
24
+ type: "string",
25
+ minLength: 1,
26
+ maxLength: 128,
27
+ description: "Human-readable app/service label; not an access policy."
28
+ };
29
+ const previewId = {
30
+ type: "string",
31
+ minLength: 1,
32
+ description: "The exact preview ID returned by the platform."
33
+ };
34
+ /**
35
+ * Keyed registry. `as const` preserves per-tool TArgs/TResult through the
36
+ * type system — `TOOL_SPECS.sandbox_run_code.makeHandler` returns a handler
37
+ * whose args parameter is the runCodeSpec's typed `{language, source, ...}`,
38
+ * not the erased `Record<string, unknown>` that an array-of-ToolSpec loses.
39
+ *
40
+ * Iteration order matches the order entries are declared here (V8 preserves
41
+ * string-key insertion order), so the public surface is stable.
42
+ */
43
+ const TOOL_SPECS = {
44
+ sandbox_run_code: {
45
+ name: "sandbox_run_code",
46
+ description: "Execute code in a persistent language kernel inside the sandbox. Variables persist across calls with the same session. Returns stdout, stderr, exit code, and a typed `results` array containing matplotlib figures (base64 PNG), pandas DataFrames, JSON via display(), or errors. Prefer this over sandbox_exec for any code that needs structured output.",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {
50
+ language: {
51
+ type: "string",
52
+ enum: [
53
+ "python",
54
+ "node",
55
+ "typescript",
56
+ "bash"
57
+ ],
58
+ description: "Kernel language."
59
+ },
60
+ source: {
61
+ type: "string",
62
+ description: "Source code to run. Multi-line supported."
63
+ },
64
+ timeout_ms: {
65
+ type: "number",
66
+ description: "Per-call timeout. 0 disables. Default 60000."
67
+ }
68
+ },
69
+ required: ["language", "source"],
70
+ additionalProperties: false
71
+ },
72
+ makeHandler: ({ box, sessionId }) => async (args) => {
73
+ return await box.runCode(args.language, args.source, {
74
+ sessionId,
75
+ timeoutMs: args.timeout_ms
76
+ });
77
+ }
78
+ },
79
+ sandbox_exec: {
80
+ name: "sandbox_exec",
81
+ description: "Run a shell command (no persistent state) in the sandbox. Use for one-shot tasks like 'pnpm install' or 'ls'. For code that should share state across calls, prefer sandbox_run_code with a sessionId.",
82
+ inputSchema: {
83
+ type: "object",
84
+ properties: {
85
+ command: {
86
+ type: "string",
87
+ description: "Shell command line."
88
+ },
89
+ cwd: {
90
+ type: "string",
91
+ description: "Working directory. Optional."
92
+ },
93
+ timeout_ms: {
94
+ type: "number",
95
+ description: "Default 60000."
96
+ }
97
+ },
98
+ required: ["command"],
99
+ additionalProperties: false
100
+ },
101
+ makeHandler: ({ box, sessionId }) => async (args) => {
102
+ return await box.exec(args.command, {
103
+ cwd: args.cwd,
104
+ timeoutMs: args.timeout_ms,
105
+ sessionId
106
+ });
107
+ }
108
+ },
109
+ sandbox_read: {
110
+ name: "sandbox_read",
111
+ description: "Read a file from the sandbox filesystem. Relative paths resolve from the workspace root; absolute paths read the container filesystem directly.",
112
+ inputSchema: {
113
+ type: "object",
114
+ properties: { path: { type: "string" } },
115
+ required: ["path"],
116
+ additionalProperties: false
117
+ },
118
+ makeHandler: ({ box, sessionId }) => async (args) => {
119
+ return { content: await box.read(args.path, { sessionId }) };
120
+ }
121
+ },
122
+ sandbox_write: {
123
+ name: "sandbox_write",
124
+ description: "Write a file in the sandbox. Creates parent directories as needed. Overwrites existing files.",
125
+ inputSchema: {
126
+ type: "object",
127
+ properties: {
128
+ path: { type: "string" },
129
+ content: {
130
+ type: "string",
131
+ description: "Full file contents."
132
+ }
133
+ },
134
+ required: ["path", "content"],
135
+ additionalProperties: false
136
+ },
137
+ makeHandler: ({ box }) => async (args) => {
138
+ await box.write(args.path, args.content);
139
+ return { ok: true };
140
+ }
141
+ },
142
+ sandbox_list: {
143
+ name: "sandbox_list",
144
+ description: "List entries in a directory with size, type, and mode.",
145
+ inputSchema: {
146
+ type: "object",
147
+ properties: { path: { type: "string" } },
148
+ required: ["path"],
149
+ additionalProperties: false
150
+ },
151
+ makeHandler: ({ box }) => async (args) => {
152
+ return { entries: await box.fs.list(args.path) };
153
+ }
154
+ },
155
+ sandbox_search: {
156
+ name: "sandbox_search",
157
+ description: "Ripgrep-style code search. Returns matching lines with surrounding context.",
158
+ inputSchema: {
159
+ type: "object",
160
+ properties: {
161
+ pattern: {
162
+ type: "string",
163
+ description: "Regex pattern."
164
+ },
165
+ path: {
166
+ type: "string",
167
+ description: "Subdirectory to search. Optional."
168
+ },
169
+ max_results: {
170
+ type: "number",
171
+ description: "Cap. Default 100."
172
+ }
173
+ },
174
+ required: ["pattern"],
175
+ additionalProperties: false
176
+ },
177
+ makeHandler: ({ box }) => async (args) => {
178
+ const matches = [];
179
+ const cap = args.max_results ?? 100;
180
+ for await (const m of box.search(args.pattern, {
181
+ cwd: args.path,
182
+ maxResults: cap
183
+ })) {
184
+ matches.push(m);
185
+ if (matches.length >= cap) break;
186
+ }
187
+ return { matches };
188
+ }
189
+ },
190
+ sandbox_preview: {
191
+ name: "sandbox_preview",
192
+ enabledByDefault: false,
193
+ description: "Start/reuse one project's managed server and publish its actual preview URL. Use a different cwd for each app; existing apps are not replaced. Executes project startup code and may expose content publicly; use only when authorized.",
194
+ inputSchema: {
195
+ type: "object",
196
+ properties: {
197
+ cwd: {
198
+ type: "string",
199
+ description: "Project directory in the bound workspace."
200
+ },
201
+ name
202
+ },
203
+ additionalProperties: false
204
+ },
205
+ makeHandler: (ctx) => async (args) => {
206
+ input(args, ["cwd", "name"]);
207
+ return ensureAgentPreview(ctx.box, {
208
+ ...args,
209
+ sessionId: ctx.sessionId
210
+ }, execution(ctx));
211
+ }
212
+ },
213
+ sandbox_preview_get: {
214
+ name: "sandbox_preview_get",
215
+ enabledByDefault: false,
216
+ description: "Read a known preview's current URL, routing readiness and diagnostics without publishing it.",
217
+ inputSchema: {
218
+ type: "object",
219
+ properties: { previewId },
220
+ required: ["previewId"],
221
+ additionalProperties: false
222
+ },
223
+ makeHandler: (ctx) => async (args) => {
224
+ input(args, ["previewId"]);
225
+ return getAgentPreview(ctx.box, args.previewId, execution(ctx));
226
+ }
227
+ },
228
+ sandbox_preview_publish: {
229
+ name: "sandbox_preview_publish",
230
+ enabledByDefault: false,
231
+ description: "Publish an existing HTTP service on an explicit port. Does not start a process or replace other previews. Use for custom servers or several services in one repository. Publishing can expose app content publicly.",
232
+ inputSchema: {
233
+ type: "object",
234
+ properties: {
235
+ port: {
236
+ type: "integer",
237
+ minimum: 1,
238
+ maximum: 65535
239
+ },
240
+ name
241
+ },
242
+ required: ["port"],
243
+ additionalProperties: false
244
+ },
245
+ makeHandler: (ctx) => async (args) => {
246
+ input(args, ["port", "name"]);
247
+ return publishAgentPreview(ctx.box, args, execution(ctx));
248
+ }
249
+ },
250
+ sandbox_preview_list: {
251
+ name: "sandbox_preview_list",
252
+ enabledByDefault: false,
253
+ description: "List this sandbox's published services with their exact URLs, ports, status and app labels. Does not publish unexposed ports. A ready record is not a fresh health check; use sandbox_preview_get to check it.",
254
+ inputSchema: {
255
+ type: "object",
256
+ properties: {},
257
+ additionalProperties: false
258
+ },
259
+ makeHandler: (ctx) => async (args) => {
260
+ input(args, []);
261
+ return listAgentPreviews(ctx.box, execution(ctx));
262
+ }
263
+ },
264
+ sandbox_preview_remove: {
265
+ name: "sandbox_preview_remove",
266
+ enabledByDefault: false,
267
+ description: "Unpublish exactly one preview, leaving its process and other applications alone. Requires authorization to change publication.",
268
+ inputSchema: {
269
+ type: "object",
270
+ properties: { previewId },
271
+ required: ["previewId"],
272
+ additionalProperties: false
273
+ },
274
+ makeHandler: (ctx) => async (args) => {
275
+ input(args, ["previewId"]);
276
+ await removeAgentPreview(ctx.box, args.previewId, execution(ctx));
277
+ return { removed: args.previewId };
278
+ }
279
+ }
280
+ };
281
+ /**
282
+ * The legacy default tool set. Kept stable for callers that pass this exported
283
+ * array directly as well as for framework packs. Preview publishing is opt-in
284
+ * through TOOL_SPECS or a pack's explicit tools allow-list.
285
+ */
286
+ const ALL_TOOL_SPECS = Object.values(TOOL_SPECS).filter((spec) => spec.enabledByDefault !== false);
287
+ /** Pack-side helper: filter the registry by an optional allow-list. */
288
+ function selectSpecs(allow) {
289
+ if (!allow || allow.length === 0) return ALL_TOOL_SPECS;
290
+ const set = new Set(allow);
291
+ return Object.keys(TOOL_SPECS).filter((name) => set.has(name)).map((name) => TOOL_SPECS[name]);
292
+ }
293
+ /**
294
+ * Best-effort serialization of a tool handler's return value into a string
295
+ * tool-result payload. Each pack uses this when its target API expects a
296
+ * string `content` field; packs that support structured content (Anthropic
297
+ * multi-block) can opt out and serialize differently.
298
+ *
299
+ * `CodeExecutionResult` is serialized as JSON because the LLM benefits from
300
+ * seeing the structured results array; images come through as base64 strings
301
+ * which the model can read or hand back to the user.
302
+ */
303
+ function serializeToolResult(value) {
304
+ if (typeof value === "string") return value;
305
+ try {
306
+ return JSON.stringify(value, null, 2);
307
+ } catch {
308
+ return String(value);
309
+ }
310
+ }
311
+ //#endregion
312
+ //#region src/agent/tools/_binding.ts
313
+ function bindToolSpecs(box, options) {
314
+ const context = {
315
+ box,
316
+ sessionId: options.sessionId,
317
+ previewAuthorize: options.previewAuthorize,
318
+ signal: options.signal
319
+ };
320
+ const handlers = /* @__PURE__ */ new Map();
321
+ return {
322
+ bindings: selectSpecs(options.allow).map((spec) => {
323
+ const handler = spec.makeHandler(context);
324
+ handlers.set(spec.name, handler);
325
+ return {
326
+ spec,
327
+ handler
328
+ };
329
+ }),
330
+ handlers
331
+ };
332
+ }
333
+ //#endregion
334
+ //#region src/agent/mcp-local.ts
335
+ /**
336
+ * Local MCP (Model Context Protocol) server bridge.
337
+ *
338
+ * `createMcpServer(box, { allow })` returns an MCP `Server` instance wired
339
+ * with the same tool registry the framework packs use. Pair it with a
340
+ * transport (most commonly stdio) and your sandbox becomes a paste-able
341
+ * MCP source for Claude Desktop, Cursor, Zed, or any other MCP client.
342
+ *
343
+ * Complements `box.getMcpEndpoint()` — that returns a hosted HTTPS+JWT MCP
344
+ * URL for users who can expose one; this gives users a fully local server
345
+ * that runs inside their own process.
346
+ *
347
+ * `@modelcontextprotocol/sdk` is dynamically imported (optional peer dep).
348
+ * Install in your app:
349
+ * pnpm add @modelcontextprotocol/sdk
350
+ */
351
+ var mcp_local_exports = /* @__PURE__ */ __exportAll({ createMcpServer: () => createMcpServer });
352
+ const SDK_VERSION = (() => {
353
+ try {
354
+ return createRequire(import.meta.url)("../../package.json").version ?? "0.0.0";
355
+ } catch {
356
+ return "0.0.0";
357
+ }
358
+ })();
359
+ /**
360
+ * Build an MCP server backed by one sandbox. The server registers
361
+ * `tools/list` and `tools/call` handlers populated from the same registry
362
+ * the framework packs use.
363
+ *
364
+ * @example
365
+ * ```ts
366
+ * // tangle-mcp-server.ts — used as the command in your MCP client config.
367
+ * import { Sandbox } from "@tangle-network/sandbox";
368
+ * import { createMcpServer } from "@tangle-network/sandbox/agent";
369
+ * import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
370
+ *
371
+ * const client = new Sandbox({ apiKey: process.env.TANGLE_API_KEY });
372
+ * const box = await client.get(process.env.SANDBOX_ID!);
373
+ * const { connect } = await createMcpServer(box, { sessionId: "claude-desktop" });
374
+ * await connect(new StdioServerTransport());
375
+ * ```
376
+ *
377
+ * Claude Desktop config snippet:
378
+ * ```json
379
+ * {
380
+ * "mcpServers": {
381
+ * "tangle-sandbox": {
382
+ * "command": "node",
383
+ * "args": ["./tangle-mcp-server.js"],
384
+ * "env": { "TANGLE_API_KEY": "...", "SANDBOX_ID": "..." }
385
+ * }
386
+ * }
387
+ * }
388
+ * ```
389
+ */
390
+ async function createMcpServer(box, options = {}) {
391
+ let serverModule;
392
+ let typesModule;
393
+ try {
394
+ [serverModule, typesModule] = await Promise.all([import("@modelcontextprotocol/sdk/server/index.js"), import("@modelcontextprotocol/sdk/types.js")]);
395
+ } catch {
396
+ throw new Error("createMcpServer(): the `@modelcontextprotocol/sdk` package is not installed. Install it via `pnpm add @modelcontextprotocol/sdk`.");
397
+ }
398
+ const { bindings, handlers } = bindToolSpecs(box, options);
399
+ const server = new serverModule.Server({
400
+ name: options.name ?? "tangle-sandbox",
401
+ version: options.version ?? SDK_VERSION
402
+ }, { capabilities: { tools: {} } });
403
+ server.setRequestHandler(typesModule.ListToolsRequestSchema, async () => ({ tools: bindings.map(({ spec: s }) => ({
404
+ name: s.name,
405
+ description: s.description,
406
+ inputSchema: s.inputSchema
407
+ })) }));
408
+ server.setRequestHandler(typesModule.CallToolRequestSchema, async (req) => {
409
+ const r = req;
410
+ const handler = handlers.get(r.params.name);
411
+ if (!handler) return {
412
+ isError: true,
413
+ content: [{
414
+ type: "text",
415
+ text: `Unknown tool: ${r.params.name}`
416
+ }]
417
+ };
418
+ try {
419
+ return { content: [{
420
+ type: "text",
421
+ text: serializeToolResult(await handler(r.params.arguments ?? {}))
422
+ }] };
423
+ } catch (err) {
424
+ return {
425
+ isError: true,
426
+ content: [{
427
+ type: "text",
428
+ text: err instanceof Error ? err.message : String(err)
429
+ }]
430
+ };
431
+ }
432
+ });
433
+ return {
434
+ server,
435
+ connect: (transport) => server.connect(transport),
436
+ close: () => server.close()
437
+ };
438
+ }
439
+ //#endregion
440
+ export { TOOL_SPECS as a, ALL_TOOL_SPECS as i, mcp_local_exports as n, serializeToolResult as o, bindToolSpecs as r, createMcpServer as t };
@@ -0,0 +1,72 @@
1
+ import { r as SandboxInstance } from "./sandbox-BMSWYvdP.js";
2
+ import { Pn as PreviewLinkInfo, mt as EnsureDevServerOptions } from "./types-DRyvWIJf.js";
3
+ import { i as Sandbox } from "./client-B1I66sl_.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 };