@evomap/evolver 1.89.11 → 1.89.12

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.
Files changed (100) hide show
  1. package/.cursor/BUGBOT.md +182 -0
  2. package/.env.example +68 -0
  3. package/.git-commit-guard-token +1 -0
  4. package/.github/CODEOWNERS +63 -0
  5. package/.github/ISSUE_TEMPLATE/good_first_issue.md +23 -0
  6. package/.github/pull_request_template.md +45 -0
  7. package/.github/workflows/test.yml +75 -0
  8. package/CHANGELOG.md +1367 -0
  9. package/README.md +90 -537
  10. package/README.public.md +578 -0
  11. package/SECURITY.md +108 -0
  12. package/assets/gep/events.jsonl +3 -0
  13. package/examples/atp-consumer-quickstart.md +100 -0
  14. package/examples/hello-world.md +38 -0
  15. package/package.json +6 -18
  16. package/proxy-package.json +39 -0
  17. package/public.manifest.json +145 -0
  18. package/src/evolve/guards.js +721 -1
  19. package/src/evolve/pipeline/collect.js +1283 -1
  20. package/src/evolve/pipeline/dispatch.js +421 -1
  21. package/src/evolve/pipeline/enrich.js +440 -1
  22. package/src/evolve/pipeline/hub.js +319 -1
  23. package/src/evolve/pipeline/select.js +274 -1
  24. package/src/evolve/pipeline/signals.js +206 -1
  25. package/src/evolve/utils.js +264 -1
  26. package/src/evolve.js +350 -1
  27. package/src/gep/a2aProtocol.js +4463 -1
  28. package/src/gep/antiAbuseTelemetry.js +233 -1
  29. package/src/gep/autoDistillConv.js +205 -1
  30. package/src/gep/autoDistillLlm.js +315 -1
  31. package/src/gep/candidateEval.js +92 -1
  32. package/src/gep/candidates.js +198 -1
  33. package/src/gep/contentHash.js +30 -1
  34. package/src/gep/conversationDistiller.js +270 -0
  35. package/src/gep/conversationSniffer.js +266 -1
  36. package/src/gep/crypto.js +89 -1
  37. package/src/gep/curriculum.js +163 -1
  38. package/src/gep/deviceId.js +218 -1
  39. package/src/gep/envFingerprint.js +118 -1
  40. package/src/gep/epigenetics.js +31 -1
  41. package/src/gep/execBridge.js +712 -1
  42. package/src/gep/explore.js +289 -1
  43. package/src/gep/hash.js +15 -1
  44. package/src/gep/hubFetch.js +608 -1
  45. package/src/gep/hubReview.js +207 -1
  46. package/src/gep/hubSearch.js +526 -1
  47. package/src/gep/hubVerify.js +306 -1
  48. package/src/gep/learningSignals.js +89 -1
  49. package/src/gep/memoryGraph.js +1449 -1
  50. package/src/gep/memoryGraphAdapter.js +203 -1
  51. package/src/gep/mutation.js +203 -1
  52. package/src/gep/narrativeMemory.js +108 -1
  53. package/src/gep/openPRRegistry.js +205 -1
  54. package/src/gep/personality.js +423 -1
  55. package/src/gep/policyCheck.js +599 -1
  56. package/src/gep/prompt.js +836 -1
  57. package/src/gep/questionGenerator.js +103 -0
  58. package/src/gep/recallInject.js +409 -1
  59. package/src/gep/recallVerifier.js +318 -1
  60. package/src/gep/reflection.js +177 -1
  61. package/src/gep/savingsCore.js +112 -1
  62. package/src/gep/selector.js +602 -1
  63. package/src/gep/skillDistiller.js +1294 -1
  64. package/src/gep/solidify.js +1699 -1
  65. package/src/gep/strategy.js +136 -1
  66. package/src/gep/tokenSavings.js +95 -1
  67. package/src/gep/workspaceKeychain.js +174 -1
  68. package/src/proxy/extensions/traceControl.js +109 -1
  69. package/src/proxy/inject.js +52 -1
  70. package/src/proxy/lifecycle/manager.js +108 -7
  71. package/src/proxy/server/routes.js +31 -0
  72. package/src/proxy/server/settings.js +6 -2
  73. package/src/proxy/sync/engine.js +31 -15
  74. package/src/proxy/sync/inbound.js +87 -9
  75. package/src/proxy/sync/outbound.js +57 -4
  76. package/src/proxy/trace/extractor.js +1403 -1
  77. package/src/proxy/trace/usage.js +105 -1
  78. package/CONTRIBUTING.md +0 -19
  79. package/assets/cover.png +0 -0
  80. package/scripts/a2a_export.js +0 -63
  81. package/scripts/a2a_ingest.js +0 -79
  82. package/scripts/a2a_promote.js +0 -118
  83. package/scripts/analyze_by_skill.js +0 -121
  84. package/scripts/build_binaries.js +0 -479
  85. package/scripts/check-changelog.js +0 -166
  86. package/scripts/extract_log.js +0 -85
  87. package/scripts/generate_history.js +0 -75
  88. package/scripts/gep_append_event.js +0 -96
  89. package/scripts/gep_personality_report.js +0 -234
  90. package/scripts/human_report.js +0 -147
  91. package/scripts/recall-verify-report.js +0 -234
  92. package/scripts/recover_loop.js +0 -61
  93. package/scripts/refresh_stars_badge.js +0 -168
  94. package/scripts/seed-merchants.js +0 -91
  95. package/scripts/suggest_version.js +0 -89
  96. package/scripts/validate-modules.js +0 -38
  97. package/scripts/validate-suite.js +0 -78
  98. package/skills/index.json +0 -14
  99. /package/assets/gep/{genes.seed.json → genes.json} +0 -0
  100. /package/{skills → bundled-skills}/_meta/SKILL.md +0 -0
