authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-27 09:18:11-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-05 23:00:41-08:00
log87abc22f39afcae72ab4a16e3b65c2be427ec851
treec8180738754cac7f559e7f758b93921bedb352f2
parent441582dbb89228390d288fe9b141fe4730c1ca57

unnecessary catch


1 files changed, 25 insertions(+), 25 deletions(-)

apps/server/src/provider/Layers/ClaudeCodeAdapter.ts+25-25
......@@ -28,10 +28,7 @@ import {
2828 type ProviderAdapterError,
2929} from "../Errors.ts";
3030import { type ProviderThreadSnapshot } from "../Services/ProviderAdapter.ts";
31import {
32 ClaudeCodeAdapter,
33 type ClaudeCodeAdapterShape,
34} from "../Services/ClaudeCodeAdapter.ts";
31import { ClaudeCodeAdapter, type ClaudeCodeAdapterShape } from "../Services/ClaudeCodeAdapter.ts";
3532
3633const PROVIDER = "claudeCode" as const;
3734
......@@ -188,10 +185,7 @@ const makeClaudeCodeAdapter = (options?: ClaudeCodeAdapterLiveOptions) =>
188185 }
189186 return makeUnavailableRuntime();
190187 }),
191 (runtime) =>
192 runtime.stopAll().pipe(
193 Effect.orElseSucceed(() => undefined),
194 ),
188 (runtime) => runtime.stopAll(),
195189 );
196190
197191 const startSession: ClaudeCodeAdapterShape["startSession"] = (input) => {
......@@ -219,19 +213,19 @@ const makeClaudeCodeAdapter = (options?: ClaudeCodeAdapterLiveOptions) =>
219213 };
220214
221215 const sendTurn: ClaudeCodeAdapterShape["sendTurn"] = (input) =>
222 runtime.sendTurn(input).pipe(
223 Effect.mapError((cause) => toRequestError(input.sessionId, "turn/start", cause)),
224 );
216 runtime
217 .sendTurn(input)
218 .pipe(Effect.mapError((cause) => toRequestError(input.sessionId, "turn/start", cause)));
225219
226220 const interruptTurn: ClaudeCodeAdapterShape["interruptTurn"] = (sessionId, turnId) =>
227 runtime.interruptTurn(sessionId, turnId).pipe(
228 Effect.mapError((cause) => toRequestError(sessionId, "turn/interrupt", cause)),
229 );
221 runtime
222 .interruptTurn(sessionId, turnId)
223 .pipe(Effect.mapError((cause) => toRequestError(sessionId, "turn/interrupt", cause)));
230224
231225 const readThread: ClaudeCodeAdapterShape["readThread"] = (sessionId) =>
232 runtime.readThread(sessionId).pipe(
233 Effect.mapError((cause) => toRequestError(sessionId, "thread/read", cause)),
234 );
226 runtime
227 .readThread(sessionId)
228 .pipe(Effect.mapError((cause) => toRequestError(sessionId, "thread/read", cause)));
235229
236230 const rollbackThread: ClaudeCodeAdapterShape["rollbackThread"] = (sessionId, numTurns) => {
237231 if (!Number.isInteger(numTurns) || numTurns < 1) {
......@@ -244,9 +238,9 @@ const makeClaudeCodeAdapter = (options?: ClaudeCodeAdapterLiveOptions) =>
244238 );
245239 }
246240
247 return runtime.rollbackThread(sessionId, numTurns).pipe(
248 Effect.mapError((cause) => toRequestError(sessionId, "thread/rollback", cause)),
249 );
241 return runtime
242 .rollbackThread(sessionId, numTurns)
243 .pipe(Effect.mapError((cause) => toRequestError(sessionId, "thread/rollback", cause)));
250244 };
251245
252246 const respondToRequest: ClaudeCodeAdapterShape["respondToRequest"] = (
......@@ -254,15 +248,21 @@ const makeClaudeCodeAdapter = (options?: ClaudeCodeAdapterLiveOptions) =>
254248 requestId,
255249 decision,
256250 ) =>
257 runtime.respondToRequest(sessionId, requestId, decision).pipe(
258 Effect.mapError((cause) => toRequestError(sessionId, "item/requestApproval/decision", cause)),
259 );
251 runtime
252 .respondToRequest(sessionId, requestId, decision)
253 .pipe(
254 Effect.mapError((cause) =>
255 toRequestError(sessionId, "item/requestApproval/decision", cause),
256 ),
257 );
260258
261 const stopSession: ClaudeCodeAdapterShape["stopSession"] = (sessionId) => runtime.stopSession(sessionId);
259 const stopSession: ClaudeCodeAdapterShape["stopSession"] = (sessionId) =>
260 runtime.stopSession(sessionId);
262261
263262 const listSessions: ClaudeCodeAdapterShape["listSessions"] = () => runtime.listSessions();
264263
265 const hasSession: ClaudeCodeAdapterShape["hasSession"] = (sessionId) => runtime.hasSession(sessionId);
264 const hasSession: ClaudeCodeAdapterShape["hasSession"] = (sessionId) =>
265 runtime.hasSession(sessionId);
266266
267267 const stopAll: ClaudeCodeAdapterShape["stopAll"] = () => runtime.stopAll();
268268