@rivet-dev/agentos 0.0.0-nathan-binding-workspace.4640d5c → 0.0.0-nathan-binding-workspace.abc7ec9
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/index.d.ts +186 -0
- package/dist/index.js +307 -0
- package/dist/index.js.map +1 -0
- package/package.json +25 -23
- package/dist/client.cjs +0 -25
- package/dist/client.cjs.map +0 -1
- package/dist/client.d.cts +0 -2
- package/dist/mod.cjs +0 -134
- package/dist/mod.cjs.map +0 -1
- package/dist/mod.d.cts +0 -594
- package/dist/mod.d.ts +0 -594
- package/dist/mod.js +0 -107
- package/dist/mod.js.map +0 -1
- package/dist/react.cjs +0 -25
- package/dist/react.cjs.map +0 -1
- package/dist/react.d.cts +0 -1
package/dist/client.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
|
|
17
|
-
// src/client.ts
|
|
18
|
-
var client_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(client_exports);
|
|
20
|
-
__reExport(client_exports, require("rivetkit/client"), module.exports);
|
|
21
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
-
0 && (module.exports = {
|
|
23
|
-
...require("rivetkit/client")
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=client.cjs.map
|
package/dist/client.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["/**\n * `@rivet-dev/agentos/client` — Agent OS client surface.\n *\n * Re-exports RivetKit's client entry (`createClient`, `ActorHandle`,\n * `ActorConn`, etc.). This is deliberately kept OFF the root module so that\n * server/Node actor code that imports `@rivet-dev/agentos` never transitively\n * pulls in the browser/client bundle.\n *\n * The browser export condition is preserved through to `rivetkit/client`\n * (which is external here), so consumers resolving this subpath in a browser\n * environment still get RivetKit's browser client build.\n */\n\nexport * from \"rivetkit/client\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAaA,2BAAc,4BAbd;","names":[]}
|
package/dist/client.d.cts
DELETED
package/dist/mod.cjs
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/mod.ts
|
|
21
|
-
var mod_exports = {};
|
|
22
|
-
__export(mod_exports, {
|
|
23
|
-
agentOS: () => agentOS,
|
|
24
|
-
nodeModulesMount: () => nodeModulesMount,
|
|
25
|
-
setup: () => import_rivetkit2.setup
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(mod_exports);
|
|
28
|
-
var import_rivetkit = require("rivetkit");
|
|
29
|
-
var import_rivetkit2 = require("rivetkit");
|
|
30
|
-
function nodeModulesMount(hostNodeModulesDir, opts) {
|
|
31
|
-
const readOnly = opts?.readOnly ?? true;
|
|
32
|
-
return {
|
|
33
|
-
path: "/root/node_modules",
|
|
34
|
-
plugin: {
|
|
35
|
-
id: "host_dir",
|
|
36
|
-
config: { hostPath: hostNodeModulesDir, readOnly }
|
|
37
|
-
},
|
|
38
|
-
readOnly
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var typedEvent = () => (0, import_rivetkit.event)();
|
|
42
|
-
var agentOSEvents = {
|
|
43
|
-
sessionEvent: typedEvent(),
|
|
44
|
-
permissionRequest: typedEvent(),
|
|
45
|
-
vmBooted: typedEvent(),
|
|
46
|
-
vmShutdown: typedEvent(),
|
|
47
|
-
processOutput: typedEvent(),
|
|
48
|
-
processExit: typedEvent(),
|
|
49
|
-
shellData: typedEvent(),
|
|
50
|
-
cronEvent: typedEvent()
|
|
51
|
-
};
|
|
52
|
-
var RUNTIME_NOT_WIRED = "agentos runtime not yet wired \u2014 dylib pending";
|
|
53
|
-
function agentOS(_config) {
|
|
54
|
-
const notWired = () => {
|
|
55
|
-
throw new Error(RUNTIME_NOT_WIRED);
|
|
56
|
-
};
|
|
57
|
-
const definition = (0, import_rivetkit.actor)({
|
|
58
|
-
state: {},
|
|
59
|
-
createVars: () => ({
|
|
60
|
-
activeSessionIds: /* @__PURE__ */ new Set(),
|
|
61
|
-
activeProcesses: /* @__PURE__ */ new Set(),
|
|
62
|
-
activeShells: /* @__PURE__ */ new Set(),
|
|
63
|
-
sessions: /* @__PURE__ */ new Set()
|
|
64
|
-
}),
|
|
65
|
-
events: agentOSEvents,
|
|
66
|
-
actions: {
|
|
67
|
-
// Sessions
|
|
68
|
-
createSession: notWired,
|
|
69
|
-
sendPrompt: notWired,
|
|
70
|
-
prompt: notWired,
|
|
71
|
-
cancelPrompt: notWired,
|
|
72
|
-
cancelSession: notWired,
|
|
73
|
-
listSessions: notWired,
|
|
74
|
-
closeSession: notWired,
|
|
75
|
-
destroySession: notWired,
|
|
76
|
-
respondPermission: notWired,
|
|
77
|
-
setMode: notWired,
|
|
78
|
-
setModel: notWired,
|
|
79
|
-
setThoughtLevel: notWired,
|
|
80
|
-
getModes: notWired,
|
|
81
|
-
getConfigOptions: notWired,
|
|
82
|
-
// Session event replay
|
|
83
|
-
getSequencedEvents: notWired,
|
|
84
|
-
getSessionEvents: notWired,
|
|
85
|
-
listPersistedSessions: notWired,
|
|
86
|
-
// Processes
|
|
87
|
-
exec: notWired,
|
|
88
|
-
execArgv: notWired,
|
|
89
|
-
spawn: notWired,
|
|
90
|
-
spawnProcess: notWired,
|
|
91
|
-
listProcesses: notWired,
|
|
92
|
-
getProcess: notWired,
|
|
93
|
-
writeProcessStdin: notWired,
|
|
94
|
-
closeProcessStdin: notWired,
|
|
95
|
-
waitProcess: notWired,
|
|
96
|
-
stopProcess: notWired,
|
|
97
|
-
killProcess: notWired,
|
|
98
|
-
// Shells
|
|
99
|
-
openShell: notWired,
|
|
100
|
-
connectTerminal: notWired,
|
|
101
|
-
writeShell: notWired,
|
|
102
|
-
resizeShell: notWired,
|
|
103
|
-
closeShell: notWired,
|
|
104
|
-
// Filesystem
|
|
105
|
-
readFile: notWired,
|
|
106
|
-
writeFile: notWired,
|
|
107
|
-
writeFiles: notWired,
|
|
108
|
-
readFiles: notWired,
|
|
109
|
-
mkdir: notWired,
|
|
110
|
-
readdir: notWired,
|
|
111
|
-
readdirRecursive: notWired,
|
|
112
|
-
stat: notWired,
|
|
113
|
-
exists: notWired,
|
|
114
|
-
move: notWired,
|
|
115
|
-
delete: notWired,
|
|
116
|
-
snapshotRootFilesystem: notWired,
|
|
117
|
-
// Networking + preview URLs
|
|
118
|
-
vmFetch: notWired,
|
|
119
|
-
createSignedPreviewUrl: notWired,
|
|
120
|
-
// Cron
|
|
121
|
-
scheduleCron: notWired,
|
|
122
|
-
listCronJobs: notWired,
|
|
123
|
-
cancelCronJob: notWired
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
return definition;
|
|
127
|
-
}
|
|
128
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
-
0 && (module.exports = {
|
|
130
|
-
agentOS,
|
|
131
|
-
nodeModulesMount,
|
|
132
|
-
setup
|
|
133
|
-
});
|
|
134
|
-
//# sourceMappingURL=mod.cjs.map
|
package/dist/mod.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mod.ts"],"sourcesContent":["/**\n * `@rivet-dev/agentos` — the user-facing Agent OS integration for RivetKit.\n *\n * INTERIM \"types-now, noop-the-runtime\" STUB.\n *\n * This package owns the Agent OS-specific TypeScript surface (config schema\n * type, events, the actor-definition type, the `vm.*` action interface, and\n * the `nodeModulesMount` helper) and imports only GENERIC primitives (the\n * actor definition / registry / action context) from `rivetkit`.\n *\n * The runtime is intentionally NOT wired: `agentOS()` returns a correctly\n * typed RivetKit actor definition whose action handler bodies THROW. This\n * lets consumers (examples, downstream packages) type-check against the real\n * shape before the native runtime (dylib) lands, without pulling in any napi\n * / native module. When the dylib is ready, swap the throwing handlers for\n * the native factory builder — the public types do not change.\n */\n\nimport { actor, type ActorDefinition, event, type Type } from \"rivetkit\";\n\n// Re-export the RivetKit registry builder so consumers import everything they\n// need from `@rivet-dev/agentos` and never reach for `rivetkit` directly.\nexport { setup } from \"rivetkit\";\n\n// ---------------------------------------------------------------------------\n// Owned ACP / Agent OS primitive shapes\n//\n// These mirror the structural shape of the types that the real integration\n// imports from `@rivet-dev/agentos-core`. They are deliberately owned here\n// (rather than imported) so this package stays self-contained on `rivetkit`\n// + `@rivetkit/react` until the runtime is wired. Swap them for the core\n// package's canonical types when the dylib lands.\n// ---------------------------------------------------------------------------\n\n/** A JSON-RPC notification frame emitted by the ACP adapter. */\nexport interface JsonRpcNotification {\n\tjsonrpc: \"2.0\";\n\tmethod: string;\n\tparams?: unknown;\n}\n\n/** A JSON-RPC response frame returned by the ACP adapter. */\nexport interface JsonRpcResponse {\n\tjsonrpc: \"2.0\";\n\tid: number | string;\n\tresult?: unknown;\n\terror?: { code: number; message: string; data?: unknown };\n}\n\n/** A permission request surfaced by the agent to the host. */\nexport interface PermissionRequest {\n\t/** Stable id used to reply to this specific request via `respondPermission`. */\n\tpermissionId: string;\n\t/** Optional human-readable description of what is being requested. */\n\tdescription?: string;\n\t/** Raw ACP permission params (tool name, input, options, etc.). */\n\tparams?: Record<string, unknown>;\n\t/** @deprecated legacy alias retained for older docs snippets. */\n\ttoolName?: string;\n\t/** @deprecated legacy alias retained for older docs snippets. */\n\trationale?: string;\n\t/** @deprecated legacy alias retained for older docs snippets. */\n\tinput?: unknown;\n}\n\n/** Reply to a permission request: allow once, allow always, or reject. */\nexport type PermissionReply = \"once\" | \"always\" | \"reject\";\n\n/** One selectable agent mode (e.g. \"plan\", \"auto\"). */\nexport interface SessionMode {\n\tid: string;\n\tname?: string;\n\tlabel?: string;\n\tdescription?: string;\n\t[key: string]: unknown;\n}\n\n/** The set of modes available to a session plus the current selection. */\nexport interface SessionModeState {\n\tcurrentModeId: string;\n\tavailableModes: SessionMode[];\n}\n\n/** A configurable session option (model, thought level, etc.). */\nexport interface SessionConfigOption {\n\tid: string;\n\tcategory?: string;\n\tlabel?: string;\n\tdescription?: string;\n\tcurrentValue?: string;\n\tallowedValues?: Array<{ id: string; label?: string }>;\n\treadOnly?: boolean;\n}\n\n/** Capabilities advertised by an ACP agent during initialization. */\nexport interface AgentCapabilities {\n\tloadSession?: boolean;\n\tpromptCapabilities?: Record<string, unknown>;\n\t[key: string]: unknown;\n}\n\n/** Identity metadata advertised by an ACP agent. */\nexport interface AgentInfo {\n\tname: string;\n\tversion?: string;\n\t[key: string]: unknown;\n}\n\n/** A cron tick delivered to the actor. */\nexport interface CronEvent {\n\tid: string;\n\tschedule: string;\n\tfiredAt: number;\n}\n\n// ---------------------------------------------------------------------------\n// Filesystem primitives (mirror core's runtime-compat / agentos shapes)\n// ---------------------------------------------------------------------------\n\n/** POSIX-style stat record returned by `stat`. */\nexport interface VirtualStat {\n\tmode: number;\n\tsize: number;\n\tblocks: number;\n\tdev: number;\n\trdev: number;\n\tisDirectory: boolean;\n\tisSymbolicLink: boolean;\n\tatimeMs: number;\n\tmtimeMs: number;\n\tctimeMs: number;\n\tbirthtimeMs: number;\n\tino: number;\n\tnlink: number;\n\tuid: number;\n\tgid: number;\n}\n\n/** A directory entry with metadata (returned by `readdirRecursive`). */\nexport interface DirEntry {\n\t/** Absolute path to the entry. */\n\tpath: string;\n\ttype: \"file\" | \"directory\" | \"symlink\";\n\tsize: number;\n}\n\n/** Options for `readdirRecursive`. */\nexport interface ReaddirRecursiveOptions {\n\t/** Maximum depth to recurse (0 = only immediate children). */\n\tmaxDepth?: number;\n\t/** Directory names to skip. */\n\texclude?: string[];\n}\n\n/** A single file in a batch write (`writeFiles`). */\nexport interface BatchWriteEntry {\n\tpath: string;\n\tcontent: string | Uint8Array;\n}\n\n/** Result of a single file in a batch write. */\nexport interface BatchWriteResult {\n\tpath: string;\n\tsuccess: boolean;\n\terror?: string;\n}\n\n/** Result of a single file in a batch read (`readFiles`). */\nexport interface BatchReadResult {\n\tpath: string;\n\tcontent: Uint8Array | null;\n\terror?: string;\n}\n\n/** A single entry in an exported root filesystem snapshot. */\nexport interface FilesystemEntry {\n\tpath: string;\n\ttype: \"file\" | \"directory\" | \"symlink\";\n\tmode: string;\n\tuid: number;\n\tgid: number;\n\tcontent?: string;\n\tencoding?: \"utf8\" | \"base64\";\n\ttarget?: string;\n}\n\n/** A serializable export of the VM root filesystem. */\nexport interface RootSnapshotExport {\n\tkind: \"snapshot-export\";\n\tsource: {\n\t\tformat: \"agentos-filesystem-snapshot-v1\";\n\t\tfilesystem: { entries: FilesystemEntry[] };\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Process + shell primitives\n// ---------------------------------------------------------------------------\n\n/** Options for `exec` / `execArgv`. */\nexport interface ExecOptions {\n\tenv?: Record<string, string>;\n\tcwd?: string;\n\tstdin?: string | Uint8Array;\n\ttimeout?: number;\n\tcaptureStdio?: boolean;\n}\n\n/** Result of a synchronous `exec` / `execArgv`. */\nexport interface ExecResult {\n\texitCode: number;\n\tstdout: string;\n\tstderr: string;\n}\n\n/** Options for `spawn`. */\nexport interface SpawnOptions {\n\tenv?: Record<string, string>;\n\tcwd?: string;\n\tstdin?: string | Uint8Array;\n}\n\n/** Info about a process spawned via `spawn`. */\nexport interface SpawnedProcessInfo {\n\tpid: number;\n\tcommand: string;\n\targs: string[];\n\trunning: boolean;\n\texitCode: number | null;\n}\n\n/** Options for `openShell` / `connectTerminal`. */\nexport interface OpenShellOptions {\n\tcommand?: string;\n\targs?: string[];\n\tenv?: Record<string, string>;\n\tcwd?: string;\n\tcols?: number;\n\trows?: number;\n}\n\n/** Options for `connectTerminal` (a shell plus a streaming data callback). */\nexport interface ConnectTerminalOptions extends OpenShellOptions {\n\tonData?: (data: Uint8Array) => void;\n}\n\n// ---------------------------------------------------------------------------\n// Networking + preview URLs\n// ---------------------------------------------------------------------------\n\n/** Options for `vmFetch` (method/headers/body for the proxied request). */\nexport interface VmFetchOptions {\n\tmethod?: string;\n\theaders?: Record<string, string>;\n\tbody?: string | Uint8Array;\n}\n\n/** Response returned by `vmFetch`. */\nexport interface VmFetchResponse {\n\tstatus: number;\n\tstatusText?: string;\n\theaders?: Array<[string, string]>;\n\tbody: Uint8Array;\n}\n\n/** A time-limited, token-based preview URL for a VM port. */\nexport interface PreviewUrl {\n\t/** Signed path (including token query) to proxy to the VM port. */\n\tpath: string;\n\t/** Opaque signed token authorizing the proxy. */\n\ttoken: string;\n\t/** Epoch millis at which the token expires. */\n\texpiresAt: number;\n}\n\n// ---------------------------------------------------------------------------\n// Session event replay\n// ---------------------------------------------------------------------------\n\n/** An in-memory session event with its monotonic sequence number. */\nexport interface SequencedSessionEvent {\n\tsequenceNumber: number;\n\tnotification: JsonRpcNotification;\n}\n\n/** Options for `getSequencedEvents` (replay in-memory events after `since`). */\nexport interface GetSequencedEventsOptions {\n\t/** Return only events with a sequence number greater than this value. */\n\tsince?: number;\n}\n\n/**\n * Serializable Agent OS VM options. These fields are accepted at the top level\n * of `agentOS({ ... })` (see `AgentOSActorConfigInput`); this type collects\n * them for callers that want to build the option set as a standalone value.\n *\n * Kept structurally open: the full option set is owned by the sidecar/native\n * layer and forwarded across the boundary, so consumers configure it as data.\n */\nexport interface AgentOSOptions {\n\tsoftware?: unknown;\n\tadditionalInstructions?: string;\n\tloopbackExemptPorts?: number[];\n\tallowedNodeBuiltins?: string[];\n\tpermissions?: unknown;\n\trootFilesystem?: unknown;\n\tmounts?: unknown[];\n\tlimits?: unknown;\n\tsidecar?: unknown;\n\t[key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Mounts\n// ---------------------------------------------------------------------------\n\n/**\n * A native `host_dir` mount of a host `node_modules` directory at\n * `/root/node_modules`.\n */\nexport interface NodeModulesMountConfig {\n\tpath: \"/root/node_modules\";\n\tplugin: { id: \"host_dir\"; config: { hostPath: string; readOnly: boolean } };\n\treadOnly: boolean;\n}\n\n/**\n * Mount a host `node_modules` directory into the VM at `/root/node_modules`.\n *\n * @param hostNodeModulesDir Absolute host path to a `node_modules` directory.\n * @param opts.readOnly Defaults to `true`; the mount is read-only.\n */\nexport function nodeModulesMount(\n\thostNodeModulesDir: string,\n\topts?: { readOnly?: boolean },\n): NodeModulesMountConfig {\n\tconst readOnly = opts?.readOnly ?? true;\n\treturn {\n\t\tpath: \"/root/node_modules\",\n\t\tplugin: {\n\t\t\tid: \"host_dir\",\n\t\t\tconfig: { hostPath: hostNodeModulesDir, readOnly },\n\t\t},\n\t\treadOnly,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Actor state / vars\n// ---------------------------------------------------------------------------\n\n// biome-ignore lint/complexity/noBannedTypes: empty state placeholder\nexport type AgentOSActorState = {};\n\nexport interface AgentOSActorVars {\n\tactiveSessionIds: Set<string>;\n\tactiveProcesses: Set<number>;\n\tactiveShells: Set<string>;\n\tsessions: Set<string>;\n}\n\n// ---------------------------------------------------------------------------\n// Event payloads + schema map\n// ---------------------------------------------------------------------------\n\nexport interface SessionEventPayload {\n\tsessionId: string;\n\tevent: JsonRpcNotification;\n}\n\nexport interface PermissionRequestPayload {\n\tsessionId: string;\n\trequest: PermissionRequest;\n}\n\nexport type VmBootedPayload = Record<string, never>;\n\nexport interface VmShutdownPayload {\n\treason: \"sleep\" | \"destroy\" | \"error\";\n}\n\nexport interface ProcessOutputPayload {\n\tpid: number;\n\tstream: \"stdout\" | \"stderr\";\n\tdata: Uint8Array;\n}\n\nexport interface ProcessExitPayload {\n\tpid: number;\n\texitCode: number;\n}\n\nexport interface ShellDataPayload {\n\tshellId: string;\n\tdata: Uint8Array;\n}\n\nexport interface CronEventPayload {\n\tevent: CronEvent;\n}\n\n/**\n * Event schema map consumed by the actor `events` config.\n *\n * Built with RivetKit's `event<T>()` helper so each entry is a valid\n * `EventSchema` (an `EventTypeToken` carrying the payload type). This lets the\n * actor definition satisfy RivetKit's `EventSchemaConfig` while\n * `conn.on(name, cb)` infers the payload for each event with no casts.\n */\n// `event<T>()` returns RivetKit's internal `EventTypeToken<T>`, which is not\n// part of the public type surface and therefore \"cannot be named\" in the\n// generated `.d.ts` (tsup dts rollup → TS4023). `Type<T>` is the exported\n// public alias for that same token, so annotating through it keeps per-event\n// payload inference while emitting a nameable type.\nconst typedEvent = <T>(): Type<T> => event<T>();\n\nconst agentOSEvents = {\n\tsessionEvent: typedEvent<SessionEventPayload>(),\n\tpermissionRequest: typedEvent<PermissionRequestPayload>(),\n\tvmBooted: typedEvent<VmBootedPayload>(),\n\tvmShutdown: typedEvent<VmShutdownPayload>(),\n\tprocessOutput: typedEvent<ProcessOutputPayload>(),\n\tprocessExit: typedEvent<ProcessExitPayload>(),\n\tshellData: typedEvent<ShellDataPayload>(),\n\tcronEvent: typedEvent<CronEventPayload>(),\n};\n\n/** Event schema map type for the actor `events` config (payload-inferring). */\nexport type AgentOSEvents = typeof agentOSEvents;\n\n// ---------------------------------------------------------------------------\n// Session + prompt records\n// ---------------------------------------------------------------------------\n\nexport interface PromptResult {\n\tresponse: JsonRpcResponse;\n\ttext: string;\n}\n\nexport interface SessionRecord {\n\tsessionId: string;\n\tagentType: string;\n\tcapabilities: AgentCapabilities;\n\tagentInfo: AgentInfo | null;\n}\n\nexport interface PersistedSessionRecord extends SessionRecord {\n\tcreatedAt: number;\n}\n\nexport interface PersistedSessionEvent {\n\tsessionId: string;\n\tseq: number;\n\tevent: JsonRpcNotification;\n\tcreatedAt: number;\n}\n\n// ---------------------------------------------------------------------------\n// Cron\n// ---------------------------------------------------------------------------\n\nexport type SerializableCronAction =\n\t| {\n\t\t\ttype: \"session\";\n\t\t\tagentType: string;\n\t\t\tprompt: string;\n\t\t\t/** Session options applied when the cron fires (cwd, env, etc.). */\n\t\t\toptions?: CreateSessionOptions;\n\t }\n\t| { type: \"exec\"; command: string; args?: string[] };\n\nexport interface SerializableCronJobOptions {\n\tid?: string;\n\tschedule: string;\n\taction: SerializableCronAction;\n\toverlap?: \"allow\" | \"skip\" | \"queue\";\n}\n\n/** Result of scheduling a cron job. */\nexport interface ScheduledCronJob {\n\tid: string;\n}\n\n/** Info about a registered cron job (returned by `listCronJobs`). */\nexport interface CronJobInfo {\n\tid: string;\n\tschedule: string;\n\taction: SerializableCronAction;\n\toverlap: \"allow\" | \"skip\" | \"queue\";\n}\n\n// ---------------------------------------------------------------------------\n// Config\n// ---------------------------------------------------------------------------\n\n/**\n * Input config passed to `agentOS(...)`.\n *\n * The VM option fields live at the TOP LEVEL (no nested `options` key), so\n * callers write `agentOS({ software: [...], additionalInstructions: \"...\" })`.\n */\nexport interface AgentOSActorConfigInput<TConnParams = undefined> {\n\t/**\n\t * Software packages to install in the VM. Pass the imported packages\n\t * directly (e.g. `software: [common, pi]`); kept loosely typed so any\n\t * software package import type-checks.\n\t */\n\tsoftware?: unknown[];\n\t/** Additional instructions appended to the base OS instructions. */\n\tadditionalInstructions?: string;\n\t/** Ports exempt from the loopback-only network restriction. */\n\tloopbackExemptPorts?: number[];\n\t/** Node.js builtins the guest is allowed to import. */\n\tallowedNodeBuiltins?: string[];\n\t/** Permission policy applied to the VM. */\n\tpermissions?: unknown;\n\t/** Root filesystem configuration / snapshot. */\n\trootFilesystem?: unknown;\n\t/** Host-backed mounts exposed inside the VM. */\n\tmounts?: unknown[];\n\t/** Bindings exposed to agents as CLI commands inside the VM. */\n\tbindings?: unknown[];\n\t/** Per-VM resource limits. */\n\tlimits?: unknown;\n\t/** Low-level runtime configuration. */\n\tsidecar?: unknown;\n\tpreview?: {\n\t\tdefaultExpiresInSeconds?: number;\n\t\tmaxExpiresInSeconds?: number;\n\t};\n\tonSessionEvent?: (\n\t\tsessionId: string,\n\t\tevent: JsonRpcNotification,\n\t) => void | Promise<void>;\n\tonPermissionRequest?: (\n\t\tsessionId: string,\n\t\trequest: PermissionRequest,\n\t) => void | Promise<void>;\n\t// Reserved for parity with the native config's typed connection params.\n\t__connParams?: TConnParams;\n}\n\n/** Parsed config (after defaults applied). */\nexport interface AgentOSActorConfig<TConnParams = undefined>\n\textends AgentOSActorConfigInput<TConnParams> {\n\tpreview: { defaultExpiresInSeconds: number; maxExpiresInSeconds: number };\n}\n\n// ---------------------------------------------------------------------------\n// MCP servers + session options (mirrors @rivet-dev/agentos-core's\n// CreateSessionOptions / McpServerConfig)\n// ---------------------------------------------------------------------------\n\n/** A local MCP server launched as a child process inside the VM. */\nexport interface McpServerConfigLocal {\n\ttype: \"local\";\n\t/** Command to launch the MCP server. */\n\tcommand: string;\n\t/** Arguments for the command. */\n\targs?: string[];\n\t/** Environment variables for the server process. */\n\tenv?: Record<string, string>;\n}\n\n/** A remote MCP server reachable over HTTP. */\nexport interface McpServerConfigRemote {\n\ttype: \"remote\";\n\t/** URL of the remote MCP server. */\n\turl: string;\n\t/** HTTP headers to include in requests to the server. */\n\theaders?: Record<string, string>;\n}\n\nexport type McpServerConfig = McpServerConfigLocal | McpServerConfigRemote;\n\n/** Options accepted by `createSession(agentType, options?)`. */\nexport interface CreateSessionOptions {\n\t/** Working directory for the agent session inside the VM. Defaults to /workspace. */\n\tcwd?: string;\n\t/** Environment variables passed to the agent process (e.g. API keys). */\n\tenv?: Record<string, string>;\n\t/** MCP servers made available to the agent during the session. */\n\tmcpServers?: McpServerConfig[];\n\t/** Skip OS instructions injection entirely (default false). */\n\tskipOsInstructions?: boolean;\n\t/** Additional instructions appended to the base OS instructions. */\n\tadditionalInstructions?: string;\n}\n\n// ---------------------------------------------------------------------------\n// vm.* action surface\n//\n// The real native factory exposes these as `any`; this stub gives them real\n// types so consumers (and tsc) exercise the intended shape.\n// ---------------------------------------------------------------------------\n\n/**\n * The `vm.*` action surface as the SERVER defines it. Each handler receives\n * the RivetKit action context (`c`) as its first argument; RivetKit strips\n * that context when projecting these onto the client handle, so callers invoke\n * e.g. `handle.createSession(\"claude\", { env: { ANTHROPIC_API_KEY } })`.\n *\n * The string index signature satisfies RivetKit's `Actions` constraint.\n */\nexport interface VmActions {\n\t// ── Sessions ────────────────────────────────────────────────────\n\t/** Create an ACP session against a registered agent and return its record. */\n\tcreateSession(\n\t\tc: any,\n\t\tagentType: string,\n\t\toptions?: CreateSessionOptions,\n\t): Promise<SessionRecord>;\n\t/** Send a prompt to an existing session and accumulate the agent's reply. */\n\tsendPrompt(c: any, sessionId: string, prompt: string): Promise<PromptResult>;\n\t/** Alias of `sendPrompt`: send a prompt and accumulate the agent's reply. */\n\tprompt(c: any, sessionId: string, text: string): Promise<PromptResult>;\n\t/** Cancel the in-flight prompt for a session (leaves the session open). */\n\tcancelPrompt(c: any, sessionId: string): Promise<JsonRpcResponse>;\n\t/** Cancel ongoing agent work for a session. */\n\tcancelSession(c: any, sessionId: string): Promise<JsonRpcResponse>;\n\t/** List the sessions currently tracked by this VM. */\n\tlistSessions(c: any): Promise<SessionRecord[]>;\n\t/** Tear down an ACP session abruptly. */\n\tcloseSession(c: any, sessionId: string): Promise<void>;\n\t/** Gracefully destroy a session (cancel pending work, then close). */\n\tdestroySession(c: any, sessionId: string): Promise<void>;\n\t/** Reply to a pending permission request raised by the agent. */\n\trespondPermission(\n\t\tc: any,\n\t\tsessionId: string,\n\t\tpermissionId: string,\n\t\treply: PermissionReply,\n\t): Promise<JsonRpcResponse>;\n\t/** Switch the active mode (e.g. \"plan\", \"auto\") for a session. */\n\tsetMode(c: any, sessionId: string, modeId: string): Promise<JsonRpcResponse>;\n\t/** Switch the active model for a session. */\n\tsetModel(c: any, sessionId: string, model: string): Promise<JsonRpcResponse>;\n\t/** Switch the thought/reasoning level for a session. */\n\tsetThoughtLevel(\n\t\tc: any,\n\t\tsessionId: string,\n\t\tlevel: string,\n\t): Promise<JsonRpcResponse>;\n\t/** Get the available + current modes for a session. */\n\tgetModes(c: any, sessionId: string): Promise<SessionModeState | null>;\n\t/** Get the configurable options (model, thought level, ...) for a session. */\n\tgetConfigOptions(c: any, sessionId: string): Promise<SessionConfigOption[]>;\n\n\t// ── Session event replay ────────────────────────────────────────\n\t/** Replay in-memory session events (live reconnection); newer than `since`. */\n\tgetSequencedEvents(\n\t\tc: any,\n\t\tsessionId: string,\n\t\toptions?: GetSequencedEventsOptions,\n\t): Promise<SequencedSessionEvent[]>;\n\t/** Replay persisted session events from durable storage (transcript history). */\n\tgetSessionEvents(\n\t\tc: any,\n\t\tsessionId: string,\n\t): Promise<PersistedSessionEvent[]>;\n\t/** List persisted session records (including for VMs not currently running). */\n\tlistPersistedSessions(c: any): Promise<PersistedSessionRecord[]>;\n\n\t// ── Processes ───────────────────────────────────────────────────\n\t/** Run a command line to completion and capture its output. */\n\texec(c: any, command: string, options?: ExecOptions): Promise<ExecResult>;\n\t/** Run a command (argv form, no shell) to completion and capture output. */\n\texecArgv(\n\t\tc: any,\n\t\tcommand: string,\n\t\targs?: readonly string[],\n\t\toptions?: ExecOptions,\n\t): Promise<ExecResult>;\n\t/** Spawn a long-running process and return its pid. */\n\tspawn(\n\t\tc: any,\n\t\tcommand: string,\n\t\targs?: string[],\n\t\toptions?: SpawnOptions,\n\t): Promise<{ pid: number }>;\n\t/** Spawn a process inside the VM and return its pid. */\n\tspawnProcess(c: any, command: string, args?: string[]): Promise<number>;\n\t/** List processes spawned via `spawn`. */\n\tlistProcesses(c: any): Promise<SpawnedProcessInfo[]>;\n\t/** Get info about a single spawned process. */\n\tgetProcess(c: any, pid: number): Promise<SpawnedProcessInfo>;\n\t/** Write data to a spawned process's stdin. */\n\twriteProcessStdin(\n\t\tc: any,\n\t\tpid: number,\n\t\tdata: string | Uint8Array,\n\t): Promise<void>;\n\t/** Close a spawned process's stdin stream. */\n\tcloseProcessStdin(c: any, pid: number): Promise<void>;\n\t/** Wait for a process to exit and return its exit code. */\n\twaitProcess(c: any, pid: number): Promise<number>;\n\t/** Gracefully stop a process (SIGTERM). */\n\tstopProcess(c: any, pid: number): Promise<void>;\n\t/** Force-kill a running process by pid (SIGKILL). */\n\tkillProcess(c: any, pid: number): Promise<void>;\n\n\t// ── Shells / PTYs ───────────────────────────────────────────────\n\t/** Open an interactive shell (PTY) and return its id. */\n\topenShell(c: any, options?: OpenShellOptions): Promise<{ shellId: string }>;\n\t/** Connect a terminal (PTY) to the VM and return its pid. */\n\tconnectTerminal(c: any, options?: ConnectTerminalOptions): Promise<number>;\n\t/** Write input to a shell's PTY. */\n\twriteShell(c: any, shellId: string, data: string | Uint8Array): Promise<void>;\n\t/** Resize a shell's PTY. */\n\tresizeShell(\n\t\tc: any,\n\t\tshellId: string,\n\t\tcols: number,\n\t\trows: number,\n\t): Promise<void>;\n\t/** Close a shell and free its PTY. */\n\tcloseShell(c: any, shellId: string): Promise<void>;\n\n\t// ── Filesystem ──────────────────────────────────────────────────\n\t/** Read a file from the VM filesystem. */\n\treadFile(c: any, path: string): Promise<Uint8Array>;\n\t/** Write a file into the VM filesystem. */\n\twriteFile(c: any, path: string, content: Uint8Array | string): Promise<void>;\n\t/** Write several files in one call, reporting per-file success. */\n\twriteFiles(c: any, entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>;\n\t/** Read several files in one call, reporting per-file content/errors. */\n\treadFiles(c: any, paths: string[]): Promise<BatchReadResult[]>;\n\t/** Create a directory (optionally recursive). */\n\tmkdir(\n\t\tc: any,\n\t\tpath: string,\n\t\toptions?: { recursive?: boolean },\n\t): Promise<void>;\n\t/** List the immediate entries of a directory. */\n\treaddir(c: any, path: string): Promise<string[]>;\n\t/** Recursively list directory entries with metadata. */\n\treaddirRecursive(\n\t\tc: any,\n\t\tpath: string,\n\t\toptions?: ReaddirRecursiveOptions,\n\t): Promise<DirEntry[]>;\n\t/** Stat a path. */\n\tstat(c: any, path: string): Promise<VirtualStat>;\n\t/** Check whether a path exists. */\n\texists(c: any, path: string): Promise<boolean>;\n\t/** Move/rename a path. */\n\tmove(c: any, from: string, to: string): Promise<void>;\n\t/** Delete a path (optionally recursive). */\n\tdelete(\n\t\tc: any,\n\t\tpath: string,\n\t\toptions?: { recursive?: boolean },\n\t): Promise<void>;\n\t/** Export a serializable snapshot of the VM root filesystem. */\n\tsnapshotRootFilesystem(c: any): Promise<RootSnapshotExport>;\n\n\t// ── Networking + preview URLs ───────────────────────────────────\n\t/** Proxy an HTTP request to a port inside the VM and return the response. */\n\tvmFetch(\n\t\tc: any,\n\t\tport: number,\n\t\tpath: string,\n\t\toptions?: VmFetchOptions,\n\t): Promise<VmFetchResponse>;\n\t/** Create a time-limited, token-based preview URL for a VM port. */\n\tcreateSignedPreviewUrl(\n\t\tc: any,\n\t\tport: number,\n\t\texpiresInSeconds?: number,\n\t): Promise<PreviewUrl>;\n\n\t// ── Cron ────────────────────────────────────────────────────────\n\t/** Schedule a serializable cron job inside the VM. */\n\tscheduleCron(\n\t\tc: any,\n\t\toptions: SerializableCronJobOptions,\n\t): Promise<ScheduledCronJob>;\n\t/** List the cron jobs registered on this VM. */\n\tlistCronJobs(c: any): Promise<CronJobInfo[]>;\n\t/** Cancel a registered cron job by id. */\n\tcancelCronJob(c: any, id: string): Promise<void>;\n\n\t/** Index signature required by RivetKit's `Actions` constraint. */\n\t[action: string]: (c: any, ...args: any[]) => any;\n}\n\n// ---------------------------------------------------------------------------\n// Actor definition\n// ---------------------------------------------------------------------------\n\n/**\n * The `agentOS(...)` actor definition type. Mirrors RivetKit's generic\n * `ActorDefinition` with the Agent OS state/vars/events/actions bound in.\n */\nexport type AgentOSActorDefinition<TConnParams = undefined> = ActorDefinition<\n\tAgentOSActorState,\n\tTConnParams,\n\tundefined,\n\tAgentOSActorVars,\n\tundefined,\n\tany,\n\tAgentOSEvents,\n\tRecord<never, never>,\n\tVmActions\n>;\n\nconst RUNTIME_NOT_WIRED =\n\t\"agentos runtime not yet wired — dylib pending\";\n\n/**\n * Build the Agent OS actor definition.\n *\n * STUB: returns a correctly typed RivetKit actor definition whose action\n * handlers throw. No native/napi module is imported. Replace the throwing\n * handlers with the native factory builder once the runtime ships; the public\n * type surface is stable.\n */\nexport function agentOS<TConnParams = undefined>(\n\t// Accepted for type-surface parity; ignored by the stub.\n\t_config: AgentOSActorConfigInput<TConnParams>,\n): AgentOSActorDefinition<TConnParams> {\n\tconst notWired = () => {\n\t\tthrow new Error(RUNTIME_NOT_WIRED);\n\t};\n\n\tconst definition = actor({\n\t\tstate: {} as AgentOSActorState,\n\t\tcreateVars: (): AgentOSActorVars => ({\n\t\t\tactiveSessionIds: new Set<string>(),\n\t\t\tactiveProcesses: new Set<number>(),\n\t\t\tactiveShells: new Set<string>(),\n\t\t\tsessions: new Set<string>(),\n\t\t}),\n\t\tevents: agentOSEvents,\n\t\tactions: {\n\t\t\t// Sessions\n\t\t\tcreateSession: notWired,\n\t\t\tsendPrompt: notWired,\n\t\t\tprompt: notWired,\n\t\t\tcancelPrompt: notWired,\n\t\t\tcancelSession: notWired,\n\t\t\tlistSessions: notWired,\n\t\t\tcloseSession: notWired,\n\t\t\tdestroySession: notWired,\n\t\t\trespondPermission: notWired,\n\t\t\tsetMode: notWired,\n\t\t\tsetModel: notWired,\n\t\t\tsetThoughtLevel: notWired,\n\t\t\tgetModes: notWired,\n\t\t\tgetConfigOptions: notWired,\n\t\t\t// Session event replay\n\t\t\tgetSequencedEvents: notWired,\n\t\t\tgetSessionEvents: notWired,\n\t\t\tlistPersistedSessions: notWired,\n\t\t\t// Processes\n\t\t\texec: notWired,\n\t\t\texecArgv: notWired,\n\t\t\tspawn: notWired,\n\t\t\tspawnProcess: notWired,\n\t\t\tlistProcesses: notWired,\n\t\t\tgetProcess: notWired,\n\t\t\twriteProcessStdin: notWired,\n\t\t\tcloseProcessStdin: notWired,\n\t\t\twaitProcess: notWired,\n\t\t\tstopProcess: notWired,\n\t\t\tkillProcess: notWired,\n\t\t\t// Shells\n\t\t\topenShell: notWired,\n\t\t\tconnectTerminal: notWired,\n\t\t\twriteShell: notWired,\n\t\t\tresizeShell: notWired,\n\t\t\tcloseShell: notWired,\n\t\t\t// Filesystem\n\t\t\treadFile: notWired,\n\t\t\twriteFile: notWired,\n\t\t\twriteFiles: notWired,\n\t\t\treadFiles: notWired,\n\t\t\tmkdir: notWired,\n\t\t\treaddir: notWired,\n\t\t\treaddirRecursive: notWired,\n\t\t\tstat: notWired,\n\t\t\texists: notWired,\n\t\t\tmove: notWired,\n\t\t\tdelete: notWired,\n\t\t\tsnapshotRootFilesystem: notWired,\n\t\t\t// Networking + preview URLs\n\t\t\tvmFetch: notWired,\n\t\t\tcreateSignedPreviewUrl: notWired,\n\t\t\t// Cron\n\t\t\tscheduleCron: notWired,\n\t\t\tlistCronJobs: notWired,\n\t\t\tcancelCronJob: notWired,\n\t\t},\n\t});\n\n\treturn definition as unknown as AgentOSActorDefinition<TConnParams>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,sBAA8D;AAI9D,IAAAA,mBAAsB;AAsTf,SAAS,iBACf,oBACA,MACyB;AACzB,QAAM,WAAW,MAAM,YAAY;AACnC,SAAO;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,IAAI;AAAA,MACJ,QAAQ,EAAE,UAAU,oBAAoB,SAAS;AAAA,IAClD;AAAA,IACA;AAAA,EACD;AACD;AAqEA,IAAM,aAAa,UAAkB,uBAAS;AAE9C,IAAM,gBAAgB;AAAA,EACrB,cAAc,WAAgC;AAAA,EAC9C,mBAAmB,WAAqC;AAAA,EACxD,UAAU,WAA4B;AAAA,EACtC,YAAY,WAA8B;AAAA,EAC1C,eAAe,WAAiC;AAAA,EAChD,aAAa,WAA+B;AAAA,EAC5C,WAAW,WAA6B;AAAA,EACxC,WAAW,WAA6B;AACzC;AA6XA,IAAM,oBACL;AAUM,SAAS,QAEf,SACsC;AACtC,QAAM,WAAW,MAAM;AACtB,UAAM,IAAI,MAAM,iBAAiB;AAAA,EAClC;AAEA,QAAM,iBAAa,uBAAM;AAAA,IACxB,OAAO,CAAC;AAAA,IACR,YAAY,OAAyB;AAAA,MACpC,kBAAkB,oBAAI,IAAY;AAAA,MAClC,iBAAiB,oBAAI,IAAY;AAAA,MACjC,cAAc,oBAAI,IAAY;AAAA,MAC9B,UAAU,oBAAI,IAAY;AAAA,IAC3B;AAAA,IACA,QAAQ;AAAA,IACR,SAAS;AAAA;AAAA,MAER,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,eAAe;AAAA,MACf,cAAc;AAAA,MACd,cAAc;AAAA,MACd,gBAAgB;AAAA,MAChB,mBAAmB;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,iBAAiB;AAAA,MACjB,UAAU;AAAA,MACV,kBAAkB;AAAA;AAAA,MAElB,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,uBAAuB;AAAA;AAAA,MAEvB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,MACP,cAAc;AAAA,MACd,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,mBAAmB;AAAA,MACnB,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA;AAAA,MAEb,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,YAAY;AAAA;AAAA,MAEZ,UAAU;AAAA,MACV,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,OAAO;AAAA,MACP,SAAS;AAAA,MACT,kBAAkB;AAAA,MAClB,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,wBAAwB;AAAA;AAAA,MAExB,SAAS;AAAA,MACT,wBAAwB;AAAA;AAAA,MAExB,cAAc;AAAA,MACd,cAAc;AAAA,MACd,eAAe;AAAA,IAChB;AAAA,EACD,CAAC;AAED,SAAO;AACR;","names":["import_rivetkit"]}
|