@newheap/platform-ai-chat 0.1.1 → 0.3.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 +12 -0
- package/fesm2022/newheap-platform-ai-chat-testing.mjs +1 -0
- package/fesm2022/newheap-platform-ai-chat-testing.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat.mjs +365 -51
- package/fesm2022/newheap-platform-ai-chat.mjs.map +1 -1
- package/i18n/en.json +9 -1
- package/i18n/nl.json +9 -1
- package/index.d.ts +49 -5
- package/package.json +1 -1
- package/testing/index.d.ts +9 -0
package/i18n/en.json
CHANGED
|
@@ -58,7 +58,11 @@
|
|
|
58
58
|
"send": "Send message",
|
|
59
59
|
"stop": "Stop the assistant",
|
|
60
60
|
"characters": "{{count}} of {{max}} characters",
|
|
61
|
-
"too-long": "The message is too long."
|
|
61
|
+
"too-long": "The message is too long.",
|
|
62
|
+
"status": {
|
|
63
|
+
"running": "You can keep typing while the assistant works. Sending is temporarily unavailable.",
|
|
64
|
+
"waiting-for-approval": "You can keep typing while an action waits for your approval. Sending is temporarily unavailable."
|
|
65
|
+
}
|
|
62
66
|
},
|
|
63
67
|
"tool-call": {
|
|
64
68
|
"label": "Tool call: {{name}}",
|
|
@@ -67,6 +71,7 @@
|
|
|
67
71
|
"arguments": "Input",
|
|
68
72
|
"result": "Result",
|
|
69
73
|
"result-code": "Result",
|
|
74
|
+
"tool-id": "Technical tool id",
|
|
70
75
|
"status": {
|
|
71
76
|
"running": "Running",
|
|
72
77
|
"succeeded": "Completed",
|
|
@@ -77,6 +82,9 @@
|
|
|
77
82
|
},
|
|
78
83
|
"approval": {
|
|
79
84
|
"title": "Approval required",
|
|
85
|
+
"fallback-summary": "Review this action before it runs.",
|
|
86
|
+
"technical-details": "Technical details",
|
|
87
|
+
"tool-id": "Tool id",
|
|
80
88
|
"targets": "Affects",
|
|
81
89
|
"arguments": "Proposed change",
|
|
82
90
|
"expires-in": "Expires in {{time}}",
|
package/i18n/nl.json
CHANGED
|
@@ -58,7 +58,11 @@
|
|
|
58
58
|
"send": "Bericht versturen",
|
|
59
59
|
"stop": "Assistent stoppen",
|
|
60
60
|
"characters": "{{count}} van {{max}} tekens",
|
|
61
|
-
"too-long": "Het bericht is te lang."
|
|
61
|
+
"too-long": "Het bericht is te lang.",
|
|
62
|
+
"status": {
|
|
63
|
+
"running": "Je kunt verder typen terwijl de assistent bezig is. Versturen is tijdelijk niet mogelijk.",
|
|
64
|
+
"waiting-for-approval": "Je kunt verder typen terwijl een actie op je goedkeuring wacht. Versturen is tijdelijk niet mogelijk."
|
|
65
|
+
}
|
|
62
66
|
},
|
|
63
67
|
"tool-call": {
|
|
64
68
|
"label": "Toolaanroep: {{name}}",
|
|
@@ -67,6 +71,7 @@
|
|
|
67
71
|
"arguments": "Invoer",
|
|
68
72
|
"result": "Resultaat",
|
|
69
73
|
"result-code": "Resultaat",
|
|
74
|
+
"tool-id": "Technisch tool-id",
|
|
70
75
|
"status": {
|
|
71
76
|
"running": "Bezig",
|
|
72
77
|
"succeeded": "Voltooid",
|
|
@@ -77,6 +82,9 @@
|
|
|
77
82
|
},
|
|
78
83
|
"approval": {
|
|
79
84
|
"title": "Goedkeuring nodig",
|
|
85
|
+
"fallback-summary": "Controleer deze actie voordat ze wordt uitgevoerd.",
|
|
86
|
+
"technical-details": "Technische details",
|
|
87
|
+
"tool-id": "Tool-id",
|
|
80
88
|
"targets": "Betreft",
|
|
81
89
|
"arguments": "Voorgestelde wijziging",
|
|
82
90
|
"expires-in": "Verloopt over {{time}}",
|
package/index.d.ts
CHANGED
|
@@ -59,6 +59,16 @@ interface ToolCallPart {
|
|
|
59
59
|
resultCode: string | null;
|
|
60
60
|
}
|
|
61
61
|
type ApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired';
|
|
62
|
+
interface ApprovalPresentationField {
|
|
63
|
+
label: string;
|
|
64
|
+
value: string;
|
|
65
|
+
}
|
|
66
|
+
interface ApprovalPresentation {
|
|
67
|
+
toolDisplayName: string;
|
|
68
|
+
summary: string;
|
|
69
|
+
fields: ApprovalPresentationField[];
|
|
70
|
+
notice: string | null;
|
|
71
|
+
}
|
|
62
72
|
interface ApprovalPart {
|
|
63
73
|
type: 'approval';
|
|
64
74
|
approvalId: string;
|
|
@@ -66,6 +76,8 @@ interface ApprovalPart {
|
|
|
66
76
|
proposalHash: string;
|
|
67
77
|
toolId: string;
|
|
68
78
|
summary: string;
|
|
79
|
+
/** Trusted server-side presentation. Missing on old events and when no presenter handled the tool. */
|
|
80
|
+
presentation?: ApprovalPresentation | null;
|
|
69
81
|
argumentsPreview: string;
|
|
70
82
|
targets: string[];
|
|
71
83
|
expiresAt: string;
|
|
@@ -324,6 +336,12 @@ interface NhAssistantConfig {
|
|
|
324
336
|
* failing getter or an invalid shape only leaves the context out. Default: none.
|
|
325
337
|
*/
|
|
326
338
|
getPageContext?: () => ClientContext | null | Promise<ClientContext | null>;
|
|
339
|
+
/**
|
|
340
|
+
* Stable, non-secret identity for browser UI state (for example a user id plus tenant id).
|
|
341
|
+
* Runs in the assistant injection context. Return null on sign-out. Without this callback
|
|
342
|
+
* the assistant keeps UI state in memory only. Never return an access token.
|
|
343
|
+
*/
|
|
344
|
+
getStateScope?: () => string | null | Promise<string | null>;
|
|
327
345
|
/** Injectable access policy. Default: always allowed. */
|
|
328
346
|
accessPolicy?: Type<NhAssistantAccessPolicy>;
|
|
329
347
|
/** Agent selected when the user has not chosen one. Default: the first agent the server lists. */
|
|
@@ -529,6 +547,7 @@ declare class NhAssistantStore {
|
|
|
529
547
|
private readonly config;
|
|
530
548
|
private readonly injector;
|
|
531
549
|
private readonly accessPolicy;
|
|
550
|
+
private readonly uiState;
|
|
532
551
|
private readonly accessGrantedState;
|
|
533
552
|
private readonly statusState;
|
|
534
553
|
private readonly statusLoadingState;
|
|
@@ -545,10 +564,14 @@ declare class NhAssistantStore {
|
|
|
545
564
|
private readonly restoredDraftState;
|
|
546
565
|
private readonly pageContextState;
|
|
547
566
|
private readonly pageContextExcludedState;
|
|
567
|
+
private readonly restorePanelOpenState;
|
|
548
568
|
private accessSubscription?;
|
|
549
569
|
private streamSubscription?;
|
|
550
570
|
private cancelTimer?;
|
|
551
571
|
private initialization?;
|
|
572
|
+
private statusRevision;
|
|
573
|
+
private accountRevision;
|
|
574
|
+
private pendingSendResolve?;
|
|
552
575
|
/** True when the access policy allows the user and the server reports the assistant as enabled. */
|
|
553
576
|
readonly enabled: _angular_core.Signal<boolean>;
|
|
554
577
|
readonly accessGranted: _angular_core.Signal<boolean | null>;
|
|
@@ -578,6 +601,8 @@ declare class NhAssistantStore {
|
|
|
578
601
|
readonly pageContext: _angular_core.Signal<ClientContext | null>;
|
|
579
602
|
/** True when the user left the page context out of the next message. */
|
|
580
603
|
readonly pageContextExcluded: _angular_core.Signal<boolean>;
|
|
604
|
+
/** Whether the drawer was open when this account last left the application. */
|
|
605
|
+
readonly restorePanelOpen: _angular_core.Signal<boolean>;
|
|
581
606
|
/** True while the user can send: enabled, an agent is chosen and no turn runs or waits. */
|
|
582
607
|
readonly canSend: _angular_core.Signal<boolean>;
|
|
583
608
|
constructor();
|
|
@@ -591,6 +616,7 @@ declare class NhAssistantStore {
|
|
|
591
616
|
/** Leaves the active conversation; the next message creates a new one. */
|
|
592
617
|
startNewConversation(): void;
|
|
593
618
|
openConversation(conversationId: string): Promise<void>;
|
|
619
|
+
private loadConversation;
|
|
594
620
|
deleteConversation(conversationId: string): Promise<void>;
|
|
595
621
|
/**
|
|
596
622
|
* Sends a user message. Creates a conversation with the selected agent when none is
|
|
@@ -603,6 +629,8 @@ declare class NhAssistantStore {
|
|
|
603
629
|
/** Asks the server to stop the running turn or to abandon a waiting approval. */
|
|
604
630
|
cancel(): Promise<void>;
|
|
605
631
|
clearError(): void;
|
|
632
|
+
/** Persists only drawer visibility, never the page context or a message draft. */
|
|
633
|
+
setPanelOpen(open: boolean): void;
|
|
606
634
|
/** Reads the host's page context again so the chip shows what the next message sends. */
|
|
607
635
|
refreshPageContext(): Promise<void>;
|
|
608
636
|
/** Leaves the page context out of the next message only, or includes it again. */
|
|
@@ -618,6 +646,7 @@ declare class NhAssistantStore {
|
|
|
618
646
|
private startInitialization;
|
|
619
647
|
private createConversation;
|
|
620
648
|
private runStream;
|
|
649
|
+
private stopLocalTurn;
|
|
621
650
|
private applyEvent;
|
|
622
651
|
private afterTurn;
|
|
623
652
|
private reloadActiveConversation;
|
|
@@ -652,6 +681,7 @@ declare class NhAssistantPanelService {
|
|
|
652
681
|
readonly isOpen: Signal<boolean>;
|
|
653
682
|
constructor();
|
|
654
683
|
open(conversationId?: string): void;
|
|
684
|
+
private showPanel;
|
|
655
685
|
close(): void;
|
|
656
686
|
toggle(): void;
|
|
657
687
|
/** Called by `nh-assistant-panel`; hosts should place that component once instead. */
|
|
@@ -719,6 +749,7 @@ declare class NhAssistantPanelComponent implements AfterViewInit, OnDestroy {
|
|
|
719
749
|
readonly closed: _angular_core.Signal<boolean>;
|
|
720
750
|
readonly busy: _angular_core.Signal<boolean>;
|
|
721
751
|
readonly composerDisabled: _angular_core.Signal<boolean>;
|
|
752
|
+
readonly composerStatus: _angular_core.Signal<"running" | "waiting-for-approval" | null>;
|
|
722
753
|
readonly errorKeys: _angular_core.Signal<string[]>;
|
|
723
754
|
constructor();
|
|
724
755
|
ngAfterViewInit(): void;
|
|
@@ -779,20 +810,28 @@ declare class NhAssistantThreadComponent {
|
|
|
779
810
|
}
|
|
780
811
|
|
|
781
812
|
/**
|
|
782
|
-
* Message input. Enter sends
|
|
783
|
-
* the
|
|
813
|
+
* Message input. Enter sends when sending is available; Shift+Enter inserts a new line.
|
|
814
|
+
* Drafting remains available while the assistant runs or waits for approval.
|
|
784
815
|
*/
|
|
785
816
|
declare class NhAssistantComposerComponent {
|
|
786
|
-
/** Disables
|
|
817
|
+
/** Disables the editor only when the conversation itself cannot accept a draft. */
|
|
787
818
|
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
819
|
+
/** Blocks sending without disabling the editor or clearing its draft. */
|
|
820
|
+
readonly sendDisabled: _angular_core.InputSignal<boolean>;
|
|
788
821
|
/** Shows the stop button instead of the send button. */
|
|
789
822
|
readonly busy: _angular_core.InputSignal<boolean>;
|
|
823
|
+
/** Announces why sending is temporarily unavailable. */
|
|
824
|
+
readonly status: _angular_core.InputSignal<"running" | "waiting-for-approval" | null>;
|
|
790
825
|
readonly maxLength: _angular_core.InputSignal<number | null>;
|
|
791
826
|
/** Text to put back into the input, for example a message the server did not accept. */
|
|
792
827
|
readonly restore: _angular_core.InputSignal<string | null>;
|
|
793
828
|
readonly send: _angular_core.OutputEmitterRef<string>;
|
|
794
829
|
readonly cancel: _angular_core.OutputEmitterRef<void>;
|
|
795
830
|
readonly restored: _angular_core.OutputEmitterRef<void>;
|
|
831
|
+
private readonly host;
|
|
832
|
+
private readonly textarea;
|
|
833
|
+
private ownedFocus;
|
|
834
|
+
private previousBusy;
|
|
796
835
|
readonly inputId: string;
|
|
797
836
|
readonly hintId: string;
|
|
798
837
|
readonly text: _angular_core.WritableSignal<string>;
|
|
@@ -801,11 +840,15 @@ declare class NhAssistantComposerComponent {
|
|
|
801
840
|
readonly showCounter: _angular_core.Signal<boolean>;
|
|
802
841
|
readonly canSend: _angular_core.Signal<boolean>;
|
|
803
842
|
constructor();
|
|
843
|
+
onFocusIn(): void;
|
|
844
|
+
onFocusOut(event: FocusEvent): void;
|
|
804
845
|
onInput(event: Event): void;
|
|
805
846
|
onKeydown(event: KeyboardEvent): void;
|
|
847
|
+
onSubmit(event: SubmitEvent): void;
|
|
806
848
|
submit(): void;
|
|
849
|
+
private restoreOwnedFocus;
|
|
807
850
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantComposerComponent, never>;
|
|
808
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantComposerComponent, "nh-assistant-composer", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "restore": { "alias": "restore"; "required": false; "isSignal": true; }; }, { "send": "send"; "cancel": "cancel"; "restored": "restored"; }, never, never, true, never>;
|
|
851
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantComposerComponent, "nh-assistant-composer", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "sendDisabled": { "alias": "sendDisabled"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "restore": { "alias": "restore"; "required": false; "isSignal": true; }; }, { "send": "send"; "cancel": "cancel"; "restored": "restored"; }, never, never, true, never>;
|
|
809
852
|
}
|
|
810
853
|
|
|
811
854
|
/** Shows one tool invocation with its status and expandable input and result previews. */
|
|
@@ -840,6 +883,7 @@ declare class NhAssistantApprovalCardComponent {
|
|
|
840
883
|
readonly actionable: _angular_core.Signal<boolean>;
|
|
841
884
|
readonly disabled: _angular_core.Signal<boolean>;
|
|
842
885
|
readonly countdown: _angular_core.Signal<string>;
|
|
886
|
+
readonly presentedSummary: _angular_core.Signal<string | null>;
|
|
843
887
|
constructor();
|
|
844
888
|
choose(decision: ApprovalDecision): void;
|
|
845
889
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantApprovalCardComponent, never>;
|
|
@@ -934,4 +978,4 @@ declare function nhAssistantErrorKeys(error: NhAssistantError | null): string[];
|
|
|
934
978
|
declare const NH_ASSISTANT_DASH_CASE: RegExp;
|
|
935
979
|
|
|
936
980
|
export { NH_ASSISTANT_ACCESS_POLICY, NH_ASSISTANT_CONFIG, NH_ASSISTANT_FETCH, NH_ASSISTANT_ICONS, NH_ASSISTANT_MAX_CUSTOM_INSTRUCTIONS, NH_ASSISTANT_PAGE_CONTEXT_LIMITS, NH_ASSISTANT_PANEL_MOBILE_QUERY, NH_ASSISTANT_PANEL_WIDTH, NH_ASSISTANT_SSE_EVENT_TYPES, NH_ASSISTANT_TRANSLATIONS, NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD, NhAssistantAdminApiService, NhAssistantAgentPickerComponent, NhAssistantAllowAllAccessPolicy, NhAssistantApiError, NhAssistantApiService, NhAssistantApprovalCardComponent, NhAssistantClientErrorCodes, NhAssistantComposerComponent, NhAssistantConversationListComponent, NhAssistantLauncherComponent, NhAssistantPanelComponent, NhAssistantPanelService, NhAssistantPreferencesComponent, NhAssistantSseParser, NhAssistantStore, NhAssistantThreadComponent, NhAssistantToolCallCardComponent, NhAssistantTranslationMerger, applyNhAssistantApprovalDecision, applyNhAssistantEvent, describeNhAssistantClientContext, formatNhAssistantCountdown, nhAssistantCodeForStatus, nhAssistantErrorMessageKey, normalizeNhAssistantClientContext, provideNhAssistant, NH_ASSISTANT_DASH_CASE as ɵNH_ASSISTANT_DASH_CASE, NhAssistantIconComponent as ɵNhAssistantIconComponent, NhAssistantTranslatePipe as ɵNhAssistantTranslatePipe, nhAssistantErrorKeys as ɵnhAssistantErrorKeys, toNhAssistantError as ɵtoNhAssistantError };
|
|
937
|
-
export type { AdminAgent, AdminAgentInput, AgentSummary, ApplicationContext, ApplicationContextVersion, ApprovalDecision, ApprovalPart, ApprovalRequiredEvent, ApprovalStatus, AssistantAddressForm, AssistantAutonomy, AssistantErrorEvent, AssistantPreferences, AssistantResponseLength, AssistantStatus, AssistantStyle, ClientContext, ClientContextEntity, Conversation, ConversationPage, ConversationStatus, ConversationSummary, CreateConversationRequest, DecideApprovalRequest, McpAuthMode, McpServer, McpServerInput, McpServerTestResult, McpTool, McpToolEffect, McpToolStatus, Message, MessageDeltaEvent, MessagePart, NhAssistantAccessPolicy, NhAssistantClientContext, NhAssistantClientErrorCode, NhAssistantConfig, NhAssistantError, NhAssistantFetch, NhAssistantIconName, NhAssistantRawSseMessage, NhAssistantSseEvent, NhAssistantSseEventMap, NhAssistantSseEventType, NhAssistantStatusCodes, SendMessageRequest, TextPart, ToolCallPart, ToolCallStatus, ToolCatalogEffect, ToolCatalogEntry, ToolCompletedEvent, ToolStartedEvent, TurnCompletedEvent, TurnCompletionStatus, TurnStartedEvent, TurnUsage, UpdateAdminAgentRequest, UpdateApplicationContextRequest, UpdateMcpToolRequest };
|
|
981
|
+
export type { AdminAgent, AdminAgentInput, AgentSummary, ApplicationContext, ApplicationContextVersion, ApprovalDecision, ApprovalPart, ApprovalPresentation, ApprovalPresentationField, ApprovalRequiredEvent, ApprovalStatus, AssistantAddressForm, AssistantAutonomy, AssistantErrorEvent, AssistantPreferences, AssistantResponseLength, AssistantStatus, AssistantStyle, ClientContext, ClientContextEntity, Conversation, ConversationPage, ConversationStatus, ConversationSummary, CreateConversationRequest, DecideApprovalRequest, McpAuthMode, McpServer, McpServerInput, McpServerTestResult, McpTool, McpToolEffect, McpToolStatus, Message, MessageDeltaEvent, MessagePart, NhAssistantAccessPolicy, NhAssistantClientContext, NhAssistantClientErrorCode, NhAssistantConfig, NhAssistantError, NhAssistantFetch, NhAssistantIconName, NhAssistantRawSseMessage, NhAssistantSseEvent, NhAssistantSseEventMap, NhAssistantSseEventType, NhAssistantStatusCodes, SendMessageRequest, TextPart, ToolCallPart, ToolCallStatus, ToolCatalogEffect, ToolCatalogEntry, ToolCompletedEvent, ToolStartedEvent, TurnCompletedEvent, TurnCompletionStatus, TurnStartedEvent, TurnUsage, UpdateAdminAgentRequest, UpdateApplicationContextRequest, UpdateMcpToolRequest };
|
package/package.json
CHANGED
package/testing/index.d.ts
CHANGED
|
@@ -31,6 +31,15 @@ interface NhAssistantMockApprovalStep {
|
|
|
31
31
|
displayName: string;
|
|
32
32
|
toolVersion?: number;
|
|
33
33
|
summary: string;
|
|
34
|
+
presentation?: {
|
|
35
|
+
toolDisplayName: string;
|
|
36
|
+
summary: string;
|
|
37
|
+
fields: {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}[];
|
|
41
|
+
notice: string | null;
|
|
42
|
+
} | null;
|
|
34
43
|
argumentsPreview: string;
|
|
35
44
|
targets: string[];
|
|
36
45
|
/** Default 300 seconds. */
|