Skip to content

Commit f93bc46

Browse files
committed
refactor(core): migrate MessageV2 part leaves + ToolPart to Effect Schema
Migrates all 13 part leaf schemas and the FilePartSource union to Effect Schema with derived .zod compatibility. ToolPart also moves, now referencing ToolState directly via Schema.Struct. The Part discriminated union stays Zod in this slice (migrates next). Also exports Schema-backed {Text,File,Agent,Subtask}PartInput with matching identifiers so prompt.ts PromptInput can reference them via .zod without re-inlining the part shapes. CommandInput keeps its (smaller) FilePart shape inlined since the SDK does not name that one with a $ref.
1 parent df0c1f6 commit f93bc46

3 files changed

Lines changed: 325 additions & 240 deletions

File tree

packages/opencode/src/server/routes/instance/session.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,9 @@ export const SessionRoutes = lazy(() =>
882882
const msg = await runRequest(
883883
"SessionRoutes.prompt",
884884
c,
885-
SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID })),
885+
SessionPrompt.Service.use((svc) =>
886+
svc.prompt({ ...body, sessionID } as unknown as SessionPrompt.PromptInput),
887+
),
886888
)
887889
void stream.write(JSON.stringify(msg))
888890
})
@@ -915,7 +917,7 @@ export const SessionRoutes = lazy(() =>
915917
void runRequest(
916918
"SessionRoutes.prompt_async",
917919
c,
918-
SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID })),
920+
SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID } as unknown as SessionPrompt.PromptInput)),
919921
).catch((err) => {
920922
log.error("prompt_async failed", { sessionID, error: err })
921923
void Bus.publish(Session.Event.Error, {

0 commit comments

Comments
 (0)