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): support current pty transport (#38463) · anomalyco/opencode@ad78ef5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • app
      • V1_API_MIGRATION.md
      • e2e/regression
        • remote-session-settings.spec.ts
        • review-line-comment.spec.ts
        • review-state-persistence.spec.ts
        • review-terminal-stacked.spec.ts
        • terminal-composer-focus.spec.ts
        • terminal-hidden.spec.ts
        • terminal-tab-switch.spec.ts
      • src
        • components
          • settings-general.tsx
          • settings-v2
            • general.tsx
          • terminal.tsx
        • context
          • server-sdk.tsx
          • terminal.tsx
        • pages/session
          • review-tab.tsx
          • session-side-panel.tsx
          • v2
            • review-diff-kinds.ts
            • review-panel-v2.tsx
        • utils
          • diffs.test.ts
          • diffs.ts
          • terminal-websocket-url.test.ts
          • terminal-websocket-url.ts
    • session-ui/src
      • components
        • session-diff.ts
        • session-review.tsx
        • session-turn.tsx
      • context
        • data.tsx
      • v2/components
        • session-review-file-preview-v2.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/V1_API_MIGRATION.md‎

Copy file name to clipboard
+220Lines changed: 220 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
# V1 API Migration Checklist
2+
3+
The app is currently hybrid. In this document, V1 refers to the legacy unprefixed server APIs used by `@opencode-ai/sdk/v2`, despite the SDK package name.
4+
5+
## Events
6+
7+
- [x] Replace `GET /global/event` with `GET /api/event`.
8+
- `src/context/server-sdk.tsx`
9+
- [x] Reduce current granular session and message events into the existing app projections.
10+
- `src/context/server-session-v2-reducer.ts`
11+
- `src/context/server-session.ts`
12+
- [ ] Remove transitional session event dependencies: `session.created`, `session.updated`, `session.diff`, `session.status`, `session.idle`, and `session.error`.
13+
- `src/context/global-sync/event-reducer.ts`
14+
- `src/context/server-session.ts`
15+
- `src/context/notification.tsx`
16+
- `src/pages/session/usage-exceeded-dialogs.tsx`
17+
- [ ] Remove legacy message event compatibility: `message.updated`, `message.removed`, `message.part.updated`, `message.part.removed`, and `message.part.delta`.
18+
- `src/context/global-sync/event-reducer.ts`
19+
- `src/context/server-session.ts`
20+
- [x] Adapt current permission and question events to the existing request model.
21+
- `src/context/global-sync/event-reducer.ts`
22+
- `src/context/permission.tsx`
23+
- [x] Consume current file watcher events.
24+
- `src/context/file.tsx`
25+
- [x] Consume current VCS events.
26+
- `src/context/global-sync/event-reducer.ts`
27+
- `src/pages/session.tsx`
28+
- [x] Consume current `pty.exited` events.
29+
- `src/context/terminal.tsx`
30+
- [ ] Migrate LSP and reference events.
31+
- `src/context/global-sync/event-reducer.ts`
32+
33+
## Sessions
34+
35+
- [x] Replace `GET /session/status` with one server-scoped `GET /api/session/active` snapshot plus V2 execution events.
36+
- `src/context/server-sync.tsx`
37+
- [x] Migrate session listing from `GET /session`.
38+
- `src/context/server-sync.tsx`
39+
- `src/context/directory-sync.ts`
40+
- `src/pages/layout.tsx`
41+
- [x] Migrate the remaining direct session read from `GET /session/:sessionID`.
42+
- `src/components/titlebar.tsx`
43+
- [x] Migrate session updates from `PATCH /session/:sessionID`.
44+
- `src/context/directory-sync.ts`
45+
- `src/context/layout.tsx`
46+
- `src/pages/home.tsx`
47+
- `src/pages/layout.tsx`
48+
- `src/pages/session/timeline/message-timeline.tsx`
49+
- `src/components/titlebar-tab-nav.tsx`
50+
- Renames use `POST /api/session/:sessionID/rename`; archival uses `POST /api/session/:sessionID/archive`.
51+
- [x] Migrate session deletion from `DELETE /session/:sessionID`.
52+
- `src/pages/session/timeline/message-timeline.tsx`
53+
- [x] Remove session diff loading from `GET /session/:sessionID/diff`.
54+
- Historical Session diffs remain unavailable until the current API defines their snapshot semantics.
55+
- [x] Migrate abort from `POST /session/:sessionID/abort`.
56+
- `src/components/prompt-input/submit.ts`
57+
- `src/pages/session/use-session-commands.tsx`
58+
- `src/pages/session.tsx`
59+
- [x] Migrate revert and unrevert from `POST /session/:sessionID/revert` and `POST /session/:sessionID/unrevert`.
60+
- `src/pages/session/use-session-commands.tsx`
61+
- `src/pages/session.tsx`
62+
- [x] Replace `POST /session/:sessionID/summarize` with the current compact API.
63+
- `src/pages/session/use-session-commands.tsx`
64+
- [x] Migrate slash commands from `POST /session/:sessionID/command`.
65+
- `src/components/prompt-input/submit.ts`
66+
- [x] Migrate shell execution from `POST /session/:sessionID/shell`.
67+
- `src/components/prompt-input/submit.ts`
68+
- [x] Migrate session fork from `POST /session/:sessionID/fork`.
69+
- `src/components/dialog-fork.tsx`
70+
- [ ] Migrate sharing from `POST /session/:sessionID/share` and `DELETE /session/:sessionID/share`.
71+
- `src/pages/session/use-session-commands.tsx`
72+
- `src/pages/session/timeline/message-timeline.tsx`
73+
- Blocked: the current API has no sharing contract or implementation.
74+
75+
## Session Compatibility Fallbacks
76+
77+
These calls are retained as fallback adapters. The current production path supplies the current session and message APIs.
78+
79+
- [ ] Remove fallback `GET /session/:sessionID` after compatibility support is unnecessary.
80+
- `src/context/server-session.ts`
81+
- [ ] Remove fallback `GET /session/:sessionID/message` after compatibility support is unnecessary.
82+
- `src/context/server-session.ts`
83+
- [ ] Remove fallback `GET /session/:sessionID/message/:messageID` after compatibility support is unnecessary.
84+
- `src/context/server-session.ts`
85+
86+
## Filesystem
87+
88+
- [ ] Migrate file listing from `GET /file`.
89+
- `src/context/file.tsx`
90+
- [ ] Migrate file reads from `GET /file/content`.
91+
- `src/context/file.tsx`
92+
- `src/pages/session/review-tab.tsx`
93+
- `src/pages/session/v2/review-panel-v2.tsx`
94+
- [x] Migrate path discovery from `GET /path` to `GET /api/path`.
95+
- `src/context/global-sync/bootstrap.ts`
96+
- `src/components/dialog-select-directory.tsx`
97+
- `src/components/dialog-select-directory-v2.tsx`
98+
99+
## Projects And Worktrees
100+
101+
- [x] Migrate project listing from `GET /project` to `GET /api/project`.
102+
- `src/context/global-sync/bootstrap.ts`
103+
- [x] Migrate the current project lookup from `GET /project/current` to `GET /api/project/current`.
104+
- `src/context/global-sync/bootstrap.ts`
105+
- [ ] Migrate Git initialization from `POST /project/git/init`.
106+
- `src/pages/session.tsx`
107+
- [x] Migrate project updates from `PATCH /project/:projectID` to `PATCH /api/project/:projectID`.
108+
- `src/context/layout.tsx`
109+
- `src/components/edit-project.ts`
110+
- `src/pages/layout.tsx`
111+
- [ ] Migrate experimental worktree listing, creation, removal, and reset from `/experimental/worktree`.
112+
- `src/pages/layout.tsx`
113+
- `src/components/prompt-input/submit.ts`
114+
- Listing now uses `GET /api/project/:projectID/directories`; create, removal, and reset remain.
115+
- [ ] Migrate instance disposal from `POST /instance/dispose`.
116+
- `src/pages/layout.tsx`
117+
118+
## VCS
119+
120+
- [x] Migrate repository information from `GET /vcs` to `GET /api/vcs`.
121+
- `src/context/global-sync/bootstrap.ts`
122+
- [x] Migrate diffs from `GET /vcs/diff` to `GET /api/vcs/diff`.
123+
- `src/pages/session.tsx`
124+
- [x] Migrate status from `GET /vcs/status` to `GET /api/vcs/status`.
125+
- `src/pages/layout.tsx`
126+
127+
## Configuration And Authentication
128+
129+
- [ ] Migrate global configuration reads from `GET /global/config`.
130+
- `src/context/global-sync/bootstrap.ts`
131+
- [ ] Migrate directory configuration reads from `GET /config`.
132+
- `src/context/global-sync/bootstrap.ts`
133+
- [ ] Migrate global configuration updates from `PATCH /global/config`.
134+
- `src/context/server-sync.tsx`
135+
- [x] Migrate provider authentication method discovery from `GET /provider/auth` to `GET /api/integration/:integrationID`.
136+
- `src/components/dialog-connect-provider.tsx`
137+
- [x] Migrate built-in provider OAuth authorization and callbacks to `/api/integration/:integrationID/connect/oauth/*`.
138+
- `src/components/dialog-connect-provider.tsx`
139+
- [ ] Migrate remaining credentials from `PUT /auth/:providerID` and `DELETE /auth/:providerID`.
140+
- Built-in provider key connections now use `POST /api/integration/:integrationID/connect/key`.
141+
- `src/components/dialog-connect-provider.tsx`
142+
- `src/components/dialog-custom-provider.tsx`
143+
- `src/components/settings-providers.tsx`
144+
- `src/components/settings-v2/providers.tsx`
145+
- [ ] Migrate global disposal from `POST /global/dispose`.
146+
- `src/components/dialog-connect-provider.tsx`
147+
- `src/components/settings-providers.tsx`
148+
- `src/components/settings-v2/providers.tsx`
149+
150+
## Permissions And Questions
151+
152+
- [x] Migrate permission listing from `GET /permission` to `GET /api/permission/request`.
153+
- `src/context/global-sync/bootstrap.ts`
154+
- `src/context/permission.tsx`
155+
- [x] Migrate permission responses from `/session/:sessionID/permissions/:permissionID`.
156+
- `src/context/permission.tsx`
157+
- `src/pages/session/composer/session-composer-state.ts`
158+
- [x] Migrate question listing from `GET /question` to `GET /api/question/request`.
159+
- `src/context/global-sync/bootstrap.ts`
160+
- [x] Migrate question replies and rejections from `/question/:requestID/*` to `/api/session/:sessionID/question/:requestID/*`.
161+
- `src/pages/session/composer/session-question-dock.tsx`
162+
163+
## Commands, MCP, LSP, And References
164+
165+
- [x] Migrate command listing from `GET /command` to `GET /api/command`.
166+
- `src/context/global-sync/bootstrap.ts`
167+
- `src/context/server-sync.tsx`
168+
- [x] Migrate MCP listing, connection, and disconnection from `/mcp` to `/api/mcp`.
169+
- `src/context/server-sync.tsx`
170+
- [ ] Replace legacy MCP authentication with the Integration OAuth workflow.
171+
- `src/context/server-sync.tsx`
172+
- [x] Migrate experimental resource listing from `GET /experimental/resource` to `GET /api/mcp/resource`.
173+
- `src/context/server-sync.tsx`
174+
- [ ] Migrate LSP status from `GET /lsp`.
175+
- `src/context/server-sync.tsx`
176+
- [x] Move `GET /api/reference` off the legacy generated SDK transport.
177+
- `src/context/global-sync/bootstrap.ts`
178+
179+
## Search
180+
181+
- [x] Migrate global session search from `GET /experimental/session` to `GET /api/session`.
182+
- `src/components/command-palette.ts`
183+
- `src/components/dialog-command-palette-v2.tsx`
184+
185+
## PTY And Terminal
186+
187+
- [x] Migrate PTY creation, reads, updates, and deletion from `/pty` to `/api/pty`.
188+
- `src/context/terminal.tsx`
189+
- `src/components/terminal.tsx`
190+
- [x] Migrate shell listing from `GET /pty/shells` to `GET /api/pty/shells`.
191+
- `src/components/settings-general.tsx`
192+
- `src/components/settings-v2/general.tsx`
193+
- [x] Migrate connection tokens from `POST /pty/:ptyID/connect-token` to `POST /api/pty/:ptyID/connect-token`.
194+
- `src/components/terminal.tsx`
195+
- [x] Migrate the direct WebSocket connection from `/pty/:ptyID/connect` to `/api/pty/:ptyID/connect`.
196+
- `src/components/terminal.tsx`
197+
198+
## Legacy Types And Adapters
199+
200+
These are not V1 network requests, but they keep the UI coupled to V1 data contracts.
201+
202+
- [ ] Replace the current-session-to-legacy-session adapter.
203+
- `src/utils/session.ts`
204+
- [ ] Replace the current-message-to-legacy-message-and-part adapter.
205+
- `src/utils/session-message.ts`
206+
- [ ] Replace current agent, provider, and model adapters to legacy SDK structures.
207+
- `src/context/global-sync/utils.ts`
208+
- [ ] Replace legacy `Session`, `Message`, `Part`, `PermissionRequest`, `QuestionRequest`, `Project`, `FileNode`, `FileDiffInfo`, and `Event` types throughout app state and rendering.
209+
- [ ] Remove the `@opencode-ai/sdk` runtime dependency after all legacy calls and types are gone.
210+
- `package.json`
211+
212+
## Test Infrastructure
213+
214+
- [ ] Replace V1 endpoint mocks with current API mocks.
215+
- `e2e/utils/mock-server.ts`
216+
- [x] Replace `/global/event` and `/event` interception with current event transport handling.
217+
- `e2e/utils/sse-transport.ts`
218+
- [ ] Replace `SessionV1` and legacy SDK fixtures in timeline performance tests.
219+
- `e2e/performance/timeline-stability/fixture.ts`
220+
- [ ] Remove remaining legacy SDK type fixtures from unit and browser tests.
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
+36-5Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { base64Encode } from "@opencode-ai/core/util/encode"
22
import { expect, test, type Page, type Route } from "@playwright/test"
33
import { installSseTransport } from "../utils/sse-transport"
4+
import { currentSession } from "../utils/mock-server"
45

56
const serverA = "http://127.0.0.1:4096"
67
const serverB = "http://127.0.0.1:4097"
@@ -17,7 +18,7 @@ test("session settings use the remote server context", async ({ page }) => {
1718

1819
await page.goto(`/server/${base64Encode(serverB)}/session/${sessionB.id}`)
1920
await expect(page.getByText(sessionB.title).first()).toBeVisible()
20-
await page.keyboard.press(process.platform === "darwin" ? "Meta+," : "Control+,")
21+
await page.keyboard.press("Control+,")
2122

2223
const dialog = page.locator(".settings-v2-dialog")
2324
const autoAccept = dialog.locator('[data-action="settings-auto-accept-permissions"]')
@@ -58,7 +59,7 @@ test("auto-accept responds for an unfocused server session", async ({ page }) =>
5859
const hrefB = `/server/${base64Encode(serverB)}/session/${sessionB.id}`
5960
await page.goto(`/server/${base64Encode(serverA)}/session/${sessionA.id}`)
6061
await expect(page.getByText(sessionA.title).first()).toBeVisible()
61-
await page.keyboard.press(process.platform === "darwin" ? "Meta+," : "Control+,")
62+
await page.keyboard.press("Control+,")
6263
const autoAccept = page.locator(".settings-v2-dialog").locator('[data-action="settings-auto-accept-permissions"]')
6364
await autoAccept.locator('[data-slot="switch-control"]').click()
6465
await expect(autoAccept.getByRole("switch")).toBeChecked()
@@ -180,10 +181,35 @@ async function mockServers(page: Page, permissionRequests: string[], permissionR
180181
return json(route, true)
181182
}
182183
if (requestDirectory && requestDirectory !== directory) return json(route, { name: "InvalidDirectory" }, 500)
183-
if (url.pathname === "/global/event" || url.pathname === "/event") return sse(route)
184+
if (url.pathname === "/global/event" || url.pathname === "/event" || url.pathname === "/api/event") return sse(route)
184185
if (url.pathname === "/global/health") return json(route, { healthy: true })
185-
if (url.pathname === "/session/status") return json(route, {})
186-
if (url.pathname === "/session") return json(route, sessions)
186+
if (url.pathname === "/api/provider" || url.pathname === "/api/model" || url.pathname === "/api/agent")
187+
return json(route, { data: [] })
188+
if (url.pathname === "/api/model/default") return json(route, { data: null })
189+
if (["/api/command", "/api/reference", "/api/permission/request", "/api/question/request"].includes(url.pathname))
190+
return json(route, { location: { directory }, data: [] })
191+
if (url.pathname === "/api/mcp") return json(route, { location: { directory }, data: [] })
192+
if (url.pathname === "/api/mcp/resource")
193+
return json(route, { location: { directory }, data: { resources: [], templates: [] } })
194+
if (url.pathname === "/api/project") {
195+
return json(route, [
196+
{
197+
id: remote ? sessionB.projectID : "project-server-a",
198+
worktree: directory,
199+
vcs: "git",
200+
time: { created: 1, updated: 1 },
201+
sandboxes: [],
202+
},
203+
])
204+
}
205+
if (url.pathname === "/api/project/current")
206+
return json(route, { id: remote ? sessionB.projectID : "project-server-a", directory })
207+
if (url.pathname === "/api/session") return json(route, { data: sessions.map(currentSession), cursor: {} })
208+
if (url.pathname === "/api/session/active") return json(route, { data: {} })
209+
const currentSessionInfo = sessions.find((session) => url.pathname === `/api/session/${session.id}`)
210+
if (currentSessionInfo) return json(route, { data: currentSession(currentSessionInfo) })
211+
if (sessions.some((session) => url.pathname === `/api/session/${session.id}/message`))
212+
return json(route, { data: [], cursor: {} })
187213
const current = sessions.find((session) => url.pathname === `/session/${session.id}`)
188214
if (current) return json(route, current)
189215
if (/^\/session\/[^/]+$/.test(url.pathname)) return json(route, { name: "NotFoundError" }, 404)
@@ -216,7 +242,12 @@ async function mockServers(page: Page, permissionRequests: string[], permissionR
216242
directory,
217243
home: directory,
218244
})
245+
if (url.pathname === "/api/path")
246+
return json(route, { state: directory, config: directory, worktree: directory, directory, home: directory })
219247
if (url.pathname === "/vcs") return json(route, { branch: "main", default_branch: "main" })
248+
if (url.pathname === "/api/vcs")
249+
return json(route, { location: { directory }, data: { branch: "main", defaultBranch: "main" } })
250+
if (url.pathname === "/api/pty/shells") return json(route, { location: { directory }, data: [] })
220251
return json(route, {})
221252
})
222253
}
Collapse file

