* Register a background task entry for an out-of-process (tmux/iTerm2) teammate. * This makes tmux teammates visible in the background tasks pill and dialog, * matching how in-process teammates are tracked.
(
setAppState: (updater: (prev: AppState) => AppState) => void,
{
teammateId,
sanitizedName,
teamName,
teammateColor,
prompt,
plan_mode_required,
paneId,
insideTmux,
backendType,
toolUseId,
}: {
teammateId: string
sanitizedName: string
teamName: string
teammateColor: string
prompt: string
plan_mode_required?: boolean
paneId: string
insideTmux: boolean
backendType: BackendType
toolUseId?: string
},
)
| 758 | * matching how in-process teammates are tracked. |
| 759 | */ |
| 760 | function registerOutOfProcessTeammateTask( |
| 761 | setAppState: (updater: (prev: AppState) => AppState) => void, |
| 762 | { |
| 763 | teammateId, |
| 764 | sanitizedName, |
| 765 | teamName, |
| 766 | teammateColor, |
| 767 | prompt, |
| 768 | plan_mode_required, |
| 769 | paneId, |
| 770 | insideTmux, |
| 771 | backendType, |
| 772 | toolUseId, |
| 773 | }: { |
| 774 | teammateId: string |
| 775 | sanitizedName: string |
| 776 | teamName: string |
| 777 | teammateColor: string |
| 778 | prompt: string |
| 779 | plan_mode_required?: boolean |
| 780 | paneId: string |
| 781 | insideTmux: boolean |
| 782 | backendType: BackendType |
| 783 | toolUseId?: string |
| 784 | }, |
| 785 | ): void { |
| 786 | const taskId = generateTaskId('in_process_teammate') |
| 787 | const description = `${sanitizedName}: ${prompt.substring(0, 50)}${prompt.length > 50 ? '...' : ''}` |
| 788 | |
| 789 | const abortController = new AbortController() |
| 790 | |
| 791 | const taskState: InProcessTeammateTaskState = { |
| 792 | ...createTaskStateBase( |
| 793 | taskId, |
| 794 | 'in_process_teammate', |
| 795 | description, |
| 796 | toolUseId, |
| 797 | ), |
| 798 | type: 'in_process_teammate', |
| 799 | status: 'running', |
| 800 | identity: { |
| 801 | agentId: teammateId, |
| 802 | agentName: sanitizedName, |
| 803 | teamName, |
| 804 | color: teammateColor, |
| 805 | planModeRequired: plan_mode_required ?? false, |
| 806 | parentSessionId: getSessionId(), |
| 807 | }, |
| 808 | prompt, |
| 809 | abortController, |
| 810 | awaitingPlanApproval: false, |
| 811 | permissionMode: plan_mode_required ? 'plan' : 'default', |
| 812 | isIdle: false, |
| 813 | shutdownRequested: false, |
| 814 | lastReportedToolCount: 0, |
| 815 | lastReportedTokenCount: 0, |
| 816 | pendingUserMessages: [], |
| 817 | } |
no test coverage detected