@flamingo-stack/openframe-frontend-core 0.0.508 → 0.0.509
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/decode.d.ts +58 -0
- package/dist/chat-protocol/decode.d.ts.map +1 -0
- package/dist/chat-protocol/encode.d.ts +44 -0
- package/dist/chat-protocol/encode.d.ts.map +1 -0
- package/dist/chat-protocol/env-flag.d.ts +35 -0
- package/dist/chat-protocol/env-flag.d.ts.map +1 -0
- package/dist/chat-protocol/events.d.ts +216 -0
- package/dist/chat-protocol/events.d.ts.map +1 -0
- package/dist/chat-protocol/frames.d.ts +213 -0
- package/dist/chat-protocol/frames.d.ts.map +1 -0
- package/dist/chat-protocol/index.cjs +506 -0
- package/dist/chat-protocol/index.cjs.map +1 -0
- package/dist/chat-protocol/index.d.ts +18 -0
- package/dist/chat-protocol/index.d.ts.map +1 -0
- package/dist/chat-protocol/index.js +490 -0
- package/dist/chat-protocol/index.js.map +1 -0
- package/dist/chat-protocol/ip-normalize.d.ts +44 -0
- package/dist/chat-protocol/ip-normalize.d.ts.map +1 -0
- package/dist/chat-protocol/nats-decoder.d.ts +26 -0
- package/dist/chat-protocol/nats-decoder.d.ts.map +1 -0
- package/dist/{chunk-3SQ5KXHQ.cjs → chunk-2T4GTV25.cjs} +9 -9
- package/dist/{chunk-3SQ5KXHQ.cjs.map → chunk-2T4GTV25.cjs.map} +1 -1
- package/dist/{chunk-CWAOV2FK.cjs → chunk-3CGZPAGR.cjs} +3 -3
- package/dist/{chunk-CWAOV2FK.cjs.map → chunk-3CGZPAGR.cjs.map} +1 -1
- package/dist/{chunk-TLMJHMXJ.js → chunk-3QSR22IC.js} +12 -12
- package/dist/chunk-3QSR22IC.js.map +1 -0
- package/dist/{chunk-TWYNR4TZ.cjs → chunk-4G5TLHJD.cjs} +7141 -4799
- package/dist/chunk-4G5TLHJD.cjs.map +1 -0
- package/dist/{chunk-ADPMHWOE.js → chunk-72XAID7Y.js} +4 -4
- package/dist/{chunk-PAGKRNWK.js → chunk-7WZHBQ4J.js} +2 -2
- package/dist/{chunk-OCEKO5CW.js → chunk-AEELJC4N.js} +12106 -9764
- package/dist/chunk-AEELJC4N.js.map +1 -0
- package/dist/{chunk-Z42BGM6Q.cjs → chunk-BT2WWDFP.cjs} +5 -5
- package/dist/{chunk-Z42BGM6Q.cjs.map → chunk-BT2WWDFP.cjs.map} +1 -1
- package/dist/{chunk-7LEL3RIX.cjs → chunk-C7OY3PQP.cjs} +11 -11
- package/dist/{chunk-7LEL3RIX.cjs.map → chunk-C7OY3PQP.cjs.map} +1 -1
- package/dist/{chunk-RHGGEKPQ.cjs → chunk-CIOLOQKQ.cjs} +4 -4
- package/dist/{chunk-RHGGEKPQ.cjs.map → chunk-CIOLOQKQ.cjs.map} +1 -1
- package/dist/{chunk-TSZHM74B.js → chunk-DC2TKS7C.js} +2 -2
- package/dist/{chunk-M2GOR3XQ.cjs → chunk-DYPYR7FR.cjs} +87 -87
- package/dist/{chunk-M2GOR3XQ.cjs.map → chunk-DYPYR7FR.cjs.map} +1 -1
- package/dist/{chunk-I64ABCDX.js → chunk-I2B6X77L.js} +2 -2
- package/dist/{chunk-NIZDKTGL.cjs → chunk-K5MSCMDK.cjs} +37 -37
- package/dist/{chunk-NIZDKTGL.cjs.map → chunk-K5MSCMDK.cjs.map} +1 -1
- package/dist/{chunk-DTYRYB2N.js → chunk-K6QTZ7CZ.js} +2 -2
- package/dist/{chunk-4LTMXDUS.js → chunk-KBN7PMFT.js} +2 -2
- package/dist/{chunk-TBMV7I5N.js → chunk-KXZO2WZX.js} +2 -2
- package/dist/{chunk-QTYZMP6D.cjs → chunk-LBAKLT6T.cjs} +62 -62
- package/dist/chunk-LBAKLT6T.cjs.map +1 -0
- package/dist/{chunk-KEBYLU3U.js → chunk-LFUPI7VX.js} +2 -2
- package/dist/{chunk-LDTR4IVZ.cjs → chunk-M37PBG4N.cjs} +31 -31
- package/dist/{chunk-LDTR4IVZ.cjs.map → chunk-M37PBG4N.cjs.map} +1 -1
- package/dist/{chunk-WA7RR64F.js → chunk-PO5O654H.js} +6 -5
- package/dist/chunk-PO5O654H.js.map +1 -0
- package/dist/{chunk-WK4N5VBX.cjs → chunk-QJJISLPA.cjs} +28 -27
- package/dist/chunk-QJJISLPA.cjs.map +1 -0
- package/dist/{chunk-2F44PLTV.cjs → chunk-T7MCSA55.cjs} +26 -26
- package/dist/{chunk-2F44PLTV.cjs.map → chunk-T7MCSA55.cjs.map} +1 -1
- package/dist/{chunk-WJQHJD7J.js → chunk-TWSKTJHW.js} +2 -2
- package/dist/{chunk-ZSQHZYCO.cjs → chunk-UQDMJ6DH.cjs} +13 -13
- package/dist/{chunk-ZSQHZYCO.cjs.map → chunk-UQDMJ6DH.cjs.map} +1 -1
- package/dist/{chunk-TZRUCD56.js → chunk-V3ZAAFE3.js} +5 -5
- package/dist/{chunk-LRGHJPET.js → chunk-XGIFOHKE.js} +2 -2
- package/dist/{chunk-POOMO3PA.cjs → chunk-YQEPRYT5.cjs} +7 -7
- package/dist/{chunk-POOMO3PA.cjs.map → chunk-YQEPRYT5.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/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/hooks/index.d.ts +0 -1
- package/dist/components/chat/hooks/index.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-chunk-catchup.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +15 -48
- package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +10 -57
- 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.d.ts +1 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +21 -13
- package/dist/components/chat/stream/chat-dialog-store.d.ts +184 -0
- package/dist/components/chat/stream/chat-dialog-store.d.ts.map +1 -0
- package/dist/components/chat/stream/chat-stream-reducer.d.ts +380 -0
- package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -0
- package/dist/components/chat/stream/delta-batcher.d.ts +51 -0
- package/dist/components/chat/stream/delta-batcher.d.ts.map +1 -0
- package/dist/components/chat/stream/index.d.ts +17 -0
- package/dist/components/chat/stream/index.d.ts.map +1 -0
- package/dist/components/chat/stream/message-mutations.d.ts +77 -0
- package/dist/components/chat/stream/message-mutations.d.ts.map +1 -0
- package/dist/components/chat/stream/use-chat-stream-reducer.d.ts +22 -0
- package/dist/components/chat/stream/use-chat-stream-reducer.d.ts.map +1 -0
- package/dist/components/chat/types/api.types.d.ts +1 -81
- package/dist/components/chat/types/api.types.d.ts.map +1 -1
- package/dist/components/chat/types/processing.types.d.ts +2 -93
- package/dist/components/chat/types/processing.types.d.ts.map +1 -1
- package/dist/components/chat/types/unified-chat-state.types.d.ts +15 -0
- package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -1
- package/dist/components/chat/utils/extract-incomplete-message-state.d.ts +34 -6
- package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
- package/dist/components/chat/utils/history-merge.d.ts.map +1 -1
- package/dist/components/chat/utils/index.d.ts +2 -3
- package/dist/components/chat/utils/index.d.ts.map +1 -1
- package/dist/components/chat/utils/process-historical-messages.d.ts +59 -11
- 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 +174 -132
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +65 -23
- 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/onboarding-guides/onboarding-guide-detail-view.d.ts.map +1 -1
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +44 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.ts +1 -2
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +55 -13
- package/dist/components/ui/markdown/base-components.d.ts +51 -0
- package/dist/components/ui/markdown/base-components.d.ts.map +1 -0
- package/dist/components/ui/markdown/engine.d.ts +99 -0
- package/dist/components/ui/markdown/engine.d.ts.map +1 -0
- package/dist/components/ui/markdown/heading-ids.d.ts +65 -0
- package/dist/components/ui/markdown/heading-ids.d.ts.map +1 -0
- package/dist/components/ui/markdown/index.d.ts +18 -0
- package/dist/components/ui/markdown/index.d.ts.map +1 -0
- package/dist/components/ui/markdown/mermaid-diagram.d.ts +79 -0
- package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -0
- package/dist/components/ui/markdown/rich/embed-overrides.d.ts +14 -0
- package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +1 -0
- package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +40 -0
- package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -0
- package/dist/components/ui/markdown/rich/shortcodes.d.ts +8 -0
- package/dist/components/ui/markdown/rich/shortcodes.d.ts.map +1 -0
- package/dist/components/ui/markdown/sanitize.d.ts +153 -0
- package/dist/components/ui/markdown/sanitize.d.ts.map +1 -0
- package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +23 -0
- package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -0
- package/dist/components/ui/markdown/streaming.d.ts +78 -0
- package/dist/components/ui/markdown/streaming.d.ts.map +1 -0
- package/dist/components/ui/markdown/text-size.d.ts +34 -0
- package/dist/components/ui/markdown/text-size.d.ts.map +1 -0
- package/dist/index.cjs +60 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +71 -13
- package/dist/utils/index.cjs +169 -40
- 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 +162 -41
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/markdown-fences.d.ts +42 -0
- package/dist/utils/markdown-fences.d.ts.map +1 -0
- package/dist/utils/markdown-heading-id.d.ts +85 -0
- package/dist/utils/markdown-heading-id.d.ts.map +1 -0
- package/dist/utils/markdown-section-extractor.d.ts.map +1 -1
- package/package.json +7 -1
- package/src/chat-protocol/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +319 -0
- package/src/chat-protocol/__tests__/chat-protocol.test.ts +516 -0
- package/src/chat-protocol/__tests__/env-flag.test.ts +52 -0
- package/src/chat-protocol/__tests__/ip-normalize.test.ts +136 -0
- package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +237 -0
- package/src/chat-protocol/decode.ts +278 -0
- package/src/chat-protocol/encode.ts +71 -0
- package/src/chat-protocol/env-flag.ts +39 -0
- package/src/chat-protocol/events.ts +254 -0
- package/src/chat-protocol/frames.ts +245 -0
- package/src/chat-protocol/index.ts +21 -0
- package/src/chat-protocol/ip-normalize.ts +146 -0
- package/src/chat-protocol/nats-decoder.ts +264 -0
- package/src/components/chat/.chat-message-list.md +10 -6
- package/src/components/chat/__tests__/chat-message-list.test.tsx +450 -9
- package/src/components/chat/__tests__/chat-message-streaming-memo.test.tsx +207 -0
- package/src/components/chat/__tests__/chat-pending-turn.test.tsx +250 -0
- package/src/components/chat/chat-message-enhanced.tsx +122 -20
- package/src/components/chat/chat-message-list.tsx +515 -133
- package/src/components/chat/embeddable-chat.tsx +6 -0
- package/src/components/chat/hooks/.index.md +30 -33
- package/src/components/chat/hooks/.use-nats-chat-adapter.md +36 -55
- package/src/components/chat/hooks/__tests__/__snapshots__/conversation-id-persistence-golden.test.ts.snap +37 -0
- package/src/components/chat/hooks/__tests__/__snapshots__/sse-stream-golden.test.ts.snap +0 -0
- package/src/components/chat/hooks/__tests__/chunk-catchup-dialog-staleness.test.ts +92 -0
- package/src/components/chat/hooks/__tests__/conversation-id-persistence-golden.test.ts +438 -0
- package/src/components/chat/hooks/__tests__/sse-stream-golden.test.ts +318 -0
- package/src/components/chat/hooks/index.ts +0 -1
- package/src/components/chat/hooks/use-chat.ts +8 -0
- package/src/components/chat/hooks/use-chunk-catchup.ts +26 -1
- package/src/components/chat/hooks/use-nats-chat-adapter.ts +254 -825
- package/src/components/chat/hooks/use-sse-chat-adapter.ts +380 -684
- package/src/components/chat/index.ts +5 -0
- package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap +944 -0
- package/src/components/chat/stream/__tests__/chat-dialog-store.test.ts +806 -0
- package/src/components/chat/stream/__tests__/chat-stream-reducer-golden.test.ts +467 -0
- package/src/components/chat/stream/__tests__/chat-stream-reducer.test.ts +1330 -0
- package/src/components/chat/stream/__tests__/delta-batcher.test.ts +255 -0
- package/src/components/chat/stream/__tests__/use-chat-stream-reducer.test.ts +105 -0
- package/src/components/chat/stream/chat-dialog-store.ts +536 -0
- package/src/components/chat/stream/chat-stream-reducer.ts +1928 -0
- package/src/components/chat/stream/delta-batcher.ts +168 -0
- package/src/components/chat/stream/index.ts +55 -0
- package/src/components/chat/stream/message-mutations.ts +340 -0
- package/src/components/chat/stream/use-chat-stream-reducer.ts +126 -0
- package/src/components/chat/thinking-display.tsx +1 -1
- package/src/components/chat/types/.api.types.md +39 -49
- package/src/components/chat/types/.processing.types.md +29 -58
- package/src/components/chat/types/.unified-chat-state.types.md +2 -2
- package/src/components/chat/types/api.types.ts +6 -73
- package/src/components/chat/types/processing.types.ts +11 -53
- package/src/components/chat/types/unified-chat-state.types.ts +16 -0
- package/src/components/chat/utils/.extract-incomplete-message-state.md +21 -3
- package/src/components/chat/utils/.history-merge.md +44 -3
- package/src/components/chat/utils/.index.md +31 -40
- package/src/components/chat/utils/__tests__/__snapshots__/process-historical-messages-golden.test.ts.snap +420 -0
- package/src/components/chat/utils/__tests__/__snapshots__/segment-accumulator-golden.test.ts.snap +605 -0
- package/src/components/chat/utils/__tests__/extract-incomplete-message-state.test.ts +106 -0
- package/src/components/chat/utils/__tests__/history-merge.test.ts +160 -0
- package/src/components/chat/utils/__tests__/process-historical-messages-approvals.test.ts +61 -0
- package/src/components/chat/utils/__tests__/process-historical-messages-golden.test.ts +394 -0
- package/src/components/chat/utils/__tests__/segment-accumulator-golden.test.ts +270 -0
- package/src/components/chat/utils/extract-incomplete-message-state.ts +93 -6
- package/src/components/chat/utils/history-merge.ts +85 -5
- package/src/components/chat/utils/index.ts +5 -8
- package/src/components/chat/utils/process-historical-messages.ts +361 -385
- package/src/components/onboarding-guides/onboarding-guide-detail-view.tsx +22 -4
- package/src/components/shared/legal-document/legal-document-page.tsx +1 -1
- package/src/components/shared/product-release/release-detail-page.tsx +19 -4
- package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +2420 -0
- package/src/components/ui/__tests__/markdown-parity.test.tsx +2540 -0
- package/src/components/ui/index.ts +1 -2
- package/src/components/ui/markdown/__tests__/mermaid-security.test.ts +176 -0
- package/src/components/ui/markdown/__tests__/mermaid-stale-render.test.tsx +151 -0
- package/src/components/ui/markdown/__tests__/sanitize-invariant.test.ts +354 -0
- package/src/components/ui/markdown/__tests__/sanitize-render.test.tsx +118 -0
- package/src/components/ui/markdown/__tests__/streaming.test.tsx +436 -0
- package/src/components/ui/markdown/base-components.tsx +360 -0
- package/src/components/ui/markdown/engine.tsx +315 -0
- package/src/components/ui/markdown/heading-ids.ts +239 -0
- package/src/components/ui/markdown/index.ts +49 -0
- package/src/components/ui/markdown/mermaid-diagram.tsx +323 -0
- package/src/components/ui/markdown/rich/embed-overrides.tsx +199 -0
- package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +184 -0
- package/src/components/ui/markdown/rich/shortcodes.ts +170 -0
- package/src/components/ui/markdown/sanitize.ts +3584 -0
- package/src/components/ui/markdown/simple-markdown-renderer.tsx +28 -0
- package/src/components/ui/markdown/streaming.ts +390 -0
- package/src/components/ui/markdown/text-size.ts +106 -0
- package/src/components/ui/release-changelog-section.tsx +1 -1
- package/src/components/ui/ticket-info-section.tsx +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/markdown-fences.ts +127 -0
- package/src/utils/markdown-heading-id.ts +348 -0
- package/src/utils/markdown-section-extractor.ts +41 -56
- package/dist/chunk-OCEKO5CW.js.map +0 -1
- package/dist/chunk-QTYZMP6D.cjs.map +0 -1
- package/dist/chunk-TLMJHMXJ.js.map +0 -1
- package/dist/chunk-TWYNR4TZ.cjs.map +0 -1
- package/dist/chunk-WA7RR64F.js.map +0 -1
- package/dist/chunk-WK4N5VBX.cjs.map +0 -1
- package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts +0 -6
- package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +0 -1
- package/dist/components/chat/utils/chunk-parser.d.ts +0 -25
- package/dist/components/chat/utils/chunk-parser.d.ts.map +0 -1
- package/dist/components/ui/rich-markdown-renderer.d.ts +0 -34
- package/dist/components/ui/rich-markdown-renderer.d.ts.map +0 -1
- package/dist/components/ui/simple-markdown-renderer.d.ts +0 -73
- package/dist/components/ui/simple-markdown-renderer.d.ts.map +0 -1
- package/src/components/chat/hooks/.use-realtime-chunk-processor.md +0 -77
- package/src/components/chat/hooks/use-realtime-chunk-processor.ts +0 -489
- package/src/components/chat/utils/.chunk-parser.md +0 -62
- package/src/components/chat/utils/chunk-parser.ts +0 -262
- package/src/components/ui/.simple-markdown-renderer.md +0 -52
- package/src/components/ui/rich-markdown-renderer.tsx +0 -1223
- package/src/components/ui/simple-markdown-renderer.tsx +0 -964
- /package/dist/{chunk-ADPMHWOE.js.map → chunk-72XAID7Y.js.map} +0 -0
- /package/dist/{chunk-PAGKRNWK.js.map → chunk-7WZHBQ4J.js.map} +0 -0
- /package/dist/{chunk-TSZHM74B.js.map → chunk-DC2TKS7C.js.map} +0 -0
- /package/dist/{chunk-I64ABCDX.js.map → chunk-I2B6X77L.js.map} +0 -0
- /package/dist/{chunk-DTYRYB2N.js.map → chunk-K6QTZ7CZ.js.map} +0 -0
- /package/dist/{chunk-4LTMXDUS.js.map → chunk-KBN7PMFT.js.map} +0 -0
- /package/dist/{chunk-TBMV7I5N.js.map → chunk-KXZO2WZX.js.map} +0 -0
- /package/dist/{chunk-KEBYLU3U.js.map → chunk-LFUPI7VX.js.map} +0 -0
- /package/dist/{chunk-WJQHJD7J.js.map → chunk-TWSKTJHW.js.map} +0 -0
- /package/dist/{chunk-TZRUCD56.js.map → chunk-V3ZAAFE3.js.map} +0 -0
- /package/dist/{chunk-LRGHJPET.js.map → chunk-XGIFOHKE.js.map} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE wire-protocol decoder — a timer-free synchronous state machine,
|
|
3
|
+
* mechanically extracted from `useSseChatAdapter`'s inline
|
|
4
|
+
* `createDocStreamFn` parser. Byte-for-byte behavior parity with the
|
|
5
|
+
* legacy parser is the contract (the golden fixtures in
|
|
6
|
+
* `src/components/chat/hooks/__tests__/sse-stream-golden.test.ts` pin it
|
|
7
|
+
* through the full hook path), including its quirks:
|
|
8
|
+
*
|
|
9
|
+
* - A leading `\0`-terminated block that fails JSON.parse flips the
|
|
10
|
+
* stream into text mode and the WHOLE buffer (including the `\0`)
|
|
11
|
+
* is emitted as answer text (legacy no-frame stream fallback). This
|
|
12
|
+
* transition is marked `turn-start { implicit: true }`.
|
|
13
|
+
* - In text mode only `\x1F` is scanned — literal `\0` / `\x1E` bytes
|
|
14
|
+
* pass through into the answer; the FIRST literal `\x1F` flips into
|
|
15
|
+
* trailer mode and everything after is captured as the trailer
|
|
16
|
+
* (golden fixture (d) characterizes this mis-framing; the fix lives
|
|
17
|
+
* in `encode.ts`'s sentinel stripping, NOT here).
|
|
18
|
+
* - The `\x1E` sentinel and the `\x1F` trailer can arrive in ONE TCP
|
|
19
|
+
* chunk (fixed-answer responses) — the post-sentinel slice is
|
|
20
|
+
* re-scanned for the trailer sentinel.
|
|
21
|
+
* - Multi-byte UTF-8 across chunk boundaries survives via a single
|
|
22
|
+
* streaming TextDecoder (`{ stream: true }` on every push; no final
|
|
23
|
+
* flush — a trailing partial code point is dropped, as legacy did).
|
|
24
|
+
* - `end()` parses the accumulated trailer (malformed → silently
|
|
25
|
+
* ignored) and drops any un-terminated leading buffer, as legacy did.
|
|
26
|
+
* It is IDEMPOTENT (a deliberate deviation from legacy): repeat calls
|
|
27
|
+
* emit nothing, so an adapter that ends in both its completion path
|
|
28
|
+
* and its `finally` cannot double-count the usage frame.
|
|
29
|
+
*
|
|
30
|
+
* State flow: leading → (sentinel | parse-failure) → text → (\x1F) →
|
|
31
|
+
* trailer-accumulate → end().
|
|
32
|
+
*
|
|
33
|
+
* Server-safe: no React, no timers, TextDecoder only.
|
|
34
|
+
*/
|
|
35
|
+
import type { ChatStreamEvent } from './events';
|
|
36
|
+
export interface SseFrameDecoder {
|
|
37
|
+
/** Feed raw response bytes; returns the events they produced. */
|
|
38
|
+
push(bytes: Uint8Array): ChatStreamEvent[];
|
|
39
|
+
/**
|
|
40
|
+
* Signal end-of-stream; parses the trailing usage frame if present.
|
|
41
|
+
* IDEMPOTENT — every call after the first returns `[]`. Adapters
|
|
42
|
+
* routinely call this from BOTH their completion path and a `finally`,
|
|
43
|
+
* and a re-emitted `usage`/`stage:'end'` event would double-count token
|
|
44
|
+
* usage (displayed cost doubles).
|
|
45
|
+
*/
|
|
46
|
+
end(): ChatStreamEvent[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Escape `<` so markdown renderers that pass HTML through (rehypeRaw)
|
|
50
|
+
* don't treat XML-like tokens in Claude's thinking output as elements.
|
|
51
|
+
* `<` → `<` preserves the visible character without breaking
|
|
52
|
+
* blockquote `>` markers. Per-character, so it distributes over
|
|
53
|
+
* concatenation: escape(a + b) === escape(a) + escape(b) — callers may
|
|
54
|
+
* apply it per-delta or on the accumulated string interchangeably.
|
|
55
|
+
*/
|
|
56
|
+
export declare function escapeThinkingTags(text: string): string;
|
|
57
|
+
export declare function createSseFrameDecoder(): SseFrameDecoder;
|
|
58
|
+
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/chat-protocol/decode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,eAAe,EAAE,CAAA;IAC1C;;;;;;OAMG;IACH,GAAG,IAAI,eAAe,EAAE,CAAA;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqGD,wBAAgB,qBAAqB,IAAI,eAAe,CAmHvD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE wire-protocol encoders — the emit side of the framing contract in
|
|
3
|
+
* `./frames.ts`. Server-safe (TextEncoder only). The hub's stream route
|
|
4
|
+
* consumes these so emitter and decoder can never drift.
|
|
5
|
+
*/
|
|
6
|
+
import { type SseLeadingFrame, type SseTrailingUsageFrame } from './frames';
|
|
7
|
+
/**
|
|
8
|
+
* Remove the SSE framing sentinel bytes (`\0`, `\x1E`, `\x1F`) from model
|
|
9
|
+
* text. Exported as a STANDALONE helper — not just folded into
|
|
10
|
+
* `encodeTextDelta` — because producers must strip at the point where they
|
|
11
|
+
* first take custody of the text, BEFORE any local accumulation.
|
|
12
|
+
*
|
|
13
|
+
* Concretely: the hub's `claude-util.ts` accumulates `state.answerText` for
|
|
14
|
+
* persistence + telemetry. If stripping only happened at encode time, the
|
|
15
|
+
* persisted/telemetered answer would diverge, character for character, from
|
|
16
|
+
* the bytes the user actually received whenever the model echoes a control
|
|
17
|
+
* byte. Both sides call this, so there is exactly ONE definition of "which
|
|
18
|
+
* bytes are framing" in the whole system — do not re-declare the regex.
|
|
19
|
+
*
|
|
20
|
+
* Idempotent and per-character, so it distributes over concatenation:
|
|
21
|
+
* `strip(a + b) === strip(a) + strip(b)` — safe to apply per-delta or on the
|
|
22
|
+
* accumulated string interchangeably.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stripSentinelBytes(text: string): string;
|
|
25
|
+
/** Encode one leading frame: JSON + `\0` terminator. */
|
|
26
|
+
export declare function encodeLeadingFrame(frame: SseLeadingFrame): Uint8Array;
|
|
27
|
+
/** Encode the single `\x1E` end-of-leading-frames sentinel. */
|
|
28
|
+
export declare function encodeEndOfLeading(): Uint8Array;
|
|
29
|
+
/**
|
|
30
|
+
* Encode a raw answer-text delta. STRIPS the framing sentinel bytes via
|
|
31
|
+
* `stripSentinelBytes` so model-echoed control bytes can no longer
|
|
32
|
+
* mis-frame the stream (a literal `\x1F` in the answer used to flip the
|
|
33
|
+
* client into trailer mode and swallow the rest of the answer PLUS the real
|
|
34
|
+
* usage trailer — characterized by golden fixture (d)). Forward-looking
|
|
35
|
+
* encoder fix only; the decoder's behavior is unchanged.
|
|
36
|
+
*
|
|
37
|
+
* Producers that ALSO accumulate the text locally (persistence, telemetry)
|
|
38
|
+
* must call `stripSentinelBytes` on their own copy — see its docblock.
|
|
39
|
+
*/
|
|
40
|
+
export declare function encodeTextDelta(text: string): Uint8Array;
|
|
41
|
+
/** Encode the trailing usage frame: `\x1F` + JSON, no terminator
|
|
42
|
+
* (runs to stream end). */
|
|
43
|
+
export declare function encodeTrailingUsageFrame(frame: SseTrailingUsageFrame): Uint8Array;
|
|
44
|
+
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/chat-protocol/encode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAA;AAQjB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wDAAwD;AACxD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CAErE;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,IAAI,UAAU,CAE/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAExD;AAED;4BAC4B;AAC5B,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,UAAU,CAEjF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `envFlagEnabled` — THE cross-repo predicate for reading a boolean env flag.
|
|
3
|
+
*
|
|
4
|
+
* WHY IT LIVES HERE: the same flag is read on BOTH sides of the guide-chat
|
|
5
|
+
* seam and each side had grown its own reading of it. The hub parsed the
|
|
6
|
+
* value (`'0'` / `'false'` / `'off'` mean OFF); the producing app used bare
|
|
7
|
+
* `Boolean(process.env.X)`, under which every non-empty string — including
|
|
8
|
+
* `'0'` and `'false'` — is TRUE.
|
|
9
|
+
*
|
|
10
|
+
* That divergence failed OPEN on the one flag that gates a security boundary.
|
|
11
|
+
* `TRUSTED_INGRESS_SETS_REAL_IP` is an operator's assertion that a reverse
|
|
12
|
+
* proxy OVERWRITES the client-IP headers; without it those headers are
|
|
13
|
+
* attacker-writable and must not be read. An operator writing `=0` to mean
|
|
14
|
+
* "off" got the hub honoring that while the producer read `x-real-ip` /
|
|
15
|
+
* `x-forwarded-for` anyway and forwarded the value as `x-chat-ip`, which the
|
|
16
|
+
* hub then trusts verbatim under the service token. A rate-limit-bucket
|
|
17
|
+
* spoof, reachable through a plausible operator typo.
|
|
18
|
+
*
|
|
19
|
+
* Both repos already depend on this package and `./chat-protocol` is its
|
|
20
|
+
* server-safe subpath (no React, no browser APIs), so this is the one place
|
|
21
|
+
* both sides can share — same reasoning that moved `normalizeIpForBucketKey`
|
|
22
|
+
* here. Keep it as ONE definition: a second copy is what caused the drift.
|
|
23
|
+
*
|
|
24
|
+
* Contract:
|
|
25
|
+
* - unset, empty, or whitespace-only → `false`;
|
|
26
|
+
* - `'0'`, `'false'`, `'off'` → `false` (case- and
|
|
27
|
+
* surrounding-whitespace-insensitive);
|
|
28
|
+
* - any other non-empty value → `true`.
|
|
29
|
+
*
|
|
30
|
+
* `process.env` is read PER CALL, never module-hoisted, so tests, preview and
|
|
31
|
+
* prod all observe the live value rather than whatever was present at
|
|
32
|
+
* module-eval time.
|
|
33
|
+
*/
|
|
34
|
+
export declare function envFlagEnabled(name: string): boolean;
|
|
35
|
+
//# sourceMappingURL=env-flag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-flag.d.ts","sourceRoot":"","sources":["../../src/chat-protocol/env-flag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized chat stream events — the transport-agnostic event union BOTH
|
|
3
|
+
* decoders (SSE byte framing in `./decode.ts`, NATS chunks in
|
|
4
|
+
* `./nats-decoder.ts`) emit. Phase 3 of the chat unification makes the
|
|
5
|
+
* reducer consume these directly; today the SSE adapter maps them back to
|
|
6
|
+
* legacy `MessageSegment` yields.
|
|
7
|
+
*
|
|
8
|
+
* Server-safe: no React, no browser APIs.
|
|
9
|
+
*/
|
|
10
|
+
import type { ApprovalRequestField, DecisionResolvedFrame, UsageTelemetry } from './frames';
|
|
11
|
+
/** Optional envelope on every event. `seq` carries the transport's
|
|
12
|
+
* stream sequence (JetStream `streamSeq` on NATS; unused on SSE). */
|
|
13
|
+
interface ChatStreamEventBase {
|
|
14
|
+
seq?: number;
|
|
15
|
+
}
|
|
16
|
+
/** Stream entered answer-text mode (SSE: the `\x1E` sentinel or the
|
|
17
|
+
* JSON-parse-failure fallback; NATS: MESSAGE_START).
|
|
18
|
+
* `implicit` is true ONLY for the SSE fallback path where a
|
|
19
|
+
* non-JSON leading buffer flips straight into text mode — consumers
|
|
20
|
+
* that flush coalesced thinking on turn-start must SKIP the flush for
|
|
21
|
+
* implicit starts (legacy adapter parity: the fallback path never
|
|
22
|
+
* flushed pending thinking before the text). */
|
|
23
|
+
export interface TurnStartEvent extends ChatStreamEventBase {
|
|
24
|
+
type: 'turn-start';
|
|
25
|
+
implicit?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TurnEndEvent extends ChatStreamEventBase {
|
|
28
|
+
type: 'turn-end';
|
|
29
|
+
}
|
|
30
|
+
/** Answer text delta. `leading: true` marks SSE `text-leading` frames
|
|
31
|
+
* (model preamble prose emitted BEFORE the tool approval card). */
|
|
32
|
+
export interface TextDeltaEvent extends ChatStreamEventBase {
|
|
33
|
+
type: 'text-delta';
|
|
34
|
+
text: string;
|
|
35
|
+
leading?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Thinking delta — APPEND-ONLY contract: each event carries the next
|
|
38
|
+
* verbatim slice; consumers accumulate. Decoders never diff. */
|
|
39
|
+
export interface ThinkingDeltaEvent extends ChatStreamEventBase {
|
|
40
|
+
type: 'thinking-delta';
|
|
41
|
+
text: string;
|
|
42
|
+
}
|
|
43
|
+
/** Guide-body delta (NATS `GUIDE` chunk) — the assistant's how-to /
|
|
44
|
+
* documentation answer, rendered as a titled "OpenFrame Guide" card rather
|
|
45
|
+
* than bare prose. Same APPEND-ONLY contract as `text-delta` /
|
|
46
|
+
* `thinking-delta`: each event carries the next verbatim slice and consumers
|
|
47
|
+
* coalesce into the trailing `guide` segment. NATS-only today — the SSE
|
|
48
|
+
* frame grammar has no guide frame — but it lives in the shared union
|
|
49
|
+
* because the reducer is transport-agnostic. */
|
|
50
|
+
export interface GuideDeltaEvent extends ChatStreamEventBase {
|
|
51
|
+
type: 'guide-delta';
|
|
52
|
+
text: string;
|
|
53
|
+
}
|
|
54
|
+
export interface StatusEvent extends ChatStreamEventBase {
|
|
55
|
+
type: 'status';
|
|
56
|
+
phase: 'thinking';
|
|
57
|
+
}
|
|
58
|
+
/** NATS tool execution progress (EXECUTING_TOOL / EXECUTED_TOOL). */
|
|
59
|
+
export interface ToolExecutionEvent extends ChatStreamEventBase {
|
|
60
|
+
type: 'tool-execution';
|
|
61
|
+
data: {
|
|
62
|
+
type: 'EXECUTING_TOOL' | 'EXECUTED_TOOL';
|
|
63
|
+
integratedToolType: string;
|
|
64
|
+
toolFunction: string;
|
|
65
|
+
toolTitle?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Human-readable "why this tool is running" line, rendered as the body of
|
|
68
|
+
* the tool card. Carried by the EXECUTING chunk ONLY — the EXECUTED one
|
|
69
|
+
* never repeats it, and the accumulator's merge keeps whatever the
|
|
70
|
+
* EXECUTING segment held (`toolData.toolExplanation ?? existing`). Omitting
|
|
71
|
+
* it from this contract blanks the card for the whole run, live and on
|
|
72
|
+
* replay, which is exactly what happened while it was missing here.
|
|
73
|
+
*/
|
|
74
|
+
toolExplanation?: string;
|
|
75
|
+
parameters?: Record<string, unknown>;
|
|
76
|
+
result?: string;
|
|
77
|
+
success?: boolean;
|
|
78
|
+
toolExecutionRequestId?: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Single tool call inside a batch approval request (NATS). */
|
|
82
|
+
export interface ApprovalToolCall {
|
|
83
|
+
toolExecutionRequestId: string;
|
|
84
|
+
toolName: string;
|
|
85
|
+
toolTitle?: string;
|
|
86
|
+
toolExplanation?: string;
|
|
87
|
+
toolType?: string;
|
|
88
|
+
requiresApproval: boolean;
|
|
89
|
+
approvalType?: string | null;
|
|
90
|
+
toolCallArguments?: Record<string, unknown> | null;
|
|
91
|
+
}
|
|
92
|
+
/** A tool call awaits user approval. SSE fills `command`/`fields`
|
|
93
|
+
* (card-ready payload); NATS fills `command`/`explanation` or
|
|
94
|
+
* `toolCalls` (batch form). */
|
|
95
|
+
export interface ApprovalRequestEvent extends ChatStreamEventBase {
|
|
96
|
+
type: 'approval-request';
|
|
97
|
+
requestId: string;
|
|
98
|
+
/** SSE: the write tool's name. NATS: approval tier (USER/ADMIN/…). */
|
|
99
|
+
approvalType?: string;
|
|
100
|
+
command?: string;
|
|
101
|
+
explanation?: string;
|
|
102
|
+
fields?: ApprovalRequestField[];
|
|
103
|
+
toolCalls?: ApprovalToolCall[];
|
|
104
|
+
status?: 'pending';
|
|
105
|
+
}
|
|
106
|
+
/** An approval request was resolved (SSE `decision_resolved` frame /
|
|
107
|
+
* NATS APPROVAL_RESULT chunk). */
|
|
108
|
+
export interface ApprovalResolvedEvent extends ChatStreamEventBase {
|
|
109
|
+
type: 'approval-resolved';
|
|
110
|
+
requestId?: string;
|
|
111
|
+
status: 'approved' | 'rejected';
|
|
112
|
+
ok?: boolean;
|
|
113
|
+
toolName?: string;
|
|
114
|
+
approvalType?: string;
|
|
115
|
+
resolvedByName?: string | null;
|
|
116
|
+
receiptText?: string;
|
|
117
|
+
/** Inline post-approve card: the ref payload + its documentType +
|
|
118
|
+
* the `[card://…]` marker (SSE only). */
|
|
119
|
+
cardRef?: unknown;
|
|
120
|
+
cardType?: string;
|
|
121
|
+
marker?: string;
|
|
122
|
+
result?: DecisionResolvedFrame['result'];
|
|
123
|
+
willAutoContinue?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/** Per-turn metadata. Raw wire values pass through UNVALIDATED — the
|
|
126
|
+
* consumer replicates the legacy truthiness/typeof gates (so a
|
|
127
|
+
* malformed frame degrades identically to the pre-SSOT parser). */
|
|
128
|
+
export interface ChatMetadataEvent extends ChatStreamEventBase {
|
|
129
|
+
type: 'metadata';
|
|
130
|
+
provider?: string | null;
|
|
131
|
+
modelLabel?: string | null;
|
|
132
|
+
/** Raw model id (SSE `meta.model`; NATS `modelName`). */
|
|
133
|
+
modelName?: string | null;
|
|
134
|
+
contextWindowMaxTokens?: number | null;
|
|
135
|
+
sources?: unknown;
|
|
136
|
+
refs?: unknown;
|
|
137
|
+
scrollAnchor?: unknown;
|
|
138
|
+
/** Server-minted conversation id (`ChatMetadataFrame.conversationId`),
|
|
139
|
+
* passed through raw like every other catch-all field — the consumer
|
|
140
|
+
* applies the `typeof === 'string' && truthy` gate. */
|
|
141
|
+
conversationId?: string | null;
|
|
142
|
+
routing?: {
|
|
143
|
+
routedComplexity: string;
|
|
144
|
+
routedModel?: string;
|
|
145
|
+
routedThinkingBudget: number | null;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/** SSE usage frames — raw wire keys (snake_case) preserved. */
|
|
149
|
+
export interface UsageEvent extends ChatStreamEventBase {
|
|
150
|
+
type: 'usage';
|
|
151
|
+
stage: 'start' | 'end';
|
|
152
|
+
input_tokens?: number;
|
|
153
|
+
output_tokens?: number;
|
|
154
|
+
cache_read_input_tokens?: number;
|
|
155
|
+
cache_creation_input_tokens?: number;
|
|
156
|
+
hit_rate_pct?: number;
|
|
157
|
+
telemetry?: UsageTelemetry;
|
|
158
|
+
/** Left OPAQUE on purpose: the consumer (`chat-stream-reducer`'s
|
|
159
|
+
* `applySseUsage`) re-validates every nested field with the legacy
|
|
160
|
+
* truthiness/typeof gates, so a malformed frame degrades identically
|
|
161
|
+
* to the pre-SSOT parser. Typing it would imply guarantees the wire
|
|
162
|
+
* does not make. */
|
|
163
|
+
breakdown?: unknown;
|
|
164
|
+
debug?: unknown;
|
|
165
|
+
}
|
|
166
|
+
/** NATS TOKEN_USAGE chunk (camelCase backend shape). */
|
|
167
|
+
export interface TokenUsageEvent extends ChatStreamEventBase {
|
|
168
|
+
type: 'token-usage';
|
|
169
|
+
inputTokensSize: number;
|
|
170
|
+
outputTokensSize: number;
|
|
171
|
+
totalTokensSize: number;
|
|
172
|
+
contextSize: number;
|
|
173
|
+
}
|
|
174
|
+
export interface CompactionEvent extends ChatStreamEventBase {
|
|
175
|
+
type: 'compaction';
|
|
176
|
+
phase: 'start' | 'end';
|
|
177
|
+
summary?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface ErrorEvent extends ChatStreamEventBase {
|
|
180
|
+
type: 'error';
|
|
181
|
+
title: string;
|
|
182
|
+
details?: string;
|
|
183
|
+
}
|
|
184
|
+
/** Non-assistant message on the stream (NATS): the user's own message
|
|
185
|
+
* echo (`message-request`), an operator direct message, or a system
|
|
186
|
+
* line. */
|
|
187
|
+
/**
|
|
188
|
+
* Dialog participant owner type. The two members below are the ones clients
|
|
189
|
+
* BRANCH ON (admin-vs-not decides echo dedup and author styling); the union
|
|
190
|
+
* stays open (`string & {}`) because the wire may carry other roles that the
|
|
191
|
+
* client treats as "not admin". Always compare against `CHAT_OWNER_ADMIN`,
|
|
192
|
+
* never a bare `'ADMIN'` literal — a typo in a literal silently disables
|
|
193
|
+
* dedup instead of failing to compile.
|
|
194
|
+
*/
|
|
195
|
+
export type ChatOwnerType = 'ADMIN' | 'CLIENT' | (string & {});
|
|
196
|
+
/** Canonical ADMIN owner-type token (see `ChatOwnerType`). */
|
|
197
|
+
export declare const CHAT_OWNER_ADMIN = "ADMIN";
|
|
198
|
+
export interface ParticipantEvent extends ChatStreamEventBase {
|
|
199
|
+
type: 'participant';
|
|
200
|
+
kind: 'message-request' | 'direct-message' | 'system';
|
|
201
|
+
text: string;
|
|
202
|
+
ownerType?: ChatOwnerType;
|
|
203
|
+
displayName?: string;
|
|
204
|
+
userId?: string;
|
|
205
|
+
contextItems?: Array<{
|
|
206
|
+
type: string;
|
|
207
|
+
id: string;
|
|
208
|
+
label: string;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
export interface DialogClosedEvent extends ChatStreamEventBase {
|
|
212
|
+
type: 'dialog-closed';
|
|
213
|
+
}
|
|
214
|
+
export type ChatStreamEvent = TurnStartEvent | TurnEndEvent | TextDeltaEvent | ThinkingDeltaEvent | GuideDeltaEvent | StatusEvent | ToolExecutionEvent | ApprovalRequestEvent | ApprovalResolvedEvent | ChatMetadataEvent | UsageEvent | TokenUsageEvent | CompactionEvent | ErrorEvent | ParticipantEvent | DialogClosedEvent;
|
|
215
|
+
export {};
|
|
216
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/chat-protocol/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACf,MAAM,UAAU,CAAA;AAEjB;sEACsE;AACtE,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;;;;iDAMiD;AACjD,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,IAAI,EAAE,UAAU,CAAA;C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the
|
|
3
|
+
* hub's chat stream emitter (`multi-platform-hub/lib/utils/claude-util.ts`)
|
|
4
|
+
* and the lib's SSE decoder (`./decode.ts`).
|
|
5
|
+
*
|
|
6
|
+
* Wire format (custom byte framing, NOT standard SSE `data:` lines):
|
|
7
|
+
*
|
|
8
|
+
* [JSON frame]\0 [JSON frame]\0 … \x1E <raw UTF-8 answer deltas> \x1F [JSON usage trailer]
|
|
9
|
+
*
|
|
10
|
+
* 1. LEADING frames — each a JSON object terminated by `\0`
|
|
11
|
+
* (FRAME_TERMINATOR). Status, metadata, routing, live thinking
|
|
12
|
+
* deltas, usage:start, tool approval frames.
|
|
13
|
+
* 2. ONE `\x1E` byte (END_OF_LEADING) — flips the stream into raw
|
|
14
|
+
* UTF-8 answer-text mode.
|
|
15
|
+
* 3. `\x1F` (TRAILER_SENTINEL) + one JSON usage frame running to
|
|
16
|
+
* stream end (no terminator).
|
|
17
|
+
*
|
|
18
|
+
* Server-safe: no React, no browser APIs beyond TextEncoder/TextDecoder.
|
|
19
|
+
*/
|
|
20
|
+
/** Terminates every leading JSON frame. */
|
|
21
|
+
export declare const FRAME_TERMINATOR = "\0";
|
|
22
|
+
/** Record Separator — end of leading frames, start of raw answer text. */
|
|
23
|
+
export declare const END_OF_LEADING = "\u001E";
|
|
24
|
+
/** Unit Separator — start of the trailing usage JSON frame. */
|
|
25
|
+
export declare const TRAILER_SENTINEL = "\u001F";
|
|
26
|
+
/** Server-side routing complexity tiers. Mirror of the hub's
|
|
27
|
+
* `lib/constants/ai-models.ts` union — kept as a lib-local literal type
|
|
28
|
+
* so the wire SSOT has zero hub imports. The DECODER accepts any string
|
|
29
|
+
* (older/newer servers may ship values outside this union). */
|
|
30
|
+
export type RouteComplexity = 'trivial' | 'default' | 'complex' | 'deep';
|
|
31
|
+
/**
|
|
32
|
+
* Routing decision frame. Emitted once per turn as a LEADING frame
|
|
33
|
+
* (between metadata and the `\x1E` end-of-leading-frames sentinel) when
|
|
34
|
+
* the server's `decideRoute()` produces a `Route`.
|
|
35
|
+
*
|
|
36
|
+
* Field names use the `routed*` prefix on PURPOSE — the client's
|
|
37
|
+
* catch-all leading-frame branch inspects `meta.model` / `meta.modelLabel`.
|
|
38
|
+
* A bare `model` field on this frame would OVERWRITE the metadata frame's
|
|
39
|
+
* modelLabel and break the <ModelDisplay> badge. The `routed` prefix
|
|
40
|
+
* sidesteps that collision.
|
|
41
|
+
*
|
|
42
|
+
* Older clients that don't recognize `kind: 'routing'` silently drop
|
|
43
|
+
* the frame (the catch-all only matches frames carrying known fields
|
|
44
|
+
* like `sources` / `refs` / `modelLabel`).
|
|
45
|
+
*/
|
|
46
|
+
export interface RoutingFrame {
|
|
47
|
+
kind: 'routing';
|
|
48
|
+
routedComplexity: RouteComplexity;
|
|
49
|
+
routedModel: string;
|
|
50
|
+
routedThinkingBudget: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Optional field on the trailing usage frame's `breakdown`. Surfaces
|
|
54
|
+
* per-route attribution to the admin test console so an operator can
|
|
55
|
+
* see "this turn ran on Haiku/trivial/$0.0005" without re-parsing the
|
|
56
|
+
* stream. Additive: clients that ignore unknown keys keep working.
|
|
57
|
+
*/
|
|
58
|
+
export interface RoutedAnswerBreakdown {
|
|
59
|
+
model: string;
|
|
60
|
+
complexity: RouteComplexity;
|
|
61
|
+
thinkingBudget: number;
|
|
62
|
+
}
|
|
63
|
+
/** First frame on every stream — lets the shell render "Thinking…"
|
|
64
|
+
* within ~200ms, before any upstream byte arrives. */
|
|
65
|
+
export interface StatusThinkingFrame {
|
|
66
|
+
status: 'thinking';
|
|
67
|
+
}
|
|
68
|
+
/** Per-turn metadata frame. The emitter sends `options.metadata`
|
|
69
|
+
* verbatim; a separate refs-only frame may follow with the same shape.
|
|
70
|
+
* All fields optional — the decoder's catch-all treats ANY frame that
|
|
71
|
+
* didn't match a `kind` discriminant as metadata-ish. */
|
|
72
|
+
export interface ChatMetadataFrame {
|
|
73
|
+
/** Retrieval sources for the source-chip strip. Host-defined row
|
|
74
|
+
* shape (`ChatSource` on the adapter side) — opaque at wire level. */
|
|
75
|
+
sources?: unknown[];
|
|
76
|
+
/** Per-row refs for inline object cards, keyed `<type>:<id>`. */
|
|
77
|
+
refs?: Record<string, unknown>;
|
|
78
|
+
/** Raw model id (e.g. 'claude-sonnet-x'). Presence alone triggers the
|
|
79
|
+
* client's meta merge; the value itself is not stored. */
|
|
80
|
+
model?: string;
|
|
81
|
+
modelLabel?: string;
|
|
82
|
+
provider?: string;
|
|
83
|
+
contextWindowMaxTokens?: number;
|
|
84
|
+
/** Per-message viewport-positioning hint ('top' | 'bottom'). */
|
|
85
|
+
scrollAnchor?: string;
|
|
86
|
+
/** SERVER-minted conversation trace id (`chat_conversations.id`),
|
|
87
|
+
* echoed on every turn's leading metadata frame. The client never
|
|
88
|
+
* generates ids — the first turn of a session goes out id-less, the
|
|
89
|
+
* server mints one and echoes it here, and the adapter persists the
|
|
90
|
+
* echoed id as its ONLY local state (see
|
|
91
|
+
* `chat-conversation-storage.ts` on the consumer side). */
|
|
92
|
+
conversationId?: string;
|
|
93
|
+
}
|
|
94
|
+
/** Live adaptive-thinking delta. WIRE IS ALREADY DELTA (Anthropic
|
|
95
|
+
* thinking_delta slices) — decoders must NOT diff or re-accumulate. */
|
|
96
|
+
export interface ThinkingDeltaFrame {
|
|
97
|
+
kind: 'thinking-delta';
|
|
98
|
+
text: string;
|
|
99
|
+
}
|
|
100
|
+
/** Usage frame emitted as a LEADING frame right after Anthropic's
|
|
101
|
+
* message_start (stage='start'). */
|
|
102
|
+
export interface UsageStartFrame {
|
|
103
|
+
kind: 'usage';
|
|
104
|
+
stage: 'start';
|
|
105
|
+
input_tokens: number;
|
|
106
|
+
cache_read_input_tokens?: number;
|
|
107
|
+
cache_creation_input_tokens?: number;
|
|
108
|
+
}
|
|
109
|
+
/** Model preamble prose written BEFORE a tool_use block — emitted as a
|
|
110
|
+
* standalone leading frame so it isn't stranded behind the approval
|
|
111
|
+
* card (the `\x1E` sentinel is suppressed on tool turns). */
|
|
112
|
+
export interface TextLeadingFrame {
|
|
113
|
+
kind: 'text-leading';
|
|
114
|
+
text: string;
|
|
115
|
+
}
|
|
116
|
+
/** Tool invocation failed server-side (proposal persist error,
|
|
117
|
+
* validation, ownership denial …). */
|
|
118
|
+
export interface ToolErrorFrame {
|
|
119
|
+
kind: 'tool_error';
|
|
120
|
+
toolName?: string;
|
|
121
|
+
toolUseId?: string;
|
|
122
|
+
message: string;
|
|
123
|
+
}
|
|
124
|
+
export interface ApprovalRequestField {
|
|
125
|
+
label: string;
|
|
126
|
+
value: string;
|
|
127
|
+
}
|
|
128
|
+
/** The model called a write tool; the server persisted a proposal and
|
|
129
|
+
* ships a card-ready payload. Shape mirrors the hub's `onToolUse`
|
|
130
|
+
* return in `lib/data/doc-chat-utils.ts`. */
|
|
131
|
+
export interface ApprovalRequestFrame {
|
|
132
|
+
kind: 'approval_request';
|
|
133
|
+
proposalId: string;
|
|
134
|
+
toolName: string;
|
|
135
|
+
title?: string;
|
|
136
|
+
fields?: ApprovalRequestField[];
|
|
137
|
+
preamble?: string | null;
|
|
138
|
+
args?: Record<string, unknown>;
|
|
139
|
+
expiresAt?: string;
|
|
140
|
+
ttlSeconds?: number;
|
|
141
|
+
}
|
|
142
|
+
/** Server-driven post-approve / post-reject frame (confirm-tool route).
|
|
143
|
+
* Mirror of the hub's `DecisionResolvedFrame` in
|
|
144
|
+
* `lib/data/chat-agent-utils.ts` (tool_name widened to string — the
|
|
145
|
+
* known-write-tool whitelist is host-side knowledge). */
|
|
146
|
+
export interface DecisionResolvedFrame {
|
|
147
|
+
kind: 'decision_resolved';
|
|
148
|
+
/** The proposal this decision resolved — locates the SOURCE approval
|
|
149
|
+
* card so the shell can flip its status + append the receipt. */
|
|
150
|
+
proposalId: string;
|
|
151
|
+
ok: boolean;
|
|
152
|
+
action: 'approved' | 'rejected';
|
|
153
|
+
tool_name?: string;
|
|
154
|
+
result?: {
|
|
155
|
+
ticket_id?: string;
|
|
156
|
+
status?: string | null;
|
|
157
|
+
mirror_synced?: boolean;
|
|
158
|
+
};
|
|
159
|
+
card?: {
|
|
160
|
+
type: string;
|
|
161
|
+
marker: string;
|
|
162
|
+
ref: unknown;
|
|
163
|
+
};
|
|
164
|
+
/** True when the server WILL pipe an auto-continuation turn after
|
|
165
|
+
* this frame. */
|
|
166
|
+
willAutoContinue: boolean;
|
|
167
|
+
/** Pre-rendered receipt copy from the source strategy's
|
|
168
|
+
* `receiptRenderer` — client renders verbatim. */
|
|
169
|
+
receiptText?: string;
|
|
170
|
+
}
|
|
171
|
+
/** Every leading frame the emitter can produce. */
|
|
172
|
+
export type SseLeadingFrame = StatusThinkingFrame | ChatMetadataFrame | RoutingFrame | ThinkingDeltaFrame | UsageStartFrame | TextLeadingFrame | ToolErrorFrame | ApprovalRequestFrame | DecisionResolvedFrame;
|
|
173
|
+
/** Card/chip emission counts for admin adoption tooling. */
|
|
174
|
+
export interface UsageTelemetry {
|
|
175
|
+
cards: number;
|
|
176
|
+
chips: number;
|
|
177
|
+
sentences: number;
|
|
178
|
+
answerLen: number;
|
|
179
|
+
}
|
|
180
|
+
/** Trailing usage frame — `\x1F` + JSON, runs to stream end (no
|
|
181
|
+
* terminator). `stage: 'display'` is a legacy alias the decoder treats
|
|
182
|
+
* identically to `'end'`. */
|
|
183
|
+
export interface SseTrailingUsageFrame {
|
|
184
|
+
kind: 'usage';
|
|
185
|
+
stage: 'end' | 'display';
|
|
186
|
+
input_tokens?: number;
|
|
187
|
+
output_tokens?: number;
|
|
188
|
+
cache_read_input_tokens?: number;
|
|
189
|
+
cache_creation_input_tokens?: number;
|
|
190
|
+
hit_rate_pct?: number;
|
|
191
|
+
telemetry?: UsageTelemetry;
|
|
192
|
+
/** Cross-call usage breakdown (Haiku rewriter / classifier /
|
|
193
|
+
* summarizer + routed-answer attribution). */
|
|
194
|
+
breakdown?: {
|
|
195
|
+
haikuRewriter?: {
|
|
196
|
+
input: number;
|
|
197
|
+
output: number;
|
|
198
|
+
};
|
|
199
|
+
haikuClassifier?: {
|
|
200
|
+
input: number;
|
|
201
|
+
output: number;
|
|
202
|
+
};
|
|
203
|
+
haikuSummarizer?: {
|
|
204
|
+
input: number;
|
|
205
|
+
output: number;
|
|
206
|
+
};
|
|
207
|
+
routedAnswer?: RoutedAnswerBreakdown;
|
|
208
|
+
};
|
|
209
|
+
/** Gated deep-debug payload (only present when the request carried
|
|
210
|
+
* the privileged debug secret). */
|
|
211
|
+
debug?: Record<string, unknown>;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=frames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../src/chat-protocol/frames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,OAAO,CAAA;AACpC,0EAA0E;AAC1E,eAAO,MAAM,cAAc,WAAS,CAAA;AACpC,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,WAAS,CAAA;AAOtC;;;gEAGgE;AAChE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAExE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAA;IACf,gBAAgB,EAAE,eAAe,CAAA;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,eAAe,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;CACvB;AAMD;uDACuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,UAAU,CAAA;CACnB;AAED;;;0DAG0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC;2EACuE;IACvE,OAAO,CA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