@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-plan-mode",
3
- "version": "0.54.0",
3
+ "version": "0.55.1",
4
4
  "description": "Pi extension that adds a Codex-like read-only /plan collaboration mode.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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
- "Only tools already active in Pi can be allowed; non-built-ins run at user risk.",
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: options.tools.map((tool) => ({
55
- id: tool.name,
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 = options.tools.find((candidate) => candidate.name === itemId);
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);