pi-advisor-flow 0.8.3 → 0.9.1

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 (40) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -5
  3. package/dist/index.js +685 -96
  4. package/package.json +14 -14
  5. package/src/attachments.ts +21 -5
  6. package/src/commands/activation.ts +6 -1
  7. package/src/commands/lifecycle.ts +6 -0
  8. package/src/commands/manual-command.ts +44 -12
  9. package/src/commands/manual-consultation.ts +7 -3
  10. package/src/commands/model-commands.ts +1 -0
  11. package/src/commands/runtime.ts +36 -10
  12. package/src/commands/settings-commands.ts +2 -0
  13. package/src/commands/settings-persistence.ts +2 -0
  14. package/src/commands/types.ts +5 -0
  15. package/src/config/defaults.ts +7 -0
  16. package/src/config/schema.ts +7 -0
  17. package/src/config/state.ts +5 -0
  18. package/src/config/types.ts +1 -0
  19. package/src/conversation.ts +29 -7
  20. package/src/image-attachments.ts +118 -0
  21. package/src/image-validation.ts +288 -0
  22. package/src/images.ts +151 -0
  23. package/src/scout-context.ts +1 -0
  24. package/src/scout-curation.ts +11 -4
  25. package/src/scout-groups.ts +13 -3
  26. package/src/scout-types.ts +2 -0
  27. package/src/tools/consult-context.ts +78 -2
  28. package/src/tools/consultation.ts +36 -4
  29. package/src/tools/jev-turn-gate.ts +4 -1
  30. package/src/tools/model-access.ts +21 -2
  31. package/src/tools/prompts.ts +14 -2
  32. package/src/tools/register-ask-advisor.ts +28 -1
  33. package/src/tools/register-lifecycle.ts +8 -2
  34. package/src/tools/render-advisor-result.ts +33 -9
  35. package/src/tools/scout-status.ts +11 -8
  36. package/src/tools/types.ts +9 -0
  37. package/src/ui/settings-items.ts +17 -1
  38. package/src/ui/settings-mutations.ts +1 -0
  39. package/src/ui/types.ts +1 -0
  40. package/src/ui-guard.ts +31 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ All notable changes to this project are documented here.
4
4
 
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0/).
6
6
 
7
+ ## 0.9.1 - 2026-09-30
8
+
9
+ ### Fixed
10
+
11
+ - Overrode transitive `brace-expansion` 5.0.12 and `undici` 8.11.2 to clear four high-severity audit advisories (stack-exhaustion DoS, WebSocket subprotocol DoS, TLS validation bypass).
12
+
13
+ - Fixed manual Advisor consultations crashing non-interactive (`--print`) sessions on Pi 0.99: UI status updates and scout lifecycle reads now no-op safely once the session context is retired instead of throwing, `/advisor-manual` completes within the command handler in print mode, and streaming tool-result repaint timers stop once their renderer is gone.
14
+
15
+ ### Changed
16
+
17
+ - Added Pi 0.99.x support (peer range `^0.87.1 || ^0.99.1`); Pi 0.99's context-lifecycle enforcement is now honored. Manual consultation results no longer trigger a follow-up turn in print mode.
18
+ - Updated the dev toolchain: oxlint 1.86.0, @oxlint/plugins 1.86.0, oxfmt 0.71.0, ultracite 7.12.2, knip 6.39.0.
19
+
20
+ ### Added
21
+
22
+ - Regression tests covering stale-context resilience of the guarded UI helpers.
23
+
24
+ ## 0.9.0 - 2026-09-28
25
+
26
+ ### Added
27
+
28
+ - **Visual Advisor reviews** — image-capable Advisor models can now review real pixels, not just paths or descriptions. PNG, JPEG, GIF, and WebP images from selected conversation history and full-policy tool results are attached when the Advisor model accepts image input, bounded to 4 images, 8 MiB total, and 4 MiB each. Explicit `includeTrackedFiles` and `includeUntracked` handoffs accept image files under their existing consent rules. Images are format-validated before egress; unsupported formats, mismatched MIME types, oversized files, text-only models, and tool policies that withhold results are reported to the Advisor as pixels-not-reviewed so it cannot claim visual evidence it never saw. Scout and Jev never receive image bytes. Results show an `N images attached · size · withheld` label with human-readable sizes.
29
+ - **Same-model Advisor suppression** — when the active Executor model matches the configured Advisor, `ask_advisor`, `/advisor-manual`, and automatic gates are skipped before any screening, budget, or tracked-file consent is spent, with a rendered skip result instead of an error. Switching either model (including via `/model`) re-enables consultations and shows a notice. Enabled by default; turn off **Disable same-model Advisor** in `/advisor-settings` (or `"advisorDisableSameModel": false`) for intentional higher-effort same-model reviews.
30
+
7
31
  ## 0.8.3 - 2026-09-27
8
32
 
9
33
  ### Changed
