export interface SecureChannelConfig {
    inviteToken: string;
    dataDir: string;
    apiUrl: string;
    agentName?: string;
    agentVersion?: string;
    platform?: string;
    maxHistorySize?: number;
    webhookUrl?: string;
    httpPort?: number;
    onMessage?: (plaintext: string, metadata: MessageMetadata) => void;
    onStateChange?: (state: ChannelState) => void;
    onA2AMessage?: (msg: A2AMessage) => void;
    /** Called when an A2A channel becomes ready (approved or activated). */
    onA2AChannelReady?: (info: {
        channelId: string;
        peerHubAddress: string;
        role: "creator" | "member";
        conversationId: string;
        topic?: string;
    }) => void;
    /** Enable client-side policy scanning. If true, rules are fetched on connect. */
    enableScanning?: boolean;
    /** If set, auto-backup encrypted state to server after state changes. */
    backupCode?: string;
}
export type ChannelState = "idle" | "enrolling" | "polling" | "activating" | "connecting" | "ready" | "disconnected" | "error";
export interface AttachmentData {
    filename: string;
    mime: string;
    size: number;
    filePath: string;
    /** Base64-encoded decrypted content (for images passed to LLM vision) */
    base64?: string;
    /** Extracted text content (for text-based files) */
    textContent?: string;
}
export interface MessageMetadata {
    messageId: string;
    conversationId: string;
    timestamp: string;
    topicId?: string;
    attachment?: AttachmentData;
    spanId?: string;
    parentSpanId?: string;
    messageType?: string;
    priority?: string;
    envelopeVersion?: string;
    /** Set when the message originated from a multi-agent room */
    roomId?: string;
    /** Device ID of the sender (room messages only) */
    senderDeviceId?: string;
    /** Whether the sender is an agent (vs owner) — room messages only */
    senderIsAgent?: boolean;
    /** Display name of the sender (room messages only) */
    senderName?: string;
    /** Human-readable room name (room messages only) */
    roomName?: string;
    /** Set when this message is a coordinator task (AES job dispatch) */
    coordinatorTask?: boolean;
    /** Coordinator job ID */
    jobId?: string;
    /** Coordinator task ID */
    taskId?: string;
    /** Coordinator job phase */
    phase?: string;
    /** Coordinator task timeout in seconds */
    timeoutSec?: number;
}
export interface SendOptions {
    /** Target a specific conversation instead of broadcasting to all sessions */
    conversationId?: string;
    topicId?: string;
    messageType?: string;
    priority?: string;
    parentSpanId?: string;
    metadata?: Record<string, unknown>;
}
export interface DecisionOption {
    option_id: string;
    label: string;
    risk_level: "low" | "medium" | "high" | "critical";
    is_default?: boolean;
}
export interface ContextRef {
    type: string;
    uri: string;
    label: string;
}
export interface DecisionRequest {
    title: string;
    description?: string;
    options: DecisionOption[];
    context_refs?: ContextRef[];
    deadline?: string;
    auto_action?: {
        option_id: string;
        trigger: string;
        description?: string;
    };
}
export interface DecisionResponse {
    decision_id: string;
    selected_option_id?: string;
    resolved_at?: string;
    action?: "approve" | "deny" | "defer";
    defer_until?: string;
    defer_reason?: string;
}
export interface HistoryEntry {
    sender: "owner" | "agent";
    text: string;
    ts: string;
    topicId?: string;
}
export interface DeviceSession {
    ownerDeviceId: string;
    ratchetState: string;
    activated?: boolean;
    epoch?: number;
}
export interface PersistedState {
    deviceId: string;
    deviceJwt: string;
    primaryConversationId: string;
    sessions: Record<string, DeviceSession>;
    identityKeypair: {
        publicKey: string;
        privateKey: string;
    };
    ephemeralKeypair: {
        publicKey: string;
        privateKey: string;
    };
    fingerprint: string;
    lastMessageTimestamp?: string;
    messageHistory?: HistoryEntry[];
    topics?: Array<{
        id: string;
        name: string;
        isDefault: boolean;
    }>;
    defaultTopicId?: string;
    groupId?: string;
    hubAddress?: string;
    hubId?: string;
    agentHubId?: string;
    agentRole?: "lead" | "peer";
    ownerHubId?: string;
    /** A2A channel state (agent-to-agent communication) */
    a2aChannels?: Record<string, {
        channelId: string;
        conversationId: string;
        role?: "creator" | "member";
        topic?: string;
        mlsGroupId?: string;
        participants: Array<{
            hubId: string;
            hubAddress: string;
            status: "invited" | "active" | "left" | "removed";
        }>;
    }>;
    /** Outbound messages queued while disconnected */
    outboundQueue?: Array<{
        convId: string;
        headerBlob: string;
        ciphertext: string;
        messageGroupId: string;
        topicId?: string;
    }>;
    /** Multi-agent room state */
    rooms?: Record<string, RoomState>;
    /** Last inbound room ID for sticky room routing across restarts */
    lastInboundRoomId?: string;
    /** Persisted message dedup IDs — survives restarts to prevent double-decrypt */
    seenMessageIds?: string[];
    /** Persisted A2A message dedup IDs */
    seenA2AMessageIds?: string[];
    /** Shadow mode skill configurations (synced from backend via WS) */
    shadowSkills?: Record<string, {
        sessionId: string;
        autonomyLevel: "shadow" | "supervised" | "autonomous";
        decisionClass: string;
    }>;
    /** MLS group state for 1:1 conversations (conversationId -> {mlsGroupId}) */
    mlsConversations?: Record<string, {
        mlsGroupId: string;
    }>;
}
/** Legacy state format for backward compatibility */
export interface LegacyPersistedState {
    deviceId: string;
    deviceJwt: string;
    conversationId: string;
    identityKeypair: {
        publicKey: string;
        privateKey: string;
    };
    ephemeralKeypair: {
        publicKey: string;
        privateKey: string;
    };
    fingerprint: string;
    ratchetState: string;
    lastMessageTimestamp?: string;
}
export interface RoomMemberInfo {
    deviceId: string;
    entityType: string;
    displayName: string;
    identityPublicKey?: string;
    ephemeralPublicKey?: string;
}
export interface RoomConversationInfo {
    id: string;
    participantA: string;
    participantB: string;
}
export interface RoomInfo {
    roomId: string;
    name: string;
    members: RoomMemberInfo[];
    conversationIds: string[];
}
export interface RoomState {
    roomId: string;
    name: string;
    conversationIds: string[];
    members: RoomMemberInfo[];
    /** MLS group identifier (set when room uses MLS encryption) */
    mlsGroupId?: string;
    /** ISO timestamp of last MLS message received in this room (for sync catch-up) */
    lastMlsMessageTs?: string;
}
export interface HeartbeatStatus {
    agent_status: string;
    current_task: string;
}
export interface StatusAlert {
    title: string;
    message: string;
    severity: "info" | "warning" | "error" | "critical";
    detail?: string;
    detailFormat?: "markdown" | "json" | "text";
    category?: "performance" | "security" | "error" | "info";
}
export interface RoomParticipantEvent {
    roomId: string;
    participant: {
        deviceId: string;
        participantType: "human" | "agent";
        displayName?: string;
    };
}
export interface A2AChannelParticipant {
    id: string;
    hub_id: string;
    hub_address: string;
    agent_name: string;
    tenant_id: string;
    device_id: string | null;
    role: "creator" | "member";
    status: "invited" | "active" | "left" | "removed";
    observer_enabled: boolean;
    joined_at: string | null;
    left_at: string | null;
}
export interface A2AChannel {
    channelId: string;
    creator_hub_id: string;
    conversationId: string | null;
    status: "pending" | "approved" | "active" | "rejected" | "revoked";
    createdAt: string;
    max_participants: number;
    participant_count: number;
    participants: A2AChannelParticipant[];
    topic?: string;
}
export interface A2AMessage {
    text: string;
    fromHubAddress: string;
    channelId: string;
    conversationId: string;
    parentSpanId?: string;
    timestamp: string;
}
/** Explicit routing target for outbound messages. */
export type DeliveryTarget = {
    kind: "owner";
} | {
    kind: "room";
    roomId: string;
} | {
    kind: "a2a";
    hubAddress: string;
} | {
    kind: "a2a_channel";
    channelId: string;
} | {
    kind: "context";
};
export interface ShadowRecommendation {
    sessionId: string;
    skillName: string;
    decisionClass: string;
    recommendedAction: string;
    reasoningTrace?: string;
    observationId: string;
}
/** Structured message content for the deliver() dispatcher. */
export type DeliveryContent = {
    type: "text";
    text: string;
} | {
    type: "decision_request";
    request: DecisionRequest;
} | {
    type: "status_alert";
    alert: StatusAlert;
} | {
    type: "action_confirmation";
    confirmation: ActionConfirmation;
} | {
    type: "artifact";
    artifact: ArtifactPayload;
} | {
    type: "attachment";
    text: string;
    filePath: string;
} | {
    type: "policy_alert";
    alert: PolicyAlert;
} | {
    type: "approval_request";
    request: ApprovalRequest;
} | {
    type: "approval_response";
    response: ApprovalResponse;
} | {
    type: "shadow_recommendation";
    recommendation: ShadowRecommendation;
};
export interface ActionConfirmation {
    action: string;
    status: "completed" | "failed" | "partial";
    decisionId?: string;
    detail?: string;
    estimated_cost?: number;
}
export interface ArtifactPayload {
    filePath: string;
    filename: string;
    mimeType: string;
    description?: string;
}
/** Notify agent owner of a policy violation. */
export interface PolicyAlert {
    ruleId: string;
    scope: "tool" | "model" | "rate" | "network" | "custom";
    action: "block" | "warn" | "log";
    violationType: string;
    message: string;
    skillName?: string;
    toolName?: string;
    model?: string;
    timestamp?: string;
}
/** Human-in-the-loop gate for sensitive operations. */
export interface ApprovalRequest {
    approvalId: string;
    category: string;
    title: string;
    description: string;
    details?: Record<string, unknown>;
    expiresAt?: string;
    requiredTier?: string;
}
/** Owner response to an approval request. */
export interface ApprovalResponse {
    approvalId: string;
    approved: boolean;
    reason?: string;
    conditions?: string[];
    signature?: string;
}
export interface CredentialGrantPayload {
    type: "credential_grant";
    agreement_id: string;
    credentials: Array<{
        key: string;
        value: string;
        type: string;
        scope: string;
    }>;
    timestamp: string;
    nonce: string;
}
export interface CredentialRevokePayload {
    type: "credential_revoke";
    agreement_id: string;
    credential_keys: string[];
    reason?: string;
    timestamp: string;
}
export interface CredentialAckPayload {
    type: "credential_ack";
    agreement_id: string;
    acknowledged_keys: string[];
    status: "stored" | "revoked";
    timestamp: string;
}
export interface CredentialRequestPayload {
    type: "credential_request";
    agreement_id: string;
    requested_keys: string[];
    reason?: string;
    timestamp: string;
}
export interface DeliveryOptions {
    conversationId?: string;
    topicId?: string;
    priority?: string;
    parentSpanId?: string;
    metadata?: Record<string, unknown>;
}
export interface DeliveryReceipt {
    ok: boolean;
    destination: {
        kind: "owner" | "room" | "a2a";
        id?: string;
    };
    error?: string;
    queued?: boolean;
    decisionId?: string;
    timestamp: string;
}
export interface TargetInfo {
    kind: "owner" | "room" | "a2a";
    id: string;
    label: string;
    available: boolean;
}
/**
 * Parse a string target into a DeliveryTarget.
 * Handles: "owner", "default", "room:<uuid>", "a2a:<hubAddr>", "context",
 * "agentvault:room:<uuid>" (channel-prefixed), "agent:<name>" (→ a2a).
 */
export declare function parseTarget(raw: string): DeliveryTarget;
export interface TrustTokenState {
    token: string | null;
    tier: string | null;
    expiresAt: string | null;
}
//# sourceMappingURL=types.d.ts.map