deepagents 1.7.0 → 1.7.1
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 +3 -3
- package/dist/index.cjs +50 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -100
- package/dist/index.d.ts +42 -100
- package/dist/index.js +50 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -346,119 +346,61 @@ interface SandboxDeleteOptions {
|
|
|
346
346
|
sandboxId: string;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* Common error codes shared across all sandbox provider implementations.
|
|
350
350
|
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* lifecycle operations (list, getOrCreate, delete).
|
|
354
|
-
*
|
|
355
|
-
* This interface separates lifecycle management from sandbox execution:
|
|
356
|
-
* - `SandboxProvider` handles lifecycle (list, create, delete)
|
|
357
|
-
* - `SandboxBackendProtocol` handles execution (execute, file operations)
|
|
358
|
-
*
|
|
359
|
-
* @typeParam MetadataT - Type of the metadata field in sandbox listings.
|
|
360
|
-
* Providers can define their own interface for type-safe metadata access.
|
|
351
|
+
* These represent the core error conditions that any sandbox provider may encounter.
|
|
352
|
+
* Provider-specific error codes should extend this type with additional codes.
|
|
361
353
|
*
|
|
362
354
|
* @example
|
|
363
355
|
* ```typescript
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
356
|
+
* // Provider-specific error code type extending the common codes:
|
|
357
|
+
* type MySandboxErrorCode = SandboxErrorCode | "CUSTOM_ERROR";
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
type SandboxErrorCode = /** Sandbox has not been initialized - call initialize() first */"NOT_INITIALIZED" /** Sandbox is already initialized - cannot initialize twice */ | "ALREADY_INITIALIZED" /** Command execution timed out */ | "COMMAND_TIMEOUT" /** Command execution failed */ | "COMMAND_FAILED" /** File operation (read/write) failed */ | "FILE_OPERATION_FAILED";
|
|
361
|
+
declare const SANDBOX_ERROR_SYMBOL: unique symbol;
|
|
362
|
+
/**
|
|
363
|
+
* Custom error class for sandbox operations.
|
|
368
364
|
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* return { items: [...], cursor: null };
|
|
373
|
-
* }
|
|
365
|
+
* @param message - Human-readable error description
|
|
366
|
+
* @param code - Structured error code for programmatic handling
|
|
367
|
+
* @returns SandboxError with message and code
|
|
374
368
|
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* try {
|
|
372
|
+
* await sandbox.execute("some command");
|
|
373
|
+
* } catch (error) {
|
|
374
|
+
* if (error instanceof SandboxError) {
|
|
375
|
+
* switch (error.code) {
|
|
376
|
+
* case "NOT_INITIALIZED":
|
|
377
|
+
* await sandbox.initialize();
|
|
378
|
+
* break;
|
|
379
|
+
* case "COMMAND_TIMEOUT":
|
|
380
|
+
* console.error("Command took too long");
|
|
381
|
+
* break;
|
|
382
|
+
* default:
|
|
383
|
+
* throw error;
|
|
378
384
|
* }
|
|
379
|
-
* return this.create();
|
|
380
|
-
* }
|
|
381
|
-
*
|
|
382
|
-
* async delete(options: SandboxDeleteOptions): Promise<void> {
|
|
383
|
-
* // Idempotent - no error if already deleted
|
|
384
|
-
* await this.client.delete(options.sandboxId);
|
|
385
385
|
* }
|
|
386
386
|
* }
|
|
387
|
-
*
|
|
388
|
-
* // Usage
|
|
389
|
-
* const provider = new MySandboxProvider();
|
|
390
|
-
* const sandbox = await provider.getOrCreate();
|
|
391
|
-
* const result = await sandbox.execute("echo hello");
|
|
392
|
-
* await provider.delete({ sandboxId: sandbox.id });
|
|
393
387
|
* ```
|
|
394
388
|
*/
|
|
395
|
-
|
|
389
|
+
declare class SandboxError extends Error {
|
|
390
|
+
readonly code: string;
|
|
391
|
+
readonly cause?: Error | undefined;
|
|
392
|
+
/** Symbol for identifying sandbox error instances */
|
|
393
|
+
[SANDBOX_ERROR_SYMBOL]: true;
|
|
394
|
+
/** Error name for instanceof checks and logging */
|
|
395
|
+
readonly name: string;
|
|
396
396
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* @param options - Optional list options including cursor for pagination
|
|
400
|
-
* @returns Paginated list of sandbox metadata
|
|
397
|
+
* Creates a new SandboxError.
|
|
401
398
|
*
|
|
402
|
-
* @
|
|
403
|
-
*
|
|
404
|
-
* // First page
|
|
405
|
-
* const response = await provider.list();
|
|
406
|
-
* for (const sandbox of response.items) {
|
|
407
|
-
* console.log(sandbox.sandboxId);
|
|
408
|
-
* }
|
|
409
|
-
*
|
|
410
|
-
* // Next page if available
|
|
411
|
-
* if (response.cursor) {
|
|
412
|
-
* const nextPage = await provider.list({ cursor: response.cursor });
|
|
413
|
-
* }
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
list(options?: SandboxListOptions): Promise<SandboxListResponse<MetadataT>>;
|
|
417
|
-
/**
|
|
418
|
-
* Get an existing sandbox or create a new one.
|
|
419
|
-
*
|
|
420
|
-
* If sandboxId is provided, retrieves the existing sandbox. If the sandbox
|
|
421
|
-
* doesn't exist, throws an error (does NOT create a new one).
|
|
422
|
-
*
|
|
423
|
-
* If sandboxId is undefined, creates a new sandbox instance.
|
|
424
|
-
*
|
|
425
|
-
* @param options - Optional options including sandboxId to retrieve
|
|
426
|
-
* @returns A sandbox instance implementing SandboxBackendProtocol
|
|
427
|
-
* @throws Error if sandboxId is provided but the sandbox doesn't exist
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```typescript
|
|
431
|
-
* // Create a new sandbox
|
|
432
|
-
* const sandbox = await provider.getOrCreate();
|
|
433
|
-
* console.log(sandbox.id); // "sb_new123"
|
|
434
|
-
*
|
|
435
|
-
* // Reconnect to existing sandbox
|
|
436
|
-
* const existing = await provider.getOrCreate({ sandboxId: "sb_new123" });
|
|
437
|
-
*
|
|
438
|
-
* // Use the sandbox
|
|
439
|
-
* const result = await sandbox.execute("node --version");
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
getOrCreate(options?: SandboxGetOrCreateOptions): Promise<SandboxBackendProtocol>;
|
|
443
|
-
/**
|
|
444
|
-
* Delete a sandbox instance.
|
|
445
|
-
*
|
|
446
|
-
* This permanently destroys the sandbox and all its associated data.
|
|
447
|
-
* The operation is idempotent - calling delete on a non-existent sandbox
|
|
448
|
-
* should succeed without raising an error.
|
|
449
|
-
*
|
|
450
|
-
* @param options - Options including the sandboxId to delete
|
|
451
|
-
*
|
|
452
|
-
* @example
|
|
453
|
-
* ```typescript
|
|
454
|
-
* // Simple deletion
|
|
455
|
-
* await provider.delete({ sandboxId: "sb_123" });
|
|
456
|
-
*
|
|
457
|
-
* // Safe to call multiple times (idempotent)
|
|
458
|
-
* await provider.delete({ sandboxId: "sb_123" }); // No error
|
|
459
|
-
* ```
|
|
399
|
+
* @param message - Human-readable error description
|
|
400
|
+
* @param code - Structured error code for programmatic handling
|
|
460
401
|
*/
|
|
461
|
-
|
|
402
|
+
constructor(message: string, code: string, cause?: Error | undefined);
|
|
403
|
+
static isInstance(error: unknown): error is SandboxError;
|
|
462
404
|
}
|
|
463
405
|
/**
|
|
464
406
|
* State and store container for backend initialization.
|
|
@@ -2196,5 +2138,5 @@ declare function parseSkillMetadata(skillMdPath: string, source: "user" | "proje
|
|
|
2196
2138
|
*/
|
|
2197
2139
|
declare function listSkills(options: ListSkillsOptions): SkillMetadata[];
|
|
2198
2140
|
//#endregion
|
|
2199
|
-
export { type AgentMemoryMiddlewareOptions, type BackendFactory, type BackendProtocol, BaseSandbox, type CompiledSubAgent, CompositeBackend, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FlattenSubAgentMiddleware, GENERAL_PURPOSE_SUBAGENT, type GrepMatch, type InferDeepAgentSubagents, type InferDeepAgentType, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type ResolveDeepAgentTypeConfig, type SandboxBackendProtocol, type SandboxDeleteOptions, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type
|
|
2141
|
+
export { type AgentMemoryMiddlewareOptions, type BackendFactory, type BackendProtocol, BaseSandbox, type CompiledSubAgent, CompositeBackend, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FlattenSubAgentMiddleware, GENERAL_PURPOSE_SUBAGENT, type GrepMatch, type InferDeepAgentSubagents, type InferDeepAgentType, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type ResolveDeepAgentTypeConfig, type SandboxBackendProtocol, type SandboxDeleteOptions, SandboxError, type SandboxErrorCode, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type Settings, type SettingsOptions, type SkillMetadata$1 as SkillMetadata, type SkillsMiddlewareOptions, StateBackend, StoreBackend, type SubAgent, type SubAgentMiddlewareOptions, TASK_SYSTEM_PROMPT, type WriteResult, createAgentMemoryMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgentMiddleware, filesValue, findProjectRoot, isSandboxBackend, listSkills, parseSkillMetadata };
|
|
2200
2142
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -346,119 +346,61 @@ interface SandboxDeleteOptions {
|
|
|
346
346
|
sandboxId: string;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* Common error codes shared across all sandbox provider implementations.
|
|
350
350
|
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* lifecycle operations (list, getOrCreate, delete).
|
|
354
|
-
*
|
|
355
|
-
* This interface separates lifecycle management from sandbox execution:
|
|
356
|
-
* - `SandboxProvider` handles lifecycle (list, create, delete)
|
|
357
|
-
* - `SandboxBackendProtocol` handles execution (execute, file operations)
|
|
358
|
-
*
|
|
359
|
-
* @typeParam MetadataT - Type of the metadata field in sandbox listings.
|
|
360
|
-
* Providers can define their own interface for type-safe metadata access.
|
|
351
|
+
* These represent the core error conditions that any sandbox provider may encounter.
|
|
352
|
+
* Provider-specific error codes should extend this type with additional codes.
|
|
361
353
|
*
|
|
362
354
|
* @example
|
|
363
355
|
* ```typescript
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
356
|
+
* // Provider-specific error code type extending the common codes:
|
|
357
|
+
* type MySandboxErrorCode = SandboxErrorCode | "CUSTOM_ERROR";
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
type SandboxErrorCode = /** Sandbox has not been initialized - call initialize() first */"NOT_INITIALIZED" /** Sandbox is already initialized - cannot initialize twice */ | "ALREADY_INITIALIZED" /** Command execution timed out */ | "COMMAND_TIMEOUT" /** Command execution failed */ | "COMMAND_FAILED" /** File operation (read/write) failed */ | "FILE_OPERATION_FAILED";
|
|
361
|
+
declare const SANDBOX_ERROR_SYMBOL: unique symbol;
|
|
362
|
+
/**
|
|
363
|
+
* Custom error class for sandbox operations.
|
|
368
364
|
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* return { items: [...], cursor: null };
|
|
373
|
-
* }
|
|
365
|
+
* @param message - Human-readable error description
|
|
366
|
+
* @param code - Structured error code for programmatic handling
|
|
367
|
+
* @returns SandboxError with message and code
|
|
374
368
|
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* try {
|
|
372
|
+
* await sandbox.execute("some command");
|
|
373
|
+
* } catch (error) {
|
|
374
|
+
* if (error instanceof SandboxError) {
|
|
375
|
+
* switch (error.code) {
|
|
376
|
+
* case "NOT_INITIALIZED":
|
|
377
|
+
* await sandbox.initialize();
|
|
378
|
+
* break;
|
|
379
|
+
* case "COMMAND_TIMEOUT":
|
|
380
|
+
* console.error("Command took too long");
|
|
381
|
+
* break;
|
|
382
|
+
* default:
|
|
383
|
+
* throw error;
|
|
378
384
|
* }
|
|
379
|
-
* return this.create();
|
|
380
|
-
* }
|
|
381
|
-
*
|
|
382
|
-
* async delete(options: SandboxDeleteOptions): Promise<void> {
|
|
383
|
-
* // Idempotent - no error if already deleted
|
|
384
|
-
* await this.client.delete(options.sandboxId);
|
|
385
385
|
* }
|
|
386
386
|
* }
|
|
387
|
-
*
|
|
388
|
-
* // Usage
|
|
389
|
-
* const provider = new MySandboxProvider();
|
|
390
|
-
* const sandbox = await provider.getOrCreate();
|
|
391
|
-
* const result = await sandbox.execute("echo hello");
|
|
392
|
-
* await provider.delete({ sandboxId: sandbox.id });
|
|
393
387
|
* ```
|
|
394
388
|
*/
|
|
395
|
-
|
|
389
|
+
declare class SandboxError extends Error {
|
|
390
|
+
readonly code: string;
|
|
391
|
+
readonly cause?: Error | undefined;
|
|
392
|
+
/** Symbol for identifying sandbox error instances */
|
|
393
|
+
[SANDBOX_ERROR_SYMBOL]: true;
|
|
394
|
+
/** Error name for instanceof checks and logging */
|
|
395
|
+
readonly name: string;
|
|
396
396
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* @param options - Optional list options including cursor for pagination
|
|
400
|
-
* @returns Paginated list of sandbox metadata
|
|
397
|
+
* Creates a new SandboxError.
|
|
401
398
|
*
|
|
402
|
-
* @
|
|
403
|
-
*
|
|
404
|
-
* // First page
|
|
405
|
-
* const response = await provider.list();
|
|
406
|
-
* for (const sandbox of response.items) {
|
|
407
|
-
* console.log(sandbox.sandboxId);
|
|
408
|
-
* }
|
|
409
|
-
*
|
|
410
|
-
* // Next page if available
|
|
411
|
-
* if (response.cursor) {
|
|
412
|
-
* const nextPage = await provider.list({ cursor: response.cursor });
|
|
413
|
-
* }
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
list(options?: SandboxListOptions): Promise<SandboxListResponse<MetadataT>>;
|
|
417
|
-
/**
|
|
418
|
-
* Get an existing sandbox or create a new one.
|
|
419
|
-
*
|
|
420
|
-
* If sandboxId is provided, retrieves the existing sandbox. If the sandbox
|
|
421
|
-
* doesn't exist, throws an error (does NOT create a new one).
|
|
422
|
-
*
|
|
423
|
-
* If sandboxId is undefined, creates a new sandbox instance.
|
|
424
|
-
*
|
|
425
|
-
* @param options - Optional options including sandboxId to retrieve
|
|
426
|
-
* @returns A sandbox instance implementing SandboxBackendProtocol
|
|
427
|
-
* @throws Error if sandboxId is provided but the sandbox doesn't exist
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```typescript
|
|
431
|
-
* // Create a new sandbox
|
|
432
|
-
* const sandbox = await provider.getOrCreate();
|
|
433
|
-
* console.log(sandbox.id); // "sb_new123"
|
|
434
|
-
*
|
|
435
|
-
* // Reconnect to existing sandbox
|
|
436
|
-
* const existing = await provider.getOrCreate({ sandboxId: "sb_new123" });
|
|
437
|
-
*
|
|
438
|
-
* // Use the sandbox
|
|
439
|
-
* const result = await sandbox.execute("node --version");
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
getOrCreate(options?: SandboxGetOrCreateOptions): Promise<SandboxBackendProtocol>;
|
|
443
|
-
/**
|
|
444
|
-
* Delete a sandbox instance.
|
|
445
|
-
*
|
|
446
|
-
* This permanently destroys the sandbox and all its associated data.
|
|
447
|
-
* The operation is idempotent - calling delete on a non-existent sandbox
|
|
448
|
-
* should succeed without raising an error.
|
|
449
|
-
*
|
|
450
|
-
* @param options - Options including the sandboxId to delete
|
|
451
|
-
*
|
|
452
|
-
* @example
|
|
453
|
-
* ```typescript
|
|
454
|
-
* // Simple deletion
|
|
455
|
-
* await provider.delete({ sandboxId: "sb_123" });
|
|
456
|
-
*
|
|
457
|
-
* // Safe to call multiple times (idempotent)
|
|
458
|
-
* await provider.delete({ sandboxId: "sb_123" }); // No error
|
|
459
|
-
* ```
|
|
399
|
+
* @param message - Human-readable error description
|
|
400
|
+
* @param code - Structured error code for programmatic handling
|
|
460
401
|
*/
|
|
461
|
-
|
|
402
|
+
constructor(message: string, code: string, cause?: Error | undefined);
|
|
403
|
+
static isInstance(error: unknown): error is SandboxError;
|
|
462
404
|
}
|
|
463
405
|
/**
|
|
464
406
|
* State and store container for backend initialization.
|
|
@@ -2196,5 +2138,5 @@ declare function parseSkillMetadata(skillMdPath: string, source: "user" | "proje
|
|
|
2196
2138
|
*/
|
|
2197
2139
|
declare function listSkills(options: ListSkillsOptions): SkillMetadata[];
|
|
2198
2140
|
//#endregion
|
|
2199
|
-
export { type AgentMemoryMiddlewareOptions, type BackendFactory, type BackendProtocol, BaseSandbox, type CompiledSubAgent, CompositeBackend, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FlattenSubAgentMiddleware, GENERAL_PURPOSE_SUBAGENT, type GrepMatch, type InferDeepAgentSubagents, type InferDeepAgentType, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type ResolveDeepAgentTypeConfig, type SandboxBackendProtocol, type SandboxDeleteOptions, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type
|
|
2141
|
+
export { type AgentMemoryMiddlewareOptions, type BackendFactory, type BackendProtocol, BaseSandbox, type CompiledSubAgent, CompositeBackend, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FlattenSubAgentMiddleware, GENERAL_PURPOSE_SUBAGENT, type GrepMatch, type InferDeepAgentSubagents, type InferDeepAgentType, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type ResolveDeepAgentTypeConfig, type SandboxBackendProtocol, type SandboxDeleteOptions, SandboxError, type SandboxErrorCode, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type Settings, type SettingsOptions, type SkillMetadata$1 as SkillMetadata, type SkillsMiddlewareOptions, StateBackend, StoreBackend, type SubAgent, type SubAgentMiddlewareOptions, TASK_SYSTEM_PROMPT, type WriteResult, createAgentMemoryMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgentMiddleware, filesValue, findProjectRoot, isSandboxBackend, listSkills, parseSkillMetadata };
|
|
2200
2142
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,55 @@ import os from "node:os";
|
|
|
26
26
|
function isSandboxBackend(backend) {
|
|
27
27
|
return typeof backend.execute === "function" && typeof backend.id === "string";
|
|
28
28
|
}
|
|
29
|
+
const SANDBOX_ERROR_SYMBOL = Symbol.for("sandbox.error");
|
|
30
|
+
/**
|
|
31
|
+
* Custom error class for sandbox operations.
|
|
32
|
+
*
|
|
33
|
+
* @param message - Human-readable error description
|
|
34
|
+
* @param code - Structured error code for programmatic handling
|
|
35
|
+
* @returns SandboxError with message and code
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* try {
|
|
40
|
+
* await sandbox.execute("some command");
|
|
41
|
+
* } catch (error) {
|
|
42
|
+
* if (error instanceof SandboxError) {
|
|
43
|
+
* switch (error.code) {
|
|
44
|
+
* case "NOT_INITIALIZED":
|
|
45
|
+
* await sandbox.initialize();
|
|
46
|
+
* break;
|
|
47
|
+
* case "COMMAND_TIMEOUT":
|
|
48
|
+
* console.error("Command took too long");
|
|
49
|
+
* break;
|
|
50
|
+
* default:
|
|
51
|
+
* throw error;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
var SandboxError = class SandboxError extends Error {
|
|
58
|
+
/** Symbol for identifying sandbox error instances */
|
|
59
|
+
[SANDBOX_ERROR_SYMBOL] = true;
|
|
60
|
+
/** Error name for instanceof checks and logging */
|
|
61
|
+
name = "SandboxError";
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new SandboxError.
|
|
64
|
+
*
|
|
65
|
+
* @param message - Human-readable error description
|
|
66
|
+
* @param code - Structured error code for programmatic handling
|
|
67
|
+
*/
|
|
68
|
+
constructor(message, code, cause) {
|
|
69
|
+
super(message);
|
|
70
|
+
this.code = code;
|
|
71
|
+
this.cause = cause;
|
|
72
|
+
Object.setPrototypeOf(this, SandboxError.prototype);
|
|
73
|
+
}
|
|
74
|
+
static isInstance(error) {
|
|
75
|
+
return typeof error === "object" && error !== null && error[SANDBOX_ERROR_SYMBOL] === true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
29
78
|
|
|
30
79
|
//#endregion
|
|
31
80
|
//#region src/backends/utils.ts
|
|
@@ -4274,5 +4323,5 @@ function listSkills(options) {
|
|
|
4274
4323
|
}
|
|
4275
4324
|
|
|
4276
4325
|
//#endregion
|
|
4277
|
-
export { BaseSandbox, CompositeBackend, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, FilesystemBackend, GENERAL_PURPOSE_SUBAGENT, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, StateBackend, StoreBackend, TASK_SYSTEM_PROMPT, createAgentMemoryMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgentMiddleware, filesValue, findProjectRoot, isSandboxBackend, listSkills, parseSkillMetadata };
|
|
4326
|
+
export { BaseSandbox, CompositeBackend, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, FilesystemBackend, GENERAL_PURPOSE_SUBAGENT, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, SandboxError, StateBackend, StoreBackend, TASK_SYSTEM_PROMPT, createAgentMemoryMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgentMiddleware, filesValue, findProjectRoot, isSandboxBackend, listSkills, parseSkillMetadata };
|
|
4278
4327
|
//# sourceMappingURL=index.js.map
|