@diegopetrucci/pi-extensions 0.1.74 → 0.1.78
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 +17 -12
- package/extensions/agent-workflow-audit/README.md +1 -1
- package/extensions/agent-workflow-audit/index.ts +1631 -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 +846 -768
- 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/index.html +3 -3
- 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 +6 -6
- package/extensions/code-reviewer/index.ts +1825 -1373
- package/extensions/code-reviewer/package.json +1 -1
- package/extensions/confirm-destructive/README.md +1 -1
- package/extensions/confirm-destructive/index.ts +50 -52
- package/extensions/confirm-destructive/package.json +1 -1
- package/extensions/context-cap/README.md +9 -9
- package/extensions/context-cap/index.ts +313 -305
- package/extensions/context-cap/package.json +2 -2
- package/extensions/context-inspector/index.ts +1211 -1064
- package/extensions/context-inspector/package.json +1 -1
- package/extensions/contrarian/README.md +4 -3
- package/extensions/contrarian/index.ts +1863 -1737
- package/extensions/contrarian/package.json +1 -1
- package/extensions/dirty-repo-guard/index.ts +37 -41
- package/extensions/dirty-repo-guard/package.json +1 -1
- package/extensions/dynamic-context-pruning/README.md +11 -43
- package/extensions/dynamic-context-pruning/index.ts +2131 -2105
- package/extensions/dynamic-context-pruning/package.json +1 -1
- package/extensions/fast/README.md +52 -14
- package/extensions/fast/index.ts +513 -317
- 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 +87 -103
- package/extensions/inline-bash/package.json +1 -1
- package/extensions/librarian/README.md +1 -1
- package/extensions/librarian/index.ts +1877 -1419
- package/extensions/librarian/package.json +1 -1
- package/extensions/minimal-footer/README.md +5 -5
- package/extensions/minimal-footer/index.ts +987 -1012
- package/extensions/minimal-footer/minimal-footer.example.json +1 -1
- package/extensions/minimal-footer/openai-usage.ts +195 -190
- package/extensions/minimal-footer/package.json +1 -1
- 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/README.md +4 -3
- package/extensions/oracle/index.ts +1740 -1627
- package/extensions/oracle/package.json +1 -1
- package/extensions/permission-gate/README.md +3 -0
- package/extensions/permission-gate/index.ts +785 -612
- 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/.pi-fleet-tested-version +1 -1
- package/extensions/quiet-tools/README.md +30 -19
- package/extensions/quiet-tools/index.ts +376 -291
- package/extensions/quiet-tools/package.json +2 -2
- 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 +280 -280
- package/extensions/todo/package.json +1 -1
- package/extensions/triage-comments/README.md +6 -4
- package/extensions/triage-comments/index.ts +2620 -1888
- package/extensions/triage-comments/package.json +1 -1
- package/package.json +9 -6
- 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,45 @@
|
|
|
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
|
-
if (choice !== "Yes, proceed anyway") {
|
|
42
|
-
ctx.ui.notify("Commit your changes first", "warning");
|
|
43
|
-
return { cancel: true };
|
|
44
|
-
}
|
|
15
|
+
const { stdout, code } = await pi.exec("git", ["status", "--porcelain"]);
|
|
16
|
+
|
|
17
|
+
if (code !== 0) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const hasChanges = stdout.trim().length > 0;
|
|
22
|
+
if (!hasChanges) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!ctx.hasUI) {
|
|
27
|
+
return { cancel: true };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const changedFiles = stdout.trim().split("\n").filter(Boolean).length;
|
|
31
|
+
|
|
32
|
+
const choice = await ctx.ui.select(
|
|
33
|
+
`You have ${changedFiles} uncommitted file(s). ${action} anyway?`,
|
|
34
|
+
["Yes, proceed anyway", "No, let me commit first"],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (choice !== "Yes, proceed anyway") {
|
|
38
|
+
ctx.ui.notify("Commit your changes first", "warning");
|
|
39
|
+
return { cancel: true };
|
|
40
|
+
}
|
|
45
41
|
}
|
|
46
42
|
|
|
47
43
|
export default function (pi: ExtensionAPI) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
pi.on("session_before_switch", async (event, ctx) => {
|
|
45
|
+
const action = event.reason === "new" ? "new session" : "switch session";
|
|
46
|
+
return checkDirtyRepo(pi, ctx, action);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
pi.on("session_before_fork", async (_event, ctx) => {
|
|
50
|
+
return checkDirtyRepo(pi, ctx, "fork");
|
|
51
|
+
});
|
|
56
52
|
}
|
|
@@ -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
|
|
@@ -256,13 +256,13 @@ Notes:
|
|
|
256
256
|
survives this floor.
|
|
257
257
|
- `gate.breakEvenThresholdByState` lets `idle` vs `mid_loop` agent states use
|
|
258
258
|
different thresholds; `idle` defaults to `22` and
|
|
259
|
-
`mid_loop` defaults to `1`. Real
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
`mid_loop` defaults to `1`. Real mid-loop/idle detection is wired through
|
|
260
|
+
the `context` event handler: the state is classified straight from the
|
|
261
|
+
message payload —
|
|
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
|
|
|
@@ -397,7 +396,7 @@ candidates, both overall and split by idle/mid-loop agent state.
|
|
|
397
396
|
|
|
398
397
|
## Comparison
|
|
399
398
|
|
|
400
|
-
- **[opencode-dynamic-context-pruning](https://github.com/
|
|
399
|
+
- **[opencode-dynamic-context-pruning](https://github.com/Tarquinen/opencode-dynamic-context-pruning) ("pi-dcp" upstream)**:
|
|
401
400
|
the OpenCode plugin this extension takes its name and general problem space
|
|
402
401
|
from. It ships a model-invoked `compress` tool (agentic, nested-summary
|
|
403
402
|
compression), autonomous nudges, manual mode, and a full `/dcp` command
|
|
@@ -429,7 +428,7 @@ net benefit, at sufficient candidate volume, with enough remaining-calls
|
|
|
429
428
|
runway per session to plausibly amortize a compression summary's own token
|
|
430
429
|
cost — see `docs/v2-design.md` §4 for the exact go/no-go bar.
|
|
431
430
|
|
|
432
|
-
The representative-corpus run of the benchmark harness (
|
|
431
|
+
The representative-corpus run of the benchmark harness (over
|
|
433
432
|
`~/.the-last-harness/agent/sessions`: 1,390+ session files, 556 gate-eligible
|
|
434
433
|
candidates — see the corpus-choice note above) produced:
|
|
435
434
|
|
|
@@ -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
|