import { AgentActivityMessage, AgentActivitySnapshot, AgentActivityPresence, AgentActivitySession } from '@tutti-os/agent-activity-core';

interface AgentHostManagedAgentsStateItem {
    toolId: string;
    toolClass: string;
    agentId?: string;
    hostDetected?: boolean;
    hostConfigDetected?: boolean;
    hostVersion?: string;
    targetVersion: string;
    recommendedVersion?: string;
    decisionReason: string;
    fallbackApplied: boolean;
    notes?: string;
}
interface AgentHostToolchainConfigSyncedAgent {
    agentId: string;
    /** RFC3339 timestamp for when Nextop last synced this agent's host config. */
    syncedAt?: string;
}
interface AgentHostManagedAgentsState {
    metadataSynced: boolean;
    toolCatalogRevision: string;
    agentProfileRevision: string;
    totalCount: number;
    items: AgentHostManagedAgentsStateItem[];
    /** Agent IDs ready for normal AgentGUI use (installed and authenticated/ready). */
    readyAgentIds: string[];
    /** Agent IDs whose host config has been synced to the VM through Manage Agents. */
    configSyncedAgentIds: string[];
    /** Agent config sync metadata, including when Nextop last copied host config. */
    configSyncedAgents?: AgentHostToolchainConfigSyncedAgent[];
}
interface AgentHostUserInfo {
    userId: string;
    email?: string;
    avatar?: string;
    avatarObjectKey?: string;
    name?: string;
}
interface AgentHostBatchUserInfoInput {
    userIds: string[];
}
interface AgentHostBatchUserInfoResult {
    users: AgentHostUserInfo[];
}
type AgentHostWorkspaceAgentProvider = "codex" | "claude-code" | string;
type AgentHostWorkspaceAgentSessionOrigin = "WORKSPACE_AGENT_SESSION_ORIGIN_HOOK" | "WORKSPACE_AGENT_SESSION_ORIGIN_RUNTIME" | string;
type AgentHostWorkspaceAgentPresenceStatus = "working" | "paused" | string;
type AgentHostWorkspaceAgentSessionLifecycleStatus = "active" | "ended" | "failed" | string;
type AgentHostWorkspaceAgentTurnPhase = "idle" | "working" | "waiting_approval" | "waiting_input" | "failed" | string;
type AgentHostWorkspaceAgentEffectiveStatus = "idle" | "working" | "waiting" | "ready" | "completed" | "failed" | string;
type AgentHostWorkspaceAgentSessionStatus = "idle" | "working" | "waiting" | "completed" | "failed" | "canceled" | string;
type AgentHostWorkspaceAgentSyncStatus = "pending" | "synced" | "failed" | string;
interface AgentHostWorkspaceAgentPresence {
    id: number;
    workspaceId: string;
    userId: string;
    provider: AgentHostWorkspaceAgentProvider;
    status: AgentHostWorkspaceAgentPresenceStatus;
}
interface AgentHostWorkspaceAgentSession {
    id: number;
    workspaceId?: string;
    agentSessionId: string;
    presenceId: number;
    userId?: string;
    provider?: AgentHostWorkspaceAgentProvider;
    providerSessionId: string;
    resumable?: boolean;
    sessionOrigin?: AgentHostWorkspaceAgentSessionOrigin;
    cwd: string;
    lifecycleStatus?: AgentHostWorkspaceAgentSessionLifecycleStatus;
    turnPhase?: AgentHostWorkspaceAgentTurnPhase;
    endedAtUnixMs?: number;
    startedAtUnixMs?: number;
    createdAtUnixMs?: number;
    updatedAtUnixMs?: number;
    pinnedAtUnixMs?: number | null;
    effectiveStatus?: AgentHostWorkspaceAgentEffectiveStatus;
    title?: string;
    status?: AgentHostWorkspaceAgentSessionStatus;
    syncState?: AgentHostWorkspaceAgentSyncState;
}
interface AgentHostWorkspaceAgentSyncState {
    workspaceId?: string;
    agentSessionId?: string;
    status: AgentHostWorkspaceAgentSyncStatus;
    pendingTimelineItemCount?: number;
    pendingStatePatchCount?: number;
    attemptCount?: number;
    failedReportCount?: number;
    lastError?: string;
    lastAttemptAtUnixMs?: number;
    lastSyncedAtUnixMs?: number;
    updatedAtUnixMs?: number;
}
interface AgentHostWorkspaceAgentListInput {
    workspaceId?: string | null;
    sessionOrigin?: AgentHostWorkspaceAgentSessionOrigin;
    userId?: string;
}
interface AgentHostWorkspaceAgentSnapshot {
    presences: AgentHostWorkspaceAgentPresence[];
    sessions: AgentHostWorkspaceAgentSession[];
    sessionMessagesById?: Record<string, AgentHostWorkspaceAgentMessage[]>;
}
interface AgentHostDeleteWorkspaceAgentSessionInput {
    workspaceId?: string | null;
    agentSessionId: string;
    sessionOrigin?: AgentHostWorkspaceAgentSessionOrigin;
}
interface AgentHostWorkspaceAgentMessage {
    id: number;
    workspaceId?: string;
    agentSessionId: string;
    messageId: string;
    version: number;
    turnId?: string;
    role: string;
    kind: string;
    status?: string;
    payload: Record<string, unknown>;
    occurredAtUnixMs?: number;
    startedAtUnixMs?: number;
    completedAtUnixMs?: number;
}
interface AgentHostWorkspaceAgentSessionMessagesInput {
    workspaceId?: string | null;
    agentSessionId: string;
    afterVersion?: number;
    beforeVersion?: number;
    limit?: number;
    order?: "asc" | "desc";
    sessionOrigin?: AgentHostWorkspaceAgentSessionOrigin;
}
interface AgentHostWorkspaceAgentSessionMessages {
    messages: AgentHostWorkspaceAgentMessage[];
    latestVersion?: number;
    hasMore?: boolean;
}
interface AgentHostWorkspaceAgentSessionSummaryItem {
    id?: number;
    turnId?: string;
    actorType?: string;
    actorId?: string;
    itemType?: string;
    role?: string;
    callType?: string;
    callId?: string;
    name?: string;
    status?: string;
    content?: string;
    occurredAtUnixMs?: number;
    createdAtUnixMs?: number;
}
interface AgentHostWorkspaceAgentSessionSummaryTurn {
    turnId?: string;
    userItems: AgentHostWorkspaceAgentSessionSummaryItem[];
    agentItems: AgentHostWorkspaceAgentSessionSummaryItem[];
}
interface AgentHostWorkspaceAgentSessionExecutionStatus {
    currentOrFinalStatus?: string;
    status?: AgentHostWorkspaceAgentSessionStatus;
}
interface AgentHostWorkspaceAgentSessionSummaryInput {
    workspaceId?: string | null;
    agentSessionId: string;
    agentReplyLimit?: number;
    recentTurnLimit?: number;
}
interface AgentHostWorkspaceAgentSessionSummary {
    agentSessionId: string;
    initialUserRequirement?: string;
    latestUserRequirement?: string;
    recentAgentReplies: string[];
    currentOrFinalStatus?: string;
    initialTurn?: AgentHostWorkspaceAgentSessionSummaryTurn | null;
    latestTurn?: AgentHostWorkspaceAgentSessionSummaryTurn | null;
    latestTurnSameAsInitial?: boolean;
    recentTurns: AgentHostWorkspaceAgentSessionSummaryTurn[];
    executionStatus?: AgentHostWorkspaceAgentSessionExecutionStatus | null;
}
interface AgentHostRuntimeOpenclawGatewayWarmupResult {
    accepted: boolean;
    ready?: boolean;
}

interface RoomShareMemberView {
    userId: string;
    label: string;
    role: "owner" | "member";
    initial: string;
    /** Resolved avatar URL; falls back to `initial` in UI when missing or load fails. */
    avatarUrl?: string;
}

type WorkspaceAgentActivityProvider = "codex" | "claude-code" | string;
declare const WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN = "WORKSPACE_AGENT_SESSION_ORIGIN_RUNTIME";
type WorkspaceAgentActivitySessionOrigin = "WORKSPACE_AGENT_SESSION_ORIGIN_HOOK" | typeof WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN | string;
type WorkspaceAgentActivitySyncStatus = "pending" | "synced" | "failed" | string;
interface WorkspaceAgentActivitySyncState {
    workspaceId?: string;
    agentSessionId?: string;
    status: WorkspaceAgentActivitySyncStatus;
    pendingTimelineItemCount?: number;
    pendingStatePatchCount?: number;
    attemptCount?: number;
    failedReportCount?: number;
    lastError?: string;
    lastAttemptAtUnixMs?: number;
    lastSyncedAtUnixMs?: number;
    updatedAtUnixMs?: number;
}
interface WorkspaceAgentActivityPresence extends Omit<AgentActivityPresence, "id" | "provider" | "status"> {
    id: string | number;
    provider: WorkspaceAgentActivityProvider;
    status: string;
    userId?: string | null;
}
interface WorkspaceAgentActivitySession extends Omit<AgentActivitySession, "provider" | "providerSessionId" | "pinnedAtUnixMs" | "status" | "title" | "workspaceId"> {
    id?: number;
    workspaceId?: string;
    presenceId?: string | number;
    userId?: string;
    provider?: WorkspaceAgentActivityProvider;
    providerSessionId?: string | null;
    resumable?: boolean;
    sessionOrigin?: WorkspaceAgentActivitySessionOrigin;
    lifecycleStatus?: string;
    turnPhase?: string;
    endedAtUnixMs?: number;
    effectiveStatus?: string;
    status?: string;
    title?: string;
    pinnedAtUnixMs?: number | null;
    syncState?: WorkspaceAgentActivitySyncState;
}
interface WorkspaceAgentActivityMessage extends Omit<AgentActivityMessage, "id" | "turnId" | "status"> {
    id?: number;
    turnId?: string | null;
    status?: string | null;
}
interface WorkspaceAgentActivitySnapshot extends Omit<AgentActivitySnapshot, "sessions" | "presences" | "sessionMessagesById" | "workspaceId"> {
    workspaceId?: string;
    presences: WorkspaceAgentActivityPresence[];
    sessions: WorkspaceAgentActivitySession[];
    sessionMessagesById?: Record<string, WorkspaceAgentActivityMessage[]>;
}

