import type { EditOperation, ItemDescriptor } from "../../types";
/**
 * Activity overview — a condensed, item-grouped view of what an agent did,
 * derived purely from the agent's `EditOperation[]` history (the same data the
 * Edit History popover renders, presented grouped-by-item instead of flat).
 *
 * Pure and deterministic: no React, no I/O. See agentActivitySummary.test.ts.
 */
export type ActivityBucketKind = "field" | "component-add" | "component-remove" | "component-move" | "component-shared" | "rendering" | "personalization" | "created" | "renamed" | "moved" | "deleted" | "published" | "suggested" | "comment";
/** Render order for buckets within an item row. */
export declare const ACTIVITY_BUCKET_ORDER: ActivityBucketKind[];
export interface ActivityBucket {
    kind: ActivityBucketKind;
    /**
     * Effect count, not op count: distinct fieldId for `field`, sum of
     * componentIds.length for component-remove/-move, otherwise the number of
     * active ops. Counts active (non-undone) effects only.
     */
    count: number;
    /** Contributing ops (incl. undone), for drill-down/tooltips. */
    operations: EditOperation[];
}
export interface ItemActivitySummary {
    /** Grouping key: lower-cased resolved target id. */
    itemId: string;
    /** Representative descriptor (the resolved target, not necessarily mainItem). */
    item: ItemDescriptor;
    /** Best available path for this target (may be undefined for id-only rows). */
    path?: string;
    /** Display label: name → leaf(path) → short id. */
    label: string;
    /** True when only an id could be resolved (bulk move/copy/clone rows). */
    idOnly: boolean;
    /** Non-empty buckets, ordered by ACTIVITY_BUCKET_ORDER. EMPTY when fully undone. */
    buckets: ActivityBucket[];
    /** All ops on this row, chronological (incl. undone). */
    operations: EditOperation[];
    /** Agent-authored suggestions/comments on this item, chronological. */
    feedback: AgentFeedbackActivity[];
    /** Distinct languages seen across this item's ops. */
    languages: string[];
    hasExecuting: boolean;
    hasFailed: boolean;
    /** Distinct non-undone op ids on this row. */
    activeOperationCount: number;
    /** Distinct op ids on this row (incl. undone). */
    totalOperationCount: number;
}
export interface ActivityOverview {
    /** Items the agent worked on, newest activity first. */
    items: ItemActivitySummary[];
    totalItems: number;
    /** Distinct active op ids across the input (NOT a sum over rows). */
    totalOperations: number;
}
/** A single item a given operation should be attributed to. */
export interface ActivityTarget {
    item: ItemDescriptor;
    path?: string;
    label?: string;
}
/** Kind of agent feedback derived from transcript tool calls. */
export type FeedbackKind = "suggested" | "comment";
/** A suggested edit or comment the agent produced (from its transcript tool calls). */
export interface AgentFeedbackActivity {
    id: string;
    kind: FeedbackKind;
    /** Page item the feedback is attributed to (mainItemId) — the grouping key. */
    itemId: string;
    language?: string;
    version?: number;
    /** The component/field item the feedback is anchored to. */
    targetItemId?: string;
    fieldName?: string;
    /** Suggested new value (suggestions) or comment text. */
    value?: string;
    date?: string;
}
interface ToolCallLike {
    id?: string;
    toolCallId?: string;
    functionName?: string;
    functionArguments?: string;
    functionResult?: string;
    functionError?: string;
    isCompleted?: boolean;
    createdDate?: string;
}
interface MessageLike {
    toolCalls?: ToolCallLike[];
}
/**
 * Extracts agent-authored suggested edits and comments from the agent transcript
 * tool calls (`suggest-field-edit` / `add-comment`). The transcript gives clean
 * per-agent attribution that the global feedback store lacks (it has no agentId).
 * Only successful, completed calls are returned.
 */
export declare function extractAgentFeedback(messages: MessageLike[] | undefined): AgentFeedbackActivity[];
export declare function classifyOperation(op: EditOperation): ActivityBucketKind;
/**
 * Resolves which item row(s) an operation belongs to. Reads the type-specific
 * field rather than `mainItem`, which the client commonly sets to the current
 * page or parent (see editor/client/operations.tsx). Bulk ops fan out to one
 * target per affected item.
 */
export declare function affectedItems(op: EditOperation): ActivityTarget[];
export declare function buildActivityOverview(operations: EditOperation[], feedback?: AgentFeedbackActivity[]): ActivityOverview;
export {};
