@ash-cloud/ash-ai 0.1.8 → 0.1.11
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/ash-widget.js +1 -1
- package/dist/ash-widget.js.map +1 -1
- package/dist/index.cjs +1829 -250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +831 -6
- package/dist/index.d.ts +831 -6
- package/dist/index.js +1800 -231
- package/dist/index.js.map +1 -1
- package/dist/playground.js +259 -255
- package/dist/{schema-B_CVsJm5.d.cts → schema-B7RbjHWi.d.cts} +261 -2
- package/dist/{schema-B_CVsJm5.d.ts → schema-B7RbjHWi.d.ts} +261 -2
- package/dist/schema.cjs +53 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +52 -3
- package/dist/schema.js.map +1 -1
- package/package.json +14 -13
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as _hono_node_server from '@hono/node-server';
|
|
|
9
9
|
export { serve } from '@hono/node-server';
|
|
10
10
|
import * as drizzle_orm_postgres_js from 'drizzle-orm/postgres-js';
|
|
11
11
|
import postgres from 'postgres';
|
|
12
|
-
export { A as AttachmentRow, M as MessageRow, b as NewAttachmentRow, a as NewMessageRow, c as NewQueueItemRow, N as NewSessionRow, Q as QueueItemRow, S as SessionRow, s as schema } from './schema-
|
|
12
|
+
export { A as AttachmentRow, M as MessageRow, b as NewAttachmentRow, a as NewMessageRow, c as NewQueueItemRow, e as NewSessionEventRow, N as NewSessionRow, Q as QueueItemRow, d as SessionEventRow, S as SessionRow, s as schema } from './schema-B7RbjHWi.js';
|
|
13
13
|
import { Writable } from 'stream';
|
|
14
14
|
import 'drizzle-orm';
|
|
15
15
|
import 'drizzle-orm/pg-core';
|
|
@@ -1110,6 +1110,7 @@ declare const StreamEventType: {
|
|
|
1110
1110
|
readonly SESSION_END: "session_end";
|
|
1111
1111
|
readonly SESSION_STOPPED: "session_stopped";
|
|
1112
1112
|
readonly SANDBOX_LOG: "sandbox_log";
|
|
1113
|
+
readonly MCP_STATUS: "mcp_status";
|
|
1113
1114
|
readonly ERROR: "error";
|
|
1114
1115
|
};
|
|
1115
1116
|
type StreamEventType = (typeof StreamEventType)[keyof typeof StreamEventType];
|
|
@@ -1175,7 +1176,7 @@ interface ErrorEvent {
|
|
|
1175
1176
|
/** Log levels for sandbox logs */
|
|
1176
1177
|
type SandboxLogLevel$1 = 'info' | 'warn' | 'error' | 'debug';
|
|
1177
1178
|
/** Categories for sandbox logs */
|
|
1178
|
-
type SandboxLogCategory$1 = 'setup' | 'skills' | 'execution' | 'process' | 'startup' | 'backup' | 'restore';
|
|
1179
|
+
type SandboxLogCategory$1 = 'setup' | 'skills' | 'execution' | 'process' | 'startup' | 'backup' | 'restore' | 'mcp';
|
|
1179
1180
|
/** A single sandbox log entry */
|
|
1180
1181
|
interface SandboxLogEntry$1 {
|
|
1181
1182
|
timestamp: string;
|
|
@@ -1188,7 +1189,17 @@ interface SandboxLogEvent {
|
|
|
1188
1189
|
type: 'sandbox_log';
|
|
1189
1190
|
entry: SandboxLogEntry$1;
|
|
1190
1191
|
}
|
|
1191
|
-
|
|
1192
|
+
/** MCP server connection status */
|
|
1193
|
+
interface McpServerStatus {
|
|
1194
|
+
name: string;
|
|
1195
|
+
status: 'connected' | 'failed' | string;
|
|
1196
|
+
}
|
|
1197
|
+
/** Emitted when MCP servers have been initialized */
|
|
1198
|
+
interface McpStatusEvent {
|
|
1199
|
+
type: 'mcp_status';
|
|
1200
|
+
servers: McpServerStatus[];
|
|
1201
|
+
}
|
|
1202
|
+
type StreamEvent = SessionStartEvent | TextDeltaEvent | ThinkingDeltaEvent | MessageEvent | ToolUseEvent | ToolResultEvent | TurnCompleteEvent | SessionEndEvent | SessionStoppedEvent | SandboxLogEvent | McpStatusEvent | ErrorEvent;
|
|
1192
1203
|
/**
|
|
1193
1204
|
* Status of a queued message
|
|
1194
1205
|
*/
|
|
@@ -1290,6 +1301,90 @@ interface SessionQueueStatus {
|
|
|
1290
1301
|
currentItem?: QueueItem;
|
|
1291
1302
|
nextItems: QueueItem[];
|
|
1292
1303
|
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Event categories for the timeline view
|
|
1306
|
+
*/
|
|
1307
|
+
declare const EventCategory: {
|
|
1308
|
+
readonly LIFECYCLE: "lifecycle";
|
|
1309
|
+
readonly CONTENT: "content";
|
|
1310
|
+
readonly TOOL: "tool";
|
|
1311
|
+
readonly SYSTEM: "system";
|
|
1312
|
+
readonly ERROR: "error";
|
|
1313
|
+
readonly FILE: "file";
|
|
1314
|
+
readonly INPUT: "input";
|
|
1315
|
+
};
|
|
1316
|
+
type EventCategory = (typeof EventCategory)[keyof typeof EventCategory];
|
|
1317
|
+
/**
|
|
1318
|
+
* File sync operation types
|
|
1319
|
+
*/
|
|
1320
|
+
type FileSyncOperation = 'push' | 'pull' | 'sync_to_sandbox' | 'sync_from_sandbox' | 'delete';
|
|
1321
|
+
/**
|
|
1322
|
+
* Direction of file sync
|
|
1323
|
+
*/
|
|
1324
|
+
type FileSyncDirection = 'to_s3' | 'from_s3' | 'to_sandbox' | 'from_sandbox';
|
|
1325
|
+
/**
|
|
1326
|
+
* Source of the file sync operation
|
|
1327
|
+
*/
|
|
1328
|
+
type FileSyncSource = 'external' | 'internal';
|
|
1329
|
+
/**
|
|
1330
|
+
* Event data for file sync operations
|
|
1331
|
+
*/
|
|
1332
|
+
interface FileSyncEventData {
|
|
1333
|
+
operation: FileSyncOperation;
|
|
1334
|
+
direction: FileSyncDirection;
|
|
1335
|
+
source: FileSyncSource;
|
|
1336
|
+
filePath: string;
|
|
1337
|
+
fileSize?: number;
|
|
1338
|
+
success: boolean;
|
|
1339
|
+
error?: string;
|
|
1340
|
+
diff?: string;
|
|
1341
|
+
isTextFile?: boolean;
|
|
1342
|
+
previousSize?: number;
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* A single event in the session timeline
|
|
1346
|
+
*/
|
|
1347
|
+
interface SessionEvent {
|
|
1348
|
+
id: string;
|
|
1349
|
+
sessionId: SessionId;
|
|
1350
|
+
eventType: string;
|
|
1351
|
+
category: EventCategory;
|
|
1352
|
+
startedAt: Date;
|
|
1353
|
+
endedAt?: Date;
|
|
1354
|
+
durationMs?: number;
|
|
1355
|
+
eventData?: Record<string, unknown>;
|
|
1356
|
+
toolUseId?: string;
|
|
1357
|
+
toolName?: string;
|
|
1358
|
+
isAggregated?: boolean;
|
|
1359
|
+
aggregatedCount?: number;
|
|
1360
|
+
sequenceNumber: number;
|
|
1361
|
+
createdAt: Date;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Options for creating a session event
|
|
1365
|
+
*/
|
|
1366
|
+
interface CreateSessionEventOptions {
|
|
1367
|
+
eventType: string;
|
|
1368
|
+
category: EventCategory;
|
|
1369
|
+
startedAt: Date;
|
|
1370
|
+
endedAt?: Date;
|
|
1371
|
+
durationMs?: number;
|
|
1372
|
+
eventData?: Record<string, unknown>;
|
|
1373
|
+
toolUseId?: string;
|
|
1374
|
+
toolName?: string;
|
|
1375
|
+
isAggregated?: boolean;
|
|
1376
|
+
aggregatedCount?: number;
|
|
1377
|
+
sequenceNumber: number;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Options for listing session events
|
|
1381
|
+
*/
|
|
1382
|
+
interface ListSessionEventsOptions extends PaginationOptions {
|
|
1383
|
+
category?: EventCategory;
|
|
1384
|
+
eventType?: string;
|
|
1385
|
+
/** Filter events involving this file path (matches file events and Read/Write/Edit tool calls) */
|
|
1386
|
+
filePath?: string;
|
|
1387
|
+
}
|
|
1293
1388
|
|
|
1294
1389
|
/**
|
|
1295
1390
|
* Base Error Types for Agent SDK Harness
|
|
@@ -1551,6 +1646,31 @@ interface QueueStorage {
|
|
|
1551
1646
|
*/
|
|
1552
1647
|
cleanupOldItems(maxAgeMs: number): Promise<number>;
|
|
1553
1648
|
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Storage interface for session events (timeline data).
|
|
1651
|
+
* Events are collected during agent execution and stored for visualization.
|
|
1652
|
+
*/
|
|
1653
|
+
interface EventStorage {
|
|
1654
|
+
initialize(): Promise<void>;
|
|
1655
|
+
close(): Promise<void>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Save multiple events for a session (batch insert)
|
|
1658
|
+
*/
|
|
1659
|
+
saveEvents(sessionId: SessionId, events: CreateSessionEventOptions[]): Promise<SessionEvent[]>;
|
|
1660
|
+
/**
|
|
1661
|
+
* Get events for a session with optional filtering
|
|
1662
|
+
*/
|
|
1663
|
+
getSessionEvents(sessionId: SessionId, options?: ListSessionEventsOptions): Promise<PaginatedResult<SessionEvent>>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Delete all events for a session
|
|
1666
|
+
*/
|
|
1667
|
+
deleteSessionEvents(sessionId: SessionId): Promise<void>;
|
|
1668
|
+
/**
|
|
1669
|
+
* Get the next sequence number for a session
|
|
1670
|
+
* This is used when creating events outside the normal agent execution flow
|
|
1671
|
+
*/
|
|
1672
|
+
getNextEventSequence(sessionId: SessionId): Promise<number>;
|
|
1673
|
+
}
|
|
1554
1674
|
|
|
1555
1675
|
/**
|
|
1556
1676
|
* Credential Management
|
|
@@ -4365,6 +4485,355 @@ declare function createMinioFileStore(config: {
|
|
|
4365
4485
|
prefix?: string;
|
|
4366
4486
|
}): S3FileStore;
|
|
4367
4487
|
|
|
4488
|
+
/**
|
|
4489
|
+
* Sandbox File Watcher
|
|
4490
|
+
*
|
|
4491
|
+
* Watches sandbox directories for file changes and emits events.
|
|
4492
|
+
* Supports debouncing to handle rapid file changes and auto-sync to S3.
|
|
4493
|
+
*
|
|
4494
|
+
* Usage:
|
|
4495
|
+
* - startWatching(): Begin watching a sandbox directory
|
|
4496
|
+
* - stopWatching(): Stop watching and cleanup
|
|
4497
|
+
* - onFileChange(): Subscribe to file change events
|
|
4498
|
+
*/
|
|
4499
|
+
/**
|
|
4500
|
+
* Types of file change events
|
|
4501
|
+
*/
|
|
4502
|
+
type FileChangeType = 'add' | 'change' | 'unlink' | 'addDir' | 'unlinkDir';
|
|
4503
|
+
/**
|
|
4504
|
+
* Event emitted when a file changes in the watched directory
|
|
4505
|
+
*/
|
|
4506
|
+
interface FileChangeEvent {
|
|
4507
|
+
/** Type of change */
|
|
4508
|
+
type: FileChangeType;
|
|
4509
|
+
/** Relative path from the watched directory */
|
|
4510
|
+
relativePath: string;
|
|
4511
|
+
/** Absolute path to the file */
|
|
4512
|
+
absolutePath: string;
|
|
4513
|
+
/** Session ID this watch is associated with */
|
|
4514
|
+
sessionId: string;
|
|
4515
|
+
/** File size (only for add/change events) */
|
|
4516
|
+
fileSize?: number;
|
|
4517
|
+
/** Timestamp of the change */
|
|
4518
|
+
timestamp: Date;
|
|
4519
|
+
}
|
|
4520
|
+
/**
|
|
4521
|
+
* Callback for file change events
|
|
4522
|
+
*/
|
|
4523
|
+
type FileChangeCallback = (event: FileChangeEvent) => void | Promise<void>;
|
|
4524
|
+
/**
|
|
4525
|
+
* Options for configuring the file watcher
|
|
4526
|
+
*/
|
|
4527
|
+
interface FileWatcherOptions {
|
|
4528
|
+
/** Session ID to associate with watched files */
|
|
4529
|
+
sessionId: string;
|
|
4530
|
+
/** Directory to watch */
|
|
4531
|
+
watchPath: string;
|
|
4532
|
+
/**
|
|
4533
|
+
* Debounce delay in milliseconds.
|
|
4534
|
+
* Changes to the same file within this window are coalesced.
|
|
4535
|
+
* Default: 300ms
|
|
4536
|
+
*/
|
|
4537
|
+
debounceMs?: number;
|
|
4538
|
+
/**
|
|
4539
|
+
* Glob patterns to watch (relative to watchPath).
|
|
4540
|
+
* Default: ['**\/*'] (all files)
|
|
4541
|
+
*/
|
|
4542
|
+
patterns?: string[];
|
|
4543
|
+
/**
|
|
4544
|
+
* Glob patterns to ignore.
|
|
4545
|
+
* Default: ['node_modules/**', '.git/**', '*.log']
|
|
4546
|
+
*/
|
|
4547
|
+
ignored?: string[];
|
|
4548
|
+
/**
|
|
4549
|
+
* Whether to emit events for the initial scan.
|
|
4550
|
+
* Default: false
|
|
4551
|
+
*/
|
|
4552
|
+
emitInitialEvents?: boolean;
|
|
4553
|
+
/**
|
|
4554
|
+
* Whether to follow symlinks.
|
|
4555
|
+
* Default: false
|
|
4556
|
+
*/
|
|
4557
|
+
followSymlinks?: boolean;
|
|
4558
|
+
/**
|
|
4559
|
+
* Use polling instead of native file system events.
|
|
4560
|
+
* Useful for network filesystems or containers.
|
|
4561
|
+
* Default: false
|
|
4562
|
+
*/
|
|
4563
|
+
usePolling?: boolean;
|
|
4564
|
+
/**
|
|
4565
|
+
* Polling interval in milliseconds (only used if usePolling is true).
|
|
4566
|
+
* Default: 100ms
|
|
4567
|
+
*/
|
|
4568
|
+
pollInterval?: number;
|
|
4569
|
+
/**
|
|
4570
|
+
* Callback for file change events.
|
|
4571
|
+
* Called after debouncing is applied.
|
|
4572
|
+
*/
|
|
4573
|
+
onFileChange?: FileChangeCallback;
|
|
4574
|
+
/**
|
|
4575
|
+
* Callback for errors during watching.
|
|
4576
|
+
*/
|
|
4577
|
+
onError?: (error: Error) => void;
|
|
4578
|
+
/**
|
|
4579
|
+
* Callback when watcher is ready (initial scan complete).
|
|
4580
|
+
*/
|
|
4581
|
+
onReady?: () => void;
|
|
4582
|
+
}
|
|
4583
|
+
/**
|
|
4584
|
+
* Status of a file watcher
|
|
4585
|
+
*/
|
|
4586
|
+
interface FileWatcherStatus {
|
|
4587
|
+
sessionId: string;
|
|
4588
|
+
watchPath: string;
|
|
4589
|
+
isWatching: boolean;
|
|
4590
|
+
watchedFileCount: number;
|
|
4591
|
+
pendingEventCount: number;
|
|
4592
|
+
startedAt?: Date;
|
|
4593
|
+
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Sandbox File Watcher
|
|
4596
|
+
*
|
|
4597
|
+
* Watches a sandbox directory for file changes and emits debounced events.
|
|
4598
|
+
* Designed to be used with SandboxFileSync for auto-syncing to S3.
|
|
4599
|
+
*/
|
|
4600
|
+
declare class SandboxFileWatcher {
|
|
4601
|
+
private readonly sessionId;
|
|
4602
|
+
private readonly watchPath;
|
|
4603
|
+
private readonly debounceMs;
|
|
4604
|
+
private readonly patterns;
|
|
4605
|
+
private readonly ignored;
|
|
4606
|
+
private readonly emitInitialEvents;
|
|
4607
|
+
private readonly followSymlinks;
|
|
4608
|
+
private readonly usePolling;
|
|
4609
|
+
private readonly pollInterval;
|
|
4610
|
+
private watcher;
|
|
4611
|
+
private pendingEvents;
|
|
4612
|
+
private subscribers;
|
|
4613
|
+
private isWatching;
|
|
4614
|
+
private startedAt?;
|
|
4615
|
+
private watchedFileCount;
|
|
4616
|
+
private onError?;
|
|
4617
|
+
private onReady?;
|
|
4618
|
+
constructor(options: FileWatcherOptions);
|
|
4619
|
+
/**
|
|
4620
|
+
* Start watching the directory for changes
|
|
4621
|
+
*/
|
|
4622
|
+
start(): Promise<void>;
|
|
4623
|
+
/**
|
|
4624
|
+
* Stop watching and cleanup resources
|
|
4625
|
+
*/
|
|
4626
|
+
stop(): Promise<void>;
|
|
4627
|
+
/**
|
|
4628
|
+
* Subscribe to file change events
|
|
4629
|
+
* @returns Unsubscribe function
|
|
4630
|
+
*/
|
|
4631
|
+
subscribe(callback: FileChangeCallback): () => void;
|
|
4632
|
+
/**
|
|
4633
|
+
* Remove a subscriber
|
|
4634
|
+
*/
|
|
4635
|
+
unsubscribe(callback: FileChangeCallback): void;
|
|
4636
|
+
/**
|
|
4637
|
+
* Get the current status of the watcher
|
|
4638
|
+
*/
|
|
4639
|
+
getStatus(): FileWatcherStatus;
|
|
4640
|
+
/**
|
|
4641
|
+
* Check if the watcher is currently active
|
|
4642
|
+
*/
|
|
4643
|
+
isActive(): boolean;
|
|
4644
|
+
/**
|
|
4645
|
+
* Handle a file system event with debouncing
|
|
4646
|
+
*/
|
|
4647
|
+
private handleFileEvent;
|
|
4648
|
+
/**
|
|
4649
|
+
* Emit a file change event to all subscribers
|
|
4650
|
+
*/
|
|
4651
|
+
private emitEvent;
|
|
4652
|
+
}
|
|
4653
|
+
/**
|
|
4654
|
+
* Create a new file watcher instance
|
|
4655
|
+
*/
|
|
4656
|
+
declare function createFileWatcher(options: FileWatcherOptions): SandboxFileWatcher;
|
|
4657
|
+
/**
|
|
4658
|
+
* Manager for multiple file watchers (one per session)
|
|
4659
|
+
*/
|
|
4660
|
+
declare class FileWatcherManager {
|
|
4661
|
+
private watchers;
|
|
4662
|
+
/**
|
|
4663
|
+
* Start watching a session's sandbox directory
|
|
4664
|
+
*/
|
|
4665
|
+
startWatching(options: FileWatcherOptions): Promise<SandboxFileWatcher>;
|
|
4666
|
+
/**
|
|
4667
|
+
* Stop watching a session's sandbox directory
|
|
4668
|
+
*/
|
|
4669
|
+
stopWatching(sessionId: string): Promise<void>;
|
|
4670
|
+
/**
|
|
4671
|
+
* Get a watcher for a session
|
|
4672
|
+
*/
|
|
4673
|
+
getWatcher(sessionId: string): SandboxFileWatcher | undefined;
|
|
4674
|
+
/**
|
|
4675
|
+
* Check if a session is being watched
|
|
4676
|
+
*/
|
|
4677
|
+
isWatching(sessionId: string): boolean;
|
|
4678
|
+
/**
|
|
4679
|
+
* Get status of all watchers
|
|
4680
|
+
*/
|
|
4681
|
+
getAllStatuses(): FileWatcherStatus[];
|
|
4682
|
+
/**
|
|
4683
|
+
* Stop all watchers and cleanup
|
|
4684
|
+
*/
|
|
4685
|
+
stopAll(): Promise<void>;
|
|
4686
|
+
}
|
|
4687
|
+
/**
|
|
4688
|
+
* Get or create the global file watcher manager
|
|
4689
|
+
*/
|
|
4690
|
+
declare function getFileWatcherManager(): FileWatcherManager;
|
|
4691
|
+
/**
|
|
4692
|
+
* Create a new file watcher manager (for isolated usage)
|
|
4693
|
+
*/
|
|
4694
|
+
declare function createFileWatcherManager(): FileWatcherManager;
|
|
4695
|
+
|
|
4696
|
+
/**
|
|
4697
|
+
* Options for the remote sandbox file watcher
|
|
4698
|
+
*/
|
|
4699
|
+
interface RemoteFileWatcherOptions {
|
|
4700
|
+
/** Session ID to watch */
|
|
4701
|
+
sessionId: string;
|
|
4702
|
+
/** Sandbox file operations interface */
|
|
4703
|
+
sandboxOps: SandboxFileOperations;
|
|
4704
|
+
/** Base path in sandbox to watch */
|
|
4705
|
+
basePath: string;
|
|
4706
|
+
/**
|
|
4707
|
+
* Polling interval in milliseconds.
|
|
4708
|
+
* How often to check for file changes.
|
|
4709
|
+
* Default: 2000ms (2 seconds)
|
|
4710
|
+
*/
|
|
4711
|
+
pollIntervalMs?: number;
|
|
4712
|
+
/**
|
|
4713
|
+
* Patterns to ignore (simple glob-like matching)
|
|
4714
|
+
* Default: ['node_modules/**', '.git/**']
|
|
4715
|
+
*/
|
|
4716
|
+
ignored?: string[];
|
|
4717
|
+
/**
|
|
4718
|
+
* Callback for file change events
|
|
4719
|
+
*/
|
|
4720
|
+
onFileChange?: FileChangeCallback;
|
|
4721
|
+
/**
|
|
4722
|
+
* Callback for errors
|
|
4723
|
+
*/
|
|
4724
|
+
onError?: (error: Error) => void;
|
|
4725
|
+
}
|
|
4726
|
+
/**
|
|
4727
|
+
* Remote Sandbox File Watcher
|
|
4728
|
+
*
|
|
4729
|
+
* Uses polling to detect file changes in remote sandboxes (Vercel, E2B, etc.)
|
|
4730
|
+
* where native file system events aren't available.
|
|
4731
|
+
*
|
|
4732
|
+
* The watcher periodically lists files in the sandbox and compares with
|
|
4733
|
+
* the previous state to detect additions, changes, and deletions.
|
|
4734
|
+
*/
|
|
4735
|
+
declare class RemoteSandboxFileWatcher {
|
|
4736
|
+
private readonly sessionId;
|
|
4737
|
+
private readonly sandboxOps;
|
|
4738
|
+
private readonly basePath;
|
|
4739
|
+
private readonly pollIntervalMs;
|
|
4740
|
+
private readonly ignored;
|
|
4741
|
+
private pollTimer;
|
|
4742
|
+
private previousFiles;
|
|
4743
|
+
private subscribers;
|
|
4744
|
+
private isWatching;
|
|
4745
|
+
private startedAt?;
|
|
4746
|
+
private lastPollAt?;
|
|
4747
|
+
private pollCount;
|
|
4748
|
+
private onError?;
|
|
4749
|
+
constructor(options: RemoteFileWatcherOptions);
|
|
4750
|
+
/**
|
|
4751
|
+
* Start polling for file changes
|
|
4752
|
+
*/
|
|
4753
|
+
start(): Promise<void>;
|
|
4754
|
+
/**
|
|
4755
|
+
* Stop polling and cleanup
|
|
4756
|
+
*/
|
|
4757
|
+
stop(): Promise<void>;
|
|
4758
|
+
/**
|
|
4759
|
+
* Subscribe to file change events
|
|
4760
|
+
*/
|
|
4761
|
+
subscribe(callback: FileChangeCallback): () => void;
|
|
4762
|
+
/**
|
|
4763
|
+
* Remove a subscriber
|
|
4764
|
+
*/
|
|
4765
|
+
unsubscribe(callback: FileChangeCallback): void;
|
|
4766
|
+
/**
|
|
4767
|
+
* Check if watcher is active
|
|
4768
|
+
*/
|
|
4769
|
+
isActive(): boolean;
|
|
4770
|
+
/**
|
|
4771
|
+
* Get watcher status
|
|
4772
|
+
*/
|
|
4773
|
+
getStatus(): FileWatcherStatus & {
|
|
4774
|
+
lastPollAt?: Date;
|
|
4775
|
+
pollCount: number;
|
|
4776
|
+
};
|
|
4777
|
+
/**
|
|
4778
|
+
* Force an immediate scan (useful for testing or manual refresh)
|
|
4779
|
+
*/
|
|
4780
|
+
forceScan(): Promise<void>;
|
|
4781
|
+
/**
|
|
4782
|
+
* Scan the sandbox for file changes
|
|
4783
|
+
*/
|
|
4784
|
+
private scan;
|
|
4785
|
+
/**
|
|
4786
|
+
* Check if a path should be ignored
|
|
4787
|
+
*/
|
|
4788
|
+
private shouldIgnore;
|
|
4789
|
+
/**
|
|
4790
|
+
* Simple glob matching (supports ** and *)
|
|
4791
|
+
*/
|
|
4792
|
+
private matchesGlob;
|
|
4793
|
+
/**
|
|
4794
|
+
* Emit a file change event to all subscribers
|
|
4795
|
+
*/
|
|
4796
|
+
private emitEvent;
|
|
4797
|
+
}
|
|
4798
|
+
/**
|
|
4799
|
+
* Create a remote sandbox file watcher
|
|
4800
|
+
*/
|
|
4801
|
+
declare function createRemoteFileWatcher(options: RemoteFileWatcherOptions): RemoteSandboxFileWatcher;
|
|
4802
|
+
/**
|
|
4803
|
+
* Manager for remote file watchers (one per session)
|
|
4804
|
+
*/
|
|
4805
|
+
declare class RemoteFileWatcherManager {
|
|
4806
|
+
private watchers;
|
|
4807
|
+
/**
|
|
4808
|
+
* Start watching a session's sandbox
|
|
4809
|
+
*/
|
|
4810
|
+
startWatching(options: RemoteFileWatcherOptions): Promise<RemoteSandboxFileWatcher>;
|
|
4811
|
+
/**
|
|
4812
|
+
* Stop watching a session
|
|
4813
|
+
*/
|
|
4814
|
+
stopWatching(sessionId: string): Promise<void>;
|
|
4815
|
+
/**
|
|
4816
|
+
* Get a watcher for a session
|
|
4817
|
+
*/
|
|
4818
|
+
getWatcher(sessionId: string): RemoteSandboxFileWatcher | undefined;
|
|
4819
|
+
/**
|
|
4820
|
+
* Check if a session is being watched
|
|
4821
|
+
*/
|
|
4822
|
+
isWatching(sessionId: string): boolean;
|
|
4823
|
+
/**
|
|
4824
|
+
* Stop all watchers
|
|
4825
|
+
*/
|
|
4826
|
+
stopAll(): Promise<void>;
|
|
4827
|
+
}
|
|
4828
|
+
/**
|
|
4829
|
+
* Get or create the global remote file watcher manager
|
|
4830
|
+
*/
|
|
4831
|
+
declare function getRemoteFileWatcherManager(): RemoteFileWatcherManager;
|
|
4832
|
+
/**
|
|
4833
|
+
* Create a new remote file watcher manager
|
|
4834
|
+
*/
|
|
4835
|
+
declare function createRemoteFileWatcherManager(): RemoteFileWatcherManager;
|
|
4836
|
+
|
|
4368
4837
|
/**
|
|
4369
4838
|
* Sandbox File Sync
|
|
4370
4839
|
*
|
|
@@ -4376,8 +4845,72 @@ declare function createMinioFileStore(config: {
|
|
|
4376
4845
|
* - pullFile(): Sandbox → S3
|
|
4377
4846
|
* - syncToSandbox(): Restore all S3 files when sandbox starts
|
|
4378
4847
|
* - syncFromSandbox(): Backup sandbox files to S3 before it dies
|
|
4848
|
+
* - startWatching(): Watch sandbox for changes and auto-sync to S3
|
|
4849
|
+
* - stopWatching(): Stop watching
|
|
4379
4850
|
*/
|
|
4380
4851
|
|
|
4852
|
+
/**
|
|
4853
|
+
* Webhook configuration for file sync notifications
|
|
4854
|
+
*/
|
|
4855
|
+
interface WebhookConfig {
|
|
4856
|
+
/**
|
|
4857
|
+
* The URL to send webhook notifications to.
|
|
4858
|
+
* Must be HTTPS in production.
|
|
4859
|
+
*/
|
|
4860
|
+
url: string;
|
|
4861
|
+
/**
|
|
4862
|
+
* Secret key for signing webhook payloads (HMAC-SHA256).
|
|
4863
|
+
* The signature is sent in the `X-Ash-Signature` header.
|
|
4864
|
+
*/
|
|
4865
|
+
secret?: string;
|
|
4866
|
+
/**
|
|
4867
|
+
* Custom headers to include with webhook requests.
|
|
4868
|
+
*/
|
|
4869
|
+
headers?: Record<string, string>;
|
|
4870
|
+
/**
|
|
4871
|
+
* Timeout for webhook requests in milliseconds.
|
|
4872
|
+
* Default: 10000 (10 seconds)
|
|
4873
|
+
*/
|
|
4874
|
+
timeoutMs?: number;
|
|
4875
|
+
/**
|
|
4876
|
+
* Number of retry attempts for failed webhooks.
|
|
4877
|
+
* Default: 3
|
|
4878
|
+
*/
|
|
4879
|
+
retries?: number;
|
|
4880
|
+
/**
|
|
4881
|
+
* Whether to send webhooks asynchronously (fire and forget).
|
|
4882
|
+
* If true, webhook failures won't block file operations.
|
|
4883
|
+
* Default: true
|
|
4884
|
+
*/
|
|
4885
|
+
async?: boolean;
|
|
4886
|
+
/**
|
|
4887
|
+
* Filter which events trigger webhooks.
|
|
4888
|
+
* Default: all events
|
|
4889
|
+
*/
|
|
4890
|
+
events?: Array<'push' | 'pull' | 'sync_to_sandbox' | 'sync_from_sandbox' | 'delete' | 'file_change'>;
|
|
4891
|
+
/**
|
|
4892
|
+
* Custom metadata to include with every webhook payload.
|
|
4893
|
+
* Useful for including project IDs, tenant IDs, or other context.
|
|
4894
|
+
*/
|
|
4895
|
+
metadata?: Record<string, unknown>;
|
|
4896
|
+
}
|
|
4897
|
+
/**
|
|
4898
|
+
* Payload sent to webhook endpoints
|
|
4899
|
+
*/
|
|
4900
|
+
interface WebhookPayload {
|
|
4901
|
+
/** Event type */
|
|
4902
|
+
event: 'file_sync' | 'file_change';
|
|
4903
|
+
/** Timestamp of the event */
|
|
4904
|
+
timestamp: string;
|
|
4905
|
+
/** Session ID */
|
|
4906
|
+
sessionId: string;
|
|
4907
|
+
/** Custom metadata from webhook config */
|
|
4908
|
+
metadata?: Record<string, unknown>;
|
|
4909
|
+
/** File sync event data (for file_sync events) */
|
|
4910
|
+
fileSyncEvent?: FileSyncEvent;
|
|
4911
|
+
/** File change event data (for file_change events from watchers) */
|
|
4912
|
+
fileChangeEvent?: FileChangeEvent;
|
|
4913
|
+
}
|
|
4381
4914
|
/**
|
|
4382
4915
|
* Result of writing a file to a sandbox
|
|
4383
4916
|
*/
|
|
@@ -4432,6 +4965,49 @@ interface SyncResult {
|
|
|
4432
4965
|
error: string;
|
|
4433
4966
|
}>;
|
|
4434
4967
|
}
|
|
4968
|
+
/**
|
|
4969
|
+
* Event emitted during file sync operations
|
|
4970
|
+
*/
|
|
4971
|
+
interface FileSyncEvent {
|
|
4972
|
+
operation: 'push' | 'pull' | 'sync_to_sandbox' | 'sync_from_sandbox' | 'delete';
|
|
4973
|
+
direction: 'to_s3' | 'from_s3' | 'to_sandbox' | 'from_sandbox';
|
|
4974
|
+
filePath: string;
|
|
4975
|
+
fileSize?: number;
|
|
4976
|
+
success: boolean;
|
|
4977
|
+
error?: string;
|
|
4978
|
+
previousContent?: Buffer;
|
|
4979
|
+
newContent?: Buffer;
|
|
4980
|
+
}
|
|
4981
|
+
/**
|
|
4982
|
+
* Options for file watching
|
|
4983
|
+
*/
|
|
4984
|
+
interface FileWatchOptions {
|
|
4985
|
+
/**
|
|
4986
|
+
* Polling interval for remote sandboxes in milliseconds.
|
|
4987
|
+
* Default: 2000ms
|
|
4988
|
+
*/
|
|
4989
|
+
pollIntervalMs?: number;
|
|
4990
|
+
/**
|
|
4991
|
+
* Debounce delay for local file changes in milliseconds.
|
|
4992
|
+
* Default: 300ms
|
|
4993
|
+
*/
|
|
4994
|
+
debounceMs?: number;
|
|
4995
|
+
/**
|
|
4996
|
+
* Patterns to ignore when watching.
|
|
4997
|
+
* Default: node_modules and .git directories
|
|
4998
|
+
*/
|
|
4999
|
+
ignored?: string[];
|
|
5000
|
+
/**
|
|
5001
|
+
* Whether to use local file watching (chokidar) instead of polling.
|
|
5002
|
+
* Only works when the sandbox is on the local filesystem.
|
|
5003
|
+
* Default: false (use polling for remote sandbox compatibility)
|
|
5004
|
+
*/
|
|
5005
|
+
useLocalWatcher?: boolean;
|
|
5006
|
+
/**
|
|
5007
|
+
* Local path to watch (required if useLocalWatcher is true)
|
|
5008
|
+
*/
|
|
5009
|
+
localPath?: string;
|
|
5010
|
+
}
|
|
4435
5011
|
/**
|
|
4436
5012
|
* Options for creating a SandboxFileSync instance
|
|
4437
5013
|
*/
|
|
@@ -4440,6 +5016,20 @@ interface SandboxFileSyncOptions {
|
|
|
4440
5016
|
fileStore: FileStore;
|
|
4441
5017
|
/** Base path in sandbox for synced files (default: .claude/files) */
|
|
4442
5018
|
sandboxBasePath?: string;
|
|
5019
|
+
/** Callback for file sync events (for event tracking) */
|
|
5020
|
+
onFileEvent?: (event: FileSyncEvent) => void;
|
|
5021
|
+
/** Default options for file watching */
|
|
5022
|
+
watchOptions?: FileWatchOptions;
|
|
5023
|
+
/**
|
|
5024
|
+
* Optional event storage for persisting file events to the session timeline.
|
|
5025
|
+
* When provided, all file sync events will be automatically saved.
|
|
5026
|
+
*/
|
|
5027
|
+
eventStorage?: EventStorage;
|
|
5028
|
+
/**
|
|
5029
|
+
* Webhook configuration for sending file event notifications to external services.
|
|
5030
|
+
* Use this to notify your application when files change in sandboxes.
|
|
5031
|
+
*/
|
|
5032
|
+
webhook?: WebhookConfig;
|
|
4443
5033
|
}
|
|
4444
5034
|
/**
|
|
4445
5035
|
* Interface for sandbox file operations
|
|
@@ -4471,12 +5061,66 @@ interface SandboxFileOperations {
|
|
|
4471
5061
|
* Sandbox File Sync service
|
|
4472
5062
|
*
|
|
4473
5063
|
* Handles bidirectional file synchronization between S3 and sandboxes.
|
|
5064
|
+
* Supports automatic file watching with auto-sync to S3.
|
|
4474
5065
|
*/
|
|
4475
5066
|
declare class SandboxFileSync {
|
|
4476
5067
|
private readonly fileStore;
|
|
4477
5068
|
private readonly sandboxBasePath;
|
|
5069
|
+
private readonly defaultWatchOptions;
|
|
4478
5070
|
private sandboxOps;
|
|
5071
|
+
private onFileEvent?;
|
|
5072
|
+
private eventStorage?;
|
|
5073
|
+
private webhookConfig?;
|
|
5074
|
+
private remoteWatchers;
|
|
5075
|
+
private localWatchers;
|
|
5076
|
+
private fileChangeSubscribers;
|
|
5077
|
+
private sequenceNumbers;
|
|
4479
5078
|
constructor(options: SandboxFileSyncOptions);
|
|
5079
|
+
/**
|
|
5080
|
+
* Set the file event callback
|
|
5081
|
+
* This can be used to set or update the callback after construction
|
|
5082
|
+
*/
|
|
5083
|
+
setFileEventCallback(callback: (event: FileSyncEvent) => void): void;
|
|
5084
|
+
/**
|
|
5085
|
+
* Set the event storage for persisting file events to the timeline
|
|
5086
|
+
* This can be used to set or update the storage after construction
|
|
5087
|
+
*/
|
|
5088
|
+
setEventStorage(storage: EventStorage): void;
|
|
5089
|
+
/**
|
|
5090
|
+
* Set webhook configuration for external notifications
|
|
5091
|
+
* This can be used to set or update the webhook after construction
|
|
5092
|
+
*/
|
|
5093
|
+
setWebhook(config: WebhookConfig): void;
|
|
5094
|
+
/**
|
|
5095
|
+
* Remove webhook configuration
|
|
5096
|
+
*/
|
|
5097
|
+
removeWebhook(): void;
|
|
5098
|
+
/**
|
|
5099
|
+
* Send a webhook notification
|
|
5100
|
+
* @param payload - The webhook payload to send
|
|
5101
|
+
*/
|
|
5102
|
+
private sendWebhook;
|
|
5103
|
+
/**
|
|
5104
|
+
* Send a file sync event webhook
|
|
5105
|
+
*/
|
|
5106
|
+
private sendFileSyncWebhook;
|
|
5107
|
+
/**
|
|
5108
|
+
* Send a file change event webhook (from watcher)
|
|
5109
|
+
*/
|
|
5110
|
+
private sendFileChangeWebhook;
|
|
5111
|
+
/**
|
|
5112
|
+
* Get the next sequence number for a session
|
|
5113
|
+
*/
|
|
5114
|
+
private getNextSequenceNumber;
|
|
5115
|
+
/**
|
|
5116
|
+
* Compute a unified diff between two text contents
|
|
5117
|
+
*/
|
|
5118
|
+
private computeDiff;
|
|
5119
|
+
/**
|
|
5120
|
+
* Emit a file event if a callback is registered
|
|
5121
|
+
* Also persists to EventStorage if configured
|
|
5122
|
+
*/
|
|
5123
|
+
private emitFileEvent;
|
|
4480
5124
|
/**
|
|
4481
5125
|
* Set the sandbox operations implementation
|
|
4482
5126
|
* This is called by the cloud layer after creating the sync service
|
|
@@ -4494,8 +5138,9 @@ declare class SandboxFileSync {
|
|
|
4494
5138
|
* @param path - File path (stored in S3 and used as relative path in sandbox)
|
|
4495
5139
|
* @param content - File content
|
|
4496
5140
|
* @param options - Push options (e.g., targetPath to override sandbox location)
|
|
5141
|
+
* @param previousContent - Optional previous content for diff computation
|
|
4497
5142
|
*/
|
|
4498
|
-
pushFile(sessionId: string, path: string, content: Buffer, options?: PushOptions): Promise<FilePushResult>;
|
|
5143
|
+
pushFile(sessionId: string, path: string, content: Buffer, options?: PushOptions, previousContent?: Buffer): Promise<FilePushResult>;
|
|
4499
5144
|
/**
|
|
4500
5145
|
* Push multiple files
|
|
4501
5146
|
* @param sessionId - Session ID
|
|
@@ -4549,6 +5194,59 @@ declare class SandboxFileSync {
|
|
|
4549
5194
|
* Get a signed URL for direct file upload
|
|
4550
5195
|
*/
|
|
4551
5196
|
getUploadUrl(sessionId: string, path: string, expiresIn?: number): Promise<string>;
|
|
5197
|
+
/**
|
|
5198
|
+
* Start watching a sandbox for file changes and auto-sync to S3.
|
|
5199
|
+
*
|
|
5200
|
+
* For remote sandboxes (Vercel, E2B, etc.), uses polling.
|
|
5201
|
+
* For local sandboxes, can optionally use native file watching via chokidar.
|
|
5202
|
+
*
|
|
5203
|
+
* @param sessionId - Session to watch
|
|
5204
|
+
* @param options - Watch options (overrides constructor defaults)
|
|
5205
|
+
*/
|
|
5206
|
+
startWatching(sessionId: string, options?: FileWatchOptions): Promise<void>;
|
|
5207
|
+
/**
|
|
5208
|
+
* Stop watching a session's sandbox
|
|
5209
|
+
*/
|
|
5210
|
+
stopWatching(sessionId: string): Promise<void>;
|
|
5211
|
+
/**
|
|
5212
|
+
* Check if a session is being watched
|
|
5213
|
+
*/
|
|
5214
|
+
isWatching(sessionId: string): boolean;
|
|
5215
|
+
/**
|
|
5216
|
+
* Subscribe to file change events across all watched sessions.
|
|
5217
|
+
* This allows external applications to react to file changes.
|
|
5218
|
+
*
|
|
5219
|
+
* @param callback - Function to call when a file changes
|
|
5220
|
+
* @returns Unsubscribe function
|
|
5221
|
+
*
|
|
5222
|
+
* @example
|
|
5223
|
+
* ```typescript
|
|
5224
|
+
* const unsubscribe = fileSync.onFileChange((event) => {
|
|
5225
|
+
* console.log(`File ${event.relativePath} was ${event.type}d`);
|
|
5226
|
+
* // Update your application state here
|
|
5227
|
+
* });
|
|
5228
|
+
*
|
|
5229
|
+
* // Later, when done
|
|
5230
|
+
* unsubscribe();
|
|
5231
|
+
* ```
|
|
5232
|
+
*/
|
|
5233
|
+
onFileChange(callback: FileChangeCallback): () => void;
|
|
5234
|
+
/**
|
|
5235
|
+
* Remove a file change subscriber
|
|
5236
|
+
*/
|
|
5237
|
+
offFileChange(callback: FileChangeCallback): void;
|
|
5238
|
+
/**
|
|
5239
|
+
* Stop all watchers and cleanup
|
|
5240
|
+
*/
|
|
5241
|
+
stopAllWatching(): Promise<void>;
|
|
5242
|
+
/**
|
|
5243
|
+
* Get watching status for all sessions
|
|
5244
|
+
*/
|
|
5245
|
+
getWatchingStatus(): Array<{
|
|
5246
|
+
sessionId: string;
|
|
5247
|
+
type: 'remote' | 'local';
|
|
5248
|
+
isActive: boolean;
|
|
5249
|
+
}>;
|
|
4552
5250
|
}
|
|
4553
5251
|
/**
|
|
4554
5252
|
* Create a SandboxFileSync instance
|
|
@@ -4981,6 +5679,128 @@ declare function initializeSandboxPool(config?: SandboxPoolConfig): Promise<Sand
|
|
|
4981
5679
|
*/
|
|
4982
5680
|
declare function shutdownSandboxPool(): Promise<void>;
|
|
4983
5681
|
|
|
5682
|
+
/**
|
|
5683
|
+
* In-Sandbox File Watcher
|
|
5684
|
+
*
|
|
5685
|
+
* Runs a file watcher INSIDE the sandbox to detect file changes in real-time.
|
|
5686
|
+
* The watcher script runs as a background process in the sandbox and reports
|
|
5687
|
+
* changes via stdout which we capture and emit as events.
|
|
5688
|
+
*
|
|
5689
|
+
* This is more accurate than polling from outside because:
|
|
5690
|
+
* 1. Detects modifications, not just add/delete
|
|
5691
|
+
* 2. Real-time events (no polling delay)
|
|
5692
|
+
* 3. Catches all changes, even rapid ones
|
|
5693
|
+
*/
|
|
5694
|
+
|
|
5695
|
+
/**
|
|
5696
|
+
* Options for the in-sandbox file watcher
|
|
5697
|
+
*/
|
|
5698
|
+
interface InSandboxWatcherOptions {
|
|
5699
|
+
/** Session ID */
|
|
5700
|
+
sessionId: string;
|
|
5701
|
+
/** Path inside the sandbox to watch */
|
|
5702
|
+
watchPath: string;
|
|
5703
|
+
/** Poll interval for reading watcher output (ms). Default: 1000 */
|
|
5704
|
+
outputPollIntervalMs?: number;
|
|
5705
|
+
/** Callback for file change events */
|
|
5706
|
+
onFileChange?: FileChangeCallback;
|
|
5707
|
+
/** Callback for errors */
|
|
5708
|
+
onError?: (error: Error) => void;
|
|
5709
|
+
/** Callback when watcher is ready */
|
|
5710
|
+
onReady?: () => void;
|
|
5711
|
+
}
|
|
5712
|
+
/**
|
|
5713
|
+
* In-Sandbox File Watcher
|
|
5714
|
+
*
|
|
5715
|
+
* Runs a file watcher process inside the Vercel sandbox.
|
|
5716
|
+
* Uses the existing sandbox command execution infrastructure.
|
|
5717
|
+
*/
|
|
5718
|
+
declare class InSandboxWatcher {
|
|
5719
|
+
private readonly sessionId;
|
|
5720
|
+
private readonly watchPath;
|
|
5721
|
+
private readonly outputPollIntervalMs;
|
|
5722
|
+
private sandboxState;
|
|
5723
|
+
private outputPollTimer;
|
|
5724
|
+
private subscribers;
|
|
5725
|
+
private isRunning;
|
|
5726
|
+
private startedAt?;
|
|
5727
|
+
private lastHeartbeat?;
|
|
5728
|
+
private lastOutputPosition;
|
|
5729
|
+
private readonly onError?;
|
|
5730
|
+
private readonly onReady?;
|
|
5731
|
+
constructor(options: InSandboxWatcherOptions);
|
|
5732
|
+
/**
|
|
5733
|
+
* Start the watcher process inside the sandbox
|
|
5734
|
+
*/
|
|
5735
|
+
start(): Promise<void>;
|
|
5736
|
+
/**
|
|
5737
|
+
* Poll the output file for new events
|
|
5738
|
+
*/
|
|
5739
|
+
private pollOutput;
|
|
5740
|
+
/**
|
|
5741
|
+
* Process output from the watcher script
|
|
5742
|
+
*/
|
|
5743
|
+
private processOutput;
|
|
5744
|
+
/**
|
|
5745
|
+
* Stop the watcher process
|
|
5746
|
+
*/
|
|
5747
|
+
stop(): Promise<void>;
|
|
5748
|
+
/**
|
|
5749
|
+
* Subscribe to file change events
|
|
5750
|
+
*/
|
|
5751
|
+
subscribe(callback: FileChangeCallback): () => void;
|
|
5752
|
+
/**
|
|
5753
|
+
* Check if watcher is running
|
|
5754
|
+
*/
|
|
5755
|
+
isActive(): boolean;
|
|
5756
|
+
/**
|
|
5757
|
+
* Get watcher status
|
|
5758
|
+
*/
|
|
5759
|
+
getStatus(): {
|
|
5760
|
+
sessionId: string;
|
|
5761
|
+
watchPath: string;
|
|
5762
|
+
isRunning: boolean;
|
|
5763
|
+
startedAt?: Date;
|
|
5764
|
+
lastHeartbeat?: Date;
|
|
5765
|
+
};
|
|
5766
|
+
/**
|
|
5767
|
+
* Emit event to all subscribers
|
|
5768
|
+
*/
|
|
5769
|
+
private emitEvent;
|
|
5770
|
+
}
|
|
5771
|
+
/**
|
|
5772
|
+
* Create an in-sandbox file watcher
|
|
5773
|
+
*/
|
|
5774
|
+
declare function createInSandboxWatcher(options: InSandboxWatcherOptions): InSandboxWatcher;
|
|
5775
|
+
/**
|
|
5776
|
+
* Manager for in-sandbox watchers (one per session)
|
|
5777
|
+
*/
|
|
5778
|
+
declare class InSandboxWatcherManager {
|
|
5779
|
+
private watchers;
|
|
5780
|
+
/**
|
|
5781
|
+
* Start watching a sandbox
|
|
5782
|
+
*/
|
|
5783
|
+
startWatching(options: InSandboxWatcherOptions): Promise<InSandboxWatcher>;
|
|
5784
|
+
/**
|
|
5785
|
+
* Stop watching a session
|
|
5786
|
+
*/
|
|
5787
|
+
stopWatching(sessionId: string): Promise<void>;
|
|
5788
|
+
/**
|
|
5789
|
+
* Get watcher for a session
|
|
5790
|
+
*/
|
|
5791
|
+
getWatcher(sessionId: string): InSandboxWatcher | undefined;
|
|
5792
|
+
/**
|
|
5793
|
+
* Check if watching
|
|
5794
|
+
*/
|
|
5795
|
+
isWatching(sessionId: string): boolean;
|
|
5796
|
+
/**
|
|
5797
|
+
* Stop all watchers
|
|
5798
|
+
*/
|
|
5799
|
+
stopAll(): Promise<void>;
|
|
5800
|
+
}
|
|
5801
|
+
declare function getInSandboxWatcherManager(): InSandboxWatcherManager;
|
|
5802
|
+
declare function createInSandboxWatcherManager(): InSandboxWatcherManager;
|
|
5803
|
+
|
|
4984
5804
|
/**
|
|
4985
5805
|
* Agent Runtime & Sandboxing Configuration
|
|
4986
5806
|
*
|
|
@@ -9208,7 +10028,7 @@ interface SupabaseStorageConfig {
|
|
|
9208
10028
|
* Supabase storage implementation using Supabase JS client.
|
|
9209
10029
|
* Uses PostgREST API which avoids direct database connection issues.
|
|
9210
10030
|
*/
|
|
9211
|
-
declare class SupabaseStorage implements SessionStorage, TransactionalStorage, AgentStorage {
|
|
10031
|
+
declare class SupabaseStorage implements SessionStorage, TransactionalStorage, AgentStorage, EventStorage {
|
|
9212
10032
|
private client;
|
|
9213
10033
|
private initialized;
|
|
9214
10034
|
private tenantId;
|
|
@@ -9247,6 +10067,11 @@ declare class SupabaseStorage implements SessionStorage, TransactionalStorage, A
|
|
|
9247
10067
|
private rowToMessage;
|
|
9248
10068
|
private rowToAttachment;
|
|
9249
10069
|
private rowToAgent;
|
|
10070
|
+
private rowToSessionEvent;
|
|
10071
|
+
saveEvents(sessionId: SessionId, events: CreateSessionEventOptions[]): Promise<SessionEvent[]>;
|
|
10072
|
+
getSessionEvents(sessionId: SessionId, options?: ListSessionEventsOptions): Promise<PaginatedResult<SessionEvent>>;
|
|
10073
|
+
deleteSessionEvents(sessionId: SessionId): Promise<void>;
|
|
10074
|
+
getNextEventSequence(sessionId: SessionId): Promise<number>;
|
|
9250
10075
|
}
|
|
9251
10076
|
|
|
9252
10077
|
/**
|
|
@@ -9587,4 +10412,4 @@ declare class AshCloud {
|
|
|
9587
10412
|
*/
|
|
9588
10413
|
declare function createAshCloud(options?: Partial<AshCloudOptions>): AshCloud;
|
|
9589
10414
|
|
|
9590
|
-
export { AVAILABLE_MODELS, type ActionType, type ActiveSession, type AgentBackend, type AgentConfig$1 as AgentConfig, AgentConfigSchema, AgentError, AgentHarness, type AgentHarnessConfig, type AgentHooks, type AgentId, AgentStatus, type AgentStorage, type AgentsRouterOptions$1 as AgentsRouterOptions, AshCloud, AshCloudApiError, AshCloudClient, type AshCloudConfig, type AshCloudError, type AshCloudOptions, type AssistantMessageEntry, type Attachment, type AttachmentConfig, AttachmentConfigSchema, type AttachmentId, AttachmentStorage, type AttachmentStorageConfig, type BackendConfig, type BulkStorage, type BundleStore, type ClaudeAgentOptions, type ClaudeContentBlock, type ClaudeMessage, ClaudeSdkClient, type ClaudeStreamEvent, type ClaudeV2Session, CloudSandbox, type CloudSandboxConfig, CloudStorage, type CloudStorageConfig, type CommandRunAction, type CommandRunResult, ConfigBuilder, ConfigError, type CreateAgentOptions, type CreateQueueItemOptions, type CreateSessionOptions, CredentialManager, type CredentialManagerConfig, type CredentialStorage, type CustomExecutor, DEFAULT_MODELS, DEFAULT_SANDBOX_PROVIDER_CONFIG, type DiscoveredSkill, type DockerConfig, type EncryptedCredential, type EntryListener, type ErrorEntry, type ErrorEvent, type EventMiddleware, type FileContent$1 as FileContent, type FileEditAction, type FileEntry, type FileMetadata, type FileProvider, type FileProviderOptions, type FilePullResult, type FilePushResult, type FileReadAction, type FileStore, type FileWriteAction, GCSBundleStore, type GCSBundleStoreConfig, GeminiCliClient, type GeminiCliOptions, type GenericToolAction, type GetOrCreateSandboxOptions, GitHubFileProvider, type GitHubSkillConfig, type GitHubSkillResult, type GitHubSkillSource, type GitRepo, type GlobAction, type AgentConfig as HarnessAgentConfig, type HarnessConfig, HarnessConfigSchema, HarnessError, HarnessErrorCode, type HarnessErrorOptions, HarnessEventEmitter, type HarnessEventHandler, type HarnessEventPayloads, type HarnessEventType, type HarnessServer, type HarnessServerConfig, type HarnessServerHooks, type ImageContent, type ListAgentsOptions, type ListMessagesOptions, type ListQueueItemsOptions, type ListSessionsOptions, type LoadStateResult, LocalBundleStore, LocalFileProvider, LocalSandbox, type LocalSandboxConfig, type LocalSkillSource, type LogContext, type LogEntry, type LogLevel, type Logger, type LoggerConfig, type ManagedWorkspace, type McpAuth, McpConfigBuilder, type McpGenerationResult, type McpHttpServerConfig, McpPresets, type McpServerConfig, type McpServerInfo, McpServers, type McpStdioServerConfig, type McpTool, type McpToolAction, type McpTransportType, MemoryBundleStore, MemoryCredentialStorage, MemoryQueueStorage, MemoryRateLimitStore, MemoryStorage, type Message, type MessageContent, type MessageEvent, type MessageId, MessageRole, type NormalizedEntry, type NormalizedEntryType, type NormalizedToolCall, NotFoundError, type OpenAPIServer, type OpenAPIServerConfig, type PaginatedResult, type PaginationOptions, type PooledSandbox, PostgresQueueStorage, type PostgresQueueStorageConfig, PostgresStorage, type PostgresStorageConfig, ProviderSandbox, type ProviderSandboxConfig, type ProxyConfig, type QueueItem, QueueItemStatus, QueueProcessor, type QueueProcessorCallbacks, type QueueProcessorConfig, type QueueRouterOptions, type QueueStats, type QueueStorage, type RateLimitConfig, type RateLimitResult, type RateLimitStore, type RequestLoggerOptions, type ResumeSessionOptions, type RuntimeConfig, RuntimeConfigBuilder, RuntimePresets, S3BundleStore, type S3BundleStoreConfig, S3FileStore, type S3FileStoreConfig, SENSITIVE_PATHS, type SandboxConfig, type SandboxConnection, type SandboxFileOperations, SandboxFileSync, type SandboxFileSyncOptions, SandboxGitRepo, type SandboxHeartbeatStatus, type SandboxLogCallback, type SandboxLogCategory$1 as SandboxLogCategory, type SandboxLogEntry$1 as SandboxLogEntry, type SandboxLogEvent, type SandboxLogLevel$1 as SandboxLogLevel, SandboxLogger, SandboxPool, type SandboxPoolConfig, type SandboxPoolMetricsCallback, type SandboxPoolStatus, type SandboxProviderConfig, type SandboxProviderType, type SandboxReadResult, type SandboxWithState, type SandboxWriteResult, type SaveStateResult, type SearchAction, type SendMessageOptions, type SendMessageRequest, type SendMessageResult, type ServerConfig, ServerConfigSchema, type Session, type SessionEndEvent, SessionError, type SessionId, SessionManager, type SessionQueueStatus, type SessionStartEvent, SessionStatus, type SessionStoppedEvent, type SessionStorage, type SessionsRouterOptions$1 as SessionsRouterOptions, SkillCatalog, type SkillConfig, SkillManager, type SkillManagerOptions, type SkillSource, type SkillsConfig, type StartServerOptions, type StopSessionResult, type StorageConfig$1 as StorageConfig, StorageConfigSchema, StorageError, type StoredAgent, type StreamEvent, StreamEventType, SupabaseBundleStore, type SupabaseBundleStoreConfig, SupabaseStorage, type SupabaseStorageConfig, type SyncResult, type TextContent, type TextDeltaEvent, type ThinkingDeltaEvent, type ThinkingEntry, type TodoItem, type TodoStatus, type TodoWriteAction, type ToolCallEntry, ToolCallProcessor, ToolError, type ToolResult, type ToolResultContent, type ToolResultEvent, type ToolStatus, type ToolUseContent, type ToolUseEvent, type TransactionalStorage, type TurnCompleteEvent, type UpdateAgentOptions, type UserMessageEntry, ValidationError, type WebFetchAction, type WebSearchAction, Workspace, type CommandResult as WorkspaceCommandResult, type WorkspaceConfig, type WorkspaceHook, type WorkspaceLoadResult, WorkspaceManager, type WorkspaceSaveResult, type WorkspaceSessionConfig, attachmentSchema, attachmentToDataUrl, checkSecurityConfig, claudeClient, cleanupAllSandboxes, configureMcp, configureRuntime, convertClaudeMessage, createAgentsRouter$1 as createAgentsRouter, createAshCloud, createBackendExecutor, createCloudSandbox, createConfig, createCredentialManager, createOpenAPIServer as createDocumentedServer, createE2BSandbox, createEventHandler, createEventMiddlewareChain, createGCSBundleStore, createGeminiExecutor, createGitHubFileProvider, createGitRepo, createHarnessServer, createLocalBundleStore, createLocalFileProvider, createLocalSandbox, createLogger, createMemoryBundleStore, createMinioBundleStore, createMinioFileStore, createModalSandbox, createAgentsRouter as createOpenAPIAgentsRouter, createOpenAPIServer, createSessionsRouter as createOpenAPISessionsRouter, createSkillsRouter as createOpenAPISkillsRouter, createProviderSandbox, createQueueProcessor, createQueueRouter, createR2BundleStore, createR2FileStore, createS3BundleStore, createS3FileStore, createSandboxFileOperations, createSandboxFileSync, createSandboxLogger, createSandboxOptions, createSessionWorkspace, createSessionsRouter$1 as createSessionsRouter, createSkillCatalog, createSkillManager, createSupabaseBundleStore, createSupabaseBundleStoreFromEnv, createToolCall, createToolCallProcessor, createVercelSandbox, createVercelSandboxExecutor, createWorkspace, createWorkspaceHooks, createWorkspaceManager, dataUrlToBuffer, defineAgent, defineConfig, ensureSandboxPoolInitialized, env, envOptional, extractTextContent, extractTextFromMessage, fileEntrySchema, formatToolName, generateDockerCommand, generateMcpServerPackage, generateMcpServers, generateProxyEnv, generateToolSummary, getActionIcon, getActionLabel, getAllHeartbeatStatuses, getApiKeyEnvVar, getDefaultModel, getHeartbeatStatus, getOrCreateSandbox, getSandboxCacheStats, getSandboxPool, getWorkspaceManager, gitHubSkillSourceSchema, globalEventEmitter, hasErrorCode, hashStartupScript, httpMcpWithAuth, initializeSandboxPool, introspectMcpServer, invalidateSandbox, isCommandRunAction, isDocumentMimeType, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isHarnessError, isHttpMcpConfig, isImageMimeType, isMcpToolAction, isSandboxExpiredError, isSandboxRunning, isSearchAction, isSensitivePath, isStdioMcpConfig, isTodoWriteAction, isToolCallEntry, isValidModel, isWebFetchAction, isWebSearchAction, listFilesInSandbox, loadConfig, loadGitHubSkill, loadGitHubSkills, loadWorkspaceState, localSkillSourceSchema, log, mapClaudeOptionsToGemini, mapToolToActionType, markConfigInstalled, markSdkInstalled, markStartupScriptRan, mcpAuthToHeaders, messageContentSchema, messageSchema, needsStartupScriptRerun, normalizeGitHubConfigs, normalizeMcpServers, normalizeMessages, normalizeToolResult, onHeartbeat, schemas as openApiSchemas, parseCommandResult, parseGitHubUrl, parseMcpToolName, processStreamEvents, rateLimit, rateLimiters, readFileFromSandbox, rekeySessionId, releaseSandbox, requestLogger, saveWorkspaceState, sessionSchema, shouldUseSandbox, shutdownSandboxPool, skillConfigSchema, skillSourceSchema, sseMcpWithAuth, startServer, updateToolCallWithResult, writeFileToSandbox };
|
|
10415
|
+
export { AVAILABLE_MODELS, type ActionType, type ActiveSession, type AgentBackend, type AgentConfig$1 as AgentConfig, AgentConfigSchema, AgentError, AgentHarness, type AgentHarnessConfig, type AgentHooks, type AgentId, AgentStatus, type AgentStorage, type AgentsRouterOptions$1 as AgentsRouterOptions, AshCloud, AshCloudApiError, AshCloudClient, type AshCloudConfig, type AshCloudError, type AshCloudOptions, type AssistantMessageEntry, type Attachment, type AttachmentConfig, AttachmentConfigSchema, type AttachmentId, AttachmentStorage, type AttachmentStorageConfig, type BackendConfig, type BulkStorage, type BundleStore, type ClaudeAgentOptions, type ClaudeContentBlock, type ClaudeMessage, ClaudeSdkClient, type ClaudeStreamEvent, type ClaudeV2Session, CloudSandbox, type CloudSandboxConfig, CloudStorage, type CloudStorageConfig, type CommandRunAction, type CommandRunResult, ConfigBuilder, ConfigError, type CreateAgentOptions, type CreateQueueItemOptions, type CreateSessionEventOptions, type CreateSessionOptions, CredentialManager, type CredentialManagerConfig, type CredentialStorage, type CustomExecutor, DEFAULT_MODELS, DEFAULT_SANDBOX_PROVIDER_CONFIG, type DiscoveredSkill, type DockerConfig, type EncryptedCredential, type EntryListener, type ErrorEntry, type ErrorEvent, EventCategory, type EventMiddleware, type EventStorage, type FileChangeCallback, type FileChangeEvent, type FileChangeType, type FileContent$1 as FileContent, type FileEditAction, type FileEntry, type FileMetadata, type FileProvider, type FileProviderOptions, type FilePullResult, type FilePushResult, type FileReadAction, type FileStore, type FileSyncDirection, type FileSyncEvent, type FileSyncEventData, type FileSyncOperation, type FileSyncSource, type FileWatchOptions, FileWatcherManager, type FileWatcherOptions, type FileWatcherStatus, type FileWriteAction, GCSBundleStore, type GCSBundleStoreConfig, GeminiCliClient, type GeminiCliOptions, type GenericToolAction, type GetOrCreateSandboxOptions, GitHubFileProvider, type GitHubSkillConfig, type GitHubSkillResult, type GitHubSkillSource, type GitRepo, type GlobAction, type AgentConfig as HarnessAgentConfig, type HarnessConfig, HarnessConfigSchema, HarnessError, HarnessErrorCode, type HarnessErrorOptions, HarnessEventEmitter, type HarnessEventHandler, type HarnessEventPayloads, type HarnessEventType, type HarnessServer, type HarnessServerConfig, type HarnessServerHooks, type ImageContent, InSandboxWatcher, InSandboxWatcherManager, type InSandboxWatcherOptions, type ListAgentsOptions, type ListMessagesOptions, type ListQueueItemsOptions, type ListSessionEventsOptions, type ListSessionsOptions, type LoadStateResult, LocalBundleStore, LocalFileProvider, LocalSandbox, type LocalSandboxConfig, type LocalSkillSource, type LogContext, type LogEntry, type LogLevel, type Logger, type LoggerConfig, type ManagedWorkspace, type McpAuth, McpConfigBuilder, type McpGenerationResult, type McpHttpServerConfig, McpPresets, type McpServerConfig, type McpServerInfo, type McpServerStatus, McpServers, type McpStatusEvent, type McpStdioServerConfig, type McpTool, type McpToolAction, type McpTransportType, MemoryBundleStore, MemoryCredentialStorage, MemoryQueueStorage, MemoryRateLimitStore, MemoryStorage, type Message, type MessageContent, type MessageEvent, type MessageId, MessageRole, type NormalizedEntry, type NormalizedEntryType, type NormalizedToolCall, NotFoundError, type OpenAPIServer, type OpenAPIServerConfig, type PaginatedResult, type PaginationOptions, type PooledSandbox, PostgresQueueStorage, type PostgresQueueStorageConfig, PostgresStorage, type PostgresStorageConfig, ProviderSandbox, type ProviderSandboxConfig, type ProxyConfig, type QueueItem, QueueItemStatus, QueueProcessor, type QueueProcessorCallbacks, type QueueProcessorConfig, type QueueRouterOptions, type QueueStats, type QueueStorage, type RateLimitConfig, type RateLimitResult, type RateLimitStore, RemoteFileWatcherManager, type RemoteFileWatcherOptions, RemoteSandboxFileWatcher, type RequestLoggerOptions, type ResumeSessionOptions, type RuntimeConfig, RuntimeConfigBuilder, RuntimePresets, S3BundleStore, type S3BundleStoreConfig, S3FileStore, type S3FileStoreConfig, SENSITIVE_PATHS, type SandboxConfig, type SandboxConnection, type SandboxFileOperations, SandboxFileSync, type SandboxFileSyncOptions, SandboxFileWatcher, SandboxGitRepo, type SandboxHeartbeatStatus, type SandboxLogCallback, type SandboxLogCategory$1 as SandboxLogCategory, type SandboxLogEntry$1 as SandboxLogEntry, type SandboxLogEvent, type SandboxLogLevel$1 as SandboxLogLevel, SandboxLogger, SandboxPool, type SandboxPoolConfig, type SandboxPoolMetricsCallback, type SandboxPoolStatus, type SandboxProviderConfig, type SandboxProviderType, type SandboxReadResult, type SandboxWithState, type SandboxWriteResult, type SaveStateResult, type SearchAction, type SendMessageOptions, type SendMessageRequest, type SendMessageResult, type ServerConfig, ServerConfigSchema, type Session, type SessionEndEvent, SessionError, type SessionEvent, type SessionId, SessionManager, type SessionQueueStatus, type SessionStartEvent, SessionStatus, type SessionStoppedEvent, type SessionStorage, type SessionsRouterOptions$1 as SessionsRouterOptions, SkillCatalog, type SkillConfig, SkillManager, type SkillManagerOptions, type SkillSource, type SkillsConfig, type StartServerOptions, type StopSessionResult, type StorageConfig$1 as StorageConfig, StorageConfigSchema, StorageError, type StoredAgent, type StreamEvent, StreamEventType, SupabaseBundleStore, type SupabaseBundleStoreConfig, SupabaseStorage, type SupabaseStorageConfig, type SyncResult, type TextContent, type TextDeltaEvent, type ThinkingDeltaEvent, type ThinkingEntry, type TodoItem, type TodoStatus, type TodoWriteAction, type ToolCallEntry, ToolCallProcessor, ToolError, type ToolResult, type ToolResultContent, type ToolResultEvent, type ToolStatus, type ToolUseContent, type ToolUseEvent, type TransactionalStorage, type TurnCompleteEvent, type UpdateAgentOptions, type UserMessageEntry, ValidationError, type WebFetchAction, type WebSearchAction, type WebhookConfig, type WebhookPayload, Workspace, type CommandResult as WorkspaceCommandResult, type WorkspaceConfig, type WorkspaceHook, type WorkspaceLoadResult, WorkspaceManager, type WorkspaceSaveResult, type WorkspaceSessionConfig, attachmentSchema, attachmentToDataUrl, checkSecurityConfig, claudeClient, cleanupAllSandboxes, configureMcp, configureRuntime, convertClaudeMessage, createAgentsRouter$1 as createAgentsRouter, createAshCloud, createBackendExecutor, createCloudSandbox, createConfig, createCredentialManager, createOpenAPIServer as createDocumentedServer, createE2BSandbox, createEventHandler, createEventMiddlewareChain, createFileWatcher, createFileWatcherManager, createGCSBundleStore, createGeminiExecutor, createGitHubFileProvider, createGitRepo, createHarnessServer, createInSandboxWatcher, createInSandboxWatcherManager, createLocalBundleStore, createLocalFileProvider, createLocalSandbox, createLogger, createMemoryBundleStore, createMinioBundleStore, createMinioFileStore, createModalSandbox, createAgentsRouter as createOpenAPIAgentsRouter, createOpenAPIServer, createSessionsRouter as createOpenAPISessionsRouter, createSkillsRouter as createOpenAPISkillsRouter, createProviderSandbox, createQueueProcessor, createQueueRouter, createR2BundleStore, createR2FileStore, createRemoteFileWatcher, createRemoteFileWatcherManager, createS3BundleStore, createS3FileStore, createSandboxFileOperations, createSandboxFileSync, createSandboxLogger, createSandboxOptions, createSessionWorkspace, createSessionsRouter$1 as createSessionsRouter, createSkillCatalog, createSkillManager, createSupabaseBundleStore, createSupabaseBundleStoreFromEnv, createToolCall, createToolCallProcessor, createVercelSandbox, createVercelSandboxExecutor, createWorkspace, createWorkspaceHooks, createWorkspaceManager, dataUrlToBuffer, defineAgent, defineConfig, ensureSandboxPoolInitialized, env, envOptional, extractTextContent, extractTextFromMessage, fileEntrySchema, formatToolName, generateDockerCommand, generateMcpServerPackage, generateMcpServers, generateProxyEnv, generateToolSummary, getActionIcon, getActionLabel, getAllHeartbeatStatuses, getApiKeyEnvVar, getDefaultModel, getFileWatcherManager, getHeartbeatStatus, getInSandboxWatcherManager, getOrCreateSandbox, getRemoteFileWatcherManager, getSandboxCacheStats, getSandboxPool, getWorkspaceManager, gitHubSkillSourceSchema, globalEventEmitter, hasErrorCode, hashStartupScript, httpMcpWithAuth, initializeSandboxPool, introspectMcpServer, invalidateSandbox, isCommandRunAction, isDocumentMimeType, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isHarnessError, isHttpMcpConfig, isImageMimeType, isMcpToolAction, isSandboxExpiredError, isSandboxRunning, isSearchAction, isSensitivePath, isStdioMcpConfig, isTodoWriteAction, isToolCallEntry, isValidModel, isWebFetchAction, isWebSearchAction, listFilesInSandbox, loadConfig, loadGitHubSkill, loadGitHubSkills, loadWorkspaceState, localSkillSourceSchema, log, mapClaudeOptionsToGemini, mapToolToActionType, markConfigInstalled, markSdkInstalled, markStartupScriptRan, mcpAuthToHeaders, messageContentSchema, messageSchema, needsStartupScriptRerun, normalizeGitHubConfigs, normalizeMcpServers, normalizeMessages, normalizeToolResult, onHeartbeat, schemas as openApiSchemas, parseCommandResult, parseGitHubUrl, parseMcpToolName, processStreamEvents, rateLimit, rateLimiters, readFileFromSandbox, rekeySessionId, releaseSandbox, requestLogger, saveWorkspaceState, sessionSchema, shouldUseSandbox, shutdownSandboxPool, skillConfigSchema, skillSourceSchema, sseMcpWithAuth, startServer, updateToolCallWithResult, writeFileToSandbox };
|