Skip to content

Implement multi-client requestInteractions and askYesNo for CLI client#2192

Merged
GeorgeNgMsft merged 4 commits intomainfrom
dev/georgeng/cli_clientio_imp
Apr 14, 2026
Merged

Implement multi-client requestInteractions and askYesNo for CLI client#2192
GeorgeNgMsft merged 4 commits intomainfrom
dev/georgeng/cli_clientio_imp

Conversation

@GeorgeNgMsft
Copy link
Copy Markdown
Contributor

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.

@GeorgeNgMsft GeorgeNgMsft marked this pull request as ready for review April 14, 2026 04:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / interactionCancelled in createEnhancedClientIO, 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.

@GeorgeNgMsft GeorgeNgMsft enabled auto-merge April 14, 2026 04:50
@GeorgeNgMsft GeorgeNgMsft changed the title Implement multi-client requestInteractions and askYesNo for CLI Implement multi-client requestInteractions and askYesNo for CLI client Apr 14, 2026
@GeorgeNgMsft GeorgeNgMsft added this pull request to the merge queue Apr 14, 2026
@robgruen
Copy link
Copy Markdown
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.

Merged via the queue into main with commit c6e4927 Apr 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants