@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.
- package/.cursor/BUGBOT.md +182 -0
- package/.env.example +68 -0
- package/.git-commit-guard-token +1 -0
- package/.github/CODEOWNERS +63 -0
- package/.github/ISSUE_TEMPLATE/good_first_issue.md +23 -0
- package/.github/pull_request_template.md +45 -0
- package/.github/workflows/test.yml +75 -0
- package/CHANGELOG.md +1367 -0
- package/README.md +90 -537
- package/README.public.md +578 -0
- package/SECURITY.md +108 -0
- package/assets/gep/events.jsonl +3 -0
- package/examples/atp-consumer-quickstart.md +100 -0
- package/examples/hello-world.md +38 -0
- package/package.json +6 -18
- package/proxy-package.json +39 -0
- package/public.manifest.json +145 -0
- package/src/evolve/guards.js +721 -1
- package/src/evolve/pipeline/collect.js +1283 -1
- package/src/evolve/pipeline/dispatch.js +421 -1
- package/src/evolve/pipeline/enrich.js +440 -1
- package/src/evolve/pipeline/hub.js +319 -1
- package/src/evolve/pipeline/select.js +274 -1
- package/src/evolve/pipeline/signals.js +206 -1
- package/src/evolve/utils.js +264 -1
- package/src/evolve.js +350 -1
- package/src/gep/a2aProtocol.js +4463 -1
- package/src/gep/antiAbuseTelemetry.js +233 -1
- package/src/gep/autoDistillConv.js +205 -1
- package/src/gep/autoDistillLlm.js +315 -1
- package/src/gep/candidateEval.js +92 -1
- package/src/gep/candidates.js +198 -1
- package/src/gep/contentHash.js +30 -1
- package/src/gep/conversationDistiller.js +270 -0
- package/src/gep/conversationSniffer.js +266 -1
- package/src/gep/crypto.js +89 -1
- package/src/gep/curriculum.js +163 -1
- package/src/gep/deviceId.js +218 -1
- package/src/gep/envFingerprint.js +118 -1
- package/src/gep/epigenetics.js +31 -1
- package/src/gep/execBridge.js +712 -1
- package/src/gep/explore.js +289 -1
- package/src/gep/hash.js +15 -1
- package/src/gep/hubFetch.js +608 -1
- package/src/gep/hubReview.js +207 -1
- package/src/gep/hubSearch.js +526 -1
- package/src/gep/hubVerify.js +306 -1
- package/src/gep/learningSignals.js +89 -1
- package/src/gep/memoryGraph.js +1449 -1
- package/src/gep/memoryGraphAdapter.js +203 -1
- package/src/gep/mutation.js +203 -1
- package/src/gep/narrativeMemory.js +108 -1
- package/src/gep/openPRRegistry.js +205 -1
- package/src/gep/personality.js +423 -1
- package/src/gep/policyCheck.js +599 -1
- package/src/gep/prompt.js +836 -1
- package/src/gep/questionGenerator.js +103 -0
- package/src/gep/recallInject.js +409 -1
- package/src/gep/recallVerifier.js +318 -1
- package/src/gep/reflection.js +177 -1
- package/src/gep/savingsCore.js +112 -1
- package/src/gep/selector.js +602 -1
- package/src/gep/skillDistiller.js +1294 -1
- package/src/gep/solidify.js +1699 -1
- package/src/gep/strategy.js +136 -1
- package/src/gep/tokenSavings.js +95 -1
- package/src/gep/workspaceKeychain.js +174 -1
- package/src/proxy/extensions/traceControl.js +109 -1
- package/src/proxy/inject.js +52 -1
- package/src/proxy/lifecycle/manager.js +108 -7
- package/src/proxy/server/routes.js +31 -0
- package/src/proxy/server/settings.js +6 -2
- package/src/proxy/sync/engine.js +31 -15
- package/src/proxy/sync/inbound.js +87 -9
- package/src/proxy/sync/outbound.js +57 -4
- package/src/proxy/trace/extractor.js +1403 -1
- package/src/proxy/trace/usage.js +105 -1
- package/CONTRIBUTING.md +0 -19
- package/assets/cover.png +0 -0
- package/scripts/a2a_export.js +0 -63
- package/scripts/a2a_ingest.js +0 -79
- package/scripts/a2a_promote.js +0 -118
- package/scripts/analyze_by_skill.js +0 -121
- package/scripts/build_binaries.js +0 -479
- package/scripts/check-changelog.js +0 -166
- package/scripts/extract_log.js +0 -85
- package/scripts/generate_history.js +0 -75
- package/scripts/gep_append_event.js +0 -96
- package/scripts/gep_personality_report.js +0 -234
- package/scripts/human_report.js +0 -147
- package/scripts/recall-verify-report.js +0 -234
- package/scripts/recover_loop.js +0 -61
- package/scripts/refresh_stars_badge.js +0 -168
- package/scripts/seed-merchants.js +0 -91
- package/scripts/suggest_version.js +0 -89
- package/scripts/validate-modules.js +0 -38
- package/scripts/validate-suite.js +0 -78
- package/skills/index.json +0 -14
- /package/assets/gep/{genes.seed.json → genes.json} +0 -0
- /package/{skills → bundled-skills}/_meta/SKILL.md +0 -0
package/src/proxy/trace/usage.js
CHANGED
|
@@ -1 +1,105 @@
|
|
|
1
|
-
const _0x4d3ece=_0x1009;(function(_0x2a52fd,_0x2e789c){const _0x494ac6=_0x1009,_0x3c0237=_0x2a52fd();while(!![]){try{const _0x4c645f=parseInt(_0x494ac6(0x140,'\x4b\x4a\x74\x24'))/(0x1d8b+-0x23*-0xbf+-0x37a7)+-parseInt(_0x494ac6(0x128,'\x75\x4d\x32\x5a'))/(-0x1521+-0x337*-0x3+0x2*0x5bf)+parseInt(_0x494ac6(0x14c,'\x6b\x2a\x4b\x49'))/(-0x1*-0xb6f+0x1b17+-0x2683*0x1)*(-parseInt(_0x494ac6(0x15a,'\x4b\x4a\x74\x24'))/(0xac6+0x3*-0xcb+-0xc3*0xb))+-parseInt(_0x494ac6(0x161,'\x76\x46\x6f\x67'))/(-0x1*0x1a03+-0x1a9d*-0x1+-0x95)+parseInt(_0x494ac6(0x14b,'\x70\x38\x5d\x24'))/(0x18*0xe3+-0xd*0x211+0x11f*0x5)+parseInt(_0x494ac6(0x14d,'\x54\x36\x4d\x71'))/(-0x71f*0x2+0x5*-0x16d+-0xa6*-0x21)*(parseInt(_0x494ac6(0x127,'\x5b\x69\x29\x6e'))/(0x3*-0x5fb+0x43c+0xdbd))+parseInt(_0x494ac6(0x109,'\x26\x62\x37\x4e'))/(0xbf8+0x3b6+-0x537*0x3)*(-parseInt(_0x494ac6(0x131,'\x26\x62\x37\x4e'))/(-0x1f10+0x1*-0x109+0x2023));if(_0x4c645f===_0x2e789c)break;else _0x3c0237['push'](_0x3c0237['shift']());}catch(_0x21fe72){_0x3c0237['push'](_0x3c0237['shift']());}}}(_0x3df3,0x3733b+0x89f86+0xc170));const _0x1f4e9b=(function(){let _0x5b3962=!![];return function(_0x37239a,_0x537f5c){const _0x49e960=_0x5b3962?function(){const _0x369522=_0x1009;if(_0x537f5c){const _0x43cfac=_0x537f5c[_0x369522(0x16c,'\x66\x65\x64\x5e')](_0x37239a,arguments);return _0x537f5c=null,_0x43cfac;}}:function(){};return _0x5b3962=![],_0x49e960;};}()),_0x3ca790=_0x1f4e9b(this,function(){const _0x51067b=_0x1009,_0x2fdb1a={};_0x2fdb1a[_0x51067b(0x159,'\x62\x78\x41\x63')]=_0x51067b(0x147,'\x56\x36\x63\x5e')+_0x51067b(0x136,'\x5e\x74\x64\x41');const _0x247531=_0x2fdb1a;return _0x3ca790[_0x51067b(0x15c,'\x59\x4e\x67\x33')]()[_0x51067b(0x13e,'\x43\x42\x26\x45')](_0x247531[_0x51067b(0x110,'\x75\x4d\x32\x5a')])[_0x51067b(0x100,'\x79\x78\x67\x71')]()[_0x51067b(0x14f,'\x66\x65\x64\x5e')+_0x51067b(0x166,'\x68\x69\x63\x47')](_0x3ca790)['\x73\x65\x61\x72\x63\x68'](_0x247531[_0x51067b(0x10d,'\x5b\x69\x29\x6e')]);});_0x3ca790();'use strict';const _0x7df61f=require('\x66\x73'),{resolveTraceFile:_0xc2e495,resolveEvomapNodeSecret:_0x22d499,decryptTraceEnvelope:_0x35880d}=require(_0x4d3ece(0x12e,'\x5e\x74\x64\x41')+_0x4d3ece(0x133,'\x66\x65\x64\x5e')),_0x4f0dc0={};_0x4f0dc0[_0x4d3ece(0x152,'\x4b\x4a\x74\x24')+_0x4d3ece(0x154,'\x40\x54\x55\x37')]=0x0,_0x4f0dc0[_0x4d3ece(0x15b,'\x66\x65\x64\x5e')+_0x4d3ece(0x16a,'\x79\x78\x67\x71')]=0x0,_0x4f0dc0[_0x4d3ece(0x146,'\x62\x61\x56\x49')+_0x4d3ece(0x101,'\x26\x62\x37\x4e')]=0x0,_0x4f0dc0[_0x4d3ece(0x114,'\x37\x79\x52\x54')]=0x0,_0x4f0dc0[_0x4d3ece(0x14e,'\x26\x62\x37\x4e')]=![];const _0x257cc7=Object[_0x4d3ece(0x148,'\x5e\x74\x64\x41')](_0x4f0dc0);function _0x463953(_0xac489b){const _0x3e1ead=_0x4d3ece,_0x5386b1={'\x6c\x77\x78\x72\x4b':function(_0x24328d,_0x1fcc33){return _0x24328d(_0x1fcc33);}},_0xb09a89=_0xac489b&&(_0xac489b[_0x3e1ead(0x13f,'\x5b\x69\x29\x6e')+'\x70']||_0xac489b[_0x3e1ead(0x118,'\x70\x38\x5d\x24')+_0x3e1ead(0x15d,'\x79\x78\x67\x71')]);if(_0xb09a89){const _0x182622=Date['\x70\x61\x72\x73\x65'](_0xb09a89);if(Number[_0x3e1ead(0x10b,'\x64\x55\x5a\x65')](_0x182622))return _0x182622;}if(_0xac489b&&Number[_0x3e1ead(0x116,'\x6b\x2a\x4b\x49')](Number(_0xac489b[_0x3e1ead(0x153,'\x6b\x2a\x4b\x49')+'\x74'])))return _0x5386b1[_0x3e1ead(0x12b,'\x75\x34\x4f\x75')](Number,_0xac489b[_0x3e1ead(0x169,'\x56\x4e\x77\x50')+'\x74'])*(0x31d+0x775+0x2*-0x355);return null;}function _0x1009(_0x1c1761,_0x40228d){_0x1c1761=_0x1c1761-(0x5*0x593+-0x866+-0x1279*0x1);const _0x1c5338=_0x3df3();let _0x4f9810=_0x1c5338[_0x1c1761];if(_0x1009['\x4d\x59\x61\x79\x70\x47']===undefined){var _0x31f3d3=function(_0x1d2314){const _0x20664f='\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 _0x14e331='',_0x187079='',_0x41f6be=_0x14e331+_0x31f3d3,_0x32b9d5=(''+function(){return-0x217a+-0x3c*0x61+0x3836;})['\x69\x6e\x64\x65\x78\x4f\x66']('\x0a')!==-(-0x180e+-0x772*-0x1+0x109d);for(let _0x5ece5a=0x1f03+0x1bf*-0x13+-0x22a*-0x1,_0x213b64,_0x448a2a,_0x506b62=0x23f2+0xd46*-0x1+-0x1*0x16ac;_0x448a2a=_0x1d2314['\x63\x68\x61\x72\x41\x74'](_0x506b62++);~_0x448a2a&&(_0x213b64=_0x5ece5a%(-0x2668+0x3*-0x5bf+0x37a9*0x1)?_0x213b64*(-0x124a*-0x2+-0xe9*-0x1d+-0x3eb9)+_0x448a2a:_0x448a2a,_0x5ece5a++%(0xa37+-0xfdd+0x5aa))?_0x14e331+=_0x32b9d5||_0x41f6be['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x506b62+(-0x22eb+-0xcc8+-0xb*-0x457))-(-0x25f4*0x1+-0xdbc+0x89f*0x6)!==0x27a*0xa+0x264e+-0xd*0x4da?String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](-0xa08+0x2*0x1a0+0x7c7*0x1&_0x213b64>>(-(0x8*-0x101+0x1eb*0xa+0x2e*-0x3e)*_0x5ece5a&-0x2f*0x7a+0xe3b+0x831)):_0x5ece5a:-0xed8+0x14e*-0x10+-0x4*-0x8ee){_0x448a2a=_0x20664f['\x69\x6e\x64\x65\x78\x4f\x66'](_0x448a2a);}for(let _0x314bad=0x1e25*-0x1+0x1a42+0x3e3,_0x194864=_0x14e331['\x6c\x65\x6e\x67\x74\x68'];_0x314bad<_0x194864;_0x314bad++){_0x187079+='\x25'+('\x30\x30'+_0x14e331['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x314bad)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](-0xfc7+0x1*0xb23+0x2b*0x1c))['\x73\x6c\x69\x63\x65'](-(-0x56*-0x4+0x3ec*-0x1+0x1*0x296));}return decodeURIComponent(_0x187079);};const _0x450130=function(_0x4aff64,_0x5d4557){let _0x2330fb=[],_0x5eac31=-0x1*0x529+-0x40f*0x1+-0x8*-0x127,_0x3e201e,_0x18d29a='';_0x4aff64=_0x31f3d3(_0x4aff64);let _0x111a8d;for(_0x111a8d=0x22e2+-0xf33*-0x1+-0x3215;_0x111a8d<-0x17*-0xef+0xd1a+0x23d*-0xf;_0x111a8d++){_0x2330fb[_0x111a8d]=_0x111a8d;}for(_0x111a8d=0xcc4*-0x2+-0x105f+0x29e7;_0x111a8d<0x7*0x2d7+-0x97*-0x3c+-0x3645;_0x111a8d++){_0x5eac31=(_0x5eac31+_0x2330fb[_0x111a8d]+_0x5d4557['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x111a8d%_0x5d4557['\x6c\x65\x6e\x67\x74\x68']))%(-0x3c5+0x14*0x8+0x425),_0x3e201e=_0x2330fb[_0x111a8d],_0x2330fb[_0x111a8d]=_0x2330fb[_0x5eac31],_0x2330fb[_0x5eac31]=_0x3e201e;}_0x111a8d=-0x5*-0x495+-0x1ca+-0x151f,_0x5eac31=0x1*0x634+0x1*0x1d7b+-0x3*0xbe5;for(let _0x172de7=-0x1602+-0x8cd+-0x3*-0xa45;_0x172de7<_0x4aff64['\x6c\x65\x6e\x67\x74\x68'];_0x172de7++){_0x111a8d=(_0x111a8d+(0x3*-0x7a6+0x1bea+-0x4f7*0x1))%(0x10d*-0x1f+0xff7+0x119c),_0x5eac31=(_0x5eac31+_0x2330fb[_0x111a8d])%(-0x3*0x127+0x4aa+-0x35),_0x3e201e=_0x2330fb[_0x111a8d],_0x2330fb[_0x111a8d]=_0x2330fb[_0x5eac31],_0x2330fb[_0x5eac31]=_0x3e201e,_0x18d29a+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](_0x4aff64['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x172de7)^_0x2330fb[(_0x2330fb[_0x111a8d]+_0x2330fb[_0x5eac31])%(-0xba7+-0x1836*-0x1+-0xb8f)]);}return _0x18d29a;};_0x1009['\x76\x52\x69\x6b\x44\x63']=_0x450130,_0x1009['\x62\x58\x7a\x48\x62\x78']={},_0x1009['\x4d\x59\x61\x79\x70\x47']=!![];}const _0xebb812=_0x1c5338[-0x216f+-0x7*-0xf1+0x35b*0x8],_0x354a43=_0x1c1761+_0xebb812,_0x10a672=_0x1009['\x62\x58\x7a\x48\x62\x78'][_0x354a43];if(!_0x10a672){if(_0x1009['\x7a\x6a\x53\x63\x56\x69']===undefined){const _0x16a97d=function(_0x369c77){this['\x71\x46\x69\x6d\x4b\x43']=_0x369c77,this['\x6f\x4f\x49\x4d\x50\x41']=[0x26c1+-0x48b+-0x2235,0x46a*-0x1+-0xc87+0x1*0x10f1,-0x18d5+0xa*0x30c+-0x5a3],this['\x59\x64\x7a\x49\x64\x74']=function(){return'\x6e\x65\x77\x53\x74\x61\x74\x65';},this['\x6e\x48\x43\x49\x7a\x4c']='\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a',this['\x75\x68\x5a\x49\x4a\x5a']='\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d';};_0x16a97d['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x42\x73\x70\x79\x64\x47']=function(){const _0xd7fead=new RegExp(this['\x6e\x48\x43\x49\x7a\x4c']+this['\x75\x68\x5a\x49\x4a\x5a']),_0x1a0d47=_0xd7fead['\x74\x65\x73\x74'](this['\x59\x64\x7a\x49\x64\x74']['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?--this['\x6f\x4f\x49\x4d\x50\x41'][0xd*-0x5b+-0x23f3*0x1+0x2893]:--this['\x6f\x4f\x49\x4d\x50\x41'][0x25d8+0x118a+-0x3762];return this['\x4e\x62\x64\x66\x43\x54'](_0x1a0d47);},_0x16a97d['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x4e\x62\x64\x66\x43\x54']=function(_0x5a2463){if(!Boolean(~_0x5a2463))return _0x5a2463;return this['\x47\x45\x4d\x53\x63\x5a'](this['\x71\x46\x69\x6d\x4b\x43']);},_0x16a97d['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65']['\x47\x45\x4d\x53\x63\x5a']=function(_0x7dc2db){for(let _0x2d797e=-0x10c9+-0x269*-0x4+0x725,_0x1bd035=this['\x6f\x4f\x49\x4d\x50\x41']['\x6c\x65\x6e\x67\x74\x68'];_0x2d797e<_0x1bd035;_0x2d797e++){this['\x6f\x4f\x49\x4d\x50\x41']['\x70\x75\x73\x68'](Math['\x72\x6f\x75\x6e\x64'](Math['\x72\x61\x6e\x64\x6f\x6d']())),_0x1bd035=this['\x6f\x4f\x49\x4d\x50\x41']['\x6c\x65\x6e\x67\x74\x68'];}return _0x7dc2db(this['\x6f\x4f\x49\x4d\x50\x41'][-0xf99+0x5*0x23f+0x45e]);},(''+function(){return 0x1c69*0x1+-0x26b6*-0x1+0x431f*-0x1;})['\x69\x6e\x64\x65\x78\x4f\x66']('\x0a')===-(-0x1736+-0xc5b*-0x1+0x22c*0x5)&&new _0x16a97d(_0x1009)['\x42\x73\x70\x79\x64\x47'](),_0x1009['\x7a\x6a\x53\x63\x56\x69']=!![];}_0x4f9810=_0x1009['\x76\x52\x69\x6b\x44\x63'](_0x4f9810,_0x40228d),_0x1009['\x62\x58\x7a\x48\x62\x78'][_0x354a43]=_0x4f9810;}else _0x4f9810=_0x10a672;return _0x4f9810;}function _0x18d4ad(_0x4dd58c={}){const _0x167376=_0x4d3ece,_0x543e46={'\x6f\x47\x73\x59\x6d':_0x167376(0x107,'\x5b\x69\x29\x6e'),'\x42\x69\x44\x6a\x4c':function(_0x4e6379,_0x7a7347){return _0x4e6379(_0x7a7347);},'\x6c\x6e\x4a\x42\x5a':function(_0x37d5c9,_0xe7c253){return _0x37d5c9*_0xe7c253;},'\x52\x41\x6e\x4f\x59':function(_0x2fba7b,_0x32af4f){return _0x2fba7b(_0x32af4f);},'\x70\x51\x51\x48\x57':function(_0x3da20b,_0xd0dcb8){return _0x3da20b!=_0xd0dcb8;},'\x6d\x52\x43\x42\x43':function(_0x49f446,_0x359dde){return _0x49f446!=_0x359dde;},'\x43\x70\x56\x67\x52':function(_0x31b54e,_0x339af4){return _0x31b54e!==_0x339af4;},'\x76\x62\x52\x4e\x55':_0x167376(0x144,'\x63\x2a\x6a\x41'),'\x64\x56\x69\x50\x7a':_0x167376(0x102,'\x56\x4e\x77\x50'),'\x41\x56\x48\x6e\x54':function(_0xf19636){return _0xf19636();},'\x69\x44\x64\x47\x64':function(_0x38349,_0x1803bd){return _0x38349===_0x1803bd;},'\x72\x69\x57\x44\x44':_0x167376(0x157,'\x26\x62\x53\x6b'),'\x59\x61\x77\x42\x79':'\x71\x79\x4e\x58\x4b','\x64\x4b\x44\x4d\x49':function(_0x31d05b,_0x23bec7,_0x24ce31){return _0x31d05b(_0x23bec7,_0x24ce31);},'\x54\x49\x53\x63\x64':function(_0x1a1fed,_0x5a09f3){return _0x1a1fed!==_0x5a09f3;},'\x68\x43\x47\x45\x54':_0x167376(0x124,'\x75\x4d\x32\x5a'),'\x6c\x45\x57\x54\x4f':function(_0x367c1b,_0x84c54c){return _0x367c1b<_0x84c54c;},'\x6a\x43\x73\x4f\x43':function(_0x2c88f7,_0x44a4b1){return _0x2c88f7>_0x44a4b1;},'\x53\x56\x4f\x63\x68':function(_0x2b9003,_0x1a71ea){return _0x2b9003>_0x1a71ea;},'\x58\x4b\x6c\x46\x4e':function(_0x488928,_0x314400){return _0x488928===_0x314400;},'\x4f\x4c\x56\x79\x47':function(_0x4b667d,_0x4d2253){return _0x4b667d+_0x4d2253;}},_0x432bd9=_0x4dd58c&&_0x543e46[_0x167376(0x151,'\x5e\x74\x64\x41')](_0x4dd58c[_0x167376(0x16d,'\x6a\x64\x4c\x78')],null)?Date['\x70\x61\x72\x73\x65'](_0x4dd58c[_0x167376(0x164,'\x51\x30\x41\x31')]):NaN,_0x2b24a9={..._0x257cc7};if(!Number[_0x167376(0x158,'\x5b\x69\x29\x6e')](_0x432bd9))return _0x2b24a9;const _0x98e9b7=_0x4dd58c&&_0x543e46[_0x167376(0x13b,'\x39\x29\x46\x56')](_0x4dd58c[_0x167376(0x15f,'\x30\x40\x62\x5b')],null)&&Number['\x69\x73\x46\x69\x6e\x69\x74\x65'](Date[_0x167376(0x15e,'\x5d\x47\x55\x64')](_0x4dd58c[_0x167376(0x10a,'\x37\x79\x52\x54')]))?Date[_0x167376(0x150,'\x39\x29\x46\x56')](_0x4dd58c[_0x167376(0x130,'\x62\x61\x56\x49')]):Date[_0x167376(0x11e,'\x6b\x70\x67\x63')]();let _0x149c77;try{if(_0x543e46[_0x167376(0x135,'\x32\x44\x77\x6b')](_0x543e46[_0x167376(0x108,'\x75\x4d\x32\x5a')],_0x543e46[_0x167376(0x138,'\x41\x6f\x4c\x48')])){const _0x46d6c4=_0x543e46[_0x167376(0x13d,'\x54\x51\x49\x5a')](_0xc2e495),_0x1c94d6={..._0x257cc7};if(!_0x7df61f[_0x167376(0x139,'\x37\x79\x52\x54')+'\x6e\x63'](_0x46d6c4))return _0x1c94d6;_0x149c77=_0x7df61f[_0x167376(0x119,'\x39\x6a\x38\x29')+_0x167376(0x143,'\x62\x61\x56\x49')](_0x46d6c4,_0x543e46[_0x167376(0x105,'\x23\x6a\x50\x4f')]);}else{const _0xfe51ce=_0x1a5851[_0x167376(0x125,'\x26\x62\x53\x6b')](_0x3c27c4);if(_0x1c53e0[_0x167376(0x11d,'\x41\x42\x51\x51')](_0xfe51ce))return _0xfe51ce;}}catch(_0x3cfd51){if(_0x543e46[_0x167376(0x11a,'\x51\x30\x41\x31')]('\x4a\x4b\x51\x4e\x41',_0x543e46[_0x167376(0x162,'\x23\x75\x5d\x64')])){const _0x4f4a5f=_0x1414cf(),_0x3ace09={..._0x241d09};if(!_0x47274e['\x65\x78\x69\x73\x74\x73\x53\x79'+'\x6e\x63'](_0x4f4a5f))return _0x3ace09;_0x15df0d=_0x1eecec[_0x167376(0x170,'\x43\x42\x26\x45')+'\x53\x79\x6e\x63'](_0x4f4a5f,_0x543e46[_0x167376(0x11c,'\x62\x78\x41\x63')]);}else{const _0x56c10e={..._0x257cc7};return _0x56c10e;}}let _0x3c1ead=null;try{_0x3c1ead=_0x543e46[_0x167376(0x11b,'\x78\x67\x32\x77')](_0x22d499);}catch(_0x1f2d7b){_0x3c1ead=null;}let _0x5c8ef5=-0x2059+-0xb*0x54+0x23f5,_0x2c7ae3=0x1*-0x9fd+0x1*0xc7d+-0xa0*0x4,_0x470e62=0x1be*-0xc+-0x7*0x482+0x3476*0x1;for(const _0x53d2c5 of _0x149c77[_0x167376(0x16e,'\x32\x44\x77\x6b')]('\x0a')){if(_0x543e46['\x69\x44\x64\x47\x64'](_0x543e46[_0x167376(0x132,'\x4e\x50\x36\x32')],_0x543e46[_0x167376(0x104,'\x42\x73\x79\x55')])){const _0x48e106=_0x53d2c5[_0x167376(0x129,'\x37\x79\x52\x54')]();if(!_0x48e106)continue;let _0x4c4234;try{_0x4c4234=JSON[_0x167376(0x16f,'\x68\x5b\x49\x67')](_0x48e106);}catch(_0x1a81cd){continue;}if(_0x4c4234&&_0x4c4234[_0x167376(0x121,'\x39\x6a\x38\x29')+'\x64']){if(_0x543e46[_0x167376(0x13c,'\x66\x65\x64\x5e')](_0x167376(0x123,'\x6a\x64\x4c\x78'),_0x167376(0x120,'\x40\x54\x55\x37'))){if(!_0x3c1ead)continue;try{_0x4c4234=_0x543e46['\x64\x4b\x44\x4d\x49'](_0x35880d,_0x4c4234,_0x3c1ead);}catch(_0x3c4da1){if(_0x543e46[_0x167376(0x167,'\x68\x68\x5e\x37')]('\x73\x58\x4b\x67\x59','\x73\x58\x4b\x67\x59'))_0x25e2d7=_0x471962(_0x368f75,_0x463cbb);else continue;}}else{const _0x253a67=_0x2686b3&&(_0x423d7a['\x74\x69\x6d\x65\x73\x74\x61\x6d'+'\x70']||_0x55fb19[_0x167376(0x12d,'\x41\x6f\x4c\x48')+_0x167376(0x111,'\x65\x72\x56\x42')]);if(_0x253a67){const _0x5493e8=_0x5cf1e2['\x70\x61\x72\x73\x65'](_0x253a67);if(_0x5c55b0[_0x167376(0x13a,'\x68\x68\x5e\x37')](_0x5493e8))return _0x5493e8;}if(_0xd0606&&_0x1aa684[_0x167376(0x155,'\x30\x40\x62\x5b')](UrTDlw[_0x167376(0x126,'\x42\x45\x58\x38')](_0x1087a5,_0x4940df[_0x167376(0x165,'\x5d\x47\x55\x64')+'\x74'])))return UrTDlw[_0x167376(0x168,'\x59\x4e\x67\x33')](UrTDlw[_0x167376(0x16b,'\x66\x43\x21\x6e')](_0x408741,_0x4d464c[_0x167376(0x14a,'\x63\x2a\x6a\x41')+'\x74']),0x15f2+-0x1f*-0xac+0xc7*-0x32);return null;}}if(!_0x4c4234||_0x543e46[_0x167376(0x12a,'\x64\x55\x5a\x65')](typeof _0x4c4234,_0x543e46['\x68\x43\x47\x45\x54']))continue;const _0x396a3f=_0x463953(_0x4c4234);if(_0x396a3f==null||_0x543e46[_0x167376(0x149,'\x59\x4e\x67\x33')](_0x396a3f,_0x432bd9)||_0x543e46[_0x167376(0x145,'\x59\x4e\x67\x33')](_0x396a3f,_0x98e9b7))continue;const _0x4ce1d7=Number(_0x4c4234['\x69\x6e\x70\x75\x74\x5f\x74\x6f'+_0x167376(0x122,'\x41\x42\x51\x51')]),_0x1f50bb=_0x543e46[_0x167376(0x10e,'\x56\x4e\x77\x50')](Number,_0x4c4234[_0x167376(0x137,'\x68\x5b\x49\x67')+_0x167376(0x11f,'\x55\x33\x57\x6c')]),_0xe6625f=Number[_0x167376(0x13a,'\x68\x68\x5e\x37')](_0x4ce1d7)&&_0x543e46[_0x167376(0x106,'\x76\x46\x6f\x67')](_0x4ce1d7,0xf0b+0x464*0x8+0x10b9*-0x3),_0x3bd94e=Number[_0x167376(0x12f,'\x26\x62\x53\x6b')](_0x1f50bb)&&_0x1f50bb>-0x1*0x903+-0x1303+-0xd3*-0x22;if(_0xe6625f)_0x5c8ef5+=_0x4ce1d7;if(_0x3bd94e)_0x2c7ae3+=_0x1f50bb;if(_0xe6625f||_0x3bd94e)_0x470e62+=0x186d+-0xb7+0x3*-0x7e7;}else{const _0x2018c4={..._0x2d3ad3};return _0x2018c4;}}const _0x27d8ed={..._0x257cc7};if(_0x543e46[_0x167376(0x171,'\x62\x61\x56\x49')](_0x470e62,0x1*0x9ff+0x24db+-0x2eda))return _0x27d8ed;return{'\x69\x6e\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x5c8ef5,'\x6f\x75\x74\x70\x75\x74\x5f\x74\x6f\x6b\x65\x6e\x73':_0x2c7ae3,'\x74\x6f\x74\x61\x6c\x5f\x74\x6f\x6b\x65\x6e\x73':_0x543e46[_0x167376(0x103,'\x39\x29\x46\x56')](_0x5c8ef5,_0x2c7ae3),'\x63\x61\x6c\x6c\x73':_0x470e62,'\x6d\x65\x61\x73\x75\x72\x65\x64':!![]};}function _0x3df3(){const _0x415195=['\x57\x36\x4c\x38\x57\x34\x4e\x63\x4a\x75\x6d','\x57\x35\x64\x63\x53\x58\x52\x63\x4a\x33\x52\x63\x4d\x43\x6b\x79\x57\x4f\x34','\x57\x51\x66\x43\x6f\x65\x42\x64\x4b\x6d\x6b\x42\x71\x43\x6b\x75','\x57\x4f\x37\x64\x51\x68\x65\x48','\x78\x6d\x6b\x42\x6e\x76\x68\x64\x54\x75\x6c\x64\x52\x53\x6f\x4b','\x57\x36\x50\x4a\x6e\x71','\x62\x61\x5a\x64\x56\x38\x6b\x55\x57\x36\x69','\x57\x34\x47\x52\x57\x52\x74\x64\x4a\x64\x52\x64\x48\x43\x6b\x49\x44\x57','\x68\x5a\x4a\x63\x55\x64\x6c\x63\x55\x47','\x57\x4f\x37\x64\x52\x66\x4a\x63\x53\x77\x56\x63\x4a\x6d\x6b\x31\x57\x4f\x64\x64\x4d\x61','\x68\x67\x37\x64\x50\x38\x6f\x4d\x6c\x77\x39\x48\x69\x71','\x65\x53\x6b\x70\x6e\x62\x4e\x64\x4c\x53\x6b\x57\x6f\x6d\x6b\x4f','\x69\x73\x4c\x43\x6e\x61','\x44\x53\x6f\x32\x42\x65\x34\x65','\x71\x6d\x6b\x67\x62\x31\x68\x64\x54\x32\x6c\x64\x51\x43\x6f\x55','\x57\x50\x6a\x53\x57\x34\x68\x63\x4e\x67\x74\x64\x56\x53\x6b\x53\x46\x43\x6b\x53\x57\x52\x47\x4b','\x68\x53\x6f\x41\x42\x74\x43\x73\x57\x37\x30\x57\x77\x38\x6f\x56\x57\x36\x66\x5a\x57\x36\x53','\x73\x49\x42\x63\x47\x4d\x6d\x2b','\x57\x51\x62\x52\x57\x36\x6d\x6b\x68\x53\x6f\x62\x41\x53\x6f\x33\x6a\x78\x31\x67\x57\x37\x75','\x69\x6d\x6f\x51\x57\x4f\x52\x63\x4a\x58\x74\x64\x47\x57\x74\x64\x48\x61','\x7a\x43\x6f\x4c\x45\x31\x57\x76\x69\x57\x6c\x63\x49\x61','\x65\x53\x6f\x31\x71\x57','\x57\x36\x47\x32\x57\x34\x76\x34\x57\x50\x47','\x63\x53\x6b\x6f\x6c\x73\x2f\x64\x56\x47','\x61\x38\x6f\x6f\x69\x58\x61\x4a\x57\x37\x35\x63\x57\x37\x75','\x6f\x47\x54\x6b\x6e\x78\x75','\x79\x31\x56\x63\x53\x43\x6b\x6e\x44\x71','\x65\x4d\x56\x64\x4f\x38\x6f\x36\x69\x71','\x57\x4f\x2f\x64\x55\x53\x6f\x34\x57\x52\x78\x64\x56\x67\x56\x64\x4c\x38\x6b\x63','\x57\x37\x48\x30\x70\x68\x2f\x63\x49\x61','\x57\x52\x37\x64\x55\x73\x43\x48\x44\x57','\x70\x43\x6b\x7a\x42\x58\x75\x4b\x6d\x6d\x6b\x39\x57\x37\x57','\x57\x34\x78\x63\x56\x5a\x4a\x64\x54\x38\x6b\x4e','\x69\x71\x39\x38\x6c\x33\x71\x35\x57\x52\x78\x64\x4f\x57','\x6e\x53\x6f\x78\x57\x4f\x52\x64\x56\x57','\x62\x53\x6f\x55\x64\x59\x53\x56','\x57\x51\x68\x64\x53\x71\x4a\x63\x55\x43\x6b\x4b','\x65\x31\x5a\x64\x56\x38\x6f\x6a\x57\x50\x75','\x57\x37\x68\x64\x49\x38\x6f\x56\x6b\x38\x6f\x2b','\x44\x6d\x6b\x35\x67\x4d\x62\x63','\x57\x35\x71\x53\x57\x50\x74\x63\x4e\x71','\x57\x34\x4f\x6b\x57\x50\x46\x64\x55\x53\x6b\x2b','\x42\x6d\x6b\x63\x57\x35\x46\x63\x55\x74\x53\x4d\x45\x68\x4f\x4d\x6d\x71','\x57\x36\x78\x64\x50\x6d\x6b\x58\x44\x38\x6b\x62\x61\x43\x6f\x42\x61\x57','\x46\x67\x56\x63\x55\x63\x79\x75\x65\x4d\x37\x64\x4f\x47','\x42\x31\x62\x55\x42\x59\x64\x63\x4c\x33\x5a\x64\x55\x66\x35\x74\x77\x57','\x57\x36\x79\x77\x57\x50\x56\x64\x47\x73\x57','\x69\x53\x6f\x76\x61\x48\x53\x42','\x62\x73\x31\x77\x46\x5a\x58\x30\x57\x35\x62\x4e\x57\x36\x52\x64\x47\x73\x56\x64\x52\x61','\x57\x37\x53\x4d\x57\x51\x5a\x64\x4b\x6d\x6b\x74','\x43\x53\x6f\x70\x57\x52\x50\x46','\x57\x4f\x56\x64\x50\x74\x33\x63\x47\x68\x4a\x63\x4b\x38\x6b\x55\x57\x51\x71','\x72\x63\x52\x63\x4f\x43\x6f\x44\x70\x76\x66\x4e\x6e\x6d\x6b\x37','\x57\x37\x70\x64\x51\x38\x6b\x50\x43\x53\x6b\x45','\x57\x51\x56\x64\x4f\x63\x75\x39\x79\x6d\x6f\x64\x63\x47','\x57\x51\x54\x44\x67\x30\x37\x64\x49\x53\x6b\x78\x75\x43\x6b\x57','\x6a\x49\x52\x64\x4a\x4e\x4c\x6a\x74\x59\x5a\x64\x4c\x53\x6b\x47\x57\x52\x68\x64\x49\x6d\x6f\x71\x57\x35\x6d','\x57\x36\x78\x64\x48\x30\x4a\x63\x56\x6d\x6b\x6c\x41\x53\x6f\x64\x6e\x57','\x61\x6d\x6f\x6e\x57\x52\x4b\x67\x63\x75\x79\x65\x41\x57','\x6f\x53\x6f\x68\x57\x4f\x64\x63\x51\x58\x75','\x44\x71\x57\x39\x44\x62\x79','\x6e\x5a\x68\x63\x4f\x47\x2f\x63\x52\x57','\x6e\x4e\x64\x63\x51\x6d\x6b\x6f\x57\x37\x6c\x64\x4f\x77\x74\x63\x52\x57','\x63\x49\x4c\x4e','\x6d\x47\x4b\x39\x6e\x4d\x43','\x57\x52\x46\x64\x56\x33\x4b\x76\x57\x51\x34','\x66\x38\x6f\x67\x57\x52\x53\x71\x6e\x4c\x38\x43\x41\x57','\x6e\x67\x42\x63\x47\x6d\x6b\x75','\x57\x51\x37\x64\x4f\x43\x6f\x57\x57\x50\x68\x64\x49\x61','\x57\x35\x6d\x6b\x57\x51\x2f\x64\x4b\x43\x6b\x69\x57\x35\x4f','\x64\x64\x2f\x64\x50\x6d\x6b\x65\x57\x35\x61','\x44\x53\x6b\x7a\x68\x43\x6b\x52\x57\x51\x53','\x57\x50\x6e\x54\x57\x34\x46\x63\x4c\x32\x6c\x63\x4e\x6d\x6f\x55\x7a\x43\x6b\x5a\x57\x51\x30\x69\x57\x37\x37\x63\x47\x57','\x57\x4f\x54\x43\x57\x37\x42\x63\x47\x38\x6f\x42\x57\x50\x4f\x72\x57\x51\x35\x52\x57\x36\x74\x64\x54\x75\x57','\x57\x36\x74\x64\x55\x6d\x6b\x53\x43\x57','\x71\x76\x68\x63\x52\x73\x57\x45','\x6f\x53\x6f\x4a\x6c\x4c\x70\x64\x56\x71','\x6c\x78\x52\x63\x49\x76\x44\x41\x6b\x43\x6b\x58\x57\x52\x6e\x39\x6a\x5a\x66\x4f\x57\x36\x71','\x6c\x63\x57\x2f\x68\x38\x6b\x42\x57\x51\x69\x6a\x6f\x71','\x57\x52\x43\x63\x57\x37\x33\x63\x56\x77\x61\x51\x57\x36\x37\x64\x47\x57','\x66\x73\x33\x64\x4b\x6d\x6b\x45\x57\x35\x56\x64\x52\x65\x74\x63\x55\x57','\x57\x36\x4a\x63\x4d\x49\x64\x64\x4d\x6d\x6b\x66\x57\x52\x35\x76\x57\x37\x69','\x42\x53\x6b\x67\x57\x35\x46\x63\x54\x75\x71\x31\x45\x65\x57\x7a\x62\x43\x6b\x6e','\x72\x61\x35\x41\x57\x52\x46\x63\x48\x61','\x62\x33\x74\x64\x4f\x71','\x57\x35\x2f\x63\x4a\x77\x33\x64\x54\x43\x6b\x53\x70\x38\x6b\x7a\x57\x50\x71\x36\x57\x50\x6d','\x57\x34\x48\x30\x62\x4e\x68\x63\x52\x47','\x57\x52\x69\x65\x57\x52\x70\x64\x4f\x71','\x57\x51\x68\x64\x52\x73\x65\x49\x7a\x38\x6f\x64\x6a\x53\x6f\x41','\x6b\x57\x47\x5a\x6c\x53\x6b\x76','\x57\x37\x78\x64\x53\x53\x6b\x53\x42\x43\x6b\x7a\x6f\x38\x6f\x37\x66\x71','\x57\x35\x75\x6d\x57\x35\x62\x59\x57\x50\x6a\x66\x57\x52\x52\x64\x4e\x57','\x57\x4f\x70\x64\x52\x58\x33\x63\x47\x53\x6b\x47','\x67\x4c\x2f\x64\x54\x38\x6f\x72\x70\x61','\x78\x72\x2f\x64\x53\x47\x30\x36','\x70\x6d\x6b\x7a\x42\x57\x6d\x62\x6d\x71','\x57\x35\x75\x58\x57\x50\x2f\x64\x47\x63\x46\x64\x4d\x6d\x6b\x33\x46\x57','\x57\x4f\x4a\x64\x52\x4c\x4e\x64\x4a\x4a\x52\x64\x54\x38\x6f\x41\x57\x4f\x5a\x64\x49\x4d\x33\x63\x4d\x38\x6f\x4f\x61\x61','\x57\x37\x5a\x63\x52\x77\x62\x47\x6a\x6d\x6b\x68\x71\x43\x6f\x7a\x46\x4a\x6c\x64\x56\x38\x6f\x33\x57\x35\x43','\x57\x36\x33\x64\x55\x43\x6f\x58\x69\x6d\x6f\x4d\x57\x35\x56\x64\x55\x43\x6b\x65','\x57\x34\x37\x63\x4a\x74\x52\x64\x4b\x47','\x57\x51\x6c\x63\x51\x33\x4e\x64\x54\x43\x6f\x76','\x64\x6d\x6b\x4a\x66\x63\x6c\x64\x50\x57','\x57\x36\x4e\x63\x4d\x59\x64\x64\x4b\x6d\x6b\x66\x57\x51\x48\x73\x57\x37\x69','\x67\x4a\x66\x6e\x7a\x49\x44\x50\x57\x4f\x53\x4c','\x57\x37\x39\x46\x57\x37\x33\x63\x4f\x67\x34\x39','\x63\x53\x6b\x4c\x6d\x64\x4e\x64\x51\x57','\x57\x51\x78\x63\x47\x75\x5a\x64\x48\x43\x6f\x77\x57\x34\x74\x63\x4a\x53\x6f\x46','\x57\x52\x78\x63\x48\x58\x33\x64\x51\x38\x6f\x6d\x6f\x38\x6b\x72\x6a\x30\x44\x78\x57\x51\x44\x6d\x6e\x71','\x57\x37\x61\x43\x41\x58\x64\x63\x4b\x6d\x6b\x59\x71\x43\x6b\x53\x57\x50\x74\x63\x4f\x33\x38','\x6a\x57\x52\x63\x48\x38\x6f\x49\x69\x6d\x6f\x33\x69\x4a\x71','\x6d\x6d\x6f\x78\x57\x4f\x78\x64\x56\x57\x65\x76\x7a\x30\x43','\x65\x68\x74\x64\x56\x43\x6f\x4c\x6c\x67\x4c\x6c\x6e\x47','\x57\x50\x37\x64\x4e\x63\x5a\x63\x53\x38\x6b\x67'];_0x3df3=function(){return _0x415195;};return _0x3df3();}const _0x57be02={};_0x57be02[_0x4d3ece(0x142,'\x23\x6a\x50\x4f')+_0x4d3ece(0x156,'\x32\x44\x77\x6b')]=_0x18d4ad,module[_0x4d3ece(0x115,'\x68\x5b\x49\x67')]=_0x57be02;
|
|
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
|
package/scripts/a2a_export.js
DELETED
|
@@ -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
|
-
}
|
package/scripts/a2a_ingest.js
DELETED
|
@@ -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
|
-
}
|
package/scripts/a2a_promote.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
var assetStore = require('../src/gep/assetStore');
|
|
2
|
-
var solidifyMod = require('../src/gep/solidify');
|
|
3
|
-
var contentHash = require('../src/gep/contentHash');
|
|
4
|
-
var a2aProto = require('../src/gep/a2aProtocol');
|
|
5
|
-
|
|
6
|
-
function parseArgs(argv) {
|
|
7
|
-
var out = { flags: new Set(), kv: new Map(), positionals: [] };
|
|
8
|
-
for (var i = 0; i < argv.length; i++) {
|
|
9
|
-
var a = argv[i];
|
|
10
|
-
if (!a) continue;
|
|
11
|
-
if (a.startsWith('--')) {
|
|
12
|
-
var eq = a.indexOf('=');
|
|
13
|
-
if (eq > -1) { out.kv.set(a.slice(2, eq), a.slice(eq + 1)); }
|
|
14
|
-
else {
|
|
15
|
-
var key = a.slice(2);
|
|
16
|
-
var next = argv[i + 1];
|
|
17
|
-
if (next && !String(next).startsWith('--')) { out.kv.set(key, next); i++; }
|
|
18
|
-
else { out.flags.add(key); }
|
|
19
|
-
}
|
|
20
|
-
} else { out.positionals.push(a); }
|
|
21
|
-
}
|
|
22
|
-
return out;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function main() {
|
|
26
|
-
var args = parseArgs(process.argv.slice(2));
|
|
27
|
-
var id = String(args.kv.get('id') || '').trim();
|
|
28
|
-
var typeRaw = String(args.kv.get('type') || '').trim().toLowerCase();
|
|
29
|
-
var validated = args.flags.has('validated') || String(args.kv.get('validated') || '') === 'true';
|
|
30
|
-
var limit = Number.isFinite(Number(args.kv.get('limit'))) ? Number(args.kv.get('limit')) : 500;
|
|
31
|
-
|
|
32
|
-
if (!id || !typeRaw) throw new Error('Usage: node scripts/a2a_promote.js --type capsule|gene|event --id <id> --validated');
|
|
33
|
-
if (!validated) throw new Error('Refusing to promote without --validated (local verification must be done first).');
|
|
34
|
-
|
|
35
|
-
var type = typeRaw === 'capsule' ? 'Capsule' : typeRaw === 'gene' ? 'Gene' : typeRaw === 'event' ? 'EvolutionEvent' : '';
|
|
36
|
-
if (!type) throw new Error('Invalid --type. Use capsule, gene, or event.');
|
|
37
|
-
|
|
38
|
-
var external = assetStore.readRecentExternalCandidates(limit);
|
|
39
|
-
var candidate = null;
|
|
40
|
-
for (var i = 0; i < external.length; i++) {
|
|
41
|
-
if (external[i] && external[i].type === type && String(external[i].id) === id) { candidate = external[i]; break; }
|
|
42
|
-
}
|
|
43
|
-
if (!candidate) throw new Error('Candidate not found in external zone: type=' + type + ' id=' + id);
|
|
44
|
-
|
|
45
|
-
if (type === 'Gene') {
|
|
46
|
-
var validation = Array.isArray(candidate.validation) ? candidate.validation : [];
|
|
47
|
-
for (var j = 0; j < validation.length; j++) {
|
|
48
|
-
var c = String(validation[j] || '').trim();
|
|
49
|
-
if (!c) continue;
|
|
50
|
-
if (!solidifyMod.isValidationCommandAllowed(c)) {
|
|
51
|
-
throw new Error('Refusing to promote Gene ' + id + ': validation command rejected by safety check: "' + c + '". Only node/npm/npx commands without shell operators are allowed.');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var promoted = JSON.parse(JSON.stringify(candidate));
|
|
57
|
-
if (!promoted.a2a || typeof promoted.a2a !== 'object') promoted.a2a = {};
|
|
58
|
-
promoted.a2a.status = 'promoted';
|
|
59
|
-
promoted.a2a.promoted_at = new Date().toISOString();
|
|
60
|
-
if (!promoted.schema_version) promoted.schema_version = contentHash.SCHEMA_VERSION;
|
|
61
|
-
promoted.asset_id = contentHash.computeAssetId(promoted);
|
|
62
|
-
|
|
63
|
-
var emitDecisions = process.env.A2A_EMIT_DECISIONS === 'true';
|
|
64
|
-
|
|
65
|
-
if (type === 'EvolutionEvent') {
|
|
66
|
-
assetStore.appendEventJsonl(promoted);
|
|
67
|
-
if (emitDecisions) {
|
|
68
|
-
try {
|
|
69
|
-
var dmEv = a2aProto.buildDecision({ assetId: promoted.asset_id, localId: id, decision: 'accept', reason: 'event promoted for provenance tracking' });
|
|
70
|
-
a2aProto.getTransport().send(dmEv);
|
|
71
|
-
} catch (e) {}
|
|
72
|
-
}
|
|
73
|
-
process.stdout.write('promoted_event=' + id + '\n');
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (type === 'Capsule') {
|
|
78
|
-
assetStore.appendCapsule(promoted);
|
|
79
|
-
if (emitDecisions) {
|
|
80
|
-
try {
|
|
81
|
-
var dm = a2aProto.buildDecision({ assetId: promoted.asset_id, localId: id, decision: 'accept', reason: 'capsule promoted after validation' });
|
|
82
|
-
a2aProto.getTransport().send(dm);
|
|
83
|
-
} catch (e) {}
|
|
84
|
-
}
|
|
85
|
-
process.stdout.write('promoted_capsule=' + id + '\n');
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
var localGenes = assetStore.loadGenes();
|
|
90
|
-
var exists = false;
|
|
91
|
-
for (var k = 0; k < localGenes.length; k++) {
|
|
92
|
-
if (localGenes[k] && localGenes[k].type === 'Gene' && String(localGenes[k].id) === id) { exists = true; break; }
|
|
93
|
-
}
|
|
94
|
-
if (exists) {
|
|
95
|
-
if (emitDecisions) {
|
|
96
|
-
try {
|
|
97
|
-
var dm2 = a2aProto.buildDecision({ assetId: promoted.asset_id, localId: id, decision: 'reject', reason: 'local gene with same ID already exists' });
|
|
98
|
-
a2aProto.getTransport().send(dm2);
|
|
99
|
-
} catch (e) {}
|
|
100
|
-
}
|
|
101
|
-
process.stdout.write('conflict_keep_local_gene=' + id + '\n');
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
assetStore.upsertGene(promoted);
|
|
106
|
-
if (emitDecisions) {
|
|
107
|
-
try {
|
|
108
|
-
var dm3 = a2aProto.buildDecision({ assetId: promoted.asset_id, localId: id, decision: 'accept', reason: 'gene promoted after safety audit' });
|
|
109
|
-
a2aProto.getTransport().send(dm3);
|
|
110
|
-
} catch (e) {}
|
|
111
|
-
}
|
|
112
|
-
process.stdout.write('promoted_gene=' + id + '\n');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
try { main(); } catch (e) {
|
|
116
|
-
process.stderr.write((e && e.message ? e.message : String(e)) + '\n');
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
5
|
-
const LOG_FILE = path.join(REPO_ROOT, 'evolution_history_full.md');
|
|
6
|
-
const OUT_FILE = path.join(REPO_ROOT, 'evolution_detailed_report.md');
|
|
7
|
-
|
|
8
|
-
function analyzeEvolution() {
|
|
9
|
-
if (!fs.existsSync(LOG_FILE)) {
|
|
10
|
-
console.error("Source file missing.");
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const content = fs.readFileSync(LOG_FILE, 'utf8');
|
|
15
|
-
// Split by divider
|
|
16
|
-
const entries = content.split('---').map(e => e.trim()).filter(e => e.length > 0);
|
|
17
|
-
|
|
18
|
-
const skillUpdates = {}; // Map<SkillName, Array<Changes>>
|
|
19
|
-
const generalUpdates = []; // Array<Changes>
|
|
20
|
-
|
|
21
|
-
// Regex to detect skills/paths
|
|
22
|
-
// e.g. `skills/feishu-card/send.js` or **Target**: `skills/git-sync`
|
|
23
|
-
const skillRegex = /skills\/([a-zA-Z0-9\-_]+)/;
|
|
24
|
-
const actionRegex = /Action:\s*([\s\S]*?)(?=\n\n|\n[A-Z]|$)/i; // Capture Action text
|
|
25
|
-
const statusRegex = /Status:\s*\[?([A-Z\s_]+)\]?/i;
|
|
26
|
-
|
|
27
|
-
entries.forEach(entry => {
|
|
28
|
-
// Extract basic info
|
|
29
|
-
const statusMatch = entry.match(statusRegex);
|
|
30
|
-
const status = statusMatch ? statusMatch[1].trim().toUpperCase() : 'UNKNOWN';
|
|
31
|
-
|
|
32
|
-
// Skip routine checks if we want a *detailed evolution* report (focus on changes)
|
|
33
|
-
// But user asked for "what happened", so routine scans might be boring unless they found something.
|
|
34
|
-
// Let's filter out "STABILITY" or "RUNNING" unless there is a clear "Mutated" or "Fixed" keyword.
|
|
35
|
-
const isInteresting =
|
|
36
|
-
entry.includes('Fixed') ||
|
|
37
|
-
entry.includes('Hardened') ||
|
|
38
|
-
entry.includes('Optimized') ||
|
|
39
|
-
entry.includes('Patched') ||
|
|
40
|
-
entry.includes('Created') ||
|
|
41
|
-
entry.includes('Added') ||
|
|
42
|
-
status === 'SUCCESS' ||
|
|
43
|
-
status === 'COMPLETED';
|
|
44
|
-
|
|
45
|
-
if (!isInteresting) return;
|
|
46
|
-
|
|
47
|
-
// Find associated skill
|
|
48
|
-
const skillMatch = entry.match(skillRegex);
|
|
49
|
-
let skillName = 'General / System';
|
|
50
|
-
if (skillMatch) {
|
|
51
|
-
skillName = skillMatch[1];
|
|
52
|
-
} else {
|
|
53
|
-
// Try heuristics
|
|
54
|
-
if (entry.toLowerCase().includes('feishu card')) skillName = 'feishu-card';
|
|
55
|
-
else if (entry.toLowerCase().includes('git sync')) skillName = 'git-sync';
|
|
56
|
-
else if (entry.toLowerCase().includes('logger')) skillName = 'interaction-logger';
|
|
57
|
-
else if (entry.toLowerCase().includes('evolve')) skillName = 'capability-evolver';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Extract description
|
|
61
|
-
let description = "";
|
|
62
|
-
const actionMatch = entry.match(actionRegex);
|
|
63
|
-
if (actionMatch) {
|
|
64
|
-
description = actionMatch[1].trim();
|
|
65
|
-
} else {
|
|
66
|
-
// Fallback: take lines that look like bullet points or text after header
|
|
67
|
-
const lines = entry.split('\n');
|
|
68
|
-
description = lines.filter(l => l.match(/^[•\-\*]|\w/)).slice(1).join('\n').trim();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Clean up description (remove duplicate "Action:" prefix if captured)
|
|
72
|
-
description = description.replace(/^Action:\s*/i, '');
|
|
73
|
-
|
|
74
|
-
if (!skillUpdates[skillName]) skillUpdates[skillName] = [];
|
|
75
|
-
|
|
76
|
-
// Dedup descriptions slightly (simple check)
|
|
77
|
-
const isDuplicate = skillUpdates[skillName].some(u => u.desc.includes(description.substring(0, 20)));
|
|
78
|
-
if (!isDuplicate) {
|
|
79
|
-
// Extract Date if possible
|
|
80
|
-
const dateMatch = entry.match(/\((\d{4}\/\d{1,2}\/\d{1,2}.*?)\)/);
|
|
81
|
-
const date = dateMatch ? dateMatch[1] : 'Unknown';
|
|
82
|
-
|
|
83
|
-
skillUpdates[skillName].push({
|
|
84
|
-
date,
|
|
85
|
-
status,
|
|
86
|
-
desc: description
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Generate Markdown
|
|
92
|
-
let md = "# Detailed Evolution Report (By Skill)\n\n> Comprehensive breakdown of system changes.\n\n";
|
|
93
|
-
|
|
94
|
-
// Sort skills alphabetically
|
|
95
|
-
const sortedSkills = Object.keys(skillUpdates).sort();
|
|
96
|
-
|
|
97
|
-
sortedSkills.forEach(skill => {
|
|
98
|
-
md += `## ${skill}\n`;
|
|
99
|
-
const updates = skillUpdates[skill];
|
|
100
|
-
|
|
101
|
-
updates.forEach(u => {
|
|
102
|
-
// Icon based on content
|
|
103
|
-
let icon = '*';
|
|
104
|
-
const lowerDesc = u.desc.toLowerCase();
|
|
105
|
-
if (lowerDesc.includes('optimiz')) icon = '[optimize]';
|
|
106
|
-
if (lowerDesc.includes('secur') || lowerDesc.includes('harden') || lowerDesc.includes('permission')) icon = '[security]';
|
|
107
|
-
if (lowerDesc.includes('fix') || lowerDesc.includes('patch')) icon = '[repair]';
|
|
108
|
-
if (lowerDesc.includes('creat') || lowerDesc.includes('add')) icon = '[add]';
|
|
109
|
-
|
|
110
|
-
md += `### ${icon} ${u.date}\n`;
|
|
111
|
-
md += `${u.desc}\n\n`;
|
|
112
|
-
});
|
|
113
|
-
md += `---\n`;
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
fs.writeFileSync(OUT_FILE, md);
|
|
117
|
-
console.log(`Generated report for ${sortedSkills.length} skills.`);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
analyzeEvolution();
|
|
121
|
-
|