sandlot 0.1.3 → 0.2.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/dist/browser/bundler.d.ts +68 -0
- package/dist/browser/bundler.d.ts.map +1 -0
- package/dist/browser/executor.d.ts +46 -0
- package/dist/browser/executor.d.ts.map +1 -0
- package/dist/browser/index.d.ts +9 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +2692 -0
- package/dist/browser/preset.d.ts +63 -0
- package/dist/browser/preset.d.ts.map +1 -0
- package/dist/commands/index.d.ts +20 -11
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/types.d.ts +31 -132
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/core/bundler-utils.d.ts +142 -0
- package/dist/core/bundler-utils.d.ts.map +1 -0
- package/dist/core/esm-types-resolver.d.ts +125 -0
- package/dist/core/esm-types-resolver.d.ts.map +1 -0
- package/dist/core/executor.d.ts +35 -0
- package/dist/core/executor.d.ts.map +1 -0
- package/dist/{fs.d.ts → core/fs.d.ts} +27 -29
- package/dist/core/fs.d.ts.map +1 -0
- package/dist/core/sandbox.d.ts +30 -0
- package/dist/core/sandbox.d.ts.map +1 -0
- package/dist/core/sandlot.d.ts +30 -0
- package/dist/core/sandlot.d.ts.map +1 -0
- package/dist/core/shared-module-registry.d.ts +46 -0
- package/dist/core/shared-module-registry.d.ts.map +1 -0
- package/dist/core/typechecker.d.ts +60 -0
- package/dist/core/typechecker.d.ts.map +1 -0
- package/dist/index.d.ts +11 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1405 -2049
- package/dist/node/bundler.d.ts +48 -0
- package/dist/node/bundler.d.ts.map +1 -0
- package/dist/node/executor.d.ts +48 -0
- package/dist/node/executor.d.ts.map +1 -0
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +2646 -0
- package/dist/node/preset.d.ts +62 -0
- package/dist/node/preset.d.ts.map +1 -0
- package/dist/types.d.ts +525 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +27 -8
- package/src/browser/bundler.ts +294 -0
- package/src/browser/executor.ts +71 -0
- package/src/browser/index.ts +57 -0
- package/src/browser/preset.ts +179 -0
- package/src/commands/index.ts +526 -43
- package/src/commands/types.ts +82 -146
- package/src/core/bundler-utils.ts +630 -0
- package/src/core/esm-types-resolver.ts +432 -0
- package/src/core/executor.ts +161 -0
- package/src/{fs.ts → core/fs.ts} +59 -37
- package/src/core/sandbox.ts +621 -0
- package/src/core/sandlot.ts +77 -0
- package/src/core/shared-module-registry.ts +138 -0
- package/src/core/typechecker.ts +607 -0
- package/src/index.ts +104 -139
- package/src/node/bundler.ts +194 -0
- package/src/node/executor.ts +87 -0
- package/src/node/index.ts +39 -0
- package/src/node/preset.ts +178 -0
- package/src/types.ts +668 -0
- package/README.md +0 -243
- package/dist/build-emitter.d.ts +0 -47
- package/dist/build-emitter.d.ts.map +0 -1
- package/dist/builder.d.ts +0 -370
- package/dist/builder.d.ts.map +0 -1
- package/dist/bundler.d.ts +0 -148
- package/dist/bundler.d.ts.map +0 -1
- package/dist/commands/compile.d.ts +0 -13
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/packages.d.ts +0 -17
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/run.d.ts +0 -40
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands.d.ts +0 -179
- package/dist/commands.d.ts.map +0 -1
- package/dist/fs.d.ts.map +0 -1
- package/dist/internal.d.ts +0 -79
- package/dist/internal.d.ts.map +0 -1
- package/dist/internal.js +0 -1976
- package/dist/loader.d.ts +0 -164
- package/dist/loader.d.ts.map +0 -1
- package/dist/packages.d.ts +0 -199
- package/dist/packages.d.ts.map +0 -1
- package/dist/runner.d.ts +0 -314
- package/dist/runner.d.ts.map +0 -1
- package/dist/sandbox-manager.d.ts +0 -261
- package/dist/sandbox-manager.d.ts.map +0 -1
- package/dist/sandbox.d.ts +0 -267
- package/dist/sandbox.d.ts.map +0 -1
- package/dist/shared-modules.d.ts +0 -148
- package/dist/shared-modules.d.ts.map +0 -1
- package/dist/shared-resources.d.ts +0 -102
- package/dist/shared-resources.d.ts.map +0 -1
- package/dist/ts-libs.d.ts +0 -98
- package/dist/ts-libs.d.ts.map +0 -1
- package/dist/typechecker.d.ts +0 -127
- package/dist/typechecker.d.ts.map +0 -1
- package/src/build-emitter.ts +0 -64
- package/src/builder.ts +0 -498
- package/src/bundler.ts +0 -542
- package/src/commands/compile.ts +0 -236
- package/src/commands/packages.ts +0 -154
- package/src/commands/run.ts +0 -245
- package/src/internal.ts +0 -119
- package/src/loader.ts +0 -229
- package/src/packages.ts +0 -936
- package/src/sandbox.ts +0 -396
- package/src/shared-modules.ts +0 -280
- package/src/shared-resources.ts +0 -166
- package/src/ts-libs.ts +0 -320
- package/src/typechecker.ts +0 -635
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SandboxManager - Manages lifecycle and orchestration for multiple sandboxes.
|
|
3
|
-
*
|
|
4
|
-
* When running many sandboxes concurrently (e.g., for multiple AI agents),
|
|
5
|
-
* this manager provides:
|
|
6
|
-
*
|
|
7
|
-
* - ID-based tracking and lookup of sandboxes
|
|
8
|
-
* - Batch operations (saveAll, destroyAll, getDirtySandboxes)
|
|
9
|
-
* - Manager-level default options inherited by all sandboxes
|
|
10
|
-
* - Statistics and introspection
|
|
11
|
-
*
|
|
12
|
-
* Note: Resources (TypeScript libs, bundler) are shared via a global singleton
|
|
13
|
-
* regardless of whether you use the manager or standalone sandbox functions.
|
|
14
|
-
* The manager's value is lifecycle management, not resource efficiency.
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* ```ts
|
|
18
|
-
* const manager = await createSandboxManager();
|
|
19
|
-
*
|
|
20
|
-
* // Create multiple sandboxes with automatic ID tracking
|
|
21
|
-
* const sandbox1 = await manager.createSandbox({ id: "agent-1", ... });
|
|
22
|
-
* const sandbox2 = await manager.createSandbox({ id: "agent-2", ... });
|
|
23
|
-
*
|
|
24
|
-
* // Lookup, batch operations, etc.
|
|
25
|
-
* manager.getSandbox("agent-1");
|
|
26
|
-
* manager.getDirtySandboxes();
|
|
27
|
-
* await manager.saveAll();
|
|
28
|
-
*
|
|
29
|
-
* // Clean up all at once
|
|
30
|
-
* manager.destroyAll();
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
import { defineCommand } from "just-bash/browser";
|
|
34
|
-
import { type IndexedDbFsOptions } from "./fs";
|
|
35
|
-
import { type BundleResult } from "./bundler";
|
|
36
|
-
import { type SharedResources } from "./shared-resources";
|
|
37
|
-
import type { Sandbox, SandboxBashOptions } from "./sandbox";
|
|
38
|
-
/**
|
|
39
|
-
* Options for creating a sandbox via the manager
|
|
40
|
-
*/
|
|
41
|
-
export interface ManagedSandboxOptions {
|
|
42
|
-
/**
|
|
43
|
-
* Unique identifier for this sandbox.
|
|
44
|
-
*
|
|
45
|
-
* Also used as the IndexedDB database name if `fsOptions.dbName` is not provided
|
|
46
|
-
* and `inMemory` is false. If both are provided, `fsOptions.dbName` takes precedence.
|
|
47
|
-
*
|
|
48
|
-
* @default Auto-generated as "sandbox-1", "sandbox-2", etc.
|
|
49
|
-
*/
|
|
50
|
-
id?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Options for the IndexedDB filesystem.
|
|
53
|
-
*
|
|
54
|
-
* Note: `fsOptions.dbName` takes precedence over `id` for the database name.
|
|
55
|
-
* If neither is provided, the auto-generated `id` is used.
|
|
56
|
-
*/
|
|
57
|
-
fsOptions?: IndexedDbFsOptions;
|
|
58
|
-
/**
|
|
59
|
-
* Initial files to populate the filesystem with
|
|
60
|
-
*/
|
|
61
|
-
initialFiles?: Record<string, string>;
|
|
62
|
-
/**
|
|
63
|
-
* Path to tsconfig.json in the virtual filesystem.
|
|
64
|
-
* Default: "/tsconfig.json"
|
|
65
|
-
*/
|
|
66
|
-
tsconfigPath?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Callback invoked when a build succeeds.
|
|
69
|
-
* Receives the bundle result with the compiled code.
|
|
70
|
-
*/
|
|
71
|
-
onBuild?: (result: BundleResult) => void | Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Additional custom commands to add to the bash environment
|
|
74
|
-
*/
|
|
75
|
-
customCommands?: ReturnType<typeof defineCommand>[];
|
|
76
|
-
/**
|
|
77
|
-
* If true, use in-memory filesystem only (no IndexedDB persistence).
|
|
78
|
-
* Default: true
|
|
79
|
-
*/
|
|
80
|
-
inMemory?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Module IDs that should be resolved from the host's SharedModuleRegistry
|
|
83
|
-
* instead of esm.sh CDN. Overrides manager-level sharedModules for this sandbox.
|
|
84
|
-
*
|
|
85
|
-
* @see SandboxOptions.sharedModules for full documentation
|
|
86
|
-
*/
|
|
87
|
-
sharedModules?: string[];
|
|
88
|
-
/**
|
|
89
|
-
* Options passed through to the just-bash Bash constructor.
|
|
90
|
-
* Overrides manager-level bashOptions for this sandbox.
|
|
91
|
-
*
|
|
92
|
-
* @see SandboxOptions.bashOptions for full documentation
|
|
93
|
-
*/
|
|
94
|
-
bashOptions?: SandboxBashOptions;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A sandbox instance managed by the SandboxManager.
|
|
98
|
-
*
|
|
99
|
-
* Extends the base Sandbox interface with an `id` property for
|
|
100
|
-
* identification within the manager. This ensures ManagedSandbox
|
|
101
|
-
* has full feature parity with Sandbox.
|
|
102
|
-
*/
|
|
103
|
-
export interface ManagedSandbox extends Sandbox {
|
|
104
|
-
/**
|
|
105
|
-
* Unique identifier for this sandbox within the manager.
|
|
106
|
-
*/
|
|
107
|
-
id: string;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Statistics about the sandbox manager
|
|
111
|
-
*/
|
|
112
|
-
export interface SandboxManagerStats {
|
|
113
|
-
/**
|
|
114
|
-
* Whether shared resources have been initialized
|
|
115
|
-
*/
|
|
116
|
-
initialized: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Number of currently active sandboxes
|
|
119
|
-
*/
|
|
120
|
-
activeSandboxes: number;
|
|
121
|
-
/**
|
|
122
|
-
* Number of TypeScript lib files loaded
|
|
123
|
-
*/
|
|
124
|
-
libFilesCount: number;
|
|
125
|
-
/**
|
|
126
|
-
* IDs of active sandboxes
|
|
127
|
-
*/
|
|
128
|
-
sandboxIds: string[];
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Options for creating a SandboxManager
|
|
132
|
-
*/
|
|
133
|
-
export interface SandboxManagerOptions {
|
|
134
|
-
/**
|
|
135
|
-
* Default shared modules for all sandboxes created by this manager.
|
|
136
|
-
* Individual sandboxes can override with their own sharedModules option.
|
|
137
|
-
*
|
|
138
|
-
* Module IDs that should be resolved from the host's SharedModuleRegistry
|
|
139
|
-
* instead of esm.sh CDN. The host must have registered these modules
|
|
140
|
-
* using `registerSharedModules()` before loading dynamic code.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```ts
|
|
144
|
-
* const manager = await createSandboxManager({
|
|
145
|
-
* sharedModules: ['react', 'react-dom/client'],
|
|
146
|
-
* });
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
sharedModules?: string[];
|
|
150
|
-
/**
|
|
151
|
-
* Default bash options for all sandboxes created by this manager.
|
|
152
|
-
* Individual sandboxes can override with their own bashOptions.
|
|
153
|
-
*
|
|
154
|
-
* @see SandboxOptions.bashOptions for full documentation
|
|
155
|
-
*/
|
|
156
|
-
bashOptions?: SandboxBashOptions;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Manager for creating and managing multiple sandboxes.
|
|
160
|
-
*
|
|
161
|
-
* Provides lifecycle management, ID-based tracking, and batch operations
|
|
162
|
-
* for multiple concurrent sandboxes. Resources (TypeScript libs, bundler)
|
|
163
|
-
* are shared via a global singleton.
|
|
164
|
-
*/
|
|
165
|
-
export declare class SandboxManager {
|
|
166
|
-
private resources;
|
|
167
|
-
private sandboxes;
|
|
168
|
-
private initialized;
|
|
169
|
-
private initPromise;
|
|
170
|
-
private nextId;
|
|
171
|
-
private options;
|
|
172
|
-
constructor(options?: SandboxManagerOptions);
|
|
173
|
-
/**
|
|
174
|
-
* Initialize the manager by loading shared resources.
|
|
175
|
-
* Called automatically on first sandbox creation, but can be called
|
|
176
|
-
* explicitly to pre-warm the global resource cache.
|
|
177
|
-
*/
|
|
178
|
-
initialize(): Promise<void>;
|
|
179
|
-
private doInitialize;
|
|
180
|
-
/**
|
|
181
|
-
* Create a new managed sandbox.
|
|
182
|
-
* The sandbox is tracked by the manager and can be looked up by ID.
|
|
183
|
-
*/
|
|
184
|
-
createSandbox(options?: ManagedSandboxOptions): Promise<ManagedSandbox>;
|
|
185
|
-
/**
|
|
186
|
-
* Get a sandbox by ID
|
|
187
|
-
*/
|
|
188
|
-
getSandbox(id: string): ManagedSandbox | undefined;
|
|
189
|
-
/**
|
|
190
|
-
* Get all active sandboxes
|
|
191
|
-
*/
|
|
192
|
-
getAllSandboxes(): ManagedSandbox[];
|
|
193
|
-
/**
|
|
194
|
-
* Close a specific sandbox
|
|
195
|
-
*/
|
|
196
|
-
closeSandbox(id: string): boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Close all sandboxes managed by this manager.
|
|
199
|
-
* Does not affect the global shared resources.
|
|
200
|
-
*/
|
|
201
|
-
destroyAll(): void;
|
|
202
|
-
/**
|
|
203
|
-
* Save all sandboxes that have unsaved changes.
|
|
204
|
-
*
|
|
205
|
-
* @returns Map of sandbox ID to save result (true if saved, false if nothing to save)
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* ```ts
|
|
209
|
-
* const results = await manager.saveAll();
|
|
210
|
-
* for (const [id, saved] of results) {
|
|
211
|
-
* console.log(`${id}: ${saved ? 'saved' : 'no changes'}`);
|
|
212
|
-
* }
|
|
213
|
-
* ```
|
|
214
|
-
*/
|
|
215
|
-
saveAll(): Promise<Map<string, boolean>>;
|
|
216
|
-
/**
|
|
217
|
-
* Get IDs of sandboxes with unsaved changes.
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* ```ts
|
|
221
|
-
* const dirtyIds = manager.getDirtySandboxes();
|
|
222
|
-
* if (dirtyIds.length > 0) {
|
|
223
|
-
* console.log('Unsaved sandboxes:', dirtyIds.join(', '));
|
|
224
|
-
* }
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
getDirtySandboxes(): string[];
|
|
228
|
-
/**
|
|
229
|
-
* Get statistics about the manager
|
|
230
|
-
*/
|
|
231
|
-
getStats(): SandboxManagerStats;
|
|
232
|
-
/**
|
|
233
|
-
* Get the shared resources (for advanced use cases)
|
|
234
|
-
*/
|
|
235
|
-
getResources(): SharedResources | null;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Create a new SandboxManager instance.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```ts
|
|
242
|
-
* const manager = await createSandboxManager();
|
|
243
|
-
*
|
|
244
|
-
* // Create multiple sandboxes concurrently
|
|
245
|
-
* const [sandbox1, sandbox2] = await Promise.all([
|
|
246
|
-
* manager.createSandbox({ id: "agent-1", initialFiles: { ... } }),
|
|
247
|
-
* manager.createSandbox({ id: "agent-2", initialFiles: { ... } }),
|
|
248
|
-
* ]);
|
|
249
|
-
*
|
|
250
|
-
* // Run operations in parallel
|
|
251
|
-
* const [result1, result2] = await Promise.all([
|
|
252
|
-
* sandbox1.bash.exec("build"),
|
|
253
|
-
* sandbox2.bash.exec("build"),
|
|
254
|
-
* ]);
|
|
255
|
-
*
|
|
256
|
-
* // Clean up
|
|
257
|
-
* manager.destroyAll();
|
|
258
|
-
* ```
|
|
259
|
-
*/
|
|
260
|
-
export declare function createSandboxManager(options?: SandboxManagerOptions): Promise<SandboxManager>;
|
|
261
|
-
//# sourceMappingURL=sandbox-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|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BG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,cAAc,CAAC,CAIzB"}
|
package/dist/sandbox.d.ts
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import { Bash, defineCommand, type BashOptions } from "just-bash/browser";
|
|
2
|
-
import { Filesystem } from "./fs";
|
|
3
|
-
import { type BuildOutput, type ValidateFn } from "./commands";
|
|
4
|
-
import { type SharedResources } from "./shared-resources";
|
|
5
|
-
/**
|
|
6
|
-
* Options that can be passed through to the just-bash Bash constructor.
|
|
7
|
-
* Excludes options that sandlot controls internally (fs, customCommands, files).
|
|
8
|
-
*/
|
|
9
|
-
export type SandboxBashOptions = Omit<BashOptions, 'fs' | 'customCommands' | 'files'>;
|
|
10
|
-
/**
|
|
11
|
-
* Options for creating a sandbox environment
|
|
12
|
-
*/
|
|
13
|
-
export interface SandboxOptions {
|
|
14
|
-
/**
|
|
15
|
-
* Initial files to populate the filesystem with.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const sandbox = await createSandbox({
|
|
20
|
-
* initialFiles: {
|
|
21
|
-
* '/src/index.ts': 'export const x = 1;',
|
|
22
|
-
* '/tsconfig.json': JSON.stringify({ compilerOptions: { strict: true } }),
|
|
23
|
-
* },
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
initialFiles?: Record<string, string>;
|
|
28
|
-
/**
|
|
29
|
-
* Maximum filesystem size in bytes (default: 50MB)
|
|
30
|
-
*/
|
|
31
|
-
maxFilesystemSize?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Path to tsconfig.json in the virtual filesystem.
|
|
34
|
-
* Default: "/tsconfig.json"
|
|
35
|
-
*/
|
|
36
|
-
tsconfigPath?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Shared resources (lib files, bundler).
|
|
39
|
-
* If not provided, uses the default singleton resources.
|
|
40
|
-
*
|
|
41
|
-
* Provide this to share resources across multiple sandboxes,
|
|
42
|
-
* or to use custom TypeScript libs.
|
|
43
|
-
*/
|
|
44
|
-
resources?: SharedResources;
|
|
45
|
-
/**
|
|
46
|
-
* Callback invoked when a build succeeds.
|
|
47
|
-
* Receives the build output with the bundle and loaded module.
|
|
48
|
-
*
|
|
49
|
-
* For agent workflows, prefer using `createBuilder()` which handles
|
|
50
|
-
* build capture automatically.
|
|
51
|
-
*/
|
|
52
|
-
onBuild?: (result: BuildOutput) => void | Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Additional custom commands to add to the bash environment
|
|
55
|
-
*/
|
|
56
|
-
customCommands?: ReturnType<typeof defineCommand>[];
|
|
57
|
-
/**
|
|
58
|
-
* Module IDs that should be resolved from the host's SharedModuleRegistry
|
|
59
|
-
* instead of esm.sh CDN. The host must have registered these modules
|
|
60
|
-
* using `registerSharedModules()` before loading dynamic code.
|
|
61
|
-
*
|
|
62
|
-
* This solves the "multiple React instances" problem by allowing dynamic
|
|
63
|
-
* components to share the same React instance as the host application.
|
|
64
|
-
*
|
|
65
|
-
* Type definitions are automatically installed for these modules so that
|
|
66
|
-
* TypeScript can typecheck code that imports them.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* // Host setup
|
|
71
|
-
* import * as React from 'react';
|
|
72
|
-
* import * as ReactDOM from 'react-dom/client';
|
|
73
|
-
* import { registerSharedModules } from 'sandlot';
|
|
74
|
-
*
|
|
75
|
-
* registerSharedModules({
|
|
76
|
-
* 'react': React,
|
|
77
|
-
* 'react-dom/client': ReactDOM,
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* // Create sandbox with shared modules (types auto-installed)
|
|
81
|
-
* const sandbox = await createSandbox({
|
|
82
|
-
* sharedModules: ['react', 'react-dom/client'],
|
|
83
|
-
* });
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
sharedModules?: string[];
|
|
87
|
-
/**
|
|
88
|
-
* Options passed through to the just-bash Bash constructor.
|
|
89
|
-
* Use this to configure environment variables, execution limits,
|
|
90
|
-
* network access, logging, and other bash-level settings.
|
|
91
|
-
*
|
|
92
|
-
* Note: `fs`, `customCommands`, and `files` are controlled by sandlot
|
|
93
|
-
* and cannot be overridden here.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* const sandbox = await createSandbox({
|
|
98
|
-
* bashOptions: {
|
|
99
|
-
* cwd: '/src',
|
|
100
|
-
* env: { NODE_ENV: 'development' },
|
|
101
|
-
* executionLimits: { maxCommandCount: 1000 },
|
|
102
|
-
* },
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
bashOptions?: SandboxBashOptions;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Sandbox state that can be serialized for persistence.
|
|
110
|
-
*/
|
|
111
|
-
export interface SandboxState {
|
|
112
|
-
/**
|
|
113
|
-
* All files in the filesystem as path -> content mapping.
|
|
114
|
-
* Can be passed as `initialFiles` when creating a new sandbox.
|
|
115
|
-
*/
|
|
116
|
-
files: Record<string, string>;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* The sandbox environment containing the filesystem and bash shell
|
|
120
|
-
*/
|
|
121
|
-
export interface Sandbox {
|
|
122
|
-
/**
|
|
123
|
-
* The virtual filesystem
|
|
124
|
-
*/
|
|
125
|
-
fs: Filesystem;
|
|
126
|
-
/**
|
|
127
|
-
* The just-bash shell environment
|
|
128
|
-
*/
|
|
129
|
-
bash: Bash;
|
|
130
|
-
/**
|
|
131
|
-
* The last successful build output, or null if no build has succeeded yet.
|
|
132
|
-
*
|
|
133
|
-
* This is updated automatically whenever a `build` command succeeds.
|
|
134
|
-
* Contains both the bundle and the loaded (and validated, if applicable) module.
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* ```ts
|
|
138
|
-
* // Agent loop pattern
|
|
139
|
-
* while (!sandbox.lastBuild) {
|
|
140
|
-
* const response = await agent.step();
|
|
141
|
-
* await sandbox.bash.exec(response.command);
|
|
142
|
-
* }
|
|
143
|
-
* // Build succeeded, sandbox.lastBuild contains bundle + module
|
|
144
|
-
* const App = sandbox.lastBuild.module.App;
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
lastBuild: BuildOutput | null;
|
|
148
|
-
/**
|
|
149
|
-
* Get the current sandbox state for persistence.
|
|
150
|
-
*
|
|
151
|
-
* Returns a serializable object containing all files that can be
|
|
152
|
-
* JSON-serialized and used to restore the sandbox later.
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* ```ts
|
|
156
|
-
* // Save sandbox state
|
|
157
|
-
* const state = sandbox.getState();
|
|
158
|
-
* localStorage.setItem('my-project', JSON.stringify(state));
|
|
159
|
-
*
|
|
160
|
-
* // Later, restore the sandbox
|
|
161
|
-
* const saved = JSON.parse(localStorage.getItem('my-project'));
|
|
162
|
-
* const sandbox2 = await createSandbox({ initialFiles: saved.files });
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
getState(): SandboxState;
|
|
166
|
-
/**
|
|
167
|
-
* Subscribe to build events. Called whenever a build succeeds.
|
|
168
|
-
* Returns an unsubscribe function.
|
|
169
|
-
*
|
|
170
|
-
* For agent workflows, prefer using `createBuilder()` which handles
|
|
171
|
-
* build capture automatically. Use `onBuild` directly when you need
|
|
172
|
-
* more control over the subscription lifecycle.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* ```ts
|
|
176
|
-
* let lastBuild: BuildOutput | null = null;
|
|
177
|
-
* const unsubscribe = sandbox.onBuild((result) => {
|
|
178
|
-
* lastBuild = result;
|
|
179
|
-
* });
|
|
180
|
-
*
|
|
181
|
-
* await sandbox.bash.exec('build /src/index.ts');
|
|
182
|
-
* unsubscribe();
|
|
183
|
-
*
|
|
184
|
-
* if (lastBuild) {
|
|
185
|
-
* const App = lastBuild.module.App as React.ComponentType;
|
|
186
|
-
* }
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
onBuild(callback: (result: BuildOutput) => void | Promise<void>): () => void;
|
|
190
|
-
/**
|
|
191
|
-
* Set a validation function for the build command.
|
|
192
|
-
*
|
|
193
|
-
* When set, the build command will run this function after loading
|
|
194
|
-
* the module. If validation throws, the build fails and the agent
|
|
195
|
-
* sees the error. If validation passes, the validated module is
|
|
196
|
-
* available in the build output.
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```ts
|
|
200
|
-
* sandbox.setValidation((mod) => {
|
|
201
|
-
* if (!mod.App) throw new Error("Must export App component");
|
|
202
|
-
* return { App: mod.App as React.ComponentType };
|
|
203
|
-
* });
|
|
204
|
-
*
|
|
205
|
-
* // Now build will fail if App is missing
|
|
206
|
-
* await sandbox.bash.exec('build /src/index.ts');
|
|
207
|
-
* ```
|
|
208
|
-
*/
|
|
209
|
-
setValidation(fn: ValidateFn): void;
|
|
210
|
-
/**
|
|
211
|
-
* Clear the validation function.
|
|
212
|
-
* After calling this, builds will not perform validation.
|
|
213
|
-
*/
|
|
214
|
-
clearValidation(): void;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Create an in-browser agent sandbox with a virtual filesystem, TypeScript
|
|
218
|
-
* type checking, and bundling capabilities.
|
|
219
|
-
*
|
|
220
|
-
* The sandbox provides a just-bash shell with custom commands:
|
|
221
|
-
* - `tsc [entry]` - Type check the project
|
|
222
|
-
* - `build [entry] [options]` - Build the project (runs typecheck first)
|
|
223
|
-
* - `install <pkg>` - Install npm packages
|
|
224
|
-
* - `uninstall <pkg>` - Remove packages
|
|
225
|
-
* - `list` - List installed packages
|
|
226
|
-
* - `run <entry>` - Run a script
|
|
227
|
-
*
|
|
228
|
-
* Build options:
|
|
229
|
-
* - `--format, -f <esm|iife|cjs>` - Output format (default: esm)
|
|
230
|
-
* - `--minify, -m` - Enable minification
|
|
231
|
-
* - `--skip-typecheck, -s` - Skip type checking
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```ts
|
|
235
|
-
* let bundleResult: BundleResult | null = null;
|
|
236
|
-
*
|
|
237
|
-
* const sandbox = await createSandbox({
|
|
238
|
-
* initialFiles: {
|
|
239
|
-
* '/src/index.ts': 'export const hello = "world";',
|
|
240
|
-
* '/tsconfig.json': JSON.stringify({
|
|
241
|
-
* compilerOptions: { target: 'ES2020', strict: true }
|
|
242
|
-
* }),
|
|
243
|
-
* },
|
|
244
|
-
* onBuild: (result) => {
|
|
245
|
-
* bundleResult = result;
|
|
246
|
-
* },
|
|
247
|
-
* });
|
|
248
|
-
*
|
|
249
|
-
* // Use bash commands
|
|
250
|
-
* await sandbox.bash.exec('echo "console.log(1);" > /src/index.ts');
|
|
251
|
-
*
|
|
252
|
-
* // Type check
|
|
253
|
-
* const tscResult = await sandbox.bash.exec('tsc /src/index.ts');
|
|
254
|
-
* console.log(tscResult.stdout);
|
|
255
|
-
*
|
|
256
|
-
* // Build (includes typecheck, triggers onBuild callback)
|
|
257
|
-
* const buildResult = await sandbox.bash.exec('build /src/index.ts');
|
|
258
|
-
* console.log(buildResult.stdout);
|
|
259
|
-
* console.log(bundleResult?.code); // The compiled bundle
|
|
260
|
-
*
|
|
261
|
-
* // Save state for later
|
|
262
|
-
* const state = sandbox.getState();
|
|
263
|
-
* localStorage.setItem('my-project', JSON.stringify(state));
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
export declare function createSandbox(options?: SandboxOptions): Promise<Sandbox>;
|
|
267
|
-
//# sourceMappingURL=sandbox.d.ts.map
|
package/dist/sandbox.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAA0B,MAAM,MAAM,CA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BG;IACH,QAAQ,IAAI,YAAY,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC;IAE7E;;;;;;;;;;;;;;;;;;OAkBG;IACH,aAAa,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAAC;IAEpC;;;OAGG;IACH,eAAe,IAAI,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CA4GlF"}
|
package/dist/shared-modules.d.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Module Registry for Sandlot
|
|
3
|
-
*
|
|
4
|
-
* Allows host applications to register their module instances (like React)
|
|
5
|
-
* so that dynamically bundled code can use the same instances instead of
|
|
6
|
-
* loading separate copies from esm.sh CDN.
|
|
7
|
-
*
|
|
8
|
-
* This solves the "multiple React instances" problem where hooks fail
|
|
9
|
-
* because the host and dynamic code use different React copies.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* // Host application setup
|
|
14
|
-
* import * as React from 'react';
|
|
15
|
-
* import * as ReactDOM from 'react-dom/client';
|
|
16
|
-
* import { registerSharedModules } from 'sandlot';
|
|
17
|
-
*
|
|
18
|
-
* registerSharedModules({
|
|
19
|
-
* 'react': React,
|
|
20
|
-
* 'react-dom/client': ReactDOM,
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* // Now create sandbox with sharedModules option
|
|
24
|
-
* const sandbox = await createSandbox({
|
|
25
|
-
* sharedModules: ['react', 'react-dom/client'],
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* Registry for sharing host modules with dynamic bundles.
|
|
31
|
-
* Modules registered here will be used instead of esm.sh CDN
|
|
32
|
-
* when the sandbox is configured with matching sharedModules.
|
|
33
|
-
*/
|
|
34
|
-
export declare class SharedModuleRegistry {
|
|
35
|
-
private modules;
|
|
36
|
-
private exportNames;
|
|
37
|
-
constructor();
|
|
38
|
-
/**
|
|
39
|
-
* Register a module to be shared with dynamic bundles.
|
|
40
|
-
* Automatically introspects the module to discover its exports.
|
|
41
|
-
*
|
|
42
|
-
* @param moduleId - The import specifier (e.g., 'react', 'react-dom/client')
|
|
43
|
-
* @param module - The module's exports object
|
|
44
|
-
* @returns this for chaining
|
|
45
|
-
*/
|
|
46
|
-
register(moduleId: string, module: unknown): this;
|
|
47
|
-
/**
|
|
48
|
-
* Register multiple modules at once.
|
|
49
|
-
* Automatically introspects each module to discover its exports.
|
|
50
|
-
*
|
|
51
|
-
* @param modules - Object mapping module IDs to their exports
|
|
52
|
-
* @returns this for chaining
|
|
53
|
-
*/
|
|
54
|
-
registerAll(modules: Record<string, unknown>): this;
|
|
55
|
-
/**
|
|
56
|
-
* Unregister a previously registered module
|
|
57
|
-
*
|
|
58
|
-
* @param moduleId - The import specifier to remove
|
|
59
|
-
* @returns true if the module was registered and removed
|
|
60
|
-
*/
|
|
61
|
-
unregister(moduleId: string): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Get a registered module (used by dynamic bundles at runtime)
|
|
64
|
-
*
|
|
65
|
-
* @param moduleId - The import specifier
|
|
66
|
-
* @returns The registered module exports
|
|
67
|
-
* @throws Error if the module is not registered
|
|
68
|
-
*/
|
|
69
|
-
get(moduleId: string): unknown;
|
|
70
|
-
/**
|
|
71
|
-
* Check if a module is registered
|
|
72
|
-
*
|
|
73
|
-
* @param moduleId - The import specifier to check
|
|
74
|
-
*/
|
|
75
|
-
has(moduleId: string): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Get list of all registered module IDs
|
|
78
|
-
*/
|
|
79
|
-
list(): string[];
|
|
80
|
-
/**
|
|
81
|
-
* Get the export names for a registered module.
|
|
82
|
-
* These were discovered by introspecting the module at registration time.
|
|
83
|
-
*
|
|
84
|
-
* @param moduleId - The import specifier
|
|
85
|
-
* @returns Array of export names, or empty array if not registered
|
|
86
|
-
*/
|
|
87
|
-
getExportNames(moduleId: string): string[];
|
|
88
|
-
/**
|
|
89
|
-
* Clear all registrations
|
|
90
|
-
*/
|
|
91
|
-
clear(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Get the number of registered modules
|
|
94
|
-
*/
|
|
95
|
-
get size(): number;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get the default shared module registry.
|
|
99
|
-
* Creates it if it doesn't exist.
|
|
100
|
-
*/
|
|
101
|
-
export declare function getSharedModuleRegistry(): SharedModuleRegistry;
|
|
102
|
-
/**
|
|
103
|
-
* Check if a shared module registry exists on globalThis
|
|
104
|
-
*/
|
|
105
|
-
export declare function hasSharedModuleRegistry(): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Convenience function to register modules with the default registry.
|
|
108
|
-
*
|
|
109
|
-
* @param modules - Object mapping module IDs to their exports
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```ts
|
|
113
|
-
* import * as React from 'react';
|
|
114
|
-
* import * as ReactDOM from 'react-dom/client';
|
|
115
|
-
* import { registerSharedModules } from 'sandlot';
|
|
116
|
-
*
|
|
117
|
-
* registerSharedModules({
|
|
118
|
-
* 'react': React,
|
|
119
|
-
* 'react-dom/client': ReactDOM,
|
|
120
|
-
* });
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
export declare function registerSharedModules(modules: Record<string, unknown>): void;
|
|
124
|
-
/**
|
|
125
|
-
* Convenience function to unregister a module from the default registry.
|
|
126
|
-
*
|
|
127
|
-
* @param moduleId - The import specifier to remove
|
|
128
|
-
* @returns true if the module was registered and removed
|
|
129
|
-
*/
|
|
130
|
-
export declare function unregisterSharedModule(moduleId: string): boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Clear all shared modules from the default registry.
|
|
133
|
-
*/
|
|
134
|
-
export declare function clearSharedModules(): void;
|
|
135
|
-
/**
|
|
136
|
-
* Get the export names for a registered shared module.
|
|
137
|
-
* Used by the bundler to generate proper re-export statements.
|
|
138
|
-
*
|
|
139
|
-
* @param moduleId - The import specifier
|
|
140
|
-
* @returns Array of export names, or empty array if not registered
|
|
141
|
-
*/
|
|
142
|
-
export declare function getSharedModuleExports(moduleId: string): string[];
|
|
143
|
-
/**
|
|
144
|
-
* Generate the runtime code that dynamic bundles use to access shared modules.
|
|
145
|
-
* This is injected into bundles when they import from shared modules.
|
|
146
|
-
*/
|
|
147
|
-
export declare function getSharedModuleRuntimeCode(moduleId: string): string;
|
|
148
|
-
//# sourceMappingURL=shared-modules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared-modules.d.ts","sourceRoot":"","sources":["../src/shared-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH;;;;GAIG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,WAAW,CAA+B;;IAOlD;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAOjD;;;;;;OAMG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAOnD;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrC;;;;;;OAMG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAa9B;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;;;;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