Skip to content

Commit ca3d435

Browse files
committed
style: 对齐 apiMachine 两个 RPC handler 缩进
spawn-mobi-session / stop-session 的 handler body(if/const/switch)原本比 const 解构少 4 空格,}) 也少 4(pre-existing 瑕疵,非上 commit 引入)。 对齐到多行参数标准缩进:body 16、}) 12。 纯格式,零逻辑变化(typecheck 0 / lint 0)。
1 parent a0f69ea commit ca3d435

1 file changed

Lines changed: 38 additions & 38 deletions

File tree

packages/cli/src/api/apiMachine.ts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -137,53 +137,53 @@ export class ApiMachineClient {
137137
effort
138138
} = params || {}
139139

140-
if (!directory) {
141-
throw new Error('Directory is required')
142-
}
140+
if (!directory) {
141+
throw new Error('Directory is required')
142+
}
143143

144-
const result = await spawnSession({
145-
directory,
146-
sessionId,
147-
resumeSessionId,
148-
machineId,
149-
approvedNewDirectoryCreation,
150-
agent,
151-
model,
152-
yolo,
153-
token,
154-
sessionType,
155-
worktreeName,
156-
effort
144+
const result = await spawnSession({
145+
directory,
146+
sessionId,
147+
resumeSessionId,
148+
machineId,
149+
approvedNewDirectoryCreation,
150+
agent,
151+
model,
152+
yolo,
153+
token,
154+
sessionType,
155+
worktreeName,
156+
effort
157+
})
158+
159+
switch (result.type) {
160+
case 'success':
161+
return { type: 'success', sessionId: result.sessionId }
162+
case 'requestToApproveDirectoryCreation':
163+
return { type: 'requestToApproveDirectoryCreation', directory: result.directory }
164+
case 'error':
165+
return { type: 'error', errorMessage: result.errorMessage }
166+
default:
167+
// 兜底:未知 result.type
168+
throw new Error(`Unknown result type: ${String((result as { type?: string }).type)}`)
169+
}
157170
})
158171

159-
switch (result.type) {
160-
case 'success':
161-
return { type: 'success', sessionId: result.sessionId }
162-
case 'requestToApproveDirectoryCreation':
163-
return { type: 'requestToApproveDirectoryCreation', directory: result.directory }
164-
case 'error':
165-
return { type: 'error', errorMessage: result.errorMessage }
166-
default:
167-
// 兜底:未知 result.type
168-
throw new Error(`Unknown result type: ${String((result as { type?: string }).type)}`)
169-
}
170-
})
171-
172172
this.rpcHandlerManager.registerHandler<{ sessionId?: string }, { message: string }>(
173173
'stop-session',
174174
(params) => {
175175
const { sessionId } = params || {}
176-
if (!sessionId) {
177-
throw new Error('Session ID is required')
178-
}
176+
if (!sessionId) {
177+
throw new Error('Session ID is required')
178+
}
179179

180-
const success = stopSession(sessionId)
181-
if (!success) {
182-
throw new Error('Session not found or failed to stop')
183-
}
180+
const success = stopSession(sessionId)
181+
if (!success) {
182+
throw new Error('Session not found or failed to stop')
183+
}
184184

185-
return { message: 'Session stopped' }
186-
})
185+
return { message: 'Session stopped' }
186+
})
187187

188188
this.rpcHandlerManager.registerHandler('stop-runner', () => {
189189
setTimeout(() => requestShutdown(), 100)

0 commit comments

Comments
 (0)