Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions packages/opencode/src/server/instance/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,15 @@ export const SessionRoutes = lazy(() =>
async (c) => {
const query = c.req.valid("query")
const params = c.req.valid("param")
const result = await SessionSummary.diff({
sessionID: params.sessionID,
messageID: query.messageID,
})
const result = await AppRuntime.runPromise(
Effect.gen(function* () {
const summary = yield* SessionSummary.Service
return yield* summary.diff({
sessionID: params.sessionID,
messageID: query.messageID,
})
}),
)
return c.json(result)
},
)
Expand Down Expand Up @@ -926,9 +931,14 @@ export const SessionRoutes = lazy(() =>
),
async (c) => {
const params = c.req.valid("param")
const result = await SessionSummary.artifacts({
sessionID: params.sessionID,
})
const result = await AppRuntime.runPromise(
Effect.gen(function* () {
const summary = yield* SessionSummary.Service
return yield* summary.artifacts({
sessionID: params.sessionID,
})
}),
)
return c.json(result)
},
)
Expand Down
6 changes: 5 additions & 1 deletion packages/opencode/test/server/session-runtime-routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ afterEach(async () => {
})

describe("session runtime routes", () => {
test("share, unshare, artifacts, command, and shell routes are wired through the instance router", async () => {
test("share, unshare, diff, artifacts, command, and shell routes are wired through the instance router", async () => {
await using tmp = await tmpdir({ git: true })
await Instance.provide({
directory: tmp.path,
Expand Down Expand Up @@ -70,6 +70,10 @@ describe("session runtime routes", () => {
expect(artifactsRes.status).toBe(200)
expect(Array.isArray(await artifactsRes.json())).toBe(true)

const diffRes = await app.request(`/session/${session.id}/diff`)
expect(diffRes.status).toBe(200)
expect(await diffRes.json()).toHaveProperty("kind")

const commandRes = await app.request(`/session/${session.id}/command`, {
method: "POST",
headers: { "Content-Type": "application/json" },
Expand Down
Loading