diff --git a/Dockerfile b/Dockerfile index ab79413..86102a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -360,7 +360,7 @@ FROM core AS browser # Browser automation over MCP. T3 Code's own preview tools are hosted by the # web/desktop client, so a phone-only setup has no eyes without this. -ARG CHROME_DEVTOOLS_MCP_VERSION=1.13.0 +ARG CHROME_DEVTOOLS_MCP_VERSION=1.14.0 ARG PLAYWRIGHT_MCP_VERSION=0.0.86 RUN set -eux; \ diff --git a/docker/browser-mcp/package-lock.json b/docker/browser-mcp/package-lock.json index 54275cb..3638b01 100644 --- a/docker/browser-mcp/package-lock.json +++ b/docker/browser-mcp/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "dependencies": { "@playwright/mcp": "0.0.86", - "chrome-devtools-mcp": "1.13.0" + "chrome-devtools-mcp": "1.14.0" } }, "node_modules/@playwright/mcp": { @@ -29,9 +29,9 @@ } }, "node_modules/chrome-devtools-mcp": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/chrome-devtools-mcp/-/chrome-devtools-mcp-1.13.0.tgz", - "integrity": "sha512-Yf4qhS0+2oo7c+gOySMDHQt4ZL/yKXG2Mxxzjk0gcArINtcQ3tLiQVzAW6g2nsyQzAGhkcLwWWBAtlx3Bg+Spg==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/chrome-devtools-mcp/-/chrome-devtools-mcp-1.14.0.tgz", + "integrity": "sha512-sO7GYmqnvmjQ0l9jiuvw2DyPxi3nBATFbxvNU8ArapYOUXE79z6fbigKuDbJ8/jsi/4OA3OvHlGq83mHLwemGA==", "license": "Apache-2.0", "bin": { "chrome-devtools": "out/Default/gen/src/bin/chrome-devtools.js", diff --git a/docker/browser-mcp/package.json b/docker/browser-mcp/package.json index 069ce0b..3399331 100644 --- a/docker/browser-mcp/package.json +++ b/docker/browser-mcp/package.json @@ -5,6 +5,6 @@ "description": "Pinned browser automation MCP servers for the browser image stage. Versions mirror the Dockerfile ARGs; refresh both with scripts/bump-versions.sh.", "dependencies": { "@playwright/mcp": "0.0.86", - "chrome-devtools-mcp": "1.13.0" + "chrome-devtools-mcp": "1.14.0" } } diff --git a/docker/runtime/patches/opencode-skills.mjs b/docker/runtime/patches/opencode-skills.mjs index e7a7016..a93c795 100644 --- a/docker/runtime/patches/opencode-skills.mjs +++ b/docker/runtime/patches/opencode-skills.mjs @@ -107,8 +107,43 @@ const shapes = [ client.provider.list({ location }).pipe(Effect.timeout("10 seconds"), Effect.ignore), processEnv,`, }, + // Reviewed against v0.1.12-nightly.20261124.5209 (84e4264bb347e36e97f6c3bd95d666eecfa12e07). + { + directory: "directory", + environment: true, + tracksScans: true, + comment: "/**\n * Until its scan ends a location lists only built-ins, even once the server lists it as loaded,\n * and nothing but the scan's end tells the two apart. Unless the caller saw that scan end, read to\n * boot the location, wait for its scan (`scanned` must listen before `read`), and read again.\n */\n", + loader: ` function* ( + read: Effect.Effect, + scanned: Effect.Effect, + sawScan: boolean, + environment?: NodeJS.ProcessEnv, + ) { + const first = yield* read; + if (sawScan) return first; + yield* scanned.pipe( + Effect.timeoutOption(resolveProviderProbeTimeoutMs("opencode", 10_000, environment)), + ); + return yield* read; + },`, + argument: ` Deferred.await(scanned), + // Without events no scan can be awaited, so trust the first read as before. + stream._tag === "None" || seen.has(directory), + processEnv,`, + }, ]; +const nativeReadiness = ` const scanned = client.plugin.list({ location }).pipe( + Effect.repeat({ + until: (plugins) => ["opencode.config.skill", "opencode.config.command"].every( + (id) => plugins.data.some((plugin) => plugin.id === id && plugin.state?.status === "active"), + ), + schedule: Schedule.spaced("100 millis"), + }), + Effect.asVoid, + ); +`; + function mismatch(file) { return new Error(`The opencode-skills patch no longer matches ${file}. Review the upstream source before publishing this runtime.`); } @@ -127,10 +162,54 @@ export function patchOpenCodeSkills(source) { change(files[0], normalized, normalized); } change(files[0], 'import * as Deferred from "effect/Deferred";', 'import * as Schedule from "effect/Schedule";'); - change(files[0], 'import * as Stream from "effect/Stream";\n', ""); - change(files[0], "openCode2Server.withConnection(({ client, events }) =>", "openCode2Server.withConnection(({ client }) =>"); - change(files[0], - ` const scanned = yield* Deferred.make(); + if (shape.tracksScans) { + change(files[0], " followOpenCode2Scans,\n", ""); + change(files[0], "openCode2Server.withConnection(({ client, events, url }) =>", "openCode2Server.withConnection(({ client }) =>"); + change(files[0], + ` // Locations whose scan T3 saw end on the current server; a scan is announced only once. + let scans = { url: "", scanned: new Set() }; + const followScans = (connection: OpenCode2Server.OpenCode2Connection) => + Effect.suspend(() => { + const scanned = new Set(); + scans = { url: connection.url, scanned }; + return connection.events.pipe( + Effect.flatMap((events) => + followOpenCode2Scans(events, (directory) => Effect.sync(() => scanned.add(directory))), + ), + Effect.scoped, + Effect.ignore, + Effect.forkScoped, + ); + }); + // A session or text generation can start the server too, and reads no catalog when it does. + yield* Stream.runForEach(openCode2Server.connections, (connection) => + followScans(connection).pipe(Effect.andThen(followMachineCatalog(connection))), + ).pipe(Effect.forkScoped); +`, ` // A session or text generation can start the server too, and reads no catalog when it does. + yield* Stream.runForEach(openCode2Server.connections, followMachineCatalog).pipe(Effect.forkScoped); +`); + change(files[0], + ` if (scans.url !== url) scans = { url, scanned: new Set() }; + const { scanned: seen } = scans; + const scanned = yield* Deferred.make(); + const stream = yield* events.pipe(Effect.option); + if (stream._tag === "Some") { + yield* followOpenCode2Scans(stream.value, (scannedDirectory) => + scannedDirectory === directory + ? Deferred.succeed(scanned, undefined).pipe(Effect.asVoid) + : Effect.void, + ).pipe(Effect.forkScoped); + } +`, nativeReadiness); + change(files[0], + ` // A location loaded before T3 watched never announces its scan; wait for it only once. + seen.add(directory); +`, ""); + } else { + change(files[0], 'import * as Stream from "effect/Stream";\n', ""); + change(files[0], "openCode2Server.withConnection(({ client, events }) =>", "openCode2Server.withConnection(({ client }) =>"); + change(files[0], + ` const scanned = yield* Deferred.make(); const pending = new Set(["command.updated", "skill.updated"]); const stream = yield* events.pipe(Effect.option); if (stream._tag === "Some") { @@ -148,16 +227,8 @@ export function patchOpenCodeSkills(source) { ); } `, - ` const scanned = client.plugin.list({ location }).pipe( - Effect.repeat({ - until: (plugins) => ["opencode.config.skill", "opencode.config.command"].every( - (id) => plugins.data.some((plugin) => plugin.id === id && plugin.state?.status === "active"), - ), - schedule: Schedule.spaced("100 millis"), - }), - Effect.asVoid, - ); -`); + nativeReadiness); + } const callEnd = shape.directory === "directory" ? "\n );" : ""; change(files[0], shape.argument + callEnd, " scanned," + (shape.environment ? "\n processEnv," : "") + callEnd); diff --git a/docker/setup/antigravity.mjs b/docker/setup/antigravity.mjs index 2a8cc15..bfd01d9 100644 --- a/docker/setup/antigravity.mjs +++ b/docker/setup/antigravity.mjs @@ -8,6 +8,12 @@ // short cache, so a status poll never waits on T3. export const INSTANCE = "antigravity"; +export function antigravityCodePrompt(interaction) { + if (interaction?.type !== "credentials" || !interaction.id || !Array.isArray(interaction.fields)) return null; + const field = ["code", "authorizationCode"].find((name) => interaction.fields.some((entry) => entry?.name === name)); + return field ? { id: interaction.id, field } : null; +} + // T3 names a release `agy_acp_server_1.1.1`; the page says 1.1.1. const shortVersion = (value) => (value ? String(value).replace(/^agy_acp_server_/, "") : null); const BUSY = new Set(["downloading", "extracting", "verifying"]); @@ -232,8 +238,8 @@ export function createAntigravity({ api, now = Date.now, maxAgeMs = 15_000 }) { } }; const completeSignIn = (flowId, callbackUrl) => api.call("provider.auth.complete", { instanceId: INSTANCE, flowId, callbackUrl }); - const submitSignInCode = (flowId, interactionId, code) => api.call("provider.auth.respond", { - instanceId: INSTANCE, flowId, interactionId, response: { type: "credentials", values: { authorizationCode: code } }, + const submitSignInCode = (flowId, prompt, code) => api.call("provider.auth.respond", { + instanceId: INSTANCE, flowId, interactionId: prompt.id, response: { type: "credentials", values: { [prompt.field]: code } }, }); const cancelSignIn = (flowId) => api.call("provider.auth.cancel", { instanceId: INSTANCE, flowId }); /** After a sign-in: have T3 check access again, then read it. */ diff --git a/docker/setup/server.mjs b/docker/setup/server.mjs index 3ae9a92..c4bcf67 100644 --- a/docker/setup/server.mjs +++ b/docker/setup/server.mjs @@ -30,7 +30,7 @@ import { createFilesService, FILES_ROUTES, FILES_POST_ROUTES, filesFailure } fro import { createHoldControl } from './files/hold.mjs'; import { createLatestCache } from "./latest.mjs"; import { createT3Api } from "./t3-api.mjs"; -import { createAntigravity } from "./antigravity.mjs"; +import { antigravityCodePrompt, createAntigravity } from "./antigravity.mjs"; import { createT3Sessions } from "./t3-session.mjs"; import { createDeviceLabels } from "./device-labels.mjs"; import * as Context from "./context.mjs"; @@ -1691,7 +1691,7 @@ const startAntigravitySignin = async () => { const session = { id, agentId: "antigravity", state: "starting", url: null, code: null, needsCode: true, output: "", error: null, child: null, t3: true, - flow: null, flowId: null, codeInteractionId: null, expiresAt: null, startedAt: Date.now(), + flow: null, flowId: null, codePrompt: null, expiresAt: null, startedAt: Date.now(), }; sessions.set(id, session); const end = (state, error = null) => { @@ -1699,7 +1699,7 @@ const startAntigravitySignin = async () => { session.state = state; session.error = error; session.url = null; - session.codeInteractionId = null; + session.codePrompt = null; session.flow?.close(); sessionStore.settle(session); }; @@ -1710,8 +1710,7 @@ const startAntigravitySignin = async () => { if (Number.isFinite(expires)) session.expiresAt = expires; if (state.phase === "waiting" && state.authorizationUrl) { session.url = state.authorizationUrl; - session.codeInteractionId = state.interaction?.type === "credentials" && - state.interaction.fields?.some((field) => field.name === "authorizationCode") ? state.interaction.id : null; + session.codePrompt = antigravityCodePrompt(state.interaction); if (session.state === "starting") session.state = "awaiting-code"; } else if (state.phase === "verifying") { session.state = "submitted"; @@ -1742,7 +1741,7 @@ const startAntigravitySignin = async () => { const publicSession = (s) => ({ id: s.id, agent: s.agentId, state: s.state, url: s.url, code: s.code, qr: s.qr ?? null, needsCode: s.needsCode, error: s.error, identity: s.identity ?? null, warning: s.warning ?? null, - googleAuthorizationCode: Boolean(s.codeInteractionId), + googleAuthorizationCode: Boolean(s.codePrompt), // When the wait for the browser step gives up, for the device code's countdown. startedAt: s.startedAt, expiresAt: s.expiresAt ?? s.startedAt + SESSION_TTL_MS, tail: s.output.trim().split("\n").slice(-4).join("\n"), @@ -3283,15 +3282,15 @@ const server = createServer(async (req, res) => { if (session.t3) { if (session.state !== "awaiting-code") return sendJson(res, 409, { error: "This sign-in is no longer waiting for a response." }); const code = String(input.code ?? "").trim(); - const expectsCode = Boolean(session.codeInteractionId); - if (expectsCode && (!/^[!-~]{1,4096}$/u.test(code) || /^https?:\/\//i.test(code))) { + const prompt = session.codePrompt; + if (prompt && (!/^[!-~]{1,4096}$/u.test(code) || /^https?:\/\//i.test(code))) { return sendJson(res, 400, { error: "Paste the authorization code shown by Google." }); } - if (!expectsCode && (!/^https?:\/\//i.test(code) || code.length > 16384)) { + if (!prompt && (!/^https?:\/\//i.test(code) || code.length > 16384)) { return sendJson(res, 400, { error: "Paste the whole address from the browser's address bar, starting with http://127.0.0.1." }); } try { - if (session.codeInteractionId) await antigravity.submitSignInCode(session.flowId, session.codeInteractionId, code); + if (prompt) await antigravity.submitSignInCode(session.flowId, prompt, code); else await antigravity.completeSignIn(session.flowId, code); if (!TERMINAL_STATES.has(session.state)) session.state = "submitted"; session.submittedAt = Date.now(); @@ -3332,7 +3331,7 @@ const server = createServer(async (req, res) => { if (session.flowId && !TERMINAL_STATES.has(session.state)) void antigravity.cancelSignIn(session.flowId).catch(() => {}); session.state = "cancelled"; session.url = null; - session.codeInteractionId = null; + session.codePrompt = null; session.flow?.close(); } else if (session) { session.state = "cancelled"; diff --git a/tests/fixtures/opencode-workspace-scans-source.mjs b/tests/fixtures/opencode-workspace-scans-source.mjs new file mode 100644 index 0000000..0212ff3 --- /dev/null +++ b/tests/fixtures/opencode-workspace-scans-source.mjs @@ -0,0 +1,101 @@ +// Excerpts from upstream Nightly 5209 at 84e4264bb347e36e97f6c3bd95d666eecfa12e07. +export const scansSource = { + "packages/provider-opencode/src/server/driver.ts": `import * as Deferred from "effect/Deferred"; +import * as Stream from "effect/Stream"; + followOpenCode2Scans, + const catalogWatch = yield* makeOpenCode2CatalogWatch(processEnv); + // An external server may not have the host's cwd; without a location it uses its own default. + const machineDirectory = (connection: OpenCode2Server.OpenCode2Connection) => + connection.external ? undefined : host.paths.cwd; + const followMachineCatalog = (connection: OpenCode2Server.OpenCode2Connection) => + catalogWatch.follow( + connection.url, + connection.events, + loadOpenCode2DirectoryCatalog(connection.client, machineDirectory(connection)), + ); + // Locations whose scan T3 saw end on the current server; a scan is announced only once. + let scans = { url: "", scanned: new Set() }; + const followScans = (connection: OpenCode2Server.OpenCode2Connection) => + Effect.suspend(() => { + const scanned = new Set(); + scans = { url: connection.url, scanned }; + return connection.events.pipe( + Effect.flatMap((events) => + followOpenCode2Scans(events, (directory) => Effect.sync(() => scanned.add(directory))), + ), + Effect.scoped, + Effect.ignore, + Effect.forkScoped, + ); + }); + // A session or text generation can start the server too, and reads no catalog when it does. + yield* Stream.runForEach(openCode2Server.connections, (connection) => + followScans(connection).pipe(Effect.andThen(followMachineCatalog(connection))), + ).pipe(Effect.forkScoped); + const loadOpenCode2Models = yield* makeOpenCode2ModelLoader( + openCode2Server.withConnection((connection) => + followMachineCatalog(connection).pipe( + Effect.andThen(loadOpenCode2Catalog(connection.client, machineDirectory(connection))), + ), + ), + processEnv, + ); + const listOpenCode2Workspace = (cwd: string) => + openCode2Server.withConnection(({ client, events, url }) => + Effect.gen(function* () { + // OpenCode names a location by its resolved path (no trailing slash or \`..\`). + const directory = pathService.resolve(cwd); + const location = { directory }; + if (scans.url !== url) scans = { url, scanned: new Set() }; + const { scanned: seen } = scans; + const scanned = yield* Deferred.make(); + const stream = yield* events.pipe(Effect.option); + if (stream._tag === "Some") { + yield* followOpenCode2Scans(stream.value, (scannedDirectory) => + scannedDirectory === directory + ? Deferred.succeed(scanned, undefined).pipe(Effect.asVoid) + : Effect.void, + ).pipe(Effect.forkScoped); + } + const workspace = yield* loadOpenCode2Workspace( + Effect.all( + { + skills: client.skill.list({ location }).pipe(Effect.map((list) => list.data)), + commands: client.command.list({ location }).pipe(Effect.map((list) => list.data)), + }, + { concurrency: "unbounded" }, + ), + Deferred.await(scanned), + // Without events no scan can be awaited, so trust the first read as before. + stream._tag === "None" || seen.has(directory), + processEnv, + ); + // A location loaded before T3 watched never announces its scan; wait for it only once. + seen.add(directory); + return workspace; + }).pipe(Effect.scoped), + ); +`, + "packages/provider-opencode/src/server/status.ts": `/** + * Until its scan ends a location lists only built-ins, even once the server lists it as loaded, + * and nothing but the scan's end tells the two apart. Unless the caller saw that scan end, read to + * boot the location, wait for its scan (\`scanned\` must listen before \`read\`), and read again. + */ +export const loadOpenCode2Workspace = Effect.fn("OpencodeProviderStatus.loadOpenCode2Workspace")( + function* ( + read: Effect.Effect, + scanned: Effect.Effect, + sawScan: boolean, + environment?: NodeJS.ProcessEnv, + ) { + const first = yield* read; + if (sawScan) return first; + yield* scanned.pipe( + Effect.timeoutOption(resolveProviderProbeTimeoutMs("opencode", 10_000, environment)), + ); + return yield* read; + }, +); + +`, +}; diff --git a/tests/opencode-workspace-patch.test.mjs b/tests/opencode-workspace-patch.test.mjs index a60a885..ff6d81e 100644 --- a/tests/opencode-workspace-patch.test.mjs +++ b/tests/opencode-workspace-patch.test.mjs @@ -3,6 +3,7 @@ import test from "node:test"; import { source } from "./fixtures/opencode-workspace-source.mjs"; import { normalizedSource } from "./fixtures/opencode-workspace-normalized-source.mjs"; import { settledSource } from "./fixtures/opencode-workspace-settled-source.mjs"; +import { scansSource } from "./fixtures/opencode-workspace-scans-source.mjs"; import { files, patchOpenCodeSkills } from "../docker/runtime/patches/opencode-skills.mjs"; import { patches } from "../docker/runtime/patches/index.mjs"; @@ -75,3 +76,23 @@ test("settled Nightly replaces the upstream catalog barrier with native plugin r assert.throws(() => patchOpenCodeSkills(changed), /no longer matches/, "unreviewed settlement changes fail closed"); } }); + +test("Nightly 5209 waits for config plugins and keeps watching the model catalog", () => { + const before = structuredClone(scansSource); + const [driver, status] = files; + const result = patchOpenCodeSkills(scansSource); + assert.deepEqual(scansSource, before); + assert.match(result[driver], /Stream\.runForEach\(openCode2Server\.connections, followMachineCatalog\)/); + assert.match(result[driver], /const directory = pathService\.resolve\(cwd\);/); + assert.match(result[driver], /client\.plugin\.list\(\{ location \}\)/); + assert.match(result[driver], /opencode\.config\.skill/); + assert.match(result[driver], /opencode\.config\.command/); + assert.match(result[driver], /scanned,\s+processEnv,/); + assert.doesNotMatch(result[driver], /followScans|followOpenCode2Scans|seen\.|Deferred/); + assert.match(result[status], /yield\* read;\s+yield\* scanned\.pipe\(Effect\.timeout\(resolveProviderProbeTimeoutMs\("opencode", 10_000, environment\)\)\);\s+return yield\* read;/); + assert.doesNotMatch(result[status], /sawScan|timeoutOption/); + for (const [file, anchor] of [[driver, 'seen.has(directory)'], [status, 'if (sawScan) return first;']]) { + const changed = { ...scansSource, [file]: scansSource[file].replace(anchor, '') }; + assert.throws(() => patchOpenCodeSkills(changed), /no longer matches/); + } +}); diff --git a/tests/t3-api.test.mjs b/tests/t3-api.test.mjs index 5ca2890..b38a579 100644 --- a/tests/t3-api.test.mjs +++ b/tests/t3-api.test.mjs @@ -9,7 +9,7 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { antigravityFacts, createAntigravity } from "../docker/setup/antigravity.mjs"; +import { antigravityCodePrompt, antigravityFacts, createAntigravity } from "../docker/setup/antigravity.mjs"; import { createT3Api, failureOf, T3ApiError } from "../docker/setup/t3-api.mjs"; const tick = () => new Promise((resolve) => setImmediate(resolve)); @@ -235,6 +235,9 @@ function fakeT3({ tokens = new Set(["good"]), protocolVersion = 1, settingsForma if (message.payload.flowId !== t3.auth.flowId || message.payload.interactionId !== t3.auth.interaction?.id) { return answer(fail("This sign-in is no longer active in this client.", "respond")); } + if (!message.payload.response.values?.[t3.auth.interaction.fields[0].name]) { + return answer(fail("Paste the code using the field named by the sign-in prompt.", "respond")); + } t3.authResponse = message.payload.response; t3.setAuth({ phase: "verifying", interaction: null, authorizationUrl: null }); return ok(t3.auth); @@ -490,30 +493,40 @@ test("sign-in follows T3's flow: a Google link, the pasted address, T3's verdict const { api } = apiFor(t3); const ag = createAntigravity({ api }); const states = []; - const flow = await ag.signIn((state) => states.push(state.phase)); + const flow = await ag.signIn((state) => states.push(state)); assert.equal(flow.flowId, "flow-1"); t3.setAuth({ phase: "waiting", authorizationUrl: "https://accounts.google.com/o/oauth2/auth?x=1" }); await settle(); + assert.equal(antigravityCodePrompt(states.find((state) => state.phase === "waiting")?.interaction), null); await ag.completeSignIn("flow-1", "http://127.0.0.1:52219/?code=abc&state=def"); t3.setAuth({ phase: "succeeded" }); await settle(); - assert.deepEqual(states.filter((p, i) => states.indexOf(p) === i), ["starting", "waiting", "verifying", "succeeded"], "never the state an earlier flow left"); + assert.deepEqual([...new Set(states.map((state) => state.phase))], ["starting", "waiting", "verifying", "succeeded"], "never the state an earlier flow left"); await assert.rejects(ag.completeSignIn("other", "http://127.0.0.1:1/"), /no longer active/); flow.close(); api.close(); }); -test("headless Antigravity sign-in sends the code to the current native credential prompt", async (t) => { - const t3 = fakeT3(); - const { api } = apiFor(t3); - t.after(() => api.close()); - const ag = createAntigravity({ api }); - const flow = await ag.signIn(() => {}); - t.after(() => flow.close()); - t3.setAuth({ phase: "waiting", interaction: { type: "credentials", id: "code-prompt" } }); - await assert.rejects(ag.submitSignInCode(flow.flowId, "old-prompt", "fixture-code"), /no longer active/); - const sent = await ag.submitSignInCode(flow.flowId, "code-prompt", "fixture-code"); - assert.equal(sent.phase, "verifying"); - assert.deepEqual(t3.authResponse, { type: "credentials", values: { authorizationCode: "fixture-code" } }); - assert.equal(t3.requests.includes("provider.auth.complete"), false); -}); +for (const field of ["code", "authorizationCode"]) { + test(`headless Antigravity sign-in uses the advertised ${field} field`, async (t) => { + const t3 = fakeT3(); + const { api } = apiFor(t3); + t.after(() => api.close()); + const ag = createAntigravity({ api }); + let prompt = null; + const flow = await ag.signIn((state) => { prompt = antigravityCodePrompt(state.interaction); }); + t.after(() => flow.close()); + t3.setAuth({ + phase: "waiting", + authorizationUrl: "https://accounts.google.com/o/oauth2/auth?x=1", + interaction: { type: "credentials", id: "code-prompt", fields: [{ name: field }] }, + }); + await settle(); + assert.deepEqual(prompt, { id: "code-prompt", field }); + await assert.rejects(ag.submitSignInCode(flow.flowId, { ...prompt, id: "old-prompt" }, "fixture-code"), /no longer active/); + const sent = await ag.submitSignInCode(flow.flowId, prompt, "fixture-code"); + assert.equal(sent.phase, "verifying"); + assert.deepEqual(t3.authResponse, { type: "credentials", values: { [field]: "fixture-code" } }); + assert.equal(t3.requests.includes("provider.auth.complete"), false); + }); +}