@diegopetrucci/pi-extensions 0.1.76 → 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 (53) hide show
  1. package/README.md +8 -8
  2. package/extensions/agent-workflow-audit/README.md +1 -1
  3. package/extensions/agent-workflow-audit/index.ts +277 -44
  4. package/extensions/agent-workflow-audit/package.json +1 -1
  5. package/extensions/annotate-git-diff/git.ts +0 -8
  6. package/extensions/annotate-git-diff/package.json +1 -1
  7. package/extensions/annotate-last-message/package.json +1 -1
  8. package/extensions/annotate-last-message/web/index.html +3 -3
  9. package/extensions/code-reviewer/README.md +5 -5
  10. package/extensions/code-reviewer/index.ts +258 -54
  11. package/extensions/code-reviewer/package.json +1 -1
  12. package/extensions/confirm-destructive/index.ts +2 -8
  13. package/extensions/confirm-destructive/package.json +1 -1
  14. package/extensions/context-cap/README.md +9 -9
  15. package/extensions/context-cap/index.ts +3 -3
  16. package/extensions/context-cap/package.json +2 -2
  17. package/extensions/contrarian/README.md +4 -3
  18. package/extensions/contrarian/index.ts +47 -40
  19. package/extensions/contrarian/package.json +1 -1
  20. package/extensions/dirty-repo-guard/index.ts +0 -4
  21. package/extensions/dirty-repo-guard/package.json +1 -1
  22. package/extensions/dynamic-context-pruning/README.md +5 -5
  23. package/extensions/dynamic-context-pruning/index.ts +114 -232
  24. package/extensions/dynamic-context-pruning/package.json +1 -1
  25. package/extensions/fast/README.md +2 -2
  26. package/extensions/fast/package.json +1 -1
  27. package/extensions/inline-bash/index.ts +0 -16
  28. package/extensions/inline-bash/package.json +1 -1
  29. package/extensions/librarian/README.md +1 -1
  30. package/extensions/librarian/index.ts +247 -39
  31. package/extensions/librarian/package.json +1 -1
  32. package/extensions/minimal-footer/README.md +5 -5
  33. package/extensions/minimal-footer/index.ts +3 -10
  34. package/extensions/minimal-footer/minimal-footer.example.json +1 -1
  35. package/extensions/minimal-footer/package.json +1 -1
  36. package/extensions/oracle/README.md +4 -3
  37. package/extensions/oracle/index.ts +45 -38
  38. package/extensions/oracle/package.json +1 -1
  39. package/extensions/permission-gate/README.md +3 -0
  40. package/extensions/permission-gate/index.ts +151 -28
  41. package/extensions/permission-gate/package.json +1 -1
  42. package/extensions/project-mcp-json/README.md +2 -2
  43. package/extensions/project-mcp-json/package.json +1 -1
  44. package/extensions/quiet-tools/.pi-fleet-tested-version +1 -1
  45. package/extensions/quiet-tools/README.md +30 -19
  46. package/extensions/quiet-tools/index.ts +233 -166
  47. package/extensions/quiet-tools/package.json +2 -2
  48. package/extensions/todo/index.ts +0 -19
  49. package/extensions/todo/package.json +1 -1
  50. package/extensions/triage-comments/README.md +4 -2
  51. package/extensions/triage-comments/index.ts +349 -29
  52. package/extensions/triage-comments/package.json +1 -1
  53. package/package.json +4 -4
@@ -102,8 +102,15 @@ interface ContrarianPreferences {
102
102
  thinkingLevel?: ThinkingLevel;
103
103
  }
104
104
 
105
- const READ_ONLY_TOOLS = ["read", "grep", "find", "ls"];
106
- const READ_ONLY_PLUS_BASH_TOOLS = [...READ_ONLY_TOOLS, "bash"];
105
+ const SUBAGENT_MCP_TOOLS = [
106
+ "mcp__*",
107
+ "tool_search",
108
+ "list_mcp_resources",
109
+ "list_mcp_resource_templates",
110
+ "read_mcp_resource",
111
+ ];
112
+ const READ_ONLY_TOOLS = ["read", "grep", "find", "ls", ...SUBAGENT_MCP_TOOLS];
113
+ const READ_ONLY_PLUS_BASH_TOOLS = ["read", "grep", "find", "ls", "bash", ...SUBAGENT_MCP_TOOLS];
107
114
  const DEFAULT_THINKING_LEVEL: ThinkingLevel = "high";
108
115
  const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;
109
116
  const COLLAPSED_LINE_LIMIT = 8;
@@ -161,6 +168,33 @@ const CONTRARIAN_MODEL_PREFERENCES = [
161
168
  "gemini-3.5-flash",
162
169
  ];
163
170
 
