diff --git a/Dockerfile b/Dockerfile index ea9cf7e..ab79413 100644 --- a/Dockerfile +++ b/Dockerfile @@ -207,7 +207,7 @@ COPY --from=t3-build-node /usr/local/bin/node /usr/local/bin/node COPY docker/runtime/ /src/docker/runtime/ COPY scripts/build-t3-runtime.mjs /src/scripts/build-t3-runtime.mjs # The one bundled version pin; scripts/bump-versions.sh refreshes it. -ARG T3_VERSION=0.1.10 +ARG T3_VERSION=0.1.11 ARG TARGETARCH ENV npm_config_store_dir=/var/cache/pnpm RUN --mount=type=cache,target=/var/cache/pnpm set -eux; \ diff --git a/docker/runtime/patches/agent-resources.mjs b/docker/runtime/patches/agent-resources.mjs index 0d6df4b..7586149 100644 --- a/docker/runtime/patches/agent-resources.mjs +++ b/docker/runtime/patches/agent-resources.mjs @@ -13,7 +13,9 @@ export function patchAgentResources(source) { next[file] = next[file].replace(before, after); }; change(files[0], 'import * as NodeFSP from "node:fs/promises";', 'import * as NodeFSP from "node:fs/promises";\nimport { linkAntigravityUserResources } from "./antigravityUserResources.ts";'); - change(files[0], ' yield* linkAntigravityUserSkills({ profileDirectory: geminiHome, userHome, platform });', ` yield* linkAntigravityUserSkills({ profileDirectory: geminiHome, userHome, platform }); +// Reviewed against v0.1.11 (59651c1761f6c63e9b6056839067066968e6a406) and +// 0.1.12-nightly.20261121.5038: linkAntigravityUserSkills became linkAntigravityUserConfig. + change(files[0], ' yield* linkAntigravityUserConfig({ profileDirectory: geminiHome, userHome, platform });', ` yield* linkAntigravityUserConfig({ profileDirectory: geminiHome, userHome, platform }); yield* Effect.tryPromise(() => linkAntigravityUserResources(geminiHome, userHome)).pipe( Effect.mapError((error) => authSupportError(error instanceof Error ? error.message : "Antigravity global instructions and MCP settings could not be linked into its T3 profile.")), );`); diff --git a/docker/runtime/patches/antigravity-sign-in.mjs b/docker/runtime/patches/antigravity-sign-in.mjs deleted file mode 100644 index 9209b4c..0000000 --- a/docker/runtime/patches/antigravity-sign-in.mjs +++ /dev/null @@ -1,133 +0,0 @@ -import { readFileSync } from "node:fs"; - -const authFile = "apps/server/src/provider/AntigravityAuth.ts"; -const driverFile = "apps/server/src/provider/Drivers/AntigravityDriver.ts"; -export const files = [authFile, driverFile]; -export const creates = ["apps/server/src/provider/antigravityTerminalLogin.ts"]; -export const assets = [new URL("./antigravity-terminal-login.ts", import.meta.url)]; - -export function patchAntigravitySignIn(source) { - const next = { ...source }; - const drift = (file) => new Error(`The Antigravity sign-in patch no longer matches ${file}. Review the upstream source before publishing.`); - const change = (file, before, after) => { - if (typeof next[file] !== "string" || next[file].split(before).length !== 2) throw drift(file); - next[file] = next[file].replace(before, after); - }; - if (Object.hasOwn(next, creates[0])) throw drift(creates[0]); - next[creates[0]] = readFileSync(assets[0], "utf8"); - - change(authFile, 'import type { ProviderAuthController }', `import type { AntigravityTerminalChallenge } from "./antigravityTerminalLogin.ts"; -import type { ProviderAuthController }`); - change(authFile, ' readonly usesBrowser?: boolean;', ` readonly usesBrowser?: boolean; - readonly terminalLogin?: (onChallenge: AntigravityTerminalChallenge) => - Effect.Effect;`); - change(authFile, ' callbackSent: boolean;', ` callbackSent: boolean; - submitCode?: Parameters[1] | undefined;`); - change(authFile, 'const isAcpRequestError = Schema.is(AcpErrors.AcpRequestError);', `const isAcpRequestError = Schema.is(AcpErrors.AcpRequestError); -const needsTerminalLogin = (error: unknown) => - isAcpRequestError(error) && error.method === "authenticate" && error.code === -32603 && - error.errorMessage.startsWith("No browser is available here") && - error.errorMessage.includes("agy acp --login");`); - change(authFile, ' phase: Exit.isSuccess(result) ? "succeeded" : "failed",', ` phase: Exit.isSuccess(result) ? "succeeded" : "failed", - interaction: null,`); - change(authFile, ' flow.pending = undefined;\n yield* publishFlow(flow, {', ' flow.pending = undefined;\n flow.submitCode = undefined;\n yield* publishFlow(flow, {'); - change(authFile, ' phase,\n authorizationUrl: null,', ' phase,\n interaction: null,\n authorizationUrl: null,'); - change(authFile, ' phase: "cancelled",\n authorizationUrl: null,', ' phase: "cancelled",\n interaction: null,\n authorizationUrl: null,'); - change(authFile, ' interaction:\n state.phase === "waiting" && state.authorizationUrl && state.flowId', - ' interaction: state.interaction ?? (\n state.phase === "waiting" && state.authorizationUrl && state.flowId'); - change(authFile, ' acceptsCallback: true,\n }\n : null,', - ' acceptsCallback: true,\n }\n : null),'); - - const oldRunStart = ' const runtime = yield* options.makeRuntime({\n onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url),\n });'; - const oldRunEnd = ' yield* options.onAuthenticated(started, runtime);'; - const auth = next[authFile]; - const startAcp = auth.indexOf(oldRunStart); - const endAcp = auth.indexOf(oldRunEnd, startAcp) + oldRunEnd.length; - if (startAcp < 0 || endAcp < startAcp || auth.split(oldRunStart).length !== 2 || - auth.split(oldRunEnd).length !== 2) throw drift(authFile); - const runAcp = auth.slice(startAcp, endAcp).split("\n").map(line => line ? " " + line : line).join("\n"); - change(authFile, auth.slice(startAcp, endAcp), ` const runAcp = Effect.gen(function* () { -${runAcp} - }).pipe(Effect.scoped); - const terminalLogin = options.terminalLogin; - yield* terminalLogin ? runAcp.pipe(Effect.catchIf(needsTerminalLogin, () => - terminalLogin((url, submit) => lock.withPermits(1)( - Effect.gen(function* () { - if (activeFlow !== flow || operation !== "auth") return; - flow.submitCode = submit; - yield* publishFlow(flow, { - ...flow.state, - phase: "waiting", - authorizationUrl: url, - message: "Open Google sign-in and paste the authorization code.", - interaction: { - type: "credentials", id: flow.id, - fields: [{ name: "authorizationCode", label: "Google authorization code", secret: true }], - }, - }); - }), - )).pipe(Effect.scoped, Effect.andThen(runAcp)), - )) : runAcp;`); - change(authFile, ' complete: Effect.fn("AntigravityAuth.complete")', ` respond: Effect.fn("AntigravityAuth.respond")(function* (ownerSessionId, input) { - return yield* lock.withPermits(1)(Effect.gen(function* () { - const flow = yield* requireFlow(ownerSessionId, input.flowId, "respond"); - if (!flow.submitCode || flow.state.phase !== "waiting" || input.interactionId !== flow.id) { - return yield* setupError("respond", "This Google authorization code request is no longer active."); - } - const code = input.response.type === "credentials" ? input.response.values.authorizationCode?.trim() : undefined; - if (!code || !/^[!-~]{1,4096}$/u.test(code)) { - return yield* setupError("respond", "Paste the authorization code shown by Google."); - } - yield* flow.submitCode(code); - flow.submitCode = undefined; - flow.callbackSent = true; - yield* publishFlow(flow, { - ...flow.state, - phase: "verifying", - interaction: null, - authorizationUrl: null, - message: "Waiting for Google to finish sign-in.", - }); - return flow.state; - })); - }), - complete: Effect.fn("AntigravityAuth.complete")`); - - change(driverFile, 'import { makeAntigravityAuth, type AntigravityAuth }', `import { runAntigravityTerminalLogin, type AntigravityTerminalChallenge } from "../antigravityTerminalLogin.ts"; -import { makeAntigravityAuth, type AntigravityAuth }`); - const driver = next[driverFile]; - const runtimeDeclaration = ' const makeRuntime = Effect.fn("AntigravityDriver.makeRuntime")'; - const signature = driver.indexOf(runtimeDeclaration); - const body = driver.indexOf(' if (authConfigIssue !== null) {', signature); - const runtime = driver.indexOf(' const runtime = yield* makeAntigravityAcpRuntime({', body); - const threadEnv = driver.indexOf(' // \`buildAntigravityAcpSpawnInput\` sets', body); - if (signature < 0 || body < signature || runtime < body || - driver.split(runtimeDeclaration).length !== 2) throw drift(driverFile); - const end = threadEnv >= body && threadEnv < runtime ? threadEnv : runtime; - const preparation = driver.slice(body, end); - if (!preparation.includes('const profile = yield* prepareAntigravityProfile(') || - !preparation.includes('const runtimeTempDirectory = yield* Effect.acquireRelease(')) throw drift(driverFile); - change(driverFile, driver.slice(signature, end), ` const prepareRuntime = Effect.fn("AntigravityDriver.prepareRuntime")(function* () { -${preparation} return { executable, profile, runtimeTempDirectory }; - }); - -${driver.slice(signature, body)} const { executable, profile, runtimeTempDirectory } = yield* prepareRuntime(); -`); - change(driverFile, ' const authFlow: AntigravityAuth = yield* makeAntigravityAuth({', ` const terminalLogin = Effect.fn("AntigravityDriver.terminalLogin")(function* (onChallenge: AntigravityTerminalChallenge) { - const { executable, profile, runtimeTempDirectory } = yield* prepareRuntime(); - if (executable.harnessPath !== null) { - return yield* new ProviderSetupError({ instanceId, operation: "start", detail: "Terminal sign-in requires the Antigravity CLI." }); - } - const spawn = buildAntigravityAcpSpawnInput({ - installation: executable, profile, cwd: runtimeTempDirectory, - baseEnv: processEnvironment, auth, runtimeTempDirectory, - }); - yield* runAntigravityTerminalLogin(instanceId, { - command: spawn.command, args: spawn.args ?? [], cwd: runtimeTempDirectory, env: spawn.env ?? {}, - }, onChallenge).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner)); - }); - - const authFlow: AntigravityAuth = yield* makeAntigravityAuth({ - ...(auth.authMethod === "oauth-personal" ? { terminalLogin } : {}),`); - return next; -} diff --git a/docker/runtime/patches/antigravity-terminal-login.ts b/docker/runtime/patches/antigravity-terminal-login.ts deleted file mode 100644 index 2020270..0000000 --- a/docker/runtime/patches/antigravity-terminal-login.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { stripVTControlCharacters } from "node:util"; -import { ProviderSetupError, type ProviderInstanceId } from "@t3tools/contracts"; -import * as Deferred from "effect/Deferred"; -import * as Effect from "effect/Effect"; -import * as Stream from "effect/Stream"; -import * as ChildProcess from "effect/process/ChildProcess"; -import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; - -export type AntigravityTerminalChallenge = ( - url: string, - submit: (code: string) => Effect.Effect, -) => Effect.Effect; - -function authorizationUrl(line: string): string | undefined { - const value = stripVTControlCharacters(line).trim(); - if (!value.startsWith("https://accounts.google.com/") || value.length > 16_384 || /\s/u.test(value)) return; - const url = URL.parse(value); - if (!url || url.origin !== "https://accounts.google.com" || url.username || url.password || url.hash) return; - if (url.pathname !== "/o/oauth2/auth" && url.pathname !== "/o/oauth2/v2/auth") return; - const params = url.searchParams; - const single = (key: string) => params.getAll(key).length === 1 ? params.get(key) : null; - if ( - single("redirect_uri") !== "https://antigravity.google/oauth-callback" || - single("response_type") !== "code" || !single("state") || !single("code_challenge") || - single("code_challenge_method") !== "S256" - ) return; - return value; -} - -export const runAntigravityTerminalLogin = Effect.fn("AntigravityTerminalLogin.run")(function* ( - instanceId: ProviderInstanceId, - input: { command: string; args: ReadonlyArray; cwd: string; env: NodeJS.ProcessEnv }, - onChallenge: AntigravityTerminalChallenge, -) { - const error = (detail: string) => new ProviderSetupError({ instanceId, operation: "start", detail }); - const unavailable = error("Antigravity could not start its terminal sign-in. Try again."); - const challenge = yield* Deferred.make(); - const code = yield* Deferred.make(); - const inputStream = Stream.fromEffect(Deferred.await(code).pipe( - Effect.map((value) => new TextEncoder().encode(`${value}\n`)), - )); - const env = { ...input.env }; - delete env.DISPLAY; - delete env.WAYLAND_DISPLAY; - delete env.BROWSER; - const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; - const child = yield* spawner.spawn(ChildProcess.make(input.command, [...input.args, "--login"], { - cwd: input.cwd, env, extendEnv: false, shell: false, - stdin: inputStream, stdout: "pipe", stderr: "ignore", forceKillAfter: "1 second", - })).pipe(Effect.mapError(() => unavailable)); - - // OAuth output may include secrets. Keep only the first validated link and drain the rest. - const decoder = new TextDecoder(); - let pending = ""; - let bytes = 0; - let found = false; - yield* Stream.runForEach(child.stdout, (chunk) => Effect.suspend(() => { - if (found) return Effect.void; - bytes += chunk.length; - if (bytes > 32_768) return Deferred.fail(challenge, unavailable).pipe(Effect.asVoid); - const lines = (pending + decoder.decode(chunk, { stream: true })).split("\n"); - pending = lines.pop() ?? ""; - for (const line of lines) { - const url = authorizationUrl(line); - if (url) { - found = true; - pending = ""; - return Deferred.succeed(challenge, url).pipe(Effect.asVoid); - } - } - return Effect.void; - })).pipe( - Effect.andThen(Deferred.fail(challenge, unavailable)), - Effect.catch(() => Deferred.fail(challenge, unavailable)), - Effect.forkScoped, - ); - const url = yield* Deferred.await(challenge).pipe(Effect.timeoutOrElse({ - duration: "30 seconds", - orElse: () => Effect.fail(unavailable), - })); - yield* onChallenge(url, (value) => Deferred.succeed(code, value).pipe(Effect.asVoid)); - const status = yield* child.exitCode.pipe(Effect.mapError(() => unavailable)); - if (Number(status) !== 0 || !(yield* Deferred.isDone(code))) { - return yield* error("Google sign-in did not accept the authorization code. Start sign-in again."); - } -}); diff --git a/docker/runtime/patches/gateway-context.mjs b/docker/runtime/patches/gateway-context.mjs index 21dd746..ff3ca83 100644 --- a/docker/runtime/patches/gateway-context.mjs +++ b/docker/runtime/patches/gateway-context.mjs @@ -73,10 +73,12 @@ export function patchGatewayContext(source) { ` canApplyClaudeSelectionLive(existing.selection, compiledSelection) && claudeGatewayContextKey(adapterOptions.environment, existing.selection.apiModelId) === claudeGatewayContextKey(adapterOptions.environment, compiledSelection.apiModelId) &&`); - change(files[1], ' customModelCapabilityOverrides: Schema.optionalKey(Schema.Boolean),', - ' customModelCapabilityOverrides: Schema.optionalKey(Schema.Boolean),\n gatewayModelLimits: Schema.optionalKey(Schema.Boolean),'); - change(files[2], ' customModelCapabilityOverrides: true,', - ' customModelCapabilityOverrides: true,\n gatewayModelLimits: true,'); + // Reviewed against v0.1.11 (59651c1761f6c63e9b6056839067066968e6a406) and + // 0.1.12-nightly.20261121.5038: upstream dropped customModelCapabilityOverrides. + change(files[1], ' threadFind: Schema.optionalKey(Schema.Boolean),', + ' threadFind: Schema.optionalKey(Schema.Boolean),\n gatewayModelLimits: Schema.optionalKey(Schema.Boolean),'); + change(files[2], ' threadFind: true,', + ' threadFind: true,\n gatewayModelLimits: true,'); next[creates[0]] = readFileSync(assets[0], 'utf8'); return next; } diff --git a/docker/runtime/patches/index.mjs b/docker/runtime/patches/index.mjs index 373d42c..428beab 100644 --- a/docker/runtime/patches/index.mjs +++ b/docker/runtime/patches/index.mjs @@ -1,6 +1,5 @@ import * as agentResources from "./agent-resources.mjs"; import * as antigravityRuntime from "./antigravity-runtime.mjs"; -import * as antigravitySignIn from "./antigravity-sign-in.mjs"; import * as opencodeSkills from "./opencode-skills.mjs"; import * as projectDirectory from "./project-directory.mjs"; import * as setupPalette from "./setup-palette.mjs"; @@ -12,7 +11,6 @@ import * as gatewayQuota from "./gateway-quota.mjs"; export const BUILD_REVISION = 5; export const patches = [{ name: "agent-resources", module: new URL("./agent-resources.mjs", import.meta.url), files: agentResources.files, creates: agentResources.creates, assets: agentResources.assets, apply: agentResources.patchAgentResources }, { name: "antigravity-runtime", module: new URL("./antigravity-runtime.mjs", import.meta.url), files: antigravityRuntime.files, apply: antigravityRuntime.patchAntigravityRuntime }, - { name: "antigravity-sign-in", module: new URL("./antigravity-sign-in.mjs", import.meta.url), files: antigravitySignIn.files, creates: antigravitySignIn.creates, assets: antigravitySignIn.assets, apply: antigravitySignIn.patchAntigravitySignIn }, { name: "project-directory", module: new URL("./project-directory.mjs", import.meta.url), files: projectDirectory.files, apply: projectDirectory.patchProjectDirectory }, { name: "gateway-capabilities", module: new URL("./gateway-capabilities.mjs", import.meta.url), files: gatewayCapabilities.files, apply: gatewayCapabilities.patchGatewayCapabilities }, { name: "gateway-context", module: new URL("./gateway-context.mjs", import.meta.url), files: gatewayContext.files, creates: gatewayContext.creates, assets: gatewayContext.assets, apply: gatewayContext.patchGatewayContext }, diff --git a/scripts/fixtures/antigravity-acp.mjs b/scripts/fixtures/antigravity-acp.mjs index b2e7509..8eb3555 100644 --- a/scripts/fixtures/antigravity-acp.mjs +++ b/scripts/fixtures/antigravity-acp.mjs @@ -8,10 +8,10 @@ const input = createInterface({ input: process.stdin }); if (process.argv.includes("--login")) { assert.equal(process.env.DISPLAY, undefined); - assert.equal(process.env.BROWSER, undefined); + // The native login keeps the browser suppression helper and only strips the display. + assert.ok((process.env.BROWSER ?? "").includes("'-e'")); const params = new URLSearchParams({ redirect_uri: "https://antigravity.google/oauth-callback", response_type: "code", state: "fixture-state", code_challenge: "fixture-challenge", code_challenge_method: "S256" }); - console.log("https://accounts.google.com/o/oauth2/auth?redirect_uri=https%3A%2F%2Fwrong.example"); console.log(`https://accounts.google.com/o/oauth2/auth?${params}`); for await (const code of input) { assert.equal(code, "fixture-authorization-code"); diff --git a/scripts/lib/gateway-quota-smoke.mjs b/scripts/lib/gateway-quota-smoke.mjs index cf793ea..a79c297 100644 --- a/scripts/lib/gateway-quota-smoke.mjs +++ b/scripts/lib/gateway-quota-smoke.mjs @@ -30,6 +30,9 @@ export async function verifyGatewayQuota({ api, gatewayT3, until }) { assert.equal(url.searchParams.get("name"), "muse.json"); return send({ dca_token: "dca:fixture-only", api_key: "LLM|private-fixture" }); } + // Nightly hubs ask which models an account routes to; empty keeps the + // older-hub behavior the smoke asserts (every model of its driver). + if (url.pathname.endsWith("/auth-files/models")) return send({ models: [] }); if (url.pathname.endsWith("/quota/fetch")) { assert.equal(body.auth_index, "go"); assert.equal(body.plugin_id, "opencode-plugin"); return failing ? send({ error: "private-fixture-error" }, 501) : send(grouped); diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index 69ed187..e7b7d61 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -1341,9 +1341,16 @@ check "native cache cleanup preserves shared dependencies and stays inside revie # raises it slips through until someone's session fails. opencode_floor_matches_t3() { local declared catalogue installed - declared="$(docker exec "$NAME" sh -c \ - "grep -a -o 'MINIMUM_OPENCODE_VERSION *= *\"[0-9][0-9.]*\"' $T3_BUNDLE | head -1" 2>/dev/null \ - | grep -o '[0-9][0-9.]*' | head -1)" + # 0.1.11 dropped the compiled MINIMUM_OPENCODE_VERSION constant for a + # driver-compat table; the broken-range boundary is the floor it enforces. + declared="$(docker exec -i "$NAME" node --input-type=module 2>/dev/null < part.includes('"t3CodeRange": ">=0.0.46"')); +const broken = /"range": "<([0-9.]+)",\s*"status": "broken"/.exec(entry ?? ""); +process.stdout.write(broken?.[1] ?? ""); +NODE +)" catalogue="$(docker exec "$NAME" sh -c \ "grep -o 'MINIMUM_OPENCODE_VERSION = \"[0-9.]*\"' /opt/t3-harness/catalogue.mjs" \ | grep -o '[0-9][0-9.]*')" @@ -1507,15 +1514,48 @@ signin_id() { } # Claude renders its URL as an OSC-8 hyperlink wrapped over several lines; -# scraping the visible text yields a truncated URL missing the PKCE challenge -# and state, which would send you to a sign-in page that cannot complete. +# scraping the visible text yields a truncated URL, which would send you to a +# sign-in page that cannot complete. What "complete" means changed in +# November 2026: the authorize URL used to carry its PKCE code_challenge and +# state as query parameters, and now carries one opaque ?z- token instead, +# with the challenge kept server side. Accept either form whole, reject a +# truncated legacy URL that lost its tail parameters. +claude_url_is_complete() { + case "$1" in + "https://claude.ai/oauth/authorize"?*client_id=*) + case "$1" in *code_challenge=*state=*|*state=*code_challenge=*) return 0 ;; *) return 1 ;; esac ;; + "https://claude.ai/oauth/authorize?z-"*) + [ "${#1}" -ge 60 ] ;; + *) return 1 ;; + esac +} claude_url_complete() { - local id + local id state url="" id="$(signin_id claude)" [ -n "$id" ] || return 1 - sleep 14 - session_state "$id" | grep -q 'code_challenge' && - session_state "$id" | grep -q '"state":"awaiting-code"' + # Rendering the login URL can take well past a fixed wait on a cold or busy + # runner, so poll for the captured URL instead of racing it. + for _ in $(seq 1 150); do + state="$(session_state "$id")" + url="$(printf %s "$state" | sed -n 's/.*"url":"\([^"]*\)".*/\1/p')" + if printf %s "$state" | grep -q '"state":"awaiting-code"' && + claude_url_is_complete "$url"; then + return 0 + fi + sleep 2 + done + # check() discards output; leave a redacted note for the failure summary so + # the next timeout says which half of the capture never arrived. + local form=none + case "$url" in + *client_id=*) form=legacy ;; + "https://claude.ai/oauth/authorize?z-"*) form=opaque ;; + ?*) form=other ;; + esac + printf 'Claude OAuth capture timed out: session state=%s, url form=%s, url bytes=%s\n' \ + "$(printf %s "$state" | sed -n 's/.*"state":"\([^"]*\)".*/\1/p')" \ + "$form" "${#url}" >> "$UI_AUDIT_LOG" + return 1 } check "Claude sign-in captures a complete OAuth URL" claude_url_complete diff --git a/scripts/t3-integration-smoke.mjs b/scripts/t3-integration-smoke.mjs index ae889a5..9b39526 100644 --- a/scripts/t3-integration-smoke.mjs +++ b/scripts/t3-integration-smoke.mjs @@ -157,14 +157,15 @@ exec "$T3_INFRA_NODE" "$@" await waitForCode(first.flowId); const cancelled = await api.call("provider.auth.cancel", { ...authInput, flowId: first.flowId }); assert.equal(cancelled.phase, "cancelled"); - assert.equal(cancelled.interaction, null); + // Upstream's state omits the optional interaction key once none is offered. + assert.equal(cancelled.interaction ?? null, null); const { flowId } = await api.call("provider.auth.start", authInput); const challenge = await waitForCode(flowId); assert.equal(new URL(challenge.authorizationUrl).searchParams.get("redirect_uri"), "https://antigravity.google/oauth-callback"); - assert.deepEqual(challenge.interaction.fields, [{ name: "authorizationCode", label: "Google authorization code", secret: true }]); - const respond = (authorizationCode) => api.call("provider.auth.respond", { ...authInput, flowId, - interactionId: challenge.interaction.id, response: { type: "credentials", values: { authorizationCode } } }); - await assert.rejects(respond("wrong\nline"), /authorization code shown by Google/); + assert.deepEqual(challenge.interaction.fields, [{ name: "code", label: "Code from the Antigravity page", secret: false }]); + const respond = (code) => api.call("provider.auth.respond", { ...authInput, flowId, + interactionId: challenge.interaction.id, response: { type: "credentials", values: { code } } }); + await assert.rejects(respond("wrong\nline"), /Paste the code from the Antigravity page/); await respond("fixture-authorization-code"); const signedIn = await until(async () => { const state = await api.first("provider.auth.subscribe", authInput); diff --git a/tests/agent-resources-patch.test.mjs b/tests/agent-resources-patch.test.mjs index 2726a51..89a9638 100644 --- a/tests/agent-resources-patch.test.mjs +++ b/tests/agent-resources-patch.test.mjs @@ -105,7 +105,7 @@ test('Cursor keeps its primary project, source layers and tool protocol while ad test('the resource bridges are registered and reject source drift and repeated application', () => { const source = { - [files[0]]: 'import * as NodeFSP from "node:fs/promises";\n yield* linkAntigravityUserSkills({ profileDirectory: geminiHome, userHome, platform });', + [files[0]]: 'import * as NodeFSP from "node:fs/promises";\n yield* linkAntigravityUserConfig({ profileDirectory: geminiHome, userHome, platform });', [files[1]]: 'import * as CursorAgentSdk from "./CursorAgentSdk.ts";\n.open({ ...input, options: { ...input.options, apiKey } })', }; const next = patchAgentResources(source); diff --git a/tests/gateway-context-patch.test.mjs b/tests/gateway-context-patch.test.mjs index 156946d..e331e0b 100644 --- a/tests/gateway-context-patch.test.mjs +++ b/tests/gateway-context-patch.test.mjs @@ -71,8 +71,8 @@ const source = { } as ClaudeSdkSettings); canApplyClaudeSelectionLive(existing.selection, compiledSelection) && nextCondition`, - [files[1]]: ' customModelCapabilityOverrides: Schema.optionalKey(Schema.Boolean),', - [files[2]]: ' customModelCapabilityOverrides: true,', + [files[1]]: ' threadFind: Schema.optionalKey(Schema.Boolean),', + [files[2]]: ' threadFind: true,', }; test('the runtime contract includes the helper, initial settings, and switch guard and rejects upstream drift', () => { const result = patchGatewayContext(source); diff --git a/tests/nightly-4616-runtime-patches.test.mjs b/tests/nightly-4616-runtime-patches.test.mjs index 42f8b5b..e29971f 100644 --- a/tests/nightly-4616-runtime-patches.test.mjs +++ b/tests/nightly-4616-runtime-patches.test.mjs @@ -13,8 +13,8 @@ const settingsFixture = readFileSync(new URL('./fixtures/claude-query-settings-n const adapter = (settings) => `import * as DocumentText from "../../provider/DocumentText.ts";\n${settings}\n canApplyClaudeSelectionLive(existing.selection, compiledSelection) &&\n nextCondition`; const claudeSource = { [claudeFiles[0]]: adapter(settingsFixture), - [claudeFiles[1]]: ' customModelCapabilityOverrides: Schema.optionalKey(Schema.Boolean),', - [claudeFiles[2]]: ' customModelCapabilityOverrides: true,', + [claudeFiles[1]]: ' threadFind: Schema.optionalKey(Schema.Boolean),', + [claudeFiles[2]]: ' threadFind: true,', }; const helper = readFileSync(new URL('../docker/runtime/patches/gateway-context.ts', import.meta.url), 'utf8'); const apply = new Function(stripTypeScriptTypes(helper.replaceAll('export ', '')) + '\nreturn applyClaudeGatewayContext;')();