@howaboua/pi-shepherdr 0.2.2 → 0.2.3

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
@@ -1,5 +1,23 @@
1
1
  # @howaboua/pi-shepherdr
2
2
 
3
+ ## 0.2.3
4
+
5
+ - Fixed context continuity, voice replies, and patch preservation.
6
+
7
+ - V2 compaction preserves the preceding request's reasoning configuration, then starts a fresh baseline without stale overrides. Astra's temporary effort survives continued work across context windows.
8
+ - Worker updates now accept up to 8 KiB without truncation announcements or offers to read the rest.
9
+ - Reasoning-summary forwarding now recognizes GPT-6 models.
10
+ - Replies resume in voice after a context-window rollover, and carried transcripts no longer falsely report that the user ended the call.
11
+ - Reconnecting voice no longer reposts a cached Voice Context summary.
12
+ - Added an opt-in plain command output toggle for Code and Notebook modes under `/codex Tools`, keeping command metadata while printing output without JSON escaping.
13
+ - Notebook cell results report heap and RSS figures only under memory pressure; routine figures remain available through notebook status.
14
+ - Code and Notebook modes show running-command continuation instructions once per response, preserving the distinction between shell sessions and exec cells.
15
+ - Notebook syntax errors now point to the original cell source, with generated-code diagnostics labeled separately.
16
+ - `apply_patch` now preserves existing line endings, unchanged context text, and trailing blank lines, and supports same-drive relative Windows paths.
17
+ - `apply_patch` rejects repeated source-file sections before writing; multiple hunks in one update remain supported.
18
+
19
+ - Shepherdr now adds exact-target recovery guidance to agent-not-found errors without changing accepted agent names or pane IDs.
20
+
3
21
  ## 0.2.2
4
22
 
5
23
  - Removed redundant tool guidance from Ask, Shepherdr, Skills and Browser. Code and Notebook Mode now show one callable contract per tool, with detailed Browser and agent rules in help.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-shepherdr",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Persistent blocking and asynchronous Pi agents through Herdr.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "pack:dry": "npm pack --dry-run"
44
44
  },
45
45
  "peerDependencies": {
46
- "@howaboua/pi-codex-conversion": ">=3.0.33",
46
+ "@howaboua/pi-codex-conversion": ">=3.0.34",
47
47
  "@earendil-works/pi-ai": ">=0.84.3",
48
48
  "@earendil-works/pi-coding-agent": ">=0.84.4",
49
49
  "@earendil-works/pi-tui": ">=0.84.3",
@@ -55,7 +55,7 @@
55
55
  }
56
56
  },
57
57
  "devDependencies": {
58
- "@howaboua/pi-codex-conversion": "3.0.33",
58
+ "@howaboua/pi-codex-conversion": "3.0.34",
59
59
  "@biomejs/biome": "^2.5.10",
60
60
  "@earendil-works/pi-ai": "0.85.1",
61
61
  "@earendil-works/pi-coding-agent": "0.85.1",
package/src/herdr.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { HerdrConnection } from "./herdr-client.js";
1
+ import { type HerdrConnection, isHerdrErrorCode } from "./herdr-client.js";
2
2
  import type {
3
3
  AgentStatus,
4
4
  PaneInfo,
@@ -66,7 +66,12 @@ export async function resolvePiAgent(
66
66
  target: string,
67
67
  controllingPaneId = process.env["HERDR_PANE_ID"],
68
68
  ): Promise<PaneInfo> {
69
- const agent = await getAgent(client, target);
69
+ const agent = await getAgent(client, target).catch((error: unknown) => {
70
+ if (error instanceof Error && isHerdrErrorCode(error, "agent_not_found")) {
71
+ error.message += "; Use the exact target returned by spawn/find";
72
+ }
73
+ throw error;
74
+ });
70
75
  if (agent.agent !== "pi") throw new Error(`${target} is not a Pi agent`);
71
76
  if (controllingPaneId && agent.pane_id === controllingPaneId) {
72
77
  throw new Error("refusing to target the controlling Pi session");
package/src/messages.ts CHANGED
@@ -21,7 +21,7 @@ import type {
21
21
  const AGENT_EVENT_MESSAGE_TYPE = "herdr-agent-event";
22
22
  const REALTIME_VOICE_PROMPT_CHANNEL =
23
23
  "@howaboua/pi-codex-conversion/realtime-voice-prompt/v1";
24
- const MAX_REALTIME_VOICE_PROMPT_BYTES = 4 * 1_024;
24
+ const MAX_REALTIME_VOICE_PROMPT_BYTES = 8 * 1_024;
25
25
 
26
26
  function xml(value: string): string {
27
27
  return value
@@ -165,22 +165,14 @@ function eventAsk(value: unknown): PendingAsk | undefined {
165
165
  };
166
166
  }
167
167
 
168
- function boundedVoicePrompt(prompt: string, truncationNotice: string): string {
169
- const encoder = new TextEncoder();
170
- const bytes = encoder.encode(prompt);
168
+ function boundedVoicePrompt(prompt: string): string {
169
+ const bytes = new TextEncoder().encode(prompt);
171
170
  if (bytes.byteLength <= MAX_REALTIME_VOICE_PROMPT_BYTES) return prompt;
172
-
173
- const suffix = `…\n\n${truncationNotice}`;
174
- const decoder = new TextDecoder("utf-8", { fatal: true });
175
- let end = MAX_REALTIME_VOICE_PROMPT_BYTES - encoder.encode(suffix).byteLength;
176
- while (end > 0) {
177
- try {
178
- return `${decoder.decode(bytes.subarray(0, end)).trimEnd()}${suffix}`;
179
- } catch {
180
- end -= 1;
181
- }
182
- }
183
- return truncationNotice;
171
+ return new TextDecoder()
172
+ .decode(bytes.subarray(0, MAX_REALTIME_VOICE_PROMPT_BYTES), {
173
+ stream: true,
174
+ })
175
+ .trimEnd();
184
176
  }
185
177
 
186
178
  function agentVoicePrompt(details: AgentEventDetails): string {
@@ -190,12 +182,9 @@ function agentVoicePrompt(details: AgentEventDetails): string {
190
182
  ];
191
183
  if (details.task?.trim()) lines.push(`Task:\n${details.task.trim()}`);
192
184
  let instruction: string;
193
- let truncationNotice: string;
194
185
  if (details.state === "blocked") {
195
186
  instruction =
196
187
  "Briefly tell the user why this monitored worker is blocked and what attention may be required.";
197
- truncationNotice =
198
- "The blocked worker details above were truncated. Tell the user and ask whether they would like the rest.";
199
188
  if (details.blockedOn?.trim())
200
189
  lines.push(`Reason:\n${details.blockedOn.trim()}`);
201
190
  if (details.ask) {
@@ -208,15 +197,10 @@ function agentVoicePrompt(details: AgentEventDetails): string {
208
197
  details.state === "failed"
209
198
  ? "Briefly tell the user that this monitored worker failed and include useful detail from its report."
210
199
  : "Briefly tell the user what this monitored worker found or completed; do not merely announce that it finished.";
211
- truncationNotice =
212
- "The worker report above was truncated. Tell the user and ask whether they would like the rest.";
213
200
  if (details.response?.trim())
214
201
  lines.push(`Report:\n${details.response.trim()}`);
215
202
  }
216
- return boundedVoicePrompt(
217
- `${instruction}\n\n${lines.join("\n\n")}`,
218
- truncationNotice,
219
- );
203
+ return boundedVoicePrompt(`${instruction}\n\n${lines.join("\n\n")}`);
220
204
  }
221
205
 
222
206
  function announceAgentEvent(