feat: handle OpenCode question requests#33
Conversation
…n stream teardown - Check question.reply/question.reject results via extractSdkResult: fields-style clients report API failures in the result instead of throwing, so failures were recorded as answered while OpenCode kept waiting on the question (issue ben-vargas#15). - Pass the request abort signal to question.reply/question.reject so in-flight question requests are cancelled on stream teardown, matching session.prompt and session.abort. - Export the question types from the package entry point so handlers can be typed outside inline settings. - Cover reply API errors, handler throws, and the undefined fallthrough in stream tests.
|
Thanks for this contribution @slegarraga, here's a summary of my review with Fable and a few tweaks... Fable 5 Generated: While reviewing I found one real bug plus two smaller gaps. Since they're all mechanical, and one depends on changes that landed on
Everything passes locally (395 tests, typecheck, lint, build) and CI is running now. One ask before merging: since you presumably have a real OpenCode flow that triggers |
…failures (#35) * fix: surface permission reply API errors instead of recording silent failures Managed clients use responseStyle "fields" without throwOnError, so a failed permission.reply resolves as { error } rather than throwing. replyToPendingApprovals never inspected the result, so API failures were silently recorded as replied and the approval was never retried. Check the result via extractSdkResult, matching the question-handling fix in #33: on error, log a warning, surface it in the response warnings, and skip adding the id to repliedApprovalIds so the next turn retries the reply. * docs: add changelog entry for permission reply error handling
Summary
onQuestionAskedmodel setting for OpenCodequestion.askedstream eventsquestion.replyor reject them throughquestion.rejectCloses #15.
Validation
npm testnpm test -- --run src/opencode-language-model.test.ts src/validation.test.tsnpm run typechecknpm run lint(exits 0; existingno-explicit-anywarnings remain in debug logging)npm run build