@rowan-agent/agent 0.15.3 → 0.15.5
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 +117 -4
- package/dist/index.js +912 -136
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1137,6 +1137,12 @@ interface OwnedStore {
|
|
|
1137
1137
|
phaseId: string;
|
|
1138
1138
|
visit: number;
|
|
1139
1139
|
}): Promise<RunRecord>;
|
|
1140
|
+
commitPhaseOutput(input: {
|
|
1141
|
+
runId: RunId;
|
|
1142
|
+
execution: ExecutionToken;
|
|
1143
|
+
expectedRevision: number;
|
|
1144
|
+
message: AssistantMessage;
|
|
1145
|
+
}): Promise<RunRecord>;
|
|
1140
1146
|
commitInputRequired(input: {
|
|
1141
1147
|
runId: RunId;
|
|
1142
1148
|
execution: ExecutionToken;
|
|
@@ -2262,10 +2268,51 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2262
2268
|
private startHeartbeat;
|
|
2263
2269
|
}
|
|
2264
2270
|
|
|
2271
|
+
type Mutable<T> = {
|
|
2272
|
+
-readonly [Key in keyof T]: T[Key];
|
|
2273
|
+
};
|
|
2274
|
+
type StoredAgent = Mutable<AgentRecord>;
|
|
2275
|
+
type StoredRun = Mutable<RunRecord>;
|
|
2276
|
+
type StoredToolCall = {
|
|
2277
|
+
id: ToolCallId;
|
|
2278
|
+
providerToolCallId: string;
|
|
2279
|
+
agentId: AgentId;
|
|
2280
|
+
runId: RunId;
|
|
2281
|
+
executionId: ExecutionId;
|
|
2282
|
+
requestMessageId: MessageId;
|
|
2283
|
+
name: string;
|
|
2284
|
+
args: JsonValue;
|
|
2285
|
+
state: ToolCallState;
|
|
2286
|
+
result?: DurableToolResult;
|
|
2287
|
+
resultMessageId?: MessageId;
|
|
2288
|
+
reason?: string;
|
|
2289
|
+
createdAt: string;
|
|
2290
|
+
updatedAt: string;
|
|
2291
|
+
};
|
|
2265
2292
|
type IdempotencyReceipt = {
|
|
2266
2293
|
payload: string;
|
|
2267
2294
|
result: unknown;
|
|
2268
2295
|
};
|
|
2296
|
+
type StoreMutationRecorder = {
|
|
2297
|
+
onAgentUpsert(agent: StoredAgent): void;
|
|
2298
|
+
onAgentDelete(agentId: AgentId): void;
|
|
2299
|
+
onRunUpsert(run: StoredRun): void;
|
|
2300
|
+
onRunDelete(runId: RunId): void;
|
|
2301
|
+
onMessageInsert(message: Message): void;
|
|
2302
|
+
onMessageDelete(messageId: MessageId): void;
|
|
2303
|
+
onToolCallUpsert(toolCall: StoredToolCall): void;
|
|
2304
|
+
onToolCallDelete(toolCallId: ToolCallId): void;
|
|
2305
|
+
onEventAppend(event: DurableRunEvent): void;
|
|
2306
|
+
onEventsTruncate(deletedEventIds: string[]): void;
|
|
2307
|
+
onIdempotencyUpsert(scope: string, receipt: IdempotencyReceipt): void;
|
|
2308
|
+
onIdempotencyDelete(scope: string): void;
|
|
2309
|
+
onOperationReceiptUpsert(key: string, receipt: IdempotencyReceipt): void;
|
|
2310
|
+
onOperationReceiptDelete(key: string): void;
|
|
2311
|
+
onConsumerCheckpointUpsert(consumerId: string, cursor: EventCursor): void;
|
|
2312
|
+
onConsumerCheckpointDelete(consumerId: string): void;
|
|
2313
|
+
onContextCompactionUpsert(agentId: AgentId, record: ContextCompactionRecord): void;
|
|
2314
|
+
onRetentionFloorChange(floor: number): void;
|
|
2315
|
+
};
|
|
2269
2316
|
type InMemoryStoreState = Readonly<{
|
|
2270
2317
|
incarnation: string;
|
|
2271
2318
|
agents: readonly AgentRecord[];
|
|
@@ -2276,7 +2323,7 @@ type InMemoryStoreState = Readonly<{
|
|
|
2276
2323
|
idempotency: readonly (readonly [string, IdempotencyReceipt])[];
|
|
2277
2324
|
operationReceipts: readonly (readonly [string, IdempotencyReceipt])[];
|
|
2278
2325
|
historySeeds?: readonly (readonly [AgentId, readonly Message[]])[];
|
|
2279
|
-
consumerCheckpoints
|
|
2326
|
+
consumerCheckpoints?: readonly (readonly [string, EventCursor])[];
|
|
2280
2327
|
retentionFloor?: number;
|
|
2281
2328
|
nextAgentSequence: readonly (readonly [AgentId, number])[];
|
|
2282
2329
|
nextReadySequence: readonly (readonly [AgentId, number])[];
|
|
@@ -2301,11 +2348,23 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2301
2348
|
private eventSequence;
|
|
2302
2349
|
private retentionFloor;
|
|
2303
2350
|
private readonly contextCompactions;
|
|
2351
|
+
private recorder?;
|
|
2352
|
+
private readonly runReceiptKeys;
|
|
2304
2353
|
constructor(options?: {
|
|
2305
2354
|
incarnation?: string;
|
|
2306
2355
|
});
|
|
2356
|
+
setChangeRecorder(recorder?: StoreMutationRecorder): void;
|
|
2357
|
+
private touchAgent;
|
|
2358
|
+
private touchRun;
|
|
2359
|
+
private storeMessage;
|
|
2360
|
+
private storeToolCall;
|
|
2361
|
+
private appendEvent;
|
|
2362
|
+
inferRunIdForReceipt(key: string, payload: string): RunId | undefined;
|
|
2363
|
+
dropRunOperationReceipts(runId: RunId): void;
|
|
2364
|
+
compactTerminalReceipts(): number;
|
|
2307
2365
|
static fromState(state: InMemoryStoreState): InMemoryStore;
|
|
2308
2366
|
exportState(): InMemoryStoreState;
|
|
2367
|
+
exportMetadata(): Record<string, unknown>;
|
|
2309
2368
|
attachOwner(lease: OwnerLease): void;
|
|
2310
2369
|
interruptOwner(ownerEpoch: number, message?: string): void;
|
|
2311
2370
|
openOwner(input: {
|
|
@@ -2368,6 +2427,13 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2368
2427
|
phaseId: string;
|
|
2369
2428
|
visit: number;
|
|
2370
2429
|
}): RunRecord;
|
|
2430
|
+
/** Commit a parallel Phase's reply while its Run is still running. */
|
|
2431
|
+
commitPhaseOutput(lease: OwnerLease, input: {
|
|
2432
|
+
runId: RunId;
|
|
2433
|
+
execution: ExecutionToken;
|
|
2434
|
+
expectedRevision: number;
|
|
2435
|
+
message: AssistantMessage;
|
|
2436
|
+
}): RunRecord;
|
|
2371
2437
|
commitInputRequired(lease: OwnerLease, input: {
|
|
2372
2438
|
runId: RunId;
|
|
2373
2439
|
execution: ExecutionToken;
|
|
@@ -2508,12 +2574,32 @@ declare class SqliteStore implements DurableStore {
|
|
|
2508
2574
|
private mirroredAgents;
|
|
2509
2575
|
private closed;
|
|
2510
2576
|
private configured;
|
|
2577
|
+
private cachedMemory?;
|
|
2578
|
+
private cachedOwner?;
|
|
2579
|
+
private isLegacyState;
|
|
2580
|
+
private stmtUpsertAgent?;
|
|
2581
|
+
private stmtDeleteAgent?;
|
|
2582
|
+
private stmtUpsertRun?;
|
|
2583
|
+
private stmtDeleteRun?;
|
|
2584
|
+
private stmtInsertMessage?;
|
|
2585
|
+
private stmtDeleteMessage?;
|
|
2586
|
+
private stmtUpsertToolCall?;
|
|
2587
|
+
private stmtDeleteToolCall?;
|
|
2588
|
+
private stmtInsertEvent?;
|
|
2589
|
+
private stmtDeleteEvent?;
|
|
2590
|
+
private stmtUpsertIdempotency?;
|
|
2591
|
+
private stmtDeleteIdempotency?;
|
|
2592
|
+
private stmtUpsertCheckpoint?;
|
|
2593
|
+
private stmtDeleteCheckpoint?;
|
|
2594
|
+
private stmtUpdateMeta?;
|
|
2595
|
+
private stmtUpdateState?;
|
|
2511
2596
|
constructor(filename?: string);
|
|
2512
2597
|
openOwner(input: {
|
|
2513
2598
|
ownerId: string;
|
|
2514
2599
|
leaseMs: number;
|
|
2515
2600
|
}): Promise<OwnedStore>;
|
|
2516
2601
|
close(): void;
|
|
2602
|
+
exportState(): InMemoryStoreState;
|
|
2517
2603
|
/** Filesystem location owned by this Store for one Agent's readable archive. */
|
|
2518
2604
|
contextArchiveDir(agentId: AgentId): string;
|
|
2519
2605
|
reserveAgent(lease: OwnerLease, input: {
|
|
@@ -2571,6 +2657,12 @@ declare class SqliteStore implements DurableStore {
|
|
|
2571
2657
|
phaseId: string;
|
|
2572
2658
|
visit: number;
|
|
2573
2659
|
}): Promise<RunRecord>;
|
|
2660
|
+
commitPhaseOutput(lease: OwnerLease, input: {
|
|
2661
|
+
runId: RunId;
|
|
2662
|
+
execution: ExecutionToken;
|
|
2663
|
+
expectedRevision: number;
|
|
2664
|
+
message: AssistantMessage;
|
|
2665
|
+
}): Promise<RunRecord>;
|
|
2574
2666
|
commitInputRequired(lease: OwnerLease, input: {
|
|
2575
2667
|
runId: RunId;
|
|
2576
2668
|
execution: ExecutionToken;
|
|
@@ -2668,6 +2760,8 @@ declare class SqliteStore implements DurableStore {
|
|
|
2668
2760
|
}): Promise<RetentionResult>;
|
|
2669
2761
|
renewOwner(lease: OwnerLease, leaseMs: number): Promise<OwnerLease>;
|
|
2670
2762
|
sealAndReleaseOwner(lease: OwnerLease): Promise<void>;
|
|
2763
|
+
private read;
|
|
2764
|
+
private write;
|
|
2671
2765
|
private invoke;
|
|
2672
2766
|
private ensureSchema;
|
|
2673
2767
|
private isCurrentSchema;
|
|
@@ -2676,10 +2770,29 @@ declare class SqliteStore implements DurableStore {
|
|
|
2676
2770
|
private readOwner;
|
|
2677
2771
|
private writeOwner;
|
|
2678
2772
|
private readState;
|
|
2679
|
-
private
|
|
2680
|
-
private
|
|
2773
|
+
private loadTableBackedState;
|
|
2774
|
+
private ensureTableBackedStorage;
|
|
2775
|
+
private getStmtUpsertAgent;
|
|
2776
|
+
private getStmtDeleteAgent;
|
|
2777
|
+
private getStmtUpsertRun;
|
|
2778
|
+
private getStmtDeleteRun;
|
|
2779
|
+
private getStmtInsertMessage;
|
|
2780
|
+
private getStmtDeleteMessage;
|
|
2781
|
+
private getStmtUpsertToolCall;
|
|
2782
|
+
private getStmtDeleteToolCall;
|
|
2783
|
+
private getStmtInsertEvent;
|
|
2784
|
+
private getStmtDeleteEvent;
|
|
2785
|
+
private getStmtUpsertIdempotency;
|
|
2786
|
+
private getStmtDeleteIdempotency;
|
|
2787
|
+
private getStmtUpsertCheckpoint;
|
|
2788
|
+
private getStmtDeleteCheckpoint;
|
|
2789
|
+
private getStmtUpdateMeta;
|
|
2790
|
+
private getStmtUpdateState;
|
|
2791
|
+
private persistChanges;
|
|
2792
|
+
private writeFullStateToTables;
|
|
2793
|
+
private mirrorChanges;
|
|
2681
2794
|
/** Append the semantic durable event mirror and remove deleted Agent sidecars. */
|
|
2682
|
-
private
|
|
2795
|
+
private mirrorInitialState;
|
|
2683
2796
|
private requireMatchingOwner;
|
|
2684
2797
|
private immediateTransaction;
|
|
2685
2798
|
private readTransaction;
|