171
+ const AZURE_MODEL_PREFERENCES = [
172
+ "gpt-6-astra ",
173
+ "gpt-6-astra",
174
+ "gpt-6.1-sol ",
175
+ "gpt-6-sol ",
176
+ "gpt-6-sol",
177
+ "gpt-5.6-sol",
178
+ "gpt-5.6-terra",
179
+ "gpt-6-luna ",
180
+ "gpt-6-luna",
181
+ "gpt-5.6-luna",
182
+ "gpt-5.5-pro",
183
+ "gpt-5.5",
184
+ "gpt-5.4-pro",
185
+ "gpt-5.4 ",
186
+ "gpt-5.3-codex",
187
+ "gpt-5-pro",
188
+ "gpt-5-chat-latest",
189
+ "gpt-5.2-pro",
190
+ "gpt-5.2",
191
+ "gpt-5.1",
192
+ "o3-pro",
193
+ "o1-pro",
194
+ "gpt-5.4-mini",
195
+ "gpt-5-mini",
196
+ ];
197
+
164
198
  const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
165
199
  "amazon-bedrock": [
166
200
  "global.anthropic.claude-opus-5-5 ",
@@ -213,32 +247,9 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
213
247
  "claude-sonnet-4-5",
214
248
  ],
215
249
  "ant-ling": ["Ling-2.6-1T", "Ling-2.6-flash"],
