@acorex-platform/module-ai-management-client 0.0.53 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{acorex-platform-module-ai-management-client-agent-registry-tool-configurator-widget-edit.component-CMsc3P9O.mjs → acorex-platform-module-ai-management-client-agent-registry-tool-configurator-widget-edit.component-CJjat56M.mjs} +2 -2
- package/fesm2022/acorex-platform-module-ai-management-client-agent-registry-tool-configurator-widget-edit.component-CJjat56M.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-ai-management-client-assist-delegated-agent-configurator-widget-edit.component-Dmi8vzfr.mjs → acorex-platform-module-ai-management-client-assist-delegated-agent-configurator-widget-edit.component-DSdzO0Zm.mjs} +10 -3
- package/fesm2022/acorex-platform-module-ai-management-client-assist-delegated-agent-configurator-widget-edit.component-DSdzO0Zm.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-ai-management-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-ai-management-client.mjs +35 -29
- package/fesm2022/acorex-platform-module-ai-management-client.mjs.map +1 -1
- package/i18n/en-AU/ai-management.json +817 -0
- package/i18n/en-US/ai-management.json +817 -0
- package/i18n/fa-IR/ai-management.json +817 -0
- package/package.json +1 -1
- package/types/acorex-platform-module-ai-management-client-contracts.d.ts +2 -0
- package/fesm2022/acorex-platform-module-ai-management-client-agent-registry-tool-configurator-widget-edit.component-CMsc3P9O.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-ai-management-client-assist-delegated-agent-configurator-widget-edit.component-Dmi8vzfr.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-ai-management-client.mjs","sources":["../../../../libs/modules/ai-management/client/src/lib/feature-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/menu.provider.ts","../../../../libs/modules/ai-management/client/src/lib/assist-permission-definition.builder.ts","../../../../libs/modules/ai-management/client/src/lib/permission-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/settings.provider.ts","../../../../libs/modules/ai-management/client/src/lib/features/tags/ai-model-purpose-tag.provider.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-assist.abstract.ts","../../../../libs/modules/ai-management/client/src/lib/features/types/ai-assist.types.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-engine.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-chat-display.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-platform-runtime-context.builder.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-run-abort.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/chat/ai-generated-image-persist.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-chat-composer-media.helpers.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-assist-prompt-box/ai-assist-prompt-box.component.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-assist-prompt-box/ai-assist-prompt-box.component.html","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-assist-prompt-box.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/assist-output-contract-from-input.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/extract-last-assistant-plain-text.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/build-structured-output-retry-user-text.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/parse-structured-assistant-text.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/repair-structured-assistant-parse.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/json-schema-mini-validator.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/validate-against-contract.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/run-structured-output-pipeline.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/output-contract-resolve.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-manager.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/widgets/agent-registry-tool-configurator/agent-registry-tool-configurator-widget.config.ts","../../../../libs/modules/ai-management/client/src/lib/features/widgets/assist-delegated-agent-configurator/assist-delegated-agent-configurator-widget.config.ts","../../../../libs/modules/ai-management/client/src/lib/widget-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/output-contract-transcript-segment.builtin-providers.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/platform-runtime-context-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/ai-management.module.ts","../../../../libs/modules/ai-management/client/src/lib/features/utils/ai-delegated-agent-prompt-preview.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/utils/assist-initial-messages.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/utils/assist-starter-prompts.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/tools/ai-chat-tool-run-context.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/tools/ai-chat-tool.llm-parameters.ts","../../../../libs/modules/ai-management/client/src/lib/features/chat/ai-chat-tts-playback.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-provider-payload.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-delegated-agent-transcript.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/validate-structured-assistant-response.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-assist-chat-model-catalog.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-default-model-picker.service.ts","../../../../libs/modules/ai-management/client/src/acorex-platform-module-ai-management-client.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n AXPFeatureDefinitionProvider,\n AXPFeatureDefinitionProviderContext,\n} from '@acorex-platform/framework-client/core';\nimport { AXPAiManagementFeatureKeys } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Feature Definition Provider ----\n\n/**\n * AI Management feature definitions.\n * ManageCatalog gates the Intelligence configuration menu (Platform Console edition).\n */\nexport class AXMAiManagementFeatureDefinitionProvider implements AXPFeatureDefinitionProvider {\n async provide(context: AXPFeatureDefinitionProviderContext): Promise<void> {\n const i18n = 'ai-management';\n context.addFeature(AXPAiManagementFeatureKeys.ManageCatalog, {\n title: `@${i18n}:features.manage-catalog.title`,\n description: `@${i18n}:features.manage-catalog.description`,\n defaultValue: false,\n type: 'boolean',\n });\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\r\nimport { AXPMenuProvider, AXPMenuProviderContext } from '@acorex-platform/framework-client/common';\r\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\r\nimport { inject, Injectable } from '@angular/core';\r\nimport {\r\n AXPAdministrationPermissionKeys,\r\n AXPAiManagementFeatureKeys,\r\n AXPAiManagementMenuKeys,\r\n RootConfig,\r\n} from '@acorex-platform/module-ai-management-client/contracts';\r\n\r\n//#endregion\r\n\r\n//#region ---- Menu Provider ----\r\n\r\n@Injectable()\r\nexport class AXMAiManagementMenuProvider implements AXPMenuProvider {\r\n private readonly entityService = inject(AXPEntityService);\r\n\r\n async provide(context: AXPMenuProviderContext): Promise<void> {\r\n const module = RootConfig.module;\r\n\r\n //#region ---- Configuration > AI Management (assists, models) ----\r\n\r\n // Platform Console edition only (same pattern as Identity Providers).\r\n const aiMenuPolicy = {\r\n features: [AXPAiManagementFeatureKeys.ManageCatalog],\r\n permissions: [AXPAdministrationPermissionKeys.MaintainAi],\r\n };\r\n\r\n const aiManagementConfigMenu = context.find(AXPAiManagementMenuKeys.AiManagementConfig);\r\n if (!aiManagementConfigMenu.exists) {\r\n context.find('Common:Menu:Configuration').addItems([\r\n {\r\n name: AXPAiManagementMenuKeys.AiManagementConfig,\r\n text: '@general:menus.ai-management.title',\r\n icon: module.icon,\r\n type: 'menu',\r\n priority: 8941,\r\n policy: aiMenuPolicy,\r\n children: [],\r\n },\r\n ]);\r\n }\r\n\r\n context.find(AXPAiManagementMenuKeys.AiManagementConfig).addItems([\r\n {\r\n name: AXPAiManagementMenuKeys.Agents,\r\n text: '@ai-management:module.menus.agents.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.agent.name),\r\n icon: RootConfig.entities.agent.icon,\r\n priority: -1,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Assists,\r\n text: '@ai-management:module.menus.assists.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.assist.name),\r\n icon: RootConfig.entities.assist.icon,\r\n priority: 0,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.OpenAiEndpoints,\r\n text: '@ai-management:module.menus.open-ai-endpoints.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.openAiEndpoint.name),\r\n icon: RootConfig.entities.openAiEndpoint.icon,\r\n priority: 2,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Models,\r\n text: '@ai-management:module.menus.models.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.model.name),\r\n icon: RootConfig.entities.model.icon,\r\n priority: 1,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Rules,\r\n text: '@ai-management:module.menus.rules.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.rule.name),\r\n icon: RootConfig.entities.rule.icon,\r\n priority: 3,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Skills,\r\n text: '@ai-management:module.menus.skills.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.skill.name),\r\n icon: RootConfig.entities.skill.icon,\r\n priority: 4,\r\n policy: aiMenuPolicy,\r\n },\r\n ]);\r\n\r\n //#endregion\r\n }\r\n}\r\n\r\n//#endregion\r\n","//#region ---- Imports ----\n\nimport { resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport type { AXMAiManagementAssistEntityModel } from '@acorex-platform/module-ai-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\n/** One assist row mapped for permission definition children. */\nexport interface AXMAiAssistPermissionRow {\n name: string;\n title: string;\n description?: string;\n}\n\n//#endregion\n\n//#region ---- Catalog load ----\n\n/**\n * Loads assist catalog rows for dynamic permission definitions.\n * Skips rows without a stable programmatic `name`.\n */\nexport async function loadAssistPermissionRows(\n entityService: AXPEntityService,\n localeId: string,\n): Promise<AXMAiAssistPermissionRow[]> {\n const assistData = entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<\n string,\n AXMAiManagementAssistEntityModel,\n AXMAiManagementAssistEntityModel,\n AXMAiManagementAssistEntityModel,\n AXMAiManagementAssistEntityModel\n >();\n\n const queryResult = await assistData.query({\n skip: 0,\n take: 500,\n sort: [{ field: 'name', dir: 'asc' }],\n });\n\n const items = (queryResult?.items ?? []) as AXMAiManagementAssistEntityModel[];\n const rows: AXMAiAssistPermissionRow[] = [];\n\n for (const item of items) {\n const name = item.name?.trim();\n if (!name) {\n continue;\n }\n\n const title = resolveMultiLanguageString(item.title, localeId).trim() || name;\n const descriptionRaw = item.description\n ? resolveMultiLanguageString(item.description, localeId).trim()\n : '';\n const description = descriptionRaw || undefined;\n\n rows.push({ name, title, description });\n }\n\n return rows.sort((a, b) => a.title.localeCompare(b.title, localeId, { sensitivity: 'base' }));\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AXPPermissionDefinitionProvider,\n AXPPermissionDefinitionProviderContext,\n} from '@acorex-platform/framework-client/auth';\nimport { AXPCommonPermissionGroupKeys } from '@acorex-platform/module-common-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { inject, Injectable, LOCALE_ID } from '@angular/core';\nimport { loadAssistPermissionRows } from './assist-permission-definition.builder';\nimport {\n AXMAiAssistPermissionKeys,\n AXPAdministrationPermissionKeys,\n} from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Permission Definition Provider ----\n\n/**\n * Registers AI section capabilities under Administration (including assist children).\n */\n@Injectable()\nexport class AXMPermissionDefinitionProvider implements AXPPermissionDefinitionProvider {\n private readonly entityService = inject(AXPEntityService);\n private readonly localeId = inject(LOCALE_ID);\n\n async define(context: AXPPermissionDefinitionProviderContext): Promise<void> {\n const keys = AXPAdministrationPermissionKeys;\n const groups = AXPCommonPermissionGroupKeys;\n const P = '@common:administration.permissions';\n const G = '@common:permission-groups';\n\n const assistRows = await loadAssistPermissionRows(this.entityService, this.localeId).catch(() => []);\n\n context.addGroup(groups.Administration.Root, `${G}.administration.title`, `${G}.administration.description`, { order: 120 });\n\n const groupBuilder = context\n .addGroup(\n groups.Administration.Ai,\n `${G}.administration-ai.title`,\n `${G}.administration-ai.description`,\n { parent: groups.Administration.Root, order: 50 },\n )\n .addPermission(keys.MaintainAi, `${P}.maintain-ai.title`, `${P}.maintain-ai.description`)\n .endPermission();\n\n let assistPermissionBuilder = groupBuilder.addPermission(\n keys.UseAiAssist,\n `${P}.use-ai-assist.title`,\n `${P}.use-ai-assist.description`,\n );\n\n for (const row of assistRows) {\n assistPermissionBuilder = assistPermissionBuilder.addChild(\n AXMAiAssistPermissionKeys.useForAssist(row.name),\n row.title,\n row.description,\n );\n }\n\n assistPermissionBuilder.endPermission().endGroup();\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AXP_SETTING_DEFINITION_PROVIDER,\n AXPSettingDefinitionProvider,\n AXPSettingDefinitionProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\nimport { AXPAiManagementSettings } from '@acorex-platform/module-ai-management-client/contracts';\nimport { objectKeyValueTransforms } from '@acorex-platform/framework-client/core';\nimport { Provider } from '@angular/core';\n\n//#endregion\n\n//#region ---- Settings Provider ----\n\nconst I18N = '@ai-management:settings';\n\nexport class AXMAiManagementSettingProvider implements AXPSettingDefinitionProvider {\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n // Extensions attach their own AI sections on this group (for example document reading and form designer).\n context\n .addGroup(\n 'ai-settings',\n `${I18N}.group.nav-title`,\n `${I18N}.group.description`,\n 'fa-light fa-robot',\n `${I18N}.group.title`,\n 60,\n )\n .addSection(\n 'global-ai',\n `${I18N}.section.global-ai.title`,\n `${I18N}.section.global-ai.description`,\n )\n .addSetting({\n key: AXPAiManagementSettings.DefaultAssistId,\n title: `${I18N}.default-assist.name.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n // Persist assist primary key (`id`); demo defaults come from settings seed/overrides.\n valueTransforms: objectKeyValueTransforms('id'),\n widget: {\n type: AXPWidgetsList.Editors.LookupBox,\n options: {\n entity: `${RootConfig.module.name}.${RootConfig.entities.assist.name}`,\n look: 'select',\n multiple: false,\n textField: 'title',\n valueField: 'id',\n hasClearButton: true,\n },\n },\n description: `${I18N}.default-assist.name.description`,\n })\n .addSetting({\n key: AXPAiManagementSettings.GlobalSystemPrompt,\n title: `${I18N}.global-system-prompt.prefix.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: undefined,\n widget: {\n type: AXPWidgetsList.Editors.LargeTextBox,\n layout: {\n stacked: true,\n },\n options: {\n rows: 8,\n placeholder: `${I18N}.global-system-prompt.prefix.placeholder`,\n },\n },\n description: `${I18N}.global-system-prompt.prefix.description`,\n })\n .endSection()\n .endGroup();\n }\n}\n\n/**\n * Registered after other Intelligence sections so Google Gemini stays last in that category.\n */\nexport class AXMAiManagementGeminiSettingProvider implements AXPSettingDefinitionProvider {\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n if (!context.hasGroup('ai-settings')) {\n return;\n }\n\n const intelligence = context.group('ai-settings');\n if (!intelligence) {\n return;\n }\n\n intelligence\n .addSection('gemini', `${I18N}.section.gemini.title`, `${I18N}.section.gemini.description`)\n .addSetting({\n key: AXPAiManagementSettings.Providers.Gemini.ApiKey,\n title: `${I18N}.gemini.api-key.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n // Server DB at-rest encryption; implies cacheable: false (no client IndexedDB).\n isEncrypted: true,\n defaultValue: undefined,\n widget: {\n type: AXPWidgetsList.Editors.TextBox,\n options: {\n placeholder: `${I18N}.gemini.api-key.placeholder`,\n },\n },\n description: `${I18N}.gemini.api-key.description`,\n })\n .endSection();\n }\n}\n\nexport function provideAiManagementGeminiSettings(): Provider {\n return {\n provide: AXP_SETTING_DEFINITION_PROVIDER,\n useClass: AXMAiManagementGeminiSettingProvider,\n multi: true,\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPTag, AXPTagProvider } from '@acorex-platform/framework-client/core';\nimport { Injectable } from '@angular/core';\n\n//#endregion\n\n/**\n * System tags for the AiModel entity `modelPurposes` field (tag-editor).\n * `title` values are stored as-is on the entity; keep them stable slugs.\n */\nconst AI_MODEL_PURPOSE_TAGS: AXPTag[] = [\n {\n id: 'ai-model-purpose-chat',\n title: 'chat',\n color: '#0284c7',\n description: 'Chat / text completion',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-vision',\n title: 'vision',\n color: '#7c3aed',\n description: 'Multimodal (image input in chat)',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-image',\n title: 'image',\n color: '#db2777',\n description: 'Image generation',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-speech',\n title: 'speech',\n color: '#16a34a',\n description: 'Speech to text',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-tts',\n title: 'tts',\n color: '#ea580c',\n description: 'Text to speech',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-video',\n title: 'video',\n color: '#0f766e',\n description: 'Video generation',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-live-voice',\n title: 'live-voice',\n color: '#c026d3',\n description: 'Realtime live voice (OpenAI Realtime / Gemini Live)',\n scope: 'system',\n },\n];\n\n//#region ---- Provider ----\n\n@Injectable()\nexport class AXMAiModelPurposeTagProvider extends AXPTagProvider {\n readonly name = 'ai-model-purpose';\n\n override provide(): Promise<AXPTag[]> {\n return Promise.resolve(AI_MODEL_PURPOSE_TAGS);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable } from '@angular/core';\nimport type { AXPAiAssistRunInput, AXPAiAssistRunResult, AXPAiAssistShowOptions } from '../types/ai-assist.types';\n\n//#endregion\n\n//#region ---- Abstract token ----\n\n/**\n * Optional cross-cutting AI assist: programmatic {@link run} and dialog {@link show}.\n * Implemented by {@link AXPAiManagerService}. Consumers outside ai-management should prefer hooks or optional injection.\n */\n@Injectable()\nexport abstract class AXPAiAssistService {\n abstract run(input: AXPAiAssistRunInput): Promise<AXPAiAssistRunResult>;\n\n /** Opens prompt UI; on Send runs {@link run} and closes the dialog. Cancel resolves `null`. */\n abstract show(options: AXPAiAssistShowOptions): Promise<AXPAiAssistRunResult | null>;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiAgentOutputContract } from '../engine/ai-agent-output-contract.types';\n\n//#endregion\n\n//#region ---- Structured output ----\n\n/** Default max completion tokens when the AiModel row has no `maxOutputTokens` and the caller omits `maxTokens`. */\nexport const AXPAiAssistDefaultStructuredMaxTokens = 32_000;\n\n/** Default maximum follow-up turns after the first model response when validating structured JSON (implementation may use this). */\nexport const AXPAiAssistDefaultMaxStructuredRetries = 3;\n\n/**\n * Validates parsed JSON from the assistant. Return the validated value (possibly narrowed), or throw with a message\n * the pipeline can send back to the model on retry.\n */\nexport type AXPAiStructuredValidator<T = unknown> = (parsed: unknown) => T | Promise<T>;\n\n/**\n * Thrown when {@link AXPAiAssistRunInput.expectStructuredOutput} is true but the assistant output could not be\n * parsed and optionally validated after all attempts.\n */\nexport class AXPAiStructuredOutputError extends Error {\n /** 1-based count of engine runs performed for this structured-output session. */\n readonly attempts: number;\n\n /** Truncated snapshot of the last assistant plain text (for debugging). */\n readonly lastAssistantText: string;\n\n /** Human-readable validation or parse failure detail. */\n readonly validationMessage: string;\n\n /** Why the pipeline stopped. */\n readonly code?: 'duplicate_assistant_output' | 'validation_exhausted';\n\n constructor(options: {\n message: string;\n attempts: number;\n lastAssistantText: string;\n validationMessage: string;\n cause?: unknown;\n code?: 'duplicate_assistant_output' | 'validation_exhausted';\n }) {\n super(options.message, options.cause !== undefined ? { cause: options.cause } : undefined);\n this.name = 'AXPAiStructuredOutputError';\n this.attempts = options.attempts;\n this.lastAssistantText = options.lastAssistantText;\n this.validationMessage = options.validationMessage;\n this.code = options.code;\n }\n}\n\n//#endregion\n\n//#region ---- Prompt surface ----\n\n/** One persisted user attachment (same storage contract as the AI chat composer). */\nexport interface AXPAiAssistUserMediaAttachment {\n /** `image` / `audio` / `file` (PDF, text, spreadsheets, and other document MIME types). */\n kind: 'image' | 'audio' | 'file';\n fileId: string;\n mimeType: string;\n name?: string;\n}\n\n/**\n * Payload when submitting the assist prompt box (text, optional target assist/agent, optional media).\n */\nexport interface AXPAiAssistPromptSubmitPayload {\n prompt: string;\n assistId?: string;\n userMediaAttachments: AXPAiAssistUserMediaAttachment[];\n}\n\n/** Execution options for a prompt-box submit (not user/prompt data). */\nexport interface AXPAiAssistPromptExecutionContext {\n abortSignal: AbortSignal;\n}\n\n//#endregion\n\n//#region ---- Context & run ----\n\n/**\n * Optional structured hints for a single assist run (serialized into the user message by the implementation).\n */\nexport interface AXPAiAssistRunContext {\n /** Short bullet hints appended to the prompt for the model. */\n hints?: string[];\n /** Extra system-level instruction for this run (implementation may emit a system message). */\n systemInstruction?: string;\n /** Arbitrary structured payload (JSON-serialized in the user message when present). */\n structuredContext?: unknown;\n}\n\n/**\n * Input for the AI assist `run` API (implemented in ai-management).\n */\nexport interface AXPAiAssistRunInput {\n prompt: string;\n /**\n * Optional images, audio, or documents (`fileId` from tenant storage). When non-empty, the implementation builds one multimodal\n * user message (same shape as the AI chat composer) plus the serialized prompt body as text segments.\n */\n userMediaAttachments?: AXPAiAssistUserMediaAttachment[];\n context?: AXPAiAssistRunContext;\n /**\n * Catalog assist id. When omitted, the platform default assist is used.\n */\n assistId?: string;\n maxSteps?: number;\n temperature?: number;\n /**\n * Max completion tokens for this engine run (when the provider supports it). Structured JSON runs apply a higher\n * default unless {@link structuredOutputMaxTokens} is set.\n */\n maxTokens?: number;\n /**\n * Declarative output contract for this run (preferred over legacy {@link expectStructuredOutput} flags).\n * Resolved with agent/assist defaults via {@link resolveEffectiveOutputContract}.\n */\n outputContract?: AXPAiAgentOutputContract;\n /** When true, implementation tries to parse assistant text as JSON into {@link AXPAiAssistRunResult.structured}. */\n expectStructuredOutput?: boolean;\n /** Extra instruction appended so the model returns JSON (used when {@link expectStructuredOutput} is true). */\n structuredOutputInstruction?: string;\n /**\n * Shallow merge over built-in platform runtime context fields (see ai-management implementation).\n */\n platformRuntimeNotes?: Record<string, unknown>;\n\n /**\n * Max extra engine turns after the first response when structured output is invalid (default {@link AXPAiAssistDefaultMaxStructuredRetries}).\n * Total attempts = 1 + maxStructuredRetries.\n */\n maxStructuredRetries?: number;\n\n /** Optional schema or domain validation after JSON parse. */\n structuredValidator?: AXPAiStructuredValidator;\n\n /**\n * When false, only one engine run is performed; invalid structured output throws {@link AXPAiStructuredOutputError}.\n * When true (default for {@link expectStructuredOutput}), invalid output triggers follow-up user messages in the same transcript.\n */\n retryOnInvalidStructure?: boolean;\n\n /**\n * Optional description of the expected JSON shape (TypeScript-style or JSON schema summary), appended to the first\n * user message and to retry prompts so the model stays aligned and retries are more accurate.\n */\n structuredOutputSchemaSummary?: string;\n\n /**\n * Overrides {@link maxTokens} for {@link expectStructuredOutput} runs only. Prefer setting this or leaving defaults so\n * the implementation can apply {@link AXPAiAssistDefaultStructuredMaxTokens} and avoid truncated JSON.\n */\n structuredOutputMaxTokens?: number;\n\n /**\n * Cancels this assist run. Not serialized to the engine JSON body.\n */\n abortSignal?: AbortSignal;\n}\n\n/**\n * Result of the AI assist `run` API.\n */\nexport interface AXPAiAssistRunResult {\n /** When false, structured validation exhausted or cannotComplete (future). */\n success?: boolean;\n /** Effective output contract kind for this run. */\n outputKind?: import('../engine/ai-agent-output-contract.types').AXPAiAgentOutputKind;\n /** Primary assistant reply text (extracted from the engine transcript). */\n text: string;\n /**\n * Present when {@link AXPAiAssistRunInput.expectStructuredOutput} is true: validated structured payload\n * (parse + optional {@link AXPAiAssistRunInput.structuredValidator}). On failure the implementation throws\n * {@link AXPAiStructuredOutputError} instead of returning.\n */\n structured?: unknown;\n /** Same as {@link structured} when using the execution-result envelope. */\n data?: unknown;\n /** Validation failures when returned without throwing (reserved). */\n validationErrors?: import('../assist/structured-output/execution-result.types').AXPAiAssistValidationError[];\n /** Full normalized transcript when available. */\n messages?: import('../engine/ai-engine.types').AXPAiChatMessage[];\n /**\n * When {@link AXPAiAssistRunInput.expectStructuredOutput} is false: engine usage / provider payload for that single run.\n * When true: {@link AXPAiAssistStructuredOutputRunRaw} with per-attempt usage and totals for debugging.\n */\n raw?: unknown;\n}\n\n//#endregion\n\n//#region ---- Structured run raw (debugging) ----\n\n/**\n * Token usage for a single engine run; numeric fields align with {@link AXPAiEngineUsageTotals} in this module\n * for stable client-side debugging contracts.\n */\nexport interface AXPAiAssistTokenUsageSnapshot {\n promptTokens: number;\n completionTokens: number;\n totalTokens: number;\n cachedPromptTokens?: number;\n}\n\n/**\n * One engine execution within a structured-output session.\n */\nexport interface AXPAiAssistStructuredOutputAttemptRecord {\n /** 1-based index of this engine run. */\n attemptIndex: number;\n /** Usage reported for this run only. */\n usage?: AXPAiAssistTokenUsageSnapshot;\n /** Whether a last-provider payload was present for this run. */\n hasLastProviderResult: boolean;\n}\n\n/**\n * Explicit `raw` shape for {@link AXPAiAssistRunResult} when {@link AXPAiAssistRunInput.expectStructuredOutput} is true.\n */\nexport interface AXPAiAssistStructuredOutputRunRaw {\n kind: 'structured-output';\n /** One entry per engine call (`runEngine` / structured-output retries). */\n attempts: AXPAiAssistStructuredOutputAttemptRecord[];\n /** Cumulative usage across all attempts. */\n totalUsage?: AXPAiAssistTokenUsageSnapshot;\n /** Count of engine runs in this session (same as the last `attemptIndex`). */\n finalAttempt: number;\n lastProviderResult?: unknown;\n}\n\n//#endregion\n\n//#region ---- Show prompt surface ----\n\n/**\n * Typical max width of the prompt box column inside the bottom overlay (maps to `contentMaxWidthPx`).\n */\nexport type AXPAiAssistPopupSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n\n/**\n * Indeterminate loading dialog shown while the prompt box executes an assist run after Send (model work /\n * structured-output retries).\n */\nexport interface AXPAiAssistRunLoadingDialogSpec {\n title: string;\n text: string;\n}\n\n/**\n * Options for the AI assist `show` prompt API: same run-related fields as {@link AXPAiAssistRunInput} except `prompt`,\n * plus UI chrome. The user-entered prompt from the surface is merged on Send.\n */\nexport interface AXPAiAssistShowOptions {\n /**\n * Prompt box header; must be translated by the caller. Entity list assist uses\n * `@extensions-ai-entity:assist.dialog-title.{type-level|selected|individual}`.\n */\n title: string;\n placeholder?: string;\n initialPrompt?: string;\n size?: AXPAiAssistPopupSize;\n context?: AXPAiAssistRunContext;\n /**\n * Optional catalog assist. When omitted, the tenant/platform default assist applies.\n */\n assistId?: string;\n maxSteps?: number;\n temperature?: number;\n maxTokens?: number;\n outputContract?: AXPAiAgentOutputContract;\n expectStructuredOutput?: boolean;\n structuredOutputInstruction?: string;\n platformRuntimeNotes?: Record<string, unknown>;\n maxStructuredRetries?: number;\n structuredValidator?: AXPAiStructuredValidator;\n retryOnInvalidStructure?: boolean;\n structuredOutputSchemaSummary?: string;\n structuredOutputMaxTokens?: number;\n\n /**\n * Ignored by {@link AXPAiManagerService.show}: the prompt box is the progress and Stop surface.\n * Callers may still pass translated strings for compatibility.\n */\n runLoadingDialog?: AXPAiAssistRunLoadingDialogSpec;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable } from '@angular/core';\nimport type { AXPAiEngineRunOptions, AXPAiEngineRunResult } from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Engine (abstract service) ----\n\n/**\n * Backend boundary for AI assist runs (chat + tool rounds). Connectivity implementations execute registry\n * commands/queries during the run loop.\n * Wire a concrete implementation via Angular providers (for example `provide: AXPAiEngine` with `useClass`).\n */\n@Injectable()\nexport abstract class AXPAiEngine {\n /**\n * Sends the conversation to the AI backend and returns updated messages (including tool rounds).\n */\n abstract run(options: AXPAiEngineRunOptions): Promise<AXPAiEngineRunResult>;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type {\n AXPAiChatMessage,\n AXPAiChatResponse,\n AXPAiDelegatedAgentResultSegment,\n} from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Message builders (client-only) ----\n\nexport function axpAiChatUserMessage(responses: AXPAiChatResponse[]): AXPAiChatMessage {\n return {\n role: 'user',\n responses,\n };\n}\n\n//#endregion\n\n//#region ---- Transcript read helpers (display only) ----\n\nexport function axpAiChatMessageIsDelegatedReflectionExcluded(message: AXPAiChatMessage): boolean {\n return message.delegatedReflection === true;\n}\n\n/** Reads typed specialist segments from a normalized {@code agent_result} payload. */\nexport function axpAiDelegatedAgentResultSegments(\n payload: { success?: boolean; data?: { responses?: AXPAiDelegatedAgentResultSegment[] } },\n): AXPAiDelegatedAgentResultSegment[] {\n if (payload.success !== true || !Array.isArray(payload.data?.responses)) {\n return [];\n }\n return payload.data.responses;\n}\n\n/** Plain text from specialist segments (text + think) for debug / preview UI. */\nexport function axpAiDelegatedAgentOutcomeResponsesPlainText(segments: AXPAiDelegatedAgentResultSegment[]): string {\n const parts: string[] = [];\n for (const s of segments) {\n if (s.type === 'text' || s.type === 'think') {\n const t = s.content.trim();\n if (t.length > 0) {\n parts.push(t);\n }\n }\n }\n return parts.join('\\n\\n').trim();\n}\n\nexport function axpAiChatToolResultBodyJson(message: AXPAiChatMessage): string {\n return axpAiChatToolOrAgentResultBodyJson(message);\n}\n\nexport function axpAiChatToolOrAgentResultBodyJson(message: AXPAiChatMessage): string {\n const tr = message.responses.find((r) => r.type === 'tool_result' || r.type === 'agent_result');\n if (!tr || (tr.type !== 'tool_result' && tr.type !== 'agent_result')) {\n return '';\n }\n try {\n return JSON.stringify(tr.content);\n } catch {\n return String(tr.content);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPPlatformScope, AXPRegionalSetting } from '@acorex-platform/framework-shared/core';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSettingsService } from '@acorex-platform/framework-client/common';\n\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { Injectable, inject } from '@angular/core';\nimport {\n assembleAxpAiPlatformRuntimeContext,\n type AXPAiPlatformRuntimeContext,\n} from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Builder ----\n\n/**\n * Builds {@link AXPAiPlatformRuntimeContext} from session and user-scoped regional settings.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPAiPlatformRuntimeContextBuilder {\n //#region ---- Services & Dependencies ----\n\n private readonly session = inject(AXPSessionService);\n private readonly settings = inject(AXPSettingsService);\n private readonly translation = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n /**\n * Resolves current user, tenant, application, UI language, and regional preferences from storage.\n */\n async build(): Promise<AXPAiPlatformRuntimeContext> {\n const user = this.session.user;\n const tenant = this.session.tenant;\n const application = this.session.application;\n const userScope = this.settings.scope(AXPPlatformScope.User);\n\n const [calendarRaw, tzRaw, countryRaw] = await Promise.all([\n userScope.get(AXPRegionalSetting.Calendar),\n userScope.get(AXPRegionalSetting.TimeZone),\n userScope.get(AXPRegionalSetting.Country),\n ]);\n\n const calendarSystem = typeof calendarRaw === 'string' && calendarRaw.trim() ? calendarRaw.trim() : undefined;\n const timeZone = typeof tzRaw === 'string' && tzRaw.trim() ? tzRaw.trim() : undefined;\n const country = typeof countryRaw === 'string' && countryRaw.trim() ? countryRaw.trim() : undefined;\n\n const locale = this.translation.getActiveLang();\n const now = new Date();\n\n return assembleAxpAiPlatformRuntimeContext({\n userDisplayName: [user?.title?.trim(), user?.name?.trim()].find((s) => s && s.length > 0),\n tenantTitle: resolveMultiLanguageString(tenant?.title, locale).trim() || tenant?.name?.trim(),\n applicationTitle:\n resolveMultiLanguageString(application?.title, locale).trim() || application?.name?.trim(),\n locale,\n calendarSystem,\n timeZone,\n country,\n now,\n });\n }\n\n //#endregion\n}\n\n//#endregion\n","//#region ---- Abort detection (client-only) ----\n\nfunction errorName(value: unknown): string | undefined {\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n const name = (value as { name?: unknown }).name;\n return typeof name === 'string' ? name : undefined;\n}\n\nfunction isAbortNamed(value: unknown): boolean {\n return errorName(value) === 'AbortError';\n}\n\nexport function isAiAssistAbortError(error: unknown, signal?: AbortSignal): boolean {\n if (signal?.aborted) {\n return true;\n }\n if (isAbortNamed(error)) {\n return true;\n }\n if (error && typeof error === 'object') {\n const cause = (error as { cause?: unknown }).cause;\n if (isAbortNamed(cause)) {\n return true;\n }\n }\n if (isAbortNamed(signal?.reason)) {\n return true;\n }\n return false;\n}\n\nexport function createAiAssistAbortError(message = 'AI assist run cancelled', options?: { cause?: unknown }): Error {\n const error = options && 'cause' in options ? new Error(message, { cause: options.cause }) : new Error(message);\n error.name = 'AbortError';\n return error;\n}\n\nexport function assertAiAssistNotAborted(signal?: AbortSignal): void {\n if (!signal?.aborted) {\n return;\n }\n const reason = signal.reason;\n if (reason instanceof Error && isAbortNamed(reason)) {\n throw reason;\n }\n throw createAiAssistAbortError('AI assist run cancelled', reason !== undefined ? { cause: reason } : undefined);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\nimport { AXPFileStorageStatus } from '@acorex-platform/framework-shared/core';\nimport { type AXPFileStorageService } from '@acorex-platform/framework-client/common';\n\n//#endregion\n\n//#region ---- Constants ----\n\n/** Max length for relaying an https image URL in tool_result when persistence fails (CORS, etc.). */\nexport const AI_GENERATED_IMAGE_MAX_REMOTE_URL_IN_TOOL = 2048;\n\n/** refType for files created from in-chat image tool output. */\nexport const AI_CHAT_GENERATED_IMAGE_REF_TYPE = `${RootConfig.module.name}.AiChatGeneratedImage`;\n\n/** refType for files created from in-chat text-to-speech tool output. */\nexport const AI_CHAT_GENERATED_SPEECH_REF_TYPE = `${RootConfig.module.name}.AiChatGeneratedSpeech`;\n\n/** refType for user-attached images in AI chat; {@link persistAiChatAttachmentImage} uses a batch ref id. */\nexport const AI_CHAT_ATTACHMENT_REF_TYPE = `${RootConfig.module.name}.AiChatAttachment`;\n\n/** File storage category for user chat image attachments. */\nexport const AI_CHAT_ATTACHMENT_CATEGORY = 'ai-chat-attachment';\n\n//#endregion\n\n//#region ---- URL / File conversion ----\n\n/**\n * Builds a File from a vendor image URL (https) or data URL (base64 image).\n */\nexport async function blobOrFileFromImageResult(\n imageUrl: string,\n defaultName = 'ai-generated.png',\n): Promise<File> {\n const trimmed = imageUrl.trim();\n if (!trimmed) {\n throw new Error('Image URL is empty.');\n }\n\n if (trimmed.startsWith('data:')) {\n const res = await fetch(trimmed);\n if (!res.ok) {\n throw new Error(`Failed to read data URL (${res.status}).`);\n }\n const blob = await res.blob();\n const mime = blob.type || parseDataUrlMime(trimmed) || 'image/png';\n return new File([blob], defaultName, { type: mime });\n }\n\n if (trimmed.startsWith('https://') || trimmed.startsWith('http://')) {\n const res = await fetch(trimmed);\n if (!res.ok) {\n throw new Error(`Failed to fetch image (${res.status}).`);\n }\n const blob = await res.blob();\n const mime =\n blob.type ||\n res.headers.get('Content-Type')?.split(';')[0]?.trim() ||\n 'image/png';\n const ext = mime.includes('jpeg') || mime.includes('jpg') ? 'jpg' : mime.includes('webp') ? 'webp' : 'png';\n return new File([blob], defaultName.replace(/\\.[^.]+$/, '') + '.' + ext, { type: mime });\n }\n\n throw new Error('Unsupported image URL scheme (expected https: or data:).');\n}\n\nfunction parseDataUrlMime(dataUrl: string): string | undefined {\n const m = /^data:([^;,]+)[;,]/.exec(dataUrl);\n return m?.[1]?.trim();\n}\n\n//#endregion\n\n//#region ---- Persistence ----\n\n/**\n * Saves the file and commits it so it appears in storage queries as committed.\n */\nexport async function persistAiGeneratedImage(\n fileStorage: AXPFileStorageService,\n file: File,\n ref: { refId: string; refType: string },\n): Promise<{ fileId: string }> {\n const info = await fileStorage.save({\n file,\n name: file.name,\n refId: ref.refId,\n refType: ref.refType,\n category: 'ai-generated-image',\n status: AXPFileStorageStatus.Temporary,\n });\n const fileId = info.fileId?.trim();\n if (!fileId) {\n throw new Error('File storage did not return a fileId.');\n }\n await fileStorage.commit(fileId);\n return { fileId };\n}\n\n/**\n * Persists a user-selected chat image; refId groups files uploaded in the same composer batch.\n */\nexport async function persistAiChatAttachmentImage(\n fileStorage: AXPFileStorageService,\n file: File,\n refId: string,\n): Promise<{ fileId: string }> {\n const trimmed = refId.trim();\n if (!trimmed) {\n throw new Error('refId is required for chat attachment persistence.');\n }\n const info = await fileStorage.save({\n file,\n name: file.name,\n refId: trimmed,\n refType: AI_CHAT_ATTACHMENT_REF_TYPE,\n category: AI_CHAT_ATTACHMENT_CATEGORY,\n status: AXPFileStorageStatus.Temporary,\n });\n const fileId = info.fileId?.trim();\n if (!fileId) {\n throw new Error('File storage did not return a fileId.');\n }\n await fileStorage.commit(fileId);\n return { fileId };\n}\n\n/**\n * Saves synthesized speech bytes and commits so the file id can be replayed in chat.\n */\nexport async function persistAiGeneratedSpeech(\n fileStorage: AXPFileStorageService,\n file: File,\n ref: { refId: string; refType: string },\n): Promise<{ fileId: string }> {\n const info = await fileStorage.save({\n file,\n name: file.name,\n refId: ref.refId,\n refType: ref.refType,\n category: 'ai-generated-speech',\n status: AXPFileStorageStatus.Temporary,\n });\n const fileId = info.fileId?.trim();\n if (!fileId) {\n throw new Error('File storage did not return a fileId.');\n }\n await fileStorage.commit(fileId);\n return { fileId };\n}\n\n//#endregion\n","//#region ---- Limits ----\n\n/** Max image file size for AI chat / assist composer attachments (bytes). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_IMAGE_BYTES = 20 * 1024 * 1024;\n\n/** Max images per composer batch (same cap as chat page). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_IMAGES_PER_TURN = 20;\n\n/** Max audio file size (bytes). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_AUDIO_BYTES = 25 * 1024 * 1024;\n\n/** Max audio files per composer batch. */\nexport const AXM_AI_CHAT_COMPOSER_MAX_AUDIO_PER_TURN = 5;\n\n/** Max document file size for PDF / text / office-style attachments (bytes). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_DOCUMENT_BYTES = 35 * 1024 * 1024;\n\n/** Max document files per composer batch. */\nexport const AXM_AI_CHAT_COMPOSER_MAX_DOCUMENTS_PER_TURN = 10;\n\n//#endregion\n\n//#region ---- Patterns ----\n\nconst CHAT_IMAGE_NAME_EXT_PATTERN = /\\.(png|jpe?g|gif|webp|bmp|svg|ico|heic|heif)$/i;\n\nconst CHAT_AUDIO_NAME_EXT_PATTERN = /\\.(mp3|m4a|aac|wav|webm|ogg|opus|flac)$/i;\n\nconst CHAT_DOCUMENT_NAME_EXT_PATTERN =\n /\\.(pdf|txt|md|markdown|csv|tsv|json|jsonl|xml|html?|yaml|yml|log|rtf|docx?|xlsx?|pptx?|odt|ods|odp)$/i;\n\n//#endregion\n\n//#region ---- Public API ----\n\n/**\n * Returns true for normal `image/*` types and for empty/octet-stream when the file name looks like an image.\n */\nexport function axmIsLikelyChatImageFile(file: File): boolean {\n const t = file.type?.trim() ?? '';\n if (t.startsWith('image/')) {\n return true;\n }\n if (t === 'application/octet-stream' || t === '') {\n return CHAT_IMAGE_NAME_EXT_PATTERN.test(file.name);\n }\n return false;\n}\n\n/**\n * Returns true for normal `audio/*` types and for empty/octet-stream when the file name looks like audio.\n */\nexport function axmIsLikelyChatAudioFile(file: File): boolean {\n const t = file.type?.trim() ?? '';\n if (t.startsWith('audio/')) {\n return true;\n }\n if (t === 'application/octet-stream' || t === '') {\n return CHAT_AUDIO_NAME_EXT_PATTERN.test(file.name);\n }\n return false;\n}\n\n/**\n * Returns true for PDF, plain text, common code/markup, CSV, and typical Office/OpenDocument uploads.\n */\nexport function axmIsLikelyChatDocumentFile(file: File): boolean {\n const t = file.type?.trim().toLowerCase() ?? '';\n if (t === 'application/pdf' || t.startsWith('text/')) {\n return true;\n }\n if (\n t === 'application/json' ||\n t === 'application/xml' ||\n t === 'application/javascript' ||\n t === 'application/typescript' ||\n t === 'text/csv' ||\n t === 'application/csv' ||\n t === 'text/tsv' ||\n t === 'application/rtf' ||\n t === 'text/rtf' ||\n t.includes('wordprocessingml') ||\n t.includes('spreadsheetml') ||\n t.includes('presentationml') ||\n t.includes('msword') ||\n t.includes('ms-excel') ||\n t.includes('ms-powerpoint') ||\n t.includes('opendocument')\n ) {\n return true;\n }\n if (t === 'application/octet-stream' || t === '') {\n return CHAT_DOCUMENT_NAME_EXT_PATTERN.test(file.name);\n }\n return false;\n}\n\n/**\n * MIME for storage/API when the browser omits or misreports `file.type` (images and common audio extensions).\n */\nexport function axmMimeTypeForChatAttachment(file: File): string {\n const t = file.type?.trim() ?? '';\n if (t.startsWith('image/')) {\n return t;\n }\n if (t.startsWith('audio/')) {\n return t;\n }\n if (t.startsWith('text/') || t === 'application/pdf' || t === 'application/json' || t === 'application/xml') {\n return t;\n }\n const m = /\\.([^.]+)$/i.exec(file.name);\n const ext = (m?.[1] ?? '').toLowerCase();\n const imageByExt: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n bmp: 'image/bmp',\n svg: 'image/svg+xml',\n ico: 'image/x-icon',\n heic: 'image/heic',\n heif: 'image/heif',\n };\n const audioByExt: Record<string, string> = {\n mp3: 'audio/mpeg',\n m4a: 'audio/mp4',\n aac: 'audio/aac',\n wav: 'audio/wav',\n webm: 'audio/webm',\n ogg: 'audio/ogg',\n opus: 'audio/opus',\n flac: 'audio/flac',\n };\n const docByExt: Record<string, string> = {\n pdf: 'application/pdf',\n txt: 'text/plain',\n md: 'text/markdown',\n markdown: 'text/markdown',\n csv: 'text/csv',\n tsv: 'text/tab-separated-values',\n json: 'application/json',\n jsonl: 'application/jsonl',\n xml: 'application/xml',\n html: 'text/html',\n htm: 'text/html',\n yaml: 'text/yaml',\n yml: 'text/yaml',\n log: 'text/plain',\n rtf: 'application/rtf',\n doc: 'application/msword',\n docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n xls: 'application/vnd.ms-excel',\n xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n ppt: 'application/vnd.ms-powerpoint',\n pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n odt: 'application/vnd.oasis.opendocument.text',\n ods: 'application/vnd.oasis.opendocument.spreadsheet',\n odp: 'application/vnd.oasis.opendocument.presentation',\n };\n return imageByExt[ext] ?? audioByExt[ext] ?? docByExt[ext] ?? 'application/octet-stream';\n}\n\n//#endregion\n","//#region ---- Imports ----\r\n\r\nimport { AXButtonModule } from '@acorex/components/button';\r\nimport { AXDecoratorModule } from '@acorex/components/decorators';\r\nimport { AXDropdownModule } from '@acorex/components/dropdown';\r\nimport { AXDropdownButtonModule } from '@acorex/components/dropdown-button';\r\nimport { AXTextAreaModule } from '@acorex/components/text-area';\r\nimport { AXToastService } from '@acorex/components/toast';\r\nimport { AXFileService } from '@acorex/core/file';\r\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\r\nimport { AXPFileStorageService } from '@acorex-platform/framework-client/common';\r\nimport { createRandomUuid } from '@acorex-platform/framework-shared/core';\r\nimport type {\r\n AXPAiAssistPromptExecutionContext,\r\n AXPAiAssistPromptSubmitPayload,\r\n AXPAiAssistRunResult,\r\n AXPAiAssistUserMediaAttachment,\r\n} from '../../types/ai-assist.types';\r\nimport { isAiAssistAbortError } from '../ai-run-abort.util';\r\nimport { persistAiChatAttachmentImage } from '../../chat/ai-generated-image-persist';\r\nimport {\r\n AXM_AI_CHAT_COMPOSER_MAX_AUDIO_BYTES,\r\n AXM_AI_CHAT_COMPOSER_MAX_AUDIO_PER_TURN,\r\n AXM_AI_CHAT_COMPOSER_MAX_DOCUMENT_BYTES,\r\n AXM_AI_CHAT_COMPOSER_MAX_DOCUMENTS_PER_TURN,\r\n AXM_AI_CHAT_COMPOSER_MAX_IMAGE_BYTES,\r\n AXM_AI_CHAT_COMPOSER_MAX_IMAGES_PER_TURN,\r\n axmIsLikelyChatAudioFile,\r\n axmIsLikelyChatDocumentFile,\r\n axmIsLikelyChatImageFile,\r\n axmMimeTypeForChatAttachment,\r\n} from '../ai-chat-composer-media.helpers';\r\nimport { CommonModule, isPlatformBrowser } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n OnDestroy,\r\n OnInit,\r\n PLATFORM_ID,\r\n ViewEncapsulation,\r\n computed,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\n\r\n//#endregion\r\n\r\n//#region ---- Draft types ----\r\n\r\ninterface AXMAiAssistDraftImage {\r\n clientId: string;\r\n previewUrl: string;\r\n mimeType: string;\r\n name?: string;\r\n fileId?: string;\r\n}\r\n\r\ninterface AXMAiAssistDraftAudio {\r\n clientId: string;\r\n mimeType: string;\r\n name?: string;\r\n fileId?: string;\r\n}\r\n\r\ninterface AXMAiAssistDraftFile {\r\n clientId: string;\r\n mimeType: string;\r\n name?: string;\r\n fileId?: string;\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---- Component ----\r\n\r\n/**\r\n * Floating prompt UI for AI assist: gradient chrome, inner composer, and image/audio/document attachments. Target assist/agent comes from optional initial ids on open.\r\n */\r\n@Component({\r\n selector: 'axm-ai-assist-prompt-box',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.None,\r\n host: {\r\n '(document:keydown.escape)': 'onDocumentEscape()',\r\n },\r\n templateUrl: './ai-assist-prompt-box.component.html',\r\n styleUrl: './ai-assist-prompt-box.component.css',\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n AXButtonModule,\r\n AXDecoratorModule,\r\n AXDropdownModule,\r\n AXDropdownButtonModule,\r\n AXTextAreaModule,\r\n AXTranslationModule,\r\n ],\r\n})\r\nexport class AXMAiAssistPromptBoxComponent implements OnInit, OnDestroy {\r\n //#region ---- Services & Dependencies ----\r\n\r\n private readonly toastService = inject(AXToastService);\r\n private readonly translation = inject(AXTranslationService);\r\n private readonly fileStorage = inject(AXPFileStorageService);\r\n private readonly fileService = inject(AXFileService);\r\n private readonly platformId = inject(PLATFORM_ID);\r\n\r\n //#endregion\r\n\r\n //#region ---- Inputs ----\r\n\r\n readonly title = input.required<string>();\r\n\r\n readonly placeholder = input<string>('');\r\n\r\n readonly initialPrompt = input<string>('');\r\n\r\n readonly contentMaxWidthPx = input<number>(680);\r\n\r\n readonly initialAssistId = input<string | undefined>(undefined);\r\n\r\n readonly runPrompt =\r\n input.required<\r\n (\r\n payload: AXPAiAssistPromptSubmitPayload,\r\n execution: AXPAiAssistPromptExecutionContext,\r\n ) => Promise<AXPAiAssistRunResult>\r\n >();\r\n\r\n readonly requestClose = input.required<(result: AXPAiAssistRunResult | null) => void>();\r\n\r\n //#endregion\r\n\r\n //#region ---- State ----\r\n\r\n readonly promptDraft = signal('');\r\n\r\n readonly runPhase = signal<'idle' | 'running' | 'stopping'>('idle');\r\n\r\n readonly busy = computed(() => this.runPhase() !== 'idle');\r\n\r\n readonly isComposerSaving = signal(false);\r\n\r\n readonly draftAttachmentGroupId = signal<string | null>(null);\r\n\r\n readonly draftComposerImages = signal<AXMAiAssistDraftImage[]>([]);\r\n\r\n readonly draftComposerAudios = signal<AXMAiAssistDraftAudio[]>([]);\r\n\r\n readonly draftComposerFiles = signal<AXMAiAssistDraftFile[]>([]);\r\n\r\n readonly assistTargetKey = signal('');\r\n\r\n private runAbortController: AbortController | null = null;\r\n\r\n //#endregion\r\n\r\n //#region ---- Computed ----\r\n\r\n readonly canSend = computed(() => {\r\n if (this.runPhase() !== 'idle' || this.isComposerSaving()) {\r\n return false;\r\n }\r\n const textOk = this.promptDraft().trim().length > 0;\r\n const draftImg = this.draftComposerImages();\r\n const draftAud = this.draftComposerAudios();\r\n const draftFiles = this.draftComposerFiles();\r\n const allImagesSaved = draftImg.length === 0 || draftImg.every((s) => Boolean(s.fileId?.trim()));\r\n const allAudiosSaved = draftAud.length === 0 || draftAud.every((s) => Boolean(s.fileId?.trim()));\r\n const allFilesSaved = draftFiles.length === 0 || draftFiles.every((s) => Boolean(s.fileId?.trim()));\r\n if (!allImagesSaved || !allAudiosSaved || !allFilesSaved) {\r\n return false;\r\n }\r\n if (draftImg.length === 0 && draftAud.length === 0 && draftFiles.length === 0) {\r\n return textOk;\r\n }\r\n return textOk || draftImg.length > 0 || draftAud.length > 0 || draftFiles.length > 0;\r\n });\r\n\r\n //#endregion\r\n\r\n //#region ---- Lifecycle ----\r\n\r\n async ngOnInit(): Promise<void> {\r\n this.promptDraft.set(this.initialPrompt().trim());\r\n\r\n const a = this.initialAssistId()?.trim();\r\n if (a) {\r\n this.assistTargetKey.set(`assist:${a}`);\r\n } else {\r\n this.assistTargetKey.set('');\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.abortActiveRun();\r\n for (const s of this.draftComposerImages()) {\r\n URL.revokeObjectURL(s.previewUrl);\r\n }\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- UI Handlers ----\r\n\r\n onPromptDraftChange(value: string | null | undefined): void {\r\n this.promptDraft.set((value ?? '').toString());\r\n }\r\n\r\n /**\r\n * Enter sends; Shift+Enter inserts a newline. IME composition Enter is left unchanged.\r\n */\r\n onPromptKeydown(event: KeyboardEvent): void {\r\n if (event.key !== 'Enter' || event.shiftKey || event.isComposing) {\r\n return;\r\n }\r\n event.preventDefault();\r\n void this.onSend();\r\n }\r\n\r\n onCancel(): void {\r\n if (this.runPhase() !== 'idle') {\r\n return;\r\n }\r\n this.requestClose()(null);\r\n }\r\n\r\n abortActiveRun(): void {\r\n this.runAbortController?.abort();\r\n }\r\n\r\n onStop(): void {\r\n if (this.runPhase() !== 'running') {\r\n return;\r\n }\r\n this.runPhase.set('stopping');\r\n this.runAbortController?.abort();\r\n }\r\n\r\n onMenuCancel(panel: { close: () => void }): void {\r\n panel.close();\r\n if (this.runPhase() !== 'idle') {\r\n return;\r\n }\r\n this.onCancel();\r\n }\r\n\r\n /**\r\n * Idle: close. Running: Stop (stay open). Stopping: ignore.\r\n */\r\n onDocumentEscape(): void {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.runPhase() === 'stopping') {\r\n return;\r\n }\r\n if (this.runPhase() === 'running') {\r\n this.onStop();\r\n return;\r\n }\r\n this.onCancel();\r\n }\r\n\r\n openImagePicker(): void {\r\n void this.pickComposerImages();\r\n }\r\n\r\n openAudioPicker(): void {\r\n void this.pickComposerAudios();\r\n }\r\n\r\n openDocumentPicker(): void {\r\n void this.pickComposerDocuments();\r\n }\r\n\r\n async onSend(): Promise<void> {\r\n if (this.runPhase() === 'running') {\r\n this.onStop();\r\n return;\r\n }\r\n if (!this.canSend()) {\r\n return;\r\n }\r\n const text = this.promptDraft().trim();\r\n const draftImg = this.draftComposerImages();\r\n const draftAud = this.draftComposerAudios();\r\n const draftFiles = this.draftComposerFiles();\r\n for (const s of draftImg) {\r\n if (!s.fileId?.trim()) {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const msg = await this.translation.translateAsync('@ai-management:chat.images-still-saving');\r\n await this.toastService.show({ color: 'warning', title: errTitle, content: msg });\r\n return;\r\n }\r\n }\r\n for (const s of draftAud) {\r\n if (!s.fileId?.trim()) {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const msg = await this.translation.translateAsync('@ai-management:chat.audio-still-saving');\r\n await this.toastService.show({ color: 'warning', title: errTitle, content: msg });\r\n return;\r\n }\r\n }\r\n for (const s of draftFiles) {\r\n if (!s.fileId?.trim()) {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const msg = await this.translation.translateAsync('@ai-management:chat.documents-still-saving');\r\n await this.toastService.show({ color: 'warning', title: errTitle, content: msg });\r\n return;\r\n }\r\n }\r\n\r\n const key = this.assistTargetKey().trim();\r\n let assistId: string | undefined;\r\n if (key.startsWith('assist:')) {\r\n assistId = key.slice('assist:'.length).trim() || undefined;\r\n }\r\n\r\n const userMediaAttachments: AXPAiAssistUserMediaAttachment[] = [\r\n ...draftImg.map((s) => ({\r\n kind: 'image' as const,\r\n fileId: s.fileId!.trim(),\r\n mimeType: s.mimeType.trim(),\r\n ...(s.name?.trim() ? { name: s.name.trim() } : {}),\r\n })),\r\n ...draftAud.map((s) => ({\r\n kind: 'audio' as const,\r\n fileId: s.fileId!.trim(),\r\n mimeType: s.mimeType.trim(),\r\n ...(s.name?.trim() ? { name: s.name.trim() } : {}),\r\n })),\r\n ...draftFiles.map((s) => ({\r\n kind: 'file' as const,\r\n fileId: s.fileId!.trim(),\r\n mimeType: s.mimeType.trim(),\r\n ...(s.name?.trim() ? { name: s.name.trim() } : {}),\r\n })),\r\n ];\r\n\r\n const payload: AXPAiAssistPromptSubmitPayload = {\r\n prompt: text,\r\n assistId,\r\n userMediaAttachments,\r\n };\r\n\r\n const controller = new AbortController();\r\n this.runAbortController = controller;\r\n this.runPhase.set('running');\r\n try {\r\n const result = await this.runPrompt()(payload, { abortSignal: controller.signal });\r\n this.requestClose()(result);\r\n } catch (err) {\r\n if (isAiAssistAbortError(err, controller.signal)) {\r\n return;\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const fallback = await this.translation.translateAsync('@ai-management:assist-popup.run-error');\r\n const content = err instanceof Error ? err.message : fallback;\r\n await this.toastService.show({ color: 'danger', title: errTitle, content });\r\n } finally {\r\n if (this.runAbortController === controller) {\r\n this.runAbortController = null;\r\n }\r\n this.runPhase.set('idle');\r\n }\r\n }\r\n\r\n removeDraftImage(clientId: string): void {\r\n const id = clientId.trim();\r\n if (!id) {\r\n return;\r\n }\r\n this.draftComposerImages.update((prev) => {\r\n const slot = prev.find((s) => s.clientId === id);\r\n if (slot) {\r\n URL.revokeObjectURL(slot.previewUrl);\r\n }\r\n const next = prev.filter((s) => s.clientId !== id);\r\n if (\r\n next.length === 0 &&\r\n this.draftComposerAudios().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n return next;\r\n });\r\n }\r\n\r\n removeDraftAudio(clientId: string): void {\r\n const id = clientId.trim();\r\n if (!id) {\r\n return;\r\n }\r\n this.draftComposerAudios.update((prev) => {\r\n const next = prev.filter((s) => s.clientId !== id);\r\n if (\r\n next.length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n return next;\r\n });\r\n }\r\n\r\n removeDraftFile(clientId: string): void {\r\n const id = clientId.trim();\r\n if (!id) {\r\n return;\r\n }\r\n this.draftComposerFiles.update((prev) => {\r\n const next = prev.filter((s) => s.clientId !== id);\r\n if (\r\n next.length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerAudios().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n return next;\r\n });\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- Composer media (mirrors chat page) ----\r\n\r\n private async pickComposerImages(): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.busy() || this.isComposerSaving()) {\r\n return;\r\n }\r\n try {\r\n const files = await this.fileService.choose({\r\n multiple: true,\r\n accept: 'image/*',\r\n });\r\n if (files.length === 0) {\r\n return;\r\n }\r\n await this.processComposerImageFiles(files);\r\n } catch {\r\n /* user cancelled */\r\n }\r\n }\r\n\r\n private async pickComposerAudios(): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.busy() || this.isComposerSaving()) {\r\n return;\r\n }\r\n try {\r\n const files = await this.fileService.choose({\r\n multiple: true,\r\n accept: 'audio/*',\r\n });\r\n if (files.length === 0) {\r\n return;\r\n }\r\n await this.processComposerAudioFiles(files);\r\n } catch {\r\n /* user cancelled */\r\n }\r\n }\r\n\r\n private async pickComposerDocuments(): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.busy() || this.isComposerSaving()) {\r\n return;\r\n }\r\n try {\r\n const files = await this.fileService.choose({\r\n multiple: true,\r\n accept:\r\n '.pdf,.txt,.md,.csv,.tsv,.json,.jsonl,.xml,.html,.htm,.yaml,.yml,.log,.rtf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.odt,.ods,.odp,application/pdf,text/*,application/json',\r\n });\r\n if (files.length === 0) {\r\n return;\r\n }\r\n await this.processComposerDocumentFiles(files);\r\n } catch {\r\n /* user cancelled */\r\n }\r\n }\r\n\r\n private async processComposerImageFiles(files: File[]): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n let groupId = this.draftAttachmentGroupId();\r\n if (!groupId?.trim()) {\r\n groupId = createRandomUuid();\r\n this.draftAttachmentGroupId.set(groupId);\r\n }\r\n const gid = groupId.trim();\r\n\r\n const existing = this.draftComposerImages().length;\r\n if (existing + files.length > AXM_AI_CHAT_COMPOSER_MAX_IMAGES_PER_TURN) {\r\n await this.showUploadWarning('@ai-management:chat.upload-too-many');\r\n return;\r\n }\r\n\r\n const newSlots: AXMAiAssistDraftImage[] = [];\r\n const filesForPersist: File[] = [];\r\n\r\n for (const file of files) {\r\n if (!axmIsLikelyChatImageFile(file)) {\r\n await this.showUploadWarning('@ai-management:chat.upload-invalid-type');\r\n return;\r\n }\r\n if (file.size > AXM_AI_CHAT_COMPOSER_MAX_IMAGE_BYTES) {\r\n await this.showUploadWarning('@ai-management:chat.upload-too-large');\r\n return;\r\n }\r\n const mimeType = axmMimeTypeForChatAttachment(file);\r\n const fileForStorage =\r\n file.type.trim().startsWith('image/') && file.type.trim().length > 0\r\n ? file\r\n : new File([file], file.name, { type: mimeType });\r\n newSlots.push({\r\n clientId: createRandomUuid(),\r\n previewUrl: URL.createObjectURL(file),\r\n mimeType,\r\n name: file.name,\r\n });\r\n filesForPersist.push(fileForStorage);\r\n }\r\n\r\n this.draftComposerImages.update((prev) => [...prev, ...newSlots]);\r\n\r\n this.isComposerSaving.set(true);\r\n try {\r\n for (let i = 0; i < filesForPersist.length; i++) {\r\n const file = filesForPersist[i];\r\n const clientId = newSlots[i].clientId;\r\n try {\r\n const { fileId } = await persistAiChatAttachmentImage(this.fileStorage, file, gid);\r\n this.draftComposerImages.update((prev) =>\r\n prev.map((s) => (s.clientId === clientId ? { ...s, fileId } : s)),\r\n );\r\n } catch (e) {\r\n const msg = e instanceof Error ? e.message : String(e);\r\n this.draftComposerImages.update((prev) => {\r\n const slot = prev.find((s) => s.clientId === clientId);\r\n if (slot) {\r\n URL.revokeObjectURL(slot.previewUrl);\r\n }\r\n return prev.filter((s) => s.clientId !== clientId);\r\n });\r\n if (\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerAudios().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const uploadFailed = await this.translation.translateAsync('@ai-management:chat.upload-error');\r\n await this.toastService.show({\r\n color: 'danger',\r\n title: errTitle,\r\n content: `${uploadFailed} ${msg}`,\r\n });\r\n return;\r\n }\r\n }\r\n } finally {\r\n this.isComposerSaving.set(false);\r\n }\r\n }\r\n\r\n private async processComposerAudioFiles(files: File[]): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n let groupId = this.draftAttachmentGroupId();\r\n if (!groupId?.trim()) {\r\n groupId = createRandomUuid();\r\n this.draftAttachmentGroupId.set(groupId);\r\n }\r\n const gid = groupId.trim();\r\n\r\n const existing = this.draftComposerAudios().length;\r\n if (existing + files.length > AXM_AI_CHAT_COMPOSER_MAX_AUDIO_PER_TURN) {\r\n await this.showUploadWarning('@ai-management:chat.upload-audio-too-many');\r\n return;\r\n }\r\n\r\n const newSlots: AXMAiAssistDraftAudio[] = [];\r\n const filesForPersist: File[] = [];\r\n\r\n for (const file of files) {\r\n if (!axmIsLikelyChatAudioFile(file)) {\r\n await this.showUploadWarning('@ai-management:chat.upload-audio-invalid-type');\r\n return;\r\n }\r\n if (file.size > AXM_AI_CHAT_COMPOSER_MAX_AUDIO_BYTES) {\r\n await this.showUploadWarning('@ai-management:chat.upload-audio-too-large');\r\n return;\r\n }\r\n const mimeType = axmMimeTypeForChatAttachment(file);\r\n const fileForStorage =\r\n file.type.trim().startsWith('audio/') && file.type.trim().length > 0\r\n ? file\r\n : new File([file], file.name, { type: mimeType });\r\n newSlots.push({\r\n clientId: createRandomUuid(),\r\n mimeType,\r\n name: file.name,\r\n });\r\n filesForPersist.push(fileForStorage);\r\n }\r\n\r\n this.draftComposerAudios.update((prev) => [...prev, ...newSlots]);\r\n\r\n this.isComposerSaving.set(true);\r\n try {\r\n for (let i = 0; i < filesForPersist.length; i++) {\r\n const file = filesForPersist[i];\r\n const clientId = newSlots[i].clientId;\r\n try {\r\n const { fileId } = await persistAiChatAttachmentImage(this.fileStorage, file, gid);\r\n this.draftComposerAudios.update((prev) =>\r\n prev.map((s) => (s.clientId === clientId ? { ...s, fileId } : s)),\r\n );\r\n } catch (e) {\r\n const msg = e instanceof Error ? e.message : String(e);\r\n this.draftComposerAudios.update((prev) => prev.filter((s) => s.clientId !== clientId));\r\n if (\r\n this.draftComposerAudios().length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const uploadFailed = await this.translation.translateAsync('@ai-management:chat.upload-audio-error');\r\n await this.toastService.show({\r\n color: 'danger',\r\n title: errTitle,\r\n content: `${uploadFailed} ${msg}`,\r\n });\r\n return;\r\n }\r\n }\r\n } finally {\r\n this.isComposerSaving.set(false);\r\n }\r\n }\r\n\r\n private async processComposerDocumentFiles(files: File[]): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n let groupId = this.draftAttachmentGroupId();\r\n if (!groupId?.trim()) {\r\n groupId = createRandomUuid();\r\n this.draftAttachmentGroupId.set(groupId);\r\n }\r\n const gid = groupId.trim();\r\n\r\n const existing = this.draftComposerFiles().length;\r\n if (existing + files.length > AXM_AI_CHAT_COMPOSER_MAX_DOCUMENTS_PER_TURN) {\r\n await this.showUploadWarning('@ai-management:chat.upload-documents-too-many');\r\n return;\r\n }\r\n\r\n const newSlots: AXMAiAssistDraftFile[] = [];\r\n const filesForPersist: File[] = [];\r\n\r\n for (const file of files) {\r\n if (!axmIsLikelyChatDocumentFile(file)) {\r\n await this.showUploadWarning('@ai-management:chat.upload-documents-invalid-type');\r\n return;\r\n }\r\n if (file.size > AXM_AI_CHAT_COMPOSER_MAX_DOCUMENT_BYTES) {\r\n await this.showUploadWarning('@ai-management:chat.upload-documents-too-large');\r\n return;\r\n }\r\n const mimeType = axmMimeTypeForChatAttachment(file);\r\n const fileForStorage =\r\n file.type.trim().length > 0 && file.type.trim() !== 'application/octet-stream'\r\n ? file\r\n : new File([file], file.name, { type: mimeType });\r\n newSlots.push({\r\n clientId: createRandomUuid(),\r\n mimeType,\r\n name: file.name,\r\n });\r\n filesForPersist.push(fileForStorage);\r\n }\r\n\r\n this.draftComposerFiles.update((prev) => [...prev, ...newSlots]);\r\n\r\n this.isComposerSaving.set(true);\r\n try {\r\n for (let i = 0; i < filesForPersist.length; i++) {\r\n const file = filesForPersist[i];\r\n const clientId = newSlots[i].clientId;\r\n try {\r\n const { fileId } = await persistAiChatAttachmentImage(this.fileStorage, file, gid);\r\n this.draftComposerFiles.update((prev) =>\r\n prev.map((s) => (s.clientId === clientId ? { ...s, fileId } : s)),\r\n );\r\n } catch (e) {\r\n const msg = e instanceof Error ? e.message : String(e);\r\n this.draftComposerFiles.update((prev) => prev.filter((s) => s.clientId !== clientId));\r\n if (\r\n this.draftComposerFiles().length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerAudios().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const uploadFailed = await this.translation.translateAsync('@ai-management:chat.upload-documents-error');\r\n await this.toastService.show({\r\n color: 'danger',\r\n title: errTitle,\r\n content: `${uploadFailed} ${msg}`,\r\n });\r\n return;\r\n }\r\n }\r\n } finally {\r\n this.isComposerSaving.set(false);\r\n }\r\n }\r\n\r\n private async showUploadWarning(translationKey: string): Promise<void> {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const content = await this.translation.translateAsync(translationKey);\r\n await this.toastService.show({ color: 'warning', title: errTitle, content });\r\n }\r\n\r\n //#endregion\r\n}\r\n\r\n//#endregion\r\n","<div\r\n class=\"axm-ai-assist-prompt-box flex flex-col gap-2.5 min-h-0 w-full\"\r\n [style.max-width.px]=\"contentMaxWidthPx()\"\r\n>\r\n <div\r\n class=\"axm-ai-assist-prompt-box__eyebrow flex items-center justify-between gap-3 shrink-0 px-0.5\"\r\n >\r\n <div\r\n class=\"axm-ai-assist-prompt-box__brand inline-flex min-w-0 items-center gap-2\"\r\n >\r\n <span class=\"axm-ai-assist-prompt-box__brand-mark\" aria-hidden=\"true\">\r\n <i class=\"fa-light fa-sparkles\" aria-hidden=\"true\"></i>\r\n </span>\r\n <span class=\"axm-ai-assist-prompt-box__brand-title truncate\">{{\r\n title()\r\n }}</span>\r\n </div>\r\n <ax-button\r\n class=\"shrink-0 ax-sm\"\r\n look=\"blank\"\r\n color=\"default\"\r\n type=\"button\"\r\n [iconOnly]=\"true\"\r\n [disabled]=\"busy()\"\r\n [attr.aria-label]=\"\r\n ('@general:actions.close.title' | translate | async) ?? ''\r\n \"\r\n (onClick)=\"onCancel()\"\r\n >\r\n <ax-prefix>\r\n <i class=\"fa-light fa-xmark\" aria-hidden=\"true\"></i>\r\n </ax-prefix>\r\n </ax-button>\r\n </div>\r\n\r\n <div class=\"axm-ai-assist-prompt-box__sheet flex min-h-0 flex-col gap-2\">\r\n @if (\r\n draftComposerImages().length > 0 ||\r\n draftComposerAudios().length > 0 ||\r\n draftComposerFiles().length > 0 ||\r\n isComposerSaving()\r\n ) {\r\n <div\r\n class=\"shrink-0 rounded-xl border border-default/45 dark:border-darker bg-lightest/90 p-1.5 flex flex-col gap-1.5\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.composer-attachments-region'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n >\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-1.5 text-[0.65rem] text-muted\"\r\n >\r\n <span>\r\n @if (isComposerSaving()) {\r\n {{ '@ai-management:chat.composer-uploading' | translate | async }}\r\n } @else {\r\n @if (draftComposerImages().length > 0) {\r\n <span\r\n >{{ draftComposerImages().length }}\r\n {{\r\n '@ai-management:chat.composer-images-count'\r\n | translate\r\n | async\r\n }}</span\r\n >\r\n }\r\n @if (\r\n draftComposerImages().length > 0 &&\r\n draftComposerAudios().length > 0\r\n ) {\r\n <span class=\"mx-1\">·</span>\r\n }\r\n @if (draftComposerAudios().length > 0) {\r\n <span\r\n >{{ draftComposerAudios().length }}\r\n {{\r\n '@ai-management:chat.composer-audio-count'\r\n | translate\r\n | async\r\n }}</span\r\n >\r\n }\r\n @if (draftComposerFiles().length > 0) {\r\n @if (\r\n draftComposerImages().length > 0 ||\r\n draftComposerAudios().length > 0\r\n ) {\r\n <span class=\"mx-1\">·</span>\r\n }\r\n <span\r\n >{{ draftComposerFiles().length }}\r\n {{\r\n '@ai-management:chat.composer-documents-count'\r\n | translate\r\n | async\r\n }}</span\r\n >\r\n }\r\n }\r\n </span>\r\n </div>\r\n @if (draftComposerImages().length > 0) {\r\n <div class=\"flex flex-wrap gap-1.5\">\r\n @for (slot of draftComposerImages(); track slot.clientId) {\r\n <div\r\n class=\"relative h-12 w-12 shrink-0 overflow-hidden rounded-md border border-default/60 dark:border-darker bg-lightest\"\r\n >\r\n <img\r\n [src]=\"slot.previewUrl\"\r\n [alt]=\"slot.name ?? ''\"\r\n class=\"h-full w-full object-cover\"\r\n />\r\n @if (!slot.fileId) {\r\n <span\r\n class=\"absolute inset-0 flex items-center justify-center bg-default/40 text-[0.6rem] font-medium text-on-lightest\"\r\n >…</span\r\n >\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"absolute end-0.5 top-0.5 flex h-4 w-4 items-center justify-center rounded bg-default/80 text-[0.65rem] leading-none text-on-lightest hover:bg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400\"\r\n [disabled]=\"busy() || isComposerSaving()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.remove-draft-image'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (click)=\"removeDraftImage(slot.clientId)\"\r\n >\r\n ×\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n @if (draftComposerAudios().length > 0) {\r\n <div class=\"flex flex-col gap-1\">\r\n @for (slot of draftComposerAudios(); track slot.clientId) {\r\n <div\r\n class=\"flex items-center justify-between gap-1.5 rounded border border-default/60 dark:border-darker bg-lightest px-1.5 py-1 text-[0.65rem] min-w-0\"\r\n >\r\n <span\r\n class=\"truncate text-on-lightest\"\r\n [attr.title]=\"slot.name ?? ''\"\r\n >\r\n {{\r\n '@ai-management:chat.attached-audio-label'\r\n | translate\r\n | async\r\n }}:\r\n {{\r\n slot.name?.trim() ||\r\n ('@ai-management:chat.audio-untitled' | translate | async)\r\n }}\r\n </span>\r\n @if (!slot.fileId) {\r\n <span class=\"text-muted shrink-0\">…</span>\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"shrink-0 flex h-5 w-5 items-center justify-center rounded bg-default/80 text-[0.75rem] leading-none text-on-lightest hover:bg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400\"\r\n [disabled]=\"busy() || isComposerSaving()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.remove-draft-audio'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (click)=\"removeDraftAudio(slot.clientId)\"\r\n >\r\n ×\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n @if (draftComposerFiles().length > 0) {\r\n <div class=\"flex flex-col gap-1\">\r\n @for (slot of draftComposerFiles(); track slot.clientId) {\r\n <div\r\n class=\"flex items-center justify-between gap-1.5 rounded border border-default/60 dark:border-darker bg-lightest px-1.5 py-1 text-[0.65rem] min-w-0\"\r\n >\r\n <span\r\n class=\"truncate text-on-lightest\"\r\n [attr.title]=\"slot.name ?? ''\"\r\n >\r\n {{\r\n '@ai-management:chat.attached-document-label'\r\n | translate\r\n | async\r\n }}:\r\n {{\r\n slot.name?.trim() ||\r\n ('@ai-management:chat.document-untitled'\r\n | translate\r\n | async)\r\n }}\r\n </span>\r\n @if (!slot.fileId) {\r\n <span class=\"text-muted shrink-0\">…</span>\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"shrink-0 flex h-5 w-5 items-center justify-center rounded bg-default/80 text-[0.75rem] leading-none text-on-lightest hover:bg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400\"\r\n [disabled]=\"busy() || isComposerSaving()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.remove-draft-document'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (click)=\"removeDraftFile(slot.clientId)\"\r\n >\r\n ×\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"axm-ai-assist-prompt-box__body flex min-h-0 flex-col\">\r\n <ax-text-area\r\n class=\"axm-ai-assist-prompt-box__prompt-input w-full min-h-0\"\r\n [rows]=\"3\"\r\n [disabled]=\"busy()\"\r\n [ngModel]=\"promptDraft()\"\r\n (ngModelChange)=\"onPromptDraftChange($event)\"\r\n (keydown)=\"onPromptKeydown($event)\"\r\n [placeholder]=\"\r\n placeholder().trim().length > 0\r\n ? placeholder()\r\n : (('@ai-management:assist-popup.placeholder'\r\n | translate\r\n | async) ?? '')\r\n \"\r\n ></ax-text-area>\r\n </div>\r\n\r\n <div\r\n class=\"axm-ai-assist-prompt-box__footer flex shrink-0 items-center justify-between gap-2\"\r\n >\r\n <ax-button\r\n class=\"axm-ai-assist-prompt-box__menu-trigger\"\r\n look=\"solid\"\r\n color=\"primary\"\r\n type=\"button\"\r\n [iconOnly]=\"true\"\r\n [disabled]=\"busy()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:assist-popup.composer-menu-aria'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n >\r\n <ax-prefix>\r\n <i class=\"fa-light fa-plus text-sm\" aria-hidden=\"true\"></i>\r\n </ax-prefix>\r\n <ax-dropdown-panel #composerMenu>\r\n <ax-button-item-list class=\"min-w-56\">\r\n <ax-button-item\r\n [text]=\"\r\n ('@ai-management:chat.upload-images' | translate | async) ?? ''\r\n \"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.upload-images-aria'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (onClick)=\"openImagePicker(); composerMenu.close()\"\r\n >\r\n <ax-prefix>\r\n <i\r\n class=\"fa-light fa-image size-4 text-center\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </ax-prefix>\r\n </ax-button-item>\r\n <ax-button-item\r\n [text]=\"\r\n ('@ai-management:chat.upload-audio' | translate | async) ?? ''\r\n \"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.upload-audio-aria' | translate | async) ??\r\n ''\r\n \"\r\n (onClick)=\"openAudioPicker(); composerMenu.close()\"\r\n >\r\n <ax-prefix>\r\n <i\r\n class=\"fa-light fa-microphone size-4 text-center\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </ax-prefix>\r\n </ax-button-item>\r\n <ax-button-item\r\n [text]=\"\r\n ('@ai-management:chat.upload-documents' | translate | async) ??\r\n ''\r\n \"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.upload-documents-aria'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (onClick)=\"openDocumentPicker(); composerMenu.close()\"\r\n >\r\n <ax-prefix>\r\n <i\r\n class=\"fa-light fa-paperclip size-4 text-center\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </ax-prefix>\r\n </ax-button-item>\r\n </ax-button-item-list>\r\n </ax-dropdown-panel>\r\n </ax-button>\r\n\r\n <ax-button\r\n class=\"axm-ai-assist-prompt-box__send axm-ai-assist-prompt-box__send-gradient\"\r\n color=\"primary\"\r\n type=\"button\"\r\n [disabled]=\"runPhase() === 'stopping' || (runPhase() === 'idle' && !canSend())\"\r\n [text]=\"\r\n runPhase() === 'stopping'\r\n ? (('@ai-management:assist-popup.stopping' | translate | async) ??\r\n '')\r\n : runPhase() === 'running'\r\n ? (('@ai-management:assist-popup.stop' | translate | async) ?? '')\r\n : (('@ai-management:assist-popup.generate' | translate | async) ??\r\n '')\r\n \"\r\n (onClick)=\"onSend()\"\r\n ></ax-button>\r\n </div>\r\n </div>\r\n</div>\r\n","//#region ---- Imports ----\n\nimport type {\n AXPAiAssistPromptExecutionContext,\n AXPAiAssistPromptSubmitPayload,\n AXPAiAssistRunResult,\n AXPAiAssistShowOptions,\n} from '../types/ai-assist.types';\nimport { AXMAiAssistPromptBoxComponent } from './ai-assist-prompt-box/ai-assist-prompt-box.component';\nimport { AXOverlayService, type AXOverlayRef } from '@acorex/cdk/overlay';\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ---- Service ----\n\n/**\n * Opens the AI assist prompt box in a bottom overlay using {@link AXOverlayService} (`centered: false`, panel CSS).\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMAiAssistPromptBoxService {\n //#region ---- Services & Dependencies ----\n\n private readonly overlayService = inject(AXOverlayService);\n\n //#endregion\n\n //#region ---- Private Properties ----\n\n private overlayRef: AXOverlayRef<AXMAiAssistPromptBoxComponent> | null = null;\n\n private pendingResolve: ((value: AXPAiAssistRunResult | null) => void) | null = null;\n\n private settled = false;\n\n private overlaySessionId = 0;\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Presents the assist prompt box and resolves when the user submits, cancels, or dismisses the overlay.\n */\n open(\n options: AXPAiAssistShowOptions,\n executeRun: (\n payload: AXPAiAssistPromptSubmitPayload,\n execution: AXPAiAssistPromptExecutionContext,\n ) => Promise<AXPAiAssistRunResult>,\n ): Promise<AXPAiAssistRunResult | null> {\n if (this.pendingResolve) {\n const superseded = this.pendingResolve;\n this.pendingResolve = null;\n superseded(null);\n }\n this.disposeOverlayOnly();\n\n const sessionId = ++this.overlaySessionId;\n\n return new Promise<AXPAiAssistRunResult | null>((resolve) => {\n this.pendingResolve = resolve;\n this.settled = false;\n\n const requestClose = (result: AXPAiAssistRunResult | null): void => {\n if (this.overlaySessionId !== sessionId) {\n return;\n }\n this.settle(result, sessionId);\n this.overlayRef?.dispose();\n };\n\n void this.overlayService\n .create(AXMAiAssistPromptBoxComponent, {\n centered: false,\n width: 'auto',\n actionSheetStyle: false,\n panelClass: ['axm-ai-assist-prompt-box-shell'],\n backdrop: {\n enabled: false,\n background: false,\n closeOnClick: false,\n },\n closeOnEscape: false,\n closeOnOutsideClick: false,\n inputs: {\n title: options.title,\n placeholder: options.placeholder ?? '',\n initialPrompt: options.initialPrompt ?? '',\n initialAssistId: options.assistId,\n runPrompt: executeRun,\n requestClose,\n },\n onDispose: () => {\n if (this.overlaySessionId !== sessionId) {\n return;\n }\n this.overlayRef = null;\n if (!this.settled && this.pendingResolve) {\n this.settle(null, sessionId);\n }\n },\n })\n .then((ref) => {\n if (this.overlaySessionId !== sessionId) {\n ref.dispose();\n return;\n }\n this.overlayRef = ref;\n })\n .catch(() => {\n if (this.overlaySessionId !== sessionId) {\n return;\n }\n this.settle(null, sessionId);\n });\n });\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private settle(result: AXPAiAssistRunResult | null, sessionId?: number): void {\n if (sessionId != null && this.overlaySessionId !== sessionId) {\n return;\n }\n if (this.settled) {\n return;\n }\n const done = this.pendingResolve;\n if (!done) {\n return;\n }\n this.settled = true;\n this.pendingResolve = null;\n done(result);\n }\n\n private disposeOverlayOnly(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n }\n }\n\n //#endregion\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\nimport { parseAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\nimport type { AXPAiAssistRunInput } from '../../types/ai-assist.types';\n\n//#endregion\n\n//#region ---- Legacy → contract ----\n\n/**\n * Maps legacy `expectStructuredOutput` flags to an {@link AXPAiAgentOutputContract}, or returns explicit `outputContract`.\n */\nexport function outputContractFromAssistRunInput(input: AXPAiAssistRunInput): AXPAiAgentOutputContract | null {\n if (input.outputContract) {\n const parsed = parseAgentOutputContract(input.outputContract);\n if (parsed) {\n return parsed;\n }\n }\n if (!input.expectStructuredOutput) {\n return null;\n }\n const instruction = input.structuredOutputInstruction?.trim();\n const schemaSummary = input.structuredOutputSchemaSummary?.trim();\n let structuredRetries: number | undefined;\n if (typeof input.maxStructuredRetries === 'number' && !Number.isNaN(input.maxStructuredRetries)) {\n structuredRetries = Math.max(0, Math.min(10, Math.floor(input.maxStructuredRetries)));\n }\n return {\n kind: 'object',\n ...(instruction && instruction.length > 0 ? { instruction } : {}),\n ...(schemaSummary && schemaSummary.length > 0 ? { schemaSummary } : {}),\n ...(structuredRetries !== undefined ? { structuredRetries } : {}),\n };\n}\n\n//#endregion\n","//#region ---- Transcript ----\n\nimport type { AXPAiChatMessage } from '../../engine/ai-engine.types';\nimport { axpAiChatMessageGetText } from '@acorex-platform/module-ai-management-client/contracts';\n\n/**\n * Text segments from the last assistant message (`type: 'text'` only).\n * Omits `think` and `node` segments so JSON parsing is not polluted by widget envelopes or reasoning blocks stored separately.\n */\nexport function extractLastAssistantTextSegments(messages: AXPAiChatMessage[]): string[] {\n for (let i = messages.length - 1; i >= 0; i--) {\n const m = messages[i];\n if (m.role !== 'assistant') {\n continue;\n }\n const parts: string[] = [];\n for (const r of m.responses) {\n if (r.type === 'text') {\n parts.push(r.content);\n }\n }\n return parts;\n }\n return [];\n}\n\n/**\n * Combined text for structured JSON extraction (text segments only).\n */\nexport function extractLastAssistantStructuredParts(messages: AXPAiChatMessage[]): {\n combined: string;\n segments: string[];\n} {\n const segments = extractLastAssistantTextSegments(messages);\n const combined = segments.join('\\n\\n').trim();\n return { combined, segments };\n}\n\n/**\n * Concatenated plain text from the last assistant message in the transcript (includes `node` payloads like {@link axpAiChatMessageGetText}).\n */\nexport function extractLastAssistantPlainText(messages: AXPAiChatMessage[]): string {\n for (let i = messages.length - 1; i >= 0; i--) {\n const m = messages[i];\n if (m.role === 'assistant') {\n return axpAiChatMessageGetText(m).trim();\n }\n }\n return '';\n}\n\n//#endregion\n","//#region ---- Retry prompt ----\n\n/**\n * User follow-up appended to the transcript when structured JSON parse/validation fails.\n *\n * @param validationDetail - Parse or schema validation error text.\n * @param schemaSummary - Optional expected shape (e.g. TypeScript-style) to improve retry quality.\n * @param failurePhase - Parse failures get stronger anti-truncation wording; validator failures focus on schema/rules.\n */\nexport function buildStructuredOutputRetryUserText(\n validationDetail: string,\n schemaSummary?: string,\n failurePhase?: 'parse' | 'validator',\n): string {\n const detail = validationDetail.trim() || 'Unknown validation error.';\n const lines: string[] = [\n 'The previous response could not be parsed or validated:',\n detail,\n '',\n ];\n if (failurePhase === 'parse') {\n lines.push(\n 'Likely causes: incomplete/truncated JSON, extra prose around the value, or unclosed strings/brackets.',\n 'Reply with ONE complete JSON value only — fully closed strings, braces, and brackets. Do not stop until the JSON is valid.',\n '',\n );\n } else if (failurePhase === 'validator') {\n lines.push(\n 'The JSON was parsed but did not match the required rules or shape. Fix the structure and values; keep the reply as a single JSON value only.',\n '',\n );\n }\n const shape = schemaSummary?.trim();\n if (shape && shape.length > 0) {\n lines.push('Expected JSON shape (summary):', shape, '');\n }\n lines.push(\n 'Return ONLY valid JSON matching the requested structure.',\n 'Do not include markdown fences or explanations.',\n );\n return lines.join('\\n');\n}\n\n//#endregion\n","//#region ---- Parse structured assistant text ----\n\n/**\n * Parses assistant plain text as JSON, supporting optional ```json fences.\n */\nexport function tryParseStructuredAssistantText(text: string): unknown | undefined {\n const t = text.trim();\n if (!t) {\n return undefined;\n }\n try {\n return JSON.parse(t) as unknown;\n } catch {\n const fence = /^```(?:json)?\\s*([\\s\\S]*?)```$/im.exec(t);\n if (fence?.[1]) {\n try {\n return JSON.parse(fence[1].trim()) as unknown;\n } catch {\n return undefined;\n }\n }\n return undefined;\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { tryParseStructuredAssistantText } from './parse-structured-assistant-text';\n\n//#endregion\n\n//#region ---- Balanced JSON extraction ----\n\nfunction tryParseBalancedJsonObjectAt(s: string, start: number): { value: unknown; end: number } | null {\n if (s[start] !== '{') {\n return null;\n }\n let depth = 0;\n let inString = false;\n let escape = false;\n for (let i = start; i < s.length; i++) {\n const c = s[i];\n if (inString) {\n if (escape) {\n escape = false;\n continue;\n }\n if (c === '\\\\') {\n escape = true;\n continue;\n }\n if (c === '\"') {\n inString = false;\n }\n continue;\n }\n if (c === '\"') {\n inString = true;\n continue;\n }\n if (c === '{') {\n depth++;\n } else if (c === '}') {\n depth--;\n if (depth === 0) {\n const slice = s.slice(start, i + 1);\n try {\n return { value: JSON.parse(slice) as unknown, end: i + 1 };\n } catch {\n return null;\n }\n }\n }\n }\n return null;\n}\n\nfunction tryParseBalancedJsonArrayAt(s: string, start: number): { value: unknown; end: number } | null {\n if (s[start] !== '[') {\n return null;\n }\n let depth = 0;\n let inString = false;\n let escape = false;\n for (let i = start; i < s.length; i++) {\n const c = s[i];\n if (inString) {\n if (escape) {\n escape = false;\n continue;\n }\n if (c === '\\\\') {\n escape = true;\n continue;\n }\n if (c === '\"') {\n inString = false;\n }\n continue;\n }\n if (c === '\"') {\n inString = true;\n continue;\n }\n if (c === '[') {\n depth++;\n } else if (c === ']') {\n depth--;\n if (depth === 0) {\n const slice = s.slice(start, i + 1);\n try {\n return { value: JSON.parse(slice) as unknown, end: i + 1 };\n } catch {\n return null;\n }\n }\n }\n }\n return null;\n}\n\n/**\n * Finds first top-level JSON object or array and returns balanced slice text.\n */\nfunction extractFirstBalancedJsonSlice(s: string): string | undefined {\n const iObj = s.indexOf('{');\n const iArr = s.indexOf('[');\n let start = -1;\n let kind: 'obj' | 'arr' | null = null;\n if (iObj >= 0 && iArr >= 0) {\n if (iObj <= iArr) {\n start = iObj;\n kind = 'obj';\n } else {\n start = iArr;\n kind = 'arr';\n }\n } else if (iObj >= 0) {\n start = iObj;\n kind = 'obj';\n } else if (iArr >= 0) {\n start = iArr;\n kind = 'arr';\n }\n if (start < 0 || !kind) {\n return undefined;\n }\n const parsed =\n kind === 'obj' ? tryParseBalancedJsonObjectAt(s, start) : tryParseBalancedJsonArrayAt(s, start);\n if (!parsed) {\n return undefined;\n }\n return s.slice(start, parsed.end);\n}\n\n//#endregion\n\n//#region ---- Lightweight repair ----\n\n/**\n * Removes assistant reasoning tags when they appear inside the text channel (they break JSON extraction).\n */\nexport function stripAssistantThinkingXml(raw: string): string {\n return raw\n .replace(/<(?:redacted_thinking|think)\\b[^>]*>[\\s\\S]*?<\\/(?:redacted_thinking|think)>/gi, '')\n .replace(/<\\/?(?:redacted_thinking|think)>/gi, '')\n .trim();\n}\n\nfunction stripOuterMarkdownFence(s: string): string {\n const t = s.trim();\n const fence = /^```(?:json)?\\s*([\\s\\S]*?)```$/im.exec(t);\n if (fence?.[1]) {\n return fence[1].trim();\n }\n return t;\n}\n\n/** Removes trailing commas before `}` or `]` outside of strings (best-effort for LLM JSON). */\nfunction removeTrailingCommasBeforeBrackets(jsonLike: string): string {\n return jsonLike.replace(/,(\\s*[}\\]])/g, '$1');\n}\n\nfunction tryParseJsonLenient(slice: string): unknown | undefined {\n const t = slice.trim();\n if (!t) {\n return undefined;\n }\n try {\n return JSON.parse(t) as unknown;\n } catch {\n try {\n return JSON.parse(removeTrailingCommasBeforeBrackets(t)) as unknown;\n } catch {\n return undefined;\n }\n }\n}\n\n/**\n * Best-effort parse when the model stopped mid-JSON (truncated completion): closes `{` `[` using a delimiter stack\n * with string awareness. Unsafe inside unclosed strings; last resort after normal repair.\n */\nfunction tryRepairTruncatedJsonWithDelimiterStack(raw: string): unknown | undefined {\n const s = raw.trim();\n if (!s.length) {\n return undefined;\n }\n const stack: ('{' | '[')[] = [];\n let inStr = false;\n let esc = false;\n for (let i = 0; i < s.length; i++) {\n const c = s[i];\n if (inStr) {\n if (esc) {\n esc = false;\n continue;\n }\n if (c === '\\\\') {\n esc = true;\n continue;\n }\n if (c === '\"') {\n inStr = false;\n }\n continue;\n }\n if (c === '\"') {\n inStr = true;\n continue;\n }\n if (c === '{') {\n stack.push('{');\n } else if (c === '[') {\n stack.push('[');\n } else if (c === '}') {\n if (stack.length > 0 && stack[stack.length - 1] === '{') {\n stack.pop();\n }\n } else if (c === ']') {\n if (stack.length > 0 && stack[stack.length - 1] === '[') {\n stack.pop();\n }\n }\n }\n let suffix = '';\n if (inStr) {\n suffix = '\"';\n }\n for (let k = stack.length - 1; k >= 0; k--) {\n suffix += stack[k] === '{' ? '}' : ']';\n }\n if (!suffix.length) {\n return undefined;\n }\n try {\n return JSON.parse(s + suffix) as unknown;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Parses assistant text after cheap local repairs (fences, trailing commas, first JSON value slice).\n * Does not call the model.\n */\nexport function parseStructuredAssistantWithLocalRepair(raw: string): unknown | undefined {\n const cleaned = stripAssistantThinkingXml(raw);\n const direct = tryParseStructuredAssistantText(cleaned);\n if (direct !== undefined) {\n return direct;\n }\n\n const stripped = stripOuterMarkdownFence(cleaned);\n let v = tryParseJsonLenient(stripped);\n if (v !== undefined) {\n return v;\n }\n\n const slice = extractFirstBalancedJsonSlice(cleaned) ?? extractFirstBalancedJsonSlice(stripped);\n if (slice !== undefined) {\n v = tryParseJsonLenient(slice);\n if (v !== undefined) {\n return v;\n }\n v = tryRepairTruncatedJsonWithDelimiterStack(slice);\n if (v !== undefined) {\n return v;\n }\n }\n\n v = tryRepairTruncatedJsonWithDelimiterStack(cleaned) ?? tryRepairTruncatedJsonWithDelimiterStack(stripped);\n if (v !== undefined) {\n return v;\n }\n\n return undefined;\n}\n\n/**\n * Tries combined assistant text, then each text segment from last to first (models often put JSON only in the last paragraph).\n */\nexport function parseStructuredAssistantWithSegmentFallback(combined: string, segments: readonly string[]): unknown | undefined {\n let v = parseStructuredAssistantWithLocalRepair(combined);\n if (v !== undefined) {\n return v;\n }\n const seen = new Set<string>();\n const mark = stripAssistantThinkingXml(combined).trim();\n if (mark.length > 0) {\n seen.add(mark);\n }\n for (let i = segments.length - 1; i >= 0; i--) {\n const seg = stripAssistantThinkingXml(segments[i] ?? '').trim();\n if (!seg.length || seen.has(seg)) {\n continue;\n }\n seen.add(seg);\n v = parseStructuredAssistantWithLocalRepair(seg);\n if (v !== undefined) {\n return v;\n }\n }\n return undefined;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiJsonSchemaLike } from '../../engine/ai-response-format.types';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface JsonSchemaMiniValidationError {\n path: string;\n message: string;\n}\n\nexport type JsonSchemaMiniValidationResult =\n | { ok: true }\n | { ok: false; errors: JsonSchemaMiniValidationError[] };\n\n//#endregion\n\n//#region ---- Validator ----\n\nfunction typeMatches(schemaType: string | undefined, value: unknown): boolean {\n if (schemaType === undefined) {\n return true;\n }\n switch (schemaType) {\n case 'object':\n return value != null && typeof value === 'object' && !Array.isArray(value);\n case 'array':\n return Array.isArray(value);\n case 'string':\n return typeof value === 'string';\n case 'number':\n return typeof value === 'number' && !Number.isNaN(value);\n case 'integer':\n return typeof value === 'number' && Number.isInteger(value);\n case 'boolean':\n return typeof value === 'boolean';\n case 'null':\n return value === null;\n default:\n return true;\n }\n}\n\nfunction validateNode(\n schema: AXPAiJsonSchemaLike,\n value: unknown,\n path: string,\n errors: JsonSchemaMiniValidationError[],\n): void {\n if (schema.enum && schema.enum.length > 0) {\n if (!schema.enum.some((e) => Object.is(e, value))) {\n errors.push({ path, message: `Value is not one of the allowed enum values.` });\n return;\n }\n }\n\n if (!typeMatches(schema.type, value)) {\n errors.push({\n path,\n message: `Expected type \"${schema.type ?? 'any'}\", got ${value === null ? 'null' : typeof value}.`,\n });\n return;\n }\n\n if (schema.type === 'object' && value != null && typeof value === 'object' && !Array.isArray(value)) {\n const o = value as Record<string, unknown>;\n const props = schema.properties ?? {};\n const required = schema.required ?? [];\n\n for (const key of required) {\n if (!(key in o) || o[key] === undefined) {\n errors.push({ path: path ? `${path}.${key}` : key, message: 'Required property is missing.' });\n }\n }\n\n for (const [key, propSchema] of Object.entries(props)) {\n if (key in o && o[key] !== undefined) {\n validateNode(propSchema, o[key], path ? `${path}.${key}` : key, errors);\n }\n }\n\n if (schema.additionalProperties === false) {\n for (const key of Object.keys(o)) {\n if (!(key in props)) {\n errors.push({\n path: path ? `${path}.${key}` : key,\n message: 'Additional property is not allowed.',\n });\n }\n }\n } else if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {\n for (const [key, val] of Object.entries(o)) {\n if (!(key in props)) {\n validateNode(schema.additionalProperties, val, path ? `${path}.${key}` : key, errors);\n }\n }\n }\n }\n\n if (schema.type === 'array' && Array.isArray(value) && schema.items) {\n const itemSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items;\n if (itemSchema) {\n value.forEach((item, index) => {\n validateNode(itemSchema, item, `${path}[${index}]`, errors);\n });\n }\n }\n}\n\n/**\n * Validates a value against a minimal JSON Schema subset (types, required, enum, properties, items).\n */\nexport function validateJsonSchemaMini(\n schema: AXPAiJsonSchemaLike,\n value: unknown,\n): JsonSchemaMiniValidationResult {\n const errors: JsonSchemaMiniValidationError[] = [];\n validateNode(schema, value, '', errors);\n if (errors.length > 0) {\n return { ok: false, errors };\n }\n return { ok: true };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\nimport { axpAiAgentOutputContractUsesStructuredFinalize } from '../../engine/ai-agent-output-contract.types';\nimport type { AXPAiStructuredValidator } from '../../types/ai-assist.types';\n\nimport { validateJsonSchemaMini } from './json-schema-mini-validator';\nimport {\n parseStructuredAssistantWithSegmentFallback,\n stripAssistantThinkingXml,\n} from './repair-structured-assistant-parse';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ContractValidationError {\n phase: 'parse' | 'validator';\n message: string;\n details?: unknown;\n}\n\nexport type ContractValidationResult =\n | { ok: true; value: unknown }\n | { ok: false; errors: ContractValidationError[] };\n\nexport interface ValidateAgainstContractCommandExecutor {\n execute(commandName: string, args: Record<string, unknown>): Promise<unknown>;\n}\n\nexport interface ValidateAgainstContractParams {\n contract: AXPAiAgentOutputContract;\n assistantPlainText: string;\n textSegmentsFallback?: readonly string[];\n structuredValidator?: AXPAiStructuredValidator;\n commandExecutor?: ValidateAgainstContractCommandExecutor;\n /**\n * When the command returns `{ success, data: { valid, errors?, normalizedJson? } }` envelope shape.\n */\n parseCommandEnvelope?: (raw: unknown) => {\n valid: boolean;\n errorMessage?: string;\n normalizedJson?: string;\n };\n}\n\n//#endregion\n\n//#region ---- Parse + validate ----\n\nfunction defaultParseCommandEnvelope(raw: unknown): {\n valid: boolean;\n errorMessage?: string;\n normalizedJson?: string;\n} {\n if (raw == null || typeof raw !== 'object' || Array.isArray(raw)) {\n return { valid: false, errorMessage: 'Validation command returned an invalid envelope.' };\n }\n const o = raw as Record<string, unknown>;\n if (o['success'] !== true) {\n const err = typeof o['error'] === 'string' ? o['error'] : 'Validation command failed.';\n return { valid: false, errorMessage: err };\n }\n const data = o['data'] as { valid?: boolean; errors?: string[]; normalizedJson?: string } | undefined;\n if (!data?.valid) {\n const errs = Array.isArray(data?.errors) ? data.errors.join('; ') : 'Layout validation failed.';\n return { valid: false, errorMessage: errs };\n }\n const normalized = typeof data.normalizedJson === 'string' ? data.normalizedJson.trim() : '';\n return { valid: true, ...(normalized.length > 0 ? { normalizedJson: normalized } : {}) };\n}\n\n/**\n * Parses assistant text and validates against contract schema, registry command, and optional custom validator.\n */\nexport async function validateAgainstContract(\n params: ValidateAgainstContractParams,\n): Promise<ContractValidationResult> {\n const { contract, assistantPlainText, textSegmentsFallback } = params;\n\n if (!axpAiAgentOutputContractUsesStructuredFinalize(contract)) {\n const trimmed = stripAssistantThinkingXml(assistantPlainText).trim();\n if (!trimmed.length && !(textSegmentsFallback?.some((s) => (s ?? '').trim().length > 0))) {\n return {\n ok: false,\n errors: [{ phase: 'parse', message: 'Assistant returned empty output.' }],\n };\n }\n return { ok: true, value: trimmed };\n }\n\n const combined = stripAssistantThinkingXml(assistantPlainText);\n const parsed = parseStructuredAssistantWithSegmentFallback(combined, textSegmentsFallback ?? []);\n if (parsed === undefined) {\n return {\n ok: false,\n errors: [\n {\n phase: 'parse',\n message:\n 'Could not parse assistant output as JSON (expected a JSON object or array; optional markdown fence; segment fallback and local repair also failed).',\n },\n ],\n };\n }\n\n let value: unknown = parsed;\n\n if (contract.kind === 'array' && !Array.isArray(value)) {\n return {\n ok: false,\n errors: [{ phase: 'validator', message: 'Expected a JSON array as the root value.' }],\n };\n }\n if (contract.kind === 'object' && (value == null || typeof value !== 'object' || Array.isArray(value))) {\n return {\n ok: false,\n errors: [{ phase: 'validator', message: 'Expected a JSON object as the root value.' }],\n };\n }\n\n if (contract.schema) {\n const schemaResult = validateJsonSchemaMini(contract.schema, value);\n if (!schemaResult.ok) {\n const message = schemaResult.errors.map((e) => `${e.path || '(root)'}: ${e.message}`).join('; ');\n return {\n ok: false,\n errors: [{ phase: 'validator', message, details: schemaResult.errors }],\n };\n }\n }\n\n const cmd = contract.validationCommandName?.trim();\n if (cmd && params.commandExecutor) {\n try {\n const raw = await params.commandExecutor.execute(cmd, { json: value });\n const parseEnvelope = params.parseCommandEnvelope ?? defaultParseCommandEnvelope;\n const envelope = parseEnvelope(raw);\n if (!envelope.valid) {\n return {\n ok: false,\n errors: [\n {\n phase: 'validator',\n message: envelope.errorMessage ?? 'Validation command failed.',\n },\n ],\n };\n }\n if (envelope.normalizedJson) {\n try {\n value = JSON.parse(envelope.normalizedJson) as unknown;\n } catch {\n value = envelope.normalizedJson;\n }\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return {\n ok: false,\n errors: [{ phase: 'validator', message: msg.trim().length > 0 ? msg : 'Validation command failed.' }],\n };\n }\n }\n\n if (params.structuredValidator) {\n try {\n value = await params.structuredValidator(value);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return {\n ok: false,\n errors: [{ phase: 'validator', message: msg.trim().length > 0 ? msg : 'Structured validation failed.' }],\n };\n }\n }\n\n return { ok: true, value };\n}\n\n//#endregion\n","//#region ---- Imports ----\r\n\r\nimport {\r\n AXPAiStructuredOutputError,\r\n type AXPAiAssistStructuredOutputRunRaw,\r\n type AXPAiStructuredValidator,\r\n type AXPAiAssistTokenUsageSnapshot,\r\n} from '../../types/ai-assist.types';\r\n\r\nimport type { AXPAiAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\r\nimport { axpAiAgentOutputContractStructuredRetryCap } from '../../engine/ai-agent-output-contract.types';\r\nimport { axpAiChatTextMessage } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport type {\r\n AXPAiChatMessage,\r\n AXPAiEngineLastProviderPayload,\r\n AXPAiEngineRunResult,\r\n AXPAiEngineUsageTotals,\r\n} from '../../engine/ai-engine.types';\r\nimport type { AXPAiAssistExecutionResult } from './execution-result.types';\r\nimport { buildStructuredOutputRetryUserText } from './build-structured-output-retry-user-text';\r\nimport {\r\n extractLastAssistantPlainText,\r\n extractLastAssistantStructuredParts,\r\n} from './extract-last-assistant-plain-text';\r\nimport { stripAssistantThinkingXml } from './repair-structured-assistant-parse';\r\nimport {\r\n validateAgainstContract,\r\n type ValidateAgainstContractCommandExecutor,\r\n} from './validate-against-contract';\r\nimport { assertAiAssistNotAborted } from '../ai-run-abort.util';\r\n\r\n//#endregion\r\n\r\n//#region ---- Usage aggregation ----\r\n\r\nfunction mergeEngineUsageTotals(\r\n acc: AXPAiEngineUsageTotals | undefined,\r\n next: AXPAiEngineUsageTotals | undefined,\r\n): AXPAiEngineUsageTotals | undefined {\r\n if (!acc && !next) {\r\n return undefined;\r\n }\r\n const promptTokens = (acc?.promptTokens ?? 0) + (next?.promptTokens ?? 0);\r\n const completionTokens = (acc?.completionTokens ?? 0) + (next?.completionTokens ?? 0);\r\n const totalTokens = (acc?.totalTokens ?? 0) + (next?.totalTokens ?? 0);\r\n const cachedPromptTokens = (acc?.cachedPromptTokens ?? 0) + (next?.cachedPromptTokens ?? 0);\r\n return {\r\n promptTokens,\r\n completionTokens,\r\n totalTokens,\r\n ...(cachedPromptTokens > 0 ? { cachedPromptTokens } : {}),\r\n };\r\n}\r\n\r\nfunction engineTotalsToSnapshot(totals: AXPAiEngineUsageTotals | undefined): AXPAiAssistTokenUsageSnapshot | undefined {\r\n if (!totals) {\r\n return undefined;\r\n }\r\n return {\r\n promptTokens: totals.promptTokens,\r\n completionTokens: totals.completionTokens,\r\n totalTokens: totals.totalTokens,\r\n ...(totals.cachedPromptTokens != null && totals.cachedPromptTokens > 0\r\n ? { cachedPromptTokens: totals.cachedPromptTokens }\r\n : {}),\r\n };\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---- Error snapshot ----\r\n\r\nconst STRUCTURED_OUTPUT_ERROR_TEXT_MAX = 8000;\r\n\r\nfunction truncateForStructuredOutputError(text: string): string {\r\n if (text.length <= STRUCTURED_OUTPUT_ERROR_TEXT_MAX) {\r\n return text;\r\n }\r\n return `${text.slice(0, STRUCTURED_OUTPUT_ERROR_TEXT_MAX)}…`;\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---- Pipeline ----\r\n\r\nexport interface RunStructuredOutputPipelineParams {\r\n /** Effective output contract for this session. */\r\n contract: AXPAiAgentOutputContract;\r\n\r\n /** Initial transcript (system + user, etc.). */\r\n initialMessages: AXPAiChatMessage[];\r\n\r\n /** Runs the engine with the given full message list. */\r\n executeRun: (messages: AXPAiChatMessage[]) => Promise<AXPAiEngineRunResult>;\r\n\r\n /**\r\n * Extra turns after the first response. Total attempts = 1 + maxStructuredRetries.\r\n * Use 0 for a single attempt. When omitted, uses {@link contract.structuredRetries}.\r\n */\r\n maxStructuredRetries?: number;\r\n\r\n /** When false, only one attempt is made. */\r\n retryOnInvalidStructure: boolean;\r\n\r\n structuredValidator?: AXPAiStructuredValidator;\r\n\r\n /** Appended to retry user messages (and should be reflected in the initial user prompt by the caller). */\r\n structuredOutputSchemaSummary?: string;\r\n\r\n commandExecutor?: ValidateAgainstContractCommandExecutor;\r\n\r\n abortSignal?: AbortSignal;\r\n}\r\n\r\nexport interface RunStructuredOutputPipelineResult extends AXPAiAssistExecutionResult {\r\n structured: unknown;\r\n structuredRunRaw: AXPAiAssistStructuredOutputRunRaw;\r\n}\r\n\r\n/**\r\n * Runs the engine, validates JSON (+ optional custom validator), and appends user retry messages on failure.\r\n */\r\nexport async function runStructuredOutputPipeline(\r\n params: RunStructuredOutputPipelineParams,\r\n): Promise<RunStructuredOutputPipelineResult> {\r\n const retryCap =\r\n params.maxStructuredRetries ?? axpAiAgentOutputContractStructuredRetryCap(params.contract);\r\n const maxAttempts = params.retryOnInvalidStructure ? 1 + Math.max(0, retryCap) : 1;\r\n const schemaSummary =\r\n params.structuredOutputSchemaSummary?.trim() || params.contract.schemaSummary?.trim();\r\n\r\n let messages = params.initialMessages;\r\n let mergedUsage: AXPAiEngineUsageTotals | undefined;\r\n let lastProvider: AXPAiEngineLastProviderPayload | undefined;\r\n let prevFailureStructuredFingerprint: string | undefined;\r\n let prevFailurePhase: 'parse' | 'validator' | undefined;\r\n\r\n const perAttemptUsage: { attemptIndex: number; usage?: AXPAiAssistTokenUsageSnapshot; hasLastProviderResult: boolean }[] =\r\n [];\r\n\r\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\r\n assertAiAssistNotAborted(params.abortSignal);\r\n let result: AXPAiEngineRunResult;\r\n try {\r\n result = await params.executeRun(messages);\r\n } catch (err) {\r\n assertAiAssistNotAborted(params.abortSignal);\r\n throw err;\r\n }\r\n assertAiAssistNotAborted(params.abortSignal);\r\n mergedUsage = mergeEngineUsageTotals(mergedUsage, result.usageTotals);\r\n\r\n if (result.lastProviderResult !== undefined) {\r\n lastProvider = result.lastProviderResult;\r\n }\r\n messages = result.messages;\r\n\r\n const displayText = extractLastAssistantPlainText(messages);\r\n const structuredParts = extractLastAssistantStructuredParts(messages);\r\n const structuredFingerprint = stripAssistantThinkingXml(structuredParts.combined).trim();\r\n\r\n const attemptUsageSnapshot = engineTotalsToSnapshot(result.usageTotals);\r\n perAttemptUsage.push({\r\n attemptIndex: attempt,\r\n usage: attemptUsageSnapshot,\r\n hasLastProviderResult: result.lastProviderResult !== undefined,\r\n });\r\n\r\n if (\r\n attempt > 1 &&\r\n prevFailureStructuredFingerprint !== undefined &&\r\n structuredFingerprint === prevFailureStructuredFingerprint &&\r\n prevFailurePhase === 'validator'\r\n ) {\r\n throw new AXPAiStructuredOutputError({\r\n message:\r\n 'Assistant returned the same output as the previous attempt while schema validation still failed; stopped to avoid excess token usage.',\r\n attempts: attempt,\r\n lastAssistantText: truncateForStructuredOutputError(displayText),\r\n validationMessage:\r\n 'The model repeated identical assistant text after a successful JSON parse; no further retries will be requested for this run.',\r\n code: 'duplicate_assistant_output',\r\n });\r\n }\r\n\r\n assertAiAssistNotAborted(params.abortSignal);\r\n const validation = await validateAgainstContract({\r\n contract: params.contract,\r\n assistantPlainText: structuredParts.combined,\r\n textSegmentsFallback: structuredParts.segments,\r\n structuredValidator: params.structuredValidator,\r\n commandExecutor: params.commandExecutor,\r\n });\r\n assertAiAssistNotAborted(params.abortSignal);\r\n\r\n if (validation.ok) {\r\n const structuredRunRaw: AXPAiAssistStructuredOutputRunRaw = {\r\n kind: 'structured-output',\r\n attempts: perAttemptUsage,\r\n totalUsage: engineTotalsToSnapshot(mergedUsage),\r\n finalAttempt: attempt,\r\n lastProviderResult: lastProvider,\r\n };\r\n return { success: true,\r\n outputKind: params.contract.kind,\r\n text: displayText,\r\n data: validation.value,\r\n structured: validation.value,\r\n messages: result.messages,\r\n structuredRunRaw,\r\n };\r\n }\r\n\r\n const firstError = validation.errors[0];\r\n prevFailureStructuredFingerprint = structuredFingerprint;\r\n prevFailurePhase = firstError?.phase;\r\n\r\n const canRetry = params.retryOnInvalidStructure && attempt < maxAttempts;\r\n if (!canRetry) {\r\n throw new AXPAiStructuredOutputError({\r\n message: `Structured output validation failed after ${attempt} attempt(s).`,\r\n attempts: attempt,\r\n lastAssistantText: truncateForStructuredOutputError(displayText),\r\n validationMessage: firstError?.message ?? 'Validation failed.',\r\n code: 'validation_exhausted',\r\n });\r\n }\r\n\r\n assertAiAssistNotAborted(params.abortSignal);\r\n messages = [\r\n ...result.messages,\r\n axpAiChatTextMessage(\r\n 'user',\r\n buildStructuredOutputRetryUserText(\r\n firstError?.message ?? 'Validation failed.',\r\n schemaSummary,\r\n firstError?.phase ?? 'parse',\r\n ),\r\n ),\r\n ];\r\n assertAiAssistNotAborted(params.abortSignal);\r\n }\r\n\r\n throw new AXPAiStructuredOutputError({\r\n message: 'Structured output validation failed (unexpected end of retry loop).',\r\n attempts: maxAttempts,\r\n lastAssistantText: '',\r\n validationMessage: 'Unexpected pipeline state.',\r\n code: 'validation_exhausted',\r\n });\r\n}\r\n\r\n//#endregion\r\n","//#region ---- Imports ----\n\nimport { inject, Injectable } from '@angular/core';\nimport type { AXPOutputTranscriptSegmentId } from '@acorex-platform/framework-shared/core';\nimport {\n AXPOutputContractTranscriptSegmentService,\n} from '@acorex-platform/framework-client/common';\nimport type { AXPAiAgentOutputContract } from './ai-agent-output-contract.types';\nimport {\n parseAgentOutputContract,\n resolveAgentOutputContract,\n} from './ai-agent-output-contract.types';\nimport type { ResolveEffectiveOutputContractInput } from './ai-effective-output-contract';\n\n//#endregion\n\n//#region ---- Segment id ----\n\nfunction isOutputContractSegmentId(value: string): value is AXPOutputTranscriptSegmentId {\n return value === 'text' || value === 'node' || value === 'followUp' || value === 'file';\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPAiOutputContractResolveService {\n //#region ---- Dependencies ----\n\n private readonly segmentService = inject(AXPOutputContractTranscriptSegmentService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n /**\n * Resolves a persisted agent/assist `outputContract` value (segment id string)\n * or a full contract object (runtime / programmatic).\n */\n async resolveFromPersisted(raw: unknown): Promise<AXPAiAgentOutputContract | null> {\n if (raw == null) {\n return null;\n }\n\n if (typeof raw === 'string') {\n const id = raw.trim();\n if (!id.length) {\n return null;\n }\n if (isOutputContractSegmentId(id)) {\n return (await this.segmentService.getContractPreset(id)) ?? null;\n }\n return parseAgentOutputContract(raw);\n }\n\n if (typeof raw === 'object' && !Array.isArray(raw)) {\n return parseAgentOutputContract(raw);\n }\n\n return null;\n }\n\n /**\n * Effective contract for one engine turn.\n * Priority: runtime > input > agent > assist > `{ kind: 'string' }`.\n */\n async resolveEffective(params: ResolveEffectiveOutputContractInput): Promise<AXPAiAgentOutputContract> {\n const runtime = await this.resolveFromPersisted(params.runtime);\n if (runtime) {\n return runtime;\n }\n const input = await this.resolveFromPersisted(params.input);\n if (input) {\n return input;\n }\n const agent = await this.resolveFromPersisted(params.agent);\n if (agent) {\n return agent;\n }\n const assist = await this.resolveFromPersisted(params.assist);\n if (assist) {\n return assist;\n }\n return resolveAgentOutputContract(null);\n }\n\n //#endregion\n}\n","//#region ---- Imports ----\r\n\r\nimport { AXPSettingsService } from '@acorex-platform/framework-client/common';\r\nimport {\r\n AXPAiAssistDefaultMaxStructuredRetries,\r\n AXPAiAssistDefaultStructuredMaxTokens,\r\n type AXPAiAssistPromptExecutionContext,\r\n type AXPAiAssistPromptSubmitPayload,\r\n type AXPAiAssistRunInput,\r\n type AXPAiAssistRunResult,\r\n type AXPAiAssistShowOptions,\r\n} from '../types/ai-assist.types';\r\nimport { Injectable, LOCALE_ID, inject } from '@angular/core';\r\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\r\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport { AXPAiManagementSettings } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport { AXPAiAssistService } from './ai-assist.abstract';\r\nimport { AXPAiEngine } from '../engine/ai-engine';\r\nimport { axpAiChatTextMessage } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport { axpAiChatUserMessage } from '../engine/ai-chat-display.util';\r\nimport {\r\n type AXPAiChatMessage,\r\n type AXPAiChatResponse,\r\n type AXPAiEffectiveAssistRow,\r\n type AXPAiChatTransport,\r\n type AXPAiEngineRunOptions,\r\n type AXPAiEngineRunResult,\r\n type AXPAiPlatformRuntimeContext,\r\n} from '../engine/ai-engine.types';\r\nimport { AXPAiPlatformRuntimeContextBuilder } from '../engine/ai-platform-runtime-context.builder';\r\nimport { AXMAiAssistPromptBoxService } from '../assist/ai-assist-prompt-box.service';\r\nimport { outputContractFromAssistRunInput } from '../assist/structured-output/assist-output-contract-from-input';\r\nimport { extractLastAssistantPlainText } from '../assist/structured-output/extract-last-assistant-plain-text';\r\nimport { runStructuredOutputPipeline } from '../assist/structured-output/run-structured-output-pipeline';\r\nimport { assertAiAssistNotAborted } from '../assist/ai-run-abort.util';\r\nimport { axpAiAgentOutputContractUsesStructuredFinalize } from '../engine/ai-agent-output-contract.types';\r\nimport { AXPAiOutputContractResolveService } from '../engine/output-contract-resolve.service';\r\n\r\n//#endregion\r\n\r\n//#region ---- Row types (UI / queries) ----\r\n\r\ntype AXMAiAssistRow = AXPAiEffectiveAssistRow;\r\n\r\n//#endregion\r\n\r\n//#region ---- Assist run helpers ----\r\n\r\nfunction mergePlatformRuntimeContext(\r\n base: AXPAiPlatformRuntimeContext,\r\n notes: Record<string, unknown> | undefined | null,\r\n): AXPAiPlatformRuntimeContext {\r\n if (!notes || Object.keys(notes).length === 0) {\r\n return base;\r\n }\r\n return { ...base, ...notes };\r\n}\r\n\r\nfunction buildUserPromptBody(input: AXPAiAssistRunInput): string {\r\n const parts: string[] = [];\r\n const prompt = input.prompt?.trim() ?? '';\r\n if (prompt.length > 0) {\r\n parts.push(prompt);\r\n }\r\n\r\n const hints = input.context?.hints?.filter((h) => (h ?? '').toString().trim().length > 0) ?? [];\r\n if (hints.length > 0) {\r\n parts.push('', 'Hints:', ...hints.map((h) => `- ${String(h).trim()}`));\r\n }\r\n\r\n const structured = input.context?.structuredContext;\r\n if (structured !== undefined && structured !== null) {\r\n let serialized: string;\r\n try {\r\n serialized = typeof structured === 'string' ? structured : JSON.stringify(structured, null, 2);\r\n } catch {\r\n serialized = String(structured);\r\n }\r\n parts.push('', 'Context (structured):', serialized);\r\n }\r\n\r\n if (input.expectStructuredOutput) {\r\n const extra = input.structuredOutputInstruction?.trim();\r\n parts.push(\r\n '',\r\n 'Structured output requirements:',\r\n '- Reply with exactly one JSON value (a single object or array). It must be complete and valid: close every string, bracket, and brace.',\r\n '- Do not truncate — finish the entire structure in one message.',\r\n '- No markdown code fences, no text or commentary before or after the JSON.',\r\n ...(extra && extra.length > 0 ? ['', 'Additional output rules from the task:', extra] : []),\r\n );\r\n const schemaSummary = input.structuredOutputSchemaSummary?.trim();\r\n if (schemaSummary && schemaSummary.length > 0) {\r\n parts.push('', 'Expected JSON shape (summary):', schemaSummary);\r\n }\r\n }\r\n\r\n return parts.join('\\n').trim();\r\n}\r\n\r\nfunction buildChatMessages(input: AXPAiAssistRunInput): AXPAiChatMessage[] {\r\n const messages: AXPAiChatMessage[] = [];\r\n const systemInstruction = input.context?.systemInstruction?.trim();\r\n if (systemInstruction) {\r\n messages.push(axpAiChatTextMessage('system', systemInstruction));\r\n }\r\n const body = buildUserPromptBody(input);\r\n const media = (input.userMediaAttachments ?? []).filter((a) => a.fileId?.trim());\r\n if (media.length > 0) {\r\n const responses: AXPAiChatResponse[] = [];\r\n for (const a of media) {\r\n const fileId = a.fileId.trim();\r\n responses.push({\r\n type: 'file',\r\n content: { fileId },\r\n });\r\n }\r\n const textBody = body.trim().length > 0 ? body : '(empty prompt)';\r\n responses.push({ type: 'text', content: textBody });\r\n messages.push(axpAiChatUserMessage(responses));\r\n } else {\r\n messages.push(axpAiChatTextMessage('user', body.trim().length > 0 ? body : '(empty prompt)'));\r\n }\r\n return messages;\r\n}\r\n\r\ninterface AXMAiModelMaxTokensRow {\r\n id: string;\r\n chatTransport?: string;\r\n maxOutputTokens?: number;\r\n}\r\n\r\n//#endregion\r\n\r\n/**\r\n * Frontend facade for AI: assist catalog, tenant defaults, engine runs, structured assist runs, and prompt UI.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class AXPAiManagerService extends AXPAiAssistService {\r\n //#region ---- Services & Dependencies ----\r\n\r\n private readonly aiEngine = inject(AXPAiEngine);\r\n private readonly outputContractResolve = inject(AXPAiOutputContractResolveService);\r\n private readonly entityService = inject(AXPEntityService);\r\n private readonly settings = inject(AXPSettingsService);\r\n private readonly runtimeContextBuilder = inject(AXPAiPlatformRuntimeContextBuilder);\r\n private readonly assistPromptBox = inject(AXMAiAssistPromptBoxService);\r\n private readonly localeId = inject(LOCALE_ID);\r\n\r\n private readonly assistData = this.entityService\r\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\r\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\r\n\r\n private readonly modelEntityData = this.entityService\r\n .withEntity(RootConfig.module.name, RootConfig.entities.model.name)\r\n .data<string, AXMAiModelMaxTokensRow, AXMAiModelMaxTokensRow, AXMAiModelMaxTokensRow, AXMAiModelMaxTokensRow>();\r\n\r\n //#endregion\r\n\r\n //#region ---- Assist catalog (frontend) ----\r\n\r\n /**\r\n * Loads the effective assist from `DefaultAssistId` (tenant setting), or the assist named `platform-assistant`.\r\n */\r\n async getEffectiveAssist(): Promise<AXPAiEffectiveAssistRow> {\r\n const raw = await this.settings.get<unknown>(AXPAiManagementSettings.DefaultAssistId);\r\n const assistId = readStoredAssistSettingId(raw);\r\n\r\n if (assistId) {\r\n const byId = await this.assistData.byKey(assistId);\r\n if (byId) {\r\n return byId;\r\n }\r\n const byName = await this.findAssistByName(assistId);\r\n if (byName) {\r\n return byName;\r\n }\r\n throw new Error(\r\n `AI assist with id \"${assistId}\" was not found. Open AI Management → AI Settings and pick a valid default assist.`,\r\n );\r\n }\r\n\r\n const record = await this.findAssistByName('platform-assistant');\r\n if (!record) {\r\n throw new Error(\r\n 'No default assist is configured. Create an assist named \"platform-assistant\" or select one under AI Settings.',\r\n );\r\n }\r\n\r\n return record;\r\n }\r\n\r\n private async findAssistByName(name: string): Promise<AXPAiEffectiveAssistRow | null> {\r\n const queryResult = await this.assistData.query({\r\n skip: 0,\r\n take: 1,\r\n filter: {\r\n field: 'name',\r\n operator: { type: 'equal' },\r\n value: name,\r\n },\r\n });\r\n return ((queryResult?.items ?? [])[0] as AXPAiEffectiveAssistRow | undefined) ?? null;\r\n }\r\n\r\n /**\r\n * Resolves the assist row for chat: explicit primary key, otherwise the effective default from settings.\r\n */\r\n async getAssistForChat(assistId?: string | null): Promise<AXPAiEffectiveAssistRow> {\r\n const id = assistId?.trim();\r\n if (id) {\r\n const row = await this.assistData.byKey(id);\r\n if (row) {\r\n return row;\r\n }\r\n const byName = await this.findAssistByName(id);\r\n if (byName) {\r\n return byName;\r\n }\r\n throw new Error(\r\n `Assist \"${id}\" was not found. Open AI Management → Assists or clear the assist id in the chat URL.`,\r\n );\r\n }\r\n return this.getEffectiveAssist();\r\n }\r\n\r\n /**\r\n * Primary catalog model transport for an assist (`modelId` row).\r\n */\r\n async getAssistPrimaryChatTransport(assistId?: string | null): Promise<AXPAiChatTransport | undefined> {\r\n const assist = await this.getAssistForChat(assistId);\r\n const modelEntityId = assist.modelId?.trim();\r\n if (!modelEntityId) {\r\n return undefined;\r\n }\r\n const model = await this.modelEntityData.byKey(modelEntityId);\r\n const raw = String(model?.chatTransport ?? '').toLowerCase();\r\n if (raw === 'openai' || raw === 'gemini' || raw === 'demis') {\r\n return raw;\r\n }\r\n return undefined;\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- Engine delegation ----\r\n\r\n /**\r\n * Low-level engine run (chat streaming and tool orchestration).\r\n */\r\n runEngine(options: AXPAiEngineRunOptions): Promise<AXPAiEngineRunResult> {\r\n return this.aiEngine.run(options);\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- Assist API (run / show) ----\r\n\r\n /**\r\n * Normalizes AiModel.maxOutputTokens from the catalog.\r\n */\r\n private normalizeMaxOutputTokens(value: unknown): number | undefined {\r\n if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) {\r\n return undefined;\r\n }\r\n return Math.floor(value);\r\n }\r\n\r\n /**\r\n * Reads {@link AXMAiModelMaxTokensRow.maxOutputTokens} for the model bound to the assist.\r\n */\r\n private async resolveCatalogMaxOutputTokens(assistId: string | undefined): Promise<number | undefined> {\r\n try {\r\n const assist = await this.getAssistForChat(assistId);\r\n const modelEntityId = assist.modelId?.trim();\r\n if (!modelEntityId) {\r\n return undefined;\r\n }\r\n const model = await this.modelEntityData.byKey(modelEntityId);\r\n return this.normalizeMaxOutputTokens(model?.maxOutputTokens);\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override async run(input: AXPAiAssistRunInput): Promise<AXPAiAssistRunResult> {\r\n assertAiAssistNotAborted(input.abortSignal);\r\n const baseCtx = await this.runtimeContextBuilder.build();\r\n const platformRuntimeContext = mergePlatformRuntimeContext(baseCtx, input.platformRuntimeNotes ?? null);\r\n\r\n const assistId = input.assistId?.trim();\r\n const assistRow = await this.getAssistForChat(assistId);\r\n assertAiAssistNotAborted(input.abortSignal);\r\n const inputContract = outputContractFromAssistRunInput(input);\r\n const effectiveOutputContract = await this.outputContractResolve.resolveEffective({\r\n input: inputContract,\r\n assist: assistRow.outputContract,\r\n });\r\n const usesStructuredPipeline =\r\n input.expectStructuredOutput === true ||\r\n axpAiAgentOutputContractUsesStructuredFinalize(effectiveOutputContract);\r\n\r\n const messages = buildChatMessages(input);\r\n\r\n const catalogMax = await this.resolveCatalogMaxOutputTokens(assistId);\r\n const effectiveMaxTokens = input.maxTokens ?? catalogMax ?? AXPAiAssistDefaultStructuredMaxTokens;\r\n\r\n const runOptions: Omit<AXPAiEngineRunOptions, 'messages'> = {\r\n platformRuntimeContext,\r\n outputContract: effectiveOutputContract,\r\n ...(assistId ? { assistId } : {}),\r\n ...(input.maxSteps !== undefined ? { maxSteps: input.maxSteps } : {}),\r\n ...(input.temperature !== undefined ? { temperature: input.temperature } : {}),\r\n maxTokens: effectiveMaxTokens,\r\n ...(input.abortSignal ? { abortSignal: input.abortSignal } : {}),\r\n };\r\n\r\n if (!usesStructuredPipeline) {\r\n const result = await this.runEngine({ ...runOptions, messages });\r\n assertAiAssistNotAborted(input.abortSignal);\r\n const text = extractLastAssistantPlainText(result.messages);\r\n return { success: true, outputKind: effectiveOutputContract.kind,\r\n text,\r\n raw: { usageTotals: result.usageTotals, lastProviderResult: result.lastProviderResult },\r\n messages: result.messages,\r\n };\r\n }\r\n\r\n const retryOnInvalidStructure = input.retryOnInvalidStructure !== false;\r\n const maxStructuredRetries = input.maxStructuredRetries ?? AXPAiAssistDefaultMaxStructuredRetries;\r\n\r\n const structuredMaxTokens = input.structuredOutputMaxTokens ?? effectiveMaxTokens;\r\n\r\n const pipelineResult = await runStructuredOutputPipeline({\r\n contract: effectiveOutputContract,\r\n initialMessages: messages,\r\n executeRun: (nextMessages) =>\r\n this.runEngine({ ...runOptions, maxTokens: structuredMaxTokens, messages: nextMessages }),\r\n maxStructuredRetries,\r\n retryOnInvalidStructure,\r\n structuredValidator: input.structuredValidator,\r\n structuredOutputSchemaSummary: input.structuredOutputSchemaSummary,\r\n abortSignal: input.abortSignal,\r\n });\r\n\r\n return {\r\n success: pipelineResult.success,\r\n outputKind: pipelineResult.outputKind,\r\n text: pipelineResult.text,\r\n structured: pipelineResult.structured,\r\n data: pipelineResult.data,\r\n validationErrors: pipelineResult.validationErrors,\r\n messages: pipelineResult.messages,\r\n raw: pipelineResult.structuredRunRaw,\r\n };\r\n }\r\n\r\n /** @inheritdoc */\r\n override async show(options: AXPAiAssistShowOptions): Promise<AXPAiAssistRunResult | null> {\r\n const data = await this.assistPromptBox.open(\r\n options,\r\n async (payload: AXPAiAssistPromptSubmitPayload, execution: AXPAiAssistPromptExecutionContext) => {\r\n return await this.run({\r\n prompt: payload.prompt,\r\n userMediaAttachments:\r\n payload.userMediaAttachments.length > 0 ? payload.userMediaAttachments : undefined,\r\n context: options.context,\r\n assistId: payload.assistId,\r\n maxSteps: options.maxSteps,\r\n temperature: options.temperature,\r\n maxTokens: options.maxTokens,\r\n outputContract: options.outputContract,\r\n expectStructuredOutput: options.expectStructuredOutput,\r\n structuredOutputInstruction: options.structuredOutputInstruction,\r\n platformRuntimeNotes: options.platformRuntimeNotes,\r\n maxStructuredRetries: options.maxStructuredRetries,\r\n structuredValidator: options.structuredValidator,\r\n retryOnInvalidStructure: options.retryOnInvalidStructure,\r\n structuredOutputSchemaSummary: options.structuredOutputSchemaSummary,\r\n structuredOutputMaxTokens: options.structuredOutputMaxTokens,\r\n abortSignal: execution.abortSignal,\r\n });\r\n },\r\n );\r\n\r\n return data ?? null;\r\n }\r\n\r\n //#endregion\r\n}\r\n\r\n/** Lookup settings persist an id string, or `{ id }` / `{ value }` before the widget transform. */\r\nfunction readStoredAssistSettingId(raw: unknown): string {\r\n if (typeof raw === 'string') {\r\n return raw.trim();\r\n }\r\n if (raw != null && typeof raw === 'object') {\r\n const record = raw as Record<string, unknown>;\r\n const value = record['id'] ?? record['value'];\r\n if (typeof value === 'string') {\r\n return value.trim();\r\n }\r\n }\r\n return '';\r\n}\r\n","//#region ---- Imports ----\n\nimport { AXPWidgetConfig, AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';\nimport { AXP_DATA_PATH_PROPERTY, AXP_NAME_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXP_WIDGETS_EDITOR_CATEGORY } from '@acorex-platform/framework-client/layout/widget-core';\n//#endregion\n\n//#region ---- Config ----\n\nexport const AXMAgentRegistryToolConfiguratorWidget: AXPWidgetConfig = {\n name: 'agent-registry-tool-configurator',\n title: 'Agent registry tool (command / query)',\n icon: 'fa-light fa-screwdriver-wrench',\n description:\n 'Select a command or query definition from the platform registry and optionally set default argument values (persisted with the agent).',\n categories: AXP_WIDGETS_EDITOR_CATEGORY,\n groups: [AXPWidgetGroupEnum.UtilityWidget],\n type: 'editor',\n defaultFilterWidgetName: 'string-filter',\n properties: [\n AXP_NAME_PROPERTY,\n AXP_DATA_PATH_PROPERTY,\n {\n name: 'label',\n title: 'Label',\n visible: true,\n group: { name: 'general', title: 'General', order: 1 },\n schema: {\n dataType: 'string',\n defaultValue: '',\n interface: {\n path: 'label',\n type: 'text-box',\n options: {\n placeholder: 'Field label',\n },\n },\n },\n },\n {\n name: 'registryKind',\n title: 'Registry kind',\n visible: true,\n group: { name: 'behavior', title: 'Behavior', order: 2 },\n schema: {\n dataType: 'string',\n defaultValue: 'command',\n interface: {\n path: 'options.registryKind',\n type: 'select-editor',\n options: {\n items: [\n { id: 'command', title: 'Command' },\n { id: 'query', title: 'Query' },\n ],\n valueField: 'id',\n textField: 'title',\n },\n },\n },\n },\n {\n name: 'readonly',\n title: 'Readonly',\n visible: true,\n group: { name: 'behavior', title: 'Behavior', order: 2 },\n schema: {\n dataType: 'string',\n interface: {\n path: 'options.readonly',\n type: 'text-box',\n options: {\n placeholder: 'true / false / expression',\n },\n },\n },\n },\n {\n name: 'dataSource',\n title: 'Data source override',\n visible: true,\n group: { name: 'data', title: 'Data', order: 3 },\n schema: {\n dataType: 'string',\n interface: {\n path: 'options.dataSource',\n type: 'text-box',\n options: {\n placeholder: 'Optional; defaults by registry kind',\n },\n },\n },\n },\n ],\n components: {\n edit: {\n component: () =>\n import('./agent-registry-tool-configurator-widget-edit.component').then(\n (c) => c.AXMAgentRegistryToolConfiguratorWidgetEditComponent,\n ),\n },\n designer: {\n component: () =>\n import('./agent-registry-tool-configurator-widget-edit.component').then(\n (c) => c.AXMAgentRegistryToolConfiguratorWidgetEditComponent,\n ),\n },\n column: {\n component: () =>\n import('./agent-registry-tool-configurator-widget-column.component').then(\n (c) => c.AXMAgentRegistryToolConfiguratorWidgetColumnComponent,\n ),\n },\n },\n};\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPWidgetConfig, AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';\nimport { AXP_DATA_PATH_PROPERTY, AXP_NAME_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXP_WIDGETS_EDITOR_CATEGORY } from '@acorex-platform/framework-client/layout/widget-core';\n\n//#endregion\n\n//#region ---- Config ----\n\nexport const AXMAssistDelegatedAgentConfiguratorWidget: AXPWidgetConfig = {\n name: 'assist-delegated-agent-configurator',\n title: 'Assist Delegated Agent Configurator',\n icon: 'fa-light fa-user-robot',\n description: 'Select a delegated agent and configure injected delegated parameters.',\n categories: AXP_WIDGETS_EDITOR_CATEGORY,\n groups: [AXPWidgetGroupEnum.UtilityWidget],\n type: 'editor',\n defaultFilterWidgetName: 'string-filter',\n properties: [\n AXP_NAME_PROPERTY,\n AXP_DATA_PATH_PROPERTY,\n {\n name: 'label',\n title: 'Label',\n visible: true,\n group: { name: 'general', title: 'General', order: 1 },\n schema: {\n dataType: 'string',\n defaultValue: '@ai-management:assists.entities.assist.fields.delegated-agent.title',\n interface: {\n path: 'label',\n type: 'text-box',\n options: {\n placeholder: 'Field label',\n },\n },\n },\n },\n {\n name: 'readonly',\n title: 'Readonly',\n visible: true,\n group: { name: 'behavior', title: 'Behavior', order: 2 },\n schema: {\n dataType: 'string',\n interface: {\n path: 'options.readonly',\n type: 'text-box',\n options: {\n placeholder: 'true / false / expression',\n },\n },\n },\n },\n ],\n components: {\n edit: {\n component: () =>\n import('./assist-delegated-agent-configurator-widget-edit.component').then(\n (c) => c.AXMAssistDelegatedAgentConfiguratorWidgetEditComponent,\n ),\n },\n designer: {\n component: () =>\n import('./assist-delegated-agent-configurator-widget-edit.component').then(\n (c) => c.AXMAssistDelegatedAgentConfiguratorWidgetEditComponent,\n ),\n },\n column: {\n component: () =>\n import('./assist-delegated-agent-configurator-widget-column.component').then(\n (c) => c.AXMAssistDelegatedAgentConfiguratorWidgetColumnComponent,\n ),\n },\n },\n};\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPWidgetDefinitionProvider } from '@acorex-platform/framework-client/layout/widget-core';\nimport { Injectable } from '@angular/core';\nimport { AXMAgentRegistryToolConfiguratorWidget } from './features/widgets/agent-registry-tool-configurator/agent-registry-tool-configurator-widget.config';\nimport { AXMAssistDelegatedAgentConfiguratorWidget } from './features/widgets/assist-delegated-agent-configurator/assist-delegated-agent-configurator-widget.config';\n\n//#endregion\n\n//#region ---- AI Management Widgets Provider ----\n\nconst AI_MANAGEMENT_WIDGETS = [\n AXMAssistDelegatedAgentConfiguratorWidget,\n AXMAgentRegistryToolConfiguratorWidget,\n];\n\n@Injectable()\nexport class AXMAiManagementWidgetsProvider implements AXPWidgetDefinitionProvider {\n getWidgets() {\n return AI_MANAGEMENT_WIDGETS;\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type {\n AXPOutputContractTranscriptSegmentDefinition,\n AXPOutputContractTranscriptSegmentProvider,\n} from '@acorex-platform/framework-client/common';\n\n//#endregion\n\n//#region ---- Built-in segment definitions ----\n\n/** Single source for entity select options and DI segment presets. */\nexport const AXM_BUILTIN_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_DEFINITIONS: AXPOutputContractTranscriptSegmentDefinition[] =\n [\n {\n name: 'text',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.text',\n applicableKinds: ['object'],\n contract: {\n kind: 'object',\n transcriptSegment: 'text',\n structuredRetries: 2,\n },\n },\n {\n name: 'node',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.node',\n applicableKinds: ['object'],\n contract: {\n kind: 'object',\n transcriptSegment: 'node',\n structuredRetries: 3,\n },\n },\n {\n name: 'followUp',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.follow-up',\n applicableKinds: ['object'],\n contract: {\n kind: 'object',\n transcriptSegment: 'followUp',\n structuredRetries: 2,\n },\n },\n {\n name: 'file',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.file',\n applicableKinds: ['string'],\n contract: {\n kind: 'string',\n instruction:\n 'When a tool persists media (image, audio, etc.), the platform attaches a chat file segment automatically (`{\"type\":\"file\",\"content\":{\"fileId\":\"<id>\"}}`; optional `\"isDownloadable\":true` when the user wants a downloadable file — default false for inline preview/playback). User-visible text: at most one friendly sentence. Never paste tool JSON, fileId, or file metadata in text.',\n },\n },\n ];\n\n//#endregion\n\n//#region ---- Provider ----\n\nexport class AXMBuiltinOutputContractTranscriptSegmentProvider implements AXPOutputContractTranscriptSegmentProvider {\n provide(): AXPOutputContractTranscriptSegmentDefinition[] {\n return AXM_BUILTIN_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_DEFINITIONS;\n }\n}\n\n//#endregion\n","import { Injectable } from '@angular/core';\nimport type { AXPContextDefinition, AXPContextDefinitionProvider } from '@acorex-platform/framework-client/core';\nimport { AXM_AI_PLATFORM_RUNTIME_CONTEXT_DEFINITIONS } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#region ---- Platform runtime time & notes ----\n\n@Injectable()\nexport class AXMAiPlatformRuntimeContextDefinitionProvider implements AXPContextDefinitionProvider {\n async items(): Promise<AXPContextDefinition[]> {\n return AXM_AI_PLATFORM_RUNTIME_CONTEXT_DEFINITIONS;\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';\nimport {\n AXP_MENU_PROVIDER,\n AXP_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_PROVIDER,\n AXP_SETTING_DEFINITION_PROVIDER,\n} from '@acorex-platform/framework-client/common';\nimport {\n AXPComponentSlotModule,\n AXP_CONTEXT_DEFINITION_PROVIDER,\n AXP_FEATURE_DEFINITION_PROVIDER,\n AXP_TAG_PROVIDER,\n} from '@acorex-platform/framework-client/core';\nimport { AXP_WIDGET_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXPWidgetsModule } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXPRuntimeModule, provideQuerySetups } from '@acorex-platform/framework-client/runtime';\nimport { NgModule } from '@angular/core';\nimport { ROUTES, Routes } from '@angular/router';\nimport { AXMAiManagementFeatureDefinitionProvider } from './feature-definition.provider';\nimport { AXMAiManagementMenuProvider } from './menu.provider';\nimport { AXMPermissionDefinitionProvider } from './permission-definition.provider';\nimport { AXMAiManagementSettingProvider } from './settings.provider';\nimport { AXMAiModelPurposeTagProvider } from './features/tags/ai-model-purpose-tag.provider';\nimport { AXPAiAssistService } from './features/services/ai-assist.abstract';\nimport { AXPAiManagerService } from './features/services/ai-manager.service';\nimport { AXMAiManagementWidgetsProvider } from './widget-definition.provider';\nimport { AXMBuiltinOutputContractTranscriptSegmentProvider } from './features/engine/output-contract-transcript-segment.builtin-providers';\nimport { AXMAiPlatformRuntimeContextDefinitionProvider } from './features/engine/platform-runtime-context-definition.provider';\n\n//#endregion\n\n//#region ---- Routes ----\n\nfunction routesFactory(): Routes {\n return [];\n}\n\n//#endregion\n\n//#region ---- Module ----\n\n@NgModule({\n imports: [\n AXPComponentSlotModule.forChild({\n }),\n AXPWidgetsModule,\n AXPRuntimeModule,\n ],\n providers: [\n {\n provide: ROUTES,\n multi: true,\n useFactory: routesFactory,\n },\n {\n provide: AXP_PERMISSION_DEFINITION_PROVIDER,\n useClass: AXMPermissionDefinitionProvider,\n multi: true,\n },\n {\n provide: AXP_FEATURE_DEFINITION_PROVIDER,\n useClass: AXMAiManagementFeatureDefinitionProvider,\n multi: true,\n },\n {\n provide: AXP_MENU_PROVIDER,\n useClass: AXMAiManagementMenuProvider,\n multi: true,\n },\n {\n provide: AXP_SETTING_DEFINITION_PROVIDER,\n useClass: AXMAiManagementSettingProvider,\n multi: true,\n },\n {\n provide: AXP_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_PROVIDER,\n useClass: AXMBuiltinOutputContractTranscriptSegmentProvider,\n multi: true,\n },\n provideQuerySetups([\n {\n key: 'AiManagement:ListOutputContractTranscriptSegments',\n loader: () =>\n import('./features/queries/list-output-contract-transcript-segments.query').then(\n (c) => c.AXMListOutputContractTranscriptSegmentsQuery,\n ),\n },\n {\n key: 'AiManagement:ListAiCommandRegistryCatalog',\n loader: () =>\n import('./features/queries/list-ai-command-registry-catalog.query').then(\n (c) => c.AXMListAiCommandRegistryCatalogQuery,\n ),\n },\n {\n key: 'AiManagement:ListAiQueryRegistryCatalog',\n loader: () =>\n import('./features/queries/list-ai-query-registry-catalog.query').then(\n (c) => c.AXMListAiQueryRegistryCatalogQuery,\n ),\n },\n ]),\n {\n provide: AXP_WIDGET_DEFINITION_PROVIDER,\n useClass: AXMAiManagementWidgetsProvider,\n multi: true,\n },\n {\n provide: AXP_TAG_PROVIDER,\n useClass: AXMAiModelPurposeTagProvider,\n multi: true,\n },\n {\n provide: AXPAiAssistService,\n useExisting: AXPAiManagerService,\n },\n {\n provide: AXP_CONTEXT_DEFINITION_PROVIDER,\n useClass: AXMAiPlatformRuntimeContextDefinitionProvider,\n multi: true,\n },\n ],\n})\nexport class AXMAiManagementModule {}\n\n//#endregion\n","//#region ---- Delegated agent prompt preview ----\n\nfunction normalizeDelegatedAgentToolArgs(argumentsValue: unknown): Record<string, unknown> | null {\n if (argumentsValue == null) {\n return null;\n }\n if (typeof argumentsValue === 'object' && !Array.isArray(argumentsValue)) {\n return { ...(argumentsValue as Record<string, unknown>) };\n }\n if (typeof argumentsValue === 'string') {\n const t = argumentsValue.trim();\n if (!t) {\n return null;\n }\n try {\n const p = JSON.parse(t) as unknown;\n if (p != null && typeof p === 'object' && !Array.isArray(p)) {\n return p as Record<string, unknown>;\n }\n } catch {\n return null;\n }\n }\n return null;\n}\n\nfunction formatArgsFallback(argumentsValue: unknown): string {\n if (argumentsValue == null) {\n return '';\n }\n if (typeof argumentsValue === 'string') {\n return argumentsValue;\n }\n try {\n return JSON.stringify(argumentsValue, null, 2);\n } catch {\n return String(argumentsValue);\n }\n}\n\n/**\n * Human-readable specialist prompt from delegated-agent tool arguments (conversation / mini-chat UI).\n */\nexport function axpAiDelegatedAgentPromptPreview(argumentsValue: unknown): string {\n const obj = normalizeDelegatedAgentToolArgs(argumentsValue);\n if (!obj) {\n return formatArgsFallback(argumentsValue);\n }\n const preferKeys = ['query', 'task', 'prompt', 'message', 'userMessage', 'instruction', 'goal'] as const;\n for (const k of preferKeys) {\n const v = obj[k];\n if (typeof v === 'string' && v.trim()) {\n return v.trim();\n }\n }\n const keys = Object.keys(obj);\n if (keys.length === 1) {\n const only = obj[keys[0]!];\n if (typeof only === 'string' && only.trim()) {\n return only.trim();\n }\n }\n try {\n return JSON.stringify(obj, null, 2);\n } catch {\n return formatArgsFallback(argumentsValue);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiChatMessage } from '../engine/ai-engine.types';\nimport { axpAiChatTextMessage } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n/** Maximum length for assist initial transcript text after HTML strip (characters). */\nconst ASSIST_INITIAL_MESSAGES_MAX_LENGTH = 16_000;\n\n//#region ---- HTML / rich text to plain ----\n\n/**\n * Strips HTML tags and decodes a few common entities for safe plain-text transcript lines.\n * Used for Assist `initialMessages` (may be stored as rich text HTML).\n */\nexport function axpAiStripAssistInitialHtmlToPlain(raw: string): string {\n let s = raw\n .replace(/<\\/p>\\s*(?:<br\\s*\\/?>\\s*)*<p[^>]*>/gi, '\\n\\n')\n .replace(/<\\/p>\\s*<p[^>]*>/gi, '\\n\\n')\n .replace(/<br\\s*\\/?>/gi, '\\n');\n s = s.replace(/<\\/(div|h[1-6]|li|tr)>/gi, '\\n');\n s = s.replace(/<[^>]+>/g, '');\n s = s\n .replace(/ /gi, ' ')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\");\n s = s.replace(/\\r\\n/g, '\\n').trim();\n if (s.length > ASSIST_INITIAL_MESSAGES_MAX_LENGTH) {\n s = s.slice(0, ASSIST_INITIAL_MESSAGES_MAX_LENGTH).trimEnd() + '…';\n }\n return s;\n}\n\n//#endregion\n\n//#region ---- Transcript messages ----\n\n/**\n * Converts assist `initialMessages` (HTML or plain) into one or more `assistant` transcript lines.\n * Non-empty paragraphs (split by blank lines) become separate messages; single block stays one message.\n */\nexport function axpAiAssistInitialMessagesToTranscript(\n raw: string | null | undefined,\n): AXPAiChatMessage[] {\n const trimmed = raw?.trim() ?? '';\n if (!trimmed) {\n return [];\n }\n const plain = axpAiStripAssistInitialHtmlToPlain(trimmed);\n if (!plain) {\n return [];\n }\n const blocks = plain\n .split(/\\n{2,}/)\n .map((b) => b.replace(/\\n+/g, ' ').trim())\n .filter((b) => b.length > 0);\n if (blocks.length === 0) {\n return [];\n }\n return blocks.map((text) => axpAiChatTextMessage('assistant', text));\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { resolveMultiLanguageString } from '@acorex/core/translation';\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport type { AXMAiManagementAssistEntityModel } from '@acorex-platform/module-ai-management-client/contracts';\nimport type { AXPAiEffectiveAssistRow } from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Types ----\n\ntype AssistStarterPromptsSource =\n | Pick<AXMAiManagementAssistEntityModel, 'starterPrompts'>\n | Pick<AXPAiEffectiveAssistRow, 'starterPrompts'>\n | null\n | undefined;\n\n//#endregion\n\n//#region ---- Extraction ----\n\n/**\n * Returns non-empty starter prompt labels, preserving repeater order.\n * Resolve locale in the template via the translate pipe.\n */\nexport function axpAiAssistStarterPromptLabels(\n source: AssistStarterPromptsSource,\n): Array<string | AXPMultiLanguageString> {\n const items = source?.starterPrompts;\n if (!Array.isArray(items) || items.length === 0) {\n return [];\n }\n\n const labels: Array<string | AXPMultiLanguageString> = [];\n for (const item of items) {\n const text = item?.text;\n if (!axpAiAssistStarterPromptLabelIsNonEmpty(text)) {\n continue;\n }\n labels.push(text);\n }\n return labels;\n}\n\n/**\n * Returns non-empty starter prompt strings for the active locale, preserving repeater order.\n */\nexport function axpAiAssistStarterPromptTexts(\n source: AssistStarterPromptsSource,\n locale: string,\n): string[] {\n return axpAiAssistStarterPromptLabels(source)\n .map((text) => (typeof text === 'string' ? text : resolveMultiLanguageString(text, locale)).trim())\n .filter((text) => text.length > 0);\n}\n\nfunction axpAiAssistStarterPromptLabelIsNonEmpty(\n text: string | AXPMultiLanguageString | null | undefined,\n): text is string | AXPMultiLanguageString {\n if (text == null) {\n return false;\n }\n if (typeof text === 'string') {\n return text.trim().length > 0;\n }\n return Object.values(text).some((value) => typeof value === 'string' && value.trim().length > 0);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable, signal } from '@angular/core';\nimport type { AXPAiChatTransport } from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Run context ----\n\nexport interface AXPAiChatToolRunContext {\n assistId: string;\n chatTransport: AXPAiChatTransport;\n /** AiModel catalog row id for the active chat model (when resolved). */\n modelEntityId?: string;\n /** Set during a delegated agent sub-run (specialist executing registry tools). */\n agentId?: string;\n /** Assist or AiAgent catalog `name` (Demisco `agent_uuid` for Demis transport). */\n agentName?: string;\n /** Optional Demisco chat session id (`session_uuid` in multipart). */\n demisSessionUuid?: string;\n}\n\n/**\n * Per chat run: stores which assist and chat transport are active.\n * Injected commands (e.g. image generation) read this instead of receiving assist/transport inside tool args.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPAiChatToolRunContextService {\n private readonly runContext = signal<AXPAiChatToolRunContext | null>(null);\n\n setContext(ctx: AXPAiChatToolRunContext | null): void {\n this.runContext.set(ctx);\n }\n\n getContext(): AXPAiChatToolRunContext | null {\n return this.runContext();\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AIMANAGEMENT_CHAT_GENERATE_IMAGE_COMMAND_KEY,\n AIMANAGEMENT_CHAT_SYNTHESIZE_SPEECH_COMMAND_KEY,\n AIMANAGEMENT_CHAT_TRANSCRIBE_SPEECH_COMMAND_KEY,\n AIMANAGEMENT_RENDER_CHAT_CHART_COMMAND_KEY,\n} from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- LLM JSON Schema overrides ----\n\n/**\n * Registry rows map inputs to string-typed JSON schemas. Override parameters for AI chat tools\n * so models receive accurate types (arrays, booleans, nested objects).\n */\nexport function getAiChatCommandLlmParametersOverride(\n commandName: string,\n): Record<string, unknown> | null {\n switch (commandName) {\n case AIMANAGEMENT_CHAT_GENERATE_IMAGE_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n prompt: {\n type: 'string',\n description: 'Detailed text description of the image to generate.',\n },\n size: {\n type: 'string',\n description: 'Optional size hint for backends that support it (e.g. 1024x1024). May be ignored.',\n },\n style: {\n type: 'string',\n description:\n 'Optional style hint (e.g. photorealistic, flat vector). May be merged into the prompt by the backend.',\n },\n },\n required: ['prompt'],\n };\n case AIMANAGEMENT_CHAT_TRANSCRIBE_SPEECH_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n model: {\n type: 'string',\n description:\n 'Optional catalog AiModel row id for speech-to-text. Omit to use options.model on the speech delegated specialist row.',\n },\n fileId: {\n type: 'string',\n description: 'Platform file storage id for the audio file to transcribe.',\n },\n language: {\n type: 'string',\n description: 'Optional language hint (e.g. en) when supported by the provider.',\n },\n },\n required: ['fileId'],\n };\n case AIMANAGEMENT_CHAT_SYNTHESIZE_SPEECH_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n model: {\n type: 'string',\n description:\n 'Catalog AiModel row id for text-to-speech (purpose tts). Pass on the command or rely on agent commandIds options.model; mock default is OpenRouter x-ai/grok-voice-tts-1.0.',\n },\n text: {\n type: 'string',\n description: 'Plain text to convert to speech.',\n },\n voice: {\n type: 'string',\n description:\n 'Optional voice. Grok Voice default row: ara, eve, rex, sal, leo (alloy maps to ara). Gemini TTS: Zephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede.',\n },\n responseFormat: {\n type: 'string',\n description: 'Optional audio format. Gemini default: pcm. OpenRouter also supports mp3 for other TTS models.',\n },\n },\n required: ['text'],\n };\n case AIMANAGEMENT_RENDER_CHAT_CHART_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n kind: {\n type: 'string',\n enum: ['bar', 'line', 'donut', 'gauge', 'funnel', 'heatmap'],\n description:\n 'Chart kind. Bar for categorical counts, line for trends, donut for part-to-whole, gauge for one KPI, funnel for stages, heatmap for a matrix.',\n },\n title: { type: 'string', description: 'Optional chart title.' },\n xAxisLabel: { type: 'string', description: 'Optional X-axis caption.' },\n yAxisLabel: { type: 'string', description: 'Optional Y-axis caption.' },\n entity: {\n type: 'string',\n description:\n 'Module.Entity for stored rows. When set, this command runs one storage aggregate and ignores items. Do not call Entity:Query:Default first.',\n },\n filter: {\n description: 'Optional AXPQueryRequest.filter JSON applied to the aggregate.',\n },\n groupBy: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Field paths from the entity schema (source of x / series). Empty array is allowed for gauge.',\n },\n measures: {\n type: 'array',\n description:\n 'Aggregate measures. Always set alias. Each item: { reducer, field?, alias? }. First alias is y unless yField is set.',\n items: {\n type: 'object',\n properties: {\n reducer: { type: 'string', enum: ['count', 'sum', 'min', 'max', 'avg'] },\n field: { type: 'string' },\n alias: { type: 'string' },\n },\n },\n },\n xField: {\n type: 'string',\n description: 'Aggregate result column for x. Defaults to the first groupBy path.',\n },\n yField: {\n type: 'string',\n description: 'Aggregate result column for y. Defaults to the first measure alias.',\n },\n seriesField: {\n type: 'string',\n description: 'Optional line-series column. Defaults to the second groupBy path when kind is line.',\n },\n valueField: {\n type: 'string',\n description: 'Heatmap numeric column. Defaults to the first measure alias.',\n },\n items: {\n type: 'array',\n description:\n 'Escape hatch when numbers are already in chat (no entity). Ignored when entity is set. Bar/donut/funnel: { x, y }. Line: { x, y, series? }. Heatmap: { x, y, value }. Gauge: one { y } or { value }.',\n items: {\n type: 'object',\n properties: {\n x: { description: 'Category or X value.' },\n y: { description: 'Numeric Y for bar/line/donut/funnel/gauge; category for heatmap.' },\n value: { description: 'Numeric intensity for heatmap, or gauge fallback.' },\n series: { type: 'string', description: 'Optional line-series name.' },\n },\n },\n },\n },\n required: ['kind'],\n };\n default:\n return null;\n }\n}\n\n//#endregion\n","//#region ---- Constants ----\n\n/** OpenAI / OpenRouter `pcm` TTS output: 16-bit signed LE, mono, 24 kHz. */\nexport const AI_CHAT_TTS_PCM_SAMPLE_RATE = 24000;\n\n//#endregion\n\n//#region ---- MIME helpers ----\n\nexport function isRawPcmMimeType(mimeType: string): boolean {\n const mime = mimeType.trim().toLowerCase();\n return mime === 'audio/pcm' || mime === 'audio/l16' || mime === 'audio/x-pcm' || mime === 'audio/raw';\n}\n\n//#endregion\n\n//#region ---- PCM → WAV ----\n\n/**\n * Wraps raw 16-bit signed little-endian PCM in a RIFF WAV container for HTML5 audio playback.\n */\nexport function wrapPcm16LeInWav(\n pcmBytes: ArrayBuffer,\n sampleRate = AI_CHAT_TTS_PCM_SAMPLE_RATE,\n numChannels = 1,\n): ArrayBuffer {\n const bitsPerSample = 16;\n const blockAlign = (numChannels * bitsPerSample) / 8;\n const byteRate = sampleRate * blockAlign;\n const dataSize = pcmBytes.byteLength;\n const headerSize = 44;\n const out = new ArrayBuffer(headerSize + dataSize);\n const view = new DataView(out);\n\n const writeStr = (offset: number, str: string): void => {\n for (let i = 0; i < str.length; i++) {\n view.setUint8(offset + i, str.charCodeAt(i));\n }\n };\n\n writeStr(0, 'RIFF');\n view.setUint32(4, 36 + dataSize, true);\n writeStr(8, 'WAVE');\n writeStr(12, 'fmt ');\n view.setUint32(16, 16, true);\n view.setUint16(20, 1, true);\n view.setUint16(22, numChannels, true);\n view.setUint32(24, sampleRate, true);\n view.setUint32(28, byteRate, true);\n view.setUint16(32, blockAlign, true);\n view.setUint16(34, bitsPerSample, true);\n writeStr(36, 'data');\n view.setUint32(40, dataSize, true);\n\n new Uint8Array(out, headerSize).set(new Uint8Array(pcmBytes));\n return out;\n}\n\n//#endregion\n\n//#region ---- Playback preparation ----\n\nexport interface AiChatTtsPlaybackBytes {\n audioBytes: ArrayBuffer;\n mimeType: string;\n extension: string;\n}\n\n/** Normalizes synthesized speech bytes to a browser-playable container (PCM → WAV). */\nexport function prepareTtsBytesForBrowserPlayback(\n audioBytes: ArrayBuffer,\n mimeType: string,\n): AiChatTtsPlaybackBytes {\n const mt = mimeType.trim() || 'application/octet-stream';\n if (isRawPcmMimeType(mt)) {\n return {\n audioBytes: wrapPcm16LeInWav(audioBytes),\n mimeType: 'audio/wav',\n extension: 'wav',\n };\n }\n\n const lower = mt.toLowerCase();\n if (lower.includes('mpeg') || lower.includes('mp3')) {\n return { audioBytes, mimeType: mt, extension: 'mp3' };\n }\n if (lower.includes('wav')) {\n return { audioBytes, mimeType: mt, extension: 'wav' };\n }\n if (lower.includes('opus')) {\n return { audioBytes, mimeType: mt, extension: 'opus' };\n }\n if (lower.includes('ogg')) {\n return { audioBytes, mimeType: mt, extension: 'ogg' };\n }\n if (lower.includes('aac')) {\n return { audioBytes, mimeType: mt, extension: 'aac' };\n }\n if (lower.includes('flac')) {\n return { audioBytes, mimeType: mt, extension: 'flac' };\n }\n if (lower.includes('pcm')) {\n return {\n audioBytes: wrapPcm16LeInWav(audioBytes),\n mimeType: 'audio/wav',\n extension: 'wav',\n };\n }\n\n return { audioBytes, mimeType: mt, extension: 'bin' };\n}\n\n/**\n * Builds a blob URL for chat voice playback, wrapping legacy PCM TTS files when needed.\n */\nexport async function createBrowserPlayableTtsBlobUrl(\n binary: Blob,\n mimeType: string,\n fileName?: string,\n): Promise<string> {\n const mime = mimeType.trim().toLowerCase();\n const name = fileName?.trim().toLowerCase() ?? '';\n const looksLikePcm =\n isRawPcmMimeType(mime) || (mime === 'application/octet-stream' && name.endsWith('.pcm'));\n\n if (!looksLikePcm) {\n return URL.createObjectURL(binary);\n }\n\n const pcmBytes = await binary.arrayBuffer();\n return URL.createObjectURL(new Blob([wrapPcm16LeInWav(pcmBytes)], { type: 'audio/wav' }));\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiEngineLastProviderPayload } from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Stream chunk stripping ----\n\n/**\n * Removes ephemeral SSE chunk arrays from provider `rawResponse` objects.\n * Assistant text is accumulated during streaming; chunk blobs must not be persisted or exported.\n */\nexport function axpStripEphemeralStreamChunksFromProviderRaw(raw: unknown): unknown {\n if (raw == null || typeof raw !== 'object' || Array.isArray(raw)) {\n return raw;\n }\n const record = raw as Record<string, unknown>;\n if (record['stream'] !== true || !Array.isArray(record['chunks'])) {\n return raw;\n }\n const rest = { ...record };\n delete rest['chunks'];\n delete rest['stream'];\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\n/** Strips stream chunks from {@link AXPAiEngineLastProviderPayload} before message metadata / debug export. */\nexport function axpSanitizeLastProviderPayloadForPersistence(\n payload: AXPAiEngineLastProviderPayload | undefined,\n): AXPAiEngineLastProviderPayload | undefined {\n if (!payload) {\n return undefined;\n }\n if (payload.rawResponse === undefined) {\n return payload;\n }\n const rawResponse = axpStripEphemeralStreamChunksFromProviderRaw(payload.rawResponse);\n if (rawResponse === payload.rawResponse) {\n return payload;\n }\n if (rawResponse === undefined) {\n const { rawResponse: _removed, ...rest } = payload;\n return rest;\n }\n return { ...payload, rawResponse };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiDelegatedAgentTranscriptRunInput, AXPAiEngineRunOptions } from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Run input snapshot ----\n\n/** Builds a JSON-serializable delegated specialist {@link AXPAiEngineRunOptions} snapshot (no callbacks). */\nexport function axpBuildDelegatedAgentRunInputSnapshot(\n delegationCallId: string,\n agentId: string,\n agentName: string | undefined,\n specialistArguments: unknown,\n runOptions: AXPAiEngineRunOptions,\n): AXPAiDelegatedAgentTranscriptRunInput {\n const { onRunEvent: _omit, ...run } = runOptions;\n const callId = delegationCallId.trim();\n const catalogId = agentId.trim();\n return {\n delegationCallId: callId,\n agentId: catalogId,\n ...(agentName?.trim() ? { agentName: agentName.trim() } : {}),\n specialistArguments,\n run,\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiStructuredValidator } from '../../types/ai-assist.types';\n\nimport { parseStructuredAssistantWithSegmentFallback } from './repair-structured-assistant-parse';\n\n//#endregion\n\n//#region ---- Validation ----\n\nexport type StructuredAssistantValidation =\n | { ok: true; value: unknown }\n | { ok: false; errorMessage: string; failurePhase: 'parse' | 'validator' };\n\nfunction hasAnyStructuredContent(combined: string, segments: readonly string[] | undefined): boolean {\n if (combined.trim().length > 0) {\n return true;\n }\n if (!segments?.length) {\n return false;\n }\n return segments.some((s) => (s ?? '').trim().length > 0);\n}\n\n/**\n * Parses JSON from assistant text (including lightweight local repair), then optionally runs a custom validator.\n *\n * @param textSegmentsFallback - When provided, each segment is tried after combined text (last segment first); helps when prose and JSON sit in separate assistant text blocks.\n */\nexport async function validateStructuredAssistantResponse(\n assistantPlainText: string,\n structuredValidator: AXPAiStructuredValidator | undefined,\n textSegmentsFallback?: readonly string[],\n): Promise<StructuredAssistantValidation> {\n if (!hasAnyStructuredContent(assistantPlainText, textSegmentsFallback)) {\n return {\n ok: false,\n errorMessage: 'Assistant returned empty output.',\n failurePhase: 'parse',\n };\n }\n\n const parsed = parseStructuredAssistantWithSegmentFallback(assistantPlainText, textSegmentsFallback ?? []);\n if (parsed === undefined) {\n return {\n ok: false,\n errorMessage:\n 'Could not parse assistant output as JSON (expected a JSON object or array; optional markdown fence; segment fallback, local repair, and truncation repair also failed).',\n failurePhase: 'parse',\n };\n }\n\n if (!structuredValidator) {\n return { ok: true, value: parsed };\n }\n\n try {\n const value = await structuredValidator(parsed);\n return { ok: true, value };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return {\n ok: false,\n errorMessage: msg.trim().length > 0 ? msg : 'Structured validation failed.',\n failurePhase: 'validator',\n };\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable, LOCALE_ID, inject } from '@angular/core';\nimport { resolveMultiLanguageString } from '@acorex/core/translation';\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\nimport { isChatPurposeModelRow, readModelPurposes } from '@acorex-platform/module-ai-management-client/contracts';\nimport type {\n AXPAiChatModelListItem,\n AXPAiChatModelListRequest,\n} from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Row types (entity query) ----\n\ninterface CatalogModelRow {\n id: string;\n name?: string;\n title?: string | AXPMultiLanguageString;\n chatTransport?: string;\n openAiEndpointId?: string;\n maxContextTokens?: number;\n inputPricePerMillion?: number;\n outputPricePerMillion?: number;\n cachedInputPricePerMillion?: number;\n isDisabled?: boolean;\n openAiEndpointIsDisabled?: boolean;\n}\n\n//#endregion\n\n/**\n * Lists chat-purpose AI models (catalog), without using {@link AXPAiEngine}.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPAiAssistChatModelCatalogService {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly localeId = inject(LOCALE_ID);\n\n private readonly modelData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.model.name)\n .data<string, CatalogModelRow, CatalogModelRow, CatalogModelRow, CatalogModelRow>();\n\n //#endregion\n\n //#region ---- Public API ----\n\n /**\n * All active chat-purpose models in the catalog (assist / agent policy is applied at engine runtime).\n */\n async listModels(_request?: AXPAiChatModelListRequest): Promise<AXPAiChatModelListItem[]> {\n const queryResult = await this.modelData.query({\n skip: 0,\n take: 500,\n });\n const items = (queryResult?.items ?? []) as CatalogModelRow[];\n let rows = items.filter((x) => isChatPurposeModelRow(x as unknown as Record<string, unknown>));\n\n rows = await this.filterModelsActiveForChat(rows);\n\n return rows.map((x) => ({\n id: x.id,\n name: x.name?.trim() ?? '',\n title:\n resolveMultiLanguageString((x.title ?? x.name ?? x.id) as AXPMultiLanguageString, this.localeId).trim() || x.id,\n modelPurposes: readModelPurposes(x as unknown as Record<string, unknown>),\n chatTransport: x.chatTransport,\n maxContextTokens:\n typeof x.maxContextTokens === 'number' && x.maxContextTokens > 0\n ? x.maxContextTokens\n : undefined,\n inputPricePerMillion:\n typeof x.inputPricePerMillion === 'number' && x.inputPricePerMillion > 0\n ? x.inputPricePerMillion\n : undefined,\n outputPricePerMillion:\n typeof x.outputPricePerMillion === 'number' && x.outputPricePerMillion > 0\n ? x.outputPricePerMillion\n : undefined,\n cachedInputPricePerMillion:\n typeof x.cachedInputPricePerMillion === 'number' && x.cachedInputPricePerMillion > 0\n ? x.cachedInputPricePerMillion\n : undefined,\n }));\n }\n\n //#endregion\n\n //#region ---- Model filtering ----\n\n /**\n * Chat pickers only use enabled models. Endpoint disabled state is denormalized on the\n * model (`openAiEndpointIsDisabled`) so tenants never need OpenAI endpoint entity reads.\n */\n private async filterModelsActiveForChat(rows: CatalogModelRow[]): Promise<CatalogModelRow[]> {\n return rows.filter((x) => {\n if (x.isDisabled === true) {\n return false;\n }\n if (x.openAiEndpointIsDisabled === true) {\n return false;\n }\n return true;\n });\n }\n\n //#endregion\n}\n","//#region ---- Imports ----\n\nimport { Injectable } from '@angular/core';\nimport type { AXPAiChatModelListItem } from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Service ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXPAiDefaultModelPickerService {\n //#region ---- Public API ----\n\n /**\n * Picks a model from chat/vision catalog candidates.\n * Prefers {@link preferredModelId} when it supports the purpose; otherwise the first\n * purpose-capable entry; otherwise the first candidate.\n */\n pickFromChatCatalogForPurpose(\n models: AXPAiChatModelListItem[],\n purpose: 'chat' | 'vision',\n preferredModelId?: string | null,\n ): AXPAiChatModelListItem | undefined {\n if (!models.length) {\n return undefined;\n }\n const preferredId = preferredModelId?.trim();\n if (preferredId) {\n const preferred = models.find((m) => m.id === preferredId);\n if (preferred && modelItemSupportsChatCatalogPurpose(preferred, purpose)) {\n return preferred;\n }\n }\n const byPurpose = models.find((m) => modelItemSupportsChatCatalogPurpose(m, purpose));\n if (byPurpose) {\n return byPurpose;\n }\n return models[0];\n }\n\n //#endregion\n}\n\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction modelItemSupportsChatCatalogPurpose(m: AXPAiChatModelListItem, purpose: 'chat' | 'vision'): boolean {\n const p = m.modelPurposes?.length ? m.modelPurposes : [];\n if (purpose === 'vision') {\n return p.includes('vision');\n }\n return p.includes('chat');\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAQA;AAEA;AAEA;;;AAGG;MACU,wCAAwC,CAAA;IACnD,MAAM,OAAO,CAAC,OAA4C,EAAA;QACxD,MAAM,IAAI,GAAG,eAAe;AAC5B,QAAA,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,aAAa,EAAE;YAC3D,KAAK,EAAE,CAAA,CAAA,EAAI,IAAI,CAAA,8BAAA,CAAgC;YAC/C,WAAW,EAAE,CAAA,CAAA,EAAI,IAAI,CAAA,oCAAA,CAAsC;AAC3D,YAAA,YAAY,EAAE,KAAK;AACnB,YAAA,IAAI,EAAE,SAAS;AAChB,SAAA,CAAC;IACJ;AACD;AAED;;ACjBA;AAEA;MAGa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAiF1D,IAA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QACF;AACA,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,mCAAmC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACrF,IAAI,SAAS,EAAE;AACb,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,MAAM,CAAC,CAAC,CAAC;IAClB;8GA5BW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA9B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,cADjB,MAAM,EAAA,CAAA,CAAA;;2FACnB,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAkClC;AAEA;AAEA,SAAS,mCAAmC,CAAC,CAAyB,EAAE,OAA0B,EAAA;AAChG,IAAA,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,GAAG,CAAC,CAAC,aAAa,GAAG,EAAE;AACxD,IAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;AACxB,QAAA,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC7B;AACA,IAAA,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC3B;;ACrDA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-ai-management-client.mjs","sources":["../../../../libs/modules/ai-management/client/src/lib/feature-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/menu.provider.ts","../../../../libs/modules/ai-management/client/src/lib/assist-permission-definition.builder.ts","../../../../libs/modules/ai-management/client/src/lib/permission-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/settings.provider.ts","../../../../libs/modules/ai-management/client/src/lib/features/tags/ai-model-purpose-tag.provider.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-assist.abstract.ts","../../../../libs/modules/ai-management/client/src/lib/features/types/ai-assist.types.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-engine.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-chat-display.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-platform-runtime-context.builder.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-run-abort.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/chat/ai-generated-image-persist.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-chat-composer-media.helpers.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-assist-prompt-box/ai-assist-prompt-box.component.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-assist-prompt-box/ai-assist-prompt-box.component.html","../../../../libs/modules/ai-management/client/src/lib/features/assist/ai-assist-prompt-box.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/assist-output-contract-from-input.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/extract-last-assistant-plain-text.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/build-structured-output-retry-user-text.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/parse-structured-assistant-text.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/repair-structured-assistant-parse.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/json-schema-mini-validator.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/validate-against-contract.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/run-structured-output-pipeline.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/output-contract-resolve.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-manager.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/widgets/agent-registry-tool-configurator/agent-registry-tool-configurator-widget.config.ts","../../../../libs/modules/ai-management/client/src/lib/features/widgets/assist-delegated-agent-configurator/assist-delegated-agent-configurator-widget.config.ts","../../../../libs/modules/ai-management/client/src/lib/widget-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/output-contract-transcript-segment.builtin-providers.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/platform-runtime-context-definition.provider.ts","../../../../libs/modules/ai-management/client/src/lib/ai-management.module.ts","../../../../libs/modules/ai-management/client/src/lib/features/utils/ai-delegated-agent-prompt-preview.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/utils/assist-initial-messages.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/utils/assist-starter-prompts.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/tools/ai-chat-tool-run-context.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/tools/ai-chat-tool.llm-parameters.ts","../../../../libs/modules/ai-management/client/src/lib/features/chat/ai-chat-tts-playback.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-provider-payload.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/engine/ai-delegated-agent-transcript.util.ts","../../../../libs/modules/ai-management/client/src/lib/features/assist/structured-output/validate-structured-assistant-response.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-assist-chat-model-catalog.service.ts","../../../../libs/modules/ai-management/client/src/lib/features/services/ai-default-model-picker.service.ts","../../../../libs/modules/ai-management/client/src/acorex-platform-module-ai-management-client.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n AXPFeatureDefinitionProvider,\n AXPFeatureDefinitionProviderContext,\n} from '@acorex-platform/framework-client/core';\nimport { AXPAiManagementFeatureKeys } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Feature Definition Provider ----\n\n/**\n * AI Management feature definitions.\n * ManageCatalog gates the Intelligence configuration menu (Platform Console edition).\n */\nexport class AXMAiManagementFeatureDefinitionProvider implements AXPFeatureDefinitionProvider {\n async provide(context: AXPFeatureDefinitionProviderContext): Promise<void> {\n const i18n = 'ai-management';\n context.addFeature(AXPAiManagementFeatureKeys.ManageCatalog, {\n title: `@${i18n}:features.manage-catalog.title`,\n description: `@${i18n}:features.manage-catalog.description`,\n defaultValue: false,\n type: 'boolean',\n });\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\r\nimport { AXPMenuProvider, AXPMenuProviderContext } from '@acorex-platform/framework-client/common';\r\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\r\nimport { inject, Injectable } from '@angular/core';\r\nimport {\r\n AXPAdministrationPermissionKeys,\r\n AXPAiManagementFeatureKeys,\r\n AXPAiManagementMenuKeys,\r\n RootConfig,\r\n} from '@acorex-platform/module-ai-management-client/contracts';\r\n\r\n//#endregion\r\n\r\n//#region ---- Menu Provider ----\r\n\r\n@Injectable()\r\nexport class AXMAiManagementMenuProvider implements AXPMenuProvider {\r\n private readonly entityService = inject(AXPEntityService);\r\n\r\n async provide(context: AXPMenuProviderContext): Promise<void> {\r\n const module = RootConfig.module;\r\n\r\n //#region ---- Configuration > AI Management (assists, models) ----\r\n\r\n // Platform Console edition only (same pattern as Identity Providers).\r\n const aiMenuPolicy = {\r\n features: [AXPAiManagementFeatureKeys.ManageCatalog],\r\n permissions: [AXPAdministrationPermissionKeys.MaintainAi],\r\n };\r\n\r\n const aiManagementConfigMenu = context.find(AXPAiManagementMenuKeys.AiManagementConfig);\r\n if (!aiManagementConfigMenu.exists) {\r\n context.find('Common:Menu:Configuration').addItems([\r\n {\r\n name: AXPAiManagementMenuKeys.AiManagementConfig,\r\n text: '@general:menus.ai-management.title',\r\n icon: module.icon,\r\n type: 'menu',\r\n priority: 8941,\r\n policy: aiMenuPolicy,\r\n children: [],\r\n },\r\n ]);\r\n }\r\n\r\n context.find(AXPAiManagementMenuKeys.AiManagementConfig).addItems([\r\n {\r\n name: AXPAiManagementMenuKeys.Agents,\r\n text: '@ai-management:module.menus.agents.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.agent.name),\r\n icon: RootConfig.entities.agent.icon,\r\n priority: -1,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Assists,\r\n text: '@ai-management:module.menus.assists.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.assist.name),\r\n icon: RootConfig.entities.assist.icon,\r\n priority: 0,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.OpenAiEndpoints,\r\n text: '@ai-management:module.menus.open-ai-endpoints.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.openAiEndpoint.name),\r\n icon: RootConfig.entities.openAiEndpoint.icon,\r\n priority: 2,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Models,\r\n text: '@ai-management:module.menus.models.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.model.name),\r\n icon: RootConfig.entities.model.icon,\r\n priority: 1,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Rules,\r\n text: '@ai-management:module.menus.rules.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.rule.name),\r\n icon: RootConfig.entities.rule.icon,\r\n priority: 3,\r\n policy: aiMenuPolicy,\r\n },\r\n {\r\n name: AXPAiManagementMenuKeys.Skills,\r\n text: '@ai-management:module.menus.skills.title',\r\n path: this.entityService.createPath(module.name, RootConfig.entities.skill.name),\r\n icon: RootConfig.entities.skill.icon,\r\n priority: 4,\r\n policy: aiMenuPolicy,\r\n },\r\n ]);\r\n\r\n //#endregion\r\n }\r\n}\r\n\r\n//#endregion\r\n","//#region ---- Imports ----\n\nimport { resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport type { AXMAiManagementAssistEntityModel } from '@acorex-platform/module-ai-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\n/** One assist row mapped for permission definition children. */\nexport interface AXMAiAssistPermissionRow {\n name: string;\n title: string;\n description?: string;\n}\n\n//#endregion\n\n//#region ---- Catalog load ----\n\n/**\n * Loads assist catalog rows for dynamic permission definitions.\n * Skips rows without a stable programmatic `name`.\n */\nexport async function loadAssistPermissionRows(\n entityService: AXPEntityService,\n localeId: string,\n): Promise<AXMAiAssistPermissionRow[]> {\n const assistData = entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<\n string,\n AXMAiManagementAssistEntityModel,\n AXMAiManagementAssistEntityModel,\n AXMAiManagementAssistEntityModel,\n AXMAiManagementAssistEntityModel\n >();\n\n const queryResult = await assistData.query({\n skip: 0,\n take: 500,\n sort: [{ field: 'name', dir: 'asc' }],\n });\n\n const items = (queryResult?.items ?? []) as AXMAiManagementAssistEntityModel[];\n const rows: AXMAiAssistPermissionRow[] = [];\n\n for (const item of items) {\n const name = item.name?.trim();\n if (!name) {\n continue;\n }\n\n const title = resolveMultiLanguageString(item.title, localeId).trim() || name;\n const descriptionRaw = item.description\n ? resolveMultiLanguageString(item.description, localeId).trim()\n : '';\n const description = descriptionRaw || undefined;\n\n rows.push({ name, title, description });\n }\n\n return rows.sort((a, b) => a.title.localeCompare(b.title, localeId, { sensitivity: 'base' }));\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AXPPermissionDefinitionProvider,\n AXPPermissionDefinitionProviderContext,\n} from '@acorex-platform/framework-client/auth';\nimport { AXPCommonPermissionGroupKeys } from '@acorex-platform/module-common-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { inject, Injectable, LOCALE_ID } from '@angular/core';\nimport { loadAssistPermissionRows } from './assist-permission-definition.builder';\nimport {\n AXMAiAssistPermissionKeys,\n AXPAdministrationPermissionKeys,\n} from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Permission Definition Provider ----\n\n/**\n * Registers AI section capabilities under Administration (including assist children).\n */\n@Injectable()\nexport class AXMPermissionDefinitionProvider implements AXPPermissionDefinitionProvider {\n private readonly entityService = inject(AXPEntityService);\n private readonly localeId = inject(LOCALE_ID);\n\n async define(context: AXPPermissionDefinitionProviderContext): Promise<void> {\n const keys = AXPAdministrationPermissionKeys;\n const groups = AXPCommonPermissionGroupKeys;\n const P = '@common:administration.permissions';\n const G = '@common:permission-groups';\n\n const assistRows = await loadAssistPermissionRows(this.entityService, this.localeId).catch(() => []);\n\n context.addGroup(groups.Administration.Root, `${G}.administration.title`, `${G}.administration.description`, { order: 120 });\n\n const groupBuilder = context\n .addGroup(\n groups.Administration.Ai,\n `${G}.administration-ai.title`,\n `${G}.administration-ai.description`,\n { parent: groups.Administration.Root, order: 50 },\n )\n .addPermission(keys.MaintainAi, `${P}.maintain-ai.title`, `${P}.maintain-ai.description`)\n .endPermission();\n\n let assistPermissionBuilder = groupBuilder.addPermission(\n keys.UseAiAssist,\n `${P}.use-ai-assist.title`,\n `${P}.use-ai-assist.description`,\n );\n\n for (const row of assistRows) {\n assistPermissionBuilder = assistPermissionBuilder.addChild(\n AXMAiAssistPermissionKeys.useForAssist(row.name),\n row.title,\n row.description,\n );\n }\n\n assistPermissionBuilder.endPermission().endGroup();\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AXP_SETTING_DEFINITION_PROVIDER,\n AXPSettingDefinitionProvider,\n AXPSettingDefinitionProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\nimport { AXPAiManagementSettings } from '@acorex-platform/module-ai-management-client/contracts';\nimport { objectKeyValueTransforms } from '@acorex-platform/framework-client/core';\nimport { Provider } from '@angular/core';\n\n//#endregion\n\n//#region ---- Settings Provider ----\n\nconst I18N = '@ai-management:settings';\n\nexport class AXMAiManagementSettingProvider implements AXPSettingDefinitionProvider {\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n // Extensions attach their own AI sections on this group (for example document reading and form designer).\n context\n .addGroup(\n 'ai-settings',\n `${I18N}.group.nav-title`,\n `${I18N}.group.description`,\n 'fa-light fa-robot',\n `${I18N}.group.title`,\n 60,\n )\n .addSection(\n 'global-ai',\n `${I18N}.section.global-ai.title`,\n `${I18N}.section.global-ai.description`,\n )\n .addSetting({\n key: AXPAiManagementSettings.DefaultAssistId,\n title: `${I18N}.default-assist.name.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n // Persist assist primary key (`id`); demo defaults come from settings seed/overrides.\n valueTransforms: objectKeyValueTransforms('id'),\n widget: {\n type: AXPWidgetsList.Editors.LookupBox,\n options: {\n entity: `${RootConfig.module.name}.${RootConfig.entities.assist.name}`,\n look: 'select',\n multiple: false,\n textField: 'title',\n valueField: 'id',\n hasClearButton: true,\n },\n },\n description: `${I18N}.default-assist.name.description`,\n })\n .addSetting({\n key: AXPAiManagementSettings.GlobalSystemPrompt,\n title: `${I18N}.global-system-prompt.prefix.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: undefined,\n widget: {\n type: AXPWidgetsList.Editors.LargeTextBox,\n layout: {\n stacked: true,\n },\n options: {\n rows: 8,\n placeholder: `${I18N}.global-system-prompt.prefix.placeholder`,\n },\n },\n description: `${I18N}.global-system-prompt.prefix.description`,\n })\n .endSection()\n .endGroup();\n }\n}\n\n/**\n * Registered after other Intelligence sections so Google Gemini stays last in that category.\n */\nexport class AXMAiManagementGeminiSettingProvider implements AXPSettingDefinitionProvider {\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n if (!context.hasGroup('ai-settings')) {\n return;\n }\n\n const intelligence = context.group('ai-settings');\n if (!intelligence) {\n return;\n }\n\n intelligence\n .addSection('gemini', `${I18N}.section.gemini.title`, `${I18N}.section.gemini.description`)\n .addSetting({\n key: AXPAiManagementSettings.Providers.Gemini.ApiKey,\n title: `${I18N}.gemini.api-key.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n // Server DB at-rest encryption; implies cacheable: false (no client IndexedDB).\n isEncrypted: true,\n defaultValue: undefined,\n widget: {\n type: AXPWidgetsList.Editors.TextBox,\n options: {\n placeholder: `${I18N}.gemini.api-key.placeholder`,\n },\n },\n description: `${I18N}.gemini.api-key.description`,\n })\n .endSection();\n }\n}\n\nexport function provideAiManagementGeminiSettings(): Provider {\n return {\n provide: AXP_SETTING_DEFINITION_PROVIDER,\n useClass: AXMAiManagementGeminiSettingProvider,\n multi: true,\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPTag, AXPTagProvider } from '@acorex-platform/framework-client/core';\nimport { Injectable } from '@angular/core';\n\n//#endregion\n\n/**\n * System tags for the AiModel entity `modelPurposes` field (tag-editor).\n * `title` values are stored as-is on the entity; keep them stable slugs.\n */\nconst AI_MODEL_PURPOSE_TAGS: AXPTag[] = [\n {\n id: 'ai-model-purpose-chat',\n title: 'chat',\n color: '#0284c7',\n description: 'Chat / text completion',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-vision',\n title: 'vision',\n color: '#7c3aed',\n description: 'Multimodal (image input in chat)',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-image',\n title: 'image',\n color: '#db2777',\n description: 'Image generation',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-speech',\n title: 'speech',\n color: '#16a34a',\n description: 'Speech to text',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-tts',\n title: 'tts',\n color: '#ea580c',\n description: 'Text to speech',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-video',\n title: 'video',\n color: '#0f766e',\n description: 'Video generation',\n scope: 'system',\n },\n {\n id: 'ai-model-purpose-live-voice',\n title: 'live-voice',\n color: '#c026d3',\n description: 'Realtime live voice (OpenAI Realtime / Gemini Live)',\n scope: 'system',\n },\n];\n\n//#region ---- Provider ----\n\n@Injectable()\nexport class AXMAiModelPurposeTagProvider extends AXPTagProvider {\n readonly name = 'ai-model-purpose';\n\n override provide(): Promise<AXPTag[]> {\n return Promise.resolve(AI_MODEL_PURPOSE_TAGS);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable } from '@angular/core';\nimport type { AXPAiAssistRunInput, AXPAiAssistRunResult, AXPAiAssistShowOptions } from '../types/ai-assist.types';\n\n//#endregion\n\n//#region ---- Abstract token ----\n\n/**\n * Optional cross-cutting AI assist: programmatic {@link run} and dialog {@link show}.\n * Implemented by {@link AXPAiManagerService}. Consumers outside ai-management should prefer hooks or optional injection.\n */\n@Injectable()\nexport abstract class AXPAiAssistService {\n abstract run(input: AXPAiAssistRunInput): Promise<AXPAiAssistRunResult>;\n\n /** Opens prompt UI; on Send runs {@link run} and closes the dialog. Cancel resolves `null`. */\n abstract show(options: AXPAiAssistShowOptions): Promise<AXPAiAssistRunResult | null>;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiAgentOutputContract } from '../engine/ai-agent-output-contract.types';\n\n//#endregion\n\n//#region ---- Structured output ----\n\n/** Default max completion tokens when the AiModel row has no `maxOutputTokens` and the caller omits `maxTokens`. */\nexport const AXPAiAssistDefaultStructuredMaxTokens = 32_000;\n\n/** Default maximum follow-up turns after the first model response when validating structured JSON (implementation may use this). */\nexport const AXPAiAssistDefaultMaxStructuredRetries = 3;\n\n/**\n * Validates parsed JSON from the assistant. Return the validated value (possibly narrowed), or throw with a message\n * the pipeline can send back to the model on retry.\n */\nexport type AXPAiStructuredValidator<T = unknown> = (parsed: unknown) => T | Promise<T>;\n\n/**\n * Thrown when {@link AXPAiAssistRunInput.expectStructuredOutput} is true but the assistant output could not be\n * parsed and optionally validated after all attempts.\n */\nexport class AXPAiStructuredOutputError extends Error {\n /** 1-based count of engine runs performed for this structured-output session. */\n readonly attempts: number;\n\n /** Truncated snapshot of the last assistant plain text (for debugging). */\n readonly lastAssistantText: string;\n\n /** Human-readable validation or parse failure detail. */\n readonly validationMessage: string;\n\n /** Why the pipeline stopped. */\n readonly code?: 'duplicate_assistant_output' | 'validation_exhausted';\n\n constructor(options: {\n message: string;\n attempts: number;\n lastAssistantText: string;\n validationMessage: string;\n cause?: unknown;\n code?: 'duplicate_assistant_output' | 'validation_exhausted';\n }) {\n super(options.message, options.cause !== undefined ? { cause: options.cause } : undefined);\n this.name = 'AXPAiStructuredOutputError';\n this.attempts = options.attempts;\n this.lastAssistantText = options.lastAssistantText;\n this.validationMessage = options.validationMessage;\n this.code = options.code;\n }\n}\n\n//#endregion\n\n//#region ---- Prompt surface ----\n\n/** One persisted user attachment (same storage contract as the AI chat composer). */\nexport interface AXPAiAssistUserMediaAttachment {\n /** `image` / `audio` / `file` (PDF, text, spreadsheets, and other document MIME types). */\n kind: 'image' | 'audio' | 'file';\n fileId: string;\n mimeType: string;\n name?: string;\n}\n\n/**\n * Payload when submitting the assist prompt box (text, optional target assist/agent, optional media).\n */\nexport interface AXPAiAssistPromptSubmitPayload {\n prompt: string;\n assistId?: string;\n userMediaAttachments: AXPAiAssistUserMediaAttachment[];\n}\n\n/** Execution options for a prompt-box submit (not user/prompt data). */\nexport interface AXPAiAssistPromptExecutionContext {\n abortSignal: AbortSignal;\n}\n\n//#endregion\n\n//#region ---- Context & run ----\n\n/**\n * Optional structured hints for a single assist run (serialized into the user message by the implementation).\n */\nexport interface AXPAiAssistRunContext {\n /** Short bullet hints appended to the prompt for the model. */\n hints?: string[];\n /** Extra system-level instruction for this run (implementation may emit a system message). */\n systemInstruction?: string;\n /** Arbitrary structured payload (JSON-serialized in the user message when present). */\n structuredContext?: unknown;\n}\n\n/**\n * Input for the AI assist `run` API (implemented in ai-management).\n */\nexport interface AXPAiAssistRunInput {\n prompt: string;\n /**\n * Optional images, audio, or documents (`fileId` from tenant storage). When non-empty, the implementation builds one multimodal\n * user message (same shape as the AI chat composer) plus the serialized prompt body as text segments.\n */\n userMediaAttachments?: AXPAiAssistUserMediaAttachment[];\n context?: AXPAiAssistRunContext;\n /**\n * Catalog assist id. When omitted, the platform default assist is used.\n */\n assistId?: string;\n maxSteps?: number;\n temperature?: number;\n /**\n * Max completion tokens for this engine run (when the provider supports it). Structured JSON runs apply a higher\n * default unless {@link structuredOutputMaxTokens} is set.\n */\n maxTokens?: number;\n /**\n * Declarative output contract for this run (preferred over legacy {@link expectStructuredOutput} flags).\n * Resolved with agent/assist defaults via {@link resolveEffectiveOutputContract}.\n */\n outputContract?: AXPAiAgentOutputContract;\n /** When true, implementation tries to parse assistant text as JSON into {@link AXPAiAssistRunResult.structured}. */\n expectStructuredOutput?: boolean;\n /** Extra instruction appended so the model returns JSON (used when {@link expectStructuredOutput} is true). */\n structuredOutputInstruction?: string;\n /**\n * Shallow merge over built-in platform runtime context fields (see ai-management implementation).\n */\n platformRuntimeNotes?: Record<string, unknown>;\n\n /**\n * Max extra engine turns after the first response when structured output is invalid (default {@link AXPAiAssistDefaultMaxStructuredRetries}).\n * Total attempts = 1 + maxStructuredRetries.\n */\n maxStructuredRetries?: number;\n\n /** Optional schema or domain validation after JSON parse. */\n structuredValidator?: AXPAiStructuredValidator;\n\n /**\n * When false, only one engine run is performed; invalid structured output throws {@link AXPAiStructuredOutputError}.\n * When true (default for {@link expectStructuredOutput}), invalid output triggers follow-up user messages in the same transcript.\n */\n retryOnInvalidStructure?: boolean;\n\n /**\n * Optional description of the expected JSON shape (TypeScript-style or JSON schema summary), appended to the first\n * user message and to retry prompts so the model stays aligned and retries are more accurate.\n */\n structuredOutputSchemaSummary?: string;\n\n /**\n * Overrides {@link maxTokens} for {@link expectStructuredOutput} runs only. Prefer setting this or leaving defaults so\n * the implementation can apply {@link AXPAiAssistDefaultStructuredMaxTokens} and avoid truncated JSON.\n */\n structuredOutputMaxTokens?: number;\n\n /**\n * Cancels this assist run. Not serialized to the engine JSON body.\n */\n abortSignal?: AbortSignal;\n}\n\n/**\n * Result of the AI assist `run` API.\n */\nexport interface AXPAiAssistRunResult {\n /** When false, structured validation exhausted or cannotComplete (future). */\n success?: boolean;\n /** Effective output contract kind for this run. */\n outputKind?: import('../engine/ai-agent-output-contract.types').AXPAiAgentOutputKind;\n /** Primary assistant reply text (extracted from the engine transcript). */\n text: string;\n /**\n * Present when {@link AXPAiAssistRunInput.expectStructuredOutput} is true: validated structured payload\n * (parse + optional {@link AXPAiAssistRunInput.structuredValidator}). On failure the implementation throws\n * {@link AXPAiStructuredOutputError} instead of returning.\n */\n structured?: unknown;\n /** Same as {@link structured} when using the execution-result envelope. */\n data?: unknown;\n /** Validation failures when returned without throwing (reserved). */\n validationErrors?: import('../assist/structured-output/execution-result.types').AXPAiAssistValidationError[];\n /** Full normalized transcript when available. */\n messages?: import('../engine/ai-engine.types').AXPAiChatMessage[];\n /**\n * When {@link AXPAiAssistRunInput.expectStructuredOutput} is false: engine usage / provider payload for that single run.\n * When true: {@link AXPAiAssistStructuredOutputRunRaw} with per-attempt usage and totals for debugging.\n */\n raw?: unknown;\n}\n\n//#endregion\n\n//#region ---- Structured run raw (debugging) ----\n\n/**\n * Token usage for a single engine run; numeric fields align with {@link AXPAiEngineUsageTotals} in this module\n * for stable client-side debugging contracts.\n */\nexport interface AXPAiAssistTokenUsageSnapshot {\n promptTokens: number;\n completionTokens: number;\n totalTokens: number;\n cachedPromptTokens?: number;\n}\n\n/**\n * One engine execution within a structured-output session.\n */\nexport interface AXPAiAssistStructuredOutputAttemptRecord {\n /** 1-based index of this engine run. */\n attemptIndex: number;\n /** Usage reported for this run only. */\n usage?: AXPAiAssistTokenUsageSnapshot;\n /** Whether a last-provider payload was present for this run. */\n hasLastProviderResult: boolean;\n}\n\n/**\n * Explicit `raw` shape for {@link AXPAiAssistRunResult} when {@link AXPAiAssistRunInput.expectStructuredOutput} is true.\n */\nexport interface AXPAiAssistStructuredOutputRunRaw {\n kind: 'structured-output';\n /** One entry per engine call (`runEngine` / structured-output retries). */\n attempts: AXPAiAssistStructuredOutputAttemptRecord[];\n /** Cumulative usage across all attempts. */\n totalUsage?: AXPAiAssistTokenUsageSnapshot;\n /** Count of engine runs in this session (same as the last `attemptIndex`). */\n finalAttempt: number;\n lastProviderResult?: unknown;\n}\n\n//#endregion\n\n//#region ---- Show prompt surface ----\n\n/**\n * Typical max width of the prompt box column inside the bottom overlay (maps to `contentMaxWidthPx`).\n */\nexport type AXPAiAssistPopupSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n\n/**\n * Indeterminate loading dialog shown while the prompt box executes an assist run after Send (model work /\n * structured-output retries).\n */\nexport interface AXPAiAssistRunLoadingDialogSpec {\n title: string;\n text: string;\n}\n\n/**\n * Options for the AI assist `show` prompt API: same run-related fields as {@link AXPAiAssistRunInput} except `prompt`,\n * plus UI chrome. The user-entered prompt from the surface is merged on Send.\n */\nexport interface AXPAiAssistShowOptions {\n /**\n * Prompt box header; must be translated by the caller. Entity list assist uses\n * `@extensions-ai-entity:assist.dialog-title.{type-level|selected|individual}`.\n */\n title: string;\n placeholder?: string;\n initialPrompt?: string;\n size?: AXPAiAssistPopupSize;\n context?: AXPAiAssistRunContext;\n /**\n * Optional catalog assist. When omitted, the tenant/platform default assist applies.\n */\n assistId?: string;\n maxSteps?: number;\n temperature?: number;\n maxTokens?: number;\n outputContract?: AXPAiAgentOutputContract;\n expectStructuredOutput?: boolean;\n structuredOutputInstruction?: string;\n platformRuntimeNotes?: Record<string, unknown>;\n maxStructuredRetries?: number;\n structuredValidator?: AXPAiStructuredValidator;\n retryOnInvalidStructure?: boolean;\n structuredOutputSchemaSummary?: string;\n structuredOutputMaxTokens?: number;\n\n /**\n * Ignored by {@link AXPAiManagerService.show}: the prompt box is the progress and Stop surface.\n * Callers may still pass translated strings for compatibility.\n */\n runLoadingDialog?: AXPAiAssistRunLoadingDialogSpec;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable } from '@angular/core';\nimport type { AXPAiEngineRunOptions, AXPAiEngineRunResult } from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Engine (abstract service) ----\n\n/**\n * Backend boundary for AI assist runs (chat + tool rounds). Connectivity implementations execute registry\n * commands/queries during the run loop.\n * Wire a concrete implementation via Angular providers (for example `provide: AXPAiEngine` with `useClass`).\n */\n@Injectable()\nexport abstract class AXPAiEngine {\n /**\n * Sends the conversation to the AI backend and returns updated messages (including tool rounds).\n */\n abstract run(options: AXPAiEngineRunOptions): Promise<AXPAiEngineRunResult>;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type {\n AXPAiChatMessage,\n AXPAiChatResponse,\n AXPAiDelegatedAgentResultSegment,\n} from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- Message builders (client-only) ----\n\nexport function axpAiChatUserMessage(responses: AXPAiChatResponse[]): AXPAiChatMessage {\n return {\n role: 'user',\n responses,\n };\n}\n\n//#endregion\n\n//#region ---- Transcript read helpers (display only) ----\n\nexport function axpAiChatMessageIsDelegatedReflectionExcluded(message: AXPAiChatMessage): boolean {\n return message.delegatedReflection === true;\n}\n\n/** Reads typed specialist segments from a normalized {@code agent_result} payload. */\nexport function axpAiDelegatedAgentResultSegments(\n payload: { success?: boolean; data?: { responses?: AXPAiDelegatedAgentResultSegment[] } },\n): AXPAiDelegatedAgentResultSegment[] {\n if (payload.success !== true || !Array.isArray(payload.data?.responses)) {\n return [];\n }\n return payload.data.responses;\n}\n\n/** Plain text from specialist segments (text + think) for debug / preview UI. */\nexport function axpAiDelegatedAgentOutcomeResponsesPlainText(segments: AXPAiDelegatedAgentResultSegment[]): string {\n const parts: string[] = [];\n for (const s of segments) {\n if (s.type === 'text' || s.type === 'think') {\n const t = s.content.trim();\n if (t.length > 0) {\n parts.push(t);\n }\n }\n }\n return parts.join('\\n\\n').trim();\n}\n\nexport function axpAiChatToolResultBodyJson(message: AXPAiChatMessage): string {\n return axpAiChatToolOrAgentResultBodyJson(message);\n}\n\nexport function axpAiChatToolOrAgentResultBodyJson(message: AXPAiChatMessage): string {\n const tr = message.responses.find((r) => r.type === 'tool_result' || r.type === 'agent_result');\n if (!tr || (tr.type !== 'tool_result' && tr.type !== 'agent_result')) {\n return '';\n }\n try {\n return JSON.stringify(tr.content);\n } catch {\n return String(tr.content);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPPlatformScope, AXPRegionalSetting } from '@acorex-platform/framework-shared/core';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSettingsService } from '@acorex-platform/framework-client/common';\n\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { Injectable, inject } from '@angular/core';\nimport {\n assembleAxpAiPlatformRuntimeContext,\n type AXPAiPlatformRuntimeContext,\n} from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Builder ----\n\n/**\n * Builds {@link AXPAiPlatformRuntimeContext} from session and user-scoped regional settings.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPAiPlatformRuntimeContextBuilder {\n //#region ---- Services & Dependencies ----\n\n private readonly session = inject(AXPSessionService);\n private readonly settings = inject(AXPSettingsService);\n private readonly translation = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n /**\n * Resolves current user, tenant, application, UI language, and regional preferences from storage.\n */\n async build(): Promise<AXPAiPlatformRuntimeContext> {\n const user = this.session.user;\n const tenant = this.session.tenant;\n const application = this.session.application;\n const userScope = this.settings.scope(AXPPlatformScope.User);\n\n const [calendarRaw, tzRaw, countryRaw] = await Promise.all([\n userScope.get(AXPRegionalSetting.Calendar),\n userScope.get(AXPRegionalSetting.TimeZone),\n userScope.get(AXPRegionalSetting.Country),\n ]);\n\n const calendarSystem = typeof calendarRaw === 'string' && calendarRaw.trim() ? calendarRaw.trim() : undefined;\n const timeZone = typeof tzRaw === 'string' && tzRaw.trim() ? tzRaw.trim() : undefined;\n const country = typeof countryRaw === 'string' && countryRaw.trim() ? countryRaw.trim() : undefined;\n\n const locale = this.translation.getActiveLang();\n const now = new Date();\n\n return assembleAxpAiPlatformRuntimeContext({\n userDisplayName: [user?.title?.trim(), user?.name?.trim()].find((s) => s && s.length > 0),\n tenantTitle: resolveMultiLanguageString(tenant?.title, locale).trim() || tenant?.name?.trim(),\n applicationTitle:\n resolveMultiLanguageString(application?.title, locale).trim() || application?.name?.trim(),\n locale,\n calendarSystem,\n timeZone,\n country,\n now,\n });\n }\n\n //#endregion\n}\n\n//#endregion\n","//#region ---- Abort detection (client-only) ----\n\nfunction errorName(value: unknown): string | undefined {\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n const name = (value as { name?: unknown }).name;\n return typeof name === 'string' ? name : undefined;\n}\n\nfunction isAbortNamed(value: unknown): boolean {\n return errorName(value) === 'AbortError';\n}\n\nexport function isAiAssistAbortError(error: unknown, signal?: AbortSignal): boolean {\n if (signal?.aborted) {\n return true;\n }\n if (isAbortNamed(error)) {\n return true;\n }\n if (error && typeof error === 'object') {\n const cause = (error as { cause?: unknown }).cause;\n if (isAbortNamed(cause)) {\n return true;\n }\n }\n if (isAbortNamed(signal?.reason)) {\n return true;\n }\n return false;\n}\n\nexport function createAiAssistAbortError(message = 'AI assist run cancelled', options?: { cause?: unknown }): Error {\n const error = options && 'cause' in options ? new Error(message, { cause: options.cause }) : new Error(message);\n error.name = 'AbortError';\n return error;\n}\n\nexport function assertAiAssistNotAborted(signal?: AbortSignal): void {\n if (!signal?.aborted) {\n return;\n }\n const reason = signal.reason;\n if (reason instanceof Error && isAbortNamed(reason)) {\n throw reason;\n }\n throw createAiAssistAbortError('AI assist run cancelled', reason !== undefined ? { cause: reason } : undefined);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\nimport { AXPFileStorageStatus } from '@acorex-platform/framework-shared/core';\nimport { type AXPFileStorageService } from '@acorex-platform/framework-client/common';\n\n//#endregion\n\n//#region ---- Constants ----\n\n/** Max length for relaying an https image URL in tool_result when persistence fails (CORS, etc.). */\nexport const AI_GENERATED_IMAGE_MAX_REMOTE_URL_IN_TOOL = 2048;\n\n/** refType for files created from in-chat image tool output. */\nexport const AI_CHAT_GENERATED_IMAGE_REF_TYPE = `${RootConfig.module.name}.AiChatGeneratedImage`;\n\n/** refType for files created from in-chat text-to-speech tool output. */\nexport const AI_CHAT_GENERATED_SPEECH_REF_TYPE = `${RootConfig.module.name}.AiChatGeneratedSpeech`;\n\n/** refType for user-attached images in AI chat; {@link persistAiChatAttachmentImage} uses a batch ref id. */\nexport const AI_CHAT_ATTACHMENT_REF_TYPE = `${RootConfig.module.name}.AiChatAttachment`;\n\n/** File storage category for user chat image attachments. */\nexport const AI_CHAT_ATTACHMENT_CATEGORY = 'ai-chat-attachment';\n\n//#endregion\n\n//#region ---- URL / File conversion ----\n\n/**\n * Builds a File from a vendor image URL (https) or data URL (base64 image).\n */\nexport async function blobOrFileFromImageResult(\n imageUrl: string,\n defaultName = 'ai-generated.png',\n): Promise<File> {\n const trimmed = imageUrl.trim();\n if (!trimmed) {\n throw new Error('Image URL is empty.');\n }\n\n if (trimmed.startsWith('data:')) {\n const res = await fetch(trimmed);\n if (!res.ok) {\n throw new Error(`Failed to read data URL (${res.status}).`);\n }\n const blob = await res.blob();\n const mime = blob.type || parseDataUrlMime(trimmed) || 'image/png';\n return new File([blob], defaultName, { type: mime });\n }\n\n if (trimmed.startsWith('https://') || trimmed.startsWith('http://')) {\n const res = await fetch(trimmed);\n if (!res.ok) {\n throw new Error(`Failed to fetch image (${res.status}).`);\n }\n const blob = await res.blob();\n const mime =\n blob.type ||\n res.headers.get('Content-Type')?.split(';')[0]?.trim() ||\n 'image/png';\n const ext = mime.includes('jpeg') || mime.includes('jpg') ? 'jpg' : mime.includes('webp') ? 'webp' : 'png';\n return new File([blob], defaultName.replace(/\\.[^.]+$/, '') + '.' + ext, { type: mime });\n }\n\n throw new Error('Unsupported image URL scheme (expected https: or data:).');\n}\n\nfunction parseDataUrlMime(dataUrl: string): string | undefined {\n const m = /^data:([^;,]+)[;,]/.exec(dataUrl);\n return m?.[1]?.trim();\n}\n\n//#endregion\n\n//#region ---- Persistence ----\n\n/**\n * Saves the file and commits it so it appears in storage queries as committed.\n */\nexport async function persistAiGeneratedImage(\n fileStorage: AXPFileStorageService,\n file: File,\n ref: { refId: string; refType: string },\n): Promise<{ fileId: string }> {\n const info = await fileStorage.save({\n file,\n name: file.name,\n refId: ref.refId,\n refType: ref.refType,\n category: 'ai-generated-image',\n status: AXPFileStorageStatus.Temporary,\n });\n const fileId = info.fileId?.trim();\n if (!fileId) {\n throw new Error('File storage did not return a fileId.');\n }\n await fileStorage.commit(fileId);\n return { fileId };\n}\n\n/**\n * Persists a user-selected chat image; refId groups files uploaded in the same composer batch.\n */\nexport async function persistAiChatAttachmentImage(\n fileStorage: AXPFileStorageService,\n file: File,\n refId: string,\n): Promise<{ fileId: string }> {\n const trimmed = refId.trim();\n if (!trimmed) {\n throw new Error('refId is required for chat attachment persistence.');\n }\n const info = await fileStorage.save({\n file,\n name: file.name,\n refId: trimmed,\n refType: AI_CHAT_ATTACHMENT_REF_TYPE,\n category: AI_CHAT_ATTACHMENT_CATEGORY,\n status: AXPFileStorageStatus.Temporary,\n });\n const fileId = info.fileId?.trim();\n if (!fileId) {\n throw new Error('File storage did not return a fileId.');\n }\n await fileStorage.commit(fileId);\n return { fileId };\n}\n\n/**\n * Saves synthesized speech bytes and commits so the file id can be replayed in chat.\n */\nexport async function persistAiGeneratedSpeech(\n fileStorage: AXPFileStorageService,\n file: File,\n ref: { refId: string; refType: string },\n): Promise<{ fileId: string }> {\n const info = await fileStorage.save({\n file,\n name: file.name,\n refId: ref.refId,\n refType: ref.refType,\n category: 'ai-generated-speech',\n status: AXPFileStorageStatus.Temporary,\n });\n const fileId = info.fileId?.trim();\n if (!fileId) {\n throw new Error('File storage did not return a fileId.');\n }\n await fileStorage.commit(fileId);\n return { fileId };\n}\n\n//#endregion\n","//#region ---- Limits ----\n\n/** Max image file size for AI chat / assist composer attachments (bytes). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_IMAGE_BYTES = 20 * 1024 * 1024;\n\n/** Max images per composer batch (same cap as chat page). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_IMAGES_PER_TURN = 20;\n\n/** Max audio file size (bytes). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_AUDIO_BYTES = 25 * 1024 * 1024;\n\n/** Max audio files per composer batch. */\nexport const AXM_AI_CHAT_COMPOSER_MAX_AUDIO_PER_TURN = 5;\n\n/** Max document file size for PDF / text / office-style attachments (bytes). */\nexport const AXM_AI_CHAT_COMPOSER_MAX_DOCUMENT_BYTES = 35 * 1024 * 1024;\n\n/** Max document files per composer batch. */\nexport const AXM_AI_CHAT_COMPOSER_MAX_DOCUMENTS_PER_TURN = 10;\n\n//#endregion\n\n//#region ---- Patterns ----\n\nconst CHAT_IMAGE_NAME_EXT_PATTERN = /\\.(png|jpe?g|gif|webp|bmp|svg|ico|heic|heif)$/i;\n\nconst CHAT_AUDIO_NAME_EXT_PATTERN = /\\.(mp3|m4a|aac|wav|webm|ogg|opus|flac)$/i;\n\nconst CHAT_DOCUMENT_NAME_EXT_PATTERN =\n /\\.(pdf|txt|md|markdown|csv|tsv|json|jsonl|xml|html?|yaml|yml|log|rtf|docx?|xlsx?|pptx?|odt|ods|odp)$/i;\n\n//#endregion\n\n//#region ---- Public API ----\n\n/**\n * Returns true for normal `image/*` types and for empty/octet-stream when the file name looks like an image.\n */\nexport function axmIsLikelyChatImageFile(file: File): boolean {\n const t = file.type?.trim() ?? '';\n if (t.startsWith('image/')) {\n return true;\n }\n if (t === 'application/octet-stream' || t === '') {\n return CHAT_IMAGE_NAME_EXT_PATTERN.test(file.name);\n }\n return false;\n}\n\n/**\n * Returns true for normal `audio/*` types and for empty/octet-stream when the file name looks like audio.\n */\nexport function axmIsLikelyChatAudioFile(file: File): boolean {\n const t = file.type?.trim() ?? '';\n if (t.startsWith('audio/')) {\n return true;\n }\n if (t === 'application/octet-stream' || t === '') {\n return CHAT_AUDIO_NAME_EXT_PATTERN.test(file.name);\n }\n return false;\n}\n\n/**\n * Returns true for PDF, plain text, common code/markup, CSV, and typical Office/OpenDocument uploads.\n */\nexport function axmIsLikelyChatDocumentFile(file: File): boolean {\n const t = file.type?.trim().toLowerCase() ?? '';\n if (t === 'application/pdf' || t.startsWith('text/')) {\n return true;\n }\n if (\n t === 'application/json' ||\n t === 'application/xml' ||\n t === 'application/javascript' ||\n t === 'application/typescript' ||\n t === 'text/csv' ||\n t === 'application/csv' ||\n t === 'text/tsv' ||\n t === 'application/rtf' ||\n t === 'text/rtf' ||\n t.includes('wordprocessingml') ||\n t.includes('spreadsheetml') ||\n t.includes('presentationml') ||\n t.includes('msword') ||\n t.includes('ms-excel') ||\n t.includes('ms-powerpoint') ||\n t.includes('opendocument')\n ) {\n return true;\n }\n if (t === 'application/octet-stream' || t === '') {\n return CHAT_DOCUMENT_NAME_EXT_PATTERN.test(file.name);\n }\n return false;\n}\n\n/**\n * MIME for storage/API when the browser omits or misreports `file.type` (images and common audio extensions).\n */\nexport function axmMimeTypeForChatAttachment(file: File): string {\n const t = file.type?.trim() ?? '';\n if (t.startsWith('image/')) {\n return t;\n }\n if (t.startsWith('audio/')) {\n return t;\n }\n if (t.startsWith('text/') || t === 'application/pdf' || t === 'application/json' || t === 'application/xml') {\n return t;\n }\n const m = /\\.([^.]+)$/i.exec(file.name);\n const ext = (m?.[1] ?? '').toLowerCase();\n const imageByExt: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n bmp: 'image/bmp',\n svg: 'image/svg+xml',\n ico: 'image/x-icon',\n heic: 'image/heic',\n heif: 'image/heif',\n };\n const audioByExt: Record<string, string> = {\n mp3: 'audio/mpeg',\n m4a: 'audio/mp4',\n aac: 'audio/aac',\n wav: 'audio/wav',\n webm: 'audio/webm',\n ogg: 'audio/ogg',\n opus: 'audio/opus',\n flac: 'audio/flac',\n };\n const docByExt: Record<string, string> = {\n pdf: 'application/pdf',\n txt: 'text/plain',\n md: 'text/markdown',\n markdown: 'text/markdown',\n csv: 'text/csv',\n tsv: 'text/tab-separated-values',\n json: 'application/json',\n jsonl: 'application/jsonl',\n xml: 'application/xml',\n html: 'text/html',\n htm: 'text/html',\n yaml: 'text/yaml',\n yml: 'text/yaml',\n log: 'text/plain',\n rtf: 'application/rtf',\n doc: 'application/msword',\n docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n xls: 'application/vnd.ms-excel',\n xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n ppt: 'application/vnd.ms-powerpoint',\n pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n odt: 'application/vnd.oasis.opendocument.text',\n ods: 'application/vnd.oasis.opendocument.spreadsheet',\n odp: 'application/vnd.oasis.opendocument.presentation',\n };\n return imageByExt[ext] ?? audioByExt[ext] ?? docByExt[ext] ?? 'application/octet-stream';\n}\n\n//#endregion\n","//#region ---- Imports ----\r\n\r\nimport { AXButtonModule } from '@acorex/components/button';\r\nimport { AXDecoratorModule } from '@acorex/components/decorators';\r\nimport { AXDropdownModule } from '@acorex/components/dropdown';\r\nimport { AXDropdownButtonModule } from '@acorex/components/dropdown-button';\r\nimport { AXTextAreaModule } from '@acorex/components/text-area';\r\nimport { AXToastService } from '@acorex/components/toast';\r\nimport { AXFileService } from '@acorex/core/file';\r\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\r\nimport { AXPFileStorageService } from '@acorex-platform/framework-client/common';\r\nimport { createRandomUuid } from '@acorex-platform/framework-shared/core';\r\nimport type {\r\n AXPAiAssistPromptExecutionContext,\r\n AXPAiAssistPromptSubmitPayload,\r\n AXPAiAssistRunResult,\r\n AXPAiAssistUserMediaAttachment,\r\n} from '../../types/ai-assist.types';\r\nimport { isAiAssistAbortError } from '../ai-run-abort.util';\r\nimport { persistAiChatAttachmentImage } from '../../chat/ai-generated-image-persist';\r\nimport {\r\n AXM_AI_CHAT_COMPOSER_MAX_AUDIO_BYTES,\r\n AXM_AI_CHAT_COMPOSER_MAX_AUDIO_PER_TURN,\r\n AXM_AI_CHAT_COMPOSER_MAX_DOCUMENT_BYTES,\r\n AXM_AI_CHAT_COMPOSER_MAX_DOCUMENTS_PER_TURN,\r\n AXM_AI_CHAT_COMPOSER_MAX_IMAGE_BYTES,\r\n AXM_AI_CHAT_COMPOSER_MAX_IMAGES_PER_TURN,\r\n axmIsLikelyChatAudioFile,\r\n axmIsLikelyChatDocumentFile,\r\n axmIsLikelyChatImageFile,\r\n axmMimeTypeForChatAttachment,\r\n} from '../ai-chat-composer-media.helpers';\r\nimport { CommonModule, isPlatformBrowser } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n OnDestroy,\r\n OnInit,\r\n PLATFORM_ID,\r\n ViewEncapsulation,\r\n computed,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\n\r\n//#endregion\r\n\r\n//#region ---- Draft types ----\r\n\r\ninterface AXMAiAssistDraftImage {\r\n clientId: string;\r\n previewUrl: string;\r\n mimeType: string;\r\n name?: string;\r\n fileId?: string;\r\n}\r\n\r\ninterface AXMAiAssistDraftAudio {\r\n clientId: string;\r\n mimeType: string;\r\n name?: string;\r\n fileId?: string;\r\n}\r\n\r\ninterface AXMAiAssistDraftFile {\r\n clientId: string;\r\n mimeType: string;\r\n name?: string;\r\n fileId?: string;\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---- Component ----\r\n\r\n/**\r\n * Floating prompt UI for AI assist: gradient chrome, inner composer, and image/audio/document attachments. Target assist/agent comes from optional initial ids on open.\r\n */\r\n@Component({\r\n selector: 'axm-ai-assist-prompt-box',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.None,\r\n host: {\r\n '(document:keydown.escape)': 'onDocumentEscape()',\r\n },\r\n templateUrl: './ai-assist-prompt-box.component.html',\r\n styleUrl: './ai-assist-prompt-box.component.css',\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n AXButtonModule,\r\n AXDecoratorModule,\r\n AXDropdownModule,\r\n AXDropdownButtonModule,\r\n AXTextAreaModule,\r\n AXTranslationModule,\r\n ],\r\n})\r\nexport class AXMAiAssistPromptBoxComponent implements OnInit, OnDestroy {\r\n //#region ---- Services & Dependencies ----\r\n\r\n private readonly toastService = inject(AXToastService);\r\n private readonly translation = inject(AXTranslationService);\r\n private readonly fileStorage = inject(AXPFileStorageService);\r\n private readonly fileService = inject(AXFileService);\r\n private readonly platformId = inject(PLATFORM_ID);\r\n\r\n //#endregion\r\n\r\n //#region ---- Inputs ----\r\n\r\n readonly title = input.required<string>();\r\n\r\n readonly placeholder = input<string>('');\r\n\r\n readonly initialPrompt = input<string>('');\r\n\r\n readonly contentMaxWidthPx = input<number>(680);\r\n\r\n readonly initialAssistId = input<string | undefined>(undefined);\r\n\r\n readonly runPrompt =\r\n input.required<\r\n (\r\n payload: AXPAiAssistPromptSubmitPayload,\r\n execution: AXPAiAssistPromptExecutionContext,\r\n ) => Promise<AXPAiAssistRunResult>\r\n >();\r\n\r\n readonly requestClose = input.required<(result: AXPAiAssistRunResult | null) => void>();\r\n\r\n //#endregion\r\n\r\n //#region ---- State ----\r\n\r\n readonly promptDraft = signal('');\r\n\r\n readonly runPhase = signal<'idle' | 'running' | 'stopping'>('idle');\r\n\r\n readonly busy = computed(() => this.runPhase() !== 'idle');\r\n\r\n readonly isComposerSaving = signal(false);\r\n\r\n readonly draftAttachmentGroupId = signal<string | null>(null);\r\n\r\n readonly draftComposerImages = signal<AXMAiAssistDraftImage[]>([]);\r\n\r\n readonly draftComposerAudios = signal<AXMAiAssistDraftAudio[]>([]);\r\n\r\n readonly draftComposerFiles = signal<AXMAiAssistDraftFile[]>([]);\r\n\r\n readonly assistTargetKey = signal('');\r\n\r\n private runAbortController: AbortController | null = null;\r\n\r\n //#endregion\r\n\r\n //#region ---- Computed ----\r\n\r\n readonly canSend = computed(() => {\r\n if (this.runPhase() !== 'idle' || this.isComposerSaving()) {\r\n return false;\r\n }\r\n const textOk = this.promptDraft().trim().length > 0;\r\n const draftImg = this.draftComposerImages();\r\n const draftAud = this.draftComposerAudios();\r\n const draftFiles = this.draftComposerFiles();\r\n const allImagesSaved = draftImg.length === 0 || draftImg.every((s) => Boolean(s.fileId?.trim()));\r\n const allAudiosSaved = draftAud.length === 0 || draftAud.every((s) => Boolean(s.fileId?.trim()));\r\n const allFilesSaved = draftFiles.length === 0 || draftFiles.every((s) => Boolean(s.fileId?.trim()));\r\n if (!allImagesSaved || !allAudiosSaved || !allFilesSaved) {\r\n return false;\r\n }\r\n if (draftImg.length === 0 && draftAud.length === 0 && draftFiles.length === 0) {\r\n return textOk;\r\n }\r\n return textOk || draftImg.length > 0 || draftAud.length > 0 || draftFiles.length > 0;\r\n });\r\n\r\n //#endregion\r\n\r\n //#region ---- Lifecycle ----\r\n\r\n async ngOnInit(): Promise<void> {\r\n this.promptDraft.set(this.initialPrompt().trim());\r\n\r\n const a = this.initialAssistId()?.trim();\r\n if (a) {\r\n this.assistTargetKey.set(`assist:${a}`);\r\n } else {\r\n this.assistTargetKey.set('');\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.abortActiveRun();\r\n for (const s of this.draftComposerImages()) {\r\n URL.revokeObjectURL(s.previewUrl);\r\n }\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- UI Handlers ----\r\n\r\n onPromptDraftChange(value: string | null | undefined): void {\r\n this.promptDraft.set((value ?? '').toString());\r\n }\r\n\r\n /**\r\n * Enter sends; Shift+Enter inserts a newline. IME composition Enter is left unchanged.\r\n */\r\n onPromptKeydown(event: KeyboardEvent): void {\r\n if (event.key !== 'Enter' || event.shiftKey || event.isComposing) {\r\n return;\r\n }\r\n event.preventDefault();\r\n void this.onSend();\r\n }\r\n\r\n onCancel(): void {\r\n if (this.runPhase() !== 'idle') {\r\n return;\r\n }\r\n this.requestClose()(null);\r\n }\r\n\r\n abortActiveRun(): void {\r\n this.runAbortController?.abort();\r\n }\r\n\r\n onStop(): void {\r\n if (this.runPhase() !== 'running') {\r\n return;\r\n }\r\n this.runPhase.set('stopping');\r\n this.runAbortController?.abort();\r\n }\r\n\r\n onMenuCancel(panel: { close: () => void }): void {\r\n panel.close();\r\n if (this.runPhase() !== 'idle') {\r\n return;\r\n }\r\n this.onCancel();\r\n }\r\n\r\n /**\r\n * Idle: close. Running: Stop (stay open). Stopping: ignore.\r\n */\r\n onDocumentEscape(): void {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.runPhase() === 'stopping') {\r\n return;\r\n }\r\n if (this.runPhase() === 'running') {\r\n this.onStop();\r\n return;\r\n }\r\n this.onCancel();\r\n }\r\n\r\n openImagePicker(): void {\r\n void this.pickComposerImages();\r\n }\r\n\r\n openAudioPicker(): void {\r\n void this.pickComposerAudios();\r\n }\r\n\r\n openDocumentPicker(): void {\r\n void this.pickComposerDocuments();\r\n }\r\n\r\n async onSend(): Promise<void> {\r\n if (this.runPhase() === 'running') {\r\n this.onStop();\r\n return;\r\n }\r\n if (!this.canSend()) {\r\n return;\r\n }\r\n const text = this.promptDraft().trim();\r\n const draftImg = this.draftComposerImages();\r\n const draftAud = this.draftComposerAudios();\r\n const draftFiles = this.draftComposerFiles();\r\n for (const s of draftImg) {\r\n if (!s.fileId?.trim()) {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const msg = await this.translation.translateAsync('@ai-management:chat.images-still-saving');\r\n await this.toastService.show({ color: 'warning', title: errTitle, content: msg });\r\n return;\r\n }\r\n }\r\n for (const s of draftAud) {\r\n if (!s.fileId?.trim()) {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const msg = await this.translation.translateAsync('@ai-management:chat.audio-still-saving');\r\n await this.toastService.show({ color: 'warning', title: errTitle, content: msg });\r\n return;\r\n }\r\n }\r\n for (const s of draftFiles) {\r\n if (!s.fileId?.trim()) {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const msg = await this.translation.translateAsync('@ai-management:chat.documents-still-saving');\r\n await this.toastService.show({ color: 'warning', title: errTitle, content: msg });\r\n return;\r\n }\r\n }\r\n\r\n const key = this.assistTargetKey().trim();\r\n let assistId: string | undefined;\r\n if (key.startsWith('assist:')) {\r\n assistId = key.slice('assist:'.length).trim() || undefined;\r\n }\r\n\r\n const userMediaAttachments: AXPAiAssistUserMediaAttachment[] = [\r\n ...draftImg.map((s) => ({\r\n kind: 'image' as const,\r\n fileId: s.fileId!.trim(),\r\n mimeType: s.mimeType.trim(),\r\n ...(s.name?.trim() ? { name: s.name.trim() } : {}),\r\n })),\r\n ...draftAud.map((s) => ({\r\n kind: 'audio' as const,\r\n fileId: s.fileId!.trim(),\r\n mimeType: s.mimeType.trim(),\r\n ...(s.name?.trim() ? { name: s.name.trim() } : {}),\r\n })),\r\n ...draftFiles.map((s) => ({\r\n kind: 'file' as const,\r\n fileId: s.fileId!.trim(),\r\n mimeType: s.mimeType.trim(),\r\n ...(s.name?.trim() ? { name: s.name.trim() } : {}),\r\n })),\r\n ];\r\n\r\n const payload: AXPAiAssistPromptSubmitPayload = {\r\n prompt: text,\r\n assistId,\r\n userMediaAttachments,\r\n };\r\n\r\n const controller = new AbortController();\r\n this.runAbortController = controller;\r\n this.runPhase.set('running');\r\n try {\r\n const result = await this.runPrompt()(payload, { abortSignal: controller.signal });\r\n this.requestClose()(result);\r\n } catch (err) {\r\n if (isAiAssistAbortError(err, controller.signal)) {\r\n return;\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const fallback = await this.translation.translateAsync('@ai-management:assist-popup.run-error');\r\n const content = err instanceof Error ? err.message : fallback;\r\n await this.toastService.show({ color: 'danger', title: errTitle, content });\r\n } finally {\r\n if (this.runAbortController === controller) {\r\n this.runAbortController = null;\r\n }\r\n this.runPhase.set('idle');\r\n }\r\n }\r\n\r\n removeDraftImage(clientId: string): void {\r\n const id = clientId.trim();\r\n if (!id) {\r\n return;\r\n }\r\n this.draftComposerImages.update((prev) => {\r\n const slot = prev.find((s) => s.clientId === id);\r\n if (slot) {\r\n URL.revokeObjectURL(slot.previewUrl);\r\n }\r\n const next = prev.filter((s) => s.clientId !== id);\r\n if (\r\n next.length === 0 &&\r\n this.draftComposerAudios().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n return next;\r\n });\r\n }\r\n\r\n removeDraftAudio(clientId: string): void {\r\n const id = clientId.trim();\r\n if (!id) {\r\n return;\r\n }\r\n this.draftComposerAudios.update((prev) => {\r\n const next = prev.filter((s) => s.clientId !== id);\r\n if (\r\n next.length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n return next;\r\n });\r\n }\r\n\r\n removeDraftFile(clientId: string): void {\r\n const id = clientId.trim();\r\n if (!id) {\r\n return;\r\n }\r\n this.draftComposerFiles.update((prev) => {\r\n const next = prev.filter((s) => s.clientId !== id);\r\n if (\r\n next.length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerAudios().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n return next;\r\n });\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- Composer media (mirrors chat page) ----\r\n\r\n private async pickComposerImages(): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.busy() || this.isComposerSaving()) {\r\n return;\r\n }\r\n try {\r\n const files = await this.fileService.choose({\r\n multiple: true,\r\n accept: 'image/*',\r\n });\r\n if (files.length === 0) {\r\n return;\r\n }\r\n await this.processComposerImageFiles(files);\r\n } catch {\r\n /* user cancelled */\r\n }\r\n }\r\n\r\n private async pickComposerAudios(): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.busy() || this.isComposerSaving()) {\r\n return;\r\n }\r\n try {\r\n const files = await this.fileService.choose({\r\n multiple: true,\r\n accept: 'audio/*',\r\n });\r\n if (files.length === 0) {\r\n return;\r\n }\r\n await this.processComposerAudioFiles(files);\r\n } catch {\r\n /* user cancelled */\r\n }\r\n }\r\n\r\n private async pickComposerDocuments(): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n if (this.busy() || this.isComposerSaving()) {\r\n return;\r\n }\r\n try {\r\n const files = await this.fileService.choose({\r\n multiple: true,\r\n accept:\r\n '.pdf,.txt,.md,.csv,.tsv,.json,.jsonl,.xml,.html,.htm,.yaml,.yml,.log,.rtf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.odt,.ods,.odp,application/pdf,text/*,application/json',\r\n });\r\n if (files.length === 0) {\r\n return;\r\n }\r\n await this.processComposerDocumentFiles(files);\r\n } catch {\r\n /* user cancelled */\r\n }\r\n }\r\n\r\n private async processComposerImageFiles(files: File[]): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n let groupId = this.draftAttachmentGroupId();\r\n if (!groupId?.trim()) {\r\n groupId = createRandomUuid();\r\n this.draftAttachmentGroupId.set(groupId);\r\n }\r\n const gid = groupId.trim();\r\n\r\n const existing = this.draftComposerImages().length;\r\n if (existing + files.length > AXM_AI_CHAT_COMPOSER_MAX_IMAGES_PER_TURN) {\r\n await this.showUploadWarning('@ai-management:chat.upload-too-many');\r\n return;\r\n }\r\n\r\n const newSlots: AXMAiAssistDraftImage[] = [];\r\n const filesForPersist: File[] = [];\r\n\r\n for (const file of files) {\r\n if (!axmIsLikelyChatImageFile(file)) {\r\n await this.showUploadWarning('@ai-management:chat.upload-invalid-type');\r\n return;\r\n }\r\n if (file.size > AXM_AI_CHAT_COMPOSER_MAX_IMAGE_BYTES) {\r\n await this.showUploadWarning('@ai-management:chat.upload-too-large');\r\n return;\r\n }\r\n const mimeType = axmMimeTypeForChatAttachment(file);\r\n const fileForStorage =\r\n file.type.trim().startsWith('image/') && file.type.trim().length > 0\r\n ? file\r\n : new File([file], file.name, { type: mimeType });\r\n newSlots.push({\r\n clientId: createRandomUuid(),\r\n previewUrl: URL.createObjectURL(file),\r\n mimeType,\r\n name: file.name,\r\n });\r\n filesForPersist.push(fileForStorage);\r\n }\r\n\r\n this.draftComposerImages.update((prev) => [...prev, ...newSlots]);\r\n\r\n this.isComposerSaving.set(true);\r\n try {\r\n for (let i = 0; i < filesForPersist.length; i++) {\r\n const file = filesForPersist[i];\r\n const clientId = newSlots[i].clientId;\r\n try {\r\n const { fileId } = await persistAiChatAttachmentImage(this.fileStorage, file, gid);\r\n this.draftComposerImages.update((prev) =>\r\n prev.map((s) => (s.clientId === clientId ? { ...s, fileId } : s)),\r\n );\r\n } catch (e) {\r\n const msg = e instanceof Error ? e.message : String(e);\r\n this.draftComposerImages.update((prev) => {\r\n const slot = prev.find((s) => s.clientId === clientId);\r\n if (slot) {\r\n URL.revokeObjectURL(slot.previewUrl);\r\n }\r\n return prev.filter((s) => s.clientId !== clientId);\r\n });\r\n if (\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerAudios().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const uploadFailed = await this.translation.translateAsync('@ai-management:chat.upload-error');\r\n await this.toastService.show({\r\n color: 'danger',\r\n title: errTitle,\r\n content: `${uploadFailed} ${msg}`,\r\n });\r\n return;\r\n }\r\n }\r\n } finally {\r\n this.isComposerSaving.set(false);\r\n }\r\n }\r\n\r\n private async processComposerAudioFiles(files: File[]): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n let groupId = this.draftAttachmentGroupId();\r\n if (!groupId?.trim()) {\r\n groupId = createRandomUuid();\r\n this.draftAttachmentGroupId.set(groupId);\r\n }\r\n const gid = groupId.trim();\r\n\r\n const existing = this.draftComposerAudios().length;\r\n if (existing + files.length > AXM_AI_CHAT_COMPOSER_MAX_AUDIO_PER_TURN) {\r\n await this.showUploadWarning('@ai-management:chat.upload-audio-too-many');\r\n return;\r\n }\r\n\r\n const newSlots: AXMAiAssistDraftAudio[] = [];\r\n const filesForPersist: File[] = [];\r\n\r\n for (const file of files) {\r\n if (!axmIsLikelyChatAudioFile(file)) {\r\n await this.showUploadWarning('@ai-management:chat.upload-audio-invalid-type');\r\n return;\r\n }\r\n if (file.size > AXM_AI_CHAT_COMPOSER_MAX_AUDIO_BYTES) {\r\n await this.showUploadWarning('@ai-management:chat.upload-audio-too-large');\r\n return;\r\n }\r\n const mimeType = axmMimeTypeForChatAttachment(file);\r\n const fileForStorage =\r\n file.type.trim().startsWith('audio/') && file.type.trim().length > 0\r\n ? file\r\n : new File([file], file.name, { type: mimeType });\r\n newSlots.push({\r\n clientId: createRandomUuid(),\r\n mimeType,\r\n name: file.name,\r\n });\r\n filesForPersist.push(fileForStorage);\r\n }\r\n\r\n this.draftComposerAudios.update((prev) => [...prev, ...newSlots]);\r\n\r\n this.isComposerSaving.set(true);\r\n try {\r\n for (let i = 0; i < filesForPersist.length; i++) {\r\n const file = filesForPersist[i];\r\n const clientId = newSlots[i].clientId;\r\n try {\r\n const { fileId } = await persistAiChatAttachmentImage(this.fileStorage, file, gid);\r\n this.draftComposerAudios.update((prev) =>\r\n prev.map((s) => (s.clientId === clientId ? { ...s, fileId } : s)),\r\n );\r\n } catch (e) {\r\n const msg = e instanceof Error ? e.message : String(e);\r\n this.draftComposerAudios.update((prev) => prev.filter((s) => s.clientId !== clientId));\r\n if (\r\n this.draftComposerAudios().length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerFiles().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const uploadFailed = await this.translation.translateAsync('@ai-management:chat.upload-audio-error');\r\n await this.toastService.show({\r\n color: 'danger',\r\n title: errTitle,\r\n content: `${uploadFailed} ${msg}`,\r\n });\r\n return;\r\n }\r\n }\r\n } finally {\r\n this.isComposerSaving.set(false);\r\n }\r\n }\r\n\r\n private async processComposerDocumentFiles(files: File[]): Promise<void> {\r\n if (!isPlatformBrowser(this.platformId)) {\r\n return;\r\n }\r\n let groupId = this.draftAttachmentGroupId();\r\n if (!groupId?.trim()) {\r\n groupId = createRandomUuid();\r\n this.draftAttachmentGroupId.set(groupId);\r\n }\r\n const gid = groupId.trim();\r\n\r\n const existing = this.draftComposerFiles().length;\r\n if (existing + files.length > AXM_AI_CHAT_COMPOSER_MAX_DOCUMENTS_PER_TURN) {\r\n await this.showUploadWarning('@ai-management:chat.upload-documents-too-many');\r\n return;\r\n }\r\n\r\n const newSlots: AXMAiAssistDraftFile[] = [];\r\n const filesForPersist: File[] = [];\r\n\r\n for (const file of files) {\r\n if (!axmIsLikelyChatDocumentFile(file)) {\r\n await this.showUploadWarning('@ai-management:chat.upload-documents-invalid-type');\r\n return;\r\n }\r\n if (file.size > AXM_AI_CHAT_COMPOSER_MAX_DOCUMENT_BYTES) {\r\n await this.showUploadWarning('@ai-management:chat.upload-documents-too-large');\r\n return;\r\n }\r\n const mimeType = axmMimeTypeForChatAttachment(file);\r\n const fileForStorage =\r\n file.type.trim().length > 0 && file.type.trim() !== 'application/octet-stream'\r\n ? file\r\n : new File([file], file.name, { type: mimeType });\r\n newSlots.push({\r\n clientId: createRandomUuid(),\r\n mimeType,\r\n name: file.name,\r\n });\r\n filesForPersist.push(fileForStorage);\r\n }\r\n\r\n this.draftComposerFiles.update((prev) => [...prev, ...newSlots]);\r\n\r\n this.isComposerSaving.set(true);\r\n try {\r\n for (let i = 0; i < filesForPersist.length; i++) {\r\n const file = filesForPersist[i];\r\n const clientId = newSlots[i].clientId;\r\n try {\r\n const { fileId } = await persistAiChatAttachmentImage(this.fileStorage, file, gid);\r\n this.draftComposerFiles.update((prev) =>\r\n prev.map((s) => (s.clientId === clientId ? { ...s, fileId } : s)),\r\n );\r\n } catch (e) {\r\n const msg = e instanceof Error ? e.message : String(e);\r\n this.draftComposerFiles.update((prev) => prev.filter((s) => s.clientId !== clientId));\r\n if (\r\n this.draftComposerFiles().length === 0 &&\r\n this.draftComposerImages().length === 0 &&\r\n this.draftComposerAudios().length === 0\r\n ) {\r\n this.draftAttachmentGroupId.set(null);\r\n }\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const uploadFailed = await this.translation.translateAsync('@ai-management:chat.upload-documents-error');\r\n await this.toastService.show({\r\n color: 'danger',\r\n title: errTitle,\r\n content: `${uploadFailed} ${msg}`,\r\n });\r\n return;\r\n }\r\n }\r\n } finally {\r\n this.isComposerSaving.set(false);\r\n }\r\n }\r\n\r\n private async showUploadWarning(translationKey: string): Promise<void> {\r\n const errTitle = await this.translation.translateAsync('@general:messages.error.title');\r\n const content = await this.translation.translateAsync(translationKey);\r\n await this.toastService.show({ color: 'warning', title: errTitle, content });\r\n }\r\n\r\n //#endregion\r\n}\r\n\r\n//#endregion\r\n","<div\r\n class=\"axm-ai-assist-prompt-box flex flex-col gap-2.5 min-h-0 w-full\"\r\n [style.max-width.px]=\"contentMaxWidthPx()\"\r\n>\r\n <div\r\n class=\"axm-ai-assist-prompt-box__eyebrow flex items-center justify-between gap-3 shrink-0 px-0.5\"\r\n >\r\n <div\r\n class=\"axm-ai-assist-prompt-box__brand inline-flex min-w-0 items-center gap-2\"\r\n >\r\n <span class=\"axm-ai-assist-prompt-box__brand-mark\" aria-hidden=\"true\">\r\n <i class=\"fa-light fa-sparkles\" aria-hidden=\"true\"></i>\r\n </span>\r\n <span class=\"axm-ai-assist-prompt-box__brand-title truncate\">{{\r\n title()\r\n }}</span>\r\n </div>\r\n <ax-button\r\n class=\"shrink-0 ax-sm\"\r\n look=\"blank\"\r\n color=\"default\"\r\n type=\"button\"\r\n [iconOnly]=\"true\"\r\n [disabled]=\"busy()\"\r\n [attr.aria-label]=\"\r\n ('@general:actions.close.title' | translate | async) ?? ''\r\n \"\r\n (onClick)=\"onCancel()\"\r\n >\r\n <ax-prefix>\r\n <i class=\"fa-light fa-xmark\" aria-hidden=\"true\"></i>\r\n </ax-prefix>\r\n </ax-button>\r\n </div>\r\n\r\n <div class=\"axm-ai-assist-prompt-box__sheet flex min-h-0 flex-col gap-2\">\r\n @if (\r\n draftComposerImages().length > 0 ||\r\n draftComposerAudios().length > 0 ||\r\n draftComposerFiles().length > 0 ||\r\n isComposerSaving()\r\n ) {\r\n <div\r\n class=\"shrink-0 rounded-xl border border-default/45 dark:border-darker bg-lightest/90 p-1.5 flex flex-col gap-1.5\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.composer-attachments-region'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n >\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-1.5 text-[0.65rem] text-muted\"\r\n >\r\n <span>\r\n @if (isComposerSaving()) {\r\n {{ '@ai-management:chat.composer-uploading' | translate | async }}\r\n } @else {\r\n @if (draftComposerImages().length > 0) {\r\n <span\r\n >{{ draftComposerImages().length }}\r\n {{\r\n '@ai-management:chat.composer-images-count'\r\n | translate\r\n | async\r\n }}</span\r\n >\r\n }\r\n @if (\r\n draftComposerImages().length > 0 &&\r\n draftComposerAudios().length > 0\r\n ) {\r\n <span class=\"mx-1\">·</span>\r\n }\r\n @if (draftComposerAudios().length > 0) {\r\n <span\r\n >{{ draftComposerAudios().length }}\r\n {{\r\n '@ai-management:chat.composer-audio-count'\r\n | translate\r\n | async\r\n }}</span\r\n >\r\n }\r\n @if (draftComposerFiles().length > 0) {\r\n @if (\r\n draftComposerImages().length > 0 ||\r\n draftComposerAudios().length > 0\r\n ) {\r\n <span class=\"mx-1\">·</span>\r\n }\r\n <span\r\n >{{ draftComposerFiles().length }}\r\n {{\r\n '@ai-management:chat.composer-documents-count'\r\n | translate\r\n | async\r\n }}</span\r\n >\r\n }\r\n }\r\n </span>\r\n </div>\r\n @if (draftComposerImages().length > 0) {\r\n <div class=\"flex flex-wrap gap-1.5\">\r\n @for (slot of draftComposerImages(); track slot.clientId) {\r\n <div\r\n class=\"relative h-12 w-12 shrink-0 overflow-hidden rounded-md border border-default/60 dark:border-darker bg-lightest\"\r\n >\r\n <img\r\n [src]=\"slot.previewUrl\"\r\n [alt]=\"slot.name ?? ''\"\r\n class=\"h-full w-full object-cover\"\r\n />\r\n @if (!slot.fileId) {\r\n <span\r\n class=\"absolute inset-0 flex items-center justify-center bg-default/40 text-[0.6rem] font-medium text-on-lightest\"\r\n >…</span\r\n >\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"absolute end-0.5 top-0.5 flex h-4 w-4 items-center justify-center rounded bg-default/80 text-[0.65rem] leading-none text-on-lightest hover:bg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400\"\r\n [disabled]=\"busy() || isComposerSaving()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.remove-draft-image'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (click)=\"removeDraftImage(slot.clientId)\"\r\n >\r\n ×\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n @if (draftComposerAudios().length > 0) {\r\n <div class=\"flex flex-col gap-1\">\r\n @for (slot of draftComposerAudios(); track slot.clientId) {\r\n <div\r\n class=\"flex items-center justify-between gap-1.5 rounded border border-default/60 dark:border-darker bg-lightest px-1.5 py-1 text-[0.65rem] min-w-0\"\r\n >\r\n <span\r\n class=\"truncate text-on-lightest\"\r\n [attr.title]=\"slot.name ?? ''\"\r\n >\r\n {{\r\n '@ai-management:chat.attached-audio-label'\r\n | translate\r\n | async\r\n }}:\r\n {{\r\n slot.name?.trim() ||\r\n ('@ai-management:chat.audio-untitled' | translate | async)\r\n }}\r\n </span>\r\n @if (!slot.fileId) {\r\n <span class=\"text-muted shrink-0\">…</span>\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"shrink-0 flex h-5 w-5 items-center justify-center rounded bg-default/80 text-[0.75rem] leading-none text-on-lightest hover:bg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400\"\r\n [disabled]=\"busy() || isComposerSaving()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.remove-draft-audio'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (click)=\"removeDraftAudio(slot.clientId)\"\r\n >\r\n ×\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n @if (draftComposerFiles().length > 0) {\r\n <div class=\"flex flex-col gap-1\">\r\n @for (slot of draftComposerFiles(); track slot.clientId) {\r\n <div\r\n class=\"flex items-center justify-between gap-1.5 rounded border border-default/60 dark:border-darker bg-lightest px-1.5 py-1 text-[0.65rem] min-w-0\"\r\n >\r\n <span\r\n class=\"truncate text-on-lightest\"\r\n [attr.title]=\"slot.name ?? ''\"\r\n >\r\n {{\r\n '@ai-management:chat.attached-document-label'\r\n | translate\r\n | async\r\n }}:\r\n {{\r\n slot.name?.trim() ||\r\n ('@ai-management:chat.document-untitled'\r\n | translate\r\n | async)\r\n }}\r\n </span>\r\n @if (!slot.fileId) {\r\n <span class=\"text-muted shrink-0\">…</span>\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"shrink-0 flex h-5 w-5 items-center justify-center rounded bg-default/80 text-[0.75rem] leading-none text-on-lightest hover:bg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400\"\r\n [disabled]=\"busy() || isComposerSaving()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.remove-draft-document'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (click)=\"removeDraftFile(slot.clientId)\"\r\n >\r\n ×\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"axm-ai-assist-prompt-box__body flex min-h-0 flex-col\">\r\n <ax-text-area\r\n class=\"axm-ai-assist-prompt-box__prompt-input w-full min-h-0\"\r\n [rows]=\"3\"\r\n [disabled]=\"busy()\"\r\n [ngModel]=\"promptDraft()\"\r\n (ngModelChange)=\"onPromptDraftChange($event)\"\r\n (keydown)=\"onPromptKeydown($event)\"\r\n [placeholder]=\"\r\n placeholder().trim().length > 0\r\n ? placeholder()\r\n : (('@ai-management:assist-popup.placeholder'\r\n | translate\r\n | async) ?? '')\r\n \"\r\n ></ax-text-area>\r\n </div>\r\n\r\n <div\r\n class=\"axm-ai-assist-prompt-box__footer flex shrink-0 items-center justify-between gap-2\"\r\n >\r\n <ax-button\r\n class=\"axm-ai-assist-prompt-box__menu-trigger\"\r\n look=\"solid\"\r\n color=\"primary\"\r\n type=\"button\"\r\n [iconOnly]=\"true\"\r\n [disabled]=\"busy()\"\r\n [attr.aria-label]=\"\r\n ('@ai-management:assist-popup.composer-menu-aria'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n >\r\n <ax-prefix>\r\n <i class=\"fa-light fa-plus text-sm\" aria-hidden=\"true\"></i>\r\n </ax-prefix>\r\n <ax-dropdown-panel #composerMenu>\r\n <ax-button-item-list class=\"min-w-56\">\r\n <ax-button-item\r\n [text]=\"\r\n ('@ai-management:chat.upload-images' | translate | async) ?? ''\r\n \"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.upload-images-aria'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (onClick)=\"openImagePicker(); composerMenu.close()\"\r\n >\r\n <ax-prefix>\r\n <i\r\n class=\"fa-light fa-image size-4 text-center\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </ax-prefix>\r\n </ax-button-item>\r\n <ax-button-item\r\n [text]=\"\r\n ('@ai-management:chat.upload-audio' | translate | async) ?? ''\r\n \"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.upload-audio-aria' | translate | async) ??\r\n ''\r\n \"\r\n (onClick)=\"openAudioPicker(); composerMenu.close()\"\r\n >\r\n <ax-prefix>\r\n <i\r\n class=\"fa-light fa-microphone size-4 text-center\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </ax-prefix>\r\n </ax-button-item>\r\n <ax-button-item\r\n [text]=\"\r\n ('@ai-management:chat.upload-documents' | translate | async) ??\r\n ''\r\n \"\r\n [attr.aria-label]=\"\r\n ('@ai-management:chat.upload-documents-aria'\r\n | translate\r\n | async) ?? ''\r\n \"\r\n (onClick)=\"openDocumentPicker(); composerMenu.close()\"\r\n >\r\n <ax-prefix>\r\n <i\r\n class=\"fa-light fa-paperclip size-4 text-center\"\r\n aria-hidden=\"true\"\r\n ></i>\r\n </ax-prefix>\r\n </ax-button-item>\r\n </ax-button-item-list>\r\n </ax-dropdown-panel>\r\n </ax-button>\r\n\r\n <ax-button\r\n class=\"axm-ai-assist-prompt-box__send axm-ai-assist-prompt-box__send-gradient\"\r\n color=\"primary\"\r\n type=\"button\"\r\n [disabled]=\"runPhase() === 'stopping' || (runPhase() === 'idle' && !canSend())\"\r\n [text]=\"\r\n runPhase() === 'stopping'\r\n ? (('@ai-management:assist-popup.stopping' | translate | async) ??\r\n '')\r\n : runPhase() === 'running'\r\n ? (('@ai-management:assist-popup.stop' | translate | async) ?? '')\r\n : (('@ai-management:assist-popup.generate' | translate | async) ??\r\n '')\r\n \"\r\n (onClick)=\"onSend()\"\r\n ></ax-button>\r\n </div>\r\n </div>\r\n</div>\r\n","//#region ---- Imports ----\n\nimport type {\n AXPAiAssistPromptExecutionContext,\n AXPAiAssistPromptSubmitPayload,\n AXPAiAssistRunResult,\n AXPAiAssistShowOptions,\n} from '../types/ai-assist.types';\nimport { AXMAiAssistPromptBoxComponent } from './ai-assist-prompt-box/ai-assist-prompt-box.component';\nimport { AXOverlayService, type AXOverlayRef } from '@acorex/cdk/overlay';\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ---- Service ----\n\n/**\n * Opens the AI assist prompt box in a bottom overlay using {@link AXOverlayService} (`centered: false`, panel CSS).\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMAiAssistPromptBoxService {\n //#region ---- Services & Dependencies ----\n\n private readonly overlayService = inject(AXOverlayService);\n\n //#endregion\n\n //#region ---- Private Properties ----\n\n private overlayRef: AXOverlayRef<AXMAiAssistPromptBoxComponent> | null = null;\n\n private pendingResolve: ((value: AXPAiAssistRunResult | null) => void) | null = null;\n\n private settled = false;\n\n private overlaySessionId = 0;\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Presents the assist prompt box and resolves when the user submits, cancels, or dismisses the overlay.\n */\n open(\n options: AXPAiAssistShowOptions,\n executeRun: (\n payload: AXPAiAssistPromptSubmitPayload,\n execution: AXPAiAssistPromptExecutionContext,\n ) => Promise<AXPAiAssistRunResult>,\n ): Promise<AXPAiAssistRunResult | null> {\n if (this.pendingResolve) {\n const superseded = this.pendingResolve;\n this.pendingResolve = null;\n superseded(null);\n }\n this.disposeOverlayOnly();\n\n const sessionId = ++this.overlaySessionId;\n\n return new Promise<AXPAiAssistRunResult | null>((resolve) => {\n this.pendingResolve = resolve;\n this.settled = false;\n\n const requestClose = (result: AXPAiAssistRunResult | null): void => {\n if (this.overlaySessionId !== sessionId) {\n return;\n }\n this.settle(result, sessionId);\n this.overlayRef?.dispose();\n };\n\n void this.overlayService\n .create(AXMAiAssistPromptBoxComponent, {\n centered: false,\n width: 'auto',\n actionSheetStyle: false,\n panelClass: ['axm-ai-assist-prompt-box-shell'],\n backdrop: {\n enabled: false,\n background: false,\n closeOnClick: false,\n },\n closeOnEscape: false,\n closeOnOutsideClick: false,\n inputs: {\n title: options.title,\n placeholder: options.placeholder ?? '',\n initialPrompt: options.initialPrompt ?? '',\n initialAssistId: options.assistId,\n runPrompt: executeRun,\n requestClose,\n },\n onDispose: () => {\n if (this.overlaySessionId !== sessionId) {\n return;\n }\n this.overlayRef = null;\n if (!this.settled && this.pendingResolve) {\n this.settle(null, sessionId);\n }\n },\n })\n .then((ref) => {\n if (this.overlaySessionId !== sessionId) {\n ref.dispose();\n return;\n }\n this.overlayRef = ref;\n })\n .catch(() => {\n if (this.overlaySessionId !== sessionId) {\n return;\n }\n this.settle(null, sessionId);\n });\n });\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private settle(result: AXPAiAssistRunResult | null, sessionId?: number): void {\n if (sessionId != null && this.overlaySessionId !== sessionId) {\n return;\n }\n if (this.settled) {\n return;\n }\n const done = this.pendingResolve;\n if (!done) {\n return;\n }\n this.settled = true;\n this.pendingResolve = null;\n done(result);\n }\n\n private disposeOverlayOnly(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n }\n }\n\n //#endregion\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\nimport { parseAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\nimport type { AXPAiAssistRunInput } from '../../types/ai-assist.types';\n\n//#endregion\n\n//#region ---- Legacy → contract ----\n\n/**\n * Maps legacy `expectStructuredOutput` flags to an {@link AXPAiAgentOutputContract}, or returns explicit `outputContract`.\n */\nexport function outputContractFromAssistRunInput(input: AXPAiAssistRunInput): AXPAiAgentOutputContract | null {\n if (input.outputContract) {\n const parsed = parseAgentOutputContract(input.outputContract);\n if (parsed) {\n return parsed;\n }\n }\n if (!input.expectStructuredOutput) {\n return null;\n }\n const instruction = input.structuredOutputInstruction?.trim();\n const schemaSummary = input.structuredOutputSchemaSummary?.trim();\n let structuredRetries: number | undefined;\n if (typeof input.maxStructuredRetries === 'number' && !Number.isNaN(input.maxStructuredRetries)) {\n structuredRetries = Math.max(0, Math.min(10, Math.floor(input.maxStructuredRetries)));\n }\n return {\n kind: 'object',\n ...(instruction && instruction.length > 0 ? { instruction } : {}),\n ...(schemaSummary && schemaSummary.length > 0 ? { schemaSummary } : {}),\n ...(structuredRetries !== undefined ? { structuredRetries } : {}),\n };\n}\n\n//#endregion\n","//#region ---- Transcript ----\n\nimport type { AXPAiChatMessage } from '../../engine/ai-engine.types';\nimport { axpAiChatMessageGetText } from '@acorex-platform/module-ai-management-client/contracts';\n\n/**\n * Text segments from the last assistant message (`type: 'text'` only).\n * Omits `think` and `node` segments so JSON parsing is not polluted by widget envelopes or reasoning blocks stored separately.\n */\nexport function extractLastAssistantTextSegments(messages: AXPAiChatMessage[]): string[] {\n for (let i = messages.length - 1; i >= 0; i--) {\n const m = messages[i];\n if (m.role !== 'assistant') {\n continue;\n }\n const parts: string[] = [];\n for (const r of m.responses) {\n if (r.type === 'text') {\n parts.push(r.content);\n }\n }\n return parts;\n }\n return [];\n}\n\n/**\n * Combined text for structured JSON extraction (text segments only).\n */\nexport function extractLastAssistantStructuredParts(messages: AXPAiChatMessage[]): {\n combined: string;\n segments: string[];\n} {\n const segments = extractLastAssistantTextSegments(messages);\n const combined = segments.join('\\n\\n').trim();\n return { combined, segments };\n}\n\n/**\n * Concatenated plain text from the last assistant message in the transcript (includes `node` payloads like {@link axpAiChatMessageGetText}).\n */\nexport function extractLastAssistantPlainText(messages: AXPAiChatMessage[]): string {\n for (let i = messages.length - 1; i >= 0; i--) {\n const m = messages[i];\n if (m.role === 'assistant') {\n return axpAiChatMessageGetText(m).trim();\n }\n }\n return '';\n}\n\n//#endregion\n","//#region ---- Retry prompt ----\n\n/**\n * User follow-up appended to the transcript when structured JSON parse/validation fails.\n *\n * @param validationDetail - Parse or schema validation error text.\n * @param schemaSummary - Optional expected shape (e.g. TypeScript-style) to improve retry quality.\n * @param failurePhase - Parse failures get stronger anti-truncation wording; validator failures focus on schema/rules.\n */\nexport function buildStructuredOutputRetryUserText(\n validationDetail: string,\n schemaSummary?: string,\n failurePhase?: 'parse' | 'validator',\n): string {\n const detail = validationDetail.trim() || 'Unknown validation error.';\n const lines: string[] = [\n 'The previous response could not be parsed or validated:',\n detail,\n '',\n ];\n if (failurePhase === 'parse') {\n lines.push(\n 'Likely causes: incomplete/truncated JSON, extra prose around the value, or unclosed strings/brackets.',\n 'Reply with ONE complete JSON value only — fully closed strings, braces, and brackets. Do not stop until the JSON is valid.',\n '',\n );\n } else if (failurePhase === 'validator') {\n lines.push(\n 'The JSON was parsed but did not match the required rules or shape. Fix the structure and values; keep the reply as a single JSON value only.',\n '',\n );\n }\n const shape = schemaSummary?.trim();\n if (shape && shape.length > 0) {\n lines.push('Expected JSON shape (summary):', shape, '');\n }\n lines.push(\n 'Return ONLY valid JSON matching the requested structure.',\n 'Do not include markdown fences or explanations.',\n );\n return lines.join('\\n');\n}\n\n//#endregion\n","//#region ---- Parse structured assistant text ----\n\n/**\n * Parses assistant plain text as JSON, supporting optional ```json fences.\n */\nexport function tryParseStructuredAssistantText(text: string): unknown | undefined {\n const t = text.trim();\n if (!t) {\n return undefined;\n }\n try {\n return JSON.parse(t) as unknown;\n } catch {\n const fence = /^```(?:json)?\\s*([\\s\\S]*?)```$/im.exec(t);\n if (fence?.[1]) {\n try {\n return JSON.parse(fence[1].trim()) as unknown;\n } catch {\n return undefined;\n }\n }\n return undefined;\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { tryParseStructuredAssistantText } from './parse-structured-assistant-text';\n\n//#endregion\n\n//#region ---- Balanced JSON extraction ----\n\nfunction tryParseBalancedJsonObjectAt(s: string, start: number): { value: unknown; end: number } | null {\n if (s[start] !== '{') {\n return null;\n }\n let depth = 0;\n let inString = false;\n let escape = false;\n for (let i = start; i < s.length; i++) {\n const c = s[i];\n if (inString) {\n if (escape) {\n escape = false;\n continue;\n }\n if (c === '\\\\') {\n escape = true;\n continue;\n }\n if (c === '\"') {\n inString = false;\n }\n continue;\n }\n if (c === '\"') {\n inString = true;\n continue;\n }\n if (c === '{') {\n depth++;\n } else if (c === '}') {\n depth--;\n if (depth === 0) {\n const slice = s.slice(start, i + 1);\n try {\n return { value: JSON.parse(slice) as unknown, end: i + 1 };\n } catch {\n return null;\n }\n }\n }\n }\n return null;\n}\n\nfunction tryParseBalancedJsonArrayAt(s: string, start: number): { value: unknown; end: number } | null {\n if (s[start] !== '[') {\n return null;\n }\n let depth = 0;\n let inString = false;\n let escape = false;\n for (let i = start; i < s.length; i++) {\n const c = s[i];\n if (inString) {\n if (escape) {\n escape = false;\n continue;\n }\n if (c === '\\\\') {\n escape = true;\n continue;\n }\n if (c === '\"') {\n inString = false;\n }\n continue;\n }\n if (c === '\"') {\n inString = true;\n continue;\n }\n if (c === '[') {\n depth++;\n } else if (c === ']') {\n depth--;\n if (depth === 0) {\n const slice = s.slice(start, i + 1);\n try {\n return { value: JSON.parse(slice) as unknown, end: i + 1 };\n } catch {\n return null;\n }\n }\n }\n }\n return null;\n}\n\n/**\n * Finds first top-level JSON object or array and returns balanced slice text.\n */\nfunction extractFirstBalancedJsonSlice(s: string): string | undefined {\n const iObj = s.indexOf('{');\n const iArr = s.indexOf('[');\n let start = -1;\n let kind: 'obj' | 'arr' | null = null;\n if (iObj >= 0 && iArr >= 0) {\n if (iObj <= iArr) {\n start = iObj;\n kind = 'obj';\n } else {\n start = iArr;\n kind = 'arr';\n }\n } else if (iObj >= 0) {\n start = iObj;\n kind = 'obj';\n } else if (iArr >= 0) {\n start = iArr;\n kind = 'arr';\n }\n if (start < 0 || !kind) {\n return undefined;\n }\n const parsed =\n kind === 'obj' ? tryParseBalancedJsonObjectAt(s, start) : tryParseBalancedJsonArrayAt(s, start);\n if (!parsed) {\n return undefined;\n }\n return s.slice(start, parsed.end);\n}\n\n//#endregion\n\n//#region ---- Lightweight repair ----\n\n/**\n * Removes assistant reasoning tags when they appear inside the text channel (they break JSON extraction).\n */\nexport function stripAssistantThinkingXml(raw: string): string {\n return raw\n .replace(/<(?:redacted_thinking|think)\\b[^>]*>[\\s\\S]*?<\\/(?:redacted_thinking|think)>/gi, '')\n .replace(/<\\/?(?:redacted_thinking|think)>/gi, '')\n .trim();\n}\n\nfunction stripOuterMarkdownFence(s: string): string {\n const t = s.trim();\n const fence = /^```(?:json)?\\s*([\\s\\S]*?)```$/im.exec(t);\n if (fence?.[1]) {\n return fence[1].trim();\n }\n return t;\n}\n\n/** Removes trailing commas before `}` or `]` outside of strings (best-effort for LLM JSON). */\nfunction removeTrailingCommasBeforeBrackets(jsonLike: string): string {\n return jsonLike.replace(/,(\\s*[}\\]])/g, '$1');\n}\n\nfunction tryParseJsonLenient(slice: string): unknown | undefined {\n const t = slice.trim();\n if (!t) {\n return undefined;\n }\n try {\n return JSON.parse(t) as unknown;\n } catch {\n try {\n return JSON.parse(removeTrailingCommasBeforeBrackets(t)) as unknown;\n } catch {\n return undefined;\n }\n }\n}\n\n/**\n * Best-effort parse when the model stopped mid-JSON (truncated completion): closes `{` `[` using a delimiter stack\n * with string awareness. Unsafe inside unclosed strings; last resort after normal repair.\n */\nfunction tryRepairTruncatedJsonWithDelimiterStack(raw: string): unknown | undefined {\n const s = raw.trim();\n if (!s.length) {\n return undefined;\n }\n const stack: ('{' | '[')[] = [];\n let inStr = false;\n let esc = false;\n for (let i = 0; i < s.length; i++) {\n const c = s[i];\n if (inStr) {\n if (esc) {\n esc = false;\n continue;\n }\n if (c === '\\\\') {\n esc = true;\n continue;\n }\n if (c === '\"') {\n inStr = false;\n }\n continue;\n }\n if (c === '\"') {\n inStr = true;\n continue;\n }\n if (c === '{') {\n stack.push('{');\n } else if (c === '[') {\n stack.push('[');\n } else if (c === '}') {\n if (stack.length > 0 && stack[stack.length - 1] === '{') {\n stack.pop();\n }\n } else if (c === ']') {\n if (stack.length > 0 && stack[stack.length - 1] === '[') {\n stack.pop();\n }\n }\n }\n let suffix = '';\n if (inStr) {\n suffix = '\"';\n }\n for (let k = stack.length - 1; k >= 0; k--) {\n suffix += stack[k] === '{' ? '}' : ']';\n }\n if (!suffix.length) {\n return undefined;\n }\n try {\n return JSON.parse(s + suffix) as unknown;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Parses assistant text after cheap local repairs (fences, trailing commas, first JSON value slice).\n * Does not call the model.\n */\nexport function parseStructuredAssistantWithLocalRepair(raw: string): unknown | undefined {\n const cleaned = stripAssistantThinkingXml(raw);\n const direct = tryParseStructuredAssistantText(cleaned);\n if (direct !== undefined) {\n return direct;\n }\n\n const stripped = stripOuterMarkdownFence(cleaned);\n let v = tryParseJsonLenient(stripped);\n if (v !== undefined) {\n return v;\n }\n\n const slice = extractFirstBalancedJsonSlice(cleaned) ?? extractFirstBalancedJsonSlice(stripped);\n if (slice !== undefined) {\n v = tryParseJsonLenient(slice);\n if (v !== undefined) {\n return v;\n }\n v = tryRepairTruncatedJsonWithDelimiterStack(slice);\n if (v !== undefined) {\n return v;\n }\n }\n\n v = tryRepairTruncatedJsonWithDelimiterStack(cleaned) ?? tryRepairTruncatedJsonWithDelimiterStack(stripped);\n if (v !== undefined) {\n return v;\n }\n\n return undefined;\n}\n\n/**\n * Tries combined assistant text, then each text segment from last to first (models often put JSON only in the last paragraph).\n */\nexport function parseStructuredAssistantWithSegmentFallback(combined: string, segments: readonly string[]): unknown | undefined {\n let v = parseStructuredAssistantWithLocalRepair(combined);\n if (v !== undefined) {\n return v;\n }\n const seen = new Set<string>();\n const mark = stripAssistantThinkingXml(combined).trim();\n if (mark.length > 0) {\n seen.add(mark);\n }\n for (let i = segments.length - 1; i >= 0; i--) {\n const seg = stripAssistantThinkingXml(segments[i] ?? '').trim();\n if (!seg.length || seen.has(seg)) {\n continue;\n }\n seen.add(seg);\n v = parseStructuredAssistantWithLocalRepair(seg);\n if (v !== undefined) {\n return v;\n }\n }\n return undefined;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiJsonSchemaLike } from '../../engine/ai-response-format.types';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface JsonSchemaMiniValidationError {\n path: string;\n message: string;\n}\n\nexport type JsonSchemaMiniValidationResult =\n | { ok: true }\n | { ok: false; errors: JsonSchemaMiniValidationError[] };\n\n//#endregion\n\n//#region ---- Validator ----\n\nfunction typeMatches(schemaType: string | undefined, value: unknown): boolean {\n if (schemaType === undefined) {\n return true;\n }\n switch (schemaType) {\n case 'object':\n return value != null && typeof value === 'object' && !Array.isArray(value);\n case 'array':\n return Array.isArray(value);\n case 'string':\n return typeof value === 'string';\n case 'number':\n return typeof value === 'number' && !Number.isNaN(value);\n case 'integer':\n return typeof value === 'number' && Number.isInteger(value);\n case 'boolean':\n return typeof value === 'boolean';\n case 'null':\n return value === null;\n default:\n return true;\n }\n}\n\nfunction validateNode(\n schema: AXPAiJsonSchemaLike,\n value: unknown,\n path: string,\n errors: JsonSchemaMiniValidationError[],\n): void {\n if (schema.enum && schema.enum.length > 0) {\n if (!schema.enum.some((e) => Object.is(e, value))) {\n errors.push({ path, message: `Value is not one of the allowed enum values.` });\n return;\n }\n }\n\n if (!typeMatches(schema.type, value)) {\n errors.push({\n path,\n message: `Expected type \"${schema.type ?? 'any'}\", got ${value === null ? 'null' : typeof value}.`,\n });\n return;\n }\n\n if (schema.type === 'object' && value != null && typeof value === 'object' && !Array.isArray(value)) {\n const o = value as Record<string, unknown>;\n const props = schema.properties ?? {};\n const required = schema.required ?? [];\n\n for (const key of required) {\n if (!(key in o) || o[key] === undefined) {\n errors.push({ path: path ? `${path}.${key}` : key, message: 'Required property is missing.' });\n }\n }\n\n for (const [key, propSchema] of Object.entries(props)) {\n if (key in o && o[key] !== undefined) {\n validateNode(propSchema, o[key], path ? `${path}.${key}` : key, errors);\n }\n }\n\n if (schema.additionalProperties === false) {\n for (const key of Object.keys(o)) {\n if (!(key in props)) {\n errors.push({\n path: path ? `${path}.${key}` : key,\n message: 'Additional property is not allowed.',\n });\n }\n }\n } else if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {\n for (const [key, val] of Object.entries(o)) {\n if (!(key in props)) {\n validateNode(schema.additionalProperties, val, path ? `${path}.${key}` : key, errors);\n }\n }\n }\n }\n\n if (schema.type === 'array' && Array.isArray(value) && schema.items) {\n const itemSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items;\n if (itemSchema) {\n value.forEach((item, index) => {\n validateNode(itemSchema, item, `${path}[${index}]`, errors);\n });\n }\n }\n}\n\n/**\n * Validates a value against a minimal JSON Schema subset (types, required, enum, properties, items).\n */\nexport function validateJsonSchemaMini(\n schema: AXPAiJsonSchemaLike,\n value: unknown,\n): JsonSchemaMiniValidationResult {\n const errors: JsonSchemaMiniValidationError[] = [];\n validateNode(schema, value, '', errors);\n if (errors.length > 0) {\n return { ok: false, errors };\n }\n return { ok: true };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\nimport { axpAiAgentOutputContractUsesStructuredFinalize } from '../../engine/ai-agent-output-contract.types';\nimport type { AXPAiStructuredValidator } from '../../types/ai-assist.types';\n\nimport { validateJsonSchemaMini } from './json-schema-mini-validator';\nimport {\n parseStructuredAssistantWithSegmentFallback,\n stripAssistantThinkingXml,\n} from './repair-structured-assistant-parse';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface ContractValidationError {\n phase: 'parse' | 'validator';\n message: string;\n details?: unknown;\n}\n\nexport type ContractValidationResult =\n | { ok: true; value: unknown }\n | { ok: false; errors: ContractValidationError[] };\n\nexport interface ValidateAgainstContractCommandExecutor {\n execute(commandName: string, args: Record<string, unknown>): Promise<unknown>;\n}\n\nexport interface ValidateAgainstContractParams {\n contract: AXPAiAgentOutputContract;\n assistantPlainText: string;\n textSegmentsFallback?: readonly string[];\n structuredValidator?: AXPAiStructuredValidator;\n commandExecutor?: ValidateAgainstContractCommandExecutor;\n /**\n * When the command returns `{ success, data: { valid, errors?, normalizedJson? } }` envelope shape.\n */\n parseCommandEnvelope?: (raw: unknown) => {\n valid: boolean;\n errorMessage?: string;\n normalizedJson?: string;\n };\n}\n\n//#endregion\n\n//#region ---- Parse + validate ----\n\nfunction defaultParseCommandEnvelope(raw: unknown): {\n valid: boolean;\n errorMessage?: string;\n normalizedJson?: string;\n} {\n if (raw == null || typeof raw !== 'object' || Array.isArray(raw)) {\n return { valid: false, errorMessage: 'Validation command returned an invalid envelope.' };\n }\n const o = raw as Record<string, unknown>;\n if (o['success'] !== true) {\n const err = typeof o['error'] === 'string' ? o['error'] : 'Validation command failed.';\n return { valid: false, errorMessage: err };\n }\n const data = o['data'] as { valid?: boolean; errors?: string[]; normalizedJson?: string } | undefined;\n if (!data?.valid) {\n const errs = Array.isArray(data?.errors) ? data.errors.join('; ') : 'Layout validation failed.';\n return { valid: false, errorMessage: errs };\n }\n const normalized = typeof data.normalizedJson === 'string' ? data.normalizedJson.trim() : '';\n return { valid: true, ...(normalized.length > 0 ? { normalizedJson: normalized } : {}) };\n}\n\n/**\n * Parses assistant text and validates against contract schema, registry command, and optional custom validator.\n */\nexport async function validateAgainstContract(\n params: ValidateAgainstContractParams,\n): Promise<ContractValidationResult> {\n const { contract, assistantPlainText, textSegmentsFallback } = params;\n\n if (!axpAiAgentOutputContractUsesStructuredFinalize(contract)) {\n const trimmed = stripAssistantThinkingXml(assistantPlainText).trim();\n if (!trimmed.length && !(textSegmentsFallback?.some((s) => (s ?? '').trim().length > 0))) {\n return {\n ok: false,\n errors: [{ phase: 'parse', message: 'Assistant returned empty output.' }],\n };\n }\n return { ok: true, value: trimmed };\n }\n\n const combined = stripAssistantThinkingXml(assistantPlainText);\n const parsed = parseStructuredAssistantWithSegmentFallback(combined, textSegmentsFallback ?? []);\n if (parsed === undefined) {\n return {\n ok: false,\n errors: [\n {\n phase: 'parse',\n message:\n 'Could not parse assistant output as JSON (expected a JSON object or array; optional markdown fence; segment fallback and local repair also failed).',\n },\n ],\n };\n }\n\n let value: unknown = parsed;\n\n if (contract.kind === 'array' && !Array.isArray(value)) {\n return {\n ok: false,\n errors: [{ phase: 'validator', message: 'Expected a JSON array as the root value.' }],\n };\n }\n if (contract.kind === 'object' && (value == null || typeof value !== 'object' || Array.isArray(value))) {\n return {\n ok: false,\n errors: [{ phase: 'validator', message: 'Expected a JSON object as the root value.' }],\n };\n }\n\n if (contract.schema) {\n const schemaResult = validateJsonSchemaMini(contract.schema, value);\n if (!schemaResult.ok) {\n const message = schemaResult.errors.map((e) => `${e.path || '(root)'}: ${e.message}`).join('; ');\n return {\n ok: false,\n errors: [{ phase: 'validator', message, details: schemaResult.errors }],\n };\n }\n }\n\n const cmd = contract.validationCommandName?.trim();\n if (cmd && params.commandExecutor) {\n try {\n const raw = await params.commandExecutor.execute(cmd, { json: value });\n const parseEnvelope = params.parseCommandEnvelope ?? defaultParseCommandEnvelope;\n const envelope = parseEnvelope(raw);\n if (!envelope.valid) {\n return {\n ok: false,\n errors: [\n {\n phase: 'validator',\n message: envelope.errorMessage ?? 'Validation command failed.',\n },\n ],\n };\n }\n if (envelope.normalizedJson) {\n try {\n value = JSON.parse(envelope.normalizedJson) as unknown;\n } catch {\n value = envelope.normalizedJson;\n }\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return {\n ok: false,\n errors: [{ phase: 'validator', message: msg.trim().length > 0 ? msg : 'Validation command failed.' }],\n };\n }\n }\n\n if (params.structuredValidator) {\n try {\n value = await params.structuredValidator(value);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return {\n ok: false,\n errors: [{ phase: 'validator', message: msg.trim().length > 0 ? msg : 'Structured validation failed.' }],\n };\n }\n }\n\n return { ok: true, value };\n}\n\n//#endregion\n","//#region ---- Imports ----\r\n\r\nimport {\r\n AXPAiStructuredOutputError,\r\n type AXPAiAssistStructuredOutputRunRaw,\r\n type AXPAiStructuredValidator,\r\n type AXPAiAssistTokenUsageSnapshot,\r\n} from '../../types/ai-assist.types';\r\n\r\nimport type { AXPAiAgentOutputContract } from '../../engine/ai-agent-output-contract.types';\r\nimport { axpAiAgentOutputContractStructuredRetryCap } from '../../engine/ai-agent-output-contract.types';\r\nimport { axpAiChatTextMessage } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport type {\r\n AXPAiChatMessage,\r\n AXPAiEngineLastProviderPayload,\r\n AXPAiEngineRunResult,\r\n AXPAiEngineUsageTotals,\r\n} from '../../engine/ai-engine.types';\r\nimport type { AXPAiAssistExecutionResult } from './execution-result.types';\r\nimport { buildStructuredOutputRetryUserText } from './build-structured-output-retry-user-text';\r\nimport {\r\n extractLastAssistantPlainText,\r\n extractLastAssistantStructuredParts,\r\n} from './extract-last-assistant-plain-text';\r\nimport { stripAssistantThinkingXml } from './repair-structured-assistant-parse';\r\nimport {\r\n validateAgainstContract,\r\n type ValidateAgainstContractCommandExecutor,\r\n} from './validate-against-contract';\r\nimport { assertAiAssistNotAborted } from '../ai-run-abort.util';\r\n\r\n//#endregion\r\n\r\n//#region ---- Usage aggregation ----\r\n\r\nfunction mergeEngineUsageTotals(\r\n acc: AXPAiEngineUsageTotals | undefined,\r\n next: AXPAiEngineUsageTotals | undefined,\r\n): AXPAiEngineUsageTotals | undefined {\r\n if (!acc && !next) {\r\n return undefined;\r\n }\r\n const promptTokens = (acc?.promptTokens ?? 0) + (next?.promptTokens ?? 0);\r\n const completionTokens = (acc?.completionTokens ?? 0) + (next?.completionTokens ?? 0);\r\n const totalTokens = (acc?.totalTokens ?? 0) + (next?.totalTokens ?? 0);\r\n const cachedPromptTokens = (acc?.cachedPromptTokens ?? 0) + (next?.cachedPromptTokens ?? 0);\r\n return {\r\n promptTokens,\r\n completionTokens,\r\n totalTokens,\r\n ...(cachedPromptTokens > 0 ? { cachedPromptTokens } : {}),\r\n };\r\n}\r\n\r\nfunction engineTotalsToSnapshot(totals: AXPAiEngineUsageTotals | undefined): AXPAiAssistTokenUsageSnapshot | undefined {\r\n if (!totals) {\r\n return undefined;\r\n }\r\n return {\r\n promptTokens: totals.promptTokens,\r\n completionTokens: totals.completionTokens,\r\n totalTokens: totals.totalTokens,\r\n ...(totals.cachedPromptTokens != null && totals.cachedPromptTokens > 0\r\n ? { cachedPromptTokens: totals.cachedPromptTokens }\r\n : {}),\r\n };\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---- Error snapshot ----\r\n\r\nconst STRUCTURED_OUTPUT_ERROR_TEXT_MAX = 8000;\r\n\r\nfunction truncateForStructuredOutputError(text: string): string {\r\n if (text.length <= STRUCTURED_OUTPUT_ERROR_TEXT_MAX) {\r\n return text;\r\n }\r\n return `${text.slice(0, STRUCTURED_OUTPUT_ERROR_TEXT_MAX)}…`;\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---- Pipeline ----\r\n\r\nexport interface RunStructuredOutputPipelineParams {\r\n /** Effective output contract for this session. */\r\n contract: AXPAiAgentOutputContract;\r\n\r\n /** Initial transcript (system + user, etc.). */\r\n initialMessages: AXPAiChatMessage[];\r\n\r\n /** Runs the engine with the given full message list. */\r\n executeRun: (messages: AXPAiChatMessage[]) => Promise<AXPAiEngineRunResult>;\r\n\r\n /**\r\n * Extra turns after the first response. Total attempts = 1 + maxStructuredRetries.\r\n * Use 0 for a single attempt. When omitted, uses {@link contract.structuredRetries}.\r\n */\r\n maxStructuredRetries?: number;\r\n\r\n /** When false, only one attempt is made. */\r\n retryOnInvalidStructure: boolean;\r\n\r\n structuredValidator?: AXPAiStructuredValidator;\r\n\r\n /** Appended to retry user messages (and should be reflected in the initial user prompt by the caller). */\r\n structuredOutputSchemaSummary?: string;\r\n\r\n commandExecutor?: ValidateAgainstContractCommandExecutor;\r\n\r\n abortSignal?: AbortSignal;\r\n}\r\n\r\nexport interface RunStructuredOutputPipelineResult extends AXPAiAssistExecutionResult {\r\n structured: unknown;\r\n structuredRunRaw: AXPAiAssistStructuredOutputRunRaw;\r\n}\r\n\r\n/**\r\n * Runs the engine, validates JSON (+ optional custom validator), and appends user retry messages on failure.\r\n */\r\nexport async function runStructuredOutputPipeline(\r\n params: RunStructuredOutputPipelineParams,\r\n): Promise<RunStructuredOutputPipelineResult> {\r\n const retryCap =\r\n params.maxStructuredRetries ?? axpAiAgentOutputContractStructuredRetryCap(params.contract);\r\n const maxAttempts = params.retryOnInvalidStructure ? 1 + Math.max(0, retryCap) : 1;\r\n const schemaSummary =\r\n params.structuredOutputSchemaSummary?.trim() || params.contract.schemaSummary?.trim();\r\n\r\n let messages = params.initialMessages;\r\n let mergedUsage: AXPAiEngineUsageTotals | undefined;\r\n let lastProvider: AXPAiEngineLastProviderPayload | undefined;\r\n let prevFailureStructuredFingerprint: string | undefined;\r\n let prevFailurePhase: 'parse' | 'validator' | undefined;\r\n\r\n const perAttemptUsage: { attemptIndex: number; usage?: AXPAiAssistTokenUsageSnapshot; hasLastProviderResult: boolean }[] =\r\n [];\r\n\r\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\r\n assertAiAssistNotAborted(params.abortSignal);\r\n let result: AXPAiEngineRunResult;\r\n try {\r\n result = await params.executeRun(messages);\r\n } catch (err) {\r\n assertAiAssistNotAborted(params.abortSignal);\r\n throw err;\r\n }\r\n assertAiAssistNotAborted(params.abortSignal);\r\n mergedUsage = mergeEngineUsageTotals(mergedUsage, result.usageTotals);\r\n\r\n if (result.lastProviderResult !== undefined) {\r\n lastProvider = result.lastProviderResult;\r\n }\r\n messages = result.messages;\r\n\r\n const displayText = extractLastAssistantPlainText(messages);\r\n const structuredParts = extractLastAssistantStructuredParts(messages);\r\n const structuredFingerprint = stripAssistantThinkingXml(structuredParts.combined).trim();\r\n\r\n const attemptUsageSnapshot = engineTotalsToSnapshot(result.usageTotals);\r\n perAttemptUsage.push({\r\n attemptIndex: attempt,\r\n usage: attemptUsageSnapshot,\r\n hasLastProviderResult: result.lastProviderResult !== undefined,\r\n });\r\n\r\n if (\r\n attempt > 1 &&\r\n prevFailureStructuredFingerprint !== undefined &&\r\n structuredFingerprint === prevFailureStructuredFingerprint &&\r\n prevFailurePhase === 'validator'\r\n ) {\r\n throw new AXPAiStructuredOutputError({\r\n message:\r\n 'Assistant returned the same output as the previous attempt while schema validation still failed; stopped to avoid excess token usage.',\r\n attempts: attempt,\r\n lastAssistantText: truncateForStructuredOutputError(displayText),\r\n validationMessage:\r\n 'The model repeated identical assistant text after a successful JSON parse; no further retries will be requested for this run.',\r\n code: 'duplicate_assistant_output',\r\n });\r\n }\r\n\r\n assertAiAssistNotAborted(params.abortSignal);\r\n const validation = await validateAgainstContract({\r\n contract: params.contract,\r\n assistantPlainText: structuredParts.combined,\r\n textSegmentsFallback: structuredParts.segments,\r\n structuredValidator: params.structuredValidator,\r\n commandExecutor: params.commandExecutor,\r\n });\r\n assertAiAssistNotAborted(params.abortSignal);\r\n\r\n if (validation.ok) {\r\n const structuredRunRaw: AXPAiAssistStructuredOutputRunRaw = {\r\n kind: 'structured-output',\r\n attempts: perAttemptUsage,\r\n totalUsage: engineTotalsToSnapshot(mergedUsage),\r\n finalAttempt: attempt,\r\n lastProviderResult: lastProvider,\r\n };\r\n return { success: true,\r\n outputKind: params.contract.kind,\r\n text: displayText,\r\n data: validation.value,\r\n structured: validation.value,\r\n messages: result.messages,\r\n structuredRunRaw,\r\n };\r\n }\r\n\r\n const firstError = validation.errors[0];\r\n prevFailureStructuredFingerprint = structuredFingerprint;\r\n prevFailurePhase = firstError?.phase;\r\n\r\n const canRetry = params.retryOnInvalidStructure && attempt < maxAttempts;\r\n if (!canRetry) {\r\n throw new AXPAiStructuredOutputError({\r\n message: `Structured output validation failed after ${attempt} attempt(s).`,\r\n attempts: attempt,\r\n lastAssistantText: truncateForStructuredOutputError(displayText),\r\n validationMessage: firstError?.message ?? 'Validation failed.',\r\n code: 'validation_exhausted',\r\n });\r\n }\r\n\r\n assertAiAssistNotAborted(params.abortSignal);\r\n messages = [\r\n ...result.messages,\r\n axpAiChatTextMessage(\r\n 'user',\r\n buildStructuredOutputRetryUserText(\r\n firstError?.message ?? 'Validation failed.',\r\n schemaSummary,\r\n firstError?.phase ?? 'parse',\r\n ),\r\n ),\r\n ];\r\n assertAiAssistNotAborted(params.abortSignal);\r\n }\r\n\r\n throw new AXPAiStructuredOutputError({\r\n message: 'Structured output validation failed (unexpected end of retry loop).',\r\n attempts: maxAttempts,\r\n lastAssistantText: '',\r\n validationMessage: 'Unexpected pipeline state.',\r\n code: 'validation_exhausted',\r\n });\r\n}\r\n\r\n//#endregion\r\n","//#region ---- Imports ----\n\nimport { inject, Injectable } from '@angular/core';\nimport type { AXPOutputTranscriptSegmentId } from '@acorex-platform/framework-shared/core';\nimport {\n AXPOutputContractTranscriptSegmentService,\n} from '@acorex-platform/framework-client/common';\nimport type { AXPAiAgentOutputContract } from './ai-agent-output-contract.types';\nimport {\n parseAgentOutputContract,\n resolveAgentOutputContract,\n} from './ai-agent-output-contract.types';\nimport type { ResolveEffectiveOutputContractInput } from './ai-effective-output-contract';\n\n//#endregion\n\n//#region ---- Segment id ----\n\nfunction isOutputContractSegmentId(value: string): value is AXPOutputTranscriptSegmentId {\n return value === 'text' || value === 'node' || value === 'followUp' || value === 'file';\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPAiOutputContractResolveService {\n //#region ---- Dependencies ----\n\n private readonly segmentService = inject(AXPOutputContractTranscriptSegmentService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n /**\n * Resolves a persisted agent/assist `outputContract` value (segment id string)\n * or a full contract object (runtime / programmatic).\n */\n async resolveFromPersisted(raw: unknown): Promise<AXPAiAgentOutputContract | null> {\n if (raw == null) {\n return null;\n }\n\n if (typeof raw === 'string') {\n const id = raw.trim();\n if (!id.length) {\n return null;\n }\n if (isOutputContractSegmentId(id)) {\n return (await this.segmentService.getContractPreset(id)) ?? null;\n }\n return parseAgentOutputContract(raw);\n }\n\n if (typeof raw === 'object' && !Array.isArray(raw)) {\n return parseAgentOutputContract(raw);\n }\n\n return null;\n }\n\n /**\n * Effective contract for one engine turn.\n * Priority: runtime > input > agent > assist > `{ kind: 'string' }`.\n */\n async resolveEffective(params: ResolveEffectiveOutputContractInput): Promise<AXPAiAgentOutputContract> {\n const runtime = await this.resolveFromPersisted(params.runtime);\n if (runtime) {\n return runtime;\n }\n const input = await this.resolveFromPersisted(params.input);\n if (input) {\n return input;\n }\n const agent = await this.resolveFromPersisted(params.agent);\n if (agent) {\n return agent;\n }\n const assist = await this.resolveFromPersisted(params.assist);\n if (assist) {\n return assist;\n }\n return resolveAgentOutputContract(null);\n }\n\n //#endregion\n}\n","//#region ---- Imports ----\r\n\r\nimport { AXPSettingsService } from '@acorex-platform/framework-client/common';\r\nimport {\r\n AXPAiAssistDefaultMaxStructuredRetries,\r\n AXPAiAssistDefaultStructuredMaxTokens,\r\n type AXPAiAssistPromptExecutionContext,\r\n type AXPAiAssistPromptSubmitPayload,\r\n type AXPAiAssistRunInput,\r\n type AXPAiAssistRunResult,\r\n type AXPAiAssistShowOptions,\r\n} from '../types/ai-assist.types';\r\nimport { Injectable, LOCALE_ID, inject } from '@angular/core';\r\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\r\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport { AXPAiManagementSettings } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport { AXPAiAssistService } from './ai-assist.abstract';\r\nimport { AXPAiEngine } from '../engine/ai-engine';\r\nimport { axpAiChatTextMessage } from '@acorex-platform/module-ai-management-client/contracts';\r\nimport { axpAiChatUserMessage } from '../engine/ai-chat-display.util';\r\nimport {\r\n type AXPAiChatMessage,\r\n type AXPAiChatResponse,\r\n type AXPAiEffectiveAssistRow,\r\n type AXPAiChatTransport,\r\n type AXPAiEngineRunOptions,\r\n type AXPAiEngineRunResult,\r\n type AXPAiPlatformRuntimeContext,\r\n} from '../engine/ai-engine.types';\r\nimport { AXPAiPlatformRuntimeContextBuilder } from '../engine/ai-platform-runtime-context.builder';\r\nimport { AXMAiAssistPromptBoxService } from '../assist/ai-assist-prompt-box.service';\r\nimport { outputContractFromAssistRunInput } from '../assist/structured-output/assist-output-contract-from-input';\r\nimport { extractLastAssistantPlainText } from '../assist/structured-output/extract-last-assistant-plain-text';\r\nimport { runStructuredOutputPipeline } from '../assist/structured-output/run-structured-output-pipeline';\r\nimport { assertAiAssistNotAborted } from '../assist/ai-run-abort.util';\r\nimport { axpAiAgentOutputContractUsesStructuredFinalize } from '../engine/ai-agent-output-contract.types';\r\nimport { AXPAiOutputContractResolveService } from '../engine/output-contract-resolve.service';\r\n\r\n//#endregion\r\n\r\n//#region ---- Row types (UI / queries) ----\r\n\r\ntype AXMAiAssistRow = AXPAiEffectiveAssistRow;\r\n\r\n//#endregion\r\n\r\n//#region ---- Assist run helpers ----\r\n\r\nfunction mergePlatformRuntimeContext(\r\n base: AXPAiPlatformRuntimeContext,\r\n notes: Record<string, unknown> | undefined | null,\r\n): AXPAiPlatformRuntimeContext {\r\n if (!notes || Object.keys(notes).length === 0) {\r\n return base;\r\n }\r\n return { ...base, ...notes };\r\n}\r\n\r\nfunction buildUserPromptBody(input: AXPAiAssistRunInput): string {\r\n const parts: string[] = [];\r\n const prompt = input.prompt?.trim() ?? '';\r\n if (prompt.length > 0) {\r\n parts.push(prompt);\r\n }\r\n\r\n const hints = input.context?.hints?.filter((h) => (h ?? '').toString().trim().length > 0) ?? [];\r\n if (hints.length > 0) {\r\n parts.push('', 'Hints:', ...hints.map((h) => `- ${String(h).trim()}`));\r\n }\r\n\r\n const structured = input.context?.structuredContext;\r\n if (structured !== undefined && structured !== null) {\r\n let serialized: string;\r\n try {\r\n serialized = typeof structured === 'string' ? structured : JSON.stringify(structured, null, 2);\r\n } catch {\r\n serialized = String(structured);\r\n }\r\n parts.push('', 'Context (structured):', serialized);\r\n }\r\n\r\n if (input.expectStructuredOutput) {\r\n const extra = input.structuredOutputInstruction?.trim();\r\n parts.push(\r\n '',\r\n 'Structured output requirements:',\r\n '- Reply with exactly one JSON value (a single object or array). It must be complete and valid: close every string, bracket, and brace.',\r\n '- Do not truncate — finish the entire structure in one message.',\r\n '- No markdown code fences, no text or commentary before or after the JSON.',\r\n ...(extra && extra.length > 0 ? ['', 'Additional output rules from the task:', extra] : []),\r\n );\r\n const schemaSummary = input.structuredOutputSchemaSummary?.trim();\r\n if (schemaSummary && schemaSummary.length > 0) {\r\n parts.push('', 'Expected JSON shape (summary):', schemaSummary);\r\n }\r\n }\r\n\r\n return parts.join('\\n').trim();\r\n}\r\n\r\nfunction buildChatMessages(input: AXPAiAssistRunInput): AXPAiChatMessage[] {\r\n const messages: AXPAiChatMessage[] = [];\r\n const systemInstruction = input.context?.systemInstruction?.trim();\r\n if (systemInstruction) {\r\n messages.push(axpAiChatTextMessage('system', systemInstruction));\r\n }\r\n const body = buildUserPromptBody(input);\r\n const media = (input.userMediaAttachments ?? []).filter((a) => a.fileId?.trim());\r\n if (media.length > 0) {\r\n const responses: AXPAiChatResponse[] = [];\r\n for (const a of media) {\r\n const fileId = a.fileId.trim();\r\n responses.push({\r\n type: 'file',\r\n content: { fileId },\r\n });\r\n }\r\n const textBody = body.trim().length > 0 ? body : '(empty prompt)';\r\n responses.push({ type: 'text', content: textBody });\r\n messages.push(axpAiChatUserMessage(responses));\r\n } else {\r\n messages.push(axpAiChatTextMessage('user', body.trim().length > 0 ? body : '(empty prompt)'));\r\n }\r\n return messages;\r\n}\r\n\r\ninterface AXMAiModelMaxTokensRow {\r\n id: string;\r\n chatTransport?: string;\r\n maxOutputTokens?: number;\r\n}\r\n\r\n//#endregion\r\n\r\n/**\r\n * Frontend facade for AI: assist catalog, tenant defaults, engine runs, structured assist runs, and prompt UI.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class AXPAiManagerService extends AXPAiAssistService {\r\n //#region ---- Services & Dependencies ----\r\n\r\n private readonly aiEngine = inject(AXPAiEngine);\r\n private readonly outputContractResolve = inject(AXPAiOutputContractResolveService);\r\n private readonly entityService = inject(AXPEntityService);\r\n private readonly settings = inject(AXPSettingsService);\r\n private readonly runtimeContextBuilder = inject(AXPAiPlatformRuntimeContextBuilder);\r\n private readonly assistPromptBox = inject(AXMAiAssistPromptBoxService);\r\n private readonly localeId = inject(LOCALE_ID);\r\n\r\n private readonly assistData = this.entityService\r\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\r\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\r\n\r\n private readonly modelEntityData = this.entityService\r\n .withEntity(RootConfig.module.name, RootConfig.entities.model.name)\r\n .data<string, AXMAiModelMaxTokensRow, AXMAiModelMaxTokensRow, AXMAiModelMaxTokensRow, AXMAiModelMaxTokensRow>();\r\n\r\n //#endregion\r\n\r\n //#region ---- Assist catalog (frontend) ----\r\n\r\n /**\r\n * Loads the effective assist from `DefaultAssistId` (tenant setting), or the assist named `platform-assistant`.\r\n */\r\n async getEffectiveAssist(): Promise<AXPAiEffectiveAssistRow> {\r\n const raw = await this.settings.get<unknown>(AXPAiManagementSettings.DefaultAssistId);\r\n const assistId = readStoredAssistSettingId(raw);\r\n\r\n if (assistId) {\r\n const byId = await this.assistData.byKey(assistId);\r\n if (byId) {\r\n return byId;\r\n }\r\n const byName = await this.findAssistByName(assistId);\r\n if (byName) {\r\n return byName;\r\n }\r\n throw new Error(\r\n `AI assist with id \"${assistId}\" was not found. Open AI Management → AI Settings and pick a valid default assist.`,\r\n );\r\n }\r\n\r\n const record = await this.findAssistByName('platform-assistant');\r\n if (!record) {\r\n throw new Error(\r\n 'No default assist is configured. Create an assist named \"platform-assistant\" or select one under AI Settings.',\r\n );\r\n }\r\n\r\n return record;\r\n }\r\n\r\n private async findAssistByName(name: string): Promise<AXPAiEffectiveAssistRow | null> {\r\n const queryResult = await this.assistData.query({\r\n skip: 0,\r\n take: 1,\r\n filter: {\r\n field: 'name',\r\n operator: { type: 'equal' },\r\n value: name,\r\n },\r\n });\r\n return ((queryResult?.items ?? [])[0] as AXPAiEffectiveAssistRow | undefined) ?? null;\r\n }\r\n\r\n /**\r\n * Resolves the assist row for chat: explicit primary key, otherwise the effective default from settings.\r\n */\r\n async getAssistForChat(assistId?: string | null): Promise<AXPAiEffectiveAssistRow> {\r\n const id = assistId?.trim();\r\n if (id) {\r\n const row = await this.assistData.byKey(id);\r\n if (row) {\r\n return row;\r\n }\r\n const byName = await this.findAssistByName(id);\r\n if (byName) {\r\n return byName;\r\n }\r\n throw new Error(\r\n `Assist \"${id}\" was not found. Open AI Management → Assists or clear the assist id in the chat URL.`,\r\n );\r\n }\r\n return this.getEffectiveAssist();\r\n }\r\n\r\n /**\r\n * Primary catalog model transport for an assist (`modelId` row).\r\n */\r\n async getAssistPrimaryChatTransport(assistId?: string | null): Promise<AXPAiChatTransport | undefined> {\r\n const assist = await this.getAssistForChat(assistId);\r\n const modelEntityId = assist.modelId?.trim();\r\n if (!modelEntityId) {\r\n return undefined;\r\n }\r\n const model = await this.modelEntityData.byKey(modelEntityId);\r\n const raw = String(model?.chatTransport ?? '').toLowerCase();\r\n if (raw === 'openai' || raw === 'gemini' || raw === 'demis') {\r\n return raw;\r\n }\r\n return undefined;\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- Engine delegation ----\r\n\r\n /**\r\n * Low-level engine run (chat streaming and tool orchestration).\r\n */\r\n runEngine(options: AXPAiEngineRunOptions): Promise<AXPAiEngineRunResult> {\r\n return this.aiEngine.run(options);\r\n }\r\n\r\n //#endregion\r\n\r\n //#region ---- Assist API (run / show) ----\r\n\r\n /**\r\n * Normalizes AiModel.maxOutputTokens from the catalog.\r\n */\r\n private normalizeMaxOutputTokens(value: unknown): number | undefined {\r\n if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) {\r\n return undefined;\r\n }\r\n return Math.floor(value);\r\n }\r\n\r\n /**\r\n * Reads {@link AXMAiModelMaxTokensRow.maxOutputTokens} for the model bound to the assist.\r\n */\r\n private async resolveCatalogMaxOutputTokens(assistId: string | undefined): Promise<number | undefined> {\r\n try {\r\n const assist = await this.getAssistForChat(assistId);\r\n const modelEntityId = assist.modelId?.trim();\r\n if (!modelEntityId) {\r\n return undefined;\r\n }\r\n const model = await this.modelEntityData.byKey(modelEntityId);\r\n return this.normalizeMaxOutputTokens(model?.maxOutputTokens);\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override async run(input: AXPAiAssistRunInput): Promise<AXPAiAssistRunResult> {\r\n assertAiAssistNotAborted(input.abortSignal);\r\n const baseCtx = await this.runtimeContextBuilder.build();\r\n const platformRuntimeContext = mergePlatformRuntimeContext(baseCtx, input.platformRuntimeNotes ?? null);\r\n\r\n const assistId = input.assistId?.trim();\r\n const assistRow = await this.getAssistForChat(assistId);\r\n assertAiAssistNotAborted(input.abortSignal);\r\n const inputContract = outputContractFromAssistRunInput(input);\r\n const effectiveOutputContract = await this.outputContractResolve.resolveEffective({\r\n input: inputContract,\r\n assist: assistRow.outputContract,\r\n });\r\n const usesStructuredPipeline =\r\n input.expectStructuredOutput === true ||\r\n axpAiAgentOutputContractUsesStructuredFinalize(effectiveOutputContract);\r\n\r\n const messages = buildChatMessages(input);\r\n\r\n const catalogMax = await this.resolveCatalogMaxOutputTokens(assistId);\r\n const effectiveMaxTokens = input.maxTokens ?? catalogMax ?? AXPAiAssistDefaultStructuredMaxTokens;\r\n\r\n const runOptions: Omit<AXPAiEngineRunOptions, 'messages'> = {\r\n platformRuntimeContext,\r\n outputContract: effectiveOutputContract,\r\n ...(assistId ? { assistId } : {}),\r\n ...(input.maxSteps !== undefined ? { maxSteps: input.maxSteps } : {}),\r\n ...(input.temperature !== undefined ? { temperature: input.temperature } : {}),\r\n maxTokens: effectiveMaxTokens,\r\n ...(input.abortSignal ? { abortSignal: input.abortSignal } : {}),\r\n };\r\n\r\n if (!usesStructuredPipeline) {\r\n const result = await this.runEngine({ ...runOptions, messages });\r\n assertAiAssistNotAborted(input.abortSignal);\r\n const text = extractLastAssistantPlainText(result.messages);\r\n return { success: true, outputKind: effectiveOutputContract.kind,\r\n text,\r\n raw: { usageTotals: result.usageTotals, lastProviderResult: result.lastProviderResult },\r\n messages: result.messages,\r\n };\r\n }\r\n\r\n const retryOnInvalidStructure = input.retryOnInvalidStructure !== false;\r\n const maxStructuredRetries = input.maxStructuredRetries ?? AXPAiAssistDefaultMaxStructuredRetries;\r\n\r\n const structuredMaxTokens = input.structuredOutputMaxTokens ?? effectiveMaxTokens;\r\n\r\n const pipelineResult = await runStructuredOutputPipeline({\r\n contract: effectiveOutputContract,\r\n initialMessages: messages,\r\n executeRun: (nextMessages) =>\r\n this.runEngine({ ...runOptions, maxTokens: structuredMaxTokens, messages: nextMessages }),\r\n maxStructuredRetries,\r\n retryOnInvalidStructure,\r\n structuredValidator: input.structuredValidator,\r\n structuredOutputSchemaSummary: input.structuredOutputSchemaSummary,\r\n abortSignal: input.abortSignal,\r\n });\r\n\r\n return {\r\n success: pipelineResult.success,\r\n outputKind: pipelineResult.outputKind,\r\n text: pipelineResult.text,\r\n structured: pipelineResult.structured,\r\n data: pipelineResult.data,\r\n validationErrors: pipelineResult.validationErrors,\r\n messages: pipelineResult.messages,\r\n raw: pipelineResult.structuredRunRaw,\r\n };\r\n }\r\n\r\n /** @inheritdoc */\r\n override async show(options: AXPAiAssistShowOptions): Promise<AXPAiAssistRunResult | null> {\r\n const data = await this.assistPromptBox.open(\r\n options,\r\n async (payload: AXPAiAssistPromptSubmitPayload, execution: AXPAiAssistPromptExecutionContext) => {\r\n return await this.run({\r\n prompt: payload.prompt,\r\n userMediaAttachments:\r\n payload.userMediaAttachments.length > 0 ? payload.userMediaAttachments : undefined,\r\n context: options.context,\r\n assistId: payload.assistId,\r\n maxSteps: options.maxSteps,\r\n temperature: options.temperature,\r\n maxTokens: options.maxTokens,\r\n outputContract: options.outputContract,\r\n expectStructuredOutput: options.expectStructuredOutput,\r\n structuredOutputInstruction: options.structuredOutputInstruction,\r\n platformRuntimeNotes: options.platformRuntimeNotes,\r\n maxStructuredRetries: options.maxStructuredRetries,\r\n structuredValidator: options.structuredValidator,\r\n retryOnInvalidStructure: options.retryOnInvalidStructure,\r\n structuredOutputSchemaSummary: options.structuredOutputSchemaSummary,\r\n structuredOutputMaxTokens: options.structuredOutputMaxTokens,\r\n abortSignal: execution.abortSignal,\r\n });\r\n },\r\n );\r\n\r\n return data ?? null;\r\n }\r\n\r\n //#endregion\r\n}\r\n\r\n/** Lookup settings persist an id string, or `{ id }` / `{ value }` before the widget transform. */\r\nfunction readStoredAssistSettingId(raw: unknown): string {\r\n if (typeof raw === 'string') {\r\n return raw.trim();\r\n }\r\n if (raw != null && typeof raw === 'object') {\r\n const record = raw as Record<string, unknown>;\r\n const value = record['id'] ?? record['value'];\r\n if (typeof value === 'string') {\r\n return value.trim();\r\n }\r\n }\r\n return '';\r\n}\r\n","//#region ----- Imports -----\n\nimport { AXPWidgetConfig, AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';\nimport { AXP_DATA_PATH_PROPERTY, AXP_NAME_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXP_WIDGETS_EDITOR_CATEGORY } from '@acorex-platform/framework-client/layout/widget-core';\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst W = '@ai-management:widgets';\n\n//#endregion\n\n//#region ----- Config -----\n\nexport const AXMAgentRegistryToolConfiguratorWidget: AXPWidgetConfig = {\n name: 'agent-registry-tool-configurator',\n title: `${W}.agent-registry-tool-configurator.title`,\n icon: 'fa-light fa-screwdriver-wrench',\n description: `${W}.agent-registry-tool-configurator.description`,\n categories: AXP_WIDGETS_EDITOR_CATEGORY,\n groups: [AXPWidgetGroupEnum.UtilityWidget],\n type: 'editor',\n defaultFilterWidgetName: 'string-filter',\n properties: [\n AXP_NAME_PROPERTY,\n AXP_DATA_PATH_PROPERTY,\n {\n name: 'label',\n title: `${W}.shared.properties.label`,\n visible: true,\n group: { name: 'general', title: `${W}.shared.groups.general`, order: 1 },\n schema: {\n dataType: 'string',\n defaultValue: '',\n interface: {\n path: 'label',\n type: 'text-box',\n options: {\n placeholder: `${W}.shared.properties.field-label-placeholder`,\n },\n },\n },\n },\n {\n name: 'registryKind',\n title: `${W}.shared.registry-kind.title`,\n visible: true,\n group: { name: 'behavior', title: `${W}.shared.groups.behavior`, order: 2 },\n schema: {\n dataType: 'string',\n defaultValue: 'command',\n interface: {\n path: 'options.registryKind',\n type: 'select-editor',\n options: {\n items: [\n { id: 'command', title: `${W}.shared.registry-kind.command` },\n { id: 'query', title: `${W}.shared.registry-kind.query` },\n ],\n valueField: 'id',\n textField: 'title',\n },\n },\n },\n },\n {\n name: 'readonly',\n title: '@general:terms.common.readonly',\n visible: true,\n group: { name: 'behavior', title: `${W}.shared.groups.behavior`, order: 2 },\n schema: {\n dataType: 'string',\n interface: {\n path: 'options.readonly',\n type: 'text-box',\n options: {\n placeholder: `${W}.shared.properties.readonly-expression-placeholder`,\n },\n },\n },\n },\n {\n name: 'dataSource',\n title: `${W}.shared.properties.data-source-override`,\n visible: true,\n group: { name: 'data', title: `${W}.shared.groups.data`, order: 3 },\n schema: {\n dataType: 'string',\n interface: {\n path: 'options.dataSource',\n type: 'text-box',\n options: {\n placeholder: `${W}.shared.properties.data-source-override-placeholder`,\n },\n },\n },\n },\n ],\n components: {\n edit: {\n component: () =>\n import('./agent-registry-tool-configurator-widget-edit.component').then(\n (c) => c.AXMAgentRegistryToolConfiguratorWidgetEditComponent,\n ),\n },\n designer: {\n component: () =>\n import('./agent-registry-tool-configurator-widget-edit.component').then(\n (c) => c.AXMAgentRegistryToolConfiguratorWidgetEditComponent,\n ),\n },\n column: {\n component: () =>\n import('./agent-registry-tool-configurator-widget-column.component').then(\n (c) => c.AXMAgentRegistryToolConfiguratorWidgetColumnComponent,\n ),\n },\n },\n};\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPWidgetConfig, AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';\nimport { AXP_DATA_PATH_PROPERTY, AXP_NAME_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXP_WIDGETS_EDITOR_CATEGORY } from '@acorex-platform/framework-client/layout/widget-core';\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst W = '@ai-management:widgets';\n\n//#endregion\n\n//#region ---- Config ----\n\nexport const AXMAssistDelegatedAgentConfiguratorWidget: AXPWidgetConfig = {\n name: 'assist-delegated-agent-configurator',\n title: `${W}.assist-delegated-agent-configurator.title`,\n icon: 'fa-light fa-user-robot',\n description: `${W}.assist-delegated-agent-configurator.description`,\n categories: AXP_WIDGETS_EDITOR_CATEGORY,\n groups: [AXPWidgetGroupEnum.UtilityWidget],\n type: 'editor',\n defaultFilterWidgetName: 'string-filter',\n properties: [\n AXP_NAME_PROPERTY,\n AXP_DATA_PATH_PROPERTY,\n {\n name: 'label',\n title: `${W}.shared.properties.label`,\n visible: true,\n group: { name: 'general', title: `${W}.shared.groups.general`, order: 1 },\n schema: {\n dataType: 'string',\n defaultValue: '@ai-management:assists.entities.assist.fields.delegated-agent.title',\n interface: {\n path: 'label',\n type: 'text-box',\n options: {\n placeholder: `${W}.shared.properties.field-label-placeholder`,\n },\n },\n },\n },\n {\n name: 'readonly',\n title: '@general:terms.common.readonly',\n visible: true,\n group: { name: 'behavior', title: `${W}.shared.groups.behavior`, order: 2 },\n schema: {\n dataType: 'string',\n interface: {\n path: 'options.readonly',\n type: 'text-box',\n options: {\n placeholder: `${W}.shared.properties.readonly-expression-placeholder`,\n },\n },\n },\n },\n ],\n components: {\n edit: {\n component: () =>\n import('./assist-delegated-agent-configurator-widget-edit.component').then(\n (c) => c.AXMAssistDelegatedAgentConfiguratorWidgetEditComponent,\n ),\n },\n designer: {\n component: () =>\n import('./assist-delegated-agent-configurator-widget-edit.component').then(\n (c) => c.AXMAssistDelegatedAgentConfiguratorWidgetEditComponent,\n ),\n },\n column: {\n component: () =>\n import('./assist-delegated-agent-configurator-widget-column.component').then(\n (c) => c.AXMAssistDelegatedAgentConfiguratorWidgetColumnComponent,\n ),\n },\n },\n};\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPWidgetDefinitionProvider } from '@acorex-platform/framework-client/layout/widget-core';\nimport { Injectable } from '@angular/core';\nimport { AXMAgentRegistryToolConfiguratorWidget } from './features/widgets/agent-registry-tool-configurator/agent-registry-tool-configurator-widget.config';\nimport { AXMAssistDelegatedAgentConfiguratorWidget } from './features/widgets/assist-delegated-agent-configurator/assist-delegated-agent-configurator-widget.config';\n\n//#endregion\n\n//#region ---- AI Management Widgets Provider ----\n\nconst AI_MANAGEMENT_WIDGETS = [\n AXMAssistDelegatedAgentConfiguratorWidget,\n AXMAgentRegistryToolConfiguratorWidget,\n];\n\n@Injectable()\nexport class AXMAiManagementWidgetsProvider implements AXPWidgetDefinitionProvider {\n getWidgets() {\n return AI_MANAGEMENT_WIDGETS;\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type {\n AXPOutputContractTranscriptSegmentDefinition,\n AXPOutputContractTranscriptSegmentProvider,\n} from '@acorex-platform/framework-client/common';\n\n//#endregion\n\n//#region ---- Built-in segment definitions ----\n\n/** Single source for entity select options and DI segment presets. */\nexport const AXM_BUILTIN_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_DEFINITIONS: AXPOutputContractTranscriptSegmentDefinition[] =\n [\n {\n name: 'text',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.text',\n applicableKinds: ['object'],\n contract: {\n kind: 'object',\n transcriptSegment: 'text',\n structuredRetries: 2,\n },\n },\n {\n name: 'node',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.node',\n applicableKinds: ['object'],\n contract: {\n kind: 'object',\n transcriptSegment: 'node',\n structuredRetries: 3,\n },\n },\n {\n name: 'followUp',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.follow-up',\n applicableKinds: ['object'],\n contract: {\n kind: 'object',\n transcriptSegment: 'followUp',\n structuredRetries: 2,\n },\n },\n {\n name: 'file',\n title: '@ai-management:agents.entities.agent.fields.output-contract.transcript-segment.options.file',\n applicableKinds: ['string'],\n contract: {\n kind: 'string',\n instruction:\n 'When a tool persists media (image, audio, etc.), the platform attaches a chat file segment automatically (`{\"type\":\"file\",\"content\":{\"fileId\":\"<id>\"}}`; optional `\"isDownloadable\":true` when the user wants a downloadable file — default false for inline preview/playback). User-visible text: at most one friendly sentence. Never paste tool JSON, fileId, or file metadata in text.',\n },\n },\n ];\n\n//#endregion\n\n//#region ---- Provider ----\n\nexport class AXMBuiltinOutputContractTranscriptSegmentProvider implements AXPOutputContractTranscriptSegmentProvider {\n provide(): AXPOutputContractTranscriptSegmentDefinition[] {\n return AXM_BUILTIN_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_DEFINITIONS;\n }\n}\n\n//#endregion\n","import { Injectable } from '@angular/core';\nimport type { AXPContextDefinition, AXPContextDefinitionProvider } from '@acorex-platform/framework-client/core';\nimport { AXM_AI_PLATFORM_RUNTIME_CONTEXT_DEFINITIONS } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#region ---- Platform runtime time & notes ----\n\n@Injectable()\nexport class AXMAiPlatformRuntimeContextDefinitionProvider implements AXPContextDefinitionProvider {\n async items(): Promise<AXPContextDefinition[]> {\n return AXM_AI_PLATFORM_RUNTIME_CONTEXT_DEFINITIONS;\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';\nimport {\n AXP_MENU_PROVIDER,\n AXP_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_PROVIDER,\n AXP_SETTING_DEFINITION_PROVIDER,\n} from '@acorex-platform/framework-client/common';\nimport {\n AXPComponentSlotModule,\n AXP_CONTEXT_DEFINITION_PROVIDER,\n AXP_FEATURE_DEFINITION_PROVIDER,\n AXP_TAG_PROVIDER,\n} from '@acorex-platform/framework-client/core';\nimport { AXP_WIDGET_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXPWidgetsModule } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXPRuntimeModule, provideQuerySetups } from '@acorex-platform/framework-client/runtime';\nimport { NgModule } from '@angular/core';\nimport { ROUTES, Routes } from '@angular/router';\nimport { AXMAiManagementFeatureDefinitionProvider } from './feature-definition.provider';\nimport { AXMAiManagementMenuProvider } from './menu.provider';\nimport { AXMPermissionDefinitionProvider } from './permission-definition.provider';\nimport { AXMAiManagementSettingProvider } from './settings.provider';\nimport { AXMAiModelPurposeTagProvider } from './features/tags/ai-model-purpose-tag.provider';\nimport { AXPAiAssistService } from './features/services/ai-assist.abstract';\nimport { AXPAiManagerService } from './features/services/ai-manager.service';\nimport { AXMAiManagementWidgetsProvider } from './widget-definition.provider';\nimport { AXMBuiltinOutputContractTranscriptSegmentProvider } from './features/engine/output-contract-transcript-segment.builtin-providers';\nimport { AXMAiPlatformRuntimeContextDefinitionProvider } from './features/engine/platform-runtime-context-definition.provider';\n\n//#endregion\n\n//#region ---- Routes ----\n\nfunction routesFactory(): Routes {\n return [];\n}\n\n//#endregion\n\n//#region ---- Module ----\n\n@NgModule({\n imports: [\n AXPComponentSlotModule.forChild({\n }),\n AXPWidgetsModule,\n AXPRuntimeModule,\n ],\n providers: [\n {\n provide: ROUTES,\n multi: true,\n useFactory: routesFactory,\n },\n {\n provide: AXP_PERMISSION_DEFINITION_PROVIDER,\n useClass: AXMPermissionDefinitionProvider,\n multi: true,\n },\n {\n provide: AXP_FEATURE_DEFINITION_PROVIDER,\n useClass: AXMAiManagementFeatureDefinitionProvider,\n multi: true,\n },\n {\n provide: AXP_MENU_PROVIDER,\n useClass: AXMAiManagementMenuProvider,\n multi: true,\n },\n {\n provide: AXP_SETTING_DEFINITION_PROVIDER,\n useClass: AXMAiManagementSettingProvider,\n multi: true,\n },\n {\n provide: AXP_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_PROVIDER,\n useClass: AXMBuiltinOutputContractTranscriptSegmentProvider,\n multi: true,\n },\n provideQuerySetups([\n {\n key: 'AiManagement:ListOutputContractTranscriptSegments',\n loader: () =>\n import('./features/queries/list-output-contract-transcript-segments.query').then(\n (c) => c.AXMListOutputContractTranscriptSegmentsQuery,\n ),\n },\n {\n key: 'AiManagement:ListAiCommandRegistryCatalog',\n loader: () =>\n import('./features/queries/list-ai-command-registry-catalog.query').then(\n (c) => c.AXMListAiCommandRegistryCatalogQuery,\n ),\n },\n {\n key: 'AiManagement:ListAiQueryRegistryCatalog',\n loader: () =>\n import('./features/queries/list-ai-query-registry-catalog.query').then(\n (c) => c.AXMListAiQueryRegistryCatalogQuery,\n ),\n },\n ]),\n {\n provide: AXP_WIDGET_DEFINITION_PROVIDER,\n useClass: AXMAiManagementWidgetsProvider,\n multi: true,\n },\n {\n provide: AXP_TAG_PROVIDER,\n useClass: AXMAiModelPurposeTagProvider,\n multi: true,\n },\n {\n provide: AXPAiAssistService,\n useExisting: AXPAiManagerService,\n },\n {\n provide: AXP_CONTEXT_DEFINITION_PROVIDER,\n useClass: AXMAiPlatformRuntimeContextDefinitionProvider,\n multi: true,\n },\n ],\n})\nexport class AXMAiManagementModule {}\n\n//#endregion\n","//#region ---- Delegated agent prompt preview ----\n\nfunction normalizeDelegatedAgentToolArgs(argumentsValue: unknown): Record<string, unknown> | null {\n if (argumentsValue == null) {\n return null;\n }\n if (typeof argumentsValue === 'object' && !Array.isArray(argumentsValue)) {\n return { ...(argumentsValue as Record<string, unknown>) };\n }\n if (typeof argumentsValue === 'string') {\n const t = argumentsValue.trim();\n if (!t) {\n return null;\n }\n try {\n const p = JSON.parse(t) as unknown;\n if (p != null && typeof p === 'object' && !Array.isArray(p)) {\n return p as Record<string, unknown>;\n }\n } catch {\n return null;\n }\n }\n return null;\n}\n\nfunction formatArgsFallback(argumentsValue: unknown): string {\n if (argumentsValue == null) {\n return '';\n }\n if (typeof argumentsValue === 'string') {\n return argumentsValue;\n }\n try {\n return JSON.stringify(argumentsValue, null, 2);\n } catch {\n return String(argumentsValue);\n }\n}\n\n/**\n * Human-readable specialist prompt from delegated-agent tool arguments (conversation / mini-chat UI).\n */\nexport function axpAiDelegatedAgentPromptPreview(argumentsValue: unknown): string {\n const obj = normalizeDelegatedAgentToolArgs(argumentsValue);\n if (!obj) {\n return formatArgsFallback(argumentsValue);\n }\n const preferKeys = ['query', 'task', 'prompt', 'message', 'userMessage', 'instruction', 'goal'] as const;\n for (const k of preferKeys) {\n const v = obj[k];\n if (typeof v === 'string' && v.trim()) {\n return v.trim();\n }\n }\n const keys = Object.keys(obj);\n if (keys.length === 1) {\n const only = obj[keys[0]!];\n if (typeof only === 'string' && only.trim()) {\n return only.trim();\n }\n }\n try {\n return JSON.stringify(obj, null, 2);\n } catch {\n return formatArgsFallback(argumentsValue);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiChatMessage } from '../engine/ai-engine.types';\nimport { axpAiChatTextMessage } from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n/** Maximum length for assist initial transcript text after HTML strip (characters). */\nconst ASSIST_INITIAL_MESSAGES_MAX_LENGTH = 16_000;\n\n//#region ---- HTML / rich text to plain ----\n\n/**\n * Strips HTML tags and decodes a few common entities for safe plain-text transcript lines.\n * Used for Assist `initialMessages` (may be stored as rich text HTML).\n */\nexport function axpAiStripAssistInitialHtmlToPlain(raw: string): string {\n let s = raw\n .replace(/<\\/p>\\s*(?:<br\\s*\\/?>\\s*)*<p[^>]*>/gi, '\\n\\n')\n .replace(/<\\/p>\\s*<p[^>]*>/gi, '\\n\\n')\n .replace(/<br\\s*\\/?>/gi, '\\n');\n s = s.replace(/<\\/(div|h[1-6]|li|tr)>/gi, '\\n');\n s = s.replace(/<[^>]+>/g, '');\n s = s\n .replace(/ /gi, ' ')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\");\n s = s.replace(/\\r\\n/g, '\\n').trim();\n if (s.length > ASSIST_INITIAL_MESSAGES_MAX_LENGTH) {\n s = s.slice(0, ASSIST_INITIAL_MESSAGES_MAX_LENGTH).trimEnd() + '…';\n }\n return s;\n}\n\n//#endregion\n\n//#region ---- Transcript messages ----\n\n/**\n * Converts assist `initialMessages` (HTML or plain) into one or more `assistant` transcript lines.\n * Non-empty paragraphs (split by blank lines) become separate messages; single block stays one message.\n */\nexport function axpAiAssistInitialMessagesToTranscript(\n raw: string | null | undefined,\n): AXPAiChatMessage[] {\n const trimmed = raw?.trim() ?? '';\n if (!trimmed) {\n return [];\n }\n const plain = axpAiStripAssistInitialHtmlToPlain(trimmed);\n if (!plain) {\n return [];\n }\n const blocks = plain\n .split(/\\n{2,}/)\n .map((b) => b.replace(/\\n+/g, ' ').trim())\n .filter((b) => b.length > 0);\n if (blocks.length === 0) {\n return [];\n }\n return blocks.map((text) => axpAiChatTextMessage('assistant', text));\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { resolveMultiLanguageString } from '@acorex/core/translation';\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport type { AXMAiManagementAssistEntityModel } from '@acorex-platform/module-ai-management-client/contracts';\nimport type { AXPAiEffectiveAssistRow } from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Types ----\n\ntype AssistStarterPromptsSource =\n | Pick<AXMAiManagementAssistEntityModel, 'starterPrompts'>\n | Pick<AXPAiEffectiveAssistRow, 'starterPrompts'>\n | null\n | undefined;\n\n//#endregion\n\n//#region ---- Extraction ----\n\n/**\n * Returns non-empty starter prompt labels, preserving repeater order.\n * Resolve locale in the template via the translate pipe.\n */\nexport function axpAiAssistStarterPromptLabels(\n source: AssistStarterPromptsSource,\n): Array<string | AXPMultiLanguageString> {\n const items = source?.starterPrompts;\n if (!Array.isArray(items) || items.length === 0) {\n return [];\n }\n\n const labels: Array<string | AXPMultiLanguageString> = [];\n for (const item of items) {\n const text = item?.text;\n if (!axpAiAssistStarterPromptLabelIsNonEmpty(text)) {\n continue;\n }\n labels.push(text);\n }\n return labels;\n}\n\n/**\n * Returns non-empty starter prompt strings for the active locale, preserving repeater order.\n */\nexport function axpAiAssistStarterPromptTexts(\n source: AssistStarterPromptsSource,\n locale: string,\n): string[] {\n return axpAiAssistStarterPromptLabels(source)\n .map((text) => (typeof text === 'string' ? text : resolveMultiLanguageString(text, locale)).trim())\n .filter((text) => text.length > 0);\n}\n\nfunction axpAiAssistStarterPromptLabelIsNonEmpty(\n text: string | AXPMultiLanguageString | null | undefined,\n): text is string | AXPMultiLanguageString {\n if (text == null) {\n return false;\n }\n if (typeof text === 'string') {\n return text.trim().length > 0;\n }\n return Object.values(text).some((value) => typeof value === 'string' && value.trim().length > 0);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable, signal } from '@angular/core';\nimport type { AXPAiChatTransport } from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Run context ----\n\nexport interface AXPAiChatToolRunContext {\n assistId: string;\n chatTransport: AXPAiChatTransport;\n /** AiModel catalog row id for the active chat model (when resolved). */\n modelEntityId?: string;\n /** Set during a delegated agent sub-run (specialist executing registry tools). */\n agentId?: string;\n /** Assist or AiAgent catalog `name` (Demisco `agent_uuid` for Demis transport). */\n agentName?: string;\n /** Optional Demisco chat session id (`session_uuid` in multipart). */\n demisSessionUuid?: string;\n}\n\n/**\n * Per chat run: stores which assist and chat transport are active.\n * Injected commands (e.g. image generation) read this instead of receiving assist/transport inside tool args.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPAiChatToolRunContextService {\n private readonly runContext = signal<AXPAiChatToolRunContext | null>(null);\n\n setContext(ctx: AXPAiChatToolRunContext | null): void {\n this.runContext.set(ctx);\n }\n\n getContext(): AXPAiChatToolRunContext | null {\n return this.runContext();\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AIMANAGEMENT_CHAT_GENERATE_IMAGE_COMMAND_KEY,\n AIMANAGEMENT_CHAT_SYNTHESIZE_SPEECH_COMMAND_KEY,\n AIMANAGEMENT_CHAT_TRANSCRIBE_SPEECH_COMMAND_KEY,\n AIMANAGEMENT_RENDER_CHAT_CHART_COMMAND_KEY,\n} from '@acorex-platform/module-ai-management-client/contracts';\n\n//#endregion\n\n//#region ---- LLM JSON Schema overrides ----\n\n/**\n * Registry rows map inputs to string-typed JSON schemas. Override parameters for AI chat tools\n * so models receive accurate types (arrays, booleans, nested objects).\n */\nexport function getAiChatCommandLlmParametersOverride(\n commandName: string,\n): Record<string, unknown> | null {\n switch (commandName) {\n case AIMANAGEMENT_CHAT_GENERATE_IMAGE_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n prompt: {\n type: 'string',\n description: 'Detailed text description of the image to generate.',\n },\n size: {\n type: 'string',\n description: 'Optional size hint for backends that support it (e.g. 1024x1024). May be ignored.',\n },\n style: {\n type: 'string',\n description:\n 'Optional style hint (e.g. photorealistic, flat vector). May be merged into the prompt by the backend.',\n },\n },\n required: ['prompt'],\n };\n case AIMANAGEMENT_CHAT_TRANSCRIBE_SPEECH_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n model: {\n type: 'string',\n description:\n 'Optional catalog AiModel row id for speech-to-text. Omit to use options.model on the speech delegated specialist row.',\n },\n fileId: {\n type: 'string',\n description: 'Platform file storage id for the audio file to transcribe.',\n },\n language: {\n type: 'string',\n description: 'Optional language hint (e.g. en) when supported by the provider.',\n },\n },\n required: ['fileId'],\n };\n case AIMANAGEMENT_CHAT_SYNTHESIZE_SPEECH_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n model: {\n type: 'string',\n description:\n 'Catalog AiModel row id for text-to-speech (purpose tts). Pass on the command or rely on agent commandIds options.model; mock default is OpenRouter x-ai/grok-voice-tts-1.0.',\n },\n text: {\n type: 'string',\n description: 'Plain text to convert to speech.',\n },\n voice: {\n type: 'string',\n description:\n 'Optional voice. Grok Voice default row: ara, eve, rex, sal, leo (alloy maps to ara). Gemini TTS: Zephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede.',\n },\n responseFormat: {\n type: 'string',\n description: 'Optional audio format. Gemini default: pcm. OpenRouter also supports mp3 for other TTS models.',\n },\n },\n required: ['text'],\n };\n case AIMANAGEMENT_RENDER_CHAT_CHART_COMMAND_KEY:\n return {\n type: 'object',\n properties: {\n kind: {\n type: 'string',\n enum: ['bar', 'line', 'donut', 'gauge', 'funnel', 'heatmap'],\n description:\n 'Chart kind. Bar for categorical counts, line for trends, donut for part-to-whole, gauge for one KPI, funnel for stages, heatmap for a matrix.',\n },\n title: { type: 'string', description: 'Optional chart title.' },\n xAxisLabel: { type: 'string', description: 'Optional X-axis caption.' },\n yAxisLabel: { type: 'string', description: 'Optional Y-axis caption.' },\n entity: {\n type: 'string',\n description:\n 'Module.Entity for stored rows. When set, this command runs one storage aggregate and ignores items. Do not call Entity:Query:Default first.',\n },\n filter: {\n description: 'Optional AXPQueryRequest.filter JSON applied to the aggregate.',\n },\n groupBy: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Field paths from the entity schema (source of x / series). Empty array is allowed for gauge.',\n },\n measures: {\n type: 'array',\n description:\n 'Aggregate measures. Always set alias. Each item: { reducer, field?, alias? }. First alias is y unless yField is set.',\n items: {\n type: 'object',\n properties: {\n reducer: { type: 'string', enum: ['count', 'sum', 'min', 'max', 'avg'] },\n field: { type: 'string' },\n alias: { type: 'string' },\n },\n },\n },\n xField: {\n type: 'string',\n description: 'Aggregate result column for x. Defaults to the first groupBy path.',\n },\n yField: {\n type: 'string',\n description: 'Aggregate result column for y. Defaults to the first measure alias.',\n },\n seriesField: {\n type: 'string',\n description: 'Optional line-series column. Defaults to the second groupBy path when kind is line.',\n },\n valueField: {\n type: 'string',\n description: 'Heatmap numeric column. Defaults to the first measure alias.',\n },\n items: {\n type: 'array',\n description:\n 'Escape hatch when numbers are already in chat (no entity). Ignored when entity is set. Bar/donut/funnel: { x, y }. Line: { x, y, series? }. Heatmap: { x, y, value }. Gauge: one { y } or { value }.',\n items: {\n type: 'object',\n properties: {\n x: { description: 'Category or X value.' },\n y: { description: 'Numeric Y for bar/line/donut/funnel/gauge; category for heatmap.' },\n value: { description: 'Numeric intensity for heatmap, or gauge fallback.' },\n series: { type: 'string', description: 'Optional line-series name.' },\n },\n },\n },\n },\n required: ['kind'],\n };\n default:\n return null;\n }\n}\n\n//#endregion\n","//#region ---- Constants ----\n\n/** OpenAI / OpenRouter `pcm` TTS output: 16-bit signed LE, mono, 24 kHz. */\nexport const AI_CHAT_TTS_PCM_SAMPLE_RATE = 24000;\n\n//#endregion\n\n//#region ---- MIME helpers ----\n\nexport function isRawPcmMimeType(mimeType: string): boolean {\n const mime = mimeType.trim().toLowerCase();\n return mime === 'audio/pcm' || mime === 'audio/l16' || mime === 'audio/x-pcm' || mime === 'audio/raw';\n}\n\n//#endregion\n\n//#region ---- PCM → WAV ----\n\n/**\n * Wraps raw 16-bit signed little-endian PCM in a RIFF WAV container for HTML5 audio playback.\n */\nexport function wrapPcm16LeInWav(\n pcmBytes: ArrayBuffer,\n sampleRate = AI_CHAT_TTS_PCM_SAMPLE_RATE,\n numChannels = 1,\n): ArrayBuffer {\n const bitsPerSample = 16;\n const blockAlign = (numChannels * bitsPerSample) / 8;\n const byteRate = sampleRate * blockAlign;\n const dataSize = pcmBytes.byteLength;\n const headerSize = 44;\n const out = new ArrayBuffer(headerSize + dataSize);\n const view = new DataView(out);\n\n const writeStr = (offset: number, str: string): void => {\n for (let i = 0; i < str.length; i++) {\n view.setUint8(offset + i, str.charCodeAt(i));\n }\n };\n\n writeStr(0, 'RIFF');\n view.setUint32(4, 36 + dataSize, true);\n writeStr(8, 'WAVE');\n writeStr(12, 'fmt ');\n view.setUint32(16, 16, true);\n view.setUint16(20, 1, true);\n view.setUint16(22, numChannels, true);\n view.setUint32(24, sampleRate, true);\n view.setUint32(28, byteRate, true);\n view.setUint16(32, blockAlign, true);\n view.setUint16(34, bitsPerSample, true);\n writeStr(36, 'data');\n view.setUint32(40, dataSize, true);\n\n new Uint8Array(out, headerSize).set(new Uint8Array(pcmBytes));\n return out;\n}\n\n//#endregion\n\n//#region ---- Playback preparation ----\n\nexport interface AiChatTtsPlaybackBytes {\n audioBytes: ArrayBuffer;\n mimeType: string;\n extension: string;\n}\n\n/** Normalizes synthesized speech bytes to a browser-playable container (PCM → WAV). */\nexport function prepareTtsBytesForBrowserPlayback(\n audioBytes: ArrayBuffer,\n mimeType: string,\n): AiChatTtsPlaybackBytes {\n const mt = mimeType.trim() || 'application/octet-stream';\n if (isRawPcmMimeType(mt)) {\n return {\n audioBytes: wrapPcm16LeInWav(audioBytes),\n mimeType: 'audio/wav',\n extension: 'wav',\n };\n }\n\n const lower = mt.toLowerCase();\n if (lower.includes('mpeg') || lower.includes('mp3')) {\n return { audioBytes, mimeType: mt, extension: 'mp3' };\n }\n if (lower.includes('wav')) {\n return { audioBytes, mimeType: mt, extension: 'wav' };\n }\n if (lower.includes('opus')) {\n return { audioBytes, mimeType: mt, extension: 'opus' };\n }\n if (lower.includes('ogg')) {\n return { audioBytes, mimeType: mt, extension: 'ogg' };\n }\n if (lower.includes('aac')) {\n return { audioBytes, mimeType: mt, extension: 'aac' };\n }\n if (lower.includes('flac')) {\n return { audioBytes, mimeType: mt, extension: 'flac' };\n }\n if (lower.includes('pcm')) {\n return {\n audioBytes: wrapPcm16LeInWav(audioBytes),\n mimeType: 'audio/wav',\n extension: 'wav',\n };\n }\n\n return { audioBytes, mimeType: mt, extension: 'bin' };\n}\n\n/**\n * Builds a blob URL for chat voice playback, wrapping legacy PCM TTS files when needed.\n */\nexport async function createBrowserPlayableTtsBlobUrl(\n binary: Blob,\n mimeType: string,\n fileName?: string,\n): Promise<string> {\n const mime = mimeType.trim().toLowerCase();\n const name = fileName?.trim().toLowerCase() ?? '';\n const looksLikePcm =\n isRawPcmMimeType(mime) || (mime === 'application/octet-stream' && name.endsWith('.pcm'));\n\n if (!looksLikePcm) {\n return URL.createObjectURL(binary);\n }\n\n const pcmBytes = await binary.arrayBuffer();\n return URL.createObjectURL(new Blob([wrapPcm16LeInWav(pcmBytes)], { type: 'audio/wav' }));\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiEngineLastProviderPayload } from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Stream chunk stripping ----\n\n/**\n * Removes ephemeral SSE chunk arrays from provider `rawResponse` objects.\n * Assistant text is accumulated during streaming; chunk blobs must not be persisted or exported.\n */\nexport function axpStripEphemeralStreamChunksFromProviderRaw(raw: unknown): unknown {\n if (raw == null || typeof raw !== 'object' || Array.isArray(raw)) {\n return raw;\n }\n const record = raw as Record<string, unknown>;\n if (record['stream'] !== true || !Array.isArray(record['chunks'])) {\n return raw;\n }\n const rest = { ...record };\n delete rest['chunks'];\n delete rest['stream'];\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\n/** Strips stream chunks from {@link AXPAiEngineLastProviderPayload} before message metadata / debug export. */\nexport function axpSanitizeLastProviderPayloadForPersistence(\n payload: AXPAiEngineLastProviderPayload | undefined,\n): AXPAiEngineLastProviderPayload | undefined {\n if (!payload) {\n return undefined;\n }\n if (payload.rawResponse === undefined) {\n return payload;\n }\n const rawResponse = axpStripEphemeralStreamChunksFromProviderRaw(payload.rawResponse);\n if (rawResponse === payload.rawResponse) {\n return payload;\n }\n if (rawResponse === undefined) {\n const { rawResponse: _removed, ...rest } = payload;\n return rest;\n }\n return { ...payload, rawResponse };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiDelegatedAgentTranscriptRunInput, AXPAiEngineRunOptions } from './ai-engine.types';\n\n//#endregion\n\n//#region ---- Run input snapshot ----\n\n/** Builds a JSON-serializable delegated specialist {@link AXPAiEngineRunOptions} snapshot (no callbacks). */\nexport function axpBuildDelegatedAgentRunInputSnapshot(\n delegationCallId: string,\n agentId: string,\n agentName: string | undefined,\n specialistArguments: unknown,\n runOptions: AXPAiEngineRunOptions,\n): AXPAiDelegatedAgentTranscriptRunInput {\n const { onRunEvent: _omit, ...run } = runOptions;\n const callId = delegationCallId.trim();\n const catalogId = agentId.trim();\n return {\n delegationCallId: callId,\n agentId: catalogId,\n ...(agentName?.trim() ? { agentName: agentName.trim() } : {}),\n specialistArguments,\n run,\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPAiStructuredValidator } from '../../types/ai-assist.types';\n\nimport { parseStructuredAssistantWithSegmentFallback } from './repair-structured-assistant-parse';\n\n//#endregion\n\n//#region ---- Validation ----\n\nexport type StructuredAssistantValidation =\n | { ok: true; value: unknown }\n | { ok: false; errorMessage: string; failurePhase: 'parse' | 'validator' };\n\nfunction hasAnyStructuredContent(combined: string, segments: readonly string[] | undefined): boolean {\n if (combined.trim().length > 0) {\n return true;\n }\n if (!segments?.length) {\n return false;\n }\n return segments.some((s) => (s ?? '').trim().length > 0);\n}\n\n/**\n * Parses JSON from assistant text (including lightweight local repair), then optionally runs a custom validator.\n *\n * @param textSegmentsFallback - When provided, each segment is tried after combined text (last segment first); helps when prose and JSON sit in separate assistant text blocks.\n */\nexport async function validateStructuredAssistantResponse(\n assistantPlainText: string,\n structuredValidator: AXPAiStructuredValidator | undefined,\n textSegmentsFallback?: readonly string[],\n): Promise<StructuredAssistantValidation> {\n if (!hasAnyStructuredContent(assistantPlainText, textSegmentsFallback)) {\n return {\n ok: false,\n errorMessage: 'Assistant returned empty output.',\n failurePhase: 'parse',\n };\n }\n\n const parsed = parseStructuredAssistantWithSegmentFallback(assistantPlainText, textSegmentsFallback ?? []);\n if (parsed === undefined) {\n return {\n ok: false,\n errorMessage:\n 'Could not parse assistant output as JSON (expected a JSON object or array; optional markdown fence; segment fallback, local repair, and truncation repair also failed).',\n failurePhase: 'parse',\n };\n }\n\n if (!structuredValidator) {\n return { ok: true, value: parsed };\n }\n\n try {\n const value = await structuredValidator(parsed);\n return { ok: true, value };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return {\n ok: false,\n errorMessage: msg.trim().length > 0 ? msg : 'Structured validation failed.',\n failurePhase: 'validator',\n };\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { Injectable, LOCALE_ID, inject } from '@angular/core';\nimport { resolveMultiLanguageString } from '@acorex/core/translation';\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-ai-management-client/contracts';\nimport { isChatPurposeModelRow, readModelPurposes } from '@acorex-platform/module-ai-management-client/contracts';\nimport type {\n AXPAiChatModelListItem,\n AXPAiChatModelListRequest,\n} from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Row types (entity query) ----\n\ninterface CatalogModelRow {\n id: string;\n name?: string;\n title?: string | AXPMultiLanguageString;\n chatTransport?: string;\n openAiEndpointId?: string;\n maxContextTokens?: number;\n inputPricePerMillion?: number;\n outputPricePerMillion?: number;\n cachedInputPricePerMillion?: number;\n isDisabled?: boolean;\n openAiEndpointIsDisabled?: boolean;\n}\n\n//#endregion\n\n/**\n * Lists chat-purpose AI models (catalog), without using {@link AXPAiEngine}.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPAiAssistChatModelCatalogService {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly localeId = inject(LOCALE_ID);\n\n private readonly modelData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.model.name)\n .data<string, CatalogModelRow, CatalogModelRow, CatalogModelRow, CatalogModelRow>();\n\n //#endregion\n\n //#region ---- Public API ----\n\n /**\n * All active chat-purpose models in the catalog (assist / agent policy is applied at engine runtime).\n */\n async listModels(_request?: AXPAiChatModelListRequest): Promise<AXPAiChatModelListItem[]> {\n const queryResult = await this.modelData.query({\n skip: 0,\n take: 500,\n });\n const items = (queryResult?.items ?? []) as CatalogModelRow[];\n let rows = items.filter((x) => isChatPurposeModelRow(x as unknown as Record<string, unknown>));\n\n rows = await this.filterModelsActiveForChat(rows);\n\n return rows.map((x) => ({\n id: x.id,\n name: x.name?.trim() ?? '',\n title:\n resolveMultiLanguageString((x.title ?? x.name ?? x.id) as AXPMultiLanguageString, this.localeId).trim() || x.id,\n modelPurposes: readModelPurposes(x as unknown as Record<string, unknown>),\n chatTransport: x.chatTransport,\n maxContextTokens:\n typeof x.maxContextTokens === 'number' && x.maxContextTokens > 0\n ? x.maxContextTokens\n : undefined,\n inputPricePerMillion:\n typeof x.inputPricePerMillion === 'number' && x.inputPricePerMillion > 0\n ? x.inputPricePerMillion\n : undefined,\n outputPricePerMillion:\n typeof x.outputPricePerMillion === 'number' && x.outputPricePerMillion > 0\n ? x.outputPricePerMillion\n : undefined,\n cachedInputPricePerMillion:\n typeof x.cachedInputPricePerMillion === 'number' && x.cachedInputPricePerMillion > 0\n ? x.cachedInputPricePerMillion\n : undefined,\n }));\n }\n\n //#endregion\n\n //#region ---- Model filtering ----\n\n /**\n * Chat pickers only use enabled models. Endpoint disabled state is denormalized on the\n * model (`openAiEndpointIsDisabled`) so tenants never need OpenAI endpoint entity reads.\n */\n private async filterModelsActiveForChat(rows: CatalogModelRow[]): Promise<CatalogModelRow[]> {\n return rows.filter((x) => {\n if (x.isDisabled === true) {\n return false;\n }\n if (x.openAiEndpointIsDisabled === true) {\n return false;\n }\n return true;\n });\n }\n\n //#endregion\n}\n","//#region ---- Imports ----\n\nimport { Injectable } from '@angular/core';\nimport type { AXPAiChatModelListItem } from '../engine/ai-engine.types';\n\n//#endregion\n\n//#region ---- Service ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXPAiDefaultModelPickerService {\n //#region ---- Public API ----\n\n /**\n * Picks a model from chat/vision catalog candidates.\n * Prefers {@link preferredModelId} when it supports the purpose; otherwise the first\n * purpose-capable entry; otherwise the first candidate.\n */\n pickFromChatCatalogForPurpose(\n models: AXPAiChatModelListItem[],\n purpose: 'chat' | 'vision',\n preferredModelId?: string | null,\n ): AXPAiChatModelListItem | undefined {\n if (!models.length) {\n return undefined;\n }\n const preferredId = preferredModelId?.trim();\n if (preferredId) {\n const preferred = models.find((m) => m.id === preferredId);\n if (preferred && modelItemSupportsChatCatalogPurpose(preferred, purpose)) {\n return preferred;\n }\n }\n const byPurpose = models.find((m) => modelItemSupportsChatCatalogPurpose(m, purpose));\n if (byPurpose) {\n return byPurpose;\n }\n return models[0];\n }\n\n //#endregion\n}\n\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction modelItemSupportsChatCatalogPurpose(m: AXPAiChatModelListItem, purpose: 'chat' | 'vision'): boolean {\n const p = m.modelPurposes?.length ? m.modelPurposes : [];\n if (purpose === 'vision') {\n return p.includes('vision');\n }\n return p.includes('chat');\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["W"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAQA;AAEA;AAEA;;;AAGG;MACU,wCAAwC,CAAA;IACnD,MAAM,OAAO,CAAC,OAA4C,EAAA;QACxD,MAAM,IAAI,GAAG,eAAe;AAC5B,QAAA,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,aAAa,EAAE;YAC3D,KAAK,EAAE,CAAA,CAAA,EAAI,IAAI,CAAA,8BAAA,CAAgC;YAC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