@@ -1 +1,30 @@
1
- const _0xca05c9=_0x2812;(function(_0x430977,_0x4725cb){const _0x2fda18=_0x2812,_0x430059=_0x430977();while(!![]){try{const _0x3d15c1=parseInt(_0x2fda18(0x1bc,'\x78\x6a\x32\x32'))/(-0x1710+0x47*0x28+0xbf9)+parseInt(_0x2fda18(0x1bf,'\x6b\x26\x44\x47'))/(0xf9f*-0x2+-0x2502+-0x4442*-0x1)+parseInt(_0x2fda18(0x1c9,'\x31\x21\x4c\x51'))/(0xad3*0x1+-0x2*-0x2d7+-0x107e)+-parseInt(_0x2fda18(0x1c8,'\x78\x6a\x32\x32'))/(0x4bd*0x5+-0x1*-0xcfe+-0x1*0x24ab)*(-parseInt(_0x2fda18(0x1d2,'\x79\x4a\x4e\x79'))/(0x1*0x211e+0x2344+0x1d9*-0x25))+-parseInt(_0x2fda18(0x1d0,'\x7a\x23\x55\x55'))/(-0xb9*0x2b+0xba9+0x1370)+parseInt(_0x2fda18(0x1b7,'\x6b\x26\x44\x47'))/(-0x638+0x11c4+-0xb85)*(-parseInt(_0x2fda18(0x1bb,'\x36\x4e\x72\x42'))/(0xddb*0x2+-0xc57+-0xf57))+-parseInt(_0x2fda18(0x1c7,'\x4b\x36\x4d\x72'))/(0x1c5b+-0x2e7*0x9+-0x1*0x233);if(_0x3d15c1===_0x4725cb)break;else _0x430059['push'](_0x430059['shift']());}catch(_0xeccef3){_0x430059['push'](_0x430059['shift']());}}}(_0x5d14,-0x2*-0x69b3+0x7f4d5*0x1+-0x397a8));const _0x253ebc=(function(){let _0x511eda=!![];return function(_0xf6153e,_0xdd11aa){const _0x45ab46=_0x511eda?function(){const _0xae7c09=_0x2812;if(_0xdd11aa){const _0x32c74a=_0xdd11aa[_0xae7c09(0x1cd,'\x6d\x59\x66\x29')](_0xf6153e,arguments);return _0xdd11aa=null,_0x32c74a;}}:function(){};return _0x511eda=![],_0x45ab46;};}()),_0x44e93f=_0x253ebc(this,function(){const _0x13ba4e=_0x2812,_0x3b2294={};_0x3b2294[_0x13ba4e(0x1be,'\x79\x28\x21\x75')]=_0x13ba4e(0x1cb,'\x51\x65\x51\x6f')+_0x13ba4e(0x1c5,'\x79\x4a\x4e\x79');const _0x26e0c8=_0x3b2294;return _0x44e93f[_0x13ba4e(0x1cf,'\x4b\x36\x4d\x72')]()['\x73\x65\x61\x72\x63\x68'](_0x26e0c8[_0x13ba4e(0x1b5,'\x51\x37\x64\x6e')])[_0x13ba4e(0x1d3,'\x51\x71\x51\x68')]()['\x63\x6f\x6e\x73\x74\x72\x75\x63'+_0x13ba4e(0x1c3,'\x56\x7a\x6b\x6c')](_0x44e93f)[_0x13ba4e(0x1b9,'\x72\x6e\x23\x6c')](_0x13ba4e(0x1b8,'\x36\x52\x61\x43')+_0x13ba4e(0x1c6,'\x51\x37\x64\x6e'));});_0x44e93f();function _0x2812(_0x2b77de,_0x31e377){_0x2b77de=_0x2b77de-(-0xc5f*0x1+0xc60*-0x3+0x3332);const _0x2b7316=_0x5d14();let _0xb41dfd=_0x2b7316[_0x2b77de];if(_0x2812['\x61\x67\x64\x63\x6e\x71']===undefined){var _0x15c4a3=function(_0x5e5a21){const _0x1fe519='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0xcac4e3='',_0x5ebff6='',_0x567b1b=_0xcac4e3+_0x15c4a3,_0x8aaaba=(''+function(){return 0x794+0xcee+0x15e*-0xf;})['\x69\x6e\x64\x65\x78\x4f\x66']('\x0a')!==-(0x19e*-0x1+-0x21c9*0x1+0x2368);for(let _0x3fe349=-0x3b*0x51+0x1479*-0x1+0x2724,_0x5a5150,_0x4c6d7d,_0x3a88c6=-0x76b+0x113c+-0x9d1;_0x4c6d7d=_0x5e5a21['\x63\x68\x61\x72\x41\x74'](_0x3a88c6++);~_0x4c6d7d&&(_0x5a5150=_0x3fe349%(0x4f0+-0x1a74+0x1588)?_0x5a5150*(0xb*-0x31c+-0x13bf+0x5*0xad7)+_0x4c6d7d:_0x4c6d7d,_0x3fe349++%(0x106*0x16+0x471*0x3+-0x23d3))?_0xcac4e3+=_0x8aaaba||_0x567b1b['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x3a88c6+(0x1*-0x15cd+-0x9c6+0x1f9d*0x1))-(-0x4c1*0x3+0x1bab+-0xd5e)!==0x1163*0x1+0x1*-0x258f+-0xa16*-0x2?String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xc*-0x250+0x1202+0xabd&_0x5a5150>>(-(0x1*0x5b5+0x137e+-0x1931)*_0x3fe349&-0x1f0a+-0x11*0x7b+0x273b)):_0x3fe349:0xd04+0x2007+-0xd*0x377){_0x4c6d7d=_0x1fe519['\x69\x6e\x64\x65\x78\x4f\x66'](_0x4c6d7d);}for(let _0x25cf08=0x1b13+0x1eb7*0x1+-0x39ca,_0x27d16d=_0xcac4e3['\x6c\x65\x6e\x67\x74\x68'];_0x25cf08<_0x27d16d;_0x25cf08++){_0x5ebff6+='\x25'+('\x30\x30'+_0xcac4e3['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x25cf08)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x3*0xb1e+-0xb2*0x36+-0x2*-0x221))['\x73\x6c\x69\x63\x65'](-(0x77c+-0x18e0+0x1166));}return decodeURIComponent(_0x5ebff6);};const _0x56bdcc=function(_0x1c6494,_0x58d4d5){let _0x4576c2=[],_0x716ecc=-0x20*0x128+-0x88+0x2588,_0x32a6ee,_0x23d6e7='';_0x1c6494=_0x15c4a3(_0x1c6494);let _0x58c576;for(_0x58c576=-0x125a*-0x1+0x1c94+0x2*-0x1777;_0x58c576<0x25f3*-0x1+-0x1679*0x1+0x3d6c;_0x58c576++){_0x4576c2[_0x58c576]=_0x58c576;}for(_0x58c576=0x2561+-0x8eb+-0x1c76;_0x58c576<0x86*-0x48+0xaf9*-0x2+-0x18e*-0x27;_0x58c576++){_0x716ecc=(_0x716ecc+_0x4576c2[_0x58c576]+_0x58d4d5['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x58c576%_0x58d4d5['\x6c\x65\x6e\x67\x74\x68']))%(0x47*0x28+-0x18c0+0xea8),_0x32a6ee=_0x4576c2[_0x58c576],_0x4576c2[_0x58c576]=_0x4576c2[_0x716ecc],_0x4576c2[_0x716ecc]=_0x32a6ee;}_0x58c576=-0xc56*0x3+-0x105c*-0x2+0x2*0x225,_0x716ecc=-0x11*-0xc8+0x22b4+0x25*-0x14c;for(let _0x5e3609=-0x3*-0x149+-0x1*-0x1a43+0xf0f*-0x2;_0x5e3609<_0x1c6494['\x6c\x65\x6e\x67\x74\x68'];_0x5e3609++){_0x58c576=(_0x58c576+(0x19d0+0x125*0x1+-0x1af4))%(0xba9+0xaae+-0x1557),_0x716ecc=(_0x716ecc+_0x4576c2[_0x58c576])%(-0x638+0x11c4+-0xa8c),_0x32a6ee=_0x4576c2[_0x58c576],_0x4576c2[_0x58c576]=_0x4576c2[_0x716ecc],_0x4576c2[_0x716ecc]=_0x32a6ee,_0x23d6e7+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](_0x1c6494['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x5e3609)^_0x4576c2[(_0x4576c2[_0x58c576]+_0x4576c2[_0x716ecc])%(0xddb*0x2+-0xc57+-0xe5f)]);}return _0x23d6e7;};_0x2812['\x6c\x72\x63\x63\x49\x52']=_0x56bdcc,_0x2812['\x59\x78\x73\x4e\x61\x77']={},_0x2812['\x61\x67\x64\x63\x6e\x71']=!![];}const _0xe018d=_0x2b7316[0x1c5b+-0x2e7*0x9+-0x1*0x23c],_0x461f6c=_0x2b77de+_0xe018d,_0x352805=_0x2812['\x59\x78\x73\x4e\x61\x77'][_0x461f6c];if(!_0x352805){if(_0x2812['\x56\x45\x45\x75\x4c\x71']===undefined){const _0xbcb682=function(_0x21c348){this['\x58\x77\x4d\x4a\x49\x61']=_0x21c348,this['\x78\x78\x65\x6d\x55\x46']=[-0x2*-0x18e+0x1df2*0x1+-0x210d,0x2*0x7ed+0x1338+-0x86*0x43,0x2*0x12d5+0x24f2+-0x4a9c],this['\x74\x49\x59\x71\x6c\x6c']=function(){return'\x6e\x65\x77\x53\x74\x61\x74\x65';},this['\x52\x45\x6c\x75\x45\x42']='\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a',this['\x74\x6c\x52\x58\x76\x76']='\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d';};_0xbcb682['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x75\x71\x43\x48\x54\x50']=function(){const _0x265797=new RegExp(this['\x52\x45\x6c\x75\x45\x42']+this['\x74\x6c\x52\x58\x76\x76']),_0x2945df=_0x265797['\x74\x65\x73\x74'](this['\x74\x49\x59\x71\x6c\x6c']['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?--this['\x78\x78\x65\x6d\x55\x46'][-0x11ef+-0x2*-0xf49+-0x1ce*0x7]:--this['\x78\x78\x65\x6d\x55\x46'][-0x247b+0x9a3*0x3+0x792];return this['\x64\x53\x4d\x75\x63\x78'](_0x2945df);},_0xbcb682['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x64\x53\x4d\x75\x63\x78']=function(_0x374783){if(!Boolean(~_0x374783))return _0x374783;return this['\x65\x47\x72\x7a\x55\x52'](this['\x58\x77\x4d\x4a\x49\x61']);},_0xbcb682['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x65\x47\x72\x7a\x55\x52']=function(_0x2376dd){for(let _0x339c90=0x258a+-0x1b88+-0x3d*0x2a,_0x4b5143=this['\x78\x78\x65\x6d\x55\x46']['\x6c\x65\x6e\x67\x74\x68'];_0x339c90<_0x4b5143;_0x339c90++){this['\x78\x78\x65\x6d\x55\x46']['\x70\x75\x73\x68'](Math['\x72\x6f\x75\x6e\x64'](Math['\x72\x61\x6e\x64\x6f\x6d']())),_0x4b5143=this['\x78\x78\x65\x6d\x55\x46']['\x6c\x65\x6e\x67\x74\x68'];}return _0x2376dd(this['\x78\x78\x65\x6d\x55\x46'][0xad*0xc+-0x2613+0x1df7]);},(''+function(){return-0xe*-0x107+0x33*0xb8+-0x330a;})['\x69\x6e\x64\x65\x78\x4f\x66']('\x0a')===-(-0xad2*-0x3+-0x1c19+0x1f*-0x24)&&new _0xbcb682(_0x2812)['\x75\x71\x43\x48\x54\x50'](),_0x2812['\x56\x45\x45\x75\x4c\x71']=!![];}_0xb41dfd=_0x2812['\x6c\x72\x63\x63\x49\x52'](_0xb41dfd,_0x31e377),_0x2812['\x59\x78\x73\x4e\x61\x77'][_0x461f6c]=_0xb41dfd;}else _0xb41dfd=_0x352805;return _0xb41dfd;}const {SCHEMA_VERSION:_0x1d8863,canonicalize:_0x4fde81,computeAssetId:_0x5db898,verifyAssetId:_0x4617e3}=require(_0xca05c9(0x1c1,'\x4d\x78\x63\x69')+_0xca05c9(0x1c2,'\x66\x67\x2a\x37')),_0x322d78={};_0x322d78[_0xca05c9(0x1d5,'\x6d\x5e\x79\x64')+_0xca05c9(0x1ba,'\x32\x62\x35\x62')]=_0x1d8863,_0x322d78[_0xca05c9(0x1b3,'\x36\x52\x61\x43')+_0xca05c9(0x1c0,'\x50\x6a\x63\x5b')]=_0x4fde81,_0x322d78['\x63\x6f\x6d\x70\x75\x74\x65\x41'+_0xca05c9(0x1ca,'\x66\x77\x6e\x25')]=_0x5db898,_0x322d78['\x76\x65\x72\x69\x66\x79\x41\x73'+'\x73\x65\x74\x49\x64']=_0x4617e3,module[_0xca05c9(0x1c4,'\x51\x71\x51\x68')]=_0x322d78;function _0x5d14(){const _0x13055f=['\x57\x50\x70\x63\x49\x73\x71\x73\x57\x35\x7a\x58\x6e\x59\x42\x63\x4c\x64\x35\x6b\x71\x6d\x6f\x49','\x66\x4a\x4f\x69\x57\x35\x6d\x49\x57\x4f\x47\x34\x57\x35\x71','\x6c\x4c\x33\x63\x4c\x77\x64\x63\x4e\x53\x6b\x77\x78\x68\x68\x64\x52\x58\x5a\x63\x51\x53\x6f\x67','\x69\x47\x4a\x64\x4f\x53\x6b\x4a\x57\x50\x6a\x45\x57\x52\x46\x63\x47\x6d\x6b\x6b\x45\x47\x4e\x64\x4f\x47','\x65\x78\x78\x63\x49\x6d\x6b\x69\x57\x52\x47\x41\x57\x37\x4b\x67\x57\x4f\x69\x67\x42\x38\x6b\x72','\x57\x51\x4c\x2b\x75\x33\x4e\x64\x55\x38\x6f\x50\x62\x76\x43','\x46\x66\x74\x64\x52\x4c\x4c\x42\x57\x37\x53\x42\x46\x58\x39\x74\x57\x50\x68\x64\x4e\x38\x6f\x74','\x57\x51\x48\x6f\x57\x36\x62\x75\x57\x34\x47\x7a\x57\x51\x56\x63\x4f\x71','\x57\x4f\x4e\x63\x56\x38\x6f\x43\x72\x57\x53\x52\x57\x35\x46\x63\x53\x61','\x75\x77\x44\x4f\x57\x50\x6a\x4f\x57\x35\x6d\x36\x57\x37\x68\x63\x51\x53\x6b\x59\x57\x36\x42\x64\x4b\x71','\x57\x35\x48\x77\x57\x4f\x78\x64\x4c\x4a\x79','\x68\x48\x6e\x4e\x57\x34\x69\x78\x70\x47\x5a\x63\x54\x47','\x6f\x68\x52\x63\x56\x38\x6b\x74\x67\x59\x56\x63\x47\x53\x6f\x66\x57\x51\x34\x4b\x70\x38\x6b\x43','\x57\x34\x6c\x64\x54\x53\x6b\x41\x62\x4b\x35\x52\x57\x50\x2f\x64\x55\x61','\x76\x6d\x6b\x59\x57\x52\x42\x64\x47\x4b\x33\x63\x54\x57','\x6a\x43\x6f\x36\x46\x63\x31\x35\x6d\x71','\x57\x51\x74\x64\x4b\x74\x58\x4d\x78\x38\x6f\x51\x57\x50\x4e\x63\x55\x47','\x57\x52\x74\x63\x4b\x43\x6b\x51\x69\x64\x4b\x68\x62\x38\x6f\x5a\x57\x37\x46\x64\x4d\x77\x47','\x57\x4f\x6c\x63\x47\x6d\x6b\x4e\x66\x6d\x6f\x4f\x74\x62\x70\x63\x4c\x43\x6f\x2b\x6e\x77\x30','\x71\x38\x6f\x4e\x42\x4c\x70\x64\x49\x47','\x70\x78\x2f\x63\x54\x6d\x6b\x45\x65\x73\x68\x63\x50\x6d\x6f\x45\x57\x4f\x75\x4c\x70\x38\x6b\x53','\x69\x66\x34\x78\x57\x34\x4b','\x67\x33\x33\x63\x4e\x4b\x4e\x63\x4f\x65\x54\x4e\x57\x51\x53','\x45\x4b\x65\x2b\x57\x34\x6a\x6f\x57\x36\x35\x67','\x69\x43\x6b\x54\x78\x47','\x57\x52\x48\x50\x43\x67\x6c\x64\x55\x38\x6f\x30\x67\x61','\x63\x77\x56\x63\x4b\x38\x6b\x7a','\x57\x4f\x6d\x4d\x57\x37\x4e\x63\x47\x57','\x76\x4d\x6a\x51\x57\x50\x35\x4b\x57\x35\x7a\x49\x57\x35\x2f\x63\x53\x43\x6b\x51\x57\x34\x42\x64\x54\x4d\x4b','\x57\x52\x78\x64\x47\x53\x6f\x54\x79\x4e\x4b\x74\x6e\x71','\x68\x62\x4b\x69\x57\x4f\x66\x7a\x44\x31\x5a\x63\x4e\x38\x6b\x77\x42\x30\x54\x72\x46\x71','\x57\x51\x71\x47\x57\x34\x44\x68\x57\x37\x42\x63\x55\x47','\x7a\x43\x6f\x6f\x6d\x43\x6f\x78\x78\x43\x6f\x67\x7a\x68\x79','\x57\x34\x47\x74\x61\x43\x6f\x44\x57\x50\x48\x57\x69\x43\x6f\x61\x57\x37\x4f\x65\x72\x66\x30','\x57\x34\x42\x64\x4a\x4d\x76\x68\x57\x50\x53'];_0x5d14=function(){return _0x13055f;};return _0x5d14();}
1
+ // Content-addressable hashing for GEP assets.
2
+ //
3
+ // As of v1.84.0 the protocol primitives (SCHEMA_VERSION, canonicalize,
4
+ // computeAssetId, verifyAssetId) live in @evomap/gep-sdk. This module
5
+ // is a thin CommonJS facade so the ~13 internal callsites that
6
+ // `require('./contentHash')` keep working unchanged.
7
+ //
8
+ // Why move them out: every implementation that participates in GEP
9
+ // (this engine, gep-mcp-server, evox-Rust, the Hub backend) needs an
10
+ // authoritative copy of the canonicalize / computeAssetId algorithm.
11
+ // Hand-maintaining four copies caused the v1.80.8 "explore" enum
12
+ // drift incident; consolidating into the SDK makes that class of bug
13
+ // structurally impossible. If you find yourself wanting to inline the
14
+ // algorithm here again, stop -- bump @evomap/gep-sdk instead.
15
+ //
16
+ // Implementation note: @evomap/gep-sdk is published as ESM
17
+ // (`"type": "module"`). Node 22 supports `require()` of synchronous
18
+ // ESM packages, but only on 22.12.0 and later (the
19
+ // `--experimental-require-module` flag was unflagged in that
20
+ // release). `package.json#engines.node` is therefore pinned to
21
+ // `>=22.12` so the call below works in every supported runtime.
22
+
23
+ const { SCHEMA_VERSION, canonicalize, computeAssetId, verifyAssetId } = require('@evomap/gep-sdk');
24
+
25
+ module.exports = {
26
+ SCHEMA_VERSION,
27
+ canonicalize,
28
+ computeAssetId,
29
+ verifyAssetId,
30
+ };
@@ -0,0 +1,270 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('crypto');
4
+
5
+ const assetStore = require('./assetStore');
6
+ const { computeAssetId, SCHEMA_VERSION } = require('./contentHash');
7
+ const { createGene } = require('./schemas/gene');
8
+ const { createCapsule } = require('./schemas/capsule');
9
+ const { redactString, sanitizePayload } = require('./sanitize');
10
+
11
+ const DEFAULT_SIGNALS = [
12
+ 'conversation_distillation',
13
+ 'reusable_capability',
14
+ 'agent_self_evolution',
15
+ ];
16
+
17
+ const SIGNAL_RULES = [
18
+ { signal: 'conversation_distillation', re: /\b(distill|distillation|distilled|蒸馏|提炼|萃取)\b/i },
19
+ { signal: 'gene_publish', re: /\b(gene|capsule|evomap|evolver|gep)\b|基因|胶囊/i },
20
+ { signal: 'reusable_capability', re: /\b(reusable|repeatable|workflow|playbook|capability)\b|可复用|复用|能力|流程/i },
21
+ { signal: 'visual_annotation', re: /\b(screenshot|annotat|mock|wireframe|playwright|visual)\b|截图|圈圈|标注|画图|飞书/i },
22
+ { signal: 'frontend_polish', re: /\b(frontend|ui|ux|interaction|polish|mockup)\b|前端|交互|打磨|体验/i },
23
+ { signal: 'proxy_sync', re: /\b(proxy|sync|mailbox|outbound|hub|asset_submit)\b|同步|队列|代理/i },
24
+ { signal: 'plugin_integration', re: /\b(plugin|codex|claude|cursor|antigravity|workbuddy|hook|notify)\b|插件|钩子/i },
25
+ { signal: 'test_verified', re: /\b(test|build|verify|passed|green)\b|测试|验证|通过/i },
26
+ ];
27
+
28
+ function trimText(value, max) {
29
+ const text = redactString(String(value || '').replace(/\s+/g, ' ').trim());
30
+ return text.length > max ? text.slice(0, max - 1) + '...' : text;
31
+ }
32
+
33
+ function asArray(value) {
34
+ if (!value) return [];
35
+ return Array.isArray(value) ? value : [value];
36
+ }
37
+
38
+ function normalizeList(value, maxItems, maxLen) {
39
+ return asArray(value)
40
+ .map((item) => trimText(item, maxLen || 180))
41
+ .filter(Boolean)
42
+ .slice(0, maxItems);
43
+ }
44
+
45
+ function slugify(value) {
46
+ const raw = String(value || 'conversation-capability').toLowerCase();
47
+ const ascii = raw
48
+ .replace(/[^a-z0-9]+/g, '-')
49
+ .replace(/^-+|-+$/g, '')
50
+ .replace(/-{2,}/g, '-');
51
+ if (ascii.length >= 8) return ascii.slice(0, 56).replace(/-+$/g, '');
52
+ const hash = crypto.createHash('sha1').update(raw, 'utf8').digest('hex').slice(0, 8);
53
+ return 'conversation-capability-' + hash;
54
+ }
55
+
56
+ function hashInput(input) {
57
+ return crypto.createHash('sha1').update(JSON.stringify(input || {}), 'utf8').digest('hex').slice(0, 10);
58
+ }
59
+
60
+ function inferSignals(text, providedSignals) {
61
+ const found = new Set(normalizeList(providedSignals, 12, 64));
62
+ for (const rule of SIGNAL_RULES) {
63
+ if (rule.re.test(text)) found.add(rule.signal);
64
+ }
65
+ if (found.size === 0) DEFAULT_SIGNALS.forEach((s) => found.add(s));
66
+ return Array.from(found).slice(0, 12);
67
+ }
68
+
69
+ function inferCategory(signals, text) {
70
+ const hay = `${signals.join(' ')} ${text}`.toLowerCase();
71
+ if (/proxy|sync|auth|error|failure|bug|repair|修复|故障/.test(hay)) return 'repair';
72
+ if (/new|plugin|integration|feature|capability|能力|新增/.test(hay)) return 'innovate';
73
+ return 'optimize';
74
+ }
75
+
76
+ function normalizeExecution(input) {
77
+ const execution = input && typeof input.execution === 'object' ? input.execution : {};
78
+ const validation = normalizeList(input.validation || input.verification || execution.validation, 8, 180);
79
+ const trace = asArray(execution.trace).map((item) => {
80
+ if (typeof item === 'string') return { command: trimText(item, 180), exit: 0 };
81
+ if (!item || typeof item !== 'object') return null;
82
+ return {
83
+ command: trimText(item.command || item.cmd || item.name || 'validation', 180),
84
+ exit: Number.isInteger(item.exit) ? item.exit : (item.ok === false ? 1 : 0),
85
+ summary: trimText(item.summary || item.output || '', 240),
86
+ };
87
+ }).filter(Boolean);
88
+ for (const cmd of validation) {
89
+ if (!trace.some((t) => t.command === cmd)) trace.push({ command: cmd, exit: 0 });
90
+ }
91
+ const ok = execution.status === 'success'
92
+ || execution.ok === true
93
+ || validation.length > 0
94
+ || trace.some((t) => t.exit === 0);
95
+ return {
96
+ status: ok ? 'success' : 'failed',
97
+ trace,
98
+ validation,
99
+ blast_radius: execution.blast_radius || input.blast_radius || { files: 0, lines: 0 },
100
+ };
101
+ }
102
+
103
+ function normalizePublishBlastRadius(value, artifactCount) {
104
+ const files = Number(value && value.files);
105
+ const lines = Number(value && value.lines);
106
+ return {
107
+ files: Math.max(1, Math.trunc(Number.isFinite(files) ? files : (artifactCount || 1))),
108
+ lines: Math.max(1, Math.trunc(Number.isFinite(lines) ? lines : 1)),
109
+ };
110
+ }
111
+
112
+ function capsuleContent(normalized) {
113
+ return redactString(JSON.stringify(sanitizePayload({
114
+ platform: normalized.platform,
115
+ source_thread: normalized.source_thread || null,
116
+ artifacts: normalized.artifacts,
117
+ excerpt: normalized.text.slice(0, 1200),
118
+ })));
119
+ }
120
+
121
+ function buildStrategy(input) {
122
+ const explicit = normalizeList(input.strategy || input.steps, 10, 220);
123
+ if (explicit.length >= 3) return explicit;
124
+ const artifacts = normalizeList(input.artifacts, 6, 160);
125
+ const strategy = explicit.slice();
126
+ strategy.push('Capture the user-visible trigger and the concrete workflow that solved it.');
127
+ strategy.push('Preserve evidence: commands, screenshots, documents, changed files, and validation results.');
128
+ if (artifacts.length > 0) strategy.push('Link generated artifacts back to the reusable procedure before publishing.');
129
+ strategy.push('Sanitize secrets and local-only paths before persisting or submitting the asset.');
130
+ strategy.push('Queue the resulting Gene/Capsule through the local Proxy so Hub outages do not drop the learning.');
131
+ return strategy.slice(0, 10);
132
+ }
133
+
134
+ function evaluateGate(input, normalized) {
135
+ let score = 0;
136
+ const reasons = [];
137
+ if (normalized.summary.length >= 40) { score += 2; reasons.push('summary'); }
138
+ if (normalized.strategy.length >= 3) { score += 2; reasons.push('strategy'); }
139
+ if (normalized.artifacts.length > 0) { score += 1; reasons.push('artifacts'); }
140
+ if (normalized.execution.validation.length > 0 || normalized.execution.trace.length > 0) { score += 1; reasons.push('validation'); }
141
+ if (/\b(gene|capsule|distill|reusable|evomap|evolver)\b|蒸馏|提炼|可复用|基因/i.test(normalized.text)) {
142
+ score += 2;
143
+ reasons.push('explicit_distill_signal');
144
+ }
145
+ const threshold = Number(input.min_score || input.minScore || 5);
146
+ if (score < threshold) {
147
+ return { ok: false, score, threshold, reasons, reason: 'insufficient_reusable_signal' };
148
+ }
149
+ return { ok: true, score, threshold, reasons };
150
+ }
151
+
152
+ function normalizeConversationInput(input) {
153
+ const sourceText = [
154
+ input.summary,
155
+ input.title,
156
+ input.user_prompt,
157
+ input.userPrompt,
158
+ input.assistant_summary,
159
+ input.assistantSummary,
160
+ input.transcript,
161
+ input.conversation,
162
+ ].filter(Boolean).join('\n');
163
+ const text = trimText(sourceText, 8000);
164
+ const summary = trimText(input.summary || input.assistant_summary || input.assistantSummary || text, 300);
165
+ const signals = inferSignals(text, input.signals);
166
+ const strategy = buildStrategy(input);
167
+ const artifacts = normalizeList(input.artifacts || input.outputs || input.files, 12, 240);
168
+ const execution = normalizeExecution(input);
169
+ return {
170
+ text,
171
+ summary,
172
+ signals,
173
+ strategy,
174
+ artifacts,
175
+ execution,
176
+ platform: trimText(input.platform || input.host || 'generic', 64),
177
+ source_thread: trimText(input.thread_id || input.threadId || input.session_id || input.sessionId || '', 128),
178
+ };
179
+ }
180
+
181
+ function distillConversation(input, opts = {}) {
182
+ if (!input || typeof input !== 'object') {
183
+ return { ok: false, status: 'skipped', reason: 'input_object_required' };
184
+ }
185
+ const normalized = normalizeConversationInput(input);
186
+ if (!normalized.summary || normalized.summary.length < 20) {
187
+ return { ok: false, status: 'skipped', reason: 'summary_required' };
188
+ }
189
+ const gate = evaluateGate(input, normalized);
190
+ if (!gate.ok) {
191
+ return { ok: false, status: 'skipped', reason: gate.reason, quality: gate, signals: normalized.signals };
192
+ }
193
+
194
+ const slug = slugify(input.name || input.title || normalized.summary);
195
+ const fingerprint = hashInput({
196
+ summary: normalized.summary,
197
+ signals: normalized.signals,
198
+ strategy: normalized.strategy,
199
+ artifacts: normalized.artifacts,
200
+ });
201
+ const gene = createGene({
202
+ id: `gene_conversation_${slug}_${fingerprint}`,
203
+ summary: normalized.summary,
204
+ category: inferCategory(normalized.signals, normalized.text),
205
+ signals_match: normalized.signals,
206
+ preconditions: [
207
+ 'A live agent conversation produced a repeatable workflow or capability.',
208
+ 'The conversation includes enough evidence to reconstruct when and how to use it.',
209
+ ],
210
+ strategy: normalized.strategy,
211
+ validation: normalized.execution.validation.length > 0 ? normalized.execution.validation : ['node --version'],
212
+ constraints: { max_files: 20, forbidden_paths: ['.git', 'node_modules', '.env'] },
213
+ schema_version: SCHEMA_VERSION,
214
+ _source: {
215
+ kind: 'conversation_distillation',
216
+ platform: normalized.platform,
217
+ source_thread: normalized.source_thread || null,
218
+ quality: gate,
219
+ distilled_at: new Date().toISOString(),
220
+ },
221
+ });
222
+ gene.asset_id = computeAssetId(gene);
223
+
224
+ const capsule = createCapsule({
225
+ id: `capsule_conversation_${slug}_${fingerprint}`,
226
+ trigger: normalized.signals,
227
+ gene: gene.id,
228
+ summary: normalized.summary,
229
+ confidence: Math.min(0.95, 0.5 + gate.score / 20),
230
+ blast_radius: normalizePublishBlastRadius(normalized.execution.blast_radius, normalized.artifacts.length),
231
+ outcome: { status: normalized.execution.status, score: normalized.execution.status === 'success' ? 0.82 : 0.35 },
232
+ success_streak: normalized.execution.status === 'success' ? 1 : 0,
233
+ success_reason: normalized.execution.status === 'success' ? 'Conversation included reusable evidence and validation signals.' : null,
234
+ source_type: 'conversation_distillation',
235
+ strategy: normalized.strategy,
236
+ execution_trace: normalized.execution.trace,
237
+ a2a: { eligible_to_broadcast: true },
238
+ content: capsuleContent(normalized),
239
+ diff: '',
240
+ reused_asset_id: '',
241
+ env_fingerprint: {
242
+ platform: normalized.platform,
243
+ source_thread: normalized.source_thread || null,
244
+ },
245
+ });
246
+ capsule.asset_id = computeAssetId(capsule);
247
+
248
+ const persist = opts.persist !== false && input.persist !== false;
249
+ if (persist) {
250
+ assetStore.upsertGene(gene);
251
+ assetStore.upsertCapsule(capsule);
252
+ }
253
+
254
+ return {
255
+ ok: true,
256
+ status: persist ? 'stored' : 'draft',
257
+ distill_id: fingerprint,
258
+ quality: gate,
259
+ signals: normalized.signals,
260
+ gene,
261
+ capsule,
262
+ };
263
+ }
264
+
265
+ module.exports = {
266
+ distillConversation,
267
+ normalizeConversationInput,
268
+ inferSignals,
269
+ evaluateGate,
270
+ };