@pi-unipi/unipi 2.4.0 → 2.4.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.4.1] — 2026-08-13
10
+
11
+ ### Fixed
12
+
13
+ - **`ralph`: loop status no longer invalidates the DeepSeek prefix cache.** The `before_agent_start` hook appended `[RALPH LOOP - name - Iteration N]` to the system prompt on every turn; because the iteration number changes each turn, this mutated the request prefix on every turn of a Ralph loop, forcing a full DeepSeek prefix-cache miss (~60K tokens re-billed at uncached price) per turn. The loop status now rides a hidden tail message (`unipi-ralph-loop-reminder`) so the cacheable prefix (system prompt + prior history) stays byte-stable across turns. The model still sees the loop name, iteration, and instructions.
14
+
9
15
  ## [2.4.0] — 2026-08-09
10
16
 
11
17
  Image generation no longer requires an OpenRouter account, and `image_generate` can now edit an existing image.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/unipi",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "All-in-one extension suite for Pi coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -80,7 +80,7 @@
80
80
  "@pi-unipi/info-screen": "2.4.0",
81
81
  "@pi-unipi/mcp": "2.4.0",
82
82
  "@pi-unipi/memory": "2.4.0",
83
- "@pi-unipi/ralph": "2.4.0",
83
+ "@pi-unipi/ralph": "2.4.1",
84
84
  "@pi-unipi/subagents": "2.4.0",
85
85
  "@pi-unipi/utility": "2.4.0",
86
86
  "@pi-unipi/milestone": "2.4.0",
File without changes
File without changes
File without changes
@@ -145,8 +145,11 @@ export default function (pi: ExtensionAPI) {
145
145
  }
146
146
  });
147
147
 
148
- // Inject ralph instructions when loop is active
149
- pi.on("before_agent_start", async (event, ctx) => {
148
+ // Inject ralph instructions when loop is active.
149
+ // NOTE: injected as a hidden tail message (not the system prompt) so the
150
+ // cacheable prefix (system prompt + prior history) stays byte-stable across
151
+ // turns. The iteration number changes every turn and must never touch the prefix.
152
+ pi.on("before_agent_start", async (_event, ctx) => {
150
153
  const mgr = getManager(ctx, pi);
151
154
  const currentLoop = mgr.getCurrentLoop();
152
155
  if (!currentLoop) return;
@@ -165,9 +168,11 @@ export default function (pi: ExtensionAPI) {
165
168
  instructions += `- Otherwise, call ralph_done tool to proceed to next iteration`;
166
169
 
167
170
  return {
168
- systemPrompt:
169
- event.systemPrompt +
170
- `\n[RALPH LOOP - ${state.name} - Iteration ${iterStr}]\n\n${instructions}`,
171
+ message: {
172
+ customType: "unipi-ralph-loop-reminder",
173
+ content: `[RALPH LOOP - ${state.name} - Iteration ${iterStr}]\n\n${instructions}`,
174
+ display: false,
175
+ },
171
176
  };
172
177
  });
173
178
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/ralph",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Long-running iterative development loops for Pi coding agent",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -7743,7 +7743,7 @@ function ralph_default(pi) {
7743
7743
  );
7744
7744
  }
7745
7745
  });
7746
- pi.on("before_agent_start", async (event, ctx) => {
7746
+ pi.on("before_agent_start", async (_event, ctx) => {
7747
7747
  const mgr = getManager(ctx, pi);
7748
7748
  const currentLoop = mgr.getCurrentLoop();
7749
7749
  if (!currentLoop) return;
@@ -7762,10 +7762,13 @@ function ralph_default(pi) {
7762
7762
  `;
7763
7763
  instructions += `- Otherwise, call ralph_done tool to proceed to next iteration`;
7764
7764
  return {
7765
- systemPrompt: event.systemPrompt + `
7766
- [RALPH LOOP - ${state.name} - Iteration ${iterStr}]
7765
+ message: {
7766
+ customType: "unipi-ralph-loop-reminder",
7767
+ content: `[RALPH LOOP - ${state.name} - Iteration ${iterStr}]
7767
7768
 
7768
- ${instructions}`
7769
+ ${instructions}`,
7770
+ display: false
7771
+ }
7769
7772
  };
7770
7773
  });
7771
7774
  pi.on("session_shutdown", async (_event, ctx) => {