@newheap/platform-ai-chat 0.2.0 → 0.4.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/fesm2022/newheap-platform-ai-chat.mjs +333 -35
- package/fesm2022/newheap-platform-ai-chat.mjs.map +1 -1
- package/i18n/en.json +3 -0
- package/i18n/nl.json +3 -0
- package/index.d.ts +39 -2
- package/package.json +1 -1
package/i18n/en.json
CHANGED
|
@@ -159,6 +159,9 @@
|
|
|
159
159
|
"assistant-turn-failed": "The assistant could not finish the answer. Try again.",
|
|
160
160
|
"assistant-turn-timeout": "The answer took too long and was stopped. Try again or ask a narrower question."
|
|
161
161
|
},
|
|
162
|
+
"notices": {
|
|
163
|
+
"no-answer": "The assistant finished without an answer. Try again or rephrase your question."
|
|
164
|
+
},
|
|
162
165
|
"preferences": {
|
|
163
166
|
"title": "Your preferences",
|
|
164
167
|
"description": "Choose how the assistant answers you. Preferences change the style only; they never change what the assistant may do or which actions need your approval.",
|
package/i18n/nl.json
CHANGED
|
@@ -159,6 +159,9 @@
|
|
|
159
159
|
"assistant-turn-failed": "De assistent kon het antwoord niet afmaken. Probeer het opnieuw.",
|
|
160
160
|
"assistant-turn-timeout": "Het antwoord duurde te lang en is gestopt. Probeer het opnieuw of stel een gerichtere vraag."
|
|
161
161
|
},
|
|
162
|
+
"notices": {
|
|
163
|
+
"no-answer": "De assistent is klaar zonder antwoord. Probeer het opnieuw of stel je vraag anders."
|
|
164
|
+
},
|
|
162
165
|
"preferences": {
|
|
163
166
|
"title": "Je voorkeuren",
|
|
164
167
|
"description": "Kies hoe de assistent je antwoordt. Voorkeuren veranderen alleen de stijl; ze veranderen nooit wat de assistent mag of welke acties je goedkeuring nodig hebben.",
|
package/index.d.ts
CHANGED
|
@@ -336,6 +336,12 @@ interface NhAssistantConfig {
|
|
|
336
336
|
* failing getter or an invalid shape only leaves the context out. Default: none.
|
|
337
337
|
*/
|
|
338
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>;
|
|
339
345
|
/** Injectable access policy. Default: always allowed. */
|
|
340
346
|
accessPolicy?: Type<NhAssistantAccessPolicy>;
|
|
341
347
|
/** Agent selected when the user has not chosen one. Default: the first agent the server lists. */
|
|
@@ -507,6 +513,11 @@ declare class NhAssistantAdminApiService {
|
|
|
507
513
|
declare function applyNhAssistantEvent(conversation: Conversation, event: NhAssistantSseEvent, clientMessageId?: string): Conversation;
|
|
508
514
|
/** Records the user's approval decision locally until the server state is reloaded. */
|
|
509
515
|
declare function applyNhAssistantApprovalDecision(conversation: Conversation, approvalId: string, decision: 'approve' | 'reject'): Conversation;
|
|
516
|
+
/**
|
|
517
|
+
* True when an assistant message after the latest user message contains non-blank text,
|
|
518
|
+
* so the latest turn produced a visible answer. Tool calls and approvals alone do not count.
|
|
519
|
+
*/
|
|
520
|
+
declare function nhAssistantLatestTurnHasText(conversation: Conversation): boolean;
|
|
510
521
|
|
|
511
522
|
/** Limits of the page context (contract 15.2). */
|
|
512
523
|
declare const NH_ASSISTANT_PAGE_CONTEXT_LIMITS: {
|
|
@@ -532,6 +543,13 @@ interface NhAssistantError {
|
|
|
532
543
|
code: string;
|
|
533
544
|
messageKey: string;
|
|
534
545
|
}
|
|
546
|
+
/**
|
|
547
|
+
* A non-blocking remark about a turn that completed normally, for example a limit that cut the
|
|
548
|
+
* answer short. The conversation stays usable; the notice only explains the answer.
|
|
549
|
+
*/
|
|
550
|
+
type NhAssistantNotice = NhAssistantError;
|
|
551
|
+
/** Notice code for a completed turn that produced no answer text and no server code. */
|
|
552
|
+
declare const NH_ASSISTANT_NO_ANSWER_NOTICE_CODE = "assistant-no-answer";
|
|
535
553
|
/**
|
|
536
554
|
* Signal-based state of one assistant scope: availability, agents, the conversation list
|
|
537
555
|
* and the active conversation with its streamed turn.
|
|
@@ -541,6 +559,7 @@ declare class NhAssistantStore {
|
|
|
541
559
|
private readonly config;
|
|
542
560
|
private readonly injector;
|
|
543
561
|
private readonly accessPolicy;
|
|
562
|
+
private readonly uiState;
|
|
544
563
|
private readonly accessGrantedState;
|
|
545
564
|
private readonly statusState;
|
|
546
565
|
private readonly statusLoadingState;
|
|
@@ -553,14 +572,19 @@ declare class NhAssistantStore {
|
|
|
553
572
|
private readonly streamingState;
|
|
554
573
|
private readonly decidingState;
|
|
555
574
|
private readonly errorState;
|
|
575
|
+
private readonly noticeState;
|
|
556
576
|
private readonly lastUsageState;
|
|
557
577
|
private readonly restoredDraftState;
|
|
558
578
|
private readonly pageContextState;
|
|
559
579
|
private readonly pageContextExcludedState;
|
|
580
|
+
private readonly restorePanelOpenState;
|
|
560
581
|
private accessSubscription?;
|
|
561
582
|
private streamSubscription?;
|
|
562
583
|
private cancelTimer?;
|
|
563
584
|
private initialization?;
|
|
585
|
+
private statusRevision;
|
|
586
|
+
private accountRevision;
|
|
587
|
+
private pendingSendResolve?;
|
|
564
588
|
/** True when the access policy allows the user and the server reports the assistant as enabled. */
|
|
565
589
|
readonly enabled: _angular_core.Signal<boolean>;
|
|
566
590
|
readonly accessGranted: _angular_core.Signal<boolean | null>;
|
|
@@ -583,6 +607,8 @@ declare class NhAssistantStore {
|
|
|
583
607
|
readonly pendingApproval: _angular_core.Signal<ApprovalPart | null>;
|
|
584
608
|
readonly deciding: _angular_core.Signal<boolean>;
|
|
585
609
|
readonly error: _angular_core.Signal<NhAssistantError | null>;
|
|
610
|
+
/** Non-blocking remark about the latest completed turn; shown only while no error is shown. */
|
|
611
|
+
readonly notice: _angular_core.Signal<NhAssistantError | null>;
|
|
586
612
|
readonly lastUsage: _angular_core.Signal<TurnUsage | null>;
|
|
587
613
|
/** Text of a message the server did not accept, so the composer can offer it again. */
|
|
588
614
|
readonly restoredDraft: _angular_core.Signal<string | null>;
|
|
@@ -590,6 +616,8 @@ declare class NhAssistantStore {
|
|
|
590
616
|
readonly pageContext: _angular_core.Signal<ClientContext | null>;
|
|
591
617
|
/** True when the user left the page context out of the next message. */
|
|
592
618
|
readonly pageContextExcluded: _angular_core.Signal<boolean>;
|
|
619
|
+
/** Whether the drawer was open when this account last left the application. */
|
|
620
|
+
readonly restorePanelOpen: _angular_core.Signal<boolean>;
|
|
593
621
|
/** True while the user can send: enabled, an agent is chosen and no turn runs or waits. */
|
|
594
622
|
readonly canSend: _angular_core.Signal<boolean>;
|
|
595
623
|
constructor();
|
|
@@ -603,6 +631,7 @@ declare class NhAssistantStore {
|
|
|
603
631
|
/** Leaves the active conversation; the next message creates a new one. */
|
|
604
632
|
startNewConversation(): void;
|
|
605
633
|
openConversation(conversationId: string): Promise<void>;
|
|
634
|
+
private loadConversation;
|
|
606
635
|
deleteConversation(conversationId: string): Promise<void>;
|
|
607
636
|
/**
|
|
608
637
|
* Sends a user message. Creates a conversation with the selected agent when none is
|
|
@@ -615,6 +644,9 @@ declare class NhAssistantStore {
|
|
|
615
644
|
/** Asks the server to stop the running turn or to abandon a waiting approval. */
|
|
616
645
|
cancel(): Promise<void>;
|
|
617
646
|
clearError(): void;
|
|
647
|
+
clearNotice(): void;
|
|
648
|
+
/** Persists only drawer visibility, never the page context or a message draft. */
|
|
649
|
+
setPanelOpen(open: boolean): void;
|
|
618
650
|
/** Reads the host's page context again so the chip shows what the next message sends. */
|
|
619
651
|
refreshPageContext(): Promise<void>;
|
|
620
652
|
/** Leaves the page context out of the next message only, or includes it again. */
|
|
@@ -630,7 +662,10 @@ declare class NhAssistantStore {
|
|
|
630
662
|
private startInitialization;
|
|
631
663
|
private createConversation;
|
|
632
664
|
private runStream;
|
|
665
|
+
private stopLocalTurn;
|
|
633
666
|
private applyEvent;
|
|
667
|
+
/** A completed turn with a server code, or without any answer text, explains itself with a notice. */
|
|
668
|
+
private completionNotice;
|
|
634
669
|
private afterTurn;
|
|
635
670
|
private reloadActiveConversation;
|
|
636
671
|
private updateActive;
|
|
@@ -664,6 +699,7 @@ declare class NhAssistantPanelService {
|
|
|
664
699
|
readonly isOpen: Signal<boolean>;
|
|
665
700
|
constructor();
|
|
666
701
|
open(conversationId?: string): void;
|
|
702
|
+
private showPanel;
|
|
667
703
|
close(): void;
|
|
668
704
|
toggle(): void;
|
|
669
705
|
/** Called by `nh-assistant-panel`; hosts should place that component once instead. */
|
|
@@ -733,6 +769,7 @@ declare class NhAssistantPanelComponent implements AfterViewInit, OnDestroy {
|
|
|
733
769
|
readonly composerDisabled: _angular_core.Signal<boolean>;
|
|
734
770
|
readonly composerStatus: _angular_core.Signal<"running" | "waiting-for-approval" | null>;
|
|
735
771
|
readonly errorKeys: _angular_core.Signal<string[]>;
|
|
772
|
+
readonly noticeKeys: _angular_core.Signal<string[]>;
|
|
736
773
|
constructor();
|
|
737
774
|
ngAfterViewInit(): void;
|
|
738
775
|
ngOnDestroy(): void;
|
|
@@ -959,5 +996,5 @@ declare function nhAssistantErrorKeys(error: NhAssistantError | null): string[];
|
|
|
959
996
|
/** Dash-case identifiers as the contract requires for agent and MCP server ids. */
|
|
960
997
|
declare const NH_ASSISTANT_DASH_CASE: RegExp;
|
|
961
998
|
|
|
962
|
-
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 };
|
|
963
|
-
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 };
|
|
999
|
+
export { NH_ASSISTANT_ACCESS_POLICY, NH_ASSISTANT_CONFIG, NH_ASSISTANT_FETCH, NH_ASSISTANT_ICONS, NH_ASSISTANT_MAX_CUSTOM_INSTRUCTIONS, NH_ASSISTANT_NO_ANSWER_NOTICE_CODE, 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, nhAssistantLatestTurnHasText, normalizeNhAssistantClientContext, provideNhAssistant, NH_ASSISTANT_DASH_CASE as ɵNH_ASSISTANT_DASH_CASE, NhAssistantIconComponent as ɵNhAssistantIconComponent, NhAssistantTranslatePipe as ɵNhAssistantTranslatePipe, nhAssistantErrorKeys as ɵnhAssistantErrorKeys, toNhAssistantError as ɵtoNhAssistantError };
|
|
1000
|
+
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, NhAssistantNotice, NhAssistantRawSseMessage, NhAssistantSseEvent, NhAssistantSseEventMap, NhAssistantSseEventType, NhAssistantStatusCodes, SendMessageRequest, TextPart, ToolCallPart, ToolCallStatus, ToolCatalogEffect, ToolCatalogEntry, ToolCompletedEvent, ToolStartedEvent, TurnCompletedEvent, TurnCompletionStatus, TurnStartedEvent, TurnUsage, UpdateAdminAgentRequest, UpdateApplicationContextRequest, UpdateMcpToolRequest };
|