@skaile/forge-agent-runtime 1.0.0 → 1.1.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/CHANGELOG.md +8 -0
- package/README.md +58 -0
- package/dist/app-runner-host/index.d.mts +61 -0
- package/dist/app-runner-host/index.d.ts +61 -0
- package/dist/app-runner-host/index.mjs +565 -0
- package/dist/index.d.mts +6 -124
- package/dist/index.d.ts +6 -124
- package/dist/index.mjs +11 -535
- package/dist/shared/forge-agent-runtime.B1LZr0Sl.mjs +538 -0
- package/dist/shared/forge-agent-runtime.DlNAoPjs.d.mts +122 -0
- package/dist/shared/forge-agent-runtime.DlNAoPjs.d.ts +122 -0
- package/package.json +6 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { AgentClient } from '@skaile/workspaces/sdk/client';
|
|
3
|
-
import { AgentCommand
|
|
3
|
+
import { AgentCommand, AgentEvent as AgentEvent$1, MessageV2 } from '@skaile/workspaces/sdk/types';
|
|
4
4
|
import { AIProviderRegistryView } from '@skaile/forge-settings/server';
|
|
5
|
+
import { a as AgentAdapter, b as AgentAdapterConfig, c as AgentCommand$1, A as AgentEvent, d as AgentStatus } from './shared/forge-agent-runtime.DlNAoPjs.mjs';
|
|
5
6
|
import { SubscriberTransport, SessionDispatcher, MessageStore } from '@skaile/workspaces/sdk/session';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -118,7 +119,7 @@ declare class AgentProcessManager extends EventEmitter {
|
|
|
118
119
|
* Send any AgentCommand to the managed process.
|
|
119
120
|
* Used internally by ProcessManagerClientTransport.
|
|
120
121
|
*/
|
|
121
|
-
sendCommand(id: string, command: AgentCommand
|
|
122
|
+
sendCommand(id: string, command: AgentCommand): void;
|
|
122
123
|
/**
|
|
123
124
|
* Create an AgentClient for a managed session.
|
|
124
125
|
* Uses ProcessManagerClientTransport so there is no second subscription
|
|
@@ -133,125 +134,6 @@ declare class AgentProcessManager extends EventEmitter {
|
|
|
133
134
|
private waitForReady;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
/**
|
|
137
|
-
* AgentAdapter — canonical interface for forge agent harnesses.
|
|
138
|
-
*
|
|
139
|
-
* Every harness (omp, claude-sdk, codex, …) runs behind an adapter that
|
|
140
|
-
* implements this interface. Apps depend only on this contract, not the
|
|
141
|
-
* concrete adapter type.
|
|
142
|
-
*
|
|
143
|
-
* Lifecycle:
|
|
144
|
-
* 1. Call `connect(config)` — spawns the subprocess or initialises the SDK client.
|
|
145
|
-
* 2. Call `sendCommand(cmd)` to dispatch prompts and control commands.
|
|
146
|
-
* 3. Call `listen()` to consume the async event stream.
|
|
147
|
-
* 4. Call `abort()` to cancel an in-flight turn.
|
|
148
|
-
* 5. Call `disconnect()` to tear down cleanly.
|
|
149
|
-
*
|
|
150
|
-
* Adapters are STATEFUL: one instance per active agent session.
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/** Input to the agent: a natural-language prompt or a control message. */
|
|
154
|
-
interface AgentCommand {
|
|
155
|
-
type: string;
|
|
156
|
-
[key: string]: unknown;
|
|
157
|
-
}
|
|
158
|
-
/** Output from the agent: any typed event from the skaile protocol. */
|
|
159
|
-
interface AgentEvent {
|
|
160
|
-
type: string;
|
|
161
|
-
[key: string]: unknown;
|
|
162
|
-
}
|
|
163
|
-
/** Observable lifecycle state of an adapter instance. */
|
|
164
|
-
type AgentStatus = "idle" | "running" | "error" | "disconnected";
|
|
165
|
-
/**
|
|
166
|
-
* Configuration passed to `AgentAdapter.connect()`.
|
|
167
|
-
*
|
|
168
|
-
* All fields mirror `AgentProcessConfig` from `agent-process.ts`
|
|
169
|
-
* so the ProcessManagerAdapter can pass them through unchanged.
|
|
170
|
-
*/
|
|
171
|
-
interface AgentAdapterConfig {
|
|
172
|
-
/** Working directory for the agent (--project-dir) */
|
|
173
|
-
projectDir: string;
|
|
174
|
-
/** Bridge harness type (omp, claude-sdk). Defaults to 'omp'. */
|
|
175
|
-
harness?: string;
|
|
176
|
-
/**
|
|
177
|
-
* The AI provider registry the session runs against. The adapter resolves
|
|
178
|
-
* each enabled entry's credential reference and delivers it through the
|
|
179
|
-
* child environment.
|
|
180
|
-
*/
|
|
181
|
-
registry?: AIProviderRegistryView;
|
|
182
|
-
/**
|
|
183
|
-
* Registry entry ids the session is restricted to (`--providers a,b`).
|
|
184
|
-
* Absent or empty: the session sees the whole registry. `registry` should
|
|
185
|
-
* already be narrowed to the same ids so only their credentials are delivered.
|
|
186
|
-
*/
|
|
187
|
-
providers?: string[];
|
|
188
|
-
/**
|
|
189
|
-
* The layered environment `env:` references resolve against and the child
|
|
190
|
-
* env is based on; defaults to `process.env`.
|
|
191
|
-
*/
|
|
192
|
-
credentialEnv?: Record<string, string | undefined>;
|
|
193
|
-
/** Model selection as `"<providerId>/<modelId>"`, a bare model id, or `@role` */
|
|
194
|
-
model?: string;
|
|
195
|
-
/** Environment variables injected into the subprocess */
|
|
196
|
-
env?: Record<string, string>;
|
|
197
|
-
/** System prompt written to .skaile/system-prompt.md before spawn */
|
|
198
|
-
systemPrompt?: string;
|
|
199
|
-
/** Max agentic turns */
|
|
200
|
-
maxTurns?: number;
|
|
201
|
-
/** GitAgent definition directory */
|
|
202
|
-
agentDir?: string;
|
|
203
|
-
/** OMP harness session ID for native resume */
|
|
204
|
-
harnessSessionId?: string;
|
|
205
|
-
/** Address the subprocess binds and the client dials. Absent: runtime default bind, dial `127.0.0.1`. */
|
|
206
|
-
host?: string;
|
|
207
|
-
/** Bearer token the subprocess WebSocket requires and the client presents. Absent: no authentication. */
|
|
208
|
-
wsAuthToken?: string;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Canonical interface for all forge agent harnesses.
|
|
212
|
-
*
|
|
213
|
-
* Implementations wrap the `AgentProcessManager` pattern used by the existing
|
|
214
|
-
* forge apps, exposing a minimal async API that higher-level managers consume.
|
|
215
|
-
*/
|
|
216
|
-
interface AgentAdapter {
|
|
217
|
-
/**
|
|
218
|
-
* Connect to the agent harness and prepare it for commands.
|
|
219
|
-
* Must be called once before `sendCommand` or `listen`.
|
|
220
|
-
*/
|
|
221
|
-
connect(config: AgentAdapterConfig): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Send a command to the connected agent.
|
|
224
|
-
* Throws if `connect()` has not been called or the session has disconnected.
|
|
225
|
-
*/
|
|
226
|
-
sendCommand(command: AgentCommand): Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* Return an async iterable of agent events.
|
|
229
|
-
* The iterable completes when the adapter disconnects.
|
|
230
|
-
*
|
|
231
|
-
* Callers can use `for await (const event of adapter.listen()) { ... }` or
|
|
232
|
-
* subscribe via an EventEmitter bridge (see BaseAgentManager).
|
|
233
|
-
*/
|
|
234
|
-
listen(): AsyncIterable<AgentEvent>;
|
|
235
|
-
/**
|
|
236
|
-
* Cancel the current in-flight agent turn.
|
|
237
|
-
* No-op if the agent is idle.
|
|
238
|
-
*/
|
|
239
|
-
abort(): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* Whether the adapter is connected and the agent is ready to receive commands.
|
|
242
|
-
*/
|
|
243
|
-
isConnected(): boolean;
|
|
244
|
-
/**
|
|
245
|
-
* Observable lifecycle state.
|
|
246
|
-
*/
|
|
247
|
-
getStatus(): AgentStatus;
|
|
248
|
-
/**
|
|
249
|
-
* Tear down the adapter: disconnect, stop subprocess if applicable, release resources.
|
|
250
|
-
* Safe to call multiple times.
|
|
251
|
-
*/
|
|
252
|
-
disconnect(): Promise<void>;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
137
|
/**
|
|
256
138
|
* ProcessManagerAdapter — AgentAdapter implementation backed by AgentProcessManager.
|
|
257
139
|
*
|
|
@@ -268,7 +150,7 @@ declare class ProcessManagerAdapter implements AgentAdapter {
|
|
|
268
150
|
private status;
|
|
269
151
|
constructor();
|
|
270
152
|
connect(config: AgentAdapterConfig): Promise<void>;
|
|
271
|
-
sendCommand(command: AgentCommand): Promise<void>;
|
|
153
|
+
sendCommand(command: AgentCommand$1): Promise<void>;
|
|
272
154
|
listen(): AsyncIterable<AgentEvent>;
|
|
273
155
|
abort(): Promise<void>;
|
|
274
156
|
isConnected(): boolean;
|
|
@@ -589,5 +471,5 @@ declare class FanoutTransport {
|
|
|
589
471
|
get subscriberCount(): number;
|
|
590
472
|
}
|
|
591
473
|
|
|
592
|
-
export { AgentProcessManager, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, listRegisteredHarnesses, registerHarness };
|
|
593
|
-
export type {
|
|
474
|
+
export { AgentAdapter, AgentAdapterConfig, AgentCommand$1 as AgentCommand, AgentEvent, AgentProcessManager, AgentStatus, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, listRegisteredHarnesses, registerHarness };
|
|
475
|
+
export type { AgentProcessConfig, ManagedSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { AgentClient } from '@skaile/workspaces/sdk/client';
|
|
3
|
-
import { AgentCommand
|
|
3
|
+
import { AgentCommand, AgentEvent as AgentEvent$1, MessageV2 } from '@skaile/workspaces/sdk/types';
|
|
4
4
|
import { AIProviderRegistryView } from '@skaile/forge-settings/server';
|
|
5
|
+
import { a as AgentAdapter, b as AgentAdapterConfig, c as AgentCommand$1, A as AgentEvent, d as AgentStatus } from './shared/forge-agent-runtime.DlNAoPjs.js';
|
|
5
6
|
import { SubscriberTransport, SessionDispatcher, MessageStore } from '@skaile/workspaces/sdk/session';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -118,7 +119,7 @@ declare class AgentProcessManager extends EventEmitter {
|
|
|
118
119
|
* Send any AgentCommand to the managed process.
|
|
119
120
|
* Used internally by ProcessManagerClientTransport.
|
|
120
121
|
*/
|
|
121
|
-
sendCommand(id: string, command: AgentCommand
|
|
122
|
+
sendCommand(id: string, command: AgentCommand): void;
|
|
122
123
|
/**
|
|
123
124
|
* Create an AgentClient for a managed session.
|
|
124
125
|
* Uses ProcessManagerClientTransport so there is no second subscription
|
|
@@ -133,125 +134,6 @@ declare class AgentProcessManager extends EventEmitter {
|
|
|
133
134
|
private waitForReady;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
/**
|
|
137
|
-
* AgentAdapter — canonical interface for forge agent harnesses.
|
|
138
|
-
*
|
|
139
|
-
* Every harness (omp, claude-sdk, codex, …) runs behind an adapter that
|
|
140
|
-
* implements this interface. Apps depend only on this contract, not the
|
|
141
|
-
* concrete adapter type.
|
|
142
|
-
*
|
|
143
|
-
* Lifecycle:
|
|
144
|
-
* 1. Call `connect(config)` — spawns the subprocess or initialises the SDK client.
|
|
145
|
-
* 2. Call `sendCommand(cmd)` to dispatch prompts and control commands.
|
|
146
|
-
* 3. Call `listen()` to consume the async event stream.
|
|
147
|
-
* 4. Call `abort()` to cancel an in-flight turn.
|
|
148
|
-
* 5. Call `disconnect()` to tear down cleanly.
|
|
149
|
-
*
|
|
150
|
-
* Adapters are STATEFUL: one instance per active agent session.
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/** Input to the agent: a natural-language prompt or a control message. */
|
|
154
|
-
interface AgentCommand {
|
|
155
|
-
type: string;
|
|
156
|
-
[key: string]: unknown;
|
|
157
|
-
}
|
|
158
|
-
/** Output from the agent: any typed event from the skaile protocol. */
|
|
159
|
-
interface AgentEvent {
|
|
160
|
-
type: string;
|
|
161
|
-
[key: string]: unknown;
|
|
162
|
-
}
|
|
163
|
-
/** Observable lifecycle state of an adapter instance. */
|
|
164
|
-
type AgentStatus = "idle" | "running" | "error" | "disconnected";
|
|
165
|
-
/**
|
|
166
|
-
* Configuration passed to `AgentAdapter.connect()`.
|
|
167
|
-
*
|
|
168
|
-
* All fields mirror `AgentProcessConfig` from `agent-process.ts`
|
|
169
|
-
* so the ProcessManagerAdapter can pass them through unchanged.
|
|
170
|
-
*/
|
|
171
|
-
interface AgentAdapterConfig {
|
|
172
|
-
/** Working directory for the agent (--project-dir) */
|
|
173
|
-
projectDir: string;
|
|
174
|
-
/** Bridge harness type (omp, claude-sdk). Defaults to 'omp'. */
|
|
175
|
-
harness?: string;
|
|
176
|
-
/**
|
|
177
|
-
* The AI provider registry the session runs against. The adapter resolves
|
|
178
|
-
* each enabled entry's credential reference and delivers it through the
|
|
179
|
-
* child environment.
|
|
180
|
-
*/
|
|
181
|
-
registry?: AIProviderRegistryView;
|
|
182
|
-
/**
|
|
183
|
-
* Registry entry ids the session is restricted to (`--providers a,b`).
|
|
184
|
-
* Absent or empty: the session sees the whole registry. `registry` should
|
|
185
|
-
* already be narrowed to the same ids so only their credentials are delivered.
|
|
186
|
-
*/
|
|
187
|
-
providers?: string[];
|
|
188
|
-
/**
|
|
189
|
-
* The layered environment `env:` references resolve against and the child
|
|
190
|
-
* env is based on; defaults to `process.env`.
|
|
191
|
-
*/
|
|
192
|
-
credentialEnv?: Record<string, string | undefined>;
|
|
193
|
-
/** Model selection as `"<providerId>/<modelId>"`, a bare model id, or `@role` */
|
|
194
|
-
model?: string;
|
|
195
|
-
/** Environment variables injected into the subprocess */
|
|
196
|
-
env?: Record<string, string>;
|
|
197
|
-
/** System prompt written to .skaile/system-prompt.md before spawn */
|
|
198
|
-
systemPrompt?: string;
|
|
199
|
-
/** Max agentic turns */
|
|
200
|
-
maxTurns?: number;
|
|
201
|
-
/** GitAgent definition directory */
|
|
202
|
-
agentDir?: string;
|
|
203
|
-
/** OMP harness session ID for native resume */
|
|
204
|
-
harnessSessionId?: string;
|
|
205
|
-
/** Address the subprocess binds and the client dials. Absent: runtime default bind, dial `127.0.0.1`. */
|
|
206
|
-
host?: string;
|
|
207
|
-
/** Bearer token the subprocess WebSocket requires and the client presents. Absent: no authentication. */
|
|
208
|
-
wsAuthToken?: string;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Canonical interface for all forge agent harnesses.
|
|
212
|
-
*
|
|
213
|
-
* Implementations wrap the `AgentProcessManager` pattern used by the existing
|
|
214
|
-
* forge apps, exposing a minimal async API that higher-level managers consume.
|
|
215
|
-
*/
|
|
216
|
-
interface AgentAdapter {
|
|
217
|
-
/**
|
|
218
|
-
* Connect to the agent harness and prepare it for commands.
|
|
219
|
-
* Must be called once before `sendCommand` or `listen`.
|
|
220
|
-
*/
|
|
221
|
-
connect(config: AgentAdapterConfig): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Send a command to the connected agent.
|
|
224
|
-
* Throws if `connect()` has not been called or the session has disconnected.
|
|
225
|
-
*/
|
|
226
|
-
sendCommand(command: AgentCommand): Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* Return an async iterable of agent events.
|
|
229
|
-
* The iterable completes when the adapter disconnects.
|
|
230
|
-
*
|
|
231
|
-
* Callers can use `for await (const event of adapter.listen()) { ... }` or
|
|
232
|
-
* subscribe via an EventEmitter bridge (see BaseAgentManager).
|
|
233
|
-
*/
|
|
234
|
-
listen(): AsyncIterable<AgentEvent>;
|
|
235
|
-
/**
|
|
236
|
-
* Cancel the current in-flight agent turn.
|
|
237
|
-
* No-op if the agent is idle.
|
|
238
|
-
*/
|
|
239
|
-
abort(): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* Whether the adapter is connected and the agent is ready to receive commands.
|
|
242
|
-
*/
|
|
243
|
-
isConnected(): boolean;
|
|
244
|
-
/**
|
|
245
|
-
* Observable lifecycle state.
|
|
246
|
-
*/
|
|
247
|
-
getStatus(): AgentStatus;
|
|
248
|
-
/**
|
|
249
|
-
* Tear down the adapter: disconnect, stop subprocess if applicable, release resources.
|
|
250
|
-
* Safe to call multiple times.
|
|
251
|
-
*/
|
|
252
|
-
disconnect(): Promise<void>;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
137
|
/**
|
|
256
138
|
* ProcessManagerAdapter — AgentAdapter implementation backed by AgentProcessManager.
|
|
257
139
|
*
|
|
@@ -268,7 +150,7 @@ declare class ProcessManagerAdapter implements AgentAdapter {
|
|
|
268
150
|
private status;
|
|
269
151
|
constructor();
|
|
270
152
|
connect(config: AgentAdapterConfig): Promise<void>;
|
|
271
|
-
sendCommand(command: AgentCommand): Promise<void>;
|
|
153
|
+
sendCommand(command: AgentCommand$1): Promise<void>;
|
|
272
154
|
listen(): AsyncIterable<AgentEvent>;
|
|
273
155
|
abort(): Promise<void>;
|
|
274
156
|
isConnected(): boolean;
|
|
@@ -589,5 +471,5 @@ declare class FanoutTransport {
|
|
|
589
471
|
get subscriberCount(): number;
|
|
590
472
|
}
|
|
591
473
|
|
|
592
|
-
export { AgentProcessManager, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, listRegisteredHarnesses, registerHarness };
|
|
593
|
-
export type {
|
|
474
|
+
export { AgentAdapter, AgentAdapterConfig, AgentCommand$1 as AgentCommand, AgentEvent, AgentProcessManager, AgentStatus, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, listRegisteredHarnesses, registerHarness };
|
|
475
|
+
export type { AgentProcessConfig, ManagedSession };
|