提供 ctx.userQuestions 接口,供 agent 在运行过程中暂停并向人类提问、获取决策答案,是 dsh-tool-ask-user 等工具依赖的服务定义包
ⓘ 此插件是大仓库 deepseek-ai/deepseek-harness 的子包,星数与活跃度统计的是整个仓库。
- 语言
- TypeScript
- License
- MIT
- 分支
- master
安装
$ dsh plugin --profile web add npm:@deepseek-ai/dsh-user-questions在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程
对话式安装
帮我安装 DeepSeek Harness 插件 deepseek-ai/deepseek-harness/packages/interaction/user-questions:先查看仓库 https://github.com/deepseek-ai/deepseek-harness 确认安全性,然后执行安装命令并验证插件加载成功。
把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。
English | 中文
User-interaction Service Definition. It owns ctx.userQuestions, the service a model-facing tool or permission plugin uses when it needs to pause work and ask the human for a decision.
Service: UserQuestionService (ctx key: userQuestions)
Public API
ctx.userQuestions.registerProvider(provider): () => voidRegister the UI-side provider. Only one provider may be active in a context; disposal unregisters it.ctx.userQuestions.ask(request): Promise<AskUserQuestionAnswer>Ask the active provider and wait for the answer.
Key Types
AskUserQuestionRequest—{ questions: [{ id, question, detail?, header?, options?, multiSelect?, intent? }], agent?, signal? };detailsupplies supporting text that providers render with the question without turning it into an option label. When present,agentmust be the registry's exact live runtime root.AskUserQuestionOption—{ label, description? }.AskUserQuestionIntent—{ kind: 'plan-review', approve }; the tagged presentation intent below.AskUserQuestionAnswer—{ answers: [{ id, selected, custom? }] }.UserQuestionProvider— UI implementation withask(request).UserQuestionError—HarnessErrorsubclass with codes such asEMPTY_QUESTIONS,BAD_INTENT,NO_PROVIDER,DUPLICATE_PROVIDER,ASK_ABORTED,CALLER_NOT_LIVE, andDELEGATED_CALLER.
For a single-select question, custom overrides the selected choice and selected is empty. For a multi-select question, custom may supplement the labels in selected. A UI may preserve a skipped item as { id, selected: [] }, keeping the existing answer shape while retaining other answers in the batch.
When a request carries an agent, ask() authenticates its exact identity through the live AgentRegistry and admits only a runtime root. Durable lineage is not authority: a session with historical delegation depth may ask after it is resumed as a new runtime root, while a live child owned by another agent is rejected even if its durable depth is zero. Agentless programmatic requests retain the existing provider path.
Presentation intent
intent declares that a question IS a known kind of decision, so a UI that recognises the tag may present it as such — plan-review says detail is a plan under review, and dsh-plan-mode sets it on the exit_plan_mode question. An intent changes presentation only: a UI honouring it answers with the same option labels a generic UI would send, and a UI that does not know the tag renders the generic option list, so callers read the same answer fields either way. approve names the label that approves rather than relying on option order. ask() rejects with BAD_INTENT the two assertions no type can carry: an approve naming none of that question's own options, and an intent on a question with no detail — the thing it declares itself a review of.
Role
This is the Service Definition package. Consumers such as @deepseek-ai/dsh-tool-ask-user depend on this service; the Web host runtime supplies the shipped Service Provider. The loop stays unchanged: a tool call awaits a promise, and the tool result resumes the normal agent loop.
Model Experience
Indirectly, through dsh-tool-ask-user, which retains a successful provider answer as compact JSON or one of these failures: Error: ask_user_question was aborted before the user answered, Error: ask_user_question requires at least one question, Error: human interaction requires the exact live calling agent when an agent is supplied, Error: human interaction is unavailable while the calling agent is owned by another live agent; include the unresolved question or decision in the child agent's final result, Error: no user-questions provider is registered, or Error: <message>. Waiting for the human adds no tokens.
KV Cache effect
No direct invalidation; the named consumer owns any request-prefix changes.
Known Limitations and Deferred Work
- One provider per context — there is no routing or fan-out to multiple UIs; a second registration throws
DUPLICATE_PROVIDER, and with none registeredask()throwsNO_PROVIDERrather than degrading. - The vocabulary is the question-form shape only — selectable options plus optional custom text; richer interaction shapes (file pickers, diff-preview confirmations) have no seam vocabulary yet.
收录徽章
[](https://deepseek-plugin.org/plugins/deepseek-ai/deepseek-harness/packages/interaction/user-questions)把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。