pi-advisor-flow 0.9.2-dev.5 → 0.10.1-dev.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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,14 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
8
8
 
9
9
  ### Added
10
10
 
11
+ - Native Pi Codemode composition for `ask_advisor`: scripts receive structured advice, IDs, normalized usage, and existing skip metadata, while interactive responses remain unchanged. Documented deterministic-check composition and explicit draft disclosure limits.
12
+
13
+ ## 0.10.0 - 2026-10-02
14
+
15
+ ### Added
16
+
17
+ - Added an optional `advisorFallbackModel`, selectable from `/advisor-models` and `/advisor-settings`, that retries a failed primary Advisor request once while attributing the response to the model that answered.
18
+ - Added `followUpTo` support for short-lived, session-local Advisor follow-ups that reuse the original post-redaction payload prefix, enforce depth and conversation-advance limits, and render distinct usage status.
11
19
  - Added `/advisor-stats`, a local rendered report for retained outcome triggers, adoption, followed-versus-rejected validation pass rates, distinct pseudonymous advice hashes, and the capped ledger time window.
12
20
  - Added default-on, toggleable `AGENTS.md` context for trusted Advisor calls, with origin labels, redaction, byte caps, untrusted-rule framing, and explicit withholding for untrusted projects.
13
21
 
@@ -20,8 +28,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
20
28
 
21
29
  ### Changed
22
30
 
31
+ - Fallback retries count as one consultation against the shared Advisor budget; follow-ups count as one consultation each and require a new question without extra attachments or context overrides.
23
32
  - Pi 0.87.x and 0.99.x hosts are no longer supported; Pi 1.0.x is now the supported Pi host and the peer range is `^1.0.0`.
24
33
  - Updated the development toolchain to the Pi 1.0.0 packages.
34
+ - Updated the Node.js type definitions to 26.6.4.
25
35
 
26
36
  ## 0.9.1 - 2026-09-30
27
37
 
package/README.md CHANGED
@@ -20,6 +20,8 @@ Keep implementation on a fast model and borrow frontier reasoning only when deci
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
22
  - **Separate model and reasoning controls** for the Executor and Advisor, with same-model consultations skipped by default to avoid redundant calls.
23
+ - **Optional Advisor fallback model** that retries provider, auth, and availability failures once without consuming a second consultation budget slot.
24
+ - **Cached Advisor follow-ups** through `followUpTo`, reusing a short-lived, redacted payload prefix for focused questions.
23
25
  - **Model whitelist** that can restrict Advisor calls to exact `provider/model` Executor references.
24
26
  - **Advisor usage accounting** with per-response token and cost details, normalized usage in Pi's `/cost` totals, and an optional cumulative footer.
25
27
  - **Outcome reporting** through `/advisor-stats`, with adoption and validation comparisons over the retained ledger window.
@@ -68,7 +70,7 @@ Reload Pi after installing.
68
70
 
69
71
  ```text
70
72
  /advisor # Enable the Advisor Flow
71
- /advisor-models # Choose the Executor and Advisor models
73
+ /advisor-models # Choose the Executor, Advisor, and optional fallback models
72
74
  /advisor-settings # Configure behavior, modes, etc.
73
75
  /advisor-stats # Show retained outcome adoption and validation stats
74
76
  ```
@@ -87,13 +89,46 @@ In the Settings, enable Simple Mode for a quick start.
87
89
 
88
90
  Unknown fields in `advisor.json` are preserved for forward compatibility and reported as non-blocking warnings. Invalid recognized values fail their own Advisor call with a clear message instead of blocking every tool call.
89
91
 
