@rowan-agent/agent 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1408,9 +1408,12 @@ interface ExtensionHost {
|
|
|
1408
1408
|
* Called once per extension load. The returned namespaces are merged into that extension's `api`
|
|
1409
1409
|
* (a name already used by Rowan's own API is an error). `dispose` runs when the extension is
|
|
1410
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.
|
|
1411
1412
|
*/
|
|
1412
|
-
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
1413
|
+
extendApi?(extensionId: string, kind: HostApiKind): HostApiExtension | undefined;
|
|
1413
1414
|
}
|
|
1415
|
+
/** What is asking for host namespaces: an Extension, or a Phase whose code is an Extension factory. */
|
|
1416
|
+
type HostApiKind = "extension" | "phase";
|
|
1414
1417
|
interface HostApiExtension {
|
|
1415
1418
|
readonly namespaces: Readonly<Record<string, unknown>>;
|
|
1416
1419
|
dispose?(): void;
|
|
@@ -2215,4 +2218,4 @@ declare class RunInteractionBoundary extends Error {
|
|
|
2215
2218
|
constructor(state: ExecutionState, interactions: readonly RunInteraction[]);
|
|
2216
2219
|
}
|
|
2217
2220
|
|
|
2218
|
-
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;
|
|
@@ -938,4 +938,4 @@ type CoreToolContext = {
|
|
|
938
938
|
/** Adapt the established host-filesystem Core Tools to the durable Runtime Tool contract. */
|
|
939
939
|
declare function createRuntimeCoreTools(input?: CoreToolContext): Tool[];
|
|
940
940
|
|
|
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, 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
|
@@ -5325,7 +5325,7 @@ var InMemoryStore = class _InMemoryStore {
|
|
|
5325
5325
|
interruptOwner(ownerEpoch, message = "The previous Runtime owner expired or closed.") {
|
|
5326
5326
|
this.ownerEpoch = Math.max(this.ownerEpoch, ownerEpoch);
|
|
5327
5327
|
for (const run of this.runs.values()) {
|
|
5328
|
-
if (run.state !== "running" || run.execution
|
|
5328
|
+
if (run.state !== "running" || !run.execution || run.execution.ownerEpoch > ownerEpoch) continue;
|
|
5329
5329
|
const activeToolCalls = [...this.toolCalls.values()].filter((toolCall) => toolCall.runId === run.id && toolCall.executionId === run.execution?.executionId && (toolCall.status === "pending" || toolCall.status === "in_progress" || toolCall.state === "pending" || toolCall.state === "in_progress"));
|
|
5330
5330
|
const indeterminateToolCallIds = [];
|
|
5331
5331
|
for (const toolCall of activeToolCalls) {
|
|
@@ -7947,7 +7947,7 @@ var ExtensionRunner = class {
|
|
|
7947
7947
|
async loadExtensions(extensions) {
|
|
7948
7948
|
for (const ext of extensions) {
|
|
7949
7949
|
const extensionId = ext.id ?? ext.manifest?.id ?? ext.name;
|
|
7950
|
-
const hostApi = this.host.extendApi?.(extensionId);
|
|
7950
|
+
const hostApi = this.host.extendApi?.(extensionId, "extension");
|
|
7951
7951
|
const extension = {
|
|
7952
7952
|
id: extensionId,
|
|
7953
7953
|
path: ext.path,
|
|
@@ -7989,7 +7989,7 @@ var ExtensionRunner = class {
|
|
|
7989
7989
|
skills: /* @__PURE__ */ new Set(),
|
|
7990
7990
|
cleanup: [],
|
|
7991
7991
|
runtime: createExtensionRuntime(),
|
|
7992
|
-
hostApi: this.host.extendApi?.(phase.name)
|
|
7992
|
+
hostApi: this.host.extendApi?.(phase.name, "phase")
|
|
7993
7993
|
};
|
|
7994
7994
|
let executeHandler;
|
|
7995
7995
|
const api = this.createExtensionAPI(extension, void 0, extension.hostApi?.namespaces, {
|
|
@@ -11896,10 +11896,6 @@ var SqliteStore = class {
|
|
|
11896
11896
|
}
|
|
11897
11897
|
const state = this.readState();
|
|
11898
11898
|
const memory = InMemoryStore.fromState(state);
|
|
11899
|
-
if (row.owner_id && row.owner_token && row.epoch > 0) {
|
|
11900
|
-
memory.attachOwner(ownerLease(row));
|
|
11901
|
-
memory.interruptOwner(row.epoch);
|
|
11902
|
-
}
|
|
11903
11899
|
const epoch = row.epoch + 1;
|
|
11904
11900
|
const token = `${state.incarnation}:${epoch}:${input.ownerId}`;
|
|
11905
11901
|
const next = {
|
|
@@ -11921,6 +11917,7 @@ var SqliteStore = class {
|
|
|
11921
11917
|
const tracker = new ChangeTracker();
|
|
11922
11918
|
memory.setChangeRecorder(tracker);
|
|
11923
11919
|
try {
|
|
11920
|
+
if (row.epoch > 0) memory.interruptOwner(row.epoch);
|
|
11924
11921
|
memory.dropSettledClaimReceipts();
|
|
11925
11922
|
memory.compactTerminalReceipts();
|
|
11926
11923
|
} finally {
|