@rulemetric/cli 0.7.3 → 0.7.4
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 +1 -14
- package/dist/chunk-2TC6WCUT.js +34 -0
- package/dist/chunk-2UC3ULIG.js +1 -0
- package/dist/chunk-3AV3GTMP.js +1 -0
- package/dist/chunk-4Z5ECCJE.js +1 -0
- package/dist/chunk-5RBLIVBF.js +1 -0
- package/dist/chunk-67QCYUJU.js +1 -0
- package/dist/chunk-6QKI756T.js +2 -0
- package/dist/chunk-6V4WM73L.js +1 -0
- package/dist/chunk-6XEC6474.js +1 -0
- package/dist/chunk-72XLQE3X.js +2 -0
- package/dist/chunk-7DFNBRLY.js +61 -0
- package/dist/chunk-7XQ4VPLC.js +2 -0
- package/dist/chunk-AHRHCERJ.js +1 -0
- package/dist/chunk-ARNZQBMX.js +1 -0
- package/dist/chunk-CADKBP3D.js +58 -0
- package/dist/chunk-CDI5CCHU.js +1 -0
- package/dist/chunk-CNQ5DTNC.js +1 -0
- package/dist/chunk-CRAKDQ4H.js +1 -0
- package/dist/chunk-DNF4HDI6.js +14 -0
- package/dist/chunk-DSO2U4Y6.js +56 -0
- package/dist/chunk-DT4GKEP5.js +5 -0
- package/dist/chunk-DVN7GFJG.js +1 -0
- package/dist/chunk-E4SFUPYR.js +15 -0
- package/dist/chunk-EUHNCVJQ.js +33 -0
- package/dist/chunk-F2VP4B4J.js +1 -0
- package/dist/chunk-FEHM5OKW.js +1 -0
- package/dist/chunk-FHVBTDBM.js +69 -0
- package/dist/chunk-GBMF3TP6.js +1 -0
- package/dist/chunk-GY5IJ4RS.js +1 -0
- package/dist/chunk-HOHD5HY2.js +5 -0
- package/dist/chunk-HP2BUPGS.js +24 -0
- package/dist/{chunk-OQBBVTDG.js → chunk-I2DZGJRR.js} +6 -71
- package/dist/chunk-I4YJ7NTX.js +1 -0
- package/dist/chunk-IY5NXR3N.js +1 -0
- package/dist/chunk-IZTIYR5Q.js +2 -0
- package/dist/chunk-KKDHD4XA.js +2 -0
- package/dist/chunk-LQRYQE6Q.js +4 -0
- package/dist/chunk-M6AJDVCL.js +5 -0
- package/dist/chunk-MGHFDHHM.js +1 -0
- package/dist/chunk-ML36XQW7.js +1 -0
- package/dist/chunk-MODXEGCU.js +1 -0
- package/dist/chunk-MVM6OGAF.js +4 -0
- package/dist/chunk-N7ODX6PO.js +1 -0
- package/dist/chunk-NBTC5FNV.js +1 -0
- package/dist/chunk-NJ5UED3H.js +1 -0
- package/dist/chunk-NVKX36YN.js +3 -0
- package/dist/chunk-NVOTOQBA.js +1 -0
- package/dist/chunk-O7ZMHCMG.js +31 -0
- package/dist/chunk-OMXUK4M6.js +1 -0
- package/dist/chunk-PZS2KOU7.js +1 -0
- package/dist/chunk-RSKQRVPJ.js +1 -0
- package/dist/chunk-RTEATXTP.js +1 -0
- package/dist/chunk-RTWRHIKY.js +7 -0
- package/dist/chunk-RVO4HV3M.js +1 -0
- package/dist/chunk-SBILN45P.js +1 -0
- package/dist/chunk-SZ62CP55.js +1 -0
- package/dist/chunk-T3W5N3BP.js +2 -0
- package/dist/chunk-TDD7IOV2.js +1 -0
- package/dist/chunk-TIQ7DQ3M.js +1 -0
- package/dist/chunk-TU2AR6XO.js +1 -0
- package/dist/chunk-UF6US7VU.js +1 -0
- package/dist/chunk-V5QFOF4F.js +9 -0
- package/dist/chunk-V5U3E4BZ.js +1 -0
- package/dist/chunk-VAFAH6QL.js +1 -0
- package/dist/chunk-VMWY7KHH.js +1 -0
- package/dist/chunk-VUGRXM7R.js +1 -0
- package/dist/{chunk-XZXS2W24.js → chunk-VWEXKDWG.js} +10 -56
- package/dist/chunk-W2MV25SB.js +1 -0
- package/dist/chunk-WJ3H73G6.js +1 -0
- package/dist/chunk-WJUQBMTF.js +9 -0
- package/dist/chunk-WLVQJH4E.js +1 -0
- package/dist/chunk-WPJ2BND4.js +1 -0
- package/dist/chunk-WSCK4WNK.js +1 -0
- package/dist/chunk-Y65CSJFF.js +3 -0
- package/dist/chunk-ZL4MZMUK.js +34 -0
- package/dist/chunk-ZLLER3HP.js +1 -0
- package/dist/chunk-ZXF5NE54.js +1 -0
- package/dist/commands/antigravity/backfill.js +2 -136
- package/dist/commands/auth/create-key.js +1 -52
- package/dist/commands/auth/login.js +1 -85
- package/dist/commands/auth/logout.js +1 -29
- package/dist/commands/auth/revoke-key.js +1 -33
- package/dist/commands/auth/signup.js +1 -89
- package/dist/commands/auth/status.js +1 -42
- package/dist/commands/catalog/index.js +2 -52
- package/dist/commands/catalog/recommend.js +3 -43
- package/dist/commands/convert.js +1 -75
- package/dist/commands/converters.js +1 -54
- package/dist/commands/crons/list.js +1 -41
- package/dist/commands/crons/run.js +2 -76
- package/dist/commands/dashboard.js +1 -46
- package/dist/commands/diagnostics.js +1 -117
- package/dist/commands/eval-targets/create.js +1 -53
- package/dist/commands/eval-targets/list.js +1 -54
- package/dist/commands/evals/agent.js +3 -310
- package/dist/commands/evals/benchmark.js +6 -73
- package/dist/commands/evals/compare.js +13 -96
- package/dist/commands/evals/create.js +1 -67
- package/dist/commands/evals/optimize-description.js +25 -239
- package/dist/commands/evals/optimize.js +5 -211
- package/dist/commands/evals/run.js +3 -183
- package/dist/commands/gateway/ensure.js +1 -104
- package/dist/commands/hooks/emit-instructions.js +1 -25
- package/dist/commands/hooks/install.js +1 -442
- package/dist/commands/hooks/run.js +3 -81
- package/dist/commands/hooks/uninstall.js +2 -156
- package/dist/commands/import.js +1 -66
- package/dist/commands/instructions/create.js +1 -74
- package/dist/commands/instructions/delete.js +1 -55
- package/dist/commands/instructions/fork.js +1 -34
- package/dist/commands/instructions/get.js +1 -68
- package/dist/commands/instructions/list.js +1 -65
- package/dist/commands/instructions/promote.js +1 -42
- package/dist/commands/instructions/pull.js +1 -39
- package/dist/commands/instructions/upstream.js +1 -38
- package/dist/commands/instructions/versions.js +1 -53
- package/dist/commands/launcher.js +1 -40
- package/dist/commands/org/current.js +1 -77
- package/dist/commands/org/list.js +1 -52
- package/dist/commands/org/switch.js +1 -71
- package/dist/commands/packs/add-instruction.js +1 -37
- package/dist/commands/packs/apply.js +1 -39
- package/dist/commands/packs/create.js +1 -50
- package/dist/commands/packs/fork.js +1 -34
- package/dist/commands/packs/get.js +3 -56
- package/dist/commands/packs/list.js +1 -66
- package/dist/commands/packs/remove-instruction.js +1 -35
- package/dist/commands/proxy/env.js +3 -131
- package/dist/commands/proxy/logs.js +3 -85
- package/dist/commands/proxy/restart.js +1 -35
- package/dist/commands/proxy/setup.js +15 -454
- package/dist/commands/proxy/start.js +10 -333
- package/dist/commands/proxy/status.js +1 -78
- package/dist/commands/proxy/stop.js +1 -94
- package/dist/commands/research/backfill.js +1 -59
- package/dist/commands/research/tail-transcript.js +1 -70
- package/dist/commands/service/install.js +57 -796
- package/dist/commands/service/status.js +1 -180
- package/dist/commands/service/uninstall.js +1 -119
- package/dist/commands/sessions/analyze.js +3 -48
- package/dist/commands/sessions/end.js +2 -85
- package/dist/commands/sessions/import.js +1 -46
- package/dist/commands/sessions/list.js +1 -48
- package/dist/commands/sessions/start.js +3 -90
- package/dist/commands/setup.js +3 -150
- package/dist/commands/skills/export-approved.js +1 -46
- package/dist/commands/skills/install.js +4 -107
- package/dist/commands/skills/list.js +4 -65
- package/dist/commands/skills/publish.js +2 -98
- package/dist/commands/skills/search.js +3 -72
- package/dist/commands/skills/update.js +3 -55
- package/dist/commands/suggestions/accept.js +8 -84
- package/dist/commands/suggestions/dismiss.js +1 -45
- package/dist/commands/suggestions/list.js +1 -61
- package/dist/commands/suggestions/refresh.js +1 -27
- package/dist/cursor-T7AMCMKS.js +13 -0
- package/dist/dashboard/Dashboard.js +1 -243
- package/dist/dashboard/data.js +1 -15
- package/dist/dashboard/launcher/ActiveJobsList.js +1 -10
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -16
- package/dist/dashboard/launcher/NewLaunchForm.js +1 -10
- package/dist/dashboard/launcher/api.js +1 -16
- package/dist/dashboard/launcher/tool-labels.js +1 -10
- package/dist/dashboard/launcher/types.js +0 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -11
- package/dist/dashboard/panels/friction.js +1 -10
- package/dist/dashboard/panels/insights.js +1 -10
- package/dist/dashboard/panels/instructions.js +1 -10
- package/dist/dashboard/panels/outcomes.js +1 -10
- package/dist/dashboard/panels/overview.js +1 -10
- package/dist/dashboard/panels/shared.js +1 -19
- package/dist/dashboard/types.js +1 -24
- package/dist/dist-FAVALJ5C.js +1 -0
- package/dist/index.js +1 -8
- package/dist/lib/active-org-refresh.js +1 -15
- package/dist/lib/active-org.js +1 -16
- package/dist/lib/agent-loop.js +1 -47
- package/dist/lib/antigravity-transcript.js +1 -22
- package/dist/lib/api-client.js +1 -23
- package/dist/lib/auth.js +1 -30
- package/dist/lib/capture-hosts.js +1 -8
- package/dist/lib/detect-languages.js +1 -8
- package/dist/lib/detect-tmux.js +1 -9
- package/dist/lib/diagnostics.js +1 -12
- package/dist/lib/editor-proxy-pins.js +1 -14
- package/dist/lib/ensure-api-key.js +1 -11
- package/dist/lib/eval-analyzer.js +1 -9
- package/dist/lib/eval-benchmark.js +1 -12
- package/dist/lib/eval-conversation-handler.js +1 -13
- package/dist/lib/eval-executor.js +1 -8
- package/dist/lib/eval-grader.js +1 -9
- package/dist/lib/eval-meta-judge.js +1 -9
- package/dist/lib/eval-trigger-tester.js +1 -11
- package/dist/lib/eval-worktree.js +1 -8
- package/dist/lib/gateway-entry.js +1 -61
- package/dist/lib/gateway-identity.js +1 -16
- package/dist/lib/gateway-lifecycle.js +1 -32
- package/dist/lib/gateway.js +1 -14
- package/dist/lib/handlers/cron-refresh-pricing.js +1 -0
- package/dist/lib/handlers/cron-refresh-skills.js +1 -8
- package/dist/lib/handlers/cron-suggest-instructions.js +1 -16
- package/dist/lib/handlers/process-announcement.js +1 -11
- package/dist/lib/handlers/process-changelog.js +1 -11
- package/dist/lib/handlers/process-conversation.js +1 -14
- package/dist/lib/handlers/process-eval.js +1 -15
- package/dist/lib/handlers/process-insights.js +1 -15
- package/dist/lib/handlers/process-launch.js +1 -16
- package/dist/lib/handlers/process-run-cleanup.js +1 -13
- package/dist/lib/handlers/process-send-message.js +1 -10
- package/dist/lib/handlers/process-session-goal.js +1 -12
- package/dist/lib/hooks-config.js +1 -81
- package/dist/lib/insights-prompts.js +1 -12
- package/dist/lib/instruction-snapshot.js +1 -8
- package/dist/lib/job-helpers.js +0 -1
- package/dist/lib/llm-client.js +1 -20
- package/dist/lib/manual-tasks-meta.js +1 -8
- package/dist/lib/manual-tasks.js +1 -80
- package/dist/lib/output.js +1 -12
- package/dist/lib/permanent-job-error.js +1 -10
- package/dist/lib/pid-identity.js +1 -14
- package/dist/lib/proxy-respawn.js +1 -12
- package/dist/lib/research-client.js +1 -12
- package/dist/lib/setup-steps.js +1 -33
- package/dist/lib/skills-loader.js +1 -8
- package/dist/lib/statusline-shim.js +1 -20
- package/dist/lib/telemetry.js +1 -16
- package/dist/lib/terminal-target-heartbeat.js +1 -15
- package/dist/lib/tmux.js +1 -16
- package/dist/lib/transcript-rate-limit-watcher.js +1 -22
- package/dist/lib/types.js +1 -8
- package/dist/lib/version-check.js +1 -12
- package/dist/lib/which.js +1 -8
- package/dist/lib/worktree.js +1 -17
- package/dist/opencode-QRJ3BH23.js +1 -0
- package/oclif.manifest.json +135 -135
- package/package.json +9 -8
- package/dist/base-command.js.map +0 -7
- package/dist/chunk-2HK7RGZB.js +0 -82
- package/dist/chunk-2HK7RGZB.js.map +0 -7
- package/dist/chunk-2ORJWTNZ.js +0 -307
- package/dist/chunk-2ORJWTNZ.js.map +0 -7
- package/dist/chunk-37LN5O7M.js +0 -59
- package/dist/chunk-37LN5O7M.js.map +0 -7
- package/dist/chunk-3S7223UR.js +0 -81
- package/dist/chunk-3S7223UR.js.map +0 -7
- package/dist/chunk-3TIMQ3O6.js +0 -96
- package/dist/chunk-3TIMQ3O6.js.map +0 -7
- package/dist/chunk-42GFSAJP.js +0 -32
- package/dist/chunk-42GFSAJP.js.map +0 -7
- package/dist/chunk-4BHDHHKL.js +0 -48
- package/dist/chunk-4BHDHHKL.js.map +0 -7
- package/dist/chunk-4D537GXE.js +0 -99
- package/dist/chunk-4D537GXE.js.map +0 -7
- package/dist/chunk-4LYCDS2N.js +0 -139
- package/dist/chunk-4LYCDS2N.js.map +0 -7
- package/dist/chunk-4SCZK7AL.js +0 -129
- package/dist/chunk-4SCZK7AL.js.map +0 -7
- package/dist/chunk-4XAWK6S2.js +0 -161
- package/dist/chunk-4XAWK6S2.js.map +0 -7
- package/dist/chunk-52WIYRZH.js +0 -73
- package/dist/chunk-52WIYRZH.js.map +0 -7
- package/dist/chunk-5BAOGNUH.js +0 -79
- package/dist/chunk-5BAOGNUH.js.map +0 -7
- package/dist/chunk-5EDMGK3W.js +0 -39
- package/dist/chunk-5EDMGK3W.js.map +0 -7
- package/dist/chunk-6NBS5XFS.js +0 -99
- package/dist/chunk-6NBS5XFS.js.map +0 -7
- package/dist/chunk-7LVVKQMZ.js +0 -98
- package/dist/chunk-7LVVKQMZ.js.map +0 -7
- package/dist/chunk-7NNFYWKK.js +0 -243
- package/dist/chunk-7NNFYWKK.js.map +0 -7
- package/dist/chunk-7NYKWN7U.js +0 -12
- package/dist/chunk-7NYKWN7U.js.map +0 -7
- package/dist/chunk-BO76WKJR.js +0 -42
- package/dist/chunk-BO76WKJR.js.map +0 -7
- package/dist/chunk-BRD5RUGM.js +0 -53
- package/dist/chunk-BRD5RUGM.js.map +0 -7
- package/dist/chunk-BT6Z6545.js +0 -43
- package/dist/chunk-BT6Z6545.js.map +0 -7
- package/dist/chunk-BZDKEQKU.js +0 -39
- package/dist/chunk-BZDKEQKU.js.map +0 -7
- package/dist/chunk-DGHWRQXL.js +0 -17
- package/dist/chunk-DGHWRQXL.js.map +0 -7
- package/dist/chunk-DIQUV5FR.js +0 -257
- package/dist/chunk-DIQUV5FR.js.map +0 -7
- package/dist/chunk-DMX5YOTM.js +0 -167
- package/dist/chunk-DMX5YOTM.js.map +0 -7
- package/dist/chunk-DNKSVWMD.js +0 -108
- package/dist/chunk-DNKSVWMD.js.map +0 -7
- package/dist/chunk-DQ3KELXD.js +0 -74
- package/dist/chunk-DQ3KELXD.js.map +0 -7
- package/dist/chunk-DUJSRBLP.js +0 -122
- package/dist/chunk-DUJSRBLP.js.map +0 -7
- package/dist/chunk-E3BIT53W.js +0 -154
- package/dist/chunk-E3BIT53W.js.map +0 -7
- package/dist/chunk-EARWG4EV.js +0 -22
- package/dist/chunk-EARWG4EV.js.map +0 -7
- package/dist/chunk-EI5BHWXA.js +0 -1662
- package/dist/chunk-EI5BHWXA.js.map +0 -7
- package/dist/chunk-EJ3YAFDP.js +0 -37
- package/dist/chunk-EJ3YAFDP.js.map +0 -7
- package/dist/chunk-EKJ2CABV.js +0 -76
- package/dist/chunk-EKJ2CABV.js.map +0 -7
- package/dist/chunk-EKP32DLN.js +0 -16
- package/dist/chunk-EKP32DLN.js.map +0 -7
- package/dist/chunk-EYPAAGN5.js +0 -51
- package/dist/chunk-EYPAAGN5.js.map +0 -7
- package/dist/chunk-F5N6CLJJ.js +0 -1995
- package/dist/chunk-F5N6CLJJ.js.map +0 -7
- package/dist/chunk-GIUBARWS.js +0 -99
- package/dist/chunk-GIUBARWS.js.map +0 -7
- package/dist/chunk-GQNJO2P2.js +0 -102
- package/dist/chunk-GQNJO2P2.js.map +0 -7
- package/dist/chunk-IJGF2ETG.js +0 -68
- package/dist/chunk-IJGF2ETG.js.map +0 -7
- package/dist/chunk-ILYDELUE.js +0 -46
- package/dist/chunk-ILYDELUE.js.map +0 -7
- package/dist/chunk-J6QFW4LD.js +0 -55
- package/dist/chunk-J6QFW4LD.js.map +0 -7
- package/dist/chunk-J7N3DLH6.js +0 -117
- package/dist/chunk-J7N3DLH6.js.map +0 -7
- package/dist/chunk-JFDWKLQC.js +0 -23
- package/dist/chunk-JFDWKLQC.js.map +0 -7
- package/dist/chunk-JULOLTZS.js +0 -61
- package/dist/chunk-JULOLTZS.js.map +0 -7
- package/dist/chunk-KJKBDQ4D.js +0 -220
- package/dist/chunk-KJKBDQ4D.js.map +0 -7
- package/dist/chunk-KRBQLMOP.js +0 -41
- package/dist/chunk-KRBQLMOP.js.map +0 -7
- package/dist/chunk-LXKPNATC.js +0 -624
- package/dist/chunk-LXKPNATC.js.map +0 -7
- package/dist/chunk-NSBPE2FW.js +0 -17
- package/dist/chunk-NSBPE2FW.js.map +0 -7
- package/dist/chunk-OCKHW72U.js +0 -55
- package/dist/chunk-OCKHW72U.js.map +0 -7
- package/dist/chunk-OKWCKCPE.js +0 -414
- package/dist/chunk-OKWCKCPE.js.map +0 -7
- package/dist/chunk-OO7JDFS4.js +0 -157
- package/dist/chunk-OO7JDFS4.js.map +0 -7
- package/dist/chunk-OQBBVTDG.js.map +0 -7
- package/dist/chunk-OQSQC7VB.js +0 -77
- package/dist/chunk-OQSQC7VB.js.map +0 -7
- package/dist/chunk-PED7L5GX.js +0 -92
- package/dist/chunk-PED7L5GX.js.map +0 -7
- package/dist/chunk-QJQS6TUN.js +0 -44
- package/dist/chunk-QJQS6TUN.js.map +0 -7
- package/dist/chunk-QN34TGD3.js +0 -83
- package/dist/chunk-QN34TGD3.js.map +0 -7
- package/dist/chunk-QSN77T7C.js +0 -250
- package/dist/chunk-QSN77T7C.js.map +0 -7
- package/dist/chunk-R56PH7YE.js +0 -78
- package/dist/chunk-R56PH7YE.js.map +0 -7
- package/dist/chunk-RAXRZYOB.js +0 -299
- package/dist/chunk-RAXRZYOB.js.map +0 -7
- package/dist/chunk-RH7NHVSK.js +0 -16
- package/dist/chunk-RH7NHVSK.js.map +0 -7
- package/dist/chunk-RMTT4KDY.js +0 -191
- package/dist/chunk-RMTT4KDY.js.map +0 -7
- package/dist/chunk-RQ2TMLKG.js +0 -142
- package/dist/chunk-RQ2TMLKG.js.map +0 -7
- package/dist/chunk-SO3T35U7.js +0 -80
- package/dist/chunk-SO3T35U7.js.map +0 -7
- package/dist/chunk-UKMLICWS.js +0 -51
- package/dist/chunk-UKMLICWS.js.map +0 -7
- package/dist/chunk-VA5FFOS7.js +0 -243
- package/dist/chunk-VA5FFOS7.js.map +0 -7
- package/dist/chunk-W2YERO7E.js +0 -170
- package/dist/chunk-W2YERO7E.js.map +0 -7
- package/dist/chunk-W53GKIZQ.js +0 -50
- package/dist/chunk-W53GKIZQ.js.map +0 -7
- package/dist/chunk-WA4MWYRW.js +0 -254
- package/dist/chunk-WA4MWYRW.js.map +0 -7
- package/dist/chunk-XC6M4CSW.js +0 -44
- package/dist/chunk-XC6M4CSW.js.map +0 -7
- package/dist/chunk-XK42ZBDE.js +0 -23
- package/dist/chunk-XK42ZBDE.js.map +0 -7
- package/dist/chunk-XUV6DDBF.js +0 -124
- package/dist/chunk-XUV6DDBF.js.map +0 -7
- package/dist/chunk-XZXS2W24.js.map +0 -7
- package/dist/chunk-Y3WD5CSW.js +0 -49
- package/dist/chunk-Y3WD5CSW.js.map +0 -7
- package/dist/chunk-Y4BJXXYV.js +0 -148
- package/dist/chunk-Y4BJXXYV.js.map +0 -7
- package/dist/chunk-YNIH3KMU.js +0 -121
- package/dist/chunk-YNIH3KMU.js.map +0 -7
- package/dist/chunk-ZUJBM6HE.js +0 -125
- package/dist/chunk-ZUJBM6HE.js.map +0 -7
- package/dist/commands/antigravity/backfill.js.map +0 -7
- package/dist/commands/auth/create-key.js.map +0 -7
- package/dist/commands/auth/login.js.map +0 -7
- package/dist/commands/auth/logout.js.map +0 -7
- package/dist/commands/auth/revoke-key.js.map +0 -7
- package/dist/commands/auth/signup.js.map +0 -7
- package/dist/commands/auth/status.js.map +0 -7
- package/dist/commands/catalog/index.js.map +0 -7
- package/dist/commands/catalog/recommend.js.map +0 -7
- package/dist/commands/convert.js.map +0 -7
- package/dist/commands/converters.js.map +0 -7
- package/dist/commands/crons/list.js.map +0 -7
- package/dist/commands/crons/run.js.map +0 -7
- package/dist/commands/dashboard.js.map +0 -7
- package/dist/commands/diagnostics.js.map +0 -7
- package/dist/commands/eval-targets/create.js.map +0 -7
- package/dist/commands/eval-targets/list.js.map +0 -7
- package/dist/commands/evals/agent.js.map +0 -7
- package/dist/commands/evals/benchmark.js.map +0 -7
- package/dist/commands/evals/compare.js.map +0 -7
- package/dist/commands/evals/create.js.map +0 -7
- package/dist/commands/evals/optimize-description.js.map +0 -7
- package/dist/commands/evals/optimize.js.map +0 -7
- package/dist/commands/evals/run.js.map +0 -7
- package/dist/commands/gateway/ensure.js.map +0 -7
- package/dist/commands/hooks/emit-instructions.js.map +0 -7
- package/dist/commands/hooks/install.js.map +0 -7
- package/dist/commands/hooks/run.js.map +0 -7
- package/dist/commands/hooks/uninstall.js.map +0 -7
- package/dist/commands/import.js.map +0 -7
- package/dist/commands/instructions/create.js.map +0 -7
- package/dist/commands/instructions/delete.js.map +0 -7
- package/dist/commands/instructions/fork.js.map +0 -7
- package/dist/commands/instructions/get.js.map +0 -7
- package/dist/commands/instructions/list.js.map +0 -7
- package/dist/commands/instructions/promote.js.map +0 -7
- package/dist/commands/instructions/pull.js.map +0 -7
- package/dist/commands/instructions/upstream.js.map +0 -7
- package/dist/commands/instructions/versions.js.map +0 -7
- package/dist/commands/launcher.js.map +0 -7
- package/dist/commands/org/current.js.map +0 -7
- package/dist/commands/org/list.js.map +0 -7
- package/dist/commands/org/switch.js.map +0 -7
- package/dist/commands/packs/add-instruction.js.map +0 -7
- package/dist/commands/packs/apply.js.map +0 -7
- package/dist/commands/packs/create.js.map +0 -7
- package/dist/commands/packs/fork.js.map +0 -7
- package/dist/commands/packs/get.js.map +0 -7
- package/dist/commands/packs/list.js.map +0 -7
- package/dist/commands/packs/remove-instruction.js.map +0 -7
- package/dist/commands/proxy/env.js.map +0 -7
- package/dist/commands/proxy/logs.js.map +0 -7
- package/dist/commands/proxy/restart.js.map +0 -7
- package/dist/commands/proxy/setup.js.map +0 -7
- package/dist/commands/proxy/start.js.map +0 -7
- package/dist/commands/proxy/status.js.map +0 -7
- package/dist/commands/proxy/stop.js.map +0 -7
- package/dist/commands/research/backfill.js.map +0 -7
- package/dist/commands/research/tail-transcript.js.map +0 -7
- package/dist/commands/service/install.js.map +0 -7
- package/dist/commands/service/status.js.map +0 -7
- package/dist/commands/service/uninstall.js.map +0 -7
- package/dist/commands/sessions/analyze.js.map +0 -7
- package/dist/commands/sessions/end.js.map +0 -7
- package/dist/commands/sessions/import.js.map +0 -7
- package/dist/commands/sessions/list.js.map +0 -7
- package/dist/commands/sessions/start.js.map +0 -7
- package/dist/commands/setup.js.map +0 -7
- package/dist/commands/skills/export-approved.js.map +0 -7
- package/dist/commands/skills/install.js.map +0 -7
- package/dist/commands/skills/list.js.map +0 -7
- package/dist/commands/skills/publish.js.map +0 -7
- package/dist/commands/skills/search.js.map +0 -7
- package/dist/commands/skills/update.js.map +0 -7
- package/dist/commands/suggestions/accept.js.map +0 -7
- package/dist/commands/suggestions/dismiss.js.map +0 -7
- package/dist/commands/suggestions/list.js.map +0 -7
- package/dist/commands/suggestions/refresh.js.map +0 -7
- package/dist/cursor-BGQJ4CWI.js +0 -134
- package/dist/cursor-BGQJ4CWI.js.map +0 -7
- package/dist/dashboard/Dashboard.js.map +0 -7
- package/dist/dashboard/data.js.map +0 -7
- package/dist/dashboard/launcher/ActiveJobsList.js.map +0 -7
- package/dist/dashboard/launcher/LauncherOverlay.js.map +0 -7
- package/dist/dashboard/launcher/NewLaunchForm.js.map +0 -7
- package/dist/dashboard/launcher/api.js.map +0 -7
- package/dist/dashboard/launcher/tool-labels.js.map +0 -7
- package/dist/dashboard/launcher/types.js.map +0 -7
- package/dist/dashboard/launcher/useLaunchJobs.js.map +0 -7
- package/dist/dashboard/panels/friction.js.map +0 -7
- package/dist/dashboard/panels/insights.js.map +0 -7
- package/dist/dashboard/panels/instructions.js.map +0 -7
- package/dist/dashboard/panels/outcomes.js.map +0 -7
- package/dist/dashboard/panels/overview.js.map +0 -7
- package/dist/dashboard/panels/shared.js.map +0 -7
- package/dist/dashboard/types.js.map +0 -7
- package/dist/dist-UNYP5PJR.js +0 -56
- package/dist/dist-UNYP5PJR.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/lib/active-org-refresh.js.map +0 -7
- package/dist/lib/active-org.js.map +0 -7
- package/dist/lib/agent-loop.js.map +0 -7
- package/dist/lib/antigravity-transcript.js.map +0 -7
- package/dist/lib/api-client.js.map +0 -7
- package/dist/lib/auth.js.map +0 -7
- package/dist/lib/capture-hosts.js.map +0 -7
- package/dist/lib/detect-languages.js.map +0 -7
- package/dist/lib/detect-tmux.js.map +0 -7
- package/dist/lib/diagnostics.js.map +0 -7
- package/dist/lib/editor-proxy-pins.js.map +0 -7
- package/dist/lib/ensure-api-key.js.map +0 -7
- package/dist/lib/eval-analyzer.js.map +0 -7
- package/dist/lib/eval-benchmark.js.map +0 -7
- package/dist/lib/eval-conversation-handler.js.map +0 -7
- package/dist/lib/eval-executor.js.map +0 -7
- package/dist/lib/eval-grader.js.map +0 -7
- package/dist/lib/eval-meta-judge.js.map +0 -7
- package/dist/lib/eval-trigger-tester.js.map +0 -7
- package/dist/lib/eval-worktree.js.map +0 -7
- package/dist/lib/gateway-entry.js.map +0 -7
- package/dist/lib/gateway-identity.js.map +0 -7
- package/dist/lib/gateway-lifecycle.js.map +0 -7
- package/dist/lib/gateway.js.map +0 -7
- package/dist/lib/handlers/cron-refresh-skills.js.map +0 -7
- package/dist/lib/handlers/cron-suggest-instructions.js.map +0 -7
- package/dist/lib/handlers/process-announcement.js.map +0 -7
- package/dist/lib/handlers/process-changelog.js.map +0 -7
- package/dist/lib/handlers/process-conversation.js.map +0 -7
- package/dist/lib/handlers/process-eval.js.map +0 -7
- package/dist/lib/handlers/process-insights.js.map +0 -7
- package/dist/lib/handlers/process-launch.js.map +0 -7
- package/dist/lib/handlers/process-run-cleanup.js.map +0 -7
- package/dist/lib/handlers/process-send-message.js.map +0 -7
- package/dist/lib/handlers/process-session-goal.js.map +0 -7
- package/dist/lib/hooks-config.js.map +0 -7
- package/dist/lib/insights-prompts.js.map +0 -7
- package/dist/lib/instruction-snapshot.js.map +0 -7
- package/dist/lib/job-helpers.js.map +0 -7
- package/dist/lib/llm-client.js.map +0 -7
- package/dist/lib/manual-tasks-meta.js.map +0 -7
- package/dist/lib/manual-tasks.js.map +0 -7
- package/dist/lib/output.js.map +0 -7
- package/dist/lib/permanent-job-error.js.map +0 -7
- package/dist/lib/pid-identity.js.map +0 -7
- package/dist/lib/proxy-respawn.js.map +0 -7
- package/dist/lib/research-client.js.map +0 -7
- package/dist/lib/setup-steps.js.map +0 -7
- package/dist/lib/skills-loader.js.map +0 -7
- package/dist/lib/statusline-shim.js.map +0 -7
- package/dist/lib/telemetry.js.map +0 -7
- package/dist/lib/terminal-target-heartbeat.js.map +0 -7
- package/dist/lib/tmux.js.map +0 -7
- package/dist/lib/transcript-rate-limit-watcher.js.map +0 -7
- package/dist/lib/types.js.map +0 -7
- package/dist/lib/version-check.js.map +0 -7
- package/dist/lib/which.js.map +0 -7
- package/dist/lib/worktree.js.map +0 -7
- package/dist/opencode-IQ7X5YMJ.js +0 -190
- package/dist/opencode-IQ7X5YMJ.js.map +0 -7
package/dist/base-command.js
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
BaseCommand
|
|
3
|
-
} from "./chunk-2HK7RGZB.js";
|
|
4
|
-
import "./chunk-R56PH7YE.js";
|
|
5
|
-
import "./chunk-GQNJO2P2.js";
|
|
6
|
-
import "./chunk-37LN5O7M.js";
|
|
7
|
-
import "./chunk-EKJ2CABV.js";
|
|
8
|
-
import "./chunk-ZUJBM6HE.js";
|
|
9
|
-
import "./chunk-W2YERO7E.js";
|
|
10
|
-
import "./chunk-NSBPE2FW.js";
|
|
11
|
-
export {
|
|
12
|
-
BaseCommand
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=base-command.js.map
|
|
1
|
+
import{a}from"./chunk-LQRYQE6Q.js";import"./chunk-IZTIYR5Q.js";import"./chunk-CRAKDQ4H.js";import"./chunk-WPJ2BND4.js";import"./chunk-3AV3GTMP.js";import"./chunk-TIQ7DQ3M.js";import"./chunk-M6AJDVCL.js";import"./chunk-ZLLER3HP.js";export{a as BaseCommand};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{a as u}from"./chunk-MGHFDHHM.js";import{a as o}from"./chunk-ZLLER3HP.js";var l=`You are a meta-judge evaluating the quality of an eval run \u2014 not the code output, but whether the test cases and grading themselves are rigorous and meaningful.
|
|
2
|
+
|
|
3
|
+
You will receive a summary of eval cases, their expectations, and grading results.
|
|
4
|
+
|
|
5
|
+
Analyze for these quality issues:
|
|
6
|
+
|
|
7
|
+
1. **Weak expectations** \u2014 Expectations that are vague ("should follow conventions") or trivially satisfiable. Good expectations are specific and falsifiable.
|
|
8
|
+
|
|
9
|
+
2. **Inconsistent grading** \u2014 Cases where similar expectations get different pass/fail results, or where evidence doesn't match the verdict.
|
|
10
|
+
|
|
11
|
+
3. **Trivial tests** \u2014 Cases where the prompt doesn't actually challenge the rule. E.g., testing "NEVER use mocks" with a prompt that doesn't involve testing at all.
|
|
12
|
+
|
|
13
|
+
4. **Untestable expectations** \u2014 Expectations that can't be verified from the output alone (e.g., "the developer should feel confident").
|
|
14
|
+
|
|
15
|
+
5. **Suspicious 100% pass** \u2014 If every expectation passes, consider whether the tests were actually challenging enough.
|
|
16
|
+
|
|
17
|
+
Respond in JSON:
|
|
18
|
+
{
|
|
19
|
+
"quality_score": <1-5>,
|
|
20
|
+
"issues": [
|
|
21
|
+
{
|
|
22
|
+
"type": "weak_expectation | inconsistent_grading | trivial_test | untestable_expectation | all_pass_suspicious",
|
|
23
|
+
"severity": "low | medium | high",
|
|
24
|
+
"description": "<specific issue>",
|
|
25
|
+
"affected_eval": "<eval name if applicable>"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"recommendations": ["<specific improvement suggestion>", ...],
|
|
29
|
+
"summary": "<1-2 sentence overall assessment>"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Be constructive but honest. A quality_score of 3 means acceptable, 4 means good, 5 means rigorous. Most real-world eval runs score 2-4.`;async function p(t){let i=t.evalResults.map(e=>{let r=e.grading?{pass_rate:e.grading.summary.pass_rate,expectations:e.grading.expectations.map(s=>({text:s.text,passed:s.passed,evidence:s.evidence.slice(0,200)})),feedback:e.grading.eval_feedback?.overall??""}:null;return{eval_name:e.evalName,prompt:e.prompt.slice(0,500),expectations:e.expectations,grading:r,output_preview:e.output?.slice(0,300)??"(not available)"}}),c=`Evaluate the quality of this eval run for target "${t.targetName}":
|
|
33
|
+
|
|
34
|
+
${JSON.stringify(i,null,2)}`,n=await u({prompt:c,systemPrompt:l,timeout:t.timeout??6e4,model:t.model});if(n.error||!n.output)return{quality_score:0,issues:[{type:"inconsistent_grading",severity:"high",description:`Meta-judge failed: ${n.error??"no output"}`}],recommendations:["Meta-judge could not complete \u2014 check model availability"],summary:"Meta-judge execution failed."};try{let e=m(n.output),r=Array.isArray(e.issues)?e.issues:[],s=Array.isArray(e.recommendations)?e.recommendations:[];return{quality_score:Math.max(1,Math.min(5,Number(e.quality_score)||3)),issues:r.map(a=>({type:a.type??"weak_expectation",severity:a.severity??"medium",description:String(a.description??""),affected_eval:a.affected_eval?String(a.affected_eval):void 0})),recommendations:s,summary:String(e.summary??"No summary provided.")}}catch{return{quality_score:3,issues:[],recommendations:[],summary:"Meta-judge returned unparseable output \u2014 defaulting to neutral score."}}}o(p,"judgeEvalQuality");function m(t){try{return JSON.parse(t)}catch{let i=t.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);if(i)return JSON.parse(i[1]);throw new Error("No JSON found in output")}}o(m,"parseJsonFromOutput");export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o,e as a}from"./chunk-TIQ7DQ3M.js";import{a as n}from"./chunk-ZLLER3HP.js";function c(e){return e==null?e??null:e instanceof Date?e.toISOString():e}n(c,"serializeDate");async function d(e){let r={provider:e.provider,plan:e.plan,limitType:e.limitType,value:e.value,unit:e.unit,comparator:e.comparator,resetsAt:c(e.resetsAt),sourceType:e.sourceType,sourceUrl:e.sourceUrl,sourceEvidence:e.sourceEvidence,confidence:e.confidence,observedAt:c(e.observedAt)};return a("/api/internal/research/observe",r)}n(d,"postObservation");async function f(e){let r=0,i=0,s=[];for(let u of e)try{await d(u),r++}catch(t){i++;let p=t instanceof o?`HTTP ${t.statusCode}: ${t.message}`:String(t);s.length<5&&s.push(p)}return{posted:r,failed:i,errors:s}}n(f,"postObservations");export{d as a,f as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-ZLLER3HP.js";import*as r from"node:fs";import*as l from"node:os";import*as u from"node:path";var d=300*1e3;function f(){return process.env.RULEMETRIC_CONFIG_DIR||u.join(l.homedir(),".config","rulemetric")}e(f,"getConfigDir");function s(){return u.join(f(),"active-org")}e(s,"getActiveOrgFile");function a(){let n=process.env.RULEMETRIC_ORG_ID;if(n&&n.trim())return{orgId:n.trim()};let o=s(),i;try{i=r.readFileSync(o,"utf-8")}catch{return null}let t;try{t=JSON.parse(i)}catch{return null}if(!t||typeof t!="object"||!("orgId"in t)||typeof t.orgId!="string")return null;let c=t,g={orgId:c.orgId};return typeof c.orgSlug=="string"&&(g.orgSlug=c.orgSlug),typeof c.syncedAt=="number"&&(g.syncedAt=c.syncedAt),g}e(a,"readActiveOrg");function p(n){let o=f();r.mkdirSync(o,{recursive:!0,mode:448});let i=s(),t=`${i}.tmp`;r.writeFileSync(t,JSON.stringify(n,null,2),{encoding:"utf-8",mode:384}),r.renameSync(t,i)}e(p,"writeActiveOrg");function y(){try{r.unlinkSync(s())}catch{}}e(y,"clearActiveOrg");function m(n,o=d){return typeof n.syncedAt!="number"?!1:Date.now()-n.syncedAt>o}e(m,"isStale");var v={getActiveOrgFile:s,getConfigDir:f};export{a,p as b,y as c,m as d,v as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as c,e as h}from"./chunk-ARNZQBMX.js";import{d as i,f as _}from"./chunk-NJ5UED3H.js";import{a as x}from"./chunk-ZLLER3HP.js";import{Box as w,Text as t}from"ink";import{Fragment as S,jsx as e,jsxs as s}from"react/jsx-runtime";function v({local:n,api:o,label:p,width:C}){let f=o?.total_sessions??n.totalSessions,a=o?.total_messages??0,l=o?.total_input_tokens??n.totalInputTokens,k=o?.total_output_tokens??n.totalOutputTokens,r=o?.total_cache_read_tokens??n.totalCacheReadTokens,d=o?.total_cache_write_tokens??n.totalCacheWriteTokens,g=o?.estimated_cost_usd??n.totalCostUSD,m=o?.days_active??0,T=o?.git_commits??0,u=l+r+d,b=u>0?r/u*100:0;return s(w,{flexDirection:"column",borderStyle:"round",borderColor:i,paddingX:1,width:C,children:[s(t,{wrap:"truncate-end",children:[e(t,{bold:!0,color:i,children:"RuleMetric"}),s(t,{dimColor:!0,children:[" ",p]}),o&&e(t,{color:"#5BF58C",children:" \u25CF API connected"}),!o&&e(t,{color:"#F55B5B",children:" \u25CB API offline"})]}),s(t,{wrap:"truncate-end",children:[e(t,{bold:!0,color:_,children:h(g)}),e(t,{dimColor:!0,children:" cost "}),e(t,{bold:!0,children:String(f)}),e(t,{dimColor:!0,children:" sessions "}),a>0&&s(S,{children:[e(t,{bold:!0,children:a.toLocaleString()}),e(t,{dimColor:!0,children:" messages "})]}),s(t,{bold:!0,children:[b.toFixed(1),"%"]}),e(t,{dimColor:!0,children:" cache hit"})]}),s(t,{dimColor:!0,wrap:"truncate-end",children:[c(l)," in ",c(k)," out ",c(r)," cached ",c(d)," written",m>0?` ${m} days active`:"",T>0?` ${T} commits`:""]})]})}x(v,"Overview");export{v as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk-ZLLER3HP.js";var e=class extends Error{static{n(this,"PermanentJobError")}__isPermanentJobError=!0;constructor(o){super(o),this.name="PermanentJobError"}};function t(r){return r instanceof Error&&r.__isPermanentJobError===!0}n(t,"isPermanentJobError");export{e as a,t as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-ZLLER3HP.js";import{existsSync as p}from"node:fs";import{homedir as u}from"node:os";import{join as o,delimiter as d}from"node:path";function b(r,n){return r==="darwin"?["/opt/homebrew/bin","/opt/homebrew/sbin","/usr/local/bin",o(n,".local/bin")]:r==="linux"?["/usr/local/bin","/usr/bin",o(n,".local/bin")]:[]}i(b,"wellKnownBinDirs");function g(r,n={}){let t=n.platform??process.platform,s=n.home??u(),l=(n.pathEnv??process.env.PATH??"").split(d).filter(Boolean),a=[...new Set([...l,...b(t,s)])],f=t==="win32"?["",...(process.env.PATHEXT||".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean)]:[""];for(let c of a)for(let m of f){let e=o(c,r+m);if(p(e))return e}return null}i(g,"findBinary");export{g as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{y as w}from"./chunk-7DFNBRLY.js";import{a as m}from"./chunk-N7ODX6PO.js";import{a as s}from"./chunk-ZLLER3HP.js";import{spawn as g}from"node:child_process";import d from"node:fs";import b from"node:path";function c(e,t){return new Promise((r,n)=>{let o=g("git",e,{cwd:t,stdio:["ignore","pipe","pipe"],env:m()}),i="",f="";o.stdout.on("data",a=>{i+=a.toString()}),o.stderr.on("data",a=>{f+=a.toString()}),o.on("error",a=>n(new Error(`git ${e.join(" ")} failed to spawn: ${a.message}`))),o.on("close",a=>{a===0?r({code:a,stdout:i,stderr:f}):n(new Error(`git ${e.join(" ")} exited ${a}: ${f.trim()||i.trim()}`))})})}s(c,"runGit");async function k(e,t){if(!t||!t.trim())throw new Error('invalid branch name "": branch must be a non-empty git refname');if(t.startsWith("-"))throw new Error(`invalid branch name "${t}": must not start with "-" (git would parse it as an option)`);if(/\s/.test(t))throw new Error(`invalid branch name "${t}": must not contain whitespace`);try{await c(["check-ref-format","--branch",t],e)}catch{throw new Error(`invalid branch name "${t}": not a valid git refname`)}}s(k,"assertValidBranch");function h(e){let t=b.resolve(e);try{return d.realpathSync(t)}catch{return t}}s(h,"canonical");function y(e){let t=[],r=null;for(let n of e.split(`
|
|
2
|
+
`))n.startsWith("worktree ")?(r&&t.push(r),r={path:n.slice(9).trim()}):n.startsWith("branch ")&&r&&(r.branch=n.slice(7).trim().replace(/^refs\/heads\//,""));return r&&t.push(r),t}s(y,"parseWorktreeList");async function v(e,t){try{return await c(["show-ref","--verify","--quiet",`refs/heads/${t}`],e),!0}catch{return!1}}s(v,"branchExists");async function B(e){let{repoRoot:t,branch:r,baseRef:n,allowExistingBranch:o=!1}=e;await k(t,r);let i=w({repoRoot:t,branch:r,basePath:e.basePath}),f=await c(["worktree","list","--porcelain"],t),a=y(f.stdout),p=a.find(u=>u.branch===r);if(p)return{path:h(p.path),branch:r,created:!1};let l=a.find(u=>h(u.path)===i);if(l)return{path:h(l.path),branch:l.branch??r,created:!1};if(await v(t,r)){if(!o)throw new Error(`branch "${r}" already exists with no worktree; refusing to clobber (pass allowExistingBranch:true to attach a worktree onto it)`);return await c(["worktree","add",i,r],t),{path:h(i),branch:r,created:!0}}return await c(["worktree","add",i,"-b",r,n],t),{path:h(i),branch:r,created:!0}}s(B,"ensureWorktree");async function S(e){let{repoRoot:t,worktreePath:r}=e;if(!d.existsSync(r))return{removed:!1,reason:"absent"};let n=!1;try{n=(await c(["status","--porcelain"],r)).stdout.trim().length>0}catch{n=!1}if(n)return{removed:!1,reason:"dirty"};try{return await c(["worktree","remove",r],t),{removed:!0}}catch(o){let i=o instanceof Error?o.message:String(o);if(/not a working tree|No such file or directory|not a valid path|is not a working tree/i.test(i))return{removed:!1,reason:"absent"};throw o}}s(S,"removeWorktree");export{c as a,B as b,S as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-ZLLER3HP.js";import{execSync as o}from"node:child_process";import{mkdtempSync as n,rmSync as m,existsSync as u}from"node:fs";import{join as k}from"node:path";import{tmpdir as f}from"node:os";function y(c){let t=c??process.cwd(),s=k(f(),"rulemetric-eval-");try{o("git rev-parse --git-dir",{cwd:t,stdio:"pipe"})}catch{let r=n(s);return{workDir:r,cleanup:e(()=>p(r),"cleanup"),isWorktree:!1}}let a;try{a=o("git rev-parse HEAD",{cwd:t,stdio:"pipe"}).toString().trim()}catch{let r=n(s);return{workDir:r,cleanup:e(()=>p(r),"cleanup"),isWorktree:!1}}let i=n(s);m(i,{recursive:!0});try{o(`git worktree add --detach "${i}" ${a}`,{cwd:t,stdio:"pipe"})}catch{let r=n(s);return{workDir:r,cleanup:e(()=>p(r),"cleanup"),isWorktree:!1}}return{workDir:i,cleanup:e(()=>{try{o(`git worktree remove --force "${i}"`,{cwd:t,stdio:"pipe"})}catch{p(i);try{o("git worktree prune",{cwd:t,stdio:"pipe"})}catch{}}},"cleanup"),isWorktree:!0}}e(y,"createEvalWorktree");function p(c){try{u(c)&&m(c,{recursive:!0,force:!0})}catch{}}e(p,"safeRm");export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-N7ODX6PO.js";import{a as i}from"./chunk-ZLLER3HP.js";import{spawn as u}from"node:child_process";function s(){return new Promise(e=>{let t;try{t=u("tmux",["-V"],{stdio:["ignore","pipe","pipe"],env:o()})}catch{e({available:!1});return}let n="";t.stdout?.on("data",a=>{n+=a.toString()}),t.stderr?.on("data",()=>{}),t.on("error",()=>{e({available:!1})}),t.on("close",a=>{if(a!==0){e({available:!1});return}let r=n.trim().match(/^tmux\s+(\S+)/);e({available:!0,version:r?r[1]:void 0})})})}i(s,"detectTmux");export{s as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as P}from"./chunk-FHVBTDBM.js";import{a as h,e as o,f as u,g as c,h as D}from"./chunk-NVOTOQBA.js";import{a as $}from"./chunk-5RBLIVBF.js";import{a as E}from"./chunk-ZLLER3HP.js";import{and as U,asc as x,eq as m,gt as C,isNotNull as T}from"drizzle-orm";var B=100,S=10;async function F(y,t={}){let e=t.db??D(),I=t.sendEmail??P,g=t.log??(n=>process.stderr.write(`[process_announcement] ${n}
|
|
2
|
+
`)),b=t.webBaseUrl??process.env.RULEMETRIC_WEB_URL??"https://rulemetric.com",{announcementId:s}=y,[r]=await e.select().from(o).where(m(o.id,s)).limit(1);if(!r)throw new $(`Announcement ${s} not found`);if(r.status!=="queued"&&r.status!=="sending")throw new $(`Announcement ${s} is in status='${r.status}'; expected 'queued' or 'sending'.`);await e.update(o).set({status:"sending",updatedAt:new Date}).where(m(o.id,s)),g(`Sending announcement ${s} (${r.subject??""})`);let l=0,a=0,w=0,i=null;try{for(;;){let d=await e.select({userId:c.userId,email:h.email,unsubscribeToken:c.unsubscribeToken}).from(c).innerJoin(h,m(h.id,c.userId)).where(U(m(c.productAnnouncements,!0),T(h.email),i?C(c.userId,i):void 0)).orderBy(x(c.userId)).limit(B);if(d.length===0)break;i=d[d.length-1].userId;for(let k=0;k<d.length;k+=S){let A=d.slice(k,k+S),v=await Promise.allSettled(A.map(p=>_({recipient:p,announcement:r,webBaseUrl:b,sendEmail:I,db:e})));for(let p=0;p<v.length;p++){let f=v[p];if(f.status==="fulfilled")f.value.ok==="sent"?l++:f.value.ok==="skipped"?w++:(a++,g(` recipient ${A[p].userId}: send failed \u2014 ${f.value.error}`));else{a++;let R=f.reason instanceof Error?f.reason.message:String(f.reason);g(` recipient ${A[p].userId}: send failed \u2014 ${R}`)}}}if(d.length<B)break}let n=a>0?`${a} of ${l+a} recipient(s) failed; see announcement_deliveries`:null;return await e.update(o).set({status:"sent",recipientCount:l,sentAt:new Date,error:n,updatedAt:new Date}).where(m(o.id,s)),g(`Done: sent=${l} failed=${a} skipped=${w}`),{sent:l,failed:a,skipped:w}}catch(n){let d=n instanceof Error?n.message:String(n);throw await e.update(o).set({status:"failed",error:d.slice(0,1e3),updatedAt:new Date}).where(m(o.id,s)).catch(()=>{}),n}}E(F,"processAnnouncement");async function _(y){let{recipient:t,announcement:e,webBaseUrl:I,sendEmail:g,db:b}=y;if(!t.email)return{ok:"skipped",reason:"no-email"};let s=await b.insert(u).values({announcementId:e.id,userId:t.userId,email:t.email,status:"pending"}).onConflictDoNothing({target:[u.announcementId,u.userId]}).returning({id:u.id});if(s.length===0)return{ok:"skipped",reason:"already-claimed"};let r=s[0].id,l=`${I.replace(/\/$/,"")}/unsubscribe/${t.unsubscribeToken}`,a=e.htmlBody.replaceAll("{{unsubscribe_url}}",l),w=e.textBody.replaceAll("{{unsubscribe_url}}",l);try{let i=await g({to:t.email,subject:e.subject,html:a,text:w,fromName:"RuleMetric",idempotencyKey:r});return await b.update(u).set({status:"sent",providerId:i.id,sentAt:new Date}).where(m(u.id,r)),{ok:"sent",providerId:i.id}}catch(i){let n=i instanceof Error?i.message:String(i);return await b.update(u).set({status:"failed",error:n.slice(0,1e3)}).where(m(u.id,r)).catch(()=>{}),{ok:"failed",error:n}}}E(_,"sendOne");export{F as a};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{a as i,b as Ce}from"./chunk-ZLLER3HP.js";var Rt=["claude_code","cursor","vscode_copilot","copilot_agent","rulemetric_mcp","codex","pi","opencode","antigravity"],Mt=["user_message","assistant_message","tool_call","tool_result","thinking","error"];var O=class{static{i(this,"ClaudeCodeAdapter")}tool="claude_code";parse(e){let t=e.split(`
|
|
2
|
+
`).filter(c=>c.trim()),s=[];for(let c of t)try{s.push(JSON.parse(c))}catch{}let o=s.filter(c=>c.type==="user"||c.type==="assistant"),r=null,l=null,p={},a=s.find(c=>c.type==="user");a&&(r=a.cwd??null,l=a.gitBranch??null,a.version&&(p.claudeCodeVersion=a.version),a.sessionId&&(p.sessionId=a.sessionId));let u=s.find(c=>c.type==="assistant");u?.message?.model&&(p.model=u.message.model);let m=[],f=0;for(let c of o){let g=c.timestamp??new Date().toISOString();if(c.type==="user"){let _=c.message?.content;if(typeof _=="string")m.push({sequence:f++,eventType:"user_message",content:_,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:g,metadata:{}});else if(Array.isArray(_))for(let h of _)h.type==="tool_result"&&m.push({sequence:f++,eventType:"tool_result",content:typeof h.content=="string"?h.content:JSON.stringify(h.content),toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:g,metadata:{toolUseId:h.tool_use_id}})}else if(c.type==="assistant"){let _=Array.isArray(c.message?.content)?c.message.content:[],h=c.message?.usage,x=h?{input:h.input_tokens??0,output:h.output_tokens??0,cacheRead:h.cache_read_input_tokens??0,cacheWrite:h.cache_creation_input_tokens??0}:null,S={};c.message?.model&&(S.model=c.message.model),c.message?.stop_reason&&(S.stopReason=c.message.stop_reason),c.requestId&&(S.requestId=c.requestId),h?.service_tier&&(S.serviceTier=h.service_tier),h?.speed&&(S.speed=h.speed),h?.cache_creation&&(S.cacheCreationDetail=h.cache_creation),h?.server_tool_use&&(S.serverToolUse=h.server_tool_use);for(let w of _)w.type==="text"?m.push({sequence:f++,eventType:"assistant_message",content:w.text??"",toolName:null,toolInput:null,toolOutput:null,tokenUsage:x,timestamp:g,metadata:S}):w.type==="thinking"?m.push({sequence:f++,eventType:"thinking",content:w.thinking??"",toolName:null,toolInput:null,toolOutput:null,tokenUsage:x,timestamp:g,metadata:S}):w.type==="tool_use"&&m.push({sequence:f++,eventType:"tool_call",content:null,toolName:w.name??"unknown",toolInput:w.input??null,toolOutput:null,tokenUsage:x,timestamp:g,metadata:{...S,toolUseId:w.id}})}}let d=m.map(c=>c.timestamp).sort(),y=new Date().toISOString();return{tool:"claude_code",projectPath:r,gitBranch:l,startedAt:d[0]??y,endedAt:d[d.length-1]??null,events:m,metadata:p}}};var N=class{static{i(this,"CursorAdapter")}tool="cursor";parse(e){let t=Ce("better-sqlite3"),s=new t(e,{readonly:!0});try{let o=s.prepare("SELECT value FROM ItemTable WHERE key = 'composer.composerData'").get();return o?this.parseComposerJson(o.value):this.emptySession()}finally{s.close()}}parseComposerJson(e){let t;try{t=JSON.parse(e)}catch{return this.emptySession()}let s=Object.values(t.allComposers??{});if(s.length===0)return this.emptySession();let o=s.sort((u,m)=>{let f=u.createdAt?new Date(u.createdAt).getTime():0;return(m.createdAt?new Date(m.createdAt).getTime():0)-f})[0],r=o.conversation??[],l=[];for(let u=0;u<r.length;u++){let m=r[u],f=m.createdAt??new Date().toISOString();l.push({sequence:u,eventType:m.type===1?"user_message":"assistant_message",content:m.text,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:f,metadata:{}})}let p=l.map(u=>u.timestamp).sort(),a=new Date().toISOString();return{tool:"cursor",projectPath:null,gitBranch:null,startedAt:p[0]??a,endedAt:p[p.length-1]??null,events:l,metadata:{composerId:o.composerId}}}emptySession(){return{tool:"cursor",projectPath:null,gitBranch:null,startedAt:new Date().toISOString(),endedAt:null,events:[],metadata:{}}}};var P=class{static{i(this,"VSCodeCopilotAdapter")}tool="vscode_copilot";parse(e){let t;try{t=JSON.parse(e)}catch{return this.emptySession()}let s=t.requests??[],o=[],r=0;for(let a of s){let u=a.timestamp?new Date(a.timestamp).toISOString():new Date().toISOString();if(o.push({sequence:r++,eventType:"user_message",content:a.message,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:u,metadata:{}}),a.response){let m=a.response.timestamp?new Date(a.response.timestamp).toISOString():u;o.push({sequence:r++,eventType:"assistant_message",content:a.response.message,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:m,metadata:{}})}}let l=o.map(a=>a.timestamp).sort(),p=new Date().toISOString();return{tool:"vscode_copilot",projectPath:null,gitBranch:null,startedAt:l[0]??p,endedAt:l[l.length-1]??null,events:o,metadata:{...t.requesterUsername&&{username:t.requesterUsername},...t.customTitle&&{title:t.customTitle}}}}emptySession(){return{tool:"vscode_copilot",projectPath:null,gitBranch:null,startedAt:new Date().toISOString(),endedAt:null,events:[],metadata:{}}}};var b=class{static{i(this,"CopilotAgentAdapter")}tool="copilot_agent";parse(e){let t;try{t=JSON.parse(e)}catch{return this.emptySession()}let s=t.requests??[],o=[],r=0;for(let a of s){let u=a.timestamp?new Date(a.timestamp).toISOString():new Date().toISOString();if(o.push({sequence:r++,eventType:"user_message",content:a.message,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:u,metadata:{}}),a.toolCalls)for(let m of a.toolCalls){let f=m.timestamp?new Date(m.timestamp).toISOString():u;o.push({sequence:r++,eventType:"tool_call",content:null,toolName:m.name??"unknown",toolInput:m.input??null,toolOutput:m.output??null,tokenUsage:null,timestamp:f,metadata:{}})}if(a.response){let m=a.response.timestamp?new Date(a.response.timestamp).toISOString():u;o.push({sequence:r++,eventType:"assistant_message",content:a.response.message,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:m,metadata:{}})}}let l=o.map(a=>a.timestamp).sort(),p=new Date().toISOString();return{tool:"copilot_agent",projectPath:null,gitBranch:null,startedAt:l[0]??p,endedAt:l[l.length-1]??null,events:o,metadata:{...t.requesterUsername&&{username:t.requesterUsername},...t.customTitle&&{title:t.customTitle},...t.agentMode!=null&&{agentMode:t.agentMode}}}}emptySession(){return{tool:"copilot_agent",projectPath:null,gitBranch:null,startedAt:new Date().toISOString(),endedAt:null,events:[],metadata:{}}}};var D=class{static{i(this,"RuleMetricMcpAdapter")}tool="rulemetric_mcp";parse(e){let t;try{t=JSON.parse(e)}catch{return this.emptySession()}let o=(t.events??[]).map((l,p)=>({sequence:l.sequence??p,eventType:this.normalizeEventType(l.eventType),content:l.content??null,toolName:l.toolName??null,toolInput:l.toolInput??null,toolOutput:l.toolOutput??null,tokenUsage:l.tokenUsage??null,timestamp:l.timestamp??new Date().toISOString(),metadata:l.metadata??{}})),r=new Date().toISOString();return{tool:"rulemetric_mcp",projectPath:t.projectPath??null,gitBranch:t.gitBranch??null,startedAt:t.startedAt??o[0]?.timestamp??r,endedAt:t.endedAt??o[o.length-1]?.timestamp??null,events:o,metadata:t.metadata??{}}}normalizeEventType(e){return e&&["user_message","assistant_message","tool_call","tool_result","thinking","error"].includes(e)?e:"assistant_message"}emptySession(){return{tool:"rulemetric_mcp",projectPath:null,gitBranch:null,startedAt:new Date().toISOString(),endedAt:null,events:[],metadata:{}}}};function $e(n){try{return JSON.parse(n)}catch{return n}}i($e,"safeJsonParse");function X(n,e){return Array.isArray(n)?n.filter(t=>t.type&&e.includes(t.type)).map(t=>t.text??"").filter(Boolean).join(`
|
|
3
|
+
|
|
4
|
+
`):""}i(X,"textFromBlocks");function je(n){if(!n)return null;let e=n.cached_input_tokens??0,t=Math.max(0,(n.input_tokens??0)-e),s=(n.output_tokens??0)+(n.reasoning_output_tokens??0);return t===0&&s===0&&e===0?null:{input:t,output:s,cacheRead:e,cacheWrite:0}}i(je,"tokenUsageFromCodex");function Ue(n){if(!n)return new Date().toISOString();let e=new Date(n);return Number.isFinite(e.getTime())?e.toISOString():new Date().toISOString()}i(Ue,"normalizeTimestamp");function Z(){return{sequence:0,model:null,prevCumulativeTotal:0,callNames:{}}}i(Z,"freshCodexState");var C=class{static{i(this,"CodexAdapter")}tool="codex";parse(e){let t=Z(),{events:s,projectPath:o,gitBranch:r,metadata:l}=this.parseLines(e,t),p=s.map(u=>u.timestamp).sort(),a=new Date().toISOString();return{tool:"codex",projectPath:o,gitBranch:r,startedAt:p[0]??a,endedAt:p[p.length-1]??null,events:s,metadata:l}}parseAppend(e,t){let s={...t,callNames:{...t.callNames}},{events:o}=this.parseLines(e,s);return{events:o,state:s}}parseLines(e,t){let s=e.split(`
|
|
5
|
+
`).filter(m=>m.trim()),o=[],r={},l=t.callNames,p=null,a=null,u=null;for(let m of s){let f;try{f=JSON.parse(m)}catch{continue}let d=f.payload;if(!d)continue;let y=Ue(f.timestamp);if(f.type==="session_meta"){u=d.session_id??d.id??u,p=d.cwd??p,d.git_branch&&(a=d.git_branch),d.model&&(t.model=d.model),r.sessionId=u,r.codexSessionId=u,r.originator=d.originator,r.source=d.source,r.modelProvider=d.model_provider,r.codexCliVersion=d.cli_version;continue}if(f.type==="turn_context"){p=d.cwd??p,d.model&&(t.model=d.model,r.model=d.model);continue}if(f.type==="response_item"&&d.type==="message"){if(d.role==="user"){let c=X(d.content,["input_text"]);if(!c)continue;o.push({sequence:t.sequence++,eventType:"user_message",content:c,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,timestamp:y,metadata:{}})}else if(d.role==="assistant"){let c=X(d.content,["output_text"]);if(!c)continue;o.push({sequence:t.sequence++,eventType:"assistant_message",content:c,toolName:null,toolInput:null,toolOutput:null,tokenUsage:null,model:t.model,timestamp:y,metadata:t.model?{model:t.model}:{}})}continue}if(f.type==="response_item"&&d.type==="function_call"){let c=d.name??"unknown";d.call_id&&(l[d.call_id]=c);let g=typeof d.arguments=="string"?$e(d.arguments):{};o.push({sequence:t.sequence++,eventType:"tool_call",content:null,toolName:c,toolInput:g&&typeof g=="object"&&!Array.isArray(g)?g:{arguments:g},toolOutput:null,tokenUsage:null,model:t.model,timestamp:y,metadata:{callId:d.call_id}});continue}if(f.type==="response_item"&&d.type==="function_call_output"){let c=d.call_id?l[d.call_id]??null:null;o.push({sequence:t.sequence++,eventType:"tool_result",content:d.output??null,toolName:c,toolInput:null,toolOutput:d.output==null?null:{output:d.output},tokenUsage:null,model:t.model,timestamp:y,metadata:{callId:d.call_id}});continue}if(f.type==="event_msg"&&d.type==="token_count"){let c=d.info,g=c?.total_token_usage?.total_tokens??0;if(g>0&&g===t.prevCumulativeTotal)continue;g>0&&(t.prevCumulativeTotal=g);let _=je(c?.last_token_usage??c?.total_token_usage);if(!_)continue;let h=c?.model??c?.model_name??t.model;o.push({sequence:t.sequence++,eventType:"assistant_message",content:null,toolName:null,toolInput:null,toolOutput:null,tokenUsage:_,model:h??null,timestamp:y,metadata:{codexEventType:"token_count",...h?{model:h}:{},reasoningOutputTokens:c?.last_token_usage?.reasoning_output_tokens??0}})}}return{events:o,projectPath:p,gitBranch:a,sessionId:u,metadata:r}}};var qe={claude_code:i(()=>new O,"claude_code"),cursor:i(()=>new N,"cursor"),vscode_copilot:i(()=>new P,"vscode_copilot"),copilot_agent:i(()=>new b,"copilot_agent"),rulemetric_mcp:i(()=>new D,"rulemetric_mcp"),codex:i(()=>new C,"codex")};function Ee(n){let e=qe[n];if(!e)throw new Error(`Unknown session tool: ${n}`);return e()}i(Ee,"getAdapter");function Re(n){let e=n.trim();if(e.startsWith("{")){let t=e.split(`
|
|
6
|
+
`)[0],s=null;try{s=JSON.parse(t)}catch{try{s=JSON.parse(e)}catch{}}if(s){if(s.type==="user"||s.type==="assistant")return"claude_code";if(Array.isArray(s.events)&&!s.requests&&!s.allComposers)return"rulemetric_mcp";if(Array.isArray(s.requests))return s.requests.some(r=>Array.isArray(r.toolCalls))||s.agentMode?"copilot_agent":"vscode_copilot";if(s.allComposers)return"cursor"}if(!s)try{let o=e.split(`
|
|
7
|
+
`).filter(r=>r.trim());if(o.length>1){let r=JSON.parse(o[0]);if(r.type==="user"||r.type==="assistant")return"claude_code"}}catch{}}return null}i(Re,"detectTool");function Me(n,e){let t=e.length>0?e.map(o=>`### ${o.name} (ID: ${o.id})
|
|
8
|
+
|
|
9
|
+
${o.content}`).join(`
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
`):"No instructions were linked to this session.",s=n.map(o=>{let r=`[${o.sequence}] ${o.eventType}`;if(o.eventType==="tool_call")return`${r}: ${o.toolName}(${JSON.stringify(o.toolInput)})`;if(o.eventType==="tool_result"){let p=o.content?.slice(0,200)??"";return`${r}: ${p}${o.content&&o.content.length>200?"...":""}`}let l=o.content?.slice(0,300)??"";return`${r}: ${l}${o.content&&o.content.length>300?"...":""}`}).join(`
|
|
14
|
+
`);return`You are analyzing an AI coding session to evaluate how well the agent followed its instructions and to suggest improvements.
|
|
15
|
+
|
|
16
|
+
## Active Instructions
|
|
17
|
+
|
|
18
|
+
${t}
|
|
19
|
+
|
|
20
|
+
## Session Transcript
|
|
21
|
+
|
|
22
|
+
${s}
|
|
23
|
+
|
|
24
|
+
## Analysis Tasks
|
|
25
|
+
|
|
26
|
+
1. **Adherence Score** (0-100): Rate how well the agent followed each active instruction. 100 = perfect adherence.
|
|
27
|
+
2. **Deviations**: List specific events where the agent deviated from instructions. Each deviation needs:
|
|
28
|
+
- eventSequence: the event number
|
|
29
|
+
- instructionId: which instruction was violated
|
|
30
|
+
- description: what went wrong
|
|
31
|
+
- severity: "low", "medium", or "high"
|
|
32
|
+
3. **Suggestions**: For each gap or deviation, propose a specific edit to the instruction. Each suggestion needs:
|
|
33
|
+
- instructionId: which instruction to improve
|
|
34
|
+
- currentContent: the relevant excerpt from the instruction
|
|
35
|
+
- suggestedContent: your proposed replacement text
|
|
36
|
+
- rationale: why this change would help
|
|
37
|
+
- confidence: 0-100 how confident you are this would improve outcomes
|
|
38
|
+
4. **Summary**: One paragraph summarizing the session quality.
|
|
39
|
+
|
|
40
|
+
Return your response as JSON matching this schema:
|
|
41
|
+
{
|
|
42
|
+
"adherenceScore": <number 0-100>,
|
|
43
|
+
"deviations": [{ "eventSequence": <number>, "instructionId": "<string>", "description": "<string>", "severity": "<low|medium|high>" }],
|
|
44
|
+
"suggestions": [{ "instructionId": "<string>", "currentContent": "<string>", "suggestedContent": "<string>", "rationale": "<string>", "confidence": <number 0-100> }],
|
|
45
|
+
"summary": "<string>"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Return valid JSON only.`}i(Me,"buildAnalysisPrompt");function Je(n){try{let e=n.match(/\{[\s\S]*\}/);if(!e)return null;let t=JSON.parse(e[0]);return typeof t.adherenceScore!="number"||!Array.isArray(t.deviations)||!Array.isArray(t.suggestions)||typeof t.summary!="string"?null:{adherenceScore:t.adherenceScore,deviations:t.deviations,suggestions:t.suggestions,summary:t.summary,analyzedAt:new Date().toISOString()}}catch{return null}}i(Je,"parseAnalysisResponse");import{readdir as G,stat as L}from"fs/promises";import{basename as Be,join as I}from"path";import{homedir as $}from"os";var Ge={"claude-opus-4-7":"Opus 4.7","claude-opus-4-6":"Opus 4.6","claude-opus-4-5":"Opus 4.5","claude-opus-4-1":"Opus 4.1","claude-opus-4":"Opus 4","claude-sonnet-4-6":"Sonnet 4.6","claude-sonnet-4-5":"Sonnet 4.5","claude-sonnet-4":"Sonnet 4","claude-3-7-sonnet":"Sonnet 3.7","claude-3-5-sonnet":"Sonnet 3.5","claude-haiku-4-5":"Haiku 4.5","claude-3-5-haiku":"Haiku 3.5"};function Le(){return process.env.CLAUDE_CONFIG_DIR||I($(),".claude")}i(Le,"getClaudeDir");function Fe(){return I(Le(),"projects")}i(Fe,"getProjectsDir");function We(){return process.platform==="darwin"?I($(),"Library","Application Support","Claude","local-agent-mode-sessions"):process.platform==="win32"?I($(),"AppData","Roaming","Claude","local-agent-mode-sessions"):I($(),".config","Claude","local-agent-mode-sessions")}i(We,"getDesktopSessionsDir");async function He(n){let e=[];async function t(s,o){if(o>8)return;let r=await G(s).catch(()=>[]);for(let l of r){if(l==="node_modules"||l===".git")continue;let p=I(s,l);if((await L(p).catch(()=>null))?.isDirectory())if(l==="projects"){let u=await G(p).catch(()=>[]);for(let m of u){let f=I(p,m);(await L(f).catch(()=>null))?.isDirectory()&&e.push(f)}}else await t(p,o+1)}}return i(t,"walk"),await t(n,0),e}i(He,"findDesktopProjectDirs");var Q={name:"claude",displayName:"Claude Code",modelDisplayName(n){let e=n.replace(/@.*$/,"").replace(/-\d{8}$/,"");for(let[t,s]of Object.entries(Ge))if(e.startsWith(t))return s;return e},toolDisplayName(n){return n},async discoverSessions(){let n=[],e=Fe();try{let s=await G(e);for(let o of s){let r=I(e,o);(await L(r).catch(()=>null))?.isDirectory()&&n.push({path:r,project:o,provider:"claude"})}}catch{}let t=await He(We());for(let s of t)n.push({path:s,project:Be(s),provider:"claude"});return n},createSessionParser(){return{async*parse(){}}}};import{readdir as j,readFile as ee,stat as ze}from"fs/promises";import{basename as Ke,join as A}from"path";import{homedir as Ve}from"os";var Ye={"gpt-5.3-codex":"GPT-5.3 Codex","gpt-5.4-mini":"GPT-5.4 Mini","gpt-5.4":"GPT-5.4","gpt-5":"GPT-5","gpt-4o-mini":"GPT-4o Mini","gpt-4o":"GPT-4o"},te={exec_command:"Bash",read_file:"Read",write_file:"Edit",apply_diff:"Edit",apply_patch:"Edit",spawn_agent:"Agent",close_agent:"Agent",wait_agent:"Agent",read_dir:"Glob"};function Xe(){return process.env.CODEX_HOME??A(Ve(),".codex")}i(Xe,"getCodexDir");function Ze(n){return n.replace(/^\//,"").replace(/\//g,"-")}i(Ze,"sanitizeProject");async function Qe(n){try{let t=(await ee(n,"utf-8")).split(`
|
|
49
|
+
`)[0];return t?.trim()?JSON.parse(t):null}catch{return null}}i(Qe,"readFirstLine");async function et(n){let e=await Qe(n);if(!e)return{valid:!1};let t=e.type==="session_meta"&&typeof e.payload?.originator=="string"&&e.payload.originator.toLowerCase().startsWith("codex");return{valid:t,meta:t?e:void 0}}i(et,"isValidCodexSession");async function tt(n){let e=A(n,"sessions"),t=[],s;try{s=await j(e)}catch{return t}for(let o of s){if(!/^\d{4}$/.test(o))continue;let r=A(e,o),l=await j(r).catch(()=>[]);for(let p of l){if(!/^\d{2}$/.test(p))continue;let a=A(r,p),u=await j(a).catch(()=>[]);for(let m of u){if(!/^\d{2}$/.test(m))continue;let f=A(a,m),d=await j(f).catch(()=>[]);for(let y of d){if(!y.startsWith("rollout-")||!y.endsWith(".jsonl"))continue;let c=A(f,y);if(!(await ze(c).catch(()=>null))?.isFile())continue;let{valid:_,meta:h}=await et(c);if(!_||!h)continue;let x=h.payload?.cwd??"unknown";t.push({path:c,project:Ze(x),provider:"codex"})}}}}return t}i(tt,"discoverSessionsInDir");function nt(n,e){return n?.info?.model??n?.info?.model_name??e??"gpt-5"}i(nt,"resolveModel");function ot(n,e){return{async*parse(){let t;try{t=await ee(n.path,"utf-8")}catch{return}let s=t.split(`
|
|
50
|
+
`).filter(y=>y.trim()),o,r="",l=0,p=0,a=0,u=0,m=0,f=[],d="";for(let y of s){let c;try{c=JSON.parse(y)}catch{continue}if(c.type==="session_meta"){r=c.payload?.session_id??Ke(n.path,".jsonl"),o=c.payload?.model;continue}if(c.type==="response_item"&&c.payload?.type==="function_call"){let g=c.payload.name??"";f.push(te[g]??g);continue}if(c.type==="response_item"&&c.payload?.type==="message"&&c.payload?.role==="user"){let g=(c.payload.content??[]).filter(_=>_.type==="input_text").map(_=>_.text??"").filter(Boolean);g.length>0&&(d=g.join(" "));continue}if(c.type==="event_msg"&&c.payload?.type==="token_count"){let g=c.payload.info;if(!g)continue;let _=g.total_token_usage?.total_tokens??0;if(_>0&&_===l)continue;l=_;let h=g.last_token_usage,x=0,S=0,w=0,v=0;if(h)x=h.input_tokens??0,S=h.cached_input_tokens??0,w=h.output_tokens??0,v=h.reasoning_output_tokens??0;else if(_>0){let T=g.total_token_usage;if(!T)continue;x=(T.input_tokens??0)-p,S=(T.cached_input_tokens??0)-a,w=(T.output_tokens??0)-u,v=(T.reasoning_output_tokens??0)-m}if(!h){let T=g.total_token_usage;T&&(p=T.input_tokens??0,a=T.cached_input_tokens??0,u=T.output_tokens??0,m=T.reasoning_output_tokens??0)}if(x+S+w+v===0)continue;let be=Math.max(0,x-S),De=nt(c.payload,o),Y=c.timestamp??"",B=`codex:${n.path}:${Y}:${_}`;if(e.has(B))continue;e.add(B),yield{provider:"codex",model:De,inputTokens:be,outputTokens:w,cacheCreationInputTokens:0,cacheReadInputTokens:S,cachedInputTokens:S,reasoningTokens:v,costUSD:0,tools:f,bashCommands:[],timestamp:Y,speed:"standard",deduplicationKey:B,userMessage:d,sessionId:r},f=[],d=""}}}}}i(ot,"createParser");var ne={name:"codex",displayName:"Codex",modelDisplayName(n){for(let[e,t]of Object.entries(Ye))if(n.startsWith(e))return t;return n},toolDisplayName(n){return te[n]??n},async discoverSessions(){return tt(Xe())},createSessionParser(n,e){return ot(n,e)}};import{readdir as st,readFile as oe,stat as rt}from"fs/promises";import{basename as se,dirname as at,join as F}from"path";import{homedir as it}from"os";var lt={"gpt-4.1-nano":"GPT-4.1 Nano","gpt-4.1-mini":"GPT-4.1 Mini","gpt-4.1":"GPT-4.1","gpt-4o-mini":"GPT-4o Mini","gpt-4o":"GPT-4o","gpt-5-mini":"GPT-5 Mini","gpt-5":"GPT-5","claude-sonnet-4-5":"Sonnet 4.5","claude-sonnet-4":"Sonnet 4","claude-3-7-sonnet":"Sonnet 3.7","claude-3-5-sonnet":"Sonnet 3.5","o4-mini":"o4-mini",o3:"o3"},re={bash:"Bash",read_file:"Read",write_file:"Edit",edit_file:"Edit",create_file:"Write",delete_file:"Delete",search_files:"Grep",find_files:"Glob",list_directory:"LS",web_search:"WebSearch",fetch_webpage:"WebFetch",github_repo:"GitHub"},ct=Object.entries(lt).sort((n,e)=>e[0].length-n[0].length);function ut(){return F(it(),".copilot","session-state")}i(ut,"getCopilotSessionStateDir");function pt(n){let e=n.match(/^cwd:\s*(.+)$/m);return e?.[1]&&e[1].replace(/\s*#.*$/,"").replace(/^['"]|['"]$/g,"").trim()||null}i(pt,"parseCwd");function dt(n,e){return{async*parse(){let t;try{t=await oe(n.path,"utf-8")}catch{return}let s=se(at(n.path)),o=t.split(`
|
|
51
|
+
`).filter(p=>p.trim()),r="",l="";for(let p of o){let a;try{a=JSON.parse(p)}catch{continue}if(a.type==="session.model_change"){r=a.data.newModel??r;continue}if(a.type==="user.message"){l=a.data.content??"";continue}if(a.type==="assistant.message"){let{messageId:u,outputTokens:m,toolRequests:f=[]}=a.data;if(m===0||!r)continue;let d=`copilot:${s}:${u}`;if(e.has(d))continue;e.add(d);let y=f.map(c=>c.name??"").filter(Boolean).map(c=>re[c]??c);yield{provider:"copilot",model:r,inputTokens:0,outputTokens:m,cacheCreationInputTokens:0,cacheReadInputTokens:0,cachedInputTokens:0,reasoningTokens:0,costUSD:0,tools:y,bashCommands:[],timestamp:a.timestamp??"",speed:"standard",deduplicationKey:d,userMessage:l,sessionId:s},l=""}}}}}i(dt,"createParser");async function mt(n){let e=[],t;try{t=await st(n)}catch{return e}for(let s of t){let o=F(n,s,"events.jsonl");if(!(await rt(o).catch(()=>null))?.isFile())continue;let l=s;try{let p=await oe(F(n,s,"workspace.yaml"),"utf-8"),a=pt(p);a&&(l=se(a))}catch{}e.push({path:o,project:l,provider:"copilot"})}return e}i(mt,"discoverSessionsInDir");var ae={name:"copilot",displayName:"GitHub Copilot",modelDisplayName(n){for(let[e,t]of ct)if(n===e||n.startsWith(e+"-"))return t;return n},toolDisplayName(n){return re[n]??n},async discoverSessions(){return mt(ut())},createSessionParser(n,e){return dt(n,e)}};import{readdir as ie,readFile as ce,stat as le}from"fs/promises";import{basename as ue,join as W}from"path";import{homedir as ft}from"os";var ht={"gpt-5.4":"GPT-5.4","gpt-5.4-mini":"GPT-5.4 Mini","gpt-5":"GPT-5","gpt-4o":"GPT-4o","gpt-4o-mini":"GPT-4o Mini"},pe={bash:"Bash",read:"Read",edit:"Edit",write:"Write",glob:"Glob",grep:"Grep",task:"Agent",dispatch_agent:"Agent",fetch:"WebFetch",search:"WebSearch",todo:"TodoWrite",patch:"Patch"},gt=Object.entries(ht).sort((n,e)=>e[0].length-n[0].length);function yt(){return W(ft(),".pi","agent","sessions")}i(yt,"getPiSessionsDir");async function _t(n){try{let t=(await ce(n,"utf-8")).split(`
|
|
52
|
+
`)[0];return t?.trim()?JSON.parse(t):null}catch{return null}}i(_t,"readFirstEntry");function St(n){return n.split(/[;&|]+/).map(e=>e.trim().split(/\s+/)[0]).filter(Boolean)}i(St,"extractBashCommands");async function vt(n){let e=[],t;try{t=await ie(n)}catch{return e}for(let s of t){let o=W(n,s);if(!(await le(o).catch(()=>null))?.isDirectory())continue;let l;try{l=await ie(o)}catch{continue}for(let p of l){if(!p.endsWith(".jsonl"))continue;let a=W(o,p);if(!(await le(a).catch(()=>null))?.isFile())continue;let m=await _t(a);if(!m||m.type!=="session")continue;let f=m.cwd??s;e.push({path:a,project:ue(f),provider:"pi"})}}return e}i(vt,"discoverSessionsInDir");function wt(n,e){return{async*parse(){let t;try{t=await ce(n.path,"utf-8")}catch{return}let s=t.split(`
|
|
53
|
+
`).filter(l=>l.trim()),o=ue(n.path,".jsonl"),r="";for(let[l,p]of s.entries()){let a;try{a=JSON.parse(p)}catch{continue}if(a.type==="session"){o=a.id??o;continue}if(a.type!=="message")continue;let u=a.message;if(!u)continue;if(u.role==="user"){let v=(u.content??[]).filter(k=>k.type==="text").map(k=>k.text??"").filter(Boolean);v.length>0&&(r=v.join(" "));continue}if(u.role!=="assistant"||!u.usage)continue;let{input:m,output:f,cacheRead:d,cacheWrite:y}=u.usage;if(m===0&&f===0)continue;let c=u.model??"gpt-5",g=u.responseId??"",_=`pi:${n.path}:${g||a.id||a.timestamp||String(l)}`;if(e.has(_))continue;e.add(_);let h=(u.content??[]).filter(v=>v.type==="toolCall"&&v.name),x=h.map(v=>pe[v.name]??v.name),S=h.filter(v=>v.name==="bash").flatMap(v=>{let k=v.arguments?.command;return typeof k=="string"?St(k):[]}),w=a.timestamp??"";yield{provider:"pi",model:c,inputTokens:m,outputTokens:f,cacheCreationInputTokens:y,cacheReadInputTokens:d,cachedInputTokens:d,reasoningTokens:0,costUSD:0,tools:x,bashCommands:S,timestamp:w,speed:"standard",deduplicationKey:_,userMessage:r,sessionId:o},r=""}}}}i(wt,"createParser");var de={name:"pi",displayName:"Pi",modelDisplayName(n){for(let[e,t]of gt)if(n.startsWith(e))return t;return n},toolDisplayName(n){return pe[n]??n},async discoverSessions(){return vt(yt())},createSessionParser(n,e){return wt(n,e)}};var ye=[Q,ne,ae,de],me=null,fe=!1;async function _e(){if(fe)return me;fe=!0;try{let{cursor:n}=await import("./cursor-T7AMCMKS.js");return me=n,n}catch{return null}}i(_e,"loadCursor");var he=null,ge=!1;async function Se(){if(ge)return he;ge=!0;try{let{opencode:n}=await import("./opencode-QRJ3BH23.js");return he=n,n}catch{return null}}i(Se,"loadOpenCode");async function ve(){let[n,e]=await Promise.all([_e(),Se()]),t=[...ye];return n&&t.push(n),e&&t.push(e),t}i(ve,"getAllProviders");async function xt(n){let e=await ve(),t=n&&n!=="all"?e.filter(o=>o.name===n):e,s=[];for(let o of t){let r=await o.discoverSessions();s.push(...r)}return s}i(xt,"discoverAllSessions");async function Tt(n){return n==="cursor"?await _e()??void 0:n==="opencode"?await Se()??void 0:ye.find(e=>e.name===n)}i(Tt,"getProvider");import{spawn as V}from"node:child_process";import{randomUUID as Ot}from"node:crypto";import{writeFile as xe}from"node:fs/promises";import{tmpdir as Te}from"node:os";import{join as Ie}from"node:path";import{spawn as It}from"node:child_process";function H(n){return`rm-${n.trim().replace(/[^A-Za-z0-9_.-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"session"}`}i(H,"sanitizeTmuxName");function z(n){let e=n.runId?["env",`RULEMETRIC_RUN_ID=${n.runId}`,"claude"]:["claude"];return n.resumeSessionId&&e.push("--resume",n.resumeSessionId),n.model&&e.push("--model",n.model),["new-session","-d","-s",n.sessionName,"-c",n.projectPath,"--",...e]}i(z,"buildTmuxLaunchArgs");function U(n,e,t={}){return t.literal===!1?["send-keys","-t",n,e]:["send-keys","-t",n,"-l","--",e]}i(U,"buildTmuxSendKeysArgs");function kt(n){return["has-session","-t",n]}i(kt,"buildTmuxHasSessionArgs");function q(n){return`tmux attach -t ${n}`}i(q,"buildTmuxAttachCommand");function At(){let n=["/opt/homebrew/bin","/usr/local/bin"],e=(process.env.PATH??"").split(":").filter(Boolean),t=n.filter(s=>!e.includes(s));return t.length===0?process.env:{...process.env,PATH:[...e,...t].join(":")}}i(At,"tmuxSpawnEnv");function K(n){return new Promise(e=>{let t=It("tmux",n,{stdio:["ignore","ignore","pipe"],env:At()}),s="";t.stderr.on("data",o=>{s+=o.toString()}),t.on("close",o=>e({code:o,stderr:s})),t.on("error",o=>e({code:null,stderr:o.message}))})}i(K,"runTmux");async function we(){return(await K(["-V"])).code===0}i(we,"isTmuxAvailable");var Nt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Pt(n){if(n!==void 0){if(Nt.test(n))return n;console.warn(`[claude-code-launcher] dropping non-uuid runId (RULEMETRIC_RUN_ID not injected): ${JSON.stringify(n)}`)}}i(Pt,"validateRunId");function bt(n){return`'${n.replace(/'/g,"'\\''")}'`}i(bt,"shellSingleQuote");var E=class{static{i(this,"ClaudeCodeLauncher")}options;tool="claude_code";constructor(e={}){this.options=e}capabilities={headless:!0,interactive:!0,remoteSpawn:!0};async launch(e){let t=Ot(),s={...e,runId:Pt(e.runId)};return s.mode==="headless"?this.launchHeadless(s,t):this.launchInteractive(s,t)}async launchHeadless(e,t){let s=["-p",e.prompt??"","--output-format","json"];e.systemPrompt&&s.push("--system-prompt",e.systemPrompt),e.model&&s.push("--model",e.model);let o={...process.env};return delete o.CLAUDECODE,delete o.HTTPS_PROXY,e.runId&&(o.RULEMETRIC_RUN_ID=e.runId),new Promise(r=>{let l=V("claude",s,{cwd:e.projectPath,env:o,stdio:["ignore","pipe","pipe"]}),p="",a="";l.stdout.on("data",m=>{p+=m.toString()}),l.stderr.on("data",m=>{a+=m.toString()});let u=e.timeout?setTimeout(()=>{l.kill("SIGTERM")},e.timeout):null;l.on("close",m=>{u&&clearTimeout(u);let f=p;try{let d=JSON.parse(p);f=d.result??d.content??p}catch{}r({sessionId:t,pid:l.pid,exitCode:m,output:f,error:m!==0?a:void 0})}),l.on("error",m=>{u&&clearTimeout(u),r({sessionId:t,error:`Failed to spawn claude: ${m.message}`})})})}async launchInteractive(e,t){return await(this.options.tmuxAvailable??we)().catch(()=>!1)?this.launchInteractiveTmux(e,t):this.launchInteractiveTerminal(e,t,"tmux_not_found")}async launchInteractiveTmux(e,t){let s=this.options.runTmux??K,o=H(`claude-${e.resumeSessionId??t}`),r=await s(z({sessionName:o,projectPath:e.projectPath,resumeSessionId:e.resumeSessionId,model:e.model,runId:e.runId}));if(r.code!==0)return this.launchInteractiveTerminal(e,t,"tmux_launch_failed",`tmux new-session exited ${r.code}: ${r.stderr.trim()||"no stderr"}`);let l=await this.openTerminalAttach(o,t);if(e.prompt){let p=await s(U(o,e.prompt));if(p.code!==0)return{sessionId:t,liveSendAvailable:!1,fallbackReason:"tmux_launch_failed",error:`tmux send-keys exited ${p.code}: ${p.stderr.trim()||"no stderr"}`};let a=await s(U(o,"Enter",{literal:!1}));if(a.code!==0)return{sessionId:t,liveSendAvailable:!1,fallbackReason:"tmux_launch_failed",error:`tmux send Enter exited ${a.code}: ${a.stderr.trim()||"no stderr"}`}}return{sessionId:t,pid:l.pid,liveSendAvailable:!0,...l.error?{error:l.error}:{},terminalTarget:{kind:"tmux",target:o,attachCommand:q(o),live:!0}}}async openTerminalAttach(e,t){let s=Ie(Te(),`rulemetric-attach-${t}.command`),o=`#!/bin/zsh
|
|
54
|
+
rm -- "$0"
|
|
55
|
+
${q(e)}
|
|
56
|
+
`;return await xe(s,o,{mode:493}),new Promise(r=>{let l=V("open",["-a","Terminal",s],{stdio:["ignore","pipe","pipe"]}),p="";l.stderr.on("data",a=>{p+=a.toString()}),l.on("close",a=>{r(a===0?{pid:l.pid}:{pid:l.pid,error:`open attach exited ${a}: ${p.trim()||"no stderr"}`})}),l.on("error",a=>{r({error:`Failed to spawn open attach: ${a.message}`})})})}async launchInteractiveTerminal(e,t,s,o){let r=["claude"];e.resumeSessionId?r.push("--resume",e.resumeSessionId):e.prompt&&r.push("-p",JSON.stringify(e.prompt)),e.model&&r.push("--model",e.model);let l=r.join(" "),p=Ie(Te(),`rulemetric-launch-${t}.command`),a=e.runId?`export RULEMETRIC_RUN_ID=${bt(e.runId)}
|
|
57
|
+
`:"",u=`#!/bin/zsh
|
|
58
|
+
rm -- "$0"
|
|
59
|
+
cd ${JSON.stringify(e.projectPath)} || exit
|
|
60
|
+
`+a+`${l}
|
|
61
|
+
`;return await xe(p,u,{mode:493}),new Promise(m=>{let f=V("open",["-a","Terminal",p],{stdio:["ignore","pipe","pipe"]}),d="";f.stderr.on("data",y=>{d+=y.toString()}),f.on("close",y=>{if(y===0)m({sessionId:t,pid:f.pid,liveSendAvailable:!1,fallbackReason:s,...o?{error:o}:{}});else{let c=d.trim()||"no stderr";m({sessionId:t,pid:f.pid,liveSendAvailable:!1,fallbackReason:s,error:o?`${o}; open exited ${y}: ${c}`:`open exited ${y}: ${c}`})}}),f.on("error",y=>{m({sessionId:t,liveSendAvailable:!1,fallbackReason:s,error:`Failed to spawn open: ${y.message}`})})})}};import{spawn as ke}from"node:child_process";import{randomUUID as Dt}from"node:crypto";var R=class{static{i(this,"CodexLauncher")}tool="codex";capabilities={headless:!0,interactive:!0,remoteSpawn:!0};async launch(e){let t=Dt();return e.mode==="headless"?this.launchHeadless(e,t):this.launchInteractive(e,t)}launchHeadless(e,t){let s=["-q",e.prompt??""];return e.model&&s.push("--model",e.model),new Promise(o=>{let r=ke("codex",s,{cwd:e.projectPath,stdio:["ignore","pipe","pipe"]}),l="",p="";r.stdout.on("data",u=>{l+=u.toString()}),r.stderr.on("data",u=>{p+=u.toString()});let a=e.timeout?setTimeout(()=>{r.kill("SIGTERM")},e.timeout):null;r.on("close",u=>{a&&clearTimeout(a),o({sessionId:t,pid:r.pid,exitCode:u,output:l,error:u!==0?p:void 0})}),r.on("error",u=>{a&&clearTimeout(a),o({sessionId:t,error:`Failed to spawn codex: ${u.message}`})})})}launchInteractive(e,t){let s=["codex"];e.prompt&&s.push(JSON.stringify(e.prompt));let o=`cd ${JSON.stringify(e.projectPath)} && ${s.join(" ")}`,r=ke("osascript",["-e",`tell application "Terminal" to do script ${JSON.stringify(o)}`],{stdio:"ignore",detached:!0});return r.unref(),Promise.resolve({sessionId:t,pid:r.pid})}};import{spawn as Ae}from"node:child_process";import{randomUUID as Ct}from"node:crypto";var M=class{static{i(this,"AiderLauncher")}tool="aider";capabilities={headless:!0,interactive:!0,remoteSpawn:!0};async launch(e){let t=Ct();return e.mode==="headless"?this.launchHeadless(e,t):this.launchInteractive(e,t)}launchHeadless(e,t){let s=["--message",e.prompt??"","--yes"];return e.model&&s.push("--model",e.model),new Promise(o=>{let r=Ae("aider",s,{cwd:e.projectPath,stdio:["ignore","pipe","pipe"]}),l="",p="";r.stdout.on("data",u=>{l+=u.toString()}),r.stderr.on("data",u=>{p+=u.toString()});let a=e.timeout?setTimeout(()=>{r.kill("SIGTERM")},e.timeout):null;r.on("close",u=>{a&&clearTimeout(a),o({sessionId:t,pid:r.pid,exitCode:u,output:l,error:u!==0?p:void 0})}),r.on("error",u=>{a&&clearTimeout(a),o({sessionId:t,error:`Failed to spawn aider: ${u.message}`})})})}launchInteractive(e,t){let s=["aider"];e.model&&s.push("--model",e.model);let o=`cd ${JSON.stringify(e.projectPath)} && ${s.join(" ")}`,r=Ae("osascript",["-e",`tell application "Terminal" to do script ${JSON.stringify(o)}`],{stdio:"ignore",detached:!0});return r.unref(),Promise.resolve({sessionId:t,pid:r.pid})}};import{spawn as $t}from"node:child_process";import{randomUUID as jt}from"node:crypto";var J=class{static{i(this,"GenericLauncher")}tool;constructor(e){this.tool=e}capabilities={headless:!1,interactive:!0,remoteSpawn:!1};async launch(e){let t=jt();if(e.mode==="headless")return{sessionId:t,error:`${this.tool} does not support headless mode`};let s=`cd ${JSON.stringify(e.projectPath)} && echo "Session ${t} \u2014 tool: ${this.tool}" && exec $SHELL`,o=$t("osascript",["-e",`tell application "Terminal" to do script ${JSON.stringify(s)}`],{stdio:"ignore",detached:!0});return o.unref(),{sessionId:t,pid:o.pid}}};var Oe={claude_code:i(()=>new E,"claude_code"),codex:i(()=>new R,"codex"),aider:i(()=>new M,"aider")};function Ut(n){let e=Oe[n];return e?e():new J(n)}i(Ut,"getLauncher");function qt(){return Object.entries(Oe).map(([n,e])=>({tool:n,capabilities:e().capabilities}))}i(qt,"getAvailableLaunchers");import Ne from"node:path";function Pe(n){return n.replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^[-.]+|[-.]+$/g,"")||"worktree"}i(Pe,"sanitizeBranch");function Et(n){return Ne.resolve(n.basePath??Ne.join(n.repoRoot,"..",".rulemetric-worktrees",Pe(n.branch)))}i(Et,"worktreePathFor");export{Rt as a,Mt as b,O as c,N as d,P as e,b as f,D as g,Z as h,C as i,Ee as j,Re as k,Me as l,Je as m,ve as n,xt as o,Tt as p,H as q,z as r,U as s,kt as t,q as u,Ut as v,qt as w,Pe as x,Et as y};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as R}from"./chunk-6QKI756T.js";import{b as s,c as r,h as j}from"./chunk-NVOTOQBA.js";import{a as P}from"./chunk-5RBLIVBF.js";import{a as g}from"./chunk-ZLLER3HP.js";import{and as y,eq as l,isNotNull as I}from"drizzle-orm";async function O($,p={}){let k=p.db??j(),b=p.removeWorktreeFn??R,n=p.log??(e=>process.stderr.write(`[process_run_cleanup] ${e}
|
|
2
|
+
`)),{runId:t}=$,[i]=await k.select({id:s.id,userId:s.userId,projectPath:s.projectPath}).from(s).where(l(s.id,t)).limit(1);if(!i)throw new P(`Run ${t} not found`);if(!i.projectPath)throw new P(`Run ${t} has no projectPath; cannot resolve a repo root for worktree cleanup`);let c=i.projectPath,v=await k.select({id:r.id,projectPath:r.projectPath}).from(r).where(y(l(r.runId,t),l(r.userId,i.userId),I(r.endedAt))),a=[],u=0,d=0,h=0,m=0,w=new Set;for(let e of v)if(!(!e.projectPath||e.projectPath===c)&&!w.has(e.projectPath)){w.add(e.projectPath);try{let o=await b({repoRoot:c,worktreePath:e.projectPath});o.removed?(u++,a.push({sessionId:e.id,worktreePath:e.projectPath,status:"removed"}),n(`removed worktree ${e.projectPath} (session ${e.id})`)):o.reason==="dirty"?(d++,a.push({sessionId:e.id,worktreePath:e.projectPath,status:"skipped-dirty"}),n(`skipped dirty worktree ${e.projectPath} (session ${e.id}) \u2014 uncommitted changes`)):(h++,a.push({sessionId:e.id,worktreePath:e.projectPath,status:"absent"}),n(`worktree absent ${e.projectPath} (session ${e.id})`))}catch(o){let f=o instanceof Error?o.message:String(o);m++,a.push({sessionId:e.id,worktreePath:e.projectPath,status:"error",error:f.slice(0,1e3)}),n(`error removing worktree ${e.projectPath} (session ${e.id}): ${f}`)}}return n(`run ${t} cleanup: removed=${u} skippedDirty=${d} absent=${h} errored=${m}`),{runId:t,repoRoot:c,removed:u,skippedDirty:d,absent:h,errored:m,worktrees:a}}g(O,"processRunCleanup");export{O as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a}from"./chunk-CRAKDQ4H.js";import{e as s}from"./chunk-TIQ7DQ3M.js";import{a as i,b as t,i as n}from"./chunk-M6AJDVCL.js";import{a as r}from"./chunk-ZLLER3HP.js";import{hostname as u}from"node:os";async function l(p,m,c){if(t(),process.env.RULEMETRIC_API_KEY||i().apiKey)return;let o=`${u()} (auto)`;try{let e=await s("/api/auth/api-keys",{name:o});n(e.key,process.env.RULEMETRIC_API_URL),t(),p(`Created API key "${o}" for hooks + proxy auth (saved to your config).`),a("key_created",{},c)}catch(e){let y=e instanceof Error?e.message:String(e);m(`Could not auto-create an API key (${y}). Hooks/proxy will work via your session token for ABOUT AN HOUR \u2014 the token expires, and capture then stops until a key exists. Run \`rulemetric auth create-key --name "my-laptop"\` (or \`rulemetric auth login\` again) to fix this permanently.`)}}r(l,"ensureDeviceApiKey");export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as d}from"./chunk-NJ5UED3H.js";import{a as o}from"./chunk-ZLLER3HP.js";import{Box as s,Text as i}from"ink";import{jsx as l,jsxs as u}from"react/jsx-runtime";function h({title:e,color:r,children:t,width:n}){return u(s,{flexDirection:"column",borderStyle:"round",borderColor:r,paddingX:1,width:n,overflowX:"hidden",children:[l(i,{bold:!0,color:r,children:e}),t]})}o(h,"Panel");function _(e){let r=e<=.5?Math.round(91+e*2*164):255,t=e<=.5?Math.round(158+e*2*42):Math.round(200-(e-.5)*2*109),n=e<=.5?Math.round(245-e*2*154):91;return`#${r.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}o(_,"gradientColor");function m({value:e,max:r,width:t}){if(r===0)return l(i,{color:d,children:"\u2591".repeat(t)});let n=Math.round(e/r*t),c=[];for(let a=0;a<Math.min(n,t);a++)c.push(l(i,{color:_(a/t),children:"\u2588"},a));return u(i,{children:[c,l(i,{color:"#333333",children:"\u2591".repeat(Math.max(t-n,0))})]})}o(m,"HBar");function p(e,r){return e.length>r?e.slice(0,r):e.padEnd(r)}o(p,"fit");function b(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}o(b,"formatTokens");function $(e){return e>=1e3?`$${(e/1e3).toFixed(1)}K`:e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}o($,"formatCost");var g={fully_achieved:"Fully Achieved",mostly_achieved:"Mostly Achieved",partially_achieved:"Partially Achieved",not_achieved:"Not Achieved",unclear_from_transcript:"Unclear",misunderstood_request:"Misunderstood Request",wrong_approach:"Wrong Approach",buggy_code:"Buggy Code",user_rejected_action:"User Rejected",excessive_changes:"Excessive Changes",wrong_file_or_location:"Wrong File/Location",slow_or_verbose:"Slow/Verbose",tool_failed:"Tool Failed"};function v(e){return g[e]||e.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}o(v,"friendlyLabel");export{h as a,m as b,p as c,b as d,$ as e,v as f};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{a as p}from"./chunk-MGHFDHHM.js";import{a as c}from"./chunk-ZLLER3HP.js";var v=`You are a rigorous eval grader. Your job is to evaluate whether an AI assistant's output meets a set of expectations.
|
|
2
|
+
|
|
3
|
+
You will receive:
|
|
4
|
+
1. The original prompt that was given to the AI
|
|
5
|
+
2. The AI's output/response
|
|
6
|
+
3. A list of expectations (assertions) to evaluate
|
|
7
|
+
|
|
8
|
+
For each expectation:
|
|
9
|
+
- Search the output for evidence that the expectation is met
|
|
10
|
+
- Determine PASS or FAIL (no partial credit)
|
|
11
|
+
- Cite specific evidence (quote or description)
|
|
12
|
+
|
|
13
|
+
PASS criteria:
|
|
14
|
+
- Clear evidence the assertion is true
|
|
15
|
+
- Evidence reflects genuine completion, not surface compliance
|
|
16
|
+
|
|
17
|
+
FAIL criteria:
|
|
18
|
+
- No evidence found
|
|
19
|
+
- Evidence contradicts the expectation
|
|
20
|
+
- Cannot verify from available information
|
|
21
|
+
|
|
22
|
+
Beyond the predefined expectations, extract implicit claims from the output:
|
|
23
|
+
- Factual claims ("uses TypeScript", "has 3 parameters")
|
|
24
|
+
- Process claims ("used async/await pattern")
|
|
25
|
+
- Quality claims ("handles edge cases")
|
|
26
|
+
|
|
27
|
+
Verify each claim against the actual output.
|
|
28
|
+
|
|
29
|
+
Finally, critique the eval itself \u2014 identify assertions that are too weak (pass for wrong outputs) or important outcomes that no assertion covers.
|
|
30
|
+
|
|
31
|
+
You MUST respond with ONLY a valid JSON object matching this exact structure (no markdown, no explanation, just JSON):
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
"expectations": [
|
|
35
|
+
{ "text": "assertion text", "passed": true, "evidence": "specific quote or description" }
|
|
36
|
+
],
|
|
37
|
+
"summary": { "passed": 2, "failed": 1, "total": 3, "pass_rate": 0.67 },
|
|
38
|
+
"claims": [
|
|
39
|
+
{ "claim": "statement", "type": "factual", "verified": true, "evidence": "..." }
|
|
40
|
+
],
|
|
41
|
+
"eval_feedback": {
|
|
42
|
+
"suggestions": [{ "assertion": "suggested new assertion", "reason": "why it matters" }],
|
|
43
|
+
"overall": "brief summary assessment"
|
|
44
|
+
}
|
|
45
|
+
}`;async function y(l){let{prompt:u,output:d,expectations:t,model:m,timeout:g=12e4}=l,f=`## Original Prompt
|
|
46
|
+
|
|
47
|
+
${u}
|
|
48
|
+
|
|
49
|
+
## AI Output
|
|
50
|
+
|
|
51
|
+
${d}
|
|
52
|
+
|
|
53
|
+
## Expectations to Evaluate
|
|
54
|
+
|
|
55
|
+
${t.map((e,s)=>`${s+1}. ${e}`).join(`
|
|
56
|
+
`)}
|
|
57
|
+
|
|
58
|
+
Grade the output against each expectation. Respond with ONLY valid JSON.`,a=await p({prompt:f,targetContent:v,timeout:g,model:m});if(a.error)return{expectations:t.map(e=>({text:e,passed:!1,evidence:`Grader error: ${a.error}`})),summary:{passed:0,failed:t.length,total:t.length,pass_rate:0},claims:[],eval_feedback:{suggestions:[],overall:`Grading failed: ${a.error}`}};try{let e=a.output.trim(),s=e.match(/```(?:json)?\s*([\s\S]*?)```/);s&&(e=s[1].trim());let n=e.match(/\{[\s\S]*\}/);n&&(e=n[0]);let r=JSON.parse(e),o=r.expectations.filter(h=>h.passed).length,i=r.expectations.length;return r.summary={passed:o,failed:i-o,total:i,pass_rate:i>0?o/i:0},r}catch{return{expectations:t.map(e=>({text:e,passed:!1,evidence:"Grader output was not valid JSON"})),summary:{passed:0,failed:t.length,total:t.length,pass_rate:0},claims:[],eval_feedback:{suggestions:[],overall:`Grader returned unparseable output: ${a.output.slice(0,200)}`}}}}c(y,"gradeEvalOutput");export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,b as n}from"./chunk-ZLLER3HP.js";import*as s from"node:fs";import*as t from"node:path";import*as c from"node:os";import{SkillCatalog as g}from"@rulemetric/skills-registry";var a=t.join(c.homedir(),".config","rulemetric","skills-registry.json");function u(){try{let e=t.dirname(n.resolve("@rulemetric/skills-registry/package.json")),r=t.join(e,"registry.json");if(s.existsSync(r))return r}catch{let e=t.resolve(process.cwd(),"packages","skills-registry","registry.json");if(s.existsSync(e))return e}return null}o(u,"findBundledRegistry");async function y(e){let r=new g;if(s.existsSync(a))try{let i=JSON.parse(s.readFileSync(a,"utf-8"));return r.load(i),r}catch{}let l=u();if(l)try{let i=JSON.parse(s.readFileSync(l,"utf-8"));return r.load(i),r}catch{}return e.log("No local registry found. Run: rulemetric skills update"),r}o(y,"loadRegistry");export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as d}from"node:crypto";import{readdirSync as h,readFileSync as l}from"node:fs";import{join as u,relative as g}from"node:path";var _=new Set(["node_modules",".git","dist","build","out",".next","coverage",".turbo","vendor",".venv"]),a=50,f=8,m=o(s=>d("sha256").update(s).digest("hex"),"sha256");function p(s){let n=[],r=o((i,t)=>{if(n.length>=a||t>f)return;let c;try{c=h(i,{withFileTypes:!0})}catch{return}for(let e of c){if(n.length>=a)return;if(e.isDirectory()){if(_.has(e.name)||e.name.startsWith("."))continue;r(u(i,e.name),t+1)}else e.isFile()&&e.name==="CLAUDE.md"&&n.push(u(i,e.name))}},"walk");return r(s,0),n.sort()}o(p,"findClaudeMdFiles");function S(s){let n=[],r=[];for(let i of p(s)){let t;try{t=l(i,"utf-8")}catch{continue}if(!t.trim())continue;let c=r.length;r.push(t),n.push({type:"claude_md",name:g(s,i)||"CLAUDE.md",content_hash:m(t),char_count:t.length,estimated_tokens:Math.ceil(t.length/4),instruction_index:c})}return n.length===0?null:{provider:"claude_code",model:"unknown",system_prompt:"",system_hash:m(""),injected_instructions:r,context_items:n,metadata:{source:"hook_instruction_snapshot"}}}o(S,"buildInstructionSnapshot");export{S as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d,c as m}from"./chunk-TIQ7DQ3M.js";import{a as c,k as a}from"./chunk-M6AJDVCL.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as g,randomUUID as v}from"node:crypto";import{hostname as y,platform as p}from"node:os";import{existsSync as P,mkdirSync as _,readFileSync as h,writeFileSync as R}from"node:fs";import{join as E}from"node:path";var O="device-id";function u(){let e=o(t=>t==="1"||t==="true","off");return e(process.env.RULEMETRIC_NO_TELEMETRY)||e(process.env.DO_NOT_TRACK)}o(u,"telemetryDisabled");function l(){let e=a(),t=E(e,O);try{if(P(t)){let r=h(t,"utf-8").trim();if(r)return r}}catch{}let n=g("sha256").update(`${v()}:${y()}`).digest("hex").slice(0,32);try{_(e,{recursive:!0}),R(t,n,{mode:384})}catch{}return n}o(l,"getDeviceId");async function U(e,t={},n){if(!u())try{await m("/api/telemetry/cli-events",{method:"POST",body:{event:e,deviceId:l(),cliVersion:n,os:p(),props:t},timeoutMs:5e3})}catch{}}o(U,"emitSetupEvent");async function w(e){if(u())return;let n=`${process.env.RULEMETRIC_API_URL??c().apiUrl??d}/api/telemetry/cli-error`,r=process.env.HTTPS_PROXY,s=process.env.HTTP_PROXY,T=r!==void 0||s!==void 0;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let i=new AbortController,f=setTimeout(()=>i.abort(),4e3);try{await globalThis.fetch(n,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`rulemetric-cli/${e.cliVersion??"unknown"}`},body:JSON.stringify({event:e.event??"onboarding_error",deviceId:l(),command:e.command,statusCode:e.statusCode,message:e.message?e.message.slice(0,500):void 0,cliVersion:e.cliVersion,os:p(),nodeVersion:process.version,proxied:T,props:e.props}),signal:i.signal})}catch{}finally{clearTimeout(f),r!==void 0&&(process.env.HTTPS_PROXY=r),s!==void 0&&(process.env.HTTP_PROXY=s)}}o(w,"emitErrorBeacon");export{u as a,l as b,U as c,w as d};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{c as v}from"./chunk-VUGRXM7R.js";import{a as y,b as R}from"./chunk-KKDHD4XA.js";import{a as i}from"./chunk-ZLLER3HP.js";import{spawn as M}from"node:child_process";import*as T from"node:fs";import*as h from"node:http";import*as m from"node:net";import*as E from"node:os";import*as w from"node:path";var O=8787,S=8788,b=3e3,N=500,I=6e4,B=w.join(E.homedir(),".config","rulemetric","proxy-addon.version"),P=w.join(E.homedir(),".config","rulemetric","proxy.pid"),u=!1;var $=null,H=0,A="unknown",f=null;function c(e){let t=new Date().toISOString();console.log(`[${t}] ${e}`)}i(c,"log");function D(){try{return T.readFileSync(B,"utf-8").trim()||null}catch{return null}}i(D,"readAddonVersion");function _(e,t){if(e==="unknown"||!t)return;let n=D();if(!n||n==="unknown"||n===$)return;if($=n,n===e){c(`addon version matches gateway (${e})`);return}let o=Date.now()-H;if(o<I){c(`addon version drift (gateway=${e}, addon=${n}); restart cooldown active (${Math.round((I-o)/1e3)}s left)`);return}c(`addon version drift detected (gateway=${e}, addon=${n}). Restarting proxy to pick up latest code.`),H=Date.now(),C(t)}i(_,"maybeRestartOnDrift");function C(e){if(!e)return c("cannot restart proxy: no CLI entry recorded (RULEMETRIC_CLI_ENTRY unset)"),!1;try{return M(process.execPath,[e,"proxy","restart"],{detached:!0,stdio:"ignore"}).unref(),!0}catch(t){return c(`restart spawn failed: ${t.message}`),!1}}i(C,"spawnProxyRestart");function Y(){try{let e=T.readFileSync(P,"utf-8").trim();return/^\d+$/.test(e)}catch{return!1}}i(Y,"proxyCrashEvidence");function L(e){let t=m.connect({port:e,timeout:N});t.on("connect",()=>{t.destroy(),u||(u=!0,c(`mitmproxy up on :${e}, routing through proxy`)),f?.onHealthCheck(!0)}),t.on("error",()=>{u&&(u=!1,c(`mitmproxy down on :${e}, routing direct`)),f?.onHealthCheck(!1)}),t.on("timeout",()=>{t.destroy(),u&&(u=!1,c(`mitmproxy timeout on :${e}, routing direct`)),f?.onHealthCheck(!1)})}i(L,"checkProxyHealth");function U(e,t,n,o){let[a,s]=(e.url??"").split(":"),d=parseInt(s,10)||443;if(u){let r=m.connect({port:o,host:"127.0.0.1"});r.on("connect",()=>{r.write(`CONNECT ${e.url} HTTP/1.1\r
|
|
2
|
+
Host: ${e.url}\r
|
|
3
|
+
\r
|
|
4
|
+
`)});let l=Buffer.alloc(0),p=i(g=>{l=Buffer.concat([l,g]),l.toString().includes(`\r
|
|
5
|
+
\r
|
|
6
|
+
`)&&(r.removeListener("data",p),t.write(`HTTP/1.1 200 Connection Established\r
|
|
7
|
+
\r
|
|
8
|
+
`),n.length>0&&r.write(n),t.pipe(r),r.pipe(t))},"onData");r.on("data",p),r.on("error",g=>{c(`proxy socket error for ${e.url}: ${g.message}, falling back to direct`),x(e,t,n,a,d)}),t.on("error",()=>{r.destroy()})}else x(e,t,n,a,d)}i(U,"handleConnect");function x(e,t,n,o,a){let s=m.connect({port:a,host:o});s.on("connect",()=>{t.write(`HTTP/1.1 200 Connection Established\r
|
|
9
|
+
\r
|
|
10
|
+
`),n.length>0&&s.write(n),t.pipe(s),s.pipe(t)}),s.on("error",d=>{c(`upstream error for ${e.url}: ${d.message}`),t.end(`HTTP/1.1 502 Bad Gateway\r
|
|
11
|
+
\r
|
|
12
|
+
`)}),t.on("error",()=>{s.destroy()})}i(x,"connectDirect");function V(e,t,n){if(e.url===y){t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify({service:R,version:A,pid:process.pid,mitmproxyAlive:u}));return}let o=e.url??"",a;try{a=new URL(o)}catch{t.writeHead(400),t.end("Bad Request");return}let s={hostname:u?"127.0.0.1":a.hostname,port:u?n:parseInt(a.port,10)||80,path:u?o:a.pathname+a.search,method:e.method,headers:e.headers},d=h.request(s,r=>{t.writeHead(r.statusCode??502,r.headers),r.pipe(t)});d.on("error",r=>{c(`HTTP proxy error for ${o}: ${r.message}`),t.writeHead(502),t.end("Bad Gateway")}),e.pipe(d)}i(V,"handleRequest");function j(e=O,t=S,n={}){let o=n.cliVersion??process.env.RULEMETRIC_CLI_VERSION??"unknown",a=n.cliEntry??process.env.RULEMETRIC_CLI_ENTRY??null;A=o,f=new v({hasCrashEvidence:Y,respawn:i(()=>C(a),"respawn"),log:c});let s=h.createServer((r,l)=>{V(r,l,t)});s.on("connect",(r,l,p)=>{U(r,l,p,t)}),s.on("clientError",(r,l)=>{l.writable&&l.end(`HTTP/1.1 400 Bad Request\r
|
|
13
|
+
\r
|
|
14
|
+
`)});let d=setInterval(()=>{L(t),_(o,a)},b);return L(t),_(o,a),s.listen(e,"127.0.0.1",()=>{c(`gateway listening on 127.0.0.1:${e} (mitmproxy target: :${t}, cli version: ${o})`)}),{server:s,healthInterval:d}}i(j,"startGateway");export{O as a,S as b,j as c};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import{a as p}from"./chunk-MGHFDHHM.js";import{a as c}from"./chunk-ZLLER3HP.js";var y=`You are an expert at improving AI coding instructions, skills, and prompts. You receive eval results showing how well the current content performs, and your job is to propose specific improvements.
|
|
2
|
+
|
|
3
|
+
You will receive:
|
|
4
|
+
1. The current content of the eval target
|
|
5
|
+
2. Eval results: for each eval, the prompt, expectations, pass/fail results, and grader feedback
|
|
6
|
+
3. The pass rate and areas of weakness
|
|
7
|
+
|
|
8
|
+
Analyze the failures and propose concrete edits to improve the content. Focus on:
|
|
9
|
+
- Expectations that consistently fail \u2014 what's missing from the content?
|
|
10
|
+
- Grader feedback suggesting new assertions \u2014 what outcomes aren't being tested?
|
|
11
|
+
- Patterns across failures \u2014 is there a systemic gap?
|
|
12
|
+
|
|
13
|
+
Your proposed content should be a complete replacement, not a diff. Keep what works, fix what doesn't.
|
|
14
|
+
|
|
15
|
+
You MUST respond with ONLY a valid JSON object:
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
"suggestions": [
|
|
19
|
+
{
|
|
20
|
+
"section": "which part of the content",
|
|
21
|
+
"current": "brief quote of current text",
|
|
22
|
+
"proposed": "what it should say instead",
|
|
23
|
+
"reasoning": "why this change helps"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"overallAssessment": "brief summary of what's working and what's not",
|
|
27
|
+
"proposedContent": "the full improved content"
|
|
28
|
+
}`;async function w(l){let{content:o,evalResults:u,model:d,timeout:m=12e4,userFeedback:i}=l,g=u.map(e=>{let t=e.grading,n=t?.expectations??[],r=t?.summary?.pass_rate??"N/A",v=t?.eval_feedback?.overall??"";return`## Eval: ${e.evalName}
|
|
29
|
+
Prompt: ${e.prompt}
|
|
30
|
+
Pass rate: ${typeof r=="number"?(r*100).toFixed(0)+"%":r}
|
|
31
|
+
|
|
32
|
+
Expectations:
|
|
33
|
+
${n.map(a=>` ${a.passed?"PASS":"FAIL"} \u2014 ${a.text}: ${a.evidence}`).join(`
|
|
34
|
+
`)}
|
|
35
|
+
|
|
36
|
+
Feedback: ${v}`}).join(`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
`),h=i?`
|
|
41
|
+
|
|
42
|
+
## User Feedback
|
|
43
|
+
|
|
44
|
+
${i}`:`
|
|
45
|
+
|
|
46
|
+
## User Feedback
|
|
47
|
+
|
|
48
|
+
No specific feedback provided.`,f=`## Current Content
|
|
49
|
+
|
|
50
|
+
${o}
|
|
51
|
+
|
|
52
|
+
## Eval Results
|
|
53
|
+
|
|
54
|
+
${g}${h}
|
|
55
|
+
|
|
56
|
+
Analyze the results and propose improvements. Respond with ONLY valid JSON.`,s=await p({prompt:f,targetContent:y,timeout:m,model:d});if(s.error)return{suggestions:[],overallAssessment:`Analysis failed: ${s.error}`,proposedContent:o};try{let e=s.output.trim(),t=e.match(/```(?:json)?\s*([\s\S]*?)```/);t&&(e=t[1].trim());let n=e.match(/\{[\s\S]*\}/);return n&&(e=n[0]),JSON.parse(e)}catch{return{suggestions:[],overallAssessment:`Analysis returned unparseable output: ${s.output.slice(0,200)}`,proposedContent:o}}}c(w,"analyzeEvalResults");export{w as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{b as h,c as R}from"./chunk-TIQ7DQ3M.js";import{a as o}from"./chunk-ZLLER3HP.js";import{existsSync as C,mkdirSync as I,readFileSync as l,renameSync as D,rmdirSync as A,writeFileSync as m}from"node:fs";import{homedir as L,tmpdir as v}from"node:os";import{join as c}from"node:path";var _=100,M=new Set(["RUN_COMMAND","VIEW_FILE","LIST_DIRECTORY","CODE_ACTION","GREP_SEARCH","SEARCH_WEB"]),U=new Set(["CONVERSATION_HISTORY","KNOWLEDGE_ARTIFACTS","CHECKPOINT"]);function x(){return process.env.RULEMETRIC_CONFIG_DIR??c(L(),".config","rulemetric")}o(x,"configDir");function T(){return c(x(),"antigravity-state")}o(T,"stateDir");function O(t){return c(T(),`${t}.json`)}o(O,"stateFile");function P(){let t=c(x(),"env");if(C(t))try{let n=l(t,"utf-8");for(let r of n.split(/\r?\n/)){let e=r.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);if(!e)continue;let i=e[1];if(process.env[i]!==void 0)continue;let s=e[2];(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),process.env[i]=s}}catch{}}o(P,"loadEnvFile");function k(t){try{let n=l(O(t),"utf-8"),r=JSON.parse(n);if(r&&typeof r=="object"&&"lastStepIdx"in r){let e=r.lastStepIdx;if(typeof e=="number"&&Number.isFinite(e))return{lastStepIdx:e}}}catch{}return null}o(k,"loadState");function f(t,n){I(T(),{recursive:!0});let r=O(t),e=`${r}.tmp`;m(e,JSON.stringify(n),{mode:384});try{D(e,r)}catch{m(r,JSON.stringify(n),{mode:384})}}o(f,"saveState");function b(t){let n=process.env.TMPDIR??v(),r=c(n,"rulemetric"),e=c(r,t);try{return l(e,"utf-8").trim()||null}catch{return null}}o(b,"resolveRwSessionId");function $(t){let n=process.env.TMPDIR??v(),r=c(n,"rulemetric"),e=c(r,`${t}.seq`),i=c(r,`${t}.seqlock`),s=Date.now()+5e3;for(;Date.now()<s;)try{I(i);break}catch{}let a=1;try{a=parseInt(l(e,"utf-8").trim(),10)+1,(!Number.isFinite(a)||a<1)&&(a=1)}catch{a=1}try{m(e,String(a))}catch{}try{A(i)}catch{}return a}o($,"nextSequence");function F(t,n){let r;try{r=l(t,"utf-8")}catch{return[]}let e=[];for(let i of r.split(/\r?\n/))if(i.trim())try{let s=JSON.parse(i);typeof s.step_index=="number"&&s.step_index>n&&e.push(s)}catch{}return e.sort((i,s)=>i.step_index-s.step_index),e}o(F,"readNewRecords");function H(t){let n;try{n=l(t,"utf-8")}catch{return-1}let r=-1;for(let e of n.split(/\r?\n/))if(e.trim())try{let i=JSON.parse(e);typeof i.step_index=="number"&&i.step_index>r&&(r=i.step_index)}catch{}return r}o(H,"findMaxStepIndex");function W(t){let n=t.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/);return n?n[1].trim():t.trim()}o(W,"extractUserPrompt");function Y(t,n){let r=t.created_at??new Date().toISOString(),e={antigravityStepIndex:t.step_index,antigravitySource:t.source,antigravityType:t.type};if(U.has(t.type)||M.has(t.type))return null;if(t.source==="USER_EXPLICIT"&&t.type==="USER_INPUT")return{sequence:n,eventType:"user_message",content:W(t.content??""),timestamp:r,metadata:e};if(t.source==="MODEL"&&t.type==="PLANNER_RESPONSE"){let i=[];return t.thinking&&t.thinking.trim()&&i.push(`[thinking]
|
|
2
|
+
${t.thinking.trim()}`),t.content&&t.content.trim()&&i.push(t.content.trim()),t.tool_calls&&t.tool_calls.length>0&&(e.antigravityToolCalls=t.tool_calls.map(s=>s.name).filter(Boolean)),{sequence:n,eventType:"assistant_response",content:i.join(`
|
|
3
|
+
|
|
4
|
+
`)||null,timestamp:r,metadata:e}}return t.source==="MODEL"&&t.type==="GENERIC"?{sequence:n,eventType:"tool_result",content:t.content??null,timestamp:r,metadata:e}:t.source==="SYSTEM"&&(t.type==="SYSTEM_MESSAGE"||t.type==="ERROR_MESSAGE")?null:{sequence:n,eventType:`antigravity_${t.type.toLowerCase()}`,content:t.content??null,timestamp:r,metadata:e}}o(Y,"classifyRecord");function G(t){try{let n=JSON.parse(t);return n&&typeof n=="object"?n:null}catch{return null}}o(G,"parseHookPayload");async function J(t,n,r,e,i={}){let s=i.errorSink??(u=>process.stderr.write(u)),a=0,d=0,g=0,S=0,p=e;for(let u of t){a++,i.onProgress?.({attempted:a,total:t.length,record:u});let N=$(r),y=Y(u,N);if(!y)S++;else try{await R(`/api/sessions/${n}/events`,{method:"POST",body:y}),d++}catch(E){g++;let w=E instanceof h?E.statusCode:"unknown";s(`[antigravity-tailer] failed step=${u.step_index} type=${u.type} status=${w}
|
|
5
|
+
`)}u.step_index>p&&(p=u.step_index)}return{attempted:a,emitted:d,failed:g,skipped:S,highestStepIdx:p}}o(J,"emitRecordsAsEvents");async function B(t){let n=G(t);if(!n?.conversationId||!n?.transcriptPath||(P(),!process.env.RULEMETRIC_API_URL))return;let r=b(n.conversationId);if(!r)return;let e=k(n.conversationId);if(e===null){let a=H(n.transcriptPath);f(n.conversationId,{lastStepIdx:a});return}let i=F(n.transcriptPath,e.lastStepIdx);if(i.length===0)return;i.length>_&&(i=i.slice(0,_));let s=await J(i,r,n.conversationId,e.lastStepIdx);f(n.conversationId,{lastStepIdx:s.highestStepIdx})}o(B,"tailAntigravityTranscript");var Q={load:k,save:f,resolveRwSessionId:b,loadEnvFile:P};export{F as a,H as b,W as c,Y as d,J as e,B as f,Q as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,b as p,c as x,f as u}from"./chunk-ARNZQBMX.js";import{d as l,h as m}from"./chunk-NJ5UED3H.js";import{a as f}from"./chunk-ZLLER3HP.js";import{Text as r}from"ink";import{jsx as t,jsxs as P}from"react/jsx-runtime";function S({api:s,width:n,barWidth:d}){if(!s)return t(c,{title:"Friction Points",color:m,width:n,children:t(r,{dimColor:!0,children:"API offline \u2014 no friction data"})});let h=s.friction??{},e=Object.entries(h).sort(([,i],[,o])=>o-i);if(e.length===0)return t(c,{title:"Friction Points",color:l,width:n,children:t(r,{dimColor:!0,children:"No friction detected \u2014 nice!"})});let T=e[0][1],a=e.reduce((i,[,o])=>i+o,0),g=Math.max(8,n-d-20);return t(c,{title:`Friction Points (${a} incidents)`,color:m,width:n,children:e.map(([i,o])=>{let b=a>0?Math.round(o/a*100):0;return P(r,{wrap:"truncate-end",children:[t(p,{value:o,max:T,width:d}),P(r,{color:l,children:[" ",x(u(i),g)]}),t(r,{children:String(o).padStart(5)}),t(r,{dimColor:!0,children:(b+"%").padStart(5)})]},i)})})}f(S,"FrictionPanel");export{S as a};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{a as j,b as C,c as T}from"./chunk-VWEXKDWG.js";import{c as O,d as A,f as w}from"./chunk-RTWRHIKY.js";import{a as I}from"./chunk-ZL4MZMUK.js";import{a as b}from"./chunk-5RBLIVBF.js";import{d as h,e as R,g}from"./chunk-TIQ7DQ3M.js";import{a as _}from"./chunk-ZLLER3HP.js";async function B(d,u){let{mirrorId:o,projectPath:s,projectId:i,config:m}=d,e=_(n=>u.logger.info(n),"log");if(m?.sessionId)return N({mirrorId:o,sessionId:m.sessionId},e);e(`Processing insights job ${o}...`),await g(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:"reading_data"}});try{let{repaired:n}=await R("/api/sessions/repair-analyzed-at",{});n>0&&e(` Repaired analyzed_at on ${n} orphan session(s).`)}catch(n){e(` Warning: analyzed_at repair failed: ${n instanceof Error?n.message:String(n)}`)}let a=await M(s,i);if(!a)throw new b("No session data found \u2014 ensure sessions are captured and enriched.");e(` Found ${a.stats.sessions} sessions, generating recommendations...`);let $=20,c=200;if(A()!=="none"){let n=0;try{for(;n<c;){let t=await h(`/api/sessions?hasAnalysis=false&limit=${$}`);if(t.length===0)break;e(` Generating facets for ${t.length} un-analyzed sessions (drained ${n} so far)...`);for(let p of t){if(n>=c)break;try{let l=await h(`/api/sessions/${p.id}/events?limit=100`);if(l.length<2){n++;continue}let v=l.filter(y=>y.eventType==="user_message"||y.eventType==="human").map(y=>y.content?.slice(0,200)??"").filter(Boolean).join(`
|
|
2
|
+
---
|
|
3
|
+
`);if(!v){n++;continue}let P=await w(T,v,4096);if(P){let y=l.filter(E=>E.eventType==="user_message"||E.eventType==="human").length;await g(`/api/sessions/${p.id}/enrich`,{analysis:{source:"generated_facets",...P},analyzedEventCount:l.length,analyzedTurnCount:y}),e(` Generated facets for session ${p.id} (${p.tool})`)}n++}catch(l){e(` Failed to generate facets for session ${p.id}: ${l instanceof Error?l.message:String(l)}`),n++}}if(t.length<$)break}}catch(t){e(` Warning: facet generation failed after ${n} sessions: ${t instanceof Error?t.message:String(t)}`)}}let r={},f=j.length+1;for(let n=0;n<j.length;n++){let t=j[n];e(` [${n+1}/${f}] Generating ${t.name}...`);try{await g(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:t.name,current:n+1,total:f,partial:{...r}}})}catch(l){e(` Warning: progress update failed for ${t.name}: ${l instanceof Error?l.message:String(l)}`)}e(` Running LLM prompt for ${t.name}...`);let p=await w(t.prompt,a.summary,t.maxTokens);p?(r[t.name]=p,e(` Got result for ${t.name}`)):e(` No result for ${t.name} (LLM returned null)`)}e(` [${f}/${f}] Generating at_a_glance...`),await g(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:"at_a_glance",current:f,total:f,partial:{...r}}});let z=[a.summary,r.what_works?`
|
|
4
|
+
## What Works
|
|
5
|
+
${JSON.stringify(r.what_works)}`:"",r.friction_analysis?`
|
|
6
|
+
## Friction
|
|
7
|
+
${JSON.stringify(r.friction_analysis)}`:"",r.suggestions?`
|
|
8
|
+
## Suggestions
|
|
9
|
+
${JSON.stringify(r.suggestions)}`:"",r.on_the_horizon?`
|
|
10
|
+
## On the Horizon
|
|
11
|
+
${JSON.stringify(r.on_the_horizon)}`:""].join(`
|
|
12
|
+
`),S=await w(C,z,8192);S&&(r.at_a_glance=S),e(" Uploading results..."),e(` Done! Recommendations generated for job ${o}`),I(r);let k={recommendations:r};return await g(`/api/insights-jobs/${o}/state`,{result:k}).catch(n=>{e(`result persist failed: ${n instanceof Error?n.message:String(n)}`)}),k}_(B,"processInsights");async function N(d,u){let{mirrorId:o,sessionId:s}=d;u(`Analyzing session ${s} via tool CLI...`),await g(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:"fetching_session"}});let i=await h(`/api/sessions/${s}`);if(i.analysis&&i.analysis.source==="session_analysis")return u(` Session ${s} already analyzed \u2014 skipping (idempotency guard)`),{sessionId:s,skipped:!0,reason:"already_analyzed"};let m=await h(`/api/sessions/${s}/events?limit=100`);if(m.length<2)throw new b("Session has too few events to analyze");let e=m.filter(c=>c.eventType==="user_message"||c.eventType==="human").map(c=>c.content?.slice(0,200)??"").filter(Boolean).join(`
|
|
13
|
+
---
|
|
14
|
+
`);if(!e)throw new b("No user messages found in session");await g(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:"running_analysis",tool:i.tool}});let a=O(i.tool,T,e);if(!a)throw new Error(`Analysis failed \u2014 ${i.tool} CLI returned no result`);let $=m.filter(c=>c.eventType==="user_message"||c.eventType==="human").length;return await g(`/api/sessions/${s}/enrich`,{analysis:{source:"session_analysis",tool:i.tool,...a},analyzedEventCount:m.length,analyzedTurnCount:$}),u(` Session ${s} analyzed via ${i.tool}`),{sessionId:s,tool:i.tool,facets:a}}_(N,"processSessionAnalysisInline");async function M(d,u){try{let o=new URLSearchParams;u?o.set("projectId",u):d&&o.set("projectPath",d);let s=await h(`/api/insights/compute?${o}`);if(!s||s.total_sessions===0)return null;let i=Object.entries(s.tool_counts??{}).sort((e,a)=>a[1]-e[1]).slice(0,10).map(([e,a])=>`${e}: ${a}`).join(", ");return{summary:[`Sessions: ${s.total_sessions}, Messages: ${s.total_messages}, Hours: ${Math.round(s.total_duration_hours)}`,`Top tools: ${i}`,s.goal_categories&&Object.keys(s.goal_categories).length>0?`Goals: ${JSON.stringify(s.goal_categories)}`:"",s.friction&&Object.keys(s.friction).length>0?`Friction: ${JSON.stringify(s.friction)}`:"",s.outcomes&&Object.keys(s.outcomes).length>0?`Outcomes: ${JSON.stringify(s.outcomes)}`:"",s.projects&&Object.keys(s.projects).length>0?`Projects: ${JSON.stringify(s.projects)}`:""].filter(Boolean).join(`
|
|
15
|
+
`),stats:{sessions:s.total_sessions,totalMessages:s.total_messages,totalHours:s.total_duration_hours,toolCounts:s.tool_counts,goalCounts:s.goal_categories,frictionCounts:s.friction}}}catch{return null}}_(M,"buildDataSummaryFromApi");export{B as a};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{a as u}from"./chunk-MGHFDHHM.js";import{a as l}from"./chunk-ZLLER3HP.js";var w=`You are determining whether an AI assistant's response shows evidence of using a specific skill/instruction.
|
|
2
|
+
|
|
3
|
+
You will receive:
|
|
4
|
+
1. The skill name and description
|
|
5
|
+
2. Key content from the skill (to know what it teaches)
|
|
6
|
+
3. The user's query
|
|
7
|
+
4. The AI's response
|
|
8
|
+
|
|
9
|
+
Determine if the response shows clear signs of the skill being used:
|
|
10
|
+
- Does the response follow patterns/approaches described in the skill?
|
|
11
|
+
- Does it use terminology or structures specific to the skill?
|
|
12
|
+
- Would the response be noticeably different without the skill?
|
|
13
|
+
|
|
14
|
+
Respond with ONLY a valid JSON object:
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
"triggered": true,
|
|
18
|
+
"confidence": 0.85,
|
|
19
|
+
"evidence": "The response follows the X pattern described in the skill..."
|
|
20
|
+
}`;async function v(t){let{query:r,shouldTrigger:e,skillName:m,skillDescription:T,skillContent:a,model:d,timeout:k=12e4}=t,s=await u({prompt:r,targetContent:a,timeout:k,model:d});if(s.error)return{query:r,shouldTrigger:e,didTrigger:!1,correct:!e,confidence:0,evidence:`Execution failed: ${s.error}`};let b=`## Skill
|
|
21
|
+
Name: ${m}
|
|
22
|
+
Description: ${T}
|
|
23
|
+
|
|
24
|
+
## Key Skill Content (first 500 chars)
|
|
25
|
+
${a.slice(0,500)}
|
|
26
|
+
|
|
27
|
+
## User Query
|
|
28
|
+
${r}
|
|
29
|
+
|
|
30
|
+
## AI Response
|
|
31
|
+
${s.output}
|
|
32
|
+
|
|
33
|
+
Did the AI's response show evidence of using this skill? Respond with ONLY valid JSON.`,g=await u({prompt:b,targetContent:w,timeout:6e4,model:d}),o=!1,h=0,n="";try{let i=g.output.trim(),p=i.match(/```(?:json)?\s*([\s\S]*?)```/);p&&(i=p[1].trim());let f=i.match(/\{[\s\S]*\}/);f&&(i=f[0]);let c=JSON.parse(i);o=c.triggered===!0,h=c.confidence??0,n=c.evidence??""}catch{n=`Detector returned unparseable output: ${g.output.slice(0,200)}`}return{query:r,shouldTrigger:e,didTrigger:o,correct:o===e,confidence:h,evidence:n}}l(v,"testTrigger");function y(t){return t.length===0?0:t.filter(e=>e.correct).length/t.length}l(y,"computeTriggerScore");export{v as a,y as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as R}from"./chunk-5RBLIVBF.js";import{a as N}from"./chunk-2TC6WCUT.js";import{a as C}from"./chunk-6V4WM73L.js";import{a as I}from"./chunk-CADKBP3D.js";import{a as M}from"./chunk-MGHFDHHM.js";import{d as k,e as y,g as p}from"./chunk-TIQ7DQ3M.js";import{a as h}from"./chunk-ZLLER3HP.js";async function H(v,m){let{mirrorId:s,evalTargetId:d,config:a}=v,r=h(t=>m.logger.info(t),"log");if(m.job.attempts>1)throw new R(`process_eval is not safe to retry (attempt ${m.job.attempts}). Re-trigger the eval run from the UI.`);let i=await k(`/api/eval-targets/${d}`),$=await k(`/api/eval-targets/${d}/evals`);if($.length===0)throw new R("No evals defined for target");let J=a.runsPerEval??1,E=a.timeout??12e4,T=a.iteration??1,_=[{name:"with_target",content:i.content}];a.skipBaseline||_.push({name:"without_target"});let f=[];for(let t of $)for(let e of _)for(let n=1;n<=J;n++)f.push({eval_:t,configuration:e.name,targetContent:e.content,runNumber:n});let l=f.length,u=0,g=Math.min(a.parallel??1,4);await p(`/api/eval-jobs/${s}/progress`,{status:"running",progress:{total:l,completed:0,current:null,message:`Starting ${l} eval runs (concurrency: ${g})...`}});let w=[];async function j(t){let e=`${t.configuration} \xB7 ${t.eval_.name} \xB7 run#${t.runNumber}`;r(`[${u+1}/${l}] ${e}`);let n=g>1?C():null;try{let o=await M({prompt:t.eval_.prompt,targetContent:t.targetContent,workDir:n?.workDir,timeout:E,model:a.model}),c={};return!a.skipGrading&&t.eval_.expectations.length>0&&!o.error&&(c=await I({prompt:t.eval_.prompt,output:o.output,expectations:t.eval_.expectations,model:a.graderModel??a.model,timeout:E})),{evalId:t.eval_.id,evalTargetId:i.id,evalTargetVersion:i.version,configuration:t.configuration,runNumber:t.runNumber,iteration:T,status:o.error?"failed":"completed",outputs:o.error?{error:o.error}:{transcript:o.output},timing:{duration_ms:o.durationMs,total_tokens:o.totalTokens},grading:c,worktree:n?.isWorktree?!0:void 0}}finally{n?.cleanup()}}if(h(j,"processItem"),g<=1)for(let t of f){let e=`${t.configuration} \xB7 ${t.eval_.name} \xB7 run#${t.runNumber}`;await p(`/api/eval-jobs/${s}/progress`,{status:"running",progress:{total:l,completed:u,current:e,message:`Executing ${e}...`}});let n=await j(t);await y("/api/eval-runs",n),w.push(n),u++,await p(`/api/eval-jobs/${s}/progress`,{status:"running",progress:{total:l,completed:u,current:e,message:`Completed ${e}`}})}else{r(`Running ${l} evals with concurrency=${g} (worktree isolation)`);for(let t=0;t<f.length;t+=g){let e=f.slice(t,t+g),n=`batch ${Math.floor(t/g)+1}/${Math.ceil(f.length/g)}`;await p(`/api/eval-jobs/${s}/progress`,{status:"running",progress:{total:l,completed:u,current:n,message:`Executing ${n} (${e.length} parallel)...`}});let o=await Promise.all(e.map(j));for(let c of o)await y("/api/eval-runs",c),w.push(c),u++;await p(`/api/eval-jobs/${s}/progress`,{status:"running",progress:{total:l,completed:u,current:n,message:`Completed ${n}`}})}}let x=G(w),b;if(!a.skipGrading&&w.some(t=>t.grading&&Object.keys(t.grading).length>0))try{r(`Running meta-judge for job ${s}...`);let t=$.map(e=>{let o=w.filter(c=>c.evalId===e.id&&c.configuration==="with_target")[0];return{evalName:e.name,prompt:e.prompt,expectations:e.expectations,grading:o?.grading?o.grading:null,output:o?.outputs?.transcript?.slice(0,500)}});b=await N({targetName:i.name,evalResults:t,model:a.graderModel??a.model,timeout:6e4}),r(`Meta-judge: quality=${b.quality_score}/5, issues=${b.issues.length}`)}catch(t){r(`Meta-judge failed (non-fatal): ${t instanceof Error?t.message:String(t)}`)}let P=b?{...x,meta_judgement:b}:x;return r(`Job ${s} completed: ${u}/${l} runs`),await p(`/api/eval-jobs/${s}/state`,{result:P}).catch(t=>{r(`result persist failed: ${t instanceof Error?t.message:String(t)}`)}),P}h(H,"processEval");function G(v){let m=v.filter(r=>r.status==="completed"),s=v.filter(r=>r.status==="failed"),d=m.filter(r=>{let i=r.grading;return i&&Object.keys(i).length>0}),a=d.length>0?d.reduce((r,i)=>r+(i.grading?.summary?.pass_rate??0),0)/d.length:null;return{total:v.length,completed:m.length,failed:s.length,avgPassRate:a}}h(G,"buildSummary");export{H as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h,c as _}from"./chunk-ARNZQBMX.js";import{d as a,e as m,g as S,i as w}from"./chunk-NJ5UED3H.js";import{a as u,b as M}from"./chunk-ZLLER3HP.js";import{useState as B,useMemo as P}from"react";import{Box as g,Text as r,useInput as R}from"ink";import{jsx as o,jsxs as d}from"react/jsx-runtime";function D(n){let t=n.recommendations;if(!t)return[];let s=[];for(let e of t.suggestions?.features_to_try??[])e.example_code&&s.push({label:e.feature,description:e.why_for_you||e.one_liner,command:e.example_code});for(let e of t.suggestions?.usage_patterns??[])e.copyable_prompt&&s.push({label:e.title,description:e.suggestion,command:e.copyable_prompt});for(let e of t.on_the_horizon?.opportunities??[])e.copyable_prompt&&s.push({label:e.title,description:e.whats_possible,command:e.copyable_prompt});return s}u(D,"extractSuggestions");function E(n){let t=n.trim();return/^(claude|rulemetric|pnpm|npm|npx|git)\s/.test(t)?t:`claude -p '${t.replace(/'/g,"'\\''")}'`}u(E,"toCliCommand");function G(n){try{let{execSync:t}=M("node:child_process");return process.platform==="darwin"?t("pbcopy",{input:n,stdio:["pipe","ignore","ignore"]}):t("xclip -selection clipboard",{input:n,stdio:["pipe","ignore","ignore"]}),!0}catch{return!1}}u(G,"copyToClipboard");function q({api:n,width:t,focused:s,onSelect:e}){let[b,y]=B(0),[C,I]=B(null),p=P(()=>n?D(n):[],[n]),f=n?.recommendations?.at_a_glance;if(R((l,c)=>{if(!(!s||p.length===0)){if(c.upArrow)y(i=>Math.max(0,i-1));else if(c.downArrow)y(i=>Math.min(p.length-1,i+1));else if(c.return){let i=p[b];if(i){let x=E(i.command);G(x)&&(I(b),setTimeout(()=>I(null),2e3)),e?.(x)}}}}),!n)return o(h,{title:"Insights",color:a,width:t,children:o(r,{dimColor:!0,children:"API offline \u2014 no insights"})});if(!f&&p.length===0)return o(h,{title:"Insights",color:a,width:t,children:o(r,{dimColor:!0,children:"No recommendations yet. Run: rulemetric insights sync"})});let T=Math.min(30,Math.max(...p.map(l=>l.label.length),10)),A=Math.max(10,t-T-12);return d(h,{title:s?"\u25B8 Insights & Suggestions":"Insights & Suggestions",color:s?a:m,width:t,children:[f&&Object.entries(f).length>0&&o(g,{flexDirection:"column",marginBottom:1,children:Object.entries(f).map(([l,c])=>d(g,{flexDirection:"column",children:[o(r,{color:m,bold:!0,children:l.replace(/_/g," ").toUpperCase()}),o(r,{wrap:"wrap",children:String(c).slice(0,200)})]},l))}),p.length>0&&d(g,{flexDirection:"column",children:[d(g,{marginBottom:0,children:[o(r,{color:a,bold:!0,children:"Suggestions"}),s&&o(r,{dimColor:!0,children:" \u2191\u2193 navigate \u23CE copy command"})]}),p.map((l,c)=>{let i=s&&c===b,x=c===C;return d(g,{children:[o(r,{color:i?a:m,children:i?"\u25B8 ":" "}),o(r,{color:i?a:w,bold:i,children:_(l.label,T)}),o(r,{color:m,children:" \u2502 "}),o(r,{color:i?void 0:m,wrap:"truncate-end",children:_(l.description,A)}),x&&o(r,{color:S,children:" \u2713 copied"})]},c)})]})]})}u(q,"InsightsPanel");export{q as a};
|