@iowarp/clio-coder 0.4.6 → 0.4.8
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/.claude-plugin/marketplace.json +283 -0
- package/CHANGELOG.md +79 -0
- package/CONTRIBUTING.md +178 -96
- package/NOTICE +8 -0
- package/README.md +100 -47
- package/dist/acp-JWPQZM2D.js +130 -0
- package/dist/agents-4GCDIRVX.js +149 -0
- package/dist/assets/codewiki.json +1 -1
- package/dist/assets/tui-notices/get-east-asian-width-LICENSE +9 -0
- package/dist/assets/tui-notices/marked-LICENSE +44 -0
- package/dist/assets/tui-notices/pi-tui-LICENSE +21 -0
- package/dist/assets/web-notices/@hono__node-server-LICENSE +21 -0
- package/dist/assets/web-notices/hono-LICENSE +21 -0
- package/dist/auth-SYAKTDQE.js +551 -0
- package/dist/background-OW67WMYR.js +37 -0
- package/dist/builtins-TKS63VNV.js +22 -0
- package/dist/chunk-2JSCCEKO.js +85 -0
- package/dist/chunk-2SXGG2IV.js +391 -0
- package/dist/chunk-2U2U5POA.js +59 -0
- package/dist/chunk-2ZWLMA3T.js +658 -0
- package/dist/chunk-36XSBPXL.js +579 -0
- package/dist/chunk-3IQOZRQ6.js +396 -0
- package/dist/chunk-3XE4NRLF.js +324 -0
- package/dist/chunk-44U2OUSM.js +243 -0
- package/dist/chunk-4P6M2TTE.js +119 -0
- package/dist/chunk-526ABLHD.js +1219 -0
- package/dist/chunk-5C2OQHLR.js +674 -0
- package/dist/chunk-5D2FNBMG.js +185 -0
- package/dist/chunk-5EQO5NWP.js +243 -0
- package/dist/chunk-5HULHKT2.js +32 -0
- package/dist/chunk-5UG6EZI3.js +66 -0
- package/dist/chunk-5W4FRA5Q.js +22283 -0
- package/dist/chunk-6R5MBXBJ.js +386 -0
- package/dist/chunk-6TKOFFGE.js +1058 -0
- package/dist/chunk-6UJ7RDI7.js +1143 -0
- package/dist/chunk-6X7VOCDY.js +44 -0
- package/dist/chunk-7QQRPB2E.js +915 -0
- package/dist/chunk-ARRUMZ7X.js +1377 -0
- package/dist/chunk-ATB3Q7YO.js +663 -0
- package/dist/chunk-AUHVBIDW.js +19 -0
- package/dist/chunk-BE4I3UJ2.js +668 -0
- package/dist/chunk-BFPHMSK7.js +169 -0
- package/dist/chunk-BHJMMCXS.js +466 -0
- package/dist/chunk-BIY22UUK.js +1322 -0
- package/dist/chunk-D55WO5J7.js +110 -0
- package/dist/chunk-DVJL77SO.js +162 -0
- package/dist/chunk-E2NSPYLC.js +814 -0
- package/dist/chunk-EFXMQYI6.js +4484 -0
- package/dist/chunk-EPYATQMG.js +2718 -0
- package/dist/chunk-EXKUF426.js +1801 -0
- package/dist/chunk-F7Y6QTPL.js +689 -0
- package/dist/chunk-FB3KTE2J.js +1710 -0
- package/dist/chunk-FNVPQQYT.js +117 -0
- package/dist/chunk-GEVQNST4.js +101 -0
- package/dist/chunk-GEYX2NZ5.js +697 -0
- package/dist/chunk-GJBJHJNY.js +2120 -0
- package/dist/chunk-GM4TY6VN.js +1233 -0
- package/dist/chunk-GVU4CXPJ.js +5191 -0
- package/dist/chunk-H5DPSUBB.js +637 -0
- package/dist/chunk-H77XBUBM.js +688 -0
- package/dist/chunk-HMGAKB7E.js +380 -0
- package/dist/chunk-HP7KJ5O2.js +797 -0
- package/dist/chunk-HVCAY2FH.js +67 -0
- package/dist/chunk-ICYIUNO4.js +35 -0
- package/dist/chunk-IILXVWJY.js +223 -0
- package/dist/chunk-JCVIL6TY.js +595 -0
- package/dist/chunk-JIMWEYWO.js +63 -0
- package/dist/chunk-JLBVCROW.js +562 -0
- package/dist/chunk-JOBN2YQQ.js +176 -0
- package/dist/chunk-JOL2QRLE.js +152 -0
- package/dist/chunk-JRA6OBHY.js +974 -0
- package/dist/chunk-JV25I7ID.js +1865 -0
- package/dist/chunk-JYKUMHCQ.js +705 -0
- package/dist/chunk-K3W6BF5C.js +283 -0
- package/dist/chunk-K45LHSCI.js +194 -0
- package/dist/chunk-K53E2PTW.js +1289 -0
- package/dist/chunk-K5UJD6MM.js +39 -0
- package/dist/chunk-KGP3UQGJ.js +200 -0
- package/dist/chunk-KKRXONXG.js +43 -0
- package/dist/chunk-KWJXCL2X.js +103 -0
- package/dist/chunk-L75H5B3B.js +446 -0
- package/dist/chunk-LLCGGVSW.js +108 -0
- package/dist/chunk-LZCCBLRC.js +57 -0
- package/dist/chunk-LZDLYSUN.js +197 -0
- package/dist/chunk-MATCRH3M.js +667 -0
- package/dist/chunk-MEHBW2SP.js +132 -0
- package/dist/chunk-MUXNDNMZ.js +659 -0
- package/dist/chunk-MWMW53WW.js +7346 -0
- package/dist/chunk-MZDPF35R.js +45 -0
- package/dist/chunk-MZKYVIWW.js +188 -0
- package/dist/chunk-O2QJDRWP.js +362 -0
- package/dist/chunk-O3HSB2YL.js +693 -0
- package/dist/chunk-OEMFEL26.js +891 -0
- package/dist/chunk-OH3YYA3B.js +15 -0
- package/dist/chunk-OPC4DQD6.js +634 -0
- package/dist/chunk-ORRNGQDV.js +207 -0
- package/dist/chunk-P4JS3MH5.js +165 -0
- package/dist/chunk-P7GTE4FX.js +308 -0
- package/dist/chunk-PAQVETLA.js +962 -0
- package/dist/chunk-PFZJMXIY.js +146 -0
- package/dist/chunk-PGEFOTJB.js +1974 -0
- package/dist/chunk-PJ5H5B7A.js +3151 -0
- package/dist/chunk-PMUUAABD.js +604 -0
- package/dist/chunk-Q32C6AWI.js +236 -0
- package/dist/chunk-QGIC5SX5.js +139 -0
- package/dist/chunk-QLAGXTTV.js +482 -0
- package/dist/chunk-QLKCCC2J.js +573 -0
- package/dist/chunk-QWUSS2QP.js +3630 -0
- package/dist/chunk-QYSAZMSH.js +47 -0
- package/dist/chunk-R5NRX5N4.js +123 -0
- package/dist/chunk-RAUOKUZV.js +1572 -0
- package/dist/chunk-RBES4TCZ.js +302 -0
- package/dist/chunk-RFCKPS2V.js +26 -0
- package/dist/chunk-RFULVPBX.js +318 -0
- package/dist/chunk-RKFNU5UA.js +404 -0
- package/dist/chunk-RM3XJX7P.js +1148 -0
- package/dist/chunk-RNLAPBJL.js +386 -0
- package/dist/chunk-RPMNIFRY.js +65 -0
- package/dist/chunk-RRZFRIJP.js +42 -0
- package/dist/chunk-RXI7K4J5.js +4493 -0
- package/dist/chunk-SER7RRAE.js +4271 -0
- package/dist/chunk-STC6CWUZ.js +402 -0
- package/dist/chunk-TEHVMHOK.js +97 -0
- package/dist/chunk-TOPICHGR.js +33 -0
- package/dist/chunk-U3TPUXOQ.js +2653 -0
- package/dist/chunk-UB33F3YW.js +709 -0
- package/dist/chunk-UDAK6GR2.js +175 -0
- package/dist/chunk-USBBEKHW.js +177 -0
- package/dist/chunk-V4ZKOKRB.js +13433 -0
- package/dist/chunk-W5RM7YAH.js +78 -0
- package/dist/chunk-W7KNI3F5.js +215 -0
- package/dist/chunk-WFTSK7N3.js +637 -0
- package/dist/chunk-WJWNZXRM.js +395 -0
- package/dist/chunk-WLHX3MM5.js +63 -0
- package/dist/chunk-WS4FOGLY.js +686 -0
- package/dist/chunk-WTZVSMQZ.js +52 -0
- package/dist/chunk-WWRV5RJI.js +165 -0
- package/dist/chunk-X6FLVUM5.js +141 -0
- package/dist/chunk-XC5POIL4.js +68 -0
- package/dist/chunk-XTLJDC2X.js +1013 -0
- package/dist/chunk-XW2UZICE.js +372 -0
- package/dist/chunk-Y3JU5RPK.js +8 -0
- package/dist/chunk-YGIV24MF.js +1018 -0
- package/dist/chunk-YJCCMYYT.js +125 -0
- package/dist/chunk-YKIIWURD.js +36 -0
- package/dist/chunk-YQ3GFEUY.js +341 -0
- package/dist/chunk-YXANQGCX.js +179 -0
- package/dist/chunk-YXFKLMX2.js +222 -0
- package/dist/chunk-ZST3FRCV.js +132 -0
- package/dist/cli/index.js +40 -40
- package/dist/clio-BPBAPZGA.js +26 -0
- package/dist/code-nav-KBQ3RIFK.js +686 -0
- package/dist/components-6DKAXWFN.js +674 -0
- package/dist/config-FWL5JK2H.js +270 -0
- package/dist/config-graph-ACDB26L2.js +156 -0
- package/dist/configure-ZIZ4YV62.js +85 -0
- package/dist/context-EZZPT2ZV.js +1074 -0
- package/dist/context-VIL5MFRH.js +282 -0
- package/dist/context-Z3GOBHDK.js +344 -0
- package/dist/context-clear-ZPB3L7MN.js +188 -0
- package/dist/context-index-W6A4V7OC.js +120 -0
- package/dist/context-map-DKL3QT6D.js +555 -0
- package/dist/context-working-set-2GLBVF7L.js +1559 -0
- package/dist/detail-VSBWYSGZ.js +119 -0
- package/dist/dispatch-runner-EEEHGKX4.js +2442 -0
- package/dist/docs-VMMWFVHL.js +101 -0
- package/dist/doctor-V5L4IQGP.js +812 -0
- package/dist/eval-VJYJ2BV3.js +5050 -0
- package/dist/eval-inventory-CX24K2JT.js +260 -0
- package/dist/evals-J2H5V6DD.js +104 -0
- package/dist/evidence-POWAEBEW.js +229 -0
- package/dist/evidence-XCCCLS36.js +242 -0
- package/dist/evidence-Y35YSXH6.js +388 -0
- package/dist/evolve-GPG72VB6.js +613 -0
- package/dist/extensions-YIZ7W3DA.js +308 -0
- package/dist/fleet-2MDCQ2VK.js +264 -0
- package/dist/fleet-W2AF3TOJ.js +919 -0
- package/dist/fleet-commands-WS56G26H.js +75 -0
- package/dist/fleet-decisions-MYGZ3JW7.js +52 -0
- package/dist/fleet-graph-ELTBXBAV.js +136 -0
- package/dist/fleet-inspect-45IK73L4.js +308 -0
- package/dist/fleet-preflight-T5NCZKHE.js +22 -0
- package/dist/fleet-validate-VG4JBLA4.js +91 -0
- package/dist/fleet-verify-VTSABAYO.js +206 -0
- package/dist/fleet-view-XC7WMKSS.js +123 -0
- package/dist/init-VTJNNTIP.js +329 -0
- package/dist/install-6PIF6F6W.js +19 -0
- package/dist/interop-IU6BNA7C.js +246 -0
- package/dist/inventory-QPQUTUUZ.js +123 -0
- package/dist/library-HUTAS57T.js +492 -0
- package/dist/library-LF7DLU6S.js +306 -0
- package/dist/library-Q3NWL5CM.js +75 -0
- package/dist/library-import-PPW4YUC5.js +183 -0
- package/dist/library-inventory-DIRVFRZU.js +56 -0
- package/dist/library-validation-XHUZ3INE.js +42 -0
- package/dist/memory-Z2LSKNV6.js +516 -0
- package/dist/models-3FTREYPY.js +302 -0
- package/dist/monitor-HF2MQRB3.js +781 -0
- package/dist/orchestrator-UYPA6W4S.js +41502 -0
- package/dist/panes-736XB73K.js +74 -0
- package/dist/panes-C4P3PIWT.js +103 -0
- package/dist/paths-JQ4QYIYB.js +67 -0
- package/dist/preload-XSLRYH3Y.js +120 -0
- package/dist/reset-V7QSPZYE.js +345 -0
- package/dist/resources-OJGDFHYT.js +181 -0
- package/dist/run-T354SMDW.js +892 -0
- package/dist/settings-MWZXO6RV.js +72 -0
- package/dist/share-Y5ZKJPND.js +293 -0
- package/dist/skills-4GLZC4LN.js +100 -0
- package/dist/skills-eval-L5T7GODM.js +1074 -0
- package/dist/skills-inventory-LASKXEZI.js +138 -0
- package/dist/slash-commands-OIMRU36D.js +95 -0
- package/dist/steer-KMAM2Y2C.js +77 -0
- package/dist/support-AWC3XKPX.js +38 -0
- package/dist/system-CD75NYBU.js +116 -0
- package/dist/targets-VSZX2J2S.js +1116 -0
- package/dist/tasks-AN567LYH.js +36 -0
- package/dist/terminal-lease-6KTWNHVY.js +418 -0
- package/dist/tools-AGRK3V5J.js +28 -0
- package/dist/trace-P4MQZD33.js +524 -0
- package/dist/tui-primitives-A6MUW32V.js +18 -0
- package/dist/uninstall-BRUTEPIC.js +432 -0
- package/dist/upgrade-SBCGHQGJ.js +307 -0
- package/dist/usage-BIDVTO6V.js +1061 -0
- package/dist/verifiers-LTGCAMXS.js +630 -0
- package/dist/verify-OZU4LLNP.js +30 -0
- package/dist/web/client/THIRD_PARTY_LICENSES.md +1809 -0
- package/dist/web/client/assets/abnfDiagram-VCTEODGH-C5wfoHm3.js +1 -0
- package/dist/web/client/assets/arc-oH91sfLl.js +1 -0
- package/dist/web/client/assets/architecture-7GRP2DOG-EGozsYEO.js +1 -0
- package/dist/web/client/assets/architectureDiagram-5GKGNRK7-z9FokbJl.js +36 -0
- package/dist/web/client/assets/array-BifhSqXX.js +1 -0
- package/dist/web/client/assets/atkinson-hyperlegible-next-latin-ext-wght-normal-C6vrW8VD.woff2 +0 -0
- package/dist/web/client/assets/atkinson-hyperlegible-next-latin-wght-normal-BcXVPD7q.woff2 +0 -0
- package/dist/web/client/assets/blockDiagram-I7D4REHJ-wi0_CYHL.js +129 -0
- package/dist/web/client/assets/c4Diagram-7LVT6UL2-DV7NYc2W.js +38 -0
- package/dist/web/client/assets/channel-CiUWbHN9.js +1 -0
- package/dist/web/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/web/client/assets/chunk-4HAMMTFA-Bhsegh3F.js +62 -0
- package/dist/web/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/web/client/assets/chunk-75Z2AOVW-RQCckcQG.js +2 -0
- package/dist/web/client/assets/chunk-DU6HZSFF-C5USiOAy.js +125 -0
- package/dist/web/client/assets/chunk-F27PBJKO-BcNqv2x1.js +1 -0
- package/dist/web/client/assets/chunk-FOHPRMQF-CoA4358r.js +161 -0
- package/dist/web/client/assets/chunk-GMAD6QVW-Bq8JWiZT.js +72 -0
- package/dist/web/client/assets/chunk-GVQU2GXP-DbchrAeJ.js +1 -0
- package/dist/web/client/assets/chunk-IMKFNOWR-DrpvjocK.js +231 -0
- package/dist/web/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/web/client/assets/chunk-L3NEJ4N5-DHLmTnCe.js +1 -0
- package/dist/web/client/assets/chunk-OSK3NFVY-CsRbtN9n.js +10 -0
- package/dist/web/client/assets/chunk-P2QGCYS3-aqPbxoMh.js +1 -0
- package/dist/web/client/assets/chunk-POPQ4Y6H-Dl5vw0h0.js +1 -0
- package/dist/web/client/assets/chunk-PWAF6VOD-D7OBRSdO.js +1 -0
- package/dist/web/client/assets/chunk-SHT3W25Y-CdKCIwuB.js +168 -0
- package/dist/web/client/assets/chunk-SVP7TREG-B94Nu_1-.js +88 -0
- package/dist/web/client/assets/chunk-TICWLB2K-jjRQI_hk.js +206 -0
- package/dist/web/client/assets/chunk-XXDRQBXY-azkbKE37.js +1 -0
- package/dist/web/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/web/client/assets/classDiagram-ZZMXUADV-CMODalmo.js +1 -0
- package/dist/web/client/assets/classDiagram-v2-VYDZK3BY-CMODalmo.js +1 -0
- package/dist/web/client/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
- package/dist/web/client/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
- package/dist/web/client/assets/cose-bilkent-JH36ORCC-RbQL23qS.js +1 -0
- package/dist/web/client/assets/cynefin-OW5HDTMX--i9RDU5f.js +1 -0
- package/dist/web/client/assets/cynefinDiagram-5FMLGOSQ-cRcvyBdp.js +62 -0
- package/dist/web/client/assets/cytoscape.esm-c2aL46s-.js +321 -0
- package/dist/web/client/assets/dagre-C-rnJpZF.js +1 -0
- package/dist/web/client/assets/dagre-GXQ25YYZ-C9mZmAPe.js +4 -0
- package/dist/web/client/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/web/client/assets/diagram-S7CK7UJ4-Oj_zlLDY.js +30 -0
- package/dist/web/client/assets/diagram-UQ7AKVKN-BWKbbfcR.js +41 -0
- package/dist/web/client/assets/diagram-VSXAHHWV-C3N3f7DO.js +3 -0
- package/dist/web/client/assets/diagram-VX7I27RA-CtDKDAWe.js +24 -0
- package/dist/web/client/assets/diagram-Z3DM3KII-B8bkBRCz.js +24 -0
- package/dist/web/client/assets/dist-D0_q-A2b.js +1 -0
- package/dist/web/client/assets/ebnfDiagram-PWID7BFC-CskW-Whx.js +1 -0
- package/dist/web/client/assets/erDiagram-RLTQ6QDP-C-83cgCW.js +99 -0
- package/dist/web/client/assets/eventmodeling-NTZA5JFV-DjVq8wKU.js +1 -0
- package/dist/web/client/assets/flowDiagram-HODETNUW-BUiCBGXt.js +1 -0
- package/dist/web/client/assets/ganttDiagram-EL5Y4UJY-B2lb8lvF.js +292 -0
- package/dist/web/client/assets/gitGraph-4MIJSDKK-B40cQtBE.js +1 -0
- package/dist/web/client/assets/gitGraphDiagram-WWUBYQGX-CH-7P7Di.js +106 -0
- package/dist/web/client/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/web/client/assets/index-Dsi52apB.css +1 -0
- package/dist/web/client/assets/index-FSIC94pi.js +83 -0
- package/dist/web/client/assets/info-A6RAGUB7-eCCE9D_Q.js +1 -0
- package/dist/web/client/assets/infoDiagram-27XIBGKW-DRnvqMjM.js +2 -0
- package/dist/web/client/assets/init-C-OQMol4.js +1 -0
- package/dist/web/client/assets/ishikawaDiagram-5VMMS53U-DBA_55wp.js +70 -0
- package/dist/web/client/assets/journeyDiagram-3NMN7TZE-C-ewpNl7.js +139 -0
- package/dist/web/client/assets/kanban-definition-UXKFOSKX-B1taGsu0.js +89 -0
- package/dist/web/client/assets/katex-ZlcWpGUi.js +257 -0
- package/dist/web/client/assets/line-lZ0kyxDI.js +1 -0
- package/dist/web/client/assets/linear-DIc8FgZj.js +1 -0
- package/dist/web/client/assets/mermaid-parser.core-SXolxpXw.js +7 -0
- package/dist/web/client/assets/mermaid.core-DXgQtkNg.js +44 -0
- package/dist/web/client/assets/mindmap-definition-YA3MSWOX-DXJas9K7.js +96 -0
- package/dist/web/client/assets/newsreader-latin-ext-wght-normal-C-3rgBeH.woff2 +0 -0
- package/dist/web/client/assets/newsreader-latin-wght-normal-CCVVNp6i.woff2 +0 -0
- package/dist/web/client/assets/newsreader-vietnamese-wght-normal-Czsa-EzN.woff2 +0 -0
- package/dist/web/client/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/web/client/assets/packet-AYTQ26CC-OqVl_07o.js +1 -0
- package/dist/web/client/assets/path-fybaL0A-.js +1 -0
- package/dist/web/client/assets/pegDiagram-XKGWAZYB-CPE_zdfN.js +1 -0
- package/dist/web/client/assets/pie-WAS4IAKB-DAxnMBLe.js +1 -0
- package/dist/web/client/assets/pieDiagram-E7YTZNPT-Uwjpufxv.js +39 -0
- package/dist/web/client/assets/prism-bash-D6zCJ74D.js +1 -0
- package/dist/web/client/assets/prism-c-04YixN25.js +1 -0
- package/dist/web/client/assets/prism-clike-DapgWyxx.js +1 -0
- package/dist/web/client/assets/prism-core-BngLtbUd.js +1 -0
- package/dist/web/client/assets/prism-cpp-C-lJbC-6.js +1 -0
- package/dist/web/client/assets/prism-css-CPgOzxXp.js +1 -0
- package/dist/web/client/assets/prism-diff-BF8m0_mq.js +3 -0
- package/dist/web/client/assets/prism-docker-DkT6yOFj.js +1 -0
- package/dist/web/client/assets/prism-fortran-Be5x3y1V.js +1 -0
- package/dist/web/client/assets/prism-go-C_8qAH5n.js +1 -0
- package/dist/web/client/assets/prism-ini-BESK3y0r.js +1 -0
- package/dist/web/client/assets/prism-javascript-BnO-swvr.js +1 -0
- package/dist/web/client/assets/prism-json-Dp_-W-Hv.js +1 -0
- package/dist/web/client/assets/prism-jsx-D-D0NWtC.js +1 -0
- package/dist/web/client/assets/prism-julia-DIjOgiAV.js +1 -0
- package/dist/web/client/assets/prism-latex-DNMbqcH_.js +1 -0
- package/dist/web/client/assets/prism-makefile-CRKWLQ8l.js +1 -0
- package/dist/web/client/assets/prism-markdown-C0FPJ1Iz.js +1 -0
- package/dist/web/client/assets/prism-markup-Cp04rIa1.js +1 -0
- package/dist/web/client/assets/prism-matlab-D-nk08al.js +1 -0
- package/dist/web/client/assets/prism-python-CfiSVtM6.js +1 -0
- package/dist/web/client/assets/prism-r-QmNGR8LX.js +1 -0
- package/dist/web/client/assets/prism-rust-Bu9N8X3N.js +1 -0
- package/dist/web/client/assets/prism-shell-session-Be4UuYoM.js +1 -0
- package/dist/web/client/assets/prism-sql-CYhVDMEE.js +1 -0
- package/dist/web/client/assets/prism-toml-DKb54GAT.js +1 -0
- package/dist/web/client/assets/prism-tsx-p6J2Kc_4.js +1 -0
- package/dist/web/client/assets/prism-typescript-BMqONzxf.js +1 -0
- package/dist/web/client/assets/prism-yaml-C0JHu8gr.js +1 -0
- package/dist/web/client/assets/purify.es-ChwZkWde.js +3 -0
- package/dist/web/client/assets/quadrantDiagram-AXDQQJYC-Bjs4yjgs.js +7 -0
- package/dist/web/client/assets/radar-RG4KPBEZ-CuCKjHM3.js +1 -0
- package/dist/web/client/assets/railroad-74A4TZTK-CnQK-Cc1.js +1 -0
- package/dist/web/client/assets/railroad-abnf-HS5TGJTU-BcW01NZG.js +1 -0
- package/dist/web/client/assets/railroad-ebnf-LZEXJU2U-B7YCEDDd.js +1 -0
- package/dist/web/client/assets/railroad-peg-WCYAUIDC-DjNZbSTZ.js +1 -0
- package/dist/web/client/assets/railroadDiagram-O6MQD6OU-BDDIPNLL.js +1 -0
- package/dist/web/client/assets/requirementDiagram-BXWQKSXE-B5Ydyxc1.js +84 -0
- package/dist/web/client/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/web/client/assets/sankeyDiagram-P5KCCOFB-Bw2Qym75.js +40 -0
- package/dist/web/client/assets/sequenceDiagram-WJ2MYXX4-BZf36nO0.js +162 -0
- package/dist/web/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/dist/web/client/assets/src-yeptRXpt.js +1 -0
- package/dist/web/client/assets/stateDiagram-D77RDMKH-DnH6JRkp.js +1 -0
- package/dist/web/client/assets/stateDiagram-v2-MP3YSRHH-C7QtHeK4.js +1 -0
- package/dist/web/client/assets/swimlanes-42K2YHIH-D9PZmtZg.js +1 -0
- package/dist/web/client/assets/swimlanesDiagram-VR7AAH4N-CBZlPFky.js +8 -0
- package/dist/web/client/assets/timeline-definition-24CTP7MA-CrkZZBo7.js +120 -0
- package/dist/web/client/assets/treeView-Q6P3EWNA-C9zDShoC.js +1 -0
- package/dist/web/client/assets/treemap-WGGIJYW6-B-plj9yK.js +1 -0
- package/dist/web/client/assets/vennDiagram-4TSXK5OY-VeOdaphN.js +34 -0
- package/dist/web/client/assets/wardley-WFR3VGLG-Wl1P_m6L.js +1 -0
- package/dist/web/client/assets/wardleyDiagram-VM6X3IG4-B85-R9t2.js +78 -0
- package/dist/web/client/assets/xychartDiagram-S5SC5T6Z-BrD8OW8m.js +7 -0
- package/dist/web/client/clio-coder-logo.webp +0 -0
- package/dist/web/client/icon-192.png +0 -0
- package/dist/web/client/icon-512.png +0 -0
- package/dist/web/client/index.html +4 -0
- package/dist/web/client/manifest.webmanifest +15 -0
- package/dist/web/client/offline.css +55 -0
- package/dist/web/client/offline.html +5 -0
- package/dist/web/client/offline.js +27 -0
- package/dist/web/client/sw.js +34 -0
- package/dist/web/ops-worker.js +37 -0
- package/dist/web/reads-worker.js +1726 -0
- package/dist/web/server.js +8499 -0
- package/dist/web-EU6ATJWA.js +13 -0
- package/dist/web-fetch-U22Q7HV4.js +788 -0
- package/dist/wiki-generate-LZRLFG6I.js +623 -0
- package/dist/with-panes-X5CZOGML.js +628 -0
- package/dist/worker/entry.js +300 -93
- package/docs/README.md +58 -14
- package/docs/architecture/acp.md +5 -9
- package/docs/architecture/alcf-provider.md +0 -3
- package/docs/architecture/architecture.md +8 -10
- package/docs/architecture/artifact-placement.md +0 -3
- package/docs/architecture/artifact-versions.md +3 -6
- package/docs/architecture/capacity-and-scheduling.md +0 -3
- package/docs/architecture/context-engine.md +35 -4
- package/docs/architecture/context-working-set.md +0 -3
- package/docs/architecture/dispatch-architecture-rationale.md +0 -3
- package/docs/architecture/dispatch-typed-intent.md +0 -3
- package/docs/architecture/evidence-and-memory.md +0 -3
- package/docs/architecture/library.md +30 -0
- package/docs/architecture/middleware-and-components.md +1 -4
- package/docs/architecture/model-catalog.md +21 -4
- package/docs/architecture/observability.md +0 -3
- package/docs/architecture/pi-boundary.md +23 -8
- package/docs/architecture/prompt-envelope-and-tools.md +6 -9
- package/docs/architecture/provider-adapter-cookbook.md +1 -4
- package/docs/architecture/safety-model.md +21 -5
- package/docs/architecture/session-lifecycle.md +12 -4
- package/docs/architecture/time-conventions.md +0 -3
- package/docs/architecture/trace-store.md +28 -20
- package/docs/architecture/tui-design.md +108 -12
- package/docs/architecture/worker-context.md +104 -0
- package/docs/architecture/worker-dispatch-mechanics.md +1 -4
- package/docs/guide/authoring-plugins.md +158 -0
- package/docs/guide/built-in-agents.md +5 -8
- package/docs/guide/commands-and-modes.md +162 -61
- package/docs/guide/configuration-and-targets.md +198 -5
- package/docs/guide/configuration-reference.md +36 -38
- package/docs/guide/environment-variables.md +2 -5
- package/docs/guide/exit-codes-and-output.md +1 -4
- package/docs/guide/extensions-and-sharing.md +92 -55
- package/docs/guide/fleet-dispatch.md +31 -7
- package/docs/guide/glossary.md +1 -4
- package/docs/guide/harness-extensions.md +289 -0
- package/docs/guide/installation-and-lifecycle.md +10 -13
- package/docs/guide/interop.md +241 -0
- package/docs/guide/panes-and-files.md +3 -6
- package/docs/guide/plugins.md +77 -0
- package/docs/guide/proactive-memory.md +0 -3
- package/docs/guide/resource-library.md +109 -45
- package/docs/guide/skills-marketplace.md +34 -73
- package/docs/guide/tool-usage.md +19 -10
- package/docs/guide/troubleshooting.md +1 -4
- package/docs/history/config-knobs-audit.md +0 -3
- package/docs/history/release-cut-checklist.md +0 -3
- package/docs/process/development-pipeline.md +14 -17
- package/docs/process/documentation-coverage.md +31 -4
- package/docs/process/documentation-guide.md +28 -27
- package/docs/process/eval-runner.md +8 -6
- package/docs/process/evals-internal.md +0 -3
- package/docs/process/evolution.md +0 -3
- package/docs/process/fleet-demo-runbook.md +0 -3
- package/docs/process/git-commit-provenance.md +0 -3
- package/docs/process/performance-methodology.md +2 -5
- package/docs/process/release-cut-checklist.md +114 -217
- package/docs/process/scientific-validation.md +23 -3
- package/evals/scalar-decision-machinery.ts +1 -1
- package/examples/extensions/README.md +67 -0
- package/examples/extensions/lab-status/clio-coder-extension.json +14 -0
- package/examples/extensions/lab-status/extension.mjs +68 -0
- package/examples/extensions/lab-status/jobs.synthetic.json +9 -0
- package/examples/extensions/measurements/clio-coder-extension.json +28 -0
- package/examples/extensions/measurements/summarize.cjs +23 -0
- package/library/README.md +109 -0
- package/library/_authoring/templates/agent/README.md +28 -0
- package/library/_authoring/templates/agent/agents/benchmark-scout.md +30 -0
- package/library/_authoring/templates/agent/plugin.json +23 -0
- package/library/_authoring/templates/fleet/README.md +29 -0
- package/library/_authoring/templates/fleet/fleets/pipeline-review.md +31 -0
- package/library/_authoring/templates/fleet/plugin.json +23 -0
- package/library/_authoring/templates/plugin/README.md +37 -0
- package/library/_authoring/templates/plugin/agents/data-curator.md +31 -0
- package/library/_authoring/templates/plugin/assets/curation-guide.md +22 -0
- package/library/_authoring/templates/plugin/plugin.json +42 -0
- package/library/_authoring/templates/plugin/prompts/inspect-dataset.md +15 -0
- package/library/_authoring/templates/plugin/skills/dataset-curation/SKILL.md +36 -0
- package/library/_authoring/templates/plugin/skills/dataset-curation/evals.md +17 -0
- package/library/_authoring/templates/prompt/README.md +28 -0
- package/library/_authoring/templates/prompt/plugin.json +23 -0
- package/library/_authoring/templates/prompt/prompts/paper-summary.md +26 -0
- package/library/_authoring/templates/skill/README.md +24 -0
- package/library/_authoring/templates/skill/SKILL.md +39 -0
- package/library/_authoring/templates/skill/evals.md +30 -0
- package/library/_authoring/templates/skill/plugin.json +23 -0
- package/library/agents/README.md +7 -0
- package/library/fleets/README.md +7 -0
- package/library/plugins/materio/README.md +137 -0
- package/library/plugins/materio/ai.iowarp.clio/agents/materio-lab-definer.md +208 -0
- package/library/plugins/materio/ai.iowarp.clio/agents/materio-literature-reviewer.md +308 -0
- package/library/plugins/materio/ai.iowarp.clio/agents/materio-research-explorer.md +249 -0
- package/library/plugins/materio/ai.iowarp.clio/agents/materio-task-executor.md +416 -0
- package/library/plugins/materio/ai.iowarp.clio/agents/materio-task-verifier.md +60 -0
- package/library/plugins/materio/ai.iowarp.clio/agents/materio-workflow-planner.md +238 -0
- package/library/plugins/materio/ai.iowarp.clio/fleets/materio-execute-task.md +50 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/add-task.md +66 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/archive-task.md +65 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/checkpoint.md +26 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/define-research-tasks.md +230 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/define-virtual-lab.md +181 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/execute-task.md +292 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/help.md +129 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/identify-research.md +206 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/literature-review.md +201 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/pause-research.md +12 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/progress.md +105 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/remove-task.md +63 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/resume-research.md +64 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/settings.md +16 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/status.md +92 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/upload-data.md +104 -0
- package/library/plugins/materio/ai.iowarp.clio/prompts/materio/wtfp.md +145 -0
- package/library/plugins/materio/ai.iowarp.clio/references/execution.md +56 -0
- package/library/plugins/materio/ai.iowarp.portability/provenance.json +9 -0
- package/library/plugins/materio/assets/actions/add-task.md +86 -0
- package/library/plugins/materio/assets/actions/archive-task.md +84 -0
- package/library/plugins/materio/assets/actions/checkpoint.md +47 -0
- package/library/plugins/materio/assets/actions/define-research-tasks.md +228 -0
- package/library/plugins/materio/assets/actions/define-virtual-lab.md +179 -0
- package/library/plugins/materio/assets/actions/execute-task.md +290 -0
- package/library/plugins/materio/assets/actions/help.md +140 -0
- package/library/plugins/materio/assets/actions/identify-research.md +204 -0
- package/library/plugins/materio/assets/actions/literature-review.md +199 -0
- package/library/plugins/materio/assets/actions/pause-research.md +34 -0
- package/library/plugins/materio/assets/actions/progress.md +125 -0
- package/library/plugins/materio/assets/actions/remove-task.md +82 -0
- package/library/plugins/materio/assets/actions/resume-research.md +84 -0
- package/library/plugins/materio/assets/actions/settings.md +38 -0
- package/library/plugins/materio/assets/actions/status.md +112 -0
- package/library/plugins/materio/assets/actions/upload-data.md +123 -0
- package/library/plugins/materio/assets/actions/wtfp.md +179 -0
- package/library/plugins/materio/assets/references/research-domains.md +134 -0
- package/library/plugins/materio/assets/references/research-policy.md +77 -0
- package/library/plugins/materio/assets/references/traditional-workflows.md +146 -0
- package/library/plugins/materio/assets/scripts/check_physics.py +271 -0
- package/library/plugins/materio/assets/scripts/check_scripts.py +248 -0
- package/library/plugins/materio/assets/scripts/project_plugin.py +165 -0
- package/library/plugins/materio/assets/scripts/research_state.py +400 -0
- package/library/plugins/materio/assets/scripts/verify_citations.py +616 -0
- package/library/plugins/materio/assets/templates/RESEARCH.md +39 -0
- package/library/plugins/materio/assets/templates/VIRTUAL-LAB.md +120 -0
- package/library/plugins/materio/assets/templates/WORKFLOW.md +42 -0
- package/library/plugins/materio/assets/templates/config.json +5 -0
- package/library/plugins/materio/evals/scripts.yaml +29 -0
- package/library/plugins/materio/plugin.json +530 -0
- package/library/plugins/materio/skills/materio-lab-definer/SKILL.md +74 -0
- package/library/plugins/materio/skills/materio-literature-reviewer/SKILL.md +64 -0
- package/library/plugins/materio/skills/materio-research-explorer/SKILL.md +74 -0
- package/library/plugins/materio/skills/materio-task-executor/SKILL.md +214 -0
- package/library/plugins/materio/skills/materio-task-verifier/SKILL.md +46 -0
- package/library/plugins/materio/skills/materio-workflow-planner/SKILL.md +79 -0
- package/library/plugins/materio/tests/test_check_physics.py +139 -0
- package/library/plugins/materio/tests/test_check_scripts.py +140 -0
- package/library/plugins/materio/tests/test_research_state.py +291 -0
- package/library/plugins/materio/tests/test_verify_citations.py +337 -0
- package/library/prompts/README.md +7 -0
- package/library/registry.yaml +921 -0
- package/library/skills/README.md +120 -0
- package/library/skills/coding/ast-grep/SKILL.md +213 -0
- package/library/skills/coding/ast-grep/evals.md +82 -0
- package/library/skills/coding/ast-grep/plugin.json +23 -0
- package/library/skills/coding/coding-standards/SKILL.md +164 -0
- package/library/skills/coding/coding-standards/evals.md +57 -0
- package/library/skills/coding/coding-standards/plugin.json +23 -0
- package/library/skills/coding/prototype/SKILL.md +151 -0
- package/library/skills/coding/prototype/evals.md +61 -0
- package/library/skills/coding/prototype/plugin.json +23 -0
- package/library/skills/coding/tdd/SKILL.md +134 -0
- package/library/skills/coding/tdd/evals.md +61 -0
- package/library/skills/coding/tdd/plugin.json +23 -0
- package/library/skills/context/context-handoff/SKILL.md +176 -0
- package/library/skills/context/context-handoff/evals.md +101 -0
- package/library/skills/context/context-handoff/plugin.json +23 -0
- package/library/skills/context/context-prime/SKILL.md +131 -0
- package/library/skills/context/context-prime/evals.md +99 -0
- package/library/skills/context/context-prime/plugin.json +23 -0
- package/library/skills/git/branch-closeout/SKILL.md +132 -0
- package/library/skills/git/branch-closeout/plugin.json +23 -0
- package/library/skills/git/file-ticket/SKILL.md +126 -0
- package/library/skills/git/file-ticket/plugin.json +23 -0
- package/library/skills/git/fix-issue/SKILL.md +136 -0
- package/library/skills/git/fix-issue/plugin.json +23 -0
- package/library/skills/git/resolve-merge-conflicts/SKILL.md +151 -0
- package/library/skills/git/resolve-merge-conflicts/evals.md +85 -0
- package/library/skills/git/resolve-merge-conflicts/plugin.json +23 -0
- package/library/skills/git/ship/SKILL.md +134 -0
- package/library/skills/git/ship/plugin.json +23 -0
- package/library/skills/git/worktree-create/SKILL.md +127 -0
- package/library/skills/git/worktree-create/plugin.json +23 -0
- package/library/skills/git/worktree-merge/SKILL.md +147 -0
- package/library/skills/git/worktree-merge/plugin.json +23 -0
- package/library/skills/meta/clio-coder-dev/SKILL.md +101 -0
- package/library/skills/meta/clio-coder-dev/evals.md +46 -0
- package/library/skills/meta/clio-coder-dev/plugin.json +23 -0
- package/library/skills/meta/clio-coder-test/SKILL.md +156 -0
- package/library/skills/meta/clio-coder-test/evals.md +62 -0
- package/library/skills/meta/clio-coder-test/plugin.json +23 -0
- package/library/skills/meta/clio-coder-test/references/test-map.md +97 -0
- package/library/skills/meta/credentials/SKILL.md +132 -0
- package/library/skills/meta/credentials/evals.md +104 -0
- package/library/skills/meta/credentials/plugin.json +23 -0
- package/library/skills/meta/find-skills/SKILL.md +85 -0
- package/library/skills/meta/find-skills/evals.md +65 -0
- package/library/skills/meta/find-skills/plugin.json +23 -0
- package/library/skills/meta/herdr/SKILL.md +133 -0
- package/library/skills/meta/herdr/evals.md +38 -0
- package/library/skills/meta/herdr/plugin.json +23 -0
- package/library/skills/meta/skill-craft/SKILL.md +139 -0
- package/library/skills/meta/skill-craft/evals.md +49 -0
- package/library/skills/meta/skill-craft/plugin.json +23 -0
- package/library/skills/planning/archify/SKILL.md +196 -0
- package/library/skills/planning/archify/plugin.json +23 -0
- package/library/skills/planning/architecture/SKILL.md +184 -0
- package/library/skills/planning/architecture/evals.md +101 -0
- package/library/skills/planning/architecture/plugin.json +23 -0
- package/library/skills/planning/backlog/SKILL.md +212 -0
- package/library/skills/planning/backlog/evals.md +185 -0
- package/library/skills/planning/backlog/plugin.json +23 -0
- package/library/skills/planning/prd/SKILL.md +129 -0
- package/library/skills/planning/prd/evals.md +103 -0
- package/library/skills/planning/prd/plugin.json +23 -0
- package/library/skills/planning/product-intent/SKILL.md +173 -0
- package/library/skills/planning/product-intent/evals.md +106 -0
- package/library/skills/planning/product-intent/plugin.json +23 -0
- package/library/skills/planning/tech-spec/SKILL.md +172 -0
- package/library/skills/planning/tech-spec/evals.md +120 -0
- package/library/skills/planning/tech-spec/plugin.json +23 -0
- package/library/skills/registry.yaml +144 -0
- package/library/skills/remote.yaml +13 -0
- package/library/skills/research/arxiv-literature/SKILL.md +168 -0
- package/library/skills/research/arxiv-literature/evals.md +108 -0
- package/library/skills/research/arxiv-literature/plugin.json +23 -0
- package/library/skills/research/experiment-protocol/SKILL.md +148 -0
- package/library/skills/research/experiment-protocol/evals.md +114 -0
- package/library/skills/research/experiment-protocol/plugin.json +23 -0
- package/library/skills/research/scientific-debugging/SKILL.md +149 -0
- package/library/skills/research/scientific-debugging/evals.md +156 -0
- package/library/skills/research/scientific-debugging/plugin.json +23 -0
- package/library/skills/research/scientific-modernization/SKILL.md +170 -0
- package/library/skills/research/scientific-modernization/evals.md +111 -0
- package/library/skills/research/scientific-modernization/plugin.json +23 -0
- package/library/skills/skill-marketplace.json +507 -0
- package/library/skills/workflow/cut-it/SKILL.md +153 -0
- package/library/skills/workflow/cut-it/evals.md +143 -0
- package/library/skills/workflow/cut-it/plugin.json +23 -0
- package/library/skills/workflow/design-council/SKILL.md +233 -0
- package/library/skills/workflow/design-council/evals.md +258 -0
- package/library/skills/workflow/design-council/plugin.json +23 -0
- package/library/skills/workflow/grill-me/SKILL.md +267 -0
- package/library/skills/workflow/grill-me/evals.md +231 -0
- package/library/skills/workflow/grill-me/plugin.json +23 -0
- package/library/skills/workflow/workflow-distiller/SKILL.md +204 -0
- package/library/skills/workflow/workflow-distiller/evals.md +233 -0
- package/library/skills/workflow/workflow-distiller/plugin.json +23 -0
- package/package.json +23 -14
- package/src/cli/agents.ts +1 -1
- package/src/cli/config-inspect.ts +1 -1
- package/src/cli/configure.ts +2 -2
- package/src/cli/docs.ts +65 -328
- package/src/cli/eval.ts +40 -6
- package/src/cli/extensions.ts +74 -8
- package/src/cli/fleet-preflight.ts +2 -0
- package/src/cli/fleet.ts +2 -0
- package/src/cli/index.ts +4 -4
- package/src/cli/interop-inspect.ts +61 -33
- package/src/cli/interop.ts +79 -9
- package/src/cli/library-import.ts +139 -0
- package/src/cli/library.ts +418 -120
- package/src/cli/run.ts +26 -9
- package/src/cli/skills-eval.ts +43 -6
- package/src/cli/skills-inventory.ts +6 -2
- package/src/cli/skills.ts +44 -491
- package/src/cli/trace.ts +4 -65
- package/src/cli/uninstall.ts +26 -0
- package/src/cli/usage.ts +3 -0
- package/src/cli/web.ts +79 -0
- package/src/core/bus-events.ts +8 -4
- package/src/core/config.ts +71 -0
- package/src/core/defaults.ts +1 -1
- package/src/core/domain-loader.ts +37 -28
- package/src/core/recent-models.ts +2 -2
- package/src/core/session-routing.ts +3 -3
- package/src/core/state-file-lock.ts +1 -1
- package/src/core/termination.ts +13 -9
- package/src/core/tool-names.ts +5 -0
- package/src/domains/agents/contract.ts +1 -1
- package/src/domains/agents/extension.ts +53 -9
- package/src/domains/agents/fleet-commands.ts +92 -1
- package/src/domains/agents/fleet-contract.ts +87 -19
- package/src/domains/agents/recipe.ts +5 -4
- package/src/domains/agents/registry.ts +80 -24
- package/src/domains/config/extension.ts +5 -4
- package/src/domains/config/keybindings.ts +155 -95
- package/src/domains/context/worker/contract.ts +91 -0
- package/src/domains/context/worker/pressure.ts +120 -0
- package/src/domains/context/worker/recall.ts +62 -0
- package/src/domains/context/worker/select.ts +164 -0
- package/src/domains/context/worker/snapshot.ts +35 -0
- package/src/domains/context/worker/store.ts +16 -0
- package/src/domains/context/working-set/replay/synthetic.ts +2 -1
- package/src/domains/dispatch/active-route-planner.ts +2 -0
- package/src/domains/dispatch/backoff.ts +1 -0
- package/src/domains/dispatch/code-step.ts +12 -2
- package/src/domains/dispatch/contract.ts +3 -0
- package/src/domains/dispatch/execution-plan.ts +2 -0
- package/src/domains/dispatch/extension.ts +184 -39
- package/src/domains/dispatch/fleet-plan.ts +10 -0
- package/src/domains/dispatch/fleet-run.ts +1 -0
- package/src/domains/dispatch/index.ts +1 -0
- package/src/domains/dispatch/orphan-recovery.ts +2 -0
- package/src/domains/dispatch/receipt-integrity.ts +7 -0
- package/src/domains/dispatch/state.ts +2 -2
- package/src/domains/dispatch/types.ts +7 -0
- package/src/domains/dispatch/validation.ts +12 -0
- package/src/domains/dispatch/workspace-checkpoint.ts +1 -1
- package/src/domains/eval/metrics/tracked.ts +22 -2
- package/src/domains/evidence/failure-attribution.ts +1 -0
- package/src/domains/evidence/trust-status.ts +22 -3
- package/src/domains/extensions/command-schema.ts +145 -0
- package/src/domains/extensions/command-tools.ts +15 -0
- package/src/domains/extensions/compatibility.ts +7 -0
- package/src/domains/extensions/contract.ts +0 -4
- package/src/domains/extensions/discovery.ts +69 -205
- package/src/domains/extensions/extension.ts +0 -4
- package/src/domains/extensions/index.ts +1 -5
- package/src/domains/extensions/manager.ts +1 -6
- package/src/domains/extensions/operator-commands.ts +29 -0
- package/src/domains/extensions/operator-runtime.ts +485 -0
- package/src/domains/extensions/public-api.ts +53 -0
- package/src/domains/extensions/runtime-child.mjs +114 -0
- package/src/domains/extensions/runtime-process.ts +306 -0
- package/src/domains/extensions/runtime-schema.ts +146 -0
- package/src/domains/extensions/snapshot-access.ts +21 -0
- package/src/domains/extensions/snapshot.ts +4 -32
- package/src/domains/extensions/state.ts +5 -83
- package/src/domains/extensions/types.ts +33 -34
- package/src/domains/interop/adopt.ts +546 -0
- package/src/domains/interop/detect.ts +50 -12
- package/src/domains/interop/foreign.ts +554 -0
- package/src/domains/interop/import.ts +277 -0
- package/src/domains/interop/index.ts +24 -0
- package/src/domains/interop/install.ts +6 -0
- package/src/domains/interop/inventory.ts +351 -0
- package/src/domains/interop/projection.ts +360 -0
- package/src/domains/interop/registry.ts +106 -3
- package/src/domains/interop/types.ts +51 -0
- package/src/domains/lifecycle/migrations/index.ts +0 -2
- package/src/domains/lifecycle/naming-resources.ts +1 -1
- package/src/domains/middleware/hooks.ts +2 -2
- package/src/domains/middleware/marketplace-offer.ts +1 -1
- package/src/domains/mux/contract.ts +1 -1
- package/src/domains/observability/background-memory-usage.ts +3 -0
- package/src/domains/observability/compaction-usage.ts +2 -0
- package/src/domains/observability/cost.ts +5 -0
- package/src/domains/observability/extension.ts +1 -0
- package/src/domains/observability/out-of-turn-usage.ts +2 -0
- package/src/domains/observability/trace-store.ts +65 -5
- package/src/domains/plugins/catalog.ts +204 -0
- package/src/domains/plugins/contract.ts +24 -0
- package/src/domains/plugins/discovery.ts +316 -0
- package/src/domains/plugins/extension.ts +40 -0
- package/src/domains/plugins/index.ts +77 -0
- package/src/domains/plugins/integrity.ts +6 -0
- package/src/domains/plugins/manifest.ts +3 -0
- package/src/domains/plugins/resources.ts +102 -0
- package/src/domains/plugins/state.ts +753 -0
- package/src/domains/plugins/types.ts +217 -0
- package/src/domains/prompts/extension.ts +4 -10
- package/src/domains/prompts/fragments/operating/skills.md +10 -10
- package/src/domains/providers/cache-deployment.ts +147 -0
- package/src/domains/providers/catalog.ts +12 -7
- package/src/domains/providers/extension.ts +27 -5
- package/src/domains/providers/index.ts +1 -0
- package/src/domains/providers/plugins.ts +3 -13
- package/src/domains/providers/runtimes/common/local-synth.ts +4 -0
- package/src/domains/providers/types/target-descriptor.ts +17 -0
- package/src/domains/resources/common-loader.ts +9 -6
- package/src/domains/resources/index.ts +67 -0
- package/src/domains/resources/library-actions.ts +836 -0
- package/src/domains/resources/library-evals.ts +38 -0
- package/src/domains/resources/library-inventory.ts +1048 -0
- package/src/domains/resources/library-types.ts +50 -0
- package/src/domains/resources/library-validation.ts +634 -0
- package/src/domains/resources/library.ts +437 -156
- package/src/domains/resources/package-references.ts +66 -0
- package/src/domains/resources/prompts/loader.ts +75 -41
- package/src/domains/resources/skills/install.ts +2 -2
- package/src/domains/resources/skills/loader.ts +77 -22
- package/src/domains/resources/skills/marketplace.ts +48 -57
- package/src/domains/resources/skills/promotion.ts +2 -2
- package/src/domains/resources/skills/provenance-pin.ts +17 -4
- package/src/domains/safety/action-classifier.ts +2 -2
- package/src/domains/safety/default-path-policy.ts +3 -1
- package/src/domains/safety/policy-engine.ts +1 -1
- package/src/domains/safety/protected-artifacts.ts +21 -5
- package/src/domains/safety/skill-authority.ts +5 -2
- package/src/domains/session/compaction/compact.ts +4 -1
- package/src/domains/session/entries.ts +1 -0
- package/src/domains/session/usage.ts +6 -7
- package/src/domains/share/archive.ts +1 -1
- package/src/engine/acp/server.ts +11 -0
- package/src/engine/ai.ts +2 -0
- package/src/engine/apis/openai-completions.ts +61 -6
- package/src/engine/notices/pi-tui-LICENSE +21 -0
- package/src/engine/prewarm.ts +232 -0
- package/src/engine/provider-diagnostics.ts +6 -1
- package/src/engine/tui.ts +3 -0
- package/src/engine/worker-runtime.ts +58 -14
- package/src/engine/worker-tools.ts +5 -0
- package/src/entry/orchestrator.ts +46 -21
- package/src/entry/plugin-reload.ts +18 -0
- package/src/interactive/application-controller.ts +67 -21
- package/src/interactive/chat-loop-messages.ts +3 -0
- package/src/interactive/chat-loop.ts +32 -11
- package/src/interactive/chat-panel.ts +5 -1
- package/src/interactive/clio-editor.ts +53 -21
- package/src/interactive/command-output.ts +56 -1
- package/src/interactive/editor-submit.ts +65 -28
- package/src/interactive/fleet-run-preview.ts +2 -0
- package/src/interactive/follow-up-queue-panel.ts +3 -3
- package/src/interactive/footer/dashboard.ts +4 -1
- package/src/interactive/footer/notifications.ts +2 -2
- package/src/interactive/footer/widgets.ts +2 -2
- package/src/interactive/interactive-application.ts +209 -21
- package/src/interactive/interactive-input-runtime.ts +254 -7
- package/src/interactive/interactive-presentation.ts +41 -12
- package/src/interactive/interactive-slash-runtime.ts +37 -8
- package/src/interactive/keybinding-manager.ts +156 -79
- package/src/interactive/keyboard-owner.ts +37 -0
- package/src/interactive/leader-key.ts +49 -102
- package/src/interactive/leader-menu.ts +45 -0
- package/src/interactive/overlay-ask-user-lifecycle.ts +9 -1
- package/src/interactive/overlay-frame.ts +15 -0
- package/src/interactive/overlay-key-routing.ts +46 -47
- package/src/interactive/overlay-lifecycle.ts +30 -15
- package/src/interactive/overlay-resource-openers.ts +56 -46
- package/src/interactive/overlays/ask-user.ts +630 -556
- package/src/interactive/overlays/extension-panel.ts +70 -0
- package/src/interactive/overlays/extensions.ts +28 -5
- package/src/interactive/overlays/fleet-run-approval.ts +7 -3
- package/src/interactive/overlays/help-reference.ts +89 -40
- package/src/interactive/overlays/interop.ts +122 -3
- package/src/interactive/overlays/keybinding-detail.ts +2 -2
- package/src/interactive/overlays/library-lifecycle.ts +90 -0
- package/src/interactive/overlays/library-model.ts +574 -0
- package/src/interactive/overlays/library-review.ts +557 -0
- package/src/interactive/overlays/library-tabs.ts +3 -15
- package/src/interactive/overlays/library.ts +602 -0
- package/src/interactive/overlays/list-overlay.ts +218 -39
- package/src/interactive/overlays/model-selector.ts +28 -25
- package/src/interactive/overlays/session-selector.ts +9 -3
- package/src/interactive/overlays/settings.ts +25 -18
- package/src/interactive/overlays/tree-selector.ts +16 -11
- package/src/interactive/permission-hint.ts +13 -0
- package/src/interactive/permission-overlay.ts +77 -28
- package/src/interactive/prewarm.ts +11 -197
- package/src/interactive/prompt-source-label.ts +21 -0
- package/src/interactive/renderers/reference-card.ts +35 -0
- package/src/interactive/renderers/worker-entry.ts +35 -3
- package/src/interactive/session-usage-reseed.ts +2 -0
- package/src/interactive/side-question.ts +2 -0
- package/src/interactive/slash-autocomplete.ts +99 -1
- package/src/interactive/slash-commands.ts +390 -67
- package/src/interactive/slash-spec.ts +0 -1
- package/src/interactive/terminal-lease.ts +44 -12
- package/src/interactive/turn-context.ts +1 -0
- package/src/interactive/turn-persistence.ts +3 -0
- package/src/interactive/turn-prewarm.ts +126 -19
- package/src/interactive/turn-queues.ts +8 -7
- package/src/interactive/turn-runtime.ts +15 -1
- package/src/interactive/view/view-overlay.ts +19 -14
- package/src/interactive/welcome-dashboard.ts +525 -408
- package/src/tools/bootstrap.ts +8 -0
- package/src/tools/builtin-tool-catalog.ts +15 -6
- package/src/tools/context/index.ts +58 -5
- package/src/tools/context/library.ts +465 -0
- package/src/tools/context/surface.ts +20 -6
- package/src/tools/core-bootstrap.ts +3 -0
- package/src/tools/dispatch-admission.ts +24 -1
- package/src/tools/dispatch-arguments.ts +8 -0
- package/src/tools/dispatch-plan.ts +32 -0
- package/src/tools/dispatch-schema.ts +31 -1
- package/src/tools/dispatch-types.ts +3 -0
- package/src/tools/dispatch.ts +1 -1
- package/src/tools/harness-extensions.ts +169 -0
- package/src/tools/observation.ts +4 -0
- package/src/tools/policy.ts +7 -1
- package/src/tools/registry.ts +31 -3
- package/src/tools/worker-evidence.ts +5 -0
- package/src/worker/context-seed.ts +192 -0
- package/src/worker/entry.ts +1 -0
- package/src/worker/spec-contract.ts +35 -1
- package/dist/acp-UVEVWSDL.js +0 -130
- package/dist/agents-VWY37DTK.js +0 -148
- package/dist/auth-PCV2XQDV.js +0 -551
- package/dist/builtins-PD652MTK.js +0 -22
- package/dist/chunk-22PQ4TX4.js +0 -360
- package/dist/chunk-24T2YZ7A.js +0 -22648
- package/dist/chunk-2AKYFREM.js +0 -1008
- package/dist/chunk-2QPI3TR3.js +0 -162
- package/dist/chunk-3BJGMT2D.js +0 -324
- package/dist/chunk-3HQVBIKD.js +0 -308
- package/dist/chunk-3JLFK5MW.js +0 -193
- package/dist/chunk-3O2ZAUGQ.js +0 -283
- package/dist/chunk-3QKXHCGS.js +0 -59
- package/dist/chunk-3T4DXWP6.js +0 -668
- package/dist/chunk-3UW3KU4A.js +0 -21
- package/dist/chunk-3WBALRQH.js +0 -5076
- package/dist/chunk-4DU2TVI4.js +0 -108
- package/dist/chunk-4U4TKZFR.js +0 -5052
- package/dist/chunk-4VMV6OS6.js +0 -101
- package/dist/chunk-536HXRFE.js +0 -1257
- package/dist/chunk-5CMARGPF.js +0 -477
- package/dist/chunk-5CY4Q6QI.js +0 -141
- package/dist/chunk-5QRX7SLS.js +0 -1018
- package/dist/chunk-5VTJP36Q.js +0 -36
- package/dist/chunk-5ZSZEYJK.js +0 -119
- package/dist/chunk-6HAO6X5B.js +0 -197
- package/dist/chunk-6OII3LOK.js +0 -404
- package/dist/chunk-6RYDAVQT.js +0 -4338
- package/dist/chunk-6VRRJT7L.js +0 -146
- package/dist/chunk-6YA46L5A.js +0 -386
- package/dist/chunk-77CZRFTE.js +0 -634
- package/dist/chunk-7JSSKXG2.js +0 -1215
- package/dist/chunk-7WUZEB2M.js +0 -165
- package/dist/chunk-7YJWEF2L.js +0 -974
- package/dist/chunk-ACCKVSHU.js +0 -44
- package/dist/chunk-B3MOMLJ4.js +0 -433
- package/dist/chunk-BBV5TKE6.js +0 -35
- package/dist/chunk-BLTEAUCB.js +0 -668
- package/dist/chunk-BS4GAMUB.js +0 -233
- package/dist/chunk-BT7HGDOX.js +0 -3151
- package/dist/chunk-CBSKDFWL.js +0 -101
- package/dist/chunk-CXQ37WJH.js +0 -45
- package/dist/chunk-DXLUVUD4.js +0 -1490
- package/dist/chunk-DZK63TZJ.js +0 -1334
- package/dist/chunk-E7RF4KBO.js +0 -266
- package/dist/chunk-ECOMVOHP.js +0 -139
- package/dist/chunk-EHOSNVVM.js +0 -59
- package/dist/chunk-F5Z7EWMN.js +0 -4484
- package/dist/chunk-FQOOGXBH.js +0 -579
- package/dist/chunk-GLYBJ4RQ.js +0 -396
- package/dist/chunk-HHVJNVUJ.js +0 -179
- package/dist/chunk-HL26ADLH.js +0 -77
- package/dist/chunk-HPTJF6DG.js +0 -2465
- package/dist/chunk-HXHFDHB6.js +0 -962
- package/dist/chunk-HZ2T2YED.js +0 -1687
- package/dist/chunk-HZFBVU5X.js +0 -666
- package/dist/chunk-I2K2NCZQ.js +0 -659
- package/dist/chunk-IGLVVNEG.js +0 -402
- package/dist/chunk-IKRWLEDA.js +0 -1567
- package/dist/chunk-J2FYEQ5L.js +0 -33
- package/dist/chunk-JMPL7NUB.js +0 -108
- package/dist/chunk-K2HL3GBL.js +0 -998
- package/dist/chunk-KAFMW7WM.js +0 -386
- package/dist/chunk-KTFSFCVN.js +0 -46
- package/dist/chunk-LIN2K3EL.js +0 -66
- package/dist/chunk-LUL5Z66S.js +0 -221
- package/dist/chunk-LVFANMOH.js +0 -466
- package/dist/chunk-LY4N4TTL.js +0 -117
- package/dist/chunk-LZBMXNLP.js +0 -1196
- package/dist/chunk-M6TAYK66.js +0 -807
- package/dist/chunk-N2OKBREN.js +0 -243
- package/dist/chunk-NC4KV7EL.js +0 -39
- package/dist/chunk-NF3BK5WR.js +0 -42
- package/dist/chunk-NNWJYUNO.js +0 -573
- package/dist/chunk-NTK3WTHM.js +0 -141
- package/dist/chunk-ODUTYZIU.js +0 -688
- package/dist/chunk-OQM5IVJY.js +0 -1377
- package/dist/chunk-P5JMBPDJ.js +0 -7192
- package/dist/chunk-P5SC4DLJ.js +0 -47
- package/dist/chunk-P6M7RKMI.js +0 -97
- package/dist/chunk-PWWSIB2A.js +0 -52
- package/dist/chunk-PZN2LQY6.js +0 -674
- package/dist/chunk-Q7NNUHQV.js +0 -705
- package/dist/chunk-QCOV5DFY.js +0 -911
- package/dist/chunk-QNWRHOMF.js +0 -692
- package/dist/chunk-QRFXEO6Y.js +0 -17
- package/dist/chunk-QXFBABFJ.js +0 -380
- package/dist/chunk-RGZNQ5CT.js +0 -657
- package/dist/chunk-SRZOW5L2.js +0 -1865
- package/dist/chunk-SXQKNKRA.js +0 -223
- package/dist/chunk-T334FW2H.js +0 -362
- package/dist/chunk-T52TPHYC.js +0 -318
- package/dist/chunk-TJFDL26W.js +0 -658
- package/dist/chunk-TN5FW4XY.js +0 -172
- package/dist/chunk-U7H5WRG5.js +0 -123
- package/dist/chunk-UFYNOQK4.js +0 -302
- package/dist/chunk-URBGEOH3.js +0 -32
- package/dist/chunk-USZA7GWL.js +0 -341
- package/dist/chunk-UUQ5G6EZ.js +0 -697
- package/dist/chunk-VAHLPXPY.js +0 -399
- package/dist/chunk-VANN3GDP.js +0 -2488
- package/dist/chunk-VHMX7SXF.js +0 -1289
- package/dist/chunk-WJIMKGD6.js +0 -132
- package/dist/chunk-WKUYQBCG.js +0 -795
- package/dist/chunk-WNGF5AJX.js +0 -1911
- package/dist/chunk-WV6TDAPN.js +0 -3627
- package/dist/chunk-X3BI7HTV.js +0 -562
- package/dist/chunk-XWMSPJYN.js +0 -149
- package/dist/chunk-YPRSNUTC.js +0 -395
- package/dist/chunk-ZS43Y2FT.js +0 -438
- package/dist/clio-QQCMTUZE.js +0 -26
- package/dist/code-nav-GUPM6766.js +0 -686
- package/dist/components-TNIKXCBH.js +0 -674
- package/dist/config-IIM7YOD3.js +0 -621
- package/dist/configure-4ZM5HWJX.js +0 -73
- package/dist/context-44BZLJ3J.js +0 -344
- package/dist/context-AIDVQKMW.js +0 -278
- package/dist/context-OL5P3HEP.js +0 -1031
- package/dist/context-clear-OQV76MYP.js +0 -184
- package/dist/context-index-HP2JFUWA.js +0 -120
- package/dist/context-map-INTXD54D.js +0 -555
- package/dist/context-working-set-ZUW3EGLS.js +0 -1556
- package/dist/detail-UXPWRANG.js +0 -115
- package/dist/dispatch-runner-P3ZW6G77.js +0 -2438
- package/dist/docs-BL7ROUFN.js +0 -292
- package/dist/doctor-JJVGPZWT.js +0 -797
- package/dist/eval-V2RTN3UH.js +0 -4972
- package/dist/eval-inventory-QOYZERXJ.js +0 -315
- package/dist/evidence-35PYWGSO.js +0 -225
- package/dist/evidence-CIGGKI6J.js +0 -383
- package/dist/evolve-33SM3NJP.js +0 -609
- package/dist/extensions-YVRHX6ZI.js +0 -229
- package/dist/fleet-LFO7SIPC.js +0 -908
- package/dist/fleet-commands-RLK72GU3.js +0 -75
- package/dist/fleet-decisions-3SBSCTCW.js +0 -159
- package/dist/fleet-graph-JZIBCGMW.js +0 -134
- package/dist/fleet-inspect-2L5YGGZJ.js +0 -469
- package/dist/fleet-preflight-QRSHIIDE.js +0 -22
- package/dist/fleet-validate-LIAVKDUU.js +0 -92
- package/dist/fleet-verify-JIK3OQZR.js +0 -202
- package/dist/fleet-view-IWHYGQKK.js +0 -118
- package/dist/init-NJEDOTQW.js +0 -321
- package/dist/interop-RVCAYECG.js +0 -115
- package/dist/inventory-74UL7UHU.js +0 -118
- package/dist/library-CTKZA7K3.js +0 -226
- package/dist/memory-I76I5VUH.js +0 -512
- package/dist/models-D4YDIQZQ.js +0 -289
- package/dist/monitor-NKVD55HX.js +0 -775
- package/dist/orchestrator-I6OATVPK.js +0 -39518
- package/dist/panes-7BTYH3XQ.js +0 -103
- package/dist/panes-WPOMEMRH.js +0 -74
- package/dist/paths-J3KN7UAO.js +0 -67
- package/dist/preload-EJAWJEIO.js +0 -116
- package/dist/reset-4XMQKDNZ.js +0 -345
- package/dist/resources-TVYVXK3Q.js +0 -125
- package/dist/run-OWQNNSJU.js +0 -872
- package/dist/share-NPZZMUXG.js +0 -290
- package/dist/skills-OXFEAWMT.js +0 -510
- package/dist/skills-eval-J5TCKSJA.js +0 -1034
- package/dist/skills-inventory-7II4DM57.js +0 -133
- package/dist/slash-commands-MDSDSWYF.js +0 -92
- package/dist/steer-S7D7IKPU.js +0 -77
- package/dist/support-5VAEC32W.js +0 -38
- package/dist/targets-KILZEOCE.js +0 -1109
- package/dist/tasks-R6P6OV22.js +0 -36
- package/dist/terminal-lease-LZCG2KN3.js +0 -405
- package/dist/tools-6OCQ6SVB.js +0 -28
- package/dist/trace-JHLXWUMN.js +0 -572
- package/dist/tui-primitives-RCY2HN7G.js +0 -17
- package/dist/uninstall-FXYMFFRT.js +0 -407
- package/dist/upgrade-D2OZH6IQ.js +0 -307
- package/dist/usage-PIASNUS4.js +0 -1052
- package/dist/verifiers-LTHUY2PX.js +0 -630
- package/dist/verify-HYF7KBVE.js +0 -30
- package/dist/web-fetch-MQN4FH3X.js +0 -788
- package/dist/wiki-generate-RK7JQ5NP.js +0 -615
- package/dist/with-panes-OFTNAR4Y.js +0 -628
- package/skills/README.md +0 -418
- package/skills/coding/ast-grep/SKILL.md +0 -213
- package/skills/coding/ast-grep/evals.md +0 -82
- package/skills/coding/coding-standards/SKILL.md +0 -164
- package/skills/coding/coding-standards/evals.md +0 -57
- package/skills/coding/prototype/SKILL.md +0 -151
- package/skills/coding/prototype/evals.md +0 -61
- package/skills/coding/tdd/SKILL.md +0 -134
- package/skills/coding/tdd/evals.md +0 -61
- package/skills/context/context-handoff/SKILL.md +0 -176
- package/skills/context/context-handoff/evals.md +0 -101
- package/skills/context/context-prime/SKILL.md +0 -131
- package/skills/context/context-prime/evals.md +0 -99
- package/skills/git/branch-closeout/SKILL.md +0 -132
- package/skills/git/file-ticket/SKILL.md +0 -126
- package/skills/git/fix-issue/SKILL.md +0 -136
- package/skills/git/resolve-merge-conflicts/SKILL.md +0 -151
- package/skills/git/resolve-merge-conflicts/evals.md +0 -85
- package/skills/git/ship/SKILL.md +0 -134
- package/skills/git/worktree-create/SKILL.md +0 -127
- package/skills/git/worktree-merge/SKILL.md +0 -147
- package/skills/meta/clio-coder-dev/SKILL.md +0 -101
- package/skills/meta/clio-coder-dev/evals.md +0 -46
- package/skills/meta/clio-coder-test/SKILL.md +0 -146
- package/skills/meta/clio-coder-test/evals.md +0 -48
- package/skills/meta/clio-coder-test/references/test-map.md +0 -96
- package/skills/meta/credentials/SKILL.md +0 -132
- package/skills/meta/credentials/evals.md +0 -104
- package/skills/meta/find-skills/SKILL.md +0 -78
- package/skills/meta/find-skills/evals.md +0 -47
- package/skills/meta/herdr/SKILL.md +0 -133
- package/skills/meta/herdr/evals.md +0 -38
- package/skills/meta/skill-craft/SKILL.md +0 -125
- package/skills/meta/skill-craft/evals.md +0 -41
- package/skills/planning/archify/SKILL.md +0 -196
- package/skills/planning/architecture/SKILL.md +0 -184
- package/skills/planning/architecture/evals.md +0 -101
- package/skills/planning/backlog/SKILL.md +0 -212
- package/skills/planning/backlog/evals.md +0 -185
- package/skills/planning/prd/SKILL.md +0 -129
- package/skills/planning/prd/evals.md +0 -103
- package/skills/planning/product-intent/SKILL.md +0 -173
- package/skills/planning/product-intent/evals.md +0 -106
- package/skills/planning/tech-spec/SKILL.md +0 -172
- package/skills/planning/tech-spec/evals.md +0 -120
- package/skills/registry.yaml +0 -144
- package/skills/remote.yaml +0 -13
- package/skills/research/arxiv-literature/SKILL.md +0 -168
- package/skills/research/arxiv-literature/evals.md +0 -108
- package/skills/research/experiment-protocol/SKILL.md +0 -148
- package/skills/research/experiment-protocol/evals.md +0 -114
- package/skills/research/scientific-debugging/SKILL.md +0 -149
- package/skills/research/scientific-debugging/evals.md +0 -156
- package/skills/research/scientific-modernization/SKILL.md +0 -170
- package/skills/research/scientific-modernization/evals.md +0 -111
- package/skills/skill-marketplace.json +0 -507
- package/skills/workflow/cut-it/SKILL.md +0 -153
- package/skills/workflow/cut-it/evals.md +0 -143
- package/skills/workflow/design-council/SKILL.md +0 -233
- package/skills/workflow/design-council/evals.md +0 -258
- package/skills/workflow/grill-me/SKILL.md +0 -267
- package/skills/workflow/grill-me/evals.md +0 -231
- package/skills/workflow/workflow-distiller/SKILL.md +0 -201
- package/skills/workflow/workflow-distiller/evals.md +0 -225
- package/src/domains/extensions/resource-path.ts +0 -27
- package/src/domains/extensions/resources.ts +0 -37
- package/src/domains/lifecycle/migrations/2026-09-01-extension-install-digests.ts +0 -27
- package/src/interactive/overlays/agents.ts +0 -70
- package/src/interactive/overlays/library-install-confirm.ts +0 -152
- package/src/interactive/overlays/prompts.ts +0 -89
- package/src/interactive/overlays/skills-hub.ts +0 -615
- /package/{skills → library/skills}/coding/ast-grep/references/rule_reference.md +0 -0
- /package/{skills → library/skills}/coding/prototype/references/LOGIC.md +0 -0
- /package/{skills → library/skills}/coding/prototype/references/UI.md +0 -0
- /package/{skills → library/skills}/coding/tdd/references/mocking.md +0 -0
- /package/{skills → library/skills}/coding/tdd/references/tests.md +0 -0
- /package/{skills → library/skills}/context/context-handoff/scripts/new-handoff.sh +0 -0
- /package/{skills → library/skills}/git/branch-closeout/evals.md +0 -0
- /package/{skills → library/skills}/git/branch-closeout/references/closeout-checklist.md +0 -0
- /package/{skills → library/skills}/git/file-ticket/assets/issue-template.md +0 -0
- /package/{skills → library/skills}/git/file-ticket/evals.md +0 -0
- /package/{skills → library/skills}/git/file-ticket/references/issue-discovery.md +0 -0
- /package/{skills → library/skills}/git/fix-issue/evals.md +0 -0
- /package/{skills → library/skills}/git/fix-issue/references/diagnosis-and-rca.md +0 -0
- /package/{skills → library/skills}/git/resolve-merge-conflicts/references/conflict-matrix.md +0 -0
- /package/{skills → library/skills}/git/ship/assets/pr-template.md +0 -0
- /package/{skills → library/skills}/git/ship/evals.md +0 -0
- /package/{skills → library/skills}/git/ship/references/remote-and-branch-policy.md +0 -0
- /package/{skills → library/skills}/git/worktree-create/evals.md +0 -0
- /package/{skills → library/skills}/git/worktree-create/references/worktree-setup.md +0 -0
- /package/{skills → library/skills}/git/worktree-merge/evals.md +0 -0
- /package/{skills → library/skills}/git/worktree-merge/references/merge-strategies.md +0 -0
- /package/{skills → library/skills}/meta/clio-coder-test/references/harness.md +0 -0
- /package/{skills → library/skills}/planning/archify/evals.md +0 -0
|
@@ -1,1556 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_KEEP_RECENT_TOKENS,
|
|
4
|
-
buildEvictionFields,
|
|
5
|
-
estimateTokens,
|
|
6
|
-
findCutPoint,
|
|
7
|
-
isProtected,
|
|
8
|
-
planEviction,
|
|
9
|
-
projectWorkingSet,
|
|
10
|
-
resolveWorkingSetPolicy,
|
|
11
|
-
tokensFreedByEviction
|
|
12
|
-
} from "./chunk-UUQ5G6EZ.js";
|
|
13
|
-
import {
|
|
14
|
-
EMPTY_WORKING_SET_VIEW,
|
|
15
|
-
buildPathIndex,
|
|
16
|
-
callPathsByToolCallId,
|
|
17
|
-
covers,
|
|
18
|
-
foldWorkingSet,
|
|
19
|
-
isTurnStart,
|
|
20
|
-
protectionCutoffIndex,
|
|
21
|
-
selectVisibleEntries
|
|
22
|
-
} from "./chunk-DBREN25X.js";
|
|
23
|
-
import {
|
|
24
|
-
parseSessionEntries
|
|
25
|
-
} from "./chunk-DXLUVUD4.js";
|
|
26
|
-
import {
|
|
27
|
-
filterEntriesToActivePath
|
|
28
|
-
} from "./chunk-O5F25NIE.js";
|
|
29
|
-
import "./chunk-QH3ZTUOA.js";
|
|
30
|
-
import "./chunk-DNHVRBH4.js";
|
|
31
|
-
import "./chunk-YPRSNUTC.js";
|
|
32
|
-
import "./chunk-KECNXMDE.js";
|
|
33
|
-
import {
|
|
34
|
-
isSessionHeader
|
|
35
|
-
} from "./chunk-KAFMW7WM.js";
|
|
36
|
-
import "./chunk-MCJKEGHO.js";
|
|
37
|
-
import "./chunk-77CZRFTE.js";
|
|
38
|
-
import "./chunk-M6TAYK66.js";
|
|
39
|
-
import "./chunk-KQ6IDQIB.js";
|
|
40
|
-
import "./chunk-NTTS3O53.js";
|
|
41
|
-
import "./chunk-M4KFUXS7.js";
|
|
42
|
-
import "./chunk-EM2WNQS2.js";
|
|
43
|
-
import "./chunk-FQOOGXBH.js";
|
|
44
|
-
import {
|
|
45
|
-
assertSafeId
|
|
46
|
-
} from "./chunk-UHW5V7HC.js";
|
|
47
|
-
import "./chunk-EHOSNVVM.js";
|
|
48
|
-
import "./chunk-KMF54VH3.js";
|
|
49
|
-
import "./chunk-HL26ADLH.js";
|
|
50
|
-
import "./chunk-CVDAFGPW.js";
|
|
51
|
-
import "./chunk-PPEZJWUG.js";
|
|
52
|
-
import "./chunk-WDV62RKY.js";
|
|
53
|
-
import "./chunk-E3LEPLQ2.js";
|
|
54
|
-
import {
|
|
55
|
-
DEFAULT_WORKING_SET_SETTINGS
|
|
56
|
-
} from "./chunk-U2MSJ57E.js";
|
|
57
|
-
import "./chunk-ZZFWWYLX.js";
|
|
58
|
-
import {
|
|
59
|
-
clioStatePath
|
|
60
|
-
} from "./chunk-CTTI7G3T.js";
|
|
61
|
-
import {
|
|
62
|
-
init_esm_shims
|
|
63
|
-
} from "./chunk-ECBHH7LU.js";
|
|
64
|
-
|
|
65
|
-
// src/cli/context-working-set.ts
|
|
66
|
-
init_esm_shims();
|
|
67
|
-
import { execFileSync } from "node:child_process";
|
|
68
|
-
import { mkdir, readdir as readdir2, readFile as readFile2, stat as stat2, writeFile } from "node:fs/promises";
|
|
69
|
-
import { basename as basename2, dirname as dirname2, join as join2, resolve as resolve2 } from "node:path";
|
|
70
|
-
|
|
71
|
-
// src/domains/context/working-set/replay/controls.ts
|
|
72
|
-
init_esm_shims();
|
|
73
|
-
|
|
74
|
-
// src/domains/context/working-set/replay/trace.ts
|
|
75
|
-
init_esm_shims();
|
|
76
|
-
function countReplayTurns(entries) {
|
|
77
|
-
let count = 0;
|
|
78
|
-
for (const entry of entries) {
|
|
79
|
-
if (isTurnStart(entry)) count += 1;
|
|
80
|
-
}
|
|
81
|
-
return count;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// src/domains/context/working-set/replay/controls.ts
|
|
85
|
-
function controlId(id) {
|
|
86
|
-
return id;
|
|
87
|
-
}
|
|
88
|
-
function eligibleToolResults(input) {
|
|
89
|
-
const cutoff = protectionCutoffIndex(input.entries, input.settings.protectLastTurns);
|
|
90
|
-
const index = buildPathIndex(input.entries, { cwd: input.cwd });
|
|
91
|
-
const out = [];
|
|
92
|
-
for (let entryIndex = cutoff - 1; entryIndex >= 0; entryIndex -= 1) {
|
|
93
|
-
const entry = input.entries[entryIndex];
|
|
94
|
-
if (entry?.kind !== "message" || entry.role !== "tool_result") continue;
|
|
95
|
-
if (input.view.evicted.has(entry.turnId)) continue;
|
|
96
|
-
if (isProtected(entry, { entryIndex, cutoffIndex: cutoff, input, index })) continue;
|
|
97
|
-
out.push(entry);
|
|
98
|
-
}
|
|
99
|
-
return out;
|
|
100
|
-
}
|
|
101
|
-
function takeToTarget(input, entries) {
|
|
102
|
-
let tokensNeeded = Math.max(0, input.pressure.tokens - input.pressure.target * input.pressure.contextWindow);
|
|
103
|
-
if (tokensNeeded <= 0) return [];
|
|
104
|
-
const selected = [];
|
|
105
|
-
const callPaths = callPathsByToolCallId(input.entries);
|
|
106
|
-
for (const entry of entries) {
|
|
107
|
-
const candidate = { ref: { entry: entry.turnId }, reason: "age_horizon" };
|
|
108
|
-
selected.push(candidate);
|
|
109
|
-
tokensNeeded -= tokensFreedByEviction(input.estimateTokens, entry, candidate, callPaths);
|
|
110
|
-
if (tokensNeeded <= 0) break;
|
|
111
|
-
}
|
|
112
|
-
return selected;
|
|
113
|
-
}
|
|
114
|
-
function makeOraclePolicy(graph) {
|
|
115
|
-
let lastInput = null;
|
|
116
|
-
let lastCandidateCount = 0;
|
|
117
|
-
const safeEntries = (input) => {
|
|
118
|
-
const currentTurn = countReplayTurns(input.entries) + 1;
|
|
119
|
-
return eligibleToolResults(input).filter((entry) => {
|
|
120
|
-
const futureTurns = graph.futureTurnsOf.get(entry.turnId) ?? [];
|
|
121
|
-
return futureTurns.every((turn) => turn < currentTurn);
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
return {
|
|
125
|
-
id: controlId("oracle"),
|
|
126
|
-
select(input) {
|
|
127
|
-
const safe = safeEntries(input);
|
|
128
|
-
lastInput = input;
|
|
129
|
-
lastCandidateCount = safe.length;
|
|
130
|
-
return takeToTarget(input, safe);
|
|
131
|
-
},
|
|
132
|
-
replayCandidateCount(input) {
|
|
133
|
-
return input === lastInput ? lastCandidateCount : safeEntries(input).length;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function mulberry32(seed) {
|
|
138
|
-
let value = seed >>> 0;
|
|
139
|
-
return () => {
|
|
140
|
-
value = value + 1831565813 >>> 0;
|
|
141
|
-
let next = value;
|
|
142
|
-
next = Math.imul(next ^ next >>> 15, next | 1);
|
|
143
|
-
next ^= next + Math.imul(next ^ next >>> 7, next | 61);
|
|
144
|
-
return ((next ^ next >>> 14) >>> 0) / 4294967296;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function makeRandomPolicy(seed) {
|
|
148
|
-
let lastInput = null;
|
|
149
|
-
let lastCandidateCount = 0;
|
|
150
|
-
return {
|
|
151
|
-
id: controlId("random"),
|
|
152
|
-
select(input) {
|
|
153
|
-
const entries = [...eligibleToolResults(input)];
|
|
154
|
-
lastInput = input;
|
|
155
|
-
lastCandidateCount = entries.length;
|
|
156
|
-
const random = mulberry32(seed);
|
|
157
|
-
for (let index = entries.length - 1; index > 0; index -= 1) {
|
|
158
|
-
const swap = Math.floor(random() * (index + 1));
|
|
159
|
-
const value = entries[index];
|
|
160
|
-
entries[index] = entries[swap];
|
|
161
|
-
entries[swap] = value;
|
|
162
|
-
}
|
|
163
|
-
return takeToTarget(input, entries);
|
|
164
|
-
},
|
|
165
|
-
replayCandidateCount(input) {
|
|
166
|
-
return input === lastInput ? lastCandidateCount : eligibleToolResults(input).length;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
var nonePolicy = {
|
|
171
|
-
id: controlId("none"),
|
|
172
|
-
select: () => []
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
// src/domains/context/working-set/replay/load-clio.ts
|
|
176
|
-
init_esm_shims();
|
|
177
|
-
import { readdir, readFile, stat } from "node:fs/promises";
|
|
178
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
179
|
-
|
|
180
|
-
// src/domains/context/working-set/replay/reference-graph.ts
|
|
181
|
-
init_esm_shims();
|
|
182
|
-
var READ_CLASS_OPS = /* @__PURE__ */ new Set(["read", "grep", "find", "ls", "code_nav"]);
|
|
183
|
-
var MUTATION_OPS = /* @__PURE__ */ new Set(["write", "edit"]);
|
|
184
|
-
function isToolResult(entry) {
|
|
185
|
-
return entry?.kind === "message" && entry.role === "tool_result";
|
|
186
|
-
}
|
|
187
|
-
function isReadableObservation(observation) {
|
|
188
|
-
return !observation.isError && observation.path.length > 0 && READ_CLASS_OPS.has(observation.op);
|
|
189
|
-
}
|
|
190
|
-
function edgeKey(edge) {
|
|
191
|
-
return `${edge.from}\0${edge.toTurnIndex}\0${edge.kind}`;
|
|
192
|
-
}
|
|
193
|
-
function buildReferenceGraph(trace, index) {
|
|
194
|
-
const entryById = new Map(trace.entries.map((entry) => [entry.turnId, entry]));
|
|
195
|
-
const edges = [];
|
|
196
|
-
const seenEdges = /* @__PURE__ */ new Set();
|
|
197
|
-
const future = /* @__PURE__ */ new Map();
|
|
198
|
-
const add = (edge) => {
|
|
199
|
-
const key = edgeKey(edge);
|
|
200
|
-
if (seenEdges.has(key)) return;
|
|
201
|
-
seenEdges.add(key);
|
|
202
|
-
edges.push(edge);
|
|
203
|
-
if (edge.kind === "file_rewrite") return;
|
|
204
|
-
const turns = future.get(edge.from);
|
|
205
|
-
if (turns === void 0) future.set(edge.from, /* @__PURE__ */ new Set([edge.toTurnIndex]));
|
|
206
|
-
else turns.add(edge.toTurnIndex);
|
|
207
|
-
};
|
|
208
|
-
for (const earlier of index.observations) {
|
|
209
|
-
if (!isToolResult(entryById.get(earlier.ref.entry)) || !isReadableObservation(earlier)) continue;
|
|
210
|
-
const surfaced = new Set(earlier.surfaced);
|
|
211
|
-
for (const later of index.observations) {
|
|
212
|
-
if (later.entryIndex <= earlier.entryIndex) continue;
|
|
213
|
-
if (isReadableObservation(later) && later.path === earlier.path) {
|
|
214
|
-
add({ from: earlier.ref.entry, toTurnIndex: later.turnIndex, kind: "file_reread" });
|
|
215
|
-
}
|
|
216
|
-
if (isReadableObservation(later) && surfaced.has(later.path)) {
|
|
217
|
-
add({ from: earlier.ref.entry, toTurnIndex: later.turnIndex, kind: "file_discovery" });
|
|
218
|
-
}
|
|
219
|
-
if (later.path === earlier.path && MUTATION_OPS.has(later.op)) {
|
|
220
|
-
add({ from: earlier.ref.entry, toTurnIndex: later.turnIndex, kind: "file_rewrite" });
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
const futureTurnsOf = /* @__PURE__ */ new Map();
|
|
225
|
-
for (const [ref, turns] of future)
|
|
226
|
-
futureTurnsOf.set(
|
|
227
|
-
ref,
|
|
228
|
-
[...turns].sort((a, b) => a - b)
|
|
229
|
-
);
|
|
230
|
-
return { edges, futureTurnsOf };
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// src/domains/context/working-set/replay/load-clio.ts
|
|
234
|
-
var DEFAULT_FILTER = {
|
|
235
|
-
minTurns: 8,
|
|
236
|
-
minToolResults: 8,
|
|
237
|
-
requireFileReread: true
|
|
238
|
-
};
|
|
239
|
-
async function collectLedgerFiles(input, out) {
|
|
240
|
-
const path = resolve(input);
|
|
241
|
-
let facts;
|
|
242
|
-
try {
|
|
243
|
-
facts = await stat(path);
|
|
244
|
-
} catch {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (facts.isFile()) {
|
|
248
|
-
if (path.endsWith(".jsonl")) out.add(path);
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (!facts.isDirectory()) return;
|
|
252
|
-
const direct = join(path, "current.jsonl");
|
|
253
|
-
try {
|
|
254
|
-
if ((await stat(direct)).isFile()) {
|
|
255
|
-
out.add(direct);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
} catch {
|
|
259
|
-
}
|
|
260
|
-
let children;
|
|
261
|
-
try {
|
|
262
|
-
children = await readdir(path, { withFileTypes: true });
|
|
263
|
-
} catch {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
for (const child of children.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
267
|
-
if (!child.isDirectory()) continue;
|
|
268
|
-
await collectLedgerFiles(join(path, child.name), out);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
function sessionFacts(raw, source) {
|
|
272
|
-
const fallback = { id: basename(dirname(source)), cwd: null };
|
|
273
|
-
for (const line of raw.split("\n")) {
|
|
274
|
-
if (line.trim().length === 0) continue;
|
|
275
|
-
try {
|
|
276
|
-
const value = JSON.parse(line);
|
|
277
|
-
if (isSessionHeader(value)) return { id: value.id, cwd: value.cwd.length > 0 ? value.cwd : null };
|
|
278
|
-
} catch {
|
|
279
|
-
return fallback;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return fallback;
|
|
283
|
-
}
|
|
284
|
-
async function pinnedLeafTurnId(source) {
|
|
285
|
-
try {
|
|
286
|
-
const raw = await readFile(join(dirname(source), "meta.json"), "utf8");
|
|
287
|
-
const value = JSON.parse(raw);
|
|
288
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
289
|
-
const pinned = value.pinnedLeafTurnId;
|
|
290
|
-
return typeof pinned === "string" && pinned.length > 0 ? pinned : void 0;
|
|
291
|
-
} catch {
|
|
292
|
-
return void 0;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function cleanActiveEntries(entries, activeLeafTurnId) {
|
|
296
|
-
return filterEntriesToActivePath(entries, activeLeafTurnId).filter(
|
|
297
|
-
(entry) => entry.kind !== "contextEviction" && entry.kind !== "contextRecall"
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
function toolResultCount(entries) {
|
|
301
|
-
let count = 0;
|
|
302
|
-
for (const entry of entries) {
|
|
303
|
-
if (entry.kind === "message" && entry.role === "tool_result") count += 1;
|
|
304
|
-
}
|
|
305
|
-
return count;
|
|
306
|
-
}
|
|
307
|
-
async function loadClioTraces(paths, options = {}) {
|
|
308
|
-
const discovered = /* @__PURE__ */ new Set();
|
|
309
|
-
let missingInputs = 0;
|
|
310
|
-
for (const path of paths) {
|
|
311
|
-
const before = discovered.size;
|
|
312
|
-
await collectLedgerFiles(path, discovered);
|
|
313
|
-
if (discovered.size === before) {
|
|
314
|
-
try {
|
|
315
|
-
await stat(resolve(path));
|
|
316
|
-
} catch {
|
|
317
|
-
missingInputs += 1;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
const filtered = {
|
|
322
|
-
turns_lt_8: 0,
|
|
323
|
-
tool_results_lt_8: 0,
|
|
324
|
-
no_file_reread: 0
|
|
325
|
-
};
|
|
326
|
-
const cascade = {
|
|
327
|
-
found: discovered.size,
|
|
328
|
-
unreadable: missingInputs,
|
|
329
|
-
filtered,
|
|
330
|
-
kept: 0
|
|
331
|
-
};
|
|
332
|
-
const traces = [];
|
|
333
|
-
const filter = options.filter === false ? null : {
|
|
334
|
-
minTurns: options.filter?.minTurns ?? DEFAULT_FILTER.minTurns,
|
|
335
|
-
minToolResults: options.filter?.minToolResults ?? DEFAULT_FILTER.minToolResults,
|
|
336
|
-
requireFileReread: options.filter?.requireFileReread ?? DEFAULT_FILTER.requireFileReread
|
|
337
|
-
};
|
|
338
|
-
for (const source of [...discovered].sort((a, b) => a.localeCompare(b))) {
|
|
339
|
-
let raw;
|
|
340
|
-
try {
|
|
341
|
-
raw = await readFile(source, "utf8");
|
|
342
|
-
} catch {
|
|
343
|
-
cascade.unreadable += 1;
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
const parsed = parseSessionEntries(raw, source);
|
|
347
|
-
if (parsed.errors.length > 0) {
|
|
348
|
-
cascade.unreadable += 1;
|
|
349
|
-
continue;
|
|
350
|
-
}
|
|
351
|
-
const entries = cleanActiveEntries(parsed.entries, await pinnedLeafTurnId(source));
|
|
352
|
-
const facts = sessionFacts(raw, source);
|
|
353
|
-
const trace = {
|
|
354
|
-
id: facts.id,
|
|
355
|
-
source,
|
|
356
|
-
cwd: facts.cwd,
|
|
357
|
-
entries,
|
|
358
|
-
turnCount: countReplayTurns(entries)
|
|
359
|
-
};
|
|
360
|
-
if (filter !== null) {
|
|
361
|
-
if (trace.turnCount < filter.minTurns) {
|
|
362
|
-
filtered.turns_lt_8 = (filtered.turns_lt_8 ?? 0) + 1;
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
|
-
if (toolResultCount(entries) < filter.minToolResults) {
|
|
366
|
-
filtered.tool_results_lt_8 = (filtered.tool_results_lt_8 ?? 0) + 1;
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
if (filter.requireFileReread) {
|
|
370
|
-
const graph = buildReferenceGraph(trace, buildPathIndex(entries, { cwd: trace.cwd }));
|
|
371
|
-
if (!graph.edges.some((edge) => edge.kind === "file_reread")) {
|
|
372
|
-
filtered.no_file_reread = (filtered.no_file_reread ?? 0) + 1;
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
traces.push(trace);
|
|
378
|
-
}
|
|
379
|
-
cascade.kept = traces.length;
|
|
380
|
-
return { traces, cascade };
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// src/domains/context/working-set/replay/metrics.ts
|
|
384
|
-
init_esm_shims();
|
|
385
|
-
function safeFraction(numerator, denominator, empty) {
|
|
386
|
-
return denominator === 0 ? empty : numerator / denominator;
|
|
387
|
-
}
|
|
388
|
-
function survivesThrough(observation, referenceTurn, evictedAtTurn) {
|
|
389
|
-
const evictedAt = evictedAtTurn.get(observation.ref.entry);
|
|
390
|
-
return evictedAt === void 0 || evictedAt > referenceTurn;
|
|
391
|
-
}
|
|
392
|
-
function hasSurvivingCoveringRead(input, ref, referenceTurn) {
|
|
393
|
-
const original = input.index.byRef.get(ref);
|
|
394
|
-
if (original?.op !== "read" || original.path.length === 0) return false;
|
|
395
|
-
return (input.index.byPath.get(original.path) ?? []).some(
|
|
396
|
-
(later) => later.op === "read" && !later.isError && later.entryIndex > original.entryIndex && later.turnIndex < referenceTurn && covers(later.range, original.range) && survivesThrough(later, referenceTurn, input.replay.evictedAtTurn)
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
function measure(input) {
|
|
400
|
-
let pairs = 0;
|
|
401
|
-
let retainedPairs = 0;
|
|
402
|
-
let coveredRetainedPairs = 0;
|
|
403
|
-
let pairsAt10 = 0;
|
|
404
|
-
let retainedPairsAt10 = 0;
|
|
405
|
-
for (const [ref, futureTurns] of input.graph.futureTurnsOf) {
|
|
406
|
-
const observationTurn = input.index.byRef.get(ref)?.turnIndex;
|
|
407
|
-
const evictedAt = input.replay.evictedAtTurn.get(ref);
|
|
408
|
-
for (const referenceTurn of futureTurns) {
|
|
409
|
-
pairs += 1;
|
|
410
|
-
const retained = evictedAt === void 0 || evictedAt > referenceTurn;
|
|
411
|
-
if (retained) retainedPairs += 1;
|
|
412
|
-
if (retained || hasSurvivingCoveringRead(input, ref, referenceTurn)) coveredRetainedPairs += 1;
|
|
413
|
-
if (observationTurn !== void 0 && referenceTurn - observationTurn <= 10) {
|
|
414
|
-
pairsAt10 += 1;
|
|
415
|
-
if (retained) retainedPairsAt10 += 1;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
let evictedItems = 0;
|
|
420
|
-
let safelyEvictedItems = 0;
|
|
421
|
-
let tokensEvicted = 0;
|
|
422
|
-
let recallTokens = 0;
|
|
423
|
-
let coldPrefixTokens2 = 0;
|
|
424
|
-
let saturatedEventCount = 0;
|
|
425
|
-
for (const event of input.replay.events) {
|
|
426
|
-
if (event.saturated) saturatedEventCount += 1;
|
|
427
|
-
coldPrefixTokens2 += event.coldPrefixTokens;
|
|
428
|
-
for (const item of event.items) {
|
|
429
|
-
evictedItems += 1;
|
|
430
|
-
tokensEvicted += item.tokensFreed;
|
|
431
|
-
const future = input.graph.futureTurnsOf.get(item.ref.entry) ?? [];
|
|
432
|
-
if (!future.some((turn) => turn > event.turnIndex)) safelyEvictedItems += 1;
|
|
433
|
-
else recallTokens += item.tokensFreed;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
metrics: {
|
|
438
|
-
traces: 1,
|
|
439
|
-
retention: safeFraction(retainedPairs, pairs, 1),
|
|
440
|
-
retentionCovered: safeFraction(coveredRetainedPairs, pairs, 1),
|
|
441
|
-
retentionAt10: safeFraction(retainedPairsAt10, pairsAt10, 1),
|
|
442
|
-
evictionPrecision: safeFraction(safelyEvictedItems, evictedItems, 1),
|
|
443
|
-
tokensEvicted,
|
|
444
|
-
recallTokens,
|
|
445
|
-
coldPrefixTokens: coldPrefixTokens2,
|
|
446
|
-
evictionEvents: input.replay.events.length,
|
|
447
|
-
saturatedEvents: safeFraction(saturatedEventCount, input.replay.events.length, 0),
|
|
448
|
-
turnsToFirstSummary: input.replay.turnsToFirstSummary,
|
|
449
|
-
summaries: input.replay.summaries
|
|
450
|
-
},
|
|
451
|
-
pairs,
|
|
452
|
-
retainedPairs,
|
|
453
|
-
coveredRetainedPairs,
|
|
454
|
-
pairsAt10,
|
|
455
|
-
retainedPairsAt10,
|
|
456
|
-
saturatedEventCount
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
function mean(values) {
|
|
460
|
-
return values.length === 0 ? 0 : values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
461
|
-
}
|
|
462
|
-
function aggregateReplayMetrics(inputs) {
|
|
463
|
-
const measured = inputs.map(measure);
|
|
464
|
-
const firstSummaries = measured.map((entry) => entry.metrics.turnsToFirstSummary).filter((value) => value !== null);
|
|
465
|
-
const sum = (field) => measured.reduce((total, entry) => total + entry[field], 0);
|
|
466
|
-
const totalEvents = measured.reduce((total, entry) => total + entry.metrics.evictionEvents, 0);
|
|
467
|
-
const saturatedEvents = measured.reduce((total, entry) => total + entry.saturatedEventCount, 0);
|
|
468
|
-
return {
|
|
469
|
-
mean: {
|
|
470
|
-
traces: measured.length,
|
|
471
|
-
retention: measured.length === 0 ? 1 : mean(measured.map((entry) => entry.metrics.retention)),
|
|
472
|
-
retentionCovered: measured.length === 0 ? 1 : mean(measured.map((entry) => entry.metrics.retentionCovered)),
|
|
473
|
-
retentionAt10: measured.length === 0 ? 1 : mean(measured.map((entry) => entry.metrics.retentionAt10)),
|
|
474
|
-
evictionPrecision: measured.length === 0 ? 1 : mean(measured.map((entry) => entry.metrics.evictionPrecision)),
|
|
475
|
-
tokensEvicted: mean(measured.map((entry) => entry.metrics.tokensEvicted)),
|
|
476
|
-
recallTokens: mean(measured.map((entry) => entry.metrics.recallTokens)),
|
|
477
|
-
coldPrefixTokens: mean(measured.map((entry) => entry.metrics.coldPrefixTokens)),
|
|
478
|
-
evictionEvents: mean(measured.map((entry) => entry.metrics.evictionEvents)),
|
|
479
|
-
// Event-pooled: zero-event traces must not dilute the saturation rate.
|
|
480
|
-
saturatedEvents: safeFraction(saturatedEvents, totalEvents, 0),
|
|
481
|
-
turnsToFirstSummary: firstSummaries.length === 0 ? null : mean(firstSummaries),
|
|
482
|
-
summaries: mean(measured.map((entry) => entry.metrics.summaries))
|
|
483
|
-
},
|
|
484
|
-
turnsToFirstSummaryCount: firstSummaries.length,
|
|
485
|
-
pooledRetention: safeFraction(sum("retainedPairs"), sum("pairs"), 1),
|
|
486
|
-
pooledRetentionCovered: safeFraction(sum("coveredRetainedPairs"), sum("pairs"), 1),
|
|
487
|
-
pooledRetentionAt10: safeFraction(sum("retainedPairsAt10"), sum("pairsAt10"), 1)
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// src/domains/context/working-set/replay/report.ts
|
|
492
|
-
init_esm_shims();
|
|
493
|
-
function metricObject(metrics, turnsToFirstSummaryCount) {
|
|
494
|
-
return {
|
|
495
|
-
traces: metrics.traces,
|
|
496
|
-
retention: metrics.retention,
|
|
497
|
-
retentionCovered: metrics.retentionCovered,
|
|
498
|
-
retentionAt10: metrics.retentionAt10,
|
|
499
|
-
evictionPrecision: metrics.evictionPrecision,
|
|
500
|
-
tokensEvicted: metrics.tokensEvicted,
|
|
501
|
-
recallTokens: metrics.recallTokens,
|
|
502
|
-
coldPrefixTokens: metrics.coldPrefixTokens,
|
|
503
|
-
evictionEvents: metrics.evictionEvents,
|
|
504
|
-
saturatedEvents: metrics.saturatedEvents,
|
|
505
|
-
turnsToFirstSummary: metrics.turnsToFirstSummary,
|
|
506
|
-
turnsToFirstSummaryCount,
|
|
507
|
-
summaries: metrics.summaries
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
function renderReplayJson(input) {
|
|
511
|
-
const filtered = Object.fromEntries(Object.entries(input.cascade.filtered).sort(([a], [b]) => a.localeCompare(b)));
|
|
512
|
-
const artifact = {
|
|
513
|
-
schema: "clio-coder-context-replay-v2",
|
|
514
|
-
config: {
|
|
515
|
-
policies: [...input.config.policies],
|
|
516
|
-
budgets: [...input.config.budgets],
|
|
517
|
-
threshold: input.config.threshold,
|
|
518
|
-
target: input.config.target,
|
|
519
|
-
seed: input.config.seed,
|
|
520
|
-
corpus: [...input.config.corpus],
|
|
521
|
-
filter: input.config.filter,
|
|
522
|
-
settings: {
|
|
523
|
-
enabled: input.config.settings.enabled,
|
|
524
|
-
policy: input.config.settings.policy,
|
|
525
|
-
target: input.config.settings.target,
|
|
526
|
-
protectLastTurns: input.config.settings.protectLastTurns,
|
|
527
|
-
minEvictableTokens: input.config.settings.minEvictableTokens
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
provenance: {
|
|
531
|
-
gitSha: input.gitSha,
|
|
532
|
-
commandLine: [...input.commandLine]
|
|
533
|
-
},
|
|
534
|
-
cascade: {
|
|
535
|
-
found: input.cascade.found,
|
|
536
|
-
unreadable: input.cascade.unreadable,
|
|
537
|
-
filtered,
|
|
538
|
-
kept: input.cascade.kept
|
|
539
|
-
},
|
|
540
|
-
results: input.results.map((result) => ({
|
|
541
|
-
budgetTokens: result.budgetTokens,
|
|
542
|
-
policyId: result.policyId,
|
|
543
|
-
metrics: {
|
|
544
|
-
mean: metricObject(result.metrics.mean, result.metrics.turnsToFirstSummaryCount),
|
|
545
|
-
pooledRetention: result.metrics.pooledRetention,
|
|
546
|
-
pooledRetentionCovered: result.metrics.pooledRetentionCovered,
|
|
547
|
-
pooledRetentionAt10: result.metrics.pooledRetentionAt10
|
|
548
|
-
}
|
|
549
|
-
}))
|
|
550
|
-
};
|
|
551
|
-
return `${JSON.stringify(artifact, null, " ")}
|
|
552
|
-
`;
|
|
553
|
-
}
|
|
554
|
-
function ratio(value) {
|
|
555
|
-
return value.toFixed(3);
|
|
556
|
-
}
|
|
557
|
-
function quantity(value) {
|
|
558
|
-
return Number.isInteger(value) ? String(value) : value.toFixed(1);
|
|
559
|
-
}
|
|
560
|
-
function cascadeRows(cascade) {
|
|
561
|
-
return [
|
|
562
|
-
`| found | ${cascade.found} |`,
|
|
563
|
-
`| unreadable | ${cascade.unreadable} |`,
|
|
564
|
-
...Object.entries(cascade.filtered).map(([stage, count]) => `| ${stage} | ${count} |`),
|
|
565
|
-
`| kept | ${cascade.kept} |`
|
|
566
|
-
];
|
|
567
|
-
}
|
|
568
|
-
function renderReplayMarkdown(input) {
|
|
569
|
-
const lines = [
|
|
570
|
-
"# Clio working-set replay",
|
|
571
|
-
"",
|
|
572
|
-
"## Inclusion cascade",
|
|
573
|
-
"",
|
|
574
|
-
"| stage | traces |",
|
|
575
|
-
"| --- | ---: |",
|
|
576
|
-
...cascadeRows(input.cascade)
|
|
577
|
-
];
|
|
578
|
-
for (const budget of input.config.budgets) {
|
|
579
|
-
lines.push(
|
|
580
|
-
"",
|
|
581
|
-
`## Budget ${budget}`,
|
|
582
|
-
"",
|
|
583
|
-
"| policy | n | retention (mean) | retention (pooled) | retention covered (mean) | retention covered (pooled) | retention@10 (mean) | eviction precision (mean) | tokens evicted (mean) | recall tokens (mean) | cold prefix tokens (mean) | eviction events (mean) | saturated events | turns to first summary (mean) | summaries (mean) |",
|
|
584
|
-
"| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |"
|
|
585
|
-
);
|
|
586
|
-
for (const policy of input.config.policies) {
|
|
587
|
-
const result = input.results.find((entry) => entry.budgetTokens === budget && entry.policyId === policy);
|
|
588
|
-
if (result === void 0) continue;
|
|
589
|
-
const metrics = result.metrics.mean;
|
|
590
|
-
lines.push(
|
|
591
|
-
`| ${policy} | ${metrics.traces} | ${ratio(metrics.retention)} | ${ratio(result.metrics.pooledRetention)} | ${ratio(metrics.retentionCovered)} | ${ratio(result.metrics.pooledRetentionCovered)} | ${ratio(metrics.retentionAt10)} | ${ratio(metrics.evictionPrecision)} | ${quantity(metrics.tokensEvicted)} | ${quantity(metrics.recallTokens)} | ${quantity(metrics.coldPrefixTokens)} | ${quantity(metrics.evictionEvents)} | ${ratio(metrics.saturatedEvents)} | ${metrics.turnsToFirstSummary === null ? "\u2014" : quantity(metrics.turnsToFirstSummary)} (n=${result.metrics.turnsToFirstSummaryCount}) | ${quantity(metrics.summaries)} |`
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
lines.push("");
|
|
596
|
-
return lines.join("\n");
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// src/domains/context/working-set/replay/runner.ts
|
|
600
|
-
init_esm_shims();
|
|
601
|
-
function sumTokens(entries) {
|
|
602
|
-
let tokens = 0;
|
|
603
|
-
for (const entry of entries) tokens += estimateTokens(entry);
|
|
604
|
-
return tokens;
|
|
605
|
-
}
|
|
606
|
-
function hasCandidatePool(policy) {
|
|
607
|
-
return "replayCandidateCount" in policy && typeof policy.replayCandidateCount === "function";
|
|
608
|
-
}
|
|
609
|
-
function latestCompactionIndex(entries) {
|
|
610
|
-
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
611
|
-
if (entries[index]?.kind === "compactionSummary") return index;
|
|
612
|
-
}
|
|
613
|
-
return -1;
|
|
614
|
-
}
|
|
615
|
-
function eventSaturated(policy, input, plan) {
|
|
616
|
-
if (policy.id === "age-horizon") return true;
|
|
617
|
-
const targetTokens = input.pressure.target * input.pressure.contextWindow;
|
|
618
|
-
if (policy.id === "structural-v1") {
|
|
619
|
-
const thresholdTokens = input.pressure.threshold * input.pressure.contextWindow;
|
|
620
|
-
const usedAgeRung = plan.items.some((item) => item.reason === "age_horizon");
|
|
621
|
-
return plan.tokensAfter > targetTokens && (plan.tokensAfter > thresholdTokens || usedAgeRung);
|
|
622
|
-
}
|
|
623
|
-
if (hasCandidatePool(policy)) return plan.items.length === policy.replayCandidateCount(input);
|
|
624
|
-
return plan.tokensAfter > targetTokens;
|
|
625
|
-
}
|
|
626
|
-
function rebuildProjection(soFar, leaf, view) {
|
|
627
|
-
const raw = selectVisibleEntries(soFar, leaf ?? void 0);
|
|
628
|
-
const projected = projectWorkingSet(raw, view);
|
|
629
|
-
return {
|
|
630
|
-
raw,
|
|
631
|
-
projected,
|
|
632
|
-
indexByTurnId: new Map(raw.map((entry, index) => [entry.turnId, index])),
|
|
633
|
-
tokens: sumTokens(projected)
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
function projectAppendedEntry(entry, state, view) {
|
|
637
|
-
if (view.evictionEvents === 0) return entry;
|
|
638
|
-
const lastEventId = view.lastEvictionTurnId;
|
|
639
|
-
if (lastEventId !== null && state.indexByTurnId.has(lastEventId)) {
|
|
640
|
-
return entry;
|
|
641
|
-
}
|
|
642
|
-
return projectWorkingSet([entry], view)[0] ?? entry;
|
|
643
|
-
}
|
|
644
|
-
function appendVisibleEntry(entry, state, view) {
|
|
645
|
-
const projected = projectAppendedEntry(entry, state, view);
|
|
646
|
-
state.indexByTurnId.set(entry.turnId, state.raw.length);
|
|
647
|
-
state.raw.push(entry);
|
|
648
|
-
state.projected.push(projected);
|
|
649
|
-
state.tokens += estimateTokens(projected);
|
|
650
|
-
}
|
|
651
|
-
function applyEvictionProjection(state, synthetic, view, items) {
|
|
652
|
-
const affected = /* @__PURE__ */ new Set();
|
|
653
|
-
for (const item of items) {
|
|
654
|
-
const index = state.indexByTurnId.get(item.ref.entry);
|
|
655
|
-
if (index !== void 0) affected.add(index);
|
|
656
|
-
}
|
|
657
|
-
for (let index = 0; index < state.raw.length - 1; index += 1) {
|
|
658
|
-
const entry = state.raw[index];
|
|
659
|
-
if (entry?.kind === "message" && entry.role === "assistant") affected.add(index);
|
|
660
|
-
}
|
|
661
|
-
for (const index of affected) {
|
|
662
|
-
const source = state.raw[index];
|
|
663
|
-
const before = state.projected[index];
|
|
664
|
-
if (source === void 0 || before === void 0) continue;
|
|
665
|
-
const after = projectWorkingSet([source, synthetic], view)[0] ?? source;
|
|
666
|
-
state.projected[index] = after;
|
|
667
|
-
state.tokens += estimateTokens(after) - estimateTokens(before);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function coldPrefixTokens(state, items) {
|
|
671
|
-
let cut = state.projected.length;
|
|
672
|
-
for (const item of items) {
|
|
673
|
-
const index = state.indexByTurnId.get(item.ref.entry);
|
|
674
|
-
if (index !== void 0 && index < cut) cut = index;
|
|
675
|
-
}
|
|
676
|
-
let tokens = 0;
|
|
677
|
-
for (let index = cut; index < state.projected.length; index += 1) {
|
|
678
|
-
const entry = state.projected[index];
|
|
679
|
-
if (entry !== void 0) tokens += estimateTokens(entry);
|
|
680
|
-
}
|
|
681
|
-
return tokens;
|
|
682
|
-
}
|
|
683
|
-
function replayTrace(trace, policy, config) {
|
|
684
|
-
const soFar = [];
|
|
685
|
-
const events = [];
|
|
686
|
-
const evictedAtTurn = /* @__PURE__ */ new Map();
|
|
687
|
-
const toolResults = new Set(
|
|
688
|
-
trace.entries.filter((entry) => entry.kind === "message" && entry.role === "tool_result").map((entry) => entry.turnId)
|
|
689
|
-
);
|
|
690
|
-
let evictionSequence = 0;
|
|
691
|
-
let summaries = 0;
|
|
692
|
-
let turnIndex = 0;
|
|
693
|
-
let turnsToFirstSummary = null;
|
|
694
|
-
let lastMessageTurnId = null;
|
|
695
|
-
let view = EMPTY_WORKING_SET_VIEW;
|
|
696
|
-
let visible = { raw: [], projected: [], indexByTurnId: /* @__PURE__ */ new Map(), tokens: 0 };
|
|
697
|
-
const pressureLimit = config.threshold * config.budgetTokens;
|
|
698
|
-
for (const entry of trace.entries) {
|
|
699
|
-
if (isTurnStart(entry)) {
|
|
700
|
-
turnIndex += 1;
|
|
701
|
-
const leaf = lastMessageTurnId;
|
|
702
|
-
const tokens = visible.tokens;
|
|
703
|
-
if (tokens > pressureLimit) {
|
|
704
|
-
const input = {
|
|
705
|
-
entries: visible.raw,
|
|
706
|
-
view,
|
|
707
|
-
cwd: trace.cwd,
|
|
708
|
-
settings: config.settings,
|
|
709
|
-
pressure: {
|
|
710
|
-
tokens,
|
|
711
|
-
contextWindow: config.budgetTokens,
|
|
712
|
-
threshold: config.threshold,
|
|
713
|
-
target: config.target
|
|
714
|
-
},
|
|
715
|
-
estimateTokens
|
|
716
|
-
};
|
|
717
|
-
const plan = planEviction(policy, input);
|
|
718
|
-
if (plan !== null) {
|
|
719
|
-
const saturated = eventSaturated(policy, input, plan);
|
|
720
|
-
evictionSequence += 1;
|
|
721
|
-
const previous = soFar[soFar.length - 1];
|
|
722
|
-
const synthetic = {
|
|
723
|
-
...buildEvictionFields(plan, {
|
|
724
|
-
trigger: "pressure",
|
|
725
|
-
pressureBefore: tokens / config.budgetTokens,
|
|
726
|
-
snapshotIdBefore: null
|
|
727
|
-
}),
|
|
728
|
-
turnId: `replay-evict-${evictionSequence}`,
|
|
729
|
-
parentTurnId: leaf,
|
|
730
|
-
timestamp: previous?.timestamp ?? entry.timestamp
|
|
731
|
-
};
|
|
732
|
-
soFar.push(synthetic);
|
|
733
|
-
appendVisibleEntry(synthetic, visible, view);
|
|
734
|
-
view = foldWorkingSet(soFar, leaf ?? void 0);
|
|
735
|
-
applyEvictionProjection(visible, synthetic, view, plan.items);
|
|
736
|
-
events.push({
|
|
737
|
-
turnIndex,
|
|
738
|
-
items: plan.items,
|
|
739
|
-
tokensBefore: plan.tokensBefore,
|
|
740
|
-
tokensAfter: plan.tokensAfter,
|
|
741
|
-
saturated,
|
|
742
|
-
coldPrefixTokens: coldPrefixTokens(visible, plan.items)
|
|
743
|
-
});
|
|
744
|
-
for (const item of plan.items) {
|
|
745
|
-
if (toolResults.has(item.ref.entry) && !evictedAtTurn.has(item.ref.entry)) {
|
|
746
|
-
evictedAtTurn.set(item.ref.entry, turnIndex);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
if (visible.tokens > pressureLimit) {
|
|
751
|
-
if (turnsToFirstSummary === null) turnsToFirstSummary = turnIndex;
|
|
752
|
-
const previousCompactionIndex = latestCompactionIndex(soFar);
|
|
753
|
-
const boundaryStart = previousCompactionIndex + 1;
|
|
754
|
-
const cut = config.summaries === void 0 ? boundaryStart : findCutPoint(soFar, config.summaries.keepRecentTokens, { startIndex: boundaryStart }).firstKeptEntryIndex;
|
|
755
|
-
if (config.summaries !== void 0 && cut > boundaryStart) {
|
|
756
|
-
summaries += 1;
|
|
757
|
-
const visibleBefore = new Set(visible.raw.map((candidate) => candidate.turnId));
|
|
758
|
-
const previous = soFar[soFar.length - 1];
|
|
759
|
-
const firstKeptTurnId = soFar[cut]?.turnId ?? "";
|
|
760
|
-
const synthetic = {
|
|
761
|
-
kind: "compactionSummary",
|
|
762
|
-
turnId: `replay-summary-${summaries}`,
|
|
763
|
-
parentTurnId: firstKeptTurnId || null,
|
|
764
|
-
timestamp: previous?.timestamp ?? entry.timestamp,
|
|
765
|
-
summary: "#".repeat(config.summaries.summaryTokens * 4),
|
|
766
|
-
tokensBefore: visible.tokens,
|
|
767
|
-
firstKeptTurnId
|
|
768
|
-
};
|
|
769
|
-
soFar.push(synthetic);
|
|
770
|
-
visible = rebuildProjection(soFar, lastMessageTurnId, view);
|
|
771
|
-
const visibleAfter = new Set(visible.raw.map((candidate) => candidate.turnId));
|
|
772
|
-
for (const removed of visibleBefore) {
|
|
773
|
-
if (toolResults.has(removed) && !visibleAfter.has(removed) && !evictedAtTurn.has(removed)) {
|
|
774
|
-
evictedAtTurn.set(removed, turnIndex);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
soFar.push(entry);
|
|
782
|
-
if (entry.kind === "compactionSummary") visible = rebuildProjection(soFar, lastMessageTurnId, view);
|
|
783
|
-
else appendVisibleEntry(entry, visible, view);
|
|
784
|
-
if (entry.kind === "message") lastMessageTurnId = entry.turnId;
|
|
785
|
-
}
|
|
786
|
-
return {
|
|
787
|
-
traceId: trace.id,
|
|
788
|
-
policyId: config.policyId,
|
|
789
|
-
budgetTokens: config.budgetTokens,
|
|
790
|
-
turnCount: trace.turnCount,
|
|
791
|
-
events,
|
|
792
|
-
evictedAtTurn,
|
|
793
|
-
turnsToFirstSummary,
|
|
794
|
-
summaries,
|
|
795
|
-
entries: soFar
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
// src/domains/context/working-set/replay/synthetic.ts
|
|
800
|
-
init_esm_shims();
|
|
801
|
-
var SYNTHETIC_CORPORA = [
|
|
802
|
-
{
|
|
803
|
-
id: "science-long",
|
|
804
|
-
seed: 7,
|
|
805
|
-
traces: 8,
|
|
806
|
-
turns: 300,
|
|
807
|
-
files: 48,
|
|
808
|
-
returnProbability: 0.3,
|
|
809
|
-
zipfExponent: 1,
|
|
810
|
-
scripts: { explore: 1, implement: 3, validate: 2, analyze: 2 },
|
|
811
|
-
fileLines: [12, 96],
|
|
812
|
-
simulationLines: [100, 2400],
|
|
813
|
-
offloadAfterLines: 200
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
id: "refactor",
|
|
817
|
-
seed: 11,
|
|
818
|
-
traces: 8,
|
|
819
|
-
turns: 200,
|
|
820
|
-
files: 64,
|
|
821
|
-
returnProbability: 0.4,
|
|
822
|
-
zipfExponent: 1,
|
|
823
|
-
scripts: { explore: 1, implement: 5, validate: 2, analyze: 0 },
|
|
824
|
-
fileLines: [16, 110],
|
|
825
|
-
simulationLines: [100, 400],
|
|
826
|
-
offloadAfterLines: 200
|
|
827
|
-
},
|
|
828
|
-
{
|
|
829
|
-
id: "exploration",
|
|
830
|
-
seed: 13,
|
|
831
|
-
traces: 8,
|
|
832
|
-
turns: 200,
|
|
833
|
-
files: 120,
|
|
834
|
-
returnProbability: 0.15,
|
|
835
|
-
zipfExponent: 1,
|
|
836
|
-
scripts: { explore: 4, implement: 1, validate: 1, analyze: 1 },
|
|
837
|
-
fileLines: [10, 64],
|
|
838
|
-
simulationLines: [100, 800],
|
|
839
|
-
offloadAfterLines: 200
|
|
840
|
-
}
|
|
841
|
-
];
|
|
842
|
-
function syntheticCorpus(id) {
|
|
843
|
-
return SYNTHETIC_CORPORA.find((spec) => spec.id === id);
|
|
844
|
-
}
|
|
845
|
-
function mulberry322(seed) {
|
|
846
|
-
let value = seed >>> 0;
|
|
847
|
-
return () => {
|
|
848
|
-
value = value + 1831565813 >>> 0;
|
|
849
|
-
let next = value;
|
|
850
|
-
next = Math.imul(next ^ next >>> 15, next | 1);
|
|
851
|
-
next ^= next + Math.imul(next ^ next >>> 7, next | 61);
|
|
852
|
-
return ((next ^ next >>> 14) >>> 0) / 4294967296;
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
function powerLawRank(size, exponent, draw) {
|
|
856
|
-
const upper = size + 1;
|
|
857
|
-
const sample = exponent === 1 ? upper ** draw : (1 + draw * (upper ** (1 - exponent) - 1)) ** (1 / (1 - exponent));
|
|
858
|
-
return Math.min(size - 1, Math.max(0, Math.floor(sample) - 1));
|
|
859
|
-
}
|
|
860
|
-
var DIRECTORIES = ["src/sim", "src/io", "src/analysis", "src/mesh", "tests", "scripts", "configs"];
|
|
861
|
-
var STEMS = ["solver", "reader", "writer", "grid", "field", "boundary", "stepper", "metrics", "plot", "checkpoint"];
|
|
862
|
-
var EXTENSIONS = ["py", "py", "py", "c", "h", "yaml", "toml"];
|
|
863
|
-
var CONSUMED_LISTING_READ_LIMIT = 48;
|
|
864
|
-
var CONSUMED_LISTING_SAMPLE_LINES = 20;
|
|
865
|
-
var Ledger = class {
|
|
866
|
-
constructor(cwd) {
|
|
867
|
-
this.cwd = cwd;
|
|
868
|
-
}
|
|
869
|
-
cwd;
|
|
870
|
-
entries = [];
|
|
871
|
-
parent = null;
|
|
872
|
-
sequence = 0;
|
|
873
|
-
calls = 0;
|
|
874
|
-
next(kind) {
|
|
875
|
-
this.sequence += 1;
|
|
876
|
-
const turnId = `${kind}-${String(this.sequence).padStart(5, "0")}`;
|
|
877
|
-
const stamp = {
|
|
878
|
-
turnId,
|
|
879
|
-
parentTurnId: this.parent,
|
|
880
|
-
timestamp: new Date(1787e9 + this.sequence * 1e3).toISOString()
|
|
881
|
-
};
|
|
882
|
-
this.parent = turnId;
|
|
883
|
-
return stamp;
|
|
884
|
-
}
|
|
885
|
-
user(text) {
|
|
886
|
-
this.entries.push({ kind: "message", ...this.next("user"), role: "user", payload: { text } });
|
|
887
|
-
}
|
|
888
|
-
assistant(thinking, text) {
|
|
889
|
-
this.entries.push({
|
|
890
|
-
kind: "message",
|
|
891
|
-
...this.next("assistant"),
|
|
892
|
-
role: "assistant",
|
|
893
|
-
payload: {
|
|
894
|
-
content: [
|
|
895
|
-
{ type: "thinking", thinking },
|
|
896
|
-
{ type: "text", text }
|
|
897
|
-
]
|
|
898
|
-
}
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
call(name, args, text, options = {}) {
|
|
902
|
-
this.calls += 1;
|
|
903
|
-
const toolCallId = `call-${String(this.calls).padStart(5, "0")}`;
|
|
904
|
-
this.entries.push({ kind: "message", ...this.next("call"), role: "tool_call", payload: { toolCallId, name, args } });
|
|
905
|
-
const details = options.offload === true ? { resultDisposition: { offloadPath: `${this.cwd}/.clio-state/scratch/${toolCallId}.txt` } } : void 0;
|
|
906
|
-
this.entries.push({
|
|
907
|
-
kind: "message",
|
|
908
|
-
...this.next("result"),
|
|
909
|
-
role: "tool_result",
|
|
910
|
-
payload: {
|
|
911
|
-
toolCallId,
|
|
912
|
-
toolName: name,
|
|
913
|
-
result: { content: [{ type: "text", text }], ...details === void 0 ? {} : { details } },
|
|
914
|
-
isError: options.isError === true
|
|
915
|
-
}
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
};
|
|
919
|
-
function fileBody(file, offset = 0, limit = null) {
|
|
920
|
-
const end = limit === null ? file.lines : Math.min(file.lines, offset + limit);
|
|
921
|
-
const lines = [];
|
|
922
|
-
for (let line = offset + 1; line <= end; line += 1) {
|
|
923
|
-
lines.push(`${String(line).padStart(4, " ")} ${file.path}@v${file.version}: x[${line}] = f(x[${line - 1}]) + eps`);
|
|
924
|
-
}
|
|
925
|
-
return lines.join("\n");
|
|
926
|
-
}
|
|
927
|
-
function simulationOutput(lines, seed) {
|
|
928
|
-
const rnd = mulberry322(seed);
|
|
929
|
-
const out = [];
|
|
930
|
-
for (let step = 0; step < lines; step += 1) {
|
|
931
|
-
out.push(
|
|
932
|
-
`step ${String(step).padStart(5, "0")} t=${(step * 0.01).toFixed(2)} e=${(1 - rnd() * 1e-3).toFixed(6)} r=${(rnd() * 1e-6).toExponential(2)}`
|
|
933
|
-
);
|
|
934
|
-
}
|
|
935
|
-
return out.join("\n");
|
|
936
|
-
}
|
|
937
|
-
function testOutput(files, failing) {
|
|
938
|
-
const out = [
|
|
939
|
-
"============================= test session starts =============================",
|
|
940
|
-
`collected ${files.length * 4} items`,
|
|
941
|
-
""
|
|
942
|
-
];
|
|
943
|
-
for (const file of files) {
|
|
944
|
-
for (let case_ = 1; case_ <= 4; case_ += 1) {
|
|
945
|
-
out.push(
|
|
946
|
-
`${file.path}::test_${file.path.replace(/\W/g, "_")}_${case_} ${file === failing && case_ === 3 ? "FAILED" : "PASSED"} [${String(Math.round(100 * case_ / 4)).padStart(3, " ")}%]`
|
|
947
|
-
);
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
if (failing !== null) {
|
|
951
|
-
const line = Math.max(1, Math.floor(failing.lines / 2));
|
|
952
|
-
out.push(
|
|
953
|
-
"",
|
|
954
|
-
"=================================== FAILURES ===================================",
|
|
955
|
-
`____________________ test_${failing.path.replace(/\W/g, "_")}_3 ____________________`,
|
|
956
|
-
""
|
|
957
|
-
);
|
|
958
|
-
for (let frame = 0; frame < 12; frame += 1) {
|
|
959
|
-
out.push(
|
|
960
|
-
` File "${failing.path}", line ${line + frame}, in step_${frame}`,
|
|
961
|
-
` residual = advance(state, dt) # frame ${frame}`
|
|
962
|
-
);
|
|
963
|
-
}
|
|
964
|
-
out.push(
|
|
965
|
-
"",
|
|
966
|
-
"AssertionError: residual 3.2e-4 exceeds tolerance 1e-6",
|
|
967
|
-
`FAILED ${failing.path}::test_${failing.path.replace(/\W/g, "_")}_3`
|
|
968
|
-
);
|
|
969
|
-
}
|
|
970
|
-
out.push(
|
|
971
|
-
"",
|
|
972
|
-
`${failing === null ? files.length * 4 : files.length * 4 - 1} passed, ${failing === null ? 0 : 1} failed`
|
|
973
|
-
);
|
|
974
|
-
return out.join("\n");
|
|
975
|
-
}
|
|
976
|
-
function generateSyntheticTrace(spec, index) {
|
|
977
|
-
const rnd = mulberry322(spec.seed * 1e3 + index);
|
|
978
|
-
const between = (low, high) => low + Math.floor(rnd() * (high - low + 1));
|
|
979
|
-
const pick = (items) => items[Math.floor(rnd() * items.length)];
|
|
980
|
-
const cwd = `/synthetic/${spec.id}-${index}`;
|
|
981
|
-
const ledger = new Ledger(cwd);
|
|
982
|
-
const repo = [];
|
|
983
|
-
for (let file = 0; file < spec.files; file += 1) {
|
|
984
|
-
const dir = DIRECTORIES[file % DIRECTORIES.length];
|
|
985
|
-
const stem = STEMS[Math.floor(file / DIRECTORIES.length) % STEMS.length];
|
|
986
|
-
const ext = EXTENSIONS[file % EXTENSIONS.length];
|
|
987
|
-
repo.push({
|
|
988
|
-
path: `${dir}/${stem}${Math.floor(file / (DIRECTORIES.length * STEMS.length)) || ""}.${ext}`,
|
|
989
|
-
lines: between(spec.fileLines[0], spec.fileLines[1]),
|
|
990
|
-
version: 1
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
const zipf = () => repo[powerLawRank(repo.length, spec.zipfExponent, rnd())];
|
|
994
|
-
const scriptNames = Object.keys(spec.scripts).flatMap(
|
|
995
|
-
(name) => Array.from({ length: spec.scripts[name] }, () => name)
|
|
996
|
-
);
|
|
997
|
-
const history = [];
|
|
998
|
-
let treeListings = 0;
|
|
999
|
-
const readWhole = (file) => ledger.call("read", { path: file.path }, fileBody(file));
|
|
1000
|
-
const readListingPath = (file) => ledger.call(
|
|
1001
|
-
"read",
|
|
1002
|
-
{ path: file.path, offset: 1, limit: CONSUMED_LISTING_SAMPLE_LINES },
|
|
1003
|
-
fileBody(file, 0, CONSUMED_LISTING_SAMPLE_LINES)
|
|
1004
|
-
);
|
|
1005
|
-
const readRange = (file) => {
|
|
1006
|
-
const limit = between(20, 80);
|
|
1007
|
-
const offset = between(1, Math.max(1, file.lines - limit));
|
|
1008
|
-
ledger.call("read", { path: file.path, offset, limit }, fileBody(file, offset - 1, limit));
|
|
1009
|
-
};
|
|
1010
|
-
const edit = (file) => {
|
|
1011
|
-
file.version += 1;
|
|
1012
|
-
ledger.call(
|
|
1013
|
-
"edit",
|
|
1014
|
-
{ path: file.path, edits: [{ oldText: `v${file.version - 1}`, newText: `v${file.version}` }] },
|
|
1015
|
-
`Applied 1 edit to ${file.path}`
|
|
1016
|
-
);
|
|
1017
|
-
};
|
|
1018
|
-
const runTests = (focus, failing) => ledger.call(
|
|
1019
|
-
"bash",
|
|
1020
|
-
{ command: `pytest ${focus.map((file) => file.path).join(" ")} -q` },
|
|
1021
|
-
testOutput(focus, failing),
|
|
1022
|
-
{ isError: failing !== null }
|
|
1023
|
-
);
|
|
1024
|
-
for (let turn = 0; turn < spec.turns; turn += 1) {
|
|
1025
|
-
const script = pick(scriptNames);
|
|
1026
|
-
const returning = history.length > 0 && rnd() < spec.returnProbability;
|
|
1027
|
-
const focus = returning ? pick(history) : Array.from({ length: between(1, 3) }, zipf);
|
|
1028
|
-
if (!returning) history.push(focus);
|
|
1029
|
-
const names = focus.map((file) => file.path).join(", ");
|
|
1030
|
-
ledger.user(`Episode ${turn + 1}: ${script} ${names}`);
|
|
1031
|
-
ledger.assistant(`Plan for ${script}: start from ${names} and keep the residual bounded.`, `Working on ${names}.`);
|
|
1032
|
-
switch (script) {
|
|
1033
|
-
case "explore": {
|
|
1034
|
-
const dir = pick(DIRECTORIES);
|
|
1035
|
-
const tree = rnd() < 0.6;
|
|
1036
|
-
const discovered = tree ? repo.slice(0, between(24, repo.length)) : repo.filter((file) => file.path.startsWith(`${dir}/`));
|
|
1037
|
-
const consumeListing = tree && treeListings % 7 === 0;
|
|
1038
|
-
if (tree) treeListings += 1;
|
|
1039
|
-
const listed = consumeListing ? repo.slice(0, CONSUMED_LISTING_READ_LIMIT) : discovered;
|
|
1040
|
-
const root = tree ? "." : dir;
|
|
1041
|
-
ledger.call(
|
|
1042
|
-
rnd() < 0.5 ? "find" : "ls",
|
|
1043
|
-
{ path: root },
|
|
1044
|
-
listed.map((file) => tree ? file.path : file.path.slice(dir.length + 1)).join("\n")
|
|
1045
|
-
);
|
|
1046
|
-
const term = pick(["residual", "checkpoint", "boundary", "tolerance"]);
|
|
1047
|
-
const matches = repo.filter(() => rnd() < 0.15).slice(0, 20);
|
|
1048
|
-
ledger.call(
|
|
1049
|
-
"grep",
|
|
1050
|
-
{ pattern: term, path: "src" },
|
|
1051
|
-
matches.map(
|
|
1052
|
-
(file) => `${file.path}:${between(1, file.lines)}: ${term} = compute_${term}(state, dt, tol=1e-6) # ${file.path}`
|
|
1053
|
-
).join("\n")
|
|
1054
|
-
);
|
|
1055
|
-
const walk = consumeListing ? listed : listed.slice(0, between(2, 4));
|
|
1056
|
-
for (const file of walk) (consumeListing ? readListingPath : readWhole)(file);
|
|
1057
|
-
for (const file of matches.slice(0, between(0, 2))) readWhole(file);
|
|
1058
|
-
break;
|
|
1059
|
-
}
|
|
1060
|
-
case "implement": {
|
|
1061
|
-
for (const file of focus) {
|
|
1062
|
-
readWhole(file);
|
|
1063
|
-
edit(file);
|
|
1064
|
-
if (rnd() < 0.7) readRange(file);
|
|
1065
|
-
}
|
|
1066
|
-
break;
|
|
1067
|
-
}
|
|
1068
|
-
case "validate": {
|
|
1069
|
-
const culprit = pick(focus);
|
|
1070
|
-
readWhole(culprit);
|
|
1071
|
-
runTests(focus, culprit);
|
|
1072
|
-
edit(culprit);
|
|
1073
|
-
runTests(focus, null);
|
|
1074
|
-
break;
|
|
1075
|
-
}
|
|
1076
|
-
case "analyze": {
|
|
1077
|
-
const lines = between(spec.simulationLines[0], spec.simulationLines[1]);
|
|
1078
|
-
const text = simulationOutput(lines, spec.seed + turn);
|
|
1079
|
-
const offload = lines > spec.offloadAfterLines;
|
|
1080
|
-
ledger.call(
|
|
1081
|
-
"bash",
|
|
1082
|
-
{ command: `python scripts/run_sim.py --config configs/run.yaml --steps ${lines}` },
|
|
1083
|
-
offload ? `${text.split("\n").slice(0, spec.offloadAfterLines).join("\n")}
|
|
1084
|
-
[tool result truncated]` : text,
|
|
1085
|
-
{ offload }
|
|
1086
|
-
);
|
|
1087
|
-
const results = pick(focus);
|
|
1088
|
-
readRange(results);
|
|
1089
|
-
if (rnd() < 0.5)
|
|
1090
|
-
ledger.call(
|
|
1091
|
-
"grep",
|
|
1092
|
-
{ pattern: "energy", path: results.path },
|
|
1093
|
-
`${results.path}:${between(1, results.lines)}: energy = 0.999`
|
|
1094
|
-
);
|
|
1095
|
-
break;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
ledger.assistant(`Checked ${names}; residual acceptable for this episode.`, `Done with episode ${turn + 1}.`);
|
|
1099
|
-
}
|
|
1100
|
-
const entries = ledger.entries;
|
|
1101
|
-
return {
|
|
1102
|
-
id: `${spec.id}-${String(index).padStart(2, "0")}`,
|
|
1103
|
-
source: `synthetic:${spec.id}#${index}`,
|
|
1104
|
-
cwd,
|
|
1105
|
-
entries,
|
|
1106
|
-
turnCount: countReplayTurns(entries)
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
function generateSyntheticCorpora(ids) {
|
|
1110
|
-
const traces = [];
|
|
1111
|
-
for (const id of ids) {
|
|
1112
|
-
const spec = syntheticCorpus(id);
|
|
1113
|
-
if (spec === void 0) throw new Error(`unknown synthetic corpus: ${id}`);
|
|
1114
|
-
for (let index = 0; index < spec.traces; index += 1) traces.push(generateSyntheticTrace(spec, index));
|
|
1115
|
-
}
|
|
1116
|
-
return { traces, cascade: { found: traces.length, unreadable: 0, filtered: {}, kept: traces.length } };
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
// src/cli/context-working-set.ts
|
|
1120
|
-
var REPLAY_HELP = `Usage:
|
|
1121
|
-
clio-coder context replay (--sessions <path>... | --synthetic <corpus>...) [options]
|
|
1122
|
-
|
|
1123
|
-
Options:
|
|
1124
|
-
--sessions <path>... Clio session directories, sessions roots, or ledger JSONL files
|
|
1125
|
-
--synthetic <ids> comma-separated procedural corpora: ${SYNTHETIC_CORPORA.map((spec) => spec.id).join(",")}
|
|
1126
|
-
--policies <ids> comma-separated none,random,age-horizon,structural-v1,oracle
|
|
1127
|
-
--budgets <tokens> comma-separated budgets (default: 16000,32000,64000)
|
|
1128
|
-
--threshold <ratio> pressure threshold (default: 0.8)
|
|
1129
|
-
--target <ratio> post-eviction pressure target (default: 0.6)
|
|
1130
|
-
--protect-last-turns <n>
|
|
1131
|
-
protected recent turns (default: ${DEFAULT_WORKING_SET_SETTINGS.protectLastTurns})
|
|
1132
|
-
--min-evictable-tokens <n>
|
|
1133
|
-
minimum tool-result body tokens (default: ${DEFAULT_WORKING_SET_SETTINGS.minEvictableTokens})
|
|
1134
|
-
--seed <integer> deterministic random-policy seed (default: 0)
|
|
1135
|
-
--no-filter include every readable transcript
|
|
1136
|
-
--json <path> write the stable JSON report
|
|
1137
|
-
--md <path> write Markdown instead of printing it
|
|
1138
|
-
`;
|
|
1139
|
-
var WORKING_SET_HELP = `Usage:
|
|
1140
|
-
clio-coder context working-set --session <id|path>
|
|
1141
|
-
|
|
1142
|
-
Print the durable working-set fold and path-index summary for one Clio session.
|
|
1143
|
-
`;
|
|
1144
|
-
var REPLAY_SUMMARY_TOKENS = 1500;
|
|
1145
|
-
var POLICY_IDS = ["none", "random", "age-horizon", "structural-v1", "oracle"];
|
|
1146
|
-
var CliUsageError = class extends Error {
|
|
1147
|
-
};
|
|
1148
|
-
function commaValues(value, flag) {
|
|
1149
|
-
const values = value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
1150
|
-
if (values.length === 0) throw new CliUsageError(`${flag} requires at least one value`);
|
|
1151
|
-
return [...new Set(values)];
|
|
1152
|
-
}
|
|
1153
|
-
function numberValue(value, flag) {
|
|
1154
|
-
const parsed = Number(value);
|
|
1155
|
-
if (!Number.isFinite(parsed)) throw new CliUsageError(`${flag} requires a finite number`);
|
|
1156
|
-
return parsed;
|
|
1157
|
-
}
|
|
1158
|
-
function requiredValue(args, index, flag) {
|
|
1159
|
-
const value = args[index + 1];
|
|
1160
|
-
if (value === void 0 || value.startsWith("--")) throw new CliUsageError(`${flag} requires a value`);
|
|
1161
|
-
return value;
|
|
1162
|
-
}
|
|
1163
|
-
function policyResolves(id) {
|
|
1164
|
-
if (id === "none" || id === "random" || id === "oracle") return true;
|
|
1165
|
-
try {
|
|
1166
|
-
resolveWorkingSetPolicy(id);
|
|
1167
|
-
return true;
|
|
1168
|
-
} catch {
|
|
1169
|
-
return false;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
function defaultPolicies() {
|
|
1173
|
-
return POLICY_IDS.filter(policyResolves);
|
|
1174
|
-
}
|
|
1175
|
-
function parseReplayArgs(args) {
|
|
1176
|
-
const parsed = {
|
|
1177
|
-
sessions: [],
|
|
1178
|
-
policies: defaultPolicies(),
|
|
1179
|
-
budgets: [16e3, 32e3, 64e3],
|
|
1180
|
-
threshold: 0.8,
|
|
1181
|
-
target: 0.6,
|
|
1182
|
-
protectLastTurns: DEFAULT_WORKING_SET_SETTINGS.protectLastTurns,
|
|
1183
|
-
minEvictableTokens: DEFAULT_WORKING_SET_SETTINGS.minEvictableTokens,
|
|
1184
|
-
seed: 0,
|
|
1185
|
-
synthetic: [],
|
|
1186
|
-
noFilter: false
|
|
1187
|
-
};
|
|
1188
|
-
let policiesExplicit = false;
|
|
1189
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
1190
|
-
const arg = args[index];
|
|
1191
|
-
if (arg === "--no-filter") {
|
|
1192
|
-
parsed.noFilter = true;
|
|
1193
|
-
continue;
|
|
1194
|
-
}
|
|
1195
|
-
if (arg === "--sessions") {
|
|
1196
|
-
let consumed = 0;
|
|
1197
|
-
while (index + 1 < args.length && !args[index + 1]?.startsWith("--")) {
|
|
1198
|
-
parsed.sessions.push(args[index + 1]);
|
|
1199
|
-
index += 1;
|
|
1200
|
-
consumed += 1;
|
|
1201
|
-
}
|
|
1202
|
-
if (consumed === 0) throw new CliUsageError("--sessions requires at least one path");
|
|
1203
|
-
continue;
|
|
1204
|
-
}
|
|
1205
|
-
if (arg === "--policies" || arg === "--budgets" || arg === "--synthetic" || arg === "--threshold" || arg === "--target" || arg === "--protect-last-turns" || arg === "--min-evictable-tokens" || arg === "--seed") {
|
|
1206
|
-
const value = requiredValue(args, index, arg);
|
|
1207
|
-
index += 1;
|
|
1208
|
-
if (arg === "--policies") {
|
|
1209
|
-
const values = commaValues(value, arg);
|
|
1210
|
-
const unknown = values.filter((entry) => !POLICY_IDS.includes(entry));
|
|
1211
|
-
if (unknown.length > 0) throw new CliUsageError(`unknown replay policy: ${unknown.join(", ")}`);
|
|
1212
|
-
parsed.policies = values;
|
|
1213
|
-
policiesExplicit = true;
|
|
1214
|
-
} else if (arg === "--budgets") {
|
|
1215
|
-
parsed.budgets = commaValues(value, arg).map((entry) => {
|
|
1216
|
-
const budget = numberValue(entry, arg);
|
|
1217
|
-
if (!Number.isInteger(budget) || budget <= 0) {
|
|
1218
|
-
throw new CliUsageError("--budgets values must be positive integers");
|
|
1219
|
-
}
|
|
1220
|
-
return budget;
|
|
1221
|
-
});
|
|
1222
|
-
} else if (arg === "--synthetic") {
|
|
1223
|
-
const values = commaValues(value, arg);
|
|
1224
|
-
const known = SYNTHETIC_CORPORA.map((spec) => spec.id);
|
|
1225
|
-
const unknown = values.filter((entry) => !known.includes(entry));
|
|
1226
|
-
if (unknown.length > 0) throw new CliUsageError(`unknown synthetic corpus: ${unknown.join(", ")}`);
|
|
1227
|
-
parsed.synthetic = values;
|
|
1228
|
-
} else if (arg === "--threshold") {
|
|
1229
|
-
parsed.threshold = numberValue(value, arg);
|
|
1230
|
-
if (parsed.threshold <= 0 || parsed.threshold > 1) {
|
|
1231
|
-
throw new CliUsageError("--threshold must be greater than 0 and at most 1");
|
|
1232
|
-
}
|
|
1233
|
-
} else if (arg === "--target") {
|
|
1234
|
-
parsed.target = numberValue(value, arg);
|
|
1235
|
-
if (parsed.target <= 0 || parsed.target >= 1) {
|
|
1236
|
-
throw new CliUsageError("--target must be greater than 0 and less than 1");
|
|
1237
|
-
}
|
|
1238
|
-
} else if (arg === "--protect-last-turns") {
|
|
1239
|
-
parsed.protectLastTurns = numberValue(value, arg);
|
|
1240
|
-
if (!Number.isInteger(parsed.protectLastTurns) || parsed.protectLastTurns < 1) {
|
|
1241
|
-
throw new CliUsageError("--protect-last-turns must be an integer at least 1");
|
|
1242
|
-
}
|
|
1243
|
-
} else if (arg === "--min-evictable-tokens") {
|
|
1244
|
-
parsed.minEvictableTokens = numberValue(value, arg);
|
|
1245
|
-
if (!Number.isInteger(parsed.minEvictableTokens) || parsed.minEvictableTokens < 0) {
|
|
1246
|
-
throw new CliUsageError("--min-evictable-tokens must be a non-negative integer");
|
|
1247
|
-
}
|
|
1248
|
-
} else {
|
|
1249
|
-
parsed.seed = numberValue(value, arg);
|
|
1250
|
-
if (!Number.isInteger(parsed.seed)) throw new CliUsageError("--seed must be an integer");
|
|
1251
|
-
}
|
|
1252
|
-
continue;
|
|
1253
|
-
}
|
|
1254
|
-
if (arg === "--json" || arg === "--md") {
|
|
1255
|
-
const value = requiredValue(args, index, arg);
|
|
1256
|
-
index += 1;
|
|
1257
|
-
if (arg === "--json") parsed.jsonPath = value;
|
|
1258
|
-
else parsed.markdownPath = value;
|
|
1259
|
-
continue;
|
|
1260
|
-
}
|
|
1261
|
-
throw new CliUsageError(`unknown flag ${arg}`);
|
|
1262
|
-
}
|
|
1263
|
-
if (parsed.sessions.length === 0 && parsed.synthetic.length === 0) {
|
|
1264
|
-
throw new CliUsageError("--sessions or --synthetic is required");
|
|
1265
|
-
}
|
|
1266
|
-
if (parsed.target >= parsed.threshold) throw new CliUsageError("--target must be less than --threshold");
|
|
1267
|
-
if (policiesExplicit) {
|
|
1268
|
-
const unavailable = parsed.policies.filter((id) => !policyResolves(id));
|
|
1269
|
-
if (unavailable.length > 0) {
|
|
1270
|
-
throw new CliUsageError(`replay policy is not available in this build: ${unavailable.join(", ")}`);
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
return parsed;
|
|
1274
|
-
}
|
|
1275
|
-
function policyForTrace(id, graph, seed) {
|
|
1276
|
-
if (id === "none") return nonePolicy;
|
|
1277
|
-
if (id === "random") return makeRandomPolicy(seed);
|
|
1278
|
-
if (id === "oracle") return makeOraclePolicy(graph);
|
|
1279
|
-
return resolveWorkingSetPolicy(id);
|
|
1280
|
-
}
|
|
1281
|
-
function gitSha() {
|
|
1282
|
-
try {
|
|
1283
|
-
return execFileSync("git", ["rev-parse", "HEAD"], {
|
|
1284
|
-
cwd: process.cwd(),
|
|
1285
|
-
encoding: "utf8",
|
|
1286
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
1287
|
-
}).trim();
|
|
1288
|
-
} catch {
|
|
1289
|
-
return null;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
function exactCommandLine() {
|
|
1293
|
-
return [process.execPath, ...process.execArgv, ...process.argv.slice(1)];
|
|
1294
|
-
}
|
|
1295
|
-
async function writeOutput(path, contents) {
|
|
1296
|
-
const output = resolve2(path);
|
|
1297
|
-
await mkdir(dirname2(output), { recursive: true });
|
|
1298
|
-
await writeFile(output, contents, "utf8");
|
|
1299
|
-
return output;
|
|
1300
|
-
}
|
|
1301
|
-
function cascadeLine(cascade) {
|
|
1302
|
-
const filtered = Object.entries(cascade.filtered).map(([stage, count]) => `${stage}=${count}`).join(" ");
|
|
1303
|
-
return `cascade found=${cascade.found} unreadable=${cascade.unreadable} ${filtered} kept=${cascade.kept}`;
|
|
1304
|
-
}
|
|
1305
|
-
async function runContextReplayCommand(args) {
|
|
1306
|
-
if (args.includes("--help") || args.includes("-h")) {
|
|
1307
|
-
process.stdout.write(REPLAY_HELP);
|
|
1308
|
-
return 0;
|
|
1309
|
-
}
|
|
1310
|
-
let parsed;
|
|
1311
|
-
try {
|
|
1312
|
-
parsed = parseReplayArgs(args);
|
|
1313
|
-
} catch (error) {
|
|
1314
|
-
process.stderr.write(
|
|
1315
|
-
`clio-coder context replay: ${error instanceof Error ? error.message : String(error)}
|
|
1316
|
-
${REPLAY_HELP}`
|
|
1317
|
-
);
|
|
1318
|
-
return 2;
|
|
1319
|
-
}
|
|
1320
|
-
try {
|
|
1321
|
-
const ledgers = await loadClioTraces(parsed.sessions, { filter: parsed.noFilter ? false : {} });
|
|
1322
|
-
const synthetic = generateSyntheticCorpora(parsed.synthetic);
|
|
1323
|
-
const loaded = {
|
|
1324
|
-
traces: [...ledgers.traces, ...synthetic.traces],
|
|
1325
|
-
cascade: {
|
|
1326
|
-
found: ledgers.cascade.found + synthetic.cascade.found,
|
|
1327
|
-
unreadable: ledgers.cascade.unreadable,
|
|
1328
|
-
filtered: ledgers.cascade.filtered,
|
|
1329
|
-
kept: ledgers.cascade.kept + synthetic.cascade.kept
|
|
1330
|
-
}
|
|
1331
|
-
};
|
|
1332
|
-
if (loaded.traces.length === 0) {
|
|
1333
|
-
process.stderr.write(`clio-coder context replay: no traces to replay (${cascadeLine(loaded.cascade)})
|
|
1334
|
-
`);
|
|
1335
|
-
return 1;
|
|
1336
|
-
}
|
|
1337
|
-
const indexed = loaded.traces.map((trace) => {
|
|
1338
|
-
const index = buildPathIndex(trace.entries, { cwd: trace.cwd });
|
|
1339
|
-
return { trace, index, graph: buildReferenceGraph(trace, index) };
|
|
1340
|
-
});
|
|
1341
|
-
const settings = {
|
|
1342
|
-
...DEFAULT_WORKING_SET_SETTINGS,
|
|
1343
|
-
target: parsed.target,
|
|
1344
|
-
protectLastTurns: parsed.protectLastTurns,
|
|
1345
|
-
minEvictableTokens: parsed.minEvictableTokens
|
|
1346
|
-
};
|
|
1347
|
-
const results = [];
|
|
1348
|
-
for (const budgetTokens of parsed.budgets) {
|
|
1349
|
-
for (const policyId of parsed.policies) {
|
|
1350
|
-
const measurements = indexed.map(({ trace, index, graph }) => ({
|
|
1351
|
-
trace,
|
|
1352
|
-
index,
|
|
1353
|
-
graph,
|
|
1354
|
-
replay: replayTrace(trace, policyForTrace(policyId, graph, parsed.seed), {
|
|
1355
|
-
policyId,
|
|
1356
|
-
budgetTokens,
|
|
1357
|
-
threshold: parsed.threshold,
|
|
1358
|
-
target: parsed.target,
|
|
1359
|
-
settings,
|
|
1360
|
-
seed: parsed.seed,
|
|
1361
|
-
summaries: { keepRecentTokens: DEFAULT_KEEP_RECENT_TOKENS, summaryTokens: REPLAY_SUMMARY_TOKENS }
|
|
1362
|
-
})
|
|
1363
|
-
}));
|
|
1364
|
-
results.push({ budgetTokens, policyId, metrics: aggregateReplayMetrics(measurements) });
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
const report = {
|
|
1368
|
-
config: {
|
|
1369
|
-
policies: parsed.policies,
|
|
1370
|
-
budgets: parsed.budgets,
|
|
1371
|
-
threshold: parsed.threshold,
|
|
1372
|
-
target: parsed.target,
|
|
1373
|
-
seed: parsed.seed,
|
|
1374
|
-
corpus: [...parsed.sessions.length > 0 ? ["ledgers"] : [], ...parsed.synthetic],
|
|
1375
|
-
filter: parsed.noFilter ? "none" : "default",
|
|
1376
|
-
settings
|
|
1377
|
-
},
|
|
1378
|
-
cascade: loaded.cascade,
|
|
1379
|
-
results,
|
|
1380
|
-
gitSha: gitSha(),
|
|
1381
|
-
commandLine: exactCommandLine()
|
|
1382
|
-
};
|
|
1383
|
-
const markdown = renderReplayMarkdown(report);
|
|
1384
|
-
if (parsed.markdownPath === void 0) process.stdout.write(markdown);
|
|
1385
|
-
else {
|
|
1386
|
-
const path = await writeOutput(parsed.markdownPath, markdown);
|
|
1387
|
-
process.stdout.write(`${cascadeLine(loaded.cascade)}
|
|
1388
|
-
markdown ${path}
|
|
1389
|
-
`);
|
|
1390
|
-
}
|
|
1391
|
-
if (parsed.jsonPath !== void 0) {
|
|
1392
|
-
const path = await writeOutput(parsed.jsonPath, renderReplayJson(report));
|
|
1393
|
-
process.stdout.write(`json ${path}
|
|
1394
|
-
`);
|
|
1395
|
-
}
|
|
1396
|
-
return 0;
|
|
1397
|
-
} catch (error) {
|
|
1398
|
-
process.stderr.write(`clio-coder context replay failed: ${error instanceof Error ? error.message : String(error)}
|
|
1399
|
-
`);
|
|
1400
|
-
return 1;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
async function sessionPath(value) {
|
|
1404
|
-
const candidate = resolve2(value);
|
|
1405
|
-
try {
|
|
1406
|
-
const facts = await stat2(candidate);
|
|
1407
|
-
if (facts.isDirectory()) return join2(candidate, "current.jsonl");
|
|
1408
|
-
if (facts.isFile()) return candidate;
|
|
1409
|
-
} catch {
|
|
1410
|
-
}
|
|
1411
|
-
try {
|
|
1412
|
-
assertSafeId(value, "session");
|
|
1413
|
-
} catch (error) {
|
|
1414
|
-
throw new CliUsageError(error instanceof Error ? error.message : String(error));
|
|
1415
|
-
}
|
|
1416
|
-
const sessionsRoot = join2(clioStatePath(), "sessions");
|
|
1417
|
-
let cwdHashes;
|
|
1418
|
-
try {
|
|
1419
|
-
cwdHashes = await readdir2(sessionsRoot);
|
|
1420
|
-
} catch {
|
|
1421
|
-
throw new Error(`session not found: ${value}`);
|
|
1422
|
-
}
|
|
1423
|
-
for (const cwdHash of cwdHashes.sort()) {
|
|
1424
|
-
const current = join2(sessionsRoot, cwdHash, value, "current.jsonl");
|
|
1425
|
-
try {
|
|
1426
|
-
if ((await stat2(current)).isFile()) return current;
|
|
1427
|
-
} catch {
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
throw new Error(`session not found: ${value}`);
|
|
1431
|
-
}
|
|
1432
|
-
async function pinnedLeafForSession(source) {
|
|
1433
|
-
try {
|
|
1434
|
-
const raw = await readFile2(join2(dirname2(source), "meta.json"), "utf8");
|
|
1435
|
-
const value = JSON.parse(raw);
|
|
1436
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
1437
|
-
const pinned = value.pinnedLeafTurnId;
|
|
1438
|
-
return typeof pinned === "string" && pinned.length > 0 ? pinned : void 0;
|
|
1439
|
-
} catch {
|
|
1440
|
-
return void 0;
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
async function sessionCwdForSession(source) {
|
|
1444
|
-
try {
|
|
1445
|
-
const raw = await readFile2(join2(dirname2(source), "meta.json"), "utf8");
|
|
1446
|
-
const value = JSON.parse(raw);
|
|
1447
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1448
|
-
const cwd = value.cwd;
|
|
1449
|
-
return typeof cwd === "string" && cwd.length > 0 ? cwd : null;
|
|
1450
|
-
} catch {
|
|
1451
|
-
return null;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
function formatWorkingSet(trace) {
|
|
1455
|
-
const view = foldWorkingSet(trace.entries);
|
|
1456
|
-
const index = buildPathIndex(trace.entries, { cwd: trace.cwd });
|
|
1457
|
-
const graph = buildReferenceGraph(trace, index);
|
|
1458
|
-
const evictedTokens = [...view.evicted.values()].reduce((sum, state) => sum + state.tokensFreed, 0);
|
|
1459
|
-
const churn = view.itemsEvicted === 0 ? "n/a" : (view.recalls / view.itemsEvicted).toFixed(3);
|
|
1460
|
-
const opCounts = /* @__PURE__ */ new Map();
|
|
1461
|
-
for (const observation of index.observations) {
|
|
1462
|
-
opCounts.set(observation.op, (opCounts.get(observation.op) ?? 0) + 1);
|
|
1463
|
-
}
|
|
1464
|
-
const rewrittenPaths = /* @__PURE__ */ new Set();
|
|
1465
|
-
for (const edge of graph.edges) {
|
|
1466
|
-
if (edge.kind !== "file_rewrite") continue;
|
|
1467
|
-
const path = index.byRef.get(edge.from)?.path;
|
|
1468
|
-
if (path) rewrittenPaths.add(path);
|
|
1469
|
-
}
|
|
1470
|
-
const lines = [
|
|
1471
|
-
`session: ${trace.id}`,
|
|
1472
|
-
`source: ${trace.source}`,
|
|
1473
|
-
"working set:",
|
|
1474
|
-
` policy: ${view.lastPolicyId ?? "none"}`,
|
|
1475
|
-
` eviction events: ${view.evictionEvents}`,
|
|
1476
|
-
` evicted refs: ${view.evicted.size}`,
|
|
1477
|
-
` items evicted: ${view.itemsEvicted}`,
|
|
1478
|
-
` evicted tokens: ${evictedTokens}`,
|
|
1479
|
-
` recalls: ${view.recalls}`,
|
|
1480
|
-
` churn: ${churn}`,
|
|
1481
|
-
" refs:",
|
|
1482
|
-
...[...view.evicted.entries()].length === 0 ? [" none"] : [...view.evicted.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([ref, state]) => ` ${ref} reason=${state.reason} by=${state.by ?? "-"} tokens=${state.tokensFreed}`),
|
|
1483
|
-
"path index:",
|
|
1484
|
-
` observations: ${index.observations.length}`,
|
|
1485
|
-
` ops: ${[...opCounts.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([op, count]) => `${op}=${count}`).join(", ") || "none"}`,
|
|
1486
|
-
` paths with rewrites: ${rewrittenPaths.size}`,
|
|
1487
|
-
...[...rewrittenPaths].sort().map((path) => ` ${path}`),
|
|
1488
|
-
""
|
|
1489
|
-
];
|
|
1490
|
-
return lines.join("\n");
|
|
1491
|
-
}
|
|
1492
|
-
async function runContextWorkingSetCommand(args) {
|
|
1493
|
-
if (args.includes("--help") || args.includes("-h")) {
|
|
1494
|
-
process.stdout.write(WORKING_SET_HELP);
|
|
1495
|
-
return 0;
|
|
1496
|
-
}
|
|
1497
|
-
let session;
|
|
1498
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
1499
|
-
const arg = args[index];
|
|
1500
|
-
if (arg === "--session") {
|
|
1501
|
-
try {
|
|
1502
|
-
session = requiredValue(args, index, arg);
|
|
1503
|
-
} catch (error) {
|
|
1504
|
-
process.stderr.write(
|
|
1505
|
-
`clio-coder context working-set: ${error instanceof Error ? error.message : String(error)}
|
|
1506
|
-
${WORKING_SET_HELP}`
|
|
1507
|
-
);
|
|
1508
|
-
return 2;
|
|
1509
|
-
}
|
|
1510
|
-
index += 1;
|
|
1511
|
-
continue;
|
|
1512
|
-
}
|
|
1513
|
-
process.stderr.write(`clio-coder context working-set: unknown flag ${arg}
|
|
1514
|
-
${WORKING_SET_HELP}`);
|
|
1515
|
-
return 2;
|
|
1516
|
-
}
|
|
1517
|
-
if (session === void 0) {
|
|
1518
|
-
process.stderr.write(`clio-coder context working-set: --session is required
|
|
1519
|
-
${WORKING_SET_HELP}`);
|
|
1520
|
-
return 2;
|
|
1521
|
-
}
|
|
1522
|
-
try {
|
|
1523
|
-
const source = await sessionPath(session);
|
|
1524
|
-
const raw = await readFile2(source, "utf8");
|
|
1525
|
-
const parsed = parseSessionEntries(raw, source);
|
|
1526
|
-
if (parsed.errors.length > 0) throw new Error(parsed.errors.join("; "));
|
|
1527
|
-
const entries = filterEntriesToActivePath(parsed.entries, await pinnedLeafForSession(source));
|
|
1528
|
-
const cwd = await sessionCwdForSession(source);
|
|
1529
|
-
process.stdout.write(
|
|
1530
|
-
formatWorkingSet({
|
|
1531
|
-
id: basename2(dirname2(source)),
|
|
1532
|
-
source,
|
|
1533
|
-
cwd,
|
|
1534
|
-
entries,
|
|
1535
|
-
turnCount: buildPathIndex(entries, { cwd }).turnCount
|
|
1536
|
-
})
|
|
1537
|
-
);
|
|
1538
|
-
return 0;
|
|
1539
|
-
} catch (error) {
|
|
1540
|
-
if (error instanceof CliUsageError) {
|
|
1541
|
-
process.stderr.write(`clio-coder context working-set: ${error.message}
|
|
1542
|
-
${WORKING_SET_HELP}`);
|
|
1543
|
-
return 2;
|
|
1544
|
-
}
|
|
1545
|
-
process.stderr.write(
|
|
1546
|
-
`clio-coder context working-set failed: ${error instanceof Error ? error.message : String(error)}
|
|
1547
|
-
`
|
|
1548
|
-
);
|
|
1549
|
-
return 1;
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
export {
|
|
1553
|
-
runContextReplayCommand,
|
|
1554
|
-
runContextWorkingSetCommand
|
|
1555
|
-
};
|
|
1556
|
-
//# sourceMappingURL=context-working-set-ZUW3EGLS.js.map
|