@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-code-reviewer",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "A standalone pi extension that adds a read-only code_reviewer subagent tool for isolated code reviews.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -7,7 +7,7 @@ This is adapted from the original `confirm-destructive.ts` example in [`earendil
7
7
  ## What it checks
8
8
 
9
9
  - clearing the current session
10
- - switching sessions when the current session has user messages
10
+ - switching sessions when a user message is newer than the last assistant (or a user message with no assistant)
11
11
  - forking from an entry
12
12
 
13
13
  ## Install
@@ -5,70 +5,68 @@
5
5
  * Demonstrates how to cancel session events using the before_* events.
6
6
  */
7
7
 
8
- import type { ExtensionAPI, SessionBeforeSwitchEvent, SessionEntry } from "@earendil-works/pi-coding-agent";
8
+ import type {
9
+ ExtensionAPI,
10
+ SessionBeforeSwitchEvent,
11
+ SessionEntry,
12
+ } from "@earendil-works/pi-coding-agent";
9
13
 
10
14
  function hasUnsavedUserWork(entries: SessionEntry[]): boolean {
11
- let sawAssistant = false;
15
+ for (let index = entries.length - 1; index >= 0; index -= 1) {
16
+ const entry = entries[index];
17
+ if (entry.type !== "message") continue;
18
+ if (entry.message.role === "assistant") return false;
19
+ if (entry.message.role === "user") return true;
20
+ }
12
21
 
13
- for (let index = entries.length - 1; index >= 0; index -= 1) {
14
- const entry = entries[index];
15
- if (entry.type !== "message") continue;
16
- if (entry.message.role === "assistant") {
17
- sawAssistant = true;
18
- break;
19
- }
20
- if (entry.message.role === "user") return true;
21
- }
22
-
23
- if (sawAssistant) return false;
24
- return entries.some((entry) => entry.type === "message" && entry.message.role === "user");
22
+ return false;
25
23
  }
26
24
 
27
25
  export default function (pi: ExtensionAPI) {
28
- pi.on("session_before_switch", async (event: SessionBeforeSwitchEvent, ctx) => {
29
- if (!ctx.hasUI) return;
26
+ pi.on("session_before_switch", async (event: SessionBeforeSwitchEvent, ctx) => {
27
+ if (!ctx.hasUI) return;
30
28
 
31
- if (event.reason === "new") {
32
- const confirmed = await ctx.ui.confirm(
33
- "Clear session?",
34
- "This will delete all messages in the current session.",
35
- );
29
+ if (event.reason === "new") {
30
+ const confirmed = await ctx.ui.confirm(
31
+ "Clear session?",
32
+ "This will delete all messages in the current session.",
33
+ );
36
34
 
37
- if (!confirmed) {
38
- ctx.ui.notify("Clear cancelled", "info");
39
- return { cancel: true };
40
- }
41
- return;
42
- }
35
+ if (!confirmed) {
36
+ ctx.ui.notify("Clear cancelled", "info");
37
+ return { cancel: true };
38
+ }
39
+ return;
40
+ }
43
41
 
44
- // reason === "resume" - check if there are unsaved changes (user messages newer than the last assistant response)
45
- const entries = ctx.sessionManager.getEntries();
46
- const hasUnsavedWork = hasUnsavedUserWork(entries);
42
+ // reason === "resume" - check if there are unsaved changes (user messages newer than the last assistant response)
43
+ const entries = ctx.sessionManager.getEntries();
44
+ const hasUnsavedWork = hasUnsavedUserWork(entries);
47
45
 
48
- if (hasUnsavedWork) {
49
- const confirmed = await ctx.ui.confirm(
50
- "Switch session?",
51
- "You have messages in the current session. Switch anyway?",
52
- );
46
+ if (hasUnsavedWork) {
47
+ const confirmed = await ctx.ui.confirm(
48
+ "Switch session?",
49
+ "You have messages in the current session. Switch anyway?",
50
+ );
53
51
 
54
- if (!confirmed) {
55
- ctx.ui.notify("Switch cancelled", "info");
56
- return { cancel: true };
57
- }
58
- }
59
- });
52
+ if (!confirmed) {
53
+ ctx.ui.notify("Switch cancelled", "info");
54
+ return { cancel: true };
55
+ }
56
+ }
57
+ });
60
58
 
61
- pi.on("session_before_fork", async (event, ctx) => {
62
- if (!ctx.hasUI) return;
59
+ pi.on("session_before_fork", async (event, ctx) => {
60
+ if (!ctx.hasUI) return;
63
61
 
64
- const choice = await ctx.ui.select(`Fork from entry ${event.entryId.slice(0, 8)}?`, [
65
- "Yes, create fork",
66
- "No, stay in current session",
67
- ]);
62
+ const choice = await ctx.ui.select(`Fork from entry ${event.entryId.slice(0, 8)}?`, [
63
+ "Yes, create fork",
64
+ "No, stay in current session",
65
+ ]);
68
66
 
69
- if (choice !== "Yes, create fork") {
70
- ctx.ui.notify("Fork cancelled", "info");
71
- return { cancel: true };
72
- }
73
- });
67
+ if (choice !== "Yes, create fork") {
68
+ ctx.ui.notify("Fork cancelled", "info");
69
+ return { cancel: true };
70
+ }
71
+ });
74
72
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-confirm-destructive",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "A pi extension that confirms destructive session actions.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,6 @@
1
1
  # context-cap
2
2
 
3
- A pi extension that treats large-context models as having an effective 200k-token context window, so pi's built-in auto-compaction starts earlier, and avoids the dumb zone.
3
+ A pi extension that treats large-context models as having an effective 300k-token context window, so pi's built-in auto-compaction starts earlier, and avoids the dumb zone.
4
4
 
5
5
  By default, pi auto-compacts when:
6
6
 
@@ -11,10 +11,10 @@ contextTokens > model.contextWindow - reserveTokens
11
11
  This extension changes the active model's in-memory `contextWindow` to:
12
12
 
13
13
  ```text
14
- min(originalContextWindow, 200000)
14
+ min(originalContextWindow, 300000)
15
15
  ```
16
16
 
17
- With pi's default `reserveTokens` of 16,384, models larger than 200k will proactively compact around 183,616 tokens.
17
+ With pi's default `reserveTokens` of 16,384, models larger than 300k will proactively compact around 283,616 tokens.
18
18
 
19
19
  ## Commands
20
20
 
@@ -65,21 +65,21 @@ Then reload pi:
65
65
 
66
66
  ### Settings guard and alternative
67
67
 
68
- - On Pi hosts exposing `getSettings()`, the extension resolves `reserveTokens` using Pi's precedence: `compaction.modelOverrides["provider/model-id"].reserveTokens`, then `compaction.reserveTokens`, then the default `16,384`. It skips the cap when the resolved value is at least `200,000` (which would make the threshold zero or negative), or when any explicit entry exists for that model. Hosts without `getSettings()` use the older cap behavior without this guard.
69
- - Pi's provider request path also derives an output-token budget from the effective window (`contextWindow - contextTokens - 4096`, with any provider-specific clamp applied afterward). The cap can therefore reduce response or thinking-token budgets near the limit, in addition to causing earlier compaction; Pi's overflow handling may also treat a request above 200k as overflow and retry after compaction. Use `/context-cap off` when you need the full model window temporarily.
70
- - As a session-scoped alternative, configure Pi's own `compaction.modelOverrides` instead of this extension. The exact key is `provider/model-id`; to match this extension's default 200k threshold for a model with original window `W`, let `R` be the configured `reserveTokens` value (default `16,384`) and use:
68
+ - On Pi hosts exposing `getSettings()`, the extension skips the cap whenever `compaction.modelOverrides` contains the active model's key (`provider/model-id`), whatever fields that entry sets; it does not read `reserveTokens` from the override. Otherwise it uses `compaction.reserveTokens`, then the default `16,384`, and skips the cap when that value is at least `300,000` (which would make the threshold zero or negative). Hosts without `getSettings()` use the older cap behavior without this guard.
69
+ - Pi's provider request path also derives an output-token budget from the effective window (`contextWindow - contextTokens - 4096`, with any provider-specific clamp applied afterward). The cap can therefore reduce response or thinking-token budgets near the limit, in addition to causing earlier compaction; Pi's overflow handling may also treat a request above 300k as overflow and retry after compaction. Use `/context-cap off` when you need the full model window temporarily.
70
+ - As a session-scoped alternative, configure Pi's own `compaction.modelOverrides` instead of this extension. The exact key is `provider/model-id`; to match this extension's default 300k threshold for a model with original window `W`, let `R` be the configured `reserveTokens` value (default `16,384`) and use:
71
71
 
72
72
  ```text
73
- reserveTokens = W - 200000 + R
73
+ reserveTokens = W - 300000 + R
74
74
  ```
75
75
 
76
- For example, with the default `R`, a 1,000,000-token model uses `816384`, yielding the same `183616` threshold as `200000 - 16384`:
76
+ For example, with the default `R`, a 1,000,000-token model uses `716384`, yielding the same `283616` threshold as `300000 - 16384`:
77
77
 
78
78
  ```json
79
79
  {
80
80
  "compaction": {
81
81
  "modelOverrides": {
82
- "provider/model-id": { "reserveTokens": 816384 }
82
+ "provider/model-id": { "reserveTokens": 716384 }
83
83
  }
84
84
  }
85
85
  }