(
private readonly config: Config,
private readonly historyService: HistoryService,
private readonly aiService: AIService,
private readonly workspaceService: WorkspaceService,
private readonly initStateManager: InitStateManager,
private readonly opResolver?: ExternalSecretResolver,
private readonly sessionUsageService?: SessionUsageService,
private readonly workspaceGoalService?: WorkspaceGoalService
)
| 1506 | } |
| 1507 | |
| 1508 | constructor( |
| 1509 | private readonly config: Config, |
| 1510 | private readonly historyService: HistoryService, |
| 1511 | private readonly aiService: AIService, |
| 1512 | private readonly workspaceService: WorkspaceService, |
| 1513 | private readonly initStateManager: InitStateManager, |
| 1514 | private readonly opResolver?: ExternalSecretResolver, |
| 1515 | private readonly sessionUsageService?: SessionUsageService, |
| 1516 | private readonly workspaceGoalService?: WorkspaceGoalService |
| 1517 | ) { |
| 1518 | this.taskHandleStore = new TaskHandleStore(config); |
| 1519 | this.terminalAttentionStore = new TerminalAttentionStore(config); |
| 1520 | this.gitPatchArtifactService = new GitPatchArtifactService(config); |
| 1521 | |
| 1522 | this.aiService.on("stream-end", (payload: unknown) => { |
| 1523 | if (!isStreamEndEvent(payload)) return; |
| 1524 | |
| 1525 | void this.workspaceEventLocks |
| 1526 | .withLock(payload.workspaceId, async () => { |
| 1527 | await this.handleStreamEnd(payload); |
| 1528 | }) |
| 1529 | .catch((error: unknown) => { |
| 1530 | log.error("TaskService.handleStreamEnd failed", { error }); |
| 1531 | }); |
| 1532 | }); |
| 1533 | |
| 1534 | this.aiService.on("stream-abort", (payload: unknown) => { |
| 1535 | if (!isStreamAbortEvent(payload)) return; |
| 1536 | |
| 1537 | void this.workspaceEventLocks |
| 1538 | .withLock(payload.workspaceId, async () => { |
| 1539 | await this.handleStreamAbort(payload); |
| 1540 | }) |
| 1541 | .catch((error: unknown) => { |
| 1542 | log.error("TaskService.handleStreamAbort failed", { error }); |
| 1543 | }); |
| 1544 | }); |
| 1545 | |
| 1546 | this.aiService.on("error", (payload: unknown) => { |
| 1547 | if (!isErrorEvent(payload)) return; |
| 1548 | |
| 1549 | void this.workspaceEventLocks |
| 1550 | .withLock(payload.workspaceId, async () => { |
| 1551 | await this.handleTaskStreamError(payload); |
| 1552 | }) |
| 1553 | .catch((error: unknown) => { |
| 1554 | log.error("TaskService.handleTaskStreamError failed", { error }); |
| 1555 | }); |
| 1556 | }); |
| 1557 | } |
| 1558 | |
| 1559 | // Prefer per-agent settings so tasks inherit the correct agent defaults; |
| 1560 | // fall back to legacy workspace settings for older configs. |
nothing calls this directly
no test coverage detected