@smart-cloud/ai-kit-ui 1.5.31 → 1.5.33

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.
@@ -0,0 +1,6 @@
1
+ import type { AnswerPresentation } from "@smart-cloud/ai-kit-core";
2
+ /** The same source-independent layouts render approved REST, MCP and CPT data. */
3
+ export declare function AnswerPresentationView({ presentation, locale }: {
4
+ presentation?: AnswerPresentation;
5
+ locale?: string;
6
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ import { type AnswerEntity, type AnswerPresentation } from "@smart-cloud/ai-kit-core";
2
+ /** Browser storage and transport values are untrusted, including old history. */
3
+ export declare function normalizeAnswerPresentation(value: unknown): AnswerPresentation | undefined;
4
+ export declare function answerAttributeText(attribute: AnswerEntity["attributes"][number], locale?: string): string | undefined;
5
+ /** Join source-backed attribute IDs only; conflicting row contracts are never guessed. */
6
+ export declare function answerComparisonRows(entities: AnswerEntity[]): AnswerEntity["attributes"];
7
+ /** Retain only a validated envelope when crossing a history boundary. */
8
+ export declare function withSafeAnswerPresentation<T extends {
9
+ presentation?: unknown;
10
+ }>(value: T): Omit<T, "presentation"> & {
11
+ presentation?: AnswerPresentation;
12
+ };
@@ -1,4 +1,4 @@
1
- import { type ProcessedCitations, type PromptResult } from "@smart-cloud/ai-kit-core";
1
+ import { type ProcessedCitations, type PromptResult, type AnswerPresentation } from "@smart-cloud/ai-kit-core";
2
2
  export type ChatActivity = {
3
3
  activityId: string;
4
4
  kind: "knowledge_search" | "web_search" | "web_read" | "calculation" | "script" | "validation" | "thinking" | "generating_response" | "checking_sources" | "other";
@@ -23,6 +23,7 @@ export type ChatStreamCheckpoint = {
23
23
  };
24
24
  export type ChatStreamView = {
25
25
  text: string;
26
+ presentation?: AnswerPresentation;
26
27
  activities: ChatActivity[];
27
28
  citations: StreamCitation[];
28
29
  checkpoint?: ChatStreamCheckpoint;
@@ -37,6 +38,7 @@ export type StreamCitation = {
37
38
  };
38
39
  export type ChatStreamResult = {
39
40
  result: string;
41
+ presentation?: AnswerPresentation;
40
42
  sessionId: string;
41
43
  messageId?: string;
42
44
  citations?: ProcessedCitations | StreamCitation[];
@@ -52,6 +54,8 @@ export type ChatStreamOptions = {
52
54
  url: string;
53
55
  text: string;
54
56
  locale: string;
57
+ /** Selected only after a verified backend capability advertises this schema. */
58
+ presentationVersion?: 1 | 2;
55
59
  sessionId?: string;
56
60
  requestId: string;
57
61
  resume?: ChatStreamCheckpoint;
@@ -82,6 +86,9 @@ export declare function summarizeChatActivities(activities: ChatActivity[]): {
82
86
  websites: number;
83
87
  otherTools: number;
84
88
  };
89
+ export declare function chatPresentationVersionForCapabilities(capabilities?: Record<string, unknown>): 1 | 2;
90
+ /** The same negotiation applies to HTTP prompts and every stream resume frame. */
91
+ export declare function discoverChatPresentationVersion(): Promise<1 | 2>;
85
92
  /** The backend advertises streaming only when its WebSocket route is ready. */
86
93
  export declare function discoverChatStreamUrl(): Promise<string | undefined>;
87
94
  export declare function sendChatStreamCancel(socket: WebSocket | null, checkpoint: ChatStreamCheckpoint | undefined): void;
@@ -1 +1,2 @@
1
1
  export { AiChatbot, DEFAULT_CHATBOT_LABELS } from "./AiChatbot";
2
+ export { AnswerPresentationView } from "./AnswerPresentation";
@@ -632,6 +632,8 @@
632
632
  .ai-chat-container-internal {
633
633
  display: flex;
634
634
  width: 100%;
635
+ min-width: 0;
636
+ min-height: 0;
635
637
  max-width: 1300px;
636
638
  margin-right: auto;
637
639
  margin-left: auto;
@@ -641,6 +643,7 @@
641
643
 
642
644
  /* Input Box */
643
645
  .ai-box-open {
646
+ flex-shrink: 0;
644
647
  gap: var(--ai-kit-space-2);
645
648
  padding: var(--ai-kit-space-4);
646
649
  border-top: 1px solid var(--ai-kit-color-border-light);
@@ -688,7 +691,24 @@
688
691
  }
689
692
 
690
693
  .ai-box-open {
691
- padding: var(--ai-kit-space-3);
694
+ padding: var(--ai-kit-space-2);
695
+ gap: var(--ai-kit-space-1);
696
+ }
697
+
698
+ .ai-chat-header-bar {
699
+ min-height: 44px;
700
+ }
701
+
702
+ .ai-chatbot-generated-content-disclosure {
703
+ padding: var(--ai-kit-space-1) var(--ai-kit-space-2);
704
+ }
705
+
706
+ .ai-chat-container .ai-message textarea {
707
+ min-height: 0;
708
+ max-height: min(10rem, 25dvh);
709
+ /* The autosizer's inline overflow:hidden must not clip a bounded draft. */
710
+ overflow-y: auto !important;
711
+ resize: none;
692
712
  }
693
713
  }
694
714
 
@@ -752,6 +772,8 @@
752
772
  /* Chat area */
753
773
  .ai-chat-scroll {
754
774
  flex: 1;
775
+ min-height: 0;
776
+ min-width: 0;
755
777
  overflow-y: auto;
756
778
  padding: var(--ai-kit-space-4);
757
779
  overscroll-behavior: auto;
@@ -780,6 +802,7 @@
780
802
  }
781
803
 
782
804
  .ai-chat-bubble {
805
+ min-width: 0;
783
806
  padding: 10px 12px;
784
807
  border-radius: var(--ai-kit-radius-sm);
785
808
  background: var(--ai-kit-assistant-bubble-bg);
@@ -887,6 +910,59 @@
887
910
  min-height: 64px;
888
911
  }
889
912
 
913
+ .ai-answer-link:hover {
914
+ filter: brightness(.94);
915
+ }
916
+
917
+ .ai-answer-link:focus-visible,
918
+ .ai-answer-comparison-scroll:focus-visible,
919
+ .ai-chat-table-scroll:focus-visible {
920
+ outline: 2px solid var(--ai-kit-color-primary, #1c7ed6);
921
+ outline-offset: 3px;
922
+ }
923
+
924
+ .ai-answer-status[data-answer-status-code="unknown"],
925
+ .ai-answer-status[data-answer-status-code="info"] {
926
+ color: var(--ai-kit-color-text-muted, inherit);
927
+ }
928
+
929
+ .ai-answer-status[data-answer-status-code="warning"],
930
+ .ai-answer-status[data-answer-status-code="backorder"],
931
+ .ai-answer-status[data-answer-status-code="pending"] {
932
+ background: var(--ai-kit-chat-surface-subtle, transparent);
933
+ }
934
+
935
+ .ai-answer-status[data-answer-status-code="error"],
936
+ .ai-answer-status[data-answer-status-code="unavailable"] {
937
+ color: var(--ai-kit-color-danger, inherit);
938
+ }
939
+
940
+ /* A focusable overflow rail preserves native touch and keyboard scrolling. */
941
+ .ai-chat-table-scroll {
942
+ min-width: 0;
943
+ max-width: 100%;
944
+ overflow-x: auto;
945
+ overscroll-behavior-inline: contain;
946
+ }
947
+
948
+ .ai-chat-table-scroll table {
949
+ width: max-content;
950
+ min-width: 100%;
951
+ border-collapse: collapse;
952
+ }
953
+
954
+ .ai-chat-table-scroll th,
955
+ .ai-chat-table-scroll td {
956
+ min-width: 10rem;
957
+ max-width: 20rem;
958
+ padding: .5rem .75rem;
959
+ text-align: start;
960
+ vertical-align: top;
961
+ word-break: normal;
962
+ overflow-wrap: normal;
963
+ hyphens: none;
964
+ }
965
+
890
966
  /* Thumbs */
891
967
  .ai-thumbs {
892
968
  display: flex;