type ToolCallStatusKind = "working" | "completed" | "failed" | "canceled" | "waiting";
interface WorkspaceAgentToolCallDisplay {
    id: string;
    name: string;
    status: string | null;
    statusKind: ToolCallStatusKind | null;
    detail?: string;
}

type WorkspaceAgentLatestActivityStatus = "working" | "waiting" | "idle" | "completed" | "canceled" | "failed";
interface WorkspaceAgentConversationPreviewLine {
    actorName: string;
    summary: string;
}

declare function workspaceAgentProviderLabel(provider: string): string;

type WorkspaceAgentActivityStatus = WorkspaceAgentLatestActivityStatus;
interface WorkspaceAgentChangedFile {
    path: string;
    label: string;
}
interface WorkspaceAgentActivityCard {
    id: string;
    sessionId: string;
    userId: string | null;
    userName: string;
    userAvatarUrl?: string;
    agentProvider: string;
    agentName: string;
    title: string;
    status: WorkspaceAgentActivityStatus;
    latestActivitySummary: string;
    /** User prompt + latest agent reply for task/issue execution cards; room status list uses single-line summary only. */
    conversationPreview?: WorkspaceAgentConversationPreviewLine[];
    latestActivityActorName?: string;
    toolCalls?: WorkspaceAgentToolCallDisplay[];
    changedFiles: WorkspaceAgentChangedFile[];
    sortTimeUnixMs: number;
    readTimeUnixMs?: number;
}
interface WorkspaceAgentActivityListViewModel {
    activities: WorkspaceAgentActivityCard[];
}
interface BuildWorkspaceAgentActivityListOptions {
    sessionMessagesById?: Record<string, WorkspaceAgentActivityMessage[]>;
    userProfilesById?: Record<string, AgentHostUserInfo>;
    fallbackMembers?: RoomShareMemberView[];
}
declare function collectWorkspaceAgentGeneratedFiles(snapshot: WorkspaceAgentActivitySnapshot, options?: {
    workspaceRoot?: string | null;
}): WorkspaceAgentChangedFile[];
declare function buildWorkspaceAgentActivityListViewModel(snapshot: WorkspaceAgentActivitySnapshot, options?: BuildWorkspaceAgentActivityListOptions): WorkspaceAgentActivityListViewModel;
declare function reuseWorkspaceAgentActivityListViewModelIfUnchanged(previous: WorkspaceAgentActivityListViewModel | null, next: WorkspaceAgentActivityListViewModel): WorkspaceAgentActivityListViewModel;

declare function resolveWorkspaceAgentActivityStatus(session: WorkspaceAgentActivitySession): WorkspaceAgentActivityStatus;
declare function resolveWorkspaceAgentActivityTitle(session: WorkspaceAgentActivitySession, messages?: readonly WorkspaceAgentActivityMessage[]): string;

export { type AgentHostBatchUserInfoInput as A, type BuildWorkspaceAgentActivityListOptions as B, type WorkspaceAgentActivityCard as W, type AgentHostBatchUserInfoResult as a, type AgentHostDeleteWorkspaceAgentSessionInput as b, type AgentHostManagedAgentsState as c, type AgentHostRuntimeOpenclawGatewayWarmupResult as d, type AgentHostWorkspaceAgentListInput as e, type AgentHostWorkspaceAgentMessage as f, type AgentHostWorkspaceAgentSession as g, type AgentHostWorkspaceAgentSessionMessages as h, type AgentHostWorkspaceAgentSessionMessagesInput as i, type AgentHostWorkspaceAgentSessionSummary as j, type AgentHostWorkspaceAgentSessionSummaryInput as k, type AgentHostWorkspaceAgentSnapshot as l, type WorkspaceAgentActivityListViewModel as m, type WorkspaceAgentActivityStatus as n, type WorkspaceAgentChangedFile as o, buildWorkspaceAgentActivityListViewModel as p, collectWorkspaceAgentGeneratedFiles as q, resolveWorkspaceAgentActivityStatus as r, resolveWorkspaceAgentActivityTitle as s, reuseWorkspaceAgentActivityListViewModelIfUnchanged as t, workspaceAgentProviderLabel as w };
