diff --git a/bun.lock b/bun.lock
index d8609b31e03c..41721bfa9b1b 100644
--- a/bun.lock
+++ b/bun.lock
@@ -1027,7 +1027,7 @@
"@effect/platform-node-shared": "4.1.0",
"@effect/sql-sqlite-bun": "4.1.0",
"@effect/sql-sqlite-node": "4.1.0",
- "@hona/strobe": "0.36.0",
+ "@hona/strobe": "0.37.0",
"@kobalte/core": "0.13.13",
"@lydell/node-pty": "1.2.0-beta.12",
"@npmcli/arborist": "9.4.0",
@@ -1569,19 +1569,19 @@
"@happy-dom/global-registrator": ["@happy-dom/global-registrator@20.0.11", "", { "dependencies": { "@types/node": "^20.0.0", "happy-dom": "^20.0.11" } }, "sha512-GqNqiShBT/lzkHTMC/slKBrvN0DsD4Di8ssBk4aDaVgEn+2WMzE6DXxq701ndSXj7/0cJ8mNT71pM7Bnrr6JRw=="],
- "@hona/strobe": ["@hona/strobe@0.36.0", "", { "optionalDependencies": { "@hona/strobe-darwin-arm64": "0.36.0", "@hona/strobe-darwin-x64": "0.36.0", "@hona/strobe-linux-arm64": "0.36.0", "@hona/strobe-linux-x64": "0.36.0", "@hona/strobe-win32-arm64": "0.36.0", "@hona/strobe-win32-x64": "0.36.0" }, "bin": { "strobe": "bin/strobe.js" } }, "sha512-TcisD2luf5y6R6RQuzTtL1NanqUzqYV2IV8IFr7Q1SIEtgGb4ueeMWPyvNfS9aQ8FSy6u9YpAZiWDoIUA6PrhQ=="],
+ "@hona/strobe": ["@hona/strobe@0.37.0", "", { "optionalDependencies": { "@hona/strobe-darwin-arm64": "0.37.0", "@hona/strobe-darwin-x64": "0.37.0", "@hona/strobe-linux-arm64": "0.37.0", "@hona/strobe-linux-x64": "0.37.0", "@hona/strobe-win32-arm64": "0.37.0", "@hona/strobe-win32-x64": "0.37.0" }, "bin": { "strobe": "bin/strobe.js" } }, "sha512-6M7W4YxcnioURhVJQtcdIEoFFO4L+Bkcbln1iEMI0MhVJbWELYJgHFWsbAAWw/nXAF6pN5b/AJ/N/fY35WkOCQ=="],
- "@hona/strobe-darwin-arm64": ["@hona/strobe-darwin-arm64@0.36.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-2fglraB9DfmrF0x92IEsv/0u6zgZ0oPmLmkmh6deGWKa+B5BD+m2BsCYaCxUrHrmHwrkA8OWG1UfS3Y0fi/HEQ=="],
+ "@hona/strobe-darwin-arm64": ["@hona/strobe-darwin-arm64@0.37.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-800o9jgsoIBvu/uYyr3qPV8BdtNAr2bQUb8StFSrcwA/h/B+dtLdOubWmwSaL18YoFd3dAwUlWqmxeipAlWH3w=="],
- "@hona/strobe-darwin-x64": ["@hona/strobe-darwin-x64@0.36.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-QBD1ejheS/cgy8kFuE9osdCpcOSUxEYh7dTeixDulvzmX+2qCua2AwajFPBS668I1PCbsbwYpUnqpcp9SC5sNg=="],
+ "@hona/strobe-darwin-x64": ["@hona/strobe-darwin-x64@0.37.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-zZiUoM290+vo+ePcZUsO0nx8F3OSrbAzFX1xhu3OiX+HT5AWagRfIR6/HyFd+k10zDS0rXlYxeudNOMqiM0xbA=="],
- "@hona/strobe-linux-arm64": ["@hona/strobe-linux-arm64@0.36.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-SJxTyskt5iCfklNVbRnCxL5jyjtspiV54T8eI+B6Y+qJJ9dk2FGlP/y/YfSkZF1w1N+v1rdKComfZatO5nkpSw=="],
+ "@hona/strobe-linux-arm64": ["@hona/strobe-linux-arm64@0.37.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-NA5K+7y4qha3PbjdLoIIzB4wz139gFi4X4g8iTS+vWGIaAob0d+6XygU5TndPyMLAZrSDfvgWqcqCQhsVwxPWg=="],
- "@hona/strobe-linux-x64": ["@hona/strobe-linux-x64@0.36.0", "", { "os": "linux", "cpu": "x64" }, "sha512-q/brYo1wrqij/rtCMKjK3gVpknncCsulZ+DjrFdW+5dh/cBbWRnuJKV1c3BEYQmXI+/puesqTktV5d3xGlXTpg=="],
+ "@hona/strobe-linux-x64": ["@hona/strobe-linux-x64@0.37.0", "", { "os": "linux", "cpu": "x64" }, "sha512-jRluj2WV+nkmO9fDpQ4Iw53NkczBsAB9aDWimBkWVLz5BW7RjZSuDT613iMDLXAAiWQJAYE6pZfMjfQnWz5HlQ=="],
- "@hona/strobe-win32-arm64": ["@hona/strobe-win32-arm64@0.36.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-10FFkPuZZg9mg4cEY13SSMeliQuJBTVsAaQrv9jYOgmaw0JBYwKo9J/g7iZ81ohLBcNf9tYEeFVPZpgWWbCMYQ=="],
+ "@hona/strobe-win32-arm64": ["@hona/strobe-win32-arm64@0.37.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-RdFuMZUT38P954klZVNludyDnGNpK+bfbmDkEFKvTmNlFuqvaZ4ARDV2gTmNjlOBAW+xurXAr/16GhTgtXG93Q=="],
- "@hona/strobe-win32-x64": ["@hona/strobe-win32-x64@0.36.0", "", { "os": "win32", "cpu": "x64" }, "sha512-fRaQX2P0xL+DKj6pzDwJj7StZgUMgRWl2x0mvC13+5uF3yuPbse/3+eF0I/spBNg/q+PuMVrotlXsHO0eFPD6g=="],
+ "@hona/strobe-win32-x64": ["@hona/strobe-win32-x64@0.37.0", "", { "os": "win32", "cpu": "x64" }, "sha512-BGKwdbo9/bexolOksstSMqc0GtR0hv6fTfCVl0qf+wg5iS90+1QIYOS4gGtKTyDE4bfy66BKgJJoM5rYQmGcJw=="],
"@hono/node-server": ["@hono/node-server@2.1.5", "", { "peerDependencies": { "hono": "^4 || ^5.0.0-0" } }, "sha512-MgP/I06GdvsilDspMk/qmRzpk8LOUStP6jFAbSRi40W09DhoyUn+Mj7eyKICPqeYKybOjVFLVIAQzvu1bfIa7Q=="],
diff --git a/package.json b/package.json
index 11cd352bd8d7..d5bf56656232 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
"@effect/sql-sqlite-node": "4.1.0",
"@npmcli/arborist": "9.4.0",
"@types/bun": "1.4.3",
- "@hona/strobe": "0.36.0",
+ "@hona/strobe": "0.37.0",
"@types/cross-spawn": "6.0.6",
"@octokit/rest": "22.0.0",
"@opentui/core": "0.8.4",
diff --git a/packages/ai/README.md b/packages/ai/README.md
index db73e71af7c0..8231abb1a633 100644
--- a/packages/ai/README.md
+++ b/packages/ai/README.md
@@ -1087,7 +1087,9 @@ const program = Effect.gen(function* () {
The shared fields are `prompt`, `start`, `end`, `references`, `duration`, `aspect`, `resolution` and `sound`;
everything else is provider-specific and goes under `providerOptions`, typed from the selected model. A request only
-fails before sending when its protocol has no way to express it, such as a reference video on xAI. Values the provider
+fails before sending when its protocol has no way to express it, such as a reference video on xAI. `sound` is the
+exception: on models whose sound can't be switched (MiniMax H3 and Gemini Omni always have it, Hailuo never does) it
+isn't sent, and the model's own behavior applies. Values the provider
may reject, like an unsupported duration or too many references, go to the provider, and its error comes back typed.
`start` and `end` are images. They take a URL, data URL, base64 string or bytes, or an asset built with
@@ -1131,11 +1133,11 @@ Provider notes:
`/v1`, and a bare host (`https://api.minimax.io`) works as is. On H3, `start`, `end` and `references` become `content[]` items with `first_frame`, `last_frame` and `reference_image` /
`reference_video` / `reference_audio` roles, MiniMax file refs become `mm_file://` URLs, `aspect: "auto"` becomes
`ratio: "adaptive"`, and `resolution` is uppercased (`480P`, `2K`). H3 requires `resolution` and `duration`, plus a
- `ratio` for text-only prompts; nothing is filled in, so MiniMax rejects a request without them. H3 always has sound,
- so `sound: false` fails before sending. On Hailuo, `start` and `end` map to `first_frame_image` and
+ `ratio` for text-only prompts; nothing is filled in, so MiniMax rejects a request without them. H3 always has sound
+ and has no field for it, so `sound` isn't sent. On Hailuo, `start` and `end` map to `first_frame_image` and
`last_frame_image`, image references to `subject_reference`, and the result looks up the file's download URL, which
- expires after one hour. Hailuo is silent and has no aspect field, so `sound: true`, an explicit `aspect`, and video
- or audio references fail before sending. Cancel works on H3 (only while queued); Hailuo has no cancel. Native fields
+ expires after one hour. Hailuo is always silent, so `sound` isn't sent; it has no aspect field, so an explicit
+ `aspect` and video or audio references fail before sending. Cancel works on H3 (only while queued); Hailuo has no cancel. Native fields
such as `extra.prompt_expansion_mode` (H3), `prompt_optimizer` (Hailuo) and `callback_url` go under `providerOptions`.
- **Google** (`Google.video("gemini-omni-1.2-flash")`) starts a background Gemini Omni interaction. Omni has no
role field for media, so `start`, `end` and `references` go into `input` in that order (images, plus video
@@ -1143,7 +1145,7 @@ Provider notes:
`reference_to_video` for references only; with both, the prompt decides. `duration` becomes
`response_format.duration` (`"3s"`), and `aspect` and `resolution` go to `response_format` as is (resolution
lowercased); `aspect: "auto"` leaves the ratio out. It rejects `end` without `start` (a lone image reads as the
- first frame) and `sound: false` (Omni always generates audio). Videos come back as inline bytes. `cancel` posts to
+ first frame). Omni always generates audio and has no field for it, so `sound` isn't sent. Videos come back as inline bytes. `cancel` posts to
`/interactions/{id}/cancel`. `providerOptions` takes native Interactions fields, such as `previous_interaction_id`
to edit or extend a generated video, `generation_config.video_config.task`, `service_tier` and `webhook_config`.
diff --git a/packages/ai/src/protocols/google-interactions-video.ts b/packages/ai/src/protocols/google-interactions-video.ts
index 79c81433c5e2..0f61c6a597c5 100644
--- a/packages/ai/src/protocols/google-interactions-video.ts
+++ b/packages/ai/src/protocols/google-interactions-video.ts
@@ -129,11 +129,6 @@ const task = (request: Request) => {
const fromRequest = Effect.fn("GoogleInteractionsVideo.fromRequest")(function* (request: Request) {
if (request.end !== undefined && request.start === undefined)
return yield* route.unsupported("video.end", `${route.name} reads a lone image as the start frame; send start too`)
- if (request.sound === false)
- return yield* route.unsupported(
- "video.sound",
- `${route.name} always generates audio and has no option to turn it off`,
- )
const media = yield* Effect.forEach(
[request.start, request.end, ...(request.references ?? [])].filter(
(asset): asset is Media.Asset => asset !== undefined,
diff --git a/packages/ai/src/protocols/minimax-video.ts b/packages/ai/src/protocols/minimax-video.ts
index fe45f999608d..aab982336fec 100644
--- a/packages/ai/src/protocols/minimax-video.ts
+++ b/packages/ai/src/protocols/minimax-video.ts
@@ -177,9 +177,7 @@ const reference = (asset: Media.Asset) =>
const resolution = (request: Request) => request.resolution?.toUpperCase()
const fromRequest = Effect.fn("MiniMaxVideo.fromRequest")(function* (request: Request) {
- // H3 always generates a soundtrack and has no field to turn it off.
- if (request.sound === false)
- return yield* route.unsupported("video.sound", `${route.name} always generates sound and can't be silenced`)
+ // H3 always generates a soundtrack and has no field for `sound`, so it isn't sent.
const content = [
{ type: "text", text: request.prompt },
...(request.start === undefined ? [] : [yield* item(request.start, "first_frame")]),
@@ -213,8 +211,7 @@ const hailuoFromRequest = Effect.fn("MiniMaxHailuoVideo.fromRequest")(function*
`${hailuoRoute.name} takes only image (subject) references`,
)
// Hailuo output is always silent and its shape follows the model or the first frame, with no field for either.
- if (request.sound === true)
- return yield* hailuoRoute.unsupported("video.sound", `${hailuoRoute.name} generates silent video only`)
+ // `sound` has nothing to send, so it isn't; an aspect ratio would change the shape the caller asked for.
if (request.aspect !== undefined && request.aspect !== "auto")
return yield* hailuoRoute.unsupported("video.aspect", `${hailuoRoute.name} has no aspect ratio input`)
const subjects = yield* Effect.forEach(references, (asset) =>
diff --git a/packages/ai/test/generation.test.ts b/packages/ai/test/generation.test.ts
index 90eda9f3a632..e89222573b38 100644
--- a/packages/ai/test/generation.test.ts
+++ b/packages/ai/test/generation.test.ts
@@ -97,7 +97,9 @@ describe("Generation", () => {
const generation = new Generation(route, "t", { id: "gen_1", status: "queued" })
const fiber = yield* Effect.forkChild(
- generation.events({ poll: { interval: "1 second", timeout: "5 seconds" } }).pipe(Stream.runCollect, Effect.flip),
+ generation
+ .events({ poll: { interval: "1 second", timeout: "5 seconds" } })
+ .pipe(Stream.runCollect, Effect.flip),
)
yield* TestClock.adjust("6 seconds")
const error = yield* Fiber.join(fiber)
diff --git a/packages/ai/test/google-interactions-video.test.ts b/packages/ai/test/google-interactions-video.test.ts
index 4aabcbaf4f0a..a57253f7f7f9 100644
--- a/packages/ai/test/google-interactions-video.test.ts
+++ b/packages/ai/test/google-interactions-video.test.ts
@@ -101,7 +101,9 @@ describe("ai.video.start / Google Interactions", () => {
model,
prompt: "Morph",
start: Media.image(Media.fromDataUrl("data:image/png;base64,AQID")),
- end: Media.image(Media.ref("google", "https://generativelanguage.googleapis.com/v1beta/files/last", "image/jpeg")),
+ end: Media.image(
+ Media.ref("google", "https://generativelanguage.googleapis.com/v1beta/files/last", "image/jpeg"),
+ ),
})
expect(body.input).toEqual([
{ type: "image", data: "AQID", mime_type: "image/png" },
@@ -147,9 +149,15 @@ describe("ai.video.start / Google Interactions", () => {
}),
)
+ it.effect("sends nothing for sound, since Omni always generates audio and has no field for it", () =>
+ Effect.gen(function* () {
+ const silent = yield* sent({ model, prompt: "x", sound: false })
+ expect(JSON.stringify(silent.body)).not.toContain("audio")
+ }),
+ )
+
for (const rejected of [
{ name: "an end frame without a start frame", input: { end: "data:image/png;base64,AQID" }, operation: "end" },
- { name: "silent video", input: { sound: false }, operation: "sound" },
])
it.effect(`rejects ${rejected.name}, which Omni has no way to send, before sending`, () =>
Effect.gen(function* () {
diff --git a/packages/ai/test/minimax-video.test.ts b/packages/ai/test/minimax-video.test.ts
index 7434dcd76481..514458e913c7 100644
--- a/packages/ai/test/minimax-video.test.ts
+++ b/packages/ai/test/minimax-video.test.ts
@@ -136,12 +136,19 @@ describe("MiniMax Video / H3 start", () => {
}),
)
- it.effect("rejects silent output, which H3 can't produce, before sending", () =>
+ it.effect("sends nothing for sound, which neither API has a field for", () =>
Effect.gen(function* () {
- const error = yield* ai.video.start({ model: h3, prompt: "x", sound: false }).pipe(Effect.flip)
- expect(error.reason._tag).toBe("UnsupportedOperation")
- expect(error.message).toContain("always generates sound")
- }).pipe(Effect.provide(layer(() => Effect.die("an unsupported request reached the network")))),
+ const requests = yield* sent([
+ { model: h3, sound: false },
+ { model: h3, sound: true },
+ { model: hailuo, sound: true },
+ ])
+ expect(requests.map((request) => "generate_audio" in request.body || "sound" in request.body)).toEqual([
+ false,
+ false,
+ false,
+ ])
+ }),
)
it.effect("returns MiniMax's HTTP errors typed", () =>
@@ -242,7 +249,6 @@ describe("MiniMax Video / Hailuo start", () => {
request: { references: [Media.url("https://example.test/v.mp3", { mediaType: "audio/mpeg" })] },
tag: "UnsupportedOperation",
},
- { name: "sound", request: { sound: true }, tag: "UnsupportedOperation" },
{ name: "an aspect ratio", request: { aspect: "16:9" as const }, tag: "UnsupportedOperation" },
{ name: "a MiniMax file reference", request: { start: Media.ref("minimax", "file_1") }, tag: "InvalidRequest" },
]) {
diff --git a/packages/app/component-tests/tooltip.spec.ts b/packages/app/component-tests/tooltip.spec.ts
index b55839f0feaf..049460740765 100644
--- a/packages/app/component-tests/tooltip.spec.ts
+++ b/packages/app/component-tests/tooltip.spec.ts
@@ -1,49 +1,169 @@
import { expect, story } from "../../stories/playwright/story"
-story("opens a neighbouring tooltip without the open delay", async ({ mount, page }) => {
+story.beforeEach(async ({ page }) => {
+ await page.clock.install({ time: new Date("2026-01-01T00:00:00Z") })
+ await page.clock.pauseAt(new Date("2026-01-01T00:00:01Z"))
+})
+
+story("cancels a pending hover on click and opens again on re-entry", async ({ mount, page }) => {
+ const root = await mount("ui-tooltip--with-button")
+
+ const trigger = root.getByRole("button", { name: "Add" })
+
+ const tooltip = page.getByRole("tooltip", { name: "Add one to the count" })
+
+ await trigger.hover()
+ await page.clock.runFor(300)
+ await trigger.click()
+ await expect(root.getByRole("status")).toHaveText("Count: 1")
+ await expect(tooltip).toBeHidden()
+ await page.clock.runFor(600)
+ await expect(tooltip).toBeHidden()
+
+ await page.mouse.move(0, 0)
+ await trigger.hover()
+ await page.clock.runFor(600)
+ await expect(tooltip).toBeVisible()
+})
+
+story("dismisses an open tooltip on pointerdown before the button activates", async ({ mount, page }) => {
+ const root = await mount("ui-tooltip--with-button")
+
+ const tooltip = page.getByRole("tooltip", { name: "Add one to the count" })
+
+ await root.getByRole("button", { name: "Add" }).hover()
+ await page.clock.runFor(600)
+ await expect(tooltip).toBeVisible()
+ await page.mouse.down()
+ await expect(tooltip).toBeHidden()
+ await expect(root.getByRole("status")).toHaveText("Count: 0")
+ await page.mouse.up()
+ await expect(root.getByRole("status")).toHaveText("Count: 1")
+ await page.clock.runFor(600)
+ await expect(tooltip).toBeHidden()
+})
+
+story("shows the wrapped button's tooltip on Tab and Shift+Tab, even after a click", async ({ mount, page }) => {
+ const root = await mount("ui-tooltip--with-button")
+
+ const trigger = root.getByRole("button", { name: "Add" })
+
+ const tooltip = page.getByRole("tooltip", { name: "Add one to the count" })
+
+ await page.keyboard.press("Tab")
+ await expect(trigger).toBeFocused()
+ await expect(tooltip).toBeVisible()
+
+ await trigger.click()
+ await expect(tooltip).toBeHidden()
+ await page.keyboard.press("Tab")
+ await expect(root.getByRole("button", { name: "Reset" })).toBeFocused()
+ await page.keyboard.press("Shift+Tab")
+ await expect(trigger).toBeFocused()
+ await expect(tooltip).toBeVisible()
+ await page.keyboard.press("Escape")
+ await expect(tooltip).toBeHidden()
+ await expect(trigger).toBeFocused()
+})
+
+story("restored focus does not open a tooltip after Tab leaves the window", async ({ mount, page }) => {
+ const root = await mount("ui-tooltip--with-button")
+
+ await page.keyboard.down("Tab")
+ await expect(root.getByRole("button", { name: "Add" })).toBeFocused()
+ // The page loses focus before receiving Tab's keyup.
+ await page.evaluate(() => window.dispatchEvent(new FocusEvent("blur")))
+ await root.getByRole("button", { name: "Reset" }).focus()
+ await expect(page.getByRole("tooltip", { name: "Reset the count" })).toBeHidden()
+ await page.keyboard.up("Tab")
+})
+
+story.describe("touch", () => {
+ story.use({ hasTouch: true, isMobile: true, viewport: { width: 390, height: 844 } })
+
+ story("tapping the button preserves the tooltip's hover state", async ({ mount, page }) => {
+ const root = await mount("ui-tooltip--with-button")
+
+ const trigger = root.getByRole("button", { name: "Add" })
+
+ const tooltip = page.getByRole("tooltip", { name: "Add one to the count" })
+
+ expect(await page.evaluate(() => matchMedia("(hover: none)").matches)).toBe(true)
+ await trigger.tap()
+ await expect(root.getByRole("status")).toHaveText("Count: 1")
+ await expect(tooltip).toBeHidden()
+ await page.clock.runFor(600)
+ await expect(tooltip).toBeHidden()
+
+ await trigger.hover()
+ await page.clock.runFor(600)
+ await expect(tooltip).toBeVisible()
+ await trigger.tap()
+ await expect(root.getByRole("status")).toHaveText("Count: 2")
+ await expect(tooltip).toBeVisible()
+ })
+})
+
+story("waits 600 ms on first hover and opens a neighbouring tooltip immediately", async ({ mount, page }) => {
const root = await mount("ui-tooltip--appearances")
+
+ const tooltip = page.getByRole("tooltip", { name: "Standard tooltip" })
+
await root.getByText("Standard", { exact: true }).hover()
- await expect(page.getByRole("tooltip", { name: "Standard tooltip" })).toBeVisible()
+ await page.clock.runFor(599)
+ await expect(tooltip).toBeHidden()
+ await page.clock.runFor(1)
+ await expect(tooltip).toBeVisible()
// With timers frozen, the next tooltip can only open through the skip-delay window that closing this one starts.
- await page.clock.install({ time: new Date("2026-01-01T00:00:00Z") })
- await page.clock.pauseAt(new Date("2026-01-01T00:00:01Z"))
await root.getByText("Compact", { exact: true }).hover()
await expect(page.getByRole("tooltip", { name: "Compact tooltip" })).toBeVisible()
})
story("keeps a menu trigger's tooltip hidden when the menu closes under a still pointer", async ({ mount, page }) => {
const root = await mount("ui-tooltip--with-menu")
- await page.clock.install()
+
const trigger = root.getByRole("button", { name: "Actions" })
+
const tooltip = page.getByRole("tooltip", { name: "More actions" })
+
await trigger.hover()
+ await page.clock.runFor(600)
await expect(tooltip).toBeVisible()
await trigger.click()
await expect(page.getByRole("menu")).toBeVisible()
await expect(tooltip).toBeHidden()
await page.keyboard.press("Escape")
await expect(page.getByRole("menu")).toBeHidden()
+ // The menu restores focus in a zero-delay task after unmounting.
+ await page.clock.runFor(0)
await expect(trigger).toBeFocused()
- // The menu's closing layer hands the still pointer a fresh pointerenter, which would open the tooltip 400 ms later.
- await page.clock.runFor(1000)
+ // The menu's closing layer can hand the still pointer a fresh pointerenter.
+ await page.clock.runFor(600)
await expect(tooltip).toBeHidden()
await page.mouse.move(0, 0)
await trigger.hover()
+ await page.clock.runFor(600)
await expect(tooltip).toBeVisible()
})
story("opens a menu trigger's tooltip on the next hover after the menu closes", async ({ mount, page }) => {
const root = await mount("ui-tooltip--with-menu")
+
const trigger = root.getByRole("button", { name: "Actions" })
+
const tooltip = page.getByRole("tooltip", { name: "More actions" })
+
await trigger.hover()
+ await page.clock.runFor(600)
await expect(tooltip).toBeVisible()
await trigger.click()
await expect(page.getByRole("menu")).toBeVisible()
await page.mouse.move(0, 0)
await page.keyboard.press("Escape")
await expect(page.getByRole("menu")).toBeHidden()
+ await page.clock.runFor(0)
await expect(trigger).toBeFocused()
await trigger.hover()
+ await page.clock.runFor(600)
await expect(tooltip).toBeVisible()
})
diff --git a/packages/app/e2e/regression/btw-sidebar.spec.ts b/packages/app/e2e/regression/btw-sidebar.spec.ts
index 6ae47c9a64e7..0028cb75d005 100644
--- a/packages/app/e2e/regression/btw-sidebar.spec.ts
+++ b/packages/app/e2e/regression/btw-sidebar.spec.ts
@@ -163,6 +163,7 @@ test("keeps many long-titled side tabs usable at a narrow desktop width", async
})
test("answers /btw in the side panel without admitting a prompt", async ({ page }) => {
+ await page.clock.install()
await page.context().grantPermissions(["clipboard-read", "clipboard-write"])
const generations: { sessionID: string; prompt: string }[] = []
const prompts: unknown[] = []
@@ -228,12 +229,27 @@ test("answers /btw in the side panel without admitting a prompt", async ({ page
await expect(panel.getByRole("button", { name: "Revert to here", exact: true })).toHaveCount(0)
await expect(panel.getByRole("button", { name: "Copy answer", exact: true })).toHaveCount(1)
await expect(panel.locator('[data-slot="text-part-meta"]')).toContainText(/\d+s/)
- await panel.locator('[data-component="user-message"]').hover()
- await panel.getByRole("button", { name: "Copy message", exact: true }).click()
- await expect(panel.getByRole("button", { name: "Copied", exact: true })).toHaveCount(1)
- await panel.locator('[data-component="text-part"]').hover()
- await panel.getByRole("button", { name: "Copy answer", exact: true }).click()
- await expect(panel.getByRole("button", { name: "Copied", exact: true })).toHaveCount(2)
+ const feedback = page.getByRole("tooltip", { name: "Copied", exact: true })
+
+ for (const [component, label] of [
+ ["user-message", "Copy message"],
+ ["text-part", "Copy answer"],
+ ]) {
+ const row = panel.locator(`[data-component="${component}"]`)
+
+ const button = row.getByRole("button", { name: label, exact: true })
+
+ await row.hover()
+ await button.click()
+ await expect(feedback).toBeVisible()
+ await page.clock.fastForward(1_000)
+ await expect(feedback).toHaveCSS("opacity", "1")
+ await expect(row.getByRole("button", { name: "Copied", exact: true })).toBeVisible()
+ await page.clock.fastForward(1_000)
+ await expect(button).toBeVisible()
+ await expect(page.getByRole("tooltip")).toBeHidden()
+ }
+
expect(generations).toHaveLength(1)
expect(generations[0]?.sessionID).toBe(main.id)
expect(generations[0]?.prompt).toContain("how does the retry loop work?")
diff --git a/packages/app/e2e/regression/settings.spec.ts b/packages/app/e2e/regression/settings.spec.ts
index 3abea682c73d..adc3e0edcd04 100644
--- a/packages/app/e2e/regression/settings.spec.ts
+++ b/packages/app/e2e/regression/settings.spec.ts
@@ -1765,6 +1765,9 @@ for (const row of [
})
}
+const connectDialog = (page: Page) =>
+ page.getByRole("dialog").filter({ has: page.getByRole("navigation", { name: "Connect steps", exact: true }) })
+
const consoleIntegrations = [
{
id: "opencode",
@@ -1799,7 +1802,7 @@ test("providers: OpenCode Console signs in from its method list", async ({ page,
await methods.getByRole("button", { name: "OpenCode Console account", exact: true }).click()
await expect(await popup).toHaveURL(url)
- const signIn = page.getByRole("dialog", { name: "Connecting to OpenCode Console", exact: true })
+ const signIn = page.getByRole("dialog", { name: "Connect OpenCode Console", exact: true })
await expect(signIn.getByRole("group", { name: "Device code: ABCD-EFGH", exact: true })).toBeVisible()
await expect(signIn.getByRole("button", { name: "Copy sign-in link", exact: true })).toBeVisible()
})
@@ -1880,14 +1883,14 @@ test("providers: Back during a pending API key request does not report the provi
.locator(".settings-provider-row", { hasText: "OpenRouter" })
.getByRole("button", { name: "Connect", exact: true })
.click()
- const dialog = page.getByRole("dialog", { name: "Connect OpenRouter", exact: true })
+ const dialog = connectDialog(page)
await dialog.getByRole("button", { name: "API key", exact: true }).click()
await dialog.getByPlaceholder("API key").fill("sk-late")
await dialog.getByRole("button", { name: "Continue", exact: true }).click()
await held.arrived
await expect(dialog.getByRole("button", { name: "Continue", exact: true })).toBeDisabled()
- await dialog.getByRole("button", { name: "Navigate back", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "OpenRouter", exact: true }).click()
await expect(dialog.getByRole("button", { name: "Sign in", exact: true })).toBeVisible()
// The server still saves the key, so its late success reloads the catalogs without leaving the method list.
@@ -1925,7 +1928,7 @@ test("providers: the free tier upsell opens Go on its own, sized to its content"
const container = page.locator('[data-slot="dialog-container"]')
await expect(dialog.getByPlaceholder("API key")).toBeVisible()
// Nothing to go back to: the upsell opened the dialog straight on Go.
- await expect(dialog.getByRole("button", { name: "Navigate back", exact: true })).toHaveCount(0)
+ await expect(dialog.getByRole("navigation").getByRole("button")).toHaveCount(0)
await expect.poll(async () => (await container.boundingBox())?.height).toBeLessThan(512)
})
@@ -1982,7 +1985,7 @@ test("providers: the connect dialog lists connected providers and manages their
const picker = await container.boundingBox()
await openai.click()
- await expect(page.getByRole("dialog", { name: "OpenAI", exact: true })).toBeVisible()
+ await expect(page.getByRole("dialog", { name: "Connect OpenAI", exact: true })).toBeVisible()
// The provider step fits its content below the list's top edge.
await expect.poll(async () => (await container.boundingBox())?.height).toBeLessThan(picker!.height)
expect((await container.boundingBox())?.y).toBe(picker!.y)
@@ -2010,7 +2013,7 @@ test("providers: the connect dialog lists connected providers and manages their
await name.fill("Ignored")
await name.press("Escape")
await expect(list.getByRole("radio")).toHaveText(["Home", "Work"])
- await expect(page.getByRole("dialog", { name: "OpenAI", exact: true })).toBeVisible()
+ await expect(page.getByRole("dialog", { name: "Connect OpenAI", exact: true })).toBeVisible()
await list.getByRole("button", { name: "Work options", exact: true }).click()
await page.getByRole("menuitem", { name: "Remove", exact: true }).click()
@@ -2025,7 +2028,7 @@ test("providers: the connect dialog lists connected providers and manages their
await dialog.getByRole("button", { name: "Add account", exact: true }).click()
await expect(dialog.getByPlaceholder("API key")).toBeVisible()
- await dialog.getByRole("button", { name: "Navigate back", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "OpenAI", exact: true }).click()
await expect(list).toBeVisible()
})
@@ -2064,9 +2067,9 @@ test("providers: adding an account starts a lone method once", async ({ page, co
await expect(dialog.getByPlaceholder("API key")).toBeVisible()
expect(attempts).toEqual([])
- await dialog.getByRole("button", { name: "Navigate back", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "OpenCode Go", exact: true }).click()
await expect(dialog.getByRole("radio", { name: "Go key", exact: true })).toBeVisible()
- await dialog.getByRole("button", { name: "Integrations", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "Connect", exact: true }).click()
await dialog.locator('[data-provider-id="github-copilot"]').click()
const popup = page.waitForEvent("popup")
await dialog.getByRole("button", { name: "Add account", exact: true }).click()
@@ -2101,9 +2104,9 @@ test("providers: Back from a pending sign-in cancels it and lets a backdrop clic
const popup = page.waitForEvent("popup")
await dialog.locator('[data-provider-id="github-copilot"]').click()
await popup
- await expect(dialog.getByText("Waiting for authorization…", { exact: true })).toBeVisible()
+ await expect(dialog.getByText("Waiting for authorization", { exact: true })).toBeVisible()
- await dialog.getByRole("button", { name: "Navigate back", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "Connect", exact: true }).click()
await expect(dialog.locator('[data-provider-id="github-copilot"]')).toBeVisible()
await expect.poll(() => cancelled).toEqual(["con_mock_1"])
@@ -2132,9 +2135,9 @@ test("providers: Back from a Claude Agent check started by Add account returns t
await dialog.getByRole("button", { name: "Add account", exact: true }).click()
await dialog.getByRole("button", { name: "Check again", exact: true }).click()
await held.arrived
- await expect(dialog.getByText("Checking Claude Code…", { exact: true })).toBeVisible()
+ await expect(dialog.getByText("Checking Claude Code", { exact: true })).toBeVisible()
- await dialog.getByRole("button", { name: "Navigate back", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "Claude Agent", exact: true }).click()
await expect(dialog.getByRole("radio", { name: "Claude Code", exact: true })).toBeVisible()
held.release()
})
@@ -2173,13 +2176,13 @@ test("providers: Back from a Console connection without models returns to its si
.locator(".settings-provider-row", { hasText: "OpenCode Console" })
.getByRole("button", { name: "Connect", exact: true })
.click()
- const dialog = page.getByRole("dialog", { name: "Connect OpenCode Console", exact: true })
+ const dialog = connectDialog(page)
const popup = page.waitForEvent("popup")
await dialog.getByRole("button", { name: "OpenCode Console account", exact: true }).click()
await popup
await expect(page.getByRole("dialog").getByText("OpenCode connected", { exact: true })).toBeVisible()
- await page.getByRole("dialog").getByRole("button", { name: "Navigate back", exact: true }).click()
+ await dialog.getByRole("navigation").getByRole("button", { name: "OpenCode Console", exact: true }).click()
await expect(dialog.locator('[data-action="provider-connect-method"]')).toHaveText([
"OpenCode Console account",
"API key (service account)",
diff --git a/packages/app/e2e/regression/side-panels.spec.ts b/packages/app/e2e/regression/side-panels.spec.ts
index 25de38130772..b58082aa29c8 100644
--- a/packages/app/e2e/regression/side-panels.spec.ts
+++ b/packages/app/e2e/regression/side-panels.spec.ts
@@ -387,3 +387,84 @@ test("the new tab view lists recently closed tabs, expands to the rest, and keep
await expect(rows.first()).toContainText("closed-00.ts")
await expect(recent).not.toContainText("README.md")
})
+
+test("Mod+F finds in Markdown and HTML previews with the code view's find bar", async ({ page }) => {
+ await page.setViewportSize({ width: 1440, height: 900 })
+ const directory = "C:/OpenCode/PreviewFind"
+ const key = `local\u0000${base64Encode(directory)}/ses_previewfind`
+
+ const files = new Map([
+ ["notes.md", "# Needle notes\n\nOne needle here.\n\nAnother **needle** there."],
+ ["diagram.mmd", "flowchart TD\n A[First needle] --> B[Last needle]"],
+ [
+ "page.html",
+ "\n
PageFirst needle
Last needle
",
+ ],
+ ])
+
+ await openSession(page, {
+ name: "PreviewFind",
+ fileList: () => [],
+ fileContent: (path) => ({ type: "text", content: files.get(path.split("/").at(-1) ?? "") ?? "" }),
+ seed: {
+ panes: { ses_previewfind: { review: true } },
+ storage: {
+ "opencode.global.dat:layout": {
+ sessionTabs: {
+ [key]: { all: ["file://notes.md", "file://diagram.mmd", "file://page.html"], active: "file://notes.md" },
+ },
+ },
+ },
+ },
+ })
+
+ const side = page.locator('[data-pane-content="side"]')
+ const find = page.getByRole("textbox", { name: "Find" })
+ const mod = await page.evaluate(() => (/(Mac|iPod|iPhone|iPad)/.test(navigator.platform) ? "Meta" : "Control"))
+ await side.getByText("One needle here.").click()
+ await page.keyboard.press(`${mod}+f`)
+ await expect(find).toBeFocused()
+ await find.fill("needle")
+ await expect(page.getByText("1/3", { exact: true })).toBeVisible()
+ await find.press("Enter")
+ await expect(page.getByText("2/3", { exact: true })).toBeVisible()
+ await find.press("Shift+Enter")
+ await find.press("Shift+Enter")
+ await expect(page.getByText("3/3", { exact: true })).toBeVisible()
+ await find.press("Escape")
+ await expect(find).toHaveCount(0)
+
+ // A closed side panel keeps its preview mounted out of sight, so Mod+F opens no bar there.
+ const toggle = page.getByRole("button", { name: "Toggle review" })
+ await toggle.click()
+ await expect(side).toBeHidden()
+ await page.keyboard.press(`${mod}+f`)
+ await expect(find).toHaveCount(0)
+ await toggle.click()
+
+ // Mermaid keeps its source in a hidden code block; only the drawn labels count.
+ await side.getByRole("tab", { name: "diagram.mmd", exact: true }).click()
+ await side.locator("svg").getByText("First needle").click()
+ await page.keyboard.press(`${mod}+f`)
+ await expect(find).toBeFocused()
+ await find.fill("needle")
+ await expect(page.getByText("1/2", { exact: true })).toBeVisible()
+ await find.press("Escape")
+ await expect(find).toHaveCount(0)
+
+ // The HTML runs in a sandboxed frame; Mod+F pressed inside it still opens the bar.
+ await side.getByRole("tab", { name: "page.html", exact: true }).click()
+ const frame = side.frameLocator('iframe[data-file-find="frame"]')
+ await frame.getByText("First needle").click()
+ // The find script goes after the doctype, even behind a comment, so the page keeps standards mode.
+ expect(await frame.locator("html").evaluate(() => document.compatMode)).toBe("CSS1Compat")
+ await page.keyboard.press(`${mod}+f`)
+ await expect(find).toBeFocused()
+ await find.fill("needle")
+ await expect(page.getByText("1/2", { exact: true })).toBeVisible()
+ await find.press("Enter")
+ await expect(page.getByText("2/2", { exact: true })).toBeVisible()
+ await expect(frame.getByText("Last needle")).toBeInViewport()
+ await find.press("Escape")
+ await expect(find).toHaveCount(0)
+})
diff --git a/packages/app/e2e/regression/tabs.spec.ts b/packages/app/e2e/regression/tabs.spec.ts
index 5ef9ed996d9d..dddb9d25374a 100644
--- a/packages/app/e2e/regression/tabs.spec.ts
+++ b/packages/app/e2e/regression/tabs.spec.ts
@@ -1874,6 +1874,9 @@ test("the Windows titlebar menu swaps one submenu for the next as the pointer mo
const parents = ["File", "Edit", "View"].map((name) => page.getByRole("menuitem", { name, exact: true }))
const submenus = page.locator('[role="menu"].desktop-app-menu-sub')
+ // Keep the hover delay from elapsing while Playwright moves the pointer and checks the old submenu.
+ await holdClock(page)
+
for (const [index, parent] of parents.entries()) {
const box = (await parent.boundingBox())!
// Down and to the left, away from the open submenu, so the pointer isn't heading for it.
diff --git a/packages/app/src/components-lab/dialog-story-runtime.tsx b/packages/app/src/components-lab/dialog-story-runtime.tsx
index 95f3ef4bd23f..23b0a41d06e1 100644
--- a/packages/app/src/components-lab/dialog-story-runtime.tsx
+++ b/packages/app/src/components-lab/dialog-story-runtime.tsx
@@ -204,7 +204,7 @@ const defaultModels = [
}),
]
-const integrations = [
+const fixtureIntegrations = [
{
id: "anthropic",
name: "Anthropic",
@@ -248,6 +248,149 @@ const integrations = [
methods: [{ type: "oauth", id: "copilot", label: "Sign in with GitHub" }],
connections: [],
},
+ {
+ id: "xai",
+ name: "xAI",
+ methods: [
+ { type: "oauth", id: "device", label: "SuperGrok Subscription" },
+ { type: "key", label: "Manually enter API Key" },
+ ],
+ connections: [],
+ },
+ {
+ id: "gitlab",
+ name: "GitLab",
+ methods: [
+ {
+ type: "oauth",
+ id: "pkce",
+ label: "Login with GitLab (OAuth)",
+ form: [
+ {
+ key: "instanceUrl",
+ type: "string",
+ title: "GitLab instance URL",
+ description: "Use gitlab.com, or the URL of your self-managed instance.",
+ placeholder: "https://gitlab.com",
+ },
+ ],
+ },
+ ],
+ connections: [],
+ },
+ {
+ id: "snowflake-cortex",
+ name: "Snowflake Cortex",
+ methods: [
+ {
+ type: "oauth",
+ id: "browser",
+ label: "Login with Snowflake (External Browser)",
+ form: [
+ { key: "account", type: "string", title: "Snowflake account", placeholder: "org-account", required: true },
+ ],
+ },
+ ],
+ connections: [],
+ },
+ {
+ id: "amazon-bedrock",
+ name: "Amazon Bedrock",
+ methods: [
+ { type: "key", label: "Bedrock API key" },
+ {
+ type: "external",
+ id: "aws-profile",
+ label: "AWS profile (SSO or named profile)",
+ form: [
+ {
+ key: "profile",
+ type: "string",
+ title: "AWS profile",
+ description: "Profiles from ~/.aws/config.",
+ required: true,
+ custom: true,
+ options: [
+ { value: "default", label: "default" },
+ { value: "work-sso", label: "work-sso", description: "SSO · us-east-1" },
+ ],
+ },
+ ],
+ },
+ ],
+ connections: [],
+ },
+ {
+ id: "acme-search",
+ name: "Acme Search",
+ methods: [
+ {
+ type: "key",
+ label: "API key",
+ form: [
+ {
+ key: "sources",
+ type: "multiselect",
+ title: "Sources to search",
+ minItems: 1,
+ custom: true,
+ options: [
+ { value: "web", label: "Web" },
+ { value: "news", label: "News", description: "Articles from the last 30 days" },
+ { value: "code", label: "Code" },
+ ],
+ },
+ { key: "safe", type: "boolean", title: "Use safe search?", default: true },
+ ],
+ },
+ ],
+ connections: [],
+ },
+ {
+ id: "acme-cloud",
+ name: "Acme Cloud",
+ methods: [
+ {
+ type: "oauth",
+ id: "browser",
+ label: "Sign in",
+ form: [
+ {
+ key: "terms",
+ type: "external",
+ url: "https://acme.example/terms",
+ title: "Accept the Acme terms",
+ description: "Open the link, accept the terms, then come back.",
+ },
+ ],
+ },
+ ],
+ connections: [],
+ },
+ {
+ id: "acme-cli",
+ name: "Acme CLI",
+ methods: [{ type: "command", id: "login", label: "Log in", command: ["acme", "login"] }],
+ connections: [],
+ },
+ {
+ id: "acme-code",
+ name: "Acme Code",
+ methods: [{ type: "oauth", id: "code", label: "Acme account" }],
+ connections: [],
+ },
+ {
+ id: "acme-broken",
+ name: "Acme Broken",
+ methods: [{ type: "oauth", id: "browser", label: "Sign in" }],
+ connections: [],
+ },
+ {
+ id: "claude-agent",
+ name: "Claude Agent",
+ methods: [{ type: "external", id: "claude-login", label: "Claude Code login (claude auth login)" }],
+ connections: [],
+ },
{
id: "google",
name: "Google",
@@ -354,9 +497,18 @@ function findMatchingPaths(root: string, query: string, type: string | null) {
type DialogStoryRuntimeOptions = {
servers?: ServerConnection.Any[]
platform?: Platform
+ /** Replaces fixture integrations with the same id. */
+ integrations?: IntegrationInfo[]
}
-export function createStoryFetch(): typeof fetch {
+const REDIRECT_PASTE = ["openai", "gitlab", "snowflake-cortex"]
+
+export function createStoryFetch(overrides: IntegrationInfo[] = []): typeof fetch {
+ const integrations = [
+ ...overrides,
+ ...fixtureIntegrations.filter((item) => !overrides.some((override) => override.id === item.id)),
+ ]
+
const encoder = new TextEncoder()
const handler = async (input: RequestInfo | URL, init?: RequestInit) => {
@@ -472,13 +624,46 @@ export function createStoryFetch(): typeof fetch {
if (rest[1] === "connect" && rest[2] === "oauth" && rest.length === 3 && method === "POST") {
const now = Date.now()
+ if (integrationID === "acme-broken")
+ return errorResponse("InvalidRequestError", "The Acme sign-in service is unavailable. Try again later.", 400)
+
return jsonResponse({
location,
data: {
attemptID: "con_story_1",
- url: "https://opencode.ai/auth/authorize",
+ // Device sign-ins show a code; some browser sign-ins also take the redirect URL pasted from another device.
+ url:
+ integrationID === "github-copilot" || integrationID === "xai"
+ ? "https://example.test/device?user_code=KBSC-TK37"
+ : integrationID === "opencode"
+ ? "https://opencode.ai/auth/device?user_code=WXYZ-2345"
+ : "https://opencode.ai/auth/authorize",
instructions: "",
- mode: "auto",
+ mode: integrationID === "acme-code" ? "code" : "auto",
+ paste: REDIRECT_PASTE.includes(integrationID) ? true : undefined,
+ time: { created: now, expires: now + 600_000 },
+ },
+ })
+ }
+
+ if (rest[1] === "connect" && rest[2] === "command" && rest.length === 3 && method === "POST") {
+ const now = Date.now()
+
+ return jsonResponse({
+ location,
+ data: { attemptID: "con_story_cmd", time: { created: now, expires: now + 600_000 } },
+ })
+ }
+
+ if (rest[1] === "connect" && rest[2] === "command" && rest[3] && method === "GET") {
+ const now = Date.now()
+
+ return jsonResponse({
+ location,
+ data: {
+ status: "pending",
+ message:
+ "$ acme login\nOpening https://acme.example/device in your browser…\nWaiting for you to approve this device.",
time: { created: now, expires: now + 600_000 },
},
})
@@ -581,7 +766,7 @@ export function DialogStoryRuntime(props: ParentProps
restart: async () => {},
notify: async () => {},
storage: createMemoryStorage(),
- fetch: createStoryFetch(),
+ fetch: createStoryFetch(props.integrations),
}
const client = new QueryClient({
diff --git a/packages/app/src/providers/connect/console.tsx b/packages/app/src/providers/connect/console.tsx
index ad90795de2b1..0bf975db7a90 100644
--- a/packages/app/src/providers/connect/console.tsx
+++ b/packages/app/src/providers/connect/console.tsx
@@ -1,7 +1,7 @@
import { For, Show } from "solid-js"
import { Button } from "@opencode/ui/button"
-import { TextShimmer } from "@opencode/ui/text-shimmer"
import { useLanguage } from "@/runtime/i18n/language"
+import { StepActions, WaitingButton } from "./step-actions"
export function ConsoleAuthorization(props: {
/** Undefined until the server returns the sign-in attempt. */
@@ -9,7 +9,6 @@ export function ConsoleAuthorization(props: {
browserFailed: boolean
copied: boolean
copyFailed: boolean
- onOpen: () => void
onCopy: () => void
}) {
const language = useLanguage()
@@ -17,67 +16,52 @@ export function ConsoleAuthorization(props: {
return (
{language.t(
props.browserFailed ? "provider.connect.console.browserFailed" : "provider.connect.console.instructions",
)}
-
-
{language.t("provider.connect.console.deviceCode")}
-
-
-
- }
- >
- {(code) => (
- <>
-
-
- {(character) => (
-
- {character}
-
- )}
-
-
-
-
-
- >
- )}
-
-
-
- {language.t("provider.connect.console.browserHint")}
-
-
-
-
-
+
+ {(code) => (
+
+
{language.t("provider.connect.console.deviceCode")}
+
+
+ {(character) => (
+
+ {character}
+
+ )}
+
+
+
+ )}
+
{language.t("provider.connect.console.copyFailed")}
+
+
+
+ {language.t(props.code ? "provider.connect.console.waiting" : "provider.connect.console.openingBrowser")}
+
+
)
}
diff --git a/packages/app/src/providers/connect/controller.ts b/packages/app/src/providers/connect/controller.ts
index d910d71d51b2..a473d5721b7b 100644
--- a/packages/app/src/providers/connect/controller.ts
+++ b/packages/app/src/providers/connect/controller.ts
@@ -23,6 +23,7 @@ import {
selectProviderDialogView,
transitionProviderDialog,
type ProviderAccounts,
+ type ProviderBackTarget,
type ProviderDialogEffect,
type ProviderDialogEvent,
} from "./dialog-machine"
@@ -635,7 +636,7 @@ export function createProviderDialogController(options: {
dispatch({ type: "provider.selected", provider: id, fromPicker: true, accounts: accountsOf(id) }),
input: (event: ProviderConnectEvent) => dispatch({ type: "connect.input", event }),
rename: accountActions.rename,
- back: () => dispatch({ type: "back" }),
+ navigate: (target: ProviderBackTarget) => dispatch({ type: "navigate", target }),
checkClaude: () => {
const id = provider()
diff --git a/packages/app/src/providers/connect/dialog-machine.test.ts b/packages/app/src/providers/connect/dialog-machine.test.ts
index 997a5a3c5f70..4e152d80afb4 100644
--- a/packages/app/src/providers/connect/dialog-machine.test.ts
+++ b/packages/app/src/providers/connect/dialog-machine.test.ts
@@ -1,6 +1,7 @@
import { expect, test } from "bun:test"
import {
createProviderDialogState,
+ providerBackTarget,
selectProviderDialogView,
transitionProviderDialog,
type ProviderAccounts,
@@ -56,6 +57,12 @@ const selected = (provider: string, fromPicker: boolean, list = none): ProviderD
accounts: list,
})
+// Clicks the nearest linked breadcrumb, the way the header goes back one step.
+const goBack = (state: ProviderDialogState): ProviderDialogEvent => ({
+ type: "navigate",
+ target: providerBackTarget(state) ?? "picker",
+})
+
function provider(state: ProviderDialogState) {
if (state.status !== "provider") throw new Error(`expected a provider step, got ${state.status}`)
@@ -180,7 +187,7 @@ test("Back from a pending OAuth sign-in to the provider list allows backdrop dis
const waiting = waitingOAuth("github-copilot")
expect(selectProviderDialogView(waiting.state).preventBackdropDismiss).toBe(true)
- const back = replay([{ type: "back" }], waiting.state)
+ const back = replay([goBack(waiting.state)], waiting.state)
expect(back.state.status).toBe("picker")
expect(selectProviderDialogView(back.state).preventBackdropDismiss).toBe(false)
@@ -197,11 +204,14 @@ test("Back from a Console connection without models returns to the sign-in metho
})
expect(types(empty.effects)).toEqual(["connected.notify", "models.reveal", "toast.connected"])
- const methods = replay([{ type: "back" }], empty.state)
+ const methods = replay([goBack(empty.state)], empty.state)
expect(selectProviderDialogView(methods.state).body).toEqual({ kind: "methods" })
- expect(selectProviderDialogView(methods.state).canBack).toBe(true)
+ expect(selectProviderDialogView(methods.state).crumbs).toEqual([
+ { kind: "root", target: "picker" },
+ { kind: "provider", target: undefined },
+ ])
- expect(replay([{ type: "back" }], methods.state).state.status).toBe("picker")
+ expect(replay([goBack(methods.state)], methods.state).state.status).toBe("picker")
})
test("Back from a failed Console refresh returns to the sign-in methods", () => {
@@ -220,14 +230,17 @@ test("Back from a failed Console refresh returns to the sign-in methods", () =>
)
expect(selectProviderDialogView(failed.state).body).toEqual({ kind: "failed" })
- expect(selectProviderDialogView(failed.state).title).toBe("console-error")
+ expect(selectProviderDialogView(failed.state).crumbs).toEqual([
+ { kind: "root", target: "picker" },
+ { kind: "provider", target: "methods" },
+ ])
- expect(selectProviderDialogView(replay([{ type: "back" }], failed.state).state).body).toEqual({ kind: "methods" })
+ expect(selectProviderDialogView(replay([goBack(failed.state)], failed.state).state).body).toEqual({ kind: "methods" })
})
test("Back during the Console workspace wait stops the wait", () => {
const refreshing = refreshingConsole()
- const back = replay([{ type: "back" }], refreshing.state)
+ const back = replay([goBack(refreshing.state)], refreshing.state)
expect(back.effects).toContainEqual({ type: "settle.cancel" })
expect(selectProviderDialogView(back.state).body).toEqual({ kind: "methods" })
@@ -239,9 +252,12 @@ test("Back from a Claude Agent check started from Add account returns to the acc
const started = replay([{ type: "claude.check", replacing: ["cred_1"] }], setup.state)
const start = connectEffect(started.effects, "start")
- expect(selectProviderDialogView(started.state).canBack).toBe(true)
+ expect(selectProviderDialogView(started.state).crumbs).toEqual([
+ { kind: "root", target: "picker" },
+ { kind: "provider", target: "accounts" },
+ ])
- const back = replay([{ type: "back" }], started.state)
+ const back = replay([goBack(started.state)], started.state)
expect(selectProviderDialogView(back.state).frame).toBe("accounts")
// The server still saves the connection, so its late result only reloads the catalogs.
@@ -267,7 +283,7 @@ test("leaving a Claude Agent check ignores its late confirmation", () => {
const session = provider(confirming.state).session
expect(confirming.effects).toContainEqual({ type: "claude.confirm", session, check })
- const back = replay([{ type: "back" }], confirming.state)
+ const back = replay([goBack(confirming.state)], confirming.state)
expect(back.state.status).toBe("picker")
expect(back.effects).toContainEqual({ type: "claude.timer.stop" })
@@ -348,7 +364,7 @@ test("a second Remove click sends one request, and a late final removal after Ba
expect(second.state).toBe(removing.state)
expect(second.effects).toEqual([])
- const back = replay([{ type: "back" }], removing.state)
+ const back = replay([goBack(removing.state)], removing.state)
const late = replay(
[
@@ -389,7 +405,7 @@ test("removing the last account closes the dialog once the removal settles", ()
)
expect(settled.effects).toEqual([{ type: "dialog.close" }])
- expect(replay([{ type: "back" }], settled.state).state).toBe(settled.state)
+ expect(replay([goBack(settled.state)], settled.state).state).toBe(settled.state)
})
test("a switch that settles after another switch started is ignored", () => {
@@ -431,7 +447,7 @@ test("a credential saved after the dialog moved to another provider only reloads
const submit = connectEffect(submitting.effects, "submit")
const session = provider(submitting.state).session
- const other = replay([{ type: "back" }, selected("anthropic", true)], submitting.state)
+ const other = replay([goBack(submitting.state), selected("anthropic", true)], submitting.state)
const late = replay(
[
@@ -526,7 +542,7 @@ test("a connection without models closes the dialog", () => {
expect(types(done.effects)).toEqual(["connected.notify", "models.reveal", "toast.connected", "dialog.close"])
// The key form stays while the dialog animates out, and takes no more input.
expect(selectProviderDialogView(done.state).body).toEqual({ kind: "key" })
- expect(replay([{ type: "back" }], done.state).state).toBe(done.state)
+ expect(replay([goBack(done.state)], done.state).state).toBe(done.state)
})
test("confirming a model closes once and keeps the outcome through disposal", () => {
@@ -598,15 +614,18 @@ test("a lone method waits on the accounts list and starts once Add account is ch
expect(types(added.effects)).toEqual(["connect.start"])
// Back from the lone method goes straight to the accounts list.
- expect(selectProviderDialogView(replay([{ type: "back" }], added.state).state).frame).toBe("accounts")
+ expect(selectProviderDialogView(replay([goBack(added.state)], added.state).state).frame).toBe("accounts")
})
test("a standalone dialog has no way back to the provider list", () => {
const opened = replay([selected("opencode-go", false)], createProviderDialogState({ standalone: true }))
const entering = replay([loaded(opened.state, [key])], opened.state)
- expect(selectProviderDialogView(entering.state).canBack).toBe(false)
- expect(replay([{ type: "back" }], entering.state).state).toBe(entering.state)
+ expect(selectProviderDialogView(entering.state).crumbs).toEqual([
+ { kind: "root", target: undefined },
+ { kind: "provider", target: undefined },
+ ])
+ expect(replay([goBack(entering.state)], entering.state).state).toBe(entering.state)
})
test("the Console sign-in link copy result belongs to its attempt", () => {
diff --git a/packages/app/src/providers/connect/dialog-machine.ts b/packages/app/src/providers/connect/dialog-machine.ts
index 8ee1773f11af..9c929cc3c6dd 100644
--- a/packages/app/src/providers/connect/dialog-machine.ts
+++ b/packages/app/src/providers/connect/dialog-machine.ts
@@ -146,7 +146,8 @@ export type ProviderDialogEvent =
| { readonly type: "model.selected"; readonly modelKey: string }
| { readonly type: "group.collapsed"; readonly providerID: string; readonly collapsed: boolean }
| { readonly type: "model.confirmed"; readonly selection: ModelChoice }
- | { readonly type: "back" }
+ /** A breadcrumb in the header: the provider list, or the provider's accounts or sign-in methods. */
+ | { readonly type: "navigate"; readonly target: ProviderBackTarget }
| { readonly type: "disposed" }
export type ProviderDialogEffect =
@@ -255,7 +256,11 @@ export function transitionProviderDialog(
if (event.type === "provider.cleared") return toPicker(state)
- if (event.type === "back") return back(state)
+ if (event.type === "navigate") {
+ if (event.target === "picker") return toPicker(state)
+
+ return event.target === providerBackTarget(state) ? back(state) : unchanged(state)
+ }
if (event.type === "accounts.synced") return synced(state, event.accounts)
@@ -338,7 +343,10 @@ export function providerBackTarget(state: ProviderDialogState): ProviderBackTarg
/** Which dialog shell the step uses: the searchable list, the model choice, or a provider step. */
export type ProviderDialogFrame = "picker" | "models" | "accounts" | "provider"
-export type ProviderDialogTitle = "connect" | "console-error" | "console-sign-in" | "anthropic-max"
+/** The header path of a provider step: the provider list, then the provider. A crumb with a `target` links back. */
+export type ProviderDialogCrumb =
+ | { readonly kind: "root"; readonly target?: "picker" }
+ | { readonly kind: "provider"; readonly target?: "accounts" | "methods" }
export type ProviderDialogBody =
| { readonly kind: "picker" }
@@ -361,7 +369,6 @@ export function selectProviderDialogView(state: ProviderDialogState) {
const connect = step && "connect" in step ? selectProviderConnectView(step.connect) : undefined
const target = providerBackTarget(state)
const body = selectBody(state, connect)
- const isConsole = provider?.provider === CONSOLE_INTEGRATION
const frame: ProviderDialogFrame = !step
? "picker"
@@ -374,17 +381,7 @@ export function selectProviderDialogView(state: ProviderDialogState) {
frame,
connect,
body,
- canBack: target !== undefined,
- title: ((): ProviderDialogTitle => {
- if (isConsole && connect?.status === "failed") return "console-error"
-
- if (body.kind === "console-sign-in") return "console-sign-in"
-
- if (provider?.provider === "anthropic" && connect?.method?.label?.toLowerCase().includes("max"))
- return "anthropic-max"
-
- return "connect"
- })(),
+ crumbs: crumbs(state, target),
// Closing on a stray backdrop click would abandon a sign-in the user is finishing in the browser.
preventBackdropDismiss: !!provider && !provider.closed && !!connect?.authorizing,
completed: state.completed,
@@ -394,6 +391,15 @@ export function selectProviderDialogView(state: ProviderDialogState) {
export type ProviderDialogView = ReturnType
+function crumbs(state: ProviderDialogState, target: ProviderBackTarget | undefined): readonly ProviderDialogCrumb[] {
+ if (state.status !== "provider" || state.step.kind === "models") return []
+
+ return [
+ { kind: "root", target: state.standalone ? undefined : "picker" },
+ { kind: "provider", target: target === "picker" ? undefined : target },
+ ]
+}
+
function selectBody(
state: ProviderDialogState,
connect: ReturnType | undefined,
diff --git a/packages/app/src/providers/connect/dialog.standalone.stories.tsx b/packages/app/src/providers/connect/dialog.standalone.stories.tsx
index 9efa9745919b..211ae47ed8d6 100644
--- a/packages/app/src/providers/connect/dialog.standalone.stories.tsx
+++ b/packages/app/src/providers/connect/dialog.standalone.stories.tsx
@@ -1,6 +1,8 @@
import { Button } from "@opencode/ui/button"
import { useDialog } from "@opencode/ui/context/dialog"
import { onMount } from "solid-js"
+import type { IntegrationInfo } from "@opencode/client/promise"
+import type { ServerConnection } from "@/runtime/server/registry"
import { DialogStoryRuntime, STORY_DIRECTORY, STORY_LOCKED_SERVER } from "@/components-lab/dialog-story-runtime"
import { DialogConnectProvider, useProviderConnectController } from "./dialog"
@@ -37,14 +39,42 @@ function ProviderConnectionDialogStory(props: { provider: string }) {
)
}
-function renderConnection(provider: string) {
- return () => (
-
-
-
- )
+function renderConnection(
+ provider: string,
+ options: { integrations?: IntegrationInfo[]; servers?: ServerConnection.Any[] } = {},
+) {
+ return () => {
+ return (
+
+
+
+ )
+ }
+}
+
+const REMOTE_SERVER: ServerConnection.Http = {
+ type: "http",
+ displayName: "Dev box",
+ http: { url: "http://devbox.local:4096" },
}
+const claudeWithProblem = (message: string): IntegrationInfo[] => [
+ {
+ id: "claude-agent",
+ name: "Claude Agent",
+ methods: [{ type: "external", id: "claude-login", label: "Claude Code login (claude auth login)" }],
+ connections: [
+ {
+ type: "credential",
+ id: "cred_claude",
+ label: "Claude Code",
+ method: "external",
+ status: { status: "needs_auth", message, url: "https://code.claude.com/docs/en/setup" },
+ },
+ ],
+ },
+]
+
export default {
title: "App/Dialogs/Connect Provider",
id: "app-dialog-connect-provider",
@@ -62,6 +92,21 @@ export const ChooseMethod = {
render: renderConnection("opencode"),
}
+/** OpenCode Console through a remote server: pick "API key (service account)" to see the note on a form. */
+export const ConsoleRemote = { render: renderConnection("opencode", { servers: [REMOTE_SERVER] }) }
+
+// Console with only its browser sign-in, so the story starts on the device code.
+const consoleAccountOnly: IntegrationInfo[] = [
+ {
+ id: "opencode",
+ name: "OpenCode Console",
+ methods: [{ type: "oauth", id: "console", label: "OpenCode Console account" }],
+ connections: [],
+ },
+]
+
+export const ConsoleSignIn = { render: renderConnection("opencode", { integrations: consoleAccountOnly }) }
+
export const ApiKey = {
render: renderConnection("openrouter"),
}
@@ -72,8 +117,66 @@ export const LoginMethods = {
export const ClaudeAgentSetup = { render: renderConnection("claude-agent") }
+export const ClaudeAgentNotInstalled = {
+ render: renderConnection("claude-agent", {
+ integrations: claudeWithProblem("Claude Code is not installed. Install it, then run `claude auth login`."),
+ }),
+}
+
+export const ClaudeAgentNotSignedIn = {
+ render: renderConnection("claude-agent", {
+ integrations: claudeWithProblem("Claude Code is not logged in. Run `claude auth login` in a terminal."),
+ }),
+}
+
+/** A device sign-in with a confirmation code. */
export const AwaitingBrowser = { render: renderConnection("github-copilot") }
+/** A choice between a device sign-in and an API key. */
+export const DeviceOrApiKey = { render: renderConnection("xai") }
+
+// OpenAI with only its ChatGPT method, so the story opens straight on the sign-in.
+const chatgptOnly: IntegrationInfo[] = [
+ {
+ id: "openai",
+ name: "OpenAI",
+ methods: [{ type: "oauth", id: "chatgpt", label: "ChatGPT Plus / Pro" }],
+ connections: [],
+ },
+]
+
+/** A browser sign-in that also takes a pasted redirect URL. */
+export const RedirectPaste = { render: renderConnection("openai", { integrations: chatgptOnly }) }
+
+/** The same sign-in through a remote server, where the paste field starts open. */
+export const RedirectPasteRemote = {
+ render: renderConnection("openai", { integrations: chatgptOnly, servers: [REMOTE_SERVER] }),
+}
+
+/** A text question before the sign-in, then a browser sign-in with redirect paste. */
+export const TextQuestion = { render: renderConnection("gitlab") }
+
+/** A required text question. Continue with an empty field to see the error. */
+export const RequiredTextQuestion = { render: renderConnection("snowflake-cortex") }
+
+/** Pick "AWS profile": a choice question with a custom answer, for an external credential. */
+export const ChoiceQuestion = { render: renderConnection("amazon-bedrock") }
+
+/** A multiselect question with a custom item, then a yes/no question, then the API key. */
+export const MultiselectQuestion = { render: renderConnection("acme-search") }
+
+/** A link the user opens and confirms before the sign-in. */
+export const ExternalLinkQuestion = { render: renderConnection("acme-cloud") }
+
+/** A sign-in that runs a command and shows its output. */
+export const Command = { render: renderConnection("acme-cli") }
+
+/** A sign-in that asks for the authorization code the browser shows. */
+export const PasteCode = { render: renderConnection("acme-code") }
+
+/** A sign-in the server fails to start. */
+export const Failed = { render: renderConnection("acme-broken") }
+
// The fixture refuses requests to this server. Submitting a sample service key shows the real error and retry.
export const LockedRemoteServer = {
render: () => (
diff --git a/packages/app/src/providers/connect/dialog.tsx b/packages/app/src/providers/connect/dialog.tsx
index 469e414481e3..c6476eac31b7 100644
--- a/packages/app/src/providers/connect/dialog.tsx
+++ b/packages/app/src/providers/connect/dialog.tsx
@@ -5,10 +5,11 @@ import { Icon } from "@opencode/ui/icon"
import { RadioGroup, RadioItem } from "@opencode/ui/radio"
import { Checkbox } from "@opencode/ui/checkbox"
import { Loader } from "@opencode/ui/loader"
-import { TextField } from "@opencode/ui/text-field"
+import { Field } from "@opencode/ui/field"
import { DialogBody, DialogHeader, DialogTitle, DialogTitleGroup, Dialog } from "@opencode/ui/dialog"
import { RedirectPasteForm } from "@opencode/ui/redirect-paste"
import { TextInput } from "@opencode/ui/text-input"
+import { Tooltip } from "@opencode/ui/tooltip"
import { type Component, createMemo, createUniqueId, For, type JSX, Match, onMount, Show, Switch } from "solid-js"
import { createStore } from "solid-js/store"
import { useParams } from "@solidjs/router"
@@ -30,12 +31,15 @@ import { CONSOLE_INTEGRATION, type ProviderDialogBody, type ProviderDialogFrame
import { connectMethods, selectProviderConnectView, type ProviderConnectMethod } from "./machine"
import type { ProviderFormInput, ProviderFormView } from "./form-machine"
import { ConsoleAuthorization } from "./console"
+import { StepActions, WaitingButton } from "./step-actions"
import { DialogChatGPTPlanWelcome } from "./chatgpt-welcome"
-import { authServerName, RemoteAuthNotice } from "./remote"
+import { authServerName } from "./remote"
import { providerAccounts } from "@/settings/providers/accounts"
import { AccountNameInput } from "@/settings/providers/account-name"
import { IconButton } from "@opencode/ui/icon-button"
import { Menu } from "@opencode/ui/menu"
+import { writeClipboard } from "@opencode/session-ui/copy"
+import { showToast } from "@/shell/notifications/toast"
import "@/shell/search-list.css"
import "./models.css"
@@ -102,23 +106,12 @@ export const DialogConnectProvider: Component<{
let focusHost: HTMLDivElement | undefined
const holdFocus = () => focusHost?.focus({ preventScroll: true })
- const title = () => {
- const name = controller.providerName()
- const kind = view().title
+ const providerName = () =>
+ consoleSelected() ? language.t("provider.connect.opencode.name") : controller.providerName()
- if (kind === "console-error") return language.t("provider.connect.opencode.errorTitle")
-
- if (kind === "console-sign-in")
- return language.t(
- view().provider === "opencode-go" ? "provider.connect.console.titleGo" : "provider.connect.console.title",
- )
-
- if (kind === "anthropic-max") return language.t("provider.connect.title.anthropicProMax")
-
- return language.t("provider.connect.title", {
- provider: consoleSelected() ? language.t("provider.connect.opencode.name") : name,
- })
- }
+ // A Console sign-in through another server is stored on that server, so the header names it.
+ const sdk = useServerSDK()
+ const remoteServer = () => (consoleSelected() && frame() !== "picker" ? authServerName(sdk.server) : undefined)
return (