@evomap/evolver 1.89.2 → 1.89.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) 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 +1237 -0
  9. package/README.ja-JP.md +1 -3
  10. package/README.ko-KR.md +1 -3
  11. package/README.md +86 -530
  12. package/README.public.md +569 -0
  13. package/README.zh-CN.md +1 -3
  14. package/SECURITY.md +108 -0
  15. package/assets/gep/events.jsonl +3 -0
  16. package/assets/gep/genes.json +496 -0
  17. package/examples/atp-consumer-quickstart.md +100 -0
  18. package/examples/hello-world.md +38 -0
  19. package/index.js +44 -48
  20. package/package.json +6 -17
  21. package/proxy-package.json +39 -0
  22. package/public.manifest.json +143 -0
  23. package/src/adapters/hookAdapter.js +2 -0
  24. package/src/adapters/scripts/_lockPaths.js +74 -0
  25. package/src/adapters/scripts/evolver-session-start.js +19 -27
  26. package/src/config.js +23 -0
  27. package/src/evolve/guards.js +721 -1
  28. package/src/evolve/pipeline/collect.js +1283 -1
  29. package/src/evolve/pipeline/dispatch.js +421 -1
  30. package/src/evolve/pipeline/enrich.js +440 -1
  31. package/src/evolve/pipeline/hub.js +319 -1
  32. package/src/evolve/pipeline/select.js +274 -1
  33. package/src/evolve/pipeline/signals.js +206 -1
  34. package/src/evolve/utils.js +264 -1
  35. package/src/evolve.js +350 -1
  36. package/src/experiment/agentRunner.js +229 -0
  37. package/src/experiment/cli.js +159 -0
  38. package/src/experiment/comparison.js +233 -0
  39. package/src/experiment/metrics.js +75 -0
  40. package/src/forceUpdate.js +311 -30
  41. package/src/gep/a2aProtocol.js +4455 -1
  42. package/src/gep/antiAbuseTelemetry.js +233 -0
  43. package/src/gep/autoDistillConv.js +205 -1
  44. package/src/gep/autoDistillLlm.js +315 -1
  45. package/src/gep/candidateEval.js +92 -1
  46. package/src/gep/candidates.js +198 -1
  47. package/src/gep/contentHash.js +30 -1
  48. package/src/gep/conversationSniffer.js +266 -1
  49. package/src/gep/crypto.js +89 -1
  50. package/src/gep/curriculum.js +163 -1
  51. package/src/gep/deviceId.js +218 -1
  52. package/src/gep/envFingerprint.js +118 -1
  53. package/src/gep/epigenetics.js +31 -1
  54. package/src/gep/execBridge.js +711 -1
  55. package/src/gep/explore.js +289 -1
  56. package/src/gep/hash.js +15 -1
  57. package/src/gep/hubFetch.js +359 -1
  58. package/src/gep/hubReview.js +207 -1
  59. package/src/gep/hubSearch.js +526 -1
  60. package/src/gep/hubVerify.js +306 -1
  61. package/src/gep/learningSignals.js +89 -1
  62. package/src/gep/memoryGraph.js +1374 -1
  63. package/src/gep/memoryGraphAdapter.js +203 -1
  64. package/src/gep/mutation.js +203 -1
  65. package/src/gep/narrativeMemory.js +108 -1
  66. package/src/gep/openPRRegistry.js +205 -1
  67. package/src/gep/personality.js +423 -1
  68. package/src/gep/policyCheck.js +599 -1
  69. package/src/gep/prompt.js +836 -1
  70. package/src/gep/recallInject.js +409 -1
  71. package/src/gep/recallVerifier.js +318 -1
  72. package/src/gep/reflection.js +177 -1
  73. package/src/gep/sanitize.js +9 -0
  74. package/src/gep/selector.js +602 -1
  75. package/src/gep/skillDistiller.js +1294 -1
  76. package/src/gep/solidify.js +1699 -1
  77. package/src/gep/strategy.js +136 -1
  78. package/src/gep/tokenSavings.js +88 -1
  79. package/src/gep/validator/sandboxExecutor.js +29 -1
  80. package/src/gep/workspaceKeychain.js +174 -1
  81. package/src/proxy/extensions/traceControl.js +99 -1
  82. package/src/proxy/index.js +14 -5
  83. package/src/proxy/inject.js +52 -1
  84. package/src/proxy/lifecycle/manager.js +30 -0
  85. package/src/proxy/mailbox/store.js +2 -1
  86. package/src/proxy/router/messages_route.js +13 -2
  87. package/src/proxy/trace/extractor.js +646 -1
  88. package/src/proxy/trace/usage.js +105 -1
  89. package/CONTRIBUTING.md +0 -19
  90. package/assets/cover.png +0 -0
  91. package/assets/gep/genes.seed.json +0 -245
  92. package/scripts/a2a_export.js +0 -63
  93. package/scripts/a2a_ingest.js +0 -79
  94. package/scripts/a2a_promote.js +0 -118
  95. package/scripts/analyze_by_skill.js +0 -121
  96. package/scripts/build_binaries.js +0 -479
  97. package/scripts/check-changelog.js +0 -166
  98. package/scripts/extract_log.js +0 -85
  99. package/scripts/generate_history.js +0 -75
  100. package/scripts/gep_append_event.js +0 -96
  101. package/scripts/gep_personality_report.js +0 -234
  102. package/scripts/human_report.js +0 -147
  103. package/scripts/recall-verify-report.js +0 -234
  104. package/scripts/recover_loop.js +0 -61
  105. package/scripts/seed-merchants.js +0 -91
  106. package/scripts/suggest_version.js +0 -89
  107. package/scripts/validate-modules.js +0 -38
  108. package/scripts/validate-suite.js +0 -78
  109. package/skills/index.json +0 -14
  110. /package/{skills → bundled-skills}/_meta/SKILL.md +0 -0
