pi-advisor-flow 0.15.1 → 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 +5 -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
@@ -2,19 +2,10 @@ import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { getKeybindings } from "@earendil-works/pi-tui";
3
3
  import type { KeybindingsManager, SettingItem } from "@earendil-works/pi-tui";
4
4
 
5
- import {
6
- DEFAULT_JEV_DIGEST_MAX_CHARS,
7
- DEFAULT_JEV_FILTER_NOUL_MARGIN,
8
- DEFAULT_JEV_FILTER_OVERRIDE_WINDOW,
9
- DEFAULT_JEV_FILTER_SKIP_CONFIDENCE,
10
- DEFAULT_JEV_TIMEOUT_MS,
11
- DEFAULT_JEV_TURN_GATE_NOUL_THRESHOLD,
12
- DEFAULT_SCOUT_TIMEOUT_MS,
13
- } from "../config/types.ts";
5
+ import { DEFAULT_SCOUT_TIMEOUT_MS } from "../config/types.ts";
14
6
  import { isValidAdvisorToolPolicies } from "../config/validation.ts";
7
+ import { t } from "../i18n.ts";
15
8
  import type { JevClassifierKeySnapshot } from "../jev/classifier-key-store.ts";
16
- import { JevClassifierSubmenu } from "./jev-classifier-submenu.ts";
17
- import { JevFilterSubmenu } from "./jev-filter-submenu.ts";
18
9
  import { SearchableModelMultiSelector } from "./model-multi-selector.ts";
19
10
  import { SearchableModelSelector } from "./model-selector.ts";
