@rivet-dev/agentos-core 0.0.0-main.29b0797 → 0.0.0-main.5ac5a14
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 +10 -199
- package/dist/agent-os.d.ts +332 -54
- package/dist/agent-os.js +1533 -91
- package/dist/agentos-package.d.ts +2 -2
- package/dist/agentos-package.js +2 -2
- package/dist/base-filesystem.js +2 -2
- package/dist/code-execution.d.ts +70 -0
- package/dist/code-execution.js +115 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -1
- package/dist/language-execution.d.ts +170 -0
- package/dist/language-execution.js +1 -0
- package/dist/options-schema.d.ts +19 -3
- package/dist/options-schema.js +17 -2
- package/dist/packages.d.ts +1 -1
- package/dist/runtime-compat.js +19 -7
- package/dist/sandbox.js +33 -20
- package/dist/sidecar/agentos-protocol.d.ts +14 -3
- package/dist/sidecar/agentos-protocol.js +10 -0
- package/dist/sidecar/rpc-client.d.ts +1 -0
- package/dist/sidecar/rpc-client.js +25 -16
- package/dist/types.d.ts +5 -3
- package/package.json +26 -20
package/dist/agent-os.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { NativeMountPluginDescriptor } from "@rivet-dev/agentos-runtime-core/descriptors";
|
|
2
2
|
import type { VmUserConfig } from "@rivet-dev/agentos-runtime-core/vm-config";
|
|
3
|
-
import type { CancelPromptResult, HistoryPage, ListSessionsInput, OpenSessionInput, PermissionResponse, PermissionResponseResult, PromptInput, PromptResult as DurablePromptResult, ReadHistoryInput, SessionCapabilities, SessionAgentInfo, SessionConfig, SessionInfo as DurableSessionInfo, SessionPage, SessionStreamEntry, SessionTarget, SetSessionConfigOptionInput } from "./session-api.js";
|
|
4
3
|
import { type Bindings } from "./bindings.js";
|
|
5
|
-
import type {
|
|
4
|
+
import type { CodeEvaluationResult, CodeExecutionResult, ContextDescriptor, ExecutionSignal, InlineExecutionOptions, JavaScriptEvaluationOptions, JavaScriptExecutionOptions, LanguageExecutionOptions, LanguageSpawnOptions, NpmPackageInstallOptions, NpmProjectInstallOptions, OutputReplay, ProcessDescriptor, ProcessExit, PythonInstallOptions, SpawnOptions, TypeScriptCheckOptions, TypeScriptCheckResult, TypeScriptEvaluationOptions, TypeScriptExecutionOptions, TypeScriptFileExecutionOptions } from "./language-execution.js";
|
|
5
|
+
import type { ConnectTerminalOptions, Kernel, KernelExecOptions, KernelExecResult, OpenShellOptions, Permissions, VirtualFileSystem, VirtualStat } from "./runtime-compat.js";
|
|
6
|
+
import { type AgentOsSandboxInput } from "./sandbox.js";
|
|
7
|
+
import type { CancelPromptResult, PromptResult as DurablePromptResult, SessionInfo as DurableSessionInfo, HistoryPage, JsonValue, ListSessionsInput, OpenSessionInput, PermissionResponse, PermissionResponseResult, PromptInput, ReadHistoryInput, SessionAgentInfo, SessionCapabilities, SessionConfig, SessionPage, SessionStreamEntry, SessionTarget, SetSessionConfigOptionInput } from "./session-api.js";
|
|
6
8
|
export type { MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountPluginDescriptor, } from "@rivet-dev/agentos-runtime-core/descriptors";
|
|
7
9
|
export type { ConnectTerminalOptions } from "./runtime-compat.js";
|
|
8
10
|
export type * from "./session-api.js";
|
|
9
|
-
/** Process tree node
|
|
10
|
-
export interface ProcessTreeNode extends
|
|
11
|
+
/** Process tree node using the same descriptor shape as process.get/list. */
|
|
12
|
+
export interface ProcessTreeNode extends ProcessDescriptor {
|
|
13
|
+
ppid?: number;
|
|
11
14
|
children: ProcessTreeNode[];
|
|
12
15
|
}
|
|
13
16
|
/** A directory entry with metadata. */
|
|
@@ -43,10 +46,6 @@ export interface ProcessOutput {
|
|
|
43
46
|
stream: "stdout" | "stderr";
|
|
44
47
|
data: Uint8Array;
|
|
45
48
|
}
|
|
46
|
-
export interface ProcessExit {
|
|
47
|
-
pid: number;
|
|
48
|
-
exitCode: number;
|
|
49
|
-
}
|
|
50
49
|
export interface ShellData {
|
|
51
50
|
shellId: string;
|
|
52
51
|
data: Uint8Array;
|
|
@@ -71,8 +70,6 @@ export interface DynamicMountDescriptor {
|
|
|
71
70
|
plugin: NativeMountPluginDescriptor;
|
|
72
71
|
readOnly?: boolean;
|
|
73
72
|
}
|
|
74
|
-
/** Callback-free options accepted by the portable spawn API. */
|
|
75
|
-
export type SpawnOptions = Omit<KernelSpawnOptions, "onStdout" | "onStderr">;
|
|
76
73
|
/** Callback-free options accepted by the portable openShell API. */
|
|
77
74
|
export type ShellOptions = Omit<OpenShellOptions, "onStderr">;
|
|
78
75
|
/** Options for readdirRecursive(). */
|
|
@@ -149,7 +146,6 @@ export type RootFilesystemConfig = OverlayRootFilesystemConfig | NativeRootFiles
|
|
|
149
146
|
export type VmSqliteConfig = {
|
|
150
147
|
type: "actor_uds";
|
|
151
148
|
path: string;
|
|
152
|
-
token: string;
|
|
153
149
|
} | {
|
|
154
150
|
type: "sqlite_file";
|
|
155
151
|
path: string;
|
|
@@ -226,12 +222,16 @@ export interface AgentOsLimits {
|
|
|
226
222
|
/** Cap on `vm.httpRequest()` buffered response bodies. Must be <= the sidecar wire frame cap. */
|
|
227
223
|
maxFetchResponseBytes?: number;
|
|
228
224
|
};
|
|
225
|
+
/** TLS plaintext buffering limits. */
|
|
226
|
+
tls?: {
|
|
227
|
+
maxBufferedBytes?: number;
|
|
228
|
+
};
|
|
229
229
|
/** Host binding registration and invocation limits. */
|
|
230
230
|
bindings?: {
|
|
231
231
|
defaultBindingTimeoutMs?: number;
|
|
232
232
|
maxBindingTimeoutMs?: number;
|
|
233
233
|
maxRegisteredCollections?: number;
|
|
234
|
-
|
|
234
|
+
maxRegisteredBindingsPerVm?: number;
|
|
235
235
|
maxBindingsPerCollection?: number;
|
|
236
236
|
maxBindingSchemaBytes?: number;
|
|
237
237
|
maxExamplesPerBinding?: number;
|
|
@@ -394,6 +394,8 @@ export interface AgentOsOptions {
|
|
|
394
394
|
rootFilesystem?: RootFilesystemConfig;
|
|
395
395
|
/** Filesystems to mount at boot time. */
|
|
396
396
|
mounts?: MountConfig[];
|
|
397
|
+
/** External sandbox mounted into this VM with process bindings. */
|
|
398
|
+
sandbox?: AgentOsSandboxInput;
|
|
397
399
|
/** Custom schedule driver for cron jobs. Defaults to TimerScheduleDriver. */
|
|
398
400
|
scheduleDriver?: ScheduleDriver;
|
|
399
401
|
/** Host-side bindings available to agents inside the VM. */
|
|
@@ -440,20 +442,16 @@ export interface AgentOsRuntimeAdmin {
|
|
|
440
442
|
env: Record<string, string>;
|
|
441
443
|
sidecar: AgentOsSidecar;
|
|
442
444
|
}
|
|
443
|
-
/** Information about a process spawned via AgentOs.spawn(). */
|
|
444
|
-
export interface SpawnedProcessInfo {
|
|
445
|
-
pid: number;
|
|
446
|
-
command: string;
|
|
447
|
-
args: string[];
|
|
448
|
-
running: boolean;
|
|
449
|
-
exitCode: number | null;
|
|
450
|
-
}
|
|
451
445
|
export declare class AgentOs {
|
|
452
446
|
#private;
|
|
453
447
|
readonly sidecar: AgentOsSidecar;
|
|
454
448
|
private _durableSessionEventHandlers;
|
|
455
449
|
private _agentExitHandlers;
|
|
456
450
|
private _processes;
|
|
451
|
+
private _languageProcesses;
|
|
452
|
+
private _languageProcessIds;
|
|
453
|
+
private _executionOutputHandlers;
|
|
454
|
+
private _executionCompletedHandlers;
|
|
457
455
|
private _shells;
|
|
458
456
|
private _closedShellIds;
|
|
459
457
|
private _pendingShellExitPromises;
|
|
@@ -476,64 +474,293 @@ export declare class AgentOs {
|
|
|
476
474
|
private readonly _agentStderrHandler?;
|
|
477
475
|
private readonly _agentExitHandler?;
|
|
478
476
|
private readonly _limitWarningHandler?;
|
|
477
|
+
private readonly _disposeHooks;
|
|
478
|
+
/**
|
|
479
|
+
* Execute commands and manage child processes in the VM.
|
|
480
|
+
*
|
|
481
|
+
* `exec` evaluates a command with the configured shell, while `execFile`
|
|
482
|
+
* invokes an executable directly with an argv array.
|
|
483
|
+
*/
|
|
484
|
+
readonly process: {
|
|
485
|
+
exec: (command: string, options?: LanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
486
|
+
execFile: (command: string, args?: readonly string[], options?: Omit<LanguageExecutionOptions, "args">) => Promise<CodeExecutionResult>;
|
|
487
|
+
spawn: (command: string, args?: string[], options?: SpawnOptions) => Promise<ProcessDescriptor>;
|
|
488
|
+
get: (pid: number) => Promise<ProcessDescriptor>;
|
|
489
|
+
list: () => Promise<ProcessDescriptor[]>;
|
|
490
|
+
tree: () => Promise<ProcessTreeNode[]>;
|
|
491
|
+
wait: (pid: number) => Promise<ProcessExit>;
|
|
492
|
+
signal: (pid: number, signal: ExecutionSignal) => Promise<void>;
|
|
493
|
+
kill: (pid: number) => Promise<void>;
|
|
494
|
+
writeStdin: (pid: number, data: string | Uint8Array) => Promise<void>;
|
|
495
|
+
closeStdin: (pid: number) => Promise<void>;
|
|
496
|
+
resizePty: (pid: number, size: {
|
|
497
|
+
cols: number;
|
|
498
|
+
rows: number;
|
|
499
|
+
}) => Promise<void>;
|
|
500
|
+
readOutput: (pid: number, options?: {
|
|
501
|
+
after?: number;
|
|
502
|
+
}) => Promise<OutputReplay>;
|
|
503
|
+
};
|
|
504
|
+
readonly javascript: {
|
|
505
|
+
execute: (source: string, options?: JavaScriptExecutionOptions) => Promise<CodeExecutionResult>;
|
|
506
|
+
evaluate: <T = JsonValue>(expression: string, options?: JavaScriptEvaluationOptions) => Promise<CodeEvaluationResult<T>>;
|
|
507
|
+
executeFile: (path: string, options?: LanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
508
|
+
spawn: (source: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
509
|
+
spawnFile: (path: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
510
|
+
npm: {
|
|
511
|
+
install: {
|
|
512
|
+
(options?: NpmProjectInstallOptions): Promise<CodeExecutionResult>;
|
|
513
|
+
(packages: string | string[], options?: NpmPackageInstallOptions): Promise<CodeExecutionResult>;
|
|
514
|
+
};
|
|
515
|
+
runScript: (script: string, options?: LanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
516
|
+
runPackage: (packageSpec: string, options?: LanguageExecutionOptions & {
|
|
517
|
+
binary?: string;
|
|
518
|
+
}) => Promise<CodeExecutionResult>;
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
readonly typescript: {
|
|
522
|
+
execute: (source: string, options?: TypeScriptExecutionOptions) => Promise<CodeExecutionResult>;
|
|
523
|
+
evaluate: <T = JsonValue>(expression: string, options?: TypeScriptEvaluationOptions) => Promise<CodeEvaluationResult<T>>;
|
|
524
|
+
executeFile: (path: string, options?: TypeScriptFileExecutionOptions) => Promise<CodeExecutionResult>;
|
|
525
|
+
spawn: (source: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
526
|
+
spawnFile: (path: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
527
|
+
check: (source: string, options?: TypeScriptCheckOptions) => Promise<TypeScriptCheckResult>;
|
|
528
|
+
checkProject: (options?: Omit<TypeScriptCheckOptions, "filePath" | "compilerOptions">) => Promise<TypeScriptCheckResult>;
|
|
529
|
+
};
|
|
530
|
+
readonly python: {
|
|
531
|
+
execute: (source: string, options?: InlineExecutionOptions) => Promise<CodeExecutionResult>;
|
|
532
|
+
evaluate: <T = JsonValue>(expression: string, options?: InlineExecutionOptions) => Promise<CodeEvaluationResult<T>>;
|
|
533
|
+
executeFile: (path: string, options?: LanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
534
|
+
executeModule: (module: string, options?: LanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
535
|
+
spawn: (source: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
536
|
+
spawnFile: (path: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
537
|
+
spawnModule: (module: string, options?: LanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
538
|
+
install: {
|
|
539
|
+
(options?: PythonInstallOptions): Promise<CodeExecutionResult>;
|
|
540
|
+
(packages: string | string[], options?: PythonInstallOptions): Promise<CodeExecutionResult>;
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
readonly contexts: {
|
|
544
|
+
get: (contextId: string) => Promise<ContextDescriptor>;
|
|
545
|
+
list: () => Promise<ContextDescriptor[]>;
|
|
546
|
+
reset: (contextId: string) => Promise<void>;
|
|
547
|
+
delete: (contextId: string) => Promise<void>;
|
|
548
|
+
};
|
|
549
|
+
readonly terminal: {
|
|
550
|
+
open: (options?: ShellOptions) => {
|
|
551
|
+
shellId: string;
|
|
552
|
+
};
|
|
553
|
+
write: (shellId: string, data: string | Uint8Array) => Promise<void>;
|
|
554
|
+
resize: (shellId: string, cols: number, rows: number) => void;
|
|
555
|
+
wait: (shellId: string) => Promise<number>;
|
|
556
|
+
close: (shellId: string) => void;
|
|
557
|
+
};
|
|
558
|
+
readonly filesystem: {
|
|
559
|
+
readFile: (path: string) => Promise<Uint8Array>;
|
|
560
|
+
writeFile: (path: string, content: string | Uint8Array) => Promise<void>;
|
|
561
|
+
readFiles: (paths: string[]) => Promise<BatchReadResult[]>;
|
|
562
|
+
writeFiles: (entries: BatchWriteEntry[]) => Promise<BatchWriteResult[]>;
|
|
563
|
+
stat: (path: string) => Promise<VirtualStat>;
|
|
564
|
+
mkdir: (path: string, options?: {
|
|
565
|
+
recursive?: boolean;
|
|
566
|
+
}) => Promise<void>;
|
|
567
|
+
readdir: (path: string) => Promise<string[]>;
|
|
568
|
+
readdirEntries: (path: string) => Promise<ReaddirEntry[]>;
|
|
569
|
+
readdirRecursive: (path: string, options?: ReaddirRecursiveOptions) => Promise<DirEntry[]>;
|
|
570
|
+
exists: (path: string) => Promise<boolean>;
|
|
571
|
+
move: (from: string, to: string) => Promise<void>;
|
|
572
|
+
remove: (path: string, options?: {
|
|
573
|
+
recursive?: boolean;
|
|
574
|
+
}) => Promise<void>;
|
|
575
|
+
export: (options: ExportRootFilesystemOptions) => Promise<RootSnapshotExport>;
|
|
576
|
+
mount: (descriptor: DynamicMountDescriptor) => Promise<void>;
|
|
577
|
+
unmount: (path: string) => Promise<void>;
|
|
578
|
+
listMounts: () => Promise<MountInfo[]>;
|
|
579
|
+
};
|
|
580
|
+
readonly network: {
|
|
581
|
+
httpRequest: (request: HttpRequest) => Promise<HttpResponse>;
|
|
582
|
+
};
|
|
583
|
+
readonly software: {
|
|
584
|
+
list: () => Promise<{
|
|
585
|
+
packageName: string;
|
|
586
|
+
commands: string[];
|
|
587
|
+
}[]>;
|
|
588
|
+
link: (descriptor: PackageDescriptor) => Promise<void>;
|
|
589
|
+
};
|
|
590
|
+
readonly agents: {
|
|
591
|
+
list: () => Promise<AgentRegistryEntry[]>;
|
|
592
|
+
};
|
|
593
|
+
readonly sessions: {
|
|
594
|
+
open: (input: OpenSessionInput) => Promise<void>;
|
|
595
|
+
get: (input?: SessionTarget) => Promise<DurableSessionInfo>;
|
|
596
|
+
list: (input?: ListSessionsInput) => Promise<SessionPage>;
|
|
597
|
+
delete: (input?: SessionTarget) => Promise<void>;
|
|
598
|
+
unload: (input?: SessionTarget) => Promise<void>;
|
|
599
|
+
prompt: (input: PromptInput) => Promise<DurablePromptResult>;
|
|
600
|
+
cancelPrompt: (input?: SessionTarget) => Promise<CancelPromptResult>;
|
|
601
|
+
respondPermission: (input: PermissionResponse) => Promise<PermissionResponseResult>;
|
|
602
|
+
readHistory: (input?: ReadHistoryInput) => Promise<HistoryPage>;
|
|
603
|
+
getConfig: (input?: SessionTarget) => Promise<SessionConfig>;
|
|
604
|
+
setConfigOption: (input: SetSessionConfigOptionInput) => Promise<SessionConfig>;
|
|
605
|
+
getCapabilities: (input?: SessionTarget) => Promise<SessionCapabilities | null>;
|
|
606
|
+
getAgentInfo: (input?: SessionTarget) => Promise<SessionAgentInfo | null>;
|
|
607
|
+
};
|
|
608
|
+
readonly cron: {
|
|
609
|
+
schedule: (options: CronJobOptions) => CronJob;
|
|
610
|
+
list: () => CronJobInfo[];
|
|
611
|
+
cancel: (id: string) => void;
|
|
612
|
+
};
|
|
479
613
|
private constructor();
|
|
480
614
|
static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
|
|
481
615
|
static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>;
|
|
482
616
|
static create(options?: AgentOsOptions): Promise<AgentOs>;
|
|
617
|
+
createContext(contextId: string): Promise<void>;
|
|
618
|
+
private _executionOperation;
|
|
619
|
+
private _spawnLanguageOperation;
|
|
620
|
+
private _exec;
|
|
621
|
+
private _execFile;
|
|
622
|
+
/** @deprecated Use `process.exec()` for lifecycle-aware execution. */
|
|
483
623
|
exec(command: string, options?: KernelExecOptions): Promise<KernelExecResult>;
|
|
624
|
+
/** @deprecated Use `process.execFile()` for lifecycle-aware execution. */
|
|
484
625
|
execArgv(command: string, args?: readonly string[], options?: KernelExecOptions): Promise<KernelExecResult>;
|
|
626
|
+
private _executeJavaScript;
|
|
627
|
+
private _evaluationOperation;
|
|
628
|
+
private _evaluateJavaScript;
|
|
629
|
+
private _executeJavaScriptFile;
|
|
630
|
+
private _spawnJavaScript;
|
|
631
|
+
private _spawnJavaScriptFile;
|
|
632
|
+
private _executeTypeScript;
|
|
633
|
+
private _evaluateTypeScript;
|
|
634
|
+
private _executeTypeScriptFile;
|
|
635
|
+
private _spawnTypeScript;
|
|
636
|
+
private _spawnTypeScriptFile;
|
|
637
|
+
private _checkTypeScript;
|
|
638
|
+
private _checkTypeScriptProject;
|
|
639
|
+
private _installNpmPackages;
|
|
640
|
+
private _executeNpmScript;
|
|
641
|
+
private _executeNpmPackage;
|
|
642
|
+
private _executePython;
|
|
643
|
+
private _evaluatePython;
|
|
644
|
+
private _executePythonFile;
|
|
645
|
+
private _executePythonModule;
|
|
646
|
+
private _spawnPython;
|
|
647
|
+
private _spawnPythonFile;
|
|
648
|
+
private _spawnPythonModule;
|
|
649
|
+
private _installPythonPackages;
|
|
650
|
+
private _getContext;
|
|
651
|
+
private _listContexts;
|
|
652
|
+
private _waitExecutionResult;
|
|
653
|
+
private _cancelExecution;
|
|
654
|
+
private _signalExecution;
|
|
655
|
+
private _resetContext;
|
|
656
|
+
private _descriptorLifecycleRequest;
|
|
657
|
+
private _deleteContext;
|
|
658
|
+
private _writeExecutionStdin;
|
|
659
|
+
private _closeExecutionStdin;
|
|
660
|
+
private _resizeExecutionPty;
|
|
661
|
+
private _readExecutionOutput;
|
|
662
|
+
private _onExecutionOutput;
|
|
663
|
+
private _onExecutionCompleted;
|
|
485
664
|
private _trackProcess;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
};
|
|
665
|
+
private _spawnProcess;
|
|
666
|
+
spawn(command: string, args?: string[], options?: SpawnOptions): Promise<ProcessDescriptor>;
|
|
489
667
|
/** Write data to a process's stdin. */
|
|
490
|
-
|
|
668
|
+
private _writeProcessStdin;
|
|
491
669
|
/** Close a process's stdin stream. */
|
|
492
|
-
|
|
670
|
+
private _closeProcessStdin;
|
|
493
671
|
/** Subscribe to stdout and stderr from a process. */
|
|
494
672
|
onProcessOutput(pid: number, handler: (event: ProcessOutput) => void): () => void;
|
|
495
673
|
/** Subscribe to process exit. Returns an unsubscribe function. */
|
|
496
674
|
onProcessExit(pid: number, handler: (event: ProcessExit) => void): () => void;
|
|
497
675
|
/** Wait for a process to exit. Returns the exit code. */
|
|
498
|
-
|
|
676
|
+
private _waitProcess;
|
|
499
677
|
private _assertSafeAbsolutePath;
|
|
500
678
|
private _assertWritableAbsolutePath;
|
|
501
679
|
private _vfs;
|
|
680
|
+
private _readFile;
|
|
681
|
+
private _writeFile;
|
|
682
|
+
private _writeFiles;
|
|
683
|
+
private _readFiles;
|
|
684
|
+
/** Recursively create directories (mkdir -p). */
|
|
685
|
+
private _mkdirp;
|
|
686
|
+
private _mkdir;
|
|
687
|
+
private _readdir;
|
|
688
|
+
private _readdirEntries;
|
|
689
|
+
private _readdirRecursive;
|
|
690
|
+
private _stat;
|
|
691
|
+
private _exists;
|
|
692
|
+
private _exportRootFilesystem;
|
|
693
|
+
/**
|
|
694
|
+
* Mount a filesystem into the running VM. Resolves once the mount has been
|
|
695
|
+
* delivered to the native sidecar, so guest code can use it immediately
|
|
696
|
+
* after the returned promise settles; a delivery failure rejects instead of
|
|
697
|
+
* leaving the mount silently host-only.
|
|
698
|
+
*/
|
|
699
|
+
private _mountFs;
|
|
700
|
+
private _unmountFs;
|
|
701
|
+
private _listMounts;
|
|
702
|
+
private _move;
|
|
703
|
+
private _remove;
|
|
704
|
+
/** @deprecated Use `filesystem.readFile()`. */
|
|
502
705
|
readFile(path: string): Promise<Uint8Array>;
|
|
706
|
+
/** @deprecated Use `filesystem.writeFile()`. */
|
|
503
707
|
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
708
|
+
/** @deprecated Use `filesystem.writeFiles()`. */
|
|
504
709
|
writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>;
|
|
710
|
+
/** @deprecated Use `filesystem.readFiles()`. */
|
|
505
711
|
readFiles(paths: string[]): Promise<BatchReadResult[]>;
|
|
506
|
-
/**
|
|
507
|
-
private _mkdirp;
|
|
712
|
+
/** @deprecated Use `filesystem.mkdir()`. */
|
|
508
713
|
mkdir(path: string, options?: {
|
|
509
714
|
recursive?: boolean;
|
|
510
715
|
}): Promise<void>;
|
|
716
|
+
/** @deprecated Use `filesystem.readdir()`. */
|
|
511
717
|
readdir(path: string): Promise<string[]>;
|
|
718
|
+
/** @deprecated Use `filesystem.readdirEntries()`. */
|
|
512
719
|
readdirEntries(path: string): Promise<ReaddirEntry[]>;
|
|
720
|
+
/** @deprecated Use `filesystem.readdirRecursive()`. */
|
|
513
721
|
readdirRecursive(path: string, options?: ReaddirRecursiveOptions): Promise<DirEntry[]>;
|
|
722
|
+
/** @deprecated Use `filesystem.stat()`. */
|
|
514
723
|
stat(path: string): Promise<VirtualStat>;
|
|
724
|
+
/** @deprecated Use `filesystem.exists()`. */
|
|
515
725
|
exists(path: string): Promise<boolean>;
|
|
726
|
+
/** @deprecated Use `filesystem.export()`. */
|
|
516
727
|
exportRootFilesystem(options: ExportRootFilesystemOptions): Promise<RootSnapshotExport>;
|
|
517
|
-
/**
|
|
518
|
-
* Mount a filesystem into the running VM. Resolves once the mount has been
|
|
519
|
-
* delivered to the native sidecar, so guest code can use it immediately
|
|
520
|
-
* after the returned promise settles; a delivery failure rejects instead of
|
|
521
|
-
* leaving the mount silently host-only.
|
|
522
|
-
*/
|
|
728
|
+
/** @deprecated Use `filesystem.mount()`. */
|
|
523
729
|
mountFs(descriptor: DynamicMountDescriptor): Promise<void>;
|
|
730
|
+
/** @deprecated Use `filesystem.unmount()`. */
|
|
524
731
|
unmountFs(path: string): Promise<void>;
|
|
732
|
+
/** @deprecated Use `filesystem.listMounts()`. */
|
|
525
733
|
listMounts(): Promise<MountInfo[]>;
|
|
734
|
+
/** @deprecated Use `filesystem.move()`. */
|
|
526
735
|
move(from: string, to: string): Promise<void>;
|
|
736
|
+
/** @deprecated Use `filesystem.remove()`. */
|
|
527
737
|
remove(path: string, options?: {
|
|
528
738
|
recursive?: boolean;
|
|
529
739
|
}): Promise<void>;
|
|
740
|
+
private _httpRequest;
|
|
741
|
+
/** @deprecated Use `network.httpRequest()`. */
|
|
530
742
|
httpRequest(request: HttpRequest): Promise<HttpResponse>;
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
743
|
+
/**
|
|
744
|
+
* Fetch an HTTP endpoint inside the VM while preserving duplicate response
|
|
745
|
+
* headers and arbitrary binary bodies. agentOS Apps uses this compatibility
|
|
746
|
+
* surface for its direct actor API.
|
|
747
|
+
*/
|
|
748
|
+
fetch(port: number, request: Request): Promise<Response>;
|
|
749
|
+
fetchStreamStart(port: number, request: Request): Promise<{
|
|
750
|
+
streamId: string;
|
|
751
|
+
status: number;
|
|
752
|
+
statusText: string;
|
|
753
|
+
headers: Array<[string, string]>;
|
|
754
|
+
}>;
|
|
755
|
+
fetchStreamRead(streamId: string, maxBytes?: number): Promise<{
|
|
756
|
+
body: Uint8Array;
|
|
757
|
+
done: boolean;
|
|
758
|
+
}>;
|
|
759
|
+
fetchStreamCancel(streamId: string): Promise<void>;
|
|
760
|
+
private _openTerminal;
|
|
534
761
|
connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
|
|
535
762
|
/** Write data to a shell's PTY input. */
|
|
536
|
-
|
|
763
|
+
private _writeTerminal;
|
|
537
764
|
/**
|
|
538
765
|
* Subscribe to ordered PTY output (stdout and stderr). Returns an unsubscribe
|
|
539
766
|
* function. `OpenShellOptions.onStderr` is a diagnostic tap for callers that
|
|
@@ -545,40 +772,79 @@ export declare class AgentOs {
|
|
|
545
772
|
/** Subscribe to shell exit. */
|
|
546
773
|
onShellExit(shellId: string, handler: (event: ShellExit) => void): () => void;
|
|
547
774
|
/** Notify a shell of terminal resize. */
|
|
548
|
-
|
|
775
|
+
private _resizeTerminal;
|
|
549
776
|
/**
|
|
550
777
|
* Wait for a shell to exit and return its process exit code. Resolves
|
|
551
778
|
* immediately for a shell that has already exited (within the closed-shell
|
|
552
779
|
* retention window).
|
|
553
780
|
*/
|
|
554
|
-
|
|
781
|
+
private _waitTerminal;
|
|
555
782
|
/** Kill a shell process and remove it from tracking. */
|
|
783
|
+
private _closeTerminal;
|
|
784
|
+
/** @deprecated Use `terminal.open()`. */
|
|
785
|
+
openShell(options?: ShellOptions): {
|
|
786
|
+
shellId: string;
|
|
787
|
+
};
|
|
788
|
+
/** @deprecated Use `terminal.write()`. */
|
|
789
|
+
writeShell(shellId: string, data: string | Uint8Array): Promise<void>;
|
|
790
|
+
/** @deprecated Use `terminal.resize()`. */
|
|
791
|
+
resizeShell(shellId: string, cols: number, rows: number): void;
|
|
792
|
+
/** @deprecated Use `terminal.wait()`. */
|
|
793
|
+
waitShell(shellId: string): Promise<number>;
|
|
794
|
+
/** @deprecated Use `terminal.close()`. */
|
|
556
795
|
closeShell(shellId: string): void;
|
|
557
796
|
private _resolveVmPathToHostPath;
|
|
558
797
|
/** Returns info about all processes spawned via spawn(). */
|
|
559
|
-
|
|
798
|
+
private _listProcesses;
|
|
560
799
|
/** Returns all kernel processes across all active runtimes (WASM and Node). */
|
|
561
|
-
|
|
800
|
+
private _listAllProcesses;
|
|
562
801
|
/** Returns processes organized as a tree using ppid relationships. */
|
|
563
|
-
|
|
802
|
+
private _processTree;
|
|
564
803
|
/** Returns info about a specific process by PID. Throws if not found. */
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
stopProcess(pid: number): void;
|
|
804
|
+
private _getProcess;
|
|
805
|
+
private _signalProcess;
|
|
568
806
|
/** Send SIGKILL to force-kill a process. No-op if already exited. */
|
|
569
|
-
|
|
807
|
+
private _killProcess;
|
|
808
|
+
private _resizeProcessPty;
|
|
809
|
+
private _readProcessOutput;
|
|
810
|
+
private _openSession;
|
|
811
|
+
private _getSession;
|
|
812
|
+
private _listSessions;
|
|
813
|
+
private _deleteSession;
|
|
814
|
+
private _unloadSession;
|
|
815
|
+
private _prompt;
|
|
816
|
+
private _cancelPrompt;
|
|
817
|
+
private _respondPermission;
|
|
818
|
+
private _readHistory;
|
|
819
|
+
private _getSessionConfig;
|
|
820
|
+
private _setSessionConfigOption;
|
|
821
|
+
private _getSessionCapabilities;
|
|
822
|
+
private _getSessionAgentInfo;
|
|
823
|
+
/** @deprecated Use `sessions.open()`. */
|
|
570
824
|
openSession(input: OpenSessionInput): Promise<void>;
|
|
825
|
+
/** @deprecated Use `sessions.get()`. */
|
|
571
826
|
getSession(input?: SessionTarget): Promise<DurableSessionInfo>;
|
|
827
|
+
/** @deprecated Use `sessions.list()`. */
|
|
572
828
|
listSessions(input?: ListSessionsInput): Promise<SessionPage>;
|
|
829
|
+
/** @deprecated Use `sessions.delete()`. */
|
|
573
830
|
deleteSession(input?: SessionTarget): Promise<void>;
|
|
831
|
+
/** @deprecated Use `sessions.unload()`. */
|
|
574
832
|
unloadSession(input?: SessionTarget): Promise<void>;
|
|
833
|
+
/** @deprecated Use `sessions.prompt()`. */
|
|
575
834
|
prompt(input: PromptInput): Promise<DurablePromptResult>;
|
|
835
|
+
/** @deprecated Use `sessions.cancelPrompt()`. */
|
|
576
836
|
cancelPrompt(input?: SessionTarget): Promise<CancelPromptResult>;
|
|
837
|
+
/** @deprecated Use `sessions.respondPermission()`. */
|
|
577
838
|
respondPermission(input: PermissionResponse): Promise<PermissionResponseResult>;
|
|
839
|
+
/** @deprecated Use `sessions.readHistory()`. */
|
|
578
840
|
readHistory(input?: ReadHistoryInput): Promise<HistoryPage>;
|
|
841
|
+
/** @deprecated Use `sessions.getConfig()`. */
|
|
579
842
|
getSessionConfig(input?: SessionTarget): Promise<SessionConfig>;
|
|
843
|
+
/** @deprecated Use `sessions.setConfigOption()`. */
|
|
580
844
|
setSessionConfigOption(input: SetSessionConfigOptionInput): Promise<SessionConfig>;
|
|
845
|
+
/** @deprecated Use `sessions.getCapabilities()`. */
|
|
581
846
|
getSessionCapabilities(input?: SessionTarget): Promise<SessionCapabilities | null>;
|
|
847
|
+
/** @deprecated Use `sessions.getAgentInfo()`. */
|
|
582
848
|
getSessionAgentInfo(input?: SessionTarget): Promise<SessionAgentInfo | null>;
|
|
583
849
|
/**
|
|
584
850
|
* Dynamically link a software package into the RUNNING VM. The package's
|
|
@@ -588,17 +854,23 @@ export declare class AgentOs {
|
|
|
588
854
|
* block registers the package for `openSession({ agent: name })`. Persists for the VM's
|
|
589
855
|
* lifetime (and across a snapshot iff the volume persists).
|
|
590
856
|
*/
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
packageName: string;
|
|
594
|
-
commands: string[];
|
|
595
|
-
}[]>;
|
|
857
|
+
private _linkSoftware;
|
|
858
|
+
private _listSoftware;
|
|
596
859
|
/**
|
|
597
860
|
* Returns all registered agents with their installation status. Thin forwarder:
|
|
598
861
|
* sends `AcpListAgentsRequest` and maps the response. The sidecar enumerates the
|
|
599
862
|
* projected `/opt/agentos` packages (the client parses no manifests). Every such
|
|
600
863
|
* agent is a package materialized into the VM, so `installed` is always `true`.
|
|
601
864
|
*/
|
|
865
|
+
private _listAgents;
|
|
866
|
+
/** @deprecated Use `software.link()`. */
|
|
867
|
+
linkSoftware(descriptor: PackageDescriptor): Promise<void>;
|
|
868
|
+
/** @deprecated Use `software.list()`. */
|
|
869
|
+
listSoftware(): Promise<{
|
|
870
|
+
packageName: string;
|
|
871
|
+
commands: string[];
|
|
872
|
+
}[]>;
|
|
873
|
+
/** @deprecated Use `agents.list()`. */
|
|
602
874
|
listAgents(): Promise<AgentRegistryEntry[]>;
|
|
603
875
|
private _recordAgentStderr;
|
|
604
876
|
private _recordAgentExit;
|
|
@@ -635,10 +907,16 @@ export declare class AgentOs {
|
|
|
635
907
|
onAgentExit(handler: AgentExitHandler): () => void;
|
|
636
908
|
onAgentExit(sessionId: string | undefined, handler: AgentExitHandler): () => void;
|
|
637
909
|
/** Schedule a cron job. Returns a handle with the job ID and a cancel method. */
|
|
638
|
-
|
|
910
|
+
private _scheduleCron;
|
|
639
911
|
/** List all registered cron jobs. */
|
|
640
|
-
|
|
912
|
+
private _listCronJobs;
|
|
641
913
|
/** Cancel a cron job by ID. */
|
|
914
|
+
private _cancelCronJob;
|
|
915
|
+
/** @deprecated Use `cron.schedule()`. */
|
|
916
|
+
scheduleCron(options: CronJobOptions): CronJob;
|
|
917
|
+
/** @deprecated Use `cron.list()`. */
|
|
918
|
+
listCronJobs(): CronJobInfo[];
|
|
919
|
+
/** @deprecated Use `cron.cancel()`. */
|
|
642
920
|
cancelCronJob(id: string): void;
|
|
643
921
|
/** Subscribe to cron lifecycle events (fire, complete, error). */
|
|
644
922
|
onCronEvent(handler: CronEventHandler): void;
|