package/README.md CHANGED
@@ -19,10 +19,11 @@ Keep implementation on a fast model and borrow frontier reasoning only when deci
19
19
  - **On-demand second opinions** through the `ask_advisor` tool or `/advisor-manual`.
20
20
  - **Configurable review gates** before plans, after repeated failures, and before declaring completion.
21
21
  - **Automatic loop detection** for repeated tool calls, with explicit proceed, revise, or blocked decisions.
22
- - **Separate model and reasoning controls** for the Executor and Advisor.
22
+ - **Separate model and reasoning controls** for the Executor and Advisor, with same-model consultations skipped by default to avoid redundant calls.
23
23
  - **Model whitelist** that can restrict Advisor calls to exact `provider/model` Executor references.
24
24
  - **Advisor usage accounting** with per-response token and cost details, normalized usage in Pi's `/cost` totals, and an optional cumulative footer.
25
- - **Privacy controls** for conversation history, repository context, explicit file handoff, tool results, secret redaction, and outcome logging.
25
+ - **Privacy controls** for conversation history, repository context, explicit file and image handoff, tool results, secret redaction, and outcome logging.
26
+ - **Visual Advisor reviews** for supported PNG, JPEG, GIF, and WebP images in selected conversation or tool results when the Advisor model accepts images.
26
27
  - **Optional persistent activation, Simple mode, session summaries, and Herdr integration.**
27
28
  - **Compact searchable `/advisor-settings`** that matches Pi's settings list and saves changes immediately.
28
29
  - **Experimental Advisor Scout** that uses the configured Executor model to curate conversation evidence before every Advisor call.
@@ -40,7 +41,7 @@ Regular consultations never block execution. Automatic loop gates are different:
40
41
 
41
42
  ## Install
42
43
 
43
- Requires Pi 0.84.1 or later. Pi 0.85.0 is not supported (broken upstream release); use Pi 0.85.1 or later instead.
44
+ Requires Pi 0.87.1+ (0.87.x) or 0.99.1+ (0.99.x).
44
45
 
45
46
  ```bash
46
47
  pi install npm:pi-advisor-flow
@@ -70,7 +71,7 @@ Reload Pi after installing.
70
71
  /advisor-settings # Configure behavior, modes, etc.
71
72
  ```
72
73
 
73
- On first use, or whenever a saved model is unavailable, `/advisor` opens the same available-model picker as `/advisor-models`; it never silently chooses an unconfigured model. You can also enable the flow and select both models at once:
74
+ On first use, or whenever a saved model is unavailable, `/advisor` opens the same available-model picker as `/advisor-models`; it never silently chooses an unconfigured model. If the active Executor and Advisor use the same provider/model, calls and automatic gates are skipped with a notice; switching either model resumes consultations. Turn off **Disable same-model Advisor** in `/advisor-settings` (or set `"advisorDisableSameModel": false` globally) if you intentionally want a higher-effort review from that same model. You can also enable the flow and select both models at once:
74
75
 
75
76
  ```text
76
77
  /advisor executor=openai-codex/gpt-5.6-luna advisor=openai-codex/gpt-5.6-sol
@@ -108,7 +109,7 @@ Advisor Scout is off by default. When enabled in `/advisor-settings` or via `"ad
108
109
 
109
110
  ## Privacy
110
111
 
111
- Advisor requests can include user messages, tool calls, tool results, targeted questions, and repository information. Repository context is configurable from no access through changed-file summaries to a capped patch; when it is disabled, the Advisor is told so rather than shown an apparently clean tree. Explicit tracked and untracked file contents require separate global opt-ins and are sent as untrusted data. Secret redaction is off by default; when enabled, credential-shaped values in targeted questions are redacted before the provider request. Tools without an explicit policy use full context. Settings are global, so a project cannot silently change them.
112
+ Advisor requests can include user messages, tool calls, tool results, targeted questions, and repository information. Repository context is configurable from no access through changed-file summaries to a capped patch; when it is disabled, the Advisor is told so rather than shown an apparently clean tree. Images from disclosed conversation and full-policy tool results can be sent as pixels only to image-capable Advisor models; Scout sees markers, not pixels. Exact tracked and untracked image files can be attached using `includeTrackedFiles` and `includeUntracked` under their existing separate global consent rules. Images are limited to four and 8 MiB total, with a 4 MiB per-image cap; unsupported, missing, or oversized images are reported as withheld, not reviewed. Explicit tracked and untracked file contents require separate global opt-ins and are sent as untrusted data. Secret redaction is off by default; when enabled, credential-shaped values in targeted questions are redacted before the provider request. Tools without an explicit policy use full context. Settings are global, so a project cannot silently change them.
112
113
 
113
114
  When Scout is enabled, the Executor model provider also receives bounded Advisor-eligible conversation history. Read [Privacy and data handling](https://github.com/philipbrembeck/pi-advisor/blob/main/docs/privacy.md) before using pi-advisor with sensitive work.
114
115