@@ -1 +1,105 @@
1
- const _0x28f474=_0x2c06;(function(_0x43e92d,_0x1c7e6a){const _0x3c9e19=_0x2c06,_0x5f0eea=_0x43e92d();while(!![]){try{const _0x3d94e2=parseInt(_0x3c9e19(0x222,'\x45\x41\x59\x72'))/(0x16f7+-0x847+-0xeaf)*(-parseInt(_0x3c9e19(0x218,'\x40\x35\x23\x76'))/(0x1*-0xdc7+-0x4*-0x516+-0x68f))+parseInt(_0x3c9e19(0x1ec,'\x32\x42\x2a\x44'))/(0x2*0x8d+0x66d*-0x6+0x1*0x2577)*(parseInt(_0x3c9e19(0x253,'\x5d\x29\x37\x34'))/(0x287*0x1+0x331*-0x6+0x10a3))+parseInt(_0x3c9e19(0x209,'\x32\x42\x2a\x44'))/(-0x1965+-0x7ae*0x5+0x3fd0)+parseInt(_0x3c9e19(0x203,'\x69\x28\x45\x5b'))/(0x22b0+-0x1d2b+-0x57f)+parseInt(_0x3c9e19(0x231,'\x31\x65\x2a\x49'))/(0x1*-0x235f+-0x263f+0x49a5)+parseInt(_0x3c9e19(0x1fe,'\x34\x50\x61\x65'))/(-0xd43+-0x62*0x43+0x3*0xcfb)*(-parseInt(_0x3c9e19(0x20a,'\x71\x72\x2a\x40'))/(-0x3b*0x5d+0x6ef*-0x3+0x2a45))+-parseInt(_0x3c9e19(0x21b,'\x51\x37\x6e\x39'))/(0x2c*-0x32+0x2*0x79d+0x34c*-0x2);if(_0x3d94e2===_0x1c7e6a)break;else _0x5f0eea['push'](_0x5f0eea['shift']());}catch(_0x202450){_0x5f0eea['push'](_0x5f0eea['shift']());}}}(_0x3c70,0x20d40+0x1*-0x6ceb6+0x94875));const _0x17389a=(function(){const _0x57b490=_0x2c06,_0x32d187={};_0x32d187[_0x57b490(0x1ff,'\x74\x72\x58\x42')]=function(_0x3b53bf,_0x267d6f){return _0x3b53bf===_0x267d6f;},_0x32d187[_0x57b490(0x205,'\x39\x5e\x44\x49')]='\x59\x6c\x6e\x50\x64';const _0x4c2de3=_0x32d187;let _0x421f0a=!![];return function(_0xdbd152,_0x1cdee7){const _0x460201=_0x57b490;if(_0x4c2de3[_0x460201(0x1f5,'\x71\x72\x2a\x40')](_0x4c2de3[_0x460201(0x216,'\x74\x72\x58\x42')],_0x4c2de3['\x74\x69\x45\x71\x48'])){const _0x2b6747=_0x421f0a?function(){const _0x4fbd16=_0x460201;if(_0x1cdee7){const _0x41cabd=_0x1cdee7[_0x4fbd16(0x1eb,'\x39\x5e\x44\x49')](_0xdbd152,arguments);return _0x1cdee7=null,_0x41cabd;}}:function(){};return _0x421f0a=![],_0x2b6747;}else _0x1fe7f5=_0x3eb75d();};}()),_0x48ff12=_0x17389a(this,function(){const _0x48106d=_0x2c06,_0x31c781={};_0x31c781[_0x48106d(0x234,'\x33\x69\x5d\x78')]='\x28\x28\x28\x2e\x2b\x29\x2b\x29'+'\x2b\x29\x2b\x24';const _0x2d5d2a=_0x31c781;return _0x48ff12[_0x48106d(0x1ed,'\x74\x23\x4e\x57')]()[_0x48106d(0x220,'\x36\x69\x21\x40')](_0x2d5d2a['\x55\x77\x57\x50\x78'])[_0x48106d(0x1ef,'\x39\x5e\x44\x49')]()[_0x48106d(0x20b,'\x33\x69\x5d\x78')+_0x48106d(0x1f8,'\x54\x53\x34\x71')](_0x48ff12)[_0x48106d(0x251,'\x79\x61\x77\x54')](_0x2d5d2a[_0x48106d(0x232,'\x54\x53\x34\x71')]);});_0x48ff12();'use strict';const _0x3234c5=require('\x66\x73'),{resolveTraceFile:_0x4babcd,resolveEvomapNodeSecret:_0x4160e3,decryptTraceEnvelope:_0x4c9550}=require('\x2e\x2f\x65\x78\x74\x72\x61\x63'+_0x28f474(0x242,'\x61\x40\x4a\x32')),_0xd87bda={};_0xd87bda[_0x28f474(0x1ea,'\x45\x41\x59\x72')+_0x28f474(0x202,'\x56\x4c\x6b\x63')]=0x0,_0xd87bda[_0x28f474(0x249,'\x40\x35\x23\x76')+_0x28f474(0x225,'\x61\x40\x4a\x32')]=0x0,_0xd87bda[_0x28f474(0x1f7,'\x49\x21\x39\x64')+_0x28f474(0x23d,'\x4d\x49\x4d\x72')]=0x0,_0xd87bda[_0x28f474(0x22b,'\x31\x65\x2a\x49')]=0x0,_0xd87bda[_0x28f474(0x24f,'\x74\x32\x75\x5b')]=![];function _0x2c06(_0x5259d1,_0x4d6708){_0x5259d1=_0x5259d1-(-0x1974+-0xd68+0x15*0x1f1);const _0x1c6bb7=_0x3c70();let _0x489063=_0x1c6bb7[_0x5259d1];if(_0x2c06['\x4b\x66\x59\x48\x6c\x4d']===undefined){var _0x590938=function(_0x5c4255){const _0x577247='\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 _0x563664='',_0x54ce96='',_0x43c357=_0x563664+_0x590938,_0x306b57=(''+function(){return 0x6*-0x80+-0x1*0xcd+0x3cd;})['\x69\x6e\x64\x65\x78\x4f\x66']('\x0a')!==-(-0x1*0x209c+0x2239*-0x1+-0xd5e*-0x5);for(let _0xd1b3a3=0x22fe+0x3b*-0x1+-0x22c3,_0x13dd9a,_0x44d714,_0x5e369b=-0x3ce*0x3+-0x10a5*-0x1+-0x67*0xd;_0x44d714=_0x5c4255['\x63\x68\x61\x72\x41\x74'](_0x5e369b++);~_0x44d714&&(_0x13dd9a=_0xd1b3a3%(0x722*0x4+-0x21fa+0x576)?_0x13dd9a*(-0x1d*0xbf+-0x83e+-0x1e21*-0x1)+_0x44d714:_0x44d714,_0xd1b3a3++%(-0x1277+-0x2b4*-0x1+0x1*0xfc7))?_0x563664+=_0x306b57||_0x43c357['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x5e369b+(0x823*0x1+0x14a9+-0x1cc2))-(0xb01+-0x3*0x75a+-0xb17*-0x1)!==-0x23ee+0x1e2d+0x5c1?String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](-0x135c+-0xfd*0x9+-0x3*-0x9c0&_0x13dd9a>>(-(-0x121+0x1*-0x147a+0x159d)*_0xd1b3a3&0x5*-0x49a+-0x4a*-0x24+0xca0)):_0xd1b3a3:-0x1*-0x176e+-0x21f2+0xa84){_0x44d714=_0x577247['\x69\x6e\x64\x65\x78\x4f\x66'](_0x44d714);}for(let _0x2e2afa=-0x17af+-0x1c8b*0x1+0x343a,_0x1d86ed=_0x563664['\x6c\x65\x6e\x67\x74\x68'];_0x2e2afa<_0x1d86ed;_0x2e2afa++){_0x54ce96+='\x25'+('\x30\x30'+_0x563664['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x2e2afa)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x2b*-0x8b+-0x1c01+0x336a))['\x73\x6c\x69\x63\x65'](-(0x1ee0+-0x1*-0x502+-0x23e0));}return decodeURIComponent(_0x54ce96);};const _0x269e7f=function(_0x303924,_0x59769e){let _0x1192ba=[],_0x371bb7=-0x1a4b+0x828+0x1223*0x1,_0x3f7d71,_0xbca765='';_0x303924=_0x590938(_0x303924);let _0x6b0d12;for(_0x6b0d12=0x18fb+0x1*-0xe8b+-0x2*0x538;_0x6b0d12<0x130b+-0x2e*-0x65+0x73d*-0x5;_0x6b0d12++){_0x1192ba[_0x6b0d12]=_0x6b0d12;}for(_0x6b0d12=0x921*0x4+0x678*0x4+-0x3e64;_0x6b0d12<0x188a+-0xb99+-0xbf1*0x1;_0x6b0d12++){_0x371bb7=(_0x371bb7+_0x1192ba[_0x6b0d12]+_0x59769e['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x6b0d12%_0x59769e['\x6c\x65\x6e\x67\x74\x68']))%(0x15a1+-0x1f*0x112+0x3*0x42f),_0x3f7d71=_0x1192ba[_0x6b0d12],_0x1192ba[_0x6b0d12]=_0x1192ba[_0x371bb7],_0x1192ba[_0x371bb7]=_0x3f7d71;}_0x6b0d12=0x1*-0x10a5+-0x157*0xa+0x1e0b,_0x371bb7=-0x6*0xd9+0x10af+-0xb99;for(let _0x50d26f=0xeef+-0x291+-0xc5e;_0x50d26f<_0x303924['\x6c\x65\x6e\x67\x74\x68'];_0x50d26f++){_0x6b0d12=(_0x6b0d12+(-0x2435+-0xc*-0x2e2+0x19e))%(-0x6fd*-0x1+-0x9*0x182+0x795),_0x371bb7=(_0x371bb7+_0x1192ba[_0x6b0d12])%(-0x2f3*0x9+0x1434+0x1*0x757),_0x3f7d71=_0x1192ba[_0x6b0d12],_0x1192ba[_0x6b0d12]=_0x1192ba[_0x371bb7],_0x1192ba[_0x371bb7]=_0x3f7d71,_0xbca765+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](_0x303924['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x50d26f)^_0x1192ba[(_0x1192ba[_0x6b0d12]+_0x1192ba[_0x371bb7])%(-0x182*-0x7+0x1051+-0x25*0xb3)]);}return _0xbca765;};_0x2c06['\x6d\x57\x68\x73\x52\x4a']=_0x269e7f,_0x2c06['\x70\x43\x72\x56\x54\x73']={},_0x2c06['\x4b\x66\x59\x48\x6c\x4d']=!![];}const _0x5ad2df=_0x1c6bb7[-0x2*0x583+0x4b2*0x6+-0x1126],_0x54d502=_0x5259d1+_0x5ad2df,_0x1f405c=_0x2c06['\x70\x43\x72\x56\x54\x73'][_0x54d502];if(!_0x1f405c){if(_0x2c06['\x66\x73\x69\x78\x4f\x47']===undefined){const _0x38a3e7=function(_0x3e3796){this['\x59\x41\x57\x54\x48\x4c']=_0x3e3796,this['\x51\x4e\x57\x54\x61\x4b']=[-0x2*-0x419+-0x173c+-0x1*-0xf0b,0x1*-0x13d0+0x227c+-0xeac,0x86f+0x557*0x5+0x3*-0xbb6],this['\x6b\x67\x51\x48\x50\x73']=function(){return'\x6e\x65\x77\x53\x74\x61\x74\x65';},this['\x69\x64\x53\x76\x6a\x65']='\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a',this['\x69\x65\x6b\x70\x5a\x74']='\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d';};_0x38a3e7['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x48\x54\x75\x75\x6c\x6d']=function(){const _0x488ee0=new RegExp(this['\x69\x64\x53\x76\x6a\x65']+this['\x69\x65\x6b\x70\x5a\x74']),_0x4fd7ea=_0x488ee0['\x74\x65\x73\x74'](this['\x6b\x67\x51\x48\x50\x73']['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?--this['\x51\x4e\x57\x54\x61\x4b'][0x7*0x3d5+-0x110f+-0x9c3]:--this['\x51\x4e\x57\x54\x61\x4b'][-0xd60+-0x1e7*0x13+0x1*0x3185];return this['\x47\x72\x45\x6d\x50\x64'](_0x4fd7ea);},_0x38a3e7['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x47\x72\x45\x6d\x50\x64']=function(_0xfa4b41){if(!Boolean(~_0xfa4b41))return _0xfa4b41;return this['\x56\x6c\x70\x78\x7a\x68'](this['\x59\x41\x57\x54\x48\x4c']);},_0x38a3e7['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x56\x6c\x70\x78\x7a\x68']=function(_0x598689){for(let _0x23b304=-0x4d7+-0xeaa+0x1381,_0x52a9fe=this['\x51\x4e\x57\x54\x61\x4b']['\x6c\x65\x6e\x67\x74\x68'];_0x23b304<_0x52a9fe;_0x23b304++){this['\x51\x4e\x57\x54\x61\x4b']['\x70\x75\x73\x68'](Math['\x72\x6f\x75\x6e\x64'](Math['\x72\x61\x6e\x64\x6f\x6d']())),_0x52a9fe=this['\x51\x4e\x57\x54\x61\x4b']['\x6c\x65\x6e\x67\x74\x68'];}return _0x598689(this['\x51\x4e\x57\x54\x61\x4b'][0x357+-0xcf4*-0x2+-0x1d3f]);},(''+function(){return-0x750+0x2*0x855+0x1*-0x95a;})['\x69\x6e\x64\x65\x78\x4f\x66']('\x0a')===-(-0x18a+-0x6d3*0x3+-0x581*-0x4)&&new _0x38a3e7(_0x2c06)['\x48\x54\x75\x75\x6c\x6d'](),_0x2c06['\x66\x73\x69\x78\x4f\x47']=!![];}_0x489063=_0x2c06['\x6d\x57\x68\x73\x52\x4a'](_0x489063,_0x4d6708),_0x2c06['\x70\x43\x72\x56\x54\x73'][_0x54d502]=_0x489063;}else _0x489063=_0x1f405c;return _0x489063;}const _0x3b95db=Object[_0x28f474(0x1fc,'\x66\x32\x58\x29')](_0xd87bda);function _0x325126(_0x8cf2d4){const _0x4eb3f7=_0x28f474,_0x4ff622={'\x6f\x52\x45\x6d\x6e':function(_0x264d75,_0xa9b737){return _0x264d75!==_0xa9b737;},'\x6a\x57\x6a\x4a\x44':_0x4eb3f7(0x23a,'\x51\x37\x6e\x39'),'\x6f\x68\x64\x43\x52':_0x4eb3f7(0x237,'\x45\x41\x59\x72'),'\x6b\x46\x44\x4d\x41':function(_0x28fb9f,_0x468977){return _0x28fb9f(_0x468977);},'\x6c\x55\x69\x49\x6c':function(_0x32ed42,_0x2ce9c5){return _0x32ed42*_0x2ce9c5;}},_0x5bd761=_0x8cf2d4&&(_0x8cf2d4[_0x4eb3f7(0x245,'\x49\x21\x39\x64')+'\x70']||_0x8cf2d4[_0x4eb3f7(0x22e,'\x51\x37\x6e\x39')+_0x4eb3f7(0x254,'\x33\x69\x5d\x78')]);if(_0x5bd761){if(_0x4ff622[_0x4eb3f7(0x207,'\x31\x65\x2a\x49')](_0x4ff622[_0x4eb3f7(0x23f,'\x79\x61\x77\x54')],_0x4ff622[_0x4eb3f7(0x21a,'\x34\x50\x61\x65')])){const _0x35cb2e=Date[_0x4eb3f7(0x1f0,'\x6c\x4c\x4a\x45')](_0x5bd761);if(Number[_0x4eb3f7(0x226,'\x74\x72\x58\x42')](_0x35cb2e))return _0x35cb2e;}else{const _0x353ea8=_0x397b89['\x70\x61\x72\x73\x65'](_0x69e1a7);if(_0x19264c[_0x4eb3f7(0x230,'\x21\x6a\x4f\x44')](_0x353ea8))return _0x353ea8;}}if(_0x8cf2d4&&Number[_0x4eb3f7(0x240,'\x48\x34\x4f\x64')](_0x4ff622[_0x4eb3f7(0x250,'\x79\x26\x40\x4f')](Number,_0x8cf2d4[_0x4eb3f7(0x21e,'\x6e\x21\x69\x42')+'\x74'])))return _0x4ff622[_0x4eb3f7(0x23b,'\x5d\x29\x37\x34')](Number(_0x8cf2d4['\x63\x72\x65\x61\x74\x65\x64\x41'+'\x74']),-0xa4b+-0x1a0d+-0x10*-0x284);return null;}function _0x24a556(_0x2dcc63={}){const _0x10f836=_0x28f474,_0x70b525={'\x49\x67\x64\x53\x45':function(_0x30b580,_0x1bc2cd){return _0x30b580*_0x1bc2cd;},'\x52\x69\x57\x74\x54':function(_0x47d50f,_0x5df386){return _0x47d50f(_0x5df386);},'\x53\x7a\x6f\x59\x5a':function(_0x404584,_0x251b13){return _0x404584!=_0x251b13;},'\x65\x63\x4a\x4e\x77':'\x75\x74\x66\x38','\x57\x4b\x62\x46\x47':function(_0x456206){return _0x456206();},'\x4e\x53\x58\x6b\x57':function(_0x366b6c,_0x34bd07){return _0x366b6c===_0x34bd07;},'\x4e\x4d\x58\x70\x72':_0x10f836(0x214,'\x48\x34\x4f\x64'),'\x79\x44\x54\x7a\x59':function(_0x463db6,_0x33dfed){return _0x463db6===_0x33dfed;},'\x6e\x52\x6d\x56\x47':_0x10f836(0x22a,'\x48\x34\x4f\x64'),'\x48\x63\x4a\x56\x42':'\x77\x4e\x41\x4c\x76','\x47\x76\x64\x66\x66':function(_0x5df656,_0x3a9662,_0xd972e7){return _0x5df656(_0x3a9662,_0xd972e7);},'\x7a\x7a\x78\x50\x50':function(_0x1a6eb2,_0x4b7928){return _0x1a6eb2!==_0x4b7928;},'\x54\x53\x79\x49\x69':_0x10f836(0x22f,'\x65\x30\x62\x36'),'\x72\x48\x72\x4f\x49':function(_0x1d739d,_0x378f5e){return _0x1d739d(_0x378f5e);},'\x75\x76\x74\x62\x4e':function(_0x2193b9,_0x3f476f){return _0x2193b9==_0x3f476f;},'\x51\x71\x4d\x6c\x6f':function(_0x5bc364,_0x14de93){return _0x5bc364<_0x14de93;},'\x59\x48\x57\x6d\x53':function(_0x5e89da,_0x200eee){return _0x5e89da>_0x200eee;},'\x4c\x75\x43\x4f\x52':function(_0x340303,_0x1bc231){return _0x340303(_0x1bc231);},'\x48\x6d\x5a\x63\x4f':function(_0x3d6229,_0x1d6da2){return _0x3d6229(_0x1d6da2);},'\x47\x6d\x64\x78\x77':function(_0x1da588,_0x4761d9){return _0x1da588>_0x4761d9;},'\x58\x4e\x66\x4d\x54':function(_0x2b3ef3,_0x135240){return _0x2b3ef3>_0x135240;},'\x70\x4f\x48\x79\x44':function(_0x40ddc9,_0x1a2159){return _0x40ddc9||_0x1a2159;},'\x58\x63\x6b\x4e\x64':function(_0x560b61,_0x16e116){return _0x560b61===_0x16e116;},'\x57\x52\x52\x56\x46':function(_0x5a0433,_0x12e5c2){return _0x5a0433+_0x12e5c2;}},_0x374b8d=_0x2dcc63&&_0x70b525[_0x10f836(0x21d,'\x79\x61\x77\x54')](_0x2dcc63[_0x10f836(0x221,'\x6e\x21\x69\x42')],null)?Date[_0x10f836(0x1ee,'\x31\x65\x2a\x49')](_0x2dcc63['\x73\x69\x6e\x63\x65\x49\x73\x6f']):NaN,_0xc5c9d2={..._0x3b95db};if(!Number[_0x10f836(0x244,'\x32\x42\x2a\x44')](_0x374b8d))return _0xc5c9d2;const _0x3090a4=_0x2dcc63&&_0x2dcc63[_0x10f836(0x224,'\x61\x40\x4a\x32')]!=null&&Number[_0x10f836(0x1f3,'\x5e\x58\x44\x33')](Date[_0x10f836(0x20e,'\x54\x53\x34\x71')](_0x2dcc63[_0x10f836(0x1fb,'\x33\x69\x5d\x78')]))?Date[_0x10f836(0x215,'\x61\x40\x4a\x32')](_0x2dcc63[_0x10f836(0x23e,'\x66\x5a\x2a\x56')]):Date[_0x10f836(0x219,'\x74\x23\x4e\x57')]();let _0x4adff4;try{const _0x358ff0=_0x4babcd(),_0x3fce3b={..._0x3b95db};if(!_0x3234c5[_0x10f836(0x1f4,'\x48\x42\x79\x68')+'\x6e\x63'](_0x358ff0))return _0x3fce3b;_0x4adff4=_0x3234c5[_0x10f836(0x21c,'\x41\x63\x29\x32')+_0x10f836(0x204,'\x33\x69\x5d\x78')](_0x358ff0,_0x70b525[_0x10f836(0x20c,'\x45\x41\x59\x72')]);}catch(_0x45d3d8){const _0x3347fc={..._0x3b95db};return _0x3347fc;}let _0x79011e=null;try{_0x79011e=_0x70b525['\x57\x4b\x62\x46\x47'](_0x4160e3);}catch(_0x96b450){_0x79011e=null;}let _0x135d31=0x11*-0x137+-0x1539+0x1*0x29e0,_0x51a447=-0x5ed*0x4+-0x14*-0x1c9+-0xc00,_0x135c16=-0x157*0x9+-0x1e3b+-0x2a4a*-0x1;for(const _0x3b3a87 of _0x4adff4[_0x10f836(0x20d,'\x32\x42\x2a\x44')]('\x0a')){if(_0x70b525[_0x10f836(0x1f9,'\x23\x46\x34\x4c')](_0x70b525[_0x10f836(0x208,'\x21\x6a\x6e\x66')],_0x70b525[_0x10f836(0x246,'\x48\x34\x4f\x64')])){const _0x408483=_0x3b3a87[_0x10f836(0x1fd,'\x74\x72\x58\x42')]();if(!_0x408483)continue;let _0x21e7bc;try{if(_0x70b525[_0x10f836(0x21f,'\x65\x73\x4c\x25')](_0x70b525[_0x10f836(0x22c,'\x6c\x6b\x45\x68')],_0x70b525[_0x10f836(0x24b,'\x34\x21\x39\x44')])){const _0x576487=_0x440168&&(_0x48dd32[_0x10f836(0x1e9,'\x39\x5e\x44\x49')+'\x70']||_0xd325c2['\x63\x72\x65\x61\x74\x65\x64\x41'+_0x10f836(0x223,'\x39\x5e\x44\x49')]);if(_0x576487){const _0x1619ed=_0x8a04b5['\x70\x61\x72\x73\x65'](_0x576487);if(_0x7f39f5[_0x10f836(0x239,'\x69\x28\x45\x5b')](_0x1619ed))return _0x1619ed;}if(_0x3cd051&&_0x1084a1['\x69\x73\x46\x69\x6e\x69\x74\x65'](_0x5282f2(_0x6381b4[_0x10f836(0x24c,'\x6c\x23\x74\x55')+'\x74'])))return VVUKAh[_0x10f836(0x228,'\x48\x42\x79\x68')](VVUKAh[_0x10f836(0x217,'\x33\x69\x5d\x78')](_0x32779f,_0x58e9a2[_0x10f836(0x21e,'\x6e\x21\x69\x42')+'\x74']),0x409*0x5+-0x4*-0x6eb+-0x2bf1);return null;}else _0x21e7bc=JSON[_0x10f836(0x248,'\x74\x23\x4e\x57')](_0x408483);}catch(_0x37d85f){continue;}if(_0x21e7bc&&_0x21e7bc[_0x10f836(0x20f,'\x79\x26\x40\x4f')+'\x64']){if(!_0x79011e)continue;try{_0x21e7bc=_0x70b525['\x47\x76\x64\x66\x66'](_0x4c9550,_0x21e7bc,_0x79011e);}catch(_0x1972cf){continue;}}if(!_0x21e7bc||_0x70b525[_0x10f836(0x235,'\x65\x73\x4c\x25')](typeof _0x21e7bc,_0x70b525[_0x10f836(0x24a,'\x34\x50\x61\x65')]))continue;const _0x3cf76c=_0x70b525[_0x10f836(0x23c,'\x48\x34\x4f\x64')](_0x325126,_0x21e7bc);if(_0x70b525[_0x10f836(0x229,'\x79\x61\x77\x54')](_0x3cf76c,null)||_0x70b525[_0x10f836(0x22d,'\x74\x32\x75\x5b')](_0x3cf76c,_0x374b8d)||_0x70b525[_0x10f836(0x1f6,'\x31\x65\x2a\x49')](_0x3cf76c,_0x3090a4))continue;const _0x4652f2=_0x70b525[_0x10f836(0x200,'\x4d\x49\x4d\x72')](Number,_0x21e7bc[_0x10f836(0x212,'\x5d\x29\x37\x34')+_0x10f836(0x241,'\x5e\x58\x44\x33')]),_0x1ce9ad=_0x70b525[_0x10f836(0x227,'\x34\x21\x39\x44')](Number,_0x21e7bc[_0x10f836(0x1fa,'\x5e\x58\x44\x33')+_0x10f836(0x252,'\x61\x49\x6b\x23')]),_0xabf059=Number['\x69\x73\x46\x69\x6e\x69\x74\x65'](_0x4652f2)&&_0x70b525[_0x10f836(0x24e,'\x74\x72\x58\x42')](_0x4652f2,-0x1*-0x487+0x24c9+-0x2950),_0x33dbd3=Number[_0x10f836(0x1f2,'\x65\x73\x4c\x25')](_0x1ce9ad)&&_0x70b525[_0x10f836(0x236,'\x31\x65\x2a\x49')](_0x1ce9ad,0x1*-0x3fb+0x9ad*-0x3+0x34d*0xa);if(_0xabf059)_0x135d31+=_0x4652f2;if(_0x33dbd3)_0x51a447+=_0x1ce9ad;if(_0x70b525['\x70\x4f\x48\x79\x44'](_0xabf059,_0x33dbd3))_0x135c16+=0x15c5*0x1+0x17f+-0x18d*0xf;}else _0x2ec853=_0x180f56[_0x10f836(0x1f0,'\x6c\x4c\x4a\x45')](_0x24d554);}const _0x383581={..._0x3b95db};if(_0x70b525[_0x10f836(0x243,'\x74\x32\x75\x5b')](_0x135c16,-0x9*0x35c+0x135+0x1d07))return _0x383581;return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x135d31,'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x51a447,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x70b525['\x57\x52\x52\x56\x46'](_0x135d31,_0x51a447),'\x63\x61\x6c\x6c\x73':_0x135c16,'\x6d\x65\x61\x73\x75\x72\x65\x64':!![]};}function _0x3c70(){const _0x18df63=['\x57\x36\x70\x64\x4a\x53\x6b\x76\x44\x38\x6b\x31','\x57\x36\x4b\x30\x67\x75\x33\x63\x54\x53\x6b\x4f\x57\x52\x68\x64\x4d\x47','\x6f\x53\x6b\x42\x57\x4f\x6c\x64\x50\x6d\x6b\x41','\x57\x35\x66\x41\x57\x52\x78\x63\x47\x4b\x30','\x76\x77\x4a\x64\x4f\x71\x35\x34\x57\x35\x69\x37\x57\x37\x75','\x69\x43\x6b\x6f\x57\x34\x74\x63\x4f\x4d\x4a\x64\x52\x61\x37\x64\x4c\x61\x79','\x57\x34\x61\x2b\x57\x51\x74\x64\x4a\x30\x34','\x44\x64\x72\x37\x57\x51\x33\x64\x56\x74\x6c\x64\x54\x57\x6d','\x43\x53\x6f\x34\x57\x52\x68\x63\x55\x33\x34','\x66\x58\x46\x63\x50\x4e\x52\x63\x52\x43\x6b\x43','\x57\x35\x38\x75\x57\x50\x47\x6c\x6a\x47','\x57\x34\x33\x63\x49\x4a\x61\x47\x57\x34\x76\x53\x57\x4f\x78\x63\x4e\x58\x4e\x64\x4e\x68\x56\x63\x56\x71','\x64\x53\x6b\x6c\x42\x6d\x6f\x37','\x57\x36\x4a\x63\x4b\x38\x6f\x54\x57\x4f\x33\x63\x4a\x71\x72\x4e\x57\x37\x53\x49\x57\x36\x56\x64\x4e\x71\x34\x41','\x65\x47\x42\x64\x52\x38\x6b\x4e\x42\x5a\x37\x63\x4d\x75\x79','\x6b\x53\x6f\x7a\x64\x75\x48\x36\x57\x51\x42\x64\x56\x6d\x6f\x4f','\x62\x58\x2f\x64\x53\x53\x6b\x55\x7a\x71','\x64\x53\x6f\x4b\x69\x38\x6b\x35\x57\x4f\x5a\x64\x50\x38\x6f\x45\x6c\x71','\x57\x36\x46\x64\x47\x6d\x6b\x30\x43\x6d\x6b\x49\x57\x4f\x4a\x63\x51\x6d\x6f\x41','\x45\x43\x6b\x73\x57\x34\x2f\x63\x55\x30\x69','\x65\x47\x64\x64\x4b\x43\x6b\x32\x42\x49\x70\x63\x4c\x4b\x57','\x6b\x58\x4e\x63\x56\x6d\x6f\x59\x67\x71','\x57\x4f\x4b\x30\x57\x34\x30','\x57\x37\x66\x48\x57\x50\x56\x64\x48\x77\x31\x37\x57\x37\x4e\x63\x52\x47','\x57\x52\x78\x64\x4c\x6d\x6b\x7a\x57\x35\x46\x64\x4b\x66\x38\x4a\x57\x37\x4f','\x57\x37\x48\x70\x57\x37\x78\x63\x4d\x32\x56\x64\x4f\x6d\x6b\x71\x57\x36\x57','\x62\x71\x50\x39\x6d\x33\x6d','\x75\x6d\x6b\x37\x57\x36\x52\x63\x50\x78\x71','\x72\x38\x6b\x2b\x61\x6d\x6f\x6d\x57\x50\x35\x34\x57\x37\x54\x44','\x65\x57\x54\x45','\x57\x37\x4a\x64\x53\x66\x5a\x64\x54\x53\x6b\x54','\x57\x52\x70\x64\x4b\x53\x6b\x52\x57\x34\x37\x64\x49\x30\x69\x69\x57\x36\x53','\x64\x38\x6b\x53\x41\x38\x6f\x39\x57\x52\x56\x64\x49\x61\x39\x59','\x57\x4f\x6e\x6f\x44\x48\x43\x38\x57\x51\x4b','\x57\x37\x6d\x48\x57\x51\x4e\x64\x4d\x47','\x78\x43\x6f\x35\x57\x34\x6c\x63\x4e\x38\x6b\x35\x57\x36\x30\x54\x57\x52\x4a\x63\x52\x43\x6b\x44','\x57\x37\x65\x58\x57\x52\x78\x64\x4c\x77\x65','\x61\x53\x6f\x37\x57\x4f\x70\x63\x51\x53\x6f\x46','\x46\x38\x6b\x32\x57\x37\x78\x64\x4b\x53\x6b\x37\x57\x34\x58\x71\x57\x52\x74\x63\x47\x73\x6e\x59\x57\x51\x37\x64\x52\x61','\x57\x35\x7a\x66\x77\x72\x69','\x57\x51\x78\x63\x48\x63\x68\x64\x55\x4a\x37\x63\x53\x74\x78\x63\x51\x53\x6f\x49\x68\x6d\x6b\x71\x57\x35\x5a\x63\x4a\x57','\x6b\x43\x6b\x37\x43\x43\x6f\x33','\x65\x47\x42\x64\x48\x38\x6b\x5a\x76\x61','\x57\x52\x76\x4c\x57\x37\x4e\x63\x48\x47\x4f\x37\x64\x49\x33\x63\x50\x43\x6b\x6b\x43\x33\x53\x30','\x7a\x53\x6b\x48\x57\x37\x4a\x63\x50\x75\x4b','\x57\x35\x50\x44\x57\x52\x37\x64\x4d\x66\x34','\x63\x53\x6f\x48\x44\x38\x6f\x43\x57\x34\x2f\x63\x52\x38\x6f\x73\x62\x6d\x6b\x76\x57\x52\x61\x63\x57\x4f\x53','\x73\x31\x47\x35\x62\x78\x58\x59\x64\x38\x6b\x51\x57\x50\x57','\x67\x43\x6b\x54\x43\x43\x6f\x4e\x57\x51\x70\x64\x53\x57\x4c\x2b','\x6a\x53\x6f\x75\x6e\x33\x6e\x35','\x74\x53\x6b\x4e\x6b\x6d\x6b\x68\x57\x4f\x4f','\x66\x57\x76\x45\x57\x4f\x50\x4d','\x46\x6d\x6f\x71\x57\x50\x42\x63\x48\x65\x42\x64\x4c\x57\x52\x64\x56\x47','\x57\x4f\x68\x63\x4c\x74\x46\x63\x52\x38\x6f\x6c\x57\x37\x37\x64\x47\x38\x6f\x37\x79\x58\x4a\x63\x56\x71\x4f','\x57\x35\x4c\x49\x57\x50\x38\x69\x6c\x78\x79\x41\x57\x52\x69\x36\x79\x49\x42\x64\x4c\x6d\x6b\x43','\x57\x50\x78\x64\x4e\x68\x48\x4e\x57\x4f\x43\x64\x57\x51\x78\x63\x4b\x71','\x57\x51\x76\x4c\x57\x4f\x2f\x64\x4f\x4e\x2f\x64\x53\x43\x6f\x2f','\x57\x51\x2f\x63\x51\x43\x6b\x43\x57\x35\x66\x64','\x42\x38\x6f\x75\x57\x50\x56\x64\x55\x38\x6b\x4d','\x57\x37\x6d\x36\x57\x4f\x78\x64\x48\x4e\x65','\x6b\x6d\x6b\x52\x73\x6d\x6f\x47\x57\x4f\x6d','\x57\x52\x44\x57\x77\x47\x74\x64\x54\x6d\x6f\x4c\x57\x35\x4a\x64\x55\x53\x6b\x34\x77\x43\x6b\x73\x46\x43\x6f\x6e','\x57\x37\x33\x64\x47\x6d\x6b\x71','\x61\x43\x6b\x47\x57\x50\x2f\x64\x52\x53\x6b\x48','\x78\x4c\x52\x63\x49\x6d\x6f\x72\x57\x36\x75\x59\x72\x71\x57\x6c\x57\x34\x70\x64\x4a\x4e\x37\x64\x4d\x61','\x57\x52\x78\x63\x4e\x73\x43\x4d\x57\x35\x42\x63\x52\x59\x65\x66','\x6e\x57\x4a\x63\x51\x66\x68\x63\x4c\x61','\x6a\x71\x6e\x6a\x45\x4e\x58\x55\x45\x6d\x6b\x50','\x57\x36\x66\x77\x57\x4f\x4e\x64\x4c\x4c\x4f','\x67\x43\x6f\x4d\x57\x36\x6c\x63\x4b\x53\x6f\x43\x57\x51\x38','\x6e\x72\x48\x63\x45\x67\x31\x63\x42\x38\x6b\x68','\x43\x53\x6f\x63\x66\x68\x44\x44\x57\x51\x56\x64\x52\x47','\x65\x49\x42\x64\x53\x43\x6b\x54','\x41\x53\x6f\x42\x57\x50\x33\x64\x4f\x43\x6b\x56\x65\x4e\x5a\x64\x4c\x47','\x43\x6d\x6f\x45\x57\x4f\x5a\x64\x50\x53\x6b\x57','\x57\x36\x34\x47\x57\x4f\x42\x64\x4e\x4c\x44\x49\x74\x4a\x53','\x57\x35\x66\x75\x57\x51\x78\x63\x54\x30\x61','\x57\x35\x72\x71\x57\x37\x4a\x63\x55\x31\x4f','\x65\x71\x74\x63\x53\x32\x52\x63\x47\x61','\x57\x4f\x33\x63\x4f\x53\x6b\x45\x57\x34\x7a\x51','\x41\x53\x6b\x73\x57\x35\x68\x63\x50\x66\x71','\x57\x52\x4b\x4c\x6d\x43\x6f\x2b\x6d\x71','\x73\x63\x62\x78\x57\x52\x6c\x64\x50\x57','\x63\x72\x5a\x64\x4e\x38\x6b\x64\x57\x51\x6a\x4c\x65\x73\x4b','\x6e\x6d\x6f\x72\x57\x4f\x4a\x64\x47\x72\x74\x64\x52\x71','\x57\x36\x34\x7a\x57\x36\x74\x63\x49\x38\x6b\x4f\x57\x50\x4e\x63\x49\x4a\x38','\x6f\x38\x6f\x66\x57\x4f\x74\x64\x55\x72\x74\x64\x48\x6d\x6b\x49\x71\x53\x6b\x61\x7a\x4a\x37\x63\x4a\x74\x6d','\x6d\x48\x6e\x37\x57\x51\x4c\x37','\x57\x37\x47\x35\x57\x37\x58\x43\x57\x37\x78\x64\x4b\x64\x62\x70\x62\x57\x34','\x6c\x38\x6b\x31\x73\x6d\x6f\x65\x57\x51\x38','\x57\x36\x6a\x4f\x57\x51\x78\x64\x56\x66\x6d','\x75\x43\x6b\x39\x57\x35\x56\x63\x48\x78\x6d','\x6b\x38\x6f\x2f\x6e\x66\x6e\x50','\x76\x30\x68\x63\x4f\x66\x2f\x63\x56\x6d\x6b\x6d\x57\x37\x66\x6f','\x57\x37\x33\x64\x4a\x31\x6c\x63\x50\x67\x42\x64\x4f\x78\x68\x63\x4e\x61','\x67\x73\x52\x64\x4e\x6d\x6b\x77\x57\x52\x30','\x57\x50\x64\x64\x50\x32\x66\x42\x57\x50\x38','\x57\x4f\x2f\x63\x53\x38\x6b\x35\x57\x35\x48\x73','\x6a\x43\x6f\x52\x57\x51\x37\x63\x4c\x47','\x57\x36\x68\x64\x54\x6d\x6b\x4c\x7a\x6d\x6b\x6b\x57\x4f\x56\x64\x56\x58\x69','\x64\x49\x78\x63\x52\x75\x6c\x63\x49\x47','\x57\x50\x74\x63\x49\x6d\x6b\x6e\x57\x37\x35\x31\x57\x51\x30\x62\x70\x61','\x57\x52\x46\x64\x47\x53\x6b\x58\x57\x34\x30','\x41\x38\x6f\x41\x57\x50\x53','\x71\x74\x6a\x58\x57\x50\x64\x64\x52\x61','\x76\x6d\x6b\x4b\x61\x53\x6b\x68\x57\x50\x64\x64\x54\x53\x6f\x49\x65\x71','\x72\x38\x6b\x34\x67\x43\x6f\x69\x57\x4f\x66\x74\x57\x36\x35\x46','\x57\x52\x70\x63\x54\x53\x6b\x74\x57\x36\x44\x50','\x42\x6d\x6f\x61\x57\x4f\x74\x64\x4d\x53\x6b\x32\x6e\x76\x52\x64\x49\x47'];_0x3c70=function(){return _0x18df63;};return _0x3c70();}const _0x58002d={};_0x58002d[_0x28f474(0x247,'\x61\x40\x4a\x32')+_0x28f474(0x1f1,'\x6d\x71\x49\x61')]=_0x24a556,module['\x65\x78\x70\x6f\x72\x74\x73']=_0x58002d;
1
+ 'use strict';
2
+
3
+ // Per-run token-usage rollup over the proxy trace log.
4
+ //
5
+ // The local proxy (src/proxy) meters real Anthropic input/output tokens for
6
+ // every Hand /v1/messages call into proxy-traces.jsonl. This reads that log
7
+ // back -- decrypting encrypted rows with the local EvoMap node secret -- and
8
+ // sums the real tokens spent within a time window, giving solidify the
9
+ // MEASURED cost of a derive loop.
10
+ //
11
+ // Best-effort by design: returns measured:false (and never throws) when the
12
+ // proxy was inactive, the node secret is missing, no rows fall in the window,
13
+ // or the in-window rows carried no usage (e.g. streamed-but-unobserved calls).
14
+ // Callers fall back to a grounded estimate in that case.
15
+
16
+ const fs = require('fs');
17
+ const {
18
+ resolveTraceFile,
19
+ resolveEvomapNodeSecret,
20
+ decryptTraceEnvelope,
21
+ } = require('./extractor');
22
+
23
+ const EMPTY = Object.freeze({
24
+ input_tokens: 0,
25
+ output_tokens: 0,
26
+ total_tokens: 0,
27
+ calls: 0,
28
+ measured: false,
29
+ });
30
+
31
+ function _rowTimestampMs(row) {
32
+ const iso = row && (row.timestamp || row.createdAtIso);
33
+ if (iso) {
34
+ const ms = Date.parse(iso);
35
+ if (Number.isFinite(ms)) return ms;
36
+ }
37
+ // createdAt is unix seconds in the Prism trace shape.
38
+ if (row && Number.isFinite(Number(row.createdAt))) return Number(row.createdAt) * 1000;
39
+ return null;
40
+ }
41
+
42
+ /**
43
+ * Sum the real token usage the proxy recorded within a run's time window.
44
+ *
45
+ * @param {object} opts
46
+ * @param {string} opts.sinceIso - REQUIRED lower bound (e.g. last_run.created_at).
47
+ * Without a window we cannot attribute traces to this run, so we report
48
+ * unmeasured rather than summing unrelated calls.
49
+ * @param {string} [opts.untilIso] - upper bound; defaults to now.
50
+ * @returns {{input_tokens:number,output_tokens:number,total_tokens:number,calls:number,measured:boolean}}
51
+ */
52
+ function sumRunUsage(opts = {}) {
53
+ const sinceMs = opts && opts.sinceIso != null ? Date.parse(opts.sinceIso) : NaN;
54
+ if (!Number.isFinite(sinceMs)) return { ...EMPTY };
55
+ const untilMs = opts && opts.untilIso != null && Number.isFinite(Date.parse(opts.untilIso))
56
+ ? Date.parse(opts.untilIso)
57
+ : Date.now();
58
+
59
+ let raw;
60
+ try {
61
+ const file = resolveTraceFile();
62
+ if (!fs.existsSync(file)) return { ...EMPTY };
63
+ raw = fs.readFileSync(file, 'utf8');
64
+ } catch (_) {
65
+ return { ...EMPTY };
66
+ }
67
+
68
+ let secret = null;
69
+ try { secret = resolveEvomapNodeSecret(); } catch (_) { secret = null; }
70
+
71
+ let input = 0;
72
+ let output = 0;
73
+ let calls = 0;
74
+ for (const line of raw.split('\n')) {
75
+ const s = line.trim();
76
+ if (!s) continue;
77
+ let row;
78
+ try { row = JSON.parse(s); } catch (_) { continue; }
79
+ if (row && row.encrypted) {
80
+ if (!secret) continue; // cannot decrypt -> treat as unobserved
81
+ try { row = decryptTraceEnvelope(row, secret); } catch (_) { continue; }
82
+ }
83
+ if (!row || typeof row !== 'object') continue;
84
+ const ms = _rowTimestampMs(row);
85
+ if (ms == null || ms < sinceMs || ms > untilMs) continue;
86
+ const i = Number(row.input_tokens);
87
+ const o = Number(row.output_tokens);
88
+ const hasI = Number.isFinite(i) && i > 0;
89
+ const hasO = Number.isFinite(o) && o > 0;
90
+ if (hasI) input += i;
91
+ if (hasO) output += o;
92
+ if (hasI || hasO) calls += 1;
93
+ }
94
+
95
+ if (calls === 0) return { ...EMPTY };
96
+ return {
97
+ input_tokens: input,
98
+ output_tokens: output,
99
+ total_tokens: input + output,
100
+ calls,
101
+ measured: true,
102
+ };
103
+ }
104
+
105
+ module.exports = { sumRunUsage };
package/CONTRIBUTING.md DELETED
@@ -1,19 +0,0 @@
1
- ## Contributing
2
-
3
- Thank you for contributing. Please follow these rules:
4
-
5
- - Do not use emoji (except the DNA emoji in documentation if needed).
6
- - Keep changes small and reviewable.
7
- - Update related documentation when you change behavior.
8
- - Run `node index.js` for a quick sanity check.
9
-
10
- Submit PRs with clear intent and scope.
11
-
12
- ### Engineering conventions
13
-
14
- - **Spawn child CLIs as `node <entry.js>` — never via a `.cmd` shim, npm symlink, or bare command name.** When launching a harness/tool subprocess (claude-code, openclaw, codex, ...), resolve the JS entry behind the launcher and hand it to `node` directly. Two reasons:
15
- 1. On Windows, `child_process.spawn` without `shell:true` on a `.cmd`/`.bat` throws `EINVAL` since the CVE-2024-27980 fix (Node >=18.20.2 / 20.12.2 / 21.7.3) — this silently broke the auto-exec bridge on Windows.
16
- 2. Across platforms, shims/wrappers can emit warnings or silently exit on some machines. `node <entry>` is zero-shell, deterministic, and passes args via argv (no shell-injection surface).
17
-
18
- `runChild` in `src/gep/execBridge.js` implements this for Windows npm shims (`_resolveNpmCmdShim`: parse the shim's `"%dp0%\<entry>" %*` exec line and rewrite `(bin, args)` -> `(process.execPath, [<entry>, ...args])`), falling back to the original target when it is not a recognized npm shim. POSIX binaries / wrappers spawn natively and are left unchanged. A unit test (`test/execBridgeSpawnNpmShim.test.js`) enforces the parser.
19
-
package/assets/cover.png DELETED
Binary file
@@ -1,245 +0,0 @@
1
- {
2
- "version": 2,
3
- "genes": [
4
- {
5
- "type": "Gene",
6
- "id": "gene_gep_repair_from_errors",
7
- "category": "repair",
8
- "signals_match": [
9
- "error|错误|异常|エラー|오류",
10
- "exception|异常|例外|예외",
11
- "failed|失败|失敗|실패|fail",
12
- "unstable|不稳定|不安定|불안정",
13
- "log_error",
14
- "test_failure"
15
- ],
16
- "preconditions": [
17
- "signals contains error-related indicators"
18
- ],
19
- "strategy": [
20
- "Extract structured signals from logs and user instructions",
21
- "Select an existing Gene by signals match (no improvisation)",
22
- "Estimate blast radius (files, lines) before editing",
23
- "Apply smallest reversible patch",
24
- "Validate using declared validation steps; rollback on failure",
25
- "Solidify knowledge: append EvolutionEvent, update Gene/Capsule store"
26
- ],
27
- "constraints": {
28
- "max_files": 20,
29
- "forbidden_paths": [
30
- ".git",
31
- "node_modules"
32
- ]
33
- },
34
- "validation": [
35
- "node scripts/validate-modules.js ./src/evolve ./src/gep/solidify ./src/gep/policyCheck ./src/gep/selector ./src/gep/memoryGraph ./src/gep/assetStore",
36
- "node scripts/validate-suite.js"
37
- ]
38
- },
39
- {
40
- "type": "Gene",
41
- "id": "gene_gep_optimize_prompt_and_assets",
42
- "category": "optimize",
43
- "signals_match": [
44
- "protocol|协议|プロトコル|프로토콜",
45
- "gep",
46
- "prompt|提示词|提示|プロンプト|프롬프트",
47
- "audit|审计|監査|감사",
48
- "reusable|可复用|再利用|재사용"
49
- ],
50
- "preconditions": [
51
- "need stricter, auditable evolution protocol outputs"
52
- ],
53
- "strategy": [
54
- "Extract signals and determine selection rationale via Selector JSON",
55
- "Prefer reusing existing Gene/Capsule; only create if no match exists",
56
- "Refactor prompt assembly to embed assets (genes, capsules, parent event)",
57
- "Reduce noise and ambiguity; enforce strict output schema",
58
- "Validate by running node index.js run and ensuring no runtime errors",
59
- "Solidify: record EvolutionEvent, update Gene definitions, create Capsule on success"
60
- ],
61
- "constraints": {
62
- "max_files": 20,
63
- "forbidden_paths": [
64
- ".git",
65
- "node_modules"
66
- ]
67
- },
68
- "validation": [
69
- "node scripts/validate-modules.js ./src/evolve ./src/gep/prompt ./src/gep/contentHash ./src/gep/skillDistiller",
70
- "node scripts/validate-suite.js"
71
- ]
72
- },
73
- {
74
- "type": "Gene",
75
- "id": "gene_gep_innovate_from_opportunity",
76
- "category": "innovate",
77
- "signals_match": [
78
- "user_feature_request|功能请求|機能リクエスト|기능요청",
79
- "user_improvement_suggestion|改进建议|改善提案|개선제안",
80
- "perf_bottleneck|性能瓶颈|パフォーマンス|성능병목",
81
- "capability_gap|能力缺口|機能ギャップ|역량공백",
82
- "stable_success_plateau",
83
- "external_opportunity|外部机会|外部機会|외부기회",
84
- "bounty_task"
85
- ],
86
- "preconditions": [
87
- "at least one opportunity signal is present",
88
- "no active log_error signals (stability first)"
89
- ],
90
- "strategy": [
91
- "Extract opportunity signals and identify the specific user need or system gap",
92
- "Search existing Genes and Capsules for partial matches (avoid reinventing)",
93
- "Design a minimal, testable implementation plan (prefer small increments)",
94
- "Estimate blast radius; innovate changes may touch more files but must stay within constraints",
95
- "Implement the change with clear validation criteria",
96
- "Validate using declared validation steps; rollback on failure",
97
- "Solidify: record EvolutionEvent with intent=innovate, create new Gene if pattern is novel, create Capsule on success"
98
- ],
99
- "constraints": {
100
- "max_files": 25,
101
- "forbidden_paths": [
102
- ".git",
103
- "node_modules"
104
- ]
105
- },
106
- "validation": [
107
- "node scripts/validate-modules.js ./src/evolve ./src/gep/solidify ./src/gep/policyCheck ./src/gep/mutation ./src/gep/personality",
108
- "node scripts/validate-suite.js"
109
- ]
110
- },
111
- {
112
- "type": "Gene",
113
- "id": "gene_gep_optimize_tool_usage",
114
- "summary": "Optimize tool execution patterns by reducing redundant exec calls, improving tool selection strategy, and enforcing tool-use constraints to prevent bypass.",
115
- "category": "optimize",
116
- "signals_match": [
117
- "high_tool_usage:exec",
118
- "repeated_tool_usage:exec",
119
- "tool_bypass|工具绕过|ツール迂回|도구우회",
120
- "tool_loop|工具循环|ツールループ|도구반복",
121
- "high_tool_usage"
122
- ],
123
- "preconditions": [
124
- "agent repeatedly invokes the same tool (especially exec) without progress",
125
- "tool execution bypass patterns detected",
126
- "no active error signals (errors would take repair priority)"
127
- ],
128
- "strategy": [
129
- "Analyze tool usage patterns to identify the root cause of repetition (wrong tool, missing context, or lack of guardrails)",
130
- "Introduce strategy-level guardrails: prefer single-shot commands, batch related operations, add explicit retry limits",
131
- "If tool_bypass detected, strengthen constraint enforcement in prompt assembly or tool routing",
132
- "Estimate blast radius; changes should target tool routing, prompt constraints, or signal deduplication logic",
133
- "Validate by confirming no regressions in existing tool tests and signal extraction accuracy",
134
- "Solidify: record EvolutionEvent with intent=optimize, update Capsule on success"
135
- ],
136
- "constraints": {
137
- "max_files": 15,
138
- "forbidden_paths": [
139
- ".git",
140
- "node_modules"
141
- ]
142
- },
143
- "validation": [
144
- "node scripts/validate-modules.js ./src/gep/signals ./src/evolve",
145
- "node scripts/validate-suite.js"
146
- ],
147
- "routing_hint": {
148
- "tier": "mid",
149
- "reasoning_level": "medium"
150
- }
151
- },
152
- {
153
- "type": "Gene",
154
- "id": "gene_distilled_s2g-env-vars",
155
- "summary": "Vercel environment variable expert guidance. Use when working with .env files, vercel env commands, OIDC tokens, or managing environment-specific configuration.",
156
- "category": "optimize",
157
- "signals_match": [
158
- "use_when_working_with",
159
- "env_files",
160
- "vercel_env_commands",
161
- "oidc_tokens",
162
- "vercel_env_pull",
163
- "env_local_overwrite",
164
- "oidc_token_expiry",
165
- "dotenv_cli"
166
- ],
167
- "preconditions": [
168
- "Skill env-vars has just been executed locally"
169
- ],
170
- "strategy": [
171
- "Identify the dominant trigger signals from the Skill description.",
172
- "Apply the smallest targeted change that satisfies the Skill workflow.",
173
- "Run the Skill validation commands and abort if any fails."
174
- ],
175
- "constraints": {
176
- "max_files": 12,
177
- "forbidden_paths": [
178
- ".git",
179
- "node_modules"
180
- ]
181
- },
182
- "validation": [
183
- "node --version"
184
- ],
185
- "routing_hint": {
186
- "tier": "cheap",
187
- "reasoning_level": "low"
188
- },
189
- "schema_version": "1.6.0",
190
- "_source": {
191
- "kind": "skill2gep",
192
- "skill_name": "env-vars",
193
- "skill_platform": "vercel",
194
- "skill_hash": "ba0bdb4db2",
195
- "rationale_paper": "Wang, Ren, Zhang. From Procedural Skills to Strategy Genes. arXiv:2604.15097",
196
- "paper_scope": "code-science (arXiv:2604.15097, 45 tasks, Gemini 3.1 Pro/Flash Lite)",
197
- "claims_outside_scope": "assumption",
198
- "quality_heuristics": {
199
- "strategy_steps": 0,
200
- "avoid_count": 0,
201
- "validation_declared_count": 0,
202
- "validation_runnable_count": 0,
203
- "validation_fallback_used": true,
204
- "signals_extracted": 4,
205
- "preconditions_extracted": 0
206
- }
207
- },
208
- "asset_id": "sha256:1501bc37fbefb18630c4dc8a95d8cdc1ed32bec4a465dc3223280ae907e07297"
209
- },
210
- {
211
- "type": "Gene",
212
- "id": "gene_tool_integrity",
213
- "category": "repair",
214
- "signals_match": [
215
- "tool_bypass|工具绕过|ツール迂回|도구우회"
216
- ],
217
- "preconditions": [
218
- "agent used shell/exec to perform an action that a registered tool can handle"
219
- ],
220
- "strategy": [
221
- "Always prefer registered tools over ad-hoc scripts or shell workarounds",
222
- "If a registered tool fails, report the actual error honestly and attempt to fix the root cause",
223
- "Never fabricate explanations -- describe actual actions transparently",
224
- "Do not create temporary scripts in extension or project directories"
225
- ],
226
- "constraints": {
227
- "max_files": 4,
228
- "forbidden_paths": [
229
- ".git",
230
- "node_modules"
231
- ]
232
- },
233
- "validation": [
234
- "node scripts/validate-suite.js"
235
- ],
236
- "anti_patterns": [
237
- "tool_bypass"
238
- ],
239
- "routing_hint": {
240
- "tier": "cheap",
241
- "reasoning_level": "low"
242
- }
243
- }
244
- ]
245
- }
@@ -1,63 +0,0 @@
1
- const { loadGenes, loadCapsules, readAllEvents } = require('../src/gep/assetStore');
2
- const { exportEligibleCapsules, exportEligibleGenes, isAllowedA2AAsset } = require('../src/gep/a2a');
3
- const { buildPublish, buildHello, getTransport } = require('../src/gep/a2aProtocol');
4
- const { computeAssetId, SCHEMA_VERSION } = require('../src/gep/contentHash');
5
-
6
- function main() {
7
- var args = process.argv.slice(2);
8
- var asJson = args.includes('--json');
9
- var asProtocol = args.includes('--protocol');
10
- var withHello = args.includes('--hello');
11
- var persist = args.includes('--persist');
12
- var includeEvents = args.includes('--include-events');
13
-
14
- var capsules = loadCapsules();
15
- var genes = loadGenes();
16
- var events = readAllEvents();
17
-
18
- // Build eligible list: Capsules (filtered) + Genes (filtered) + Events (opt-in)
19
- var eligibleCapsules = exportEligibleCapsules({ capsules: capsules, events: events });
20
- var eligibleGenes = exportEligibleGenes({ genes: genes });
21
- var eligible = eligibleCapsules.concat(eligibleGenes);
22
-
23
- if (includeEvents) {
24
- var eligibleEvents = (Array.isArray(events) ? events : []).filter(function (e) {
25
- return isAllowedA2AAsset(e) && e.type === 'EvolutionEvent';
26
- });
27
- for (var ei = 0; ei < eligibleEvents.length; ei++) {
28
- var ev = eligibleEvents[ei];
29
- if (!ev.schema_version) ev.schema_version = SCHEMA_VERSION;
30
- if (!ev.asset_id) { try { ev.asset_id = computeAssetId(ev); } catch (e) {} }
31
- }
32
- eligible = eligible.concat(eligibleEvents);
33
- }
34
-
35
- if (withHello || asProtocol) {
36
- var hello = buildHello({ geneCount: genes.length, capsuleCount: capsules.length });
37
- process.stdout.write(JSON.stringify(hello) + '\n');
38
- if (persist) { try { getTransport().send(hello); } catch (e) {} }
39
- }
40
-
41
- if (asProtocol) {
42
- for (var i = 0; i < eligible.length; i++) {
43
- var msg = buildPublish({ asset: eligible[i] });
44
- process.stdout.write(JSON.stringify(msg) + '\n');
45
- if (persist) { try { getTransport().send(msg); } catch (e) {} }
46
- }
47
- return;
48
- }
49
-
50
- if (asJson) {
51
- process.stdout.write(JSON.stringify(eligible, null, 2) + '\n');
52
- return;
53
- }
54
-
55
- for (var j = 0; j < eligible.length; j++) {
56
- process.stdout.write(JSON.stringify(eligible[j]) + '\n');
57
- }
58
- }
59
-
60
- try { main(); } catch (e) {
61
- process.stderr.write((e && e.message ? e.message : String(e)) + '\n');
62
- process.exit(1);
63
- }
@@ -1,79 +0,0 @@
1
- var fs = require('fs');
2
- var assetStore = require('../src/gep/assetStore');
3
- var a2a = require('../src/gep/a2a');
4
- var memGraph = require('../src/gep/memoryGraphAdapter');
5
- var contentHash = require('../src/gep/contentHash');
6
- var a2aProto = require('../src/gep/a2aProtocol');
7
-
8
- function readStdin() {
9
- try { return fs.readFileSync(0, 'utf8'); } catch (e) { return ''; }
10
- }
11
-
12
- function parseSignalsFromEnv() {
13
- var raw = process.env.A2A_SIGNALS || '';
14
- if (!raw) return [];
15
- try {
16
- var maybe = JSON.parse(raw);
17
- if (Array.isArray(maybe)) return maybe.map(String).filter(Boolean);
18
- } catch (e) {}
19
- return String(raw).split(',').map(function (s) { return s.trim(); }).filter(Boolean);
20
- }
21
-
22
- function main() {
23
- var args = process.argv.slice(2);
24
- var inputPath = '';
25
- for (var i = 0; i < args.length; i++) {
26
- if (args[i] && !args[i].startsWith('--')) { inputPath = args[i]; break; }
27
- }
28
- var source = process.env.A2A_SOURCE || 'external';
29
- var factor = Number.isFinite(Number(process.env.A2A_EXTERNAL_CONFIDENCE_FACTOR))
30
- ? Number(process.env.A2A_EXTERNAL_CONFIDENCE_FACTOR) : 0.6;
31
-
32
- var text = inputPath ? a2a.readTextIfExists(inputPath) : readStdin();
33
- var parsed = a2a.parseA2AInput(text);
34
- var signals = parseSignalsFromEnv();
35
-
36
- var accepted = 0;
37
- var rejected = 0;
38
- var emitDecisions = process.env.A2A_EMIT_DECISIONS === 'true';
39
-
40
- for (var j = 0; j < parsed.length; j++) {
41
- var obj = parsed[j];
42
- if (!a2a.isAllowedA2AAsset(obj)) continue;
43
-
44
- if (obj.asset_id && typeof obj.asset_id === 'string') {
45
- if (!contentHash.verifyAssetId(obj)) {
46
- rejected += 1;
47
- if (emitDecisions) {
48
- try {
49
- var dm = a2aProto.buildDecision({ assetId: obj.asset_id, localId: obj.id, decision: 'reject', reason: 'asset_id integrity check failed' });
50
- a2aProto.getTransport().send(dm);
51
- } catch (e) {}
52
- }
53
- continue;
54
- }
55
- }
56
-
57
- var staged = a2a.lowerConfidence(obj, { source: source, factor: factor });
58
- if (!staged) continue;
59
-
60
- assetStore.appendExternalCandidateJsonl(staged);
61
- try { memGraph.recordExternalCandidate({ asset: staged, source: source, signals: signals }); } catch (e) {}
62
-
63
- if (emitDecisions) {
64
- try {
65
- var dm2 = a2aProto.buildDecision({ assetId: staged.asset_id, localId: staged.id, decision: 'quarantine', reason: 'staged as external candidate' });
66
- a2aProto.getTransport().send(dm2);
67
- } catch (e) {}
68
- }
69
-
70
- accepted += 1;
71
- }
72
-
73
- process.stdout.write('accepted=' + accepted + ' rejected=' + rejected + '\n');
74
- }
75
-
76
- try { main(); } catch (e) {
77
- process.stderr.write((e && e.message ? e.message : String(e)) + '\n');
78
- process.exit(1);
79
- }