pi-advisor-flow 0.15.1-dev.2 → 0.15.2-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.
Files changed (71) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +16 -1
  3. package/dist/index.js +1157 -502
  4. package/docs/README.md +9 -0
  5. package/docs/benchmark.md +22 -0
  6. package/docs/configuration.md +194 -0
  7. package/docs/development.md +38 -0
  8. package/docs/herdr.md +169 -0
  9. package/docs/privacy.md +102 -0
  10. package/extensions/index.ts +23 -0
  11. package/locales/de.json +330 -0
  12. package/locales/en.json +331 -0
  13. package/locales/es.json +3 -0
  14. package/locales/fr.json +330 -0
  15. package/locales/pt-BR.json +3 -0
  16. package/locales/pt.json +3 -0
  17. package/locales/ru.json +3 -0
  18. package/locales/uk.json +3 -0
  19. package/locales/zh.json +3 -0
  20. package/package.json +15 -2
  21. package/skills/pi-advisor-flow/SKILL.md +62 -0
  22. package/src/commands/activation-preparation.ts +9 -2
  23. package/src/commands/activation.ts +28 -8
  24. package/src/commands/configuration-tool-models.ts +143 -0
  25. package/src/commands/configuration-tool-policy.ts +177 -0
  26. package/src/commands/configuration-tool-preview.ts +228 -0
  27. package/src/commands/configuration-tool-runtime.ts +40 -0
  28. package/src/commands/configuration-tool-transaction.ts +120 -0
  29. package/src/commands/configuration-tool-update.ts +230 -0
  30. package/src/commands/configuration-tool.ts +89 -0
  31. package/src/commands/lifecycle.ts +6 -1
  32. package/src/commands/manual-consultation.ts +6 -1
  33. package/src/commands/manual-progress.ts +4 -3
  34. package/src/commands/model-commands.ts +2 -1
  35. package/src/commands/model-options.ts +4 -6
  36. package/src/commands/model-picker.ts +16 -6
  37. package/src/commands/registration.ts +2 -0
  38. package/src/commands/runtime.ts +17 -4
  39. package/src/commands/settings-commands.ts +30 -7
  40. package/src/config/schema-validators.ts +104 -0
  41. package/src/config/schema.ts +35 -102
  42. package/src/config/storage.ts +160 -7
  43. package/src/i18n.ts +31 -0
  44. package/src/scout-group-serialization.ts +66 -0
  45. package/src/scout-groups.ts +3 -66
  46. package/src/scout-selection.ts +99 -0
  47. package/src/scout.ts +6 -93
  48. package/src/session-state.ts +27 -137
  49. package/src/tool-input-normalization.ts +119 -0
  50. package/src/tools/gate-policy.ts +13 -5
  51. package/src/tools/jev-filter.ts +2 -1
  52. package/src/tools/jev-turn-gate.ts +2 -1
  53. package/src/tools/register-lifecycle.ts +5 -1
  54. package/src/tools/register-outcome.ts +5 -1
  55. package/src/tools/register-renderers.ts +5 -2
  56. package/src/tools/render-advisor-result.ts +20 -8
  57. package/src/tools/render-common.ts +16 -4
  58. package/src/tools/scout-status.ts +10 -2
  59. package/src/ui/jev-classifier-submenu.ts +143 -38
  60. package/src/ui/jev-filter-submenu.ts +52 -14
  61. package/src/ui/jev-provider-submenu-view.ts +72 -20
  62. package/src/ui/jev-provider-submenu.ts +40 -12
  63. package/src/ui/jev-setup-support.ts +48 -19
  64. package/src/ui/manual-dialog-render.ts +71 -25
  65. package/src/ui/searchable-model-list.ts +18 -4
  66. package/src/ui/settings-formatting.ts +5 -2
  67. package/src/ui/settings-items-jev.ts +216 -0
  68. package/src/ui/settings-items.ts +216 -259
  69. package/src/ui/settings-selector.ts +9 -2
  70. package/src/ui/text-setting-submenu.ts +8 -1
  71. package/src/usage.ts +9 -3
