@springbrand/agent-runtime 0.2.0-alpha.63 → 0.2.0-alpha.65
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/package.json +1 -1
- package/src/pi/message/contract.ts +2 -0
- package/src/runtime.ts +12 -7
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ export interface RequestedCapability {
|
|
|
7
7
|
readonly kind: "skill" | "tool" | "plan";
|
|
8
8
|
readonly name: string;
|
|
9
9
|
readonly label: string;
|
|
10
|
+
/** Stable Resource identity used only to group capabilities in presentation. */
|
|
11
|
+
readonly resourceId?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export interface UIChatRequestBody {
|
package/src/runtime.ts
CHANGED
|
@@ -3486,13 +3486,7 @@ export abstract class AgentRuntimeKernel<
|
|
|
3486
3486
|
* 使持久化历史和 resumable stream 只有一个生产者。
|
|
3487
3487
|
*/
|
|
3488
3488
|
async onConnect(connection: Connection): Promise<void> {
|
|
3489
|
-
|
|
3490
|
-
connection,
|
|
3491
|
-
json({
|
|
3492
|
-
type: MessageType.CF_AGENT_CHAT_MESSAGES,
|
|
3493
|
-
messages: await this.hydrationMessages(),
|
|
3494
|
-
}),
|
|
3495
|
-
);
|
|
3489
|
+
await this.sendHydrationSnapshot(connection);
|
|
3496
3490
|
await super.onConnect(connection);
|
|
3497
3491
|
}
|
|
3498
3492
|
|
|
@@ -3618,6 +3612,10 @@ export abstract class AgentRuntimeKernel<
|
|
|
3618
3612
|
}
|
|
3619
3613
|
|
|
3620
3614
|
if (event.type === "stream-resume-request") {
|
|
3615
|
+
// The client sends this only after its listener mounts; onConnect's snapshot
|
|
3616
|
+
// may have arrived while initial history suspended. Active replies still
|
|
3617
|
+
// come exclusively from CF replay, never from this history snapshot.
|
|
3618
|
+
await this.sendHydrationSnapshot(connection);
|
|
3621
3619
|
await this.handleResumeRequest(
|
|
3622
3620
|
connection,
|
|
3623
3621
|
event.probeId,
|
|
@@ -3659,6 +3657,13 @@ export abstract class AgentRuntimeKernel<
|
|
|
3659
3657
|
return this.transcript.browserMessages();
|
|
3660
3658
|
}
|
|
3661
3659
|
|
|
3660
|
+
private async sendHydrationSnapshot(connection: Connection): Promise<void> {
|
|
3661
|
+
sendIfOpen(connection, json({
|
|
3662
|
+
type: MessageType.CF_AGENT_CHAT_MESSAGES,
|
|
3663
|
+
messages: await this.hydrationMessages(),
|
|
3664
|
+
}));
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3662
3667
|
private async hydrationMessages(): Promise<UIMessage[]> {
|
|
3663
3668
|
const messages = await this.getMessages();
|
|
3664
3669
|
const running = this.db.submissions.findRunning();
|