@wbline/pi-plan-build 0.0.6 → 0.0.8

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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本遵循语义化版本。
6
6
 
7
+ ## [0.0.8] - 2026-10-21
8
+
9
+ ### 新增
10
+
11
+ - **`plan_question` 自由输入入口**:此前用户只能在 AI 预置的选项里单选,想表达选项之外的想法只能 Esc 取消后打字。现在选择列表末尾自动追加「✏️ 自行输入…」入口,选中后弹输入框自由作答(首尾空白裁剪);输入为空或 Esc 返回选项列表,可改选预置项(镜像官方 question.ts 示例的交互);AI 选项恰好与入口同名时复用为该入口、不重复追加。RPC/ACP 桥接下输入框走 `ui.input` 通道(JetBrains 弹窗 elicitation 表单),与 select 同级可用
12
+
13
+ ## [0.0.7] - 2026-10-21
14
+
15
+ ### 变更
16
+
17
+ - **包根入口薄壳**:`pi.extensions` 从 `./src/index.ts` 改为 `./index.ts`(对齐 `@wbline/pi-acp-jetbrain` 的做法),pi 中插件显示从 `@wbline/pi-plan-build:src` 变为干净的 `@wbline/pi-plan-build`——`:src` 后缀来自扩展路径首段目录;`main` 同步指向 `./index.ts`,`files` 补列 `index.ts`(否则发布包缺薄壳入口),`tsconfig.json` include 纳入薄壳。实现代码零改动,`src/` 结构不变
18
+
7
19
  ## [0.0.6] - 2026-10-20
8
20
 
9
21
  ### 新增
package/README.md CHANGED
@@ -64,7 +64,7 @@ pi install npm:@wbline/pi-plan-build
64
64
  | `plan_step_complete` | 完成当前进行中的步(摘要必填),立即生效不等待验收;最后一步完成即自动收尾整计划 |
65
65
  | `plan_complete` | 标记整计划完成——仅在全部工作与必需检查通过,或用户明确指示时。收尾时在计划文件文末写入状态块(`> **状态:已完成**(日期)` + 摘要),放弃同理(含原因),历史计划单看文件即可知结局 |
66
66
  | `plan_set_outcome` | 记录未完成结局并保持计划开放:`awaiting_validation`(必填精确的 userAction)/ `blocked` / `waiting_for_input` / `still_working` |
67
- | `plan_question` | 结构化选择题,收集决策;无交互 UI 时自动降级为文本提问 |
67
+ | `plan_question` | 结构化选择题,收集决策;选择列表末尾自动附「✏️ 自行输入…」入口,用户可跳出选项自由作答(空提交/Esc 返回选项);无交互 UI 时自动降级为文本提问 |
68
68
 
69
69
  ## 设置
70
70
 
package/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 包根入口薄壳:pi.extensions 指向 ./index.ts,
3
+ * 让 pi 显示干净的包名 @wbline/pi-plan-build(无 :src 路径后缀)。
4
+ * 实现在 src/index.ts,此处仅 re-export。
5
+ */
6
+ export { default } from "./src/index.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wbline/pi-plan-build",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Plan/Build dual-mode for the Pi coding agent: read-only planning, explicit approval, step-wise execution.",
5
5
  "license": "MIT",
6
6
  "author": "wongbin",
@@ -13,16 +13,17 @@
13
13
  "task-management"
14
14
  ],
15
15
  "type": "module",
16
- "main": "./src/index.ts",
16
+ "main": "./index.ts",
17
17
  "engines": {
18
18
  "node": ">=22.6"
19
19
  },
20
20
  "pi": {
21
21
  "extensions": [
22
- "./src/index.ts"
22
+ "./index.ts"
23
23
  ]
24
24
  },