216
- "azure-openai-responses": [
217
- "gpt-6-astra ",
218
- "gpt-6-astra",
219
- "gpt-6.1-sol ",
220
- "gpt-6-sol ",
221
- "gpt-6-sol",
222
- "gpt-5.6-sol",
223
- "gpt-5.6-terra",
224
- "gpt-6-luna ",
225
- "gpt-6-luna",
226
- "gpt-5.6-luna",
227
- "gpt-5.5-pro",
228
- "gpt-5.5",
229
- "gpt-5.4-pro",
230
- "gpt-5.4 ",
231
- "gpt-5.3-codex",
232
- "gpt-5-pro",
233
- "gpt-5-chat-latest",
234
- "gpt-5.2-pro",
235
- "gpt-5.2",
236
- "gpt-5.1",
237
- "o3-pro",
238
- "o1-pro",
239
- "gpt-5.4-mini",
240
- "gpt-5-mini",
241
- ],
250
+ azure: AZURE_MODEL_PREFERENCES,
251
+ // Legacy alias for Pi 1.0.0–1.0.2 hosts (renamed to `azure` in Pi 1.0.3).
252
+ "azure-openai-responses": AZURE_MODEL_PREFERENCES,
242
253
  baseten: [
243
254
  "moonshotai/Kimi-K3",
244
255
  "moonshotai/Kimi-K2.7-Code ",
@@ -263,10 +274,6 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
263
274
  "cloudflare-ai-gateway": [
264
275
  "claude-fable-5",
265
276
  "claude-opus-5",
266
- "claude-opus-4.8",
267
- "claude-opus-4.7",
268
- "claude-opus-4.6",
269
- "claude-opus-4.5",
270
277
  "gpt-6-astra ",
271
278
  "gpt-6-astra",
272
279
  "gpt-5.5",
@@ -603,9 +610,7 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
603
610
  "MiniMaxAI/MiniMax-M3",
604
611
  "MiniMaxAI/MiniMax-M2.7",
605
612
  "openai/gpt-oss-120b",
606
- "openai/gpt-oss-20b",
607
613
  "nvidia/nemotron-3-ultra-550b-a55b",
608
- "google/gemma-4-31B-it",
609
614
  ],
610
615
  typesafe: [],
611
616
  "vercel-ai-gateway": [
@@ -681,13 +686,14 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
681
686
  };
682
687
 
683
688
  const CONTRARIAN_SYSTEM_PROMPT = [
684
- "You are the Contrarian: an independent, read-only adversarial analyst.",
689
+ "You are the Contrarian: an independent adversarial analyst with access to read-only built-in tools and any configured MCP tools.",
685
690
  "Your job is to stress-test a proposal, plan, design, assumption, bug hypothesis, review conclusion, product direction, or decision by developing the strongest credible opposing case for the delegating primary agent.",
686
- "You are read-only. Never modify files, create patches, install dependencies, change configuration, implement fixes, or delegate work to other agents. Your output is adversarial analysis, evidence, and recommendations only.",
691
+ "Never modify files, create patches, install dependencies, change configuration, implement fixes, or delegate work to other agents. Your output is adversarial analysis, evidence, and recommendations only.",
687
692
  "Use the available tools to inspect the repository and gather evidence. If bash is available, use it only for non-mutating inspection commands.",
693
+ "Configured MCP tools are available and run without confirmation inside this subagent. Use them only to gather evidence or context. Avoid side-effecting MCP actions unless the task explicitly asks for them.",
688
694
  "Analysis process:",
689
695
  "1. Identify the core claim, decision, or direction being challenged.",
690
- "2. Gather the local read-only context needed to evaluate it accurately.",
696
+ "2. Gather the local context needed to evaluate it accurately.",
691
697
  "3. Steelman the strongest credible opposing position before judging whether it holds.",
692
698
  "4. Identify hidden assumptions, failure modes, alternative interpretations, tradeoffs, and disconfirming evidence.",
693
699
  "5. Clearly separate confirmed objections, plausible concerns, and unresolved unknowns.",
@@ -1814,15 +1820,16 @@ function createContrarianExtension(pi: ExtensionAPI, deps: ContrarianExtensionDe
1814
1820
  name: "contrarian",
1815
1821
  label: "Contrarian",
1816
1822
  description:
1817
- "Consult a separate read-only contrarian subprocess that stress-tests plans, designs, assumptions, bug hypotheses, and conclusions by steelmanning the strongest opposing case.",
1823
+ "Consult a separate contrarian subprocess with read-only built-in tools and configured MCP tools that stress-tests plans, designs, assumptions, bug hypotheses, and conclusions by steelmanning the strongest opposing case.",
1818
1824
  promptSnippet:
1819
- "Consult a read-only contrarian that prefers a strong opposite-family/provider model for adversarial analysis.",
1825
+ "Consult a contrarian subprocess that prefers a strong opposite-family/provider model for adversarial analysis; exposes read-only built-in tools plus any configured MCP tools.",
1820
1826
  promptGuidelines: [
1821
1827
  "Use contrarian when you need to stress-test a proposal, implementation plan, design, assumption, bug hypothesis, review conclusion, or product direction.",
1822
1828
  "Ask contrarian to steelman the strongest opposing case and separate confirmed objections, plausible concerns, and unresolved unknowns.",
1823
1829
  "Do not use contrarian for routine low-value work; contrarian is slower than the main agent.",
1824
- "The contrarian tool is read-only by default and only exposes read, grep, find, and ls unless contrarian includeBash is enabled.",
1830
+ "The contrarian tool exposes read-only built-in tools (read, grep, find, and ls) plus any configured MCP tools; contrarian includeBash adds the bash inspection tool.",
1825
1831
  "Set contrarian includeBash only when the extra bash inspection tool is genuinely useful; keep contrarian relying on read, grep, find, and ls otherwise.",
1832
+ "Configured MCP tools are available to contrarian and run without confirmation inside the subagent; they may have side effects — use them only for gathering evidence, not for state-changing actions unless the task explicitly asks. MCP access requires host Pi >=1.0.4; older hosts degrade to no MCP, no error.",
1826
1833
  "The contrarian tool requests high by default for reasoning models; contrarian defaults and explicit thinkingLevel overrides are clamped to the effective model-supported level when the model is matched.",
1827
1834
  ],
1828
1835
  parameters: ContrarianParams,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-contrarian",
3
- "version": "0.1.15",
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",
@@ -12,11 +12,9 @@ async function checkDirtyRepo(
12
12
  ctx: ExtensionContext,
13
13
  action: string,
14
14
  ): Promise<{ cancel: boolean } | undefined> {
15
- // Check for uncommitted changes
16
15
  const { stdout, code } = await pi.exec("git", ["status", "--porcelain"]);
17
16
 
18
17
  if (code !== 0) {
19
- // Not a git repo, allow the action
20
18
  return;
21
19
  }
22
20
 
@@ -26,11 +24,9 @@ async function checkDirtyRepo(
26
24
  }
27
25
 
28
26
  if (!ctx.hasUI) {
29
- // In non-interactive mode, block by default
30
27
  return { cancel: true };
31
28
  }
32
29
 
33
- // Count changed files
34
30
  const changedFiles = stdout.trim().split("\n").filter(Boolean).length;
35
31
 
36
32
  const choice = await ctx.ui.select(
@@ -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",
@@ -256,9 +256,9 @@ 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
@@ -396,7 +396,7 @@ candidates, both overall and split by idle/mid-loop agent state.
396
396
 
397
397
  ## Comparison
398
398
 
399
- - **[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)**:
400
400
  the OpenCode plugin this extension takes its name and general problem space
401
401
  from. It ships a model-invoked `compress` tool (agentic, nested-summary
402
402
  compression), autonomous nudges, manual mode, and a full `/dcp` command
@@ -428,7 +428,7 @@ net benefit, at sufficient candidate volume, with enough remaining-calls
428
428
  runway per session to plausibly amortize a compression summary's own token
429
429
  cost — see `docs/v2-design.md` §4 for the exact go/no-go bar.
430
430
 
431
- The representative-corpus run of the benchmark harness (`pe-c5n9`, over
431
+ The representative-corpus run of the benchmark harness (over
432
432
  `~/.the-last-harness/agent/sessions`: 1,390+ session files, 556 gate-eligible
433
433
  candidates — see the corpus-choice note above) produced:
434
434