/** * OpenCode hook adapter。 * * OpenCode 自带原生 `question` 工具(= Claude AskUserQuestion 等价物),模型调用时服务端 * 发布 `question.asked` 事件并阻塞,等客户端把答案 POST 回 `/question/{id}/reply` 才解阻塞。 * botmux 的 OpenCode 插件(见 hook-installer.ts buildOpenCodePlugin)用 `event` 钩子拦截该 * 事件,把 questions 规范成下面这个 payload 喂给 `botmux hook opencode`,拿到 directive 里的 * `answers` 后再 POST 回 OpenCode: * { * hook_event_name: 'question.asked', * question_id: 'que_', * session_id: 'ses_', * tool_input: { * questions: [ * { * question: '问题文本', * header: '可选标题', * options: [{ label: '选项文本', description?: '描述' }, ...], * multiple?: boolean, * } * ] * }, * } * * formatAnswer 返回的 directive 形状(插件取其中的 `answers` 作为 reply body): * { type: 'answer', answers: string[][] } * 其中 answers[i] = 第 i 个问题选中的 label 数组;跳过的 question 填 ['']。 * (自由文本作答即把该文字当作选中的 label —— OpenCode question 默认 custom:true 允许任意串。) * * passthrough(放行)= 空字符串:插件见 stdout 为空 → 不 reply,把问题留给 OpenCode * 原生 picker(botmux web 终端里仍可人工作答)。绝不用空答案顶替这次提问。 * * 机制已在 OpenCode 1.17.x 端到端实测确认(事件名 `question.asked`、reply 端点 * `POST /question/{id}/reply`、body `{ answers }`)。 */ import type { HookAskAdapter } from './types.js'; declare const openCodeAdapter: HookAskAdapter; export default openCodeAdapter; //# sourceMappingURL=opencode.d.ts.map