@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.
Files changed (108) hide show
  1. package/LICENSE +2 -0
  2. package/README.md +17 -12
  3. package/extensions/agent-workflow-audit/README.md +1 -1
  4. package/extensions/agent-workflow-audit/index.ts +1631 -1009
  5. package/extensions/agent-workflow-audit/package.json +1 -1
  6. package/extensions/annotate-git-diff/README.md +3 -1
  7. package/extensions/annotate-git-diff/clipboard.ts +109 -100
  8. package/extensions/annotate-git-diff/git.ts +846 -768
  9. package/extensions/annotate-git-diff/glimpseui.d.ts +87 -78
  10. package/extensions/annotate-git-diff/index.ts +712 -671
  11. package/extensions/annotate-git-diff/package.json +1 -1
  12. package/extensions/annotate-git-diff/prompt.ts +45 -45
  13. package/extensions/annotate-git-diff/quiet-glimpse.ts +161 -155
  14. package/extensions/annotate-git-diff/review-server.ts +337 -311
  15. package/extensions/annotate-git-diff/types.ts +132 -132
  16. package/extensions/annotate-git-diff/ui.ts +27 -27
  17. package/extensions/annotate-git-diff/watch.ts +74 -74
  18. package/extensions/annotate-git-diff/web/app.js +1947 -1884
  19. package/extensions/annotate-git-diff/web/index.html +5 -6
  20. package/extensions/annotate-last-message/README.md +1 -1
  21. package/extensions/annotate-last-message/glimpseui.d.ts +87 -78
  22. package/extensions/annotate-last-message/index.ts +210 -206
  23. package/extensions/annotate-last-message/package.json +1 -1
  24. package/extensions/annotate-last-message/prompt.ts +87 -66
  25. package/extensions/annotate-last-message/quiet-glimpse.ts +161 -155
  26. package/extensions/annotate-last-message/session.ts +94 -89
  27. package/extensions/annotate-last-message/theme.ts +199 -193
  28. package/extensions/annotate-last-message/types.ts +23 -23
  29. package/extensions/annotate-last-message/ui.ts +27 -25
  30. package/extensions/annotate-last-message/web/app.js +4 -7
  31. package/extensions/annotate-last-message/web/index.html +3 -3
  32. package/extensions/annotate-last-message/web/md-renderer.js +1 -1
  33. package/extensions/brrr/README.md +1 -1
  34. package/extensions/brrr/index.ts +213 -191
  35. package/extensions/brrr/package.json +1 -1
  36. package/extensions/claude-fast/README.md +5 -79
  37. package/extensions/claude-fast/index.ts +31 -289
  38. package/extensions/claude-fast/package.json +2 -3
  39. package/extensions/code-reviewer/README.md +6 -6
  40. package/extensions/code-reviewer/index.ts +1825 -1373
  41. package/extensions/code-reviewer/package.json +1 -1
  42. package/extensions/confirm-destructive/README.md +1 -1
  43. package/extensions/confirm-destructive/index.ts +50 -52
  44. package/extensions/confirm-destructive/package.json +1 -1
  45. package/extensions/context-cap/README.md +9 -9
  46. package/extensions/context-cap/index.ts +313 -305
  47. package/extensions/context-cap/package.json +2 -2
  48. package/extensions/context-inspector/index.ts +1211 -1064
  49. package/extensions/context-inspector/package.json +1 -1
  50. package/extensions/contrarian/README.md +4 -3
  51. package/extensions/contrarian/index.ts +1863 -1737
  52. package/extensions/contrarian/package.json +1 -1
  53. package/extensions/dirty-repo-guard/index.ts +37 -41
  54. package/extensions/dirty-repo-guard/package.json +1 -1
  55. package/extensions/dynamic-context-pruning/README.md +11 -43
  56. package/extensions/dynamic-context-pruning/index.ts +2131 -2105
  57. package/extensions/dynamic-context-pruning/package.json +1 -1
  58. package/extensions/fast/README.md +52 -14
  59. package/extensions/fast/index.ts +513 -317
  60. package/extensions/fast/package.json +1 -1
  61. package/extensions/git-footer/README.md +1 -1
  62. package/extensions/git-footer/index.ts +458 -411
  63. package/extensions/git-footer/package.json +2 -3
  64. package/extensions/gnosis/index.ts +180 -130
  65. package/extensions/gnosis/package.json +1 -1
  66. package/extensions/inline-bash/index.ts +87 -103
  67. package/extensions/inline-bash/package.json +1 -1
  68. package/extensions/librarian/README.md +1 -1
  69. package/extensions/librarian/index.ts +1877 -1419
  70. package/extensions/librarian/package.json +1 -1
  71. package/extensions/minimal-footer/README.md +5 -5
  72. package/extensions/minimal-footer/index.ts +987 -1012
  73. package/extensions/minimal-footer/minimal-footer.example.json +1 -1
  74. package/extensions/minimal-footer/openai-usage.ts +195 -190
  75. package/extensions/minimal-footer/package.json +1 -1
  76. package/extensions/notify/index.ts +222 -230
  77. package/extensions/notify/package.json +1 -1
  78. package/extensions/openai-fast/README.md +5 -73
  79. package/extensions/openai-fast/index.ts +32 -272
  80. package/extensions/openai-fast/package.json +2 -3
  81. package/extensions/oracle/README.md +4 -3
  82. package/extensions/oracle/index.ts +1740 -1627
  83. package/extensions/oracle/package.json +1 -1
  84. package/extensions/permission-gate/README.md +3 -0
  85. package/extensions/permission-gate/index.ts +785 -612
  86. package/extensions/permission-gate/package.json +1 -1
  87. package/extensions/permission-gate/powershell-safety.ts +840 -793
  88. package/extensions/project-mcp-json/.pi-fleet-tested-version +1 -0
  89. package/extensions/project-mcp-json/README.md +199 -0
  90. package/extensions/project-mcp-json/config.ts +564 -0
  91. package/extensions/project-mcp-json/index.ts +119 -0
  92. package/extensions/project-mcp-json/package.json +38 -0
  93. package/extensions/quiet-tools/.pi-fleet-tested-version +1 -1
  94. package/extensions/quiet-tools/README.md +30 -19
  95. package/extensions/quiet-tools/index.ts +376 -291
  96. package/extensions/quiet-tools/package.json +2 -2
  97. package/extensions/review/README.md +2 -2
  98. package/extensions/review/index.ts +1745 -1872
  99. package/extensions/review/package.json +1 -1
  100. package/extensions/todo/index.ts +280 -280
  101. package/extensions/todo/package.json +1 -1
  102. package/extensions/triage-comments/README.md +6 -4
  103. package/extensions/triage-comments/index.ts +2620 -1888
  104. package/extensions/triage-comments/package.json +1 -1
  105. package/package.json +9 -6
  106. package/assets/social-preview.png +0 -0
  107. package/extensions/claude-fast/claude-fast.example.json +0 -4
  108. package/extensions/openai-fast/openai-fast.example.json +0 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-contrarian",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "A read-only contrarian subagent extension for pi that stress-tests plans, designs, assumptions, and conclusions.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -8,49 +8,45 @@
8
8
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
9
9
 
10
10
  async function checkDirtyRepo(
11
- pi: ExtensionAPI,
12
- ctx: ExtensionContext,
13
- action: string,
11
+ pi: ExtensionAPI,
12
+ ctx: ExtensionContext,
13
+ action: string,
14
14
  ): Promise<{ cancel: boolean } | undefined> {
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(`You have ${changedFiles} uncommitted file(s). ${action} anyway?`, [
37
- "Yes, proceed anyway",
38
- "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
- }
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
- 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
- });
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
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-dirty-repo-guard",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "A pi extension that prompts before session changes when the current git repo has uncommitted changes.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -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) and the [Roadmap](#roadmap) evidence).
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
- mid-loop/idle detection is wired through the `context` event handler
261
- (pe-zy4s): the state is classified straight from the message payload —
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 (see [Roadmap](#roadmap)) was re-derived against this same
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) — see [Roadmap](#roadmap) for the full
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/sculptdotfun/opencode-dynamic-context-pruning) ("pi-dcp" upstream)**:
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 (`pe-c5n9`, over
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
- - **Hindsight-optimal break-even threshold `T`** (maximizes total *realized*
444
- net benefit), by cached-price ratio `r`, split overall / mid_loop / idle:
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