@acorex/connectivity 21.0.0-next.71 → 21.0.0-next.72

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.
Files changed (17) hide show
  1. package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-Wofp2dW8.mjs → acorex-connectivity-mock-acorex-connectivity-mock-ChTgoKCp.mjs} +3267 -1737
  2. package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-ChTgoKCp.mjs.map +1 -0
  3. package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-C18ksdYp.mjs → acorex-connectivity-mock-assign-to-manager.activity-7uIojNj1.mjs} +2 -2
  4. package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-C18ksdYp.mjs.map → acorex-connectivity-mock-assign-to-manager.activity-7uIojNj1.mjs.map} +1 -1
  5. package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-B4aTFrkL.mjs → acorex-connectivity-mock-chat-generate-image.command-B5cbkpr0.mjs} +2 -2
  6. package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-B4aTFrkL.mjs.map → acorex-connectivity-mock-chat-generate-image.command-B5cbkpr0.mjs.map} +1 -1
  7. package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-WgAOpZ71.mjs → acorex-connectivity-mock-chat-synthesize-speech.command-rqgbcQxF.mjs} +17 -32
  8. package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-rqgbcQxF.mjs.map +1 -0
  9. package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-BzqFA5rc.mjs → acorex-connectivity-mock-chat-transcribe-speech.command-DMKreUYD.mjs} +2 -2
  10. package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-BzqFA5rc.mjs.map → acorex-connectivity-mock-chat-transcribe-speech.command-DMKreUYD.mjs.map} +1 -1
  11. package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-DkMa4-Ju.mjs → acorex-connectivity-mock-user-roles-for-list-column.query-CoH1CYkf.mjs} +2 -2
  12. package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-DkMa4-Ju.mjs.map → acorex-connectivity-mock-user-roles-for-list-column.query-CoH1CYkf.mjs.map} +1 -1
  13. package/fesm2022/acorex-connectivity-mock.mjs +1 -1
  14. package/package.json +2 -2
  15. package/types/acorex-connectivity-mock.d.ts +80 -156
  16. package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-Wofp2dW8.mjs.map +0 -1
  17. package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-WgAOpZ71.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-connectivity-mock-chat-synthesize-speech.command-WgAOpZ71.mjs","sources":["../../../../libs/connectivity/mock/src/lib/ai-management/commands/chat-synthesize-speech.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n AI_CHAT_GENERATED_SPEECH_REF_TYPE,\n AXPAiChatToolRunContextService,\n modelRowHasPurpose,\n persistAiGeneratedSpeech,\n RootConfig,\n} from '@acorex/modules/ai-management';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPFileStorageService } from '@acorex/platform/common';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\n\nimport type { AXMAiAssistRow, AXMAiModelRow } from '../ai-agent-engine.types';\nimport {\n resolveDelegatedAssistOptionString,\n} from '../ai-delegated-agent-parameters.util';\nimport { AXCAiChatRouterService } from '../chat/ai-chat-router.service';\nimport { AXMAiModelStableIds } from '../model/model.mock';\n\n//#endregion\n\n//#region ---- Command: AiManagement:ChatSynthesizeSpeech ----\n\nexport interface AiManagementChatSynthesizeSpeechInput {\n /**\n * Catalog `AiModel` row id (tts purpose). Supplied on the command invocation or via\n * agent `commandIds[].command.options.model` defaults merged before execute.\n */\n model?: string;\n text?: string;\n voice?: string;\n responseFormat?: string;\n}\n\nfunction extForMime(mime: string): string {\n const m = mime.toLowerCase();\n if (m.includes('mpeg') || m.includes('mp3')) {\n return 'mp3';\n }\n if (m.includes('wav')) {\n return 'wav';\n }\n if (m.includes('opus')) {\n return 'opus';\n }\n if (m.includes('ogg')) {\n return 'ogg';\n }\n if (m.includes('aac')) {\n return 'aac';\n }\n if (m.includes('flac')) {\n return 'flac';\n }\n return 'bin';\n}\n\nfunction parseSynthesizeInput(args: unknown):\n | { ok: true; model?: string; text: string; voice?: string; responseFormat?: string }\n | { ok: false; error: string } {\n const obj =\n args != null && typeof args === 'object' && !Array.isArray(args)\n ? (args as Record<string, unknown>)\n : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const text = typeof obj['text'] === 'string' ? obj['text'].trim() : '';\n if (!text) {\n return { ok: false, error: 'Invalid arguments: \"text\" is required and must be non-empty.' };\n }\n const model = typeof obj['model'] === 'string' ? obj['model'].trim() : undefined;\n const voice = typeof obj['voice'] === 'string' ? obj['voice'].trim() : undefined;\n const responseFormat =\n typeof obj['responseFormat'] === 'string' ? obj['responseFormat'].trim() : undefined;\n return {\n ok: true,\n text,\n ...(model ? { model } : {}),\n ...(voice ? { voice } : {}),\n ...(responseFormat ? { responseFormat } : {}),\n };\n}\n\n@Injectable()\nexport class AiManagementChatSynthesizeSpeechCommand\n implements\n AXPCommand<\n AiManagementChatSynthesizeSpeechInput,\n { fileId?: string; text: string }\n >\n{\n private readonly aiChatRouter = inject(AXCAiChatRouterService);\n private readonly runContext = inject(AXPAiChatToolRunContextService);\n private readonly fileStorage = inject(AXPFileStorageService);\n private readonly entityService = inject(AXPEntityService);\n\n private readonly modelData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.model.name)\n .data<string, AXMAiModelRow, AXMAiModelRow, AXMAiModelRow, AXMAiModelRow>();\n\n private readonly assistData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\n\n /**\n * Resolves the TTS catalog row from the command `model` input only (invalid ids are ignored).\n */\n private async resolveTtsModelEntityId(explicitModel: string | undefined): Promise<string> {\n const candidates = [\n explicitModel?.trim(),\n AXMAiModelStableIds.openrouterGrokVoiceTts10,\n ].filter((id): id is string => Boolean(id?.trim()));\n\n for (const candidate of candidates) {\n const row = await this.modelData.byKey(candidate);\n if (row && modelRowHasPurpose(row as unknown as Record<string, unknown>, 'tts')) {\n return candidate;\n }\n }\n\n return AXMAiModelStableIds.openrouterGrokVoiceTts10;\n }\n\n async execute(\n input: AiManagementChatSynthesizeSpeechInput,\n ): Promise<AXPExecuteCommandResult<{ fileId?: string; text: string }>> {\n const ctx = this.runContext.getContext();\n if (!ctx?.assistId?.trim()) {\n return {\n success: false,\n message: {\n text: 'Text-to-speech requires an active AI chat run context (assist id).',\n },\n };\n }\n\n const parsed = parseSynthesizeInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n\n try {\n const modelEntityId = await this.resolveTtsModelEntityId(parsed.model);\n\n const assist = await this.assistData.byKey(ctx.assistId.trim());\n const voiceFromAssist =\n assist ? resolveDelegatedAssistOptionString(assist, ctx.agentId, 'voice') || undefined : undefined;\n const voice = parsed.voice?.trim() || voiceFromAssist || 'alloy';\n\n const { audioBytes, mimeType } = await this.aiChatRouter.synthesizeSpeech({\n modelEntityId,\n text: parsed.text,\n voice,\n ...(parsed.responseFormat?.trim() ? { responseFormat: parsed.responseFormat.trim() } : {}),\n });\n\n const mt = mimeType?.trim() || 'application/octet-stream';\n const ext = extForMime(mt);\n const fileName = `ai-tts.${ext}`;\n const file = new File([audioBytes], fileName, { type: mt });\n\n try {\n const { fileId } = await persistAiGeneratedSpeech(this.fileStorage, file, {\n refId: ctx.assistId.trim(),\n refType: AI_CHAT_GENERATED_SPEECH_REF_TYPE,\n });\n return { success: true, data: { fileId, text: parsed.text } };\n } catch (persistErr) {\n const pmsg = persistErr instanceof Error ? persistErr.message : String(persistErr);\n throw new Error(`Could not store synthesized speech for chat replay. ${pmsg}`);\n }\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { success: false, message: { text: msg } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAqCA,SAAS,UAAU,CAAC,IAAY,EAAA;AAC9B,IAAA,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE;AAC5B,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC3C,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACtB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACtB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,OAAO,KAAK;AACd;AAEA,SAAS,oBAAoB,CAAC,IAAa,EAAA;AAGzC,IAAA,MAAM,GAAG,GACP,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;AAC7D,UAAG;UACD,IAAI;IACV,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wCAAwC,EAAE;IACvE;IACA,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,GAAG,CA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