@@ -0,0 +1,230 @@
1
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { getAdvisorSettings, setContextMaxCharsRef } from "../config/state.ts";
4
+ import {
5
+ configPaths,
6
+ loadConfig,
7
+ readGlobalAdvisorConfig,
8
+ rebaseConfigBaseline,
9
+ } from "../config/storage.ts";
10
+ import type { JsonValue } from "../content-utils.ts";
11
+ import { resolveModelChanges } from "./configuration-tool-models.ts";
12
+ import type { SelectAdvisorModels } from "./configuration-tool-models.ts";
13
+ import {
14
+ addAdvisorConfigDependencies,
15
+ getAdvisorConfigSnapshot,
16
+ validateAdvisorConfigPatch,
17
+ } from "./configuration-tool-policy.ts";
18
+ import {
19
+ effectiveChanges,
20
+ summarizeAdvisorConfigPatch,
21
+ } from "./configuration-tool-preview.ts";
22
+ import {
23
+ applyAdvisorConfigRuntimeSettings,
24
+ cancelledAdvisorConfigResult,
25
+ unchangedAdvisorConfigResult,
26
+ } from "./configuration-tool-runtime.ts";
27
+ import {
28
+ confirmAdvisorConfigUpdate,
29
+ persistAdvisorConfigUpdate,
30
+ } from "./configuration-tool-transaction.ts";
31
+ import type { PreparedAdvisorConfigUpdate } from "./configuration-tool-transaction.ts";
32
+ import type { CommandRuntime } from "./types.ts";
33
+
34
+ const prepareAdvisorConfigUpdate = async (
35
+ ctx: ExtensionContext,
36
+ input: JsonValue | undefined,
37
+ selectModels?: SelectAdvisorModels
38
+ ): Promise<PreparedAdvisorConfigUpdate | undefined> => {
39
+ const existing = readGlobalAdvisorConfig();
40
+ const before = getAdvisorConfigSnapshot();
41
+ const beforeSettings = getAdvisorSettings();
42
+ const [, configPath] = configPaths(ctx);
43
+
44
+ if (!configPath) {
45
+ throw new Error("Could not resolve the global Advisor configuration path.");
46
+ }
47
+
48
+ if (input === undefined) {
49
+ throw new TypeError("Provide Advisor settings changes for action=update.");
50
+ }
51
+
52
+ if (
53
+ !validateAdvisorConfigPatch(input, Boolean(existing.advisorJevClassifier))
54
+ ) {
55
+ throw new TypeError("Advisor settings changes must be a JSON object.");
56
+ }
57
+
58
+ const initialChanges = input;
59
+
60
+ if (
61
+ Object.hasOwn(initialChanges, "advisorOutcomeLogging") &&
62
+ Object.keys(initialChanges).length > 1
63
+ ) {
64
+ throw new Error(
65
+ "Update advisorOutcomeLogging by itself so its separate consent path remains clear."
66
+ );
67
+ }
68
+
69
+ const changesWithModels = await resolveModelChanges(
70
+ ctx,
71
+ initialChanges,
72
+ before,
73
+ existing,
74
+ selectModels
75
+ );
76
+
77
+ if (!changesWithModels) {
78
+ return undefined;
79
+ }
80
+
81
+ const changes = addAdvisorConfigDependencies(changesWithModels);
82
+
83
+ return {
84
+ before,
85
+ beforeSettings,
86
+ configPath,
87
+ existing,
88
+ proposed: effectiveChanges(changes, existing),
89
+ };
90
+ };
91
+
92
+ const appliedAdvisorConfigResult = (
93
+ prepared: PreparedAdvisorConfigUpdate,
94
+ savedPath: string
95
+ ) => {
96
+ const notices: string[] = [];
97
+
98
+ if (
99
+ Object.hasOwn(prepared.proposed, "alwaysOn") &&
100
+ prepared.proposed.alwaysOn === true
101
+ ) {
102
+ notices.push(
103
+ "Always on applies to future sessions; this did not start an Advisor call."
104
+ );
105
+ }
106
+
107
+ if (Object.hasOwn(prepared.proposed, "executor")) {
108
+ notices.push(
109
+ prepared.proposed.executor === null
110
+ ? "The Executor pin was removed; it now follows the current Pi session model."
111
+ : "Executor model selection is saved; run /advisor to activate it in this session."
112
+ );
113
+ }
114
+
115
+ return {
116
+ content: [
117
+ {
118
+ text: [
119
+ `Saved Advisor settings to ${savedPath}.`,
120
+ summarizeAdvisorConfigPatch(
121
+ prepared.proposed,
122
+ prepared.before,
123
+ prepared.existing
124
+ ),
125
+ ...notices,
126
+ ].join("\n"),
127
+ type: "text" as const,
128
+ },
129
+ ],
130
+ details: {
131
+ action: "update",
132
+ applied: true,
133
+ changes: prepared.proposed,
134
+ saved: true,
135
+ },
136
+ };
137
+ };
138
+
139
+ const savedButNotAppliedResult = (
140
+ prepared: PreparedAdvisorConfigUpdate,
141
+ savedPath: string,
142
+ message: string
143
+ ) => ({
144
+ content: [
145
+ {
146
+ text: `Advisor settings were saved to ${savedPath}, but could not be fully applied to the current session: ${message}`,
147
+ type: "text" as const,
148
+ },
149
+ ],
150
+ details: {
151
+ action: "update",
152
+ applied: false,
153
+ changes: prepared.proposed,
154
+ saved: true,
155
+ },
156
+ });
157
+
158
+ const applyAdvisorConfigUpdate = (
159
+ runtime: CommandRuntime,
160
+ ctx: ExtensionContext,
161
+ prepared: PreparedAdvisorConfigUpdate,
162
+ savedPath: string
163
+ ) => {
164
+ try {
165
+ loadConfig(ctx);
166
+
167
+ if (
168
+ !Object.hasOwn(prepared.proposed, "contextMaxChars") &&
169
+ prepared.before.contextMaxChars !== undefined
170
+ ) {
171
+ setContextMaxCharsRef(prepared.before.contextMaxChars);
172
+ rebaseConfigBaseline();
173
+ }
174
+
175
+ applyAdvisorConfigRuntimeSettings(runtime, ctx, prepared.beforeSettings);
176
+ } catch (error) {
177
+ const message = error instanceof Error ? error.message : String(error);
178
+
179
+ return savedButNotAppliedResult(prepared, savedPath, message);
180
+ }
181
+
182
+ return appliedAdvisorConfigResult(prepared, savedPath);
183
+ };
184
+
185
+ export const executeAdvisorConfigUpdate = async (
186
+ runtime: CommandRuntime,
187
+ ctx: ExtensionContext,
188
+ input: JsonValue | undefined,
189
+ signal?: AbortSignal,
190
+ selectModels?: SelectAdvisorModels
191
+ ) => {
192
+ if (!ctx.hasUI) {
193
+ throw new Error(
194
+ "Advisor setting updates require an interactive confirmation. Use Pi's TUI or RPC UI; no settings were changed."
195
+ );
196
+ }
197
+
198
+ const prepared = await prepareAdvisorConfigUpdate(ctx, input, selectModels);
199
+
200
+ if (!prepared) {
201
+ return cancelledAdvisorConfigResult(
202
+ "Model selection cancelled; no settings changed."
203
+ );
204
+ }
205
+
206
+ if (Object.keys(prepared.proposed).length === 0) {
207
+ return unchangedAdvisorConfigResult(
208
+ "Advisor settings already match the request."
209
+ );
210
+ }
211
+
212
+ if (!(await confirmAdvisorConfigUpdate(ctx, prepared, signal))) {
213
+ return cancelledAdvisorConfigResult(
214
+ "Update cancelled; no settings changed."
215
+ );
216
+ }
217
+
218
+ let savedPath: string;
219
+
220
+ try {
221
+ savedPath = await persistAdvisorConfigUpdate(prepared, signal);
222
+ } catch (error) {
223
+ const message = error instanceof Error ? error.message : String(error);
224
+ throw new Error(`Advisor settings were not saved: ${message}`, {
225
+ cause: error,
226
+ });
227
+ }
228
+
229
+ return applyAdvisorConfigUpdate(runtime, ctx, prepared, savedPath);
230
+ };
@@ -0,0 +1,89 @@
1
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { Text } from "@earendil-works/pi-tui";
3
+ import { Type } from "typebox";
4
+
5
+ import { readGlobalAdvisorConfig } from "../config/storage.ts";
6
+ import { textFrom } from "../conversation.ts";
7
+ import type { SelectAdvisorModels } from "./configuration-tool-models.ts";
8
+ import { getAdvisorConfigForAgent } from "./configuration-tool-policy.ts";
9
+ import { executeAdvisorConfigUpdate } from "./configuration-tool-update.ts";
10
+ import type { CommandRuntime } from "./types.ts";
11
+
12
+ const CONFIGURATION_VALUE = Type.Union([
13
+ Type.String(),
14
+ Type.Number(),
15
+ Type.Boolean(),
16
+ Type.Null(),
17
+ Type.Array(Type.String()),
18
+ Type.Record(Type.String(), Type.String()),
19
+ ]);
20
+
21
+ const CONFIGURATION_TOOL_PARAMETERS = Type.Object(
22
+ {
23
+ action: Type.String({ enum: ["read", "update"] }),
24
+ changes: Type.Optional(Type.Record(Type.String(), CONFIGURATION_VALUE)),
25
+ },
26
+ { additionalProperties: false }
27
+ );
28
+
29
+ const readCurrentConfig = (ctx: ExtensionContext) => {
30
+ const config = getAdvisorConfigForAgent(readGlobalAdvisorConfig());
31
+
32
+ const currentSessionModel = ctx.model
33
+ ? `${ctx.model.provider}/${ctx.model.id}`
34
+ : null;
35
+
36
+ return {
37
+ ...config,
38
+ currentSessionModel,
39
+ scope: "global",
40
+ };
41
+ };
42
+
43
+ export interface AdvisorConfigurationToolDependencies {
44
+ selectModels?: SelectAdvisorModels;
45
+ }
46
+
47
+ export const registerAdvisorConfigurationTool = (
48
+ runtime: CommandRuntime,
49
+ dependencies: AdvisorConfigurationToolDependencies = {}
50
+ ) => {
51
+ runtime.pi.registerTool({
52
+ description:
53
+ "Read or update pi-advisor settings at the user's request. Start with action=read to inspect current effective settings, persisted global overrides, and writable keys. For action=update, pass a sparse changes object using exact keys from writableKeys; use null to remove a saved override and restore the extension default. Every changing update previews global old-to-new values and requires user confirmation. Model settings open the existing interactive model picker; supplied model strings are proposed selections, not approval. Jev classifier/credential setup must use /advisor-settings, and outcome logging must be changed by itself through its dedicated consent path.",
54
+ async execute(_id, params, signal, _onUpdate, ctx) {
55
+ if (params.action === "read") {
56
+ if (params.changes) {
57
+ throw new Error("Do not pass changes with action=read.");
58
+ }
59
+
60
+ const settings = readCurrentConfig(ctx);
61
+
62
+ return {
63
+ content: [{ text: JSON.stringify(settings, null, 2), type: "text" }],
64
+ details: { action: "read", applied: false, settings },
65
+ };
66
+ }
67
+
68
+ return await executeAdvisorConfigUpdate(
69
+ runtime,
70
+ ctx,
71
+ params.changes,
72
+ signal,
73
+ dependencies.selectModels
74
+ );
75
+ },
76
+ executionMode: "sequential",
77
+ label: "Configure Advisor",
78
+ name: "advisor_config",
79
+ parameters: CONFIGURATION_TOOL_PARAMETERS,
80
+ promptGuidelines: [
81
+ "Use advisor_config when the user asks to inspect or change pi-advisor settings. Read before updates when the current value affects the requested outcome.",
82
+ "Send only settings the user asked to change. advisor_config asks for confirmation before writing and preserves unrelated settings; do not edit advisor.json directly.",
83
+ "Wait for advisor_config to report a successful update before saying a setting changed. Use /advisor-settings for Jev classifier/credential setup.",
84
+ ],
85
+ promptSnippet: "Read or change the user's pi-advisor configuration",
86
+ renderCall: () => new Text("[advisor] Configure settings", 0, 0),
87
+ renderResult: (result) => new Text(textFrom(result.content), 0, 0),
88
+ });
89
+ };
@@ -9,6 +9,7 @@ import {
9
9
  setExecutorRef,
10
10
  } from "../config/state.ts";
