@narumitw/pi-plan-mode 0.56.0 → 0.57.0
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 +64 -214
- package/dist/chunks/{chunk-57OBPS7P.js → chunk-YUFPCQVG.js} +501 -367
- package/dist/chunks/chunk-YUFPCQVG.js.map +7 -0
- package/dist/chunks/{interactive-ui-N2ZKBVNE.js → interactive-ui-M3GEZN4M.js} +183 -84
- package/dist/chunks/interactive-ui-M3GEZN4M.js.map +7 -0
- package/dist/index.ts +185 -17
- package/dist/index.ts.map +3 -3
- package/docs/command-workflows.md +52 -0
- package/docs/settings.md +169 -0
- package/package.json +4 -3
- package/src/fresh-implementation-preferences.ts +102 -0
- package/src/fresh-implementation.ts +46 -3
- package/src/implementation-options.ts +127 -0
- package/src/implementation-preferences.ts +145 -0
- package/src/plan-action-controller.ts +26 -10
- package/src/plan-action-menus.ts +65 -104
- package/src/plan-mode.ts +106 -6
- package/src/saved-plan-menu.ts +35 -7
- package/src/settings-menu.ts +35 -1
- package/src/settings.ts +35 -1
- package/dist/chunks/chunk-57OBPS7P.js.map +0 -7
- package/dist/chunks/interactive-ui-N2ZKBVNE.js.map +0 -7
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
planModeSettingsPath,
|
|
16
16
|
readPlanModeSettings,
|
|
17
17
|
retentionLabel,
|
|
18
|
+
safeImplementationText,
|
|
18
19
|
toolPolicyLabel,
|
|
19
20
|
updatePlanModeSettings
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YUFPCQVG.js";
|
|
21
22
|
|
|
22
23
|
// src/active-implementation-menu.ts
|
|
23
24
|
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
@@ -89,28 +90,144 @@ async function showActiveImplementationMenu(ctx, options) {
|
|
|
89
90
|
|
|
90
91
|
// src/plan-action-menus.ts
|
|
91
92
|
import { defineMenu as defineMenu2, runMenu as runMenu2 } from "@narumitw/pi-tui-kit";
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
|
|
94
|
+
// src/implementation-options.ts
|
|
95
|
+
function implementationModelLabel(model) {
|
|
96
|
+
return model ? safeImplementationText(`${model.provider} / ${model.id}`) : "Use current";
|
|
97
|
+
}
|
|
98
|
+
function implementationSummary(preferences) {
|
|
99
|
+
return `Model: ${implementationModelLabel(preferences.implementationModel)} \xB7 Thinking: ${preferences.implementationThinkingLevel && preferences.implementationThinkingLevel !== "inherit" ? preferences.implementationThinkingLevel : "Use normal behavior"}`;
|
|
100
|
+
}
|
|
101
|
+
function implementationSettingItems(preferences) {
|
|
102
|
+
return [
|
|
103
|
+
{
|
|
104
|
+
id: "implementationModel",
|
|
105
|
+
label: "Implementation model",
|
|
106
|
+
currentValue: implementationModelLabel(preferences.implementationModel),
|
|
107
|
+
description: "Select the model only when implementation starts; never switch back automatically.",
|
|
108
|
+
action: "open-implementation-model"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "implementationThinkingLevel",
|
|
112
|
+
label: "Implementation thinking",
|
|
113
|
+
currentValue: preferences.implementationThinkingLevel ?? "inherit",
|
|
114
|
+
values: PLAN_MODE_THINKING_LEVELS,
|
|
115
|
+
description: "inherit preserves normal behavior, including restoration of Plan thinking. Explicit levels apply after model selection and are clamped by Pi.",
|
|
116
|
+
action: "set-implementation-thinking"
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
function createImplementationModelPicker(ctx) {
|
|
121
|
+
const models = ctx.scopedModels?.length ? ctx.scopedModels.map(({ model }) => model) : ctx.modelRegistry.getAvailable();
|
|
122
|
+
const byId = new Map(
|
|
123
|
+
models.map((model, index) => [
|
|
124
|
+
`implementation-model:${index}`,
|
|
125
|
+
{ provider: model.provider, id: model.id }
|
|
126
|
+
])
|
|
127
|
+
);
|
|
128
|
+
return {
|
|
129
|
+
selection(itemId) {
|
|
130
|
+
return itemId === "implementation-current" ? null : byId.get(itemId);
|
|
131
|
+
},
|
|
132
|
+
screen(preferences) {
|
|
133
|
+
return {
|
|
134
|
+
kind: "choice",
|
|
135
|
+
title: "Implementation model",
|
|
136
|
+
enableSearch: true,
|
|
137
|
+
viewportSize: 10,
|
|
138
|
+
hint: "back",
|
|
139
|
+
action: "set-implementation-model",
|
|
140
|
+
lines: [
|
|
141
|
+
"Use current makes no model change. Reopen this menu to refresh the catalogue.",
|
|
142
|
+
"Implement here sends the planning conversation to the selected provider; fresh transfers only the approved plan and normal destination resources.",
|
|
143
|
+
`Selected: ${implementationModelLabel(preferences.implementationModel)}`
|
|
144
|
+
],
|
|
145
|
+
items: [
|
|
146
|
+
{ id: "implementation-current", label: "Use current" },
|
|
147
|
+
...[...byId].map(([id, model]) => ({ id, label: implementationModelLabel(model) }))
|
|
148
|
+
]
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function createImplementationOptions(ctx, initial = {}) {
|
|
154
|
+
let preferences = { ...initial };
|
|
155
|
+
let picker;
|
|
156
|
+
return {
|
|
157
|
+
get: () => preferences,
|
|
158
|
+
summary: () => implementationSummary(preferences),
|
|
159
|
+
screens: {
|
|
160
|
+
"implementation-options": () => ({
|
|
161
|
+
kind: "settings",
|
|
162
|
+
title: "Implementation options",
|
|
163
|
+
lines: [
|
|
164
|
+
"Applies to both implementation actions in this menu only.",
|
|
165
|
+
"Changes take effect only when implementation starts. No automatic restoration afterwards.",
|
|
166
|
+
`Current model: ${implementationModelLabel(ctx.model)}`,
|
|
167
|
+
"inherit keeps normal thinking behavior, not necessarily the temporary Plan thinking level."
|
|
168
|
+
],
|
|
169
|
+
items: implementationSettingItems(preferences)
|
|
170
|
+
}),
|
|
171
|
+
"implementation-model": () => {
|
|
172
|
+
picker ??= createImplementationModelPicker(ctx);
|
|
173
|
+
return picker.screen(preferences);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
actions: {
|
|
177
|
+
"open-implementation-model": async () => ({
|
|
178
|
+
kind: "to",
|
|
179
|
+
screen: "implementation-model"
|
|
180
|
+
}),
|
|
181
|
+
"set-implementation-model": async ({ itemId }) => {
|
|
182
|
+
const selected = picker?.selection(itemId);
|
|
183
|
+
if (selected === void 0) return { kind: "rejected" };
|
|
184
|
+
preferences = { ...preferences, implementationModel: selected ?? void 0 };
|
|
185
|
+
return { kind: "back" };
|
|
186
|
+
},
|
|
187
|
+
"set-implementation-thinking": async ({ value }) => {
|
|
188
|
+
const level = PLAN_MODE_THINKING_LEVELS.find((level2) => level2 === value);
|
|
189
|
+
if (!level) return { kind: "rejected" };
|
|
190
|
+
preferences = { ...preferences, implementationThinkingLevel: level };
|
|
191
|
+
return { kind: "stay" };
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/plan-action-menus.ts
|
|
198
|
+
function showPlanModeMenu(ctx, options) {
|
|
199
|
+
return showActions(ctx, options, options);
|
|
200
|
+
}
|
|
201
|
+
function showReadyPlanMenu(ctx, options) {
|
|
202
|
+
return showActions(ctx, options);
|
|
203
|
+
}
|
|
204
|
+
async function showActions(ctx, options, current) {
|
|
205
|
+
const implementation = createImplementationOptions(ctx, options.implementationPreferences);
|
|
206
|
+
const ready = current?.hasReadyPlan ?? true;
|
|
97
207
|
const menu = defineMenu2({
|
|
98
208
|
start: "main",
|
|
99
209
|
screens: {
|
|
210
|
+
...implementation.screens,
|
|
100
211
|
main: () => ({
|
|
101
212
|
kind: "actions",
|
|
102
|
-
title: "Plan mode",
|
|
213
|
+
title: current ? "Plan mode" : "Proposed plan ready. What next?",
|
|
103
214
|
lines: [
|
|
104
|
-
|
|
105
|
-
...
|
|
215
|
+
...current ? [current.statusText] : [],
|
|
216
|
+
...ready ? [
|
|
217
|
+
"Implement here keeps this planning conversation.",
|
|
218
|
+
"Start fresh transfers only the approved plan to a new session.",
|
|
219
|
+
options.implementationOutcome(),
|
|
220
|
+
implementation.summary()
|
|
221
|
+
] : []
|
|
106
222
|
],
|
|
107
|
-
items:
|
|
108
|
-
{ id: "show", label: "Show latest proposed plan", action: "show" },
|
|
223
|
+
items: ready ? [
|
|
224
|
+
...current ? [{ id: "show", label: "Show latest proposed plan", action: "show" }] : [],
|
|
109
225
|
{
|
|
110
226
|
id: "implement-here",
|
|
111
227
|
label: "Implement here",
|
|
112
228
|
description: "Continue in this session with the planning conversation.",
|
|
113
|
-
action: "implement-here"
|
|
229
|
+
action: "implement-here",
|
|
230
|
+
busyLabel: "Preparing implementation\u2026"
|
|
114
231
|
},
|
|
115
232
|
{
|
|
116
233
|
id: "implement-fresh",
|
|
@@ -119,6 +236,11 @@ async function showPlanModeMenu(ctx, options) {
|
|
|
119
236
|
action: "implement-fresh",
|
|
120
237
|
busyLabel: "Starting fresh implementation session\u2026"
|
|
121
238
|
},
|
|
239
|
+
{
|
|
240
|
+
id: "implementation-options",
|
|
241
|
+
label: "Implementation options\u2026",
|
|
242
|
+
to: "implementation-options"
|
|
243
|
+
},
|
|
122
244
|
{ id: "export", label: "Export plan\u2026", to: "export" },
|
|
123
245
|
{ id: "save", label: "Save for later", action: "save" },
|
|
124
246
|
{ id: "stay", label: "Stay in Plan mode", action: "stay" },
|
|
@@ -133,81 +255,21 @@ async function showPlanModeMenu(ctx, options) {
|
|
|
133
255
|
export: () => planExportInputScreen(options.getExportDestination)
|
|
134
256
|
},
|
|
135
257
|
actions: {
|
|
258
|
+
...implementation.actions,
|
|
136
259
|
show: async () => {
|
|
137
|
-
|
|
260
|
+
current?.show();
|
|
138
261
|
return { kind: "close" };
|
|
139
262
|
},
|
|
140
263
|
finalize: async () => {
|
|
141
|
-
|
|
142
|
-
return { kind: "close" };
|
|
143
|
-
},
|
|
144
|
-
"implement-here": async () => {
|
|
145
|
-
await options.implementHere();
|
|
146
|
-
return { kind: "close" };
|
|
147
|
-
},
|
|
148
|
-
"implement-fresh": async ({ signal }) => {
|
|
149
|
-
await options.implementFresh(signal);
|
|
150
|
-
return { kind: "close" };
|
|
151
|
-
},
|
|
152
|
-
export: async ({ value, signal }) => await options.exportPlan(value ?? "", signal) ? { kind: "close" } : { kind: "rejected" },
|
|
153
|
-
save: async () => {
|
|
154
|
-
options.save();
|
|
264
|
+
current?.finalize();
|
|
155
265
|
return { kind: "close" };
|
|
156
266
|
},
|
|
157
|
-
|
|
158
|
-
options.
|
|
159
|
-
return { kind: "close" };
|
|
160
|
-
},
|
|
161
|
-
exit: async () => {
|
|
162
|
-
options.exit();
|
|
163
|
-
return { kind: "close" };
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
await runMenu2(ctx, menu, {
|
|
168
|
-
getState: () => void 0,
|
|
169
|
-
signal: options.signal,
|
|
170
|
-
isCurrent: options.isCurrent
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
async function showReadyPlanMenu(ctx, options) {
|
|
174
|
-
const menu = defineMenu2({
|
|
175
|
-
start: "ready",
|
|
176
|
-
screens: {
|
|
177
|
-
ready: () => ({
|
|
178
|
-
kind: "actions",
|
|
179
|
-
title: "Proposed plan ready. What next?",
|
|
180
|
-
lines: [...IMPLEMENTATION_CONTEXT_LINES, options.implementationOutcome()],
|
|
181
|
-
items: [
|
|
182
|
-
{
|
|
183
|
-
id: "implement-here",
|
|
184
|
-
label: "Implement here",
|
|
185
|
-
description: "Continue in this session with the planning conversation.",
|
|
186
|
-
action: "implement-here"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
id: "implement-fresh",
|
|
190
|
-
label: "Start fresh and implement",
|
|
191
|
-
description: "Open a new linked session; transfer only the approved plan.",
|
|
192
|
-
action: "implement-fresh",
|
|
193
|
-
busyLabel: "Starting fresh implementation session\u2026"
|
|
194
|
-
},
|
|
195
|
-
{ id: "export", label: "Export plan\u2026", to: "export" },
|
|
196
|
-
{ id: "save", label: "Save for later", action: "save" },
|
|
197
|
-
{ id: "stay", label: "Stay in Plan mode", action: "stay" },
|
|
198
|
-
{ id: "exit", label: "Discard plan and exit", action: "exit" }
|
|
199
|
-
],
|
|
200
|
-
hint: "close"
|
|
201
|
-
}),
|
|
202
|
-
export: () => planExportInputScreen(options.getExportDestination)
|
|
203
|
-
},
|
|
204
|
-
actions: {
|
|
205
|
-
"implement-here": async () => {
|
|
206
|
-
await options.implementHere();
|
|
267
|
+
"implement-here": async ({ signal }) => {
|
|
268
|
+
await options.implementHere(implementation.get(), signal);
|
|
207
269
|
return { kind: "close" };
|
|
208
270
|
},
|
|
209
271
|
"implement-fresh": async ({ signal }) => {
|
|
210
|
-
await options.implementFresh(signal);
|
|
272
|
+
await options.implementFresh(signal, implementation.get());
|
|
211
273
|
return { kind: "close" };
|
|
212
274
|
},
|
|
213
275
|
export: async ({ value, signal }) => await options.exportPlan(value ?? "", signal) ? { kind: "close" } : { kind: "rejected" },
|
|
@@ -346,9 +408,11 @@ async function showSavedPlanMenu(ctx, options) {
|
|
|
346
408
|
`${options.statusText} Use /plan show, /plan implement, /plan export, or /plan exit.`
|
|
347
409
|
);
|
|
348
410
|
}
|
|
411
|
+
const implementation = createImplementationOptions(ctx, options.implementationPreferences);
|
|
349
412
|
const menu = defineMenu4({
|
|
350
413
|
start: "saved",
|
|
351
414
|
screens: {
|
|
415
|
+
...implementation.screens,
|
|
352
416
|
saved: () => ({
|
|
353
417
|
kind: "actions",
|
|
354
418
|
title: "Saved plan",
|
|
@@ -356,7 +420,8 @@ async function showSavedPlanMenu(ctx, options) {
|
|
|
356
420
|
options.statusText,
|
|
357
421
|
"Implement here keeps this planning conversation.",
|
|
358
422
|
"Start fresh transfers only the approved plan to a new session.",
|
|
359
|
-
options.implementationOutcome()
|
|
423
|
+
options.implementationOutcome(),
|
|
424
|
+
implementation.summary()
|
|
360
425
|
],
|
|
361
426
|
items: [
|
|
362
427
|
{ id: "show", label: "Show saved plan", action: "show" },
|
|
@@ -373,6 +438,11 @@ async function showSavedPlanMenu(ctx, options) {
|
|
|
373
438
|
action: "implement-fresh",
|
|
374
439
|
busyLabel: "Starting fresh implementation session\u2026"
|
|
375
440
|
},
|
|
441
|
+
{
|
|
442
|
+
id: "implementation-options",
|
|
443
|
+
label: "Implementation options\u2026",
|
|
444
|
+
to: "implementation-options"
|
|
445
|
+
},
|
|
376
446
|
{ id: "export", label: "Export plan\u2026", to: "export" },
|
|
377
447
|
{ id: "settings", label: "Settings", action: "settings" },
|
|
378
448
|
{ id: "clear", label: "Clear saved plan", action: "clear" }
|
|
@@ -382,16 +452,17 @@ async function showSavedPlanMenu(ctx, options) {
|
|
|
382
452
|
export: () => planExportInputScreen(options.getExportDestination)
|
|
383
453
|
},
|
|
384
454
|
actions: {
|
|
455
|
+
...implementation.actions,
|
|
385
456
|
show: async () => {
|
|
386
457
|
options.show();
|
|
387
458
|
return { kind: "close" };
|
|
388
459
|
},
|
|
389
|
-
"implement-here": async () => {
|
|
390
|
-
await options.implementHere();
|
|
460
|
+
"implement-here": async ({ signal }) => {
|
|
461
|
+
await options.implementHere(implementation.get(), signal);
|
|
391
462
|
return { kind: "close" };
|
|
392
463
|
},
|
|
393
464
|
"implement-fresh": async ({ signal }) => {
|
|
394
|
-
await options.implementFresh(signal);
|
|
465
|
+
await options.implementFresh(signal, implementation.get());
|
|
395
466
|
return { kind: "close" };
|
|
396
467
|
},
|
|
397
468
|
export: async ({ value, signal }) => await options.exportPlan(value ?? "", signal) ? { kind: "close" } : { kind: "rejected" },
|
|
@@ -445,6 +516,7 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
445
516
|
notice: loaded.notice
|
|
446
517
|
};
|
|
447
518
|
};
|
|
519
|
+
let implementationPicker;
|
|
448
520
|
const menu = defineMenu5({
|
|
449
521
|
start: "settings",
|
|
450
522
|
screens: {
|
|
@@ -491,9 +563,14 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
491
563
|
description: "Set the global shortcut used to toggle Plan mode.",
|
|
492
564
|
currentValue: configuredPlanModeToggleShortcut(state.settings) ?? "none",
|
|
493
565
|
action: "open-shortcut"
|
|
494
|
-
}
|
|
566
|
+
},
|
|
567
|
+
...implementationSettingItems(state.settings)
|
|
495
568
|
]
|
|
496
569
|
},
|
|
570
|
+
"implementation-model": ({ state }) => {
|
|
571
|
+
implementationPicker ??= createImplementationModelPicker(ctx);
|
|
572
|
+
return implementationPicker.screen(state.settings);
|
|
573
|
+
},
|
|
497
574
|
tools: ({ state }) => ({
|
|
498
575
|
kind: "multiSelect",
|
|
499
576
|
title: "Default Plan policy allowlist",
|
|
@@ -551,6 +628,28 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
551
628
|
})
|
|
552
629
|
},
|
|
553
630
|
actions: {
|
|
631
|
+
"open-implementation-model": async () => ({ kind: "to", screen: "implementation-model" }),
|
|
632
|
+
"set-implementation-model": async ({ ctx: actionCtx, itemId, signal }) => {
|
|
633
|
+
const model = implementationPicker?.selection(itemId);
|
|
634
|
+
if (model === void 0) return { kind: "rejected" };
|
|
635
|
+
const result = await savePatch(
|
|
636
|
+
actionCtx,
|
|
637
|
+
{ implementationModel: model },
|
|
638
|
+
signal,
|
|
639
|
+
"Implementation model saved. Applies when implementation starts."
|
|
640
|
+
);
|
|
641
|
+
return result.kind === "stay" ? { kind: "back" } : result;
|
|
642
|
+
},
|
|
643
|
+
"set-implementation-thinking": async ({ ctx: actionCtx, value, signal }) => {
|
|
644
|
+
const level = PLAN_MODE_THINKING_LEVELS.find((level2) => level2 === value);
|
|
645
|
+
if (!level) return { kind: "rejected" };
|
|
646
|
+
return savePatch(
|
|
647
|
+
actionCtx,
|
|
648
|
+
{ implementationThinkingLevel: level },
|
|
649
|
+
signal,
|
|
650
|
+
"Implementation thinking saved. Applies when implementation starts."
|
|
651
|
+
);
|
|
652
|
+
},
|
|
554
653
|
"set-thinking": async ({ ctx: actionCtx, value, signal }) => {
|
|
555
654
|
if (!PLAN_MODE_THINKING_LEVELS.includes(value)) {
|
|
556
655
|
return { kind: "rejected" };
|
|
@@ -740,4 +839,4 @@ export {
|
|
|
740
839
|
showReadyPlanMenu,
|
|
741
840
|
showSavedPlanMenu
|
|
742
841
|
};
|
|
743
|
-
//# sourceMappingURL=interactive-ui-
|
|
842
|
+
//# sourceMappingURL=interactive-ui-M3GEZN4M.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/active-implementation-menu.ts", "../../src/plan-export-screen.ts", "../../src/plan-action-menus.ts", "../../src/implementation-options.ts", "../../src/plan-launch-menu.ts", "../../src/saved-plan-menu.ts", "../../src/settings-menu.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { type PlanExportDestinationProvider, planExportInputScreen } from \"./plan-export-screen.js\";\n\ninterface ActiveImplementationMenuOptions {\n\tstatusText: string;\n\tgetExportDestination: PlanExportDestinationProvider;\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tshow(): void;\n\texportPlan(path: string, signal: AbortSignal): Promise<boolean>;\n\tsettings(signal: AbortSignal): Promise<boolean>;\n\tstartNew(): void;\n\tclear(): void;\n}\n\nexport async function showActiveImplementationMenu(\n\tctx: ExtensionContext,\n\toptions: ActiveImplementationMenuOptions,\n) {\n\ttype Screen = \"active\" | \"export\";\n\ttype Action = \"show\" | \"export\" | \"settings\" | \"start-new\" | \"clear\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionContext>({\n\t\tstart: \"active\",\n\t\tscreens: {\n\t\t\tactive: () => ({\n\t\t\t\tkind: \"actions\",\n\t\t\t\ttitle: \"Active implementation plan\",\n\t\t\t\tlines: [options.statusText],\n\t\t\t\titems: [\n\t\t\t\t\t{ id: \"show\", label: \"Show active implementation plan\", action: \"show\" },\n\t\t\t\t\t{ id: \"export\", label: \"Export plan\u2026\", to: \"export\" },\n\t\t\t\t\t{ id: \"settings\", label: \"Settings\", action: \"settings\" },\n\t\t\t\t\t{ id: \"start-new\", label: \"Start a new plan\", action: \"start-new\" },\n\t\t\t\t\t{ id: \"clear\", label: \"Clear active implementation plan\", action: \"clear\" },\n\t\t\t\t],\n\t\t\t\thint: \"close\",\n\t\t\t}),\n\t\t\texport: () => planExportInputScreen(options.getExportDestination),\n\t\t},\n\t\tactions: {\n\t\t\tshow: async () => {\n\t\t\t\toptions.show();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\texport: async ({ value, signal }) =>\n\t\t\t\t(await options.exportPlan(value ?? \"\", signal)) ? { kind: \"close\" } : { kind: \"rejected\" },\n\t\t\tsettings: async ({ signal }) => {\n\t\t\t\tconst close = await options.settings(signal);\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\treturn close ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\t\"start-new\": async () => {\n\t\t\t\toptions.startNew();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\tclear: async () => {\n\t\t\t\toptions.clear();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t},\n\t});\n\tawait runMenu(ctx, menu, {\n\t\tgetState: () => undefined,\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n}\n", "import type { PlanExportDestination } from \"./plan-export.js\";\n\nexport type PlanExportDestinationProvider = () => PlanExportDestination;\n\nexport function planExportInputScreen(getDestination: PlanExportDestinationProvider) {\n\tconst destination = getDestination();\n\treturn {\n\t\tkind: \"input\" as const,\n\t\ttitle: \"Export plan\",\n\t\tlines: [\n\t\t\t\"Existing paths are never overwritten.\",\n\t\t\t`Default: ${destination.configuredPath}`,\n\t\t\t`Resolves to: ${destination.resolvedPath}`,\n\t\t],\n\t\tplaceholder: destination.configuredPath,\n\t\taction: \"export\" as const,\n\t\thint: \"back\" as const,\n\t};\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport {\n\tcreateImplementationOptions,\n\ttype ImplementationOptionAction,\n} from \"./implementation-options.js\";\nimport { type PlanExportDestinationProvider, planExportInputScreen } from \"./plan-export-screen.js\";\nimport type { ImplementationPreferences } from \"./settings.js\";\n\ninterface ReadyPlanMenuOptions {\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\timplementationPreferences?: ImplementationPreferences;\n\timplementationOutcome(): string;\n\tgetExportDestination: PlanExportDestinationProvider;\n\timplementHere(\n\t\tpreferences?: ImplementationPreferences,\n\t\tsignal?: AbortSignal,\n\t): void | Promise<void>;\n\timplementFresh(\n\t\tsignal: AbortSignal,\n\t\tpreferences?: ImplementationPreferences,\n\t): void | Promise<void>;\n\texportPlan(path: string, signal: AbortSignal): Promise<boolean>;\n\tsave(): void;\n\tstay(): void;\n\texit(): void;\n}\n\ninterface PlanMenuOptions extends ReadyPlanMenuOptions {\n\tstatusText: string;\n\thasReadyPlan: boolean;\n\tshow(): void;\n\tfinalize(): void;\n}\n\nexport function showPlanModeMenu(ctx: ExtensionContext, options: PlanMenuOptions) {\n\treturn showActions(ctx, options, options);\n}\n\nexport function showReadyPlanMenu(ctx: ExtensionContext, options: ReadyPlanMenuOptions) {\n\treturn showActions(ctx, options);\n}\n\nasync function showActions(\n\tctx: ExtensionContext,\n\toptions: ReadyPlanMenuOptions,\n\tcurrent?: PlanMenuOptions,\n) {\n\tconst implementation = createImplementationOptions(ctx, options.implementationPreferences);\n\tconst ready = current?.hasReadyPlan ?? true;\n\ttype Screen = \"main\" | \"export\" | \"implementation-options\" | \"implementation-model\";\n\ttype Action =\n\t\t| ImplementationOptionAction\n\t\t| \"show\"\n\t\t| \"finalize\"\n\t\t| \"implement-here\"\n\t\t| \"implement-fresh\"\n\t\t| \"export\"\n\t\t| \"save\"\n\t\t| \"stay\"\n\t\t| \"exit\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionContext>({\n\t\tstart: \"main\",\n\t\tscreens: {\n\t\t\t...implementation.screens,\n\t\t\tmain: () => ({\n\t\t\t\tkind: \"actions\",\n\t\t\t\ttitle: current ? \"Plan mode\" : \"Proposed plan ready. What next?\",\n\t\t\t\tlines: [\n\t\t\t\t\t...(current ? [current.statusText] : []),\n\t\t\t\t\t...(ready\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\"Implement here keeps this planning conversation.\",\n\t\t\t\t\t\t\t\t\"Start fresh transfers only the approved plan to a new session.\",\n\t\t\t\t\t\t\t\toptions.implementationOutcome(),\n\t\t\t\t\t\t\t\timplementation.summary(),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t\t\t],\n\t\t\t\titems: ready\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t...(current\n\t\t\t\t\t\t\t\t? [{ id: \"show\", label: \"Show latest proposed plan\", action: \"show\" as const }]\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: \"implement-here\",\n\t\t\t\t\t\t\t\tlabel: \"Implement here\",\n\t\t\t\t\t\t\t\tdescription: \"Continue in this session with the planning conversation.\",\n\t\t\t\t\t\t\t\taction: \"implement-here\",\n\t\t\t\t\t\t\t\tbusyLabel: \"Preparing implementation\u2026\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: \"implement-fresh\",\n\t\t\t\t\t\t\t\tlabel: \"Start fresh and implement\",\n\t\t\t\t\t\t\t\tdescription: \"Open a new linked session; transfer only the approved plan.\",\n\t\t\t\t\t\t\t\taction: \"implement-fresh\",\n\t\t\t\t\t\t\t\tbusyLabel: \"Starting fresh implementation session\u2026\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: \"implementation-options\",\n\t\t\t\t\t\t\t\tlabel: \"Implementation options\u2026\",\n\t\t\t\t\t\t\t\tto: \"implementation-options\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ id: \"export\", label: \"Export plan\u2026\", to: \"export\" },\n\t\t\t\t\t\t\t{ id: \"save\", label: \"Save for later\", action: \"save\" },\n\t\t\t\t\t\t\t{ id: \"stay\", label: \"Stay in Plan mode\", action: \"stay\" },\n\t\t\t\t\t\t\t{ id: \"exit\", label: \"Discard plan and exit\", action: \"exit\" },\n\t\t\t\t\t\t]\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t{ id: \"finalize\", label: \"Request final plan\", action: \"finalize\" },\n\t\t\t\t\t\t\t{ id: \"stay\", label: \"Stay in Plan mode\", action: \"stay\" },\n\t\t\t\t\t\t\t{ id: \"exit\", label: \"Exit Plan mode\", action: \"exit\" },\n\t\t\t\t\t\t],\n\t\t\t\thint: \"close\",\n\t\t\t}),\n\t\t\texport: () => planExportInputScreen(options.getExportDestination),\n\t\t},\n\t\tactions: {\n\t\t\t...implementation.actions,\n\t\t\tshow: async () => {\n\t\t\t\tcurrent?.show();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\tfinalize: async () => {\n\t\t\t\tcurrent?.finalize();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\t\"implement-here\": async ({ signal }) => {\n\t\t\t\tawait options.implementHere(implementation.get(), signal);\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\t\"implement-fresh\": async ({ signal }) => {\n\t\t\t\tawait options.implementFresh(signal, implementation.get());\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\texport: async ({ value, signal }) =>\n\t\t\t\t(await options.exportPlan(value ?? \"\", signal)) ? { kind: \"close\" } : { kind: \"rejected\" },\n\t\t\tsave: async () => {\n\t\t\t\toptions.save();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\tstay: async () => {\n\t\t\t\toptions.stay();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\texit: async () => {\n\t\t\t\toptions.exit();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t},\n\t});\n\tawait runMenu(ctx, menu, {\n\t\tgetState: () => undefined,\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { ChoiceScreen, SettingsScreen } from \"@narumitw/pi-tui-kit\";\nimport { safeImplementationText as terminalText } from \"./implementation-preferences.js\";\nimport { type ImplementationPreferences, PLAN_MODE_THINKING_LEVELS } from \"./settings.js\";\n\nexport function implementationModelLabel(model: ImplementationPreferences[\"implementationModel\"]) {\n\treturn model ? terminalText(`${model.provider} / ${model.id}`) : \"Use current\";\n}\n\nexport function implementationSummary(preferences: ImplementationPreferences) {\n\treturn `Model: ${implementationModelLabel(preferences.implementationModel)} \u00B7 Thinking: ${preferences.implementationThinkingLevel && preferences.implementationThinkingLevel !== \"inherit\" ? preferences.implementationThinkingLevel : \"Use normal behavior\"}`;\n}\n\nexport type ImplementationOptionAction =\n\t| \"open-implementation-model\"\n\t| \"set-implementation-model\"\n\t| \"set-implementation-thinking\";\n\nexport function implementationSettingItems(\n\tpreferences: ImplementationPreferences,\n): SettingsScreen<ImplementationOptionAction>[\"items\"] {\n\treturn [\n\t\t{\n\t\t\tid: \"implementationModel\",\n\t\t\tlabel: \"Implementation model\",\n\t\t\tcurrentValue: implementationModelLabel(preferences.implementationModel),\n\t\t\tdescription:\n\t\t\t\t\"Select the model only when implementation starts; never switch back automatically.\",\n\t\t\taction: \"open-implementation-model\",\n\t\t},\n\t\t{\n\t\t\tid: \"implementationThinkingLevel\",\n\t\t\tlabel: \"Implementation thinking\",\n\t\t\tcurrentValue: preferences.implementationThinkingLevel ?? \"inherit\",\n\t\t\tvalues: PLAN_MODE_THINKING_LEVELS,\n\t\t\tdescription:\n\t\t\t\t\"inherit preserves normal behavior, including restoration of Plan thinking. Explicit levels apply after model selection and are clamped by Pi.\",\n\t\t\taction: \"set-implementation-thinking\",\n\t\t},\n\t];\n}\n\nexport function createImplementationModelPicker(ctx: ExtensionContext) {\n\t// Snapshot Pi's scoped catalogue without network refresh or auth execution.\n\t// Unlike /model, this picker stages a preference and never persists Pi defaults.\n\tconst models = ctx.scopedModels?.length\n\t\t? ctx.scopedModels.map(({ model }) => model)\n\t\t: ctx.modelRegistry.getAvailable();\n\tconst byId = new Map(\n\t\tmodels.map((model, index) => [\n\t\t\t`implementation-model:${index}`,\n\t\t\t{ provider: model.provider, id: model.id },\n\t\t]),\n\t);\n\treturn {\n\t\tselection(itemId: string) {\n\t\t\treturn itemId === \"implementation-current\" ? null : byId.get(itemId);\n\t\t},\n\t\tscreen(preferences: ImplementationPreferences): ChoiceScreen<\"set-implementation-model\"> {\n\t\t\treturn {\n\t\t\t\tkind: \"choice\",\n\t\t\t\ttitle: \"Implementation model\",\n\t\t\t\tenableSearch: true,\n\t\t\t\tviewportSize: 10,\n\t\t\t\thint: \"back\",\n\t\t\t\taction: \"set-implementation-model\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Use current makes no model change. Reopen this menu to refresh the catalogue.\",\n\t\t\t\t\t\"Implement here sends the planning conversation to the selected provider; fresh transfers only the approved plan and normal destination resources.\",\n\t\t\t\t\t`Selected: ${implementationModelLabel(preferences.implementationModel)}`,\n\t\t\t\t],\n\t\t\t\titems: [\n\t\t\t\t\t{ id: \"implementation-current\", label: \"Use current\" },\n\t\t\t\t\t...[...byId].map(([id, model]) => ({ id, label: implementationModelLabel(model) })),\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t};\n}\n\n/** Local draft lives only as long as the owning action menu. */\nexport function createImplementationOptions(\n\tctx: ExtensionContext,\n\tinitial: ImplementationPreferences = {},\n) {\n\tlet preferences = { ...initial };\n\tlet picker: ReturnType<typeof createImplementationModelPicker> | undefined;\n\treturn {\n\t\tget: () => preferences,\n\t\tsummary: () => implementationSummary(preferences),\n\t\tscreens: {\n\t\t\t\"implementation-options\": (): SettingsScreen<ImplementationOptionAction> => ({\n\t\t\t\tkind: \"settings\",\n\t\t\t\ttitle: \"Implementation options\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Applies to both implementation actions in this menu only.\",\n\t\t\t\t\t\"Changes take effect only when implementation starts. No automatic restoration afterwards.\",\n\t\t\t\t\t`Current model: ${implementationModelLabel(ctx.model)}`,\n\t\t\t\t\t\"inherit keeps normal thinking behavior, not necessarily the temporary Plan thinking level.\",\n\t\t\t\t],\n\t\t\t\titems: implementationSettingItems(preferences),\n\t\t\t}),\n\t\t\t\"implementation-model\": () => {\n\t\t\t\tpicker ??= createImplementationModelPicker(ctx);\n\t\t\t\treturn picker.screen(preferences);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\t\"open-implementation-model\": async () => ({\n\t\t\t\tkind: \"to\" as const,\n\t\t\t\tscreen: \"implementation-model\" as const,\n\t\t\t}),\n\t\t\t\"set-implementation-model\": async ({ itemId }: { itemId: string }) => {\n\t\t\t\tconst selected = picker?.selection(itemId);\n\t\t\t\tif (selected === undefined) return { kind: \"rejected\" as const };\n\t\t\t\tpreferences = { ...preferences, implementationModel: selected ?? undefined };\n\t\t\t\treturn { kind: \"back\" as const };\n\t\t\t},\n\t\t\t\"set-implementation-thinking\": async ({ value }: { value?: string }) => {\n\t\t\t\tconst level = PLAN_MODE_THINKING_LEVELS.find((level) => level === value);\n\t\t\t\tif (!level) return { kind: \"rejected\" as const };\n\t\t\t\tpreferences = { ...preferences, implementationThinkingLevel: level };\n\t\t\t\treturn { kind: \"stay\" as const };\n\t\t\t},\n\t\t},\n\t};\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\n\nexport interface PlanLaunchTool {\n\tname: string;\n\tlabel?: string;\n\tdescription: string;\n\tsearchText: string;\n\tdisabled: boolean;\n\tdisabledReason?: string;\n}\n\ninterface PlanLaunchMenuOptions {\n\tstatusText: string;\n\ttoolSummary(selectedNames: ReadonlySet<string>): string;\n\tgetSelectedNames(): ReadonlySet<string>;\n\ttools: readonly PlanLaunchTool[];\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tinitialScreen?: \"main\" | \"tools\";\n\tstart(signal: AbortSignal): void;\n\tstartWithTools(toolNames: string[], signal: AbortSignal): void;\n\tsettings(signal: AbortSignal): Promise<boolean>;\n}\n\nexport async function showPlanLaunchMenu(ctx: ExtensionContext, options: PlanLaunchMenuOptions) {\n\ttype Screen = \"main\" | \"tools\" | \"help\";\n\ttype Action = \"start\" | \"toggle-tool\" | \"start-with-tools\" | \"settings\";\n\tconst selectedNames = new Set(options.getSelectedNames());\n\tconst toolItems = options.tools.map((tool, index) => ({\n\t\tid: `plan-tool:${index}`,\n\t\ttool,\n\t}));\n\tconst toolsByItemId = new Map(toolItems.map(({ id, tool }) => [id, tool]));\n\tlet draftChanged = false;\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionContext>({\n\t\tstart: options.initialScreen ?? \"main\",\n\t\tscreens: {\n\t\t\tmain: () => ({\n\t\t\t\tkind: \"actions\",\n\t\t\t\ttitle: \"Plan mode\",\n\t\t\t\tlines: [options.statusText, options.toolSummary(selectedNames)],\n\t\t\t\titems: [\n\t\t\t\t\t{ id: \"start\", label: \"Start Plan mode\", action: \"start\" },\n\t\t\t\t\t{ id: \"tools\", label: \"Choose tools, then start\u2026\", to: \"tools\" },\n\t\t\t\t\t{ id: \"settings\", label: \"Settings\", action: \"settings\" },\n\t\t\t\t\t{ id: \"help\", label: \"How Plan mode works\", to: \"help\" },\n\t\t\t\t],\n\t\t\t\thint: \"close\",\n\t\t\t}),\n\t\t\ttools: () => ({\n\t\t\t\tkind: \"multiSelect\",\n\t\t\t\ttitle: \"Choose Plan policy allowlist\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Policy changes apply only when you start Plan mode; first use may also reveal Plan helpers.\",\n\t\t\t\t\toptions.toolSummary(selectedNames),\n\t\t\t\t\t\"Active tools can be chosen now; retained names resolve before the first request.\",\n\t\t\t\t\t\"Plan mode never activates tools, and non-built-ins run at user risk.\",\n\t\t\t\t],\n\t\t\t\tenableSearch: true,\n\t\t\t\tviewportSize: 10,\n\t\t\t\titems: toolItems.map(({ id, tool }) => ({\n\t\t\t\t\tid,\n\t\t\t\t\tlabel: tool.label ?? tool.name,\n\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\tsearchText: tool.searchText,\n\t\t\t\t\tselected: selectedNames.has(tool.name),\n\t\t\t\t\tdisabled: tool.disabled,\n\t\t\t\t\tdisabledReason: tool.disabledReason,\n\t\t\t\t})),\n\t\t\t\taction: \"toggle-tool\",\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"start-with-tools\",\n\t\t\t\t\t\tlabel: \"Done \u2014 start with this policy\",\n\t\t\t\t\t\taction: \"start-with-tools\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t\thelp: () => ({\n\t\t\t\tkind: \"detail\",\n\t\t\t\ttitle: \"How Plan mode works\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Plan mode uses read-only exploration to understand the project before implementation.\",\n\t\t\t\t\t\"The agent can ask important decision questions, then returns a complete implementation-ready plan.\",\n\t\t\t\t\t\"File mutation stays blocked until you explicitly choose to implement the completed plan.\",\n\t\t\t\t],\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t},\n\t\tactions: {\n\t\t\tstart: async ({ signal }) => {\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\toptions.start(signal);\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\t\"toggle-tool\": async ({ itemId, selected, signal }) => {\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\tconst tool = itemId ? toolsByItemId.get(itemId) : undefined;\n\t\t\t\tif (!tool || tool.disabled) return { kind: \"rejected\" };\n\t\t\t\tif (selected) selectedNames.add(tool.name);\n\t\t\t\telse selectedNames.delete(tool.name);\n\t\t\t\tdraftChanged = true;\n\t\t\t\treturn { kind: \"stay\" };\n\t\t\t},\n\t\t\t\"start-with-tools\": async ({ signal }) => {\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\toptions.startWithTools(Array.from(selectedNames), signal);\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\tsettings: async ({ signal }) => {\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\tconst close = await options.settings(signal);\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\tif (close) return { kind: \"close\" };\n\t\t\t\tif (!draftChanged) {\n\t\t\t\t\tselectedNames.clear();\n\t\t\t\t\tfor (const name of options.getSelectedNames()) selectedNames.add(name);\n\t\t\t\t}\n\t\t\t\treturn { kind: \"stay\" };\n\t\t\t},\n\t\t},\n\t});\n\tawait runMenu(ctx, menu, {\n\t\tgetState: () => undefined,\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport {\n\tcreateImplementationOptions,\n\ttype ImplementationOptionAction,\n} from \"./implementation-options.js\";\nimport { type PlanExportDestinationProvider, planExportInputScreen } from \"./plan-export-screen.js\";\nimport type { ImplementationPreferences } from \"./settings.js\";\n\ninterface SavedPlanMenuOptions {\n\tstatusText: string;\n\timplementationOutcome(): string;\n\tgetExportDestination: PlanExportDestinationProvider;\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tshow(): void;\n\timplementationPreferences?: ImplementationPreferences;\n\timplementHere(\n\t\tpreferences?: ImplementationPreferences,\n\t\tsignal?: AbortSignal,\n\t): void | Promise<void>;\n\timplementFresh(\n\t\tsignal: AbortSignal,\n\t\tpreferences?: ImplementationPreferences,\n\t): void | Promise<void>;\n\texportPlan(path: string, signal: AbortSignal): Promise<boolean>;\n\tsettings(signal: AbortSignal): Promise<boolean>;\n\tclear(): void;\n}\n\nexport async function showSavedPlanMenu(ctx: ExtensionContext, options: SavedPlanMenuOptions) {\n\tif (!ctx.hasUI) {\n\t\tthrow new Error(\n\t\t\t`${options.statusText} Use /plan show, /plan implement, /plan export, or /plan exit.`,\n\t\t);\n\t}\n\tconst implementation = createImplementationOptions(ctx, options.implementationPreferences);\n\ttype Screen = \"saved\" | \"export\" | \"implementation-options\" | \"implementation-model\";\n\ttype Action =\n\t\t| ImplementationOptionAction\n\t\t| \"show\"\n\t\t| \"implement-here\"\n\t\t| \"implement-fresh\"\n\t\t| \"export\"\n\t\t| \"settings\"\n\t\t| \"clear\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionContext>({\n\t\tstart: \"saved\",\n\t\tscreens: {\n\t\t\t...implementation.screens,\n\t\t\tsaved: () => ({\n\t\t\t\tkind: \"actions\",\n\t\t\t\ttitle: \"Saved plan\",\n\t\t\t\tlines: [\n\t\t\t\t\toptions.statusText,\n\t\t\t\t\t\"Implement here keeps this planning conversation.\",\n\t\t\t\t\t\"Start fresh transfers only the approved plan to a new session.\",\n\t\t\t\t\toptions.implementationOutcome(),\n\t\t\t\t\timplementation.summary(),\n\t\t\t\t],\n\t\t\t\titems: [\n\t\t\t\t\t{ id: \"show\", label: \"Show saved plan\", action: \"show\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"implement-here\",\n\t\t\t\t\t\tlabel: \"Implement here\",\n\t\t\t\t\t\tdescription: \"Continue in this session with the planning conversation.\",\n\t\t\t\t\t\taction: \"implement-here\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"implement-fresh\",\n\t\t\t\t\t\tlabel: \"Start fresh and implement\",\n\t\t\t\t\t\tdescription: \"Open a new linked session; transfer only the approved plan.\",\n\t\t\t\t\t\taction: \"implement-fresh\",\n\t\t\t\t\t\tbusyLabel: \"Starting fresh implementation session\u2026\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"implementation-options\",\n\t\t\t\t\t\tlabel: \"Implementation options\u2026\",\n\t\t\t\t\t\tto: \"implementation-options\",\n\t\t\t\t\t},\n\t\t\t\t\t{ id: \"export\", label: \"Export plan\u2026\", to: \"export\" },\n\t\t\t\t\t{ id: \"settings\", label: \"Settings\", action: \"settings\" },\n\t\t\t\t\t{ id: \"clear\", label: \"Clear saved plan\", action: \"clear\" },\n\t\t\t\t],\n\t\t\t\thint: \"close\",\n\t\t\t}),\n\t\t\texport: () => planExportInputScreen(options.getExportDestination),\n\t\t},\n\t\tactions: {\n\t\t\t...implementation.actions,\n\t\t\tshow: async () => {\n\t\t\t\toptions.show();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\t\"implement-here\": async ({ signal }) => {\n\t\t\t\tawait options.implementHere(implementation.get(), signal);\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\t\"implement-fresh\": async ({ signal }) => {\n\t\t\t\tawait options.implementFresh(signal, implementation.get());\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\texport: async ({ value, signal }) =>\n\t\t\t\t(await options.exportPlan(value ?? \"\", signal)) ? { kind: \"close\" } : { kind: \"rejected\" },\n\t\t\tsettings: async ({ signal }) => {\n\t\t\t\tconst close = await options.settings(signal);\n\t\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" };\n\t\t\t\treturn close ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\tclear: async () => {\n\t\t\t\toptions.clear();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t},\n\t});\n\tawait runMenu(ctx, menu, {\n\t\tgetState: () => undefined,\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n}\n", "import type { ExtensionContext, ToolInfo } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, type RunMenuResult, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { PLAN_MODE_COMPLETE_TOOL_NAME } from \"./completion-tool.js\";\nimport {\n\tcreateImplementationModelPicker,\n\ttype ImplementationOptionAction,\n\timplementationSettingItems,\n} from \"./implementation-options.js\";\nimport { retentionLabel } from \"./implementation-retention.js\";\nimport { planExportDestination } from \"./plan-export.js\";\nimport { PLAN_MODE_QUESTION_TOOL_NAME } from \"./question-tool.js\";\nimport {\n\tconfiguredImplementationPlanRetention,\n\tconfiguredPlanExportPath,\n\tconfiguredPlanModeToggleShortcut,\n\tIMPLEMENTATION_PLAN_RETENTIONS,\n\tnormalizeKeyId,\n\tPLAN_MODE_THINKING_LEVELS,\n\ttype PlanModeSettings,\n\ttype PlanModeSettingsLoadResult,\n\ttype PlanModeSettingsPatch,\n\tplanModeSettingsPath,\n\treadPlanModeSettings,\n\ttype UpdatePlanModeSettingsOptions,\n\tupdatePlanModeSettings,\n} from \"./settings.js\";\nimport { canSelectToolInPlanMode } from \"./tool-policy.js\";\nimport { defaultPlanModeToolNames, toolPolicyLabel } from \"./tool-selection.js\";\n\ninterface SettingsMenuState {\n\tkind: \"valid\" | \"invalid\";\n\tsettings: PlanModeSettings;\n\tnotice?: string;\n\treason?: string;\n}\n\nexport interface PlanModeSettingsMenuOptions {\n\ttools: readonly ToolInfo[];\n\tactiveToolNames?: readonly string[];\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tsettingsPath?: string;\n\tlegacySettingsPath?: string;\n\treadSettings?: (settingsPath?: string) => Promise<PlanModeSettingsLoadResult>;\n\tupdateSettings?: (\n\t\tpatch: PlanModeSettingsPatch,\n\t\toptions?: UpdatePlanModeSettingsOptions,\n\t) => Promise<PlanModeSettings>;\n\tonSaved(settings: PlanModeSettings): void;\n}\n\ntype Screen = \"settings\" | \"tools\" | \"export\" | \"shortcut\" | \"implementation-model\";\ntype Action =\n\t| ImplementationOptionAction\n\t| \"set-thinking\"\n\t| \"open-tools\"\n\t| \"toggle-tool\"\n\t| \"reset-tools\"\n\t| \"set-retention\"\n\t| \"open-export\"\n\t| \"set-export\"\n\t| \"open-shortcut\"\n\t| \"set-shortcut\";\n\nexport async function showPlanModeSettings(\n\tctx: ExtensionContext,\n\toptions: PlanModeSettingsMenuOptions,\n): Promise<RunMenuResult> {\n\tconst settingsPath = options.settingsPath ?? planModeSettingsPath();\n\tconst readSettings = options.readSettings ?? readPlanModeSettings;\n\tconst updateSettings = options.updateSettings ?? updatePlanModeSettings;\n\tconst activeToolNames = new Set(\n\t\toptions.activeToolNames ?? options.tools.map((tool) => tool.name),\n\t);\n\tconst tools = options.tools.filter(\n\t\t(tool) =>\n\t\t\ttool.name !== PLAN_MODE_QUESTION_TOOL_NAME && tool.name !== PLAN_MODE_COMPLETE_TOOL_NAME,\n\t);\n\tconst toolItemIds = new Map(\n\t\ttools.map((tool, index) => [tool.name, `plan-settings-tool:${index}`]),\n\t);\n\tconst toolsByItemId = new Map(tools.map((tool) => [toolItemIds.get(tool.name) as string, tool]));\n\n\tconst loadState = async (): Promise<SettingsMenuState> => {\n\t\tconst loaded = await readSettings(options.settingsPath);\n\t\tif (loaded.kind === \"invalid\") {\n\t\t\treturn {\n\t\t\t\tkind: \"invalid\",\n\t\t\t\tsettings: { thinkingLevel: \"inherit\" },\n\t\t\t\tnotice: loaded.notice,\n\t\t\t\treason: loaded.reason,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tkind: \"valid\",\n\t\t\tsettings: loaded.kind === \"loaded\" ? loaded.settings : { thinkingLevel: \"inherit\" },\n\t\t\tnotice: loaded.notice,\n\t\t};\n\t};\n\n\tlet implementationPicker: ReturnType<typeof createImplementationModelPicker> | undefined;\n\tconst menu = defineMenu<SettingsMenuState, Screen, Action, ExtensionContext>({\n\t\tstart: \"settings\",\n\t\tscreens: {\n\t\t\tsettings: ({ state }) =>\n\t\t\t\tstate.kind === \"invalid\"\n\t\t\t\t\t? invalidScreen(settingsPath, state)\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tkind: \"settings\",\n\t\t\t\t\t\t\ttitle: \"Plan Mode Settings\",\n\t\t\t\t\t\t\tlines: settingsLines(settingsPath, state.notice),\n\t\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"thinkingLevel\",\n\t\t\t\t\t\t\t\t\tlabel: \"Plan thinking\",\n\t\t\t\t\t\t\t\t\tdescription: \"Set the thinking level when the next Plan workflow starts.\",\n\t\t\t\t\t\t\t\t\tcurrentValue: state.settings.thinkingLevel,\n\t\t\t\t\t\t\t\t\tvalues: PLAN_MODE_THINKING_LEVELS,\n\t\t\t\t\t\t\t\t\taction: \"set-thinking\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"defaultPlanTools\",\n\t\t\t\t\t\t\t\t\tlabel: \"Plan policy tools\",\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\"Choose active tools or retain names to resolve before the first request.\",\n\t\t\t\t\t\t\t\t\tcurrentValue: defaultToolsValue(state.settings.defaultPlanTools),\n\t\t\t\t\t\t\t\t\taction: \"open-tools\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"implementationPlanRetention\",\n\t\t\t\t\t\t\t\t\tlabel: \"Plan reinjection\",\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\"Choose how long Plan mode restores the exact plan when ordinary context no longer contains it.\",\n\t\t\t\t\t\t\t\t\tcurrentValue: retentionLabel(\n\t\t\t\t\t\t\t\t\t\tconfiguredImplementationPlanRetention(state.settings),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tvalues: IMPLEMENTATION_PLAN_RETENTIONS.map(retentionLabel),\n\t\t\t\t\t\t\t\t\taction: \"set-retention\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"defaultPlanExportPath\",\n\t\t\t\t\t\t\t\t\tlabel: \"Export destination\",\n\t\t\t\t\t\t\t\t\tdescription: \"Set the destination used when an export omits its path.\",\n\t\t\t\t\t\t\t\t\tcurrentValue: safeTerminalText(configuredPlanExportPath(state.settings)),\n\t\t\t\t\t\t\t\t\taction: \"open-export\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"toggleShortcut\",\n\t\t\t\t\t\t\t\t\tlabel: \"Plan mode shortcut\",\n\t\t\t\t\t\t\t\t\tdescription: \"Set the global shortcut used to toggle Plan mode.\",\n\t\t\t\t\t\t\t\t\tcurrentValue: configuredPlanModeToggleShortcut(state.settings) ?? \"none\",\n\t\t\t\t\t\t\t\t\taction: \"open-shortcut\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...implementationSettingItems(state.settings),\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\"implementation-model\": ({ state }) => {\n\t\t\t\timplementationPicker ??= createImplementationModelPicker(ctx);\n\t\t\t\treturn implementationPicker.screen(state.settings);\n\t\t\t},\n\t\t\ttools: ({ state }) => ({\n\t\t\t\tkind: \"multiSelect\",\n\t\t\t\ttitle: \"Default Plan policy allowlist\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Changes apply when a later Plan workflow starts; model-visible tools stay unchanged.\",\n\t\t\t\t\t\"Retained inactive names resolve before that workflow's first request.\",\n\t\t\t\t\t\"Plan mode never activates tools, and non-built-ins run at user risk.\",\n\t\t\t\t],\n\t\t\t\tenableSearch: true,\n\t\t\t\tviewportSize: 10,\n\t\t\t\titems: defaultToolItems(\n\t\t\t\t\ttools,\n\t\t\t\t\tstate.settings.defaultPlanTools,\n\t\t\t\t\tactiveToolNames,\n\t\t\t\t\ttoolItemIds,\n\t\t\t\t),\n\t\t\t\taction: \"toggle-tool\",\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"reset-tools\",\n\t\t\t\t\t\tlabel: \"Use automatic safe built-ins\",\n\t\t\t\t\t\taction: \"reset-tools\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t\texport: ({ state }) => {\n\t\t\t\tconst configured = configuredPlanExportPath(state.settings);\n\t\t\t\tconst destination = planExportDestination(configured, ctx.cwd);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"input\",\n\t\t\t\t\ttitle: \"Export destination\",\n\t\t\t\t\tlines: [\n\t\t\t\t\t\t`Configured: ${destination.configuredPath}`,\n\t\t\t\t\t\t`Resolves here to: ${destination.resolvedPath}`,\n\t\t\t\t\t\t\"Submit an empty value to reset to PLAN.md. Changes affect the next export.\",\n\t\t\t\t\t],\n\t\t\t\t\tplaceholder: configured,\n\t\t\t\t\taction: \"set-export\",\n\t\t\t\t\thint: \"back\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tshortcut: ({ state }) => ({\n\t\t\t\tkind: \"input\",\n\t\t\t\ttitle: \"Plan mode shortcut\",\n\t\t\t\tlines: [\n\t\t\t\t\t`Configured: ${configuredPlanModeToggleShortcut(state.settings) ?? \"none\"}`,\n\t\t\t\t\t\"Use Pi key identifiers.\",\n\t\t\t\t\t\"Submit an empty value to clear the shortcut.\",\n\t\t\t\t\t\"When unset, Plan mode has no global shortcut.\",\n\t\t\t\t],\n\t\t\t\tplaceholder: configuredPlanModeToggleShortcut(state.settings) ?? \"\",\n\t\t\t\taction: \"set-shortcut\",\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t},\n\t\tactions: {\n\t\t\t\"open-implementation-model\": async () => ({ kind: \"to\", screen: \"implementation-model\" }),\n\t\t\t\"set-implementation-model\": async ({ ctx: actionCtx, itemId, signal }) => {\n\t\t\t\tconst model = implementationPicker?.selection(itemId);\n\t\t\t\tif (model === undefined) return { kind: \"rejected\" };\n\t\t\t\tconst result = await savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ implementationModel: model },\n\t\t\t\t\tsignal,\n\t\t\t\t\t\"Implementation model saved. Applies when implementation starts.\",\n\t\t\t\t);\n\t\t\t\treturn result.kind === \"stay\" ? { kind: \"back\" } : result;\n\t\t\t},\n\t\t\t\"set-implementation-thinking\": async ({ ctx: actionCtx, value, signal }) => {\n\t\t\t\tconst level = PLAN_MODE_THINKING_LEVELS.find((level) => level === value);\n\t\t\t\tif (!level) return { kind: \"rejected\" };\n\t\t\t\treturn savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ implementationThinkingLevel: level },\n\t\t\t\t\tsignal,\n\t\t\t\t\t\"Implementation thinking saved. Applies when implementation starts.\",\n\t\t\t\t);\n\t\t\t},\n\t\t\t\"set-thinking\": async ({ ctx: actionCtx, value, signal }) => {\n\t\t\t\tif (\n\t\t\t\t\t!PLAN_MODE_THINKING_LEVELS.includes(value as (typeof PLAN_MODE_THINKING_LEVELS)[number])\n\t\t\t\t) {\n\t\t\t\t\treturn { kind: \"rejected\" };\n\t\t\t\t}\n\t\t\t\treturn savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ thinkingLevel: value as PlanModeSettings[\"thinkingLevel\"] },\n\t\t\t\t\tsignal,\n\t\t\t\t\t`Plan mode thinking level: ${value}. Applies to the next Plan workflow.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\t\"open-tools\": async () => ({ kind: \"to\", screen: \"tools\" }),\n\t\t\t\"set-retention\": async ({ ctx: actionCtx, value, signal }) => {\n\t\t\t\tconst implementationPlanRetention = retentionFromLabel(value);\n\t\t\t\tif (!implementationPlanRetention) return { kind: \"rejected\" };\n\t\t\t\treturn savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ implementationPlanRetention },\n\t\t\t\t\tsignal,\n\t\t\t\t\t`Plan reinjection: ${retentionLabel(implementationPlanRetention)}. Applies to the next Implement action.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\t\"open-export\": async () => ({ kind: \"to\", screen: \"export\" }),\n\t\t\t\"set-export\": async ({ ctx: actionCtx, value, signal }) => {\n\t\t\t\tconst defaultPlanExportPath = value?.trim() || null;\n\t\t\t\tconst result = await savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ defaultPlanExportPath },\n\t\t\t\t\tsignal,\n\t\t\t\t\tdefaultPlanExportPath\n\t\t\t\t\t\t? `Default Plan export destination: ${safeTerminalText(defaultPlanExportPath)}.`\n\t\t\t\t\t\t: \"Default Plan export destination reset to PLAN.md.\",\n\t\t\t\t);\n\t\t\t\treturn result.kind === \"stay\" ? { kind: \"to\", screen: \"settings\" } : result;\n\t\t\t},\n\t\t\t\"open-shortcut\": async () => ({ kind: \"to\", screen: \"shortcut\" }),\n\t\t\t\"set-shortcut\": async ({ ctx: actionCtx, value, signal }) => {\n\t\t\t\tconst raw = value?.trim() || null;\n\t\t\t\tif (raw && !normalizeKeyId(raw)) {\n\t\t\t\t\tactionCtx.ui.notify(\n\t\t\t\t\t\t`Invalid key identifier: ${safeTerminalText(raw)}. Use Pi key identifiers like ctrl+alt+p.`,\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t);\n\t\t\t\t\treturn { kind: \"stay\" as const };\n\t\t\t\t}\n\t\t\t\tconst toggleShortcut = raw as PlanModeSettingsPatch[\"toggleShortcut\"];\n\t\t\t\tconst result = await savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ toggleShortcut },\n\t\t\t\t\tsignal,\n\t\t\t\t\ttoggleShortcut\n\t\t\t\t\t\t? `Plan mode shortcut: ${safeTerminalText(toggleShortcut)}.`\n\t\t\t\t\t\t: \"Plan mode shortcut cleared (no global shortcut).\",\n\t\t\t\t);\n\t\t\t\treturn result.kind === \"stay\" ? { kind: \"to\", screen: \"settings\" } : result;\n\t\t\t},\n\t\t\t\"toggle-tool\": async ({ ctx: actionCtx, state, itemId, selected, signal }) => {\n\t\t\t\tconst tool = itemId ? toolsByItemId.get(itemId) : undefined;\n\t\t\t\tif (!tool || !activeToolNames.has(tool.name) || !canSelectToolInPlanMode(tool)) {\n\t\t\t\t\treturn { kind: \"rejected\" };\n\t\t\t\t}\n\t\t\t\tconst names = explicitToolNames(tools, state.settings.defaultPlanTools);\n\t\t\t\tconst next = selected\n\t\t\t\t\t? Array.from(new Set([...names, tool.name]))\n\t\t\t\t\t: names.filter((name) => name !== tool.name);\n\t\t\t\treturn savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ defaultPlanTools: next },\n\t\t\t\t\tsignal,\n\t\t\t\t\t`Default Plan policy: ${next.length === 0 ? \"no optional tools\" : `${next.length} allowed`}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\t\"reset-tools\": async ({ ctx: actionCtx, state, signal }) => {\n\t\t\t\tif (state.settings.defaultPlanTools === undefined) return { kind: \"stay\" };\n\t\t\t\treturn savePatch(\n\t\t\t\t\tactionCtx,\n\t\t\t\t\t{ defaultPlanTools: null },\n\t\t\t\t\tsignal,\n\t\t\t\t\t\"Default Plan-mode tools: automatic safe built-ins.\",\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn runMenu(ctx, menu, {\n\t\tgetState: loadState,\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n\n\tasync function savePatch(\n\t\tactionCtx: ExtensionContext,\n\t\tpatch: PlanModeSettingsPatch,\n\t\tsignal: AbortSignal,\n\t\tsuccessMessage: string,\n\t) {\n\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" as const };\n\t\ttry {\n\t\t\tconst saved = await updateSettings(patch, {\n\t\t\t\tsettingsPath: options.settingsPath,\n\t\t\t\tlegacySettingsPath: options.legacySettingsPath,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (options.isCurrent()) options.onSaved(saved);\n\t\t\tif (signal.aborted || !options.isCurrent()) return { kind: \"rejected\" as const };\n\t\t\tactionCtx.ui.notify(successMessage, \"info\");\n\t\t\treturn { kind: \"stay\" as const };\n\t\t} catch (error) {\n\t\t\tif (!signal.aborted && options.isCurrent()) {\n\t\t\t\tactionCtx.ui.notify(\n\t\t\t\t\t`Could not save Plan mode settings; the previous value remains: ${safeTerminalText(formatError(error))}`,\n\t\t\t\t\t\"error\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { kind: \"rejected\" as const };\n\t\t}\n\t}\n}\n\nfunction settingsLines(settingsPath: string, notice: string | undefined) {\n\treturn [\n\t\t`User settings \u00B7 ${safeTerminalText(settingsPath)}`,\n\t\t\"Plan defaults apply to the next workflow; reinjection and export choices apply to their next action.\",\n\t\t...(notice ? [safeTerminalText(notice)] : []),\n\t];\n}\n\nfunction invalidScreen(settingsPath: string, state: SettingsMenuState) {\n\treturn {\n\t\tkind: \"detail\" as const,\n\t\ttitle: \"Plan Mode Settings \u00B7 Read only\",\n\t\tlines: [\n\t\t\t`Invalid settings file. Fix ${safeTerminalText(settingsPath)} before saving.`,\n\t\t\tsafeTerminalText(state.reason ?? \"The settings file is invalid.\"),\n\t\t\t...(state.notice ? [safeTerminalText(state.notice)] : []),\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nfunction retentionFromLabel(value: string | undefined) {\n\treturn IMPLEMENTATION_PLAN_RETENTIONS.find((retention) => retentionLabel(retention) === value);\n}\n\nfunction defaultToolsValue(configured: string[] | undefined) {\n\tif (configured === undefined) return \"Automatic safe built-ins\";\n\tif (configured.length === 0) return \"No optional tools\";\n\treturn `${configured.length} selected`;\n}\n\nfunction defaultToolItems(\n\ttools: readonly ToolInfo[],\n\tconfigured: string[] | undefined,\n\tactiveToolNames: ReadonlySet<string>,\n\ttoolItemIds: ReadonlyMap<string, string>,\n) {\n\tconst selected = new Set(explicitToolNames(tools, configured));\n\tconst availableNames = new Set(tools.map((tool) => tool.name));\n\tconst items = tools.map((tool) => {\n\t\tconst active = activeToolNames.has(tool.name);\n\t\tconst selectable = active && canSelectToolInPlanMode(tool);\n\t\tconst policy = active\n\t\t\t? toolPolicyLabel(tool)\n\t\t\t: selected.has(tool.name)\n\t\t\t\t? \"not active yet; retained for first-request resolution\"\n\t\t\t\t: \"not active in this Pi session\";\n\t\tconst description = tool.description ?? \"No description available\";\n\t\treturn {\n\t\t\tid: toolItemIds.get(tool.name) as string,\n\t\t\tlabel: tool.name,\n\t\t\tdescription: `${policy} \u00B7 ${description}`,\n\t\t\tsearchText: `${policy} ${description}`,\n\t\t\tselected: selected.has(tool.name),\n\t\t\tdisabled: !selectable,\n\t\t\tdisabledReason: !active\n\t\t\t\t? selected.has(tool.name)\n\t\t\t\t\t? \"Not active yet; retained and resolved before the first request\"\n\t\t\t\t\t: \"Not active in Pi; Plan mode will not activate it\"\n\t\t\t\t: selectable\n\t\t\t\t\t? undefined\n\t\t\t\t\t: \"Blocked by Plan-mode policy\",\n\t\t};\n\t});\n\tfor (const [index, name] of (configured ?? []).entries()) {\n\t\tif (availableNames.has(name)) continue;\n\t\tconst label = terminalToolName(name);\n\t\titems.push({\n\t\t\tid: `plan-settings-pending:${index}`,\n\t\t\tlabel,\n\t\t\tdescription: \"pending registration \u00B7 Retained and resolved before the first request\",\n\t\t\tsearchText: `${label} pending registration retained settings first request`,\n\t\t\tselected: true,\n\t\t\tdisabled: true,\n\t\t\tdisabledReason: \"Not registered yet; reset defaults to remove retained names\",\n\t\t});\n\t}\n\treturn items;\n}\n\nfunction explicitToolNames(tools: readonly ToolInfo[], configured: string[] | undefined) {\n\treturn configured === undefined\n\t\t? defaultPlanModeToolNames([...tools], undefined)\n\t\t: [...configured];\n}\n\nfunction terminalToolName(value: string) {\n\tconst safe = safeTerminalText(value) || \"(unnamed tool)\";\n\treturn safe.length > 120 ? `${safe.slice(0, 119)}\u2026` : safe;\n}\n\nfunction safeTerminalText(value: string) {\n\treturn [...value]\n\t\t.map((character) => {\n\t\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\t\treturn codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f) ? \" \" : character;\n\t\t})\n\t\t.join(\"\")\n\t\t.trim();\n}\n\nfunction formatError(error: unknown) {\n\treturn error instan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AC;AAAA,EACF;AACA,SAAO;AACR;AAEA,SAAS,kBAAkB,OAA4B,YAAkC;AACxF,SAAO,eAAe,SACnB,yBAAyB,CAAC,GAAG,KAAK,GAAG,MAAS,IAC9C,CAAC,GAAG,UAAU;AAClB;AAEA,SAAS,iBAAiB,OAAe;AACxC,QAAM,OAAO,iBAAiB,KAAK,KAAK;AACxC,SAAO,KAAK,SAAS,MAAM,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,WAAM;AACvD;AAEA,SAAS,iBAAiB,OAAe;AACxC,SAAO,CAAC,GAAG,KAAK,EACd,IAAI,CAAC,cAAc;AACnB,UAAM,YAAY,UAAU,YAAY,CAAC,KAAK;AAC9C,WAAO,aAAa,MAAS,aAAa,OAAQ,aAAa,MAAQ,MAAM;AAAA,EAC9E,CAAC,EACA,KAAK,EAAE,EACP,KAAK;AACR;AAEA,SAAS,YAAY,OAAgB;AACpC,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC7D;",
|
|
6
|
+
"names": ["defineMenu", "runMenu", "level", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "level", "runMenu"]
|
|
7
|
+
}
|