pi-advisor-flow 0.3.6 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,44 @@ 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.html).
6
6
 
7
+ ## 0.5.0
8
+
9
+ ### Changed
10
+
11
+ - Updated the development toolchain and Pi compatibility packages, including TypeScript 7, Node.js 26 type definitions, Pi 0.84.4 packages, and Bun 1.3.14 validation.
12
+
13
+ ### Added
14
+
15
+ - Added a centered TUI overlay for `/advisor-manual` with an editable prefilled focus message, optional general review, a Git context selector bounded by the configured disclosure ceiling, and live Scout/Advisor progress without duplicate footer status text; non-TUI invocations remain immediate.
16
+ - Reworked `/advisor-settings` into a compact Pi-style searchable settings list with fuzzy search, arrow-key value adjustment, and immediate persistence for every valid change.
17
+ - Restored the animated Simple mode indicator and added a context-depth meter spanning recent history to the complete branch at `ALL`.
18
+ - Added enabled-by-default per-response usage detail display plus an independent, opt-in `showUsageFooter` setting for cumulative Advisor footer usage; both are presentation-only and do not change usage accounting.
19
+
20
+ ### Performance
21
+
22
+ - Coalesced Advisor streaming UI updates to roughly 10–12 refreshes per second while flushing the latest partial state immediately on completion or error.
23
+
24
+ ### Fixed
25
+
26
+ - Fixed `/advisor-settings` context-meter alignment and numeric controls so custom max-call limits advance to the next numeric option.
27
+ - Made blocked automatic-gate decisions honor the configured session, tool, or warning behavior.
28
+ - Allowed failed local Advisor outcome writes to be retried without consuming the advice.
29
+
30
+ ## 0.4.0
31
+
32
+ ### Added
33
+
34
+ - Exposed provider-reported Advisor and Scout token/cache/cost details per result, tracked cumulative direct Advisor usage in the session footer and optional summary, and attached normalized `ask_advisor` usage to Pi's built-in cost totals without double-counting manual consultations or automatic gates.
35
+
36
+ ### Removed
37
+
38
+ - Removed the repository-only Benchmark suite and its benchmark-specific telemetry instrumentation.
39
+
40
+ ### Fixed
41
+
42
+ - Kept Scout's serialized manifest limit separate from the Advisor conversation budget so required context does not fall back solely because of manifest metadata overhead.
43
+ - Made unlimited Advisor call budgets live at every enforcement boundary, preventing stale finite limits from triggering false Herdr budget notifications after switching to unlimited.
44
+
7
45
  ## 0.3.6
8
46
 
9
47
  ### Fixed
package/README.md CHANGED
@@ -21,8 +21,10 @@ The idea is simple: keep implementation on a fast model and borrow frontier reas
21
21
  - **Configurable review gates** before plans, after repeated failures, and before declaring completion.
22
22
  - **Automatic loop detection** for repeated tool calls, with explicit proceed, revise, or blocked decisions.
23
23
  - **Separate model and reasoning controls** for the Executor and Advisor.
24
+ - **Advisor usage accounting** with per-response token/cost details and optional cumulative direct usage in the Pi footer and session summary. Per-response usage and cost details are shown by default and can be hidden independently from the footer in `/advisor-settings`.
24
25
  - **Privacy controls** for conversation history, repository context, explicit tracked/untracked file handoff, tool results, secret redaction, and outcome logging.
25
26
  - **Optional persistent activation, Simple mode, session summaries, and Herdr integration.**
27
+ - **Compact searchable `/advisor-settings` controls** that match Pi's settings list and save changes immediately.
26
28
  - **EXPERIMENTAL Advisor Scout** that uses the configured Executor model to curate conversation evidence before every Advisor call.
27
29
 
28
30
  ## Install
@@ -46,7 +48,7 @@ Restart or reload Pi after installation.
46
48
 
47
49
  1. Run `/advisor` to enable the flow and register `ask_advisor`.
48
50
  2. Run `/advisor-models` to choose the Executor and Advisor models. Current model and thinking-level selections appear first and ticked, so pressing Enter keeps them.
49
- 3. Run `/advisor-settings` to configure review gates, context, privacy, and limits.
51
+ 3. Run `/advisor-settings` to configure review gates, context, privacy, and limits. Type to fuzzy-search settings; changes save immediately.
50
52
 