11
11
  import { loadConfig, saveConfig } from "../config/storage.ts";
12
+ import { t } from "../i18n.ts";
12
13
  import { setAdvisorToolsActive } from "./advisor-tools.ts";
13
14
  import { notify } from "./runtime.ts";
14
15
  import type { CommandRuntime } from "./types.ts";
@@ -48,7 +49,11 @@ export const registerCommandLifecycle = (
48
49
  } catch (error) {
49
50
  setAdvisorToolsActive(runtime.pi, false);
50
51
  const message = error instanceof Error ? error.message : String(error);
51
- notify(ctx, `Advisor activation failed: ${message}`, "error");
52
+ notify(
53
+ ctx,
54
+ `${t("notify.activationFailed.prefix", "Advisor activation failed:")} ${message}`,
55
+ "error"
56
+ );
52
57
  }
53
58
  });
54
59
 
@@ -4,6 +4,7 @@ import { advisorRef } from "../config/state.ts";
4
4
  import { isString } from "../content-utils.ts";
5
5
  import type { GitContextLevel } from "../git.ts";
6
6
  import { notifyHerdrAdvisorFailure } from "../herdr.ts";
7
+ import { t } from "../i18n.ts";
7
8
  import { normalizeScreeningQuestion } from "../tools/jev-filter.ts";
