/**
 * DeepAgentsAdapter -- Orchestrator adapter for deepagents (LangChain-ai / Harrison Chase).
 *
 * Architecture: deepagents returns a compiled LangGraph graph as its execution
 * substrate. This adapter extends LangGraphAdapter and overrides the three
 * additional surfaces that deepagents adds on top of LangGraph:
 *
 *   1. Sub-agent spawning via the `task` tool
 *      - When a parent agent spawns a sub-agent, the sub-agent MUST inherit
 *        the parent's pack bindings (unless the pack explicitly forbids delegation).
 *      - Emits canonical event: `agent.subagent.spawned` (mapped to the closest
 *        existing canonical event: orchestrator:workflow-start with subagent flag).
 *
 *   2. Todo-list middleware
 *      - The planning tool produces a structured todo list that becomes part of
 *        the cycle's context. Each todo item is classified for data-class tags
 *        AT EMIT TIME, not at consumption time (fail-forward classification rule).
 *
 *   3. Context summarization layer
 *      - Summaries can contain distilled PHI/PII even when the underlying
 *        messages were redacted. The ingress classifier is applied to every
 *        summary output before it propagates.
 *
 * Everything else routes to the parent LangGraphAdapter unchanged.
 *
 * Integration:
 *   const adapter = new DeepAgentsAdapter(deepAgentsCfg, langGraphCfg);
 *   adapter.initialize(orchCfg);
 *   const saver = adapter.toCheckpointSaver();
 *   const graph = agent.compile({ checkpointer: saver });
 *
 *   // Additional deepagents-specific hooks:
 *   await adapter.subAgentSpawn(parentAgentId, childAgentId, spawnContext);
 *   await adapter.processTodoList(agentId, todoItems);
 *   await adapter.processSummary(agentId, summaryText, summaryContext);
 *
 * Pack inheritance rules for sub-agent spawning:
 *   - By default, child agent inherits ALL pack bindings from the parent.
 *   - If a pack carries a 'no-delegation' flag, inheritance of THAT pack is
 *     refused and the spawn is denied. Other packs may still propagate.
 *   - An empty resulting binding after filtering is an error (UnboundDataError).
 *
 * No live deepagents SDK installed. All framework surfaces are shims.
 * DEFERRED-DEEPAGENTS-V1-API: Verify exact hook surface when deepagents
 * stabilises its Python/JS API (beta as of 2026-04-23).
 *
 * Spec: P3-SUB-ADAPT-06
 * @connexum/ai-governance
 */
import { LangGraphAdapter } from './langgraph';
import type { LangGraphAdapterConfig } from './langgraph';
/**
 * Data-class tags for todo-list items.
 * 'SENSITIVE' replaces 'PHI' so no governance category literal is hardcoded
 * at the interface level. The actual category is determined by the
 * PackDrivenClassifier at runtime (W1 architectural directive).
 */
