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 · anomalyco/opencode@9f299ff

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/app
    • e2e/regression
      • cross-server-tab-close.spec.ts
      • remote-tab-busy.spec.ts
      • session-list-path-loading.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
      • pages
        • layout.tsx
    • 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
+18-4Lines changed: 18 additions & 4 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,19 @@ 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/event" || url.pathname === "/event" || url.pathname === "/api/event") return sse(route)
8889
if (url.pathname === "/global/health") return json(route, { healthy: true })
89-
if (url.pathname === "/session") return json(route, [current])
90+
if (url.pathname === "/api/session") return json(route, { data: [currentSession(current)], cursor: {} })
91+
if (url.pathname === "/api/session/active") return json(route, { data: {} })
92+
if (url.pathname === `/api/session/${current.id}`) return json(route, { data: currentSession(current) })
93+
if (url.pathname === `/api/session/${current.id}/message`) return json(route, { data: [], cursor: {} })
9094
if (url.pathname === `/session/${current.id}`) return json(route, current)
9195
if (/^\/session\/[^/]+$/.test(url.pathname)) return json(route, { name: "NotFoundError" }, 404)
9296
if (url.pathname === `/session/${current.id}/message`) return json(route, [])
9397
if (/^\/session\/[^/]+\/(children|todo|diff)$/.test(url.pathname)) return json(route, [])
9498
if (["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/diff"].includes(url.pathname))
9599
return json(route, [])
96-
if (["/global/config", "/config", "/provider/auth", "/mcp", "/session/status"].includes(url.pathname))
100+
if (["/global/config", "/config", "/provider/auth", "/mcp"].includes(url.pathname))
97101
return json(route, {})
98102
if (url.pathname === "/provider")
99103
return json(route, { all: [], connected: [], default: { providerID: "", modelID: "" } })
@@ -116,7 +120,17 @@ async function mockServers(page: Page, requests: string[]) {
116120
directory: current.directory,
117121
home: current.directory,
118122
})
123+
if (url.pathname === "/api/path")
124+
return json(route, {
125+
state: current.directory,
126+
config: current.directory,
127+
worktree: current.directory,
128+
directory: current.directory,
129+
home: current.directory,
130+
})
119131
if (url.pathname === "/vcs") return json(route, { branch: "main", default_branch: "main" })
132+
if (url.pathname === "/api/vcs")
133+
return json(route, { location: { directory: current.directory }, data: { branch: "main", defaultBranch: "main" } })
120134
return json(route, {})
121135
})
122136
}
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
+20-6Lines changed: 20 additions & 6 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,14 @@ 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/event" || url.pathname === "/event" || url.pathname === "/api/event")
62+
return sse(route, url.pathname === "/api/event")
6163
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])
64+
if (url.pathname === "/api/session/active")
65+
return json(route, { data: url.origin === serverB ? { [sessionB.id]: { type: "running" } } : {} })
66+
if (url.pathname === "/api/session") return json(route, { data: [currentSession(current)], cursor: {} })
67+
if (url.pathname === `/api/session/${current.id}`) return json(route, { data: currentSession(current) })
68+
if (url.pathname === `/api/session/${current.id}/message`) return json(route, { data: [], cursor: {} })
6569
if (url.pathname === `/session/${current.id}`) return json(route, current)
6670
if (/^\/session\/[^/]+$/.test(url.pathname)) return json(route, { name: "NotFoundError" }, 404)
6771
if (url.pathname === `/session/${current.id}/message`) return json(route, [])
@@ -90,7 +94,17 @@ async function mockServers(page: Page) {
9094
directory: current.directory,
9195
home: current.directory,
9296
})
97+
if (url.pathname === "/api/path")
98+
return json(route, {
99+
state: current.directory,
100+
config: current.directory,
101+
worktree: current.directory,
102+
directory: current.directory,
103+
home: current.directory,
104+
})
93105
if (url.pathname === "/vcs") return json(route, { branch: "main", default_branch: "main" })
106+
if (url.pathname === "/api/vcs")
107+
return json(route, { location: { directory: current.directory }, data: { branch: "main", defaultBranch: "main" } })
94108
return json(route, {})
95109
})
96110
}
@@ -104,10 +118,10 @@ function json(route: Route, body: unknown, status = 200) {
104118
})
105119
}
106120

107-
function sse(route: Route) {
121+
function sse(route: Route, current: boolean) {
108122
return route.fulfill({
109123
status: 200,
110124
contentType: "text/event-stream",
111-
body: `data: ${JSON.stringify({ payload: { id: "evt_mock_connected", type: "server.connected", properties: {} } })}\n\n`,
125+
body: current ? 'data: {"id":"evt_connected","type":"server.connected","data":{}}\n\n' : ": ok\n\n",
112126
})
113127
}
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/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.