@aexhq/agentloop-pi 5.1.0 → 6.0.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/README.md CHANGED
@@ -58,3 +58,6 @@ a truncated, refused, or unknown summary leaves the original saved context intac
58
58
  Version 5.1 targets Brain 0.22 and preserves the existing WIT. Existing sessions keep their
59
59
  immutable loop implementation; create new sessions to adopt the updated loop. Keep matching
60
60
  server/artifacts for recovery. An upgrade does not migrate or delete session data.
61
+
62
+ Image and PDF blocks remain native media in compaction requests. The JSON-length estimate used
63
+ for new context does not measure image/PDF tokens; provider context-limit failures remain explicit.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/agentloop-pi",
3
- "version": "5.1.0",
3
+ "version": "6.0.0",
4
4
  "description": "Pi-style parallel-Tool Brain extension",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "prepack": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "@aexhq/brain": "0.22.0",
38
+ "@aexhq/brain": "0.23.0",
39
39
  "zod": "4.4.3"
40
40
  },
41
41
  "devDependencies": {}
package/src/logic.mjs CHANGED
@@ -47,9 +47,9 @@ const blockText = (block) => {
47
47
  if (block.type === "text") return block.text;
48
48
  if (block.type === "tool_use") return `[tool_use ${block.name}] ${JSON.stringify(block.input)}`;
49
49
  if (block.type === "native") return `[provider continuation state: ${block.format}]`;
50
- if (block.type === "image") return block.url.startsWith("https://") ? `[image ${block.url}]` : "[embedded image]";
50
+ if (block.type === "image" || block.type === "file") return `[${block.type} ${block.url}]`;
51
51
  const output = typeof block.content === "string" ? block.content : JSON.stringify(block.content);
52
- return `[tool_result${block.is_error ? " (error)" : ""}] ${output.length > 2000 ? `${output.slice(0, 2000)}…` : output}`;
52
+ return `[tool_result${block.is_error ? " (error)" : ""}] ${output.length > 2000 ? `${output.slice(0, 2000)}…` : output}`;
53
53
  };
54
54
 
55
55
  const serializeConversation = (messages) =>
@@ -94,7 +94,7 @@ export async function runPi(input, context) {
94
94
  const { message, stop_reason } = await context.model({
95
95
  response_format: null,
96
96
  tools: [],
97
- messages: [{ role: "user", content: [{ type: "text", text: `${previous}${serializeConversation(messages.slice(0, cut))}\n\n${prompt}` }] }],
97
+ messages: [{ role: "user", content: [{ type: "text", text: `${previous}${serializeConversation(messages.slice(0, cut))}\n\n${prompt}` }, ...messages.slice(0, cut).flatMap(message => message.content.flatMap(block => block.type === "image" || block.type === "file" ? [block] : block.type === "tool_result" ? block.media ?? [] : []))] }],
98
98
  });
99
99
  if (stop_reason !== "end_turn") throw new Error(`Compaction did not complete: ${stop_reason}`);
100
100
  checkpoint.summary = text(message);