8
9
  import { appendScoutLifecycleEntry } from "../tools/scout-status.ts";
9
10
  import type { ScoutToolDetails } from "../tools/types.ts";
@@ -186,7 +187,11 @@ export const startManualConsultation = async (
186
187
  },
187
188
  { deliverAs: "steer", triggerTurn: !isPrintMode }
188
189
  );
189
- notify(ctx, `Advisor consultation failed: ${message}`, "error");
190
+ notify(
191
+ ctx,
192
+ `${t("manualCmd.consultFailed.prefix", "Advisor consultation failed:")} ${message}`,
193
+ "error"
194
+ );
190
195
  notifyHerdrAdvisorFailure("Advisor consultation failed", message);
191
196
  } finally {
192
197
  finishHerdrActivity();
@@ -3,6 +3,7 @@ import type { Theme } from "@earendil-works/pi-coding-agent";
3
3
  import { Markdown, Text } from "@earendil-works/pi-tui";
4
4
  import type { Component } from "@earendil-works/pi-tui";
5
5
 
6
+ import { t } from "../i18n.ts";
6
7
  import {
7
8
  adviceForDisplay,
8
9
  noop,
@@ -68,12 +69,12 @@ export class ManualAdvisorProgressComponent implements Component {
68
69
  const frame =
69
70
  SPINNER_FRAMES[Math.floor(Date.now() / 80) % SPINNER_FRAMES.length];
70
71
 
71
- let status = "Working…";
72
+ let status = t("manualProgress.working", "Working…");
72
73
 
73
74
  if (this.state.phase === "preparing") {
74
- status = "Preparing…";
75
+ status = t("manualProgress.preparing", "Preparing…");
75
76
  } else if (this.state.text?.trim()) {
76
- status = "Responding…";
77
+ status = t("manualProgress.responding", "Responding…");
77
78
  }
78
79
 
79
80
  box.addChild(
@@ -12,6 +12,7 @@ import {
12
12
  setExecutorRef,
13
13
  } from "../config/state.ts";
14
14
  import { saveConfig } from "../config/storage.ts";
15
+ import { t } from "../i18n.ts";
15
16
  import { loadCommandConfig } from "./activation-preparation.ts";
16
17
  import { activateAdvisor } from "./activation.ts";
17
18
  import { selectAdvisorModels } from "./model-picker.ts";
@@ -67,7 +68,7 @@ export const registerModelCommands = (runtime: CommandRuntime) => {
67
68
  runtime.pendingExecutorModelRef = undefined;
68
69
  runtime.updateSameModelNotice(ctx);
69
70
  ctx.ui.notify(
70
- `Saved Executor + Advisor configurations to ${path}`,
71
+ `${t("notify.modelsSaved.prefix", "Saved Executor + Advisor configurations to")} ${path}`,
71
72
  "info"
72
73
  );
73
74
  },
@@ -2,6 +2,7 @@ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
 
3
3
  import { splitRef } from "../config/state.ts";
4
4
  import type { getPersistedModelRefs } from "../config/state.ts";
5
+ import { t } from "../i18n.ts";
5
6
  import type { ContextPreset } from "../ui/types.ts";
6
7
 
7
8
  export const DEFAULT_EFFORT_LEVEL = "Default (Model Default)";
@@ -35,9 +36,6 @@ export const selectedEffort = (choice: string): string | undefined => {
35
36
  return effort === DEFAULT_EFFORT_LEVEL ? undefined : effort;
36
37
  };
37
38
 
38
- export const ADVISOR_ACTIVATION_EXPLANATION =
39
- "The Advisor is a second-opinion model that reviews the Executor's context and returns risks, alternatives, and verification steps without changing files or running tools.";
40
-
41
39
  const ARGUMENT_WHITESPACE = /\s+/u;
42
40
 
43
41
  const hasModelOverride = (args: string, key: "advisor" | "executor") =>
@@ -153,15 +151,15 @@ export const getExplicitModelError = (
153
151
  ) => {
154
152
  if (overridden) {
155
153
  if (!ref) {
156
- return `${label} model not configured`;
154
+ return `${label} ${t("activation.modelNotConfigured", "model not configured")}`;
157
155
  }
158
156
 
159
157
  if (!findConfiguredModel(ctx, ref)) {
160
- return `${label} model not found: ${ref}`;
158
+ return `${label} ${t("activation.modelNotFound.prefix", "model not found:")} ${ref}`;
161
159
  }
162
160
 
163
161
  if (availableRefs && !isSelectableModel(ctx, ref, availableRefs)) {
164
- return `${label} model unavailable: ${ref}`;
162
+ return `${label} ${t("activation.modelUnavailable.prefix", "model unavailable:")} ${ref}`;
165
163
  }
166
164
  }
167
165
  };
@@ -1,5 +1,6 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
 
3
+ import { t } from "../i18n.ts";
3
4
  import { SearchableModelSelector } from "../ui/model-selector.ts";
4
5
  import {
5
6
  EXECUTOR_FOLLOWS_SESSION_MODEL,
@@ -41,7 +42,10 @@ export const selectAdvisorModels = async (
41
42
 
42
43
  if (refs && refs.length === 0) {
43
44
  ctx.ui.notify(
44
- "No selectable models are available. Configure a provider with /login or models.json, then retry.",
45
+ t(
46
+ "notify.noSelectableModels.message",
47
+ "No selectable models are available. Configure a provider with /login or models.json, then retry."
48
+ ),
45
49
  "error"
46
50
  );
47
51
 
@@ -75,7 +79,7 @@ export const selectAdvisorModels = async (
75
79
  onCancel: () => done(undefined),
76
80
  onSelect: done,
77
81
  theme,
78
- title: "Select Executor Model",
82
+ title: t("modelPicker.selectExecutor", "Select Executor Model"),
79
83
  tui,
80
84
  })
81
85
  );
@@ -85,7 +89,10 @@ export const selectAdvisorModels = async (
85
89
  }
86
90
 
87
91
  const selectedExecutorEffort = await ctx.ui.select(
88
- "Select Executor Reasoning/Thinking Level",
92
+ t(
93
+ "modelPicker.executorEffort",
94
+ "Select Executor Reasoning/Thinking Level"
95
+ ),
89
96
  effortChoices(executorEffort)
90
97
  );
91
98
 
@@ -110,7 +117,7 @@ export const selectAdvisorModels = async (
110
117
  onCancel: () => done(undefined),
111
118
  onSelect: done,
112
119
  theme,
113
- title: "Select Advisor Model",
120
+ title: t("modelPicker.selectAdvisor", "Select Advisor Model"),
114
121
  tui,
115
122
  })
116
123
  );
@@ -120,7 +127,7 @@ export const selectAdvisorModels = async (
120
127
  }
121
128
 
122
129
  const selectedAdvisorEffort = await ctx.ui.select(
123
- "Select Advisor Reasoning/Thinking Level",
130
+ t("modelPicker.advisorEffort", "Select Advisor Reasoning/Thinking Level"),
124
131
  effortChoices(advisorEffort)
125
132
  );
126
133
 
@@ -147,7 +154,10 @@ export const selectAdvisorModels = async (
147
154
  onCancel: () => done(undefined),
148
155
  onSelect: done,
149
156
  theme,
150
- title: "Select Fallback Advisor Model (optional)",
157
+ title: t(
158
+ "modelPicker.selectFallbackAdvisor",
159
+ "Select Fallback Advisor Model (optional)"
160
+ ),
151
161
  tui,
152
162
  })
153
163
  );
@@ -4,6 +4,7 @@ import type {
4
4
  } from "@earendil-works/pi-coding-agent";
5
5
 
6
6
  import { activateAdvisor } from "./activation.ts";
7
+ import { registerAdvisorConfigurationTool } from "./configuration-tool.ts";
7
8
  import { registerCommandLifecycle } from "./lifecycle.ts";
8
9
  import { registerManualCommand } from "./manual-command.ts";
9
10
  import { registerModelCommands } from "./model-commands.ts";
@@ -28,4 +29,5 @@ export const registerCommands = (
28
29
  registerModelCommands(runtime);
29
30
  registerOutcomeStatsCommand(runtime);
30
31
  registerSettingsCommands(runtime);
32
+ registerAdvisorConfigurationTool(runtime);
31
33
  };
@@ -5,6 +5,7 @@ import type {
5
5
 
6
6
  import { getAdvisorSettings } from "../config/state.ts";
7
7
  import { herdrAdvisorActivity, notifyHerdrAdvisorFailure } from "../herdr.ts";
8
+ import { t } from "../i18n.ts";
8
9
  import type { AdvisorSessionState } from "../session-state.ts";
9
10
  import { consultAdvisor } from "../tools/consultation.ts";
10
11
  import {
@@ -30,9 +31,18 @@ export const notify = (
30
31
  };
31
32
 
32
33
  const reportManualBudgetExhausted = (ctx: ExtensionContext) => {
33
- const message = "Advisor call budget exhausted for this session.";
34
- notify(ctx, message, "warning");
35
- notifyHerdrAdvisorFailure("Advisor budget exhausted", message);
34
+ notify(
35
+ ctx,
36
+ t(
37
+ "notify.budgetExhausted.message",
38
+ "Advisor call budget exhausted for this session."
39
+ ),
40
+ "warning"
41
+ );
42
+ notifyHerdrAdvisorFailure(
43
+ "Advisor budget exhausted",
44
+ "Advisor call budget exhausted for this session."
45
+ );
36
46
  };
37
47
 
38
48
  const requestManualRender = (ctx: ExtensionContext) => {
@@ -117,7 +127,10 @@ class CommandRuntime implements CommandRuntimeContract {
117
127
  } else if (!disabled && this.lastSameModelDisabled === true) {
118
128
  notify(
119
129
  ctx,
120
- "Advisor re-enabled: executor and advisor models differ.",
130
+ t(
131
+ "notify.sameModelReenabled.message",
132
+ "Advisor re-enabled: executor and advisor models differ."
133
+ ),
121
134
  "info"
122
135
  );
123
136
  }
@@ -8,6 +8,7 @@ import {
8
8
  setAlwaysOnRef,
9
9
  } from "../config/state.ts";
10
10
  import { loadConfig, saveConfig } from "../config/storage.ts";
11
+ import { t } from "../i18n.ts";
11
12
  import {
12
13
  readJevClassifierKey,
13
14
  restoreJevClassifierKey,
@@ -35,7 +36,10 @@ const persistJevSettings = (
35
36
  saveAdvisorSettings(ctx, settings, { skipOutcomeLogging: true });
36
37
  } catch (error) {
37
38
  const message = error instanceof Error ? error.message : String(error);
38
- ctx.ui.notify(`Could not save Advisor settings: ${message}`, "error");
39
+ ctx.ui.notify(
40
+ `${t("settingsCmd.saveFailed.prefix", "Could not save Advisor settings:")} ${message}`,
41
+ "error"
42
+ );
39
43
 
40
44
  return false;
41
45
  }
@@ -47,7 +51,10 @@ const persistJevSettings = (
47
51
  } catch (error) {
48
52
  const message = error instanceof Error ? error.message : String(error);
49
53
  ctx.ui.notify(
50
- `Advisor settings were saved, but the status refresh failed: ${message}`,
54
+ `${t(
55
+ "settingsCmd.refreshFailed.prefix",
56
+ "Advisor settings were saved, but the status refresh failed:"
57
+ )} ${message}`,
51
58
  "warning"
52
59
  );
53
60
  }
@@ -111,8 +118,11 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
111
118
 
112
119
  ctx.ui.notify(
113
120
  toolsDisabled
114
- ? `Could not save Advisor settings; tools remain disabled for this session. ${message}`
115
- : `Could not save Advisor settings: ${message}`,
121
+ ? `${t(
122
+ "settingsCmd.saveFailedToolsDisabled.prefix",
123
+ "Could not save Advisor settings; tools remain disabled for this session."
124
+ )} ${message}`
125
+ : `${t("settingsCmd.saveFailed.prefix", "Could not save Advisor settings:")} ${message}`,
116
126
  "error"
117
127
  );
118
128
  }
@@ -145,7 +155,10 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
145
155
  const message = error instanceof Error ? error.message : String(error);
146
156
  notify(
147
157
  ctx,
148
- `Advisor tools disabled for this session, but configuration could not be reloaded: ${message}`,
158
+ `${t(
159
+ "settingsCmd.offReloadFailed.prefix",
160
+ "Advisor tools disabled for this session, but configuration could not be reloaded:"
161
+ )} ${message}`,
149
162
  "error"
150
163
  );
151
164
 
@@ -169,7 +182,10 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
169
182
  const message = error instanceof Error ? error.message : String(error);
170
183
  notify(
171
184
  ctx,
172
- `Advisor tools disabled for this session, but the setting could not be saved: ${message}`,
185
+ `${t(
186
+ "settingsCmd.offSaveFailed.prefix",
187
+ "Advisor tools disabled for this session, but the setting could not be saved:"
188
+ )} ${message}`,
173
189
  "error"
174
190
  );
175
191
 
@@ -178,7 +194,14 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
178
194
 
179
195
  notify(
180
196
  ctx,
181
- `Advisor tools disabled. Current model unchanged.${wasAlwaysOn ? " Always on turned off." : ""}`,
197
+ `${t(
198
+ "settingsCmd.off.message",
199
+ "Advisor tools disabled. Current model unchanged."
200
+ )}${
201
+ wasAlwaysOn
202
+ ? ` ${t("settingsCmd.off.alwaysOnTurnedOff", "Always on turned off.")}`
203
+ : ""
204
+ }`,
182
205
  "info"
183
206
  );
184
207