@diegopetrucci/pi-extensions 0.1.72 → 0.1.73
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/README.md +2 -2
- package/extensions/agent-workflow-audit/index.ts +41 -8
- package/extensions/agent-workflow-audit/package.json +1 -1
- package/extensions/annotate-git-diff/README.md +7 -3
- package/extensions/annotate-git-diff/git.ts +3 -2
- package/extensions/annotate-git-diff/index.ts +366 -81
- package/extensions/annotate-git-diff/package.json +2 -2
- package/extensions/annotate-git-diff/quiet-glimpse.ts +4 -2
- package/extensions/annotate-git-diff/types.ts +6 -0
- package/extensions/annotate-git-diff/web/app.js +54 -4
- package/extensions/annotate-git-diff/web/index.html +2 -2
- package/extensions/annotate-last-message/README.md +9 -1
- package/extensions/annotate-last-message/index.ts +53 -13
- package/extensions/annotate-last-message/package.json +2 -1
- package/extensions/annotate-last-message/quiet-glimpse.ts +4 -2
- package/extensions/annotate-last-message/theme.ts +247 -0
- package/extensions/annotate-last-message/ui.ts +28 -2
- package/extensions/annotate-last-message/web/app.js +351 -162
- package/extensions/annotate-last-message/web/index.html +153 -24
- package/extensions/annotate-last-message/web/md-renderer.js +458 -0
- package/extensions/code-reviewer/index.ts +12 -1
- package/extensions/code-reviewer/package.json +2 -1
- package/extensions/context-cap/README.md +33 -4
- package/extensions/context-cap/index.ts +271 -68
- package/extensions/context-cap/package.json +1 -1
- package/extensions/context-inspector/README.md +2 -0
- package/extensions/context-inspector/index.ts +90 -9
- package/extensions/context-inspector/package.json +1 -1
- package/extensions/contrarian/index.ts +21 -15
- package/extensions/contrarian/package.json +1 -1
- package/extensions/dynamic-context-pruning/README.md +17 -5
- package/extensions/dynamic-context-pruning/index.ts +17 -4
- package/extensions/dynamic-context-pruning/package.json +1 -1
- package/extensions/fast/README.md +24 -3
- package/extensions/fast/index.ts +2 -2
- package/extensions/fast/package.json +1 -1
- package/extensions/git-footer/README.md +1 -0
- package/extensions/git-footer/package.json +1 -1
- package/extensions/librarian/index.ts +7 -0
- package/extensions/librarian/package.json +2 -1
- package/extensions/minimal-footer/README.md +16 -4
- package/extensions/minimal-footer/index.ts +263 -14
- package/extensions/minimal-footer/openai-usage.ts +62 -8
- package/extensions/minimal-footer/package.json +1 -1
- package/extensions/oracle/index.ts +19 -18
- package/extensions/oracle/package.json +1 -1
- package/extensions/permission-gate/README.md +6 -0
- package/extensions/permission-gate/index.ts +37 -16
- package/extensions/permission-gate/package.json +1 -1
- package/extensions/quiet-tools/README.md +1 -1
- package/extensions/quiet-tools/package.json +1 -1
- package/extensions/triage-comments/package.json +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -24,8 +24,8 @@ A collection of [pi](https://pi.dev) agent extensions I made. (Btw, [I am also b
|
|
|
24
24
|
### / Slash commands
|
|
25
25
|
|
|
26
26
|
- [`agent-workflow-audit`](./extensions/agent-workflow-audit): Adds `/agent-workflow-audit`, which runs an isolated repo workflow audit subagent and returns only the final distilled report to the main session.
|
|
27
|
-
- [`annotate-git-diff`](./extensions/annotate-git-diff): Adds `/annotate-git-diff`, a native Glimpse UI
|
|
28
|
-
- [`annotate-last-message`](./extensions/annotate-last-message): Adds `/annotate-last-message`, a native Glimpse UI for annotating the latest assistant reply and sending planning-oriented feedback
|
|
27
|
+
- [`annotate-git-diff`](./extensions/annotate-git-diff): Adds `/annotate-git-diff`, a native Glimpse UI where explicit Submit sends structured feedback to the agent and close recovery keeps an unsent draft in the editor.
|
|
28
|
+
- [`annotate-last-message`](./extensions/annotate-last-message): Adds `/annotate-last-message`, a native Glimpse UI for annotating the latest assistant reply and sending planning-oriented feedback directly to the agent.
|
|
29
29
|
- [`review`](./extensions/review): Adds `/review` and `/end-review` for interactive code reviews of local changes, commits, PRs, and selected paths.
|
|
30
30
|
- [`triage-comments`](./extensions/triage-comments): Adds `/triage-comments` and a read-only `triage_comments` subagent tool that can auto-detect the current branch's PR, filter resolved/outdated inline comments, classify selected review comments with evidence, and suggest handling options without implementing changes
|
|
31
31
|
|
|
@@ -148,14 +148,39 @@ function messageContentToText(content: unknown): string {
|
|
|
148
148
|
return parts.join("\n").trim();
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
type AuditAssistantOutcome =
|
|
152
|
+
| { ok: true; answer: string; stopReason?: string }
|
|
153
|
+
| { ok: false; reason: string; stopReason?: string; errorMessage?: string };
|
|
154
|
+
|
|
155
|
+
function inspectFinalAssistant(messages: unknown[]): AuditAssistantOutcome {
|
|
152
156
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
153
|
-
const message = messages[i] as { role?: string; content?: unknown };
|
|
157
|
+
const message = messages[i] as { role?: string; content?: unknown; stopReason?: unknown; errorMessage?: unknown };
|
|
154
158
|
if (message?.role !== "assistant") continue;
|
|
155
|
-
const
|
|
156
|
-
|
|
159
|
+
const stopReason = typeof message.stopReason === "string" ? message.stopReason.trim() : "";
|
|
160
|
+
const errorMessage = typeof message.errorMessage === "string" ? message.errorMessage.trim() : "";
|
|
161
|
+
const answer = messageContentToText(message.content);
|
|
162
|
+
if (stopReason === "error") {
|
|
163
|
+
return { ok: false, reason: `Agent Workflow Audit subagent error: ${errorMessage || "provider/model error"}`, stopReason, errorMessage };
|
|
164
|
+
}
|
|
165
|
+
if (stopReason === "aborted") {
|
|
166
|
+
return { ok: false, reason: "Agent Workflow Audit subagent aborted before producing a usable report", stopReason };
|
|
167
|
+
}
|
|
168
|
+
if (answer) return { ok: true, answer, stopReason: stopReason || undefined };
|
|
169
|
+
return {
|
|
170
|
+
ok: false,
|
|
171
|
+
reason: stopReason
|
|
172
|
+
? `Agent Workflow Audit subagent produced no final assistant text (stopReason: ${stopReason})`
|
|
173
|
+
: "Agent Workflow Audit subagent produced no final assistant text",
|
|
174
|
+
...(stopReason ? { stopReason } : {}),
|
|
175
|
+
...(errorMessage ? { errorMessage } : {}),
|
|
176
|
+
};
|
|
157
177
|
}
|
|
158
|
-
return "";
|
|
178
|
+
return { ok: false, reason: "Agent Workflow Audit subagent produced no assistant message" };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function extractLastAssistantText(messages: unknown[]): string {
|
|
182
|
+
const outcome = inspectFinalAssistant(messages);
|
|
183
|
+
return outcome.ok ? outcome.answer : "";
|
|
159
184
|
}
|
|
160
185
|
|
|
161
186
|
function isAbortLikeError(error: unknown): boolean {
|
|
@@ -1085,9 +1110,16 @@ async function runAudit(
|
|
|
1085
1110
|
await Promise.race([promptPromise, timeoutPromise]);
|
|
1086
1111
|
}
|
|
1087
1112
|
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1113
|
+
const outcome = session ? inspectFinalAssistant(session.state.messages) : { ok: false as const, reason: "Agent Workflow Audit subagent produced no assistant message" };
|
|
1114
|
+
if (outcome.ok) {
|
|
1115
|
+
lastContent = outcome.answer;
|
|
1116
|
+
details.status = "done";
|
|
1117
|
+
} else if (aborted) {
|
|
1118
|
+
lastContent = "Aborted";
|
|
1119
|
+
details.status = "aborted";
|
|
1120
|
+
} else {
|
|
1121
|
+
throw new Error(outcome.reason);
|
|
1122
|
+
}
|
|
1091
1123
|
details.endedAt = Date.now();
|
|
1092
1124
|
details.reportLength = lastContent.length;
|
|
1093
1125
|
emit();
|
|
@@ -1116,6 +1148,7 @@ export const __test__ = {
|
|
|
1116
1148
|
buildSystemPrompt,
|
|
1117
1149
|
buildUserPrompt,
|
|
1118
1150
|
createAuditRuntimeGuardExtension,
|
|
1151
|
+
inspectFinalAssistant,
|
|
1119
1152
|
formatToolCall,
|
|
1120
1153
|
getBlockedBashReason,
|
|
1121
1154
|
parseArgs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# annotate-git-diff
|
|
2
2
|
|
|
3
|
-
A standalone pi extension that adds `/annotate-git-diff`, a native Glimpse window for reviewing git changes
|
|
3
|
+
A standalone pi extension that adds `/annotate-git-diff`, a native Glimpse window for reviewing git changes. Explicit **Submit to agent** sends structured feedback directly to the active agent; closing with unsent comments pastes an editor-only draft instead.
|
|
4
4
|
|
|
5
5
|
## Attribution
|
|
6
6
|
|
|
@@ -25,12 +25,16 @@ Run `/annotate-git-diff` inside a git repository. The command opens a native rev
|
|
|
25
25
|
- Monaco-based diff viewing,
|
|
26
26
|
- branch diff, per-commit including working tree, and all-files scopes,
|
|
27
27
|
- inline, file-level, and overall review comments,
|
|
28
|
-
-
|
|
28
|
+
- explicit Submit sends review feedback directly to the agent; closing the window with unsent comments pastes a draft prompt to the editor instead.
|
|
29
29
|
|
|
30
|
-
Submitting feedback does not auto-apply code changes.
|
|
30
|
+
Submitting feedback does not auto-apply code changes. Clicking **Submit to agent** sends a structured prompt directly to the active agent. If you close the window with comments not yet submitted, the extension pastes a draft prompt into the editor instead, so an accidental close cannot fire a new agent turn.
|
|
31
31
|
|
|
32
32
|
The review UI does not fetch assets from a CDN. While the window is open, the extension serves its packaged Monaco graph from an ephemeral, tokenized HTTP server bound only to `127.0.0.1`; closing, cancelling, submitting, startup failure, or Pi shutdown stops that server.
|
|
33
33
|
|
|
34
|
+
## Rollback
|
|
35
|
+
|
|
36
|
+
There is no runtime setting or toggle for submit behavior. To restore the prior editor-only Submit flow, reinstall the previous package version or revert this source change and rebuild/reinstall the package.
|
|
37
|
+
|
|
34
38
|
## Requirements
|
|
35
39
|
|
|
36
40
|
- Run inside a git repository.
|
|
@@ -248,7 +248,7 @@ function buildCommitFileId(sha: string, comparison: ReviewFileComparison): strin
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
async function getRevisionContent(pi: ExtensionAPI, repoRoot: string, revision: string, path: string): Promise<string> {
|
|
251
|
-
const result = await pi.exec("git", ["show", `${revision}:${path}`], { cwd: repoRoot });
|
|
251
|
+
const result = await pi.exec("git", ["show", "--end-of-options", `${revision}:${path}`], { cwd: repoRoot });
|
|
252
252
|
if (result.code !== 0) {
|
|
253
253
|
return "";
|
|
254
254
|
}
|
|
@@ -327,7 +327,7 @@ async function getRevisionBytes(
|
|
|
327
327
|
path: string,
|
|
328
328
|
): Promise<Buffer | null> {
|
|
329
329
|
const spec = shellQuote(`${revision}:${path}`);
|
|
330
|
-
const result = await pi.exec("bash", ["-lc", `git show ${spec} | base64 | tr -d '\\n'`], { cwd: repoRoot });
|
|
330
|
+
const result = await pi.exec("bash", ["-lc", `git show --end-of-options ${spec} | base64 | tr -d '\\n'`], { cwd: repoRoot });
|
|
331
331
|
if (result.code !== 0) return null;
|
|
332
332
|
const encoded = (result.stdout ?? "").trim();
|
|
333
333
|
try {
|
|
@@ -706,6 +706,7 @@ export async function getCommitFiles(pi: ExtensionAPI, repoRoot: string, sha: st
|
|
|
706
706
|
"--name-status",
|
|
707
707
|
"--no-commit-id",
|
|
708
708
|
"-r",
|
|
709
|
+
"--end-of-options",
|
|
709
710
|
sha,
|
|
710
711
|
]);
|
|
711
712
|
const changes = parseNameStatus(output).filter((change) =>
|