@m6d/cortex-angular 0.15.2 → 0.17.0
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/README.md +4 -6
- package/fesm2022/m6d-cortex-angular.mjs +529 -28
- package/package.json +3 -3
- package/types/m6d-cortex-angular.d.ts +38 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m6d/cortex-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Angular chat widget for Cortex agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"@angular/common": ">=21.2.0 <23",
|
|
22
22
|
"@angular/core": ">=21.2.0 <23",
|
|
23
23
|
"@angular/platform-browser": ">=21.2.0 <23",
|
|
24
|
-
"@tanstack/ai": ">=0.
|
|
25
|
-
"@tanstack/ai-client": ">=0.
|
|
24
|
+
"@tanstack/ai": ">=1.0.0 <2.0.0",
|
|
25
|
+
"@tanstack/ai-client": ">=1.0.0 <2.0.0",
|
|
26
26
|
"dompurify": "^3.0.0",
|
|
27
27
|
"highlight.js": "^11.0.0",
|
|
28
28
|
"leaflet": "^1.9.0",
|
|
@@ -80,6 +80,8 @@ export type TokenUsage = {
|
|
|
80
80
|
* The widget hides UI for anything absent; Cortex enforces each.
|
|
81
81
|
*/
|
|
82
82
|
export type AgentCapabilities = {
|
|
83
|
+
/** The agent's display name per locale, which titles a new chat; `{}` for an agent without one. */
|
|
84
|
+
displayName: Partial<LocalizedText>;
|
|
83
85
|
attachments: boolean;
|
|
84
86
|
/**
|
|
85
87
|
* False when this caller may not send to the chat: the agent's `message`
|
|
@@ -121,6 +123,8 @@ export type Suggestion = {
|
|
|
121
123
|
/** The manifest's suggestion and greeting schemas are built from these. */
|
|
122
124
|
export type Suggestions = Record<Locale, Suggestion[]>;
|
|
123
125
|
export type Greeting = Record<Locale, string>;
|
|
126
|
+
/** Author-written copy the widget shows verbatim, one string per locale. */
|
|
127
|
+
export type LocalizedText = Record<Locale, string>;
|
|
124
128
|
export type TriggerFiringSummary = {
|
|
125
129
|
name: string;
|
|
126
130
|
firingId: string;
|
|
@@ -203,8 +207,6 @@ export type MediaRenderContext = {
|
|
|
203
207
|
*/
|
|
204
208
|
export type MediaRenderer = (host: HTMLElement, source: string, context: MediaRenderContext) => Promise<() => void>;
|
|
205
209
|
export type MediaRenderers = Partial<Record<string, MediaRenderer>>;
|
|
206
|
-
/** One value for every locale, or a map keyed by locale ('en', 'ar'). */
|
|
207
|
-
export type Localized<T> = T | Partial<Record<Locale, T>>;
|
|
208
210
|
export type CortexViewMode = "helper" | "full";
|
|
209
211
|
export type CortexTheme = "light" | "dark" | "system";
|
|
210
212
|
export type CortexToolCallContext = {
|
|
@@ -252,12 +254,6 @@ export type CortexConfig = {
|
|
|
252
254
|
* fence tag; `map` swaps the built-in Leaflet map for another provider.
|
|
253
255
|
*/
|
|
254
256
|
mediaRenderers?: MediaRenderers;
|
|
255
|
-
/**
|
|
256
|
-
* Chat header title while no thread is selected; defaults to a localized
|
|
257
|
-
* "New Chat". Like the other copy props, either one value for every locale
|
|
258
|
-
* or a map keyed by locale (`{ en: 'Support', ar: 'الدعم' }`).
|
|
259
|
-
*/
|
|
260
|
-
agentName?: Localized<string>;
|
|
261
257
|
/**
|
|
262
258
|
* A thread to open when the widget mounts, by id, once the thread list holds
|
|
263
259
|
* it: a deep link into one conversation, such as the console's inspector.
|
|
@@ -283,10 +279,11 @@ export type CortexConfig = {
|
|
|
283
279
|
export type CortexHeaderContext = {
|
|
284
280
|
screen: "chat" | "threads";
|
|
285
281
|
viewMode: CortexViewMode;
|
|
286
|
-
/**
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
282
|
+
/**
|
|
283
|
+
* The open thread's title, else the agent's display name in the widget's
|
|
284
|
+
* locale, else the built-in "New Chat"; empty while the handshake is out.
|
|
285
|
+
*/
|
|
286
|
+
title: string;
|
|
290
287
|
/** How many conversations the history lists; undefined while the first load is out. */
|
|
291
288
|
threadCount: number | undefined;
|
|
292
289
|
isWorking: boolean;
|
|
@@ -404,6 +401,12 @@ export type CortexWidgetState = {
|
|
|
404
401
|
session: ChatSessionState;
|
|
405
402
|
/** What Cortex offers this agent's clients; undefined until the handshake answers. */
|
|
406
403
|
capabilities: AgentCapabilities | undefined;
|
|
404
|
+
/**
|
|
405
|
+
* The agent's display name from the last handshake answered, kept while a
|
|
406
|
+
* new one is out; `{}` once the first try fails. Undefined only before the
|
|
407
|
+
* first answer or miss.
|
|
408
|
+
*/
|
|
409
|
+
displayName: AgentCapabilities["displayName"] | undefined;
|
|
407
410
|
/** Why the handshake has not answered yet, once a try has failed. */
|
|
408
411
|
unanswered: Unanswered | undefined;
|
|
409
412
|
/** The files held for the next message. */
|
|
@@ -420,7 +423,7 @@ export type CortexWidgetState = {
|
|
|
420
423
|
* one of its fields changes, which a streamed chunk does only as the turn
|
|
421
424
|
* starts and stops working, so a framework redraws them only then.
|
|
422
425
|
*/
|
|
423
|
-
parts: Pick<CortexWidgetState, "threads" | "selected" | "capabilities" | "debugMode"> & {
|
|
426
|
+
parts: Pick<CortexWidgetState, "threads" | "selected" | "capabilities" | "displayName" | "debugMode"> & {
|
|
424
427
|
isWorking: boolean;
|
|
425
428
|
};
|
|
426
429
|
};
|
|
@@ -485,11 +488,24 @@ type TokenUsage$1 = {
|
|
|
485
488
|
};
|
|
486
489
|
total: number;
|
|
487
490
|
};
|
|
491
|
+
/**
|
|
492
|
+
* Response of `GET /connections/:server?call=<toolCallId>`: where the
|
|
493
|
+
* caller's own account stands with the agent's MCP server of that name, for
|
|
494
|
+
* the card of that `connectAccount` call. `connected` with all a sign-in
|
|
495
|
+
* may ask for; `pending` while it is not connected, or lacks access a
|
|
496
|
+
* sign-in may still grant; `refused` once the card's own sign-in came back
|
|
497
|
+
* without it, or no sign-in may ask again.
|
|
498
|
+
*/
|
|
499
|
+
export type AccountConnection$1 = {
|
|
500
|
+
status: "connected" | "pending" | "refused";
|
|
501
|
+
};
|
|
488
502
|
/**
|
|
489
503
|
* What Cortex offers this agent's clients, fetched once at widget startup.
|
|
490
504
|
* The widget hides UI for anything absent; Cortex enforces each.
|
|
491
505
|
*/
|
|
492
506
|
export type AgentCapabilities$1 = {
|
|
507
|
+
/** The agent's display name per locale, which titles a new chat; `{}` for an agent without one. */
|
|
508
|
+
displayName: Partial<LocalizedText$1>;
|
|
493
509
|
attachments: boolean;
|
|
494
510
|
/**
|
|
495
511
|
* False when this caller may not send to the chat: the agent's `message`
|
|
@@ -515,6 +531,7 @@ type Suggestion$1 = {
|
|
|
515
531
|
};
|
|
516
532
|
type Suggestions$1 = Record<Locale$1, Suggestion$1[]>;
|
|
517
533
|
type Greeting$1 = Record<Locale$1, string>;
|
|
534
|
+
type LocalizedText$1 = Record<Locale$1, string>;
|
|
518
535
|
/**
|
|
519
536
|
* Response of `POST /chat/:threadId/tools/:toolCallId/initiate` for a pending
|
|
520
537
|
* call stamped with an embed. The payload is for the widget only; it never
|
|
@@ -551,6 +568,7 @@ declare class CortexChatService {
|
|
|
551
568
|
listLlmRequests(threadId: string, messageId: string): Promise<LlmRequest$1[]>;
|
|
552
569
|
abortStream(threadId: string): Promise<AbortRunResult$1>;
|
|
553
570
|
initiateToolCall(threadId: string, toolCallId: string): Promise<ClientToolInitiateResult$1>;
|
|
571
|
+
accountConnection(server: string, toolCallId: string, signal?: AbortSignal): Promise<AccountConnection$1>;
|
|
554
572
|
uploadAttachment(threadId: string, file: File): Promise<AttachmentSummary$1>;
|
|
555
573
|
deleteAttachment(id: string): Promise<void>;
|
|
556
574
|
downloadAttachment(id: string): Promise<{
|
|
@@ -599,7 +617,7 @@ declare class CortexChatService {
|
|
|
599
617
|
readonly debugMode: import("@angular/core").Signal<boolean>;
|
|
600
618
|
readonly turnFailure: import("@angular/core").Signal<TurnFailure | undefined>;
|
|
601
619
|
/** What the header, landing and history are drawn from: a streamed chunk leaves it as it was. */
|
|
602
|
-
readonly parts: import("@angular/core").Signal<Pick<CortexWidgetState, "threads" | "capabilities" | "debugMode" | "selected"> & {
|
|
620
|
+
readonly parts: import("@angular/core").Signal<Pick<CortexWidgetState, "threads" | "capabilities" | "debugMode" | "displayName" | "selected"> & {
|
|
603
621
|
isWorking: boolean;
|
|
604
622
|
}>;
|
|
605
623
|
constructor();
|
|
@@ -610,6 +628,8 @@ declare class CortexChatService {
|
|
|
610
628
|
export declare class CortexChatWidgetComponent implements OnInit {
|
|
611
629
|
readonly config: import("@angular/core").InputSignal<CortexAngularConfig>;
|
|
612
630
|
protected readonly direction: import("@angular/core").Signal<"ltr" | "rtl">;
|
|
631
|
+
protected readonly viewMode: import("@angular/core").Signal<CortexViewMode>;
|
|
632
|
+
private readonly container;
|
|
613
633
|
private readonly landingComposer;
|
|
614
634
|
/** The consumer's own parts by slot; each replaces the widget's default and gets the same context. */
|
|
615
635
|
private readonly slotDirectives;
|
|
@@ -621,8 +641,7 @@ export declare class CortexChatWidgetComponent implements OnInit {
|
|
|
621
641
|
chatHeader: {
|
|
622
642
|
screen: "chat" | "threads";
|
|
623
643
|
viewMode: CortexViewMode;
|
|
624
|
-
title: string
|
|
625
|
-
agentName: string | undefined;
|
|
644
|
+
title: string;
|
|
626
645
|
threadCount: number | undefined;
|
|
627
646
|
isWorking: boolean;
|
|
628
647
|
debug: {
|
|
@@ -637,8 +656,7 @@ export declare class CortexChatWidgetComponent implements OnInit {
|
|
|
637
656
|
threadsHeader: {
|
|
638
657
|
screen: "chat" | "threads";
|
|
639
658
|
viewMode: CortexViewMode;
|
|
640
|
-
title: string
|
|
641
|
-
agentName: string | undefined;
|
|
659
|
+
title: string;
|
|
642
660
|
threadCount: number | undefined;
|
|
643
661
|
isWorking: boolean;
|
|
644
662
|
debug: {
|
|
@@ -669,6 +687,7 @@ export declare class CortexChatWidgetComponent implements OnInit {
|
|
|
669
687
|
}>;
|
|
670
688
|
protected readonly composerSlot: import("@angular/core").Signal<"translate_access_refused" | "translate_visitor_unverified" | "translate_agent_unreachable" | "translate_agent_missing" | "composer" | "translate_read_only" | "translate_messages_disabled" | undefined>;
|
|
671
689
|
private readonly injector;
|
|
690
|
+
constructor();
|
|
672
691
|
ngOnInit(): void;
|
|
673
692
|
protected onWidgetDragOver(event: DragEvent): void;
|
|
674
693
|
protected onWidgetDrop(event: DragEvent): void;
|
|
@@ -695,7 +714,7 @@ export type SlotTemplateContext<Slot extends SlotName> = {
|
|
|
695
714
|
*
|
|
696
715
|
* <cortex-chat-widget [config]="config">
|
|
697
716
|
* <ng-template cortexSlot="header" let-chat>
|
|
698
|
-
* <div class="cortex-widget__chat-header">{{ chat.title
|
|
717
|
+
* <div class="cortex-widget__chat-header">{{ chat.title }}</div>
|
|
699
718
|
* </ng-template>
|
|
700
719
|
* </cortex-chat-widget>
|
|
701
720
|
*/
|