GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(app): migrate discovery workflows (#38465) · moonug/opencode@aea4365

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/app
    • e2e/regression
      • cross-server-tab-close.spec.ts
      • remote-session-settings.spec.ts
      • remote-tab-busy.spec.ts
      • session-list-path-loading.spec.ts
      • session-request-docks.spec.ts
      • tab-navigate-mousedown.spec.ts
    • src
      • components
        • command-palette.ts
        • dialog-command-palette-v2.tsx
        • dialog-connect-provider.tsx
        • dialog-select-directory-v2.tsx
        • dialog-select-directory.tsx
        • dialog-select-mcp.tsx
        • directory-picker-domain.test.ts
        • directory-picker-domain.ts
        • edit-project.ts
        • titlebar-tab-nav.tsx
        • titlebar.tsx
      • context
        • file.tsx
        • layout.tsx
        • permission.tsx
      • pages
        • layout.tsx
      • utils
        • server-compat.test.ts
        • server-compat.ts
    • test-browser
      • command-palette.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/e2e/regression/cross-server-tab-close.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/cross-server-tab-close.spec.ts
+20-5Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect, test, type Page, type Route } from "@playwright/test"
22
import { base64Encode } from "@opencode-ai/core/util/encode"
3+
import { currentSession } from "../utils/mock-server"
34

45
const serverA = "http://127.0.0.1:4096"
56
const serverB = "http://127.0.0.1:4097"
@@ -33,7 +34,7 @@ test("closing the active server's last tab opens the remaining server tab", asyn
3334
await tabA.locator('[data-slot="tab-close"] button').click()
3435

3536
await expect(page).toHaveURL(new RegExp(`${hrefB.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`))
36-
await expect.poll(() => requests.some((url) => url.startsWith(`${serverB}/session/${sessionB.id}`))).toBe(true)
37+
await expect.poll(() => requests.some((url) => url.startsWith(`${serverB}/api/session/${sessionB.id}`))).toBe(true)
3738
await expect(page.getByText(sessionB.title).first()).toBeVisible()
3839
const sessionBRequests = requests.filter((url) => url.includes(`/session/${sessionB.id}`))
3940
expect(sessionBRequests.every((url) => url.startsWith(serverB))).toBe(true)
@@ -84,16 +85,20 @@ async function mockServers(page: Page, requests: string[]) {
8485
const current = url.origin === serverA ? sessionA : sessionB
8586
const directory = url.searchParams.get("directory")
8687
if (directory && directory !== current.directory) return json(route, { name: "InvalidDirectory" }, 500)
87-
if (url.pathname === "/global/event" || url.pathname === "/event") return sse(route)
88-
if (url.pathname === "/global/health") return json(route, { healthy: true })
89-
if (url.pathname === "/session") return json(route, [current])
88+
if (url.pathname === "/global/event" || url.pathname === "/event" || url.pathname === "/api/event") return sse(route)
89+
if (url.pathname === "/global/health") return json(route, {}, 404)
90+
if (url.pathname === "/api/health") return json(route, { pid: 1 })
91+
if (url.pathname === "/api/session") return json(route, { data: [currentSession(current)], cursor: {} })
92+
if (url.pathname === "/api/session/active") return json(route, { data: {} })
93+
if (url.pathname === `/api/session/${current.id}`) return json(route, { data: currentSession(current) })
94+
if (url.pathname === `/api/session/${current.id}/message`) return json(route, { data: [], cursor: {} })
9095
if (url.pathname === `/session/${current.id}`) return json(route, current)
9196
if (/^\/session\/[^/]+$/.test(url.pathname)) return json(route, { name: "NotFoundError" }, 404)
9297
if (url.pathname === `/session/${current.id}/message`) return json(route, [])
9398
if (/^\/session\/[^/]+\/(children|todo|diff)$/.test(url.pathname)) return json(route, [])
9499
if (["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/diff"].includes(url.pathname))
95100
return json(route, [])
96-
if (["/global/config", "/config", "/provider/auth", "/mcp", "/session/status"].includes(url.pathname))
101+
if (["/global/config", "/config", "/provider/auth", "/mcp"].includes(url.pathname))
97102
return json(route, {})
98103
if (url.pathname === "/provider")
99104
return json(route, { all: [], connected: [], default: { providerID: "", modelID: "" } })
@@ -116,7 +121,17 @@ async function mockServers(page: Page, requests: string[]) {
116121
directory: current.directory,
117122
home: current.directory,
118123
})
124+
if (url.pathname === "/api/path")
125+
return json(route, {
126+
state: current.directory,
127+
config: current.directory,
128+
worktree: current.directory,
129+
directory: current.directory,
130+
home: current.directory,
131+
})
119132
if (url.pathname === "/vcs") return json(route, { branch: "main", default_branch: "main" })
133+
if (url.pathname === "/api/vcs")
134+
return json(route, { location: { directory: current.directory }, data: { branch: "main", defaultBranch: "main" } })
120135
return json(route, {})
121136
})
122137
}
Collapse file

