@c8y/ngx-components 1024.15.13 → 1024.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs +303 -63
- package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-agents-html.mjs +9 -0
- package/fesm2022/c8y-ngx-components-ai-agents-html.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-agents-scada.mjs +4 -0
- package/fesm2022/c8y-ngx-components-ai-agents-scada.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs +394 -52
- package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai.mjs +329 -19
- package/fesm2022/c8y-ngx-components-ai.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-bookmarks.mjs +1 -1
- package/fesm2022/c8y-ngx-components-bookmarks.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs +8 -2
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs +96 -77
- package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-selector.mjs +92 -47
- package/fesm2022/c8y-ngx-components-datapoint-selector.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-device-profile.mjs +1 -1
- package/fesm2022/c8y-ngx-components-device-profile.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-echart.mjs +39 -12
- package/fesm2022/c8y-ngx-components-echart.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ecosystem.mjs +1 -1
- package/fesm2022/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-protocol-opcua.mjs +1 -1
- package/fesm2022/c8y-ngx-components-protocol-opcua.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-register-device.mjs +5 -6
- package/fesm2022/c8y-ngx-components-register-device.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-repository-firmware.mjs +1 -1
- package/fesm2022/c8y-ngx-components-repository-firmware.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-repository-software.mjs +1 -1
- package/fesm2022/c8y-ngx-components-repository-software.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-sub-assets.mjs +30 -10
- package/fesm2022/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-time-context.mjs +13 -9
- package/fesm2022/c8y-ngx-components-time-context.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-trusted-certificates.mjs +1 -1
- package/fesm2022/c8y-ngx-components-trusted-certificates.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs +3 -2
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs +4 -6
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs +3 -2
- package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +122 -24
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/locales/de.po +147 -16
- package/locales/es.po +143 -11
- package/locales/fr.po +459 -324
- package/locales/ja_JP.po +143 -11
- package/locales/ko.po +143 -11
- package/locales/locales.pot +139 -10
- package/locales/nl.po +143 -11
- package/locales/pl.po +143 -11
- package/locales/pt_BR.po +143 -11
- package/locales/zh_CN.po +143 -11
- package/locales/zh_TW.po +143 -11
- package/package.json +1 -1
- package/types/c8y-ngx-components-ai-agent-chat.d.ts +111 -4
- package/types/c8y-ngx-components-ai-agent-chat.d.ts.map +1 -1
- package/types/c8y-ngx-components-ai-agents-html.d.ts.map +1 -1
- package/types/c8y-ngx-components-ai-agents-scada.d.ts.map +1 -1
- package/types/c8y-ngx-components-ai-ai-chat.d.ts +224 -10
- package/types/c8y-ngx-components-ai-ai-chat.d.ts.map +1 -1
- package/types/c8y-ngx-components-ai.d.ts +176 -6
- package/types/c8y-ngx-components-ai.d.ts.map +1 -1
- package/types/c8y-ngx-components-context-dashboard.d.ts.map +1 -1
- package/types/c8y-ngx-components-datapoint-explorer-view.d.ts +7 -2
- package/types/c8y-ngx-components-datapoint-explorer-view.d.ts.map +1 -1
- package/types/c8y-ngx-components-datapoint-selector.d.ts +63 -50
- package/types/c8y-ngx-components-datapoint-selector.d.ts.map +1 -1
- package/types/c8y-ngx-components-echart.d.ts +12 -0
- package/types/c8y-ngx-components-echart.d.ts.map +1 -1
- package/types/c8y-ngx-components-register-device.d.ts.map +1 -1
- package/types/c8y-ngx-components-sub-assets.d.ts +10 -1
- package/types/c8y-ngx-components-sub-assets.d.ts.map +1 -1
- package/types/c8y-ngx-components-time-context.d.ts +2 -0
- package/types/c8y-ngx-components-time-context.d.ts.map +1 -1
- package/types/c8y-ngx-components-widgets-implementations-scada.d.ts.map +1 -1
- package/types/c8y-ngx-components.d.ts +37 -5
- package/types/c8y-ngx-components.d.ts.map +1 -1
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { EventEmitter, Type
|
|
3
|
-
import { AIAssistantMessage, AssistantMessageDisplayConfig,
|
|
2
|
+
import { TemplateRef, EventEmitter, Type } from '@angular/core';
|
|
3
|
+
import { AIAssistantMessage, AssistantMessageDisplayConfig, ToolCallPart, ToolApprovalDecision, AIMessagePart, AIMessage, ChatConfig } from '@c8y/ngx-components/ai';
|
|
4
4
|
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
5
6
|
import { TranslateService } from '@ngx-translate/core';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Projects arbitrary content into the action bar beneath the `c8y-ai-chat` input box.
|
|
10
|
+
*
|
|
11
|
+
* Place one or more `<c8y-ai-chat-action>` elements inside a `<c8y-ai-chat>` (or `<c8y-agent-chat>`)
|
|
12
|
+
* and use the `placement` input to position them. The projected content is rendered as-is, so it can
|
|
13
|
+
* hold any component or control (buttons, dropdowns, tags, and so on).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <c8y-ai-chat-action placement="left">
|
|
18
|
+
* <button class="btn btn-link btn-sm"><i c8yIcon="attach"></i></button>
|
|
19
|
+
* </c8y-ai-chat-action>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare class AiChatActionComponent {
|
|
23
|
+
/**
|
|
24
|
+
* Where the action is placed in the action bar. `more` collects the action into an overflow
|
|
25
|
+
* dropdown on the right side.
|
|
26
|
+
*/
|
|
27
|
+
readonly placement: _angular_core.InputSignal<"left" | "right" | "more">;
|
|
28
|
+
/** The projected content, exposed as a template so the host chat can render it in the right group. */
|
|
29
|
+
readonly template: _angular_core.Signal<TemplateRef<any>>;
|
|
30
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiChatActionComponent, never>;
|
|
31
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatActionComponent, "c8y-ai-chat-action", never, { "placement": { "alias": "placement"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
32
|
+
}
|
|
33
|
+
|
|
7
34
|
/**
|
|
8
35
|
* Context object which includes the inputs needed for assistant message rendering.
|
|
9
36
|
* If creating a custom component for assistant message rendering, you will receive this as an input.
|
|
@@ -15,6 +42,18 @@ interface AssistantMessageContext {
|
|
|
15
42
|
isMessageLoading: boolean;
|
|
16
43
|
/** A number identifying this message in the chat history numbered from the latest - 0 is the latest, -1 is the previous, etc. */
|
|
17
44
|
messageDisplayIndex: number;
|
|
45
|
+
/**
|
|
46
|
+
* Callback invoked when the user approves or denies a tool call that requires approval.
|
|
47
|
+
* When set, approve/deny actions are offered on tool calls in the `tool-approval-requested` state.
|
|
48
|
+
*/
|
|
49
|
+
onToolApprovalResponse?: (part: ToolCallPart, decision: ToolApprovalDecision) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the "always approve" options may be offered for a tool call awaiting approval.
|
|
52
|
+
* Returns false for tools that must be approved explicitly on every call (configured via
|
|
53
|
+
* `needsApproval`), which show plain approve/deny buttons instead. Defaults to true when
|
|
54
|
+
* not provided.
|
|
55
|
+
*/
|
|
56
|
+
canRememberToolApproval?: (part: ToolCallPart) => boolean;
|
|
18
57
|
}
|
|
19
58
|
/**
|
|
20
59
|
* This is the default component used to render the contents of a message from the AI assistant, including
|
|
@@ -150,8 +189,12 @@ declare class AiChatMessageComponent {
|
|
|
150
189
|
private readonly translateService;
|
|
151
190
|
private readonly roleResolved;
|
|
152
191
|
/**
|
|
153
|
-
* Generates an accessible label for the message container
|
|
154
|
-
*
|
|
192
|
+
* Generates an accessible label for the message container: role (user or assistant) and
|
|
193
|
+
* timestamp if available.
|
|
194
|
+
*
|
|
195
|
+
* Deliberately short - the actual message content is already exposed to assistive technology via
|
|
196
|
+
* the normal (structured) DOM content, so duplicating it here as a flat string would just repeat
|
|
197
|
+
* a long, unstructured block of text, especially for multi-paragraph assistant responses.
|
|
155
198
|
* @returns The aria-label string for screen readers
|
|
156
199
|
*/
|
|
157
200
|
readonly ariaLabel: _angular_core.Signal<any>;
|
|
@@ -165,6 +208,88 @@ declare class AiChatMessageComponent {
|
|
|
165
208
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatMessageComponent, "c8y-ai-chat-message", never, { "role": { "alias": "role"; "required": false; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; }, {}, never, [":not(c8y-ai-chat-message-action)", "c8y-ai-chat-message-action"], true, never>;
|
|
166
209
|
}
|
|
167
210
|
|
|
211
|
+
/**
|
|
212
|
+
* A microphone button for the `c8y-ai-chat` action bar that transcribes speech into the chat input
|
|
213
|
+
* using the browser's Web Speech API. Recognized text is appended to the current `prompt`.
|
|
214
|
+
*
|
|
215
|
+
* The button is only rendered when the current browser supports the Web Speech API, so it stays
|
|
216
|
+
* hidden where speech input is unavailable. While a recognition session is running the microphone
|
|
217
|
+
* icon pulses.
|
|
218
|
+
*
|
|
219
|
+
* `c8y-ai-chat` renders this button automatically unless `config.enableSpeechToText` is `false`, so
|
|
220
|
+
* you normally do not place it yourself.
|
|
221
|
+
*/
|
|
222
|
+
declare class AiChatSpeechToTextComponent {
|
|
223
|
+
private readonly speechRecognition;
|
|
224
|
+
private readonly alertService;
|
|
225
|
+
private readonly destroyRef;
|
|
226
|
+
private readonly appState;
|
|
227
|
+
/**
|
|
228
|
+
* Disables the button, for example while the chat is loading or otherwise unavailable. The
|
|
229
|
+
* button is still rendered (see {@link isAvailable} for whether it is offered at all), just
|
|
230
|
+
* not interactive.
|
|
231
|
+
*/
|
|
232
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
233
|
+
/**
|
|
234
|
+
* BCP-47 language tag to recognize, e.g. `en-US`. When not set, the application's active UI
|
|
235
|
+
* language is used (falling back to the browser language).
|
|
236
|
+
*/
|
|
237
|
+
readonly lang: _angular_core.InputSignal<string>;
|
|
238
|
+
/**
|
|
239
|
+
* The chat input text. Recognized speech is appended to it. Supports two-way binding with
|
|
240
|
+
* `[(prompt)]`.
|
|
241
|
+
*/
|
|
242
|
+
readonly prompt: _angular_core.ModelSignal<string>;
|
|
243
|
+
/**
|
|
244
|
+
* Whether a recognition session is currently running. Drives the pulsing microphone icon.
|
|
245
|
+
*/
|
|
246
|
+
readonly isListening: _angular_core.WritableSignal<boolean>;
|
|
247
|
+
/**
|
|
248
|
+
* Emits whenever listening starts (`true`) or stops (`false`), so the host can react, for example
|
|
249
|
+
* by adapting the chat input placeholder while the user is dictating.
|
|
250
|
+
*/
|
|
251
|
+
readonly listeningChange: _angular_core.OutputEmitterRef<boolean>;
|
|
252
|
+
/**
|
|
253
|
+
* Whether the button should be shown at all: the browser supports the Web Speech API. Callers
|
|
254
|
+
* that want to withhold the feature entirely (as `c8y-ai-chat` does via
|
|
255
|
+
* `config.enableSpeechToText`) should not render this component rather than pass a "disabled"
|
|
256
|
+
* flag here - `disabled` only controls interactivity of an already-shown button.
|
|
257
|
+
*/
|
|
258
|
+
readonly isAvailable: _angular_core.Signal<boolean>;
|
|
259
|
+
protected readonly startLabel: "Start voice input";
|
|
260
|
+
protected readonly stopLabel: "Stop voice input";
|
|
261
|
+
/**
|
|
262
|
+
* The input text present when listening started, so recognized speech is appended to it.
|
|
263
|
+
*/
|
|
264
|
+
private textBeforeListening;
|
|
265
|
+
private listenSubscription?;
|
|
266
|
+
/**
|
|
267
|
+
* Starts listening when idle, or stops the current session when already listening.
|
|
268
|
+
*/
|
|
269
|
+
toggleListening(): void;
|
|
270
|
+
private startListening;
|
|
271
|
+
private stopListening;
|
|
272
|
+
/**
|
|
273
|
+
* Resolves the language to recognize: the explicit {@link lang} input when set, otherwise the
|
|
274
|
+
* application's active UI language. The stored language uses an underscore region separator
|
|
275
|
+
* (e.g. `zh_CN`), so it is normalized to the hyphenated BCP-47 form the Web Speech API expects.
|
|
276
|
+
*/
|
|
277
|
+
private resolveLang;
|
|
278
|
+
/** Updates the listening state and notifies the host, ignoring no-op transitions. */
|
|
279
|
+
private setListening;
|
|
280
|
+
/**
|
|
281
|
+
* Appends the recognized transcript to the text that was present when listening started.
|
|
282
|
+
*/
|
|
283
|
+
private appendTranscript;
|
|
284
|
+
/**
|
|
285
|
+
* Ends the session and, for errors the user can act on (such as a denied microphone permission),
|
|
286
|
+
* shows an alert. Benign outcomes like "no speech detected" or a user-initiated stop are ignored.
|
|
287
|
+
*/
|
|
288
|
+
private handleError;
|
|
289
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiChatSpeechToTextComponent, never>;
|
|
290
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatSpeechToTextComponent, "c8y-ai-chat-speech-to-text", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "lang": { "alias": "lang"; "required": false; "isSignal": true; }; "prompt": { "alias": "prompt"; "required": false; "isSignal": true; }; }, { "prompt": "promptChange"; "listeningChange": "listeningChange"; }, never, never, true, never>;
|
|
291
|
+
}
|
|
292
|
+
|
|
168
293
|
/**
|
|
169
294
|
* A suggestion chip that can be displayed in the chat interface.
|
|
170
295
|
* When clicked, it automatically populates and sends a predefined prompt.
|
|
@@ -202,6 +327,38 @@ declare class AiChatSuggestionComponent {
|
|
|
202
327
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatSuggestionComponent, "c8y-ai-chat-suggestion", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; "prompt": { "alias": "prompt"; "required": true; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "useAiButtons": { "alias": "useAiButtons"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "suggestionClicked": "suggestionClicked"; }, never, never, true, never>;
|
|
203
328
|
}
|
|
204
329
|
|
|
330
|
+
/** Options accepted when starting a recognition session. */
|
|
331
|
+
interface SpeechRecognitionOptions {
|
|
332
|
+
/** BCP-47 language tag to recognize, e.g. `en-US`. Defaults to the browser language. */
|
|
333
|
+
lang?: string;
|
|
334
|
+
/** Whether to emit interim (not yet final) results as the user speaks. Default: true. */
|
|
335
|
+
interimResults?: boolean;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Thin wrapper around the browser's Web Speech API (`SpeechRecognition`) used to transcribe speech
|
|
339
|
+
* to text. The API is not available in every browser, so consumers must check {@link isSupported}
|
|
340
|
+
* before offering speech input.
|
|
341
|
+
*/
|
|
342
|
+
declare class SpeechRecognitionService {
|
|
343
|
+
private readonly ngZone;
|
|
344
|
+
private readonly recognitionConstructor;
|
|
345
|
+
/** Whether the current browser exposes the Web Speech API required for speech-to-text. */
|
|
346
|
+
get isSupported(): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Starts a recognition session and emits the cumulative transcript recognized so far on every
|
|
349
|
+
* update (including interim results, when enabled). The observable completes when recognition
|
|
350
|
+
* ends and errors with the API error code (a string such as `not-allowed`) when it fails.
|
|
351
|
+
* Unsubscribing aborts an in-progress recognition.
|
|
352
|
+
*/
|
|
353
|
+
listen(options?: SpeechRecognitionOptions): Observable<string>;
|
|
354
|
+
/** Joins the transcripts of every recognition result into a single string. */
|
|
355
|
+
private collectTranscript;
|
|
356
|
+
/** Resolves the recognition constructor from the window, handling the `webkit` prefix. */
|
|
357
|
+
private resolveConstructor;
|
|
358
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SpeechRecognitionService, never>;
|
|
359
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SpeechRecognitionService>;
|
|
360
|
+
}
|
|
361
|
+
|
|
205
362
|
declare class AiChatToolCallComponent {
|
|
206
363
|
/**
|
|
207
364
|
* The tool call part to render. This includes all information about the tool call, including the name of the tool,
|
|
@@ -229,16 +386,41 @@ declare class AiChatToolCallComponent {
|
|
|
229
386
|
*/
|
|
230
387
|
readonly completedLabel: _angular_core.InputSignal<string>;
|
|
231
388
|
/**
|
|
232
|
-
* A function that can generate a label for this tool call based on the tool call data
|
|
389
|
+
* A function that can generate a label for this tool call based on the tool call data,
|
|
390
|
+
* including for the `tool-approval-requested` state - e.g. "Delete device weather-station-12"
|
|
391
|
+
* instead of the generic "Tool delete_device requires approval". When this returns nothing for
|
|
392
|
+
* a pending approval, the details section is auto-expanded so the raw input is visible instead.
|
|
233
393
|
*/
|
|
234
394
|
readonly labelProvider: _angular_core.InputSignal<(toolCallPart: ToolCallPart, translateService: TranslateService) => string | undefined>;
|
|
395
|
+
/**
|
|
396
|
+
* Whether the approve/deny actions are offered when the tool is in the `tool-approval-requested` state.
|
|
397
|
+
* Only enabled for the latest message while no response is streaming.
|
|
398
|
+
*/
|
|
399
|
+
readonly approvalEnabled: _angular_core.InputSignal<boolean>;
|
|
400
|
+
/**
|
|
401
|
+
* Whether the "always approve" options are offered next to the approve action. Disabled for
|
|
402
|
+
* tools that must be approved explicitly on every call (configured via `needsApproval`),
|
|
403
|
+
* which show plain approve/deny buttons without the dropdown.
|
|
404
|
+
*/
|
|
405
|
+
readonly rememberApprovalEnabled: _angular_core.InputSignal<boolean>;
|
|
406
|
+
/** Emits the user's decision for a tool call awaiting approval. */
|
|
407
|
+
readonly approvalResponse: _angular_core.OutputEmitterRef<ToolApprovalDecision>;
|
|
235
408
|
protected readonly expanded: _angular_core.WritableSignal<boolean>;
|
|
236
409
|
protected readonly everExpanded: _angular_core.WritableSignal<boolean>;
|
|
237
410
|
private readonly translateService;
|
|
411
|
+
/** Guards the auto-expand-on-approval effect so it only ever applies its initial decision once. */
|
|
412
|
+
private hasSetInitialApprovalExpansion;
|
|
413
|
+
constructor();
|
|
238
414
|
getToolLabel(tool: ToolCallPart): string;
|
|
415
|
+
/**
|
|
416
|
+
* The fieldset's accessible name (and, for a pending approval, also its visible legend - see the
|
|
417
|
+
* template). Both must stay in sync so sighted and screen-reader users see/hear the same thing.
|
|
418
|
+
*/
|
|
419
|
+
getFieldsetLabel(tool: ToolCallPart): string;
|
|
239
420
|
protected toggleExpanded(): void;
|
|
421
|
+
private getDynamicLabel;
|
|
240
422
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiChatToolCallComponent, never>;
|
|
241
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatToolCallComponent, "c8y-ai-chat-tool-call", never, { "tool": { "alias": "tool"; "required": true; "isSignal": true; }; "isExecuting": { "alias": "isExecuting"; "required": true; "isSignal": true; }; "toolDetailsComponent": { "alias": "toolDetailsComponent"; "required": false; "isSignal": true; }; "showDefaultToolDetails": { "alias": "showDefaultToolDetails"; "required": false; "isSignal": true; }; "executingLabel": { "alias": "executingLabel"; "required": false; "isSignal": true; }; "completedLabel": { "alias": "completedLabel"; "required": false; "isSignal": true; }; "labelProvider": { "alias": "labelProvider"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
423
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatToolCallComponent, "c8y-ai-chat-tool-call", never, { "tool": { "alias": "tool"; "required": true; "isSignal": true; }; "isExecuting": { "alias": "isExecuting"; "required": true; "isSignal": true; }; "toolDetailsComponent": { "alias": "toolDetailsComponent"; "required": false; "isSignal": true; }; "showDefaultToolDetails": { "alias": "showDefaultToolDetails"; "required": false; "isSignal": true; }; "executingLabel": { "alias": "executingLabel"; "required": false; "isSignal": true; }; "completedLabel": { "alias": "completedLabel"; "required": false; "isSignal": true; }; "labelProvider": { "alias": "labelProvider"; "required": false; "isSignal": true; }; "approvalEnabled": { "alias": "approvalEnabled"; "required": false; "isSignal": true; }; "rememberApprovalEnabled": { "alias": "rememberApprovalEnabled"; "required": false; "isSignal": true; }; }, { "approvalResponse": "approvalResponse"; }, never, never, true, never>;
|
|
242
424
|
}
|
|
243
425
|
|
|
244
426
|
/**
|
|
@@ -251,7 +433,11 @@ declare class AiChatComponent {
|
|
|
251
433
|
* Indicates whether the chat is currently processing a request.
|
|
252
434
|
* When true, displays a cancel button instead of send button and disables the input.
|
|
253
435
|
*/
|
|
254
|
-
isLoading: boolean;
|
|
436
|
+
set isLoading(value: boolean);
|
|
437
|
+
get isLoading(): boolean;
|
|
438
|
+
private _isLoading;
|
|
439
|
+
/** Announced politely when the response starts and when it finishes. */
|
|
440
|
+
readonly statusAnnouncement: _angular_core.WritableSignal<string>;
|
|
255
441
|
/**
|
|
256
442
|
* Disables the chat input and send button when true.
|
|
257
443
|
*/
|
|
@@ -286,11 +472,34 @@ declare class AiChatComponent {
|
|
|
286
472
|
* Child message components displayed in the chat.
|
|
287
473
|
*/
|
|
288
474
|
readonly messages: _angular_core.Signal<readonly AiChatMessageComponent[]>;
|
|
475
|
+
/**
|
|
476
|
+
* Action components projected into the action bar beneath the input box.
|
|
477
|
+
*/
|
|
478
|
+
private readonly projectedActions;
|
|
479
|
+
/**
|
|
480
|
+
* Action components provided programmatically. Used by wrapper components (such as
|
|
481
|
+
* `c8y-agent-chat`) to forward actions projected by their own consumers, since content queries do
|
|
482
|
+
* not reach components re-projected through a nested `ng-content`.
|
|
483
|
+
*/
|
|
484
|
+
readonly actions: _angular_core.InputSignal<readonly AiChatActionComponent[]>;
|
|
485
|
+
/** All actions from content projection and the `actions` input, in declaration order. */
|
|
486
|
+
private readonly allActions;
|
|
487
|
+
/** Whether any action is present, i.e. whether the action bar should be rendered. */
|
|
488
|
+
readonly hasActionBar: _angular_core.Signal<boolean>;
|
|
489
|
+
/** Actions placed on the left side of the action bar. */
|
|
490
|
+
readonly leftActions: _angular_core.Signal<AiChatActionComponent[]>;
|
|
491
|
+
/** Actions placed on the right side of the action bar. */
|
|
492
|
+
readonly rightActions: _angular_core.Signal<AiChatActionComponent[]>;
|
|
493
|
+
/** Actions collected into the overflow (`more`) dropdown on the right side. */
|
|
494
|
+
readonly moreActions: _angular_core.Signal<AiChatActionComponent[]>;
|
|
289
495
|
/**
|
|
290
496
|
* Reference to the scroll container for the chat messages.
|
|
291
497
|
*/
|
|
292
498
|
private readonly scrollContainer;
|
|
499
|
+
private readonly chatInput;
|
|
293
500
|
readonly componentId: string;
|
|
501
|
+
/** Whether the speech-to-text button is currently listening; swaps the input placeholder. */
|
|
502
|
+
readonly isListeningForSpeech: _angular_core.WritableSignal<boolean>;
|
|
294
503
|
private _config;
|
|
295
504
|
constructor();
|
|
296
505
|
/**
|
|
@@ -312,10 +521,15 @@ declare class AiChatComponent {
|
|
|
312
521
|
* Emits the onCancel event.
|
|
313
522
|
*/
|
|
314
523
|
cancel(): void;
|
|
524
|
+
/**
|
|
525
|
+
* Moves keyboard focus to the prompt input. Call this after removing or replacing messages, so
|
|
526
|
+
* that focus is not lost with the element the user was on.
|
|
527
|
+
*/
|
|
528
|
+
focusInput(): void;
|
|
315
529
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiChatComponent, never>;
|
|
316
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatComponent, "c8y-ai-chat", never, { "isLoading": { "alias": "isLoading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "prompt": { "alias": "prompt"; "required": false; }; "suggestionsTemplate": { "alias": "suggestionsTemplate"; "required": false; }; "welcomeTemplate": { "alias": "welcomeTemplate"; "required": false; }; "cumulativeUsage": { "alias": "cumulativeUsage"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "onMessage": "onMessage"; "onCancel": "onCancel"; }, ["messages"], ["[slot='before-messages']", "c8y-ai-chat-message", "[slot='after-messages']", "c8y-ai-chat-suggestion"], true, never>;
|
|
530
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatComponent, "c8y-ai-chat", never, { "isLoading": { "alias": "isLoading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "prompt": { "alias": "prompt"; "required": false; }; "suggestionsTemplate": { "alias": "suggestionsTemplate"; "required": false; }; "welcomeTemplate": { "alias": "welcomeTemplate"; "required": false; }; "cumulativeUsage": { "alias": "cumulativeUsage"; "required": false; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; }; }, { "onMessage": "onMessage"; "onCancel": "onCancel"; }, ["messages", "projectedActions"], ["[slot='before-messages']", "c8y-ai-chat-message", "[slot='after-messages']", "c8y-ai-chat-suggestion", "[slot='input-actions']"], true, never>;
|
|
317
531
|
}
|
|
318
532
|
|
|
319
|
-
export { AiChatAssistantMessageComponent, AiChatAssistantPartComponent, AiChatComponent, AiChatMessageActionComponent, AiChatMessageComponent, AiChatSuggestionComponent, AiChatToolCallComponent };
|
|
320
|
-
export type { AssistantMessageContext };
|
|
533
|
+
export { AiChatActionComponent, AiChatAssistantMessageComponent, AiChatAssistantPartComponent, AiChatComponent, AiChatMessageActionComponent, AiChatMessageComponent, AiChatSpeechToTextComponent, AiChatSuggestionComponent, AiChatToolCallComponent, SpeechRecognitionService };
|
|
534
|
+
export type { AssistantMessageContext, SpeechRecognitionOptions };
|
|
321
535
|
//# sourceMappingURL=c8y-ngx-components-ai-ai-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-ai-ai-chat.d.ts","sources":["../../ai/ai-chat/ai-chat-assistant-message.component.ts","../../ai/ai-chat/ai-chat-assistant-part.component.ts","../../ai/ai-chat/ai-chat-message-action.component.ts","../../ai/ai-chat/ai-chat-message.component.ts","../../ai/ai-chat/ai-chat-suggestion.component.ts","../../ai/ai-chat/ai-chat-tool-call.component.ts","../../ai/ai-chat/ai-chat.component.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-ai-ai-chat.d.ts","sources":["../../ai/ai-chat/ai-chat-action.component.ts","../../ai/ai-chat/ai-chat-assistant-message.component.ts","../../ai/ai-chat/ai-chat-assistant-part.component.ts","../../ai/ai-chat/ai-chat-message-action.component.ts","../../ai/ai-chat/ai-chat-message.component.ts","../../ai/ai-chat/ai-chat-speech-to-text.component.ts","../../ai/ai-chat/ai-chat-suggestion.component.ts","../../ai/ai-chat/speech-recognition.service.ts","../../ai/ai-chat/ai-chat-tool-call.component.ts","../../ai/ai-chat/ai-chat.component.ts"],"mappings":";;;;;;;AAEA;;;;;;;;;;;;;AAaG;AACH,cAMa,qBAAqB;AAChC;;;AAGG;wBACe,aAAA,CAAA,WAAA;;uBAGD,aAAA,CAAA,MAAA,CAAA,WAAA;oDARN,qBAAqB;sDAArB,qBAAqB;AASjC;;ACTD;;;AAGG;UACc,uBAAuB;aAC7B,kBAAkB;YACnB,6BAA6B;;;;;AAQrC;;;AAGG;AACH,oCAAgC,YAAY,YAAY,oBAAoB;AAE5E;;;;;AAKG;qCAC8B,YAAY;AAC9C;AAED;;;AAGG;AACH,cAaa,+BAA+B;AAC1C;;;AAGG;sCAC6B,aAAA,CAAA,WAAA,CAAA,uBAAA;AAEhC;;AAEG;mCAC0B,aAAA,CAAA,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I message representing a call to a tool (which may or may not have completed and a result is available). */
|
|
39
39
|
interface ToolCallPart<TInput extends Record<string, any> = Record<string, unknown>, TOutput = unknown> {
|
|
40
|
-
/** The status of the tool call - whether it is currently streaming its input, in progress,
|
|
41
|
-
|
|
40
|
+
/** The status of the tool call - whether it is currently streaming its input, in progress,
|
|
41
|
+
* has completed and a result (output or error) is available, or requires human approval before execution. */
|
|
42
|
+
type: 'tool-input-streaming' | 'tool-executing' | 'tool-result' | 'tool-approval-requested' | 'tool-approval-responded';
|
|
42
43
|
/** Unique identifier for the tool, as specified in the MCP server and agent definition. */
|
|
43
44
|
toolName: string;
|
|
44
45
|
/** Unique identifier for this invocation of the tool, used to match calls with results. */
|
|
@@ -62,7 +63,64 @@ interface ToolCallPart<TInput extends Record<string, any> = Record<string, unkno
|
|
|
62
63
|
outputType?: 'content' | string;
|
|
63
64
|
/** Set to true for a tool-result where an error occurred. The error message or JSON is in the output field. */
|
|
64
65
|
error?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Present when the tool requires human approval before execution (type `tool-approval-requested`
|
|
68
|
+
* or `tool-approval-responded`). `approved` is set once the user has made a decision.
|
|
69
|
+
*/
|
|
70
|
+
approval?: {
|
|
71
|
+
/** Identifier for this approval request, used to match the response when resuming the conversation. */
|
|
72
|
+
approvalId: string;
|
|
73
|
+
/** The user's decision. Undefined while the approval is still pending. */
|
|
74
|
+
approved?: boolean;
|
|
75
|
+
/** Optional reason given for the decision. */
|
|
76
|
+
reason?: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The user's decision on a tool call awaiting approval.
|
|
81
|
+
*/
|
|
82
|
+
interface ToolApprovalDecision {
|
|
83
|
+
/** Whether the tool call may execute. */
|
|
84
|
+
approved: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* When approving, optionally remember the decision for the rest of the current chat session
|
|
87
|
+
* so future calls are approved automatically without prompting: `'tool'` remembers this tool
|
|
88
|
+
* only, `'all'` remembers every tool of the conversation. A new conversation prompts again.
|
|
89
|
+
* Tools configured with `needsApproval` always prompt, regardless of remembered decisions.
|
|
90
|
+
* Ignored when `approved` is false.
|
|
91
|
+
*/
|
|
92
|
+
remember?: 'tool' | 'all';
|
|
65
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Policy for requiring human approval of tool calls based on the annotations (behaviour hints)
|
|
96
|
+
* the MCP server declares for each tool. Each enabled criterion is checked against the tool's
|
|
97
|
+
* annotations; if any matches, the call pauses for approval. Tools without annotations are
|
|
98
|
+
* treated as matching every criterion (the MCP specification assumes the worst case for
|
|
99
|
+
* missing hints).
|
|
100
|
+
*/
|
|
101
|
+
interface McpToolApprovalPolicy {
|
|
102
|
+
/** Require approval for tools that may perform destructive updates. */
|
|
103
|
+
destructive?: boolean;
|
|
104
|
+
/** Require approval for tools that may modify their environment in any way. */
|
|
105
|
+
nonReadOnly?: boolean;
|
|
106
|
+
/** Require approval for tools that may interact with external entities. */
|
|
107
|
+
openWorld?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A tool entry in an MCP configuration's `tools` array: either just the tool name, or an
|
|
111
|
+
* object naming the tool together with its own approval policy. A tool with its own policy
|
|
112
|
+
* is judged by that policy alone - it replaces the server-wide `approvalPolicy` for this
|
|
113
|
+
* tool, so an entry without any enabled criterion (`{ name: 'x' }`) exempts the tool from
|
|
114
|
+
* the server-wide policy.
|
|
115
|
+
*
|
|
116
|
+
* `needsApproval` set on the entry decides for this tool and overrides the MCP-entry-level
|
|
117
|
+
* `needsApproval`: `true` requires explicit approval on every call - such tools are never
|
|
118
|
+
* approved automatically, not even by the "approve all tools" options.
|
|
119
|
+
*/
|
|
120
|
+
type McpToolConfig = string | ({
|
|
121
|
+
name: string;
|
|
122
|
+
needsApproval?: boolean;
|
|
123
|
+
} & McpToolApprovalPolicy);
|
|
66
124
|
/** Parts that make up the content of a message (typically an assistant message). */
|
|
67
125
|
type AIMessagePart = {
|
|
68
126
|
type: 'text' | 'reasoning';
|
|
@@ -137,7 +195,25 @@ interface AgentDefinition {
|
|
|
137
195
|
/** The tools this agent can use from the configured MCP servers. */
|
|
138
196
|
mcp?: Array<{
|
|
139
197
|
serverName: string;
|
|
140
|
-
|
|
198
|
+
/**
|
|
199
|
+
* The tools of this server the agent can use. Each entry is either a tool name, or an
|
|
200
|
+
* object naming the tool together with its own approval policy (see {@link McpToolConfig}).
|
|
201
|
+
*/
|
|
202
|
+
tools: McpToolConfig[];
|
|
203
|
+
/**
|
|
204
|
+
* Tools that require human approval before execution. `true` applies to all tools of this
|
|
205
|
+
* server, an array applies to the listed tool names only. When triggered, the response stops
|
|
206
|
+
* with a `tool-approval-requested` part and the user is asked to approve or deny the call.
|
|
207
|
+
*/
|
|
208
|
+
needsApproval?: boolean | string[];
|
|
209
|
+
/**
|
|
210
|
+
* Annotation-based approval policy for the tools of this server, applied to tools that
|
|
211
|
+
* `needsApproval` does not already cover. See {@link McpToolApprovalPolicy}.
|
|
212
|
+
*
|
|
213
|
+
* A tool entry carrying its own policy is judged by that policy instead of this one;
|
|
214
|
+
* plain tool names fall back to this server-wide policy.
|
|
215
|
+
*/
|
|
216
|
+
approvalPolicy?: McpToolApprovalPolicy;
|
|
141
217
|
}>;
|
|
142
218
|
}
|
|
143
219
|
/** Configuration for the `ai-chat` component. */
|
|
@@ -152,12 +228,19 @@ interface ChatConfig {
|
|
|
152
228
|
welcomePosition: 'top' | 'bottom' | 'center';
|
|
153
229
|
/** The message displayed in the input box before the user types their message */
|
|
154
230
|
placeholder: string;
|
|
231
|
+
/** The placeholder shown in the input box while the speech-to-text button is actively listening. */
|
|
232
|
+
listeningPlaceholder?: string;
|
|
155
233
|
/** Default is horizontal */
|
|
156
234
|
suggestionsLayout?: 'vertical' | 'horizontal';
|
|
157
235
|
/** Hide scrollbar except when hovering over the chat conversation (default: false) */
|
|
158
236
|
scrollbarOnlyOnHover?: boolean;
|
|
159
237
|
/** By default a framed appearance is used; use this to choose a flat appearance with no shading instead. */
|
|
160
238
|
appearance?: 'framed' | 'flat';
|
|
239
|
+
/**
|
|
240
|
+
* When `false`, hides the speech-to-text (voice input) button. The button is only shown when it
|
|
241
|
+
* is enabled and the browser supports the Web Speech API. Default: `true`.
|
|
242
|
+
*/
|
|
243
|
+
enableSpeechToText?: boolean;
|
|
161
244
|
sendButtonText: string;
|
|
162
245
|
cancelButtonText: string;
|
|
163
246
|
disclaimerText: string;
|
|
@@ -174,6 +257,11 @@ interface AgentChatConfig extends ChatConfig {
|
|
|
174
257
|
showUsagePerMessage?: boolean;
|
|
175
258
|
/** When true, shows a delete button on the last completed assistant message to remove the last exchange. Default: false. */
|
|
176
259
|
showDeleteAction?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* When false, hides the global tool-approval mode selector (Manual/Auto) and its banner.
|
|
262
|
+
* Per-message tool approval prompts are unaffected. Default: true.
|
|
263
|
+
*/
|
|
264
|
+
showGlobalToolApprovalToggle?: boolean;
|
|
177
265
|
}
|
|
178
266
|
/** Configuration for how the `<ai-chat-assistant-message>` displays a calls for a specific tool name to the user. */
|
|
179
267
|
type ToolCallConfig = {
|
|
@@ -350,13 +438,13 @@ declare enum DataStreamType {
|
|
|
350
438
|
TOOL_CALL_STREAMING = "tool-call-streaming",
|
|
351
439
|
TOOL_CALL_DELTA = "tool-call-delta",
|
|
352
440
|
TOOL_RESULT = "tool-result",
|
|
441
|
+
TOOL_APPROVAL_REQUEST = "tool-approval-request",
|
|
353
442
|
REASONING = "reasoning",
|
|
354
443
|
REASONING_DELTA = "reasoning-delta",
|
|
355
444
|
REDACTED_REASONING = "redacted-reasoning",
|
|
356
445
|
REASONING_SIGNATURE = "reasoning-signature",
|
|
357
446
|
FINISH_REASONING = "finish-reasoning",
|
|
358
447
|
FINISH = "finish",
|
|
359
|
-
FINISH_STEP = "finish-step",
|
|
360
448
|
ERROR = "error",
|
|
361
449
|
DATA = "data",
|
|
362
450
|
MESSAGE_ANNOTATIONS = "message-annotations",
|
|
@@ -449,6 +537,22 @@ declare class AIService {
|
|
|
449
537
|
[key: string]: any;
|
|
450
538
|
}, abortController: AbortController, fromApp?: string): Promise<Observable<AIStreamResponse>>;
|
|
451
539
|
protected convertToAgentMessageFormat(messages: AIMessage[]): object[];
|
|
540
|
+
/**
|
|
541
|
+
* Converts an assistant message containing tool approval parts into the wire format expected by
|
|
542
|
+
* the agent: an assistant message carrying `tool-call` and `tool-approval-request` parts, followed
|
|
543
|
+
* (once the user has decided) by a `tool` role message carrying the matching `tool-approval-response`
|
|
544
|
+
* parts.
|
|
545
|
+
*
|
|
546
|
+
* The agent strips approval parts from the prompt it sends to the model provider, so a *resolved*
|
|
547
|
+
* exchange must also carry the call's outcome in its tool message: the executed result (found via
|
|
548
|
+
* `resultsByToolCallId`, since it streams in with the following assistant message) or an
|
|
549
|
+
* `execution-denied` marker. Each such result is serialized exactly once - `serializedToolCallIds`
|
|
550
|
+
* tracks consumed calls so the copy stored in the following message is not emitted again as a
|
|
551
|
+
* duplicate tool call.
|
|
552
|
+
*/
|
|
553
|
+
private convertAssistantMessageWithApprovals;
|
|
554
|
+
/** Converts a tool output stored in our format back to the LanguageModelV*ToolResultOutput wire format. */
|
|
555
|
+
private convertToolResultOutputForAgent;
|
|
452
556
|
/**
|
|
453
557
|
* Convert a tool output from the MCP/wire format (which is different/more compact than LanguageModelV3ToolResultOutput)
|
|
454
558
|
* into our own standard representation, which can be roundtripped to the format we need to provide when making future requests.
|
|
@@ -499,6 +603,72 @@ declare class AIService {
|
|
|
499
603
|
*/
|
|
500
604
|
declare function defaultPruneMessagesForAgent(messages: AIMessage[]): AIMessage[];
|
|
501
605
|
|
|
502
|
-
|
|
503
|
-
|
|
606
|
+
/**
|
|
607
|
+
* Remembers the user's "always approve" decisions for tool calls that require human approval.
|
|
608
|
+
*
|
|
609
|
+
* Decisions are held in memory only and are scoped to a chat session: each chat component
|
|
610
|
+
* instance identifies its conversation with a unique session ID, so approvals never outlive
|
|
611
|
+
* the conversation they were given in. Navigating away and back, reopening a dialog, or
|
|
612
|
+
* starting a new conversation creates a new session that prompts again. This applies both to
|
|
613
|
+
* single tools ("always approve this tool") and to the session-wide YOLO mode
|
|
614
|
+
* ({@link rememberAllTools}, "always approve all tools").
|
|
615
|
+
*
|
|
616
|
+
* Tools configured with `needsApproval` always prompt regardless of these preferences; that
|
|
617
|
+
* is enforced by the chat component, since it requires the agent definition. The chat
|
|
618
|
+
* component also offers a global "approve all tools" option persisted as a user preference,
|
|
619
|
+
* which is not managed by this service.
|
|
620
|
+
*
|
|
621
|
+
* Only approvals are remembered, never denials.
|
|
622
|
+
*/
|
|
623
|
+
declare class AiToolApprovalMemoryService {
|
|
624
|
+
/** Remembered approvals, keyed by chat session ID. */
|
|
625
|
+
private readonly sessions;
|
|
626
|
+
private nextSessionId;
|
|
627
|
+
/**
|
|
628
|
+
* Returns a new chat session ID, unique for the lifetime of the page. Chat components request
|
|
629
|
+
* one per conversation and pass it to the other methods to scope their approvals.
|
|
630
|
+
*/
|
|
631
|
+
newSessionId(): string;
|
|
632
|
+
/** Remembers that calls of the given tool are always approved within the given chat session. */
|
|
633
|
+
rememberTool(sessionId: string, toolName: string): void;
|
|
634
|
+
/**
|
|
635
|
+
* Enables YOLO mode for the given chat session: every tool of the conversation is approved
|
|
636
|
+
* automatically, without prompting, until the conversation ends.
|
|
637
|
+
*/
|
|
638
|
+
rememberAllTools(sessionId: string): void;
|
|
639
|
+
/** Whether the user chose to always approve the given tool within the given chat session. */
|
|
640
|
+
isToolRemembered(sessionId: string, toolName: string): boolean;
|
|
641
|
+
/** Whether YOLO mode is enabled for the given chat session (see {@link rememberAllTools}). */
|
|
642
|
+
isApproveAllToolsEnabled(sessionId: string): boolean;
|
|
643
|
+
/** Forgets the remembered approvals of a chat session, e.g. when the conversation ends. */
|
|
644
|
+
endSession(sessionId: string): void;
|
|
645
|
+
/** Forgets all remembered approvals of all sessions. */
|
|
646
|
+
clear(): void;
|
|
647
|
+
private session;
|
|
648
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AiToolApprovalMemoryService, never>;
|
|
649
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AiToolApprovalMemoryService>;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* A `labelProvider` (see `ToolCallConfig`) for the `cumulocity-api-request` tool: the generic
|
|
654
|
+
* Cumulocity REST query tool offered to AI agents to look up API data. For a tool call awaiting
|
|
655
|
+
* approval, produces a human-readable summary of the query - e.g. "Look up: alarms with status:
|
|
656
|
+
* active" -
|
|
657
|
+
* instead of the raw `{ "query": "/alarm/alarms?status=ACTIVE" }`, so the user can judge the
|
|
658
|
+
* request without reading the API path themselves.
|
|
659
|
+
*
|
|
660
|
+
* Only applies to the `tool-approval-requested`/`tool-approval-responded` states; for every other
|
|
661
|
+
* state this returns `undefined` so the caller's own `executingLabel`/`completedLabel` is used
|
|
662
|
+
* instead. It also returns `undefined` for any query it doesn't recognize, which keeps the generic
|
|
663
|
+
* "Tool cumulocity-api-request requires approval" text and the auto-expanded raw input as a
|
|
664
|
+
* fallback - recognizes the common read endpoints (inventory, alarms, measurements, events,
|
|
665
|
+
* operations, users, applications, identity).
|
|
666
|
+
*
|
|
667
|
+
* Assumes the tool's `query` input is a REST path with no separate `method`/body fields, matching
|
|
668
|
+
* its documented purpose of verifying/looking up API data.
|
|
669
|
+
*/
|
|
670
|
+
declare function cumulocityApiRequestLabelProvider(tool: ToolCallPart, translateService: TranslateService): string | undefined;
|
|
671
|
+
|
|
672
|
+
export { AIService, AiToolApprovalMemoryService, DataStreamType, cumulocityApiRequestLabelProvider, defaultPruneMessagesForAgent };
|
|
673
|
+
export type { AIAssistantMessage, AIMessage, AIMessagePart, AIStreamResponse, AISystemMessage, AIUserMessage, AgentChatConfig, AgentDefinition, AgentHealthCheckResponse, AssistantMessageDisplayConfig, ChatConfig, ChatHistory, ChatHistoryConfig, ClientAgentDefinition, McpToolApprovalPolicy, McpToolConfig, ObjectAgentResponse, ResponseMetadataPart, Suggestion, ToolApprovalDecision, ToolCallConfig, ToolCallPart, WidgetAiChatSectionComponentConfig, pruneMessagesFunction };
|
|
504
674
|
//# sourceMappingURL=c8y-ngx-components-ai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-ai.d.ts","sources":["../../ai/ai.model.ts","../../ai/ai.service.ts"],"mappings":";;;;;;;AAIA;;AAEG;AACG,KAAM,SAAS,GAAG,kBAAkB,GAAG,aAAa,GAAG,eAAe;AAE5E;;AAEG;AACG,KAAM,aAAa;;;;;AAMzB;AACM,KAAM,eAAe;;;;;AAM3B;UACiB,kBAAkB;;aAGxB,aAAa;;;AAKtB;AACE;AACA;AACA;;AAEH;AAKD;AACM,UAAW,YAAY,gBACZ,MAAM,gBAAgB,MAAM
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-ai.d.ts","sources":["../../ai/ai.model.ts","../../ai/ai.service.ts","../../ai/ai-tool-approval-memory.service.ts","../../ai/cumulocity-api-request-label.ts"],"mappings":";;;;;;;AAIA;;AAEG;AACG,KAAM,SAAS,GAAG,kBAAkB,GAAG,aAAa,GAAG,eAAe;AAE5E;;AAEG;AACG,KAAM,aAAa;;;;;AAMzB;AACM,KAAM,eAAe;;;;;AAM3B;UACiB,kBAAkB;;aAGxB,aAAa;;;AAKtB;AACE;AACA;AACA;;AAEH;AAKD;AACM,UAAW,YAAY,gBACZ,MAAM,gBAAgB,MAAM;AAG3C;AAC6G;;;;;;AAW7G;;;AAGG;;AAEH;;;;AAIG;;AAGH;;;;AAIG;AACH;;;AAKA;;;AAGG;AACH;;;;;;;;AAQD;AAED;;AAEG;UACc,oBAAoB;;;AAGnC;;;;;;AAMG;AACH;AACD;AAED;;;;;;AAMG;UACc,qBAAqB;;;;;;;AAOrC;AAED;;;;;;;;;;AAUG;AACG,KAAM,aAAa;;;IAEwB,qBAAqB;AAEtE;AACM,KAAM,aAAa;AACnB;;;;;;;AAEoB,IACtB,YAAY;AAEhB;AACM,KAAM,oBAA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