@narumitw/pi-plan-mode 0.55.0 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -9
- package/dist/chunks/{chunk-KSGLZ4S2.js → chunk-AS76FCC5.js} +3 -11
- package/dist/chunks/{chunk-KSGLZ4S2.js.map → chunk-AS76FCC5.js.map} +2 -2
- package/dist/chunks/{interactive-ui-PSDKEVVG.js → interactive-ui-UCL5UIJN.js} +43 -21
- package/dist/chunks/interactive-ui-UCL5UIJN.js.map +7 -0
- package/dist/index.ts +196 -49
- package/dist/index.ts.map +2 -2
- package/package.json +1 -1
- package/src/plan-launch-menu.ts +13 -5
- package/src/plan-mode.ts +246 -46
- package/src/settings-menu.ts +36 -13
- package/src/state.ts +30 -0
- package/src/tool-selection.ts +2 -4
- package/dist/chunks/interactive-ui-PSDKEVVG.js.map +0 -7
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
retentionLabel,
|
|
18
18
|
toolPolicyLabel,
|
|
19
19
|
updatePlanModeSettings
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-AS76FCC5.js";
|
|
21
21
|
|
|
22
22
|
// src/active-implementation-menu.ts
|
|
23
23
|
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
@@ -236,6 +236,11 @@ async function showReadyPlanMenu(ctx, options) {
|
|
|
236
236
|
import { defineMenu as defineMenu3, runMenu as runMenu3 } from "@narumitw/pi-tui-kit";
|
|
237
237
|
async function showPlanLaunchMenu(ctx, options) {
|
|
238
238
|
const selectedNames = new Set(options.getSelectedNames());
|
|
239
|
+
const toolItems = options.tools.map((tool, index) => ({
|
|
240
|
+
id: `plan-tool:${index}`,
|
|
241
|
+
tool
|
|
242
|
+
}));
|
|
243
|
+
const toolsByItemId = new Map(toolItems.map(({ id, tool }) => [id, tool]));
|
|
239
244
|
let draftChanged = false;
|
|
240
245
|
const menu = defineMenu3({
|
|
241
246
|
start: options.initialScreen ?? "main",
|
|
@@ -257,13 +262,15 @@ async function showPlanLaunchMenu(ctx, options) {
|
|
|
257
262
|
title: "Choose Plan policy allowlist",
|
|
258
263
|
lines: [
|
|
259
264
|
"Policy changes apply only when you start Plan mode; first use may also reveal Plan helpers.",
|
|
260
|
-
|
|
265
|
+
options.toolSummary(selectedNames),
|
|
266
|
+
"Active tools can be chosen now; retained names resolve before the first request.",
|
|
267
|
+
"Plan mode never activates tools, and non-built-ins run at user risk."
|
|
261
268
|
],
|
|
262
269
|
enableSearch: true,
|
|
263
270
|
viewportSize: 10,
|
|
264
|
-
items:
|
|
265
|
-
id
|
|
266
|
-
label: tool.name,
|
|
271
|
+
items: toolItems.map(({ id, tool }) => ({
|
|
272
|
+
id,
|
|
273
|
+
label: tool.label ?? tool.name,
|
|
267
274
|
description: tool.description,
|
|
268
275
|
searchText: tool.searchText,
|
|
269
276
|
selected: selectedNames.has(tool.name),
|
|
@@ -299,7 +306,7 @@ async function showPlanLaunchMenu(ctx, options) {
|
|
|
299
306
|
},
|
|
300
307
|
"toggle-tool": async ({ itemId, selected, signal }) => {
|
|
301
308
|
if (signal.aborted || !options.isCurrent()) return { kind: "rejected" };
|
|
302
|
-
const tool =
|
|
309
|
+
const tool = itemId ? toolsByItemId.get(itemId) : void 0;
|
|
303
310
|
if (!tool || tool.disabled) return { kind: "rejected" };
|
|
304
311
|
if (selected) selectedNames.add(tool.name);
|
|
305
312
|
else selectedNames.delete(tool.name);
|
|
@@ -418,6 +425,10 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
418
425
|
const tools = options.tools.filter(
|
|
419
426
|
(tool) => tool.name !== PLAN_MODE_QUESTION_TOOL_NAME && tool.name !== PLAN_MODE_COMPLETE_TOOL_NAME
|
|
420
427
|
);
|
|
428
|
+
const toolItemIds = new Map(
|
|
429
|
+
tools.map((tool, index) => [tool.name, `plan-settings-tool:${index}`])
|
|
430
|
+
);
|
|
431
|
+
const toolsByItemId = new Map(tools.map((tool) => [toolItemIds.get(tool.name), tool]));
|
|
421
432
|
const loadState = async () => {
|
|
422
433
|
const loaded = await readSettings(options.settingsPath);
|
|
423
434
|
if (loaded.kind === "invalid") {
|
|
@@ -453,7 +464,7 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
453
464
|
{
|
|
454
465
|
id: "defaultPlanTools",
|
|
455
466
|
label: "Plan policy tools",
|
|
456
|
-
description: "Choose
|
|
467
|
+
description: "Choose active tools or retain names to resolve before the first request.",
|
|
457
468
|
currentValue: defaultToolsValue(state.settings.defaultPlanTools),
|
|
458
469
|
action: "open-tools"
|
|
459
470
|
},
|
|
@@ -488,11 +499,17 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
488
499
|
title: "Default Plan policy allowlist",
|
|
489
500
|
lines: [
|
|
490
501
|
"Changes apply when a later Plan workflow starts; model-visible tools stay unchanged.",
|
|
491
|
-
"
|
|
502
|
+
"Retained inactive names resolve before that workflow's first request.",
|
|
503
|
+
"Plan mode never activates tools, and non-built-ins run at user risk."
|
|
492
504
|
],
|
|
493
505
|
enableSearch: true,
|
|
494
506
|
viewportSize: 10,
|
|
495
|
-
items: defaultToolItems(
|
|
507
|
+
items: defaultToolItems(
|
|
508
|
+
tools,
|
|
509
|
+
state.settings.defaultPlanTools,
|
|
510
|
+
activeToolNames,
|
|
511
|
+
toolItemIds
|
|
512
|
+
),
|
|
496
513
|
action: "toggle-tool",
|
|
497
514
|
actions: [
|
|
498
515
|
{
|
|
@@ -587,7 +604,7 @@ async function showPlanModeSettings(ctx, options) {
|
|
|
587
604
|
return result.kind === "stay" ? { kind: "to", screen: "settings" } : result;
|
|
588
605
|
},
|
|
589
606
|
"toggle-tool": async ({ ctx: actionCtx, state, itemId, selected, signal }) => {
|
|
590
|
-
const tool =
|
|
607
|
+
const tool = itemId ? toolsByItemId.get(itemId) : void 0;
|
|
591
608
|
if (!tool || !activeToolNames.has(tool.name) || !canSelectToolInPlanMode(tool)) {
|
|
592
609
|
return { kind: "rejected" };
|
|
593
610
|
}
|
|
@@ -666,34 +683,35 @@ function defaultToolsValue(configured) {
|
|
|
666
683
|
if (configured.length === 0) return "No optional tools";
|
|
667
684
|
return `${configured.length} selected`;
|
|
668
685
|
}
|
|
669
|
-
function defaultToolItems(tools, configured, activeToolNames) {
|
|
686
|
+
function defaultToolItems(tools, configured, activeToolNames, toolItemIds) {
|
|
670
687
|
const selected = new Set(explicitToolNames(tools, configured));
|
|
671
688
|
const availableNames = new Set(tools.map((tool) => tool.name));
|
|
672
689
|
const items = tools.map((tool) => {
|
|
673
690
|
const active = activeToolNames.has(tool.name);
|
|
674
691
|
const selectable = active && canSelectToolInPlanMode(tool);
|
|
675
|
-
const policy = active ? toolPolicyLabel(tool) : "not active in this Pi session";
|
|
692
|
+
const policy = active ? toolPolicyLabel(tool) : selected.has(tool.name) ? "not active yet; retained for first-request resolution" : "not active in this Pi session";
|
|
676
693
|
const description = tool.description ?? "No description available";
|
|
677
694
|
return {
|
|
678
|
-
id: tool.name,
|
|
695
|
+
id: toolItemIds.get(tool.name),
|
|
679
696
|
label: tool.name,
|
|
680
697
|
description: `${policy} \xB7 ${description}`,
|
|
681
698
|
searchText: `${policy} ${description}`,
|
|
682
699
|
selected: selected.has(tool.name),
|
|
683
700
|
disabled: !selectable,
|
|
684
|
-
disabledReason: !active ? "Not active in Pi; Plan mode will not activate it" : selectable ? void 0 : "Blocked by Plan-mode policy"
|
|
701
|
+
disabledReason: !active ? selected.has(tool.name) ? "Not active yet; retained and resolved before the first request" : "Not active in Pi; Plan mode will not activate it" : selectable ? void 0 : "Blocked by Plan-mode policy"
|
|
685
702
|
};
|
|
686
703
|
});
|
|
687
|
-
for (const name of configured ?? []) {
|
|
704
|
+
for (const [index, name] of (configured ?? []).entries()) {
|
|
688
705
|
if (availableNames.has(name)) continue;
|
|
706
|
+
const label = terminalToolName(name);
|
|
689
707
|
items.push({
|
|
690
|
-
id:
|
|
691
|
-
label
|
|
692
|
-
description: "
|
|
693
|
-
searchText:
|
|
708
|
+
id: `plan-settings-pending:${index}`,
|
|
709
|
+
label,
|
|
710
|
+
description: "pending registration \xB7 Retained and resolved before the first request",
|
|
711
|
+
searchText: `${label} pending registration retained settings first request`,
|
|
694
712
|
selected: true,
|
|
695
713
|
disabled: true,
|
|
696
|
-
disabledReason: "
|
|
714
|
+
disabledReason: "Not registered yet; reset defaults to remove retained names"
|
|
697
715
|
});
|
|
698
716
|
}
|
|
699
717
|
return items;
|
|
@@ -701,6 +719,10 @@ function defaultToolItems(tools, configured, activeToolNames) {
|
|
|
701
719
|
function explicitToolNames(tools, configured) {
|
|
702
720
|
return configured === void 0 ? defaultPlanModeToolNames([...tools], void 0) : [...configured];
|
|
703
721
|
}
|
|
722
|
+
function terminalToolName(value) {
|
|
723
|
+
const safe = safeTerminalText(value) || "(unnamed tool)";
|
|
724
|
+
return safe.length > 120 ? `${safe.slice(0, 119)}\u2026` : safe;
|
|
725
|
+
}
|
|
704
726
|
function safeTerminalText(value) {
|
|
705
727
|
return [...value].map((character) => {
|
|
706
728
|
const codePoint = character.codePointAt(0) ?? 0;
|
|
@@ -718,4 +740,4 @@ export {
|
|
|
718
740
|
showReadyPlanMenu,
|
|
719
741
|
showSavedPlanMenu
|
|
720
742
|
};
|
|
721
|
-
//# sourceMappingURL=interactive-ui-
|
|
743
|
+
//# sourceMappingURL=interactive-ui-UCL5UIJN.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/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 { type PlanExportDestinationProvider, planExportInputScreen } from \"./plan-export-screen.js\";\n\ninterface MenuLifecycle {\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n}\n\nconst IMPLEMENTATION_CONTEXT_LINES = [\n\t\"Implement here keeps this planning conversation.\",\n\t\"Start fresh transfers only the approved plan to a new session.\",\n] as const;\n\ninterface PlanMenuOptions extends MenuLifecycle {\n\tstatusText: string;\n\thasReadyPlan: boolean;\n\timplementationOutcome(): string;\n\tgetExportDestination: PlanExportDestinationProvider;\n\tshow(): void;\n\tfinalize(): void;\n\timplementHere(): void | Promise<void>;\n\timplementFresh(signal: AbortSignal): void | Promise<void>;\n\texportPlan(path: string, signal: AbortSignal): Promise<boolean>;\n\tsave(): void;\n\tstay(): void;\n\texit(): void;\n}\n\nexport async function showPlanModeMenu(ctx: ExtensionContext, options: PlanMenuOptions) {\n\ttype Screen = \"main\" | \"export\";\n\ttype Action =\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\tmain: () => ({\n\t\t\t\tkind: \"actions\",\n\t\t\t\ttitle: \"Plan mode\",\n\t\t\t\tlines: [\n\t\t\t\t\toptions.statusText,\n\t\t\t\t\t...(options.hasReadyPlan\n\t\t\t\t\t\t? [...IMPLEMENTATION_CONTEXT_LINES, options.implementationOutcome()]\n\t\t\t\t\t\t: []),\n\t\t\t\t],\n\t\t\t\titems: options.hasReadyPlan\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{ id: \"show\", label: \"Show latest proposed plan\", action: \"show\" },\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},\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{ 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\tshow: async () => {\n\t\t\t\toptions.show();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\tfinalize: async () => {\n\t\t\t\toptions.finalize();\n\t\t\t\treturn { kind: \"close\" };\n\t\t\t},\n\t\t\t\"implement-here\": async () => {\n\t\t\t\tawait options.implementHere();\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);\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\ninterface ReadyPlanMenuOptions extends MenuLifecycle {\n\timplementationOutcome(): string;\n\tgetExportDestination: PlanExportDestinationProvider;\n\timplementHere(): void | Promise<void>;\n\timplementFresh(signal: AbortSignal): void | Promise<void>;\n\texportPlan(path: string, signal: AbortSignal): Promise<boolean>;\n\tsave(): void;\n\tstay(): void;\n\texit(): void;\n}\n\nexport async function showReadyPlanMenu(ctx: ExtensionContext, options: ReadyPlanMenuOptions) {\n\ttype Screen = \"ready\" | \"export\";\n\ttype Action = \"implement-here\" | \"implement-fresh\" | \"export\" | \"save\" | \"stay\" | \"exit\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionContext>({\n\t\tstart: \"ready\",\n\t\tscreens: {\n\t\t\tready: () => ({\n\t\t\t\tkind: \"actions\",\n\t\t\t\ttitle: \"Proposed plan ready. What next?\",\n\t\t\t\tlines: [...IMPLEMENTATION_CONTEXT_LINES, options.implementationOutcome()],\n\t\t\t\titems: [\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{ id: \"export\", label: \"Export plan\u2026\", to: \"export\" },\n\t\t\t\t\t{ id: \"save\", label: \"Save for later\", action: \"save\" },\n\t\t\t\t\t{ id: \"stay\", label: \"Stay in Plan mode\", action: \"stay\" },\n\t\t\t\t\t{ id: \"exit\", label: \"Discard plan and exit\", action: \"exit\" },\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\"implement-here\": async () => {\n\t\t\t\tawait options.implementHere();\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);\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 { 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 { type PlanExportDestinationProvider, planExportInputScreen } from \"./plan-export-screen.js\";\n\ninterface SavedPlanMenuOptions {\n\tstatusText: string;\n\timplementationOutcome(): string;\n\tgetExportDestination: PlanExportDestinationProvider;\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tshow(): void;\n\timplementHere(): void | Promise<void>;\n\timplementFresh(signal: AbortSignal): 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\ttype Screen = \"saved\" | \"export\";\n\ttype Action = \"show\" | \"implement-here\" | \"implement-fresh\" | \"export\" | \"settings\" | \"clear\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionContext>({\n\t\tstart: \"saved\",\n\t\tscreens: {\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],\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{ 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\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 () => {\n\t\t\t\tawait options.implementHere();\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);\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 { 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\";\ntype Action =\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\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],\n\t\t\t\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\"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 instanceof Error ? error.message : String(error);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACG7B,SAAS,sBAAsB,gBAA+C;AACpF,QAAM,cAAc,eAAe;AACnC,SAAO;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,MACN;AAAA,MACA,YAAY,YAAY,cAAc;AAAA,MACtC,gBAAgB,YAAY,YAAY;AAAA,IACzC;AAAA,IACA,aAAa,YAAY;AAAA,IACzB,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AACD;;;ADFA,eAAsB,6BACrB,KACA,SACC;AAGD,QAAM,OAAO,WAAwD;AAAA,IACpE,OAAO;AAAA,IACP,SAAS;AAAA,MACR,QAAQ,OAAO;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO,CAAC,QAAQ,UAAU;AAAA,QAC1B,OAAO;AAAA,UACN,EAAE,IAAI,QAAQ,OAAO,mCAAmC,QAAQ,OAAO;AAAA,UACvE,EAAE,IAAI,UAAU,OAAO,qBAAgB,IAAI,SAAS;AAAA,UACpD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AgB,CAAC,SACd,SAAS,IAAI,KAAK,IAAI,IACrB,mEACA,qDACD,aACC,SACA;AAAA,IACL;AAAA,EACD,CAAC;AACD,aAAW,CAAC,OAAO,IAAI,MAAM,cAAc,CAAC,GAAG,QAAQ,GAAG;AACzD,QAAI,eAAe,IAAI,IAAI,EAAG;AAC9B,UAAM,QAAQ,iBAAiB,IAAI;AACnC,UAAM,KAAK;AAAA,MACV,IAAI,yBAAyB,KAAK;AAAA,MAClC;AAAA,MACA,aAAa;AAAA,MACb,YAAY,GAAG,KAAK;AAAA,MACpB,UAAU;AAAA,MACV,UAAU;AAAA,MACV,gBAAgB;AAAA,IACjB,CAAC;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", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu", "defineMenu", "runMenu"]
|
|
7
|
+
}
|