GeezerVison is showing github.com — feat(server): Antigravity ACP 1.4.3 runtime and model support (pingdo… · e-kotov/t3code@a86242f
File treeExpand file treeCollapse file tree Open diff view settings orchestration-v2/Adapters
web/src/components/settings
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.ts +8-1Lines changed: 8 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,6 +78,7 @@ export interface AntigravityAdapterV2Options { | 78 | 78 | cwd: string, | 79 | 79 | ) => Effect.Effect<void>; | 80 | 80 | readonly onSessionEvent?: AcpAdapterV2Flavor["onSessionEvent"]; | | 81 | + readonly onModelSelected?: (modelId: string) => Effect.Effect<void>; | 81 | 82 | readonly nativeLogging?: Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"]; | 82 | 83 | readonly continuationRequests?: Parameters<typeof makeAcpAdapterV2>[0]["continuationRequests"]; | 83 | 84 | } | @@ -172,16 +173,22 @@ export function makeAntigravityAcpAdapterFlavor( | 172 | 173 | ...(options.onSessionEvent === undefined ? {} : { onSessionEvent: options.onSessionEvent }), | 173 | 174 | applyModelSelection: Effect.fn("AntigravityAdapterV2.applyModelSelection")(function* ({ | 174 | 175 | runtime, | | 176 | + startResult, | 175 | 177 | modelSelection, | 176 | 178 | }) { | 177 | 179 | const defaultModel = yield* options.defaultModel; | 178 | | - return yield* applyAntigravityAcpModelSelection({ | | 180 | + const selected = yield* applyAntigravityAcpModelSelection({ | 179 | 181 | runtime, | | 182 | + models: startResult.sessionSetupResult.models, | 180 | 183 | model: | 181 | 184 | modelSelection.model === ANTIGRAVITY_DEFAULT_MODEL ? undefined : modelSelection.model, | 182 | 185 | defaultModel, | 183 | 186 | mapError: (cause) => cause, | 184 | 187 | }); | | 188 | + if (selected !== undefined && options.onModelSelected) { | | 189 | + yield* options.onModelSelected(selected); | | 190 | + } | | 191 | + return selected; | 185 | 192 | }), | 186 | 193 | sessionModeForPolicy: (policy) => antigravityPermissionMode(policy.runtimeMode), | 187 | 194 | clientFileSystem: { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/AntigravityProvider.test.ts +76Lines changed: 76 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,6 +28,7 @@ import { | 28 | 28 | buildAntigravityModelsFromSession, | 29 | 29 | makeAntigravityProvider, | 30 | 30 | } from "./AntigravityProvider.ts"; | | 31 | +import { antigravity143Session } from "./acp/antigravity143.fixture.ts"; | 31 | 32 |
| 32 | 33 | const decodeSettings = Schema.decodeSync(AntigravitySettings); | 33 | 34 | const instanceId = ProviderInstanceId.make("antigravity-test"); | @@ -358,6 +359,81 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => { | 358 | 359 | ), | 359 | 360 | ); | 360 | 361 |
| | 362 | + it.effect("lists ACP 1.4 concrete models through grouped thinking-level updates", () => | | 363 | + Effect.scoped( | | 364 | + Effect.gen(function* () { | | 365 | + const harness = yield* makeHarness(); | | 366 | + yield* harness.initialize; | | 367 | + yield* harness.provider.onSessionStarted({ | | 368 | + ...started, | | 369 | + sessionSetupResult: antigravity143Session, | | 370 | + }); | | 371 | + const snapshot = yield* harness.provider.snapshot.getSnapshot; | | 372 | + expect(snapshot.models.map((model) => model.slug)).toEqual( | | 373 | + antigravity143Session.models.availableModels.map((model) => model.modelId), | | 374 | + ); | | 375 | + expect(snapshot.models.find((model) => model.isDefault)?.slug).toBe( | | 376 | + "gemini-3.8-flash-high", | | 377 | + ); | | 378 | + | | 379 | + yield* harness.provider.onConfigOptionsUpdated( | | 380 | + antigravity143Session.configOptions.map((option) => | | 381 | + option.id === "model" | | 382 | + ? { ...option, currentValue: "claude-sonnet-5-5" } | | 383 | + : { ...option, currentValue: "low" }, | | 384 | + ), | | 385 | + ); | | 386 | + expect((yield* harness.provider.snapshot.getSnapshot).models).toEqual(snapshot.models); | | 387 | + }), | | 388 | + ), | | 389 | + ); | | 390 | + | | 391 | + it.effect("defaults to the concrete model a grouped session selected", () => | | 392 | + Effect.scoped( | | 393 | + Effect.gen(function* () { | | 394 | + const harness = yield* makeHarness(); | | 395 | + yield* harness.initialize; | | 396 | + yield* harness.provider.onSessionStarted({ | | 397 | + ...started, | | 398 | + sessionSetupResult: antigravity143Session, | | 399 | + }); | | 400 | + yield* harness.provider.onModelSelected("claude-sonnet-5-5-low"); | | 401 | + yield* harness.provider.onConfigOptionsUpdated( | | 402 | + antigravity143Session.configOptions.map((option) => | | 403 | + option.id === "model" | | 404 | + ? { ...option, currentValue: "claude-sonnet-5-5" } | | 405 | + : { ...option, currentValue: "low" }, | | 406 | + ), | | 407 | + ); | | 408 | + const models = (yield* harness.provider.snapshot.getSnapshot).models; | | 409 | + expect(models.filter((model) => model.isDefault).map((model) => model.slug)).toEqual([ | | 410 | + "claude-sonnet-5-5-low", | | 411 | + ]); | | 412 | + }), | | 413 | + ), | | 414 | + ); | | 415 | + | | 416 | + it.effect("lists models added by config updates to ungrouped sessions", () => | | 417 | + Effect.scoped( | | 418 | + Effect.gen(function* () { | | 419 | + const harness = yield* makeHarness(); | | 420 | + yield* harness.initialize; | | 421 | + yield* harness.provider.onSessionStarted(started); | | 422 | + | | 423 | + const configOptions = [ | | 424 | + { | | 425 | + ...modelConfig, | | 426 | + options: [...modelOptions, { value: "gemini-4-argon-high", name: "Gemini 4 Argon" }], | | 427 | + }, | | 428 | + ]; | | 429 | + yield* harness.provider.onConfigOptionsUpdated(configOptions); | | 430 | + expect((yield* harness.provider.snapshot.getSnapshot).models).toEqual( | | 431 | + buildAntigravityModelsFromSession({ configOptions }), | | 432 | + ); | | 433 | + }), | | 434 | + ), | | 435 | + ); | | 436 | + | 361 | 437 | it.effect("does not guess a version before a custom launcher's first handshake", () => | 362 | 438 | Effect.scoped( | 363 | 439 | Effect.gen(function* () { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/AntigravityProvider.ts +39-4Lines changed: 39 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,6 +31,7 @@ import { | 31 | 31 | type ServerProviderDraft, | 32 | 32 | } from "@t3tools/provider-core/server/snapshotProbe"; | 33 | 33 | import { resolveUsageLimitsAfterProbe } from "@t3tools/provider-core/server/usageLimits"; | | 34 | +import { antigravityGroupedModels } from "./acp/AntigravityAcpSupport.ts"; | 34 | 35 |
| 35 | 36 | const EMPTY_MODEL_CAPABILITIES = createModelCapabilities({ optionDescriptors: [] }); | 36 | 37 | const MAX_WORKSPACE_SNAPSHOTS = 32; | @@ -47,9 +48,9 @@ type SessionSetupResult = Pick< | 47 | 48 | export function buildAntigravityModelsFromSession( | 48 | 49 | setup: SessionSetupResult, | 49 | 50 | ): ReadonlyArray<ServerProviderModel> { | 50 | | - const config = setup.configOptions?.find( | 51 | | - (option) => option.id === "model" || option.category === "model", | 52 | | - ); | | 51 | + const config = antigravityGroupedModels(setup) | | 52 | + ? undefined | | 53 | + : setup.configOptions?.find((option) => option.id === "model" || option.category === "model"); | 53 | 54 | const currentValue = | 54 | 55 | config?.type === "select" ? config.currentValue : setup.models?.currentModelId; | 55 | 56 | const entries = | @@ -115,6 +116,8 @@ function isMissingInstallation(error: EffectAcpErrors.AcpError | ProviderSetupEr | 115 | 116 | interface AntigravityProviderState { | 116 | 117 | readonly draft: ServerProviderDraft; | 117 | 118 | readonly authRevision: number; | | 119 | + /** Config updates omit `models`, so keep a grouped session's concrete list. */ | | 120 | + readonly groupedModels: EffectAcpSchema.SessionModelState | null; | 118 | 121 | } | 119 | 122 |
| 120 | 123 | interface AntigravityProviderOptions { | @@ -159,6 +162,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func | 159 | 162 | const metadata = yield* SubscriptionRef.make<AntigravityProviderState>({ | 160 | 163 | draft: initialDraft, | 161 | 164 | authRevision: 0, | | 165 | + groupedModels: null, | 162 | 166 | }); | 163 | 167 | // Preserve disk-discovered skills when callbacks replace workspace commands; the registry will not rescan them. | 164 | 168 | const discoveredSkills = new Map<string, ServerProvider["skills"]>(); | @@ -286,6 +290,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func | 286 | 290 | const workspace = cwd ? workspaces.find((entry) => entry.cwd === cwd) : undefined; | 287 | 291 | return { | 288 | 292 | authRevision: state.authRevision + 1, | | 293 | + groupedModels: antigravityGroupedModels(started.sessionSetupResult) ?? null, | 289 | 294 | draft: { | 290 | 295 | ...draft, | 291 | 296 | installed: true, | @@ -324,13 +329,41 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func | 324 | 329 | const onConfigOptionsUpdated = Effect.fn("AntigravityProvider.onConfigOptionsUpdated")(function* ( | 325 | 330 | configOptions: ReadonlyArray<EffectAcpSchema.SessionConfigOption>, | 326 | 331 | ) { | 327 | | - const models = buildAntigravityModelsFromSession({ configOptions }); | 328 | 332 | yield* SubscriptionRef.update(metadata, (state) => { | 329 | 333 | if (state.draft.auth.status !== "authenticated") return state; | | 334 | + const models = buildAntigravityModelsFromSession( | | 335 | + state.groupedModels ? { models: state.groupedModels } : { configOptions }, | | 336 | + ); | 330 | 337 | return { ...state, draft: { ...state.draft, models } }; | 331 | 338 | }); | 332 | 339 | }); | 333 | 340 |
| | 341 | + // Grouped config updates name only the family and thinking level. | | 342 | + const onModelSelected = Effect.fn("AntigravityProvider.onModelSelected")(function* ( | | 343 | + modelId: string, | | 344 | + ) { | | 345 | + yield* SubscriptionRef.update(metadata, (state) => { | | 346 | + const grouped = state.groupedModels; | | 347 | + if ( | | 348 | + state.draft.auth.status !== "authenticated" || | | 349 | + !grouped || | | 350 | + grouped.currentModelId === modelId || | | 351 | + !grouped.availableModels.some((model) => model.modelId === modelId) | | 352 | + ) { | | 353 | + return state; | | 354 | + } | | 355 | + const groupedModels = { ...grouped, currentModelId: modelId }; | | 356 | + return { | | 357 | + ...state, | | 358 | + groupedModels, | | 359 | + draft: { | | 360 | + ...state.draft, | | 361 | + models: buildAntigravityModelsFromSession({ models: groupedModels }), | | 362 | + }, | | 363 | + }; | | 364 | + }); | | 365 | + }); | | 366 | + | 334 | 367 | const onAvailableCommands = Effect.fn("AntigravityProvider.onAvailableCommands")(function* ( | 335 | 368 | commands: ReadonlyArray<EffectAcpSchema.AvailableCommand>, | 336 | 369 | cwd?: string, | @@ -375,6 +408,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func | 375 | 408 | (state) => | 376 | 409 | ({ | 377 | 410 | authRevision: state.authRevision + 1, | | 411 | + groupedModels: null, | 378 | 412 | draft: { | 379 | 413 | ...state.draft, | 380 | 414 | auth: { status: "unauthenticated" }, | @@ -425,6 +459,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func | 425 | 459 | snapshot: { ...managed, getSnapshot }, | 426 | 460 | onSessionStarted, | 427 | 461 | onConfigOptionsUpdated, | | 462 | + onModelSelected, | 428 | 463 | onAvailableCommands, | 429 | 464 | onSignedOut: clearAccountMetadata(), | 430 | 465 | onAuthRequired: clearAccountMetadata(), | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/Drivers/AntigravityDriver.test.ts +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -333,6 +333,20 @@ it.layer(layerTest)("AntigravityDriver", (it) => { | 333 | 333 | }).pipe(Effect.scoped), | 334 | 334 | ); | 335 | 335 |
| | 336 | + it.effect.skipIf(windowsHost)("reports the configured ACP client name to the agent", () => | | 337 | + Effect.gen(function* () { | | 338 | + const h = yield* makeHarness({ config: { acpClientName: "custom-client" } }); | | 339 | + yield* h.refresh(); | | 340 | + const requests = yield* h.readRequests; | | 341 | + expect( | | 342 | + requests | | 343 | + .filter((request) => request.method === "initialize") | | 344 | + .map((request) => request.params?.clientInfo), | | 345 | + ).toEqual([{ name: "custom-client", version: "0.0.0" }]); | | 346 | + yield* h.assertClosed; | | 347 | + }).pipe(Effect.scoped), | | 348 | + ); | | 349 | + | 336 | 350 | it.effect.skipIf(windowsHost)( | 337 | 351 | "closes refresh processes and clears account metadata when Google sign-in is required", | 338 | 352 | () => | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/Drivers/AntigravityDriver.ts +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -241,6 +241,9 @@ export const AntigravityDriver: ProviderDriver< | 241 | 241 | ); | 242 | 242 | const runtime = yield* makeAntigravityAcpRuntime({ | 243 | 243 | ...input, | | 244 | + ...(settings.acpClientName | | 245 | + ? { clientInfo: { ...input.clientInfo, name: settings.acpClientName } } | | 246 | + : {}), | 244 | 247 | authMethod: auth.authMethod, | 245 | 248 | childProcessSpawner: spawner, | 246 | 249 | spawn: buildAntigravityAcpSpawnInput({ | @@ -425,6 +428,7 @@ export const AntigravityDriver: ProviderDriver< | 425 | 428 | ? provider.onAvailableCommands(event.availableCommands) | 426 | 429 | : Effect.void; | 427 | 430 | }, | | 431 | + onModelSelected: provider.onModelSelected, | 428 | 432 | continuationRequests, | 429 | 433 | nativeLogging: (threadId) => | 430 | 434 | makeNativeLogger({ | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/acp/AntigravityAcpSupport.test.ts +34-1Lines changed: 34 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,6 +17,7 @@ import { | 17 | 17 | applyAntigravityAcpModelSelection, | 18 | 18 | buildAntigravityPrompt, | 19 | 19 | } from "./AntigravityAcpSupport.ts"; | | 20 | +import { antigravity143Session } from "./antigravity143.fixture.ts"; | 20 | 21 |
| 21 | 22 | const modelConfig = { | 22 | 23 | id: "model", | @@ -34,13 +35,20 @@ function makeModelRuntime( | 34 | 35 | failure?: EffectAcpErrors.AcpError, | 35 | 36 | ) { | 36 | 37 | const selections: string[] = []; | | 38 | + const sessionModelSelections: string[] = []; | 37 | 39 | const setModel = Effect.fn("AntigravityAcpSupportTest.setModel")(function* (model: string) { | 38 | 40 | if (failure) return yield* failure; | 39 | 41 | selections.push(model); | 40 | 42 | }); | | 43 | + const setSessionModel = (model: string) => | | 44 | + Effect.sync(() => { | | 45 | + sessionModelSelections.push(model); | | 46 | + return {}; | | 47 | + }); | 41 | 48 | return { | 42 | | - runtime: { getConfigOptions: Effect.succeed(configOptions), setModel }, | | 49 | + runtime: { getConfigOptions: Effect.succeed(configOptions), setModel, setSessionModel }, | 43 | 50 | selections, | | 51 | + sessionModelSelections, | 44 | 52 | }; | 45 | 53 | } | 46 | 54 |
| @@ -137,6 +145,31 @@ describe("applyAntigravityAcpModelSelection", () => { | 137 | 145 | expect(selections).toEqual(["gemini-saved"]); | 138 | 146 | }), | 139 | 147 | ); | | 148 | + | | 149 | + it.effect("selects concrete models when ACP 1.4 groups thinking levels by family", () => | | 150 | + Effect.gen(function* () { | | 151 | + const { runtime, selections, sessionModelSelections } = makeModelRuntime( | | 152 | + antigravity143Session.configOptions, | | 153 | + ); | | 154 | + const select = (model: string) => | | 155 | + applyAntigravityAcpModelSelection({ | | 156 | + runtime, | | 157 | + models: antigravity143Session.models, | | 158 | + model, | | 159 | + defaultModel: "gemini-3.8-flash-high", | | 160 | + mapError: (cause) => cause, | | 161 | + }); | | 162 | + | | 163 | + expect(yield* select("claude-sonnet-5-5-low")).toBe("claude-sonnet-5-5-low"); | | 164 | + expect(yield* select(ANTIGRAVITY_DEFAULT_MODEL)).toBe("gemini-3.8-flash-high"); | | 165 | + expect(sessionModelSelections).toEqual(["claude-sonnet-5-5-low", "gemini-3.8-flash-high"]); | | 166 | + expect(selections).toEqual([]); | | 167 | + | | 168 | + const error = yield* select("claude-opus-5-5-low").pipe(Effect.flip); | | 169 | + expect(error).toMatchObject({ _tag: "AcpRequestError", code: -32602 }); | | 170 | + expect(sessionModelSelections).toHaveLength(2); | | 171 | + }), | | 172 | + ); | 140 | 173 | }); | 141 | 174 |
| 142 | 175 | const imageAttachment = { | |
|