@c8y/ngx-components 1024.20.8 → 1024.21.3

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 (127) hide show
  1. package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs +527 -12
  2. package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs.map +1 -1
  3. package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs +31 -9
  4. package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs.map +1 -1
  5. package/fesm2022/c8y-ngx-components-ai.mjs +503 -62
  6. package/fesm2022/c8y-ngx-components-ai.mjs.map +1 -1
  7. package/fesm2022/c8y-ngx-components-alarm-event-selector.mjs +2 -2
  8. package/fesm2022/c8y-ngx-components-alarm-event-selector.mjs.map +1 -1
  9. package/fesm2022/c8y-ngx-components-alarms.mjs +3 -3
  10. package/fesm2022/c8y-ngx-components-alarms.mjs.map +1 -1
  11. package/fesm2022/c8y-ngx-components-application-access-list.mjs +1 -1
  12. package/fesm2022/c8y-ngx-components-application-access-list.mjs.map +1 -1
  13. package/fesm2022/c8y-ngx-components-auth-configuration.mjs +1 -1
  14. package/fesm2022/c8y-ngx-components-auth-configuration.mjs.map +1 -1
  15. package/fesm2022/c8y-ngx-components-bookmarks.mjs +1 -1
  16. package/fesm2022/c8y-ngx-components-bookmarks.mjs.map +1 -1
  17. package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs +1 -1
  18. package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs.map +1 -1
  19. package/fesm2022/c8y-ngx-components-cockpit-config.mjs +5 -5
  20. package/fesm2022/c8y-ngx-components-cockpit-config.mjs.map +1 -1
  21. package/fesm2022/{c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs → c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs} +2 -2
  22. package/fesm2022/{c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs.map → c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs.map} +1 -1
  23. package/fesm2022/c8y-ngx-components-context-dashboard.mjs +3 -3
  24. package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
  25. package/fesm2022/{c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-UEUYsXBv.mjs → c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-CRvgIgri.mjs} +2 -2
  26. package/fesm2022/{c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-UEUYsXBv.mjs.map → c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-CRvgIgri.mjs.map} +1 -1
  27. package/fesm2022/c8y-ngx-components-dashboard-details-advanced-tab.mjs +2 -2
  28. package/fesm2022/c8y-ngx-components-dashboard-manager.mjs +1 -1
  29. package/fesm2022/c8y-ngx-components-dashboard-manager.mjs.map +1 -1
  30. package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs +3 -3
  31. package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs.map +1 -1
  32. package/fesm2022/c8y-ngx-components-datapoint-selector.mjs +2 -2
  33. package/fesm2022/c8y-ngx-components-datapoint-selector.mjs.map +1 -1
  34. package/fesm2022/c8y-ngx-components-device-profile.mjs +2 -2
  35. package/fesm2022/c8y-ngx-components-device-profile.mjs.map +1 -1
  36. package/fesm2022/c8y-ngx-components-diagnostics.mjs +1 -1
  37. package/fesm2022/c8y-ngx-components-diagnostics.mjs.map +1 -1
  38. package/fesm2022/c8y-ngx-components-echart.mjs +101 -45
  39. package/fesm2022/c8y-ngx-components-echart.mjs.map +1 -1
  40. package/fesm2022/c8y-ngx-components-ecosystem-application-plugins.mjs +2 -2
  41. package/fesm2022/c8y-ngx-components-ecosystem-application-plugins.mjs.map +1 -1
  42. package/fesm2022/c8y-ngx-components-ecosystem-shared.mjs +1 -1
  43. package/fesm2022/c8y-ngx-components-ecosystem-shared.mjs.map +1 -1
  44. package/fesm2022/c8y-ngx-components-ecosystem.mjs +4 -4
  45. package/fesm2022/c8y-ngx-components-ecosystem.mjs.map +1 -1
  46. package/fesm2022/c8y-ngx-components-events-events-timeline.mjs +1 -1
  47. package/fesm2022/c8y-ngx-components-events-events-timeline.mjs.map +1 -1
  48. package/fesm2022/c8y-ngx-components-events.mjs +2 -2
  49. package/fesm2022/c8y-ngx-components-events.mjs.map +1 -1
  50. package/fesm2022/c8y-ngx-components-icon-selector.mjs +1 -1
  51. package/fesm2022/c8y-ngx-components-icon-selector.mjs.map +1 -1
  52. package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs +1 -1
  53. package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs.map +1 -1
  54. package/fesm2022/c8y-ngx-components-operations-operations-list.mjs +1 -1
  55. package/fesm2022/c8y-ngx-components-operations-operations-list.mjs.map +1 -1
  56. package/fesm2022/c8y-ngx-components-operations-operations-timeline.mjs +1 -1
  57. package/fesm2022/c8y-ngx-components-operations-operations-timeline.mjs.map +1 -1
  58. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-configuration.mjs +1 -1
  59. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-configuration.mjs.map +1 -1
  60. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-device-profile.mjs +2 -2
  61. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-device-profile.mjs.map +1 -1
  62. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-firmware.mjs +2 -2
  63. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-firmware.mjs.map +1 -1
  64. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-software.mjs +2 -2
  65. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-software.mjs.map +1 -1
  66. package/fesm2022/c8y-ngx-components-protocol-lpwan.mjs +5 -5
  67. package/fesm2022/c8y-ngx-components-protocol-lpwan.mjs.map +1 -1
  68. package/fesm2022/c8y-ngx-components-protocol-opcua.mjs +1 -1
  69. package/fesm2022/c8y-ngx-components-protocol-opcua.mjs.map +1 -1
  70. package/fesm2022/c8y-ngx-components-register-device.mjs +3 -3
  71. package/fesm2022/c8y-ngx-components-register-device.mjs.map +1 -1
  72. package/fesm2022/c8y-ngx-components-remote-access-configurations.mjs +1 -1
  73. package/fesm2022/c8y-ngx-components-remote-access-configurations.mjs.map +1 -1
  74. package/fesm2022/c8y-ngx-components-replace-device-replace-device-wizard.mjs +1 -1
  75. package/fesm2022/c8y-ngx-components-replace-device-replace-device-wizard.mjs.map +1 -1
  76. package/fesm2022/c8y-ngx-components-report-dashboard.mjs +1 -1
  77. package/fesm2022/c8y-ngx-components-report-dashboard.mjs.map +1 -1
  78. package/fesm2022/c8y-ngx-components-repository-configuration.mjs +1 -1
  79. package/fesm2022/c8y-ngx-components-repository-configuration.mjs.map +1 -1
  80. package/fesm2022/c8y-ngx-components-repository-firmware.mjs +4 -4
  81. package/fesm2022/c8y-ngx-components-repository-firmware.mjs.map +1 -1
  82. package/fesm2022/c8y-ngx-components-repository-shared.mjs +2 -2
  83. package/fesm2022/c8y-ngx-components-repository-shared.mjs.map +1 -1
  84. package/fesm2022/c8y-ngx-components-repository-software.mjs +3 -3
  85. package/fesm2022/c8y-ngx-components-repository-software.mjs.map +1 -1
  86. package/fesm2022/c8y-ngx-components-static-assets-modal.mjs +1 -1
  87. package/fesm2022/c8y-ngx-components-static-assets-modal.mjs.map +1 -1
  88. package/fesm2022/c8y-ngx-components-tracking.mjs +1 -1
  89. package/fesm2022/c8y-ngx-components-tracking.mjs.map +1 -1
  90. package/fesm2022/c8y-ngx-components-trusted-certificates.mjs +1 -1
  91. package/fesm2022/c8y-ngx-components-trusted-certificates.mjs.map +1 -1
  92. package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs +1 -1
  93. package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs.map +1 -1
  94. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-list.mjs +2 -2
  95. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-list.mjs.map +1 -1
  96. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-table.mjs +1 -1
  97. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-table.mjs.map +1 -1
  98. package/fesm2022/c8y-ngx-components-widgets-implementations-image.mjs +1 -1
  99. package/fesm2022/c8y-ngx-components-widgets-implementations-image.mjs.map +1 -1
  100. package/fesm2022/c8y-ngx-components-widgets-implementations-quick-links.mjs +1 -1
  101. package/fesm2022/c8y-ngx-components-widgets-implementations-quick-links.mjs.map +1 -1
  102. package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs +1 -1
  103. package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs.map +1 -1
  104. package/fesm2022/c8y-ngx-components.mjs +306 -22
  105. package/fesm2022/c8y-ngx-components.mjs.map +1 -1
  106. package/locales/de.po +72 -0
  107. package/locales/es.po +72 -0
  108. package/locales/fr.po +72 -0
  109. package/locales/ja_JP.po +72 -0
  110. package/locales/ko.po +72 -0
  111. package/locales/locales.pot +72 -3
  112. package/locales/nl.po +72 -0
  113. package/locales/pl.po +73 -1
  114. package/locales/pt_BR.po +72 -0
  115. package/locales/zh_CN.po +72 -0
  116. package/locales/zh_TW.po +72 -0
  117. package/package.json +1 -1
  118. package/types/c8y-ngx-components-ai-agent-chat.d.ts +201 -3
  119. package/types/c8y-ngx-components-ai-agent-chat.d.ts.map +1 -1
  120. package/types/c8y-ngx-components-ai-ai-chat.d.ts +14 -4
  121. package/types/c8y-ngx-components-ai-ai-chat.d.ts.map +1 -1
  122. package/types/c8y-ngx-components-ai.d.ts +157 -2
  123. package/types/c8y-ngx-components-ai.d.ts.map +1 -1
  124. package/types/c8y-ngx-components-echart.d.ts +6 -0
  125. package/types/c8y-ngx-components-echart.d.ts.map +1 -1
  126. package/types/c8y-ngx-components.d.ts +170 -9
  127. package/types/c8y-ngx-components.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"c8y-ngx-components-ai.mjs","sources":["../../ai/ai.service.ts","../../ai/ai-tool-approval-memory.service.ts","../../ai/cumulocity-api-request-label.ts","../../ai/c8y-ngx-components-ai.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { FetchClient } from '@c8y/client';\nimport { Observable, Subscriber } from 'rxjs';\nimport {\n AgentDefinition,\n AgentHealthCheckResponse,\n AIAssistantMessage,\n AIMessage,\n AIMessagePart,\n AIStreamResponse,\n ClientAgentDefinition,\n ObjectAgentResponse,\n ToolCallPart\n} from './ai.model';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\n// Internal implementation detail; maybe we don't even need this enum since\nexport enum DataStreamType {\n TEXT_DELTA = 'text-delta',\n TOOL_CALL = 'tool-call',\n TOOL_INPUT_START = 'tool-input-start',\n TOOL_INPUT_DELTA = 'tool-input-delta',\n TOOL_CALL_STREAMING = 'tool-call-streaming',\n TOOL_CALL_DELTA = 'tool-call-delta',\n TOOL_RESULT = 'tool-result',\n TOOL_APPROVAL_REQUEST = 'tool-approval-request',\n REASONING = 'reasoning',\n REASONING_DELTA = 'reasoning-delta',\n REDACTED_REASONING = 'redacted-reasoning',\n REASONING_SIGNATURE = 'reasoning-signature',\n FINISH_REASONING = 'finish-reasoning',\n FINISH = 'finish',\n ERROR = 'error',\n DATA = 'data',\n MESSAGE_ANNOTATIONS = 'message-annotations',\n SOURCE = 'source',\n FILE = 'file',\n STEP_START = 'start-step',\n STEP_FINISH = 'finish-step'\n}\n\n/** This service manages communication with the AI Agent Manager microservice, supporting\n * management of agents, and sending requests to the agents.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class AIService {\n private baseUrl = '/service/ai';\n private client: FetchClient;\n\n // nb: allowing the client to be passed in the constructor allows efficient unit testing without setting up the Angular TestBed\n constructor(client?: FetchClient) {\n this.client = client ?? inject(FetchClient);\n }\n\n /**\n * Creates or updates an agent.\n * @param def The agent definition\n */\n async createOrUpdateAgent(def: AgentDefinition): Promise<void> {\n const health = await this.getAgentHealth(def.name);\n let resource = `${this.baseUrl}/agent/${def.type}`;\n let method = 'POST';\n if (health.exists) {\n resource = `${this.baseUrl}/agent/${def.type}/${def.name}`;\n method = 'PUT';\n }\n const response = await this.client.fetch(resource, {\n body: JSON.stringify(def),\n method,\n headers: { 'Content-Type': 'application/json' }\n });\n\n if (!response.ok) {\n const detail = await response.text().catch(() => '');\n throw new Error(\n `Failed to create agent: ${response.statusText}${detail ? ` - ${detail}` : ''}`\n );\n }\n }\n\n /**\n * Check if an agent exists and is ready for use.\n * @param name Agent name (optional)\n * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional).\n * @returns Agent health check response.\n */\n async getAgentHealth(name = '', fromApp?: string): Promise<AgentHealthCheckResponse> {\n const response = await this.client.fetch(\n `${this.baseUrl}/agent/test/${name || crypto.randomUUID()}${fromApp ? `?fromApp=${fromApp}` : ''}`,\n {\n method: 'GET',\n headers: { 'Content-Type': 'application/json' }\n }\n );\n\n if (!response.ok) {\n return {\n status: response.status === 403 ? 'missing-permissions' : 'missing-microservice',\n exists: false,\n canCreate: false,\n isProviderConfigured: false,\n messages: response.status === 403 ? [] : [response.statusText]\n };\n }\n const json: AgentHealthCheckResponse = await response.json();\n if (!json.isProviderConfigured) {\n json.status = 'missing-provider';\n } else if (!json.exists) {\n json.status = 'missing-agent';\n } else {\n json.status = 'ready';\n }\n return json;\n }\n\n /**\n * Send a text message to the agent.\n * @param name Agent name\n * @param messages The message to send, including any previous message history.\n * Typically you should use `defaultPruneMessagesForAgent` or a custom function to prepare the message history\n * by removing unnecessary content such as large/old tool inputs/outputs.\n * @param variables Variables to include\n * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional).\n * @returns Text response from the agent.\n */\n async text(\n name: string,\n messages: AIMessage[],\n variables: Record<string, unknown>,\n fromApp?: string\n ): Promise<string> {\n const parsedMessages = this.convertToAgentMessageFormat(messages);\n\n const data = this.client.fetch(\n `${this.baseUrl}/agent/text/${name}${fromApp ? `?fromApp=${fromApp}` : ''}`,\n {\n body: JSON.stringify({ messages: parsedMessages, variables }),\n method: 'POST',\n headers: { 'Content-Type': 'application/json' }\n }\n );\n\n const response = await data;\n if (!response.ok) {\n throw new Error(`Failed to talk with agent: ${response.statusText}`);\n }\n const text = await response.text();\n return text;\n }\n\n /**\n * Send messages to an object-type agent via the non-streaming test endpoint.\n * Object agents return a single structured JSON response rather than a stream.\n *\n * @param agent A ClientAgentDefinition with `snapshot: true` (required for test endpoint).\n * @param messages Messages to send\n * @param variables Variables to include\n * @param abortController An AbortController to cancel the request.\n * @returns The full response including the structured object and usage information.\n */\n async callObjectAgent(\n agent: string | ClientAgentDefinition,\n messages: AIMessage[],\n variables: Record<string, unknown>,\n abortController: AbortController\n ): Promise<ObjectAgentResponse> {\n const parsedMessages = this.convertToAgentMessageFormat(messages);\n const agentName = typeof agent === 'string' ? agent : agent.definition.name;\n const useTest = typeof agent !== 'string' && agent.snapshot;\n const baseUrl = useTest\n ? `${this.baseUrl}/agent/test/${typeof agent !== 'string' ? agent.definition.type : 'object'}`\n : `${this.baseUrl}/agent/${typeof agent !== 'string' ? agent.definition.type : 'object'}/${agentName}`;\n let body = JSON.stringify({ messages: parsedMessages, variables });\n if (useTest) {\n const agentCopy = {\n ...(agent as ClientAgentDefinition).definition\n };\n agentCopy.agent.messages = parsedMessages;\n agentCopy.agent.variables = variables;\n body = JSON.stringify(agentCopy);\n }\n\n const response = await this.client.fetch(`${baseUrl}?fullResponse=true`, {\n method: 'POST',\n body,\n headers: {\n ...this.client.defaultHeaders,\n 'content-type': 'application/json'\n },\n signal: abortController.signal\n });\n\n if (response.status > 300) {\n const data = await response.json();\n throw new Error(JSON.stringify(data, null, 2));\n }\n\n const data = await response.json();\n\n if (!('object' in data)) {\n throw new Error('Invalid response: missing required \"object\" field');\n }\n\n if (typeof data.object !== 'object' || data.object === null) {\n throw new Error('Invalid response: \"object\" field must be an object');\n }\n\n // Validate optional totalUsage field if present\n if (data.totalUsage !== undefined) {\n if (typeof data.totalUsage !== 'object' || data.totalUsage === null) {\n throw new Error('Invalid response: \"totalUsage\" must be an object');\n }\n }\n\n return data;\n }\n\n /**\n * Stream a text message to the agent.\n * @param agent Agent name or an agent definition.\n * @param messages The message to send, including any previous message history.\n * Typically you should use `defaultPruneMessagesForAgent` or a custom function to prepare the message history\n * by removing unnecessary content such as large/old tool inputs/outputs.\n * @param variables Variables to include\n * @param abortController An AbortController to cancel the request.\n * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional).\n * @returns An observable that emits AIStreamResponse including partial `AIMessage` objects as they are received.\n * When additional useful metadata is available, this will be streamed with type indicating it is metadata.\n * The observable can be cancelled using the provided AbortController.\n * The observable will emit an error if the request fails or is aborted.\n * The observable will complete when the stream is finished.\n *\n * The messages sent to the agent can include special options:\n * - `hiddenContent`: If set, this content will be sent to the agent instead of the `content` field.\n * - `skipToLLM`: If set to true, this message will be skipped when sending to the agent.\n *\n * Example usage:\n * ```typescript\n * const abortController = new AbortController();\n * const messages: AIMessage[] = [\n * { role: 'user', content: 'Hello' },\n * { role: 'assistant', content: 'Hi there!' },\n * { role: 'user', content: 'Tell me a joke.', options: { hiddenContent: 'Tell me a joke about cats.' } }\n * ];\n * const observable = aiService.stream$('my-agent', messages, {}, abortController);\n * const subscription = observable.subscribe({\n * next: (response) => { console.log('Received message update:', response.message); },\n * error: (err) => console.error('Error:', err),\n * complete: () => console.log('Stream complete')\n * });\n *\n * // To cancel the request:\n * abortController.abort();\n * subscription.unsubscribe();\n * ```\n */\n async stream$(\n agent: string | ClientAgentDefinition,\n messages: AIMessage[],\n variables: { [key: string]: any },\n abortController: AbortController,\n fromApp?: string\n ): Promise<Observable<AIStreamResponse>> {\n const parsedMessages = this.convertToAgentMessageFormat(messages);\n\n const agentName = typeof agent === 'string' ? agent : agent.definition.name;\n const useTest = typeof agent !== 'string' && agent.snapshot;\n const baseUrl = useTest\n ? `${this.baseUrl}/agent/test/text`\n : `${this.baseUrl}/agent/text/${agentName}`;\n let body = JSON.stringify({ messages: parsedMessages, variables });\n if (useTest) {\n const agentCopy = {\n ...agent.definition\n };\n agentCopy.agent['messages'] = parsedMessages;\n agentCopy.agent['variables'] = variables;\n body = JSON.stringify(agentCopy);\n }\n\n const response = await this.client.fetch(\n `${baseUrl}?fullResponse=true${fromApp ? `&fromApp=${fromApp}` : ''}`,\n {\n method: 'POST',\n body,\n headers: {\n ...this.client.defaultHeaders,\n 'content-type': 'application/json',\n accept: 'text/event-stream'\n },\n signal: abortController.signal\n }\n );\n\n const stream = response.body;\n const decoder = new TextDecoder();\n\n return new Observable<AIStreamResponse>(observer => {\n if (response.status > 300) {\n response\n .json()\n .then(data => {\n observer.error(`Error communicating with server: ${JSON.stringify(data, null, 2)}`);\n })\n .catch(err => {\n observer.error(\n `Error communicating with server: HTTP ${response.status}: ${response.statusText}; ${err}`\n );\n });\n return;\n }\n\n if (!stream) {\n observer.error('Server error - no response body');\n return;\n }\n\n const reader = stream.getReader();\n const message: AIAssistantMessage = {\n role: 'assistant',\n content: []\n };\n\n const abortHandler = (e: Event) => {\n const reason = (e?.target as AbortSignal)?.reason || gettext('Aborted');\n reader.cancel();\n observer.error(new DOMException(reason, 'AbortError'));\n };\n\n abortController.signal.addEventListener('abort', abortHandler);\n\n let buffer = '';\n\n const read = () => {\n reader.read().then(({ done, value }) => {\n if (done) {\n if (buffer.trim()) this.processLine(buffer, observer, message); // process any remaining data\n observer.complete();\n return;\n }\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n\\n');\n buffer = lines.pop() || '';\n for (const line of lines) {\n if (line.trim()) this.processLine(line, observer, message);\n }\n read();\n });\n };\n\n read();\n return () => {\n abortController.signal.removeEventListener('abort', abortHandler);\n reader.cancel();\n };\n });\n }\n\n protected convertToAgentMessageFormat(messages: AIMessage[]): object[] {\n // We will need to rewrite this to include tool outputs soon (effectively this means targetting LanguageModelV*ToolResultOutput).\n // Once we have more fields than just role and content, we will need to convert between our format and\n // the Vercel format expected by the agent manager (e.g. steps->content parts)\n\n // The result of an approved tool call streams in with the NEXT assistant message after the\n // resume, but on the wire it must sit next to its approval exchange (the agent strips\n // approval parts from the model prompt, so an exchange without a result leaves a dangling\n // tool call the model provider rejects). Index all results up front so\n // convertAssistantMessageWithApprovals can pull them into the right message.\n const resultsByToolCallId = new Map<string, ToolCallPart>();\n for (const m of messages) {\n if (m.role !== 'assistant') continue;\n for (const part of m.content) {\n if (part.type === 'tool-result') {\n resultsByToolCallId.set(part.toolCallId, part);\n }\n }\n }\n const serializedToolCallIds = new Set<string>();\n\n return messages.flatMap(m => {\n if (m.role !== 'assistant') {\n return [\n {\n role: m.role,\n content: m.content\n }\n ];\n }\n\n // For assistant messages, check if there's an object part\n const objectPart = m.content.find(\n (part): part is { type: 'object'; jsonContent: string } => part.type === 'object'\n );\n\n if (objectPart) {\n // If there's an object part, parse and send the JSON object as content\n return [\n {\n role: m.role,\n content: objectPart.jsonContent\n }\n ];\n }\n\n // Messages containing tool approvals must round-trip with full fidelity so the agent\n // can match the user's decision to the pending tool call.\n if (\n m.content.some(\n part => part.type === 'tool-approval-requested' || part.type === 'tool-approval-responded'\n )\n ) {\n return this.convertAssistantMessageWithApprovals(\n m,\n resultsByToolCallId,\n serializedToolCallIds\n );\n }\n\n // Otherwise, send text parts as joined string\n return [\n {\n role: m.role,\n content: m.content\n .filter((part): part is { type: 'text'; text: string } => part.type === 'text')\n .map(part => part.text)\n .join('\\n\\n')\n }\n ];\n });\n }\n\n /**\n * Converts an assistant message containing tool approval parts into the wire format expected by\n * the agent: an assistant message carrying `tool-call` and `tool-approval-request` parts, followed\n * (once the user has decided) by a `tool` role message carrying the matching `tool-approval-response`\n * parts.\n *\n * The agent strips approval parts from the prompt it sends to the model provider, so a *resolved*\n * exchange must also carry the call's outcome in its tool message: the executed result (found via\n * `resultsByToolCallId`, since it streams in with the following assistant message) or an\n * `execution-denied` marker. Each such result is serialized exactly once - `serializedToolCallIds`\n * tracks consumed calls so the copy stored in the following message is not emitted again as a\n * duplicate tool call.\n */\n private convertAssistantMessageWithApprovals(\n m: AIAssistantMessage,\n resultsByToolCallId: Map<string, ToolCallPart>,\n serializedToolCallIds: Set<string>\n ): object[] {\n const assistantContent: object[] = [];\n const toolContent: object[] = [];\n\n for (const part of m.content) {\n switch (part.type) {\n case 'text':\n assistantContent.push({ type: 'text', text: part.text });\n break;\n\n case 'tool-approval-requested':\n case 'tool-approval-responded':\n if (!part.approval) break;\n assistantContent.push({\n type: 'tool-call',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input ?? {}\n });\n assistantContent.push({\n type: 'tool-approval-request',\n approvalId: part.approval.approvalId,\n toolCallId: part.toolCallId\n });\n if (part.approval.approved !== undefined) {\n toolContent.push({\n type: 'tool-approval-response',\n approvalId: part.approval.approvalId,\n approved: part.approval.approved,\n ...(part.approval.reason ? { reason: part.approval.reason } : {})\n });\n if (!serializedToolCallIds.has(part.toolCallId)) {\n if (!part.approval.approved) {\n toolContent.push({\n type: 'tool-result',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n output: {\n type: 'execution-denied',\n ...(part.approval.reason ? { reason: part.approval.reason } : {})\n }\n });\n serializedToolCallIds.add(part.toolCallId);\n } else {\n const result = resultsByToolCallId.get(part.toolCallId);\n if (result) {\n toolContent.push({\n type: 'tool-result',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n output: this.convertToolResultOutputForAgent(result)\n });\n serializedToolCallIds.add(part.toolCallId);\n }\n // No result yet: this approval is the one triggering the resume,\n // and the agent executes the tool itself.\n }\n }\n }\n break;\n\n case 'tool-result':\n // Skip results already serialized next to their approval exchange in an earlier message\n if (serializedToolCallIds.has(part.toolCallId)) break;\n assistantContent.push({\n type: 'tool-call',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n input: part.input ?? {}\n });\n toolContent.push({\n type: 'tool-result',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n output: this.convertToolResultOutputForAgent(part)\n });\n break;\n\n default:\n // reasoning and step-start parts are not needed by the agent\n break;\n }\n }\n\n const result: object[] = [{ role: 'assistant', content: assistantContent }];\n if (toolContent.length > 0) {\n result.push({ role: 'tool', content: toolContent });\n }\n return result;\n }\n\n /** Converts a tool output stored in our format back to the LanguageModelV*ToolResultOutput wire format. */\n private convertToolResultOutputForAgent(part: ToolCallPart): { type: string; value: unknown } {\n if (part.outputType === 'content') {\n return { type: 'content', value: part.output };\n }\n if (part.error) {\n return typeof part.output === 'string'\n ? { type: 'error-text', value: part.output }\n : { type: 'error-json', value: part.output ?? null };\n }\n return typeof part.output === 'string'\n ? { type: 'text', value: part.output }\n : { type: 'json', value: part.output ?? null };\n }\n\n /**\n * Convert a tool output from the MCP/wire format (which is different/more compact than LanguageModelV3ToolResultOutput)\n * into our own standard representation, which can be roundtripped to the format we need to provide when making future requests.\n *\n * Handles different data types from Vercel's streaming API:\n * - Text: stored as simple string in output field\n * - JSON objects: stored as-is in output field\n * - Content arrays: stored in output field with outputType=\"content\" to enable roundtripping\n * - Single text in content array: unwrapped to simple string for simpler handling (and easier truncation)\n * - Errors: error flag set to true\n */\n protected convertStreamingToolOutputToToolCallPart(output: any, target: ToolCallPart) {\n if (!output) {\n return;\n }\n\n if (output.isError || output.type === 'error-text' || output.type === 'error-json')\n target.error = true;\n\n // Handle content array format from streaming API\n if (output.content && Array.isArray(output.content)) {\n // Single text element - unwrap to simple string for simplicity\n if (output.content.length === 1 && output.content[0].type === 'text') {\n target.output = output.content[0].text;\n return;\n }\n\n // Multiple elements or mixed types - preserve as content array\n target.output = output.content;\n target.outputType = 'content'; // Mark as content to enable roundtripping\n return;\n }\n\n // Plain string or structured (JSON-serializable) object - store as-is\n target.output = output;\n }\n\n /** Add the specified tool call info to the current step. If this toolCallId is already known,\n * updates it rather than adding a new one, since for UI rendering and compactness of data it's\n * easiest to just have one item per tool call.\n *\n * Returns the changed item.\n */\n private addToolCallInfo(\n type: ToolCallPart['type'],\n rawInfo: any,\n addTo: AIMessagePart[]\n ): ToolCallPart {\n // Vercel v4 seems to set this to \"id\" not \"toolCallId\" in some places despite doc to the contrary, so normalize it here\n if (!rawInfo.toolCallId) rawInfo.toolCallId = rawInfo.id;\n\n let existing: ToolCallPart | undefined = addTo.find(\n (tc): tc is ToolCallPart =>\n tc.type.startsWith('tool-') && (tc as ToolCallPart).toolCallId === rawInfo.toolCallId\n );\n\n if (existing) {\n existing.type = type;\n } else if (!existing) {\n existing = { type: type, toolName: rawInfo.toolName, toolCallId: rawInfo.toolCallId };\n addTo.push(existing);\n }\n if (rawInfo?.input) existing.input = rawInfo.input;\n if (rawInfo?.output) this.convertStreamingToolOutputToToolCallPart(rawInfo.output, existing);\n\n return existing;\n }\n\n /** Unpacks data from the Vercel Data Stream Protocol (sent by the Agent Manager over SSE) to update the message\n *\n * See streamText().fullStream() from https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol#data-stream-protocol\n *\n * This is similar to what the Vercel `toUIMessageStreamResponse` API does (though it'd need the agent manager to publish the\n * UIMessageStream which has a bit more - useful - data than what is included here).\n *\n * We always use the same parts object, to make it easier for consumers (eg. agent-chat)\n * to add items to the list and have them still there on the next update from this service.\n */\n private processLine(\n line: string,\n observer: Subscriber<AIStreamResponse>,\n message: AIAssistantMessage\n ) {\n if (!line.trim()) {\n return;\n }\n\n try {\n let data: any = {};\n let type = '';\n try {\n data = JSON.parse(line.replace('data: ', ''));\n type = data.type;\n } catch (e) {\n console.error('Error parsing line from AI response: ', line, e);\n return;\n }\n\n let lastPart = !message.content ? undefined : message.content[message.content.length - 1];\n\n switch (type) {\n case DataStreamType.STEP_START:\n // Don't add consecutive duplicate step bounaries\n if (!lastPart || lastPart.type !== 'step-start') {\n message.content.push({ type: 'step-start' });\n observer.next({ message, changedPart: message.content[message.content.length - 1] });\n }\n\n return;\n\n case DataStreamType.STEP_FINISH:\n // `response.modelId` is always present, unlike `start-step`'s raw `request.body`\n // which the agent manager only includes when explicitly configured to.\n if (data.response?.modelId) {\n observer.next({\n message,\n changedPart: { type: 'response-metadata', model: data.response.modelId }\n });\n }\n return;\n\n case DataStreamType.REASONING_DELTA:\n const reasoning = data.text;\n if (!reasoning) return;\n if (lastPart?.type === 'reasoning') {\n lastPart.text += reasoning;\n } else {\n lastPart = { type: 'reasoning', text: reasoning };\n message.content.push(lastPart);\n }\n observer.next({ message, changedPart: lastPart });\n return;\n\n case DataStreamType.TEXT_DELTA:\n const text = data.textDelta || data.text;\n if (!text) return;\n if (lastPart?.type === 'text') {\n lastPart.text += text;\n } else {\n lastPart = { type: 'text', text: text };\n message.content.push(lastPart);\n }\n observer.next({ message, changedPart: lastPart });\n return;\n\n case DataStreamType.TOOL_INPUT_START:\n observer.next({\n message,\n changedPart: this.addToolCallInfo('tool-input-streaming', data, message.content)\n });\n return;\n\n case DataStreamType.TOOL_CALL:\n observer.next({\n message,\n changedPart: this.addToolCallInfo('tool-executing', data, message.content)\n });\n return;\n\n case DataStreamType.TOOL_RESULT:\n observer.next({\n message,\n changedPart: this.addToolCallInfo('tool-result', data, message.content)\n });\n return;\n\n case DataStreamType.TOOL_APPROVAL_REQUEST: {\n // Emitted when a tool with `needsApproval` is called; the agent stops until the\n // conversation is resent with the user's decision (see convertAssistantMessageWithApprovals).\n const approvalPart = this.addToolCallInfo(\n 'tool-approval-requested',\n data.toolCall || data,\n message.content\n );\n approvalPart.approval = { approvalId: data.approvalId };\n observer.next({ message, changedPart: approvalPart });\n return;\n }\n\n case DataStreamType.FINISH:\n message.finishReason = data.finishReason; // FUTURE could be anything, may not match the options in AIMessage\n message.usage = data.totalUsage;\n observer.next({ message, changedPart: undefined });\n observer.complete();\n return;\n\n case DataStreamType.ERROR:\n message.finishReason = 'error';\n observer.next({ message, changedPart: undefined });\n observer.error(data?.message || data?.errorText || data);\n // Error is instead of completing the stream\n return;\n\n // Should we also handle other types such as \"abort\"?\n }\n } catch (e) {\n observer.error(e);\n }\n }\n}\n\n/**\n * The default implementation of for reducing the size of the message history so it is ready to be sent to the LLM agent.\n *\n * This is important since old tool inputs and outputs can be very large and fill up the agent's context window.\n *\n * Implements `pruneMessagesFunction`.\n *\n * When sending an AI request you can provide your own function instead of using this one,\n * or you can write your own function that calls this and adds extra logic,\n * for example to suppress specific tools from the AIMessage, or\n * retain only the final step text in multi-step responses, etc.\n *\n * The current default implementation preserves text content, but does not include any tool calls.\n * This may change in future releases.\n */\nexport function defaultPruneMessagesForAgent(messages: AIMessage[]): AIMessage[] {\n // When we change this to include tool calls, we should remove large inputs and truncate large and/or old outputs\n // to avoid too many tokens and context window consumption.\n // Some applications will want to entirely remove specific tool calls that have only transient use,\n // which can be done by providing their own pruneMessagesForAgent function.\n // Tool calls that went through an approval exchange must keep their results as well:\n // the wire format pairs each resolved approval with its result, so pruning the result\n // would leave the approved tool call dangling in the prompt sent to the model.\n const approvalToolCallIds = new Set<string>();\n for (const m of messages) {\n if (m.role !== 'assistant') continue;\n for (const part of m.content) {\n if (part.type === 'tool-approval-requested' || part.type === 'tool-approval-responded') {\n approvalToolCallIds.add(part.toolCallId);\n }\n }\n }\n\n return messages.map(m => {\n if (m.role !== 'assistant') {\n return {\n role: m.role,\n content: m.content\n };\n }\n\n const textParts = m.content.filter(\n (part): part is { type: 'text'; text: string } => part.type === 'text'\n );\n const objectParts = m.content.filter(\n (part): part is { type: 'object'; jsonContent: string } => part.type === 'object'\n );\n // Approval parts must survive pruning: the agent needs the pending tool call and the\n // user's decision to resume a conversation that stopped for approval.\n const approvalParts = m.content.filter(\n (part): part is ToolCallPart =>\n part.type === 'tool-approval-requested' ||\n part.type === 'tool-approval-responded' ||\n (part.type === 'tool-result' && approvalToolCallIds.has(part.toolCallId))\n );\n\n const content: AIMessagePart[] = [];\n\n // Only add text part if there are text parts\n if (textParts.length > 0) {\n content.push({\n type: 'text',\n text: textParts.map(part => part.text).join('\\n\\n')\n });\n }\n\n // Preserve object parts for object agents\n content.push(...objectParts);\n content.push(...approvalParts);\n\n return {\n role: m.role,\n content\n };\n });\n}\n","import { Injectable } from '@angular/core';\n\n/** The remembered approval decisions of one chat session. */\ninterface SessionApprovals {\n /** YOLO mode for this session: every tool of the conversation is approved automatically. */\n approveAll: boolean;\n /** Tool names the user chose to always approve within this session. */\n tools: Set<string>;\n}\n\n/**\n * Remembers the user's \"always approve\" decisions for tool calls that require human approval.\n *\n * Decisions are held in memory only and are scoped to a chat session: each chat component\n * instance identifies its conversation with a unique session ID, so approvals never outlive\n * the conversation they were given in. Navigating away and back, reopening a dialog, or\n * starting a new conversation creates a new session that prompts again. This applies both to\n * single tools (\"always approve this tool\") and to the session-wide YOLO mode\n * ({@link rememberAllTools}, \"always approve all tools\").\n *\n * Tools configured with `needsApproval` always prompt regardless of these preferences; that\n * is enforced by the chat component, since it requires the agent definition. The chat\n * component also offers a global \"approve all tools\" option persisted as a user preference,\n * which is not managed by this service.\n *\n * Only approvals are remembered, never denials.\n */\n@Injectable({ providedIn: 'root' })\nexport class AiToolApprovalMemoryService {\n /** Remembered approvals, keyed by chat session ID. */\n private readonly sessions = new Map<string, SessionApprovals>();\n private nextSessionId = 0;\n\n /**\n * Returns a new chat session ID, unique for the lifetime of the page. Chat components request\n * one per conversation and pass it to the other methods to scope their approvals.\n */\n newSessionId(): string {\n return `chat-session-${++this.nextSessionId}`;\n }\n\n /** Remembers that calls of the given tool are always approved within the given chat session. */\n rememberTool(sessionId: string, toolName: string): void {\n this.session(sessionId).tools.add(toolName);\n }\n\n /**\n * Enables YOLO mode for the given chat session: every tool of the conversation is approved\n * automatically, without prompting, until the conversation ends.\n */\n rememberAllTools(sessionId: string): void {\n this.session(sessionId).approveAll = true;\n }\n\n /** Whether the user chose to always approve the given tool within the given chat session. */\n isToolRemembered(sessionId: string, toolName: string): boolean {\n return this.sessions.get(sessionId)?.tools.has(toolName) ?? false;\n }\n\n /** Whether YOLO mode is enabled for the given chat session (see {@link rememberAllTools}). */\n isApproveAllToolsEnabled(sessionId: string): boolean {\n return this.sessions.get(sessionId)?.approveAll ?? false;\n }\n\n /** Forgets the remembered approvals of a chat session, e.g. when the conversation ends. */\n endSession(sessionId: string): void {\n this.sessions.delete(sessionId);\n }\n\n /** Forgets all remembered approvals of all sessions. */\n clear(): void {\n this.sessions.clear();\n }\n\n private session(sessionId: string): SessionApprovals {\n let session = this.sessions.get(sessionId);\n if (!session) {\n session = { approveAll: false, tools: new Set<string>() };\n this.sessions.set(sessionId, session);\n }\n return session;\n }\n}\n","import { TranslateService } from '@ngx-translate/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { ToolCallPart } from './ai.model';\n\n/** REST resource segments the `cumulocity-api-request` tool commonly queries, mapped to a readable plural noun. */\nconst RESOURCE_LABELS: Record<string, string> = {\n managedObjects: gettext('inventory objects'),\n alarms: gettext('alarms'),\n measurements: gettext('measurements'),\n events: gettext('events'),\n operations: gettext('operations'),\n users: gettext('users'),\n applications: gettext('applications'),\n identity: gettext('external IDs')\n};\n\n/** Common `fragmentType`/`type` filter values used to narrow an inventory query, mapped to a more specific noun than the generic \"inventory objects\" label. */\nconst FRAGMENT_TYPE_LABELS: Record<string, string> = {\n c8y_IsDevice: gettext('devices'),\n c8y_IsDeviceGroup: gettext('device groups'),\n c8y_IsAsset: gettext('assets')\n};\n\n/**\n * A `labelProvider` (see `ToolCallConfig`) for the `cumulocity-api-request` tool: the generic\n * Cumulocity REST query tool offered to AI agents to look up API data. For a tool call awaiting\n * approval, produces a human-readable summary of the query - e.g. \"Look up: alarms with status:\n * active\" -\n * instead of the raw `{ \"query\": \"/alarm/alarms?status=ACTIVE\" }`, so the user can judge the\n * request without reading the API path themselves.\n *\n * Only applies to the `tool-approval-requested`/`tool-approval-responded` states; for every other\n * state this returns `undefined` so the caller's own `executingLabel`/`completedLabel` is used\n * instead. It also returns `undefined` for any query it doesn't recognize, which keeps the generic\n * \"Tool cumulocity-api-request requires approval\" text and the auto-expanded raw input as a\n * fallback - recognizes the common read endpoints (inventory, alarms, measurements, events,\n * operations, users, applications, identity).\n *\n * Assumes the tool's `query` input is a REST path with no separate `method`/body fields, matching\n * its documented purpose of verifying/looking up API data.\n */\nexport function cumulocityApiRequestLabelProvider(\n tool: ToolCallPart,\n translateService: TranslateService\n): string | undefined {\n if (tool.type !== 'tool-approval-requested' && tool.type !== 'tool-approval-responded') {\n return undefined;\n }\n\n const query = (tool.input as { query?: string } | undefined)?.query;\n const summary = summarizeQuery(query, translateService);\n if (!summary) return undefined;\n\n if (tool.type === 'tool-approval-responded') {\n return translateService.instant(\n tool.approval?.approved ? gettext('Approved: {{summary}}') : gettext('Denied: {{summary}}'),\n { summary }\n );\n }\n return summary;\n}\n\nfunction summarizeQuery(\n query: string | undefined,\n translateService: TranslateService\n): string | undefined {\n if (!query) return undefined;\n\n const [path, search] = query.split('?');\n const resourceKey = path.split('/').find(segment => RESOURCE_LABELS[segment]);\n if (!resourceKey) return undefined;\n\n const params = new URLSearchParams(search || '');\n const fragmentType = params.get('fragmentType') || params.get('type');\n const resource = translateService.instant(\n (fragmentType && FRAGMENT_TYPE_LABELS[fragmentType]) || RESOURCE_LABELS[resourceKey]\n );\n const status = params.get('status');\n\n return status\n ? translateService.instant(gettext('Look up: {{resource}} with status: {{status}}'), {\n status: status.toLowerCase(),\n resource\n })\n : translateService.instant(gettext('Look up: {{resource}}'), { resource });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAgBA;IACY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,cAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC;AACrC,IAAA,cAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC;AACrC,IAAA,cAAA,CAAA,qBAAA,CAAA,GAAA,qBAA2C;AAC3C,IAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;AACnC,IAAA,cAAA,CAAA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MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CACvC,CAAC,YAAY,IAAI,oBAAoB,CAAC,YAAY,CAAC,KAAK,eAAe,CAAC,WAAW,CAAC,CACrF;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;AAEnC,IAAA,OAAO;UACH,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,+CAA+C,CAAC,EAAE;AACjF,YAAA,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;YAC5B;SACD;AACH,UAAE,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC;AAC9E;;ACrFA;;AAEG;;;;"}
1
+ {"version":3,"file":"c8y-ngx-components-ai.mjs","sources":["../../ai/ai-service-agent-message-converter.ts","../../ai/ai.service.ts","../../ai/conversation-message-converter.ts","../../ai/ai-tool-approval-memory.service.ts","../../ai/cumulocity-api-request-label.ts","../../ai/c8y-ngx-components-ai.ts"],"sourcesContent":["import { AIMessage, AIMessagePart, ToolCallPart } from './ai.model';\r\n\r\n/*\r\n This module contains some internal helpers used by the AIService to convert message formats.\r\n\r\n The types below are for the message history format required by our agent service (currently this is Vercel's model message).\r\n They are shared with `conversation-message-converter`, which needs the same wire format for conversation storage,\r\n but are NOT part of the package's public API as they may change if we upgrade Vercel backend.\r\n*/\r\n\r\n/** A compact summary of the format required by Vercel for passing tool outputs in\r\n * ModelMessage, based on LanguageModelV*ToolResultOutput. */\r\nexport type ModelMessageToolResultOutput =\r\n | { type: 'text'; value: string }\r\n | { type: 'json'; value: unknown }\r\n | { type: 'error-text'; value: string }\r\n | { type: 'error-json'; value: any }\r\n | { type: 'content'; value: any[] }\r\n /** A tool call the user refused to approve, so it never ran and has no value. */\r\n | { type: 'execution-denied'; reason?: string }\r\n | { type: string };\r\n\r\nexport type AssistantMessageContent =\r\n | {\r\n type: 'text';\r\n text: string;\r\n }\r\n | {\r\n type: 'tool-call';\r\n toolCallId: string;\r\n toolName: string;\r\n input: unknown;\r\n }\r\n | {\r\n type: 'tool-approval-request';\r\n approvalId: string;\r\n toolCallId: string;\r\n };\r\n\r\nexport type ToolResultContent = {\r\n type: 'tool-result';\r\n toolCallId: string;\r\n toolName: string;\r\n // Any normalization required to generate valid outputs out of the streaming data should be done in the ai.service\r\n output: ModelMessageToolResultOutput;\r\n};\r\n\r\n/** The user's decision on a tool call that required approval, paired with its request by `approvalId`. */\r\nexport type ToolApprovalResponseContent = {\r\n type: 'tool-approval-response';\r\n approvalId: string;\r\n approved: boolean;\r\n reason?: string;\r\n};\r\n\r\n/**\r\n * The small subset needed by us from the format accepted by Vercel v6.\r\n * Note that each message corresponds to one \"step\" - so having text after tools calls would be an error. */\r\nexport type ModelMessage =\r\n | {\r\n role: 'user' | 'system';\r\n content: string;\r\n }\r\n | {\r\n role: 'assistant';\r\n content: AssistantMessageContent[];\r\n }\r\n | {\r\n role: 'tool';\r\n content: (ToolResultContent | ToolApprovalResponseContent)[];\r\n };\r\n\r\nexport function convertToolOutputToAgentFormat(tool: ToolCallPart): ModelMessageToolResultOutput {\r\n const { output, outputType, error } = tool;\r\n\r\n // Content arrays need outputType=\"content\" for roundtripping (set by convertStreamingToolOutputToToolCallPart)\r\n if (outputType === 'content' && Array.isArray(output)) {\r\n return { type: 'content', value: output };\r\n }\r\n\r\n if (error) {\r\n return typeof output === 'string'\r\n ? { type: 'error-text', value: output }\r\n : { type: 'error-json', value: output ?? null };\r\n }\r\n\r\n if (typeof output === 'string') {\r\n return { type: 'text', value: output };\r\n }\r\n\r\n if (output == null) {\r\n return { type: 'text', value: '' };\r\n }\r\n\r\n return { type: 'json', value: output };\r\n}\r\n\r\n/** Builds the `tool-call` content part for a tool call or a tool call awaiting/holding an approval decision. */\r\nexport function toToolCallContent(part: ToolCallPart): AssistantMessageContent {\r\n return {\r\n type: 'tool-call',\r\n toolCallId: part.toolCallId,\r\n toolName: part.toolName,\r\n input: part.input ?? {} // must be a dict\r\n };\r\n}\r\n\r\n/**\r\n * Resolves the outcome to record beside a decided tool-approval exchange: the refusal itself when\r\n * the user said no, or the result of the call it authorised. Returns `undefined` when the call was\r\n * approved but has not produced a result yet.\r\n *\r\n * @param part The approval part; `part.approval.approved` must already be defined.\r\n * @param resultsByToolCallId Completed tool results indexed by call id. The result of an approved\r\n * call usually streams in with a later message, but may also live on `part` itself already, when\r\n * the conversation being converted was itself restored from storage.\r\n * @param convertOutput Converts a completed tool call's recorded output into the wire format.\r\n */\r\nexport function resolveApprovalOutcome(\r\n part: ToolCallPart,\r\n resultsByToolCallId: Map<string, ToolCallPart>,\r\n convertOutput: (tool: ToolCallPart) => ModelMessageToolResultOutput\r\n): ToolResultContent | undefined {\r\n if (!part.approval?.approved) {\r\n return {\r\n type: 'tool-result',\r\n toolCallId: part.toolCallId,\r\n toolName: part.toolName,\r\n output: {\r\n type: 'execution-denied',\r\n ...(part.approval?.reason ? { reason: part.approval.reason } : {})\r\n }\r\n };\r\n }\r\n\r\n const result =\r\n resultsByToolCallId.get(part.toolCallId) ?? (part.output !== undefined ? part : undefined);\r\n // No result anywhere means the call was approved but has not run yet.\r\n return result\r\n ? {\r\n type: 'tool-result',\r\n toolCallId: part.toolCallId,\r\n toolName: part.toolName,\r\n output: convertOutput(result)\r\n }\r\n : undefined;\r\n}\r\n\r\n/**\r\n * Splits an assistant message's content into per-step groups at `step-start` boundaries.\r\n * Parts before the first `step-start` are placed in an implicit first step, and empty groups\r\n * (from leading, consecutive or trailing `step-start` parts) are dropped.\r\n *\r\n * Each step has to become its own message in the wire format, which has no `step-start` part:\r\n * this ensures text from a later step is never placed after tool calls from an earlier step,\r\n * which some AI providers forbid.\r\n */\r\nexport function splitIntoSteps(content: AIMessagePart[]): AIMessagePart[][] {\r\n const steps: AIMessagePart[][] = [[]];\r\n for (const part of content) {\r\n if (part.type === 'step-start') {\r\n if (steps[steps.length - 1].length > 0) steps.push([]);\r\n } else {\r\n steps[steps.length - 1].push(part);\r\n }\r\n }\r\n if (steps[steps.length - 1].length === 0) steps.pop();\r\n return steps;\r\n}\r\n\r\n/**\r\n * Converts from our UI-friendly message format back to the format the API requires when\r\n * sending message history back to the agent manager service.\r\n *\r\n * Currently the format is Vercel v6 ModelMessage (so this is a little similar to Vercel's convertToModelMessages).\r\n *\r\n * We do not bother with details such as reasoning (not worth the tokens) or in-progress tool calls\r\n * (since this method is only used on completed responses).\r\n */\r\nexport function convertToAgentMessageFormat(messages: AIMessage[]): ModelMessage[] {\r\n return messages.flatMap(message => {\r\n if (message.role === 'user' || message.role === 'system') {\r\n return [{ role: message.role, content: message.content }];\r\n }\r\n\r\n // Each step maps to its own assistant message + optional tool message.\r\n const steps = splitIntoSteps(message.content);\r\n\r\n const stepMessages: ModelMessage[] = [];\r\n\r\n for (const stepParts of steps) {\r\n const stepAssistantContent: AssistantMessageContent[] = [];\r\n const stepToolResultContent: ToolResultContent[] = [];\r\n\r\n for (const part of stepParts) {\r\n if (part.type === 'text' && part.text) {\r\n stepAssistantContent.push({ type: 'text', text: part.text });\r\n } else if (part.type === 'tool-result') {\r\n stepAssistantContent.push({\r\n type: 'tool-call',\r\n toolCallId: part.toolCallId,\r\n toolName: part.toolName,\r\n input: !part.input ? {} : part.input // must be a dict\r\n });\r\n stepToolResultContent.push({\r\n type: 'tool-result',\r\n toolCallId: part.toolCallId,\r\n toolName: part.toolName,\r\n output: convertToolOutputToAgentFormat(part)\r\n });\r\n }\r\n // Reasoning, tool-input-streaming and tool-executing (in-progress calls) are intentionally skipped\r\n }\r\n\r\n if (stepAssistantContent.length > 0) {\r\n stepMessages.push({ role: 'assistant', content: stepAssistantContent });\r\n }\r\n if (stepToolResultContent.length > 0) {\r\n stepMessages.push({ role: 'tool', content: stepToolResultContent });\r\n }\r\n }\r\n\r\n return stepMessages;\r\n });\r\n}\r\n","import { inject, Injectable } from '@angular/core';\nimport { FetchClient } from '@c8y/client';\nimport { Observable, Subscriber } from 'rxjs';\nimport {\n AgentDefinition,\n AgentHealthCheckResponse,\n AIAssistantMessage,\n AIMessage,\n AIMessagePart,\n AIStreamResponse,\n ClientAgentDefinition,\n ObjectAgentResponse,\n ToolCallPart\n} from './ai.model';\nimport { resolveApprovalOutcome, toToolCallContent } from './ai-service-agent-message-converter';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\n// Internal implementation detail; maybe we don't even need this enum since\nexport enum DataStreamType {\n TEXT_DELTA = 'text-delta',\n TOOL_CALL = 'tool-call',\n TOOL_INPUT_START = 'tool-input-start',\n TOOL_INPUT_DELTA = 'tool-input-delta',\n TOOL_CALL_STREAMING = 'tool-call-streaming',\n TOOL_CALL_DELTA = 'tool-call-delta',\n TOOL_RESULT = 'tool-result',\n TOOL_APPROVAL_REQUEST = 'tool-approval-request',\n REASONING = 'reasoning',\n REASONING_DELTA = 'reasoning-delta',\n REDACTED_REASONING = 'redacted-reasoning',\n REASONING_SIGNATURE = 'reasoning-signature',\n FINISH_REASONING = 'finish-reasoning',\n FINISH = 'finish',\n ERROR = 'error',\n DATA = 'data',\n MESSAGE_ANNOTATIONS = 'message-annotations',\n SOURCE = 'source',\n FILE = 'file',\n STEP_START = 'start-step',\n STEP_FINISH = 'finish-step'\n}\n\n/** This service manages communication with the AI Agent Manager microservice, supporting\n * management of agents, and sending requests to the agents.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class AIService {\n private baseUrl = '/service/ai';\n private client: FetchClient;\n\n // nb: allowing the client to be passed in the constructor allows efficient unit testing without setting up the Angular TestBed\n constructor(client?: FetchClient) {\n this.client = client ?? inject(FetchClient);\n }\n\n /**\n * Creates or updates an agent.\n * @param def The agent definition\n */\n async createOrUpdateAgent(def: AgentDefinition): Promise<void> {\n const health = await this.getAgentHealth(def.name);\n let resource = `${this.baseUrl}/agent/${def.type}`;\n let method = 'POST';\n if (health.exists) {\n resource = `${this.baseUrl}/agent/${def.type}/${def.name}`;\n method = 'PUT';\n }\n const response = await this.client.fetch(resource, {\n body: JSON.stringify(def),\n method,\n headers: { 'Content-Type': 'application/json' }\n });\n\n if (!response.ok) {\n const detail = await response.text().catch(() => '');\n throw new Error(\n `Failed to create agent: ${response.statusText}${detail ? ` - ${detail}` : ''}`\n );\n }\n }\n\n /**\n * Check if an agent exists and is ready for use.\n * @param name Agent name (optional)\n * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional).\n * @returns Agent health check response.\n */\n async getAgentHealth(name = '', fromApp?: string): Promise<AgentHealthCheckResponse> {\n const response = await this.client.fetch(\n `${this.baseUrl}/agent/test/${name || crypto.randomUUID()}${fromApp ? `?fromApp=${fromApp}` : ''}`,\n {\n method: 'GET',\n headers: { 'Content-Type': 'application/json' }\n }\n );\n\n if (!response.ok) {\n return {\n status: response.status === 403 ? 'missing-permissions' : 'missing-microservice',\n exists: false,\n canCreate: false,\n isProviderConfigured: false,\n messages: response.status === 403 ? [] : [response.statusText]\n };\n }\n const json: AgentHealthCheckResponse = await response.json();\n if (!json.isProviderConfigured) {\n json.status = 'missing-provider';\n } else if (!json.exists) {\n json.status = 'missing-agent';\n } else {\n json.status = 'ready';\n }\n return json;\n }\n\n /**\n * Send a text message to the agent.\n * @param name Agent name\n * @param messages The message to send, including any previous message history.\n * Typically you should use `defaultPruneMessagesForAgent` or a custom function to prepare the message history\n * by removing unnecessary content such as large/old tool inputs/outputs.\n * @param variables Variables to include\n * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional).\n * @returns Text response from the agent.\n */\n async text(\n name: string,\n messages: AIMessage[],\n variables: Record<string, unknown>,\n fromApp?: string\n ): Promise<string> {\n const parsedMessages = this.convertToAgentMessageFormat(messages);\n\n const data = this.client.fetch(\n `${this.baseUrl}/agent/text/${name}${fromApp ? `?fromApp=${fromApp}` : ''}`,\n {\n body: JSON.stringify({ messages: parsedMessages, variables }),\n method: 'POST',\n headers: { 'Content-Type': 'application/json' }\n }\n );\n\n const response = await data;\n if (!response.ok) {\n throw new Error(`Failed to talk with agent: ${response.statusText}`);\n }\n const text = await response.text();\n return text;\n }\n\n /**\n * Send messages to an object-type agent via the non-streaming test endpoint.\n * Object agents return a single structured JSON response rather than a stream.\n *\n * @param agent A ClientAgentDefinition with `snapshot: true` (required for test endpoint).\n * @param messages Messages to send\n * @param variables Variables to include\n * @param abortController An AbortController to cancel the request.\n * @returns The full response including the structured object and usage information.\n */\n async callObjectAgent(\n agent: string | ClientAgentDefinition,\n messages: AIMessage[],\n variables: Record<string, unknown>,\n abortController: AbortController\n ): Promise<ObjectAgentResponse> {\n const parsedMessages = this.convertToAgentMessageFormat(messages);\n const agentName = typeof agent === 'string' ? agent : agent.definition.name;\n const useTest = typeof agent !== 'string' && agent.snapshot;\n const baseUrl = useTest\n ? `${this.baseUrl}/agent/test/${typeof agent !== 'string' ? agent.definition.type : 'object'}`\n : `${this.baseUrl}/agent/${typeof agent !== 'string' ? agent.definition.type : 'object'}/${agentName}`;\n let body = JSON.stringify({ messages: parsedMessages, variables });\n if (useTest) {\n const agentCopy = {\n ...(agent as ClientAgentDefinition).definition\n };\n agentCopy.agent.messages = parsedMessages;\n agentCopy.agent.variables = variables;\n body = JSON.stringify(agentCopy);\n }\n\n const response = await this.client.fetch(`${baseUrl}?fullResponse=true`, {\n method: 'POST',\n body,\n headers: {\n ...this.client.defaultHeaders,\n 'content-type': 'application/json'\n },\n signal: abortController.signal\n });\n\n if (response.status > 300) {\n const data = await response.json();\n throw new Error(JSON.stringify(data, null, 2));\n }\n\n const data = await response.json();\n\n if (!('object' in data)) {\n throw new Error('Invalid response: missing required \"object\" field');\n }\n\n if (typeof data.object !== 'object' || data.object === null) {\n throw new Error('Invalid response: \"object\" field must be an object');\n }\n\n // Validate optional totalUsage field if present\n if (data.totalUsage !== undefined) {\n if (typeof data.totalUsage !== 'object' || data.totalUsage === null) {\n throw new Error('Invalid response: \"totalUsage\" must be an object');\n }\n }\n\n return data;\n }\n\n /**\n * Stream a text message to the agent.\n * @param agent Agent name or an agent definition.\n * @param messages The message to send, including any previous message history.\n * Typically you should use `defaultPruneMessagesForAgent` or a custom function to prepare the message history\n * by removing unnecessary content such as large/old tool inputs/outputs.\n * @param variables Variables to include\n * @param abortController An AbortController to cancel the request.\n * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional).\n * @returns An observable that emits AIStreamResponse including partial `AIMessage` objects as they are received.\n * When additional useful metadata is available, this will be streamed with type indicating it is metadata.\n * The observable can be cancelled using the provided AbortController.\n * The observable will emit an error if the request fails or is aborted.\n * The observable will complete when the stream is finished.\n *\n * The messages sent to the agent can include special options:\n * - `hiddenContent`: If set, this content will be sent to the agent instead of the `content` field.\n * - `skipToLLM`: If set to true, this message will be skipped when sending to the agent.\n *\n * Example usage:\n * ```typescript\n * const abortController = new AbortController();\n * const messages: AIMessage[] = [\n * { role: 'user', content: 'Hello' },\n * { role: 'assistant', content: 'Hi there!' },\n * { role: 'user', content: 'Tell me a joke.', options: { hiddenContent: 'Tell me a joke about cats.' } }\n * ];\n * const observable = aiService.stream$('my-agent', messages, {}, abortController);\n * const subscription = observable.subscribe({\n * next: (response) => { console.log('Received message update:', response.message); },\n * error: (err) => console.error('Error:', err),\n * complete: () => console.log('Stream complete')\n * });\n *\n * // To cancel the request:\n * abortController.abort();\n * subscription.unsubscribe();\n * ```\n */\n async stream$(\n agent: string | ClientAgentDefinition,\n messages: AIMessage[],\n variables: { [key: string]: any },\n abortController: AbortController,\n fromApp?: string\n ): Promise<Observable<AIStreamResponse>> {\n const parsedMessages = this.convertToAgentMessageFormat(messages);\n\n const agentName = typeof agent === 'string' ? agent : agent.definition.name;\n const useTest = typeof agent !== 'string' && agent.snapshot;\n const baseUrl = useTest\n ? `${this.baseUrl}/agent/test/text`\n : `${this.baseUrl}/agent/text/${agentName}`;\n let body = JSON.stringify({ messages: parsedMessages, variables });\n if (useTest) {\n const agentCopy = {\n ...agent.definition\n };\n agentCopy.agent['messages'] = parsedMessages;\n agentCopy.agent['variables'] = variables;\n body = JSON.stringify(agentCopy);\n }\n\n const response = await this.client.fetch(\n `${baseUrl}?fullResponse=true${fromApp ? `&fromApp=${fromApp}` : ''}`,\n {\n method: 'POST',\n body,\n headers: {\n ...this.client.defaultHeaders,\n 'content-type': 'application/json',\n accept: 'text/event-stream'\n },\n signal: abortController.signal\n }\n );\n\n const stream = response.body;\n const decoder = new TextDecoder();\n\n return new Observable<AIStreamResponse>(observer => {\n if (response.status > 300) {\n response\n .json()\n .then(data => {\n observer.error(`Error communicating with server: ${JSON.stringify(data, null, 2)}`);\n })\n .catch(err => {\n observer.error(\n `Error communicating with server: HTTP ${response.status}: ${response.statusText}; ${err}`\n );\n });\n return;\n }\n\n if (!stream) {\n observer.error('Server error - no response body');\n return;\n }\n\n const reader = stream.getReader();\n const message: AIAssistantMessage = {\n role: 'assistant',\n content: []\n };\n\n const abortHandler = (e: Event) => {\n const reason = (e?.target as AbortSignal)?.reason || gettext('Aborted');\n reader.cancel();\n observer.error(new DOMException(reason, 'AbortError'));\n };\n\n abortController.signal.addEventListener('abort', abortHandler);\n\n let buffer = '';\n\n const read = () => {\n reader.read().then(({ done, value }) => {\n if (done) {\n if (buffer.trim()) this.processLine(buffer, observer, message); // process any remaining data\n observer.complete();\n return;\n }\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n\\n');\n buffer = lines.pop() || '';\n for (const line of lines) {\n if (line.trim()) this.processLine(line, observer, message);\n }\n read();\n });\n };\n\n read();\n return () => {\n abortController.signal.removeEventListener('abort', abortHandler);\n reader.cancel();\n };\n });\n }\n\n protected convertToAgentMessageFormat(messages: AIMessage[]): object[] {\n // We will need to rewrite this to include tool outputs soon (effectively this means targetting LanguageModelV*ToolResultOutput).\n // Once we have more fields than just role and content, we will need to convert between our format and\n // the Vercel format expected by the agent manager (e.g. steps->content parts)\n\n // The result of an approved tool call streams in with the NEXT assistant message after the\n // resume, but on the wire it must sit next to its approval exchange (the agent strips\n // approval parts from the model prompt, so an exchange without a result leaves a dangling\n // tool call the model provider rejects). Index all results up front so\n // convertAssistantMessageWithApprovals can pull them into the right message.\n const resultsByToolCallId = new Map<string, ToolCallPart>();\n for (const m of messages) {\n if (m.role !== 'assistant') continue;\n for (const part of m.content) {\n // A conversation restored from storage carries the result on the approval part itself,\n // rather than in the following message where it originally streamed in.\n if (\n part.type === 'tool-result' ||\n (part.type === 'tool-approval-responded' && part.output !== undefined)\n ) {\n resultsByToolCallId.set(part.toolCallId, part);\n }\n }\n }\n const serializedToolCallIds = new Set<string>();\n\n return messages.flatMap(m => {\n if (m.role !== 'assistant') {\n return [\n {\n role: m.role,\n content: m.content\n }\n ];\n }\n // For assistant messages, check if there's an object part\n const objectPart = m.content.find(\n (part): part is { type: 'object'; jsonContent: string } => part.type === 'object'\n );\n\n if (objectPart) {\n // If there's an object part, parse and send the JSON object as content\n return [\n {\n role: m.role,\n content: objectPart.jsonContent\n }\n ];\n }\n\n // Messages containing tool approvals must round-trip with full fidelity so the agent\n // can match the user's decision to the pending tool call.\n if (\n m.content.some(\n part => part.type === 'tool-approval-requested' || part.type === 'tool-approval-responded'\n )\n ) {\n return this.convertAssistantMessageWithApprovals(\n m,\n resultsByToolCallId,\n serializedToolCallIds\n );\n }\n\n // Otherwise, send text parts as joined string\n return [\n {\n role: m.role,\n content: m.content\n .filter((part): part is { type: 'text'; text: string } => part.type === 'text')\n .map(part => part.text)\n .join('\\n\\n')\n }\n ];\n });\n }\n\n /**\n * Converts an assistant message containing tool approval parts into the wire format expected by\n * the agent: an assistant message carrying `tool-call` and `tool-approval-request` parts, followed\n * (once the user has decided) by a `tool` role message carrying the matching `tool-approval-response`\n * parts.\n *\n * The agent strips approval parts from the prompt it sends to the model provider, so a *resolved*\n * exchange must also carry the call's outcome in its tool message: the executed result (found via\n * `resultsByToolCallId`, since it streams in with the following assistant message) or an\n * `execution-denied` marker. Each such result is serialized exactly once - `serializedToolCallIds`\n * tracks consumed calls so the copy stored in the following message is not emitted again as a\n * duplicate tool call.\n */\n private convertAssistantMessageWithApprovals(\n m: AIAssistantMessage,\n resultsByToolCallId: Map<string, ToolCallPart>,\n serializedToolCallIds: Set<string>\n ): object[] {\n const assistantContent: object[] = [];\n const toolContent: object[] = [];\n\n for (const part of m.content) {\n switch (part.type) {\n case 'text':\n assistantContent.push({ type: 'text', text: part.text });\n break;\n\n case 'tool-approval-requested':\n case 'tool-approval-responded':\n if (!part.approval) break;\n assistantContent.push(toToolCallContent(part));\n assistantContent.push({\n type: 'tool-approval-request',\n approvalId: part.approval.approvalId,\n toolCallId: part.toolCallId\n });\n if (part.approval.approved !== undefined) {\n toolContent.push({\n type: 'tool-approval-response',\n approvalId: part.approval.approvalId,\n approved: part.approval.approved,\n ...(part.approval.reason ? { reason: part.approval.reason } : {})\n });\n if (!serializedToolCallIds.has(part.toolCallId)) {\n // No outcome means the call was approved but has not run yet: this approval is the\n // one triggering the resume, and the agent executes the tool itself.\n const outcome = resolveApprovalOutcome(part, resultsByToolCallId, result =>\n this.convertToolResultOutputForAgent(result)\n );\n if (outcome) {\n toolContent.push(outcome);\n serializedToolCallIds.add(part.toolCallId);\n }\n }\n }\n break;\n\n case 'tool-result':\n // Skip results already serialized next to their approval exchange in an earlier message\n if (serializedToolCallIds.has(part.toolCallId)) break;\n assistantContent.push(toToolCallContent(part));\n toolContent.push({\n type: 'tool-result',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n output: this.convertToolResultOutputForAgent(part)\n });\n break;\n\n default:\n // reasoning and step-start parts are not needed by the agent\n break;\n }\n }\n\n const result: object[] = [{ role: 'assistant', content: assistantContent }];\n if (toolContent.length > 0) {\n result.push({ role: 'tool', content: toolContent });\n }\n return result;\n }\n\n /** Converts a tool output stored in our format back to the LanguageModelV*ToolResultOutput wire format. */\n private convertToolResultOutputForAgent(part: ToolCallPart): { type: string; value: unknown } {\n if (part.outputType === 'content') {\n return { type: 'content', value: part.output };\n }\n if (part.error) {\n return typeof part.output === 'string'\n ? { type: 'error-text', value: part.output }\n : { type: 'error-json', value: part.output ?? null };\n }\n return typeof part.output === 'string'\n ? { type: 'text', value: part.output }\n : { type: 'json', value: part.output ?? null };\n }\n\n /**\n * Convert a tool output from the MCP/wire format (which is different/more compact than LanguageModelV3ToolResultOutput)\n * into our own standard representation, which can be roundtripped to the format we need to provide when making future requests.\n *\n * Handles different data types from Vercel's streaming API:\n * - Text: stored as simple string in output field\n * - JSON objects: stored as-is in output field\n * - Content arrays: stored in output field with outputType=\"content\" to enable roundtripping\n * - Single text in content array: unwrapped to simple string for simpler handling (and easier truncation)\n * - Errors: error flag set to true\n */\n protected convertStreamingToolOutputToToolCallPart(output: any, target: ToolCallPart) {\n if (!output) {\n return;\n }\n\n if (output.isError || output.type === 'error-text' || output.type === 'error-json')\n target.error = true;\n\n // Handle content array format from streaming API\n if (output.content && Array.isArray(output.content)) {\n // Single text element - unwrap to simple string for simplicity\n if (output.content.length === 1 && output.content[0].type === 'text') {\n target.output = output.content[0].text;\n return;\n }\n\n // Multiple elements or mixed types - preserve as content array\n target.output = output.content;\n target.outputType = 'content'; // Mark as content to enable roundtripping\n return;\n }\n\n // Plain string or structured (JSON-serializable) object - store as-is\n target.output = output;\n }\n\n /** Add the specified tool call info to the current step. If this toolCallId is already known,\n * updates it rather than adding a new one, since for UI rendering and compactness of data it's\n * easiest to just have one item per tool call.\n *\n * Returns the changed item.\n */\n private addToolCallInfo(\n type: ToolCallPart['type'],\n rawInfo: any,\n addTo: AIMessagePart[]\n ): ToolCallPart {\n // Vercel v4 seems to set this to \"id\" not \"toolCallId\" in some places despite doc to the contrary, so normalize it here\n if (!rawInfo.toolCallId) rawInfo.toolCallId = rawInfo.id;\n\n let existing: ToolCallPart | undefined = addTo.find(\n (tc): tc is ToolCallPart =>\n tc.type.startsWith('tool-') && (tc as ToolCallPart).toolCallId === rawInfo.toolCallId\n );\n\n if (existing) {\n existing.type = type;\n } else if (!existing) {\n existing = { type: type, toolName: rawInfo.toolName, toolCallId: rawInfo.toolCallId };\n addTo.push(existing);\n }\n if (rawInfo?.input) existing.input = rawInfo.input;\n if (rawInfo?.output) this.convertStreamingToolOutputToToolCallPart(rawInfo.output, existing);\n\n return existing;\n }\n\n /** Unpacks data from the Vercel Data Stream Protocol (sent by the Agent Manager over SSE) to update the message\n *\n * See streamText().fullStream() from https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol#data-stream-protocol\n *\n * This is similar to what the Vercel `toUIMessageStreamResponse` API does (though it'd need the agent manager to publish the\n * UIMessageStream which has a bit more - useful - data than what is included here).\n *\n * We always use the same parts object, to make it easier for consumers (eg. agent-chat)\n * to add items to the list and have them still there on the next update from this service.\n */\n private processLine(\n line: string,\n observer: Subscriber<AIStreamResponse>,\n message: AIAssistantMessage\n ) {\n if (!line.trim()) {\n return;\n }\n\n try {\n let data: any = {};\n let type = '';\n try {\n data = JSON.parse(line.replace('data: ', ''));\n type = data.type;\n } catch (e) {\n console.error('Error parsing line from AI response: ', line, e);\n return;\n }\n\n let lastPart = !message.content ? undefined : message.content[message.content.length - 1];\n\n switch (type) {\n case DataStreamType.STEP_START:\n // Don't add consecutive duplicate step bounaries\n if (!lastPart || lastPart.type !== 'step-start') {\n message.content.push({ type: 'step-start' });\n observer.next({ message, changedPart: message.content[message.content.length - 1] });\n }\n\n return;\n\n case DataStreamType.STEP_FINISH:\n // `response.modelId` is always present, unlike `start-step`'s raw `request.body`\n // which the agent manager only includes when explicitly configured to.\n if (data.response?.modelId) {\n observer.next({\n message,\n changedPart: { type: 'response-metadata', model: data.response.modelId }\n });\n }\n return;\n\n case DataStreamType.REASONING_DELTA:\n const reasoning = data.text;\n if (!reasoning) return;\n if (lastPart?.type === 'reasoning') {\n lastPart.text += reasoning;\n } else {\n lastPart = { type: 'reasoning', text: reasoning };\n message.content.push(lastPart);\n }\n observer.next({ message, changedPart: lastPart });\n return;\n\n case DataStreamType.TEXT_DELTA:\n const text = data.textDelta || data.text;\n if (!text) return;\n if (lastPart?.type === 'text') {\n lastPart.text += text;\n } else {\n lastPart = { type: 'text', text: text };\n message.content.push(lastPart);\n }\n observer.next({ message, changedPart: lastPart });\n return;\n\n case DataStreamType.TOOL_INPUT_START:\n observer.next({\n message,\n changedPart: this.addToolCallInfo('tool-input-streaming', data, message.content)\n });\n return;\n\n case DataStreamType.TOOL_CALL:\n observer.next({\n message,\n changedPart: this.addToolCallInfo('tool-executing', data, message.content)\n });\n return;\n\n case DataStreamType.TOOL_RESULT:\n observer.next({\n message,\n changedPart: this.addToolCallInfo('tool-result', data, message.content)\n });\n return;\n\n case DataStreamType.TOOL_APPROVAL_REQUEST: {\n // Emitted when a tool with `needsApproval` is called; the agent stops until the\n // conversation is resent with the user's decision (see convertAssistantMessageWithApprovals).\n const approvalPart = this.addToolCallInfo(\n 'tool-approval-requested',\n data.toolCall || data,\n message.content\n );\n approvalPart.approval = { approvalId: data.approvalId };\n observer.next({ message, changedPart: approvalPart });\n return;\n }\n\n case DataStreamType.FINISH:\n message.finishReason = data.finishReason; // FUTURE could be anything, may not match the options in AIMessage\n message.usage = data.totalUsage;\n observer.next({ message, changedPart: undefined });\n observer.complete();\n return;\n\n case DataStreamType.ERROR:\n message.finishReason = 'error';\n observer.next({ message, changedPart: undefined });\n observer.error(data?.message || data?.errorText || data);\n // Error is instead of completing the stream\n return;\n\n // Should we also handle other types such as \"abort\"?\n }\n } catch (e) {\n observer.error(e);\n }\n }\n}\n\n/**\n * The default implementation of for reducing the size of the message history so it is ready to be sent to the LLM agent.\n *\n * This is important since old tool inputs and outputs can be very large and fill up the agent's context window.\n *\n * Implements `pruneMessagesFunction`.\n *\n * When sending an AI request you can provide your own function instead of using this one,\n * or you can write your own function that calls this and adds extra logic,\n * for example to suppress specific tools from the AIMessage, or\n * retain only the final step text in multi-step responses, etc.\n *\n * The current default implementation preserves text content, but does not include any tool calls.\n * This may change in future releases.\n */\nexport function defaultPruneMessagesForAgent(messages: AIMessage[]): AIMessage[] {\n // When we change this to include tool calls, we should remove large inputs and truncate large and/or old outputs\n // to avoid too many tokens and context window consumption.\n // Some applications will want to entirely remove specific tool calls that have only transient use,\n // which can be done by providing their own pruneMessagesForAgent function.\n // Tool calls that went through an approval exchange must keep their results as well:\n // the wire format pairs each resolved approval with its result, so pruning the result\n // would leave the approved tool call dangling in the prompt sent to the model.\n const approvalToolCallIds = collectApprovalToolCallIds(messages);\n\n return messages.map(m => {\n if (m.role !== 'assistant') {\n return { role: m.role, content: m.content } as AIMessage;\n }\n\n const textParts = m.content.filter(\n (part): part is { type: 'text'; text: string } => part.type === 'text'\n );\n const objectParts = m.content.filter(\n (part): part is { type: 'object'; jsonContent: string } => part.type === 'object'\n );\n // Approval parts must survive pruning: the agent needs the pending tool call and the\n // user's decision to resume a conversation that stopped for approval.\n const approvalParts = m.content.filter(\n (part): part is ToolCallPart =>\n part.type === 'tool-approval-requested' ||\n part.type === 'tool-approval-responded' ||\n (part.type === 'tool-result' && approvalToolCallIds.has(part.toolCallId))\n );\n\n const content: AIMessagePart[] = [];\n\n if (textParts.length > 0) {\n content.push({ type: 'text', text: textParts.map(part => part.text).join('\\n\\n') });\n }\n\n content.push(...objectParts);\n content.push(...approvalParts);\n\n return { role: m.role, content } as AIMessage;\n });\n}\n\n/**\n * The default implementation for preparing messages for conversation persistence.\n *\n * Unlike `defaultPruneMessagesForAgent` (which strips tool calls for token efficiency),\n * this preserves tool call history so stored conversations can be fully restored in the UI.\n *\n * Strips only transient streaming states that should never be persisted:\n * reasoning blocks, in-progress tool-input-streaming, and tool-executing parts.\n *\n * Tool outputs longer than 10,000 characters are truncated, as the storage service rejects\n * conversations of about 1 MB and above. `defaultPruneMessagesForAgent` never sends these outputs\n * back to the agent, so the truncation only shows in the UI once the conversation is reopened.\n * The results of tool calls that went through an approval are the exception: the agent does get\n * them back, so they are kept whole for a reopened conversation to send it the same history.\n *\n * Step boundaries are kept because `toConversationMessages`, which converts the result into the\n * format the storage service accepts, needs them to split a multi-step turn into one message per step.\n *\n * Implements `pruneMessagesFunction`.\n */\nexport function defaultPruneMessagesForPersistence(messages: AIMessage[]): AIMessage[] {\n const approvalToolCallIds = collectApprovalToolCallIds(messages);\n\n return messages.map(m => {\n if (m.role !== 'assistant') {\n return m;\n }\n\n const content = m.content\n .filter(\n part =>\n part.type === 'step-start' ||\n part.type === 'text' ||\n part.type === 'tool-result' ||\n part.type === 'object' ||\n // Approval parts carry the user's decision on a tool call, including a refusal, which is\n // the only record that the call was attempted at all.\n part.type === 'tool-approval-requested' ||\n part.type === 'tool-approval-responded'\n )\n .map(part =>\n part.type === 'tool-result' && !approvalToolCallIds.has(part.toolCallId)\n ? truncateToolOutput(part)\n : part\n );\n\n return { ...m, content };\n });\n}\n\nconst MAX_PERSISTED_TOOL_OUTPUT_LENGTH = 10_000;\n/** Matches the note `truncateToolOutput` appends to the outputs it cuts. */\nconst TRUNCATED_OUTPUT_PATTERN = /… \\[truncated to \\d+ of \\d+ characters\\]$/;\n\n/**\n * Cuts a tool output longer than `MAX_PERSISTED_TOOL_OUTPUT_LENGTH` characters (of its JSON form,\n * for a structured output) down to that length. The cut no longer parses, so it is kept as text.\n */\nfunction truncateToolOutput(part: ToolCallPart): ToolCallPart {\n const serialized = typeof part.output === 'string' ? part.output : JSON.stringify(part.output);\n if (!serialized || serialized.length <= MAX_PERSISTED_TOOL_OUTPUT_LENGTH) {\n return part;\n }\n // Cut when the conversation was saved before, so it already notes the original size, which\n // cutting it again would replace with the size of the cut.\n if (typeof part.output === 'string' && TRUNCATED_OUTPUT_PATTERN.test(part.output)) {\n return part;\n }\n return {\n ...part,\n output: `${serialized.slice(0, MAX_PERSISTED_TOOL_OUTPUT_LENGTH)}… [truncated to ${MAX_PERSISTED_TOOL_OUTPUT_LENGTH} of ${serialized.length} characters]`,\n outputType: undefined\n };\n}\n\n/** Collects the ids of the tool calls that went through an approval exchange. */\nfunction collectApprovalToolCallIds(messages: AIMessage[]): Set<string> {\n const ids = new Set<string>();\n for (const m of messages) {\n if (m.role !== 'assistant') continue;\n for (const part of m.content) {\n if (part.type === 'tool-approval-requested' || part.type === 'tool-approval-responded') {\n ids.add(part.toolCallId);\n }\n }\n }\n return ids;\n}\n","import { AIAssistantMessage, AIMessage, AIMessagePart, ToolCallPart } from './ai.model';\nimport {\n AssistantMessageContent,\n convertToolOutputToAgentFormat,\n ModelMessage,\n ModelMessageToolResultOutput,\n resolveApprovalOutcome,\n splitIntoSteps,\n ToolApprovalResponseContent,\n ToolResultContent,\n toToolCallContent\n} from './ai-service-agent-message-converter';\n\n/**\n * A message as stored by the conversation storage API (`/service/ai/conversation`).\n *\n * The service validates every message against the Vercel AI SDK's `ModelMessage` schema, so the\n * UI-only parts of `AIMessage` — `step-start` boundaries above all — cannot be sent as-is. The\n * display metadata below is carried as extra properties, which the schema tolerates.\n */\nexport type ConversationMessage = ModelMessage & {\n timestamp?: string;\n usage?: AIAssistantMessage['usage'];\n /** Agent that produced the message. Accepted by the service on assistant messages only. */\n agentName?: string;\n};\n\n/**\n * Converts chat messages into the format accepted by the conversation storage API.\n *\n * Unlike the history sent to the agent, tool calls are preserved so a stored conversation can be\n * restored with its full transcript by `fromConversationMessages`. Note that:\n * - each step of a multi-step assistant turn becomes its own message, since the wire format has no\n * `step-start` part — `fromConversationMessages` rebuilds the boundaries from the message split;\n * - a tool call that required approval keeps its full exchange: the `tool-approval-request` beside\n * the call, and the user's `tool-approval-response` beside the outcome, which for a refused call\n * is an `execution-denied` result;\n * - the agent that produced an assistant turn is recorded on every assistant message of that turn,\n * so it survives pruning of individual steps;\n * - `object` parts are stored as text, as the wire format has no structured-object equivalent;\n * - `system` messages are dropped, as the service rejects them: a conversation's system prompt\n * comes from the agent's server-side configuration, never from stored history;\n * - reasoning and in-progress tool calls are dropped, as they are not worth persisting.\n *\n * @param messages The chat messages to store, typically already pruned for persistence.\n */\nexport function toConversationMessages(messages: AIMessage[]): ConversationMessage[] {\n // The result of an approved tool call streams in with a later assistant message, but on the wire\n // it has to sit beside its approval exchange, so index every result up front.\n const resultsByToolCallId = new Map<string, ToolCallPart>();\n for (const message of messages) {\n if (message.role !== 'assistant') continue;\n for (const part of message.content) {\n if (part.type === 'tool-result') resultsByToolCallId.set(part.toolCallId, part);\n }\n }\n // Tracks calls already written beside their approval, so the copy carried by a later message is\n // not written a second time.\n const serializedToolCallIds = new Set<string>();\n\n return messages.flatMap(message => {\n if (message.role === 'system') {\n return [];\n }\n\n if (message.role === 'user') {\n return [withDisplayMetadata({ role: 'user', content: message.content }, message)];\n }\n\n const stored: ConversationMessage[] = [];\n\n for (const stepParts of splitIntoSteps(message.content)) {\n stored.push(...buildStepMessages(stepParts, resultsByToolCallId, serializedToolCallIds));\n }\n\n if (stored.length > 0) {\n stored[0] = withDisplayMetadata(stored[0], message);\n }\n\n return message.agentName\n ? stored.map(m => (m.role === 'assistant' ? { ...m, agentName: message.agentName } : m))\n : stored;\n });\n}\n\n/**\n * Converts one step's parts into the `assistant` message it maps to, paired with a `tool` message\n * when the step carries tool results or approval decisions.\n *\n * @param resultsByToolCallId Completed tool results indexed by call id, so an approved call's result\n * (which streams in with a later message) can be matched to the approval it belongs beside.\n * @param serializedToolCallIds Tracks calls already written beside their approval, so the copy\n * carried by a later message is not written a second time.\n */\nfunction buildStepMessages(\n stepParts: AIMessagePart[],\n resultsByToolCallId: Map<string, ToolCallPart>,\n serializedToolCallIds: Set<string>\n): ConversationMessage[] {\n const assistantContent: AssistantMessageContent[] = [];\n const toolContent: (ToolResultContent | ToolApprovalResponseContent)[] = [];\n\n for (const part of stepParts) {\n if (part.type === 'text' && part.text) {\n assistantContent.push({ type: 'text', text: part.text });\n } else if (part.type === 'object') {\n assistantContent.push({ type: 'text', text: part.jsonContent });\n } else if (part.type === 'tool-approval-requested' || part.type === 'tool-approval-responded') {\n if (!part.approval) continue;\n assistantContent.push(toToolCallContent(part));\n assistantContent.push({\n type: 'tool-approval-request',\n approvalId: part.approval.approvalId,\n toolCallId: part.toolCallId\n });\n\n // An undecided approval is stored as the pending request alone.\n if (part.approval.approved === undefined) continue;\n\n toolContent.push({\n type: 'tool-approval-response',\n approvalId: part.approval.approvalId,\n approved: part.approval.approved,\n ...(part.approval.reason ? { reason: part.approval.reason } : {})\n });\n\n if (serializedToolCallIds.has(part.toolCallId)) continue;\n const outcome = resolveApprovalOutcome(\n part,\n resultsByToolCallId,\n convertToolOutputToAgentFormat\n );\n if (outcome) {\n toolContent.push(outcome);\n serializedToolCallIds.add(part.toolCallId);\n }\n } else if (part.type === 'tool-result') {\n if (serializedToolCallIds.has(part.toolCallId)) continue;\n assistantContent.push(toToolCallContent(part));\n toolContent.push({\n type: 'tool-result',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n output: convertToolOutputToAgentFormat(part)\n });\n }\n }\n\n const stepMessages: ConversationMessage[] = [];\n if (assistantContent.length > 0) {\n stepMessages.push({ role: 'assistant', content: assistantContent });\n }\n if (toolContent.length > 0) {\n stepMessages.push({ role: 'tool', content: toolContent });\n }\n return stepMessages;\n}\n\n/**\n * Restores stored messages into the format the chat renders, inverting `toConversationMessages`.\n *\n * The consecutive assistant and tool messages that one assistant turn was split into are merged\n * back into a single message, with a `step-start` part marking each boundary, and each tool call\n * is reunited with its result and, where it needed one, with the user's approval decision.\n *\n * A restored approved call carries its result on the approval part itself, rather than in the\n * following message where it originally streamed in. The chat renders that identically, and a\n * restored decision is never re-actionable: the approval buttons only appear on the latest message.\n *\n * Note that the wire format marks where a step ended but not where a turn did, so assistant\n * messages that followed one another without the user speaking in between — an approval and the\n * response resumed from it, for example — come back merged into a single turn. Every part and its\n * order is preserved; only the split into separate messages is not. The merged turn carries the\n * sum of their token usage and the timestamp of the last one. Messages recorded as coming from\n * different agents are never merged.\n *\n * @param messages The messages of a stored conversation.\n */\nexport function fromConversationMessages(messages: ConversationMessage[]): AIMessage[] {\n const restored: AIMessage[] = [];\n // The assistant turn currently being rebuilt, or undefined when the last message was not one.\n let turn: AIAssistantMessage | undefined;\n\n for (const message of messages) {\n if (message.role === 'tool') {\n for (const part of message.content) {\n if (part.type === 'tool-approval-response') {\n applyApprovalResponse(turn, part);\n } else {\n applyToolResult(turn, part);\n }\n }\n } else if (message.role === 'assistant') {\n // A different agent answering starts a new turn, even without the user speaking in between.\n const agentChanged =\n !!turn?.agentName && !!message.agentName && turn.agentName !== message.agentName;\n if (!turn || agentChanged) {\n turn = {\n role: 'assistant',\n content: [],\n ...(message.timestamp ? { timestamp: message.timestamp } : {}),\n ...(message.usage ? { usage: message.usage } : {}),\n ...(message.agentName ? { agentName: message.agentName } : {})\n };\n restored.push(turn);\n } else {\n if (!turn.agentName && message.agentName) turn.agentName = message.agentName;\n // Only the first stored message of a chat message carries its metadata, so a later one with\n // it was a separate chat message, such as the response resumed after a tool approval.\n if (message.usage) turn.usage = addUsage(turn.usage, message.usage);\n if (message.timestamp) turn.timestamp = message.timestamp;\n turn.content.push({ type: 'step-start' });\n }\n\n // Another client may store an assistant message as plain text, which the wire format allows.\n const content: AssistantMessageContent[] =\n typeof message.content === 'string'\n ? [{ type: 'text', text: message.content }]\n : message.content;\n\n for (const part of content) {\n if (part.type === 'text') {\n turn.content.push({ type: 'text', text: part.text });\n } else if (part.type === 'tool-call') {\n // Stored as a completed call: its output is filled in from the tool message that follows.\n turn.content.push({\n type: 'tool-result',\n toolName: part.toolName,\n toolCallId: part.toolCallId,\n input: part.input as ToolCallPart['input']\n });\n } else if (part.type === 'tool-approval-request') {\n const call = findToolCall(turn, part.toolCallId);\n if (call) {\n call.type = 'tool-approval-requested';\n call.approval = { approvalId: part.approvalId };\n }\n }\n }\n } else {\n turn = undefined;\n restored.push({\n role: message.role,\n content: message.content,\n ...(message.timestamp ? { timestamp: message.timestamp } : {})\n });\n }\n }\n\n return restored;\n}\n\nfunction withDisplayMetadata(stored: ModelMessage, source: AIMessage): ConversationMessage {\n return {\n ...stored,\n ...(source.timestamp ? { timestamp: source.timestamp } : {}),\n ...(source.role === 'assistant' && source.usage ? { usage: source.usage } : {})\n };\n}\n\nfunction addUsage(\n total: AIAssistantMessage['usage'] | undefined,\n usage: AIAssistantMessage['usage']\n): AIAssistantMessage['usage'] {\n if (!total) return usage;\n return {\n inputTokens: (total.inputTokens ?? 0) + (usage.inputTokens ?? 0),\n outputTokens: (total.outputTokens ?? 0) + (usage.outputTokens ?? 0),\n totalTokens: (total.totalTokens ?? 0) + (usage.totalTokens ?? 0)\n };\n}\n\nfunction findToolCall(\n turn: AIAssistantMessage | undefined,\n toolCallId: string\n): ToolCallPart | undefined {\n return turn?.content.find(\n (candidate): candidate is ToolCallPart =>\n 'toolCallId' in candidate && candidate.toolCallId === toolCallId\n );\n}\n\nfunction applyApprovalResponse(\n turn: AIAssistantMessage | undefined,\n part: ToolApprovalResponseContent\n): void {\n const call = turn?.content.find(\n (candidate): candidate is ToolCallPart =>\n 'approval' in candidate && candidate.approval?.approvalId === part.approvalId\n );\n if (!call) {\n return;\n }\n\n call.type = 'tool-approval-responded';\n call.approval = {\n approvalId: part.approvalId,\n approved: part.approved,\n ...(part.reason ? { reason: part.reason } : {})\n };\n}\n\nfunction applyToolResult(turn: AIAssistantMessage | undefined, part: ToolResultContent): void {\n const call = findToolCall(turn, part.toolCallId);\n if (!call) {\n return;\n }\n\n const output = part.output as Extract<ModelMessageToolResultOutput, { value: unknown }>;\n\n switch (part.output.type) {\n case 'execution-denied':\n // A refused call never ran, so it has no output — the decision itself is on the approval part.\n break;\n case 'content':\n call.output = output.value;\n // Marks the output as a multi-part content array so it can be sent back to the agent as one.\n call.outputType = 'content';\n break;\n case 'error-text':\n case 'error-json':\n call.output = output.value;\n call.error = true;\n break;\n default:\n // text and json outputs both restore to the plain value the UI renders.\n call.output = output.value;\n }\n}\n","import { Injectable } from '@angular/core';\n\n/** The remembered approval decisions of one chat session. */\ninterface SessionApprovals {\n /** YOLO mode for this session: every tool of the conversation is approved automatically. */\n approveAll: boolean;\n /** Tool names the user chose to always approve within this session. */\n tools: Set<string>;\n}\n\n/**\n * Remembers the user's \"always approve\" decisions for tool calls that require human approval.\n *\n * Decisions are held in memory only and are scoped to a chat session: each chat component\n * instance identifies its conversation with a unique session ID, so approvals never outlive\n * the conversation they were given in. Navigating away and back, reopening a dialog, or\n * starting a new conversation creates a new session that prompts again. This applies both to\n * single tools (\"always approve this tool\") and to the session-wide YOLO mode\n * ({@link rememberAllTools}, \"always approve all tools\").\n *\n * Tools configured with `needsApproval` always prompt regardless of these preferences; that\n * is enforced by the chat component, since it requires the agent definition. The chat\n * component also offers a global \"approve all tools\" option persisted as a user preference,\n * which is not managed by this service.\n *\n * Only approvals are remembered, never denials.\n */\n@Injectable({ providedIn: 'root' })\nexport class AiToolApprovalMemoryService {\n /** Remembered approvals, keyed by chat session ID. */\n private readonly sessions = new Map<string, SessionApprovals>();\n private nextSessionId = 0;\n\n /**\n * Returns a new chat session ID, unique for the lifetime of the page. Chat components request\n * one per conversation and pass it to the other methods to scope their approvals.\n */\n newSessionId(): string {\n return `chat-session-${++this.nextSessionId}`;\n }\n\n /** Remembers that calls of the given tool are always approved within the given chat session. */\n rememberTool(sessionId: string, toolName: string): void {\n this.session(sessionId).tools.add(toolName);\n }\n\n /**\n * Enables YOLO mode for the given chat session: every tool of the conversation is approved\n * automatically, without prompting, until the conversation ends.\n */\n rememberAllTools(sessionId: string): void {\n this.session(sessionId).approveAll = true;\n }\n\n /** Whether the user chose to always approve the given tool within the given chat session. */\n isToolRemembered(sessionId: string, toolName: string): boolean {\n return this.sessions.get(sessionId)?.tools.has(toolName) ?? false;\n }\n\n /** Whether YOLO mode is enabled for the given chat session (see {@link rememberAllTools}). */\n isApproveAllToolsEnabled(sessionId: string): boolean {\n return this.sessions.get(sessionId)?.approveAll ?? false;\n }\n\n /** Forgets the remembered approvals of a chat session, e.g. when the conversation ends. */\n endSession(sessionId: string): void {\n this.sessions.delete(sessionId);\n }\n\n /** Forgets all remembered approvals of all sessions. */\n clear(): void {\n this.sessions.clear();\n }\n\n private session(sessionId: string): SessionApprovals {\n let session = this.sessions.get(sessionId);\n if (!session) {\n session = { approveAll: false, tools: new Set<string>() };\n this.sessions.set(sessionId, session);\n }\n return session;\n }\n}\n","import { TranslateService } from '@ngx-translate/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { ToolCallPart } from './ai.model';\n\n/** REST resource segments the `cumulocity-api-request` tool commonly queries, mapped to a readable plural noun. */\nconst RESOURCE_LABELS: Record<string, string> = {\n managedObjects: gettext('inventory objects'),\n alarms: gettext('alarms'),\n measurements: gettext('measurements'),\n events: gettext('events'),\n operations: gettext('operations'),\n users: gettext('users'),\n applications: gettext('applications'),\n identity: gettext('external IDs')\n};\n\n/** Common `fragmentType`/`type` filter values used to narrow an inventory query, mapped to a more specific noun than the generic \"inventory objects\" label. */\nconst FRAGMENT_TYPE_LABELS: Record<string, string> = {\n c8y_IsDevice: gettext('devices'),\n c8y_IsDeviceGroup: gettext('device groups'),\n c8y_IsAsset: gettext('assets')\n};\n\n/**\n * A `labelProvider` (see `ToolCallConfig`) for the `cumulocity-api-request` tool: the generic\n * Cumulocity REST query tool offered to AI agents to look up API data. For a tool call awaiting\n * approval, produces a human-readable summary of the query - e.g. \"Look up: alarms with status:\n * active\" -\n * instead of the raw `{ \"query\": \"/alarm/alarms?status=ACTIVE\" }`, so the user can judge the\n * request without reading the API path themselves.\n *\n * Only applies to the `tool-approval-requested`/`tool-approval-responded` states; for every other\n * state this returns `undefined` so the caller's own `executingLabel`/`completedLabel` is used\n * instead. It also returns `undefined` for any query it doesn't recognize, which keeps the generic\n * \"Tool cumulocity-api-request requires approval\" text and the auto-expanded raw input as a\n * fallback - recognizes the common read endpoints (inventory, alarms, measurements, events,\n * operations, users, applications, identity).\n *\n * Assumes the tool's `query` input is a REST path with no separate `method`/body fields, matching\n * its documented purpose of verifying/looking up API data.\n */\nexport function cumulocityApiRequestLabelProvider(\n tool: ToolCallPart,\n translateService: TranslateService\n): string | undefined {\n if (tool.type !== 'tool-approval-requested' && tool.type !== 'tool-approval-responded') {\n return undefined;\n }\n\n const query = (tool.input as { query?: string } | undefined)?.query;\n const summary = summarizeQuery(query, translateService);\n if (!summary) return undefined;\n\n if (tool.type === 'tool-approval-responded') {\n return translateService.instant(\n tool.approval?.approved ? gettext('Approved: {{summary}}') : gettext('Denied: {{summary}}'),\n { summary }\n );\n }\n return summary;\n}\n\nfunction summarizeQuery(\n query: string | undefined,\n translateService: TranslateService\n): string | undefined {\n if (!query) return undefined;\n\n const [path, search] = query.split('?');\n const resourceKey = path.split('/').find(segment => RESOURCE_LABELS[segment]);\n if (!resourceKey) return undefined;\n\n const params = new URLSearchParams(search || '');\n const fragmentType = params.get('fragmentType') || params.get('type');\n const resource = translateService.instant(\n (fragmentType && FRAGMENT_TYPE_LABELS[fragmentType]) || RESOURCE_LABELS[resourceKey]\n );\n const status = params.get('status');\n\n return status\n ? translateService.instant(gettext('Look up: {{resource}} with status: {{status}}'), {\n status: status.toLowerCase(),\n resource\n })\n : translateService.instant(gettext('Look up: {{resource}}'), { resource });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAwEM,SAAU,8BAA8B,CAAC,IAAkB,EAAA;IAC/D,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAAI;;IAG1C,IAAI,UAAU,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;IAC3C;IAEA,IAAI,KAAK,EAAE;QACT,OAAO,OAAO,MAAM,KAAK;cACrB,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM;AACrC,cAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,IAAI,IAAI,EAAE;IACnD;AAEA,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IACxC;AAEA,IAAA,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACpC;IAEA,OAA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,YAAY,IAAI,oBAAoB,CAAC,YAAY,CAAC,KAAK,eAAe,CAAC,WAAW,CAAC,CACrF;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;AAEnC,IAAA,OAAO;UACH,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,+CAA+C,CAAC,EAAE;AACjF,YAAA,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;YAC5B;SACD;AACH,UAAE,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC;AAC9E;;ACrFA;;AAEG;;;;"}
@@ -426,7 +426,7 @@ class AlarmEventSelectorListItemComponent {
426
426
  useExisting: forwardRef(() => AlarmEventSelectorListItemComponent),
427
427
  multi: true
428
428
  }
429
- ], ngImport: i0, template: "<c8y-li\n class=\"c8y-list__item__collapse--container-small\"\n [formGroup]=\"formGroup\"\n #li\n>\n <c8y-li-drag-handle><ng-content select=\"c8y-li-drag-handle\"></ng-content></c8y-li-drag-handle>\n @if (showActiveToggle) {\n <c8y-li-checkbox\n class=\"a-s-center m-t-4 p-r-0\"\n [displayAsSwitch]=\"displayAsSwitch\"\n formControlName=\"__active\"\n (click)=\"$event.stopPropagation()\"\n ></c8y-li-checkbox>\n }\n\n <div class=\"d-flex a-i-center p-l-0\">\n <div\n class=\"c8y-list__item__colorpicker p-t-0 p-b-0 p-l-16\"\n [title]=\"colorPickerTitle | translate\"\n >\n <div\n class=\"c8y-colorpicker\"\n [class.c8y-colorpicker--alarm]=\"timelineType === 'ALARM'\"\n [class.c8y-colorpicker--event]=\"timelineType === 'EVENT'\"\n >\n <input\n [style.pointer-events]=\"allowItemEdit && !omitProperties.color ? 'auto' : 'none'\"\n type=\"color\"\n formControlName=\"color\"\n (click)=\"$event.stopPropagation()\"\n />\n <span\n class=\"circle-icon-wrapper circle-icon-wrapper--medium\"\n [style.background-color]=\"formGroup.value.color\"\n >\n <i\n class=\"stroked-icon\"\n [c8yIcon]=\"timelineType === 'EVENT' ? 'online1' : 'bell'\"\n ></i>\n </span>\n </div>\n </div>\n <button\n class=\"btn-clean text-truncate\"\n [title]=\"formGroup.value.details?.label\"\n (click)=\"\n allowItemEdit\n ? (li.collapsed = !li.collapsed)\n : showActiveToggle\n ? toggleActive()\n : addOrRemoveItem()\n \"\n >\n <span class=\"text-truncate\">\n <c8y-highlight\n [text]=\"\n omitProperties.label\n ? formGroup.value.details?.filters?.type\n : formGroup.value.details?.label\n \"\n [pattern]=\"highlightText\"\n [shouldTrimPattern]=\"true\"\n ></c8y-highlight>\n </span>\n @if (formGroup.value.__target && !hideSource) {\n <small class=\"text-truncate text-muted icon-flex\">\n <i c8yIcon=\"exchange\"></i>\n <span class=\"text-truncate\">{{ formGroup.value.__target.name }}</span>\n </small>\n }\n </button>\n\n <span class=\"m-l-auto d-flex a-i-center m-r-4\">\n @if ((valid$ | async) === false && li.collapsed) {\n <button\n class=\"btn-dot btn-dot--danger\"\n title=\"{{ 'Invalid entries' | translate }}\"\n [popover]=\"'Some entries are invalid. Check the required input fields.' | translate\"\n container=\"body\"\n type=\"button\"\n [outsideClick]=\"true\"\n >\n <i\n class=\"icon-20\"\n c8yIcon=\"exclamation-circle\"\n ></i>\n </button>\n }\n @if (showAddRemoveButton) {\n <span>\n @if (isSelected) {\n <button\n class=\"btn btn-dot text-danger\"\n [attr.aria-label]=\"'Remove' | translate\"\n [tooltip]=\"'Remove' | translate\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n [delay]=\"500\"\n (click)=\"addOrRemoveItem()\"\n >\n <i\n class=\"icon-20\"\n c8yIcon=\"minus-circle\"\n ></i>\n </button>\n } @else {\n <button\n class=\"btn btn-dot text-primary\"\n [attr.aria-label]=\"'Select' | translate\"\n [tooltip]=\"'Select' | translate\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n [disabled]=\"(valid$ | async) === false\"\n [delay]=\"500\"\n (click)=\"addOrRemoveItem()\"\n >\n <i\n class=\"icon-20\"\n c8yIcon=\"plus-circle\"\n ></i>\n </button>\n }\n </span>\n }\n @if (optionToRemove) {\n <button\n class=\"showOnHover btn btn-dot btn-dot--danger m-r-4\"\n [attr.aria-label]=\"'Remove from list' | translate\"\n [tooltip]=\"'Remove from list' | translate\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n data-cy=\"alarm-event-selector-list-item--remove-btn\"\n [delay]=\"500\"\n (click)=\"remove()\"\n >\n <i c8yIcon=\"minus-circle\"></i>\n </button>\n }\n </span>\n </div>\n\n @if (allowItemEdit) {\n <c8y-li-collapse>\n <div class=\"data-point-details\">\n <c8y-alarm-event-attributes-form\n formControlName=\"details\"\n [timelineType]=\"timelineType\"\n [omitProperties]=\"omitProperties\"\n [datapoints]=\"datapoints\"\n [target]=\"formGroup.value.__target\"\n ></c8y-alarm-event-attributes-form>\n </div>\n </c8y-li-collapse>\n }\n</c8y-li>\n", dependencies: [{ kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: ListItemDragHandleComponent, selector: "c8y-list-item-drag-handle, c8y-li-drag-handle" }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: ListItemCheckboxComponent, selector: "c8y-list-item-checkbox, c8y-li-checkbox", inputs: ["selected", "indeterminate", "disabled", "displayAsSwitch"], outputs: ["onSelect"] }, { kind: "directive", type: RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "component", type: HighlightComponent, selector: "c8y-highlight", inputs: ["pattern", "text", "elementClass", "shouldTrimPattern"] }, { kind: "directive", type: PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i2$1.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "component", type: ListItemCollapseComponent, selector: "c8y-list-item-collapse, c8y-li-collapse", inputs: ["collapseWay"] }, { kind: "component", type: AlarmEventAttributesFormComponent, selector: "c8y-alarm-event-attributes-form", inputs: ["timelineType", "omitProperties", "selectedItems", "target", "datapoints"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
429
+ ], ngImport: i0, template: "<c8y-li\n class=\"c8y-list__item__collapse--container-small\"\n [formGroup]=\"formGroup\"\n #li\n>\n <c8y-li-drag-handle><ng-content select=\"c8y-li-drag-handle\"></ng-content></c8y-li-drag-handle>\n @if (showActiveToggle) {\n <c8y-li-checkbox\n class=\"a-s-center m-t-4 p-r-0\"\n [displayAsSwitch]=\"displayAsSwitch\"\n formControlName=\"__active\"\n (click)=\"$event.stopPropagation()\"\n ></c8y-li-checkbox>\n }\n\n <div class=\"d-flex a-i-center p-l-0\">\n <div\n class=\"c8y-list__item__colorpicker p-t-0 p-b-0 p-l-16\"\n [title]=\"colorPickerTitle | translate\"\n >\n <div\n class=\"c8y-colorpicker\"\n [class.c8y-colorpicker--alarm]=\"timelineType === 'ALARM'\"\n [class.c8y-colorpicker--event]=\"timelineType === 'EVENT'\"\n >\n <input\n [style.pointer-events]=\"allowItemEdit && !omitProperties.color ? 'auto' : 'none'\"\n type=\"color\"\n formControlName=\"color\"\n (click)=\"$event.stopPropagation()\"\n />\n <span\n class=\"circle-icon-wrapper circle-icon-wrapper--medium\"\n [style.background-color]=\"formGroup.value.color\"\n >\n <i\n class=\"stroked-icon\"\n [c8yIcon]=\"timelineType === 'EVENT' ? 'online1' : 'bell'\"\n ></i>\n </span>\n </div>\n </div>\n <button\n class=\"btn-clean text-truncate\"\n [title]=\"formGroup.value.details?.label\"\n (click)=\"\n allowItemEdit\n ? (li.collapsed = !li.collapsed)\n : showActiveToggle\n ? toggleActive()\n : addOrRemoveItem()\n \"\n >\n <span class=\"text-truncate\">\n <c8y-highlight\n [text]=\"\n omitProperties.label\n ? formGroup.value.details?.filters?.type\n : formGroup.value.details?.label\n \"\n [pattern]=\"highlightText\"\n [shouldTrimPattern]=\"true\"\n ></c8y-highlight>\n </span>\n @if (formGroup.value.__target && !hideSource) {\n <small class=\"text-truncate text-muted icon-flex\">\n <i c8yIcon=\"exchange\"></i>\n <span class=\"text-truncate\">{{ formGroup.value.__target.name }}</span>\n </small>\n }\n </button>\n\n <span class=\"m-l-auto d-flex a-i-center m-r-4\">\n @if ((valid$ | async) === false && li.collapsed) {\n <button\n class=\"btn-dot btn-dot--danger\"\n title=\"{{ 'Invalid entries' | translate }}\"\n [popover]=\"'Some entries are invalid. Check the required input fields.' | translate\"\n container=\"body\"\n type=\"button\"\n [outsideClick]=\"true\"\n >\n <i\n class=\"icon-20\"\n c8yIcon=\"exclamation-circle\"\n ></i>\n </button>\n }\n @if (showAddRemoveButton) {\n <span>\n @if (isSelected) {\n <button\n class=\"btn btn-dot text-danger\"\n [attr.aria-label]=\"'Remove' | translate\"\n [tooltip]=\"'Remove' | translate\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n [delay]=\"500\"\n (click)=\"addOrRemoveItem()\"\n >\n <i\n class=\"icon-20\"\n c8yIcon=\"minus-circle\"\n ></i>\n </button>\n } @else {\n <button\n class=\"btn btn-dot text-primary\"\n [attr.aria-label]=\"'Select' | translate\"\n [tooltip]=\"'Select' | translate\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n [disabled]=\"(valid$ | async) === false\"\n [delay]=\"500\"\n (click)=\"addOrRemoveItem()\"\n >\n <i\n class=\"icon-20\"\n c8yIcon=\"plus-circle\"\n ></i>\n </button>\n }\n </span>\n }\n @if (optionToRemove) {\n <button\n class=\"showOnHover btn btn-dot btn-dot--danger m-r-4\"\n [attr.aria-label]=\"'Remove from list' | translate\"\n [tooltip]=\"'Remove from list' | translate\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n data-cy=\"alarm-event-selector-list-item--remove-btn\"\n [delay]=\"500\"\n (click)=\"remove()\"\n >\n <i c8yIcon=\"minus-circle\"></i>\n </button>\n }\n </span>\n </div>\n\n @if (allowItemEdit) {\n <c8y-li-collapse>\n <div class=\"data-point-details\">\n <c8y-alarm-event-attributes-form\n formControlName=\"details\"\n [timelineType]=\"timelineType\"\n [omitProperties]=\"omitProperties\"\n [datapoints]=\"datapoints\"\n [target]=\"formGroup.value.__target\"\n ></c8y-alarm-event-attributes-form>\n </div>\n </c8y-li-collapse>\n }\n</c8y-li>\n", dependencies: [{ kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable", "selectOnClick"], outputs: ["collapsedChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: ListItemDragHandleComponent, selector: "c8y-list-item-drag-handle, c8y-li-drag-handle" }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: ListItemCheckboxComponent, selector: "c8y-list-item-checkbox, c8y-li-checkbox", inputs: ["selected", "indeterminate", "disabled", "displayAsSwitch"], outputs: ["onSelect"] }, { kind: "directive", type: RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "component", type: HighlightComponent, selector: "c8y-highlight", inputs: ["pattern", "text", "elementClass", "shouldTrimPattern"] }, { kind: "directive", type: PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i2$1.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "component", type: ListItemCollapseComponent, selector: "c8y-list-item-collapse, c8y-li-collapse", inputs: ["collapseWay"] }, { kind: "component", type: AlarmEventAttributesFormComponent, selector: "c8y-alarm-event-attributes-form", inputs: ["timelineType", "omitProperties", "selectedItems", "target", "datapoints"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
430
430
  }
431
431
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: AlarmEventSelectorListItemComponent, decorators: [{
432
432
  type: Component,
@@ -601,7 +601,7 @@ class AlarmEventSelectorComponent {
601
601
  multi: true,
602
602
  useExisting: forwardRef(() => AlarmEventSelectorComponent)
603
603
  }
604
- ], ngImport: i0, template: "<div\n class=\"d-grid grid__row--1 fit-h\"\n [ngClass]=\"{\n 'grid__col--3-6-3--md': allowChangingContext,\n 'grid__col--8-4--md': !allowChangingContext\n }\"\n>\n <div\n class=\"d-flex d-col p-relative bg-level-1\"\n *ngIf=\"allowChangingContext\"\n >\n <c8y-asset-selector-miller\n class=\"d-contents\"\n [(ngModel)]=\"contextAsset\"\n [asset]=\"contextAsset\"\n (onSelected)=\"assetSelectionChanged($event)\"\n [container]=\"''\"\n [config]=\"{\n view: 'miller',\n groupsSelectable: groupsSelectable,\n columnHeaders: true,\n showChildDevices: true,\n showUnassignedDevices: true,\n singleColumn: true,\n search: allowSearch,\n showFilter: true\n }\"\n ></c8y-asset-selector-miller>\n </div>\n <!-- center column -->\n <div class=\"inner-scroll bg-component\" data-cy=\"c8y-alarm-event-selector--inner-column\">\n <ng-template #noDeviceEmptyState>\n <div class=\"p-16\">\n <c8y-ui-empty-state\n [icon]=\"timelineTypeTexts.emptyStateIcon\"\n [title]=\"timelineTypeTexts.emptyStateTitle | translate\"\n [subtitle]=\"timelineTypeTexts.assetWithNoItemsEmptyStateSubtitle | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </div>\n </ng-template>\n\n <ng-template #loadingData>\n <div class=\"p-16 text-center\">\n <c8y-loading></c8y-loading>\n </div>\n </ng-template>\n\n <div\n class=\"bg-inherit\"\n *ngIf=\"assetSelection | async as asset; else noDeviceEmptyState\"\n >\n <div class=\"p-l-16 p-r-16 p-t-8 p-b-8 sticky-top bg-inherit separator-bottom\">\n <p\n class=\"text-medium text-truncate\"\n [title]=\"timelineTypeTexts.availableItemsTitle | translate\"\n >\n {{ timelineTypeTexts.availableItemsTitle | translate }}\n </p>\n <div class=\"d-flex\">\n <div\n class=\"input-group input-group-search m-t-4\"\n id=\"search\"\n *ngIf=\"!(loadingItems$ | async)\"\n >\n <input\n class=\"form-control\"\n placeholder=\"Filter\u2026\"\n type=\"search\"\n [ngModel]=\"filterString\"\n (ngModelChange)=\"filterStringChanged($event)\"\n />\n <span class=\"input-group-addon\">\n <i\n c8yIcon=\"search\"\n *ngIf=\"!filterString; else clearFilterString\"\n ></i>\n <ng-template #clearFilterString>\n <i\n class=\"text-muted\"\n c8yIcon=\"times\"\n *ngIf=\"filterString\"\n (click)=\"filterStringChanged()\"\n ></i>\n </ng-template>\n </span>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"filteredItems$ | async as filteredItems; else loadingData\">\n <ng-container *ngIf=\"!(loadingItems$ | async); else loadingData\">\n <ng-container *ngIf=\"items$ | async as items\">\n <div class=\"p-16 bg-level-2 separator-bottom\">\n <div>\n <p>\n <i\n class=\"text-info m-r-4\"\n c8yIcon=\"info-circle\"\n ></i>\n <strong>{{ timelineTypeTexts.recentItemsWarningTitle | translate }}</strong>\n </p>\n <p>\n {{ timelineTypeTexts.recentItemsWarningText | translate }}\n {{ timelineTypeTexts.addCustomText | translate }}\n </p>\n </div>\n <div class=\"p-t-16\">\n <button\n class=\"btn btn-default btn-sm\"\n aria-controls=\"collapseCustomItemForm\"\n [attr.aria-expanded]=\"isExpanded\"\n *ngIf=\"!isExpanded\"\n (click)=\"isExpanded = true\"\n >\n {{ timelineTypeTexts.addCustomItemButtonLabel | translate }}\n </button>\n <div\n class=\"collapse\"\n id=\"collapseCustomItemForm\"\n [collapse]=\"!isExpanded\"\n [isAnimated]=\"true\"\n >\n <div [style.min-height]=\"'230px'\">\n <c8y-custom-alarm-event-form\n class=\"d-block\"\n *ngIf=\"isExpanded\"\n [timelineType]=\"timelineType\"\n [target]=\"assetSelection | async\"\n [omitProperties]=\"omitProperties\"\n [defaultColor]=\"defaultColor\"\n (added)=\"itemAdded($event); isExpanded = false\"\n (cancel)=\"isExpanded = false\"\n [selectedItems]=\"selectedItems\"\n ></c8y-custom-alarm-event-form>\n </div>\n </div>\n </div>\n </div>\n\n <div\n class=\"p-16\"\n *ngIf=\"!filteredItems.length\"\n >\n <c8y-ui-empty-state\n [icon]=\"timelineTypeTexts.emptyStateIcon\"\n [title]=\"timelineTypeTexts.emptyStateTitle | translate\"\n [subtitle]=\"\n items.length\n ? ('Try another filter term.' | translate)\n : (timelineTypeTexts.assetWithNoItemsEmptyStateSubtitle | translate)\n \"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </div>\n\n <c8y-list-group>\n <c8y-list-item\n class=\"sticky-top\"\n style=\"top: 72px\"\n *ngIf=\"items.length > maxNumberOfItems && filteredItems.length >= maxNumberOfItems\"\n >\n <div class=\"alert alert-warning m-b-0\">\n {{ timelineTypeTexts.largeNumberOfItemsInfo | translate }}\n </div>\n </c8y-list-item>\n <c8y-alarm-event-selector-list-item\n class=\"d-contents\"\n [ngModel]=\"item\"\n [isSelected]=\"selectedItems | includesAlarmOrEvent: item\"\n (added)=\"itemAdded($event)\"\n (removed)=\"itemRemoved($event)\"\n [highlightText]=\"filterStringChanges$ | async\"\n [timelineType]=\"timelineType\"\n [hideSource]=\"hideSource\"\n *ngFor=\"let item of filteredItems; trackBy: trackByFn\"\n ></c8y-alarm-event-selector-list-item>\n </c8y-list-group>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <!-- last column -->\n <div class=\"inner-scroll bg-level-1\">\n <p\n class=\"text-medium m-b-4 p-l-16 p-r-16 p-t-8 p-b-8 separator-bottom sticky-top text-truncate\"\n [title]=\"timelineTypeTexts.selectedItemsTitle | translate\"\n >\n {{ timelineTypeTexts.selectedItemsTitle | translate }}\n </p>\n <div class=\"d-flex flex-wrap gap-8 p-l-16 p-r-16 p-b-16\">\n <c8y-ui-empty-state\n [icon]=\"timelineTypeTexts.emptyStateIcon\"\n [title]=\"timelineTypeTexts.noSelectedItemsTitle | translate\"\n *ngIf=\"!selectedItems || !selectedItems.length\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n\n <div\n [ngClass]=\"{\n 'c8y-alarm-pill': timelineType === 'ALARM',\n 'c8y-event-pill': timelineType === 'EVENT'\n }\"\n *ngFor=\"let selectedItem of selectedItems\"\n >\n <button\n [title]=\"'Remove' | translate\"\n type=\"button\"\n [ngClass]=\"{\n 'c8y-alarm-pill__btn': timelineType === 'ALARM',\n 'c8y-event-pill__btn': timelineType === 'EVENT'\n }\"\n (click)=\"itemRemoved(selectedItem)\"\n >\n <i\n class=\"icon-14\"\n c8yIcon=\"remove\"\n ></i>\n </button>\n <div\n class=\"c8y-datapoint-pill__label\"\n [title]=\"selectedItem.label || selectedItem.filters.type\"\n >\n <span\n class=\"circle-icon-wrapper circle-icon-wrapper--small m-r-4\"\n [style.background-color]=\"selectedItem.color || defaultColor\"\n >\n <i\n class=\"stroked-icon\"\n [c8yIcon]=\"timelineType === 'ALARM' ? 'bell' : 'online1'\"\n ></i>\n </span>\n <span class=\"text-truncate\">\n <span class=\"text-truncate\">{{ selectedItem.label || selectedItem.filters.type }}</span>\n <small\n class=\"text-muted text-10\"\n *ngIf=\"!hideSource && selectedItem?.__target?.name\"\n >\n {{ selectedItem?.__target?.name }}\n </small>\n </span>\n </div>\n </div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MillerViewComponent, selector: "c8y-asset-selector-miller", inputs: ["config", "asset", "selectedDevice", "rootNode", "container"], outputs: ["onSelected", "onClearSelected"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "component", type: LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "progressLabel", "message"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: CollapseDirective, selector: "[collapse]", inputs: ["display", "isAnimated", "collapse"], outputs: ["collapsed", "collapses", "expanded", "expands"], exportAs: ["bs-collapse"] }, { kind: "component", type: CustomAlarmEventFormComponent, selector: "c8y-custom-alarm-event-form", inputs: ["timelineType", "target", "omitProperties", "selectedItems", "defaultColor"], outputs: ["added", "cancel"] }, { kind: "component", type: ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AlarmEventSelectorListItemComponent, selector: "c8y-alarm-event-selector-list-item", inputs: ["timelineType", "datapoints", "highlightText", "showAddRemoveButton", "isSelected", "optionToRemove", "showActiveToggle", "allowItemEdit", "hideSource", "displayAsSwitch", "omitProperties"], outputs: ["added", "removed"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: IncludesAlarmOrEventPipe, name: "includesAlarmOrEvent" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
604
+ ], ngImport: i0, template: "<div\n class=\"d-grid grid__row--1 fit-h\"\n [ngClass]=\"{\n 'grid__col--3-6-3--md': allowChangingContext,\n 'grid__col--8-4--md': !allowChangingContext\n }\"\n>\n <div\n class=\"d-flex d-col p-relative bg-level-1\"\n *ngIf=\"allowChangingContext\"\n >\n <c8y-asset-selector-miller\n class=\"d-contents\"\n [(ngModel)]=\"contextAsset\"\n [asset]=\"contextAsset\"\n (onSelected)=\"assetSelectionChanged($event)\"\n [container]=\"''\"\n [config]=\"{\n view: 'miller',\n groupsSelectable: groupsSelectable,\n columnHeaders: true,\n showChildDevices: true,\n showUnassignedDevices: true,\n singleColumn: true,\n search: allowSearch,\n showFilter: true\n }\"\n ></c8y-asset-selector-miller>\n </div>\n <!-- center column -->\n <div class=\"inner-scroll bg-component\" data-cy=\"c8y-alarm-event-selector--inner-column\">\n <ng-template #noDeviceEmptyState>\n <div class=\"p-16\">\n <c8y-ui-empty-state\n [icon]=\"timelineTypeTexts.emptyStateIcon\"\n [title]=\"timelineTypeTexts.emptyStateTitle | translate\"\n [subtitle]=\"timelineTypeTexts.assetWithNoItemsEmptyStateSubtitle | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </div>\n </ng-template>\n\n <ng-template #loadingData>\n <div class=\"p-16 text-center\">\n <c8y-loading></c8y-loading>\n </div>\n </ng-template>\n\n <div\n class=\"bg-inherit\"\n *ngIf=\"assetSelection | async as asset; else noDeviceEmptyState\"\n >\n <div class=\"p-l-16 p-r-16 p-t-8 p-b-8 sticky-top bg-inherit separator-bottom\">\n <p\n class=\"text-medium text-truncate\"\n [title]=\"timelineTypeTexts.availableItemsTitle | translate\"\n >\n {{ timelineTypeTexts.availableItemsTitle | translate }}\n </p>\n <div class=\"d-flex\">\n <div\n class=\"input-group input-group-search m-t-4\"\n id=\"search\"\n *ngIf=\"!(loadingItems$ | async)\"\n >\n <input\n class=\"form-control\"\n placeholder=\"Filter\u2026\"\n type=\"search\"\n [ngModel]=\"filterString\"\n (ngModelChange)=\"filterStringChanged($event)\"\n />\n <span class=\"input-group-addon\">\n <i\n c8yIcon=\"search\"\n *ngIf=\"!filterString; else clearFilterString\"\n ></i>\n <ng-template #clearFilterString>\n <i\n class=\"text-muted\"\n c8yIcon=\"times\"\n *ngIf=\"filterString\"\n (click)=\"filterStringChanged()\"\n ></i>\n </ng-template>\n </span>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"filteredItems$ | async as filteredItems; else loadingData\">\n <ng-container *ngIf=\"!(loadingItems$ | async); else loadingData\">\n <ng-container *ngIf=\"items$ | async as items\">\n <div class=\"p-16 bg-level-2 separator-bottom\">\n <div>\n <p>\n <i\n class=\"text-info m-r-4\"\n c8yIcon=\"info-circle\"\n ></i>\n <strong>{{ timelineTypeTexts.recentItemsWarningTitle | translate }}</strong>\n </p>\n <p>\n {{ timelineTypeTexts.recentItemsWarningText | translate }}\n {{ timelineTypeTexts.addCustomText | translate }}\n </p>\n </div>\n <div class=\"p-t-16\">\n <button\n class=\"btn btn-default btn-sm\"\n aria-controls=\"collapseCustomItemForm\"\n [attr.aria-expanded]=\"isExpanded\"\n *ngIf=\"!isExpanded\"\n (click)=\"isExpanded = true\"\n >\n {{ timelineTypeTexts.addCustomItemButtonLabel | translate }}\n </button>\n <div\n class=\"collapse\"\n id=\"collapseCustomItemForm\"\n [collapse]=\"!isExpanded\"\n [isAnimated]=\"true\"\n >\n <div [style.min-height]=\"'230px'\">\n <c8y-custom-alarm-event-form\n class=\"d-block\"\n *ngIf=\"isExpanded\"\n [timelineType]=\"timelineType\"\n [target]=\"assetSelection | async\"\n [omitProperties]=\"omitProperties\"\n [defaultColor]=\"defaultColor\"\n (added)=\"itemAdded($event); isExpanded = false\"\n (cancel)=\"isExpanded = false\"\n [selectedItems]=\"selectedItems\"\n ></c8y-custom-alarm-event-form>\n </div>\n </div>\n </div>\n </div>\n\n <div\n class=\"p-16\"\n *ngIf=\"!filteredItems.length\"\n >\n <c8y-ui-empty-state\n [icon]=\"timelineTypeTexts.emptyStateIcon\"\n [title]=\"timelineTypeTexts.emptyStateTitle | translate\"\n [subtitle]=\"\n items.length\n ? ('Try another filter term.' | translate)\n : (timelineTypeTexts.assetWithNoItemsEmptyStateSubtitle | translate)\n \"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </div>\n\n <c8y-list-group>\n <c8y-list-item\n class=\"sticky-top\"\n style=\"top: 72px\"\n *ngIf=\"items.length > maxNumberOfItems && filteredItems.length >= maxNumberOfItems\"\n >\n <div class=\"alert alert-warning m-b-0\">\n {{ timelineTypeTexts.largeNumberOfItemsInfo | translate }}\n </div>\n </c8y-list-item>\n <c8y-alarm-event-selector-list-item\n class=\"d-contents\"\n [ngModel]=\"item\"\n [isSelected]=\"selectedItems | includesAlarmOrEvent: item\"\n (added)=\"itemAdded($event)\"\n (removed)=\"itemRemoved($event)\"\n [highlightText]=\"filterStringChanges$ | async\"\n [timelineType]=\"timelineType\"\n [hideSource]=\"hideSource\"\n *ngFor=\"let item of filteredItems; trackBy: trackByFn\"\n ></c8y-alarm-event-selector-list-item>\n </c8y-list-group>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <!-- last column -->\n <div class=\"inner-scroll bg-level-1\">\n <p\n class=\"text-medium m-b-4 p-l-16 p-r-16 p-t-8 p-b-8 separator-bottom sticky-top text-truncate\"\n [title]=\"timelineTypeTexts.selectedItemsTitle | translate\"\n >\n {{ timelineTypeTexts.selectedItemsTitle | translate }}\n </p>\n <div class=\"d-flex flex-wrap gap-8 p-l-16 p-r-16 p-b-16\">\n <c8y-ui-empty-state\n [icon]=\"timelineTypeTexts.emptyStateIcon\"\n [title]=\"timelineTypeTexts.noSelectedItemsTitle | translate\"\n *ngIf=\"!selectedItems || !selectedItems.length\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n\n <div\n [ngClass]=\"{\n 'c8y-alarm-pill': timelineType === 'ALARM',\n 'c8y-event-pill': timelineType === 'EVENT'\n }\"\n *ngFor=\"let selectedItem of selectedItems\"\n >\n <button\n [title]=\"'Remove' | translate\"\n type=\"button\"\n [ngClass]=\"{\n 'c8y-alarm-pill__btn': timelineType === 'ALARM',\n 'c8y-event-pill__btn': timelineType === 'EVENT'\n }\"\n (click)=\"itemRemoved(selectedItem)\"\n >\n <i\n class=\"icon-14\"\n c8yIcon=\"remove\"\n ></i>\n </button>\n <div\n class=\"c8y-datapoint-pill__label\"\n [title]=\"selectedItem.label || selectedItem.filters.type\"\n >\n <span\n class=\"circle-icon-wrapper circle-icon-wrapper--small m-r-4\"\n [style.background-color]=\"selectedItem.color || defaultColor\"\n >\n <i\n class=\"stroked-icon\"\n [c8yIcon]=\"timelineType === 'ALARM' ? 'bell' : 'online1'\"\n ></i>\n </span>\n <span class=\"text-truncate\">\n <span class=\"text-truncate\">{{ selectedItem.label || selectedItem.filters.type }}</span>\n <small\n class=\"text-muted text-10\"\n *ngIf=\"!hideSource && selectedItem?.__target?.name\"\n >\n {{ selectedItem?.__target?.name }}\n </small>\n </span>\n </div>\n </div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MillerViewComponent, selector: "c8y-asset-selector-miller", inputs: ["config", "asset", "selectedDevice", "rootNode", "container"], outputs: ["onSelected", "onClearSelected"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "component", type: LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "progressLabel", "message"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: CollapseDirective, selector: "[collapse]", inputs: ["display", "isAnimated", "collapse"], outputs: ["collapsed", "collapses", "expanded", "expands"], exportAs: ["bs-collapse"] }, { kind: "component", type: CustomAlarmEventFormComponent, selector: "c8y-custom-alarm-event-form", inputs: ["timelineType", "target", "omitProperties", "selectedItems", "defaultColor"], outputs: ["added", "cancel"] }, { kind: "component", type: ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable", "selectOnClick"], outputs: ["collapsedChange"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AlarmEventSelectorListItemComponent, selector: "c8y-alarm-event-selector-list-item", inputs: ["timelineType", "datapoints", "highlightText", "showAddRemoveButton", "isSelected", "optionToRemove", "showActiveToggle", "allowItemEdit", "hideSource", "displayAsSwitch", "omitProperties"], outputs: ["added", "removed"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: IncludesAlarmOrEventPipe, name: "includesAlarmOrEvent" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
605
605
  }
606
606
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: AlarmEventSelectorComponent, decorators: [{
607
607
  type: Component,