@rulemetric/cli 0.2.1 → 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 -74
- package/dist/lib/handlers/process-session-goal.js.map +7 -1
- 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 +27 -11
- 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 -530
- 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/handlers/process-session-goal.d.ts +0 -29
- package/dist/lib/handlers/process-session-goal.d.ts.map +0 -1
- package/dist/lib/handlers/process-session-goal.test.d.ts +0 -2
- package/dist/lib/handlers/process-session-goal.test.d.ts.map +0 -1
- package/dist/lib/handlers/process-session-goal.test.js +0 -134
- package/dist/lib/handlers/process-session-goal.test.js.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
package/dist/lib/gateway.js
CHANGED
|
@@ -1,216 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const HEALTH_INTERVAL = 3000;
|
|
14
|
-
const HEALTH_TIMEOUT = 500;
|
|
15
|
-
// Floor on auto-restarts so a misconfigured drift can't trigger a restart
|
|
16
|
-
// loop. Plenty long for the user to fix any underlying problem manually.
|
|
17
|
-
const RESTART_COOLDOWN_MS = 60_000;
|
|
18
|
-
const VERSION_FILE = path.join(os.homedir(), '.config', 'rulemetric', 'proxy-addon.version');
|
|
19
|
-
let isProxyAlive = false;
|
|
20
|
-
let lastState = null;
|
|
21
|
-
// Drift state — tracked across health-check ticks. lastSeenAddonVersion is
|
|
22
|
-
// what the file said last time we read it; lastRestartAt prevents loops.
|
|
23
|
-
let lastSeenAddonVersion = null;
|
|
24
|
-
let lastRestartAt = 0;
|
|
25
|
-
function log(msg) {
|
|
26
|
-
const ts = new Date().toISOString();
|
|
27
|
-
console.log(`[${ts}] ${msg}`);
|
|
28
|
-
}
|
|
29
|
-
function readAddonVersion() {
|
|
30
|
-
try {
|
|
31
|
-
return fs.readFileSync(VERSION_FILE, 'utf-8').trim() || null;
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// File may not exist yet (proxy not started, or older addon that doesn't
|
|
35
|
-
// write the file). Returning null disables drift checks for this tick.
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function maybeRestartOnDrift(gatewayCliVersion, cliEntry) {
|
|
40
|
-
// No reference version means we can't compare — skip.
|
|
41
|
-
if (gatewayCliVersion === 'unknown' || !cliEntry)
|
|
42
|
-
return;
|
|
43
|
-
const addonVersion = readAddonVersion();
|
|
44
|
-
if (!addonVersion || addonVersion === 'unknown')
|
|
45
|
-
return;
|
|
46
|
-
// Same as last tick — nothing changed, no need to log or act.
|
|
47
|
-
if (addonVersion === lastSeenAddonVersion)
|
|
48
|
-
return;
|
|
49
|
-
lastSeenAddonVersion = addonVersion;
|
|
50
|
-
if (addonVersion === gatewayCliVersion) {
|
|
51
|
-
// Drift cleared (e.g. proxy was just restarted). Quiet log, no action.
|
|
52
|
-
log(`addon version matches gateway (${gatewayCliVersion})`);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const sinceLast = Date.now() - lastRestartAt;
|
|
56
|
-
if (sinceLast < RESTART_COOLDOWN_MS) {
|
|
57
|
-
log(`addon version drift (gateway=${gatewayCliVersion}, addon=${addonVersion}); ` +
|
|
58
|
-
`restart cooldown active (${Math.round((RESTART_COOLDOWN_MS - sinceLast) / 1000)}s left)`);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
log(`addon version drift detected (gateway=${gatewayCliVersion}, addon=${addonVersion}). ` +
|
|
62
|
-
`Restarting proxy to pick up latest code.`);
|
|
63
|
-
lastRestartAt = Date.now();
|
|
64
|
-
// Detached spawn — we don't want the gateway to block on the restart
|
|
65
|
-
// completing. Output goes to /dev/null; the proxy.log captures the
|
|
66
|
-
// restart events from mitmproxy itself.
|
|
67
|
-
try {
|
|
68
|
-
const child = spawn(process.execPath, [cliEntry, 'proxy', 'restart'], {
|
|
69
|
-
detached: true,
|
|
70
|
-
stdio: 'ignore',
|
|
71
|
-
});
|
|
72
|
-
child.unref();
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
log(`restart spawn failed: ${err.message}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function checkProxyHealth(mitmproxyPort) {
|
|
79
|
-
const sock = net.connect({ port: mitmproxyPort, timeout: HEALTH_TIMEOUT });
|
|
80
|
-
sock.on('connect', () => {
|
|
81
|
-
sock.destroy();
|
|
82
|
-
if (!isProxyAlive) {
|
|
83
|
-
isProxyAlive = true;
|
|
84
|
-
log(`mitmproxy up on :${mitmproxyPort}, routing through proxy`);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
sock.on('error', () => {
|
|
88
|
-
if (isProxyAlive) {
|
|
89
|
-
isProxyAlive = false;
|
|
90
|
-
log(`mitmproxy down on :${mitmproxyPort}, routing direct`);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
sock.on('timeout', () => {
|
|
94
|
-
sock.destroy();
|
|
95
|
-
if (isProxyAlive) {
|
|
96
|
-
isProxyAlive = false;
|
|
97
|
-
log(`mitmproxy timeout on :${mitmproxyPort}, routing direct`);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function handleConnect(req, clientSocket, head, mitmproxyPort) {
|
|
102
|
-
const [targetHost, targetPortStr] = (req.url ?? '').split(':');
|
|
103
|
-
const targetPort = parseInt(targetPortStr, 10) || 443;
|
|
104
|
-
if (isProxyAlive) {
|
|
105
|
-
// Forward CONNECT to mitmproxy
|
|
106
|
-
const proxySocket = net.connect({ port: mitmproxyPort, host: '127.0.0.1' });
|
|
107
|
-
proxySocket.on('connect', () => {
|
|
108
|
-
// Send the CONNECT request to mitmproxy
|
|
109
|
-
proxySocket.write(`CONNECT ${req.url} HTTP/1.1\r\nHost: ${req.url}\r\n\r\n`);
|
|
110
|
-
});
|
|
111
|
-
// Wait for mitmproxy's 200 response before piping
|
|
112
|
-
let responseBuffer = Buffer.alloc(0);
|
|
113
|
-
const onData = (chunk) => {
|
|
114
|
-
responseBuffer = Buffer.concat([responseBuffer, chunk]);
|
|
115
|
-
const responseStr = responseBuffer.toString();
|
|
116
|
-
if (responseStr.includes('\r\n\r\n')) {
|
|
117
|
-
proxySocket.removeListener('data', onData);
|
|
118
|
-
// Forward the 200 to client
|
|
119
|
-
clientSocket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
|
|
120
|
-
// Pipe remaining data and head
|
|
121
|
-
if (head.length > 0)
|
|
122
|
-
proxySocket.write(head);
|
|
123
|
-
clientSocket.pipe(proxySocket);
|
|
124
|
-
proxySocket.pipe(clientSocket);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
proxySocket.on('data', onData);
|
|
128
|
-
proxySocket.on('error', (err) => {
|
|
129
|
-
log(`proxy socket error for ${req.url}: ${err.message}, falling back to direct`);
|
|
130
|
-
// Mitmproxy failed mid-connect, fall back to direct
|
|
131
|
-
connectDirect(req, clientSocket, head, targetHost, targetPort);
|
|
132
|
-
});
|
|
133
|
-
clientSocket.on('error', () => {
|
|
134
|
-
proxySocket.destroy();
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
connectDirect(req, clientSocket, head, targetHost, targetPort);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function connectDirect(req, clientSocket, head, targetHost, targetPort) {
|
|
142
|
-
const upstream = net.connect({ port: targetPort, host: targetHost });
|
|
143
|
-
upstream.on('connect', () => {
|
|
144
|
-
clientSocket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
|
|
145
|
-
if (head.length > 0)
|
|
146
|
-
upstream.write(head);
|
|
147
|
-
clientSocket.pipe(upstream);
|
|
148
|
-
upstream.pipe(clientSocket);
|
|
149
|
-
});
|
|
150
|
-
upstream.on('error', (err) => {
|
|
151
|
-
log(`upstream error for ${req.url}: ${err.message}`);
|
|
152
|
-
clientSocket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
|
|
153
|
-
});
|
|
154
|
-
clientSocket.on('error', () => {
|
|
155
|
-
upstream.destroy();
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
function handleRequest(req, res, mitmproxyPort) {
|
|
159
|
-
// Plain HTTP proxy (non-CONNECT)
|
|
160
|
-
const targetUrl = req.url ?? '';
|
|
161
|
-
let parsedUrl;
|
|
162
|
-
try {
|
|
163
|
-
parsedUrl = new URL(targetUrl);
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
res.writeHead(400);
|
|
167
|
-
res.end('Bad Request');
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const options = {
|
|
171
|
-
hostname: isProxyAlive ? '127.0.0.1' : parsedUrl.hostname,
|
|
172
|
-
port: isProxyAlive ? mitmproxyPort : (parseInt(parsedUrl.port, 10) || 80),
|
|
173
|
-
path: isProxyAlive ? targetUrl : parsedUrl.pathname + parsedUrl.search,
|
|
174
|
-
method: req.method,
|
|
175
|
-
headers: req.headers,
|
|
176
|
-
};
|
|
177
|
-
const proxyReq = http.request(options, (proxyRes) => {
|
|
178
|
-
res.writeHead(proxyRes.statusCode ?? 502, proxyRes.headers);
|
|
179
|
-
proxyRes.pipe(res);
|
|
180
|
-
});
|
|
181
|
-
proxyReq.on('error', (err) => {
|
|
182
|
-
log(`HTTP proxy error for ${targetUrl}: ${err.message}`);
|
|
183
|
-
res.writeHead(502);
|
|
184
|
-
res.end('Bad Gateway');
|
|
185
|
-
});
|
|
186
|
-
req.pipe(proxyReq);
|
|
187
|
-
}
|
|
188
|
-
export function startGateway(port = GATEWAY_PORT, mitmproxyPort = MITMPROXY_PORT, options = {}) {
|
|
189
|
-
const cliVersion = options.cliVersion ?? process.env.RULEMETRIC_CLI_VERSION ?? 'unknown';
|
|
190
|
-
const cliEntry = options.cliEntry ?? process.env.RULEMETRIC_CLI_ENTRY ?? null;
|
|
191
|
-
const server = http.createServer((req, res) => {
|
|
192
|
-
handleRequest(req, res, mitmproxyPort);
|
|
193
|
-
});
|
|
194
|
-
server.on('connect', (req, clientSocket, head) => {
|
|
195
|
-
handleConnect(req, clientSocket, head, mitmproxyPort);
|
|
196
|
-
});
|
|
197
|
-
// Don't crash on client socket errors
|
|
198
|
-
server.on('clientError', (_err, socket) => {
|
|
199
|
-
if (socket.writable) {
|
|
200
|
-
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
const healthInterval = setInterval(() => {
|
|
204
|
-
checkProxyHealth(mitmproxyPort);
|
|
205
|
-
maybeRestartOnDrift(cliVersion, cliEntry);
|
|
206
|
-
}, HEALTH_INTERVAL);
|
|
207
|
-
// Do an immediate check
|
|
208
|
-
checkProxyHealth(mitmproxyPort);
|
|
209
|
-
maybeRestartOnDrift(cliVersion, cliEntry);
|
|
210
|
-
server.listen(port, '127.0.0.1', () => {
|
|
211
|
-
log(`gateway listening on 127.0.0.1:${port} (mitmproxy target: :${mitmproxyPort}, ` +
|
|
212
|
-
`cli version: ${cliVersion})`);
|
|
213
|
-
});
|
|
214
|
-
return { server, healthInterval };
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=gateway.js.map
|
|
1
|
+
import {
|
|
2
|
+
GATEWAY_PORT,
|
|
3
|
+
MITMPROXY_PORT,
|
|
4
|
+
startGateway
|
|
5
|
+
} from "../chunk-PXVQLD7S.js";
|
|
6
|
+
import "../chunk-NSBPE2FW.js";
|
|
7
|
+
export {
|
|
8
|
+
GATEWAY_PORT,
|
|
9
|
+
MITMPROXY_PORT,
|
|
10
|
+
startGateway
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=gateway.js.map
|
package/dist/lib/gateway.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {
|
|
2
|
+
apiPost
|
|
3
|
+
} from "../../chunk-EJOI2ZGU.js";
|
|
4
|
+
import "../../chunk-KZRFUXGF.js";
|
|
5
|
+
import "../../chunk-NSBPE2FW.js";
|
|
6
|
+
|
|
7
|
+
// src/lib/handlers/cron-close-stale-sessions.ts
|
|
8
|
+
var cronCloseStaleSessions = async (_payload, helpers) => {
|
|
9
|
+
const result = await apiPost("/api/sessions/close-stale", {
|
|
10
|
+
maxAgeHours: 4
|
|
11
|
+
});
|
|
12
|
+
helpers.logger.info(
|
|
13
|
+
`Closed ${result.closed} stale session${result.closed === 1 ? "" : "s"} (>${result.maxAgeHours}h idle)`
|
|
14
|
+
);
|
|
7
15
|
};
|
|
8
|
-
|
|
16
|
+
export {
|
|
17
|
+
cronCloseStaleSessions
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=cron-close-stale-sessions.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/handlers/cron-close-stale-sessions.ts"],
|
|
4
|
+
"sourcesContent": ["import type { JobHelpers } from '../job-helpers.js';\nimport { apiPost } from '../api-client.js';\n\ninterface CloseStaleResponse {\n closed: number;\n maxAgeHours: number;\n}\n\nexport const cronCloseStaleSessions = async (_payload: unknown, helpers: JobHelpers): Promise<void> => {\n const result = await apiPost<CloseStaleResponse>('/api/sessions/close-stale', {\n maxAgeHours: 4,\n });\n helpers.logger.info(\n `Closed ${result.closed} stale session${result.closed === 1 ? '' : 's'} (>${result.maxAgeHours}h idle)`,\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAQO,IAAM,yBAAyB,OAAO,UAAmB,YAAuC;AACrG,QAAM,SAAS,MAAM,QAA4B,6BAA6B;AAAA,IAC5E,aAAa;AAAA,EACf,CAAC;AACD,UAAQ,OAAO;AAAA,IACb,UAAU,OAAO,MAAM,iBAAiB,OAAO,WAAW,IAAI,KAAK,GAAG,MAAM,OAAO,WAAW;AAAA,EAChG;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import {
|
|
2
|
+
apiPost
|
|
3
|
+
} from "../../chunk-EJOI2ZGU.js";
|
|
4
|
+
import "../../chunk-KZRFUXGF.js";
|
|
5
|
+
import "../../chunk-NSBPE2FW.js";
|
|
6
|
+
|
|
7
|
+
// src/lib/handlers/cron-data-integrity-audit.ts
|
|
8
|
+
var RECIPIENT_USER_ID = process.env.RULEMETRIC_AUDIT_NOTIFY_USER_ID ?? process.env.RULEMETRIC_USER_ID ?? null;
|
|
9
|
+
var cronDataIntegrityAudit = async (_payload, helpers) => {
|
|
10
|
+
const audit = await apiPost(
|
|
11
|
+
"/api/superadmin/data-integrity-audit",
|
|
12
|
+
RECIPIENT_USER_ID ? { notifyUserId: RECIPIENT_USER_ID } : {}
|
|
13
|
+
);
|
|
14
|
+
const summary = audit.findings.length ? audit.findings.map((f) => `${f.label}: ${f.count}`).join("; ") : "all checks passed";
|
|
15
|
+
helpers.logger.info(
|
|
16
|
+
`Data integrity audit (${audit.generatedAt}): ${summary}` + (audit.notificationWritten ? " [notification written]" : "")
|
|
17
|
+
);
|
|
15
18
|
};
|
|
16
|
-
|
|
19
|
+
export {
|
|
20
|
+
cronDataIntegrityAudit
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=cron-data-integrity-audit.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/handlers/cron-data-integrity-audit.ts"],
|
|
4
|
+
"sourcesContent": ["import type { JobHelpers } from '../job-helpers.js';\nimport { apiPost } from '../api-client.js';\n\ninterface AuditFinding {\n key: string;\n label: string;\n severity: 'high' | 'medium' | 'info';\n count: number;\n}\n\ninterface AuditResponse {\n generatedAt: string;\n totals: Record<string, number>;\n findings: AuditFinding[];\n hasIssues: boolean;\n notificationWritten: boolean;\n}\n\n// The notification recipient. The cron worker has no caller context, so we\n// notify the worker's own user (the API key owner \u2014 also the platform's\n// superadmin). Override via env if you ever want a dedicated audit account.\nconst RECIPIENT_USER_ID =\n process.env.RULEMETRIC_AUDIT_NOTIFY_USER_ID ??\n process.env.RULEMETRIC_USER_ID ??\n null;\n\nexport const cronDataIntegrityAudit = async (_payload: unknown, helpers: JobHelpers): Promise<void> => {\n const audit = await apiPost<AuditResponse>(\n '/api/superadmin/data-integrity-audit',\n RECIPIENT_USER_ID ? { notifyUserId: RECIPIENT_USER_ID } : {},\n );\n\n const summary = audit.findings.length\n ? audit.findings.map((f) => `${f.label}: ${f.count}`).join('; ')\n : 'all checks passed';\n helpers.logger.info(\n `Data integrity audit (${audit.generatedAt}): ${summary}` +\n (audit.notificationWritten ? ' [notification written]' : ''),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAqBA,IAAM,oBACJ,QAAQ,IAAI,mCACZ,QAAQ,IAAI,sBACZ;AAEK,IAAM,yBAAyB,OAAO,UAAmB,YAAuC;AACrG,QAAM,QAAQ,MAAM;AAAA,IAClB;AAAA,IACA,oBAAoB,EAAE,cAAc,kBAAkB,IAAI,CAAC;AAAA,EAC7D;AAEA,QAAM,UAAU,MAAM,SAAS,SAC3B,MAAM,SAAS,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI,IAC7D;AACJ,UAAQ,OAAO;AAAA,IACb,yBAAyB,MAAM,WAAW,MAAM,OAAO,MACpD,MAAM,sBAAsB,4BAA4B;AAAA,EAC7D;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,91 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Fail fast when there's no GITHUB_TOKEN. The unauthenticated GitHub API
|
|
8
|
-
// gives 60 req/hr; this cron does 2 calls per source × ~351 sources = 702
|
|
9
|
-
// calls. Without a token we'd exhaust the cap on the first batch, hit
|
|
10
|
-
// Octokit's throttle plugin, and (pre-fix) sleep up to 57 min per source
|
|
11
|
-
// waiting for the rate window to reset — all while holding a graphile
|
|
12
|
-
// concurrency slot. The bounded-retry change in github-fetcher.ts makes
|
|
13
|
-
// that survivable, but we'd still rather skip cleanly than crawl 702 calls
|
|
14
|
-
// just to skip them all individually. Set GITHUB_TOKEN in the worker env
|
|
15
|
-
// (e.g. via launchctl setenv) to enable.
|
|
16
|
-
if (!process.env.GITHUB_TOKEN) {
|
|
17
|
-
helpers.logger.warn('GITHUB_TOKEN unset — skipping skills registry refresh. Without a token the unauthenticated 60 req/hr cap is too tight for ~351 sources; set GITHUB_TOKEN (5000 req/hr) and re-run.');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
// Combine all source tiers + the discovered set so the cron's coverage
|
|
21
|
-
// matches the bundled registry. De-dupe by repo to avoid double-fetching
|
|
22
|
-
// when discovered overlaps with explicit sources.
|
|
23
|
-
const discovered = loadDiscoveredSources();
|
|
24
|
-
const seen = new Set();
|
|
25
|
-
const sources = [...TIER_1_SOURCES, ...TIER_2_SOURCES, ...discovered].filter((s) => {
|
|
26
|
-
if (seen.has(s.repo))
|
|
27
|
-
return false;
|
|
28
|
-
seen.add(s.repo);
|
|
29
|
-
return true;
|
|
30
|
-
});
|
|
31
|
-
helpers.logger.info(`Fetching from ${sources.length} sources (T1=${TIER_1_SOURCES.length}, T2=${TIER_2_SOURCES.length}, discovered=${discovered.length})`);
|
|
32
|
-
const result = await fetchAllSources(sources, {
|
|
33
|
-
onProgress: (source, count) => helpers.logger.info(`fetched ${count} from ${source}`),
|
|
34
|
-
});
|
|
35
|
-
// Persist JSON-on-disk view (legacy / fast-path consumers).
|
|
36
|
-
const configDir = path.join(os.homedir(), '.config', 'rulemetric');
|
|
37
|
-
await mkdir(configDir, { recursive: true });
|
|
38
|
-
const outPath = path.join(configDir, 'skills-registry.json');
|
|
39
|
-
await writeFile(outPath, JSON.stringify({ generatedAt: new Date().toISOString(), skills: result.entries }, null, 2));
|
|
40
|
-
helpers.logger.info(`Refreshed disk registry: ${result.entries.length} skills`);
|
|
41
|
-
// Mirror to DB as scope='public' instructions rows so the catalog,
|
|
42
|
-
// recommendations, and suggestion-cron all see one source of truth.
|
|
43
|
-
const apiUrl = process.env.RULEMETRIC_API_URL;
|
|
44
|
-
const botToken = process.env.RULEMETRIC_REGISTRY_BOT_TOKEN;
|
|
45
|
-
if (!apiUrl || !botToken) {
|
|
46
|
-
helpers.logger.warn('RULEMETRIC_API_URL or RULEMETRIC_REGISTRY_BOT_TOKEN unset; skipping DB sync');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
let totalInserted = 0;
|
|
50
|
-
let totalUpdated = 0;
|
|
51
|
-
let totalUnchanged = 0;
|
|
52
|
-
let totalFailed = 0;
|
|
53
|
-
for (let i = 0; i < result.entries.length; i += BATCH_SIZE) {
|
|
54
|
-
const batch = result.entries.slice(i, i + BATCH_SIZE).map((s) => ({
|
|
55
|
-
id: s.id,
|
|
56
|
-
name: s.name,
|
|
57
|
-
description: s.description,
|
|
58
|
-
content: s.content,
|
|
59
|
-
source: s.source,
|
|
60
|
-
tags: s.tags,
|
|
61
|
-
category: s.category,
|
|
62
|
-
updatedAt: s.updatedAt,
|
|
63
|
-
popularity: s.popularity,
|
|
64
|
-
}));
|
|
65
|
-
try {
|
|
66
|
-
const res = await fetch(`${apiUrl}/api/skills/sync-public`, {
|
|
67
|
-
method: 'POST',
|
|
68
|
-
headers: {
|
|
69
|
-
'content-type': 'application/json',
|
|
70
|
-
authorization: `Bearer ${botToken}`,
|
|
71
|
-
},
|
|
72
|
-
body: JSON.stringify({ skills: batch }),
|
|
73
|
-
});
|
|
74
|
-
if (!res.ok) {
|
|
75
|
-
helpers.logger.warn(`Batch ${i / BATCH_SIZE} failed: ${res.status} ${await res.text()}`);
|
|
76
|
-
totalFailed += batch.length;
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const json = (await res.json());
|
|
80
|
-
totalInserted += json.inserted;
|
|
81
|
-
totalUpdated += json.updated;
|
|
82
|
-
totalUnchanged += json.unchanged;
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
helpers.logger.warn(`Batch ${i / BATCH_SIZE} threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
86
|
-
totalFailed += batch.length;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
helpers.logger.info(`DB sync: inserted=${totalInserted} updated=${totalUpdated} unchanged=${totalUnchanged} failed=${totalFailed}`);
|
|
1
|
+
import {
|
|
2
|
+
cronRefreshSkills
|
|
3
|
+
} from "../../chunk-RQ2TMLKG.js";
|
|
4
|
+
import "../../chunk-NSBPE2FW.js";
|
|
5
|
+
export {
|
|
6
|
+
cronRefreshSkills
|
|
90
7
|
};
|
|
91
|
-
//# sourceMappingURL=cron-refresh-skills.js.map
|
|
8
|
+
//# sourceMappingURL=cron-refresh-skills.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,159 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
async function checkSkillsRegistryStale() {
|
|
15
|
-
const registryPath = path.join(os.homedir(), '.config', 'rulemetric', 'skills-registry.json');
|
|
16
|
-
try {
|
|
17
|
-
const raw = readFileSync(registryPath, 'utf-8');
|
|
18
|
-
const registry = JSON.parse(raw);
|
|
19
|
-
const ageMs = Date.now() - new Date(registry.generatedAt).getTime();
|
|
20
|
-
return ageMs > STALE_THRESHOLD_HOURS * 60 * 60 * 1000;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export const cronSuggestInstructions = async (_payload, helpers) => {
|
|
27
|
-
// Scoring uses the user's locally-installed LLM tooling — Claude Code CLI
|
|
28
|
-
// when available, otherwise the Anthropic SDK with ANTHROPIC_API_KEY.
|
|
29
|
-
// No third-party LLM_PROVIDER / LLM_API_KEY required. If neither backend
|
|
30
|
-
// is reachable, skip cleanly.
|
|
31
|
-
const backend = detectLlmBackend();
|
|
32
|
-
if (backend === 'none') {
|
|
33
|
-
helpers.logger.warn('No LLM backend available (claude CLI missing and ANTHROPIC_API_KEY unset); skipping suggestion compute');
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
helpers.logger.info(`Scoring backend: ${backend}`);
|
|
37
|
-
// 1. Fetch recent project paths
|
|
38
|
-
let projectPaths;
|
|
39
|
-
try {
|
|
40
|
-
const res = await apiGet('/api/sessions/project-paths?limit=' + MAX_PROJECTS_PER_RUN);
|
|
41
|
-
projectPaths = res.projectPaths;
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
helpers.logger.warn(`Failed to fetch project paths: ${err instanceof Error ? err.message : String(err)}`);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (projectPaths.length === 0) {
|
|
48
|
-
helpers.logger.info('No recent project paths; nothing to score');
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
// 2. Fetch candidate instructions: public+org+team from /catalog, plus
|
|
52
|
-
// the user's own (personal+created) from /instructions. Dedup by id.
|
|
53
|
-
const candidates = new Map();
|
|
54
|
-
try {
|
|
55
|
-
const catalogRows = await apiGet('/api/catalog?limit=200');
|
|
56
|
-
for (const row of catalogRows) {
|
|
57
|
-
candidates.set(row.id, {
|
|
58
|
-
id: row.id,
|
|
59
|
-
name: row.name,
|
|
60
|
-
description: row.description ?? '',
|
|
61
|
-
tags: row.tags ?? [],
|
|
62
|
-
contentPreview: (row.content ?? '').slice(0, CONTENT_PREVIEW_CHARS),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (err) {
|
|
67
|
-
helpers.logger.warn(`Failed to fetch catalog: ${err instanceof Error ? err.message : String(err)}`);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
const personalRes = await apiGet('/api/instructions?limit=100');
|
|
71
|
-
for (const row of personalRes.instructions ?? []) {
|
|
72
|
-
if (!candidates.has(row.id)) {
|
|
73
|
-
candidates.set(row.id, {
|
|
74
|
-
id: row.id,
|
|
75
|
-
name: row.name,
|
|
76
|
-
description: row.description ?? '',
|
|
77
|
-
tags: row.tags ?? [],
|
|
78
|
-
contentPreview: (row.content ?? '').slice(0, CONTENT_PREVIEW_CHARS),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
helpers.logger.warn(`Failed to fetch personal instructions: ${err instanceof Error ? err.message : String(err)}`);
|
|
85
|
-
}
|
|
86
|
-
const candidateList = [...candidates.values()];
|
|
87
|
-
if (candidateList.length === 0) {
|
|
88
|
-
helpers.logger.info('No candidate instructions; nothing to score');
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
helpers.logger.info(`Scoring ${candidateList.length} candidates across ${projectPaths.length} project(s)`);
|
|
92
|
-
// 3. Score per project
|
|
93
|
-
let scored = 0;
|
|
94
|
-
for (const rawPath of projectPaths) {
|
|
95
|
-
try {
|
|
96
|
-
const projectPath = normalizeProjectPath(rawPath);
|
|
97
|
-
const languages = detectLanguages(projectPath);
|
|
98
|
-
if (languages.length === 0) {
|
|
99
|
-
helpers.logger.info(`Skipping ${projectPath}: insufficient language signals`);
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const context = {
|
|
103
|
-
name: path.basename(projectPath),
|
|
104
|
-
description: null,
|
|
105
|
-
languages,
|
|
106
|
-
topics: [],
|
|
107
|
-
dependencies: [],
|
|
108
|
-
};
|
|
109
|
-
const prompt = buildRecommendationPrompt(context, candidateList);
|
|
110
|
-
// runLlmPrompt expects (systemPrompt, data, maxTokens). The recommendation
|
|
111
|
-
// prompt is fully self-contained; pass an empty data block.
|
|
112
|
-
const parsed = await runLlmPrompt(prompt, '', 4096);
|
|
113
|
-
if (!parsed) {
|
|
114
|
-
helpers.logger.warn(`LLM returned null for ${projectPath} (backend ${backend})`);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
const raw = (parsed.recommendations ?? []);
|
|
118
|
-
const recommendations = raw
|
|
119
|
-
.filter((r) => typeof r.instructionId === 'string' && typeof r.score === 'number' && typeof r.reason === 'string')
|
|
120
|
-
.map((r) => ({
|
|
121
|
-
instructionId: r.instructionId,
|
|
122
|
-
score: r.score,
|
|
123
|
-
reason: r.reason,
|
|
124
|
-
}));
|
|
125
|
-
const top = recommendations
|
|
126
|
-
.filter((r) => r.score >= MIN_SCORE)
|
|
127
|
-
.sort((a, b) => b.score - a.score)
|
|
128
|
-
.slice(0, MAX_SUGGESTIONS_PER_PROJECT);
|
|
129
|
-
if (top.length === 0) {
|
|
130
|
-
helpers.logger.info(`No suggestions over threshold for ${projectPath}`);
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
await apiPost('/api/instruction-suggestions/batch-upsert', {
|
|
134
|
-
projectPath,
|
|
135
|
-
suggestions: top.map((r) => ({
|
|
136
|
-
instructionId: r.instructionId,
|
|
137
|
-
score: r.score,
|
|
138
|
-
reason: r.reason,
|
|
139
|
-
})),
|
|
140
|
-
});
|
|
141
|
-
scored++;
|
|
142
|
-
}
|
|
143
|
-
catch (err) {
|
|
144
|
-
helpers.logger.warn(`Failed to score ${rawPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// 4. Mark stale if registry is old
|
|
148
|
-
if (await checkSkillsRegistryStale()) {
|
|
149
|
-
try {
|
|
150
|
-
await apiPost('/api/instruction-suggestions/mark-stale', {});
|
|
151
|
-
helpers.logger.warn('Skills registry is stale (>48h); marked all suggestions stale');
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
// Non-fatal
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
helpers.logger.info(`Done: scored ${scored}/${projectPaths.length} projects`);
|
|
1
|
+
import {
|
|
2
|
+
cronSuggestInstructions
|
|
3
|
+
} from "../../chunk-YBNW7ARH.js";
|
|
4
|
+
import "../../chunk-FZKLLNDS.js";
|
|
5
|
+
import "../../chunk-K3BFZ7KG.js";
|
|
6
|
+
import "../../chunk-EKP32DLN.js";
|
|
7
|
+
import "../../chunk-OQSQC7VB.js";
|
|
8
|
+
import "../../chunk-KRBQLMOP.js";
|
|
9
|
+
import "../../chunk-EJOI2ZGU.js";
|
|
10
|
+
import "../../chunk-KZRFUXGF.js";
|
|
11
|
+
import "../../chunk-NSBPE2FW.js";
|
|
12
|
+
export {
|
|
13
|
+
cronSuggestInstructions
|
|
158
14
|
};
|
|
159
|
-
//# sourceMappingURL=cron-suggest-instructions.js.map
|
|
15
|
+
//# sourceMappingURL=cron-suggest-instructions.js.map
|