51
53
  ![Advisor Settings](https://raw.githubusercontent.com/philipbrembeck/pi-advisor/refs/heads/main/assets/settings.png)
52
54
 
@@ -55,7 +57,7 @@ Unknown fields in `advisor.json` are preserved for forward compatibility and rep
55
57
  You can also enable the flow and select both models at once:
56
58
 
57
59
  ```text
58
- /advisor executor=anthropic/claude-sonnet-5 advisor=openai/gpt-5.6-sol
60
+ /advisor executor=openai-codex/gpt-5.6-luna advisor=openai-codex/gpt-5.6-sol
59
61
  ```
60
62
 
61
63
  ## How it works
@@ -68,15 +70,17 @@ You can also enable the flow and select both models at once:
68
70
 
69
71
  A normal consultation never blocks execution. The optional automatic loop gate is different: it evaluates repeated tool calls and applies the configured failure policy when the Advisor says to revise, reports a block, is unavailable, or returns an invalid decision.
70
72
 
73
+ Advisor responses show provider-reported input, output, cache, and cost details when available. Successful `ask_advisor` tool results also carry normalized usage into Pi's built-in `Tools/summaries` and `/cost` totals. Manual consultations and automatic gates remain in the separate session-local direct Advisor accounting because they are custom messages, so they are not double-counted in Pi's Executor totals. Missing or partial provider usage is shown as unavailable rather than fabricated as zero usage. `/advisor-settings` independently controls per-response usage details and the cumulative Advisor footer without disabling this accounting; the footer is off by default.
74
+
71
75
  Successful calls return an opaque `adviceId`. If global outcome logging is enabled, the Executor can call `record_advisor_outcome` once to record whether the advice was adopted and whether final validation passed.
72
76
 
73
77
  ### Experimental Advisor Scout
74
78
 
75
79
  Experimental Advisor Scout is off by default. Enable `Experimental Advisor Scout` in the advanced `/advisor-settings` screen or set `"advisorScoutEnabled": true` in the global `advisor.json`.
76
80
 
77
- Scout runs before `ask_advisor`, `/advisor-manual`, and automatic Advisor gates. It uses the configured Executor model and Executor reasoning effort in a separate model call. This adds cost and latency, but can reduce cost in the Advisor call. The compact result shows the model, selection counts, and elapsed time; `Ctrl+O` shows bounded selected labels and the synthesis.
81
+ Scout runs before `ask_advisor`, `/advisor-manual`, and automatic Advisor gates. It uses the configured Executor model and Executor reasoning effort in a separate model call. This adds cost and latency, but can reduce cost in the Advisor call. The compact result shows the model, selection counts, elapsed time, and usage/cost details; `Ctrl+O` shows bounded selected labels and the synthesis. Usage and cost details can be hidden in `/advisor-settings`.
78
82
 
79
- Scout receives a bounded manifest of conversation and tool-history groups after the normal tool disclosure, result-cap, and redaction policies are applied. The manifest and reconstructed Scout conversation share the Advisor's remaining context budget after repository context; a zero remaining budget produces no history groups. For a pending `ask_advisor` call, Scout receives only the allowlisted question and Git-context preference, never the draft or explicit attachment paths. Scout does not receive the deterministic Git context, draft, project preferences, or explicit tracked and untracked attachments. Those regions are appended later through their existing consent and cap rules.
83
+ Scout receives a bounded manifest of conversation and tool-history groups after the normal tool disclosure, result-cap, and redaction policies are applied. The Scout manifest has its own fixed transport limit, while the reconstructed conversation remains bounded by the Advisor's remaining context budget after repository context; manifest metadata no longer consumes that Advisor conversation budget. A zero remaining budget produces no history groups. For a pending `ask_advisor` call, Scout receives only the allowlisted question and Git-context preference, never the draft or explicit attachment paths. Scout does not receive the deterministic Git context, draft, project preferences, or explicit tracked and untracked attachments. Those regions are appended later through their existing consent and cap rules.
80
84
 
81
85
  This experiment adapts the context-boundary idea from Zhang et al., ["FastContext: Training Efficient Repository Explorer for Coding Agents"](https://arxiv.org/html/2606.14066v1). It is not a reproduction of FastContext. pi-advisor Scout curates conversation history only.
82
86
 
@@ -85,11 +89,13 @@ This experiment adapts the context-boundary idea from Zhang et al., ["FastContex
85
89
  | Command | Purpose |
86
90
  | --- | --- |
87
91
  | `/advisor` | Enable the flow and optionally override the Executor, Advisor, or context limit. |
88
- | `/advisor-manual [focus]` | Start a parallel consultation without interrupting the current Executor turn; shows progress in the footer. |
92
+ | `/advisor-manual [focus]` | Open a TUI form for a parallel consultation, or consult immediately in non-TUI modes; shows progress in the footer. |
89
93
  | `/advisor-models` | Choose both models and their reasoning effort; current models are preselected. |
90
94
  | `/advisor-settings` | Configure behavior, context, gates, privacy, and output limits. |
91
95
  | `/advisor-off` | Disable the flow and turn off persistent activation. |
92
96
 
97
+ In the interactive TUI, `/advisor-manual [focus]` opens a centered overlay. The optional focus text is prefilled and editable; Enter submits, Shift+Enter inserts a newline, Tab/Shift+Tab moves focus, and Escape cancels. The form lets you choose the permitted Git context level, with choices above the configured ceiling hidden. `None` withholds Git data only; it does not remove configured conversation history. After submission, the call, Scout, and Advisor streaming progress appear immediately in the transcript. Canceling has no consultation side effects. RPC, print, and JSON invocations retain their immediate argument-driven behavior.
98
+
93
99
  The Executor calls `ask_advisor({})` for a general review. It can pass a targeted `question` or a concise `draft` describing proposed work, validation, and remaining risks. If the Advisor explicitly says it cannot review a specifically named file, the Executor may make a sequential follow-up call with `includeTrackedFiles` when global consent is enabled and the file is relevant. Draft claims give the Advisor review context; they are not verification evidence.
94
100
 
95
101
  ## What gets sent to the Advisor
@@ -2,7 +2,6 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { registerCommands } from "../src/commands.js";
3
3
  import { setHerdrBlockedEmitter } from "../src/herdr.js";
4
4
  import { AdvisorSessionState } from "../src/session-state.js";
5
- import { createBenchmarkTelemetry } from "../src/telemetry.js";
6
5
  import {
7
6
  consultAdvisor as consultAdvisorImplementation,
8
7
  parseAutomaticDecision as parseAutomaticDecisionImplementation,
@@ -37,20 +36,11 @@ export default function (pi: ExtensionAPI) {
37
36
  setHerdrBlockedEmitter((active, label) =>
38
37
  pi.events.emit("herdr:blocked", { active, label })
39
38
  );
40
- const benchmarkTelemetry = createBenchmarkTelemetry(pi.events);
41
- if (benchmarkTelemetry) {
42
- // Diagnostics only: never rewrite provider payloads or affect production sessions.
43
- pi.on("before_provider_request", (event) => {
44
- benchmarkTelemetry.providerRequest(event.payload);
45
- });
46
- }
47
39
  registerAdvisorTool(pi, sessionState, {
48
40
  statusManager: scoutStatus,
49
- telemetry: benchmarkTelemetry,
50
41
  });
51
42
  registerCommands(pi, {
52
43
  sessionState,
53
44
  statusManager: scoutStatus,
54
- telemetry: benchmarkTelemetry,
55
45
  });
56
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-advisor-flow",
3
- "version": "0.3.6",
3
+ "version": "0.5.0",
4
4
  "description": "Advanced Executor/Advisor flow for Pi, fully configurable and extendable.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -28,8 +28,6 @@
28
28
  "README.md"
29
29
  ],
30
30
  "scripts": {
31
- "benchmark": "bun benchmarks/src/cli.ts",
32
- "benchmark:report": "bun benchmarks/src/cli.ts report",
33
31
  "format": "bunx ultracite fix --linter-enabled=false",
34
32
  "lint": "bunx ultracite check",
35
33
  "lint:fix": "bunx ultracite fix",
@@ -46,17 +44,17 @@
46
44
  "undici": "8.9.0"
47
45
  },
48
46
  "devDependencies": {
49
- "@biomejs/biome": "2.5.8",
50
- "@earendil-works/pi-ai": "^0.84.2",
51
- "@earendil-works/pi-coding-agent": "^0.84.2",
52
- "@earendil-works/pi-tui": "^0.84.2",
53
- "@types/node": "^20.11.0",
54
- "bun-types": "^1.0.0",
47
+ "@biomejs/biome": "2.5.11",
48
+ "@earendil-works/pi-ai": "^0.84.4",
49
+ "@earendil-works/pi-coding-agent": "^0.84.4",
50
+ "@earendil-works/pi-tui": "^0.84.4",
51
+ "@types/node": "^26.4.0",
52
+ "bun-types": "1.3.14",
55
53
  "husky": "^9.1.7",
56
- "lint-staged": "^17.3.0",
57
- "typebox": "^1.3.14",
58
- "typescript": "^5.3.3",
59
- "ultracite": "7.10.4"
54
+ "lint-staged": "^17.4.1",
55
+ "typebox": "^1.3.21",
56
+ "typescript": "^7.0.2",
57
+ "ultracite": "7.10.7"
60
58
  },
61
59
  "peerDependencies": {
62
60
  "@earendil-works/pi-ai": "^0.84.1",