@c8y/ngx-components 1023.82.2 → 1023.82.4
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/ai/agent-chat/index.d.ts +36 -8
- package/ai/agent-chat/index.d.ts.map +1 -1
- package/ai/ai-chat/index.d.ts +6 -1
- package/ai/ai-chat/index.d.ts.map +1 -1
- package/ai/index.d.ts +45 -5
- package/ai/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs +229 -82
- package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs +35 -8
- package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai.mjs +103 -23
- package/fesm2022/c8y-ngx-components-ai.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs +4 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs.map +1 -1
- package/locales/de.po +16 -1
- package/locales/es.po +15 -0
- package/locales/fr.po +16 -1
- package/locales/ja_JP.po +15 -0
- package/locales/ko.po +15 -0
- package/locales/locales.pot +18 -0
- package/locales/nl.po +15 -0
- package/locales/pl.po +15 -0
- package/locales/pt_BR.po +15 -0
- package/locales/zh_CN.po +15 -0
- package/locales/zh_TW.po +15 -0
- package/package.json +1 -1
package/ai/agent-chat/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { OnInit, OnDestroy, TemplateRef, Type, Injector } from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, OnChanges, TemplateRef, Type, SimpleChanges, Injector } from '@angular/core';
|
|
3
3
|
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
-
import { ClientAgentDefinition, Suggestion,
|
|
4
|
+
import { ClientAgentDefinition, Suggestion, AgentChatConfig, AssistantMessageDisplayConfig, AIAssistantMessage, AIStreamResponse, pruneMessagesFunction, AIMessage, ToolCallPart, ChatHistory, AIUserMessage, WidgetAiChatSectionComponentConfig } from '@c8y/ngx-components/ai';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
|
|
7
|
-
declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
7
|
+
declare class AgentChatComponent implements OnInit, OnDestroy, OnChanges {
|
|
8
8
|
readonly translateService: TranslateService;
|
|
9
9
|
private readonly datePipe;
|
|
10
10
|
private readonly modalService;
|
|
@@ -30,7 +30,7 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
30
30
|
*/
|
|
31
31
|
readonly suggestions: _angular_core.InputSignal<Suggestion[]>;
|
|
32
32
|
/** ChatConfig to customize the ai-chat component's configuration if desired. */
|
|
33
|
-
readonly chatConfig: _angular_core.InputSignal<Partial<
|
|
33
|
+
readonly chatConfig: _angular_core.InputSignal<Partial<AgentChatConfig>>;
|
|
34
34
|
/** Template for customizing the welcome view using `ng-template`. */
|
|
35
35
|
readonly welcomeTemplate: _angular_core.InputSignal<TemplateRef<any>>;
|
|
36
36
|
/** Indicates whether the component has zero messages and is showing the welcome page. */
|
|
@@ -81,6 +81,10 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
81
81
|
* or to make what is sent to the agent different from what is rendered in the UI.
|
|
82
82
|
*/
|
|
83
83
|
readonly pruneMessagesForAgent: _angular_core.InputSignal<pruneMessagesFunction>;
|
|
84
|
+
/** When true, skips the agent health check on initialization.
|
|
85
|
+
* Use this when the component is used with the test endpoint (snapshot mode) where the agent
|
|
86
|
+
* does not need to exist on the backend. Default: false. */
|
|
87
|
+
readonly skipHealthCheck: _angular_core.InputSignal<boolean>;
|
|
84
88
|
/** Input that provides a previously-saved chat history snapshot to restore. */
|
|
85
89
|
readonly initialChatHistory: _angular_core.InputSignal<string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
|
|
86
90
|
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
@@ -150,6 +154,11 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
150
154
|
text: string;
|
|
151
155
|
type: string;
|
|
152
156
|
}>;
|
|
157
|
+
/**
|
|
158
|
+
* Emitted after any meaningful mutation of the messages list (send, finish, reprompt, reload, delete, reset).
|
|
159
|
+
* Allows the parent to react to conversation changes, e.g. to persist the conversation.
|
|
160
|
+
*/
|
|
161
|
+
readonly onMessagesChange: _angular_core.OutputEmitterRef<AIMessage[]>;
|
|
153
162
|
protected readonly _isLoading: _angular_core.WritableSignal<boolean>;
|
|
154
163
|
/** Is an AI agent request currently in progress. This can be used to disable UI elements while a reply (which might change the state) is being loaded. */
|
|
155
164
|
get isLoadingAiResponse(): _angular_core.Signal<boolean>;
|
|
@@ -163,13 +172,19 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
163
172
|
/** Stores any detailed error messages from the backend. */
|
|
164
173
|
protected readonly agentHealthDetailedMessages: _angular_core.WritableSignal<string>;
|
|
165
174
|
/**
|
|
166
|
-
* Stores any error
|
|
175
|
+
* Stores any error from LLM call.
|
|
167
176
|
*
|
|
168
177
|
* If possible this string is translated already or registered with `gettext`.
|
|
169
178
|
* In practice, this may not be translated if it comes from the backend.
|
|
170
179
|
*/
|
|
171
|
-
readonly
|
|
180
|
+
readonly agentRequestError: _angular_core.WritableSignal<string>;
|
|
172
181
|
readonly messages: _angular_core.WritableSignal<AIMessage[]>;
|
|
182
|
+
/** Computed cumulative token usage across all messages in the conversation. */
|
|
183
|
+
readonly cumulativeUsage: _angular_core.Signal<{
|
|
184
|
+
inputTokens: number;
|
|
185
|
+
outputTokens: number;
|
|
186
|
+
totalTokens: number;
|
|
187
|
+
}>;
|
|
173
188
|
/**
|
|
174
189
|
* Computed signal holding the last assistant message, which is the one which may be rapidly changing as we
|
|
175
190
|
* stream it back. This allows us to update the UI reactively without affecting the rest of the message history.
|
|
@@ -199,6 +214,7 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
199
214
|
*/
|
|
200
215
|
private _clientToolOutputs;
|
|
201
216
|
ngOnInit(): Promise<void>;
|
|
217
|
+
ngOnChanges(changes: SimpleChanges): Promise<void>;
|
|
202
218
|
/**
|
|
203
219
|
* Save the current chat history and suggestions to an opaque, versioned, JSON-serializable snapshot of the chat history for persistence.
|
|
204
220
|
*
|
|
@@ -217,6 +233,10 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
217
233
|
rate(assistantMessage: AIAssistantMessage, positive: boolean): Promise<void>;
|
|
218
234
|
reload(assistantMessage: AIMessage): void;
|
|
219
235
|
cancel(): void;
|
|
236
|
+
/** Clears all messages and cancels any in-flight stream. */
|
|
237
|
+
resetMessages(): void;
|
|
238
|
+
/** Removes the last user message and all assistant messages that follow it from the conversation. */
|
|
239
|
+
deleteLastExchange(): void;
|
|
220
240
|
/**
|
|
221
241
|
* Overrides the output of a specific tool result (in the current assistant message), including optionally indicating that an error occurred.
|
|
222
242
|
*
|
|
@@ -227,8 +247,10 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
227
247
|
*/
|
|
228
248
|
addToolOutput(toolCallId: string, output: any, error?: boolean): void;
|
|
229
249
|
createAgent(): Promise<void>;
|
|
250
|
+
private initializeChat;
|
|
230
251
|
/** Restore chat history from a previously-saved snapshot. Does nothing if the component already has some messages. */
|
|
231
252
|
protected _restoreChatHistory(history: ChatHistory | undefined): void;
|
|
253
|
+
private checkAgentHealth;
|
|
232
254
|
private getAnalyticsMetadataContext;
|
|
233
255
|
private handleAgentError;
|
|
234
256
|
/**
|
|
@@ -240,8 +262,14 @@ declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
|
240
262
|
*/
|
|
241
263
|
private processAgentMessage;
|
|
242
264
|
private handleMessageFinish;
|
|
265
|
+
/** Handles sending a message to a text-type agent via SSE streaming. */
|
|
266
|
+
private _sendStreamMessage;
|
|
267
|
+
/** Handles sending a message to an object-type agent via a single non-streaming request.
|
|
268
|
+
* The response JSON is rendered as a fenced code block in the assistant message.
|
|
269
|
+
*/
|
|
270
|
+
private _sendObjectMessage;
|
|
243
271
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AgentChatComponent, never>;
|
|
244
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgentChatComponent, "c8y-agent-chat", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "suggestions": { "alias": "suggestions"; "required": false; "isSignal": true; }; "chatConfig": { "alias": "chatConfig"; "required": false; "isSignal": true; }; "welcomeTemplate": { "alias": "welcomeTemplate"; "required": false; "isSignal": true; }; "autoCreateAgents": { "alias": "autoCreateAgents"; "required": false; "isSignal": true; }; "variables": { "alias": "variables"; "required": false; "isSignal": true; }; "assistantMessageComponent": { "alias": "assistantMessageComponent"; "required": false; "isSignal": true; }; "assistantMessageDisplayConfig": { "alias": "assistantMessageDisplayConfig"; "required": false; "isSignal": true; }; "preprocessAgentMessage": { "alias": "preprocessAgentMessage"; "required": false; "isSignal": true; }; "pruneMessagesForAgent": { "alias": "pruneMessagesForAgent"; "required": false; "isSignal": true; }; "initialChatHistory": { "alias": "initialChatHistory"; "required": false; "isSignal": true; }; "groundingContextProvider": { "alias": "groundingContextProvider"; "required": false; "isSignal": true; }; "userAnalyticsContext": { "alias": "userAnalyticsContext"; "required": false; "isSignal": true; }; }, { "onMessageFinish": "onMessageFinish"; "onToolResult": "onToolResult"; "onFeedback": "onFeedback"; }, never, never, true, never>;
|
|
272
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgentChatComponent, "c8y-agent-chat", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "suggestions": { "alias": "suggestions"; "required": false; "isSignal": true; }; "chatConfig": { "alias": "chatConfig"; "required": false; "isSignal": true; }; "welcomeTemplate": { "alias": "welcomeTemplate"; "required": false; "isSignal": true; }; "autoCreateAgents": { "alias": "autoCreateAgents"; "required": false; "isSignal": true; }; "variables": { "alias": "variables"; "required": false; "isSignal": true; }; "assistantMessageComponent": { "alias": "assistantMessageComponent"; "required": false; "isSignal": true; }; "assistantMessageDisplayConfig": { "alias": "assistantMessageDisplayConfig"; "required": false; "isSignal": true; }; "preprocessAgentMessage": { "alias": "preprocessAgentMessage"; "required": false; "isSignal": true; }; "pruneMessagesForAgent": { "alias": "pruneMessagesForAgent"; "required": false; "isSignal": true; }; "skipHealthCheck": { "alias": "skipHealthCheck"; "required": false; "isSignal": true; }; "initialChatHistory": { "alias": "initialChatHistory"; "required": false; "isSignal": true; }; "groundingContextProvider": { "alias": "groundingContextProvider"; "required": false; "isSignal": true; }; "userAnalyticsContext": { "alias": "userAnalyticsContext"; "required": false; "isSignal": true; }; }, { "onMessageFinish": "onMessageFinish"; "onToolResult": "onToolResult"; "onFeedback": "onFeedback"; "onMessagesChange": "onMessagesChange"; }, never, never, true, never>;
|
|
245
273
|
}
|
|
246
274
|
|
|
247
275
|
declare class WidgetAiChatSectionComponent implements OnInit {
|
|
@@ -256,7 +284,7 @@ declare class WidgetAiChatSectionComponent implements OnInit {
|
|
|
256
284
|
prompt: string;
|
|
257
285
|
}>;
|
|
258
286
|
agent: string | ClientAgentDefinition;
|
|
259
|
-
chatConfig?: Partial<
|
|
287
|
+
chatConfig?: Partial<AgentChatConfig>;
|
|
260
288
|
/** Provide the specified `contextVariableName` as a variable that can be used in the prompt. */
|
|
261
289
|
useContextAsVariable: boolean;
|
|
262
290
|
contextVariableName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../../ai/agent-chat/agent-chat.component.ts","../../../ai/agent-chat/widget-ai-chat-section.component.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../../ai/agent-chat/agent-chat.component.ts","../../../ai/ag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A6B,aAAA,CAAA,cAAA;;AAE7B,+BAAuB,aAAA,CAAA,MAAA;AAIvB;;AAGA,0CAAoC,aAAA,CAAA,cAAA;;AAKpC;;AAEA;;AAKA,oDAA8C,aAAA,CAAA,cAAA;AAE9C;;;;;AAKG;gCACuB,aAAA,CAAA,cAAA;uBAKT,aAAA,CAAA,cAAA,CAAA,SAAA;;AAGjB,8BAAwB,aAAA,CAAA,MAAA;;;;AAarB;AAEH;;;AAGG;oDAC2C,aAAA,CAAA,MAAA;;;;;AAc3C;;AAGH;AACA;AAEA;AACA;AACA;AACA;;;;;AAMA;;AAMA;;;AAGG;;AAGG,gBAAA,OAAA;;AAWN;;;;;;;;AAQG;AACH,6BAAA,qBAAA,GAAA,WAAA;;;AAsDA;;;AAsCM,2BAAA,kBAAA,sBAAA,OAAA;;;;;;;AA+EN;;;;;;;AAOG;AACH;;;;;;;AA+FA;AAyDA;;;;;;AAMG;;AA4EH;;;AA4HA;;AAEG;;;;AA6DJ;;AC57BD,cAAA,4BAAA,YAAA,MAAA;AAOE;;;AAGG;;AAMH,yCAAmC,aAAA,CAAA,cAAA,CAAA,kCAAA;;;;AAGiB;AAEpD,oBAAA,qBAAA;AAEA,iBAAA,OAAA,CAAA,eAAA;;AAGA;AAEA;;AAGA;;;;;;;;;;;;;;;;AAgBG;AACH,uBAAA,UAAA;AACgC;AAAoB;AAAM;;;AAO5B;AAAoB;AAIlD;AACA;AACA;AACA;AAEA;;;;AAIG;;AAIH;;AAEG;AACG,gBAAA,OAAA;AAaN;;;AAGG;;;;AAoBJ;;;;"}
|
package/ai/ai-chat/index.d.ts
CHANGED
|
@@ -268,6 +268,11 @@ declare class AiChatComponent {
|
|
|
268
268
|
suggestionsTemplate?: TemplateRef<any>;
|
|
269
269
|
/** Template for customizing the welcome view using `<ng-template>`. */
|
|
270
270
|
welcomeTemplate?: TemplateRef<any>;
|
|
271
|
+
cumulativeUsage?: {
|
|
272
|
+
inputTokens: number;
|
|
273
|
+
outputTokens: number;
|
|
274
|
+
totalTokens: number;
|
|
275
|
+
};
|
|
271
276
|
/**
|
|
272
277
|
* Emitted when the user sends a message.
|
|
273
278
|
* Provides an AIMessage object with role, content, and timestamp.
|
|
@@ -308,7 +313,7 @@ declare class AiChatComponent {
|
|
|
308
313
|
*/
|
|
309
314
|
cancel(): void;
|
|
310
315
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiChatComponent, never>;
|
|
311
|
-
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; }; "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>;
|
|
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>;
|
|
312
317
|
}
|
|
313
318
|
|
|
314
319
|
export { AiChatAssistantMessageComponent, AiChatAssistantPartComponent, AiChatComponent, AiChatMessageActionComponent, AiChatMessageComponent, AiChatSuggestionComponent, AiChatToolCallComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;AAqBA;;;AAGG;;;;;;;;AAUF;AAED;;;AAGG;AACH;AAcE;;;AAGG;;AAGH;;AAEG;;AAGH;;;AAGG;AACH;AAEA;;AAEG;AACH;AAEA;;AA2GiB;AACE;AAxGjB;;AAYF;;;AAGG;AACH;AAIA;;;;AAIG;AACH;AA8BA;AAQA;;;;;AAKG;AACH;;;AAuBA;;;;;;;;;AASG;AACH;;;AAGC;AA8DD;;;;;;AAMG;AACH;;;AA0BD;;
|
|
1
|
+
{"version":3,"file":"index.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"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;AAqBA;;;AAGG;;;;;;;;AAUF;AAED;;;AAGG;AACH;AAcE;;;AAGG;;AAGH;;AAEG;;AAGH;;;AAGG;AACH;AAEA;;AAEG;AACH;AAEA;;AA2GiB;AACE;AAxGjB;;AAYF;;;AAGG;AACH;AAIA;;;;AAIG;AACH;AA8BA;AAQA;;;;;AAKG;AACH;;;AAuBA;;;;;;;;;AASG;AACH;;;AAGC;AA8DD;;;;;;AAMG;AACH;;;AA0BD;;AC1QD;AACA;;;;AAuBE;;;AAGG;;;AAIH;;;;AAKD;;AC7CD;;;AAGG;AACH;AAOE;;AAEG;AAEH;AAEA;;AAEG;AAEH;AAEA;;AAEG;AAEH;AAEA;;AAEG;;AAIH;;AAEG;AAEH;;;AACD;;ACpCD;;;;;AAKG;AACH;;;AAYE;AAEA;AAIA;;;;AAIG;;AAUH;;;;AAIG;;;;AAgBJ;;AC9DD;;;AAGG;AACH;AAQE;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;;;AAQJ;;ACjDD;AAcE;;;AAGG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAEH;;AAEG;;AAGH;;AAEG;;AAGH;AACA;AAEA;AAEA;;;;AAgCD;;ACpED;;;;AAIG;AACH;AAoBE;;;AAGG;AAEH;AAEA;;AAEG;AAEH;AAEA;;AAEG;AAEH;AAEA;;;;AAIG;AAEH;;AAGS;AAEA;;;;;AAMT;;;AAGG;AAEH;AAEA;;AAEG;AAEH;AAEA;;AAEG;;AAGH;;AAEG;AACH;;;;AAoCA;;;;;AAKG;;;AASH;;;;AAIG;AACH;AAWA;;;AAGG;AACH;;;AAGD;;;"}
|
package/ai/index.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ interface AIAssistantMessage {
|
|
|
29
29
|
content: AIMessagePart[];
|
|
30
30
|
timestamp?: string;
|
|
31
31
|
finishReason?: string;
|
|
32
|
+
usage?: {
|
|
33
|
+
inputTokens: number | undefined;
|
|
34
|
+
outputTokens: number | undefined;
|
|
35
|
+
totalTokens: number | undefined;
|
|
36
|
+
};
|
|
32
37
|
}
|
|
33
38
|
/** The part of an AI message representing a call to a tool (which may or may not have completed and a result is available). */
|
|
34
39
|
interface ToolCallPart<TInput extends Record<string, any> = Record<string, unknown>, TOutput = unknown> {
|
|
@@ -62,6 +67,9 @@ interface ToolCallPart<TInput extends Record<string, any> = Record<string, unkno
|
|
|
62
67
|
type AIMessagePart = {
|
|
63
68
|
type: 'text' | 'reasoning';
|
|
64
69
|
text: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: 'object';
|
|
72
|
+
jsonContent: string;
|
|
65
73
|
} | {
|
|
66
74
|
type: 'step-start';
|
|
67
75
|
} | ToolCallPart;
|
|
@@ -127,7 +135,7 @@ interface AgentDefinition {
|
|
|
127
135
|
[key: string]: any;
|
|
128
136
|
};
|
|
129
137
|
/** The tools this agent can use from the configured MCP servers. */
|
|
130
|
-
mcp
|
|
138
|
+
mcp?: Array<{
|
|
131
139
|
serverName: string;
|
|
132
140
|
tools: string[];
|
|
133
141
|
}>;
|
|
@@ -158,6 +166,15 @@ interface ChatConfig {
|
|
|
158
166
|
cancel: string;
|
|
159
167
|
};
|
|
160
168
|
}
|
|
169
|
+
/** Configuration for the `c8y-agent-chat` component. */
|
|
170
|
+
interface AgentChatConfig extends ChatConfig {
|
|
171
|
+
/** When true, shows cumulative token usage for the entire conversation. Default: false. */
|
|
172
|
+
showCumulativeUsage?: boolean;
|
|
173
|
+
/** When true, shows per-message token usage. Default: false. */
|
|
174
|
+
showUsagePerMessage?: boolean;
|
|
175
|
+
/** When true, shows a delete button on the last completed assistant message to remove the last exchange. Default: false. */
|
|
176
|
+
showDeleteAction?: boolean;
|
|
177
|
+
}
|
|
161
178
|
/** Configuration for how the `<ai-chat-assistant-message>` displays a calls for a specific tool name to the user. */
|
|
162
179
|
type ToolCallConfig = {
|
|
163
180
|
/**
|
|
@@ -283,6 +300,20 @@ type Suggestion = {
|
|
|
283
300
|
prompt: string;
|
|
284
301
|
icon?: SupportedIconsSuggestions;
|
|
285
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* Response from the non-streaming debug/test endpoint for object-type agents.
|
|
305
|
+
* Contains the structured JSON output plus usage information.
|
|
306
|
+
*/
|
|
307
|
+
interface ObjectAgentResponse {
|
|
308
|
+
/** The structured JSON object returned by the agent. */
|
|
309
|
+
object: Record<string, unknown>;
|
|
310
|
+
/** Token usage for this response. */
|
|
311
|
+
totalUsage?: {
|
|
312
|
+
inputTokens: number;
|
|
313
|
+
outputTokens: number;
|
|
314
|
+
totalTokens: number;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
286
317
|
interface AgentHealthCheckResponse {
|
|
287
318
|
/** This field indicates summarizes the most serious current health problem with the agent, or "ok" if none.
|
|
288
319
|
* This can be used to generate useful error messages in the front-end.
|
|
@@ -363,9 +394,18 @@ declare class AIService {
|
|
|
363
394
|
* @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).
|
|
364
395
|
* @returns Text response from the agent.
|
|
365
396
|
*/
|
|
366
|
-
text(name: string, messages: AIMessage[], variables:
|
|
367
|
-
|
|
368
|
-
|
|
397
|
+
text(name: string, messages: AIMessage[], variables: Record<string, unknown>, fromApp?: string): Promise<string>;
|
|
398
|
+
/**
|
|
399
|
+
* Send messages to an object-type agent via the non-streaming test endpoint.
|
|
400
|
+
* Object agents return a single structured JSON response rather than a stream.
|
|
401
|
+
*
|
|
402
|
+
* @param agent A ClientAgentDefinition with `snapshot: true` (required for test endpoint).
|
|
403
|
+
* @param messages Messages to send
|
|
404
|
+
* @param variables Variables to include
|
|
405
|
+
* @param abortController An AbortController to cancel the request.
|
|
406
|
+
* @returns The full response including the structured object and usage information.
|
|
407
|
+
*/
|
|
408
|
+
callObjectAgent(agent: string | ClientAgentDefinition, messages: AIMessage[], variables: Record<string, unknown>, abortController: AbortController): Promise<ObjectAgentResponse>;
|
|
369
409
|
/**
|
|
370
410
|
* Stream a text message to the agent.
|
|
371
411
|
* @param agent Agent name or an agent definition.
|
|
@@ -460,5 +500,5 @@ declare class AIService {
|
|
|
460
500
|
declare function defaultPruneMessagesForAgent(messages: AIMessage[]): AIMessage[];
|
|
461
501
|
|
|
462
502
|
export { AIService, DataStreamType, defaultPruneMessagesForAgent };
|
|
463
|
-
export type { AIAssistantMessage, AIMessage, AIMessagePart, AIStreamResponse, AISystemMessage, AIUserMessage, AgentDefinition, AgentHealthCheckResponse, AssistantMessageDisplayConfig, ChatConfig, ChatHistory, ChatHistoryConfig, ClientAgentDefinition, ResponseMetadataPart, Suggestion, ToolCallConfig, ToolCallPart, WidgetAiChatSectionComponentConfig, pruneMessagesFunction };
|
|
503
|
+
export type { AIAssistantMessage, AIMessage, AIMessagePart, AIStreamResponse, AISystemMessage, AIUserMessage, AgentChatConfig, AgentDefinition, AgentHealthCheckResponse, AssistantMessageDisplayConfig, ChatConfig, ChatHistory, ChatHistoryConfig, ClientAgentDefinition, ObjectAgentResponse, ResponseMetadataPart, Suggestion, ToolCallConfig, ToolCallPart, WidgetAiChatSectionComponentConfig, pruneMessagesFunction };
|
|
464
504
|
//# sourceMappingURL=index.d.ts.map
|
package/ai/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../ai/ai.model.ts","../../ai/ai.service.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;;AAIA;;AAEG;AACG;AAEN;;AAEG;AACG;;;;;AAMN;AACM;;;;;AAMN;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../ai/ai.model.ts","../../ai/ai.service.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;;AAIA;;AAEG;AACG;AAEN;;AAEG;AACG;;;;;AAMN;AACM;;;;;AAMN;;;;;;AASE;AACE;AACA;AACA;;AAEH;AAKD;AACM;;AAKJ;;;;;AAKA;;;AAGG;;AAEH;;;;AAIG;;AAGH;;;;AAIG;AACH;;;AAID;AAED;AACM;AACA;;;;;;;AAEoB;AAG1B;AACM;;;;;;;;AAO+C;;AAGrD;;;AAGG;AACG;;AAEJ;;;;;;;AAOG;AACH;;;AAIA;;;;AAIG;;AAEH;;AAEG;;AAEH;;AAEG;;AAEJ;AAED;;;AAGG;;;;AAKD;;;AAGG;AACH;AAEA;;;;AAIE;;;;;;AAIiD;AACpD;AAED;;;;;;;;;AASE;;;;AAIA;;;;AAIA;;;;AAKA;;;;AAC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