pi-advisor-flow 0.1.9 → 0.2.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/README.md CHANGED
@@ -68,13 +68,13 @@ Saves and persists your configuration to `~/.pi/agent/advisor.json`.
68
68
 
69
69
  The Executor can call `ask_advisor` with an empty object for a general review of the current task and conversation, or provide `question` for targeted feedback. The Advisor is a brief second opinion: the Executor investigates and forms its own candidate direction first, then uses the Advisor to challenge assumptions and validate a consequential next step. It should not delegate the entire plan or task.
70
70
 
71
- Advisor responses use a structured verdict: `proceed`, `revise`, `insufficient-evidence`, or `blocked`. A `blocked` verdict is reserved for critical escalation. When critical blocking is enabled (the default), it aborts the active run and marks the Pi pane blocked in Herdr.
71
+ Normal Advisor consultations return the provider's final Markdown unchanged. They never parse JSON, synthesize a verdict, or block Executor work. Only automatic loop gates use machine-readable decisions: the first non-empty line must be `Decision: proceed`, `Decision: revise`, or `Decision: blocked`; malformed, missing, duplicate, or contradictory decisions are explicit gate failures.
72
72
 
73
73
  ### Automatic loop gate
74
74
 
75
- When enabled, the loop gate consults the Advisor after the configured number of consecutive equivalent tool calls (default: three). A `proceed` verdict resets the repetition counter and allows the call. `revise` and `insufficient-evidence` stop only the repeated call and deliver the Advisor guidance to the Executor. A critical `blocked` verdict, an Advisor failure, or an exhausted Advisor-call budget blocks the session and reports that state to Herdr.
75
+ When enabled, the loop gate consults the Advisor after the configured number of consecutive calls with the same normalized tool signature (default: three). A `proceed` decision resets the repetition counter and allows the call. `revise` blocks only the repeated tool action; `blocked` can block the session according to the configured policy. Gate failures default to `block-session` and may be changed to `block-tool` or `warn-and-continue`. Normalization is allowlisted: object keys are deterministic, arrays retain order, and only volatile IDs/timestamps, temporary paths, and safe shell whitespace are normalized.
76
76
 
77
- The maximum Advisor calls per session defaults to unlimited. When set to a finite value, the Executor receives the remaining-call count in its system instructions. The optional Session Advisor Summary is local, in-memory only, and appears after a non-blocked settled run; it is never persisted or sent to Herdr.
77
+ Every manual, Executor-requested, and automatic Advisor invocation consumes one shared session budget. The default is unlimited; a finite budget appears as used/remaining in the Executor instructions and local summary. The optional Session Advisor Summary is local, in-memory only, and appears after a non-blocked settled run; it is never persisted or sent to Herdr. It separates Markdown advice from gate decisions and records trigger, model, usage/cost when available, failure, budget, and execution effect.
78
78
 
79
79
  ### Context configuration
80
80
 
@@ -82,10 +82,10 @@ The selected configuration is saved as `advisor.json` in the Pi agent directory
82
82
 
83
83
  ```json
84
84
  {
85
- "executor": "aikeys/claude-sonnet-5",
86
- "advisor": "aikeys/claude-fable-5",
87
- "executorEffort": "high",
88
- "advisorEffort": "high",
85
+ "executor": "openai/gpt-5.6-luna",
86
+ "advisor": "anthropic/claude-fable-5",
87
+ "executorEffort": "medium",
88
+ "advisorEffort": "xhigh",
89
89
  "contextMaxChars": 25000,
90
90
  "advisorPlanGate": true,
91
91
  "advisorFailureGate": true,
@@ -96,13 +96,17 @@ The selected configuration is saved as `advisor.json` in the Pi agent directory
96
96
  "advisorAutoLoopGate": true,
97
97
  "advisorLoopThreshold": 3,
98
98
  "advisorMaxCallsPerSession": 5,
99
- "advisorSessionSummary": true
99
+ "advisorSessionSummary": true,
100
+ "gateFailureMode": "block-session",
101
+ "advisorHerdrIntegration": true,
102
+ "advisorToolResultMaxLines": 2000,
103
+ "advisorToolResultMaxBytes": 51200
100
104
  }
101
105
  ```
102
106
 
103
- All fields are optional. `executor`, `advisor`, and their effort settings are managed by `/advisor-models`. `/advisor-settings` manages `advisorEffort`, `contextMaxChars`, the three invocation-gate booleans, `advisorCollapseResponses`, `advisorCustomInvocation`, `advisorBlockOnBlocked`, `advisorAutoLoopGate`, `advisorLoopThreshold`, `advisorMaxCallsPerSession`, and `advisorSessionSummary`.
107
+ All fields are optional. `executor`, `advisor`, and their effort settings are managed by `/advisor-models`. `/advisor-settings` manages `advisorEffort`, `contextMaxChars`, the three invocation-gate booleans, `advisorCollapseResponses`, `advisorCustomInvocation`, `advisorBlockOnBlocked`, `advisorAutoLoopGate`, `advisorLoopThreshold`, `advisorMaxCallsPerSession`, `advisorSessionSummary`, `gateFailureMode`, `advisorHerdrIntegration`, and the tool-result line/byte limits.
104
108
 
