@rudderhq/server 0.2.5-canary.8 → 0.2.5
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/bootstrap/plugin-host-runtime.d.ts +39 -39
- package/dist/bundled-plugins/plugin-linear/dist/worker.js +101 -147
- package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +2 -2
- package/dist/bundled-plugins/plugin-linear/package.json +1 -1
- package/dist/routes/access-onboarding.helpers.d.ts +142 -0
- package/dist/routes/access-onboarding.helpers.d.ts.map +1 -0
- package/dist/routes/access-onboarding.helpers.js +762 -0
- package/dist/routes/access-onboarding.helpers.js.map +1 -0
- package/dist/routes/access.d.ts +2 -48
- package/dist/routes/access.d.ts.map +1 -1
- package/dist/routes/access.helpers.d.ts +109 -0
- package/dist/routes/access.helpers.d.ts.map +1 -0
- package/dist/routes/access.helpers.js +460 -0
- package/dist/routes/access.helpers.js.map +1 -0
- package/dist/routes/access.js +6 -1218
- package/dist/routes/access.js.map +1 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +55 -1057
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/agents.management-routes.d.ts +12 -0
- package/dist/routes/agents.management-routes.d.ts.map +1 -0
- package/dist/routes/agents.management-routes.js +1067 -0
- package/dist/routes/agents.management-routes.js.map +1 -0
- package/dist/routes/chats.d.ts.map +1 -1
- package/dist/routes/chats.js +42 -652
- package/dist/routes/chats.js.map +1 -1
- package/dist/routes/chats.stream-routes.d.ts +12 -0
- package/dist/routes/chats.stream-routes.d.ts.map +1 -0
- package/dist/routes/chats.stream-routes.js +666 -0
- package/dist/routes/chats.stream-routes.js.map +1 -0
- package/dist/routes/issues.comments-attachments.d.ts +12 -0
- package/dist/routes/issues.comments-attachments.d.ts.map +1 -0
- package/dist/routes/issues.comments-attachments.js +511 -0
- package/dist/routes/issues.comments-attachments.js.map +1 -0
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +43 -1128
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/issues.mutations.d.ts +12 -0
- package/dist/routes/issues.mutations.d.ts.map +1 -0
- package/dist/routes/issues.mutations.js +635 -0
- package/dist/routes/issues.mutations.js.map +1 -0
- package/dist/routes/plugins.d.ts.map +1 -1
- package/dist/routes/plugins.js +14 -694
- package/dist/routes/plugins.js.map +1 -1
- package/dist/routes/plugins.operations-routes.d.ts +28 -0
- package/dist/routes/plugins.operations-routes.d.ts.map +1 -0
- package/dist/routes/plugins.operations-routes.js +720 -0
- package/dist/routes/plugins.operations-routes.js.map +1 -0
- package/dist/services/access.d.ts +21 -21
- package/dist/services/activity.d.ts +19 -19
- package/dist/services/agents.d.ts +158 -158
- package/dist/services/approvals.d.ts +29 -29
- package/dist/services/assets.d.ts +8 -8
- package/dist/services/automations.d.ts +41 -27
- package/dist/services/automations.d.ts.map +1 -1
- package/dist/services/automations.js +287 -110
- package/dist/services/automations.js.map +1 -1
- package/dist/services/automations.scheduler.d.ts +9 -0
- package/dist/services/automations.scheduler.d.ts.map +1 -0
- package/dist/services/automations.scheduler.js +101 -0
- package/dist/services/automations.scheduler.js.map +1 -0
- package/dist/services/board-auth.d.ts +32 -32
- package/dist/services/calendar.d.ts +26 -26
- package/dist/services/chat-assistant.d.ts +3 -47
- package/dist/services/chat-assistant.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.d.ts +156 -0
- package/dist/services/chat-assistant.helpers.d.ts.map +1 -0
- package/dist/services/chat-assistant.helpers.js +862 -0
- package/dist/services/chat-assistant.helpers.js.map +1 -0
- package/dist/services/chat-assistant.js +2 -861
- package/dist/services/chat-assistant.js.map +1 -1
- package/dist/services/chats.d.ts +149 -247
- package/dist/services/chats.d.ts.map +1 -1
- package/dist/services/chats.helpers.d.ts +117 -0
- package/dist/services/chats.helpers.d.ts.map +1 -0
- package/dist/services/chats.helpers.js +285 -0
- package/dist/services/chats.helpers.js.map +1 -0
- package/dist/services/chats.js +6 -286
- package/dist/services/chats.js.map +1 -1
- package/dist/services/costs.d.ts +8 -8
- package/dist/services/finance.d.ts +18 -18
- package/dist/services/goals.d.ts +30 -30
- package/dist/services/heartbeat.d.ts +3 -1
- package/dist/services/heartbeat.d.ts.map +1 -1
- package/dist/services/heartbeat.js +3 -1
- package/dist/services/heartbeat.js.map +1 -1
- package/dist/services/issue-approvals.d.ts +4 -4
- package/dist/services/issue-review-wakeup.d.ts +3 -3
- package/dist/services/issues.comments-attachments.d.ts +141 -0
- package/dist/services/issues.comments-attachments.d.ts.map +1 -0
- package/dist/services/issues.comments-attachments.js +313 -0
- package/dist/services/issues.comments-attachments.js.map +1 -0
- package/dist/services/issues.d.ts +205 -256
- package/dist/services/issues.d.ts.map +1 -1
- package/dist/services/issues.helpers.d.ts +87 -0
- package/dist/services/issues.helpers.d.ts.map +1 -0
- package/dist/services/issues.helpers.js +270 -0
- package/dist/services/issues.helpers.js.map +1 -0
- package/dist/services/issues.js +5 -569
- package/dist/services/issues.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.core.d.ts +210 -0
- package/dist/services/knowledge-portability/organization-portability.core.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.core.js +997 -0
- package/dist/services/knowledge-portability/organization-portability.core.js.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.d.ts +6 -28
- package/dist/services/knowledge-portability/organization-portability.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.export.d.ts +24 -0
- package/dist/services/knowledge-portability/organization-portability.export.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.export.js +607 -0
- package/dist/services/knowledge-portability/organization-portability.export.js.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.files.d.ts +69 -0
- package/dist/services/knowledge-portability/organization-portability.files.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.files.js +597 -0
- package/dist/services/knowledge-portability/organization-portability.files.js.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.import.d.ts +31 -0
- package/dist/services/knowledge-portability/organization-portability.import.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.import.js +575 -0
- package/dist/services/knowledge-portability/organization-portability.import.js.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.js +37 -3848
- package/dist/services/knowledge-portability/organization-portability.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.package.d.ts +72 -0
- package/dist/services/knowledge-portability/organization-portability.package.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.package.js +749 -0
- package/dist/services/knowledge-portability/organization-portability.package.js.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.preview.d.ts +18 -0
- package/dist/services/knowledge-portability/organization-portability.preview.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.preview.js +333 -0
- package/dist/services/knowledge-portability/organization-portability.preview.js.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.resolve-source.d.ts +4 -0
- package/dist/services/knowledge-portability/organization-portability.resolve-source.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-portability.resolve-source.js +86 -0
- package/dist/services/knowledge-portability/organization-portability.resolve-source.js.map +1 -0
- package/dist/services/knowledge-portability/organization-skills.catalog.d.ts +221 -0
- package/dist/services/knowledge-portability/organization-skills.catalog.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-skills.catalog.js +999 -0
- package/dist/services/knowledge-portability/organization-skills.catalog.js.map +1 -0
- package/dist/services/knowledge-portability/organization-skills.d.ts +4 -75
- package/dist/services/knowledge-portability/organization-skills.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.js +11 -2008
- package/dist/services/knowledge-portability/organization-skills.js.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.scans.d.ts +16 -0
- package/dist/services/knowledge-portability/organization-skills.scans.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-skills.scans.js +300 -0
- package/dist/services/knowledge-portability/organization-skills.scans.js.map +1 -0
- package/dist/services/knowledge-portability/organization-skills.sources.d.ts +68 -0
- package/dist/services/knowledge-portability/organization-skills.sources.d.ts.map +1 -0
- package/dist/services/knowledge-portability/organization-skills.sources.js +728 -0
- package/dist/services/knowledge-portability/organization-skills.sources.js.map +1 -0
- package/dist/services/messenger.d.ts +2 -2
- package/dist/services/messenger.js +2 -2
- package/dist/services/messenger.js.map +1 -1
- package/dist/services/organization-skills.d.ts +3 -1
- package/dist/services/organization-skills.d.ts.map +1 -1
- package/dist/services/organization-skills.js +3 -1
- package/dist/services/organization-skills.js.map +1 -1
- package/dist/services/orgs.d.ts +9 -9
- package/dist/services/plugin-loader.core.d.ts +14 -0
- package/dist/services/plugin-loader.core.d.ts.map +1 -0
- package/dist/services/plugin-loader.core.js +905 -0
- package/dist/services/plugin-loader.core.js.map +1 -0
- package/dist/services/plugin-loader.d.ts +3 -440
- package/dist/services/plugin-loader.d.ts.map +1 -1
- package/dist/services/plugin-loader.helpers.d.ts +468 -0
- package/dist/services/plugin-loader.helpers.d.ts.map +1 -0
- package/dist/services/plugin-loader.helpers.js +263 -0
- package/dist/services/plugin-loader.helpers.js.map +1 -0
- package/dist/services/plugin-loader.js +3 -1191
- package/dist/services/plugin-loader.js.map +1 -1
- package/dist/services/plugin-loader.worker-paths.d.ts +7 -0
- package/dist/services/plugin-loader.worker-paths.d.ts.map +1 -0
- package/dist/services/plugin-loader.worker-paths.js +85 -0
- package/dist/services/plugin-loader.worker-paths.js.map +1 -0
- package/dist/services/plugin-registry.d.ts +123 -123
- package/dist/services/projects.d.ts +8 -8
- package/dist/services/runtime-kernel/heartbeat.core.d.ts +725 -0
- package/dist/services/runtime-kernel/heartbeat.core.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.core.js +525 -0
- package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.d.ts +38 -259
- package/dist/services/runtime-kernel/heartbeat.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.execute.d.ts +5 -0
- package/dist/services/runtime-kernel/heartbeat.execute.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.execute.js +1052 -0
- package/dist/services/runtime-kernel/heartbeat.execute.js.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.js +50 -4142
- package/dist/services/runtime-kernel/heartbeat.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.misc.d.ts +30 -0
- package/dist/services/runtime-kernel/heartbeat.misc.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.misc.js +483 -0
- package/dist/services/runtime-kernel/heartbeat.misc.js.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.recovery.d.ts +38 -0
- package/dist/services/runtime-kernel/heartbeat.recovery.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.recovery.js +605 -0
- package/dist/services/runtime-kernel/heartbeat.recovery.js.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.release.d.ts +6 -0
- package/dist/services/runtime-kernel/heartbeat.release.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.release.js +398 -0
- package/dist/services/runtime-kernel/heartbeat.release.js.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.sessions.d.ts +229 -0
- package/dist/services/runtime-kernel/heartbeat.sessions.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.sessions.js +708 -0
- package/dist/services/runtime-kernel/heartbeat.sessions.js.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts +5 -0
- package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts.map +1 -0
- package/dist/services/runtime-kernel/heartbeat.wakeup.js +552 -0
- package/dist/services/runtime-kernel/heartbeat.wakeup.js.map +1 -0
- package/dist/services/secrets.d.ts +25 -25
- package/dist/services/sidebar-badges.js +1 -1
- package/dist/services/sidebar-badges.js.map +1 -1
- package/dist/services/workspace-runtime.comments.d.ts +6 -0
- package/dist/services/workspace-runtime.comments.d.ts.map +1 -0
- package/dist/services/workspace-runtime.comments.js +17 -0
- package/dist/services/workspace-runtime.comments.js.map +1 -0
- package/dist/services/workspace-runtime.d.ts +4 -163
- package/dist/services/workspace-runtime.d.ts.map +1 -1
- package/dist/services/workspace-runtime.helpers.d.ts +163 -0
- package/dist/services/workspace-runtime.helpers.d.ts.map +1 -0
- package/dist/services/workspace-runtime.helpers.js +360 -0
- package/dist/services/workspace-runtime.helpers.js.map +1 -0
- package/dist/services/workspace-runtime.js +4 -1236
- package/dist/services/workspace-runtime.js.map +1 -1
- package/dist/services/workspace-runtime.lifecycle.d.ts +35 -0
- package/dist/services/workspace-runtime.lifecycle.d.ts.map +1 -0
- package/dist/services/workspace-runtime.lifecycle.js +266 -0
- package/dist/services/workspace-runtime.lifecycle.js.map +1 -0
- package/dist/services/workspace-runtime.services.d.ts +140 -0
- package/dist/services/workspace-runtime.services.d.ts.map +1 -0
- package/dist/services/workspace-runtime.services.js +606 -0
- package/dist/services/workspace-runtime.services.js.map +1 -0
- package/package.json +21 -15
- package/ui-dist/assets/{_basePickBy-DeCw-kw3.js → _basePickBy-N8I9ml5Y.js} +1 -1
- package/ui-dist/assets/{_baseUniq-CVepsVZm.js → _baseUniq-BuSlpRSQ.js} +1 -1
- package/ui-dist/assets/{arc-QifRrkx2.js → arc-qX-dPyA1.js} +1 -1
- package/ui-dist/assets/{architectureDiagram-2XIMDMQ5-CT4me0hw.js → architectureDiagram-2XIMDMQ5-DhjkbXsp.js} +1 -1
- package/ui-dist/assets/{blockDiagram-WCTKOSBZ-uD6J91MI.js → blockDiagram-WCTKOSBZ-JS-tTu3J.js} +1 -1
- package/ui-dist/assets/{c4Diagram-IC4MRINW-D2GM2pzG.js → c4Diagram-IC4MRINW-4DqwCWIx.js} +1 -1
- package/ui-dist/assets/channel-CccCW5_a.js +1 -0
- package/ui-dist/assets/{chunk-4BX2VUAB-D8pPrlss.js → chunk-4BX2VUAB-T37SqBpp.js} +1 -1
- package/ui-dist/assets/{chunk-55IACEB6-CHF68vwj.js → chunk-55IACEB6-BSj9hdqK.js} +1 -1
- package/ui-dist/assets/{chunk-FMBD7UC4-CKmGUf9X.js → chunk-FMBD7UC4-Dkrlh0Wk.js} +1 -1
- package/ui-dist/assets/{chunk-JSJVCQXG-CTBCV-7X.js → chunk-JSJVCQXG-C0ZE3QdB.js} +1 -1
- package/ui-dist/assets/{chunk-KX2RTZJC-DV5XzGob.js → chunk-KX2RTZJC-DOZQM9gW.js} +1 -1
- package/ui-dist/assets/{chunk-NQ4KR5QH-B7diT0e4.js → chunk-NQ4KR5QH-5Yr3U2k8.js} +1 -1
- package/ui-dist/assets/{chunk-QZHKN3VN-BphcSb1i.js → chunk-QZHKN3VN-CvKTufwF.js} +1 -1
- package/ui-dist/assets/{chunk-WL4C6EOR-Bs_jQBMG.js → chunk-WL4C6EOR-IoEM0jyx.js} +1 -1
- package/ui-dist/assets/classDiagram-VBA2DB6C-JKk4tCW2.js +1 -0
- package/ui-dist/assets/classDiagram-v2-RAHNMMFH-JKk4tCW2.js +1 -0
- package/ui-dist/assets/clone-Onaweg8D.js +1 -0
- package/ui-dist/assets/{cose-bilkent-S5V4N54A-BxfO0pV9.js → cose-bilkent-S5V4N54A-CTvr1OFj.js} +1 -1
- package/ui-dist/assets/{dagre-KLK3FWXG-BiDkAX-Z.js → dagre-KLK3FWXG-UZ-SNjVK.js} +1 -1
- package/ui-dist/assets/{diagram-E7M64L7V-Btz_oxkC.js → diagram-E7M64L7V-D7RAN0Hr.js} +1 -1
- package/ui-dist/assets/{diagram-IFDJBPK2-Cdp8lQxJ.js → diagram-IFDJBPK2-B4LViaFR.js} +1 -1
- package/ui-dist/assets/{diagram-P4PSJMXO-DuTbeAS1.js → diagram-P4PSJMXO-CY1be7ak.js} +1 -1
- package/ui-dist/assets/{erDiagram-INFDFZHY-CzoQlOwo.js → erDiagram-INFDFZHY-Dca0KkvJ.js} +1 -1
- package/ui-dist/assets/{flowDiagram-PKNHOUZH-Diz_MWi3.js → flowDiagram-PKNHOUZH-i-qMvfwg.js} +1 -1
- package/ui-dist/assets/{ganttDiagram-A5KZAMGK-CWeGI1E-.js → ganttDiagram-A5KZAMGK-Wxq2lhbh.js} +1 -1
- package/ui-dist/assets/{gitGraphDiagram-K3NZZRJ6-C3QhZnAN.js → gitGraphDiagram-K3NZZRJ6-DwzgPlAY.js} +1 -1
- package/ui-dist/assets/{graph-KQH4eaLv.js → graph-BAqf89Tz.js} +1 -1
- package/ui-dist/assets/{index-CkEEsJ_9.js → index-4eCzaLuY.js} +1 -1
- package/ui-dist/assets/{index-DCOA92Vt.js → index-8uu-nKqK.js} +1 -1
- package/ui-dist/assets/{index-DtsZnqcf.js → index-B-1NEcI_.js} +1 -1
- package/ui-dist/assets/{index-BvGpil9e.js → index-B0b_3Eu5.js} +1 -1
- package/ui-dist/assets/{index-BMhxh9sB.js → index-B8v0eZjP.js} +1 -1
- package/ui-dist/assets/{index-aKvEm2pJ.js → index-BN7Moj3u.js} +1 -1
- package/ui-dist/assets/{index-iJyjaIGd.js → index-BSpxh3cY.js} +1 -1
- package/ui-dist/assets/{index-DhRKQjzu.js → index-BY44RIi9.js} +1 -1
- package/ui-dist/assets/{index-Z4rTzdcL.js → index-BhyQJhdZ.js} +1 -1
- package/ui-dist/assets/{index-DBxBUiZC.js → index-BkPL_iGU.js} +1 -1
- package/ui-dist/assets/{index-CsSppW5U.js → index-BsPfoHXS.js} +1 -1
- package/ui-dist/assets/{index-B8J1oewY.js → index-BstW7nmv.js} +1 -1
- package/ui-dist/assets/{index-CVZYu_kq.js → index-BwB67Zyz.js} +1 -1
- package/ui-dist/assets/index-C2peSkmT.css +1 -0
- package/ui-dist/assets/{index-Djz3PL1M.js → index-C3ktOsS_.js} +1 -1
- package/ui-dist/assets/{index-BMZfWLwr.js → index-CMyABlS-.js} +1 -1
- package/ui-dist/assets/{index-Cqdw7Lnc.js → index-CyBJ8ujC.js} +1 -1
- package/ui-dist/assets/{index-Ctp_0y5X.js → index-DAxM2W3O.js} +1 -1
- package/ui-dist/assets/{index-_jGthZ-1.js → index-DVZXPmhk.js} +1 -1
- package/ui-dist/assets/{index-CBLnbZVL.js → index-Dc19uAyw.js} +1 -1
- package/ui-dist/assets/index-DzHrwZu1.js +1511 -0
- package/ui-dist/assets/{index-ChTjk1gO.js → index-LJuf53Ye.js} +1 -1
- package/ui-dist/assets/{index-wXEAD8rI.js → index-Ugw5VWWz.js} +1 -1
- package/ui-dist/assets/{index-ciyPUpT9.js → index-YGraEFR7.js} +1 -1
- package/ui-dist/assets/{infoDiagram-LFFYTUFH-DbMzKsuw.js → infoDiagram-LFFYTUFH-jLmDtFVR.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-PHBUUO56-CcKXcf2V.js → ishikawaDiagram-PHBUUO56-6OGMyLT8.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-4ABVD52K-BY2GuHyR.js → journeyDiagram-4ABVD52K-yQjl6E0t.js} +1 -1
- package/ui-dist/assets/{kanban-definition-K7BYSVSG-BlZWM0Uz.js → kanban-definition-K7BYSVSG-DkdCeQlS.js} +1 -1
- package/ui-dist/assets/{layout-qHGAYgRY.js → layout-CqSYvZ_w.js} +1 -1
- package/ui-dist/assets/{linear-BigkGXbh.js → linear-B8xGZaoi.js} +1 -1
- package/ui-dist/assets/{mermaid.core-DZ099nW4.js → mermaid.core-AKL_cdyk.js} +4 -4
- package/ui-dist/assets/{mindmap-definition-YRQLILUH-CElDqDe0.js → mindmap-definition-YRQLILUH-Zr-dXC0x.js} +1 -1
- package/ui-dist/assets/{pieDiagram-SKSYHLDU-I2LDYrgm.js → pieDiagram-SKSYHLDU-BvDAU-Nk.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-337W2JSQ-D-U35edU.js → quadrantDiagram-337W2JSQ-Dn9kM62o.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-Z7DCOOCP-FAWtaOKe.js → requirementDiagram-Z7DCOOCP-GIsIh7Sd.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-WA2Y5GQK-CzFHHNNh.js → sankeyDiagram-WA2Y5GQK-CUCuBkuf.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-2WXFIKYE-Cy-UViPL.js → sequenceDiagram-2WXFIKYE-MDpUY2HM.js} +1 -1
- package/ui-dist/assets/{stateDiagram-RAJIS63D-BEdt3CLl.js → stateDiagram-RAJIS63D-BymMpuUU.js} +1 -1
- package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-Bi2oCU6d.js +1 -0
- package/ui-dist/assets/{timeline-definition-YZTLITO2-YD1e-WHS.js → timeline-definition-YZTLITO2-B6ofPhhy.js} +1 -1
- package/ui-dist/assets/{treemap-KZPCXAKY-BnqlVkAC.js → treemap-KZPCXAKY-DnLO6w1l.js} +1 -1
- package/ui-dist/assets/{vennDiagram-LZ73GAT5-f4WCy3o6.js → vennDiagram-LZ73GAT5-D0MyZIDl.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-JWTSCODW-CWA35znA.js → xychartDiagram-JWTSCODW-rADY1iUG.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/assets/channel-BV7st2TW.js +0 -1
- package/ui-dist/assets/classDiagram-VBA2DB6C-Cw_xj5ie.js +0 -1
- package/ui-dist/assets/classDiagram-v2-RAHNMMFH-Cw_xj5ie.js +0 -1
- package/ui-dist/assets/clone-DGshofUt.js +0 -1
- package/ui-dist/assets/index-Ded0dPwB.css +0 -1
- package/ui-dist/assets/index-Jhxth516.js +0 -1510
- package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-cW7aES_v.js +0 -1
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
import { createWriteStream } from "node:fs";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { pipeline } from "node:stream/promises";
|
|
6
|
+
import { chatAskUserRequestFromStructuredPayload, sanitizeChatStructuredPayload } from "@rudderhq/shared";
|
|
7
|
+
export const CHAT_UNSUPPORTED_ADAPTER_TYPES = new Set(["process", "http"]);
|
|
8
|
+
export const CHAT_RESULT_SENTINEL_PREFIX = "__RUDDER_RESULT_";
|
|
9
|
+
export class ChatAssistantStreamError extends Error {
|
|
10
|
+
partialBody;
|
|
11
|
+
generatedAttachments;
|
|
12
|
+
constructor(message, partialBody, generatedAttachments = []) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "ChatAssistantStreamError";
|
|
15
|
+
this.partialBody = partialBody;
|
|
16
|
+
this.generatedAttachments = generatedAttachments;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function safeTrim(value) {
|
|
20
|
+
const trimmed = value?.trim();
|
|
21
|
+
return trimmed ? trimmed : null;
|
|
22
|
+
}
|
|
23
|
+
export function asString(value) {
|
|
24
|
+
return typeof value === "string" ? value : "";
|
|
25
|
+
}
|
|
26
|
+
export function summarizeBody(value, maxChars = 160) {
|
|
27
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
28
|
+
if (!normalized)
|
|
29
|
+
return "(empty)";
|
|
30
|
+
if (normalized.length <= maxChars)
|
|
31
|
+
return normalized;
|
|
32
|
+
return `${normalized.slice(0, maxChars - 1)}…`;
|
|
33
|
+
}
|
|
34
|
+
export function modelLabel(config) {
|
|
35
|
+
return safeTrim(typeof config?.model === "string" ? config.model : null);
|
|
36
|
+
}
|
|
37
|
+
export function unconfiguredDescriptor(error) {
|
|
38
|
+
return {
|
|
39
|
+
sourceType: "unconfigured",
|
|
40
|
+
sourceLabel: "Choose an agent",
|
|
41
|
+
runtimeAgentId: null,
|
|
42
|
+
agentRuntimeType: null,
|
|
43
|
+
model: null,
|
|
44
|
+
available: false,
|
|
45
|
+
error,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function unavailableAgentDescriptor(input) {
|
|
49
|
+
return {
|
|
50
|
+
sourceType: "agent",
|
|
51
|
+
sourceLabel: input.sourceLabel,
|
|
52
|
+
runtimeAgentId: input.runtimeAgentId,
|
|
53
|
+
agentRuntimeType: input.agentRuntimeType,
|
|
54
|
+
model: input.model,
|
|
55
|
+
available: false,
|
|
56
|
+
error: input.error,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function buildPrompt(input, attachmentReferences = new Map()) {
|
|
60
|
+
const contextSummary = input.contextLinks.map((link) => ({
|
|
61
|
+
entityType: link.entityType,
|
|
62
|
+
entityId: link.entityId,
|
|
63
|
+
label: link.entity?.label ?? null,
|
|
64
|
+
identifier: link.entity?.identifier ?? null,
|
|
65
|
+
status: link.entity?.status ?? null,
|
|
66
|
+
description: link.entity?.description ?? null,
|
|
67
|
+
priority: link.entity?.priority ?? null,
|
|
68
|
+
}));
|
|
69
|
+
const history = input.messages.slice(-12).map((message) => ({
|
|
70
|
+
role: message.role,
|
|
71
|
+
kind: message.kind,
|
|
72
|
+
status: message.status,
|
|
73
|
+
body: message.body,
|
|
74
|
+
attachments: message.attachments.map((attachment) => {
|
|
75
|
+
const reference = attachmentReferences.get(attachment.id);
|
|
76
|
+
return {
|
|
77
|
+
id: attachment.id,
|
|
78
|
+
assetId: attachment.assetId,
|
|
79
|
+
name: attachment.originalFilename ?? attachment.assetId,
|
|
80
|
+
contentType: attachment.contentType,
|
|
81
|
+
byteSize: attachment.byteSize,
|
|
82
|
+
contentPath: attachment.contentPath,
|
|
83
|
+
...(reference?.localPath ? { localPath: reference.localPath } : {}),
|
|
84
|
+
...(reference?.localPathError ? { localPathError: reference.localPathError } : {}),
|
|
85
|
+
};
|
|
86
|
+
}),
|
|
87
|
+
structuredPayload: message.structuredPayload,
|
|
88
|
+
}));
|
|
89
|
+
return JSON.stringify({
|
|
90
|
+
conversation: {
|
|
91
|
+
id: input.conversation.id,
|
|
92
|
+
title: input.conversation.title,
|
|
93
|
+
status: input.conversation.status,
|
|
94
|
+
summary: input.conversation.summary,
|
|
95
|
+
planMode: input.conversation.planMode,
|
|
96
|
+
issueCreationMode: input.conversation.issueCreationMode,
|
|
97
|
+
preferredAgentId: input.conversation.preferredAgentId,
|
|
98
|
+
routedAgentId: input.conversation.routedAgentId,
|
|
99
|
+
primaryIssueId: input.conversation.primaryIssueId,
|
|
100
|
+
},
|
|
101
|
+
contextLinks: contextSummary,
|
|
102
|
+
recentMessages: history,
|
|
103
|
+
}, null, 2);
|
|
104
|
+
}
|
|
105
|
+
export function buildCurrentUserAttachmentPromptSection(messages, attachmentReferences = new Map()) {
|
|
106
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
107
|
+
const message = messages[index];
|
|
108
|
+
if (message.role !== "user" || message.attachments.length === 0)
|
|
109
|
+
continue;
|
|
110
|
+
const lines = [
|
|
111
|
+
"Current user message attachments:",
|
|
112
|
+
`- The latest user message includes ${message.attachments.length} attachment(s). Inspect any listed localPath directly before answering.`,
|
|
113
|
+
`- User message body: ${JSON.stringify(summarizeBody(message.body))}`,
|
|
114
|
+
...message.attachments.map((attachment, attachmentIndex) => {
|
|
115
|
+
const name = attachment.originalFilename ?? attachment.assetId;
|
|
116
|
+
const reference = attachmentReferences.get(attachment.id);
|
|
117
|
+
const parts = [
|
|
118
|
+
`name=${name}`,
|
|
119
|
+
`contentType=${attachment.contentType}`,
|
|
120
|
+
`byteSize=${attachment.byteSize}`,
|
|
121
|
+
`contentPath=${attachment.contentPath}`,
|
|
122
|
+
];
|
|
123
|
+
if (reference?.localPath) {
|
|
124
|
+
parts.push(`localPath=${reference.localPath}`);
|
|
125
|
+
parts.push("runtimeReference=local_image_file");
|
|
126
|
+
}
|
|
127
|
+
else if (reference?.localPathError) {
|
|
128
|
+
parts.push(`localPathError=${reference.localPathError}`);
|
|
129
|
+
}
|
|
130
|
+
return `- [${attachmentIndex + 1}] ${parts.join("; ")}`;
|
|
131
|
+
}),
|
|
132
|
+
];
|
|
133
|
+
return lines.join("\n");
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
export function buildOperatorProfilePromptSection(profile) {
|
|
138
|
+
const nickname = safeTrim(profile?.nickname);
|
|
139
|
+
const moreAboutYou = safeTrim(profile?.moreAboutYou);
|
|
140
|
+
if (!nickname && !moreAboutYou)
|
|
141
|
+
return null;
|
|
142
|
+
return [
|
|
143
|
+
"Current board operator profile:",
|
|
144
|
+
...(nickname ? [`- Preferred form of address: ${nickname}`] : []),
|
|
145
|
+
...(moreAboutYou ? [`- Background about the operator: ${moreAboutYou}`] : []),
|
|
146
|
+
"Use this only as background context when you address the operator or interpret their requests.",
|
|
147
|
+
].join("\n");
|
|
148
|
+
}
|
|
149
|
+
export function buildSelectedProjectPromptSection(contextLinks) {
|
|
150
|
+
const projectLink = contextLinks.find((link) => link.entityType === "project");
|
|
151
|
+
if (!projectLink)
|
|
152
|
+
return null;
|
|
153
|
+
const lines = [
|
|
154
|
+
"Selected project context:",
|
|
155
|
+
`- Project ID: ${projectLink.entityId}`,
|
|
156
|
+
];
|
|
157
|
+
if (projectLink.entity?.label) {
|
|
158
|
+
lines.push(`- Name: ${projectLink.entity.label}`);
|
|
159
|
+
}
|
|
160
|
+
if (projectLink.entity?.status) {
|
|
161
|
+
lines.push(`- Status: ${projectLink.entity.status}`);
|
|
162
|
+
}
|
|
163
|
+
if (projectLink.entity?.subtitle) {
|
|
164
|
+
lines.push(`- Description: ${projectLink.entity.subtitle}`);
|
|
165
|
+
}
|
|
166
|
+
lines.push("Use this as the default project for issue proposals and project-scoped reasoning unless the user explicitly chooses another project.");
|
|
167
|
+
return lines.join("\n");
|
|
168
|
+
}
|
|
169
|
+
export function buildSelectedIssuePromptSection(conversation, contextLinks) {
|
|
170
|
+
const issueLink = contextLinks.find((link) => link.entityType === "issue");
|
|
171
|
+
const primaryIssue = conversation.primaryIssue;
|
|
172
|
+
if (!issueLink && !primaryIssue)
|
|
173
|
+
return null;
|
|
174
|
+
const lines = ["Selected issue context:"];
|
|
175
|
+
if (issueLink) {
|
|
176
|
+
lines.push(`- Issue ID: ${issueLink.entityId}`);
|
|
177
|
+
if (issueLink.entity?.identifier) {
|
|
178
|
+
lines.push(`- Identifier: ${issueLink.entity.identifier}`);
|
|
179
|
+
}
|
|
180
|
+
if (issueLink.entity?.label) {
|
|
181
|
+
lines.push(`- Title: ${issueLink.entity.label}`);
|
|
182
|
+
}
|
|
183
|
+
if (issueLink.entity?.status) {
|
|
184
|
+
lines.push(`- Status: ${issueLink.entity.status}`);
|
|
185
|
+
}
|
|
186
|
+
if (issueLink.entity?.priority) {
|
|
187
|
+
lines.push(`- Priority: ${issueLink.entity.priority}`);
|
|
188
|
+
}
|
|
189
|
+
if (issueLink.entity?.description?.trim()) {
|
|
190
|
+
lines.push(`- Description: ${issueLink.entity.description.trim()}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (primaryIssue) {
|
|
194
|
+
lines.push(`- Issue ID: ${primaryIssue.id}`);
|
|
195
|
+
if (primaryIssue.identifier) {
|
|
196
|
+
lines.push(`- Identifier: ${primaryIssue.identifier}`);
|
|
197
|
+
}
|
|
198
|
+
lines.push(`- Title: ${primaryIssue.title}`);
|
|
199
|
+
lines.push(`- Status: ${primaryIssue.status}`);
|
|
200
|
+
lines.push(`- Priority: ${primaryIssue.priority}`);
|
|
201
|
+
}
|
|
202
|
+
lines.push("Use this as the default issue context for this chat unless the user explicitly switches topics.");
|
|
203
|
+
return lines.join("\n");
|
|
204
|
+
}
|
|
205
|
+
export function buildIssueLabelsPromptSection(labels) {
|
|
206
|
+
if (!labels || labels.length === 0)
|
|
207
|
+
return null;
|
|
208
|
+
const lines = [
|
|
209
|
+
"Organization issue labels:",
|
|
210
|
+
...labels.map((label) => `- ${label.name} (${label.id})`),
|
|
211
|
+
];
|
|
212
|
+
if (labels.length >= 5) {
|
|
213
|
+
lines.push("This organization has a mature label taxonomy. When emitting an issueProposal for agent-created work, include labelIds with at least one best-fit label id from this list.");
|
|
214
|
+
}
|
|
215
|
+
return lines.join("\n");
|
|
216
|
+
}
|
|
217
|
+
export function buildChatSpeakerPromptSection(runtimeSource) {
|
|
218
|
+
const name = runtimeSource.descriptor.sourceLabel;
|
|
219
|
+
if (runtimeSource.descriptor.sourceType === "agent") {
|
|
220
|
+
return [
|
|
221
|
+
`You are ${name}, replying inside Rudder's chat scene.`,
|
|
222
|
+
"Speak as this agent, using the agent's own instructions and enabled skills as your working context.",
|
|
223
|
+
"Do not claim to be a generic assistant or any agent other than the selected chat agent.",
|
|
224
|
+
].join("\n");
|
|
225
|
+
}
|
|
226
|
+
return "A preferred agent must be selected before the chat assistant can reply.";
|
|
227
|
+
}
|
|
228
|
+
export function buildChatResponseQualityPromptSection() {
|
|
229
|
+
return [
|
|
230
|
+
"Before answering, classify the user's request depth:",
|
|
231
|
+
"- Quick factual or status request: answer directly and keep it concise.",
|
|
232
|
+
"- Ambiguous work request: ask one to three blocking clarification questions before proposing work.",
|
|
233
|
+
"- Product, design, architecture, strategy, or workflow judgment: reason from scenarios, actors, needs, non-needs, constraints, failure modes, and corner cases before giving a decision-ready answer.",
|
|
234
|
+
"- Implementation request with local evidence available: inspect the relevant files, docs, or artifacts before giving a confident recommendation.",
|
|
235
|
+
"For non-trivial judgment questions, do not jump from the user's proposed solution to an answer. Reframe the durable job-to-be-done, map the likely scenarios, identify what must be true for the answer to be correct, compare two to three realistic options when useful, and recommend one next move.",
|
|
236
|
+
"Do not claim certainty you do not have. State assumptions, confidence, and remaining unknowns when they matter. Keep the final answer concise and user-visible; do not expose hidden chain-of-thought or unnecessary process.",
|
|
237
|
+
].join("\n");
|
|
238
|
+
}
|
|
239
|
+
export function buildBaseSystemPromptSections(runtimeSource, resultSentinel) {
|
|
240
|
+
return [
|
|
241
|
+
buildChatSpeakerPromptSection(runtimeSource),
|
|
242
|
+
"Your job is to clarify work requests for a Rudder AI organization control plane.",
|
|
243
|
+
"This is the dedicated chat scene. Do not use heartbeat issue bootstrap framing.",
|
|
244
|
+
"Always reply in the same language as the user's most recent substantive message unless they explicitly ask for a different language.",
|
|
245
|
+
"Always prefer clarification before proposing issue creation when requirements are incomplete.",
|
|
246
|
+
"Treat message attachments as part of the user's message. If an image attachment includes localPath metadata, inspect that local file before claiming you cannot see the image.",
|
|
247
|
+
"Do not expose internal attachment retrieval commands or auth-bearing asset fetch instructions to the user.",
|
|
248
|
+
buildChatResponseQualityPromptSection(),
|
|
249
|
+
"Use result kind 'message' for clarification, summaries, and small requests that can stay in chat.",
|
|
250
|
+
"Use result kind 'ask_user' only when one to three short structured questions are blocked on the user's decision before the conversation can continue safely.",
|
|
251
|
+
"For ask_user, each requestUserInput question id must be unique, and option ids must be unique within their question.",
|
|
252
|
+
"Use result kind 'issue_proposal' for larger work that should become an issue.",
|
|
253
|
+
"Reply in two phases.",
|
|
254
|
+
"Phase 1: while you work, write concise progress updates in Markdown with no JSON fences. These are process transcript entries, not the final answer.",
|
|
255
|
+
`Phase 2: on a new line, emit exactly ${resultSentinel} followed immediately by one JSON object. The JSON body is the final user-visible answer.`,
|
|
256
|
+
"Do not output anything after that JSON object.",
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
export function buildPlanModePromptSection() {
|
|
260
|
+
return [
|
|
261
|
+
"Plan mode is active for this conversation.",
|
|
262
|
+
"Stay strictly in read-only investigation and planning mode.",
|
|
263
|
+
"Do not propose or imply file edits, shell mutations, or lightweight control-plane changes.",
|
|
264
|
+
"Converge on an issue-sized implementation plan, and when you are ready to conclude, emit kind 'issue_proposal'.",
|
|
265
|
+
"Include structuredPayload.planDocument.body as markdown for the issue plan document.",
|
|
266
|
+
].join("\n");
|
|
267
|
+
}
|
|
268
|
+
export function buildResponseSchemaPromptSection(planMode) {
|
|
269
|
+
return [
|
|
270
|
+
"JSON shape:",
|
|
271
|
+
JSON.stringify({
|
|
272
|
+
kind: "message",
|
|
273
|
+
body: "final user-visible answer only, not progress updates",
|
|
274
|
+
structuredPayload: {
|
|
275
|
+
summary: "optional short summary",
|
|
276
|
+
issueProposal: {
|
|
277
|
+
title: "required for issue_proposal",
|
|
278
|
+
description: "required for issue_proposal",
|
|
279
|
+
priority: "critical|high|medium|low",
|
|
280
|
+
assigneeAgentId: "optional uuid",
|
|
281
|
+
assigneeUserId: "optional user id",
|
|
282
|
+
reviewerAgentId: "optional uuid",
|
|
283
|
+
reviewerUserId: "optional user id",
|
|
284
|
+
labelIds: ["optional label uuid"],
|
|
285
|
+
projectId: "optional uuid",
|
|
286
|
+
goalId: "optional uuid",
|
|
287
|
+
parentId: "optional uuid",
|
|
288
|
+
},
|
|
289
|
+
planDocument: {
|
|
290
|
+
title: "optional plan title",
|
|
291
|
+
body: planMode
|
|
292
|
+
? "required markdown plan for the issue plan document"
|
|
293
|
+
: "optional markdown plan",
|
|
294
|
+
changeSummary: "optional short summary for the issue document revision",
|
|
295
|
+
},
|
|
296
|
+
routingSuggestion: {
|
|
297
|
+
agentId: "optional uuid",
|
|
298
|
+
reason: "short explanation",
|
|
299
|
+
},
|
|
300
|
+
requestUserInput: {
|
|
301
|
+
questions: [
|
|
302
|
+
{
|
|
303
|
+
id: "stable_question_id",
|
|
304
|
+
header: "optional short header",
|
|
305
|
+
question: "required short question",
|
|
306
|
+
options: [
|
|
307
|
+
{
|
|
308
|
+
id: "stable_option_id",
|
|
309
|
+
label: "required short option label",
|
|
310
|
+
description: "optional short tradeoff",
|
|
311
|
+
recommended: false,
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
allowFreeform: true,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
richReferences: [
|
|
319
|
+
{
|
|
320
|
+
type: "issue",
|
|
321
|
+
issueId: "optional issue uuid",
|
|
322
|
+
identifier: "optional issue identifier such as ZST-153",
|
|
323
|
+
display: "card|inline",
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
type: "issue_comment",
|
|
327
|
+
issueId: "optional issue uuid",
|
|
328
|
+
identifier: "optional issue identifier such as ZST-153",
|
|
329
|
+
commentId: "required comment uuid",
|
|
330
|
+
display: "card|inline",
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
}, null, 2),
|
|
335
|
+
].join("\n");
|
|
336
|
+
}
|
|
337
|
+
export function systemPrompt(runtimeSource, conversation, resultSentinel) {
|
|
338
|
+
return [
|
|
339
|
+
...buildBaseSystemPromptSections(runtimeSource, resultSentinel),
|
|
340
|
+
...(conversation.planMode ? [buildPlanModePromptSection()] : []),
|
|
341
|
+
buildResponseSchemaPromptSection(conversation.planMode),
|
|
342
|
+
].join("\n");
|
|
343
|
+
}
|
|
344
|
+
export function extractJsonObject(text) {
|
|
345
|
+
const trimmed = text.trim();
|
|
346
|
+
if (!trimmed)
|
|
347
|
+
return null;
|
|
348
|
+
try {
|
|
349
|
+
const parsed = JSON.parse(trimmed);
|
|
350
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
351
|
+
return parsed;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
// Fall through to brace matching.
|
|
356
|
+
}
|
|
357
|
+
const firstBrace = trimmed.indexOf("{");
|
|
358
|
+
const lastBrace = trimmed.lastIndexOf("}");
|
|
359
|
+
if (firstBrace === -1 || lastBrace === -1 || lastBrace <= firstBrace)
|
|
360
|
+
return null;
|
|
361
|
+
try {
|
|
362
|
+
const parsed = JSON.parse(trimmed.slice(firstBrace, lastBrace + 1));
|
|
363
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
364
|
+
return parsed;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
export function asRecord(value) {
|
|
373
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
374
|
+
? value
|
|
375
|
+
: null;
|
|
376
|
+
}
|
|
377
|
+
export function extractImageGenerationItem(event) {
|
|
378
|
+
const direct = event.type === "image_generation_call" ? event : null;
|
|
379
|
+
const item = asRecord(event.item);
|
|
380
|
+
const payload = asRecord(event.payload);
|
|
381
|
+
const candidate = direct ?? item ?? payload;
|
|
382
|
+
if (candidate?.type !== "image_generation_call")
|
|
383
|
+
return null;
|
|
384
|
+
return candidate;
|
|
385
|
+
}
|
|
386
|
+
export function base64PngToBuffer(value) {
|
|
387
|
+
if (typeof value !== "string")
|
|
388
|
+
return null;
|
|
389
|
+
const trimmed = value.trim();
|
|
390
|
+
if (!trimmed)
|
|
391
|
+
return null;
|
|
392
|
+
const base64 = trimmed.includes(",") ? trimmed.slice(trimmed.indexOf(",") + 1) : trimmed;
|
|
393
|
+
if (!/^[a-zA-Z0-9+/=\s]+$/.test(base64))
|
|
394
|
+
return null;
|
|
395
|
+
try {
|
|
396
|
+
const buffer = Buffer.from(base64.replace(/\s+/g, ""), "base64");
|
|
397
|
+
if (buffer.length <= 0)
|
|
398
|
+
return null;
|
|
399
|
+
return buffer;
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
export function extractGeneratedAttachments(result) {
|
|
406
|
+
const raw = result.resultJson && typeof result.resultJson === "object" && !Array.isArray(result.resultJson)
|
|
407
|
+
? result.resultJson
|
|
408
|
+
: null;
|
|
409
|
+
const stdout = typeof raw?.stdout === "string" ? raw.stdout : "";
|
|
410
|
+
if (!stdout)
|
|
411
|
+
return [];
|
|
412
|
+
const attachments = [];
|
|
413
|
+
const seen = new Set();
|
|
414
|
+
for (const rawLine of stdout.split(/\r?\n/)) {
|
|
415
|
+
const line = rawLine.trim();
|
|
416
|
+
if (!line || !line.includes("image_generation_call"))
|
|
417
|
+
continue;
|
|
418
|
+
let parsed;
|
|
419
|
+
try {
|
|
420
|
+
parsed = JSON.parse(line);
|
|
421
|
+
}
|
|
422
|
+
catch {
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
const event = asRecord(parsed);
|
|
426
|
+
if (!event)
|
|
427
|
+
continue;
|
|
428
|
+
const item = extractImageGenerationItem(event);
|
|
429
|
+
if (!item)
|
|
430
|
+
continue;
|
|
431
|
+
const buffer = base64PngToBuffer(item.result);
|
|
432
|
+
if (!buffer)
|
|
433
|
+
continue;
|
|
434
|
+
const toolCallId = typeof item.id === "string" && item.id.trim() ? item.id.trim() : null;
|
|
435
|
+
const key = toolCallId ?? `${buffer.length}:${buffer.subarray(0, 32).toString("base64")}`;
|
|
436
|
+
if (seen.has(key))
|
|
437
|
+
continue;
|
|
438
|
+
seen.add(key);
|
|
439
|
+
const filenameStem = toolCallId?.replace(/[^a-zA-Z0-9._-]+/g, "_") || `generated-image-${attachments.length + 1}`;
|
|
440
|
+
attachments.push({
|
|
441
|
+
source: "codex_image_generation",
|
|
442
|
+
originalFilename: `${filenameStem}.png`,
|
|
443
|
+
contentType: "image/png",
|
|
444
|
+
body: buffer,
|
|
445
|
+
toolCallId,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
return attachments;
|
|
449
|
+
}
|
|
450
|
+
export function isImageAttachment(attachment) {
|
|
451
|
+
return attachment.contentType.toLowerCase().startsWith("image/");
|
|
452
|
+
}
|
|
453
|
+
export function extensionForContentType(contentType) {
|
|
454
|
+
switch (contentType.toLowerCase()) {
|
|
455
|
+
case "image/png":
|
|
456
|
+
return ".png";
|
|
457
|
+
case "image/jpeg":
|
|
458
|
+
case "image/jpg":
|
|
459
|
+
return ".jpg";
|
|
460
|
+
case "image/webp":
|
|
461
|
+
return ".webp";
|
|
462
|
+
case "image/gif":
|
|
463
|
+
return ".gif";
|
|
464
|
+
case "image/svg+xml":
|
|
465
|
+
return ".svg";
|
|
466
|
+
default:
|
|
467
|
+
return "";
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
export function safeAttachmentFilename(attachment, index) {
|
|
471
|
+
const fallbackExt = extensionForContentType(attachment.contentType);
|
|
472
|
+
const sourceName = attachment.originalFilename ?? `${attachment.assetId}${fallbackExt}`;
|
|
473
|
+
const base = path.basename(sourceName).trim();
|
|
474
|
+
const cleaned = base
|
|
475
|
+
.replace(/[^a-zA-Z0-9._-]+/g, "_")
|
|
476
|
+
.replace(/_{2,}/g, "_")
|
|
477
|
+
.replace(/^_+|_+$/g, "");
|
|
478
|
+
const filename = cleaned || `attachment-${index + 1}${fallbackExt}`;
|
|
479
|
+
const hasExt = path.extname(filename).length > 0;
|
|
480
|
+
const withExt = hasExt || !fallbackExt ? filename : `${filename}${fallbackExt}`;
|
|
481
|
+
return `${String(index + 1).padStart(2, "0")}-${attachment.id.replace(/[^a-zA-Z0-9._-]+/g, "_")}-${withExt}`.slice(0, 180);
|
|
482
|
+
}
|
|
483
|
+
export async function prepareChatAttachmentReferences(input) {
|
|
484
|
+
const references = new Map();
|
|
485
|
+
if (input.runtimeType !== "codex_local" || !input.storage) {
|
|
486
|
+
return { references, cleanup: async () => { } };
|
|
487
|
+
}
|
|
488
|
+
const attachments = input.messages
|
|
489
|
+
.slice(-12)
|
|
490
|
+
.flatMap((message) => message.attachments)
|
|
491
|
+
.filter(isImageAttachment);
|
|
492
|
+
if (attachments.length === 0) {
|
|
493
|
+
return { references, cleanup: async () => { } };
|
|
494
|
+
}
|
|
495
|
+
const safeRunId = input.runId.replace(/[^a-zA-Z0-9._-]+/g, "_");
|
|
496
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), `rudder-chat-attachments-${safeRunId}-`));
|
|
497
|
+
await Promise.all(attachments.map(async (attachment, index) => {
|
|
498
|
+
const targetPath = path.join(dir, safeAttachmentFilename(attachment, index));
|
|
499
|
+
try {
|
|
500
|
+
const object = await input.storage.getObject(attachment.orgId, attachment.objectKey);
|
|
501
|
+
await pipeline(object.stream, createWriteStream(targetPath, { mode: 0o600 }));
|
|
502
|
+
references.set(attachment.id, { localPath: targetPath });
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
references.set(attachment.id, {
|
|
506
|
+
localPathError: error instanceof Error ? error.message : "Failed to prepare image attachment",
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}));
|
|
510
|
+
return {
|
|
511
|
+
references,
|
|
512
|
+
cleanup: async () => {
|
|
513
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
export function validateAssistantResult(payload, options = {}) {
|
|
518
|
+
const kind = typeof payload.kind === "string" ? payload.kind : "message";
|
|
519
|
+
const payloadBody = typeof payload.body === "string" ? payload.body.trim() : "";
|
|
520
|
+
const body = options.bodyOverride?.trim() || payloadBody || options.bodyFallback?.trim() || "";
|
|
521
|
+
const structuredPayload = payload.structuredPayload && typeof payload.structuredPayload === "object" && !Array.isArray(payload.structuredPayload)
|
|
522
|
+
? sanitizeChatStructuredPayload(payload.structuredPayload)
|
|
523
|
+
: null;
|
|
524
|
+
if (!body) {
|
|
525
|
+
throw new Error("Assistant response body was empty");
|
|
526
|
+
}
|
|
527
|
+
if (kind !== "message" && kind !== "ask_user" && kind !== "issue_proposal" && kind !== "operation_proposal") {
|
|
528
|
+
throw new Error(`Unsupported assistant result kind: ${kind}`);
|
|
529
|
+
}
|
|
530
|
+
if (kind === "ask_user" && !chatAskUserRequestFromStructuredPayload(structuredPayload)) {
|
|
531
|
+
throw new Error("ask_user assistant responses require structuredPayload.requestUserInput with 1-3 valid questions");
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
kind,
|
|
535
|
+
body,
|
|
536
|
+
structuredPayload,
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
export function buildConversationPrompt(input, runtimeSource, resultSentinel, orgResourcesPrompt, attachmentReferences = new Map()) {
|
|
540
|
+
const operatorProfileSection = buildOperatorProfilePromptSection(input.operatorProfile);
|
|
541
|
+
const selectedProjectSection = buildSelectedProjectPromptSection(input.contextLinks);
|
|
542
|
+
const selectedIssueSection = buildSelectedIssuePromptSection(input.conversation, input.contextLinks);
|
|
543
|
+
const issueLabelsSection = buildIssueLabelsPromptSection(input.issueLabels);
|
|
544
|
+
const currentUserAttachmentSection = buildCurrentUserAttachmentPromptSection(input.messages.slice(-12), attachmentReferences);
|
|
545
|
+
/**
|
|
546
|
+
* Chat prompt assembly stays compositional on purpose.
|
|
547
|
+
*
|
|
548
|
+
* Reasoning:
|
|
549
|
+
* - Always-loaded sections should hold only invariant chat-scene rules.
|
|
550
|
+
* - Conditional behavior such as plan mode should be injected only when active,
|
|
551
|
+
* so the runtime does not carry dormant "when X, do Y" branches in every chat.
|
|
552
|
+
*
|
|
553
|
+
* Traceability:
|
|
554
|
+
* - doc/plans/2026-04-18-chat-plan-mode.md
|
|
555
|
+
* - doc/DEVELOPING.md
|
|
556
|
+
*/
|
|
557
|
+
return [
|
|
558
|
+
systemPrompt(runtimeSource, input.conversation, resultSentinel),
|
|
559
|
+
...(selectedIssueSection ? [selectedIssueSection] : []),
|
|
560
|
+
...(selectedProjectSection ? [selectedProjectSection] : []),
|
|
561
|
+
...(issueLabelsSection ? [issueLabelsSection] : []),
|
|
562
|
+
...(orgResourcesPrompt ? [orgResourcesPrompt] : []),
|
|
563
|
+
...(operatorProfileSection ? [operatorProfileSection] : []),
|
|
564
|
+
...(currentUserAttachmentSection ? [currentUserAttachmentSection] : []),
|
|
565
|
+
"Conversation input:",
|
|
566
|
+
buildPrompt(input, attachmentReferences),
|
|
567
|
+
].join("\n\n");
|
|
568
|
+
}
|
|
569
|
+
export function resultText(result) {
|
|
570
|
+
if (typeof result.summary === "string" && result.summary.trim().length > 0) {
|
|
571
|
+
return result.summary.trim();
|
|
572
|
+
}
|
|
573
|
+
const raw = result.resultJson && typeof result.resultJson === "object" && !Array.isArray(result.resultJson)
|
|
574
|
+
? result.resultJson
|
|
575
|
+
: null;
|
|
576
|
+
const candidate = typeof raw?.text === "string"
|
|
577
|
+
? raw.text
|
|
578
|
+
: typeof raw?.message === "string"
|
|
579
|
+
? raw.message
|
|
580
|
+
: typeof raw?.content === "string"
|
|
581
|
+
? raw.content
|
|
582
|
+
: null;
|
|
583
|
+
return safeTrim(candidate) ?? "";
|
|
584
|
+
}
|
|
585
|
+
export function configArgs(agentRuntimeConfig) {
|
|
586
|
+
const raw = Array.isArray(agentRuntimeConfig.extraArgs)
|
|
587
|
+
? agentRuntimeConfig.extraArgs
|
|
588
|
+
: Array.isArray(agentRuntimeConfig.args)
|
|
589
|
+
? agentRuntimeConfig.args
|
|
590
|
+
: [];
|
|
591
|
+
return raw.filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
592
|
+
}
|
|
593
|
+
export function stripCliArgs(args, input) {
|
|
594
|
+
const flagsWithValues = new Set(input.flagsWithValues ?? []);
|
|
595
|
+
const standaloneFlags = new Set(input.standaloneFlags ?? []);
|
|
596
|
+
const prefixedFlags = input.prefixedFlags ?? [];
|
|
597
|
+
const next = [];
|
|
598
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
599
|
+
const arg = args[index];
|
|
600
|
+
if (flagsWithValues.has(arg)) {
|
|
601
|
+
index += 1;
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
if (standaloneFlags.has(arg)) {
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
if (prefixedFlags.some((prefix) => arg.startsWith(prefix))) {
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
next.push(arg);
|
|
611
|
+
}
|
|
612
|
+
return next;
|
|
613
|
+
}
|
|
614
|
+
export function applyPlanModeRuntimeOverlay(agentRuntimeType, agentRuntimeConfig) {
|
|
615
|
+
const args = configArgs(agentRuntimeConfig);
|
|
616
|
+
if (agentRuntimeType === "codex_local") {
|
|
617
|
+
return {
|
|
618
|
+
...agentRuntimeConfig,
|
|
619
|
+
dangerouslyBypassApprovalsAndSandbox: false,
|
|
620
|
+
dangerouslyBypassSandbox: false,
|
|
621
|
+
extraArgs: [
|
|
622
|
+
"-s",
|
|
623
|
+
"read-only",
|
|
624
|
+
...stripCliArgs(args, {
|
|
625
|
+
flagsWithValues: ["-s", "--sandbox"],
|
|
626
|
+
standaloneFlags: ["--dangerously-bypass-approvals-and-sandbox"],
|
|
627
|
+
prefixedFlags: ["--sandbox="],
|
|
628
|
+
}),
|
|
629
|
+
],
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
if (agentRuntimeType === "claude_local") {
|
|
633
|
+
return {
|
|
634
|
+
...agentRuntimeConfig,
|
|
635
|
+
dangerouslySkipPermissions: false,
|
|
636
|
+
extraArgs: [
|
|
637
|
+
"--permission-mode",
|
|
638
|
+
"plan",
|
|
639
|
+
...stripCliArgs(args, {
|
|
640
|
+
flagsWithValues: ["--permission-mode"],
|
|
641
|
+
standaloneFlags: ["--dangerously-skip-permissions"],
|
|
642
|
+
prefixedFlags: ["--permission-mode="],
|
|
643
|
+
}),
|
|
644
|
+
],
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
if (agentRuntimeType === "cursor") {
|
|
648
|
+
return {
|
|
649
|
+
...agentRuntimeConfig,
|
|
650
|
+
mode: "plan",
|
|
651
|
+
extraArgs: stripCliArgs(args, {
|
|
652
|
+
flagsWithValues: ["--mode"],
|
|
653
|
+
prefixedFlags: ["--mode="],
|
|
654
|
+
}),
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
return agentRuntimeConfig;
|
|
658
|
+
}
|
|
659
|
+
export function chatExecutionConfig(conversation, agentRuntimeType, agentRuntimeConfig) {
|
|
660
|
+
const baseConfig = conversation.planMode
|
|
661
|
+
? applyPlanModeRuntimeOverlay(agentRuntimeType, agentRuntimeConfig)
|
|
662
|
+
: agentRuntimeConfig;
|
|
663
|
+
return {
|
|
664
|
+
...baseConfig,
|
|
665
|
+
promptTemplate: "{{context.chatPrompt}}",
|
|
666
|
+
bootstrapPromptTemplate: "",
|
|
667
|
+
maxTurns: 1,
|
|
668
|
+
chrome: false,
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
export function linkedIssueIdsForChat(conversation, contextLinks) {
|
|
672
|
+
return Array.from(new Set([
|
|
673
|
+
conversation.primaryIssueId,
|
|
674
|
+
...contextLinks
|
|
675
|
+
.filter((link) => link.entityType === "issue")
|
|
676
|
+
.map((link) => link.entityId),
|
|
677
|
+
].filter((value) => typeof value === "string" && value.trim().length > 0)));
|
|
678
|
+
}
|
|
679
|
+
export function linkedProjectIdForChat(contextLinks) {
|
|
680
|
+
return contextLinks.find((link) => link.entityType === "project")?.entityId ?? null;
|
|
681
|
+
}
|
|
682
|
+
export function stubAgent(input) {
|
|
683
|
+
return {
|
|
684
|
+
id: input.sourceId,
|
|
685
|
+
orgId: input.orgId,
|
|
686
|
+
name: input.sourceLabel,
|
|
687
|
+
agentRuntimeType: input.agentRuntimeType,
|
|
688
|
+
agentRuntimeConfig: input.agentRuntimeConfig,
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
export function summarizeRuntimeSkills(entries) {
|
|
692
|
+
return entries.map((entry) => ({
|
|
693
|
+
key: entry.key,
|
|
694
|
+
runtimeName: entry.runtimeName,
|
|
695
|
+
name: entry.name,
|
|
696
|
+
description: entry.description,
|
|
697
|
+
}));
|
|
698
|
+
}
|
|
699
|
+
export function longestSentinelPrefixSuffix(value, sentinel) {
|
|
700
|
+
const max = Math.min(value.length, sentinel.length - 1);
|
|
701
|
+
for (let len = max; len > 0; len -= 1) {
|
|
702
|
+
if (value.endsWith(sentinel.slice(0, len))) {
|
|
703
|
+
return len;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
return 0;
|
|
707
|
+
}
|
|
708
|
+
export function createAssistantTextAccumulator() {
|
|
709
|
+
let fullText = "";
|
|
710
|
+
return {
|
|
711
|
+
get fullText() {
|
|
712
|
+
return fullText;
|
|
713
|
+
},
|
|
714
|
+
push(fragment, isDelta = false) {
|
|
715
|
+
if (!fragment)
|
|
716
|
+
return "";
|
|
717
|
+
if (isDelta) {
|
|
718
|
+
fullText += fragment;
|
|
719
|
+
return fragment;
|
|
720
|
+
}
|
|
721
|
+
if (fragment.startsWith(fullText)) {
|
|
722
|
+
const delta = fragment.slice(fullText.length);
|
|
723
|
+
fullText = fragment;
|
|
724
|
+
return delta;
|
|
725
|
+
}
|
|
726
|
+
if (fullText.endsWith(fragment) || fullText.includes(fragment)) {
|
|
727
|
+
return "";
|
|
728
|
+
}
|
|
729
|
+
fullText += fragment;
|
|
730
|
+
return fragment;
|
|
731
|
+
},
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
export function createSentinelStream(resultSentinel) {
|
|
735
|
+
let visibleText = "";
|
|
736
|
+
let resultPayloadText = "";
|
|
737
|
+
let carry = "";
|
|
738
|
+
let seenSentinel = false;
|
|
739
|
+
return {
|
|
740
|
+
get visibleText() {
|
|
741
|
+
return visibleText;
|
|
742
|
+
},
|
|
743
|
+
get resultPayloadText() {
|
|
744
|
+
return resultPayloadText;
|
|
745
|
+
},
|
|
746
|
+
get seenSentinel() {
|
|
747
|
+
return seenSentinel;
|
|
748
|
+
},
|
|
749
|
+
push(text) {
|
|
750
|
+
if (!text)
|
|
751
|
+
return "";
|
|
752
|
+
if (seenSentinel) {
|
|
753
|
+
resultPayloadText += text;
|
|
754
|
+
return "";
|
|
755
|
+
}
|
|
756
|
+
const combined = `${carry}${text}`;
|
|
757
|
+
const sentinelIndex = combined.indexOf(resultSentinel);
|
|
758
|
+
if (sentinelIndex >= 0) {
|
|
759
|
+
const visibleDelta = combined.slice(0, sentinelIndex);
|
|
760
|
+
seenSentinel = true;
|
|
761
|
+
visibleText += visibleDelta;
|
|
762
|
+
resultPayloadText += combined.slice(sentinelIndex + resultSentinel.length);
|
|
763
|
+
carry = "";
|
|
764
|
+
return visibleDelta;
|
|
765
|
+
}
|
|
766
|
+
const holdLength = longestSentinelPrefixSuffix(combined, resultSentinel);
|
|
767
|
+
const visibleDelta = combined.slice(0, combined.length - holdLength);
|
|
768
|
+
carry = combined.slice(combined.length - holdLength);
|
|
769
|
+
visibleText += visibleDelta;
|
|
770
|
+
return visibleDelta;
|
|
771
|
+
},
|
|
772
|
+
finish() {
|
|
773
|
+
if (seenSentinel) {
|
|
774
|
+
if (carry)
|
|
775
|
+
resultPayloadText += carry;
|
|
776
|
+
carry = "";
|
|
777
|
+
return "";
|
|
778
|
+
}
|
|
779
|
+
const visibleDelta = carry;
|
|
780
|
+
carry = "";
|
|
781
|
+
visibleText += visibleDelta;
|
|
782
|
+
return visibleDelta;
|
|
783
|
+
},
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
export function parseAssistantEnvelope(rawText, resultSentinel) {
|
|
787
|
+
const sentinelIndex = rawText.indexOf(resultSentinel);
|
|
788
|
+
if (sentinelIndex === -1) {
|
|
789
|
+
return {
|
|
790
|
+
visibleBody: rawText.trim(),
|
|
791
|
+
jsonPayload: null,
|
|
792
|
+
usedSentinel: false,
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
const visibleBody = rawText.slice(0, sentinelIndex).trim();
|
|
796
|
+
const jsonPayload = extractJsonObject(rawText.slice(sentinelIndex + resultSentinel.length));
|
|
797
|
+
return {
|
|
798
|
+
visibleBody,
|
|
799
|
+
jsonPayload,
|
|
800
|
+
usedSentinel: true,
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
export function parseCompletedAssistantReply(rawText, resultSentinel, options = {}) {
|
|
804
|
+
const enveloped = parseAssistantEnvelope(rawText, resultSentinel);
|
|
805
|
+
if (options.requireSentinel && !enveloped.usedSentinel) {
|
|
806
|
+
throw new Error("Chat adapter completed without the required Rudder result sentinel");
|
|
807
|
+
}
|
|
808
|
+
if (options.requireSentinel && enveloped.usedSentinel && !enveloped.jsonPayload) {
|
|
809
|
+
throw new Error("Chat adapter emitted the Rudder result sentinel without a valid JSON payload");
|
|
810
|
+
}
|
|
811
|
+
if (enveloped.jsonPayload) {
|
|
812
|
+
return validateAssistantResult(enveloped.jsonPayload, {
|
|
813
|
+
bodyFallback: enveloped.usedSentinel ? enveloped.visibleBody : null,
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
const legacyPayload = extractJsonObject(rawText);
|
|
817
|
+
if (legacyPayload) {
|
|
818
|
+
return validateAssistantResult(legacyPayload);
|
|
819
|
+
}
|
|
820
|
+
const body = safeTrim(enveloped.visibleBody);
|
|
821
|
+
if (!body) {
|
|
822
|
+
throw new Error("Chat adapter returned no assistant text");
|
|
823
|
+
}
|
|
824
|
+
return {
|
|
825
|
+
kind: "message",
|
|
826
|
+
body,
|
|
827
|
+
structuredPayload: null,
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
export function partialBodyFromRawAssistantText(rawText, resultSentinel) {
|
|
831
|
+
return safeTrim(parseAssistantEnvelope(rawText, resultSentinel).visibleBody) ?? "";
|
|
832
|
+
}
|
|
833
|
+
export async function maybeEmitAssistantState(callback, state) {
|
|
834
|
+
if (!callback)
|
|
835
|
+
return;
|
|
836
|
+
await callback(state);
|
|
837
|
+
}
|
|
838
|
+
export async function maybeEmitAssistantDelta(callback, delta) {
|
|
839
|
+
if (!callback || !delta)
|
|
840
|
+
return;
|
|
841
|
+
await callback(delta);
|
|
842
|
+
}
|
|
843
|
+
export async function maybeEmitTranscriptEntry(callback, entry) {
|
|
844
|
+
if (!callback)
|
|
845
|
+
return;
|
|
846
|
+
await callback(entry);
|
|
847
|
+
}
|
|
848
|
+
export async function maybeEmitObservedTranscriptEntry(callback, entry) {
|
|
849
|
+
if (!callback)
|
|
850
|
+
return;
|
|
851
|
+
await callback(entry);
|
|
852
|
+
}
|
|
853
|
+
export function shouldSuppressChatTranscriptEntry(entry, resultSentinel) {
|
|
854
|
+
if (entry.kind === "result") {
|
|
855
|
+
return true;
|
|
856
|
+
}
|
|
857
|
+
if (entry.kind === "stdout" && entry.text.includes(resultSentinel)) {
|
|
858
|
+
return true;
|
|
859
|
+
}
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
//# sourceMappingURL=chat-assistant.helpers.js.map
|