MCPcopy Create free account
hub / github.com/WJX20/claude-code / registerOutOfProcessTeammateTask

Function registerOutOfProcessTeammateTask

src/tools/shared/spawnMultiAgent.ts:760–834  ·  view source on GitHub ↗

* 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
  },
)

Source from the content-addressed store, hash-verified

758 * matching how in-process teammates are tracked.
759 */
760function 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 }

Callers 2

handleSpawnSplitPaneFunction · 0.85

Calls 7

generateTaskIdFunction · 0.85
createTaskStateBaseFunction · 0.85
getSessionIdFunction · 0.85
registerTaskFunction · 0.85
isPaneBackendFunction · 0.85
getBackendByTypeFunction · 0.85
killPaneMethod · 0.45

Tested by

no test coverage detected