@f5-sales-demo/pi-agent-core 21.15.0 → 21.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/package.json +3 -3
- package/src/proxy.ts +16 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-agent-core",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.16.0",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@f5-sales-demo/pi-ai": "21.
|
|
39
|
-
"@f5-sales-demo/pi-utils": "21.
|
|
38
|
+
"@f5-sales-demo/pi-ai": "21.16.0",
|
|
39
|
+
"@f5-sales-demo/pi-utils": "21.16.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@sinclair/typebox": "^0.34",
|
package/src/proxy.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
type AssistantMessage,
|
|
7
7
|
type AssistantMessageEvent,
|
|
8
|
+
type AssistantMessagePhase,
|
|
8
9
|
type Context,
|
|
9
10
|
EventStream,
|
|
10
11
|
type Model,
|
|
@@ -34,9 +35,9 @@ class ProxyMessageEventStream extends EventStream<AssistantMessageEvent, Assista
|
|
|
34
35
|
*/
|
|
35
36
|
export type ProxyAssistantMessageEvent =
|
|
36
37
|
| { type: "start" }
|
|
37
|
-
| { type: "text_start"; contentIndex: number }
|
|
38
|
+
| { type: "text_start"; contentIndex: number; phase?: AssistantMessagePhase }
|
|
38
39
|
| { type: "text_delta"; contentIndex: number; delta: string }
|
|
39
|
-
| { type: "text_end"; contentIndex: number; contentSignature?: string }
|
|
40
|
+
| { type: "text_end"; contentIndex: number; contentSignature?: string; phase?: AssistantMessagePhase }
|
|
40
41
|
| { type: "thinking_start"; contentIndex: number }
|
|
41
42
|
| { type: "thinking_delta"; contentIndex: number; delta: string }
|
|
42
43
|
| { type: "thinking_end"; contentIndex: number; contentSignature?: string }
|
|
@@ -205,8 +206,17 @@ function processProxyEvent(
|
|
|
205
206
|
return { type: "start", partial };
|
|
206
207
|
|
|
207
208
|
case "text_start":
|
|
208
|
-
partial.content[proxyEvent.contentIndex] = {
|
|
209
|
-
|
|
209
|
+
partial.content[proxyEvent.contentIndex] = {
|
|
210
|
+
type: "text",
|
|
211
|
+
text: "",
|
|
212
|
+
phase: proxyEvent.phase ?? "final_answer",
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
type: "text_start",
|
|
216
|
+
contentIndex: proxyEvent.contentIndex,
|
|
217
|
+
phase: proxyEvent.phase ?? "final_answer",
|
|
218
|
+
partial,
|
|
219
|
+
};
|
|
210
220
|
|
|
211
221
|
case "text_delta": {
|
|
212
222
|
const content = partial.content[proxyEvent.contentIndex];
|
|
@@ -226,10 +236,12 @@ function processProxyEvent(
|
|
|
226
236
|
const content = partial.content[proxyEvent.contentIndex];
|
|
227
237
|
if (content?.type === "text") {
|
|
228
238
|
content.textSignature = proxyEvent.contentSignature;
|
|
239
|
+
content.phase = proxyEvent.phase ?? content.phase ?? "final_answer";
|
|
229
240
|
return {
|
|
230
241
|
type: "text_end",
|
|
231
242
|
contentIndex: proxyEvent.contentIndex,
|
|
232
243
|
content: content.text,
|
|
244
|
+
phase: content.phase,
|
|
233
245
|
partial,
|
|
234
246
|
};
|
|
235
247
|
}
|