@rowan-agent/agent 0.19.2 → 0.20.1
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 +822 -808
- package/dist/index.js +63 -14
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,60 +1,53 @@
|
|
|
1
1
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
2
|
-
import { LlmContentPart, ModelRef,
|
|
2
|
+
import { ContentBlock, LlmContentPart, ModelRef, ScopeRef, ToolCallStatus, JsonValue as JsonValue$1, ToolProgress, ToolCallContent, ToolCallLocation, JsonObject as JsonObject$1, ToolKind, ModelConfig, StreamFn, ToolAnnotations, ThinkingLevel, ToolCall as ToolCall$1, ToolCallUpdate } from '@rowan-agent/models';
|
|
3
3
|
export { ModelConfig, ModelRef, ProviderCallContext, ProviderConfig, ProviderModelConfig, ProviderStreamFn, ScopeRef, StreamFn, ThinkingLevel, ToolAnnotations, ToolCall, ToolCallContent, ToolCallLocation, ToolCallOptions, ToolCallOutcome, ToolCallStatus, ToolCallUpdate, ToolDefinitionSummary, ToolKind, ToolProgress } from '@rowan-agent/models';
|
|
4
4
|
import Type from 'typebox';
|
|
5
5
|
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
metadata?: Record<string, unknown> & {
|
|
12
|
-
phase?: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
type Skill = {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
/** Absolute path to the SKILL.md file */
|
|
19
|
-
filePath: string;
|
|
20
|
-
/** Directory containing the SKILL.md file */
|
|
21
|
-
baseDir: string;
|
|
22
|
-
/** Full body content of the SKILL.md (after frontmatter) */
|
|
23
|
-
content: string;
|
|
24
|
-
/** Do not automatically inject this Skill into the model Context. */
|
|
25
|
-
disableAutoInvocation?: boolean;
|
|
26
|
-
/** Do not expose this Skill to direct user invocation. */
|
|
27
|
-
disableImplicitInvocation?: boolean;
|
|
28
|
-
/** @deprecated Use disableAutoInvocation; kept only for old in-memory callers during cutover. */
|
|
29
|
-
disableModelInvocation?: boolean;
|
|
6
|
+
type ModelInvokeOutput = {
|
|
7
|
+
text: string;
|
|
8
|
+
contentBlocks: ContentBlock[];
|
|
9
|
+
toolCalls: ToolCall[];
|
|
10
|
+
stopReason?: string;
|
|
30
11
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
12
|
+
/** Snapshot of phase-level context for restore */
|
|
13
|
+
type PhaseContextSnapshot = {
|
|
14
|
+
systemPrompt: string;
|
|
15
|
+
messages: AgentMessage[];
|
|
16
|
+
currentPhase: string;
|
|
17
|
+
availablePhases: string[];
|
|
18
|
+
turnNumber: number;
|
|
36
19
|
payload?: unknown;
|
|
37
|
-
toolResults?: Array<{
|
|
38
|
-
toolCallId: string;
|
|
39
|
-
toolName: string;
|
|
40
|
-
ok: boolean;
|
|
41
|
-
content: unknown;
|
|
42
|
-
error?: string;
|
|
43
|
-
}>;
|
|
44
20
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
21
|
+
/** Execution capabilities for a phase — operates on PhaseContext. */
|
|
22
|
+
type PhaseExecution = {
|
|
23
|
+
snapshot(): PhaseContextSnapshot;
|
|
24
|
+
restore(snapshot: PhaseContextSnapshot): void;
|
|
25
|
+
invokeModel(context: PhaseContext, options?: {
|
|
26
|
+
output?: "reply" | "internal";
|
|
27
|
+
}): Promise<ModelInvokeOutput>;
|
|
28
|
+
reportStatus(status: PhaseStatus): Promise<void>;
|
|
29
|
+
executeTool(context: AgentContext, toolCall: ToolCall): Promise<ToolResult>;
|
|
30
|
+
executeTools(context: AgentContext, toolCalls: readonly ToolCall[], contentBlocks?: readonly ContentBlock[]): Promise<readonly ToolResult[]>;
|
|
31
|
+
interaction: RunInteractionDriver;
|
|
32
|
+
/** Message lifecycle manager for streaming updates from programmatic phases */
|
|
33
|
+
messages: PhaseMessageManager;
|
|
49
34
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
35
|
+
/** Message lifecycle manager for streaming updates */
|
|
36
|
+
type PhaseMessageManager = {
|
|
37
|
+
/** Get all visible messages in the transcript */
|
|
38
|
+
visible(): AgentMessage[];
|
|
39
|
+
/** Reserve the eventual message identity before stream deltas arrive. */
|
|
40
|
+
reserve(role: "assistant" | "tool", metadata?: Record<string, unknown>): string;
|
|
41
|
+
/** Start a new message stream, returns message id */
|
|
42
|
+
start(role: "assistant" | "tool", content: AgentMessage["content"], metadata?: Record<string, unknown>): string;
|
|
43
|
+
/** Stream a text delta */
|
|
44
|
+
update(messageId: string, delta: string): Promise<void>;
|
|
45
|
+
/** Replace the active message content with model-native content parts */
|
|
46
|
+
replaceContent(messageId: string, content: string | LlmContentPart[]): void;
|
|
47
|
+
/** End the message stream, appends to transcript */
|
|
48
|
+
end(messageId: string): Promise<void>;
|
|
49
|
+
/** Drop an unstarted stream that produced no content. */
|
|
50
|
+
discard(messageId: string): void;
|
|
58
51
|
};
|
|
59
52
|
|
|
60
53
|
type PhaseRegistrySelection = Readonly<{
|
|
@@ -161,261 +154,45 @@ declare class ResourceRegistry {
|
|
|
161
154
|
private nextRevision;
|
|
162
155
|
}
|
|
163
156
|
|
|
164
|
-
type ModelInvokeOutput = {
|
|
165
|
-
text: string;
|
|
166
|
-
contentBlocks: ContentBlock[];
|
|
167
|
-
toolCalls: ToolCall[];
|
|
168
|
-
stopReason?: string;
|
|
169
|
-
};
|
|
170
|
-
/** Snapshot of phase-level context for restore */
|
|
171
|
-
type PhaseContextSnapshot = {
|
|
172
|
-
systemPrompt: string;
|
|
173
|
-
messages: AgentMessage[];
|
|
174
|
-
currentPhase: string;
|
|
175
|
-
availablePhases: string[];
|
|
176
|
-
turnNumber: number;
|
|
177
|
-
payload?: unknown;
|
|
178
|
-
};
|
|
179
|
-
/** Execution capabilities for a phase — operates on PhaseContext. */
|
|
180
|
-
type PhaseExecution = {
|
|
181
|
-
snapshot(): PhaseContextSnapshot;
|
|
182
|
-
restore(snapshot: PhaseContextSnapshot): void;
|
|
183
|
-
invokeModel(context: PhaseContext, options?: {
|
|
184
|
-
output?: "reply" | "internal";
|
|
185
|
-
}): Promise<ModelInvokeOutput>;
|
|
186
|
-
reportStatus(status: PhaseStatus): Promise<void>;
|
|
187
|
-
executeTool(context: AgentContext, toolCall: ToolCall): Promise<ToolResult>;
|
|
188
|
-
executeTools(context: AgentContext, toolCalls: readonly ToolCall[], contentBlocks?: readonly ContentBlock[]): Promise<readonly ToolResult[]>;
|
|
189
|
-
interaction: RunInteractionDriver;
|
|
190
|
-
/** Message lifecycle manager for streaming updates from programmatic phases */
|
|
191
|
-
messages: PhaseMessageManager;
|
|
192
|
-
};
|
|
193
|
-
/** Message lifecycle manager for streaming updates */
|
|
194
|
-
type PhaseMessageManager = {
|
|
195
|
-
/** Get all visible messages in the transcript */
|
|
196
|
-
visible(): AgentMessage[];
|
|
197
|
-
/** Reserve the eventual message identity before stream deltas arrive. */
|
|
198
|
-
reserve(role: "assistant" | "tool", metadata?: Record<string, unknown>): string;
|
|
199
|
-
/** Start a new message stream, returns message id */
|
|
200
|
-
start(role: "assistant" | "tool", content: AgentMessage["content"], metadata?: Record<string, unknown>): string;
|
|
201
|
-
/** Stream a text delta */
|
|
202
|
-
update(messageId: string, delta: string): Promise<void>;
|
|
203
|
-
/** Replace the active message content with model-native content parts */
|
|
204
|
-
replaceContent(messageId: string, content: string | LlmContentPart[]): void;
|
|
205
|
-
/** End the message stream, appends to transcript */
|
|
206
|
-
end(messageId: string): Promise<void>;
|
|
207
|
-
/** Drop an unstarted stream that produced no content. */
|
|
208
|
-
discard(messageId: string): void;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
type HostContribution = {
|
|
212
|
-
readonly kind: string;
|
|
213
|
-
readonly id: string;
|
|
214
|
-
} & {
|
|
215
|
-
readonly [key: string]: JsonValue;
|
|
216
|
-
};
|
|
217
|
-
interface ExtensionStateStore {
|
|
218
|
-
get(key: string): Promise<JsonValue | undefined>;
|
|
219
|
-
set(key: string, value: JsonValue): Promise<void>;
|
|
220
|
-
delete(key: string): Promise<void>;
|
|
221
|
-
}
|
|
222
|
-
interface ExtensionHost {
|
|
223
|
-
getConfig(extensionId: string, scope?: ScopeRef): Promise<JsonObject | null> | JsonObject | null;
|
|
224
|
-
onConfigChanged?(listener: (extensionId: string, scope: ScopeRef) => void): (() => void) | void;
|
|
225
|
-
getAgentState(extensionId: string, agentId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
226
|
-
setAgentState(extensionId: string, agentId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
227
|
-
deleteAgentState(extensionId: string, agentId: string, key: string): Promise<void> | void;
|
|
228
|
-
getGlobalState(extensionId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
229
|
-
setGlobalState(extensionId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
230
|
-
deleteGlobalState(extensionId: string, key: string): Promise<void> | void;
|
|
231
|
-
}
|
|
232
|
-
type ExtensionToolContribution = {
|
|
233
|
-
kind: "tool";
|
|
234
|
-
name: string;
|
|
235
|
-
description: string;
|
|
236
|
-
};
|
|
237
|
-
type ExtensionCapabilityContribution = ExtensionToolContribution;
|
|
238
|
-
type ExtensionCapability = {
|
|
239
|
-
extensionId: string;
|
|
240
|
-
kind: "tool";
|
|
241
|
-
name: string;
|
|
242
|
-
description: string;
|
|
243
|
-
};
|
|
244
|
-
interface SourceInfo {
|
|
245
|
-
source: string;
|
|
246
|
-
baseDir?: string;
|
|
247
|
-
displayName?: string;
|
|
248
|
-
}
|
|
249
|
-
/** Register a Phase by directory path or Phase object; PHASE.md and direct child Skills are loaded atomically when a path is supplied. */
|
|
250
|
-
type PhaseRegistration = string | Phase;
|
|
251
157
|
/**
|
|
252
|
-
*
|
|
158
|
+
* EventBus — simple pub/sub for inter-extension communication.
|
|
159
|
+
*
|
|
160
|
+
* Extensions can emit and subscribe to arbitrary events via `api.events`.
|
|
161
|
+
* This allows extensions to coordinate without direct coupling.
|
|
253
162
|
*
|
|
254
163
|
* @example
|
|
255
164
|
* ```typescript
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
* parameters: { type: "object", properties: { query: { type: "string" } } },
|
|
260
|
-
* execute: async (args, ctx) => {
|
|
261
|
-
* return { content: [{ type: "text", text: "result" }] };
|
|
262
|
-
* },
|
|
165
|
+
* // Extension A
|
|
166
|
+
* api.events.on("my-plugin:ready", (data) => {
|
|
167
|
+
* console.log("Plugin ready:", data);
|
|
263
168
|
* });
|
|
169
|
+
*
|
|
170
|
+
* // Extension B
|
|
171
|
+
* api.events.emit("my-plugin:ready", { version: "1.0" });
|
|
264
172
|
* ```
|
|
265
173
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
annotations?: ToolAnnotations;
|
|
279
|
-
_meta?: JsonObject;
|
|
280
|
-
present?: (call: {
|
|
281
|
-
status: ToolCallStatus;
|
|
282
|
-
args: JsonValue;
|
|
283
|
-
progress?: ToolProgress;
|
|
284
|
-
result?: ToolExecutionResult;
|
|
285
|
-
}) => {
|
|
286
|
-
title?: string;
|
|
287
|
-
content?: ToolCallContent[];
|
|
288
|
-
locations?: ToolCallLocation[];
|
|
289
|
-
_meta?: JsonObject;
|
|
290
|
-
} | undefined | void | Promise<{
|
|
291
|
-
title?: string;
|
|
292
|
-
content?: ToolCallContent[];
|
|
293
|
-
locations?: ToolCallLocation[];
|
|
294
|
-
_meta?: JsonObject;
|
|
295
|
-
} | undefined | void>;
|
|
296
|
-
/** Execute the tool */
|
|
297
|
-
execute: (args: unknown, context: ToolInvocationContext, signal?: AbortSignal) => Promise<ToolExecutionResult>;
|
|
298
|
-
/** Optional: per-tool execution mode override */
|
|
299
|
-
executionMode?: "sequential" | "parallel";
|
|
174
|
+
type Listener = (...args: unknown[]) => void;
|
|
175
|
+
interface EventBus {
|
|
176
|
+
/** Subscribe to an event. Returns unsubscribe function. */
|
|
177
|
+
on(event: string, listener: Listener): () => void;
|
|
178
|
+
/** Emit an event to all subscribers. */
|
|
179
|
+
emit(event: string, ...args: unknown[]): void;
|
|
180
|
+
/** Remove all listeners for an event, or all listeners if no event specified. */
|
|
181
|
+
off(event?: string): void;
|
|
182
|
+
/** Check if there are listeners for an event. */
|
|
183
|
+
has(event: string): boolean;
|
|
184
|
+
/** Get listener count for an event. */
|
|
185
|
+
count(event: string): number;
|
|
300
186
|
}
|
|
301
187
|
|
|
302
188
|
/**
|
|
303
|
-
*
|
|
189
|
+
* @module extensions/context
|
|
190
|
+
*
|
|
191
|
+
* Extension context types — runtime state and phase execution context.
|
|
192
|
+
*
|
|
193
|
+
* For ExtensionAPI and createExtensionAPI, see ./api.ts
|
|
304
194
|
*/
|
|
305
|
-
|
|
306
|
-
definition: ToolDefinition;
|
|
307
|
-
sourceInfo: SourceInfo;
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Structured extension error with attribution.
|
|
311
|
-
*/
|
|
312
|
-
interface ExtensionError {
|
|
313
|
-
/** Path of the extension that caused the error */
|
|
314
|
-
extensionPath: string;
|
|
315
|
-
/** Event or operation that caused the error */
|
|
316
|
-
event: string;
|
|
317
|
-
/** Error message */
|
|
318
|
-
error: string;
|
|
319
|
-
/** Optional stack trace */
|
|
320
|
-
stack?: string;
|
|
321
|
-
}
|
|
322
|
-
/** Error listener callback type. */
|
|
323
|
-
type ExtensionErrorListener = (error: ExtensionError) => void;
|
|
324
|
-
type ExecOptions = {
|
|
325
|
-
/** Working directory for the command. Defaults to cwd passed to runtime. */
|
|
326
|
-
cwd?: string;
|
|
327
|
-
/** Environment variables to add/override. */
|
|
328
|
-
env?: Record<string, string>;
|
|
329
|
-
/** Timeout in milliseconds. */
|
|
330
|
-
timeout?: number;
|
|
331
|
-
/** AbortSignal for cancellation. */
|
|
332
|
-
signal?: AbortSignal;
|
|
333
|
-
};
|
|
334
|
-
type ExecResult = {
|
|
335
|
-
exitCode: number;
|
|
336
|
-
stdout: string;
|
|
337
|
-
stderr: string;
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Shared runtime state created by loader, used during registration and runtime.
|
|
341
|
-
* All ExtensionAPI instances reference this shared state.
|
|
342
|
-
*
|
|
343
|
-
* It only owns the lifetime guard shared by captured Extension API objects.
|
|
344
|
-
*/
|
|
345
|
-
interface ExtensionRuntime {
|
|
346
|
-
/** Throws when this extension instance is stale after runtime replacement. */
|
|
347
|
-
assertActive: () => void;
|
|
348
|
-
/** Marks this extension instance as stale after runtime replacement or reload. */
|
|
349
|
-
invalidate: (message?: string) => void;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Result of loading extensions from filesystem.
|
|
353
|
-
* The runner takes these and creates Extension tracking objects.
|
|
354
|
-
*/
|
|
355
|
-
type LoadExtensionsResult = {
|
|
356
|
-
extensions: LoadedExtension[];
|
|
357
|
-
errors: Array<{
|
|
358
|
-
path: string;
|
|
359
|
-
error: string;
|
|
360
|
-
}>;
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
363
|
-
* Pre-initialization extension form — factory + metadata.
|
|
364
|
-
* Runner.loadExtensions() calls the factory and creates the full Extension object.
|
|
365
|
-
*/
|
|
366
|
-
interface LoadedExtension {
|
|
367
|
-
id?: string;
|
|
368
|
-
path: string;
|
|
369
|
-
name: string;
|
|
370
|
-
factory: ExtensionFactory;
|
|
371
|
-
manifest?: ExtensionManifest;
|
|
372
|
-
}
|
|
373
|
-
/** Extension manifest from package.json `rowan` field. */
|
|
374
|
-
interface ExtensionManifest {
|
|
375
|
-
id?: string;
|
|
376
|
-
entry?: string;
|
|
377
|
-
name?: string;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* EventBus — simple pub/sub for inter-extension communication.
|
|
382
|
-
*
|
|
383
|
-
* Extensions can emit and subscribe to arbitrary events via `api.events`.
|
|
384
|
-
* This allows extensions to coordinate without direct coupling.
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```typescript
|
|
388
|
-
* // Extension A
|
|
389
|
-
* api.events.on("my-plugin:ready", (data) => {
|
|
390
|
-
* console.log("Plugin ready:", data);
|
|
391
|
-
* });
|
|
392
|
-
*
|
|
393
|
-
* // Extension B
|
|
394
|
-
* api.events.emit("my-plugin:ready", { version: "1.0" });
|
|
395
|
-
* ```
|
|
396
|
-
*/
|
|
397
|
-
type Listener = (...args: unknown[]) => void;
|
|
398
|
-
interface EventBus {
|
|
399
|
-
/** Subscribe to an event. Returns unsubscribe function. */
|
|
400
|
-
on(event: string, listener: Listener): () => void;
|
|
401
|
-
/** Emit an event to all subscribers. */
|
|
402
|
-
emit(event: string, ...args: unknown[]): void;
|
|
403
|
-
/** Remove all listeners for an event, or all listeners if no event specified. */
|
|
404
|
-
off(event?: string): void;
|
|
405
|
-
/** Check if there are listeners for an event. */
|
|
406
|
-
has(event: string): boolean;
|
|
407
|
-
/** Get listener count for an event. */
|
|
408
|
-
count(event: string): number;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* @module extensions/context
|
|
413
|
-
*
|
|
414
|
-
* Extension context types — runtime state and phase execution context.
|
|
415
|
-
*
|
|
416
|
-
* For ExtensionAPI and createExtensionAPI, see ./api.ts
|
|
417
|
-
*/
|
|
418
|
-
|
|
195
|
+
|
|
419
196
|
/**
|
|
420
197
|
* Runtime context available to extensions during event handler execution.
|
|
421
198
|
*
|
|
@@ -499,107 +276,6 @@ interface ExtensionUtils {
|
|
|
499
276
|
formatJson(value: unknown): string;
|
|
500
277
|
}
|
|
501
278
|
|
|
502
|
-
/**
|
|
503
|
-
* Extension API object passed to extension factory function.
|
|
504
|
-
*
|
|
505
|
-
* @example
|
|
506
|
-
* ```typescript
|
|
507
|
-
* export default function(api: ExtensionAPI) {
|
|
508
|
-
* // api provides all extension APIs
|
|
509
|
-
* }
|
|
510
|
-
* ```
|
|
511
|
-
*/
|
|
512
|
-
interface ExtensionAPI {
|
|
513
|
-
/** Hook events — subscribe or unsubscribe. */
|
|
514
|
-
hooks: {
|
|
515
|
-
/**
|
|
516
|
-
* Subscribe to a hook event.
|
|
517
|
-
*
|
|
518
|
-
* @param eventType - Hook type, e.g. "before_tool_call"
|
|
519
|
-
* @param handler - Hook handler, can return result to modify behavior
|
|
520
|
-
*/
|
|
521
|
-
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
522
|
-
/** Unsubscribe from a hook event. */
|
|
523
|
-
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
524
|
-
};
|
|
525
|
-
/** Extension configuration — read own layered config or listen for changes. */
|
|
526
|
-
config: {
|
|
527
|
-
/** Get the extension's own effective configuration block. */
|
|
528
|
-
get(scope?: ScopeRef): Promise<JsonObject | null>;
|
|
529
|
-
/** Listen for configuration changes for a scope. */
|
|
530
|
-
changed(handler: (scope: ScopeRef) => void): void;
|
|
531
|
-
};
|
|
532
|
-
/** Extension state — scoped to run (in-memory) or agent (durable) or global (durable). */
|
|
533
|
-
state: {
|
|
534
|
-
/** Run-scoped in-memory state; dropped when the Run ends. */
|
|
535
|
-
run(runId: string): ExtensionStateStore;
|
|
536
|
-
/** Agent-scoped durable state; persisted with the Agent record. */
|
|
537
|
-
agent(agentId: string): ExtensionStateStore;
|
|
538
|
-
/** Extension-scoped durable state; survives process restarts. */
|
|
539
|
-
global(): ExtensionStateStore;
|
|
540
|
-
};
|
|
541
|
-
/** Tool capabilities — register and unregister custom tools. */
|
|
542
|
-
tools: {
|
|
543
|
-
/** Register a custom LLM-callable tool. */
|
|
544
|
-
register(tool: ToolDefinition): void;
|
|
545
|
-
/** Unregister a previously registered tool by name. */
|
|
546
|
-
unregister(toolName: string): void;
|
|
547
|
-
};
|
|
548
|
-
/** Capability contributions — advertise tools or features to the host. */
|
|
549
|
-
capabilities: {
|
|
550
|
-
/** Contribute a capability to the host. Returns a disposer to remove the contribution. */
|
|
551
|
-
contribute(contribution: ExtensionCapabilityContribution): () => void;
|
|
552
|
-
};
|
|
553
|
-
/** Model provider registration. */
|
|
554
|
-
providers: {
|
|
555
|
-
/** Register a model provider. Registering with an existing id replaces it. */
|
|
556
|
-
register(config: _rowan_agent_models.ProviderConfig): void;
|
|
557
|
-
/** Unregister a model provider by id. */
|
|
558
|
-
unregister(id: string): void;
|
|
559
|
-
};
|
|
560
|
-
/** Phase execution capabilities — provides Phase In/Out, phase identity, phase routing, and registration. */
|
|
561
|
-
phases: {
|
|
562
|
-
/** Register a Phase directory bundle or Phase object. */
|
|
563
|
-
register(phase: PhaseRegistration): Promise<void>;
|
|
564
|
-
/** Unregister a previously registered phase by name. */
|
|
565
|
-
unregister(phaseName: string): void;
|
|
566
|
-
/** Phase In: get payload from previous phase */
|
|
567
|
-
getPayload(): unknown;
|
|
568
|
-
/** Phase Out: set payload for next phase */
|
|
569
|
-
setPayload(payload: unknown): void;
|
|
570
|
-
/** Phase Out: set outcome message */
|
|
571
|
-
setMessage(message: string): void;
|
|
572
|
-
/** Get current phase name */
|
|
573
|
-
getCurrentPhase(): string;
|
|
574
|
-
/** Set next phase (lower priority than PHASE.md target) */
|
|
575
|
-
setNextPhase(phaseName: string): void;
|
|
576
|
-
/** Get the next phase set by setNextPhase */
|
|
577
|
-
getNextPhase(): string | undefined;
|
|
578
|
-
/** Get the message set by setMessage */
|
|
579
|
-
getMessage(): string | undefined;
|
|
580
|
-
};
|
|
581
|
-
/** Declarative host contributions. */
|
|
582
|
-
host: {
|
|
583
|
-
/** Contribute a declarative declaration to the host. Returns a disposer to remove the contribution. */
|
|
584
|
-
contribute<T extends HostContribution>(contribution: T): () => void;
|
|
585
|
-
};
|
|
586
|
-
/** Extension manifest from package.json `rowan` field. */
|
|
587
|
-
manifest?: ExtensionManifest;
|
|
588
|
-
/** Utility functions. */
|
|
589
|
-
utils: ExtensionUtils;
|
|
590
|
-
/** Runtime context — cwd, signal, exec, message access, etc. */
|
|
591
|
-
context: ExtensionContext;
|
|
592
|
-
/** Shared event bus for inter-extension communication. */
|
|
593
|
-
events: EventBus;
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Extension factory function.
|
|
597
|
-
* Receives ExtensionAPI for registering hooks, phases, and providers.
|
|
598
|
-
*/
|
|
599
|
-
type ExtensionDisposer = () => void | Promise<void>;
|
|
600
|
-
type ExtensionFactoryResult = void | ExtensionDisposer;
|
|
601
|
-
type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<ExtensionFactoryResult>;
|
|
602
|
-
|
|
603
279
|
declare class InMemoryExtensionHost implements ExtensionHost {
|
|
604
280
|
private readonly configs;
|
|
605
281
|
private readonly agentState;
|
|
@@ -983,6 +659,7 @@ type UserInput = string | Readonly<{
|
|
|
983
659
|
content: UserContent;
|
|
984
660
|
metadata?: Metadata;
|
|
985
661
|
thinkingLevel?: ThinkingLevel;
|
|
662
|
+
providerOptions?: JsonObject;
|
|
986
663
|
}>;
|
|
987
664
|
type HistorySeed = readonly Message[];
|
|
988
665
|
type ContextStatus = Readonly<{
|
|
@@ -1052,10 +729,6 @@ type Tool$1 = Readonly<{
|
|
|
1052
729
|
} | undefined | void>;
|
|
1053
730
|
execute(args: JsonValue, context: ToolInvocationContext, signal: AbortSignal): Promise<ToolExecutionResult>;
|
|
1054
731
|
}>;
|
|
1055
|
-
type ContextCandidate = Readonly<{
|
|
1056
|
-
name: string;
|
|
1057
|
-
value: JsonValue;
|
|
1058
|
-
}>;
|
|
1059
732
|
type BeforeToolCallDecision = Readonly<{
|
|
1060
733
|
allow: true;
|
|
1061
734
|
}> | Readonly<{
|
|
@@ -1170,7 +843,7 @@ type RunRecord = Readonly<{
|
|
|
1170
843
|
openInteractions?: readonly RunInteraction[];
|
|
1171
844
|
interactionAnswers?: Readonly<Record<string, JsonValue>>;
|
|
1172
845
|
execution?: ExecutionToken;
|
|
1173
|
-
outcome?: Outcome;
|
|
846
|
+
outcome?: Outcome$1;
|
|
1174
847
|
failure?: RunFailure;
|
|
1175
848
|
cancellationReason?: string;
|
|
1176
849
|
createdAt: string;
|
|
@@ -1242,7 +915,7 @@ type RunSnapshot = RunSnapshotBase & (Readonly<{
|
|
|
1242
915
|
answers: Readonly<Record<string, JsonValue>>;
|
|
1243
916
|
}> | Readonly<{
|
|
1244
917
|
state: "completed";
|
|
1245
|
-
outcome: Outcome;
|
|
918
|
+
outcome: Outcome$1;
|
|
1246
919
|
output?: AssistantMessage;
|
|
1247
920
|
}> | Readonly<{
|
|
1248
921
|
state: "failed";
|
|
@@ -1257,7 +930,7 @@ type RunBoundary = Readonly<{
|
|
|
1257
930
|
answers: Readonly<Record<string, JsonValue>>;
|
|
1258
931
|
}> | Readonly<{
|
|
1259
932
|
type: "completed";
|
|
1260
|
-
outcome: Outcome;
|
|
933
|
+
outcome: Outcome$1;
|
|
1261
934
|
output?: AssistantMessage;
|
|
1262
935
|
}> | Readonly<{
|
|
1263
936
|
type: "failed";
|
|
@@ -1345,6 +1018,7 @@ interface OwnedStore {
|
|
|
1345
1018
|
executionId?: ExecutionId;
|
|
1346
1019
|
messageId?: MessageId;
|
|
1347
1020
|
configToken?: ConfigToken;
|
|
1021
|
+
additionalContexts?: readonly ContextCandidate[];
|
|
1348
1022
|
}): Promise<RunClaim>;
|
|
1349
1023
|
failQueuedRun(input: {
|
|
1350
1024
|
runId: RunId;
|
|
@@ -1386,7 +1060,7 @@ interface OwnedStore {
|
|
|
1386
1060
|
runId: RunId;
|
|
1387
1061
|
execution: ExecutionToken;
|
|
1388
1062
|
expectedRevision: number;
|
|
1389
|
-
outcome?: Outcome;
|
|
1063
|
+
outcome?: Outcome$1;
|
|
1390
1064
|
failure?: RunFailure;
|
|
1391
1065
|
output?: AssistantMessage;
|
|
1392
1066
|
}): Promise<RunRecord>;
|
|
@@ -1457,6 +1131,7 @@ interface OwnedStore {
|
|
|
1457
1131
|
execution?: ExecutionToken;
|
|
1458
1132
|
update: ToolCall$1 | ToolCallUpdate;
|
|
1459
1133
|
external?: boolean;
|
|
1134
|
+
contentIndex?: number;
|
|
1460
1135
|
}): Promise<DurableRunEvent>;
|
|
1461
1136
|
snapshotRun(runId: RunId): Promise<RunSnapshot>;
|
|
1462
1137
|
history(agentId: AgentId): Promise<readonly Message[]>;
|
|
@@ -1600,48 +1275,656 @@ type ConsumerRegistration = Readonly<{
|
|
|
1600
1275
|
waterline: EventCursor;
|
|
1601
1276
|
}>;
|
|
1602
1277
|
|
|
1603
|
-
type
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
};
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1278
|
+
type HostContribution = {
|
|
1279
|
+
readonly kind: string;
|
|
1280
|
+
readonly id: string;
|
|
1281
|
+
} & {
|
|
1282
|
+
readonly [key: string]: JsonValue;
|
|
1283
|
+
};
|
|
1284
|
+
interface ExtensionStateStore {
|
|
1285
|
+
get(key: string): Promise<JsonValue | undefined>;
|
|
1286
|
+
set(key: string, value: JsonValue): Promise<void>;
|
|
1287
|
+
delete(key: string): Promise<void>;
|
|
1288
|
+
}
|
|
1289
|
+
interface ExtensionHost {
|
|
1290
|
+
getConfig(extensionId: string, scope?: ScopeRef): Promise<JsonObject | null> | JsonObject | null;
|
|
1291
|
+
onConfigChanged?(listener: (extensionId: string, scope: ScopeRef) => void): (() => void) | void;
|
|
1292
|
+
getAgentState(extensionId: string, agentId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
1293
|
+
setAgentState(extensionId: string, agentId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
1294
|
+
deleteAgentState(extensionId: string, agentId: string, key: string): Promise<void> | void;
|
|
1295
|
+
getGlobalState(extensionId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
1296
|
+
setGlobalState(extensionId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
1297
|
+
deleteGlobalState(extensionId: string, key: string): Promise<void> | void;
|
|
1298
|
+
}
|
|
1299
|
+
type ExtensionToolContribution = {
|
|
1300
|
+
kind: "tool";
|
|
1301
|
+
name: string;
|
|
1302
|
+
description: string;
|
|
1303
|
+
};
|
|
1304
|
+
type ExtensionCapabilityContribution = ExtensionToolContribution;
|
|
1305
|
+
type ExtensionCapability = {
|
|
1306
|
+
extensionId: string;
|
|
1307
|
+
kind: "tool";
|
|
1308
|
+
name: string;
|
|
1309
|
+
description: string;
|
|
1310
|
+
};
|
|
1311
|
+
interface SourceInfo {
|
|
1312
|
+
source: string;
|
|
1313
|
+
baseDir?: string;
|
|
1314
|
+
displayName?: string;
|
|
1315
|
+
}
|
|
1316
|
+
/** Register a Phase by directory path or Phase object; PHASE.md and direct child Skills are loaded atomically when a path is supplied. */
|
|
1317
|
+
type PhaseRegistration = string | Phase;
|
|
1318
|
+
/**
|
|
1319
|
+
* Tool definition for registering LLM-callable tools via `api.tools.register()`.
|
|
1320
|
+
*
|
|
1321
|
+
* @example
|
|
1322
|
+
* ```typescript
|
|
1323
|
+
* api.tools.register({
|
|
1324
|
+
* name: "search_docs",
|
|
1325
|
+
* description: "Search documentation",
|
|
1326
|
+
* parameters: { type: "object", properties: { query: { type: "string" } } },
|
|
1327
|
+
* execute: async (args, ctx) => {
|
|
1328
|
+
* return { content: [{ type: "text", text: "result" }] };
|
|
1329
|
+
* },
|
|
1330
|
+
* });
|
|
1331
|
+
* ```
|
|
1332
|
+
*/
|
|
1333
|
+
interface ToolDefinition {
|
|
1334
|
+
/** Tool name (used in LLM tool calls) */
|
|
1335
|
+
name: string;
|
|
1336
|
+
/** Description for LLM */
|
|
1337
|
+
description: string;
|
|
1338
|
+
/** Parameter schema (JSON Schema) */
|
|
1339
|
+
parameters: Record<string, unknown>;
|
|
1340
|
+
/** Optional: one-line snippet shown in the system prompt tool list */
|
|
1341
|
+
promptSnippet?: string;
|
|
1342
|
+
/** Optional: additional guidelines appended to system prompt */
|
|
1343
|
+
promptGuidelines?: string[];
|
|
1344
|
+
kind?: ToolKind;
|
|
1345
|
+
annotations?: ToolAnnotations;
|
|
1346
|
+
_meta?: JsonObject;
|
|
1347
|
+
present?: (call: {
|
|
1348
|
+
status: ToolCallStatus;
|
|
1349
|
+
args: JsonValue;
|
|
1350
|
+
progress?: ToolProgress;
|
|
1351
|
+
result?: ToolExecutionResult;
|
|
1352
|
+
}) => {
|
|
1353
|
+
title?: string;
|
|
1354
|
+
content?: ToolCallContent[];
|
|
1355
|
+
locations?: ToolCallLocation[];
|
|
1356
|
+
_meta?: JsonObject;
|
|
1357
|
+
} | undefined | void | Promise<{
|
|
1358
|
+
title?: string;
|
|
1359
|
+
content?: ToolCallContent[];
|
|
1360
|
+
locations?: ToolCallLocation[];
|
|
1361
|
+
_meta?: JsonObject;
|
|
1362
|
+
} | undefined | void>;
|
|
1363
|
+
/** Execute the tool */
|
|
1364
|
+
execute: (args: unknown, context: ToolInvocationContext, signal?: AbortSignal) => Promise<ToolExecutionResult>;
|
|
1365
|
+
/** Optional: per-tool execution mode override */
|
|
1366
|
+
executionMode?: "sequential" | "parallel";
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Registered tool with source metadata.
|
|
1371
|
+
*/
|
|
1372
|
+
interface RegisteredTool {
|
|
1373
|
+
definition: ToolDefinition;
|
|
1374
|
+
sourceInfo: SourceInfo;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Structured extension error with attribution.
|
|
1378
|
+
*/
|
|
1379
|
+
interface ExtensionError {
|
|
1380
|
+
/** Path of the extension that caused the error */
|
|
1381
|
+
extensionPath: string;
|
|
1382
|
+
/** Event or operation that caused the error */
|
|
1383
|
+
event: string;
|
|
1384
|
+
/** Error message */
|
|
1385
|
+
error: string;
|
|
1386
|
+
/** Optional stack trace */
|
|
1387
|
+
stack?: string;
|
|
1388
|
+
}
|
|
1389
|
+
/** Error listener callback type. */
|
|
1390
|
+
type ExtensionErrorListener = (error: ExtensionError) => void;
|
|
1391
|
+
type ExecOptions = {
|
|
1392
|
+
/** Working directory for the command. Defaults to cwd passed to runtime. */
|
|
1393
|
+
cwd?: string;
|
|
1394
|
+
/** Environment variables to add/override. */
|
|
1395
|
+
env?: Record<string, string>;
|
|
1396
|
+
/** Timeout in milliseconds. */
|
|
1397
|
+
timeout?: number;
|
|
1398
|
+
/** AbortSignal for cancellation. */
|
|
1399
|
+
signal?: AbortSignal;
|
|
1400
|
+
};
|
|
1401
|
+
type ExecResult = {
|
|
1402
|
+
exitCode: number;
|
|
1403
|
+
stdout: string;
|
|
1404
|
+
stderr: string;
|
|
1405
|
+
};
|
|
1406
|
+
/**
|
|
1407
|
+
* Shared runtime state created by loader, used during registration and runtime.
|
|
1408
|
+
* All ExtensionAPI instances reference this shared state.
|
|
1409
|
+
*
|
|
1410
|
+
* It only owns the lifetime guard shared by captured Extension API objects.
|
|
1411
|
+
*/
|
|
1412
|
+
interface ExtensionRuntime {
|
|
1413
|
+
/** Throws when this extension instance is stale after runtime replacement. */
|
|
1414
|
+
assertActive: () => void;
|
|
1415
|
+
/** Marks this extension instance as stale after runtime replacement or reload. */
|
|
1416
|
+
invalidate: (message?: string) => void;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Result of loading extensions from filesystem.
|
|
1420
|
+
* The runner takes these and creates Extension tracking objects.
|
|
1421
|
+
*/
|
|
1422
|
+
type LoadExtensionsResult = {
|
|
1423
|
+
extensions: LoadedExtension[];
|
|
1424
|
+
errors: Array<{
|
|
1425
|
+
path: string;
|
|
1426
|
+
error: string;
|
|
1427
|
+
}>;
|
|
1428
|
+
};
|
|
1429
|
+
/**
|
|
1430
|
+
* Pre-initialization extension form — factory + metadata.
|
|
1431
|
+
* Runner.loadExtensions() calls the factory and creates the full Extension object.
|
|
1432
|
+
*/
|
|
1433
|
+
interface LoadedExtension {
|
|
1434
|
+
id?: string;
|
|
1435
|
+
path: string;
|
|
1436
|
+
name: string;
|
|
1437
|
+
factory: ExtensionFactory;
|
|
1438
|
+
manifest?: ExtensionManifest;
|
|
1439
|
+
}
|
|
1440
|
+
/** Extension manifest from package.json `rowan` field. */
|
|
1441
|
+
interface ExtensionManifest {
|
|
1442
|
+
id?: string;
|
|
1443
|
+
entry?: string;
|
|
1444
|
+
name?: string;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
/**
|
|
1448
|
+
* Extension API object passed to extension factory function.
|
|
1449
|
+
*
|
|
1450
|
+
* @example
|
|
1451
|
+
* ```typescript
|
|
1452
|
+
* export default function(api: ExtensionAPI) {
|
|
1453
|
+
* // api provides all extension APIs
|
|
1454
|
+
* }
|
|
1455
|
+
* ```
|
|
1456
|
+
*/
|
|
1457
|
+
interface ExtensionAPI {
|
|
1458
|
+
/** Hook events — subscribe or unsubscribe. */
|
|
1459
|
+
hooks: {
|
|
1460
|
+
/**
|
|
1461
|
+
* Subscribe to a hook event.
|
|
1462
|
+
*
|
|
1463
|
+
* @param eventType - Hook type, e.g. "before_tool_call"
|
|
1464
|
+
* @param handler - Hook handler, can return result to modify behavior
|
|
1465
|
+
*/
|
|
1466
|
+
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
1467
|
+
/** Unsubscribe from a hook event. */
|
|
1468
|
+
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
1469
|
+
};
|
|
1470
|
+
/** Extension configuration — read own layered config or listen for changes. */
|
|
1471
|
+
config: {
|
|
1472
|
+
/** Get the extension's own effective configuration block. */
|
|
1473
|
+
get(scope?: ScopeRef): Promise<JsonObject | null>;
|
|
1474
|
+
/** Listen for configuration changes for a scope. */
|
|
1475
|
+
changed(handler: (scope: ScopeRef) => void): void;
|
|
1476
|
+
};
|
|
1477
|
+
/** Extension state — scoped to run (in-memory) or agent (durable) or global (durable). */
|
|
1478
|
+
state: {
|
|
1479
|
+
/** Run-scoped in-memory state; dropped when the Run ends. */
|
|
1480
|
+
run(runId: string): ExtensionStateStore;
|
|
1481
|
+
/** Agent-scoped durable state; persisted with the Agent record. */
|
|
1482
|
+
agent(agentId: string): ExtensionStateStore;
|
|
1483
|
+
/** Extension-scoped durable state; survives process restarts. */
|
|
1484
|
+
global(): ExtensionStateStore;
|
|
1485
|
+
};
|
|
1486
|
+
/** Tool capabilities — register and unregister custom tools. */
|
|
1487
|
+
tools: {
|
|
1488
|
+
/** Register a custom LLM-callable tool. */
|
|
1489
|
+
register(tool: ToolDefinition): void;
|
|
1490
|
+
/** Unregister a previously registered tool by name. */
|
|
1491
|
+
unregister(toolName: string): void;
|
|
1492
|
+
};
|
|
1493
|
+
/** Capability contributions — advertise tools or features to the host. */
|
|
1494
|
+
capabilities: {
|
|
1495
|
+
/** Contribute a capability to the host. Returns a disposer to remove the contribution. */
|
|
1496
|
+
contribute(contribution: ExtensionCapabilityContribution): () => void;
|
|
1497
|
+
};
|
|
1498
|
+
/** Model provider registration. */
|
|
1499
|
+
providers: {
|
|
1500
|
+
/** Register a model provider. Registering with an existing id replaces it. */
|
|
1501
|
+
register(config: _rowan_agent_models.ProviderConfig): void;
|
|
1502
|
+
/** Unregister a model provider by id. */
|
|
1503
|
+
unregister(id: string): void;
|
|
1504
|
+
};
|
|
1505
|
+
/** Phase execution capabilities — provides Phase In/Out, phase identity, phase routing, and registration. */
|
|
1506
|
+
phases: {
|
|
1507
|
+
/** Register a Phase directory bundle or Phase object. */
|
|
1508
|
+
register(phase: PhaseRegistration): Promise<void>;
|
|
1509
|
+
/** Unregister a previously registered phase by name. */
|
|
1510
|
+
unregister(phaseName: string): void;
|
|
1511
|
+
/** Phase In: get payload from previous phase */
|
|
1512
|
+
getPayload(): unknown;
|
|
1513
|
+
/** Phase Out: set payload for next phase */
|
|
1514
|
+
setPayload(payload: unknown): void;
|
|
1515
|
+
/** Phase Out: set outcome message */
|
|
1516
|
+
setMessage(message: string): void;
|
|
1517
|
+
/** Get current phase name */
|
|
1518
|
+
getCurrentPhase(): string;
|
|
1519
|
+
/** Set next phase (lower priority than PHASE.md target) */
|
|
1520
|
+
setNextPhase(phaseName: string): void;
|
|
1521
|
+
/** Get the next phase set by setNextPhase */
|
|
1522
|
+
getNextPhase(): string | undefined;
|
|
1523
|
+
/** Get the message set by setMessage */
|
|
1524
|
+
getMessage(): string | undefined;
|
|
1525
|
+
};
|
|
1526
|
+
/** Declarative host contributions. */
|
|
1527
|
+
host: {
|
|
1528
|
+
/** Contribute a declarative declaration to the host. Returns a disposer to remove the contribution. */
|
|
1529
|
+
contribute<T extends HostContribution>(contribution: T): () => void;
|
|
1530
|
+
};
|
|
1531
|
+
/** Extension manifest from package.json `rowan` field. */
|
|
1532
|
+
manifest?: ExtensionManifest;
|
|
1533
|
+
/** Utility functions. */
|
|
1534
|
+
utils: ExtensionUtils;
|
|
1535
|
+
/** Runtime context — cwd, signal, exec, message access, etc. */
|
|
1536
|
+
context: ExtensionContext;
|
|
1537
|
+
/** Shared event bus for inter-extension communication. */
|
|
1538
|
+
events: EventBus;
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Extension factory function.
|
|
1542
|
+
* Receives ExtensionAPI for registering hooks, phases, and providers.
|
|
1543
|
+
*/
|
|
1544
|
+
type ExtensionDisposer = () => void | Promise<void>;
|
|
1545
|
+
type ExtensionFactoryResult = void | ExtensionDisposer;
|
|
1546
|
+
type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<ExtensionFactoryResult>;
|
|
1547
|
+
|
|
1548
|
+
type PhaseStatusState = "running" | "completed";
|
|
1549
|
+
/** Normalized status event exposed to Runtime consumers. */
|
|
1550
|
+
type PhaseStatus = Readonly<{
|
|
1551
|
+
state: PhaseStatusState;
|
|
1552
|
+
/** Stable consumer-facing status identifier, e.g. `compacting`. */
|
|
1553
|
+
kind: string;
|
|
1554
|
+
/** Optional human-readable detail for UI/status consumers. */
|
|
1555
|
+
message?: string;
|
|
1556
|
+
/** Structured status payload. */
|
|
1557
|
+
payload?: unknown;
|
|
1558
|
+
}>;
|
|
1559
|
+
/** Unified phase output — model-driven routing is optional; programmatic phases may normalize omission to stop. */
|
|
1560
|
+
type PhaseOutput = {
|
|
1561
|
+
/** User-visible assistant message. */
|
|
1562
|
+
message?: string;
|
|
1563
|
+
/** Final status update for non-conversational consumers. */
|
|
1564
|
+
status?: PhaseStatus;
|
|
1565
|
+
/** Route to next phase, or "continue" to re-execute current phase, or "stop" to end. Undefined means no model route. */
|
|
1566
|
+
route?: string;
|
|
1567
|
+
/** Phase name that produced this output */
|
|
1568
|
+
phase?: string;
|
|
1569
|
+
/** Tool calls from the model invocation (used by framework for route extraction) */
|
|
1570
|
+
toolCalls?: Array<{
|
|
1571
|
+
id: string;
|
|
1572
|
+
name: string;
|
|
1573
|
+
args: unknown;
|
|
1574
|
+
}>;
|
|
1575
|
+
/** Route reason extracted from route tool call (for hooks to inspect) */
|
|
1576
|
+
routeReason?: string;
|
|
1577
|
+
/** Structured data from this phase, passed to the next phase */
|
|
1578
|
+
payload?: unknown;
|
|
1579
|
+
};
|
|
1580
|
+
/** Phase machine state — tracks position and inter-phase data */
|
|
1581
|
+
interface PhaseState {
|
|
1582
|
+
current: string;
|
|
1583
|
+
available: string[];
|
|
1584
|
+
iterations: number;
|
|
1585
|
+
payload?: unknown;
|
|
1586
|
+
}
|
|
1587
|
+
type PhaseInvocation = {
|
|
1588
|
+
mode: "serial";
|
|
1589
|
+
instanceId: string;
|
|
1590
|
+
} | {
|
|
1591
|
+
mode: "parallel";
|
|
1592
|
+
instanceId: string;
|
|
1593
|
+
groupId: string;
|
|
1594
|
+
index: number;
|
|
1595
|
+
count: number;
|
|
1596
|
+
sourcePhaseId: string;
|
|
1597
|
+
};
|
|
1598
|
+
/** Durable identity of the Run execution currently invoking a Phase. */
|
|
1599
|
+
type PhaseExecutionIdentity = Readonly<{
|
|
1600
|
+
agentId: string;
|
|
1601
|
+
runId: string;
|
|
1602
|
+
executionId: string;
|
|
1603
|
+
/** Original durable Run input, before any Phase-local interpretation. */
|
|
1604
|
+
input?: UserContent;
|
|
1605
|
+
/** Opaque metadata captured at the durable boundary; Rowan does not decode it. */
|
|
1606
|
+
agentMetadata?: Readonly<Record<string, unknown>>;
|
|
1607
|
+
runMetadata?: Readonly<Record<string, unknown>>;
|
|
1608
|
+
scope?: _rowan_agent_models.ScopeRef;
|
|
1609
|
+
cwd?: string;
|
|
1610
|
+
}>;
|
|
1611
|
+
/** Everything a phase needs to execute */
|
|
1612
|
+
interface PhaseContext {
|
|
1613
|
+
systemPrompt: string;
|
|
1614
|
+
messages: AgentMessage[];
|
|
1615
|
+
/** Phase-filtered tools */
|
|
1616
|
+
tools: Tool[];
|
|
1617
|
+
/** Phase-filtered skills */
|
|
1618
|
+
skills: Skill[];
|
|
1619
|
+
/** Phase machine state */
|
|
1620
|
+
state: PhaseState;
|
|
1621
|
+
/** Identity and dispatch metadata for this phase execution */
|
|
1622
|
+
readonly invocation: PhaseInvocation;
|
|
1623
|
+
/** Durable Run identity for cross-store integrations and idempotent commands. */
|
|
1624
|
+
readonly execution: PhaseExecutionIdentity;
|
|
1625
|
+
/** Additional guideline bullets appended to the system prompt */
|
|
1626
|
+
promptGuidelines?: string[];
|
|
1627
|
+
/** Text to append after the system prompt */
|
|
1628
|
+
appendSystemPrompt?: string;
|
|
1629
|
+
}
|
|
1630
|
+
/** JSON-safe structural defaults declared by a Phase's `input` mapping. */
|
|
1631
|
+
type PhaseInput = Readonly<Record<string, JsonValue>>;
|
|
1632
|
+
/** JSON-safe option metadata exposed to a host Settings surface. */
|
|
1633
|
+
interface SettingsOption {
|
|
1634
|
+
value: string;
|
|
1635
|
+
label: string;
|
|
1636
|
+
description?: string;
|
|
1637
|
+
disabled?: boolean;
|
|
1638
|
+
}
|
|
1639
|
+
interface SettingsBadge {
|
|
1640
|
+
label: string;
|
|
1641
|
+
tone?: "neutral" | "success" | "review" | "danger";
|
|
1642
|
+
}
|
|
1643
|
+
interface SettingsItem {
|
|
1644
|
+
id: string;
|
|
1645
|
+
title: string;
|
|
1646
|
+
description?: string;
|
|
1647
|
+
badges?: readonly SettingsBadge[];
|
|
1648
|
+
}
|
|
1649
|
+
type SettingsControl = {
|
|
1650
|
+
type: "boolean";
|
|
1651
|
+
path: string;
|
|
1652
|
+
label: string;
|
|
1653
|
+
description?: string;
|
|
1654
|
+
} | {
|
|
1655
|
+
type: "number";
|
|
1656
|
+
path: string;
|
|
1657
|
+
label: string;
|
|
1658
|
+
description?: string;
|
|
1659
|
+
min?: number;
|
|
1660
|
+
max?: number;
|
|
1661
|
+
step?: number;
|
|
1662
|
+
unit?: string;
|
|
1663
|
+
scale?: number;
|
|
1664
|
+
} | {
|
|
1665
|
+
type: "select";
|
|
1666
|
+
path: string;
|
|
1667
|
+
label: string;
|
|
1668
|
+
description?: string;
|
|
1669
|
+
options: readonly SettingsOption[];
|
|
1670
|
+
} | {
|
|
1671
|
+
type: "text";
|
|
1672
|
+
path: string;
|
|
1673
|
+
label: string;
|
|
1674
|
+
description?: string;
|
|
1675
|
+
placeholder?: string;
|
|
1676
|
+
format?: "string" | "string-array" | "key-value";
|
|
1677
|
+
multiline?: boolean;
|
|
1678
|
+
} | {
|
|
1679
|
+
type: "collection";
|
|
1680
|
+
path: string;
|
|
1681
|
+
label: string;
|
|
1682
|
+
description?: string;
|
|
1683
|
+
items: readonly SettingsItem[];
|
|
1684
|
+
fields: readonly SettingsControl[];
|
|
1685
|
+
add?: {
|
|
1686
|
+
label: string;
|
|
1687
|
+
idLabel?: string;
|
|
1688
|
+
fields: readonly SettingsControl[];
|
|
1689
|
+
};
|
|
1690
|
+
removeLabel?: string;
|
|
1691
|
+
};
|
|
1692
|
+
interface SettingsSection {
|
|
1693
|
+
id: string;
|
|
1694
|
+
title: string;
|
|
1695
|
+
description?: string;
|
|
1696
|
+
controls: readonly SettingsControl[];
|
|
1697
|
+
}
|
|
1698
|
+
/** Declarative, host-neutral Settings surface. */
|
|
1699
|
+
interface SettingsDefinition {
|
|
1700
|
+
description?: string;
|
|
1701
|
+
sections: readonly SettingsSection[];
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Loaded Phase object
|
|
1705
|
+
*/
|
|
1706
|
+
interface Phase {
|
|
1707
|
+
/** Unique phase identity and display name. */
|
|
1708
|
+
name: string;
|
|
1709
|
+
/** Rowan-owned built-in Phase; built-ins are never filtered or disabled. */
|
|
1710
|
+
core?: boolean;
|
|
1711
|
+
/** Description */
|
|
1712
|
+
description: string;
|
|
1713
|
+
/** Restricted tools (undefined = all tools available) */
|
|
1714
|
+
tools?: string[];
|
|
1715
|
+
/** Skills bundled directly inside this phase directory. Inline phases may omit this (equivalent to []). */
|
|
1716
|
+
skills?: Skill[];
|
|
1717
|
+
/** Forced next phase */
|
|
1718
|
+
target?: string;
|
|
1719
|
+
/** Structural JSON-safe input defaults */
|
|
1720
|
+
input?: PhaseInput;
|
|
1721
|
+
/** If true, phase gets a fresh context when executed in parallel */
|
|
1722
|
+
isolated?: boolean;
|
|
1723
|
+
/** Path to PHASE.md file */
|
|
1724
|
+
filePath: string;
|
|
1725
|
+
/** Phase directory path */
|
|
1726
|
+
baseDir: string;
|
|
1727
|
+
/** PHASE.md body content */
|
|
1728
|
+
content: string;
|
|
1729
|
+
/** Model override for this phase (resolved from frontmatter) */
|
|
1730
|
+
model?: ModelRef;
|
|
1731
|
+
/** Do not automatically inject this Phase into the model route catalog/context. */
|
|
1732
|
+
disableAutoInvocation?: boolean;
|
|
1733
|
+
/** Do not expose this Phase to direct user invocation. */
|
|
1734
|
+
disableImplicitInvocation?: boolean;
|
|
1735
|
+
/** ExtensionAPI factory function used for registration or programmatic execution. */
|
|
1736
|
+
factory?: (api: ExtensionAPI) => Promise<void>;
|
|
1737
|
+
/** Direct run function */
|
|
1738
|
+
run?: (context: PhaseContext, execution: PhaseExecution) => Promise<PhaseOutput | void>;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Phase registry containing all loaded phases
|
|
1742
|
+
*/
|
|
1743
|
+
interface PhaseRegistry {
|
|
1744
|
+
/** Map of phase name to Phase object */
|
|
1745
|
+
phases: Map<string, Phase>;
|
|
1746
|
+
/** Entry phase name (null until Agent applies its default phase) */
|
|
1747
|
+
entryPhaseId: string | null;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
interface BeforePhaseEvent {
|
|
1751
|
+
type: "before_phase";
|
|
1752
|
+
phaseId: string;
|
|
1753
|
+
input: PhaseContext;
|
|
1754
|
+
}
|
|
1755
|
+
interface AfterPhaseEvent {
|
|
1756
|
+
type: "after_phase";
|
|
1757
|
+
phaseId: string;
|
|
1758
|
+
output: PhaseOutput;
|
|
1759
|
+
}
|
|
1760
|
+
interface BeforePromptEvent {
|
|
1761
|
+
type: "before_prompt";
|
|
1762
|
+
phaseId: string;
|
|
1763
|
+
input: PhaseContext;
|
|
1764
|
+
}
|
|
1765
|
+
interface BeforeToolCallEvent {
|
|
1766
|
+
type: "before_tool_call";
|
|
1767
|
+
tool: Tool;
|
|
1768
|
+
args: unknown;
|
|
1769
|
+
readonly runId?: string;
|
|
1770
|
+
readonly agentId?: string;
|
|
1771
|
+
readonly toolCallId?: string;
|
|
1772
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
1773
|
+
readonly answer?: unknown;
|
|
1774
|
+
readonly scope?: ScopeRef;
|
|
1775
|
+
readonly turn?: JsonObject;
|
|
1776
|
+
}
|
|
1777
|
+
interface AfterToolCallEvent {
|
|
1778
|
+
type: "after_tool_call";
|
|
1779
|
+
tool: Tool;
|
|
1780
|
+
result: ToolResult;
|
|
1781
|
+
readonly runId?: string;
|
|
1782
|
+
readonly agentId?: string;
|
|
1783
|
+
readonly toolCallId?: string;
|
|
1784
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
1785
|
+
readonly scope?: ScopeRef;
|
|
1786
|
+
readonly turn?: JsonObject;
|
|
1787
|
+
}
|
|
1788
|
+
interface RunStartEvent {
|
|
1789
|
+
type: "run_start";
|
|
1790
|
+
runId: string;
|
|
1791
|
+
agentId: string;
|
|
1792
|
+
metadata: Readonly<Record<string, unknown>>;
|
|
1793
|
+
turn: JsonObject;
|
|
1794
|
+
}
|
|
1795
|
+
interface RunEndEvent {
|
|
1796
|
+
type: "run_end";
|
|
1797
|
+
runId: string;
|
|
1798
|
+
agentId: string;
|
|
1799
|
+
outcome: unknown;
|
|
1800
|
+
}
|
|
1801
|
+
type HookEvent = BeforePhaseEvent | AfterPhaseEvent | BeforePromptEvent | BeforeToolCallEvent | AfterToolCallEvent | RunStartEvent | RunEndEvent;
|
|
1802
|
+
interface BeforePhaseResult {
|
|
1803
|
+
abort?: Outcome;
|
|
1804
|
+
skip?: {
|
|
1805
|
+
route: string;
|
|
1806
|
+
message: string;
|
|
1807
|
+
};
|
|
1808
|
+
input?: PhaseContext;
|
|
1809
|
+
}
|
|
1810
|
+
interface AfterPhaseResult {
|
|
1811
|
+
abort?: Outcome;
|
|
1812
|
+
retry?: PhaseContext;
|
|
1813
|
+
output?: PhaseOutput;
|
|
1814
|
+
}
|
|
1815
|
+
interface BeforePromptResult {
|
|
1816
|
+
input?: PhaseContext;
|
|
1817
|
+
}
|
|
1818
|
+
interface BeforeToolCallResult {
|
|
1819
|
+
allow?: boolean;
|
|
1820
|
+
reason?: string;
|
|
1821
|
+
interaction?: RunInteractionRequest;
|
|
1822
|
+
}
|
|
1823
|
+
interface AfterToolCallResult {
|
|
1824
|
+
result?: ToolResult;
|
|
1825
|
+
}
|
|
1826
|
+
interface HookResultMap {
|
|
1827
|
+
before_phase: BeforePhaseResult | undefined;
|
|
1828
|
+
after_phase: AfterPhaseResult | undefined;
|
|
1829
|
+
before_prompt: BeforePromptResult | undefined;
|
|
1830
|
+
before_tool_call: BeforeToolCallResult | undefined;
|
|
1831
|
+
after_tool_call: AfterToolCallResult | undefined;
|
|
1832
|
+
run_start: void;
|
|
1833
|
+
run_end: void;
|
|
1834
|
+
}
|
|
1835
|
+
type HookEventType = HookEvent["type"];
|
|
1836
|
+
type HookHandler<K extends HookEventType> = (event: Extract<HookEvent, {
|
|
1837
|
+
type: K;
|
|
1838
|
+
}>) => HookResultMap[K] | Promise<HookResultMap[K]> | void | Promise<void>;
|
|
1839
|
+
declare class HooksManager {
|
|
1840
|
+
private handlers;
|
|
1841
|
+
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
1842
|
+
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
1843
|
+
emit<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
|
|
1844
|
+
type: K;
|
|
1845
|
+
}>): Promise<void>;
|
|
1846
|
+
emitFirst<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
|
|
1847
|
+
type: K;
|
|
1848
|
+
}>): Promise<HookResultMap[K] | undefined>;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
type ToolContext = Pick<AgentContext, "skills"> & {
|
|
1852
|
+
toolCallId: string;
|
|
1853
|
+
interaction?: RunInteractionDriver;
|
|
1854
|
+
};
|
|
1855
|
+
type ToolExecutionMode = "sequential" | "parallel";
|
|
1856
|
+
type Tool<TArgs = unknown> = {
|
|
1857
|
+
name: string;
|
|
1858
|
+
/** Rowan-owned Core Tool; Core Tools bypass Phase filtering. */
|
|
1859
|
+
core?: boolean;
|
|
1860
|
+
description: string;
|
|
1861
|
+
parameters: Type.TSchema;
|
|
1862
|
+
/** One-line snippet shown in the system prompt tool list. */
|
|
1863
|
+
promptSnippet?: string;
|
|
1864
|
+
/** Additional guidelines appended to the system prompt when this tool is active. */
|
|
1865
|
+
promptGuidelines?: string[];
|
|
1866
|
+
/** Whether this tool can run concurrently with others. Default: "parallel". */
|
|
1867
|
+
executionMode?: ToolExecutionMode;
|
|
1868
|
+
_meta?: JsonObject$1;
|
|
1869
|
+
execute(args: TArgs, context: ToolContext, signal?: AbortSignal): Promise<ToolResult>;
|
|
1870
|
+
};
|
|
1871
|
+
/** Context snapshot passed into the low-level agent loop. */
|
|
1872
|
+
type AgentContext = {
|
|
1873
|
+
/** System prompt included with the request. */
|
|
1874
|
+
systemPrompt: string;
|
|
1875
|
+
/** Transcript visible to the model. */
|
|
1876
|
+
messages: AgentMessage[];
|
|
1877
|
+
/** Tools available for this run. */
|
|
1878
|
+
tools: Tool[];
|
|
1879
|
+
/** Skills available for this run. */
|
|
1880
|
+
skills: Skill[];
|
|
1881
|
+
/** Custom phases for this run. Agent normalizes this with the built-in default phase. */
|
|
1882
|
+
phases?: PhaseRegistry;
|
|
1883
|
+
cwd?: string;
|
|
1884
|
+
};
|
|
1885
|
+
|
|
1886
|
+
type LoopMetrics = {
|
|
1887
|
+
/** Number of phase iterations executed. */
|
|
1888
|
+
iterations: number;
|
|
1889
|
+
/** Phase transition history. */
|
|
1890
|
+
phaseTransitions: Array<{
|
|
1891
|
+
from: string;
|
|
1892
|
+
to: string;
|
|
1893
|
+
ts: string;
|
|
1894
|
+
}>;
|
|
1895
|
+
/** Number of times compaction was triggered. */
|
|
1896
|
+
compactionCount: number;
|
|
1897
|
+
/** Number of retry attempts due to transient errors. */
|
|
1898
|
+
retryCount: number;
|
|
1899
|
+
/** Loop start timestamp. */
|
|
1900
|
+
startedAt: string;
|
|
1901
|
+
/** Loop start time as epoch ms (for duration calculation). */
|
|
1902
|
+
startedAtMs: number;
|
|
1903
|
+
/** Loop end timestamp (set on completion). */
|
|
1904
|
+
endedAt?: string;
|
|
1905
|
+
/** Total wall-clock duration in ms. */
|
|
1906
|
+
durationMs?: number;
|
|
1907
|
+
};
|
|
1908
|
+
type ExecutionState = {
|
|
1909
|
+
currentPhase: string;
|
|
1910
|
+
attempt: number;
|
|
1911
|
+
metrics: LoopMetrics;
|
|
1912
|
+
status: "idle" | "running" | "suspended" | "completed" | "aborted" | "failed";
|
|
1913
|
+
initialPhasePayload?: JsonValue;
|
|
1914
|
+
entryPhases?: readonly EntryPhaseSpec[];
|
|
1915
|
+
continuation?: ExecutionContinuationState;
|
|
1916
|
+
runInteractions?: RunInteractionState;
|
|
1917
|
+
phaseInteractions?: RunInteractionState;
|
|
1918
|
+
};
|
|
1919
|
+
type ExecutionContinuationState = {
|
|
1920
|
+
isContinuing: boolean;
|
|
1921
|
+
previousPayload?: unknown;
|
|
1922
|
+
previousResults: Array<{
|
|
1923
|
+
name: string;
|
|
1924
|
+
output?: unknown;
|
|
1925
|
+
}>;
|
|
1926
|
+
pendingInstruction?: string;
|
|
1927
|
+
previousPhaseMessageId?: string;
|
|
1645
1928
|
};
|
|
1646
1929
|
|
|
1647
1930
|
type RunInteractionKind = "user_input" | "permission" | "elicitation" | "confirmation";
|
|
@@ -1792,9 +2075,14 @@ type MessageBase = Readonly<{
|
|
|
1792
2075
|
sequenceWithinRun: number;
|
|
1793
2076
|
createdAt: string;
|
|
1794
2077
|
}>;
|
|
2078
|
+
type ContextCandidate = Readonly<{
|
|
2079
|
+
name: string;
|
|
2080
|
+
value: JsonValue;
|
|
2081
|
+
}>;
|
|
1795
2082
|
type UserMessage = MessageBase & Readonly<{
|
|
1796
2083
|
role: "user";
|
|
1797
2084
|
content: UserContent;
|
|
2085
|
+
contexts?: readonly ContextCandidate[];
|
|
1798
2086
|
}>;
|
|
1799
2087
|
type AssistantMessage = MessageBase & Readonly<{
|
|
1800
2088
|
role: "assistant";
|
|
@@ -1822,7 +2110,7 @@ type InteractionRecord = MessageBase & Readonly<{
|
|
|
1822
2110
|
}>;
|
|
1823
2111
|
}>;
|
|
1824
2112
|
type Message = UserMessage | AssistantMessage | ToolMessage | InteractionRecord;
|
|
1825
|
-
type Outcome = Readonly<{
|
|
2113
|
+
type Outcome$1 = Readonly<{
|
|
1826
2114
|
id: OutcomeId;
|
|
1827
2115
|
message: string;
|
|
1828
2116
|
payload?: JsonValue;
|
|
@@ -1886,6 +2174,7 @@ type ToolCallSnapshot = ToolCall$1 & Readonly<{
|
|
|
1886
2174
|
resultMessageId?: MessageId;
|
|
1887
2175
|
reason?: string;
|
|
1888
2176
|
external?: boolean;
|
|
2177
|
+
contentIndex?: number;
|
|
1889
2178
|
createdAt?: string;
|
|
1890
2179
|
updatedAt?: string;
|
|
1891
2180
|
}>;
|
|
@@ -1940,7 +2229,7 @@ type RunStateChanged = DurableEventBase & (Readonly<{
|
|
|
1940
2229
|
kind: "run_state_changed";
|
|
1941
2230
|
from: "running";
|
|
1942
2231
|
to: "completed";
|
|
1943
|
-
outcome: Outcome;
|
|
2232
|
+
outcome: Outcome$1;
|
|
1944
2233
|
output?: AssistantMessage;
|
|
1945
2234
|
}> | Readonly<{
|
|
1946
2235
|
kind: "run_state_changed";
|
|
@@ -1968,6 +2257,8 @@ type ToolStateChanged = (DurableEventBase & Readonly<{
|
|
|
1968
2257
|
}>;
|
|
1969
2258
|
toolCall: ToolCall$1;
|
|
1970
2259
|
external?: boolean;
|
|
2260
|
+
/** For a provider-reported call: assistant content blocks streamed before it. */
|
|
2261
|
+
contentIndex?: number;
|
|
1971
2262
|
}>) | Readonly<{
|
|
1972
2263
|
kind: "tool_state_changed";
|
|
1973
2264
|
durability: "transient";
|
|
@@ -1979,6 +2270,7 @@ type ToolStateChanged = (DurableEventBase & Readonly<{
|
|
|
1979
2270
|
}>;
|
|
1980
2271
|
toolCall: ToolCall$1 | ToolCallUpdate;
|
|
1981
2272
|
external?: boolean;
|
|
2273
|
+
contentIndex?: number;
|
|
1982
2274
|
}>;
|
|
1983
2275
|
type DurableRunEvent = PhaseEntered | MessageCommitted | MessageRevised | RunStateChanged | Extract<ToolStateChanged, {
|
|
1984
2276
|
durability: "durable";
|
|
@@ -2007,377 +2299,94 @@ type ToolCallDelta = Readonly<{
|
|
|
2007
2299
|
durability: "transient";
|
|
2008
2300
|
runId: RunId;
|
|
2009
2301
|
executionId: ExecutionId;
|
|
2010
|
-
messageId: MessageId;
|
|
2011
|
-
providerToolCallId: string;
|
|
2012
|
-
toolName: string;
|
|
2013
|
-
arguments: string;
|
|
2014
|
-
args: JsonValue | undefined;
|
|
2015
|
-
}>;
|
|
2016
|
-
type PhaseStatusEvent = Readonly<{
|
|
2017
|
-
kind: "phase_status";
|
|
2018
|
-
durability: "transient";
|
|
2019
|
-
runId: RunId;
|
|
2020
|
-
executionId: ExecutionId;
|
|
2021
|
-
phaseId: string;
|
|
2022
|
-
status: PhaseStatus;
|
|
2023
|
-
}>;
|
|
2024
|
-
type ModelRetry = Readonly<{
|
|
2025
|
-
kind: "model_retry";
|
|
2026
|
-
durability: "transient";
|
|
2027
|
-
runId: RunId;
|
|
2028
|
-
executionId: ExecutionId;
|
|
2029
|
-
attempt: number;
|
|
2030
|
-
maxRetries: number;
|
|
2031
|
-
delayMs: number;
|
|
2032
|
-
error: string;
|
|
2033
|
-
}>;
|
|
2034
|
-
type LiveInteractionEvent = Readonly<{
|
|
2035
|
-
kind: "live_interaction";
|
|
2036
|
-
durability: "transient";
|
|
2037
|
-
runId: RunId;
|
|
2038
|
-
executionId?: ExecutionId;
|
|
2039
|
-
interaction: RunInteraction;
|
|
2040
|
-
}>;
|
|
2041
|
-
type RunEvent = DurableRunEvent | MessageDelta | ThinkingDelta | ToolCallDelta | PhaseStatusEvent | ModelRetry | LiveInteractionEvent | Extract<ToolStateChanged, {
|
|
2042
|
-
durability: "transient";
|
|
2043
|
-
}>;
|
|
2044
|
-
|
|
2045
|
-
type
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
message?: string;
|
|
2053
|
-
/** Structured status payload. */
|
|
2054
|
-
payload?: unknown;
|
|
2055
|
-
}>;
|
|
2056
|
-
/** Unified phase output — model-driven routing is optional; programmatic phases may normalize omission to stop. */
|
|
2057
|
-
type PhaseOutput = {
|
|
2058
|
-
/** User-visible assistant message. */
|
|
2059
|
-
message?: string;
|
|
2060
|
-
/** Final status update for non-conversational consumers. */
|
|
2061
|
-
status?: PhaseStatus;
|
|
2062
|
-
/** Route to next phase, or "continue" to re-execute current phase, or "stop" to end. Undefined means no model route. */
|
|
2063
|
-
route?: string;
|
|
2064
|
-
/** Phase name that produced this output */
|
|
2065
|
-
phase?: string;
|
|
2066
|
-
/** Tool calls from the model invocation (used by framework for route extraction) */
|
|
2067
|
-
toolCalls?: Array<{
|
|
2068
|
-
id: string;
|
|
2069
|
-
name: string;
|
|
2070
|
-
args: unknown;
|
|
2071
|
-
}>;
|
|
2072
|
-
/** Route reason extracted from route tool call (for hooks to inspect) */
|
|
2073
|
-
routeReason?: string;
|
|
2074
|
-
/** Structured data from this phase, passed to the next phase */
|
|
2075
|
-
payload?: unknown;
|
|
2076
|
-
};
|
|
2077
|
-
/** Phase machine state — tracks position and inter-phase data */
|
|
2078
|
-
interface PhaseState {
|
|
2079
|
-
current: string;
|
|
2080
|
-
available: string[];
|
|
2081
|
-
iterations: number;
|
|
2082
|
-
payload?: unknown;
|
|
2083
|
-
}
|
|
2084
|
-
type PhaseInvocation = {
|
|
2085
|
-
mode: "serial";
|
|
2086
|
-
instanceId: string;
|
|
2087
|
-
} | {
|
|
2088
|
-
mode: "parallel";
|
|
2089
|
-
instanceId: string;
|
|
2090
|
-
groupId: string;
|
|
2091
|
-
index: number;
|
|
2092
|
-
count: number;
|
|
2093
|
-
sourcePhaseId: string;
|
|
2094
|
-
};
|
|
2095
|
-
/** Durable identity of the Run execution currently invoking a Phase. */
|
|
2096
|
-
type PhaseExecutionIdentity = Readonly<{
|
|
2097
|
-
agentId: string;
|
|
2098
|
-
runId: string;
|
|
2099
|
-
executionId: string;
|
|
2100
|
-
/** Original durable Run input, before any Phase-local interpretation. */
|
|
2101
|
-
input?: UserContent;
|
|
2102
|
-
/** Opaque metadata captured at the durable boundary; Rowan does not decode it. */
|
|
2103
|
-
agentMetadata?: Readonly<Record<string, unknown>>;
|
|
2104
|
-
runMetadata?: Readonly<Record<string, unknown>>;
|
|
2105
|
-
scope?: _rowan_agent_models.ScopeRef;
|
|
2106
|
-
cwd?: string;
|
|
2107
|
-
}>;
|
|
2108
|
-
/** Everything a phase needs to execute */
|
|
2109
|
-
interface PhaseContext {
|
|
2110
|
-
systemPrompt: string;
|
|
2111
|
-
messages: AgentMessage[];
|
|
2112
|
-
/** Phase-filtered tools */
|
|
2113
|
-
tools: Tool[];
|
|
2114
|
-
/** Phase-filtered skills */
|
|
2115
|
-
skills: Skill[];
|
|
2116
|
-
/** Phase machine state */
|
|
2117
|
-
state: PhaseState;
|
|
2118
|
-
/** Identity and dispatch metadata for this phase execution */
|
|
2119
|
-
readonly invocation: PhaseInvocation;
|
|
2120
|
-
/** Durable Run identity for cross-store integrations and idempotent commands. */
|
|
2121
|
-
readonly execution: PhaseExecutionIdentity;
|
|
2122
|
-
/** Additional guideline bullets appended to the system prompt */
|
|
2123
|
-
promptGuidelines?: string[];
|
|
2124
|
-
/** Text to append after the system prompt */
|
|
2125
|
-
appendSystemPrompt?: string;
|
|
2126
|
-
}
|
|
2127
|
-
/** JSON-safe structural defaults declared by a Phase's `input` mapping. */
|
|
2128
|
-
type PhaseInput = Readonly<Record<string, JsonValue>>;
|
|
2129
|
-
/** JSON-safe option metadata exposed to a host Settings surface. */
|
|
2130
|
-
interface SettingsOption {
|
|
2131
|
-
value: string;
|
|
2132
|
-
label: string;
|
|
2133
|
-
description?: string;
|
|
2134
|
-
disabled?: boolean;
|
|
2135
|
-
}
|
|
2136
|
-
interface SettingsBadge {
|
|
2137
|
-
label: string;
|
|
2138
|
-
tone?: "neutral" | "success" | "review" | "danger";
|
|
2139
|
-
}
|
|
2140
|
-
interface SettingsItem {
|
|
2141
|
-
id: string;
|
|
2142
|
-
title: string;
|
|
2143
|
-
description?: string;
|
|
2144
|
-
badges?: readonly SettingsBadge[];
|
|
2145
|
-
}
|
|
2146
|
-
type SettingsControl = {
|
|
2147
|
-
type: "boolean";
|
|
2148
|
-
path: string;
|
|
2149
|
-
label: string;
|
|
2150
|
-
description?: string;
|
|
2151
|
-
} | {
|
|
2152
|
-
type: "number";
|
|
2153
|
-
path: string;
|
|
2154
|
-
label: string;
|
|
2155
|
-
description?: string;
|
|
2156
|
-
min?: number;
|
|
2157
|
-
max?: number;
|
|
2158
|
-
step?: number;
|
|
2159
|
-
unit?: string;
|
|
2160
|
-
scale?: number;
|
|
2161
|
-
} | {
|
|
2162
|
-
type: "select";
|
|
2163
|
-
path: string;
|
|
2164
|
-
label: string;
|
|
2165
|
-
description?: string;
|
|
2166
|
-
options: readonly SettingsOption[];
|
|
2167
|
-
} | {
|
|
2168
|
-
type: "text";
|
|
2169
|
-
path: string;
|
|
2170
|
-
label: string;
|
|
2171
|
-
description?: string;
|
|
2172
|
-
placeholder?: string;
|
|
2173
|
-
format?: "string" | "string-array" | "key-value";
|
|
2174
|
-
multiline?: boolean;
|
|
2175
|
-
} | {
|
|
2176
|
-
type: "collection";
|
|
2177
|
-
path: string;
|
|
2178
|
-
label: string;
|
|
2179
|
-
description?: string;
|
|
2180
|
-
items: readonly SettingsItem[];
|
|
2181
|
-
fields: readonly SettingsControl[];
|
|
2182
|
-
add?: {
|
|
2183
|
-
label: string;
|
|
2184
|
-
idLabel?: string;
|
|
2185
|
-
fields: readonly SettingsControl[];
|
|
2302
|
+
messageId: MessageId;
|
|
2303
|
+
providerToolCallId: string;
|
|
2304
|
+
toolName: string;
|
|
2305
|
+
arguments: string;
|
|
2306
|
+
args: JsonValue | undefined;
|
|
2307
|
+
}>;
|
|
2308
|
+
type PhaseStatusEvent = Readonly<{
|
|
2309
|
+
kind: "phase_status";
|
|
2310
|
+
durability: "transient";
|
|
2311
|
+
runId: RunId;
|
|
2312
|
+
executionId: ExecutionId;
|
|
2313
|
+
phaseId: string;
|
|
2314
|
+
status: PhaseStatus;
|
|
2315
|
+
}>;
|
|
2316
|
+
type ModelRetry = Readonly<{
|
|
2317
|
+
kind: "model_retry";
|
|
2318
|
+
durability: "transient";
|
|
2319
|
+
runId: RunId;
|
|
2320
|
+
executionId: ExecutionId;
|
|
2321
|
+
attempt: number;
|
|
2322
|
+
maxRetries: number;
|
|
2323
|
+
delayMs: number;
|
|
2324
|
+
error: string;
|
|
2325
|
+
}>;
|
|
2326
|
+
type LiveInteractionEvent = Readonly<{
|
|
2327
|
+
kind: "live_interaction";
|
|
2328
|
+
durability: "transient";
|
|
2329
|
+
runId: RunId;
|
|
2330
|
+
executionId?: ExecutionId;
|
|
2331
|
+
interaction: RunInteraction;
|
|
2332
|
+
}>;
|
|
2333
|
+
type RunEvent = DurableRunEvent | MessageDelta | ThinkingDelta | ToolCallDelta | PhaseStatusEvent | ModelRetry | LiveInteractionEvent | Extract<ToolStateChanged, {
|
|
2334
|
+
durability: "transient";
|
|
2335
|
+
}>;
|
|
2336
|
+
|
|
2337
|
+
type AgentMessage = {
|
|
2338
|
+
id: string;
|
|
2339
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
2340
|
+
content: string | LlmContentPart[];
|
|
2341
|
+
createdAt: string;
|
|
2342
|
+
metadata?: Record<string, unknown> & {
|
|
2343
|
+
phase?: string;
|
|
2186
2344
|
};
|
|
2187
|
-
|
|
2345
|
+
contexts?: readonly ContextCandidate[];
|
|
2188
2346
|
};
|
|
2189
|
-
|
|
2190
|
-
id: string;
|
|
2191
|
-
title: string;
|
|
2192
|
-
description?: string;
|
|
2193
|
-
controls: readonly SettingsControl[];
|
|
2194
|
-
}
|
|
2195
|
-
/** Declarative, host-neutral Settings surface. */
|
|
2196
|
-
interface SettingsDefinition {
|
|
2197
|
-
description?: string;
|
|
2198
|
-
sections: readonly SettingsSection[];
|
|
2199
|
-
}
|
|
2200
|
-
/**
|
|
2201
|
-
* Loaded Phase object
|
|
2202
|
-
*/
|
|
2203
|
-
interface Phase {
|
|
2204
|
-
/** Unique phase identity and display name. */
|
|
2347
|
+
type Skill = {
|
|
2205
2348
|
name: string;
|
|
2206
|
-
/** Rowan-owned built-in Phase; built-ins are never filtered or disabled. */
|
|
2207
|
-
core?: boolean;
|
|
2208
|
-
/** Description */
|
|
2209
2349
|
description: string;
|
|
2210
|
-
/**
|
|
2211
|
-
tools?: string[];
|
|
2212
|
-
/** Skills bundled directly inside this phase directory. Inline phases may omit this (equivalent to []). */
|
|
2213
|
-
skills?: Skill[];
|
|
2214
|
-
/** Forced next phase */
|
|
2215
|
-
target?: string;
|
|
2216
|
-
/** Structural JSON-safe input defaults */
|
|
2217
|
-
input?: PhaseInput;
|
|
2218
|
-
/** If true, phase gets a fresh context when executed in parallel */
|
|
2219
|
-
isolated?: boolean;
|
|
2220
|
-
/** Path to PHASE.md file */
|
|
2350
|
+
/** Absolute path to the SKILL.md file */
|
|
2221
2351
|
filePath: string;
|
|
2222
|
-
/**
|
|
2352
|
+
/** Directory containing the SKILL.md file */
|
|
2223
2353
|
baseDir: string;
|
|
2224
|
-
/**
|
|
2354
|
+
/** Full body content of the SKILL.md (after frontmatter) */
|
|
2225
2355
|
content: string;
|
|
2226
|
-
/**
|
|
2227
|
-
model?: ModelRef;
|
|
2228
|
-
/** Do not automatically inject this Phase into the model route catalog/context. */
|
|
2356
|
+
/** Do not automatically inject this Skill into the model Context. */
|
|
2229
2357
|
disableAutoInvocation?: boolean;
|
|
2230
|
-
/** Do not expose this
|
|
2358
|
+
/** Do not expose this Skill to direct user invocation. */
|
|
2231
2359
|
disableImplicitInvocation?: boolean;
|
|
2232
|
-
/**
|
|
2233
|
-
|
|
2234
|
-
/** Direct run function */
|
|
2235
|
-
run?: (context: PhaseContext, execution: PhaseExecution) => Promise<PhaseOutput | void>;
|
|
2236
|
-
}
|
|
2237
|
-
/**
|
|
2238
|
-
* Phase registry containing all loaded phases
|
|
2239
|
-
*/
|
|
2240
|
-
interface PhaseRegistry {
|
|
2241
|
-
/** Map of phase name to Phase object */
|
|
2242
|
-
phases: Map<string, Phase>;
|
|
2243
|
-
/** Entry phase name (null until Agent applies its default phase) */
|
|
2244
|
-
entryPhaseId: string | null;
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
interface BeforePhaseEvent {
|
|
2248
|
-
type: "before_phase";
|
|
2249
|
-
phaseId: string;
|
|
2250
|
-
input: PhaseContext;
|
|
2251
|
-
}
|
|
2252
|
-
interface AfterPhaseEvent {
|
|
2253
|
-
type: "after_phase";
|
|
2254
|
-
phaseId: string;
|
|
2255
|
-
output: PhaseOutput;
|
|
2256
|
-
}
|
|
2257
|
-
interface BeforePromptEvent {
|
|
2258
|
-
type: "before_prompt";
|
|
2259
|
-
phaseId: string;
|
|
2260
|
-
input: PhaseContext;
|
|
2261
|
-
}
|
|
2262
|
-
interface BeforeToolCallEvent {
|
|
2263
|
-
type: "before_tool_call";
|
|
2264
|
-
tool: Tool;
|
|
2265
|
-
args: unknown;
|
|
2266
|
-
readonly runId?: string;
|
|
2267
|
-
readonly agentId?: string;
|
|
2268
|
-
readonly toolCallId?: string;
|
|
2269
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
2270
|
-
readonly answer?: unknown;
|
|
2271
|
-
readonly scope?: ScopeRef;
|
|
2272
|
-
readonly turn?: JsonObject;
|
|
2273
|
-
}
|
|
2274
|
-
interface AfterToolCallEvent {
|
|
2275
|
-
type: "after_tool_call";
|
|
2276
|
-
tool: Tool;
|
|
2277
|
-
result: ToolResult;
|
|
2278
|
-
readonly runId?: string;
|
|
2279
|
-
readonly agentId?: string;
|
|
2280
|
-
readonly toolCallId?: string;
|
|
2281
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
2282
|
-
readonly scope?: ScopeRef;
|
|
2283
|
-
readonly turn?: JsonObject;
|
|
2284
|
-
}
|
|
2285
|
-
interface RunStartEvent {
|
|
2286
|
-
type: "run_start";
|
|
2287
|
-
runId: string;
|
|
2288
|
-
agentId: string;
|
|
2289
|
-
metadata: Readonly<Record<string, unknown>>;
|
|
2290
|
-
turn: JsonObject;
|
|
2291
|
-
}
|
|
2292
|
-
interface RunEndEvent {
|
|
2293
|
-
type: "run_end";
|
|
2294
|
-
runId: string;
|
|
2295
|
-
agentId: string;
|
|
2296
|
-
outcome: unknown;
|
|
2297
|
-
}
|
|
2298
|
-
type HookEvent = BeforePhaseEvent | AfterPhaseEvent | BeforePromptEvent | BeforeToolCallEvent | AfterToolCallEvent | RunStartEvent | RunEndEvent;
|
|
2299
|
-
interface BeforePhaseResult {
|
|
2300
|
-
abort?: Outcome$1;
|
|
2301
|
-
skip?: {
|
|
2302
|
-
route: string;
|
|
2303
|
-
message: string;
|
|
2304
|
-
};
|
|
2305
|
-
input?: PhaseContext;
|
|
2306
|
-
}
|
|
2307
|
-
interface AfterPhaseResult {
|
|
2308
|
-
abort?: Outcome$1;
|
|
2309
|
-
retry?: PhaseContext;
|
|
2310
|
-
output?: PhaseOutput;
|
|
2311
|
-
}
|
|
2312
|
-
interface BeforePromptResult {
|
|
2313
|
-
input?: PhaseContext;
|
|
2314
|
-
}
|
|
2315
|
-
interface BeforeToolCallResult {
|
|
2316
|
-
allow?: boolean;
|
|
2317
|
-
reason?: string;
|
|
2318
|
-
interaction?: RunInteractionRequest;
|
|
2319
|
-
}
|
|
2320
|
-
interface AfterToolCallResult {
|
|
2321
|
-
result?: ToolResult;
|
|
2322
|
-
}
|
|
2323
|
-
interface HookResultMap {
|
|
2324
|
-
before_phase: BeforePhaseResult | undefined;
|
|
2325
|
-
after_phase: AfterPhaseResult | undefined;
|
|
2326
|
-
before_prompt: BeforePromptResult | undefined;
|
|
2327
|
-
before_tool_call: BeforeToolCallResult | undefined;
|
|
2328
|
-
after_tool_call: AfterToolCallResult | undefined;
|
|
2329
|
-
run_start: void;
|
|
2330
|
-
run_end: void;
|
|
2331
|
-
}
|
|
2332
|
-
type HookEventType = HookEvent["type"];
|
|
2333
|
-
type HookHandler<K extends HookEventType> = (event: Extract<HookEvent, {
|
|
2334
|
-
type: K;
|
|
2335
|
-
}>) => HookResultMap[K] | Promise<HookResultMap[K]> | void | Promise<void>;
|
|
2336
|
-
declare class HooksManager {
|
|
2337
|
-
private handlers;
|
|
2338
|
-
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
2339
|
-
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
2340
|
-
emit<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
|
|
2341
|
-
type: K;
|
|
2342
|
-
}>): Promise<void>;
|
|
2343
|
-
emitFirst<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
|
|
2344
|
-
type: K;
|
|
2345
|
-
}>): Promise<HookResultMap[K] | undefined>;
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
type ToolContext = Pick<AgentContext, "skills"> & {
|
|
2349
|
-
toolCallId: string;
|
|
2350
|
-
interaction?: RunInteractionDriver;
|
|
2360
|
+
/** @deprecated Use disableAutoInvocation; kept only for old in-memory callers during cutover. */
|
|
2361
|
+
disableModelInvocation?: boolean;
|
|
2351
2362
|
};
|
|
2352
|
-
type
|
|
2353
|
-
|
|
2363
|
+
type Outcome = {
|
|
2364
|
+
id: string;
|
|
2365
|
+
message: string;
|
|
2366
|
+
/** Publish this outcome's message as an assistant message before completing the run. */
|
|
2367
|
+
display?: boolean;
|
|
2368
|
+
payload?: unknown;
|
|
2369
|
+
toolResults?: Array<{
|
|
2370
|
+
toolCallId: string;
|
|
2371
|
+
toolName: string;
|
|
2372
|
+
ok: boolean;
|
|
2373
|
+
content: unknown;
|
|
2374
|
+
error?: string;
|
|
2375
|
+
}>;
|
|
2376
|
+
};
|
|
2377
|
+
type ToolCall = {
|
|
2378
|
+
id: string;
|
|
2354
2379
|
name: string;
|
|
2355
|
-
|
|
2356
|
-
core?: boolean;
|
|
2357
|
-
description: string;
|
|
2358
|
-
parameters: Type.TSchema;
|
|
2359
|
-
/** One-line snippet shown in the system prompt tool list. */
|
|
2360
|
-
promptSnippet?: string;
|
|
2361
|
-
/** Additional guidelines appended to the system prompt when this tool is active. */
|
|
2362
|
-
promptGuidelines?: string[];
|
|
2363
|
-
/** Whether this tool can run concurrently with others. Default: "parallel". */
|
|
2364
|
-
executionMode?: ToolExecutionMode;
|
|
2365
|
-
_meta?: JsonObject$1;
|
|
2366
|
-
execute(args: TArgs, context: ToolContext, signal?: AbortSignal): Promise<ToolResult>;
|
|
2380
|
+
args: unknown;
|
|
2367
2381
|
};
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
/** Skills available for this run. */
|
|
2377
|
-
skills: Skill[];
|
|
2378
|
-
/** Custom phases for this run. Agent normalizes this with the built-in default phase. */
|
|
2379
|
-
phases?: PhaseRegistry;
|
|
2380
|
-
cwd?: string;
|
|
2382
|
+
type ToolResult = {
|
|
2383
|
+
toolCallId: string;
|
|
2384
|
+
toolName: string;
|
|
2385
|
+
ok: boolean;
|
|
2386
|
+
content: unknown;
|
|
2387
|
+
error?: string;
|
|
2388
|
+
structuredContent?: unknown;
|
|
2389
|
+
isError?: boolean;
|
|
2381
2390
|
};
|
|
2382
2391
|
|
|
2383
2392
|
/**
|
|
@@ -2563,6 +2572,7 @@ type StoredToolCall = {
|
|
|
2563
2572
|
rawOutput?: JsonValue;
|
|
2564
2573
|
_meta?: JsonObject;
|
|
2565
2574
|
external?: boolean;
|
|
2575
|
+
contentIndex?: number;
|
|
2566
2576
|
result?: DurableToolResult;
|
|
2567
2577
|
resultMessageId?: MessageId;
|
|
2568
2578
|
reason?: string;
|
|
@@ -2694,6 +2704,7 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2694
2704
|
executionId?: ExecutionId;
|
|
2695
2705
|
messageId?: MessageId;
|
|
2696
2706
|
configToken?: ConfigToken;
|
|
2707
|
+
additionalContexts?: readonly ContextCandidate[];
|
|
2697
2708
|
}): RunClaim;
|
|
2698
2709
|
failQueuedRun(lease: OwnerLease, input: {
|
|
2699
2710
|
runId: RunId;
|
|
@@ -2789,7 +2800,7 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2789
2800
|
runId: RunId;
|
|
2790
2801
|
execution: ExecutionToken;
|
|
2791
2802
|
expectedRevision: number;
|
|
2792
|
-
outcome?: Outcome;
|
|
2803
|
+
outcome?: Outcome$1;
|
|
2793
2804
|
failure?: RunFailure;
|
|
2794
2805
|
output?: AssistantMessage;
|
|
2795
2806
|
}): RunRecord;
|
|
@@ -2804,6 +2815,7 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2804
2815
|
execution?: ExecutionToken;
|
|
2805
2816
|
update: ToolCall$1 | ToolCallUpdate;
|
|
2806
2817
|
external?: boolean;
|
|
2818
|
+
contentIndex?: number;
|
|
2807
2819
|
}): DurableRunEvent;
|
|
2808
2820
|
snapshotRun(lease: OwnerLease, runId: RunId): RunSnapshot;
|
|
2809
2821
|
listAgents(lease: OwnerLease): readonly AgentRecord[];
|
|
@@ -2944,6 +2956,7 @@ declare class SqliteStore implements DurableStore {
|
|
|
2944
2956
|
executionId?: ExecutionId;
|
|
2945
2957
|
messageId?: MessageId;
|
|
2946
2958
|
configToken?: ConfigToken;
|
|
2959
|
+
additionalContexts?: readonly ContextCandidate[];
|
|
2947
2960
|
}): Promise<RunClaim>;
|
|
2948
2961
|
failQueuedRun(lease: OwnerLease, input: {
|
|
2949
2962
|
runId: RunId;
|
|
@@ -2987,7 +3000,7 @@ declare class SqliteStore implements DurableStore {
|
|
|
2987
3000
|
runId: RunId;
|
|
2988
3001
|
execution: ExecutionToken;
|
|
2989
3002
|
expectedRevision: number;
|
|
2990
|
-
outcome?: Outcome;
|
|
3003
|
+
outcome?: Outcome$1;
|
|
2991
3004
|
failure?: RunFailure;
|
|
2992
3005
|
output?: AssistantMessage;
|
|
2993
3006
|
}): Promise<RunRecord>;
|
|
@@ -3057,6 +3070,7 @@ declare class SqliteStore implements DurableStore {
|
|
|
3057
3070
|
execution?: ExecutionToken;
|
|
3058
3071
|
update: ToolCall$1 | ToolCallUpdate;
|
|
3059
3072
|
external?: boolean;
|
|
3073
|
+
contentIndex?: number;
|
|
3060
3074
|
}): Promise<DurableRunEvent>;
|
|
3061
3075
|
snapshotRun(lease: OwnerLease, runId: RunId): Promise<RunSnapshot>;
|
|
3062
3076
|
history(lease: OwnerLease, agentId: AgentId): Promise<readonly Message[]>;
|
|
@@ -3303,4 +3317,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
|
|
|
3303
3317
|
|
|
3304
3318
|
declare function createCoreTools(input?: CoreToolContext): Tool$1[];
|
|
3305
3319
|
|
|
3306
|
-
export { type AfterToolCall, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, COMPACT_PHASE_ID, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type ContextCompactionRecord, type ContextStatus, type CoreToolContext, DEFAULT_PHASE_ID, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EntryPhaseSpec, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionCapability, type ExtensionCapabilityContribution, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionHost, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type ExtensionStateStore, type ExtensionToolContribution, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, type HostContribution, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, type InteractionRecord, type InvocationCatalogEntry, type InvocationSource, type JsonObject, type JsonPrimitive, type JsonValue, type LiveInteractionEvent, type LoadExtensionsResult, type LoadInput, type LoadResult, type LoadedExtension, type Message, type MessageBase, type MessageCommitted, type MessageContent, type MessageDelta, type MessageId, type MessageRevised, type MessageRevisionResult, type Metadata, type ModelRetry, type OpaqueId, type Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecution, type PhaseExecutionIdentity, type PhaseInput, type PhaseInvocation, type PhaseMessageManager, type PhaseOutput, type PhaseRegistry, type PhaseRegistrySelection, type PhaseState, type PhaseStatus, type PhaseStatusState, type ResolvedResourceView, type ResourceDiagnostic, type ResourceKind, type ResourceRef, ResourceRegistry, ResourceRegistryError, type ResourceRegistryErrorCode, type ResourceSourceId, type ResourceView, type RetentionResult, type RunBoundary, type RunClaim, type RunEndEvent, type RunEvent, type RunFailure, type RunId, type RunInteraction, RunInteractionBoundary, RunInteractionCancelledError, type RunInteractionDriver, type RunInteractionKind, type RunInteractionRequest, type RunInteractionState, type RunInteractionStatus, type RunListCursor, type RunRecord, type RunSnapshot, type RunStartEvent, type RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, STOP_PHASE_ID, type SettingsBadge, type SettingsControl, type SettingsDefinition, type SettingsItem, type SettingsOption, type SettingsSection, type Skill, SqliteStore, type TextContent, type ThinkingContent, type ThinkingDelta, type Tool$1 as Tool, type ToolCallContext, type ToolCallDelta, type ToolCallId, type ToolCallPresentationInput, type ToolCallPresentationOutput, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, type WithdrawnUserInput, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, mergeToolCall, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
|
|
3320
|
+
export { type AfterToolCall, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, COMPACT_PHASE_ID, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type ContextCompactionRecord, type ContextStatus, type CoreToolContext, DEFAULT_PHASE_ID, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EntryPhaseSpec, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionCapability, type ExtensionCapabilityContribution, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionHost, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type ExtensionStateStore, type ExtensionToolContribution, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, type HostContribution, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, type InteractionRecord, type InvocationCatalogEntry, type InvocationSource, type JsonObject, type JsonPrimitive, type JsonValue, type LiveInteractionEvent, type LoadExtensionsResult, type LoadInput, type LoadResult, type LoadedExtension, type Message, type MessageBase, type MessageCommitted, type MessageContent, type MessageDelta, type MessageId, type MessageRevised, type MessageRevisionResult, type Metadata, type ModelRetry, type OpaqueId, type Outcome$1 as Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecution, type PhaseExecutionIdentity, type PhaseInput, type PhaseInvocation, type PhaseMessageManager, type PhaseOutput, type PhaseRegistry, type PhaseRegistrySelection, type PhaseState, type PhaseStatus, type PhaseStatusState, type ResolvedResourceView, type ResourceDiagnostic, type ResourceKind, type ResourceRef, ResourceRegistry, ResourceRegistryError, type ResourceRegistryErrorCode, type ResourceSourceId, type ResourceView, type RetentionResult, type RunBoundary, type RunClaim, type RunEndEvent, type RunEvent, type RunFailure, type RunId, type RunInteraction, RunInteractionBoundary, RunInteractionCancelledError, type RunInteractionDriver, type RunInteractionKind, type RunInteractionRequest, type RunInteractionState, type RunInteractionStatus, type RunListCursor, type RunRecord, type RunSnapshot, type RunStartEvent, type RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, STOP_PHASE_ID, type SettingsBadge, type SettingsControl, type SettingsDefinition, type SettingsItem, type SettingsOption, type SettingsSection, type Skill, SqliteStore, type TextContent, type ThinkingContent, type ThinkingDelta, type Tool$1 as Tool, type ToolCallContext, type ToolCallDelta, type ToolCallId, type ToolCallPresentationInput, type ToolCallPresentationOutput, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, type WithdrawnUserInput, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, mergeToolCall, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
|