@pi-unipi/ralph 2.3.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.
Files changed (2) hide show
  1. package/index.ts +10 -5
  2. package/package.json +3 -3
package/index.ts CHANGED
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/ralph",
3
- "version": "2.3.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",
@@ -27,8 +27,8 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@pi-unipi/core": "2.3.0",
31
- "@pi-unipi/info-screen": "2.3.0"
30
+ "@pi-unipi/core": "2.4.0",
31
+ "@pi-unipi/info-screen": "2.4.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@earendil-works/pi-ai": "^0.80.0",