Files
deepseek-harness/website/zh-CN/api/harness/user-interaction.md
2026-07-19 14:14:02 +08:00

50 lines
1.7 KiB
Markdown

<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
# ctx.userInteraction
`UserInteractionService` — provided by `@deepseek-ai/dsh-user-interaction`.
`ctx.userInteraction`: one active UI provider plus an `ask()` surface.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/user-interaction/src/index.ts#L82)
### ctx.userInteraction.registerProvider(provider)
```ts website-api
/**
* Register the UI provider. Only one provider may be active in a context.
*
* @param provider UI-side implementation that collects answers.
* @returns Disposer that unregisters this provider.
*/
registerProvider(provider: UserInteractionProvider): () => void
```
Register the UI provider. Only one provider may be active in a context.
- `provider` — UI-side implementation that collects answers.
**Returns** Disposer that unregisters this provider.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/user-interaction/src/index.ts#L95)
### ctx.userInteraction.ask(request)
```ts website-api
/**
* Ask the active UI provider and wait for the user's answer.
*
* @param request Questions, owner agent, and abort signal.
* @returns The answer chosen or typed by the human.
*/
async ask(request: AskUserQuestionRequest): Promise<AskUserQuestionAnswer>
```
Ask the active UI provider and wait for the user's answer.
- `request` — Questions, owner agent, and abort signal.
**Returns** The answer chosen or typed by the human.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/user-interaction/src/index.ts#L114)