@oh-my-pi/pi-agent-core 17.0.0 → 17.0.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.
@@ -2,7 +2,7 @@
2
2
  * Proxy stream function for apps that route LLM calls through a server.
3
3
  * The server manages auth and proxies requests to LLM providers.
4
4
  */
5
- import { type AssistantMessage, type AssistantMessageEvent, type Context, EventStream, type FetchImpl, type Model, type SimpleStreamOptions, type StopReason } from "@oh-my-pi/pi-ai";
5
+ import { type AssistantMessage, type AssistantMessageEvent, type Context, EventStream, type FetchImpl, type ImageContent, type Model, type SimpleStreamOptions, type StopReason } from "@oh-my-pi/pi-ai";
6
6
  export declare class ProxyMessageEventStream extends EventStream<AssistantMessageEvent, AssistantMessage> {
7
7
  constructor();
8
8
  }
@@ -33,6 +33,10 @@ export type ProxyAssistantMessageEvent = {
33
33
  type: "thinking_end";
34
34
  contentIndex: number;
35
35
  contentSignature?: string;
36
+ } | {
37
+ type: "image_end";
38
+ contentIndex: number;
39
+ content: ImageContent;
36
40
  } | {
37
41
  type: "toolcall_start";
38
42
  contentIndex: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-agent-core",
4
- "version": "17.0.0",
4
+ "version": "17.0.1",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -35,12 +35,12 @@
35
35
  "fmt": "biome format --write ."
36
36
  },
37
37
  "dependencies": {
38
- "@oh-my-pi/pi-ai": "17.0.0",
39
- "@oh-my-pi/pi-catalog": "17.0.0",
40
- "@oh-my-pi/pi-natives": "17.0.0",
41
- "@oh-my-pi/pi-utils": "17.0.0",
42
- "@oh-my-pi/pi-wire": "17.0.0",
43
- "@oh-my-pi/snapcompact": "17.0.0",
38
+ "@oh-my-pi/pi-ai": "17.0.1",
39
+ "@oh-my-pi/pi-catalog": "17.0.1",
40
+ "@oh-my-pi/pi-natives": "17.0.1",
41
+ "@oh-my-pi/pi-utils": "17.0.1",
42
+ "@oh-my-pi/pi-wire": "17.0.1",
43
+ "@oh-my-pi/snapcompact": "17.0.1",
44
44
  "@opentelemetry/api": "^1.9.1"
45
45
  },
46
46
  "devDependencies": {
package/src/agent-loop.ts CHANGED
@@ -183,6 +183,7 @@ type AssistantToolCallBlock = Extract<AssistantContentBlock, { type: "toolCall"
183
183
  function snapshotAssistantContentBlock(block: AssistantContentBlock): AssistantContentBlock {
184
184
  switch (block.type) {
185
185
  case "text":
186
+ case "image":
186
187
  return { ...block };
187
188
  case "thinking":
188
189
  return { ...block };
@@ -224,6 +225,7 @@ function snapshotAssistantMessageEvent(
224
225
  case "text_start":
225
226
  case "text_delta":
226
227
  case "text_end":
228
+ case "image_end":
227
229
  case "thinking_start":
228
230
  case "thinking_delta":
229
231
  case "thinking_end":
@@ -1525,6 +1527,7 @@ async function streamAssistantResponse(
1525
1527
  case "text_start":
1526
1528
  case "text_delta":
1527
1529
  case "text_end":
1530
+ case "image_end":
1528
1531
  case "thinking_start":
1529
1532
  case "thinking_delta":
1530
1533
  case "thinking_end":
package/src/proxy.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  type Context,
9
9
  EventStream,
10
10
  type FetchImpl,
11
+ type ImageContent,
11
12
  type Model,
12
13
  type SimpleStreamOptions,
13
14
  type StopReason,
@@ -47,6 +48,7 @@ export type ProxyAssistantMessageEvent =
47
48
  | { type: "thinking_start"; contentIndex: number }
48
49
  | { type: "thinking_delta"; contentIndex: number; delta: string }
49
50
  | { type: "thinking_end"; contentIndex: number; contentSignature?: string }
51
+ | { type: "image_end"; contentIndex: number; content: ImageContent }
50
52
  | { type: "toolcall_start"; contentIndex: number; id: string; toolName: string }
51
53
  | { type: "toolcall_delta"; contentIndex: number; delta: string }
52
54
  | { type: "toolcall_end"; contentIndex: number }
@@ -315,6 +317,15 @@ function processProxyEvent(
315
317
  throw new Error("Received thinking_end for non-thinking content");
316
318
  }
317
319
 
320
+ case "image_end":
321
+ partial.content[proxyEvent.contentIndex] = proxyEvent.content;
322
+ return {
323
+ type: "image_end",
324
+ contentIndex: proxyEvent.contentIndex,
325
+ content: proxyEvent.content,
326
+ partial,
327
+ };
328
+
318
329
  case "toolcall_start":
319
330
  partial.content[proxyEvent.contentIndex] = {
320
331
  type: "toolCall",
package/src/telemetry.ts CHANGED
@@ -957,6 +957,9 @@ function assistantContentToOtelParts(content: AssistantMessage["content"]): Otel
957
957
  case "text":
958
958
  parts.push({ type: "text", content: part.text });
959
959
  break;
960
+ case "image":
961
+ parts.push({ type: "blob", modality: "image", mime_type: part.mimeType, content: part.data });
962
+ break;
960
963
  case "thinking":
961
964
  parts.push({ type: "reasoning", content: part.thinking });
962
965
  break;