agor-live 0.21.2 → 0.22.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/cli/commands/branch/env/restart.js +1 -1
- package/dist/cli/commands/branch/env/start.js +1 -1
- package/dist/cli/commands/branch/env/stop.js +1 -1
- package/dist/core/api/index.cjs +5 -1
- package/dist/core/api/index.d.ts +6 -1
- package/dist/core/api/index.d.ts.map +1 -1
- package/dist/core/api/index.js +5 -1
- package/dist/core/claude/index.cjs +162 -14
- package/dist/core/claude/index.js +166 -18
- package/dist/core/client/index.cjs +43 -3
- package/dist/core/client/index.js +37 -3
- package/dist/core/config/browser.cjs +2 -2
- package/dist/core/config/browser.js +2 -2
- package/dist/core/config/config-manager.d.ts.map +1 -1
- package/dist/core/config/constants.d.ts +1 -1
- package/dist/core/config/index.cjs +174 -20
- package/dist/core/config/index.js +178 -24
- package/dist/core/config/types.d.ts +8 -0
- package/dist/core/config/types.d.ts.map +1 -1
- package/dist/core/db/index.cjs +495 -86
- package/dist/core/db/index.js +482 -75
- package/dist/core/db/repositories/artifacts.d.ts.map +1 -1
- package/dist/core/db/repositories/branches.d.ts +13 -1
- package/dist/core/db/repositories/branches.d.ts.map +1 -1
- package/dist/core/db/repositories/gateway-channels.d.ts.map +1 -1
- package/dist/core/db/repositories/index.d.ts +1 -0
- package/dist/core/db/repositories/index.d.ts.map +1 -1
- package/dist/core/db/repositories/session-relationships.d.ts +30 -0
- package/dist/core/db/repositories/session-relationships.d.ts.map +1 -0
- package/dist/core/db/repositories/users.d.ts +11 -0
- package/dist/core/db/repositories/users.d.ts.map +1 -1
- package/dist/core/db/schema.d.ts +421 -4
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.postgres.d.ts +226 -2
- package/dist/core/db/schema.postgres.d.ts.map +1 -1
- package/dist/core/db/schema.sqlite.d.ts +228 -2
- package/dist/core/db/schema.sqlite.d.ts.map +1 -1
- package/dist/core/drizzle/postgres/0050_artifact_source_session.sql +3 -0
- package/dist/core/drizzle/postgres/0051_session_relationships.sql +26 -0
- package/dist/core/drizzle/postgres/meta/_journal.json +14 -0
- package/dist/core/drizzle/sqlite/0059_artifact_source_session.sql +2 -0
- package/dist/core/drizzle/sqlite/0060_session_relationships.sql +23 -0
- package/dist/core/drizzle/sqlite/meta/_journal.json +14 -0
- package/dist/core/gateway/connector-registry.d.ts.map +1 -1
- package/dist/core/gateway/connector.d.ts +22 -0
- package/dist/core/gateway/connector.d.ts.map +1 -1
- package/dist/core/gateway/connectors/slack.d.ts +35 -3
- package/dist/core/gateway/connectors/slack.d.ts.map +1 -1
- package/dist/core/gateway/connectors/teams.d.ts +107 -0
- package/dist/core/gateway/connectors/teams.d.ts.map +1 -0
- package/dist/core/gateway/context.d.ts.map +1 -1
- package/dist/core/gateway/index.cjs +552 -52
- package/dist/core/gateway/index.d.ts +3 -2
- package/dist/core/gateway/index.d.ts.map +1 -1
- package/dist/core/gateway/index.js +544 -52
- package/dist/core/gateway/system-message.d.ts +21 -0
- package/dist/core/gateway/system-message.d.ts.map +1 -1
- package/dist/core/index.cjs +616 -127
- package/dist/core/index.js +597 -116
- package/dist/core/mcp/index.cjs +146 -9
- package/dist/core/mcp/index.js +146 -9
- package/dist/core/mcp/template-resolver.d.ts.map +1 -1
- package/dist/core/seed/index.cjs +375 -59
- package/dist/core/seed/index.js +378 -62
- package/dist/core/sessions/index.cjs +19 -0
- package/dist/core/sessions/index.js +19 -0
- package/dist/core/templates/agor-system-prompt.md +21 -53
- package/dist/core/templates/session-context.cjs +2 -73
- package/dist/core/templates/session-context.d.ts +9 -53
- package/dist/core/templates/session-context.d.ts.map +1 -1
- package/dist/core/templates/session-context.js +2 -72
- package/dist/core/tools/mcp/jwt-auth.cjs +2 -20
- package/dist/core/tools/mcp/jwt-auth.d.ts.map +1 -1
- package/dist/core/tools/mcp/jwt-auth.js +2 -20
- package/dist/core/tools/mcp/oauth-mcp-transport.cjs +2 -15
- package/dist/core/tools/mcp/oauth-mcp-transport.d.ts.map +1 -1
- package/dist/core/tools/mcp/oauth-mcp-transport.js +2 -15
- package/dist/core/tools/mcp/oauth-refresh.cjs +167 -19
- package/dist/core/tools/mcp/oauth-refresh.js +167 -19
- package/dist/core/types/artifact.d.ts +5 -1
- package/dist/core/types/artifact.d.ts.map +1 -1
- package/dist/core/types/branch.d.ts +14 -0
- package/dist/core/types/branch.d.ts.map +1 -1
- package/dist/core/types/gateway.d.ts +1 -1
- package/dist/core/types/gateway.d.ts.map +1 -1
- package/dist/core/types/id.d.ts +1 -0
- package/dist/core/types/id.d.ts.map +1 -1
- package/dist/core/types/index.cjs +36 -0
- package/dist/core/types/index.js +30 -0
- package/dist/core/types/session.d.ts +65 -1
- package/dist/core/types/session.d.ts.map +1 -1
- package/dist/core/types/task.d.ts +9 -0
- package/dist/core/types/task.d.ts.map +1 -1
- package/dist/core/unix/index.cjs +371 -55
- package/dist/core/unix/index.js +374 -58
- package/dist/core/unix/unix-integration-service.d.ts +10 -7
- package/dist/core/unix/unix-integration-service.d.ts.map +1 -1
- package/dist/core/utils/permission-mode-mapper.cjs +19 -0
- package/dist/core/utils/permission-mode-mapper.js +19 -0
- package/dist/daemon/declarations.d.ts +7 -0
- package/dist/daemon/declarations.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.js +53 -1
- package/dist/daemon/index.js +3760 -2107
- package/dist/daemon/main.js +3760 -2107
- package/dist/daemon/mcp/server.js +155 -17
- package/dist/daemon/mcp/tools/analytics.js +6 -7
- package/dist/daemon/mcp/tools/artifacts.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/artifacts.js +7 -7
- package/dist/daemon/mcp/tools/boards.js +6 -7
- package/dist/daemon/mcp/tools/branches.js +6 -7
- package/dist/daemon/mcp/tools/card-types.js +6 -7
- package/dist/daemon/mcp/tools/cards.js +6 -7
- package/dist/daemon/mcp/tools/environment.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/environment.js +19 -12
- package/dist/daemon/mcp/tools/knowledge.js +6 -7
- package/dist/daemon/mcp/tools/mcp-servers.js +6 -7
- package/dist/daemon/mcp/tools/messages.js +6 -7
- package/dist/daemon/mcp/tools/proxies.js +6 -7
- package/dist/daemon/mcp/tools/repos.js +6 -7
- package/dist/daemon/mcp/tools/schedules.js +6 -7
- package/dist/daemon/mcp/tools/search.js +6 -7
- package/dist/daemon/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/sessions.js +140 -11
- package/dist/daemon/mcp/tools/tasks.js +6 -7
- package/dist/daemon/mcp/tools/users.js +6 -7
- package/dist/daemon/mcp/tools/widgets.js +7 -8
- package/dist/daemon/register-hooks.d.ts +5 -1
- package/dist/daemon/register-hooks.d.ts.map +1 -1
- package/dist/daemon/register-hooks.js +404 -179
- package/dist/daemon/register-routes.d.ts.map +1 -1
- package/dist/daemon/register-routes.js +360 -162
- package/dist/daemon/register-services.d.ts.map +1 -1
- package/dist/daemon/register-services.js +1928 -671
- package/dist/daemon/services/artifacts.d.ts +10 -1
- package/dist/daemon/services/artifacts.d.ts.map +1 -1
- package/dist/daemon/services/artifacts.js +25 -1
- package/dist/daemon/services/branches.d.ts +11 -1
- package/dist/daemon/services/branches.d.ts.map +1 -1
- package/dist/daemon/services/branches.js +470 -184
- package/dist/daemon/services/claude-models.js +879 -339
- package/dist/daemon/services/gateway.d.ts +58 -2
- package/dist/daemon/services/gateway.d.ts.map +1 -1
- package/dist/daemon/services/gateway.js +590 -47
- package/dist/daemon/services/groups.d.ts +2 -0
- package/dist/daemon/services/groups.d.ts.map +1 -1
- package/dist/daemon/services/groups.js +56 -0
- package/dist/daemon/services/mcp-servers.d.ts.map +1 -1
- package/dist/daemon/services/mcp-servers.js +0 -6
- package/dist/daemon/services/scheduler.d.ts.map +1 -1
- package/dist/daemon/services/scheduler.js +6 -2
- package/dist/daemon/services/sessions.d.ts +11 -3
- package/dist/daemon/services/sessions.d.ts.map +1 -1
- package/dist/daemon/services/sessions.js +68 -7
- package/dist/daemon/services/tasks.d.ts +13 -2
- package/dist/daemon/services/tasks.d.ts.map +1 -1
- package/dist/daemon/services/tasks.js +42 -26
- package/dist/daemon/startup.js +6 -2
- package/dist/daemon/utils/session-stop.d.ts +43 -0
- package/dist/daemon/utils/session-stop.d.ts.map +1 -0
- package/dist/daemon/utils/session-stop.js +102 -0
- package/dist/daemon/utils/session-task-state.d.ts +7 -2
- package/dist/daemon/utils/session-task-state.d.ts.map +1 -1
- package/dist/daemon/utils/session-task-state.js +9 -3
- package/dist/daemon/utils/session-tasks.d.ts +4 -4
- package/dist/daemon/utils/session-tasks.d.ts.map +1 -1
- package/dist/daemon/utils/session-tasks.js +4 -8
- package/dist/executor/commands/environment.d.ts +13 -0
- package/dist/executor/commands/environment.d.ts.map +1 -0
- package/dist/executor/commands/environment.js +287 -0
- package/dist/executor/commands/index.d.ts.map +1 -1
- package/dist/executor/commands/index.js +5 -1
- package/dist/executor/commands/unix.d.ts +8 -1
- package/dist/executor/commands/unix.d.ts.map +1 -1
- package/dist/executor/commands/unix.js +157 -2
- package/dist/executor/payload-types.d.ts +201 -5
- package/dist/executor/payload-types.d.ts.map +1 -1
- package/dist/executor/payload-types.js +98 -0
- package/dist/executor/sdk-handlers/base/mcp-scoping.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/base/mcp-scoping.js +14 -0
- package/dist/executor/sdk-handlers/claude/message-processor.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/message-processor.js +0 -1
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts +1 -0
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/query-builder.js +91 -39
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts +12 -5
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/codex/prompt-service.js +72 -30
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/copilot/prompt-service.js +4 -13
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/gemini/prompt-service.js +4 -13
- package/dist/ui/assets/App-DcEY8Ota.js +3 -0
- package/dist/ui/assets/App-DcEY8Ota.js.gz +0 -0
- package/dist/ui/assets/{ArtifactConsentModal-ParNk5kW.js → ArtifactConsentModal-CiCbK9iv.js} +1 -1
- package/dist/ui/assets/ArtifactConsentModal-CiCbK9iv.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js +9 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js +18 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js.gz +0 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js +34 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js.gz +0 -0
- package/dist/ui/assets/{CodeEditor.inner-D51Z_CLQ.js → CodeEditor.inner-DBgsP4tn.js} +2 -2
- package/dist/ui/assets/CodeEditor.inner-DBgsP4tn.js.gz +0 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js +1 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js +24 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js.gz +0 -0
- package/dist/ui/assets/MarketingScreenshotPage-9Qd7eZsm.css +1 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js +143 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js.gz +0 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js +1 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js.gz +0 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js +20 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js.gz +0 -0
- package/dist/ui/assets/{App-BAdBsEnV.css → SessionCanvas-mEmYGZhC.css} +1 -1
- package/dist/ui/assets/SessionCanvas-mEmYGZhC.css.gz +0 -0
- package/dist/ui/assets/{StreamdownDemoPage-B9wbgp2s.js → StreamdownDemoPage-wzWaqWwr.js} +1 -1
- package/dist/ui/assets/StreamdownDemoPage-wzWaqWwr.js.gz +0 -0
- package/dist/ui/assets/{ThemeSwitcher-ubn6IOz9.js → ThemeSwitcher-Dly2y9pi.js} +1 -1
- package/dist/ui/assets/ThemeSwitcher-Dly2y9pi.js.gz +0 -0
- package/dist/ui/assets/antd-CfbbHJOz.js +401 -0
- package/dist/ui/assets/antd-CfbbHJOz.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-CykGFbQU.js +1 -0
- package/dist/ui/assets/{architectureDiagram-VXUJARFQ-ChmZt3zk.js → architectureDiagram-VXUJARFQ-C8HXAenz.js} +1 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-C8HXAenz.js.gz +0 -0
- package/dist/ui/assets/{blockDiagram-VD42YOAC-CzGHAHao.js → blockDiagram-VD42YOAC-BhZaEN19.js} +1 -1
- package/dist/ui/assets/blockDiagram-VD42YOAC-BhZaEN19.js.gz +0 -0
- package/dist/ui/assets/{c4Diagram-YG6GDRKO-DscJyaWN.js → c4Diagram-YG6GDRKO-Dk_UH-sY.js} +1 -1
- package/dist/ui/assets/c4Diagram-YG6GDRKO-Dk_UH-sY.js.gz +0 -0
- package/dist/ui/assets/channel-D6_nUWlW.js +1 -0
- package/dist/ui/assets/{chunk-4BX2VUAB-DoWpTvP8.js → chunk-4BX2VUAB-XprbG2TG.js} +1 -1
- package/dist/ui/assets/chunk-55IACEB6-ByzqIgSb.js +1 -0
- package/dist/ui/assets/{chunk-ABZYJK2D-RzDCrjE6.js → chunk-ABZYJK2D-BJcrryHK.js} +1 -1
- package/dist/ui/assets/chunk-ABZYJK2D-BJcrryHK.js.gz +0 -0
- package/dist/ui/assets/{chunk-AGHRB4JF-jidCS5Of.js → chunk-AGHRB4JF-DvxmfbM0.js} +1 -1
- package/dist/ui/assets/chunk-AGHRB4JF-DvxmfbM0.js.gz +0 -0
- package/dist/ui/assets/{chunk-ATLVNIR6-BEIIfJtC.js → chunk-ATLVNIR6-DbeJ0OrR.js} +1 -1
- package/dist/ui/assets/chunk-ATLVNIR6-DbeJ0OrR.js.gz +0 -0
- package/dist/ui/assets/{chunk-B4BG7PRW-B8b6dQQ2.js → chunk-B4BG7PRW-C53q2ggf.js} +1 -1
- package/dist/ui/assets/chunk-B4BG7PRW-C53q2ggf.js.gz +0 -0
- package/dist/ui/assets/{chunk-CVBHYZKI-D-mQAfrk.js → chunk-CVBHYZKI-B3EBSlb3.js} +1 -1
- package/dist/ui/assets/{chunk-DI55MBZ5-BfATX3V8.js → chunk-DI55MBZ5-vIyNEQN-.js} +1 -1
- package/dist/ui/assets/chunk-DI55MBZ5-vIyNEQN-.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-B3ObkuOm.js +1 -0
- package/dist/ui/assets/{chunk-FMBD7UC4-fqXscNvc.js → chunk-FMBD7UC4-rddmfK-Z.js} +1 -1
- package/dist/ui/assets/{chunk-HN2XXSSU-BCHvD80g.js → chunk-HN2XXSSU-Dttqcg3b.js} +1 -1
- package/dist/ui/assets/chunk-HN2XXSSU-Dttqcg3b.js.gz +0 -0
- package/dist/ui/assets/{chunk-JA3XYJ7Z-Cp6dqHnY.js → chunk-JA3XYJ7Z-DbNDev3D.js} +1 -1
- package/dist/ui/assets/chunk-JA3XYJ7Z-DbNDev3D.js.gz +0 -0
- package/dist/ui/assets/{chunk-JZLCHNYA-cKMooY3y.js → chunk-JZLCHNYA-EUmx2y4H.js} +1 -1
- package/dist/ui/assets/chunk-JZLCHNYA-EUmx2y4H.js.gz +0 -0
- package/dist/ui/assets/{chunk-MI3HLSF2-BlzO5wOE.js → chunk-MI3HLSF2-65n9Mkyc.js} +1 -1
- package/dist/ui/assets/chunk-MI3HLSF2-65n9Mkyc.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js +2 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js.gz +0 -0
- package/dist/ui/assets/{chunk-QN33PNHL-DIHGQ_pd.js → chunk-QN33PNHL-DsRKK6NR.js} +1 -1
- package/dist/ui/assets/{chunk-QXUST7PY-C9l0muI0.js → chunk-QXUST7PY-BCYnMiS3.js} +1 -1
- package/dist/ui/assets/chunk-QXUST7PY-BCYnMiS3.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-HucAw4xW.js +1 -0
- package/dist/ui/assets/{chunk-S3R3BYOJ-VJiLzt2o.js → chunk-S3R3BYOJ-CWMEa9Dc.js} +1 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-CWMEa9Dc.js.gz +0 -0
- package/dist/ui/assets/{chunk-TZMSLE5B-DZwI0C_2.js → chunk-TZMSLE5B-BuQUQcTr.js} +1 -1
- package/dist/ui/assets/chunk-TZMSLE5B-BuQUQcTr.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-CUT3rPTB.js +1 -0
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-CUT3rPTB.js +1 -0
- package/dist/ui/assets/{cose-bilkent-S5V4N54A-Ipik-oSD.js → cose-bilkent-S5V4N54A-CnPB3ARO.js} +1 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-CnPB3ARO.js.gz +0 -0
- package/dist/ui/assets/cursor-QEb7m-rN.png +0 -0
- package/dist/ui/assets/{dagre-6UL2VRFP-BDpyWQnh.js → dagre-6UL2VRFP-DhS-k_Se.js} +1 -1
- package/dist/ui/assets/dagre-6UL2VRFP-DhS-k_Se.js.gz +0 -0
- package/dist/ui/assets/{dagre-CgA4KhUX.js → dagre-KgLoHEuy.js} +1 -1
- package/dist/ui/assets/dagre-KgLoHEuy.js.gz +0 -0
- package/dist/ui/assets/{diagram-PSM6KHXK-B4GRzxLJ.js → diagram-PSM6KHXK-BZg3MJmb.js} +1 -1
- package/dist/ui/assets/diagram-PSM6KHXK-BZg3MJmb.js.gz +0 -0
- package/dist/ui/assets/{diagram-QEK2KX5R-BWPW28XI.js → diagram-QEK2KX5R-BPCitvbo.js} +1 -1
- package/dist/ui/assets/diagram-QEK2KX5R-BPCitvbo.js.gz +0 -0
- package/dist/ui/assets/{diagram-S2PKOQOG-BIHhcGoV.js → diagram-S2PKOQOG-NW4uK6sx.js} +1 -1
- package/dist/ui/assets/diagram-S2PKOQOG-NW4uK6sx.js.gz +0 -0
- package/dist/ui/assets/{editor-C-HJ7Yw0.js → editor-CzFWIUw2.js} +1 -1
- package/dist/ui/assets/editor-CzFWIUw2.js.gz +0 -0
- package/dist/ui/assets/{emoji-D8F6B62m.js → emoji-Dkz4Zzv_.js} +1 -1
- package/dist/ui/assets/emoji-Dkz4Zzv_.js.gz +0 -0
- package/dist/ui/assets/{erDiagram-Q2GNP2WA-ubTaAFcK.js → erDiagram-Q2GNP2WA-me1fboaf.js} +1 -1
- package/dist/ui/assets/erDiagram-Q2GNP2WA-me1fboaf.js.gz +0 -0
- package/dist/ui/assets/{flowDiagram-NV44I4VS-BHLCTYjI.js → flowDiagram-NV44I4VS-DzE8dGsh.js} +1 -1
- package/dist/ui/assets/flowDiagram-NV44I4VS-DzE8dGsh.js.gz +0 -0
- package/dist/ui/assets/{ganttDiagram-LVOFAZNH-ClC3pay1.js → ganttDiagram-LVOFAZNH-CFQD09Mi.js} +2 -2
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-CFQD09Mi.js.gz +0 -0
- package/dist/ui/assets/{gitGraph-F6HP7TQM-DghoobE6.js → gitGraph-F6HP7TQM-CfFE_uAC.js} +1 -1
- package/dist/ui/assets/{gitGraphDiagram-NY62KEGX-Clqpiswu.js → gitGraphDiagram-NY62KEGX-CaVoxU4C.js} +1 -1
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-CaVoxU4C.js.gz +0 -0
- package/dist/ui/assets/index-BN5_Qq7R.js +324 -0
- package/dist/ui/assets/index-BN5_Qq7R.js.gz +0 -0
- package/dist/ui/assets/index-DxuPq13l.css +1 -0
- package/dist/ui/assets/index-DxuPq13l.css.gz +0 -0
- package/dist/ui/assets/{info-NVLQJR56-0ZldEXPQ.js → info-NVLQJR56-i_xHYg3f.js} +1 -1
- package/dist/ui/assets/{infoDiagram-ER5ION4S-DMmPX-il.js → infoDiagram-ER5ION4S-2NL93b78.js} +1 -1
- package/dist/ui/assets/{journeyDiagram-XKPGCS4Q-CrVickA2.js → journeyDiagram-XKPGCS4Q-CZF-2DHU.js} +1 -1
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CZF-2DHU.js.gz +0 -0
- package/dist/ui/assets/{kanban-definition-3W4ZIXB7-C_BsdHYL.js → kanban-definition-3W4ZIXB7-CfvJIOny.js} +1 -1
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-CfvJIOny.js.gz +0 -0
- package/dist/ui/assets/{line-CfBP7Yic.js → line-DDv8kOJk.js} +1 -1
- package/dist/ui/assets/{linear-BsjageUB.js → linear-Daef-l29.js} +1 -1
- package/dist/ui/assets/linear-Daef-l29.js.gz +0 -0
- package/dist/ui/assets/{mermaid-parser.core-DZdP-NFq.js → mermaid-parser.core-CdK9QgYV.js} +2 -2
- package/dist/ui/assets/mermaid-parser.core-CdK9QgYV.js.gz +0 -0
- package/dist/ui/assets/{mermaid.core-TNrI0pHG.js → mermaid.core-D6GS9mU-.js} +3 -3
- package/dist/ui/assets/mermaid.core-D6GS9mU-.js.gz +0 -0
- package/dist/ui/assets/message-SqLqNYcv.js +36 -0
- package/dist/ui/assets/message-SqLqNYcv.js.gz +0 -0
- package/dist/ui/assets/{mindmap-definition-VGOIOE7T-BbmaUjMY.js → mindmap-definition-VGOIOE7T-Cb3QMflX.js} +1 -1
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-Cb3QMflX.js.gz +0 -0
- package/dist/ui/assets/{packet-BFZMPI3H-D_ZhkXuT.js → packet-BFZMPI3H-Bm2uwz4i.js} +1 -1
- package/dist/ui/assets/{particles-Dv28pjOd.js → particles-DsJFOarW.js} +1 -1
- package/dist/ui/assets/particles-DsJFOarW.js.gz +0 -0
- package/dist/ui/assets/{pie-7BOR55EZ-Dn0Q3qNx.js → pie-7BOR55EZ-5i17tVnF.js} +1 -1
- package/dist/ui/assets/{pieDiagram-ADFJNKIX-BbyjfYu8.js → pieDiagram-ADFJNKIX-BxIwQWvw.js} +1 -1
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BxIwQWvw.js.gz +0 -0
- package/dist/ui/assets/{quadrantDiagram-AYHSOK5B-Bc3GqMKz.js → quadrantDiagram-AYHSOK5B-B5HPe4ga.js} +1 -1
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-B5HPe4ga.js.gz +0 -0
- package/dist/ui/assets/{radar-NHE76QYJ-BHwoAy1q.js → radar-NHE76QYJ-BTn-tq0k.js} +1 -1
- package/dist/ui/assets/{reactflow-BVYPxNhc.js → reactflow-Bf74ngoo.js} +2 -2
- package/dist/ui/assets/reactflow-Bf74ngoo.js.gz +0 -0
- package/dist/ui/assets/{requirementDiagram-UZGBJVZJ-BQaKKL09.js → requirementDiagram-UZGBJVZJ-YfI6llkX.js} +1 -1
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-YfI6llkX.js.gz +0 -0
- package/dist/ui/assets/{sandpack-BQW_FQ7G.js → sandpack-D7koO5op.js} +1 -1
- package/dist/ui/assets/sandpack-D7koO5op.js.gz +0 -0
- package/dist/ui/assets/{sankeyDiagram-TZEHDZUN-DiJvDvhb.js → sankeyDiagram-TZEHDZUN-DOk_B10B.js} +1 -1
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DOk_B10B.js.gz +0 -0
- package/dist/ui/assets/{sequenceDiagram-WL72ISMW-Dw32824o.js → sequenceDiagram-WL72ISMW-DAe4Um17.js} +1 -1
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-DAe4Um17.js.gz +0 -0
- package/dist/ui/assets/{stateDiagram-FKZM4ZOC-BCOpNdHV.js → stateDiagram-FKZM4ZOC-CCesDu_C.js} +1 -1
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-CCesDu_C.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-CMlIrsoO.js +1 -0
- package/dist/ui/assets/{syntax-VJrU5BEu.js → syntax-C-M-8jOU.js} +1 -1
- package/dist/ui/assets/syntax-C-M-8jOU.js.gz +0 -0
- package/dist/ui/assets/{theme-DZtFA8b4.js → theme-BQZdiqwv.js} +1 -1
- package/dist/ui/assets/{timeline-definition-IT6M3QCI-Jh_WZzXv.js → timeline-definition-IT6M3QCI-D6P5txjT.js} +1 -1
- package/dist/ui/assets/timeline-definition-IT6M3QCI-D6P5txjT.js.gz +0 -0
- package/dist/ui/assets/{treemap-KMMF4GRG-CPYIgjxE.js → treemap-KMMF4GRG-Bitm3gy4.js} +1 -1
- package/dist/ui/assets/{knowledgeRoutes-CivaUqha.js → useUserLocalStorage-Ckb8HsIw.js} +1 -1
- package/dist/ui/assets/useUserLocalStorage-Ckb8HsIw.js.gz +0 -0
- package/dist/ui/assets/{xychartDiagram-PRI3JC2R-CERc7Rdb.js → xychartDiagram-PRI3JC2R-CsybjUbd.js} +1 -1
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CsybjUbd.js.gz +0 -0
- package/dist/ui/index.html +13 -11
- package/dist/ui/index.html.gz +0 -0
- package/package.json +10 -9
- package/dist/ui/assets/App-9s2WHM6S.js +0 -22
- package/dist/ui/assets/App-9s2WHM6S.js.gz +0 -0
- package/dist/ui/assets/App-BAdBsEnV.css.gz +0 -0
- package/dist/ui/assets/ArtifactConsentModal-ParNk5kW.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js +0 -9
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js +0 -18
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js.gz +0 -0
- package/dist/ui/assets/CodeEditor.inner-D51Z_CLQ.js.gz +0 -0
- package/dist/ui/assets/ConversationView-Dyddw2b1.js +0 -34
- package/dist/ui/assets/ConversationView-Dyddw2b1.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-CdftslnF.js +0 -24
- package/dist/ui/assets/KnowledgePage-CdftslnF.js.gz +0 -0
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js +0 -1
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js.gz +0 -0
- package/dist/ui/assets/StreamdownDemoPage-B9wbgp2s.js.gz +0 -0
- package/dist/ui/assets/ThemeSwitcher-ubn6IOz9.js.gz +0 -0
- package/dist/ui/assets/antd-C-HfEC4E.js +0 -400
- package/dist/ui/assets/antd-C-HfEC4E.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-dkBewUpN.js +0 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-ChmZt3zk.js.gz +0 -0
- package/dist/ui/assets/blockDiagram-VD42YOAC-CzGHAHao.js.gz +0 -0
- package/dist/ui/assets/c4Diagram-YG6GDRKO-DscJyaWN.js.gz +0 -0
- package/dist/ui/assets/channel-DvRQqEqC.js +0 -1
- package/dist/ui/assets/chunk-55IACEB6-DojF2pZN.js +0 -1
- package/dist/ui/assets/chunk-ABZYJK2D-RzDCrjE6.js.gz +0 -0
- package/dist/ui/assets/chunk-AGHRB4JF-jidCS5Of.js.gz +0 -0
- package/dist/ui/assets/chunk-ATLVNIR6-BEIIfJtC.js.gz +0 -0
- package/dist/ui/assets/chunk-B4BG7PRW-B8b6dQQ2.js.gz +0 -0
- package/dist/ui/assets/chunk-DI55MBZ5-BfATX3V8.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-BKt6lPJM.js +0 -1
- package/dist/ui/assets/chunk-HN2XXSSU-BCHvD80g.js.gz +0 -0
- package/dist/ui/assets/chunk-JA3XYJ7Z-Cp6dqHnY.js.gz +0 -0
- package/dist/ui/assets/chunk-JZLCHNYA-cKMooY3y.js.gz +0 -0
- package/dist/ui/assets/chunk-MI3HLSF2-BlzO5wOE.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js +0 -2
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js.gz +0 -0
- package/dist/ui/assets/chunk-QXUST7PY-C9l0muI0.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-CZskCFCf.js +0 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-VJiLzt2o.js.gz +0 -0
- package/dist/ui/assets/chunk-TZMSLE5B-DZwI0C_2.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-BFASUbmZ.js +0 -1
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-BFASUbmZ.js +0 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-Ipik-oSD.js.gz +0 -0
- package/dist/ui/assets/dagre-6UL2VRFP-BDpyWQnh.js.gz +0 -0
- package/dist/ui/assets/dagre-CgA4KhUX.js.gz +0 -0
- package/dist/ui/assets/diagram-PSM6KHXK-B4GRzxLJ.js.gz +0 -0
- package/dist/ui/assets/diagram-QEK2KX5R-BWPW28XI.js.gz +0 -0
- package/dist/ui/assets/diagram-S2PKOQOG-BIHhcGoV.js.gz +0 -0
- package/dist/ui/assets/editor-C-HJ7Yw0.js.gz +0 -0
- package/dist/ui/assets/emoji-D8F6B62m.js.gz +0 -0
- package/dist/ui/assets/erDiagram-Q2GNP2WA-ubTaAFcK.js.gz +0 -0
- package/dist/ui/assets/flowDiagram-NV44I4VS-BHLCTYjI.js.gz +0 -0
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-ClC3pay1.js.gz +0 -0
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-Clqpiswu.js.gz +0 -0
- package/dist/ui/assets/index-D9OElx9A.css +0 -1
- package/dist/ui/assets/index-D9OElx9A.css.gz +0 -0
- package/dist/ui/assets/index-DxPuzG7E.js +0 -350
- package/dist/ui/assets/index-DxPuzG7E.js.gz +0 -0
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CrVickA2.js.gz +0 -0
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-C_BsdHYL.js.gz +0 -0
- package/dist/ui/assets/knowledgeRoutes-CivaUqha.js.gz +0 -0
- package/dist/ui/assets/linear-BsjageUB.js.gz +0 -0
- package/dist/ui/assets/mermaid-parser.core-DZdP-NFq.js.gz +0 -0
- package/dist/ui/assets/mermaid.core-TNrI0pHG.js.gz +0 -0
- package/dist/ui/assets/message-BtWWJ9Af.js +0 -36
- package/dist/ui/assets/message-BtWWJ9Af.js.gz +0 -0
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-BbmaUjMY.js.gz +0 -0
- package/dist/ui/assets/particles-Dv28pjOd.js.gz +0 -0
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BbyjfYu8.js.gz +0 -0
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-Bc3GqMKz.js.gz +0 -0
- package/dist/ui/assets/reactflow-BVYPxNhc.js.gz +0 -0
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-BQaKKL09.js.gz +0 -0
- package/dist/ui/assets/sandpack-BQW_FQ7G.js.gz +0 -0
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DiJvDvhb.js.gz +0 -0
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-Dw32824o.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-BCOpNdHV.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-Cuqwvgfg.js +0 -1
- package/dist/ui/assets/syntax-VJrU5BEu.js.gz +0 -0
- package/dist/ui/assets/timeline-definition-IT6M3QCI-Jh_WZzXv.js.gz +0 -0
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CERc7Rdb.js.gz +0 -0
package/dist/core/index.js
CHANGED
|
@@ -65,8 +65,8 @@ var init_constants = __esm({
|
|
|
65
65
|
* Logs command timeout in milliseconds
|
|
66
66
|
* How long to wait for logs command to complete
|
|
67
67
|
*/
|
|
68
|
-
LOGS_TIMEOUT_MS:
|
|
69
|
-
//
|
|
68
|
+
LOGS_TIMEOUT_MS: 3e4,
|
|
69
|
+
// 30 seconds
|
|
70
70
|
/**
|
|
71
71
|
* Maximum number of log lines to return from logs command
|
|
72
72
|
* Prevents daemon crashes from massive log outputs
|
|
@@ -591,6 +591,9 @@ async function getBaseUrl() {
|
|
|
591
591
|
if (config.daemon?.base_url) {
|
|
592
592
|
return validateBaseUrl(config.daemon.base_url);
|
|
593
593
|
}
|
|
594
|
+
if (config.ui?.base_url) {
|
|
595
|
+
return validateBaseUrl(config.ui.base_url);
|
|
596
|
+
}
|
|
594
597
|
const defaults = getDefaultConfig();
|
|
595
598
|
const envPort = process.env.PORT ? Number.parseInt(process.env.PORT, 10) : void 0;
|
|
596
599
|
const port = envPort || config.daemon?.port || defaults.daemon?.port || DAEMON.DEFAULT_PORT;
|
|
@@ -605,8 +608,11 @@ async function requirePublicBaseUrl() {
|
|
|
605
608
|
if (config.daemon?.base_url) {
|
|
606
609
|
return validateBaseUrl(config.daemon.base_url);
|
|
607
610
|
}
|
|
611
|
+
if (config.ui?.base_url) {
|
|
612
|
+
return validateBaseUrl(config.ui.base_url);
|
|
613
|
+
}
|
|
608
614
|
throw new PublicBaseUrlNotConfiguredError(
|
|
609
|
-
"No public base URL configured. Set the AGOR_BASE_URL environment variable or `daemon.base_url` in ~/.agor/config.yaml to the daemon's browser-reachable URL (e.g. https://agor.example.com). This is required so OAuth providers can redirect users back to a URL their browser can reach \u2014 the localhost fallback only works for browsers on the daemon machine."
|
|
615
|
+
"No public base URL configured. Set the AGOR_BASE_URL environment variable or `daemon.base_url` (preferred) / `ui.base_url` (legacy) in ~/.agor/config.yaml to the daemon's browser-reachable URL (e.g. https://agor.example.com). This is required so OAuth providers can redirect users back to a URL their browser can reach \u2014 the localhost fallback only works for browsers on the daemon machine."
|
|
610
616
|
);
|
|
611
617
|
}
|
|
612
618
|
function loadConfigSync() {
|
|
@@ -1766,6 +1772,15 @@ function getDefaultPermissionMode(agenticTool) {
|
|
|
1766
1772
|
return "auto";
|
|
1767
1773
|
}
|
|
1768
1774
|
}
|
|
1775
|
+
function sessionCanStartTask(status, readyForPrompt) {
|
|
1776
|
+
return status === SessionStatus.IDLE || status === SessionStatus.FAILED && readyForPrompt === true;
|
|
1777
|
+
}
|
|
1778
|
+
function isSessionPromptable(session) {
|
|
1779
|
+
return sessionCanStartTask(session.status, session.ready_for_prompt);
|
|
1780
|
+
}
|
|
1781
|
+
function isSessionExecuting(session) {
|
|
1782
|
+
return EXECUTING_SESSION_STATUSES.has(session.status);
|
|
1783
|
+
}
|
|
1769
1784
|
function isGatewaySession(session) {
|
|
1770
1785
|
const ctx = session.custom_context;
|
|
1771
1786
|
return !!ctx?.gateway_source;
|
|
@@ -1783,7 +1798,7 @@ function getSessionType(session) {
|
|
|
1783
1798
|
if (session.scheduled_from_branch) return "scheduled";
|
|
1784
1799
|
return "agent";
|
|
1785
1800
|
}
|
|
1786
|
-
var SessionStatus;
|
|
1801
|
+
var SessionStatus, EXECUTING_SESSION_STATUSES;
|
|
1787
1802
|
var init_session = __esm({
|
|
1788
1803
|
"src/types/session.ts"() {
|
|
1789
1804
|
"use strict";
|
|
@@ -1801,6 +1816,12 @@ var init_session = __esm({
|
|
|
1801
1816
|
COMPLETED: "completed",
|
|
1802
1817
|
FAILED: "failed"
|
|
1803
1818
|
};
|
|
1819
|
+
EXECUTING_SESSION_STATUSES = /* @__PURE__ */ new Set([
|
|
1820
|
+
SessionStatus.RUNNING,
|
|
1821
|
+
SessionStatus.STOPPING,
|
|
1822
|
+
SessionStatus.AWAITING_PERMISSION,
|
|
1823
|
+
SessionStatus.AWAITING_INPUT
|
|
1824
|
+
]);
|
|
1804
1825
|
}
|
|
1805
1826
|
});
|
|
1806
1827
|
|
|
@@ -1811,7 +1832,10 @@ function isNaturalCompletion(status) {
|
|
|
1811
1832
|
function isTerminalTaskStatus(status) {
|
|
1812
1833
|
return status !== void 0 && TERMINAL_TASK_STATUSES.has(status);
|
|
1813
1834
|
}
|
|
1814
|
-
|
|
1835
|
+
function isTaskExecuting(task) {
|
|
1836
|
+
return EXECUTING_TASK_STATUSES.has(task.status);
|
|
1837
|
+
}
|
|
1838
|
+
var TaskStatus, TERMINAL_TASK_STATUSES, EXECUTING_TASK_STATUSES;
|
|
1815
1839
|
var init_task = __esm({
|
|
1816
1840
|
"src/types/task.ts"() {
|
|
1817
1841
|
"use strict";
|
|
@@ -1839,6 +1863,12 @@ var init_task = __esm({
|
|
|
1839
1863
|
TaskStatus.STOPPED,
|
|
1840
1864
|
TaskStatus.TIMED_OUT
|
|
1841
1865
|
]);
|
|
1866
|
+
EXECUTING_TASK_STATUSES = /* @__PURE__ */ new Set([
|
|
1867
|
+
TaskStatus.RUNNING,
|
|
1868
|
+
TaskStatus.STOPPING,
|
|
1869
|
+
TaskStatus.AWAITING_PERMISSION,
|
|
1870
|
+
TaskStatus.AWAITING_INPUT
|
|
1871
|
+
]);
|
|
1842
1872
|
}
|
|
1843
1873
|
});
|
|
1844
1874
|
|
|
@@ -2040,6 +2070,8 @@ __export(schema_postgres_exports, {
|
|
|
2040
2070
|
serializedSessions: () => serializedSessions,
|
|
2041
2071
|
sessionEnvSelections: () => sessionEnvSelections,
|
|
2042
2072
|
sessionMcpServers: () => sessionMcpServers,
|
|
2073
|
+
sessionRelationships: () => sessionRelationships,
|
|
2074
|
+
sessionRelationshipsRelations: () => sessionRelationshipsRelations,
|
|
2043
2075
|
sessions: () => sessions,
|
|
2044
2076
|
sessionsRelations: () => sessionsRelations,
|
|
2045
2077
|
tasks: () => tasks,
|
|
@@ -2063,7 +2095,7 @@ import {
|
|
|
2063
2095
|
uniqueIndex,
|
|
2064
2096
|
varchar
|
|
2065
2097
|
} from "drizzle-orm/pg-core";
|
|
2066
|
-
var bytea, t, sessions, tasks, serializedSessions, messages, boards, repos, branches, branchOwners, boardOwners, schedules, users, groups, groupMemberships, branchGroupGrants, boardGroupGrants, appVariables, userApiKeys, mcpServers, cardTypes, cards, artifacts, artifactTrustGrants, boardObjects, sessionMcpServers, userMcpOauthTokens, boardComments, gatewayChannels, threadSessionMap, sessionEnvSelections, kbNamespaces, kbNamespaceAcl, kbDocuments, kbDocumentVersions, kbDocumentUnits, kbEmbeddingSpaces, kbGraphNodes, kbGraphEdges, sessionsRelations, branchesRelations, schedulesRelations;
|
|
2098
|
+
var bytea, t, sessions, sessionRelationships, tasks, serializedSessions, messages, boards, repos, branches, branchOwners, boardOwners, schedules, users, groups, groupMemberships, branchGroupGrants, boardGroupGrants, appVariables, userApiKeys, mcpServers, cardTypes, cards, artifacts, artifactTrustGrants, boardObjects, sessionMcpServers, userMcpOauthTokens, boardComments, gatewayChannels, threadSessionMap, sessionEnvSelections, kbNamespaces, kbNamespaceAcl, kbDocuments, kbDocumentVersions, kbDocumentUnits, kbEmbeddingSpaces, kbGraphNodes, kbGraphEdges, sessionsRelations, sessionRelationshipsRelations, branchesRelations, schedulesRelations;
|
|
2067
2099
|
var init_schema_postgres = __esm({
|
|
2068
2100
|
"src/db/schema.postgres.ts"() {
|
|
2069
2101
|
"use strict";
|
|
@@ -2156,6 +2188,36 @@ var init_schema_postgres = __esm({
|
|
|
2156
2188
|
scheduleRunUnique: uniqueIndex("sessions_schedule_run_unique").on(table.schedule_id, table.scheduled_run_at).where(sql2`${table.schedule_id} IS NOT NULL AND ${table.scheduled_run_at} IS NOT NULL`)
|
|
2157
2189
|
})
|
|
2158
2190
|
);
|
|
2191
|
+
sessionRelationships = pgTable(
|
|
2192
|
+
"session_relationships",
|
|
2193
|
+
{
|
|
2194
|
+
relationship_id: varchar("relationship_id", { length: 36 }).primaryKey(),
|
|
2195
|
+
source_session_id: varchar("source_session_id", { length: 36 }).notNull().references(() => sessions.session_id, { onDelete: "cascade" }),
|
|
2196
|
+
target_session_id: varchar("target_session_id", { length: 36 }).notNull().references(() => sessions.session_id, { onDelete: "cascade" }),
|
|
2197
|
+
relationship_type: text("relationship_type", { enum: ["remote_create"] }).notNull(),
|
|
2198
|
+
created_by: varchar("created_by", { length: 36 }).notNull(),
|
|
2199
|
+
created_at: t.timestamp("created_at").notNull(),
|
|
2200
|
+
updated_at: t.timestamp("updated_at"),
|
|
2201
|
+
callback_enabled: t.bool("callback_enabled").notNull().default(false),
|
|
2202
|
+
callback_session_id: varchar("callback_session_id", { length: 36 }).references(
|
|
2203
|
+
() => sessions.session_id,
|
|
2204
|
+
{
|
|
2205
|
+
onDelete: "set null"
|
|
2206
|
+
}
|
|
2207
|
+
),
|
|
2208
|
+
data: t.json("data")
|
|
2209
|
+
},
|
|
2210
|
+
(table) => ({
|
|
2211
|
+
sourceIdx: index("session_relationships_source_idx").on(table.source_session_id),
|
|
2212
|
+
targetIdx: index("session_relationships_target_idx").on(table.target_session_id),
|
|
2213
|
+
callbackIdx: index("session_relationships_callback_idx").on(table.callback_session_id),
|
|
2214
|
+
sourceTargetTypeUnique: uniqueIndex("session_relationships_source_target_type_unique").on(
|
|
2215
|
+
table.source_session_id,
|
|
2216
|
+
table.target_session_id,
|
|
2217
|
+
table.relationship_type
|
|
2218
|
+
)
|
|
2219
|
+
})
|
|
2220
|
+
);
|
|
2159
2221
|
tasks = pgTable(
|
|
2160
2222
|
"tasks",
|
|
2161
2223
|
{
|
|
@@ -2692,6 +2754,12 @@ var init_schema_postgres = __esm({
|
|
|
2692
2754
|
branch_id: varchar("branch_id", { length: 36 }).references(() => branches.branch_id, {
|
|
2693
2755
|
onDelete: "set null"
|
|
2694
2756
|
}),
|
|
2757
|
+
source_session_id: varchar("source_session_id", { length: 36 }).references(
|
|
2758
|
+
() => sessions.session_id,
|
|
2759
|
+
{
|
|
2760
|
+
onDelete: "set null"
|
|
2761
|
+
}
|
|
2762
|
+
),
|
|
2695
2763
|
board_id: varchar("board_id", { length: 36 }).notNull().references(() => boards.board_id, { onDelete: "cascade" }),
|
|
2696
2764
|
name: text("name").notNull(),
|
|
2697
2765
|
description: text("description"),
|
|
@@ -2718,6 +2786,7 @@ var init_schema_postgres = __esm({
|
|
|
2718
2786
|
},
|
|
2719
2787
|
(table) => ({
|
|
2720
2788
|
branchIdx: index("artifacts_branch_idx").on(table.branch_id),
|
|
2789
|
+
sourceSessionIdx: index("artifacts_source_session_idx").on(table.source_session_id),
|
|
2721
2790
|
boardIdx: index("artifacts_board_idx").on(table.board_id),
|
|
2722
2791
|
archivedIdx: index("artifacts_archived_idx").on(table.archived),
|
|
2723
2792
|
publicIdx: index("artifacts_public_idx").on(table.public)
|
|
@@ -2874,7 +2943,7 @@ var init_schema_postgres = __esm({
|
|
|
2874
2943
|
// Materialized for queries
|
|
2875
2944
|
name: text("name").notNull(),
|
|
2876
2945
|
channel_type: text("channel_type", {
|
|
2877
|
-
enum: ["slack", "discord", "whatsapp", "telegram", "github"]
|
|
2946
|
+
enum: ["slack", "discord", "whatsapp", "telegram", "github", "teams"]
|
|
2878
2947
|
}).notNull(),
|
|
2879
2948
|
target_branch_id: varchar("target_branch_id", { length: 36 }).notNull().references(() => branches.branch_id, { onDelete: "cascade" }),
|
|
2880
2949
|
agor_user_id: varchar("agor_user_id", { length: 36 }).notNull(),
|
|
@@ -3258,7 +3327,7 @@ var init_schema_postgres = __esm({
|
|
|
3258
3327
|
archivedIdx: index("kb_graph_edges_archived_idx").on(table.archived)
|
|
3259
3328
|
})
|
|
3260
3329
|
);
|
|
3261
|
-
sessionsRelations = relations(sessions, ({ one }) => ({
|
|
3330
|
+
sessionsRelations = relations(sessions, ({ one, many }) => ({
|
|
3262
3331
|
branch: one(branches, {
|
|
3263
3332
|
fields: [sessions.branch_id],
|
|
3264
3333
|
references: [branches.branch_id]
|
|
@@ -3266,6 +3335,24 @@ var init_schema_postgres = __esm({
|
|
|
3266
3335
|
schedule: one(schedules, {
|
|
3267
3336
|
fields: [sessions.schedule_id],
|
|
3268
3337
|
references: [schedules.schedule_id]
|
|
3338
|
+
}),
|
|
3339
|
+
outboundRelationships: many(sessionRelationships, { relationName: "relationshipSource" }),
|
|
3340
|
+
inboundRelationships: many(sessionRelationships, { relationName: "relationshipTarget" })
|
|
3341
|
+
}));
|
|
3342
|
+
sessionRelationshipsRelations = relations(sessionRelationships, ({ one }) => ({
|
|
3343
|
+
sourceSession: one(sessions, {
|
|
3344
|
+
fields: [sessionRelationships.source_session_id],
|
|
3345
|
+
references: [sessions.session_id],
|
|
3346
|
+
relationName: "relationshipSource"
|
|
3347
|
+
}),
|
|
3348
|
+
targetSession: one(sessions, {
|
|
3349
|
+
fields: [sessionRelationships.target_session_id],
|
|
3350
|
+
references: [sessions.session_id],
|
|
3351
|
+
relationName: "relationshipTarget"
|
|
3352
|
+
}),
|
|
3353
|
+
callbackSession: one(sessions, {
|
|
3354
|
+
fields: [sessionRelationships.callback_session_id],
|
|
3355
|
+
references: [sessions.session_id]
|
|
3269
3356
|
})
|
|
3270
3357
|
}));
|
|
3271
3358
|
branchesRelations = relations(branches, ({ many }) => ({
|
|
@@ -3318,6 +3405,8 @@ __export(schema_sqlite_exports, {
|
|
|
3318
3405
|
serializedSessions: () => serializedSessions2,
|
|
3319
3406
|
sessionEnvSelections: () => sessionEnvSelections2,
|
|
3320
3407
|
sessionMcpServers: () => sessionMcpServers2,
|
|
3408
|
+
sessionRelationships: () => sessionRelationships2,
|
|
3409
|
+
sessionRelationshipsRelations: () => sessionRelationshipsRelations2,
|
|
3321
3410
|
sessions: () => sessions2,
|
|
3322
3411
|
sessionsRelations: () => sessionsRelations2,
|
|
3323
3412
|
tasks: () => tasks2,
|
|
@@ -3336,7 +3425,7 @@ import {
|
|
|
3336
3425
|
text as text2,
|
|
3337
3426
|
uniqueIndex as uniqueIndex2
|
|
3338
3427
|
} from "drizzle-orm/sqlite-core";
|
|
3339
|
-
var t2, sessions2, tasks2, serializedSessions2, messages2, boards2, repos2, branches2, branchOwners2, boardOwners2, schedules2, users2, groups2, groupMemberships2, branchGroupGrants2, boardGroupGrants2, appVariables2, userApiKeys2, mcpServers2, cardTypes2, cards2, artifacts2, artifactTrustGrants2, boardObjects2, sessionMcpServers2, userMcpOauthTokens2, boardComments2, gatewayChannels2, threadSessionMap2, sessionEnvSelections2, kbNamespaces2, kbNamespaceAcl2, kbDocuments2, kbDocumentVersions2, kbDocumentUnits2, kbEmbeddingSpaces2, kbGraphNodes2, kbGraphEdges2, sessionsRelations2, branchesRelations2, schedulesRelations2;
|
|
3428
|
+
var t2, sessions2, sessionRelationships2, tasks2, serializedSessions2, messages2, boards2, repos2, branches2, branchOwners2, boardOwners2, schedules2, users2, groups2, groupMemberships2, branchGroupGrants2, boardGroupGrants2, appVariables2, userApiKeys2, mcpServers2, cardTypes2, cards2, artifacts2, artifactTrustGrants2, boardObjects2, sessionMcpServers2, userMcpOauthTokens2, boardComments2, gatewayChannels2, threadSessionMap2, sessionEnvSelections2, kbNamespaces2, kbNamespaceAcl2, kbDocuments2, kbDocumentVersions2, kbDocumentUnits2, kbEmbeddingSpaces2, kbGraphNodes2, kbGraphEdges2, sessionsRelations2, sessionRelationshipsRelations2, branchesRelations2, schedulesRelations2;
|
|
3340
3429
|
var init_schema_sqlite = __esm({
|
|
3341
3430
|
"src/db/schema.sqlite.ts"() {
|
|
3342
3431
|
"use strict";
|
|
@@ -3426,6 +3515,36 @@ var init_schema_sqlite = __esm({
|
|
|
3426
3515
|
scheduleRunUnique: uniqueIndex2("sessions_schedule_run_unique").on(table.schedule_id, table.scheduled_run_at).where(sql3`${table.schedule_id} IS NOT NULL AND ${table.scheduled_run_at} IS NOT NULL`)
|
|
3427
3516
|
})
|
|
3428
3517
|
);
|
|
3518
|
+
sessionRelationships2 = sqliteTable(
|
|
3519
|
+
"session_relationships",
|
|
3520
|
+
{
|
|
3521
|
+
relationship_id: text2("relationship_id", { length: 36 }).primaryKey(),
|
|
3522
|
+
source_session_id: text2("source_session_id", { length: 36 }).notNull().references(() => sessions2.session_id, { onDelete: "cascade" }),
|
|
3523
|
+
target_session_id: text2("target_session_id", { length: 36 }).notNull().references(() => sessions2.session_id, { onDelete: "cascade" }),
|
|
3524
|
+
relationship_type: text2("relationship_type", { enum: ["remote_create"] }).notNull(),
|
|
3525
|
+
created_by: text2("created_by", { length: 36 }).notNull(),
|
|
3526
|
+
created_at: t2.timestamp("created_at").notNull(),
|
|
3527
|
+
updated_at: t2.timestamp("updated_at"),
|
|
3528
|
+
callback_enabled: t2.bool("callback_enabled").notNull().default(false),
|
|
3529
|
+
callback_session_id: text2("callback_session_id", { length: 36 }).references(
|
|
3530
|
+
() => sessions2.session_id,
|
|
3531
|
+
{
|
|
3532
|
+
onDelete: "set null"
|
|
3533
|
+
}
|
|
3534
|
+
),
|
|
3535
|
+
data: t2.json("data")
|
|
3536
|
+
},
|
|
3537
|
+
(table) => ({
|
|
3538
|
+
sourceIdx: index2("session_relationships_source_idx").on(table.source_session_id),
|
|
3539
|
+
targetIdx: index2("session_relationships_target_idx").on(table.target_session_id),
|
|
3540
|
+
callbackIdx: index2("session_relationships_callback_idx").on(table.callback_session_id),
|
|
3541
|
+
sourceTargetTypeUnique: uniqueIndex2("session_relationships_source_target_type_unique").on(
|
|
3542
|
+
table.source_session_id,
|
|
3543
|
+
table.target_session_id,
|
|
3544
|
+
table.relationship_type
|
|
3545
|
+
)
|
|
3546
|
+
})
|
|
3547
|
+
);
|
|
3429
3548
|
tasks2 = sqliteTable(
|
|
3430
3549
|
"tasks",
|
|
3431
3550
|
{
|
|
@@ -3970,6 +4089,12 @@ var init_schema_sqlite = __esm({
|
|
|
3970
4089
|
branch_id: text2("branch_id", { length: 36 }).references(() => branches2.branch_id, {
|
|
3971
4090
|
onDelete: "set null"
|
|
3972
4091
|
}),
|
|
4092
|
+
source_session_id: text2("source_session_id", { length: 36 }).references(
|
|
4093
|
+
() => sessions2.session_id,
|
|
4094
|
+
{
|
|
4095
|
+
onDelete: "set null"
|
|
4096
|
+
}
|
|
4097
|
+
),
|
|
3973
4098
|
board_id: text2("board_id", { length: 36 }).notNull().references(() => boards2.board_id, { onDelete: "cascade" }),
|
|
3974
4099
|
name: text2("name").notNull(),
|
|
3975
4100
|
description: text2("description"),
|
|
@@ -3996,6 +4121,7 @@ var init_schema_sqlite = __esm({
|
|
|
3996
4121
|
},
|
|
3997
4122
|
(table) => ({
|
|
3998
4123
|
branchIdx: index2("artifacts_branch_idx").on(table.branch_id),
|
|
4124
|
+
sourceSessionIdx: index2("artifacts_source_session_idx").on(table.source_session_id),
|
|
3999
4125
|
boardIdx: index2("artifacts_board_idx").on(table.board_id),
|
|
4000
4126
|
archivedIdx: index2("artifacts_archived_idx").on(table.archived),
|
|
4001
4127
|
publicIdx: index2("artifacts_public_idx").on(table.public)
|
|
@@ -4154,7 +4280,7 @@ var init_schema_sqlite = __esm({
|
|
|
4154
4280
|
// Materialized for queries
|
|
4155
4281
|
name: text2("name").notNull(),
|
|
4156
4282
|
channel_type: text2("channel_type", {
|
|
4157
|
-
enum: ["slack", "discord", "whatsapp", "telegram", "github"]
|
|
4283
|
+
enum: ["slack", "discord", "whatsapp", "telegram", "github", "teams"]
|
|
4158
4284
|
}).notNull(),
|
|
4159
4285
|
target_branch_id: text2("target_branch_id", { length: 36 }).notNull().references(() => branches2.branch_id, { onDelete: "cascade" }),
|
|
4160
4286
|
agor_user_id: text2("agor_user_id", { length: 36 }).notNull(),
|
|
@@ -4537,7 +4663,7 @@ var init_schema_sqlite = __esm({
|
|
|
4537
4663
|
archivedIdx: index2("kb_graph_edges_archived_idx").on(table.archived)
|
|
4538
4664
|
})
|
|
4539
4665
|
);
|
|
4540
|
-
sessionsRelations2 = relations2(sessions2, ({ one }) => ({
|
|
4666
|
+
sessionsRelations2 = relations2(sessions2, ({ one, many }) => ({
|
|
4541
4667
|
branch: one(branches2, {
|
|
4542
4668
|
fields: [sessions2.branch_id],
|
|
4543
4669
|
references: [branches2.branch_id]
|
|
@@ -4545,6 +4671,24 @@ var init_schema_sqlite = __esm({
|
|
|
4545
4671
|
schedule: one(schedules2, {
|
|
4546
4672
|
fields: [sessions2.schedule_id],
|
|
4547
4673
|
references: [schedules2.schedule_id]
|
|
4674
|
+
}),
|
|
4675
|
+
outboundRelationships: many(sessionRelationships2, { relationName: "relationshipSource" }),
|
|
4676
|
+
inboundRelationships: many(sessionRelationships2, { relationName: "relationshipTarget" })
|
|
4677
|
+
}));
|
|
4678
|
+
sessionRelationshipsRelations2 = relations2(sessionRelationships2, ({ one }) => ({
|
|
4679
|
+
sourceSession: one(sessions2, {
|
|
4680
|
+
fields: [sessionRelationships2.source_session_id],
|
|
4681
|
+
references: [sessions2.session_id],
|
|
4682
|
+
relationName: "relationshipSource"
|
|
4683
|
+
}),
|
|
4684
|
+
targetSession: one(sessions2, {
|
|
4685
|
+
fields: [sessionRelationships2.target_session_id],
|
|
4686
|
+
references: [sessions2.session_id],
|
|
4687
|
+
relationName: "relationshipTarget"
|
|
4688
|
+
}),
|
|
4689
|
+
callbackSession: one(sessions2, {
|
|
4690
|
+
fields: [sessionRelationships2.callback_session_id],
|
|
4691
|
+
references: [sessions2.session_id]
|
|
4548
4692
|
})
|
|
4549
4693
|
}));
|
|
4550
4694
|
branchesRelations2 = relations2(branches2, ({ many }) => ({
|
|
@@ -4640,6 +4784,7 @@ __export(schema_exports, {
|
|
|
4640
4784
|
serializedSessions: () => serializedSessions3,
|
|
4641
4785
|
sessionEnvSelections: () => sessionEnvSelections3,
|
|
4642
4786
|
sessionMcpServers: () => sessionMcpServers3,
|
|
4787
|
+
sessionRelationships: () => sessionRelationships3,
|
|
4643
4788
|
sessions: () => sessions3,
|
|
4644
4789
|
tasks: () => tasks3,
|
|
4645
4790
|
threadSessionMap: () => threadSessionMap3,
|
|
@@ -4647,7 +4792,7 @@ __export(schema_exports, {
|
|
|
4647
4792
|
userMcpOauthTokens: () => userMcpOauthTokens3,
|
|
4648
4793
|
users: () => users3
|
|
4649
4794
|
});
|
|
4650
|
-
var dialect, schema, sessions3, tasks3, messages3, boards3, repos3, branches3, branchOwners3, boardOwners3, groups3, groupMemberships3, branchGroupGrants3, boardGroupGrants3, schedules3, users3, appVariables3, mcpServers3, cardTypes3, cards3, artifacts3, artifactTrustGrants3, boardObjects3, sessionMcpServers3, sessionEnvSelections3, userMcpOauthTokens3, boardComments3, gatewayChannels3, threadSessionMap3, userApiKeys3, serializedSessions3, kbNamespaces3, kbNamespaceAcl3, kbDocuments3, kbDocumentVersions3, kbDocumentUnits3, kbEmbeddingSpaces3, kbGraphNodes3, kbGraphEdges3;
|
|
4795
|
+
var dialect, schema, sessions3, tasks3, messages3, boards3, repos3, branches3, branchOwners3, boardOwners3, groups3, groupMemberships3, branchGroupGrants3, boardGroupGrants3, schedules3, users3, appVariables3, mcpServers3, cardTypes3, cards3, artifacts3, artifactTrustGrants3, boardObjects3, sessionMcpServers3, sessionRelationships3, sessionEnvSelections3, userMcpOauthTokens3, boardComments3, gatewayChannels3, threadSessionMap3, userApiKeys3, serializedSessions3, kbNamespaces3, kbNamespaceAcl3, kbDocuments3, kbDocumentVersions3, kbDocumentUnits3, kbEmbeddingSpaces3, kbGraphNodes3, kbGraphEdges3;
|
|
4651
4796
|
var init_schema = __esm({
|
|
4652
4797
|
"src/db/schema.ts"() {
|
|
4653
4798
|
"use strict";
|
|
@@ -4679,6 +4824,7 @@ var init_schema = __esm({
|
|
|
4679
4824
|
artifactTrustGrants3 = schema.artifactTrustGrants;
|
|
4680
4825
|
boardObjects3 = schema.boardObjects;
|
|
4681
4826
|
sessionMcpServers3 = schema.sessionMcpServers;
|
|
4827
|
+
sessionRelationships3 = schema.sessionRelationships;
|
|
4682
4828
|
sessionEnvSelections3 = schema.sessionEnvSelections;
|
|
4683
4829
|
userMcpOauthTokens3 = schema.userMcpOauthTokens;
|
|
4684
4830
|
boardComments3 = schema.boardComments;
|
|
@@ -5213,7 +5359,11 @@ function extendBranchesService(client) {
|
|
|
5213
5359
|
const branchesService = client.service("branches");
|
|
5214
5360
|
if (branchesService[BRANCHES_SERVICE_EXTENDED]) return;
|
|
5215
5361
|
if (typeof branchesService.methods === "function") {
|
|
5216
|
-
branchesService.methods(
|
|
5362
|
+
branchesService.methods(
|
|
5363
|
+
"updateEnvironment",
|
|
5364
|
+
"initializeUnixGroup",
|
|
5365
|
+
"ensureAssistantKnowledgeNamespace"
|
|
5366
|
+
);
|
|
5217
5367
|
}
|
|
5218
5368
|
branchesService[BRANCHES_SERVICE_EXTENDED] = true;
|
|
5219
5369
|
}
|
|
@@ -6364,17 +6514,17 @@ init_esm_shims();
|
|
|
6364
6514
|
init_esm_shims();
|
|
6365
6515
|
init_ids();
|
|
6366
6516
|
import {
|
|
6367
|
-
and as
|
|
6517
|
+
and as and23,
|
|
6368
6518
|
asc as asc3,
|
|
6369
6519
|
desc as desc6,
|
|
6370
|
-
eq as
|
|
6520
|
+
eq as eq32,
|
|
6371
6521
|
gt,
|
|
6372
6522
|
gte,
|
|
6373
|
-
inArray as
|
|
6523
|
+
inArray as inArray8,
|
|
6374
6524
|
like as like16,
|
|
6375
6525
|
lte as lte2,
|
|
6376
|
-
or as
|
|
6377
|
-
sql as
|
|
6526
|
+
or as or9,
|
|
6527
|
+
sql as sql15
|
|
6378
6528
|
} from "drizzle-orm";
|
|
6379
6529
|
import bcryptjs from "bcryptjs";
|
|
6380
6530
|
|
|
@@ -6502,8 +6652,8 @@ function createPostgresDatabase(config) {
|
|
|
6502
6652
|
if (config.ssl !== void 0) {
|
|
6503
6653
|
options.ssl = config.ssl;
|
|
6504
6654
|
}
|
|
6505
|
-
const
|
|
6506
|
-
return drizzlePostgres(
|
|
6655
|
+
const sql16 = postgres(config.url, options);
|
|
6656
|
+
return drizzlePostgres(sql16, { schema: schema_postgres_exports });
|
|
6507
6657
|
} catch (error) {
|
|
6508
6658
|
throw new DatabaseConnectionError(
|
|
6509
6659
|
`Failed to create PostgreSQL client: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -7087,6 +7237,7 @@ var ArtifactRepository = class {
|
|
|
7087
7237
|
return {
|
|
7088
7238
|
artifact_id: artifactId,
|
|
7089
7239
|
branch_id: row.branch_id ?? null,
|
|
7240
|
+
source_session_id: row.source_session_id ?? null,
|
|
7090
7241
|
board_id: row.board_id,
|
|
7091
7242
|
name: row.name,
|
|
7092
7243
|
description: row.description ?? void 0,
|
|
@@ -7125,6 +7276,7 @@ var ArtifactRepository = class {
|
|
|
7125
7276
|
const insertData = {
|
|
7126
7277
|
artifact_id: artifactId,
|
|
7127
7278
|
branch_id: data.branch_id ?? null,
|
|
7279
|
+
source_session_id: data.source_session_id ?? null,
|
|
7128
7280
|
board_id: data.board_id ?? "",
|
|
7129
7281
|
name: data.name ?? "Untitled Artifact",
|
|
7130
7282
|
description: data.description ?? null,
|
|
@@ -7277,6 +7429,9 @@ var ArtifactRepository = class {
|
|
|
7277
7429
|
setData.agor_grants = updates.agor_grants ?? null;
|
|
7278
7430
|
}
|
|
7279
7431
|
if (updates.public !== void 0) setData.public = updates.public;
|
|
7432
|
+
if (updates.source_session_id !== void 0) {
|
|
7433
|
+
setData.source_session_id = updates.source_session_id ?? null;
|
|
7434
|
+
}
|
|
7280
7435
|
if (updates.archived !== void 0) setData.archived = updates.archived;
|
|
7281
7436
|
if (updates.archived_at !== void 0) {
|
|
7282
7437
|
setData.archived_at = updates.archived_at ? new Date(updates.archived_at) : null;
|
|
@@ -8502,6 +8657,7 @@ var FS_ACCESS_RANK = {
|
|
|
8502
8657
|
};
|
|
8503
8658
|
var VIEW_OR_BETTER_BRANCH_PERMISSIONS = ["view", "session", "prompt", "all"];
|
|
8504
8659
|
var BRANCH_PERMISSION_SOURCES = ["board", "override"];
|
|
8660
|
+
var FS_ACCESS_BRANCH_PERMISSIONS = ["read", "write"];
|
|
8505
8661
|
var BranchRepository = class {
|
|
8506
8662
|
constructor(db) {
|
|
8507
8663
|
this.db = db;
|
|
@@ -8995,6 +9151,83 @@ var BranchRepository = class {
|
|
|
8995
9151
|
}
|
|
8996
9152
|
return Array.from(userIds);
|
|
8997
9153
|
}
|
|
9154
|
+
/**
|
|
9155
|
+
* Find users whose explicit branch or aligned-board grants should materialize
|
|
9156
|
+
* into filesystem access for the branch.
|
|
9157
|
+
*
|
|
9158
|
+
* This intentionally excludes ambient "others" access because there is no
|
|
9159
|
+
* bounded user set to expand. Board owners apply whenever the branch is
|
|
9160
|
+
* explicitly aligned to board permissions (`permission_source = 'board'`);
|
|
9161
|
+
* board group grants additionally require a shared board. Override branches
|
|
9162
|
+
* must not inherit board grants.
|
|
9163
|
+
*/
|
|
9164
|
+
async findExplicitFsAccessUserIds(branchId) {
|
|
9165
|
+
const branchRow = await select(this.db, {
|
|
9166
|
+
board_id: branches3.board_id,
|
|
9167
|
+
permission_source: branches3.permission_source
|
|
9168
|
+
}).from(branches3).where(eq13(branches3.branch_id, branchId)).one();
|
|
9169
|
+
const ownerRows = await select(this.db, { user_id: branchOwners3.user_id }).from(branchOwners3).where(eq13(branchOwners3.branch_id, branchId)).all();
|
|
9170
|
+
const groupRows = await select(this.db, { user_id: groupMemberships3.user_id }).from(branchGroupGrants3).innerJoin(groupMemberships3, eq13(groupMemberships3.group_id, branchGroupGrants3.group_id)).innerJoin(
|
|
9171
|
+
groups3,
|
|
9172
|
+
and9(eq13(groups3.group_id, branchGroupGrants3.group_id), eq13(groups3.archived, false))
|
|
9173
|
+
).where(
|
|
9174
|
+
and9(
|
|
9175
|
+
eq13(branchGroupGrants3.branch_id, branchId),
|
|
9176
|
+
inArray3(
|
|
9177
|
+
sql7`coalesce(${branchGroupGrants3.fs_access}, 'read')`,
|
|
9178
|
+
FS_ACCESS_BRANCH_PERMISSIONS
|
|
9179
|
+
)
|
|
9180
|
+
)
|
|
9181
|
+
).all();
|
|
9182
|
+
const isBoardAligned = branchRow?.permission_source === "board" && branchRow.board_id;
|
|
9183
|
+
const boardOwnerRows = isBoardAligned ? await select(this.db, { user_id: boardOwners3.user_id }).from(boardOwners3).where(eq13(boardOwners3.board_id, branchRow.board_id)).all() : [];
|
|
9184
|
+
const boardGroupRows = isBoardAligned ? await select(this.db, { user_id: groupMemberships3.user_id }).from(boardGroupGrants3).innerJoin(groupMemberships3, eq13(groupMemberships3.group_id, boardGroupGrants3.group_id)).innerJoin(
|
|
9185
|
+
groups3,
|
|
9186
|
+
and9(eq13(groups3.group_id, boardGroupGrants3.group_id), eq13(groups3.archived, false))
|
|
9187
|
+
).innerJoin(
|
|
9188
|
+
boards3,
|
|
9189
|
+
and9(
|
|
9190
|
+
eq13(boards3.board_id, boardGroupGrants3.board_id),
|
|
9191
|
+
eq13(
|
|
9192
|
+
sql7`coalesce(${jsonExtract(this.db, boards3.data, "access_mode")}, 'shared')`,
|
|
9193
|
+
"shared"
|
|
9194
|
+
)
|
|
9195
|
+
)
|
|
9196
|
+
).where(
|
|
9197
|
+
and9(
|
|
9198
|
+
eq13(boardGroupGrants3.board_id, branchRow.board_id),
|
|
9199
|
+
inArray3(
|
|
9200
|
+
sql7`coalesce(${boardGroupGrants3.fs_access}, 'read')`,
|
|
9201
|
+
FS_ACCESS_BRANCH_PERMISSIONS
|
|
9202
|
+
)
|
|
9203
|
+
)
|
|
9204
|
+
).all() : [];
|
|
9205
|
+
const userIds = /* @__PURE__ */ new Set();
|
|
9206
|
+
for (const row of ownerRows) {
|
|
9207
|
+
userIds.add(row.user_id);
|
|
9208
|
+
}
|
|
9209
|
+
for (const row of groupRows) {
|
|
9210
|
+
userIds.add(row.user_id);
|
|
9211
|
+
}
|
|
9212
|
+
for (const row of boardOwnerRows) {
|
|
9213
|
+
userIds.add(row.user_id);
|
|
9214
|
+
}
|
|
9215
|
+
for (const row of boardGroupRows) {
|
|
9216
|
+
userIds.add(row.user_id);
|
|
9217
|
+
}
|
|
9218
|
+
return Array.from(userIds);
|
|
9219
|
+
}
|
|
9220
|
+
async findBoardAlignedBranches(boardId) {
|
|
9221
|
+
const rows = await select(this.db).from(branches3).where(
|
|
9222
|
+
and9(
|
|
9223
|
+
eq13(branches3.board_id, boardId),
|
|
9224
|
+
eq13(branches3.permission_source, "board"),
|
|
9225
|
+
eq13(branches3.archived, false)
|
|
9226
|
+
)
|
|
9227
|
+
).all();
|
|
9228
|
+
const baseUrl = await getBaseUrl();
|
|
9229
|
+
return rows.map((row) => this.rowToBranch(row, baseUrl));
|
|
9230
|
+
}
|
|
8998
9231
|
/**
|
|
8999
9232
|
* Get all owners of a branch
|
|
9000
9233
|
*
|
|
@@ -10570,8 +10803,10 @@ var SENSITIVE_CONFIG_FIELDS = [
|
|
|
10570
10803
|
"signing_secret",
|
|
10571
10804
|
// Slack
|
|
10572
10805
|
"private_key",
|
|
10573
|
-
"webhook_secret"
|
|
10806
|
+
"webhook_secret",
|
|
10574
10807
|
// GitHub
|
|
10808
|
+
"app_password"
|
|
10809
|
+
// Teams (Azure Bot App Secret)
|
|
10575
10810
|
];
|
|
10576
10811
|
var REDACTED_SENTINEL = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
10577
10812
|
function encryptConfig(config) {
|
|
@@ -14269,13 +14504,173 @@ var SessionMCPServerRepository = class {
|
|
|
14269
14504
|
}
|
|
14270
14505
|
};
|
|
14271
14506
|
|
|
14507
|
+
// src/db/repositories/session-relationships.ts
|
|
14508
|
+
init_esm_shims();
|
|
14509
|
+
init_ids();
|
|
14510
|
+
init_database_wrapper();
|
|
14511
|
+
init_schema();
|
|
14512
|
+
import { and as and19, eq as eq26, inArray as inArray6, or as or8 } from "drizzle-orm";
|
|
14513
|
+
var SessionRelationshipRepository = class {
|
|
14514
|
+
constructor(db) {
|
|
14515
|
+
this.db = db;
|
|
14516
|
+
}
|
|
14517
|
+
rowToRelationship(row) {
|
|
14518
|
+
return {
|
|
14519
|
+
relationship_id: row.relationship_id,
|
|
14520
|
+
source_session_id: row.source_session_id,
|
|
14521
|
+
target_session_id: row.target_session_id,
|
|
14522
|
+
relationship_type: row.relationship_type,
|
|
14523
|
+
created_by: row.created_by,
|
|
14524
|
+
created_at: new Date(row.created_at).toISOString(),
|
|
14525
|
+
updated_at: row.updated_at ? new Date(row.updated_at).toISOString() : null,
|
|
14526
|
+
callback_enabled: Boolean(row.callback_enabled),
|
|
14527
|
+
callback_session_id: row.callback_session_id ?? null,
|
|
14528
|
+
data: row.data ?? null
|
|
14529
|
+
};
|
|
14530
|
+
}
|
|
14531
|
+
async create(input) {
|
|
14532
|
+
try {
|
|
14533
|
+
const now = /* @__PURE__ */ new Date();
|
|
14534
|
+
const row = {
|
|
14535
|
+
relationship_id: generateId(),
|
|
14536
|
+
source_session_id: input.source_session_id,
|
|
14537
|
+
target_session_id: input.target_session_id,
|
|
14538
|
+
relationship_type: input.relationship_type,
|
|
14539
|
+
created_by: input.created_by,
|
|
14540
|
+
created_at: now,
|
|
14541
|
+
updated_at: now,
|
|
14542
|
+
callback_enabled: input.callback_enabled ?? false,
|
|
14543
|
+
callback_session_id: input.callback_session_id ?? null,
|
|
14544
|
+
data: input.data ?? null
|
|
14545
|
+
};
|
|
14546
|
+
await insert(this.db, sessionRelationships3).values(row).run();
|
|
14547
|
+
return this.rowToRelationship(row);
|
|
14548
|
+
} catch (error) {
|
|
14549
|
+
throw new RepositoryError(
|
|
14550
|
+
`Failed to create session relationship: ${error instanceof Error ? error.message : String(error)}`,
|
|
14551
|
+
error
|
|
14552
|
+
);
|
|
14553
|
+
}
|
|
14554
|
+
}
|
|
14555
|
+
async get(relationshipId) {
|
|
14556
|
+
try {
|
|
14557
|
+
const row = await select(this.db).from(sessionRelationships3).where(eq26(sessionRelationships3.relationship_id, relationshipId)).one();
|
|
14558
|
+
if (!row) throw new EntityNotFoundError("SessionRelationship", relationshipId);
|
|
14559
|
+
return this.rowToRelationship(row);
|
|
14560
|
+
} catch (error) {
|
|
14561
|
+
if (error instanceof EntityNotFoundError) throw error;
|
|
14562
|
+
throw new RepositoryError(
|
|
14563
|
+
`Failed to get session relationship: ${error instanceof Error ? error.message : String(error)}`,
|
|
14564
|
+
error
|
|
14565
|
+
);
|
|
14566
|
+
}
|
|
14567
|
+
}
|
|
14568
|
+
async findForSession(sessionId) {
|
|
14569
|
+
try {
|
|
14570
|
+
const rows = await select(this.db).from(sessionRelationships3).where(
|
|
14571
|
+
or8(
|
|
14572
|
+
eq26(sessionRelationships3.source_session_id, sessionId),
|
|
14573
|
+
eq26(sessionRelationships3.target_session_id, sessionId)
|
|
14574
|
+
)
|
|
14575
|
+
).all();
|
|
14576
|
+
return rows.map((row) => this.rowToRelationship(row));
|
|
14577
|
+
} catch (error) {
|
|
14578
|
+
throw new RepositoryError(
|
|
14579
|
+
`Failed to list session relationships: ${error instanceof Error ? error.message : String(error)}`,
|
|
14580
|
+
error
|
|
14581
|
+
);
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
async findForSessions(sessionIds) {
|
|
14585
|
+
if (sessionIds.length === 0) return [];
|
|
14586
|
+
try {
|
|
14587
|
+
const rows = await select(this.db).from(sessionRelationships3).where(
|
|
14588
|
+
or8(
|
|
14589
|
+
inArray6(sessionRelationships3.source_session_id, sessionIds),
|
|
14590
|
+
inArray6(sessionRelationships3.target_session_id, sessionIds)
|
|
14591
|
+
)
|
|
14592
|
+
).all();
|
|
14593
|
+
return rows.map((row) => this.rowToRelationship(row));
|
|
14594
|
+
} catch (error) {
|
|
14595
|
+
throw new RepositoryError(
|
|
14596
|
+
`Failed to list session relationships: ${error instanceof Error ? error.message : String(error)}`,
|
|
14597
|
+
error
|
|
14598
|
+
);
|
|
14599
|
+
}
|
|
14600
|
+
}
|
|
14601
|
+
async findRemoteChildren(sourceSessionId) {
|
|
14602
|
+
try {
|
|
14603
|
+
const rows = await select(this.db).from(sessionRelationships3).where(
|
|
14604
|
+
and19(
|
|
14605
|
+
eq26(sessionRelationships3.source_session_id, sourceSessionId),
|
|
14606
|
+
eq26(sessionRelationships3.relationship_type, "remote_create")
|
|
14607
|
+
)
|
|
14608
|
+
).all();
|
|
14609
|
+
return rows.map((row) => this.rowToRelationship(row));
|
|
14610
|
+
} catch (error) {
|
|
14611
|
+
throw new RepositoryError(
|
|
14612
|
+
`Failed to list remote child relationships: ${error instanceof Error ? error.message : String(error)}`,
|
|
14613
|
+
error
|
|
14614
|
+
);
|
|
14615
|
+
}
|
|
14616
|
+
}
|
|
14617
|
+
async findRemoteParents(targetSessionId) {
|
|
14618
|
+
try {
|
|
14619
|
+
const rows = await select(this.db).from(sessionRelationships3).where(
|
|
14620
|
+
and19(
|
|
14621
|
+
eq26(sessionRelationships3.target_session_id, targetSessionId),
|
|
14622
|
+
eq26(sessionRelationships3.relationship_type, "remote_create")
|
|
14623
|
+
)
|
|
14624
|
+
).all();
|
|
14625
|
+
return rows.map((row) => this.rowToRelationship(row));
|
|
14626
|
+
} catch (error) {
|
|
14627
|
+
throw new RepositoryError(
|
|
14628
|
+
`Failed to list remote parent relationships: ${error instanceof Error ? error.message : String(error)}`,
|
|
14629
|
+
error
|
|
14630
|
+
);
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14633
|
+
async setCallbackEnabled(relationshipId, callbackEnabled) {
|
|
14634
|
+
try {
|
|
14635
|
+
const result = await update(this.db, sessionRelationships3).set({ callback_enabled: callbackEnabled, updated_at: /* @__PURE__ */ new Date() }).where(eq26(sessionRelationships3.relationship_id, relationshipId)).run();
|
|
14636
|
+
if (result.rowsAffected === 0) {
|
|
14637
|
+
throw new EntityNotFoundError("SessionRelationship", relationshipId);
|
|
14638
|
+
}
|
|
14639
|
+
const row = await select(this.db).from(sessionRelationships3).where(eq26(sessionRelationships3.relationship_id, relationshipId)).one();
|
|
14640
|
+
if (!row) throw new EntityNotFoundError("SessionRelationship", relationshipId);
|
|
14641
|
+
return this.rowToRelationship(row);
|
|
14642
|
+
} catch (error) {
|
|
14643
|
+
if (error instanceof EntityNotFoundError) throw error;
|
|
14644
|
+
throw new RepositoryError(
|
|
14645
|
+
`Failed to update session relationship callback state: ${error instanceof Error ? error.message : String(error)}`,
|
|
14646
|
+
error
|
|
14647
|
+
);
|
|
14648
|
+
}
|
|
14649
|
+
}
|
|
14650
|
+
async setCallbackEnabledForTargetSession(targetSessionId, callbackEnabled) {
|
|
14651
|
+
try {
|
|
14652
|
+
await update(this.db, sessionRelationships3).set({ callback_enabled: callbackEnabled, updated_at: /* @__PURE__ */ new Date() }).where(
|
|
14653
|
+
and19(
|
|
14654
|
+
eq26(sessionRelationships3.target_session_id, targetSessionId),
|
|
14655
|
+
eq26(sessionRelationships3.relationship_type, "remote_create")
|
|
14656
|
+
)
|
|
14657
|
+
).run();
|
|
14658
|
+
} catch (error) {
|
|
14659
|
+
throw new RepositoryError(
|
|
14660
|
+
`Failed to update target session relationship callback state: ${error instanceof Error ? error.message : String(error)}`,
|
|
14661
|
+
error
|
|
14662
|
+
);
|
|
14663
|
+
}
|
|
14664
|
+
}
|
|
14665
|
+
};
|
|
14666
|
+
|
|
14272
14667
|
// src/db/repositories/tasks.ts
|
|
14273
14668
|
init_esm_shims();
|
|
14274
14669
|
init_types2();
|
|
14275
14670
|
init_ids();
|
|
14276
14671
|
init_database_wrapper();
|
|
14277
14672
|
init_schema();
|
|
14278
|
-
import { eq as
|
|
14673
|
+
import { eq as eq27, inArray as inArray7, like as like13, sql as sql13 } from "drizzle-orm";
|
|
14279
14674
|
var TaskRepository = class {
|
|
14280
14675
|
constructor(db) {
|
|
14281
14676
|
this.db = db;
|
|
@@ -14371,7 +14766,7 @@ var TaskRepository = class {
|
|
|
14371
14766
|
try {
|
|
14372
14767
|
const insertData = this.taskToInsert(data);
|
|
14373
14768
|
await insert(this.db, tasks3).values(insertData).run();
|
|
14374
|
-
const row = await select(this.db).from(tasks3).where(
|
|
14769
|
+
const row = await select(this.db).from(tasks3).where(eq27(tasks3.task_id, insertData.task_id)).one();
|
|
14375
14770
|
if (!row) {
|
|
14376
14771
|
throw new RepositoryError("Failed to retrieve created task");
|
|
14377
14772
|
}
|
|
@@ -14395,7 +14790,7 @@ var TaskRepository = class {
|
|
|
14395
14790
|
const inserts = taskList.map((task) => this.taskToInsert(task));
|
|
14396
14791
|
await insert(this.db, tasks3).values(inserts).run();
|
|
14397
14792
|
const taskIds = inserts.map((t3) => t3.task_id);
|
|
14398
|
-
const rows = await select(this.db).from(tasks3).where(
|
|
14793
|
+
const rows = await select(this.db).from(tasks3).where(inArray7(tasks3.task_id, taskIds)).all();
|
|
14399
14794
|
const rowsById = new Map(rows.map((r) => [r.task_id, r]));
|
|
14400
14795
|
return taskIds.map((id) => this.rowToTask(rowsById.get(id)));
|
|
14401
14796
|
} catch (error) {
|
|
@@ -14411,7 +14806,7 @@ var TaskRepository = class {
|
|
|
14411
14806
|
async findById(id) {
|
|
14412
14807
|
try {
|
|
14413
14808
|
const fullId = await this.resolveId(id);
|
|
14414
|
-
const row = await select(this.db).from(tasks3).where(
|
|
14809
|
+
const row = await select(this.db).from(tasks3).where(eq27(tasks3.task_id, fullId)).one();
|
|
14415
14810
|
return row ? this.rowToTask(row) : null;
|
|
14416
14811
|
} catch (error) {
|
|
14417
14812
|
if (error instanceof EntityNotFoundError) return null;
|
|
@@ -14441,7 +14836,7 @@ var TaskRepository = class {
|
|
|
14441
14836
|
*/
|
|
14442
14837
|
async findBySession(sessionId) {
|
|
14443
14838
|
try {
|
|
14444
|
-
const rows = await select(this.db).from(tasks3).where(
|
|
14839
|
+
const rows = await select(this.db).from(tasks3).where(eq27(tasks3.session_id, sessionId)).orderBy(tasks3.created_at).all();
|
|
14445
14840
|
return rows.map((row) => this.rowToTask(row));
|
|
14446
14841
|
} catch (error) {
|
|
14447
14842
|
throw new RepositoryError(
|
|
@@ -14455,7 +14850,7 @@ var TaskRepository = class {
|
|
|
14455
14850
|
*/
|
|
14456
14851
|
async findRunning() {
|
|
14457
14852
|
try {
|
|
14458
|
-
const rows = await select(this.db).from(tasks3).where(
|
|
14853
|
+
const rows = await select(this.db).from(tasks3).where(eq27(tasks3.status, TaskStatus.RUNNING)).all();
|
|
14459
14854
|
return rows.map((row) => this.rowToTask(row));
|
|
14460
14855
|
} catch (error) {
|
|
14461
14856
|
throw new RepositoryError(
|
|
@@ -14511,7 +14906,7 @@ var TaskRepository = class {
|
|
|
14511
14906
|
*/
|
|
14512
14907
|
async findByStatus(status) {
|
|
14513
14908
|
try {
|
|
14514
|
-
const rows = await select(this.db).from(tasks3).where(
|
|
14909
|
+
const rows = await select(this.db).from(tasks3).where(eq27(tasks3.status, status)).all();
|
|
14515
14910
|
return rows.map((row) => this.rowToTask(row));
|
|
14516
14911
|
} catch (error) {
|
|
14517
14912
|
throw new RepositoryError(
|
|
@@ -14533,8 +14928,8 @@ var TaskRepository = class {
|
|
|
14533
14928
|
`\u{1F504} [TaskRepo] Updating task ${shortId(fullId)}${updates.status ? ` (status: ${updates.status})` : ""}`
|
|
14534
14929
|
);
|
|
14535
14930
|
const result = await this.db.transaction(async (tx) => {
|
|
14536
|
-
await lockRowForUpdate(txAsDb(tx), this.db, tasks3,
|
|
14537
|
-
const currentRow = await select(txAsDb(tx)).from(tasks3).where(
|
|
14931
|
+
await lockRowForUpdate(txAsDb(tx), this.db, tasks3, eq27(tasks3.task_id, fullId));
|
|
14932
|
+
const currentRow = await select(txAsDb(tx)).from(tasks3).where(eq27(tasks3.task_id, fullId)).one();
|
|
14538
14933
|
if (!currentRow) {
|
|
14539
14934
|
throw new EntityNotFoundError("Task", id);
|
|
14540
14935
|
}
|
|
@@ -14548,7 +14943,7 @@ var TaskRepository = class {
|
|
|
14548
14943
|
last_executor_heartbeat_at: insertData.last_executor_heartbeat_at,
|
|
14549
14944
|
session_md5: insertData.session_md5,
|
|
14550
14945
|
data: insertData.data
|
|
14551
|
-
}).where(
|
|
14946
|
+
}).where(eq27(tasks3.task_id, fullId)).run();
|
|
14552
14947
|
return merged;
|
|
14553
14948
|
});
|
|
14554
14949
|
return result;
|
|
@@ -14567,7 +14962,7 @@ var TaskRepository = class {
|
|
|
14567
14962
|
async delete(id) {
|
|
14568
14963
|
try {
|
|
14569
14964
|
const fullId = await this.resolveId(id);
|
|
14570
|
-
const result = await deleteFrom(this.db, tasks3).where(
|
|
14965
|
+
const result = await deleteFrom(this.db, tasks3).where(eq27(tasks3.task_id, fullId)).run();
|
|
14571
14966
|
if (result.rowsAffected === 0) {
|
|
14572
14967
|
throw new EntityNotFoundError("Task", id);
|
|
14573
14968
|
}
|
|
@@ -14629,7 +15024,7 @@ var TaskRepository = class {
|
|
|
14629
15024
|
queue_position: nextPosition
|
|
14630
15025
|
});
|
|
14631
15026
|
await insert(txAsDb(tx), tasks3).values(insertData).run();
|
|
14632
|
-
const row = await select(txAsDb(tx)).from(tasks3).where(
|
|
15027
|
+
const row = await select(txAsDb(tx)).from(tasks3).where(eq27(tasks3.task_id, insertData.task_id)).one();
|
|
14633
15028
|
if (!row) {
|
|
14634
15029
|
throw new RepositoryError("Failed to retrieve created queued task");
|
|
14635
15030
|
}
|
|
@@ -14670,7 +15065,7 @@ var TaskRepository = class {
|
|
|
14670
15065
|
*/
|
|
14671
15066
|
async countBySession(sessionId) {
|
|
14672
15067
|
try {
|
|
14673
|
-
const result = await select(this.db, { count: sql13`count(*)` }).from(tasks3).where(
|
|
15068
|
+
const result = await select(this.db, { count: sql13`count(*)` }).from(tasks3).where(eq27(tasks3.session_id, sessionId)).one();
|
|
14674
15069
|
return result?.count ?? 0;
|
|
14675
15070
|
} catch (error) {
|
|
14676
15071
|
throw new RepositoryError(
|
|
@@ -14687,7 +15082,7 @@ init_types2();
|
|
|
14687
15082
|
init_ids();
|
|
14688
15083
|
init_database_wrapper();
|
|
14689
15084
|
init_schema();
|
|
14690
|
-
import { and as
|
|
15085
|
+
import { and as and20, eq as eq28, like as like14, lt as lt2 } from "drizzle-orm";
|
|
14691
15086
|
var ThreadSessionMapRepository = class {
|
|
14692
15087
|
constructor(db) {
|
|
14693
15088
|
this.db = db;
|
|
@@ -14757,7 +15152,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14757
15152
|
id: data.id ?? generateId()
|
|
14758
15153
|
});
|
|
14759
15154
|
await insert(this.db, threadSessionMap3).values(insertData).run();
|
|
14760
|
-
const row = await select(this.db).from(threadSessionMap3).where(
|
|
15155
|
+
const row = await select(this.db).from(threadSessionMap3).where(eq28(threadSessionMap3.id, insertData.id)).one();
|
|
14761
15156
|
if (!row) {
|
|
14762
15157
|
throw new RepositoryError("Failed to retrieve created thread-session mapping");
|
|
14763
15158
|
}
|
|
@@ -14776,7 +15171,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14776
15171
|
async findById(id) {
|
|
14777
15172
|
try {
|
|
14778
15173
|
const fullId = await this.resolveId(id);
|
|
14779
|
-
const row = await select(this.db).from(threadSessionMap3).where(
|
|
15174
|
+
const row = await select(this.db).from(threadSessionMap3).where(eq28(threadSessionMap3.id, fullId)).one();
|
|
14780
15175
|
return row ? this.rowToMapping(row) : null;
|
|
14781
15176
|
} catch (error) {
|
|
14782
15177
|
if (error instanceof EntityNotFoundError) return null;
|
|
@@ -14817,7 +15212,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14817
15212
|
status: insertData.status,
|
|
14818
15213
|
last_message_at: insertData.last_message_at,
|
|
14819
15214
|
metadata: insertData.metadata
|
|
14820
|
-
}).where(
|
|
15215
|
+
}).where(eq28(threadSessionMap3.id, fullId)).run();
|
|
14821
15216
|
const updated = await this.findById(fullId);
|
|
14822
15217
|
if (!updated) {
|
|
14823
15218
|
throw new RepositoryError("Failed to retrieve updated thread-session mapping");
|
|
@@ -14838,7 +15233,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14838
15233
|
async delete(id) {
|
|
14839
15234
|
try {
|
|
14840
15235
|
const fullId = await this.resolveId(id);
|
|
14841
|
-
const result = await deleteFrom(this.db, threadSessionMap3).where(
|
|
15236
|
+
const result = await deleteFrom(this.db, threadSessionMap3).where(eq28(threadSessionMap3.id, fullId)).run();
|
|
14842
15237
|
if (result.rowsAffected === 0) {
|
|
14843
15238
|
throw new EntityNotFoundError("ThreadSessionMap", id);
|
|
14844
15239
|
}
|
|
@@ -14856,7 +15251,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14856
15251
|
async findByChannelAndThread(channelId, threadId) {
|
|
14857
15252
|
try {
|
|
14858
15253
|
const row = await select(this.db).from(threadSessionMap3).where(
|
|
14859
|
-
|
|
15254
|
+
and20(eq28(threadSessionMap3.channel_id, channelId), eq28(threadSessionMap3.thread_id, threadId))
|
|
14860
15255
|
).one();
|
|
14861
15256
|
return row ? this.rowToMapping(row) : null;
|
|
14862
15257
|
} catch (error) {
|
|
@@ -14873,7 +15268,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14873
15268
|
*/
|
|
14874
15269
|
async findByThread(threadId) {
|
|
14875
15270
|
try {
|
|
14876
|
-
const row = await select(this.db).from(threadSessionMap3).where(
|
|
15271
|
+
const row = await select(this.db).from(threadSessionMap3).where(eq28(threadSessionMap3.thread_id, threadId)).one();
|
|
14877
15272
|
return row ? this.rowToMapping(row) : null;
|
|
14878
15273
|
} catch (error) {
|
|
14879
15274
|
throw new RepositoryError(
|
|
@@ -14887,7 +15282,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14887
15282
|
*/
|
|
14888
15283
|
async findBySession(sessionId) {
|
|
14889
15284
|
try {
|
|
14890
|
-
const row = await select(this.db).from(threadSessionMap3).where(
|
|
15285
|
+
const row = await select(this.db).from(threadSessionMap3).where(eq28(threadSessionMap3.session_id, sessionId)).one();
|
|
14891
15286
|
return row ? this.rowToMapping(row) : null;
|
|
14892
15287
|
} catch (error) {
|
|
14893
15288
|
throw new RepositoryError(
|
|
@@ -14901,11 +15296,11 @@ var ThreadSessionMapRepository = class {
|
|
|
14901
15296
|
*/
|
|
14902
15297
|
async findByChannel(channelId, status) {
|
|
14903
15298
|
try {
|
|
14904
|
-
const conditions = [
|
|
15299
|
+
const conditions = [eq28(threadSessionMap3.channel_id, channelId)];
|
|
14905
15300
|
if (status) {
|
|
14906
|
-
conditions.push(
|
|
15301
|
+
conditions.push(eq28(threadSessionMap3.status, status));
|
|
14907
15302
|
}
|
|
14908
|
-
const rows = await select(this.db).from(threadSessionMap3).where(
|
|
15303
|
+
const rows = await select(this.db).from(threadSessionMap3).where(and20(...conditions)).all();
|
|
14909
15304
|
return rows.map((row) => this.rowToMapping(row));
|
|
14910
15305
|
} catch (error) {
|
|
14911
15306
|
throw new RepositoryError(
|
|
@@ -14921,7 +15316,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14921
15316
|
try {
|
|
14922
15317
|
await update(this.db, threadSessionMap3).set({
|
|
14923
15318
|
last_message_at: /* @__PURE__ */ new Date()
|
|
14924
|
-
}).where(
|
|
15319
|
+
}).where(eq28(threadSessionMap3.id, id)).run();
|
|
14925
15320
|
} catch (error) {
|
|
14926
15321
|
throw new RepositoryError(
|
|
14927
15322
|
`Failed to update last message timestamp: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -14934,7 +15329,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14934
15329
|
*/
|
|
14935
15330
|
async updateMetadata(id, metadata) {
|
|
14936
15331
|
try {
|
|
14937
|
-
await update(this.db, threadSessionMap3).set({ metadata }).where(
|
|
15332
|
+
await update(this.db, threadSessionMap3).set({ metadata }).where(eq28(threadSessionMap3.id, id)).run();
|
|
14938
15333
|
} catch (error) {
|
|
14939
15334
|
throw new RepositoryError(
|
|
14940
15335
|
`Failed to update metadata: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -14949,7 +15344,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14949
15344
|
try {
|
|
14950
15345
|
const cutoff = new Date(Date.now() - daysInactive * 24 * 60 * 60 * 1e3);
|
|
14951
15346
|
const rows = await select(this.db).from(threadSessionMap3).where(
|
|
14952
|
-
|
|
15347
|
+
and20(eq28(threadSessionMap3.status, "active"), lt2(threadSessionMap3.last_message_at, cutoff))
|
|
14953
15348
|
).all();
|
|
14954
15349
|
return rows.map((row) => this.rowToMapping(row));
|
|
14955
15350
|
} catch (error) {
|
|
@@ -14964,7 +15359,7 @@ var ThreadSessionMapRepository = class {
|
|
|
14964
15359
|
*/
|
|
14965
15360
|
async findByBranch(branchId) {
|
|
14966
15361
|
try {
|
|
14967
|
-
const rows = await select(this.db).from(threadSessionMap3).where(
|
|
15362
|
+
const rows = await select(this.db).from(threadSessionMap3).where(eq28(threadSessionMap3.branch_id, branchId)).all();
|
|
14968
15363
|
return rows.map((row) => this.rowToMapping(row));
|
|
14969
15364
|
} catch (error) {
|
|
14970
15365
|
throw new RepositoryError(
|
|
@@ -14982,7 +15377,7 @@ init_database_wrapper();
|
|
|
14982
15377
|
init_schema();
|
|
14983
15378
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
14984
15379
|
import bcrypt2 from "bcryptjs";
|
|
14985
|
-
import { and as
|
|
15380
|
+
import { and as and21, eq as eq29 } from "drizzle-orm";
|
|
14986
15381
|
var KEY_PREFIX = "agor_sk_";
|
|
14987
15382
|
var KEY_PREFIX_LENGTH = 12;
|
|
14988
15383
|
var KEY_RANDOM_BYTES = 32;
|
|
@@ -15019,7 +15414,7 @@ var UserApiKeysRepository = class {
|
|
|
15019
15414
|
}
|
|
15020
15415
|
/** List all API keys for a user (never returns hashes) */
|
|
15021
15416
|
async listByUser(userId) {
|
|
15022
|
-
const rows = await select(this.db).from(userApiKeys3).where(
|
|
15417
|
+
const rows = await select(this.db).from(userApiKeys3).where(eq29(userApiKeys3.user_id, userId)).all();
|
|
15023
15418
|
return rows.map((r) => ({
|
|
15024
15419
|
id: r.id,
|
|
15025
15420
|
name: r.name,
|
|
@@ -15030,7 +15425,7 @@ var UserApiKeysRepository = class {
|
|
|
15030
15425
|
}
|
|
15031
15426
|
/** Find a key by prefix (for auth lookup). Returns rows with hash for verification. */
|
|
15032
15427
|
async findByPrefix(prefix) {
|
|
15033
|
-
return select(this.db).from(userApiKeys3).where(
|
|
15428
|
+
return select(this.db).from(userApiKeys3).where(eq29(userApiKeys3.prefix, prefix)).all();
|
|
15034
15429
|
}
|
|
15035
15430
|
/** Verify a raw API key against stored hashes. Returns the matching row or null. */
|
|
15036
15431
|
async verifyKey(rawKey) {
|
|
@@ -15045,19 +15440,19 @@ var UserApiKeysRepository = class {
|
|
|
15045
15440
|
}
|
|
15046
15441
|
/** Update last_used_at timestamp */
|
|
15047
15442
|
async updateLastUsed(id) {
|
|
15048
|
-
await update(this.db, userApiKeys3).set({ last_used_at: /* @__PURE__ */ new Date() }).where(
|
|
15443
|
+
await update(this.db, userApiKeys3).set({ last_used_at: /* @__PURE__ */ new Date() }).where(eq29(userApiKeys3.id, id)).run();
|
|
15049
15444
|
}
|
|
15050
15445
|
/** Update key name */
|
|
15051
15446
|
async updateName(id, userId, name) {
|
|
15052
|
-
await update(this.db, userApiKeys3).set({ name }).where(
|
|
15447
|
+
await update(this.db, userApiKeys3).set({ name }).where(and21(eq29(userApiKeys3.id, id), eq29(userApiKeys3.user_id, userId))).run();
|
|
15053
15448
|
}
|
|
15054
15449
|
/** Delete a key */
|
|
15055
15450
|
async delete(id, userId) {
|
|
15056
|
-
await deleteFrom(this.db, userApiKeys3).where(
|
|
15451
|
+
await deleteFrom(this.db, userApiKeys3).where(and21(eq29(userApiKeys3.id, id), eq29(userApiKeys3.user_id, userId))).run();
|
|
15057
15452
|
}
|
|
15058
15453
|
/** Delete all keys for a user */
|
|
15059
15454
|
async deleteAllForUser(userId) {
|
|
15060
|
-
await deleteFrom(this.db, userApiKeys3).where(
|
|
15455
|
+
await deleteFrom(this.db, userApiKeys3).where(eq29(userApiKeys3.user_id, userId)).run();
|
|
15061
15456
|
}
|
|
15062
15457
|
};
|
|
15063
15458
|
|
|
@@ -15065,7 +15460,7 @@ var UserApiKeysRepository = class {
|
|
|
15065
15460
|
init_esm_shims();
|
|
15066
15461
|
init_database_wrapper();
|
|
15067
15462
|
init_schema();
|
|
15068
|
-
import { and as
|
|
15463
|
+
import { and as and22, eq as eq30, isNull as isNull6 } from "drizzle-orm";
|
|
15069
15464
|
function rowToToken(row) {
|
|
15070
15465
|
return {
|
|
15071
15466
|
user_id: row.user_id ?? null,
|
|
@@ -15080,9 +15475,9 @@ function rowToToken(row) {
|
|
|
15080
15475
|
};
|
|
15081
15476
|
}
|
|
15082
15477
|
function matchKey(userId, serverId) {
|
|
15083
|
-
return
|
|
15084
|
-
userId === null ? isNull6(userMcpOauthTokens3.user_id) :
|
|
15085
|
-
|
|
15478
|
+
return and22(
|
|
15479
|
+
userId === null ? isNull6(userMcpOauthTokens3.user_id) : eq30(userMcpOauthTokens3.user_id, userId),
|
|
15480
|
+
eq30(userMcpOauthTokens3.mcp_server_id, serverId)
|
|
15086
15481
|
);
|
|
15087
15482
|
}
|
|
15088
15483
|
var UserMCPOAuthTokenRepository = class {
|
|
@@ -15199,7 +15594,7 @@ var UserMCPOAuthTokenRepository = class {
|
|
|
15199
15594
|
}
|
|
15200
15595
|
async deleteAllForUser(userId) {
|
|
15201
15596
|
try {
|
|
15202
|
-
const result = await deleteFrom(this.db, userMcpOauthTokens3).where(
|
|
15597
|
+
const result = await deleteFrom(this.db, userMcpOauthTokens3).where(eq30(userMcpOauthTokens3.user_id, userId)).run();
|
|
15203
15598
|
return result.rowsAffected;
|
|
15204
15599
|
} catch (error) {
|
|
15205
15600
|
throw new RepositoryError(
|
|
@@ -15210,7 +15605,7 @@ var UserMCPOAuthTokenRepository = class {
|
|
|
15210
15605
|
}
|
|
15211
15606
|
async deleteAllForServer(serverId) {
|
|
15212
15607
|
try {
|
|
15213
|
-
const result = await deleteFrom(this.db, userMcpOauthTokens3).where(
|
|
15608
|
+
const result = await deleteFrom(this.db, userMcpOauthTokens3).where(eq30(userMcpOauthTokens3.mcp_server_id, serverId)).run();
|
|
15214
15609
|
return result.rowsAffected;
|
|
15215
15610
|
} catch (error) {
|
|
15216
15611
|
throw new RepositoryError(
|
|
@@ -15221,7 +15616,7 @@ var UserMCPOAuthTokenRepository = class {
|
|
|
15221
15616
|
}
|
|
15222
15617
|
async listForUser(userId) {
|
|
15223
15618
|
try {
|
|
15224
|
-
const rows = await select(this.db).from(userMcpOauthTokens3).where(
|
|
15619
|
+
const rows = await select(this.db).from(userMcpOauthTokens3).where(eq30(userMcpOauthTokens3.user_id, userId)).all();
|
|
15225
15620
|
return rows.map(rowToToken);
|
|
15226
15621
|
} catch (error) {
|
|
15227
15622
|
throw new RepositoryError(
|
|
@@ -15239,7 +15634,7 @@ var UserMCPOAuthTokenRepository = class {
|
|
|
15239
15634
|
// src/db/repositories/users.ts
|
|
15240
15635
|
init_esm_shims();
|
|
15241
15636
|
init_types2();
|
|
15242
|
-
import { eq as
|
|
15637
|
+
import { eq as eq31, like as like15, sql as sql14 } from "drizzle-orm";
|
|
15243
15638
|
init_ids();
|
|
15244
15639
|
init_database_wrapper();
|
|
15245
15640
|
init_schema();
|
|
@@ -15339,7 +15734,7 @@ var UsersRepository = class {
|
|
|
15339
15734
|
* Check if unix_username is already taken by another user
|
|
15340
15735
|
*/
|
|
15341
15736
|
async isUnixUsernameTaken(unixUsername, excludeUserId) {
|
|
15342
|
-
const result = await select(this.db).from(users3).where(
|
|
15737
|
+
const result = await select(this.db).from(users3).where(eq31(users3.unix_username, unixUsername)).one();
|
|
15343
15738
|
if (!result) {
|
|
15344
15739
|
return false;
|
|
15345
15740
|
}
|
|
@@ -15362,7 +15757,7 @@ var UsersRepository = class {
|
|
|
15362
15757
|
}
|
|
15363
15758
|
const insertData = this.userToInsert(data);
|
|
15364
15759
|
await insert(this.db, users3).values(insertData).run();
|
|
15365
|
-
const row = await select(this.db).from(users3).where(
|
|
15760
|
+
const row = await select(this.db).from(users3).where(eq31(users3.user_id, insertData.user_id)).one();
|
|
15366
15761
|
if (!row) {
|
|
15367
15762
|
throw new RepositoryError("Failed to retrieve created user");
|
|
15368
15763
|
}
|
|
@@ -15374,7 +15769,7 @@ var UsersRepository = class {
|
|
|
15374
15769
|
async findById(id) {
|
|
15375
15770
|
try {
|
|
15376
15771
|
const fullId = await this.resolveId(id);
|
|
15377
|
-
const result = await select(this.db).from(users3).where(
|
|
15772
|
+
const result = await select(this.db).from(users3).where(eq31(users3.user_id, fullId)).one();
|
|
15378
15773
|
if (!result) {
|
|
15379
15774
|
return null;
|
|
15380
15775
|
}
|
|
@@ -15390,12 +15785,41 @@ var UsersRepository = class {
|
|
|
15390
15785
|
* Find user by email
|
|
15391
15786
|
*/
|
|
15392
15787
|
async findByEmail(email) {
|
|
15393
|
-
const result = await select(this.db).from(users3).where(
|
|
15788
|
+
const result = await select(this.db).from(users3).where(eq31(users3.email, email)).one();
|
|
15394
15789
|
if (!result) {
|
|
15395
15790
|
return null;
|
|
15396
15791
|
}
|
|
15397
15792
|
return this.rowToUser(result);
|
|
15398
15793
|
}
|
|
15794
|
+
/**
|
|
15795
|
+
* Find user by email for external identity providers.
|
|
15796
|
+
*
|
|
15797
|
+
* Agor intentionally keeps exact/case-sensitive email lookup semantics for
|
|
15798
|
+
* auth paths because the schema historically allowed case-distinct emails.
|
|
15799
|
+
* External providers such as Slack and GitHub treat email addresses as a
|
|
15800
|
+
* canonical identity hint, so their alignment path needs a case-insensitive
|
|
15801
|
+
* match. Prefer an exact match when present; otherwise return a
|
|
15802
|
+
* case-insensitive match only when it is unambiguous.
|
|
15803
|
+
*/
|
|
15804
|
+
async findByEmailForAlignment(email) {
|
|
15805
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
15806
|
+
if (!normalizedEmail) return null;
|
|
15807
|
+
const exact = await this.findByEmail(normalizedEmail);
|
|
15808
|
+
if (exact) return exact;
|
|
15809
|
+
const results = await select(this.db).from(users3).where(sql14`LOWER(${users3.email}) = ${normalizedEmail}`).all();
|
|
15810
|
+
if (results.length !== 1) {
|
|
15811
|
+
if (results.length > 1) {
|
|
15812
|
+
console.warn(
|
|
15813
|
+
`[users] Ambiguous case-insensitive email alignment for ${normalizedEmail}: ${results.map((row) => {
|
|
15814
|
+
const userRow = row;
|
|
15815
|
+
return `${shortId(userRow.user_id)}:${userRow.email}`;
|
|
15816
|
+
}).join(", ")}`
|
|
15817
|
+
);
|
|
15818
|
+
}
|
|
15819
|
+
return null;
|
|
15820
|
+
}
|
|
15821
|
+
return this.rowToUser(results[0]);
|
|
15822
|
+
}
|
|
15399
15823
|
/**
|
|
15400
15824
|
* Find all users
|
|
15401
15825
|
*/
|
|
@@ -15432,8 +15856,8 @@ var UsersRepository = class {
|
|
|
15432
15856
|
await update(this.db, users3).set({
|
|
15433
15857
|
...insertData,
|
|
15434
15858
|
updated_at: /* @__PURE__ */ new Date()
|
|
15435
|
-
}).where(
|
|
15436
|
-
const row = await select(this.db).from(users3).where(
|
|
15859
|
+
}).where(eq31(users3.user_id, fullId)).run();
|
|
15860
|
+
const row = await select(this.db).from(users3).where(eq31(users3.user_id, fullId)).one();
|
|
15437
15861
|
if (!row) {
|
|
15438
15862
|
throw new RepositoryError("Failed to retrieve updated user");
|
|
15439
15863
|
}
|
|
@@ -15444,7 +15868,7 @@ var UsersRepository = class {
|
|
|
15444
15868
|
*/
|
|
15445
15869
|
async delete(id) {
|
|
15446
15870
|
const fullId = await this.resolveId(id);
|
|
15447
|
-
await deleteFrom(this.db, users3).where(
|
|
15871
|
+
await deleteFrom(this.db, users3).where(eq31(users3.user_id, fullId)).run();
|
|
15448
15872
|
}
|
|
15449
15873
|
/**
|
|
15450
15874
|
* Get raw database row (internal use only - includes encrypted keys)
|
|
@@ -15452,7 +15876,7 @@ var UsersRepository = class {
|
|
|
15452
15876
|
async getRawRow(id) {
|
|
15453
15877
|
try {
|
|
15454
15878
|
const fullId = await this.resolveId(id);
|
|
15455
|
-
const result = await select(this.db).from(users3).where(
|
|
15879
|
+
const result = await select(this.db).from(users3).where(eq31(users3.user_id, fullId)).one();
|
|
15456
15880
|
return result;
|
|
15457
15881
|
} catch (error) {
|
|
15458
15882
|
if (error instanceof EntityNotFoundError) {
|
|
@@ -15534,7 +15958,7 @@ var UsersRepository = class {
|
|
|
15534
15958
|
await update(this.db, users3).set({
|
|
15535
15959
|
data: { ...row.data, agentic_tools: next },
|
|
15536
15960
|
updated_at: /* @__PURE__ */ new Date()
|
|
15537
|
-
}).where(
|
|
15961
|
+
}).where(eq31(users3.user_id, fullId)).run();
|
|
15538
15962
|
}
|
|
15539
15963
|
/**
|
|
15540
15964
|
* Delete a single credential field for a tool.
|
|
@@ -15560,7 +15984,7 @@ var UsersRepository = class {
|
|
|
15560
15984
|
await update(this.db, users3).set({
|
|
15561
15985
|
data: { ...row.data, agentic_tools: next },
|
|
15562
15986
|
updated_at: /* @__PURE__ */ new Date()
|
|
15563
|
-
}).where(
|
|
15987
|
+
}).where(eq31(users3.user_id, fullId)).run();
|
|
15564
15988
|
}
|
|
15565
15989
|
};
|
|
15566
15990
|
|
|
@@ -15604,7 +16028,7 @@ async function resolveApiKey(keyName, context = {}) {
|
|
|
15604
16028
|
);
|
|
15605
16029
|
if (context.userId && context.db) {
|
|
15606
16030
|
debugKeyResolution(` \u2192 Checking user-level configuration...`);
|
|
15607
|
-
const row = await select(context.db).from(users3).where(
|
|
16031
|
+
const row = await select(context.db).from(users3).where(eq32(users3.user_id, context.userId)).one();
|
|
15608
16032
|
if (row) {
|
|
15609
16033
|
const data = row.data;
|
|
15610
16034
|
let encryptedKey;
|
|
@@ -16309,8 +16733,8 @@ function getDefaultGitConfigParameters() {
|
|
|
16309
16733
|
}
|
|
16310
16734
|
function gitConfigParameterKey(pair) {
|
|
16311
16735
|
const trimmed = pair.trim();
|
|
16312
|
-
const
|
|
16313
|
-
return
|
|
16736
|
+
const eq33 = trimmed.indexOf("=");
|
|
16737
|
+
return eq33 >= 0 ? trimmed.slice(0, eq33) : trimmed;
|
|
16314
16738
|
}
|
|
16315
16739
|
function validateGitConfigParameterList(value, path3) {
|
|
16316
16740
|
if (value === void 0 || value === null) return void 0;
|
|
@@ -18036,11 +18460,6 @@ function buildMCPTemplateContextFromEnv(env) {
|
|
|
18036
18460
|
userEnv[key] = value;
|
|
18037
18461
|
}
|
|
18038
18462
|
}
|
|
18039
|
-
if (allowedKeys.size > 0) {
|
|
18040
|
-
console.log(
|
|
18041
|
-
` \u{1F510} MCP template context: ${allowedKeys.size} user env var(s) available for templates`
|
|
18042
|
-
);
|
|
18043
|
-
}
|
|
18044
18463
|
return {
|
|
18045
18464
|
user: {
|
|
18046
18465
|
env: userEnv
|
|
@@ -19964,6 +20383,30 @@ var UnixIntegrationService = class {
|
|
|
19964
20383
|
this.usersRepo = new UsersRepository(db);
|
|
19965
20384
|
this.repoRepo = new RepoRepository(db);
|
|
19966
20385
|
}
|
|
20386
|
+
async getUnixUsernamesForUsers(userIds) {
|
|
20387
|
+
const unixUsernames = /* @__PURE__ */ new Set();
|
|
20388
|
+
for (const userId of userIds) {
|
|
20389
|
+
const user = await this.usersRepo.findById(userId);
|
|
20390
|
+
if (user?.unix_username) {
|
|
20391
|
+
unixUsernames.add(user.unix_username);
|
|
20392
|
+
}
|
|
20393
|
+
}
|
|
20394
|
+
return unixUsernames;
|
|
20395
|
+
}
|
|
20396
|
+
async reconcileUnixGroupMembers(groupName, allowedUnixUsernames, options) {
|
|
20397
|
+
if (this.config.daemonUser) {
|
|
20398
|
+
allowedUnixUsernames.add(this.config.daemonUser);
|
|
20399
|
+
}
|
|
20400
|
+
const result = await this.executor.exec(UnixGroupCommands.listGroupMembers(groupName));
|
|
20401
|
+
const currentMembers = result.stdout.trim().split(",").filter(Boolean);
|
|
20402
|
+
for (const unixUsername of currentMembers) {
|
|
20403
|
+
if (allowedUnixUsernames.has(unixUsername)) continue;
|
|
20404
|
+
console.log(
|
|
20405
|
+
`[UnixIntegration] Removing stale ${options.label} group member ${unixUsername} from ${groupName}`
|
|
20406
|
+
);
|
|
20407
|
+
await this.executor.exec(UnixGroupCommands.removeUserFromGroup(unixUsername, groupName));
|
|
20408
|
+
}
|
|
20409
|
+
}
|
|
19967
20410
|
/**
|
|
19968
20411
|
* Get the configured daemon user
|
|
19969
20412
|
*
|
|
@@ -20207,19 +20650,26 @@ var UnixIntegrationService = class {
|
|
|
20207
20650
|
/**
|
|
20208
20651
|
* Initialize Unix group for an existing branch
|
|
20209
20652
|
*
|
|
20210
|
-
* Creates group and adds all
|
|
20653
|
+
* Creates group and adds all users with explicit filesystem access.
|
|
20211
20654
|
*
|
|
20212
20655
|
* @param branchId - Branch ID
|
|
20213
20656
|
*/
|
|
20214
20657
|
async initializeBranchGroup(branchId) {
|
|
20215
20658
|
const groupName = await this.createBranchGroup(branchId);
|
|
20216
|
-
const
|
|
20217
|
-
for (const
|
|
20218
|
-
await this.addUserToBranchGroup(branchId,
|
|
20659
|
+
const userIds = await this.branchRepo.findExplicitFsAccessUserIds(branchId);
|
|
20660
|
+
for (const userId of userIds) {
|
|
20661
|
+
await this.addUserToBranchGroup(branchId, userId);
|
|
20219
20662
|
}
|
|
20663
|
+
await this.reconcileUnixGroupMembers(groupName, await this.getUnixUsernamesForUsers(userIds), {
|
|
20664
|
+
label: "branch"
|
|
20665
|
+
});
|
|
20220
20666
|
console.log(
|
|
20221
|
-
`[UnixIntegration] Initialized group ${groupName} with ${
|
|
20667
|
+
`[UnixIntegration] Initialized group ${groupName} with ${userIds.length} explicit filesystem user(s)`
|
|
20222
20668
|
);
|
|
20669
|
+
const branch = await this.branchRepo.findById(branchId);
|
|
20670
|
+
if (branch?.repo_id) {
|
|
20671
|
+
await this.syncRepo(branch.repo_id);
|
|
20672
|
+
}
|
|
20223
20673
|
}
|
|
20224
20674
|
// ============================================================
|
|
20225
20675
|
// REPO GROUP MANAGEMENT
|
|
@@ -20451,8 +20901,8 @@ var UnixIntegrationService = class {
|
|
|
20451
20901
|
/**
|
|
20452
20902
|
* Check if a user should be in a repo's Unix group
|
|
20453
20903
|
*
|
|
20454
|
-
* A user should be in the repo group if they have
|
|
20455
|
-
*
|
|
20904
|
+
* A user should be in the repo group if they have explicit filesystem access
|
|
20905
|
+
* to ANY branch in that repo.
|
|
20456
20906
|
*
|
|
20457
20907
|
* @param repoId - Repo ID
|
|
20458
20908
|
* @param userId - User ID to check
|
|
@@ -20461,8 +20911,8 @@ var UnixIntegrationService = class {
|
|
|
20461
20911
|
async shouldUserBeInRepoGroup(repoId, userId) {
|
|
20462
20912
|
const branches4 = await this.branchRepo.findAll({ repo_id: repoId });
|
|
20463
20913
|
for (const wt of branches4) {
|
|
20464
|
-
const
|
|
20465
|
-
if (
|
|
20914
|
+
const userIds = await this.branchRepo.findExplicitFsAccessUserIds(wt.branch_id);
|
|
20915
|
+
if (userIds.includes(userId)) {
|
|
20466
20916
|
return true;
|
|
20467
20917
|
}
|
|
20468
20918
|
}
|
|
@@ -20471,33 +20921,36 @@ var UnixIntegrationService = class {
|
|
|
20471
20921
|
/**
|
|
20472
20922
|
* Initialize Unix group for an existing repo
|
|
20473
20923
|
*
|
|
20474
|
-
* Creates group, sets .git permissions, and adds all users who
|
|
20475
|
-
*
|
|
20924
|
+
* Creates group, sets .git permissions, and adds all users who have explicit
|
|
20925
|
+
* filesystem access to any branch in the repo.
|
|
20476
20926
|
*
|
|
20477
20927
|
* @param repoId - Repo ID
|
|
20478
20928
|
*/
|
|
20479
20929
|
async initializeRepoGroup(repoId) {
|
|
20480
20930
|
const groupName = await this.createRepoGroup(repoId);
|
|
20481
20931
|
const branches4 = await this.branchRepo.findAll({ repo_id: repoId });
|
|
20482
|
-
const
|
|
20932
|
+
const userIds = /* @__PURE__ */ new Set();
|
|
20483
20933
|
for (const wt of branches4) {
|
|
20484
|
-
const
|
|
20485
|
-
for (const
|
|
20486
|
-
|
|
20934
|
+
const branchUserIds = await this.branchRepo.findExplicitFsAccessUserIds(wt.branch_id);
|
|
20935
|
+
for (const userId of branchUserIds) {
|
|
20936
|
+
userIds.add(userId);
|
|
20487
20937
|
}
|
|
20488
20938
|
}
|
|
20489
|
-
for (const
|
|
20490
|
-
await this.addUserToRepoGroup(repoId,
|
|
20939
|
+
for (const userId of userIds) {
|
|
20940
|
+
await this.addUserToRepoGroup(repoId, userId);
|
|
20491
20941
|
}
|
|
20942
|
+
await this.reconcileUnixGroupMembers(groupName, await this.getUnixUsernamesForUsers(userIds), {
|
|
20943
|
+
label: "repo"
|
|
20944
|
+
});
|
|
20492
20945
|
console.log(
|
|
20493
|
-
`[UnixIntegration] Initialized repo group ${groupName} with ${
|
|
20946
|
+
`[UnixIntegration] Initialized repo group ${groupName} with ${userIds.size} unique filesystem user(s)`
|
|
20494
20947
|
);
|
|
20495
20948
|
}
|
|
20496
20949
|
/**
|
|
20497
20950
|
* Full sync for a repo
|
|
20498
20951
|
*
|
|
20499
20952
|
* Ensures repo group exists, .git permissions are set, and all
|
|
20500
|
-
* branch
|
|
20953
|
+
* branch filesystem-access users are in the repo group.
|
|
20501
20954
|
*
|
|
20502
20955
|
* @param repoId - Repo ID
|
|
20503
20956
|
*/
|
|
@@ -20505,15 +20958,23 @@ var UnixIntegrationService = class {
|
|
|
20505
20958
|
console.log(`[UnixIntegration] Full sync for repo ${shortId(repoId)}`);
|
|
20506
20959
|
await this.createRepoGroup(repoId);
|
|
20507
20960
|
const branches4 = await this.branchRepo.findAll({ repo_id: repoId });
|
|
20508
|
-
const
|
|
20961
|
+
const userIds = /* @__PURE__ */ new Set();
|
|
20509
20962
|
for (const wt of branches4) {
|
|
20510
|
-
const
|
|
20511
|
-
for (const
|
|
20512
|
-
|
|
20963
|
+
const branchUserIds = await this.branchRepo.findExplicitFsAccessUserIds(wt.branch_id);
|
|
20964
|
+
for (const userId of branchUserIds) {
|
|
20965
|
+
userIds.add(userId);
|
|
20513
20966
|
}
|
|
20514
20967
|
}
|
|
20515
|
-
for (const
|
|
20516
|
-
await this.addUserToRepoGroup(repoId,
|
|
20968
|
+
for (const userId of userIds) {
|
|
20969
|
+
await this.addUserToRepoGroup(repoId, userId);
|
|
20970
|
+
}
|
|
20971
|
+
const repo = await this.repoRepo.findById(repoId);
|
|
20972
|
+
if (repo?.unix_group) {
|
|
20973
|
+
await this.reconcileUnixGroupMembers(
|
|
20974
|
+
repo.unix_group,
|
|
20975
|
+
await this.getUnixUsernamesForUsers(userIds),
|
|
20976
|
+
{ label: "repo" }
|
|
20977
|
+
);
|
|
20517
20978
|
}
|
|
20518
20979
|
}
|
|
20519
20980
|
// ============================================================
|
|
@@ -20790,16 +21251,28 @@ var UnixIntegrationService = class {
|
|
|
20790
21251
|
/**
|
|
20791
21252
|
* Full sync for a branch
|
|
20792
21253
|
*
|
|
20793
|
-
* Ensures group exists, all
|
|
21254
|
+
* Ensures group exists, all explicit filesystem-access users are in group,
|
|
21255
|
+
* and symlinks are created.
|
|
20794
21256
|
*
|
|
20795
21257
|
* @param branchId - Branch ID
|
|
20796
21258
|
*/
|
|
20797
21259
|
async syncBranch(branchId) {
|
|
20798
21260
|
console.log(`[UnixIntegration] Full sync for branch ${shortId(branchId)}`);
|
|
20799
21261
|
await this.createBranchGroup(branchId);
|
|
20800
|
-
const
|
|
20801
|
-
for (const
|
|
20802
|
-
await this.addUserToBranchGroup(branchId,
|
|
21262
|
+
const userIds = await this.branchRepo.findExplicitFsAccessUserIds(branchId);
|
|
21263
|
+
for (const userId of userIds) {
|
|
21264
|
+
await this.addUserToBranchGroup(branchId, userId);
|
|
21265
|
+
}
|
|
21266
|
+
const branch = await this.branchRepo.findById(branchId);
|
|
21267
|
+
if (branch?.unix_group) {
|
|
21268
|
+
await this.reconcileUnixGroupMembers(
|
|
21269
|
+
branch.unix_group,
|
|
21270
|
+
await this.getUnixUsernamesForUsers(userIds),
|
|
21271
|
+
{ label: "branch" }
|
|
21272
|
+
);
|
|
21273
|
+
}
|
|
21274
|
+
if (branch?.repo_id) {
|
|
21275
|
+
await this.syncRepo(branch.repo_id);
|
|
20803
21276
|
}
|
|
20804
21277
|
}
|
|
20805
21278
|
/**
|
|
@@ -20954,6 +21427,8 @@ export {
|
|
|
20954
21427
|
ENV_COMMAND_DENY_PATTERNS,
|
|
20955
21428
|
ENV_VAR_CONSTRAINTS,
|
|
20956
21429
|
ENV_VAR_SCOPES_V05,
|
|
21430
|
+
EXECUTING_SESSION_STATUSES,
|
|
21431
|
+
EXECUTING_TASK_STATUSES,
|
|
20957
21432
|
EXECUTOR_HEARTBEAT_DEFAULT_CALLBACK_TIMEOUT_MS,
|
|
20958
21433
|
EXECUTOR_HEARTBEAT_DEFAULT_INTERVAL_MS,
|
|
20959
21434
|
EXECUTOR_HEARTBEAT_MIN_STALE_AFTER_MS,
|
|
@@ -21031,6 +21506,7 @@ export {
|
|
|
21031
21506
|
SerializedSessionRepository,
|
|
21032
21507
|
SessionEnvSelectionRepository,
|
|
21033
21508
|
SessionMCPServerRepository,
|
|
21509
|
+
SessionRelationshipRepository,
|
|
21034
21510
|
SessionRepository,
|
|
21035
21511
|
SessionStatus,
|
|
21036
21512
|
SudoCliExecutor,
|
|
@@ -21055,7 +21531,7 @@ export {
|
|
|
21055
21531
|
__resetConfigCacheForTests,
|
|
21056
21532
|
addSafeDirectoryBestEffort,
|
|
21057
21533
|
advisoryLockKeyForUuid,
|
|
21058
|
-
|
|
21534
|
+
and23 as and,
|
|
21059
21535
|
appVariables3 as appVariables,
|
|
21060
21536
|
applyKnowledgeEditOps,
|
|
21061
21537
|
artifactTrustGrants3 as artifactTrustGrants,
|
|
@@ -21127,7 +21603,7 @@ export {
|
|
|
21127
21603
|
enforcedAgentConfigSchema,
|
|
21128
21604
|
ensureBranchStorageModeAllowed,
|
|
21129
21605
|
ensureGitRemoteUrl,
|
|
21130
|
-
|
|
21606
|
+
eq32 as eq,
|
|
21131
21607
|
escapeShellArg,
|
|
21132
21608
|
executeAll,
|
|
21133
21609
|
executeGet,
|
|
@@ -21212,7 +21688,7 @@ export {
|
|
|
21212
21688
|
hasRemoteBranch,
|
|
21213
21689
|
hash,
|
|
21214
21690
|
identifyUrlParam,
|
|
21215
|
-
|
|
21691
|
+
inArray8 as inArray,
|
|
21216
21692
|
initConfig,
|
|
21217
21693
|
initializeDatabase,
|
|
21218
21694
|
insert,
|
|
@@ -21242,7 +21718,10 @@ export {
|
|
|
21242
21718
|
isServiceEnabled,
|
|
21243
21719
|
isServiceExternallyAccessible,
|
|
21244
21720
|
isServiceFullAccess,
|
|
21721
|
+
isSessionExecuting,
|
|
21722
|
+
isSessionPromptable,
|
|
21245
21723
|
isShortId,
|
|
21724
|
+
isTaskExecuting,
|
|
21246
21725
|
isTerminalTaskStatus,
|
|
21247
21726
|
isThreadRoot,
|
|
21248
21727
|
isUnixGroupRefreshNeeded,
|
|
@@ -21286,7 +21765,7 @@ export {
|
|
|
21286
21765
|
normalizeRole,
|
|
21287
21766
|
normalizeStoredEnvMap,
|
|
21288
21767
|
normalizeStoredEnvVar,
|
|
21289
|
-
|
|
21768
|
+
or9 as or,
|
|
21290
21769
|
parseAgorYml,
|
|
21291
21770
|
parseAgorYmlString,
|
|
21292
21771
|
parseBranchGroupName,
|
|
@@ -21347,15 +21826,17 @@ export {
|
|
|
21347
21826
|
seedInitialData,
|
|
21348
21827
|
select,
|
|
21349
21828
|
serializedSessions3 as serializedSessions,
|
|
21829
|
+
sessionCanStartTask,
|
|
21350
21830
|
sessionEnvSelections3 as sessionEnvSelections,
|
|
21351
21831
|
sessionMcpServers3 as sessionMcpServers,
|
|
21832
|
+
sessionRelationships3 as sessionRelationships,
|
|
21352
21833
|
sessions3 as sessions,
|
|
21353
21834
|
setConfigValue,
|
|
21354
21835
|
shortId,
|
|
21355
21836
|
simpleGit,
|
|
21356
21837
|
spawnEnvironmentCommand,
|
|
21357
21838
|
splitSecretEnv,
|
|
21358
|
-
|
|
21839
|
+
sql15 as sql,
|
|
21359
21840
|
stripGitUrlCredentials,
|
|
21360
21841
|
tasks3 as tasks,
|
|
21361
21842
|
threadSessionMap3 as threadSessionMap,
|