ruvnet-brain 4.4.0 → 4.5.0
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/README.md +3 -3
- package/bin/install.mjs +679 -121
- package/console/app.js +178 -81
- package/console/index.html +1 -1
- package/console/install-architecture.html +1 -0
- package/console/scope.css +4 -1
- package/console/style.css +13 -0
- package/console/tips.html +4 -4
- package/kb/brain-profile.mjs +1 -0
- package/kb/corpus-release-identity.mjs +1 -1
- package/kb/forge-update.mjs +41 -17
- package/kb/model-requirements.mjs +4 -1
- package/kb/update-storage-transaction.mjs +79 -0
- package/kb/zip-extract.mjs +22 -0
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/commands/brain-console.md +5 -4
- package/plugin/commands/configure.md +5 -4
- package/plugin/commands/rnb-brief.md +41 -0
- package/plugin/commands/rnb.md +80 -0
- package/plugin/commands/rnbc.md +80 -0
- package/plugin/commands/rvbc.md +5 -4
- package/plugin/commands/rvcb.md +5 -4
- package/plugin/commands/whats-new.md +4 -4
- package/plugin/mcp/server.mjs +10 -2
- package/plugin/scripts/advocacy-route.mjs +59 -23
- package/plugin/scripts/anticipate.sh +4 -0
- package/plugin/scripts/brain-confirmation.mjs +258 -0
- package/plugin/scripts/brain-footprint.mjs +494 -0
- package/plugin/scripts/brain-location.mjs +47 -0
- package/plugin/scripts/capability-registry.mjs +11 -1
- package/plugin/scripts/continuity-brief.mjs +324 -0
- package/plugin/scripts/continuity-events.mjs +327 -0
- package/plugin/scripts/continuity-journal.mjs +500 -0
- package/plugin/scripts/decision-gate.mjs +56 -3
- package/plugin/scripts/footprint-io.mjs +186 -0
- package/plugin/scripts/ground-before-write.sh +8 -1
- package/plugin/scripts/ground-ruvnet.sh +103 -12
- package/plugin/scripts/grounding-answer.mjs +2 -1
- package/plugin/scripts/grounding-stamp.sh +3 -0
- package/plugin/scripts/grounding-substance.mjs +1 -1
- package/plugin/scripts/grounding-turn-evidence.mjs +68 -6
- package/plugin/scripts/hook-input.mjs +78 -4
- package/plugin/scripts/kb-copy-proof.mjs +148 -0
- package/plugin/scripts/lesson-bridge.mjs +6 -2
- package/plugin/scripts/nightly-controller.mjs +8 -1
- package/plugin/scripts/node-sqlite.mjs +41 -0
- package/plugin/scripts/package-cards.json +797 -0
- package/plugin/scripts/package-cards.rvf +0 -0
- package/plugin/scripts/package-cards.rvf.idmap.json +1 -0
- package/plugin/scripts/package-cards.rvf.meta.json +1 -0
- package/plugin/scripts/package-recommender-client.mjs +138 -0
- package/plugin/scripts/package-recommender-flag.mjs +30 -0
- package/plugin/scripts/package-recommender.mjs +391 -0
- package/plugin/scripts/project-progression-outbox.mjs +26 -8
- package/plugin/scripts/project-progression-reader.mjs +14 -2
- package/plugin/scripts/project-progression-store.mjs +153 -6
- package/plugin/scripts/protect-brain-state.sh +4 -1
- package/plugin/scripts/session-snapshot-hook.mjs +225 -41
- package/plugin/scripts/session-start-budget.mjs +1 -0
- package/plugin/scripts/session-start-core.mjs +34 -4
- package/plugin/scripts/session-start-health.mjs +7 -1
- package/plugin/scripts/session-start-update-plane.mjs +35 -0
- package/plugin/scripts/turn-outcome-capture.mjs +12 -1
- package/plugin/scripts/unprompted-runtime.mjs +2 -2
- package/plugin/skills/brain-console/SKILL.md +3 -3
- package/plugin/skills/rnbc/SKILL.md +24 -0
- package/plugin/skills/rvbc/SKILL.md +2 -2
- package/scripts/approved-runtime.mjs +2 -2
- package/scripts/ci/warm-brain-models.mjs +28 -0
- package/scripts/codex-hook-trust.mjs +94 -0
- package/scripts/console-instances.mjs +70 -12
- package/scripts/console-runtime-identity.mjs +5 -0
- package/scripts/corpus-canary.mjs +46 -6
- package/scripts/corpus-dispatch-decision.mjs +2 -2
- package/scripts/corpus-promotion.mjs +1 -1
- package/scripts/full-suite-gate.mjs +9 -2
- package/scripts/hook-qualify-hosts.mjs +15 -3
- package/scripts/host-install-matrix.mjs +63 -2
- package/scripts/human-approval-phrases.mjs +46 -0
- package/scripts/installed-brain-health.mjs +53 -0
- package/scripts/move-brain.mjs +310 -0
- package/scripts/onboarding-console.mjs +93 -10
- package/scripts/oracle/abstain-threshold-sweep.mjs +62 -0
- package/scripts/oracle/abstain-trace.mjs +139 -0
- package/scripts/oracle/doc2query-generate.mjs +162 -0
- package/scripts/oracle/doc2query-reach.mjs +110 -0
- package/scripts/oracle/judge-train.mjs +158 -0
- package/scripts/oracle/need-set-split.mjs +48 -0
- package/scripts/oracle/sona-query-adapter-eval.mjs +139 -0
- package/scripts/package-cards.mjs +374 -0
- package/scripts/publication-receipt.mjs +37 -9
- package/scripts/recommendation-e2e.mjs +110 -0
- package/scripts/recommendation-eval.mjs +105 -0
- package/scripts/recommendation-floor.mjs +56 -0
- package/scripts/recommendation-judge-score.mjs +74 -0
- package/scripts/recommendation-latency.mjs +95 -0
- package/scripts/recommendation-real-host-score.mjs +76 -0
- package/scripts/recommendation-real-host.mjs +137 -0
- package/scripts/release-channel-kind.mjs +1 -1
- package/scripts/release-environment-policy.mjs +33 -0
- package/scripts/single-source-check.mjs +15 -10
- package/scripts/sync-commands.mjs +5 -2
- package/scripts/wired-check.mjs +17 -2
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"idToLabel":{"0":1,"1":3,"2":5,"3":7,"4":9,"5":11,"6":12,"7":13,"11":14,"12":15,"13":17,"14":19,"15":21,"16":23,"17":25,"18":27,"19":29,"20":31,"21":33,"22":35,"23":37,"24":39,"25":41,"26":43,"27":45,"28":47,"29":49,"30":51,"31":53,"32":55,"33":57,"34":59,"35":61,"36":63,"37":65,"38":67,"39":69,"40":71,"41":73,"42":75,"43":77,"44":79,"45":81,"46":83,"47":85,"48":87,"49":89,"50":90,"51":92,"52":94,"53":96,"54":98,"55":100,"67":102,"69":103,"70":105,"71":107,"72":109,"73":111,"74":113,"75":115,"77":117,"78":119,"79":121,"80":123,"81":124,"82":126,"83":128,"84":130,"85":131,"86":133,"87":135,"88":137,"89":139,"90":141,"91":143,"92":145,"93":147,"94":149,"95":151,"96":152,"97":154,"98":156,"99":158,"100":160,"101":161,"102":162,"103":164,"105":166,"107":168,"108":170,"109":172,"110":174,"111":176,"112":177,"113":179,"114":180,"115":182,"116":184,"117":186,"118":188,"119":190,"121":192,"122":193,"123":195,"125":197,"126":199,"127":201,"128":203,"129":205,"131":207,"132":209,"134":211,"135":213,"137":215,"138":217,"139":219,"140":221,"145":223,"154":225,"155":227,"156":229,"157":231,"158":233,"159":235,"167":237,"169":239,"170":241,"171":243,"213":245,"238":246,"241":247,"289":248,"290":250,"301":252,"304":254,"305":256,"306":258,"307":260,"308":262,"309":264,"310":266,"311":268,"312":269,"313":271,"314":273,"315":275,"316":277,"317":279,"318":281,"319":283,"320":285,"324":286,"329":288,"333":290,"334":291,"335":292,"337":294,"338":295,"368":297,"369":299,"370":301,"371":303,"372":305,"373":307,"374":309,"375":311,"376":313,"377":315,"378":317,"379":318,"380":320,"381":322,"382":323,"398":325,"403":326,"404":328,"405":330,"406":331,"407":332,"409":334,"410":336,"411":338,"412":339,"413":340,"414":341,"415":342,"416":343,"420":344,"421":345,"422":347,"423":348,"424":350,"425":351,"426":352,"427":354,"428":356,"429":358,"430":360,"431":362,"432":364,"436":365,"437":367,"440":368,"445":369,"446":371,"450":373,"451":375,"452":377,"453":379,"455":380,"456":382,"457":383,"458":385,"459":387,"460":389,"461":390,"462":391,"463":393,"464":395,"465":397,"466":399,"467":400,"471":402,"472":403,"473":404,"491":405,"494":406,"495":407,"497":408,"498":410,"499":411,"500":413,"501":414,"503":415,"504":416,"505":418,"508":420,"513":421,"514":423,"515":425,"517":426,"518":427,"519":429,"520":431,"521":433,"522":435,"523":437,"524":439,"525":441,"526":442,"527":444,"528":446,"529":447,"530":449,"531":451,"532":452,"533":454,"534":456,"535":458,"536":460,"537":462,"538":463,"539":465,"540":467,"541":469,"542":471,"543":473,"544":475,"546":477,"547":479,"548":480,"549":482,"550":483,"551":485,"552":487,"553":489,"554":491,"555":493,"556":495,"557":497,"558":498,"559":500,"560":501,"561":502,"562":504,"563":506,"564":508,"565":509,"566":510,"567":511,"568":512,"569":513,"570":515,"571":517,"572":519,"573":521,"574":522,"575":523,"576":524,"577":525,"578":526,"579":527,"580":528,"581":529,"582":530,"583":531,"584":532,"585":534,"586":535,"587":537,"588":539,"589":541,"590":543,"591":545,"592":547,"593":549,"594":551,"595":553,"596":554,"597":555,"598":557,"599":558,"600":560,"601":562,"602":564,"603":566,"604":567,"605":569,"606":571,"607":572,"608":574,"609":576,"610":578,"611":580,"612":581,"613":583,"614":585,"615":587,"616":589,"617":590,"618":591,"619":593,"620":595,"621":597,"622":599,"623":601,"624":603,"625":605,"626":607,"627":609,"628":610,"629":611,"630":612,"631":613,"632":615,"633":616,"634":618,"635":620,"636":622,"637":623,"638":625,"639":626,"640":628,"641":629,"642":630,"643":631,"644":633,"645":634,"646":635,"647":637,"649":638,"650":639,"651":641,"652":643,"653":645,"654":646,"655":648,"656":650,"657":652,"658":654,"659":656,"660":658,"661":660,"662":662,"663":664,"664":666,"665":668,"666":670,"667":672,"668":674,"669":676,"670":678,"671":680,"672":682,"675":684,"676":685,"677":686,"678":687,"679":688,"680":689,"681":690,"682":691,"683":692,"684":694,"685":696,"686":698,"687":700,"688":702,"689":704,"690":705,"691":706,"692":707,"693":708,"694":709,"695":710,"696":712,"697":714,"698":716,"699":717,"700":719,"701":721,"702":723,"703":725,"704":727,"705":729,"706":731,"707":733,"710":735,"711":737,"712":738,"713":740,"714":741,"715":743,"716":745,"717":746,"718":748,"719":749,"720":750,"721":752,"722":753,"723":755,"724":756,"725":758,"726":759,"727":761,"728":763,"729":765,"730":766,"731":768,"732":770,"733":772,"735":774,"736":776,"737":777,"738":779,"740":781,"741":783,"742":785,"744":787,"745":789,"746":790,"747":791,"748":793,"749":795,"750":797,"751":799,"752":801,"754":802,"755":804,"756":806,"760":808,"761":809,"762":811,"763":812,"764":814,"765":816,"767":817,"768":819,"769":821,"770":823,"771":824,"772":825,"773":826,"774":828,"775":830,"776":832,"777":833,"778":835,"779":837,"780":839,"781":841,"782":843,"783":845,"784":847,"785":848,"794":850,"0.r":2,"1.r":4,"2.r":6,"3.r":8,"4.r":10,"12.r":16,"13.r":18,"14.r":20,"15.r":22,"16.r":24,"17.r":26,"18.r":28,"19.r":30,"20.r":32,"21.r":34,"22.r":36,"23.r":38,"24.r":40,"25.r":42,"26.r":44,"27.r":46,"28.r":48,"29.r":50,"30.r":52,"31.r":54,"32.r":56,"33.r":58,"34.r":60,"35.r":62,"36.r":64,"37.r":66,"38.r":68,"39.r":70,"40.r":72,"41.r":74,"42.r":76,"43.r":78,"44.r":80,"45.r":82,"46.r":84,"47.r":86,"48.r":88,"50.r":91,"51.r":93,"52.r":95,"53.r":97,"54.r":99,"55.r":101,"69.r":104,"70.r":106,"71.r":108,"72.r":110,"73.r":112,"74.r":114,"75.r":116,"77.r":118,"78.r":120,"79.r":122,"81.r":125,"82.r":127,"83.r":129,"85.r":132,"86.r":134,"87.r":136,"88.r":138,"89.r":140,"90.r":142,"91.r":144,"92.r":146,"93.r":148,"94.r":150,"96.r":153,"97.r":155,"98.r":157,"99.r":159,"102.r":163,"103.r":165,"105.r":167,"107.r":169,"108.r":171,"109.r":173,"110.r":175,"112.r":178,"114.r":181,"115.r":183,"116.r":185,"117.r":187,"118.r":189,"119.r":191,"122.r":194,"123.r":196,"125.r":198,"126.r":200,"127.r":202,"128.r":204,"129.r":206,"131.r":208,"132.r":210,"134.r":212,"135.r":214,"137.r":216,"138.r":218,"139.r":220,"140.r":222,"145.r":224,"154.r":226,"155.r":228,"156.r":230,"157.r":232,"158.r":234,"159.r":236,"167.r":238,"169.r":240,"170.r":242,"171.r":244,"289.r":249,"290.r":251,"301.r":253,"304.r":255,"305.r":257,"306.r":259,"307.r":261,"308.r":263,"309.r":265,"310.r":267,"312.r":270,"313.r":272,"314.r":274,"315.r":276,"316.r":278,"317.r":280,"318.r":282,"319.r":284,"324.r":287,"329.r":289,"335.r":293,"338.r":296,"368.r":298,"369.r":300,"370.r":302,"371.r":304,"372.r":306,"373.r":308,"374.r":310,"375.r":312,"376.r":314,"377.r":316,"379.r":319,"380.r":321,"382.r":324,"403.r":327,"404.r":329,"407.r":333,"409.r":335,"410.r":337,"421.r":346,"423.r":349,"426.r":353,"427.r":355,"428.r":357,"429.r":359,"430.r":361,"431.r":363,"436.r":366,"445.r":370,"446.r":372,"450.r":374,"451.r":376,"452.r":378,"455.r":381,"457.r":384,"458.r":386,"459.r":388,"462.r":392,"463.r":394,"464.r":396,"465.r":398,"467.r":401,"497.r":409,"499.r":412,"504.r":417,"505.r":419,"513.r":422,"514.r":424,"518.r":428,"519.r":430,"520.r":432,"521.r":434,"522.r":436,"523.r":438,"524.r":440,"526.r":443,"527.r":445,"529.r":448,"530.r":450,"532.r":453,"533.r":455,"534.r":457,"535.r":459,"536.r":461,"538.r":464,"539.r":466,"540.r":468,"541.r":470,"542.r":472,"543.r":474,"544.r":476,"546.r":478,"548.r":481,"550.r":484,"551.r":486,"552.r":488,"553.r":490,"554.r":492,"555.r":494,"556.r":496,"558.r":499,"561.r":503,"562.r":505,"563.r":507,"569.r":514,"570.r":516,"571.r":518,"572.r":520,"584.r":533,"586.r":536,"587.r":538,"588.r":540,"589.r":542,"590.r":544,"591.r":546,"592.r":548,"593.r":550,"594.r":552,"597.r":556,"599.r":559,"600.r":561,"601.r":563,"602.r":565,"604.r":568,"605.r":570,"607.r":573,"608.r":575,"609.r":577,"610.r":579,"612.r":582,"613.r":584,"614.r":586,"615.r":588,"618.r":592,"619.r":594,"620.r":596,"621.r":598,"622.r":600,"623.r":602,"624.r":604,"625.r":606,"626.r":608,"631.r":614,"633.r":617,"634.r":619,"635.r":621,"637.r":624,"639.r":627,"643.r":632,"646.r":636,"650.r":640,"651.r":642,"652.r":644,"654.r":647,"655.r":649,"656.r":651,"657.r":653,"658.r":655,"659.r":657,"660.r":659,"661.r":661,"662.r":663,"663.r":665,"664.r":667,"665.r":669,"666.r":671,"667.r":673,"668.r":675,"669.r":677,"670.r":679,"671.r":681,"672.r":683,"683.r":693,"684.r":695,"685.r":697,"686.r":699,"687.r":701,"688.r":703,"695.r":711,"696.r":713,"697.r":715,"699.r":718,"700.r":720,"701.r":722,"702.r":724,"703.r":726,"704.r":728,"705.r":730,"706.r":732,"707.r":734,"710.r":736,"712.r":739,"714.r":742,"715.r":744,"717.r":747,"720.r":751,"722.r":754,"724.r":757,"726.r":760,"727.r":762,"728.r":764,"730.r":767,"731.r":769,"732.r":771,"733.r":773,"735.r":775,"737.r":778,"738.r":780,"740.r":782,"741.r":784,"742.r":786,"744.r":788,"747.r":792,"748.r":794,"749.r":796,"750.r":798,"751.r":800,"754.r":803,"755.r":805,"756.r":807,"761.r":810,"763.r":813,"764.r":815,"767.r":818,"768.r":820,"769.r":822,"773.r":827,"774.r":829,"775.r":831,"777.r":834,"778.r":836,"779.r":838,"780.r":840,"781.r":842,"782.r":844,"783.r":846,"785.r":849},"labelToId":{"1":"0","2":"0.r","3":"1","4":"1.r","5":"2","6":"2.r","7":"3","8":"3.r","9":"4","10":"4.r","11":"5","12":"6","13":"7","14":"11","15":"12","16":"12.r","17":"13","18":"13.r","19":"14","20":"14.r","21":"15","22":"15.r","23":"16","24":"16.r","25":"17","26":"17.r","27":"18","28":"18.r","29":"19","30":"19.r","31":"20","32":"20.r","33":"21","34":"21.r","35":"22","36":"22.r","37":"23","38":"23.r","39":"24","40":"24.r","41":"25","42":"25.r","43":"26","44":"26.r","45":"27","46":"27.r","47":"28","48":"28.r","49":"29","50":"29.r","51":"30","52":"30.r","53":"31","54":"31.r","55":"32","56":"32.r","57":"33","58":"33.r","59":"34","60":"34.r","61":"35","62":"35.r","63":"36","64":"36.r","65":"37","66":"37.r","67":"38","68":"38.r","69":"39","70":"39.r","71":"40","72":"40.r","73":"41","74":"41.r","75":"42","76":"42.r","77":"43","78":"43.r","79":"44","80":"44.r","81":"45","82":"45.r","83":"46","84":"46.r","85":"47","86":"47.r","87":"48","88":"48.r","89":"49","90":"50","91":"50.r","92":"51","93":"51.r","94":"52","95":"52.r","96":"53","97":"53.r","98":"54","99":"54.r","100":"55","101":"55.r","102":"67","103":"69","104":"69.r","105":"70","106":"70.r","107":"71","108":"71.r","109":"72","110":"72.r","111":"73","112":"73.r","113":"74","114":"74.r","115":"75","116":"75.r","117":"77","118":"77.r","119":"78","120":"78.r","121":"79","122":"79.r","123":"80","124":"81","125":"81.r","126":"82","127":"82.r","128":"83","129":"83.r","130":"84","131":"85","132":"85.r","133":"86","134":"86.r","135":"87","136":"87.r","137":"88","138":"88.r","139":"89","140":"89.r","141":"90","142":"90.r","143":"91","144":"91.r","145":"92","146":"92.r","147":"93","148":"93.r","149":"94","150":"94.r","151":"95","152":"96","153":"96.r","154":"97","155":"97.r","156":"98","157":"98.r","158":"99","159":"99.r","160":"100","161":"101","162":"102","163":"102.r","164":"103","165":"103.r","166":"105","167":"105.r","168":"107","169":"107.r","170":"108","171":"108.r","172":"109","173":"109.r","174":"110","175":"110.r","176":"111","177":"112","178":"112.r","179":"113","180":"114","181":"114.r","182":"115","183":"115.r","184":"116","185":"116.r","186":"117","187":"117.r","188":"118","189":"118.r","190":"119","191":"119.r","192":"121","193":"122","194":"122.r","195":"123","196":"123.r","197":"125","198":"125.r","199":"126","200":"126.r","201":"127","202":"127.r","203":"128","204":"128.r","205":"129","206":"129.r","207":"131","208":"131.r","209":"132","210":"132.r","211":"134","212":"134.r","213":"135","214":"135.r","215":"137","216":"137.r","217":"138","218":"138.r","219":"139","220":"139.r","221":"140","222":"140.r","223":"145","224":"145.r","225":"154","226":"154.r","227":"155","228":"155.r","229":"156","230":"156.r","231":"157","232":"157.r","233":"158","234":"158.r","235":"159","236":"159.r","237":"167","238":"167.r","239":"169","240":"169.r","241":"170","242":"170.r","243":"171","244":"171.r","245":"213","246":"238","247":"241","248":"289","249":"289.r","250":"290","251":"290.r","252":"301","253":"301.r","254":"304","255":"304.r","256":"305","257":"305.r","258":"306","259":"306.r","260":"307","261":"307.r","262":"308","263":"308.r","264":"309","265":"309.r","266":"310","267":"310.r","268":"311","269":"312","270":"312.r","271":"313","272":"313.r","273":"314","274":"314.r","275":"315","276":"315.r","277":"316","278":"316.r","279":"317","280":"317.r","281":"318","282":"318.r","283":"319","284":"319.r","285":"320","286":"324","287":"324.r","288":"329","289":"329.r","290":"333","291":"334","292":"335","293":"335.r","294":"337","295":"338","296":"338.r","297":"368","298":"368.r","299":"369","300":"369.r","301":"370","302":"370.r","303":"371","304":"371.r","305":"372","306":"372.r","307":"373","308":"373.r","309":"374","310":"374.r","311":"375","312":"375.r","313":"376","314":"376.r","315":"377","316":"377.r","317":"378","318":"379","319":"379.r","320":"380","321":"380.r","322":"381","323":"382","324":"382.r","325":"398","326":"403","327":"403.r","328":"404","329":"404.r","330":"405","331":"406","332":"407","333":"407.r","334":"409","335":"409.r","336":"410","337":"410.r","338":"411","339":"412","340":"413","341":"414","342":"415","343":"416","344":"420","345":"421","346":"421.r","347":"422","348":"423","349":"423.r","350":"424","351":"425","352":"426","353":"426.r","354":"427","355":"427.r","356":"428","357":"428.r","358":"429","359":"429.r","360":"430","361":"430.r","362":"431","363":"431.r","364":"432","365":"436","366":"436.r","367":"437","368":"440","369":"445","370":"445.r","371":"446","372":"446.r","373":"450","374":"450.r","375":"451","376":"451.r","377":"452","378":"452.r","379":"453","380":"455","381":"455.r","382":"456","383":"457","384":"457.r","385":"458","386":"458.r","387":"459","388":"459.r","389":"460","390":"461","391":"462","392":"462.r","393":"463","394":"463.r","395":"464","396":"464.r","397":"465","398":"465.r","399":"466","400":"467","401":"467.r","402":"471","403":"472","404":"473","405":"491","406":"494","407":"495","408":"497","409":"497.r","410":"498","411":"499","412":"499.r","413":"500","414":"501","415":"503","416":"504","417":"504.r","418":"505","419":"505.r","420":"508","421":"513","422":"513.r","423":"514","424":"514.r","425":"515","426":"517","427":"518","428":"518.r","429":"519","430":"519.r","431":"520","432":"520.r","433":"521","434":"521.r","435":"522","436":"522.r","437":"523","438":"523.r","439":"524","440":"524.r","441":"525","442":"526","443":"526.r","444":"527","445":"527.r","446":"528","447":"529","448":"529.r","449":"530","450":"530.r","451":"531","452":"532","453":"532.r","454":"533","455":"533.r","456":"534","457":"534.r","458":"535","459":"535.r","460":"536","461":"536.r","462":"537","463":"538","464":"538.r","465":"539","466":"539.r","467":"540","468":"540.r","469":"541","470":"541.r","471":"542","472":"542.r","473":"543","474":"543.r","475":"544","476":"544.r","477":"546","478":"546.r","479":"547","480":"548","481":"548.r","482":"549","483":"550","484":"550.r","485":"551","486":"551.r","487":"552","488":"552.r","489":"553","490":"553.r","491":"554","492":"554.r","493":"555","494":"555.r","495":"556","496":"556.r","497":"557","498":"558","499":"558.r","500":"559","501":"560","502":"561","503":"561.r","504":"562","505":"562.r","506":"563","507":"563.r","508":"564","509":"565","510":"566","511":"567","512":"568","513":"569","514":"569.r","515":"570","516":"570.r","517":"571","518":"571.r","519":"572","520":"572.r","521":"573","522":"574","523":"575","524":"576","525":"577","526":"578","527":"579","528":"580","529":"581","530":"582","531":"583","532":"584","533":"584.r","534":"585","535":"586","536":"586.r","537":"587","538":"587.r","539":"588","540":"588.r","541":"589","542":"589.r","543":"590","544":"590.r","545":"591","546":"591.r","547":"592","548":"592.r","549":"593","550":"593.r","551":"594","552":"594.r","553":"595","554":"596","555":"597","556":"597.r","557":"598","558":"599","559":"599.r","560":"600","561":"600.r","562":"601","563":"601.r","564":"602","565":"602.r","566":"603","567":"604","568":"604.r","569":"605","570":"605.r","571":"606","572":"607","573":"607.r","574":"608","575":"608.r","576":"609","577":"609.r","578":"610","579":"610.r","580":"611","581":"612","582":"612.r","583":"613","584":"613.r","585":"614","586":"614.r","587":"615","588":"615.r","589":"616","590":"617","591":"618","592":"618.r","593":"619","594":"619.r","595":"620","596":"620.r","597":"621","598":"621.r","599":"622","600":"622.r","601":"623","602":"623.r","603":"624","604":"624.r","605":"625","606":"625.r","607":"626","608":"626.r","609":"627","610":"628","611":"629","612":"630","613":"631","614":"631.r","615":"632","616":"633","617":"633.r","618":"634","619":"634.r","620":"635","621":"635.r","622":"636","623":"637","624":"637.r","625":"638","626":"639","627":"639.r","628":"640","629":"641","630":"642","631":"643","632":"643.r","633":"644","634":"645","635":"646","636":"646.r","637":"647","638":"649","639":"650","640":"650.r","641":"651","642":"651.r","643":"652","644":"652.r","645":"653","646":"654","647":"654.r","648":"655","649":"655.r","650":"656","651":"656.r","652":"657","653":"657.r","654":"658","655":"658.r","656":"659","657":"659.r","658":"660","659":"660.r","660":"661","661":"661.r","662":"662","663":"662.r","664":"663","665":"663.r","666":"664","667":"664.r","668":"665","669":"665.r","670":"666","671":"666.r","672":"667","673":"667.r","674":"668","675":"668.r","676":"669","677":"669.r","678":"670","679":"670.r","680":"671","681":"671.r","682":"672","683":"672.r","684":"675","685":"676","686":"677","687":"678","688":"679","689":"680","690":"681","691":"682","692":"683","693":"683.r","694":"684","695":"684.r","696":"685","697":"685.r","698":"686","699":"686.r","700":"687","701":"687.r","702":"688","703":"688.r","704":"689","705":"690","706":"691","707":"692","708":"693","709":"694","710":"695","711":"695.r","712":"696","713":"696.r","714":"697","715":"697.r","716":"698","717":"699","718":"699.r","719":"700","720":"700.r","721":"701","722":"701.r","723":"702","724":"702.r","725":"703","726":"703.r","727":"704","728":"704.r","729":"705","730":"705.r","731":"706","732":"706.r","733":"707","734":"707.r","735":"710","736":"710.r","737":"711","738":"712","739":"712.r","740":"713","741":"714","742":"714.r","743":"715","744":"715.r","745":"716","746":"717","747":"717.r","748":"718","749":"719","750":"720","751":"720.r","752":"721","753":"722","754":"722.r","755":"723","756":"724","757":"724.r","758":"725","759":"726","760":"726.r","761":"727","762":"727.r","763":"728","764":"728.r","765":"729","766":"730","767":"730.r","768":"731","769":"731.r","770":"732","771":"732.r","772":"733","773":"733.r","774":"735","775":"735.r","776":"736","777":"737","778":"737.r","779":"738","780":"738.r","781":"740","782":"740.r","783":"741","784":"741.r","785":"742","786":"742.r","787":"744","788":"744.r","789":"745","790":"746","791":"747","792":"747.r","793":"748","794":"748.r","795":"749","796":"749.r","797":"750","798":"750.r","799":"751","800":"751.r","801":"752","802":"754","803":"754.r","804":"755","805":"755.r","806":"756","807":"756.r","808":"760","809":"761","810":"761.r","811":"762","812":"763","813":"763.r","814":"764","815":"764.r","816":"765","817":"767","818":"767.r","819":"768","820":"768.r","821":"769","822":"769.r","823":"770","824":"771","825":"772","826":"773","827":"773.r","828":"774","829":"774.r","830":"775","831":"775.r","832":"776","833":"777","834":"777.r","835":"778","836":"778.r","837":"779","838":"779.r","839":"780","840":"780.r","841":"781","842":"781.r","843":"782","844":"782.r","845":"783","846":"783.r","847":"784","848":"785","849":"785.r","850":"794"},"nextLabel":851}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"tiers":["T0","T1"],"vectors":850,"embed":{"model":"Xenova/bge-base-en-v1.5","dimensions":768,"pooling":"cls","normalize":true,"queryPrefix":"Represent this sentence for searching relevant passages: "},"cards":"package-cards.json","cardsSha256":"aa50d8f857716026ad11f120fc9fc971cd5d064409f9b9fc6bf4a61513fd4f74","rvfSha256":"29f704ab4376ec68c4c878ed56dfad6579b30a7a97250e8048eee5fc0e0f9225"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// package-recommender-client.mjs — the hook's side of the semantic lane (ADR-093 rev 2).
|
|
2
|
+
//
|
|
3
|
+
// Asks a WARM search worker (kb/recommend-endpoint.mjs inside forge-mcp-all.mjs) for the package cards
|
|
4
|
+
// nearest to the prompt. Never loads a model, never spawns anything, never waits past its budget: no
|
|
5
|
+
// live endpoint, a refused connection, a slow answer, or a malformed reply all resolve to
|
|
6
|
+
// { candidates: null, reason } — the caller then uses the lexical lane or stays silent.
|
|
7
|
+
//
|
|
8
|
+
// The plugin cannot import kb/ (issue #32), so brainHomeFromEnv() and the flag rule are duplicated
|
|
9
|
+
// here and held equal to kb/recommend-endpoint.mjs by tests/unit/package-recommender-semantic.test.mjs.
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
import net from 'node:net';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
import { packageRecommenderEnabled, isDesignOrDiagnosis } from './package-recommender.mjs';
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_BUDGET_MS = 250;
|
|
17
|
+
export const CARDS_DIR = path.dirname(fileURLToPath(import.meta.url)); // package-cards.{json,rvf} ship here
|
|
18
|
+
|
|
19
|
+
export function brainHomeFromEnv(env = process.env) {
|
|
20
|
+
if (env.RUVNET_BRAIN_HOME) return env.RUVNET_BRAIN_HOME;
|
|
21
|
+
if (env.XDG_CACHE_HOME) return path.join(env.XDG_CACHE_HOME, 'ruvnet-brain');
|
|
22
|
+
return path.join(env.HOME || env.USERPROFILE || '', '.cache', 'ruvnet-brain');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ESRCH = gone. EPERM = a process we may not signal, i.e. NOT ours — never a worker we should trust.
|
|
26
|
+
const alive = (pid) => { try { process.kill(pid, 0); return true; } catch { return false; } };
|
|
27
|
+
const SCHEMA = 'ruvnet-brain.recommend-endpoint/1';
|
|
28
|
+
const uid = typeof process.getuid === 'function' ? process.getuid() : null;
|
|
29
|
+
|
|
30
|
+
/** A file or dir we would trust: owned by this user and not group/world-writable/readable (POSIX). */
|
|
31
|
+
function privateToUser(p) {
|
|
32
|
+
if (uid === null) return true; // Windows: no POSIX modes; the per-process token is the guard (ADR-093)
|
|
33
|
+
try { const st = fs.statSync(p); return st.uid === uid && (st.mode & 0o077) === 0; } catch { return false; }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// The endpoint's short-socket fallback dir (kb/recommend-endpoint.mjs shortSocketDir, held equal by
|
|
37
|
+
// tests/unit/package-recommender-semantic.test.mjs): used when <brainHome>/run/… is too long for a socket.
|
|
38
|
+
export function shortSocketDir(id = uid) {
|
|
39
|
+
return id === null || id === undefined ? null : path.join('/tmp', `ruvnet-brain-${id}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Where a descriptor's socket may live: inside run/, or exactly recommend-<pid>.sock in the private short dir. */
|
|
43
|
+
function trustedSocket(d, runDir) {
|
|
44
|
+
const socket = path.resolve(String(d?.socket));
|
|
45
|
+
if (path.dirname(socket) === path.resolve(runDir)) return true;
|
|
46
|
+
const short = shortSocketDir();
|
|
47
|
+
if (!short || path.dirname(socket) !== short || path.basename(socket) !== `recommend-${d.pid}.sock`) return false;
|
|
48
|
+
try { const st = fs.lstatSync(short); return st.isDirectory() && !st.isSymbolicLink() && privateToUser(short); } catch { return false; }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Live endpoint descriptors, newest first. A descriptor is trusted only when the run/ dir and the file
|
|
53
|
+
* are private to this user, its schema matches, its pid is alive and ours, and (POSIX) its socket lies
|
|
54
|
+
* inside run/ (or is that pid's socket in the private short dir) — so a planted descriptor cannot route the
|
|
55
|
+
* user's prompt text to someone else's socket
|
|
56
|
+
* (adversarial review M3). Stale ones are skipped here, swept by the next endpoint.
|
|
57
|
+
*/
|
|
58
|
+
export function liveEndpoints(env = process.env) {
|
|
59
|
+
const dir = path.join(brainHomeFromEnv(env), 'run');
|
|
60
|
+
if (!privateToUser(dir)) return [];
|
|
61
|
+
let names = [];
|
|
62
|
+
try { names = fs.readdirSync(dir).filter((n) => /^recommend-\d+\.json$/.test(n)); } catch { return []; }
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const n of names) {
|
|
65
|
+
try {
|
|
66
|
+
const file = path.join(dir, n);
|
|
67
|
+
if (!privateToUser(file)) continue;
|
|
68
|
+
const d = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
69
|
+
const sockOk = process.platform === 'win32'
|
|
70
|
+
? /^\\\\\.\\pipe\\ruvnet-brain-recommend-\d+$/.test(String(d?.socket))
|
|
71
|
+
: trustedSocket(d, dir);
|
|
72
|
+
if (d?.schema === SCHEMA && Number.isInteger(d.pid) && n === `recommend-${d.pid}.json` && sockOk
|
|
73
|
+
&& typeof d.token === 'string' && d.token.length >= 32 && alive(d.pid)) out.push(d);
|
|
74
|
+
} catch { /* torn or foreign file */ }
|
|
75
|
+
}
|
|
76
|
+
return out.sort((a, b) => String(b.startedAt).localeCompare(String(a.startedAt)));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function askOne(d, request, deadline) {
|
|
80
|
+
return new Promise((resolve) => {
|
|
81
|
+
let done = false;
|
|
82
|
+
let buf = '';
|
|
83
|
+
const finish = (v) => { if (!done) { done = true; clearTimeout(timer); try { sock.destroy(); } catch { /* closed */ } resolve(v); } };
|
|
84
|
+
const timer = setTimeout(() => finish({ candidates: null, reason: 'timeout' }), Math.max(1, deadline - Date.now()));
|
|
85
|
+
const sock = net.createConnection(d.socket);
|
|
86
|
+
sock.setEncoding('utf8');
|
|
87
|
+
sock.on('connect', () => sock.write(`${JSON.stringify({ ...request, token: d.token })}\n`));
|
|
88
|
+
sock.on('data', (c) => {
|
|
89
|
+
buf += c;
|
|
90
|
+
if (buf.length > 64 * 1024) return finish({ candidates: null, reason: 'oversize' });
|
|
91
|
+
const nl = buf.indexOf('\n');
|
|
92
|
+
if (nl < 0) return;
|
|
93
|
+
let r;
|
|
94
|
+
try { r = JSON.parse(buf.slice(0, nl)); } catch { return finish({ candidates: null, reason: 'bad-reply' }); }
|
|
95
|
+
if (!Array.isArray(r?.candidates)) return finish({ candidates: null, reason: r?.error || 'no-candidates' });
|
|
96
|
+
const candidates = r.candidates
|
|
97
|
+
.filter((c) => c && typeof c.id === 'string' && Number.isFinite(c.similarity))
|
|
98
|
+
.slice(0, 10);
|
|
99
|
+
finish({ candidates, reason: null, workerMs: r.ms });
|
|
100
|
+
});
|
|
101
|
+
sock.on('error', () => finish({ candidates: null, reason: 'connect-failed' }));
|
|
102
|
+
sock.on('close', () => finish({ candidates: null, reason: 'closed' }));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The semantic lane, from the hook. Tries live endpoints newest-first until one answers or the
|
|
108
|
+
* budget is spent. Resolves (never rejects) to { candidates: [{id, similarity}] | null, reason }.
|
|
109
|
+
*/
|
|
110
|
+
export async function askWarmWorker({ prompt, k = 8, cardsDir = CARDS_DIR, budgetMs = DEFAULT_BUDGET_MS, env = process.env } = {}) {
|
|
111
|
+
const deadline = Date.now() + budgetMs;
|
|
112
|
+
const endpoints = liveEndpoints(env);
|
|
113
|
+
if (!endpoints.length) return { candidates: null, reason: 'no-warm-worker' };
|
|
114
|
+
let last = { candidates: null, reason: 'no-answer' };
|
|
115
|
+
for (const d of endpoints) {
|
|
116
|
+
if (Date.now() >= deadline) return { candidates: null, reason: 'timeout' };
|
|
117
|
+
last = await askOne(d, { prompt: String(prompt || '').slice(0, 4000), k, cardsDir }, deadline);
|
|
118
|
+
if (last.candidates) return last;
|
|
119
|
+
}
|
|
120
|
+
return last;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The route's single call: semantic candidates for this prompt, or null. Asks ONLY when the flag is
|
|
125
|
+
* on, the closed catalogue did not match, and the prompt is design/diagnosis-shaped — so a chore,
|
|
126
|
+
* a status question, or a default-off install never touches a socket.
|
|
127
|
+
*/
|
|
128
|
+
export const MAX_BUDGET_MS = 1000; // never more than this, whatever the env asks (route's own budget is 1500)
|
|
129
|
+
|
|
130
|
+
export async function semanticFor(prompt, { catalogueMatched = false, env = process.env, startedAt = Date.now() } = {}) {
|
|
131
|
+
if (!packageRecommenderEnabled(env) || catalogueMatched || !isDesignOrDiagnosis(prompt)) return null;
|
|
132
|
+
// The budget runs from the HOOK PROCESS START the caller passes in, so module load and descriptor
|
|
133
|
+
// reads count against it too (adversarial review M4); an env override is clamped, never trusted.
|
|
134
|
+
const asked = Number(env.RUVNET_PACKAGE_RECOMMENDER_BUDGET_MS) || DEFAULT_BUDGET_MS;
|
|
135
|
+
const budgetMs = Math.min(asked, MAX_BUDGET_MS) - (Date.now() - startedAt);
|
|
136
|
+
if (budgetMs <= 0) return { candidates: null, reason: 'budget-spent' };
|
|
137
|
+
try { return await askWarmWorker({ prompt, budgetMs, env }); } catch { return null; }
|
|
138
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// package-recommender-flag.mjs — the two pieces of the package recommender (ADR-093) that advocacy-route
|
|
2
|
+
// needs even when the recommender is OFF, kept dependency-free so a default-off hook never loads the
|
|
3
|
+
// matcher, the card snapshot reader, or the socket client (adversarial review L1, 2026-10-01).
|
|
4
|
+
|
|
5
|
+
/** THE FLAG, DEFAULT OFF: only an explicit opt-in is on. Read per call, never cached. */
|
|
6
|
+
export function packageRecommenderEnabled(env = process.env) {
|
|
7
|
+
return ['1', 'on', 'true', 'yes'].includes(String(env.RUVNET_PACKAGE_RECOMMENDER || '').trim().toLowerCase());
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Short package names that are ordinary words ("don't touch the memory layout"): never treated as the
|
|
11
|
+
// user naming an offered package (adversarial review H2c). Full ids ("@ruvector/router") always count.
|
|
12
|
+
const COMMON_WORDS = new Set(`
|
|
13
|
+
memory testing hooks hook server router core node gate runtime backend frontend cli wasm graph cache
|
|
14
|
+
client sdk api types utils common shared config solver index search agent agents swarm flow store
|
|
15
|
+
queue worker workers proxy bridge monitor dashboard plugin plugins cluster raft replication
|
|
16
|
+
`.trim().split(/\s+/));
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The names a user can answer an offer with, and whether the offer is a candidate SET.
|
|
20
|
+
* A set (several packages shown, the model asked to mention at most one) answers only to a package
|
|
21
|
+
* the user actually names — never to a bare "ok"/"no", which may be about something else entirely.
|
|
22
|
+
*/
|
|
23
|
+
export function offerNames(offer) {
|
|
24
|
+
const set = Array.isArray(offer?.candidates) && offer.candidates.length > 0;
|
|
25
|
+
if (!set) return { set: false, names: [String(offer?.capability || '')].filter(Boolean) };
|
|
26
|
+
const distinctive = (n) => n.startsWith('@') || (n.length >= 5 && !COMMON_WORDS.has(n.toLowerCase()));
|
|
27
|
+
const full = (Array.isArray(offer.packages) ? offer.packages : []).map(String).filter(distinctive);
|
|
28
|
+
const short = offer.candidates.map(String).filter(distinctive);
|
|
29
|
+
return { set: true, names: [...new Set([...full, ...short])] };
|
|
30
|
+
}
|