@rowan-agent/agent 0.15.4 → 0.16.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 +242 -6
- package/dist/index.js +1345 -145
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,40 @@ type PhaseMessageManager = {
|
|
|
206
206
|
discard(messageId: string): void;
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
type ScopeRef = {
|
|
210
|
+
kind: "global";
|
|
211
|
+
} | {
|
|
212
|
+
kind: "team";
|
|
213
|
+
teamId: string;
|
|
214
|
+
} | {
|
|
215
|
+
kind: "project";
|
|
216
|
+
teamId: string;
|
|
217
|
+
projectId: string;
|
|
218
|
+
};
|
|
219
|
+
interface ExtensionStateStore {
|
|
220
|
+
get(key: string): Promise<JsonValue | undefined>;
|
|
221
|
+
set(key: string, value: JsonValue): Promise<void>;
|
|
222
|
+
delete(key: string): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
interface ExtensionHost {
|
|
225
|
+
getConfig(extensionId: string, scope?: ScopeRef): Promise<JsonObject | null> | JsonObject | null;
|
|
226
|
+
onConfigChanged?(listener: (extensionId: string, scope: ScopeRef) => void): (() => void) | void;
|
|
227
|
+
getAgentState(extensionId: string, agentId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
228
|
+
setAgentState(extensionId: string, agentId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
229
|
+
deleteAgentState(extensionId: string, agentId: string, key: string): Promise<void> | void;
|
|
230
|
+
}
|
|
231
|
+
type ExtensionToolContribution = {
|
|
232
|
+
kind: "tool";
|
|
233
|
+
name: string;
|
|
234
|
+
description: string;
|
|
235
|
+
};
|
|
236
|
+
type ExtensionCapabilityContribution = ExtensionToolContribution;
|
|
237
|
+
type ExtensionCapability = {
|
|
238
|
+
extensionId: string;
|
|
239
|
+
kind: "tool";
|
|
240
|
+
name: string;
|
|
241
|
+
description: string;
|
|
242
|
+
};
|
|
209
243
|
interface SourceInfo {
|
|
210
244
|
source: string;
|
|
211
245
|
baseDir?: string;
|
|
@@ -318,6 +352,7 @@ type LoadExtensionsResult = {
|
|
|
318
352
|
* Runner.loadExtensions() calls the factory and creates the full Extension object.
|
|
319
353
|
*/
|
|
320
354
|
interface LoadedExtension {
|
|
355
|
+
id?: string;
|
|
321
356
|
path: string;
|
|
322
357
|
name: string;
|
|
323
358
|
factory: ExtensionFactory;
|
|
@@ -325,6 +360,7 @@ interface LoadedExtension {
|
|
|
325
360
|
}
|
|
326
361
|
/** Extension manifest from package.json `rowan` field. */
|
|
327
362
|
interface ExtensionManifest {
|
|
363
|
+
id?: string;
|
|
328
364
|
entry?: string;
|
|
329
365
|
name?: string;
|
|
330
366
|
}
|
|
@@ -471,6 +507,20 @@ interface ExtensionAPI {
|
|
|
471
507
|
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
472
508
|
/** Unsubscribe from a hook event. */
|
|
473
509
|
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
510
|
+
/** Extension configuration — read own layered config or listen for changes. */
|
|
511
|
+
config: {
|
|
512
|
+
/** Get the extension's own effective configuration block. */
|
|
513
|
+
get(scope?: ScopeRef): Promise<JsonObject | null>;
|
|
514
|
+
/** Listen for configuration changes for a scope. */
|
|
515
|
+
changed(handler: (scope: ScopeRef) => void): void;
|
|
516
|
+
};
|
|
517
|
+
/** Extension state — scoped to run (in-memory) or agent (durable). */
|
|
518
|
+
state: {
|
|
519
|
+
/** Run-scoped in-memory state; dropped when the Run ends. */
|
|
520
|
+
run(runId: string): ExtensionStateStore;
|
|
521
|
+
/** Agent-scoped durable state; persisted with the Agent record. */
|
|
522
|
+
agent(agentId: string): ExtensionStateStore;
|
|
523
|
+
};
|
|
474
524
|
/** Tool capabilities — register and unregister custom tools. */
|
|
475
525
|
tool: {
|
|
476
526
|
/** Register a custom LLM-callable tool. */
|
|
@@ -478,6 +528,11 @@ interface ExtensionAPI {
|
|
|
478
528
|
/** Unregister a previously registered tool by name. */
|
|
479
529
|
unregister(toolName: string): void;
|
|
480
530
|
};
|
|
531
|
+
/** Capability contributions — advertise tools or features to the host. */
|
|
532
|
+
capabilities: {
|
|
533
|
+
/** Contribute a capability to the host. Returns a disposer to remove the contribution. */
|
|
534
|
+
contribute(contribution: ExtensionCapabilityContribution): () => void;
|
|
535
|
+
};
|
|
481
536
|
/** Register a model provider. */
|
|
482
537
|
registerProvider(config: _rowan_agent_models.ProviderConfig): void;
|
|
483
538
|
/** Unregister a model provider. */
|
|
@@ -524,6 +579,23 @@ type ExtensionDisposer = () => void | Promise<void>;
|
|
|
524
579
|
type ExtensionFactoryResult = void | ExtensionDisposer;
|
|
525
580
|
type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<ExtensionFactoryResult>;
|
|
526
581
|
|
|
582
|
+
declare class InMemoryExtensionHost implements ExtensionHost {
|
|
583
|
+
private readonly configs;
|
|
584
|
+
private readonly agentState;
|
|
585
|
+
private readonly listeners;
|
|
586
|
+
constructor(options?: {
|
|
587
|
+
configs?: Record<string, Record<string, JsonObject>>;
|
|
588
|
+
agentState?: Record<string, Record<string, Record<string, JsonValue>>>;
|
|
589
|
+
});
|
|
590
|
+
setConfig(extensionId: string, config: JsonObject | null, scope?: ScopeRef): void;
|
|
591
|
+
getConfig(extensionId: string, scope?: ScopeRef): JsonObject | null;
|
|
592
|
+
onConfigChanged(listener: (extensionId: string, scope: ScopeRef) => void): () => void;
|
|
593
|
+
notifyConfigChanged(extensionId: string, scope?: ScopeRef): void;
|
|
594
|
+
getAgentState(extensionId: string, agentId: string, key: string): JsonValue | undefined;
|
|
595
|
+
setAgentState(extensionId: string, agentId: string, key: string, value: JsonValue): void;
|
|
596
|
+
deleteAgentState(extensionId: string, agentId: string, key: string): void;
|
|
597
|
+
}
|
|
598
|
+
|
|
527
599
|
/**
|
|
528
600
|
* Extension runner — manages extension loading and hook execution.
|
|
529
601
|
*
|
|
@@ -538,6 +610,7 @@ type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<
|
|
|
538
610
|
type ExtensionRunnerOptions = {
|
|
539
611
|
entryPhaseId?: string | null;
|
|
540
612
|
cwd?: string;
|
|
613
|
+
host?: ExtensionHost;
|
|
541
614
|
};
|
|
542
615
|
/**
|
|
543
616
|
* Manages extensions and provides hooks for the agent loop.
|
|
@@ -573,15 +646,20 @@ declare class ExtensionRunner {
|
|
|
573
646
|
readonly hooks: HooksManager;
|
|
574
647
|
readonly runtime: ExtensionRuntime;
|
|
575
648
|
readonly events: EventBus;
|
|
649
|
+
readonly host: ExtensionHost;
|
|
576
650
|
private readonly cwd;
|
|
577
651
|
private readonly abortController;
|
|
578
652
|
private _idle;
|
|
579
653
|
private readonly extensions;
|
|
654
|
+
private readonly runState;
|
|
655
|
+
private readonly configChangeListeners;
|
|
656
|
+
private readonly hostUnsubscribers;
|
|
580
657
|
private readonly phases;
|
|
581
658
|
private _phaseCache;
|
|
582
659
|
private readonly pendingProviders;
|
|
583
660
|
private bound;
|
|
584
661
|
private readonly errorListeners;
|
|
662
|
+
private readonly capabilityListeners;
|
|
585
663
|
/** Current agent context — set by the agent before each phase */
|
|
586
664
|
currentContext?: AgentContext;
|
|
587
665
|
constructor(options?: ExtensionRunnerOptions);
|
|
@@ -628,12 +706,25 @@ declare class ExtensionRunner {
|
|
|
628
706
|
loadExtensions(extensions: LoadedExtension[]): Promise<void>;
|
|
629
707
|
/** Dispose all active Extensions in reverse activation order. */
|
|
630
708
|
close(): Promise<void>;
|
|
709
|
+
get extensionHost(): ExtensionHost;
|
|
710
|
+
notifyConfigChanged(extensionId: string, scope: ScopeRef): void;
|
|
711
|
+
getRunState(runId: string, extensionId: string, key: string): JsonValue | undefined;
|
|
712
|
+
setRunState(runId: string, extensionId: string, key: string, value: JsonValue): void;
|
|
713
|
+
deleteRunState(runId: string, extensionId: string, key: string): void;
|
|
714
|
+
dropRunState(runId: string): void;
|
|
631
715
|
/** Get all registered tools from all extensions. */
|
|
632
716
|
getAllRegisteredTools(): RegisteredTool[];
|
|
633
717
|
/**
|
|
634
718
|
* Get a tool definition by name. Returns undefined if not found.
|
|
635
719
|
*/
|
|
636
720
|
getToolDefinition(toolName: string): RegisteredTool["definition"] | undefined;
|
|
721
|
+
/** Get all contributed capabilities across all extensions. */
|
|
722
|
+
getCapabilities(): readonly ExtensionCapability[];
|
|
723
|
+
/**
|
|
724
|
+
* Subscribe to capability changes (contributions added, removed, or extensions disposed).
|
|
725
|
+
* Returns an unsubscribe function.
|
|
726
|
+
*/
|
|
727
|
+
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
637
728
|
getPhase(name: string): Phase | undefined;
|
|
638
729
|
getPhases(): Phase[];
|
|
639
730
|
createPhaseRegistry(input?: {
|
|
@@ -665,18 +756,33 @@ declare class ExtensionRunner {
|
|
|
665
756
|
output?: PhaseOutput;
|
|
666
757
|
}>;
|
|
667
758
|
emitBeforePrompt(phaseId: string, input: PhaseContext): Promise<PhaseContext>;
|
|
759
|
+
emitRunStart(event: {
|
|
760
|
+
runId: string;
|
|
761
|
+
agentId: string;
|
|
762
|
+
metadata: Readonly<Record<string, unknown>>;
|
|
763
|
+
turn: JsonObject;
|
|
764
|
+
}): Promise<void>;
|
|
765
|
+
emitRunEnd(event: {
|
|
766
|
+
runId: string;
|
|
767
|
+
agentId: string;
|
|
768
|
+
outcome: unknown;
|
|
769
|
+
}): Promise<void>;
|
|
668
770
|
emitBeforeToolCall(tool: Tool, args: unknown, context?: {
|
|
669
771
|
runId?: string;
|
|
670
772
|
agentId?: string;
|
|
671
773
|
toolCallId?: string;
|
|
672
774
|
metadata?: Readonly<Record<string, unknown>>;
|
|
673
775
|
answer?: unknown;
|
|
776
|
+
scope?: ScopeRef;
|
|
777
|
+
turn?: JsonObject;
|
|
674
778
|
}): Promise<BeforeToolCallResult>;
|
|
675
779
|
emitAfterToolCall(tool: Tool, result: ToolResult, context?: {
|
|
676
780
|
runId?: string;
|
|
677
781
|
agentId?: string;
|
|
678
782
|
toolCallId?: string;
|
|
679
783
|
metadata?: Readonly<Record<string, unknown>>;
|
|
784
|
+
scope?: ScopeRef;
|
|
785
|
+
turn?: JsonObject;
|
|
680
786
|
}): Promise<ToolResult>;
|
|
681
787
|
/**
|
|
682
788
|
* Create an ExtensionAPI for a specific extension.
|
|
@@ -686,6 +792,8 @@ declare class ExtensionRunner {
|
|
|
686
792
|
private createExtensionAPI;
|
|
687
793
|
private registerTool;
|
|
688
794
|
private unregisterTool;
|
|
795
|
+
private contributeCapability;
|
|
796
|
+
private notifyCapabilitiesChanged;
|
|
689
797
|
private registerPhase;
|
|
690
798
|
private registerPhaseDefinition;
|
|
691
799
|
private unregisterPhase;
|
|
@@ -724,11 +832,14 @@ declare class RuntimeExtensionLifetime {
|
|
|
724
832
|
private closed;
|
|
725
833
|
constructor(options?: {
|
|
726
834
|
cwd?: string;
|
|
835
|
+
host?: ExtensionHost;
|
|
727
836
|
});
|
|
728
837
|
activate(extensions: readonly LoadedExtension[]): Promise<ExtensionActivationResult>;
|
|
729
838
|
tools(): readonly RegisteredTool[];
|
|
730
839
|
phases(): readonly Phase[];
|
|
731
840
|
get extensionRunner(): ExtensionRunner;
|
|
841
|
+
get extensionHost(): ExtensionHost;
|
|
842
|
+
dropRunState(runId: string): void;
|
|
732
843
|
close(): Promise<void>;
|
|
733
844
|
}
|
|
734
845
|
/** Bootstrap-only Registry facade; its Extension method disappears after init. */
|
|
@@ -736,6 +847,7 @@ declare class RuntimeBootstrapRegistry extends ResourceRegistry {
|
|
|
736
847
|
private readonly extensions;
|
|
737
848
|
private readonly extensionSourceId;
|
|
738
849
|
constructor(extensions?: RuntimeExtensionLifetime);
|
|
850
|
+
get extensionHost(): ExtensionHost;
|
|
739
851
|
/** Install Rowan-owned implicit resources before any host source is read. */
|
|
740
852
|
ensureCoreResources(): Promise<void>;
|
|
741
853
|
loadExtensions(input: readonly LoadedExtension[] | ExtensionLoadInput): Promise<ExtensionActivationResult>;
|
|
@@ -830,6 +942,8 @@ type ToolCallContext = Readonly<{
|
|
|
830
942
|
agentMetadata?: Metadata;
|
|
831
943
|
runMetadata?: Metadata;
|
|
832
944
|
toolCallId: ToolCallId;
|
|
945
|
+
scope?: ScopeRef;
|
|
946
|
+
turn?: JsonObject;
|
|
833
947
|
reportProgress(progress: JsonValue): void;
|
|
834
948
|
}>;
|
|
835
949
|
type ToolInvocationContext = ToolCallContext & Readonly<{
|
|
@@ -1244,6 +1358,7 @@ type AgentRuntimeOptions = Readonly<{
|
|
|
1244
1358
|
configs?: ConfigProvider;
|
|
1245
1359
|
concurrency?: number;
|
|
1246
1360
|
bootstrap?: (registry: RuntimeBootstrapRegistry) => void | Promise<void>;
|
|
1361
|
+
host?: ExtensionHost;
|
|
1247
1362
|
}>;
|
|
1248
1363
|
type DurableConsumer = Readonly<{
|
|
1249
1364
|
caughtUp: Promise<void>;
|
|
@@ -1268,6 +1383,7 @@ interface AgentRun {
|
|
|
1268
1383
|
cancel(reason?: string): Promise<RunBoundary>;
|
|
1269
1384
|
}
|
|
1270
1385
|
interface AgentRuntime$1 {
|
|
1386
|
+
readonly host: ExtensionHost;
|
|
1271
1387
|
loadAgents(input: LoadInput<AgentDefinition>): Promise<LoadResult>;
|
|
1272
1388
|
loadSkills(input: LoadInput<Skill>): Promise<LoadResult>;
|
|
1273
1389
|
loadPhases(input: LoadInput<Phase>): Promise<LoadResult>;
|
|
@@ -1335,6 +1451,8 @@ interface AgentRuntime$1 {
|
|
|
1335
1451
|
signal: AbortSignal;
|
|
1336
1452
|
}>): void | Promise<void>;
|
|
1337
1453
|
}): Promise<DurableConsumer>;
|
|
1454
|
+
listCapabilities(): readonly ExtensionCapability[];
|
|
1455
|
+
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
1338
1456
|
close(): Promise<void>;
|
|
1339
1457
|
}
|
|
1340
1458
|
type ConsumerRegistration = Readonly<{
|
|
@@ -2039,6 +2157,8 @@ interface BeforeToolCallEvent {
|
|
|
2039
2157
|
readonly toolCallId?: string;
|
|
2040
2158
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
2041
2159
|
readonly answer?: unknown;
|
|
2160
|
+
readonly scope?: ScopeRef;
|
|
2161
|
+
readonly turn?: JsonObject;
|
|
2042
2162
|
}
|
|
2043
2163
|
interface AfterToolCallEvent {
|
|
2044
2164
|
type: "after_tool_call";
|
|
@@ -2048,8 +2168,23 @@ interface AfterToolCallEvent {
|
|
|
2048
2168
|
readonly agentId?: string;
|
|
2049
2169
|
readonly toolCallId?: string;
|
|
2050
2170
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
2171
|
+
readonly scope?: ScopeRef;
|
|
2172
|
+
readonly turn?: JsonObject;
|
|
2173
|
+
}
|
|
2174
|
+
interface RunStartEvent {
|
|
2175
|
+
type: "run_start";
|
|
2176
|
+
runId: string;
|
|
2177
|
+
agentId: string;
|
|
2178
|
+
metadata: Readonly<Record<string, unknown>>;
|
|
2179
|
+
turn: JsonObject;
|
|
2180
|
+
}
|
|
2181
|
+
interface RunEndEvent {
|
|
2182
|
+
type: "run_end";
|
|
2183
|
+
runId: string;
|
|
2184
|
+
agentId: string;
|
|
2185
|
+
outcome: unknown;
|
|
2051
2186
|
}
|
|
2052
|
-
type HookEvent = BeforePhaseEvent | AfterPhaseEvent | BeforePromptEvent | BeforeToolCallEvent | AfterToolCallEvent;
|
|
2187
|
+
type HookEvent = BeforePhaseEvent | AfterPhaseEvent | BeforePromptEvent | BeforeToolCallEvent | AfterToolCallEvent | RunStartEvent | RunEndEvent;
|
|
2053
2188
|
interface BeforePhaseResult {
|
|
2054
2189
|
abort?: Outcome$1;
|
|
2055
2190
|
skip?: {
|
|
@@ -2080,6 +2215,8 @@ interface HookResultMap {
|
|
|
2080
2215
|
before_prompt: BeforePromptResult | undefined;
|
|
2081
2216
|
before_tool_call: BeforeToolCallResult | undefined;
|
|
2082
2217
|
after_tool_call: AfterToolCallResult | undefined;
|
|
2218
|
+
run_start: void;
|
|
2219
|
+
run_end: void;
|
|
2083
2220
|
}
|
|
2084
2221
|
type HookEventType = HookEvent["type"];
|
|
2085
2222
|
type HookHandler<K extends HookEventType> = (event: Extract<HookEvent, {
|
|
@@ -2157,12 +2294,15 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2157
2294
|
private readonly autoCompactionRuns;
|
|
2158
2295
|
private readonly consumers;
|
|
2159
2296
|
private readonly transientEvents;
|
|
2297
|
+
readonly host: ExtensionHost;
|
|
2160
2298
|
private readonly resources;
|
|
2299
|
+
private readonly startedRuns;
|
|
2161
2300
|
private heartbeat?;
|
|
2162
2301
|
private pumping;
|
|
2163
2302
|
private closed;
|
|
2164
2303
|
private constructor();
|
|
2165
2304
|
static init(options: AgentRuntimeOptions): Promise<AgentRuntime>;
|
|
2305
|
+
private handleRunEnd;
|
|
2166
2306
|
loadAgents(input: LoadInput<AgentDefinition>): Promise<LoadResult>;
|
|
2167
2307
|
loadSkills(input: LoadInput<Skill>): Promise<LoadResult>;
|
|
2168
2308
|
loadPhases(input: LoadInput<Phase>): Promise<LoadResult>;
|
|
@@ -2235,6 +2375,8 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2235
2375
|
signal: AbortSignal;
|
|
2236
2376
|
}>): void | Promise<void>;
|
|
2237
2377
|
}): Promise<DurableConsumer>;
|
|
2378
|
+
listCapabilities(): readonly ExtensionCapability[];
|
|
2379
|
+
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
2238
2380
|
close(): Promise<void>;
|
|
2239
2381
|
snapshot(runId: RunId): Promise<RunSnapshot>;
|
|
2240
2382
|
history(agentId: AgentId): Promise<readonly Message[]>;
|
|
@@ -2268,10 +2410,51 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2268
2410
|
private startHeartbeat;
|
|
2269
2411
|
}
|
|
2270
2412
|
|
|
2413
|
+
type Mutable<T> = {
|
|
2414
|
+
-readonly [Key in keyof T]: T[Key];
|
|
2415
|
+
};
|
|
2416
|
+
type StoredAgent = Mutable<AgentRecord>;
|
|
2417
|
+
type StoredRun = Mutable<RunRecord>;
|
|
2418
|
+
type StoredToolCall = {
|
|
2419
|
+
id: ToolCallId;
|
|
2420
|
+
providerToolCallId: string;
|
|
2421
|
+
agentId: AgentId;
|
|
2422
|
+
runId: RunId;
|
|
2423
|
+
executionId: ExecutionId;
|
|
2424
|
+
requestMessageId: MessageId;
|
|
2425
|
+
name: string;
|
|
2426
|
+
args: JsonValue;
|
|
2427
|
+
state: ToolCallState;
|
|
2428
|
+
result?: DurableToolResult;
|
|
2429
|
+
resultMessageId?: MessageId;
|
|
2430
|
+
reason?: string;
|
|
2431
|
+
createdAt: string;
|
|
2432
|
+
updatedAt: string;
|
|
2433
|
+
};
|
|
2271
2434
|
type IdempotencyReceipt = {
|
|
2272
2435
|
payload: string;
|
|
2273
2436
|
result: unknown;
|
|
2274
2437
|
};
|
|
2438
|
+
type StoreMutationRecorder = {
|
|
2439
|
+
onAgentUpsert(agent: StoredAgent): void;
|
|
2440
|
+
onAgentDelete(agentId: AgentId): void;
|
|
2441
|
+
onRunUpsert(run: StoredRun): void;
|
|
2442
|
+
onRunDelete(runId: RunId): void;
|
|
2443
|
+
onMessageInsert(message: Message): void;
|
|
2444
|
+
onMessageDelete(messageId: MessageId): void;
|
|
2445
|
+
onToolCallUpsert(toolCall: StoredToolCall): void;
|
|
2446
|
+
onToolCallDelete(toolCallId: ToolCallId): void;
|
|
2447
|
+
onEventAppend(event: DurableRunEvent): void;
|
|
2448
|
+
onEventsTruncate(deletedEventIds: string[]): void;
|
|
2449
|
+
onIdempotencyUpsert(scope: string, receipt: IdempotencyReceipt): void;
|
|
2450
|
+
onIdempotencyDelete(scope: string): void;
|
|
2451
|
+
onOperationReceiptUpsert(key: string, receipt: IdempotencyReceipt): void;
|
|
2452
|
+
onOperationReceiptDelete(key: string): void;
|
|
2453
|
+
onConsumerCheckpointUpsert(consumerId: string, cursor: EventCursor): void;
|
|
2454
|
+
onConsumerCheckpointDelete(consumerId: string): void;
|
|
2455
|
+
onContextCompactionUpsert(agentId: AgentId, record: ContextCompactionRecord): void;
|
|
2456
|
+
onRetentionFloorChange(floor: number): void;
|
|
2457
|
+
};
|
|
2275
2458
|
type InMemoryStoreState = Readonly<{
|
|
2276
2459
|
incarnation: string;
|
|
2277
2460
|
agents: readonly AgentRecord[];
|
|
@@ -2282,7 +2465,7 @@ type InMemoryStoreState = Readonly<{
|
|
|
2282
2465
|
idempotency: readonly (readonly [string, IdempotencyReceipt])[];
|
|
2283
2466
|
operationReceipts: readonly (readonly [string, IdempotencyReceipt])[];
|
|
2284
2467
|
historySeeds?: readonly (readonly [AgentId, readonly Message[]])[];
|
|
2285
|
-
consumerCheckpoints
|
|
2468
|
+
consumerCheckpoints?: readonly (readonly [string, EventCursor])[];
|
|
2286
2469
|
retentionFloor?: number;
|
|
2287
2470
|
nextAgentSequence: readonly (readonly [AgentId, number])[];
|
|
2288
2471
|
nextReadySequence: readonly (readonly [AgentId, number])[];
|
|
@@ -2307,11 +2490,23 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2307
2490
|
private eventSequence;
|
|
2308
2491
|
private retentionFloor;
|
|
2309
2492
|
private readonly contextCompactions;
|
|
2493
|
+
private recorder?;
|
|
2494
|
+
private readonly runReceiptKeys;
|
|
2310
2495
|
constructor(options?: {
|
|
2311
2496
|
incarnation?: string;
|
|
2312
2497
|
});
|
|
2498
|
+
setChangeRecorder(recorder?: StoreMutationRecorder): void;
|
|
2499
|
+
private touchAgent;
|
|
2500
|
+
private touchRun;
|
|
2501
|
+
private storeMessage;
|
|
2502
|
+
private storeToolCall;
|
|
2503
|
+
private appendEvent;
|
|
2504
|
+
inferRunIdForReceipt(key: string, payload: string): RunId | undefined;
|
|
2505
|
+
dropRunOperationReceipts(runId: RunId): void;
|
|
2506
|
+
compactTerminalReceipts(): number;
|
|
2313
2507
|
static fromState(state: InMemoryStoreState): InMemoryStore;
|
|
2314
2508
|
exportState(): InMemoryStoreState;
|
|
2509
|
+
exportMetadata(): Record<string, unknown>;
|
|
2315
2510
|
attachOwner(lease: OwnerLease): void;
|
|
2316
2511
|
interruptOwner(ownerEpoch: number, message?: string): void;
|
|
2317
2512
|
openOwner(input: {
|
|
@@ -2521,12 +2716,32 @@ declare class SqliteStore implements DurableStore {
|
|
|
2521
2716
|
private mirroredAgents;
|
|
2522
2717
|
private closed;
|
|
2523
2718
|
private configured;
|
|
2719
|
+
private cachedMemory?;
|
|
2720
|
+
private cachedOwner?;
|
|
2721
|
+
private isLegacyState;
|
|
2722
|
+
private stmtUpsertAgent?;
|
|
2723
|
+
private stmtDeleteAgent?;
|
|
2724
|
+
private stmtUpsertRun?;
|
|
2725
|
+
private stmtDeleteRun?;
|
|
2726
|
+
private stmtInsertMessage?;
|
|
2727
|
+
private stmtDeleteMessage?;
|
|
2728
|
+
private stmtUpsertToolCall?;
|
|
2729
|
+
private stmtDeleteToolCall?;
|
|
2730
|
+
private stmtInsertEvent?;
|
|
2731
|
+
private stmtDeleteEvent?;
|
|
2732
|
+
private stmtUpsertIdempotency?;
|
|
2733
|
+
private stmtDeleteIdempotency?;
|
|
2734
|
+
private stmtUpsertCheckpoint?;
|
|
2735
|
+
private stmtDeleteCheckpoint?;
|
|
2736
|
+
private stmtUpdateMeta?;
|
|
2737
|
+
private stmtUpdateState?;
|
|
2524
2738
|
constructor(filename?: string);
|
|
2525
2739
|
openOwner(input: {
|
|
2526
2740
|
ownerId: string;
|
|
2527
2741
|
leaseMs: number;
|
|
2528
2742
|
}): Promise<OwnedStore>;
|
|
2529
2743
|
close(): void;
|
|
2744
|
+
exportState(): InMemoryStoreState;
|
|
2530
2745
|
/** Filesystem location owned by this Store for one Agent's readable archive. */
|
|
2531
2746
|
contextArchiveDir(agentId: AgentId): string;
|
|
2532
2747
|
reserveAgent(lease: OwnerLease, input: {
|
|
@@ -2687,6 +2902,8 @@ declare class SqliteStore implements DurableStore {
|
|
|
2687
2902
|
}): Promise<RetentionResult>;
|
|
2688
2903
|
renewOwner(lease: OwnerLease, leaseMs: number): Promise<OwnerLease>;
|
|
2689
2904
|
sealAndReleaseOwner(lease: OwnerLease): Promise<void>;
|
|
2905
|
+
private read;
|
|
2906
|
+
private write;
|
|
2690
2907
|
private invoke;
|
|
2691
2908
|
private ensureSchema;
|
|
2692
2909
|
private isCurrentSchema;
|
|
@@ -2695,10 +2912,29 @@ declare class SqliteStore implements DurableStore {
|
|
|
2695
2912
|
private readOwner;
|
|
2696
2913
|
private writeOwner;
|
|
2697
2914
|
private readState;
|
|
2698
|
-
private
|
|
2699
|
-
private
|
|
2915
|
+
private loadTableBackedState;
|
|
2916
|
+
private ensureTableBackedStorage;
|
|
2917
|
+
private getStmtUpsertAgent;
|
|
2918
|
+
private getStmtDeleteAgent;
|
|
2919
|
+
private getStmtUpsertRun;
|
|
2920
|
+
private getStmtDeleteRun;
|
|
2921
|
+
private getStmtInsertMessage;
|
|
2922
|
+
private getStmtDeleteMessage;
|
|
2923
|
+
private getStmtUpsertToolCall;
|
|
2924
|
+
private getStmtDeleteToolCall;
|
|
2925
|
+
private getStmtInsertEvent;
|
|
2926
|
+
private getStmtDeleteEvent;
|
|
2927
|
+
private getStmtUpsertIdempotency;
|
|
2928
|
+
private getStmtDeleteIdempotency;
|
|
2929
|
+
private getStmtUpsertCheckpoint;
|
|
2930
|
+
private getStmtDeleteCheckpoint;
|
|
2931
|
+
private getStmtUpdateMeta;
|
|
2932
|
+
private getStmtUpdateState;
|
|
2933
|
+
private persistChanges;
|
|
2934
|
+
private writeFullStateToTables;
|
|
2935
|
+
private mirrorChanges;
|
|
2700
2936
|
/** Append the semantic durable event mirror and remove deleted Agent sidecars. */
|
|
2701
|
-
private
|
|
2937
|
+
private mirrorInitialState;
|
|
2702
2938
|
private requireMatchingOwner;
|
|
2703
2939
|
private immediateTransaction;
|
|
2704
2940
|
private readTransaction;
|
|
@@ -2896,4 +3132,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
|
|
|
2896
3132
|
|
|
2897
3133
|
declare function createCoreTools(input?: CoreToolContext): Tool$1[];
|
|
2898
3134
|
|
|
2899
|
-
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 ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, InMemoryConfigProvider, 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 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 PhaseSettingsBadge, type PhaseSettingsContext, type PhaseSettingsControl, type PhaseSettingsDefinition, type PhaseSettingsItem, type PhaseSettingsOption, type PhaseSettingsProvider, type PhaseSettingsSection, 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 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 RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, STOP_PHASE_ID, type Skill, SqliteStore, type TextContent, type ThinkingContent, type ThinkingDelta, type Tool$1 as Tool, type ToolCallContext, type ToolCallId, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolProgress, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhaseSettings, loadPhases, loadSkill, loadSkills, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
|
|
3135
|
+
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 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 PhaseSettingsBadge, type PhaseSettingsContext, type PhaseSettingsControl, type PhaseSettingsDefinition, type PhaseSettingsItem, type PhaseSettingsOption, type PhaseSettingsProvider, type PhaseSettingsSection, 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 ScopeRef, type Skill, SqliteStore, type TextContent, type ThinkingContent, type ThinkingDelta, type Tool$1 as Tool, type ToolCallContext, type ToolCallId, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolProgress, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhaseSettings, loadPhases, loadSkill, loadSkills, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
|