(taskId: string, feedback: string)
| 178 | |
| 179 | // Continue an existing task |
| 180 | async function continueTask(taskId: string, feedback: string) { |
| 181 | console.log(`\n${colors.cyan}Continuing task:${colors.reset}`); |
| 182 | console.log(` Task: ${colors.bright}${taskId}${colors.reset}`); |
| 183 | |
| 184 | try { |
| 185 | // Load session info |
| 186 | const info = await loadSessionInfo(taskId); |
| 187 | if (!info) { |
| 188 | console.error(`${colors.red}❌ No session found for task: ${taskId}${colors.reset}`); |
| 189 | console.log(`\nHint: Use ${colors.cyan}monitor-auto${colors.reset} to see running tasks`); |
| 190 | return { success: false, taskId }; |
| 191 | } |
| 192 | |
| 193 | console.log(` Session: ${colors.dim}${info.sessionName}${colors.reset}`); |
| 194 | |
| 195 | // Load the session |
| 196 | const s = await session.load(info.sessionName); |
| 197 | |
| 198 | // Create new log file for continuation |
| 199 | const logFile = path.join(LOG_DIR, `${info.sessionName}-continue-${Date.now()}.log`); |
| 200 | |
| 201 | console.log(`${colors.yellow}Continuing session...${colors.reset}`); |
| 202 | |
| 203 | // Continue with feedback |
| 204 | const result = await s.detached(feedback, { |
| 205 | logFile, |
| 206 | stream: true, |
| 207 | outputFormat: 'stream-json', |
| 208 | }); |
| 209 | |
| 210 | if (result.success) { |
| 211 | console.log(`${colors.green}✅ Task continued successfully${colors.reset}`); |
| 212 | if (result.pid) { |
| 213 | console.log(` PID: ${result.pid}`); |
| 214 | } |
| 215 | console.log(` Monitor with: ${colors.cyan}monitor-auto${colors.reset}`); |
| 216 | |
| 217 | return { success: true, taskId, sessionName: info.sessionName }; |
| 218 | } else { |
| 219 | console.error(`${colors.red}❌ Failed to continue task: ${result.error}${colors.reset}`); |
| 220 | return { success: false, taskId, error: result.error }; |
| 221 | } |
| 222 | } catch (error) { |
| 223 | console.error(`${colors.red}❌ Error continuing task:${colors.reset}`, error); |
| 224 | return { success: false, taskId, error }; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | // Main execution |
| 229 | async function main() { |
no test coverage detected
searching dependent graphs…