@rowan-agent/agent 0.33.0 → 0.35.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.
|
@@ -342,6 +342,7 @@ declare class ExtensionRunner {
|
|
|
342
342
|
private readonly skills;
|
|
343
343
|
private readonly pendingProviders;
|
|
344
344
|
private bound;
|
|
345
|
+
private readonly providersChangedListeners;
|
|
345
346
|
private readonly errorListeners;
|
|
346
347
|
private readonly resourceChangeListeners;
|
|
347
348
|
private runtimeAgents?;
|
|
@@ -496,6 +497,9 @@ declare class ExtensionRunner {
|
|
|
496
497
|
private registerSkillDefinition;
|
|
497
498
|
private unregisterSkill;
|
|
498
499
|
private loadRegisteredSkill;
|
|
500
|
+
/** Called after a Provider registration change has been applied to the model registry. */
|
|
501
|
+
onProvidersChanged(listener: () => void): () => void;
|
|
502
|
+
private notifyProvidersChanged;
|
|
499
503
|
private registerProvider;
|
|
500
504
|
private unregisterProvider;
|
|
501
505
|
private flushPendingProviders;
|
|
@@ -1267,6 +1271,8 @@ interface AgentRuntime {
|
|
|
1267
1271
|
signal: AbortSignal;
|
|
1268
1272
|
}>): void | Promise<void>;
|
|
1269
1273
|
}): Promise<DurableConsumer>;
|
|
1274
|
+
/** Called after an Extension registers, replaces or unregisters a Provider in the model registry. */
|
|
1275
|
+
onProvidersChanged(listener: () => void): () => void;
|
|
1270
1276
|
close(): Promise<void>;
|
|
1271
1277
|
}
|
|
1272
1278
|
type ConsumerRegistration = Readonly<{
|
|
@@ -1402,9 +1408,12 @@ interface ExtensionHost {
|
|
|
1402
1408
|
* Called once per extension load. The returned namespaces are merged into that extension's `api`
|
|
1403
1409
|
* (a name already used by Rowan's own API is an error). `dispose` runs when the extension is
|
|
1404
1410
|
* unloaded, reloaded or fails activation, so the host can drop everything that extension registered.
|
|
1411
|
+
* `kind` says whether the caller is an Extension or an Extension Phase, whose ids are separate.
|
|
1405
1412
|
*/
|
|
1406
|
-
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
1413
|
+
extendApi?(extensionId: string, kind: HostApiKind): HostApiExtension | undefined;
|
|
1407
1414
|
}
|
|
1415
|
+
/** What is asking for host namespaces: an Extension, or a Phase whose code is an Extension factory. */
|
|
1416
|
+
type HostApiKind = "extension" | "phase";
|
|
1408
1417
|
interface HostApiExtension {
|
|
1409
1418
|
readonly namespaces: Readonly<Record<string, unknown>>;
|
|
1410
1419
|
dispose?(): void;
|
|
@@ -2209,4 +2218,4 @@ declare class RunInteractionBoundary extends Error {
|
|
|
2209
2218
|
constructor(state: ExecutionState, interactions: readonly RunInteraction[]);
|
|
2210
2219
|
}
|
|
2211
2220
|
|
|
2212
|
-
export { type
|
|
2221
|
+
export { type AssistantMessage as $, type AgentRuntime as A, type RunEvent as B, type ContextStatus as C, type DurableRunEvent as D, type ExtensionHost as E, type DurableStore as F, type AgentRecord as G, type HostApiKind as H, type InvocationSource as I, type RunRecord as J, type ToolCallSnapshot as K, type LoadInput as L, type MessageId as M, type ContextCompactionRecord as N, type OwnerLease as O, type Phase as P, type OwnedStore as Q, type ResourceKind as R, type Skill as S, type Tool as T, type UserContent as U, type ConfigToken as V, type ExecutionId as W, type ContextCandidate as X, type RunClaim as Y, type RunFailure as Z, type ExecutionToken as _, type HostApiExtension as a, type MessageDelta as a$, type ExecutionCheckpoint as a0, type RunInteraction as a1, type ToolCommit as a2, type ToolCallReservation as a3, type ToolBatchCommit as a4, type Outcome as a5, type ConsumerRegistration as a6, type RetentionResult as a7, type ConfigProvider as a8, type ConfigurationSnapshot as a9, extensionSourceId as aA, isConfigurationSnapshot as aB, mergeToolCall as aC, parseAgentDefinition as aD, resolveConfigurationSnapshot as aE, type AfterToolCall as aF, type AssistantContent as aG, type BeforeToolCall as aH, type EventBus as aI, type EventId as aJ, type ExecOptions as aK, type ExecResult as aL, type ExtensionAPI as aM, type ExtensionAgentConsumerDisposer as aN, type ExtensionAgentsAPI as aO, type ExtensionContext as aP, type ExtensionFactory as aQ, type ExtensionStateStore as aR, type HookEvent as aS, type HookEventType as aT, type HookHandler as aU, type InteractionRecord as aV, type InternalModelLoopOptions as aW, type LiveInteractionEvent as aX, type MessageBase as aY, type MessageCommitted as aZ, type MessageContent as a_, type ConfigPutResult as aa, type ConfigResolution as ab, type PhaseRegistry as ac, type LoadedExtension as ad, type DefinitionLayer as ae, type ExtensionActivationError as af, type ExtensionActivationResult as ag, type ExtensionContribution as ah, ExtensionLifetimeError as ai, type ExtensionLifetimeErrorCode as aj, type ExtensionLoadInput as ak, type LoadExtensionsResult as al, type ModelRetry as am, type OpaqueId as an, type OwnerToken as ao, type PhaseRegistrySelection as ap, type ResolvedResourceView as aq, type ResourceDiagnostic as ar, type ResourceRef as as, ResourceRegistry as at, ResourceRegistryError as au, type ResourceRegistryErrorCode as av, type ResourceSourceId as aw, type ResourceView as ax, RuntimeBootstrapRegistry as ay, RuntimeExtensionLifetime as az, type AgentRuntimeOptions as b, type MessageRevised as b0, type ModelInvokeOutput as b1, type PhaseContext as b2, type PhaseExecution as b3, type PhaseExecutionIdentity as b4, type PhaseInput as b5, type PhaseInvocation as b6, type PhaseMessageManager as b7, type PhaseOutput as b8, type PhaseRegistration as b9, type ToolMessage as bA, type ToolMessageContent as bB, type ToolResultBlock as bC, type ToolResultRecord as bD, type ToolStateChanged as bE, type ToolUseBlock as bF, type UserMessage as bG, type WithdrawnUserInput as bH, type PhaseRunHandler as ba, type PhaseState as bb, type PhaseStatus as bc, type PhaseStatusState as bd, type RunEndEvent as be, RunInteractionBoundary as bf, RunInteractionCancelledError as bg, type RunInteractionDriver as bh, type RunInteractionState as bi, type RunInteractionStatus as bj, type RunStartEvent as bk, type RunStateChanged as bl, type SettingsBadge as bm, type SettingsControl as bn, type SettingsDefinition as bo, type SettingsItem as bp, type SettingsOption as bq, type SettingsSection as br, type SkillRegistration as bs, type ThinkingDelta as bt, type ToolCallContext as bu, type ToolCallDelta as bv, type ToolCallPhase as bw, type ToolCallPresentationInput as bx, type ToolCallPresentationOutput as by, type ToolInvocationContext as bz, type AgentDefinition as c, type LoadResult as d, type AgentConfiguration as e, type HistorySeed as f, type AgentId as g, type AgentDeletionRequest as h, type MessageRevisionResult as i, type RunId as j, type ToolCallId as k, type EventCursor as l, type UserInput as m, type AgentRun as n, type EntryPhaseSpec as o, type AgentListCursor as p, type Page as q, type AgentSummary as r, type RunState as s, type RunListCursor as t, type RunSummary as u, type InvocationCatalogEntry as v, type DurableConsumer as w, type RunSnapshot as x, type Message as y, type RunBoundary as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
2
2
|
export { _rowan_agent_models as models };
|
|
3
3
|
export { AudioBlock, ContentBlock, ImageBlock, JsonObject, JsonPrimitive, JsonValue, ResourceBlock, ResourceLinkBlock, RunInteractionKind, RunInteractionRequest, ScopeRef, StreamBlock, TextBlock, ThinkingBlock, ToolResult } from '@rowan-agent/models';
|
|
4
|
-
export {
|
|
4
|
+
export { aF as AfterToolCall, g as AgentId, p as AgentListCursor, n as AgentRun, r as AgentSummary, aG as AssistantContent, $ as AssistantMessage, aH as BeforeToolCall, X as ContextCandidate, N as ContextCompactionRecord, C as ContextStatus, w as DurableConsumer, D as DurableRunEvent, aI as EventBus, l as EventCursor, aJ as EventId, aK as ExecOptions, aL as ExecResult, aM as ExtensionAPI, aN as ExtensionAgentConsumerDisposer, aO as ExtensionAgentsAPI, aP as ExtensionContext, aQ as ExtensionFactory, aR as ExtensionStateStore, aS as HookEvent, aT as HookEventType, aU as HookHandler, aV as InteractionRecord, aW as InternalModelLoopOptions, aX as LiveInteractionEvent, y as Message, aY as MessageBase, aZ as MessageCommitted, a_ as MessageContent, a$ as MessageDelta, M as MessageId, b0 as MessageRevised, i as MessageRevisionResult, b1 as ModelInvokeOutput, q as Page, P as Phase, b2 as PhaseContext, b3 as PhaseExecution, b4 as PhaseExecutionIdentity, b5 as PhaseInput, b6 as PhaseInvocation, b7 as PhaseMessageManager, b8 as PhaseOutput, b9 as PhaseRegistration, ba as PhaseRunHandler, bb as PhaseState, bc as PhaseStatus, bd as PhaseStatusState, z as RunBoundary, be as RunEndEvent, B as RunEvent, Z as RunFailure, j as RunId, a1 as RunInteraction, bf as RunInteractionBoundary, bg as RunInteractionCancelledError, bh as RunInteractionDriver, bi as RunInteractionState, bj as RunInteractionStatus, t as RunListCursor, x as RunSnapshot, bk as RunStartEvent, s as RunState, bl as RunStateChanged, u as RunSummary, bm as SettingsBadge, bn as SettingsControl, bo as SettingsDefinition, bp as SettingsItem, bq as SettingsOption, br as SettingsSection, bs as SkillRegistration, bt as ThinkingDelta, T as Tool, bu as ToolCallContext, bv as ToolCallDelta, k as ToolCallId, bw as ToolCallPhase, bx as ToolCallPresentationInput, by as ToolCallPresentationOutput, K as ToolCallSnapshot, bz as ToolInvocationContext, bA as ToolMessage, bB as ToolMessageContent, bC as ToolResultBlock, bD as ToolResultRecord, bE as ToolStateChanged, bF as ToolUseBlock, U as UserContent, m as UserInput, bG as UserMessage, bH as WithdrawnUserInput } from './index-BFCvQd3i.js';
|
|
5
5
|
import 'typebox';
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExtensionHost, H as HostApiExtension, A as AgentRuntime$1,
|
|
2
|
-
export {
|
|
1
|
+
import { E as ExtensionHost, H as HostApiKind, a as HostApiExtension, A as AgentRuntime$1, b as AgentRuntimeOptions, L as LoadInput, c as AgentDefinition, d as LoadResult, S as Skill, P as Phase, T as Tool, R as ResourceKind, e as AgentConfiguration, f as HistorySeed, g as AgentId, h as AgentDeletionRequest, M as MessageId, U as UserContent, i as MessageRevisionResult, j as RunId, k as ToolCallId, l as EventCursor, C as ContextStatus, m as UserInput, n as AgentRun, o as EntryPhaseSpec, p as AgentListCursor, q as Page, r as AgentSummary, s as RunState, t as RunListCursor, u as RunSummary, I as InvocationSource, v as InvocationCatalogEntry, D as DurableRunEvent, w as DurableConsumer, x as RunSnapshot, y as Message, z as RunBoundary, B as RunEvent, F as DurableStore, G as AgentRecord, J as RunRecord, K as ToolCallSnapshot, N as ContextCompactionRecord, O as OwnerLease, Q as OwnedStore, V as ConfigToken, W as ExecutionId, X as ContextCandidate, Y as RunClaim, Z as RunFailure, _ as ExecutionToken, $ as AssistantMessage, a0 as ExecutionCheckpoint, a1 as RunInteraction, a2 as ToolCommit, a3 as ToolCallReservation, a4 as ToolBatchCommit, a5 as Outcome, a6 as ConsumerRegistration, a7 as RetentionResult, a8 as ConfigProvider, a9 as ConfigurationSnapshot, aa as ConfigPutResult, ab as ConfigResolution, ac as PhaseRegistry, ad as LoadedExtension } from './index-BFCvQd3i.js';
|
|
2
|
+
export { ae as DefinitionLayer, af as ExtensionActivationError, ag as ExtensionActivationResult, ah as ExtensionContribution, ai as ExtensionLifetimeError, aj as ExtensionLifetimeErrorCode, ak as ExtensionLoadInput, al as LoadExtensionsResult, am as ModelRetry, an as OpaqueId, ao as OwnerToken, ap as PhaseRegistrySelection, aq as ResolvedResourceView, ar as ResourceDiagnostic, as as ResourceRef, at as ResourceRegistry, au as ResourceRegistryError, av as ResourceRegistryErrorCode, aw as ResourceSourceId, ax as ResourceView, ay as RuntimeBootstrapRegistry, az as RuntimeExtensionLifetime, aA as extensionSourceId, aB as isConfigurationSnapshot, aC as mergeToolCall, aD as parseAgentDefinition, aE as resolveConfigurationSnapshot } from './index-BFCvQd3i.js';
|
|
3
3
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
4
4
|
import { JsonObject, JsonValue, ScopeRef, ModelRef, LlmTokenUsage, StreamBlock, ToolKind, ToolCallLocation, ToolCallContent, ToolResult, ToolCall, ToolCallUpdate } from '@rowan-agent/models';
|
|
5
5
|
import 'typebox';
|
|
@@ -9,12 +9,12 @@ declare class InMemoryExtensionHost implements ExtensionHost {
|
|
|
9
9
|
private readonly agentState;
|
|
10
10
|
private readonly globalState;
|
|
11
11
|
private readonly listeners;
|
|
12
|
-
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
12
|
+
extendApi?(extensionId: string, kind: HostApiKind): HostApiExtension | undefined;
|
|
13
13
|
constructor(options?: {
|
|
14
14
|
configs?: Record<string, Record<string, JsonObject>>;
|
|
15
15
|
agentState?: Record<string, Record<string, Record<string, JsonValue>>>;
|
|
16
16
|
globalState?: Record<string, Record<string, JsonValue>>;
|
|
17
|
-
extendApi?: (extensionId: string) => HostApiExtension | undefined;
|
|
17
|
+
extendApi?: (extensionId: string, kind: HostApiKind) => HostApiExtension | undefined;
|
|
18
18
|
});
|
|
19
19
|
setConfig(extensionId: string, config: JsonObject | null, scope?: ScopeRef): void;
|
|
20
20
|
getConfig(extensionId: string, scope?: ScopeRef): JsonObject | null;
|
|
@@ -136,6 +136,7 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
136
136
|
}>): void | Promise<void>;
|
|
137
137
|
}): Promise<DurableConsumer>;
|
|
138
138
|
private liveInteract;
|
|
139
|
+
onProvidersChanged(listener: () => void): () => void;
|
|
139
140
|
close(): Promise<void>;
|
|
140
141
|
snapshot(runId: RunId): Promise<RunSnapshot>;
|
|
141
142
|
history(agentId: AgentId): Promise<readonly Message[]>;
|
|
@@ -937,4 +938,4 @@ type CoreToolContext = {
|
|
|
937
938
|
/** Adapt the established host-filesystem Core Tools to the durable Runtime Tool contract. */
|
|
938
939
|
declare function createRuntimeCoreTools(input?: CoreToolContext): Tool[];
|
|
939
940
|
|
|
940
|
-
export { AgentConfiguration, AgentDefinition, AgentRecord, AgentRuntime, AgentRuntimeOptions, type AnyRuntimeError, COMPACT_PHASE_ID, ConfigProvider, ConfigPutResult, ConfigResolution, ConfigToken, ConfigurationSnapshot, type CoreToolContext, DEFAULT_PHASE_ID, DurableStore, EntryPhaseSpec, ExecutionCheckpoint, ExecutionId, ExecutionToken, ExtensionHost, type FrontmatterResult, HistorySeed, HostApiExtension, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, InvocationCatalogEntry, InvocationSource, LoadInput, LoadResult, LoadedExtension, Outcome, OwnerLease, PhaseRegistry, ResourceKind, RetentionResult, RunClaim, RunRecord, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, STOP_PHASE_ID, Skill, SqliteStore, brandConfigToken, createCompactPhase, createCorePhases, createRuntimeCoreTools as createCoreTools, createDefaultPhase, createStopPhase, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, parseFrontmatter };
|
|
941
|
+
export { AgentConfiguration, AgentDefinition, AgentRecord, AgentRuntime, AgentRuntimeOptions, type AnyRuntimeError, COMPACT_PHASE_ID, ConfigProvider, ConfigPutResult, ConfigResolution, ConfigToken, ConfigurationSnapshot, type CoreToolContext, DEFAULT_PHASE_ID, DurableStore, EntryPhaseSpec, ExecutionCheckpoint, ExecutionId, ExecutionToken, ExtensionHost, type FrontmatterResult, HistorySeed, HostApiExtension, HostApiKind, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, InvocationCatalogEntry, InvocationSource, LoadInput, LoadResult, LoadedExtension, Outcome, OwnerLease, PhaseRegistry, ResourceKind, RetentionResult, RunClaim, RunRecord, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, STOP_PHASE_ID, Skill, SqliteStore, brandConfigToken, createCompactPhase, createCorePhases, createRuntimeCoreTools as createCoreTools, createDefaultPhase, createStopPhase, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, parseFrontmatter };
|
package/dist/runtime.js
CHANGED
|
@@ -7840,6 +7840,7 @@ var ExtensionRunner = class {
|
|
|
7840
7840
|
// Provider management
|
|
7841
7841
|
pendingProviders = [];
|
|
7842
7842
|
bound = false;
|
|
7843
|
+
providersChangedListeners = /* @__PURE__ */ new Set();
|
|
7843
7844
|
// Error listeners
|
|
7844
7845
|
errorListeners = /* @__PURE__ */ new Set();
|
|
7845
7846
|
// Resource change listeners (for Registry live sync)
|
|
@@ -7946,7 +7947,7 @@ var ExtensionRunner = class {
|
|
|
7946
7947
|
async loadExtensions(extensions) {
|
|
7947
7948
|
for (const ext of extensions) {
|
|
7948
7949
|
const extensionId = ext.id ?? ext.manifest?.id ?? ext.name;
|
|
7949
|
-
const hostApi = this.host.extendApi?.(extensionId);
|
|
7950
|
+
const hostApi = this.host.extendApi?.(extensionId, "extension");
|
|
7950
7951
|
const extension = {
|
|
7951
7952
|
id: extensionId,
|
|
7952
7953
|
path: ext.path,
|
|
@@ -7988,7 +7989,7 @@ var ExtensionRunner = class {
|
|
|
7988
7989
|
skills: /* @__PURE__ */ new Set(),
|
|
7989
7990
|
cleanup: [],
|
|
7990
7991
|
runtime: createExtensionRuntime(),
|
|
7991
|
-
hostApi: this.host.extendApi?.(phase.name)
|
|
7992
|
+
hostApi: this.host.extendApi?.(phase.name, "phase")
|
|
7992
7993
|
};
|
|
7993
7994
|
let executeHandler;
|
|
7994
7995
|
const api = this.createExtensionAPI(extension, void 0, extension.hostApi?.namespaces, {
|
|
@@ -8052,6 +8053,7 @@ var ExtensionRunner = class {
|
|
|
8052
8053
|
this.extensions.length = 0;
|
|
8053
8054
|
this.activeExtensionPhases.clear();
|
|
8054
8055
|
this.resourceChangeListeners.clear();
|
|
8056
|
+
this.providersChangedListeners.clear();
|
|
8055
8057
|
this.phases.clear();
|
|
8056
8058
|
this._phaseCache = null;
|
|
8057
8059
|
this.skills.clear();
|
|
@@ -8515,9 +8517,24 @@ var ExtensionRunner = class {
|
|
|
8515
8517
|
const skill = await loadSkill(resolve5(extensionBase, registration));
|
|
8516
8518
|
await this.registerSkillDefinition(extension, skill, scope);
|
|
8517
8519
|
}
|
|
8520
|
+
/** Called after a Provider registration change has been applied to the model registry. */
|
|
8521
|
+
onProvidersChanged(listener) {
|
|
8522
|
+
this.providersChangedListeners.add(listener);
|
|
8523
|
+
return () => this.providersChangedListeners.delete(listener);
|
|
8524
|
+
}
|
|
8525
|
+
notifyProvidersChanged() {
|
|
8526
|
+
for (const listener of this.providersChangedListeners) {
|
|
8527
|
+
try {
|
|
8528
|
+
listener();
|
|
8529
|
+
} catch (err) {
|
|
8530
|
+
console.error("[extension-runner] Providers-changed listener failed:", err);
|
|
8531
|
+
}
|
|
8532
|
+
}
|
|
8533
|
+
}
|
|
8518
8534
|
registerProvider(config) {
|
|
8519
8535
|
if (this.bound) {
|
|
8520
8536
|
applyProviderRegistration(config);
|
|
8537
|
+
this.notifyProvidersChanged();
|
|
8521
8538
|
} else {
|
|
8522
8539
|
this.pendingProviders.push({ kind: "register", config });
|
|
8523
8540
|
}
|
|
@@ -8525,6 +8542,7 @@ var ExtensionRunner = class {
|
|
|
8525
8542
|
unregisterProvider(name) {
|
|
8526
8543
|
if (this.bound) {
|
|
8527
8544
|
applyProviderUnregistration(name);
|
|
8545
|
+
this.notifyProvidersChanged();
|
|
8528
8546
|
} else {
|
|
8529
8547
|
this.pendingProviders.push({ kind: "unregister", name });
|
|
8530
8548
|
}
|
|
@@ -8537,7 +8555,9 @@ var ExtensionRunner = class {
|
|
|
8537
8555
|
applyProviderUnregistration(action.name);
|
|
8538
8556
|
}
|
|
8539
8557
|
}
|
|
8558
|
+
const applied = this.pendingProviders.length > 0;
|
|
8540
8559
|
this.pendingProviders.length = 0;
|
|
8560
|
+
if (applied) this.notifyProvidersChanged();
|
|
8541
8561
|
}
|
|
8542
8562
|
getRegisteredPhase(name) {
|
|
8543
8563
|
return this.collectRegisteredPhases().get(name);
|
|
@@ -9786,6 +9806,9 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
9786
9806
|
});
|
|
9787
9807
|
});
|
|
9788
9808
|
}
|
|
9809
|
+
onProvidersChanged(listener) {
|
|
9810
|
+
return this.resources.extensionRunner.onProvidersChanged(listener);
|
|
9811
|
+
}
|
|
9789
9812
|
async close() {
|
|
9790
9813
|
if (this.closed) return;
|
|
9791
9814
|
this.closed = true;
|