@restranger/repi-advisor 0.0.0-stage → 0.0.1-1a48fc0
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 +89 -2
- package/package.json +44 -5
- package/src/advisor-ui.ts +1117 -0
- package/src/command.ts +169 -0
- package/src/config.ts +302 -0
- package/src/context.ts +62 -0
- package/src/execute.ts +355 -0
- package/src/handlers.ts +73 -0
- package/src/index.ts +31 -0
- package/src/inventory.ts +99 -0
- package/src/messages.ts +64 -0
- package/src/pi-compat.ts +90 -0
- package/src/plugin.ts +22 -0
- package/src/policy.ts +49 -0
- package/src/prompt.ts +16 -0
- package/src/register.ts +74 -0
- package/src/restore.ts +168 -0
- package/src/state.ts +36 -0
- package/src/types.ts +57 -0
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @restranger/repi-advisor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Advisor strategy pattern for Pi Coding Agent (`@earendil-works/pi-coding-agent`).
|
|
4
|
+
|
|
5
|
+
Enables the primary executor model to escalate its entire conversation to a second, stronger reviewer model (the advisor) and receive back a concrete plan, a correction, or a stop signal — then keep going.
|
|
6
|
+
|
|
7
|
+
Includes first-class integration with **model fallback chains** (`@restranger/repi-model-fallback`) and **subagents** (`@restranger/repi-subagents`).
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Zero-parameter `advisor` tool**: The executor calls `advisor()` with no manual copying. The entire conversation context is serialized and forwarded.
|
|
12
|
+
- **Model Fallback Chain**: If the primary advisor model is unavailable (rate-limited, overloaded, error, quota exhausted), it automatically falls back to secondary advisor models.
|
|
13
|
+
- **Subagents Integration**: The advisor is informed of all declared declarative subagents via `@restranger/repi-lib`'s `re:subagents@1` contract and can instruct the executor to delegate specialized tasks (e.g. `Explore`, `Plan`, `verification`).
|
|
14
|
+
- **Service Seam Integration**: Publishes `re:advisor@1` (`AdvisorService`), allowing `@restranger/repi-model-fallback` to manage and persist advisor fallback models in the unified `/fallback` menu.
|
|
15
|
+
- **Dynamic Policy & Blocklist**: Automatically hides or shows the `advisor` tool based on the executor's active model and reasoning level (`disabledForModels`).
|
|
16
|
+
- **Interactive TUI Picker**: Clean native TUI menu for selecting the advisor model, reasoning effort, and fallback chains.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
pi install npm:@restranger/repi-advisor
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
Run the `/advisor` command to open the interactive setup picker:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/advisor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Pick an advisor model and (if supported) the reasoning effort level. The tool becomes active immediately.
|
|
33
|
+
|
|
34
|
+
### Slash Commands
|
|
35
|
+
|
|
36
|
+
- `/advisor` — Open interactive configuration menu. It renders like Pi's native pickers (`/models`,
|
|
37
|
+
`/scoped-models`, `ctx.ui.select`): an inline frame in the editor slot, a `→ ` cursor, muted
|
|
38
|
+
descriptions and a key-hint line.
|
|
39
|
+
- **Settings roster**: Lists `Model`, `Reasoning effort`, and `Fallback models`, with a preview of
|
|
40
|
+
the fallback chain below.
|
|
41
|
+
- **Model picker**: Press `Enter` on `Model` to select an advisor model with fuzzy search, or pick
|
|
42
|
+
`No advisor` to disable it.
|
|
43
|
+
- **Effort picker**: Press `Enter` on `Reasoning effort` to pick a reasoning effort level (`model default`,
|
|
44
|
+
`minimal`, `low`, `medium`, `high (recommended)`, `xhigh`, `max`).
|
|
45
|
+
- **Fallback picker**: Press `Enter` on `Fallback models` to open a multi-select picker modelled on
|
|
46
|
+
`/scoped-models`: `Enter` toggles a model, `Ctrl+A`/`Ctrl+X` enable or clear the list, `Ctrl+P`
|
|
47
|
+
toggles provider, and `Alt+↑/↓` reorders the chain (`#n` rank).
|
|
48
|
+
- Press `Ctrl+S` (or `s` in settings) to save. Settings are written to the user config
|
|
49
|
+
(`<agentDir>/extensions/repi-advisor.json`) so they work before trust; a trusted project that already
|
|
50
|
+
owns a config is updated in place.
|
|
51
|
+
- Press `q` or `Esc` to close (or back from a picker).
|
|
52
|
+
- `/advisor status` — Inspect the active advisor model, reasoning effort, fallback chain, and subagents integration status.
|
|
53
|
+
- `/advisor list` — List all available models suitable for acting as advisor.
|
|
54
|
+
- `/advisor off` — Disable the advisor tool.
|
|
55
|
+
- `/advisor model <provider/id>` — Quickly switch the advisor model.
|
|
56
|
+
- `/advisor effort <minimal|low|medium|high|xhigh|max|off>` — Set reasoning effort.
|
|
57
|
+
- `/advisor fallback <model1,model2,...>` — Set the fallback chain for the advisor.
|
|
58
|
+
|
|
59
|
+
## Fallback Integration
|
|
60
|
+
|
|
61
|
+
When `@restranger/repi-model-fallback` is installed, the unified `/fallback` command automatically detects the advisor through the `re:advisor@1` contract. You can configure fallback chains for the Main Agent, the Advisor, and Subagents in a single interface.
|
|
62
|
+
|
|
63
|
+
## Subagents Integration
|
|
64
|
+
|
|
65
|
+
When `@restranger/repi-subagents` is installed, the advisor model receives the current roster of available subagents in its prompt context. If a complex multi-step task arises, the advisor will guide the executor to launch relevant subagents.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
Settings are saved in `$PI_CODING_AGENT_DIR/extensions/repi-advisor.json` (default
|
|
70
|
+
`~/.pi/agent/extensions/repi-advisor.json`); a trusted project can own `.pi/extensions/repi-advisor.json`.
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"version": 1,
|
|
75
|
+
"modelKey": "anthropic/claude-3-7-sonnet",
|
|
76
|
+
"effort": "high",
|
|
77
|
+
"fallbackModels": [
|
|
78
|
+
"openai/gpt-4o",
|
|
79
|
+
"google/gemini-2.5-pro"
|
|
80
|
+
],
|
|
81
|
+
"disabledForModels": [
|
|
82
|
+
"anthropic/claude-3-7-sonnet",
|
|
83
|
+
{ "model": "openai/gpt-4.5-preview", "minEffort": "high" }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@restranger/repi-advisor",
|
|
3
|
+
"version": "0.0.1-1a48fc0",
|
|
4
|
+
"description": "Advisor strategy pattern for pi-coding-agent with model fallback and subagents integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"types": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"files": ["src", "README.md", "!src/**/__tests__"],
|
|
12
|
+
"keywords": ["pi-package", "pi-coding-agent", "advisor", "model-fallback", "subagents", "tui"],
|
|
13
|
+
"author": "ReStranger <restranger@disroot.org>",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/ReStranger/repi-mono.git",
|
|
18
|
+
"directory": "packages/advisor"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/ReStranger/repi-mono/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/ReStranger/repi-mono#readme",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"pi": {
|
|
28
|
+
"extensions": ["./src/index.ts"]
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@restranger/repi-lib": "0.0.1-1a48fc0",
|
|
32
|
+
"@restranger/repi-ui": "0.0.1-1a48fc0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@earendil-works/pi-coding-agent": ">=0.79.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@earendil-works/pi-coding-agent": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@restranger/repi-test-utils": "0.0.1-1a48fc0"
|
|
44
|
+
}
|
|
45
|
+
}
|