@diegopetrucci/pi-extensions 0.1.73 → 0.1.76
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/LICENSE +2 -0
- package/README.md +9 -4
- package/extensions/agent-workflow-audit/index.ts +1398 -1009
- package/extensions/agent-workflow-audit/package.json +1 -1
- package/extensions/annotate-git-diff/README.md +3 -1
- package/extensions/annotate-git-diff/clipboard.ts +109 -100
- package/extensions/annotate-git-diff/git.ts +853 -767
- package/extensions/annotate-git-diff/glimpseui.d.ts +87 -78
- package/extensions/annotate-git-diff/index.ts +712 -671
- package/extensions/annotate-git-diff/package.json +1 -1
- package/extensions/annotate-git-diff/prompt.ts +45 -45
- package/extensions/annotate-git-diff/quiet-glimpse.ts +161 -155
- package/extensions/annotate-git-diff/review-server.ts +337 -311
- package/extensions/annotate-git-diff/types.ts +132 -132
- package/extensions/annotate-git-diff/ui.ts +27 -27
- package/extensions/annotate-git-diff/watch.ts +74 -74
- package/extensions/annotate-git-diff/web/app.js +1947 -1884
- package/extensions/annotate-git-diff/web/index.html +5 -6
- package/extensions/annotate-last-message/README.md +1 -1
- package/extensions/annotate-last-message/glimpseui.d.ts +87 -78
- package/extensions/annotate-last-message/index.ts +210 -206
- package/extensions/annotate-last-message/package.json +1 -1
- package/extensions/annotate-last-message/prompt.ts +87 -66
- package/extensions/annotate-last-message/quiet-glimpse.ts +161 -155
- package/extensions/annotate-last-message/session.ts +94 -89
- package/extensions/annotate-last-message/theme.ts +199 -193
- package/extensions/annotate-last-message/types.ts +23 -23
- package/extensions/annotate-last-message/ui.ts +27 -25
- package/extensions/annotate-last-message/web/app.js +4 -7
- package/extensions/annotate-last-message/web/md-renderer.js +1 -1
- package/extensions/brrr/README.md +1 -1
- package/extensions/brrr/index.ts +213 -191
- package/extensions/brrr/package.json +1 -1
- package/extensions/claude-fast/README.md +5 -79
- package/extensions/claude-fast/index.ts +31 -289
- package/extensions/claude-fast/package.json +2 -3
- package/extensions/code-reviewer/README.md +1 -1
- package/extensions/code-reviewer/index.ts +1598 -1350
- package/extensions/code-reviewer/package.json +1 -1
- package/extensions/confirm-destructive/README.md +1 -1
- package/extensions/confirm-destructive/index.ts +55 -51
- package/extensions/confirm-destructive/package.json +1 -1
- package/extensions/context-cap/index.ts +312 -304
- package/extensions/context-cap/package.json +1 -1
- package/extensions/context-inspector/index.ts +1211 -1064
- package/extensions/context-inspector/package.json +1 -1
- package/extensions/contrarian/index.ts +1854 -1735
- package/extensions/contrarian/package.json +1 -1
- package/extensions/dirty-repo-guard/index.ts +41 -41
- package/extensions/dynamic-context-pruning/README.md +6 -38
- package/extensions/dynamic-context-pruning/index.ts +2124 -1980
- package/extensions/dynamic-context-pruning/package.json +1 -1
- package/extensions/fast/README.md +71 -21
- package/extensions/fast/index.ts +513 -313
- package/extensions/fast/package.json +1 -1
- package/extensions/git-footer/README.md +1 -1
- package/extensions/git-footer/index.ts +458 -411
- package/extensions/git-footer/package.json +2 -3
- package/extensions/gnosis/index.ts +180 -130
- package/extensions/gnosis/package.json +1 -1
- package/extensions/inline-bash/index.ts +88 -88
- package/extensions/inline-bash/package.json +1 -1
- package/extensions/librarian/index.ts +1669 -1419
- package/extensions/librarian/package.json +1 -1
- package/extensions/minimal-footer/index.ts +994 -1012
- package/extensions/minimal-footer/openai-usage.ts +195 -190
- package/extensions/notify/index.ts +222 -230
- package/extensions/notify/package.json +1 -1
- package/extensions/openai-fast/README.md +5 -73
- package/extensions/openai-fast/index.ts +32 -272
- package/extensions/openai-fast/package.json +2 -3
- package/extensions/oracle/index.ts +1731 -1625
- package/extensions/oracle/package.json +1 -1
- package/extensions/permission-gate/index.ts +658 -608
- package/extensions/permission-gate/package.json +1 -1
- package/extensions/permission-gate/powershell-safety.ts +840 -793
- package/extensions/project-mcp-json/.pi-fleet-tested-version +1 -0
- package/extensions/project-mcp-json/README.md +199 -0
- package/extensions/project-mcp-json/config.ts +564 -0
- package/extensions/project-mcp-json/index.ts +119 -0
- package/extensions/project-mcp-json/package.json +38 -0
- package/extensions/quiet-tools/index.ts +282 -264
- package/extensions/review/README.md +2 -2
- package/extensions/review/index.ts +1745 -1872
- package/extensions/review/package.json +1 -1
- package/extensions/todo/index.ts +284 -265
- package/extensions/triage-comments/README.md +2 -2
- package/extensions/triage-comments/index.ts +2294 -1882
- package/extensions/triage-comments/package.json +1 -1
- package/package.json +6 -3
- package/assets/social-preview.png +0 -0
- package/extensions/claude-fast/claude-fast.example.json +0 -4
- package/extensions/openai-fast/openai-fast.example.json +0 -4
|
@@ -8,49 +8,49 @@
|
|
|
8
8
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
9
9
|
|
|
10
10
|
async function checkDirtyRepo(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
pi: ExtensionAPI,
|
|
12
|
+
ctx: ExtensionContext,
|
|
13
|
+
action: string,
|
|
14
14
|
): Promise<{ cancel: boolean } | undefined> {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
// Check for uncommitted changes
|
|
16
|
+
const { stdout, code } = await pi.exec("git", ["status", "--porcelain"]);
|
|
17
|
+
|
|
18
|
+
if (code !== 0) {
|
|
19
|
+
// Not a git repo, allow the action
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const hasChanges = stdout.trim().length > 0;
|
|
24
|
+
if (!hasChanges) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!ctx.hasUI) {
|
|
29
|
+
// In non-interactive mode, block by default
|
|
30
|
+
return { cancel: true };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Count changed files
|
|
34
|
+
const changedFiles = stdout.trim().split("\n").filter(Boolean).length;
|
|
35
|
+
|
|
36
|
+
const choice = await ctx.ui.select(
|
|
37
|
+
`You have ${changedFiles} uncommitted file(s). ${action} anyway?`,
|
|
38
|
+
["Yes, proceed anyway", "No, let me commit first"],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
if (choice !== "Yes, proceed anyway") {
|
|
42
|
+
ctx.ui.notify("Commit your changes first", "warning");
|
|
43
|
+
return { cancel: true };
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export default function (pi: ExtensionAPI) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
pi.on("session_before_switch", async (event, ctx) => {
|
|
49
|
+
const action = event.reason === "new" ? "new session" : "switch session";
|
|
50
|
+
return checkDirtyRepo(pi, ctx, action);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
pi.on("session_before_fork", async (_event, ctx) => {
|
|
54
|
+
return checkDirtyRepo(pi, ctx, "fork");
|
|
55
|
+
});
|
|
56
56
|
}
|
|
@@ -145,7 +145,7 @@ recoup the one-time cache-bust cost via the recurring saving. The gate accepts
|
|
|
145
145
|
a batch of candidates only if `breakEvenCalls` is at most the effective
|
|
146
146
|
threshold for the current state (`idle=22`, `mid_loop=1` by default,
|
|
147
147
|
calibrated from the representative-corpus benchmark — see the calibration
|
|
148
|
-
note under [Configuration](#configuration)
|
|
148
|
+
note under [Configuration](#configuration)).
|
|
149
149
|
|
|
150
150
|
All candidates proposed in the same `context` call share one cache bust (since
|
|
151
151
|
a prompt cache is a single linear prefix), so they're evaluated and
|
|
@@ -262,7 +262,7 @@ Notes:
|
|
|
262
262
|
`idle` if the most recent relevant message is a user message (this is the
|
|
263
263
|
first LLM call of the turn), `mid_loop` if it's an assistant message or a
|
|
264
264
|
tool result (the agent is iterating mid-turn). The representative-corpus
|
|
265
|
-
benchmark
|
|
265
|
+
benchmark was re-derived against this same
|
|
266
266
|
runtime-observable definition and found the state-split REVERSED from an
|
|
267
267
|
earlier turn-end-based analysis: at r=0.1, `idle` candidates now carry
|
|
268
268
|
essentially all the realized net benefit and `mid_loop` candidates carry
|
|
@@ -277,8 +277,7 @@ Notes:
|
|
|
277
277
|
impossible. Set `mid_loop` back to `22` to restore the old parity behavior.
|
|
278
278
|
- `gate.breakEvenThreshold`'s default of `22` is calibrated from the
|
|
279
279
|
representative-corpus benchmark at `cachedPriceRatio` r=0.1 (aggressive
|
|
280
|
-
prompt caching, the common case)
|
|
281
|
-
evidence and its ratio-sensitivity caveats. It is **provider/ratio-
|
|
280
|
+
prompt caching, the common case). It is **provider/ratio-
|
|
282
281
|
dependent**: the optimal threshold rises as caching gets weaker (T=29 at
|
|
283
282
|
r=0.25, T=54 at r=0.5, T=58 at r=0.9 on the same corpus).
|
|
284
283
|
|
|
@@ -440,40 +439,9 @@ candidates — see the corpus-choice note above) produced:
|
|
|
440
439
|
more amortization runway than the earlier small-corpus run showed, because
|
|
441
440
|
this corpus is dominated by long, tool-heavy agent sessions rather than
|
|
442
441
|
short orchestrator sessions.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
| ratio `r` | overall `T` (benefit) | mid_loop `T` (benefit) | idle `T` (benefit) |
|
|
447
|
-
| --- | --- | --- | --- |
|
|
448
|
-
| 0.1 | T=22 (~20.6k) | T=22 (~20.6k) | T=1 (0 — zero benefit) |
|
|
449
|
-
| 0.25 | T=29 (~1.54M) | T=29 (~1.54M) | T=12 (~4.0k) |
|
|
450
|
-
| 0.5 | T=54 (~8.06M) | T=54 (~8.06M) | T=27 (~37.2k) |
|
|
451
|
-
| 0.9 | T=58 (~24.7M) | T=58 (~24.2M) | T=21 (~459k) |
|
|
452
|
-
|
|
453
|
-
**Reading**: `mid_loop` candidates carry essentially all of the realized
|
|
454
|
-
benefit; `idle` candidates carry essentially none (literally zero at r=0.1).
|
|
455
|
-
At r=0.1 (aggressive prompt caching, the common Anthropic case) the total
|
|
456
|
-
realized benefit across the whole 1,390-session corpus is only ~20.6k
|
|
457
|
-
token-units — economically marginal, on the order of pennies. Savings only
|
|
458
|
-
become material at weaker caching, r>=0.25.
|
|
459
|
-
|
|
460
|
-
**pe-zy4s update (2026-07-08): this idle/mid_loop split used a turn-END
|
|
461
|
-
definition** ("idle" = this call IS the turn's final assistant message, only
|
|
462
|
-
knowable in hindsight via replay) **that was never runtime-observable.** Once
|
|
463
|
-
real runtime agent-state detection landed (turn-START definition: "idle" =
|
|
464
|
-
this is the FIRST LLM call of a turn; see the config-notes bullet above), the
|
|
465
|
-
benchmark's candidate labeling was aligned to that same definition and
|
|
466
|
-
re-derived on the representative corpus (460 gate-eligible candidates on the
|
|
467
|
-
current `~/.the-last-harness/agent/sessions` corpus). The split **reverses**:
|
|
468
|
-
at r=0.1, `idle` (T=22, ~20.6k realized net benefit) now carries essentially
|
|
469
|
-
all the value, and `mid_loop` (T=1, ~0 realized net benefit) carries
|
|
470
|
-
essentially none. Under that ticket's decision rule (stricter idle default
|
|
471
|
-
only if idle is shown ~worthless), parity (`22`/`22`) was retained at the time.
|
|
472
|
-
The 2026-09-08 follow-up supersedes that default with `idle=22` / `mid_loop=1`,
|
|
473
|
-
using the measured mid-loop result to choose a conservative threshold (see
|
|
474
|
-
[Configuration](#configuration) for the evidence and limitations). The table
|
|
475
|
-
above is retained as the historical turn-END-definition record; it no longer
|
|
476
|
-
reflects how the runtime classifies agent state.
|
|
442
|
+
|
|
443
|
+
Shipped gate defaults remain `idle=22` / `mid_loop=1` (see
|
|
444
|
+
[Configuration](#configuration)).
|
|
477
445
|
|
|
478
446
|
**This reframes, rather than weakens, the case for v2.** Small deterministic
|
|
479
447
|
removals (dedupe/error-purge/superseded-file-ops) structurally cannot beat
|