@rulemetric/cli 0.13.0 → 0.14.1
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 -1
- package/dist/chunk-2UK4DZFW.js +12 -0
- package/dist/{chunk-3UPHCQWI.js → chunk-35YVHBLL.js} +1 -1
- package/dist/{chunk-VH2EAP4J.js → chunk-3FNTV2TW.js} +1 -1
- package/dist/{chunk-WQX4RRBQ.js → chunk-3IMRLHJJ.js} +1 -1
- package/dist/chunk-42A4PUW7.js +48 -0
- package/dist/chunk-43VKTVM3.js +1 -0
- package/dist/{chunk-CYYDQFRY.js → chunk-44TYRMIS.js} +1 -1
- package/dist/{chunk-25RDT32M.js → chunk-4FJYVYCU.js} +1 -1
- package/dist/{chunk-I3M5VBLT.js → chunk-5BT375C7.js} +1 -1
- package/dist/{chunk-7AWFSFR7.js → chunk-5Z3H5JHK.js} +1 -1
- package/dist/{chunk-25Q3Y7TC.js → chunk-6ANODRDT.js} +1 -1
- package/dist/{chunk-APDRR6FS.js → chunk-76UKAFNM.js} +1 -1
- package/dist/{chunk-VXUKXGRX.js → chunk-7MTYUTUN.js} +2 -2
- package/dist/{chunk-JWFRI32Y.js → chunk-AGEZAKCC.js} +1 -1
- package/dist/chunk-AHLVY52I.js +1 -0
- package/dist/{chunk-MNQPCNGQ.js → chunk-AIYFT4P6.js} +1 -1
- package/dist/{chunk-UYPBIXF2.js → chunk-B5X6HCBK.js} +1 -1
- package/dist/chunk-BAITMD76.js +1 -0
- package/dist/{chunk-GJBS6QYC.js → chunk-BFQVAU6N.js} +1 -1
- package/dist/{chunk-UE76F2NQ.js → chunk-BMT5WMEV.js} +20 -20
- package/dist/chunk-CT6GJQIR.js +1 -0
- package/dist/chunk-CT7FWSIU.js +3 -0
- package/dist/chunk-DHX4U6EC.js +13 -0
- package/dist/chunk-DQYYHX6K.js +1 -0
- package/dist/{chunk-WH3IPXXQ.js → chunk-DVU5PHPM.js} +5 -5
- package/dist/chunk-E7GQJML3.js +1 -0
- package/dist/{chunk-4N43IBXH.js → chunk-EMLLGASZ.js} +1 -1
- package/dist/{chunk-Y7QIOPN5.js → chunk-EUHRTEVJ.js} +1 -1
- package/dist/chunk-FBSZ6KCM.js +1 -0
- package/dist/{chunk-5XK6LB2T.js → chunk-FKTT7A4H.js} +1 -1
- package/dist/{chunk-V2USQH27.js → chunk-FYZ6HHCV.js} +1 -1
- package/dist/chunk-GH4EZK2O.js +1 -0
- package/dist/{chunk-DUBBL57L.js → chunk-GKVHFXUQ.js} +1 -1
- package/dist/chunk-GPBN4ROE.js +2 -0
- package/dist/chunk-GYNZ3OZF.js +1 -0
- package/dist/chunk-H6FVXVGG.js +1 -0
- package/dist/{chunk-6GAIYJ6K.js → chunk-HNYHZO2J.js} +1 -1
- package/dist/{chunk-RJX75Y7J.js → chunk-I6ZQOMZS.js} +1 -1
- package/dist/{chunk-O2HCD6XL.js → chunk-IO46ICZY.js} +1 -1
- package/dist/chunk-IQEZ3T5A.js +1 -0
- package/dist/{chunk-KV5A77XW.js → chunk-ISFPPDDB.js} +1 -1
- package/dist/chunk-J4W6GNCF.js +2 -0
- package/dist/chunk-JP6ULOEX.js +2 -0
- package/dist/{chunk-J6QMBMC2.js → chunk-JTYVBR5H.js} +1 -1
- package/dist/{chunk-BG55WDDX.js → chunk-KOYHJFB3.js} +1 -1
- package/dist/chunk-LJRJ2RAC.js +4 -0
- package/dist/chunk-MHVHGKDK.js +3 -0
- package/dist/{chunk-PVGUDJD7.js → chunk-MMLRWCBW.js} +1 -1
- package/dist/chunk-MMM4B3KH.js +1 -0
- package/dist/{chunk-ZGW3N3A6.js → chunk-MU7KKU3O.js} +1 -1
- package/dist/{chunk-YI2OWO6R.js → chunk-MXHAXY66.js} +1 -1
- package/dist/chunk-N4YPDZJF.js +9 -0
- package/dist/{chunk-VIQ25ORK.js → chunk-NYNHX7OX.js} +1 -1
- package/dist/{chunk-RK663O4M.js → chunk-OP4U3XBZ.js} +6 -6
- package/dist/{chunk-6W2GSV4O.js → chunk-OVS7ZDJ4.js} +1 -1
- package/dist/chunk-PIVEJTNF.js +1 -0
- package/dist/chunk-POEMCITL.js +1 -0
- package/dist/chunk-PPAHIVG5.js +1 -0
- package/dist/{chunk-NBEZ5FAU.js → chunk-Q36QSFSB.js} +1 -1
- package/dist/chunk-Q776YUBD.js +1 -0
- package/dist/chunk-QAMHZY2P.js +1 -0
- package/dist/chunk-QI3FJKGK.js +1 -0
- package/dist/{chunk-WOJ733IB.js → chunk-QRIJ3AHP.js} +1 -1
- package/dist/chunk-RAQLVO2X.js +1 -0
- package/dist/{chunk-M2VVRQKA.js → chunk-RG3R4EAB.js} +1 -1
- package/dist/{chunk-WY3VVX3R.js → chunk-RMRVUI7B.js} +1 -1
- package/dist/{chunk-GBWQENAH.js → chunk-RXZLBSDO.js} +1 -1
- package/dist/chunk-SCQK52SL.js +1 -0
- package/dist/{chunk-BZS5QRWB.js → chunk-SG4UDDHB.js} +1 -1
- package/dist/chunk-SWSOEYC7.js +1 -0
- package/dist/chunk-T75KAEJO.js +25 -0
- package/dist/{chunk-U7TBEC3I.js → chunk-V55ROUNP.js} +1 -1
- package/dist/{chunk-SHYP27B7.js → chunk-VALRPZXH.js} +1 -1
- package/dist/{chunk-P2WSDHIA.js → chunk-VIFOLTZT.js} +1 -1
- package/dist/{chunk-6QLZT7EP.js → chunk-VU24IH5S.js} +1 -1
- package/dist/{chunk-6ZPSVZNH.js → chunk-VXL5H3VZ.js} +1 -1
- package/dist/{chunk-QFKUSNUB.js → chunk-W23OYQXI.js} +1 -1
- package/dist/{chunk-QTCWOIT4.js → chunk-WWQWHC4K.js} +1 -1
- package/dist/{chunk-LTQ5BJYL.js → chunk-XGMOVQ5G.js} +1 -1
- package/dist/{chunk-4COLIGD7.js → chunk-XJ25HFIT.js} +1 -1
- package/dist/{chunk-3MDEGOUG.js → chunk-XMA6SWOT.js} +1 -1
- package/dist/{chunk-WJZY5Y22.js → chunk-XMTKP74H.js} +1 -1
- package/dist/chunk-XQYAVSUQ.js +1 -0
- package/dist/{chunk-2EX27VJ3.js → chunk-YK2IEHLB.js} +1 -1
- package/dist/chunk-ZK3ACE4T.js +1 -0
- package/dist/commands/antigravity/backfill.js +1 -1
- package/dist/commands/auth/create-key.js +1 -1
- package/dist/commands/auth/login.js +1 -1
- package/dist/commands/auth/logout.js +1 -1
- package/dist/commands/auth/revoke-key.js +1 -1
- package/dist/commands/auth/signup.js +1 -1
- package/dist/commands/auth/status.js +1 -1
- package/dist/commands/capture/scope.js +1 -1
- package/dist/commands/catalog/index.js +1 -1
- package/dist/commands/catalog/recommend.js +1 -1
- package/dist/commands/crons/list.js +1 -1
- package/dist/commands/crons/run.js +2 -2
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/diagnostics.js +1 -1
- package/dist/commands/eval-targets/create.js +1 -1
- package/dist/commands/eval-targets/list.js +1 -1
- package/dist/commands/evals/agent.js +3 -3
- package/dist/commands/evals/auto-run.js +1 -1
- package/dist/commands/evals/benchmark.js +1 -1
- package/dist/commands/evals/compare.js +1 -1
- package/dist/commands/evals/create.js +1 -1
- package/dist/commands/evals/optimize-description.js +1 -1
- package/dist/commands/evals/optimize.js +1 -1
- package/dist/commands/evals/refine-cases.js +1 -1
- package/dist/commands/evals/run.js +1 -1
- package/dist/commands/evals/validate-judge.js +1 -1
- package/dist/commands/experiments/list.js +1 -1
- package/dist/commands/gateway/ensure.js +1 -1
- package/dist/commands/hooks/emit-instructions.js +1 -1
- package/dist/commands/hooks/install.js +1 -1
- package/dist/commands/hooks/run.js +1 -1
- package/dist/commands/hooks/uninstall.js +1 -1
- package/dist/commands/instructions/create.js +1 -1
- package/dist/commands/instructions/dedupe.js +1 -1
- package/dist/commands/instructions/delete.js +1 -1
- package/dist/commands/instructions/fork.js +1 -1
- package/dist/commands/instructions/get.js +1 -1
- package/dist/commands/instructions/list.js +1 -1
- package/dist/commands/instructions/promote.js +1 -1
- package/dist/commands/instructions/pull.js +1 -1
- package/dist/commands/instructions/restore.js +1 -1
- package/dist/commands/instructions/retract.js +1 -1
- package/dist/commands/instructions/upstream.js +1 -1
- package/dist/commands/instructions/versions.js +1 -1
- package/dist/commands/launcher.js +1 -1
- package/dist/commands/local/down.js +1 -1
- package/dist/commands/local/up.js +1 -1
- package/dist/commands/org/current.js +1 -1
- package/dist/commands/org/list.js +1 -1
- package/dist/commands/org/switch.js +1 -1
- package/dist/commands/packs/add-instruction.js +1 -1
- package/dist/commands/packs/apply.js +1 -1
- package/dist/commands/packs/create.js +1 -1
- package/dist/commands/packs/fork.js +1 -1
- package/dist/commands/packs/get.js +1 -1
- package/dist/commands/packs/list.js +1 -1
- package/dist/commands/packs/remove-instruction.js +1 -1
- package/dist/commands/proxy/env.js +1 -1
- package/dist/commands/proxy/logs.js +1 -1
- package/dist/commands/proxy/restart.js +1 -1
- package/dist/commands/proxy/setup.js +1 -1
- package/dist/commands/proxy/start.js +1 -1
- package/dist/commands/proxy/status.js +1 -1
- package/dist/commands/proxy/stop.js +1 -1
- package/dist/commands/research/backfill.js +1 -1
- package/dist/commands/research/tail-transcript.js +1 -1
- package/dist/commands/service/install.js +18 -18
- package/dist/commands/service/status.js +1 -1
- package/dist/commands/service/uninstall.js +1 -1
- package/dist/commands/sessions/analyze.js +1 -1
- package/dist/commands/sessions/delete.js +1 -1
- package/dist/commands/sessions/end.js +1 -1
- package/dist/commands/sessions/import.js +1 -1
- package/dist/commands/sessions/list.js +1 -1
- package/dist/commands/sessions/start.js +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/skills/export-approved.js +1 -1
- package/dist/commands/skills/install.js +1 -1
- package/dist/commands/skills/list.js +1 -1
- package/dist/commands/skills/publish.js +1 -1
- package/dist/commands/skills/search.js +1 -1
- package/dist/commands/skills/update.js +1 -1
- package/dist/commands/suggestions/accept.js +1 -1
- package/dist/commands/suggestions/auto.js +1 -1
- package/dist/commands/suggestions/dismiss.js +1 -1
- package/dist/commands/suggestions/list.js +1 -1
- package/dist/commands/suggestions/refresh.js +1 -1
- package/dist/commands/suggestions/undo.js +1 -1
- package/dist/dashboard/Dashboard.js +1 -1
- package/dist/dashboard/data.js +1 -1
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -1
- package/dist/dashboard/launcher/api.js +1 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -1
- package/dist/dashboard/panels/measurement.js +1 -0
- package/dist/dist-GSHUC7UU.js +1 -0
- package/dist/harbor/cost_delta.py +377 -0
- package/dist/harbor/mcp_container_shell.py +156 -0
- package/dist/harbor/provenance.py +361 -0
- package/dist/harbor/rm-batch-task/environment/Dockerfile +6 -0
- package/dist/harbor/rm-batch-task/environment/items.jsonl +60 -0
- package/dist/harbor/rm-batch-task/inject.md +8 -0
- package/dist/harbor/rm-batch-task/instruction.md +8 -0
- package/dist/harbor/rm-batch-task/solution/solve.sh +68 -0
- package/dist/harbor/rm-batch-task/task.toml +30 -0
- package/dist/harbor/rm-batch-task/tests/test.sh +23 -0
- package/dist/harbor/rm-batch-task/tests/test_outputs.py +32 -0
- package/dist/harbor/rm-locality-task/environment/Dockerfile +8 -0
- package/dist/harbor/rm-locality-task/environment/workspace/deploy/prod/ingest.yaml +3 -0
- package/dist/harbor/rm-locality-task/environment/workspace/deploy/staging/ingest.yaml +3 -0
- package/dist/harbor/rm-locality-task/environment/workspace/docs/architecture/ingest.md +6 -0
- package/dist/harbor/rm-locality-task/environment/workspace/legacy/ingest_v1/config.yaml +2 -0
- package/dist/harbor/rm-locality-task/environment/workspace/packages/shared/defaults.py +4 -0
- package/dist/harbor/rm-locality-task/environment/workspace/services/ingest/config/limits.defaults.yaml +4 -0
- package/dist/harbor/rm-locality-task/environment/workspace/services/ingest/config/limits.yaml +3 -0
- package/dist/harbor/rm-locality-task/environment/workspace/services/ingest/loader.py +15 -0
- package/dist/harbor/rm-locality-task/environment/workspace/tests/fixtures/ingest_config.yaml +3 -0
- package/dist/harbor/rm-locality-task/inject.md +12 -0
- package/dist/harbor/rm-locality-task/instruction.md +4 -0
- package/dist/harbor/rm-locality-task/solution/solve.sh +14 -0
- package/dist/harbor/rm-locality-task/task.toml +30 -0
- package/dist/harbor/rm-locality-task/tests/test.sh +23 -0
- package/dist/harbor/rm-locality-task/tests/test_outputs.py +19 -0
- package/dist/harbor/rm-migrations-task/environment/Dockerfile +7 -0
- package/dist/harbor/rm-migrations-task/environment/applied.txt +2 -0
- package/dist/harbor/rm-migrations-task/environment/migrations/00001_init.sql +1 -0
- package/dist/harbor/rm-migrations-task/environment/migrations/00002_add_email.sql +1 -0
- package/dist/harbor/rm-migrations-task/inject.md +7 -0
- package/dist/harbor/rm-migrations-task/instruction.md +8 -0
- package/dist/harbor/rm-migrations-task/solution/solve.sh +8 -0
- package/dist/harbor/rm-migrations-task/task.toml +30 -0
- package/dist/harbor/rm-migrations-task/tests/test.sh +23 -0
- package/dist/harbor/rm-migrations-task/tests/test_outputs.py +36 -0
- package/dist/harbor/rm-pagination-task/environment/Dockerfile +6 -0
- package/dist/harbor/rm-pagination-task/environment/store.py +29 -0
- package/dist/harbor/rm-pagination-task/inject.md +8 -0
- package/dist/harbor/rm-pagination-task/instruction.md +5 -0
- package/dist/harbor/rm-pagination-task/solution/solve.sh +7 -0
- package/dist/harbor/rm-pagination-task/task.toml +30 -0
- package/dist/harbor/rm-pagination-task/tests/test.sh +23 -0
- package/dist/harbor/rm-pagination-task/tests/test_outputs.py +14 -0
- package/dist/harbor/rm_host_claude.py +264 -0
- package/dist/harbor/rm_host_codex.py +208 -0
- package/dist/harbor/run.sh +268 -0
- package/dist/harbor/summarize.py +248 -0
- package/dist/lib/active-org-refresh.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/dist/lib/antigravity-transcript.js +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/autorun-batch.js +1 -0
- package/dist/lib/capture-scope-config.js +1 -1
- package/dist/lib/codex-capture-scope.js +1 -1
- package/dist/lib/codex-exec.js +1 -1
- package/dist/lib/ensure-api-key.js +1 -1
- package/dist/lib/ensure-fresh-token.js +1 -1
- package/dist/lib/eval-accumulation.js +1 -0
- package/dist/lib/eval-analyzer.js +1 -1
- package/dist/lib/eval-benchmark.js +1 -1
- package/dist/lib/eval-candidate-run.js +1 -1
- package/dist/lib/eval-case-generator.js +1 -1
- package/dist/lib/eval-conversation-handler.js +1 -1
- package/dist/lib/eval-executor.js +1 -1
- package/dist/lib/eval-grader.js +1 -1
- package/dist/lib/eval-meta-judge.js +1 -1
- package/dist/lib/eval-resume.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/eval-trigger-tester.js +1 -1
- package/dist/lib/evolution-enrolment.js +1 -1
- package/dist/lib/harbor-readiness.js +1 -1
- package/dist/lib/hooks-capture-gate.js +1 -1
- package/dist/lib/insights/generation/installed-asks.js +1 -1
- package/dist/lib/insights/nomination/nominate.js +1 -1
- package/dist/lib/instruction-proposer.js +1 -1
- package/dist/lib/instruction-snapshot.js +1 -1
- package/dist/lib/instructions/acceptance/accept-events.js +1 -1
- package/dist/lib/instructions/acceptance/accept-hook.js +1 -1
- package/dist/lib/instructions/acceptance/agent-instruction-files.js +1 -1
- package/dist/lib/instructions/acceptance/hook-install.js +1 -1
- package/dist/lib/instructions/acceptance/reverse-applications.js +1 -1
- package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -1
- package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -1
- package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-evolution.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -1
- package/dist/lib/jobs/handlers/cron-reconcile-attribution.js +1 -1
- package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -1
- package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -1
- package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -1
- package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -1
- package/dist/lib/jobs/handlers/distill-memories.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab-verdict.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab.js +1 -1
- package/dist/lib/jobs/handlers/process-changelog.js +1 -1
- package/dist/lib/jobs/handlers/process-conversation.js +1 -1
- package/dist/lib/jobs/handlers/process-eval.js +1 -1
- package/dist/lib/jobs/handlers/process-insights.js +1 -1
- package/dist/lib/jobs/handlers/process-judge-review.js +1 -1
- package/dist/lib/jobs/handlers/process-launch.js +1 -1
- package/dist/lib/jobs/handlers/process-memory-ab.js +1 -1
- package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -1
- package/dist/lib/jobs/handlers/process-session-goal.js +1 -1
- package/dist/lib/jobs/shed-retry.js +1 -1
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/llm-client.js +1 -1
- package/dist/lib/llm-reply-parsers.js +1 -0
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/measurement-llm.js +1 -0
- package/dist/lib/pi-exec.js +1 -0
- package/dist/lib/projects/workspace/eval-workspace.js +1 -1
- package/dist/lib/projects/workspace/worktree.js +1 -1
- package/dist/lib/refine-cases.js +1 -1
- package/dist/lib/research-client.js +1 -1
- package/dist/lib/retraction.js +1 -1
- package/dist/lib/reviewer-detect.js +1 -1
- package/dist/lib/service-environment.js +1 -0
- package/dist/lib/setup-steps.js +1 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/dist/lib/tool-cli-map.js +1 -0
- package/dist/lib/transcript-instruction-linking.js +1 -1
- package/dist/lib/transcript-sync.js +1 -1
- package/dist/lib/work-report.js +1 -1
- package/oclif.manifest.json +7 -1
- package/package.json +5 -4
- package/dist/chunk-4FSQSETR.js +0 -12
- package/dist/chunk-6WQG6C7F.js +0 -1
- package/dist/chunk-C42NTI2V.js +0 -3
- package/dist/chunk-F6DAHCJC.js +0 -20
- package/dist/chunk-GN3ZHQ46.js +0 -1
- package/dist/chunk-H3BCWSYO.js +0 -1
- package/dist/chunk-HLNHBZLI.js +0 -1
- package/dist/chunk-HLQZR4XJ.js +0 -13
- package/dist/chunk-J5HW45PZ.js +0 -48
- package/dist/chunk-JNFB22FD.js +0 -1
- package/dist/chunk-KCOJLTVX.js +0 -1
- package/dist/chunk-MLV2RHRE.js +0 -1
- package/dist/chunk-N7GK33PU.js +0 -1
- package/dist/chunk-NRYLYMDM.js +0 -1
- package/dist/chunk-OZNKMJ5B.js +0 -1
- package/dist/chunk-PPXOC7IV.js +0 -1
- package/dist/chunk-QXPYGN7I.js +0 -1
- package/dist/chunk-R4QIPG4V.js +0 -2
- package/dist/chunk-RGUCR7T6.js +0 -1
- package/dist/chunk-RO3ZZVCG.js +0 -1
- package/dist/chunk-SBGXIPRN.js +0 -2
- package/dist/chunk-SN3CHV66.js +0 -1
- package/dist/chunk-U3XKXJ3A.js +0 -5
- package/dist/chunk-UM4CBCXI.js +0 -1
- package/dist/chunk-WHQ4BDSM.js +0 -4
- package/dist/dist-45KJH5M7.js +0 -1
package/dist/base-command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-MU7KKU3O.js";import"./chunk-IZTIYR5Q.js";import"./chunk-FKTT7A4H.js";import"./chunk-VIFOLTZT.js";import"./chunk-4FJYVYCU.js";import"./chunk-3AV3GTMP.js";import"./chunk-76UKAFNM.js";import"./chunk-42A4PUW7.js";import"./chunk-XQYAVSUQ.js";import"./chunk-PZNWH4VQ.js";import"./chunk-ZLLER3HP.js";export{a as BaseCommand};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{a as U,b as F}from"./chunk-3FNTV2TW.js";import{a as h,b as I}from"./chunk-B5X6HCBK.js";import{a as w,b as k,e as R}from"./chunk-LJRE3LZ2.js";import{d as $}from"./chunk-GYNZ3OZF.js";import{g as C,i as D,j as P}from"./chunk-UPFH72PF.js";import{e as v,f as x,i as j}from"./chunk-76UKAFNM.js";import{D as S,F as b,G as T,o as A}from"./chunk-42A4PUW7.js";import{a as l}from"./chunk-ZLLER3HP.js";import*as u from"node:fs";import*as m from"node:path";var O=new Set(["mcp","subagent","feature"]);function ie(e,t,n){return L(m.join(e,"CLAUDE.md"),t,n)}l(ie,"appendToCLAUDEmd");function L(e,t,n){let i=w(t),s=k(t),a=u.existsSync(e)?u.readFileSync(e,"utf8"):"";if(a.includes(i))return!1;let p=`${a.length>0&&!a.endsWith(`
|
|
2
|
+
`)?`
|
|
3
|
+
|
|
4
|
+
`:a.length>0?`
|
|
5
|
+
`:""}
|
|
6
|
+
${i}
|
|
7
|
+
${n}
|
|
8
|
+
${s}
|
|
9
|
+
`;return u.mkdirSync(m.dirname(e),{recursive:!0}),u.writeFileSync(e,a+p,"utf8"),!0}l(L,"appendBlockToFile");function E(e,t,n,i={}){return $(e,i).filter(s=>L(s.path,t,n))}l(E,"appendToAgentInstructionFiles");function _(e,t,n={}){return $(e,n).filter(i=>M(i.path,t))}l(_,"removeFromAgentInstructionFiles");function re(e,t){return M(m.join(e,"CLAUDE.md"),t)}l(re,"removeFromCLAUDEmd");function M(e,t){if(!u.existsSync(e))return!1;let n=w(t),i=k(t),s=u.readFileSync(e,"utf8"),a=s.indexOf(n);if(a===-1)return!1;let c=s.indexOf(i,a);if(c===-1)return!1;let p=s.slice(0,a),d=s.slice(c+i.length),o=(p.replace(/\n+$/,"")+`
|
|
10
|
+
`+d.replace(/^\n+/,"")).replace(/^\n+/,"");return u.writeFileSync(e,o,"utf8"),!0}l(M,"removeBlockFromFile");function g(e,t=90){return e.length<=t?e:`${e.slice(0,t-1)}\u2026`}l(g,"truncate");function q(e){return v(`/api/instruction-suggestions/${encodeURIComponent(e)}`)}l(q,"fetchSuggestion");async function ae(e){let t=e.suggestion??await q(e.suggestionId);if(t.kind==="remove")return B(e,t);if(t.kind==="trim")return K(e,t);let n=t.instructionId;t.instructionScope==="public"&&(n=(await x(`/api/instructions/${encodeURIComponent(t.instructionId)}/promote-from-public`,{targetScope:"personal"})).instructionId);let i=await v(`/api/instructions/${encodeURIComponent(n)}`),a=i.type!=="skill"&&i.type!=="hook"&&!O.has(i.type??"")?T(i.content,r=>u.existsSync(m.join(e.dir,r))):[];if(a.length>0)return await I(e.suggestionId,e.projectPath,n,e.actor,"unresolvable_reference"),{action:"unresolvable-reference",instructionId:n,name:i.name,fileModified:!1,unresolvable:a,messages:[`Refused: ${i.name} tells the agent to run something this project does not have.`,...a.map(r=>` ${r.path} \u2014 no such file under ${e.dir}`),"Nothing was written. A confident instruction pointing at a file that is not there costs every future session the time it takes to discover that."]};let c;if(!e.force){let r=S(i.content,R(e.dir)),N=e.actor==="auto"?r.matches.length>0:r.redundant;if(!r.redundant&&r.matches.length>0&&(c=r),N){let y=r.redundant;return await I(e.suggestionId,e.projectPath,n,e.actor,y?"redundant":"partial_overlap"),{action:"redundant",instructionId:n,name:i.name,fileModified:!1,redundancy:r,partialOverlap:y?void 0:r,messages:[y?`Skipped: ${i.name} already applies here in different words \u2014 adding it would spend context to say the same thing twice.`:`Refused: ${r.matches.length} of ${r.matches.length+r.novel.length} asks in ${i.name} are already covered here, so adopting it would restate the file back at itself.`,...r.matches.map(f=>` "${g(f.directive)}"
|
|
11
|
+
already covered by ${f.matchedSource??f.matchedId} (${(f.similarity*100).toFixed(0)}% match): "${g(f.matchedDirective)}"`),...y?[]:["Still wanted, and not adopted:",...r.novel.map(f=>` "${g(f)}"`),"Propose those on their own and they can be adopted, tracked and undone individually."],"Add it anyway with `--force` if the overlap is not real."]}}}if(i.type==="skill")return H(e,{...i,id:n});if(i.type==="hook")return F(e,{...i,id:n});if(O.has(i.type??""))return{action:"manual-required",instructionId:n,name:i.name,fileModified:!1,messages:[`Not installed: ${i.name} is a ${i.type} artifact, and installing one runs code or edits tool configuration \u2014 that always requires a human.`,` Review it: rulemetric instructions get ${n}`,"Nothing was written. This proposal will keep appearing until you act on it or dismiss it."]};let p=E(e.dir,n,i.content),d=p.length>0;await h(e.suggestionId,e.projectPath,n,e.actor);let o=d&&c?[` Note: ${c.matches.length} of ${c.matches.length+c.novel.length} asks in this rule already appear elsewhere in context; it was added for the rest.`,...c.matches.map(r=>` "${g(r.directive)}"
|
|
12
|
+
repeats ${r.matchedSource??r.matchedId} (${(r.similarity*100).toFixed(0)}%): "${g(r.matchedDirective)}"`)]:[];return{action:d?"added":"already-present",instructionId:n,name:i.name,fileModified:d,partialOverlap:d?c:void 0,messages:d?[`Accepted: added ${i.name} to ${p.map(r=>m.relative(e.dir,r.path)).join(", ")}. It will be active starting in your next session.`,...o]:[`Already present: ${i.name} is already in CLAUDE.md (block id: ${n}).`]}}l(ae,"acceptSuggestion");async function H(e,t){if(!e.force){let o=b({name:t.name,content:t.content},D(e.dir));if(o)return await I(e.suggestionId,e.projectPath,t.id,e.actor),{action:"redundant",instructionId:t.id,name:t.name,fileModified:!1,duplicateOf:o,messages:[`Skipped: ${t.name} is already installed here as ${o.name}`+(o.reason==="name-stem"?" (same skill, different content-hash suffix).":` (${(o.similarity*100).toFixed(0)}% identical body).`),` Installed: ${P(e.dir,o.name)}`,"A second copy is not more available \u2014 it is one more thing to keep in sync."]}}let n=C({dir:e.dir,name:t.name,content:t.content,description:t.description}),i=[...n.warnings],s=[m.relative(e.dir,n.skillFile)];n.linkKind!=="none"&&s.push(m.relative(e.dir,n.linkPath));let a={boundaryClass:"inside",targets:s,requires:[],provides:[`skill:${n.dirName}`]},c={kind:"delete-paths",paths:s},p=A(a,c);if(p.length===0)try{await U({instructionId:t.id,projectPath:e.projectPath,targetPath:n.skillFile,beforeHash:"",appliedHash:"",boundaryClass:a.boundaryClass,targets:a.targets,inverse:c,requires:a.requires,provides:a.provides,applyMode:e.actor==="auto"?"auto":"human"})}catch(o){i.push(`the effect ledger did not record this install (${o instanceof Error?o.message:String(o)}) \u2014 \`suggestions undo\` will not remove it; delete ${s.join(" and ")} by hand.`)}else i.push(`no reversible inverse could be recorded (${p.map(o=>o.message).join("; ")}).`);await h(e.suggestionId,e.projectPath,t.id,e.actor);let d=[`Accepted: installed skill ${n.dirName} to ${m.relative(e.dir,n.skillFile)}.`];n.linkKind==="none"&&d.push("Claude Code will NOT see it yet \u2014 its path is taken by a directory this command did not create."),d.push("It loads on demand, so it costs no context until a task matches its description."),d.push(`Undo with: rulemetric suggestions undo ${t.id}`);for(let o of i)d.push(` Warning: ${o}`);return{action:"added",instructionId:t.id,name:t.name,fileModified:!0,messages:d}}l(H,"acceptSkill");async function K(e,t){let n=t.estimatedTokens?` It currently costs roughly ${t.estimatedTokens} tokens per session (estimated).`:"";return await h(e.suggestionId,e.projectPath,t.instructionId,e.actor),{action:"acknowledged",instructionId:t.instructionId,name:t.name,fileModified:!1,messages:[`Noted: ${t.name} is measured neutral, not harmful.${n}`,"Nothing was changed \u2014 trimming is a judgement call about which parts carry the value,","and the measurement only found the absence of a detectable effect, not which half to cut.",` View it: rulemetric instructions get ${t.instructionId}`," Then edit CLAUDE.md (or the instruction) and let the next measurement cycle re-check it.","This suggestion will stop re-surfacing."]}}l(K,"acknowledgeTrim");async function B(e,t){let n=_(e.dir,t.instructionId).length>0;await j(`/api/instructions/${encodeURIComponent(t.instructionId)}`);let i=t.estimatedTokens?` Frees roughly ${t.estimatedTokens} tokens of context per session (estimated).`:"",s=n?[`Retired: removed ${t.name} from CLAUDE.md and archived it.${i}`]:[`Archived ${t.name}.${i}`,"CLAUDE.md was not modified \u2014 no rulemetric-managed block for this instruction was found in this directory. If you added it by hand, remove it yourself."];return s.push("Undo with: rulemetric instructions restore "+t.instructionId),await h(e.suggestionId,e.projectPath,t.instructionId,e.actor),{action:n?"retired":"archived-only",instructionId:t.instructionId,name:t.name,fileModified:n,messages:s}}l(B,"acceptRemoval");export{ie as a,L as b,E as c,_ as d,re as e,M as f,q as g,ae as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as E,m}from"./chunk-
|
|
1
|
+
import{c as E,n as m}from"./chunk-T75KAEJO.js";import{a as d}from"./chunk-76UKAFNM.js";import{a as c}from"./chunk-ZLLER3HP.js";import*as p from"node:fs";import*as u from"node:path";import*as _ from"node:os";function T(){if(process.env.RULEMETRIC_API_KEY||process.env.RULEMETRIC_ACCESS_TOKEN)return;let s=u.join(_.homedir(),".config","rulemetric","env");C(s)||C(u.join(process.cwd(),".env.local"))}c(T,"ensureEnv");function C(s){try{let t=p.readFileSync(s,"utf-8");for(let n of t.split(`
|
|
2
2
|
`)){let e=n.trim();if(!e||e.startsWith("#"))continue;let o=e.indexOf("=");if(o<0)continue;let r=e.slice(0,o).trim(),i=e.slice(o+1).trim();process.env[r]||(process.env[r]=i)}return!!(process.env.RULEMETRIC_API_KEY||process.env.RULEMETRIC_ACCESS_TOKEN)}catch{return!1}}c(C,"loadEnvFile");T();async function I(s){let t={totalSessions:0,totalCalls:0,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,totalCacheWriteTokens:0,totalCostUSD:0,providers:{}},n=await m(s);t.providers={};for(let a of n)t.providers[a.provider]=(t.providers[a.provider]||0)+1;let e=new E,o=n.filter(a=>a.provider==="claude");for(let a of o)try{let h=p.readdirSync(a.path).filter(f=>f.endsWith(".jsonl"));t.totalSessions+=h.length;for(let f of h){let v=p.readFileSync(u.join(a.path,f),"utf-8"),R=e.parse(v);for(let l of R.events)l.tokenUsage&&(t.totalCalls++,t.totalInputTokens+=l.tokenUsage.input,t.totalOutputTokens+=l.tokenUsage.output,t.totalCacheReadTokens+=l.tokenUsage.cacheRead??0,t.totalCacheWriteTokens+=l.tokenUsage.cacheWrite??0)}}catch{}let r=15,i=75;return t.totalCostUSD=Math.round((t.totalInputTokens/1e6*r+t.totalOutputTokens/1e6*i+t.totalCacheReadTokens/1e6*(r*.1)+t.totalCacheWriteTokens/1e6*(r*1.25))*100)/100,t}c(I,"loadLocalStats");async function U(s){let t=process.env.RULEMETRIC_API_URL??d,n=process.env.RULEMETRIC_API_KEY,e=process.env.RULEMETRIC_ACCESS_TOKEN,o=n??e;if(!o)return null;let r=new URLSearchParams;s&&r.set("projectPath",s);try{let i=await fetch(`${t}/api/insights/compute?${r}`,{headers:{Authorization:`Bearer ${o}`},signal:AbortSignal.timeout(5e3)});return i.ok?await i.json():null}catch{return null}}c(U,"loadApiInsights");async function g(s){let t=process.env.RULEMETRIC_API_URL??d,n=process.env.RULEMETRIC_API_KEY??process.env.RULEMETRIC_ACCESS_TOKEN;if(!n)return null;let e=new URLSearchParams;s&&e.set("projectPath",s);try{let o=await fetch(`${t}/api/insights/linked-instructions?${e}`,{headers:{Authorization:`Bearer ${n}`},signal:AbortSignal.timeout(5e3)});return o.ok?await o.json():null}catch{return null}}c(g,"loadLinkedInstructions");export{I as a,U as b,g as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as A,c as l,d as b}from"./chunk-
|
|
1
|
+
import{b as A,c as l,d as b}from"./chunk-JTYVBR5H.js";import{a as I}from"./chunk-B5X6HCBK.js";import{f as k}from"./chunk-76UKAFNM.js";import{n as f,o as g,p as u,v,w as $,x as y}from"./chunk-42A4PUW7.js";import{a as c}from"./chunk-ZLLER3HP.js";import{randomUUID as P}from"node:crypto";async function H(s){let{applyMode:e="human",...r}=s;await k("/api/recommendation-applications",{...r,harness:"claude_code",applyMode:e,status:"applied",applyBatchId:P(),applySeq:0})}c(H,"recordApplication");async function M(s,e){let r=c(t=>({action:"manual-required",instructionId:e.id,name:e.name,fileModified:!1,messages:t}),"refuse");if(s.actor!=="human")return r([`Not installed: ${e.name} is a hook, and a hook is a command this machine runs unattended.`,"Installing one is always a human decision \u2014 the same refusal the API makes server-side.",` Review it: rulemetric suggestions accept ${s.suggestionId}`]);let n=y(e);if(!n.spec)return r([`Not installed: ${e.name} does not contain an installable hook spec.`,...n.problems.map(t=>` ${t.field}: ${t.message}`)]);if(n.problems.length>0)return r([`Not installed: ${e.name}'s hook spec is not fit to act on.`,...n.problems.map(t=>` ${t.field}: ${t.message}`)]);let w=u(e.frontmatter),i=v(n.spec,w??void 0),p=f(i);if(p.length>0)return r([`Not installed: ${e.name}'s artifact spec is not fit to act on.`,...p.map(t=>` ${t.field}: ${t.message}`)]);let o=b(s.dir,i.requires);if(o.missing.length>0)return r([`Not installed: ${e.name} needs ${o.missing.join(", ")}, which is not present here.`,"It is left unapplied rather than installed and broken \u2014 a hook whose command is missing still runs, and fails, on every matching event.","Accept it again once the dependency exists."]);let a=A({dir:s.dir,instructionId:e.id,spec:n.spec});if(a.status==="refused")return r([`Not installed: ${e.name}.`,` ${a.reason}`]);let m=g(i,a.inverse);if(m.length>0)return l({dir:s.dir,inverse:a.inverse}),r([`Not installed: ${e.name} was written and then rolled back \u2014 the actuator could not produce a valid inverse.`,...m.map(t=>` ${t.field}: ${t.message}`)]);try{await H({instructionId:e.id,projectPath:s.projectPath,targetPath:a.target,beforeHash:a.beforeHash,appliedHash:a.inverse.hashAtWrite,boundaryClass:i.boundaryClass,targets:i.targets,inverse:a.inverse,requires:i.requires,provides:i.provides})}catch(t){let h=l({dir:s.dir,inverse:a.inverse});return r([`Not installed: ${e.name} \u2014 the effect could not be recorded, so it was undone.`,` ${t instanceof Error?t.message:String(t)}`,h.removed?" The hook was removed; your settings are as they were.":` WARNING: the rollback did not complete (${h.reason??"unknown reason"}). Check ${a.target} for the entry tagged with ${e.id}.`])}await I(s.suggestionId,s.projectPath,e.id,s.actor);let d=a.status==="installed"?[`Accepted: installed a ${n.spec.event} hook into ${a.target}.`]:[`Already present: this hook is already installed in ${a.target}.`];for(let t of $(n.spec))d.push(` ${t}`);return o.unverifiable.length>0&&d.push(` unchecked: ${o.unverifiable.join(", ")} \u2014 this command cannot verify that namespace.`),d.push(`Undo with: rulemetric suggestions undo ${e.id}`),{action:a.status==="installed"?"added":"already-present",instructionId:e.id,name:e.name,fileModified:a.status==="installed",messages:d}}c(M,"acceptHook");export{H as a,M as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"./chunk-3ZHVP3KE.js";import{d as k,e as h}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-3ZHVP3KE.js";import{d as k,e as h}from"./chunk-RXZLBSDO.js";import{e as m,i as f}from"./chunk-76UKAFNM.js";import{a as c}from"./chunk-ZLLER3HP.js";import{existsSync as b}from"node:fs";async function w($,y){let r=c(t=>y?.logger?.info?.(t)??console.log(t),"log"),{projectPath:s}=$,n=`[cron_retire_unused_skills] ${s}`;if(!s||!b(s))return{skipped:"project-missing",reason:`${s} does not exist on this machine \u2014 refusing to delete files for a project that is not here.`};let o=await m("/api/insights/groom-candidates"),e=g({captureHealthy:o.skillCaptureHealthy===!0,captureReason:o.skillCaptureHealthy===void 0?"API did not report skill capture health (older deployment)":o.skillCaptureReason,candidates:o.unusedSkills??[]});if(e.refused)return r(`${n} ${e.refused}: ${e.summary}`),{skipped:e.refused,reason:e.summary,held:e.held.length};r(`${n} ${e.summary}`);let a=[],d=[],l=0;for(let t of e.retire){let u=k({kind:"skill_file",target:t.name,cwd:s});if(!u.ok){l+=1,r(`${n} could not plan removal of ${t.name}: ${u.refusal??"unresolved"}`);continue}let R=new Date().toISOString().replace(/[:.]/g,"-"),i=h(u,R);if(!i.applied){l+=1,r(`${n} failed to remove ${t.name}: ${i.error??"unknown error"}`);continue}a.push(t.name),i.backupPath&&d.push(i.backupPath),r(`${n} retired ${t.name} (backup: ${i.backupPath??"none"})`);try{await f(`/api/instructions/${t.instructionId}`)}catch(p){r(`${n} removed ${t.name} but could not archive its instruction row: ${p instanceof Error?p.message:String(p)}`)}}return{retired:a.length,failed:l,held:e.held.length,names:a,backups:d,reason:e.summary}}c(w,"cronRetireUnusedSkills");export{w as a};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import{f as I,g as N}from"./chunk-XQYAVSUQ.js";import{a as i}from"./chunk-ZLLER3HP.js";function ne(e){return(e.trim().split(`
|
|
2
|
+
`)[0]?.replace(/^#+\s*/,"").trim()||"Suggested instruction").slice(0,120)}i(ne,"recommendationTitle");function oe(e){if(!e||typeof e!="object")return e;let t=e;if(Array.isArray(t.recommendation_candidates))return e;let n=t.suggestions;if(!n||typeof n!="object")return e;let o=n.claude_md_additions;return Array.isArray(o)&&(t.recommendation_candidates=o.flatMap(r=>{if(!r||typeof r!="object")return[];let s=r;if(typeof s.addition!="string"||s.addition.trim()==="")return[];let a=s.addition.trim();return[{title:ne(a),artifact:"instruction",canonicalBody:a,rationale:typeof s.why=="string"?s.why:"",evidence:[],outcomeMetric:"session_outcome",renderings:[{harness:"claude_code",target:"CLAUDE.md",body:a},{harness:"codex",target:"AGENTS.md",body:a}]}]})),e}i(oe,"normalizeRecommendationCandidates");var re=new Set(["instruction"]);function se(e){if(!e||typeof e!="object")return e;let t=e,n=t.recommendation_candidates;if(!Array.isArray(n)||n.length===0)return e;let o=n.filter(s=>!!s&&typeof s=="object"&&typeof s.canonicalBody=="string"&&s.canonicalBody.trim().length>0);for(let s of o){if(Array.isArray(s.renderings)&&s.renderings.length>0)continue;let a=s.canonicalBody.trim(),c=re.has(String(s.artifact));s.renderings=c?[{harness:"claude_code",target:"CLAUDE.md",body:a},{harness:"codex",target:"AGENTS.md",body:a}]:[{harness:"claude_code",target:"manual",body:a},{harness:"codex",target:"manual",body:a}]}let r=t.suggestions&&typeof t.suggestions=="object"?t.suggestions:{};return(!Array.isArray(r.claude_md_additions)||r.claude_md_additions.length===0)&&(r.claude_md_additions=o.filter(s=>s.artifact==="instruction").map(s=>({addition:s.canonicalBody.trim(),why:typeof s.rationale=="string"?s.rationale:"",prompt_scaffold:"Add to CLAUDE.md (and AGENTS.md for Codex)."}))),(!Array.isArray(r.features_to_try)||r.features_to_try.length===0)&&(r.features_to_try=o.filter(s=>s.artifact!=="instruction").map(s=>({feature:typeof s.title=="string"?s.title:"Proposed change",one_liner:typeof s.rationale=="string"?s.rationale:"",why_for_you:typeof s.outcomeMetric=="string"?`Aimed at ${s.outcomeMetric}.`:"",example_code:s.canonicalBody.trim()}))),Array.isArray(r.usage_patterns)||(r.usage_patterns=[]),t.suggestions=r,e}i(se,"deriveLegacyPresentation");function ie(e){if(!e||typeof e!="object")return e;let t=e,n=t.project_areas;if(n!==void 0&&!Array.isArray(n)){let o=n&&typeof n=="object"?n.areas:void 0;t.project_areas=Array.isArray(o)?o:void 0}return ae(e),oe(e),e}i(ie,"normalizeRecommendations");function ae(e){if(!e||typeof e!="object")return;let t=e;if(Array.isArray(t.recommendation_candidates)&&t.recommendation_candidates.length>0)return;let n=t.suggestions;if(!n||typeof n!="object")return;let o=n.recommendation_candidates;!Array.isArray(o)||o.length===0||(t.recommendation_candidates=o)}i(ae,"liftNestedCandidates");import{z as d}from"zod";var P=["org","team","project","personal"],D=d.object({name:d.string().min(1),description:d.string().min(1),type:d.literal("instruction").default("instruction"),scope:d.enum(P),version:d.string().min(1),tags:d.array(d.string()).optional(),compatibility:d.array(d.string()).optional(),slots:d.record(d.string(),d.string()).optional(),metadata:d.record(d.string(),d.unknown()).optional()});import{z as p}from"zod";var j=p.object({name:p.string().min(1),description:p.string().min(1),type:p.literal("prompt"),version:p.string().min(1),tags:p.array(p.string()).optional(),variables:p.array(p.string()).optional(),metadata:p.record(p.string(),p.unknown()).optional()});function _(e,t){let n=t.map(o=>`- ID: ${o.id}
|
|
3
|
+
Name: ${o.name}
|
|
4
|
+
Description: ${o.description}
|
|
5
|
+
Tags: ${o.tags.join(", ")}
|
|
6
|
+
Preview: ${o.contentPreview}`).join(`
|
|
7
|
+
|
|
8
|
+
`);return`You are an expert at matching AI coding instructions to software projects.
|
|
9
|
+
|
|
10
|
+
## Project
|
|
11
|
+
- Name: ${e.name}
|
|
12
|
+
- Description: ${e.description??"No description"}
|
|
13
|
+
- Languages: ${e.languages.join(", ")||"Unknown"}
|
|
14
|
+
- Topics: ${e.topics.join(", ")||"None"}
|
|
15
|
+
- Dependencies: ${e.dependencies.join(", ")||"None"}
|
|
16
|
+
|
|
17
|
+
## Available Instructions
|
|
18
|
+
|
|
19
|
+
${n}
|
|
20
|
+
|
|
21
|
+
## Task
|
|
22
|
+
|
|
23
|
+
Analyze the project and recommend which instructions would be most useful. Consider:
|
|
24
|
+
1. Language and framework alignment
|
|
25
|
+
2. Project purpose and what standards/practices would help
|
|
26
|
+
3. Security, testing, and quality needs based on the project type
|
|
27
|
+
|
|
28
|
+
Return your response as JSON in this exact format:
|
|
29
|
+
{
|
|
30
|
+
"recommendations": [
|
|
31
|
+
{ "instructionId": "<id>", "score": <0.0-1.0>, "reason": "<one sentence explanation>" }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Only include instructions with a relevance score >= ${.5}. Order by score descending. Return valid JSON only, no markdown fences.`}i(_,"buildRecommendationPrompt");var $=32e3,ce={name:"x".repeat(64),description:"x".repeat(256),languages:["TypeScript","Python","Go"],topics:["x".repeat(32)],dependencies:["x".repeat(32)]};function M(e,t={}){if(e.length===0)return[];let n=t.charBudget??$,o=_(ce,[]).length,r=[],s=[],a=0;for(let c of e){let l=le(c);s.length>0&&o+a+l>n&&(r.push(s),s=[],a=0),s.push(c),a+=l}return s.length>0&&r.push(s),r}i(M,"batchCandidatesForPrompt");function le(e){return`- ID: ${e.id}
|
|
36
|
+
Name: ${e.name}
|
|
37
|
+
Description: ${e.description}
|
|
38
|
+
Tags: ${e.tags.join(", ")}
|
|
39
|
+
Preview: ${e.contentPreview}`.length+2}i(le,"renderedSize");var H=["Added","Changed","Fixed","Removed","Deprecated","Security"],ue=/^##\s+\[([^\]]+)\](?:\s*[-–]\s*(\d{4}-\d{2}-\d{2}))?\s*$/,me=/^###\s+(.+?)\s*$/,de=/^[-*]\s+(.*\S)\s*$/,pe=/^ {2,}(\S.*)$/;function fe(e){let t=e.split(/\r?\n/),n=[],o=null,r=null,s=null;for(let a of t){let c=a.match(ue);if(c){o&&n.push(o);let m=c[1].trim();o={version:m,date:c[2]??null,unreleased:m.toLowerCase()==="unreleased",sections:{}},r=null,s=null;continue}if(!o)continue;let l=a.match(me);if(l){let m=l[1].trim();H.includes(m)?(r=m,o.sections[r]||(o.sections[r]=[]),s=o.sections[r]):(r=null,s=null);continue}if(!r||!s)continue;let u=a.match(de);if(u){s.push(u[1]);continue}let f=a.match(pe);if(f&&s.length>0){s[s.length-1]+=" "+f[1].trim();continue}}return o&&n.push(o),{entries:n}}i(fe,"parseChangelog");function he(e){return e.entries.filter(t=>t.unreleased?!1:Object.values(t.sections).some(n=>n&&n.length>0))}i(he,"announceableEntries");function S(e){let t=/^(#{1,6})\s+/.exec(e);return t?t[1].length:0}i(S,"headingLevel");function B(e){return e.replace(/^#{1,6}\s+/,"").replace(/[`*_~]/g,"").trim().toLowerCase()}i(B,"normaliseHeading");function ge(e,t){let n=B(t);if(n.length===0)return{content:e,removed:!1,removedText:null,reason:"not-found"};let o=e.split(`
|
|
40
|
+
`),r=[];for(let m=0;m<o.length;m+=1)S(o[m])>0&&B(o[m])===n&&r.push(m);if(r.length===0)return{content:e,removed:!1,removedText:null,reason:"not-found"};if(r.length>1)return{content:e,removed:!1,removedText:null,reason:"ambiguous"};let s=r[0],a=S(o[s]),c=o.length;for(let m=s+1;m<o.length;m+=1){let E=S(o[m]);if(E>0&&E<=a){c=m;break}}let l=o.slice(s,c).join(`
|
|
41
|
+
`),u=[...o.slice(0,s),...o.slice(c)];return u.join("").trim().length===0?{content:e,removed:!1,removedText:null,reason:"would-empty-file"}:{content:u.join(`
|
|
42
|
+
`).replace(/\n{3,}/g,`
|
|
43
|
+
|
|
44
|
+
`),removed:!0,removedText:l}}i(ge,"removeMarkdownSection");function ye(e,t){let n=t.trim();if(n.length===0)return{content:e,removed:!1,removedText:null,reason:"not-found"};let o=e.indexOf(n);if(o===-1)return{content:e,removed:!1,removedText:null,reason:"not-found"};if(e.indexOf(n,o+1)!==-1)return{content:e,removed:!1,removedText:null,reason:"ambiguous"};let r=(e.slice(0,o)+e.slice(o+n.length)).replace(/\n{3,}/g,`
|
|
45
|
+
|
|
46
|
+
`);return r.trim().length===0?{content:e,removed:!1,removedText:null,reason:"would-empty-file"}:{content:r,removed:!0,removedText:n}}i(ye,"removeExactBlock");var U=["HTTPS_PROXY","HTTP_PROXY","NODE_EXTRA_CA_CERTS"];function xe(e,t){if(!e||typeof e!="object")return{value:e,removed:!1,removedDescriptions:[],reason:"not-found"};let n=structuredClone(e);if(!n.hooks)return{value:n,removed:!1,removedDescriptions:[],reason:"not-found"};let o=[];for(let[r,s]of Object.entries(n.hooks)){if(!Array.isArray(s))continue;let a=s.filter(c=>{let l=(c.hooks??[]).some(u=>typeof u.command=="string"&&u.command.includes(t));return l&&o.push(`${r}: ${c.matcher??"*"} \u2192 ${(c.hooks??[]).map(u=>u.command).join(", ")}`),!l});a.length===0?delete n.hooks[r]:n.hooks[r]=a}return Object.keys(n.hooks).length===0&&delete n.hooks,{value:n,removed:o.length>0,removedDescriptions:o,...o.length===0?{reason:"not-found"}:{}}}i(xe,"removeHookByCommand");function _e(e,t){if(!e||typeof e!="object")return{value:e,removed:!1,removedDescriptions:[],reason:"not-found"};let n=structuredClone(e);return!n.mcpServers||!(t in n.mcpServers)?{value:n,removed:!1,removedDescriptions:[],reason:"not-found"}:(delete n.mcpServers[t],Object.keys(n.mcpServers).length===0&&delete n.mcpServers,{value:n,removed:!0,removedDescriptions:[`mcpServers.${t}`]})}i(_e,"removeMcpServer");function v(e){if(!e||typeof e!="object")return[];let t=e.env;return t?U.filter(n=>n in t):[]}i(v,"protectedEnvKeysPresent");function Ee(e,t){let n=v(e),o=new Set(v(t));return n.filter(r=>!o.has(r))}i(Ee,"lostProtectedEnvKeys");function Se(e,t){let n=`HTTP ${e}`;if(!t||typeof t!="object")return{message:n};let o=t,r=typeof o.error=="string"&&o.error?o.error:o.error?JSON.stringify(o.error):n,s=typeof o.code=="string"&&o.code?o.code:void 0;return s?{message:r,code:s}:{message:r}}i(Se,"parseApiError");var T=["inside","outside"];function y(e){return e.trim().toLowerCase()}i(y,"normalizeDependencyKey");function ve(e){let t=[];if(T.includes(e.boundaryClass)||t.push({field:"boundaryClass",message:`must be one of ${T.join(" | ")}`}),!Array.isArray(e.targets)||e.targets.length===0)t.push({field:"targets",message:"a proposal that cannot name the paths it writes cannot be applied"});else{for(let r of e.targets)if(typeof r!="string"||r.trim().length===0){t.push({field:"targets",message:"target paths must be non-empty"});break}let n=e.targets.filter(r=>typeof r=="string"&&(r.startsWith("/")||/^[A-Za-z]:[\\/]/.test(r)));n.length>0&&t.push({field:"targets",message:`targets must be project-relative (absolute: ${n.join(", ")})`});let o=e.targets.filter(r=>typeof r=="string"&&r.split(/[\\/]/).includes(".."));o.length>0&&t.push({field:"targets",message:`targets must not traverse outside the project (${o.join(", ")})`})}for(let n of["requires","provides"]){let o=e[n];if(!Array.isArray(o)){t.push({field:n,message:"must be an array of dependency keys"});continue}o.some(r=>typeof r!="string"||r.trim().length===0)&&t.push({field:n,message:"dependency keys must be non-empty strings"})}return t}i(ve,"validateArtifactSpec");function Ae(e,t){let n=[],o=new Set(e.targets??[]);if(t.kind==="delete-paths"){e.boundaryClass!=="inside"&&n.push({field:"inverse",message:"deleting paths is only an inverse for `inside` artifacts; an `outside` path may hold text we did not write"}),t.paths.length===0&&n.push({field:"inverse.paths",message:"nothing to delete \u2014 this is not an inverse"});let r=t.paths.filter(s=>!o.has(s));return r.length>0&&n.push({field:"inverse.paths",message:`would delete paths the spec never declared: ${r.join(", ")}`}),n}return e.boundaryClass!=="outside"&&n.push({field:"inverse",message:"a compensation is only an inverse for `outside` artifacts; an `inside` path owes an exact undo"}),(!t.backupPath||t.backupPath.trim().length===0)&&n.push({field:"inverse.backupPath",message:"an `outside` write owes a backup"}),(!t.hashAtWrite||t.hashAtWrite.trim().length===0)&&n.push({field:"inverse.hashAtWrite",message:"without the post-write hash the undo cannot tell a drifted file from an untouched one"}),o.has(t.file)||n.push({field:"inverse.file",message:`wrote ${t.file}, which the spec did not declare as a target`}),t.kind==="remove-marked-region"?(!t.startMarker||!t.endMarker)&&n.push({field:"inverse",message:"an `outside` region needs both markers, or the undo cannot tell where our text ends"}):t.command.trim().length===0&&n.push({field:"inverse.command",message:"the exact command written is the identity of the entry; without it the undo is a search"}),n}i(Ae,"validateArtifactInverse");var z="artifact";function A(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}i(A,"stringArray");function Te(e){if(!e||typeof e!="object")return null;let t=e[z];if(!t||typeof t!="object")return null;let n=t;return{boundaryClass:n.boundaryClass,targets:A(n.targets),requires:A(n.requires),provides:A(n.provides)}}i(Te,"parseArtifactSpec");var be=["applied","measuring","improved","inconclusive","harmful","rollback_ready"];function K(e){return e.appliedAt?e.appliedAt instanceof Date?e.appliedAt.getTime():new Date(e.appliedAt).getTime():0}i(K,"appliedAtMs");function ke(e){return[...e].sort((t,n)=>{let o=K(n)-K(t);return o!==0?o:(n.applySeq??0)-(t.applySeq??0)})}i(ke,"orderForReversal");var Y=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PostToolUse","PreCompact","Notification","Stop","SubagentStop"],b=".claude/settings.local.json";function G(e){return`# rm-artifact:${e}`}i(G,"hookTag");function Ce(e,t){return`${e.trim()} ${G(t)}`}i(Ce,"taggedHookCommand");var Oe=new Set(["if","then","else","elif","fi","for","while","until","do","done","case","esac","function","return","exit","cd","echo","test","true","false"]);function k(e){let t=e.trim().split(/\s+/)[0]??"";return!/^[a-z][a-z0-9_-]*$/.test(t)||Oe.has(t)?null:y(`cmd:${t}`)}i(k,"inferredCommandRequirement");function we(e,t){let n=new Set((t?.requires??[]).map(y).filter(Boolean)),o=k(e.command);return o&&n.add(o),{boundaryClass:"outside",targets:[b],requires:[...n],provides:(t?.provides??[]).map(y).filter(Boolean)}}i(we,"hookArtifactSpec");function x(e){let t=[];Y.includes(e.event)||t.push({field:"event",message:`unknown hook event ${JSON.stringify(e.event)} \u2014 a hook on an event that never fires is indistinguishable from one that was never installed`});let n=(e.command??"").trim();return n.length===0?t.push({field:"command",message:"a hook with no command installs nothing"}):(/[\r\n]/.test(n)&&t.push({field:"command",message:"multi-line commands are refused: the identity tag is a trailing shell comment, which would silence only the final line, and a human reviewing an install should read one line"}),n.includes("\0")&&t.push({field:"command",message:"command contains a NUL byte"}),n.includes("rulemetric")&&t.push({field:"command",message:'refused: `rulemetric hooks uninstall` deletes every hook whose command contains "rulemetric", so installing one here would make this hook collateral damage of an unrelated command'}),n.includes("rm-artifact:")&&t.push({field:"command",message:"command already carries an artifact tag \u2014 installing it would produce two identities for one entry"})),e.matcher!==void 0&&(typeof e.matcher!="string"||e.matcher.trim().length===0)&&t.push({field:"matcher",message:"matcher must be a non-empty string when present"}),t}i(x,"validateHookSpec");function Re(e){let t=[`runs on: ${e.event}${e.matcher?` (tools matching ${e.matcher})`:""}`,`spawns: ${e.command.trim()}`,`writes: ${b} (one entry, tagged with this artifact's id)`],n=k(e.command);return n&&t.push(`needs: ${n} on PATH`),t}i(Re,"describeHookCapability");var q="hook";function h(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(h,"asRecord");function F(e){let t=e.event,n=e.command;if(typeof t!="string"||typeof n!="string")return null;let o=typeof e.matcher=="string"?e.matcher:void 0;return{event:t,matcher:o,command:n}}i(F,"readBareSpec");function W(e){let t=h(e.hooks)??e,n=[];for(let[o,r]of Object.entries(t))if(Array.isArray(r))for(let s of r){let a=h(s);if(!a)continue;let c=typeof a.matcher=="string"&&a.matcher.length>0?a.matcher:void 0,l=Array.isArray(a.hooks)?a.hooks:[];for(let u of l){let f=h(u)?.command;typeof f=="string"&&n.push({event:o,matcher:c,command:f})}}return n.length===0?{spec:null,problems:[]}:n.length>1?{spec:null,problems:[{field:"hook",message:`proposal describes ${n.length} hook entries; one proposal installs exactly one hook, so its inverse stays exact and its review stays readable`}]}:{spec:n[0],problems:[]}}i(W,"readSettingsFragment");function Le(e){let t=[],n=/```[a-zA-Z]*\n([\s\S]*?)```/g,o;for(;(o=n.exec(e))!==null;)t.push(o[1]);return t}i(Le,"fencedBlocks");function Ie(e){let t=h(h(e.frontmatter)?.artifact),n=t?h(t[q]):null;if(n){let o=F(n);if(o)return{spec:o,problems:x(o),source:"envelope"};let r=W(n);if(r.spec)return{spec:r.spec,problems:x(r.spec),source:"envelope"};if(r.problems.length>0)return{spec:null,problems:r.problems,source:"envelope"}}for(let o of Le(e.content??"")){let r;try{r=JSON.parse(o)}catch{continue}let s=h(r);if(!s)continue;let a=F(s);if(a)return{spec:a,problems:x(a),source:"content-fragment"};let c=W(s);if(c.spec)return{spec:c.spec,problems:x(c.spec),source:"content-fragment"};if(c.problems.length>0)return{spec:null,problems:c.problems,source:"content-fragment"}}return{spec:null,problems:[{field:"hook",message:"no hook spec found \u2014 a hook proposal must carry {event, command} in its artifact envelope or a JSON settings fragment in its body"}],source:"none"}}i(Ie,"parseHookSpec");var V=25,C=N,X=[{task:"rm-batch-task",instructions:"rm-batch-task/inject.md",class:"proven",axis:"reward",measured:"2026-09-02 n=25/arm Haiku 4.5: 0/25 \u2192 25/25, delta +1.000, 95% CI [+0.734, +1.000]"},{task:"rm-locality-task",instructions:"rm-locality-task/inject.md",class:"proven",axis:"cost",measured:"2026-09-02 n=25/arm Haiku 4.5: 25/25 both arms, cost \u221225.6%/trial, 95% CI [\u22120.0171, \u22120.0107]"},{task:"rm-migrations-task",instructions:"rm-migrations-task/inject.md",class:"negative",axis:"reward",measured:"2026-08-31 Haiku 4.5: flat after two reworks \u2014 redundant with the model's priors on this shape"},{task:"rm-pagination-task",instructions:"rm-pagination-task/inject.md",class:"negative",axis:"reward",measured:"2026-09-02 n=25/arm Haiku 4.5: 25/25 baseline under --allowedTools Bash; the rule costs +8.0%/trial and buys nothing"}];function Ne(e){return X.filter(t=>t.class===e)}i(Ne,"harborTasksOfClass");function J(e,t){return t?.engine==="pi"?"Pi is supported for eval trials, not Harbor tasks":t?.engine==="codex"&&e.axis==="cost"?`${e.task}: dollar-cost telemetry is unavailable for Codex; reward calibration remains supported`:null}i(J,"harborTaskSupport");function Pe(e,t,n=null){let o=n?I.parse(n):null,r=J(e,o);if(r)throw new Error(r);let s=!o||o.engine==="claude"&&o.model===C;return{task:e.task,instructions:e.instructions,class:s?e.class:"unvalidated",axis:e.axis,model:o?.model??C,...o?{measurement:o}:{},nTrials:V,lane:t}}i(Pe,"harborPayloadFor");var De=/[\p{L}\p{N}]+/gu;function O(e){let t=new Set;for(let n of e.toLowerCase().matchAll(De)){let o=` ${n[0]} `;for(let r=0;r+3<=o.length;r+=1)t.add(o.slice(r,r+3))}return t}i(O,"trigrams");function g(e,t){let n=O(e),o=O(t);if(n.size===0||o.size===0)return 0;let r=0,[s,a]=n.size<=o.size?[n,o]:[o,n];for(let l of s)a.has(l)&&(r+=1);let c=n.size+o.size-r;return c===0?0:r/c}i(g,"trigramSimilarity");var R=.3,je=15;function w(e){let n=e.replace(/<!--[\s\S]*?-->/g," ").replace(/```[\s\S]*?```/g," "),o=[];for(let r of n.split(`
|
|
47
|
+
`)){let s=r.trim();if(s.length===0||s.startsWith("#"))continue;let a=s.replace(/^(?:[-*+]|\d+[.)])\s+/,"").trim();if(a.length!==0)for(let c of a.split(/(?<=[.!?])\s+(?=[A-Z(`"'*])/)){let l=c.trim();l.length>=je&&o.push(l)}}return o}i(w,"splitDirectives");function Z(e,t,n=R){let o=w(e);if(o.length===0)return{redundant:!1,coverage:0,matches:[],novel:[]};let r=t.flatMap(c=>w(c.content).map(l=>({text:l,id:c.id,source:c.source}))),s=[],a=[];for(let c of o){let l=null;for(let u of r){let f=g(c,u.text);f<n||(l===null||f>l.similarity)&&(l={directive:c,matchedDirective:u.text,matchedId:u.id,matchedSource:u.source,similarity:f})}l?s.push(l):a.push(c)}return{redundant:a.length===0,coverage:s.length/o.length,matches:s,novel:a}}i(Z,"assessRedundancy");function $e(e,t=R){let n=[];for(let o=0;o<e.length;o+=1){let r=Z(e[o].content,e.slice(0,o),t);r.matches.length>0&&n.push({instruction:e[o],verdict:r})}return n}i($e,"findInternalRedundancy");var Q=.5,Me=/-(?=[0-9a-f]{6}$)[0-9a-f]*[0-9][0-9a-f]*$/;function L(e){return e.trim().toLowerCase().replace(/^skills--/,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(Me,"").replace(/-+$/,"")}i(L,"skillNameStem");function He(e,t,n=Q){let o=L(e.name);for(let s of t)if(o.length>0&&L(s.name)===o)return{name:s.name,similarity:g(e.content,s.content),reason:"name-stem"};let r=null;for(let s of t){let a=g(e.content,s.content);a<n||(r===null||a>r.similarity)&&(r={name:s.name,similarity:a,reason:"body"})}return r}i(He,"assessSkillDuplication");var Be=new Set(["sh","bash","zsh","fish"]),Ue=new Set(["mjs","cjs","js","ts","py","rb","pl"]),Ke=/(?:^|[\s(`'"])(?:sudo\s+)?(?:node|npx|pnpm|npm|yarn|bun|deno|tsx|ts-node|vitest|jest|python3?|python|ruby|perl|bash|sh|zsh|exec|run|dlx)\s+(?:[-\w=@./]+\s+)*$/,ze=/(?:\.\/)?(?:[\w.@-]+\/)+[\w.@-]+\.\w+/g;function Fe(e){return e.replace(/```[\w-]*\n?/g," ").replace(/`/g," ")}i(Fe,"stripCodeMarkers");function We(e){let t=e.trim();return t=t.replace(/[.,;:)\]]+$/,""),t.startsWith("./")&&(t=t.slice(2)),t.length===0||t.startsWith("/")||t.startsWith("~")||t.startsWith("..")||/[<>{}*?]/.test(t)?null:t}i(We,"normalise");function ee(e){let t=Fe(e),n=new Set,o=[];for(let r of t.matchAll(ze)){let s=r[0],a=r.index??0,c=t.slice(Math.max(0,a-1),a);if(c.length>0&&!/[\s(['"=]/.test(c))continue;let l=We(s);if(!l)continue;let u=l.slice(l.lastIndexOf(".")+1).toLowerCase();(Be.has(u)||Ue.has(u)&&(s.startsWith("./")||Ke.test(t.slice(t.lastIndexOf(`
|
|
48
|
+
`,Math.max(0,a-1))+1,a))))&&(n.has(l)||(n.add(l),o.push({reference:s,path:l})))}return o}i(ee,"extractCommandReferences");function Ye(e,t){return ee(e).filter(n=>!t(n.path))}i(Ye,"findUnresolvableReferences");import Yt from"gray-matter";import{z as te}from"zod";var Xt=te.object({type:te.enum(["instruction","prompt"])});export{se as a,ie as b,_ as c,M as d,fe as e,he as f,ge as g,ye as h,xe as i,_e as j,Ee as k,Se as l,y as m,ve as n,Ae as o,Te as p,be as q,ke as r,b as s,G as t,Ce as u,we as v,Re as w,Ie as x,C as y,Ne as z,J as A,Pe as B,w as C,Z as D,$e as E,He as F,Ye as G};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as h,e as g}from"./chunk-SCQK52SL.js";import{e as p,g as f}from"./chunk-76UKAFNM.js";import{a as o}from"./chunk-ZLLER3HP.js";var u="openCandidate";function K(n,s,a){let t=(n??{})[u];if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return e.executionKey!==a||typeof e.content!="string"||!e.content||typeof e.hash!="string"||!e.hash||typeof e.priorHash!="string"||e.priorHash!==s?null:{...a?{executionKey:a}:{},...typeof e.observedKey=="string"?{observedKey:e.observedKey}:{},content:e.content,hash:e.hash,priorHash:e.priorHash,plannedPairs:typeof e.plannedPairs=="number"?e.plannedPairs:0,updatedAt:typeof e.updatedAt=="string"?e.updatedAt:""}}o(K,"resolveOpenCandidate");function C(n){let{plannedPairs:s,carriedPairs:a,liveCases:t}=n;if(t<=0)return 0;let e=s-a;return e<=0?0:Math.ceil(e/t)}o(C,"owedPasses");var d=100;async function x(n){let{evalTargetId:s,candidateContentHash:a}=n,t=[];for(let e=0;;e+=d){let i=await p(`/api/eval-targets/${s}/runs?candidateContentHash=${encodeURIComponent(a)}&limit=${d}&offset=${e}`);if(!Array.isArray(i)||i.length===0||(t.push(...i.filter(r=>{if(r.outputs?.executionKey!==n.executionKey)return!1;if(!n.executionKey)return!0;if(!n.observedKey)return!1;let l=h([r]);if(!l)return!1;let[y,c]=JSON.parse(l),[b,m]=JSON.parse(n.observedKey);return y===b&&(c===null||c===m)})),i.length<d))break}return g(t)}o(x,"fetchCarriedPairs");async function A(n){let{evalTargetId:s,meta:a,blob:t,log:e,tag:i}=n;try{let r={...a};t?r[u]=t:delete r[u],await f(`/api/eval-targets/${s}`,{metadata:r}),e(t?`${i}: banked candidate ${t.hash.slice(0,8)} \u2014 the next run resumes instead of restarting`:`${i}: cleared the banked candidate (this cycle reached a decision)`)}catch(r){e(`${i}: could not update the candidate bank (${r instanceof Error?r.message:String(r)})`)}}o(A,"bankOpenCandidate");function O(n){return{...n.executionKey?{executionKey:n.executionKey}:{},...n.observedKey?{observedKey:n.observedKey}:{},content:n.content,hash:n.hash,priorHash:n.priorHash,plannedPairs:n.plannedPairs,updatedAt:n.now.toISOString()}}o(O,"buildOpenCandidate");export{u as a,K as b,C as c,x as d,A as e,O as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-76UKAFNM.js";import{a as e}from"./chunk-ZLLER3HP.js";function i(){return process.env.RULEMETRIC_API_URL??a}e(i,"apiUrl");function u(){let n=process.env.RULEMETRIC_API_KEY??process.env.RULEMETRIC_ACCESS_TOKEN;if(!n)throw new Error("not signed in \u2014 run `rulemetric auth login`");return n}e(u,"authToken");async function t(n,o){let r=await fetch(`${i()}${n}`,{...o,headers:{Authorization:`Bearer ${u()}`,"Content-Type":"application/json",...o?.headers??{}},signal:AbortSignal.timeout(1e4)});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return await r.json()}e(t,"request");function c({limit:n}){return t(`/api/launch-jobs?limit=${n}`)}e(c,"fetchLaunchJobs");function h(n){return t("/api/launch-jobs",{method:"POST",body:JSON.stringify(n)})}e(h,"createLaunchJob");function l(n){return t(`/api/launch-jobs/${n}/cancel`,{method:"POST"})}e(l,"cancelLaunchJob");function p(){return t("/api/launchers")}e(p,"listLaunchers");export{c as a,h as b,l as c,p as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as n,c as a,d as g}from"./chunk-3AV3GTMP.js";import{e as o}from"./chunk-
|
|
1
|
+
import{a as s,b as n,c as a,d as g}from"./chunk-3AV3GTMP.js";import{e as o}from"./chunk-76UKAFNM.js";import{a as e}from"./chunk-ZLLER3HP.js";var i=!1;async function c(){if(process.env.RULEMETRIC_ORG_ID)return;let r=s();if(!(r&&!g(r)))try{let t=await o("/api/profile");if(!t.activeOrgId){a();return}if(r&&t.activeOrgId===r.orgId){n({orgId:r.orgId,orgSlug:r.orgSlug,syncedAt:Date.now()});return}let d=(await o("/api/orgs")).find(l=>l.id===t.activeOrgId);n({orgId:t.activeOrgId,orgSlug:d?.slug,syncedAt:Date.now()})}catch{}}e(c,"syncActiveOrgFromServer");async function p(){i||(i=!0,await c())}e(p,"maybeRefreshActiveOrg");async function v(){i=!0,await c()}e(v,"bootstrapActiveOrg");function O(){i=!1}e(O,"_resetRefreshAttempt");export{p as a,v as b,O as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as d}from"./chunk-QWCEZEDO.js";import{a as R,g as v,h as T,j as I,m as C}from"./chunk-OZQNSELV.js";import{d as g}from"./chunk-
|
|
1
|
+
import{e as d}from"./chunk-QWCEZEDO.js";import{a as R,g as v,h as T,j as I,m as C}from"./chunk-OZQNSELV.js";import{d as g}from"./chunk-GPBN4ROE.js";import{e as _}from"./chunk-76UKAFNM.js";import{g as m,l as k}from"./chunk-PZNWH4VQ.js";import{a as i}from"./chunk-ZLLER3HP.js";import{execSync as j}from"node:child_process";import{existsSync as p,readFileSync as y}from"node:fs";import{homedir as f}from"node:os";import{join as a}from"node:path";var P=["install","auth","hooks","worker"],O=["judge"],M=[...P,...O];function $(){return{projectPath:process.cwd(),configDir:k()}}i($,"defaultContext");var A=a(f(),".mitmproxy","mitmproxy-ca-cert.pem");function S(e){if(!e)return"";if(e.length<=8)return"*".repeat(e.length);let t=e.slice(0,4),n=e.slice(-4);return`${t}${"*".repeat(Math.max(4,e.length-8))}${n}`}i(S,"maskToken");function te(e,t){let n=e===null?[]:e.replace(/\n$/,"").split(`
|
|
2
2
|
`),o=t===null?[]:t.replace(/\n$/,"").split(`
|
|
3
3
|
`),s=[],u=Math.max(n.length,o.length);for(let c=0;c<u;c++){let l=n[c],r=o[c];l===r?s.push(` ${l}`):(l!==void 0&&s.push(`-${l}`),r!==void 0&&s.push(`+${r}`))}return s.join(`
|
|
4
4
|
`)}i(te,"renderDiff");function x(e,t){let n=a(e,"env");if(!p(n))return null;try{let s=y(n,"utf-8").match(new RegExp(`^${t}=(.+)$`,"m"));return s?s[1]:null}catch{return null}}i(x,"readEnvValue");async function b(){if(!m())return!1;try{return(await Promise.race([_("/api/setup/status"),new Promise((t,n)=>setTimeout(()=>n(new Error("setup/status timeout")),2500))]))?.workerActive===!0}catch{return!1}}i(b,"workerActive");function E(e,t){let n=a(e,".claude",t),o={},s=null;if(p(n))try{s=y(n,"utf-8").replace(/\n$/,""),o=JSON.parse(s)}catch{o={}}return{settings:o,before:s}}i(E,"readProjectSettings");function D(e){let{settings:t,before:n}=E(e,"settings.local.json");return v(t),{before:n,after:JSON.stringify(t,null,2)}}i(D,"projectHooksSettings");function N(e){let{settings:t,before:n}=E(e,"settings.local.json"),o={...t.env??{}};return o.HTTPS_PROXY=`http://localhost:${d}`,o.NO_PROXY=I,o.NODE_EXTRA_CA_CERTS=A,{before:n,after:JSON.stringify({...t,env:o},null,2)}}i(N,"projectProxyEnvSettings");function U(e){let{settings:t,before:n}=E(e,"settings.json");if(n===null)return null;let{removed:o}=C(t,d);return o?{before:n,after:JSON.stringify(t,null,2)}:null}i(U,"projectSharedSettingsMigration");var Y=a(f(),"Library","LaunchAgents","com.rulemetric.worker.plist"),G=a(f(),".config","systemd","user","rulemetric-worker.service");function h(e){j(e,{stdio:"inherit"})}i(h,"runCommand");var L=[{id:"install",title:"Install the CLI",command:"npm install -g @rulemetric/cli",async detect(){return m()||await b()},async plan(){return{id:"install",title:"Install the CLI",command:"npm install -g @rulemetric/cli",artifacts:[{path:"npm install -g @rulemetric/cli",kind:"command",before:null,after:"rulemetric --version # verifies the binary is on PATH"}]}},async apply(){h("npm install -g @rulemetric/cli")}},{id:"auth",title:"Authenticate",command:"rulemetric auth login",async detect(){return m()},async plan(e){let t=a(e.configDir,"env"),n=null;if(p(t))try{n=X(y(t,"utf-8"))}catch{n="(unreadable)"}let o=x(e.configDir,"RULEMETRIC_ACCESS_TOKEN"),u=[`RULEMETRIC_ACCESS_TOKEN=${S(o||"<token-from-login>")}`],c=x(e.configDir,"RULEMETRIC_API_KEY");c&&u.push(`RULEMETRIC_API_KEY=${S(c)}`);let l=process.env.RULEMETRIC_API_URL;l&&u.push(`RULEMETRIC_API_URL=${l}`);let r=u.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-44TYRMIS.js";import{a as f}from"./chunk-ZLLER3HP.js";import{useEffect as J,useState as u,useCallback as m,useRef as s}from"react";var y=5e3;function T(a=20){let[d,b]=u([]),[g,l]=u(null),[h,p]=u(!0),r=s(!1),e=s(null),c=s(0),t=m(async()=>{let o=++c.current;try{let n=await i({limit:a});if(r.current||o!==c.current)return;b(n),l(null)}catch(n){if(r.current||o!==c.current)return;l(n instanceof Error?n.message:String(n))}finally{if(r.current||o!==c.current)return;p(!1),e.current=setTimeout(()=>{t()},y)}},[a]),L=m(()=>{e.current&&clearTimeout(e.current),t()},[t]);return J(()=>(r.current=!1,t(),()=>{r.current=!0,e.current&&clearTimeout(e.current)}),[t]),{jobs:d,error:g,loading:h,refetch:L}}f(T,"useLaunchJobs");export{T as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as d}from"./chunk-
|
|
1
|
+
import{b as u,c as d}from"./chunk-MXHAXY66.js";import{b as g}from"./chunk-OP4U3XBZ.js";import{e as m,f as p,h as l}from"./chunk-76UKAFNM.js";import{a as s}from"./chunk-ZLLER3HP.js";async function x(f,R){let r=s(e=>R?.logger?.info?.(e)??console.log(e),"log"),{evalTargetId:n}=f,i=`[cron_refine_cases] ${n}`,t=await m(`/api/eval-targets/${n}`);if(!(t.metadata?.autoRefineCases===!0))return r(`${i} not opted in (metadata.autoRefineCases)`),{skipped:"not-opted-in",reason:`"${t.name}" has not opted into automatic case refinement. Set metadata.autoRefineCases=true to let the loop cull cases that carry no treatment signal, or run \`rulemetric evals refine-cases ${n}\` by hand.`,targetName:t.name};let C=await m(`/api/eval-targets/${n}/judge-calibration`),a=u(C.caseDiscrimination);if(a.refused)return r(`${i} ${a.refused}: ${a.summary}`),{skipped:a.refused,reason:a.summary,targetName:t.name};r(`${i} ${a.summary}`);let o=await d(a,{generate:s(e=>g({content:t.content,name:t.name,feedback:e}),"generate"),createCase:s(e=>p(`/api/eval-targets/${n}/evals`,{name:e.name,prompt:e.prompt,expectations:e.expectations}),"createCase"),retireCase:s(async(e,y)=>{await l(`/api/eval-targets/${n}/evals/${e}`,{retire:!0,retiredReason:y})},"retireCase"),log:r});r(`${i} ${o.summary}`);let{skipped:c,...$}=o;return{...$,targetName:t.name,...c?{skipped:c,reason:o.summary}:{}}}s(x,"cronRefineCases");export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as E}from"./chunk-
|
|
1
|
+
import{l as E}from"./chunk-42A4PUW7.js";import{a as p,e as w}from"./chunk-PZNWH4VQ.js";import{a as o}from"./chunk-ZLLER3HP.js";import{fileURLToPath as v}from"node:url";import{existsSync as A,readFileSync as b}from"node:fs";import{dirname as L,join as x}from"node:path";function C(){let t=L(v(import.meta.url));for(let e=0;e<8;e++){let s=x(t,"package.json");if(A(s))try{let i=JSON.parse(b(s,"utf8"));if(i.name==="@rulemetric/cli"&&i.version)return i.version}catch{}let n=L(t);if(n===t)break;t=n}return"0.0.0"}o(C,"readCliVersion");var O=C(),I="https://rulemetric.com",l=class extends Error{constructor(s,n){super(n);this.statusCode=s;this.name="ApiError"}static{o(this,"ApiError")}};function S(){let t=p(),e=process.env.RULEMETRIC_API_URL??t.apiUrl;if(!e){if(process.env.RULEMETRIC_STRICT_LOCAL==="1"||t.strictLocal==="1")throw new Error("RULEMETRIC_STRICT_LOCAL is set but no RULEMETRIC_API_URL is configured \u2014 refusing the cloud default. Set RULEMETRIC_API_URL in the environment or ~/.config/rulemetric/env.");e=I}let s=new URL(e);if(s.protocol==="http:"&&s.hostname!=="localhost"&&s.hostname!=="127.0.0.1")throw new Error(`API URL must use HTTPS for non-localhost hosts: ${e}`);return e}o(S,"getBaseUrl");async function a(t,e={}){let n=`${S()}${t}`,i={"Content-Type":"application/json","User-Agent":`rulemetric-cli/${O}`,...e.headers},m=p(),d=process.env.RULEMETRIC_API_KEY||m.apiKey||w()?.accessToken||m.accessToken;d&&(i.Authorization=`Bearer ${d}`);let h=new URL(n),f=h.hostname==="localhost"||h.hostname==="127.0.0.1",P=process.env.HTTPS_PROXY,R=process.env.HTTP_PROXY;f&&(delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY);let u=e.timeoutMs?new AbortController:void 0,g=!1,y=u?setTimeout(()=>{g=!0,u.abort()},e.timeoutMs):void 0,r;try{r=await fetch(n,{method:e.method??"GET",headers:i,body:e.body?JSON.stringify(e.body):void 0,signal:u?.signal})}catch(T){if(g){let U=new URL(n).host,_=Math.round(e.timeoutMs/1e3);throw new l(408,`Request to ${U} timed out after ${_}s. This is usually transient or a local proxy/gateway issue \u2014 retry, and if it persists check HTTPS_PROXY / the RuleMetric gateway (:8787).`)}throw T}finally{y&&clearTimeout(y),f&&(P!==void 0&&(process.env.HTTPS_PROXY=P),R!==void 0&&(process.env.HTTP_PROXY=R))}let c;if(r.headers.get("content-type")?.includes("application/json")?c=await r.json():c=await r.text(),!r.ok){let{message:T}=E(r.status,c);throw new l(r.status,T)}return c}o(a,"api");var j=o(t=>a(t),"apiGet"),F=o((t,e)=>a(t,{method:"POST",body:e}),"apiPost"),B=o((t,e)=>a(t,{method:"PUT",body:e}),"apiPut"),D=o((t,e)=>a(t,{method:"PATCH",body:e}),"apiPatch"),G=o(t=>a(t,{method:"DELETE"}),"apiDelete");export{I as a,l as b,S as c,a as d,j as e,F as f,B as g,D as h,G as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as u}from"./chunk-
|
|
1
|
+
import{f as u}from"./chunk-FBSZ6KCM.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
2
|
|
|
3
3
|
You will receive a summary of eval cases, their expectations, and grading results.
|
|
4
4
|
|
|
@@ -31,4 +31,4 @@ Respond in JSON:
|
|
|
31
31
|
|
|
32
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
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=
|
|
34
|
+
${JSON.stringify(i,null,2)}`,n=await u({engine:t.engine??"claude",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=d(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 d(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(d,"parseJsonFromOutput");export{p as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{h as R}from"./chunk-
|
|
1
|
+
import{h as R}from"./chunk-I6ZQOMZS.js";import{a as S,b as v,c as $,f as w,g as A}from"./chunk-SIGZEQ3K.js";import{e as y,f}from"./chunk-76UKAFNM.js";import{a as c}from"./chunk-ZLLER3HP.js";import{execFileSync as x}from"node:child_process";import{openSync as P,readSync as C,closeSync as j,readFileSync as E}from"node:fs";function I(l){let t;try{t=P(l,"r");let o=Buffer.alloc(64*1024),s=C(t,o,0,o.length,0),i=o.subarray(0,s).toString("utf-8");for(let r of i.split(`
|
|
2
2
|
`))if(r.startsWith("{"))try{let a=JSON.parse(r).cwd;if(typeof a=="string"&&a.startsWith("/"))return a}catch{}return null}catch{return null}finally{t!==void 0&&j(t)}}c(I,"readTranscriptCwd");function W(l){let t=c(r=>{try{return x("git",["-C",l,...r],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:5e3}).trim()||null}catch{return null}},"git");if(!t(["rev-parse","--show-toplevel"]))return null;let s=t(["rev-parse","--git-dir"]),i=t(["rev-parse","--git-common-dir"]);return{gitRemote:t(["remote","get-url","origin"]),gitRootCommit:t(["rev-list","--max-parents=0","HEAD"])?.split(`
|
|
3
3
|
`).pop()?.trim()??null,gitBranch:t(["branch","--show-current"]),isWorktree:!!s&&!!i&&s!==i}}c(W,"gitAnchors");async function O(l,t,o=v(W,I)){let s=Math.min(l.limit??200,1e3),i=await R(()=>y(`/api/sessions/unattributed?limit=${s}`),{log:c(e=>t.logger.info(e),"log"),label:"sessions/unattributed",idempotent:!0}),r=i.sessions??[],a=i.total??r.length;if(r.length===0)return t.logger.info("no unattributed sessions"),{scanned:0,repaired:0,reimported:0,unrepairable:0,remaining:0};let m=0,g=0,u=0;for(let e of r){if(!e.externalSessionId){u++;continue}let n=A(e,o);if(!n){u++;continue}try{await f("/api/sessions",{tool:e.tool,externalSessionId:e.externalSessionId,projectPath:n.projectPath,...n.gitBranch?{gitBranch:n.gitBranch}:{},metadata:{...n.gitRemote?{gitRemote:n.gitRemote}:{},...n.gitRootCommit?{gitRootCommit:n.gitRootCommit}:{},isWorktree:n.isWorktree,reconciledAttribution:!0}}),m++}catch(d){u++,t.logger.info(`reconcile failed for ${e.externalSessionId}: ${d.message}`);continue}let p=e.tool==="claude_code"?$(e.externalSessionId,o):null,b=w({tool:e.tool,pathWasJunk:!!e.projectPath&&S(e.projectPath),endedAt:e.endedAt??null,transcript:p?o.stat(p):null});if(b.reimport&&p)try{let d=E(p,"utf-8");await f(`/api/sessions/${e.id}/reimport`,{content:d,tool:"claude_code"}),g++}catch(d){t.logger.info(`reimport failed for ${e.externalSessionId} (${b.reason}): ${d.message}`)}}let h=a-m;return t.logger.info(`reconciled attribution: scanned=${r.length} repaired=${m} reimported=${g} unrepairable=${u} remaining=${h} (of ${a} total)`),{scanned:r.length,repaired:m,reimported:g,unrepairable:u,remaining:h}}c(O,"cronReconcileAttribution");export{O as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-ZLLER3HP.js";var c=r(t=>typeof t=="object"&&t!==null&&typeof t.withScore=="number"&&typeof t.withoutScore=="number","isPair");function l(t,s,i,a){let u=[...t].sort((e,n)=>Date.parse(n.createdAt)-Date.parse(e.createdAt));for(let e of u){if(e.applied)continue;let n=e.gates?.accumulation;if(!n||typeof n!="object"||n.executionKey!==a||n.priorContentHash!==s||n.targetPairs!==i||typeof n.candidateContentHash!="string"||!Array.isArray(n.pairs))continue;let o=n.pairs.filter(c);if(o.length===n.pairs.length&&!(o.length>=i))return{promotionId:e.id,...n.observedKey?{observedKey:n.observedKey}:{},candidateContentHash:n.candidateContentHash,pairs:o,runs:typeof n.runs=="number"?n.runs:1}}return null}r(l,"findOpenAccumulation");export{l as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as b,g as y}from"./chunk-N4YPDZJF.js";import{e as M,f as w}from"./chunk-76UKAFNM.js";import{a as u}from"./chunk-ZLLER3HP.js";var $={anthropic:["https://platform.claude.com/docs/en/about-claude/pricing.md"],openai:["https://platform.openai.com/docs/pricing"]},R=.7,v=16e3,x=["You extract LLM API pricing from a provider pricing page.","You will be given the page text in <data> tags and, in this system prompt,","a list of model ids to find. For EACH requested model id, return its","published USD price per 1,000,000 tokens.","","Rules:","- Only report a model if you can find its rate ON THE PAGE. If it is not on"," the page, set found=false and omit the numbers \u2014 never guess from memory.","- inputPerM and outputPerM are the standard (non-batch, non-priority) rates.","- cacheReadPerM: the cached/discounted-input rate if published, else omit.","- For Anthropic models ONLY, if cache-write rates are not explicitly listed,"," compute them as cacheWrite5mPerM = inputPerM * 1.25 and"," cacheWrite1hPerM = inputPerM * 2.0. For all other providers, omit them.","- confidence is 0..1: how sure you are the numbers are correct for THIS id.","- contextWindow in tokens if stated, else omit.","","Respond with ONLY a JSON object of the form:",'{"rates":[{"modelId":"...","found":true,"confidence":0.9,"inputPerM":5,"outputPerM":25,"cacheReadPerM":0.5,"contextWindow":1000000}]}'].join(`
|
|
2
2
|
`);async function C(f){try{let n=await fetch(f,{headers:{accept:"text/plain, text/markdown, text/html"}});if(!n.ok)return null;let i=await n.text();return i.length>v?i.slice(0,v):i}catch{return null}}u(C,"fetchPage");var L=u(async(f,n)=>{let i=await M("/api/pricing/coverage"),I=[...i.unpriced,...i.stale],m=new Map;for(let r of I)m.set(`${r.provider}::${r.modelId}`,r);let a=[...m.values()];if(a.length===0)return n.logger.info("[cron-refresh-pricing] coverage clean \u2014 nothing unpriced or stale"),{status:"clean",checked:i.unpriced.length+i.stale.length};if(b()==="none")return n.logger.warn(`[cron-refresh-pricing] ${a.length} model(s) need pricing but no LLM backend (install the claude CLI or set ANTHROPIC_API_KEY) \u2014 skipping`),{status:"no-llm",pending:a.length};let d=new Map;for(let r of a){let o=d.get(r.provider)??[];o.push(r.modelId),d.set(r.provider,o)}let t={written:0,unchanged:0,flagged:0,rejected:0,skipped:0},c=[];for(let[r,o]of d){let h=$[r];if(!h){n.logger.warn(`[cron-refresh-pricing] no pricing source configured for provider '${r}' (${o.length} model(s)) \u2014 skipping`),t.skipped+=o.length;continue}let p="",l="";for(let e of h){let s=await C(e);s&&(p+=`
|
|
3
3
|
|
|
4
4
|
=== ${e} ===
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as r}from"./chunk-
|
|
1
|
+
import{f as r}from"./chunk-76UKAFNM.js";import{a as i}from"./chunk-ZLLER3HP.js";async function p(e,t,n,o){await r(`/api/instruction-suggestions/${encodeURIComponent(e)}/events`,{eventType:"accepted",projectPath:t,instructionId:n,actor:o})}i(p,"logAccepted");async function a(e,t,n,o,s="redundant"){await r(`/api/instruction-suggestions/${encodeURIComponent(e)}/events`,{eventType:s,projectPath:t,instructionId:n,actor:o})}i(a,"logRefused");export{p as a,a as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as R,c as L,f as s,g as I,i as h}from"./chunk-W23OYQXI.js";import{c as ne}from"./chunk-EMLLGASZ.js";import{b as re}from"./chunk-IEQDLURA.js";import{d as te,e as oe,f as se}from"./chunk-KINIFUZQ.js";import{a as U}from"./chunk-V55ROUNP.js";import{a as F}from"./chunk-XMA6SWOT.js";import{a as W}from"./chunk-RAQLVO2X.js";import{a as $}from"./chunk-DHX4U6EC.js";import{a as q}from"./chunk-NYNHX7OX.js";import{b as J}from"./chunk-VXL5H3VZ.js";import{a as K}from"./chunk-QAMHZY2P.js";import{a as Y}from"./chunk-RMRVUI7B.js";import{a as O}from"./chunk-ZYGBABMZ.js";import{b as V}from"./chunk-5RBLIVBF.js";import{a as Q}from"./chunk-AIYFT4P6.js";import{a as D}from"./chunk-PZS55PW2.js";import{a as ee}from"./chunk-3IMRLHJJ.js";import{e as P}from"./chunk-EUHRTEVJ.js";import{b as G}from"./chunk-GKVHFXUQ.js";import{c as N}from"./chunk-LJRJ2RAC.js";import{a as z}from"./chunk-QRIJ3AHP.js";import{a as X}from"./chunk-CT6GJQIR.js";import{a as Z}from"./chunk-OVS7ZDJ4.js";import{a as x}from"./chunk-AGEZAKCC.js";import{a as j}from"./chunk-6ANODRDT.js";import{b as C}from"./chunk-PIVEJTNF.js";import{k as B}from"./chunk-POEMCITL.js";import{d as S}from"./chunk-GPBN4ROE.js";import{b as M,e as T,f as E}from"./chunk-76UKAFNM.js";import{a as l}from"./chunk-ZLLER3HP.js";var H=null,w=null,ce={process_eval:W,process_insights:$,process_launch:J,process_send_message:O,process_conversation:F,process_session_goal:U,distill_memories:G,memory_ab:K,process_run_cleanup:Y,cron_refine_cases:j,cron_retire_unused_skills:ee,cron_reconcile_attribution:x,cron_suggest_instructions:P,cron_refresh_skills:D,cron_refresh_pricing:Q,cron_eval_autorun:X,cron_auto_accept_suggestions:z,cron_instruction_training:Z,cron_instruction_evolution:B,process_judge_review:q,harbor_ab:N},ae=Object.keys(ce),me=new Set([]);function pe(e=process.env){return e.DATABASE_URL?ae:ae.filter(t=>!me.has(t))}l(pe,"availableCapabilities");var ge=3e4,_e=3e4,fe=3e4,ie=500,le=1e4,ve=`thin-agent-${process.pid}`,A=null;function ke(e,t,r,p){let d;try{let i=S();d={claude:i.claudeBin!=null,codex:i.codexBin!=null,pi:i.piBin!=null,codexModel:i.codexConfiguredModel}}catch{}let m;try{m=C()}catch{}let g=l(i=>E("/api/workers/heartbeat",{workerType:"cli-worker",clientName:ve,clientVersion:p,workerVersion:"0.1.0",currentJobId:null,inFlightCount:0,lastError:null,status:i,metadata:{capabilities:e,mode:"thin-agent",measurementProtocol:1,memorySnapshots:1,boundedAutorun:1,llmEngines:d,harborReady:m,machine:H?.summary()}}).then(c=>{let u=c?.advisory;u&&u.message!==A?(A=u.message,s(r,{event:"worker_advisory",code:u.code,message:u.message})):u||(A=null)}).catch(c=>{s(r,{event:"presence_heartbeat_error",error:c instanceof Error?c.message:String(c)})}),"send");g("alive");let f=setInterval(()=>g("alive"),fe),a=null,n=l(()=>a||(clearInterval(f),a=Promise.race([g("shutting_down"),new Promise(i=>setTimeout(i,2e3).unref())]),a),"sayGoodbye");return t.addEventListener("abort",()=>{n()},{once:!0}),{shutdown:n}}l(ke,"startPresenceHeartbeat");async function be(e,t,r=S()){let p=[...r.claudeBin?["claude"]:[],...r.codexBin?["codex"]:[],...r.piBin?["pi"]:[]],d=`capabilities=${encodeURIComponent(e.join(","))}&waitMs=${t}&measurementProtocol=1&memorySnapshots=1&boundedAutorun=1&measurementEngines=${encodeURIComponent(p.join(","))}`,m=await T(`/api/work/next?${d}`);return m==null||typeof m=="string"?null:m}l(be,"pollForWork");function he(e,t){return{logger:{info:l(r=>t(r),"info"),warn:l(r=>t(r),"warn"),error:l(r=>t(r),"error")},job:{attempts:e}}}l(he,"makeHelpers");async function we(e,t,r,p){let d=ce[e.kind],m=Date.now();if(s(r,{event:"claim",jobId:e.id,kind:e.kind,attempts:e.attempts}),!d){let n=`unknown kind: ${e.kind}`;s(r,{event:"fail",jobId:e.id,kind:e.kind,terminal:!0,error:n}),await E(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:n,terminal:!0}).catch(()=>{});return}let g=l(()=>{s(r,{event:"heartbeat",jobId:e.id}),h(`/api/work/${e.id}/heartbeat`,{leaseToken:e.leaseToken},{budgetMs:Math.min(L,Math.max(0,t-1e3)),signal:p,log:r,event:"heartbeat",jobId:e.id}).then(n=>{n.ok||s(r,{event:"heartbeat_error",jobId:e.id,attempts:n.attempts,error:n.error instanceof Error?n.error.message:String(n.error)})})},"beat"),f=setInterval(g,t);w={jobId:e.id,beat:g};let a;try{let n=he(e.attempts,r);a={kind:"complete",result:await d(e.payload,n)??{}}}catch(n){let i=H?.pausesSince(m)??[],c=se(i),u=n instanceof Error?n.message:String(n),v=V(n),o=!v&&oe(i);a={kind:"fail",message:c?`${c}; ${u}`:u,pausedDuringJob:!!c,terminal:v,hostSuspended:o}}try{if(a.kind==="complete"){s(r,{event:"complete",jobId:e.id,kind:e.kind,durationMs:Date.now()-m});let n=await h(`/api/work/${e.id}/complete`,{leaseToken:e.leaseToken,result:a.result},{budgetMs:R,signal:p,log:r,event:"complete_post",jobId:e.id});n.ok||s(r,{event:"complete_post_error",jobId:e.id,kind:e.kind,attempts:n.attempts,error:n.error instanceof Error?n.error.message:String(n.error)})}else{s(r,{event:"fail",jobId:e.id,kind:e.kind,durationMs:Date.now()-m,terminal:a.terminal,error:a.message,...a.pausedDuringJob?{pausedDuringJob:!0}:{},...a.hostSuspended?{hostSuspended:!0}:{}});let n=await h(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:a.message,terminal:a.terminal,hostSuspended:a.hostSuspended},{budgetMs:R,signal:p,log:r,event:"fail_post",jobId:e.id});n.ok||s(r,{event:"fail_post_error",jobId:e.id,attempts:n.attempts,error:n.error instanceof Error?n.error.message:String(n.error)})}}finally{clearInterval(f),w=null}}l(we,"runOne");var de=new Set(["process_eval","process_conversation","process_insights","process_session_goal","distill_memories","memory_ab","cron_suggest_instructions","cron_eval_autorun","cron_instruction_evolution","process_judge_review","harbor_ab"]);async function Ze(e){let t=e.log??(()=>{}),r=e.pollWaitMs??ge,p=e.heartbeatIntervalMs??_e,d=e.capabilities??pe();s(t,{event:"agent_start",capabilities:d,pollWaitMs:r,heartbeatIntervalMs:p});try{let o=re();o.removed.length>0&&s(t,{event:"eval_worktrees_swept",removed:o.removed.length})}catch(o){s(t,{event:"eval_worktree_sweep_failed",error:o instanceof Error?o.message:String(o)})}H=te({signal:e.signal,onPause:l(o=>{s(t,{event:"machine_pause",...o,jobId:w?.jobId??null}),w?.beat()},"onPause")});let m=ke(d,e.signal,t,e.version);ne({signal:e.signal,log:t}).catch(o=>{s(t,{event:"tt_heartbeat_fatal",error:o instanceof Error?o.message:String(o)})});let g=5*6e4,f=0,a=l(()=>{if(!e.readInstalledVersion||!e.version)return!1;let o=Date.now();if(o-f<g)return!1;f=o;let b=e.readInstalledVersion();return!!(b&&b!==e.version)},"versionDrifted"),n=new AbortController,i=n.signal;e.signal.aborted?n.abort():e.signal.addEventListener("abort",()=>n.abort(),{once:!0});let c=l(async(o,b)=>{let _=ie;for(;!i.aborted;){if(a()){s(t,{event:"agent_version_drift",bootVersion:e.version,installedVersion:e.readInstalledVersion?.()??null}),n.abort(),e.onVersionDrift?.();break}let y=null;try{y=await be([...b],r)}catch(k){let ue=k instanceof M?k.statusCode:void 0;if(s(t,{event:"poll_error",lane:o,status:ue,error:k instanceof Error?k.message:String(k)}),!await I(_,i))break;_=Math.min(_*2,le);continue}if(!y){if(s(t,{event:"poll_204",lane:o}),!await I(_,i))break;_=Math.min(_*2,le);continue}_=ie,await we(y,p,t,i)}},"runLane"),u=d.filter(o=>de.has(o)),v=d.filter(o=>!de.has(o));u.length>0&&v.length>0?(s(t,{event:"agent_lanes",heavy:u.length,fast:v.length}),await Promise.all([c("heavy",u),c("fast",v)])):await c("single",d),await m.shutdown(),s(t,{event:"agent_stop"})}l(Ze,"runAgentLoop");export{ce as a,ae as b,pe as c,be as d,Ze as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,f as a}from"./chunk-
|
|
1
|
+
import{b as o,f as a}from"./chunk-76UKAFNM.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};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`);return` <h3 style="margin:24px 0 8px 0;font-size:16px;line-height:1.3;font-weight:600;color:${
|
|
1
|
+
import{a as f,b as M}from"./chunk-Q776YUBD.js";import{e as _,f as S}from"./chunk-42A4PUW7.js";import{a as o}from"./chunk-ZLLER3HP.js";import*as m from"node:fs/promises";import*as x from"node:path";import{eq as j}from"drizzle-orm";import{randomBytes as Y}from"node:crypto";var A="#0d9488",h="#1a1a1a",$="#666666",C="#f5f5f7",N="#ffffff",D="#e5e5e9",I=["Added","Changed","Fixed","Removed","Deprecated","Security"];function U(e){let t=["January","February","March","April","May","June","July","August","September","October","November","December"],[n,r,a]=e.split("-").map(d=>parseInt(d,10));return!n||!r||!a||r<1||r>12?e:`${t[r-1]} ${a}, ${n}`}o(U,"formatIsoDate");function l(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}o(l,"escapeHtml");function z(e){let t=[];for(let n of I){let r=e[n];r&&r.length>0&&t.push({name:n,items:r})}return t}o(z,"orderedSections");function v(e){let{version:t,date:n,sections:r,unsubscribeUrl:a,productUrl:d,recipientName:u}=e,c=U(n),s=`What's new in RuleMetric \u2014 ${c}`,y=u?`Hi ${u},`:"Hi there,",i=z(r),p=new Date().getUTCFullYear(),b=i.map(({name:R,items:E})=>{let w=E.map(O=>` <li style="margin:0 0 6px 0;font-size:15px;line-height:1.5;color:${h};">${l(O)}</li>`).join(`
|
|
2
|
+
`);return` <h3 style="margin:24px 0 8px 0;font-size:16px;line-height:1.3;font-weight:600;color:${h};">${R}</h3>
|
|
3
3
|
<ul style="margin:0 0 8px 0;padding-left:20px;">
|
|
4
4
|
${w}
|
|
5
5
|
</ul>`}).join(`
|
|
6
|
-
`),
|
|
6
|
+
`),k=`<!doctype html>
|
|
7
7
|
<html lang="en">
|
|
8
8
|
<head>
|
|
9
9
|
<meta charset="utf-8" />
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
11
11
|
<title>${l(s)}</title>
|
|
12
12
|
</head>
|
|
13
|
-
<body style="margin:0;padding:0;background:${
|
|
14
|
-
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background:${
|
|
13
|
+
<body style="margin:0;padding:0;background:${C};font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:${h};">
|
|
14
|
+
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background:${C};padding:32px 16px;">
|
|
15
15
|
<tr>
|
|
16
16
|
<td align="center">
|
|
17
|
-
<table role="presentation" width="560" cellspacing="0" cellpadding="0" border="0" style="max-width:560px;background:${
|
|
17
|
+
<table role="presentation" width="560" cellspacing="0" cellpadding="0" border="0" style="max-width:560px;background:${N};border:1px solid ${D};border-radius:8px;overflow:hidden;">
|
|
18
18
|
<tr>
|
|
19
19
|
<td style="padding:24px 32px 8px 32px;">
|
|
20
|
-
<a href="${l(
|
|
20
|
+
<a href="${l(d)}" style="text-decoration:none;color:${A};font-size:14px;font-weight:600;">RuleMetric</a>
|
|
21
21
|
</td>
|
|
22
22
|
</tr>
|
|
23
23
|
<tr>
|
|
24
24
|
<td style="padding:8px 32px 8px 32px;">
|
|
25
|
-
<h1 style="margin:0 0 8px 0;font-size:22px;line-height:1.3;font-weight:600;color:${
|
|
25
|
+
<h1 style="margin:0 0 8px 0;font-size:22px;line-height:1.3;font-weight:600;color:${h};">
|
|
26
26
|
What's new \u2014 ${l(c)}
|
|
27
27
|
</h1>
|
|
28
|
-
<p style="margin:0 0 8px 0;font-size:13px;line-height:1.5;color:${
|
|
28
|
+
<p style="margin:0 0 8px 0;font-size:13px;line-height:1.5;color:${$};">
|
|
29
29
|
Release ${l(t)}
|
|
30
30
|
</p>
|
|
31
|
-
<p style="margin:16px 0 0 0;font-size:15px;line-height:1.5;color:${
|
|
32
|
-
${l(
|
|
31
|
+
<p style="margin:16px 0 0 0;font-size:15px;line-height:1.5;color:${h};">
|
|
32
|
+
${l(y)}
|
|
33
33
|
</p>
|
|
34
|
-
<p style="margin:8px 0 0 0;font-size:15px;line-height:1.5;color:${
|
|
34
|
+
<p style="margin:8px 0 0 0;font-size:15px;line-height:1.5;color:${h};">
|
|
35
35
|
Here's what shipped in the latest RuleMetric release.
|
|
36
36
|
</p>
|
|
37
37
|
</td>
|
|
38
38
|
</tr>
|
|
39
39
|
<tr>
|
|
40
40
|
<td style="padding:0 32px 16px 32px;">
|
|
41
|
-
${
|
|
41
|
+
${b}
|
|
42
42
|
</td>
|
|
43
43
|
</tr>
|
|
44
44
|
<tr>
|
|
45
|
-
<td style="padding:16px 32px 24px 32px;border-top:1px solid ${
|
|
46
|
-
<p style="margin:0 0 8px 0;font-size:12px;line-height:1.5;color:${
|
|
45
|
+
<td style="padding:16px 32px 24px 32px;border-top:1px solid ${D};">
|
|
46
|
+
<p style="margin:0 0 8px 0;font-size:12px;line-height:1.5;color:${$};">
|
|
47
47
|
You're receiving this because you signed up for RuleMetric product updates. If you'd rather not hear about new releases, you can unsubscribe at any time.
|
|
48
48
|
</p>
|
|
49
49
|
<p style="margin:0 0 4px 0;font-size:12px;line-height:1.5;">
|
|
50
50
|
<a href="${l(a)}" style="color:${A};text-decoration:underline;">Unsubscribe</a>
|
|
51
51
|
</p>
|
|
52
|
-
<p style="margin:0 0 12px 0;font-size:12px;line-height:1.5;color:${
|
|
52
|
+
<p style="margin:0 0 12px 0;font-size:12px;line-height:1.5;color:${$};word-break:break-all;">
|
|
53
53
|
${l(a)}
|
|
54
54
|
</p>
|
|
55
|
-
<p style="margin:0;font-size:11px;line-height:1.5;color:${
|
|
56
|
-
RuleMetric \u2022 ${
|
|
55
|
+
<p style="margin:0;font-size:11px;line-height:1.5;color:${$};">
|
|
56
|
+
RuleMetric \u2022 ${p}
|
|
57
57
|
</p>
|
|
58
58
|
</td>
|
|
59
59
|
</tr>
|
|
@@ -62,5 +62,5 @@ ${E}
|
|
|
62
62
|
</tr>
|
|
63
63
|
</table>
|
|
64
64
|
</body>
|
|
65
|
-
</html>`,
|
|
66
|
-
`);return{subject:s,html:
|
|
65
|
+
</html>`,g=[`What's new in RuleMetric \u2014 ${c}`,`Release ${t}`,"",y,"","Here's what shipped in the latest RuleMetric release.",""];for(let{name:R,items:E}of i){g.push(`${R}:`);for(let w of E)g.push(` - ${w}`);g.push("")}g.push("--","You're receiving this because you signed up for RuleMetric product updates.",`Unsubscribe: ${a}`,"",`RuleMetric \u2022 ${p}`);let T=g.join(`
|
|
66
|
+
`);return{subject:s,html:k,text:T}}o(v,"renderChangelogAnnouncement");async function P(e){let t=e;for(let n=0;n<50;n++){try{return await m.stat(x.join(t,"pnpm-workspace.yaml")),t}catch{}let r=x.dirname(t);if(r===t)return null;t=r}return null}o(P,"findRepoRoot");async function L(e){if(e)try{return await m.readFile(e,"utf-8")}catch{return null}let t=await P(process.cwd())??process.cwd(),n=x.join(t,"CHANGELOG.md");try{return await m.readFile(n,"utf-8")}catch{return null}}o(L,"readChangelog");var B="https://rulemetric.com";function F(e){let t=e.date??new Date().toISOString().slice(0,10),n=v({version:e.version,date:t,sections:e.sections,unsubscribeUrl:"{{unsubscribe_url}}",recipientName:"{{recipient_name}}",productUrl:B});return{version:e.version,releaseDate:t,subject:n.subject,htmlBody:n.html,textBody:n.text,sections:e.sections}}o(F,"renderRow");async function Re(e={}){let t=e.db??M(),n=e.logger??{info:o(s=>console.log(s),"info"),warn:o(s=>console.warn(s),"warn")},r=await L(e.changelogPath);if(r===null)return n.info("[cron_check_changelog] CHANGELOG.md not found; nothing to do"),{createdCount:0,skippedCount:0};let a=_(r),d=S(a);if(d.length===0)return n.info("[cron_check_changelog] No announceable entries; nothing to do"),{createdCount:0,skippedCount:0};let u=0,c=0;for(let s of d){if((await t.select({id:f.id}).from(f).where(j(f.version,s.version)).limit(1)).length>0){c++;continue}let i=F(s);try{await t.insert(f).values({version:i.version,releaseDate:i.releaseDate,subject:i.subject,htmlBody:i.htmlBody,textBody:i.textBody,sections:i.sections,status:"draft"}),u++,n.info(`[cron_check_changelog] Created draft announcement for ${i.version}`)}catch(p){let b=p instanceof Error?p.message:String(p);if(/duplicate key|unique/i.test(b)){c++;continue}throw p}}return n.info(`[cron_check_changelog] Done: created ${u}, skipped ${c}`),{createdCount:u,skippedCount:c}}o(Re,"processChangelog");export{Re as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as E}from"./chunk-DQYYHX6K.js";import{a as I}from"./chunk-RBSEE2Z6.js";import{a as w}from"./chunk-M7QSC64D.js";import{c as v,e as h}from"./chunk-H6FVXVGG.js";import{b as R}from"./chunk-SWSOEYC7.js";import{e as m}from"./chunk-76UKAFNM.js";import{a as d}from"./chunk-ZLLER3HP.js";var T=6e5;async function P(e,$){let i=d(n=>$?.logger?.info?.(n)??console.log(n),"log"),{evalTargetId:r}=e,k=e.measurement?v(e):{},o=await m(`/api/eval-targets/${r}/judge-calibration`),l=!e.measurement||o.methodology?.measurement?.engine===e.measurement.engine&&o.methodology.measurement.model===e.measurement.model&&o.methodology.current===R(e.measurement.engine),a=I({powered:l&&o.powerCheck.powered,mde:l?o.powerCheck.mde??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY},(l?o.caseDiscrimination:void 0)??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},{runsCompleted:0,maxRuns:e.maxRuns??24,batchesRun:0,maxBatches:1});if(a.action==="stop")return i(`[cron_eval_autorun] ${r}: ${a.reason}`),{skipped:a.code,reason:a.reason};let t=await m(`/api/eval-targets/${r}`);if(t.metadata?.autoRunEnabled===!1)return{skipped:"paused",reason:"Nightly measurement is off for this target."};let c=w(t);if(c)return i(`[cron_eval_autorun] ${r}: ${c.reason}`),c;let p=(await m(`/api/eval-targets/${r}/evals`)).filter(n=>!n.retiredAt);if(p.length===0)return{skipped:"no-live-cases"};let{completed:f,failed:b,results:N}=await h({cases:E(p,e.maxRuns??12),targetContent:t.content,concurrency:2,runNumber:Math.floor(Date.now()/1e3),opts:{targetId:r,targetVersion:t.version??1,iteration:1,timeout:e.timeout??T,model:e.model,graderModel:e.graderModel,graderEngine:e.graderEngine,...k,skipGrading:!1,targetType:t.type,targetName:t.name},onLog:i}),g={};for(let n of N){if(n.status!=="failed")continue;let s=n.failure?.kind??"unknown";g[s]=(g[s]??0)+1}let u=Object.entries(g).sort(([,n],[,s])=>s-n).map(([n,s])=>`${n}x${s}`).join(", ");return i(`[cron_eval_autorun] ${t.name}: ${f} completed, ${b} failed`+(u===""?"":` (${u})`)),{ranRuns:f,failedRuns:b,...u===""?{}:{failures:u},reason:a.reason}}d(P,"cronEvalAutorun");export{P as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a}from"./chunk-ZLLER3HP.js";function p(s){return/\d+\.\d+/.test(s)}a(p,"versionProbeSucceeded");function c(s){let e=null;for(let r of s.split(`
|
|
2
|
+
`)){let t=r.trim();if(!t)continue;let o;try{o=JSON.parse(t)}catch{continue}let n=o;n.type==="assistant.message"&&typeof n.data?.content=="string"&&(e=n.data.content)}return e}a(c,"parseCopilotReply");function g(s){let e=null;for(let n of s.split(`
|
|
3
|
+
`)){let i=n.trim();if(!i)continue;let u;try{u=JSON.parse(i)}catch{continue}let l=u;l.type==="agent_end"&&(e=l)}if(!e)return{ok:!1,reason:"pi exited without an agent_end event in its JSON stream"};let r=(e.messages??[]).filter(n=>n.role==="assistant"),t=r[r.length-1];if(!t)return{ok:!1,reason:"pi agent_end carried no assistant message"};if(t.stopReason==="error")return{ok:!1,reason:`pi provider error: ${String(t.errorMessage??"unknown").slice(0,300)}`};let o=(Array.isArray(t.content)?t.content:[]).map(n=>n&&typeof n=="object"&&n.type==="text"?String(n.text??""):"").join("");return o.trim()?{ok:!0,text:o}:{ok:!1,reason:`pi assistant message held no text (stopReason ${String(t.stopReason)})`}}a(g,"parsePiReply");export{p as a,c as b,g as c};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as A}from"./chunk-5RBLIVBF.js";import{a as I,d as M}from"./chunk-3UKZJAFS.js";import{c as W}from"./chunk-XJ25HFIT.js";import{a as T,b as k,c as U,d as O}from"./chunk-SJKS3PYX.js";import{a as B}from"./chunk-YK2IEHLB.js";import{b as x,e as H,g as R}from"./chunk-N4YPDZJF.js";import{e as _,f as L,h as d}from"./chunk-76UKAFNM.js";import{a as F,b as J}from"./chunk-42A4PUW7.js";import{a as f}from"./chunk-ZLLER3HP.js";var V=f((l,{limit:i,sort:n,eventTypes:s})=>_(`/api/sessions/${l}/events?limit=${i}&sort=${n}&eventType=${encodeURIComponent(s.join(","))}&hasContent=true`),"fetchTranscriptTurns");async function is(l,i){let{mirrorId:n,projectPath:s,projectId:r,config:g}=l,t=f(e=>i.logger.info(e),"log");if(g?.sessionId)return Y({mirrorId:n,sessionId:g.sessionId},t);t(`Processing insights job ${n}...`),await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"reading_data"}});try{let{repaired:e}=await L("/api/sessions/repair-analyzed-at",{});e>0&&t(` Repaired analyzed_at on ${e} orphan session(s).`)}catch(e){t(` Warning: analyzed_at repair failed: ${e instanceof Error?e.message:String(e)}`)}let p=20,w=200,D=15*6e4,N=3,E=Date.now()+D,C=H()==="none"?"no-llm-backend":null;if(C&&i.logger.warn?.("[process-insights] no LLM backend (no claude/codex CLI and no ANTHROPIC_API_KEY) \u2014 facet grading SKIPPED for this run; the summary below is computed from already-graded sessions only"),!C){let e=0,o=0;try{for(;e<w&&Date.now()<E;){let c=await _(`/api/sessions?needsFacets=true&graderVersion=${2}&limit=${p}&offset=${o}`);if(c.length===0)break;t(` Generating facets for ${c.length} un-analyzed sessions (drained ${e} so far)...`);for(let $=0;$<c.length&&!(e>=w||Date.now()>=E);$+=N){let S=c.slice($,$+N);await Promise.all(S.map(async m=>{if(!(e>=w||Date.now()>=E))try{let u=await M(K=>V(m.id,K));if(u.turnCount<2){e++,o++;return}let j=await R(O,u.text,4096);j&&typeof j.outcome=="string"?(await d(`/api/sessions/${m.id}/enrich`,{analysis:{source:"generated_facets",...j,graderVersion:2},...m.eventCount!=null?{analyzedEventCount:m.eventCount}:{},analyzedTurnCount:u.turnCount}),t(` Generated facets for session ${m.id} (${m.tool}, ${u.turnCount} turns)`)):o++,e++}catch(u){t(` Failed to generate facets for session ${m.id}: ${u instanceof Error?u.message:String(u)}`),e++,o++}}))}if(c.length<p)break}}catch(c){t(` Warning: facet generation failed after ${e} sessions: ${c instanceof Error?c.message:String(c)}`)}if(e>0){let c=Date.now()>=E?`time budget (${Math.round(D/6e4)}m)`:e>=w?`hard cap (${w})`:"queue empty";t(` Facet drain stopped on ${c} after ${e} session(s); the rest resume next run.`)}}let b=await Q(s,r);if(!b)throw new A("No session data found \u2014 ensure sessions are captured and enriched.");t(` Found ${b.stats.sessions} sessions, generating recommendations...`);let P=await Z(s,t);P&&t(` Generator memory: ${P.split(`
|
|
2
|
+
`).length} lines of prior-advice context`);let a={},y=[],h=k.length+1;for(let e=0;e<k.length;e++){let o=k[e];t(` [${e+1}/${h}] Generating ${o.name}...`);try{await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:o.name,current:e+1,total:h,partial:{...a}}})}catch(u){t(` Warning: progress update failed for ${o.name}: ${u instanceof Error?u.message:String(u)}`)}t(` Running LLM prompt for ${o.name}...`);let c=o.usesGeneratorMemory&&P?`${b.summary}
|
|
3
|
+
${P}`:b.summary,$=Date.now(),S=await R(o.prompt,c,o.maxTokens,{timeoutMs:o.timeoutMs}),m=Date.now()-$;S?(a[o.name]=S,t(` Got result for ${o.name} (${Math.round(m/1e3)}s)`)):(y.push(o.name),t(` No result for ${o.name} after ${Math.round(m/1e3)}s (budget ${Math.round((o.timeoutMs??12e4)/1e3)}s) \u2014 section DROPPED`))}t(` [${h}/${h}] Generating at_a_glance...`),await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"at_a_glance",current:h,total:h,partial:{...a}}});let q=[b.summary,a.what_works?`
|
|
4
|
+
## What Works
|
|
5
|
+
${JSON.stringify(a.what_works)}`:"",a.friction_analysis?`
|
|
6
|
+
## Friction
|
|
7
|
+
${JSON.stringify(a.friction_analysis)}`:"",a.suggestions?`
|
|
8
|
+
## Suggestions
|
|
9
|
+
${JSON.stringify(a.suggestions)}`:"",a.on_the_horizon?`
|
|
10
|
+
## On the Horizon
|
|
11
|
+
${JSON.stringify(a.on_the_horizon)}`:""].join(`
|
|
12
|
+
`),G=await R(U,q,8192);G&&(a.at_a_glance=G),t(" Uploading results..."),t(` Done! Recommendations generated for job ${n}`),J(a),F(a);let z={recommendations:a,...y.length>0?{sectionsFailed:y}:{},...C?{facetsSkipped:C}:{}};return y.length>0&&t(` \u26A0 ${y.length} section(s) produced nothing: ${y.join(", ")}`),await d(`/api/insights-jobs/${n}/state`,{result:z}).catch(e=>{t(`result persist failed: ${e instanceof Error?e.message:String(e)}`)}),await B(a,s,t),z}f(is,"processInsights");async function Y(l,i){let{mirrorId:n,sessionId:s}=l;i(`Analyzing session ${s} via tool CLI...`),await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"fetching_session"}});let r=await _(`/api/sessions/${s}`);if(r.analysis&&r.analysis.source==="session_analysis")return i(` Session ${s} already analyzed \u2014 skipping (idempotency guard)`),{sessionId:s,skipped:!0,reason:"already_analyzed"};let g=await M(p=>V(s,p));if(g.turnCount<2)throw new A("Session has too few conversation turns to analyze");await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"running_analysis",tool:r.tool}});let t=await x(r.tool,O,g.text);if(!t.ok)throw new Error(`Analysis failed \u2014 ${t.reason}`);return await d(`/api/sessions/${s}/enrich`,{analysis:{source:"session_analysis",tool:r.tool,...t.value,graderVersion:2},...r.eventCount!=null?{analyzedEventCount:r.eventCount}:{},analyzedTurnCount:g.turnCount}),i(` Session ${s} analyzed via ${r.tool}`),{sessionId:s,tool:r.tool,facets:t.value}}f(Y,"processSessionAnalysisInline");async function Z(l,i,n=_,s=W){let{asks:r,omitted:g}=s(l);try{let t=await n(`/api/insights/recommendations/history?projectPath=${encodeURIComponent(l??"")}`);return!t||!Array.isArray(t.dismissed)||!Array.isArray(t.repeated)?T({dismissed:[],repeated:[],installed:r,installedOmitted:g}):T({...t,installed:r,installedOmitted:g})}catch(t){return i(` Warning: generator memory unavailable (${t instanceof Error?t.message:String(t)}) \u2014 generating without it`),T({dismissed:[],repeated:[],installed:r,installedOmitted:g})}}f(Z,"fetchGeneratorMemory");async function Q(l,i){try{let n=new URLSearchParams;i?n.set("projectId",i):l&&n.set("projectPath",l);let s=await _(`/api/insights/compute?${n}`);if(!s||s.total_sessions===0)return null;let r=Object.entries(s.tool_counts??{}).sort((t,p)=>p[1]-t[1]).slice(0,10).map(([t,p])=>`${t}: ${p}`).join(", ");return{summary:[`Sessions: ${s.total_sessions}, Messages: ${s.total_messages}, Session-hours: ${Math.round(s.total_duration_hours)} (sum of per-session spans across ${s.sessions_with_meta} measured sessions; concurrent sessions counted separately, so this exceeds elapsed time)`,`Top tools: ${r}`,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(`
|
|
13
|
+
`),stats:{sessions:s.total_sessions,totalMessages:s.total_messages,totalSessionHours:s.total_duration_hours,measuredSessions:s.sessions_with_meta,toolCounts:s.tool_counts,goalCounts:s.goal_categories,frictionCounts:s.friction}}}catch(n){throw new v(n instanceof Error?n.message:String(n))}}f(Q,"buildDataSummaryFromApi");var v=class extends Error{static{f(this,"InsightsSummaryUnavailableError")}constructor(i){super(`Could not read session summary (retryable): ${i}`),this.name="InsightsSummaryUnavailableError"}};export{is as a,Z as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-ZLLER3HP.js";function g(n,e=12,l=new Date){if(!Number.isFinite(e)||e<2)return[];let h=Math.min(6,Math.floor(e/2),n.length),t=[...n].sort((o,r)=>o.id.localeCompare(r.id));if(!t.length)return[];let a=Math.floor(l.getTime()/864e5)%t.length;return Array.from({length:h},(o,r)=>t[(a+r)%t.length])}i(g,"selectNightlyCases");export{g as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as w,b as S}from"./chunk-CDY7TQFZ.js";import{f as A}from"./chunk-
|
|
1
|
+
import{a as w,b as S}from"./chunk-CDY7TQFZ.js";import{f as A}from"./chunk-FBSZ6KCM.js";import{d as G}from"./chunk-SG4UDDHB.js";import{a as p}from"./chunk-ZLLER3HP.js";var j=`You are a rigorous eval grader. Your job is to evaluate whether an AI assistant's output meets a set of expectations.
|
|
2
2
|
|
|
3
3
|
You will receive:
|
|
4
4
|
1. The original prompt that was given to the AI
|
|
@@ -45,17 +45,17 @@ You MUST respond with ONLY a valid JSON object matching this exact structure (no
|
|
|
45
45
|
"suggestions": [{ "assertion": "suggested new assertion", "reason": "why it matters" }],
|
|
46
46
|
"overall": "brief summary assessment"
|
|
47
47
|
}
|
|
48
|
-
}`;async function q(E){let{prompt:O,output:
|
|
48
|
+
}`;async function q(E){let{prompt:O,output:h,expectations:v,model:d,timeout:x=12e4,engine:g="claude"}=E,n=new Array(v.length),o=[];v.forEach((r,e)=>{let t=w(r);if(t){let i=S(t,h);n[e]={text:r,passed:i.passed,evidence:i.evidence,method:"deterministic",...i.errored?{errored:!0}:{}}}else o.push({text:r,index:e})});let m=null,f=p((r,e)=>{let t=n.filter(s=>!s.errored),i=n.length-t.length,l=t.filter(s=>s.passed).length,a=t.length;return{expectations:n,summary:{passed:l,failed:a-l,total:a,pass_rate:a>0?l/a:null,...i>0?{errored:i}:{}},claims:r,eval_feedback:e,judge_model:m,judge_engine:o.length>0?g:null,judge_model_requested:d??null}},"finish"),y=p((r,e)=>{for(let t of o)n[t.index]={text:t.text,passed:!1,evidence:r,method:"llm",errored:!0};return f([],{suggestions:[],overall:e})},"errorSubjective");if(o.length===0)return f([],{suggestions:[],overall:"All expectations verified deterministically \u2014 LLM judge skipped."});let b=`## Original Prompt
|
|
49
49
|
|
|
50
50
|
${O}
|
|
51
51
|
|
|
52
52
|
## AI Output
|
|
53
53
|
|
|
54
|
-
${
|
|
54
|
+
${h}
|
|
55
55
|
|
|
56
56
|
## Expectations to Evaluate
|
|
57
57
|
|
|
58
|
-
${
|
|
58
|
+
${o.map((r,e)=>`${e+1}. ${r.text}`).join(`
|
|
59
59
|
`)}
|
|
60
60
|
|
|
61
|
-
Grade the output against each expectation. Respond with ONLY valid JSON.`;if(
|
|
61
|
+
Grade the output against each expectation. Respond with ONLY valid JSON.`;if(g==="codex"&&!d)return y("Grader error: the codex engine requires an explicit --model","Grading failed: codex engine requires an explicit model");let k=2,u={evidence:"Grader error: judge did not run",overall:"Grading failed"};for(let r=1;r<=k;r++){let e;if(g==="codex"?e=await G({prompt:b,systemPrompt:j,model:d,timeout:x}):e=await A({engine:"claude",prompt:b,targetContent:j,timeout:x,model:d}),m=e.model??m,e.error){u={evidence:`Grader error: ${e.error}`,overall:`Grading failed: ${e.error}`};continue}try{let t=e.output.trim(),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1].trim());let l=t.match(/\{[\s\S]*\}/);l&&(t=l[0]);let a=JSON.parse(t);return o.forEach((s,R)=>{let c=a.expectations?.[R],_=c?.flag==="non_discriminating"||c?.flag==="unverifiable"?c.flag:void 0;n[s.index]=c?{text:s.text,passed:c.passed,evidence:c.evidence??"",method:"llm",..._?{flag:_}:{}}:{text:s.text,passed:!1,evidence:"Judge did not return a grade for this expectation",method:"llm",errored:!0}}),f(a.claims??[],a.eval_feedback??{suggestions:[],overall:""})}catch{u={evidence:"Grader output was not valid JSON",overall:`Grader returned unparseable output: ${e.output.slice(0,200)}`}}}return y(u.evidence,u.overall)}p(q,"gradeEvalOutput");export{q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./chunk-ZLLER3HP.js";var N=25;function $(e,s,r=1.959964){let n=1+r*r/s,c=(e+r*r/(2*s))/n,d=r*Math.sqrt(e*(1-e)/s+r*r/(4*s*s))/n;return[c-d,c+d]}l($,"wilson");function x(e,s,r,n){let[c,d]=$(e,s),[m,i]=$(r,n);return[m-d,i-c]}l(x,"newcombe");var w=l(e=>`${e>=0?"+":""}${e.toFixed(3)}`,"fmt"),f=l(e=>`${e.passes}/${e.n}`,"counts");function _(e){let s=e.provenance;if(s&&!s.comparable)return{decision:"incomparable",reason:`the two arms were not the same harness, so this is not an A/B of the rule: ${s.reasons.join("; ")}. Nothing here is evidence about the instruction \u2014 re-run both arms on one harness before reading anything into the numbers.`,reward:{delta:null,ci:null}};let r=v(e);return s?.pooled_across.length?{...r,reason:`${r.reason} [pooled across ${s.pooled_across.join(", ")} by explicit --allow-cross]`}:r}l(_,"judgeSweep");function v(e){let s=e.minN??25,{baseline:r,with:n}=e;if(r.passes==null||n.passes==null||r.n===0||n.n===0)return{decision:"unmeasured",reason:`no reward recorded for the ${[r.passes==null||r.n===0?"baseline":null,n.passes==null||n.n===0?"with-arm":null].filter(Boolean).join(" and ")} arm \u2014 nothing to decide on; check the job dir for a harness error before reading this as a result`,reward:{delta:null,ci:null}};let c=r.passes/r.n,d=n.passes/n.n,m=d-c,i=x(c,r.n,d,n.n),b=i[0]>0||i[1]<0,u=r.n<s||n.n<s,a=`baseline ${f(r)} \u2192 with ${f(n)}, delta ${w(m)}, 95% CI [${w(i[0])}, ${w(i[1])}]`,t={delta:m,ci:i},h=u?` (n=${r.n}/${n.n}, below the ${s}/arm floor)`:"";if(e.taskClass==="unvalidated")return{decision:u?"undecided":"measured",reason:`calibration on an unvalidated engine/model${h}: ${a}. No regression or graduation claim against another model's catalogue.`,reward:t};if(e.taskClass==="proven"&&e.axis==="reward")return i[0]>0?{decision:"holds",reason:`still discriminates: ${a}`,reward:t}:u?{decision:"undecided",reason:`interval does not exclude zero${h}: ${a}`,reward:t}:{decision:"regression",reason:`a PROVEN discriminator went flat: ${a}. At this depth a flat result is a real change \u2014 the rule, the model, or the harness (the last observed cause was a harness permission change nobody thought was under test). Do not pool this run with earlier ones.`,reward:t};if(e.taskClass==="proven"&&e.axis==="cost"){let o=e.cost;if(!o)return{decision:"unmeasured",reason:`no per-trial cost measured \u2014 a cost task with no cost telemetry is UNKNOWN, not $0 (${a})`,reward:t};let p=`cost ${o.delta_pct==null?"n/a":`${o.delta_pct>=0?"+":""}${o.delta_pct.toFixed(1)}%`}/trial, 95% CI [${o.ci_usd[0].toFixed(4)}, ${o.ci_usd[1].toFixed(4)}] USD`;return o.decision==="cheaper"&&!o.reward.regressed?{decision:"holds",reason:`still cheaper at equal reward: ${p}; reward ${a}`,reward:t}:o.decision==="undecided"&&u?{decision:"undecided",reason:`cost interval spans zero${h}: ${p}`,reward:t}:o.reward.regressed?{decision:"regression",reason:`the with-arm solved LESS (${a}) \u2014 a cheaper arm that solves less is not a saving; ${p}`,reward:t}:{decision:"regression",reason:`a PROVEN cost saving did not reproduce: ${p} (decision ${o.decision}); reward ${a}`,reward:t}}let g=e.cost?.decision==="cheaper"&&!e.cost.reward.regressed;return b||g?{decision:"now_discriminates",reason:`a task measured as a NEGATIVE started discriminating \u2014 ${b?`reward now discriminates: ${a}`:`cost now discriminates at equal reward: ${e.cost.delta_pct?.toFixed(1)}%/trial`}. Re-measure by hand before moving it to the proven set; the 08-31 scorecard was wrong once already.`,reward:t}:u?{decision:"undecided",reason:`flat, but${h}: ${a}`,reward:t}:{decision:"flat",reason:`still flat, as measured: ${a}`,reward:t}}l(v,"judgeMeasured");export{N as a,$ as b,x as c,_ as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g,c as m}from"./chunk-N7ODX6PO.js";import{e as s,h as c}from"./chunk-
|
|
1
|
+
import{b as g,c as m}from"./chunk-N7ODX6PO.js";import{e as s,h as c}from"./chunk-76UKAFNM.js";import{a as i}from"./chunk-ZLLER3HP.js";var u=6e4;function o(t,e){try{t(JSON.stringify({ts:new Date().toISOString(),...e}))}catch{t(`[tt-heartbeat] log_error event=${e.event}`)}}i(o,"structuredLog");function d(t,e){return e.aborted?Promise.resolve(!1):t<=0?Promise.resolve(!0):new Promise(r=>{let a=setTimeout(()=>{e.removeEventListener("abort",n),r(!0)},t),n=i(()=>{clearTimeout(a),e.removeEventListener("abort",n),r(!1)},"onAbort");e.addEventListener("abort",n,{once:!0})})}i(d,"abortableSleep");async function l(t,e){if(t.kind!=="tmux")return;let a=(await g(m(t.target))).code===0?"active":"missing";try{await c(`/api/terminal-targets/${t.id}/status`,{status:a,lastSeenAt:new Date().toISOString()}),o(e,{event:"tt_heartbeat",targetId:t.id,target:t.target,status:a})}catch(n){o(e,{event:"tt_heartbeat_error",targetId:t.id,target:t.target,error:n instanceof Error?n.message:String(n)})}}i(l,"probeAndReport");async function b(t){let e;try{e=await s("/api/terminal-targets?status=active")}catch(r){o(t,{event:"tt_heartbeat_list_error",error:r instanceof Error?r.message:String(r)});return}for(let r of e.targets??[])try{await l(r,t)}catch(a){o(t,{event:"tt_heartbeat_probe_error",targetId:r.id,error:a instanceof Error?a.message:String(a)})}}i(b,"runOneHeartbeatCycle");async function p(t){let e=t.log??(()=>{}),r=t.intervalMs??u;for(o(e,{event:"tt_heartbeat_start",intervalMs:r});!t.signal.aborted&&(await b(e),!!await d(r,t.signal)););o(e,{event:"tt_heartbeat_stop"})}i(p,"startTerminalTargetHeartbeat");export{l as a,b,p as c};
|