@rowan-agent/agent 0.9.7 → 0.9.9

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 CHANGED
@@ -21,7 +21,12 @@ type Skill = {
21
21
  baseDir: string;
22
22
  /** Full body content of the SKILL.md (after frontmatter) */
23
23
  content: string;
24
- disableModelInvocation: boolean;
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;
25
30
  };
26
31
  type Outcome$1 = {
27
32
  id: string;
@@ -50,6 +55,481 @@ type ToolResult = {
50
55
  error?: string;
51
56
  };
52
57
 
58
+ /** Durable and transient DTOs owned by the event-driven Agent Runtime. */
59
+
60
+ declare const opaqueIdBrand: unique symbol;
61
+ type OpaqueId<Kind extends string> = string & {
62
+ readonly [opaqueIdBrand]: Kind;
63
+ };
64
+ type AgentId = OpaqueId<"AgentId">;
65
+ type RunId = OpaqueId<"RunId">;
66
+ type MessageId = OpaqueId<"MessageId">;
67
+ type InputRequestId = OpaqueId<"InputRequestId">;
68
+ type ToolCallId = OpaqueId<"ToolCallId">;
69
+ type EventId = OpaqueId<"EventId">;
70
+ type ExecutionId = OpaqueId<"ExecutionId">;
71
+ type OutcomeId = OpaqueId<"OutcomeId">;
72
+ type ConfigToken = OpaqueId<"ConfigToken">;
73
+ type OwnerToken = OpaqueId<"OwnerToken">;
74
+ type EventCursor = OpaqueId<"EventCursor">;
75
+ type AgentListCursor = OpaqueId<"AgentListCursor">;
76
+ type RunListCursor = OpaqueId<"RunListCursor">;
77
+ type JsonPrimitive = null | boolean | number | string;
78
+ type JsonValue = JsonPrimitive | readonly JsonValue[] | {
79
+ readonly [key: string]: JsonValue;
80
+ };
81
+ type JsonObject = Readonly<Record<string, JsonValue>>;
82
+ type Metadata = JsonObject;
83
+ type TextContent = Readonly<{
84
+ type: "text";
85
+ text: string;
86
+ }>;
87
+ type ImageContent = Readonly<{
88
+ type: "image";
89
+ data: string;
90
+ mimeType: string;
91
+ }>;
92
+ type ThinkingContent = Readonly<{
93
+ type: "thinking";
94
+ thinking: string;
95
+ signature?: string;
96
+ }>;
97
+ type ToolUseContent = Readonly<{
98
+ type: "tool_use";
99
+ toolCallId: ToolCallId;
100
+ /** Provider/model correlation, retained only to reconstruct the next request. */
101
+ providerToolCallId?: string;
102
+ name: string;
103
+ input: JsonValue;
104
+ }>;
105
+ type ToolExecutionResult$1 = Readonly<{
106
+ ok: true;
107
+ content: JsonValue;
108
+ }> | Readonly<{
109
+ ok: false;
110
+ content: JsonValue;
111
+ error: string;
112
+ }>;
113
+ type DurableToolResult = Readonly<{
114
+ toolCallId: ToolCallId;
115
+ toolName: string;
116
+ }> & ToolExecutionResult$1;
117
+ type ToolResultContent = Readonly<{
118
+ type: "tool_result";
119
+ toolCallId: ToolCallId;
120
+ /** Provider/model correlation, retained only to reconstruct the next request. */
121
+ providerToolCallId?: string;
122
+ result: ToolExecutionResult$1;
123
+ }>;
124
+ type UserContent = string | readonly (TextContent | ImageContent)[];
125
+ type AssistantContent = string | readonly (TextContent | ThinkingContent | ToolUseContent)[];
126
+ type ToolMessageContent = readonly [ToolResultContent, ...ToolResultContent[]];
127
+ type MessageContent = UserContent | AssistantContent | ToolMessageContent;
128
+ type MessageBase = Readonly<{
129
+ id: MessageId;
130
+ agentId: AgentId;
131
+ runId: RunId;
132
+ /** Monotonic active revision. Omitted on legacy/initial messages and read as 0. */
133
+ messageRevision?: number;
134
+ metadata?: Metadata;
135
+ sequenceWithinRun: number;
136
+ createdAt: string;
137
+ }>;
138
+ type UserMessage = MessageBase & Readonly<{
139
+ role: "user";
140
+ content: UserContent;
141
+ }>;
142
+ type AssistantMessage = MessageBase & Readonly<{
143
+ role: "assistant";
144
+ content: AssistantContent;
145
+ interrupted?: boolean;
146
+ }>;
147
+ type ToolMessage = MessageBase & Readonly<{
148
+ role: "tool";
149
+ content: ToolMessageContent;
150
+ }>;
151
+ type Message = UserMessage | AssistantMessage | ToolMessage;
152
+ type Outcome = Readonly<{
153
+ id: OutcomeId;
154
+ message: string;
155
+ payload?: JsonValue;
156
+ toolResults?: readonly DurableToolResult[];
157
+ }>;
158
+ type RunState = "queued" | "running" | "input_required" | "completed" | "failed" | "cancelled";
159
+ type RunFailure = Readonly<{
160
+ code: "configuration_unavailable";
161
+ message: string;
162
+ }> | Readonly<{
163
+ code: "checkpoint_incompatible";
164
+ message: string;
165
+ expected: Readonly<{
166
+ codec: string;
167
+ versions: readonly number[];
168
+ }>;
169
+ actual: Readonly<{
170
+ codec: string;
171
+ version: number;
172
+ }>;
173
+ }> | Readonly<{
174
+ code: "runtime_interrupted";
175
+ message: string;
176
+ ownerEpoch: number;
177
+ }> | Readonly<{
178
+ code: "tool_indeterminate";
179
+ message: string;
180
+ toolCallIds: readonly [ToolCallId, ...ToolCallId[]];
181
+ }> | Readonly<{
182
+ code: "execution_failed";
183
+ message: string;
184
+ details?: JsonValue;
185
+ }>;
186
+ type QueuedRunFailure = Extract<RunFailure, {
187
+ code: "configuration_unavailable" | "checkpoint_incompatible";
188
+ }>;
189
+ type RunningRunFailure = Extract<RunFailure, {
190
+ code: "runtime_interrupted" | "tool_indeterminate" | "execution_failed";
191
+ }>;
192
+ type ToolCallState = "pending" | "running" | "completed" | "failed" | "indeterminate";
193
+ type ToolCallSnapshotBase = Readonly<{
194
+ id: ToolCallId;
195
+ providerToolCallId: string;
196
+ agentId: AgentId;
197
+ runId: RunId;
198
+ executionId: ExecutionId;
199
+ requestMessageId: MessageId;
200
+ name: string;
201
+ args: JsonValue;
202
+ createdAt: string;
203
+ updatedAt: string;
204
+ }>;
205
+ type ToolCallSnapshot = ToolCallSnapshotBase & (Readonly<{
206
+ state: "pending";
207
+ }> | Readonly<{
208
+ state: "running";
209
+ }> | Readonly<{
210
+ state: "completed";
211
+ result: DurableToolResult & Readonly<{
212
+ ok: true;
213
+ }>;
214
+ resultMessageId: MessageId;
215
+ }> | Readonly<{
216
+ state: "failed";
217
+ result: DurableToolResult & Readonly<{
218
+ ok: false;
219
+ }>;
220
+ resultMessageId: MessageId;
221
+ }> | Readonly<{
222
+ state: "indeterminate";
223
+ result: DurableToolResult & Readonly<{
224
+ ok: false;
225
+ }>;
226
+ resultMessageId: MessageId;
227
+ reason: string;
228
+ }>);
229
+ type DurableEventBase = Readonly<{
230
+ id: EventId;
231
+ schemaVersion: 1;
232
+ cursor: EventCursor;
233
+ durability: "durable";
234
+ agentId: AgentId;
235
+ runId: RunId;
236
+ runRevision: number;
237
+ metadata?: Metadata;
238
+ createdAt: string;
239
+ }>;
240
+ type MessageCommitted = DurableEventBase & Readonly<{
241
+ kind: "message_committed";
242
+ message: Message;
243
+ }>;
244
+ type MessageRevised = DurableEventBase & Readonly<{
245
+ kind: "message_revised";
246
+ message: UserMessage;
247
+ previousRevision: number;
248
+ invalidatedRunIds: readonly RunId[];
249
+ targetRunId: RunId;
250
+ cutoffSequenceWithinRun: number;
251
+ }>;
252
+ type RunStateChanged = DurableEventBase & (Readonly<{
253
+ kind: "run_state_changed";
254
+ from: null;
255
+ to: "queued";
256
+ }> | Readonly<{
257
+ kind: "run_state_changed";
258
+ from: "input_required";
259
+ to: "queued";
260
+ }> | Readonly<{
261
+ kind: "run_state_changed";
262
+ from: "queued";
263
+ to: "running";
264
+ }> | Readonly<{
265
+ kind: "run_state_changed";
266
+ from: "running";
267
+ to: "input_required";
268
+ request: Readonly<{
269
+ id: InputRequestId;
270
+ phase: string;
271
+ prompt: AssistantMessage;
272
+ }>;
273
+ interactions: readonly PhaseInteraction[];
274
+ answers: Readonly<Record<string, JsonValue>>;
275
+ }> | Readonly<{
276
+ kind: "run_state_changed";
277
+ from: "running";
278
+ to: "completed";
279
+ outcome: Outcome;
280
+ output?: AssistantMessage;
281
+ }> | Readonly<{
282
+ kind: "run_state_changed";
283
+ from: "queued";
284
+ to: "failed";
285
+ failure: QueuedRunFailure;
286
+ }> | Readonly<{
287
+ kind: "run_state_changed";
288
+ from: "running";
289
+ to: "failed";
290
+ failure: RunningRunFailure;
291
+ }> | Readonly<{
292
+ kind: "run_state_changed";
293
+ from: "queued" | "running" | "input_required";
294
+ to: "cancelled";
295
+ reason?: string;
296
+ }>);
297
+ type ToolStateChanged = DurableEventBase & (Readonly<{
298
+ kind: "tool_state_changed";
299
+ transition: Readonly<{
300
+ from: null;
301
+ to: "pending";
302
+ }>;
303
+ toolCall: Extract<ToolCallSnapshot, {
304
+ state: "pending";
305
+ }>;
306
+ }> | Readonly<{
307
+ kind: "tool_state_changed";
308
+ transition: Readonly<{
309
+ from: "pending";
310
+ to: "running";
311
+ }>;
312
+ toolCall: Extract<ToolCallSnapshot, {
313
+ state: "running";
314
+ }>;
315
+ }> | Readonly<{
316
+ kind: "tool_state_changed";
317
+ transition: Readonly<{
318
+ from: "pending";
319
+ to: "failed";
320
+ }>;
321
+ toolCall: Extract<ToolCallSnapshot, {
322
+ state: "failed";
323
+ }>;
324
+ }> | Readonly<{
325
+ kind: "tool_state_changed";
326
+ transition: Readonly<{
327
+ from: "running";
328
+ to: "completed";
329
+ }>;
330
+ toolCall: Extract<ToolCallSnapshot, {
331
+ state: "completed";
332
+ }>;
333
+ }> | Readonly<{
334
+ kind: "tool_state_changed";
335
+ transition: Readonly<{
336
+ from: "running";
337
+ to: "failed";
338
+ }>;
339
+ toolCall: Extract<ToolCallSnapshot, {
340
+ state: "failed";
341
+ }>;
342
+ }> | Readonly<{
343
+ kind: "tool_state_changed";
344
+ transition: Readonly<{
345
+ from: "running";
346
+ to: "indeterminate";
347
+ }>;
348
+ toolCall: Extract<ToolCallSnapshot, {
349
+ state: "indeterminate";
350
+ }>;
351
+ }>);
352
+ type DurableRunEvent = MessageCommitted | MessageRevised | RunStateChanged | ToolStateChanged;
353
+ type MessageDelta = Readonly<{
354
+ kind: "message_delta";
355
+ durability: "transient";
356
+ runId: RunId;
357
+ executionId: ExecutionId;
358
+ messageId: MessageId;
359
+ offset: number;
360
+ text: string;
361
+ }>;
362
+ type ToolProgress = Readonly<{
363
+ kind: "tool_progress";
364
+ durability: "transient";
365
+ runId: RunId;
366
+ executionId: ExecutionId;
367
+ toolCallId: ToolCallId;
368
+ progress: JsonValue;
369
+ }>;
370
+ type PhaseStatusEvent = Readonly<{
371
+ kind: "phase_status";
372
+ durability: "transient";
373
+ runId: RunId;
374
+ executionId: ExecutionId;
375
+ phaseId: string;
376
+ status: PhaseStatus;
377
+ }>;
378
+ type RunEvent = DurableRunEvent | MessageDelta | ToolProgress | PhaseStatusEvent;
379
+
380
+ interface BeforePhaseEvent {
381
+ type: "before_phase";
382
+ phaseId: string;
383
+ input: PhaseContext;
384
+ }
385
+ interface AfterPhaseEvent {
386
+ type: "after_phase";
387
+ phaseId: string;
388
+ output: PhaseOutput;
389
+ }
390
+ interface BeforePromptEvent {
391
+ type: "before_prompt";
392
+ phaseId: string;
393
+ input: PhaseContext;
394
+ }
395
+ interface BeforeToolCallEvent {
396
+ type: "before_tool_call";
397
+ tool: Tool$1;
398
+ args: unknown;
399
+ }
400
+ interface AfterToolCallEvent {
401
+ type: "after_tool_call";
402
+ tool: Tool$1;
403
+ result: ToolResult;
404
+ }
405
+ type HookEvent = BeforePhaseEvent | AfterPhaseEvent | BeforePromptEvent | BeforeToolCallEvent | AfterToolCallEvent;
406
+ interface BeforePhaseResult {
407
+ abort?: Outcome$1;
408
+ skip?: {
409
+ route: string;
410
+ message: string;
411
+ };
412
+ input?: PhaseContext;
413
+ }
414
+ interface AfterPhaseResult {
415
+ abort?: Outcome$1;
416
+ retry?: PhaseContext;
417
+ output?: PhaseOutput;
418
+ }
419
+ interface BeforePromptResult {
420
+ input?: PhaseContext;
421
+ }
422
+ interface BeforeToolCallResult {
423
+ allow: boolean;
424
+ reason?: string;
425
+ }
426
+ interface AfterToolCallResult {
427
+ result?: ToolResult;
428
+ }
429
+ interface HookResultMap {
430
+ before_phase: BeforePhaseResult | undefined;
431
+ after_phase: AfterPhaseResult | undefined;
432
+ before_prompt: BeforePromptResult | undefined;
433
+ before_tool_call: BeforeToolCallResult | undefined;
434
+ after_tool_call: AfterToolCallResult | undefined;
435
+ }
436
+ type HookEventType = HookEvent["type"];
437
+ type HookHandler<K extends HookEventType> = (event: Extract<HookEvent, {
438
+ type: K;
439
+ }>) => HookResultMap[K] | Promise<HookResultMap[K]> | void | Promise<void>;
440
+ declare class HooksManager {
441
+ private handlers;
442
+ on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
443
+ off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
444
+ emit<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
445
+ type: K;
446
+ }>): Promise<void>;
447
+ emitFirst<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
448
+ type: K;
449
+ }>): Promise<HookResultMap[K] | undefined>;
450
+ }
451
+
452
+ type LoopMetrics = {
453
+ /** Number of phase iterations executed. */
454
+ iterations: number;
455
+ /** Phase transition history. */
456
+ phaseTransitions: Array<{
457
+ from: string;
458
+ to: string;
459
+ ts: string;
460
+ }>;
461
+ /** Number of times compaction was triggered. */
462
+ compactionCount: number;
463
+ /** Number of retry attempts due to transient errors. */
464
+ retryCount: number;
465
+ /** Loop start timestamp. */
466
+ startedAt: string;
467
+ /** Loop start time as epoch ms (for duration calculation). */
468
+ startedAtMs: number;
469
+ /** Loop end timestamp (set on completion). */
470
+ endedAt?: string;
471
+ /** Total wall-clock duration in ms. */
472
+ durationMs?: number;
473
+ };
474
+ type ExecutionState = {
475
+ currentPhase: string;
476
+ attempt: number;
477
+ metrics: LoopMetrics;
478
+ status: "idle" | "running" | "suspended" | "completed" | "aborted" | "failed";
479
+ continuation?: ExecutionContinuationState;
480
+ phaseInteractions?: PhaseInteractionState;
481
+ };
482
+ type ExecutionContinuationState = {
483
+ isContinuing: boolean;
484
+ previousPayload?: unknown;
485
+ previousResults: Array<{
486
+ name: string;
487
+ output?: unknown;
488
+ }>;
489
+ pendingInstruction?: string;
490
+ previousPhaseMessageId?: string;
491
+ };
492
+
493
+ type PhaseInteractionKind = "user_input" | "permission" | "elicitation" | "confirmation";
494
+ type PhaseInteractionStatus = "pending" | "answered" | "denied" | "cancelled" | "expired";
495
+ type PhaseInteraction = Readonly<{
496
+ id: string;
497
+ phase: string;
498
+ kind: PhaseInteractionKind;
499
+ prompt: string;
500
+ payload?: JsonValue;
501
+ createdAt: string;
502
+ status: PhaseInteractionStatus;
503
+ }>;
504
+ type PhaseInteractionState = Readonly<{
505
+ requests: readonly PhaseInteraction[];
506
+ answers: Readonly<Record<string, JsonValue>>;
507
+ checkpoint?: JsonValue;
508
+ }>;
509
+ type PhaseInteractionDriver = Readonly<{
510
+ signal: AbortSignal;
511
+ request(input: Readonly<{
512
+ id?: string;
513
+ kind: PhaseInteractionKind;
514
+ prompt: string;
515
+ payload?: JsonValue;
516
+ }>): PhaseInteraction;
517
+ pending(): readonly PhaseInteraction[];
518
+ answers(): ReadonlyMap<string, JsonValue>;
519
+ suspend(input?: Readonly<{
520
+ checkpoint?: JsonValue;
521
+ }>): never;
522
+ }>;
523
+ declare class PhaseInteractionCancelledError extends Error {
524
+ readonly code: "phase_interaction_cancelled";
525
+ constructor();
526
+ }
527
+ declare class PhaseInteractionBoundary extends Error {
528
+ readonly state: ExecutionState;
529
+ readonly interactions: readonly PhaseInteraction[];
530
+ constructor(state: ExecutionState, interactions: readonly PhaseInteraction[]);
531
+ }
532
+
53
533
  type ModelInvokeOutput = {
54
534
  text: string;
55
535
  contentBlocks: ContentBlock[];
@@ -69,9 +549,13 @@ type PhaseContextSnapshot = {
69
549
  type PhaseExecution = {
70
550
  snapshot(): PhaseContextSnapshot;
71
551
  restore(snapshot: PhaseContextSnapshot): void;
72
- invokeModel(context: PhaseContext): Promise<ModelInvokeOutput>;
552
+ invokeModel(context: PhaseContext, options?: {
553
+ output?: "reply" | "internal";
554
+ }): Promise<ModelInvokeOutput>;
555
+ reportStatus(status: PhaseStatus): Promise<void>;
73
556
  executeTool(context: AgentContext, toolCall: ToolCall): Promise<ToolResult>;
74
557
  executeTools(context: AgentContext, toolCalls: readonly ToolCall[]): Promise<readonly ToolResult[]>;
558
+ interaction: PhaseInteractionDriver;
75
559
  };
76
560
 
77
561
  /**
@@ -106,14 +590,14 @@ interface ToolDefinition {
106
590
  /** Parameter schema (JSON Schema) */
107
591
  parameters: Record<string, unknown>;
108
592
  /** Execute the tool */
109
- execute: (args: unknown, signal?: AbortSignal) => Promise<ToolExecutionResult$1>;
593
+ execute: (args: unknown, signal?: AbortSignal) => Promise<ToolExecutionResult>;
110
594
  /** Optional: per-tool execution mode override */
111
595
  executionMode?: "sequential" | "parallel";
112
596
  }
113
597
  /**
114
598
  * Result from tool execution.
115
599
  */
116
- interface ToolExecutionResult$1 {
600
+ interface ToolExecutionResult {
117
601
  /** Content blocks to return to the LLM */
118
602
  content: Array<{
119
603
  type: string;
@@ -230,78 +714,6 @@ interface EventBus {
230
714
  count(event: string): number;
231
715
  }
232
716
 
233
- interface BeforePhaseEvent {
234
- type: "before_phase";
235
- phaseId: string;
236
- input: PhaseContext;
237
- }
238
- interface AfterPhaseEvent {
239
- type: "after_phase";
240
- phaseId: string;
241
- output: PhaseOutput;
242
- }
243
- interface BeforePromptEvent {
244
- type: "before_prompt";
245
- phaseId: string;
246
- input: PhaseContext;
247
- }
248
- interface BeforeToolCallEvent {
249
- type: "before_tool_call";
250
- tool: Tool$1;
251
- args: unknown;
252
- }
253
- interface AfterToolCallEvent {
254
- type: "after_tool_call";
255
- tool: Tool$1;
256
- result: ToolResult;
257
- }
258
- type HookEvent = BeforePhaseEvent | AfterPhaseEvent | BeforePromptEvent | BeforeToolCallEvent | AfterToolCallEvent;
259
- interface BeforePhaseResult {
260
- abort?: Outcome$1;
261
- skip?: {
262
- route: string;
263
- message: string;
264
- };
265
- input?: PhaseContext;
266
- }
267
- interface AfterPhaseResult {
268
- abort?: Outcome$1;
269
- retry?: PhaseContext;
270
- output?: PhaseOutput;
271
- }
272
- interface BeforePromptResult {
273
- input?: PhaseContext;
274
- }
275
- interface BeforeToolCallResult {
276
- allow: boolean;
277
- reason?: string;
278
- }
279
- interface AfterToolCallResult {
280
- result?: ToolResult;
281
- }
282
- interface HookResultMap {
283
- before_phase: BeforePhaseResult | undefined;
284
- after_phase: AfterPhaseResult | undefined;
285
- before_prompt: BeforePromptResult | undefined;
286
- before_tool_call: BeforeToolCallResult | undefined;
287
- after_tool_call: AfterToolCallResult | undefined;
288
- }
289
- type HookEventType = HookEvent["type"];
290
- type HookHandler<K extends HookEventType> = (event: Extract<HookEvent, {
291
- type: K;
292
- }>) => HookResultMap[K] | Promise<HookResultMap[K]> | void | Promise<void>;
293
- declare class HooksManager {
294
- private handlers;
295
- on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
296
- off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
297
- emit<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
298
- type: K;
299
- }>): Promise<void>;
300
- emitFirst<K extends HookEventType>(eventType: K, event: Extract<HookEvent, {
301
- type: K;
302
- }>): Promise<HookResultMap[K] | undefined>;
303
- }
304
-
305
717
  /**
306
718
  * @module extensions/context
307
719
  *
@@ -455,9 +867,23 @@ type ExtensionDisposer = () => void | Promise<void>;
455
867
  type ExtensionFactoryResult = void | ExtensionDisposer;
456
868
  type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<ExtensionFactoryResult>;
457
869
 
870
+ type PhaseStatusState = "running" | "completed";
871
+ /** Normalized status event exposed to Runtime consumers. */
872
+ type PhaseStatus = Readonly<{
873
+ state: PhaseStatusState;
874
+ /** Stable consumer-facing status identifier, e.g. `compacting`. */
875
+ kind: string;
876
+ /** Optional human-readable detail for UI/status consumers. */
877
+ message?: string;
878
+ /** Structured status payload. */
879
+ payload?: unknown;
880
+ }>;
458
881
  /** Unified phase output — model-driven routing is optional; programmatic phases may normalize omission to stop. */
459
882
  type PhaseOutput = {
460
- message: string;
883
+ /** User-visible assistant message. */
884
+ message?: string;
885
+ /** Final status update for non-conversational consumers. */
886
+ status?: PhaseStatus;
461
887
  /** Route to next phase, or "continue" to re-execute current phase, or "stop" to end. Undefined means no model route. */
462
888
  route?: string;
463
889
  /** Phase name that produced this output */
@@ -525,6 +951,8 @@ interface PhaseContext {
525
951
  interface Phase {
526
952
  /** Unique phase identity and display name. */
527
953
  name: string;
954
+ /** Rowan-owned built-in Phase; built-ins are never filtered or disabled. */
955
+ core?: boolean;
528
956
  /** Description */
529
957
  description: string;
530
958
  /** Restricted tools (undefined = all tools available) */
@@ -545,476 +973,174 @@ interface Phase {
545
973
  content: string;
546
974
  /** Model override for this phase (resolved from frontmatter) */
547
975
  model?: ModelRef;
976
+ /** Do not automatically inject this Phase into the model route catalog/context. */
977
+ disableAutoInvocation?: boolean;
978
+ /** Do not expose this Phase to direct user invocation. */
979
+ disableImplicitInvocation?: boolean;
548
980
  /** ExtensionAPI factory function (default export pattern) */
549
981
  factory?: (api: ExtensionAPI) => Promise<void>;
550
982
  /** Direct run function */
551
983
  run?: (context: PhaseContext, execution: PhaseExecution) => Promise<PhaseOutput | void>;
552
984
  }
553
985
  /**
554
- * Phase registry containing all loaded phases
555
- */
556
- interface PhaseRegistry {
557
- /** Map of phase name to Phase object */
558
- phases: Map<string, Phase>;
559
- /** Entry phase name (null until Agent applies its default phase) */
560
- entryPhaseId: string | null;
561
- }
562
-
563
- type ToolContext = Pick<AgentContext, "skills"> & {
564
- toolCallId: string;
565
- };
566
- type ToolExecutionMode = "sequential" | "parallel";
567
- type Tool$1<TArgs = unknown> = {
568
- name: string;
569
- description: string;
570
- parameters: Type.TSchema;
571
- /** One-line snippet shown in the system prompt tool list. */
572
- promptSnippet?: string;
573
- /** Additional guidelines appended to the system prompt when this tool is active. */
574
- promptGuidelines?: string[];
575
- /** Whether this tool can run concurrently with others. Default: "parallel". */
576
- executionMode?: ToolExecutionMode;
577
- execute(args: TArgs, context: ToolContext, signal?: AbortSignal): Promise<ToolResult>;
578
- };
579
- /** Context snapshot passed into the low-level agent loop. */
580
- type AgentContext = {
581
- /** System prompt included with the request. */
582
- systemPrompt: string;
583
- /** Transcript visible to the model. */
584
- messages: AgentMessage[];
585
- /** Tools available for this run. */
586
- tools: Tool$1[];
587
- /** Skills available for this run. */
588
- skills: Skill[];
589
- /** Custom phases for this run. Agent normalizes this with the built-in default phase. */
590
- phases?: PhaseRegistry;
591
- };
592
-
593
- /**
594
- * `root` anchors relative paths and the Bash working directory. It is not a
595
- * filesystem sandbox: core Tools use the permissions of the host process.
596
- */
597
- type CoreToolContext = {
598
- root?: string;
599
- maxReadBytes?: number;
600
- bashTimeoutMs?: number;
601
- maxBashOutputBytes?: number;
602
- };
603
-
604
- type PhaseRegistrySelection = Readonly<{
605
- entryPhaseId: string | null;
606
- phaseIds: readonly string[];
607
- }>;
608
- type AgentDefinition = Readonly<{
609
- name: string;
610
- description: string;
611
- prompt: string;
612
- tools?: readonly string[];
613
- skills?: readonly string[];
614
- /** Host-supplied Skills private to this Agent Definition/Bundle. */
615
- bundledSkills?: readonly Skill[];
616
- phases?: PhaseRegistrySelection;
617
- contexts?: readonly string[];
618
- model?: ModelRef;
619
- }>;
620
- /** Parse one Markdown definition using the same frontmatter vocabulary as Phase resources. */
621
- declare function parseAgentDefinition(raw: string): AgentDefinition;
622
-
623
- type ResourceKind = "agent" | "tool" | "skill" | "phase";
624
- type ResourceSourceId = string;
625
- /** Rowan-native contribution aliases. Hosts may adapt their domain handlers to
626
- * these existing Tool/Phase lifecycles without importing host Scope types. */
627
- type ToolContribution = Tool;
628
- type PhaseContribution = Phase;
629
- type ResourceView = Readonly<{
630
- agents: readonly ResourceSourceId[];
631
- tools: readonly ResourceSourceId[];
632
- skills: readonly ResourceSourceId[];
633
- phases: readonly ResourceSourceId[];
634
- }>;
635
- type ResourceRef = Readonly<{
636
- kind: ResourceKind;
637
- sourceId: ResourceSourceId;
638
- name: string;
639
- }>;
640
- type ResourceDiagnostic = Readonly<{
641
- kind: "invalid" | "missing" | "collision";
642
- sourceId: ResourceSourceId;
643
- message: string;
644
- path?: string;
645
- }>;
646
- type LoadResult = Readonly<{
647
- revision: string;
648
- registered: readonly ResourceRef[];
649
- skipped: readonly ResourceDiagnostic[];
650
- }>;
651
- type LoadInput<T> = Readonly<{
652
- sourceId: ResourceSourceId;
653
- directory?: string;
654
- values?: readonly T[];
655
- }>;
656
- type ResolvedResourceView = Readonly<{
657
- agents: readonly AgentDefinition[];
658
- tools: readonly Tool[];
659
- skills: readonly Skill[];
660
- phases: readonly Phase[];
661
- revisions: Readonly<Record<ResourceKind, readonly string[]>>;
662
- refs: Readonly<Record<ResourceKind, readonly ResourceRef[]>>;
663
- }>;
664
- type ResourceRegistryErrorCode = "invalid_source_id" | "invalid_resource_name" | "resource_collision" | "resource_input_missing" | "resource_directory_not_supported" | "unknown_resource_source" | "implicit_source_protected";
665
- declare class ResourceRegistryError extends Error {
666
- readonly code: ResourceRegistryErrorCode;
667
- constructor(code: ResourceRegistryErrorCode, message: string);
668
- }
669
- type RegistryValue = AgentDefinition | Tool | Skill | Phase;
670
- /**
671
- * Runtime Resource Registry source transaction and view resolver.
672
- *
673
- * Directory normalization is intentionally added by the typed loader slice;
674
- * this first module owns only the atomic source/revision/collision semantics.
986
+ * Phase registry containing all loaded phases
675
987
  */
676
- declare class ResourceRegistry {
677
- private readonly sources;
678
- /** Sources registered by the bootstrap boundary (currently Extensions). */
679
- private readonly implicitSources;
680
- private revisionSequence;
681
- loadAgents(input: LoadInput<AgentDefinition>): Promise<LoadResult>;
682
- loadSkills(input: LoadInput<Skill>): Promise<LoadResult>;
683
- loadPhases(input: LoadInput<Phase>): Promise<LoadResult>;
684
- loadTools(input: Readonly<{
685
- sourceId: ResourceSourceId;
686
- values: readonly ToolContribution[];
687
- }>): Promise<LoadResult>;
688
- unload(input: Readonly<{
689
- kind: ResourceKind;
690
- sourceId: ResourceSourceId;
691
- }>): Promise<LoadResult>;
692
- resolveView(view: ResourceView): ResolvedResourceView;
693
- /** Mark one already-loaded source as implicit for every Resource View. */
694
- protected markImplicit(kind: ResourceKind, sourceId: ResourceSourceId): void;
695
- /** Bootstrap-only helper for replacing an implicit contribution source. */
696
- protected replaceImplicit<T extends RegistryValue>(kind: ResourceKind, sourceId: ResourceSourceId, values: readonly T[]): Promise<LoadResult>;
697
- protected hasImplicit(kind: ResourceKind, sourceId: ResourceSourceId): boolean;
698
- private withImplicit;
699
- private collect;
700
- private commit;
701
- private resolveKind;
702
- private resolveRevisions;
703
- private resolveRefs;
704
- private sourcesFor;
705
- private nextRevision;
988
+ interface PhaseRegistry {
989
+ /** Map of phase name to Phase object */
990
+ phases: Map<string, Phase>;
991
+ /** Entry phase name (null until Agent applies its default phase) */
992
+ entryPhaseId: string | null;
706
993
  }
707
994
 
708
- /** Durable and transient DTOs owned by the event-driven Agent Runtime. */
709
- declare const opaqueIdBrand: unique symbol;
710
- type OpaqueId<Kind extends string> = string & {
711
- readonly [opaqueIdBrand]: Kind;
712
- };
713
- type AgentId = OpaqueId<"AgentId">;
714
- type RunId = OpaqueId<"RunId">;
715
- type MessageId = OpaqueId<"MessageId">;
716
- type InputRequestId = OpaqueId<"InputRequestId">;
717
- type ToolCallId = OpaqueId<"ToolCallId">;
718
- type EventId = OpaqueId<"EventId">;
719
- type ExecutionId = OpaqueId<"ExecutionId">;
720
- type OutcomeId = OpaqueId<"OutcomeId">;
721
- type ConfigToken = OpaqueId<"ConfigToken">;
722
- type OwnerToken = OpaqueId<"OwnerToken">;
723
- type EventCursor = OpaqueId<"EventCursor">;
724
- type AgentListCursor = OpaqueId<"AgentListCursor">;
725
- type RunListCursor = OpaqueId<"RunListCursor">;
726
- type JsonPrimitive = null | boolean | number | string;
727
- type JsonValue = JsonPrimitive | readonly JsonValue[] | {
728
- readonly [key: string]: JsonValue;
995
+ type ToolContext = Pick<AgentContext, "skills"> & {
996
+ toolCallId: string;
729
997
  };
730
- type JsonObject = Readonly<Record<string, JsonValue>>;
731
- type Metadata = JsonObject;
732
- type TextContent = Readonly<{
733
- type: "text";
734
- text: string;
735
- }>;
736
- type ImageContent = Readonly<{
737
- type: "image";
738
- data: string;
739
- mimeType: string;
740
- }>;
741
- type ThinkingContent = Readonly<{
742
- type: "thinking";
743
- thinking: string;
744
- signature?: string;
745
- }>;
746
- type ToolUseContent = Readonly<{
747
- type: "tool_use";
748
- toolCallId: ToolCallId;
749
- /** Provider/model correlation, retained only to reconstruct the next request. */
750
- providerToolCallId?: string;
751
- name: string;
752
- input: JsonValue;
753
- }>;
754
- type ToolExecutionResult = Readonly<{
755
- ok: true;
756
- content: JsonValue;
757
- }> | Readonly<{
758
- ok: false;
759
- content: JsonValue;
760
- error: string;
761
- }>;
762
- type DurableToolResult = Readonly<{
763
- toolCallId: ToolCallId;
764
- toolName: string;
765
- }> & ToolExecutionResult;
766
- type ToolResultContent = Readonly<{
767
- type: "tool_result";
768
- toolCallId: ToolCallId;
769
- /** Provider/model correlation, retained only to reconstruct the next request. */
770
- providerToolCallId?: string;
771
- result: ToolExecutionResult;
772
- }>;
773
- type UserContent = string | readonly (TextContent | ImageContent)[];
774
- type AssistantContent = string | readonly (TextContent | ThinkingContent | ToolUseContent)[];
775
- type ToolMessageContent = readonly [ToolResultContent, ...ToolResultContent[]];
776
- type MessageContent = UserContent | AssistantContent | ToolMessageContent;
777
- type MessageBase = Readonly<{
778
- id: MessageId;
779
- agentId: AgentId;
780
- runId: RunId;
781
- /** Monotonic active revision. Omitted on legacy/initial messages and read as 0. */
782
- messageRevision?: number;
783
- metadata?: Metadata;
784
- sequenceWithinRun: number;
785
- createdAt: string;
786
- }>;
787
- type UserMessage = MessageBase & Readonly<{
788
- role: "user";
789
- content: UserContent;
790
- }>;
791
- type AssistantMessage = MessageBase & Readonly<{
792
- role: "assistant";
793
- content: AssistantContent;
794
- interrupted?: boolean;
795
- }>;
796
- type ToolMessage = MessageBase & Readonly<{
797
- role: "tool";
798
- content: ToolMessageContent;
799
- }>;
800
- type Message = UserMessage | AssistantMessage | ToolMessage;
801
- type Outcome = Readonly<{
802
- id: OutcomeId;
803
- message: string;
804
- payload?: JsonValue;
805
- toolResults?: readonly DurableToolResult[];
806
- }>;
807
- type RunState = "queued" | "running" | "input_required" | "completed" | "failed" | "cancelled";
808
- type RunFailure = Readonly<{
809
- code: "configuration_unavailable";
810
- message: string;
811
- }> | Readonly<{
812
- code: "checkpoint_incompatible";
813
- message: string;
814
- expected: Readonly<{
815
- codec: string;
816
- versions: readonly number[];
817
- }>;
818
- actual: Readonly<{
819
- codec: string;
820
- version: number;
821
- }>;
822
- }> | Readonly<{
823
- code: "runtime_interrupted";
824
- message: string;
825
- ownerEpoch: number;
826
- }> | Readonly<{
827
- code: "tool_indeterminate";
828
- message: string;
829
- toolCallIds: readonly [ToolCallId, ...ToolCallId[]];
830
- }> | Readonly<{
831
- code: "execution_failed";
832
- message: string;
833
- details?: JsonValue;
834
- }>;
835
- type QueuedRunFailure = Extract<RunFailure, {
836
- code: "configuration_unavailable" | "checkpoint_incompatible";
837
- }>;
838
- type RunningRunFailure = Extract<RunFailure, {
839
- code: "runtime_interrupted" | "tool_indeterminate" | "execution_failed";
840
- }>;
841
- type ToolCallState = "pending" | "running" | "completed" | "failed" | "indeterminate";
842
- type ToolCallSnapshotBase = Readonly<{
843
- id: ToolCallId;
844
- providerToolCallId: string;
845
- agentId: AgentId;
846
- runId: RunId;
847
- executionId: ExecutionId;
848
- requestMessageId: MessageId;
998
+ type ToolExecutionMode = "sequential" | "parallel";
999
+ type Tool$1<TArgs = unknown> = {
849
1000
  name: string;
850
- args: JsonValue;
851
- createdAt: string;
852
- updatedAt: string;
853
- }>;
854
- type ToolCallSnapshot = ToolCallSnapshotBase & (Readonly<{
855
- state: "pending";
856
- }> | Readonly<{
857
- state: "running";
858
- }> | Readonly<{
859
- state: "completed";
860
- result: DurableToolResult & Readonly<{
861
- ok: true;
862
- }>;
863
- resultMessageId: MessageId;
864
- }> | Readonly<{
865
- state: "failed";
866
- result: DurableToolResult & Readonly<{
867
- ok: false;
868
- }>;
869
- resultMessageId: MessageId;
870
- }> | Readonly<{
871
- state: "indeterminate";
872
- result: DurableToolResult & Readonly<{
873
- ok: false;
874
- }>;
875
- resultMessageId: MessageId;
876
- reason: string;
877
- }>);
878
- type DurableEventBase = Readonly<{
879
- id: EventId;
880
- schemaVersion: 1;
881
- cursor: EventCursor;
882
- durability: "durable";
883
- agentId: AgentId;
884
- runId: RunId;
885
- runRevision: number;
886
- metadata?: Metadata;
887
- createdAt: string;
1001
+ /** Rowan-owned Core Tool; Core Tools bypass Phase filtering. */
1002
+ core?: boolean;
1003
+ description: string;
1004
+ parameters: Type.TSchema;
1005
+ /** One-line snippet shown in the system prompt tool list. */
1006
+ promptSnippet?: string;
1007
+ /** Additional guidelines appended to the system prompt when this tool is active. */
1008
+ promptGuidelines?: string[];
1009
+ /** Whether this tool can run concurrently with others. Default: "parallel". */
1010
+ executionMode?: ToolExecutionMode;
1011
+ execute(args: TArgs, context: ToolContext, signal?: AbortSignal): Promise<ToolResult>;
1012
+ };
1013
+ /** Context snapshot passed into the low-level agent loop. */
1014
+ type AgentContext = {
1015
+ /** System prompt included with the request. */
1016
+ systemPrompt: string;
1017
+ /** Transcript visible to the model. */
1018
+ messages: AgentMessage[];
1019
+ /** Tools available for this run. */
1020
+ tools: Tool$1[];
1021
+ /** Skills available for this run. */
1022
+ skills: Skill[];
1023
+ /** Custom phases for this run. Agent normalizes this with the built-in default phase. */
1024
+ phases?: PhaseRegistry;
1025
+ };
1026
+
1027
+ /**
1028
+ * `root` anchors relative paths and the Bash working directory. It is not a
1029
+ * filesystem sandbox: core Tools use the permissions of the host process.
1030
+ */
1031
+ type CoreToolContext = {
1032
+ root?: string;
1033
+ /** Directory for complete Tool Result spill files. */
1034
+ archiveDir?: string;
1035
+ maxReadBytes?: number;
1036
+ maxReadLines?: number;
1037
+ bashTimeoutMs?: number;
1038
+ maxBashOutputBytes?: number;
1039
+ };
1040
+
1041
+ type PhaseRegistrySelection = Readonly<{
1042
+ entryPhaseId: string | null;
1043
+ phaseIds: readonly string[];
888
1044
  }>;
889
- type MessageCommitted = DurableEventBase & Readonly<{
890
- kind: "message_committed";
891
- message: Message;
1045
+ type AgentDefinition = Readonly<{
1046
+ name: string;
1047
+ description: string;
1048
+ prompt: string;
1049
+ tools?: readonly string[];
1050
+ skills?: readonly string[];
1051
+ /** Host-supplied Skills private to this Agent Definition/Bundle. */
1052
+ bundledSkills?: readonly Skill[];
1053
+ phases?: PhaseRegistrySelection;
1054
+ contexts?: readonly string[];
1055
+ model?: ModelRef;
892
1056
  }>;
893
- type MessageRevised = DurableEventBase & Readonly<{
894
- kind: "message_revised";
895
- message: UserMessage;
896
- previousRevision: number;
897
- invalidatedRunIds: readonly RunId[];
898
- targetRunId: RunId;
899
- cutoffSequenceWithinRun: number;
1057
+ /** Parse one Markdown definition using the same frontmatter vocabulary as Phase resources. */
1058
+ declare function parseAgentDefinition(raw: string): AgentDefinition;
1059
+
1060
+ type ResourceKind = "agent" | "tool" | "skill" | "phase";
1061
+ type ResourceSourceId = string;
1062
+ /** Rowan-native contribution aliases. Hosts may adapt their domain handlers to
1063
+ * these existing Tool/Phase lifecycles without importing host Scope types. */
1064
+ type ToolContribution = Tool;
1065
+ type PhaseContribution = Phase;
1066
+ type ResourceView = Readonly<{
1067
+ agents: readonly ResourceSourceId[];
1068
+ tools: readonly ResourceSourceId[];
1069
+ skills: readonly ResourceSourceId[];
1070
+ phases: readonly ResourceSourceId[];
900
1071
  }>;
901
- type RunStateChanged = DurableEventBase & (Readonly<{
902
- kind: "run_state_changed";
903
- from: null;
904
- to: "queued";
905
- }> | Readonly<{
906
- kind: "run_state_changed";
907
- from: "input_required";
908
- to: "queued";
909
- }> | Readonly<{
910
- kind: "run_state_changed";
911
- from: "queued";
912
- to: "running";
913
- }> | Readonly<{
914
- kind: "run_state_changed";
915
- from: "running";
916
- to: "input_required";
917
- request: Readonly<{
918
- id: InputRequestId;
919
- phase: string;
920
- prompt: AssistantMessage;
921
- }>;
922
- }> | Readonly<{
923
- kind: "run_state_changed";
924
- from: "running";
925
- to: "completed";
926
- outcome: Outcome;
927
- output?: AssistantMessage;
928
- }> | Readonly<{
929
- kind: "run_state_changed";
930
- from: "queued";
931
- to: "failed";
932
- failure: QueuedRunFailure;
933
- }> | Readonly<{
934
- kind: "run_state_changed";
935
- from: "running";
936
- to: "failed";
937
- failure: RunningRunFailure;
938
- }> | Readonly<{
939
- kind: "run_state_changed";
940
- from: "queued" | "running" | "input_required";
941
- to: "cancelled";
942
- reason?: string;
943
- }>);
944
- type ToolStateChanged = DurableEventBase & (Readonly<{
945
- kind: "tool_state_changed";
946
- transition: Readonly<{
947
- from: null;
948
- to: "pending";
949
- }>;
950
- toolCall: Extract<ToolCallSnapshot, {
951
- state: "pending";
952
- }>;
953
- }> | Readonly<{
954
- kind: "tool_state_changed";
955
- transition: Readonly<{
956
- from: "pending";
957
- to: "running";
958
- }>;
959
- toolCall: Extract<ToolCallSnapshot, {
960
- state: "running";
961
- }>;
962
- }> | Readonly<{
963
- kind: "tool_state_changed";
964
- transition: Readonly<{
965
- from: "pending";
966
- to: "failed";
967
- }>;
968
- toolCall: Extract<ToolCallSnapshot, {
969
- state: "failed";
970
- }>;
971
- }> | Readonly<{
972
- kind: "tool_state_changed";
973
- transition: Readonly<{
974
- from: "running";
975
- to: "completed";
976
- }>;
977
- toolCall: Extract<ToolCallSnapshot, {
978
- state: "completed";
979
- }>;
980
- }> | Readonly<{
981
- kind: "tool_state_changed";
982
- transition: Readonly<{
983
- from: "running";
984
- to: "failed";
985
- }>;
986
- toolCall: Extract<ToolCallSnapshot, {
987
- state: "failed";
988
- }>;
989
- }> | Readonly<{
990
- kind: "tool_state_changed";
991
- transition: Readonly<{
992
- from: "running";
993
- to: "indeterminate";
994
- }>;
995
- toolCall: Extract<ToolCallSnapshot, {
996
- state: "indeterminate";
997
- }>;
998
- }>);
999
- type DurableRunEvent = MessageCommitted | MessageRevised | RunStateChanged | ToolStateChanged;
1000
- type MessageDelta = Readonly<{
1001
- kind: "message_delta";
1002
- durability: "transient";
1003
- runId: RunId;
1004
- executionId: ExecutionId;
1005
- messageId: MessageId;
1006
- offset: number;
1007
- text: string;
1072
+ type ResourceRef = Readonly<{
1073
+ kind: ResourceKind;
1074
+ sourceId: ResourceSourceId;
1075
+ name: string;
1008
1076
  }>;
1009
- type ToolProgress = Readonly<{
1010
- kind: "tool_progress";
1011
- durability: "transient";
1012
- runId: RunId;
1013
- executionId: ExecutionId;
1014
- toolCallId: ToolCallId;
1015
- progress: JsonValue;
1077
+ type ResourceDiagnostic = Readonly<{
1078
+ kind: "invalid" | "missing" | "collision";
1079
+ sourceId: ResourceSourceId;
1080
+ message: string;
1081
+ path?: string;
1082
+ }>;
1083
+ type LoadResult = Readonly<{
1084
+ revision: string;
1085
+ registered: readonly ResourceRef[];
1086
+ skipped: readonly ResourceDiagnostic[];
1087
+ }>;
1088
+ type LoadInput<T> = Readonly<{
1089
+ sourceId: ResourceSourceId;
1090
+ directory?: string;
1091
+ values?: readonly T[];
1092
+ }>;
1093
+ type ResolvedResourceView = Readonly<{
1094
+ agents: readonly AgentDefinition[];
1095
+ tools: readonly Tool[];
1096
+ skills: readonly Skill[];
1097
+ phases: readonly Phase[];
1098
+ revisions: Readonly<Record<ResourceKind, readonly string[]>>;
1099
+ refs: Readonly<Record<ResourceKind, readonly ResourceRef[]>>;
1016
1100
  }>;
1017
- type RunEvent = DurableRunEvent | MessageDelta | ToolProgress;
1101
+ type ResourceRegistryErrorCode = "invalid_source_id" | "invalid_resource_name" | "resource_collision" | "resource_input_missing" | "resource_directory_not_supported" | "unknown_resource_source" | "implicit_source_protected";
1102
+ declare class ResourceRegistryError extends Error {
1103
+ readonly code: ResourceRegistryErrorCode;
1104
+ constructor(code: ResourceRegistryErrorCode, message: string);
1105
+ }
1106
+ type RegistryValue = AgentDefinition | Tool | Skill | Phase;
1107
+ /**
1108
+ * Runtime Resource Registry source transaction and view resolver.
1109
+ *
1110
+ * Directory normalization is intentionally added by the typed loader slice;
1111
+ * this first module owns only the atomic source/revision/collision semantics.
1112
+ */
1113
+ declare class ResourceRegistry {
1114
+ private readonly sources;
1115
+ /** Sources registered by the bootstrap boundary (currently Extensions). */
1116
+ private readonly implicitSources;
1117
+ private revisionSequence;
1118
+ loadAgents(input: LoadInput<AgentDefinition>): Promise<LoadResult>;
1119
+ loadSkills(input: LoadInput<Skill>): Promise<LoadResult>;
1120
+ loadPhases(input: LoadInput<Phase>): Promise<LoadResult>;
1121
+ loadTools(input: Readonly<{
1122
+ sourceId: ResourceSourceId;
1123
+ values: readonly ToolContribution[];
1124
+ }>): Promise<LoadResult>;
1125
+ unload(input: Readonly<{
1126
+ kind: ResourceKind;
1127
+ sourceId: ResourceSourceId;
1128
+ }>): Promise<LoadResult>;
1129
+ resolveView(view: ResourceView): ResolvedResourceView;
1130
+ /** Mark one already-loaded source as implicit for every Resource View. */
1131
+ protected markImplicit(kind: ResourceKind, sourceId: ResourceSourceId): void;
1132
+ /** Bootstrap-only helper for replacing an implicit contribution source. */
1133
+ protected replaceImplicit<T extends RegistryValue>(kind: ResourceKind, sourceId: ResourceSourceId, values: readonly T[]): Promise<LoadResult>;
1134
+ protected hasImplicit(kind: ResourceKind, sourceId: ResourceSourceId): boolean;
1135
+ private withImplicit;
1136
+ private collect;
1137
+ private commit;
1138
+ private resolveKind;
1139
+ private resolveRevisions;
1140
+ private resolveRefs;
1141
+ private sourcesFor;
1142
+ private nextRevision;
1143
+ }
1018
1144
 
1019
1145
  /**
1020
1146
  * Extension runner — manages extension loading and hook execution.
@@ -1276,6 +1402,28 @@ type UserInput = string | Readonly<{
1276
1402
  metadata?: Metadata;
1277
1403
  }>;
1278
1404
  type HistorySeed = readonly Message[];
1405
+ type ContextStatus = Readonly<{
1406
+ tokens: number;
1407
+ contextWindow: number;
1408
+ percent: number;
1409
+ thresholdTokens: number;
1410
+ estimated: boolean;
1411
+ coveredThrough?: Readonly<{
1412
+ messageId: MessageId;
1413
+ sequence: number;
1414
+ }>;
1415
+ }>;
1416
+ type ContextCompactionRecord = Readonly<{
1417
+ id: string;
1418
+ agentId: AgentId;
1419
+ summary: string;
1420
+ coveredThrough?: Readonly<{
1421
+ messageId: MessageId;
1422
+ sequence: number;
1423
+ }>;
1424
+ instructions?: string;
1425
+ createdAt: string;
1426
+ }>;
1279
1427
  type ToolInvocationContext = Readonly<{
1280
1428
  agentId: AgentId;
1281
1429
  runId: RunId;
@@ -1288,9 +1436,11 @@ type ToolInvocationContext = Readonly<{
1288
1436
  }>;
1289
1437
  type Tool = Readonly<{
1290
1438
  name: string;
1439
+ /** Rowan-owned Core Tool; Core Tools bypass Definition/Phase filtering. */
1440
+ core?: boolean;
1291
1441
  description: string;
1292
1442
  parameters: Type.TSchema;
1293
- execute(args: JsonValue, context: ToolInvocationContext, signal: AbortSignal): Promise<ToolExecutionResult>;
1443
+ execute(args: JsonValue, context: ToolInvocationContext, signal: AbortSignal): Promise<ToolExecutionResult$1>;
1294
1444
  }>;
1295
1445
  type ContextCandidate = Readonly<{
1296
1446
  name: string;
@@ -1314,10 +1464,10 @@ type BeforeToolCall = (input: Readonly<{
1314
1464
  }>>;
1315
1465
  type AfterToolCall = (input: Readonly<{
1316
1466
  tool: Tool;
1317
- result: ToolExecutionResult;
1467
+ result: ToolExecutionResult$1;
1318
1468
  context: ToolInvocationContext;
1319
1469
  signal: AbortSignal;
1320
- }>) => ToolExecutionResult | Promise<ToolExecutionResult>;
1470
+ }>) => ToolExecutionResult$1 | Promise<ToolExecutionResult$1>;
1321
1471
  type AgentResources = Readonly<{
1322
1472
  tools: readonly Tool[];
1323
1473
  skills: readonly Skill[];
@@ -1328,6 +1478,16 @@ type AgentResources = Readonly<{
1328
1478
  resourceRefs?: readonly ResourceRef[];
1329
1479
  resourceRevisions?: Readonly<Record<ResourceKind, readonly string[]>>;
1330
1480
  }>;
1481
+ type InvocationSource = "auto" | "implicit" | "external";
1482
+ type InvocationCatalogEntry = Readonly<{
1483
+ kind: "phase" | "skill";
1484
+ name: string;
1485
+ description: string;
1486
+ core?: boolean;
1487
+ disableAutoInvocation: boolean;
1488
+ disableImplicitInvocation: boolean;
1489
+ filePath: string;
1490
+ }>;
1331
1491
  type AgentConfig = Readonly<{
1332
1492
  identity: string;
1333
1493
  definition: AgentDefinition;
@@ -1390,6 +1550,7 @@ type InputRequiredCommit = Readonly<{
1390
1550
  run: RunRecord;
1391
1551
  prompt: AssistantMessage;
1392
1552
  request: InputRequest;
1553
+ interactions: readonly PhaseInteraction[];
1393
1554
  }>;
1394
1555
  type ToolCallReservation = Readonly<{
1395
1556
  providerToolCallId: string;
@@ -1422,6 +1583,8 @@ type RunRecord = Readonly<{
1422
1583
  pinnedConfigToken?: ConfigToken;
1423
1584
  checkpoint?: ExecutionCheckpoint;
1424
1585
  openInputRequest?: InputRequest;
1586
+ openInteractions?: readonly PhaseInteraction[];
1587
+ interactionAnswers?: Readonly<Record<string, JsonValue>>;
1425
1588
  execution?: ExecutionToken;
1426
1589
  outcome?: Outcome;
1427
1590
  failure?: RunFailure;
@@ -1488,6 +1651,8 @@ type RunSnapshot = RunSnapshotBase & (Readonly<{
1488
1651
  phase: string;
1489
1652
  prompt: AssistantMessage;
1490
1653
  }>;
1654
+ interactions: readonly PhaseInteraction[];
1655
+ answers: Readonly<Record<string, JsonValue>>;
1491
1656
  }> | Readonly<{
1492
1657
  state: "completed";
1493
1658
  outcome: Outcome;
@@ -1504,6 +1669,8 @@ type RunBoundary = Readonly<{
1504
1669
  requestId: InputRequestId;
1505
1670
  phase: string;
1506
1671
  prompt: AssistantMessage;
1672
+ interactions: readonly PhaseInteraction[];
1673
+ answers: Readonly<Record<string, JsonValue>>;
1507
1674
  }> | Readonly<{
1508
1675
  type: "completed";
1509
1676
  outcome: Outcome;
@@ -1574,6 +1741,9 @@ interface OwnedStore {
1574
1741
  now?: string;
1575
1742
  retentionMs?: number;
1576
1743
  }): Promise<RetentionResult>;
1744
+ contextStatus(agentId: AgentId, contextWindow: number): Promise<ContextStatus>;
1745
+ contextMessages(agentId: AgentId, recentTokenBudget?: number): Promise<readonly Message[]>;
1746
+ commitContextCompaction(record: ContextCompactionRecord): Promise<ContextCompactionRecord>;
1577
1747
  createRun(input: {
1578
1748
  agentId: AgentId;
1579
1749
  input: UserInput;
@@ -1600,6 +1770,8 @@ interface OwnedStore {
1600
1770
  phase: string;
1601
1771
  prompt: AssistantMessage;
1602
1772
  checkpoint: ExecutionCheckpoint;
1773
+ interactions?: readonly PhaseInteraction[];
1774
+ interactionAnswers?: Readonly<Record<string, JsonValue>>;
1603
1775
  }): Promise<InputRequiredCommit>;
1604
1776
  answerInput(input: {
1605
1777
  runId: RunId;
@@ -1608,6 +1780,12 @@ interface OwnedStore {
1608
1780
  input: UserInput;
1609
1781
  messageId?: MessageId;
1610
1782
  }): Promise<RunRecord>;
1783
+ answerInteraction(input: {
1784
+ runId: RunId;
1785
+ interactionId: string;
1786
+ expectedRevision: number;
1787
+ input: JsonValue;
1788
+ }): Promise<RunRecord>;
1611
1789
  commitOutcome(input: {
1612
1790
  runId: RunId;
1613
1791
  execution: ExecutionToken;
@@ -1644,7 +1822,7 @@ interface OwnedStore {
1644
1822
  execution: ExecutionToken;
1645
1823
  expectedRevision: number;
1646
1824
  toolCallId: ToolCallId;
1647
- result: ToolExecutionResult;
1825
+ result: ToolExecutionResult$1;
1648
1826
  state: "completed" | "failed" | "indeterminate";
1649
1827
  reason?: string;
1650
1828
  }): Promise<ToolCommit>;
@@ -1703,6 +1881,10 @@ interface AgentRun {
1703
1881
  requestId: InputRequestId;
1704
1882
  input: UserInput;
1705
1883
  }): Promise<void>;
1884
+ respondInteraction(input: {
1885
+ interactionId: string;
1886
+ input: JsonValue;
1887
+ }): Promise<void>;
1706
1888
  cancel(reason?: string): Promise<RunBoundary>;
1707
1889
  }
1708
1890
  interface AgentRuntime$1 {
@@ -1742,6 +1924,16 @@ interface AgentRuntime$1 {
1742
1924
  metadata?: Metadata;
1743
1925
  }): Promise<AgentRun>;
1744
1926
  run(runId: RunId): AgentRun;
1927
+ contextStatus(agentId: AgentId, options?: {
1928
+ contextWindow?: number;
1929
+ }): Promise<ContextStatus>;
1930
+ compactContext(agentId: AgentId, options?: {
1931
+ instructions?: string;
1932
+ idempotencyKey?: string;
1933
+ }): Promise<AgentRun>;
1934
+ listInvocations(agentId: AgentId, options: {
1935
+ source: InvocationSource;
1936
+ }): Promise<readonly InvocationCatalogEntry[]>;
1745
1937
  history(agentId: AgentId): Promise<readonly Message[]>;
1746
1938
  listAgents(input?: {
1747
1939
  after?: AgentListCursor;
@@ -1777,6 +1969,7 @@ declare class AgentRuntime implements AgentRuntime$1 {
1777
1969
  private readonly executionDone;
1778
1970
  private readonly cancellationRequested;
1779
1971
  private readonly cancellationReasons;
1972
+ private readonly autoCompactionRuns;
1780
1973
  private readonly consumers;
1781
1974
  private readonly transientEvents;
1782
1975
  private readonly resources;
@@ -1822,6 +2015,13 @@ declare class AgentRuntime implements AgentRuntime$1 {
1822
2015
  retentionFloor: EventCursor;
1823
2016
  skipped?: "active_consumers" | "no_eligible_events";
1824
2017
  }>>;
2018
+ contextStatus(agentId: AgentId, options?: {
2019
+ contextWindow?: number;
2020
+ }): Promise<ContextStatus>;
2021
+ compactContext(agentId: AgentId, options?: {
2022
+ instructions?: string;
2023
+ idempotencyKey?: string;
2024
+ }): Promise<AgentRun>;
1825
2025
  start(agentId: AgentId, input: UserInput, options: {
1826
2026
  idempotencyKey: string;
1827
2027
  metadata?: Metadata;
@@ -1837,6 +2037,9 @@ declare class AgentRuntime implements AgentRuntime$1 {
1837
2037
  after?: RunListCursor;
1838
2038
  limit?: number;
1839
2039
  }): Promise<Page<RunSummary, RunListCursor>>;
2040
+ listInvocations(agentId: AgentId, options: {
2041
+ source: InvocationSource;
2042
+ }): Promise<readonly InvocationCatalogEntry[]>;
1840
2043
  consume(input: {
1841
2044
  consumerId: string;
1842
2045
  signal: AbortSignal;
@@ -1851,14 +2054,20 @@ declare class AgentRuntime implements AgentRuntime$1 {
1851
2054
  requestId: InputRequestId;
1852
2055
  input: UserInput;
1853
2056
  }): Promise<void>;
2057
+ respondInteraction(runId: RunId, input: {
2058
+ interactionId: string;
2059
+ input: JsonValue;
2060
+ }): Promise<void>;
1854
2061
  cancel(runId: RunId, reason?: string): Promise<RunBoundary>;
1855
2062
  private pump;
1856
2063
  private execute;
1857
2064
  private failQueued;
2065
+ private resolveContextWindow;
1858
2066
  private executeTool;
1859
2067
  private executeToolBatch;
1860
2068
  private executeReservedTool;
1861
2069
  private requireAgent;
2070
+ private archiveDirFor;
1862
2071
  private runConsumer;
1863
2072
  observe(runId: RunId, options?: {
1864
2073
  after?: EventCursor;
@@ -1891,6 +2100,7 @@ type InMemoryStoreState = Readonly<{
1891
2100
  nextAgentSequence: readonly (readonly [AgentId, number])[];
1892
2101
  nextReadySequence: readonly (readonly [AgentId, number])[];
1893
2102
  eventSequence: number;
2103
+ contextCompactions?: readonly (readonly [AgentId, ContextCompactionRecord])[];
1894
2104
  }>;
1895
2105
  declare class InMemoryStore implements DurableStore {
1896
2106
  private readonly incarnation;
@@ -1909,6 +2119,7 @@ declare class InMemoryStore implements DurableStore {
1909
2119
  private ownerEpoch;
1910
2120
  private eventSequence;
1911
2121
  private retentionFloor;
2122
+ private readonly contextCompactions;
1912
2123
  constructor(options?: {
1913
2124
  incarnation?: string;
1914
2125
  });
@@ -1973,6 +2184,8 @@ declare class InMemoryStore implements DurableStore {
1973
2184
  phase: string;
1974
2185
  prompt: AssistantMessage;
1975
2186
  checkpoint: ExecutionCheckpoint;
2187
+ interactions?: readonly PhaseInteraction[];
2188
+ interactionAnswers?: Readonly<Record<string, JsonValue>>;
1976
2189
  }): InputRequiredCommit;
1977
2190
  answerInput(lease: OwnerLease, input: {
1978
2191
  runId: RunId;
@@ -1981,6 +2194,12 @@ declare class InMemoryStore implements DurableStore {
1981
2194
  input: UserInput;
1982
2195
  messageId?: MessageId;
1983
2196
  }): RunRecord;
2197
+ answerInteraction(lease: OwnerLease, input: {
2198
+ runId: RunId;
2199
+ interactionId: string;
2200
+ expectedRevision: number;
2201
+ input: JsonValue;
2202
+ }): RunRecord;
1984
2203
  reserveToolCall(lease: OwnerLease, input: {
1985
2204
  runId: RunId;
1986
2205
  execution: ExecutionToken;
@@ -2014,7 +2233,7 @@ declare class InMemoryStore implements DurableStore {
2014
2233
  execution: ExecutionToken;
2015
2234
  expectedRevision: number;
2016
2235
  toolCallId: ToolCallId;
2017
- result: ToolExecutionResult;
2236
+ result: ToolExecutionResult$1;
2018
2237
  state: "completed" | "failed" | "indeterminate";
2019
2238
  reason?: string;
2020
2239
  }): ToolCommit;
@@ -2067,6 +2286,9 @@ declare class InMemoryStore implements DurableStore {
2067
2286
  private nextMessageSequence;
2068
2287
  private messagesForRun;
2069
2288
  history(lease: OwnerLease, agentId: AgentId): readonly Message[];
2289
+ contextStatus(lease: OwnerLease, agentId: AgentId, contextWindow: number): ContextStatus;
2290
+ contextMessages(lease: OwnerLease, agentId: AgentId, recentTokenBudget?: number): readonly Message[];
2291
+ commitContextCompaction(lease: OwnerLease, record: ContextCompactionRecord): ContextCompactionRecord;
2070
2292
  private activeHistory;
2071
2293
  private appendMessage;
2072
2294
  private appendTransition;
@@ -2078,6 +2300,10 @@ declare class InMemoryStore implements DurableStore {
2078
2300
 
2079
2301
  declare class SqliteStore implements DurableStore {
2080
2302
  private readonly database;
2303
+ private readonly archiveRoot;
2304
+ private readonly mirroredEventIds;
2305
+ private readonly mirroredCompactionIds;
2306
+ private mirroredAgents;
2081
2307
  private closed;
2082
2308
  private configured;
2083
2309
  constructor(filename?: string);
@@ -2086,6 +2312,8 @@ declare class SqliteStore implements DurableStore {
2086
2312
  leaseMs: number;
2087
2313
  }): Promise<OwnedStore>;
2088
2314
  close(): void;
2315
+ /** Filesystem location owned by this Store for one Agent's readable archive. */
2316
+ contextArchiveDir(agentId: AgentId): string;
2089
2317
  reserveAgent(lease: OwnerLease, input: {
2090
2318
  idempotencyKey: string;
2091
2319
  metadata?: Metadata;
@@ -2108,6 +2336,9 @@ declare class SqliteStore implements DurableStore {
2108
2336
  operationId: string;
2109
2337
  effectDigestConfirmation?: string;
2110
2338
  }): Promise<MessageRevisionResult>;
2339
+ contextStatus(lease: OwnerLease, agentId: AgentId, contextWindow: number): Promise<ContextStatus>;
2340
+ contextMessages(lease: OwnerLease, agentId: AgentId, recentTokenBudget?: number): Promise<readonly Message[]>;
2341
+ commitContextCompaction(lease: OwnerLease, record: ContextCompactionRecord): Promise<ContextCompactionRecord>;
2111
2342
  createRun(lease: OwnerLease, input: {
2112
2343
  agentId: AgentId;
2113
2344
  input: UserInput;
@@ -2136,6 +2367,8 @@ declare class SqliteStore implements DurableStore {
2136
2367
  phase: string;
2137
2368
  prompt: AssistantMessage;
2138
2369
  checkpoint: ExecutionCheckpoint;
2370
+ interactions?: readonly PhaseInteraction[];
2371
+ interactionAnswers?: Readonly<Record<string, JsonValue>>;
2139
2372
  }): Promise<InputRequiredCommit>;
2140
2373
  answerInput(lease: OwnerLease, input: {
2141
2374
  runId: RunId;
@@ -2144,6 +2377,12 @@ declare class SqliteStore implements DurableStore {
2144
2377
  input: UserInput;
2145
2378
  messageId?: MessageId;
2146
2379
  }): Promise<RunRecord>;
2380
+ answerInteraction(lease: OwnerLease, input: {
2381
+ runId: RunId;
2382
+ interactionId: string;
2383
+ expectedRevision: number;
2384
+ input: JsonValue;
2385
+ }): Promise<RunRecord>;
2147
2386
  commitOutcome(lease: OwnerLease, input: {
2148
2387
  runId: RunId;
2149
2388
  execution: ExecutionToken;
@@ -2185,7 +2424,7 @@ declare class SqliteStore implements DurableStore {
2185
2424
  execution: ExecutionToken;
2186
2425
  expectedRevision: number;
2187
2426
  toolCallId: ToolCallId;
2188
- result: ToolExecutionResult;
2427
+ result: ToolExecutionResult$1;
2189
2428
  state: "completed" | "failed" | "indeterminate";
2190
2429
  reason?: string;
2191
2430
  }): Promise<ToolCommit>;
@@ -2226,6 +2465,8 @@ declare class SqliteStore implements DurableStore {
2226
2465
  private readState;
2227
2466
  private writeState;
2228
2467
  private persistState;
2468
+ /** Append the semantic durable event mirror and remove deleted Agent sidecars. */
2469
+ private mirrorState;
2229
2470
  private requireMatchingOwner;
2230
2471
  private immediateTransaction;
2231
2472
  private readTransaction;
@@ -2252,7 +2493,7 @@ declare class InMemoryConfigProvider implements ConfigProvider {
2252
2493
  }
2253
2494
  declare function brandConfigToken(raw: unknown): ConfigToken;
2254
2495
 
2255
- type RuntimeErrorCode = "invalid_argument" | "runtime_closed" | "runtime_already_owned" | "runtime_ownership_lost" | "agent_not_found" | "run_not_found" | "run_state_conflict" | "message_revision_conflict" | "tool_effect_confirmation_required" | "input_request_conflict" | "idempotency_conflict" | "configuration_unavailable" | "checkpoint_incompatible" | "consumer_already_active" | "invalid_cursor" | "store_unavailable" | "unsupported_store_version";
2496
+ type RuntimeErrorCode = "invalid_argument" | "runtime_closed" | "runtime_already_owned" | "runtime_ownership_lost" | "agent_not_found" | "run_not_found" | "run_state_conflict" | "context_busy" | "message_history_compacted" | "message_revision_conflict" | "tool_effect_confirmation_required" | "input_request_conflict" | "idempotency_conflict" | "configuration_unavailable" | "checkpoint_incompatible" | "consumer_already_active" | "invalid_cursor" | "store_unavailable" | "unsupported_store_version";
2256
2497
  type RuntimeErrorDetails = {
2257
2498
  invalid_argument: Readonly<{
2258
2499
  argument: string;
@@ -2280,6 +2521,15 @@ type RuntimeErrorDetails = {
2280
2521
  expected: readonly RunState[];
2281
2522
  actual: RunState;
2282
2523
  }>;
2524
+ context_busy: Readonly<{
2525
+ agentId: AgentId;
2526
+ runId?: RunId;
2527
+ actual: RunState;
2528
+ }>;
2529
+ message_history_compacted: Readonly<{
2530
+ agentId: AgentId;
2531
+ messageId: MessageId;
2532
+ }>;
2283
2533
  message_revision_conflict: Readonly<{
2284
2534
  agentId: AgentId;
2285
2535
  messageId: MessageId;
@@ -2366,6 +2616,14 @@ declare function loadPhase(targetPath: string): Promise<Phase>;
2366
2616
  */
2367
2617
  declare function loadPhases(targetPath: string): Promise<PhaseRegistry>;
2368
2618
 
2619
+ declare const DEFAULT_PHASE_ID = "default";
2620
+ declare const STOP_PHASE_ID = "stop";
2621
+ declare const COMPACT_PHASE_ID = "compact";
2622
+ declare function createDefaultPhase(): Phase;
2623
+ declare function createStopPhase(): Phase;
2624
+ declare function createCompactPhase(): Phase;
2625
+ declare function createCorePhases(): Phase[];
2626
+
2369
2627
  /**
2370
2628
  * Extension loader — discovers and loads extensions from the filesystem.
2371
2629
  *
@@ -2399,4 +2657,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
2399
2657
 
2400
2658
  declare function createCoreTools(input?: CoreToolContext): Tool[];
2401
2659
 
2402
- export { type AfterToolCall, type AgentConfig, type AgentConfigRequest, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentResources, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type CoreToolContext, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, InMemoryConfigProvider, InMemoryStore, type InputRequest, type InputRequestId, type InputRequiredCommit, type JsonObject, type JsonPrimitive, type JsonValue, 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 OpaqueId, type Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecutionIdentity, type PhaseInvocation, type PhaseOutput, type PhaseRegistry, type PhaseRegistrySelection, type PhaseState, type ResolvedResourceView, type ResourceDiagnostic, type ResourceKind, type ResourceRef, ResourceRegistry, ResourceRegistryError, type ResourceRegistryErrorCode, type ResourceSourceId, type ResourceView, type RetentionResult, type RunBoundary, type RunClaim, type RunEvent, type RunFailure, type RunId, type RunListCursor, type RunRecord, type RunSnapshot, type RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, type Skill, SqliteStore, type TextContent, type ThinkingContent, type Tool, type ToolCallId, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolProgress, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, brandConfigToken, createCoreTools, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, materializeConfigurationSnapshot, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
2660
+ export { type AfterToolCall, type AgentConfig, type AgentConfigRequest, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentResources, 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 EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, InMemoryConfigProvider, InMemoryStore, type InputRequest, type InputRequestId, type InputRequiredCommit, type InvocationCatalogEntry, type InvocationSource, type JsonObject, type JsonPrimitive, type JsonValue, 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 OpaqueId, type Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecution, type PhaseExecutionIdentity, type PhaseInteraction, PhaseInteractionBoundary, PhaseInteractionCancelledError, type PhaseInteractionDriver, type PhaseInteractionKind, type PhaseInteractionState, type PhaseInteractionStatus, type PhaseInvocation, 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 RunEvent, type RunFailure, type RunId, type RunListCursor, type RunRecord, type RunSnapshot, type RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, STOP_PHASE_ID, type Skill, SqliteStore, type TextContent, type ThinkingContent, type Tool, type ToolCallId, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult$1 as ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolProgress, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, materializeConfigurationSnapshot, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };