interface SubtransactionSummary { id: string; transaction_id: string; amount: number; memo?: string | null; payee_id?: string | null; payee_name?: string | null; category_id?: string | null; category_name?: string | null; transfer_account_id?: string | null; transfer_transaction_id?: string | null; deleted: boolean; } type AccountType = 'checking' | 'savings' | 'cash' | 'creditCard' | 'lineOfCredit' | 'otherAsset' | 'otherLiability' | 'mortgage' | 'autoLoan' | 'studentLoan' | 'personalLoan' | 'medicalDebt' | 'otherDebt'; type TransactionClearedStatus = 'cleared' | 'uncleared' | 'reconciled'; type TransactionFlagColor = 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple' | '' | null; type TransactionFlagName = string | null; type ScheduledTransactionFrequency = 'never' | 'daily' | 'weekly' | 'everyOtherWeek' | 'twiceAMonth' | 'every4Weeks' | 'monthly' | 'everyOtherMonth' | 'every3Months' | 'every4Months' | 'twiceAYear' | 'yearly' | 'everyOtherYear'; type LoanAccountPeriodicValue = { [key: string]: number; } | null; type Account = { id: string; name: string; type: AccountType; on_budget: boolean; closed: boolean; note?: string | null; balance: number; cleared_balance: number; uncleared_balance: number; transfer_payee_id: string | null; direct_import_linked?: boolean; direct_import_in_error?: boolean; last_reconciled_at?: string | null; debt_original_balance?: number | null; debt_interest_rates?: LoanAccountPeriodicValue; debt_minimum_payments?: LoanAccountPeriodicValue; debt_escrow_amounts?: LoanAccountPeriodicValue; deleted: boolean; }; type Category = { id: string; category_group_id: string; category_group_name?: string; name: string; hidden: boolean; original_category_group_id?: string | null; note?: string | null; budgeted: number; activity: number; balance: number; goal_type?: 'TB' | 'TBD' | 'MF' | 'NEED' | 'DEBT' | null; goal_needs_whole_amount?: boolean | null; goal_day?: number | null; goal_cadence?: number | null; goal_cadence_frequency?: number | null; goal_creation_month?: string | null; goal_target?: number | null; goal_target_month?: string | null; goal_percentage_complete?: number | null; goal_months_to_budget?: number | null; goal_under_funded?: number | null; goal_overall_funded?: number | null; goal_overall_left?: number | null; goal_snoozed_at?: string | null; deleted: boolean; }; type TransactionSummary = { id: string; date: string; amount: number; memo?: string | null; cleared: TransactionClearedStatus; approved: boolean; flag_color?: TransactionFlagColor; flag_name?: TransactionFlagName; account_id: string; payee_id?: string | null; category_id?: string | null; transfer_account_id?: string | null; transfer_transaction_id?: string | null; matched_transaction_id?: string | null; import_id?: string | null; import_payee_name?: string | null; import_payee_name_original?: string | null; debt_transaction_type?: 'payment' | 'refund' | 'fee' | 'interest' | 'escrow' | 'balanceAdjustment' | 'credit' | 'charge' | null; deleted: boolean; }; type ScheduledTransactionSummary = { id: string; date_first: string; date_next: string; frequency: ScheduledTransactionFrequency; amount: number; memo?: string | null; flag_color?: TransactionFlagColor; flag_name?: TransactionFlagName; account_id: string; payee_id?: string | null; category_id?: string | null; transfer_account_id?: string | null; deleted: boolean; }; /** * Conversation Management Types * * Defines data structures for managing multi-turn conversations in agent tasks, * including support for conversation history compression and context optimization. */ /** * Conversation turn in agent task execution */ interface ConversationTurn { /** Turn number in conversation (1-indexed) */ turnNumber: number; /** Role: user, assistant, or system */ role: 'user' | 'assistant' | 'system'; /** Message content */ content: string; /** ISO timestamp */ timestamp: string; /** Optional metadata about this turn */ metadata?: TurnMetadata; } /** * Metadata for a conversation turn */ interface TurnMetadata { /** Tools used during this turn (summary) */ toolsUsed?: string[]; /** Files modified during this turn */ filesModified?: string[]; /** Commands executed (summary) */ commandsExecuted?: string[]; /** Token usage for this turn */ tokens?: { input: number; output: number; }; /** Cost for this turn (USD) */ costUsd?: number; /** Whether this turn blocked waiting for input */ blockedForInput?: boolean; /** Agent ID that processed this turn */ agentId?: string; /** Claude session ID for conversation resumption */ sessionId?: string; } /** * Conversation state with compression support */ interface ConversationState { /** All conversation turns (recent, uncompressed) */ turns: ConversationTurn[]; /** Compressed summary of older turns (if compression applied) */ compressedHistory?: CompressedHistory; /** Total number of turns (including compressed) */ totalTurns: number; /** Configuration used for this conversation */ config?: ConversationConfig; } /** * Compressed history segment */ interface CompressedHistory { /** Turn numbers that were compressed (e.g., 1-10) */ turnRange: { start: number; end: number; }; /** Summary of compressed turns */ summary: string; /** When compression was performed */ compressedAt: string; /** Key facts/decisions from compressed turns */ keyPoints?: string[]; /** Estimated tokens saved by compression */ tokensSaved?: number; } /** * Configuration for conversation management */ interface ConversationConfig { /** Number of recent turns to keep verbatim */ recentTurnsToKeep: number; /** Trigger compression when total turns exceeds this */ compressionThreshold: number; /** Whether to include tool details in summaries */ includeToolDetails: boolean; /** Whether compression is enabled */ compressionEnabled: boolean; } /** * Default conversation configuration * * Optimized for balance between context fidelity and token efficiency: * - Keeps last 8 turns verbatim (sufficient for most multi-turn tasks) * - Compresses when conversation exceeds 12 turns * - Tool summaries only (not full output) */ declare const DEFAULT_CONVERSATION_CONFIG: ConversationConfig; /** * Process & Workflow Type Definitions * * Provides comprehensive type safety for the process visualization system * that supports flowchart rendering, workflow documentation, and process management. */ /** * Status of a process in its lifecycle */ type ProcessStatus = 'draft' | 'active' | 'archived' | 'deprecated'; /** * Category/domain that a process belongs to */ type ProcessCategory = 'operations' | 'engineering' | 'hr' | 'finance' | 'sales' | 'marketing' | 'support' | 'legal' | 'compliance' | 'other'; /** * Type of step in a process flowchart */ type ProcessStepType = 'start' | 'end' | 'action' | 'decision' | 'subprocess' | 'wait' | 'parallel' | 'merge'; /** * Discussion Feature Type Definitions * * Provides comprehensive type safety for the discussion system that supports * polymorphic relationships with Projects, Milestones, Tasks, and future entities. */ /** * Supported entity types for discussions * Extensible to support future entity types */ type DiscussionEntityType = 'project' | 'milestone' | 'task' | string; /** * File attachment status states */ type AttachmentStatus = 'pending' | 'uploaded' | 'failed'; /** * Mention extracted from discussion content * Represents an @mention of a user or agent */ interface DiscussionMention { /** Type of entity mentioned */ type: 'agent' | 'user' | 'team'; /** The @handle used in content (e.g., "engineering-manager-backend") */ identifier: string; /** Resolved TeamMember ID if applicable */ teamMemberId?: string; /** Resolved User ID for human users */ userId?: string; /** Character position in content where mention starts */ position: number; } /** * Main discussion model interface * Follows existing collection patterns with UTC date strings */ interface DiscussionModel { id: string; orgId: string; workspaceId: string; userId: string; createdAt: string; updatedAt: string; entityType: DiscussionEntityType; entityId: string; content: string; contentHtml?: string; parentId?: string; threadDepth: number; isEdited: boolean; editedAt?: string; isDeleted: boolean; deletedAt?: string; attachments?: AttachmentModel[]; userName: string; userAvatar?: string; /** Parsed @mentions from content */ mentions?: DiscussionMention[]; /** Emoji reaction tallies, keyed by emoji string (e.g. { "👍": 3 }). */ reactionCounts?: Record; metadata?: Record; /** Tenant isolation identifier */ tenantId?: string; /** Extensible object for future schema additions */ extended?: Record; } /** * File attachment model interface * Stores metadata for files attached to discussions */ interface AttachmentModel { id: string; name: string; size: number; type: string; url: string; uploadedAt: string; status: AttachmentStatus; thumbnailUrl?: string; checksum?: string; } export { type Account as A, type Category as C, type DiscussionEntityType as D, type LoanAccountPeriodicValue as L, type ProcessStatus as P, type ScheduledTransactionSummary as S, type TransactionSummary as T, type DiscussionModel as a, type SubtransactionSummary as b, type ConversationState as c, type ProcessCategory as d, type ProcessStepType as e, type ConversationTurn as f, type TurnMetadata as g, type CompressedHistory as h, type ConversationConfig as i, type AccountType as j, type ScheduledTransactionFrequency as k, type TransactionFlagColor as l, type TransactionFlagName as m, type TransactionClearedStatus as n, type AttachmentModel as o, type AttachmentStatus as p, type DiscussionMention as q, DEFAULT_CONVERSATION_CONFIG as r };