(log_0: LogOption)
| 176 | process.exit(1); |
| 177 | } |
| 178 | async function onSelect(log_0: LogOption) { |
| 179 | setResuming(true); |
| 180 | const resumeStart = performance.now(); |
| 181 | const crossProjectCheck = checkCrossProjectResume(log_0, showAllProjects, worktreePaths); |
| 182 | if (crossProjectCheck.isCrossProject) { |
| 183 | if (!crossProjectCheck.isSameRepoWorktree) { |
| 184 | const raw = await setClipboard(crossProjectCheck.command); |
| 185 | if (raw) process.stdout.write(raw); |
| 186 | setCrossProjectCommand(crossProjectCheck.command); |
| 187 | return; |
| 188 | } |
| 189 | } |
| 190 | try { |
| 191 | const result_3 = await loadConversationForResume(log_0, undefined); |
| 192 | if (!result_3) { |
| 193 | throw new Error('Failed to load conversation'); |
| 194 | } |
| 195 | if (feature('COORDINATOR_MODE')) { |
| 196 | /* eslint-disable @typescript-eslint/no-require-imports */ |
| 197 | const coordinatorModule = require('../coordinator/coordinatorMode.js') as typeof import('../coordinator/coordinatorMode.js'); |
| 198 | /* eslint-enable @typescript-eslint/no-require-imports */ |
| 199 | const warning = coordinatorModule.matchSessionMode(result_3.mode); |
| 200 | if (warning) { |
| 201 | /* eslint-disable @typescript-eslint/no-require-imports */ |
| 202 | const { |
| 203 | getAgentDefinitionsWithOverrides, |
| 204 | getActiveAgentsFromList |
| 205 | } = require('../tools/AgentTool/loadAgentsDir.js') as typeof import('../tools/AgentTool/loadAgentsDir.js'); |
| 206 | /* eslint-enable @typescript-eslint/no-require-imports */ |
| 207 | getAgentDefinitionsWithOverrides.cache.clear?.(); |
| 208 | const freshAgentDefs = await getAgentDefinitionsWithOverrides(getOriginalCwd()); |
| 209 | setAppState(prev_0 => ({ |
| 210 | ...prev_0, |
| 211 | agentDefinitions: { |
| 212 | ...freshAgentDefs, |
| 213 | allAgents: freshAgentDefs.allAgents, |
| 214 | activeAgents: getActiveAgentsFromList(freshAgentDefs.allAgents) |
| 215 | } |
| 216 | })); |
| 217 | result_3.messages.push(createSystemMessage(warning, 'warning')); |
| 218 | } |
| 219 | } |
| 220 | if (result_3.sessionId && !forkSession) { |
| 221 | switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname(log_0.fullPath) : null); |
| 222 | await renameRecordingForSession(); |
| 223 | await resetSessionFilePointer(); |
| 224 | restoreCostStateForSession(result_3.sessionId); |
| 225 | } else if (forkSession && result_3.contentReplacements?.length) { |
| 226 | await recordContentReplacement(result_3.contentReplacements); |
| 227 | } |
| 228 | const { |
| 229 | agentDefinition: resolvedAgentDef |
| 230 | } = restoreAgentFromSession(result_3.agentSetting, mainThreadAgentDefinition, agentDefinitions); |
| 231 | setAppState(prev_1 => ({ |
| 232 | ...prev_1, |
| 233 | agent: resolvedAgentDef?.agentType |
| 234 | })); |
| 235 | if (feature('COORDINATOR_MODE')) { |
no test coverage detected