@flamingo-stack/openframe-frontend-core 0.0.207 → 0.0.208
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/dist/{chunk-Z3GQGR5E.js → chunk-2HMZSCJY.js} +3158 -2074
- package/dist/chunk-2HMZSCJY.js.map +1 -0
- package/dist/chunk-4XLJWX2N.js +12 -0
- package/dist/chunk-4XLJWX2N.js.map +1 -0
- package/dist/{chunk-APM6KBPU.cjs → chunk-C5EC5AZM.cjs} +1644 -560
- package/dist/chunk-C5EC5AZM.cjs.map +1 -0
- package/dist/chunk-VFKQMAUF.cjs +12 -0
- package/dist/chunk-VFKQMAUF.cjs.map +1 -0
- package/dist/components/chat/embeddable-chat.d.ts +35 -2
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/index.d.ts +3 -0
- package/dist/components/chat/hooks/index.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-embedded-chat.d.ts +10 -169
- package/dist/components/chat/hooks/use-embedded-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +85 -0
- package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -0
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +124 -0
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -0
- package/dist/components/chat/hooks/use-unified-chat.d.ts +33 -0
- package/dist/components/chat/hooks/use-unified-chat.d.ts.map +1 -0
- package/dist/components/chat/index.cjs +8 -2
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +11 -5
- package/dist/components/chat/types/index.d.ts +1 -0
- package/dist/components/chat/types/index.d.ts.map +1 -1
- package/dist/components/chat/types/unified-chat-state.types.d.ts +185 -0
- package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -0
- package/dist/components/features/index.cjs +3 -2
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.js +2 -1
- package/dist/components/index.cjs +26 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +27 -3
- package/dist/components/navigation/index.cjs +3 -2
- package/dist/components/navigation/index.cjs.map +1 -1
- package/dist/components/navigation/index.js +2 -1
- package/dist/components/shared/delivery/delivery-lists.d.ts +16 -0
- package/dist/components/shared/delivery/delivery-lists.d.ts.map +1 -0
- package/dist/components/shared/delivery/delivery-table.d.ts +12 -0
- package/dist/components/shared/delivery/delivery-table.d.ts.map +1 -0
- package/dist/components/shared/delivery/index.d.ts +3 -0
- package/dist/components/shared/delivery/index.d.ts.map +1 -0
- package/dist/components/shared/dev-section/dev-section-page.d.ts +31 -0
- package/dist/components/shared/dev-section/dev-section-page.d.ts.map +1 -0
- package/dist/components/shared/dev-section/dev-section-view.d.ts +34 -0
- package/dist/components/shared/dev-section/dev-section-view.d.ts.map +1 -0
- package/dist/components/shared/dev-section/index.d.ts +3 -0
- package/dist/components/shared/dev-section/index.d.ts.map +1 -0
- package/dist/components/shared/legal-document/index.d.ts +10 -0
- package/dist/components/shared/legal-document/index.d.ts.map +1 -0
- package/dist/components/shared/legal-document/legal-document-page.d.ts +66 -0
- package/dist/components/shared/legal-document/legal-document-page.d.ts.map +1 -0
- package/dist/components/shared/legal-document/use-legal-docs.d.ts +40 -0
- package/dist/components/shared/legal-document/use-legal-docs.d.ts.map +1 -0
- package/dist/components/shared/product-release/index.d.ts +2 -1
- package/dist/components/shared/product-release/index.d.ts.map +1 -1
- package/dist/components/shared/product-release/release-detail-page.d.ts +11 -7
- package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
- package/dist/components/shared/roadmap/index.d.ts +18 -0
- package/dist/components/shared/roadmap/index.d.ts.map +1 -0
- package/dist/components/shared/roadmap/roadmap-grid-skeleton.d.ts +24 -0
- package/dist/components/shared/roadmap/roadmap-grid-skeleton.d.ts.map +1 -0
- package/dist/components/shared/roadmap/roadmap-grid.d.ts +18 -0
- package/dist/components/shared/roadmap/roadmap-grid.d.ts.map +1 -0
- package/dist/components/shared/roadmap/use-roadmap-voting.d.ts +25 -0
- package/dist/components/shared/roadmap/use-roadmap-voting.d.ts.map +1 -0
- package/dist/components/ui/index.cjs +8 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +11 -5
- package/dist/components/ui/release-changelog-section.d.ts +13 -2
- package/dist/components/ui/release-changelog-section.d.ts.map +1 -1
- package/dist/embed-shims/index.cjs +1 -6
- package/dist/embed-shims/index.cjs.map +1 -1
- package/dist/embed-shims/index.js +1 -6
- package/dist/embed-shims/index.js.map +1 -1
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -3
- package/dist/types/delivery.d.ts +49 -0
- package/dist/types/delivery.d.ts.map +1 -0
- package/dist/types/index.cjs +13 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +12 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/dev-sections/index.d.ts +11 -0
- package/dist/utils/dev-sections/index.d.ts.map +1 -0
- package/dist/utils/dev-sections/openframe-dev-sections.d.ts +209 -0
- package/dist/utils/dev-sections/openframe-dev-sections.d.ts.map +1 -0
- package/dist/utils/index.cjs +82 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +81 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/embeddable-chat.tsx +123 -8
- package/src/components/chat/hooks/index.ts +9 -2
- package/src/components/chat/hooks/use-embedded-chat.ts +18 -1016
- package/src/components/chat/hooks/use-nats-chat-adapter.ts +372 -0
- package/src/components/chat/hooks/use-sse-chat-adapter.ts +1058 -0
- package/src/components/chat/hooks/use-unified-chat.ts +171 -0
- package/src/components/chat/types/index.ts +1 -0
- package/src/components/chat/types/unified-chat-state.types.ts +215 -0
- package/src/components/index.ts +8 -0
- package/src/components/shared/delivery/delivery-lists.tsx +199 -0
- package/src/components/shared/delivery/delivery-table.tsx +174 -0
- package/src/components/shared/delivery/index.ts +9 -0
- package/src/components/shared/dev-section/dev-section-page.tsx +72 -0
- package/src/components/shared/dev-section/dev-section-view.tsx +129 -0
- package/src/components/shared/dev-section/index.ts +2 -0
- package/src/components/shared/legal-document/index.ts +19 -0
- package/src/components/shared/legal-document/legal-document-page.tsx +178 -0
- package/src/components/shared/legal-document/use-legal-docs.ts +123 -0
- package/src/components/shared/product-release/index.ts +14 -3
- package/src/components/shared/product-release/release-detail-page.tsx +45 -7
- package/src/components/shared/roadmap/index.ts +23 -0
- package/src/components/shared/roadmap/roadmap-grid-skeleton.tsx +74 -0
- package/src/components/shared/roadmap/roadmap-grid.tsx +106 -0
- package/src/components/shared/roadmap/use-roadmap-voting.ts +163 -0
- package/src/components/ui/release-changelog-section.tsx +113 -32
- package/src/stories/EmbeddableChat.stories.tsx +186 -0
- package/src/types/delivery.ts +54 -0
- package/src/types/index.ts +1 -0
- package/src/utils/dev-sections/index.ts +17 -0
- package/src/utils/dev-sections/openframe-dev-sections.ts +148 -0
- package/src/utils/index.ts +6 -1
- package/dist/chunk-APM6KBPU.cjs.map +0 -1
- package/dist/chunk-Z3GQGR5E.js.map +0 -1
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - `currentPlatform()` → `useRequiredChatRuntime().source`.
|
|
16
16
|
* - `useNavLink`/`NavLinkAnchor` → chip-anchor rewrite via
|
|
17
17
|
* `handleChatNavClick` + lib's `NavLinkAnchorViaRuntime`.
|
|
18
|
-
* - `useDocChat(source)` → `
|
|
18
|
+
* - `useDocChat(source)` → `useSseChatAdapter()` (reads source from runtime).
|
|
19
19
|
* - `tableIdForDocumentType` import deleted (dead per audit).
|
|
20
20
|
* - `renderChatInlineEntityCard` imported from lib's entity-cards barrel.
|
|
21
21
|
* - `useCloseOnNavigation` signature is `(close, pathname)` — pass `null`
|
|
@@ -54,7 +54,13 @@ import { renderChatInlineEntityCard } from './entity-cards/dispatch'
|
|
|
54
54
|
import type { ChatCardDispatchExtras } from './entity-cards/dispatch'
|
|
55
55
|
|
|
56
56
|
import { useRequiredChatRuntime } from '../../contexts/chat-runtime-context'
|
|
57
|
-
import {
|
|
57
|
+
import { type ChatSource, type UseSseChatAdapterOptions } from './hooks/use-sse-chat-adapter'
|
|
58
|
+
import {
|
|
59
|
+
useUnifiedChat,
|
|
60
|
+
type ChatMode,
|
|
61
|
+
type UseUnifiedChatModes,
|
|
62
|
+
} from './hooks/use-unified-chat'
|
|
63
|
+
import type { UseNatsChatAdapterConfig } from './hooks/use-nats-chat-adapter'
|
|
58
64
|
import { useChatAttachments } from './hooks/use-chat-attachments'
|
|
59
65
|
import { useChatAttachmentImageGallery } from './hooks/use-chat-attachment-image-gallery'
|
|
60
66
|
import { useChatIdentity } from './hooks/use-chat-identity'
|
|
@@ -84,7 +90,7 @@ import { formatSingularLookupInvocation } from './utils/slash-dispatch-utils'
|
|
|
84
90
|
|
|
85
91
|
/** Lib-side type alias kept inline to avoid leaking the (deprecated) hub
|
|
86
92
|
* `rag-table-config` `DocSource` import. The chat source is always a
|
|
87
|
-
* string id; `
|
|
93
|
+
* string id; `useSseChatAdapter` reads it from `runtime.source`. */
|
|
88
94
|
type DocSource = string
|
|
89
95
|
|
|
90
96
|
export interface EmbeddableChatProps {
|
|
@@ -117,10 +123,46 @@ export interface EmbeddableChatProps {
|
|
|
117
123
|
* (programs + product_release). Forwarded straight to
|
|
118
124
|
* `renderChatInlineEntityCard`. */
|
|
119
125
|
extras?: ChatCardDispatchExtras
|
|
120
|
-
/** Optional callback used by `
|
|
126
|
+
/** Optional callback used by `useSseChatAdapter`'s `displayRef` /
|
|
121
127
|
* `discussRef` flow to translate an LLM document type into the
|
|
122
|
-
* registry table id for entity-id-filtered retrieval.
|
|
128
|
+
* registry table id for entity-id-filtered retrieval.
|
|
129
|
+
*
|
|
130
|
+
* Legacy top-level form. The new shape is `modes.guide.tableIdForDocumentType`.
|
|
131
|
+
* When both are present, `modes` wins. */
|
|
123
132
|
tableIdForDocumentType?: (documentType: string) => string | null
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Per-mode transport configuration. When omitted, the component
|
|
136
|
+
* falls back to legacy guide-only behaviour synthesised from the
|
|
137
|
+
* top-level `tableIdForDocumentType` prop — multi-platform-hub and
|
|
138
|
+
* any other existing consumer keep working with zero changes.
|
|
139
|
+
*
|
|
140
|
+
* When provided, this is the canonical way to wire chat transports:
|
|
141
|
+
*
|
|
142
|
+
* - `modes.guide` → SSE/Guide adapter options (RAG retrieval, hub).
|
|
143
|
+
* - `modes.mingo` → NATS/Mingo adapter config (agent, openframe).
|
|
144
|
+
*
|
|
145
|
+
* Configuring both modes makes the in-panel mode toggle appear so
|
|
146
|
+
* the user can flip between Guide and Mingo without losing either
|
|
147
|
+
* history (each mode keeps its own local thread).
|
|
148
|
+
*/
|
|
149
|
+
modes?: UseUnifiedChatModes
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Controlled active-mode. When provided, `onActiveModeChange` MUST
|
|
153
|
+
* also be provided. For uncontrolled use see `defaultActiveMode`.
|
|
154
|
+
*/
|
|
155
|
+
activeMode?: ChatMode
|
|
156
|
+
|
|
157
|
+
/** Controlled active-mode change handler. Required when `activeMode` is set. */
|
|
158
|
+
onActiveModeChange?: (mode: ChatMode) => void
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Initial active mode for uncontrolled mode. Ignored when `activeMode`
|
|
162
|
+
* is set. Defaults to `'guide'` when `modes.guide` is configured,
|
|
163
|
+
* else `'mingo'`.
|
|
164
|
+
*/
|
|
165
|
+
defaultActiveMode?: ChatMode
|
|
124
166
|
}
|
|
125
167
|
|
|
126
168
|
// =============================================================================
|
|
@@ -490,6 +532,10 @@ function EmbeddableChatInner({
|
|
|
490
532
|
showInternalTrigger = true,
|
|
491
533
|
extras,
|
|
492
534
|
tableIdForDocumentType,
|
|
535
|
+
modes,
|
|
536
|
+
activeMode: controlledActiveMode,
|
|
537
|
+
onActiveModeChange,
|
|
538
|
+
defaultActiveMode,
|
|
493
539
|
}: EmbeddableChatProps) {
|
|
494
540
|
const runtime = useRequiredChatRuntime()
|
|
495
541
|
const source = runtime.source as DocSource
|
|
@@ -639,6 +685,42 @@ function EmbeddableChatInner({
|
|
|
639
685
|
identityUser?.name?.split(' ')[0]?.trim()) ||
|
|
640
686
|
undefined
|
|
641
687
|
|
|
688
|
+
// Synthesize `modes` from legacy props when the new API isn't used.
|
|
689
|
+
// `modes` wins when both are present — the legacy top-level
|
|
690
|
+
// `tableIdForDocumentType` is then silently ignored.
|
|
691
|
+
const effectiveModes = useMemo<UseUnifiedChatModes>(() => {
|
|
692
|
+
if (modes) return modes
|
|
693
|
+
const guideOptions: UseSseChatAdapterOptions = tableIdForDocumentType
|
|
694
|
+
? { tableIdForDocumentType }
|
|
695
|
+
: {}
|
|
696
|
+
return { guide: guideOptions }
|
|
697
|
+
}, [modes, tableIdForDocumentType])
|
|
698
|
+
|
|
699
|
+
// Initial active mode picks the first configured slot when neither
|
|
700
|
+
// controlled `activeMode` nor `defaultActiveMode` is provided. Guide
|
|
701
|
+
// wins ties so legacy callers see no behaviour change.
|
|
702
|
+
const initialActiveMode: ChatMode =
|
|
703
|
+
controlledActiveMode ??
|
|
704
|
+
defaultActiveMode ??
|
|
705
|
+
(effectiveModes.guide ? 'guide' : 'mingo')
|
|
706
|
+
|
|
707
|
+
const [uncontrolledActiveMode, setUncontrolledActiveMode] =
|
|
708
|
+
useState<ChatMode>(initialActiveMode)
|
|
709
|
+
const activeMode = controlledActiveMode ?? uncontrolledActiveMode
|
|
710
|
+
const handleActiveModeChange = useCallback(
|
|
711
|
+
(next: ChatMode) => {
|
|
712
|
+
if (controlledActiveMode === undefined) {
|
|
713
|
+
setUncontrolledActiveMode(next)
|
|
714
|
+
}
|
|
715
|
+
onActiveModeChange?.(next)
|
|
716
|
+
},
|
|
717
|
+
[controlledActiveMode, onActiveModeChange],
|
|
718
|
+
)
|
|
719
|
+
|
|
720
|
+
// Mode toggle visible only when both slots are populated.
|
|
721
|
+
const showModeToggle =
|
|
722
|
+
effectiveModes.guide !== undefined && effectiveModes.mingo !== undefined
|
|
723
|
+
|
|
642
724
|
const {
|
|
643
725
|
messages: rawMessages,
|
|
644
726
|
isLoading: chatLoading,
|
|
@@ -654,7 +736,7 @@ function EmbeddableChatInner({
|
|
|
654
736
|
currentCacheHitRatePct,
|
|
655
737
|
currentUsageBreakdown,
|
|
656
738
|
displayRef,
|
|
657
|
-
} =
|
|
739
|
+
} = useUnifiedChat({ modes: effectiveModes, activeMode })
|
|
658
740
|
|
|
659
741
|
// Chat-attachment hooks (v2 attachment feature).
|
|
660
742
|
const {
|
|
@@ -736,7 +818,7 @@ function EmbeddableChatInner({
|
|
|
736
818
|
}
|
|
737
819
|
sendMessage(augmentedText, {
|
|
738
820
|
...(readyAttachments.length > 0
|
|
739
|
-
? {
|
|
821
|
+
? { attachments: readyAttachments }
|
|
740
822
|
: {}),
|
|
741
823
|
})
|
|
742
824
|
if (readyAttachments.length > 0) {
|
|
@@ -894,6 +976,35 @@ function EmbeddableChatInner({
|
|
|
894
976
|
fullWidth
|
|
895
977
|
className="!rounded-xl"
|
|
896
978
|
/>
|
|
979
|
+
{showModeToggle ? (
|
|
980
|
+
<div
|
|
981
|
+
role="radiogroup"
|
|
982
|
+
aria-label="Chat mode"
|
|
983
|
+
className="mt-3 inline-flex rounded-lg border border-ods-border bg-ods-bg-secondary p-0.5"
|
|
984
|
+
>
|
|
985
|
+
{(['mingo', 'guide'] as ChatMode[]).map((m) => {
|
|
986
|
+
const isActive = activeMode === m
|
|
987
|
+
const label = m === 'mingo' ? 'Mingo' : 'Guide'
|
|
988
|
+
return (
|
|
989
|
+
<button
|
|
990
|
+
key={m}
|
|
991
|
+
type="button"
|
|
992
|
+
role="radio"
|
|
993
|
+
aria-checked={isActive}
|
|
994
|
+
onClick={() => handleActiveModeChange(m)}
|
|
995
|
+
className={
|
|
996
|
+
'px-3 py-1 text-sm rounded-md transition-colors ' +
|
|
997
|
+
(isActive
|
|
998
|
+
? 'bg-ods-accent text-ods-text-on-accent'
|
|
999
|
+
: 'text-ods-text-secondary hover:text-ods-text-primary')
|
|
1000
|
+
}
|
|
1001
|
+
>
|
|
1002
|
+
{label}
|
|
1003
|
+
</button>
|
|
1004
|
+
)
|
|
1005
|
+
})}
|
|
1006
|
+
</div>
|
|
1007
|
+
) : null}
|
|
897
1008
|
</div>
|
|
898
1009
|
|
|
899
1010
|
<div
|
|
@@ -1071,7 +1182,11 @@ function EmbeddableChatInner({
|
|
|
1071
1182
|
|
|
1072
1183
|
<div className="flex items-center gap-2 w-full">
|
|
1073
1184
|
<ChatAttachmentAddButton
|
|
1074
|
-
|
|
1185
|
+
// Attachments are Guide-only: the NATS agent backend
|
|
1186
|
+
// doesn't accept them, so the add-button is hidden in
|
|
1187
|
+
// Mingo mode regardless of the identity endpoint's
|
|
1188
|
+
// capability flag.
|
|
1189
|
+
attachmentsEnabled={attachmentsEnabled && activeMode === 'guide'}
|
|
1075
1190
|
attachmentsCount={stagedAttachments.length}
|
|
1076
1191
|
onAddFiles={addAttachmentFiles}
|
|
1077
1192
|
disabled={chatLoading}
|
|
@@ -16,10 +16,17 @@ export * from './use-close-on-navigation'
|
|
|
16
16
|
|
|
17
17
|
// useChat + useSSE — ported from hub `hooks/useChat.ts` + `hooks/useSSE.ts`
|
|
18
18
|
// minus the MockChatService + useChatConfig dependencies (which stay in
|
|
19
|
-
// hub-only code).
|
|
20
|
-
// the hub's `useDocChat`.
|
|
19
|
+
// hub-only code).
|
|
21
20
|
export * from './use-chat'
|
|
22
21
|
export * from './use-sse'
|
|
22
|
+
|
|
23
|
+
// Unified chat surface — single public hook + two transport adapters.
|
|
24
|
+
// Consumers typically use `useUnifiedChat({ modes, activeMode })`; the
|
|
25
|
+
// adapter hooks are exposed for advanced cases where direct transport
|
|
26
|
+
// access is needed. `useEmbeddedChat` is the legacy SSE alias.
|
|
27
|
+
export * from './use-sse-chat-adapter'
|
|
28
|
+
export * from './use-nats-chat-adapter'
|
|
29
|
+
export * from './use-unified-chat'
|
|
23
30
|
export * from './use-embedded-chat'
|
|
24
31
|
|
|
25
32
|
// useProxiedImageUrl — runtime-driven hook wrapping pure
|