@m6d/cortex-angular 0.15.1 → 0.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-angular",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "description": "Angular chat widget for Cortex agents",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -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
- /** The open thread's title; null on a new chat. */
287
- title: string | null;
288
- /** `agentName` in the widget's locale. */
289
- agentName: string | undefined;
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
  };
@@ -490,6 +493,8 @@ type TokenUsage$1 = {
490
493
  * The widget hides UI for anything absent; Cortex enforces each.
491
494
  */
492
495
  export type AgentCapabilities$1 = {
496
+ /** The agent's display name per locale, which titles a new chat; `{}` for an agent without one. */
497
+ displayName: Partial<LocalizedText$1>;
493
498
  attachments: boolean;
494
499
  /**
495
500
  * False when this caller may not send to the chat: the agent's `message`
@@ -515,6 +520,7 @@ type Suggestion$1 = {
515
520
  };
516
521
  type Suggestions$1 = Record<Locale$1, Suggestion$1[]>;
517
522
  type Greeting$1 = Record<Locale$1, string>;
523
+ type LocalizedText$1 = Record<Locale$1, string>;
518
524
  /**
519
525
  * Response of `POST /chat/:threadId/tools/:toolCallId/initiate` for a pending
520
526
  * call stamped with an embed. The payload is for the widget only; it never
@@ -599,7 +605,7 @@ declare class CortexChatService {
599
605
  readonly debugMode: import("@angular/core").Signal<boolean>;
600
606
  readonly turnFailure: import("@angular/core").Signal<TurnFailure | undefined>;
601
607
  /** 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"> & {
608
+ readonly parts: import("@angular/core").Signal<Pick<CortexWidgetState, "threads" | "capabilities" | "debugMode" | "displayName" | "selected"> & {
603
609
  isWorking: boolean;
604
610
  }>;
605
611
  constructor();
@@ -621,8 +627,7 @@ export declare class CortexChatWidgetComponent implements OnInit {
621
627
  chatHeader: {
622
628
  screen: "chat" | "threads";
623
629
  viewMode: CortexViewMode;
624
- title: string | null;
625
- agentName: string | undefined;
630
+ title: string;
626
631
  threadCount: number | undefined;
627
632
  isWorking: boolean;
628
633
  debug: {
@@ -637,8 +642,7 @@ export declare class CortexChatWidgetComponent implements OnInit {
637
642
  threadsHeader: {
638
643
  screen: "chat" | "threads";
639
644
  viewMode: CortexViewMode;
640
- title: string | null;
641
- agentName: string | undefined;
645
+ title: string;
642
646
  threadCount: number | undefined;
643
647
  isWorking: boolean;
644
648
  debug: {
@@ -695,7 +699,7 @@ export type SlotTemplateContext<Slot extends SlotName> = {
695
699
  *
696
700
  * <cortex-chat-widget [config]="config">
697
701
  * <ng-template cortexSlot="header" let-chat>
698
- * <div class="cortex-widget__chat-header">{{ chat.title ?? chat.agentName }}</div>
702
+ * <div class="cortex-widget__chat-header">{{ chat.title }}</div>
699
703
  * </ng-template>
700
704
  * </cortex-chat-widget>
701
705
  */