mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-24 04:47:03 +00:00
* feat(acp): opt-in form elicitation capability advertisement * feat(acp): route elicitation/create forms to a registered handler * feat(opencode): map question forms to AskUserQuestion input and back * feat(opencode): queue question forms as AskUserQuestion requests without auto-answering * feat(opencode): advertise form elicitation for OpenCode v2 * feat(opencode): present the question tool call as AskUserQuestion * feat(opencode): cancel pending question forms on abort, turn end, archive and exit * test(opencode): cover the unshown question result surfacing * feat(acp): let a form elicitation be declined A form elicitation could only be accepted or cancelled. ACP also has decline, the user refusing to answer, and agents may record it differently from a cancel: Antigravity records a declined question as "User Skipped". FormElicitationResponse now includes it, and the backend passes it back to the agent unchanged. * feat(acp): let the ACP permission handler ask the user a question An agent's question (Antigravity's ask_question) is not a permission request: it needs the user's answers, and it must never be answered automatically. askUser() shows it as a pending request with the given tool name and input, whatever the permission mode, and resolves with the user's decision and answers. cancelAll() resolves an open question as aborted, and an open question counts as a pending request, so callers that wait for approvals also wait for it. onUserWait now covers these waits too and no longer takes the request. isUsed() tells whether an id is open or was already shown, since clients hide a pending request whose id was completed before. * feat(agy): answer agy's questions in the question card On agy acp, agy's ask_question used to arrive as a generic tool card and plain text. The turn ended, and whatever the user typed next became the answer. agy now gets form elicitation advertised, so it asks through elicitation/create and keeps the turn open. The launcher takes these forms through the backend's shared form elicitation handler, the same one OpenCode uses. - The question is shown as the AskUserQuestion card on agy's own tool call, with the options as choices, multi-select and an Other field. - The user's choice goes back as agy's answer: the chosen option values, plus free text under qN_other only when the user typed some, so agy records exactly the chosen label. - Denying declines the question, which agy records as "User Skipped". Stop and session end cancel it. - No permission mode answers a question, always-proceed included. - Steer is refused while a question is open. - An approval that carries no usable answer declines instead of sending an empty answer. - A question that arrives after Stop is cancelled. * fix(opencode): decline question forms that arrive after Stop cancelAll only swept requests that already existed, so a form delivered afterwards was queued as a card whose promise never settled. Close the gate synchronously in cancelAll and reopen it when the next prompt begins, matching the aborted-turn guard of the agy handler. * feat(web): let the question card be skipped Add a Skip button, also bound to Esc inside the card, that denies the pending question through the existing deny API and clears the draft like Submit does. A deny already becomes a decline for agy and a cancel for OpenCode, so the backend is unchanged. * fix(agy): decline questions that arrive after the turn has ended * fix(web): keep typed text when Esc is pressed in the question card's text field * fix(question): hide Other on question forms that do not allow free text Forms without qN_custom (OpenCode) or qN_other (agy) take no typed answer, yet the card always offered Other, and a typed answer was dropped so the result became a cancel. Carry an allowFreeText flag through the tool-call input and the synthesized question input, and hide Other on the card when it is false. Inputs without the flag keep showing Other.