‎packages/app/e2e/regression/review-line-comment.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/review-line-comment.spec.ts
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ test("stages a submitted line comment in the prompt context", async ({ page }) =
8484
async function openReview(page: Page) {
8585
await page.setViewportSize({ width: 700, height: 900 })
8686
await mockOpenCodeServer(page, {
87+
protocol: "v2",
8788
directory,
8889
project: {
8990
id: "proj_review_line_comment_regression",
@@ -143,9 +144,9 @@ async function openReview(page: Page) {
143144

144145
await page.goto(`/${base64Encode(directory)}/session/${sessionID}`)
145146
await expectSessionTitle(page, title)
146-
const diffResponse = page.waitForResponse((response) => new URL(response.url()).pathname === "/vcs/diff")
147+
const diffResponse = page.waitForResponse((response) => new URL(response.url()).pathname === "/api/vcs/diff")
147148
await page.getByRole("tab", { name: "Changes" }).click()
148-
expect(await (await diffResponse).json()).toHaveLength(1)
149+
expect((await (await diffResponse).json()).data).toHaveLength(1)
149150

150151
const review = page.locator('[data-component="session-review"]')
151152
await expectAppVisible(review)
Collapse file

‎packages/app/e2e/regression/review-state-persistence.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/regression/review-state-persistence.spec.ts
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ async function switchSession(page: Page, title: string) {
6565

6666
async function setup(page: Page) {
6767
await mockOpenCodeServer(page, {
68+
protocol: "v2",
6869
directory,
6970
project: {
7071
id: projectID,
@@ -92,18 +93,20 @@ async function setup(page: Page) {
9293
route.fulfill({
9394
status: 200,
9495
contentType: "application/json",
95-
body: JSON.stringify({ branch: "feature", default_branch: "dev" }),
96+
body: JSON.stringify({ location: { directory }, data: { branch: "feature", defaultBranch: "dev" } }),
9697
}),
9798
)
9899
await page.route("**/vcs/diff**", (route) =>
99100
route.fulfill({
100101
status: 200,
101102
contentType: "application/json",
102-
body: JSON.stringify(
103-
new URL(route.request().url()).searchParams.get("mode") === "branch"
104-
? [diff("src/alpha.ts"), diff("src/beta.ts")]
105-
: [diff("src/alpha.ts"), diff("src/gamma.ts")],
106-
),
103+
body: JSON.stringify({
104+
location: { directory },
105+
data:
106+
new URL(route.request().url()).searchParams.get("mode") === "branch"
107+
? [diff("src/alpha.ts"), diff("src/beta.ts")]
108+
: [diff("src/alpha.ts"), diff("src/gamma.ts")],
109+
}),
107110
}),
108111
)
109112
await page.addInitScript(

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.