pi-advisor-flow 0.13.2-dev.1 → 0.13.3-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 +6 -0
- package/README.md +1 -1
- package/dist/index.js +21 -17
- package/package.json +1 -1
- package/src/child-session.ts +6 -2
- package/src/commands/activation.ts +12 -9
- package/src/commands/lifecycle.ts +4 -0
- package/src/commands/model-options.ts +3 -3
- package/src/commands/model-picker.ts +12 -6
- package/src/config/storage.ts +4 -0
- package/src/scout-curation.ts +3 -2
- package/src/ui/types.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
8
8
|
|
|
9
9
|
### Changed
|
|
10
10
|
|
|
11
|
+
- The Executor now follows the model and thinking level of the current Pi session by default. `/advisor` no longer asks for or switches to an Executor model, and `/model` selections are not saved as the Executor. Pick an explicit Executor in `/advisor-models`, via `executor=` on `/advisor`, or in `advisor.json` to pin one; choose **Current session model** in `/advisor-models` to return to following the session.
|
|
12
|
+
|
|
13
|
+
## 0.13.2 - 2026-10-14
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
11
17
|
- Updated development dependencies: Pi packages to 1.2.0, Oxlint and plugins to 1.88.0, Oxfmt to 0.73.0, TypeBox to 1.3.37, and Ultracite to 8.0.1; adopted Ultracite 8's readable-spacing rule across the codebase and excluded the deliberately JSON-shaped benchmark `traps.toml` fixtures from Oxfmt's new TOML support.
|
|
12
18
|
|
|
13
19
|
## 0.13.1 - 2026-10-11
|
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Reload Pi after installing.
|
|
|
75
75
|
/advisor-stats # Show retained outcome adoption and validation stats
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
On first use, or whenever
|
|
78
|
+
The Executor is whichever model your Pi session is using; `/advisor` never switches it unless you pin one with `executor=` or `/advisor-models`. On first use, or whenever the saved Advisor is unavailable, `/advisor` opens the available-model picker; it never silently chooses an unconfigured Advisor. 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:
|
|
79
79
|
|
|
80
80
|
```text
|
|
81
81
|
/advisor executor=openai-codex/gpt-5.6-luna advisor=openai-codex/gpt-5.6-sol
|
package/dist/index.js
CHANGED
|
@@ -316,13 +316,14 @@ var splitRef = (ref) => {
|
|
|
316
316
|
|
|
317
317
|
// src/child-session.ts
|
|
318
318
|
var isMarkedSubagent = () => process.env.PI_SUBAGENT_CHILD === "1";
|
|
319
|
+
var followsSessionExecutor = () => isMarkedSubagent() || !executorRef;
|
|
319
320
|
var effectiveExecutorRef = (ctx) => {
|
|
320
|
-
if (
|
|
321
|
+
if (followsSessionExecutor() && ctx.model) {
|
|
321
322
|
return `${ctx.model.provider}/${ctx.model.id}`;
|
|
322
323
|
}
|
|
323
324
|
return executorRef;
|
|
324
325
|
};
|
|
325
|
-
var effectiveExecutorEffort = (ctx) => isMarkedSubagent() ? ctx.thinkingLevel : executorEffortRef;
|
|
326
|
+
var effectiveExecutorEffort = (ctx) => isMarkedSubagent() || !(executorRef || executorEffortRef) ? ctx.thinkingLevel : executorEffortRef;
|
|
326
327
|
|
|
327
328
|
// src/content-utils.ts
|
|
328
329
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -1184,6 +1185,7 @@ var saveConfig = (_ctx, options = {}) => {
|
|
|
1184
1185
|
}
|
|
1185
1186
|
loadedConfigState = nextLoadedState;
|
|
1186
1187
|
loadedConfigPath = path;
|
|
1188
|
+
setPersistedModelRefs(configuredModelRef(nextLoadedState.advisor), configuredModelRef(nextLoadedState.executor));
|
|
1187
1189
|
return path;
|
|
1188
1190
|
};
|
|
1189
1191
|
var saveGlobalOutcomeLogging = (enabled) => {
|
|
@@ -1342,8 +1344,8 @@ var getExplicitModelError = (ctx, ref, label, overridden, availableRefs) => {
|
|
|
1342
1344
|
}
|
|
1343
1345
|
};
|
|
1344
1346
|
var planActivationModels = (ctx, executor, advisor, pendingExecutorRef, persisted, executorOverride, advisorOverride, availableRefs) => {
|
|
1345
|
-
const pendingExecutor = !executorOverride && pendingExecutorRef && isSelectableModel(ctx, pendingExecutorRef, availableRefs) ? pendingExecutorRef : undefined;
|
|
1346
|
-
const executorConfigured = executorOverride || Boolean(pendingExecutor) ||
|
|
1347
|
+
const pendingExecutor = !executorOverride && persisted.executor && pendingExecutorRef && isSelectableModel(ctx, pendingExecutorRef, availableRefs) ? pendingExecutorRef : undefined;
|
|
1348
|
+
const executorConfigured = executorOverride || Boolean(pendingExecutor) || !persisted.executor || isSelectableModel(ctx, executor, availableRefs);
|
|
1347
1349
|
const advisorConfigured = advisorOverride || Boolean(persisted.advisor && isSelectableModel(ctx, advisor, availableRefs));
|
|
1348
1350
|
return {
|
|
1349
1351
|
pendingExecutor,
|
|
@@ -1551,6 +1553,7 @@ class SearchableModelSelector extends ModelSelectorAdapter {
|
|
|
1551
1553
|
|
|
1552
1554
|
// src/ui/types.ts
|
|
1553
1555
|
var FALLBACK_ADVISOR_MODEL_DISABLED = "Disabled (no fallback)";
|
|
1556
|
+
var EXECUTOR_FOLLOWS_SESSION_MODEL = "Current session model (no override)";
|
|
1554
1557
|
|
|
1555
1558
|
// src/commands/model-picker.ts
|
|
1556
1559
|
var selectAdvisorModels = async (ctx, options) => {
|
|
@@ -1574,8 +1577,8 @@ var selectAdvisorModels = async (ctx, options) => {
|
|
|
1574
1577
|
} = options;
|
|
1575
1578
|
if (options.selectExecutor) {
|
|
1576
1579
|
const selectedExecutor = await ctx.ui.custom((tui, theme, keybindings, done) => new SearchableModelSelector({
|
|
1577
|
-
allOptions,
|
|
1578
|
-
currentOption: executor ||
|
|
1580
|
+
allOptions: [EXECUTOR_FOLLOWS_SESSION_MODEL, ...allOptions],
|
|
1581
|
+
currentOption: executor || EXECUTOR_FOLLOWS_SESSION_MODEL,
|
|
1579
1582
|
keybindings,
|
|
1580
1583
|
onCancel: () => done(undefined),
|
|
1581
1584
|
onSelect: done,
|
|
@@ -1590,7 +1593,7 @@ var selectAdvisorModels = async (ctx, options) => {
|
|
|
1590
1593
|
if (!selectedExecutorEffort) {
|
|
1591
1594
|
return;
|
|
1592
1595
|
}
|
|
1593
|
-
executor = selectedExecutor;
|
|
1596
|
+
executor = selectedExecutor === EXECUTOR_FOLLOWS_SESSION_MODEL ? "" : selectedExecutor;
|
|
1594
1597
|
executorEffort = selectedEffort(selectedExecutorEffort);
|
|
1595
1598
|
}
|
|
1596
1599
|
if (options.selectAdvisor) {
|
|
@@ -1634,14 +1637,14 @@ var selectAdvisorModels = async (ctx, options) => {
|
|
|
1634
1637
|
return;
|
|
1635
1638
|
}
|
|
1636
1639
|
advisorFallbackModel = selectedFallback === FALLBACK_ADVISOR_MODEL_DISABLED ? undefined : selectedFallback;
|
|
1637
|
-
if (!
|
|
1640
|
+
if (!advisor) {
|
|
1638
1641
|
return;
|
|
1639
1642
|
}
|
|
1640
1643
|
return {
|
|
1641
1644
|
advisor,
|
|
1642
1645
|
advisorEffort,
|
|
1643
1646
|
advisorFallbackModel,
|
|
1644
|
-
executor,
|
|
1647
|
+
executor: executor ?? "",
|
|
1645
1648
|
executorEffort
|
|
1646
1649
|
};
|
|
1647
1650
|
};
|
|
@@ -3849,7 +3852,7 @@ var curateAdvisorConversation = async (ctx, legacyConversation, signal, onScout,
|
|
|
3849
3852
|
omittedBeforeScout: 0,
|
|
3850
3853
|
selectedCount: 0
|
|
3851
3854
|
},
|
|
3852
|
-
model:
|
|
3855
|
+
model: effectiveExecutorRef(ctx),
|
|
3853
3856
|
ok: false
|
|
3854
3857
|
};
|
|
3855
3858
|
onScout?.({ outcome: scout, type: "fallback" });
|
|
@@ -5448,11 +5451,9 @@ var resolveActivationModels = async (runtime, ctx, canContinue) => {
|
|
|
5448
5451
|
if (!canContinue()) {
|
|
5449
5452
|
return { cancelled: true };
|
|
5450
5453
|
}
|
|
5451
|
-
const executor = findConfiguredModel(ctx, executorRef);
|
|
5452
|
-
if (!executor) {
|
|
5453
|
-
return {
|
|
5454
|
-
error: executorRef ? `Executor model not found: ${executorRef}` : "Executor model not configured"
|
|
5455
|
-
};
|
|
5454
|
+
const executor = executorRef ? findConfiguredModel(ctx, executorRef) : undefined;
|
|
5455
|
+
if (executorRef && !executor) {
|
|
5456
|
+
return { error: `Executor model not found: ${executorRef}` };
|
|
5456
5457
|
}
|
|
5457
5458
|
const advisor = findConfiguredModel(ctx, advisorRef);
|
|
5458
5459
|
if (!advisor) {
|
|
@@ -5467,7 +5468,7 @@ var resolveActivationModels = async (runtime, ctx, canContinue) => {
|
|
|
5467
5468
|
if (!(advisorAuth.ok && advisorAuth.apiKey)) {
|
|
5468
5469
|
return { error: `No API key for Advisor ${advisorRef}` };
|
|
5469
5470
|
}
|
|
5470
|
-
if (!isMarkedSubagent() && !await runtime.setExecutorModel(executor)) {
|
|
5471
|
+
if (executor && !isMarkedSubagent() && !await runtime.setExecutorModel(executor)) {
|
|
5471
5472
|
return { error: `No API key for Executor ${executorRef}` };
|
|
5472
5473
|
}
|
|
5473
5474
|
return {};
|
|
@@ -5571,7 +5572,7 @@ var activateAdvisor = async (runtime, args, ctx, announce = true) => {
|
|
|
5571
5572
|
runtime.pi.setThinkingLevel(executorEffortRef);
|
|
5572
5573
|
}
|
|
5573
5574
|
setAdvisorToolsActive(runtime.pi, true);
|
|
5574
|
-
const activeModel =
|
|
5575
|
+
const activeModel = followsSessionExecutor() ? ctx.model : findConfiguredModel(ctx, executorRef);
|
|
5575
5576
|
runtime.updateSameModelNotice(ctx, activeModel);
|
|
5576
5577
|
if (announce) {
|
|
5577
5578
|
const activeExecutorRef = effectiveExecutorRef(ctx);
|
|
@@ -5614,6 +5615,9 @@ var registerCommandLifecycle = (runtime, activateAdvisor) => {
|
|
|
5614
5615
|
return;
|
|
5615
5616
|
}
|
|
5616
5617
|
const selected = `${event.model.provider}/${event.model.id}`;
|
|
5618
|
+
if (!getPersistedModelRefs().executor) {
|
|
5619
|
+
return;
|
|
5620
|
+
}
|
|
5617
5621
|
if (!runtime.flowEnabled()) {
|
|
5618
5622
|
runtime.pendingExecutorModelRef = selected;
|
|
5619
5623
|
return;
|
package/package.json
CHANGED
package/src/child-session.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { executorEffortRef, executorRef } from "./config/state.ts";
|
|
|
4
4
|
|
|
5
5
|
export const isMarkedSubagent = () => process.env.PI_SUBAGENT_CHILD === "1";
|
|
6
6
|
|
|
7
|
+
export const followsSessionExecutor = () => isMarkedSubagent() || !executorRef;
|
|
8
|
+
|
|
7
9
|
export const effectiveExecutorRef = (ctx: ExtensionContext) => {
|
|
8
|
-
if (
|
|
10
|
+
if (followsSessionExecutor() && ctx.model) {
|
|
9
11
|
return `${ctx.model.provider}/${ctx.model.id}`;
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -13,4 +15,6 @@ export const effectiveExecutorRef = (ctx: ExtensionContext) => {
|
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export const effectiveExecutorEffort = (ctx: ExtensionContext) =>
|
|
16
|
-
isMarkedSubagent()
|
|
18
|
+
isMarkedSubagent() || !(executorRef || executorEffortRef)
|
|
19
|
+
? ctx.thinkingLevel
|
|
20
|
+
: executorEffortRef;
|
|
@@ -3,6 +3,7 @@ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
|
3
3
|
import {
|
|
4
4
|
effectiveExecutorEffort,
|
|
5
5
|
effectiveExecutorRef,
|
|
6
|
+
followsSessionExecutor,
|
|
6
7
|
isMarkedSubagent,
|
|
7
8
|
} from "../child-session.ts";
|
|
8
9
|
import { parseArgs } from "../config/args.ts";
|
|
@@ -45,14 +46,12 @@ const resolveActivationModels = async (
|
|
|
45
46
|
return { cancelled: true };
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const executor =
|
|
49
|
+
const executor = executorRef
|
|
50
|
+
? findConfiguredModel(ctx, executorRef)
|
|
51
|
+
: undefined;
|
|
49
52
|
|
|
50
|
-
if (!executor) {
|
|
51
|
-
return {
|
|
52
|
-
error: executorRef
|
|
53
|
-
? `Executor model not found: ${executorRef}`
|
|
54
|
-
: "Executor model not configured",
|
|
55
|
-
};
|
|
53
|
+
if (executorRef && !executor) {
|
|
54
|
+
return { error: `Executor model not found: ${executorRef}` };
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
const advisor = findConfiguredModel(ctx, advisorRef);
|
|
@@ -75,7 +74,11 @@ const resolveActivationModels = async (
|
|
|
75
74
|
return { error: `No API key for Advisor ${advisorRef}` };
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
executor &&
|
|
79
|
+
!isMarkedSubagent() &&
|
|
80
|
+
!(await runtime.setExecutorModel(executor))
|
|
81
|
+
) {
|
|
79
82
|
return { error: `No API key for Executor ${executorRef}` };
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -260,7 +263,7 @@ export const activateAdvisor = async (
|
|
|
260
263
|
|
|
261
264
|
setAdvisorToolsActive(runtime.pi, true);
|
|
262
265
|
|
|
263
|
-
const activeModel =
|
|
266
|
+
const activeModel = followsSessionExecutor()
|
|
264
267
|
? ctx.model
|
|
265
268
|
: findConfiguredModel(ctx, executorRef);
|
|
266
269
|
|
|
@@ -70,6 +70,10 @@ export const registerCommandLifecycle = (
|
|
|
70
70
|
|
|
71
71
|
const selected = `${event.model.provider}/${event.model.id}`;
|
|
72
72
|
|
|
73
|
+
if (!getPersistedModelRefs().executor) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
if (!runtime.flowEnabled()) {
|
|
74
78
|
// Defer persistence until `/advisor` succeeds. This keeps ordinary model
|
|
75
79
|
// selection global defaults untouched when the flow is not enabled.
|
|
@@ -184,6 +184,7 @@ export const planActivationModels = (
|
|
|
184
184
|
): ActivationModelPlan => {
|
|
185
185
|
const pendingExecutor =
|
|
186
186
|
!executorOverride &&
|
|
187
|
+
persisted.executor &&
|
|
187
188
|
pendingExecutorRef &&
|
|
188
189
|
isSelectableModel(ctx, pendingExecutorRef, availableRefs)
|
|
189
190
|
? pendingExecutorRef
|
|
@@ -192,9 +193,8 @@ export const planActivationModels = (
|
|
|
192
193
|
const executorConfigured =
|
|
193
194
|
executorOverride ||
|
|
194
195
|
Boolean(pendingExecutor) ||
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
);
|
|
196
|
+
!persisted.executor ||
|
|
197
|
+
isSelectableModel(ctx, executor, availableRefs);
|
|
198
198
|
|
|
199
199
|
const advisorConfigured =
|
|
200
200
|
advisorOverride ||
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
|
|
3
3
|
import { SearchableModelSelector } from "../ui/model-selector.ts";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
EXECUTOR_FOLLOWS_SESSION_MODEL,
|
|
6
|
+
FALLBACK_ADVISOR_MODEL_DISABLED,
|
|
7
|
+
} from "../ui/types.ts";
|
|
5
8
|
import {
|
|
6
9
|
effortChoices,
|
|
7
10
|
getAvailableModelRefs,
|
|
@@ -66,8 +69,8 @@ export const selectAdvisorModels = async (
|
|
|
66
69
|
const selectedExecutor = await ctx.ui.custom<string | undefined>(
|
|
67
70
|
(tui, theme, keybindings, done) =>
|
|
68
71
|
new SearchableModelSelector({
|
|
69
|
-
allOptions,
|
|
70
|
-
currentOption: executor ||
|
|
72
|
+
allOptions: [EXECUTOR_FOLLOWS_SESSION_MODEL, ...allOptions],
|
|
73
|
+
currentOption: executor || EXECUTOR_FOLLOWS_SESSION_MODEL,
|
|
71
74
|
keybindings,
|
|
72
75
|
onCancel: () => done(undefined),
|
|
73
76
|
onSelect: done,
|
|
@@ -90,7 +93,10 @@ export const selectAdvisorModels = async (
|
|
|
90
93
|
return undefined;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
executor =
|
|
96
|
+
executor =
|
|
97
|
+
selectedExecutor === EXECUTOR_FOLLOWS_SESSION_MODEL
|
|
98
|
+
? ""
|
|
99
|
+
: selectedExecutor;
|
|
94
100
|
executorEffort = selectedEffort(selectedExecutorEffort);
|
|
95
101
|
}
|
|
96
102
|
|
|
@@ -155,7 +161,7 @@ export const selectAdvisorModels = async (
|
|
|
155
161
|
? undefined
|
|
156
162
|
: selectedFallback;
|
|
157
163
|
|
|
158
|
-
if (!
|
|
164
|
+
if (!advisor) {
|
|
159
165
|
return undefined;
|
|
160
166
|
}
|
|
161
167
|
|
|
@@ -163,7 +169,7 @@ export const selectAdvisorModels = async (
|
|
|
163
169
|
advisor,
|
|
164
170
|
advisorEffort,
|
|
165
171
|
advisorFallbackModel,
|
|
166
|
-
executor,
|
|
172
|
+
executor: executor ?? "",
|
|
167
173
|
executorEffort,
|
|
168
174
|
};
|
|
169
175
|
};
|
package/src/config/storage.ts
CHANGED
|
@@ -290,6 +290,10 @@ export const saveConfig = (
|
|
|
290
290
|
|
|
291
291
|
loadedConfigState = nextLoadedState;
|
|
292
292
|
loadedConfigPath = path;
|
|
293
|
+
setPersistedModelRefs(
|
|
294
|
+
configuredModelRef(nextLoadedState.advisor),
|
|
295
|
+
configuredModelRef(nextLoadedState.executor)
|
|
296
|
+
);
|
|
293
297
|
|
|
294
298
|
return path;
|
|
295
299
|
};
|
package/src/scout-curation.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { effectiveExecutorRef } from "./child-session.ts";
|
|
4
|
+
import { advisorScoutEnabledRef } from "./config/state.ts";
|
|
4
5
|
import {
|
|
5
6
|
buildScoutManifest,
|
|
6
7
|
reconstructScoutConversation,
|
|
@@ -53,7 +54,7 @@ export const curateAdvisorConversation = async (
|
|
|
53
54
|
omittedBeforeScout: 0,
|
|
54
55
|
selectedCount: 0,
|
|
55
56
|
},
|
|
56
|
-
model:
|
|
57
|
+
model: effectiveExecutorRef(ctx),
|
|
57
58
|
ok: false,
|
|
58
59
|
};
|
|
59
60
|
|
package/src/ui/types.ts
CHANGED
|
@@ -74,6 +74,9 @@ export interface ContextPreset {
|
|
|
74
74
|
|
|
75
75
|
export const FALLBACK_ADVISOR_MODEL_DISABLED = "Disabled (no fallback)";
|
|
76
76
|
|
|
77
|
+
export const EXECUTOR_FOLLOWS_SESSION_MODEL =
|
|
78
|
+
"Current session model (no override)";
|
|
79
|
+
|
|
77
80
|
export interface AdvisorSettings {
|
|
78
81
|
advisorToolsEnabled?: boolean;
|
|
79
82
|
agentsMdContext?: boolean;
|