@rudderhq/server 0.2.5-canary.9 → 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-B5mJzzqZ.js → _basePickBy-N8I9ml5Y.js} +1 -1
- package/ui-dist/assets/{_baseUniq-B10Ec09o.js → _baseUniq-BuSlpRSQ.js} +1 -1
- package/ui-dist/assets/{arc-Bw7wimOa.js → arc-qX-dPyA1.js} +1 -1
- package/ui-dist/assets/{architectureDiagram-2XIMDMQ5-DZr0XEvv.js → architectureDiagram-2XIMDMQ5-DhjkbXsp.js} +1 -1
- package/ui-dist/assets/{blockDiagram-WCTKOSBZ-D0jl0LgB.js → blockDiagram-WCTKOSBZ-JS-tTu3J.js} +1 -1
- package/ui-dist/assets/{c4Diagram-IC4MRINW-BEFxBnEm.js → c4Diagram-IC4MRINW-4DqwCWIx.js} +1 -1
- package/ui-dist/assets/channel-CccCW5_a.js +1 -0
- package/ui-dist/assets/{chunk-4BX2VUAB-Cbul1GoA.js → chunk-4BX2VUAB-T37SqBpp.js} +1 -1
- package/ui-dist/assets/{chunk-55IACEB6-DuouC3bT.js → chunk-55IACEB6-BSj9hdqK.js} +1 -1
- package/ui-dist/assets/{chunk-FMBD7UC4-bN1jF9xw.js → chunk-FMBD7UC4-Dkrlh0Wk.js} +1 -1
- package/ui-dist/assets/{chunk-JSJVCQXG-B0-Ij6ZF.js → chunk-JSJVCQXG-C0ZE3QdB.js} +1 -1
- package/ui-dist/assets/{chunk-KX2RTZJC-BjI3IEjI.js → chunk-KX2RTZJC-DOZQM9gW.js} +1 -1
- package/ui-dist/assets/{chunk-NQ4KR5QH-MUoGr46n.js → chunk-NQ4KR5QH-5Yr3U2k8.js} +1 -1
- package/ui-dist/assets/{chunk-QZHKN3VN-CQoI9Ouy.js → chunk-QZHKN3VN-CvKTufwF.js} +1 -1
- package/ui-dist/assets/{chunk-WL4C6EOR-DSJh3iDp.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-BPepglgB.js → cose-bilkent-S5V4N54A-CTvr1OFj.js} +1 -1
- package/ui-dist/assets/{dagre-KLK3FWXG-DhnHVZkt.js → dagre-KLK3FWXG-UZ-SNjVK.js} +1 -1
- package/ui-dist/assets/{diagram-E7M64L7V-DNvXtoOO.js → diagram-E7M64L7V-D7RAN0Hr.js} +1 -1
- package/ui-dist/assets/{diagram-IFDJBPK2-DhGlDTgn.js → diagram-IFDJBPK2-B4LViaFR.js} +1 -1
- package/ui-dist/assets/{diagram-P4PSJMXO-BmXEloWS.js → diagram-P4PSJMXO-CY1be7ak.js} +1 -1
- package/ui-dist/assets/{erDiagram-INFDFZHY-BTYVzaLM.js → erDiagram-INFDFZHY-Dca0KkvJ.js} +1 -1
- package/ui-dist/assets/{flowDiagram-PKNHOUZH-CqMNQUVv.js → flowDiagram-PKNHOUZH-i-qMvfwg.js} +1 -1
- package/ui-dist/assets/{ganttDiagram-A5KZAMGK-B2le_64a.js → ganttDiagram-A5KZAMGK-Wxq2lhbh.js} +1 -1
- package/ui-dist/assets/{gitGraphDiagram-K3NZZRJ6-BtxOBq5A.js → gitGraphDiagram-K3NZZRJ6-DwzgPlAY.js} +1 -1
- package/ui-dist/assets/{graph-C5E6qFfm.js → graph-BAqf89Tz.js} +1 -1
- package/ui-dist/assets/{index-Piq-IPXt.js → index-4eCzaLuY.js} +1 -1
- package/ui-dist/assets/{index-DT6UN2ec.js → index-8uu-nKqK.js} +1 -1
- package/ui-dist/assets/{index-T5NVZ3nR.js → index-B-1NEcI_.js} +1 -1
- package/ui-dist/assets/{index-D-MoarxG.js → index-B0b_3Eu5.js} +1 -1
- package/ui-dist/assets/{index-CZiP3FBQ.js → index-B8v0eZjP.js} +1 -1
- package/ui-dist/assets/{index-C1Ga66FM.js → index-BN7Moj3u.js} +1 -1
- package/ui-dist/assets/{index-xBUfBdQn.js → index-BSpxh3cY.js} +1 -1
- package/ui-dist/assets/{index-CQcMWp51.js → index-BY44RIi9.js} +1 -1
- package/ui-dist/assets/{index-3a93sZNI.js → index-BhyQJhdZ.js} +1 -1
- package/ui-dist/assets/{index-BsVDit5y.js → index-BkPL_iGU.js} +1 -1
- package/ui-dist/assets/{index-88lBSTsW.js → index-BsPfoHXS.js} +1 -1
- package/ui-dist/assets/{index-CyJtcUF0.js → index-BstW7nmv.js} +1 -1
- package/ui-dist/assets/{index-BvZ0Ptfl.js → index-BwB67Zyz.js} +1 -1
- package/ui-dist/assets/index-C2peSkmT.css +1 -0
- package/ui-dist/assets/{index-vkCrQLeX.js → index-C3ktOsS_.js} +1 -1
- package/ui-dist/assets/{index-D2hZpQJT.js → index-CMyABlS-.js} +1 -1
- package/ui-dist/assets/{index-C4WCPEY4.js → index-CyBJ8ujC.js} +1 -1
- package/ui-dist/assets/{index-Bf7NB_lK.js → index-DAxM2W3O.js} +1 -1
- package/ui-dist/assets/{index-Dq7H6-Lm.js → index-DVZXPmhk.js} +1 -1
- package/ui-dist/assets/{index-CskDu6A3.js → index-Dc19uAyw.js} +1 -1
- package/ui-dist/assets/index-DzHrwZu1.js +1511 -0
- package/ui-dist/assets/{index-B20JneLK.js → index-LJuf53Ye.js} +1 -1
- package/ui-dist/assets/{index-D6McTDMQ.js → index-Ugw5VWWz.js} +1 -1
- package/ui-dist/assets/{index-CcVGS6HJ.js → index-YGraEFR7.js} +1 -1
- package/ui-dist/assets/{infoDiagram-LFFYTUFH-BiCCZcIW.js → infoDiagram-LFFYTUFH-jLmDtFVR.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-PHBUUO56-BiwBemM5.js → ishikawaDiagram-PHBUUO56-6OGMyLT8.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-4ABVD52K-D8RGr2xl.js → journeyDiagram-4ABVD52K-yQjl6E0t.js} +1 -1
- package/ui-dist/assets/{kanban-definition-K7BYSVSG-C733Fj-E.js → kanban-definition-K7BYSVSG-DkdCeQlS.js} +1 -1
- package/ui-dist/assets/{layout-CM4c3NA_.js → layout-CqSYvZ_w.js} +1 -1
- package/ui-dist/assets/{linear-DzH21Xsf.js → linear-B8xGZaoi.js} +1 -1
- package/ui-dist/assets/{mermaid.core-Z2rpoVP2.js → mermaid.core-AKL_cdyk.js} +4 -4
- package/ui-dist/assets/{mindmap-definition-YRQLILUH-DylLLj9w.js → mindmap-definition-YRQLILUH-Zr-dXC0x.js} +1 -1
- package/ui-dist/assets/{pieDiagram-SKSYHLDU-617wI_rr.js → pieDiagram-SKSYHLDU-BvDAU-Nk.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-337W2JSQ-lxoCPJIL.js → quadrantDiagram-337W2JSQ-Dn9kM62o.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-Z7DCOOCP-C5XydQ9-.js → requirementDiagram-Z7DCOOCP-GIsIh7Sd.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-WA2Y5GQK--grmq-Q8.js → sankeyDiagram-WA2Y5GQK-CUCuBkuf.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-2WXFIKYE-BS2PeYH-.js → sequenceDiagram-2WXFIKYE-MDpUY2HM.js} +1 -1
- package/ui-dist/assets/{stateDiagram-RAJIS63D-CeuZtj2z.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-DxHdMpRr.js → timeline-definition-YZTLITO2-B6ofPhhy.js} +1 -1
- package/ui-dist/assets/{treemap-KZPCXAKY-Bv1ZlC5h.js → treemap-KZPCXAKY-DnLO6w1l.js} +1 -1
- package/ui-dist/assets/{vennDiagram-LZ73GAT5-DvpZSXY2.js → vennDiagram-LZ73GAT5-D0MyZIDl.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-JWTSCODW-DttOu1GC.js → xychartDiagram-JWTSCODW-rADY1iUG.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/assets/channel-DGUh6rEi.js +0 -1
- package/ui-dist/assets/classDiagram-VBA2DB6C-1ntk2IOV.js +0 -1
- package/ui-dist/assets/classDiagram-v2-RAHNMMFH-1ntk2IOV.js +0 -1
- package/ui-dist/assets/clone-BpddY88c.js +0 -1
- package/ui-dist/assets/index-C8AD6s7S.js +0 -1510
- package/ui-dist/assets/index-Ded0dPwB.css +0 -1
- package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-DXq0yC5C.js +0 -1
package/dist/routes/chats.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { Router } from "express";
|
|
3
3
|
import multer from "multer";
|
|
4
|
-
import { addChatMessageSchema,
|
|
4
|
+
import { addChatMessageSchema, createChatConversationSchema, updateChatConversationSchema, } from "@rudderhq/shared";
|
|
5
5
|
import { isAllowedContentType, MAX_ATTACHMENT_BYTES } from "../attachment-types.js";
|
|
6
6
|
import { forbidden, HttpError, unauthorized } from "../errors.js";
|
|
7
7
|
import { observeExecutionEvent, updateExecutionObservation, updateExecutionTraceIO, withExecutionObservation, } from "../langfuse.js";
|
|
@@ -9,10 +9,11 @@ import { emitExecutionTranscriptTree } from "../langfuse-transcript.js";
|
|
|
9
9
|
import { validate } from "../middleware/validate.js";
|
|
10
10
|
import { logger } from "../middleware/logger.js";
|
|
11
11
|
import { ChatAssistantStreamError, chatAssistantService, } from "../services/chat-assistant.js";
|
|
12
|
-
import {
|
|
12
|
+
import { claimChatGeneration, hasActiveChatGeneration } from "../services/chat-generation-locks.js";
|
|
13
13
|
import { accessService, agentService, chatService, operatorProfileService, organizationService, goalService, issueService, logActivity, projectService, } from "../services/index.js";
|
|
14
14
|
import { summarizeRuntimeSkillsForTrace } from "../services/runtime-trace-metadata.js";
|
|
15
15
|
import { assertBoard, assertCompanyAccess, getActorInfo } from "./authz.js";
|
|
16
|
+
import { registerChatStreamRoutes } from "./chats.stream-routes.js";
|
|
16
17
|
export function chatRoutes(db, storage) {
|
|
17
18
|
const router = Router();
|
|
18
19
|
const svc = chatService(db);
|
|
@@ -953,656 +954,45 @@ export function chatRoutes(db, storage) {
|
|
|
953
954
|
releaseGeneration();
|
|
954
955
|
}
|
|
955
956
|
});
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
const releaseGeneration = claimChatGeneration(conversation.id, abortController);
|
|
996
|
-
if (!releaseGeneration) {
|
|
997
|
-
res.status(409).json({ error: "A chat reply is already being generated for this conversation" });
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
const actor = getActorInfo(req);
|
|
1001
|
-
let assistantConversationForPartial = null;
|
|
1002
|
-
let turnContextForPartial = null;
|
|
1003
|
-
let chatObservation = null;
|
|
1004
|
-
const transcript = [];
|
|
1005
|
-
const observedTranscript = [];
|
|
1006
|
-
let modelTurnInput;
|
|
1007
|
-
let assistantProgressMessage = null;
|
|
1008
|
-
let assistantProgressMessageId = null;
|
|
1009
|
-
let assistantDraftBody = "";
|
|
1010
|
-
const persistStreamProgress = async (progressConversation, replyingAgentId = chatReplyingAgentId(progressConversation)) => {
|
|
1011
|
-
if (!turnContextForPartial)
|
|
1012
|
-
return null;
|
|
1013
|
-
const input = {
|
|
1014
|
-
kind: "message",
|
|
1015
|
-
status: "streaming",
|
|
1016
|
-
body: assistantDraftBody,
|
|
1017
|
-
transcript,
|
|
1018
|
-
replyingAgentId,
|
|
1019
|
-
};
|
|
1020
|
-
if (assistantProgressMessage) {
|
|
1021
|
-
const updated = await svc.updateMessage(progressConversation.id, assistantProgressMessage.id, input);
|
|
1022
|
-
if (updated) {
|
|
1023
|
-
assistantProgressMessage = updated;
|
|
1024
|
-
assistantProgressMessageId = assistantProgressMessage.id;
|
|
1025
|
-
return assistantProgressMessage;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
assistantProgressMessage = await svc.addMessage(progressConversation.id, {
|
|
1029
|
-
orgId: progressConversation.orgId,
|
|
1030
|
-
role: "assistant",
|
|
1031
|
-
kind: "message",
|
|
1032
|
-
status: "streaming",
|
|
1033
|
-
body: assistantDraftBody,
|
|
1034
|
-
transcript,
|
|
1035
|
-
replyingAgentId,
|
|
1036
|
-
chatTurnId: turnContextForPartial.chatTurnId,
|
|
1037
|
-
turnVariant: turnContextForPartial.turnVariant,
|
|
1038
|
-
});
|
|
1039
|
-
assistantProgressMessageId = assistantProgressMessage.id;
|
|
1040
|
-
return assistantProgressMessage;
|
|
1041
|
-
};
|
|
1042
|
-
let clientClosed = false;
|
|
1043
|
-
const handleClosed = () => {
|
|
1044
|
-
if (clientClosed || res.writableEnded)
|
|
1045
|
-
return;
|
|
1046
|
-
clientClosed = true;
|
|
1047
|
-
};
|
|
1048
|
-
req.on("aborted", handleClosed);
|
|
1049
|
-
res.on("close", handleClosed);
|
|
1050
|
-
res.status(201);
|
|
1051
|
-
res.setHeader("Content-Type", "application/x-ndjson; charset=utf-8");
|
|
1052
|
-
res.setHeader("Cache-Control", "no-cache, no-transform");
|
|
1053
|
-
res.setHeader("X-Accel-Buffering", "no");
|
|
1054
|
-
res.flushHeaders();
|
|
1055
|
-
try {
|
|
1056
|
-
const userMessage = await addUserMessage(conversation, parsedBody.data.body, actor, parsedBody.data.editUserMessageId ?? null);
|
|
1057
|
-
const userAttachments = await attachFilesToUserMessage(conversation, userMessage.id, messageFiles, actor);
|
|
1058
|
-
const hydratedUserMessage = {
|
|
1059
|
-
...userMessage,
|
|
1060
|
-
attachments: userAttachments,
|
|
1061
|
-
};
|
|
1062
|
-
turnContextForPartial = turnContextFromUserMessage(userMessage);
|
|
1063
|
-
chatObservation = buildChatObservabilityContext(conversation, {
|
|
1064
|
-
surface: "chat_turn",
|
|
1065
|
-
rootExecutionId: turnContextForPartial.chatTurnId,
|
|
1066
|
-
trigger: "assistant_reply_stream",
|
|
1067
|
-
runtime: assistantAvailability.agentRuntimeType ?? null,
|
|
1068
|
-
metadata: {
|
|
1069
|
-
stream: true,
|
|
1070
|
-
userMessageId: userMessage.id,
|
|
1071
|
-
editUserMessageId: parsedBody.data.editUserMessageId ?? null,
|
|
1072
|
-
attachmentCount: userAttachments.length,
|
|
1073
|
-
},
|
|
1074
|
-
});
|
|
1075
|
-
const traceInputBase = {
|
|
1076
|
-
conversationId: conversation.id,
|
|
1077
|
-
body: parsedBody.data.body,
|
|
1078
|
-
userMessageId: userMessage.id,
|
|
1079
|
-
};
|
|
1080
|
-
let currentChatTraceInput = buildChatTraceInput(traceInputBase);
|
|
1081
|
-
writeStreamEvent(res, {
|
|
1082
|
-
type: "ack",
|
|
1083
|
-
userMessage: hydratedUserMessage,
|
|
1084
|
-
});
|
|
1085
|
-
await withChatObservation(chatObservation, {
|
|
1086
|
-
name: "chat_turn",
|
|
1087
|
-
asType: "agent",
|
|
1088
|
-
input: currentChatTraceInput,
|
|
1089
|
-
}, async (observation) => {
|
|
1090
|
-
const assistantInput = await loadAssistantInput(conversation, actor);
|
|
1091
|
-
assistantConversationForPartial = assistantInput.conversation;
|
|
1092
|
-
let finalChatOutput = null;
|
|
1093
|
-
let finalChatStatus = "completed";
|
|
1094
|
-
try {
|
|
1095
|
-
const streamed = await assistantSvc.streamChatAssistantReply({
|
|
1096
|
-
...assistantInput,
|
|
1097
|
-
abortSignal: abortController.signal,
|
|
1098
|
-
onInvocationMeta: async (meta) => {
|
|
1099
|
-
modelTurnInput = modelTurnInputFromInvocationMeta(meta);
|
|
1100
|
-
currentChatTraceInput = buildChatTraceInput(traceInputBase, meta);
|
|
1101
|
-
mergeChatInvocationTraceMetadata(chatObservation, meta);
|
|
1102
|
-
updateExecutionObservation(observation, chatObservation, {
|
|
1103
|
-
input: currentChatTraceInput,
|
|
1104
|
-
});
|
|
1105
|
-
updateExecutionTraceIO(observation, { input: currentChatTraceInput });
|
|
1106
|
-
},
|
|
1107
|
-
onAssistantDelta: async (delta) => {
|
|
1108
|
-
assistantDraftBody = `${assistantDraftBody}${delta}`;
|
|
1109
|
-
await persistStreamProgress(assistantInput.conversation);
|
|
1110
|
-
if (clientClosed)
|
|
1111
|
-
return;
|
|
1112
|
-
writeStreamEvent(res, {
|
|
1113
|
-
type: "assistant_delta",
|
|
1114
|
-
delta,
|
|
1115
|
-
});
|
|
1116
|
-
},
|
|
1117
|
-
onAssistantState: async (state) => {
|
|
1118
|
-
await persistStreamProgress(assistantInput.conversation);
|
|
1119
|
-
if (clientClosed)
|
|
1120
|
-
return;
|
|
1121
|
-
writeStreamEvent(res, {
|
|
1122
|
-
type: "assistant_state",
|
|
1123
|
-
state,
|
|
1124
|
-
});
|
|
1125
|
-
},
|
|
1126
|
-
onTranscriptEntry: async (entry) => {
|
|
1127
|
-
transcript.push(entry);
|
|
1128
|
-
await persistStreamProgress(assistantInput.conversation);
|
|
1129
|
-
if (clientClosed)
|
|
1130
|
-
return;
|
|
1131
|
-
writeStreamEvent(res, {
|
|
1132
|
-
type: "transcript_entry",
|
|
1133
|
-
entry,
|
|
1134
|
-
});
|
|
1135
|
-
},
|
|
1136
|
-
onObservedTranscriptEntry: async (entry) => {
|
|
1137
|
-
observedTranscript.push(entry);
|
|
1138
|
-
},
|
|
1139
|
-
});
|
|
1140
|
-
if (streamed.outcome === "stopped") {
|
|
1141
|
-
finalChatStatus = "stopped";
|
|
1142
|
-
finalChatOutput = streamed.partialBody;
|
|
1143
|
-
const stoppedMessage = await persistPartialAssistantMessage(assistantInput.conversation, streamed.partialBody, "stopped", turnContextForPartial, transcript, streamed.replyingAgentId, assistantProgressMessageId);
|
|
1144
|
-
if (stoppedMessage) {
|
|
1145
|
-
await logChatMessagesAdded(assistantInput.conversation, [stoppedMessage], {
|
|
1146
|
-
actorType: "system",
|
|
1147
|
-
actorId: "chat-assistant",
|
|
1148
|
-
agentId: streamed.replyingAgentId,
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
await emitChatObservationEvent(chatObservation, {
|
|
1152
|
-
name: "chat.reply.stopped",
|
|
1153
|
-
level: "WARNING",
|
|
1154
|
-
metadata: {
|
|
1155
|
-
stoppedMessageId: stoppedMessage?.id ?? null,
|
|
1156
|
-
transcriptEntries: transcript.length,
|
|
1157
|
-
observedTranscriptEntries: observedTranscript.length,
|
|
1158
|
-
},
|
|
1159
|
-
});
|
|
1160
|
-
if (!clientClosed) {
|
|
1161
|
-
writeStreamEvent(res, {
|
|
1162
|
-
type: "final",
|
|
1163
|
-
messages: stoppedMessage ? [stoppedMessage] : [],
|
|
1164
|
-
});
|
|
1165
|
-
res.end();
|
|
1166
|
-
}
|
|
1167
|
-
return;
|
|
1168
|
-
}
|
|
1169
|
-
const createdMessages = await persistAssistantReply(req, assistantInput.conversation, actor, streamed.reply, turnContextForPartial, transcript, streamed.replyingAgentId, assistantProgressMessageId);
|
|
1170
|
-
finalChatOutput = streamed.reply.body;
|
|
1171
|
-
await logChatMessagesAdded(assistantInput.conversation, createdMessages, {
|
|
1172
|
-
actorType: "system",
|
|
1173
|
-
actorId: "chat-assistant",
|
|
1174
|
-
agentId: streamed.replyingAgentId,
|
|
1175
|
-
});
|
|
1176
|
-
await emitChatObservationEvent(chatObservation, {
|
|
1177
|
-
name: "chat.reply.persisted",
|
|
1178
|
-
metadata: {
|
|
1179
|
-
transcriptEntries: transcript.length,
|
|
1180
|
-
observedTranscriptEntries: observedTranscript.length,
|
|
1181
|
-
...summarizeChatObservationMessages(createdMessages),
|
|
1182
|
-
},
|
|
1183
|
-
});
|
|
1184
|
-
if (!clientClosed) {
|
|
1185
|
-
writeStreamEvent(res, {
|
|
1186
|
-
type: "final",
|
|
1187
|
-
messages: createdMessages,
|
|
1188
|
-
});
|
|
1189
|
-
res.end();
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
catch (error) {
|
|
1193
|
-
finalChatStatus = "failed";
|
|
1194
|
-
if (error instanceof ChatAssistantStreamError) {
|
|
1195
|
-
finalChatOutput = error.partialBody;
|
|
1196
|
-
}
|
|
1197
|
-
throw error;
|
|
1198
|
-
}
|
|
1199
|
-
finally {
|
|
1200
|
-
try {
|
|
1201
|
-
const transcriptStats = emitExecutionTranscriptTree({
|
|
1202
|
-
context: chatObservation,
|
|
1203
|
-
parentObservation: observation,
|
|
1204
|
-
transcript: observedTranscript,
|
|
1205
|
-
initialTurnInput: modelTurnInput,
|
|
1206
|
-
fallbackResult: finalChatOutput
|
|
1207
|
-
? {
|
|
1208
|
-
output: finalChatOutput,
|
|
1209
|
-
subtype: finalChatStatus,
|
|
1210
|
-
isError: finalChatStatus === "failed",
|
|
1211
|
-
}
|
|
1212
|
-
: null,
|
|
1213
|
-
});
|
|
1214
|
-
finalChatOutput = finalChatOutput ?? transcriptStats.finalOutput ?? null;
|
|
1215
|
-
}
|
|
1216
|
-
catch (error) {
|
|
1217
|
-
logger.warn({
|
|
1218
|
-
rootExecutionId: chatObservation.rootExecutionId,
|
|
1219
|
-
err: error instanceof Error ? error.message : String(error),
|
|
1220
|
-
}, "Failed to export chat transcript tree to Langfuse");
|
|
1221
|
-
}
|
|
1222
|
-
updateExecutionObservation(observation, {
|
|
1223
|
-
...chatObservation,
|
|
1224
|
-
status: finalChatStatus,
|
|
1225
|
-
}, {
|
|
1226
|
-
input: currentChatTraceInput,
|
|
1227
|
-
output: finalChatOutput,
|
|
1228
|
-
level: finalChatStatus === "failed" ? "ERROR" : "DEFAULT",
|
|
1229
|
-
statusMessage: finalChatStatus,
|
|
1230
|
-
});
|
|
1231
|
-
updateExecutionTraceIO(observation, {
|
|
1232
|
-
input: currentChatTraceInput,
|
|
1233
|
-
output: finalChatOutput,
|
|
1234
|
-
});
|
|
1235
|
-
}
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
catch (err) {
|
|
1239
|
-
const partialBody = err instanceof ChatAssistantStreamError ? err.partialBody : "";
|
|
1240
|
-
const generatedAttachments = err instanceof ChatAssistantStreamError ? err.generatedAttachments : [];
|
|
1241
|
-
const failedReplyingAgentId = chatReplyingAgentId(assistantConversationForPartial);
|
|
1242
|
-
let failedMessage = await persistPartialAssistantMessage(assistantConversationForPartial ?? conversation, partialBody, "failed", turnContextForPartial, transcript, failedReplyingAgentId, assistantProgressMessageId).catch(() => null);
|
|
1243
|
-
failedMessage = await attachGeneratedFilesToPartialMessage(assistantConversationForPartial ?? conversation, failedMessage, generatedAttachments, failedReplyingAgentId).catch(() => failedMessage);
|
|
1244
|
-
if (failedMessage && assistantConversationForPartial) {
|
|
1245
|
-
await logChatMessagesAdded(assistantConversationForPartial, [failedMessage], {
|
|
1246
|
-
actorType: "system",
|
|
1247
|
-
actorId: "chat-assistant",
|
|
1248
|
-
agentId: failedReplyingAgentId,
|
|
1249
|
-
}).catch(() => { });
|
|
1250
|
-
}
|
|
1251
|
-
if (chatObservation) {
|
|
1252
|
-
await emitChatObservationEvent(chatObservation, {
|
|
1253
|
-
name: "chat.reply.failed",
|
|
1254
|
-
level: "ERROR",
|
|
1255
|
-
metadata: {
|
|
1256
|
-
failedMessageId: failedMessage?.id ?? null,
|
|
1257
|
-
transcriptEntries: transcript.length,
|
|
1258
|
-
observedTranscriptEntries: observedTranscript.length,
|
|
1259
|
-
error: err instanceof Error ? err.message : String(err),
|
|
1260
|
-
},
|
|
1261
|
-
statusMessage: err instanceof Error ? err.message : "chat_reply_failed",
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
logger.warn({ err, conversationId: conversation.id }, "chat assistant stream failed");
|
|
1265
|
-
if (!clientClosed) {
|
|
1266
|
-
writeStreamEvent(res, {
|
|
1267
|
-
type: "error",
|
|
1268
|
-
error: err instanceof Error ? err.message : "Chat assistant failed to respond",
|
|
1269
|
-
messageId: failedMessage?.id ?? null,
|
|
1270
|
-
});
|
|
1271
|
-
res.end();
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
finally {
|
|
1275
|
-
req.off("aborted", handleClosed);
|
|
1276
|
-
res.off("close", handleClosed);
|
|
1277
|
-
releaseGeneration();
|
|
1278
|
-
}
|
|
1279
|
-
});
|
|
1280
|
-
router.post("/chats/:id/messages/stream/stop", async (req, res) => {
|
|
1281
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1282
|
-
if (!conversation) {
|
|
1283
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
res.json({ stopped: cancelActiveChatGeneration(conversation.id) });
|
|
1287
|
-
});
|
|
1288
|
-
router.post("/orgs/:orgId/chats/:chatId/attachments", async (req, res) => {
|
|
1289
|
-
const orgId = req.params.orgId;
|
|
1290
|
-
const chatId = req.params.chatId;
|
|
1291
|
-
assertCompanyAccess(req, orgId);
|
|
1292
|
-
const conversation = await svc.getById(chatId);
|
|
1293
|
-
if (!conversation) {
|
|
1294
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1295
|
-
return;
|
|
1296
|
-
}
|
|
1297
|
-
if (conversation.orgId !== orgId) {
|
|
1298
|
-
res.status(422).json({ error: "Chat conversation does not belong to organization" });
|
|
1299
|
-
return;
|
|
1300
|
-
}
|
|
1301
|
-
try {
|
|
1302
|
-
await runSingleFileUpload(req, res);
|
|
1303
|
-
}
|
|
1304
|
-
catch (err) {
|
|
1305
|
-
if (err instanceof multer.MulterError) {
|
|
1306
|
-
if (err.code === "LIMIT_FILE_SIZE") {
|
|
1307
|
-
res.status(422).json({ error: `Attachment exceeds ${MAX_ATTACHMENT_BYTES} bytes` });
|
|
1308
|
-
return;
|
|
1309
|
-
}
|
|
1310
|
-
res.status(400).json({ error: err.message });
|
|
1311
|
-
return;
|
|
1312
|
-
}
|
|
1313
|
-
throw err;
|
|
1314
|
-
}
|
|
1315
|
-
const file = req.file;
|
|
1316
|
-
if (!file) {
|
|
1317
|
-
res.status(400).json({ error: "Missing file field 'file'" });
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
const contentType = (file.mimetype || "").toLowerCase();
|
|
1321
|
-
if (!isAllowedContentType(contentType)) {
|
|
1322
|
-
res.status(422).json({ error: `Unsupported attachment type: ${contentType || "unknown"}` });
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
if (file.buffer.length <= 0) {
|
|
1326
|
-
res.status(422).json({ error: "Attachment is empty" });
|
|
1327
|
-
return;
|
|
1328
|
-
}
|
|
1329
|
-
const parsedMeta = createChatAttachmentMetadataSchema.safeParse(req.body ?? {});
|
|
1330
|
-
if (!parsedMeta.success) {
|
|
1331
|
-
res.status(400).json({ error: "Invalid attachment metadata", details: parsedMeta.error.issues });
|
|
1332
|
-
return;
|
|
1333
|
-
}
|
|
1334
|
-
const actor = getActorInfo(req);
|
|
1335
|
-
const stored = await storage.putFile({
|
|
1336
|
-
orgId,
|
|
1337
|
-
namespace: `chats/${chatId}`,
|
|
1338
|
-
originalFilename: file.originalname || null,
|
|
1339
|
-
contentType,
|
|
1340
|
-
body: file.buffer,
|
|
1341
|
-
});
|
|
1342
|
-
const attachment = await svc.createAttachment({
|
|
1343
|
-
orgId,
|
|
1344
|
-
conversationId: chatId,
|
|
1345
|
-
messageId: parsedMeta.data.messageId,
|
|
1346
|
-
provider: stored.provider,
|
|
1347
|
-
objectKey: stored.objectKey,
|
|
1348
|
-
contentType: stored.contentType,
|
|
1349
|
-
byteSize: stored.byteSize,
|
|
1350
|
-
sha256: stored.sha256,
|
|
1351
|
-
originalFilename: stored.originalFilename,
|
|
1352
|
-
createdByAgentId: actor.agentId,
|
|
1353
|
-
createdByUserId: actor.actorType === "user" ? actor.actorId : null,
|
|
1354
|
-
});
|
|
1355
|
-
await logActivity(db, {
|
|
1356
|
-
orgId,
|
|
1357
|
-
actorType: actor.actorType,
|
|
1358
|
-
actorId: actor.actorId,
|
|
1359
|
-
agentId: actor.agentId,
|
|
1360
|
-
runId: actor.runId,
|
|
1361
|
-
action: "chat.attachment_added",
|
|
1362
|
-
entityType: "chat",
|
|
1363
|
-
entityId: chatId,
|
|
1364
|
-
details: {
|
|
1365
|
-
attachmentId: attachment.id,
|
|
1366
|
-
messageId: attachment.messageId,
|
|
1367
|
-
originalFilename: attachment.originalFilename,
|
|
1368
|
-
contentType: attachment.contentType,
|
|
1369
|
-
},
|
|
1370
|
-
});
|
|
1371
|
-
res.status(201).json(attachment);
|
|
1372
|
-
});
|
|
1373
|
-
router.post("/chats/:id/context-links", validate(createChatContextLinkSchema), async (req, res) => {
|
|
1374
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1375
|
-
if (!conversation) {
|
|
1376
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
await assertContextLinksBelongToCompany(conversation.orgId, [req.body]);
|
|
1380
|
-
const linked = await svc.addContextLink(conversation.id, conversation.orgId, req.body);
|
|
1381
|
-
const actor = getActorInfo(req);
|
|
1382
|
-
await logActivity(db, {
|
|
1383
|
-
orgId: conversation.orgId,
|
|
1384
|
-
actorType: actor.actorType,
|
|
1385
|
-
actorId: actor.actorId,
|
|
1386
|
-
agentId: actor.agentId,
|
|
1387
|
-
runId: actor.runId,
|
|
1388
|
-
action: "chat.context_linked",
|
|
1389
|
-
entityType: "chat",
|
|
1390
|
-
entityId: conversation.id,
|
|
1391
|
-
details: req.body,
|
|
1392
|
-
});
|
|
1393
|
-
res.status(201).json(linked);
|
|
1394
|
-
});
|
|
1395
|
-
router.post("/chats/:id/project-context", validate(setChatProjectContextSchema), async (req, res) => {
|
|
1396
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1397
|
-
if (!conversation) {
|
|
1398
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1399
|
-
return;
|
|
1400
|
-
}
|
|
1401
|
-
const projectId = req.body.projectId ?? null;
|
|
1402
|
-
if (projectId) {
|
|
1403
|
-
await assertContextLinksBelongToCompany(conversation.orgId, [{
|
|
1404
|
-
entityType: "project",
|
|
1405
|
-
entityId: projectId,
|
|
1406
|
-
}]);
|
|
1407
|
-
}
|
|
1408
|
-
const messages = await svc.listMessages(conversation.id);
|
|
1409
|
-
if (messages.length > 0) {
|
|
1410
|
-
res.status(409).json({ error: "Project context is locked after conversation starts" });
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
const updated = await svc.setProjectContextLink(conversation.id, conversation.orgId, projectId);
|
|
1414
|
-
if (!updated) {
|
|
1415
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1416
|
-
return;
|
|
1417
|
-
}
|
|
1418
|
-
const actor = getActorInfo(req);
|
|
1419
|
-
await logActivity(db, {
|
|
1420
|
-
orgId: conversation.orgId,
|
|
1421
|
-
actorType: actor.actorType,
|
|
1422
|
-
actorId: actor.actorId,
|
|
1423
|
-
agentId: actor.agentId,
|
|
1424
|
-
runId: actor.runId,
|
|
1425
|
-
action: "chat.project_context_updated",
|
|
1426
|
-
entityType: "chat",
|
|
1427
|
-
entityId: conversation.id,
|
|
1428
|
-
details: { projectId },
|
|
1429
|
-
});
|
|
1430
|
-
res.json(updated);
|
|
1431
|
-
});
|
|
1432
|
-
router.post("/chats/:id/convert-to-issue", validate(convertChatToIssueSchema), async (req, res) => {
|
|
1433
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1434
|
-
if (!conversation) {
|
|
1435
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1436
|
-
return;
|
|
1437
|
-
}
|
|
1438
|
-
const actor = getActorInfo(req);
|
|
1439
|
-
if (req.body.proposal?.goalId) {
|
|
1440
|
-
const goal = await goalsSvc.getById(req.body.proposal.goalId);
|
|
1441
|
-
if (!goal || goal.orgId !== conversation.orgId) {
|
|
1442
|
-
res.status(422).json({ error: "Goal must belong to the same organization" });
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
await assertCanConvertIssueProposal(req, conversation, {
|
|
1447
|
-
messageId: req.body.messageId ?? null,
|
|
1448
|
-
proposal: req.body.proposal ?? null,
|
|
1449
|
-
});
|
|
1450
|
-
const chatObservation = buildChatObservabilityContext(conversation, {
|
|
1451
|
-
rootExecutionId: req.body.messageId ?? `chat-convert:${conversation.id}`,
|
|
1452
|
-
trigger: "convert_to_issue",
|
|
1453
|
-
metadata: {
|
|
1454
|
-
source: "chat_route",
|
|
1455
|
-
messageId: req.body.messageId ?? null,
|
|
1456
|
-
},
|
|
1457
|
-
});
|
|
1458
|
-
const result = await withChatObservation(chatObservation, {
|
|
1459
|
-
name: "chat:convert_to_issue",
|
|
1460
|
-
asType: "tool",
|
|
1461
|
-
input: {
|
|
1462
|
-
conversationId: conversation.id,
|
|
1463
|
-
messageId: req.body.messageId ?? null,
|
|
1464
|
-
proposal: req.body.proposal ?? null,
|
|
1465
|
-
},
|
|
1466
|
-
}, async () => {
|
|
1467
|
-
const issue = await svc.convertToIssue(conversation.id, {
|
|
1468
|
-
actorUserId: actor.actorType === "user" ? actor.actorId : null,
|
|
1469
|
-
messageId: req.body.messageId ?? null,
|
|
1470
|
-
proposal: req.body.proposal ?? null,
|
|
1471
|
-
});
|
|
1472
|
-
const systemMessage = await svc.addMessage(conversation.id, {
|
|
1473
|
-
orgId: conversation.orgId,
|
|
1474
|
-
role: "system",
|
|
1475
|
-
kind: "system_event",
|
|
1476
|
-
body: `Created issue ${issue.identifier ?? issue.id} from this chat conversation.`,
|
|
1477
|
-
structuredPayload: {
|
|
1478
|
-
eventType: "issue_created",
|
|
1479
|
-
issueId: issue.id,
|
|
1480
|
-
issueIdentifier: issue.identifier,
|
|
1481
|
-
},
|
|
1482
|
-
});
|
|
1483
|
-
await logActivity(db, {
|
|
1484
|
-
orgId: conversation.orgId,
|
|
1485
|
-
actorType: actor.actorType,
|
|
1486
|
-
actorId: actor.actorId,
|
|
1487
|
-
agentId: actor.agentId,
|
|
1488
|
-
runId: actor.runId,
|
|
1489
|
-
action: "chat.issue_converted",
|
|
1490
|
-
entityType: "chat",
|
|
1491
|
-
entityId: conversation.id,
|
|
1492
|
-
details: {
|
|
1493
|
-
issueId: issue.id,
|
|
1494
|
-
issueIdentifier: issue.identifier,
|
|
1495
|
-
messageId: req.body.messageId ?? null,
|
|
1496
|
-
systemMessageId: systemMessage.id,
|
|
1497
|
-
},
|
|
1498
|
-
});
|
|
1499
|
-
await emitChatObservationEvent(chatObservation, {
|
|
1500
|
-
name: "chat.issue.created",
|
|
1501
|
-
metadata: {
|
|
1502
|
-
issueId: issue.id,
|
|
1503
|
-
issueIdentifier: issue.identifier,
|
|
1504
|
-
systemMessageId: systemMessage.id,
|
|
1505
|
-
},
|
|
1506
|
-
});
|
|
1507
|
-
return { issue, systemMessage };
|
|
1508
|
-
});
|
|
1509
|
-
res.status(201).json(result);
|
|
1510
|
-
});
|
|
1511
|
-
router.post("/chats/:id/messages/:messageId/operation-proposal/resolve", validate(resolveChatOperationProposalSchema), async (req, res) => {
|
|
1512
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1513
|
-
if (!conversation) {
|
|
1514
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
const actor = getActorInfo(req);
|
|
1518
|
-
const messageId = req.params.messageId;
|
|
1519
|
-
const chatObservation = buildChatObservabilityContext(conversation, {
|
|
1520
|
-
rootExecutionId: messageId,
|
|
1521
|
-
trigger: "resolve_operation_proposal",
|
|
1522
|
-
metadata: {
|
|
1523
|
-
action: req.body.action,
|
|
1524
|
-
decisionNote: req.body.decisionNote ?? null,
|
|
1525
|
-
},
|
|
1526
|
-
});
|
|
1527
|
-
const result = await withChatObservation(chatObservation, {
|
|
1528
|
-
name: "chat:resolve_operation_proposal",
|
|
1529
|
-
asType: "tool",
|
|
1530
|
-
input: {
|
|
1531
|
-
conversationId: conversation.id,
|
|
1532
|
-
messageId,
|
|
1533
|
-
action: req.body.action,
|
|
1534
|
-
},
|
|
1535
|
-
}, async () => {
|
|
1536
|
-
const resolved = await svc.resolveOperationProposal(conversation.id, messageId, {
|
|
1537
|
-
action: req.body.action,
|
|
1538
|
-
actorUserId: actor.actorType === "user" ? actor.actorId : null,
|
|
1539
|
-
decisionNote: req.body.decisionNote ?? null,
|
|
1540
|
-
});
|
|
1541
|
-
await emitChatObservationEvent(chatObservation, {
|
|
1542
|
-
name: "chat.operation_proposal.resolved",
|
|
1543
|
-
metadata: {
|
|
1544
|
-
action: req.body.action,
|
|
1545
|
-
messageId: resolved.message.id,
|
|
1546
|
-
systemMessageId: resolved.systemMessage.id,
|
|
1547
|
-
},
|
|
1548
|
-
});
|
|
1549
|
-
return resolved;
|
|
1550
|
-
});
|
|
1551
|
-
res.status(201).json(result);
|
|
1552
|
-
});
|
|
1553
|
-
router.post("/chats/:id/resolve", async (req, res) => {
|
|
1554
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1555
|
-
if (!conversation) {
|
|
1556
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1557
|
-
return;
|
|
1558
|
-
}
|
|
1559
|
-
const resolved = await svc.resolve(conversation.id);
|
|
1560
|
-
const actor = getActorInfo(req);
|
|
1561
|
-
await logActivity(db, {
|
|
1562
|
-
orgId: conversation.orgId,
|
|
1563
|
-
actorType: actor.actorType,
|
|
1564
|
-
actorId: actor.actorId,
|
|
1565
|
-
agentId: actor.agentId,
|
|
1566
|
-
runId: actor.runId,
|
|
1567
|
-
action: "chat.resolved",
|
|
1568
|
-
entityType: "chat",
|
|
1569
|
-
entityId: conversation.id,
|
|
1570
|
-
});
|
|
1571
|
-
res.json(resolved ? await assistantSvc.enrichConversation(resolved) : null);
|
|
1572
|
-
});
|
|
1573
|
-
router.post("/chats/:id/read", async (req, res) => {
|
|
1574
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1575
|
-
if (!conversation) {
|
|
1576
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1577
|
-
return;
|
|
1578
|
-
}
|
|
1579
|
-
const userId = boardUserId(req);
|
|
1580
|
-
const state = await svc.markRead(conversation.id, conversation.orgId, userId);
|
|
1581
|
-
res.status(201).json({
|
|
1582
|
-
conversationId: conversation.id,
|
|
1583
|
-
lastReadAt: state.lastReadAt,
|
|
1584
|
-
});
|
|
1585
|
-
});
|
|
1586
|
-
router.post("/chats/:id/user-state", validate(updateChatConversationUserStateSchema), async (req, res) => {
|
|
1587
|
-
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1588
|
-
if (!conversation) {
|
|
1589
|
-
res.status(404).json({ error: "Chat conversation not found" });
|
|
1590
|
-
return;
|
|
1591
|
-
}
|
|
1592
|
-
const userId = boardUserId(req);
|
|
1593
|
-
if (typeof req.body.pinned === "boolean") {
|
|
1594
|
-
await svc.setPinned(conversation.id, conversation.orgId, userId, req.body.pinned);
|
|
1595
|
-
}
|
|
1596
|
-
if (typeof req.body.unread === "boolean") {
|
|
1597
|
-
if (req.body.unread) {
|
|
1598
|
-
await svc.markUnread(conversation.id, conversation.orgId, userId);
|
|
1599
|
-
}
|
|
1600
|
-
else {
|
|
1601
|
-
await svc.markRead(conversation.id, conversation.orgId, userId);
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
const refreshed = await svc.getById(conversation.id, userId);
|
|
1605
|
-
res.json(await assistantSvc.enrichConversation(refreshed));
|
|
957
|
+
registerChatStreamRoutes({
|
|
958
|
+
router,
|
|
959
|
+
db,
|
|
960
|
+
storage,
|
|
961
|
+
svc,
|
|
962
|
+
assistantSvc,
|
|
963
|
+
agentsSvc,
|
|
964
|
+
issuesSvc,
|
|
965
|
+
projectsSvc,
|
|
966
|
+
goalsSvc,
|
|
967
|
+
access,
|
|
968
|
+
operatorProfiles,
|
|
969
|
+
assertConversationAccess,
|
|
970
|
+
boardUserId,
|
|
971
|
+
assertCanAssignTasks,
|
|
972
|
+
runSingleFileUpload,
|
|
973
|
+
runMessageFileUpload,
|
|
974
|
+
isMultipartRequest,
|
|
975
|
+
uploadedMessageFiles,
|
|
976
|
+
validateUploadedMessageFiles,
|
|
977
|
+
buildChatObservabilityContext,
|
|
978
|
+
withChatObservation,
|
|
979
|
+
emitChatObservationEvent,
|
|
980
|
+
summarizeChatObservationMessages,
|
|
981
|
+
modelTurnInputFromInvocationMeta,
|
|
982
|
+
buildChatTraceInput,
|
|
983
|
+
mergeChatInvocationTraceMetadata,
|
|
984
|
+
logChatMessagesAdded,
|
|
985
|
+
assertContextLinksBelongToCompany,
|
|
986
|
+
turnContextFromUserMessage,
|
|
987
|
+
addUserMessage,
|
|
988
|
+
attachFilesToUserMessage,
|
|
989
|
+
loadAssistantInput,
|
|
990
|
+
chatReplyingAgentId,
|
|
991
|
+
assertCanConvertIssueProposal,
|
|
992
|
+
persistAssistantReply,
|
|
993
|
+
attachGeneratedFilesToPartialMessage,
|
|
994
|
+
persistPartialAssistantMessage,
|
|
995
|
+
writeStreamEvent,
|
|
1606
996
|
});
|
|
1607
997
|
return router;
|
|
1608
998
|
}
|