@rivet-dev/agentos-core 0.2.14 → 0.2.15
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 +308 -54
- package/dist/agent-os.js +1430 -83
- package/dist/agentos-package.d.ts +1 -1
- package/dist/agentos-package.js +1 -1
- 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 +3 -1
- package/dist/index.js +1 -1
- package/dist/language-execution.d.ts +170 -0
- package/dist/language-execution.js +1 -0
- package/dist/options-schema.d.ts +12 -2
- package/dist/options-schema.js +9 -1
- package/dist/packages.d.ts +1 -1
- package/dist/runtime-compat.js +1 -1
- package/dist/sidecar/agentos-protocol.d.ts +5 -3
- package/dist/sidecar/agentos-protocol.js +2 -0
- package/dist/sidecar/rpc-client.js +10 -8
- package/dist/types.d.ts +4 -3
- package/package.json +11 -6
package/dist/agent-os.d.ts
CHANGED
|
@@ -1,14 +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
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";
|
|
7
8
|
export type { MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountPluginDescriptor, } from "@rivet-dev/agentos-runtime-core/descriptors";
|
|
8
9
|
export type { ConnectTerminalOptions } from "./runtime-compat.js";
|
|
9
10
|
export type * from "./session-api.js";
|
|
10
|
-
/** Process tree node
|
|
11
|
-
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;
|
|
12
14
|
children: ProcessTreeNode[];
|
|
13
15
|
}
|
|
14
16
|
/** A directory entry with metadata. */
|
|
@@ -44,10 +46,6 @@ export interface ProcessOutput {
|
|
|
44
46
|
stream: "stdout" | "stderr";
|
|
45
47
|
data: Uint8Array;
|
|
46
48
|
}
|
|
47
|
-
export interface ProcessExit {
|
|
48
|
-
pid: number;
|
|
49
|
-
exitCode: number;
|
|
50
|
-
}
|
|
51
49
|
export interface ShellData {
|
|
52
50
|
shellId: string;
|
|
53
51
|
data: Uint8Array;
|
|
@@ -72,8 +70,6 @@ export interface DynamicMountDescriptor {
|
|
|
72
70
|
plugin: NativeMountPluginDescriptor;
|
|
73
71
|
readOnly?: boolean;
|
|
74
72
|
}
|
|
75
|
-
/** Callback-free options accepted by the portable spawn API. */
|
|
76
|
-
export type SpawnOptions = KernelSpawnOptions;
|
|
77
73
|
/** Callback-free options accepted by the portable openShell API. */
|
|
78
74
|
export type ShellOptions = Omit<OpenShellOptions, "onStderr">;
|
|
79
75
|
/** Options for readdirRecursive(). */
|
|
@@ -235,7 +231,7 @@ export interface AgentOsLimits {
|
|
|
235
231
|
defaultBindingTimeoutMs?: number;
|
|
236
232
|
maxBindingTimeoutMs?: number;
|
|
237
233
|
maxRegisteredCollections?: number;
|
|
238
|
-
|
|
234
|
+
maxRegisteredBindingsPerVm?: number;
|
|
239
235
|
maxBindingsPerCollection?: number;
|
|
240
236
|
maxBindingSchemaBytes?: number;
|
|
241
237
|
maxExamplesPerBinding?: number;
|
|
@@ -446,20 +442,16 @@ export interface AgentOsRuntimeAdmin {
|
|
|
446
442
|
env: Record<string, string>;
|
|
447
443
|
sidecar: AgentOsSidecar;
|
|
448
444
|
}
|
|
449
|
-
/** Information about a process spawned via AgentOs.spawn(). */
|
|
450
|
-
export interface SpawnedProcessInfo {
|
|
451
|
-
pid: number;
|
|
452
|
-
command: string;
|
|
453
|
-
args: string[];
|
|
454
|
-
running: boolean;
|
|
455
|
-
exitCode: number | null;
|
|
456
|
-
}
|
|
457
445
|
export declare class AgentOs {
|
|
458
446
|
#private;
|
|
459
447
|
readonly sidecar: AgentOsSidecar;
|
|
460
448
|
private _durableSessionEventHandlers;
|
|
461
449
|
private _agentExitHandlers;
|
|
462
450
|
private _processes;
|
|
451
|
+
private _languageProcesses;
|
|
452
|
+
private _languageProcessIds;
|
|
453
|
+
private _executionOutputHandlers;
|
|
454
|
+
private _executionCompletedHandlers;
|
|
463
455
|
private _shells;
|
|
464
456
|
private _closedShellIds;
|
|
465
457
|
private _pendingShellExitPromises;
|
|
@@ -483,61 +475,274 @@ export declare class AgentOs {
|
|
|
483
475
|
private readonly _agentExitHandler?;
|
|
484
476
|
private readonly _limitWarningHandler?;
|
|
485
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
|
+
};
|
|
486
613
|
private constructor();
|
|
487
614
|
static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
|
|
488
615
|
static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>;
|
|
489
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. */
|
|
490
623
|
exec(command: string, options?: KernelExecOptions): Promise<KernelExecResult>;
|
|
624
|
+
/** @deprecated Use `process.execFile()` for lifecycle-aware execution. */
|
|
491
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;
|
|
492
664
|
private _trackProcess;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
};
|
|
665
|
+
private _spawnProcess;
|
|
666
|
+
spawn(command: string, args?: string[], options?: SpawnOptions): Promise<ProcessDescriptor>;
|
|
496
667
|
/** Write data to a process's stdin. */
|
|
497
|
-
|
|
668
|
+
private _writeProcessStdin;
|
|
498
669
|
/** Close a process's stdin stream. */
|
|
499
|
-
|
|
670
|
+
private _closeProcessStdin;
|
|
500
671
|
/** Subscribe to stdout and stderr from a process. */
|
|
501
672
|
onProcessOutput(pid: number, handler: (event: ProcessOutput) => void): () => void;
|
|
502
673
|
/** Subscribe to process exit. Returns an unsubscribe function. */
|
|
503
674
|
onProcessExit(pid: number, handler: (event: ProcessExit) => void): () => void;
|
|
504
675
|
/** Wait for a process to exit. Returns the exit code. */
|
|
505
|
-
|
|
676
|
+
private _waitProcess;
|
|
506
677
|
private _assertSafeAbsolutePath;
|
|
507
678
|
private _assertWritableAbsolutePath;
|
|
508
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()`. */
|
|
509
705
|
readFile(path: string): Promise<Uint8Array>;
|
|
706
|
+
/** @deprecated Use `filesystem.writeFile()`. */
|
|
510
707
|
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
708
|
+
/** @deprecated Use `filesystem.writeFiles()`. */
|
|
511
709
|
writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>;
|
|
710
|
+
/** @deprecated Use `filesystem.readFiles()`. */
|
|
512
711
|
readFiles(paths: string[]): Promise<BatchReadResult[]>;
|
|
513
|
-
/**
|
|
514
|
-
private _mkdirp;
|
|
712
|
+
/** @deprecated Use `filesystem.mkdir()`. */
|
|
515
713
|
mkdir(path: string, options?: {
|
|
516
714
|
recursive?: boolean;
|
|
517
715
|
}): Promise<void>;
|
|
716
|
+
/** @deprecated Use `filesystem.readdir()`. */
|
|
518
717
|
readdir(path: string): Promise<string[]>;
|
|
718
|
+
/** @deprecated Use `filesystem.readdirEntries()`. */
|
|
519
719
|
readdirEntries(path: string): Promise<ReaddirEntry[]>;
|
|
720
|
+
/** @deprecated Use `filesystem.readdirRecursive()`. */
|
|
520
721
|
readdirRecursive(path: string, options?: ReaddirRecursiveOptions): Promise<DirEntry[]>;
|
|
722
|
+
/** @deprecated Use `filesystem.stat()`. */
|
|
521
723
|
stat(path: string): Promise<VirtualStat>;
|
|
724
|
+
/** @deprecated Use `filesystem.exists()`. */
|
|
522
725
|
exists(path: string): Promise<boolean>;
|
|
726
|
+
/** @deprecated Use `filesystem.export()`. */
|
|
523
727
|
exportRootFilesystem(options: ExportRootFilesystemOptions): Promise<RootSnapshotExport>;
|
|
524
|
-
/**
|
|
525
|
-
* Mount a filesystem into the running VM. Resolves once the mount has been
|
|
526
|
-
* delivered to the native sidecar, so guest code can use it immediately
|
|
527
|
-
* after the returned promise settles; a delivery failure rejects instead of
|
|
528
|
-
* leaving the mount silently host-only.
|
|
529
|
-
*/
|
|
728
|
+
/** @deprecated Use `filesystem.mount()`. */
|
|
530
729
|
mountFs(descriptor: DynamicMountDescriptor): Promise<void>;
|
|
730
|
+
/** @deprecated Use `filesystem.unmount()`. */
|
|
531
731
|
unmountFs(path: string): Promise<void>;
|
|
732
|
+
/** @deprecated Use `filesystem.listMounts()`. */
|
|
532
733
|
listMounts(): Promise<MountInfo[]>;
|
|
734
|
+
/** @deprecated Use `filesystem.move()`. */
|
|
533
735
|
move(from: string, to: string): Promise<void>;
|
|
736
|
+
/** @deprecated Use `filesystem.remove()`. */
|
|
534
737
|
remove(path: string, options?: {
|
|
535
738
|
recursive?: boolean;
|
|
536
739
|
}): Promise<void>;
|
|
740
|
+
private _httpRequest;
|
|
741
|
+
/** @deprecated Use `network.httpRequest()`. */
|
|
537
742
|
httpRequest(request: HttpRequest): Promise<HttpResponse>;
|
|
538
743
|
/**
|
|
539
744
|
* Fetch an HTTP endpoint inside the VM while preserving duplicate response
|
|
540
|
-
* headers and arbitrary binary bodies.
|
|
745
|
+
* headers and arbitrary binary bodies. agentOS Apps uses this compatibility
|
|
541
746
|
* surface for its direct actor API.
|
|
542
747
|
*/
|
|
543
748
|
fetch(port: number, request: Request): Promise<Response>;
|
|
@@ -552,12 +757,10 @@ export declare class AgentOs {
|
|
|
552
757
|
done: boolean;
|
|
553
758
|
}>;
|
|
554
759
|
fetchStreamCancel(streamId: string): Promise<void>;
|
|
555
|
-
|
|
556
|
-
shellId: string;
|
|
557
|
-
};
|
|
760
|
+
private _openTerminal;
|
|
558
761
|
connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
|
|
559
762
|
/** Write data to a shell's PTY input. */
|
|
560
|
-
|
|
763
|
+
private _writeTerminal;
|
|
561
764
|
/**
|
|
562
765
|
* Subscribe to ordered PTY output (stdout and stderr). Returns an unsubscribe
|
|
563
766
|
* function. `OpenShellOptions.onStderr` is a diagnostic tap for callers that
|
|
@@ -569,40 +772,79 @@ export declare class AgentOs {
|
|
|
569
772
|
/** Subscribe to shell exit. */
|
|
570
773
|
onShellExit(shellId: string, handler: (event: ShellExit) => void): () => void;
|
|
571
774
|
/** Notify a shell of terminal resize. */
|
|
572
|
-
|
|
775
|
+
private _resizeTerminal;
|
|
573
776
|
/**
|
|
574
777
|
* Wait for a shell to exit and return its process exit code. Resolves
|
|
575
778
|
* immediately for a shell that has already exited (within the closed-shell
|
|
576
779
|
* retention window).
|
|
577
780
|
*/
|
|
578
|
-
|
|
781
|
+
private _waitTerminal;
|
|
579
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()`. */
|
|
580
795
|
closeShell(shellId: string): void;
|
|
581
796
|
private _resolveVmPathToHostPath;
|
|
582
797
|
/** Returns info about all processes spawned via spawn(). */
|
|
583
|
-
|
|
798
|
+
private _listProcesses;
|
|
584
799
|
/** Returns all kernel processes across all active runtimes (WASM and Node). */
|
|
585
|
-
|
|
800
|
+
private _listAllProcesses;
|
|
586
801
|
/** Returns processes organized as a tree using ppid relationships. */
|
|
587
|
-
|
|
802
|
+
private _processTree;
|
|
588
803
|
/** Returns info about a specific process by PID. Throws if not found. */
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
stopProcess(pid: number): void;
|
|
804
|
+
private _getProcess;
|
|
805
|
+
private _signalProcess;
|
|
592
806
|
/** Send SIGKILL to force-kill a process. No-op if already exited. */
|
|
593
|
-
|
|
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()`. */
|
|
594
824
|
openSession(input: OpenSessionInput): Promise<void>;
|
|
825
|
+
/** @deprecated Use `sessions.get()`. */
|
|
595
826
|
getSession(input?: SessionTarget): Promise<DurableSessionInfo>;
|
|
827
|
+
/** @deprecated Use `sessions.list()`. */
|
|
596
828
|
listSessions(input?: ListSessionsInput): Promise<SessionPage>;
|
|
829
|
+
/** @deprecated Use `sessions.delete()`. */
|
|
597
830
|
deleteSession(input?: SessionTarget): Promise<void>;
|
|
831
|
+
/** @deprecated Use `sessions.unload()`. */
|
|
598
832
|
unloadSession(input?: SessionTarget): Promise<void>;
|
|
833
|
+
/** @deprecated Use `sessions.prompt()`. */
|
|
599
834
|
prompt(input: PromptInput): Promise<DurablePromptResult>;
|
|
835
|
+
/** @deprecated Use `sessions.cancelPrompt()`. */
|
|
600
836
|
cancelPrompt(input?: SessionTarget): Promise<CancelPromptResult>;
|
|
837
|
+
/** @deprecated Use `sessions.respondPermission()`. */
|
|
601
838
|
respondPermission(input: PermissionResponse): Promise<PermissionResponseResult>;
|
|
839
|
+
/** @deprecated Use `sessions.readHistory()`. */
|
|
602
840
|
readHistory(input?: ReadHistoryInput): Promise<HistoryPage>;
|
|
841
|
+
/** @deprecated Use `sessions.getConfig()`. */
|
|
603
842
|
getSessionConfig(input?: SessionTarget): Promise<SessionConfig>;
|
|
843
|
+
/** @deprecated Use `sessions.setConfigOption()`. */
|
|
604
844
|
setSessionConfigOption(input: SetSessionConfigOptionInput): Promise<SessionConfig>;
|
|
845
|
+
/** @deprecated Use `sessions.getCapabilities()`. */
|
|
605
846
|
getSessionCapabilities(input?: SessionTarget): Promise<SessionCapabilities | null>;
|
|
847
|
+
/** @deprecated Use `sessions.getAgentInfo()`. */
|
|
606
848
|
getSessionAgentInfo(input?: SessionTarget): Promise<SessionAgentInfo | null>;
|
|
607
849
|
/**
|
|
608
850
|
* Dynamically link a software package into the RUNNING VM. The package's
|
|
@@ -612,17 +854,23 @@ export declare class AgentOs {
|
|
|
612
854
|
* block registers the package for `openSession({ agent: name })`. Persists for the VM's
|
|
613
855
|
* lifetime (and across a snapshot iff the volume persists).
|
|
614
856
|
*/
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
packageName: string;
|
|
618
|
-
commands: string[];
|
|
619
|
-
}[]>;
|
|
857
|
+
private _linkSoftware;
|
|
858
|
+
private _listSoftware;
|
|
620
859
|
/**
|
|
621
860
|
* Returns all registered agents with their installation status. Thin forwarder:
|
|
622
861
|
* sends `AcpListAgentsRequest` and maps the response. The sidecar enumerates the
|
|
623
862
|
* projected `/opt/agentos` packages (the client parses no manifests). Every such
|
|
624
863
|
* agent is a package materialized into the VM, so `installed` is always `true`.
|
|
625
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()`. */
|
|
626
874
|
listAgents(): Promise<AgentRegistryEntry[]>;
|
|
627
875
|
private _recordAgentStderr;
|
|
628
876
|
private _recordAgentExit;
|
|
@@ -659,10 +907,16 @@ export declare class AgentOs {
|
|
|
659
907
|
onAgentExit(handler: AgentExitHandler): () => void;
|
|
660
908
|
onAgentExit(sessionId: string | undefined, handler: AgentExitHandler): () => void;
|
|
661
909
|
/** Schedule a cron job. Returns a handle with the job ID and a cancel method. */
|
|
662
|
-
|
|
910
|
+
private _scheduleCron;
|
|
663
911
|
/** List all registered cron jobs. */
|
|
664
|
-
|
|
912
|
+
private _listCronJobs;
|
|
665
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()`. */
|
|
666
920
|
cancelCronJob(id: string): void;
|
|
667
921
|
/** Subscribe to cron lifecycle events (fire, complete, error). */
|
|
668
922
|
onCronEvent(handler: CronEventHandler): void;
|