mesauth-angular 1.17.2 → 1.19.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.
|
|
3
|
+
"version": "1.19.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,10 +1,10 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { InjectionToken, EnvironmentProviders,
|
|
2
|
+
import { InjectionToken, EnvironmentProviders, AfterViewInit, OnDestroy, ElementRef } 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';
|
|
6
|
-
import { SafeHtml } from '@angular/platform-browser';
|
|
7
6
|
import * as mesauth_angular from 'mesauth-angular';
|
|
7
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
8
8
|
|
|
9
9
|
interface MesAuthConfig {
|
|
10
10
|
apiBaseUrl: string;
|
|
@@ -16,6 +16,23 @@ interface MesAuthConfig {
|
|
|
16
16
|
* Allows updating themes, icons, and labels without republishing the npm package.
|
|
17
17
|
*/
|
|
18
18
|
uiAssetsUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Hostnames of backend services that run MesAuth.Authorizer middleware.
|
|
21
|
+
* The interceptor will attach Bearer + X-Refresh-Token headers to requests
|
|
22
|
+
* going to any of these hosts so the authorizer can silently refresh tokens.
|
|
23
|
+
* Example: ["mes.kefico.vn", "api.kefico.vn"]
|
|
24
|
+
*/
|
|
25
|
+
trustedHosts?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Called after a successful sign-in (login, externalLogin, or notifySignedIn).
|
|
28
|
+
* Use this to persist tokens to localStorage or sessionStorage for cross-origin requests.
|
|
29
|
+
*/
|
|
30
|
+
onSignedIn?: (accessToken: string, refreshToken?: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Called during sign-out (before the logout HTTP request completes).
|
|
33
|
+
* Use this to clear any persisted tokens from localStorage or sessionStorage.
|
|
34
|
+
*/
|
|
35
|
+
onSigningOut?: () => void;
|
|
19
36
|
}
|
|
20
37
|
/** Injection token for MesAuth configuration */
|
|
21
38
|
declare const MES_AUTH_CONFIG: InjectionToken<MesAuthConfig>;
|
|
@@ -169,6 +186,12 @@ declare class MesAuthService {
|
|
|
169
186
|
private startConnection;
|
|
170
187
|
stop(): void;
|
|
171
188
|
logout(): Observable<any>;
|
|
189
|
+
/**
|
|
190
|
+
* Call this after a successful local login to trigger the `onSignedIn` lifecycle hook.
|
|
191
|
+
* This allows the config's `onSignedIn` callback (e.g. localStorage persistence) to
|
|
192
|
+
* run consistently for both normal login and external/SSO login flows.
|
|
193
|
+
*/
|
|
194
|
+
notifySignedIn(accessToken: string, refreshToken?: string): void;
|
|
172
195
|
get currentUser(): IUser | null;
|
|
173
196
|
get isAuthenticated(): boolean;
|
|
174
197
|
/**
|
|
@@ -188,6 +211,35 @@ declare class MesAuthService {
|
|
|
188
211
|
avatarRatio: string | null;
|
|
189
212
|
}>;
|
|
190
213
|
getUserX(userId: string): Observable<IUser | null>;
|
|
214
|
+
/** POST a peer-issued JWT to the local /auth/external-login, returning local tokens. */
|
|
215
|
+
externalLogin(peerToken: string): Observable<{
|
|
216
|
+
accessToken: string;
|
|
217
|
+
refreshToken: string;
|
|
218
|
+
}>;
|
|
219
|
+
/** List active trusted issuers (public, no auth required). */
|
|
220
|
+
getTrustedIssuers(): Observable<{
|
|
221
|
+
issuer: string;
|
|
222
|
+
origin: string;
|
|
223
|
+
displayName: string;
|
|
224
|
+
priority: number;
|
|
225
|
+
}[]>;
|
|
226
|
+
/** List origins that are allowed to silent-SSO from this host (public, no auth required). */
|
|
227
|
+
getSsoAllowedPeers(): Observable<{
|
|
228
|
+
peerOrigin: string;
|
|
229
|
+
}[]>;
|
|
230
|
+
/**
|
|
231
|
+
* Get a short-lived SSO exchange token from this host (requires active session cookie).
|
|
232
|
+
* Used by the /sso/check page before postMessaging the token to a peer's iframe.
|
|
233
|
+
*/
|
|
234
|
+
getSsoToken(): Observable<{
|
|
235
|
+
token: string;
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* Open a hidden iframe to `${issuerOrigin}/sso/check` and wait for a postMessage reply.
|
|
239
|
+
* Returns the peer's short-lived SSO token, or null if the peer has no active session
|
|
240
|
+
* or does not respond within `timeoutMs` milliseconds.
|
|
241
|
+
*/
|
|
242
|
+
trySilentSsoFromPeer(issuerOrigin: string, timeoutMs?: number): Promise<string | null>;
|
|
191
243
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MesAuthService, never>;
|
|
192
244
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<MesAuthService>;
|
|
193
245
|
}
|
|
@@ -239,10 +291,12 @@ declare class UserProfileComponent {
|
|
|
239
291
|
showBell: _angular_core.InputSignal<boolean>;
|
|
240
292
|
showApproval: _angular_core.InputSignal<boolean>;
|
|
241
293
|
showName: _angular_core.InputSignal<boolean>;
|
|
294
|
+
showAi: _angular_core.InputSignal<boolean>;
|
|
242
295
|
showSignature: _angular_core.InputSignal<boolean[]>;
|
|
243
296
|
signatureHeight: _angular_core.InputSignal<number>;
|
|
244
297
|
notificationClick: _angular_core.OutputEmitterRef<void>;
|
|
245
298
|
approvalClick: _angular_core.OutputEmitterRef<void>;
|
|
299
|
+
aiClick: _angular_core.OutputEmitterRef<void>;
|
|
246
300
|
get themeClass(): string;
|
|
247
301
|
readonly currentUser: _angular_core.WritableSignal<IUser>;
|
|
248
302
|
readonly unreadCount: _angular_core.WritableSignal<number>;
|
|
@@ -265,6 +319,7 @@ declare class UserProfileComponent {
|
|
|
265
319
|
loadUnreadCount(): void;
|
|
266
320
|
loadPendingApprovalCount(): void;
|
|
267
321
|
onApprovalClick(): void;
|
|
322
|
+
onAiClick(): void;
|
|
268
323
|
getAvatarUrl(user: IUser): string;
|
|
269
324
|
getLastNameInitial(user: IUser): string;
|
|
270
325
|
toggleDropdown(): void;
|
|
@@ -277,7 +332,7 @@ declare class UserProfileComponent {
|
|
|
277
332
|
onNotificationClick(): void;
|
|
278
333
|
onSigErr(_ev: Event): void;
|
|
279
334
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserProfileComponent, never>;
|
|
280
|
-
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; }; "showSignature": { "alias": "showSignature"; "required": false; "isSignal": true; }; "signatureHeight": { "alias": "signatureHeight"; "required": false; "isSignal": true; }; }, { "notificationClick": "notificationClick"; "approvalClick": "approvalClick"; }, never, ["*"], true, never>;
|
|
335
|
+
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>;
|
|
281
336
|
}
|
|
282
337
|
|
|
283
338
|
declare enum ApprovalStepMode {
|
|
@@ -504,6 +559,192 @@ declare class MaApprovalPanelComponent {
|
|
|
504
559
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaApprovalPanelComponent, "ma-approval-panel", never, {}, { "approvalActioned": "approvalActioned"; }, never, never, true, never>;
|
|
505
560
|
}
|
|
506
561
|
|
|
562
|
+
/**
|
|
563
|
+
* Public AI types exported from mesauth-angular.
|
|
564
|
+
*
|
|
565
|
+
* The library ships a chat panel that talks to MesAuth.Api's /ai/chat SSE endpoint.
|
|
566
|
+
* Consumer apps may register additional client-side tools that the AI can invoke
|
|
567
|
+
* to drive their UI (navigation, dialogs, etc.) via provideMesAuthAi().
|
|
568
|
+
*/
|
|
569
|
+
/**
|
|
570
|
+
* A tool the host app registers. The AI may call it; the handler runs in the browser
|
|
571
|
+
* with the application's DI container available via Angular's inject() in the handler.
|
|
572
|
+
*
|
|
573
|
+
* `parameters` is a JSON schema (object type). Use `readOnly: true` to skip the
|
|
574
|
+
* confirm card for safe operations like navigation. Anything that mutates server state
|
|
575
|
+
* or is hard to undo should have readOnly: false (default).
|
|
576
|
+
*/
|
|
577
|
+
interface ClientTool {
|
|
578
|
+
name: string;
|
|
579
|
+
description: string;
|
|
580
|
+
parameters: ClientToolSchema;
|
|
581
|
+
readOnly?: boolean;
|
|
582
|
+
/**
|
|
583
|
+
* Handler executed when the AI calls this tool.
|
|
584
|
+
* Return a string (or anything JSON-serializable) describing the outcome; this is
|
|
585
|
+
* fed back to the AI as the tool result. Throw to signal failure.
|
|
586
|
+
*/
|
|
587
|
+
handler: (args: any) => Promise<unknown> | unknown;
|
|
588
|
+
}
|
|
589
|
+
interface ClientToolSchema {
|
|
590
|
+
type: 'object';
|
|
591
|
+
properties?: Record<string, unknown>;
|
|
592
|
+
required?: string[];
|
|
593
|
+
[k: string]: unknown;
|
|
594
|
+
}
|
|
595
|
+
/** A single message in the chat panel UI (different from the on-wire format). */
|
|
596
|
+
interface ChatBubble {
|
|
597
|
+
id: string;
|
|
598
|
+
role: 'user' | 'assistant' | 'tool';
|
|
599
|
+
/** Plain-text content (assistant + user). For tool: short summary. */
|
|
600
|
+
text: string;
|
|
601
|
+
/** Server tool calls that ran in this assistant turn (rendered as chips). */
|
|
602
|
+
toolEvents?: ChatToolEvent[];
|
|
603
|
+
pending?: boolean;
|
|
604
|
+
}
|
|
605
|
+
interface ChatToolEvent {
|
|
606
|
+
id: string;
|
|
607
|
+
name: string;
|
|
608
|
+
side: 'server' | 'client';
|
|
609
|
+
status: 'running' | 'ok' | 'error' | 'awaiting-approval' | 'declined';
|
|
610
|
+
summary?: string;
|
|
611
|
+
args?: any;
|
|
612
|
+
readOnly?: boolean;
|
|
613
|
+
}
|
|
614
|
+
/** Stream event types matching MesAuth.Api's AiStreamEvent JSON. */
|
|
615
|
+
type AiSseEvent = {
|
|
616
|
+
type: 'session';
|
|
617
|
+
sessionId: string;
|
|
618
|
+
} | {
|
|
619
|
+
type: 'token';
|
|
620
|
+
text: string;
|
|
621
|
+
} | {
|
|
622
|
+
type: 'tool_call_started';
|
|
623
|
+
id: string;
|
|
624
|
+
name: string;
|
|
625
|
+
args: any;
|
|
626
|
+
side: 'server' | 'client';
|
|
627
|
+
readOnly?: boolean;
|
|
628
|
+
} | {
|
|
629
|
+
type: 'tool_call_completed';
|
|
630
|
+
id: string;
|
|
631
|
+
ok: boolean;
|
|
632
|
+
summary?: string;
|
|
633
|
+
} | {
|
|
634
|
+
type: 'client_tool_call';
|
|
635
|
+
id: string;
|
|
636
|
+
name: string;
|
|
637
|
+
args: any;
|
|
638
|
+
side: 'client';
|
|
639
|
+
readOnly?: boolean;
|
|
640
|
+
} | {
|
|
641
|
+
type: 'error';
|
|
642
|
+
message: string;
|
|
643
|
+
} | {
|
|
644
|
+
type: 'done';
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
interface PendingApproval {
|
|
648
|
+
callId: string;
|
|
649
|
+
name: string;
|
|
650
|
+
args: any;
|
|
651
|
+
side: 'client';
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Drives the chat panel.
|
|
655
|
+
*
|
|
656
|
+
* Uses `fetch` + `ReadableStream` (not `EventSource`, which can't POST a body) to talk to
|
|
657
|
+
* `/ai/chat` SSE. State lives in signals so the panel can re-render reactively.
|
|
658
|
+
*/
|
|
659
|
+
declare class MaAiService {
|
|
660
|
+
private readonly auth;
|
|
661
|
+
private readonly aiConfig;
|
|
662
|
+
private readonly tools;
|
|
663
|
+
readonly messages: _angular_core.WritableSignal<ChatBubble[]>;
|
|
664
|
+
readonly streaming: _angular_core.WritableSignal<boolean>;
|
|
665
|
+
/** When non-null, a write-class client tool is awaiting user confirmation. */
|
|
666
|
+
readonly pendingApproval: _angular_core.WritableSignal<PendingApproval>;
|
|
667
|
+
readonly lastError: _angular_core.WritableSignal<string>;
|
|
668
|
+
private sessionId;
|
|
669
|
+
/** Verbs the user already chose "always approve" for in this session. */
|
|
670
|
+
private alwaysApproved;
|
|
671
|
+
private abortController;
|
|
672
|
+
/** ID of the current assistant bubble we're streaming tokens into. */
|
|
673
|
+
private currentAssistantId;
|
|
674
|
+
get enabled(): boolean;
|
|
675
|
+
/** Start a brand-new conversation. */
|
|
676
|
+
resetSession(): void;
|
|
677
|
+
/** Cancel the in-flight stream (if any). The session id is preserved so the user can resume. */
|
|
678
|
+
cancel(): void;
|
|
679
|
+
/** User typed and submitted a message. */
|
|
680
|
+
send(text: string, currentRoute?: string): Promise<void>;
|
|
681
|
+
/**
|
|
682
|
+
* Approve (or decline) a pending client tool call. If approved (and alwaysApprove),
|
|
683
|
+
* remember the verb so we skip the prompt next time in this session.
|
|
684
|
+
*/
|
|
685
|
+
resolvePendingApproval(decision: 'approve' | 'always' | 'decline'): Promise<void>;
|
|
686
|
+
private runStream;
|
|
687
|
+
private readSse;
|
|
688
|
+
private handleEvent;
|
|
689
|
+
private executeClientTool;
|
|
690
|
+
private continueWithToolResult;
|
|
691
|
+
private appendBubble;
|
|
692
|
+
private appendToken;
|
|
693
|
+
private appendToolEvent;
|
|
694
|
+
private markToolStatus;
|
|
695
|
+
private finalizeAssistant;
|
|
696
|
+
private verbOf;
|
|
697
|
+
private summarize;
|
|
698
|
+
private uid;
|
|
699
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiService, never>;
|
|
700
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<MaAiService>;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Right-side, resizable chat drawer. Open/close via the public open/close/toggle methods.
|
|
705
|
+
* Uses panel-shared.css for the header/empty-state styling so it looks like the approval
|
|
706
|
+
* and notification panels.
|
|
707
|
+
*/
|
|
708
|
+
declare class MaAiChatPanelComponent implements AfterViewInit {
|
|
709
|
+
readonly isOpen: _angular_core.WritableSignal<boolean>;
|
|
710
|
+
readonly width: _angular_core.WritableSignal<number>;
|
|
711
|
+
readonly draft: _angular_core.WritableSignal<string>;
|
|
712
|
+
readonly ai: MaAiService;
|
|
713
|
+
private readonly router;
|
|
714
|
+
private readonly themeService;
|
|
715
|
+
private readonly scrollContainer;
|
|
716
|
+
private readonly textArea;
|
|
717
|
+
get themeClass(): string;
|
|
718
|
+
readonly messages: _angular_core.WritableSignal<mesauth_angular.ChatBubble[]>;
|
|
719
|
+
readonly streaming: _angular_core.WritableSignal<boolean>;
|
|
720
|
+
readonly pendingApproval: _angular_core.WritableSignal<mesauth_angular.PendingApproval>;
|
|
721
|
+
readonly lastError: _angular_core.WritableSignal<string>;
|
|
722
|
+
readonly hasMessages: _angular_core.Signal<boolean>;
|
|
723
|
+
private isDragging;
|
|
724
|
+
private dragStartX;
|
|
725
|
+
private dragStartWidth;
|
|
726
|
+
constructor();
|
|
727
|
+
ngAfterViewInit(): void;
|
|
728
|
+
open(): void;
|
|
729
|
+
close(): void;
|
|
730
|
+
toggle(): void;
|
|
731
|
+
newConversation(): void;
|
|
732
|
+
send(): void;
|
|
733
|
+
cancel(): void;
|
|
734
|
+
onTextareaKey(ev: KeyboardEvent): void;
|
|
735
|
+
onTextareaInput(ev: Event): void;
|
|
736
|
+
approve(): void;
|
|
737
|
+
alwaysApprove(): void;
|
|
738
|
+
decline(): void;
|
|
739
|
+
startResize(ev: PointerEvent): void;
|
|
740
|
+
onResizeMove(ev: PointerEvent): void;
|
|
741
|
+
endResize(ev: PointerEvent): void;
|
|
742
|
+
private loadWidth;
|
|
743
|
+
private scrollToBottom;
|
|
744
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiChatPanelComponent, never>;
|
|
745
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaAiChatPanelComponent, "ma-ai-chat-panel", never, {}, {}, never, never, true, never>;
|
|
746
|
+
}
|
|
747
|
+
|
|
507
748
|
type Theme = 'light' | 'dark';
|
|
508
749
|
declare class ThemeService implements OnDestroy {
|
|
509
750
|
private readonly _currentTheme;
|
|
@@ -528,9 +769,11 @@ declare class ThemeService implements OnDestroy {
|
|
|
528
769
|
declare class MaUserComponent implements AfterViewInit {
|
|
529
770
|
userProfile?: UserProfileComponent;
|
|
530
771
|
approvalPanel: MaApprovalPanelComponent;
|
|
772
|
+
aiPanel?: MaAiChatPanelComponent;
|
|
531
773
|
avatarShape: _angular_core.InputSignal<"circle" | "rounded" | "rectangle">;
|
|
532
774
|
showBell: _angular_core.InputSignal<boolean>;
|
|
533
775
|
showApproval: _angular_core.InputSignal<boolean>;
|
|
776
|
+
showAi: _angular_core.InputSignal<boolean>;
|
|
534
777
|
showName: _angular_core.InputSignal<boolean>;
|
|
535
778
|
showSignature: _angular_core.InputSignal<boolean[]>;
|
|
536
779
|
theme: _angular_core.InputSignal<"light" | "dark">;
|
|
@@ -540,7 +783,7 @@ declare class MaUserComponent implements AfterViewInit {
|
|
|
540
783
|
onNotificationRead(): void;
|
|
541
784
|
onApprovalActioned(): void;
|
|
542
785
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaUserComponent, never>;
|
|
543
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaUserComponent, "ma-user", never, { "avatarShape": { "alias": "avatarShape"; "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; }; "showSignature": { "alias": "showSignature"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
786
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaUserComponent, "ma-user", never, { "avatarShape": { "alias": "avatarShape"; "required": false; "isSignal": true; }; "showBell": { "alias": "showBell"; "required": false; "isSignal": true; }; "showApproval": { "alias": "showApproval"; "required": false; "isSignal": true; }; "showAi": { "alias": "showAi"; "required": false; "isSignal": true; }; "showName": { "alias": "showName"; "required": false; "isSignal": true; }; "showSignature": { "alias": "showSignature"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
544
787
|
}
|
|
545
788
|
|
|
546
789
|
declare class MaUserXComponent {
|
|
@@ -803,7 +1046,7 @@ interface MaUiManifest {
|
|
|
803
1046
|
features?: Record<string, boolean>;
|
|
804
1047
|
}
|
|
805
1048
|
/** Current installed package version — keep in sync with package.json. */
|
|
806
|
-
declare const PACKAGE_VERSION = "1.
|
|
1049
|
+
declare const PACKAGE_VERSION = "1.19.0";
|
|
807
1050
|
/**
|
|
808
1051
|
* Provides server-driven UI configuration loaded from the hosted manifest.
|
|
809
1052
|
* Components read `labels()` and `features()` signals instead of hardcoded strings.
|
|
@@ -908,5 +1151,109 @@ declare class MaUserMenuComponent {
|
|
|
908
1151
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaUserMenuComponent, "ma-user-menu", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "itemClick": "itemClick"; }, never, ["[maUserMenuIcon]"], true, never>;
|
|
909
1152
|
}
|
|
910
1153
|
|
|
911
|
-
|
|
912
|
-
|
|
1154
|
+
/**
|
|
1155
|
+
* Invoked by the /sso/check page component on init.
|
|
1156
|
+
*
|
|
1157
|
+
* Flow:
|
|
1158
|
+
* 1. Verify the page is inside an iframe (window !== window.parent).
|
|
1159
|
+
* 2. Fetch the list of allowed peer origins from the backend.
|
|
1160
|
+
* 3. If the opener's origin is in the allow-list, get a short-lived SSO token
|
|
1161
|
+
* from this host's /auth/sso-token endpoint (uses the current session cookie).
|
|
1162
|
+
* 4. postMessage the result back to the opener.
|
|
1163
|
+
*
|
|
1164
|
+
* If the user is not logged in, /auth/sso-token returns 401 → post { ok: false }.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function runSsoCheckHandshake(authService: MesAuthService): Promise<void>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Invoked by the login page component after a successful local login.
|
|
1169
|
+
*
|
|
1170
|
+
* If the URL contains `return_via=postMessage&target_origin=<url>`, this function
|
|
1171
|
+
* posts the newly issued SSO token back to the opener window and closes this popup.
|
|
1172
|
+
*
|
|
1173
|
+
* @returns true if it handled the return-via flow (caller should NOT do normal navigation).
|
|
1174
|
+
*/
|
|
1175
|
+
declare function runReturnViaPostMessageIfRequested(authService: MesAuthService): Promise<boolean>;
|
|
1176
|
+
|
|
1177
|
+
interface MesAuthAiConfig {
|
|
1178
|
+
/** Master switch — when false the Ask-AI button hides and the panel never opens. */
|
|
1179
|
+
enabled?: boolean;
|
|
1180
|
+
/**
|
|
1181
|
+
* Extra client-side tools the AI can invoke. The handler runs in the browser.
|
|
1182
|
+
* The library always exposes a set of built-in client tools (navigate, toggle theme, etc.)
|
|
1183
|
+
* — these are merged in addition.
|
|
1184
|
+
*/
|
|
1185
|
+
tools?: ClientTool[];
|
|
1186
|
+
/**
|
|
1187
|
+
* Optional extra paragraphs appended to the backend system prompt for this app.
|
|
1188
|
+
* Use to tell the AI what domain the consumer app handles (e.g. "You are inside the SPC app").
|
|
1189
|
+
*/
|
|
1190
|
+
systemPromptExtensions?: string[];
|
|
1191
|
+
/**
|
|
1192
|
+
* Optional friendly name of the host app; sent to the backend each turn.
|
|
1193
|
+
*/
|
|
1194
|
+
appName?: string;
|
|
1195
|
+
}
|
|
1196
|
+
declare const MES_AUTH_AI_CONFIG: InjectionToken<MesAuthAiConfig>;
|
|
1197
|
+
/** Default configuration when the consumer doesn't call provideMesAuthAi(). */
|
|
1198
|
+
declare const DEFAULT_AI_CONFIG: MesAuthAiConfig;
|
|
1199
|
+
/**
|
|
1200
|
+
* Provide AI assistant configuration to mesauth-angular.
|
|
1201
|
+
*
|
|
1202
|
+
* @example
|
|
1203
|
+
* ```ts
|
|
1204
|
+
* providers: [
|
|
1205
|
+
* provideMesAuth(...),
|
|
1206
|
+
* provideMesAuthAi({
|
|
1207
|
+
* enabled: true,
|
|
1208
|
+
* appName: 'MesExtensionSite',
|
|
1209
|
+
* tools: [
|
|
1210
|
+
* {
|
|
1211
|
+
* name: 'spc_open_chart',
|
|
1212
|
+
* description: 'Open the SPC chart for a given product line',
|
|
1213
|
+
* parameters: {
|
|
1214
|
+
* type: 'object',
|
|
1215
|
+
* properties: { lineId: { type: 'string' } },
|
|
1216
|
+
* required: ['lineId']
|
|
1217
|
+
* },
|
|
1218
|
+
* readOnly: true,
|
|
1219
|
+
* handler: (args) => inject(Router).navigateByUrl(`/spc/${args.lineId}`)
|
|
1220
|
+
* }
|
|
1221
|
+
* ]
|
|
1222
|
+
* })
|
|
1223
|
+
* ]
|
|
1224
|
+
* ```
|
|
1225
|
+
*/
|
|
1226
|
+
declare function provideMesAuthAi(config: MesAuthAiConfig): EnvironmentProviders;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Resolves the full set of client tools available to the AI: built-ins + consumer-registered.
|
|
1230
|
+
* Handlers are invoked through `runTool(name, args)` which automatically threads the Injector
|
|
1231
|
+
* so consumer handlers can use inject() patterns.
|
|
1232
|
+
*/
|
|
1233
|
+
declare class MaAiToolsRegistry {
|
|
1234
|
+
private readonly config;
|
|
1235
|
+
private readonly injector;
|
|
1236
|
+
/** Built-in client tools shipped by the library. */
|
|
1237
|
+
private readonly builtIn;
|
|
1238
|
+
/** All tools, deduplicated by name (consumer wins on conflict). */
|
|
1239
|
+
list(): ClientTool[];
|
|
1240
|
+
resolve(name: string): ClientTool | undefined;
|
|
1241
|
+
/** Run a registered client tool and serialize its result for posting back to the agent loop. */
|
|
1242
|
+
runTool(name: string, args: any): Promise<{
|
|
1243
|
+
ok: boolean;
|
|
1244
|
+
result: string;
|
|
1245
|
+
}>;
|
|
1246
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiToolsRegistry, never>;
|
|
1247
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<MaAiToolsRegistry>;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
declare class MaAiButtonComponent {
|
|
1251
|
+
private readonly config;
|
|
1252
|
+
readonly enabled: _angular_core.Signal<boolean>;
|
|
1253
|
+
clicked: _angular_core.OutputEmitterRef<void>;
|
|
1254
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaAiButtonComponent, never>;
|
|
1255
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaAiButtonComponent, "ma-ai-button", never, {}, { "clicked": "clicked"; }, never, never, true, never>;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
export { ALL_ACTIONS, AVATAR_FRAMES, ApprovalActionType, ApprovalDocumentStatus, ApprovalStepMode, ApprovalStepStatus, DEFAULT_AI_CONFIG, MES_AUTH_AI_CONFIG, MES_AUTH_CONFIG, MaAiButtonComponent, MaAiChatPanelComponent, 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, runReturnViaPostMessageIfRequested, runSsoCheckHandshake, withXMaPerm, xMaResource };
|
|
1259
|
+
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, MaUiManifest, MesAuthAiConfig, MesAuthConfig, NotificationDto, PagedList, PendingApproval, PermissionHeader, RealTimeNotificationDto, RequestConfig, RolePreviewUserDto, StepRoleDto, Theme, Toast, UpdateApprovalTemplateRequest, UserFrontEndRoutesGrouped };
|