@rivus/runtime 0.16.6 → 0.18.0

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 CHANGED
@@ -3,3 +3,24 @@
3
3
  Standalone agent execution runtime for Rivus, including the Pi and ACP adapters, memory, tool execution, and run history.
4
4
 
5
5
  Use the root entrypoint for execution contracts, `@rivus/runtime/pi` for Pi assembly, and `@rivus/runtime/acp` for ACP.
6
+
7
+ `createAgentHarness` returns the canonical Effect Harness; its session handles, event/update handlers and injected
8
+ Clock/Run ID ports compose Effect directly. Promise Harness clients, runtime conveniences, event constructors,
9
+ projection helpers and generic Clock/Run ID factories are not public entrypoints. Infer private options and results
10
+ from the retained Factory/Port signatures instead of importing implementation modules.
11
+
12
+ Pi assembly owns SDK model, resource and session creation. `createSession({ sessionCwd })` honors an explicit working
13
+ directory with or without `sessionDirectory`; omitting both options preserves the SDK defaults.
14
+ Pi and ACP loops implement the same native Effect contract. SDK session, plugin callback and stdio transport APIs retain
15
+ their real asynchronous boundaries. Pi still validates SDK-managed history when changing a live Session's model.
16
+
17
+ Runtime-only applications supply their loop and ports without installing Gateway or Agent. The Agent SDK does not
18
+ re-export execution helpers; consume this package for runtime behavior.
19
+
20
+ Memory consumers open `openJsonlAgentMemoryRepository` and inject it into `createMemoryService` with an identity source.
21
+ `createRivusMemoryToolDescriptor` and `createProjectMemoryPromptPreparer` use the canonical Effect service directly;
22
+ Legacy Memory DTOs, Promise services/handles and compaction aliases are removed. The JSONL v1 format is unchanged.
23
+
24
+ Tool Broker, Ledger, policy and approval ports use Effect. Pi runs the workflow only at its SDK execute callback,
25
+ using `unwrapExit` to preserve failure identity. Legacy tool authority, Promise Ledger and Pi Proxy aliases are removed;
26
+ open the canonical `openJsonlToolOperationLedger` and inject it directly. The existing operation file format is unchanged.
package/dist/acp.d.ts CHANGED
@@ -1,37 +1,5 @@
1
- import { C as AgentLoopInput, a as AgentLoopInput$1, b as AgentLoop, t as AgentLoop$1 } from "./chunks/agent-loop.js";
1
+ import { n as AgentLoopInput, t as AgentLoop } from "./chunks/agent-loop.js";
2
2
  import * as acp from "@agentclientprotocol/sdk";
3
-
4
- //#region src/adapters/acp/runtime/acp-agent-loop.d.ts
5
- type AcpToolCallStatus = "pending" | "in_progress" | "completed" | "failed";
6
- interface AcpSessionUpdate {
7
- readonly content?: unknown;
8
- readonly name?: string | null;
9
- readonly rawInput?: unknown;
10
- readonly rawOutput?: unknown;
11
- readonly sessionUpdate: string;
12
- readonly status?: AcpToolCallStatus | null;
13
- readonly title?: string | null;
14
- readonly toolCallId?: string;
15
- readonly [key: string]: unknown;
16
- }
17
- interface AcpPromptResult {
18
- readonly stopReason: string;
19
- }
20
- interface AcpAgentSession {
21
- cancel(options?: {
22
- readonly preserveSession?: boolean;
23
- }): Promise<void> | void;
24
- prompt(text: string, onUpdate: (update: AcpSessionUpdate) => void): Promise<AcpPromptResult>;
25
- dispose?(): Promise<void> | void;
26
- invalidate?(): Promise<void> | void;
27
- }
28
- interface AcpAgentLoopOptions {
29
- readonly cancellationSettleTimeoutMs?: number;
30
- readonly disposeSessionAfterRun?: boolean;
31
- readonly resolveSession: (input: AgentLoopInput) => Promise<AcpAgentSession> | AcpAgentSession;
32
- }
33
- declare function createAcpAgentLoop(options: AcpAgentLoopOptions): AgentLoop;
34
- //#endregion
35
3
  //#region src/adapters/acp/runtime/acp-permission-policy.d.ts