20
11
  import {
@@ -27,6 +18,7 @@ import {
27
18
  TOGGLE_VALUES,
28
19
  withCurrentValue,
29
20
  } from "./settings-formatting.ts";
21
+ import { jevItems } from "./settings-items-jev.ts";
30
22
  import { TextSettingSubmenu } from "./text-setting-submenu.ts";
31
23
  import { FALLBACK_ADVISOR_MODEL_DISABLED } from "./types.ts";
32
24
  import type {
@@ -79,10 +71,12 @@ const scoutTimeoutItem = (settings: AdvisorSettings): SettingItem => {
79
71
 
80
72
  return {
81
73
  currentValue: String(timeoutMs),
82
- description:
83
- "Maximum time for Scout's response stream; model and auth resolution happen before this timeout starts.",
74
+ description: t(
75
+ "settings.scoutTimeoutMs.desc",
76
+ "Maximum time for Scout's response stream; model and auth resolution happen before this timeout starts."
77
+ ),
84
78
  id: "scoutTimeoutMs",
85
- label: "Scout timeout ms",
79
+ label: t("settings.scoutTimeoutMs.label", "Scout timeout ms"),
86
80
  values: numericValues(
87
81
  timeoutMs,
88
82
  [5000, 10_000, 15_000, 30_000, 45_000, 60_000, 90_000, 120_000]
@@ -90,154 +84,6 @@ const scoutTimeoutItem = (settings: AdvisorSettings): SettingItem => {
90
84
  };
91
85
  };
92
86
 
93
- const jevFilterRowValue = (settings: AdvisorSettings) => {
94
- if (!settings.jevFilterEnabled) {
95
- return "Off";
96
- }
97
-
98
- return settings.jevClassifier ? "On" : "On (unavailable: no classifier)";
99
- };
100
-
101
- const jevItems = (
102
- settings: AdvisorSettings,
103
- theme: Theme,
104
- tui: RenderRequester,
105
- jevClassifierRegistry?: JevClassifierRegistryAccess,
106
- jevKeyDeps?: SettingsItemsOptions["jevKeyDeps"],
107
- onJevFilter?: (selection: JevFilterSelection) => boolean,
108
- onJevProvider?: (selection: JevProviderSelection) => boolean
109
- ): SettingItem[] => [
110
- {
111
- currentValue: settings.jevClassifier ?? "Choose classifier",
112
- description:
113
- "Select a Pi-authenticated classifier or explicitly configure the separate Jev API Key option.",
114
- id: "jevProvider",
115
- label: "Jev classifier",
116
- submenu: (currentValue, done) =>
117
- new JevClassifierSubmenu({
118
- currentValue,
119
- done,
120
- keybindings: getKeybindings(),
121
- modelRegistry: jevClassifierRegistry,
122
- onSelection: onJevProvider,
123
- persistKey: jevKeyDeps?.persistClassifierKey,
124
- resolveStoredKey: jevKeyDeps?.resolveClassifierKey,
125
- restoreKey: jevKeyDeps?.restoreClassifierKey,
126
- theme,
127
- tui,
128
- }),
129
- },
130
- {
131
- currentValue: jevFilterRowValue(settings),
132
- description:
133
- "Screen low-stakes ask_advisor consultations with the selected Jev provider.",
134
- id: "jevFilter",
135
- label: "Jev/Decisions consultation filter",
136
- submenu: (currentValue, done) =>
137
- new JevFilterSubmenu({
138
- currentClassifier: settings.jevClassifier,
139
- currentValue,
140
- done,
141
- modelRegistry: jevClassifierRegistry,
142
- onSelection: onJevFilter,
143
- resolveClassifierKey: jevKeyDeps?.resolveClassifierKey,
144
- theme,
145
- tui,
146
- }),
147
- },
148
- {
149
- currentValue: String(
150
- settings.jevFilterSkipConfidence ?? DEFAULT_JEV_FILTER_SKIP_CONFIDENCE
151
- ),
152
- description:
153
- "Required probability on negligible stakes before a consultation is skipped.",
154
- id: "jevFilterSkipConfidence",
155
- label: "Jev skip confidence",
156
- values: numericValues(
157
- settings.jevFilterSkipConfidence ?? DEFAULT_JEV_FILTER_SKIP_CONFIDENCE,
158
- [0.6, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95]
159
- ),
160
- },
161
- {
162
- currentValue: String(
163
- settings.jevFilterNoulMargin ?? DEFAULT_JEV_FILTER_NOUL_MARGIN
164
- ),
165
- description:
166
- "Extra margin over a coin flip required on self-answerability before skipping.",
167
- id: "jevFilterNoulMargin",
168
- label: "Jev Noul margin",
169
- values: numericValues(
170
- settings.jevFilterNoulMargin ?? DEFAULT_JEV_FILTER_NOUL_MARGIN,
171
- [0.1, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45]
172
- ),
173
- },
174
- {
175
- currentValue: `${settings.jevFilterOverrideWindow ?? DEFAULT_JEV_FILTER_OVERRIDE_WINDOW} turns`,
176
- description:
177
- "Turns after a skip during which the same question passes automatically.",
178
- id: "jevFilterOverrideWindow",
179
- label: "Jev override window",
180
- values: numericValues(
181
- settings.jevFilterOverrideWindow ?? DEFAULT_JEV_FILTER_OVERRIDE_WINDOW,
182
- [0, 3, 5, 10, 20, 50]
183
- ).map((value) => `${value} turns`),
184
- },
185
- {
186
- currentValue: String(settings.jevTimeoutMs ?? DEFAULT_JEV_TIMEOUT_MS),
187
- description: "Total wall-time budget for one Jev call, including retries.",
188
- id: "jevTimeoutMs",
189
- label: "Jev timeout ms",
190
- values: numericValues(
191
- settings.jevTimeoutMs ?? DEFAULT_JEV_TIMEOUT_MS,
192
- [1000, 2000, 5000, 8000, 15_000, 30_000]
193
- ),
194
- },
195
- {
196
- currentValue: String(
197
- settings.jevDigestMaxChars ?? DEFAULT_JEV_DIGEST_MAX_CHARS
198
- ),
199
- description: "Conversation characters sent to Jev as screening evidence.",
200
- id: "jevDigestMaxChars",
201
- label: "Jev digest chars",
202
- values: numericValues(
203
- settings.jevDigestMaxChars ?? DEFAULT_JEV_DIGEST_MAX_CHARS,
204
- [0, 1000, 2000, 4000, 8000, 15_000]
205
- ),
206
- },
207
-
208
- {
209
- currentValue:
210
- settings.jevTurnGateEveryTurns === 0 ||
211
- settings.jevTurnGateEveryTurns === undefined
212
- ? "Off"
213
- : `every ${settings.jevTurnGateEveryTurns} turns`,
214
- description:
215
- "Proactively consult the Advisor every N turns without a consultation (0 = off).",
216
- id: "jevTurnGateEveryTurns",
217
- label: "Jev/Decisions turn gate",
218
- values: [
219
- "Off",
220
- "every 3 turns",
221
- "every 5 turns",
222
- "every 10 turns",
223
- "every 20 turns",
224
- ],
225
- },
226
- {
227
- currentValue: String(
228
- settings.jevTurnGateNoulThreshold ?? DEFAULT_JEV_TURN_GATE_NOUL_THRESHOLD
229
- ),
230
- description:
231
- "Jev confidence required before the turn gate interrupts with advice.",
232
- id: "jevTurnGateNoulThreshold",
233
- label: "Jev/Decisions turn-gate threshold",
234
- values: numericValues(
235
- settings.jevTurnGateNoulThreshold ?? DEFAULT_JEV_TURN_GATE_NOUL_THRESHOLD,
236
- [0.6, 0.7, 0.8, 0.85, 0.9, 0.95]
237
- ),
238
- },
239
- ];
240
-
241
87
  export const advisorFallbackModelItem = (
242
88
  settings: AdvisorSettings,
243
89
  modelRefs: string[] | undefined,
@@ -246,10 +92,12 @@ export const advisorFallbackModelItem = (
246
92
  tui: RenderRequester
247
93
  ): SettingItem => ({
248
94
  currentValue: settings.fallbackModel ?? FALLBACK_ADVISOR_MODEL_DISABLED,
249
- description:
250
- "Retry a failed Advisor request once with this optional model; the primary model remains unchanged.",
95
+ description: t(
96
+ "settings.fallbackModel.desc",
97
+ "Retry a failed Advisor request once with this optional model; the primary model remains unchanged."
98
+ ),
251
99
  id: "fallbackModel",
252
- label: "Fallback Advisor model",
100
+ label: t("settings.fallbackModel.label", "Fallback Advisor model"),
253
101
  submenu: (_currentValue, done) =>
254
102
  new SearchableModelSelector({
255
103
  allOptions: [
@@ -264,7 +112,7 @@ export const advisorFallbackModelItem = (
264
112
  onSelect: (value) =>
265
113
  done(value === FALLBACK_ADVISOR_MODEL_DISABLED ? "" : value),
266
114
  theme,
267
- title: "Fallback Advisor model",
115
+ title: t("settings.fallbackModel.label", "Fallback Advisor model"),
268
116
  tui,
269
117
  }),
270
118
  });
@@ -278,11 +126,13 @@ export const advisorModelWhitelistItem = (
278
126
  ): SettingItem => ({
279
127
  currentValue: settings.modelWhitelist?.length
280
128
  ? settings.modelWhitelist.join(", ")
281
- : "Any model",
282
- description:
283
- "Only the exact provider/model references listed here may call the Advisor; an empty list allows every model.",
129
+ : t("settings.modelWhitelist.any", "Any model"),
130
+ description: t(
131
+ "settings.modelWhitelist.desc",
132
+ "Only the exact provider/model references listed here may call the Advisor; an empty list allows every model."
133
+ ),
284
134
  id: "modelWhitelist",
285
- label: "Advisor model whitelist",
135
+ label: t("settings.modelWhitelist.label", "Advisor model whitelist"),
286
136
  submenu: (_currentValue, done) =>
287
137
  new SearchableModelMultiSelector({
288
138
  allOptions: [
@@ -294,7 +144,7 @@ export const advisorModelWhitelistItem = (
294
144
  onCancel: done,
295
145
  onSelect: (values) => done(values.join(",")),
296
146
  theme,
297
- title: "Advisor model whitelist",
147
+ title: t("settings.modelWhitelist.label", "Advisor model whitelist"),
298
148
  tui,
299
149
  }),
300
150
  });
@@ -317,31 +167,37 @@ export const createSettingsItems = ({
317
167
  currentValue: currentContextLabel(presets, settings.contextMaxChars),
318
168
  description: contextDescription(presets, settings.contextMaxChars),
319
169
  id: "context",
320
- label: "Context window",
170
+ label: t("settings.context.label", "Context window"),
321
171
  values: presets.map((preset) => preset.label),
322
172
  },
323
173
  {
324
174
  currentValue: settingValue(settings.advisorToolsEnabled, true),
325
- description:
326
- "Allow the model to call the Advisor tools; /advisor-off disables them across sessions.",
175
+ description: t(
176
+ "settings.advisorToolsEnabled.desc",
177
+ "Allow the model to call the Advisor tools; /advisor-off disables them across sessions."
178
+ ),
327
179
  id: "advisorToolsEnabled",
328
- label: "Advisor tools",
180
+ label: t("settings.advisorToolsEnabled.label", "Advisor tools"),
329
181
  values: TOGGLE_VALUES,
330
182
  },
331
183
  {
332
184
  currentValue: settingValue(settings.simpleMode, false),
333
- description:
334
- "Keep enabled Advisor tools available on demand without automatic gates or blocks.",
185
+ description: t(
186
+ "settings.simpleMode.desc",
187
+ "Keep enabled Advisor tools available on demand without automatic gates or blocks."
188
+ ),
335
189
  id: "simpleMode",
336
- label: "Simple mode",
190
+ label: t("settings.simpleMode.label", "Simple mode"),
337
191
  values: TOGGLE_VALUES,
338
192
  },
339
193
  {
340
194
  currentValue: settingValue(settings.alwaysOn, false),
341
- description:
342
- "Run the Advisor flow automatically for supported agent turns.",
195
+ description: t(
196
+ "settings.alwaysOn.desc",
197
+ "Run the Advisor flow automatically for supported agent turns."
198
+ ),
343
199
  id: "alwaysOn",
344
- label: "Always on",
200
+ label: t("settings.alwaysOn.label", "Always on"),
345
201
  values: TOGGLE_VALUES,
346
202
  },
347
203
  fallbackModel,
@@ -352,8 +208,11 @@ export const createSettingsItems = ({
352
208
  modelWhitelist,
353
209
  toggle(
354
210
  "disableSameModel",
355
- "Disable same-model Advisor",
356
- "Skip advice when the active Executor and Advisor use the same provider/model; turn off to allow higher-effort same-model reviews.",
211
+ t("settings.disableSameModel.label", "Disable same-model Advisor"),
212
+ t(
213
+ "settings.disableSameModel.desc",
214
+ "Skip advice when the active Executor and Advisor use the same provider/model; turn off to allow higher-effort same-model reviews."
215
+ ),
357
216
  settings.disableSameModel,
358
217
  true
359
218
  )
@@ -365,117 +224,168 @@ export const createSettingsItems = ({
365
224
  items.push(
366
225
  {
367
226
  currentValue: currentEffort(settings.effort),
368
- description: "Reasoning level used for Advisor calls.",
227
+ description: t(
228
+ "settings.effort.desc",
229
+ "Reasoning level used for Advisor calls."
230
+ ),
369
231
  id: "effort",
370
- label: "Advisor reasoning",
232
+ label: t("settings.effort.label", "Advisor reasoning"),
371
233
  values: withCurrentValue(currentEffort(settings.effort), effortLevels),
372
234
  },
373
235
  modelWhitelist,
374
236
  toggle(
375
237
  "disableSameModel",
376
- "Disable same-model Advisor",
377
- "Skip advice when the active Executor and Advisor use the same provider/model; turn off to allow higher-effort same-model reviews.",
238
+ t("settings.disableSameModel.label", "Disable same-model Advisor"),
239
+ t(
240
+ "settings.disableSameModel.desc",
241
+ "Skip advice when the active Executor and Advisor use the same provider/model; turn off to allow higher-effort same-model reviews."
242
+ ),
378
243
  settings.disableSameModel,
379
244
  true
380
245
  ),
381
246
  toggle(
382
247
  "scoutEnabled",
383
- "Experimental Advisor Scout",
384
- "Enable the experimental Scout before Advisor calls.",
248
+ t("settings.scoutEnabled.label", "Experimental Advisor Scout"),
249
+ t(
250
+ "settings.scoutEnabled.desc",
251
+ "Enable the experimental Scout before Advisor calls."
252
+ ),
385
253
  settings.scoutEnabled,
386
254
  false
387
255
  ),
388
256
  scoutTimeoutItem(settings),
389
257
  toggle(
390
258
  "showUsageDetails",
391
- "Show usage and cost details",
392
- "Show token usage and cost details in Advisor responses.",
259
+ t("settings.showUsageDetails.label", "Show usage and cost details"),
260
+ t(
261
+ "settings.showUsageDetails.desc",
262
+ "Show token usage and cost details in Advisor responses."
263
+ ),
393
264
  settings.showUsageDetails,
394
265
  true
395
266
  ),
396
267
  toggle(
397
268
  "showUsageFooter",
398
- "Show usage in footer",
399
- "Show the current Advisor usage summary in the footer.",
269
+ t("settings.showUsageFooter.label", "Show usage in footer"),
270
+ t(
271
+ "settings.showUsageFooter.desc",
272
+ "Show the current Advisor usage summary in the footer."
273
+ ),
400
274
  settings.showUsageFooter,
401
275
  false
402
276
  ),
403
277
  toggle(
404
278
  "planGate",
405
- "Plan gate",
406
- "Ask the Advisor to review implementation plans.",
279
+ t("settings.planGate.label", "Plan gate"),
280
+ t(
281
+ "settings.planGate.desc",
282
+ "Ask the Advisor to review implementation plans."
283
+ ),
407
284
  settings.planGate,
408
285
  true
409
286
  ),
410
287
  toggle(
411
288
  "failureGate",
412
- "Failure gate",
413
- "Ask the Advisor to review repeated failures.",
289
+ t("settings.failureGate.label", "Failure gate"),
290
+ t(
291
+ "settings.failureGate.desc",
292
+ "Ask the Advisor to review repeated failures."
293
+ ),
414
294
  settings.failureGate,
415
295
  true
416
296
  ),
417
297
  toggle(
418
298
  "completionGate",
419
- "Completion gate",
420
- "Ask the Advisor to review work before declaring success.",
299
+ t("settings.completionGate.label", "Completion gate"),
300
+ t(
301
+ "settings.completionGate.desc",
302
+ "Ask the Advisor to review work before declaring success."
303
+ ),
421
304
  settings.completionGate,
422
305
  true
423
306
  ),
424
307
  toggle(
425
308
  "collapseResponses",
426
- "Collapse long responses",
427
- "Collapse long Advisor responses in the transcript.",
309
+ t("settings.collapseResponses.label", "Collapse long responses"),
310
+ t(
311
+ "settings.collapseResponses.desc",
312
+ "Collapse long Advisor responses in the transcript."
313
+ ),
428
314
  settings.collapseResponses,
429
315
  false
430
316
  ),
431
317
  {
432
- currentValue: settings.customRule || "None",
433
- description: "Add a rule that triggers Advisor involvement.",
318
+ currentValue: settings.customRule || t("settings.none", "None"),
319
+ description: t(
320
+ "settings.customRule.desc",
321
+ "Add a rule that triggers Advisor involvement."
322
+ ),
434
323
  id: "customRule",
435
- label: "Custom invocation",
324
+ label: t("settings.customRule.label", "Custom invocation"),
436
325
  submenu: (_currentValue, done) =>
437
326
  new TextSettingSubmenu({
438
- description: "Enter a custom invocation rule.",
327
+ description: t(
328
+ "settings.customRule.submenuDesc",
329
+ "Enter a custom invocation rule."
330
+ ),
439
331
  initial: settings.customRule || "",
440
332
  onCancel: done,
441
333
  onSubmit: (value) => ({ value: value.trim() }),
442
334
  theme,
443
- title: "Custom invocation",
335
+ title: t("settings.customRule.label", "Custom invocation"),
444
336
  tui,
445
337
  }),
446
338
  },
447
339
  toggle(
448
340
  "blockOnBlocked",
449
- "Block on critical advice",
450
- "Block the agent when the Advisor returns a critical decision.",
341
+ t("settings.blockOnBlocked.label", "Block on critical advice"),
342
+ t(
343
+ "settings.blockOnBlocked.desc",
344
+ "Block the agent when the Advisor returns a critical decision."
345
+ ),
451
346
  settings.blockOnBlocked,
452
347
  true
453
348
  ),
454
349
  toggle(
455
350
  "autoLoopGate",
456
- "Automatic loop gate",
457
- "Ask the Advisor to review repeated equivalent attempts.",
351
+ t("settings.autoLoopGate.label", "Automatic loop gate"),
352
+ t(
353
+ "settings.autoLoopGate.desc",
354
+ "Ask the Advisor to review repeated equivalent attempts."
355
+ ),
458
356
  settings.autoLoopGate,
459
357
  true
460
358
  ),
461
359
  {
462
- currentValue: `After ${settings.loopThreshold ?? 3} repeats`,
463
- description: "Number of equivalent attempts before automatic review.",
360
+ currentValue: `${t("settings.loopThreshold.after", "After")} ${settings.loopThreshold ?? 3} ${t("settings.loopThreshold.repeats", "repeats")}`,
361
+ description: t(
362
+ "settings.loopThreshold.desc",
363
+ "Number of equivalent attempts before automatic review."
364
+ ),
464
365
  id: "loopThreshold",
465
- label: "Loop threshold",
366
+ label: t("settings.loopThreshold.label", "Loop threshold"),
466
367
  values: numericValues(
467
368
  settings.loopThreshold ?? 3,
468
369
  Array.from({ length: 99 }, (_, index) => index + 2)
469
- ).map((value) => `After ${value} repeats`),
370
+ ).map(
371
+ (value) =>
372
+ `${t("settings.loopThreshold.after", "After")} ${value} ${t("settings.loopThreshold.repeats", "repeats")}`
373
+ ),
470
374
  },
471
375
  {
472
376
  currentValue:
473
377
  settings.maxCallsPerSession === undefined
474
378
  ? "∞"
475
379
  : String(settings.maxCallsPerSession),
476
- description: "Limit automatic Advisor calls in one session.",
380
+ description: t(
381
+ "settings.maxCallsPerSession.desc",
382
+ "Limit automatic Advisor calls in one session."
383
+ ),
477
384
  id: "maxCallsPerSession",
478
- label: "Max Advisor calls/session",
385
+ label: t(
386
+ "settings.maxCallsPerSession.label",
387
+ "Max Advisor calls/session"
388
+ ),
479
389
  values: maxCallValues(
480
390
  settings.maxCallsPerSession === undefined
481
391
  ? "∞"
@@ -484,23 +394,32 @@ export const createSettingsItems = ({
484
394
  },
485
395
  toggle(
486
396
  "sessionSummary",
487
- "Session Advisor Summary",
488
- "Show a local summary when the session ends.",
397
+ t("settings.sessionSummary.label", "Session Advisor Summary"),
398
+ t(
399
+ "settings.sessionSummary.desc",
400
+ "Show a local summary when the session ends."
401
+ ),
489
402
  settings.sessionSummary,
490
403
  false
491
404
  ),
492
405
  toggle(
493
406
  "logFeedback",
494
- "Advisor log feedback",
495
- "Include budget and Scout status messages in session logs. Actual Advisor calls and results remain visible either way.",
407
+ t("settings.logFeedback.label", "Advisor log feedback"),
408
+ t(
409
+ "settings.logFeedback.desc",
410
+ "Include budget and Scout status messages in session logs. Actual Advisor calls and results remain visible either way."
411
+ ),
496
412
  settings.logFeedback,
497
413
  false
498
414
  ),
499
415
  {
500
416
  currentValue: settings.failureMode ?? "block-session",
501
- description: "Choose what happens when an Advisor gate fails.",
417
+ description: t(
418
+ "settings.failureMode.desc",
419
+ "Choose what happens when an Advisor gate fails."
420
+ ),
502
421
  id: "failureMode",
503
- label: "Gate failure mode",
422
+ label: t("settings.failureMode.label", "Gate failure mode"),
504
423
  values: withCurrentValue(settings.failureMode ?? "block-session", [
505
424
  "block-session",
506
425
  "block-tool",
@@ -509,16 +428,22 @@ export const createSettingsItems = ({
509
428
  },
510
429
  toggle(
511
430
  "herdrIntegration",
512
- "Herdr integration",
513
- "Send Advisor activity to the optional Herdr integration.",
431
+ t("settings.herdrIntegration.label", "Herdr integration"),
432
+ t(
433
+ "settings.herdrIntegration.desc",
434
+ "Send Advisor activity to the optional Herdr integration."
435
+ ),
514
436
  settings.herdrIntegration,
515
437
  true
516
438
  ),
517
439
  {
518
440
  currentValue: String(settings.toolResultMaxLines ?? 2000),
519
- description: "Maximum lines included from a tool result.",
441
+ description: t(
442
+ "settings.toolResultMaxLines.desc",
443
+ "Maximum lines included from a tool result."
444
+ ),
520
445
  id: "toolResultMaxLines",
521
- label: "Tool result lines",
446
+ label: t("settings.toolResultMaxLines.label", "Tool result lines"),
522
447
  values: numericValues(
523
448
  settings.toolResultMaxLines ?? 2000,
524
449
  [0, 500, 1000, 2000, 5000, 10_000]
@@ -526,9 +451,12 @@ export const createSettingsItems = ({
526
451
  },
527
452
  {
528
453
  currentValue: String(settings.toolResultMaxBytes ?? 50 * 1024),
529
- description: "Maximum bytes included from a tool result.",
454
+ description: t(
455
+ "settings.toolResultMaxBytes.desc",
456
+ "Maximum bytes included from a tool result."
457
+ ),
530
458
  id: "toolResultMaxBytes",
531
- label: "Tool result bytes",
459
+ label: t("settings.toolResultMaxBytes.label", "Tool result bytes"),
532
460
  values: numericValues(settings.toolResultMaxBytes ?? 50 * 1024, [
533
461
  0,
534
462
  10 * 1024,
@@ -539,23 +467,32 @@ export const createSettingsItems = ({
539
467
  },
540
468
  toggle(
541
469
  "redactSecrets",
542
- "Redact common secrets",
543
- "Redact common credential patterns before Advisor calls.",
470
+ t("settings.redactSecrets.label", "Redact common secrets"),
471
+ t(
472
+ "settings.redactSecrets.desc",
473
+ "Redact common credential patterns before Advisor calls."
474
+ ),
544
475
  settings.redactSecrets,
545
476
  false
546
477
  ),
547
478
  toggle(
548
479
  "agentsMdContext",
549
- "AGENTS.md context",
550
- "Include trusted project and global AGENTS.md rules in Advisor calls.",
480
+ t("settings.agentsMdContext.label", "AGENTS.md context"),
481
+ t(
482
+ "settings.agentsMdContext.desc",
483
+ "Include trusted project and global AGENTS.md rules in Advisor calls."
484
+ ),
551
485
  settings.agentsMdContext,
552
486
  true
553
487
  ),
554
488
  {
555
489
  currentValue: settings.gitContext ?? "summary",
556
- description: "How much repository context is shared with the Advisor.",
490
+ description: t(
491
+ "settings.gitContext.desc",
492
+ "How much repository context is shared with the Advisor."
493
+ ),
557
494
  id: "gitContext",
558
- label: "Repository context",
495
+ label: t("settings.gitContext.label", "Repository context"),
559
496
  values: withCurrentValue(settings.gitContext ?? "summary", [
560
497
  "off",
561
498
  "summary",
@@ -564,9 +501,12 @@ export const createSettingsItems = ({
564
501
  },
565
502
  {
566
503
  currentValue: String(settings.gitContextMaxChars ?? 20_000),
567
- description: "Maximum repository context characters included.",
504
+ description: t(
505
+ "settings.gitContextMaxChars.desc",
506
+ "Maximum repository context characters included."
507
+ ),
568
508
  id: "gitContextMaxChars",
569
- label: "Repository context chars",
509
+ label: t("settings.gitContextMaxChars.label", "Repository context chars"),
570
510
  values: numericValues(
571
511
  settings.gitContextMaxChars ?? 20_000,
572
512
  [0, 5000, 10_000, 20_000, 50_000, 100_000]
@@ -574,16 +514,20 @@ export const createSettingsItems = ({
574
514
  },
575
515
  {
576
516
  currentValue: Object.keys(settings.toolPolicies ?? {}).length
577
- ? "Configured"
578
- : "All tools: full",
579
- description:
580
- "Choose which tools are shared in full, summarized, or excluded.",
517
+ ? t("settings.toolPolicies.configured", "Configured")
518
+ : t("settings.toolPolicies.allToolsFull", "All tools: full"),
519
+ description: t(
520
+ "settings.toolPolicies.desc",
521
+ "Choose which tools are shared in full, summarized, or excluded."
522
+ ),
581
523
  id: "toolPolicies",
582
- label: "Tool disclosure policies",
524
+ label: t("settings.toolPolicies.label", "Tool disclosure policies"),
583
525
  submenu: (_currentValue, done) =>
584
526
  new TextSettingSubmenu({
585
- description:
586
- 'Enter a JSON object with "full", "summary", or "exclude" values.',
527
+ description: t(
528
+ "settings.toolPolicies.submenuDesc",
529
+ 'Enter a JSON object with "full", "summary", or "exclude" values.'
530
+ ),
587
531
  initial: JSON.stringify(settings.toolPolicies ?? {}),
588
532
  onCancel: done,
589
533
  onSubmit: (value) => {
@@ -592,53 +536,66 @@ export const createSettingsItems = ({
592
536
  try {
593
537
  parsed = JSON.parse(value || "{}");
594
538
  } catch {
595
- return { error: "Enter a valid JSON object." };
539
+ return {
540
+ error: t(
541
+ "settings.toolPolicies.invalidJson",
542
+ "Enter a valid JSON object."
543
+ ),
544
+ };
596
545
  }
597
546
 
598
547
  if (!isValidAdvisorToolPolicies(parsed)) {
599
548
  return {
600
- error:
601
- "Use non-empty tool names with full, summary, or exclude values.",
549
+ error: t(
550
+ "settings.toolPolicies.invalidPolicies",
551
+ "Use non-empty tool names with full, summary, or exclude values."
552
+ ),
602
553
  };
603
554
  }
604
555
 
605
556
  return { value: JSON.stringify(parsed) };
606
557
  },
607
558
  theme,
608
- title: "Tool disclosure policies",
559
+ title: t("settings.toolPolicies.label", "Tool disclosure policies"),
609
560
  tui,
610
561
  }),
611
562
  },
612
563
  toggle(
613
564
  "trackedFileContent",
614
- "Tracked file content",
615
- "Allow tracked file contents to be sent with Advisor context.",
565
+ t("settings.trackedFileContent.label", "Tracked file content"),
566
+ t(
567
+ "settings.trackedFileContent.desc",
568
+ "Allow tracked file contents to be sent with Advisor context."
569
+ ),
616
570
  settings.trackedFileContent,
617
571
  false
618
572
  ),
619
573
  toggle(
620
574
  "untrackedContent",
621
- "Untracked file content",
622
- "Allow untracked file contents to be sent with Advisor context.",
575
+ t("settings.untrackedContent.label", "Untracked file content"),
576
+ t(
577
+ "settings.untrackedContent.desc",
578
+ "Allow untracked file contents to be sent with Advisor context."
579
+ ),
623
580
  settings.untrackedContent,
624
581
  false
625
582
  ),
626
583
  toggle(
627
584
  "outcomeLogging",
628
- "Outcome logging (global)",
629
- "Allow anonymized Advisor outcomes to be logged globally.",
585
+ t("settings.outcomeLogging.label", "Outcome logging (global)"),
586
+ t(
587
+ "settings.outcomeLogging.desc",
588
+ "Allow anonymized Advisor outcomes to be logged globally."
589
+ ),
630
590
  settings.outcomeLogging,
631
591
  false
632
592
  ),
633
- ...jevItems(
634
- settings,
635
- theme,
636
- tui,
593
+ ...jevItems(settings, theme, tui, {
637
594
  jevClassifierRegistry,
638
595
  jevKeyDeps,
639
596
  onJevFilter,
640
- onJevProvider
641
- )
597
+ onJevProvider,
598
+ })
642
599
  );
643
600
 
644
601
  return items;