fix: guard human interaction by runtime ownership
This commit is contained in:
@@ -2627,15 +2627,17 @@ registerProvider(provider: UserInteractionProvider): () => void
|
||||
/**
|
||||
* Ask the active UI provider and wait for the user's answer.
|
||||
*
|
||||
* Human-interaction requests are only valid from a top-level agent: a
|
||||
* delegated subagent has no human answerer in its own context, so asking
|
||||
* there would block forever. This mirrors the goal tools' top-level-only
|
||||
* authority (`create_goal` rejects non-top-level agents).
|
||||
* When a caller supplies an agent, human interaction is valid only for the
|
||||
* exact live runtime root. Runtime ownership, not durable session lineage,
|
||||
* decides this boundary: an owned child has no human answerer and would
|
||||
* block forever, while a lineage-bearing session resumed as a new runtime
|
||||
* root may ask normally.
|
||||
*
|
||||
* @param request Questions, owner agent, and abort signal.
|
||||
* @returns The answer chosen or typed by the human.
|
||||
* @throws {UserInteractionError} code `DELEGATED_CALLER` when the calling
|
||||
* agent is a delegated subagent (`session.header.delegationDepth > 0`).
|
||||
* @throws {UserInteractionError} code `CALLER_NOT_LIVE` when a supplied
|
||||
* agent is not the registry's exact live instance, or `DELEGATED_CALLER`
|
||||
* when that live agent is owned by another agent.
|
||||
*/
|
||||
async ask(request: AskUserQuestionRequest): Promise<AskUserQuestionAnswer>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user