@howaboua/pi-subagent-review 0.2.19 → 0.2.21

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,21 @@
1
1
  # @howaboua/pi-subagent-review
2
2
 
3
+ ## 0.2.21
4
+
5
+ - Restore full extension prompt preparation when continuing into a new context window or starting review triage.
6
+
7
+ - Keep tool instructions current through Pi's normal startup hooks without resetting the Notebook.
8
+ - Let active context management own review-loop navigation summaries.
9
+
10
+ ## 0.2.20
11
+
12
+ - Preserve extension-owned messages while delivering true developer-role policy through compatible Pi Codex Responses adapters.
13
+
14
+ - Add an optional custom-message API that retains caller rendering and restoration fields.
15
+ - Route Shepherdr's unclaimed worker events and orchestration toggles through it, preserving ordinary Pi delivery when unavailable.
16
+ - Send review preface/triage policy and realtime voice start/end guidance as developer messages without elevating raw reviewer findings, spoken delegations, or transcript tails.
17
+ - Keep persisted developer messages in context across model switches, using ordinary Pi conversion on incompatible models.
18
+
3
19
  ## 0.2.19
4
20
 
5
21
  ### 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.21",
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.31",
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.31",
63
+ "@earendil-works/pi-ai": "0.85.1",
64
+ "@earendil-works/pi-coding-agent": "0.85.1",
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"
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(
@@ -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 =
@@ -117,6 +117,9 @@ export function registerTreeSummaryModel(
117
117
  });
118
118
 
119
119
  return async (ctx, targetId, options, config) => {
120
+ // Codex projects new_context only while context management is active.
121
+ if (pi.getActiveTools().includes("new_context"))
122
+ return ctx.navigateTree(targetId, options);
120
123
  if (!config.enabled) return ctx.navigateTree(targetId, options);
121
124
  if (pending) throw new Error("A tree summary is already in progress");
122
125