Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

781 B
Raw Blame
import { useEffect } from 'react'
import { capabilityAgentId, hasUsage, type AgentId } from '@shared/agents/config'
import type { ContextApi } from '@shared/types'

/** Canvas and board co-attach share the same account/agent-aware mount-time read. The backend
 * resolves on the owning host; this capability gate must never enable Claude's search resolver. */
export function useContextEnsure(
  api: ContextApi, nodeId: string, agentId: AgentId | undefined, sessionId: string | null | undefined,
  cwd: string | undefined, accountId: string | undefined
): void {
  useEffect(() => {
    if (agentId && hasUsage(agentId) && sessionId) {
      api.ensure(sessionId, cwd, accountId, nodeId, capabilityAgentId(agentId))
    }
  }, [api, nodeId, agentId, sessionId, cwd, accountId])
}