refactor(server): unify instance httpapi middleware routing
publish-github-action / publish (push) Has been cancelled

Unify declared instance HTTP API endpoints under typed middleware routing, including event streaming and PTY WebSocket connect handling.\n\nPreserve PTY connect compatibility by checking missing PTYs before parsing optional cursor and ticket query fields, with regression coverage.
This commit is contained in:
Kit Langton
2026-05-27 08:45:11 -04:00
committed by GitHub
parent 61001c5dd6
commit 0122f38e09
18 changed files with 340 additions and 195 deletions
@@ -147,6 +147,14 @@ describe("pty HttpApi bridge", () => {
expect(response.status).toBe(404)
})
test("returns 404 for missing PTY websocket before decoding cursor query", async () => {
await using tmp = await tmpdir({ git: true, config: { formatter: false, lsp: false } })
const response = await app().request(`${PtyPaths.connect.replace(":ptyID", PtyID.ascending())}?cursor=a&cursor=b`, {
headers: { "x-opencode-directory": tmp.path },
})
expect(response.status).toBe(404)
})
test("returns typed not found errors for missing PTY HTTP resources", async () => {
await using tmp = await tmpdir({ git: true, config: { formatter: false, lsp: false } })
const headers = { "x-opencode-directory": tmp.path }