@oh-my-pi/pi-agent-core 18.0.5 → 18.0.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.0.7] - 2026-08-26
6
+
7
+ ### Fixed
8
+
9
+ - Fixed Codex remote compaction to preserve images returned by image-reading tools, preventing them from being replayed as incorrect synthetic user messages.
10
+
5
11
  ## [18.0.5] - 2026-08-25
6
12
 
7
13
  ### Fixed
@@ -87,7 +87,7 @@ export declare function withOpenAiRemoteCompactionPreserveData(preserveData: Rec
87
87
  * @param previousReplacementHistory - History from a prior compaction whose
88
88
  * encrypted reasoning we want to preserve.
89
89
  */
90
- export declare function buildOpenAiNativeHistory(messages: Message[], model: Model, previousReplacementHistory?: Array<Record<string, unknown>>): Array<Record<string, unknown>>;
90
+ export declare function buildOpenAiNativeHistory(messages: Message[], model: Model, previousReplacementHistory?: Array<Record<string, unknown>>, supportsImageDetailOriginal?: boolean): Array<Record<string, unknown>>;
91
91
  export declare function requestOpenAiRemoteCompaction(model: Model, apiKey: string, compactInput: Array<Record<string, unknown>>, instructions: string, signal?: AbortSignal, opts?: {
92
92
  fetch?: FetchImpl;
93
93
  timeoutMs?: 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": "18.0.5",
4
+ "version": "18.0.7",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Stencil Labs, Inc.",
@@ -35,16 +35,16 @@
35
35
  "fmt": "biome format --write ."
36
36
  },
37
37
  "dependencies": {
38
- "@oh-my-pi/pi-ai": "18.0.5",
39
- "@oh-my-pi/pi-catalog": "18.0.5",
40
- "@oh-my-pi/pi-natives": "18.0.5",
41
- "@oh-my-pi/pi-utils": "18.0.5",
42
- "@oh-my-pi/pi-wire": "18.0.5",
43
- "@oh-my-pi/snapcompact": "18.0.5",
38
+ "@oh-my-pi/pi-ai": "18.0.7",
39
+ "@oh-my-pi/pi-catalog": "18.0.7",
40
+ "@oh-my-pi/pi-natives": "18.0.7",
41
+ "@oh-my-pi/pi-utils": "18.0.7",
42
+ "@oh-my-pi/pi-wire": "18.0.7",
43
+ "@oh-my-pi/snapcompact": "18.0.7",
44
44
  "@opentelemetry/api": "^1.9.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@oh-my-pi/omptype": "18.0.5",
47
+ "@oh-my-pi/omptype": "18.0.7",
48
48
  "@opentelemetry/context-async-hooks": "^2.9.0",
49
49
  "@opentelemetry/sdk-trace-base": "^2.9.0",
50
50
  "@types/bun": "^1.3.14"
@@ -1674,6 +1674,7 @@ export async function compact(
1674
1674
  (summaryOptions.convertToLlm ?? defaultConvertToLlm)(remoteMessages),
1675
1675
  model,
1676
1676
  previousReplacementHistory,
1677
+ openAiCompatSupportsImageDetailOriginal(model),
1677
1678
  );
1678
1679
  if (remoteHistory.length > 0) {
1679
1680
  try {
@@ -23,6 +23,7 @@ import {
23
23
  getCodexAttestationHeader,
24
24
  } from "@oh-my-pi/pi-ai/providers/openai-codex-responses";
25
25
  import {
26
+ encodeResponsesToolResultOutput,
26
27
  hoistInterleavedResponsesToolBatchMessages,
27
28
  parseAzureDeploymentNameMap,
28
29
  parseTextSignature,
@@ -503,6 +504,7 @@ export function buildOpenAiNativeHistory(
503
504
  messages: Message[],
504
505
  model: Model,
505
506
  previousReplacementHistory?: Array<Record<string, unknown>>,
507
+ supportsImageDetailOriginal = false,
506
508
  ): Array<Record<string, unknown>> {
507
509
  const input: Array<Record<string, unknown>> = previousReplacementHistory
508
510
  ? adaptComputerHistoryForCompaction([...previousReplacementHistory], model.supportsComputerUse === true)
@@ -691,12 +693,7 @@ export function buildOpenAiNativeHistory(
691
693
 
692
694
  if (message.role === "toolResult") {
693
695
  const normalized = normalizeResponsesToolCallId(message.toolCallId);
694
- const textOutput = message.content
695
- .filter(block => block.type === "text")
696
- .map(block => block.text)
697
- .join("\n");
698
- const hasImages = message.content.some(block => block.type === "image");
699
- const outputText = textOutput.length > 0 ? textOutput : hasImages ? "(see attached image)" : "";
696
+ const { output, outputText } = encodeResponsesToolResultOutput(message, model, supportsImageDetailOriginal);
700
697
  if (demotedComputerCallIds.has(normalized.callId)) {
701
698
  const resultItem =
702
699
  message.providerMetadata?.type === "computer"
@@ -746,23 +743,8 @@ export function buildOpenAiNativeHistory(
746
743
  input.push({
747
744
  type: customCallIds.has(normalized.callId) ? "custom_tool_call_output" : "function_call_output",
748
745
  call_id: normalized.callId,
749
- output: outputText.toWellFormed(),
746
+ output,
750
747
  });
751
-
752
- if (hasImages && model.input.includes("image")) {
753
- const contentBlocks: Array<Record<string, unknown>> = [
754
- { type: "input_text", text: TOOL_RESULT_IMAGE_ATTACHMENT_TEXT },
755
- ];
756
- for (const block of message.content) {
757
- if (block.type !== "image") continue;
758
- contentBlocks.push({
759
- type: "input_image",
760
- detail: "auto",
761
- image_url: `data:${block.mimeType};base64,${block.data}`,
762
- });
763
- }
764
- input.push({ type: "message", role: "user", content: contentBlocks });
765
- }
766
748
  }
767
749
 
768
750
  msgIndex++;