@rowan-agent/agent 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -208,25 +208,11 @@ type PhaseMessageManager = {
208
208
  discard(messageId: string): void;
209
209
  };
210
210
 
211
- type UiSlot = "settings" | "model-picker";
212
- type UiContribution = {
213
- slot: "settings";
214
- id: string;
215
- title: string;
216
- description?: string;
217
- settings: SettingsDefinition;
218
- } | {
219
- slot: "model-picker";
220
- id: string;
221
- provider: string;
222
- status?: {
223
- kind: "ready" | "needs-setup" | "error";
224
- message?: string;
225
- };
226
- actions?: {
227
- id: string;
228
- label: string;
229
- }[];
211
+ type HostContribution = {
212
+ readonly kind: string;
213
+ readonly id: string;
214
+ } & {
215
+ readonly [key: string]: JsonValue;
230
216
  };
231
217
  interface ExtensionStateStore {
232
218
  get(key: string): Promise<JsonValue | undefined>;
@@ -592,10 +578,10 @@ interface ExtensionAPI {
592
578
  /** Get the message set by setMessage */
593
579
  getMessage(): string | undefined;
594
580
  };
595
- /** Declarative UI contributions — settings or model picker decorations. */
596
- ui: {
597
- /** Contribute declarative UI to a host slot. Returns a disposer to remove the contribution. */
598
- contribute(contribution: UiContribution): () => void;
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;
599
585
  };
600
586
  /** Extension manifest from package.json `rowan` field. */
601
587
  manifest?: ExtensionManifest;
@@ -700,7 +686,7 @@ declare class ExtensionRunner {
700
686
  private bound;
701
687
  private readonly errorListeners;
702
688
  private readonly capabilityListeners;
703
- private readonly uiContributionListeners;
689
+ private readonly hostContributionListeners;
704
690
  /** Current agent context — set by the agent before each phase */
705
691
  currentContext?: AgentContext;
706
692
  constructor(options?: ExtensionRunnerOptions);
@@ -766,13 +752,13 @@ declare class ExtensionRunner {
766
752
  * Returns an unsubscribe function.
767
753
  */
768
754
  onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
769
- /** Get all contributed UI elements across all extensions. */
770
- getUiContributions(): readonly UiContribution[];
755
+ /** Get all contributed host elements across all extensions. */
756
+ getHostContributions(): readonly HostContribution[];
771
757
  /**
772
- * Subscribe to UI contribution changes (contributions added, removed, or extensions disposed).
758
+ * Subscribe to host contribution changes (contributions added, removed, or extensions disposed).
773
759
  * Returns an unsubscribe function.
774
760
  */
775
- onUiContributionsChanged(listener: (contributions: readonly UiContribution[]) => void): () => void;
761
+ onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
776
762
  triggerUiAction(event: {
777
763
  contributionId: string;
778
764
  actionId: string;
@@ -847,8 +833,8 @@ declare class ExtensionRunner {
847
833
  private unregisterTool;
848
834
  private contributeCapability;
849
835
  private notifyCapabilitiesChanged;
850
- private contributeUi;
851
- private notifyUiContributionsChanged;
836
+ private contributeToHost;
837
+ private notifyHostContributionsChanged;
852
838
  private registerPhase;
853
839
  private registerPhaseDefinition;
854
840
  private unregisterPhase;
@@ -1600,8 +1586,8 @@ interface AgentRuntime$1 {
1600
1586
  }): Promise<DurableConsumer>;
1601
1587
  listCapabilities(): readonly ExtensionCapability[];
1602
1588
  onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
1603
- listUiContributions(): readonly UiContribution[];
1604
- onUiContributionsChanged(listener: (contributions: readonly UiContribution[]) => void): () => void;
1589
+ listHostContributions(): readonly HostContribution[];
1590
+ onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
1605
1591
  triggerUiAction(event: {
1606
1592
  contributionId: string;
1607
1593
  actionId: string;
@@ -2499,8 +2485,8 @@ declare class AgentRuntime implements AgentRuntime$1 {
2499
2485
  }): Promise<DurableConsumer>;
2500
2486
  listCapabilities(): readonly ExtensionCapability[];
2501
2487
  onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
2502
- listUiContributions(): readonly UiContribution[];
2503
- onUiContributionsChanged(listener: (contributions: readonly UiContribution[]) => void): () => void;
2488
+ listHostContributions(): readonly HostContribution[];
2489
+ onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
2504
2490
  triggerUiAction(event: {
2505
2491
  contributionId: string;
2506
2492
  actionId: string;
@@ -3306,4 +3292,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
3306
3292
 
3307
3293
  declare function createCoreTools(input?: CoreToolContext): Tool$1[];
3308
3294
 
3309
- 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, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, type InteractionRecord, 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 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 UiContribution, type UiSlot, 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 };
3295
+ 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 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 };
package/dist/index.js CHANGED
@@ -1800,32 +1800,20 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
1800
1800
  getNextPhase: () => nextPhase,
1801
1801
  getMessage: () => outputMessage
1802
1802
  },
1803
- ui: {
1803
+ host: {
1804
1804
  contribute: (contribution) => {
1805
1805
  assertActive();
1806
- if (!contribution || typeof contribution !== "object") {
1807
- throw new TypeError("UI contribution must be an object.");
1806
+ if (!contribution || typeof contribution !== "object" || Array.isArray(contribution)) {
1807
+ throw new TypeError("Host contribution must be an object.");
1808
1808
  }
1809
- if (contribution.slot !== "settings" && contribution.slot !== "model-picker") {
1810
- throw new TypeError(`Unsupported UI contribution slot: "${contribution.slot}".`);
1809
+ if (typeof contribution.kind !== "string" || contribution.kind.trim() === "") {
1810
+ throw new TypeError("Host contribution requires a non-empty kind.");
1811
1811
  }
1812
1812
  if (typeof contribution.id !== "string" || contribution.id.trim() === "") {
1813
- throw new TypeError("UI contribution requires a non-empty id.");
1814
- }
1815
- if (contribution.slot === "settings") {
1816
- if (typeof contribution.title !== "string") {
1817
- throw new TypeError("Settings UI contribution requires a title.");
1818
- }
1819
- if (!contribution.settings || typeof contribution.settings !== "object") {
1820
- throw new TypeError("Settings UI contribution requires a settings definition.");
1821
- }
1822
- }
1823
- if (contribution.slot === "model-picker") {
1824
- if (typeof contribution.provider !== "string" || contribution.provider.trim() === "") {
1825
- throw new TypeError("Model-picker UI contribution requires a provider.");
1826
- }
1813
+ throw new TypeError("Host contribution requires a non-empty id.");
1827
1814
  }
1828
- const dispose = options?.contributeUi ? options.contributeUi(contribution) : () => {
1815
+ assertJsonValue(contribution, "Host contribution");
1816
+ const dispose = options?.contributeToHost ? options.contributeToHost(contribution) : () => {
1829
1817
  };
1830
1818
  trackCleanup?.(dispose);
1831
1819
  return dispose;
@@ -5770,8 +5758,8 @@ var ExtensionRunner = class {
5770
5758
  errorListeners = /* @__PURE__ */ new Set();
5771
5759
  // Capability change listeners
5772
5760
  capabilityListeners = /* @__PURE__ */ new Set();
5773
- // UI contribution change listeners
5774
- uiContributionListeners = /* @__PURE__ */ new Set();
5761
+ // Host contribution change listeners
5762
+ hostContributionListeners = /* @__PURE__ */ new Set();
5775
5763
  /** Current agent context — set by the agent before each phase */
5776
5764
  currentContext;
5777
5765
  constructor(options) {
@@ -5875,7 +5863,7 @@ var ExtensionRunner = class {
5875
5863
  tools: /* @__PURE__ */ new Map(),
5876
5864
  phases: /* @__PURE__ */ new Set(),
5877
5865
  capabilities: /* @__PURE__ */ new Map(),
5878
- uiContributions: /* @__PURE__ */ new Map(),
5866
+ hostContributions: /* @__PURE__ */ new Map(),
5879
5867
  cleanup: [],
5880
5868
  runtime: createExtensionRuntime()
5881
5869
  };
@@ -5888,8 +5876,8 @@ var ExtensionRunner = class {
5888
5876
  if (extension.capabilities.size > 0) {
5889
5877
  this.notifyCapabilitiesChanged();
5890
5878
  }
5891
- if (extension.uiContributions.size > 0) {
5892
- this.notifyUiContributionsChanged();
5879
+ if (extension.hostContributions.size > 0) {
5880
+ this.notifyHostContributionsChanged();
5893
5881
  }
5894
5882
  } catch (error) {
5895
5883
  await this.rollbackExtension(extension);
@@ -6019,23 +6007,23 @@ var ExtensionRunner = class {
6019
6007
  this.capabilityListeners.add(listener);
6020
6008
  return () => this.capabilityListeners.delete(listener);
6021
6009
  }
6022
- /** Get all contributed UI elements across all extensions. */
6023
- getUiContributions() {
6010
+ /** Get all contributed host elements across all extensions. */
6011
+ getHostContributions() {
6024
6012
  const result = [];
6025
6013
  for (const ext of this.extensions) {
6026
- for (const contrib of ext.uiContributions.values()) {
6014
+ for (const contrib of ext.hostContributions.values()) {
6027
6015
  result.push(contrib);
6028
6016
  }
6029
6017
  }
6030
6018
  return Object.freeze(result);
6031
6019
  }
6032
6020
  /**
6033
- * Subscribe to UI contribution changes (contributions added, removed, or extensions disposed).
6021
+ * Subscribe to host contribution changes (contributions added, removed, or extensions disposed).
6034
6022
  * Returns an unsubscribe function.
6035
6023
  */
6036
- onUiContributionsChanged(listener) {
6037
- this.uiContributionListeners.add(listener);
6038
- return () => this.uiContributionListeners.delete(listener);
6024
+ onHostContributionsChanged(listener) {
6025
+ this.hostContributionListeners.add(listener);
6026
+ return () => this.hostContributionListeners.delete(listener);
6039
6027
  }
6040
6028
  triggerUiAction(event) {
6041
6029
  this.events.emit("ui.action", event);
@@ -6254,7 +6242,7 @@ var ExtensionRunner = class {
6254
6242
  registerTool: (tool) => this.registerTool(extension, tool),
6255
6243
  unregisterTool: (toolName) => this.unregisterTool(extension, toolName),
6256
6244
  contributeCapability: (contribution) => this.contributeCapability(extension, contribution),
6257
- contributeUi: (contribution) => this.contributeUi(extension, contribution),
6245
+ contributeToHost: (contribution) => this.contributeToHost(extension, contribution),
6258
6246
  context: extContext,
6259
6247
  manifest,
6260
6248
  trackCleanup: (cleanup) => extension.cleanup.push(cleanup),
@@ -6364,38 +6352,38 @@ var ExtensionRunner = class {
6364
6352
  }
6365
6353
  }
6366
6354
  }
6367
- contributeUi(extension, contribution) {
6368
- const key = `${contribution.slot}:${contribution.id}`;
6355
+ contributeToHost(extension, contribution) {
6356
+ const key = `${contribution.kind}:${contribution.id}`;
6369
6357
  const entry = {
6370
6358
  ...contribution
6371
6359
  };
6372
- extension.uiContributions.set(key, entry);
6360
+ extension.hostContributions.set(key, entry);
6373
6361
  if (this.extensions.includes(extension)) {
6374
- this.notifyUiContributionsChanged();
6362
+ this.notifyHostContributionsChanged();
6375
6363
  }
6376
6364
  let disposed = false;
6377
6365
  const dispose = () => {
6378
6366
  if (disposed) return;
6379
6367
  disposed = true;
6380
- if (extension.uiContributions.get(key) === entry) {
6381
- extension.uiContributions.delete(key);
6368
+ if (extension.hostContributions.get(key) === entry) {
6369
+ extension.hostContributions.delete(key);
6382
6370
  if (this.extensions.includes(extension)) {
6383
- this.notifyUiContributionsChanged();
6371
+ this.notifyHostContributionsChanged();
6384
6372
  }
6385
6373
  }
6386
6374
  };
6387
6375
  extension.cleanup.push(dispose);
6388
6376
  return dispose;
6389
6377
  }
6390
- notifyUiContributionsChanged() {
6391
- const contributions = this.getUiContributions();
6392
- for (const listener of this.uiContributionListeners) {
6378
+ notifyHostContributionsChanged() {
6379
+ const contributions = this.getHostContributions();
6380
+ for (const listener of this.hostContributionListeners) {
6393
6381
  try {
6394
6382
  listener(contributions);
6395
6383
  } catch (error) {
6396
6384
  this.emitError({
6397
6385
  extensionPath: "<runtime>",
6398
- event: "ui_contributions_changed",
6386
+ event: "host_contributions_changed",
6399
6387
  error: error instanceof Error ? error.message : String(error),
6400
6388
  stack: error instanceof Error ? error.stack : void 0
6401
6389
  });
@@ -6490,8 +6478,8 @@ var ExtensionRunner = class {
6490
6478
  for (const name of extension.phases) this.phases.delete(name);
6491
6479
  const hadCapabilities = extension.capabilities.size > 0;
6492
6480
  extension.capabilities.clear();
6493
- const hadUiContributions = extension.uiContributions.size > 0;
6494
- extension.uiContributions.clear();
6481
+ const hadHostContributions = extension.hostContributions.size > 0;
6482
+ extension.hostContributions.clear();
6495
6483
  for (const cleanup of [...extension.cleanup].reverse()) {
6496
6484
  await Promise.resolve().then(() => cleanup()).catch(() => void 0);
6497
6485
  }
@@ -6502,8 +6490,8 @@ var ExtensionRunner = class {
6502
6490
  if (hadCapabilities) {
6503
6491
  this.notifyCapabilitiesChanged();
6504
6492
  }
6505
- if (hadUiContributions) {
6506
- this.notifyUiContributionsChanged();
6493
+ if (hadHostContributions) {
6494
+ this.notifyHostContributionsChanged();
6507
6495
  }
6508
6496
  }
6509
6497
  };
@@ -7610,13 +7598,13 @@ var AgentRuntime = class _AgentRuntime {
7610
7598
  this.assertOpen();
7611
7599
  return this.resources.extensionRunner.onCapabilitiesChanged(listener);
7612
7600
  }
7613
- listUiContributions() {
7601
+ listHostContributions() {
7614
7602
  this.assertOpen();
7615
- return this.resources.extensionRunner.getUiContributions();
7603
+ return this.resources.extensionRunner.getHostContributions();
7616
7604
  }
7617
- onUiContributionsChanged(listener) {
7605
+ onHostContributionsChanged(listener) {
7618
7606
  this.assertOpen();
7619
- return this.resources.extensionRunner.onUiContributionsChanged(listener);
7607
+ return this.resources.extensionRunner.onHostContributionsChanged(listener);
7620
7608
  }
7621
7609
  triggerUiAction(event) {
7622
7610
  this.assertOpen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowan-agent/agent",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",