Implement multi-client requestInteractions and askYesNo for CLI client#2192
Merged
GeorgeNgMsft merged 4 commits intomainfrom Apr 14, 2026
Merged
Implement multi-client requestInteractions and askYesNo for CLI client#2192GeorgeNgMsft merged 4 commits intomainfrom
GeorgeNgMsft merged 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements real deferred-interaction handling in the TypeAgent CLI ClientIO so the CLI can respond to server-pushed prompts (e.g., askYesNo, popupQuestion) in multi-client AgentServer sessions, and adds Jest-based coverage plus a protocol/design doc.
Changes:
- Implemented
requestInteraction/interactionResolved/interactionCancelledincreateEnhancedClientIO, including prompt rendering, spinner pausing, and abort-based dismissal. - Added CLI Jest + ts-jest ESM test setup and a new multi-client interaction test suite.
- Added an AgentServer design doc describing the multi-client deferred interaction protocol.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ts/packages/cli/src/enhancedConsole.ts | Implements deferred interaction prompting, cancellation via AbortController, and display-history rendering for interaction entries. |
| ts/packages/cli/test/multiClientInteraction.spec.ts | Adds tests for multi-client interaction flows, including dismissal behavior. |
| ts/packages/cli/jest.config.js | Introduces ts-jest ESM Jest configuration for CLI TypeScript tests. |
| ts/packages/cli/test/tsconfig.json | Adds a dedicated TS config for Jest/ts-jest test compilation. |
| ts/packages/cli/package.json | Adds test scripts and dev deps for Jest globals and ts-jest. |
| ts/packages/cli/tsconfig.json | Small cleanup (comment removal). |
| ts/packages/agentServer/docs/multi-client-interactions.md | Adds protocol/design documentation for deferred interactions across multiple clients. |
| ts/pnpm-lock.yaml | Updates lockfile for added test dependencies and resulting dependency graph changes. |
Files not reviewed (1)
- ts/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Since you're doing this could you look into also wiring this through for the reasoning loop? It'd be great if we could surface those questions to the user. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core feature — enhancedConsole.ts: Implemented requestInteraction in the CLI's ClientIO, replacing the previous no-op stub. The CLI can now handle server-pushed interaction requests (e.g. askYesNo prompts) in real time:
Displays a styled yes/no prompt to the user using readline
Temporarily pauses any active spinner while awaiting input
Responds back to the server via dispatcher.respondInteraction()
Handles concurrent interactions from multiple clients — uses an AbortController per interactionId so that if another client responds first, the local prompt is dismissed cleanly
Tests — new multiClientInteraction.spec.ts (370 lines) with full Jest setup (jest.config.js, test/tsconfig.json) covering the multi-client interaction flow.
Docs — multi-client-interactions.md: design doc explaining the deferred interaction pattern for multiple concurrent clients.
Key design detail
Each pending interaction is tracked in activeInteractions: Map<string, AbortController>. When the server signals that another client already responded (resolved-by-other), the AbortController fires and the local question() call is cancelled without requiring user input.