@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
package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap
ADDED
|
@@ -0,0 +1,944 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > CHARACTERIZATION duplicate/out-of-order: redelivered EXECUTING after EXECUTED in-stream appends a NEW executing segment (no dedup) 1`] = `
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
"event": "onStreamStart",
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"event": "onAgentBusy",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"event": "onSegmentsUpdate",
|
|
13
|
+
"metadata": undefined,
|
|
14
|
+
"segments": [
|
|
15
|
+
{
|
|
16
|
+
"data": {
|
|
17
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
18
|
+
"parameters": {
|
|
19
|
+
"script": "cleanup.sh",
|
|
20
|
+
},
|
|
21
|
+
"toolExecutionRequestId": "exec-1",
|
|
22
|
+
"toolExplanation": undefined,
|
|
23
|
+
"toolFunction": "run_script",
|
|
24
|
+
"toolTitle": "Run cleanup script",
|
|
25
|
+
"type": "EXECUTING_TOOL",
|
|
26
|
+
},
|
|
27
|
+
"type": "tool_execution",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"event": "onSegmentsUpdate",
|
|
33
|
+
"metadata": undefined,
|
|
34
|
+
"segments": [
|
|
35
|
+
{
|
|
36
|
+
"data": {
|
|
37
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
38
|
+
"parameters": {
|
|
39
|
+
"script": "cleanup.sh",
|
|
40
|
+
},
|
|
41
|
+
"result": "Freed 2.3 GB",
|
|
42
|
+
"success": true,
|
|
43
|
+
"toolExecutionRequestId": "exec-1",
|
|
44
|
+
"toolExplanation": undefined,
|
|
45
|
+
"toolFunction": "run_script",
|
|
46
|
+
"toolTitle": "Run cleanup script",
|
|
47
|
+
"type": "EXECUTED_TOOL",
|
|
48
|
+
},
|
|
49
|
+
"type": "tool_execution",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"event": "onAgentBusy",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"event": "onSegmentsUpdate",
|
|
58
|
+
"metadata": undefined,
|
|
59
|
+
"segments": [
|
|
60
|
+
{
|
|
61
|
+
"data": {
|
|
62
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
63
|
+
"parameters": {
|
|
64
|
+
"script": "cleanup.sh",
|
|
65
|
+
},
|
|
66
|
+
"result": "Freed 2.3 GB",
|
|
67
|
+
"success": true,
|
|
68
|
+
"toolExecutionRequestId": "exec-1",
|
|
69
|
+
"toolExplanation": undefined,
|
|
70
|
+
"toolFunction": "run_script",
|
|
71
|
+
"toolTitle": "Run cleanup script",
|
|
72
|
+
"type": "EXECUTED_TOOL",
|
|
73
|
+
},
|
|
74
|
+
"type": "tool_execution",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"data": {
|
|
78
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
79
|
+
"parameters": {
|
|
80
|
+
"script": "cleanup.sh",
|
|
81
|
+
},
|
|
82
|
+
"toolExecutionRequestId": "exec-1",
|
|
83
|
+
"toolExplanation": undefined,
|
|
84
|
+
"toolFunction": "run_script",
|
|
85
|
+
"toolTitle": "Run cleanup script",
|
|
86
|
+
"type": "EXECUTING_TOOL",
|
|
87
|
+
},
|
|
88
|
+
"type": "tool_execution",
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"event": "onStreamEnd",
|
|
94
|
+
},
|
|
95
|
+
]
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > approval request (displayed) → approval result: in-message flip + onApprovalResolved 1`] = `
|
|
99
|
+
[
|
|
100
|
+
{
|
|
101
|
+
"event": "onStreamStart",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"event": "onSegmentsUpdate",
|
|
105
|
+
"metadata": undefined,
|
|
106
|
+
"segments": [
|
|
107
|
+
{
|
|
108
|
+
"data": {
|
|
109
|
+
"approvalType": "CLIENT",
|
|
110
|
+
"command": "systemctl restart nats",
|
|
111
|
+
"explanation": "Restart the broker",
|
|
112
|
+
"requestId": "req-1",
|
|
113
|
+
},
|
|
114
|
+
"onApprove": [Function],
|
|
115
|
+
"onReject": [Function],
|
|
116
|
+
"status": "pending",
|
|
117
|
+
"type": "approval_request",
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"event": "onStreamEnd",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"event": "onAgentBusy",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"approvalType": "CLIENT",
|
|
129
|
+
"event": "onApprovalResolved",
|
|
130
|
+
"requestId": "req-1",
|
|
131
|
+
"resolvedByName": "Jane Admin",
|
|
132
|
+
"status": "approved",
|
|
133
|
+
},
|
|
134
|
+
]
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > approval result WITHOUT onApprovalResolved wired: emits cumulative onSegmentsUpdate instead 1`] = `
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
"event": "onStreamStart",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"event": "onSegmentsUpdate",
|
|
144
|
+
"metadata": undefined,
|
|
145
|
+
"segments": [
|
|
146
|
+
{
|
|
147
|
+
"data": {
|
|
148
|
+
"approvalType": "CLIENT",
|
|
149
|
+
"command": "reboot",
|
|
150
|
+
"explanation": undefined,
|
|
151
|
+
"requestId": "req-1",
|
|
152
|
+
},
|
|
153
|
+
"onApprove": [Function],
|
|
154
|
+
"onReject": [Function],
|
|
155
|
+
"status": "pending",
|
|
156
|
+
"type": "approval_request",
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"event": "onSegmentsUpdate",
|
|
162
|
+
"metadata": undefined,
|
|
163
|
+
"segments": [
|
|
164
|
+
{
|
|
165
|
+
"data": {
|
|
166
|
+
"approvalType": "CLIENT",
|
|
167
|
+
"command": "reboot",
|
|
168
|
+
"explanation": undefined,
|
|
169
|
+
"requestId": "req-1",
|
|
170
|
+
},
|
|
171
|
+
"onApprove": [Function],
|
|
172
|
+
"onReject": [Function],
|
|
173
|
+
"status": "rejected",
|
|
174
|
+
"type": "approval_request",
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
]
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > batch approval (batchApprovalsEnabled default ON): one batch segment, executions merge into it 1`] = `
|
|
182
|
+
[
|
|
183
|
+
{
|
|
184
|
+
"event": "onStreamStart",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"event": "onSegmentsUpdate",
|
|
188
|
+
"metadata": undefined,
|
|
189
|
+
"segments": [
|
|
190
|
+
{
|
|
191
|
+
"data": {
|
|
192
|
+
"approvalRequestId": "batch-1",
|
|
193
|
+
"approvalType": "CLIENT",
|
|
194
|
+
"toolCalls": [
|
|
195
|
+
{
|
|
196
|
+
"approvalType": "CLIENT",
|
|
197
|
+
"requiresApproval": true,
|
|
198
|
+
"toolCallArguments": {
|
|
199
|
+
"subject": "Printer down",
|
|
200
|
+
},
|
|
201
|
+
"toolExecutionRequestId": "exec-a",
|
|
202
|
+
"toolExplanation": undefined,
|
|
203
|
+
"toolName": "create_ticket",
|
|
204
|
+
"toolTitle": "Create ticket",
|
|
205
|
+
"toolType": undefined,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"approvalType": null,
|
|
209
|
+
"requiresApproval": false,
|
|
210
|
+
"toolCallArguments": null,
|
|
211
|
+
"toolExecutionRequestId": "exec-b",
|
|
212
|
+
"toolExplanation": undefined,
|
|
213
|
+
"toolName": "read_kb",
|
|
214
|
+
"toolTitle": undefined,
|
|
215
|
+
"toolType": undefined,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
"onApprove": [Function],
|
|
220
|
+
"onReject": [Function],
|
|
221
|
+
"resolvedByName": undefined,
|
|
222
|
+
"status": "pending",
|
|
223
|
+
"type": "approval_batch",
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"event": "onAgentBusy",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"approvalType": "CLIENT",
|
|
232
|
+
"event": "onApprovalResolved",
|
|
233
|
+
"requestId": "batch-1",
|
|
234
|
+
"resolvedByName": "Alice Client",
|
|
235
|
+
"status": "approved",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"event": "onAgentBusy",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"event": "onSegmentsUpdate",
|
|
242
|
+
"metadata": undefined,
|
|
243
|
+
"segments": [
|
|
244
|
+
{
|
|
245
|
+
"data": {
|
|
246
|
+
"approvalRequestId": "batch-1",
|
|
247
|
+
"approvalType": "CLIENT",
|
|
248
|
+
"executions": {
|
|
249
|
+
"exec-a": {
|
|
250
|
+
"result": undefined,
|
|
251
|
+
"status": "executing",
|
|
252
|
+
"success": undefined,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
"toolCalls": [
|
|
256
|
+
{
|
|
257
|
+
"approvalType": "CLIENT",
|
|
258
|
+
"requiresApproval": true,
|
|
259
|
+
"toolCallArguments": {
|
|
260
|
+
"subject": "Printer down",
|
|
261
|
+
},
|
|
262
|
+
"toolExecutionRequestId": "exec-a",
|
|
263
|
+
"toolExplanation": undefined,
|
|
264
|
+
"toolName": "create_ticket",
|
|
265
|
+
"toolTitle": "Create ticket",
|
|
266
|
+
"toolType": undefined,
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"approvalType": null,
|
|
270
|
+
"requiresApproval": false,
|
|
271
|
+
"toolCallArguments": null,
|
|
272
|
+
"toolExecutionRequestId": "exec-b",
|
|
273
|
+
"toolExplanation": undefined,
|
|
274
|
+
"toolName": "read_kb",
|
|
275
|
+
"toolTitle": undefined,
|
|
276
|
+
"toolType": undefined,
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
"onApprove": [Function],
|
|
281
|
+
"onReject": [Function],
|
|
282
|
+
"resolvedByName": "Alice Client",
|
|
283
|
+
"status": "approved",
|
|
284
|
+
"type": "approval_batch",
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"event": "onSegmentsUpdate",
|
|
290
|
+
"metadata": undefined,
|
|
291
|
+
"segments": [
|
|
292
|
+
{
|
|
293
|
+
"data": {
|
|
294
|
+
"approvalRequestId": "batch-1",
|
|
295
|
+
"approvalType": "CLIENT",
|
|
296
|
+
"executions": {
|
|
297
|
+
"exec-a": {
|
|
298
|
+
"result": "Ticket #77 created",
|
|
299
|
+
"status": "done",
|
|
300
|
+
"success": true,
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
"toolCalls": [
|
|
304
|
+
{
|
|
305
|
+
"approvalType": "CLIENT",
|
|
306
|
+
"requiresApproval": true,
|
|
307
|
+
"toolCallArguments": {
|
|
308
|
+
"subject": "Printer down",
|
|
309
|
+
},
|
|
310
|
+
"toolExecutionRequestId": "exec-a",
|
|
311
|
+
"toolExplanation": undefined,
|
|
312
|
+
"toolName": "create_ticket",
|
|
313
|
+
"toolTitle": "Create ticket",
|
|
314
|
+
"toolType": undefined,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"approvalType": null,
|
|
318
|
+
"requiresApproval": false,
|
|
319
|
+
"toolCallArguments": null,
|
|
320
|
+
"toolExecutionRequestId": "exec-b",
|
|
321
|
+
"toolExplanation": undefined,
|
|
322
|
+
"toolName": "read_kb",
|
|
323
|
+
"toolTitle": undefined,
|
|
324
|
+
"toolType": undefined,
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
},
|
|
328
|
+
"onApprove": [Function],
|
|
329
|
+
"onReject": [Function],
|
|
330
|
+
"resolvedByName": "Alice Client",
|
|
331
|
+
"status": "approved",
|
|
332
|
+
"type": "approval_batch",
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"event": "onStreamEnd",
|
|
338
|
+
},
|
|
339
|
+
]
|
|
340
|
+
`;
|
|
341
|
+
|
|
342
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > batch approval with batchApprovalsEnabled:false unfolds into legacy cards (requiresApproval only) 1`] = `
|
|
343
|
+
[
|
|
344
|
+
{
|
|
345
|
+
"event": "onStreamStart",
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"event": "onSegmentsUpdate",
|
|
349
|
+
"metadata": undefined,
|
|
350
|
+
"segments": [
|
|
351
|
+
{
|
|
352
|
+
"data": {
|
|
353
|
+
"approvalType": "CLIENT",
|
|
354
|
+
"command": "Create ticket",
|
|
355
|
+
"explanation": undefined,
|
|
356
|
+
"requestId": "batch-1",
|
|
357
|
+
},
|
|
358
|
+
"onApprove": [Function],
|
|
359
|
+
"onReject": [Function],
|
|
360
|
+
"status": "pending",
|
|
361
|
+
"type": "approval_request",
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"event": "onStreamEnd",
|
|
367
|
+
},
|
|
368
|
+
]
|
|
369
|
+
`;
|
|
370
|
+
|
|
371
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > cold start (no MESSAGE_START ever): text emits CUMULATIVE segments (no append flag) 1`] = `
|
|
372
|
+
[
|
|
373
|
+
{
|
|
374
|
+
"event": "onSegmentsUpdate",
|
|
375
|
+
"metadata": undefined,
|
|
376
|
+
"segments": [
|
|
377
|
+
{
|
|
378
|
+
"text": "cold ",
|
|
379
|
+
"type": "text",
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"event": "onSegmentsUpdate",
|
|
385
|
+
"metadata": undefined,
|
|
386
|
+
"segments": [
|
|
387
|
+
{
|
|
388
|
+
"text": "cold start",
|
|
389
|
+
"type": "text",
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
},
|
|
393
|
+
]
|
|
394
|
+
`;
|
|
395
|
+
|
|
396
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > context compaction outside a stream emits append+isCompacting metadata; inside a stream it is cumulative 1`] = `
|
|
397
|
+
{
|
|
398
|
+
"inStream": [
|
|
399
|
+
{
|
|
400
|
+
"event": "onStreamStart",
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"event": "onSegmentsUpdate",
|
|
404
|
+
"metadata": undefined,
|
|
405
|
+
"segments": [
|
|
406
|
+
{
|
|
407
|
+
"status": "started",
|
|
408
|
+
"type": "context_compaction",
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"event": "onSegmentsUpdate",
|
|
414
|
+
"metadata": undefined,
|
|
415
|
+
"segments": [
|
|
416
|
+
{
|
|
417
|
+
"status": "completed",
|
|
418
|
+
"summary": "Mid-stream summary",
|
|
419
|
+
"type": "context_compaction",
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"event": "onStreamEnd",
|
|
425
|
+
},
|
|
426
|
+
],
|
|
427
|
+
"standalone": [
|
|
428
|
+
{
|
|
429
|
+
"event": "onSegmentsUpdate",
|
|
430
|
+
"metadata": {
|
|
431
|
+
"append": true,
|
|
432
|
+
"isCompacting": true,
|
|
433
|
+
},
|
|
434
|
+
"segments": [
|
|
435
|
+
{
|
|
436
|
+
"status": "started",
|
|
437
|
+
"type": "context_compaction",
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"event": "onSegmentsUpdate",
|
|
443
|
+
"metadata": {
|
|
444
|
+
"append": true,
|
|
445
|
+
"isCompacting": true,
|
|
446
|
+
},
|
|
447
|
+
"segments": [
|
|
448
|
+
{
|
|
449
|
+
"status": "completed",
|
|
450
|
+
"summary": "Summarized 12 messages",
|
|
451
|
+
"type": "context_compaction",
|
|
452
|
+
},
|
|
453
|
+
],
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
}
|
|
457
|
+
`;
|
|
458
|
+
|
|
459
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > direct-mode barrier: after a DIRECT_MESSAGE, AI chunks are dropped with a one-shot teardown 1`] = `
|
|
460
|
+
[
|
|
461
|
+
{
|
|
462
|
+
"event": "onStreamStart",
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"event": "onSegmentsUpdate",
|
|
466
|
+
"metadata": undefined,
|
|
467
|
+
"segments": [
|
|
468
|
+
{
|
|
469
|
+
"text": "ai text before takeover",
|
|
470
|
+
"type": "text",
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"event": "onDirectMessage",
|
|
476
|
+
"metadata": {
|
|
477
|
+
"displayName": undefined,
|
|
478
|
+
"ownerType": "ADMIN",
|
|
479
|
+
"streamSeq": undefined,
|
|
480
|
+
"userId": undefined,
|
|
481
|
+
},
|
|
482
|
+
"text": "Human takeover",
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"event": "onStreamEnd",
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"event": "onSystemMessage",
|
|
489
|
+
"metadata": {
|
|
490
|
+
"streamSeq": undefined,
|
|
491
|
+
},
|
|
492
|
+
"text": "still visible",
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"event": "onDirectMessage",
|
|
496
|
+
"metadata": {
|
|
497
|
+
"displayName": undefined,
|
|
498
|
+
"ownerType": undefined,
|
|
499
|
+
"streamSeq": undefined,
|
|
500
|
+
"userId": undefined,
|
|
501
|
+
},
|
|
502
|
+
"text": "second human message",
|
|
503
|
+
},
|
|
504
|
+
]
|
|
505
|
+
`;
|
|
506
|
+
|
|
507
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > error chunk: segment append + onError with JSON-extracted message 1`] = `
|
|
508
|
+
[
|
|
509
|
+
{
|
|
510
|
+
"event": "onStreamStart",
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"event": "onSegmentsUpdate",
|
|
514
|
+
"metadata": undefined,
|
|
515
|
+
"segments": [
|
|
516
|
+
{
|
|
517
|
+
"text": "partial",
|
|
518
|
+
"type": "text",
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"event": "onSegmentsUpdate",
|
|
524
|
+
"metadata": undefined,
|
|
525
|
+
"segments": [
|
|
526
|
+
{
|
|
527
|
+
"text": "partial",
|
|
528
|
+
"type": "text",
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"details": "boom",
|
|
532
|
+
"title": "Agent crashed",
|
|
533
|
+
"type": "error",
|
|
534
|
+
},
|
|
535
|
+
],
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"details": "boom",
|
|
539
|
+
"error": "Agent crashed",
|
|
540
|
+
"event": "onError",
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"event": "onSegmentsUpdate",
|
|
544
|
+
"metadata": undefined,
|
|
545
|
+
"segments": [
|
|
546
|
+
{
|
|
547
|
+
"text": "partial",
|
|
548
|
+
"type": "text",
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
"details": "boom",
|
|
552
|
+
"title": "Agent crashed",
|
|
553
|
+
"type": "error",
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"details": "not-json",
|
|
557
|
+
"title": "Plain details",
|
|
558
|
+
"type": "error",
|
|
559
|
+
},
|
|
560
|
+
],
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"details": "not-json",
|
|
564
|
+
"error": "Plain details",
|
|
565
|
+
"event": "onError",
|
|
566
|
+
},
|
|
567
|
+
]
|
|
568
|
+
`;
|
|
569
|
+
|
|
570
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > escalated approval (type not displayed) → onEscalatedApproval, then result appends resolved card 1`] = `
|
|
571
|
+
{
|
|
572
|
+
"log": [
|
|
573
|
+
{
|
|
574
|
+
"event": "onStreamStart",
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"data": {
|
|
578
|
+
"approvalType": "ADMIN",
|
|
579
|
+
"command": "drop database prod",
|
|
580
|
+
"explanation": undefined,
|
|
581
|
+
},
|
|
582
|
+
"event": "onEscalatedApproval",
|
|
583
|
+
"requestId": "req-adm",
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"event": "onStreamEnd",
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
"event": "onAgentBusy",
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"approved": true,
|
|
593
|
+
"data": {
|
|
594
|
+
"approvalType": "ADMIN",
|
|
595
|
+
"command": "drop database prod",
|
|
596
|
+
"explanation": undefined,
|
|
597
|
+
},
|
|
598
|
+
"event": "onEscalatedApprovalResult",
|
|
599
|
+
"requestId": "req-adm",
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"event": "onSegmentsUpdate",
|
|
603
|
+
"metadata": {
|
|
604
|
+
"append": true,
|
|
605
|
+
},
|
|
606
|
+
"segments": [
|
|
607
|
+
{
|
|
608
|
+
"data": {
|
|
609
|
+
"approvalType": "ADMIN",
|
|
610
|
+
"command": "drop database prod",
|
|
611
|
+
"explanation": undefined,
|
|
612
|
+
"requestId": "req-adm",
|
|
613
|
+
},
|
|
614
|
+
"onApprove": [Function],
|
|
615
|
+
"onReject": [Function],
|
|
616
|
+
"status": "approved",
|
|
617
|
+
"type": "approval_request",
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"approvalType": "ADMIN",
|
|
623
|
+
"event": "onApprovalResolved",
|
|
624
|
+
"requestId": "req-adm",
|
|
625
|
+
"resolvedByName": undefined,
|
|
626
|
+
"status": "approved",
|
|
627
|
+
},
|
|
628
|
+
],
|
|
629
|
+
"pendingAfter": [],
|
|
630
|
+
}
|
|
631
|
+
`;
|
|
632
|
+
|
|
633
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > initialState resume: continuation chunks after resume take the post-stream append path 1`] = `
|
|
634
|
+
[
|
|
635
|
+
{
|
|
636
|
+
"data": {
|
|
637
|
+
"approvalType": "ADMIN",
|
|
638
|
+
"command": "escalated cmd",
|
|
639
|
+
},
|
|
640
|
+
"event": "onEscalatedApproval",
|
|
641
|
+
"requestId": "req-esc",
|
|
642
|
+
},
|
|
643
|
+
]
|
|
644
|
+
`;
|
|
645
|
+
|
|
646
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > normal turn: start → metadata → text ×3 → token usage → end 1`] = `
|
|
647
|
+
[
|
|
648
|
+
{
|
|
649
|
+
"event": "onStreamStart",
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"event": "onMetadata",
|
|
653
|
+
"metadata": {
|
|
654
|
+
"action": "metadata",
|
|
655
|
+
"contextWindow": 200000,
|
|
656
|
+
"modelDisplayName": "Claude Sonnet",
|
|
657
|
+
"modelName": "claude-sonnet-x",
|
|
658
|
+
"providerName": "anthropic",
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"event": "onSegmentsUpdate",
|
|
663
|
+
"metadata": undefined,
|
|
664
|
+
"segments": [
|
|
665
|
+
{
|
|
666
|
+
"text": "Hello",
|
|
667
|
+
"type": "text",
|
|
668
|
+
},
|
|
669
|
+
],
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
"event": "onSegmentsUpdate",
|
|
673
|
+
"metadata": undefined,
|
|
674
|
+
"segments": [
|
|
675
|
+
{
|
|
676
|
+
"text": "Hello, ",
|
|
677
|
+
"type": "text",
|
|
678
|
+
},
|
|
679
|
+
],
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
"event": "onSegmentsUpdate",
|
|
683
|
+
"metadata": undefined,
|
|
684
|
+
"segments": [
|
|
685
|
+
{
|
|
686
|
+
"text": "Hello, world",
|
|
687
|
+
"type": "text",
|
|
688
|
+
},
|
|
689
|
+
],
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"data": {
|
|
693
|
+
"contextSize": 180000,
|
|
694
|
+
"inputTokensSize": 100,
|
|
695
|
+
"outputTokensSize": 20,
|
|
696
|
+
"totalTokensSize": 120,
|
|
697
|
+
},
|
|
698
|
+
"event": "onTokenUsage",
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"event": "onStreamEnd",
|
|
702
|
+
},
|
|
703
|
+
]
|
|
704
|
+
`;
|
|
705
|
+
|
|
706
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > post-MESSAGE_END continuation: text/thinking emit DELTA segments with append:true 1`] = `
|
|
707
|
+
[
|
|
708
|
+
{
|
|
709
|
+
"event": "onStreamStart",
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"event": "onSegmentsUpdate",
|
|
713
|
+
"metadata": undefined,
|
|
714
|
+
"segments": [
|
|
715
|
+
{
|
|
716
|
+
"text": "in-stream",
|
|
717
|
+
"type": "text",
|
|
718
|
+
},
|
|
719
|
+
],
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"event": "onStreamEnd",
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"event": "onSegmentsUpdate",
|
|
726
|
+
"metadata": {
|
|
727
|
+
"append": true,
|
|
728
|
+
},
|
|
729
|
+
"segments": [
|
|
730
|
+
{
|
|
731
|
+
"text": "post-end text",
|
|
732
|
+
"type": "text",
|
|
733
|
+
},
|
|
734
|
+
],
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"event": "onSegmentsUpdate",
|
|
738
|
+
"metadata": {
|
|
739
|
+
"append": true,
|
|
740
|
+
},
|
|
741
|
+
"segments": [
|
|
742
|
+
{
|
|
743
|
+
"text": "post-end thinking",
|
|
744
|
+
"type": "thinking",
|
|
745
|
+
},
|
|
746
|
+
],
|
|
747
|
+
},
|
|
748
|
+
]
|
|
749
|
+
`;
|
|
750
|
+
|
|
751
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > reset() clears accumulator + stream flags so the next dialog cold-starts cumulative 1`] = `
|
|
752
|
+
[
|
|
753
|
+
{
|
|
754
|
+
"event": "onSegmentsUpdate",
|
|
755
|
+
"metadata": undefined,
|
|
756
|
+
"segments": [
|
|
757
|
+
{
|
|
758
|
+
"text": "dialog two cold start",
|
|
759
|
+
"type": "text",
|
|
760
|
+
},
|
|
761
|
+
],
|
|
762
|
+
},
|
|
763
|
+
]
|
|
764
|
+
`;
|
|
765
|
+
|
|
766
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > streamSeq on content chunks is threaded into onSegmentsUpdate metadata 1`] = `
|
|
767
|
+
[
|
|
768
|
+
{
|
|
769
|
+
"event": "onStreamStart",
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
"event": "onSegmentsUpdate",
|
|
773
|
+
"metadata": {
|
|
774
|
+
"streamSeq": 7,
|
|
775
|
+
},
|
|
776
|
+
"segments": [
|
|
777
|
+
{
|
|
778
|
+
"text": "seq-stamped",
|
|
779
|
+
"type": "text",
|
|
780
|
+
},
|
|
781
|
+
],
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"event": "onStreamEnd",
|
|
785
|
+
},
|
|
786
|
+
]
|
|
787
|
+
`;
|
|
788
|
+
|
|
789
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > tool execution IN-stream: accumulator-driven segment updates, onToolExecuted NOT fired 1`] = `
|
|
790
|
+
[
|
|
791
|
+
{
|
|
792
|
+
"event": "onStreamStart",
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"event": "onSegmentsUpdate",
|
|
796
|
+
"metadata": undefined,
|
|
797
|
+
"segments": [
|
|
798
|
+
{
|
|
799
|
+
"text": "Running now. ",
|
|
800
|
+
"type": "text",
|
|
801
|
+
},
|
|
802
|
+
],
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
"event": "onAgentBusy",
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"event": "onSegmentsUpdate",
|
|
809
|
+
"metadata": undefined,
|
|
810
|
+
"segments": [
|
|
811
|
+
{
|
|
812
|
+
"text": "Running now. ",
|
|
813
|
+
"type": "text",
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
"data": {
|
|
817
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
818
|
+
"parameters": {
|
|
819
|
+
"script": "cleanup.sh",
|
|
820
|
+
},
|
|
821
|
+
"toolExecutionRequestId": "exec-1",
|
|
822
|
+
"toolExplanation": undefined,
|
|
823
|
+
"toolFunction": "run_script",
|
|
824
|
+
"toolTitle": "Run cleanup script",
|
|
825
|
+
"type": "EXECUTING_TOOL",
|
|
826
|
+
},
|
|
827
|
+
"type": "tool_execution",
|
|
828
|
+
},
|
|
829
|
+
],
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"event": "onSegmentsUpdate",
|
|
833
|
+
"metadata": undefined,
|
|
834
|
+
"segments": [
|
|
835
|
+
{
|
|
836
|
+
"text": "Running now. ",
|
|
837
|
+
"type": "text",
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"data": {
|
|
841
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
842
|
+
"parameters": {
|
|
843
|
+
"script": "cleanup.sh",
|
|
844
|
+
},
|
|
845
|
+
"result": "Freed 2.3 GB",
|
|
846
|
+
"success": true,
|
|
847
|
+
"toolExecutionRequestId": "exec-1",
|
|
848
|
+
"toolExplanation": undefined,
|
|
849
|
+
"toolFunction": "run_script",
|
|
850
|
+
"toolTitle": "Run cleanup script",
|
|
851
|
+
"type": "EXECUTED_TOOL",
|
|
852
|
+
},
|
|
853
|
+
"type": "tool_execution",
|
|
854
|
+
},
|
|
855
|
+
],
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"event": "onStreamEnd",
|
|
859
|
+
},
|
|
860
|
+
]
|
|
861
|
+
`;
|
|
862
|
+
|
|
863
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > tool execution OUTSIDE a message window: onAgentBusy + cross-message onToolExecuted (accumulator skipped) 1`] = `
|
|
864
|
+
[
|
|
865
|
+
{
|
|
866
|
+
"event": "onAgentBusy",
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"event": "onToolExecuted",
|
|
870
|
+
"segment": {
|
|
871
|
+
"data": {
|
|
872
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
873
|
+
"parameters": {
|
|
874
|
+
"script": "cleanup.sh",
|
|
875
|
+
},
|
|
876
|
+
"toolExecutionRequestId": "exec-1",
|
|
877
|
+
"toolExplanation": undefined,
|
|
878
|
+
"toolFunction": "run_script",
|
|
879
|
+
"toolTitle": "Run cleanup script",
|
|
880
|
+
"type": "EXECUTING_TOOL",
|
|
881
|
+
},
|
|
882
|
+
"type": "tool_execution",
|
|
883
|
+
},
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"event": "onToolExecuted",
|
|
887
|
+
"segment": {
|
|
888
|
+
"data": {
|
|
889
|
+
"integratedToolType": "TACTICAL_RMM",
|
|
890
|
+
"parameters": undefined,
|
|
891
|
+
"result": "Freed 2.3 GB",
|
|
892
|
+
"success": true,
|
|
893
|
+
"toolExecutionRequestId": "exec-1",
|
|
894
|
+
"toolFunction": "run_script",
|
|
895
|
+
"toolTitle": undefined,
|
|
896
|
+
"type": "EXECUTED_TOOL",
|
|
897
|
+
},
|
|
898
|
+
"type": "tool_execution",
|
|
899
|
+
},
|
|
900
|
+
},
|
|
901
|
+
]
|
|
902
|
+
`;
|
|
903
|
+
|
|
904
|
+
exports[`chat stream reducer — legacy chunk-processor golden event logs > user echo / system / direct-message / dialog-closed routing 1`] = `
|
|
905
|
+
[
|
|
906
|
+
{
|
|
907
|
+
"event": "onUserMessage",
|
|
908
|
+
"metadata": {
|
|
909
|
+
"contextItems": [
|
|
910
|
+
{
|
|
911
|
+
"id": "dev-1",
|
|
912
|
+
"label": "dev-1",
|
|
913
|
+
"type": "device",
|
|
914
|
+
},
|
|
915
|
+
],
|
|
916
|
+
"displayName": "Alice",
|
|
917
|
+
"ownerType": "CLIENT",
|
|
918
|
+
"streamSeq": 3,
|
|
919
|
+
"userId": "user-42",
|
|
920
|
+
},
|
|
921
|
+
"text": "open a ticket",
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"event": "onSystemMessage",
|
|
925
|
+
"metadata": {
|
|
926
|
+
"streamSeq": 4,
|
|
927
|
+
},
|
|
928
|
+
"text": "User joined the chat",
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"event": "onDirectMessage",
|
|
932
|
+
"metadata": {
|
|
933
|
+
"displayName": "Jane Admin",
|
|
934
|
+
"ownerType": "ADMIN",
|
|
935
|
+
"streamSeq": 5,
|
|
936
|
+
"userId": "admin-7",
|
|
937
|
+
},
|
|
938
|
+
"text": "Human here now",
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
"event": "onDialogClosed",
|
|
942
|
+
},
|
|
943
|
+
]
|
|
944
|
+
`;
|