@howaboua/pi-subagent-review 0.2.19 → 0.2.20

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,14 @@
1
1
  # @howaboua/pi-subagent-review
2
2
 
3
+ ## 0.2.20
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
+
3
12
  ## 0.2.19
4
13
 
5
14
  ### Changes
package/README.md CHANGED
@@ -24,6 +24,8 @@ Anything after `/review` becomes additional reviewer guidance. A leading `loop`
24
24
 
25
25
  Findings are advisory. The command tells the main agent to verify and categorize them against the current implementation and session context rather than treating them as a TODO list.
26
26
 
27
+ With a compatible optional Pi Codex Responses adapter, the review preface and triage follow-up use developer-role policy. The preface keeps its existing display and deduplication; the follow-up appears as an extension developer message rather than user input. Raw reviewer findings remain lower-authority custom-message content. Without the API or active adapter, ordinary Pi delivery is unchanged.
28
+
27
29
  ## Review scope
28
30
 
29
31
  In a JJ workspace, the extension reviews the active revision before considering an enclosing Git checkout. It pins the active change and commit IDs, reviews against its direct parent by default, and uses `stack=<ancestor revset>` for a cumulative range. The active revision must be conflict-free. The read-only command reviews stored commit content; capture filesystem edits with JJ before invoking `/review`.
