{"version":3,"sources":["/Users/shyun/comcom/ain-enterprise/ain-adk/dist/cjs/chunk-7XBNW7XM.cjs","../../src/types/memory.ts"],"names":["MessageRole","ThreadType"],"mappings":"AAAA;ACGO,IAAK,YAAA,kBAAL,CAAA,CAAKA,YAAAA,EAAAA,GAAL;AAEN,EAAAA,YAAAA,CAAA,MAAA,EAAA,EAAO,MAAA;AAEP,EAAAA,YAAAA,CAAA,QAAA,EAAA,EAAS,QAAA;AAET,EAAAA,YAAAA,CAAA,OAAA,EAAA,EAAQ,OAAA;AANG,EAAA,OAAAA,YAAAA;AAAA,CAAA,CAAA,CAAA,YAAA,GAAA,CAAA,CAAA,CAAA;AAgFL,IAAK,WAAA,kBAAL,CAAA,CAAKC,WAAAA,EAAAA,GAAL;AACN,EAAAA,WAAAA,CAAA,UAAA,EAAA,EAAW,UAAA;AACX,EAAAA,WAAAA,CAAA,MAAA,EAAA,EAAO,MAAA;AAFI,EAAA,OAAAA,WAAAA;AAAA,CAAA,CAAA,CAAA,WAAA,GAAA,CAAA,CAAA,CAAA;ADvEZ;AACA;AACE;AACA;AACF,mEAAC","file":"/Users/shyun/comcom/ain-enterprise/ain-adk/dist/cjs/chunk-7XBNW7XM.cjs","sourcesContent":[null,"/**\n * Roles for participants in a message.\n */\nexport enum MessageRole {\n\t/** User/human participant */\n\tUSER = \"USER\",\n\t/** System-generated messages or instructions */\n\tSYSTEM = \"SYSTEM\",\n\t/** AI model responses */\n\tMODEL = \"MODEL\",\n}\n\n/**\n * A plain-text segment within a \"rich\" message.\n */\nexport type TextPart = {\n\ttype: \"text\";\n\ttext: string;\n};\n\n/**\n * A reference to a {@link Document} within a \"rich\" message.\n *\n * The body is NOT embedded — clients resolve `documentId` to fetch the latest\n * document (rendering it inline or as a link). `title` is a label hint only.\n */\nexport type DocumentPart = {\n\ttype: \"document\";\n\tdocumentId: string;\n\t/** Label hint for rendering (e.g. link text). Not the canonical title. */\n\ttitle?: string;\n};\n\n/**\n * A single segment of a \"rich\" message. Discriminated by `type`.\n */\nexport type MessagePart = TextPart | DocumentPart;\n\n/**\n * Content structure for message content.\n *\n * Supports multi-part content with different types (text, images, etc.).\n *\n * - `type: \"text\"` — `parts` is `string[]` (legacy/simple text).\n * - `type: \"document\"` — `parts` is a single `[DocumentPart]` (document-only).\n * - `type: \"rich\"` — `parts` is `MessagePart[]`, mixing text and document\n *   references in display order.\n */\nexport type MessageContentObject = {\n\t/** Content type (e.g., \"text\", \"document\", \"rich\"). */\n\ttype: string;\n\t/** Array of content parts, structure depends on content type. */\n\tparts: unknown[];\n};\n\n/**\n * Represents a single message in a thread.\n *\n * @example\n * ```typescript\n * const message: MessageObject = {\n *   role: MessageRole.USER,\n *   content: {\n *     type: \"text\",\n *     parts: [\"Hello, how can you help me?\"]\n *   },\n *   timestamp: Date.now(),\n *   metadata: { source: \"web-ui\" }\n * };\n * ```\n */\nexport type MessageObject = {\n\tmessageId: string;\n\t/** Role of the message sender */\n\trole: MessageRole;\n\t/** Message content with type and parts */\n\tcontent: MessageContentObject;\n\t/** Unix timestamp when the message was created */\n\ttimestamp: number;\n\t/** Optional metadata for additional context */\n\tmetadata?: { [key: string]: unknown };\n};\n\nexport enum ThreadType {\n\tWORKFLOW = \"WORKFLOW\",\n\tCHAT = \"CHAT\",\n}\n\nexport type ThreadFilter = {\n\t/** Filter by user workflow ID */\n\tworkflowId?: string;\n\t/** Filter by thread type */\n\ttype?: ThreadType;\n};\n\nexport type ThreadMetadata = {\n\ttype: ThreadType;\n\ttitle: string;\n\tuserId: string;\n\tthreadId: string;\n\tisPinned?: boolean;\n\t/** ID of the user workflow that created this thread */\n\tworkflowId?: string;\n\tcreatedAt?: string;\n\tupdatedAt?: string;\n};\n\n/**\n * Represents a conversation thread containing multiple messages.\n *\n * Messages are stored in a key-value structure where keys are unique message IDs\n * and values are the corresponding message objects.\n *\n * @example\n * ```typescript\n * const thread: ThreadObject = {\n * \t title: \"New conversation\",\n *   messages: [\n *     { messageId: <UUID_1>, role: MessageRole.USER, content: {...}, timestamp: 1234567890 },\n *     { messageId: <UUID_2> ,role: MessageRole.MODEL, content: {...}, timestamp: 1234567891 }\n *   ]\n * };\n * ```\n */\nexport type ThreadObject = {\n\tuserId: string;\n\tthreadId: string;\n\ttype: ThreadType;\n\ttitle: string;\n\tisPinned?: boolean;\n\t/** ID of the user workflow that created this thread */\n\tworkflowId?: string;\n\tmessages: Array<MessageObject>;\n};\n\nexport type IntentToolChoice = \"auto\" | \"required\";\n\nexport interface Intent {\n\tid: string;\n\tname: string;\n\tdescription: string;\n\tstatus: string;\n\tprompt?: string;\n\ttriggeringSentences?: Array<string>;\n\ttags?: Array<string>;\n\t/** Controls whether the LLM must call a tool for this intent.\n\t * - \"required\": first LLM call must invoke at least one tool\n\t * - \"auto\": LLM decides (default)\n\t */\n\ttoolChoice?: IntentToolChoice;\n\t/** When set, fulfilling this intent runs the mapped workflow instead of\n\t * the prompt-based inference loop. Accepts a user workflow id or a\n\t * workflow template id (user workflow wins), like document slot bindings.\n\t */\n\tworkflowId?: string;\n}\n\nexport type TriggeredIntent = {\n\tsubquery: string;\n\tintent?: Intent;\n\tactionPlan?: string;\n};\n\n/**\n * Result of multi-intent triggering.\n * Contains the list of triggered intents and metadata about aggregation.\n */\nexport type IntentTriggerResult = {\n\t/** List of triggered intents */\n\tintents: Array<TriggeredIntent>;\n\t/** Whether the results need to be aggregated into a unified response */\n\tneedsAggregation: boolean;\n};\n\n/**\n * Result of fulfilling a single intent.\n * Used to collect all results before the rewrite step.\n */\nexport type FulfillmentResult = {\n\t/** Original subquery that was processed */\n\tsubquery: string;\n\t/** Matched intent (may be undefined if no match) */\n\tintent?: Intent;\n\t/** Action plan description */\n\tactionPlan?: string;\n\t/** Response text generated for this intent */\n\tresponse: string;\n};\n\nexport interface WorkflowTaskAgent {\n\tprotocol: \"A2A\";\n\tconnectorName: string;\n}\n\nexport interface WorkflowTask {\n\ttaskId: string;\n\t/** Display label; falls back to taskId in progress events and logs. */\n\ttitle?: string;\n\tprompt: string;\n\tagent?: WorkflowTaskAgent;\n}\n\nexport interface WorkflowHeadingBlock {\n\tblockId: string;\n\ttype: \"heading\";\n\tlevel?: 1 | 2 | 3;\n\ttext: string;\n}\n\nexport interface WorkflowTextBlock {\n\tblockId: string;\n\ttype: \"text\";\n\tprompt: string;\n\t/**\n\t * Absent/\"generate\": write new commentary; source context must not be\n\t * restated. \"present\": source content is the output material — the block\n\t * prompt controls how it is organized; facts absent from the source must\n\t * not be added.\n\t */\n\tmode?: \"generate\" | \"present\";\n\tsourceTaskIds?: string[];\n\tsourceBlockIds?: string[];\n}\n\nexport type WorkflowGraphType = \"xychart-beta\" | \"pie\";\n\nexport interface WorkflowGraphBlockBase {\n\tblockId: string;\n\ttype: \"graph\";\n\tgraphType: WorkflowGraphType;\n\ttitle?: string;\n\tprompt: string;\n\tsourceTaskIds?: string[];\n\tsourceBlockIds?: string[];\n}\n\nexport interface WorkflowXYChartSeriesData {\n\tkind: \"bar\" | \"line\";\n\tlabel?: string;\n\tdata: number[];\n}\n\nexport interface WorkflowXYChartBlock extends WorkflowGraphBlockBase {\n\tgraphType: \"xychart-beta\";\n}\n\nexport interface WorkflowPieChartSlice {\n\tlabel: string;\n\tvalue: number;\n}\n\nexport interface WorkflowPieChartBlock extends WorkflowGraphBlockBase {\n\tgraphType: \"pie\";\n\tshowData?: boolean;\n}\n\nexport type WorkflowGraphBlock = WorkflowXYChartBlock | WorkflowPieChartBlock;\n\nexport type WorkflowTableLayout = \"records\" | \"matrix\";\n\nexport type WorkflowTableColumnFormatKind =\n\t| \"auto\"\n\t| \"text\"\n\t| \"number\"\n\t| \"currency\"\n\t| \"percent\";\n\nexport interface WorkflowTableColumnFormat {\n\tkind?: WorkflowTableColumnFormatKind;\n\tgrouping?: boolean;\n\tdecimals?: number;\n\tprefix?: string;\n\tsuffix?: string;\n\tnullDisplay?: string;\n}\n\nexport interface WorkflowTableBlock {\n\tblockId: string;\n\ttype: \"table\";\n\tlayout: WorkflowTableLayout;\n\ttitle?: string;\n\tunit?: string;\n\trowHeader?: string;\n\trows?: string[];\n\tcolumns: string[];\n\thiddenRows?: string[];\n\thiddenColumns?: string[];\n\tformulas?: string[];\n\tsourceTaskIds?: string[];\n\tprompt?: string;\n\tcolumnFormats?: Record<string, WorkflowTableColumnFormat>;\n\t/** Matrix-only: per-row format overrides, merged field-by-field over columnFormats. */\n\trowFormats?: Record<string, WorkflowTableColumnFormat>;\n}\n\nexport type WorkflowResponseBlock =\n\t| WorkflowHeadingBlock\n\t| WorkflowTextBlock\n\t| WorkflowGraphBlock\n\t| WorkflowTableBlock;\n\nexport interface WorkflowDefinition {\n\ttasks: WorkflowTask[];\n\tresponse: {\n\t\tblocks: WorkflowResponseBlock[];\n\t};\n}\n\nexport interface WorkflowTaskResult {\n\ttaskId: string;\n\ttitle: string;\n\tagent?: WorkflowTaskAgent;\n\tstatus: \"completed\" | \"failed\" | \"skipped\";\n\tcontent: string;\n\traw?: unknown;\n\terror?: string;\n\tstartedAt: number;\n\tcompletedAt: number;\n}\n\nexport interface WorkflowRenderedTableSpec {\n\tlayout: WorkflowTableLayout;\n\trowHeader?: string;\n\trows?: string[];\n\tcolumns: string[];\n\thiddenRows?: string[];\n\thiddenColumns?: string[];\n\tformulas?: string[];\n\tcolumnFormats?: Record<string, WorkflowTableColumnFormat>;\n\trowFormats?: Record<string, WorkflowTableColumnFormat>;\n}\n\nexport interface WorkflowRenderedTableGridRow {\n\tkey?: string;\n\tcells: Array<string | number | null>;\n\tkind?: \"data\" | \"total\";\n}\n\nexport interface WorkflowRenderedTableMetadata {\n\tunit?: string;\n}\n\nexport interface WorkflowRenderedTableData {\n\tspec: WorkflowRenderedTableSpec;\n\tmetadata?: WorkflowRenderedTableMetadata;\n\ttable: {\n\t\theaders: string[];\n\t\trows: WorkflowRenderedTableGridRow[];\n\t};\n\twarnings?: string[];\n}\n\nexport interface WorkflowRenderedXYChartData {\n\tgraphType: \"xychart-beta\";\n\ttitle?: string;\n\txAxis: string[];\n\tyAxis?: {\n\t\tlabel?: string;\n\t\tmin?: number;\n\t\tmax?: number;\n\t};\n\tseries: WorkflowXYChartSeriesData[];\n}\n\nexport interface WorkflowRenderedPieChartData {\n\tgraphType: \"pie\";\n\ttitle?: string;\n\tshowData?: boolean;\n\tslices: WorkflowPieChartSlice[];\n}\n\nexport type WorkflowRenderedGraphSpec =\n\t| WorkflowRenderedXYChartData\n\t| WorkflowRenderedPieChartData;\n\nexport interface WorkflowRenderedGraphData {\n\tspec: WorkflowRenderedGraphSpec;\n\tmermaid: string;\n\twarnings?: string[];\n}\n\nexport type WorkflowRenderedBlockData =\n\t| WorkflowRenderedTableData\n\t| WorkflowRenderedGraphData;\n\nexport interface WorkflowRenderedBlock {\n\tblockId: string;\n\ttype: WorkflowResponseBlock[\"type\"];\n\tcontent: string;\n\tdata?: WorkflowRenderedBlockData;\n}\n\nexport type WorkflowVariableType =\n\t| \"select\"\n\t| \"dropdown\"\n\t| \"date_range\"\n\t| \"date_parts\"\n\t| \"text\"\n\t| \"number\";\n\nexport type WorkflowVariableResolveAt = \"creation\" | \"execution\";\n\nexport interface WorkflowVariablePartSpec {\n\ttoken?: string;\n\tid?: string;\n\tkey?: string;\n\tlabel?: string;\n\tname?: string;\n\tplaceholder?: string;\n\tformat?: string;\n\tsource?: \"value\" | \"start\" | \"end\";\n}\n\nexport interface WorkflowVariable {\n\tid: string; // e.g. \"workplace_id\"\n\tlabel: string; // e.g. \"분석할 업장을 선택해주세요\"\n\ttype: WorkflowVariableType;\n\toptions?: Array<string>; // for \"select\" or \"dropdown\" type\n\tparts?: Record<string, string> | WorkflowVariablePartSpec[];\n\t/** When to resolve this variable:\n\t * - \"creation\": resolved when copying template → my workflow (e.g., store selection)\n\t * - \"execution\": resolved each time the workflow runs (e.g., date range)\n\t * Defaults to \"creation\" if not specified.\n\t */\n\tresolveAt?: WorkflowVariableResolveAt;\n}\n\n/**\n * A workflow template — an immutable blueprint for creating user workflows.\n * System-provided or admin-defined.\n */\nexport interface WorkflowTemplate {\n\ttemplateId: string;\n\ttitle: string;\n\tdescription: string;\n\tactive: boolean;\n\t/** Classification label for grouping templates in the UI (e.g. \"식음\", \"객실\"). */\n\tcategory?: string;\n\t/** The prompt/instruction template with {{variable}} placeholders */\n\tcontent: string;\n\t/** Structured workflow definition (tasks → response blocks). Required. */\n\tdefinition: WorkflowDefinition;\n\t/** Variable schema definitions (type, label, options) for UI rendering */\n\tvariables?: Record<string, WorkflowVariable>;\n\t/**\n\t * Hidden templates are excluded from list responses by default\n\t * (e.g. document-advice-only workflows). Fetch-by-id is unaffected.\n\t */\n\thidden?: boolean;\n}\n\n/**\n * A user-owned workflow instance, optionally created from a WorkflowTemplate.\n *\n * Supports:\n * - Internal execution via scheduler/service\n * - Scheduled execution via cron expression\n * - Template variables (e.g., {{today}}, {{yesterday}}) resolved at execution time\n * - User-defined variable values resolved at execution time\n */\nexport interface UserWorkflow {\n\tworkflowId: string;\n\tuserId: string;\n\ttitle: string;\n\tdescription?: string;\n\tactive: boolean;\n\t/** Classification label for grouping workflows in the UI (e.g. \"식음\", \"객실\"). Copied from the source template. */\n\tcategory?: string;\n\n\t/** Reference to the original WorkflowTemplate (optional) */\n\ttemplateId?: string;\n\t/** The prompt/instruction content with {{variable}} placeholders */\n\tcontent: string;\n\t/** Structured workflow definition (tasks → response blocks). Required. */\n\tdefinition: WorkflowDefinition;\n\t/** Variable schema definitions (copied from template, used for UI rendering) */\n\tvariables?: Record<string, WorkflowVariable>;\n\t/** User-provided variable values (can contain template variables like {{today}}) */\n\tvariableValues?: Record<string, string>;\n\n\t/** Cron expression for scheduled execution (e.g., \"0 9 * * *\"). If not set, manual-only. */\n\tschedule?: string;\n\t/** IANA timezone (e.g., \"Asia/Seoul\"). Defaults to system timezone. */\n\ttimezone?: string;\n\n\t/** Unix timestamp of the last execution */\n\tlastRunAt?: number;\n\t/** Unix timestamp of the next scheduled execution */\n\tnextRunAt?: number;\n\t/** Thread ID of the last execution result */\n\tlastThreadId?: string;\n\n\t/**\n\t * ISO 8601 timestamp of the last update (used for sorting in list endpoints).\n\t * Typed as `string`, but the mongodb provider stores this via mongoose\n\t * `timestamps: true`, so at runtime it can be a `Date` instance (it only\n\t * serializes to an ISO string once it crosses HTTP as JSON). Treat as\n\t * `string | Date` when consuming this field in-process; comparators that\n\t * sort on it should coerce (e.g. `String(x.updatedAt ?? \"\")`) rather than\n\t * assume `.localeCompare` is available.\n\t */\n\tupdatedAt?: string;\n}\n"]}