File tree Expand file tree Collapse file tree
packages/opencode/src/server/routes/instance/httpapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,9 +139,10 @@ export const mcpHandlers = Layer.unwrap(
139139 } )
140140
141141 const add = Effect . fn ( "McpHttpApi.add" ) ( function * ( ctx : { payload : typeof AddPayload . Type } ) {
142- const payload = Schema . decodeUnknownSync ( AddPayload ) ( ctx . payload )
143- const result = ( yield * mcp . add ( payload . name , payload . config ) ) . status
144- return Schema . decodeUnknownSync ( StatusMap ) ( "status" in result ? { [ payload . name ] : result } : result )
142+ const result = ( yield * mcp . add ( ctx . payload . name , ctx . payload . config ) ) . status
143+ return yield * Schema . decodeUnknownEffect ( StatusMap ) ( "status" in result ? { [ ctx . payload . name ] : result } : result ) . pipe (
144+ Effect . mapError ( ( ) => new HttpApiError . BadRequest ( { } ) ) ,
145+ )
145146 } )
146147
147148 const authStart = Effect . fn ( "McpHttpApi.authStart" ) ( function * ( ctx : { params : { name : string } } ) {
Original file line number Diff line number Diff line change @@ -96,8 +96,7 @@ export const syncHandlers = Layer.unwrap(
9696 } )
9797
9898 const replay = Effect . fn ( "SyncHttpApi.replay" ) ( function * ( ctx : { payload : typeof ReplayPayload . Type } ) {
99- const payload = Schema . decodeUnknownSync ( ReplayPayload ) ( ctx . payload )
100- const events : SyncEvent . SerializedEvent [ ] = payload . events . map ( ( event ) => ( {
99+ const events : SyncEvent . SerializedEvent [ ] = ctx . payload . events . map ( ( event ) => ( {
101100 id : event . id ,
102101 aggregateID : event . aggregateID ,
103102 seq : event . seq ,
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ export const workspaceHandlers = Layer.unwrap(
123123 return yield * Effect . promise ( ( ) =>
124124 Instance . restore ( instance , ( ) =>
125125 Workspace . create ( {
126- ...Schema . decodeUnknownSync ( CreatePayload ) ( ctx . payload ) ,
126+ ...ctx . payload ,
127127 projectID : instance . project . id ,
128128 } ) ,
129129 ) ,
You can’t perform that action at this time.
0 commit comments