92
+ ## Pi Codemode
93
+
94
+ With Pi Codemode enabled and the Advisor flow active, call the existing tool through `tools.ask_advisor`; no separate review tool or workflow is needed:
95
+
96
+ ```js
97
+ const commands = ["bun test", "bun run typecheck"];
98
+ const checks = await Promise.all(
99
+ commands.map(async (command) => {
100
+ const result = await tools.bash({ command });
101
+ return {
102
+ command,
103
+ exit_code: result.exit_code,
104
+ truncated: result.truncated,
105
+ };
106
+ })
107
+ );
108
+ return await tools.ask_advisor({
109
+ draft: JSON.stringify({
110
+ checks,
111
+ remainingRisk: "Runtime behavior needs review.",
112
+ }),
113
+ gitContext: "full",
114
+ });
115
+ ```
116
+
117
+ Gather and filter deterministic results before paying for Advisor reasoning. Nested results are not transcript entries, so they are not automatically available to reconstructed Advisor context. Use the existing `draft` for permitted, concise summaries (8 KiB after optional redaction); these remain untrusted Executor claims, not independently verified evidence. `question` can focus a specific decision; omit it for general reviews. Use `gitContext` for patches so the user's configured disclosure ceiling applies, rather than copying a diff into the draft.
118
+
119
+ Codemode receives `{ text, adviceId?, advisor?, followUp?, usage?, jev?, skipReason? }`. `text` preserves Advisor Markdown or the existing skip notice; `usage` is the same normalized snapshot shown in response details. Skipped calls have no new `adviceId`. Provider failures and blocked calls reject. Regular consultations never become loop-gate decisions. Interactive responses and usage accounting are unchanged.
120
+
121
+ Draft text is explicit disclosure: it does **not** inherit the policies of the tools that produced it. Do not copy excluded tool output, secrets, or unconsented file bodies into `draft` or `question`. Jev may also receive the draft when screening is enabled. See [Privacy and data handling](docs/privacy.md).
122
+
90
123
  ## Usage and accounting
91
124
 
92
- Advisor responses show provider-reported input, output, cache, and cost details when available. Successful `ask_advisor` calls also carry normalized usage into Pi's built-in `/cost` totals. Manual consultations and automatic gates keep their own session-local accounting instead, so nothing is double-counted. Missing or partial provider usage is shown as unavailable rather than fabricated as zero. `/advisor-settings` controls both the per-response details and the optional cumulative footer independently.
125
+ Advisor responses show provider-reported input, output, cache, and cost details when available. Successful `ask_advisor` calls also carry normalized usage into Pi's built-in `/cost` totals. Manual consultations and automatic gates keep their own session-local accounting instead, so nothing is double-counted. Missing or partial provider usage is shown as unavailable rather than fabricated as zero. `/advisor-settings` controls both the per-response details and the optional cumulative footer independently. Configure `advisorFallbackModel` or choose **Fallback Advisor model** in the model/settings pickers to retry one failed primary request; the final response is labelled with the model that answered, and both failures are shown together.
126
+
127
+ A follow-up reuses only the original post-redaction payload in memory. It expires after five minutes, is cleared by a new user turn or three subsequent non-Advisor tool results, and allows at most three chained follow-ups. Use a fresh consultation when it expires or when you need new repository context or attachments.
93
128
 
94
129
  `/advisor-stats` reads the local outcomes ledger and reports trigger counts, adoption, followed-versus-rejected validation pass rates, distinct pseudonymous advice hashes, and the retained time window. It never fabricates historical cost data; the ledger is capped at 1 MiB and rewritten on overflow.
95
130
 
96
- 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.
131
+ 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. A later `ask_advisor` call can pass that ID as `followUpTo` with a new question; the follow-up is counted once against the session budget and shows its responding model and follow-up status.
97
132
 
98
133
  ## Commands
99
134
 
@@ -101,8 +136,8 @@ Successful calls return an opaque `adviceId`. If global outcome logging is enabl
101
136
  | --- | --- |
102
137
  | `/advisor` | Enable the flow; choose available models when needed. |
103
138
  | `/advisor-manual [focus]` | Ask for an immediate second opinion. |
104
- | `/advisor-models` | Choose the Executor and Advisor models. |
105
- | `/advisor-settings` | Configure behavior, context, privacy, and limits. |
139
+ | `/advisor-models` | Choose the Executor, Advisor, and optional fallback models. |
140
+ | `/advisor-settings` | Configure behavior, models, context, privacy, and limits. |
106
141
  | `/advisor-stats` | Show retained outcome adoption and validation stats. |
107
142
  | `/advisor-off` | Disable the flow and persistent activation. |
108
143