export type TodoItemDataClass = 'SENSITIVE' | 'PAN' | 'PII' | 'CLEAN';
/** Structured representation of a single todo-list item. */
export interface DeepAgentsTodoItem {
    /** Unique ID of this todo item within the cycle */
    itemId: string;
    /** Task description text */
    description: string;
    /** Priority (1 = highest) */
    priority?: number;
    /** Estimated completion time in minutes */
    estimatedMinutes?: number;
    /** Whether this item delegates to a sub-agent */
    isSubAgentTask?: boolean;
    /** Metadata from the planning tool */
    metadata?: Record<string, unknown>;
}
/** Context for a todo-list emit event (includes data-class tag). */
export interface DeepAgentsTodoItemClassified extends DeepAgentsTodoItem {
    /** Data class tag assigned at emit time */
    dataClass: TodoItemDataClass;
}
/** Context for a sub-agent spawn event. */
export interface DeepAgentsSubAgentSpawnContext {
    /** Pack bindings of the parent agent (source of inheritance) */
    parentPackBinding: string[];
    /** Pack bindings the child agent requests (may be a subset or superset) */
    requestedChildPackBinding: string[];
    /**
     * Pack IDs that explicitly forbid delegation.
     * If any of these packs is in the parent binding AND the child requests it,
     * the spawn is denied for that pack. Other packs may still propagate.
     */
    noDelegationPacks?: string[];
    /** Optional model the child agent will use */
    childModel?: string;
    /** Arbitrary spawn metadata */
    metadata?: Record<string, unknown>;
}
/** Context for a summarization event. */
export interface DeepAgentsSummaryContext {
    /** Which cycle / step this summary covers */
    cycleId?: string;
    /** Number of original messages that were summarized */
    originalMessageCount?: number;
    /** Whether the original messages contained redacted PHI */
    originalHadRedactedPhi?: boolean;
    /** Arbitrary summary metadata */
    metadata?: Record<string, unknown>;
}
export interface DeepAgentsAdapterConfig {
    /**
     * Pack IDs that prohibit delegation to sub-agents.
     * When a parent agent with one of these packs tries to spawn a sub-agent
     * that inherits the pack, the spawn is refused for that specific pack.
     * If all inherited packs are no-delegation packs, the entire spawn is denied.
     */
    noDelegationPacks?: string[];
    /**
     * If true (default), each todo-list item is classified for data-class tags
     * at emit time. Set to false only in test environments where classification
     * latency matters.
     */
    classifyTodoItems?: boolean;
    /**
     * If true (default), apply the PHI classifier to every summary output.
     * Summaries can contain distilled PHI even when underlying messages were
     * redacted.
     */
    classifySummaries?: boolean;
}
export declare class DeepAgentsAdapter extends LangGraphAdapter {
    private deepAgentsConfig;
    /**
     * Strip any org-field prefix from a caller-supplied agentId string.
     *
     * Deepagents agentIds may include an optional org prefix of the form
     * "org:<orgName>/<localId>" or "org:<orgName>:<localId>".
     * Because callers are untrusted, any org field embedded in the agentId
     * MUST be ignored for authorization/scoping purposes. Only the
     * JWT-derived orgId from the adapter's config is authoritative.
     *
     * This method returns only the local agent identifier (the part after
     * the final "/" or ":" separator if an "org:" prefix is present).
     * If no org prefix is detected, the original string is returned unchanged.
     *
     * Examples:
     *   "org:attacker/agent-123"  -> "agent-123"
     *   "org:attacker:agent-123"  -> "agent-123"
     *   "agent-123"               -> "agent-123"
     *   "org:legit/team/agent-1"  -> "agent-1"
     */
    static _extractAgentLocalId(agentId: string): string;
    constructor(deepAgentsCfg: DeepAgentsAdapterConfig, langGraphCfg: LangGraphAdapterConfig);
    /**
     * Called when a parent agent spawns a sub-agent via the `task` tool.
     *
     * Pack inheritance rules:
     *   1. Compute effective binding = parent binding INTERSECT requested child binding
     *      (child cannot escalate privilege above parent)
     *   2. Remove any packs in noDelegationPacks (pack-level delegation prohibition)
     *   3. If the effective binding is empty after filtering, deny (UnboundDataError)
     *   4. Emit canonical event with subagentSpawn=true marker
     *
     * Returns the EFFECTIVE pack binding the child should operate under.
     * The canonical event name is orchestrator:workflow-start (closest match) with
     * a `subagentSpawn: true` flag in the payload so compliance queries can filter.
     *
     * Throws OrchestratorError or BedrockUnboundDataError (as OrchestratorError) if denied.
     */
    subAgentSpawn(parentAgentId: string, childAgentId: string, spawnContext: DeepAgentsSubAgentSpawnContext): Promise<{
        effectivePackBinding: string[];
        auditId: string;
    }>;
    /**
     * Called when the deepagents planning tool produces a structured todo list.
     * Classifies each todo item for data-class tags AT EMIT TIME.
     *
     * Classification happens before the todo list enters the cycle's context.
     * Any item containing PHI/PAN is tagged; the full classified list is emitted
     * as a batch in a single canonical audit event.
     *
     * Returns the classified items (with dataClass tags added).
     */
    processTodoList(agentId: string, items: DeepAgentsTodoItem[]): Promise<DeepAgentsTodoItemClassified[]>;
    /**
     * Called when the deepagents context summarization layer produces a summary.
     * Applies the ingress PHI/PAN classifier to the summary text.
     *
     * Summary outputs can contain DISTILLED PHI even when underlying messages
     * were individually redacted (the summarization process can reassemble
     * identifying information from fragments). This hook catches that risk.
     *
     * If PHI/PAN is detected, emits a compliance review event. Does not block
     * (post-hoc scan) but surfaces to the compliance officer queue.
     *
     * Returns: whether PHI/PAN was detected in the summary.
     */
    processSummary(agentId: string, summaryText: string, summaryContext?: DeepAgentsSummaryContext): Promise<{
        hasPhiContent: boolean;
        auditId: string;
    }>;
    /**
     * Classify a single todo item for data-class tags.
     * Returns the most severe class found (PHI > PAN > PII > CLEAN).
     */
    private classifyTodoItem;
    getOrchestratorCapabilities(): {
        subAgentSpawning: boolean;
        todoListMiddleware: boolean;
        contextSummarization: boolean;
        workflowGovernance: boolean;
        taskGovernance: boolean;
        planGovernance: boolean;
        delegationGovernance: boolean;
        roleEdgeGovernance: boolean;
        parallelExecution: boolean;
        nestedPlans: boolean;
        circuitBreaker: boolean;
    };
}
//# sourceMappingURL=deepagents.d.ts.map