@howaboua/pi-shepherdr 0.2.1 → 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 +22 -0
- package/index.ts +2 -1
- package/package.json +3 -3
- package/src/agents-operations.ts +2 -3
- package/src/agents-tool.ts +1 -8
- package/src/herdr.ts +7 -2
- package/src/messages.ts +9 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
|
|
21
|
+
## 0.2.2
|
|
22
|
+
|
|
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.
|
|
24
|
+
|
|
3
25
|
## 0.2.1
|
|
4
26
|
|
|
5
27
|
- Deliver peer messages directly to Pi without submitting unsent human drafts.
|
package/index.ts
CHANGED
|
@@ -38,7 +38,8 @@ async function registerAgentsInCodeMode(
|
|
|
38
38
|
const registration = registerCodeModeExtensionTools(pi, () => [
|
|
39
39
|
adaptToolForCodeMode(tool, {
|
|
40
40
|
blocking: isBlockingAgentsCall,
|
|
41
|
-
usage:
|
|
41
|
+
usage:
|
|
42
|
+
'await tools.agents({ action: "help" }) // Persistent agents; first call alone',
|
|
42
43
|
}),
|
|
43
44
|
]);
|
|
44
45
|
pi.on("session_shutdown", () => registration.unregister());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-shepherdr",
|
|
3
|
-
"version": "0.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.
|
|
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.
|
|
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/agents-operations.ts
CHANGED
|
@@ -62,7 +62,7 @@ export async function agentsHelp(): Promise<Record<string, unknown>> {
|
|
|
62
62
|
send: "Peer questions, updates, replies; submission only, no wait or watch",
|
|
63
63
|
assign: "Delegate a task to an existing agent",
|
|
64
64
|
blocking:
|
|
65
|
-
"spawn/assign/answer default true; false pushes task settlement;
|
|
65
|
+
"spawn/assign/answer default true; false pushes task settlement; never poll. Reviewer spawns always block; await review before working its scope",
|
|
66
66
|
watch:
|
|
67
67
|
"Explicit watch persists until unwatch; automatic task watches end on finish/failure, not blockage",
|
|
68
68
|
prompt:
|
|
@@ -73,8 +73,7 @@ export async function agentsHelp(): Promise<Record<string, unknown>> {
|
|
|
73
73
|
"Reuse only same investigation; reviews independent; new scope = new agent",
|
|
74
74
|
...(profiles.has("general")
|
|
75
75
|
? {
|
|
76
|
-
general:
|
|
77
|
-
"Only when requested/orchestrating. Current repo: create + bootstrap worktree; pass cwd",
|
|
76
|
+
general: "Only when requested/orchestrating",
|
|
78
77
|
}
|
|
79
78
|
: {}),
|
|
80
79
|
},
|
package/src/agents-tool.ts
CHANGED
|
@@ -52,15 +52,8 @@ export function createAgentsTool(fleet: AgentFleet) {
|
|
|
52
52
|
return defineTool({
|
|
53
53
|
name: "agents",
|
|
54
54
|
label: "Shepherdr",
|
|
55
|
-
description: "
|
|
55
|
+
description: "Delegate to persistent agents; call help first, alone",
|
|
56
56
|
parameters: AgentsParameters,
|
|
57
|
-
promptSnippet: "Load agents help before first use.",
|
|
58
|
-
promptGuidelines: [
|
|
59
|
-
"agents: send messages to peers; assign delegates work. Reviewer spawns always block; await review before working its scope.",
|
|
60
|
-
"agents: Specialists know their job. Give only the concrete task and inaccessible context; never append generic method, evidence, or reporting instructions.",
|
|
61
|
-
"agents: Reuse specialists only for the same investigation. Keep reviews independent. New scope gets a new agent.",
|
|
62
|
-
"agents: For advanced Herdr workspace, pane, process or layout control, run herdr --skill.",
|
|
63
|
-
],
|
|
64
57
|
executionMode: "sequential",
|
|
65
58
|
async execute(
|
|
66
59
|
_toolCallId,
|
package/src/herdr.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
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 =
|
|
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
|
|
169
|
-
const
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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(
|