@flamingo-stack/openframe-frontend-core 0.0.532 → 0.0.533
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/confirm-tool.d.ts +50 -0
- package/dist/chat-protocol/confirm-tool.d.ts.map +1 -0
- package/dist/chat-protocol/decode.d.ts +1 -9
- package/dist/chat-protocol/decode.d.ts.map +1 -1
- package/dist/chat-protocol/events.d.ts +35 -0
- package/dist/chat-protocol/events.d.ts.map +1 -1
- package/dist/chat-protocol/index.cjs +72 -3
- package/dist/chat-protocol/index.cjs.map +1 -1
- package/dist/chat-protocol/index.d.ts +1 -0
- package/dist/chat-protocol/index.d.ts.map +1 -1
- package/dist/chat-protocol/index.js +67 -4
- package/dist/chat-protocol/index.js.map +1 -1
- package/dist/chat-protocol/leading-frames.d.ts +38 -0
- package/dist/chat-protocol/leading-frames.d.ts.map +1 -0
- package/dist/chat-protocol/nats-decoder.d.ts +41 -0
- package/dist/chat-protocol/nats-decoder.d.ts.map +1 -1
- package/dist/{chunk-QEMI34VA.cjs → chunk-2MYDGLJS.cjs} +87 -87
- package/dist/{chunk-QEMI34VA.cjs.map → chunk-2MYDGLJS.cjs.map} +1 -1
- package/dist/{chunk-TQ7EPKKO.js → chunk-2TUOBFPK.js} +2 -2
- package/dist/{chunk-XBYEPSNZ.js → chunk-2XGHEJZK.js} +4 -4
- package/dist/{chunk-OAEJWP7H.js → chunk-46FKXLNE.js} +2 -2
- package/dist/{chunk-ECR37JHH.js → chunk-4QKXNWH5.js} +2 -2
- package/dist/{chunk-GWFC3NE5.cjs → chunk-4ZRHVOEB.cjs} +31 -31
- package/dist/{chunk-GWFC3NE5.cjs.map → chunk-4ZRHVOEB.cjs.map} +1 -1
- package/dist/{chunk-AZBS4PZG.js → chunk-5U67WTAS.js} +2 -2
- package/dist/{chunk-3G7FDE5E.js → chunk-6SMLYZLH.js} +4 -4
- package/dist/{chunk-7SGBF2I2.js → chunk-6W3ULZ4X.js} +6 -6
- package/dist/{chunk-ALXLWF75.js → chunk-6YXN5RHW.js} +2 -2
- package/dist/{chunk-2QP67D2L.cjs → chunk-DFQLUK75.cjs} +3 -3
- package/dist/{chunk-2QP67D2L.cjs.map → chunk-DFQLUK75.cjs.map} +1 -1
- package/dist/{chunk-ETF2QXXU.cjs → chunk-ENPGPZIB.cjs} +61 -61
- package/dist/{chunk-ETF2QXXU.cjs.map → chunk-ENPGPZIB.cjs.map} +1 -1
- package/dist/{chunk-HJDCDOJM.cjs → chunk-GNOK5J34.cjs} +37 -37
- package/dist/{chunk-HJDCDOJM.cjs.map → chunk-GNOK5J34.cjs.map} +1 -1
- package/dist/{chunk-4GL2XJ5C.cjs → chunk-J4BE4FIR.cjs} +4 -4
- package/dist/{chunk-4GL2XJ5C.cjs.map → chunk-J4BE4FIR.cjs.map} +1 -1
- package/dist/{chunk-HXHA3DCI.cjs → chunk-JDW2IL7A.cjs} +11 -11
- package/dist/{chunk-HXHA3DCI.cjs.map → chunk-JDW2IL7A.cjs.map} +1 -1
- package/dist/{chunk-TMZS63G2.cjs → chunk-KMB66NYX.cjs} +7 -7
- package/dist/{chunk-TMZS63G2.cjs.map → chunk-KMB66NYX.cjs.map} +1 -1
- package/dist/{chunk-5W3RCZIK.js → chunk-LE3BJ5H2.js} +2 -2
- package/dist/{chunk-WINT757E.js → chunk-LIUARTOZ.js} +206 -64
- package/dist/chunk-LIUARTOZ.js.map +1 -0
- package/dist/{chunk-65NR333L.js → chunk-MVGL5NNJ.js} +2 -2
- package/dist/{chunk-LYWSHNK4.cjs → chunk-NAV4FRNL.cjs} +26 -26
- package/dist/{chunk-LYWSHNK4.cjs.map → chunk-NAV4FRNL.cjs.map} +1 -1
- package/dist/{chunk-2MBS3YEY.cjs → chunk-OLOKQQAP.cjs} +5 -5
- package/dist/{chunk-2MBS3YEY.cjs.map → chunk-OLOKQQAP.cjs.map} +1 -1
- package/dist/{chunk-QYNLVIGQ.cjs → chunk-QZ2NAPLF.cjs} +9 -9
- package/dist/{chunk-QYNLVIGQ.cjs.map → chunk-QZ2NAPLF.cjs.map} +1 -1
- package/dist/{chunk-L6EKEYF7.cjs → chunk-RKITTO5V.cjs} +14 -14
- package/dist/{chunk-L6EKEYF7.cjs.map → chunk-RKITTO5V.cjs.map} +1 -1
- package/dist/{chunk-UP4RA54U.js → chunk-U555TMPC.js} +5 -5
- package/dist/{chunk-GVLA2BPW.cjs → chunk-UPHN2VRZ.cjs} +259 -117
- package/dist/chunk-UPHN2VRZ.cjs.map +1 -0
- package/dist/{chunk-IZOGFZ7N.js → chunk-XN4JKIJY.js} +2 -2
- package/dist/{chunk-KYQZBQYV.js → chunk-YLB6XXO6.js} +2 -2
- package/dist/{chunk-JZ5XDZYD.cjs → chunk-Z3NOI7X7.cjs} +26 -26
- package/dist/{chunk-JZ5XDZYD.cjs.map → chunk-Z3NOI7X7.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +8 -8
- package/dist/components/case-studies/index.js +2 -2
- package/dist/components/chat/embeddable-chat.d.ts +13 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +10 -2
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +9 -1
- package/dist/components/chat/stream/chat-stream-reducer.d.ts +9 -0
- package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -1
- package/dist/components/chat/types/message.types.d.ts +15 -0
- package/dist/components/chat/types/message.types.d.ts.map +1 -1
- package/dist/components/chat/types/network.types.d.ts +4 -0
- package/dist/components/chat/types/network.types.d.ts.map +1 -1
- package/dist/components/chat/types/processing.types.d.ts +7 -1
- package/dist/components/chat/types/processing.types.d.ts.map +1 -1
- package/dist/components/chat/utils/approval-display.d.ts +49 -0
- package/dist/components/chat/utils/approval-display.d.ts.map +1 -0
- package/dist/components/chat/utils/index.d.ts +1 -0
- package/dist/components/chat/utils/index.d.ts.map +1 -1
- package/dist/components/chat/utils/message-segment-accumulator.d.ts +25 -3
- package/dist/components/chat/utils/message-segment-accumulator.d.ts.map +1 -1
- package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/docs/index.cjs +5 -5
- package/dist/components/docs/index.js +4 -4
- package/dist/components/embeds/index.cjs +3 -3
- package/dist/components/embeds/index.js +2 -2
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/help-center-pages/index.cjs +22 -22
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +140 -132
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +19 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +34 -34
- package/dist/components/meeting-scheduler/index.js +3 -3
- package/dist/components/navigation/index.cjs +2 -2
- package/dist/components/navigation/index.js +1 -1
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/onboarding-guides/index.js +4 -4
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +10 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +9 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- 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/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +70 -0
- package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +108 -1
- package/src/chat-protocol/confirm-tool.ts +67 -0
- package/src/chat-protocol/decode.ts +7 -153
- package/src/chat-protocol/events.ts +40 -0
- package/src/chat-protocol/index.ts +3 -0
- package/src/chat-protocol/leading-frames.ts +175 -0
- package/src/chat-protocol/nats-decoder.ts +111 -3
- package/src/components/chat/embeddable-chat.tsx +18 -0
- package/src/components/chat/hooks/use-sse-chat-adapter.ts +7 -16
- package/src/components/chat/stream/chat-stream-reducer.ts +49 -3
- package/src/components/chat/types/message.types.ts +15 -0
- package/src/components/chat/types/network.types.ts +4 -0
- package/src/components/chat/types/processing.types.ts +12 -1
- package/src/components/chat/utils/__tests__/process-historical-messages-approvals.test.ts +92 -0
- package/src/components/chat/utils/approval-display.ts +70 -0
- package/src/components/chat/utils/index.ts +9 -0
- package/src/components/chat/utils/message-segment-accumulator.ts +62 -32
- package/src/components/chat/utils/process-historical-messages.ts +40 -6
- package/dist/chunk-GVLA2BPW.cjs.map +0 -1
- package/dist/chunk-WINT757E.js.map +0 -1
- /package/dist/{chunk-TQ7EPKKO.js.map → chunk-2TUOBFPK.js.map} +0 -0
- /package/dist/{chunk-XBYEPSNZ.js.map → chunk-2XGHEJZK.js.map} +0 -0
- /package/dist/{chunk-OAEJWP7H.js.map → chunk-46FKXLNE.js.map} +0 -0
- /package/dist/{chunk-ECR37JHH.js.map → chunk-4QKXNWH5.js.map} +0 -0
- /package/dist/{chunk-AZBS4PZG.js.map → chunk-5U67WTAS.js.map} +0 -0
- /package/dist/{chunk-3G7FDE5E.js.map → chunk-6SMLYZLH.js.map} +0 -0
- /package/dist/{chunk-7SGBF2I2.js.map → chunk-6W3ULZ4X.js.map} +0 -0
- /package/dist/{chunk-ALXLWF75.js.map → chunk-6YXN5RHW.js.map} +0 -0
- /package/dist/{chunk-5W3RCZIK.js.map → chunk-LE3BJ5H2.js.map} +0 -0
- /package/dist/{chunk-65NR333L.js.map → chunk-MVGL5NNJ.js.map} +0 -0
- /package/dist/{chunk-UP4RA54U.js.map → chunk-U555TMPC.js.map} +0 -0
- /package/dist/{chunk-IZOGFZ7N.js.map → chunk-XN4JKIJY.js.map} +0 -0
- /package/dist/{chunk-KYQZBQYV.js.map → chunk-YLB6XXO6.js.map} +0 -0
|
@@ -4,6 +4,10 @@ var END_OF_LEADING = "";
|
|
|
4
4
|
var TRAILER_SENTINEL = "";
|
|
5
5
|
|
|
6
6
|
// src/chat-protocol/events.ts
|
|
7
|
+
var GUIDE_ORIGIN = "guide";
|
|
8
|
+
function isGuideOrigin(source) {
|
|
9
|
+
return source?.origin === GUIDE_ORIGIN;
|
|
10
|
+
}
|
|
7
11
|
var ESCALATION_STATE = {
|
|
8
12
|
PENDING: "PENDING",
|
|
9
13
|
APPROVED: "APPROVED",
|
|
@@ -43,7 +47,7 @@ function encodeTrailingUsageFrame(frame) {
|
|
|
43
47
|
return encoder.encode(TRAILER_SENTINEL + JSON.stringify(frame));
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
// src/chat-protocol/
|
|
50
|
+
// src/chat-protocol/leading-frames.ts
|
|
47
51
|
function escapeThinkingTags(text) {
|
|
48
52
|
return text.replace(/</g, "<");
|
|
49
53
|
}
|
|
@@ -150,6 +154,8 @@ function mapLeadingFrame(meta, out) {
|
|
|
150
154
|
});
|
|
151
155
|
}
|
|
152
156
|
}
|
|
157
|
+
|
|
158
|
+
// src/chat-protocol/decode.ts
|
|
153
159
|
function createSseFrameDecoder() {
|
|
154
160
|
const textDecoder = new TextDecoder();
|
|
155
161
|
let buffer = "";
|
|
@@ -297,6 +303,37 @@ function normalizeAskOptions(raw) {
|
|
|
297
303
|
description: typeof item.description === "string" ? item.description : void 0
|
|
298
304
|
})).filter((option) => option.label.length > 0);
|
|
299
305
|
}
|
|
306
|
+
var AGENT_OWNED_EVENTS = /* @__PURE__ */ new Set([
|
|
307
|
+
"usage",
|
|
308
|
+
"token-usage",
|
|
309
|
+
"status",
|
|
310
|
+
"compaction",
|
|
311
|
+
"participant",
|
|
312
|
+
"dialog-closed"
|
|
313
|
+
]);
|
|
314
|
+
var ORIGIN_BEARING_EVENTS = /* @__PURE__ */ new Set([
|
|
315
|
+
"approval-request",
|
|
316
|
+
"approval-resolved"
|
|
317
|
+
]);
|
|
318
|
+
function guideEventForNats(event) {
|
|
319
|
+
switch (event.type) {
|
|
320
|
+
case "text-delta":
|
|
321
|
+
return { type: "guide-delta", text: event.text };
|
|
322
|
+
case "thinking-delta":
|
|
323
|
+
return { type: "thinking-delta", text: escapeThinkingTags(event.text) };
|
|
324
|
+
case "metadata":
|
|
325
|
+
return typeof event.conversationId === "string" && event.conversationId ? { type: "metadata", conversationId: event.conversationId, origin: GUIDE_ORIGIN } : null;
|
|
326
|
+
default:
|
|
327
|
+
if (AGENT_OWNED_EVENTS.has(event.type)) return null;
|
|
328
|
+
return ORIGIN_BEARING_EVENTS.has(event.type) ? { ...event, origin: GUIDE_ORIGIN } : event;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function guideFrameEvent(frame) {
|
|
332
|
+
const events = [];
|
|
333
|
+
mapLeadingFrame(frame, events);
|
|
334
|
+
const event = events[0];
|
|
335
|
+
return event ? guideEventForNats(event) : null;
|
|
336
|
+
}
|
|
300
337
|
function decodeNatsChunk(chunk) {
|
|
301
338
|
if (!chunk || typeof chunk !== "object") return null;
|
|
302
339
|
const data = chunk;
|
|
@@ -331,11 +368,20 @@ function decodeNatsChunk(chunk) {
|
|
|
331
368
|
return { type: "thinking-delta", text: data.text, ...seq };
|
|
332
369
|
}
|
|
333
370
|
return null;
|
|
334
|
-
|
|
371
|
+
// Two shapes share this chunk type. `text` is the answer body the agent
|
|
372
|
+
// streams (and persists). `payload` is a Product Guide frame re-streamed
|
|
373
|
+
// verbatim from the hub — decoded through the shared frame table, with the
|
|
374
|
+
// narrowing `guideFrameEvent` documents.
|
|
375
|
+
case MESSAGE_TYPE.GUIDE: {
|
|
335
376
|
if (typeof data.text === "string") {
|
|
336
377
|
return { type: "guide-delta", text: data.text, ...seq };
|
|
337
378
|
}
|
|
338
|
-
|
|
379
|
+
const frame = data.payload;
|
|
380
|
+
if (!frame || typeof frame !== "object" || Array.isArray(frame)) return null;
|
|
381
|
+
const event = guideFrameEvent(frame);
|
|
382
|
+
if (!event) return null;
|
|
383
|
+
return { ...event, ...seq };
|
|
384
|
+
}
|
|
339
385
|
// An ask card is only an ask card with something to pick: a question and at
|
|
340
386
|
// least one option. Anything less is dropped rather than rendered as an
|
|
341
387
|
// empty card the user can't answer — the backend already falls back to a
|
|
@@ -515,6 +561,23 @@ function decodeNatsChunk(chunk) {
|
|
|
515
561
|
}
|
|
516
562
|
}
|
|
517
563
|
|
|
564
|
+
// src/chat-protocol/confirm-tool.ts
|
|
565
|
+
function buildConfirmToolBody(request) {
|
|
566
|
+
return {
|
|
567
|
+
proposal_id: request.proposalId,
|
|
568
|
+
action: request.action,
|
|
569
|
+
conversationId: request.conversationId
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
async function readServerErrorMessage(response) {
|
|
573
|
+
try {
|
|
574
|
+
const body = await response.json();
|
|
575
|
+
if (typeof body?.error === "string" && body.error.length > 0) return body.error;
|
|
576
|
+
} catch {
|
|
577
|
+
}
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
|
|
518
581
|
// src/chat-protocol/ip-normalize.ts
|
|
519
582
|
var IP_BUCKET_KEY_MAX_LENGTH = 64;
|
|
520
583
|
function isIpv4(value) {
|
|
@@ -588,6 +651,6 @@ function envFlagEnabled(name) {
|
|
|
588
651
|
return v !== "" && v !== "0" && v !== "false" && v !== "off";
|
|
589
652
|
}
|
|
590
653
|
|
|
591
|
-
export { CHAT_OWNER_ADMIN, END_OF_LEADING, ESCALATION_STATE, FRAME_TERMINATOR, IP_BUCKET_KEY_MAX_LENGTH, TRAILER_SENTINEL, createSseFrameDecoder, decodeNatsChunk, encodeEndOfLeading, encodeLeadingFrame, encodeTextDelta, encodeTrailingUsageFrame, envFlagEnabled, escalationResolvedStatus, escapeThinkingTags, normalizeAskOptions, normalizeIpForBucketKey, stripSentinelBytes };
|
|
654
|
+
export { CHAT_OWNER_ADMIN, END_OF_LEADING, ESCALATION_STATE, FRAME_TERMINATOR, GUIDE_ORIGIN, IP_BUCKET_KEY_MAX_LENGTH, TRAILER_SENTINEL, buildConfirmToolBody, createSseFrameDecoder, decodeNatsChunk, encodeEndOfLeading, encodeLeadingFrame, encodeTextDelta, encodeTrailingUsageFrame, envFlagEnabled, escalationResolvedStatus, escapeThinkingTags, guideEventForNats, guideFrameEvent, isGuideOrigin, normalizeAskOptions, normalizeIpForBucketKey, readServerErrorMessage, stripSentinelBytes };
|
|
592
655
|
//# sourceMappingURL=index.js.map
|
|
593
656
|
//# sourceMappingURL=index.js.map
|