pi-advisor-flow 0.17.1-dev.1 → 0.17.1-dev.2

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
@@ -10,6 +10,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
10
10
 
11
11
  - Added **Tracked file handoff** (`advisorTrackedFileHandoff`) in `/advisor-settings`. The default `advisor-named` keeps the current rule: `includeTrackedFiles` works only for files the latest Advisor answer names. `executor` lets the Executor attach tracked files on any consultation, without that extra round trip. Tracked file content consent, exact path checks, size limits, redaction, and untrusted-data labelling still apply.
12
12
 
13
+ ### Fixed
14
+
15
+ - Preserve session entries proposed by earlier `turn_end` handlers when appending Advisor budget feedback.
16
+ - Keep already-active Advisor tools in place during successful always-on activation so pending tools can still be restored.
17
+
13
18
  ### Changed
14
19
 
15
20
  - Updated development dependencies: Pi packages (`pi-ai`, `pi-coding-agent`, and `pi-tui`) to 1.6.0, Oxlint and plugins to 1.94.0, Bun types to 1.4.5, Knip to 6.47.0, lint-staged to 17.6.1, TypeBox to 1.4.7, and Ultracite to 8.3.1. Existing peer dependency ranges remain unchanged.
package/README.md CHANGED
@@ -84,7 +84,9 @@ The Executor is whichever model your Pi session is using unless you pin one with
84
84
  /advisor executor=openai-codex/gpt-5.6-luna advisor=openai-codex/gpt-5.6-sol