‎packages/app/e2e/regression/remote-session-settings.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/remote-session-settings.spec.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test("auto-accept responds for an unfocused server session", async ({ page }) =>
9898
.toEqual([
9999
{
100100
origin: serverA,
101-
directory: undefined,
101+
directory: directoryA,
102102
sessionID: sessionA.id,
103103
permissionID: "permission-background-a",
104104
body: { response: "once" },
@@ -126,14 +126,14 @@ test("auto-accept responds for an unfocused server session", async ({ page }) =>
126126
.toEqual([
127127
{
128128
origin: serverA,
129-
directory: undefined,
129+
directory: directoryA,
130130
sessionID: sessionA.id,
131131
permissionID: "permission-background-a",
132132
body: { response: "once" },
133133
},
134134
{
135135
origin: serverA,
136-
directory: undefined,
136+
directory: directoryA,
137137
sessionID: childSessionA.id,
138138
permissionID: "permission-background-a-child",
139139
body: { response: "once" },
Collapse file

‎packages/app/e2e/regression/remote-tab-busy.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/remote-tab-busy.spec.ts
+22-7Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect, test, type Page, type Route } from "@playwright/test"
22
import { base64Encode } from "@opencode-ai/core/util/encode"
3+
import { currentSession } from "../utils/mock-server"
34

45
const serverA = "http://127.0.0.1:4096"
56
const serverB = "http://127.0.0.1:4097"
@@ -57,11 +58,15 @@ async function mockServers(page: Page) {
5758
const current = url.origin === serverA ? sessionA : sessionB
5859
const directory = url.searchParams.get("directory")
5960
if (directory && directory !== current.directory) return json(route, { name: "InvalidDirectory" }, 500)
60-
if (url.pathname === "/global/event" || url.pathname === "/event") return sse(route)
61-
if (url.pathname === "/global/health") return json(route, { healthy: true })
62-
if (url.pathname === "/session/status")
63-
return json(route, url.origin === serverB ? { [sessionB.id]: { type: "busy" } } : {})
64-
if (url.pathname === "/session") return json(route, [current])
61+
if (url.pathname === "/global/event" || url.pathname === "/event" || url.pathname === "/api/event")
62+
return sse(route, url.pathname === "/api/event")
63+
if (url.pathname === "/global/health") return json(route, {}, 404)
64+
if (url.pathname === "/api/health") return json(route, { pid: 1 })
65+
if (url.pathname === "/api/session/active")
66+
return json(route, { data: url.origin === serverB ? { [sessionB.id]: { type: "running" } } : {} })
67+
if (url.pathname === "/api/session") return json(route, { data: [currentSession(current)], cursor: {} })
68+
if (url.pathname === `/api/session/${current.id}`) return json(route, { data: currentSession(current) })
69+
if (url.pathname === `/api/session/${current.id}/message`) return json(route, { data: [], cursor: {} })
6570
if (url.pathname === `/session/${current.id}`) return json(route, current)
6671
if (/^\/session\/[^/]+$/.test(url.pathname)) return json(route, { name: "NotFoundError" }, 404)
6772
if (url.pathname === `/session/${current.id}/message`) return json(route, [])
@@ -90,7 +95,17 @@ async function mockServers(page: Page) {
9095
directory: current.directory,
9196
home: current.directory,
9297
})
98+
if (url.pathname === "/api/path")
99+
return json(route, {
100+
state: current.directory,
101+
config: current.directory,
102+
worktree: current.directory,
103+
directory: current.directory,
104+
home: current.directory,
105+
})
93106
if (url.pathname === "/vcs") return json(route, { branch: "main", default_branch: "main" })
107+
if (url.pathname === "/api/vcs")
108+
return json(route, { location: { directory: current.directory }, data: { branch: "main", defaultBranch: "main" } })
94109
return json(route, {})
95110
})
96111
}
@@ -104,10 +119,10 @@ function json(route: Route, body: unknown, status = 200) {
104119
})
105120
}
106121

107-
function sse(route: Route) {
122+
function sse(route: Route, current: boolean) {
108123
return route.fulfill({
109124
status: 200,
110125
contentType: "text/event-stream",
111-
body: `data: ${JSON.stringify({ payload: { id: "evt_mock_connected", type: "server.connected", properties: {} } })}\n\n`,
126+
body: current ? 'data: {"id":"evt_connected","type":"server.connected","data":{}}\n\n' : ": ok\n\n",
112127
})
113128
}
Collapse file

‎packages/app/e2e/regression/session-list-path-loading.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/session-list-path-loading.spec.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ test("shows loaded sessions before the directory path request resolves", async (
1616
const pathBlocked = new Promise<void>((resolve) => {
1717
releasePath = resolve
1818
})
19-
await page.route("**/path?*", async (route) => {
20-
if (!new URL(route.request().url()).searchParams.has("directory")) return route.fallback()
19+
await page.route("**/api/path?*", async (route) => {
20+
if (!new URL(route.request().url()).searchParams.has("location[directory]")) return route.fallback()
2121
await pathBlocked
2222
return route.fallback()
2323
})
Collapse file

‎packages/app/e2e/regression/session-request-docks.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/session-request-docks.spec.ts
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ test("shows a pending question dock", async ({ page }) => {
4242
const rejectRequests: string[] = []
4343
page.on("request", (request) => {
4444
if (request.method() !== "POST") return
45-
if (new URL(request.url()).pathname === "/question/question-request/reject") rejectRequests.push(request.url())
45+
if (new URL(request.url()).pathname === `/api/session/${sessionID}/question/question-request/reject`)
46+
rejectRequests.push(request.url())
4647
})
4748

4849
await question.locator('[data-component="icon-button"][data-icon="chevron-down"]').click()
@@ -64,7 +65,9 @@ test("shows a pending question dock", async ({ page }) => {
6465

6566
await question.getByRole("radio", { name: /Minimal/ }).click()
6667
const reply = page.waitForRequest(
67-
(request) => request.method() === "POST" && new URL(request.url()).pathname === "/question/question-request/reply",
68+
(request) =>
69+
request.method() === "POST" &&
70+
new URL(request.url()).pathname === `/api/session/${sessionID}/question/question-request/reply`,
6871
)
6972
await question.getByRole("button", { name: "Submit" }).click()
7073
expect((await reply).postDataJSON()).toEqual({ answers: [["Minimal"]] })
@@ -97,8 +100,8 @@ test("shows a pending permission dock", async ({ page }) => {
97100
const reply = page.waitForRequest((request) => request.method() === "POST")
98101
await permission.getByRole("button", { name: "Allow once" }).click()
99102
const request = await reply
100-
expect(new URL(request.url()).pathname).toBe(`/session/${sessionID}/permissions/permission-request`)
101-
expect(request.postDataJSON()).toEqual({ response: "once" })
103+
expect(new URL(request.url()).pathname).toBe(`/api/session/${sessionID}/permission/permission-request/reply`)
104+
expect(request.postDataJSON()).toEqual({ reply: "once" })
102105
})
103106

104107
test("restores the draft caret before typing after a request dock closes", async ({ page }) => {
@@ -170,6 +173,7 @@ async function mockServer(
170173
},
171174
) {
172175
await mockOpenCodeServer(page, {
176+
protocol: "v2",
173177
directory,
174178
project: {
175179
id: projectID,
Collapse file

‎packages/app/e2e/regression/tab-navigate-mousedown.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/tab-navigate-mousedown.spec.ts
+22-3Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect, test, type Page, type Route } from "@playwright/test"
22
import { base64Encode } from "@opencode-ai/core/util/encode"
3+
import { currentSession } from "../utils/mock-server"
34

45
const server = "http://127.0.0.1:4096"
56
const sessionA = session("ses_tab_a", "Tab A session")
@@ -56,17 +57,22 @@ async function mockServer(page: Page) {
5657
await page.route("**/*", async (route) => {
5758
const url = new URL(route.request().url())
5859
if (url.origin !== server) return route.fallback()
59-
if (url.pathname === "/global/event" || url.pathname === "/event") return sse(route)
60+
if (url.pathname === "/global/event" || url.pathname === "/event" || url.pathname === "/api/event") return sse(route)
6061
if (url.pathname === "/global/health") return json(route, { healthy: true })
61-
if (url.pathname === "/session") return json(route, sessions)
62+
if (url.pathname === "/api/session") return json(route, { data: sessions.map(currentSession), cursor: {} })
63+
if (url.pathname === "/api/session/active") return json(route, { data: {} })
64+
const currentSessionInfo = sessions.find((item) => url.pathname === `/api/session/${item.id}`)
65+
if (currentSessionInfo) return json(route, { data: currentSession(currentSessionInfo) })
66+
if (sessions.some((item) => url.pathname === `/api/session/${item.id}/message`))
67+
return json(route, { data: [], cursor: {} })
6268
const byId = sessions.find((item) => url.pathname === `/session/${item.id}`)
6369
if (byId) return json(route, byId)
6470
if (/^\/session\/[^/]+$/.test(url.pathname)) return json(route, { name: "NotFoundError" }, 404)
6571
if (/^\/session\/[^/]+\/message$/.test(url.pathname)) return json(route, [])
6672
if (/^\/session\/[^/]+\/(children|todo|diff)$/.test(url.pathname)) return json(route, [])
6773
if (["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/diff"].includes(url.pathname))
6874
return json(route, [])
69-
if (["/global/config", "/config", "/provider/auth", "/mcp", "/session/status"].includes(url.pathname))
75+
if (["/global/config", "/config", "/provider/auth", "/mcp"].includes(url.pathname))
7076
return json(route, {})
7177
if (url.pathname === "/provider")
7278
return json(route, { all: [], connected: [], default: { providerID: "", modelID: "" } })
@@ -89,7 +95,20 @@ async function mockServer(page: Page) {
8995
directory: sessionA.directory,
9096
home: sessionA.directory,
9197
})
98+
if (url.pathname === "/api/path")
99+
return json(route, {
100+
state: sessionA.directory,
101+
config: sessionA.directory,
102+
worktree: sessionA.directory,
103+
directory: sessionA.directory,
104+
home: sessionA.directory,
105+
})
92106
if (url.pathname === "/vcs") return json(route, { branch: "main", default_branch: "main" })
107+
if (url.pathname === "/api/vcs")
108+
return json(route, {
109+
location: { directory: sessionA.directory },
110+
data: { branch: "main", defaultBranch: "main" },
111+
})
93112
return json(route, {})
94113
})
95114
}
Collapse file

‎packages/app/src/components/command-palette.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/components/command-palette.ts
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getFilename } from "@opencode-ai/core/util/path"
2-
import type { GlobalSession, Project } from "@opencode-ai/sdk/v2/client"
2+
import type { Project } from "@opencode-ai/sdk/v2/client"
3+
import type { SessionInfo } from "@opencode-ai/client/promise"
34
import { useDialog } from "@opencode-ai/ui/context/dialog"
45
import { createMemo, onCleanup } from "solid-js"
56
import { commandPaletteOptions, useCommand, type CommandOption } from "@/context/command"
@@ -13,6 +14,7 @@ import { useTabs } from "@/context/tabs"
1314
import { displayName, projectForSession } from "@/pages/layout/helpers"
1415
import { createSessionTabs } from "@/pages/session/helpers"
1516
import { useSessionLayout } from "@/pages/session/session-layout"
17+
import { normalizeSessionInfo } from "@/utils/session"
1618

1719
export type CommandPaletteEntry = {
1820
id: string
@@ -145,7 +147,7 @@ export function createCommandPaletteModel(props: { filesOnly?: () => boolean; on
145147
opened: serverCtx.projects.list,
146148
stored: () => serverCtx.sync.data.project,
147149
load: (search, signal) =>
148-
serverSDK.client.experimental.session.list({ roots: true, search, limit: 50 }, { signal }),
150+
serverSDK.api.session.list({ parentID: null, search, limit: 50 }, { signal }),
149151
untitled: () => language.t("command.session.new"),
150152
category: () => language.t("command.category.session"),
151153
})
@@ -219,7 +221,7 @@ export function createServerSessionEntries(props: {
219221
server: ServerConnection.Key
220222
opened: () => LocalProject[]
221223
stored: () => Project[]
222-
load: (search: string, signal: AbortSignal) => Promise<{ data?: GlobalSession[] }>
224+
load: (search: string, signal: AbortSignal) => Promise<{ data: SessionInfo[] }>
223225
untitled: () => string
224226
category: () => string
225227
}) {
@@ -255,7 +257,8 @@ export function createServerSessionEntries(props: {
255257
return props
256258
.load(search, current.signal)
257259
.then((result) =>
258-
(result.data ?? [])
260+
result.data
261+
.map(normalizeSessionInfo)
259262
.filter((session) => !session.time.archived)
260263
.map((session) => {
261264
const project =
@@ -264,7 +267,7 @@ export function createServerSessionEntries(props: {
264267
id: `session:${props.server}:${session.id}`,
265268
type: "session" as const,
266269
title: session.title || props.untitled(),
267-
description: project ? displayName(project) : session.project?.name || getFilename(session.directory),
270+
description: project ? displayName(project) : getFilename(session.directory),
268271
category: props.category(),
269272
directory: session.directory,
270273
sessionID: session.id,
Collapse file

‎packages/app/src/components/dialog-command-palette-v2.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-command-palette-v2.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function DialogHomeCommandPaletteV2(props: {
8080
opened: serverCtx.projects.list,
8181
stored: () => serverCtx.sync.data.project,
8282
load: (search, signal) =>
83-
serverCtx.sdk.client.experimental.session.list({ roots: true, search, limit: 50 }, { signal }),
83+
serverCtx.sdk.api.session.list({ parentID: null, search, limit: 50 }, { signal }),
8484
untitled: () => language.t("command.session.new"),
8585
category: () => language.t("command.category.session"),
8686
})

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.