package/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.5.10/schema.json",
3
3
  "vcs": {
4
4
  "enabled": true,
5
5
  "clientKind": "git",
package/changelog.ts CHANGED
@@ -182,9 +182,19 @@ function packageMarkdown(
182
182
  registration: PackageRegistration,
183
183
  entries: ChangelogEntry[],
184
184
  ): string {
185
+ const body = (entry: ChangelogEntry) =>
186
+ entry.content
187
+ .replace(/^##[^\n]*\n*/, "")
188
+ .replace(/^###\s+(?:Changes|Minor Changes|Patch Changes)\s*\n*/gim, "")
189
+ .replace(/^###\s+(.+)$/gm, "**$1**");
190
+ if (entries.length === 1) {
191
+ const [entry] = entries;
192
+ if (!entry) return "";
193
+ return `## ${registration.name} ${entry.version}\n\n${body(entry)}`;
194
+ }
185
195
  return [
186
196
  `## ${registration.name}`,
187
- ...entries.map((entry) => entry.content.replace(/^##\s+/, "### ")),
197
+ ...entries.map((entry) => `**${entry.version}**\n\n${body(entry)}`),
188
198
  ].join("\n\n");
189
199
  }
190
200
 
package/index.ts CHANGED
@@ -1,12 +1,61 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import registerPackageChangelog from "./changelog.js";
2
3
  import { ensureConfigFile } from "./src/config.js";
3
4
  import { CHILD_ENV } from "./src/constants.js";
5
+ import type { ReviewDeveloperMessages } from "./src/messages.js";
4
6
  import { registerReviewCommand } from "./src/review-command.js";
5
7
  import { registerTreeSummaryModel } from "./src/tree-summary.js";
6
8
 
7
- export default function (pi: ExtensionAPI) {
9
+ export default async function (pi: ExtensionAPI) {
8
10
  if (process.env[CHILD_ENV] === "1") return;
9
11
 
12
+ registerPackageChangelog(pi);
10
13
  ensureConfigFile();
11
- registerReviewCommand(pi, registerTreeSummaryModel(pi));
14
+ const developerMessages = await loadDeveloperMessages();
15
+ registerReviewCommand(pi, registerTreeSummaryModel(pi), developerMessages);
16
+ }
17
+
18
+ async function loadDeveloperMessages(): Promise<
19
+ ReviewDeveloperMessages | undefined
20
+ > {
21
+ try {
22
+ return await import("@howaboua/pi-codex-conversion/developer-messages");
23
+ } catch (error) {
24
+ if (!isUnavailable(error)) throw error;
25
+ return undefined;
26
+ }
27
+ }
28
+
29
+ function isUnavailable(error: unknown): boolean {
30
+ if (
31
+ !error ||
32
+ typeof error !== "object" ||
33
+ !("code" in error) ||
34
+ !("message" in error) ||
35
+ typeof error.message !== "string"
36
+ )
37
+ return false;
38
+ const packageName = "@howaboua/pi-codex-conversion";
39
+ const moduleName = `${packageName}/developer-messages`;
40
+ if (
41
+ error.code === "ERR_MODULE_NOT_FOUND" ||
42
+ error.code === "MODULE_NOT_FOUND"
43
+ ) {
44
+ const missing = error.message.match(
45
+ /Cannot find (?:package|module) ['"]([^'"]+)['"]/,
46
+ )?.[1];
47
+ const normalized = missing?.replaceAll("\\", "/").replace(/\.js$/, "");
48
+ return (
49
+ missing === packageName ||
50
+ normalized === moduleName ||
51
+ normalized?.endsWith(`/${moduleName}`) === true
52
+ );
53
+ }
54
+ return (
55
+ (error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED" ||
56
+ error.code === "ERR_UNSUPPORTED_DIR_IMPORT") &&
57
+ (error.message.includes(moduleName) ||
58
+ (error.message.includes("Package subpath './developer-messages'") &&
59
+ error.message.includes(packageName)))
60
+ );
12
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-subagent-review",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Pi extension that adds /review via an isolated review subagent.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -36,14 +36,19 @@
36
36
  },
37
37
  "pi": {
38
38
  "extensions": [
39
- "./changelog.ts",
40
39
  "./index.ts"
41
40
  ]
42
41
  },
43
42
  "peerDependencies": {
44
- "@earendil-works/pi-ai": ">=0.80.8",
45
- "@earendil-works/pi-coding-agent": ">=0.82.0",
46
- "@earendil-works/pi-tui": "*"
43
+ "@howaboua/pi-codex-conversion": ">=3.0.26",
44
+ "@earendil-works/pi-ai": ">=0.84.3",
45
+ "@earendil-works/pi-coding-agent": ">=0.84.3",
46
+ "@earendil-works/pi-tui": ">=0.84.3"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "@howaboua/pi-codex-conversion": {
50
+ "optional": true
51
+ }
47
52
  },
48
53
  "scripts": {
49
54
  "check": "bun run lint && bun run typecheck && bun run test",
@@ -54,11 +59,12 @@
54
59
  "format": "biome check --write ."
55
60
  },
56
61
  "devDependencies": {
57
- "@earendil-works/pi-ai": "0.84.1",
58
- "@earendil-works/pi-coding-agent": "0.84.1",
59
- "@types/node": "^24.10.0",
60
- "typescript": "^5.9.3",
61
- "@biomejs/biome": "^2.4.16"
62
+ "@howaboua/pi-codex-conversion": "3.0.26",
63
+ "@earendil-works/pi-ai": "0.85.0",
64
+ "@earendil-works/pi-coding-agent": "0.85.0",
65
+ "@types/node": "^26.2.0",
66
+ "typescript": "^7.0.2",
67
+ "@biomejs/biome": "^2.5.10"
62
68
  },
63
69
  "publishConfig": {
64
70
  "access": "public"
package/src/messages.ts CHANGED
@@ -9,6 +9,13 @@ import {
9
9
  } from "./constants.js";
10
10
  import type { ReviewContext } from "./types.js";
11
11
 
12
+ export type ReviewDeveloperMessages = Partial<
13
+ Pick<
14
+ typeof import("@howaboua/pi-codex-conversion/developer-messages"),
15
+ "trySendCodexDeveloperCustomMessage" | "trySendCodexDeveloperMessage"
16
+ >
17
+ >;
18
+
12
19
  const REALTIME_VOICE_PROMPT_CHANNEL =
13
20
  "@howaboua/pi-codex-conversion/realtime-voice-prompt/v1";
14
21
  const REVIEW_LOOP_PREFACE_MESSAGE = [
@@ -83,16 +90,22 @@ export function sendReviewPreface(
83
90
  pi: ExtensionAPI,
84
91
  ctx: ExtensionCommandContext,
85
92
  options: { freshLoop?: boolean } = {},
93
+ developerMessages?: ReviewDeveloperMessages,
86
94
  ): void {
87
95
  if (!options.freshLoop && getReviewPrefaceMessageId(ctx)) return;
88
- pi.sendMessage(
89
- {
90
- customType: REVIEW_PREFACE_MESSAGE_TYPE,
91
- content: REVIEW_LOOP_PREFACE_MESSAGE,
92
- display: true,
93
- },
94
- { triggerTurn: false },
95
- );
96
+ const message = {
97
+ customType: REVIEW_PREFACE_MESSAGE_TYPE,
98
+ content: REVIEW_LOOP_PREFACE_MESSAGE,
99
+ display: true,
100
+ };
101
+ const delivery = { triggerTurn: false };
102
+ if (
103
+ typeof developerMessages?.trySendCodexDeveloperCustomMessage ===
104
+ "function" &&
105
+ developerMessages.trySendCodexDeveloperCustomMessage(pi, message, delivery)
106
+ )
107
+ return;
108
+ pi.sendMessage(message, delivery);
96
109
  }
97
110
 
98
111
  function buildJjReviewScopeText(
@@ -177,6 +190,7 @@ export function sendReviewFindings(
177
190
  ctx: ExtensionCommandContext,
178
191
  review: ReviewContext,
179
192
  findings: string,
193
+ developerMessages?: ReviewDeveloperMessages,
180
194
  ): void {
181
195
  const normalizedFindings = findings.trim();
182
196
  const idle = ctx.isIdle();
@@ -194,6 +208,17 @@ export function sendReviewFindings(
194
208
  normalizedFindings === "No actionable issues found."
195
209
  )
196
210
  return;
211
+ if (
212
+ typeof developerMessages?.trySendCodexDeveloperMessage === "function" &&
213
+ developerMessages.trySendCodexDeveloperMessage(
214
+ pi,
215
+ REVIEW_FINDINGS_FOLLOW_UP,
216
+ idle
217
+ ? { triggerTurn: true }
218
+ : { triggerTurn: true, deliverAs: "followUp" },
219
+ )
220
+ )
221
+ return;
197
222
  pi.sendUserMessage(
198
223
  REVIEW_FINDINGS_FOLLOW_UP,
199
224
  idle ? undefined : { deliverAs: "followUp" },
@@ -5,6 +5,7 @@ import { buildReviewConversationSummary } from "./conversation-summary.js";
5
5
  import {
6
6
  announceReviewFindingsReady,
7
7
  announceReviewSummaryStarted,
8
+ type ReviewDeveloperMessages,
8
9
  sendReviewFindings,
9
10
  sendReviewPreface,
10
11
  } from "./messages.js";
@@ -29,6 +30,7 @@ import type { NavigateWithSummaryModel } from "./tree-summary.js";
29
30
  export function registerReviewCommand(
30
31
  pi: ExtensionAPI,
31
32
  navigateWithSummaryModel: NavigateWithSummaryModel,
33
+ developerMessages?: ReviewDeveloperMessages,
32
34
  ) {
33
35
  pi.registerCommand(REVIEW_COMMAND, {
34
36
  description:
@@ -109,7 +111,12 @@ export function registerReviewCommand(
109
111
  );
110
112
  return;
111
113
  }
112
- sendReviewPreface(pi, ctx, { freshLoop: parsedArgs.startLoop });
114
+ sendReviewPreface(
115
+ pi,
116
+ ctx,
117
+ { freshLoop: parsedArgs.startLoop },
118
+ developerMessages,
119
+ );
113
120
 
114
121
  if (parsedArgs.startLoop) {
115
122
  const targetId =
@@ -183,7 +190,7 @@ export function registerReviewCommand(
183
190
  details.errorMessage || details.stderr || finalOutput,
184
191
  );
185
192
 
186
- sendReviewFindings(pi, ctx, review, finalOutput);
193
+ sendReviewFindings(pi, ctx, review, finalOutput, developerMessages);
187
194
  announceReviewFindingsReady(pi);
188
195
  ctx.ui.notify(
189
196
  `Review findings sent back to the main agent from /${REVIEW_COMMAND}.`,