@rudderhq/server 0.5.0 → 0.5.1
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/agent-runtimes/http/execute.d.ts.map +1 -1
- package/dist/agent-runtimes/http/execute.js +56 -1
- package/dist/agent-runtimes/http/execute.js.map +1 -1
- package/dist/agent-runtimes/http/index.d.ts.map +1 -1
- package/dist/agent-runtimes/http/index.js +10 -0
- package/dist/agent-runtimes/http/index.js.map +1 -1
- package/dist/agent-runtimes/process/execute.d.ts.map +1 -1
- package/dist/agent-runtimes/process/execute.js +9 -1
- package/dist/agent-runtimes/process/execute.js.map +1 -1
- package/dist/agent-runtimes/process/index.d.ts.map +1 -1
- package/dist/agent-runtimes/process/index.js +7 -0
- package/dist/agent-runtimes/process/index.js.map +1 -1
- package/dist/agent-runtimes/registry.d.ts.map +1 -1
- package/dist/agent-runtimes/registry.js +21 -1
- package/dist/agent-runtimes/registry.js.map +1 -1
- package/dist/agent-runtimes/utils.d.ts +1 -0
- package/dist/agent-runtimes/utils.d.ts.map +1 -1
- package/dist/agent-runtimes/utils.js.map +1 -1
- package/dist/bundled-plugins/plugin-linear/dist/worker.js +183 -10
- package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +3 -3
- package/dist/home-paths.d.ts +7 -0
- package/dist/home-paths.d.ts.map +1 -1
- package/dist/home-paths.js +46 -2
- package/dist/home-paths.js.map +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/routes/access.d.ts.map +1 -1
- package/dist/routes/access.helpers.d.ts +1 -1
- package/dist/routes/access.helpers.d.ts.map +1 -1
- package/dist/routes/access.helpers.js +0 -3
- package/dist/routes/access.helpers.js.map +1 -1
- package/dist/routes/access.js +0 -4
- package/dist/routes/access.js.map +1 -1
- package/dist/routes/agents.js +2 -2
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/chats.d.ts.map +1 -1
- package/dist/routes/chats.generated-attachments.d.ts +16 -0
- package/dist/routes/chats.generated-attachments.d.ts.map +1 -0
- package/dist/routes/chats.generated-attachments.js +157 -0
- package/dist/routes/chats.generated-attachments.js.map +1 -0
- package/dist/routes/chats.helpers.d.ts +27 -0
- package/dist/routes/chats.helpers.d.ts.map +1 -0
- package/dist/routes/chats.helpers.js +52 -0
- package/dist/routes/chats.helpers.js.map +1 -0
- package/dist/routes/chats.js +126 -188
- 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 +185 -16
- package/dist/routes/chats.stream-routes.js.map +1 -1
- package/dist/routes/llms.js +3 -3
- package/dist/routes/llms.js.map +1 -1
- package/dist/routes/messenger.d.ts.map +1 -1
- package/dist/routes/messenger.js +48 -6
- package/dist/routes/messenger.js.map +1 -1
- package/dist/services/activity.d.ts.map +1 -1
- package/dist/services/activity.js +7 -2
- package/dist/services/activity.js.map +1 -1
- package/dist/services/agents.d.ts +65 -65
- package/dist/services/agents.d.ts.map +1 -1
- package/dist/services/agents.js +5 -4
- package/dist/services/agents.js.map +1 -1
- package/dist/services/approvals.d.ts +1 -1
- package/dist/services/assets.d.ts +2 -2
- package/dist/services/automation-chat-output.d.ts +1 -1
- package/dist/services/automation-chat-output.d.ts.map +1 -1
- package/dist/services/automation-chat-output.js +38 -23
- package/dist/services/automation-chat-output.js.map +1 -1
- package/dist/services/automations.d.ts.map +1 -1
- package/dist/services/automations.js +39 -41
- package/dist/services/automations.js.map +1 -1
- package/dist/services/budgets.d.ts +1 -1
- package/dist/services/chat-assistant.d.ts +23 -1
- package/dist/services/chat-assistant.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.d.ts +21 -0
- package/dist/services/chat-assistant.helpers.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.js +29 -10
- package/dist/services/chat-assistant.helpers.js.map +1 -1
- package/dist/services/chat-assistant.inline-visuals.d.ts +23 -0
- package/dist/services/chat-assistant.inline-visuals.d.ts.map +1 -0
- package/dist/services/chat-assistant.inline-visuals.js +129 -0
- package/dist/services/chat-assistant.inline-visuals.js.map +1 -0
- package/dist/services/chat-assistant.inline-visuals.test.js +85 -1
- package/dist/services/chat-assistant.inline-visuals.test.js.map +1 -1
- package/dist/services/chat-assistant.js +262 -38
- package/dist/services/chat-assistant.js.map +1 -1
- package/dist/services/chat-family-groups.d.ts +14 -0
- package/dist/services/chat-family-groups.d.ts.map +1 -0
- package/dist/services/chat-family-groups.js +96 -0
- package/dist/services/chat-family-groups.js.map +1 -0
- package/dist/services/chat-generation-protocol.d.ts +17 -31
- package/dist/services/chat-generation-protocol.d.ts.map +1 -1
- package/dist/services/chat-generation-protocol.helpers.d.ts +36 -0
- package/dist/services/chat-generation-protocol.helpers.d.ts.map +1 -0
- package/dist/services/chat-generation-protocol.helpers.js +53 -0
- package/dist/services/chat-generation-protocol.helpers.js.map +1 -0
- package/dist/services/chat-generation-protocol.js +86 -55
- package/dist/services/chat-generation-protocol.js.map +1 -1
- package/dist/services/chat-generation-protocol.test.js +31 -3
- package/dist/services/chat-generation-protocol.test.js.map +1 -1
- package/dist/services/chat-steer-messages.d.ts +117 -0
- package/dist/services/chat-steer-messages.d.ts.map +1 -0
- package/dist/services/chat-steer-messages.js +410 -0
- package/dist/services/chat-steer-messages.js.map +1 -0
- package/dist/services/chat-title-generation.d.ts +1 -0
- package/dist/services/chat-title-generation.d.ts.map +1 -1
- package/dist/services/chat-title-generation.js +12 -9
- package/dist/services/chat-title-generation.js.map +1 -1
- package/dist/services/chat-work-manifest.d.ts.map +1 -1
- package/dist/services/chat-work-manifest.js +39 -2
- package/dist/services/chat-work-manifest.js.map +1 -1
- package/dist/services/chats.constants.d.ts +5 -0
- package/dist/services/chats.constants.d.ts.map +1 -0
- package/dist/services/chats.constants.js +13 -0
- package/dist/services/chats.constants.js.map +1 -0
- package/dist/services/chats.create.d.ts +75 -0
- package/dist/services/chats.create.d.ts.map +1 -0
- package/dist/services/chats.create.js +159 -0
- package/dist/services/chats.create.js.map +1 -0
- package/dist/services/chats.d.ts +85 -76
- package/dist/services/chats.d.ts.map +1 -1
- package/dist/services/chats.fork-helpers.d.ts +8 -0
- package/dist/services/chats.fork-helpers.d.ts.map +1 -0
- package/dist/services/chats.fork-helpers.js +45 -0
- package/dist/services/chats.fork-helpers.js.map +1 -0
- package/dist/services/chats.inline-visual-persistence.d.ts +30 -0
- package/dist/services/chats.inline-visual-persistence.d.ts.map +1 -0
- package/dist/services/chats.inline-visual-persistence.js +209 -0
- package/dist/services/chats.inline-visual-persistence.js.map +1 -0
- package/dist/services/chats.js +288 -273
- package/dist/services/chats.js.map +1 -1
- package/dist/services/chats.types.d.ts +31 -0
- package/dist/services/chats.types.d.ts.map +1 -0
- package/dist/services/chats.types.js +2 -0
- package/dist/services/chats.types.js.map +1 -0
- package/dist/services/integrations/feishu/inbound-dispatcher-db.d.ts.map +1 -1
- package/dist/services/integrations/feishu/inbound-dispatcher-db.js +81 -53
- package/dist/services/integrations/feishu/inbound-dispatcher-db.js.map +1 -1
- package/dist/services/integrations/feishu/inbound-dispatcher.d.ts +1 -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/issues.comments-attachments.d.ts.map +1 -1
- package/dist/services/issues.comments-attachments.js +11 -2
- package/dist/services/issues.comments-attachments.js.map +1 -1
- package/dist/services/issues.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.catalog.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.catalog.js +7 -1
- package/dist/services/knowledge-portability/organization-skills.catalog.js.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.js +13 -1
- package/dist/services/knowledge-portability/organization-skills.js.map +1 -1
- package/dist/services/messenger-run-origin.d.ts +18 -0
- package/dist/services/messenger-run-origin.d.ts.map +1 -0
- package/dist/services/messenger-run-origin.js +248 -0
- package/dist/services/messenger-run-origin.js.map +1 -0
- package/dist/services/messenger-run-summary.d.ts +4 -0
- package/dist/services/messenger-run-summary.d.ts.map +1 -0
- package/dist/services/messenger-run-summary.js +6 -0
- package/dist/services/messenger-run-summary.js.map +1 -0
- package/dist/services/messenger-saved-views.d.ts +133 -0
- package/dist/services/messenger-saved-views.d.ts.map +1 -0
- package/dist/services/messenger-saved-views.js +275 -0
- package/dist/services/messenger-saved-views.js.map +1 -0
- package/dist/services/messenger.d.ts +17 -3
- package/dist/services/messenger.d.ts.map +1 -1
- package/dist/services/messenger.js +276 -56
- package/dist/services/messenger.js.map +1 -1
- package/dist/services/operator-event-visibility.d.ts +3 -0
- package/dist/services/operator-event-visibility.d.ts.map +1 -0
- package/dist/services/operator-event-visibility.js +5 -0
- package/dist/services/operator-event-visibility.js.map +1 -0
- package/dist/services/orgs.d.ts +5 -5
- package/dist/services/plugin-registry.d.ts +4 -4
- package/dist/services/projects.d.ts +2 -2
- package/dist/services/run-intelligence.d.ts.map +1 -1
- package/dist/services/run-intelligence.js +7 -3
- package/dist/services/run-intelligence.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.core.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.core.js +9 -8
- package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.d.ts +2 -2
- package/dist/services/runtime-kernel/heartbeat.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.js +3 -2
- package/dist/services/runtime-kernel/heartbeat.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.misc.js +1 -1
- package/dist/services/runtime-kernel/heartbeat.misc.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.recovery.js +1 -1
- package/dist/services/runtime-kernel/heartbeat.recovery.js.map +1 -1
- package/dist/services/side-chats.d.ts +1 -46
- package/dist/services/side-chats.d.ts.map +1 -1
- package/dist/services/side-chats.js +58 -65
- package/dist/services/side-chats.js.map +1 -1
- package/dist/services/title-generation.d.ts +3 -0
- package/dist/services/title-generation.d.ts.map +1 -1
- package/dist/services/title-generation.js +178 -6
- package/dist/services/title-generation.js.map +1 -1
- package/dist/services/workspace-backups.d.ts +19 -8
- package/dist/services/workspace-backups.d.ts.map +1 -1
- package/dist/services/workspace-backups.js +335 -127
- package/dist/services/workspace-backups.js.map +1 -1
- package/package.json +14 -13
- package/resources/bundled-skills/browser/references/tool-contract.md +2 -2
- package/resources/bundled-skills/rudder-docs/SKILL.md +20 -4
- package/resources/bundled-skills/rudder-docs/evals/retrieval-authority-evals.json +262 -0
- package/resources/bundled-skills/rudder-docs/evals/trigger-evals.json +11 -11
- package/resources/bundled-skills/rudder-docs/references/agent-creation.md +153 -0
- package/resources/bundled-skills/rudder-docs/references/api-reference.md +9 -2
- package/resources/bundled-skills/rudder-docs/references/cli-reference.md +12 -12
- package/{skills/rudder-docs/references/control-plane-practices.md → resources/bundled-skills/rudder-docs/references/operating-practices.md} +4 -4
- package/resources/bundled-skills/rudder-docs/references/organization-skills.md +3 -3
- package/resources/bundled-skills/rudder-docs/references/plugin-authoring.md +116 -0
- package/resources/bundled-skills/rudder-docs/references/source-map.md +26 -2
- package/resources/bundled-skills/visualize/SKILL.md +29 -27
- package/resources/bundled-skills/visualize/references/runtime-contract.md +18 -8
- package/skills/browser/references/tool-contract.md +2 -2
- package/skills/rudder-docs/SKILL.md +20 -4
- package/skills/rudder-docs/evals/retrieval-authority-evals.json +262 -0
- package/skills/rudder-docs/evals/trigger-evals.json +11 -11
- package/skills/rudder-docs/references/agent-creation.md +153 -0
- package/skills/rudder-docs/references/api-reference.md +9 -2
- package/skills/rudder-docs/references/cli-reference.md +12 -12
- package/{resources/bundled-skills/rudder-docs/references/control-plane-practices.md → skills/rudder-docs/references/operating-practices.md} +4 -4
- package/skills/rudder-docs/references/organization-skills.md +3 -3
- package/skills/rudder-docs/references/plugin-authoring.md +116 -0
- package/skills/rudder-docs/references/source-map.md +26 -2
- package/skills/visualize/SKILL.md +29 -27
- package/skills/visualize/references/runtime-contract.md +18 -8
- package/ui-dist/assets/{abnfDiagram-VRR7QNED-Dpnx79fp.js → abnfDiagram-VRR7QNED-CAAPm9Nj.js} +1 -1
- package/ui-dist/assets/{arc-Cpvh_rCf.js → arc-DOFoNr3M.js} +1 -1
- package/ui-dist/assets/{architectureDiagram-ZJ3FMSHR-sDD_mBAI.js → architectureDiagram-ZJ3FMSHR-DRg6yhG8.js} +1 -1
- package/ui-dist/assets/{blockDiagram-677ZJIJ3-4O4wWti1.js → blockDiagram-677ZJIJ3-e3ShzsXT.js} +1 -1
- package/ui-dist/assets/{c4Diagram-LMCZKHZV-BkGODE4P.js → c4Diagram-LMCZKHZV-Csd_18O2.js} +1 -1
- package/ui-dist/assets/channel-BFLsBJOK.js +1 -0
- package/ui-dist/assets/{chunk-2Q5K7J3B-DsDQQpID.js → chunk-2Q5K7J3B-eF77FV1C.js} +1 -1
- package/ui-dist/assets/{chunk-32BRIVSS-Bzx_VnIw.js → chunk-32BRIVSS-CpMx72B5.js} +1 -1
- package/ui-dist/assets/{chunk-5VM5RSS4-D4LoPCni.js → chunk-5VM5RSS4-Be6WylCu.js} +1 -1
- package/ui-dist/assets/{chunk-EX3LRPZG-BO0R-mS4.js → chunk-EX3LRPZG-D-A_TfL-.js} +1 -1
- package/ui-dist/assets/{chunk-JWPE2WC7-B4Nr8KRL.js → chunk-JWPE2WC7-CdBLDqvo.js} +1 -1
- package/ui-dist/assets/{chunk-MOJQB5TN--uaDDrYM.js → chunk-MOJQB5TN-DkLjRENV.js} +1 -1
- package/ui-dist/assets/{chunk-RYQCIY6F-CyBY2w_j.js → chunk-RYQCIY6F-57VqTsE9.js} +1 -1
- package/ui-dist/assets/{chunk-V7JOEXUC-BMid_x8S.js → chunk-V7JOEXUC-DI_m8pt6.js} +1 -1
- package/ui-dist/assets/{chunk-VR4S4FIN-DVqdPKuG.js → chunk-VR4S4FIN-CM_944j4.js} +1 -1
- package/ui-dist/assets/{chunk-XXDRQBXY-vy03lLSS.js → chunk-XXDRQBXY--WTAlt82.js} +1 -1
- package/ui-dist/assets/classDiagram-OUVF2IWQ-Dah6C4Dl.js +1 -0
- package/ui-dist/assets/classDiagram-v2-EOCWNBFH-Dah6C4Dl.js +1 -0
- package/ui-dist/assets/{cose-bilkent-JH36ORCC-jQDZmrG3.js → cose-bilkent-JH36ORCC-CR0qu31s.js} +1 -1
- package/ui-dist/assets/{cynefin-VYW2F7L2-BxBj6aea.js → cynefin-VYW2F7L2-f41lF5RD.js} +1 -1
- package/ui-dist/assets/{cynefinDiagram-TSTJHNR4-BuUubF5I.js → cynefinDiagram-TSTJHNR4-88wJ2LA8.js} +1 -1
- package/ui-dist/assets/{dagre-VKFMJZFB-B8HipJ3a.js → dagre-VKFMJZFB-B1yJCIRh.js} +1 -1
- package/ui-dist/assets/{diagram-FQU43EPY-r7gkbKSt.js → diagram-FQU43EPY-C0iYYFUe.js} +1 -1
- package/ui-dist/assets/{diagram-G47NLZAW-CxClRsxD.js → diagram-G47NLZAW-Cp6S0siK.js} +1 -1
- package/ui-dist/assets/{diagram-NH7WQ7WH-C8HYTLlq.js → diagram-NH7WQ7WH-CmZb5OSk.js} +1 -1
- package/ui-dist/assets/{diagram-OA4YK3LP-CjwqqLKz.js → diagram-OA4YK3LP-9rFYGY7H.js} +1 -1
- package/ui-dist/assets/{diagram-WEI45ONY-2IWfCqZb.js → diagram-WEI45ONY-Og8vyDQh.js} +1 -1
- package/ui-dist/assets/{ebnfDiagram-CCIWWBDH-DVGZkgjy.js → ebnfDiagram-CCIWWBDH--5sMape2.js} +1 -1
- package/ui-dist/assets/{erDiagram-Q63AITRT-C_-u3Gmw.js → erDiagram-Q63AITRT-DG10Bza-.js} +1 -1
- package/ui-dist/assets/{flowDiagram-23GEKE2U-BvGg0NCq.js → flowDiagram-23GEKE2U-BW-aZfEk.js} +1 -1
- package/ui-dist/assets/{ganttDiagram-NO4QXBWP-U3CZUUUR.js → ganttDiagram-NO4QXBWP-DcA7on8t.js} +1 -1
- package/ui-dist/assets/{gitGraphDiagram-IHSO6WYX-CIWuEBIo.js → gitGraphDiagram-IHSO6WYX-ygGufg32.js} +1 -1
- package/ui-dist/assets/{graph-D3P5q-7m.js → graph-BXl6uBoM.js} +1 -1
- package/ui-dist/assets/{index-DOPIV8vd.js → index-9bXlV2sq.js} +1 -1
- package/ui-dist/assets/{index-CjztBLJi.js → index-B58ems-F.js} +1 -1
- package/ui-dist/assets/{index-mnl55Stn.js → index-BM-SJNCx.js} +1 -1
- package/ui-dist/assets/index-BcdA9dZc.css +1 -0
- package/ui-dist/assets/{index-BAgtKYR1.js → index-BmTNDbzy.js} +1 -1
- package/ui-dist/assets/{index-DidCCw78.js → index-CCDynlok.js} +1 -1
- package/ui-dist/assets/{index-CbHqnWUe.js → index-CRLl2Ck7.js} +1 -1
- package/ui-dist/assets/{index-D7ycf1qU.js → index-CqmU1PxY.js} +1 -1
- package/ui-dist/assets/{index-B1rLBtZ1.js → index-CssgLJwf.js} +605 -493
- package/ui-dist/assets/{index-DRxLJD40.js → index-DOVMMhyj.js} +1 -1
- package/ui-dist/assets/{index-Ds_qma4-.js → index-DTlR8bJV.js} +1 -1
- package/ui-dist/assets/{index-DCFf9dps.js → index-Dl6nXXNc.js} +1 -1
- package/ui-dist/assets/{index-DAYlwxsg.js → index-DoiNhQrY.js} +1 -1
- package/ui-dist/assets/{index-CBOr9F6w.js → index-Dug5GX1J.js} +1 -1
- package/ui-dist/assets/{index-HkQRx1D6.js → index-DxXOCTVe.js} +1 -1
- package/ui-dist/assets/{index-BAMXpiI5.js → index-GdN-7KLt.js} +1 -1
- package/ui-dist/assets/{index-ikpL--zj.js → index-ZA8lPH2n.js} +1 -1
- package/ui-dist/assets/{index-Cu1iMhjl.js → index-fkDP349f.js} +1 -1
- package/ui-dist/assets/{index-DYMtCDKT.js → index-uKIvv9n9.js} +1 -1
- package/ui-dist/assets/{infoDiagram-FWYZ7A6U-Cx8Fa-I4.js → infoDiagram-FWYZ7A6U-27INMkBm.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-FXEZZL3T-Cmuz1QUN.js → ishikawaDiagram-FXEZZL3T-Bp6XQ1_r.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-5HDEW3XC-CJgkiVXG.js → journeyDiagram-5HDEW3XC-9vaIwdZ3.js} +1 -1
- package/ui-dist/assets/{kanban-definition-HUTT4EX6-RAWpefOB.js → kanban-definition-HUTT4EX6-DjsMaR6l.js} +1 -1
- package/ui-dist/assets/{layout-DyWQv0Rr.js → layout-C0oWcIiC.js} +1 -1
- package/ui-dist/assets/{linear-D5pdgIf9.js → linear-DNbmenmQ.js} +1 -1
- package/ui-dist/assets/{map-bVSzNLl2.js → map-B1s9kpcR.js} +1 -1
- package/ui-dist/assets/{mermaid.core-CeaXGD6B.js → mermaid.core-DsYT9DxL.js} +4 -4
- package/ui-dist/assets/{mindmap-definition-LN4V7U3C-B8B8AX5C.js → mindmap-definition-LN4V7U3C-vVHeRI83.js} +1 -1
- package/ui-dist/assets/{pegDiagram-2B236MQR-C4Sv-ua6.js → pegDiagram-2B236MQR-ohrgWLo_.js} +1 -1
- package/ui-dist/assets/{pieDiagram-ENE6RG2P-CLARlOHx.js → pieDiagram-ENE6RG2P-B0EqPrjn.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-ABIIQ3AL-DPCXQmeT.js → quadrantDiagram-ABIIQ3AL-D44iYm0o.js} +1 -1
- package/ui-dist/assets/{railroadDiagram-RFXS5EU6-BpqRuKUQ.js → railroadDiagram-RFXS5EU6-BQU5bpbU.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-TGXJPOKE-Dd-h62HZ.js → requirementDiagram-TGXJPOKE-DGJciRxB.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-HTMAVEWB-DylT_pqq.js → sankeyDiagram-HTMAVEWB-NMXZW_Qb.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-DBY2YBRQ-RiCF1REj.js → sequenceDiagram-DBY2YBRQ-8uWY67Bb.js} +1 -1
- package/ui-dist/assets/{sizeCapture-X5ZJPWSS-DXW4JQz2.js → sizeCapture-X5ZJPWSS-BnUUR-On.js} +1 -1
- package/ui-dist/assets/{stateDiagram-2N3HPSRC-6U3ESIGT.js → stateDiagram-2N3HPSRC-B37bcKMy.js} +1 -1
- package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-p6H0vL7N.js +1 -0
- package/ui-dist/assets/{swimlanes-5IMT3BWC-CeNHVNCi.js → swimlanes-5IMT3BWC-Bi2ZzUMi.js} +2 -2
- package/ui-dist/assets/swimlanesDiagram-G3AALYLV-BX6FiLF9.js +8 -0
- package/ui-dist/assets/{timeline-definition-FHXFAJF6-Vlwoe_1b.js → timeline-definition-FHXFAJF6-CkWauU5D.js} +1 -1
- package/ui-dist/assets/{vennDiagram-L72KCM5P-DBP7D3HE.js → vennDiagram-L72KCM5P-BrmBXmnk.js} +1 -1
- package/ui-dist/assets/{wardleyDiagram-EHGQE667-DG-wzqpy.js → wardleyDiagram-EHGQE667-kO5cojc6.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-FW5EYKEG-BAq3mbha.js → xychartDiagram-FW5EYKEG-CUBDaCDm.js} +1 -1
- package/ui-dist/index.html +5 -4
- package/resources/bundled-skills/rudder-create-agent/SKILL.md +0 -185
- package/resources/bundled-skills/rudder-create-agent/references/api-reference.md +0 -179
- package/resources/bundled-skills/rudder-create-agent/references/cli-reference.md +0 -132
- package/resources/bundled-skills/rudder-create-plugin/SKILL.md +0 -103
- package/resources/bundled-skills/skill-optimizer/CHANGELOG.md +0 -29
- package/resources/bundled-skills/skill-optimizer/SKILL.md +0 -205
- package/resources/bundled-skills/skill-optimizer/references/adapters/creative-brand-content.md +0 -30
- package/resources/bundled-skills/skill-optimizer/references/adapters/customer-support-sales.md +0 -30
- package/resources/bundled-skills/skill-optimizer/references/adapters/document-data-processing.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/education-training.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/finance-accounting.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/healthcare-operations.md +0 -30
- package/resources/bundled-skills/skill-optimizer/references/adapters/hr-people-ops.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/legal-compliance.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/operations-supply-chain.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/personal-productivity.md +0 -29
- package/resources/bundled-skills/skill-optimizer/references/adapters/research-knowledge.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/adapters/software-ai.md +0 -31
- package/resources/bundled-skills/skill-optimizer/references/domain-adapter-patterns.md +0 -66
- package/resources/bundled-skills/skill-optimizer/references/eval-method.md +0 -17
- package/resources/bundled-skills/skill-optimizer/references/universal-optimization-lens.md +0 -73
- package/skills/rudder-create-agent/SKILL.md +0 -185
- package/skills/rudder-create-agent/references/api-reference.md +0 -179
- package/skills/rudder-create-agent/references/cli-reference.md +0 -132
- package/skills/rudder-create-plugin/SKILL.md +0 -103
- package/skills/skill-optimizer/CHANGELOG.md +0 -29
- package/skills/skill-optimizer/SKILL.md +0 -205
- package/skills/skill-optimizer/references/adapters/creative-brand-content.md +0 -30
- package/skills/skill-optimizer/references/adapters/customer-support-sales.md +0 -30
- package/skills/skill-optimizer/references/adapters/document-data-processing.md +0 -31
- package/skills/skill-optimizer/references/adapters/education-training.md +0 -31
- package/skills/skill-optimizer/references/adapters/finance-accounting.md +0 -31
- package/skills/skill-optimizer/references/adapters/healthcare-operations.md +0 -30
- package/skills/skill-optimizer/references/adapters/hr-people-ops.md +0 -31
- package/skills/skill-optimizer/references/adapters/legal-compliance.md +0 -31
- package/skills/skill-optimizer/references/adapters/operations-supply-chain.md +0 -31
- package/skills/skill-optimizer/references/adapters/personal-productivity.md +0 -29
- package/skills/skill-optimizer/references/adapters/research-knowledge.md +0 -31
- package/skills/skill-optimizer/references/adapters/software-ai.md +0 -31
- package/skills/skill-optimizer/references/domain-adapter-patterns.md +0 -66
- package/skills/skill-optimizer/references/eval-method.md +0 -17
- package/skills/skill-optimizer/references/universal-optimization-lens.md +0 -73
- package/ui-dist/assets/channel-CM4Myg_6.js +0 -1
- package/ui-dist/assets/classDiagram-OUVF2IWQ-CtlIEzTt.js +0 -1
- package/ui-dist/assets/classDiagram-v2-EOCWNBFH-CtlIEzTt.js +0 -1
- package/ui-dist/assets/index-DekHKOsL.css +0 -1
- package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-KQTrcZvp.js +0 -1
- package/ui-dist/assets/swimlanesDiagram-G3AALYLV-CcxS1c6r.js +0 -8
package/dist/routes/chats.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addChatMessageSchema, cancelChatQueuedMessageSchema, chatAutomationCreateFromStructuredPayload, createChatConversationSchema, createChatQueuedMessageSchema, createSideChatSchema, forkChatConversationSchema,
|
|
1
|
+
import { addChatMessageSchema, cancelChatQueuedMessageSchema, chatAutomationCreateFromStructuredPayload, chatDraftSchema, createChatConversationSchema, createChatQueuedMessageSchema, createSideChatSchema, 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";
|
|
@@ -8,9 +8,10 @@ import { logger } from "../middleware/logger.js";
|
|
|
8
8
|
import { validate } from "../middleware/validate.js";
|
|
9
9
|
import { assertTimeZone } from "../services/automations.scheduler.js";
|
|
10
10
|
import { chatAgentRunService } from "../services/chat-agent-runs.js";
|
|
11
|
-
import { CHAT_ASSISTANT_USER_ERROR_MESSAGE, chatAssistantService, ChatAssistantStreamError, userVisiblePartialBodyFromError, } from "../services/chat-assistant.js";
|
|
11
|
+
import { CHAT_ASSISTANT_USER_ERROR_MESSAGE, chatAssistantErrorForLog, chatAssistantService, ChatAssistantStreamError, userVisiblePartialBodyFromError, } from "../services/chat-assistant.js";
|
|
12
12
|
import { cancelAndReleaseActiveChatGeneration, claimChatGeneration, createChatRuntimeControlCoordinator, getActiveChatGeneration, hasActiveChatGeneration, interruptActiveChatGeneration, steerActiveChatGeneration } from "../services/chat-generation-locks.js";
|
|
13
13
|
import { hashChatGenerationBody } from "../services/chat-generation-protocol.js";
|
|
14
|
+
import { chatSteerMessageService } from "../services/chat-steer-messages.js";
|
|
14
15
|
import { buildChatTitlePromptFromMessages, chatTitleGenerationService, } from "../services/chat-title-generation.js";
|
|
15
16
|
import { chatWorkManifestService } from "../services/chat-work-manifest.js";
|
|
16
17
|
import { validateCron } from "../services/cron.js";
|
|
@@ -19,6 +20,8 @@ import { runtimeResultText, sanitizeGeneratedTitle, } from "../services/title-ge
|
|
|
19
20
|
import { assertBoard, assertCompanyAccess, getActorInfo } from "./authz.js";
|
|
20
21
|
import { createChatBackgroundRuntime, } from "./chat-background-runtime.js";
|
|
21
22
|
import { wakeIssueAssigneeAfterChatConversion } from "./chat-issue-assignment-wakeup.js";
|
|
23
|
+
import { attachGeneratedChatFiles } from "./chats.generated-attachments.js";
|
|
24
|
+
import { isMultipartRequest, paginateChatMessages, positiveIntegerQuery, uploadedMessageFiles, validateUploadedMessageFiles, } from "./chats.helpers.js";
|
|
22
25
|
import { registerChatStreamRoutes } from "./chats.stream-routes.js";
|
|
23
26
|
function chatVisibleOutputAdmissionClosed(error) {
|
|
24
27
|
return error instanceof HttpError
|
|
@@ -42,6 +45,7 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
42
45
|
const heartbeat = heartbeatService(db);
|
|
43
46
|
const productIntelligence = productIntelligenceService(db);
|
|
44
47
|
const chatTitles = chatTitleGenerationService({ chats: svc, productIntelligence });
|
|
48
|
+
const steerMessages = chatSteerMessageService(db);
|
|
45
49
|
const sideChats = sideChatService(db);
|
|
46
50
|
const CHAT_ASSISTANT_RECOVERABLE_FAILURE_FALLBACK_MESSAGE = "The assistant reply could not be completed. Rudder saved this attempt for diagnostics; retry when ready.";
|
|
47
51
|
const upload = multer({
|
|
@@ -72,28 +76,6 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
72
76
|
});
|
|
73
77
|
});
|
|
74
78
|
}
|
|
75
|
-
function isMultipartRequest(req) {
|
|
76
|
-
return (req.headers["content-type"] ?? "").toLowerCase().startsWith("multipart/form-data");
|
|
77
|
-
}
|
|
78
|
-
function uploadedMessageFiles(req) {
|
|
79
|
-
const files = req.files;
|
|
80
|
-
const list = Array.isArray(files) ? files : [];
|
|
81
|
-
return list.filter((file) => typeof file === "object" &&
|
|
82
|
-
file !== null &&
|
|
83
|
-
Buffer.isBuffer(file.buffer));
|
|
84
|
-
}
|
|
85
|
-
function validateUploadedMessageFiles(files) {
|
|
86
|
-
for (const file of files) {
|
|
87
|
-
const contentType = (file.mimetype || "").toLowerCase();
|
|
88
|
-
if (!isAllowedContentType(contentType)) {
|
|
89
|
-
return `Unsupported attachment type: ${contentType || "unknown"}`;
|
|
90
|
-
}
|
|
91
|
-
if (file.buffer.length <= 0) {
|
|
92
|
-
return "Attachment is empty";
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
79
|
async function assertConversationAccess(req, conversationId) {
|
|
98
80
|
const conversation = await svc.getById(conversationId);
|
|
99
81
|
if (!conversation)
|
|
@@ -113,9 +95,6 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
113
95
|
return false;
|
|
114
96
|
return Boolean(agent.permissions.canCreateAgents);
|
|
115
97
|
}
|
|
116
|
-
function stringQuery(value) {
|
|
117
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
118
|
-
}
|
|
119
98
|
function assertChatLocalMutationAllowed(conversation) {
|
|
120
99
|
if (conversation.mutability === "external_bound_chat") {
|
|
121
100
|
throw conflict("Fork this Feishu chat to continue in Rudder");
|
|
@@ -141,35 +120,6 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
141
120
|
});
|
|
142
121
|
return sanitizeGeneratedTitle(runtimeResultText(result));
|
|
143
122
|
}
|
|
144
|
-
function positiveIntegerQuery(value, fallback, max) {
|
|
145
|
-
const parsed = Number(value ?? fallback);
|
|
146
|
-
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
147
|
-
return fallback;
|
|
148
|
-
return Math.min(max, Math.floor(parsed));
|
|
149
|
-
}
|
|
150
|
-
function paginateChatMessages(messages, query) {
|
|
151
|
-
const order = query.order === "newest" ? "newest" : "oldest";
|
|
152
|
-
const limit = positiveIntegerQuery(query.limit, 50, 500);
|
|
153
|
-
const cursor = stringQuery(query.cursor);
|
|
154
|
-
const ordered = order === "newest" ? [...messages].reverse() : messages;
|
|
155
|
-
const startIndex = cursor
|
|
156
|
-
? Math.max(0, ordered.findIndex((message) => message.id === cursor) + 1)
|
|
157
|
-
: 0;
|
|
158
|
-
const pageMessages = ordered.slice(startIndex, startIndex + limit);
|
|
159
|
-
const hasMore = startIndex + pageMessages.length < ordered.length;
|
|
160
|
-
return {
|
|
161
|
-
messages: pageMessages,
|
|
162
|
-
page: {
|
|
163
|
-
cursor,
|
|
164
|
-
nextCursor: hasMore && pageMessages.length > 0 ? pageMessages[pageMessages.length - 1].id : null,
|
|
165
|
-
hasMore,
|
|
166
|
-
limit,
|
|
167
|
-
order,
|
|
168
|
-
returnedMessages: pageMessages.length,
|
|
169
|
-
totalMessages: messages.length,
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
123
|
async function assertCanAssignTasks(req, orgId) {
|
|
174
124
|
assertCompanyAccess(req, orgId);
|
|
175
125
|
if (req.actor.type === "board") {
|
|
@@ -234,6 +184,40 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
234
184
|
}
|
|
235
185
|
}
|
|
236
186
|
}
|
|
187
|
+
async function preflightChatDraft(req, res, input) {
|
|
188
|
+
const orgId = req.params.orgId;
|
|
189
|
+
assertCompanyAccess(req, orgId);
|
|
190
|
+
const organization = await organizationsSvc.getById(orgId);
|
|
191
|
+
if (!organization) {
|
|
192
|
+
res.status(404).json({ error: "Organization not found" });
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
const contextLinks = input.contextLinks ?? [];
|
|
196
|
+
await assertContextLinksBelongToCompany(orgId, contextLinks);
|
|
197
|
+
let preferredAgentId = input.preferredAgentId ?? null;
|
|
198
|
+
if (preferredAgentId) {
|
|
199
|
+
const agent = await agentsSvc.getById(preferredAgentId);
|
|
200
|
+
if (!agent || agent.orgId !== orgId || agent.status === "terminated") {
|
|
201
|
+
res.status(422).json({ error: "Preferred agent must be available in the same organization" });
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const [defaultAgent] = await agentsSvc.list(orgId);
|
|
207
|
+
if (!defaultAgent) {
|
|
208
|
+
res.status(422).json({ error: "Chat requires an available agent" });
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
preferredAgentId = defaultAgent.id;
|
|
212
|
+
}
|
|
213
|
+
const availability = await assistantSvc.getDraftChatAssistantAvailability({
|
|
214
|
+
orgId,
|
|
215
|
+
preferredAgentId,
|
|
216
|
+
contextLinks,
|
|
217
|
+
planMode: input.planMode ?? false,
|
|
218
|
+
});
|
|
219
|
+
return { orgId, organization, contextLinks, preferredAgentId, availability };
|
|
220
|
+
}
|
|
237
221
|
function queueRequestActor(req) {
|
|
238
222
|
if (req.actor.type === "agent") {
|
|
239
223
|
return {
|
|
@@ -477,83 +461,15 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
477
461
|
async function persistAssistantReply(req, conversation, actor, assistantReply, turnContext, transcript = [], replyingAgentId = assistantReply.replyingAgentId ?? chatReplyingAgentId(conversation), existingMessageId, runId) {
|
|
478
462
|
const createdMessages = [];
|
|
479
463
|
const { chatTurnId, turnVariant } = turnContext;
|
|
480
|
-
const attachGeneratedFiles =
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const attachments = [];
|
|
490
|
-
const attachmentByVisualIndex = new Map();
|
|
491
|
-
for (const generated of generatedFiles) {
|
|
492
|
-
if (generated.body.length > MAX_ATTACHMENT_BYTES) {
|
|
493
|
-
throw new ChatAssistantStreamError(`Generated attachment exceeds ${MAX_ATTACHMENT_BYTES} bytes`, assistantReply.body, generatedFiles, { partialBodyUserVisible: true });
|
|
494
|
-
}
|
|
495
|
-
const stored = await storage.putFile({
|
|
496
|
-
orgId: conversation.orgId,
|
|
497
|
-
namespace: `chats/${conversation.id}/generated`,
|
|
498
|
-
originalFilename: generated.originalFilename,
|
|
499
|
-
contentType: generated.contentType,
|
|
500
|
-
body: generated.body,
|
|
501
|
-
});
|
|
502
|
-
const attachment = await svc.createAttachment({
|
|
503
|
-
orgId: conversation.orgId,
|
|
504
|
-
conversationId: conversation.id,
|
|
505
|
-
messageId: message.id,
|
|
506
|
-
provider: stored.provider,
|
|
507
|
-
objectKey: stored.objectKey,
|
|
508
|
-
contentType: stored.contentType,
|
|
509
|
-
byteSize: stored.byteSize,
|
|
510
|
-
sha256: stored.sha256,
|
|
511
|
-
originalFilename: stored.originalFilename,
|
|
512
|
-
createdByAgentId: replyingAgentId,
|
|
513
|
-
createdByUserId: null,
|
|
514
|
-
});
|
|
515
|
-
const typedAttachment = attachment;
|
|
516
|
-
const publicAttachment = generated.source === "codex_inline_visual"
|
|
517
|
-
? (({ provider: _provider, objectKey: _objectKey, ...safe }) => safe)(typedAttachment)
|
|
518
|
-
: typedAttachment;
|
|
519
|
-
attachments.push(publicAttachment);
|
|
520
|
-
if (generated.source === "codex_inline_visual") {
|
|
521
|
-
attachmentByVisualIndex.set(generated.directiveIndex, publicAttachment);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
let structuredPayload = message.structuredPayload ?? null;
|
|
525
|
-
if (inlineVisuals.length > 0) {
|
|
526
|
-
const persistedMappings = inlineVisuals.map((visual) => {
|
|
527
|
-
if (visual.status === "captured") {
|
|
528
|
-
const attachment = attachmentByVisualIndex.get(visual.directiveIndex);
|
|
529
|
-
if (attachment) {
|
|
530
|
-
return {
|
|
531
|
-
directiveIndex: visual.directiveIndex,
|
|
532
|
-
file: visual.file,
|
|
533
|
-
status: "ready",
|
|
534
|
-
attachmentId: attachment.id,
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
return {
|
|
539
|
-
directiveIndex: visual.directiveIndex,
|
|
540
|
-
file: visual.file,
|
|
541
|
-
status: "unavailable",
|
|
542
|
-
reason: visual.status === "unavailable" ? visual.reason : "capture_failed",
|
|
543
|
-
};
|
|
544
|
-
});
|
|
545
|
-
structuredPayload = {
|
|
546
|
-
...(structuredPayload ?? {}),
|
|
547
|
-
inlineVisuals: persistedMappings,
|
|
548
|
-
};
|
|
549
|
-
await svc.updateMessage(conversation.id, message.id, { structuredPayload });
|
|
550
|
-
}
|
|
551
|
-
return {
|
|
552
|
-
...message,
|
|
553
|
-
structuredPayload,
|
|
554
|
-
attachments: [...(message.attachments ?? []), ...attachments],
|
|
555
|
-
};
|
|
556
|
-
};
|
|
464
|
+
const attachGeneratedFiles = (message, generatedAttachments) => attachGeneratedChatFiles({
|
|
465
|
+
assistantReply,
|
|
466
|
+
generatedAttachments,
|
|
467
|
+
message,
|
|
468
|
+
conversation,
|
|
469
|
+
replyingAgentId,
|
|
470
|
+
storage,
|
|
471
|
+
chats: svc,
|
|
472
|
+
});
|
|
557
473
|
const saveAssistantMessage = async (input) => {
|
|
558
474
|
if (existingMessageId) {
|
|
559
475
|
const updated = await svc.updateMessage(conversation.id, existingMessageId, {
|
|
@@ -836,7 +752,8 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
836
752
|
if (!message || !generatedAttachments || generatedAttachments.length === 0)
|
|
837
753
|
return message;
|
|
838
754
|
const attachments = [];
|
|
839
|
-
|
|
755
|
+
const publishableAttachments = generatedAttachments.filter((generated) => generated.source !== "codex_inline_visual" && generated.source !== "rudder_inline_visual");
|
|
756
|
+
for (const generated of publishableAttachments) {
|
|
840
757
|
if (generated.body.length > MAX_ATTACHMENT_BYTES)
|
|
841
758
|
continue;
|
|
842
759
|
const stored = await storage.putFile({
|
|
@@ -1391,51 +1308,38 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1391
1308
|
res.json(await assistantSvc.enrichConversations(visibleConversations));
|
|
1392
1309
|
});
|
|
1393
1310
|
router.post("/orgs/:orgId/chats", validate(createChatConversationSchema), async (req, res) => {
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
if (!
|
|
1398
|
-
res.status(
|
|
1311
|
+
const draft = await preflightChatDraft(req, res, req.body);
|
|
1312
|
+
if (!draft)
|
|
1313
|
+
return;
|
|
1314
|
+
if (!draft.availability.available) {
|
|
1315
|
+
res.status(503).json({ error: draft.availability.error });
|
|
1399
1316
|
return;
|
|
1400
|
-
}
|
|
1401
|
-
const contextLinks = req.body.contextLinks ?? [];
|
|
1402
|
-
await assertContextLinksBelongToCompany(orgId, contextLinks);
|
|
1403
|
-
if (req.body.preferredAgentId) {
|
|
1404
|
-
const agent = await agentsSvc.getById(req.body.preferredAgentId);
|
|
1405
|
-
if (!agent || agent.orgId !== orgId) {
|
|
1406
|
-
res.status(422).json({ error: "Preferred agent must belong to the same organization" });
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
1409
1317
|
}
|
|
1410
1318
|
const actor = getActorInfo(req);
|
|
1411
|
-
const
|
|
1319
|
+
const result = await svc.createWithInitialMessage(draft.orgId, {
|
|
1412
1320
|
title: req.body.title,
|
|
1413
1321
|
summary: req.body.summary ?? null,
|
|
1414
|
-
preferredAgentId:
|
|
1415
|
-
issueCreationMode: req.body.issueCreationMode ?? organization.defaultChatIssueCreationMode,
|
|
1322
|
+
preferredAgentId: draft.preferredAgentId,
|
|
1323
|
+
issueCreationMode: req.body.issueCreationMode ?? draft.organization.defaultChatIssueCreationMode,
|
|
1416
1324
|
planMode: req.body.planMode ?? false,
|
|
1417
1325
|
createdByUserId: actor.actorType === "user" ? actor.actorId : null,
|
|
1418
|
-
contextLinks,
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
runId: actor.runId,
|
|
1426
|
-
action: "chat.created",
|
|
1427
|
-
entityType: "chat",
|
|
1428
|
-
entityId: conversation?.id ?? "unknown",
|
|
1429
|
-
details: {
|
|
1430
|
-
title: conversation?.title ?? "New chat",
|
|
1431
|
-
contextLinkCount: contextLinks.length,
|
|
1432
|
-
contextLinks: contextLinks.map((link) => ({
|
|
1433
|
-
entityType: link.entityType,
|
|
1434
|
-
entityId: link.entityId,
|
|
1435
|
-
})),
|
|
1326
|
+
contextLinks: draft.contextLinks,
|
|
1327
|
+
initialMessage: {
|
|
1328
|
+
role: actor.actorType === "agent" ? "assistant" : "user",
|
|
1329
|
+
kind: "message",
|
|
1330
|
+
status: "completed",
|
|
1331
|
+
body: req.body.initialMessage.body,
|
|
1332
|
+
replyingAgentId: actor.actorType === "agent" ? actor.agentId : null,
|
|
1436
1333
|
},
|
|
1334
|
+
activity: actor,
|
|
1437
1335
|
});
|
|
1438
|
-
res.status(201).json(await assistantSvc.enrichConversation(conversation));
|
|
1336
|
+
res.status(201).json(await assistantSvc.enrichConversation(result.conversation));
|
|
1337
|
+
});
|
|
1338
|
+
router.post("/orgs/:orgId/chats/preflight", validate(chatDraftSchema), async (req, res) => {
|
|
1339
|
+
const draft = await preflightChatDraft(req, res, req.body);
|
|
1340
|
+
if (!draft)
|
|
1341
|
+
return;
|
|
1342
|
+
res.json(draft.availability);
|
|
1439
1343
|
});
|
|
1440
1344
|
router.get("/chats/:id", async (req, res) => {
|
|
1441
1345
|
const conversation = await assertConversationAccess(req, req.params.id);
|
|
@@ -1473,10 +1377,14 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1473
1377
|
return;
|
|
1474
1378
|
}
|
|
1475
1379
|
}
|
|
1380
|
+
if (req.body.preferredAgentId === null) {
|
|
1381
|
+
res.status(422).json({ error: "Chat requires an available agent" });
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1476
1384
|
if (req.body.preferredAgentId) {
|
|
1477
1385
|
const agent = await agentsSvc.getById(req.body.preferredAgentId);
|
|
1478
|
-
if (!agent || agent.orgId !== existing.orgId) {
|
|
1479
|
-
res.status(422).json({ error: "Preferred agent must
|
|
1386
|
+
if (!agent || agent.orgId !== existing.orgId || agent.status === "terminated") {
|
|
1387
|
+
res.status(422).json({ error: "Preferred agent must be available in the same organization" });
|
|
1480
1388
|
return;
|
|
1481
1389
|
}
|
|
1482
1390
|
}
|
|
@@ -1513,7 +1421,7 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1513
1421
|
return;
|
|
1514
1422
|
}
|
|
1515
1423
|
await assertSideChatMutationAllowed(req, existing);
|
|
1516
|
-
const messages = await svc.
|
|
1424
|
+
const messages = await svc.listRecentUserMessages(existing.id, 5);
|
|
1517
1425
|
const prompt = buildChatTitlePromptFromMessages(messages);
|
|
1518
1426
|
if (!prompt) {
|
|
1519
1427
|
throw unprocessable("No chat messages available to generate a title");
|
|
@@ -1610,34 +1518,51 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1610
1518
|
});
|
|
1611
1519
|
res.status(201).json(await assistantSvc.enrichConversation(sideChat));
|
|
1612
1520
|
});
|
|
1613
|
-
router.
|
|
1521
|
+
router.delete("/chats/:id/side-chat", async (req, res) => {
|
|
1614
1522
|
assertBoard(req);
|
|
1615
1523
|
const existing = await assertConversationAccess(req, req.params.id);
|
|
1616
1524
|
if (!existing || existing.conversationKind !== "side_chat") {
|
|
1617
1525
|
res.status(404).json({ error: "Side Chat not found" });
|
|
1618
1526
|
return;
|
|
1619
1527
|
}
|
|
1528
|
+
if (existing.sideChatState === "kept" || existing.messengerVisible) {
|
|
1529
|
+
throw conflict("A kept Side Chat is a normal Messenger chat");
|
|
1530
|
+
}
|
|
1531
|
+
if (hasActiveChatGeneration(existing.id)) {
|
|
1532
|
+
cancelAndReleaseActiveChatGeneration(existing.id);
|
|
1533
|
+
}
|
|
1534
|
+
const attachments = await svc.listAttachmentsForConversation(existing.id);
|
|
1620
1535
|
const userId = boardUserId(req);
|
|
1621
|
-
const
|
|
1536
|
+
const destroyed = await sideChats.destroy({
|
|
1622
1537
|
conversationId: req.params.id,
|
|
1623
1538
|
userId,
|
|
1624
1539
|
});
|
|
1540
|
+
for (const attachment of attachments) {
|
|
1541
|
+
try {
|
|
1542
|
+
if (!await svc.assetHasAttachments(attachment.assetId)) {
|
|
1543
|
+
await storage.deleteObject(attachment.orgId, attachment.objectKey);
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
catch (err) {
|
|
1547
|
+
logger.warn({ err, conversationId: existing.id, attachmentId: attachment.id }, "failed to delete Side Chat attachment object");
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1625
1550
|
const actor = getActorInfo(req);
|
|
1626
1551
|
await logActivity(db, {
|
|
1627
|
-
orgId:
|
|
1552
|
+
orgId: existing.orgId,
|
|
1628
1553
|
actorType: actor.actorType,
|
|
1629
1554
|
actorId: actor.actorId,
|
|
1630
1555
|
agentId: actor.agentId,
|
|
1631
1556
|
runId: actor.runId,
|
|
1632
|
-
action: "chat.
|
|
1557
|
+
action: "chat.side_chat_destroyed",
|
|
1633
1558
|
entityType: "chat",
|
|
1634
|
-
entityId:
|
|
1559
|
+
entityId: existing.id,
|
|
1635
1560
|
details: {
|
|
1636
|
-
sourceConversationId:
|
|
1637
|
-
sourceMessageId:
|
|
1561
|
+
sourceConversationId: existing.forkedFromConversationId,
|
|
1562
|
+
sourceMessageId: existing.forkedFromMessageId,
|
|
1638
1563
|
},
|
|
1639
1564
|
});
|
|
1640
|
-
res.json(
|
|
1565
|
+
res.json(destroyed);
|
|
1641
1566
|
});
|
|
1642
1567
|
router.post("/chats/:id/side-chat/keep", async (req, res) => {
|
|
1643
1568
|
assertBoard(req);
|
|
@@ -1676,8 +1601,9 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1676
1601
|
return;
|
|
1677
1602
|
}
|
|
1678
1603
|
assertChatLocalMutationAllowed(existing);
|
|
1679
|
-
if (existing.conversationKind === "side_chat"
|
|
1680
|
-
|
|
1604
|
+
if (existing.conversationKind === "side_chat"
|
|
1605
|
+
&& (!existing.messengerVisible || existing.sideChatState !== "kept")) {
|
|
1606
|
+
throw conflict("Close the Side Chat tab to destroy this temporary chat");
|
|
1681
1607
|
}
|
|
1682
1608
|
if (hasActiveChatGeneration(existing.id)) {
|
|
1683
1609
|
if (req.query.cancelActive === "true") {
|
|
@@ -1776,7 +1702,7 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1776
1702
|
}
|
|
1777
1703
|
const latestGeneration = await svc.getLatestGeneration(conversation.id);
|
|
1778
1704
|
if (latestGeneration && latestGeneration.status !== "completed") {
|
|
1779
|
-
throw conflict("
|
|
1705
|
+
throw conflict("Queue remains parked after a stopped or failed reply");
|
|
1780
1706
|
}
|
|
1781
1707
|
const item = await svc.claimNextQueuedMessage(conversation.id);
|
|
1782
1708
|
if (item) {
|
|
@@ -1859,24 +1785,26 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1859
1785
|
await assertSideChatMutationAllowed(req, conversation);
|
|
1860
1786
|
const active = getActiveChatGeneration(conversation.id);
|
|
1861
1787
|
const requestActor = queueRequestActor(req);
|
|
1788
|
+
const activityActor = getActorInfo(req);
|
|
1862
1789
|
const controlActionId = req.body.controlActionId ?? randomUUID();
|
|
1863
1790
|
const expectedGenerationId = req.body.expectedActiveGenerationId
|
|
1864
1791
|
?? active?.generationId
|
|
1865
1792
|
?? null;
|
|
1866
1793
|
if (!expectedGenerationId) {
|
|
1867
|
-
const scheduled = await
|
|
1794
|
+
const scheduled = await steerMessages.scheduleContinuation({
|
|
1868
1795
|
orgId: conversation.orgId,
|
|
1869
1796
|
conversationId: conversation.id,
|
|
1870
1797
|
itemId: req.params.itemId,
|
|
1871
1798
|
controlActionId,
|
|
1872
1799
|
requestActor,
|
|
1800
|
+
actor: activityActor,
|
|
1873
1801
|
});
|
|
1874
1802
|
wakeServerQueue();
|
|
1875
1803
|
res.json({
|
|
1876
1804
|
item: scheduled.item,
|
|
1877
1805
|
result: "scheduled_next",
|
|
1878
1806
|
disposition: "continuation_pending",
|
|
1879
|
-
controlActionId,
|
|
1807
|
+
controlActionId: scheduled.action.id,
|
|
1880
1808
|
activeGenerationId: scheduled.action.expectedGenerationId ?? null,
|
|
1881
1809
|
queueVersion: scheduled.item.version,
|
|
1882
1810
|
transcriptEventId: null,
|
|
@@ -1891,7 +1819,7 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1891
1819
|
const expectedControlVersion = req.body.expectedControlVersion
|
|
1892
1820
|
?? queueSnapshot.activeControlVersion
|
|
1893
1821
|
?? 0;
|
|
1894
|
-
const
|
|
1822
|
+
const startedControl = await steerMessages.beginControlAction({
|
|
1895
1823
|
orgId: conversation.orgId,
|
|
1896
1824
|
conversationId: conversation.id,
|
|
1897
1825
|
itemId: req.params.itemId,
|
|
@@ -1900,7 +1828,9 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
1900
1828
|
expectedAttemptEpoch,
|
|
1901
1829
|
expectedControlVersion,
|
|
1902
1830
|
requestActor,
|
|
1831
|
+
actor: activityActor,
|
|
1903
1832
|
});
|
|
1833
|
+
const started = startedControl;
|
|
1904
1834
|
const durableControlActionId = started.action.id;
|
|
1905
1835
|
const durableGenerationId = started.action.expectedGenerationId ?? expectedGenerationId;
|
|
1906
1836
|
const durableAttemptEpoch = started.action.expectedAttemptEpoch ?? expectedAttemptEpoch;
|
|
@@ -2189,6 +2119,10 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
2189
2119
|
}
|
|
2190
2120
|
const releaseGeneration = claimChatGeneration(conversation.id, null, null);
|
|
2191
2121
|
if (!releaseGeneration) {
|
|
2122
|
+
if (req.body.editUserMessageId) {
|
|
2123
|
+
res.status(409).json({ error: "Stop the current response before editing this message" });
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2192
2126
|
const item = await svc.createQueuedMessage({
|
|
2193
2127
|
orgId: conversation.orgId,
|
|
2194
2128
|
conversationId: conversation.id,
|
|
@@ -2276,7 +2210,10 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
2276
2210
|
res.status(201).json({ messages: createdMessages });
|
|
2277
2211
|
}
|
|
2278
2212
|
catch (err) {
|
|
2279
|
-
logger.warn({
|
|
2213
|
+
logger.warn({
|
|
2214
|
+
err: chatAssistantErrorForLog(err),
|
|
2215
|
+
conversationId: conversation.id,
|
|
2216
|
+
}, "chat assistant reply failed");
|
|
2280
2217
|
if (err instanceof HttpError) {
|
|
2281
2218
|
throw err;
|
|
2282
2219
|
}
|
|
@@ -2312,6 +2249,7 @@ export function chatRoutes(db, storage, backgroundRuntime = createChatBackground
|
|
|
2312
2249
|
isMultipartRequest,
|
|
2313
2250
|
uploadedMessageFiles,
|
|
2314
2251
|
validateUploadedMessageFiles,
|
|
2252
|
+
preflightChatDraft,
|
|
2315
2253
|
logChatMessagesAdded,
|
|
2316
2254
|
assertContextLinksBelongToCompany,
|
|
2317
2255
|
turnContextFromUserMessage,
|