diff options
| author | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-26 15:50:09 +0000 |
|---|---|---|
| committer | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-26 15:50:09 +0000 |
| commit | daff119fe453207cdb2c14878d87e407dbd05de0 (patch) | |
| tree | a32fff7959cdd8ad4cf556118923ca04ebdd87e1 /packages | |
| parent | e0d1ff42c0df9041a204cfb0755a0d259b35de3c (diff) | |
| download | opencode-daff119fe453207cdb2c14878d87e407dbd05de0.tar.gz opencode-daff119fe453207cdb2c14878d87e407dbd05de0.zip | |
chore: generate
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/specs/effect/http-api.md | 34 | ||||
| -rw-r--r-- | packages/opencode/test/server/httpapi-session.test.ts | 46 |
2 files changed, 52 insertions, 28 deletions
diff --git a/packages/opencode/specs/effect/http-api.md b/packages/opencode/specs/effect/http-api.md index fc17feb5b..f6a0c06a5 100644 --- a/packages/opencode/specs/effect/http-api.md +++ b/packages/opencode/specs/effect/http-api.md @@ -170,23 +170,23 @@ Use raw Effect HTTP routes where `HttpApi` does not fit. The goal is deleting Ho ## Current Route Status -| Area | Status | Notes | -| ------------------------- | ----------------- | ---------------------------------------------------------------------------------------- | -| `question` | `bridged` | `GET /question`, reply, reject | -| `permission` | `bridged` | list and reply | -| `provider` | `bridged` | list, auth, OAuth authorize/callback | -| `config` | `bridged` | read, providers, update | -| `project` | `bridged` | list, current, git init, update | -| `file` | `bridged` partial | find text/file/symbol, list/content/status | -| `mcp` | `bridged` | status, add, OAuth, connect/disconnect | -| `workspace` | `bridged` | adaptor/list/status/create/remove/session-restore | -| top-level instance routes | `bridged` | path, vcs, command, agent, skill, lsp, formatter, dispose | -| experimental JSON routes | `bridged` | console, tool, worktree list/mutations, global session list, resource list | -| `session` | `bridged` partial | read routes; lifecycle, message mutations, streaming remain | -| `sync` | `bridged` | start/replay/history | -| `event` | `special` | SSE | -| `pty` | `special` | websocket | -| `tui` | `special` | UI bridge | +| Area | Status | Notes | +| ------------------------- | ----------------- | -------------------------------------------------------------------------- | +| `question` | `bridged` | `GET /question`, reply, reject | +| `permission` | `bridged` | list and reply | +| `provider` | `bridged` | list, auth, OAuth authorize/callback | +| `config` | `bridged` | read, providers, update | +| `project` | `bridged` | list, current, git init, update | +| `file` | `bridged` partial | find text/file/symbol, list/content/status | +| `mcp` | `bridged` | status, add, OAuth, connect/disconnect | +| `workspace` | `bridged` | adaptor/list/status/create/remove/session-restore | +| top-level instance routes | `bridged` | path, vcs, command, agent, skill, lsp, formatter, dispose | +| experimental JSON routes | `bridged` | console, tool, worktree list/mutations, global session list, resource list | +| `session` | `bridged` partial | read routes; lifecycle, message mutations, streaming remain | +| `sync` | `bridged` | start/replay/history | +| `event` | `special` | SSE | +| `pty` | `special` | websocket | +| `tui` | `special` | UI bridge | ## Full Route Checklist diff --git a/packages/opencode/test/server/httpapi-session.test.ts b/packages/opencode/test/server/httpapi-session.test.ts index 42cbb8495..4c4663d71 100644 --- a/packages/opencode/test/server/httpapi-session.test.ts +++ b/packages/opencode/test/server/httpapi-session.test.ts @@ -86,23 +86,47 @@ describe("session HttpApi", () => { const message = await createTextMessage(tmp.path, parent.id, "hello") await createTextMessage(tmp.path, parent.id, "world") - expect((await json<Session.Info[]>(await app().request(`${SessionPaths.list}?roots=true`, { headers }))).map((item) => item.id)).toContain(parent.id) + expect( + (await json<Session.Info[]>(await app().request(`${SessionPaths.list}?roots=true`, { headers }))).map( + (item) => item.id, + ), + ).toContain(parent.id) expect(await json<Record<string, unknown>>(await app().request(SessionPaths.status, { headers }))).toEqual({}) - expect(await json<Session.Info>(await app().request(pathFor(SessionPaths.get, { sessionID: parent.id }), { headers }))).toMatchObject({ id: parent.id, title: "parent" }) - - expect((await json<Session.Info[]>(await app().request(pathFor(SessionPaths.children, { sessionID: parent.id }), { headers }))).map((item) => item.id)).toEqual([child.id]) - - expect(await json<unknown[]>(await app().request(pathFor(SessionPaths.todo, { sessionID: parent.id }), { headers }))).toEqual([]) - - expect(await json<unknown[]>(await app().request(pathFor(SessionPaths.diff, { sessionID: parent.id }), { headers }))).toEqual([]) - - const messages = await app().request(`${pathFor(SessionPaths.messages, { sessionID: parent.id })}?limit=1`, { headers }) + expect( + await json<Session.Info>(await app().request(pathFor(SessionPaths.get, { sessionID: parent.id }), { headers })), + ).toMatchObject({ id: parent.id, title: "parent" }) + + expect( + ( + await json<Session.Info[]>( + await app().request(pathFor(SessionPaths.children, { sessionID: parent.id }), { headers }), + ) + ).map((item) => item.id), + ).toEqual([child.id]) + + expect( + await json<unknown[]>(await app().request(pathFor(SessionPaths.todo, { sessionID: parent.id }), { headers })), + ).toEqual([]) + + expect( + await json<unknown[]>(await app().request(pathFor(SessionPaths.diff, { sessionID: parent.id }), { headers })), + ).toEqual([]) + + const messages = await app().request(`${pathFor(SessionPaths.messages, { sessionID: parent.id })}?limit=1`, { + headers, + }) const messagePage = await json<MessageV2.WithParts[]>(messages) expect(messages.headers.get("x-next-cursor")).toBeTruthy() expect(messagePage[0]?.parts[0]).toMatchObject({ type: "text" }) - expect(await json<MessageV2.WithParts>(await app().request(pathFor(SessionPaths.message, { sessionID: parent.id, messageID: message.id }), { headers }))).toMatchObject({ info: { id: message.id } }) + expect( + await json<MessageV2.WithParts>( + await app().request(pathFor(SessionPaths.message, { sessionID: parent.id, messageID: message.id }), { + headers, + }), + ), + ).toMatchObject({ info: { id: message.id } }) }) }) |
