@xyz-agent/extension-protocol 0.1.1-dev.0 → 0.3.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/dist/index.d.mts CHANGED
@@ -195,8 +195,6 @@ interface AskUserQuestion {
195
195
  * - 有 options 时:默认 true,前端在选项末尾追加 Other 输入框;设 false 则不追加
196
196
  * - 无 options 时:整个问题就是自由输入,此字段被忽略 */
197
197
  allowOther?: boolean;
198
- /** 是否允许附加评论。选中后可追加短文本 */
199
- allowComment?: boolean;
200
198
  }
201
199
  interface AskUserOption {
202
200
  /** 显示标签 */
@@ -214,12 +212,10 @@ interface AskUserOption {
214
212
  * - 多选:value = JSON.stringify(选中项 value 数组),如 '["pg","mysql"]'
215
213
  * (不用逗号 join——option value 可能含逗号导致 split 歧义)
216
214
  * - Other 文本:单独 key `${header}__other`,value = 自由文本(不混进选中项数组)
217
- * - comment:单独 key `${header}__comment`,value = 评论文本
218
215
  *
219
216
  * extension 解析示例:
220
217
  * const selected = JSON.parse(answers[header]) // 多选 → string[]
221
218
  * const other = answers[`${header}__other`] // Other 自由文本
222
- * const comment = answers[`${header}__comment`] // 评论
223
219
  */
224
220
  type AskUserAnswers = Record<string, string>;
225
221
 
@@ -266,12 +262,10 @@ declare function askUserInteract(ctx: GuiContext, questions: AskUserQuestion[],
266
262
  declare function getAskUserAnswer(answers: AskUserAnswers, question: AskUserQuestion): string | string[] | undefined;
267
263
  /** 从 answers 中提取 Other 自由文本 */
268
264
  declare function getAskUserOther(answers: AskUserAnswers, question: AskUserQuestion): string | undefined;
269
- /** 从 answers 中提取评论 */
270
- declare function getAskUserComment(answers: AskUserAnswers, question: AskUserQuestion): string | undefined;
271
265
  /**
272
266
  * 类型守卫:验证 unknown 是否为合法的 AskUserQuestion。
273
267
  * 用于前端从 runtime 透传的 askUserQuestions(unknown[])中安全收窄。
274
268
  */
275
269
  declare function isAskUserQuestion(value: unknown): value is AskUserQuestion;
276
270
 
277
- export { ASK_USER_MARKER, type AskUserAnswers, type AskUserOption, type AskUserQuestion, GUI_WIDGET_MARKER, type GuiComponent, type GuiComponentProps, type GuiComponentType, type GuiContext, type GuiRenderResult, PROTOCOL_VERSION, type StatItem, type TreeItem, type TreeItemIcon, askUserInteract, extractGui, getAskUserAnswer, getAskUserComment, getAskUserOther, guiComponent, guiResult, guiSetWidget, isAskUserQuestion, isGuiCapable, isGuiComponent };
271
+ export { ASK_USER_MARKER, type AskUserAnswers, type AskUserOption, type AskUserQuestion, GUI_WIDGET_MARKER, type GuiComponent, type GuiComponentProps, type GuiComponentType, type GuiContext, type GuiRenderResult, PROTOCOL_VERSION, type StatItem, type TreeItem, type TreeItemIcon, askUserInteract, extractGui, getAskUserAnswer, getAskUserOther, guiComponent, guiResult, guiSetWidget, isAskUserQuestion, isGuiCapable, isGuiComponent };
package/dist/index.mjs CHANGED
@@ -100,13 +100,10 @@ function getAskUserAnswer(answers, question) {
100
100
  function getAskUserOther(answers, question) {
101
101
  return answers[`${askUserKey(question)}__other`];
102
102
  }
103
- function getAskUserComment(answers, question) {
104
- return answers[`${askUserKey(question)}__comment`];
105
- }
106
103
  function isAskUserQuestion(value) {
107
104
  if (typeof value !== "object" || value === null) return false;
108
105
  const q = value;
109
- return typeof q.question === "string" && (q.header === void 0 || typeof q.header === "string") && (q.options === void 0 || Array.isArray(q.options)) && (q.multiSelect === void 0 || typeof q.multiSelect === "boolean") && (q.allowOther === void 0 || typeof q.allowOther === "boolean") && (q.allowComment === void 0 || typeof q.allowComment === "boolean");
106
+ return typeof q.question === "string" && (q.header === void 0 || typeof q.header === "string") && (q.options === void 0 || Array.isArray(q.options)) && (q.multiSelect === void 0 || typeof q.multiSelect === "boolean") && (q.allowOther === void 0 || typeof q.allowOther === "boolean");
110
107
  }
111
108
  export {
112
109
  ASK_USER_MARKER,
@@ -115,7 +112,6 @@ export {
115
112
  askUserInteract,
116
113
  extractGui,
117
114
  getAskUserAnswer,
118
- getAskUserComment,
119
115
  getAskUserOther,
120
116
  guiComponent,
121
117
  guiResult,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyz-agent/extension-protocol",
3
- "version": "0.1.1-dev.0",
3
+ "version": "0.3.0",
4
4
  "description": "Extension GUI rendering protocol: types and helpers for pi extension dual-mode (TUI/GUI) rendering",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",