25
25
  "files": [
26
+ "index.ts",
26
27
  "src",
27
28
  "README.md",
28
29
  "CHANGELOG.md",
@@ -30,6 +30,8 @@ export interface ToolTexts {
30
30
  questionHeader: string;
31
31
  questionLabel: string;
32
32
  questionDescription: string;
33
+ questionCustom: string;
34
+ questionCustomPrompt: string;
33
35
  }
34
36
 
35
37
  const ZH: ToolTexts = {
@@ -64,11 +66,13 @@ const ZH: ToolTexts = {
64
66
  "awaiting_validation 必填:用户要执行的精确验证步骤(多项检查每项一个简短要点)",
65
67
  outcomeReason: "blocked/waiting_for_input/still_working 必填:原因",
66
68
  question:
67
- "向用户提出结构化选择题,收集决策/澄清歧义;推荐选项放第一个并在 label 尾部加「(推荐)」。无交互 UI 时自动降级为文本提问。",
69
+ "向用户提出结构化选择题,收集决策/澄清歧义;推荐选项放第一个并在 label 尾部加「(推荐)」。选择列表末尾自动附自由输入入口,用户可跳出选项作答。无交互 UI 时自动降级为文本提问。",
68
70
  questionPrompt: "问题",
69
71
  questionHeader: "短标题(≤12 字符)",
70
72
  questionLabel: "选项显示文本",
71
73
  questionDescription: "选项说明",
74
+ questionCustom: "✏️ 自行输入…",
75
+ questionCustomPrompt: "输入你的想法(空提交或 Esc 返回选项)",
72
76
  };
73
77
 
74
78
  const EN: ToolTexts = {
@@ -106,11 +110,14 @@ const EN: ToolTexts = {
106
110
  outcomeReason:
107
111
  "required for blocked/waiting_for_input/still_working: the reason",
108
112
  question:
109
- 'Ask the user structured multiple-choice questions to settle decisions or clarify ambiguity; put the recommended option first and append "(recommended)" to its label. Falls back to a text question without interactive UI.',
113
+ 'Ask the user structured multiple-choice questions to settle decisions or clarify ambiguity; put the recommended option first and append "(recommended)" to its label. A custom-input entry is appended to the choice list so the user can answer in free text. Falls back to a text question without interactive UI.',
110
114
  questionPrompt: "The question",
111
115
  questionHeader: "Short header (≤12 chars)",
112
116
  questionLabel: "Option display text",
113
117
  questionDescription: "Option description",
118
+ questionCustom: "✏️ Type something…",
119
+ questionCustomPrompt:
120
+ "Type your answer (empty submit or Esc goes back to options)",
114
121
  };
115
122
 
116
123
  export function toolTexts(lang: Lang): ToolTexts {
@@ -1,4 +1,4 @@
1
- /** question:结构化提问工具(精简自官方 question.ts 模式)。 */
1
+ /** question:结构化提问工具(精简自官方 question.ts 模式,选项自带自由输入入口)。 */
2
2
 
3
3
  import type {
4
4
  ExtensionAPI,
@@ -53,22 +53,37 @@ export function registerQuestion(pi: ExtensionAPI, lang: Lang): void {
53
53
  }
54
54
  const answers: string[] = [];
55
55
  for (const q of params.questions) {
56
- const choice = await ctx.ui.select(
57
- q.question,
58
- q.options.map((o) => o.label),
59
- );
60
- if (choice === undefined) {
61
- return {
62
- content: [
63
- {
64
- type: "text" as const,
65
- text: "用户取消了提问。请根据上下文继续,不要重复询问。",
66
- },
67
- ],
68
- details: undefined,
69
- };
56
+ // 自由输入入口追加在选项末尾;AI 选项恰好同名时复用为该入口,不重复追加
57
+ const custom = T.questionCustom;
58
+ const labels = q.options.map((o) => o.label);
59
+ const options = labels.includes(custom) ? labels : [...labels, custom];
60
+ // 输入为空或取消 → 回到选项列表(镜像官方示例:编辑器 Esc 返回选项)
61
+ while (true) {
62
+ const choice = await ctx.ui.select(q.question, options);
63
+ if (choice === undefined) {
64
+ return {
65
+ content: [
66
+ {
67
+ type: "text" as const,
68
+ text: "用户取消了提问。请根据上下文继续,不要重复询问。",
69
+ },
70
+ ],
71
+ details: undefined,
72
+ };
73
+ }
74
+ if (choice !== custom) {
75
+ answers.push(`${q.header}: ${choice}`);
76
+ break;
77
+ }
78
+ const customAnswer = await ctx.ui.input(
79
+ q.question,
80
+ T.questionCustomPrompt,
81
+ );
82
+ if (customAnswer?.trim()) {
83
+ answers.push(`${q.header}: ${customAnswer.trim()}`);
84
+ break;
85
+ }
70
86
  }
71
- answers.push(`${q.header}: ${choice}`);
72
87
  }
73
88
  return {
74
89
  content: [