@howaboua/pi-shepherdr 0.1.3 → 0.1.4
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 +18 -0
- package/README.md +3 -1
- package/index.ts +2 -0
- package/package.json +6 -6
- package/src/activity.ts +2 -2
- package/src/controller.ts +3 -1
- package/src/delivery.ts +68 -0
- package/src/messages.ts +3 -1
- package/src/settlement.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @howaboua/pi-shepherdr
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
- Preserve extension-owned messages while delivering true developer-role policy through compatible Pi Codex Responses adapters.
|
|
6
|
+
|
|
7
|
+
- Add an optional custom-message API that retains caller rendering and restoration fields.
|
|
8
|
+
- Route Shepherdr's unclaimed worker events and orchestration toggles through it, preserving ordinary Pi delivery when unavailable.
|
|
9
|
+
- Send review preface/triage policy and realtime voice start/end guidance as developer messages without elevating raw reviewer findings, spoken delegations, or transcript tails.
|
|
10
|
+
- Keep persisted developer messages in context across model switches, using ordinary Pi conversion on incompatible models.
|
|
11
|
+
|
|
12
|
+
- Fix worker settlement, custom model preservation, and prompt-only image generation.
|
|
13
|
+
|
|
14
|
+
- Settle Shepherdr workers after Pi expands skill or prompt-template invocations.
|
|
15
|
+
- Preserve custom Codex models and `models.json` overrides, including after refresh.
|
|
16
|
+
- Keep optional tool arguments optional in Codex Responses requests while preserving explicit strict sampling.
|
|
17
|
+
- Treat null image selectors as absent, so prompt-only requests generate rather than edit.
|
|
18
|
+
- Honor the details toggle in Notebook Mode to hide duplicate output previews.
|
|
19
|
+
- Show submitted messages without waiting for cached WebSocket warmup, while keeping generation serialized behind it.
|
|
20
|
+
|
|
3
21
|
## 0.1.3
|
|
4
22
|
|
|
5
23
|
- Replaced Shepherdr's fire-and-forget tool with persistent blocking and asynchronous agents in normal Pi, Code Mode, and Notebook Mode.
|
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Shepherdr combines a monitored [Herdr](https://herdr.dev) fleet with blocking an
|
|
|
6
6
|
|
|
7
7
|
Asynchronous calls return after dispatch, then push completion, failure or blockage into the controller with a steer message. The model never has to poll. Blocking calls hold the tool call and return the worker's reply directly.
|
|
8
8
|
|
|
9
|
+
With Pi Codex's compatible custom developer-message API active, asynchronous worker reports and orchestration toggles use the Responses developer role while retaining their normal display and session restoration. Without that API or adapter, delivery remains ordinary Pi custom messages. Blocking results stay in the tool response.
|
|
10
|
+
|
|
9
11
|
## Install
|
|
10
12
|
|
|
11
13
|
```bash
|
|
@@ -20,7 +22,7 @@ herdr integration install pi
|
|
|
20
22
|
|
|
21
23
|
Do not load Pi Codex's example `agents.toml` custom tool alongside Shepherdr; they own the same agent surface.
|
|
22
24
|
|
|
23
|
-
Pi Codex 3.0.
|
|
25
|
+
Pi Codex 3.0.25 or newer is optional. Without it, Shepherdr remains a normal Pi extension.
|
|
24
26
|
|
|
25
27
|
## Enable orchestration
|
|
26
28
|
|
package/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import registerPackageChangelog from "./changelog.js";
|
|
|
3
3
|
import { isBlockingAgentsCall } from "./src/agents-contract.js";
|
|
4
4
|
import { createAgentsTool } from "./src/agents-tool.js";
|
|
5
5
|
import { registerAgentController } from "./src/controller.js";
|
|
6
|
+
import { registerDeveloperDelivery } from "./src/delivery.js";
|
|
6
7
|
import { AgentFleet } from "./src/fleet.js";
|
|
7
8
|
import { registerAgentEventRenderer } from "./src/messages.js";
|
|
8
9
|
import { installAgentProfiles } from "./src/profiles.js";
|
|
@@ -15,6 +16,7 @@ export default async function shepherdrExtension(
|
|
|
15
16
|
): Promise<void> {
|
|
16
17
|
registerPackageChangelog(pi);
|
|
17
18
|
await installAgentProfiles();
|
|
19
|
+
await registerDeveloperDelivery(pi);
|
|
18
20
|
const fleet = new AgentFleet(pi);
|
|
19
21
|
const tool = createAgentsTool(fleet);
|
|
20
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-shepherdr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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.26",
|
|
47
47
|
"@earendil-works/pi-ai": ">=0.84.3",
|
|
48
48
|
"@earendil-works/pi-coding-agent": ">=0.84.3",
|
|
49
49
|
"@earendil-works/pi-tui": ">=0.84.3",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@howaboua/pi-codex-conversion": "3.0.
|
|
58
|
+
"@howaboua/pi-codex-conversion": "3.0.26",
|
|
59
59
|
"@biomejs/biome": "^2.5.10",
|
|
60
|
-
"@earendil-works/pi-ai": "0.
|
|
61
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
62
|
-
"@earendil-works/pi-tui": "0.
|
|
60
|
+
"@earendil-works/pi-ai": "0.85.0",
|
|
61
|
+
"@earendil-works/pi-coding-agent": "0.85.0",
|
|
62
|
+
"@earendil-works/pi-tui": "0.85.0",
|
|
63
63
|
"@types/node": "^26.2.0",
|
|
64
64
|
"typebox": "1.3.18",
|
|
65
65
|
"typescript": "^7.0.2"
|
package/src/activity.ts
CHANGED
|
@@ -33,11 +33,11 @@ export function activityAttemptId(activity: AgentActivity): string | undefined {
|
|
|
33
33
|
|
|
34
34
|
export function activityExpectedUser(
|
|
35
35
|
activity: AgentActivity,
|
|
36
|
-
): { after: string | null
|
|
36
|
+
): { after: string | null } | undefined {
|
|
37
37
|
return activity.phase !== "settled" &&
|
|
38
38
|
activity.expectedUserAfter !== undefined &&
|
|
39
39
|
activity.task
|
|
40
|
-
? { after: activity.expectedUserAfter
|
|
40
|
+
? { after: activity.expectedUserAfter }
|
|
41
41
|
: undefined;
|
|
42
42
|
}
|
|
43
43
|
|
package/src/controller.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
ExtensionAPI,
|
|
3
3
|
ExtensionContext,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import { sendPolicyMessage } from "./delivery.js";
|
|
5
6
|
import type { AgentFleet } from "./fleet.js";
|
|
6
7
|
import { showMachineMenu } from "./machine-menu.js";
|
|
7
8
|
import { loadAgentProfiles } from "./profiles.js";
|
|
@@ -45,7 +46,8 @@ export function registerAgentController(
|
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
orchestrationEnabled = !orchestrationEnabled;
|
|
48
|
-
|
|
49
|
+
sendPolicyMessage(
|
|
50
|
+
pi,
|
|
49
51
|
{
|
|
50
52
|
customType: ORCHESTRATION_STATE_TYPE,
|
|
51
53
|
content: orchestrationEnabled
|
package/src/delivery.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type {
|
|
3
|
+
CodexDeveloperCustomMessage,
|
|
4
|
+
CodexDeveloperMessageOptions,
|
|
5
|
+
trySendCodexDeveloperCustomMessage,
|
|
6
|
+
} from "@howaboua/pi-codex-conversion/developer-messages";
|
|
7
|
+
|
|
8
|
+
const senders = new WeakMap<
|
|
9
|
+
ExtensionAPI,
|
|
10
|
+
typeof trySendCodexDeveloperCustomMessage
|
|
11
|
+
>();
|
|
12
|
+
const PACKAGE = "@howaboua/pi-codex-conversion";
|
|
13
|
+
const MODULE = `${PACKAGE}/developer-messages`;
|
|
14
|
+
|
|
15
|
+
export async function registerDeveloperDelivery(
|
|
16
|
+
pi: ExtensionAPI,
|
|
17
|
+
): Promise<void> {
|
|
18
|
+
try {
|
|
19
|
+
const api = await import(
|
|
20
|
+
"@howaboua/pi-codex-conversion/developer-messages"
|
|
21
|
+
);
|
|
22
|
+
if (typeof api.trySendCodexDeveloperCustomMessage === "function")
|
|
23
|
+
senders.set(pi, api.trySendCodexDeveloperCustomMessage);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (!isUnavailable(error)) throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function sendPolicyMessage(
|
|
30
|
+
pi: ExtensionAPI,
|
|
31
|
+
message: CodexDeveloperCustomMessage,
|
|
32
|
+
options: CodexDeveloperMessageOptions,
|
|
33
|
+
): void {
|
|
34
|
+
if (senders.get(pi)?.(pi, message, options)) return;
|
|
35
|
+
pi.sendMessage(message, options);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isUnavailable(error: unknown): boolean {
|
|
39
|
+
if (
|
|
40
|
+
!error ||
|
|
41
|
+
typeof error !== "object" ||
|
|
42
|
+
!("code" in error) ||
|
|
43
|
+
!("message" in error) ||
|
|
44
|
+
typeof error.message !== "string"
|
|
45
|
+
)
|
|
46
|
+
return false;
|
|
47
|
+
if (
|
|
48
|
+
error.code === "ERR_MODULE_NOT_FOUND" ||
|
|
49
|
+
error.code === "MODULE_NOT_FOUND"
|
|
50
|
+
) {
|
|
51
|
+
const missing = error.message.match(
|
|
52
|
+
/Cannot find (?:package|module) ['"]([^'"]+)['"]/,
|
|
53
|
+
)?.[1];
|
|
54
|
+
const normalized = missing?.replaceAll("\\", "/").replace(/\.js$/, "");
|
|
55
|
+
return (
|
|
56
|
+
missing === PACKAGE ||
|
|
57
|
+
normalized === MODULE ||
|
|
58
|
+
normalized?.endsWith(`/${MODULE}`) === true
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
(error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED" ||
|
|
63
|
+
error.code === "ERR_UNSUPPORTED_DIR_IMPORT") &&
|
|
64
|
+
(error.message.includes(MODULE) ||
|
|
65
|
+
(error.message.includes("Package subpath './developer-messages'") &&
|
|
66
|
+
error.message.includes(PACKAGE)))
|
|
67
|
+
);
|
|
68
|
+
}
|
package/src/messages.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { Box, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
7
7
|
import { activityTask } from "./activity.js";
|
|
8
|
+
import { sendPolicyMessage } from "./delivery.js";
|
|
8
9
|
import type {
|
|
9
10
|
LatestAssistant,
|
|
10
11
|
MonitoredAgent,
|
|
@@ -314,7 +315,8 @@ export function injectAgentEvent(
|
|
|
314
315
|
const delivery = ctx.isIdle()
|
|
315
316
|
? { triggerTurn: true, deliverAs: "steer" as const }
|
|
316
317
|
: { deliverAs: "steer" as const };
|
|
317
|
-
|
|
318
|
+
sendPolicyMessage(
|
|
319
|
+
pi,
|
|
318
320
|
{
|
|
319
321
|
customType: AGENT_EVENT_MESSAGE_TYPE,
|
|
320
322
|
content: message.content,
|
package/src/settlement.ts
CHANGED
|
@@ -245,12 +245,12 @@ export class SettlementReporter {
|
|
|
245
245
|
if (activityAttemptId(current.activity) !== retryState.attemptId) return;
|
|
246
246
|
const retryRequest = task ? { ...request, task } : request;
|
|
247
247
|
const expectedUser = activityExpectedUser(current.activity);
|
|
248
|
+
// Pi persists expanded skills/templates, not the submitted command text.
|
|
248
249
|
if (
|
|
249
250
|
expectedUser &&
|
|
250
251
|
(settlement.session.assistantAfterUser !== true ||
|
|
251
252
|
!settlement.session.user ||
|
|
252
|
-
settlement.session.user.id === expectedUser.after
|
|
253
|
-
settlement.session.user.text !== expectedUser.text)
|
|
253
|
+
settlement.session.user.id === expectedUser.after)
|
|
254
254
|
) {
|
|
255
255
|
if (!this.retry(lifecycle, retryRequest, retryState)) {
|
|
256
256
|
this.failReconciliation(
|