@narumitw/pi-plan-mode 0.54.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 +33 -36
- package/dist/chunks/{chunk-U5CQ7RQX.js → chunk-AS76FCC5.js} +242 -265
- package/dist/chunks/chunk-AS76FCC5.js.map +7 -0
- package/dist/chunks/{interactive-ui-W3VYAJIQ.js → interactive-ui-UCL5UIJN.js} +43 -51
- package/dist/chunks/interactive-ui-UCL5UIJN.js.map +7 -0
- package/dist/index.ts +224 -321
- package/dist/index.ts.map +3 -3
- package/package.json +1 -1
- package/src/plan-launch-menu.ts +13 -5
- package/src/plan-mode.ts +263 -238
- package/src/required-tools.ts +17 -0
- package/src/settings-menu.ts +36 -47
- package/src/settings.ts +0 -19
- package/src/state.ts +30 -0
- package/src/tool-selection.ts +2 -4
- package/dist/chunks/chunk-U5CQ7RQX.js.map +0 -7
- package/dist/chunks/interactive-ui-W3VYAJIQ.js.map +0 -7
- package/src/helper-tool-visibility.ts +0 -142
package/package.json
CHANGED
package/src/plan-launch-menu.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
|
3
3
|
|
|
4
4
|
export interface PlanLaunchTool {
|
|
5
5
|
name: string;
|
|
6
|
+
label?: string;
|
|
6
7
|
description: string;
|
|
7
8
|
searchText: string;
|
|
8
9
|
disabled: boolean;
|
|
@@ -26,6 +27,11 @@ export async function showPlanLaunchMenu(ctx: ExtensionContext, options: PlanLau
|
|
|
26
27
|
type Screen = "main" | "tools" | "help";
|
|
27
28
|
type Action = "start" | "toggle-tool" | "start-with-tools" | "settings";
|
|
28
29
|
const selectedNames = new Set(options.getSelectedNames());
|
|
30
|
+
const toolItems = options.tools.map((tool, index) => ({
|
|
31
|
+
id: `plan-tool:${index}`,
|
|
32
|
+
tool,
|
|
33
|
+
}));
|
|
34
|
+
const toolsByItemId = new Map(toolItems.map(({ id, tool }) => [id, tool]));
|
|
29
35
|
let draftChanged = false;
|
|
30
36
|
const menu = defineMenu<undefined, Screen, Action, ExtensionContext>({
|
|
31
37
|
start: options.initialScreen ?? "main",
|
|
@@ -47,13 +53,15 @@ export async function showPlanLaunchMenu(ctx: ExtensionContext, options: PlanLau
|
|
|
47
53
|
title: "Choose Plan policy allowlist",
|
|
48
54
|
lines: [
|
|
49
55
|
"Policy changes apply only when you start Plan mode; first use may also reveal Plan helpers.",
|
|
50
|
-
|
|
56
|
+
options.toolSummary(selectedNames),
|
|
57
|
+
"Active tools can be chosen now; retained names resolve before the first request.",
|
|
58
|
+
"Plan mode never activates tools, and non-built-ins run at user risk.",
|
|
51
59
|
],
|
|
52
60
|
enableSearch: true,
|
|
53
61
|
viewportSize: 10,
|
|
54
|
-
items:
|
|
55
|
-
id
|
|
56
|
-
label: tool.name,
|
|
62
|
+
items: toolItems.map(({ id, tool }) => ({
|
|
63
|
+
id,
|
|
64
|
+
label: tool.label ?? tool.name,
|
|
57
65
|
description: tool.description,
|
|
58
66
|
searchText: tool.searchText,
|
|
59
67
|
selected: selectedNames.has(tool.name),
|
|
@@ -89,7 +97,7 @@ export async function showPlanLaunchMenu(ctx: ExtensionContext, options: PlanLau
|
|
|
89
97
|
},
|
|
90
98
|
"toggle-tool": async ({ itemId, selected, signal }) => {
|
|
91
99
|
if (signal.aborted || !options.isCurrent()) return { kind: "rejected" };
|
|
92
|
-
const tool =
|
|
100
|
+
const tool = itemId ? toolsByItemId.get(itemId) : undefined;
|
|
93
101
|
if (!tool || tool.disabled) return { kind: "rejected" };
|
|
94
102
|
if (selected) selectedNames.add(tool.name);
|
|
95
103
|
else selectedNames.delete(tool.name);
|