@rudderhq/server 0.7.24-canary.2 → 0.7.24-canary.21
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/registry.d.ts.map +1 -1
- package/dist/agent-runtimes/registry.js +3 -17
- package/dist/agent-runtimes/registry.js.map +1 -1
- package/dist/agent-runtimes/registry.test.d.ts +2 -0
- package/dist/agent-runtimes/registry.test.d.ts.map +1 -0
- package/dist/agent-runtimes/registry.test.js +25 -0
- package/dist/agent-runtimes/registry.test.js.map +1 -0
- package/dist/app.d.ts +9 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +20 -0
- package/dist/app.js.map +1 -1
- package/dist/bootstrap/create-http-app.d.ts +2 -0
- package/dist/bootstrap/create-http-app.d.ts.map +1 -1
- package/dist/bootstrap/create-http-app.js +57 -2
- package/dist/bootstrap/create-http-app.js.map +1 -1
- package/dist/bootstrap/public-ingress-startup.d.ts +12 -0
- package/dist/bootstrap/public-ingress-startup.d.ts.map +1 -0
- package/dist/bootstrap/public-ingress-startup.js +54 -0
- package/dist/bootstrap/public-ingress-startup.js.map +1 -0
- package/dist/bootstrap/register-api-routes.d.ts +2 -1
- package/dist/bootstrap/register-api-routes.d.ts.map +1 -1
- package/dist/bootstrap/register-api-routes.js +5 -5
- package/dist/bootstrap/register-api-routes.js.map +1 -1
- package/dist/bootstrap/types.d.ts +14 -0
- package/dist/bootstrap/types.d.ts.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -1
- package/dist/embedded-postgres-startup-logs.d.ts +6 -0
- package/dist/embedded-postgres-startup-logs.d.ts.map +1 -0
- package/dist/embedded-postgres-startup-logs.js +48 -0
- package/dist/embedded-postgres-startup-logs.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -30
- package/dist/index.js.map +1 -1
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +10 -2
- package/dist/middleware/auth.js.map +1 -1
- package/dist/realtime/live-events-ws.d.ts.map +1 -1
- package/dist/realtime/live-events-ws.js +14 -0
- package/dist/realtime/live-events-ws.js.map +1 -1
- package/dist/routes/agents.d.ts +2 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +2 -10
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/agents.management-routes.d.ts.map +1 -1
- package/dist/routes/agents.management-routes.js +16 -60
- package/dist/routes/agents.management-routes.js.map +1 -1
- package/dist/routes/onboarding.d.ts +2 -1
- package/dist/routes/onboarding.d.ts.map +1 -1
- package/dist/routes/onboarding.js +50 -17
- package/dist/routes/onboarding.js.map +1 -1
- package/dist/routes/organization-rust-foundation-routes.d.ts +21 -0
- package/dist/routes/organization-rust-foundation-routes.d.ts.map +1 -0
- package/dist/routes/organization-rust-foundation-routes.js +410 -0
- package/dist/routes/organization-rust-foundation-routes.js.map +1 -0
- package/dist/routes/orgs.d.ts +4 -1
- package/dist/routes/orgs.d.ts.map +1 -1
- package/dist/routes/orgs.js +38 -102
- package/dist/routes/orgs.js.map +1 -1
- package/dist/routes/projects.d.ts +2 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +301 -28
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/public-ingress-auth.d.ts +8 -0
- package/dist/routes/public-ingress-auth.d.ts.map +1 -0
- package/dist/routes/public-ingress-auth.js +144 -0
- package/dist/routes/public-ingress-auth.js.map +1 -0
- package/dist/services/agent-run-context.d.ts.map +1 -1
- package/dist/services/agent-run-context.js +0 -1
- package/dist/services/agent-run-context.js.map +1 -1
- package/dist/services/agent-runtime-availability.d.ts.map +1 -1
- package/dist/services/agent-runtime-availability.js +0 -3
- package/dist/services/agent-runtime-availability.js.map +1 -1
- package/dist/services/assets.d.ts.map +1 -1
- package/dist/services/assets.js +9 -5
- package/dist/services/assets.js.map +1 -1
- package/dist/services/budgets.d.ts.map +1 -1
- package/dist/services/budgets.js +21 -19
- package/dist/services/budgets.js.map +1 -1
- package/dist/services/chat-assistant.helpers.d.ts +1 -1
- package/dist/services/chat-assistant.helpers.d.ts.map +1 -1
- package/dist/services/chat-assistant.runtime-overrides.d.ts.map +1 -1
- package/dist/services/chat-assistant.runtime-overrides.js +0 -2
- package/dist/services/chat-assistant.runtime-overrides.js.map +1 -1
- package/dist/services/chats.annotation-persistence.d.ts.map +1 -1
- package/dist/services/chats.annotation-persistence.js +2 -0
- package/dist/services/chats.annotation-persistence.js.map +1 -1
- package/dist/services/chats.d.ts.map +1 -1
- package/dist/services/chats.helpers.d.ts +2 -0
- package/dist/services/chats.helpers.d.ts.map +1 -1
- package/dist/services/chats.helpers.js +17 -1
- package/dist/services/chats.helpers.js.map +1 -1
- package/dist/services/chats.js +17 -33
- package/dist/services/chats.js.map +1 -1
- package/dist/services/chats.queued-message-create.d.ts.map +1 -1
- package/dist/services/chats.queued-message-create.js +2 -0
- package/dist/services/chats.queued-message-create.js.map +1 -1
- package/dist/services/chats.user-state-initialization.d.ts +5 -0
- package/dist/services/chats.user-state-initialization.d.ts.map +1 -0
- package/dist/services/chats.user-state-initialization.js +27 -0
- package/dist/services/chats.user-state-initialization.js.map +1 -0
- package/dist/services/costs.d.ts.map +1 -1
- package/dist/services/costs.js +2 -0
- package/dist/services/costs.js.map +1 -1
- package/dist/services/goal-public-contract.d.ts +13 -0
- package/dist/services/goal-public-contract.d.ts.map +1 -0
- package/dist/services/goal-public-contract.js +106 -0
- package/dist/services/goal-public-contract.js.map +1 -0
- package/dist/services/goal-public-contract.test.d.ts +2 -0
- package/dist/services/goal-public-contract.test.d.ts.map +1 -0
- package/dist/services/goal-public-contract.test.js +45 -0
- package/dist/services/goal-public-contract.test.js.map +1 -0
- package/dist/services/goals.d.ts +1 -2
- package/dist/services/goals.d.ts.map +1 -1
- package/dist/services/goals.js +72 -137
- package/dist/services/goals.js.map +1 -1
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/issues.comments-attachments.d.ts.map +1 -1
- package/dist/services/issues.comments-attachments.js +3 -0
- package/dist/services/issues.comments-attachments.js.map +1 -1
- package/dist/services/issues.d.ts.map +1 -1
- package/dist/services/issues.helpers.d.ts +3 -0
- package/dist/services/issues.helpers.d.ts.map +1 -1
- package/dist/services/issues.helpers.js +23 -0
- package/dist/services/issues.helpers.js.map +1 -1
- package/dist/services/issues.js +12 -24
- package/dist/services/issues.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.core.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.core.js +0 -4
- package/dist/services/knowledge-portability/organization-portability.core.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.d.ts +6 -2
- package/dist/services/knowledge-portability/organization-portability.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.import.d.ts +5 -1
- package/dist/services/knowledge-portability/organization-portability.import.d.ts.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.import.js +92 -9
- package/dist/services/knowledge-portability/organization-portability.import.js.map +1 -1
- package/dist/services/knowledge-portability/organization-portability.js +3 -1
- package/dist/services/knowledge-portability/organization-portability.js.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 +0 -6
- package/dist/services/knowledge-portability/organization-skills.catalog.js.map +1 -1
- package/dist/services/live-events.d.ts +2 -0
- package/dist/services/live-events.d.ts.map +1 -1
- package/dist/services/live-events.js +7 -1
- package/dist/services/live-events.js.map +1 -1
- package/dist/services/live-run-read-bridge.d.ts +11 -0
- package/dist/services/live-run-read-bridge.d.ts.map +1 -0
- package/dist/services/live-run-read-bridge.js +16 -0
- package/dist/services/live-run-read-bridge.js.map +1 -0
- package/dist/services/live-run-read-bridge.test.d.ts +2 -0
- package/dist/services/live-run-read-bridge.test.d.ts.map +1 -0
- package/dist/services/live-run-read-bridge.test.js +99 -0
- package/dist/services/live-run-read-bridge.test.js.map +1 -0
- package/dist/services/migration-preflight.d.ts.map +1 -1
- package/dist/services/migration-preflight.js +1 -0
- package/dist/services/migration-preflight.js.map +1 -1
- package/dist/services/migration-preflight.test.js +24 -0
- package/dist/services/migration-preflight.test.js.map +1 -1
- package/dist/services/organization-branding-fence.d.ts +30 -0
- package/dist/services/organization-branding-fence.d.ts.map +1 -0
- package/dist/services/organization-branding-fence.js +99 -0
- package/dist/services/organization-branding-fence.js.map +1 -0
- package/dist/services/organization-branding-fence.test.d.ts +2 -0
- package/dist/services/organization-branding-fence.test.d.ts.map +1 -0
- package/dist/services/organization-branding-fence.test.js +44 -0
- package/dist/services/organization-branding-fence.test.js.map +1 -0
- package/dist/services/organization-intelligence-profile-defaults.d.ts.map +1 -1
- package/dist/services/organization-intelligence-profile-defaults.js +32 -16
- package/dist/services/organization-intelligence-profile-defaults.js.map +1 -1
- package/dist/services/organization-intelligence-profiles.d.ts +1 -1
- package/dist/services/organization-intelligence-profiles.d.ts.map +1 -1
- package/dist/services/organization-intelligence-profiles.js +3 -2
- package/dist/services/organization-intelligence-profiles.js.map +1 -1
- package/dist/services/organization-mutation-fence.d.ts +21 -0
- package/dist/services/organization-mutation-fence.d.ts.map +1 -0
- package/dist/services/organization-mutation-fence.js +40 -0
- package/dist/services/organization-mutation-fence.js.map +1 -0
- package/dist/services/organization-mutation-outbox.d.ts +22 -0
- package/dist/services/organization-mutation-outbox.d.ts.map +1 -0
- package/dist/services/organization-mutation-outbox.js +125 -0
- package/dist/services/organization-mutation-outbox.js.map +1 -0
- package/dist/services/organization-mutation-outbox.test.d.ts +2 -0
- package/dist/services/organization-mutation-outbox.test.d.ts.map +1 -0
- package/dist/services/organization-mutation-outbox.test.js +80 -0
- package/dist/services/organization-mutation-outbox.test.js.map +1 -0
- package/dist/services/organization-resource-mutation-fence.d.ts +29 -0
- package/dist/services/organization-resource-mutation-fence.d.ts.map +1 -0
- package/dist/services/organization-resource-mutation-fence.js +75 -0
- package/dist/services/organization-resource-mutation-fence.js.map +1 -0
- package/dist/services/organization-resource-rust-authority.d.ts +7 -0
- package/dist/services/organization-resource-rust-authority.d.ts.map +1 -0
- package/dist/services/organization-resource-rust-authority.js +38 -0
- package/dist/services/organization-resource-rust-authority.js.map +1 -0
- package/dist/services/organization-resource-rust-authority.test.d.ts +2 -0
- package/dist/services/organization-resource-rust-authority.test.d.ts.map +1 -0
- package/dist/services/organization-resource-rust-authority.test.js +48 -0
- package/dist/services/organization-resource-rust-authority.test.js.map +1 -0
- package/dist/services/orgs.d.ts.map +1 -1
- package/dist/services/orgs.js +20 -2
- package/dist/services/orgs.js.map +1 -1
- package/dist/services/product-analytics.d.ts +1 -1
- package/dist/services/project-goal-mutation-fence.d.ts +35 -0
- package/dist/services/project-goal-mutation-fence.d.ts.map +1 -0
- package/dist/services/project-goal-mutation-fence.js +277 -0
- package/dist/services/project-goal-mutation-fence.js.map +1 -0
- package/dist/services/project-goal-mutation-fence.test.d.ts +2 -0
- package/dist/services/project-goal-mutation-fence.test.d.ts.map +1 -0
- package/dist/services/project-goal-mutation-fence.test.js +278 -0
- package/dist/services/project-goal-mutation-fence.test.js.map +1 -0
- package/dist/services/projects-create.test.d.ts +2 -0
- package/dist/services/projects-create.test.d.ts.map +1 -0
- package/dist/services/projects-create.test.js +174 -0
- package/dist/services/projects-create.test.js.map +1 -0
- package/dist/services/projects.d.ts +19 -3
- package/dist/services/projects.d.ts.map +1 -1
- package/dist/services/projects.js +215 -57
- package/dist/services/projects.js.map +1 -1
- package/dist/services/resource-catalog.d.ts.map +1 -1
- package/dist/services/resource-catalog.js +188 -112
- package/dist/services/resource-catalog.js.map +1 -1
- package/dist/services/run-intelligence.d.ts.map +1 -1
- package/dist/services/run-intelligence.js +3 -1
- 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 +0 -1
- package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.misc.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.misc.js +8 -4
- package/dist/services/runtime-kernel/heartbeat.misc.js.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.sessions.d.ts.map +1 -1
- package/dist/services/runtime-kernel/heartbeat.sessions.js +2 -0
- package/dist/services/runtime-kernel/heartbeat.sessions.js.map +1 -1
- package/dist/services/rust-foundation-bridge.d.ts +95 -0
- package/dist/services/rust-foundation-bridge.d.ts.map +1 -0
- package/dist/services/rust-foundation-bridge.js +802 -0
- package/dist/services/rust-foundation-bridge.js.map +1 -0
- package/dist/services/rust-foundation-bridge.test.d.ts +2 -0
- package/dist/services/rust-foundation-bridge.test.d.ts.map +1 -0
- package/dist/services/rust-foundation-bridge.test.js +829 -0
- package/dist/services/rust-foundation-bridge.test.js.map +1 -0
- package/dist/services/side-chats.d.ts.map +1 -1
- package/dist/services/side-chats.js +38 -19
- package/dist/services/side-chats.js.map +1 -1
- package/package.json +19 -16
- package/resources/bundled-skills/rudder-docs/references/cli-reference.md +2 -1
- package/resources/bundled-skills/visualize/SKILL.md +1 -1
- package/resources/native/aarch64-apple-darwin/migration-preflight +0 -0
- package/resources/native/aarch64-apple-darwin/rudder-server-foundation +0 -0
- package/resources/native/aarch64-pc-windows-msvc/migration-preflight.exe +0 -0
- package/resources/native/aarch64-pc-windows-msvc/rudder-server-foundation.exe +0 -0
- package/resources/native/aarch64-unknown-linux-gnu/migration-preflight +0 -0
- package/resources/native/aarch64-unknown-linux-gnu/rudder-server-foundation +0 -0
- package/resources/native/x86_64-apple-darwin/migration-preflight +0 -0
- package/resources/native/x86_64-apple-darwin/rudder-server-foundation +0 -0
- package/resources/native/x86_64-pc-windows-msvc/migration-preflight.exe +0 -0
- package/resources/native/x86_64-pc-windows-msvc/rudder-server-foundation.exe +0 -0
- package/resources/native/x86_64-unknown-linux-gnu/migration-preflight +0 -0
- package/resources/native/x86_64-unknown-linux-gnu/rudder-server-foundation +0 -0
- package/resources/postinstall-embedded-postgres.mjs +193 -0
- package/resources/postinstall-native-mode.mjs +36 -0
- package/skills/rudder-docs/references/cli-reference.md +2 -1
- package/skills/visualize/SKILL.md +1 -1
- package/ui-dist/assets/{LibraryLiveSurface-BpUD1odP.js → LibraryLiveSurface-Bs8V_pMU.js} +1 -1
- package/ui-dist/assets/{abnfDiagram-VRR7QNED-BPrBDdld.js → abnfDiagram-VRR7QNED-DneqWru9.js} +1 -1
- package/ui-dist/assets/{addon-fit-DNQtwoFo.js → addon-fit-DCRNyXYv.js} +1 -1
- package/ui-dist/assets/{arc-IXEjKK3z.js → arc-D_2I_R5Z.js} +1 -1
- package/ui-dist/assets/{architectureDiagram-ZJ3FMSHR-D5-GsWPu.js → architectureDiagram-ZJ3FMSHR-C0ANAv78.js} +1 -1
- package/ui-dist/assets/{blockDiagram-677ZJIJ3-BT91oUno.js → blockDiagram-677ZJIJ3-BqFGOix5.js} +1 -1
- package/ui-dist/assets/{c4Diagram-LMCZKHZV-DZa4R-RY.js → c4Diagram-LMCZKHZV-82LfEi1P.js} +1 -1
- package/ui-dist/assets/channel-DjvWm5jR.js +1 -0
- package/ui-dist/assets/{chunk-2Q5K7J3B-BJn1mzn0.js → chunk-2Q5K7J3B-DijvvGcl.js} +1 -1
- package/ui-dist/assets/{chunk-32BRIVSS-DX4CN1No.js → chunk-32BRIVSS-Z09s337w.js} +1 -1
- package/ui-dist/assets/{chunk-5VM5RSS4-Bvq0Cx67.js → chunk-5VM5RSS4-DgQWkO6B.js} +1 -1
- package/ui-dist/assets/{chunk-EX3LRPZG-C9g5iHPO.js → chunk-EX3LRPZG-UTEQqeds.js} +1 -1
- package/ui-dist/assets/{chunk-JWPE2WC7-DoPFngr_.js → chunk-JWPE2WC7-DAaSu1vD.js} +1 -1
- package/ui-dist/assets/{chunk-MOJQB5TN-CZeNor1c.js → chunk-MOJQB5TN-D_fTXJM3.js} +1 -1
- package/ui-dist/assets/{chunk-RYQCIY6F-DSIa1gN4.js → chunk-RYQCIY6F-C7H_axhC.js} +1 -1
- package/ui-dist/assets/{chunk-V7JOEXUC-B-t9NovP.js → chunk-V7JOEXUC-B2toa05O.js} +1 -1
- package/ui-dist/assets/{chunk-VR4S4FIN-C17_to2o.js → chunk-VR4S4FIN-CkRvPkE2.js} +1 -1
- package/ui-dist/assets/{chunk-XXDRQBXY-CMKjuqZI.js → chunk-XXDRQBXY-DOO_r0VK.js} +1 -1
- package/ui-dist/assets/classDiagram-OUVF2IWQ-CNSRItW2.js +1 -0
- package/ui-dist/assets/classDiagram-v2-EOCWNBFH-CNSRItW2.js +1 -0
- package/ui-dist/assets/{cose-bilkent-JH36ORCC--JzUailr.js → cose-bilkent-JH36ORCC-BzYjE_M-.js} +1 -1
- package/ui-dist/assets/{cynefin-VYW2F7L2-Is3IDXR5.js → cynefin-VYW2F7L2-Dcf0eQJ5.js} +1 -1
- package/ui-dist/assets/{cynefinDiagram-TSTJHNR4-D9pZPkr_.js → cynefinDiagram-TSTJHNR4-Cs_Lv8Ua.js} +1 -1
- package/ui-dist/assets/{dagre-VKFMJZFB-DQtVOPbA.js → dagre-VKFMJZFB-B8oZME7g.js} +1 -1
- package/ui-dist/assets/{diagram-FQU43EPY-nzceu0kB.js → diagram-FQU43EPY-DFHkB-_t.js} +1 -1
- package/ui-dist/assets/{diagram-G47NLZAW-Dw-D5CH5.js → diagram-G47NLZAW-FGxRm1A-.js} +1 -1
- package/ui-dist/assets/{diagram-NH7WQ7WH-CoyPw9Uo.js → diagram-NH7WQ7WH-Ot83ScOb.js} +1 -1
- package/ui-dist/assets/{diagram-OA4YK3LP-Cqoi9a6k.js → diagram-OA4YK3LP-CkiHNUvw.js} +1 -1
- package/ui-dist/assets/{diagram-WEI45ONY-D8RWrHSh.js → diagram-WEI45ONY-CxM3g_L3.js} +1 -1
- package/ui-dist/assets/{ebnfDiagram-CCIWWBDH-By9B5HMb.js → ebnfDiagram-CCIWWBDH-DbcqsHcY.js} +1 -1
- package/ui-dist/assets/{erDiagram-Q63AITRT-rwMzFibF.js → erDiagram-Q63AITRT-DLROlxDN.js} +1 -1
- package/ui-dist/assets/{flowDiagram-23GEKE2U-BaCpiX-T.js → flowDiagram-23GEKE2U-DphM_YLM.js} +1 -1
- package/ui-dist/assets/{ganttDiagram-NO4QXBWP-DzXDtk7b.js → ganttDiagram-NO4QXBWP--QIRtWYP.js} +1 -1
- package/ui-dist/assets/{gitGraphDiagram-IHSO6WYX-C1RILXL1.js → gitGraphDiagram-IHSO6WYX-Bg3QwNvE.js} +1 -1
- package/ui-dist/assets/{graph-RzQsSMN0.js → graph-B_1y14m_.js} +1 -1
- package/ui-dist/assets/{index-DeIqk5X9.js → index-6O1Ef9oA.js} +1 -1
- package/ui-dist/assets/{index-Ufqpd6-1.js → index-Aj3Mi7R6.js} +1 -1
- package/ui-dist/assets/{index-C9N1nzkG.js → index-B-yeMW3t.js} +1 -1
- package/ui-dist/assets/{index-Dp0HIAhW.js → index-BABow2kh.js} +1 -1
- package/ui-dist/assets/{index-DUw2q_Tn.js → index-BEgTumxB.js} +1 -1
- package/ui-dist/assets/{index-QzfB2Hm8.js → index-BQheb_6L.js} +1 -1
- package/ui-dist/assets/index-B_tEQoXz.css +32 -0
- package/ui-dist/assets/{index-S_I6m7qi.js → index-Bi9I1TFJ.js} +561 -560
- package/ui-dist/assets/{index-1CcOBUAh.js → index-BlFoD6Gg.js} +1 -1
- package/ui-dist/assets/{index-Bj8AKsm3.js → index-BueQLOw6.js} +1 -1
- package/ui-dist/assets/{index-CTY5MHTT.js → index-CMUgKK2j.js} +1 -1
- package/ui-dist/assets/{index-DLz28cdj.js → index-CS2TW9nf.js} +1 -1
- package/ui-dist/assets/{index-B7vWk3jX.js → index-CcWXJMSa.js} +1 -1
- package/ui-dist/assets/{index-Cm40qa2n.js → index-CdAtz86o.js} +1 -1
- package/ui-dist/assets/{index-DobP_OA5.js → index-E2v-0TkN.js} +1 -1
- package/ui-dist/assets/{index-Cd1EZEkn.js → index-XWYyP2hU.js} +1 -1
- package/ui-dist/assets/{infoDiagram-FWYZ7A6U-DVIzbK0n.js → infoDiagram-FWYZ7A6U-BxygKDVp.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-FXEZZL3T-BoCZRszc.js → ishikawaDiagram-FXEZZL3T-47zucfG2.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-5HDEW3XC-DCRkA_lv.js → journeyDiagram-5HDEW3XC-D8cyI8aY.js} +1 -1
- package/ui-dist/assets/{kanban-definition-HUTT4EX6-sttcO1jJ.js → kanban-definition-HUTT4EX6-CrxRNese.js} +1 -1
- package/ui-dist/assets/{layout-u47UnAg9.js → layout-OyZo5VN3.js} +1 -1
- package/ui-dist/assets/{linear-Hx-0ykqm.js → linear-CuiwlwQB.js} +1 -1
- package/ui-dist/assets/{map-JHAuHxTf.js → map-rixHzQ5d.js} +1 -1
- package/ui-dist/assets/{mermaid.core-duAMtZT0.js → mermaid.core-BBG92fxH.js} +4 -4
- package/ui-dist/assets/{mindmap-definition-LN4V7U3C-BqImMmHB.js → mindmap-definition-LN4V7U3C-CivqbhCV.js} +1 -1
- package/ui-dist/assets/{pegDiagram-2B236MQR-BBqSimCZ.js → pegDiagram-2B236MQR-JrPSWk9k.js} +1 -1
- package/ui-dist/assets/{pieDiagram-ENE6RG2P-IvsJkrmf.js → pieDiagram-ENE6RG2P-F4HEWR5n.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-ABIIQ3AL-CBW_UfNv.js → quadrantDiagram-ABIIQ3AL-BJNly8dn.js} +1 -1
- package/ui-dist/assets/{railroadDiagram-RFXS5EU6-Zjn4XqMZ.js → railroadDiagram-RFXS5EU6-DNORDnb2.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-TGXJPOKE-DPk09fAM.js → requirementDiagram-TGXJPOKE-710xtGEU.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-HTMAVEWB-qzaGYd61.js → sankeyDiagram-HTMAVEWB-BmWJHmHA.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-DBY2YBRQ-B-4BDFMx.js → sequenceDiagram-DBY2YBRQ-A73TFc3V.js} +1 -1
- package/ui-dist/assets/{sizeCapture-X5ZJPWSS-S3KZiokK.js → sizeCapture-X5ZJPWSS-B8otrPI2.js} +1 -1
- package/ui-dist/assets/{stateDiagram-2N3HPSRC-BumYuIdY.js → stateDiagram-2N3HPSRC-BZ9k729q.js} +1 -1
- package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-DepHJpk7.js +1 -0
- package/ui-dist/assets/{swimlanes-5IMT3BWC-T_bbOzkS.js → swimlanes-5IMT3BWC-W_CH_z9Z.js} +2 -2
- package/ui-dist/assets/swimlanesDiagram-G3AALYLV-BRL-ddud.js +8 -0
- package/ui-dist/assets/{timeline-definition-FHXFAJF6-95nLoqCi.js → timeline-definition-FHXFAJF6-CcXbC6J1.js} +1 -1
- package/ui-dist/assets/{vennDiagram-L72KCM5P-DROzWeg9.js → vennDiagram-L72KCM5P-BMHmsQqg.js} +1 -1
- package/ui-dist/assets/{wardleyDiagram-EHGQE667-f6rn8OB5.js → wardleyDiagram-EHGQE667-Bq2-CEvU.js} +1 -1
- package/ui-dist/assets/{xterm-DOe84fOC.js → xterm-8vrqRuWm.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-FW5EYKEG-JdlcTNzG.js → xychartDiagram-FW5EYKEG-De3RUAME.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/assets/channel-GV4x9fGv.js +0 -1
- package/ui-dist/assets/classDiagram-OUVF2IWQ-C9tnRpuJ.js +0 -1
- package/ui-dist/assets/classDiagram-v2-EOCWNBFH-C9tnRpuJ.js +0 -1
- package/ui-dist/assets/index-3zlQxsgk.css +0 -32
- package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-Cmr2JA9o.js +0 -1
- package/ui-dist/assets/swimlanesDiagram-G3AALYLV-BnoZ05uR.js +0 -8
- package/ui-dist/brands/google-gemini-logo.svg +0 -1
package/dist/services/goals.js
CHANGED
|
@@ -3,7 +3,10 @@ import { activateGoalSchema, parseLibraryEntryMentionHref, parseLibraryFileMenti
|
|
|
3
3
|
import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lt, or, sql } from "drizzle-orm";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { badRequest, conflict, forbidden, notFound, unprocessable } from "../errors.js";
|
|
6
|
+
import { publicGoalContractSummary, publicGoalRecord, publicGoalText } from "./goal-public-contract.js";
|
|
7
|
+
import { lockNodeMutationAuthority } from "./organization-mutation-fence.js";
|
|
6
8
|
import { buildDeferredWakePayload, readDeferredWakePayload } from "./runtime-kernel/heartbeat.sessions.js";
|
|
9
|
+
export { publicGoalText } from "./goal-public-contract.js";
|
|
7
10
|
function safeGoalShortRef(id) {
|
|
8
11
|
try {
|
|
9
12
|
return shortRefFor("goal", id);
|
|
@@ -258,111 +261,6 @@ function publicGoalOutcome(outcome) {
|
|
|
258
261
|
return "Goal completed with a decision";
|
|
259
262
|
return "Result needs more evidence";
|
|
260
263
|
}
|
|
261
|
-
const INTERNAL_GOAL_LANGUAGE = [
|
|
262
|
-
[/\bgoal\s+contract\b/gi, "Goal"],
|
|
263
|
-
[/\bcontract\s+revision\b/gi, "Goal update"],
|
|
264
|
-
[/\bcontracts?\b/gi, "agreement"],
|
|
265
|
-
[/\bobjective\s+mode\b/gi, "Goal type"],
|
|
266
|
-
[/\bevaluator\b/gi, "success check"],
|
|
267
|
-
[/\bevidence\s+requirements?\b/gi, "what we need to verify"],
|
|
268
|
-
[/\bautonomy\s+envelope\b/gi, "working boundaries"],
|
|
269
|
-
[/\bhuman\s+authorit(?:y|ies)\b/gi, "decisions that need you"],
|
|
270
|
-
[/\bcontinuation\b/gi, "next step"],
|
|
271
|
-
[/\bchange\s+proposal\b/gi, "Goal update"],
|
|
272
|
-
[/\bresult\s+proposal\b/gi, "result review"],
|
|
273
|
-
[/\bchange_proposal\b/gi, "Goal update"],
|
|
274
|
-
[/\bresult_proposal\b/gi, "result review"],
|
|
275
|
-
[/\bruntime\s+evidence\b/gi, "supporting evidence"],
|
|
276
|
-
[/\brun\s+evidence\b/gi, "supporting work"],
|
|
277
|
-
[/\bpara-memory-files\b/gi, "shared notes"],
|
|
278
|
-
[/\b(?:the\s+)?[`]?shared notes[`]?\s+skill\b/gi, "shared notes"],
|
|
279
|
-
[/\bdaily[- ]note\b/gi, "notes"],
|
|
280
|
-
[/\b(?:runtime\s+)?evidence\s+(?:demonstrates?|shows?)\s+that\b/gi, "Supporting work shows that"],
|
|
281
|
-
];
|
|
282
|
-
export function publicGoalText(value) {
|
|
283
|
-
const mapped = INTERNAL_GOAL_LANGUAGE.reduce((current, [pattern, replacement]) => current.replace(pattern, replacement), value);
|
|
284
|
-
return mapped
|
|
285
|
-
.replace(/\b(?:goal-feedback|goal-start|goal-change-decision|goal-result-evaluation):[0-9a-f-]{8,}\b/gi, "the related update")
|
|
286
|
-
.replace(/\b(?:artifact|run|issue|project|approval|decision|measurement|library-file|library-entry):\/\/[^\s)]+/gi, "supporting work")
|
|
287
|
-
.replace(/\b[0-9a-f]{8}-[0-9a-f-]{27,}\b/gi, "the related item")
|
|
288
|
-
.replace(/\b(?:feedback|activity|proposal|request|run)\s+(?:the related item|[0-9a-f-]{8,})\b/gi, "the related update");
|
|
289
|
-
}
|
|
290
|
-
function publicGoalToken(value) {
|
|
291
|
-
const known = {
|
|
292
|
-
bounded_reversible_work: "bounded, reversible work",
|
|
293
|
-
external_or_irreversible_action: "external or irreversible actions",
|
|
294
|
-
external_publication: "publishing externally",
|
|
295
|
-
authority_expansion: "expanding access",
|
|
296
|
-
acceptance: "accepting the result",
|
|
297
|
-
consequentialChanges: "consequential changes",
|
|
298
|
-
externalPublication: "publishing externally",
|
|
299
|
-
};
|
|
300
|
-
return known[value] ?? value.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").toLowerCase();
|
|
301
|
-
}
|
|
302
|
-
function publicGoalRecord(value) {
|
|
303
|
-
return value && typeof value === "object" && !Array.isArray(value)
|
|
304
|
-
? value
|
|
305
|
-
: {};
|
|
306
|
-
}
|
|
307
|
-
function publicGoalStrings(value) {
|
|
308
|
-
return Array.isArray(value)
|
|
309
|
-
? value.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
310
|
-
: [];
|
|
311
|
-
}
|
|
312
|
-
function publicGoalBoundarySummary(value) {
|
|
313
|
-
const record = publicGoalRecord(value);
|
|
314
|
-
const allowed = publicGoalStrings(record.allowed).map(publicGoalToken);
|
|
315
|
-
const approvals = publicGoalStrings(record.requiresHumanApproval).map(publicGoalToken);
|
|
316
|
-
const parts = [
|
|
317
|
-
allowed.length > 0 ? `The Agent may handle ${allowed.join(", ")}.` : null,
|
|
318
|
-
approvals.length > 0 ? `You will be asked before ${approvals.join(", ")}.` : null,
|
|
319
|
-
].filter((part) => Boolean(part));
|
|
320
|
-
return parts.length > 0 ? parts.join(" ") : null;
|
|
321
|
-
}
|
|
322
|
-
function publicGoalAuthoritySummary(value) {
|
|
323
|
-
const decisions = Object.entries(publicGoalRecord(value))
|
|
324
|
-
.filter(([, entry]) => entry === "board_human" || entry === true)
|
|
325
|
-
.map(([key]) => publicGoalToken(key));
|
|
326
|
-
return decisions.length > 0 ? `You decide ${decisions.join(", ")}.` : null;
|
|
327
|
-
}
|
|
328
|
-
function publicGoalCompletionSummary(value) {
|
|
329
|
-
const record = publicGoalRecord(value);
|
|
330
|
-
const requiresEvidence = record.terminalEvidenceRequired === true;
|
|
331
|
-
const requiresAcceptance = record.humanAcceptanceRequired === true;
|
|
332
|
-
if (requiresEvidence && requiresAcceptance)
|
|
333
|
-
return "Supporting work is shown, and you accept the result.";
|
|
334
|
-
if (requiresEvidence)
|
|
335
|
-
return "Supporting work is shown before the result is considered ready.";
|
|
336
|
-
if (requiresAcceptance)
|
|
337
|
-
return "You accept the result when it is ready.";
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
function publicGoalContractSummary(value) {
|
|
341
|
-
const record = publicGoalRecord(value);
|
|
342
|
-
const outcomeStatement = typeof record.outcomeStatement === "string" && record.outcomeStatement.trim()
|
|
343
|
-
? publicGoalText(record.outcomeStatement)
|
|
344
|
-
: null;
|
|
345
|
-
const criteria = Array.isArray(record.criteria)
|
|
346
|
-
? record.criteria.flatMap((criterion) => {
|
|
347
|
-
const label = publicGoalRecord(criterion).label;
|
|
348
|
-
return typeof label === "string" && label.trim() ? [{ label: publicGoalText(label) }] : [];
|
|
349
|
-
})
|
|
350
|
-
: [];
|
|
351
|
-
const targetTime = typeof record.evaluationDeadline === "string"
|
|
352
|
-
? record.evaluationDeadline
|
|
353
|
-
: typeof record.actionDeadline === "string" ? record.actionDeadline : null;
|
|
354
|
-
return {
|
|
355
|
-
...(outcomeStatement ? { outcomeStatement } : {}),
|
|
356
|
-
...(criteria.length > 0 ? { criteria } : {}),
|
|
357
|
-
...(targetTime ? { targetTime } : {}),
|
|
358
|
-
...(publicGoalBoundarySummary(record.autonomyEnvelope)
|
|
359
|
-
? { boundarySummary: publicGoalBoundarySummary(record.autonomyEnvelope) } : {}),
|
|
360
|
-
...(publicGoalAuthoritySummary(record.humanAuthorities)
|
|
361
|
-
? { approvalSummary: publicGoalAuthoritySummary(record.humanAuthorities) } : {}),
|
|
362
|
-
...(publicGoalCompletionSummary(record.evaluationPolicy)
|
|
363
|
-
? { completionSummary: publicGoalCompletionSummary(record.evaluationPolicy) } : {}),
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
264
|
export function publicGoalView(goal) {
|
|
367
265
|
const criteria = Array.isArray(goal.criteria)
|
|
368
266
|
? goal.criteria.flatMap((criterion) => {
|
|
@@ -1003,6 +901,14 @@ function assertSameResultProposalPayload(existing, input, candidateHash) {
|
|
|
1003
901
|
}
|
|
1004
902
|
}
|
|
1005
903
|
export function goalService(db) {
|
|
904
|
+
async function lockGoalNodeMutationAuthority(database, goalId) {
|
|
905
|
+
const scope = await database.select({ orgId: goals.orgId })
|
|
906
|
+
.from(goals)
|
|
907
|
+
.where(eq(goals.id, goalId))
|
|
908
|
+
.then((rows) => rows[0] ?? null);
|
|
909
|
+
if (scope)
|
|
910
|
+
await lockNodeMutationAuthority(database, scope.orgId);
|
|
911
|
+
}
|
|
1006
912
|
function facetFor(goal, pendingChange, readyResult, pendingWakeup = null, externalWorkFact = null) {
|
|
1007
913
|
if (goal.lifecycle === "closed")
|
|
1008
914
|
return "closed";
|
|
@@ -1763,18 +1669,24 @@ export function goalService(db) {
|
|
|
1763
1669
|
if (replay.status !== "completed" || !replay.goalId) {
|
|
1764
1670
|
throw conflict("Goal Start request has not completed");
|
|
1765
1671
|
}
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1672
|
+
const replayGoalId = replay.goalId;
|
|
1673
|
+
return db.transaction(async (tx) => {
|
|
1674
|
+
const database = tx;
|
|
1675
|
+
await lockNodeMutationAuthority(database, orgId);
|
|
1676
|
+
const goal = await database.select().from(goals).where(and(eq(goals.id, replayGoalId), eq(goals.orgId, orgId))).then((rows) => rows[0] ?? null);
|
|
1677
|
+
if (!goal)
|
|
1678
|
+
throw conflict("Completed Goal Start request has no Goal");
|
|
1679
|
+
const dispatch = await ensureGoalWakeupIntent(database, goal, {
|
|
1680
|
+
event: "goal_started",
|
|
1681
|
+
eventId: replay.id,
|
|
1682
|
+
actor,
|
|
1683
|
+
});
|
|
1684
|
+
return { goal, replayed: true, dispatch };
|
|
1773
1685
|
});
|
|
1774
|
-
return { goal, replayed: true, dispatch };
|
|
1775
1686
|
}
|
|
1776
1687
|
return db.transaction(async (tx) => {
|
|
1777
1688
|
const database = tx;
|
|
1689
|
+
await lockNodeMutationAuthority(database, orgId);
|
|
1778
1690
|
const owner = await requireInvokableOwner(database, orgId, input.packet.ownerAgentId);
|
|
1779
1691
|
if (!ownerCanAdvanceGoal(owner, {
|
|
1780
1692
|
title: input.packet.title,
|
|
@@ -1994,25 +1906,30 @@ export function goalService(db) {
|
|
|
1994
1906
|
};
|
|
1995
1907
|
}),
|
|
1996
1908
|
create: async (orgId, data) => {
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
1909
|
+
return db.transaction(async (tx) => {
|
|
1910
|
+
const database = tx;
|
|
1911
|
+
await lockNodeMutationAuthority(database, orgId);
|
|
1912
|
+
if (data.ownerAgentId)
|
|
1913
|
+
await requireInvokableOwner(database, orgId, data.ownerAgentId);
|
|
1914
|
+
return database.insert(goals).values({
|
|
1915
|
+
orgId,
|
|
1916
|
+
title: data.title,
|
|
1917
|
+
description: data.description ?? null,
|
|
1918
|
+
alignmentQuestion: data.alignmentQuestion ?? null,
|
|
1919
|
+
evaluationDeadline: data.targetTime ?? null,
|
|
1920
|
+
level: "task",
|
|
1921
|
+
status: "planned",
|
|
1922
|
+
lifecycle: "draft",
|
|
1923
|
+
parentId: null,
|
|
1924
|
+
ownerAgentId: data.ownerAgentId ?? null,
|
|
1925
|
+
ownerAgentRuntimeOverrides: data.ownerAgentRuntimeOverrides ?? null,
|
|
1926
|
+
}).returning().then((rows) => rows[0]);
|
|
1927
|
+
});
|
|
2012
1928
|
},
|
|
2013
1929
|
update: async (id, data, actorAgentId = null) => {
|
|
2014
1930
|
return db.transaction(async (tx) => {
|
|
2015
1931
|
const database = tx;
|
|
1932
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2016
1933
|
const current = await requireGoalForUpdate(database, id);
|
|
2017
1934
|
assertGoalOwner(current, actorAgentId);
|
|
2018
1935
|
if (current.lifecycle === "closed") {
|
|
@@ -2057,7 +1974,9 @@ export function goalService(db) {
|
|
|
2057
1974
|
}
|
|
2058
1975
|
await requireInvokableOwner(db, current.orgId, input.ownerAgentId);
|
|
2059
1976
|
const result = await db.transaction(async (tx) => {
|
|
2060
|
-
const
|
|
1977
|
+
const database = tx;
|
|
1978
|
+
await lockNodeMutationAuthority(database, current.orgId);
|
|
1979
|
+
const [goal] = await database.update(goals).set({
|
|
2061
1980
|
outcomeStatement: input.outcomeStatement,
|
|
2062
1981
|
objectiveMode: input.objectiveMode,
|
|
2063
1982
|
lifecycle: "active",
|
|
@@ -2079,21 +1998,21 @@ export function goalService(db) {
|
|
|
2079
1998
|
}).where(and(eq(goals.id, id), eq(goals.lifecycle, "draft"))).returning();
|
|
2080
1999
|
if (!goal)
|
|
2081
2000
|
throw conflict("Goal changed before activation; reload and retry");
|
|
2082
|
-
await
|
|
2001
|
+
await database.insert(goalOwnerAssignments).values({
|
|
2083
2002
|
orgId: current.orgId,
|
|
2084
2003
|
goalId: id,
|
|
2085
2004
|
agentId: input.ownerAgentId,
|
|
2086
2005
|
assignedByAuthorityRef: "activation",
|
|
2087
2006
|
assignmentRevision: 1,
|
|
2088
2007
|
});
|
|
2089
|
-
await
|
|
2008
|
+
await database.insert(goalPlans).values({
|
|
2090
2009
|
orgId: current.orgId,
|
|
2091
2010
|
goalId: id,
|
|
2092
2011
|
revision: 1,
|
|
2093
2012
|
...input.initialPlan,
|
|
2094
2013
|
createdByAgentId: actorAgentId,
|
|
2095
2014
|
});
|
|
2096
|
-
await
|
|
2015
|
+
await database.insert(goalActivities).values({
|
|
2097
2016
|
orgId: current.orgId,
|
|
2098
2017
|
goalId: id,
|
|
2099
2018
|
contractRevision: 1,
|
|
@@ -2110,6 +2029,7 @@ export function goalService(db) {
|
|
|
2110
2029
|
updatePlan: async (id, input, actorAgentId = null) => {
|
|
2111
2030
|
return db.transaction(async (tx) => {
|
|
2112
2031
|
const database = tx;
|
|
2032
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2113
2033
|
const current = await requireGoalForUpdate(database, id);
|
|
2114
2034
|
assertCanonicalActiveGoal(current);
|
|
2115
2035
|
assertGoalOwner(current, actorAgentId);
|
|
@@ -2143,6 +2063,7 @@ export function goalService(db) {
|
|
|
2143
2063
|
});
|
|
2144
2064
|
return db.transaction(async (tx) => {
|
|
2145
2065
|
const database = tx;
|
|
2066
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2146
2067
|
const current = await requireGoalForUpdate(database, id);
|
|
2147
2068
|
assertCanonicalActiveGoal(current);
|
|
2148
2069
|
assertGoalOwner(current, actorAgentId);
|
|
@@ -2247,6 +2168,7 @@ export function goalService(db) {
|
|
|
2247
2168
|
createActivity: async (id, input, actorAgentId = null) => {
|
|
2248
2169
|
return db.transaction(async (tx) => {
|
|
2249
2170
|
const database = tx;
|
|
2171
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2250
2172
|
const current = await requireGoalForUpdate(database, id);
|
|
2251
2173
|
assertCanonicalActiveGoal(current);
|
|
2252
2174
|
assertGoalOwner(current, actorAgentId);
|
|
@@ -2294,6 +2216,7 @@ export function goalService(db) {
|
|
|
2294
2216
|
feedback: async (id, input, actorUserId) => {
|
|
2295
2217
|
return db.transaction(async (tx) => {
|
|
2296
2218
|
const database = tx;
|
|
2219
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2297
2220
|
const current = await requireGoalForUpdate(database, id);
|
|
2298
2221
|
return recordFeedback(database, current, input, actorUserId);
|
|
2299
2222
|
});
|
|
@@ -2304,6 +2227,7 @@ export function goalService(db) {
|
|
|
2304
2227
|
const normalizedPatch = normalizeContractPatch(input.afterContract);
|
|
2305
2228
|
return db.transaction(async (tx) => {
|
|
2306
2229
|
const database = tx;
|
|
2230
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2307
2231
|
const current = await requireGoalForUpdate(database, id);
|
|
2308
2232
|
assertCanonicalActiveGoal(current);
|
|
2309
2233
|
assertGoalOwner(current, actorAgentId);
|
|
@@ -2414,6 +2338,7 @@ export function goalService(db) {
|
|
|
2414
2338
|
.where(eq(goalChangeProposals.id, proposalId)).then((rows) => rows[0] ?? null);
|
|
2415
2339
|
if (!proposal)
|
|
2416
2340
|
throw notFound("Goal change proposal not found");
|
|
2341
|
+
await lockNodeMutationAuthority(database, proposal.orgId);
|
|
2417
2342
|
const approval = await database.select().from(approvals).where(and(eq(approvals.id, proposal.approvalId), eq(approvals.orgId, proposal.orgId))).then((rows) => rows[0] ?? null);
|
|
2418
2343
|
if (!approval || approval.type !== "goal_change") {
|
|
2419
2344
|
throw unprocessable("Goal change proposal approval is invalid");
|
|
@@ -2581,6 +2506,7 @@ export function goalService(db) {
|
|
|
2581
2506
|
// deadlock on heartbeat_runs.agent_id foreign-key checks.
|
|
2582
2507
|
await database.select({ id: agents.id }).from(agents)
|
|
2583
2508
|
.where(eq(agents.id, actorAgentId)).for("update");
|
|
2509
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2584
2510
|
const current = await requireGoalForUpdate(database, id);
|
|
2585
2511
|
assertGoalOwner(current, actorAgentId);
|
|
2586
2512
|
if (actorRunId)
|
|
@@ -2667,6 +2593,7 @@ export function goalService(db) {
|
|
|
2667
2593
|
.where(eq(goalResultProposals.id, proposalId)).then((rows) => rows[0] ?? null);
|
|
2668
2594
|
if (!proposal)
|
|
2669
2595
|
throw notFound("Goal Result Proposal not found");
|
|
2596
|
+
await lockNodeMutationAuthority(database, proposal.orgId);
|
|
2670
2597
|
const current = await requireGoalForUpdate(database, proposal.goalId);
|
|
2671
2598
|
if (current.orgId !== proposal.orgId)
|
|
2672
2599
|
throw unprocessable("Goal Result Proposal organization mismatch");
|
|
@@ -2741,6 +2668,7 @@ export function goalService(db) {
|
|
|
2741
2668
|
.where(eq(goalResultProposals.id, proposalId)).then((rows) => rows[0] ?? null);
|
|
2742
2669
|
if (!proposal)
|
|
2743
2670
|
throw notFound("Goal Result Proposal not found");
|
|
2671
|
+
await lockNodeMutationAuthority(database, proposal.orgId);
|
|
2744
2672
|
if (proposal.status === "rejected") {
|
|
2745
2673
|
if (proposal.rejectionFeedback !== input.feedback) {
|
|
2746
2674
|
throw conflict("Goal Result Proposal rejection was replayed with different feedback");
|
|
@@ -2789,6 +2717,7 @@ export function goalService(db) {
|
|
|
2789
2717
|
assignOwner: async (id, input, actorAgentId = null) => {
|
|
2790
2718
|
return db.transaction(async (tx) => {
|
|
2791
2719
|
const database = tx;
|
|
2720
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2792
2721
|
const current = await requireGoalForUpdate(database, id);
|
|
2793
2722
|
assertCanonicalActiveGoal(current);
|
|
2794
2723
|
assertGoalOwner(current, actorAgentId);
|
|
@@ -2820,6 +2749,7 @@ export function goalService(db) {
|
|
|
2820
2749
|
setFocus: async (id, focus, actorAgentId = null) => {
|
|
2821
2750
|
return db.transaction(async (tx) => {
|
|
2822
2751
|
const database = tx;
|
|
2752
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2823
2753
|
const candidate = await requireGoal(database, id);
|
|
2824
2754
|
await database.execute(sql `select id from organizations where id = ${candidate.orgId} for update`);
|
|
2825
2755
|
const current = await requireGoalForUpdate(database, id);
|
|
@@ -2838,16 +2768,21 @@ export function goalService(db) {
|
|
|
2838
2768
|
evaluate: async (id, input, actorAgentId = null) => {
|
|
2839
2769
|
return db.transaction(async (tx) => {
|
|
2840
2770
|
const database = tx;
|
|
2771
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2841
2772
|
const current = await requireGoalForUpdate(database, id);
|
|
2842
2773
|
return evaluateInTransaction(database, current, input, actorAgentId);
|
|
2843
2774
|
});
|
|
2844
2775
|
},
|
|
2845
2776
|
remove: async (id) => {
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2777
|
+
return db.transaction(async (tx) => {
|
|
2778
|
+
const database = tx;
|
|
2779
|
+
await lockGoalNodeMutationAuthority(database, id);
|
|
2780
|
+
const existing = await requireGoalForUpdate(database, id);
|
|
2781
|
+
const dependencies = await getGoalDependencies(database, existing);
|
|
2782
|
+
if (!dependencies.canDelete)
|
|
2783
|
+
throw conflict("Only an unlinked draft Goal can be deleted", dependencies);
|
|
2784
|
+
return database.delete(goals).where(eq(goals.id, id)).returning().then((rows) => rows[0] ?? null);
|
|
2785
|
+
});
|
|
2851
2786
|
},
|
|
2852
2787
|
};
|
|
2853
2788
|
}
|