105
- `contextMaxChars` must be a non-negative safe integer: its default is 15,000, `0` omits history, and `9007199254740991` means ALL. `advisorLoopThreshold` must be at least `2` and defaults to `3`. Omit `advisorMaxCallsPerSession` for an unlimited session budget; otherwise it must be a non-negative safe integer. Critical blocking, the automatic loop gate, and the Session Advisor Summary default to `true`.
109
+ `contextMaxChars` is a soft character budget: it preserves complete semantic entries and adds an older-context omission marker rather than starting mid-message. Its default is 15,000, `0` omits history, and `9007199254740991` means ALL. Oversized tool results default to Pi's 2,000-line/50 KiB limits and preserve beginning/end sections with an omission marker; `advisorToolResultMaxLines` and `advisorToolResultMaxBytes` override them. `advisorLoopThreshold` must be at least `2` and defaults to `3`. Omit `advisorMaxCallsPerSession` for an unlimited shared budget; otherwise it must be a non-negative safe integer. `gateFailureMode` accepts `block-session`, `block-tool`, or `warn-and-continue`, defaulting to `block-session`. Herdr integration and the notification/activity/blocked metadata paths default to enabled; failure notifications use sanitized `notification.show` requests and can be disabled with `advisorHerdrIntegration`. Critical blocking, the automatic loop gate, and the Session Advisor Summary default to `true`. Unknown or invalid configuration keys fail at startup with the file, key, accepted values, and remediation; save operations preserve unknown fields.
106
110
 
107
111
  ### `/advisor-off`
108
112
 
@@ -110,7 +114,7 @@ Disables the Advisor flow, removing the `ask_advisor` tool from the active sessi
110
114
 
111
115
  ## Publishing releases
112
116
 
113
- Pushing a version tag (`vX.Y.Z`) runs the release workflow. It verifies that the tag matches `package.json`, type-checks, tests, then publishes:
117
+ CI manages `vX.Y.Z` release tags from the version in `package.json`; contributors must not create or push release tags manually. The release workflow verifies the version, type-checks, tests, and then publishes:
114
118
 
115
119
  - `pi-advisor-flow` to [npm](https://www.npmjs.com/package/pi-advisor-flow)
116
120
  - `@philipbrembeck/pi-advisor-flow` to GitHub Packages, which makes the package appear in this repository’s **Packages** sidebar
@@ -1,6 +1,22 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { registerAdvisorTool } from "../src/tools.js";
3
2
  import { registerCommands } from "../src/commands.js";
3
+ import { registerAdvisorTool } from "../src/tools.js";
4
+
5
+ export type { AdvisorConfig, GateFailureMode } from "../src/config.js";
6
+ export type {
7
+ AdvisorConsultationResult,
8
+ AdvisorGateFailure,
9
+ AdvisorGateOutcome,
10
+ AdvisorGateResult,
11
+ ConsultationTrigger,
12
+ GateDecision,
13
+ GateTrigger,
14
+ } from "../src/tools.js";
15
+ export {
16
+ consultAdvisor,
17
+ parseAutomaticDecision,
18
+ runAdvisorGate,
19
+ } from "../src/tools.js";
4
20
 
5
21
  export default function (pi: ExtensionAPI) {
6
22
  registerAdvisorTool(pi);
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
+ "devDependencies": {
3
+ "@earendil-works/pi-ai": "^0.80.7",
4
+ "@earendil-works/pi-coding-agent": "^0.80.7",
5
+ "@earendil-works/pi-tui": "^0.80.7",
6
+ "@types/node": "^20.11.0",
7
+ "bun-types": "^1.0.0",
8
+ "typebox": "^1.1.38",
9
+ "typescript": "^5.3.3",
10
+ "ultracite": "7.9.4",
11
+ "@biomejs/biome": "2.5.3"
12
+ },
2
13
  "name": "pi-advisor-flow",
3
- "version": "0.1.9",
14
+ "peerDependencies": {
15
+ "@earendil-works/pi-ai": "^0.80.7",
16
+ "@earendil-works/pi-coding-agent": "^0.80.7",
17
+ "@earendil-works/pi-tui": "^0.80.7",
18
+ "typebox": "^1.1.38"
19
+ },
20
+ "scripts": {
21
+ "test": "bun test",
22
+ "typecheck": "tsc --noEmit",
23
+ "format": "bunx ultracite fix --linter-enabled=false",
24
+ "package:check": "npm pack --dry-run --json >/dev/null"
25
+ },
26
+ "type": "module",
27
+ "version": "0.2.0",
4
28
  "license": "MIT",
5
29
  "repository": {
6
30
  "type": "git",
@@ -9,7 +33,6 @@
9
33
  "homepage": "https://github.com/philipbrembeck/pi-advisor",
10
34
  "author": "Philip Brembeck",
11
35
  "description": "Advanced Executor/Advisor flow for Pi, fully configurable and extendable.",
12
- "type": "module",
13
36
  "main": "extensions/index.ts",
14
37
  "types": "extensions/index.ts",
15
38
  "keywords": [
@@ -30,24 +53,5 @@
30
53
  "./extensions/index.ts"
31
54
  ],
32
55
  "image": "https://raw.githubusercontent.com/philipbrembeck/pi-advisor/refs/heads/main/assets/hero.png"
33
- },
34
- "scripts": {
35
- "test": "bun test",
36
- "typecheck": "tsc --noEmit"
37
- },
38
- "peerDependencies": {
39
- "@earendil-works/pi-ai": "^0.80.7",
40
- "@earendil-works/pi-coding-agent": "^0.80.7",
41
- "@earendil-works/pi-tui": "^0.80.7",
42
- "typebox": "^1.1.38"
43
- },
44
- "devDependencies": {
45
- "@earendil-works/pi-ai": "^0.80.7",
46
- "@earendil-works/pi-coding-agent": "^0.80.7",
47
- "@earendil-works/pi-tui": "^0.80.7",
48
- "typebox": "^1.1.38",
49
- "@types/node": "^20.11.0",
50
- "bun-types": "^1.0.0",
51
- "typescript": "^5.3.3"
52
56
  }
53
57
  }