@rulemetric/cli 0.2.0 → 0.2.2
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/base-command.js +13 -52
- package/dist/base-command.js.map +7 -1
- package/dist/chunk-2AM54TUK.js +59 -0
- package/dist/chunk-2AM54TUK.js.map +7 -0
- package/dist/chunk-3TIMQ3O6.js +96 -0
- package/dist/chunk-3TIMQ3O6.js.map +7 -0
- package/dist/chunk-4BHDHHKL.js +48 -0
- package/dist/chunk-4BHDHHKL.js.map +7 -0
- package/dist/chunk-4D537GXE.js +99 -0
- package/dist/chunk-4D537GXE.js.map +7 -0
- package/dist/chunk-4SCZK7AL.js +129 -0
- package/dist/chunk-4SCZK7AL.js.map +7 -0
- package/dist/chunk-4WFE4PFP.js +61 -0
- package/dist/chunk-4WFE4PFP.js.map +7 -0
- package/dist/chunk-52WIYRZH.js +73 -0
- package/dist/chunk-52WIYRZH.js.map +7 -0
- package/dist/chunk-7FAA3YNB.js +1549 -0
- package/dist/chunk-7FAA3YNB.js.map +7 -0
- package/dist/chunk-7NYKWN7U.js +12 -0
- package/dist/chunk-7NYKWN7U.js.map +7 -0
- package/dist/chunk-AULP2OWH.js +99 -0
- package/dist/chunk-AULP2OWH.js.map +7 -0
- package/dist/chunk-B5KNTGMJ.js +1788 -0
- package/dist/chunk-B5KNTGMJ.js.map +7 -0
- package/dist/chunk-BD7CY42U.js +23 -0
- package/dist/chunk-BD7CY42U.js.map +7 -0
- package/dist/chunk-BO76WKJR.js +42 -0
- package/dist/chunk-BO76WKJR.js.map +7 -0
- package/dist/chunk-BRD5RUGM.js +53 -0
- package/dist/chunk-BRD5RUGM.js.map +7 -0
- package/dist/chunk-BT6Z6545.js +43 -0
- package/dist/chunk-BT6Z6545.js.map +7 -0
- package/dist/chunk-BZDKEQKU.js +39 -0
- package/dist/chunk-BZDKEQKU.js.map +7 -0
- package/dist/chunk-CROYS75W.js +161 -0
- package/dist/chunk-CROYS75W.js.map +7 -0
- package/dist/chunk-DGHWRQXL.js +17 -0
- package/dist/chunk-DGHWRQXL.js.map +7 -0
- package/dist/chunk-DQ3KELXD.js +74 -0
- package/dist/chunk-DQ3KELXD.js.map +7 -0
- package/dist/chunk-DTFXCHHI.js +108 -0
- package/dist/chunk-DTFXCHHI.js.map +7 -0
- package/dist/chunk-DU73QUS3.js +75 -0
- package/dist/chunk-DU73QUS3.js.map +7 -0
- package/dist/chunk-EHZJ6OXD.js +307 -0
- package/dist/chunk-EHZJ6OXD.js.map +7 -0
- package/dist/chunk-EJOI2ZGU.js +109 -0
- package/dist/chunk-EJOI2ZGU.js.map +7 -0
- package/dist/chunk-EKJ2CABV.js +76 -0
- package/dist/chunk-EKJ2CABV.js.map +7 -0
- package/dist/chunk-EKP32DLN.js +16 -0
- package/dist/chunk-EKP32DLN.js.map +7 -0
- package/dist/chunk-EOOP6WTC.js +148 -0
- package/dist/chunk-EOOP6WTC.js.map +7 -0
- package/dist/chunk-ERPMDAO3.js +20 -0
- package/dist/chunk-ERPMDAO3.js.map +7 -0
- package/dist/chunk-FTJRMUID.js +96 -0
- package/dist/chunk-FTJRMUID.js.map +7 -0
- package/dist/chunk-FZKLLNDS.js +228 -0
- package/dist/chunk-FZKLLNDS.js.map +7 -0
- package/dist/chunk-GQCISMAH.js +157 -0
- package/dist/chunk-GQCISMAH.js.map +7 -0
- package/dist/chunk-IGXX624H.js +55 -0
- package/dist/chunk-IGXX624H.js.map +7 -0
- package/dist/chunk-IJGF2ETG.js +68 -0
- package/dist/chunk-IJGF2ETG.js.map +7 -0
- package/dist/chunk-IWYCRLEK.js +220 -0
- package/dist/chunk-IWYCRLEK.js.map +7 -0
- package/dist/chunk-J7N3DLH6.js +117 -0
- package/dist/chunk-J7N3DLH6.js.map +7 -0
- package/dist/chunk-JX5UI6RW.js +99 -0
- package/dist/chunk-JX5UI6RW.js.map +7 -0
- package/dist/chunk-K3BFZ7KG.js +154 -0
- package/dist/chunk-K3BFZ7KG.js.map +7 -0
- package/dist/chunk-KHJUQFIK.js +51 -0
- package/dist/chunk-KHJUQFIK.js.map +7 -0
- package/dist/chunk-KRBQLMOP.js +41 -0
- package/dist/chunk-KRBQLMOP.js.map +7 -0
- package/dist/chunk-KZRFUXGF.js +145 -0
- package/dist/chunk-KZRFUXGF.js.map +7 -0
- package/dist/chunk-L674RNKQ.js +492 -0
- package/dist/chunk-L674RNKQ.js.map +7 -0
- package/dist/chunk-N52AHNBH.js +47 -0
- package/dist/chunk-N52AHNBH.js.map +7 -0
- package/dist/chunk-NIDLJO6F.js +228 -0
- package/dist/chunk-NIDLJO6F.js.map +7 -0
- package/dist/chunk-NSBPE2FW.js +17 -0
- package/dist/chunk-NSBPE2FW.js.map +7 -0
- package/dist/chunk-OGVORIFM.js +70 -0
- package/dist/chunk-OGVORIFM.js.map +7 -0
- package/dist/chunk-OQSQC7VB.js +77 -0
- package/dist/chunk-OQSQC7VB.js.map +7 -0
- package/dist/chunk-PHLMIZKM.js +153 -0
- package/dist/chunk-PHLMIZKM.js.map +7 -0
- package/dist/chunk-PQU7GZ7A.js +92 -0
- package/dist/chunk-PQU7GZ7A.js.map +7 -0
- package/dist/chunk-PXVQLD7S.js +196 -0
- package/dist/chunk-PXVQLD7S.js.map +7 -0
- package/dist/chunk-QD6X4L4L.js +79 -0
- package/dist/chunk-QD6X4L4L.js.map +7 -0
- package/dist/chunk-QJQS6TUN.js +44 -0
- package/dist/chunk-QJQS6TUN.js.map +7 -0
- package/dist/chunk-QJXAULRC.js +191 -0
- package/dist/chunk-QJXAULRC.js.map +7 -0
- package/dist/chunk-QN34TGD3.js +83 -0
- package/dist/chunk-QN34TGD3.js.map +7 -0
- package/dist/chunk-R5MFHGHR.js +122 -0
- package/dist/chunk-R5MFHGHR.js.map +7 -0
- package/dist/chunk-RH7NHVSK.js +16 -0
- package/dist/chunk-RH7NHVSK.js.map +7 -0
- package/dist/chunk-RJ7BHDLM.js +121 -0
- package/dist/chunk-RJ7BHDLM.js.map +7 -0
- package/dist/chunk-RQ2TMLKG.js +142 -0
- package/dist/chunk-RQ2TMLKG.js.map +7 -0
- package/dist/chunk-S56LOTGQ.js +63 -0
- package/dist/chunk-S56LOTGQ.js.map +7 -0
- package/dist/chunk-UF73WX2J.js +49 -0
- package/dist/chunk-UF73WX2J.js.map +7 -0
- package/dist/chunk-W53GKIZQ.js +50 -0
- package/dist/chunk-W53GKIZQ.js.map +7 -0
- package/dist/chunk-WA4MWYRW.js +254 -0
- package/dist/chunk-WA4MWYRW.js.map +7 -0
- package/dist/chunk-WFULKPEQ.js +269 -0
- package/dist/chunk-WFULKPEQ.js.map +7 -0
- package/dist/chunk-XC6M4CSW.js +44 -0
- package/dist/chunk-XC6M4CSW.js.map +7 -0
- package/dist/chunk-XPUEGHXN.js +243 -0
- package/dist/chunk-XPUEGHXN.js.map +7 -0
- package/dist/chunk-XZXS2W24.js +148 -0
- package/dist/chunk-XZXS2W24.js.map +7 -0
- package/dist/chunk-YBNW7ARH.js +167 -0
- package/dist/chunk-YBNW7ARH.js.map +7 -0
- package/dist/chunk-YNIH3KMU.js +121 -0
- package/dist/chunk-YNIH3KMU.js.map +7 -0
- package/dist/commands/antigravity/backfill.js +135 -0
- package/dist/commands/antigravity/backfill.js.map +7 -0
- package/dist/commands/auth/create-key.js +48 -33
- package/dist/commands/auth/create-key.js.map +7 -1
- package/dist/commands/auth/login.js +58 -46
- package/dist/commands/auth/login.js.map +7 -1
- package/dist/commands/auth/logout.js +28 -13
- package/dist/commands/auth/logout.js.map +7 -1
- package/dist/commands/auth/revoke-key.js +32 -18
- package/dist/commands/auth/revoke-key.js.map +7 -1
- package/dist/commands/auth/status.js +40 -22
- package/dist/commands/auth/status.js.map +7 -1
- package/dist/commands/catalog/index.js +50 -34
- package/dist/commands/catalog/index.js.map +7 -1
- package/dist/commands/catalog/recommend.js +41 -26
- package/dist/commands/catalog/recommend.js.map +7 -1
- package/dist/commands/convert.js +72 -54
- package/dist/commands/convert.js.map +7 -1
- package/dist/commands/converters.js +52 -38
- package/dist/commands/converters.js.map +7 -1
- package/dist/commands/crons/list.js +50 -24
- package/dist/commands/crons/list.js.map +7 -1
- package/dist/commands/crons/run.js +72 -47
- package/dist/commands/crons/run.js.map +7 -1
- package/dist/commands/dashboard.js +45 -24
- package/dist/commands/dashboard.js.map +7 -1
- package/dist/commands/eval-targets/create.js +51 -39
- package/dist/commands/eval-targets/create.js.map +7 -1
- package/dist/commands/eval-targets/list.js +52 -35
- package/dist/commands/eval-targets/list.js.map +7 -1
- package/dist/commands/evals/agent.js +292 -0
- package/dist/commands/evals/agent.js.map +7 -0
- package/dist/commands/evals/benchmark.js +70 -51
- package/dist/commands/evals/benchmark.js.map +7 -1
- package/dist/commands/evals/compare.js +90 -78
- package/dist/commands/evals/compare.js.map +7 -1
- package/dist/commands/evals/create.js +64 -50
- package/dist/commands/evals/create.js.map +7 -1
- package/dist/commands/evals/optimize-description.js +225 -222
- package/dist/commands/evals/optimize-description.js.map +7 -1
- package/dist/commands/evals/optimize.js +206 -196
- package/dist/commands/evals/optimize.js.map +7 -1
- package/dist/commands/evals/run.js +178 -164
- package/dist/commands/evals/run.js.map +7 -1
- package/dist/commands/gateway/ensure.js +33 -19
- package/dist/commands/gateway/ensure.js.map +7 -1
- package/dist/commands/hooks/install.js +335 -275
- package/dist/commands/hooks/install.js.map +7 -1
- package/dist/commands/hooks/run.js +72 -53
- package/dist/commands/hooks/run.js.map +7 -1
- package/dist/commands/hooks/uninstall.js +117 -94
- package/dist/commands/hooks/uninstall.js.map +7 -1
- package/dist/commands/import.js +63 -53
- package/dist/commands/import.js.map +7 -1
- package/dist/commands/instructions/create.js +71 -58
- package/dist/commands/instructions/create.js.map +7 -1
- package/dist/commands/instructions/delete.js +53 -36
- package/dist/commands/instructions/delete.js.map +7 -1
- package/dist/commands/instructions/fork.js +33 -19
- package/dist/commands/instructions/fork.js.map +7 -1
- package/dist/commands/instructions/get.js +66 -49
- package/dist/commands/instructions/get.js.map +7 -1
- package/dist/commands/instructions/list.js +63 -46
- package/dist/commands/instructions/list.js.map +7 -1
- package/dist/commands/instructions/promote.js +41 -27
- package/dist/commands/instructions/promote.js.map +7 -1
- package/dist/commands/instructions/pull.js +37 -21
- package/dist/commands/instructions/pull.js.map +7 -1
- package/dist/commands/instructions/upstream.js +36 -21
- package/dist/commands/instructions/upstream.js.map +7 -1
- package/dist/commands/instructions/versions.js +51 -33
- package/dist/commands/instructions/versions.js.map +7 -1
- package/dist/commands/launcher.js +39 -0
- package/dist/commands/launcher.js.map +7 -0
- package/dist/commands/org/current.js +74 -68
- package/dist/commands/org/current.js.map +7 -1
- package/dist/commands/org/list.js +50 -36
- package/dist/commands/org/list.js.map +7 -1
- package/dist/commands/org/switch.js +69 -51
- package/dist/commands/org/switch.js.map +7 -1
- package/dist/commands/packs/add-instruction.js +36 -22
- package/dist/commands/packs/add-instruction.js.map +7 -1
- package/dist/commands/packs/apply.js +38 -24
- package/dist/commands/packs/apply.js.map +7 -1
- package/dist/commands/packs/create.js +47 -33
- package/dist/commands/packs/create.js.map +7 -1
- package/dist/commands/packs/fork.js +33 -19
- package/dist/commands/packs/fork.js.map +7 -1
- package/dist/commands/packs/get.js +54 -35
- package/dist/commands/packs/get.js.map +7 -1
- package/dist/commands/packs/list.js +64 -47
- package/dist/commands/packs/list.js.map +7 -1
- package/dist/commands/packs/remove-instruction.js +34 -20
- package/dist/commands/packs/remove-instruction.js.map +7 -1
- package/dist/commands/proxy/env.js +126 -116
- package/dist/commands/proxy/env.js.map +7 -1
- package/dist/commands/proxy/logs.js +83 -74
- package/dist/commands/proxy/logs.js.map +7 -1
- package/dist/commands/proxy/restart.js +34 -36
- package/dist/commands/proxy/restart.js.map +7 -1
- package/dist/commands/proxy/setup.js +432 -375
- package/dist/commands/proxy/setup.js.map +7 -1
- package/dist/commands/proxy/start.js +289 -289
- package/dist/commands/proxy/start.js.map +7 -1
- package/dist/commands/proxy/status.js +74 -64
- package/dist/commands/proxy/status.js.map +7 -1
- package/dist/commands/proxy/stop.js +81 -75
- package/dist/commands/proxy/stop.js.map +7 -1
- package/dist/commands/research/backfill.js +58 -0
- package/dist/commands/research/backfill.js.map +7 -0
- package/dist/commands/research/tail-transcript.js +69 -0
- package/dist/commands/research/tail-transcript.js.map +7 -0
- package/dist/commands/service/install.js +639 -405
- package/dist/commands/service/install.js.map +7 -1
- package/dist/commands/service/status.js +178 -111
- package/dist/commands/service/status.js.map +7 -1
- package/dist/commands/service/uninstall.js +85 -110
- package/dist/commands/service/uninstall.js.map +7 -1
- package/dist/commands/sessions/analyze.js +46 -25
- package/dist/commands/sessions/analyze.js.map +7 -1
- package/dist/commands/sessions/end.js +81 -79
- package/dist/commands/sessions/end.js.map +7 -1
- package/dist/commands/sessions/import.js +44 -27
- package/dist/commands/sessions/import.js.map +7 -1
- package/dist/commands/sessions/list.js +46 -33
- package/dist/commands/sessions/list.js.map +7 -1
- package/dist/commands/sessions/start.js +88 -87
- package/dist/commands/sessions/start.js.map +7 -1
- package/dist/commands/signals/report.js +42 -34
- package/dist/commands/signals/report.js.map +7 -1
- package/dist/commands/skills/export-approved.js +44 -30
- package/dist/commands/skills/export-approved.js.map +7 -1
- package/dist/commands/skills/install.js +99 -84
- package/dist/commands/skills/install.js.map +7 -1
- package/dist/commands/skills/list.js +59 -42
- package/dist/commands/skills/list.js.map +7 -1
- package/dist/commands/skills/publish.js +95 -78
- package/dist/commands/skills/publish.js.map +7 -1
- package/dist/commands/skills/search.js +68 -53
- package/dist/commands/skills/search.js.map +7 -1
- package/dist/commands/skills/update.js +52 -39
- package/dist/commands/skills/update.js.map +7 -1
- package/dist/commands/suggestions/accept.js +82 -59
- package/dist/commands/suggestions/accept.js.map +7 -1
- package/dist/commands/suggestions/dismiss.js +44 -26
- package/dist/commands/suggestions/dismiss.js.map +7 -1
- package/dist/commands/suggestions/list.js +59 -39
- package/dist/commands/suggestions/list.js.map +7 -1
- package/dist/commands/suggestions/refresh.js +26 -11
- package/dist/commands/suggestions/refresh.js.map +7 -1
- package/dist/cursor-BGQJ4CWI.js +134 -0
- package/dist/cursor-BGQJ4CWI.js.map +7 -0
- package/dist/dashboard/Dashboard.js +229 -126
- package/dist/dashboard/Dashboard.js.map +7 -1
- package/dist/dashboard/data.js +13 -137
- package/dist/dashboard/data.js.map +7 -1
- package/dist/dashboard/launcher/ActiveJobsList.js +10 -0
- package/dist/dashboard/launcher/ActiveJobsList.js.map +7 -0
- package/dist/dashboard/launcher/LauncherOverlay.js +14 -0
- package/dist/dashboard/launcher/LauncherOverlay.js.map +7 -0
- package/dist/dashboard/launcher/NewLaunchForm.js +10 -0
- package/dist/dashboard/launcher/NewLaunchForm.js.map +7 -0
- package/dist/dashboard/launcher/api.js +14 -0
- package/dist/dashboard/launcher/api.js.map +7 -0
- package/dist/dashboard/launcher/tool-labels.js +10 -0
- package/dist/dashboard/launcher/tool-labels.js.map +7 -0
- package/dist/dashboard/launcher/types.js +1 -0
- package/dist/dashboard/launcher/types.js.map +7 -0
- package/dist/dashboard/launcher/useLaunchJobs.js +9 -0
- package/dist/dashboard/launcher/useLaunchJobs.js.map +7 -0
- package/dist/dashboard/panels/friction.js +10 -22
- package/dist/dashboard/panels/friction.js.map +7 -1
- package/dist/dashboard/panels/insights.js +10 -109
- package/dist/dashboard/panels/insights.js.map +7 -1
- package/dist/dashboard/panels/instructions.js +10 -17
- package/dist/dashboard/panels/instructions.js.map +7 -1
- package/dist/dashboard/panels/outcomes.js +9 -28
- package/dist/dashboard/panels/outcomes.js.map +7 -1
- package/dist/dashboard/panels/overview.js +10 -20
- package/dist/dashboard/panels/overview.js.map +7 -1
- package/dist/dashboard/panels/shared.js +18 -61
- package/dist/dashboard/panels/shared.js.map +7 -1
- package/dist/dashboard/types.js +23 -26
- package/dist/dashboard/types.js.map +7 -1
- package/dist/dist-CSUYFYKI.js +52 -0
- package/dist/dist-CSUYFYKI.js.map +7 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +7 -1
- package/dist/lib/active-org-refresh.js +15 -108
- package/dist/lib/active-org-refresh.js.map +7 -1
- package/dist/lib/active-org.js +15 -95
- package/dist/lib/active-org.js.map +7 -1
- package/dist/lib/agent-loop.js +44 -0
- package/dist/lib/agent-loop.js.map +7 -0
- package/dist/lib/antigravity-transcript.js +22 -0
- package/dist/lib/antigravity-transcript.js.map +7 -0
- package/dist/lib/api-client.js +21 -92
- package/dist/lib/api-client.js.map +7 -1
- package/dist/lib/auth.js +26 -137
- package/dist/lib/auth.js.map +7 -1
- package/dist/lib/detect-languages.js +8 -113
- package/dist/lib/detect-languages.js.map +7 -1
- package/dist/lib/detect-tmux.js +9 -0
- package/dist/lib/detect-tmux.js.map +7 -0
- package/dist/lib/eval-analyzer.js +9 -89
- package/dist/lib/eval-analyzer.js.map +7 -1
- package/dist/lib/eval-benchmark.js +12 -92
- package/dist/lib/eval-benchmark.js.map +7 -1
- package/dist/lib/eval-conversation-handler.js +13 -200
- package/dist/lib/eval-conversation-handler.js.map +7 -1
- package/dist/lib/eval-executor.js +8 -83
- package/dist/lib/eval-executor.js.map +7 -1
- package/dist/lib/eval-grader.js +9 -123
- package/dist/lib/eval-grader.js.map +7 -1
- package/dist/lib/eval-meta-judge.js +9 -116
- package/dist/lib/eval-meta-judge.js.map +7 -1
- package/dist/lib/eval-trigger-tester.js +11 -96
- package/dist/lib/eval-trigger-tester.js.map +7 -1
- package/dist/lib/eval-worktree.js +8 -87
- package/dist/lib/eval-worktree.js.map +7 -1
- package/dist/lib/gateway-entry.js +20 -18
- package/dist/lib/gateway-entry.js.map +7 -1
- package/dist/lib/gateway-lifecycle.js +22 -97
- package/dist/lib/gateway-lifecycle.js.map +7 -1
- package/dist/lib/gateway.js +12 -216
- package/dist/lib/gateway.js.map +7 -1
- package/dist/lib/handlers/cron-close-stale-sessions.js +18 -7
- package/dist/lib/handlers/cron-close-stale-sessions.js.map +7 -1
- package/dist/lib/handlers/cron-data-integrity-audit.js +21 -15
- package/dist/lib/handlers/cron-data-integrity-audit.js.map +7 -1
- package/dist/lib/handlers/cron-refresh-skills.js +7 -90
- package/dist/lib/handlers/cron-refresh-skills.js.map +7 -1
- package/dist/lib/handlers/cron-suggest-instructions.js +14 -158
- package/dist/lib/handlers/cron-suggest-instructions.js.map +7 -1
- package/dist/lib/handlers/process-announcement.js +11 -0
- package/dist/lib/handlers/process-announcement.js.map +7 -0
- package/dist/lib/handlers/process-changelog.js +11 -0
- package/dist/lib/handlers/process-changelog.js.map +7 -0
- package/dist/lib/handlers/process-conversation.js +14 -35
- package/dist/lib/handlers/process-conversation.js.map +7 -1
- package/dist/lib/handlers/process-eval.js +15 -207
- package/dist/lib/handlers/process-eval.js.map +7 -1
- package/dist/lib/handlers/process-insights.js +14 -300
- package/dist/lib/handlers/process-insights.js.map +7 -1
- package/dist/lib/handlers/process-launch.js +16 -41
- package/dist/lib/handlers/process-launch.js.map +7 -1
- package/dist/lib/handlers/process-run-cleanup.js +13 -0
- package/dist/lib/handlers/process-run-cleanup.js.map +7 -0
- package/dist/lib/handlers/process-send-message.js +10 -0
- package/dist/lib/handlers/process-send-message.js.map +7 -0
- package/dist/lib/handlers/process-session-goal.js +11 -0
- package/dist/lib/handlers/process-session-goal.js.map +7 -0
- package/dist/lib/hooks-config.js +52 -544
- package/dist/lib/hooks-config.js.map +7 -1
- package/dist/lib/insights-prompts.js +12 -145
- package/dist/lib/insights-prompts.js.map +7 -1
- package/dist/lib/job-helpers.js +1 -0
- package/dist/lib/job-helpers.js.map +7 -0
- package/dist/lib/llm-client.js +16 -274
- package/dist/lib/llm-client.js.map +7 -1
- package/dist/lib/manual-tasks.js +22 -0
- package/dist/lib/manual-tasks.js.map +7 -0
- package/dist/lib/output.js +12 -36
- package/dist/lib/output.js.map +7 -1
- package/dist/lib/permanent-job-error.js +10 -23
- package/dist/lib/permanent-job-error.js.map +7 -1
- package/dist/lib/provider-aggregator.js +57 -55
- package/dist/lib/provider-aggregator.js.map +7 -1
- package/dist/lib/research-client.js +12 -0
- package/dist/lib/research-client.js.map +7 -0
- package/dist/lib/skills-loader.js +8 -51
- package/dist/lib/skills-loader.js.map +7 -1
- package/dist/lib/statusline-shim.js +16 -0
- package/dist/lib/statusline-shim.js.map +7 -0
- package/dist/lib/terminal-target-heartbeat.js +15 -0
- package/dist/lib/terminal-target-heartbeat.js.map +7 -0
- package/dist/lib/tmux.js +16 -0
- package/dist/lib/tmux.js.map +7 -0
- package/dist/lib/transcript-rate-limit-watcher.js +22 -0
- package/dist/lib/transcript-rate-limit-watcher.js.map +7 -0
- package/dist/lib/types.js +8 -7
- package/dist/lib/types.js.map +7 -1
- package/dist/lib/version-check.js +10 -106
- package/dist/lib/version-check.js.map +7 -1
- package/dist/lib/which.js +8 -0
- package/dist/lib/which.js.map +7 -0
- package/dist/lib/worktree.js +17 -0
- package/dist/lib/worktree.js.map +7 -0
- package/dist/opencode-IQ7X5YMJ.js +190 -0
- package/dist/opencode-IQ7X5YMJ.js.map +7 -0
- package/oclif.manifest.json +299 -66
- package/package.json +28 -10
- package/dist/base-command.d.ts +0 -12
- package/dist/base-command.d.ts.map +0 -1
- package/dist/commands/auth/create-key.d.ts +0 -11
- package/dist/commands/auth/create-key.d.ts.map +0 -1
- package/dist/commands/auth/login.d.ts +0 -11
- package/dist/commands/auth/login.d.ts.map +0 -1
- package/dist/commands/auth/logout.d.ts +0 -7
- package/dist/commands/auth/logout.d.ts.map +0 -1
- package/dist/commands/auth/revoke-key.d.ts +0 -10
- package/dist/commands/auth/revoke-key.d.ts.map +0 -1
- package/dist/commands/auth/status.d.ts +0 -7
- package/dist/commands/auth/status.d.ts.map +0 -1
- package/dist/commands/catalog/index.d.ts +0 -11
- package/dist/commands/catalog/index.d.ts.map +0 -1
- package/dist/commands/catalog/recommend.d.ts +0 -9
- package/dist/commands/catalog/recommend.d.ts.map +0 -1
- package/dist/commands/convert.d.ts +0 -15
- package/dist/commands/convert.d.ts.map +0 -1
- package/dist/commands/converters.d.ts +0 -12
- package/dist/commands/converters.d.ts.map +0 -1
- package/dist/commands/crons/list.d.ts +0 -7
- package/dist/commands/crons/list.d.ts.map +0 -1
- package/dist/commands/crons/run.d.ts +0 -13
- package/dist/commands/crons/run.d.ts.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -10
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/commands/eval-targets/create.d.ts +0 -14
- package/dist/commands/eval-targets/create.d.ts.map +0 -1
- package/dist/commands/eval-targets/list.d.ts +0 -10
- package/dist/commands/eval-targets/list.d.ts.map +0 -1
- package/dist/commands/evals/benchmark.d.ts +0 -13
- package/dist/commands/evals/benchmark.d.ts.map +0 -1
- package/dist/commands/evals/compare.d.ts +0 -15
- package/dist/commands/evals/compare.d.ts.map +0 -1
- package/dist/commands/evals/create.d.ts +0 -17
- package/dist/commands/evals/create.d.ts.map +0 -1
- package/dist/commands/evals/listen.d.ts +0 -37
- package/dist/commands/evals/listen.d.ts.map +0 -1
- package/dist/commands/evals/listen.js +0 -188
- package/dist/commands/evals/listen.js.map +0 -1
- package/dist/commands/evals/listen.test.d.ts +0 -2
- package/dist/commands/evals/listen.test.d.ts.map +0 -1
- package/dist/commands/evals/listen.test.js +0 -48
- package/dist/commands/evals/listen.test.js.map +0 -1
- package/dist/commands/evals/optimize-description.d.ts +0 -22
- package/dist/commands/evals/optimize-description.d.ts.map +0 -1
- package/dist/commands/evals/optimize.d.ts +0 -22
- package/dist/commands/evals/optimize.d.ts.map +0 -1
- package/dist/commands/evals/run.d.ts +0 -21
- package/dist/commands/evals/run.d.ts.map +0 -1
- package/dist/commands/gateway/ensure.d.ts +0 -7
- package/dist/commands/gateway/ensure.d.ts.map +0 -1
- package/dist/commands/hooks/install.d.ts +0 -16
- package/dist/commands/hooks/install.d.ts.map +0 -1
- package/dist/commands/hooks/run.d.ts +0 -11
- package/dist/commands/hooks/run.d.ts.map +0 -1
- package/dist/commands/hooks/uninstall.d.ts +0 -7
- package/dist/commands/hooks/uninstall.d.ts.map +0 -1
- package/dist/commands/import.d.ts +0 -17
- package/dist/commands/import.d.ts.map +0 -1
- package/dist/commands/instructions/create.d.ts +0 -17
- package/dist/commands/instructions/create.d.ts.map +0 -1
- package/dist/commands/instructions/delete.d.ts +0 -13
- package/dist/commands/instructions/delete.d.ts.map +0 -1
- package/dist/commands/instructions/fork.d.ts +0 -10
- package/dist/commands/instructions/fork.d.ts.map +0 -1
- package/dist/commands/instructions/get.d.ts +0 -15
- package/dist/commands/instructions/get.d.ts.map +0 -1
- package/dist/commands/instructions/list.d.ts +0 -12
- package/dist/commands/instructions/list.d.ts.map +0 -1
- package/dist/commands/instructions/promote.d.ts +0 -14
- package/dist/commands/instructions/promote.d.ts.map +0 -1
- package/dist/commands/instructions/pull.d.ts +0 -9
- package/dist/commands/instructions/pull.d.ts.map +0 -1
- package/dist/commands/instructions/upstream.d.ts +0 -9
- package/dist/commands/instructions/upstream.d.ts.map +0 -1
- package/dist/commands/instructions/versions.d.ts +0 -12
- package/dist/commands/instructions/versions.d.ts.map +0 -1
- package/dist/commands/org/current.d.ts +0 -7
- package/dist/commands/org/current.d.ts.map +0 -1
- package/dist/commands/org/list.d.ts +0 -7
- package/dist/commands/org/list.d.ts.map +0 -1
- package/dist/commands/org/switch.d.ts +0 -13
- package/dist/commands/org/switch.d.ts.map +0 -1
- package/dist/commands/packs/add-instruction.d.ts +0 -11
- package/dist/commands/packs/add-instruction.d.ts.map +0 -1
- package/dist/commands/packs/apply.d.ts +0 -13
- package/dist/commands/packs/apply.d.ts.map +0 -1
- package/dist/commands/packs/create.d.ts +0 -13
- package/dist/commands/packs/create.d.ts.map +0 -1
- package/dist/commands/packs/fork.d.ts +0 -10
- package/dist/commands/packs/fork.d.ts.map +0 -1
- package/dist/commands/packs/get.d.ts +0 -10
- package/dist/commands/packs/get.d.ts.map +0 -1
- package/dist/commands/packs/list.d.ts +0 -22
- package/dist/commands/packs/list.d.ts.map +0 -1
- package/dist/commands/packs/remove-instruction.d.ts +0 -11
- package/dist/commands/packs/remove-instruction.d.ts.map +0 -1
- package/dist/commands/proxy/env.d.ts +0 -14
- package/dist/commands/proxy/env.d.ts.map +0 -1
- package/dist/commands/proxy/logs.d.ts +0 -11
- package/dist/commands/proxy/logs.d.ts.map +0 -1
- package/dist/commands/proxy/restart.d.ts +0 -11
- package/dist/commands/proxy/restart.d.ts.map +0 -1
- package/dist/commands/proxy/setup.d.ts +0 -23
- package/dist/commands/proxy/setup.d.ts.map +0 -1
- package/dist/commands/proxy/start.d.ts +0 -17
- package/dist/commands/proxy/start.d.ts.map +0 -1
- package/dist/commands/proxy/status.d.ts +0 -7
- package/dist/commands/proxy/status.d.ts.map +0 -1
- package/dist/commands/proxy/stop.d.ts +0 -8
- package/dist/commands/proxy/stop.d.ts.map +0 -1
- package/dist/commands/service/install.d.ts +0 -33
- package/dist/commands/service/install.d.ts.map +0 -1
- package/dist/commands/service/install.test.d.ts +0 -2
- package/dist/commands/service/install.test.d.ts.map +0 -1
- package/dist/commands/service/install.test.js +0 -345
- package/dist/commands/service/install.test.js.map +0 -1
- package/dist/commands/service/status.d.ts +0 -6
- package/dist/commands/service/status.d.ts.map +0 -1
- package/dist/commands/service/uninstall.d.ts +0 -6
- package/dist/commands/service/uninstall.d.ts.map +0 -1
- package/dist/commands/sessions/analyze.d.ts +0 -10
- package/dist/commands/sessions/analyze.d.ts.map +0 -1
- package/dist/commands/sessions/end.d.ts +0 -9
- package/dist/commands/sessions/end.d.ts.map +0 -1
- package/dist/commands/sessions/import.d.ts +0 -13
- package/dist/commands/sessions/import.d.ts.map +0 -1
- package/dist/commands/sessions/list.d.ts +0 -11
- package/dist/commands/sessions/list.d.ts.map +0 -1
- package/dist/commands/sessions/start.d.ts +0 -11
- package/dist/commands/sessions/start.d.ts.map +0 -1
- package/dist/commands/signals/report.d.ts +0 -10
- package/dist/commands/signals/report.d.ts.map +0 -1
- package/dist/commands/signals/report.test.d.ts +0 -2
- package/dist/commands/signals/report.test.d.ts.map +0 -1
- package/dist/commands/signals/report.test.js +0 -65
- package/dist/commands/signals/report.test.js.map +0 -1
- package/dist/commands/skills/export-approved.d.ts +0 -10
- package/dist/commands/skills/export-approved.d.ts.map +0 -1
- package/dist/commands/skills/install.d.ts +0 -15
- package/dist/commands/skills/install.d.ts.map +0 -1
- package/dist/commands/skills/list.d.ts +0 -11
- package/dist/commands/skills/list.d.ts.map +0 -1
- package/dist/commands/skills/publish.d.ts +0 -17
- package/dist/commands/skills/publish.d.ts.map +0 -1
- package/dist/commands/skills/search.d.ts +0 -17
- package/dist/commands/skills/search.d.ts.map +0 -1
- package/dist/commands/skills/update.d.ts +0 -10
- package/dist/commands/skills/update.d.ts.map +0 -1
- package/dist/commands/suggestions/accept.d.ts +0 -16
- package/dist/commands/suggestions/accept.d.ts.map +0 -1
- package/dist/commands/suggestions/accept.test.d.ts +0 -2
- package/dist/commands/suggestions/accept.test.d.ts.map +0 -1
- package/dist/commands/suggestions/accept.test.js +0 -52
- package/dist/commands/suggestions/accept.test.js.map +0 -1
- package/dist/commands/suggestions/dismiss.d.ts +0 -10
- package/dist/commands/suggestions/dismiss.d.ts.map +0 -1
- package/dist/commands/suggestions/list.d.ts +0 -10
- package/dist/commands/suggestions/list.d.ts.map +0 -1
- package/dist/commands/suggestions/refresh.d.ts +0 -7
- package/dist/commands/suggestions/refresh.d.ts.map +0 -1
- package/dist/dashboard/Dashboard.d.ts +0 -3
- package/dist/dashboard/Dashboard.d.ts.map +0 -1
- package/dist/dashboard/data.d.ts +0 -11
- package/dist/dashboard/data.d.ts.map +0 -1
- package/dist/dashboard/panels/friction.d.ts +0 -7
- package/dist/dashboard/panels/friction.d.ts.map +0 -1
- package/dist/dashboard/panels/insights.d.ts +0 -8
- package/dist/dashboard/panels/insights.d.ts.map +0 -1
- package/dist/dashboard/panels/instructions.d.ts +0 -9
- package/dist/dashboard/panels/instructions.d.ts.map +0 -1
- package/dist/dashboard/panels/outcomes.d.ts +0 -7
- package/dist/dashboard/panels/outcomes.d.ts.map +0 -1
- package/dist/dashboard/panels/overview.d.ts +0 -8
- package/dist/dashboard/panels/overview.d.ts.map +0 -1
- package/dist/dashboard/panels/shared.d.ts +0 -17
- package/dist/dashboard/panels/shared.d.ts.map +0 -1
- package/dist/dashboard/types.d.ts +0 -80
- package/dist/dashboard/types.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/active-org-refresh.d.ts +0 -22
- package/dist/lib/active-org-refresh.d.ts.map +0 -1
- package/dist/lib/active-org-refresh.test.d.ts +0 -2
- package/dist/lib/active-org-refresh.test.d.ts.map +0 -1
- package/dist/lib/active-org-refresh.test.js +0 -190
- package/dist/lib/active-org-refresh.test.js.map +0 -1
- package/dist/lib/active-org.d.ts +0 -43
- package/dist/lib/active-org.d.ts.map +0 -1
- package/dist/lib/active-org.test.d.ts +0 -2
- package/dist/lib/active-org.test.d.ts.map +0 -1
- package/dist/lib/active-org.test.js +0 -147
- package/dist/lib/active-org.test.js.map +0 -1
- package/dist/lib/api-client.d.ts +0 -17
- package/dist/lib/api-client.d.ts.map +0 -1
- package/dist/lib/api-client.test.d.ts +0 -2
- package/dist/lib/api-client.test.d.ts.map +0 -1
- package/dist/lib/api-client.test.js +0 -161
- package/dist/lib/api-client.test.js.map +0 -1
- package/dist/lib/auth.d.ts +0 -27
- package/dist/lib/auth.d.ts.map +0 -1
- package/dist/lib/auth.test.d.ts +0 -2
- package/dist/lib/auth.test.d.ts.map +0 -1
- package/dist/lib/auth.test.js +0 -110
- package/dist/lib/auth.test.js.map +0 -1
- package/dist/lib/cron-registry.d.ts +0 -47
- package/dist/lib/cron-registry.d.ts.map +0 -1
- package/dist/lib/cron-registry.js +0 -102
- package/dist/lib/cron-registry.js.map +0 -1
- package/dist/lib/cron-registry.test.d.ts +0 -2
- package/dist/lib/cron-registry.test.d.ts.map +0 -1
- package/dist/lib/cron-registry.test.js +0 -136
- package/dist/lib/cron-registry.test.js.map +0 -1
- package/dist/lib/cron-runner.d.ts +0 -16
- package/dist/lib/cron-runner.d.ts.map +0 -1
- package/dist/lib/cron-runner.js +0 -68
- package/dist/lib/cron-runner.js.map +0 -1
- package/dist/lib/detect-languages.d.ts +0 -7
- package/dist/lib/detect-languages.d.ts.map +0 -1
- package/dist/lib/detect-languages.test.d.ts +0 -2
- package/dist/lib/detect-languages.test.d.ts.map +0 -1
- package/dist/lib/detect-languages.test.js +0 -29
- package/dist/lib/detect-languages.test.js.map +0 -1
- package/dist/lib/eval-analyzer.d.ts +0 -23
- package/dist/lib/eval-analyzer.d.ts.map +0 -1
- package/dist/lib/eval-benchmark.d.ts +0 -17
- package/dist/lib/eval-benchmark.d.ts.map +0 -1
- package/dist/lib/eval-conversation-handler.d.ts +0 -9
- package/dist/lib/eval-conversation-handler.d.ts.map +0 -1
- package/dist/lib/eval-executor.d.ts +0 -21
- package/dist/lib/eval-executor.d.ts.map +0 -1
- package/dist/lib/eval-executor.test.d.ts +0 -2
- package/dist/lib/eval-executor.test.d.ts.map +0 -1
- package/dist/lib/eval-executor.test.js +0 -8
- package/dist/lib/eval-executor.test.js.map +0 -1
- package/dist/lib/eval-grader.d.ts +0 -38
- package/dist/lib/eval-grader.d.ts.map +0 -1
- package/dist/lib/eval-grader.test.d.ts +0 -2
- package/dist/lib/eval-grader.test.d.ts.map +0 -1
- package/dist/lib/eval-grader.test.js +0 -8
- package/dist/lib/eval-grader.test.js.map +0 -1
- package/dist/lib/eval-meta-judge.d.ts +0 -28
- package/dist/lib/eval-meta-judge.d.ts.map +0 -1
- package/dist/lib/eval-trigger-tester.d.ts +0 -19
- package/dist/lib/eval-trigger-tester.d.ts.map +0 -1
- package/dist/lib/eval-worktree.d.ts +0 -11
- package/dist/lib/eval-worktree.d.ts.map +0 -1
- package/dist/lib/eval-worktree.test.d.ts +0 -2
- package/dist/lib/eval-worktree.test.d.ts.map +0 -1
- package/dist/lib/eval-worktree.test.js +0 -68
- package/dist/lib/eval-worktree.test.js.map +0 -1
- package/dist/lib/gateway-entry.d.ts +0 -3
- package/dist/lib/gateway-entry.d.ts.map +0 -1
- package/dist/lib/gateway-lifecycle.d.ts +0 -9
- package/dist/lib/gateway-lifecycle.d.ts.map +0 -1
- package/dist/lib/gateway.d.ts +0 -11
- package/dist/lib/gateway.d.ts.map +0 -1
- package/dist/lib/graphile-worker-runner.d.ts +0 -124
- package/dist/lib/graphile-worker-runner.d.ts.map +0 -1
- package/dist/lib/graphile-worker-runner.js +0 -526
- package/dist/lib/graphile-worker-runner.js.map +0 -1
- package/dist/lib/graphile-worker-runner.test.d.ts +0 -2
- package/dist/lib/graphile-worker-runner.test.d.ts.map +0 -1
- package/dist/lib/graphile-worker-runner.test.js +0 -153
- package/dist/lib/graphile-worker-runner.test.js.map +0 -1
- package/dist/lib/handlers/cron-close-stale-sessions.d.ts +0 -3
- package/dist/lib/handlers/cron-close-stale-sessions.d.ts.map +0 -1
- package/dist/lib/handlers/cron-data-integrity-audit.d.ts +0 -3
- package/dist/lib/handlers/cron-data-integrity-audit.d.ts.map +0 -1
- package/dist/lib/handlers/cron-refresh-skills.d.ts +0 -3
- package/dist/lib/handlers/cron-refresh-skills.d.ts.map +0 -1
- package/dist/lib/handlers/cron-refresh-skills.test.d.ts +0 -2
- package/dist/lib/handlers/cron-refresh-skills.test.d.ts.map +0 -1
- package/dist/lib/handlers/cron-refresh-skills.test.js +0 -114
- package/dist/lib/handlers/cron-refresh-skills.test.js.map +0 -1
- package/dist/lib/handlers/cron-regenerate-insights.d.ts +0 -3
- package/dist/lib/handlers/cron-regenerate-insights.d.ts.map +0 -1
- package/dist/lib/handlers/cron-regenerate-insights.js +0 -6
- package/dist/lib/handlers/cron-regenerate-insights.js.map +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.d.ts +0 -3
- package/dist/lib/handlers/cron-suggest-instructions.d.ts.map +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.test.d.ts +0 -2
- package/dist/lib/handlers/cron-suggest-instructions.test.d.ts.map +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.test.js +0 -80
- package/dist/lib/handlers/cron-suggest-instructions.test.js.map +0 -1
- package/dist/lib/handlers/process-conversation.d.ts +0 -35
- package/dist/lib/handlers/process-conversation.d.ts.map +0 -1
- package/dist/lib/handlers/process-eval.d.ts +0 -32
- package/dist/lib/handlers/process-eval.d.ts.map +0 -1
- package/dist/lib/handlers/process-insights.d.ts +0 -39
- package/dist/lib/handlers/process-insights.d.ts.map +0 -1
- package/dist/lib/handlers/process-launch.d.ts +0 -29
- package/dist/lib/handlers/process-launch.d.ts.map +0 -1
- package/dist/lib/hooks-config.d.ts +0 -119
- package/dist/lib/hooks-config.d.ts.map +0 -1
- package/dist/lib/hooks-config.test.d.ts +0 -2
- package/dist/lib/hooks-config.test.d.ts.map +0 -1
- package/dist/lib/hooks-config.test.js +0 -231
- package/dist/lib/hooks-config.test.js.map +0 -1
- package/dist/lib/insights-prompts.d.ts +0 -13
- package/dist/lib/insights-prompts.d.ts.map +0 -1
- package/dist/lib/llm-client.d.ts +0 -26
- package/dist/lib/llm-client.d.ts.map +0 -1
- package/dist/lib/llm-client.test.d.ts +0 -2
- package/dist/lib/llm-client.test.d.ts.map +0 -1
- package/dist/lib/llm-client.test.js +0 -62
- package/dist/lib/llm-client.test.js.map +0 -1
- package/dist/lib/mirror-writer-db.d.ts +0 -12
- package/dist/lib/mirror-writer-db.d.ts.map +0 -1
- package/dist/lib/mirror-writer-db.js +0 -51
- package/dist/lib/mirror-writer-db.js.map +0 -1
- package/dist/lib/mirror-writer.d.ts +0 -35
- package/dist/lib/mirror-writer.d.ts.map +0 -1
- package/dist/lib/mirror-writer.js +0 -27
- package/dist/lib/mirror-writer.js.map +0 -1
- package/dist/lib/mirror-writer.test.d.ts +0 -2
- package/dist/lib/mirror-writer.test.d.ts.map +0 -1
- package/dist/lib/mirror-writer.test.js +0 -47
- package/dist/lib/mirror-writer.test.js.map +0 -1
- package/dist/lib/output.d.ts +0 -4
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.test.d.ts +0 -2
- package/dist/lib/output.test.d.ts.map +0 -1
- package/dist/lib/output.test.js +0 -71
- package/dist/lib/output.test.js.map +0 -1
- package/dist/lib/permanent-job-error.d.ts +0 -17
- package/dist/lib/permanent-job-error.d.ts.map +0 -1
- package/dist/lib/permanent-job-error.test.d.ts +0 -2
- package/dist/lib/permanent-job-error.test.d.ts.map +0 -1
- package/dist/lib/permanent-job-error.test.js +0 -29
- package/dist/lib/permanent-job-error.test.js.map +0 -1
- package/dist/lib/provider-aggregator.d.ts +0 -24
- package/dist/lib/provider-aggregator.d.ts.map +0 -1
- package/dist/lib/provider-aggregator.test.d.ts +0 -2
- package/dist/lib/provider-aggregator.test.d.ts.map +0 -1
- package/dist/lib/provider-aggregator.test.js +0 -103
- package/dist/lib/provider-aggregator.test.js.map +0 -1
- package/dist/lib/skills-loader.d.ts +0 -6
- package/dist/lib/skills-loader.d.ts.map +0 -1
- package/dist/lib/types.d.ts +0 -48
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/version-check.d.ts +0 -11
- package/dist/lib/version-check.d.ts.map +0 -1
- package/dist/test-helpers.d.ts +0 -58
- package/dist/test-helpers.d.ts.map +0 -1
- package/dist/test-helpers.js +0 -58
- package/dist/test-helpers.js.map +0 -1
|
@@ -0,0 +1,1549 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-NSBPE2FW.js";
|
|
4
|
+
|
|
5
|
+
// ../../packages/db/dist/schema/tables/profiles.js
|
|
6
|
+
import { boolean, pgTable as pgTable2, text as text2, timestamp as timestamp2, uuid as uuid2 } from "drizzle-orm/pg-core";
|
|
7
|
+
|
|
8
|
+
// ../../packages/db/dist/schema/tables/organizations.js
|
|
9
|
+
import { pgTable, text, timestamp, jsonb, uuid, primaryKey } from "drizzle-orm/pg-core";
|
|
10
|
+
var organizations = pgTable("organizations", {
|
|
11
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
12
|
+
name: text("name").unique().notNull(),
|
|
13
|
+
slug: text("slug").unique().notNull(),
|
|
14
|
+
metadata: jsonb("metadata"),
|
|
15
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
16
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow()
|
|
17
|
+
});
|
|
18
|
+
var teams = pgTable("teams", {
|
|
19
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
20
|
+
orgId: uuid("org_id").references(() => organizations.id, { onDelete: "cascade" }),
|
|
21
|
+
name: text("name").notNull(),
|
|
22
|
+
slug: text("slug").notNull(),
|
|
23
|
+
metadata: jsonb("metadata"),
|
|
24
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow()
|
|
25
|
+
});
|
|
26
|
+
var userOrganizations = pgTable("user_organizations", {
|
|
27
|
+
userId: uuid("user_id").notNull(),
|
|
28
|
+
orgId: uuid("org_id").references(() => organizations.id, { onDelete: "cascade" }).notNull(),
|
|
29
|
+
role: text("role").notNull().default("member"),
|
|
30
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow()
|
|
31
|
+
}, (table) => [
|
|
32
|
+
primaryKey({ columns: [table.userId, table.orgId] })
|
|
33
|
+
]);
|
|
34
|
+
var userTeams = pgTable("user_teams", {
|
|
35
|
+
userId: uuid("user_id").notNull(),
|
|
36
|
+
teamId: uuid("team_id").references(() => teams.id, { onDelete: "cascade" }).notNull(),
|
|
37
|
+
role: text("role").notNull().default("member"),
|
|
38
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow()
|
|
39
|
+
}, (table) => [
|
|
40
|
+
primaryKey({ columns: [table.userId, table.teamId] })
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
// ../../packages/db/dist/schema/tables/profiles.js
|
|
44
|
+
var profiles = pgTable2("profiles", {
|
|
45
|
+
id: uuid2("id").primaryKey(),
|
|
46
|
+
email: text2("email"),
|
|
47
|
+
displayName: text2("display_name"),
|
|
48
|
+
avatarUrl: text2("avatar_url"),
|
|
49
|
+
activeOrgId: uuid2("active_org_id").references(() => organizations.id, { onDelete: "set null" }),
|
|
50
|
+
isSuperadmin: boolean("is_superadmin").notNull().default(false),
|
|
51
|
+
claudeCodePlan: text2("claude_code_plan"),
|
|
52
|
+
planSource: text2("plan_source").notNull().default("detected"),
|
|
53
|
+
setupCompletedAt: timestamp2("setup_completed_at", { withTimezone: true }),
|
|
54
|
+
liveSendSkipped: boolean("live_send_skipped").notNull().default(false),
|
|
55
|
+
createdAt: timestamp2("created_at", { withTimezone: true }).defaultNow(),
|
|
56
|
+
updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow()
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// ../../packages/db/dist/schema/tables/agent-runs.js
|
|
60
|
+
import { pgTable as pgTable5, text as text5, timestamp as timestamp5, jsonb as jsonb4, uuid as uuid5, integer as integer2, boolean as boolean4, index as index2 } from "drizzle-orm/pg-core";
|
|
61
|
+
|
|
62
|
+
// ../../packages/db/dist/schema/tables/projects.js
|
|
63
|
+
import { boolean as boolean3, jsonb as jsonb3, pgTable as pgTable4, primaryKey as primaryKey2, text as text4, timestamp as timestamp4, uniqueIndex as uniqueIndex2, uuid as uuid4 } from "drizzle-orm/pg-core";
|
|
64
|
+
import { sql } from "drizzle-orm";
|
|
65
|
+
|
|
66
|
+
// ../../packages/db/dist/schema/tables/instructions.js
|
|
67
|
+
import { pgTable as pgTable3, text as text3, timestamp as timestamp3, jsonb as jsonb2, uuid as uuid3, integer, boolean as boolean2, uniqueIndex, index } from "drizzle-orm/pg-core";
|
|
68
|
+
var instructions = pgTable3("instructions", {
|
|
69
|
+
id: uuid3("id").primaryKey().defaultRandom(),
|
|
70
|
+
name: text3("name").notNull(),
|
|
71
|
+
description: text3("description").notNull(),
|
|
72
|
+
type: text3("type").notNull().default("instruction"),
|
|
73
|
+
scope: text3("scope").notNull(),
|
|
74
|
+
scopeRef: uuid3("scope_ref"),
|
|
75
|
+
version: text3("version").notNull(),
|
|
76
|
+
content: text3("content").notNull(),
|
|
77
|
+
frontmatter: jsonb2("frontmatter").notNull(),
|
|
78
|
+
slots: jsonb2("slots"),
|
|
79
|
+
tags: text3("tags").array(),
|
|
80
|
+
compatibility: text3("compatibility").array(),
|
|
81
|
+
createdBy: uuid3("created_by"),
|
|
82
|
+
createdAt: timestamp3("created_at", { withTimezone: true }).defaultNow(),
|
|
83
|
+
updatedAt: timestamp3("updated_at", { withTimezone: true }).defaultNow(),
|
|
84
|
+
archived: boolean2("archived").default(false),
|
|
85
|
+
archivedAt: timestamp3("archived_at", { withTimezone: true }),
|
|
86
|
+
archivedBy: uuid3("archived_by"),
|
|
87
|
+
forkedFromId: uuid3("forked_from_id").references(() => instructions.id, { onDelete: "set null" }),
|
|
88
|
+
upstreamVersion: text3("upstream_version"),
|
|
89
|
+
badge: text3("badge"),
|
|
90
|
+
contentHash: text3("content_hash"),
|
|
91
|
+
contextIdentity: text3("context_identity"),
|
|
92
|
+
scanScore: integer("scan_score"),
|
|
93
|
+
scanFindings: jsonb2("scan_findings"),
|
|
94
|
+
popularityScore: integer("popularity_score"),
|
|
95
|
+
// Source file's last git-commit date (from the skills registry). Distinct
|
|
96
|
+
// from updatedAt, which is the local row's last-sync time. Used to sort the
|
|
97
|
+
// public catalog by genuine recency. NULL for non-registry rows and until
|
|
98
|
+
// the next registry sync populates it.
|
|
99
|
+
sourceUpdatedAt: timestamp3("source_updated_at", { withTimezone: true })
|
|
100
|
+
}, (table) => [
|
|
101
|
+
uniqueIndex("instructions_name_scope_ref_idx").on(table.name, table.scope, table.scopeRef),
|
|
102
|
+
index("idx_instructions_scope").on(table.scope, table.scopeRef),
|
|
103
|
+
index("idx_instructions_created_by").on(table.createdBy),
|
|
104
|
+
index("idx_instructions_context_identity").on(table.createdBy, table.contextIdentity),
|
|
105
|
+
// Recency sort for the public catalog: COALESCE(source_updated_at, updated_at) DESC.
|
|
106
|
+
index("idx_instructions_public_recency").on(table.scope, table.sourceUpdatedAt.desc())
|
|
107
|
+
]);
|
|
108
|
+
var instructionVersions = pgTable3("instruction_versions", {
|
|
109
|
+
id: uuid3("id").primaryKey().defaultRandom(),
|
|
110
|
+
instructionId: uuid3("instruction_id").references(() => instructions.id, { onDelete: "cascade" }),
|
|
111
|
+
versionNumber: integer("version_number").notNull(),
|
|
112
|
+
content: text3("content").notNull(),
|
|
113
|
+
frontmatter: jsonb2("frontmatter").notNull(),
|
|
114
|
+
changeSummary: text3("change_summary"),
|
|
115
|
+
createdBy: uuid3("created_by"),
|
|
116
|
+
createdAt: timestamp3("created_at", { withTimezone: true }).defaultNow()
|
|
117
|
+
}, (table) => [
|
|
118
|
+
uniqueIndex("instruction_versions_instruction_version_idx").on(table.instructionId, table.versionNumber)
|
|
119
|
+
]);
|
|
120
|
+
|
|
121
|
+
// ../../packages/db/dist/schema/tables/projects.js
|
|
122
|
+
var projects = pgTable4("projects", {
|
|
123
|
+
id: uuid4("id").primaryKey().defaultRandom(),
|
|
124
|
+
orgId: uuid4("org_id").references(() => organizations.id, { onDelete: "cascade" }),
|
|
125
|
+
name: text4("name").notNull(),
|
|
126
|
+
description: text4("description"),
|
|
127
|
+
// Legacy display field. No longer used as a primary lookup key — see
|
|
128
|
+
// gitRemoteUrl below. Kept for backward compat on existing UI forms.
|
|
129
|
+
githubRepo: text4("github_repo"),
|
|
130
|
+
// Canonicalized git remote URL (e.g. 'github.com/owner/repo'). Primary
|
|
131
|
+
// identity for project matching, set via canonicalizeRemote() server-side.
|
|
132
|
+
gitRemoteUrl: text4("git_remote_url"),
|
|
133
|
+
// SHA of the repo's first commit. Stability anchor — survives URL renames
|
|
134
|
+
// (transferred repos keep the same root commit). Used as fallback lookup
|
|
135
|
+
// when remote URL doesn't match.
|
|
136
|
+
gitRootCommit: text4("git_root_commit"),
|
|
137
|
+
// Old URLs this project has been known by. Populated when a URL rename
|
|
138
|
+
// is detected via root-commit match. Future sessions with the old URL
|
|
139
|
+
// still resolve to this project.
|
|
140
|
+
gitRemoteAliases: text4("git_remote_aliases").array().notNull().default([]),
|
|
141
|
+
metadata: jsonb3("metadata"),
|
|
142
|
+
createdBy: uuid4("created_by"),
|
|
143
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).defaultNow(),
|
|
144
|
+
updatedAt: timestamp4("updated_at", { withTimezone: true }).defaultNow()
|
|
145
|
+
}, (table) => [
|
|
146
|
+
uniqueIndex2("projects_org_name_idx").on(table.orgId, table.name),
|
|
147
|
+
// Partial unique index — NULLs are allowed (legacy projects with no
|
|
148
|
+
// remote). See migration 00054.
|
|
149
|
+
uniqueIndex2("projects_git_remote_url_unique").on(table.gitRemoteUrl).where(sql`${table.gitRemoteUrl} IS NOT NULL`)
|
|
150
|
+
]);
|
|
151
|
+
var projectInstructions = pgTable4("project_instructions", {
|
|
152
|
+
projectId: uuid4("project_id").references(() => projects.id, { onDelete: "cascade" }).notNull(),
|
|
153
|
+
instructionId: uuid4("instruction_id").references(() => instructions.id, { onDelete: "cascade" }).notNull(),
|
|
154
|
+
addedAt: timestamp4("added_at", { withTimezone: true }).defaultNow(),
|
|
155
|
+
addedBy: uuid4("added_by")
|
|
156
|
+
}, (table) => [
|
|
157
|
+
primaryKey2({ columns: [table.projectId, table.instructionId] })
|
|
158
|
+
]);
|
|
159
|
+
var projectCheckouts = pgTable4("project_checkouts", {
|
|
160
|
+
projectId: uuid4("project_id").references(() => projects.id, { onDelete: "cascade" }).notNull(),
|
|
161
|
+
path: text4("path").notNull(),
|
|
162
|
+
isWorktree: boolean3("is_worktree").notNull().default(false),
|
|
163
|
+
firstSeen: timestamp4("first_seen", { withTimezone: true }).notNull().defaultNow(),
|
|
164
|
+
lastSeen: timestamp4("last_seen", { withTimezone: true }).notNull().defaultNow()
|
|
165
|
+
}, (table) => [
|
|
166
|
+
primaryKey2({ columns: [table.projectId, table.path] }),
|
|
167
|
+
uniqueIndex2("project_checkouts_path_unique").on(table.path)
|
|
168
|
+
]);
|
|
169
|
+
|
|
170
|
+
// ../../packages/db/dist/schema/tables/agent-runs.js
|
|
171
|
+
var agentRuns = pgTable5("agent_runs", {
|
|
172
|
+
id: uuid5("id").primaryKey().defaultRandom(),
|
|
173
|
+
userId: uuid5("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
174
|
+
orgId: uuid5("org_id").references(() => organizations.id, { onDelete: "set null" }),
|
|
175
|
+
projectId: uuid5("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
176
|
+
projectPath: text5("project_path"),
|
|
177
|
+
gitRemote: text5("git_remote"),
|
|
178
|
+
baseBranch: text5("base_branch"),
|
|
179
|
+
title: text5("title"),
|
|
180
|
+
prompt: text5("prompt"),
|
|
181
|
+
// the shared task fanned out to each session
|
|
182
|
+
toolSpec: jsonb4("tool_spec").notNull().default([]),
|
|
183
|
+
// [{tool, model?, label?}] one entry per session
|
|
184
|
+
autoWorktree: boolean4("auto_worktree").notNull().default(true),
|
|
185
|
+
// 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' (DB CHECK enforces)
|
|
186
|
+
status: text5("status").notNull().default("pending"),
|
|
187
|
+
sessionCount: integer2("session_count").notNull().default(0),
|
|
188
|
+
metadata: jsonb4("metadata").notNull().default({}),
|
|
189
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
190
|
+
updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
191
|
+
completedAt: timestamp5("completed_at", { withTimezone: true })
|
|
192
|
+
}, (table) => [
|
|
193
|
+
index2("idx_agent_runs_user").on(table.userId),
|
|
194
|
+
index2("idx_agent_runs_org_created").on(table.orgId, table.createdAt),
|
|
195
|
+
index2("idx_agent_runs_project").on(table.projectId)
|
|
196
|
+
]);
|
|
197
|
+
|
|
198
|
+
// ../../packages/db/dist/schema/tables/sessions.js
|
|
199
|
+
import { pgTable as pgTable6, text as text6, timestamp as timestamp6, jsonb as jsonb5, uuid as uuid6, integer as integer3, uniqueIndex as uniqueIndex3, index as index3 } from "drizzle-orm/pg-core";
|
|
200
|
+
var sessions = pgTable6("sessions", {
|
|
201
|
+
id: uuid6("id").primaryKey().defaultRandom(),
|
|
202
|
+
userId: uuid6("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
203
|
+
externalSessionId: text6("external_session_id"),
|
|
204
|
+
projectId: uuid6("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
205
|
+
orgId: uuid6("org_id").references(() => organizations.id, { onDelete: "set null" }),
|
|
206
|
+
tool: text6("tool").notNull(),
|
|
207
|
+
projectPath: text6("project_path"),
|
|
208
|
+
gitBranch: text6("git_branch"),
|
|
209
|
+
startedAt: timestamp6("started_at", { withTimezone: true }).notNull(),
|
|
210
|
+
endedAt: timestamp6("ended_at", { withTimezone: true }),
|
|
211
|
+
eventCount: integer3("event_count").default(0),
|
|
212
|
+
tokenUsage: jsonb5("token_usage"),
|
|
213
|
+
analysis: jsonb5("analysis"),
|
|
214
|
+
analyzedAt: timestamp6("analyzed_at", { withTimezone: true }),
|
|
215
|
+
analyzedEventCount: integer3("analyzed_event_count"),
|
|
216
|
+
analyzedTurnCount: integer3("analyzed_turn_count"),
|
|
217
|
+
metadata: jsonb5("metadata").default({}),
|
|
218
|
+
// 'hook' | 'mcp' | 'proxy' | 'internal_worker' | 'import' | 'unknown'
|
|
219
|
+
// Set on insert in POST /api/sessions. GET /api/sessions defaults to
|
|
220
|
+
// excluding 'internal_worker' so insights/eval pipeline auto-captures
|
|
221
|
+
// never appear in the user's Sessions tab. See migration 00050.
|
|
222
|
+
origin: text6("origin").notNull().default("unknown"),
|
|
223
|
+
runId: uuid6("run_id").references(() => agentRuns.id, { onDelete: "set null" }),
|
|
224
|
+
createdAt: timestamp6("created_at", { withTimezone: true }).defaultNow()
|
|
225
|
+
}, (table) => [
|
|
226
|
+
index3("idx_sessions_user").on(table.userId),
|
|
227
|
+
index3("idx_sessions_tool").on(table.tool),
|
|
228
|
+
index3("idx_sessions_started_at").on(table.startedAt),
|
|
229
|
+
index3("idx_sessions_project").on(table.projectId),
|
|
230
|
+
index3("idx_sessions_org_started_at").on(table.orgId, table.startedAt),
|
|
231
|
+
index3("idx_sessions_run").on(table.runId),
|
|
232
|
+
uniqueIndex3("idx_sessions_user_external").on(table.userId, table.externalSessionId)
|
|
233
|
+
]);
|
|
234
|
+
var sessionEvents = pgTable6("session_events", {
|
|
235
|
+
id: uuid6("id").primaryKey().defaultRandom(),
|
|
236
|
+
sessionId: uuid6("session_id").notNull().references(() => sessions.id, { onDelete: "cascade" }),
|
|
237
|
+
sequence: integer3("sequence").notNull(),
|
|
238
|
+
eventType: text6("event_type").notNull(),
|
|
239
|
+
content: text6("content"),
|
|
240
|
+
toolName: text6("tool_name"),
|
|
241
|
+
toolInput: jsonb5("tool_input"),
|
|
242
|
+
toolOutput: jsonb5("tool_output"),
|
|
243
|
+
tokenUsage: jsonb5("token_usage"),
|
|
244
|
+
model: text6("model"),
|
|
245
|
+
timestamp: timestamp6("timestamp", { withTimezone: true }).notNull(),
|
|
246
|
+
metadata: jsonb5("metadata").default({})
|
|
247
|
+
}, (table) => [
|
|
248
|
+
uniqueIndex3("session_events_session_sequence_idx").on(table.sessionId, table.sequence),
|
|
249
|
+
index3("idx_session_events_session_id").on(table.sessionId),
|
|
250
|
+
index3("idx_session_events_event_type").on(table.eventType),
|
|
251
|
+
index3("idx_session_events_model").on(table.model)
|
|
252
|
+
]);
|
|
253
|
+
var sessionInstructions = pgTable6("session_instructions", {
|
|
254
|
+
sessionId: uuid6("session_id").notNull().references(() => sessions.id, { onDelete: "cascade" }),
|
|
255
|
+
instructionId: uuid6("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
|
|
256
|
+
linkMethod: text6("link_method").notNull()
|
|
257
|
+
}, (table) => [
|
|
258
|
+
index3("idx_session_instructions_instruction_id").on(table.instructionId)
|
|
259
|
+
]);
|
|
260
|
+
|
|
261
|
+
// ../../packages/db/dist/schema/tables/announcements.js
|
|
262
|
+
import { boolean as boolean5, date, index as index4, integer as integer4, jsonb as jsonb6, pgTable as pgTable7, text as text7, timestamp as timestamp7, uniqueIndex as uniqueIndex4, uuid as uuid7 } from "drizzle-orm/pg-core";
|
|
263
|
+
var announcements = pgTable7("announcements", {
|
|
264
|
+
id: uuid7("id").primaryKey().defaultRandom(),
|
|
265
|
+
version: text7("version").notNull().unique(),
|
|
266
|
+
releaseDate: date("release_date").notNull(),
|
|
267
|
+
subject: text7("subject").notNull(),
|
|
268
|
+
htmlBody: text7("html_body").notNull(),
|
|
269
|
+
textBody: text7("text_body").notNull(),
|
|
270
|
+
sections: jsonb6("sections").notNull().default({}),
|
|
271
|
+
status: text7("status").notNull().default("draft"),
|
|
272
|
+
recipientCount: integer4("recipient_count"),
|
|
273
|
+
sentAt: timestamp7("sent_at", { withTimezone: true }),
|
|
274
|
+
sentBy: uuid7("sent_by"),
|
|
275
|
+
error: text7("error"),
|
|
276
|
+
createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
277
|
+
updatedAt: timestamp7("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
278
|
+
}, (table) => [
|
|
279
|
+
index4("idx_announcements_status").on(table.status),
|
|
280
|
+
index4("idx_announcements_created").on(table.createdAt)
|
|
281
|
+
]);
|
|
282
|
+
var announcementDeliveries = pgTable7("announcement_deliveries", {
|
|
283
|
+
id: uuid7("id").primaryKey().defaultRandom(),
|
|
284
|
+
announcementId: uuid7("announcement_id").notNull(),
|
|
285
|
+
userId: uuid7("user_id").notNull(),
|
|
286
|
+
email: text7("email").notNull(),
|
|
287
|
+
status: text7("status").notNull().default("pending"),
|
|
288
|
+
providerId: text7("provider_id"),
|
|
289
|
+
error: text7("error"),
|
|
290
|
+
sentAt: timestamp7("sent_at", { withTimezone: true }),
|
|
291
|
+
createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
292
|
+
}, (table) => [
|
|
293
|
+
uniqueIndex4("uniq_announcement_deliveries_announcement_user").on(table.announcementId, table.userId),
|
|
294
|
+
index4("idx_announcement_deliveries_user").on(table.userId, table.createdAt)
|
|
295
|
+
]);
|
|
296
|
+
var notificationPreferences = pgTable7("notification_preferences", {
|
|
297
|
+
userId: uuid7("user_id").primaryKey(),
|
|
298
|
+
productAnnouncements: boolean5("product_announcements").notNull().default(true),
|
|
299
|
+
unsubscribeToken: text7("unsubscribe_token").notNull().unique(),
|
|
300
|
+
unsubscribedAt: timestamp7("unsubscribed_at", { withTimezone: true }),
|
|
301
|
+
createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
302
|
+
updatedAt: timestamp7("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// ../../packages/db/dist/schema/tables/org-invitations.js
|
|
306
|
+
import { pgTable as pgTable8, text as text8, timestamp as timestamp8, uuid as uuid8, index as index5 } from "drizzle-orm/pg-core";
|
|
307
|
+
var orgInvitations = pgTable8("org_invitations", {
|
|
308
|
+
id: uuid8("id").primaryKey().defaultRandom(),
|
|
309
|
+
orgId: uuid8("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
310
|
+
email: text8("email").notNull(),
|
|
311
|
+
role: text8("role").notNull().default("member"),
|
|
312
|
+
teamId: uuid8("team_id").references(() => teams.id, { onDelete: "set null" }),
|
|
313
|
+
invitedBy: uuid8("invited_by").notNull().references(() => profiles.id),
|
|
314
|
+
token: text8("token").notNull().unique(),
|
|
315
|
+
// expires_at is generated by Postgres via `default (now() + interval '7 days')`,
|
|
316
|
+
// so no Drizzle-side default — just notNull.
|
|
317
|
+
expiresAt: timestamp8("expires_at", { withTimezone: true }).notNull(),
|
|
318
|
+
acceptedAt: timestamp8("accepted_at", { withTimezone: true }),
|
|
319
|
+
revokedAt: timestamp8("revoked_at", { withTimezone: true }),
|
|
320
|
+
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
321
|
+
}, (t) => [
|
|
322
|
+
index5("idx_org_invitations_token").on(t.token),
|
|
323
|
+
index5("idx_org_invitations_org").on(t.orgId)
|
|
324
|
+
]);
|
|
325
|
+
|
|
326
|
+
// ../../packages/db/dist/schema/tables/instruction-events.js
|
|
327
|
+
import { pgTable as pgTable9, text as text9, timestamp as timestamp9, jsonb as jsonb7, uuid as uuid9, index as index6 } from "drizzle-orm/pg-core";
|
|
328
|
+
var instructionEvents = pgTable9("instruction_events", {
|
|
329
|
+
id: uuid9("id").primaryKey().defaultRandom(),
|
|
330
|
+
instructionId: uuid9("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
|
|
331
|
+
eventType: text9("event_type").notNull(),
|
|
332
|
+
actorId: uuid9("actor_id").notNull(),
|
|
333
|
+
metadata: jsonb7("metadata"),
|
|
334
|
+
createdAt: timestamp9("created_at", { withTimezone: true }).defaultNow()
|
|
335
|
+
}, (table) => [
|
|
336
|
+
index6("idx_instruction_events_instruction").on(table.instructionId),
|
|
337
|
+
index6("idx_instruction_events_type").on(table.eventType)
|
|
338
|
+
]);
|
|
339
|
+
|
|
340
|
+
// ../../packages/db/dist/schema/tables/session-terminal-targets.js
|
|
341
|
+
import { pgTable as pgTable10, text as text10, timestamp as timestamp10, uuid as uuid10, jsonb as jsonb8, uniqueIndex as uniqueIndex5, index as index7 } from "drizzle-orm/pg-core";
|
|
342
|
+
var sessionTerminalTargets = pgTable10("session_terminal_targets", {
|
|
343
|
+
id: uuid10("id").primaryKey().defaultRandom(),
|
|
344
|
+
userId: uuid10("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
345
|
+
sessionId: uuid10("session_id").references(() => sessions.id, { onDelete: "set null" }),
|
|
346
|
+
externalSessionId: text10("external_session_id"),
|
|
347
|
+
kind: text10("kind").notNull(),
|
|
348
|
+
target: text10("target").notNull(),
|
|
349
|
+
status: text10("status").notNull().default("active"),
|
|
350
|
+
attachCommand: text10("attach_command").notNull(),
|
|
351
|
+
projectPath: text10("project_path"),
|
|
352
|
+
metadata: jsonb8("metadata").notNull().default({}),
|
|
353
|
+
lastSeenAt: timestamp10("last_seen_at", { withTimezone: true }).defaultNow(),
|
|
354
|
+
createdAt: timestamp10("created_at", { withTimezone: true }).defaultNow(),
|
|
355
|
+
updatedAt: timestamp10("updated_at", { withTimezone: true }).defaultNow()
|
|
356
|
+
}, (table) => [
|
|
357
|
+
uniqueIndex5("idx_session_terminal_targets_user_target").on(table.userId, table.target),
|
|
358
|
+
index7("idx_session_terminal_targets_session").on(table.sessionId),
|
|
359
|
+
index7("idx_session_terminal_targets_user_status").on(table.userId, table.status)
|
|
360
|
+
]);
|
|
361
|
+
|
|
362
|
+
// ../../packages/db/dist/schema/tables/session-send-jobs.js
|
|
363
|
+
import { boolean as boolean6, bigint, index as index8, jsonb as jsonb9, pgTable as pgTable11, text as text11, timestamp as timestamp11, uuid as uuid11, integer as integer5 } from "drizzle-orm/pg-core";
|
|
364
|
+
var sessionSendJobs = pgTable11("session_send_jobs", {
|
|
365
|
+
id: uuid11("id").primaryKey().defaultRandom(),
|
|
366
|
+
userId: uuid11("user_id").notNull(),
|
|
367
|
+
sessionId: uuid11("session_id").notNull().references(() => sessions.id, { onDelete: "cascade" }),
|
|
368
|
+
terminalTargetId: uuid11("terminal_target_id").references(() => sessionTerminalTargets.id, { onDelete: "set null" }),
|
|
369
|
+
target: text11("target").notNull(),
|
|
370
|
+
message: text11("message").notNull(),
|
|
371
|
+
submit: boolean6("submit").notNull().default(true),
|
|
372
|
+
delivery: text11("delivery").notNull().default("live"),
|
|
373
|
+
status: text11("status").notNull().default("pending"),
|
|
374
|
+
result: jsonb9("result"),
|
|
375
|
+
error: text11("error"),
|
|
376
|
+
attempts: integer5("attempts").notNull().default(0),
|
|
377
|
+
graphileJobId: bigint("graphile_job_id", { mode: "number" }),
|
|
378
|
+
taskKind: text11("task_kind"),
|
|
379
|
+
payload: jsonb9("payload"),
|
|
380
|
+
claimedBy: text11("claimed_by"),
|
|
381
|
+
claimedAt: timestamp11("claimed_at", { withTimezone: true }),
|
|
382
|
+
leaseExpiresAt: timestamp11("lease_expires_at", { withTimezone: true }),
|
|
383
|
+
createdAt: timestamp11("created_at", { withTimezone: true }).defaultNow(),
|
|
384
|
+
updatedAt: timestamp11("updated_at", { withTimezone: true }).defaultNow(),
|
|
385
|
+
completedAt: timestamp11("completed_at", { withTimezone: true })
|
|
386
|
+
}, (table) => [
|
|
387
|
+
index8("idx_session_send_jobs_user").on(table.userId),
|
|
388
|
+
index8("idx_session_send_jobs_session").on(table.sessionId),
|
|
389
|
+
index8("idx_session_send_jobs_status").on(table.status),
|
|
390
|
+
index8("idx_session_send_jobs_pending").on(table.userId, table.status)
|
|
391
|
+
]);
|
|
392
|
+
|
|
393
|
+
// ../../packages/db/dist/schema/tables/packs.js
|
|
394
|
+
import { pgTable as pgTable12, text as text12, timestamp as timestamp12, jsonb as jsonb10, uuid as uuid12, integer as integer6, boolean as boolean7, uniqueIndex as uniqueIndex6, index as index9, primaryKey as primaryKey3 } from "drizzle-orm/pg-core";
|
|
395
|
+
var packs = pgTable12("packs", {
|
|
396
|
+
id: uuid12("id").primaryKey().defaultRandom(),
|
|
397
|
+
name: text12("name").notNull(),
|
|
398
|
+
description: text12("description").notNull(),
|
|
399
|
+
scope: text12("scope").notNull(),
|
|
400
|
+
scopeRef: uuid12("scope_ref"),
|
|
401
|
+
version: text12("version").notNull().default("1.0.0"),
|
|
402
|
+
tags: text12("tags").array(),
|
|
403
|
+
badge: text12("badge"),
|
|
404
|
+
metadata: jsonb10("metadata"),
|
|
405
|
+
createdBy: uuid12("created_by"),
|
|
406
|
+
createdAt: timestamp12("created_at", { withTimezone: true }).defaultNow(),
|
|
407
|
+
updatedAt: timestamp12("updated_at", { withTimezone: true }).defaultNow(),
|
|
408
|
+
archived: boolean7("archived").default(false),
|
|
409
|
+
archivedAt: timestamp12("archived_at", { withTimezone: true }),
|
|
410
|
+
archivedBy: uuid12("archived_by"),
|
|
411
|
+
forkedFromId: uuid12("forked_from_id").references(() => packs.id, { onDelete: "set null" }),
|
|
412
|
+
upstreamVersion: text12("upstream_version")
|
|
413
|
+
}, (table) => [
|
|
414
|
+
uniqueIndex6("packs_name_scope_ref_idx").on(table.name, table.scope, table.scopeRef),
|
|
415
|
+
index9("idx_packs_scope").on(table.scope, table.scopeRef),
|
|
416
|
+
index9("idx_packs_created_by").on(table.createdBy)
|
|
417
|
+
]);
|
|
418
|
+
var packInstructions = pgTable12("pack_instructions", {
|
|
419
|
+
packId: uuid12("pack_id").references(() => packs.id, { onDelete: "cascade" }).notNull(),
|
|
420
|
+
instructionId: uuid12("instruction_id").references(() => instructions.id, { onDelete: "cascade" }).notNull(),
|
|
421
|
+
position: integer6("position").notNull().default(0),
|
|
422
|
+
slotOverrides: jsonb10("slot_overrides"),
|
|
423
|
+
addedAt: timestamp12("added_at", { withTimezone: true }).defaultNow(),
|
|
424
|
+
addedBy: uuid12("added_by")
|
|
425
|
+
}, (table) => [
|
|
426
|
+
primaryKey3({ columns: [table.packId, table.instructionId] })
|
|
427
|
+
]);
|
|
428
|
+
|
|
429
|
+
// ../../packages/db/dist/schema/tables/project-signals.js
|
|
430
|
+
import { pgTable as pgTable13, text as text13, timestamp as timestamp13, uuid as uuid13, index as index10, primaryKey as primaryKey4 } from "drizzle-orm/pg-core";
|
|
431
|
+
var projectSignals = pgTable13("project_signals", {
|
|
432
|
+
userId: uuid13("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
433
|
+
projectPath: text13("project_path").notNull(),
|
|
434
|
+
detectedLanguages: text13("detected_languages").array().notNull().default([]).$type(),
|
|
435
|
+
lastSeenAt: timestamp13("last_seen_at", { withTimezone: true }).notNull().defaultNow()
|
|
436
|
+
}, (table) => [
|
|
437
|
+
primaryKey4({ columns: [table.userId, table.projectPath] }),
|
|
438
|
+
index10("idx_project_signals_user_seen").on(table.userId, table.lastSeenAt)
|
|
439
|
+
]);
|
|
440
|
+
|
|
441
|
+
// ../../packages/db/dist/schema/tables/usage-events.js
|
|
442
|
+
import { pgTable as pgTable14, text as text14, timestamp as timestamp14, jsonb as jsonb11, uuid as uuid14, index as index11 } from "drizzle-orm/pg-core";
|
|
443
|
+
var instructionUsageEvents = pgTable14("instruction_usage_events", {
|
|
444
|
+
id: uuid14("id").primaryKey().defaultRandom(),
|
|
445
|
+
instructionId: uuid14("instruction_id").references(() => instructions.id, { onDelete: "set null" }),
|
|
446
|
+
userId: uuid14("user_id").notNull(),
|
|
447
|
+
surface: text14("surface").notNull(),
|
|
448
|
+
action: text14("action").notNull(),
|
|
449
|
+
metadata: jsonb11("metadata"),
|
|
450
|
+
traceId: text14("trace_id"),
|
|
451
|
+
createdAt: timestamp14("created_at", { withTimezone: true }).defaultNow()
|
|
452
|
+
}, (table) => [
|
|
453
|
+
index11("idx_usage_events_instruction").on(table.instructionId),
|
|
454
|
+
index11("idx_usage_events_user").on(table.userId),
|
|
455
|
+
index11("idx_usage_events_surface").on(table.surface),
|
|
456
|
+
index11("idx_usage_events_action").on(table.action),
|
|
457
|
+
index11("idx_usage_events_created_at").on(table.createdAt),
|
|
458
|
+
index11("idx_usage_events_user_created").on(table.userId, table.createdAt)
|
|
459
|
+
]);
|
|
460
|
+
|
|
461
|
+
// ../../packages/db/dist/schema/tables/worker-connections.js
|
|
462
|
+
import { pgTable as pgTable15, text as text15, timestamp as timestamp15, jsonb as jsonb12, uuid as uuid15, index as index12 } from "drizzle-orm/pg-core";
|
|
463
|
+
var workerConnections = pgTable15("worker_connections", {
|
|
464
|
+
id: uuid15("id").primaryKey().defaultRandom(),
|
|
465
|
+
userId: uuid15("user_id").notNull(),
|
|
466
|
+
workerType: text15("worker_type").notNull().default("mcp"),
|
|
467
|
+
clientName: text15("client_name").notNull(),
|
|
468
|
+
clientVersion: text15("client_version"),
|
|
469
|
+
workerVersion: text15("worker_version"),
|
|
470
|
+
lastHeartbeat: timestamp15("last_heartbeat", { withTimezone: true }).notNull().defaultNow(),
|
|
471
|
+
connectedAt: timestamp15("connected_at", { withTimezone: true }).notNull().defaultNow(),
|
|
472
|
+
metadata: jsonb12("metadata")
|
|
473
|
+
}, (table) => [
|
|
474
|
+
index12("idx_worker_connections_user").on(table.userId),
|
|
475
|
+
index12("idx_worker_connections_heartbeat").on(table.userId, table.lastHeartbeat),
|
|
476
|
+
index12("idx_worker_connections_type").on(table.userId, table.workerType)
|
|
477
|
+
]);
|
|
478
|
+
|
|
479
|
+
// ../../packages/db/dist/schema/tables/eval-targets.js
|
|
480
|
+
import { pgTable as pgTable16, text as text16, timestamp as timestamp16, jsonb as jsonb13, uuid as uuid16, integer as integer7, index as index13 } from "drizzle-orm/pg-core";
|
|
481
|
+
var evalTargets = pgTable16("eval_targets", {
|
|
482
|
+
id: uuid16("id").primaryKey().defaultRandom(),
|
|
483
|
+
userId: uuid16("user_id").notNull(),
|
|
484
|
+
name: text16("name").notNull(),
|
|
485
|
+
type: text16("type").notNull(),
|
|
486
|
+
content: text16("content").notNull(),
|
|
487
|
+
description: text16("description").notNull().default(""),
|
|
488
|
+
metadata: jsonb13("metadata").notNull().default({}),
|
|
489
|
+
version: integer7("version").notNull().default(1),
|
|
490
|
+
parentId: uuid16("parent_id").references(() => evalTargets.id, { onDelete: "set null" }),
|
|
491
|
+
createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
|
|
492
|
+
updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
|
|
493
|
+
}, (table) => [
|
|
494
|
+
index13("eval_targets_name_user_idx").on(table.name, table.userId),
|
|
495
|
+
index13("idx_eval_targets_user").on(table.userId),
|
|
496
|
+
index13("idx_eval_targets_type").on(table.type),
|
|
497
|
+
index13("idx_eval_targets_parent").on(table.parentId)
|
|
498
|
+
]);
|
|
499
|
+
var evals = pgTable16("evals", {
|
|
500
|
+
id: uuid16("id").primaryKey().defaultRandom(),
|
|
501
|
+
evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
502
|
+
name: text16("name").notNull(),
|
|
503
|
+
prompt: text16("prompt").notNull(),
|
|
504
|
+
expectedOutput: text16("expected_output").notNull().default(""),
|
|
505
|
+
files: jsonb13("files").notNull().default([]),
|
|
506
|
+
expectations: jsonb13("expectations").notNull().default([]),
|
|
507
|
+
createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
|
|
508
|
+
updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
|
|
509
|
+
}, (table) => [
|
|
510
|
+
index13("idx_evals_target").on(table.evalTargetId)
|
|
511
|
+
]);
|
|
512
|
+
var evalRuns = pgTable16("eval_runs", {
|
|
513
|
+
id: uuid16("id").primaryKey().defaultRandom(),
|
|
514
|
+
evalId: uuid16("eval_id").notNull().references(() => evals.id, { onDelete: "cascade" }),
|
|
515
|
+
evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
516
|
+
evalTargetVersion: integer7("eval_target_version").notNull(),
|
|
517
|
+
configuration: text16("configuration").notNull(),
|
|
518
|
+
runNumber: integer7("run_number").notNull().default(1),
|
|
519
|
+
iteration: integer7("iteration").notNull().default(1),
|
|
520
|
+
status: text16("status").notNull().default("completed"),
|
|
521
|
+
outputs: jsonb13("outputs").notNull().default({}),
|
|
522
|
+
timing: jsonb13("timing").notNull().default({}),
|
|
523
|
+
grading: jsonb13("grading").notNull().default({}),
|
|
524
|
+
comparison: jsonb13("comparison"),
|
|
525
|
+
createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
|
|
526
|
+
}, (table) => [
|
|
527
|
+
index13("idx_eval_runs_eval").on(table.evalId),
|
|
528
|
+
index13("idx_eval_runs_target").on(table.evalTargetId),
|
|
529
|
+
index13("idx_eval_runs_iteration").on(table.evalTargetId, table.iteration)
|
|
530
|
+
]);
|
|
531
|
+
var benchmarks = pgTable16("benchmarks", {
|
|
532
|
+
id: uuid16("id").primaryKey().defaultRandom(),
|
|
533
|
+
evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
534
|
+
iteration: integer7("iteration").notNull().default(1),
|
|
535
|
+
runSummary: jsonb13("run_summary").notNull().default({}),
|
|
536
|
+
notes: jsonb13("notes").notNull().default([]),
|
|
537
|
+
feedback: jsonb13("feedback"),
|
|
538
|
+
createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
|
|
539
|
+
}, (table) => [
|
|
540
|
+
index13("idx_benchmarks_target").on(table.evalTargetId)
|
|
541
|
+
]);
|
|
542
|
+
|
|
543
|
+
// ../../packages/db/dist/schema/tables/optimization.js
|
|
544
|
+
import { pgTable as pgTable17, text as text17, timestamp as timestamp17, jsonb as jsonb14, uuid as uuid17, integer as integer8, index as index14, real } from "drizzle-orm/pg-core";
|
|
545
|
+
var triggerEvals = pgTable17("trigger_evals", {
|
|
546
|
+
id: uuid17("id").primaryKey().defaultRandom(),
|
|
547
|
+
evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
548
|
+
userId: uuid17("user_id").notNull(),
|
|
549
|
+
queries: jsonb14("queries").notNull().default([]),
|
|
550
|
+
status: text17("status").notNull().default("pending_review"),
|
|
551
|
+
trainIndices: integer8("train_indices").array().default([]),
|
|
552
|
+
testIndices: integer8("test_indices").array().default([]),
|
|
553
|
+
createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow(),
|
|
554
|
+
updatedAt: timestamp17("updated_at", { withTimezone: true }).defaultNow()
|
|
555
|
+
}, (table) => [
|
|
556
|
+
index14("idx_trigger_evals_target").on(table.evalTargetId),
|
|
557
|
+
index14("idx_trigger_evals_user").on(table.userId)
|
|
558
|
+
]);
|
|
559
|
+
var optimizationRuns = pgTable17("optimization_runs", {
|
|
560
|
+
id: uuid17("id").primaryKey().defaultRandom(),
|
|
561
|
+
evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
562
|
+
userId: uuid17("user_id").notNull(),
|
|
563
|
+
type: text17("type").notNull(),
|
|
564
|
+
iteration: integer8("iteration").notNull(),
|
|
565
|
+
inputVersion: integer8("input_version").notNull(),
|
|
566
|
+
outputVersion: integer8("output_version"),
|
|
567
|
+
trainScore: real("train_score"),
|
|
568
|
+
testScore: real("test_score"),
|
|
569
|
+
analysis: jsonb14("analysis").notNull().default({}),
|
|
570
|
+
status: text17("status").notNull().default("running"),
|
|
571
|
+
createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow()
|
|
572
|
+
}, (table) => [
|
|
573
|
+
index14("idx_optimization_runs_target").on(table.evalTargetId),
|
|
574
|
+
index14("idx_optimization_runs_user").on(table.userId)
|
|
575
|
+
]);
|
|
576
|
+
|
|
577
|
+
// ../../packages/db/dist/schema/tables/context-snapshots.js
|
|
578
|
+
import { pgTable as pgTable18, text as text18, timestamp as timestamp18, jsonb as jsonb15, uuid as uuid18, integer as integer9, real as real2, index as index15, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
|
|
579
|
+
var contextSnapshots = pgTable18("context_snapshots", {
|
|
580
|
+
id: uuid18("id").primaryKey().defaultRandom(),
|
|
581
|
+
sessionId: uuid18("session_id").references(() => sessions.id, { onDelete: "cascade" }),
|
|
582
|
+
userId: uuid18("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
583
|
+
sequence: integer9("sequence").notNull().default(0),
|
|
584
|
+
provider: text18("provider").notNull(),
|
|
585
|
+
model: text18("model").notNull(),
|
|
586
|
+
systemPrompt: text18("system_prompt").notNull(),
|
|
587
|
+
injectedInstructions: jsonb15("injected_instructions").notNull().default([]),
|
|
588
|
+
messagesSummary: jsonb15("messages_summary").notNull(),
|
|
589
|
+
tools: jsonb15("tools").notNull().default([]),
|
|
590
|
+
// Deprecated: use content_blobs via tools_hash
|
|
591
|
+
systemHash: text18("system_hash").notNull(),
|
|
592
|
+
requestHash: text18("request_hash").notNull().default(""),
|
|
593
|
+
toolsHash: text18("tools_hash"),
|
|
594
|
+
injectedHash: text18("injected_hash"),
|
|
595
|
+
messagesDelta: jsonb15("messages_delta").default([]),
|
|
596
|
+
// Storage pointer set when messages_delta is offloaded to the snapshot-deltas
|
|
597
|
+
// bucket (Stage 1+). NULL = inline (messages_delta populated) OR pruned (both
|
|
598
|
+
// NULL — see 00101). docs/plans/2026-06-24-messages-delta-object-storage-offload.md
|
|
599
|
+
messagesDeltaRef: text18("messages_delta_ref"),
|
|
600
|
+
maxTokens: integer9("max_tokens"),
|
|
601
|
+
temperature: real2("temperature"),
|
|
602
|
+
estimatedTokens: integer9("estimated_tokens"),
|
|
603
|
+
capturedAt: timestamp18("captured_at", { withTimezone: true }).notNull().defaultNow(),
|
|
604
|
+
metadata: jsonb15("metadata").default({})
|
|
605
|
+
}, (table) => [
|
|
606
|
+
index15("idx_context_snapshots_session").on(table.sessionId),
|
|
607
|
+
index15("idx_context_snapshots_user").on(table.userId),
|
|
608
|
+
index15("idx_context_snapshots_hash").on(table.systemHash),
|
|
609
|
+
index15("idx_context_snapshots_request_hash").on(table.requestHash),
|
|
610
|
+
uniqueIndex7("idx_snapshots_session_request").on(table.sessionId, table.requestHash),
|
|
611
|
+
// Concurrent snapshot POSTs for one session must not reuse a sequence — stops
|
|
612
|
+
// the live duplicate-sequence corruption. Built via migration 00095.
|
|
613
|
+
// Pool/perf audit 2026-06-22.
|
|
614
|
+
uniqueIndex7("idx_snapshots_session_sequence").on(table.sessionId, table.sequence)
|
|
615
|
+
]);
|
|
616
|
+
|
|
617
|
+
// ../../packages/db/dist/schema/tables/content-blobs.js
|
|
618
|
+
import { pgTable as pgTable19, text as text19, timestamp as timestamp19, jsonb as jsonb16, integer as integer10, index as index16 } from "drizzle-orm/pg-core";
|
|
619
|
+
var contentBlobs = pgTable19("content_blobs", {
|
|
620
|
+
hash: text19("hash").primaryKey(),
|
|
621
|
+
contentType: text19("content_type").notNull(),
|
|
622
|
+
content: jsonb16("content").notNull(),
|
|
623
|
+
sizeBytes: integer10("size_bytes").notNull().default(0),
|
|
624
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).defaultNow()
|
|
625
|
+
}, (table) => [
|
|
626
|
+
index16("idx_content_blobs_type").on(table.contentType)
|
|
627
|
+
]);
|
|
628
|
+
|
|
629
|
+
// ../../packages/db/dist/schema/tables/eval-jobs.js
|
|
630
|
+
import { pgTable as pgTable20, text as text20, timestamp as timestamp20, jsonb as jsonb17, uuid as uuid19, index as index17, integer as integer11, bigint as bigint2 } from "drizzle-orm/pg-core";
|
|
631
|
+
var evalJobs = pgTable20("eval_jobs", {
|
|
632
|
+
id: uuid19("id").primaryKey().defaultRandom(),
|
|
633
|
+
userId: uuid19("user_id").notNull(),
|
|
634
|
+
evalTargetId: uuid19("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
635
|
+
status: text20("status").notNull().default("pending"),
|
|
636
|
+
config: jsonb17("config").notNull().default({}),
|
|
637
|
+
progress: jsonb17("progress").notNull().default({}),
|
|
638
|
+
result: jsonb17("result"),
|
|
639
|
+
error: text20("error"),
|
|
640
|
+
attempts: integer11("attempts").notNull().default(0),
|
|
641
|
+
graphileJobId: bigint2("graphile_job_id", { mode: "number" }),
|
|
642
|
+
taskKind: text20("task_kind"),
|
|
643
|
+
payload: jsonb17("payload"),
|
|
644
|
+
claimedBy: text20("claimed_by"),
|
|
645
|
+
claimedAt: timestamp20("claimed_at", { withTimezone: true }),
|
|
646
|
+
leaseExpiresAt: timestamp20("lease_expires_at", { withTimezone: true }),
|
|
647
|
+
createdAt: timestamp20("created_at", { withTimezone: true }).defaultNow(),
|
|
648
|
+
updatedAt: timestamp20("updated_at", { withTimezone: true }).defaultNow(),
|
|
649
|
+
completedAt: timestamp20("completed_at", { withTimezone: true })
|
|
650
|
+
}, (table) => [
|
|
651
|
+
index17("idx_eval_jobs_user").on(table.userId),
|
|
652
|
+
index17("idx_eval_jobs_target").on(table.evalTargetId),
|
|
653
|
+
index17("idx_eval_jobs_status").on(table.status),
|
|
654
|
+
index17("idx_eval_jobs_pending").on(table.userId, table.status)
|
|
655
|
+
]);
|
|
656
|
+
|
|
657
|
+
// ../../packages/db/dist/schema/tables/agent-jobs.js
|
|
658
|
+
import { pgTable as pgTable21, text as text21, timestamp as timestamp21, jsonb as jsonb18, uuid as uuid20, integer as integer12, index as index18 } from "drizzle-orm/pg-core";
|
|
659
|
+
var agentJobs = pgTable21("agent_jobs", {
|
|
660
|
+
id: uuid20("id").primaryKey().defaultRandom(),
|
|
661
|
+
userId: uuid20("user_id").notNull(),
|
|
662
|
+
taskKind: text21("task_kind").notNull(),
|
|
663
|
+
status: text21("status").notNull().default("pending"),
|
|
664
|
+
payload: jsonb18("payload").notNull(),
|
|
665
|
+
dedupeKey: text21("dedupe_key"),
|
|
666
|
+
result: jsonb18("result"),
|
|
667
|
+
error: text21("error"),
|
|
668
|
+
attempts: integer12("attempts").notNull().default(0),
|
|
669
|
+
claimedBy: text21("claimed_by"),
|
|
670
|
+
claimedAt: timestamp21("claimed_at", { withTimezone: true }),
|
|
671
|
+
leaseExpiresAt: timestamp21("lease_expires_at", { withTimezone: true }),
|
|
672
|
+
createdAt: timestamp21("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
673
|
+
updatedAt: timestamp21("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
674
|
+
completedAt: timestamp21("completed_at", { withTimezone: true })
|
|
675
|
+
}, (table) => [
|
|
676
|
+
index18("idx_agent_jobs_claim").on(table.userId, table.status, table.taskKind, table.createdAt),
|
|
677
|
+
index18("idx_agent_jobs_dedupe").on(table.userId, table.taskKind, table.dedupeKey)
|
|
678
|
+
]);
|
|
679
|
+
|
|
680
|
+
// ../../packages/db/dist/schema/tables/insights.js
|
|
681
|
+
import { pgTable as pgTable22, text as text22, timestamp as timestamp22, jsonb as jsonb19, uuid as uuid21, index as index19, uniqueIndex as uniqueIndex8, integer as integer13, bigint as bigint3 } from "drizzle-orm/pg-core";
|
|
682
|
+
var insightsJobs = pgTable22("insights_jobs", {
|
|
683
|
+
id: uuid21("id").primaryKey().defaultRandom(),
|
|
684
|
+
userId: uuid21("user_id").notNull(),
|
|
685
|
+
status: text22("status").notNull().default("pending"),
|
|
686
|
+
projectPath: text22("project_path"),
|
|
687
|
+
// Canonical project identity (project_path-keying fragments one project across
|
|
688
|
+
// worktrees/subdirs/cwds — migration 00104). Nullable: legacy/unlinked rows fall
|
|
689
|
+
// back to project_path. Stamped at enqueue when resolvable.
|
|
690
|
+
projectId: uuid21("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
691
|
+
config: jsonb19("config").notNull().default({}),
|
|
692
|
+
progress: jsonb19("progress").notNull().default({}),
|
|
693
|
+
result: jsonb19("result"),
|
|
694
|
+
error: text22("error"),
|
|
695
|
+
attempts: integer13("attempts").notNull().default(0),
|
|
696
|
+
graphileJobId: bigint3("graphile_job_id", { mode: "number" }),
|
|
697
|
+
taskKind: text22("task_kind"),
|
|
698
|
+
payload: jsonb19("payload"),
|
|
699
|
+
claimedBy: text22("claimed_by"),
|
|
700
|
+
claimedAt: timestamp22("claimed_at", { withTimezone: true }),
|
|
701
|
+
leaseExpiresAt: timestamp22("lease_expires_at", { withTimezone: true }),
|
|
702
|
+
createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow(),
|
|
703
|
+
updatedAt: timestamp22("updated_at", { withTimezone: true }).defaultNow(),
|
|
704
|
+
completedAt: timestamp22("completed_at", { withTimezone: true })
|
|
705
|
+
}, (table) => [
|
|
706
|
+
index19("idx_insights_jobs_user").on(table.userId),
|
|
707
|
+
index19("idx_insights_jobs_status").on(table.status),
|
|
708
|
+
index19("idx_insights_jobs_pending").on(table.userId, table.status),
|
|
709
|
+
index19("idx_insights_jobs_project").on(table.projectId)
|
|
710
|
+
]);
|
|
711
|
+
var insightsReports = pgTable22("insights_reports", {
|
|
712
|
+
id: uuid21("id").primaryKey().defaultRandom(),
|
|
713
|
+
userId: uuid21("user_id").notNull(),
|
|
714
|
+
projectPath: text22("project_path"),
|
|
715
|
+
data: jsonb19("data").notNull(),
|
|
716
|
+
reportHtml: text22("report_html"),
|
|
717
|
+
createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow()
|
|
718
|
+
}, (table) => [
|
|
719
|
+
index19("idx_insights_user").on(table.userId),
|
|
720
|
+
index19("idx_insights_created").on(table.createdAt),
|
|
721
|
+
uniqueIndex8("idx_insights_user_project").on(table.userId, table.projectPath)
|
|
722
|
+
]);
|
|
723
|
+
|
|
724
|
+
// ../../packages/db/dist/schema/tables/api-keys.js
|
|
725
|
+
import { pgTable as pgTable23, text as text23, timestamp as timestamp23, uuid as uuid22, index as index20, uniqueIndex as uniqueIndex9 } from "drizzle-orm/pg-core";
|
|
726
|
+
var apiKeys = pgTable23("api_keys", {
|
|
727
|
+
id: uuid22("id").primaryKey().defaultRandom(),
|
|
728
|
+
userId: uuid22("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
729
|
+
name: text23("name").notNull(),
|
|
730
|
+
keyHash: text23("key_hash").notNull(),
|
|
731
|
+
keyPrefix: text23("key_prefix").notNull(),
|
|
732
|
+
lastUsedAt: timestamp23("last_used_at", { withTimezone: true }),
|
|
733
|
+
expiresAt: timestamp23("expires_at", { withTimezone: true }),
|
|
734
|
+
revokedAt: timestamp23("revoked_at", { withTimezone: true }),
|
|
735
|
+
createdAt: timestamp23("created_at", { withTimezone: true }).defaultNow()
|
|
736
|
+
}, (table) => [
|
|
737
|
+
index20("idx_api_keys_user").on(table.userId),
|
|
738
|
+
uniqueIndex9("idx_api_keys_hash").on(table.keyHash)
|
|
739
|
+
]);
|
|
740
|
+
|
|
741
|
+
// ../../packages/db/dist/schema/tables/extension-auth-codes.js
|
|
742
|
+
import { pgTable as pgTable24, text as text24, timestamp as timestamp24, uuid as uuid23, index as index21 } from "drizzle-orm/pg-core";
|
|
743
|
+
var extensionAuthCodes = pgTable24("extension_auth_codes", {
|
|
744
|
+
code: text24("code").primaryKey(),
|
|
745
|
+
userId: uuid23("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
746
|
+
editor: text24("editor"),
|
|
747
|
+
email: text24("email"),
|
|
748
|
+
expiresAt: timestamp24("expires_at", { withTimezone: true }).notNull(),
|
|
749
|
+
createdAt: timestamp24("created_at", { withTimezone: true }).defaultNow()
|
|
750
|
+
}, (table) => [
|
|
751
|
+
index21("idx_ext_auth_codes_expiry").on(table.expiresAt)
|
|
752
|
+
]);
|
|
753
|
+
|
|
754
|
+
// ../../packages/db/dist/schema/tables/eval-conversations.js
|
|
755
|
+
import { pgTable as pgTable25, text as text25, timestamp as timestamp25, jsonb as jsonb20, uuid as uuid24, index as index22 } from "drizzle-orm/pg-core";
|
|
756
|
+
var evalConversations = pgTable25("eval_conversations", {
|
|
757
|
+
id: uuid24("id").primaryKey().defaultRandom(),
|
|
758
|
+
evalTargetId: uuid24("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
759
|
+
userId: uuid24("user_id").notNull(),
|
|
760
|
+
messages: jsonb20("messages").notNull().default([]),
|
|
761
|
+
status: text25("status").notNull().default("active"),
|
|
762
|
+
createdAt: timestamp25("created_at", { withTimezone: true }).defaultNow(),
|
|
763
|
+
updatedAt: timestamp25("updated_at", { withTimezone: true }).defaultNow()
|
|
764
|
+
}, (table) => [
|
|
765
|
+
index22("idx_eval_conversations_target").on(table.evalTargetId),
|
|
766
|
+
index22("idx_eval_conversations_user").on(table.userId)
|
|
767
|
+
]);
|
|
768
|
+
|
|
769
|
+
// ../../packages/db/dist/schema/tables/security-events.js
|
|
770
|
+
import { pgTable as pgTable26, uuid as uuid25, text as text26, jsonb as jsonb21, timestamp as timestamp26, index as index23 } from "drizzle-orm/pg-core";
|
|
771
|
+
var securityEvents = pgTable26("security_events", {
|
|
772
|
+
id: uuid25("id").primaryKey().defaultRandom(),
|
|
773
|
+
eventType: text26("event_type").notNull(),
|
|
774
|
+
severity: text26("severity").notNull(),
|
|
775
|
+
category: text26("category").notNull(),
|
|
776
|
+
source: text26("source").notNull(),
|
|
777
|
+
entityType: text26("entity_type"),
|
|
778
|
+
entityId: uuid25("entity_id"),
|
|
779
|
+
userId: uuid25("user_id"),
|
|
780
|
+
details: jsonb21("details").notNull().default({}),
|
|
781
|
+
createdAt: timestamp26("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
782
|
+
}, (table) => [
|
|
783
|
+
index23("idx_security_events_type").on(table.eventType),
|
|
784
|
+
index23("idx_security_events_user").on(table.userId),
|
|
785
|
+
index23("idx_security_events_created").on(table.createdAt),
|
|
786
|
+
index23("idx_security_events_severity").on(table.severity),
|
|
787
|
+
index23("idx_security_events_source").on(table.source)
|
|
788
|
+
]);
|
|
789
|
+
|
|
790
|
+
// ../../packages/db/dist/schema/tables/tasks.js
|
|
791
|
+
import { pgTable as pgTable27, text as text27, timestamp as timestamp27, uuid as uuid26, index as index24 } from "drizzle-orm/pg-core";
|
|
792
|
+
var tasks = pgTable27("tasks", {
|
|
793
|
+
id: uuid26("id").primaryKey().defaultRandom(),
|
|
794
|
+
title: text27("title").notNull(),
|
|
795
|
+
description: text27("description"),
|
|
796
|
+
status: text27("status").notNull().default("pending"),
|
|
797
|
+
createdBy: uuid26("created_by"),
|
|
798
|
+
createdAt: timestamp27("created_at", { withTimezone: true }).defaultNow(),
|
|
799
|
+
updatedAt: timestamp27("updated_at", { withTimezone: true }).defaultNow()
|
|
800
|
+
}, (table) => [
|
|
801
|
+
index24("tasks_created_by_idx").on(table.createdBy),
|
|
802
|
+
index24("tasks_status_idx").on(table.status)
|
|
803
|
+
]);
|
|
804
|
+
|
|
805
|
+
// ../../packages/db/dist/schema/tables/skill-submissions.js
|
|
806
|
+
import { pgTable as pgTable28, text as text28, timestamp as timestamp28, jsonb as jsonb22, uuid as uuid27 } from "drizzle-orm/pg-core";
|
|
807
|
+
var skillSubmissions = pgTable28("skill_submissions", {
|
|
808
|
+
id: uuid27("id").primaryKey().defaultRandom(),
|
|
809
|
+
skillId: text28("skill_id").notNull(),
|
|
810
|
+
name: text28("name").notNull(),
|
|
811
|
+
description: text28("description").notNull(),
|
|
812
|
+
category: text28("category").notNull(),
|
|
813
|
+
tools: text28("tools").array().notNull(),
|
|
814
|
+
tags: text28("tags").array().default([]),
|
|
815
|
+
content: text28("content").notNull(),
|
|
816
|
+
status: text28("status").notNull().default("pending"),
|
|
817
|
+
// pending | approved | rejected
|
|
818
|
+
submittedBy: uuid27("submitted_by").notNull(),
|
|
819
|
+
reviewedBy: uuid27("reviewed_by"),
|
|
820
|
+
reviewNote: text28("review_note"),
|
|
821
|
+
metadata: jsonb22("metadata"),
|
|
822
|
+
createdAt: timestamp28("created_at", { withTimezone: true }).defaultNow(),
|
|
823
|
+
updatedAt: timestamp28("updated_at", { withTimezone: true }).defaultNow()
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
// ../../packages/db/dist/schema/tables/harness-releases.js
|
|
827
|
+
import { pgTable as pgTable29, text as text29, timestamp as timestamp29, jsonb as jsonb23, uuid as uuid28, uniqueIndex as uniqueIndex10, index as index25 } from "drizzle-orm/pg-core";
|
|
828
|
+
var harnessReleases = pgTable29("harness_releases", {
|
|
829
|
+
id: uuid28("id").primaryKey().defaultRandom(),
|
|
830
|
+
harness: text29("harness").notNull(),
|
|
831
|
+
// "claude_code", "cursor", "copilot"
|
|
832
|
+
version: text29("version").notNull(),
|
|
833
|
+
// "v2.1.119"
|
|
834
|
+
publishedAt: timestamp29("published_at", { withTimezone: true }).notNull(),
|
|
835
|
+
title: text29("title"),
|
|
836
|
+
// release name
|
|
837
|
+
body: text29("body"),
|
|
838
|
+
// raw markdown
|
|
839
|
+
categories: jsonb23("categories").default({}),
|
|
840
|
+
// { features: string[], fixes: string[], security: string[] }
|
|
841
|
+
url: text29("url"),
|
|
842
|
+
// link to release page
|
|
843
|
+
createdAt: timestamp29("created_at", { withTimezone: true }).defaultNow()
|
|
844
|
+
}, (table) => [
|
|
845
|
+
uniqueIndex10("idx_harness_releases_unique").on(table.harness, table.version),
|
|
846
|
+
index25("idx_harness_releases_harness").on(table.harness),
|
|
847
|
+
index25("idx_harness_releases_published").on(table.publishedAt)
|
|
848
|
+
]);
|
|
849
|
+
|
|
850
|
+
// ../../packages/db/dist/schema/tables/notifications.js
|
|
851
|
+
import { pgTable as pgTable30, text as text30, timestamp as timestamp30, jsonb as jsonb24, uuid as uuid29, index as index26, uniqueIndex as uniqueIndex11 } from "drizzle-orm/pg-core";
|
|
852
|
+
var notifications = pgTable30("notifications", {
|
|
853
|
+
id: uuid29("id").primaryKey().defaultRandom(),
|
|
854
|
+
userId: uuid29("user_id").notNull(),
|
|
855
|
+
type: text30("type").notNull(),
|
|
856
|
+
title: text30("title").notNull(),
|
|
857
|
+
body: text30("body"),
|
|
858
|
+
url: text30("url"),
|
|
859
|
+
sourceTable: text30("source_table"),
|
|
860
|
+
sourceId: text30("source_id"),
|
|
861
|
+
metadata: jsonb24("metadata").notNull().default({}),
|
|
862
|
+
readAt: timestamp30("read_at", { withTimezone: true }),
|
|
863
|
+
createdAt: timestamp30("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
864
|
+
}, (table) => [
|
|
865
|
+
index26("idx_notifications_user_created").on(table.userId, table.createdAt),
|
|
866
|
+
index26("idx_notifications_user_unread").on(table.userId),
|
|
867
|
+
uniqueIndex11("idx_notifications_source_dedup").on(table.userId, table.sourceTable, table.sourceId)
|
|
868
|
+
]);
|
|
869
|
+
|
|
870
|
+
// ../../packages/db/dist/schema/tables/launch-jobs.js
|
|
871
|
+
import { pgTable as pgTable31, text as text31, timestamp as timestamp31, jsonb as jsonb25, uuid as uuid30, index as index27, integer as integer14, bigint as bigint4 } from "drizzle-orm/pg-core";
|
|
872
|
+
var launchJobs = pgTable31("launch_jobs", {
|
|
873
|
+
id: uuid30("id").primaryKey().defaultRandom(),
|
|
874
|
+
userId: uuid30("user_id").notNull(),
|
|
875
|
+
tool: text31("tool").notNull(),
|
|
876
|
+
status: text31("status").notNull().default("pending"),
|
|
877
|
+
config: jsonb25("config").notNull().default({}),
|
|
878
|
+
result: jsonb25("result"),
|
|
879
|
+
error: text31("error"),
|
|
880
|
+
attempts: integer14("attempts").notNull().default(0),
|
|
881
|
+
graphileJobId: bigint4("graphile_job_id", { mode: "number" }),
|
|
882
|
+
taskKind: text31("task_kind"),
|
|
883
|
+
payload: jsonb25("payload"),
|
|
884
|
+
claimedBy: text31("claimed_by"),
|
|
885
|
+
claimedAt: timestamp31("claimed_at", { withTimezone: true }),
|
|
886
|
+
leaseExpiresAt: timestamp31("lease_expires_at", { withTimezone: true }),
|
|
887
|
+
createdAt: timestamp31("created_at", { withTimezone: true }).defaultNow(),
|
|
888
|
+
updatedAt: timestamp31("updated_at", { withTimezone: true }).defaultNow(),
|
|
889
|
+
completedAt: timestamp31("completed_at", { withTimezone: true }),
|
|
890
|
+
runId: uuid30("run_id").references(() => agentRuns.id, { onDelete: "set null" })
|
|
891
|
+
}, (table) => [
|
|
892
|
+
index27("idx_launch_jobs_user").on(table.userId),
|
|
893
|
+
index27("idx_launch_jobs_status").on(table.status),
|
|
894
|
+
index27("idx_launch_jobs_pending").on(table.userId, table.status),
|
|
895
|
+
index27("idx_launch_jobs_run").on(table.runId)
|
|
896
|
+
]);
|
|
897
|
+
|
|
898
|
+
// ../../packages/db/dist/schema/tables/instruction-suggestions.js
|
|
899
|
+
import { pgTable as pgTable32, uuid as uuid31, text as text32, real as real3, timestamp as timestamp32, boolean as boolean8, uniqueIndex as uniqueIndex12, index as index28 } from "drizzle-orm/pg-core";
|
|
900
|
+
var instructionSuggestions = pgTable32("instruction_suggestions", {
|
|
901
|
+
id: uuid31("id").primaryKey().defaultRandom(),
|
|
902
|
+
userId: uuid31("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
903
|
+
instructionId: uuid31("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
|
|
904
|
+
projectPath: text32("project_path").notNull(),
|
|
905
|
+
// Canonical project identity (migration 00104). Additive + nullable; the
|
|
906
|
+
// unique index below stays on project_path (NOT NULL) so upserts are
|
|
907
|
+
// unchanged. Readers prefer project_id to aggregate across path variants.
|
|
908
|
+
projectId: uuid31("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
909
|
+
score: real3("score").notNull(),
|
|
910
|
+
reason: text32("reason").notNull(),
|
|
911
|
+
generatedAt: timestamp32("generated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
912
|
+
isStale: boolean8("is_stale").notNull().default(false),
|
|
913
|
+
dismissedAt: timestamp32("dismissed_at", { withTimezone: true }),
|
|
914
|
+
acceptedAt: timestamp32("accepted_at", { withTimezone: true }),
|
|
915
|
+
promotedToInstructionId: uuid31("promoted_to_instruction_id").references(() => instructions.id, { onDelete: "set null" })
|
|
916
|
+
}, (table) => [
|
|
917
|
+
uniqueIndex12("idx_instruction_suggestions_user_project_instruction").on(table.userId, table.projectPath, table.instructionId),
|
|
918
|
+
index28("idx_instruction_suggestions_user_project").on(table.userId, table.projectPath),
|
|
919
|
+
index28("idx_instruction_suggestions_user_proj_id").on(table.userId, table.projectId),
|
|
920
|
+
index28("idx_instruction_suggestions_generated_at").on(table.generatedAt)
|
|
921
|
+
]);
|
|
922
|
+
var instructionSuggestionEvents = pgTable32("instruction_suggestion_events", {
|
|
923
|
+
id: uuid31("id").primaryKey().defaultRandom(),
|
|
924
|
+
suggestionId: uuid31("suggestion_id").notNull().references(() => instructionSuggestions.id, { onDelete: "cascade" }),
|
|
925
|
+
userId: uuid31("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
926
|
+
eventType: text32("event_type").notNull(),
|
|
927
|
+
tool: text32("tool"),
|
|
928
|
+
sessionId: uuid31("session_id"),
|
|
929
|
+
projectPath: text32("project_path").notNull(),
|
|
930
|
+
createdAt: timestamp32("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
931
|
+
}, (table) => [
|
|
932
|
+
index28("idx_instruction_suggestion_events_suggestion_id").on(table.suggestionId),
|
|
933
|
+
index28("idx_instruction_suggestion_events_user_id").on(table.userId)
|
|
934
|
+
]);
|
|
935
|
+
|
|
936
|
+
// ../../packages/db/dist/schema/tables/model-pricing.js
|
|
937
|
+
import { pgTable as pgTable33, text as text33, integer as integer15, numeric, timestamp as timestamp33, index as index29, primaryKey as primaryKey5 } from "drizzle-orm/pg-core";
|
|
938
|
+
var modelPricing = pgTable33("model_pricing", {
|
|
939
|
+
provider: text33("provider").notNull(),
|
|
940
|
+
modelId: text33("model_id").notNull(),
|
|
941
|
+
inputPerM: numeric("input_per_m").notNull(),
|
|
942
|
+
outputPerM: numeric("output_per_m").notNull(),
|
|
943
|
+
cacheReadPerM: numeric("cache_read_per_m").notNull(),
|
|
944
|
+
cacheWrite5mPerM: numeric("cache_write_5m_per_m").notNull(),
|
|
945
|
+
cacheWrite1hPerM: numeric("cache_write_1h_per_m").notNull(),
|
|
946
|
+
contextWindow: integer15("context_window"),
|
|
947
|
+
effectiveFrom: timestamp33("effective_from", { withTimezone: true }).notNull(),
|
|
948
|
+
effectiveUntil: timestamp33("effective_until", { withTimezone: true }),
|
|
949
|
+
source: text33("source").notNull()
|
|
950
|
+
}, (table) => [
|
|
951
|
+
primaryKey5({ columns: [table.provider, table.modelId, table.effectiveFrom] }),
|
|
952
|
+
index29("idx_model_pricing_active").on(table.provider, table.modelId, table.effectiveFrom.desc())
|
|
953
|
+
]);
|
|
954
|
+
|
|
955
|
+
// ../../packages/db/dist/schema/tables/limit-observations.js
|
|
956
|
+
import { pgTable as pgTable34, text as text34, numeric as numeric2, timestamp as timestamp34, uuid as uuid32, jsonb as jsonb26, index as index30 } from "drizzle-orm/pg-core";
|
|
957
|
+
var limitObservations = pgTable34("limit_observations", {
|
|
958
|
+
id: uuid32("id").primaryKey().defaultRandom(),
|
|
959
|
+
observedAt: timestamp34("observed_at", { withTimezone: true }).notNull().defaultNow(),
|
|
960
|
+
provider: text34("provider").notNull(),
|
|
961
|
+
plan: text34("plan").notNull(),
|
|
962
|
+
limitType: text34("limit_type").notNull(),
|
|
963
|
+
value: numeric2("value").notNull(),
|
|
964
|
+
unit: text34("unit").notNull(),
|
|
965
|
+
comparator: text34("comparator").notNull().default("="),
|
|
966
|
+
resetsAt: timestamp34("resets_at", { withTimezone: true }),
|
|
967
|
+
sourceType: text34("source_type").notNull(),
|
|
968
|
+
sourceUrl: text34("source_url"),
|
|
969
|
+
sourceEvidence: jsonb26("source_evidence"),
|
|
970
|
+
confidence: numeric2("confidence").notNull(),
|
|
971
|
+
userId: uuid32("user_id")
|
|
972
|
+
}, (table) => [
|
|
973
|
+
index30("idx_limit_obs_lookup").on(table.provider, table.plan, table.limitType, table.observedAt.desc()),
|
|
974
|
+
index30("idx_limit_obs_user").on(table.userId, table.observedAt.desc())
|
|
975
|
+
]);
|
|
976
|
+
|
|
977
|
+
// ../../packages/db/dist/schema/tables/provider-docs-snapshots.js
|
|
978
|
+
import { pgTable as pgTable35, text as text35, timestamp as timestamp35, uuid as uuid33, jsonb as jsonb27, boolean as boolean9, uniqueIndex as uniqueIndex13 } from "drizzle-orm/pg-core";
|
|
979
|
+
var providerDocsSnapshots = pgTable35("provider_docs_snapshots", {
|
|
980
|
+
id: uuid33("id").primaryKey().defaultRandom(),
|
|
981
|
+
fetchedAt: timestamp35("fetched_at", { withTimezone: true }).notNull().defaultNow(),
|
|
982
|
+
provider: text35("provider").notNull(),
|
|
983
|
+
docUrl: text35("doc_url").notNull(),
|
|
984
|
+
contentHash: text35("content_hash").notNull(),
|
|
985
|
+
content: text35("content").notNull(),
|
|
986
|
+
parseSuccess: boolean9("parse_success").notNull(),
|
|
987
|
+
parseErrors: jsonb27("parse_errors")
|
|
988
|
+
}, (table) => [
|
|
989
|
+
uniqueIndex13("idx_docs_dedup").on(table.provider, table.docUrl, table.contentHash)
|
|
990
|
+
]);
|
|
991
|
+
|
|
992
|
+
// ../../packages/db/dist/schema/tables/plan-limits-active.js
|
|
993
|
+
import { pgTable as pgTable36, text as text36, numeric as numeric3, timestamp as timestamp36, uuid as uuid34, primaryKey as primaryKey6, index as index31 } from "drizzle-orm/pg-core";
|
|
994
|
+
var planLimitsActive = pgTable36("plan_limits_active", {
|
|
995
|
+
provider: text36("provider").notNull(),
|
|
996
|
+
plan: text36("plan").notNull(),
|
|
997
|
+
limitType: text36("limit_type").notNull(),
|
|
998
|
+
value: numeric3("value").notNull(),
|
|
999
|
+
unit: text36("unit").notNull(),
|
|
1000
|
+
effectiveFrom: timestamp36("effective_from", { withTimezone: true }).notNull(),
|
|
1001
|
+
effectiveUntil: timestamp36("effective_until", { withTimezone: true }),
|
|
1002
|
+
confidence: numeric3("confidence").notNull(),
|
|
1003
|
+
sourceObservationIds: uuid34("source_observation_ids").array().notNull()
|
|
1004
|
+
}, (table) => [
|
|
1005
|
+
primaryKey6({ columns: [table.provider, table.plan, table.limitType, table.effectiveFrom] }),
|
|
1006
|
+
index31("idx_plan_limits_lookup").on(table.provider, table.plan, table.limitType, table.effectiveFrom.desc())
|
|
1007
|
+
]);
|
|
1008
|
+
|
|
1009
|
+
// ../../packages/db/dist/schema/tables/alert-dispatches.js
|
|
1010
|
+
import { pgTable as pgTable37, text as text37, timestamp as timestamp37, uuid as uuid35, jsonb as jsonb28, index as index32 } from "drizzle-orm/pg-core";
|
|
1011
|
+
var alertDispatches = pgTable37("alert_dispatches", {
|
|
1012
|
+
id: uuid35("id").primaryKey().defaultRandom(),
|
|
1013
|
+
userId: uuid35("user_id").notNull(),
|
|
1014
|
+
alertKey: text37("alert_key").notNull(),
|
|
1015
|
+
// 'soft' | 'approaching' | 'imminent' | 'hit'
|
|
1016
|
+
severity: text37("severity").notNull(),
|
|
1017
|
+
lastDispatchedAt: timestamp37("last_dispatched_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1018
|
+
// { used_percentage, resets_at, ... } — snapshot of the input that fired this alert.
|
|
1019
|
+
lastState: jsonb28("last_state").notNull(),
|
|
1020
|
+
// 'in_app' | 'vscode' | 'banner'
|
|
1021
|
+
channel: text37("channel").notNull()
|
|
1022
|
+
}, (table) => [
|
|
1023
|
+
index32("idx_alert_user_key").on(table.userId, table.alertKey, table.lastDispatchedAt.desc())
|
|
1024
|
+
]);
|
|
1025
|
+
|
|
1026
|
+
// ../../packages/db/dist/client.js
|
|
1027
|
+
import { createClient } from "@supabase/supabase-js";
|
|
1028
|
+
import { drizzle } from "drizzle-orm/postgres-js";
|
|
1029
|
+
import postgres from "postgres";
|
|
1030
|
+
|
|
1031
|
+
// ../../packages/db/dist/schema/index.js
|
|
1032
|
+
var schema_exports = {};
|
|
1033
|
+
__export(schema_exports, {
|
|
1034
|
+
INSTRUCTION_SCOPES: () => INSTRUCTION_SCOPES,
|
|
1035
|
+
ORG_ROLES: () => ORG_ROLES,
|
|
1036
|
+
agentJobs: () => agentJobs,
|
|
1037
|
+
agentRuns: () => agentRuns,
|
|
1038
|
+
agentRunsRelations: () => agentRunsRelations,
|
|
1039
|
+
alertDispatches: () => alertDispatches,
|
|
1040
|
+
announcementDeliveries: () => announcementDeliveries,
|
|
1041
|
+
announcements: () => announcements,
|
|
1042
|
+
apiKeys: () => apiKeys,
|
|
1043
|
+
apiKeysRelations: () => apiKeysRelations,
|
|
1044
|
+
benchmarks: () => benchmarks,
|
|
1045
|
+
benchmarksRelations: () => benchmarksRelations,
|
|
1046
|
+
contentBlobs: () => contentBlobs,
|
|
1047
|
+
contextSnapshots: () => contextSnapshots,
|
|
1048
|
+
contextSnapshotsRelations: () => contextSnapshotsRelations,
|
|
1049
|
+
evalConversations: () => evalConversations,
|
|
1050
|
+
evalConversationsRelations: () => evalConversationsRelations,
|
|
1051
|
+
evalJobs: () => evalJobs,
|
|
1052
|
+
evalJobsRelations: () => evalJobsRelations,
|
|
1053
|
+
evalRuns: () => evalRuns,
|
|
1054
|
+
evalRunsRelations: () => evalRunsRelations,
|
|
1055
|
+
evalTargets: () => evalTargets,
|
|
1056
|
+
evalTargetsRelations: () => evalTargetsRelations,
|
|
1057
|
+
evals: () => evals,
|
|
1058
|
+
evalsRelations: () => evalsRelations,
|
|
1059
|
+
extensionAuthCodes: () => extensionAuthCodes,
|
|
1060
|
+
harnessReleases: () => harnessReleases,
|
|
1061
|
+
insightsJobs: () => insightsJobs,
|
|
1062
|
+
insightsReports: () => insightsReports,
|
|
1063
|
+
instructionEvents: () => instructionEvents,
|
|
1064
|
+
instructionEventsRelations: () => instructionEventsRelations,
|
|
1065
|
+
instructionSuggestionEvents: () => instructionSuggestionEvents,
|
|
1066
|
+
instructionSuggestions: () => instructionSuggestions,
|
|
1067
|
+
instructionUsageEvents: () => instructionUsageEvents,
|
|
1068
|
+
instructionUsageEventsRelations: () => instructionUsageEventsRelations,
|
|
1069
|
+
instructionVersions: () => instructionVersions,
|
|
1070
|
+
instructionVersionsRelations: () => instructionVersionsRelations,
|
|
1071
|
+
instructions: () => instructions,
|
|
1072
|
+
instructionsRelations: () => instructionsRelations,
|
|
1073
|
+
launchJobs: () => launchJobs,
|
|
1074
|
+
launchJobsRelations: () => launchJobsRelations,
|
|
1075
|
+
limitObservations: () => limitObservations,
|
|
1076
|
+
modelPricing: () => modelPricing,
|
|
1077
|
+
notificationPreferences: () => notificationPreferences,
|
|
1078
|
+
notifications: () => notifications,
|
|
1079
|
+
optimizationRuns: () => optimizationRuns,
|
|
1080
|
+
optimizationRunsRelations: () => optimizationRunsRelations,
|
|
1081
|
+
orgInvitations: () => orgInvitations,
|
|
1082
|
+
orgInvitationsRelations: () => orgInvitationsRelations,
|
|
1083
|
+
organizations: () => organizations,
|
|
1084
|
+
organizationsRelations: () => organizationsRelations,
|
|
1085
|
+
packInstructions: () => packInstructions,
|
|
1086
|
+
packInstructionsRelations: () => packInstructionsRelations,
|
|
1087
|
+
packs: () => packs,
|
|
1088
|
+
packsRelations: () => packsRelations,
|
|
1089
|
+
planLimitsActive: () => planLimitsActive,
|
|
1090
|
+
profiles: () => profiles,
|
|
1091
|
+
profilesRelations: () => profilesRelations,
|
|
1092
|
+
projectCheckouts: () => projectCheckouts,
|
|
1093
|
+
projectInstructions: () => projectInstructions,
|
|
1094
|
+
projectInstructionsRelations: () => projectInstructionsRelations,
|
|
1095
|
+
projectSignals: () => projectSignals,
|
|
1096
|
+
projects: () => projects,
|
|
1097
|
+
projectsRelations: () => projectsRelations,
|
|
1098
|
+
providerDocsSnapshots: () => providerDocsSnapshots,
|
|
1099
|
+
securityEvents: () => securityEvents,
|
|
1100
|
+
sessionEvents: () => sessionEvents,
|
|
1101
|
+
sessionEventsRelations: () => sessionEventsRelations,
|
|
1102
|
+
sessionInstructions: () => sessionInstructions,
|
|
1103
|
+
sessionInstructionsRelations: () => sessionInstructionsRelations,
|
|
1104
|
+
sessionSendJobs: () => sessionSendJobs,
|
|
1105
|
+
sessionTerminalTargets: () => sessionTerminalTargets,
|
|
1106
|
+
sessions: () => sessions,
|
|
1107
|
+
sessionsRelations: () => sessionsRelations,
|
|
1108
|
+
skillSubmissions: () => skillSubmissions,
|
|
1109
|
+
tasks: () => tasks,
|
|
1110
|
+
teams: () => teams,
|
|
1111
|
+
teamsRelations: () => teamsRelations,
|
|
1112
|
+
triggerEvals: () => triggerEvals,
|
|
1113
|
+
triggerEvalsRelations: () => triggerEvalsRelations,
|
|
1114
|
+
userOrganizations: () => userOrganizations,
|
|
1115
|
+
userOrganizationsRelations: () => userOrganizationsRelations,
|
|
1116
|
+
userTeams: () => userTeams,
|
|
1117
|
+
userTeamsRelations: () => userTeamsRelations,
|
|
1118
|
+
workerConnections: () => workerConnections
|
|
1119
|
+
});
|
|
1120
|
+
|
|
1121
|
+
// ../../packages/db/dist/schema/relations.js
|
|
1122
|
+
import { relations } from "drizzle-orm";
|
|
1123
|
+
var profilesRelations = relations(profiles, ({ many }) => ({
|
|
1124
|
+
sessions: many(sessions),
|
|
1125
|
+
contextSnapshots: many(contextSnapshots),
|
|
1126
|
+
apiKeys: many(apiKeys)
|
|
1127
|
+
}));
|
|
1128
|
+
var apiKeysRelations = relations(apiKeys, ({ one }) => ({
|
|
1129
|
+
profile: one(profiles, {
|
|
1130
|
+
fields: [apiKeys.userId],
|
|
1131
|
+
references: [profiles.id]
|
|
1132
|
+
})
|
|
1133
|
+
}));
|
|
1134
|
+
var organizationsRelations = relations(organizations, ({ many }) => ({
|
|
1135
|
+
teams: many(teams),
|
|
1136
|
+
userOrganizations: many(userOrganizations),
|
|
1137
|
+
projects: many(projects),
|
|
1138
|
+
invitations: many(orgInvitations)
|
|
1139
|
+
}));
|
|
1140
|
+
var teamsRelations = relations(teams, ({ one, many }) => ({
|
|
1141
|
+
organization: one(organizations, {
|
|
1142
|
+
fields: [teams.orgId],
|
|
1143
|
+
references: [organizations.id]
|
|
1144
|
+
}),
|
|
1145
|
+
userTeams: many(userTeams),
|
|
1146
|
+
invitations: many(orgInvitations)
|
|
1147
|
+
}));
|
|
1148
|
+
var orgInvitationsRelations = relations(orgInvitations, ({ one }) => ({
|
|
1149
|
+
organization: one(organizations, {
|
|
1150
|
+
fields: [orgInvitations.orgId],
|
|
1151
|
+
references: [organizations.id]
|
|
1152
|
+
}),
|
|
1153
|
+
team: one(teams, {
|
|
1154
|
+
fields: [orgInvitations.teamId],
|
|
1155
|
+
references: [teams.id]
|
|
1156
|
+
}),
|
|
1157
|
+
inviter: one(profiles, {
|
|
1158
|
+
fields: [orgInvitations.invitedBy],
|
|
1159
|
+
references: [profiles.id]
|
|
1160
|
+
})
|
|
1161
|
+
}));
|
|
1162
|
+
var userOrganizationsRelations = relations(userOrganizations, ({ one }) => ({
|
|
1163
|
+
organization: one(organizations, {
|
|
1164
|
+
fields: [userOrganizations.orgId],
|
|
1165
|
+
references: [organizations.id]
|
|
1166
|
+
})
|
|
1167
|
+
}));
|
|
1168
|
+
var userTeamsRelations = relations(userTeams, ({ one }) => ({
|
|
1169
|
+
team: one(teams, {
|
|
1170
|
+
fields: [userTeams.teamId],
|
|
1171
|
+
references: [teams.id]
|
|
1172
|
+
})
|
|
1173
|
+
}));
|
|
1174
|
+
var instructionsRelations = relations(instructions, ({ one, many }) => ({
|
|
1175
|
+
versions: many(instructionVersions),
|
|
1176
|
+
projectInstructions: many(projectInstructions),
|
|
1177
|
+
events: many(instructionEvents),
|
|
1178
|
+
usageEvents: many(instructionUsageEvents),
|
|
1179
|
+
sessionInstructions: many(sessionInstructions),
|
|
1180
|
+
packInstructions: many(packInstructions),
|
|
1181
|
+
forkedFrom: one(instructions, {
|
|
1182
|
+
fields: [instructions.forkedFromId],
|
|
1183
|
+
references: [instructions.id]
|
|
1184
|
+
})
|
|
1185
|
+
}));
|
|
1186
|
+
var instructionEventsRelations = relations(instructionEvents, ({ one }) => ({
|
|
1187
|
+
instruction: one(instructions, {
|
|
1188
|
+
fields: [instructionEvents.instructionId],
|
|
1189
|
+
references: [instructions.id]
|
|
1190
|
+
})
|
|
1191
|
+
}));
|
|
1192
|
+
var instructionVersionsRelations = relations(instructionVersions, ({ one }) => ({
|
|
1193
|
+
instruction: one(instructions, {
|
|
1194
|
+
fields: [instructionVersions.instructionId],
|
|
1195
|
+
references: [instructions.id]
|
|
1196
|
+
})
|
|
1197
|
+
}));
|
|
1198
|
+
var projectsRelations = relations(projects, ({ one, many }) => ({
|
|
1199
|
+
organization: one(organizations, {
|
|
1200
|
+
fields: [projects.orgId],
|
|
1201
|
+
references: [organizations.id]
|
|
1202
|
+
}),
|
|
1203
|
+
projectInstructions: many(projectInstructions),
|
|
1204
|
+
sessions: many(sessions)
|
|
1205
|
+
}));
|
|
1206
|
+
var projectInstructionsRelations = relations(projectInstructions, ({ one }) => ({
|
|
1207
|
+
project: one(projects, {
|
|
1208
|
+
fields: [projectInstructions.projectId],
|
|
1209
|
+
references: [projects.id]
|
|
1210
|
+
}),
|
|
1211
|
+
instruction: one(instructions, {
|
|
1212
|
+
fields: [projectInstructions.instructionId],
|
|
1213
|
+
references: [instructions.id]
|
|
1214
|
+
})
|
|
1215
|
+
}));
|
|
1216
|
+
var sessionsRelations = relations(sessions, ({ one, many }) => ({
|
|
1217
|
+
profile: one(profiles, {
|
|
1218
|
+
fields: [sessions.userId],
|
|
1219
|
+
references: [profiles.id]
|
|
1220
|
+
}),
|
|
1221
|
+
project: one(projects, {
|
|
1222
|
+
fields: [sessions.projectId],
|
|
1223
|
+
references: [projects.id]
|
|
1224
|
+
}),
|
|
1225
|
+
run: one(agentRuns, {
|
|
1226
|
+
fields: [sessions.runId],
|
|
1227
|
+
references: [agentRuns.id]
|
|
1228
|
+
}),
|
|
1229
|
+
events: many(sessionEvents),
|
|
1230
|
+
sessionInstructions: many(sessionInstructions),
|
|
1231
|
+
contextSnapshots: many(contextSnapshots)
|
|
1232
|
+
}));
|
|
1233
|
+
var agentRunsRelations = relations(agentRuns, ({ one, many }) => ({
|
|
1234
|
+
profile: one(profiles, {
|
|
1235
|
+
fields: [agentRuns.userId],
|
|
1236
|
+
references: [profiles.id]
|
|
1237
|
+
}),
|
|
1238
|
+
organization: one(organizations, {
|
|
1239
|
+
fields: [agentRuns.orgId],
|
|
1240
|
+
references: [organizations.id]
|
|
1241
|
+
}),
|
|
1242
|
+
project: one(projects, {
|
|
1243
|
+
fields: [agentRuns.projectId],
|
|
1244
|
+
references: [projects.id]
|
|
1245
|
+
}),
|
|
1246
|
+
sessions: many(sessions),
|
|
1247
|
+
launchJobs: many(launchJobs)
|
|
1248
|
+
}));
|
|
1249
|
+
var launchJobsRelations = relations(launchJobs, ({ one }) => ({
|
|
1250
|
+
run: one(agentRuns, {
|
|
1251
|
+
fields: [launchJobs.runId],
|
|
1252
|
+
references: [agentRuns.id]
|
|
1253
|
+
})
|
|
1254
|
+
}));
|
|
1255
|
+
var sessionEventsRelations = relations(sessionEvents, ({ one }) => ({
|
|
1256
|
+
session: one(sessions, {
|
|
1257
|
+
fields: [sessionEvents.sessionId],
|
|
1258
|
+
references: [sessions.id]
|
|
1259
|
+
})
|
|
1260
|
+
}));
|
|
1261
|
+
var sessionInstructionsRelations = relations(sessionInstructions, ({ one }) => ({
|
|
1262
|
+
session: one(sessions, {
|
|
1263
|
+
fields: [sessionInstructions.sessionId],
|
|
1264
|
+
references: [sessions.id]
|
|
1265
|
+
}),
|
|
1266
|
+
instruction: one(instructions, {
|
|
1267
|
+
fields: [sessionInstructions.instructionId],
|
|
1268
|
+
references: [instructions.id]
|
|
1269
|
+
})
|
|
1270
|
+
}));
|
|
1271
|
+
var packsRelations = relations(packs, ({ one, many }) => ({
|
|
1272
|
+
packInstructions: many(packInstructions),
|
|
1273
|
+
forkedFrom: one(packs, {
|
|
1274
|
+
fields: [packs.forkedFromId],
|
|
1275
|
+
references: [packs.id]
|
|
1276
|
+
})
|
|
1277
|
+
}));
|
|
1278
|
+
var packInstructionsRelations = relations(packInstructions, ({ one }) => ({
|
|
1279
|
+
pack: one(packs, {
|
|
1280
|
+
fields: [packInstructions.packId],
|
|
1281
|
+
references: [packs.id]
|
|
1282
|
+
}),
|
|
1283
|
+
instruction: one(instructions, {
|
|
1284
|
+
fields: [packInstructions.instructionId],
|
|
1285
|
+
references: [instructions.id]
|
|
1286
|
+
})
|
|
1287
|
+
}));
|
|
1288
|
+
var instructionUsageEventsRelations = relations(instructionUsageEvents, ({ one }) => ({
|
|
1289
|
+
instruction: one(instructions, {
|
|
1290
|
+
fields: [instructionUsageEvents.instructionId],
|
|
1291
|
+
references: [instructions.id]
|
|
1292
|
+
})
|
|
1293
|
+
}));
|
|
1294
|
+
var evalTargetsRelations = relations(evalTargets, ({ one, many }) => ({
|
|
1295
|
+
parent: one(evalTargets, {
|
|
1296
|
+
fields: [evalTargets.parentId],
|
|
1297
|
+
references: [evalTargets.id]
|
|
1298
|
+
}),
|
|
1299
|
+
evals: many(evals),
|
|
1300
|
+
evalRuns: many(evalRuns),
|
|
1301
|
+
benchmarks: many(benchmarks),
|
|
1302
|
+
triggerEvals: many(triggerEvals),
|
|
1303
|
+
optimizationRuns: many(optimizationRuns),
|
|
1304
|
+
evalJobs: many(evalJobs),
|
|
1305
|
+
evalConversations: many(evalConversations)
|
|
1306
|
+
}));
|
|
1307
|
+
var evalsRelations = relations(evals, ({ one, many }) => ({
|
|
1308
|
+
evalTarget: one(evalTargets, {
|
|
1309
|
+
fields: [evals.evalTargetId],
|
|
1310
|
+
references: [evalTargets.id]
|
|
1311
|
+
}),
|
|
1312
|
+
runs: many(evalRuns)
|
|
1313
|
+
}));
|
|
1314
|
+
var evalRunsRelations = relations(evalRuns, ({ one }) => ({
|
|
1315
|
+
eval: one(evals, {
|
|
1316
|
+
fields: [evalRuns.evalId],
|
|
1317
|
+
references: [evals.id]
|
|
1318
|
+
}),
|
|
1319
|
+
evalTarget: one(evalTargets, {
|
|
1320
|
+
fields: [evalRuns.evalTargetId],
|
|
1321
|
+
references: [evalTargets.id]
|
|
1322
|
+
})
|
|
1323
|
+
}));
|
|
1324
|
+
var benchmarksRelations = relations(benchmarks, ({ one }) => ({
|
|
1325
|
+
evalTarget: one(evalTargets, {
|
|
1326
|
+
fields: [benchmarks.evalTargetId],
|
|
1327
|
+
references: [evalTargets.id]
|
|
1328
|
+
})
|
|
1329
|
+
}));
|
|
1330
|
+
var triggerEvalsRelations = relations(triggerEvals, ({ one }) => ({
|
|
1331
|
+
evalTarget: one(evalTargets, {
|
|
1332
|
+
fields: [triggerEvals.evalTargetId],
|
|
1333
|
+
references: [evalTargets.id]
|
|
1334
|
+
})
|
|
1335
|
+
}));
|
|
1336
|
+
var optimizationRunsRelations = relations(optimizationRuns, ({ one }) => ({
|
|
1337
|
+
evalTarget: one(evalTargets, {
|
|
1338
|
+
fields: [optimizationRuns.evalTargetId],
|
|
1339
|
+
references: [evalTargets.id]
|
|
1340
|
+
})
|
|
1341
|
+
}));
|
|
1342
|
+
var evalJobsRelations = relations(evalJobs, ({ one }) => ({
|
|
1343
|
+
evalTarget: one(evalTargets, {
|
|
1344
|
+
fields: [evalJobs.evalTargetId],
|
|
1345
|
+
references: [evalTargets.id]
|
|
1346
|
+
})
|
|
1347
|
+
}));
|
|
1348
|
+
var evalConversationsRelations = relations(evalConversations, ({ one }) => ({
|
|
1349
|
+
evalTarget: one(evalTargets, {
|
|
1350
|
+
fields: [evalConversations.evalTargetId],
|
|
1351
|
+
references: [evalTargets.id]
|
|
1352
|
+
})
|
|
1353
|
+
}));
|
|
1354
|
+
var contextSnapshotsRelations = relations(contextSnapshots, ({ one }) => ({
|
|
1355
|
+
session: one(sessions, {
|
|
1356
|
+
fields: [contextSnapshots.sessionId],
|
|
1357
|
+
references: [sessions.id]
|
|
1358
|
+
}),
|
|
1359
|
+
profile: one(profiles, {
|
|
1360
|
+
fields: [contextSnapshots.userId],
|
|
1361
|
+
references: [profiles.id]
|
|
1362
|
+
})
|
|
1363
|
+
}));
|
|
1364
|
+
|
|
1365
|
+
// ../../packages/db/dist/schema/enums.js
|
|
1366
|
+
var INSTRUCTION_SCOPES = ["org", "team", "project", "personal"];
|
|
1367
|
+
var ORG_ROLES = ["owner", "admin", "member"];
|
|
1368
|
+
|
|
1369
|
+
// ../../packages/db/dist/client.js
|
|
1370
|
+
var _supabase;
|
|
1371
|
+
var _supabaseAdmin;
|
|
1372
|
+
var _db;
|
|
1373
|
+
var _client;
|
|
1374
|
+
var _closed = false;
|
|
1375
|
+
var _closing;
|
|
1376
|
+
var _probeClient;
|
|
1377
|
+
function getEnv(name) {
|
|
1378
|
+
const value = process.env[name];
|
|
1379
|
+
if (!value)
|
|
1380
|
+
throw new Error(`Missing required env var: ${name}`);
|
|
1381
|
+
return value;
|
|
1382
|
+
}
|
|
1383
|
+
function getSupabase() {
|
|
1384
|
+
if (!_supabase) {
|
|
1385
|
+
_supabase = createClient(getEnv("SUPABASE_URL"), getEnv("SUPABASE_ANON_KEY"));
|
|
1386
|
+
}
|
|
1387
|
+
return _supabase;
|
|
1388
|
+
}
|
|
1389
|
+
function getSupabaseAdmin() {
|
|
1390
|
+
if (!_supabaseAdmin) {
|
|
1391
|
+
_supabaseAdmin = createClient(getEnv("SUPABASE_URL"), getEnv("SUPABASE_SERVICE_ROLE_KEY"));
|
|
1392
|
+
}
|
|
1393
|
+
return _supabaseAdmin;
|
|
1394
|
+
}
|
|
1395
|
+
function getDb() {
|
|
1396
|
+
if (_closed) {
|
|
1397
|
+
throw new Error("getDb() called after closeDb(): the connection pool is closed for shutdown. Stop issuing queries (timers/requests) before draining the pool.");
|
|
1398
|
+
}
|
|
1399
|
+
if (!_db) {
|
|
1400
|
+
const appName = process.env.PG_APPLICATION_NAME || "rulemetric";
|
|
1401
|
+
const max = Number(process.env.PG_POOL_MAX) || 3;
|
|
1402
|
+
const connectTimeoutS = Number(process.env.PG_CONNECT_TIMEOUT_S) || 10;
|
|
1403
|
+
const statementTimeoutMs = Number(process.env.PG_STATEMENT_TIMEOUT_MS) || 0;
|
|
1404
|
+
const idleTimeoutS = Number(process.env.PG_IDLE_TIMEOUT) || 5;
|
|
1405
|
+
const keepAliveS = Number(process.env.PG_KEEP_ALIVE_S) || 60;
|
|
1406
|
+
_client = postgres(getEnv("DATABASE_URL"), {
|
|
1407
|
+
prepare: false,
|
|
1408
|
+
max,
|
|
1409
|
+
connect_timeout: connectTimeoutS,
|
|
1410
|
+
idle_timeout: idleTimeoutS,
|
|
1411
|
+
keep_alive: keepAliveS,
|
|
1412
|
+
// Hard rotation cap. Even active connections get closed and replaced
|
|
1413
|
+
// after 5 minutes, defending against long-lived sockets that Supavisor
|
|
1414
|
+
// marks stale for reasons unrelated to idleness (max-lifetime, server
|
|
1415
|
+
// restart, network blip).
|
|
1416
|
+
max_lifetime: 300,
|
|
1417
|
+
connection: {
|
|
1418
|
+
application_name: appName,
|
|
1419
|
+
// postgres-js applies this as the server-side statement_timeout (ms).
|
|
1420
|
+
...statementTimeoutMs > 0 ? { statement_timeout: statementTimeoutMs } : {}
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
_db = drizzle(_client, { schema: schema_exports });
|
|
1424
|
+
}
|
|
1425
|
+
return _db;
|
|
1426
|
+
}
|
|
1427
|
+
async function closeDb() {
|
|
1428
|
+
if (_closing)
|
|
1429
|
+
return _closing;
|
|
1430
|
+
_closed = true;
|
|
1431
|
+
const c = _client;
|
|
1432
|
+
const p = _probeClient;
|
|
1433
|
+
_client = void 0;
|
|
1434
|
+
_db = void 0;
|
|
1435
|
+
_probeClient = void 0;
|
|
1436
|
+
_closing = Promise.allSettled([
|
|
1437
|
+
c ? c.end({ timeout: 5 }) : Promise.resolve(),
|
|
1438
|
+
p ? p.end({ timeout: 5 }) : Promise.resolve()
|
|
1439
|
+
]).then(() => {
|
|
1440
|
+
});
|
|
1441
|
+
return _closing;
|
|
1442
|
+
}
|
|
1443
|
+
var RETRYABLE_CONNECT_CODES = /* @__PURE__ */ new Set([
|
|
1444
|
+
"CONNECT_TIMEOUT",
|
|
1445
|
+
"ETIMEDOUT",
|
|
1446
|
+
"ENOTFOUND",
|
|
1447
|
+
"ECONNREFUSED",
|
|
1448
|
+
"EAI_AGAIN"
|
|
1449
|
+
]);
|
|
1450
|
+
function isRetryableConnectError(err) {
|
|
1451
|
+
const e = err;
|
|
1452
|
+
const code = e?.code ?? e?.cause?.code ?? e?.errno;
|
|
1453
|
+
return code !== void 0 && RETRYABLE_CONNECT_CODES.has(code);
|
|
1454
|
+
}
|
|
1455
|
+
var RETRYABLE_RESET_CODES = /* @__PURE__ */ new Set(["CONNECTION_CLOSED", "ECONNRESET", "EPIPE"]);
|
|
1456
|
+
function isRetryableResetError(err) {
|
|
1457
|
+
const e = err;
|
|
1458
|
+
const code = e?.code ?? e?.cause?.code ?? e?.errno;
|
|
1459
|
+
return code !== void 0 && RETRYABLE_RESET_CODES.has(code);
|
|
1460
|
+
}
|
|
1461
|
+
async function withDbRetry(fn, opts = {}) {
|
|
1462
|
+
const attempts = opts.attempts ?? 3;
|
|
1463
|
+
const baseMs = opts.baseMs ?? 100;
|
|
1464
|
+
let lastErr;
|
|
1465
|
+
for (let i = 0; i < attempts; i++) {
|
|
1466
|
+
try {
|
|
1467
|
+
return await fn();
|
|
1468
|
+
} catch (err) {
|
|
1469
|
+
lastErr = err;
|
|
1470
|
+
const retryable = isRetryableConnectError(err) || opts.retryResets === true && isRetryableResetError(err);
|
|
1471
|
+
if (i === attempts - 1 || !retryable)
|
|
1472
|
+
throw err;
|
|
1473
|
+
await new Promise((resolve) => setTimeout(resolve, baseMs * 2 ** i));
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
throw lastErr;
|
|
1477
|
+
}
|
|
1478
|
+
var RETRY_ENTRY_METHODS = /* @__PURE__ */ new Set([
|
|
1479
|
+
"select",
|
|
1480
|
+
"selectDistinct",
|
|
1481
|
+
"selectDistinctOn",
|
|
1482
|
+
"insert",
|
|
1483
|
+
"update",
|
|
1484
|
+
"delete",
|
|
1485
|
+
"execute",
|
|
1486
|
+
"with",
|
|
1487
|
+
"$count",
|
|
1488
|
+
"refreshMaterializedView"
|
|
1489
|
+
]);
|
|
1490
|
+
var READ_ONLY_ENTRY_METHODS = /* @__PURE__ */ new Set([
|
|
1491
|
+
"select",
|
|
1492
|
+
"selectDistinct",
|
|
1493
|
+
"selectDistinctOn",
|
|
1494
|
+
"$count"
|
|
1495
|
+
]);
|
|
1496
|
+
function wrapBuilder(value, readSafe = false) {
|
|
1497
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
1498
|
+
return value;
|
|
1499
|
+
}
|
|
1500
|
+
return new Proxy(value, {
|
|
1501
|
+
get(target, prop, receiver) {
|
|
1502
|
+
if (prop === "then") {
|
|
1503
|
+
const then = Reflect.get(target, prop, receiver);
|
|
1504
|
+
if (typeof then !== "function")
|
|
1505
|
+
return then;
|
|
1506
|
+
return (onFulfilled, onRejected) => withDbRetry(() => new Promise((resolve, reject) => then.call(target, resolve, reject)), { retryResets: readSafe }).then(onFulfilled, onRejected);
|
|
1507
|
+
}
|
|
1508
|
+
const v = Reflect.get(target, prop, receiver);
|
|
1509
|
+
if (typeof v === "function") {
|
|
1510
|
+
return (...args) => wrapBuilder(v.apply(target, args), readSafe);
|
|
1511
|
+
}
|
|
1512
|
+
return v;
|
|
1513
|
+
}
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
var db = new Proxy({}, {
|
|
1517
|
+
get(_target, prop) {
|
|
1518
|
+
const real4 = getDb();
|
|
1519
|
+
const value = real4[prop];
|
|
1520
|
+
if (typeof prop === "string" && RETRY_ENTRY_METHODS.has(prop) && typeof value === "function") {
|
|
1521
|
+
const readSafe = READ_ONLY_ENTRY_METHODS.has(prop);
|
|
1522
|
+
return (...args) => wrapBuilder(value.apply(real4, args), readSafe);
|
|
1523
|
+
}
|
|
1524
|
+
return value;
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
var supabase = new Proxy({}, {
|
|
1528
|
+
get(_target, prop) {
|
|
1529
|
+
return getSupabase()[prop];
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
var supabaseAdmin = new Proxy({}, {
|
|
1533
|
+
get(_target, prop) {
|
|
1534
|
+
return getSupabaseAdmin()[prop];
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
export {
|
|
1539
|
+
profiles,
|
|
1540
|
+
agentRuns,
|
|
1541
|
+
sessions,
|
|
1542
|
+
sessionEvents,
|
|
1543
|
+
announcements,
|
|
1544
|
+
announcementDeliveries,
|
|
1545
|
+
notificationPreferences,
|
|
1546
|
+
getDb,
|
|
1547
|
+
closeDb
|
|
1548
|
+
};
|
|
1549
|
+
//# sourceMappingURL=chunk-7FAA3YNB.js.map
|