@flamingo-stack/openframe-frontend-core 0.0.609-snapshot.20260908170120 → 0.0.609
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/chat-protocol/events.d.ts +2 -21
- package/dist/chat-protocol/events.d.ts.map +1 -1
- package/dist/chat-protocol/index.cjs +9 -211
- package/dist/chat-protocol/index.cjs.map +1 -1
- package/dist/chat-protocol/index.js +9 -211
- package/dist/chat-protocol/index.js.map +1 -1
- package/dist/chat-protocol/nats-decoder.d.ts.map +1 -1
- package/dist/{chunk-2YMDDD5V.cjs → chunk-3N4FXBVJ.cjs} +3 -3
- package/dist/{chunk-2YMDDD5V.cjs.map → chunk-3N4FXBVJ.cjs.map} +1 -1
- package/dist/{chunk-THCB7NHV.cjs → chunk-3XNMDLGB.cjs} +9 -9
- package/dist/{chunk-THCB7NHV.cjs.map → chunk-3XNMDLGB.cjs.map} +1 -1
- package/dist/{chunk-GFAHCXIL.cjs → chunk-45XXK2VU.cjs} +10 -10
- package/dist/{chunk-GFAHCXIL.cjs.map → chunk-45XXK2VU.cjs.map} +1 -1
- package/dist/{chunk-2QBXG74C.js → chunk-6MLRFM3T.js} +5 -5
- package/dist/{chunk-IBMHEOBV.js → chunk-B3UXNGVM.js} +3 -3
- package/dist/{chunk-O6PO5BHE.js → chunk-B7LYKBCD.js} +5 -5
- package/dist/{chunk-F2C2U7CP.js → chunk-BSMPCPOZ.js} +299 -590
- package/dist/chunk-BSMPCPOZ.js.map +1 -0
- package/dist/{chunk-MGXSJI23.js → chunk-BUXGWBTF.js} +2 -2
- package/dist/{chunk-OIKZDXNW.js → chunk-C7CTEUU7.js} +2 -2
- package/dist/{chunk-EANAFFAD.cjs → chunk-CZTOSG7Q.cjs} +22 -22
- package/dist/{chunk-EANAFFAD.cjs.map → chunk-CZTOSG7Q.cjs.map} +1 -1
- package/dist/{chunk-C4KQ2XPK.cjs → chunk-D3DTC7SZ.cjs} +15 -15
- package/dist/{chunk-C4KQ2XPK.cjs.map → chunk-D3DTC7SZ.cjs.map} +1 -1
- package/dist/{chunk-HKJ3WKGW.cjs → chunk-DKNXAJMP.cjs} +159 -159
- package/dist/{chunk-HKJ3WKGW.cjs.map → chunk-DKNXAJMP.cjs.map} +1 -1
- package/dist/{chunk-UFFVMZDL.cjs → chunk-FYG7QNAO.cjs} +5 -5
- package/dist/{chunk-UFFVMZDL.cjs.map → chunk-FYG7QNAO.cjs.map} +1 -1
- package/dist/{chunk-THCSSPXU.cjs → chunk-GMOBT5NP.cjs} +70 -70
- package/dist/{chunk-THCSSPXU.cjs.map → chunk-GMOBT5NP.cjs.map} +1 -1
- package/dist/{chunk-HQSCJYCF.js → chunk-HGVW7OHI.js} +2 -2
- package/dist/{chunk-FS3CTGIR.js → chunk-JKM5FH63.js} +3 -3
- package/dist/{chunk-37CAZTLP.js → chunk-JOCVQZGT.js} +5 -5
- package/dist/{chunk-ROOIHDLS.js → chunk-JR7I2AGL.js} +3 -3
- package/dist/{chunk-OVVKVIMH.cjs → chunk-L2JWC5VS.cjs} +43 -43
- package/dist/{chunk-OVVKVIMH.cjs.map → chunk-L2JWC5VS.cjs.map} +1 -1
- package/dist/{chunk-25YIHMZ6.js → chunk-LA2W5L6K.js} +2 -2
- package/dist/{chunk-V6TINNLD.js → chunk-MVBRMQGU.js} +2 -2
- package/dist/{chunk-Q3APHZK5.cjs → chunk-NJUSDREV.cjs} +22 -22
- package/dist/{chunk-Q3APHZK5.cjs.map → chunk-NJUSDREV.cjs.map} +1 -1
- package/dist/{chunk-FASOANK7.cjs → chunk-O2M4T34Q.cjs} +4 -4
- package/dist/{chunk-FASOANK7.cjs.map → chunk-O2M4T34Q.cjs.map} +1 -1
- package/dist/{chunk-R2UDEMKK.js → chunk-OTYV6SDN.js} +3 -3
- package/dist/{chunk-HZS4TV34.js → chunk-QX4ANESW.js} +6 -6
- package/dist/{chunk-ZDLCWNM6.cjs → chunk-RZM6FPOT.cjs} +25 -25
- package/dist/{chunk-ZDLCWNM6.cjs.map → chunk-RZM6FPOT.cjs.map} +1 -1
- package/dist/{chunk-GNLV326I.cjs → chunk-SEW25Y2W.cjs} +10 -10
- package/dist/{chunk-GNLV326I.cjs.map → chunk-SEW25Y2W.cjs.map} +1 -1
- package/dist/{chunk-QE2Z6WME.cjs → chunk-TCEALWE3.cjs} +33 -33
- package/dist/{chunk-QE2Z6WME.cjs.map → chunk-TCEALWE3.cjs.map} +1 -1
- package/dist/{chunk-OJZW3GE2.js → chunk-TJ3GFULR.js} +3 -3
- package/dist/{chunk-Q2CNCBMK.js → chunk-VCYRJY7J.js} +4 -4
- package/dist/{chunk-YXTAV2E3.cjs → chunk-XNDTYTVT.cjs} +683 -974
- package/dist/chunk-XNDTYTVT.cjs.map +1 -0
- package/dist/{chunk-WJQOYSR3.cjs → chunk-ZRLFBLME.cjs} +3 -3
- package/dist/{chunk-WJQOYSR3.cjs.map → chunk-ZRLFBLME.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +28 -5
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +2 -2
- package/dist/components/chat/index.js +1 -1
- package/dist/components/chat/remark-card-links.d.ts +4 -5
- package/dist/components/chat/remark-card-links.d.ts.map +1 -1
- package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -1
- package/dist/components/chat/tool-execution-display.d.ts.map +1 -1
- package/dist/components/chat/types/component.types.d.ts +0 -27
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/chat/types/message.types.d.ts +1 -81
- package/dist/components/chat/types/message.types.d.ts.map +1 -1
- package/dist/components/chat/types/unified-chat-state.types.d.ts +3 -12
- package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -1
- package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/docs/index.js +6 -6
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +4 -4
- package/dist/components/faq/index.js +3 -3
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/help-center-pages/index.cjs +23 -23
- package/dist/components/help-center-pages/index.js +14 -14
- package/dist/components/index.cjs +38 -38
- package/dist/components/index.js +13 -13
- package/dist/components/meeting-scheduler/index.cjs +24 -24
- package/dist/components/meeting-scheduler/index.js +2 -2
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/navigation/index.js +5 -5
- package/dist/components/onboarding-guides/index.cjs +6 -6
- package/dist/components/onboarding-guides/index.js +5 -5
- package/dist/components/tickets/index.cjs +7 -7
- package/dist/components/tickets/index.js +6 -6
- package/dist/components/ui/index.cjs +3 -3
- package/dist/components/ui/index.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.js +6 -6
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/chat-protocol/events.ts +1 -22
- package/src/chat-protocol/nats-decoder.ts +0 -12
- package/src/components/chat/chat-message-enhanced.tsx +12 -37
- package/src/components/chat/chat-message-list.tsx +1 -14
- package/src/components/chat/embeddable-chat.tsx +87 -47
- package/src/components/chat/hooks/use-sse-chat-adapter.ts +28 -5
- package/src/components/chat/remark-card-links.ts +12 -14
- package/src/components/chat/stream/chat-stream-reducer.ts +3 -48
- package/src/components/chat/tool-execution-display.tsx +4 -18
- package/src/components/chat/types/component.types.ts +0 -27
- package/src/components/chat/types/message.types.ts +0 -83
- package/src/components/chat/types/unified-chat-state.types.ts +3 -12
- package/src/components/chat/utils/process-historical-messages.ts +0 -25
- package/dist/chat-protocol/card-marker.d.ts +0 -31
- package/dist/chat-protocol/card-marker.d.ts.map +0 -1
- package/dist/chat-protocol/source-metadata.d.ts +0 -56
- package/dist/chat-protocol/source-metadata.d.ts.map +0 -1
- package/dist/chunk-F2C2U7CP.js.map +0 -1
- package/dist/chunk-YXTAV2E3.cjs.map +0 -1
- package/dist/components/chat/utils/cited-sources.d.ts +0 -24
- package/dist/components/chat/utils/cited-sources.d.ts.map +0 -1
- package/dist/components/chat/utils/host-message.d.ts +0 -41
- package/dist/components/chat/utils/host-message.d.ts.map +0 -1
- package/src/chat-protocol/__tests__/card-marker.test.ts +0 -63
- package/src/chat-protocol/__tests__/source-metadata.test.ts +0 -243
- package/src/chat-protocol/card-marker.ts +0 -40
- package/src/chat-protocol/source-metadata.ts +0 -336
- package/src/components/chat/__tests__/tool-execution-display.test.tsx +0 -70
- package/src/components/chat/utils/__tests__/cited-sources.test.ts +0 -80
- package/src/components/chat/utils/__tests__/host-message.test.ts +0 -92
- package/src/components/chat/utils/__tests__/process-historical-messages-sources.test.ts +0 -138
- package/src/components/chat/utils/cited-sources.ts +0 -61
- package/src/components/chat/utils/host-message.ts +0 -87
- /package/dist/{chunk-2QBXG74C.js.map → chunk-6MLRFM3T.js.map} +0 -0
- /package/dist/{chunk-IBMHEOBV.js.map → chunk-B3UXNGVM.js.map} +0 -0
- /package/dist/{chunk-O6PO5BHE.js.map → chunk-B7LYKBCD.js.map} +0 -0
- /package/dist/{chunk-MGXSJI23.js.map → chunk-BUXGWBTF.js.map} +0 -0
- /package/dist/{chunk-OIKZDXNW.js.map → chunk-C7CTEUU7.js.map} +0 -0
- /package/dist/{chunk-HQSCJYCF.js.map → chunk-HGVW7OHI.js.map} +0 -0
- /package/dist/{chunk-FS3CTGIR.js.map → chunk-JKM5FH63.js.map} +0 -0
- /package/dist/{chunk-37CAZTLP.js.map → chunk-JOCVQZGT.js.map} +0 -0
- /package/dist/{chunk-ROOIHDLS.js.map → chunk-JR7I2AGL.js.map} +0 -0
- /package/dist/{chunk-25YIHMZ6.js.map → chunk-LA2W5L6K.js.map} +0 -0
- /package/dist/{chunk-V6TINNLD.js.map → chunk-MVBRMQGU.js.map} +0 -0
- /package/dist/{chunk-R2UDEMKK.js.map → chunk-OTYV6SDN.js.map} +0 -0
- /package/dist/{chunk-HZS4TV34.js.map → chunk-QX4ANESW.js.map} +0 -0
- /package/dist/{chunk-OJZW3GE2.js.map → chunk-TJ3GFULR.js.map} +0 -0
- /package/dist/{chunk-Q2CNCBMK.js.map → chunk-VCYRJY7J.js.map} +0 -0
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Server-safe: no React, no browser APIs.
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
11
|
-
import type { AskOptionData, ChatSource } from '../components/chat/types/message.types';
|
|
10
|
+
import type { AskOptionData } from '../components/chat/types/message.types';
|
|
12
11
|
import type { ApprovalRequestField, DecisionResolvedFrame, UsageTelemetry } from './frames';
|
|
13
12
|
/** Optional envelope on every event. `seq` carries the transport's
|
|
14
13
|
* stream sequence (JetStream `streamSeq` on NATS; unused on SSE). */
|
|
@@ -182,24 +181,6 @@ export interface TicketEventEvent extends ChatStreamEventBase {
|
|
|
182
181
|
/** Kind-token the ticket reopened INTO (AI_ASSISTANCE / TECH_REQUIRED / ...). */
|
|
183
182
|
targetStatusKind?: string;
|
|
184
183
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Per-answer source metadata — the documents an answer cited, plus the video
|
|
187
|
-
* and entity-card references its `[card://type:id]` markers expand with.
|
|
188
|
-
*
|
|
189
|
-
* Unlike `ChatMetadataEvent`, this one is DECODED, not passthrough: the payload
|
|
190
|
-
* comes from a remote MCP server's tool output rather than from our own
|
|
191
|
-
* backend's frame, so it is validated at the protocol boundary (see
|
|
192
|
-
* `source-metadata.ts`) and never reaches a consumer half-checked.
|
|
193
|
-
*
|
|
194
|
-
* Both fields are optional and never both absent — the decoder returns `null`
|
|
195
|
-
* instead of emitting an empty event, so applying one can't blank metadata an
|
|
196
|
-
* earlier chunk of the same turn already supplied.
|
|
197
|
-
*/
|
|
198
|
-
export interface SourcesEvent extends ChatStreamEventBase {
|
|
199
|
-
type: 'sources';
|
|
200
|
-
sources?: ChatSource[];
|
|
201
|
-
refs?: ChatRef[];
|
|
202
|
-
}
|
|
203
184
|
/** Per-turn metadata. Raw wire values pass through UNVALIDATED — the
|
|
204
185
|
* consumer replicates the legacy truthiness/typeof gates (so a
|
|
205
186
|
* malformed frame degrades identically to the pre-SSOT parser). */
|
|
@@ -311,6 +292,6 @@ export interface ParticipantEvent extends ChatStreamEventBase {
|
|
|
311
292
|
export interface DialogClosedEvent extends ChatStreamEventBase {
|
|
312
293
|
type: 'dialog-closed';
|
|
313
294
|
}
|
|
314
|
-
export type ChatStreamEvent = TurnStartEvent | TurnEndEvent | TextDeltaEvent | ThinkingDeltaEvent | AskEvent | StatusEvent | ToolExecutionEvent | ApprovalRequestEvent | ApprovalResolvedEvent | EscalationOfferEvent | EscalationOfferResolvedEvent | TicketEscalatedEvent | TicketEventEvent | ChatMetadataEvent |
|
|
295
|
+
export type ChatStreamEvent = TurnStartEvent | TurnEndEvent | TextDeltaEvent | ThinkingDeltaEvent | AskEvent | StatusEvent | ToolExecutionEvent | ApprovalRequestEvent | ApprovalResolvedEvent | EscalationOfferEvent | EscalationOfferResolvedEvent | TicketEscalatedEvent | TicketEventEvent | ChatMetadataEvent | UsageEvent | TokenUsageEvent | CompactionEvent | ErrorEvent | ParticipantEvent | DialogClosedEvent;
|
|
315
296
|
export {};
|
|
316
297
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/chat-protocol/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/chat-protocol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AK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,QAAQ,GACR,WAAW,GACX,kBAAkB,GAClB,oBAAoB,GACpB,qBAAqB,GACrB,oBAAoB,GACpB,4BAA4B,GAC5B,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,UAAU,GACV,eAAe,GACf,eAAe,GACf,UAAU,GACV,gBAAgB,GAChB,iBAAiB,CAAC"}
|
|
@@ -43,8 +43,8 @@ var CHAT_OWNER_ADMIN = "ADMIN";
|
|
|
43
43
|
// src/chat-protocol/encode.ts
|
|
44
44
|
var encoder = new TextEncoder();
|
|
45
45
|
var SENTINEL_BYTES_RE = /[\u0000\u001E\u001F]/g;
|
|
46
|
-
function stripSentinelBytes(
|
|
47
|
-
return
|
|
46
|
+
function stripSentinelBytes(text) {
|
|
47
|
+
return text.replace(SENTINEL_BYTES_RE, "");
|
|
48
48
|
}
|
|
49
49
|
function encodeLeadingFrame(frame) {
|
|
50
50
|
return encoder.encode(JSON.stringify(frame) + FRAME_TERMINATOR);
|
|
@@ -52,16 +52,16 @@ function encodeLeadingFrame(frame) {
|
|
|
52
52
|
function encodeEndOfLeading() {
|
|
53
53
|
return encoder.encode(END_OF_LEADING);
|
|
54
54
|
}
|
|
55
|
-
function encodeTextDelta(
|
|
56
|
-
return encoder.encode(stripSentinelBytes(
|
|
55
|
+
function encodeTextDelta(text) {
|
|
56
|
+
return encoder.encode(stripSentinelBytes(text));
|
|
57
57
|
}
|
|
58
58
|
function encodeTrailingUsageFrame(frame) {
|
|
59
59
|
return encoder.encode(TRAILER_SENTINEL + JSON.stringify(frame));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/chat-protocol/leading-frames.ts
|
|
63
|
-
function escapeThinkingTags(
|
|
64
|
-
return
|
|
63
|
+
function escapeThinkingTags(text) {
|
|
64
|
+
return text.replace(/</g, "<");
|
|
65
65
|
}
|
|
66
66
|
function frameStr(value) {
|
|
67
67
|
return typeof value === "string" ? value : void 0;
|
|
@@ -172,11 +172,11 @@ function isFrameObject(value) {
|
|
|
172
172
|
}
|
|
173
173
|
function frameTelemetry(value) {
|
|
174
174
|
if (!isFrameObject(value)) return void 0;
|
|
175
|
-
const { cards
|
|
176
|
-
if (typeof
|
|
175
|
+
const { cards, chips, sentences, answerLen } = value;
|
|
176
|
+
if (typeof cards !== "number" || typeof chips !== "number" || typeof sentences !== "number" || typeof answerLen !== "number") {
|
|
177
177
|
return void 0;
|
|
178
178
|
}
|
|
179
|
-
return { cards
|
|
179
|
+
return { cards, chips, sentences, answerLen };
|
|
180
180
|
}
|
|
181
181
|
function createSseFrameDecoder() {
|
|
182
182
|
const textDecoder = new TextDecoder();
|
|
@@ -287,15 +287,6 @@ var MESSAGE_TYPE = {
|
|
|
287
287
|
TEXT: "TEXT",
|
|
288
288
|
THINKING: "THINKING",
|
|
289
289
|
ASK: "ASK",
|
|
290
|
-
/** Per-answer source metadata (documents, videos, entity cards).
|
|
291
|
-
*
|
|
292
|
-
* TWO names for ONE payload, on purpose. `SOURCES` is the contract the
|
|
293
|
-
* backend is moving to; `GUIDE` is the envelope it ships in today, reused
|
|
294
|
-
* from Guide Mode v2 so a released frontend keeps working during the v2→v3
|
|
295
|
-
* rollout. Both decode through the same path, so dropping `GUIDE` later is a
|
|
296
|
-
* deletion here and nothing else. */
|
|
297
|
-
GUIDE: "GUIDE",
|
|
298
|
-
SOURCES: "SOURCES",
|
|
299
290
|
EXECUTING_TOOL: "EXECUTING_TOOL",
|
|
300
291
|
EXECUTED_TOOL: "EXECUTED_TOOL",
|
|
301
292
|
APPROVAL_REQUEST: "APPROVAL_REQUEST",
|
|
@@ -316,11 +307,6 @@ var MESSAGE_TYPE = {
|
|
|
316
307
|
DIALOG_CLOSED: "DIALOG_CLOSED"
|
|
317
308
|
};
|
|
318
309
|
|
|
319
|
-
// src/chat-protocol/card-marker.ts
|
|
320
|
-
var CARD_TYPE = "[a-zA-Z0-9_-]+";
|
|
321
|
-
var CARD_ID = "[^\\]\\r\\n)]+";
|
|
322
|
-
var CARD_REFERENCE = new RegExp(`^\\[card://(${CARD_TYPE}):(${CARD_ID})\\]$`);
|
|
323
|
-
|
|
324
310
|
// src/chat-protocol/wire-narrow.ts
|
|
325
311
|
function isRecord(value) {
|
|
326
312
|
return typeof value === "object" && value !== null;
|
|
@@ -329,184 +315,6 @@ function unwrapEnvelope(payload) {
|
|
|
329
315
|
return isRecord(payload) && "data" in payload ? payload.data : payload;
|
|
330
316
|
}
|
|
331
317
|
|
|
332
|
-
// src/chat-protocol/source-metadata.ts
|
|
333
|
-
var YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
|
|
334
|
-
var VIDEO_URL_KEYS = ["videoUrl", "highlightVideoUrl", "videoPoster", "highlightVideoPoster"];
|
|
335
|
-
function text(value) {
|
|
336
|
-
if (typeof value !== "string") return void 0;
|
|
337
|
-
const trimmed = value.trim();
|
|
338
|
-
return trimmed || void 0;
|
|
339
|
-
}
|
|
340
|
-
function nullableText(value) {
|
|
341
|
-
return value === null ? null : text(value);
|
|
342
|
-
}
|
|
343
|
-
function httpsUrl(value) {
|
|
344
|
-
const candidate = text(value);
|
|
345
|
-
if (!candidate) return void 0;
|
|
346
|
-
try {
|
|
347
|
-
return new URL(candidate).protocol === "https:" ? candidate : void 0;
|
|
348
|
-
} catch {
|
|
349
|
-
return void 0;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function youtubeVideoId(value) {
|
|
353
|
-
const candidate = text(value);
|
|
354
|
-
if (!candidate) return void 0;
|
|
355
|
-
if (YOUTUBE_ID.test(candidate)) return candidate;
|
|
356
|
-
const url = httpsUrl(candidate);
|
|
357
|
-
if (!url) return void 0;
|
|
358
|
-
const parsed = new URL(url);
|
|
359
|
-
const hostname = parsed.hostname.toLowerCase();
|
|
360
|
-
const isYoutubeHost = hostname === "youtu.be" || hostname === "youtube.com" || hostname.endsWith(".youtube.com");
|
|
361
|
-
if (!isYoutubeHost) return void 0;
|
|
362
|
-
const fromPath = hostname === "youtu.be" ? parsed.pathname.split("/").filter(Boolean)[0] : /^\/(?:embed|v|shorts)\/([A-Za-z0-9_-]{11})(?:\/|$)/.exec(parsed.pathname)?.[1];
|
|
363
|
-
const id = fromPath ?? parsed.searchParams.get("v") ?? void 0;
|
|
364
|
-
return id && YOUTUBE_ID.test(id) ? id : void 0;
|
|
365
|
-
}
|
|
366
|
-
function sourceItems(value) {
|
|
367
|
-
if (!Array.isArray(value)) return void 0;
|
|
368
|
-
const items = value.filter(isRecord).flatMap((item) => {
|
|
369
|
-
const id = text(item.id);
|
|
370
|
-
const documentType = text(item.documentType);
|
|
371
|
-
const name = text(item.name);
|
|
372
|
-
if (!id || !documentType || !name) return [];
|
|
373
|
-
const externalUrl = httpsUrl(item.externalUrl);
|
|
374
|
-
const targetPlatform = nullableText(item.targetPlatform);
|
|
375
|
-
const path = nullableText(item.path);
|
|
376
|
-
return [
|
|
377
|
-
{
|
|
378
|
-
id,
|
|
379
|
-
documentType,
|
|
380
|
-
name,
|
|
381
|
-
...externalUrl ? { externalUrl } : {},
|
|
382
|
-
...targetPlatform !== void 0 ? { targetPlatform } : {},
|
|
383
|
-
...path !== void 0 ? { path } : {}
|
|
384
|
-
}
|
|
385
|
-
];
|
|
386
|
-
});
|
|
387
|
-
return items.length > 0 ? items : void 0;
|
|
388
|
-
}
|
|
389
|
-
function sources(value) {
|
|
390
|
-
if (!Array.isArray(value)) return [];
|
|
391
|
-
const claimed = /* @__PURE__ */ new Set();
|
|
392
|
-
const decoded = [];
|
|
393
|
-
for (const candidate of value) {
|
|
394
|
-
if (!isRecord(candidate)) continue;
|
|
395
|
-
const index = candidate.index;
|
|
396
|
-
const name = text(candidate.name);
|
|
397
|
-
const isUsableIndex = typeof index === "number" && Number.isInteger(index) && index > 0 && !claimed.has(index);
|
|
398
|
-
if (!isUsableIndex || !name) continue;
|
|
399
|
-
claimed.add(index);
|
|
400
|
-
const path = text(candidate.path);
|
|
401
|
-
const documentType = text(candidate.documentType);
|
|
402
|
-
const externalUrl = httpsUrl(candidate.externalUrl);
|
|
403
|
-
const targetPlatform = nullableText(candidate.targetPlatform);
|
|
404
|
-
const id = text(candidate.id);
|
|
405
|
-
const sourceRepo = text(candidate.sourceRepo);
|
|
406
|
-
const label = text(candidate.label);
|
|
407
|
-
const items = sourceItems(candidate.items);
|
|
408
|
-
decoded.push({
|
|
409
|
-
index,
|
|
410
|
-
name,
|
|
411
|
-
// Both are typed non-optional on `ChatSource` and predate this decoder;
|
|
412
|
-
// '' is the established "no value" for them across the SSE path.
|
|
413
|
-
path: path ?? "",
|
|
414
|
-
documentType: documentType ?? "",
|
|
415
|
-
...externalUrl ? { externalUrl } : {},
|
|
416
|
-
...targetPlatform !== void 0 ? { targetPlatform } : {},
|
|
417
|
-
...id ? { id } : {},
|
|
418
|
-
...sourceRepo ? { sourceRepo } : {},
|
|
419
|
-
...label ? { label } : {},
|
|
420
|
-
...items ? { items } : {}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
return decoded;
|
|
424
|
-
}
|
|
425
|
-
function videoMetadata(value, url) {
|
|
426
|
-
const metadata = {};
|
|
427
|
-
if (isRecord(value)) {
|
|
428
|
-
for (const key of VIDEO_URL_KEYS) {
|
|
429
|
-
const validated = httpsUrl(value[key]);
|
|
430
|
-
if (validated) metadata[key] = validated;
|
|
431
|
-
}
|
|
432
|
-
const declaredId = youtubeVideoId(value.youtubeUrl);
|
|
433
|
-
if (declaredId) metadata.youtubeUrl = declaredId;
|
|
434
|
-
}
|
|
435
|
-
if (url) {
|
|
436
|
-
const idFromUrl = youtubeVideoId(url);
|
|
437
|
-
if (idFromUrl) {
|
|
438
|
-
metadata.youtubeUrl = idFromUrl;
|
|
439
|
-
delete metadata.videoUrl;
|
|
440
|
-
} else {
|
|
441
|
-
metadata.videoUrl = url;
|
|
442
|
-
delete metadata.youtubeUrl;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return metadata;
|
|
446
|
-
}
|
|
447
|
-
function videos(value) {
|
|
448
|
-
if (!Array.isArray(value)) return [];
|
|
449
|
-
return value.filter(isRecord).flatMap((video) => {
|
|
450
|
-
const match = typeof video.ref === "string" ? CARD_REFERENCE.exec(video.ref) : null;
|
|
451
|
-
if (!match || match[1] !== "video") return [];
|
|
452
|
-
const id = match[2];
|
|
453
|
-
const url = httpsUrl(video.url) ?? null;
|
|
454
|
-
const sourceRepo = text(video.sourceRepo);
|
|
455
|
-
const metadata = videoMetadata(video.metadata, url);
|
|
456
|
-
return [
|
|
457
|
-
{
|
|
458
|
-
type: "video",
|
|
459
|
-
id,
|
|
460
|
-
title: text(video.title) ?? id,
|
|
461
|
-
url,
|
|
462
|
-
...sourceRepo ? { sourceRepo } : {},
|
|
463
|
-
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
464
|
-
}
|
|
465
|
-
];
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
function cards(value, decodedSources) {
|
|
469
|
-
if (!Array.isArray(value)) return [];
|
|
470
|
-
return value.filter(isRecord).flatMap((card) => {
|
|
471
|
-
const match = typeof card.ref === "string" ? CARD_REFERENCE.exec(card.ref) : null;
|
|
472
|
-
if (!match || match[1] === "video") return [];
|
|
473
|
-
const type = text(card.entityType);
|
|
474
|
-
const id = text(card.entityId);
|
|
475
|
-
if (!type || !id || type !== match[1] || id !== match[2]) return [];
|
|
476
|
-
const source = decodedSources.find((candidate) => candidate.id === id && candidate.documentType === type);
|
|
477
|
-
return [
|
|
478
|
-
{
|
|
479
|
-
type,
|
|
480
|
-
id,
|
|
481
|
-
title: source?.name ?? id,
|
|
482
|
-
url: source?.externalUrl ?? null,
|
|
483
|
-
...source?.sourceRepo ? { sourceRepo: source.sourceRepo } : {},
|
|
484
|
-
...source?.targetPlatform !== void 0 ? { targetPlatform: source.targetPlatform } : {},
|
|
485
|
-
...source?.path ? { metadata: { path: source.path } } : {}
|
|
486
|
-
}
|
|
487
|
-
];
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
function deduplicateRefs(refs) {
|
|
491
|
-
const byIdentity = /* @__PURE__ */ new Map();
|
|
492
|
-
for (const ref of refs) {
|
|
493
|
-
const identity = `${ref.type}:${ref.id}`;
|
|
494
|
-
if (!byIdentity.has(identity)) byIdentity.set(identity, ref);
|
|
495
|
-
}
|
|
496
|
-
return [...byIdentity.values()];
|
|
497
|
-
}
|
|
498
|
-
function sourceMetadataEvent(payload) {
|
|
499
|
-
if (!isRecord(payload)) return null;
|
|
500
|
-
const decodedSources = sources(payload.sources);
|
|
501
|
-
const refs = deduplicateRefs([...videos(payload.videos), ...cards(payload.cards, decodedSources)]);
|
|
502
|
-
if (decodedSources.length === 0 && refs.length === 0) return null;
|
|
503
|
-
return {
|
|
504
|
-
type: "sources",
|
|
505
|
-
...decodedSources.length > 0 ? { sources: decodedSources } : {},
|
|
506
|
-
...refs.length > 0 ? { refs } : {}
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
|
|
510
318
|
// src/chat-protocol/nats-decoder.ts
|
|
511
319
|
function str(value) {
|
|
512
320
|
return typeof value === "string" ? value : void 0;
|
|
@@ -572,16 +380,6 @@ function decodeNatsChunk(chunk) {
|
|
|
572
380
|
return { type: "thinking-delta", text: data.text, ...seq };
|
|
573
381
|
}
|
|
574
382
|
return null;
|
|
575
|
-
// Two chunk names, one payload and one decoder. `SOURCES` is the contract
|
|
576
|
-
// the backend is moving to; `GUIDE` is the v2 envelope it ships in during
|
|
577
|
-
// the rollout (see `MESSAGE_TYPE.GUIDE`). The chunk arrives BEFORE or
|
|
578
|
-
// between the answer's text deltas, so the reducer — not this decoder —
|
|
579
|
-
// owns attaching it to the right turn.
|
|
580
|
-
case MESSAGE_TYPE.GUIDE:
|
|
581
|
-
case MESSAGE_TYPE.SOURCES: {
|
|
582
|
-
const event = sourceMetadataEvent(data.payload);
|
|
583
|
-
return event ? { ...event, ...seq } : null;
|
|
584
|
-
}
|
|
585
383
|
// An ask card is only an ask card with something to pick: a question and at
|
|
586
384
|
// least one option. Anything less is dropped rather than rendered as an
|
|
587
385
|
// empty card the user can't answer — the backend already falls back to a
|