@rowan-agent/agent 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +54 -9
  2. package/dist/index.js +5956 -5847
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -319,6 +319,8 @@ declare class InMemoryExtensionHost implements ExtensionHost {
319
319
  * - Tool registration support
320
320
  */
321
321
 
322
+ /** The Resource Source an Extension registration lands in: Global (`[]`) is `rowan.extensions`, any other Scope `rowan.extensions:<scopeToKey(scope)>`. */
323
+ declare function extensionSourceId(scope?: ScopeRef): string;
322
324
  type ExtensionRunnerOptions = {
323
325
  entryPhaseId?: string | null;
324
326
  cwd?: string;
@@ -452,12 +454,14 @@ declare class ExtensionRunner {
452
454
  }): void;
453
455
  getPhase(name: string): Phase | undefined;
454
456
  getPhases(): Phase[];
457
+ getRegisteredPhases(): readonly RegisteredPhase[];
455
458
  createPhaseRegistry(input?: {
456
459
  entryPhaseId?: string | null;
457
460
  }): PhaseRegistry;
458
461
  /** Adapt an extension RegisteredPhase to the core Phase type. */
459
- private adaptToPhase;
462
+ adaptToPhase(reg: RegisteredPhase): Phase;
460
463
  getSkills(): Skill[];
464
+ getRegisteredSkills(): readonly RegisteredSkill[];
461
465
  /**
462
466
  * Bind the runner — flushes pending provider registrations and
463
467
  * replaces runtime stubs with real implementations.
@@ -498,6 +502,7 @@ declare class ExtensionRunner {
498
502
  agentId?: string;
499
503
  toolCallId?: string;
500
504
  metadata?: Readonly<Record<string, unknown>>;
505
+ agentMetadata?: Readonly<Record<string, unknown>>;
501
506
  answer?: unknown;
502
507
  scope?: ScopeRef;
503
508
  turn?: JsonObject;
@@ -601,7 +606,9 @@ declare class RuntimeExtensionLifetime {
601
606
  activate(extensions: readonly LoadedExtension[]): Promise<ExtensionActivationResult>;
602
607
  tools(): readonly RegisteredTool[];
603
608
  phases(): readonly Phase[];
609
+ registeredPhases(): readonly RegisteredPhase[];
604
610
  skills(): readonly Skill[];
611
+ registeredSkills(): readonly RegisteredSkill[];
605
612
  get extensionRunner(): ExtensionRunner;
606
613
  get extensionHost(): ExtensionHost;
607
614
  onResourceChange(listener: (kind: "tool" | "phase" | "skill") => Promise<void> | void): () => void;
@@ -611,7 +618,7 @@ declare class RuntimeExtensionLifetime {
611
618
  /** Bootstrap-only Registry facade; its Extension method disappears after init. */
612
619
  declare class RuntimeBootstrapRegistry extends ResourceRegistry {
613
620
  private readonly extensions;
614
- private readonly extensionSourceId;
621
+ private readonly knownSources;
615
622
  private commitQueue;
616
623
  constructor(extensions?: RuntimeExtensionLifetime);
617
624
  private recommit;
@@ -1262,6 +1269,13 @@ interface AgentRuntime$1 {
1262
1269
  instructions?: string;
1263
1270
  idempotencyKey?: string;
1264
1271
  }): Promise<AgentRun>;
1272
+ runPhase(agentId: AgentId, options: {
1273
+ phase: string;
1274
+ payload?: JsonValue;
1275
+ input?: UserInput;
1276
+ yieldToInput?: boolean;
1277
+ idempotencyKey?: string;
1278
+ }): Promise<AgentRun>;
1265
1279
  listInvocations(agentId: AgentId, options: {
1266
1280
  source: InvocationSource;
1267
1281
  }): Promise<readonly InvocationCatalogEntry[]>;
@@ -1339,10 +1353,28 @@ interface SourceInfo {
1339
1353
  baseDir?: string;
1340
1354
  displayName?: string;
1341
1355
  }
1356
+ /** A loaded directory Bundle used by an extension. */
1357
+ type PhaseDefinition = Phase;
1342
1358
  /** Register a Phase by directory path or Phase object; PHASE.md and direct child Skills are loaded atomically when a path is supplied. */
1343
1359
  type PhaseRegistration = string | Phase;
1360
+ type RegisteredPhase = {
1361
+ definition: PhaseDefinition;
1362
+ source: {
1363
+ extensionPath: string;
1364
+ };
1365
+ sourceId: string;
1366
+ scope?: ScopeRef;
1367
+ };
1344
1368
  /** Register a Skill directory (containing SKILL.md) or a Skill object. Registering an existing name replaces it. */
1345
1369
  type SkillRegistration = string | Skill;
1370
+ type RegisteredSkill = {
1371
+ definition: Skill;
1372
+ source: {
1373
+ extensionPath: string;
1374
+ };
1375
+ sourceId: string;
1376
+ scope?: ScopeRef;
1377
+ };
1346
1378
  /**
1347
1379
  * Tool definition for registering LLM-callable tools via `api.tools.register()`.
1348
1380
  *
@@ -1400,6 +1432,8 @@ interface ToolDefinition {
1400
1432
  interface RegisteredTool {
1401
1433
  definition: ToolDefinition;
1402
1434
  sourceInfo: SourceInfo;
1435
+ sourceId: string;
1436
+ scope?: ScopeRef;
1403
1437
  }
1404
1438
  /**
1405
1439
  * Structured extension error with attribution.
@@ -1514,9 +1548,9 @@ interface ExtensionAPI {
1514
1548
  /** Tool capabilities — register and unregister custom tools. */
1515
1549
  tools: {
1516
1550
  /** Register a custom LLM-callable tool. */
1517
- register(tool: ToolDefinition): Promise<void>;
1551
+ register(tool: ToolDefinition, scope?: ScopeRef): Promise<void>;
1518
1552
  /** Unregister a previously registered tool by name. */
1519
- unregister(toolName: string): Promise<void>;
1553
+ unregister(toolName: string, scope?: ScopeRef): Promise<void>;
1520
1554
  };
1521
1555
  /** Capability contributions — advertise tools or features to the host. */
1522
1556
  capabilities: {
@@ -1533,9 +1567,9 @@ interface ExtensionAPI {
1533
1567
  /** Phase execution capabilities — provides Phase In/Out, phase identity, phase routing, and registration. */
1534
1568
  phases: {
1535
1569
  /** Register a Phase directory bundle or Phase object. */
1536
- register(phase: PhaseRegistration): Promise<void>;
1570
+ register(phase: PhaseRegistration, scope?: ScopeRef): Promise<void>;
1537
1571
  /** Unregister a previously registered phase by name. */
1538
- unregister(phaseName: string): void;
1572
+ unregister(phaseName: string, scope?: ScopeRef): Promise<void> | void;
1539
1573
  /** Phase In: get payload from previous phase */
1540
1574
  getPayload(): unknown;
1541
1575
  /** Phase Out: set payload for next phase */
@@ -1554,9 +1588,9 @@ interface ExtensionAPI {
1554
1588
  /** Skill capabilities — register and unregister standalone skills. */
1555
1589
  skills: {
1556
1590
  /** Register a Skill directory (containing SKILL.md) or a Skill object. Registering an existing name replaces it. */
1557
- register(skill: SkillRegistration): Promise<void>;
1591
+ register(skill: SkillRegistration, scope?: ScopeRef): Promise<void>;
1558
1592
  /** Unregister a previously registered Skill by name. */
1559
- unregister(skillName: string): void;
1593
+ unregister(skillName: string, scope?: ScopeRef): Promise<void> | void;
1560
1594
  };
1561
1595
  /** Extension manifest from package.json `rowan` field. */
1562
1596
  manifest?: ExtensionManifest;
@@ -1746,6 +1780,8 @@ interface Phase {
1746
1780
  skills?: Skill[];
1747
1781
  /** Forced next phase */
1748
1782
  target?: string;
1783
+ /** Additional system-prompt guidance while this Phase is in the auto route catalog. */
1784
+ promptGuidelines?: string[];
1749
1785
  /** Structural JSON-safe input defaults */
1750
1786
  input?: PhaseInput;
1751
1787
  /** If true, phase gets a fresh context when executed in parallel */
@@ -1800,6 +1836,8 @@ interface BeforeToolCallEvent {
1800
1836
  readonly agentId?: string;
1801
1837
  readonly toolCallId?: string;
1802
1838
  readonly metadata?: Readonly<Record<string, unknown>>;
1839
+ /** The invoking Agent's metadata, as the Tool's own call context carries it. */
1840
+ readonly agentMetadata?: Readonly<Record<string, unknown>>;
1803
1841
  readonly answer?: unknown;
1804
1842
  readonly scope?: ScopeRef;
1805
1843
  readonly turn?: JsonObject;
@@ -2503,6 +2541,13 @@ declare class AgentRuntime implements AgentRuntime$1 {
2503
2541
  contextStatus(agentId: AgentId, options?: {
2504
2542
  contextWindow?: number;
2505
2543
  }): Promise<ContextStatus>;
2544
+ runPhase(agentId: AgentId, options: {
2545
+ phase: string;
2546
+ payload?: JsonValue;
2547
+ input?: UserInput;
2548
+ yieldToInput?: boolean;
2549
+ idempotencyKey?: string;
2550
+ }): Promise<AgentRun>;
2506
2551
  compactContext(agentId: AgentId, options?: {
2507
2552
  input?: UserInput;
2508
2553
  instructions?: string;
@@ -3357,4 +3402,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
3357
3402
 
3358
3403
  declare function createCoreTools(input?: CoreToolContext): Tool$1[];
3359
3404
 
3360
- 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 HostApiExtension, 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, type SkillRegistration, 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 };
3405
+ 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 HostApiExtension, 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, type SkillRegistration, 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, extensionSourceId, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, mergeToolCall, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };