@rudderhq/server 0.3.6-canary.9 → 0.4.0
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/register-api-routes.d.ts.map +1 -1
- package/dist/bootstrap/register-api-routes.js +2 -0
- package/dist/bootstrap/register-api-routes.js.map +1 -1
- package/dist/bundled-plugins/plugin-linear/dist/worker.js +35 -2
- package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -26
- package/dist/index.js.map +1 -1
- package/dist/routes/activity.d.ts +1 -1
- package/dist/routes/activity.d.ts.map +1 -1
- package/dist/routes/activity.js +21 -5
- package/dist/routes/activity.js.map +1 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +254 -4
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/agents.management-routes.d.ts.map +1 -1
- package/dist/routes/agents.management-routes.js +132 -40
- package/dist/routes/agents.management-routes.js.map +1 -1
- package/dist/routes/automations.d.ts +8 -0
- package/dist/routes/automations.d.ts.map +1 -1
- package/dist/routes/automations.js.map +1 -1
- package/dist/routes/chats.d.ts.map +1 -1
- package/dist/routes/chats.js +228 -115
- package/dist/routes/chats.js.map +1 -1
- package/dist/routes/chats.stream-routes.d.ts.map +1 -1
- package/dist/routes/chats.stream-routes.js +94 -5
- package/dist/routes/chats.stream-routes.js.map +1 -1
- package/dist/routes/issues.comments-attachments.d.ts.map +1 -1
- package/dist/routes/issues.comments-attachments.js +72 -83
- package/dist/routes/issues.comments-attachments.js.map +1 -1
- package/dist/routes/issues.d.ts +8 -0
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +0 -4
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/issues.mutations.d.ts.map +1 -1
- package/dist/routes/issues.mutations.js +2 -26
- package/dist/routes/issues.mutations.js.map +1 -1
- package/dist/routes/messenger.d.ts.map +1 -1
- package/dist/routes/messenger.js +33 -1
- package/dist/routes/messenger.js.map +1 -1
- package/dist/routes/orgs.d.ts.map +1 -1
- package/dist/routes/orgs.js +16 -0
- package/dist/routes/orgs.js.map +1 -1
- package/dist/routes/plugin-ui-static.d.ts +4 -4
- package/dist/routes/plugin-ui-static.js +5 -5
- package/dist/routes/plugin-ui-static.js.map +1 -1
- package/dist/routes/plugins.d.ts +4 -4
- package/dist/routes/plugins.js +10 -10
- package/dist/routes/plugins.operations-routes.d.ts +1 -1
- package/dist/routes/plugins.operations-routes.js +2 -2
- package/dist/routes/plugins.operations-routes.js.map +1 -1
- package/dist/routes/run-intelligence.js +5 -5
- package/dist/routes/run-intelligence.js.map +1 -1
- package/dist/routes/website-metadata.d.ts +8 -0
- package/dist/routes/website-metadata.d.ts.map +1 -0
- package/dist/routes/website-metadata.js +67 -0
- package/dist/routes/website-metadata.js.map +1 -0
- package/dist/services/activity.d.ts.map +1 -1
- package/dist/services/activity.js +1 -1
- package/dist/services/activity.js.map +1 -1
- package/dist/services/agent-instructions.d.ts +1 -0
- package/dist/services/agent-instructions.d.ts.map +1 -1
- package/dist/services/agent-instructions.js +57 -6
- package/dist/services/agent-instructions.js.map +1 -1
- package/dist/services/agent-run-context.d.ts +3 -1
- package/dist/services/agent-run-context.d.ts.map +1 -1
- package/dist/services/agent-run-context.js +7 -0
- package/dist/services/agent-run-context.js.map +1 -1
- package/dist/services/agent-startup-context.d.ts +2 -1
- package/dist/services/agent-startup-context.d.ts.map +1 -1
- package/dist/services/agent-startup-context.js +6 -26
- package/dist/services/agent-startup-context.js.map +1 -1
- package/dist/services/agents.d.ts +9 -1
- package/dist/services/agents.d.ts.map +1 -1
- package/dist/services/agents.js.map +1 -1
- package/dist/services/approvals.d.ts +8 -0
- package/dist/services/approvals.d.ts.map +1 -1
- package/dist/services/approvals.js.map +1 -1
- package/dist/services/automation-chat-output.d.ts +1 -1
- package/dist/services/automations.d.ts +4 -4
- package/dist/services/automations.d.ts.map +1 -1
- package/dist/services/automations.js +12 -0
- package/dist/services/automations.js.map +1 -1
- package/dist/services/budgets.d.ts +8 -0
- package/dist/services/budgets.d.ts.map +1 -1
- package/dist/services/budgets.js.map +1 -1
- package/dist/services/calendar.d.ts +2 -2
- package/dist/services/calendar.js +3 -3
- package/dist/services/calendar.js.map +1 -1
- package/dist/services/chat-agent-runs.d.ts +2 -0
- package/dist/services/chat-agent-runs.d.ts.map +1 -1
- package/dist/services/chat-agent-runs.js +6 -0
- package/dist/services/chat-agent-runs.js.map +1 -1
- package/dist/services/chat-assistant.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.d.ts +1 -0
- package/dist/services/chat-assistant.helpers.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.js +7 -10
- package/dist/services/chat-assistant.helpers.js.map +1 -1
- package/dist/services/chat-assistant.js +23 -6
- package/dist/services/chat-assistant.js.map +1 -1
- package/dist/services/chat-generation-locks.d.ts +6 -1
- package/dist/services/chat-generation-locks.d.ts.map +1 -1
- package/dist/services/chat-generation-locks.js +20 -2
- package/dist/services/chat-generation-locks.js.map +1 -1
- package/dist/services/chat-title-generation.d.ts +36 -0
- package/dist/services/chat-title-generation.d.ts.map +1 -0
- package/dist/services/chat-title-generation.js +107 -0
- package/dist/services/chat-title-generation.js.map +1 -0
- package/dist/services/chats.d.ts +471 -25
- package/dist/services/chats.d.ts.map +1 -1
- package/dist/services/chats.helpers.d.ts +2 -2
- package/dist/services/chats.js +651 -35
- package/dist/services/chats.js.map +1 -1
- package/dist/services/costs.d.ts +1 -1
- package/dist/services/finance.d.ts +2 -2
- package/dist/services/finance.js +1 -1
- package/dist/services/finance.js.map +1 -1
- package/dist/services/goals.d.ts +8 -0
- package/dist/services/goals.d.ts.map +1 -1
- package/dist/services/goals.js.map +1 -1
- package/dist/services/heartbeat-run-reference.d.ts +1 -0
- package/dist/services/heartbeat-run-reference.d.ts.map +1 -1
- package/dist/services/heartbeat-run-reference.js +3 -2
- package/dist/services/heartbeat-run-reference.js.map +1 -1
- package/dist/services/integrations/agent-integrations.d.ts +19 -0
- package/dist/services/integrations/agent-integrations.d.ts.map +1 -1
- package/dist/services/integrations/agent-integrations.js +30 -0
- package/dist/services/integrations/agent-integrations.js.map +1 -1
- package/dist/services/integrations/feishu/app-registration.d.ts +74 -0
- package/dist/services/integrations/feishu/app-registration.d.ts.map +1 -0
- package/dist/services/integrations/feishu/app-registration.js +226 -0
- package/dist/services/integrations/feishu/app-registration.js.map +1 -0
- package/dist/services/integrations/feishu/inbound-dispatcher-db.d.ts +4 -0
- package/dist/services/integrations/feishu/inbound-dispatcher-db.d.ts.map +1 -1
- package/dist/services/integrations/feishu/inbound-dispatcher-db.js +35 -5
- package/dist/services/integrations/feishu/inbound-dispatcher-db.js.map +1 -1
- package/dist/services/integrations/feishu/inbound-dispatcher.d.ts +2 -0
- package/dist/services/integrations/feishu/inbound-dispatcher.d.ts.map +1 -1
- package/dist/services/integrations/feishu/inbound-dispatcher.js.map +1 -1
- package/dist/services/integrations/feishu/runtime-registry.d.ts +20 -0
- package/dist/services/integrations/feishu/runtime-registry.d.ts.map +1 -0
- package/dist/services/integrations/feishu/runtime-registry.js +41 -0
- package/dist/services/integrations/feishu/runtime-registry.js.map +1 -0
- package/dist/services/integrations/feishu/runtime.d.ts +21 -23
- package/dist/services/integrations/feishu/runtime.d.ts.map +1 -1
- package/dist/services/integrations/feishu/runtime.js +135 -45
- package/dist/services/integrations/feishu/runtime.js.map +1 -1
- package/dist/services/integrations/feishu/user-bindings.d.ts +22 -0
- package/dist/services/integrations/feishu/user-bindings.d.ts.map +1 -0
- package/dist/services/integrations/feishu/user-bindings.js +57 -0
- package/dist/services/integrations/feishu/user-bindings.js.map +1 -0
- package/dist/services/issue-approvals.d.ts +2 -2
- package/dist/services/issue-review-wakeup.js +1 -1
- package/dist/services/issue-review-wakeup.js.map +1 -1
- package/dist/services/issues.comments-attachments.d.ts +3 -3
- package/dist/services/issues.d.ts +14 -6
- package/dist/services/issues.d.ts.map +1 -1
- package/dist/services/issues.helpers.d.ts +9 -1
- package/dist/services/issues.helpers.d.ts.map +1 -1
- package/dist/services/issues.helpers.js +8 -0
- package/dist/services/issues.helpers.js.map +1 -1
- package/dist/services/issues.js +1 -1
- package/dist/services/issues.js.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.catalog.d.ts +1 -1
- package/dist/services/library-entries.d.ts +8 -0
- package/dist/services/library-entries.d.ts.map +1 -1
- package/dist/services/library-entries.js +8 -0
- package/dist/services/library-entries.js.map +1 -1
- package/dist/services/messenger.d.ts +19 -4
- package/dist/services/messenger.d.ts.map +1 -1
- package/dist/services/messenger.js +136 -18
- package/dist/services/messenger.js.map +1 -1
- package/dist/services/plugin-capability-validator.d.ts +1 -1
- package/dist/services/plugin-capability-validator.js +2 -2
- package/dist/services/plugin-dev-watcher.js +1 -1
- package/dist/services/plugin-event-bus.d.ts +3 -3
- package/dist/services/plugin-event-bus.js +3 -3
- package/dist/services/plugin-job-coordinator.d.ts +1 -1
- package/dist/services/plugin-job-coordinator.js +1 -1
- package/dist/services/plugin-job-scheduler.d.ts +1 -1
- package/dist/services/plugin-job-scheduler.js +1 -1
- package/dist/services/plugin-job-store.d.ts +2 -2
- package/dist/services/plugin-job-store.js +2 -2
- package/dist/services/plugin-lifecycle.d.ts +4 -4
- package/dist/services/plugin-lifecycle.js +3 -3
- package/dist/services/plugin-loader.core.d.ts +4 -4
- package/dist/services/plugin-loader.core.js +2 -2
- package/dist/services/plugin-loader.core.js.map +1 -1
- package/dist/services/plugin-loader.d.ts +3 -3
- package/dist/services/plugin-loader.helpers.d.ts +26 -25
- package/dist/services/plugin-loader.helpers.d.ts.map +1 -1
- package/dist/services/plugin-loader.helpers.js +10 -9
- package/dist/services/plugin-loader.helpers.js.map +1 -1
- package/dist/services/plugin-loader.js +3 -3
- package/dist/services/plugin-loader.worker-paths.d.ts +3 -3
- package/dist/services/plugin-manifest-validator.d.ts +2 -2
- package/dist/services/plugin-registry.d.ts +9 -9
- package/dist/services/plugin-registry.js +1 -1
- package/dist/services/plugin-secrets-handler.d.ts +2 -2
- package/dist/services/plugin-secrets-handler.js +2 -2
- package/dist/services/plugin-state-store.d.ts +3 -3
- package/dist/services/plugin-state-store.js +3 -3
- package/dist/services/plugin-stream-bus.d.ts +1 -1
- package/dist/services/plugin-stream-bus.js +1 -1
- package/dist/services/plugin-tool-dispatcher.d.ts +2 -2
- package/dist/services/plugin-tool-dispatcher.js +2 -2
- package/dist/services/plugin-tool-registry.d.ts +2 -2
- package/dist/services/plugin-tool-registry.js +2 -2
- package/dist/services/plugin-worker-manager.d.ts +4 -4
- package/dist/services/plugin-worker-manager.d.ts.map +1 -1
- package/dist/services/plugin-worker-manager.js +8 -7
- package/dist/services/plugin-worker-manager.js.map +1 -1
- package/dist/services/run-intelligence.js +3 -3
- package/dist/services/run-intelligence.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.core.d.ts +9 -1
- package/dist/services/runtime-kernel/heartbeat.core.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.core.js +16 -5
- package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.d.ts +3 -3
- package/dist/services/runtime-kernel/heartbeat.execute.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.execute.js +17 -3
- package/dist/services/runtime-kernel/heartbeat.execute.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.misc.js +1 -1
- package/dist/services/runtime-kernel/heartbeat.recovery.d.ts +1 -1
- package/dist/services/runtime-kernel/heartbeat.recovery.js +7 -7
- package/dist/services/runtime-kernel/heartbeat.recovery.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.release.js +4 -4
- package/dist/services/runtime-kernel/heartbeat.release.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.wakeup.js +1 -1
- package/dist/services/sidebar-badges.d.ts.map +1 -1
- package/dist/services/sidebar-badges.js +13 -1
- package/dist/services/sidebar-badges.js.map +1 -1
- package/dist/services/title-generation.d.ts +13 -0
- package/dist/services/title-generation.d.ts.map +1 -0
- package/dist/services/title-generation.js +77 -0
- package/dist/services/title-generation.js.map +1 -0
- package/dist/services/website-metadata.d.ts +17 -0
- package/dist/services/website-metadata.d.ts.map +1 -0
- package/dist/services/website-metadata.js +293 -0
- package/dist/services/website-metadata.js.map +1 -0
- package/dist/services/workspace-backups.d.ts +22 -0
- package/dist/services/workspace-backups.d.ts.map +1 -1
- package/dist/services/workspace-backups.js +161 -5
- package/dist/services/workspace-backups.js.map +1 -1
- package/dist/services/workspace-runtime.services.d.ts +1 -1
- package/package.json +14 -13
- package/resources/bundled-skills/rudder/SKILL.md +7 -6
- package/resources/bundled-skills/rudder/references/cli-reference.md +3 -3
- package/resources/bundled-skills/rudder-create-plugin/SKILL.md +2 -2
- package/skills/rudder/SKILL.md +7 -6
- package/skills/rudder/references/cli-reference.md +3 -3
- package/skills/rudder-create-plugin/SKILL.md +2 -2
- package/ui-dist/assets/{_basePickBy-CM0XatHw.js → _basePickBy-CyhMvFCw.js} +1 -1
- package/ui-dist/assets/{_baseUniq-CdBBmdoP.js → _baseUniq-k3x-egdv.js} +1 -1
- package/ui-dist/assets/{arc-DSTtxyJ9.js → arc-DVwZMGLR.js} +1 -1
- package/ui-dist/assets/{architectureDiagram-2XIMDMQ5-BkHMYb5I.js → architectureDiagram-2XIMDMQ5-BvKp7DHW.js} +1 -1
- package/ui-dist/assets/{blockDiagram-WCTKOSBZ-EYczZxwW.js → blockDiagram-WCTKOSBZ-CQ0KLoGd.js} +1 -1
- package/ui-dist/assets/{c4Diagram-IC4MRINW-Xo9qijMi.js → c4Diagram-IC4MRINW-BY44eeD7.js} +1 -1
- package/ui-dist/assets/channel-Cb8ybYSt.js +1 -0
- package/ui-dist/assets/{chunk-4BX2VUAB-CKzta1FF.js → chunk-4BX2VUAB-D7D6PuZU.js} +1 -1
- package/ui-dist/assets/{chunk-55IACEB6-BxxUB0ww.js → chunk-55IACEB6-CraDwywJ.js} +1 -1
- package/ui-dist/assets/{chunk-FMBD7UC4-0F4oxVtY.js → chunk-FMBD7UC4-BGYh4kbq.js} +1 -1
- package/ui-dist/assets/{chunk-JSJVCQXG-CVMPMlVD.js → chunk-JSJVCQXG-DndeOLp_.js} +1 -1
- package/ui-dist/assets/{chunk-KX2RTZJC-lPrAWT94.js → chunk-KX2RTZJC-Cx0eOadl.js} +1 -1
- package/ui-dist/assets/{chunk-NQ4KR5QH-Bufcm7Iv.js → chunk-NQ4KR5QH-PNVbQ_36.js} +1 -1
- package/ui-dist/assets/{chunk-QZHKN3VN-CucmdWnl.js → chunk-QZHKN3VN-DKsTZ1-C.js} +1 -1
- package/ui-dist/assets/{chunk-WL4C6EOR-Dz0oYQrJ.js → chunk-WL4C6EOR-B4aSDSws.js} +1 -1
- package/ui-dist/assets/classDiagram-VBA2DB6C-US2diuPm.js +1 -0
- package/ui-dist/assets/classDiagram-v2-RAHNMMFH-US2diuPm.js +1 -0
- package/ui-dist/assets/clone-CbFoFrhF.js +1 -0
- package/ui-dist/assets/{cose-bilkent-S5V4N54A-DzyX-Er8.js → cose-bilkent-S5V4N54A-DwgS7_iT.js} +1 -1
- package/ui-dist/assets/{dagre-KLK3FWXG-BbZzCKuN.js → dagre-KLK3FWXG-CGMeHr1L.js} +1 -1
- package/ui-dist/assets/{diagram-E7M64L7V-B5Rb7Bm4.js → diagram-E7M64L7V-1AVTOsRS.js} +1 -1
- package/ui-dist/assets/{diagram-IFDJBPK2-Cpu1Xc8G.js → diagram-IFDJBPK2-hfbRtuHq.js} +1 -1
- package/ui-dist/assets/{diagram-P4PSJMXO-kLfHqRlk.js → diagram-P4PSJMXO-BypSVEur.js} +1 -1
- package/ui-dist/assets/{erDiagram-INFDFZHY-rCnUyQUb.js → erDiagram-INFDFZHY-DWMZC8pq.js} +1 -1
- package/ui-dist/assets/{flowDiagram-PKNHOUZH-BhOz8cvV.js → flowDiagram-PKNHOUZH-C4ODl03j.js} +1 -1
- package/ui-dist/assets/{ganttDiagram-A5KZAMGK-Csg9g3hz.js → ganttDiagram-A5KZAMGK-K0UbcKpB.js} +1 -1
- package/ui-dist/assets/{gitGraphDiagram-K3NZZRJ6-DLPnSlRs.js → gitGraphDiagram-K3NZZRJ6-CEtw8QBQ.js} +1 -1
- package/ui-dist/assets/{graph-BrxYh68N.js → graph-D-YEM3eO.js} +1 -1
- package/ui-dist/assets/{index-DMkClCka.js → index--e_5aFtV.js} +1 -1
- package/ui-dist/assets/{index-G_y-oBne.js → index--wGHASfH.js} +1 -1
- package/ui-dist/assets/index-2sHXDbqQ.css +1 -0
- package/ui-dist/assets/{index-BQW242nS.js → index-8D4SrlCZ.js} +1 -1
- package/ui-dist/assets/{index-DpdsNIGb.js → index-B9FglFcf.js} +1 -1
- package/ui-dist/assets/{index-D4FFno9t.js → index-BOLNi_9C.js} +1 -1
- package/ui-dist/assets/{index-COBwmF-C.js → index-BVSwDm4x.js} +1 -1
- package/ui-dist/assets/{index-BkzdTp2b.js → index-C4vZZ0jB.js} +1 -1
- package/ui-dist/assets/{index-Br07RRw1.js → index-CMZ9kRE0.js} +1 -1
- package/ui-dist/assets/{index-mOyLwPeE.js → index-CZb2W71E.js} +1 -1
- package/ui-dist/assets/{index-DiMeST8g.js → index-Cfp9ooqM.js} +1 -1
- package/ui-dist/assets/{index-BeZv_Z0b.js → index-CyWWtF_x.js} +1 -1
- package/ui-dist/assets/{index-CsraICzz.js → index-CzQXnPD8.js} +1 -1
- package/ui-dist/assets/{index-Bw8MgLaM.js → index-D2uGk78l.js} +446 -446
- package/ui-dist/assets/{index-Cb2qts0o.js → index-DVl9xsgP.js} +1 -1
- package/ui-dist/assets/{index-D0rP99dj.js → index-T4jxRzoA.js} +1 -1
- package/ui-dist/assets/{index-B6_gFYNj.js → index-V0iKRmt7.js} +1 -1
- package/ui-dist/assets/{index-Dj72ldIc.js → index-byosaKUg.js} +1 -1
- package/ui-dist/assets/{index-D_06pAuN.js → index-nUtypsmU.js} +1 -1
- package/ui-dist/assets/{infoDiagram-LFFYTUFH-CRBKgiEf.js → infoDiagram-LFFYTUFH-C6TFdmXf.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-PHBUUO56-DI3jquVE.js → ishikawaDiagram-PHBUUO56-DyiJqs9l.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-4ABVD52K-DDFZ2Q6D.js → journeyDiagram-4ABVD52K-A-q8eZgk.js} +1 -1
- package/ui-dist/assets/{kanban-definition-K7BYSVSG-yL5u3cXV.js → kanban-definition-K7BYSVSG-B_1rE7-5.js} +1 -1
- package/ui-dist/assets/{layout-DDZaRkp7.js → layout-kMGiiRYg.js} +1 -1
- package/ui-dist/assets/{linear-CWngWuQa.js → linear-PdbwVMlL.js} +1 -1
- package/ui-dist/assets/{mermaid.core-CQuYoq9K.js → mermaid.core-Cev3K7jk.js} +4 -4
- package/ui-dist/assets/{mindmap-definition-YRQLILUH-BwSsHtTO.js → mindmap-definition-YRQLILUH-C8xkWcsS.js} +1 -1
- package/ui-dist/assets/{pieDiagram-SKSYHLDU-BasUkvwH.js → pieDiagram-SKSYHLDU-D2I_J-RQ.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-337W2JSQ-D0D2xp36.js → quadrantDiagram-337W2JSQ-B6BBePuG.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-Z7DCOOCP-CztN9kDh.js → requirementDiagram-Z7DCOOCP-BUl7tTbs.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-WA2Y5GQK-2xDqN9ox.js → sankeyDiagram-WA2Y5GQK-Dus4b_vo.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-2WXFIKYE-CO3OUPIJ.js → sequenceDiagram-2WXFIKYE-DnwzyMvt.js} +1 -1
- package/ui-dist/assets/{stateDiagram-RAJIS63D-DuQ1QZcT.js → stateDiagram-RAJIS63D-CWYWUh48.js} +1 -1
- package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-yRuBqnCA.js +1 -0
- package/ui-dist/assets/{timeline-definition-YZTLITO2-CnOxbQeb.js → timeline-definition-YZTLITO2-D7vwtWgR.js} +1 -1
- package/ui-dist/assets/{treemap-KZPCXAKY-DD77IFOl.js → treemap-KZPCXAKY-CGCh4N8D.js} +1 -1
- package/ui-dist/assets/{vennDiagram-LZ73GAT5-DOXTGJn1.js → vennDiagram-LZ73GAT5-Bq1y4idx.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-JWTSCODW-DWkrcdri.js → xychartDiagram-JWTSCODW-CMFdYJaJ.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/assets/channel-BRnz7pSY.js +0 -1
- package/ui-dist/assets/classDiagram-VBA2DB6C-Q3YuI9dv.js +0 -1
- package/ui-dist/assets/classDiagram-v2-RAHNMMFH-Q3YuI9dv.js +0 -1
- package/ui-dist/assets/clone-C1exIyAN.js +0 -1
- package/ui-dist/assets/index-Dz8xxyqB.css +0 -1
- package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-DQbZqbl9.js +0 -1
package/dist/routes/chats.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addChatMessageSchema, chatAutomationCreateFromStructuredPayload, createChatConversationSchema,
|
|
1
|
+
import { addChatMessageSchema, cancelChatQueuedMessageSchema, chatAutomationCreateFromStructuredPayload, createChatConversationSchema, createChatQueuedMessageSchema, forkChatConversationSchema, steerChatQueuedMessageSchema, updateChatConversationSchema, updateChatQueuedMessageSchema } from "@rudderhq/shared";
|
|
2
2
|
import { Router } from "express";
|
|
3
3
|
import multer from "multer";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -11,11 +11,13 @@ import { validate } from "../middleware/validate.js";
|
|
|
11
11
|
import { assertTimeZone } from "../services/automations.scheduler.js";
|
|
12
12
|
import { chatAgentRunService } from "../services/chat-agent-runs.js";
|
|
13
13
|
import { CHAT_ASSISTANT_USER_ERROR_MESSAGE, chatAssistantService, ChatAssistantStreamError, userVisiblePartialBodyFromError, } from "../services/chat-assistant.js";
|
|
14
|
-
import { cancelAndReleaseActiveChatGeneration, claimChatGeneration, hasActiveChatGeneration } from "../services/chat-generation-locks.js";
|
|
14
|
+
import { cancelAndReleaseActiveChatGeneration, claimChatGeneration, getActiveChatGeneration, hasActiveChatGeneration } from "../services/chat-generation-locks.js";
|
|
15
|
+
import { buildChatTitlePromptFromMessages, chatTitleGenerationService, } from "../services/chat-title-generation.js";
|
|
15
16
|
import { validateCron } from "../services/cron.js";
|
|
16
17
|
import { accessService, agentService, automationService, chatService, goalService, heartbeatService, issueService, logActivity, operatorProfileService, organizationService, productIntelligenceService, projectService, } from "../services/index.js";
|
|
17
18
|
import { sanitizeStartupContextPromptForPersistence } from "../services/runtime-kernel/heartbeat.core.js";
|
|
18
19
|
import { summarizeRuntimeSkillsForTrace } from "../services/runtime-trace-metadata.js";
|
|
20
|
+
import { runtimeResultText, sanitizeGeneratedTitle, } from "../services/title-generation.js";
|
|
19
21
|
import { assertBoard, assertCompanyAccess, getActorInfo } from "./authz.js";
|
|
20
22
|
import { wakeIssueAssigneeAfterChatConversion } from "./chat-issue-assignment-wakeup.js";
|
|
21
23
|
import { registerChatStreamRoutes } from "./chats.stream-routes.js";
|
|
@@ -34,9 +36,7 @@ export function chatRoutes(db, storage) {
|
|
|
34
36
|
const operatorProfiles = operatorProfileService(db);
|
|
35
37
|
const heartbeat = heartbeatService(db);
|
|
36
38
|
const productIntelligence = productIntelligenceService(db);
|
|
37
|
-
const
|
|
38
|
-
const CHAT_TITLE_MAX_LENGTH = 80;
|
|
39
|
-
const CHAT_TITLE_REGENERATION_MESSAGE_LIMIT = 12;
|
|
39
|
+
const chatTitles = chatTitleGenerationService({ chats: svc, productIntelligence });
|
|
40
40
|
const CHAT_ASSISTANT_RECOVERABLE_FAILURE_FALLBACK_MESSAGE = "The assistant reply could not be completed. Rudder saved this attempt for diagnostics; retry when ready.";
|
|
41
41
|
const upload = multer({
|
|
42
42
|
storage: multer.memoryStorage(),
|
|
@@ -109,113 +109,12 @@ export function chatRoutes(db, storage) {
|
|
|
109
109
|
function stringQuery(value) {
|
|
110
110
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
? `${normalized.slice(0, CHAT_TITLE_SOURCE_LIMIT)}\n\n[Input truncated for title generation.]`
|
|
116
|
-
: normalized;
|
|
117
|
-
return [
|
|
118
|
-
"Generate a concise title for this chat.",
|
|
119
|
-
"Rules:",
|
|
120
|
-
"- Return only the title text.",
|
|
121
|
-
"- No quotes, markdown, emoji, or trailing punctuation.",
|
|
122
|
-
`- Maximum ${CHAT_TITLE_MAX_LENGTH} characters.`,
|
|
123
|
-
"",
|
|
124
|
-
`${sourceLabel}:`,
|
|
125
|
-
source,
|
|
126
|
-
].join("\n");
|
|
127
|
-
}
|
|
128
|
-
function runtimeResultText(result) {
|
|
129
|
-
if (!result || typeof result !== "object")
|
|
130
|
-
return "";
|
|
131
|
-
const candidate = result;
|
|
132
|
-
if (candidate.timedOut === true || candidate.signal !== null || candidate.exitCode !== 0)
|
|
133
|
-
return "";
|
|
134
|
-
for (const key of ["output", "stdout", "text", "message", "summary"]) {
|
|
135
|
-
const value = candidate[key];
|
|
136
|
-
if (typeof value === "string" && value.trim().length > 0)
|
|
137
|
-
return value;
|
|
138
|
-
}
|
|
139
|
-
if (candidate.resultJson && typeof candidate.resultJson === "object") {
|
|
140
|
-
const resultJson = candidate.resultJson;
|
|
141
|
-
for (const key of ["output", "stdout", "text", "message", "summary"]) {
|
|
142
|
-
const value = resultJson[key];
|
|
143
|
-
if (typeof value === "string" && value.trim().length > 0)
|
|
144
|
-
return value;
|
|
145
|
-
}
|
|
112
|
+
function assertChatLocalMutationAllowed(conversation) {
|
|
113
|
+
if (conversation.mutability === "external_bound_chat") {
|
|
114
|
+
throw conflict("Fork this Feishu chat to continue in Rudder");
|
|
146
115
|
}
|
|
147
|
-
return "";
|
|
148
|
-
}
|
|
149
|
-
function sanitizeGeneratedChatTitle(raw) {
|
|
150
|
-
let title = raw
|
|
151
|
-
.replace(/^```(?:\w+)?\s*/i, "")
|
|
152
|
-
.replace(/\s*```$/i, "")
|
|
153
|
-
.trim()
|
|
154
|
-
.replace(/^#+\s*/, "")
|
|
155
|
-
.replace(/^[-*]\s*/, "")
|
|
156
|
-
.replace(/\s+/g, " ")
|
|
157
|
-
.trim();
|
|
158
|
-
title = title.replace(/^["'`]+|["'`]+$/g, "").trim();
|
|
159
|
-
title = title.replace(/[.!?:;]+$/g, "").trim();
|
|
160
|
-
if (!title)
|
|
161
|
-
return null;
|
|
162
|
-
return title.length > CHAT_TITLE_MAX_LENGTH
|
|
163
|
-
? title.slice(0, CHAT_TITLE_MAX_LENGTH).trim()
|
|
164
|
-
: title;
|
|
165
|
-
}
|
|
166
|
-
function fallbackChatTitleFromBody(body) {
|
|
167
|
-
return formatMessengerTitle(body, { max: CHAT_TITLE_MAX_LENGTH });
|
|
168
|
-
}
|
|
169
|
-
function buildChatTitlePromptFromMessages(messages) {
|
|
170
|
-
const source = messages
|
|
171
|
-
.filter((message) => message.role === "user" || message.role === "assistant")
|
|
172
|
-
.slice(-CHAT_TITLE_REGENERATION_MESSAGE_LIMIT)
|
|
173
|
-
.map((message) => `${message.role}: ${message.body}`)
|
|
174
|
-
.join("\n\n")
|
|
175
|
-
.trim();
|
|
176
|
-
return source ? buildChatTitlePrompt(source, "Conversation excerpt") : null;
|
|
177
|
-
}
|
|
178
|
-
function startChatTitleGeneration(conversation, body) {
|
|
179
|
-
if (conversation.title !== "New chat" || body.trim().length === 0)
|
|
180
|
-
return;
|
|
181
|
-
const prompt = buildChatTitlePrompt(body);
|
|
182
|
-
const fallbackTitle = fallbackChatTitleFromBody(body);
|
|
183
|
-
void (async () => {
|
|
184
|
-
if (fallbackTitle) {
|
|
185
|
-
await svc.updateDefaultTitle(conversation.id, fallbackTitle);
|
|
186
|
-
}
|
|
187
|
-
try {
|
|
188
|
-
const result = await productIntelligence.execute({
|
|
189
|
-
orgId: conversation.orgId,
|
|
190
|
-
purpose: "lightweight",
|
|
191
|
-
feature: "chat_title",
|
|
192
|
-
prompt,
|
|
193
|
-
});
|
|
194
|
-
const title = sanitizeGeneratedChatTitle(runtimeResultText(result));
|
|
195
|
-
if (title) {
|
|
196
|
-
if (fallbackTitle) {
|
|
197
|
-
await svc.replaceSystemGeneratedTitle(conversation.id, fallbackTitle, title);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
await svc.updateDefaultTitle(conversation.id, title);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
logger.warn({
|
|
206
|
-
err: error,
|
|
207
|
-
conversationId: conversation.id,
|
|
208
|
-
orgId: conversation.orgId,
|
|
209
|
-
}, "Failed to generate chat title with organization lightweight model");
|
|
210
|
-
}
|
|
211
|
-
})().catch((error) => {
|
|
212
|
-
logger.warn({
|
|
213
|
-
err: error,
|
|
214
|
-
conversationId: conversation.id,
|
|
215
|
-
orgId: conversation.orgId,
|
|
216
|
-
}, "Failed to update chat title");
|
|
217
|
-
});
|
|
218
116
|
}
|
|
117
|
+
const startChatTitleGeneration = chatTitles.startAutomaticGeneration;
|
|
219
118
|
async function generateChatTitle(orgId, prompt) {
|
|
220
119
|
const result = await productIntelligence.execute({
|
|
221
120
|
orgId,
|
|
@@ -223,7 +122,7 @@ export function chatRoutes(db, storage) {
|
|
|
223
122
|
feature: "chat_title",
|
|
224
123
|
prompt,
|
|
225
124
|
});
|
|
226
|
-
return
|
|
125
|
+
return sanitizeGeneratedTitle(runtimeResultText(result));
|
|
227
126
|
}
|
|
228
127
|
function positiveIntegerQuery(value, fallback, max) {
|
|
229
128
|
const parsed = Number(value ?? fallback);
|
|
@@ -425,6 +324,7 @@ export function chatRoutes(db, storage) {
|
|
|
425
324
|
return { chatTurnId: userMessage.chatTurnId, turnVariant: userMessage.turnVariant };
|
|
426
325
|
}
|
|
427
326
|
async function addUserMessage(conversation, body, actor, editUserMessageId) {
|
|
327
|
+
assertChatLocalMutationAllowed(conversation);
|
|
428
328
|
const userMessage = await svc.addUserChatMessage(conversation.id, conversation.orgId, body, editUserMessageId ?? null);
|
|
429
329
|
await logActivity(db, {
|
|
430
330
|
orgId: conversation.orgId,
|
|
@@ -445,6 +345,7 @@ export function chatRoutes(db, storage) {
|
|
|
445
345
|
return userMessage;
|
|
446
346
|
}
|
|
447
347
|
async function addAgentAuthoredMessage(conversation, body, actor) {
|
|
348
|
+
assertChatLocalMutationAllowed(conversation);
|
|
448
349
|
if (!actor.agentId) {
|
|
449
350
|
throw forbidden("Agent authentication required");
|
|
450
351
|
}
|
|
@@ -475,6 +376,7 @@ export function chatRoutes(db, storage) {
|
|
|
475
376
|
return message;
|
|
476
377
|
}
|
|
477
378
|
async function attachFilesToUserMessage(conversation, messageId, files, actor) {
|
|
379
|
+
assertChatLocalMutationAllowed(conversation);
|
|
478
380
|
const attachments = [];
|
|
479
381
|
for (const file of files) {
|
|
480
382
|
const contentType = (file.mimetype || "").toLowerCase();
|
|
@@ -1091,6 +993,7 @@ export function chatRoutes(db, storage) {
|
|
|
1091
993
|
res.status(404).json({ error: "Chat conversation not found" });
|
|
1092
994
|
return;
|
|
1093
995
|
}
|
|
996
|
+
assertChatLocalMutationAllowed(existing);
|
|
1094
997
|
if (req.body.primaryIssueId) {
|
|
1095
998
|
const issue = await issuesSvc.getById(req.body.primaryIssueId);
|
|
1096
999
|
if (!issue || issue.orgId !== existing.orgId) {
|
|
@@ -1137,6 +1040,7 @@ export function chatRoutes(db, storage) {
|
|
|
1137
1040
|
res.status(404).json({ error: "Chat conversation not found" });
|
|
1138
1041
|
return;
|
|
1139
1042
|
}
|
|
1043
|
+
assertChatLocalMutationAllowed(existing);
|
|
1140
1044
|
const messages = await svc.listMessages(existing.id, { includeTranscript: false });
|
|
1141
1045
|
const prompt = buildChatTitlePromptFromMessages(messages);
|
|
1142
1046
|
if (!prompt) {
|
|
@@ -1164,6 +1068,44 @@ export function chatRoutes(db, storage) {
|
|
|
1164
1068
|
});
|
|
1165
1069
|
res.json(updated ? await assistantSvc.enrichConversation(updated) : null);
|
|
1166
1070
|
});
|
|
1071
|
+
router.post("/chats/:id/fork", validate(forkChatConversationSchema), async (req, res) => {
|
|
1072
|
+
assertBoard(req);
|
|
1073
|
+
const existing = await assertConversationAccess(req, req.params.id);
|
|
1074
|
+
if (!existing) {
|
|
1075
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
const sourceMessageId = req.body.sourceMessageId ?? null;
|
|
1079
|
+
if (!sourceMessageId && hasActiveChatGeneration(existing.id)) {
|
|
1080
|
+
throw conflict("Cannot fork a chat while a reply is in progress");
|
|
1081
|
+
}
|
|
1082
|
+
const actor = getActorInfo(req);
|
|
1083
|
+
const userId = boardUserId(req);
|
|
1084
|
+
const forked = await svc.forkConversation({
|
|
1085
|
+
sourceConversationId: existing.id,
|
|
1086
|
+
orgId: existing.orgId,
|
|
1087
|
+
userId,
|
|
1088
|
+
sourceMessageId,
|
|
1089
|
+
title: req.body.title,
|
|
1090
|
+
createdByUserId: actor.actorType === "user" ? actor.actorId : null,
|
|
1091
|
+
});
|
|
1092
|
+
await logActivity(db, {
|
|
1093
|
+
orgId: existing.orgId,
|
|
1094
|
+
actorType: actor.actorType,
|
|
1095
|
+
actorId: actor.actorId,
|
|
1096
|
+
agentId: actor.agentId,
|
|
1097
|
+
runId: actor.runId,
|
|
1098
|
+
action: "chat.forked",
|
|
1099
|
+
entityType: "chat",
|
|
1100
|
+
entityId: forked?.id ?? "unknown",
|
|
1101
|
+
details: {
|
|
1102
|
+
sourceConversationId: existing.id,
|
|
1103
|
+
sourceMessageId,
|
|
1104
|
+
forkRootConversationId: forked?.forkRootConversationId ?? existing.id,
|
|
1105
|
+
},
|
|
1106
|
+
});
|
|
1107
|
+
res.status(201).json(await assistantSvc.enrichConversation(forked));
|
|
1108
|
+
});
|
|
1167
1109
|
router.delete("/chats/:id", async (req, res) => {
|
|
1168
1110
|
assertBoard(req);
|
|
1169
1111
|
const existing = await assertConversationAccess(req, req.params.id);
|
|
@@ -1171,6 +1113,7 @@ export function chatRoutes(db, storage) {
|
|
|
1171
1113
|
res.status(404).json({ error: "Chat conversation not found" });
|
|
1172
1114
|
return;
|
|
1173
1115
|
}
|
|
1116
|
+
assertChatLocalMutationAllowed(existing);
|
|
1174
1117
|
if (hasActiveChatGeneration(existing.id)) {
|
|
1175
1118
|
if (req.query.cancelActive === "true") {
|
|
1176
1119
|
cancelAndReleaseActiveChatGeneration(existing.id);
|
|
@@ -1209,13 +1152,163 @@ export function chatRoutes(db, storage) {
|
|
|
1209
1152
|
});
|
|
1210
1153
|
res.json(deleted);
|
|
1211
1154
|
});
|
|
1155
|
+
router.get("/chats/:id/queue", async (req, res) => {
|
|
1156
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1157
|
+
if (!conversation) {
|
|
1158
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const active = getActiveChatGeneration(conversation.id);
|
|
1162
|
+
res.json(await svc.getQueueSnapshot(conversation.id, active?.generationId ?? null));
|
|
1163
|
+
});
|
|
1164
|
+
router.post("/chats/:id/queue", validate(createChatQueuedMessageSchema), async (req, res) => {
|
|
1165
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1166
|
+
if (!conversation) {
|
|
1167
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1171
|
+
const item = await svc.createQueuedMessage({
|
|
1172
|
+
orgId: conversation.orgId,
|
|
1173
|
+
conversationId: conversation.id,
|
|
1174
|
+
clientMutationId: req.body.clientMutationId,
|
|
1175
|
+
expectedGenerationId: req.body.expectedGenerationId ?? getActiveChatGeneration(conversation.id)?.generationId ?? null,
|
|
1176
|
+
payload: req.body.payload,
|
|
1177
|
+
});
|
|
1178
|
+
const actor = getActorInfo(req);
|
|
1179
|
+
await logActivity(db, {
|
|
1180
|
+
orgId: conversation.orgId,
|
|
1181
|
+
actorType: actor.actorType,
|
|
1182
|
+
actorId: actor.actorId,
|
|
1183
|
+
agentId: actor.agentId,
|
|
1184
|
+
runId: actor.runId,
|
|
1185
|
+
action: "chat.queue.created",
|
|
1186
|
+
entityType: "chat",
|
|
1187
|
+
entityId: conversation.id,
|
|
1188
|
+
details: {
|
|
1189
|
+
queuedMessageId: item.id,
|
|
1190
|
+
position: item.position,
|
|
1191
|
+
},
|
|
1192
|
+
});
|
|
1193
|
+
res.status(201).json(item);
|
|
1194
|
+
});
|
|
1195
|
+
router.post("/chats/:id/queue/next/claim", async (req, res) => {
|
|
1196
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1197
|
+
if (!conversation) {
|
|
1198
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1202
|
+
if (hasActiveChatGeneration(conversation.id)) {
|
|
1203
|
+
throw conflict("Cannot dequeue the next message while a reply is in progress");
|
|
1204
|
+
}
|
|
1205
|
+
const latestGeneration = await svc.getLatestGeneration(conversation.id);
|
|
1206
|
+
if (latestGeneration && latestGeneration.status !== "completed") {
|
|
1207
|
+
throw conflict("Queued follow-ups remain parked after a stopped or failed reply");
|
|
1208
|
+
}
|
|
1209
|
+
const item = await svc.claimNextQueuedMessage(conversation.id);
|
|
1210
|
+
if (item) {
|
|
1211
|
+
const actor = getActorInfo(req);
|
|
1212
|
+
await logActivity(db, {
|
|
1213
|
+
orgId: conversation.orgId,
|
|
1214
|
+
actorType: actor.actorType,
|
|
1215
|
+
actorId: actor.actorId,
|
|
1216
|
+
agentId: actor.agentId,
|
|
1217
|
+
runId: actor.runId,
|
|
1218
|
+
action: "chat.queue.claimed",
|
|
1219
|
+
entityType: "chat",
|
|
1220
|
+
entityId: conversation.id,
|
|
1221
|
+
details: {
|
|
1222
|
+
queuedMessageId: item.id,
|
|
1223
|
+
position: item.position,
|
|
1224
|
+
},
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
res.json({ item });
|
|
1228
|
+
});
|
|
1229
|
+
router.post("/chats/:id/queue/:itemId/release-claim", async (req, res) => {
|
|
1230
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1231
|
+
if (!conversation) {
|
|
1232
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1236
|
+
const item = await svc.releaseQueuedMessageClaim({
|
|
1237
|
+
conversationId: conversation.id,
|
|
1238
|
+
itemId: req.params.itemId,
|
|
1239
|
+
reason: "delivery_failed",
|
|
1240
|
+
});
|
|
1241
|
+
res.json({ item });
|
|
1242
|
+
});
|
|
1243
|
+
router.patch("/chats/:id/queue/:itemId", validate(updateChatQueuedMessageSchema), async (req, res) => {
|
|
1244
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1245
|
+
if (!conversation) {
|
|
1246
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1250
|
+
const item = await svc.updateQueuedMessage({
|
|
1251
|
+
conversationId: conversation.id,
|
|
1252
|
+
itemId: req.params.itemId,
|
|
1253
|
+
version: req.body.version,
|
|
1254
|
+
payload: req.body.payload,
|
|
1255
|
+
});
|
|
1256
|
+
res.json(item);
|
|
1257
|
+
});
|
|
1258
|
+
router.delete("/chats/:id/queue/:itemId", async (req, res) => {
|
|
1259
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1260
|
+
if (!conversation) {
|
|
1261
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1265
|
+
const parsed = cancelChatQueuedMessageSchema.safeParse(req.body ?? {});
|
|
1266
|
+
if (!parsed.success) {
|
|
1267
|
+
res.status(400).json({ error: "Invalid queued message cancel request", details: parsed.error.issues });
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
const item = await svc.cancelQueuedMessage({
|
|
1271
|
+
conversationId: conversation.id,
|
|
1272
|
+
itemId: req.params.itemId,
|
|
1273
|
+
version: parsed.data.version ?? null,
|
|
1274
|
+
});
|
|
1275
|
+
res.json(item);
|
|
1276
|
+
});
|
|
1277
|
+
router.post("/chats/:id/queue/:itemId/steer", validate(steerChatQueuedMessageSchema), async (req, res) => {
|
|
1278
|
+
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1279
|
+
if (!conversation) {
|
|
1280
|
+
res.status(404).json({ error: "Chat conversation not found" });
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1284
|
+
const active = getActiveChatGeneration(conversation.id);
|
|
1285
|
+
const expected = req.body.expectedActiveGenerationId ?? null;
|
|
1286
|
+
const result = !active?.generationId
|
|
1287
|
+
? "closing"
|
|
1288
|
+
: expected && expected !== active.generationId
|
|
1289
|
+
? "stale_generation"
|
|
1290
|
+
: "unsupported";
|
|
1291
|
+
const item = await svc.markQueuedMessageSteerFallback({
|
|
1292
|
+
conversationId: conversation.id,
|
|
1293
|
+
itemId: req.params.itemId,
|
|
1294
|
+
reason: result,
|
|
1295
|
+
activeGenerationId: active?.generationId ?? null,
|
|
1296
|
+
});
|
|
1297
|
+
res.json({
|
|
1298
|
+
item,
|
|
1299
|
+
result: result === "unsupported" ? "queued_fallback" : result,
|
|
1300
|
+
activeGenerationId: active?.generationId ?? null,
|
|
1301
|
+
queueVersion: item.version,
|
|
1302
|
+
transcriptEventId: null,
|
|
1303
|
+
});
|
|
1304
|
+
});
|
|
1212
1305
|
router.get("/chats/:id/messages", async (req, res) => {
|
|
1213
1306
|
const conversation = await assertConversationAccess(req, req.params.id);
|
|
1214
1307
|
if (!conversation) {
|
|
1215
1308
|
res.status(404).json({ error: "Chat conversation not found" });
|
|
1216
1309
|
return;
|
|
1217
1310
|
}
|
|
1218
|
-
if (!hasActiveChatGeneration(conversation.id)) {
|
|
1311
|
+
if (conversation.mutability !== "external_bound_chat" && !hasActiveChatGeneration(conversation.id)) {
|
|
1219
1312
|
await svc.markInterruptedStreamingMessages(conversation.id);
|
|
1220
1313
|
}
|
|
1221
1314
|
const includeTranscript = req.query.includeTranscript === "true";
|
|
@@ -1246,6 +1339,7 @@ export function chatRoutes(db, storage) {
|
|
|
1246
1339
|
return;
|
|
1247
1340
|
}
|
|
1248
1341
|
const actor = getActorInfo(req);
|
|
1342
|
+
assertChatLocalMutationAllowed(conversation);
|
|
1249
1343
|
if (actor.actorType === "agent") {
|
|
1250
1344
|
if (req.body.editUserMessageId) {
|
|
1251
1345
|
res.status(422).json({ error: "Agent-authored chat messages cannot edit operator messages" });
|
|
@@ -1260,16 +1354,34 @@ export function chatRoutes(db, storage) {
|
|
|
1260
1354
|
res.status(503).json({ error: assistantAvailability.error });
|
|
1261
1355
|
return;
|
|
1262
1356
|
}
|
|
1263
|
-
const releaseGeneration = claimChatGeneration(conversation.id);
|
|
1357
|
+
const releaseGeneration = claimChatGeneration(conversation.id, null, null);
|
|
1264
1358
|
if (!releaseGeneration) {
|
|
1265
|
-
|
|
1359
|
+
const item = await svc.createQueuedMessage({
|
|
1360
|
+
orgId: conversation.orgId,
|
|
1361
|
+
conversationId: conversation.id,
|
|
1362
|
+
clientMutationId: `message:${randomUUID()}`,
|
|
1363
|
+
expectedGenerationId: getActiveChatGeneration(conversation.id)?.generationId ?? null,
|
|
1364
|
+
payload: {
|
|
1365
|
+
body: req.body.body,
|
|
1366
|
+
attachmentIds: [],
|
|
1367
|
+
skillRefs: [],
|
|
1368
|
+
projectId: null,
|
|
1369
|
+
accessMode: null,
|
|
1370
|
+
model: null,
|
|
1371
|
+
effort: null,
|
|
1372
|
+
metadata: {
|
|
1373
|
+
source: "messages_endpoint_during_active_generation",
|
|
1374
|
+
},
|
|
1375
|
+
},
|
|
1376
|
+
});
|
|
1377
|
+
res.status(202).json({ queued: item });
|
|
1266
1378
|
return;
|
|
1267
1379
|
}
|
|
1268
1380
|
let chatObservation = null;
|
|
1269
1381
|
try {
|
|
1270
1382
|
const userMessage = await addUserMessage(conversation, req.body.body, actor, req.body.editUserMessageId ?? null);
|
|
1271
1383
|
if (!req.body.editUserMessageId) {
|
|
1272
|
-
startChatTitleGeneration(conversation,
|
|
1384
|
+
startChatTitleGeneration(conversation, userMessage);
|
|
1273
1385
|
}
|
|
1274
1386
|
const turnContext = turnContextFromUserMessage(userMessage);
|
|
1275
1387
|
chatObservation = buildChatObservabilityContext(conversation, {
|
|
@@ -1473,6 +1585,7 @@ export function chatRoutes(db, storage) {
|
|
|
1473
1585
|
operatorProfiles,
|
|
1474
1586
|
heartbeat,
|
|
1475
1587
|
assertConversationAccess,
|
|
1588
|
+
assertChatLocalMutationAllowed,
|
|
1476
1589
|
boardUserId,
|
|
1477
1590
|
assertCanAssignTasks,
|
|
1478
1591
|
runSingleFileUpload,
|