85
85
  ```
86
86
 
87
- From the Executor, `ask_advisor({})` requests a general review. A targeted `question` or concise `draft` can focus the review on a particular decision. Advisor log feedback is off by default; enable **Advisor log feedback** in `/advisor-settings` to include budget and Scout status messages in session logs. Actual Advisor call and result messages remain visible either way, and call limits and enforcement are unchanged. `/advisor-settings` can restrict this tool and every automatic Advisor gate to a whitelist of exact `provider/model` Executor references; an empty whitelist preserves the default of allowing every model.
87
+ From the Executor, `ask_advisor({})` requests a general review. A targeted `question` or concise `draft` can focus the review on a particular decision. Advisor log feedback is off by default; enable **Advisor log feedback** in `/advisor-settings` to include budget and Scout status messages in session logs. Budget feedback preserves session entries proposed by other extensions. Actual Advisor call and result messages remain visible either way, and call limits and enforcement are unchanged. `/advisor-settings` can restrict this tool and every automatic Advisor gate to a whitelist of exact `provider/model` Executor references; an empty whitelist preserves the default of allowing every model.
88
+
89
+ With **Always on**, successful automatic activation leaves already-active Advisor tools in place, so Pi can still restore deferred tools when they become available. If automatic activation fails, the Advisor tools are disabled.
88
90
 
89
91
  In the Settings, enable Simple Mode for a quick start.
90
92
 
package/dist/index.js CHANGED
@@ -5885,7 +5885,7 @@ ${t("activation.flow", "Advisor flow")} ${sameModelAdvisorDisabled(ctx, activeMo
5885
5885
  };
5886
5886
  var activateAdvisor = async (runtime, args, ctx, announce = true) => {
5887
5887
  if (!loadCommandConfig(ctx)) {
5888
- return;
5888
+ return false;
5889
5889
  }
5890
5890
  const { toolAvailabilityRevision } = runtime;
5891
5891
  const canContinue = () => runtime.toolAvailabilityRevision === toolAvailabilityRevision;
@@ -5899,22 +5899,22 @@ var activateAdvisor = async (runtime, args, ctx, announce = true) => {
5899
5899
  attempted = liveRefSnapshot();
5900
5900
  restoreRefs(attempted);
5901
5901
  notify(ctx, argumentError, "error");
5902
- return;
5902
+ return false;
5903
5903
  }
5904
5904
  const prepared = await prepareActivationModels(runtime, ctx, announce, executorOverride, advisorOverride, canContinue);
5905
5905
  if (!prepared) {
5906
5906
  attempted = liveRefSnapshot();
5907
5907
  restoreActivationRefsIfCurrent(canContinue, () => restoreRefs(attempted));
5908
- return;
5908
+ return false;
5909
5909
  }
5910
5910
  const { cancelled, error } = await resolveActivationModels(runtime, ctx, canContinue);
5911
5911
  if (cancelled || !canContinue()) {
5912
- return;
5912
+ return false;
5913
5913
  }
5914
5914
  if (error) {
5915
5915
  restoreRefs(attempted);
5916
5916
  notify(ctx, error, "error");
5917
- return;
5917
+ return false;
5918
5918
  }
5919
5919
  const sessionScoped = advisorActivationRef === "session";
5920
5920
  const reenableTools = !sessionScoped && !advisorToolsEnabledRef;
@@ -5923,7 +5923,7 @@ var activateAdvisor = async (runtime, args, ctx, announce = true) => {
5923
5923
  }
5924
5924
  const shouldSave = !sessionScoped && Boolean(args.trim() || prepared.pickedModels || reenableTools);
5925
5925
  if (!persistSuccessfulActivation(ctx, shouldSave, reenableTools, () => restoreRefs(liveRefSnapshot()))) {
5926
- return;
5926
+ return false;
5927
5927
  }
5928
5928
  if (executorEffortRef && !isMarkedSubagent()) {
5929
5929
  runtime.pi.setThinkingLevel(executorEffortRef);
@@ -5939,6 +5939,7 @@ var activateAdvisor = async (runtime, args, ctx, announce = true) => {
5939
5939
  if (announce) {
5940
5940
  announceActivation(ctx, activeModel);
5941
5941
  }
5942
+ return true;
5942
5943
  };
5943
5944
 
5944
5945
  // src/commands/configuration-tool.ts
@@ -6528,8 +6529,11 @@ var registerCommandLifecycle = (runtime, activateAdvisor) => {
6528
6529
  return;
6529
6530
  }
6530
6531
  if (alwaysOnRef) {
6531
- setAdvisorToolsActive(runtime.pi, false);
6532
- await activateAdvisor("", ctx, false);
6532
+ const { toolAvailabilityRevision } = runtime;
6533
+ const activated = await activateAdvisor("", ctx, false);
6534
+ if (!activated && runtime.toolAvailabilityRevision === toolAvailabilityRevision) {
6535
+ setAdvisorToolsActive(runtime.pi, false);
6536
+ }
6533
6537
  } else {
6534
6538
  runtime.updateSameModelNotice(ctx);
6535
6539
  }
@@ -7663,7 +7667,9 @@ var MODEL_SETTINGS = [
7663
7667
  var registerModelCommands = (runtime) => {
7664
7668
  runtime.pi.registerCommand("advisor", {
7665
7669
  description: "Enable the Executor/Advisor flow and switch to the configured or explicitly selected Executor model; accepts contextMaxChars=N",
7666
- handler: (args, ctx) => activateAdvisor(runtime, args, ctx)
7670
+ handler: async (args, ctx) => {
7671
+ await activateAdvisor(runtime, args, ctx);
7672
+ }
7667
7673
  });
7668
7674
  runtime.pi.registerCommand("advisor-models", {
7669
7675
  description: "Select and persist the Executor, Advisor, and optional fallback models with reasoning levels",
@@ -9759,7 +9765,10 @@ var advisorBudgetUpdate = (event, ctx, pi, session) => {
9759
9765
  return;
9760
9766
  }
9761
9767
  return {
9762
- entries: [{ ...message, type: "custom_message" }]
9768
+ entries: [
9769
+ ...event.entries ?? [],
9770
+ { ...message, type: "custom_message" }
9771
+ ]
9763
9772
  };
9764
9773
  };
9765
9774
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-advisor-flow",
3
- "version": "0.17.1-dev.1",
3
+ "version": "0.17.1-dev.2",
4
4
  "description": "Advanced Executor/Advisor flow for Pi, fully configurable and extendable.",
5
5
  "keywords": [
6
6
  "advisor",
@@ -209,9 +209,9 @@ export const activateAdvisor = async (
209
209
  args: string,
210
210
  ctx: ExtensionContext,
211
211
  announce = true
212
- ) => {
212
+ ): Promise<boolean> => {
213
213
  if (!loadCommandConfig(ctx)) {
214
- return;
214
+ return false;
215
215
  }
216
216
 
217
217
  const { toolAvailabilityRevision } = runtime;
@@ -234,7 +234,7 @@ export const activateAdvisor = async (
234
234
  restoreRefs(attempted);
235
235
  notify(ctx, argumentError, "error");
236
236
 
237
- return;
237
+ return false;
238
238
  }
239
239
 
240
240
  const prepared = await prepareActivationModels(
@@ -250,7 +250,7 @@ export const activateAdvisor = async (
250
250
  attempted = liveRefSnapshot();
251
251
  restoreActivationRefsIfCurrent(canContinue, () => restoreRefs(attempted));
252
252
 
253
- return;
253
+ return false;
254
254
  }
255
255
 
256
256
  const { cancelled, error } = await resolveActivationModels(
@@ -260,14 +260,14 @@ export const activateAdvisor = async (
260
260
  );
261
261
 
262
262
  if (cancelled || !canContinue()) {
263
- return;
263
+ return false;
264
264
  }
265
265
 
266
266
  if (error) {
267
267
  restoreRefs(attempted);
268
268
  notify(ctx, error, "error");
269
269
 
270
- return;
270
+ return false;
271
271
  }
272
272
 
273
273
  // Persist model changes only after both models are known and authenticated.
@@ -287,7 +287,7 @@ export const activateAdvisor = async (
287
287
  restoreRefs(liveRefSnapshot())
288
288
  )
289
289
  ) {
290
- return;
290
+ return false;
291
291
  }
292
292
 
293
293
  if (executorEffortRef && !isMarkedSubagent()) {
@@ -312,4 +312,6 @@ export const activateAdvisor = async (
312
312
  if (announce) {
313
313
  announceActivation(ctx, activeModel);
314
314
  }
315
+
316
+ return true;
315
317
  };
@@ -16,7 +16,7 @@ export type ActivateAdvisor = (
16
16
  args: string,
17
17
  ctx: ExtensionContext,
18
18
  announce?: boolean
19
- ) => Promise<void>;
19
+ ) => Promise<boolean>;
20
20
 
21
21
  export const registerCommandLifecycle = (
22
22
  runtime: CommandRuntime,
@@ -47,8 +47,15 @@ export const registerCommandLifecycle = (
47
47
  }
48
48
 
49
49
  if (alwaysOnRef) {
50
- setAdvisorToolsActive(runtime.pi, false);
51
- await activateAdvisor("", ctx, false);
50
+ const { toolAvailabilityRevision } = runtime;
51
+ const activated = await activateAdvisor("", ctx, false);
52
+
53
+ if (
54
+ !activated &&
55
+ runtime.toolAvailabilityRevision === toolAvailabilityRevision
56
+ ) {
57
+ setAdvisorToolsActive(runtime.pi, false);
58
+ }
52
59
  } else {
53
60
  runtime.updateSameModelNotice(ctx);
54
61
  }
@@ -32,7 +32,9 @@ export const registerModelCommands = (runtime: CommandRuntime) => {
32
32
  runtime.pi.registerCommand("advisor", {
33
33
  description:
34
34
  "Enable the Executor/Advisor flow and switch to the configured or explicitly selected Executor model; accepts contextMaxChars=N",
35
- handler: (args, ctx) => activateAdvisor(runtime, args, ctx),
35
+ handler: async (args, ctx) => {
36
+ await activateAdvisor(runtime, args, ctx);
37
+ },
36
38
  });
37
39
 
38
40
  runtime.pi.registerCommand("advisor-models", {
@@ -65,6 +65,9 @@ export const advisorBudgetUpdate = (
65
65
  }
66
66
 
67
67
  return {
68
- entries: [{ ...message, type: "custom_message" as const }],
68
+ entries: [
69
+ ...(event.entries ?? []),
70
+ { ...message, type: "custom_message" as const },
71
+ ],
69
72
  };
70
73
  };