@rudderhq/server 0.5.2-canary.2 → 0.6.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 +15 -0
- package/dist/bootstrap/register-api-routes.js.map +1 -1
- package/dist/bootstrap/types.d.ts +11 -0
- package/dist/bootstrap/types.d.ts.map +1 -1
- package/dist/bundled-plugins/plugin-linear/dist/worker.js +741 -7
- package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +3 -3
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.d.ts +7 -0
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +15 -1
- package/dist/local-runtime.js.map +1 -1
- package/dist/middleware/auth.js +2 -2
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/error-handler.d.ts.map +1 -1
- package/dist/middleware/error-handler.js +3 -2
- package/dist/middleware/error-handler.js.map +1 -1
- package/dist/middleware/logger.d.ts +4 -0
- package/dist/middleware/logger.d.ts.map +1 -1
- package/dist/middleware/logger.js +82 -7
- package/dist/middleware/logger.js.map +1 -1
- package/dist/middleware/logger.test.js +94 -1
- package/dist/middleware/logger.test.js.map +1 -1
- package/dist/routes/chats.annotation-routes.d.ts +47 -0
- package/dist/routes/chats.annotation-routes.d.ts.map +1 -0
- package/dist/routes/chats.annotation-routes.js +164 -0
- package/dist/routes/chats.annotation-routes.js.map +1 -0
- package/dist/routes/chats.d.ts.map +1 -1
- package/dist/routes/chats.js +467 -165
- package/dist/routes/chats.js.map +1 -1
- package/dist/routes/chats.stream-routes.d.ts +1 -10
- package/dist/routes/chats.stream-routes.d.ts.map +1 -1
- package/dist/routes/chats.stream-routes.js +168 -110
- package/dist/routes/chats.stream-routes.js.map +1 -1
- package/dist/routes/chats.stream-support.d.ts +79 -0
- package/dist/routes/chats.stream-support.d.ts.map +1 -0
- package/dist/routes/chats.stream-support.js +121 -0
- package/dist/routes/chats.stream-support.js.map +1 -0
- package/dist/routes/issues.comments-attachments.d.ts.map +1 -1
- package/dist/routes/issues.comments-attachments.js +16 -2
- package/dist/routes/issues.comments-attachments.js.map +1 -1
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +21 -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 +20 -33
- package/dist/routes/issues.mutations.js.map +1 -1
- package/dist/routes/managed-mcp-agent-bindings.d.ts +15 -0
- package/dist/routes/managed-mcp-agent-bindings.d.ts.map +1 -0
- package/dist/routes/managed-mcp-agent-bindings.js +66 -0
- package/dist/routes/managed-mcp-agent-bindings.js.map +1 -0
- package/dist/routes/managed-mcp-connections.d.ts +8 -0
- package/dist/routes/managed-mcp-connections.d.ts.map +1 -0
- package/dist/routes/managed-mcp-connections.js +189 -0
- package/dist/routes/managed-mcp-connections.js.map +1 -0
- package/dist/routes/managed-mcp-runtime.d.ts +5 -0
- package/dist/routes/managed-mcp-runtime.d.ts.map +1 -0
- package/dist/routes/managed-mcp-runtime.js +148 -0
- package/dist/routes/managed-mcp-runtime.js.map +1 -0
- package/dist/routes/messenger.d.ts.map +1 -1
- package/dist/routes/messenger.js +1 -1
- package/dist/routes/messenger.js.map +1 -1
- package/dist/services/access.d.ts.map +1 -1
- package/dist/services/access.js +91 -12
- package/dist/services/access.js.map +1 -1
- package/dist/services/agent-run-context.d.ts +1 -0
- package/dist/services/agent-run-context.d.ts.map +1 -1
- package/dist/services/agent-run-context.js +5 -1
- package/dist/services/agent-run-context.js.map +1 -1
- package/dist/services/board-auth.d.ts +2 -2
- package/dist/services/chat-annotation-copy-lineage.d.ts +32 -0
- package/dist/services/chat-annotation-copy-lineage.d.ts.map +1 -0
- package/dist/services/chat-annotation-copy-lineage.js +110 -0
- package/dist/services/chat-annotation-copy-lineage.js.map +1 -0
- package/dist/services/chat-assistant.annotations.d.ts +16 -0
- package/dist/services/chat-assistant.annotations.d.ts.map +1 -0
- package/dist/services/chat-assistant.annotations.js +108 -0
- package/dist/services/chat-assistant.annotations.js.map +1 -0
- package/dist/services/chat-assistant.annotations.test.d.ts +2 -0
- package/dist/services/chat-assistant.annotations.test.d.ts.map +1 -0
- package/dist/services/chat-assistant.annotations.test.js +257 -0
- package/dist/services/chat-assistant.annotations.test.js.map +1 -0
- package/dist/services/chat-assistant.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.d.ts +2 -3
- package/dist/services/chat-assistant.helpers.d.ts.map +1 -1
- package/dist/services/chat-assistant.helpers.js +37 -53
- package/dist/services/chat-assistant.helpers.js.map +1 -1
- package/dist/services/chat-assistant.js +61 -5
- package/dist/services/chat-assistant.js.map +1 -1
- package/dist/services/chat-generation-protocol.d.ts +8 -15
- package/dist/services/chat-generation-protocol.d.ts.map +1 -1
- package/dist/services/chat-generation-protocol.js +19 -59
- package/dist/services/chat-generation-protocol.js.map +1 -1
- package/dist/services/chat-generation-protocol.test.js +168 -6
- package/dist/services/chat-generation-protocol.test.js.map +1 -1
- package/dist/services/chat-generation-provenance.d.ts +14 -0
- package/dist/services/chat-generation-provenance.d.ts.map +1 -0
- package/dist/services/chat-generation-provenance.js +71 -0
- package/dist/services/chat-generation-provenance.js.map +1 -0
- package/dist/services/chat-inline-annotation-rendering.d.ts +2 -0
- package/dist/services/chat-inline-annotation-rendering.d.ts.map +1 -0
- package/dist/services/chat-inline-annotation-rendering.js +265 -0
- package/dist/services/chat-inline-annotation-rendering.js.map +1 -0
- package/dist/services/chat-inline-annotation-resolved-labels.d.ts +11 -0
- package/dist/services/chat-inline-annotation-resolved-labels.d.ts.map +1 -0
- package/dist/services/chat-inline-annotation-resolved-labels.js +490 -0
- package/dist/services/chat-inline-annotation-resolved-labels.js.map +1 -0
- package/dist/services/chat-inline-annotation-validation.d.ts +15 -0
- package/dist/services/chat-inline-annotation-validation.d.ts.map +1 -0
- package/dist/services/chat-inline-annotation-validation.js +430 -0
- package/dist/services/chat-inline-annotation-validation.js.map +1 -0
- package/dist/services/chat-inline-annotations.d.ts +18 -0
- package/dist/services/chat-inline-annotations.d.ts.map +1 -0
- package/dist/services/chat-inline-annotations.js +52 -0
- package/dist/services/chat-inline-annotations.js.map +1 -0
- package/dist/services/chat-inline-annotations.test.d.ts +2 -0
- package/dist/services/chat-inline-annotations.test.d.ts.map +1 -0
- package/dist/services/chat-inline-annotations.test.js +1306 -0
- package/dist/services/chat-inline-annotations.test.js.map +1 -0
- package/dist/services/chat-queued-message-materialization.d.ts +126 -0
- package/dist/services/chat-queued-message-materialization.d.ts.map +1 -0
- package/dist/services/chat-queued-message-materialization.js +327 -0
- package/dist/services/chat-queued-message-materialization.js.map +1 -0
- package/dist/services/chat-steer-messages.d.ts +3 -3
- package/dist/services/chat-steer-messages.d.ts.map +1 -1
- package/dist/services/chat-steer-messages.js +50 -80
- package/dist/services/chat-steer-messages.js.map +1 -1
- package/dist/services/chat-work-manifest.d.ts.map +1 -1
- package/dist/services/chat-work-manifest.js +5 -1
- package/dist/services/chat-work-manifest.js.map +1 -1
- package/dist/services/chats.annotation-persistence.d.ts +20 -0
- package/dist/services/chats.annotation-persistence.d.ts.map +1 -0
- package/dist/services/chats.annotation-persistence.js +206 -0
- package/dist/services/chats.annotation-persistence.js.map +1 -0
- package/dist/services/chats.d.ts +129 -96
- package/dist/services/chats.d.ts.map +1 -1
- package/dist/services/chats.helpers.d.ts +2 -2
- package/dist/services/chats.inline-visual-persistence.d.ts +3 -3
- package/dist/services/chats.inline-visual-persistence.d.ts.map +1 -1
- package/dist/services/chats.inline-visual-persistence.js +114 -54
- package/dist/services/chats.inline-visual-persistence.js.map +1 -1
- package/dist/services/chats.js +743 -252
- package/dist/services/chats.js.map +1 -1
- package/dist/services/finance.d.ts +1 -1
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +8 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/integrations/agent-integrations.d.ts +2 -2
- package/dist/services/integrations/custom-integrations.d.ts +3 -1
- package/dist/services/integrations/custom-integrations.d.ts.map +1 -1
- package/dist/services/integrations/custom-integrations.js +13 -2
- package/dist/services/integrations/custom-integrations.js.map +1 -1
- package/dist/services/issues.comments-attachments.d.ts +7 -1
- package/dist/services/issues.comments-attachments.d.ts.map +1 -1
- package/dist/services/issues.comments-attachments.js +13 -1
- package/dist/services/issues.comments-attachments.js.map +1 -1
- package/dist/services/issues.d.ts +6 -0
- package/dist/services/issues.d.ts.map +1 -1
- package/dist/services/issues.js +22 -3
- package/dist/services/issues.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.core.d.ts +4 -1
- package/dist/services/knowledge-portability/organization-portability.core.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.core.js +17 -3
- package/dist/services/knowledge-portability/organization-portability.core.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.export.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.export.js +2 -2
- package/dist/services/knowledge-portability/organization-portability.export.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.import.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.import.js +13 -3
- package/dist/services/knowledge-portability/organization-portability.import.js.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.catalog.d.ts +3 -0
- package/dist/services/knowledge-portability/organization-skills.catalog.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.catalog.js +54 -23
- 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 +627 -124
- package/dist/services/knowledge-portability/organization-skills.js.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.sources.d.ts +1 -0
- package/dist/services/knowledge-portability/organization-skills.sources.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-skills.sources.js +53 -10
- package/dist/services/knowledge-portability/organization-skills.sources.js.map +1 -1
- package/dist/services/mcp/authorizer-lock.d.ts +9 -0
- package/dist/services/mcp/authorizer-lock.d.ts.map +1 -0
- package/dist/services/mcp/authorizer-lock.js +15 -0
- package/dist/services/mcp/authorizer-lock.js.map +1 -0
- package/dist/services/mcp/managed-bindings.d.ts +17 -0
- package/dist/services/mcp/managed-bindings.d.ts.map +1 -0
- package/dist/services/mcp/managed-bindings.js +332 -0
- package/dist/services/mcp/managed-bindings.js.map +1 -0
- package/dist/services/mcp/managed-client.d.ts +64 -0
- package/dist/services/mcp/managed-client.d.ts.map +1 -0
- package/dist/services/mcp/managed-client.js +238 -0
- package/dist/services/mcp/managed-client.js.map +1 -0
- package/dist/services/mcp/managed-client.test.d.ts +2 -0
- package/dist/services/mcp/managed-client.test.d.ts.map +1 -0
- package/dist/services/mcp/managed-client.test.js +398 -0
- package/dist/services/mcp/managed-client.test.js.map +1 -0
- package/dist/services/mcp/managed-connections.d.ts +81 -0
- package/dist/services/mcp/managed-connections.d.ts.map +1 -0
- package/dist/services/mcp/managed-connections.js +920 -0
- package/dist/services/mcp/managed-connections.js.map +1 -0
- package/dist/services/mcp/managed-runtime.d.ts +134 -0
- package/dist/services/mcp/managed-runtime.d.ts.map +1 -0
- package/dist/services/mcp/managed-runtime.js +282 -0
- package/dist/services/mcp/managed-runtime.js.map +1 -0
- package/dist/services/mcp/oauth-provider.d.ts +48 -0
- package/dist/services/mcp/oauth-provider.d.ts.map +1 -0
- package/dist/services/mcp/oauth-provider.js +120 -0
- package/dist/services/mcp/oauth-provider.js.map +1 -0
- package/dist/services/mcp/oauth-scope.test.d.ts +2 -0
- package/dist/services/mcp/oauth-scope.test.d.ts.map +1 -0
- package/dist/services/mcp/oauth-scope.test.js +69 -0
- package/dist/services/mcp/oauth-scope.test.js.map +1 -0
- package/dist/services/mcp/oauth-session-gc.d.ts +14 -0
- package/dist/services/mcp/oauth-session-gc.d.ts.map +1 -0
- package/dist/services/mcp/oauth-session-gc.js +34 -0
- package/dist/services/mcp/oauth-session-gc.js.map +1 -0
- package/dist/services/mcp/oauth-session-gc.test.d.ts +2 -0
- package/dist/services/mcp/oauth-session-gc.test.d.ts.map +1 -0
- package/dist/services/mcp/oauth-session-gc.test.js +66 -0
- package/dist/services/mcp/oauth-session-gc.test.js.map +1 -0
- package/dist/services/mcp/oauth.d.ts +61 -0
- package/dist/services/mcp/oauth.d.ts.map +1 -0
- package/dist/services/mcp/oauth.js +1690 -0
- package/dist/services/mcp/oauth.js.map +1 -0
- package/dist/services/mcp/pinned-fetch.d.ts +15 -0
- package/dist/services/mcp/pinned-fetch.d.ts.map +1 -0
- package/dist/services/mcp/pinned-fetch.js +400 -0
- package/dist/services/mcp/pinned-fetch.js.map +1 -0
- package/dist/services/mcp/pinned-fetch.test.d.ts +2 -0
- package/dist/services/mcp/pinned-fetch.test.d.ts.map +1 -0
- package/dist/services/mcp/pinned-fetch.test.js +190 -0
- package/dist/services/mcp/pinned-fetch.test.js.map +1 -0
- package/dist/services/mcp/provider-registry.d.ts +77 -0
- package/dist/services/mcp/provider-registry.d.ts.map +1 -0
- package/dist/services/mcp/provider-registry.js +80 -0
- package/dist/services/mcp/provider-registry.js.map +1 -0
- package/dist/services/mcp/provider-registry.test.d.ts +2 -0
- package/dist/services/mcp/provider-registry.test.d.ts.map +1 -0
- package/dist/services/mcp/provider-registry.test.js +80 -0
- package/dist/services/mcp/provider-registry.test.js.map +1 -0
- package/dist/services/mcp/security-policy.d.ts +48 -0
- package/dist/services/mcp/security-policy.d.ts.map +1 -0
- package/dist/services/mcp/security-policy.js +344 -0
- package/dist/services/mcp/security-policy.js.map +1 -0
- package/dist/services/mcp/security-policy.test.d.ts +2 -0
- package/dist/services/mcp/security-policy.test.d.ts.map +1 -0
- package/dist/services/mcp/security-policy.test.js +226 -0
- package/dist/services/mcp/security-policy.test.js.map +1 -0
- package/dist/services/mcp/tool-discovery.d.ts +49 -0
- package/dist/services/mcp/tool-discovery.d.ts.map +1 -0
- package/dist/services/mcp/tool-discovery.js +198 -0
- package/dist/services/mcp/tool-discovery.js.map +1 -0
- package/dist/services/mcp/tool-discovery.test.d.ts +2 -0
- package/dist/services/mcp/tool-discovery.test.d.ts.map +1 -0
- package/dist/services/mcp/tool-discovery.test.js +168 -0
- package/dist/services/mcp/tool-discovery.test.js.map +1 -0
- package/dist/services/messenger.d.ts +1 -1
- package/dist/services/messenger.d.ts.map +1 -1
- package/dist/services/messenger.js +21 -3
- package/dist/services/messenger.js.map +1 -1
- package/dist/services/plugin-registry.d.ts +3 -3
- package/dist/services/runtime-kernel/heartbeat.core.d.ts +1 -1
- package/dist/services/runtime-kernel/heartbeat.core.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.core.js +30 -4
- package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.wakeup.js +38 -23
- package/dist/services/runtime-kernel/heartbeat.wakeup.js.map +1 -1
- package/dist/services/secrets.d.ts +64 -6
- package/dist/services/secrets.d.ts.map +1 -1
- package/dist/services/secrets.js +38 -15
- package/dist/services/secrets.js.map +1 -1
- package/dist/services/side-chats.d.ts +1 -1
- package/dist/services/side-chats.d.ts.map +1 -1
- package/dist/services/side-chats.js +56 -14
- package/dist/services/side-chats.js.map +1 -1
- package/dist/services/workspace-runtime.services.d.ts +2 -2
- package/dist/services/workspace-web-preview.js +1 -1
- package/package.json +16 -13
- package/resources/bundled-skills/rudder-docs/references/operating-practices.md +12 -5
- package/skills/rudder-docs/references/operating-practices.md +12 -5
- package/ui-dist/assets/LibraryLiveSurface-CKOthw54.js +1 -0
- package/ui-dist/assets/{abnfDiagram-VRR7QNED-KGtP7zoC.js → abnfDiagram-VRR7QNED-C6a_wMho.js} +1 -1
- package/ui-dist/assets/{arc-JjnKyiOb.js → arc-CP0En6KA.js} +1 -1
- package/ui-dist/assets/architectureDiagram-ZJ3FMSHR-AHfOdcaZ.js +36 -0
- package/ui-dist/assets/{blockDiagram-677ZJIJ3-D7YzMYrz.js → blockDiagram-677ZJIJ3-Bkl9lp63.js} +1 -1
- package/ui-dist/assets/{c4Diagram-LMCZKHZV-Dpf7UQxl.js → c4Diagram-LMCZKHZV-BpZareVt.js} +1 -1
- package/ui-dist/assets/channel-DqxL_Zcy.js +1 -0
- package/ui-dist/assets/{chunk-2Q5K7J3B-UJ3gsGlQ.js → chunk-2Q5K7J3B-BQAwVuXc.js} +1 -1
- package/ui-dist/assets/{chunk-32BRIVSS-BeHl2j2l.js → chunk-32BRIVSS-YkmfA08F.js} +1 -1
- package/ui-dist/assets/{chunk-5VM5RSS4-STE9fJd0.js → chunk-5VM5RSS4-DvvjwTnG.js} +1 -1
- package/ui-dist/assets/{chunk-EX3LRPZG-Bj8g8j4B.js → chunk-EX3LRPZG-TXD_Yhg5.js} +1 -1
- package/ui-dist/assets/{chunk-JWPE2WC7-0V4Pwta-.js → chunk-JWPE2WC7-CgMlj6XI.js} +1 -1
- package/ui-dist/assets/{chunk-MOJQB5TN-DNPn50gm.js → chunk-MOJQB5TN-BnJjU8Rc.js} +1 -1
- package/ui-dist/assets/{chunk-RYQCIY6F-Befmnv8r.js → chunk-RYQCIY6F-D9B64JKM.js} +1 -1
- package/ui-dist/assets/{chunk-V7JOEXUC-Boh8TjHj.js → chunk-V7JOEXUC-PS09QVpl.js} +1 -1
- package/ui-dist/assets/{chunk-VR4S4FIN-B_yEQSo3.js → chunk-VR4S4FIN-DQXb7pRS.js} +1 -1
- package/ui-dist/assets/{chunk-XXDRQBXY-Cf1GnUFx.js → chunk-XXDRQBXY-B1UdLiF2.js} +1 -1
- package/ui-dist/assets/classDiagram-OUVF2IWQ-DMwjzuJE.js +1 -0
- package/ui-dist/assets/classDiagram-v2-EOCWNBFH-DMwjzuJE.js +1 -0
- package/ui-dist/assets/cose-bilkent-JH36ORCC-lqqmMB3m.js +1 -0
- package/ui-dist/assets/{cynefin-VYW2F7L2-Dv1yELYC.js → cynefin-VYW2F7L2-C9hu0XqZ.js} +1 -1
- package/ui-dist/assets/{cynefinDiagram-TSTJHNR4-CeFwjFoZ.js → cynefinDiagram-TSTJHNR4-Uuhz4c-1.js} +1 -1
- package/ui-dist/assets/{dagre-VKFMJZFB-8idd_4sX.js → dagre-VKFMJZFB-ChDrQYse.js} +1 -1
- package/ui-dist/assets/{diagram-FQU43EPY-BBVua6hM.js → diagram-FQU43EPY-DLtjkVSN.js} +1 -1
- package/ui-dist/assets/{diagram-G47NLZAW-D1zLQZlp.js → diagram-G47NLZAW-DCvEm4D0.js} +1 -1
- package/ui-dist/assets/{diagram-NH7WQ7WH-DE_FTSNv.js → diagram-NH7WQ7WH-Dz5jlsPG.js} +1 -1
- package/ui-dist/assets/{diagram-OA4YK3LP-61VSKBEn.js → diagram-OA4YK3LP-BXmQLO-Q.js} +1 -1
- package/ui-dist/assets/{diagram-WEI45ONY-C-tED6BJ.js → diagram-WEI45ONY-JnMU3xrx.js} +1 -1
- package/ui-dist/assets/{ebnfDiagram-CCIWWBDH-BEB8WGt0.js → ebnfDiagram-CCIWWBDH-Kryuqj4r.js} +1 -1
- package/ui-dist/assets/{erDiagram-Q63AITRT-AN_jm1TZ.js → erDiagram-Q63AITRT-Bn7g2mSW.js} +1 -1
- package/ui-dist/assets/{flowDiagram-23GEKE2U-BwLC6tI7.js → flowDiagram-23GEKE2U-DcjqTK91.js} +4 -4
- package/ui-dist/assets/ganttDiagram-NO4QXBWP-BRkw9-GE.js +292 -0
- package/ui-dist/assets/{gitGraphDiagram-IHSO6WYX-D9HCL9rY.js → gitGraphDiagram-IHSO6WYX-Cexcp6kR.js} +1 -1
- package/ui-dist/assets/graph-Cu7OV4Oi.js +1 -0
- package/ui-dist/assets/{index-BQXnpwke.js → index-ASZMPBYm.js} +5 -5
- package/ui-dist/assets/{index-5OM32_rf.js → index-B17BqCTj.js} +1 -1
- package/ui-dist/assets/{index-Cf0gLy6a.js → index-B9MccU1g.js} +1 -1
- package/ui-dist/assets/{index-BoSJ4Rx1.js → index-BPqbtW_X.js} +1 -1
- package/ui-dist/assets/{index-CpIdZ4-7.js → index-C2HjDa98.js} +1 -1
- package/ui-dist/assets/index-CMPtpj0A.js +1 -0
- package/ui-dist/assets/{index-p0ZGU1_7.js → index-CZXgOYtk.js} +1 -1
- package/ui-dist/assets/{index-74cx3ESJ.js → index-CknAauOP.js} +1 -1
- package/ui-dist/assets/index-Cu1GuH0a.js +1 -0
- package/ui-dist/assets/index-D8PdEImm.css +1 -0
- package/ui-dist/assets/{index-DrVDiJhe.js → index-DB1YX9-p.js} +1 -1
- package/ui-dist/assets/{index-vHMnAQSb.js → index-DBxLZXK7.js} +624 -610
- package/ui-dist/assets/{index-CpEfk5zb.js → index-DOCVOD97.js} +1 -1
- package/ui-dist/assets/{index-DMuWG0YN.js → index-DUbakRAC.js} +1 -1
- package/ui-dist/assets/{index-AT8juaIi.js → index-Dbg1ZwO2.js} +1 -1
- package/ui-dist/assets/index-DwbLsoLt.js +1 -0
- package/ui-dist/assets/index-hCLSotmS.js +1 -0
- package/ui-dist/assets/index-jrhEFc-j.js +1 -0
- package/ui-dist/assets/index-kz8ueXgo.js +1 -0
- package/ui-dist/assets/{infoDiagram-FWYZ7A6U-CyO3CAA1.js → infoDiagram-FWYZ7A6U-DugVGI3K.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-FXEZZL3T-BLLZuF1_.js → ishikawaDiagram-FXEZZL3T-CHy06Oev.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-5HDEW3XC-CWzQocvE.js → journeyDiagram-5HDEW3XC-BI0w53rb.js} +1 -1
- package/ui-dist/assets/{kanban-definition-HUTT4EX6-Dz4SFU-I.js → kanban-definition-HUTT4EX6-v_bLwx7B.js} +1 -1
- package/ui-dist/assets/layout-Dwp1s_bo.js +1 -0
- package/ui-dist/assets/{linear-BlzDlAaL.js → linear-DAV4STLZ.js} +1 -1
- package/ui-dist/assets/map-Bs6QpaaQ.js +1 -0
- package/ui-dist/assets/{mermaid.core-BtCydd-w.js → mermaid.core-fVmaL47V.js} +4 -4
- package/ui-dist/assets/{mindmap-definition-LN4V7U3C-BeIkKRBx.js → mindmap-definition-LN4V7U3C-5dWD4dxm.js} +1 -1
- package/ui-dist/assets/{pegDiagram-2B236MQR-BZgpT4TN.js → pegDiagram-2B236MQR-DB2XsDPN.js} +1 -1
- package/ui-dist/assets/{pieDiagram-ENE6RG2P-BRFggcg2.js → pieDiagram-ENE6RG2P-Bc5teLCS.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-ABIIQ3AL-CibUo3gT.js → quadrantDiagram-ABIIQ3AL-BlfNdETt.js} +1 -1
- package/ui-dist/assets/{railroadDiagram-RFXS5EU6-DINJqhgn.js → railroadDiagram-RFXS5EU6-BbXywkq3.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-TGXJPOKE-NegluQIe.js → requirementDiagram-TGXJPOKE-DU-CapdF.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-HTMAVEWB-Kq41yHAd.js → sankeyDiagram-HTMAVEWB-Ftvh3MqA.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-DBY2YBRQ-CngfEI4f.js → sequenceDiagram-DBY2YBRQ-CCtHt9V4.js} +1 -1
- package/ui-dist/assets/{sizeCapture-X5ZJPWSS-DUWRNlme.js → sizeCapture-X5ZJPWSS-x0jnIKHx.js} +1 -1
- package/ui-dist/assets/{stateDiagram-2N3HPSRC-BwHC_Fz4.js → stateDiagram-2N3HPSRC-2qCrydE7.js} +1 -1
- package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-CvGRUgRf.js +1 -0
- package/ui-dist/assets/{swimlanes-5IMT3BWC-Cqp2rT1K.js → swimlanes-5IMT3BWC-6kqJq5Xf.js} +2 -2
- package/ui-dist/assets/swimlanesDiagram-G3AALYLV-EBa7-qSc.js +8 -0
- package/ui-dist/assets/{timeline-definition-FHXFAJF6-BG3GYPCu.js → timeline-definition-FHXFAJF6-BuRz8KHZ.js} +1 -1
- package/ui-dist/assets/{vennDiagram-L72KCM5P-D1IFU27N.js → vennDiagram-L72KCM5P-BKzMZ_Rv.js} +1 -1
- package/ui-dist/assets/{wardleyDiagram-EHGQE667-DboO2kYu.js → wardleyDiagram-EHGQE667-8uXlFtBV.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-FW5EYKEG-vI2BGrXP.js → xychartDiagram-FW5EYKEG-CWKGlpF9.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/assets/architectureDiagram-ZJ3FMSHR-DHyfFgK0.js +0 -36
- package/ui-dist/assets/channel-TMGI9Qt9.js +0 -1
- package/ui-dist/assets/classDiagram-OUVF2IWQ-r5zIpY6G.js +0 -1
- package/ui-dist/assets/classDiagram-v2-EOCWNBFH-r5zIpY6G.js +0 -1
- package/ui-dist/assets/cose-bilkent-JH36ORCC-fSNs9447.js +0 -1
- package/ui-dist/assets/ganttDiagram-NO4QXBWP-CJYhBF1C.js +0 -292
- package/ui-dist/assets/graph-DdBT9W3J.js +0 -1
- package/ui-dist/assets/index-6UIO-gg7.js +0 -1
- package/ui-dist/assets/index-BVkQVMFn.js +0 -1
- package/ui-dist/assets/index-BaAPxkqh.css +0 -1
- package/ui-dist/assets/index-CmCERTmS.js +0 -1
- package/ui-dist/assets/index-Cr4lUIaJ.js +0 -1
- package/ui-dist/assets/index-D0fAqlES.js +0 -1
- package/ui-dist/assets/index-DfNcAyZq.js +0 -1
- package/ui-dist/assets/layout-D3tY9q4Q.js +0 -1
- package/ui-dist/assets/map-Ctg1-a9N.js +0 -1
- package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-C6P3NY96.js +0 -1
- package/ui-dist/assets/swimlanesDiagram-G3AALYLV-BNdDt62J.js +0 -8
|
@@ -1,65 +1,21 @@
|
|
|
1
|
-
import { addChatMessageSchema, chatClientCheckpointSchema, convertChatToIssueSchema, createChatAttachmentMetadataSchema, createChatContextLinkSchema, createChatFirstTurnSchema, resolveChatOperationProposalSchema, setChatProjectContextSchema, stopChatGenerationSchema, updateChatConversationUserStateSchema } from "@rudderhq/shared";
|
|
1
|
+
import { addChatMessageSchema, chatClientCheckpointSchema, convertChatToIssueSchema, createChatAttachmentMetadataSchema, createChatContextLinkSchema, createChatFirstTurnSchema, resolveChatOperationProposalSchema, setChatProjectContextSchema, stopChatGenerationSchema, updateChatConversationUserStateSchema, } from "@rudderhq/shared";
|
|
2
|
+
import { coalesceChatTranscriptTextEntries, withChatTranscriptGenerationProvenance, } from "@rudderhq/shared/chat-transcript-provenance";
|
|
2
3
|
import multer from "multer";
|
|
3
4
|
import { randomUUID } from "node:crypto";
|
|
4
5
|
import { isAllowedContentType, MAX_ATTACHMENT_BYTES } from "../attachment-types.js";
|
|
5
6
|
import { conflict } from "../errors.js";
|
|
6
7
|
import { logger } from "../middleware/logger.js";
|
|
7
8
|
import { validate } from "../middleware/validate.js";
|
|
8
|
-
import { chatAssistantErrorForLog
|
|
9
|
+
import { chatAssistantErrorForLog } from "../services/chat-assistant.helpers.js";
|
|
9
10
|
import { CHAT_ASSISTANT_USER_ERROR_MESSAGE, ChatAssistantStreamError, userVisiblePartialBodyFromError } from "../services/chat-assistant.js";
|
|
10
11
|
import { cancelActiveChatGeneration, claimChatGeneration, createChatRuntimeControlCoordinator, getActiveChatGeneration, setActiveChatGenerationId, } from "../services/chat-generation-locks.js";
|
|
11
12
|
import { hashChatGenerationBody } from "../services/chat-generation-protocol.js";
|
|
12
13
|
import { logActivity } from "../services/index.js";
|
|
13
14
|
import { assertCompanyAccess, getActorInfo } from "./authz.js";
|
|
14
15
|
import { wakeIssueAssigneeAfterChatConversion } from "./chat-issue-assignment-wakeup.js";
|
|
15
|
-
|
|
16
|
-
function createStartingChatGenerationGate() {
|
|
17
|
-
let resolveGeneration;
|
|
18
|
-
let resolveStopApplied;
|
|
19
|
-
return {
|
|
20
|
-
generationReady: new Promise((resolve) => {
|
|
21
|
-
resolveGeneration = resolve;
|
|
22
|
-
}),
|
|
23
|
-
stopApplied: new Promise((resolve) => {
|
|
24
|
-
resolveStopApplied = resolve;
|
|
25
|
-
}),
|
|
26
|
-
stopRequested: false,
|
|
27
|
-
resolveGeneration,
|
|
28
|
-
resolveStopApplied,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function outputAdmissionClosed(error) {
|
|
32
|
-
return Boolean(error
|
|
33
|
-
&& typeof error === "object"
|
|
34
|
-
&& "status" in error
|
|
35
|
-
&& Number(error.status) === 409
|
|
36
|
-
&& "message" in error
|
|
37
|
-
&& error.message === "Chat-visible output admission is closed for this generation");
|
|
38
|
-
}
|
|
39
|
-
function normalizeMultipartFirstTurnBody(body) {
|
|
40
|
-
if (!body)
|
|
41
|
-
return {};
|
|
42
|
-
const normalized = { ...body };
|
|
43
|
-
if (typeof normalized.planMode === "string") {
|
|
44
|
-
if (normalized.planMode === "true")
|
|
45
|
-
normalized.planMode = true;
|
|
46
|
-
else if (normalized.planMode === "false")
|
|
47
|
-
normalized.planMode = false;
|
|
48
|
-
}
|
|
49
|
-
if (typeof normalized.contextLinks === "string") {
|
|
50
|
-
try {
|
|
51
|
-
normalized.contextLinks = JSON.parse(normalized.contextLinks);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
// Leave invalid JSON in place so the shared schema returns a normal 400.
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return normalized;
|
|
58
|
-
}
|
|
16
|
+
import { CHAT_ASSISTANT_RECOVERABLE_FAILURE_FALLBACK_MESSAGE, CHAT_ASSISTANT_STOPPED_FALLBACK_MESSAGE, createChatStreamFileStaging, createStartingChatGenerationGate, normalizeMultipartFirstTurnBody, normalizeMultipartMessageBody, outputAdmissionClosed, resolveStoppedAssistantState, startingChatGenerationGates, withMergedChatMessageAttachments, } from "./chats.stream-support.js";
|
|
59
17
|
export function registerChatStreamRoutes(ctx) {
|
|
60
|
-
const
|
|
61
|
-
const CHAT_ASSISTANT_STOPPED_FALLBACK_MESSAGE = "Chat run stopped before a final reply. Continue the conversation to resume from the preserved context.";
|
|
62
|
-
const { router, db, storage, svc, assistantSvc, agentsSvc, issuesSvc, projectsSvc, goalsSvc, access, operatorProfiles, heartbeat, assertConversationAccess, assertChatLocalMutationAllowed, assertSideChatMutationAllowed, touchSideChat, boardUserId, assertCanAssignTasks, runSingleFileUpload, runMessageFileUpload, isMultipartRequest, uploadedMessageFiles, validateUploadedMessageFiles, preflightChatDraft, logChatMessagesAdded, assertContextLinksBelongToCompany, turnContextFromUserMessage, addUserMessage, startChatTitleGeneration, attachFilesToUserMessage, loadAssistantInput, chatReplyingAgentId, assertCanConvertIssueProposal, persistAssistantReply, linkChatRunMessages, attachGeneratedFilesToPartialMessage, persistPartialAssistantMessage, recoverableFailurePayload, recoverableFailureBody, writeStreamEvent, queueRequestActor, wakeServerQueue, wakeTerminalProjector, } = ctx;
|
|
18
|
+
const { router, db, storage, svc, assistantSvc, agentsSvc, issuesSvc, projectsSvc, goalsSvc, access, operatorProfiles, heartbeat, assertConversationAccess, assertChatLocalMutationAllowed, assertSideChatMutationAllowed, touchSideChat, boardUserId, assertCanAssignTasks, runSingleFileUpload, runMessageFileUpload, isMultipartRequest, uploadedMessageFiles, validateUploadedMessageFiles, preflightChatDraft, logChatMessagesAdded, assertContextLinksBelongToCompany, turnContextFromUserMessage, addUserMessage, inlineAnnotations, storeUserMessageFiles, cleanupStoredUserMessageFiles, storeQueuedAnnotationFiles, cleanupUncommittedQueuedAnnotationFiles, startChatTitleGeneration, attachFilesToUserMessage, loadAssistantInput, chatReplyingAgentId, assertCanConvertIssueProposal, persistAssistantReply, linkChatRunMessages, attachGeneratedFilesToPartialMessage, persistPartialAssistantMessage, recoverableFailurePayload, recoverableFailureBody, writeStreamEvent, queueRequestActor, wakeServerQueue, wakeTerminalProjector, } = ctx;
|
|
63
19
|
const handleChatMessageStream = async (req, res) => {
|
|
64
20
|
const atomicFirstTurn = req.atomicFirstTurn;
|
|
65
21
|
if (isMultipartRequest(req) && !atomicFirstTurn?.uploadPrepared) {
|
|
@@ -78,7 +34,11 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
78
34
|
throw err;
|
|
79
35
|
}
|
|
80
36
|
}
|
|
81
|
-
const
|
|
37
|
+
const normalizedBody = isMultipartRequest(req)
|
|
38
|
+
? normalizeMultipartMessageBody(req.body)
|
|
39
|
+
: (req.body ?? {});
|
|
40
|
+
const inlineAnnotationsProvided = Object.hasOwn(normalizedBody, "inlineAnnotations");
|
|
41
|
+
const parsedBody = addChatMessageSchema.safeParse(normalizedBody);
|
|
82
42
|
if (!parsedBody.success) {
|
|
83
43
|
res.status(400).json({ error: "Invalid chat message", details: parsedBody.error.issues });
|
|
84
44
|
return;
|
|
@@ -107,6 +67,21 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
107
67
|
return;
|
|
108
68
|
}
|
|
109
69
|
const queuedMessageId = parsedBody.data.queuedMessageId ?? null;
|
|
70
|
+
if (queuedMessageId) {
|
|
71
|
+
res.status(409).json({
|
|
72
|
+
error: "Queued messages are delivered only by Rudder's server-owned Queue worker",
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const preparedAnnotations = !atomicFirstTurn && inlineAnnotationsProvided
|
|
77
|
+
? await inlineAnnotations.prepare({
|
|
78
|
+
orgId: conversation.orgId,
|
|
79
|
+
conversationId: conversation.id,
|
|
80
|
+
annotations: parsedBody.data.inlineAnnotations ?? [],
|
|
81
|
+
uploadedFileCount: messageFiles.length,
|
|
82
|
+
editUserMessageId: parsedBody.data.editUserMessageId ?? null,
|
|
83
|
+
})
|
|
84
|
+
: null;
|
|
110
85
|
if (!atomicFirstTurn) {
|
|
111
86
|
const assistantAvailability = await assistantSvc.getChatAssistantAvailability(conversation);
|
|
112
87
|
if (!assistantAvailability.available) {
|
|
@@ -125,27 +100,61 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
125
100
|
res.status(409).json({ error: "A chat reply is already being generated for this conversation" });
|
|
126
101
|
return;
|
|
127
102
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
103
|
+
const clientMutationId = `stream:${randomUUID()}`;
|
|
104
|
+
const storedQueueFiles = await storeQueuedAnnotationFiles(conversation, messageFiles);
|
|
105
|
+
let queuedResult;
|
|
106
|
+
try {
|
|
107
|
+
queuedResult = await svc.createQueuedMessageWithStagedAttachments({
|
|
108
|
+
orgId: conversation.orgId,
|
|
109
|
+
conversationId: conversation.id,
|
|
110
|
+
clientMutationId,
|
|
111
|
+
expectedGenerationId: getActiveChatGeneration(conversation.id)?.generationId ?? null,
|
|
112
|
+
requestActor: queueRequestActor(req),
|
|
113
|
+
payload: {
|
|
114
|
+
body: parsedBody.data.body,
|
|
115
|
+
attachmentIds: [],
|
|
116
|
+
...(inlineAnnotationsProvided
|
|
117
|
+
? { inlineAnnotations: preparedAnnotations?.annotations ?? [] }
|
|
118
|
+
: {}),
|
|
119
|
+
skillRefs: [],
|
|
120
|
+
projectId: null,
|
|
121
|
+
accessMode: null,
|
|
122
|
+
model: null,
|
|
123
|
+
effort: null,
|
|
124
|
+
metadata: {
|
|
125
|
+
source: "stream_endpoint_during_active_generation",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
stagedAttachments: storedQueueFiles.map((attachment) => ({
|
|
129
|
+
...attachment,
|
|
130
|
+
createdByAgentId: null,
|
|
131
|
+
createdByUserId: actor.actorId,
|
|
132
|
+
})),
|
|
133
|
+
attachmentFileIndexesByAnnotationId: preparedAnnotations?.attachmentFileIndexesByAnnotationId ?? new Map(),
|
|
134
|
+
});
|
|
131
135
|
}
|
|
132
|
-
|
|
136
|
+
catch (error) {
|
|
137
|
+
await cleanupUncommittedQueuedAnnotationFiles(conversation.orgId, clientMutationId, storedQueueFiles);
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
await cleanupUncommittedQueuedAnnotationFiles(conversation.orgId, clientMutationId, queuedResult.cleanupAttachments);
|
|
141
|
+
const item = queuedResult.item;
|
|
142
|
+
await logActivity(db, {
|
|
133
143
|
orgId: conversation.orgId,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
144
|
+
actorType: actor.actorType,
|
|
145
|
+
actorId: actor.actorId,
|
|
146
|
+
agentId: actor.agentId,
|
|
147
|
+
runId: actor.runId,
|
|
148
|
+
action: "chat.queue.created",
|
|
149
|
+
entityType: "chat",
|
|
150
|
+
entityId: conversation.id,
|
|
151
|
+
details: {
|
|
152
|
+
queuedMessageId: item.id,
|
|
153
|
+
position: item.position,
|
|
154
|
+
annotationCount: item.annotationCount ?? 0,
|
|
155
|
+
annotationSourceMessageIds: [
|
|
156
|
+
...new Set((item.payload.inlineAnnotations ?? []).map((annotation) => annotation.sourceMessageId)),
|
|
157
|
+
],
|
|
149
158
|
},
|
|
150
159
|
});
|
|
151
160
|
res.status(202);
|
|
@@ -156,6 +165,20 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
156
165
|
res.end();
|
|
157
166
|
return;
|
|
158
167
|
}
|
|
168
|
+
const stagedMessageFiles = createChatStreamFileStaging({
|
|
169
|
+
conversation: conversation,
|
|
170
|
+
shouldStage: !atomicFirstTurn,
|
|
171
|
+
files: messageFiles,
|
|
172
|
+
store: storeUserMessageFiles,
|
|
173
|
+
cleanup: cleanupStoredUserMessageFiles,
|
|
174
|
+
});
|
|
175
|
+
try {
|
|
176
|
+
await stagedMessageFiles.stage();
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
releaseGeneration();
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
159
182
|
const startupGate = createStartingChatGenerationGate();
|
|
160
183
|
startingChatGenerationGates.set(conversation.id, startupGate);
|
|
161
184
|
if (queuedMessageId) {
|
|
@@ -170,6 +193,7 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
170
193
|
startupGate.resolveGeneration(null);
|
|
171
194
|
startingChatGenerationGates.delete(conversation.id);
|
|
172
195
|
releaseGeneration();
|
|
196
|
+
await stagedMessageFiles.cleanup();
|
|
173
197
|
throw error;
|
|
174
198
|
}
|
|
175
199
|
}
|
|
@@ -184,6 +208,7 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
184
208
|
startupGate.resolveGeneration(null);
|
|
185
209
|
startingChatGenerationGates.delete(conversation.id);
|
|
186
210
|
releaseGeneration();
|
|
211
|
+
await stagedMessageFiles.cleanup();
|
|
187
212
|
if (atomicFirstTurn) {
|
|
188
213
|
const failurePayload = recoverableFailurePayload(error, null);
|
|
189
214
|
const failureBody = recoverableFailureBody(failurePayload) || CHAT_ASSISTANT_RECOVERABLE_FAILURE_FALLBACK_MESSAGE;
|
|
@@ -229,6 +254,8 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
229
254
|
const transcript = [];
|
|
230
255
|
let assistantProgressMessageId = null;
|
|
231
256
|
let activeChatRunId = null;
|
|
257
|
+
let userMessagePersisted = Boolean(atomicFirstTurn);
|
|
258
|
+
let committedUserMessageId = atomicFirstTurn?.userMessage.id ?? null;
|
|
232
259
|
let generationTerminalStatus = "failed";
|
|
233
260
|
let admittedAssistantBody = "";
|
|
234
261
|
let stopCutoff = null;
|
|
@@ -247,24 +274,12 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
247
274
|
};
|
|
248
275
|
};
|
|
249
276
|
abortController.signal.addEventListener("abort", freezeStopCutoff, { once: true });
|
|
250
|
-
const stoppedState = (fallbackBody) => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
const accumulator = createAssistantTextAccumulator();
|
|
258
|
-
for (const entry of stopCutoff.transcript) {
|
|
259
|
-
if (entry.kind === "assistant") {
|
|
260
|
-
accumulator.push(entry.text, entry.delta === true);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return {
|
|
264
|
-
body: stopCutoff.body.trim() ? stopCutoff.body : accumulator.fullText,
|
|
265
|
-
transcript: stopCutoff.transcript,
|
|
266
|
-
};
|
|
267
|
-
};
|
|
277
|
+
const stoppedState = (fallbackBody) => resolveStoppedAssistantState({
|
|
278
|
+
stopCutoff,
|
|
279
|
+
admittedAssistantBody,
|
|
280
|
+
transcript,
|
|
281
|
+
fallbackBody,
|
|
282
|
+
});
|
|
268
283
|
let stoppedPersistencePromise = null;
|
|
269
284
|
const persistStoppedAssistant = (stoppedConversation, replyingAgentId, fallbackBody) => {
|
|
270
285
|
if (stoppedPersistencePromise)
|
|
@@ -293,7 +308,7 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
293
308
|
let lastProjectionError;
|
|
294
309
|
for (let attempt = 1; attempt <= 3; attempt += 1) {
|
|
295
310
|
try {
|
|
296
|
-
stoppedMessage = await persistPartialAssistantMessage(stoppedConversation, stoppedBody, "stopped", turnContextForPartial, frozen.transcript, replyingAgentId, assistantProgressMessageId, activeChatRunId);
|
|
311
|
+
stoppedMessage = await persistPartialAssistantMessage(stoppedConversation, stoppedBody, "stopped", turnContextForPartial, frozen.transcript, replyingAgentId, assistantProgressMessageId, activeChatRunId, undefined, false);
|
|
297
312
|
lastProjectionError = undefined;
|
|
298
313
|
break;
|
|
299
314
|
}
|
|
@@ -338,7 +353,19 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
338
353
|
res.setHeader("X-Accel-Buffering", "no");
|
|
339
354
|
res.flushHeaders();
|
|
340
355
|
try {
|
|
341
|
-
const userMessage = atomicFirstTurn?.userMessage ?? await addUserMessage(conversation, parsedBody.data.body, actor, parsedBody.data.editUserMessageId ?? null
|
|
356
|
+
const userMessage = atomicFirstTurn?.userMessage ?? await addUserMessage(conversation, parsedBody.data.body, actor, parsedBody.data.editUserMessageId ?? null, {
|
|
357
|
+
provided: inlineAnnotationsProvided,
|
|
358
|
+
prepared: preparedAnnotations,
|
|
359
|
+
storedAttachments: stagedMessageFiles.files,
|
|
360
|
+
onPersisted: (messageId) => {
|
|
361
|
+
userMessagePersisted = true;
|
|
362
|
+
committedUserMessageId = messageId;
|
|
363
|
+
stagedMessageFiles.markCommitted();
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
userMessagePersisted = true;
|
|
367
|
+
committedUserMessageId = userMessage.id;
|
|
368
|
+
stagedMessageFiles.markCommitted();
|
|
342
369
|
await touchSideChat(req, conversation);
|
|
343
370
|
if (queuedMessageId) {
|
|
344
371
|
await svc.markQueuedMessageRunning({
|
|
@@ -350,19 +377,10 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
350
377
|
if (!parsedBody.data.editUserMessageId) {
|
|
351
378
|
startChatTitleGeneration(conversation, userMessage);
|
|
352
379
|
}
|
|
353
|
-
const userAttachments =
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
for (const attachment of userAttachments) {
|
|
359
|
-
mergedUserAttachmentsById.set(attachment.id, attachment);
|
|
360
|
-
}
|
|
361
|
-
const mergedUserAttachments = [...mergedUserAttachmentsById.values()];
|
|
362
|
-
const hydratedUserMessage = {
|
|
363
|
-
...userMessage,
|
|
364
|
-
attachments: mergedUserAttachments,
|
|
365
|
-
};
|
|
380
|
+
const userAttachments = atomicFirstTurn
|
|
381
|
+
? await attachFilesToUserMessage(conversation, userMessage.id, messageFiles, actor)
|
|
382
|
+
: [];
|
|
383
|
+
const hydratedUserMessage = withMergedChatMessageAttachments(userMessage, userAttachments);
|
|
366
384
|
turnContextForPartial = turnContextFromUserMessage(userMessage);
|
|
367
385
|
writeStreamEvent(res, {
|
|
368
386
|
type: "ack",
|
|
@@ -448,7 +466,6 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
448
466
|
runId: activeChatRunId,
|
|
449
467
|
bodyHash: hashChatGenerationBody(projectedBody),
|
|
450
468
|
body: projectedBody,
|
|
451
|
-
transcript: [...transcript],
|
|
452
469
|
replyingAgentId: chatReplyingAgentId(assistantInput.conversation),
|
|
453
470
|
chatTurnId: turnContextForPartial.chatTurnId,
|
|
454
471
|
turnVariant: turnContextForPartial.turnVariant,
|
|
@@ -487,7 +504,6 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
487
504
|
return;
|
|
488
505
|
const activeControl = getActiveChatGeneration(conversation.id);
|
|
489
506
|
const attemptEpoch = Math.max(1, activeControl?.attemptEpoch ?? generation?.attemptEpoch ?? 1);
|
|
490
|
-
const projectedTranscript = [...transcript, entry];
|
|
491
507
|
let committed;
|
|
492
508
|
try {
|
|
493
509
|
committed = await svc.generationProtocol.appendVisibleEventAndProject({
|
|
@@ -501,7 +517,6 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
501
517
|
runId: activeChatRunId,
|
|
502
518
|
bodyHash: hashChatGenerationBody(admittedAssistantBody),
|
|
503
519
|
body: admittedAssistantBody,
|
|
504
|
-
transcript: projectedTranscript,
|
|
505
520
|
replyingAgentId: chatReplyingAgentId(assistantInput.conversation),
|
|
506
521
|
chatTurnId: turnContextForPartial.chatTurnId,
|
|
507
522
|
turnVariant: turnContextForPartial.turnVariant,
|
|
@@ -513,12 +528,20 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
513
528
|
throw error;
|
|
514
529
|
}
|
|
515
530
|
assistantProgressMessageId = committed.message.id;
|
|
516
|
-
|
|
531
|
+
const durableEntry = withChatTranscriptGenerationProvenance(entry, {
|
|
532
|
+
generationId: generation.id,
|
|
533
|
+
generationSeq: committed.event.generationSeq,
|
|
534
|
+
});
|
|
535
|
+
const normalizedTranscript = coalesceChatTranscriptTextEntries([
|
|
536
|
+
...transcript,
|
|
537
|
+
durableEntry,
|
|
538
|
+
]);
|
|
539
|
+
transcript.splice(0, transcript.length, ...normalizedTranscript);
|
|
517
540
|
if (abortController.signal.aborted || clientClosed)
|
|
518
541
|
return;
|
|
519
542
|
writeStreamEvent(res, {
|
|
520
543
|
type: "transcript_entry",
|
|
521
|
-
entry,
|
|
544
|
+
entry: durableEntry,
|
|
522
545
|
generationId: generation.id,
|
|
523
546
|
attemptEpoch,
|
|
524
547
|
generationSeq: committed.event.generationSeq,
|
|
@@ -552,7 +575,6 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
552
575
|
runId: activeChatRunId,
|
|
553
576
|
bodyHash: hashChatGenerationBody(streamed.reply.body),
|
|
554
577
|
body: streamed.reply.body,
|
|
555
|
-
transcript: [...transcript],
|
|
556
578
|
replyingAgentId: streamed.replyingAgentId,
|
|
557
579
|
chatTurnId: turnContextForPartial.chatTurnId,
|
|
558
580
|
turnVariant: turnContextForPartial.turnVariant,
|
|
@@ -572,7 +594,7 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
572
594
|
await persistStoppedAssistant(assistantInput.conversation, streamed.replyingAgentId, streamed.partialBody);
|
|
573
595
|
return;
|
|
574
596
|
}
|
|
575
|
-
const createdMessages = await persistAssistantReply(req, assistantInput.conversation, actor, streamed.reply, turnContextForPartial, transcript, streamed.replyingAgentId, assistantProgressMessageId, activeChatRunId);
|
|
597
|
+
const createdMessages = await persistAssistantReply(req, assistantInput.conversation, actor, streamed.reply, turnContextForPartial, transcript, streamed.replyingAgentId, assistantProgressMessageId, activeChatRunId, false);
|
|
576
598
|
await linkChatRunMessages(assistantInput.conversation, activeChatRunId, createdMessages);
|
|
577
599
|
generationTerminalStatus = "completed";
|
|
578
600
|
await logChatMessagesAdded(assistantInput.conversation, createdMessages, {
|
|
@@ -599,6 +621,41 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
599
621
|
}
|
|
600
622
|
}
|
|
601
623
|
catch (err) {
|
|
624
|
+
if (!userMessagePersisted) {
|
|
625
|
+
logger.warn({
|
|
626
|
+
err: chatAssistantErrorForLog(err),
|
|
627
|
+
conversationId: conversation.id,
|
|
628
|
+
}, "chat user message persistence failed");
|
|
629
|
+
if (!clientClosed) {
|
|
630
|
+
writeStreamEvent(res, {
|
|
631
|
+
type: "error",
|
|
632
|
+
error: CHAT_ASSISTANT_USER_ERROR_MESSAGE,
|
|
633
|
+
errorCode: "chat_runtime_exception",
|
|
634
|
+
runId: null,
|
|
635
|
+
messageId: null,
|
|
636
|
+
});
|
|
637
|
+
res.end();
|
|
638
|
+
}
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (!turnContextForPartial && committedUserMessageId) {
|
|
642
|
+
logger.warn({
|
|
643
|
+
err: chatAssistantErrorForLog(err),
|
|
644
|
+
conversationId: conversation.id,
|
|
645
|
+
userMessageId: committedUserMessageId,
|
|
646
|
+
}, "chat user message hydration failed after commit");
|
|
647
|
+
if (!clientClosed) {
|
|
648
|
+
writeStreamEvent(res, {
|
|
649
|
+
type: "error",
|
|
650
|
+
error: CHAT_ASSISTANT_USER_ERROR_MESSAGE,
|
|
651
|
+
errorCode: "chat_runtime_exception",
|
|
652
|
+
runId: null,
|
|
653
|
+
messageId: committedUserMessageId,
|
|
654
|
+
});
|
|
655
|
+
res.end();
|
|
656
|
+
}
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
602
659
|
if (abortController.signal.aborted) {
|
|
603
660
|
try {
|
|
604
661
|
if (stoppedPersistencePromise) {
|
|
@@ -621,7 +678,7 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
621
678
|
|| CHAT_ASSISTANT_USER_ERROR_MESSAGE;
|
|
622
679
|
const generatedAttachments = err instanceof ChatAssistantStreamError ? err.generatedAttachments : [];
|
|
623
680
|
const failedReplyingAgentId = chatReplyingAgentId(assistantConversationForPartial);
|
|
624
|
-
let failedMessage = await persistPartialAssistantMessage(assistantConversationForPartial ?? conversation, partialBody, "failed", turnContextForPartial, transcript, failedReplyingAgentId, assistantProgressMessageId, activeChatRunId, failurePayload).catch(() => null);
|
|
681
|
+
let failedMessage = await persistPartialAssistantMessage(assistantConversationForPartial ?? conversation, partialBody, "failed", turnContextForPartial, transcript, failedReplyingAgentId, assistantProgressMessageId, activeChatRunId, failurePayload, false).catch(() => null);
|
|
625
682
|
await linkChatRunMessages(assistantConversationForPartial ?? conversation, activeChatRunId, failedMessage ? [failedMessage] : []).catch(() => { });
|
|
626
683
|
failedMessage = await attachGeneratedFilesToPartialMessage(assistantConversationForPartial ?? conversation, failedMessage, generatedAttachments, failedReplyingAgentId).catch(() => failedMessage);
|
|
627
684
|
if (failedMessage && assistantConversationForPartial) {
|
|
@@ -648,6 +705,7 @@ export function registerChatStreamRoutes(ctx) {
|
|
|
648
705
|
}
|
|
649
706
|
}
|
|
650
707
|
finally {
|
|
708
|
+
await stagedMessageFiles.cleanup();
|
|
651
709
|
abortController.signal.removeEventListener("abort", freezeStopCutoff);
|
|
652
710
|
req.off("aborted", handleClosed);
|
|
653
711
|
res.off("close", handleClosed);
|