@rowan-agent/agent 0.20.2 → 0.22.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 +43 -29
- package/dist/index.js +480 -177
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
2
|
-
import { ContentBlock,
|
|
2
|
+
import { ContentBlock, ModelRef, LlmTokenUsage, LlmContentPart, ScopeRef, ToolCallStatus, JsonValue as JsonValue$1, ToolProgress, ToolCallContent, ToolCallLocation, JsonObject as JsonObject$1, ToolKind, ModelConfig, StreamFn, ToolAnnotations, ThinkingLevel, ToolCall as ToolCall$1, ToolCallUpdate } from '@rowan-agent/models';
|
|
3
3
|
export { ModelConfig, ModelRef, ProviderCallContext, ProviderConfig, ProviderModelConfig, ProviderStreamFn, ScopeRef, StreamFn, ThinkingLevel, ToolAnnotations, ToolCall, ToolCallContent, ToolCallLocation, ToolCallOptions, ToolCallOutcome, ToolCallStatus, ToolCallUpdate, ToolDefinitionSummary, ToolKind, ToolProgress } from '@rowan-agent/models';
|
|
4
4
|
import Type from 'typebox';
|
|
5
5
|
|
|
@@ -8,6 +8,8 @@ type ModelInvokeOutput = {
|
|
|
8
8
|
contentBlocks: ContentBlock[];
|
|
9
9
|
toolCalls: ToolCall[];
|
|
10
10
|
stopReason?: string;
|
|
11
|
+
model?: ModelRef;
|
|
12
|
+
usage?: LlmTokenUsage;
|
|
11
13
|
};
|
|
12
14
|
/** Snapshot of phase-level context for restore */
|
|
13
15
|
type PhaseContextSnapshot = {
|
|
@@ -27,7 +29,10 @@ type PhaseExecution = {
|
|
|
27
29
|
}): Promise<ModelInvokeOutput>;
|
|
28
30
|
reportStatus(status: PhaseStatus): Promise<void>;
|
|
29
31
|
executeTool(context: AgentContext, toolCall: ToolCall): Promise<ToolResult>;
|
|
30
|
-
executeTools(context: AgentContext, toolCalls: readonly ToolCall[], contentBlocks?: readonly ContentBlock[]
|
|
32
|
+
executeTools(context: AgentContext, toolCalls: readonly ToolCall[], contentBlocks?: readonly ContentBlock[], meta?: {
|
|
33
|
+
model?: ModelRef;
|
|
34
|
+
usage?: LlmTokenUsage;
|
|
35
|
+
}): Promise<readonly ToolResult[]>;
|
|
31
36
|
interaction: RunInteractionDriver;
|
|
32
37
|
/** Message lifecycle manager for streaming updates from programmatic phases */
|
|
33
38
|
messages: PhaseMessageManager;
|
|
@@ -45,7 +50,10 @@ type PhaseMessageManager = {
|
|
|
45
50
|
/** Replace the active message content with model-native content parts */
|
|
46
51
|
replaceContent(messageId: string, content: string | LlmContentPart[]): void;
|
|
47
52
|
/** End the message stream, appends to transcript */
|
|
48
|
-
end(messageId: string
|
|
53
|
+
end(messageId: string, meta?: {
|
|
54
|
+
model?: ModelRef;
|
|
55
|
+
usage?: LlmTokenUsage;
|
|
56
|
+
}): Promise<void>;
|
|
49
57
|
/** Drop an unstarted stream that produced no content. */
|
|
50
58
|
discard(messageId: string): void;
|
|
51
59
|
};
|
|
@@ -281,10 +289,12 @@ declare class InMemoryExtensionHost implements ExtensionHost {
|
|
|
281
289
|
private readonly agentState;
|
|
282
290
|
private readonly globalState;
|
|
283
291
|
private readonly listeners;
|
|
292
|
+
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
284
293
|
constructor(options?: {
|
|
285
294
|
configs?: Record<string, Record<string, JsonObject>>;
|
|
286
295
|
agentState?: Record<string, Record<string, Record<string, JsonValue>>>;
|
|
287
296
|
globalState?: Record<string, Record<string, JsonValue>>;
|
|
297
|
+
extendApi?: (extensionId: string) => HostApiExtension | undefined;
|
|
288
298
|
});
|
|
289
299
|
setConfig(extensionId: string, config: JsonObject | null, scope?: ScopeRef): void;
|
|
290
300
|
getConfig(extensionId: string, scope?: ScopeRef): JsonObject | null;
|
|
@@ -362,7 +372,6 @@ declare class ExtensionRunner {
|
|
|
362
372
|
private bound;
|
|
363
373
|
private readonly errorListeners;
|
|
364
374
|
private readonly capabilityListeners;
|
|
365
|
-
private readonly hostContributionListeners;
|
|
366
375
|
/** Current agent context — set by the agent before each phase */
|
|
367
376
|
currentContext?: AgentContext;
|
|
368
377
|
constructor(options?: ExtensionRunnerOptions);
|
|
@@ -428,13 +437,6 @@ declare class ExtensionRunner {
|
|
|
428
437
|
* Returns an unsubscribe function.
|
|
429
438
|
*/
|
|
430
439
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
431
|
-
/** Get all contributed host elements across all extensions. */
|
|
432
|
-
getHostContributions(): readonly HostContribution[];
|
|
433
|
-
/**
|
|
434
|
-
* Subscribe to host contribution changes (contributions added, removed, or extensions disposed).
|
|
435
|
-
* Returns an unsubscribe function.
|
|
436
|
-
*/
|
|
437
|
-
onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
|
|
438
440
|
triggerUiAction(event: {
|
|
439
441
|
contributionId: string;
|
|
440
442
|
actionId: string;
|
|
@@ -509,8 +511,6 @@ declare class ExtensionRunner {
|
|
|
509
511
|
private unregisterTool;
|
|
510
512
|
private contributeCapability;
|
|
511
513
|
private notifyCapabilitiesChanged;
|
|
512
|
-
private contributeToHost;
|
|
513
|
-
private notifyHostContributionsChanged;
|
|
514
514
|
private registerPhase;
|
|
515
515
|
private registerPhaseDefinition;
|
|
516
516
|
private unregisterPhase;
|
|
@@ -1078,6 +1078,8 @@ interface OwnedStore {
|
|
|
1078
1078
|
locations?: ToolCallLocation[];
|
|
1079
1079
|
content?: ToolCallContent[];
|
|
1080
1080
|
_meta?: JsonObject;
|
|
1081
|
+
model?: ModelRef;
|
|
1082
|
+
usage?: LlmTokenUsage;
|
|
1081
1083
|
}): Promise<ToolCommit>;
|
|
1082
1084
|
reserveToolCalls(input: {
|
|
1083
1085
|
runId: RunId;
|
|
@@ -1087,6 +1089,8 @@ interface OwnedStore {
|
|
|
1087
1089
|
calls: readonly ToolCallReservation[];
|
|
1088
1090
|
/** The model response's blocks, so the request message keeps what preceded the Tool Calls. */
|
|
1089
1091
|
contentBlocks?: readonly ContentBlock[];
|
|
1092
|
+
model?: ModelRef;
|
|
1093
|
+
usage?: LlmTokenUsage;
|
|
1090
1094
|
}): Promise<ToolBatchCommit>;
|
|
1091
1095
|
startToolCall(input: {
|
|
1092
1096
|
runId: RunId;
|
|
@@ -1163,6 +1167,9 @@ type AgentRuntimeOptions = Readonly<{
|
|
|
1163
1167
|
concurrency?: number;
|
|
1164
1168
|
bootstrap?: (registry: RuntimeBootstrapRegistry) => void | Promise<void>;
|
|
1165
1169
|
host?: ExtensionHost;
|
|
1170
|
+
sessionFiles?: Readonly<{
|
|
1171
|
+
dir: string;
|
|
1172
|
+
}>;
|
|
1166
1173
|
/** @internal Private / testing parameter to override retry delay */
|
|
1167
1174
|
retryDelayMs?: number;
|
|
1168
1175
|
}>;
|
|
@@ -1261,8 +1268,6 @@ interface AgentRuntime$1 {
|
|
|
1261
1268
|
}): Promise<DurableConsumer>;
|
|
1262
1269
|
listCapabilities(): readonly ExtensionCapability[];
|
|
1263
1270
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
1264
|
-
listHostContributions(): readonly HostContribution[];
|
|
1265
|
-
onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
|
|
1266
1271
|
triggerUiAction(event: {
|
|
1267
1272
|
contributionId: string;
|
|
1268
1273
|
actionId: string;
|
|
@@ -1275,12 +1280,6 @@ type ConsumerRegistration = Readonly<{
|
|
|
1275
1280
|
waterline: EventCursor;
|
|
1276
1281
|
}>;
|
|
1277
1282
|
|
|
1278
|
-
type HostContribution = {
|
|
1279
|
-
readonly kind: string;
|
|
1280
|
-
readonly id: string;
|
|
1281
|
-
} & {
|
|
1282
|
-
readonly [key: string]: JsonValue;
|
|
1283
|
-
};
|
|
1284
1283
|
interface ExtensionStateStore {
|
|
1285
1284
|
get(key: string): Promise<JsonValue | undefined>;
|
|
1286
1285
|
set(key: string, value: JsonValue): Promise<void>;
|
|
@@ -1295,6 +1294,16 @@ interface ExtensionHost {
|
|
|
1295
1294
|
getGlobalState(extensionId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
1296
1295
|
setGlobalState(extensionId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
1297
1296
|
deleteGlobalState(extensionId: string, key: string): Promise<void> | void;
|
|
1297
|
+
/**
|
|
1298
|
+
* Called once per extension load. The returned namespaces are merged into that extension's `api`
|
|
1299
|
+
* (a name already used by Rowan's own API is an error). `dispose` runs when the extension is
|
|
1300
|
+
* unloaded, reloaded or fails activation, so the host can drop everything that extension registered.
|
|
1301
|
+
*/
|
|
1302
|
+
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
1303
|
+
}
|
|
1304
|
+
interface HostApiExtension {
|
|
1305
|
+
readonly namespaces: Readonly<Record<string, unknown>>;
|
|
1306
|
+
dispose?(): void;
|
|
1298
1307
|
}
|
|
1299
1308
|
type ExtensionToolContribution = {
|
|
1300
1309
|
kind: "tool";
|
|
@@ -1523,11 +1532,6 @@ interface ExtensionAPI {
|
|
|
1523
1532
|
/** Get the message set by setMessage */
|
|
1524
1533
|
getMessage(): string | undefined;
|
|
1525
1534
|
};
|
|
1526
|
-
/** Declarative host contributions. */
|
|
1527
|
-
host: {
|
|
1528
|
-
/** Contribute a declarative declaration to the host. Returns a disposer to remove the contribution. */
|
|
1529
|
-
contribute<T extends HostContribution>(contribution: T): () => void;
|
|
1530
|
-
};
|
|
1531
1535
|
/** Extension manifest from package.json `rowan` field. */
|
|
1532
1536
|
manifest?: ExtensionManifest;
|
|
1533
1537
|
/** Utility functions. */
|
|
@@ -2088,6 +2092,8 @@ type AssistantMessage = MessageBase & Readonly<{
|
|
|
2088
2092
|
role: "assistant";
|
|
2089
2093
|
content: AssistantContent;
|
|
2090
2094
|
interrupted?: boolean;
|
|
2095
|
+
model?: ModelRef;
|
|
2096
|
+
usage?: LlmTokenUsage;
|
|
2091
2097
|
}>;
|
|
2092
2098
|
type ToolMessage = MessageBase & Readonly<{
|
|
2093
2099
|
role: "tool";
|
|
@@ -2343,6 +2349,8 @@ type AgentMessage = {
|
|
|
2343
2349
|
phase?: string;
|
|
2344
2350
|
};
|
|
2345
2351
|
contexts?: readonly ContextCandidate[];
|
|
2352
|
+
model?: ModelRef;
|
|
2353
|
+
usage?: LlmTokenUsage;
|
|
2346
2354
|
};
|
|
2347
2355
|
type Skill = {
|
|
2348
2356
|
name: string;
|
|
@@ -2505,8 +2513,6 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2505
2513
|
}): Promise<DurableConsumer>;
|
|
2506
2514
|
listCapabilities(): readonly ExtensionCapability[];
|
|
2507
2515
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
2508
|
-
listHostContributions(): readonly HostContribution[];
|
|
2509
|
-
onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
|
|
2510
2516
|
triggerUiAction(event: {
|
|
2511
2517
|
contributionId: string;
|
|
2512
2518
|
actionId: string;
|
|
@@ -2754,6 +2760,8 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2754
2760
|
args: JsonValue;
|
|
2755
2761
|
toolCallId?: ToolCallId;
|
|
2756
2762
|
providerToolCallId?: string;
|
|
2763
|
+
model?: ModelRef;
|
|
2764
|
+
usage?: LlmTokenUsage;
|
|
2757
2765
|
}): ToolCommit;
|
|
2758
2766
|
reserveToolCalls(lease: OwnerLease, input: {
|
|
2759
2767
|
runId: RunId;
|
|
@@ -2763,6 +2771,8 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2763
2771
|
calls: readonly ToolCallReservation[];
|
|
2764
2772
|
/** The model response's blocks, so the request message keeps what preceded the Tool Calls. */
|
|
2765
2773
|
contentBlocks?: readonly ContentBlock[];
|
|
2774
|
+
model?: ModelRef;
|
|
2775
|
+
usage?: LlmTokenUsage;
|
|
2766
2776
|
}): ToolBatchCommit;
|
|
2767
2777
|
startToolCall(lease: OwnerLease, input: {
|
|
2768
2778
|
runId: RunId;
|
|
@@ -3018,6 +3028,8 @@ declare class SqliteStore implements DurableStore {
|
|
|
3018
3028
|
locations?: ToolCallLocation[];
|
|
3019
3029
|
content?: ToolCallContent[];
|
|
3020
3030
|
_meta?: JsonObject;
|
|
3031
|
+
model?: _rowan_agent_models.ModelRef;
|
|
3032
|
+
usage?: _rowan_agent_models.LlmTokenUsage;
|
|
3021
3033
|
}): Promise<ToolCommit>;
|
|
3022
3034
|
reserveToolCalls(lease: OwnerLease, input: {
|
|
3023
3035
|
runId: RunId;
|
|
@@ -3026,6 +3038,8 @@ declare class SqliteStore implements DurableStore {
|
|
|
3026
3038
|
requestMessageId: MessageId;
|
|
3027
3039
|
calls: readonly ToolCallReservation[];
|
|
3028
3040
|
contentBlocks?: readonly ContentBlock[];
|
|
3041
|
+
model?: _rowan_agent_models.ModelRef;
|
|
3042
|
+
usage?: _rowan_agent_models.LlmTokenUsage;
|
|
3029
3043
|
}): Promise<ToolBatchCommit>;
|
|
3030
3044
|
startToolCall(lease: OwnerLease, input: {
|
|
3031
3045
|
runId: RunId;
|
|
@@ -3317,4 +3331,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
|
|
|
3317
3331
|
|
|
3318
3332
|
declare function createCoreTools(input?: CoreToolContext): Tool$1[];
|
|
3319
3333
|
|
|
3320
|
-
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
|
|
3334
|
+
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, 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 };
|