Skip to content

feat(core): expose Question.ask via API/SDK #12046

Open
eXamadeus wants to merge 1 commit intoanomalyco:devfrom
ex-machina-co:feat/question-ask
Open

feat(core): expose Question.ask via API/SDK #12046
eXamadeus wants to merge 1 commit intoanomalyco:devfrom
ex-machina-co:feat/question-ask

Conversation

@eXamadeus
Copy link
Contributor

What does this PR do?

Fixes: #8384

Important

The LOC changes are misleading, it's mostly tests and generated code.

Exposes a new POST /question/ask server endpoint that allows clients and the SDK to programmatically ask questions to users without blocking. Key changes:

  • Refactored Question.ask() function to support an optional options parameter with an awaitAnswers key:
    • When awaitAnswers: true (default): blocks and returns the answers (existing behavior)
    • When awaitAnswers: false: returns the question request ID immediately without waiting for answers
  • Added new /question/ask API endpoint that creates a question request and returns its ID, enabling async question flows from external clients
    • /question/ask endpoint performs session existence validation and returns 404 when the session doesn't exist
  • Extracted Question.AskInput schema from Question.Request to provide a clean input type for the new endpoint (without the server-generated id field)
  • Regenerated SDK with the new Question.ask() method and types (QuestionAskInput, QuestionAskResponses, etc.)

How did you verify your code works?

  • Called endpoint locally and tested with my plugin
  • Added a test for the Question.ask refactor in test/question/question.test.ts
  • Added server endpoint tests in test/server/question.test.ts:
    • Happy path: returns question ID and adds to pending list
    • Returns 404 when session does not exist
    • Returns 400 when session ID format is invalid
    • Returns 400 when header exceeds max length (12 chars)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

This PR appears to be addressing the same feature request. Both PRs have nearly identical titles and are for exposing the Question.ask API endpoint via SDK. Since your current PR (12046) is fixing issue #8384, you should verify if PR #8404 is related to or duplicates this work. Check the status of PR #8404 to determine if this is a duplicate submission or if they address different aspects of the same feature.

@eXamadeus
Copy link
Contributor Author

The bot is right, it's the same PR. I changed base repos so I can maintain my fork easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Expose Question.ask for API/SDK to use

1 participant

Comments