mesauth-angular 1.22.0 → 1.24.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": "mesauth-angular",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "Angular helper library to connect to a backend API and SignalR hub to surface the current logged-in user and incoming notifications with dark/light theme support",
5
5
  "keywords": [
6
6
  "angular",
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { InjectionToken, EnvironmentProviders, AfterViewInit, OnDestroy, ElementRef, PipeTransform } from '@angular/core';
2
+ import { InjectionToken, EnvironmentProviders, AfterViewInit, OnDestroy, ElementRef, OnInit, PipeTransform } from '@angular/core';
3
3
  import { HttpClient, HttpInterceptorFn, HttpResponse, HttpParams } from '@angular/common/http';
4
4
  import { Observable, OperatorFunction } from 'rxjs';
5
5
  import { Router } from '@angular/router';
@@ -245,9 +245,18 @@ declare class MesAuthService {
245
245
  }
246
246
 
247
247
  /**
248
- * Functional HTTP interceptor for handling 401/403 auth errors.
249
- * Redirects to login page on 401, and to 403 page on 403.
250
- * Includes loopback prevention to avoid infinite redirects.
248
+ * Functional HTTP interceptor.
249
+ *
250
+ * Responsibilities:
251
+ * 1. Attach `Authorization: Bearer` + `X-Refresh-Token` from localStorage to requests
252
+ * targeting the auth server / trusted hosts (so the server-side Authorizer middleware
253
+ * can perform silent refresh and emit X-Refreshed-* response headers).
254
+ * 2. On every successful response, if `X-Refreshed-Token` is present, write it to
255
+ * localStorage exactly once (dedup across parallel responses).
256
+ * 3. On 401, queue concurrent failures behind a single 1.5s wait so only ONE retry
257
+ * fires per refresh window. Retries strip the stale auth headers so the interceptor
258
+ * re-reads the freshly-stored tokens from localStorage.
259
+ * 4. On 403, redirect to /403.
251
260
  */
252
261
  declare const mesAuthInterceptor: HttpInterceptorFn;
253
262
 
@@ -303,6 +312,7 @@ declare class UserProfileComponent {
303
312
  readonly pendingApprovalCount: _angular_core.WritableSignal<number>;
304
313
  readonly dropdownOpen: _angular_core.WritableSignal<boolean>;
305
314
  readonly avatarRefresh: _angular_core.WritableSignal<number>;
315
+ readonly lessonsOpen: _angular_core.WritableSignal<boolean>;
306
316
  readonly navAvatarSize: _angular_core.Signal<AvatarSize>;
307
317
  readonly dropAvatarSize: _angular_core.Signal<AvatarSize>;
308
318
  readonly avatarShape: _angular_core.Signal<"circle" | "rounded" | "rectangle" | "portrait">;
@@ -330,6 +340,8 @@ declare class UserProfileComponent {
330
340
  private openInNewTabIfSameOrigin;
331
341
  onLogout(): void;
332
342
  onNotificationClick(): void;
343
+ openLessons(): void;
344
+ closeLessons(): void;
333
345
  onSigErr(_ev: Event): void;
334
346
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserProfileComponent, never>;
335
347
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserProfileComponent, "ma-user-profile", never, { "inputAvatarShape": { "alias": "inputAvatarShape"; "required": false; "isSignal": true; }; "showBell": { "alias": "showBell"; "required": false; "isSignal": true; }; "showApproval": { "alias": "showApproval"; "required": false; "isSignal": true; }; "showName": { "alias": "showName"; "required": false; "isSignal": true; }; "showAi": { "alias": "showAi"; "required": false; "isSignal": true; }; "showSignature": { "alias": "showSignature"; "required": false; "isSignal": true; }; "signatureHeight": { "alias": "signatureHeight"; "required": false; "isSignal": true; }; }, { "notificationClick": "notificationClick"; "approvalClick": "approvalClick"; "aiClick": "aiClick"; }, never, ["*"], true, never>;
@@ -612,6 +624,51 @@ interface ChatToolEvent {
612
624
  args?: any;
613
625
  readOnly?: boolean;
614
626
  }
627
+ /** Summary row in the user's conversation history list. */
628
+ interface AiConversationSummary {
629
+ id: string;
630
+ title: string | null;
631
+ appName: string | null;
632
+ originRoute: string | null;
633
+ createdAt: string;
634
+ updatedAt: string;
635
+ messageCount: number;
636
+ }
637
+ /** One stored message from a past conversation (resume payload). */
638
+ interface AiStoredMessage {
639
+ sequence: number;
640
+ role: 'user' | 'assistant' | 'tool' | string;
641
+ content: string | null;
642
+ toolCalls?: AiStoredToolCall[] | null;
643
+ toolCallId?: string | null;
644
+ toolIsError: boolean;
645
+ createdAt: string;
646
+ }
647
+ interface AiStoredToolCall {
648
+ id: string;
649
+ name: string;
650
+ args: any;
651
+ side: 'server' | 'client' | string;
652
+ }
653
+ /** Full transcript returned by GET /ai/conversations/{id}. */
654
+ interface AiConversationDetail {
655
+ id: string;
656
+ title: string | null;
657
+ appName: string | null;
658
+ originRoute: string | null;
659
+ createdAt: string;
660
+ updatedAt: string;
661
+ messages: AiStoredMessage[];
662
+ }
663
+ /** Per-user "lesson" injected into the system prompt every turn. */
664
+ interface AiUserLesson {
665
+ id: string;
666
+ text: string;
667
+ enabled: boolean;
668
+ source: 'user' | 'llm' | string;
669
+ createdAt: string;
670
+ updatedAt: string;
671
+ }
615
672
  /** Stream event types matching MesAuth.Api's AiStreamEvent JSON. */
616
673
  type AiSseEvent = {
617
674
  type: 'session';
@@ -697,6 +754,29 @@ declare class MaAiService {
697
754
  private verbOf;
698
755
  private summarize;
699
756
  private uid;
757
+ /** GET /ai/conversations — list this user's past conversations (most recent first). */
758
+ listConversations(take?: number): Promise<AiConversationSummary[]>;
759
+ /** GET /ai/conversations/{id} — fetch and hydrate a past conversation into the panel. */
760
+ resumeConversation(id: string): Promise<boolean>;
761
+ /** DELETE /ai/conversations/{id} */
762
+ deleteConversation(id: string): Promise<boolean>;
763
+ listLessons(): Promise<AiUserLesson[]>;
764
+ createLesson(text: string): Promise<AiUserLesson | null>;
765
+ updateLesson(id: string, patch: {
766
+ text?: string;
767
+ enabled?: boolean;
768
+ }): Promise<AiUserLesson | null>;
769
+ deleteLesson(id: string): Promise<boolean>;
770
+ private baseUrl;
771
+ private apiGet;
772
+ private apiSend;
773
+ /**
774
+ * Rebuild ChatBubble[] from a stored transcript. Tool messages don't appear as their
775
+ * own bubbles — they were emitted as chips on the preceding assistant bubble — but we
776
+ * reconstruct that linkage best-effort so the resumed view roughly matches what the
777
+ * user originally saw.
778
+ */
779
+ private hydrateBubbles;
700
780
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiService, never>;
701
781
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<MaAiService>;
702
782
  }
@@ -710,6 +790,7 @@ declare class MaAiChatPanelComponent implements AfterViewInit, OnDestroy {
710
790
  readonly isOpen: _angular_core.WritableSignal<boolean>;
711
791
  readonly width: _angular_core.WritableSignal<number>;
712
792
  readonly draft: _angular_core.WritableSignal<string>;
793
+ readonly historyOpen: _angular_core.WritableSignal<boolean>;
713
794
  readonly ai: MaAiService;
714
795
  private readonly router;
715
796
  private readonly themeService;
@@ -737,6 +818,8 @@ declare class MaAiChatPanelComponent implements AfterViewInit, OnDestroy {
737
818
  close(): void;
738
819
  toggle(): void;
739
820
  newConversation(): void;
821
+ toggleHistory(): void;
822
+ onHistoryResumed(_id: string): void;
740
823
  send(): void;
741
824
  cancel(): void;
742
825
  onTextareaKey(ev: KeyboardEvent): void;
@@ -1057,7 +1140,7 @@ interface MaUiManifest {
1057
1140
  quickPrompts?: string[];
1058
1141
  }
1059
1142
  /** Current installed package version — keep in sync with package.json. */
1060
- declare const PACKAGE_VERSION = "1.21.0";
1143
+ declare const PACKAGE_VERSION = "1.24.0";
1061
1144
  /**
1062
1145
  * Provides server-driven UI configuration loaded from the hosted manifest.
1063
1146
  * Components read `labels()` and `features()` signals instead of hardcoded strings.
@@ -1282,6 +1365,56 @@ declare class MaAiButtonComponent {
1282
1365
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaAiButtonComponent, "ma-ai-button", never, {}, { "clicked": "clicked"; }, never, never, true, never>;
1283
1366
  }
1284
1367
 
1368
+ /**
1369
+ * Drop-down list of the signed-in user's recent AI conversations.
1370
+ * Lives inside the chat panel header (toggled by the History button).
1371
+ */
1372
+ declare class MaAiHistoryListComponent implements OnInit {
1373
+ private readonly ai;
1374
+ readonly conversations: _angular_core.WritableSignal<AiConversationSummary[]>;
1375
+ readonly loading: _angular_core.WritableSignal<boolean>;
1376
+ /** Emitted after the user picks a row and the panel finishes hydrating. */
1377
+ readonly resumed: _angular_core.OutputEmitterRef<string>;
1378
+ ngOnInit(): void;
1379
+ refresh(): Promise<void>;
1380
+ pick(c: AiConversationSummary): Promise<void>;
1381
+ remove(c: AiConversationSummary): Promise<void>;
1382
+ relative(iso: string): string;
1383
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiHistoryListComponent, never>;
1384
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaAiHistoryListComponent, "ma-ai-history-list", never, {}, { "resumed": "resumed"; }, never, never, true, never>;
1385
+ }
1386
+
1387
+ /**
1388
+ * Modal editor for the signed-in user's AI "lessons" — long-lived instructions
1389
+ * injected into the LLM system prompt every turn. Opened from the user profile
1390
+ * dropdown via a dedicated button.
1391
+ *
1392
+ * Library-only styling (no @angular/forms — we use [value] + (input) per
1393
+ * mesauth-angular conventions).
1394
+ */
1395
+ declare class MaAiLessonsEditorComponent implements OnInit {
1396
+ private readonly ai;
1397
+ private readonly themeService;
1398
+ readonly lessons: _angular_core.WritableSignal<AiUserLesson[]>;
1399
+ readonly loading: _angular_core.WritableSignal<boolean>;
1400
+ readonly saving: _angular_core.WritableSignal<boolean>;
1401
+ readonly draft: _angular_core.WritableSignal<string>;
1402
+ readonly error: _angular_core.WritableSignal<string>;
1403
+ readonly cancel: _angular_core.OutputEmitterRef<void>;
1404
+ private pendingText;
1405
+ get themeClass(): string;
1406
+ ngOnInit(): Promise<void>;
1407
+ onBackdropClick(ev: MouseEvent): void;
1408
+ onDraftInput(ev: Event): void;
1409
+ add(): Promise<void>;
1410
+ onTextInput(lesson: AiUserLesson, ev: Event): void;
1411
+ commitText(lesson: AiUserLesson): Promise<void>;
1412
+ toggle(lesson: AiUserLesson, ev: Event): Promise<void>;
1413
+ remove(lesson: AiUserLesson): Promise<void>;
1414
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiLessonsEditorComponent, never>;
1415
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaAiLessonsEditorComponent, "ma-ai-lessons-editor", never, {}, { "cancel": "cancel"; }, never, never, true, never>;
1416
+ }
1417
+
1285
1418
  /**
1286
1419
  * Tiny hand-rolled GitHub-flavoured Markdown renderer for AI chat bubbles.
1287
1420
  *
@@ -1304,5 +1437,5 @@ declare class MaAiMarkdownPipe implements PipeTransform {
1304
1437
  }
1305
1438
  declare function renderMarkdown(src: string): string;
1306
1439
 
1307
- export { ALL_ACTIONS, AVATAR_FRAMES, ApprovalActionType, ApprovalDocumentStatus, ApprovalStepMode, ApprovalStepStatus, DEFAULT_AI_CONFIG, MES_AUTH_AI_CONFIG, MES_AUTH_CONFIG, MaAiButtonComponent, MaAiChatPanelComponent, MaAiMarkdownPipe, MaAiService, MaAiToolsRegistry, MaApprovalPanelComponent, MaApprovalService, MaArvContainerComponent, MaAvatarComponent, MaIconComponent, MaThemeDirective, MaUiConfigService, MaUserComponent, MaUserMenuColor, MaUserMenuComponent, MaUserXComponent, MesAuthModule, MesAuthService, NotificationBadgeComponent, NotificationPanelComponent, NotificationType, PACKAGE_VERSION, ThemeService, ToastContainerComponent, ToastService, UserProfileComponent, extractXMaPerm, mesAuthInterceptor, provideMesAuth, provideMesAuthAi, renderMarkdown, runReturnViaPostMessageIfRequested, runSsoCheckHandshake, withXMaPerm, xMaResource };
1308
- export type { AiSseEvent, ApprovalDashboardDto, ApprovalDocumentDto, ApprovalDocumentSummaryDto, ApprovalHistoryDto, ApprovalReferenceDto, ApprovalStepDto, ApprovalStepRequest, ApprovalSubmitResult, ApprovalTemplateDto, ApprovalTemplateStepDto, ApprovalTemplateSummaryDto, ApproveRejectRequest, AvatarFrameDef, AvatarShape, AvatarSize, ChatBubble, ChatToolEvent, ClientTool, ClientToolSchema, CreateApprovalRequest, CreateApprovalResponseDto, CreateApprovalTemplateRequest, DelegateRequest, FrontEndRoute, IUser, MaAiPanelMode, MaUiManifest, MesAuthAiConfig, MesAuthConfig, NotificationDto, PagedList, PendingApproval, PermissionHeader, RealTimeNotificationDto, RequestConfig, RolePreviewUserDto, StepRoleDto, Theme, Toast, UpdateApprovalTemplateRequest, UserFrontEndRoutesGrouped };
1440
+ export { ALL_ACTIONS, AVATAR_FRAMES, ApprovalActionType, ApprovalDocumentStatus, ApprovalStepMode, ApprovalStepStatus, DEFAULT_AI_CONFIG, MES_AUTH_AI_CONFIG, MES_AUTH_CONFIG, MaAiButtonComponent, MaAiChatPanelComponent, MaAiHistoryListComponent, MaAiLessonsEditorComponent, MaAiMarkdownPipe, MaAiService, MaAiToolsRegistry, MaApprovalPanelComponent, MaApprovalService, MaArvContainerComponent, MaAvatarComponent, MaIconComponent, MaThemeDirective, MaUiConfigService, MaUserComponent, MaUserMenuColor, MaUserMenuComponent, MaUserXComponent, MesAuthModule, MesAuthService, NotificationBadgeComponent, NotificationPanelComponent, NotificationType, PACKAGE_VERSION, ThemeService, ToastContainerComponent, ToastService, UserProfileComponent, extractXMaPerm, mesAuthInterceptor, provideMesAuth, provideMesAuthAi, renderMarkdown, runReturnViaPostMessageIfRequested, runSsoCheckHandshake, withXMaPerm, xMaResource };
1441
+ export type { AiConversationDetail, AiConversationSummary, AiSseEvent, AiStoredMessage, AiStoredToolCall, AiUserLesson, ApprovalDashboardDto, ApprovalDocumentDto, ApprovalDocumentSummaryDto, ApprovalHistoryDto, ApprovalReferenceDto, ApprovalStepDto, ApprovalStepRequest, ApprovalSubmitResult, ApprovalTemplateDto, ApprovalTemplateStepDto, ApprovalTemplateSummaryDto, ApproveRejectRequest, AvatarFrameDef, AvatarShape, AvatarSize, ChatBubble, ChatToolEvent, ClientTool, ClientToolSchema, CreateApprovalRequest, CreateApprovalResponseDto, CreateApprovalTemplateRequest, DelegateRequest, FrontEndRoute, IUser, MaAiPanelMode, MaUiManifest, MesAuthAiConfig, MesAuthConfig, NotificationDto, PagedList, PendingApproval, PermissionHeader, RealTimeNotificationDto, RequestConfig, RolePreviewUserDto, StepRoleDto, Theme, Toast, UpdateApprovalTemplateRequest, UserFrontEndRoutesGrouped };