@rowan-agent/agent 0.20.0 → 0.20.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.
- package/dist/index.d.ts +8 -0
- package/dist/index.js +26 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1131,6 +1131,7 @@ interface OwnedStore {
|
|
|
1131
1131
|
execution?: ExecutionToken;
|
|
1132
1132
|
update: ToolCall$1 | ToolCallUpdate;
|
|
1133
1133
|
external?: boolean;
|
|
1134
|
+
contentIndex?: number;
|
|
1134
1135
|
}): Promise<DurableRunEvent>;
|
|
1135
1136
|
snapshotRun(runId: RunId): Promise<RunSnapshot>;
|
|
1136
1137
|
history(agentId: AgentId): Promise<readonly Message[]>;
|
|
@@ -2173,6 +2174,7 @@ type ToolCallSnapshot = ToolCall$1 & Readonly<{
|
|
|
2173
2174
|
resultMessageId?: MessageId;
|
|
2174
2175
|
reason?: string;
|
|
2175
2176
|
external?: boolean;
|
|
2177
|
+
contentIndex?: number;
|
|
2176
2178
|
createdAt?: string;
|
|
2177
2179
|
updatedAt?: string;
|
|
2178
2180
|
}>;
|
|
@@ -2255,6 +2257,8 @@ type ToolStateChanged = (DurableEventBase & Readonly<{
|
|
|
2255
2257
|
}>;
|
|
2256
2258
|
toolCall: ToolCall$1;
|
|
2257
2259
|
external?: boolean;
|
|
2260
|
+
/** For a provider-reported call: assistant content blocks streamed before it. */
|
|
2261
|
+
contentIndex?: number;
|
|
2258
2262
|
}>) | Readonly<{
|
|
2259
2263
|
kind: "tool_state_changed";
|
|
2260
2264
|
durability: "transient";
|
|
@@ -2266,6 +2270,7 @@ type ToolStateChanged = (DurableEventBase & Readonly<{
|
|
|
2266
2270
|
}>;
|
|
2267
2271
|
toolCall: ToolCall$1 | ToolCallUpdate;
|
|
2268
2272
|
external?: boolean;
|
|
2273
|
+
contentIndex?: number;
|
|
2269
2274
|
}>;
|
|
2270
2275
|
type DurableRunEvent = PhaseEntered | MessageCommitted | MessageRevised | RunStateChanged | Extract<ToolStateChanged, {
|
|
2271
2276
|
durability: "durable";
|
|
@@ -2567,6 +2572,7 @@ type StoredToolCall = {
|
|
|
2567
2572
|
rawOutput?: JsonValue;
|
|
2568
2573
|
_meta?: JsonObject;
|
|
2569
2574
|
external?: boolean;
|
|
2575
|
+
contentIndex?: number;
|
|
2570
2576
|
result?: DurableToolResult;
|
|
2571
2577
|
resultMessageId?: MessageId;
|
|
2572
2578
|
reason?: string;
|
|
@@ -2809,6 +2815,7 @@ declare class InMemoryStore implements DurableStore {
|
|
|
2809
2815
|
execution?: ExecutionToken;
|
|
2810
2816
|
update: ToolCall$1 | ToolCallUpdate;
|
|
2811
2817
|
external?: boolean;
|
|
2818
|
+
contentIndex?: number;
|
|
2812
2819
|
}): DurableRunEvent;
|
|
2813
2820
|
snapshotRun(lease: OwnerLease, runId: RunId): RunSnapshot;
|
|
2814
2821
|
listAgents(lease: OwnerLease): readonly AgentRecord[];
|
|
@@ -3063,6 +3070,7 @@ declare class SqliteStore implements DurableStore {
|
|
|
3063
3070
|
execution?: ExecutionToken;
|
|
3064
3071
|
update: ToolCall$1 | ToolCallUpdate;
|
|
3065
3072
|
external?: boolean;
|
|
3073
|
+
contentIndex?: number;
|
|
3066
3074
|
}): Promise<DurableRunEvent>;
|
|
3067
3075
|
snapshotRun(lease: OwnerLease, runId: RunId): Promise<RunSnapshot>;
|
|
3068
3076
|
history(lease: OwnerLease, agentId: AgentId): Promise<readonly Message[]>;
|
package/dist/index.js
CHANGED
|
@@ -1378,7 +1378,7 @@ var LoopGuard = {
|
|
|
1378
1378
|
// src/loop/stream-collector.ts
|
|
1379
1379
|
var MAX_STREAMED_OUTPUT_CHARACTERS = 1024 * 1024;
|
|
1380
1380
|
async function invokeModel(input) {
|
|
1381
|
-
const
|
|
1381
|
+
const baseContext = input.callContext ?? {
|
|
1382
1382
|
signal: input.config.signal ?? new AbortController().signal,
|
|
1383
1383
|
run: {
|
|
1384
1384
|
id: input.config.execution.runId,
|
|
@@ -1413,8 +1413,23 @@ async function invokeModel(input) {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
}
|
|
1415
1415
|
};
|
|
1416
|
+
const position = { contentIndex: 0 };
|
|
1417
|
+
const callContext = {
|
|
1418
|
+
...baseContext,
|
|
1419
|
+
tools: {
|
|
1420
|
+
...baseContext.tools,
|
|
1421
|
+
report: (update) => {
|
|
1422
|
+
input.config.onToolReport?.({
|
|
1423
|
+
runId: input.config.execution.runId,
|
|
1424
|
+
update,
|
|
1425
|
+
contentIndex: position.contentIndex
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1416
1430
|
const events = input.config.stream(input.request, callContext);
|
|
1417
1431
|
const result = await collectStreamResult({
|
|
1432
|
+
position,
|
|
1418
1433
|
config: input.config,
|
|
1419
1434
|
message: input.message,
|
|
1420
1435
|
events,
|
|
@@ -1455,6 +1470,7 @@ async function collectStreamResult(input) {
|
|
|
1455
1470
|
const toolNames = /* @__PURE__ */ new Map();
|
|
1456
1471
|
const toolArguments = /* @__PURE__ */ new Map();
|
|
1457
1472
|
for await (const event of input.events) {
|
|
1473
|
+
if ("partial" in event) input.position.contentIndex = event.partial.contentBlocks.length;
|
|
1458
1474
|
if (event.type === "text_delta") {
|
|
1459
1475
|
streamedOutputCharacters += event.text.length;
|
|
1460
1476
|
} else if (event.type === "thinking_delta") {
|
|
@@ -8112,7 +8128,8 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
8112
8128
|
executionId: claim.execution.executionId,
|
|
8113
8129
|
transition: { from: null, to: event.update.status ?? "in_progress" },
|
|
8114
8130
|
toolCall: event.update,
|
|
8115
|
-
external: true
|
|
8131
|
+
external: true,
|
|
8132
|
+
...event.contentIndex === void 0 ? {} : { contentIndex: event.contentIndex }
|
|
8116
8133
|
});
|
|
8117
8134
|
const task = toolQueue.then(async () => {
|
|
8118
8135
|
const active2 = this.executions.get(run.id);
|
|
@@ -8121,7 +8138,8 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
8121
8138
|
runId: run.id,
|
|
8122
8139
|
execution: claim.execution,
|
|
8123
8140
|
update: event.update,
|
|
8124
|
-
external: true
|
|
8141
|
+
external: true,
|
|
8142
|
+
...event.contentIndex === void 0 ? {} : { contentIndex: event.contentIndex }
|
|
8125
8143
|
});
|
|
8126
8144
|
executionRevision = recorded.runRevision;
|
|
8127
8145
|
});
|
|
@@ -10716,6 +10734,7 @@ var InMemoryStore = class _InMemoryStore {
|
|
|
10716
10734
|
status: toStatus,
|
|
10717
10735
|
state: toStatus,
|
|
10718
10736
|
external: input.external ?? false,
|
|
10737
|
+
...input.contentIndex === void 0 ? {} : { contentIndex: input.contentIndex },
|
|
10719
10738
|
createdAt: timestamp,
|
|
10720
10739
|
updatedAt: timestamp
|
|
10721
10740
|
};
|
|
@@ -10741,7 +10760,8 @@ var InMemoryStore = class _InMemoryStore {
|
|
|
10741
10760
|
kind: "tool_state_changed",
|
|
10742
10761
|
transition: { from: fromStatus, to: toStatus },
|
|
10743
10762
|
toolCall: acpToolCall,
|
|
10744
|
-
...input.external ? { external: true } : {}
|
|
10763
|
+
...input.external ? { external: true } : {},
|
|
10764
|
+
...stored.contentIndex === void 0 ? {} : { contentIndex: stored.contentIndex }
|
|
10745
10765
|
});
|
|
10746
10766
|
this.appendEvent(event);
|
|
10747
10767
|
return event;
|
|
@@ -11185,7 +11205,8 @@ ${record.summary}`,
|
|
|
11185
11205
|
kind: "tool_state_changed",
|
|
11186
11206
|
transition,
|
|
11187
11207
|
toolCall: acpToolCall,
|
|
11188
|
-
...toolCall.external ? { external: true } : {}
|
|
11208
|
+
...toolCall.external ? { external: true } : {},
|
|
11209
|
+
...toolCall.contentIndex === void 0 ? {} : { contentIndex: toolCall.contentIndex }
|
|
11189
11210
|
});
|
|
11190
11211
|
}
|
|
11191
11212
|
baseEvent(run, extra) {
|