noumen 0.3.0 → 0.5.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 +63 -8
- package/dist/a2a/index.d.ts +4 -2
- package/dist/acp/index.d.ts +5 -3
- package/dist/{agent-1nFVUP9E.d.ts → agent-C3eDRsxs.d.ts} +19 -508
- package/dist/chunk-I5SBSOS6.js +40 -0
- package/dist/chunk-I5SBSOS6.js.map +1 -0
- package/dist/{chunk-4HW6LN6D.js → chunk-WPCYGZOE.js} +58 -1228
- package/dist/chunk-WPCYGZOE.js.map +1 -0
- package/dist/{chunk-5JN4SPI7.js → chunk-WTLK2ZAR.js} +1 -1
- package/dist/{chunk-HL6JCRZJ.js → chunk-XZN4QZLK.js} +4 -4
- package/dist/cli/index.js +10 -10
- package/dist/computer-BPdxSo6X.d.ts +88 -0
- package/dist/docker.d.ts +129 -0
- package/dist/docker.js +401 -0
- package/dist/docker.js.map +1 -0
- package/dist/e2b.d.ts +157 -0
- package/dist/e2b.js +202 -0
- package/dist/e2b.js.map +1 -0
- package/dist/freestyle.d.ts +174 -0
- package/dist/freestyle.js +240 -0
- package/dist/freestyle.js.map +1 -0
- package/dist/index.d.ts +9 -201
- package/dist/index.js +24 -48
- package/dist/lsp/index.d.ts +3 -2
- package/dist/mcp/index.d.ts +4 -3
- package/dist/mcp/index.js +2 -2
- package/dist/{provider-factory-KCLIF34X.js → provider-factory-KI7OZUY3.js} +2 -2
- package/dist/{resolve-4JA2BBDA.js → resolve-GDSHNMG6.js} +2 -2
- package/dist/sandbox-9qeMTNrD.d.ts +126 -0
- package/dist/server/index.d.ts +4 -2
- package/dist/{server-CHMxuWKq.d.ts → server-Cu9gv1dk.d.ts} +1 -1
- package/dist/sprites.d.ts +136 -0
- package/dist/sprites.js +334 -0
- package/dist/sprites.js.map +1 -0
- package/dist/ssh.d.ts +187 -0
- package/dist/ssh.js +392 -0
- package/dist/ssh.js.map +1 -0
- package/dist/{types-RPKUTu1k.d.ts → types-BA87bHPV.d.ts} +2 -88
- package/package.json +28 -1
- package/dist/chunk-4HW6LN6D.js.map +0 -1
- /package/dist/{chunk-5JN4SPI7.js.map → chunk-WTLK2ZAR.js.map} +0 -0
- /package/dist/{chunk-HL6JCRZJ.js.map → chunk-XZN4QZLK.js.map} +0 -0
- /package/dist/{provider-factory-KCLIF34X.js.map → provider-factory-KI7OZUY3.js.map} +0 -0
- /package/dist/{resolve-4JA2BBDA.js.map → resolve-GDSHNMG6.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -7,18 +7,9 @@ import {
|
|
|
7
7
|
DEFAULT_PRICING,
|
|
8
8
|
DEFAULT_RETRY_CONFIG,
|
|
9
9
|
DenialTracker,
|
|
10
|
-
DockerComputer,
|
|
11
|
-
DockerFs,
|
|
12
|
-
DockerSandbox,
|
|
13
|
-
E2BComputer,
|
|
14
|
-
E2BFs,
|
|
15
|
-
E2BSandbox,
|
|
16
10
|
FileCheckpointManager,
|
|
17
11
|
FileMemoryProvider,
|
|
18
12
|
FileStateCache,
|
|
19
|
-
FreestyleComputer,
|
|
20
|
-
FreestyleFs,
|
|
21
|
-
FreestyleSandbox,
|
|
22
13
|
InProcessBackend,
|
|
23
14
|
InvariantViolation,
|
|
24
15
|
LocalComputer,
|
|
@@ -31,9 +22,6 @@ import {
|
|
|
31
22
|
STRUCTURED_OUTPUT_TOOL_NAME,
|
|
32
23
|
SandboxedLocalComputer,
|
|
33
24
|
SpanStatusCode,
|
|
34
|
-
SpritesComputer,
|
|
35
|
-
SpritesFs,
|
|
36
|
-
SpritesSandbox,
|
|
37
25
|
StreamingToolExecutor,
|
|
38
26
|
SwarmManager,
|
|
39
27
|
TaskStore,
|
|
@@ -126,30 +114,18 @@ import {
|
|
|
126
114
|
tryReactiveCompact,
|
|
127
115
|
webSearchToolPlaceholder,
|
|
128
116
|
withRetry
|
|
129
|
-
} from "./chunk-
|
|
130
|
-
import {
|
|
131
|
-
applySnipRemovals,
|
|
132
|
-
projectSnippedView,
|
|
133
|
-
snipMessagesByUuids
|
|
134
|
-
} from "./chunk-42PHHZUA.js";
|
|
117
|
+
} from "./chunk-WPCYGZOE.js";
|
|
135
118
|
import {
|
|
136
119
|
DEFAULT_MODELS,
|
|
137
120
|
SUPPORTED_PROVIDERS,
|
|
138
121
|
detectProvider,
|
|
139
122
|
resolveProvider
|
|
140
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-WTLK2ZAR.js";
|
|
141
124
|
import {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
registerContextWindows,
|
|
147
|
-
sortToolDefinitionsForCache
|
|
148
|
-
} from "./chunk-HEQQQGK5.js";
|
|
149
|
-
import {
|
|
150
|
-
ChatStreamError
|
|
151
|
-
} from "./chunk-L3L3FG5T.js";
|
|
152
|
-
import "./chunk-3HEYCV26.js";
|
|
125
|
+
applySnipRemovals,
|
|
126
|
+
projectSnippedView,
|
|
127
|
+
snipMessagesByUuids
|
|
128
|
+
} from "./chunk-42PHHZUA.js";
|
|
153
129
|
import {
|
|
154
130
|
RULE_SOURCE_PRECEDENCE,
|
|
155
131
|
TOOL_SEARCH_NAME,
|
|
@@ -187,12 +163,7 @@ import {
|
|
|
187
163
|
toolMatchesRule,
|
|
188
164
|
webFetchTool,
|
|
189
165
|
writeFileTool
|
|
190
|
-
} from "./chunk-
|
|
191
|
-
import {
|
|
192
|
-
formatZodValidationError,
|
|
193
|
-
registerZodToJsonSchema,
|
|
194
|
-
zodToJsonSchema
|
|
195
|
-
} from "./chunk-3SK5GCI6.js";
|
|
166
|
+
} from "./chunk-XZN4QZLK.js";
|
|
196
167
|
import {
|
|
197
168
|
API_IMAGE_MAX_BASE64_SIZE,
|
|
198
169
|
IMAGE_EXTENSIONS,
|
|
@@ -209,6 +180,23 @@ import {
|
|
|
209
180
|
normalizeNameForMCP,
|
|
210
181
|
parseMcpToolName
|
|
211
182
|
} from "./chunk-4SQA2UCV.js";
|
|
183
|
+
import {
|
|
184
|
+
formatZodValidationError,
|
|
185
|
+
registerZodToJsonSchema,
|
|
186
|
+
zodToJsonSchema
|
|
187
|
+
} from "./chunk-3SK5GCI6.js";
|
|
188
|
+
import {
|
|
189
|
+
getAutoCompactThreshold,
|
|
190
|
+
getContextWindowForModel,
|
|
191
|
+
getEffectiveContextWindow,
|
|
192
|
+
getMessageCacheBreakpointIndex,
|
|
193
|
+
registerContextWindows,
|
|
194
|
+
sortToolDefinitionsForCache
|
|
195
|
+
} from "./chunk-HEQQQGK5.js";
|
|
196
|
+
import {
|
|
197
|
+
ChatStreamError
|
|
198
|
+
} from "./chunk-L3L3FG5T.js";
|
|
199
|
+
import "./chunk-3HEYCV26.js";
|
|
212
200
|
import {
|
|
213
201
|
contentToString,
|
|
214
202
|
hasImageContent,
|
|
@@ -228,18 +216,9 @@ export {
|
|
|
228
216
|
DEFAULT_PRICING,
|
|
229
217
|
DEFAULT_RETRY_CONFIG,
|
|
230
218
|
DenialTracker,
|
|
231
|
-
DockerComputer,
|
|
232
|
-
DockerFs,
|
|
233
|
-
DockerSandbox,
|
|
234
|
-
E2BComputer,
|
|
235
|
-
E2BFs,
|
|
236
|
-
E2BSandbox,
|
|
237
219
|
FileCheckpointManager,
|
|
238
220
|
FileMemoryProvider,
|
|
239
221
|
FileStateCache,
|
|
240
|
-
FreestyleComputer,
|
|
241
|
-
FreestyleFs,
|
|
242
|
-
FreestyleSandbox,
|
|
243
222
|
IMAGE_EXTENSIONS,
|
|
244
223
|
IMAGE_MAX_HEIGHT,
|
|
245
224
|
IMAGE_MAX_WIDTH,
|
|
@@ -257,9 +236,6 @@ export {
|
|
|
257
236
|
SUPPORTED_PROVIDERS,
|
|
258
237
|
SandboxedLocalComputer,
|
|
259
238
|
SpanStatusCode,
|
|
260
|
-
SpritesComputer,
|
|
261
|
-
SpritesFs,
|
|
262
|
-
SpritesSandbox,
|
|
263
239
|
StreamingToolExecutor,
|
|
264
240
|
SwarmManager,
|
|
265
241
|
TOOL_SEARCH_NAME,
|
package/dist/lsp/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { L as LspServerConfig, a as LspServerState, b as LspDiagnostic, T as Tool } from '../types-
|
|
2
|
-
export { D as DiagnosticRegistry, c as LspLocation, d as LspOperation, e as LspServerManager, f as LspSymbol } from '../types-
|
|
1
|
+
import { L as LspServerConfig, a as LspServerState, b as LspDiagnostic, T as Tool } from '../types-BA87bHPV.js';
|
|
2
|
+
export { D as DiagnosticRegistry, c as LspLocation, d as LspOperation, e as LspServerManager, f as LspSymbol } from '../types-BA87bHPV.js';
|
|
3
3
|
import '../types-LrU4LRmX.js';
|
|
4
|
+
import '../computer-BPdxSo6X.js';
|
|
4
5
|
import '../types-CD0rUKKT.js';
|
|
5
6
|
|
|
6
7
|
interface ServerCapabilities {
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { M as McpClientManager } from '../server-
|
|
2
|
-
export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, d as createMcpServer, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from '../server-
|
|
1
|
+
import { M as McpClientManager } from '../server-Cu9gv1dk.js';
|
|
2
|
+
export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, d as createMcpServer, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from '../server-Cu9gv1dk.js';
|
|
3
3
|
import { T as TokenStorage, O as OAuthTokenData, a as OAuthProviderOptions } from '../types-2kTLUCnD.js';
|
|
4
4
|
export { b as McpConfig, c as McpConnection, d as McpHttpServerConfig, e as McpOAuthConfig, M as McpServerConfig, f as McpSseServerConfig, g as McpStdioServerConfig, h as McpToolInfo, i as McpWebSocketServerConfig } from '../types-2kTLUCnD.js';
|
|
5
5
|
import { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
6
6
|
export { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
7
|
import { OAuthClientMetadata, OAuthClientInformationMixed, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
8
|
export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
9
|
-
import { T as Tool } from '../types-
|
|
9
|
+
import { T as Tool } from '../types-BA87bHPV.js';
|
|
10
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
11
11
|
import '../types-LrU4LRmX.js';
|
|
12
|
+
import '../computer-BPdxSo6X.js';
|
|
12
13
|
import '../types-CD0rUKKT.js';
|
|
13
14
|
|
|
14
15
|
/**
|
package/dist/mcp/index.js
CHANGED
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
} from "../chunk-BZSFUEWM.js";
|
|
12
12
|
import {
|
|
13
13
|
ToolRegistry
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-3SK5GCI6.js";
|
|
14
|
+
} from "../chunk-XZN4QZLK.js";
|
|
16
15
|
import "../chunk-5GEX6ZSB.js";
|
|
17
16
|
import {
|
|
18
17
|
buildMcpToolName,
|
|
@@ -20,6 +19,7 @@ import {
|
|
|
20
19
|
normalizeNameForMCP,
|
|
21
20
|
parseMcpToolName
|
|
22
21
|
} from "../chunk-4SQA2UCV.js";
|
|
22
|
+
import "../chunk-3SK5GCI6.js";
|
|
23
23
|
import {
|
|
24
24
|
contentToString
|
|
25
25
|
} from "../chunk-JACGEMTF.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SUPPORTED_PROVIDERS,
|
|
8
8
|
detectProvider,
|
|
9
9
|
resolveProvider
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WTLK2ZAR.js";
|
|
11
11
|
import "./chunk-DGUM43GV.js";
|
|
12
12
|
export {
|
|
13
13
|
DEFAULT_MODELS,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
isOllamaRunning,
|
|
18
18
|
ollamaBaseURL
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=provider-factory-
|
|
20
|
+
//# sourceMappingURL=provider-factory-KI7OZUY3.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
SUPPORTED_PROVIDERS,
|
|
4
4
|
detectProvider,
|
|
5
5
|
resolveProvider
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WTLK2ZAR.js";
|
|
7
7
|
import "./chunk-DGUM43GV.js";
|
|
8
8
|
export {
|
|
9
9
|
DEFAULT_MODELS,
|
|
@@ -11,4 +11,4 @@ export {
|
|
|
11
11
|
detectProvider,
|
|
12
12
|
resolveProvider
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=resolve-
|
|
14
|
+
//# sourceMappingURL=resolve-GDSHNMG6.js.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { V as VirtualComputer, E as ExecOptions, C as CommandResult, a as VirtualFs } from './computer-BPdxSo6X.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Filesystem and network restriction config passed to `@anthropic-ai/sandbox-runtime`.
|
|
5
|
+
*/
|
|
6
|
+
interface SandboxConfig {
|
|
7
|
+
filesystem?: {
|
|
8
|
+
/** Paths the agent may write to (default: `[cwd]`). Write is denied everywhere else. */
|
|
9
|
+
allowWrite?: string[];
|
|
10
|
+
/** Paths to explicitly deny writes within allowed regions. */
|
|
11
|
+
denyWrite?: string[];
|
|
12
|
+
/** Paths to deny reading. By default everything is readable. */
|
|
13
|
+
denyRead?: string[];
|
|
14
|
+
/** Paths to re-allow reading within denyRead regions. Takes precedence over denyRead. */
|
|
15
|
+
allowRead?: string[];
|
|
16
|
+
};
|
|
17
|
+
network?: {
|
|
18
|
+
/** Domains the agent may reach via HTTP/HTTPS/SOCKS. */
|
|
19
|
+
allowedDomains?: string[];
|
|
20
|
+
/** Domains to explicitly block. */
|
|
21
|
+
deniedDomains?: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface SandboxedLocalComputerOptions {
|
|
25
|
+
defaultCwd?: string;
|
|
26
|
+
defaultTimeout?: number;
|
|
27
|
+
sandbox?: SandboxConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `VirtualComputer` that wraps every command with OS-level sandboxing via
|
|
31
|
+
* `@anthropic-ai/sandbox-runtime`. Uses macOS Seatbelt (`sandbox-exec`) or
|
|
32
|
+
* Linux bubblewrap (`bwrap`) under the hood.
|
|
33
|
+
*/
|
|
34
|
+
declare class SandboxedLocalComputer implements VirtualComputer {
|
|
35
|
+
private defaultCwd;
|
|
36
|
+
private defaultTimeout;
|
|
37
|
+
private sandboxConfig;
|
|
38
|
+
private initPromise;
|
|
39
|
+
private initialized;
|
|
40
|
+
constructor(opts?: SandboxedLocalComputerOptions);
|
|
41
|
+
private buildRuntimeConfig;
|
|
42
|
+
private ensureInitialized;
|
|
43
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Tear down the sandbox runtime. Call when the agent is done.
|
|
46
|
+
*/
|
|
47
|
+
dispose(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Bundled sandbox: a `VirtualFs` and `VirtualComputer` paired together.
|
|
52
|
+
*
|
|
53
|
+
* Use one of the built-in factories (`LocalSandbox`, `UnsandboxedLocal`)
|
|
54
|
+
* or import a remote backend from its subpath
|
|
55
|
+
* (`noumen/docker`, `noumen/e2b`, `noumen/freestyle`, `noumen/ssh`,
|
|
56
|
+
* `noumen/sprites`). You can also supply any object that satisfies this
|
|
57
|
+
* shape for custom sandboxes (in-memory, custom cloud backends, etc.).
|
|
58
|
+
*/
|
|
59
|
+
interface Sandbox {
|
|
60
|
+
fs: VirtualFs;
|
|
61
|
+
computer: VirtualComputer;
|
|
62
|
+
/** Optional cleanup — called by Agent.close() to tear down OS-level sandbox state. */
|
|
63
|
+
dispose?(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Lazily provision the underlying sandbox resource. Idempotent — repeated
|
|
66
|
+
* calls return the same single-flight promise.
|
|
67
|
+
*
|
|
68
|
+
* When `sandboxId` is provided the sandbox reconnects to an existing
|
|
69
|
+
* resource instead of creating a new one. This is used during session
|
|
70
|
+
* resume: the stored sandbox identifier is read from session metadata
|
|
71
|
+
* and passed here so the agent reattaches to its previous container.
|
|
72
|
+
*
|
|
73
|
+
* When omitted a fresh resource is provisioned (for factories that
|
|
74
|
+
* support auto-creation) or the call is a no-op (for factories that
|
|
75
|
+
* were given a pre-created resource up front).
|
|
76
|
+
*/
|
|
77
|
+
init?(sandboxId?: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Return the opaque identifier for this sandbox instance so it can be
|
|
80
|
+
* persisted in session metadata and used to reconnect later via `init()`.
|
|
81
|
+
* Returns `undefined` before `init()` has resolved or for sandboxes
|
|
82
|
+
* that don't support reconnection.
|
|
83
|
+
*/
|
|
84
|
+
sandboxId?(): string | undefined;
|
|
85
|
+
}
|
|
86
|
+
interface UnsandboxedLocalOptions {
|
|
87
|
+
/** Working directory for both file resolution and command execution. */
|
|
88
|
+
cwd?: string;
|
|
89
|
+
/** Default timeout (ms) for shell commands. */
|
|
90
|
+
defaultTimeout?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a `Sandbox` backed by the host filesystem and shell with **no
|
|
94
|
+
* OS-level isolation**. The agent can access anything the host process can.
|
|
95
|
+
*
|
|
96
|
+
* Use this for development or fully-trusted environments where sandboxing
|
|
97
|
+
* overhead is unwanted. For production use, prefer `LocalSandbox()` (which
|
|
98
|
+
* wraps commands with `@anthropic-ai/sandbox-runtime`).
|
|
99
|
+
*/
|
|
100
|
+
declare function UnsandboxedLocal(opts?: UnsandboxedLocalOptions): Sandbox;
|
|
101
|
+
interface LocalSandboxOptions {
|
|
102
|
+
/** Working directory for both file resolution and command execution. */
|
|
103
|
+
cwd?: string;
|
|
104
|
+
/** Default timeout (ms) for shell commands. */
|
|
105
|
+
defaultTimeout?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Sandbox restrictions. Defaults: writes allowed only in `cwd`,
|
|
108
|
+
* reads allowed everywhere, network unrestricted.
|
|
109
|
+
*/
|
|
110
|
+
sandbox?: SandboxConfig;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create a `Sandbox` with OS-level isolation via `@anthropic-ai/sandbox-runtime`.
|
|
114
|
+
*
|
|
115
|
+
* - **macOS**: Seatbelt (`sandbox-exec`) profiles restrict filesystem and network.
|
|
116
|
+
* - **Linux**: bubblewrap (`bwrap`) + socat for namespace-based isolation.
|
|
117
|
+
*
|
|
118
|
+
* Filesystem operations (`VirtualFs`) use the host `node:fs` — the sandbox
|
|
119
|
+
* boundary is enforced on shell commands (`VirtualComputer`), which is where
|
|
120
|
+
* the agent executes arbitrary code.
|
|
121
|
+
*
|
|
122
|
+
* Requires `@anthropic-ai/sandbox-runtime` as a peer dependency.
|
|
123
|
+
*/
|
|
124
|
+
declare function LocalSandbox(opts?: LocalSandboxOptions): Sandbox;
|
|
125
|
+
|
|
126
|
+
export { LocalSandbox as L, type Sandbox as S, UnsandboxedLocal as U, type LocalSandboxOptions as a, type SandboxConfig as b, SandboxedLocalComputer as c, type SandboxedLocalComputerOptions as d, type UnsandboxedLocalOptions as e };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ServerResponse, IncomingMessage } from 'node:http';
|
|
2
|
-
import { A as Agent } from '../agent-
|
|
2
|
+
import { A as Agent } from '../agent-C3eDRsxs.js';
|
|
3
3
|
import { S as StreamEvent } from '../types-LrU4LRmX.js';
|
|
4
4
|
import { P as PermissionResponse } from '../types-CD0rUKKT.js';
|
|
5
|
-
import '../
|
|
5
|
+
import '../sandbox-9qeMTNrD.js';
|
|
6
|
+
import '../computer-BPdxSo6X.js';
|
|
7
|
+
import '../types-BA87bHPV.js';
|
|
6
8
|
import '../cache-DsRqxx6v.js';
|
|
7
9
|
import '../types-2kTLUCnD.js';
|
|
8
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { S as Sandbox } from './sandbox-9qeMTNrD.js';
|
|
2
|
+
import { a as VirtualFs, R as ReadOptions, F as FileEntry, b as FileStat, V as VirtualComputer, E as ExecOptions, C as CommandResult } from './computer-BPdxSo6X.js';
|
|
3
|
+
|
|
4
|
+
interface SpritesSandboxOptions {
|
|
5
|
+
/** sprites.dev API token. */
|
|
6
|
+
token: string;
|
|
7
|
+
/**
|
|
8
|
+
* Name of an existing sprite container. When provided the sandbox
|
|
9
|
+
* attaches to this sprite directly — no auto-creation occurs and
|
|
10
|
+
* `dispose()` will **not** delete it (lifecycle is yours to manage).
|
|
11
|
+
*
|
|
12
|
+
* When omitted a new sprite is provisioned on the first `init()` call
|
|
13
|
+
* (via `POST /v1/sprites`). The auto-created sprite is deleted when
|
|
14
|
+
* `dispose()` is called, and its name is available via `sandboxId()`
|
|
15
|
+
* for session persistence.
|
|
16
|
+
*/
|
|
17
|
+
spriteName?: string;
|
|
18
|
+
/** Base URL for sprites API (default: https://api.sprites.dev). */
|
|
19
|
+
baseURL?: string;
|
|
20
|
+
/** Working directory inside the sprite (default: /home/sprite). */
|
|
21
|
+
workingDir?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional prefix for auto-generated sprite names (default: "noumen-").
|
|
24
|
+
* Only used when `spriteName` is omitted.
|
|
25
|
+
*/
|
|
26
|
+
namePrefix?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a `Sandbox` backed by a remote sprites.dev container.
|
|
30
|
+
* Full isolation — the agent has no access to the host machine.
|
|
31
|
+
*
|
|
32
|
+
* **Auto-creation:** When `spriteName` is omitted the sandbox is created
|
|
33
|
+
* lazily on the first `init()` call via the Sprites REST API. The sprite
|
|
34
|
+
* name is available through `sandboxId()` so callers can persist it in
|
|
35
|
+
* session metadata for reconnection on resume. Pass the stored name back
|
|
36
|
+
* through `init(storedId)` to reattach instead of creating a new sprite.
|
|
37
|
+
*
|
|
38
|
+
* **Explicit ID:** When `spriteName` is provided the sandbox attaches to
|
|
39
|
+
* that sprite immediately on `init()`. `dispose()` is a no-op in this
|
|
40
|
+
* case — the caller owns the sprite's lifecycle.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* // Auto-create — sprite provisioned on first init()
|
|
45
|
+
* const sandbox = SpritesSandbox({ token: process.env.SPRITES_TOKEN! });
|
|
46
|
+
*
|
|
47
|
+
* // Explicit — attach to pre-existing sprite, no auto-lifecycle
|
|
48
|
+
* const sandbox = SpritesSandbox({
|
|
49
|
+
* token: process.env.SPRITES_TOKEN!,
|
|
50
|
+
* spriteName: "my-sprite",
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare function SpritesSandbox(opts: SpritesSandboxOptions): Sandbox;
|
|
55
|
+
|
|
56
|
+
interface SpritesFsOptions {
|
|
57
|
+
/** sprites.dev API token */
|
|
58
|
+
token: string;
|
|
59
|
+
/** Name of the sprite container */
|
|
60
|
+
spriteName: string;
|
|
61
|
+
/** Base URL for sprites API (default: https://api.sprites.dev) */
|
|
62
|
+
baseURL?: string;
|
|
63
|
+
/** Working directory inside the sprite (default: /home/sprite) */
|
|
64
|
+
workingDir?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Sandboxed VirtualFs backed by a remote sprites.dev container. All file
|
|
68
|
+
* operations are executed over the sprites.dev HTTP API — the agent has no
|
|
69
|
+
* access to the host filesystem. This is the recommended VirtualFs for
|
|
70
|
+
* production deployments and untrusted agents. See `LocalFs` for an
|
|
71
|
+
* unsandboxed local alternative.
|
|
72
|
+
*/
|
|
73
|
+
declare class SpritesFs implements VirtualFs {
|
|
74
|
+
private token;
|
|
75
|
+
private spriteName;
|
|
76
|
+
private baseURL;
|
|
77
|
+
private workingDir;
|
|
78
|
+
constructor(opts: SpritesFsOptions);
|
|
79
|
+
private fsUrl;
|
|
80
|
+
private resolvePath;
|
|
81
|
+
private headers;
|
|
82
|
+
readFile(filePath: string, _opts?: ReadOptions): Promise<string>;
|
|
83
|
+
readFileBytes(filePath: string, maxBytes?: number): Promise<Buffer>;
|
|
84
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* @warning Not atomic. Concurrent appends may lose data due to
|
|
87
|
+
* read-then-write TOCTOU. The Sprites API does not expose an append primitive.
|
|
88
|
+
*/
|
|
89
|
+
appendFile(filePath: string, content: string): Promise<void>;
|
|
90
|
+
deleteFile(filePath: string, opts?: {
|
|
91
|
+
recursive?: boolean;
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
mkdir(dirPath: string, opts?: {
|
|
94
|
+
recursive?: boolean;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
readdir(dirPath: string, _opts?: {
|
|
97
|
+
recursive?: boolean;
|
|
98
|
+
}): Promise<FileEntry[]>;
|
|
99
|
+
exists(filePath: string): Promise<boolean>;
|
|
100
|
+
stat(filePath: string): Promise<FileStat>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface SpritesComputerOptions {
|
|
104
|
+
/** sprites.dev API token */
|
|
105
|
+
token: string;
|
|
106
|
+
/** Name of the sprite container */
|
|
107
|
+
spriteName: string;
|
|
108
|
+
/** Base URL for sprites API (default: https://api.sprites.dev) */
|
|
109
|
+
baseURL?: string;
|
|
110
|
+
/** Working directory inside the sprite (default: /home/sprite) */
|
|
111
|
+
workingDir?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Sandboxed VirtualComputer that executes commands inside a remote
|
|
115
|
+
* sprites.dev container. All shell execution is fully isolated — the agent
|
|
116
|
+
* has no access to the host machine's processes, filesystem, or network.
|
|
117
|
+
*
|
|
118
|
+
* This is the recommended VirtualComputer for production deployments and
|
|
119
|
+
* untrusted agents. See `LocalComputer` for an unsandboxed local alternative.
|
|
120
|
+
*
|
|
121
|
+
* Uses the non-interactive exec REST endpoint (POST command, receive
|
|
122
|
+
* stdout/stderr/exit_code). The WebSocket exec endpoint can be used for
|
|
123
|
+
* streaming/TTY use cases, but REST is sufficient for tool calls.
|
|
124
|
+
*/
|
|
125
|
+
declare class SpritesComputer implements VirtualComputer {
|
|
126
|
+
private token;
|
|
127
|
+
private spriteName;
|
|
128
|
+
private baseURL;
|
|
129
|
+
private workingDir;
|
|
130
|
+
constructor(opts: SpritesComputerOptions);
|
|
131
|
+
private headers;
|
|
132
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
133
|
+
private shellEscape;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { SpritesComputer, type SpritesComputerOptions, SpritesFs, type SpritesFsOptions, SpritesSandbox, type SpritesSandboxOptions };
|