@rivet-dev/agentos 0.0.0-integrate-dylib-into-main.815fcda → 0.0.0-main.29b0797

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.
@@ -1,5 +0,0 @@
1
- /**
2
- * Resolve the absolute path to the agent-os actor plugin cdylib. RivetKit
3
- * `dlopen`s this path through the generic native-plugin ABI.
4
- */
5
- export declare function getPluginPath(): string;
@@ -1,84 +0,0 @@
1
- // Platform-specific resolver for the prebuilt agent-os actor plugin cdylib
2
- // (`libagentos_actor_plugin.{so,dylib,dll}`). Mirrors the sidecar-binary
3
- // resolver (`@rivet-dev/agentos-sidecar`): the library ships inside one of the
4
- // `@rivet-dev/agentos-plugin-<platform>` packages, declared as
5
- // optionalDependencies so npm installs only the one matching the current
6
- // `os`/`cpu`/`libc` at install time (spec phase 6).
7
- //
8
- // Resolution priority:
9
- // 1. `AGENTOS_PLUGIN_BIN` env var (absolute path override).
10
- // 2. A cargo build output under the repo `target/{release,debug}/` (dev).
11
- // 3. The platform-specific `@rivet-dev/agentos-plugin-<platform>` package.
12
- import { existsSync } from "node:fs";
13
- import { createRequire } from "node:module";
14
- import { dirname, join } from "node:path";
15
- import { fileURLToPath } from "node:url";
16
- const PLUGIN_BIN_ENV = "AGENTOS_PLUGIN_BIN";
17
- /** The cdylib filename for the current platform. */
18
- function libraryName() {
19
- switch (process.platform) {
20
- case "darwin":
21
- return "libagentos_actor_plugin.dylib";
22
- case "win32":
23
- return "agentos_actor_plugin.dll";
24
- default:
25
- return "libagentos_actor_plugin.so";
26
- }
27
- }
28
- function getPlatformPackageName() {
29
- const { platform, arch } = process;
30
- switch (platform) {
31
- case "linux":
32
- if (arch === "x64")
33
- return "@rivet-dev/agentos-plugin-linux-x64-gnu";
34
- if (arch === "arm64")
35
- return "@rivet-dev/agentos-plugin-linux-arm64-gnu";
36
- break;
37
- default:
38
- break;
39
- }
40
- return null;
41
- }
42
- /**
43
- * Resolve the absolute path to the agent-os actor plugin cdylib. RivetKit
44
- * `dlopen`s this path through the generic native-plugin ABI.
45
- */
46
- export function getPluginPath() {
47
- const override = process.env[PLUGIN_BIN_ENV];
48
- if (override) {
49
- if (!existsSync(override)) {
50
- throw new Error(`${PLUGIN_BIN_ENV} is set to ${override} but the file does not exist`);
51
- }
52
- return override;
53
- }
54
- const lib = libraryName();
55
- // Dev: a cargo build output under the repo `target/`. `import.meta.url` is
56
- // `packages/agentos/dist/plugin-binary.js`, so the repo root is three levels up.
57
- const here = dirname(fileURLToPath(import.meta.url));
58
- for (const profile of ["release", "debug"]) {
59
- const candidate = join(here, "..", "..", "..", "target", profile, lib);
60
- if (existsSync(candidate)) {
61
- return candidate;
62
- }
63
- }
64
- // Prod: the platform-specific package.
65
- const platformPkg = getPlatformPackageName();
66
- if (!platformPkg) {
67
- throw new Error(`@rivet-dev/agentos: unsupported platform ${process.platform}/${process.arch}. ` +
68
- "The Agent OS actor plugin currently supports linux x64 and arm64. " +
69
- `Set ${PLUGIN_BIN_ENV} to a local cdylib to override.`);
70
- }
71
- const require = createRequire(import.meta.url);
72
- let pkgJsonPath;
73
- try {
74
- pkgJsonPath = require.resolve(`${platformPkg}/package.json`);
75
- }
76
- catch {
77
- throw new Error(`@rivet-dev/agentos: platform package ${platformPkg} is not installed.\n` +
78
- "This usually means the platform is unsupported or optionalDependencies\n" +
79
- `were skipped during install. Try: npm install --include=optional ${platformPkg}\n` +
80
- `Or set ${PLUGIN_BIN_ENV} to a local cdylib, or build it with\n` +
81
- "`cargo build -p agentos-actor-plugin`.");
82
- }
83
- return join(dirname(pkgJsonPath), lib);
84
- }
package/dist/types.d.ts DELETED
@@ -1,102 +0,0 @@
1
- import type { AgentCapabilities, AgentInfo, AgentOs, CronEvent, JsonRpcNotification, JsonRpcResponse, PermissionRequest } from "@rivet-dev/agentos-core";
2
- import type { ActionContext } from "rivetkit";
3
- export type AgentOsActorState = {};
4
- export interface AgentOsActorVars {
5
- agentOs: AgentOs | null;
6
- activeSessionIds: Set<string>;
7
- activeProcesses: Set<number>;
8
- activeHooks: Set<Promise<void>>;
9
- activeShells: Set<string>;
10
- sessions: Set<string>;
11
- }
12
- export interface SessionEventPayload {
13
- sessionId: string;
14
- event: JsonRpcNotification;
15
- }
16
- export interface PermissionRequestPayload {
17
- sessionId: string;
18
- request: PermissionRequest;
19
- }
20
- export type VmBootedPayload = Record<string, never>;
21
- export interface VmShutdownPayload {
22
- reason: "sleep" | "destroy" | "error";
23
- }
24
- export interface ProcessOutputPayload {
25
- pid: number;
26
- stream: "stdout" | "stderr";
27
- data: Uint8Array;
28
- }
29
- export interface ProcessExitPayload {
30
- pid: number;
31
- exitCode: number;
32
- }
33
- export interface ShellDataPayload {
34
- shellId: string;
35
- data: Uint8Array;
36
- }
37
- export interface CronEventPayload {
38
- event: CronEvent;
39
- }
40
- export interface AgentOsEvents {
41
- sessionEvent: SessionEventPayload;
42
- permissionRequest: PermissionRequestPayload;
43
- vmBooted: VmBootedPayload;
44
- vmShutdown: VmShutdownPayload;
45
- processOutput: ProcessOutputPayload;
46
- processExit: ProcessExitPayload;
47
- shellData: ShellDataPayload;
48
- cronEvent: CronEventPayload;
49
- }
50
- /** Result from sendPrompt. */
51
- export interface PromptResult {
52
- /** Raw JSON-RPC response from the ACP adapter. */
53
- response: JsonRpcResponse;
54
- /** Accumulated agent text output from streamed message chunks. */
55
- text: string;
56
- }
57
- export interface SessionRecord {
58
- sessionId: string;
59
- agentType: string;
60
- capabilities: AgentCapabilities;
61
- agentInfo: AgentInfo | null;
62
- }
63
- export interface PersistedSessionRecord {
64
- sessionId: string;
65
- agentType: string;
66
- capabilities: AgentCapabilities;
67
- agentInfo: AgentInfo | null;
68
- createdAt: number;
69
- }
70
- export interface PersistedSessionEvent {
71
- sessionId: string;
72
- seq: number;
73
- event: JsonRpcNotification;
74
- createdAt: number;
75
- }
76
- export type SerializableCronAction = {
77
- type: "session";
78
- agentType: string;
79
- prompt: string;
80
- cwd?: string;
81
- } | {
82
- type: "exec";
83
- command: string;
84
- args?: string[];
85
- };
86
- export interface SerializableCronJobOptions {
87
- id?: string;
88
- schedule: string;
89
- action: SerializableCronAction;
90
- overlap?: "allow" | "skip" | "queue";
91
- }
92
- export interface SerializableCronJobInfo {
93
- id: string;
94
- schedule: string;
95
- action: SerializableCronAction;
96
- overlap: "allow" | "skip" | "queue";
97
- lastRun?: string;
98
- nextRun?: string;
99
- runCount: number;
100
- running: boolean;
101
- }
102
- export type AgentOsActionContext<TConnParams = undefined> = ActionContext<AgentOsActorState, TConnParams, undefined, AgentOsActorVars, undefined, any>;
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};