GeezerVison is showing github.com — fix(server): Antigravity ask_question shows the question as the card … · pingdotgg/t3code@744ff6c
File treeExpand file treeCollapse file tree Open diff view settings orchestration-v2/Adapters
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts +37Lines changed: 37 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -162,6 +162,43 @@ describe("AntigravityAdapterV2 flavor", () => { | 162 | 162 | outcome: { outcome: "selected", optionId: "opt-dev" }, | 163 | 163 | }); | 164 | 164 | }); | | 165 | + | | 166 | + it("shows each ask_question question as the question body, not the generic form message", () => { | | 167 | + // agy's ask_question puts each question in its field's title, with no description, | | 168 | + // and a generic count in the form message. | | 169 | + const choice = (title: string) => ({ | | 170 | + type: "string", | | 171 | + title, | | 172 | + oneOf: [ | | 173 | + { const: "npm", title: "npm" }, | | 174 | + { const: "pnpm", title: "pnpm" }, | | 175 | + ], | | 176 | + }); | | 177 | + const form = flavor.extractElicitationForm?.({ | | 178 | + sessionId: "session-1", | | 179 | + mode: "form", | | 180 | + message: "The agent has 2 questions.", | | 181 | + requestedSchema: { | | 182 | + type: "object", | | 183 | + properties: { | | 184 | + q0: choice("Which package manager should this new TypeScript project use?"), | | 185 | + q0_other: { type: "string", title: "Other" }, | | 186 | + q1: choice("Which package manager should the docs site use?"), | | 187 | + q1_other: { type: "string", title: "Other" }, | | 188 | + }, | | 189 | + }, | | 190 | + } as EffectAcpSchema.CreateElicitationRequest); | | 191 | + assert.deepEqual( | | 192 | + form?.questions.map((question) => question.question), | | 193 | + [ | | 194 | + "Which package manager should this new TypeScript project use?", | | 195 | + "Which package manager should the docs site use?", | | 196 | + ], | | 197 | + ); | | 198 | + for (const question of form?.questions ?? []) { | | 199 | + assert.notStrictEqual(question.header, question.question); | | 200 | + } | | 201 | + }); | 165 | 202 | }); | 166 | 203 |
| 167 | 204 | const layerSession = Layer.mergeAll( | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,6 +46,7 @@ import { | 46 | 46 | antigravityCommandOutlivesPrompt, | 47 | 47 | antigravitySubagentOutput, | 48 | 48 | classifyAntigravitySubagentToolCall, | | 49 | + extractAntigravityElicitationForm, | 49 | 50 | extractAntigravityUserInputQuestion, | 50 | 51 | makeAntigravityReadRepair, | 51 | 52 | makeAntigravityUpdateStepsPlans, | @@ -300,6 +301,7 @@ export function makeAntigravityAcpAdapterFlavor( | 300 | 301 | respond: (answers) => makeAntigravityUserInputResponse(request, answers), | 301 | 302 | }; | 302 | 303 | }, | | 304 | + extractElicitationForm: extractAntigravityElicitationForm, | 303 | 305 | normalizeToolCall: normalizeAntigravityToolCall, | 304 | 306 | extractSubagentUpdate: extractAntigravitySubagentUpdate, | 305 | 307 | supportsImagePrompts: true, | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/acp/AntigravityProtocol.ts +32Lines changed: 32 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,6 +15,8 @@ import { | 15 | 15 | ACP_RAW_INPUT_PATH_KEYS, | 16 | 16 | acpChangedPathsOfToolCall, | 17 | 17 | } from "@t3tools/provider-acp/server/clientPolicy"; | | 18 | +import type { AcpAdapterV2Flavor } from "@t3tools/provider-acp/server/adapter"; | | 19 | +import { parseElicitationForm } from "@t3tools/provider-acp/server/elicitationForm"; | 18 | 20 | import { | 19 | 21 | extractMcpToolCallIdentity, | 20 | 22 | type AcpToolCallState, | @@ -171,6 +173,36 @@ export function extractAntigravityUserInputQuestion( | 171 | 173 | }; | 172 | 174 | } | 173 | 175 |
| | 176 | +const isAskQuestionForm = Schema.is( | | 177 | + Schema.Struct({ properties: Schema.Record(Schema.String, Schema.Unknown) }), | | 178 | +); | | 179 | +const isAskQuestionField = Schema.is( | | 180 | + Schema.Struct({ title: Schema.String, description: Schema.optional(Schema.String) }), | | 181 | +); | | 182 | + | | 183 | +/** agy's ask_question puts each question in its field's title and a count in the message. */ | | 184 | +export const extractAntigravityElicitationForm: NonNullable< | | 185 | + AcpAdapterV2Flavor["extractElicitationForm"] | | 186 | +> = (request) => { | | 187 | + if (request.mode !== "form" || !isAskQuestionForm(request.requestedSchema)) return undefined; | | 188 | + const form = parseElicitationForm(request.requestedSchema, request.message); | | 189 | + if (form === undefined) return undefined; | | 190 | + const { properties } = request.requestedSchema; | | 191 | + return { | | 192 | + questions: form.questions.map((question, index) => { | | 193 | + const field = properties[question.id]; | | 194 | + if (!isAskQuestionField(field) || field.description?.trim() || !field.title.trim()) { | | 195 | + return question; | | 196 | + } | | 197 | + return { ...question, header: `Question ${index + 1}`, question: field.title.trim() }; | | 198 | + }), | | 199 | + respond: (answers) => { | | 200 | + const content = form.content(answers); | | 201 | + return content === undefined ? { action: "cancel" } : { action: "accept", content }; | | 202 | + }, | | 203 | + }; | | 204 | +}; | | 205 | + | 174 | 206 | export function makeAntigravityUserInputResponse( | 175 | 207 | request: EffectAcpSchema.RequestPermissionRequest, | 176 | 208 | answers: ProviderUserInputAnswers, | |
Collapse file Copy file name to clipboardExpand all lines: packages/provider-acp/package.json +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | "types": "./src/server/clientTerminals.ts", | 20 | 20 | "import": "./src/server/clientTerminals.ts" | 21 | 21 | }, | | 22 | + "./server/elicitationForm": { | | 23 | + "types": "./src/server/elicitationForm.ts", | | 24 | + "import": "./src/server/elicitationForm.ts" | | 25 | + }, | 22 | 26 | "./server/mcpOverAcpBridge": { | 23 | 27 | "types": "./src/server/mcpOverAcpBridge.ts", | 24 | 28 | "import": "./src/server/mcpOverAcpBridge.ts" | |
|