36
4
  interface AcpPermissionOption {
37
5
  readonly kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
@@ -51,25 +19,18 @@ interface AcpPermissionRequest {
51
19
  interface AcpPermissionSelection {
52
20
  readonly optionId: string;
53
21
  }
54
- type AcpPermissionDecision = {
55
- readonly outcome: "cancelled";
56
- } | {
57
- readonly optionId: string;
58
- readonly outcome: "selected";
59
- };
60
22
  type AcpPermissionPolicy = (request: AcpPermissionRequest) => Promise<AcpPermissionSelection | undefined> | AcpPermissionSelection | undefined;
61
23
  interface AcpSessionPermissionContext {
62
24
  readonly sessionKey: string;
63
25
  }
64
26
  type AcpSessionPermissionPolicy = (request: AcpPermissionRequest, context: AcpSessionPermissionContext) => Promise<AcpPermissionSelection | undefined> | AcpPermissionSelection | undefined;
65
- declare function decideAcpPermission(request: AcpPermissionRequest, policy?: AcpPermissionPolicy): Promise<AcpPermissionDecision>;
66
27
  //#endregion
67
28
  //#region src/adapters/acp/runtime/acp-permission-bridge.d.ts
68
29
  interface AcpPermissionBridge {
69
30
  readonly policy: AcpSessionPermissionPolicy;
70
31
  bind(sessionKey: string, policy: AcpPermissionPolicy): () => void;
71
32
  }
72
- declare function createAcpPermissionBridge(): AcpPermissionBridge;
33
+ export declare function createAcpPermissionBridge(): AcpPermissionBridge;
73
34
  //#endregion
74
35
  //#region src/adapters/acp/runtime/acp-agent-server.d.ts
75
36
  interface AcpAgentServerOptions {
@@ -78,8 +39,8 @@ interface AcpAgentServerOptions {
78
39
  readonly permissionBridge?: AcpPermissionBridge;
79
40
  readonly workingDirectory: string;
80
41
  }
81
- declare function createAcpAgentServer(options: AcpAgentServerOptions): acp.AgentApp;
82
- declare function serveAcpAgentOnStdio(app: acp.AgentApp): Promise<void>;
42
+ export declare function createAcpAgentServer(options: AcpAgentServerOptions): acp.AgentApp;
43
+ export declare function serveAcpAgentOnStdio(app: acp.AgentApp): Promise<void>;
83
44
  //#endregion
84
45
  //#region src/adapters/acp/runtime/acp-session-store.d.ts
85
46
  interface AcpSessionRecord {
@@ -97,7 +58,7 @@ interface JsonAcpSessionStoreOptions {
97
58
  * A small deployment-owned store for ACP provider session identities.
98
59
  * The file contains no prompts or credentials, only session-key bindings.
99
60
  */
100
- declare function createJsonAcpSessionStore(options: JsonAcpSessionStoreOptions): AcpSessionStore;
61
+ export declare function createJsonAcpSessionStore(options: JsonAcpSessionStoreOptions): AcpSessionStore;
101
62
  //#endregion
102
63
  //#region src/adapters/acp/runtime/acp-stdio-agent-loop.d.ts
103
64
  interface AcpMcpServerEnvironmentVariable {
@@ -128,52 +89,6 @@ interface AcpStdioAgentLoopHandle {
128
89
  readonly loop: AgentLoop;
129
90
  dispose(): Promise<void>;
130
91
  }
131
- declare function createAcpStdioAgentLoop(options: AcpStdioAgentLoopOptions): AcpStdioAgentLoopHandle;
132
- declare class AcpSessionResumeUnavailable extends Error {
133
- readonly sessionId: string;
134
- readonly name = "AcpSessionResumeUnavailable";
135
- constructor(sessionId: string);
136
- }
137
- declare class AcpSessionResumeFailed extends Error {
138
- readonly sessionId: string;
139
- readonly cause: unknown;
140
- readonly name = "AcpSessionResumeFailed";
141
- constructor(sessionId: string, cause: unknown);
142
- }
143
- //#endregion
144
- //#region src/adapters/compatibility/acp/acp-runtime.d.ts
145
- interface AcpAgentLoopOptions$1 {
146
- readonly cancellationSettleTimeoutMs?: number;
147
- readonly disposeSessionAfterRun?: boolean;
148
- readonly resolveSession: (input: AgentLoopInput$1) => Promise<AcpAgentSession> | AcpAgentSession;
149
- }
150
- interface AcpAgentServerOptions$1 {
151
- readonly loop: AgentLoop$1;
152
- readonly workingDirectory: string;
153
- readonly agentName?: string;
154
- readonly permissionBridge?: AcpPermissionBridge;
155
- }
156
- interface AcpStdioAgentLoopOptions$1 {
157
- readonly command: string;
158
- readonly workingDirectory: string;
159
- readonly mcpServers?: (input: AgentLoopInput$1) => ReadonlyArray<AcpMcpServer>;
160
- /** Persist provider session IDs so a restarted ACP child can load/resume them. */
161
- readonly sessionStore?: AcpSessionStore;
162
- readonly permissionPolicy?: AcpSessionPermissionPolicy;
163
- readonly environment?: Readonly<Record<string, string>>;
164
- readonly arguments?: ReadonlyArray<string>;
165
- readonly clientName?: string;
166
- readonly initializationTimeoutMs?: number;
167
- readonly terminationTimeoutMs?: number;
168
- readonly onStderr?: (text: string) => void;
169
- }
170
- interface AcpStdioAgentLoopHandle$1 {
171
- readonly loop: AgentLoop$1;
172
- dispose(): Promise<void>;
173
- }
174
- declare function createAcpAgentLoop$1(options: AcpAgentLoopOptions$1): AgentLoop$1;
175
- declare function createAcpAgentServer$1(options: AcpAgentServerOptions$1): acp.AgentApp;
176
- declare function serveAcpAgentOnStdio$1(app: acp.AgentApp): Promise<void>;
177
- declare function createAcpStdioAgentLoop$1(options: AcpStdioAgentLoopOptions$1): AcpStdioAgentLoopHandle$1;
92
+ export declare function createAcpStdioAgentLoop(options: AcpStdioAgentLoopOptions): AcpStdioAgentLoopHandle;
178
93
  //#endregion
179
- export { type AcpAgentLoopOptions, type AcpAgentServerOptions, type AcpAgentSession, type AcpMcpServer, type AcpMcpServerEnvironmentVariable, type AcpPermissionBridge, type AcpPermissionDecision, type AcpPermissionOption, type AcpPermissionPolicy, type AcpPermissionRequest, type AcpPermissionSelection, type AcpPermissionToolCall, type AcpPromptResult, type AcpSessionPermissionContext, type AcpSessionPermissionPolicy, type AcpSessionRecord, AcpSessionResumeFailed, AcpSessionResumeUnavailable, type AcpSessionStore, type AcpSessionUpdate, type AcpStdioAgentLoopHandle, type AcpStdioAgentLoopOptions, type AcpToolCallStatus, type JsonAcpSessionStoreOptions, type AcpAgentLoopOptions$1 as LegacyAcpAgentLoopOptions, type AcpAgentServerOptions$1 as LegacyAcpAgentServerOptions, type AcpStdioAgentLoopHandle$1 as LegacyAcpStdioAgentLoopHandle, type AcpStdioAgentLoopOptions$1 as LegacyAcpStdioAgentLoopOptions, createAcpAgentLoop, createAcpAgentServer, createAcpPermissionBridge, createAcpStdioAgentLoop, createJsonAcpSessionStore, createAcpAgentLoop$1 as createLegacyAcpAgentLoop, createAcpAgentServer$1 as createLegacyAcpAgentServer, createAcpStdioAgentLoop$1 as createLegacyAcpStdioAgentLoop, decideAcpPermission, serveAcpAgentOnStdio, serveAcpAgentOnStdio$1 as serveLegacyAcpAgentOnStdio };
94
+ export {};