/**
 * Claude Code transport — provider-specific adapter wrapping the current SendMessage pattern.
 *
 * This is the Phase 0 transport that maps the AgentTransport interface onto
 * Claude Code's native Agent SDK tools (SendMessage, TaskUpdate, etc.).
 *
 * It serves as the default transport when SignalDock is not enabled,
 * preserving backward compatibility with the existing orchestration model.
 *
 * @task T5671
 */
/**
 * Claude Code transport — wraps the current provider-specific messaging.
 *
 * Registration and deregistration are no-ops because the Claude Code Agent SDK
 * manages agent identity internally. Message sending is logged but actual
 * delivery happens through the SDK's SendMessage tool at the agent level.
 */
export class ClaudeCodeTransport {
    name = 'claude-code';
    agents = new Map();
    conversations = new Map();
    messages = [];
    async register(name, agentClass, privacyTier) {
        const registration = {
            agentId: `cc-${name}`,
            name,
            agentClass,
            privacyTier,
        };
        this.agents.set(registration.agentId, registration);
        return registration;
    }
    async deregister(agentId) {
        this.agents.delete(agentId);
    }
    async send(fromAgentId, toAgentId, content, conversationId) {
        const resolvedConversationId = conversationId ?? `cc-conv-${fromAgentId}-${toAgentId}`;
        const now = new Date().toISOString();
        const messageId = `cc-msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
        const message = {
            id: messageId,
            conversationId: resolvedConversationId,
            fromAgentId,
            toAgentId,
            content,
            contentType: 'text',
            status: 'delivered',
            createdAt: now,
            deliveredAt: now,
        };
        this.messages.push(message);
        return {
            messageId,
            conversationId: resolvedConversationId,
            status: 'delivered',
        };
    }
    async poll(agentId, since) {
        return this.messages.filter((m) => {
            if (m.toAgentId !== agentId)
                return false;
            if (since && m.createdAt <= since)
                return false;
            return true;
        });
    }
    async heartbeat(agentId) {
        const agent = this.agents.get(agentId);
        if (agent) {
            this.agents.set(agentId, { ...agent });
        }
    }
    async createConversation(participants, visibility) {
        const now = new Date().toISOString();
        const id = `cc-conv-${participants.sort().join('-')}`;
        const existing = this.conversations.get(id);
        if (existing)
            return existing;
        const conversation = {
            id,
            participants,
            visibility: visibility ?? 'private',
            messageCount: 0,
            createdAt: now,
            updatedAt: now,
        };
        this.conversations.set(id, conversation);
        return conversation;
    }
    async getAgent(agentId) {
        const registration = this.agents.get(agentId);
        if (!registration)
            return null;
        const now = new Date().toISOString();
        return {
            id: registration.agentId,
            name: registration.name,
            agentClass: registration.agentClass,
            privacyTier: registration.privacyTier,
            status: 'online',
            createdAt: now,
            updatedAt: now,
        };
    }
}
//# sourceMappingURL=claude-code-transport.js.map