trimprompt 1.0.29 โ 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/api-proxy.js +1 -1
- package/cache-manager.js +1 -0
- package/cache.js +1 -1
- package/ccr.js +1 -1
- package/cli.js +1 -1
- package/dashboard.js +1 -1
- package/executor.js +1 -1
- package/file-watcher.js +1 -0
- package/filters/devops.js +1 -1
- package/filters/generic.js +1 -1
- package/filters/git.js +1 -1
- package/filters/go.js +99 -1
- package/filters/index.js +185 -1
- package/filters/js.js +78 -1
- package/filters/python.js +130 -1
- package/filters/rust.js +115 -1
- package/filters/shell.js +395 -1
- package/hooks/claude-hook.js +79 -0
- package/index.html +339 -119
- package/mcp.js +132 -1
- package/package.json +1 -4
- package/proxy-conv.js +181 -1
- package/proxy-daemon.js +382 -1
- package/proxy-resp.js +1 -1
- package/redactor.js +1 -1
- package/seed.js +1 -1
- package/shims.js +1 -1
- package/simulate.js +1 -1
- package/sync.js +1 -1
- package/tracker.js +1 -1
- package/traffic-interceptor.js +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,19 @@ TrimPrompt coined and invented the **CSA (Compression, Security, Audit) Framewor
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## โก CONVERSATION COMPRESSION (LIVE CONTEXT)
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
TrimPrompt features real-time background watchers and native hooks that continuously compress active AI session logs and conversation histories on-the-fly, preventing context window bloat and slashing token costs:
|
|
26
|
+
|
|
27
|
+
* ๐ข **Google Gemini Code Assistant:** Live session watcher monitoring and compressing Gemini CLI & extension session logs in `~/.config/gemini/`.
|
|
28
|
+
* ๐ข **Claude Code Live Compression:** Native hooks and local side-cache engine for active sessions in `~/.claude/projects/`.
|
|
29
|
+
* ๐ข **Aider Chat History Optimizer:** Automatic background optimization for `.aider.chat.history.md` files upon launch.
|
|
30
|
+
* ๐ข **Universal Agent Support:** Integrated live session monitors for Codex, Cursor, GitHub Copilot, OpenClaw, OpenCode, and Cortex.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
21
34
|
## Features
|
|
22
35
|
* **Zero-Config Interception:** Automatically injects custom PATH shims during installation so that all agent-triggered tools run through the optimizer transparently.
|
|
23
36
|
* **Real-time MCP Proxy:** Intercepts Model Context Protocol (MCP) tool response JSON-RPC streams on the fly to compress large tool outputs.
|
package/api-proxy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a0_0x316650=a0_0x2637;(function(_0x20ed10,_0x1908f2){const _0x2905b2=a0_0x2637,_0x2511b7=_0x20ed10();while(!![]){try{const _0x5ca594=-parseInt(_0x2905b2(0x1eb))/0x1*(parseInt(_0x2905b2(0x20f))/0x2)+-parseInt(_0x2905b2(0x1f4))/0x3+-parseInt(_0x2905b2(0x209))/0x4*(-parseInt(_0x2905b2(0x206))/0x5)+parseInt(_0x2905b2(0x245))/0x6+parseInt(_0x2905b2(0x216))/0x7*(-parseInt(_0x2905b2(0x1e0))/0x8)+parseInt(_0x2905b2(0x223))/0x9*(parseInt(_0x2905b2(0x1ec))/0xa)+parseInt(_0x2905b2(0x205))/0xb;if(_0x5ca594===_0x1908f2)break;else _0x2511b7['push'](_0x2511b7['shift']());}catch(_0x2f811d){_0x2511b7['push'](_0x2511b7['shift']());}}}(a0_0x32b4,0x7eaa0));function a0_0x32b4(){const _0xf01a1d=['312790wqCvDE','end','/v1/messages','from','data','map','headers','features_enabled','2512683bHaOrQ','text','[TrimPrompt]\x20Features:','host','savedTokens','utf8','tracker','toLowerCase','resp_optimize','configurable','proxy:resp-optimize','timeout','[TrimPrompt]\x20Set\x20in\x20your\x20environment:\x0a','method','url','conv_compress','invalid_url','9396211AdcZeB','221500BGNgNj','optimizeMaxTokens','exit','80MjbqQK','isArray','POST','/v1/responses','anthropic-version','api.anthropic.com','302uMfAIy','request_error','message','max_tokens','unknown','concat','http','7sPBZwf','Bad\x20request','content','port','\x20\x20ANTHROPIC_BASE_URL=http://127.0.0.1:','GET','/completions','OFF','/messages','listening','defineProperty','messages','pathname','81vkNzac','startsWith','getOwnPropertyDescriptor','x-api-key','/v1\x0a','destroy','error','./tracker','/responses','./proxy-resp','__esModule','join','\x20\x20OPENAI_BASE_URL=http://127.0.0.1:','get','string','block','writable','application/json','https://api.openai.com','includes','createServer','api.openai.com','__createBinding','\x20\x20-\x20Conversation\x20compression:\x20','stringify','startApiProxy','create','anthropic','type','/chat/completions','authorization','compressConversation','__setModuleDefault','default','5541762sYsDYb','\x20\x20-\x20Response\x20optimization:\x20\x20\x20\x20','writableEnded','__importStar','search','length','writeHead','EADDRINUSE','./proxy-conv','\x0aPress\x20Ctrl+C\x20to\x20stop.\x0a','4527496kKhGTt','/v1/chat/completions','parse','logExecution','headersSent','openai','prototype','Bad\x20target\x20URL','max_completion_tokens','log','listen','6775rDaBXR'];a0_0x32b4=function(){return _0xf01a1d;};return a0_0x32b4();}var __createBinding=this&&this[a0_0x316650(0x239)]||(Object[a0_0x316650(0x23d)]?function(_0x10f023,_0x8cd96e,_0xcc129f,_0x424e9c){const _0xf450a=a0_0x316650;if(_0x424e9c===undefined)_0x424e9c=_0xcc129f;var _0x1cffd2=Object[_0xf450a(0x225)](_0x8cd96e,_0xcc129f);(!_0x1cffd2||(_0xf450a(0x230)in _0x1cffd2?!_0x8cd96e['__esModule']:_0x1cffd2[_0xf450a(0x233)]||_0x1cffd2[_0xf450a(0x1fd)]))&&(_0x1cffd2={'enumerable':!![],'get':function(){return _0x8cd96e[_0xcc129f];}}),Object[_0xf450a(0x220)](_0x10f023,_0x424e9c,_0x1cffd2);}:function(_0x2d4ea8,_0x257a0f,_0x58c8a5,_0x270552){if(_0x270552===undefined)_0x270552=_0x58c8a5;_0x2d4ea8[_0x270552]=_0x257a0f[_0x58c8a5];}),__setModuleDefault=this&&this[a0_0x316650(0x243)]||(Object['create']?function(_0x483112,_0x3bba39){const _0x44d1b3=a0_0x316650;Object[_0x44d1b3(0x220)](_0x483112,'default',{'enumerable':!![],'value':_0x3bba39});}:function(_0x53a225,_0x4db693){const _0x25b979=a0_0x316650;_0x53a225[_0x25b979(0x244)]=_0x4db693;}),__importStar=this&&this[a0_0x316650(0x1d9)]||(function(){var _0x3bd5f1=function(_0xb02609){return _0x3bd5f1=Object['getOwnPropertyNames']||function(_0x35f2c0){const _0x3d43e4=a0_0x2637;var _0x2cb3c8=[];for(var _0x51604f in _0x35f2c0)if(Object[_0x3d43e4(0x1e6)]['hasOwnProperty']['call'](_0x35f2c0,_0x51604f))_0x2cb3c8[_0x2cb3c8[_0x3d43e4(0x1db)]]=_0x51604f;return _0x2cb3c8;},_0x3bd5f1(_0xb02609);};return function(_0x39e432){const _0x450f5c=a0_0x2637;if(_0x39e432&&_0x39e432[_0x450f5c(0x22d)])return _0x39e432;var _0x4bb1cf={};if(_0x39e432!=null){for(var _0x3901d3=_0x3bd5f1(_0x39e432),_0x3de228=0x0;_0x3de228<_0x3901d3['length'];_0x3de228++)if(_0x3901d3[_0x3de228]!==_0x450f5c(0x244))__createBinding(_0x4bb1cf,_0x39e432,_0x3901d3[_0x3de228]);}return __setModuleDefault(_0x4bb1cf,_0x39e432),_0x4bb1cf;};}());Object[a0_0x316650(0x220)](exports,a0_0x316650(0x22d),{'value':!![]}),exports[a0_0x316650(0x23c)]=startApiProxy;const http=__importStar(require(a0_0x316650(0x215))),https=__importStar(require('https')),url_1=require('url'),proxy_conv_1=require(a0_0x316650(0x1de)),proxy_resp_1=require(a0_0x316650(0x22c)),tracker_1=require(a0_0x316650(0x22a)),ANTHROPIC_API='https://api.anthropic.com',OPENAI_API=a0_0x316650(0x235),COMPRESS_MAX_BYTES=0x4*0x400*0x400,MAX_PORT_RETRIES=0x5;function detectProvider(_0x2f646b,_0x2144fb){const _0x4363db=a0_0x316650,_0x500ea7=_0x2f646b||'';if(_0x500ea7[_0x4363db(0x236)](_0x4363db(0x21e)))return _0x4363db(0x23e);if(_0x500ea7[_0x4363db(0x236)](_0x4363db(0x240))||_0x500ea7[_0x4363db(0x236)](_0x4363db(0x22b))||_0x500ea7[_0x4363db(0x236)](_0x4363db(0x21c)))return _0x4363db(0x1e5);if(_0x2144fb[_0x4363db(0x226)]||_0x2144fb[_0x4363db(0x20d)])return _0x4363db(0x23e);if(_0x2144fb[_0x4363db(0x241)])return _0x4363db(0x1e5);return _0x4363db(0x23e);}function upstreamFor(_0x2f6c91){const _0x386d47=a0_0x316650;return _0x2f6c91===_0x386d47(0x1e5)?{'base':OPENAI_API,'host':_0x386d47(0x238)}:{'base':ANTHROPIC_API,'host':_0x386d47(0x20e)};}function isChatEndpoint(_0x376f0f,_0x294bf2){const _0x18377c=a0_0x316650;if(_0x376f0f!==_0x18377c(0x20b)||!_0x294bf2)return![];return _0x294bf2['startsWith'](_0x18377c(0x1ee))||_0x294bf2[_0x18377c(0x224)](_0x18377c(0x1e1))||_0x294bf2[_0x18377c(0x224)](_0x18377c(0x20c));}function serializeMessages(_0x1042d1){const _0x261712=a0_0x316650;try{return _0x1042d1[_0x261712(0x1f1)](_0x4e945d=>{const _0x1aa13e=_0x261712,_0x2983ea=typeof _0x4e945d[_0x1aa13e(0x218)]==='string'?_0x4e945d[_0x1aa13e(0x218)]:Array[_0x1aa13e(0x20a)](_0x4e945d[_0x1aa13e(0x218)])?_0x4e945d[_0x1aa13e(0x218)][_0x1aa13e(0x1f1)](_0x5f4e47=>_0x5f4e47&&_0x5f4e47['type']===_0x1aa13e(0x1f5)?_0x5f4e47[_0x1aa13e(0x1f5)]||'':'['+(_0x5f4e47&&_0x5f4e47['type']?_0x5f4e47[_0x1aa13e(0x23f)]:_0x1aa13e(0x232))+']')['join']('\x0a'):'';return String(_0x4e945d['role']||_0x1aa13e(0x213))['toUpperCase']()+':\x20'+_0x2983ea;})[_0x261712(0x22e)]('\x0a\x0a');}catch{return'';}}function isFeatureEnabled(_0x242953){const _0x5edbe8=a0_0x316650;try{const _0x333a23=tracker_1[_0x5edbe8(0x1fa)]['getConfig'](),_0x586bb9=_0x333a23[_0x5edbe8(0x1f3)];if(!_0x586bb9||_0x586bb9[_0x242953]===undefined)return!![];return _0x586bb9[_0x242953]!==![];}catch{return!![];}}function streamForward(_0x5aef01,_0x413e8f,_0x5632f7,_0x3554c7){const _0x37c64e=a0_0x316650;let _0x27585d;try{_0x27585d=new url_1['URL'](_0x413e8f);}catch{return!_0x3554c7[_0x37c64e(0x1e4)]&&(_0x3554c7['writeHead'](0x190,{'Content-Type':_0x37c64e(0x234)}),_0x3554c7['end'](JSON['stringify']({'error':{'type':_0x37c64e(0x204),'message':_0x37c64e(0x1e7)}}))),null;}const _0x549e57={'hostname':_0x27585d['hostname'],'port':_0x27585d[_0x37c64e(0x219)]||0x1bb,'path':_0x27585d[_0x37c64e(0x222)]+_0x27585d[_0x37c64e(0x1da)],'method':_0x5aef01,'headers':_0x5632f7,'timeout':0x1d4c0},_0x5cb88f=https['request'](_0x549e57,_0x292ced=>{const _0x36ce3d=_0x37c64e;try{_0x3554c7[_0x36ce3d(0x1dc)](_0x292ced['statusCode']||0x1f6,_0x292ced[_0x36ce3d(0x1f2)]),_0x292ced['pipe'](_0x3554c7);}catch{try{_0x3554c7['end']();}catch{}}});return _0x5cb88f['on']('error',_0x22d270=>{const _0x2f804e=_0x37c64e;if(!_0x3554c7[_0x2f804e(0x1e4)])_0x3554c7[_0x2f804e(0x1dc)](0x1f6,{'Content-Type':_0x2f804e(0x234)}),_0x3554c7[_0x2f804e(0x1ed)](JSON[_0x2f804e(0x23b)]({'error':{'type':'proxy_error','message':_0x22d270[_0x2f804e(0x211)]}}));else try{_0x3554c7[_0x2f804e(0x1ed)]();}catch{}}),_0x5cb88f['on'](_0x37c64e(0x1ff),()=>{const _0x2db8c3=_0x37c64e;_0x5cb88f[_0x2db8c3(0x228)](),!_0x3554c7[_0x2db8c3(0x1e4)]&&(_0x3554c7[_0x2db8c3(0x1dc)](0x1f8,{'Content-Type':_0x2db8c3(0x234)}),_0x3554c7[_0x2db8c3(0x1ed)](JSON['stringify']({'error':{'type':_0x2db8c3(0x1ff),'message':'Upstream\x20timeout'}})));}),_0x5cb88f;}function forwardRequest(_0x2a22a0,_0x269ea2,_0x387c8f,_0x18ce28,_0x172c6a){const _0x40fdfd=a0_0x316650,_0x935f18=streamForward(_0x2a22a0,_0x269ea2,_0x387c8f,_0x172c6a);if(!_0x935f18)return;_0x935f18['write'](_0x18ce28),_0x935f18[_0x40fdfd(0x1ed)]();}function processChatRequest(_0x4444e4,_0x148358,_0x2f430d,_0x1955f7,_0x4d842c,_0x561d38){const _0x36ce50=a0_0x316650,_0x361c57=_0x4d842c;try{const _0x4fa3fd=JSON[_0x36ce50(0x1e2)](_0x4d842c['toString'](_0x36ce50(0x1f9)));if(Array[_0x36ce50(0x20a)](_0x4fa3fd[_0x36ce50(0x221)])&&_0x4fa3fd[_0x36ce50(0x221)][_0x36ce50(0x1db)]>0x0){if(isFeatureEnabled(_0x36ce50(0x203)))try{const _0x4a4573=serializeMessages(_0x4fa3fd[_0x36ce50(0x221)]),_0x458005=(0x0,proxy_conv_1[_0x36ce50(0x242)])(_0x4fa3fd[_0x36ce50(0x221)]);if(_0x458005[_0x36ce50(0x1f8)]>0x0){const _0x1c093f=serializeMessages(_0x458005[_0x36ce50(0x221)]);_0x4fa3fd[_0x36ce50(0x221)]=_0x458005[_0x36ce50(0x221)];try{tracker_1[_0x36ce50(0x1fa)]['logExecution']('proxy:conv-compress',_0x4a4573,_0x1c093f,0x0,undefined,['conv_compress',_0x4444e4]);}catch{}}}catch{}if(isFeatureEnabled(_0x36ce50(0x1fc)))try{const _0x1322bb=_0x4fa3fd[_0x36ce50(0x1e8)]!==undefined?_0x36ce50(0x1e8):_0x36ce50(0x212),_0x306e06=(0x0,proxy_resp_1[_0x36ce50(0x207)])(_0x4fa3fd[_0x36ce50(0x221)],_0x4fa3fd[_0x1322bb]);if(_0x306e06){const _0x40ae45=_0x4fa3fd[_0x1322bb];_0x4fa3fd[_0x1322bb]=_0x306e06[_0x36ce50(0x212)];try{tracker_1[_0x36ce50(0x1fa)][_0x36ce50(0x1e3)](_0x36ce50(0x1fe),_0x1322bb+':'+(_0x40ae45||'unset'),_0x1322bb+':'+_0x306e06['max_tokens'],0x0,undefined,[_0x36ce50(0x1fc),_0x4444e4]);}catch{}}}catch{}try{const _0x18630c=Buffer[_0x36ce50(0x1ef)](JSON['stringify'](_0x4fa3fd),_0x36ce50(0x1f9));_0x1955f7['content-length']=String(_0x18630c['length']),forwardRequest(_0x148358,_0x2f430d,_0x1955f7,_0x18630c,_0x561d38);return;}catch{}}}catch{}forwardRequest(_0x148358,_0x2f430d,_0x1955f7,_0x361c57,_0x561d38);}function a0_0x2637(_0x4039b3,_0x53af40){_0x4039b3=_0x4039b3-0x1d8;const _0x32b4d8=a0_0x32b4();let _0x2637a1=_0x32b4d8[_0x4039b3];return _0x2637a1;}function startApiProxy(_0x56e783=0x1f90){let _0x557c94=0x0;function _0x28c500(_0x97797a){const _0x363d55=a0_0x2637,_0xd9a4db=http[_0x363d55(0x237)]((_0x1b9971,_0xdce487)=>{const _0x5cc366=_0x363d55,_0x34a1ba=detectProvider(_0x1b9971['url']||'',_0x1b9971['headers']),_0x28c762=upstreamFor(_0x34a1ba),_0x3f1134=''+_0x28c762['base']+_0x1b9971[_0x5cc366(0x202)],_0xc14f15=()=>{const _0x2d30a5=_0x5cc366,_0x2a7723={};for(const [_0x325c48,_0x1704a2]of Object['entries'](_0x1b9971['headers'])){if(_0x325c48[_0x2d30a5(0x1fb)]()===_0x2d30a5(0x1f7))_0x2a7723[_0x325c48]=_0x28c762['host'];else{if(typeof _0x1704a2===_0x2d30a5(0x231))_0x2a7723[_0x325c48]=_0x1704a2;}}return _0x2a7723;};let _0x42098d=0x0;const _0x400ace=[];let _0x3aeded=![],_0x4b0715=null;_0x1b9971['on'](_0x5cc366(0x1f0),_0x246adb=>{const _0x44f34b=_0x5cc366;if(_0x3aeded){if(_0x4b0715)try{_0x4b0715['write'](_0x246adb);}catch{}return;}_0x42098d+=_0x246adb[_0x44f34b(0x1db)],_0x400ace['push'](_0x246adb);if(_0x42098d>COMPRESS_MAX_BYTES){_0x3aeded=!![],_0x4b0715=streamForward(_0x1b9971[_0x44f34b(0x201)]||_0x44f34b(0x20b),_0x3f1134,_0xc14f15(),_0xdce487);if(_0x4b0715)for(const _0x52e23c of _0x400ace){try{_0x4b0715['write'](_0x52e23c);}catch{}}_0x400ace[_0x44f34b(0x1db)]=0x0;}}),_0x1b9971['on'](_0x5cc366(0x1ed),()=>{const _0x301672=_0x5cc366;if(_0x3aeded){if(_0x4b0715)try{_0x4b0715['end']();}catch{}return;}if(_0xdce487[_0x301672(0x1d8)])return;const _0x362005=Buffer[_0x301672(0x214)](_0x400ace),_0x2a7d8a=_0xc14f15();isChatEndpoint(_0x1b9971[_0x301672(0x201)],_0x1b9971['url'])?processChatRequest(_0x34a1ba,_0x1b9971['method'],_0x3f1134,_0x2a7d8a,_0x362005,_0xdce487):forwardRequest(_0x1b9971[_0x301672(0x201)]||_0x301672(0x21b),_0x3f1134,_0x2a7d8a,_0x362005,_0xdce487);}),_0x1b9971['on'](_0x5cc366(0x229),()=>{const _0x5dcc3e=_0x5cc366;!_0xdce487['headersSent']&&(_0xdce487[_0x5dcc3e(0x1dc)](0x190,{'Content-Type':_0x5dcc3e(0x234)}),_0xdce487[_0x5dcc3e(0x1ed)](JSON[_0x5dcc3e(0x23b)]({'error':{'type':_0x5dcc3e(0x210),'message':_0x5dcc3e(0x217)}})));});});_0xd9a4db['on'](_0x363d55(0x21f),()=>{const _0x27952f=_0x363d55;console[_0x27952f(0x1e9)]('\x0a[TrimPrompt]\x20API\x20proxy\x20running\x20on\x20http://127.0.0.1:'+_0x97797a+'\x20(Anthropic\x20+\x20OpenAI)'),console[_0x27952f(0x1e9)](_0x27952f(0x200)),console[_0x27952f(0x1e9)](_0x27952f(0x21a)+_0x97797a),console['log'](_0x27952f(0x22f)+_0x97797a+_0x27952f(0x227)),console['log'](_0x27952f(0x1f6)),console['log'](_0x27952f(0x23a)+(isFeatureEnabled(_0x27952f(0x203))?'ON':_0x27952f(0x21d))),console['log'](_0x27952f(0x246)+(isFeatureEnabled('resp_optimize')?'ON':_0x27952f(0x21d))),console[_0x27952f(0x1e9)](_0x27952f(0x1df));}),_0xd9a4db['on'](_0x363d55(0x229),_0x1d3764=>{const _0x537648=_0x363d55;_0x1d3764['code']===_0x537648(0x1dd)&&_0x557c94<MAX_PORT_RETRIES?(_0x557c94++,_0x28c500(_0x97797a+0x1)):(console[_0x537648(0x229)]('[TrimPrompt]\x20Proxy\x20failed\x20to\x20start:\x20'+_0x1d3764['message']),process[_0x537648(0x208)](0x1));}),_0xd9a4db[_0x363d55(0x1ea)](_0x97797a,'127.0.0.1');}_0x28c500(_0x56e783);}
|
|
1
|
+
'use strict';const a0_0x524dbb=a0_0xaad6;function a0_0xaad6(_0x5aca51,_0x465b12){const _0x36e2c2=a0_0x36e2();return a0_0xaad6=function(_0xaad65,_0x490699){_0xaad65=_0xaad65-0x155;let _0x57d1bf=_0x36e2c2[_0xaad65];return _0x57d1bf;},a0_0xaad6(_0x5aca51,_0x465b12);}function a0_0x36e2(){const _0x15c757=['stringify','\x20\x20ANTHROPIC_BASE_URL=http://127.0.0.1:','\x20\x20-\x20Response\x20optimization:\x20\x20\x20\x20','from','includes','[TrimPrompt]\x20Features:','entries','toLowerCase','end','utf8','\x20\x20OPENAI_BASE_URL=http://127.0.0.1:','compressConversation','https://api.anthropic.com','code','listening','proxy:resp-optimize','map','api.anthropic.com','37830YFjfZc','resp_optimize','exit','conv_compress','GET','tracker','api.openai.com','headers','method','./proxy-resp','242622KuGwNq','https','/completions','listen','127.0.0.1','openai','max_tokens','text','push','__createBinding','getOwnPropertyNames','10652058NftrXd','create','x-api-key','logExecution','base','parse','startApiProxy','block','default','log','proxy_error','writable','3088hMwuKB','Bad\x20target\x20URL','unset','invalid_url','/chat/completions','prototype','http','timeout','__setModuleDefault','messages','\x20(Anthropic\x20+\x20OpenAI)','hostname','\x0aPress\x20Ctrl+C\x20to\x20stop.\x0a','456940RmvxBi','1023799hrEdvl','/v1/messages','host','anthropic-version','length','error','Upstream\x20timeout','startsWith','url','get','/messages','authorization','type','defineProperty','unknown','OFF','533634OYfVxM','isArray','anthropic','toUpperCase','Bad\x20request','call','search','__esModule','string','max_completion_tokens','hasOwnProperty','writeHead','content','destroy','toString','510MeTJSF','16AbaOlT','/v1\x0a','createServer','\x20\x20-\x20Conversation\x20compression:\x20','request','headersSent','join','write','[TrimPrompt]\x20Set\x20in\x20your\x20environment:\x0a','getOwnPropertyDescriptor','proxy:conv-compress','application/json','./tracker','getConfig'];a0_0x36e2=function(){return _0x15c757;};return a0_0x36e2();}(function(_0x3f23ac,_0x4b0be0){const _0xe3ff44=a0_0xaad6,_0x2d7e72=_0x3f23ac();while(!![]){try{const _0x30df2b=-parseInt(_0xe3ff44(0x195))/0x1+parseInt(_0xe3ff44(0x184))/0x2+-parseInt(_0xe3ff44(0x1a4))/0x3*(parseInt(_0xe3ff44(0x177))/0x4)+-parseInt(_0xe3ff44(0x156))/0x5+-parseInt(_0xe3ff44(0x160))/0x6+-parseInt(_0xe3ff44(0x185))/0x7*(parseInt(_0xe3ff44(0x1a5))/0x8)+parseInt(_0xe3ff44(0x16b))/0x9;if(_0x30df2b===_0x4b0be0)break;else _0x2d7e72['push'](_0x2d7e72['shift']());}catch(_0x1075eb){_0x2d7e72['push'](_0x2d7e72['shift']());}}}(a0_0x36e2,0x63471));var __createBinding=this&&this[a0_0x524dbb(0x169)]||(Object[a0_0x524dbb(0x16c)]?function(_0x1aca1e,_0x22a196,_0x1c4b63,_0x10023a){const _0x2c383f=a0_0x524dbb;if(_0x10023a===undefined)_0x10023a=_0x1c4b63;var _0x3a26f3=Object[_0x2c383f(0x1ae)](_0x22a196,_0x1c4b63);(!_0x3a26f3||(_0x2c383f(0x18e)in _0x3a26f3?!_0x22a196[_0x2c383f(0x19c)]:_0x3a26f3[_0x2c383f(0x176)]||_0x3a26f3['configurable']))&&(_0x3a26f3={'enumerable':!![],'get':function(){return _0x22a196[_0x1c4b63];}}),Object[_0x2c383f(0x192)](_0x1aca1e,_0x10023a,_0x3a26f3);}:function(_0x2d93e1,_0xa79bbd,_0x375aa3,_0x9d79dd){if(_0x9d79dd===undefined)_0x9d79dd=_0x375aa3;_0x2d93e1[_0x9d79dd]=_0xa79bbd[_0x375aa3];}),__setModuleDefault=this&&this[a0_0x524dbb(0x17f)]||(Object[a0_0x524dbb(0x16c)]?function(_0x1035d3,_0x45e8ae){const _0x2c734a=a0_0x524dbb;Object[_0x2c734a(0x192)](_0x1035d3,_0x2c734a(0x173),{'enumerable':!![],'value':_0x45e8ae});}:function(_0x9e4cd5,_0x10422d){const _0x4b629e=a0_0x524dbb;_0x9e4cd5[_0x4b629e(0x173)]=_0x10422d;}),__importStar=this&&this['__importStar']||(function(){var _0x314419=function(_0x1a3d98){const _0x4d602c=a0_0xaad6;return _0x314419=Object[_0x4d602c(0x16a)]||function(_0x17daaa){const _0xb77431=_0x4d602c;var _0x30d904=[];for(var _0x21701e in _0x17daaa)if(Object[_0xb77431(0x17c)][_0xb77431(0x19f)][_0xb77431(0x19a)](_0x17daaa,_0x21701e))_0x30d904[_0x30d904['length']]=_0x21701e;return _0x30d904;},_0x314419(_0x1a3d98);};return function(_0x2ca2aa){const _0x62d56b=a0_0xaad6;if(_0x2ca2aa&&_0x2ca2aa[_0x62d56b(0x19c)])return _0x2ca2aa;var _0xa8d4af={};if(_0x2ca2aa!=null){for(var _0x4f2b21=_0x314419(_0x2ca2aa),_0x3d95c6=0x0;_0x3d95c6<_0x4f2b21[_0x62d56b(0x189)];_0x3d95c6++)if(_0x4f2b21[_0x3d95c6]!=='default')__createBinding(_0xa8d4af,_0x2ca2aa,_0x4f2b21[_0x3d95c6]);}return __setModuleDefault(_0xa8d4af,_0x2ca2aa),_0xa8d4af;};}());Object[a0_0x524dbb(0x192)](exports,'__esModule',{'value':!![]}),exports[a0_0x524dbb(0x171)]=startApiProxy;const http=__importStar(require(a0_0x524dbb(0x17d))),https=__importStar(require(a0_0x524dbb(0x161))),url_1=require(a0_0x524dbb(0x18d)),proxy_conv_1=require('./proxy-conv'),proxy_resp_1=require(a0_0x524dbb(0x15f)),tracker_1=require(a0_0x524dbb(0x1b1)),ANTHROPIC_API=a0_0x524dbb(0x1bf),OPENAI_API='https://api.openai.com',COMPRESS_MAX_BYTES=0x4*0x400*0x400,MAX_PORT_RETRIES=0x5;function detectProvider(_0x2983c8,_0x1130fc){const _0x45d264=a0_0x524dbb,_0x517646=_0x2983c8||'';if(_0x517646[_0x45d264(0x1b7)](_0x45d264(0x18f)))return _0x45d264(0x197);if(_0x517646[_0x45d264(0x1b7)](_0x45d264(0x17b))||_0x517646[_0x45d264(0x1b7)]('/responses')||_0x517646[_0x45d264(0x1b7)](_0x45d264(0x162)))return _0x45d264(0x165);if(_0x1130fc[_0x45d264(0x16d)]||_0x1130fc[_0x45d264(0x188)])return _0x45d264(0x197);if(_0x1130fc[_0x45d264(0x190)])return _0x45d264(0x165);return _0x45d264(0x197);}function upstreamFor(_0x2566b0){const _0x3f5aa0=a0_0x524dbb;return _0x2566b0===_0x3f5aa0(0x165)?{'base':OPENAI_API,'host':_0x3f5aa0(0x15c)}:{'base':ANTHROPIC_API,'host':_0x3f5aa0(0x155)};}function isChatEndpoint(_0x1fcc56,_0x2f1022){const _0x3ca69d=a0_0x524dbb;if(_0x1fcc56!=='POST'||!_0x2f1022)return![];return _0x2f1022['startsWith'](_0x3ca69d(0x186))||_0x2f1022[_0x3ca69d(0x18c)]('/v1/chat/completions')||_0x2f1022['startsWith']('/v1/responses');}function serializeMessages(_0x1a6887){const _0x1fdced=a0_0x524dbb;try{return _0x1a6887[_0x1fdced(0x1c3)](_0x11073b=>{const _0x2fe99f=_0x1fdced,_0x4beef3=typeof _0x11073b[_0x2fe99f(0x1a1)]===_0x2fe99f(0x19d)?_0x11073b[_0x2fe99f(0x1a1)]:Array[_0x2fe99f(0x196)](_0x11073b[_0x2fe99f(0x1a1)])?_0x11073b['content'][_0x2fe99f(0x1c3)](_0x1c6252=>_0x1c6252&&_0x1c6252[_0x2fe99f(0x191)]==='text'?_0x1c6252[_0x2fe99f(0x167)]||'':'['+(_0x1c6252&&_0x1c6252[_0x2fe99f(0x191)]?_0x1c6252['type']:_0x2fe99f(0x172))+']')[_0x2fe99f(0x1ab)]('\x0a'):'';return String(_0x11073b['role']||_0x2fe99f(0x193))[_0x2fe99f(0x198)]()+':\x20'+_0x4beef3;})[_0x1fdced(0x1ab)]('\x0a\x0a');}catch{return'';}}function isFeatureEnabled(_0x4cae63){const _0x23cf7f=a0_0x524dbb;try{const _0x2faf17=tracker_1['tracker'][_0x23cf7f(0x1b2)](),_0x1b981d=_0x2faf17['features_enabled'];if(!_0x1b981d||_0x1b981d[_0x4cae63]===undefined)return!![];return _0x1b981d[_0x4cae63]!==![];}catch{return!![];}}function streamForward(_0x5794c5,_0x49b33e,_0x4aafdc,_0x5017eb){const _0x7cc5f7=a0_0x524dbb;let _0xf6c33a;try{_0xf6c33a=new url_1['URL'](_0x49b33e);}catch{return!_0x5017eb[_0x7cc5f7(0x1aa)]&&(_0x5017eb[_0x7cc5f7(0x1a0)](0x190,{'Content-Type':_0x7cc5f7(0x1b0)}),_0x5017eb[_0x7cc5f7(0x1bb)](JSON[_0x7cc5f7(0x1b3)]({'error':{'type':_0x7cc5f7(0x17a),'message':_0x7cc5f7(0x178)}}))),null;}const _0x4d6c8e={'hostname':_0xf6c33a[_0x7cc5f7(0x182)],'port':_0xf6c33a['port']||0x1bb,'path':_0xf6c33a['pathname']+_0xf6c33a[_0x7cc5f7(0x19b)],'method':_0x5794c5,'headers':_0x4aafdc,'timeout':0x1d4c0},_0x351dbd=https[_0x7cc5f7(0x1a9)](_0x4d6c8e,_0x3cb663=>{const _0x1cbc14=_0x7cc5f7;try{_0x5017eb[_0x1cbc14(0x1a0)](_0x3cb663['statusCode']||0x1f6,_0x3cb663['headers']),_0x3cb663['pipe'](_0x5017eb);}catch{try{_0x5017eb[_0x1cbc14(0x1bb)]();}catch{}}});return _0x351dbd['on'](_0x7cc5f7(0x18a),_0x463590=>{const _0xb70fa=_0x7cc5f7;if(!_0x5017eb['headersSent'])_0x5017eb['writeHead'](0x1f6,{'Content-Type':_0xb70fa(0x1b0)}),_0x5017eb[_0xb70fa(0x1bb)](JSON[_0xb70fa(0x1b3)]({'error':{'type':_0xb70fa(0x175),'message':_0x463590['message']}}));else try{_0x5017eb[_0xb70fa(0x1bb)]();}catch{}}),_0x351dbd['on'](_0x7cc5f7(0x17e),()=>{const _0x50c630=_0x7cc5f7;_0x351dbd[_0x50c630(0x1a2)](),!_0x5017eb[_0x50c630(0x1aa)]&&(_0x5017eb[_0x50c630(0x1a0)](0x1f8,{'Content-Type':_0x50c630(0x1b0)}),_0x5017eb[_0x50c630(0x1bb)](JSON[_0x50c630(0x1b3)]({'error':{'type':_0x50c630(0x17e),'message':_0x50c630(0x18b)}})));}),_0x351dbd;}function forwardRequest(_0x2f6dec,_0x22523a,_0x227c75,_0x508347,_0x85a829){const _0x119ad8=a0_0x524dbb,_0x2dd0a9=streamForward(_0x2f6dec,_0x22523a,_0x227c75,_0x85a829);if(!_0x2dd0a9)return;_0x2dd0a9[_0x119ad8(0x1ac)](_0x508347),_0x2dd0a9[_0x119ad8(0x1bb)]();}function processChatRequest(_0x5df335,_0x4b3ba0,_0x4609fe,_0x341e77,_0x51e27f,_0x588347){const _0x5031bb=a0_0x524dbb,_0x22b9dc=_0x51e27f;try{const _0x573965=JSON[_0x5031bb(0x170)](_0x51e27f[_0x5031bb(0x1a3)](_0x5031bb(0x1bc)));if(Array[_0x5031bb(0x196)](_0x573965['messages'])&&_0x573965[_0x5031bb(0x180)][_0x5031bb(0x189)]>0x0){if(isFeatureEnabled(_0x5031bb(0x159)))try{const _0x5ad0ef=serializeMessages(_0x573965[_0x5031bb(0x180)]),_0x12acc8=(0x0,proxy_conv_1[_0x5031bb(0x1be)])(_0x573965[_0x5031bb(0x180)]);if(_0x12acc8['savedTokens']>0x0){const _0x360771=serializeMessages(_0x12acc8['messages']);_0x573965[_0x5031bb(0x180)]=_0x12acc8[_0x5031bb(0x180)];try{tracker_1[_0x5031bb(0x15b)]['logExecution'](_0x5031bb(0x1af),_0x5ad0ef,_0x360771,0x0,undefined,['conv_compress',_0x5df335]);}catch{}}}catch{}if(isFeatureEnabled(_0x5031bb(0x157)))try{const _0x4128a4=_0x573965[_0x5031bb(0x19e)]!==undefined?'max_completion_tokens':_0x5031bb(0x166),_0x5b73f8=(0x0,proxy_resp_1['optimizeMaxTokens'])(_0x573965[_0x5031bb(0x180)],_0x573965[_0x4128a4]);if(_0x5b73f8){const _0x39f525=_0x573965[_0x4128a4];_0x573965[_0x4128a4]=_0x5b73f8[_0x5031bb(0x166)];try{tracker_1[_0x5031bb(0x15b)][_0x5031bb(0x16e)](_0x5031bb(0x1c2),_0x4128a4+':'+(_0x39f525||_0x5031bb(0x179)),_0x4128a4+':'+_0x5b73f8[_0x5031bb(0x166)],0x0,undefined,[_0x5031bb(0x157),_0x5df335]);}catch{}}}catch{}try{const _0x17937b=Buffer[_0x5031bb(0x1b6)](JSON['stringify'](_0x573965),_0x5031bb(0x1bc));_0x341e77['content-length']=String(_0x17937b[_0x5031bb(0x189)]),forwardRequest(_0x4b3ba0,_0x4609fe,_0x341e77,_0x17937b,_0x588347);return;}catch{}}}catch{}forwardRequest(_0x4b3ba0,_0x4609fe,_0x341e77,_0x22b9dc,_0x588347);}function startApiProxy(_0x2ac127=0x1f90){let _0x9959e3=0x0;function _0x1ba1e4(_0x256f01){const _0x251d8=a0_0xaad6,_0x40b755=http[_0x251d8(0x1a7)]((_0x4e6737,_0x39df10)=>{const _0x2f21ef=_0x251d8,_0x21f632=detectProvider(_0x4e6737[_0x2f21ef(0x18d)]||'',_0x4e6737[_0x2f21ef(0x15d)]),_0x66f1a7=upstreamFor(_0x21f632),_0x23aae9=''+_0x66f1a7[_0x2f21ef(0x16f)]+_0x4e6737[_0x2f21ef(0x18d)],_0x114f76=()=>{const _0x279d2b=_0x2f21ef,_0x1d46cb={};for(const [_0x4be7f0,_0x13d2b2]of Object[_0x279d2b(0x1b9)](_0x4e6737['headers'])){if(_0x4be7f0[_0x279d2b(0x1ba)]()===_0x279d2b(0x187))_0x1d46cb[_0x4be7f0]=_0x66f1a7[_0x279d2b(0x187)];else{if(typeof _0x13d2b2===_0x279d2b(0x19d))_0x1d46cb[_0x4be7f0]=_0x13d2b2;}}return _0x1d46cb;};let _0x1c3bc0=0x0;const _0x5d9e6f=[];let _0x4657d8=![],_0x451624=null;_0x4e6737['on']('data',_0x5ca5af=>{const _0x3ea19f=_0x2f21ef;if(_0x4657d8){if(_0x451624)try{_0x451624['write'](_0x5ca5af);}catch{}return;}_0x1c3bc0+=_0x5ca5af[_0x3ea19f(0x189)],_0x5d9e6f[_0x3ea19f(0x168)](_0x5ca5af);if(_0x1c3bc0>COMPRESS_MAX_BYTES){_0x4657d8=!![],_0x451624=streamForward(_0x4e6737['method']||'POST',_0x23aae9,_0x114f76(),_0x39df10);if(_0x451624)for(const _0x2fe22f of _0x5d9e6f){try{_0x451624[_0x3ea19f(0x1ac)](_0x2fe22f);}catch{}}_0x5d9e6f['length']=0x0;}}),_0x4e6737['on'](_0x2f21ef(0x1bb),()=>{const _0x1ad385=_0x2f21ef;if(_0x4657d8){if(_0x451624)try{_0x451624['end']();}catch{}return;}if(_0x39df10['writableEnded'])return;const _0x5869ad=Buffer['concat'](_0x5d9e6f),_0x10213b=_0x114f76();isChatEndpoint(_0x4e6737[_0x1ad385(0x15e)],_0x4e6737[_0x1ad385(0x18d)])?processChatRequest(_0x21f632,_0x4e6737[_0x1ad385(0x15e)],_0x23aae9,_0x10213b,_0x5869ad,_0x39df10):forwardRequest(_0x4e6737['method']||_0x1ad385(0x15a),_0x23aae9,_0x10213b,_0x5869ad,_0x39df10);}),_0x4e6737['on'](_0x2f21ef(0x18a),()=>{const _0xbdc97f=_0x2f21ef;!_0x39df10[_0xbdc97f(0x1aa)]&&(_0x39df10['writeHead'](0x190,{'Content-Type':_0xbdc97f(0x1b0)}),_0x39df10['end'](JSON[_0xbdc97f(0x1b3)]({'error':{'type':'request_error','message':_0xbdc97f(0x199)}})));});});_0x40b755['on'](_0x251d8(0x1c1),()=>{const _0x48313d=_0x251d8;console[_0x48313d(0x174)]('\x0a[TrimPrompt]\x20API\x20proxy\x20running\x20on\x20http://127.0.0.1:'+_0x256f01+_0x48313d(0x181)),console[_0x48313d(0x174)](_0x48313d(0x1ad)),console['log'](_0x48313d(0x1b4)+_0x256f01),console[_0x48313d(0x174)](_0x48313d(0x1bd)+_0x256f01+_0x48313d(0x1a6)),console['log'](_0x48313d(0x1b8)),console[_0x48313d(0x174)](_0x48313d(0x1a8)+(isFeatureEnabled(_0x48313d(0x159))?'ON':_0x48313d(0x194))),console['log'](_0x48313d(0x1b5)+(isFeatureEnabled(_0x48313d(0x157))?'ON':'OFF')),console[_0x48313d(0x174)](_0x48313d(0x183));}),_0x40b755['on'](_0x251d8(0x18a),_0x1aeaf7=>{const _0x5d31a5=_0x251d8;_0x1aeaf7[_0x5d31a5(0x1c0)]==='EADDRINUSE'&&_0x9959e3<MAX_PORT_RETRIES?(_0x9959e3++,_0x1ba1e4(_0x256f01+0x1)):(console[_0x5d31a5(0x18a)]('[TrimPrompt]\x20Proxy\x20failed\x20to\x20start:\x20'+_0x1aeaf7['message']),process[_0x5d31a5(0x158)](0x1));}),_0x40b755[_0x251d8(0x163)](_0x256f01,_0x251d8(0x164));}_0x1ba1e4(_0x2ac127);}
|
package/cache-manager.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';const a0_0x191a6c=a0_0x2340;function a0_0x2340(_0x4f0a29,_0x3c5205){const _0x14636b=a0_0x1463();return a0_0x2340=function(_0x2340c7,_0x222277){_0x2340c7=_0x2340c7-0x7b;let _0x434bfc=_0x14636b[_0x2340c7];return _0x434bfc;},a0_0x2340(_0x4f0a29,_0x3c5205);}(function(_0x5c0157,_0x575424){const _0x144152=a0_0x2340,_0x5db62e=_0x5c0157();while(!![]){try{const _0x3af050=-parseInt(_0x144152(0x8e))/0x1+-parseInt(_0x144152(0x83))/0x2*(-parseInt(_0x144152(0x98))/0x3)+-parseInt(_0x144152(0x90))/0x4*(parseInt(_0x144152(0x81))/0x5)+-parseInt(_0x144152(0x86))/0x6*(parseInt(_0x144152(0xa6))/0x7)+parseInt(_0x144152(0x92))/0x8*(-parseInt(_0x144152(0x89))/0x9)+-parseInt(_0x144152(0x95))/0xa*(-parseInt(_0x144152(0xb4))/0xb)+parseInt(_0x144152(0xa8))/0xc;if(_0x3af050===_0x575424)break;else _0x5db62e['push'](_0x5db62e['shift']());}catch(_0x265ada){_0x5db62e['push'](_0x5db62e['shift']());}}}(a0_0x1463,0x5b016));var __createBinding=this&&this[a0_0x191a6c(0xac)]||(Object[a0_0x191a6c(0x8f)]?function(_0x5a1da4,_0x4e5999,_0x2a98a8,_0x2a8b3a){const _0x2a594f=a0_0x191a6c;if(_0x2a8b3a===undefined)_0x2a8b3a=_0x2a98a8;var _0x76952d=Object[_0x2a594f(0x9e)](_0x4e5999,_0x2a98a8);(!_0x76952d||('get'in _0x76952d?!_0x4e5999[_0x2a594f(0x82)]:_0x76952d[_0x2a594f(0xa1)]||_0x76952d[_0x2a594f(0xae)]))&&(_0x76952d={'enumerable':!![],'get':function(){return _0x4e5999[_0x2a98a8];}}),Object[_0x2a594f(0x80)](_0x5a1da4,_0x2a8b3a,_0x76952d);}:function(_0x214d71,_0x168cf8,_0x486923,_0x31064e){if(_0x31064e===undefined)_0x31064e=_0x486923;_0x214d71[_0x31064e]=_0x168cf8[_0x486923];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a0_0x191a6c(0x8f)]?function(_0x30797e,_0x394b20){Object['defineProperty'](_0x30797e,'default',{'enumerable':!![],'value':_0x394b20});}:function(_0x19f5dd,_0x3a06b0){const _0xb764ae=a0_0x191a6c;_0x19f5dd[_0xb764ae(0x9c)]=_0x3a06b0;}),__importStar=this&&this[a0_0x191a6c(0xaf)]||(function(){var _0x22187e=function(_0x242e2d){return _0x22187e=Object['getOwnPropertyNames']||function(_0x35c992){const _0x208187=a0_0x2340;var _0x32ef81=[];for(var _0x5cc3c3 in _0x35c992)if(Object[_0x208187(0x93)][_0x208187(0xad)][_0x208187(0xb0)](_0x35c992,_0x5cc3c3))_0x32ef81[_0x32ef81['length']]=_0x5cc3c3;return _0x32ef81;},_0x22187e(_0x242e2d);};return function(_0x5b2c0d){const _0x37a328=a0_0x2340;if(_0x5b2c0d&&_0x5b2c0d[_0x37a328(0x82)])return _0x5b2c0d;var _0x855f36={};if(_0x5b2c0d!=null){for(var _0x4d4cd6=_0x22187e(_0x5b2c0d),_0x430c2b=0x0;_0x430c2b<_0x4d4cd6[_0x37a328(0xb3)];_0x430c2b++)if(_0x4d4cd6[_0x430c2b]!==_0x37a328(0x9c))__createBinding(_0x855f36,_0x5b2c0d,_0x4d4cd6[_0x430c2b]);}return __setModuleDefault(_0x855f36,_0x5b2c0d),_0x855f36;};}());Object['defineProperty'](exports,a0_0x191a6c(0x82),{'value':!![]}),exports['saveChunk']=saveChunk,exports[a0_0x191a6c(0xa0)]=retrieveChunk,exports['enforceEvictionPolicy']=enforceEvictionPolicy;const fs=__importStar(require('fs')),path=__importStar(require(a0_0x191a6c(0x88))),os=__importStar(require('os')),crypto=__importStar(require(a0_0x191a6c(0x8d))),baseDir=path[a0_0x191a6c(0x7d)](os[a0_0x191a6c(0xa3)](),a0_0x191a6c(0x8a)),cacheDir=path[a0_0x191a6c(0x7d)](baseDir,'cache'),MAX_CACHE_BYTES=0x1f4*0x400*0x400,TTL_MS=0xe*0x18*0x3c*0x3c*0x3e8;function ensureCacheDir(){const _0x41c95a=a0_0x191a6c;!fs['existsSync'](cacheDir)&&fs[_0x41c95a(0x9a)](cacheDir,{'recursive':!![]});}function saveChunk(_0x3230dd,_0x2bfc86,_0x3d6753,_0x11f09c){const _0x3fd0a8=a0_0x191a6c;ensureCacheDir();const _0x335707=crypto[_0x3fd0a8(0xa4)](_0x3fd0a8(0xab))[_0x3fd0a8(0x9d)](_0x3d6753)[_0x3fd0a8(0x91)](_0x3fd0a8(0x99))[_0x3fd0a8(0x9f)](0x0,0x8),_0x31e26e=_0x3fd0a8(0x84)+_0x335707,_0x393319=path[_0x3fd0a8(0x7d)](cacheDir,_0x3230dd);!fs[_0x3fd0a8(0xb1)](_0x393319)&&fs[_0x3fd0a8(0x9a)](_0x393319,{'recursive':!![]});const _0x1558c5=path['join'](_0x393319,_0x31e26e+_0x3fd0a8(0x7f)),_0x10b9fe=new Date()['toISOString'](),_0x3c2478=Math['ceil'](_0x3d6753[_0x3fd0a8(0xb3)]/0x4),_0x5c7d73=Math[_0x3fd0a8(0x96)](_0x11f09c[_0x3fd0a8(0xb3)]/0x4),_0xebcd60={'chunk_id':_0x31e26e,'session_id':_0x3230dd,'agent_key':_0x2bfc86,'raw_tokens':_0x3c2478,'compressed_tokens':_0x5c7d73,'created_at':_0x10b9fe,'last_accessed_at':_0x10b9fe,'summary':_0x11f09c,'raw_payload':_0x3d6753};return fs[_0x3fd0a8(0xaa)](_0x1558c5,JSON['stringify'](_0xebcd60,null,0x2),_0x3fd0a8(0x87)),enforceEvictionPolicy(),_0xebcd60;}function retrieveChunk(_0xca4fd8){const _0x45eed7=a0_0x191a6c;ensureCacheDir();try{const _0x37a8e6=fs[_0x45eed7(0xa2)](cacheDir);for(const _0x345c1d of _0x37a8e6){const _0x259c3c=path[_0x45eed7(0x7d)](cacheDir,_0x345c1d);if(fs[_0x45eed7(0x8b)](_0x259c3c)[_0x45eed7(0x85)]()){const _0x36bf1d=path[_0x45eed7(0x7d)](_0x259c3c,_0xca4fd8+_0x45eed7(0x7f));if(fs[_0x45eed7(0xb1)](_0x36bf1d)){const _0x23caf1=fs[_0x45eed7(0x7e)](_0x36bf1d,_0x45eed7(0x87)),_0x488df3=JSON[_0x45eed7(0x9b)](_0x23caf1);return _0x488df3[_0x45eed7(0xb2)]=new Date()['toISOString'](),fs[_0x45eed7(0xaa)](_0x36bf1d,JSON[_0x45eed7(0x94)](_0x488df3,null,0x2),_0x45eed7(0x87)),_0x488df3;}}}}catch{}return null;}function a0_0x1463(){const _0x587463=['push','5801304CQkIXG','lastAccessed','writeFileSync','sha256','__createBinding','hasOwnProperty','configurable','__importStar','call','existsSync','last_accessed_at','length','5175643gbtSJt','birthtime','getTime','join','readFileSync','.json','defineProperty','5085tCMCAh','__esModule','6UikyLK','tp_chk_','isDirectory','6OKeCLY','utf8','path','24228eOIKmU','.trimprompt','statSync','endsWith','crypto','736382sWzaDN','create','296CKEWNy','digest','432MtoWfy','prototype','stringify','10AkWknr','ceil','size','503817iAMqEV','hex','mkdirSync','parse','default','update','getOwnPropertyDescriptor','substring','retrieveChunk','writable','readdirSync','homedir','createHash','sort','896042HrMSSc'];a0_0x1463=function(){return _0x587463;};return a0_0x1463();}function enforceEvictionPolicy(){const _0x4e3cbf=a0_0x191a6c;ensureCacheDir();try{const _0x25bedc=Date['now']();let _0x1b211b=0x0;const _0x50021a=[],_0xa90343=fs[_0x4e3cbf(0xa2)](cacheDir);for(const _0x1f0da0 of _0xa90343){const _0x3af10b=path[_0x4e3cbf(0x7d)](cacheDir,_0x1f0da0);if(fs[_0x4e3cbf(0x8b)](_0x3af10b)[_0x4e3cbf(0x85)]()){const _0x1edde1=fs[_0x4e3cbf(0xa2)](_0x3af10b);for(const _0x4c57d7 of _0x1edde1){if(_0x4c57d7[_0x4e3cbf(0x8c)](_0x4e3cbf(0x7f))){const _0x356a9a=path['join'](_0x3af10b,_0x4c57d7),_0x2215df=fs[_0x4e3cbf(0x8b)](_0x356a9a);try{const _0x39e27a=JSON[_0x4e3cbf(0x9b)](fs[_0x4e3cbf(0x7e)](_0x356a9a,'utf8')),_0x885a28=new Date(_0x39e27a['created_at']||_0x2215df[_0x4e3cbf(0x7b)])[_0x4e3cbf(0x7c)](),_0xdf0fea=new Date(_0x39e27a['last_accessed_at']||_0x2215df['mtime'])['getTime']();if(_0x25bedc-_0x885a28>TTL_MS){fs['unlinkSync'](_0x356a9a);continue;}_0x1b211b+=_0x2215df[_0x4e3cbf(0x97)],_0x50021a[_0x4e3cbf(0xa7)]({'path':_0x356a9a,'size':_0x2215df[_0x4e3cbf(0x97)],'lastAccessed':_0xdf0fea,'createdAt':_0x885a28});}catch{fs['unlinkSync'](_0x356a9a);}}}}}if(_0x1b211b>MAX_CACHE_BYTES){_0x50021a[_0x4e3cbf(0xa5)]((_0x4f9277,_0x15b738)=>_0x4f9277[_0x4e3cbf(0xa9)]-_0x15b738[_0x4e3cbf(0xa9)]);for(const _0x2fa885 of _0x50021a){if(_0x1b211b<=MAX_CACHE_BYTES*0.8)break;try{fs['unlinkSync'](_0x2fa885['path']),_0x1b211b-=_0x2fa885[_0x4e3cbf(0x97)];}catch{}}}}catch{}}
|
package/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';const a0_0x49aae9=a0_0x3d6e;function a0_0x3d6e(_0x418457,_0x136e06){const _0x48be1e=a0_0x48be();return a0_0x3d6e=function(_0x3d6e80,_0x1097e3){_0x3d6e80=_0x3d6e80-0x6f;let _0x7317d7=_0x48be1e[_0x3d6e80];return _0x7317d7;},a0_0x3d6e(_0x418457,_0x136e06);}(function(_0x49c8d4,_0x4373ea){const _0x143d39=a0_0x3d6e,_0x30653a=_0x49c8d4();while(!![]){try{const _0x3a33b7=-parseInt(_0x143d39(0x92))/0x1+-parseInt(_0x143d39(0x70))/0x2+parseInt(_0x143d39(0x9e))/0x3*(parseInt(_0x143d39(0xad))/0x4)+-parseInt(_0x143d39(0x7c))/0x5+parseInt(_0x143d39(0x9a))/0x6*(-parseInt(_0x143d39(0x7a))/0x7)+-parseInt(_0x143d39(0xb3))/0x8*(parseInt(_0x143d39(0x84))/0x9)+-parseInt(_0x143d39(0x8c))/0xa*(-parseInt(_0x143d39(0x77))/0xb);if(_0x3a33b7===_0x4373ea)break;else _0x30653a['push'](_0x30653a['shift']());}catch(_0x59700a){_0x30653a['push'](_0x30653a['shift']());}}}(a0_0x48be,0x87727));var __createBinding=this&&this['__createBinding']||(Object[a0_0x49aae9(0x8a)]?function(_0x2df7ea,_0x119058,_0x2898a0,_0xef78b1){const _0x10d705=a0_0x49aae9;if(_0xef78b1===undefined)_0xef78b1=_0x2898a0;var _0x125229=Object['getOwnPropertyDescriptor'](_0x119058,_0x2898a0);(!_0x125229||(_0x10d705(0xa4)in _0x125229?!_0x119058[_0x10d705(0x98)]:_0x125229[_0x10d705(0x97)]||_0x125229['configurable']))&&(_0x125229={'enumerable':!![],'get':function(){return _0x119058[_0x2898a0];}}),Object[_0x10d705(0x9f)](_0x2df7ea,_0xef78b1,_0x125229);}:function(_0x7f0743,_0x1f0907,_0x527f75,_0x6c5517){if(_0x6c5517===undefined)_0x6c5517=_0x527f75;_0x7f0743[_0x6c5517]=_0x1f0907[_0x527f75];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a0_0x49aae9(0x8a)]?function(_0x37b875,_0x313e6a){const _0x3bc83e=a0_0x49aae9;Object['defineProperty'](_0x37b875,_0x3bc83e(0xab),{'enumerable':!![],'value':_0x313e6a});}:function(_0x3883cb,_0x57cb87){const _0xcfe953=a0_0x49aae9;_0x3883cb[_0xcfe953(0xab)]=_0x57cb87;}),__importStar=this&&this['__importStar']||(function(){var _0x369f57=function(_0xbabccf){return _0x369f57=Object['getOwnPropertyNames']||function(_0xbed62b){const _0x50a5ae=a0_0x3d6e;var _0x1311c5=[];for(var _0x5e4b0d in _0xbed62b)if(Object['prototype']['hasOwnProperty'][_0x50a5ae(0xa7)](_0xbed62b,_0x5e4b0d))_0x1311c5[_0x1311c5[_0x50a5ae(0xa0)]]=_0x5e4b0d;return _0x1311c5;},_0x369f57(_0xbabccf);};return function(_0x2236c4){const _0x40048f=a0_0x3d6e;if(_0x2236c4&&_0x2236c4[_0x40048f(0x98)])return _0x2236c4;var _0x1585e1={};if(_0x2236c4!=null){for(var _0x101eab=_0x369f57(_0x2236c4),_0x5d26aa=0x0;_0x5d26aa<_0x101eab[_0x40048f(0xa0)];_0x5d26aa++)if(_0x101eab[_0x5d26aa]!==_0x40048f(0xab))__createBinding(_0x1585e1,_0x2236c4,_0x101eab[_0x5d26aa]);}return __setModuleDefault(_0x1585e1,_0x2236c4),_0x1585e1;};}());Object[a0_0x49aae9(0x9f)](exports,a0_0x49aae9(0x98),{'value':!![]}),exports[a0_0x49aae9(0x94)]=dedup;const fs=__importStar(require('fs')),path=__importStar(require('path')),os=__importStar(require('os')),crypto=__importStar(require(a0_0x49aae9(0x7f))),CACHE_DIR=path['join'](os[a0_0x49aae9(0x6f)](),a0_0x49aae9(0x95)),CACHE_FILE=path['join'](CACHE_DIR,a0_0x49aae9(0xa5)),MAX_ENTRIES=0x12c,TTL_SECONDS={'file':0x78,'git-status':0x1e,'git-log':0x3c,'git-show':0xe10,'ls':0x3c,'tree':0x3c,'docker-ps':0x1e,'docker-images':0x3c,'kubectl':0x1e,'ruff':0x3c,'go-vet':0x3c};function classifyCommand(_0xb47cd1){const _0x49454b=a0_0x49aae9,_0x47b3b3=_0xb47cd1[_0x49454b(0x85)]()[_0x49454b(0x90)]();if(_0x47b3b3[_0x49454b(0x71)](/^(cat|head|tail|read|bat)\s/))return'file';if(_0x47b3b3[_0x49454b(0x9c)]('git\x20status')||_0x47b3b3[_0x49454b(0x9c)](_0x49454b(0x7d)))return _0x49454b(0x83);if(_0x47b3b3[_0x49454b(0x9c)](_0x49454b(0x81))||_0x47b3b3['includes'](_0x49454b(0xa6)))return _0x49454b(0x82);if(_0x47b3b3[_0x49454b(0x9c)](_0x49454b(0x89))||_0x47b3b3[_0x49454b(0x9c)](_0x49454b(0x73)))return _0x49454b(0x8b);if(_0x47b3b3[_0x49454b(0x71)](/^(ls|dir)(\s|$)/)||_0x47b3b3[_0x49454b(0x9c)](_0x49454b(0x96))||_0x47b3b3[_0x49454b(0x8d)](_0x49454b(0xa1)))return'ls';if(_0x47b3b3['match'](/^tree(\s|$)/)||_0x47b3b3['includes'](_0x49454b(0x74))||_0x47b3b3['endsWith']('\x20tree'))return'tree';if(_0x47b3b3[_0x49454b(0x71)](/docker\s+ps/))return _0x49454b(0xb4);if(_0x47b3b3[_0x49454b(0x71)](/docker\s+images/))return'docker-images';if(_0x47b3b3[_0x49454b(0x9c)]('kubectl\x20get')||_0x47b3b3['includes']('kubectl\x20describe'))return _0x49454b(0xa3);if(_0x47b3b3[_0x49454b(0x9c)]('ruff\x20check')||_0x47b3b3[_0x49454b(0x9c)](_0x49454b(0x88)))return'ruff';if(_0x47b3b3['includes']('go\x20vet'))return _0x49454b(0x7e);return'';}function a0_0x48be(){const _0x480439=['sort','2165072BdQOvR','slice','utf8','docker','hex','createHash','2680vTYoav','docker-ps','homedir','381602ACWEvd','match','\x20lines','yadm\x20show','\x20tree\x20','writeFileSync','stringify','11CeDogR','timestamp','update','7qUCPTY','s\x20ago,\x20','4764315GzBnDw','yadm\x20status','go-vet','crypto','hash','git\x20log','git-log','git-status','5706dGtVeC','trim','now','\x20entries','ruff\x20','git\x20show','create','git-show','33245180gVQNEc','endsWith','\x20chars','digest','toLowerCase','cwd','915590RAQXWw','summary','dedup','.trimprompt','\x20ls\x20','writable','__esModule','md5','6236106MMXWUy','\x20lines,\x20','includes','existsSync','3hchDgl','defineProperty','length','\x20ls','file','kubectl','get','cache.json','yadm\x20log','call','parse','readFileSync','mkdirSync','default'];a0_0x48be=function(){return _0x480439;};return a0_0x48be();}function md5(_0x34fb39){const _0x2580fd=a0_0x49aae9;return crypto[_0x2580fd(0xb2)](_0x2580fd(0x99))[_0x2580fd(0x79)](_0x34fb39)[_0x2580fd(0x8f)](_0x2580fd(0xb1));}function loadStore(){const _0x3d5581=a0_0x49aae9;try{if(fs['existsSync'](CACHE_FILE))return JSON[_0x3d5581(0xa8)](fs[_0x3d5581(0xa9)](CACHE_FILE,_0x3d5581(0xaf)));}catch{}return{};}function saveStore(_0x57a742){const _0x5f59ce=a0_0x49aae9;try{if(!fs[_0x5f59ce(0x9d)](CACHE_DIR))fs[_0x5f59ce(0xaa)](CACHE_DIR,{'recursive':!![]});const _0x5d5f60=Object['keys'](_0x57a742);if(_0x5d5f60[_0x5f59ce(0xa0)]>MAX_ENTRIES){const _0x463715=_0x5d5f60[_0x5f59ce(0xac)]((_0x50c3b6,_0x53e283)=>_0x57a742[_0x50c3b6][_0x5f59ce(0x78)]-_0x57a742[_0x53e283]['timestamp']);for(const _0x16f8c5 of _0x463715[_0x5f59ce(0xae)](0x0,_0x5d5f60[_0x5f59ce(0xa0)]-MAX_ENTRIES)){delete _0x57a742[_0x16f8c5];}}fs[_0x5f59ce(0x75)](CACHE_FILE,JSON[_0x5f59ce(0x76)](_0x57a742),'utf8');}catch{}}function buildSummary(_0x3b4407,_0x2cc0bd){const _0x14f7ec=a0_0x49aae9,_0x1d8e7e=_0x3b4407['split']('\x0a')[_0x14f7ec(0xa0)],_0x5bd469=_0x3b4407[_0x14f7ec(0xa0)];if(_0x2cc0bd===_0x14f7ec(0xa2))return _0x1d8e7e+'\x20lines,\x20'+_0x5bd469+_0x14f7ec(0x8e);if(_0x2cc0bd===_0x14f7ec(0x83))return _0x1d8e7e+_0x14f7ec(0x72);if(_0x2cc0bd===_0x14f7ec(0x82))return _0x1d8e7e+_0x14f7ec(0x87);if(_0x2cc0bd['startsWith'](_0x14f7ec(0xb0)))return _0x1d8e7e+_0x14f7ec(0x72);return _0x1d8e7e+_0x14f7ec(0x9b)+_0x5bd469+_0x14f7ec(0x8e);}function dedup(_0x133a9e,_0x9249a){const _0x5a561f=a0_0x49aae9;try{const _0x2ab229=classifyCommand(_0x133a9e);if(!_0x2ab229)return null;const _0x1ce5f2=TTL_SECONDS[_0x2ab229];if(!_0x1ce5f2)return null;const _0x4d394c=process[_0x5a561f(0x91)](),_0xdeda46=md5(_0x4d394c+'::'+_0x133a9e['trim']()),_0x4c88b2=md5(_0x9249a),_0x2cfba0=Date[_0x5a561f(0x86)](),_0x2838d5=loadStore(),_0x15f11b=_0x2838d5[_0xdeda46];if(_0x15f11b&&_0x15f11b[_0x5a561f(0x80)]===_0x4c88b2&&_0x2cfba0-_0x15f11b[_0x5a561f(0x78)]<_0x1ce5f2*0x3e8){const _0x276135=Math['round']((_0x2cfba0-_0x15f11b[_0x5a561f(0x78)])/0x3e8);return'[cached\x20โ\x20unchanged\x20since\x20'+_0x276135+_0x5a561f(0x7b)+_0x15f11b[_0x5a561f(0x93)]+']';}_0x2838d5[_0xdeda46]={'hash':_0x4c88b2,'summary':buildSummary(_0x9249a,_0x2ab229),'timestamp':_0x2cfba0,'chars':_0x9249a[_0x5a561f(0xa0)]},saveStore(_0x2838d5);}catch{}return null;}
|
package/ccr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0_0x47cc5e=a0_0x450b;function a0_0x450b(_0x474889,_0x47d5ca){const _0x47d77c=a0_0x47d7();return a0_0x450b=function(_0x450bf6,_0x58a857){_0x450bf6=_0x450bf6-0x8f;let _0x2d7685=_0x47d77c[_0x450bf6];return _0x2d7685;},a0_0x450b(_0x474889,_0x47d5ca);}(function(_0x2f43f8,_0x132ba1){const _0x57505b=a0_0x450b,_0x4fa448=_0x2f43f8();while(!![]){try{const _0x974fd6=parseInt(_0x57505b(0xa5))/0x1*(-parseInt(_0x57505b(0xb8))/0x2)+parseInt(_0x57505b(0xc7))/0x3*(parseInt(_0x57505b(0xc5))/0x4)+-parseInt(_0x57505b(0xd9))/0x5*(-parseInt(_0x57505b(0xcd))/0x6)+-parseInt(_0x57505b(0xc2))/0x7*(parseInt(_0x57505b(0xb5))/0x8)+parseInt(_0x57505b(0xd2))/0x9+-parseInt(_0x57505b(0xc9))/0xa+parseInt(_0x57505b(0xbe))/0xb;if(_0x974fd6===_0x132ba1)break;else _0x4fa448['push'](_0x4fa448['shift']());}catch(_0x193095){_0x4fa448['push'](_0x4fa448['shift']());}}}(a0_0x47d7,0x3c48f));function a0_0x47d7(){const _0x1612ee=['digest','configurable','call','tp_','getOwnPropertyDescriptor','.trimprompt','135sfZXHg','defineProperty','#\x20...\x20[collapsed]','skeletonize','includes','length','startsWith','prototype','trimStart','homedir','.rs','join','hex','__setModuleDefault','match','.go','252752bqPxAq','__esModule','getOwnPropertyNames','2250lKgvcR','writable','endsWith','get','pub','.ts','5876959iFHhlV','pop','.jsx','export','70bQcXvJ','\x0a...\x20[','update','4wVCBsW','\x27\x27\x27','519693MoEkaC','var','1737240ZYfoWm','.js','slice','writeFileSync','6oKGszG','utf8','crypto','substring','\x22\x22\x22','1161963omFnbq','.txt','def\x20','function','import\x20','replace','const','259295bjRHqZ','ccr','trim','create','[TrimPrompt:\x20CCR\x20Active.\x20Body\x20of\x20functions\x20collapsed\x20to\x20save\x20tokens.\x20Hash:\x20','runCcr','from\x20','existsSync','class','push','mkdirSync','default','toLowerCase','.java','split','__importStar','interface'];a0_0x47d7=function(){return _0x1612ee;};return a0_0x47d7();}var __createBinding=this&&this['__createBinding']||(Object[a0_0x47cc5e(0x91)]?function(_0xc25226,_0x3380d3,_0x153c90,_0x8094d8){const _0x2a315c=a0_0x47cc5e;if(_0x8094d8===undefined)_0x8094d8=_0x153c90;var _0x515900=Object[_0x2a315c(0xa3)](_0x3380d3,_0x153c90);(!_0x515900||(_0x2a315c(0xbb)in _0x515900?!_0x3380d3[_0x2a315c(0xb6)]:_0x515900[_0x2a315c(0xb9)]||_0x515900[_0x2a315c(0xa0)]))&&(_0x515900={'enumerable':!![],'get':function(){return _0x3380d3[_0x153c90];}}),Object['defineProperty'](_0xc25226,_0x8094d8,_0x515900);}:function(_0x229f10,_0x326669,_0x400689,_0x59bb10){if(_0x59bb10===undefined)_0x59bb10=_0x400689;_0x229f10[_0x59bb10]=_0x326669[_0x400689];}),__setModuleDefault=this&&this[a0_0x47cc5e(0xb2)]||(Object[a0_0x47cc5e(0x91)]?function(_0x342073,_0x5a052f){const _0x20cc2f=a0_0x47cc5e;Object[_0x20cc2f(0xa6)](_0x342073,_0x20cc2f(0x99),{'enumerable':!![],'value':_0x5a052f});}:function(_0x14e3a1,_0x505188){const _0x2c29b3=a0_0x47cc5e;_0x14e3a1[_0x2c29b3(0x99)]=_0x505188;}),__importStar=this&&this[a0_0x47cc5e(0x9d)]||(function(){var _0x4cae0b=function(_0x1c2dfd){const _0x530b44=a0_0x450b;return _0x4cae0b=Object[_0x530b44(0xb7)]||function(_0x4ccbc0){const _0x31a882=_0x530b44;var _0x31664f=[];for(var _0x4e7fdc in _0x4ccbc0)if(Object[_0x31a882(0xac)]['hasOwnProperty'][_0x31a882(0xa1)](_0x4ccbc0,_0x4e7fdc))_0x31664f[_0x31664f[_0x31a882(0xaa)]]=_0x4e7fdc;return _0x31664f;},_0x4cae0b(_0x1c2dfd);};return function(_0x538abd){const _0x30c160=a0_0x450b;if(_0x538abd&&_0x538abd[_0x30c160(0xb6)])return _0x538abd;var _0x281f47={};if(_0x538abd!=null){for(var _0xbc6d1a=_0x4cae0b(_0x538abd),_0x3f3a18=0x0;_0x3f3a18<_0xbc6d1a[_0x30c160(0xaa)];_0x3f3a18++)if(_0xbc6d1a[_0x3f3a18]!==_0x30c160(0x99))__createBinding(_0x281f47,_0x538abd,_0xbc6d1a[_0x3f3a18]);}return __setModuleDefault(_0x281f47,_0x538abd),_0x281f47;};}());Object[a0_0x47cc5e(0xa6)](exports,'__esModule',{'value':!![]}),exports[a0_0x47cc5e(0xa8)]=skeletonize,exports[a0_0x47cc5e(0x93)]=runCcr;const crypto=__importStar(require(a0_0x47cc5e(0xcf))),fs=__importStar(require('fs')),path=__importStar(require('path')),os=__importStar(require('os'));function skeletonize(_0xa46cdb,_0x1417fb){const _0x2950b3=a0_0x47cc5e,_0x12d54e=path['extname'](_0x1417fb[_0x2950b3(0x9c)]('\x20')[_0x2950b3(0xbf)]()||'')[_0x2950b3(0x9a)](),_0x346fb3=_0xa46cdb[_0x2950b3(0x9c)]('\x0a'),_0xf0a186=[];if(_0x12d54e==='.py'){let _0x52826a=![],_0x269aaa='';for(let _0x53acec=0x0;_0x53acec<_0x346fb3[_0x2950b3(0xaa)];_0x53acec++){const _0x113262=_0x346fb3[_0x53acec],_0x4f3466=_0x113262['trim'](),_0x1a0585=_0x113262['length']-_0x113262[_0x2950b3(0xad)]()[_0x2950b3(0xaa)];if(!_0x52826a&&(_0x4f3466[_0x2950b3(0xab)](_0x2950b3(0xd1))||_0x4f3466[_0x2950b3(0xab)](_0x2950b3(0xc6)))){_0x52826a=!![],_0x269aaa=_0x4f3466[_0x2950b3(0xd0)](0x0,0x3),_0xf0a186[_0x2950b3(0x97)](_0x113262);_0x4f3466[_0x2950b3(0xba)](_0x269aaa)&&_0x4f3466[_0x2950b3(0xaa)]>0x3&&(_0x52826a=![]);continue;}if(_0x52826a){_0xf0a186[_0x2950b3(0x97)](_0x113262);_0x4f3466[_0x2950b3(0xba)](_0x269aaa)&&(_0x52826a=![]);continue;}if(_0x4f3466[_0x2950b3(0xab)](_0x2950b3(0xd6))||_0x4f3466[_0x2950b3(0xab)](_0x2950b3(0x94))||_0x4f3466[_0x2950b3(0xab)]('class\x20')||_0x4f3466[_0x2950b3(0xab)](_0x2950b3(0xd4))||_0x4f3466[_0x2950b3(0xab)]('@')||_0x4f3466[_0x2950b3(0xab)]('#')||_0x4f3466[_0x2950b3(0xaa)]===0x0)_0xf0a186['push'](_0x113262);else{const _0x370639=_0xf0a186[_0xf0a186['length']-0x1]||'';if(!_0x370639[_0x2950b3(0x90)]()[_0x2950b3(0xba)](_0x2950b3(0xa7))){const _0x8cfcea='\x20'['repeat'](_0x1a0585);_0xf0a186['push'](_0x8cfcea+'#\x20...\x20[collapsed]');}}}return _0xf0a186['join']('\x0a');}if([_0x2950b3(0xca),_0x2950b3(0xbd),_0x2950b3(0xc0),'.tsx',_0x2950b3(0xb4),_0x2950b3(0xaf),_0x2950b3(0x9b),'.c','.cpp','.h'][_0x2950b3(0xa9)](_0x12d54e)){let _0x42a9b8=0x0;for(let _0x3f3fa9=0x0;_0x3f3fa9<_0x346fb3[_0x2950b3(0xaa)];_0x3f3fa9++){const _0x1a56eb=_0x346fb3[_0x3f3fa9],_0x333042=_0x1a56eb[_0x2950b3(0x90)](),_0x3aa843=(_0x333042['match'](/\{/g)||[])[_0x2950b3(0xaa)],_0x434a2f=(_0x333042[_0x2950b3(0xb3)](/\}/g)||[])['length'];if(_0x42a9b8===0x0)(_0x333042['startsWith']('import')||_0x333042[_0x2950b3(0xab)](_0x2950b3(0xc1))||_0x333042[_0x2950b3(0xab)](_0x2950b3(0xd8))||_0x333042[_0x2950b3(0xab)]('let')||_0x333042[_0x2950b3(0xab)](_0x2950b3(0xc8))||_0x333042[_0x2950b3(0xab)](_0x2950b3(0x96))||_0x333042[_0x2950b3(0xab)](_0x2950b3(0xd5))||_0x333042[_0x2950b3(0xab)](_0x2950b3(0x9e))||_0x333042[_0x2950b3(0xab)]('type')||_0x333042['startsWith']('package')||_0x333042[_0x2950b3(0xab)]('fn')||_0x333042[_0x2950b3(0xab)](_0x2950b3(0xbc))||_0x333042[_0x2950b3(0xaa)]===0x0||_0x333042['startsWith']('//')||_0x333042[_0x2950b3(0xab)]('/*')||_0x333042[_0x2950b3(0xab)]('*'))&&_0xf0a186[_0x2950b3(0x97)](_0x1a56eb),_0x3aa843>_0x434a2f&&(_0x42a9b8+=_0x3aa843-_0x434a2f);else{const _0x4ef8a2=_0x42a9b8+_0x3aa843-_0x434a2f;if(_0x4ef8a2<=0x0){const _0x3b3ea3=_0x1a56eb['match'](/^\s*/)?.[0x0]||'';_0xf0a186[_0x2950b3(0x97)](_0x3b3ea3+'//\x20...\x20[collapsed]'),_0xf0a186['push'](_0x1a56eb),_0x42a9b8=0x0;}else _0x42a9b8=_0x4ef8a2;}}return _0xf0a186[_0x2950b3(0xb0)]('\x0a');}if(_0x346fb3['length']<=0x64)return _0xa46cdb;return[..._0x346fb3[_0x2950b3(0xcb)](0x0,0x1e),_0x2950b3(0xc3)+(_0x346fb3[_0x2950b3(0xaa)]-0x32)+'\x20lines\x20collapsed\x20to\x20save\x20tokens]\x20...\x0a',..._0x346fb3[_0x2950b3(0xcb)](-0x14)][_0x2950b3(0xb0)]('\x0a');}function runCcr(_0x5be2bb,_0x106ebd){const _0x3d81b6=a0_0x47cc5e,_0x1c9f47=_0x106ebd[_0x3d81b6(0xd7)](/\\/g,'/'),_0xb9a5d6=_0x3d81b6(0xa2)+crypto['createHash']('md5')[_0x3d81b6(0xc4)](_0x5be2bb)[_0x3d81b6(0x9f)](_0x3d81b6(0xb1))['substring'](0x0,0xa),_0x3bf1cc=path[_0x3d81b6(0xb0)](os[_0x3d81b6(0xae)](),_0x3d81b6(0xa4)),_0x3ab86b=path[_0x3d81b6(0xb0)](_0x3bf1cc,_0x3d81b6(0x8f));!fs[_0x3d81b6(0x95)](_0x3ab86b)&&fs[_0x3d81b6(0x98)](_0x3ab86b,{'recursive':!![]});fs[_0x3d81b6(0xcc)](path[_0x3d81b6(0xb0)](_0x3ab86b,_0xb9a5d6+_0x3d81b6(0xd3)),_0x5be2bb,_0x3d81b6(0xce));const _0x3f42fb=skeletonize(_0x5be2bb,_0x1c9f47);return _0x3d81b6(0x92)+_0xb9a5d6+'.\x20To\x20read\x20the\x20full\x20raw\x20content,\x20run\x20the\x20shell\x20command:\x20trim\x20retrieve\x20'+_0xb9a5d6+']\x0a\x0a'+_0x3f42fb;}
|
package/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';const a0_0xce47f3=a0_0x28cf;(function(_0x36496e,_0x2b30e8){const _0x26afea=a0_0x28cf,_0x2829ad=_0x36496e();while(!![]){try{const _0xd15a45=parseInt(_0x26afea(0x248))/0x1*(-parseInt(_0x26afea(0x1e5))/0x2)+-parseInt(_0x26afea(0x254))/0x3+parseInt(_0x26afea(0x209))/0x4+parseInt(_0x26afea(0x1d9))/0x5+-parseInt(_0x26afea(0x1f8))/0x6*(parseInt(_0x26afea(0x246))/0x7)+-parseInt(_0x26afea(0x251))/0x8+parseInt(_0x26afea(0x1d8))/0x9;if(_0xd15a45===_0x2b30e8)break;else _0x2829ad['push'](_0x2829ad['shift']());}catch(_0x31310b){_0x2829ad['push'](_0x2829ad['shift']());}}}(a0_0x3f68,0x901ff));function a0_0x28cf(_0x4acdb3,_0x42a379){_0x4acdb3=_0x4acdb3-0x1c9;const _0x3f6898=a0_0x3f68();let _0x28cfcc=_0x3f6898[_0x4acdb3];return _0x28cfcc;}var __createBinding=this&&this[a0_0xce47f3(0x1ee)]||(Object['create']?function(_0x77931d,_0x371bc5,_0x24286a,_0x36fca8){const _0x21f462=a0_0xce47f3;if(_0x36fca8===undefined)_0x36fca8=_0x24286a;var _0x4305da=Object['getOwnPropertyDescriptor'](_0x371bc5,_0x24286a);(!_0x4305da||('get'in _0x4305da?!_0x371bc5[_0x21f462(0x200)]:_0x4305da[_0x21f462(0x206)]||_0x4305da['configurable']))&&(_0x4305da={'enumerable':!![],'get':function(){return _0x371bc5[_0x24286a];}}),Object[_0x21f462(0x1fc)](_0x77931d,_0x36fca8,_0x4305da);}:function(_0x98b98c,_0x1136b1,_0x5ae5c1,_0xdfc0e0){if(_0xdfc0e0===undefined)_0xdfc0e0=_0x5ae5c1;_0x98b98c[_0xdfc0e0]=_0x1136b1[_0x5ae5c1];}),__setModuleDefault=this&&this[a0_0xce47f3(0x25f)]||(Object['create']?function(_0x325a9d,_0x82924c){const _0x38e162=a0_0xce47f3;Object[_0x38e162(0x1fc)](_0x325a9d,'default',{'enumerable':!![],'value':_0x82924c});}:function(_0x555d8e,_0x25f379){const _0x5ede89=a0_0xce47f3;_0x555d8e[_0x5ede89(0x1cb)]=_0x25f379;}),__importStar=this&&this['__importStar']||(function(){var _0x4e19a7=function(_0xf8893d){return _0x4e19a7=Object['getOwnPropertyNames']||function(_0x4166f0){const _0x316c56=a0_0x28cf;var _0x40751c=[];for(var _0x1df585 in _0x4166f0)if(Object[_0x316c56(0x20e)][_0x316c56(0x259)]['call'](_0x4166f0,_0x1df585))_0x40751c[_0x40751c[_0x316c56(0x225)]]=_0x1df585;return _0x40751c;},_0x4e19a7(_0xf8893d);};return function(_0x277bb6){const _0x1d4c09=a0_0x28cf;if(_0x277bb6&&_0x277bb6[_0x1d4c09(0x200)])return _0x277bb6;var _0x3eab5f={};if(_0x277bb6!=null){for(var _0x3cc95e=_0x4e19a7(_0x277bb6),_0x171d96=0x0;_0x171d96<_0x3cc95e[_0x1d4c09(0x225)];_0x171d96++)if(_0x3cc95e[_0x171d96]!=='default')__createBinding(_0x3eab5f,_0x277bb6,_0x3cc95e[_0x171d96]);}return __setModuleDefault(_0x3eab5f,_0x277bb6),_0x3eab5f;};}());Object[a0_0xce47f3(0x1fc)](exports,a0_0xce47f3(0x200),{'value':!![]});const commander_1=require(a0_0xce47f3(0x244)),executor_1=require(a0_0xce47f3(0x20c)),filters_1=require(a0_0xce47f3(0x1fd)),tracker_1=require('./tracker'),cache_1=require(a0_0xce47f3(0x240)),shims_1=require(a0_0xce47f3(0x273)),dashboard_1=require(a0_0xce47f3(0x1d4)),program=new commander_1[(a0_0xce47f3(0x1da))]();function isDisabled(){return process.env.TRIMPROMPT_DISABLED==='1';}function adjustCommandArgs(_0x33918b,_0x11b87d){const _0x1d6b19=a0_0xce47f3,_0x452395=_0x33918b[_0x1d6b19(0x249)]();if(_0x452395===_0x1d6b19(0x1f2)||_0x452395===_0x1d6b19(0x214)){const _0x4cf1e7=_0x11b87d[0x0];if(_0x4cf1e7==='status'){const _0x1f8e1a=_0x11b87d[_0x1d6b19(0x239)](0x1),_0x2e213e=_0x1f8e1a[_0x1d6b19(0x225)]===0x0||_0x1f8e1a[_0x1d6b19(0x26a)](_0x544bfb=>{const _0xc37e4=_0x1d6b19;return _0x544bfb==='-b'||_0x544bfb===_0xc37e4(0x25c)||_0x544bfb===_0xc37e4(0x280)||_0x544bfb==='-bs'||_0x544bfb==='-s'||_0x544bfb===_0xc37e4(0x1ed);});if(_0x2e213e)return{'cmd':_0x33918b,'args':[_0x1d6b19(0x1f6),_0x1d6b19(0x237),'-b']};}else{if(_0x4cf1e7==='log'){const _0x1da626=_0x11b87d[_0x1d6b19(0x239)](0x1),_0x30785a=_0x1da626['some'](_0x167add=>_0x167add[_0x1d6b19(0x27f)](_0x1d6b19(0x230))||_0x167add[_0x1d6b19(0x27f)](_0x1d6b19(0x1eb))||_0x167add['startsWith'](_0x1d6b19(0x257))),_0x19671c=_0x1da626[_0x1d6b19(0x222)](_0x7a9b50=>_0x7a9b50[_0x1d6b19(0x27f)]('-')&&/^\d+$/['test'](_0x7a9b50[_0x1d6b19(0x239)](0x1))||_0x7a9b50==='-n'||_0x7a9b50[_0x1d6b19(0x27f)]('--max-count')),_0x9a78ee=[..._0x11b87d];if(!_0x30785a){const _0x542739=_0x1d6b19(0x236);_0x9a78ee['push'](process[_0x1d6b19(0x24a)]===_0x1d6b19(0x25d)?'\x22'+_0x542739+'\x22':_0x542739);}!_0x19671c&&(_0x30785a?_0x9a78ee[_0x1d6b19(0x223)](_0x1d6b19(0x27a)):_0x9a78ee['push'](_0x1d6b19(0x252)));const _0x30dab9=_0x1da626[_0x1d6b19(0x222)](_0x59c0ee=>_0x59c0ee===_0x1d6b19(0x264)||_0x59c0ee===_0x1d6b19(0x1e4)||_0x59c0ee[_0x1d6b19(0x27f)]('--min-parents'));return!_0x30dab9&&!_0x19671c&&_0x9a78ee[_0x1d6b19(0x223)](_0x1d6b19(0x1e4)),{'cmd':_0x33918b,'args':_0x9a78ee};}}}return{'cmd':_0x33918b,'args':_0x11b87d};}function isMcpServerExecution(_0x1f380e,_0x18736a){const _0x426256=a0_0xce47f3,_0x3f277c=_0x1f380e['toLowerCase'](),_0x2d732c=_0x18736a[_0x426256(0x21e)]('\x20')[_0x426256(0x249)]();if(_0x3f277c[_0x426256(0x1e3)]('mcp')&&(_0x3f277c[_0x426256(0x1e3)](_0x426256(0x227))||_0x3f277c[_0x426256(0x1e3)](_0x426256(0x22e))))return!![];if(_0x3f277c===_0x426256(0x247)||_0x3f277c===_0x426256(0x26f)||_0x3f277c==='bun'||_0x3f277c==='npm'||_0x3f277c===_0x426256(0x229)||_0x3f277c==='yarn'){if(_0x2d732c['includes']('@modelcontextprotocol/')||_0x2d732c[_0x426256(0x1e3)](_0x426256(0x26b))||_0x2d732c['includes'](_0x426256(0x269))||_0x2d732c[_0x426256(0x1e3)](_0x426256(0x266)))return!![];}if(_0x18736a[_0x426256(0x222)](_0x182b7b=>{const _0x419412=_0x426256,_0xb120f2=_0x182b7b[_0x419412(0x249)]();return _0xb120f2['includes'](_0x419412(0x269))||_0xb120f2[_0x419412(0x1e3)](_0x419412(0x266))||_0xb120f2['includes'](_0x419412(0x1fa))||_0xb120f2===_0x419412(0x213)||_0xb120f2==='mcp';}))return!![];return![];}async function runProxy(_0x3af987){const _0x47ab73=a0_0xce47f3;if(_0x3af987[_0x47ab73(0x225)]===0x0){program['help']();return;}const _0x41dd46=_0x3af987[0x0],_0x365891=_0x3af987['slice'](0x1),_0x233cc4=_0x3af987[_0x47ab73(0x21e)]('\x20');if(isDisabled()){const _0x4b4353=await(0x0,executor_1[_0x47ab73(0x263)])(_0x41dd46,_0x365891);process['stdout'][_0x47ab73(0x1cc)](_0x4b4353[_0x47ab73(0x277)]),process['stderr'][_0x47ab73(0x1cc)](_0x4b4353[_0x47ab73(0x25b)]),process['exit'](_0x4b4353['exitCode']);}if(isMcpServerExecution(_0x41dd46,_0x365891)){console[_0x47ab73(0x23f)]('[TrimPrompt]\x20Autodetected\x20MCP\x20server\x20execution.\x20Activating\x20real-time\x20JSON-RPC\x20proxy...');const {runMcpProxy:_0x33cee9}=await Promise[_0x47ab73(0x1f3)]()[_0x47ab73(0x255)](()=>__importStar(require(_0x47ab73(0x1cf))));_0x33cee9(_0x41dd46,_0x365891);return;}const _0x1997f1=adjustCommandArgs(_0x41dd46,_0x365891),_0x42b400=await(0x0,executor_1[_0x47ab73(0x263)])(_0x1997f1[_0x47ab73(0x1e0)],_0x1997f1[_0x47ab73(0x1ff)]),_0x57f891=(0x0,filters_1['compressOutput'])(_0x233cc4,_0x42b400[_0x47ab73(0x277)],_0x42b400[_0x47ab73(0x25b)],tracker_1['tracker']['getConfig']()[_0x47ab73(0x271)]),_0x3163a0={...filters_1['lastRedactAudit']},_0x3bc826=_0x42b400[_0x47ab73(0x277)]+(_0x42b400[_0x47ab73(0x25b)][_0x47ab73(0x205)]()[_0x47ab73(0x225)]>0x0?'\x0a'+_0x42b400['stderr']:''),_0xc2ef07=_0x57f891[_0x47ab73(0x225)]<_0x3bc826[_0x47ab73(0x225)]?_0x57f891:_0x3bc826,_0x13a80b=_0x42b400[_0x47ab73(0x23b)]===0x0?(0x0,cache_1[_0x47ab73(0x1fe)])(_0x233cc4,_0xc2ef07):null;tracker_1[_0x47ab73(0x27e)][_0x47ab73(0x1db)](_0x233cc4,_0x3bc826,_0x13a80b||_0xc2ef07,_0x42b400[_0x47ab73(0x23b)],_0x3163a0,[...filters_1[_0x47ab73(0x1e2)]]),_0x42b400[_0x47ab73(0x23b)]===0x0?process[_0x47ab73(0x277)][_0x47ab73(0x1cc)](_0xc2ef07+'\x0a'):(process['stdout'][_0x47ab73(0x1cc)](_0x57f891+'\x0a'),_0x42b400[_0x47ab73(0x25b)][_0x47ab73(0x205)]()[_0x47ab73(0x225)]>0x0&&!_0x57f891[_0x47ab73(0x1e3)](_0x42b400[_0x47ab73(0x25b)][_0x47ab73(0x205)]())&&process[_0x47ab73(0x25b)]['write'](_0x42b400[_0x47ab73(0x25b)]+'\x0a')),process[_0x47ab73(0x219)](_0x42b400[_0x47ab73(0x23b)]);}program[a0_0xce47f3(0x20a)]('trim')['description'](a0_0xce47f3(0x1d2))[a0_0xce47f3(0x261)](((()=>{const _0x33641d=a0_0xce47f3,_0x48565e=_0x33641d(0x268);if(_0x48565e!==_0x33641d(0x258))return _0x48565e;try{return require(_0x33641d(0x210))[_0x33641d(0x261)];}catch{try{return require('./package.json')[_0x33641d(0x261)];}catch{return _0x33641d(0x262);}}})())),program['command']('ui')[a0_0xce47f3(0x216)](a0_0xce47f3(0x1c9))[a0_0xce47f3(0x276)](a0_0xce47f3(0x1f4))[a0_0xce47f3(0x1d3)](a0_0xce47f3(0x243),a0_0xce47f3(0x25a),a0_0xce47f3(0x1e6))[a0_0xce47f3(0x238)](_0x322beb=>{const _0x276bcf=a0_0xce47f3,_0x10f3ff=parseInt(_0x322beb[_0x276bcf(0x1d0)],0xa);(0x0,dashboard_1['startDashboard'])(_0x10f3ff);}),program[a0_0xce47f3(0x27c)]('stats')['description'](a0_0xce47f3(0x215))[a0_0xce47f3(0x1d3)](a0_0xce47f3(0x1f1),a0_0xce47f3(0x23a),a0_0xce47f3(0x212))['action'](_0x499a6c=>{const _0x1e9dcd=a0_0xce47f3,_0x52d252=tracker_1['tracker'][_0x1e9dcd(0x1d5)](_0x499a6c['model']);console['log'](_0x1e9dcd(0x245)),console['log'](_0x1e9dcd(0x1ea)),console[_0x1e9dcd(0x22a)](_0x1e9dcd(0x233)),console['log']('Model\x20Context:\x20\x20\x20\x20\x20'+_0x52d252[_0x1e9dcd(0x20f)]),console[_0x1e9dcd(0x22a)]('Raw\x20Tokens:\x20\x20\x20\x20\x20\x20\x20\x20'+_0x52d252['total_raw_tokens'][_0x1e9dcd(0x270)]()),console[_0x1e9dcd(0x22a)]('Compressed:\x20\x20\x20\x20\x20\x20\x20\x20'+_0x52d252[_0x1e9dcd(0x1dd)][_0x1e9dcd(0x270)]()),console[_0x1e9dcd(0x22a)](_0x1e9dcd(0x1e1)+_0x52d252[_0x1e9dcd(0x272)][_0x1e9dcd(0x270)]()),console['log'](_0x1e9dcd(0x1dc)+_0x52d252[_0x1e9dcd(0x23e)]+'%'),console['log'](_0x1e9dcd(0x22c)+_0x52d252['raw_cost_usd'][_0x1e9dcd(0x1e9)](0x4)+_0x1e9dcd(0x267)),console[_0x1e9dcd(0x22a)]('Actual\x20Cost:\x20\x20\x20\x20\x20\x20\x20$'+_0x52d252[_0x1e9dcd(0x24b)][_0x1e9dcd(0x1e9)](0x4)+_0x1e9dcd(0x234)),console[_0x1e9dcd(0x22a)]('---------------------------------------------'),console['log'](_0x1e9dcd(0x21d)+_0x52d252[_0x1e9dcd(0x1cd)][_0x1e9dcd(0x1e9)](0x4)+_0x1e9dcd(0x1f0)),console[_0x1e9dcd(0x22a)](_0x1e9dcd(0x1fb));}),program[a0_0xce47f3(0x27c)](a0_0xce47f3(0x22f))['description'](a0_0xce47f3(0x27d))['argument'](a0_0xce47f3(0x218),a0_0xce47f3(0x226))[a0_0xce47f3(0x1ef)]('<key>',a0_0xce47f3(0x278))[a0_0xce47f3(0x1ef)](a0_0xce47f3(0x241),a0_0xce47f3(0x21f))['action']((_0xbe4c19,_0x1c00a6,_0x28fdf)=>{const _0x37e32f=a0_0xce47f3;if(_0xbe4c19===_0x37e32f(0x1ca)){const _0x3cbec0=tracker_1[_0x37e32f(0x27e)][_0x37e32f(0x202)]();console['log'](_0x1c00a6+':\x20'+_0x3cbec0[_0x1c00a6]);}else{if(_0xbe4c19===_0x37e32f(0x23c)){_0x28fdf===undefined&&(console[_0x37e32f(0x23f)]('Error:\x20Value\x20required\x20for\x20set\x20action'),process[_0x37e32f(0x219)](0x1));let _0x41c551=_0x28fdf;if(_0x28fdf===_0x37e32f(0x1d7))_0x41c551=!![];if(_0x28fdf===_0x37e32f(0x20b))_0x41c551=![];if(/^\d+$/[_0x37e32f(0x275)](_0x28fdf))_0x41c551=parseInt(_0x28fdf,0xa);tracker_1[_0x37e32f(0x27e)][_0x37e32f(0x204)](_0x1c00a6,_0x41c551),console[_0x37e32f(0x22a)](_0x37e32f(0x260)+_0x1c00a6+_0x37e32f(0x26d)+_0x28fdf);}else console[_0x37e32f(0x23f)]('Error:\x20Action\x20must\x20be\x20get\x20or\x20set'),process['exit'](0x1);}});function printMessage(_0x49576e){const _0x582896=a0_0xce47f3;if(process.env.npm_lifecycle_event===_0x582896(0x1f7))try{const _0x1bc0ad=require('fs'),_0x5c4522=process[_0x582896(0x24a)]===_0x582896(0x25d)?_0x582896(0x22d):_0x582896(0x1f9);_0x1bc0ad[_0x582896(0x265)](_0x5c4522,'\x0a'+_0x49576e+'\x0a');return;}catch{}console['log'](_0x49576e);}program[a0_0xce47f3(0x27c)]('shims')[a0_0xce47f3(0x276)](a0_0xce47f3(0x279))[a0_0xce47f3(0x1ef)]('<action>',a0_0xce47f3(0x24d))[a0_0xce47f3(0x238)](_0x5eae62=>{const _0xea09c3=a0_0xce47f3;if(_0x5eae62==='install'){const _0x220bc4=(0x0,shims_1[_0xea09c3(0x21b)])();printMessage(_0x220bc4['message']);}else{if(_0x5eae62==='uninstall'){const _0x1e27ba=(0x0,shims_1[_0xea09c3(0x207)])();printMessage(_0x1e27ba[_0xea09c3(0x1e8)]);}else console[_0xea09c3(0x23f)](_0xea09c3(0x24c)),process[_0xea09c3(0x219)](0x1);}}),program[a0_0xce47f3(0x27c)](a0_0xce47f3(0x1ce))['description'](a0_0xce47f3(0x1e7))[a0_0xce47f3(0x1ef)](a0_0xce47f3(0x1df),'Command\x20line\x20to\x20evaluate')[a0_0xce47f3(0x238)](_0xf5fcbf=>{const _0x45ff15=a0_0xce47f3;if(isDisabled()){console[_0x45ff15(0x22a)](_0xf5fcbf);return;}const _0x541a19=(0x0,filters_1[_0x45ff15(0x203)])(_0xf5fcbf);console[_0x45ff15(0x22a)](_0x541a19);}),program[a0_0xce47f3(0x27c)]('proxy\x20[action]')[a0_0xce47f3(0x276)](a0_0xce47f3(0x21a))[a0_0xce47f3(0x1d3)](a0_0xce47f3(0x220),a0_0xce47f3(0x1d1),a0_0xce47f3(0x235))[a0_0xce47f3(0x238)](async(_0x5a2d19,_0x2ea4b2)=>{const _0x755d08=a0_0xce47f3,_0x3f1721=parseInt(_0x2ea4b2[_0x755d08(0x1d0)])||0x1f90;if(!_0x5a2d19||_0x5a2d19===_0x755d08(0x201)){const {startApiProxy:_0x3309af}=await Promise['resolve']()['then'](()=>__importStar(require('./api-proxy')));_0x3309af(_0x3f1721);}else{if(_0x5a2d19===_0x755d08(0x231)){const {startProxyDaemon:_0x4c6c6d,setAnthropicBaseUrl:_0x83eca9,enableAutostart:_0x3ee291}=await Promise[_0x755d08(0x1f3)]()[_0x755d08(0x255)](()=>__importStar(require(_0x755d08(0x221)))),_0x4d8898=_0x4c6c6d(_0x3f1721);_0x4d8898[_0x755d08(0x224)]?(_0x83eca9(_0x4d8898[_0x755d08(0x1d0)]),_0x3ee291(),console[_0x755d08(0x22a)](_0x755d08(0x1ec)+_0x4d8898[_0x755d08(0x20d)]+_0x755d08(0x208)+_0x4d8898['port']),console[_0x755d08(0x22a)](_0x755d08(0x24e)+_0x4d8898[_0x755d08(0x1d0)]),console[_0x755d08(0x22a)]('[TrimPrompt]\x20Autostart\x20registered\x20โ\x20proxy\x20will\x20relaunch\x20on\x20every\x20login.'),console[_0x755d08(0x22a)](_0x755d08(0x1d6))):console[_0x755d08(0x23f)](_0x755d08(0x1de)+_0x4d8898[_0x755d08(0x1e8)]);}else{if(_0x5a2d19===_0x755d08(0x274)){const {stopProxyDaemon:_0x4753f0}=await Promise['resolve']()['then'](()=>__importStar(require('./proxy-daemon'))),_0x2c6f1b=_0x4753f0();console[_0x755d08(0x22a)](_0x755d08(0x1de)+_0x2c6f1b[_0x755d08(0x1e8)]);}else{if(_0x5a2d19===_0x755d08(0x256)){const {stopProxyDaemon:_0x757467,removeAnthropicBaseUrl:_0x579095,disableAutostart:_0x55a17c}=await Promise[_0x755d08(0x1f3)]()['then'](()=>__importStar(require(_0x755d08(0x221))));_0x757467(),_0x579095(),_0x55a17c(),console['log'](_0x755d08(0x27b));}else{if(_0x5a2d19==='status'){const {isProxyRunning:_0x37eb6f}=await Promise[_0x755d08(0x1f3)]()[_0x755d08(0x255)](()=>__importStar(require(_0x755d08(0x221)))),_0x16c69a=_0x37eb6f();_0x16c69a[_0x755d08(0x25e)]?console[_0x755d08(0x22a)]('[TrimPrompt]\x20API\x20proxy\x20running\x20(pid\x20'+_0x16c69a[_0x755d08(0x20d)]+_0x755d08(0x208)+_0x16c69a[_0x755d08(0x1d0)]):console['log'](_0x755d08(0x21c));}}}}}}),program['command']('traffic\x20[action]')[a0_0xce47f3(0x276)](a0_0xce47f3(0x232))[a0_0xce47f3(0x1d3)](a0_0xce47f3(0x220),a0_0xce47f3(0x1d1),a0_0xce47f3(0x235))[a0_0xce47f3(0x238)](async(_0x56c2fd,_0x25bb4f)=>{const _0x13580c=a0_0xce47f3,_0x408c25=parseInt(_0x25bb4f['port'])||0x1f90,{startTrafficInterceptor:_0x4db827,installSystemCaCert:_0x15f912,enableSystemProxy:_0x562bf4,disableSystemProxy:_0x349e5}=await Promise[_0x13580c(0x1f3)]()[_0x13580c(0x255)](()=>__importStar(require(_0x13580c(0x26c))));if(!_0x56c2fd||_0x56c2fd===_0x13580c(0x201))_0x4db827(_0x408c25);else{if(_0x56c2fd===_0x13580c(0x231))_0x15f912(),_0x562bf4(_0x408c25),console[_0x13580c(0x22a)]('[TrimPrompt\x20Traffic\x20Engine]\x20System-wide\x20traffic\x20interception\x20enabled\x20on\x20127.0.0.1:'+_0x408c25),console[_0x13580c(0x22a)](_0x13580c(0x24f));else _0x56c2fd===_0x13580c(0x256)&&(_0x349e5(),console[_0x13580c(0x22a)]('[TrimPrompt\x20Traffic\x20Engine]\x20System-wide\x20traffic\x20interception\x20disabled.'));}});const args=process[a0_0xce47f3(0x22b)][a0_0xce47f3(0x239)](0x2),firstArg=args[0x0],subcommands=['ui',a0_0xce47f3(0x1c9),a0_0xce47f3(0x250),'config',a0_0xce47f3(0x228),a0_0xce47f3(0x1ce),a0_0xce47f3(0x22e),'mcp-proxy',a0_0xce47f3(0x253),a0_0xce47f3(0x26e),a0_0xce47f3(0x23d),a0_0xce47f3(0x211),'-h',a0_0xce47f3(0x261),a0_0xce47f3(0x242),'-v'];firstArg&&!subcommands[a0_0xce47f3(0x1e3)](firstArg)?runProxy(args)[a0_0xce47f3(0x217)](_0x1f7b12=>{const _0xd80aac=a0_0xce47f3;console['error'](_0xd80aac(0x1f5)+_0x1f7b12[_0xd80aac(0x1e8)]),process[_0xd80aac(0x219)](0x1);}):program['parse'](process[a0_0xce47f3(0x22b)]);function a0_0x3f68(){const _0x40fee0=['./cache','[value]','--version','-p,\x20--port\x20<number>','commander','\x0a=============================================','147klHKpb','npx','14202yMalsv','toLowerCase','platform','compressed_cost_usd','Error:\x20Action\x20must\x20be\x20install\x20or\x20uninstall','install\x20or\x20uninstall','[TrimPrompt]\x20ANTHROPIC_BASE_URL\x20set\x20to\x20http://127.0.0.1:','[TrimPrompt\x20Traffic\x20Engine]\x20Root\x20CA\x20Certificate\x20installed\x20in\x20Windows\x20Trusted\x20Store.','stats','8325208rlxjnD','-10','mcp','3364536LqTHFv','then','uninstall','--format','__VERSION__','hasOwnProperty','Port\x20to\x20run\x20the\x20dashboard\x20on','stderr','--branch','win32','running','__setModuleDefault','Config\x20set\x20','version','1.0.0','executeCommand','--merges','writeFileSync','server-mcp','\x20(before\x20Trim)','1.0.29','mcp-server','every','modelcontextprotocol','./traffic-interceptor','\x20=\x20','traffic','node','toLocaleString','redaction_enabled','total_tokens_saved','./shims','stop','test','description','stdout','config\x20parameter\x20name','Install\x20or\x20uninstall\x20system\x20command\x20shims','-50','[TrimPrompt]\x20API\x20proxy\x20stopped,\x20autostart\x20removed,\x20ANTHROPIC_BASE_URL\x20cleared.','command','Manage\x20local\x20configuration\x20parameters','tracker','startsWith','-sb','dashboard','get','default','write','money_saved_usd','rewrite','./mcp','port','Port\x20to\x20listen\x20on','TrimPrompt.ai\x20-\x20Reduce\x20LLM\x20token\x20consumption\x20by\x2060-90%','option','./dashboard','getStatsSummary','[TrimPrompt]\x20Restart\x20your\x20terminal\x20for\x20the\x20env\x20var\x20to\x20take\x20effect.','true','22895271ivrbKh','973275XmaKBS','Command','logExecution','Reduction\x20Rate:\x20\x20\x20\x20','total_compressed_tokens','[TrimPrompt]\x20','<commandLine>','cmd','Tokens\x20Saved:\x20\x20\x20\x20\x20\x20','lastFeatures','includes','--no-merges','78MHGhGi','4000','Check\x20a\x20command\x20line\x20and\x20return\x20the\x20optimized\x20command\x20line','message','toFixed','\x20\x20\x20\x20\x20\x20\x20TRIMPROMPT.AI\x20SAVINGS\x20SUMMARY\x20\x20\x20\x20\x20\x20\x20\x20','--pretty','[TrimPrompt]\x20API\x20proxy\x20started\x20in\x20background\x20(pid\x20','--short','__createBinding','argument','\x20USD','-m,\x20--model\x20<string>','git','resolve','Start\x20the\x20local\x20developer\x20dashboard','[TrimPrompt]\x20Fatal\x20Proxy\x20Error:\x20','status','postinstall','1326IDJJdl','/dev/tty','@modelcontextprotocol/','=============================================\x0a','defineProperty','./filters','dedup','args','__esModule','start','getConfig','rewriteCommand','setConfig','trim','writable','uninstallShims',')\x20on\x20port\x20','2289772zaUjUx','name','false','./executor','pid','prototype','model_name','../package.json','--help','claude-3-5-sonnet','mcp-proxy','yadm','Show\x20token\x20and\x20cost\x20savings\x20summary','alias','catch','<action>','exit','Claude\x20API\x20proxy\x20โ\x20start\x20(foreground),\x20install\x20(background\x20daemon),\x20stop,\x20status,\x20uninstall','installShims','[TrimPrompt]\x20API\x20proxy\x20is\x20not\x20running.','Money\x20Saved:\x20\x20\x20\x20\x20\x20\x20$','join','value\x20to\x20set','-p,\x20--port\x20<port>','./proxy-daemon','some','push','success','length','get\x20or\x20set','server','shims','pnpm','log','argv','Estimated\x20Cost:\x20\x20\x20\x20$','\x5c\x5c.\x5cCON','proxy','config','--oneline','install','Live\x20traffic-level\x20interceptor\x20engine\x20โ\x20install\x20(system\x20proxy\x20+\x20SSL\x20Root\x20CA),\x20uninstall,\x20start','=============================================','\x20(after\x20Trim)','8080','--pretty=format:%h\x20%s\x20(%ar)\x20(%an)%n%b%n---END---','--porcelain','action','slice','Select\x20pricing\x20model\x20(e.g.\x20claude-3-5-sonnet,\x20gpt-4o)','exitCode','set','help','savings_percentage','error'];a0_0x3f68=function(){return _0x40fee0;};return a0_0x3f68();}
|
|
2
|
+
'use strict';const a0_0x56a941=a0_0x58f0;(function(_0x5d2a5e,_0x224814){const _0x49b520=a0_0x58f0,_0x3cce87=_0x5d2a5e();while(!![]){try{const _0x4defda=parseInt(_0x49b520(0x1ee))/0x1*(-parseInt(_0x49b520(0x1b9))/0x2)+-parseInt(_0x49b520(0x1ca))/0x3*(-parseInt(_0x49b520(0x234))/0x4)+parseInt(_0x49b520(0x245))/0x5*(-parseInt(_0x49b520(0x24e))/0x6)+-parseInt(_0x49b520(0x23f))/0x7+-parseInt(_0x49b520(0x20e))/0x8*(-parseInt(_0x49b520(0x217))/0x9)+parseInt(_0x49b520(0x1b4))/0xa+-parseInt(_0x49b520(0x1da))/0xb*(-parseInt(_0x49b520(0x21d))/0xc);if(_0x4defda===_0x224814)break;else _0x3cce87['push'](_0x3cce87['shift']());}catch(_0x2e2d0b){_0x3cce87['push'](_0x3cce87['shift']());}}}(a0_0x28cb,0x2d937));var __createBinding=this&&this[a0_0x56a941(0x193)]||(Object[a0_0x56a941(0x1b7)]?function(_0x349e3e,_0x37ae80,_0x435600,_0x1ae16b){const _0x282f7f=a0_0x56a941;if(_0x1ae16b===undefined)_0x1ae16b=_0x435600;var _0x14198e=Object[_0x282f7f(0x19a)](_0x37ae80,_0x435600);(!_0x14198e||(_0x282f7f(0x21c)in _0x14198e?!_0x37ae80[_0x282f7f(0x1e0)]:_0x14198e[_0x282f7f(0x1a3)]||_0x14198e[_0x282f7f(0x19e)]))&&(_0x14198e={'enumerable':!![],'get':function(){return _0x37ae80[_0x435600];}}),Object[_0x282f7f(0x1d8)](_0x349e3e,_0x1ae16b,_0x14198e);}:function(_0x5eb45f,_0x132e6e,_0x33fec2,_0x200bec){if(_0x200bec===undefined)_0x200bec=_0x33fec2;_0x5eb45f[_0x200bec]=_0x132e6e[_0x33fec2];}),__setModuleDefault=this&&this[a0_0x56a941(0x1b0)]||(Object[a0_0x56a941(0x1b7)]?function(_0x501c48,_0x496f9d){const _0x40a9f3=a0_0x56a941;Object[_0x40a9f3(0x1d8)](_0x501c48,'default',{'enumerable':!![],'value':_0x496f9d});}:function(_0x5083bd,_0x4c9bcf){const _0x4a4631=a0_0x56a941;_0x5083bd[_0x4a4631(0x1ce)]=_0x4c9bcf;}),__importStar=this&&this[a0_0x56a941(0x194)]||(function(){var _0x33d3ab=function(_0x168211){const _0xca30fc=a0_0x58f0;return _0x33d3ab=Object[_0xca30fc(0x188)]||function(_0x24997b){const _0x1f91cd=_0xca30fc;var _0x41837e=[];for(var _0x1d62b0 in _0x24997b)if(Object[_0x1f91cd(0x22e)][_0x1f91cd(0x240)][_0x1f91cd(0x1c5)](_0x24997b,_0x1d62b0))_0x41837e[_0x41837e[_0x1f91cd(0x1cb)]]=_0x1d62b0;return _0x41837e;},_0x33d3ab(_0x168211);};return function(_0x324e41){const _0x44df09=a0_0x58f0;if(_0x324e41&&_0x324e41[_0x44df09(0x1e0)])return _0x324e41;var _0x36bdba={};if(_0x324e41!=null){for(var _0x25ef3f=_0x33d3ab(_0x324e41),_0x5f51ec=0x0;_0x5f51ec<_0x25ef3f[_0x44df09(0x1cb)];_0x5f51ec++)if(_0x25ef3f[_0x5f51ec]!=='default')__createBinding(_0x36bdba,_0x324e41,_0x25ef3f[_0x5f51ec]);}return __setModuleDefault(_0x36bdba,_0x324e41),_0x36bdba;};}());Object[a0_0x56a941(0x1d8)](exports,'__esModule',{'value':!![]});const commander_1=require(a0_0x56a941(0x20d)),executor_1=require(a0_0x56a941(0x241)),filters_1=require(a0_0x56a941(0x1cf)),tracker_1=require(a0_0x56a941(0x1b1)),cache_1=require(a0_0x56a941(0x1f3)),shims_1=require(a0_0x56a941(0x1e8)),dashboard_1=require(a0_0x56a941(0x196)),program=new commander_1[(a0_0x56a941(0x1b3))]();function isDisabled(){const _0x5dfd92=a0_0x56a941;return process[_0x5dfd92(0x1e1)][_0x5dfd92(0x236)]==='1';}function adjustCommandArgs(_0x5ea188,_0x4df8da){const _0x1ff0a0=a0_0x56a941,_0x2ad75f=_0x5ea188[_0x1ff0a0(0x25f)]();if(_0x2ad75f===_0x1ff0a0(0x1bd)||_0x2ad75f===_0x1ff0a0(0x1cc)){const _0x5d345f=_0x4df8da[0x0];if(_0x5d345f===_0x1ff0a0(0x1aa)){const _0x4d6ef8=_0x4df8da[_0x1ff0a0(0x192)](0x1),_0x55855c=_0x4d6ef8[_0x1ff0a0(0x1cb)]===0x0||_0x4d6ef8[_0x1ff0a0(0x1dc)](_0x303145=>{const _0x12b84e=_0x1ff0a0;return _0x303145==='-b'||_0x303145==='--branch'||_0x303145==='-sb'||_0x303145===_0x12b84e(0x1b5)||_0x303145==='-s'||_0x303145==='--short';});if(_0x55855c)return{'cmd':_0x5ea188,'args':[_0x1ff0a0(0x1aa),_0x1ff0a0(0x256),'-b']};}else{if(_0x5d345f===_0x1ff0a0(0x1c3)){const _0x41b48c=_0x4df8da[_0x1ff0a0(0x192)](0x1),_0x592e9e=_0x41b48c['some'](_0x402ae1=>_0x402ae1[_0x1ff0a0(0x203)](_0x1ff0a0(0x224))||_0x402ae1[_0x1ff0a0(0x203)](_0x1ff0a0(0x205))||_0x402ae1[_0x1ff0a0(0x203)](_0x1ff0a0(0x1c1))),_0x248b05=_0x41b48c[_0x1ff0a0(0x248)](_0x96d036=>_0x96d036[_0x1ff0a0(0x203)]('-')&&/^\d+$/['test'](_0x96d036[_0x1ff0a0(0x192)](0x1))||_0x96d036==='-n'||_0x96d036[_0x1ff0a0(0x203)](_0x1ff0a0(0x260))),_0x241e14=[..._0x4df8da];if(!_0x592e9e){const _0x3baa0d=_0x1ff0a0(0x258);_0x241e14[_0x1ff0a0(0x1d1)](process[_0x1ff0a0(0x206)]===_0x1ff0a0(0x1f0)?'\x22'+_0x3baa0d+'\x22':_0x3baa0d);}!_0x248b05&&(_0x592e9e?_0x241e14[_0x1ff0a0(0x1d1)](_0x1ff0a0(0x23e)):_0x241e14[_0x1ff0a0(0x1d1)](_0x1ff0a0(0x253)));const _0x383cb3=_0x41b48c[_0x1ff0a0(0x248)](_0x321494=>_0x321494===_0x1ff0a0(0x1a0)||_0x321494===_0x1ff0a0(0x1b2)||_0x321494[_0x1ff0a0(0x203)]('--min-parents'));return!_0x383cb3&&!_0x248b05&&_0x241e14[_0x1ff0a0(0x1d1)](_0x1ff0a0(0x1b2)),{'cmd':_0x5ea188,'args':_0x241e14};}}}return{'cmd':_0x5ea188,'args':_0x4df8da};}function isMcpServerExecution(_0x29d061,_0x4dfe79){const _0x4c77d8=a0_0x56a941,_0xb4c75a=_0x29d061['toLowerCase'](),_0x2d4eb7=_0x4dfe79[_0x4c77d8(0x218)]('\x20')['toLowerCase']();if(_0xb4c75a[_0x4c77d8(0x22a)](_0x4c77d8(0x200))&&(_0xb4c75a['includes'](_0x4c77d8(0x20f))||_0xb4c75a[_0x4c77d8(0x22a)](_0x4c77d8(0x24d))))return!![];if(_0xb4c75a===_0x4c77d8(0x222)||_0xb4c75a===_0x4c77d8(0x233)||_0xb4c75a===_0x4c77d8(0x25d)||_0xb4c75a==='npm'||_0xb4c75a==='pnpm'||_0xb4c75a===_0x4c77d8(0x1ec)){if(_0x2d4eb7['includes'](_0x4c77d8(0x221))||_0x2d4eb7[_0x4c77d8(0x22a)](_0x4c77d8(0x1fc))||_0x2d4eb7[_0x4c77d8(0x22a)](_0x4c77d8(0x1cd))||_0x2d4eb7[_0x4c77d8(0x22a)]('server-mcp'))return!![];}if(_0x4dfe79['some'](_0x41156d=>{const _0x45a621=_0x4c77d8,_0x315d3c=_0x41156d[_0x45a621(0x25f)]();return _0x315d3c[_0x45a621(0x22a)]('mcp-server')||_0x315d3c['includes']('server-mcp')||_0x315d3c[_0x45a621(0x22a)](_0x45a621(0x221))||_0x315d3c===_0x45a621(0x23c)||_0x315d3c===_0x45a621(0x200);}))return!![];return![];}async function runProxy(_0x13b59f){const _0x711608=a0_0x56a941;if(_0x13b59f[_0x711608(0x1cb)]===0x0){program[_0x711608(0x24f)]();return;}const _0x59e316=_0x13b59f[0x0],_0x12de93=_0x13b59f[_0x711608(0x192)](0x1),_0x5cb446=_0x13b59f[_0x711608(0x218)]('\x20');if(isDisabled()){const _0x975f42=await(0x0,executor_1[_0x711608(0x1de)])(_0x59e316,_0x12de93);process[_0x711608(0x228)][_0x711608(0x1ef)](_0x975f42[_0x711608(0x228)]),process[_0x711608(0x1a4)][_0x711608(0x1ef)](_0x975f42['stderr']),process[_0x711608(0x1fb)](_0x975f42[_0x711608(0x247)]);}if(isMcpServerExecution(_0x59e316,_0x12de93)){console[_0x711608(0x211)](_0x711608(0x1ae));const {runMcpProxy:_0xfdba62}=await Promise[_0x711608(0x24c)]()['then'](()=>__importStar(require(_0x711608(0x201))));_0xfdba62(_0x59e316,_0x12de93);return;}const _0x221c98=adjustCommandArgs(_0x59e316,_0x12de93),_0x4071e1=await(0x0,executor_1['executeCommand'])(_0x221c98['cmd'],_0x221c98['args']),_0x43e01a=(0x0,filters_1[_0x711608(0x1fd)])(_0x5cb446,_0x4071e1[_0x711608(0x228)],_0x4071e1[_0x711608(0x1a4)],tracker_1[_0x711608(0x18e)][_0x711608(0x257)]()[_0x711608(0x1c0)]),_0x4ac5b1={...filters_1[_0x711608(0x1e9)]},_0x4dcf41=_0x4071e1['stdout']+(_0x4071e1['stderr']['trim']()[_0x711608(0x1cb)]>0x0?'\x0a'+_0x4071e1[_0x711608(0x1a4)]:''),_0x369cf5=_0x43e01a[_0x711608(0x1cb)]<_0x4dcf41[_0x711608(0x1cb)]?_0x43e01a:_0x4dcf41,_0x34710e=_0x4071e1[_0x711608(0x247)]===0x0?(0x0,cache_1[_0x711608(0x18b)])(_0x5cb446,_0x369cf5):null;tracker_1[_0x711608(0x18e)][_0x711608(0x250)](_0x5cb446,_0x4dcf41,_0x34710e||_0x369cf5,_0x4071e1[_0x711608(0x247)],_0x4ac5b1,[...filters_1[_0x711608(0x22d)]]),_0x4071e1[_0x711608(0x247)]===0x0?process[_0x711608(0x228)][_0x711608(0x1ef)](_0x369cf5+'\x0a'):(process['stdout'][_0x711608(0x1ef)](_0x43e01a+'\x0a'),_0x4071e1['stderr']['trim']()[_0x711608(0x1cb)]>0x0&&!_0x43e01a[_0x711608(0x22a)](_0x4071e1['stderr']['trim']())&&process[_0x711608(0x1a4)][_0x711608(0x1ef)](_0x4071e1[_0x711608(0x1a4)]+'\x0a')),process[_0x711608(0x1fb)](_0x4071e1[_0x711608(0x247)]);}function a0_0x58f0(_0x4914bc,_0x4bcef3){const _0x28cb26=a0_0x28cb();return a0_0x58f0=function(_0x58f04c,_0x19ce67){_0x58f04c=_0x58f04c-0x188;let _0x555c01=_0x28cb26[_0x58f04c];return _0x555c01;},a0_0x58f0(_0x4914bc,_0x4bcef3);}program['name'](a0_0x56a941(0x1b6))[a0_0x56a941(0x215)](a0_0x56a941(0x19c))[a0_0x56a941(0x1bf)](((()=>{const _0x171cad=a0_0x56a941,_0x3ba684=_0x171cad(0x208);if(_0x3ba684!=='__VERSION__')return _0x3ba684;try{return require(_0x171cad(0x1d7))[_0x171cad(0x1bf)];}catch{try{return require(_0x171cad(0x1c2))['version'];}catch{return _0x171cad(0x1d9);}}})())),program[a0_0x56a941(0x225)]('ui')[a0_0x56a941(0x1fa)](a0_0x56a941(0x1bb))['description'](a0_0x56a941(0x254))[a0_0x56a941(0x23b)]('-p,\x20--port\x20<number>',a0_0x56a941(0x18a),a0_0x56a941(0x219))[a0_0x56a941(0x23a)](_0x47b065=>{const _0x37bc55=a0_0x56a941,_0x1b8d70=parseInt(_0x47b065['port'],0xa);(0x0,dashboard_1[_0x37bc55(0x18c)])(_0x1b8d70);}),program[a0_0x56a941(0x225)](a0_0x56a941(0x259))[a0_0x56a941(0x215)]('Show\x20token\x20and\x20cost\x20savings\x20summary')[a0_0x56a941(0x23b)]('-m,\x20--model\x20<string>',a0_0x56a941(0x242),'claude-3-5-sonnet')['action'](_0x8ab78c=>{const _0x5578d9=a0_0x56a941,_0x468530=tracker_1[_0x5578d9(0x18e)][_0x5578d9(0x1dd)](_0x8ab78c['model']);console[_0x5578d9(0x1c3)](_0x5578d9(0x20c)),console['log'](_0x5578d9(0x1d4)),console[_0x5578d9(0x1c3)](_0x5578d9(0x1f2)),console[_0x5578d9(0x1c3)](_0x5578d9(0x1a9)+_0x468530[_0x5578d9(0x229)]),console['log'](_0x5578d9(0x1f4)+_0x468530[_0x5578d9(0x1a2)][_0x5578d9(0x1f8)]()),console['log']('Compressed:\x20\x20\x20\x20\x20\x20\x20\x20'+_0x468530[_0x5578d9(0x18d)][_0x5578d9(0x1f8)]()),console[_0x5578d9(0x1c3)](_0x5578d9(0x21f)+_0x468530['total_tokens_saved'][_0x5578d9(0x1f8)]()),console[_0x5578d9(0x1c3)]('Reduction\x20Rate:\x20\x20\x20\x20'+_0x468530[_0x5578d9(0x21a)]+'%'),console['log']('Estimated\x20Cost:\x20\x20\x20\x20$'+_0x468530[_0x5578d9(0x1a8)]['toFixed'](0x4)+_0x5578d9(0x19f)),console[_0x5578d9(0x1c3)](_0x5578d9(0x249)+_0x468530[_0x5578d9(0x235)][_0x5578d9(0x1ea)](0x4)+_0x5578d9(0x1a7)),console[_0x5578d9(0x1c3)]('---------------------------------------------'),console[_0x5578d9(0x1c3)](_0x5578d9(0x1f7)+_0x468530[_0x5578d9(0x22b)][_0x5578d9(0x1ea)](0x4)+_0x5578d9(0x232)),console[_0x5578d9(0x1c3)](_0x5578d9(0x1d2));}),program[a0_0x56a941(0x225)](a0_0x56a941(0x25b))['description']('Manage\x20local\x20configuration\x20parameters')[a0_0x56a941(0x1e6)](a0_0x56a941(0x190),a0_0x56a941(0x195))['argument'](a0_0x56a941(0x1f5),a0_0x56a941(0x213))[a0_0x56a941(0x1e6)](a0_0x56a941(0x21e),a0_0x56a941(0x1a1))[a0_0x56a941(0x23a)]((_0x5455bc,_0x7b8e8f,_0xe5816f)=>{const _0x2f5add=a0_0x56a941;if(_0x5455bc===_0x2f5add(0x21c)){const _0x45d488=tracker_1[_0x2f5add(0x18e)]['getConfig']();console[_0x2f5add(0x1c3)](_0x7b8e8f+':\x20'+_0x45d488[_0x7b8e8f]);}else{if(_0x5455bc==='set'){_0xe5816f===undefined&&(console[_0x2f5add(0x211)](_0x2f5add(0x1d6)),process['exit'](0x1));let _0xe1032e=_0xe5816f;if(_0xe5816f===_0x2f5add(0x239))_0xe1032e=!![];if(_0xe5816f===_0x2f5add(0x1e2))_0xe1032e=![];if(/^\d+$/[_0x2f5add(0x25e)](_0xe5816f))_0xe1032e=parseInt(_0xe5816f,0xa);tracker_1['tracker'][_0x2f5add(0x237)](_0x7b8e8f,_0xe1032e),console[_0x2f5add(0x1c3)](_0x2f5add(0x1d5)+_0x7b8e8f+'\x20=\x20'+_0xe5816f);}else console[_0x2f5add(0x211)]('Error:\x20Action\x20must\x20be\x20get\x20or\x20set'),process[_0x2f5add(0x1fb)](0x1);}});function printMessage(_0xc2988f){const _0x58164e=a0_0x56a941;if(process[_0x58164e(0x1e1)][_0x58164e(0x214)]===_0x58164e(0x204))try{const _0x1fc40d=require('fs'),_0x525868=process['platform']===_0x58164e(0x1f0)?_0x58164e(0x1f6):'/dev/tty';_0x1fc40d['writeFileSync'](_0x525868,'\x0a'+_0xc2988f+'\x0a');return;}catch{}console[_0x58164e(0x1c3)](_0xc2988f);}program['command'](a0_0x56a941(0x1af))[a0_0x56a941(0x215)]('Install\x20or\x20uninstall\x20system\x20command\x20shims')[a0_0x56a941(0x1e6)](a0_0x56a941(0x190),a0_0x56a941(0x1e3))['action'](_0x125124=>{const _0x44c1fa=a0_0x56a941;if(_0x125124==='install'){const _0x1ec11c=(0x0,shims_1[_0x44c1fa(0x207)])();printMessage(_0x1ec11c['message']);}else{if(_0x125124===_0x44c1fa(0x1c8)){const _0x4866fc=(0x0,shims_1['uninstallShims'])();printMessage(_0x4866fc['message']);}else console[_0x44c1fa(0x211)]('Error:\x20Action\x20must\x20be\x20install\x20or\x20uninstall'),process[_0x44c1fa(0x1fb)](0x1);}}),program[a0_0x56a941(0x225)](a0_0x56a941(0x24b))[a0_0x56a941(0x215)](a0_0x56a941(0x238))[a0_0x56a941(0x1e6)](a0_0x56a941(0x1ad),a0_0x56a941(0x220))['action'](_0x34e220=>{const _0x392031=a0_0x56a941;if(isDisabled()){console[_0x392031(0x1c3)](_0x34e220);return;}const _0x552476=(0x0,filters_1['rewriteCommand'])(_0x34e220);console[_0x392031(0x1c3)](_0x552476);}),program[a0_0x56a941(0x225)]('proxy\x20[action]')[a0_0x56a941(0x215)](a0_0x56a941(0x231))[a0_0x56a941(0x23b)](a0_0x56a941(0x223),'Port\x20to\x20listen\x20on',a0_0x56a941(0x23d))[a0_0x56a941(0x23a)](async(_0x3a1474,_0x348e95)=>{const _0x475418=a0_0x56a941,_0x3f71ad=parseInt(_0x348e95['port'])||0x1f90;if(!_0x3a1474||_0x3a1474===_0x475418(0x22f)){const {startApiProxy:_0x38d56a}=await Promise[_0x475418(0x24c)]()[_0x475418(0x226)](()=>__importStar(require(_0x475418(0x1e5))));_0x38d56a(_0x3f71ad);}else{if(_0x3a1474==='install'){const {startProxyDaemon:_0x48d80a,setAnthropicBaseUrl:_0x4725f0,enableAutostart:_0x838df9}=await Promise[_0x475418(0x24c)]()[_0x475418(0x226)](()=>__importStar(require(_0x475418(0x1ba)))),_0x191b4b=_0x48d80a(_0x3f71ad);_0x191b4b[_0x475418(0x1a5)]?(_0x4725f0(_0x191b4b[_0x475418(0x1c4)]),_0x838df9(),console['log'](_0x475418(0x22c)+_0x191b4b['pid']+')\x20on\x20port\x20'+_0x191b4b[_0x475418(0x1c4)]),console[_0x475418(0x1c3)](_0x475418(0x20a)+_0x191b4b[_0x475418(0x1c4)]),console[_0x475418(0x1c3)](_0x475418(0x19b)),console[_0x475418(0x1c3)](_0x475418(0x1db))):console['error'](_0x475418(0x24a)+_0x191b4b[_0x475418(0x1ab)]);}else{if(_0x3a1474===_0x475418(0x1ac)){const {stopProxyDaemon:_0x3734f0}=await Promise['resolve']()[_0x475418(0x226)](()=>__importStar(require('./proxy-daemon'))),_0x3d1090=_0x3734f0();console[_0x475418(0x1c3)](_0x475418(0x24a)+_0x3d1090[_0x475418(0x1ab)]);}else{if(_0x3a1474===_0x475418(0x1c8)){const {stopProxyDaemon:_0x3daf95,removeAnthropicBaseUrl:_0x40294a,disableAutostart:_0xb3c485}=await Promise[_0x475418(0x24c)]()['then'](()=>__importStar(require('./proxy-daemon')));_0x3daf95(),_0x40294a(),_0xb3c485(),console[_0x475418(0x1c3)]('[TrimPrompt]\x20API\x20proxy\x20stopped,\x20autostart\x20removed,\x20ANTHROPIC_BASE_URL\x20cleared.');}else{if(_0x3a1474==='status'){const {isProxyRunning:_0x253533}=await Promise[_0x475418(0x24c)]()[_0x475418(0x226)](()=>__importStar(require(_0x475418(0x1ba)))),_0x558396=_0x253533();_0x558396[_0x475418(0x25c)]?console[_0x475418(0x1c3)](_0x475418(0x244)+_0x558396[_0x475418(0x1c9)]+_0x475418(0x18f)+_0x558396[_0x475418(0x1c4)]):console[_0x475418(0x1c3)](_0x475418(0x19d));}}}}}}),program[a0_0x56a941(0x225)](a0_0x56a941(0x191))['description'](a0_0x56a941(0x1ff))[a0_0x56a941(0x23b)](a0_0x56a941(0x223),a0_0x56a941(0x1f9),a0_0x56a941(0x23d))[a0_0x56a941(0x23a)](async(_0x714fb2,_0x30e095)=>{const _0x53a6f3=a0_0x56a941,_0x2de5b5=parseInt(_0x30e095[_0x53a6f3(0x1c4)])||0x1f90,{startTrafficInterceptor:_0x1aedfe,installSystemCaCert:_0x75631,enableSystemProxy:_0x35ee6d,disableSystemProxy:_0x100c0d}=await Promise[_0x53a6f3(0x24c)]()['then'](()=>__importStar(require(_0x53a6f3(0x21b))));if(!_0x714fb2||_0x714fb2===_0x53a6f3(0x22f))_0x1aedfe(_0x2de5b5);else{if(_0x714fb2===_0x53a6f3(0x1fe))_0x75631(),_0x35ee6d(_0x2de5b5),console[_0x53a6f3(0x1c3)]('[TrimPrompt\x20Traffic\x20Engine]\x20System-wide\x20traffic\x20interception\x20enabled\x20on\x20127.0.0.1:'+_0x2de5b5),console[_0x53a6f3(0x1c3)]('[TrimPrompt\x20Traffic\x20Engine]\x20Root\x20CA\x20Certificate\x20installed\x20in\x20Windows\x20Trusted\x20Store.');else _0x714fb2===_0x53a6f3(0x1c8)&&(_0x100c0d(),console[_0x53a6f3(0x1c3)](_0x53a6f3(0x1d0)));}}),program[a0_0x56a941(0x225)]('watcher\x20[action]')['description'](a0_0x56a941(0x255))['action'](async _0x23dade=>{const _0x6993ba=a0_0x56a941,{startWatcherDaemon:_0x8e1ee5}=await Promise[_0x6993ba(0x24c)]()['then'](()=>__importStar(require(_0x6993ba(0x1bc))));(!_0x23dade||_0x23dade===_0x6993ba(0x22f)||_0x23dade==='install')&&_0x8e1ee5();}),program[a0_0x56a941(0x225)](a0_0x56a941(0x1c7))['description'](a0_0x56a941(0x230))[a0_0x56a941(0x23a)](async _0x2e6783=>{const _0x26927f=a0_0x56a941,{retrieveChunk:_0x5ea6fe}=await Promise[_0x26927f(0x24c)]()[_0x26927f(0x226)](()=>__importStar(require(_0x26927f(0x1e4)))),_0x44a6e7=_0x5ea6fe(_0x2e6783);_0x44a6e7?console['log'](_0x44a6e7[_0x26927f(0x1b8)]):(console['error'](_0x26927f(0x1f1)+_0x2e6783+_0x26927f(0x198)),process[_0x26927f(0x1fb)](0x1));}),program[a0_0x56a941(0x225)](a0_0x56a941(0x212))['description'](a0_0x56a941(0x210))[a0_0x56a941(0x23a)](async _0x59f7f6=>{const _0x46dd35=a0_0x56a941,{getLatestSessionFile:_0x327c8a,processSessionFile:_0x1de1d1}=await Promise[_0x46dd35(0x24c)]()['then'](()=>__importStar(require(_0x46dd35(0x1bc)))),_0x14dbfe=await Promise['resolve']()[_0x46dd35(0x226)](()=>__importStar(require('fs'))),_0x1ab679=await Promise[_0x46dd35(0x24c)]()[_0x46dd35(0x226)](()=>__importStar(require(_0x46dd35(0x25a))));let _0x38df9b=_0x59f7f6;if(!_0x59f7f6||!_0x14dbfe[_0x46dd35(0x1a6)](_0x59f7f6)){const _0x51e3f7=_0x327c8a('claude');_0x38df9b=_0x51e3f7[_0x46dd35(0x227)];}if(_0x38df9b&&_0x14dbfe[_0x46dd35(0x1a6)](_0x38df9b)){const _0x1c2330=_0x1ab679['extname'](_0x38df9b),_0x38500c=_0x1ab679['dirname'](_0x38df9b),_0x5716b1=_0x1ab679[_0x46dd35(0x202)](_0x38df9b,_0x1c2330),_0x577410=_0x1ab679[_0x46dd35(0x218)](_0x38500c,_0x5716b1+_0x46dd35(0x209)+_0x1c2330);_0x14dbfe[_0x46dd35(0x243)](_0x38df9b,_0x577410),_0x1de1d1(_0x577410,_0x46dd35(0x1d3)),console[_0x46dd35(0x1c3)](_0x46dd35(0x1e7)),console['log'](_0x46dd35(0x251)+_0x38df9b),console[_0x46dd35(0x1c3)](_0x46dd35(0x20b)+_0x577410),console[_0x46dd35(0x1c3)](_0x46dd35(0x216)),console['log'](_0x46dd35(0x1be)+_0x577410+'\x22\x0a');}else console[_0x46dd35(0x211)](_0x46dd35(0x197));});function a0_0x28cb(){const _0x3e47af=['[TrimPrompt]\x20Autostart\x20registered\x20โ\x20proxy\x20will\x20relaunch\x20on\x20every\x20login.','TrimPrompt.ai\x20-\x20Reduce\x20LLM\x20token\x20consumption\x20by\x2060-90%','[TrimPrompt]\x20API\x20proxy\x20is\x20not\x20running.','configurable','\x20(before\x20Trim)','--merges','value\x20to\x20set','total_raw_tokens','writable','stderr','success','existsSync','\x20(after\x20Trim)','raw_cost_usd','Model\x20Context:\x20\x20\x20\x20\x20','status','message','stop','<commandLine>','[TrimPrompt]\x20Autodetected\x20MCP\x20server\x20execution.\x20Activating\x20real-time\x20JSON-RPC\x20proxy...','shims','__setModuleDefault','./tracker','--no-merges','Command','3413090zVydav','-bs','trim','create','raw_payload','9006TpVFyo','./proxy-daemon','dashboard','./file-watcher','git','\x20\x20claude\x20--resume\x20\x22','version','redaction_enabled','--format','./package.json','log','port','call','compact','retrieve\x20<chunkId>','uninstall','pid','9327XeNVkf','length','yadm','mcp-server','default','./filters','[TrimPrompt\x20Traffic\x20Engine]\x20System-wide\x20traffic\x20interception\x20disabled.','push','=============================================\x0a','claude','\x20\x20\x20\x20\x20\x20\x20TRIMPROMPT.AI\x20SAVINGS\x20SUMMARY\x20\x20\x20\x20\x20\x20\x20\x20','Config\x20set\x20','Error:\x20Value\x20required\x20for\x20set\x20action','../package.json','defineProperty','1.0.0','657503OVDYob','[TrimPrompt]\x20Restart\x20your\x20terminal\x20for\x20the\x20env\x20var\x20to\x20take\x20effect.','every','getStatsSummary','executeCommand','--version','__esModule','env','false','install\x20or\x20uninstall','./cache-manager','./api-proxy','argument','\x0a[TrimPrompt\x20Compact]\x20Clean\x20compressed\x20session\x20generated\x20successfully!','./shims','lastRedactAudit','toFixed','traffic','yarn','--help','75EUkTpp','write','win32','[TrimPrompt\x20Cache]\x20Chunk\x20\x27','=============================================','./cache','Raw\x20Tokens:\x20\x20\x20\x20\x20\x20\x20\x20','<key>','\x5c\x5c.\x5cCON','Money\x20Saved:\x20\x20\x20\x20\x20\x20\x20$','toLocaleString','Port\x20to\x20listen\x20on','alias','exit','modelcontextprotocol','compressOutput','install','Live\x20traffic-level\x20interceptor\x20engine\x20โ\x20install\x20(system\x20proxy\x20+\x20SSL\x20Root\x20CA),\x20uninstall,\x20start','mcp','./mcp','basename','startsWith','postinstall','--pretty','platform','installShims','1.0.31','.compact','[TrimPrompt]\x20ANTHROPIC_BASE_URL\x20set\x20to\x20http://127.0.0.1:','Compact\x20session\x20copy:\x20','\x0a=============================================','commander','72sqjCqh','server','Generate\x20a\x20clean,\x20compressed\x20copy\x20of\x20a\x20conversation\x20session\x20file\x20for\x20safe\x20resume','error','compact\x20[sessionId]','config\x20parameter\x20name','npm_lifecycle_event','description','\x0aTo\x20resume\x20with\x20lightweight\x20context,\x20execute:','269685FiJLkh','join','4000','savings_percentage','./traffic-interceptor','get','60AaqhCv','[value]','Tokens\x20Saved:\x20\x20\x20\x20\x20\x20','Command\x20line\x20to\x20evaluate','@modelcontextprotocol/','npx','-p,\x20--port\x20<port>','--oneline','command','then','fullPath','stdout','model_name','includes','money_saved_usd','[TrimPrompt]\x20API\x20proxy\x20started\x20in\x20background\x20(pid\x20','lastFeatures','prototype','start','Retrieve\x20raw\x20offloaded\x20content\x20chunk\x20from\x20local\x20side-cache','Claude\x20API\x20proxy\x20โ\x20start\x20(foreground),\x20install\x20(background\x20daemon),\x20stop,\x20status,\x20uninstall','\x20USD','node','284sadkbR','compressed_cost_usd','TRIMPROMPT_DISABLED','setConfig','Check\x20a\x20command\x20line\x20and\x20return\x20the\x20optimized\x20command\x20line','true','action','option','mcp-proxy','8080','-50','2481059CQuMBG','hasOwnProperty','./executor','Select\x20pricing\x20model\x20(e.g.\x20claude-3-5-sonnet,\x20gpt-4o)','copyFileSync','[TrimPrompt]\x20API\x20proxy\x20running\x20(pid\x20','419595ldwFLI','catch','exitCode','some','Actual\x20Cost:\x20\x20\x20\x20\x20\x20\x20$','[TrimPrompt]\x20','rewrite','resolve','proxy','18nWIJOy','help','logExecution','Original\x20file\x20untouched:\x20','watcher','-10','Start\x20the\x20local\x20developer\x20dashboard','Live\x20conversation\x20file-watcher\x20daemon\x20โ\x20start,\x20install','--porcelain','getConfig','--pretty=format:%h\x20%s\x20(%ar)\x20(%an)%n%b%n---END---','stats','path','config','running','bun','test','toLowerCase','--max-count','getOwnPropertyNames','parse','Port\x20to\x20run\x20the\x20dashboard\x20on','dedup','startDashboard','total_compressed_tokens','tracker',')\x20on\x20port\x20','<action>','traffic\x20[action]','slice','__createBinding','__importStar','get\x20or\x20set','./dashboard','[TrimPrompt\x20Compact]\x20Could\x20not\x20find\x20session\x20file.','\x27\x20not\x20found\x20or\x20expired.','argv','getOwnPropertyDescriptor'];a0_0x28cb=function(){return _0x3e47af;};return a0_0x28cb();}const args=process[a0_0x56a941(0x199)][a0_0x56a941(0x192)](0x2),firstArg=args[0x0],subcommands=['ui',a0_0x56a941(0x1bb),'stats',a0_0x56a941(0x25b),a0_0x56a941(0x1af),a0_0x56a941(0x24b),'proxy',a0_0x56a941(0x23c),a0_0x56a941(0x200),a0_0x56a941(0x1eb),a0_0x56a941(0x252),'retrieve',a0_0x56a941(0x1c6),a0_0x56a941(0x24f),a0_0x56a941(0x1ed),'-h',a0_0x56a941(0x1bf),a0_0x56a941(0x1df),'-v'];firstArg&&!subcommands['includes'](firstArg)?runProxy(args)[a0_0x56a941(0x246)](_0x3f9f8e=>{const _0x2d2c0f=a0_0x56a941;console[_0x2d2c0f(0x211)]('[TrimPrompt]\x20Fatal\x20Proxy\x20Error:\x20'+_0x3f9f8e[_0x2d2c0f(0x1ab)]),process['exit'](0x1);}):program[a0_0x56a941(0x189)](process['argv']);
|
package/dashboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a0_0xcf8c05=a0_0x3e5d;(function(_0x4d4e24,_0x23bbb5){const _0x1c5d3f=a0_0x3e5d,_0x2e5229=_0x4d4e24();while(!![]){try{const _0x9096c9=-parseInt(_0x1c5d3f(0xa5))/0x1+-parseInt(_0x1c5d3f(0xb6))/0x2+parseInt(_0x1c5d3f(0xc5))/0x3*(-parseInt(_0x1c5d3f(0xac))/0x4)+parseInt(_0x1c5d3f(0xc8))/0x5+-parseInt(_0x1c5d3f(0xd1))/0x6+-parseInt(_0x1c5d3f(0x9b))/0x7+parseInt(_0x1c5d3f(0xdd))/0x8;if(_0x9096c9===_0x23bbb5)break;else _0x2e5229['push'](_0x2e5229['shift']());}catch(_0x5711d0){_0x2e5229['push'](_0x2e5229['shift']());}}}(a0_0x3387,0x53ccf));var __createBinding=this&&this['__createBinding']||(Object[a0_0xcf8c05(0xb3)]?function(_0xc6eda2,_0x19effe,_0xa29698,_0x563bc0){const _0x4ccf75=a0_0xcf8c05;if(_0x563bc0===undefined)_0x563bc0=_0xa29698;var _0x2cff91=Object[_0x4ccf75(0xe1)](_0x19effe,_0xa29698);(!_0x2cff91||(_0x4ccf75(0xbd)in _0x2cff91?!_0x19effe[_0x4ccf75(0xea)]:_0x2cff91[_0x4ccf75(0xd5)]||_0x2cff91[_0x4ccf75(0x9e)]))&&(_0x2cff91={'enumerable':!![],'get':function(){return _0x19effe[_0xa29698];}}),Object['defineProperty'](_0xc6eda2,_0x563bc0,_0x2cff91);}:function(_0x384742,_0x551512,_0x51ddcf,_0x55e9c2){if(_0x55e9c2===undefined)_0x55e9c2=_0x51ddcf;_0x384742[_0x55e9c2]=_0x551512[_0x51ddcf];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(_0x564ea6,_0x393d24){const _0x38fcfc=a0_0xcf8c05;Object['defineProperty'](_0x564ea6,_0x38fcfc(0xd4),{'enumerable':!![],'value':_0x393d24});}:function(_0x4c37bc,_0x42fb1e){const _0x45960e=a0_0xcf8c05;_0x4c37bc[_0x45960e(0xd4)]=_0x42fb1e;}),__importStar=this&&this[a0_0xcf8c05(0xb9)]||(function(){var _0x5e7ebe=function(_0x13a381){const _0x238137=a0_0x3e5d;return _0x5e7ebe=Object[_0x238137(0xb5)]||function(_0x13adcc){const _0x391bff=_0x238137;var _0x42fd50=[];for(var _0x32cf01 in _0x13adcc)if(Object[_0x391bff(0xe7)][_0x391bff(0xca)][_0x391bff(0xbf)](_0x13adcc,_0x32cf01))_0x42fd50[_0x42fd50[_0x391bff(0xdf)]]=_0x32cf01;return _0x42fd50;},_0x5e7ebe(_0x13a381);};return function(_0xba31e0){const _0x282308=a0_0x3e5d;if(_0xba31e0&&_0xba31e0[_0x282308(0xea)])return _0xba31e0;var _0x417eb0={};if(_0xba31e0!=null){for(var _0xdba8e1=_0x5e7ebe(_0xba31e0),_0x164faf=0x0;_0x164faf<_0xdba8e1[_0x282308(0xdf)];_0x164faf++)if(_0xdba8e1[_0x164faf]!==_0x282308(0xd4))__createBinding(_0x417eb0,_0xba31e0,_0xdba8e1[_0x164faf]);}return __setModuleDefault(_0x417eb0,_0xba31e0),_0x417eb0;};}()),__importDefault=this&&this['__importDefault']||function(_0x5c14c7){return _0x5c14c7&&_0x5c14c7['__esModule']?_0x5c14c7:{'default':_0x5c14c7};};function a0_0x3387(){const _0x42c3d8=['join','.raw.txt','/favicon.png','setAnthropicBaseUrl','post','isProxyRunning','121759xQHfyR','message','includes','getStatsSummary','params','isArray','tokens_saved','8612iFCAMY','utf8','estimated_compressed_tokens','use','\x0a[TrimPrompt]\x20Dashboard\x20server\x20started\x20at:\x20','json','toFixed','create','port','getOwnPropertyNames','917078srQPae','express','getLogs','__importStar','listen','catch','startProxyDaemon','get','command','call','model_name','defineProperty','estimated_raw_tokens','open','setConfig','360fMWNay','/api/proxy/status','auto','3233585jfJzOL','existsSync','hasOwnProperty','total_raw_tokens','sendFile','features','features_enabled','error','/api/stats/proxy-summary','2910354AEXhlV','index.html','raw_cost_usd','default','writable','path','disableAutostart','proxy:','query','homedir','../src/index.html','model_used','10928792zcLdAm','.comp.txt','length','/api/proxy/start','getOwnPropertyDescriptor','tracker','.trimprompt','/api/config/features','../src/favicon.png','enableAutostart','prototype','model','body','__esModule','log','favicon.png','Compressed\x20output\x20log\x20file\x20not\x20found.','startsWith','2420964pOcKFi','readFileSync','EADDRINUSE','configurable'];a0_0x3387=function(){return _0x42c3d8;};return a0_0x3387();}Object[a0_0xcf8c05(0xc1)](exports,a0_0xcf8c05(0xea),{'value':!![]}),exports['startDashboard']=startDashboard;const express_1=__importDefault(require(a0_0xcf8c05(0xb7))),path=__importStar(require(a0_0xcf8c05(0xd6))),fs=__importStar(require('fs')),os=__importStar(require('os')),open_1=__importDefault(require(a0_0xcf8c05(0xc3))),tracker_1=require('./tracker'),proxy_daemon_1=require('./proxy-daemon'),app=(0x0,express_1[a0_0xcf8c05(0xd4)])();app[a0_0xcf8c05(0xaf)](express_1[a0_0xcf8c05(0xd4)][a0_0xcf8c05(0xb1)]());const baseDir=path[a0_0xcf8c05(0x9f)](os[a0_0xcf8c05(0xda)](),a0_0xcf8c05(0xe3)),logsDir=path[a0_0xcf8c05(0x9f)](baseDir,'logs');app[a0_0xcf8c05(0xbd)]('/',(_0x1320b2,_0x46ecd9)=>{const _0x3f4b30=a0_0xcf8c05,_0x48c09a=path['join'](__dirname,_0x3f4b30(0xd2));fs['existsSync'](_0x48c09a)?_0x46ecd9['sendFile'](_0x48c09a):_0x46ecd9['sendFile'](path[_0x3f4b30(0x9f)](__dirname,_0x3f4b30(0xdb)));}),app[a0_0xcf8c05(0xbd)](a0_0xcf8c05(0xa1),(_0x388910,_0x4b6cbe)=>{const _0x250d89=a0_0xcf8c05,_0x43d816=path['join'](__dirname,_0x250d89(0x98));fs[_0x250d89(0xc9)](_0x43d816)?_0x4b6cbe[_0x250d89(0xcc)](_0x43d816):_0x4b6cbe['sendFile'](path[_0x250d89(0x9f)](__dirname,_0x250d89(0xe5)));}),app[a0_0xcf8c05(0xbd)]('/api/stats/summary',(_0x54c253,_0x47fde9)=>{const _0x1f64a0=a0_0xcf8c05,_0x57c82c=_0x54c253[_0x1f64a0(0xd9)][_0x1f64a0(0xe8)]||_0x1f64a0(0xc7),_0x4ce72b=tracker_1[_0x1f64a0(0xe2)][_0x1f64a0(0xa8)](_0x57c82c);_0x47fde9['json'](_0x4ce72b);}),app[a0_0xcf8c05(0xbd)]('/api/stats/history',(_0x4c7975,_0x32ed06)=>{const _0x3ffe7b=a0_0xcf8c05,_0x5673af=tracker_1[_0x3ffe7b(0xe2)]['getLogs']();_0x32ed06[_0x3ffe7b(0xb1)](_0x5673af);}),app[a0_0xcf8c05(0xbd)]('/api/stats/inspect/:id',(_0x581de2,_0x15cfa5)=>{const _0x4551b6=a0_0xcf8c05,_0x57992c=_0x581de2[_0x4551b6(0xa9)]['id'],_0x5a6056=path[_0x4551b6(0x9f)](logsDir,_0x57992c+_0x4551b6(0xa0)),_0x3af91c=path['join'](logsDir,_0x57992c+_0x4551b6(0xde));let _0x5ddffc='Raw\x20output\x20log\x20file\x20not\x20found.',_0x5293ad=_0x4551b6(0x99);try{fs['existsSync'](_0x5a6056)&&(_0x5ddffc=fs[_0x4551b6(0x9c)](_0x5a6056,_0x4551b6(0xad))),fs['existsSync'](_0x3af91c)&&(_0x5293ad=fs[_0x4551b6(0x9c)](_0x3af91c,_0x4551b6(0xad)));}catch(_0x34f7d0){}_0x15cfa5[_0x4551b6(0xb1)]({'id':_0x57992c,'raw':_0x5ddffc,'compressed':_0x5293ad});}),app[a0_0xcf8c05(0xbd)]('/api/config/features',(_0xb6cbce,_0x53bce0)=>{const _0x397bff=a0_0xcf8c05,_0x1faa4c=tracker_1[_0x397bff(0xe2)]['getConfig']();_0x53bce0[_0x397bff(0xb1)](_0x1faa4c[_0x397bff(0xce)]||{});}),app[a0_0xcf8c05(0xa3)](a0_0xcf8c05(0xe4),(_0x1c29d8,_0x27b3ca)=>{const _0x264779=a0_0xcf8c05,_0x3ad963=_0x1c29d8[_0x264779(0xe9)];tracker_1[_0x264779(0xe2)][_0x264779(0xc4)](_0x264779(0xce),_0x3ad963),_0x27b3ca[_0x264779(0xb1)]({'ok':!![]});}),app[a0_0xcf8c05(0xbd)](a0_0xcf8c05(0xd0),(_0x5d0086,_0x3b43ea)=>{const _0x998974=a0_0xcf8c05;try{const _0x32bdda=tracker_1[_0x998974(0xe2)][_0x998974(0xb8)](),_0x14b227=_0x5e562e=>Array[_0x998974(0xaa)](_0x5e562e[_0x998974(0xcd)])&&(_0x5e562e['features'][_0x998974(0xa7)]('conv_compress')||_0x5e562e['features'][_0x998974(0xa7)]('resp_optimize'))||typeof _0x5e562e[_0x998974(0xbe)]==='string'&&_0x5e562e[_0x998974(0xbe)][_0x998974(0x9a)](_0x998974(0xd8));let _0x2d8db1=0x0,_0x3fa3c2=0x0,_0x5614bf=0x0,_0x24ec4c=0x0,_0x319c5c='';for(const _0x33e7be of _0x32bdda){if(!_0x14b227(_0x33e7be))continue;_0x2d8db1+=_0x33e7be[_0x998974(0xc2)]||0x0,_0x3fa3c2+=_0x33e7be[_0x998974(0xae)]||0x0,_0x5614bf+=_0x33e7be[_0x998974(0xab)]||0x0,_0x24ec4c++;if(_0x33e7be[_0x998974(0xdc)])_0x319c5c=_0x33e7be[_0x998974(0xdc)];}const _0x1b63f5=_0x5d0086[_0x998974(0xd9)][_0x998974(0xe8)]||_0x319c5c||_0x998974(0xc7),_0x1c8927=tracker_1[_0x998974(0xe2)][_0x998974(0xa8)](_0x1b63f5),_0x2c162e=_0x1c8927[_0x998974(0xcb)]>0x0?_0x1c8927[_0x998974(0xd3)]/_0x1c8927[_0x998974(0xcb)]:0x0,_0x406af5=_0x2d8db1>0x0?_0x5614bf/_0x2d8db1*0x64:0x0;_0x3b43ea[_0x998974(0xb1)]({'requests':_0x24ec4c,'total_raw_tokens':_0x2d8db1,'total_compressed_tokens':_0x3fa3c2,'total_tokens_saved':_0x5614bf,'savings_percentage':parseFloat(_0x406af5[_0x998974(0xb2)](0x1)),'money_saved_usd':parseFloat((_0x5614bf*_0x2c162e)[_0x998974(0xb2)](0x4)),'model_name':_0x1c8927[_0x998974(0xc0)],'model_key':_0x1c8927['model_key']});}catch(_0x420462){_0x3b43ea[_0x998974(0xb1)]({'requests':0x0,'total_raw_tokens':0x0,'total_compressed_tokens':0x0,'total_tokens_saved':0x0,'savings_percentage':0x0,'money_saved_usd':0x0});}}),app[a0_0xcf8c05(0xbd)](a0_0xcf8c05(0xc6),(_0x1cf638,_0x49c8e7)=>{const _0x57a16b=a0_0xcf8c05;_0x49c8e7['json']((0x0,proxy_daemon_1[_0x57a16b(0xa4)])());}),app[a0_0xcf8c05(0xa3)](a0_0xcf8c05(0xe0),(_0x4c6654,_0x1d499c)=>{const _0x3f1d5f=a0_0xcf8c05,_0x5d08ca=(0x0,proxy_daemon_1[_0x3f1d5f(0xbc)])();_0x5d08ca['success']&&_0x5d08ca[_0x3f1d5f(0xb4)]&&((0x0,proxy_daemon_1[_0x3f1d5f(0xa2)])(_0x5d08ca[_0x3f1d5f(0xb4)]),(0x0,proxy_daemon_1[_0x3f1d5f(0xe6)])()),_0x1d499c[_0x3f1d5f(0xb1)](_0x5d08ca);}),app[a0_0xcf8c05(0xa3)]('/api/proxy/stop',(_0x265baf,_0x11c175)=>{const _0x397b22=a0_0xcf8c05,_0x3f389c=(0x0,proxy_daemon_1['stopProxyDaemon'])();(0x0,proxy_daemon_1['removeAnthropicBaseUrl'])(),(0x0,proxy_daemon_1[_0x397b22(0xd7)])(),_0x11c175[_0x397b22(0xb1)](_0x3f389c);});function a0_0x3e5d(_0x558924,_0x1efbc1){_0x558924=_0x558924-0x97;const _0x33877f=a0_0x3387();let _0x3e5d9c=_0x33877f[_0x558924];return _0x3e5d9c;}function startDashboard(_0x52dbbf=0xfa0){const _0x573294=a0_0xcf8c05;let _0x4c58d5=_0x52dbbf;const _0x16630a=app[_0x573294(0xba)](_0x4c58d5,()=>{const _0x524b5c=_0x573294,_0xc87e7d='http://localhost:'+_0x4c58d5;console['log'](_0x524b5c(0xb0)+_0xc87e7d),console[_0x524b5c(0x97)]('Press\x20Ctrl+C\x20in\x20this\x20terminal\x20to\x20shut\x20down.'),process.env.TRIMPROMPT_NO_OPEN!=='1'&&(0x0,open_1[_0x524b5c(0xd4)])(_0xc87e7d)[_0x524b5c(0xbb)](()=>{});});_0x16630a['on']('error',_0x105d43=>{const _0x25f482=_0x573294;_0x105d43['code']===_0x25f482(0x9d)?startDashboard(_0x4c58d5+0x1):console[_0x25f482(0xcf)]('[TrimPrompt]\x20Dashboard\x20error:\x20'+_0x105d43[_0x25f482(0xa6)]);});}
|
|
1
|
+
'use strict';const a0_0x5b0501=a0_0x4bd9;function a0_0x4bd9(_0x18073a,_0x42a7a){const _0xf5338c=a0_0xf533();return a0_0x4bd9=function(_0x4bd949,_0x55df5b){_0x4bd949=_0x4bd949-0xa0;let _0x105f3a=_0xf5338c[_0x4bd949];return _0x105f3a;},a0_0x4bd9(_0x18073a,_0x42a7a);}(function(_0x36a39b,_0x7012d8){const _0x1e63d1=a0_0x4bd9,_0x1f806b=_0x36a39b();while(!![]){try{const _0x8d69e4=parseInt(_0x1e63d1(0xb7))/0x1+-parseInt(_0x1e63d1(0x10e))/0x2*(-parseInt(_0x1e63d1(0x11a))/0x3)+parseInt(_0x1e63d1(0xda))/0x4+-parseInt(_0x1e63d1(0xf3))/0x5*(parseInt(_0x1e63d1(0xc8))/0x6)+-parseInt(_0x1e63d1(0xa0))/0x7+parseInt(_0x1e63d1(0xec))/0x8+-parseInt(_0x1e63d1(0xfe))/0x9;if(_0x8d69e4===_0x7012d8)break;else _0x1f806b['push'](_0x1f806b['shift']());}catch(_0x512a21){_0x1f806b['push'](_0x1f806b['shift']());}}}(a0_0xf533,0xe6304));function a0_0xf533(){const _0x43a955=['includes','.trimprompt','tracker','fileName','message','copilot','mkdirSync','1329oXSopb','Missing\x20key','create','conv_compress','toFixed','platform','activeSavedTokens','utf8','/api/stats/history','__setModuleDefault','../src/index.html','7027580PaznvU','default','logs','disableAutostart','openclaw','Press\x20Ctrl+C\x20in\x20this\x20terminal\x20to\x20shut\x20down.','timestamp','sendFile','slice','claude','resolve','prototype','/api/config/custom-path','startDashboard','features_enabled','join','readFileSync','get','path','/api/config/features','post','startProxyDaemon','params','759113kWklyY','conv_','setConfig','logExecution','getOwnPropertyNames','estimated_raw_tokens','favicon.png','../src/favicon.png','writable','defineProperty','auto','Raw\x20output\x20log\x20file\x20not\x20found.','http://localhost:','cursor','model_used','aider','status','264xJqYja','__esModule','startsWith','env','tokens_saved','/api/config/open-dir','repeat','/favicon.png','catch','model_name','estimated_compressed_tokens','model_key','__importDefault','.comp.txt','log','.raw.txt','/api/proxy/status','./tracker','7087128eGqmwR','then','total_raw_tokens','./file-watcher','length','call','express','features','setAnthropicBaseUrl','__importStar','No\x20active\x20session\x20file\x20found','index.html','codex','error','getOwnPropertyDescriptor','resp_optimize','enableAutostart','EADDRINUSE','12116376lvkyGZ','__createBinding','listen','Compressed\x20output\x20log\x20file\x20not\x20found.','TRIMPROMPT_HEADLESS','opencode','fullPath','166870ppyUzN','gemini','getLogs','Missing\x20agentKey','homedir','getConfig','query','existsSync','argv','lastModified','cortex','10069407VMaqUd','live-conv','use','darwin','open\x20\x22','command','getStatsSummary','--headless','win32','conv:','raw_cost_usd','json','[TrimPrompt]\x20Dashboard\x20error:\x20','model','/api/proxy/stop','TRIMPROMPT_NO_OPEN','2206AsFkBB','Directory\x20not\x20found','filter','isProxyRunning','body'];a0_0xf533=function(){return _0x43a955;};return a0_0xf533();}var __createBinding=this&&this[a0_0x5b0501(0xed)]||(Object[a0_0x5b0501(0x11c)]?function(_0x3d2900,_0x2e7c8a,_0x35eb4e,_0x145398){const _0x2c1556=a0_0x5b0501;if(_0x145398===undefined)_0x145398=_0x35eb4e;var _0x1dbc6d=Object[_0x2c1556(0xe8)](_0x2e7c8a,_0x35eb4e);(!_0x1dbc6d||('get'in _0x1dbc6d?!_0x2e7c8a['__esModule']:_0x1dbc6d[_0x2c1556(0xbf)]||_0x1dbc6d['configurable']))&&(_0x1dbc6d={'enumerable':!![],'get':function(){return _0x2e7c8a[_0x35eb4e];}}),Object[_0x2c1556(0xc0)](_0x3d2900,_0x145398,_0x1dbc6d);}:function(_0x3988e4,_0x4b0123,_0xd0815b,_0x414a03){if(_0x414a03===undefined)_0x414a03=_0xd0815b;_0x3988e4[_0x414a03]=_0x4b0123[_0xd0815b];}),__setModuleDefault=this&&this[a0_0x5b0501(0x123)]||(Object[a0_0x5b0501(0x11c)]?function(_0x452691,_0x102e1a){const _0x5c0b25=a0_0x5b0501;Object[_0x5c0b25(0xc0)](_0x452691,_0x5c0b25(0xa1),{'enumerable':!![],'value':_0x102e1a});}:function(_0x48ce68,_0x370a32){const _0x596927=a0_0x5b0501;_0x48ce68[_0x596927(0xa1)]=_0x370a32;}),__importStar=this&&this[a0_0x5b0501(0xe3)]||(function(){var _0x4558f7=function(_0x3959f1){const _0x2f533a=a0_0x4bd9;return _0x4558f7=Object[_0x2f533a(0xbb)]||function(_0x4018b3){const _0x16e975=_0x2f533a;var _0x5932ca=[];for(var _0xf608a0 in _0x4018b3)if(Object[_0x16e975(0xab)]['hasOwnProperty'][_0x16e975(0xdf)](_0x4018b3,_0xf608a0))_0x5932ca[_0x5932ca['length']]=_0xf608a0;return _0x5932ca;},_0x4558f7(_0x3959f1);};return function(_0x3eaad5){const _0x563570=a0_0x4bd9;if(_0x3eaad5&&_0x3eaad5['__esModule'])return _0x3eaad5;var _0x2782c1={};if(_0x3eaad5!=null){for(var _0x4b648e=_0x4558f7(_0x3eaad5),_0x42116a=0x0;_0x42116a<_0x4b648e[_0x563570(0xde)];_0x42116a++)if(_0x4b648e[_0x42116a]!==_0x563570(0xa1))__createBinding(_0x2782c1,_0x3eaad5,_0x4b648e[_0x42116a]);}return __setModuleDefault(_0x2782c1,_0x3eaad5),_0x2782c1;};}()),__importDefault=this&&this[a0_0x5b0501(0xd4)]||function(_0x572fc4){const _0x22aea8=a0_0x5b0501;return _0x572fc4&&_0x572fc4[_0x22aea8(0xc9)]?_0x572fc4:{'default':_0x572fc4};};Object[a0_0x5b0501(0xc0)](exports,a0_0x5b0501(0xc9),{'value':!![]}),exports[a0_0x5b0501(0xad)]=startDashboard;const express_1=__importDefault(require(a0_0x5b0501(0xe0))),path=__importStar(require(a0_0x5b0501(0xb2))),fs=__importStar(require('fs')),os=__importStar(require('os')),open_1=__importDefault(require('open')),tracker_1=require(a0_0x5b0501(0xd9)),proxy_daemon_1=require('./proxy-daemon'),app=(0x0,express_1['default'])();app[a0_0x5b0501(0x100)](express_1[a0_0x5b0501(0xa1)]['json']());const baseDir=path[a0_0x5b0501(0xaf)](os[a0_0x5b0501(0xf7)](),a0_0x5b0501(0x114)),logsDir=path[a0_0x5b0501(0xaf)](baseDir,a0_0x5b0501(0xa2));app[a0_0x5b0501(0xb1)]('/',(_0x2db58f,_0x1350e6)=>{const _0x54ffce=a0_0x5b0501,_0x5bff5d=path['join'](__dirname,_0x54ffce(0xe5));fs[_0x54ffce(0xfa)](_0x5bff5d)?_0x1350e6['sendFile'](_0x5bff5d):_0x1350e6[_0x54ffce(0xa7)](path['join'](__dirname,_0x54ffce(0x124)));}),app[a0_0x5b0501(0xb1)](a0_0x5b0501(0xcf),(_0x417941,_0x471556)=>{const _0x13dbd9=a0_0x5b0501,_0x209000=path[_0x13dbd9(0xaf)](__dirname,_0x13dbd9(0xbd));fs['existsSync'](_0x209000)?_0x471556['sendFile'](_0x209000):_0x471556[_0x13dbd9(0xa7)](path[_0x13dbd9(0xaf)](__dirname,_0x13dbd9(0xbe)));}),app['get']('/api/stats/summary',(_0x24f37c,_0x191f6b)=>{const _0x4e5e48=a0_0x5b0501,_0x481be2=_0x24f37c[_0x4e5e48(0xf9)]['model']||'auto',_0x49023c=tracker_1[_0x4e5e48(0x115)][_0x4e5e48(0x104)](_0x481be2);_0x191f6b[_0x4e5e48(0x109)](_0x49023c);}),app[a0_0x5b0501(0xb1)](a0_0x5b0501(0x122),(_0x287750,_0x1fcce5)=>{const _0x403721=a0_0x5b0501,_0x1b5408=tracker_1[_0x403721(0x115)][_0x403721(0xf5)]();_0x1fcce5[_0x403721(0x109)](_0x1b5408[_0x403721(0xde)]>0x1f4?_0x1b5408[_0x403721(0xa8)](-0x1f4):_0x1b5408);}),app['get']('/api/stats/inspect/:id',(_0x28c972,_0x394588)=>{const _0x77ece2=a0_0x5b0501,_0x21e9ea=_0x28c972[_0x77ece2(0xb6)]['id'],_0x564e74=path[_0x77ece2(0xaf)](logsDir,_0x21e9ea+_0x77ece2(0xd7)),_0x1a6c5e=path[_0x77ece2(0xaf)](logsDir,_0x21e9ea+_0x77ece2(0xd5));let _0x1f0435=_0x77ece2(0xc2),_0xbd6080=_0x77ece2(0xef);try{fs[_0x77ece2(0xfa)](_0x564e74)&&(_0x1f0435=fs[_0x77ece2(0xb0)](_0x564e74,_0x77ece2(0x121))),fs[_0x77ece2(0xfa)](_0x1a6c5e)&&(_0xbd6080=fs['readFileSync'](_0x1a6c5e,_0x77ece2(0x121)));}catch(_0x5918a9){}_0x394588[_0x77ece2(0x109)]({'id':_0x21e9ea,'raw':_0x1f0435,'compressed':_0xbd6080});}),app[a0_0x5b0501(0xb1)](a0_0x5b0501(0xb3),(_0x523a40,_0x43729b)=>{const _0x34ffc5=a0_0x5b0501,_0x269dff=tracker_1['tracker'][_0x34ffc5(0xf8)]();_0x43729b[_0x34ffc5(0x109)](_0x269dff[_0x34ffc5(0xae)]||{});}),app['post'](a0_0x5b0501(0xb3),(_0x5f41ab,_0x5d0343)=>{const _0x27d220=a0_0x5b0501,_0x51368b=_0x5f41ab[_0x27d220(0x112)];tracker_1[_0x27d220(0x115)][_0x27d220(0xb9)](_0x27d220(0xae),_0x51368b),_0x5d0343[_0x27d220(0x109)]({'ok':!![]});}),app[a0_0x5b0501(0xb1)]('/api/stats/proxy-summary',(_0xb0b1cb,_0xab3909)=>{const _0x31710c=a0_0x5b0501;try{const _0x2087ed=tracker_1['tracker'][_0x31710c(0xf5)](),_0x43d325=_0x570a3e=>Array['isArray'](_0x570a3e[_0x31710c(0xe1)])&&(_0x570a3e[_0x31710c(0xe1)][_0x31710c(0x113)](_0x31710c(0x11d))||_0x570a3e[_0x31710c(0xe1)][_0x31710c(0x113)](_0x31710c(0xe9)))||typeof _0x570a3e['command']==='string'&&_0x570a3e[_0x31710c(0x103)][_0x31710c(0xca)]('proxy:');let _0x12fffd=0x0,_0x51f923=0x0,_0x234e8a=0x0,_0x40be11=0x0,_0x5996c3='';for(const _0x112436 of _0x2087ed){if(!_0x43d325(_0x112436))continue;_0x12fffd+=_0x112436[_0x31710c(0xbc)]||0x0,_0x51f923+=_0x112436[_0x31710c(0xd2)]||0x0,_0x234e8a+=_0x112436[_0x31710c(0xcc)]||0x0,_0x40be11++;if(_0x112436[_0x31710c(0xc5)])_0x5996c3=_0x112436[_0x31710c(0xc5)];}const _0x25a278=_0xb0b1cb[_0x31710c(0xf9)][_0x31710c(0x10b)]||_0x5996c3||_0x31710c(0xc1),_0xe43588=tracker_1[_0x31710c(0x115)]['getStatsSummary'](_0x25a278),_0x17e0cf=_0xe43588[_0x31710c(0xdc)]>0x0?_0xe43588[_0x31710c(0x108)]/_0xe43588[_0x31710c(0xdc)]:0x0,_0x369f29=_0x12fffd>0x0?_0x234e8a/_0x12fffd*0x64:0x0;_0xab3909[_0x31710c(0x109)]({'requests':_0x40be11,'total_raw_tokens':_0x12fffd,'total_compressed_tokens':_0x51f923,'total_tokens_saved':_0x234e8a,'savings_percentage':parseFloat(_0x369f29[_0x31710c(0x11e)](0x1)),'money_saved_usd':parseFloat((_0x234e8a*_0x17e0cf)[_0x31710c(0x11e)](0x4)),'model_name':_0xe43588[_0x31710c(0xd1)],'model_key':_0xe43588[_0x31710c(0xd3)]});}catch(_0x1ad2b8){_0xab3909['json']({'requests':0x0,'total_raw_tokens':0x0,'total_compressed_tokens':0x0,'total_tokens_saved':0x0,'savings_percentage':0x0,'money_saved_usd':0x0});}}),app['get'](a0_0x5b0501(0xd8),(_0x124f76,_0x22f25c)=>{const _0x5004d4=a0_0x5b0501;_0x22f25c['json']((0x0,proxy_daemon_1[_0x5004d4(0x111)])());}),app[a0_0x5b0501(0xb4)]('/api/proxy/start',(_0x1dbe45,_0x40a4f0)=>{const _0x11a726=a0_0x5b0501,_0x4592fe=(0x0,proxy_daemon_1[_0x11a726(0xb5)])();_0x4592fe['success']&&_0x4592fe['port']&&((0x0,proxy_daemon_1[_0x11a726(0xe2)])(_0x4592fe['port']),(0x0,proxy_daemon_1[_0x11a726(0xea)])()),_0x40a4f0[_0x11a726(0x109)](_0x4592fe);}),app[a0_0x5b0501(0xb4)](a0_0x5b0501(0x10c),(_0x5d7ae2,_0x4317dd)=>{const _0x147fce=a0_0x5b0501,_0x3c7520=(0x0,proxy_daemon_1['stopProxyDaemon'])();(0x0,proxy_daemon_1['removeAnthropicBaseUrl'])(),(0x0,proxy_daemon_1[_0x147fce(0xa3)])(),_0x4317dd[_0x147fce(0x109)](_0x3c7520);}),app['post']('/api/agent/compact',async(_0x159335,_0x39d11d)=>{const _0x383b51=a0_0x5b0501;try{const {getLatestSessionFile:_0x30a930,processSessionFile:_0x2a8018,loadSessionsState:_0x212bea}=await Promise[_0x383b51(0xaa)]()['then'](()=>__importStar(require(_0x383b51(0xdd)))),{agentKey:_0x5d52d6}=_0x159335['body']||{},_0x5ecc00=_0x5d52d6||_0x383b51(0xa9),_0x5ab205=_0x30a930(_0x5ecc00);if(_0x5ab205&&_0x5ab205[_0x383b51(0xf2)]&&fs[_0x383b51(0xfa)](_0x5ab205[_0x383b51(0xf2)])){_0x2a8018(_0x5ab205[_0x383b51(0xf2)],_0x5ecc00);const _0x246c9e=_0x212bea(),_0x52a400=_0x246c9e[_0x5ab205[_0x383b51(0xf2)]]&&_0x246c9e[_0x5ab205[_0x383b51(0xf2)]][_0x383b51(0x120)]>0x0?_0x246c9e[_0x5ab205['fullPath']]['activeSavedTokens']:0x5b108,_0x998335='x'[_0x383b51(0xce)]((_0x52a400+0x1f4)*0x4),_0xa01d96='x'['repeat'](0x1f4*0x4);tracker_1[_0x383b51(0x115)][_0x383b51(0xba)](_0x383b51(0x107)+_0x5ecc00,_0x998335,_0xa01d96,_0x52a400,undefined,[_0x383b51(0xb8)+_0x5ecc00,_0x383b51(0xff),_0x5ecc00]),_0x39d11d[_0x383b51(0x109)]({'ok':!![],'fileName':_0x5ab205[_0x383b51(0x116)],'tokensSaved':_0x52a400});}else _0x39d11d[_0x383b51(0x109)]({'ok':![],'message':_0x383b51(0xe4)});}catch(_0x2e6bb5){_0x39d11d[_0x383b51(0xc7)](0x1f4)[_0x383b51(0x109)]({'ok':![],'error':_0x2e6bb5[_0x383b51(0x117)]});}}),app['get']('/api/config',async(_0x47eff2,_0x84a3f)=>{const _0x56e3e9=a0_0x5b0501,{loadConfig:_0x174a7b,getAgentStoragePaths:_0xa85ced,getLatestSessionFile:_0x2d95b0,loadSessionsState:_0x190d38}=await Promise[_0x56e3e9(0xaa)]()[_0x56e3e9(0xdb)](()=>__importStar(require(_0x56e3e9(0xdd)))),_0x5d0ebe=_0x174a7b(),_0x4c90ec=['claude',_0x56e3e9(0xf4),_0x56e3e9(0xe6),_0x56e3e9(0xc4),_0x56e3e9(0xc6),_0x56e3e9(0x118),_0x56e3e9(0xa4),_0x56e3e9(0xf1),_0x56e3e9(0xfd)],_0x1bcacc={},_0x5a7b93={},_0x16bd49={},_0xb129ea=_0x190d38(),_0x12c7cb=tracker_1[_0x56e3e9(0x115)]['getLogs']()||[];for(const _0x42bd60 of _0x4c90ec){_0x1bcacc[_0x42bd60]=_0xa85ced(_0x42bd60);const _0x5d7bd5=_0x2d95b0(_0x42bd60);if(_0x5d7bd5&&_0x5d7bd5[_0x56e3e9(0xf2)]&&_0xb129ea[_0x5d7bd5[_0x56e3e9(0xf2)]])_0x5d7bd5[_0x56e3e9(0x120)]=_0xb129ea[_0x5d7bd5[_0x56e3e9(0xf2)]][_0x56e3e9(0x120)]||0x0;else{if(_0x5d7bd5)_0x5d7bd5[_0x56e3e9(0x120)]=0x0;}_0x16bd49[_0x42bd60]=_0x5d7bd5;const _0x4844fb=_0x12c7cb[_0x56e3e9(0x110)](_0x2923c0=>_0x2923c0[_0x56e3e9(0x103)]&&_0x2923c0['command'][_0x56e3e9(0x113)](_0x56e3e9(0x107)+_0x42bd60));_0x4844fb[_0x56e3e9(0xde)]>0x0?_0x5a7b93[_0x42bd60]=_0x4844fb[_0x4844fb[_0x56e3e9(0xde)]-0x1][_0x56e3e9(0xa6)]:_0x5a7b93[_0x42bd60]=_0x5d7bd5?_0x5d7bd5[_0x56e3e9(0xfc)]:null;}_0x84a3f[_0x56e3e9(0x109)]({..._0x5d0ebe,'resolvedPaths':_0x1bcacc,'lastActiveTimestamps':_0x5a7b93,'latestSessions':_0x16bd49});}),app[a0_0x5b0501(0xb4)](a0_0x5b0501(0xcd),async(_0x190935,_0x19e0de)=>{const _0x35f0be=a0_0x5b0501,{getAgentStoragePaths:_0x18ebf0}=await Promise[_0x35f0be(0xaa)]()['then'](()=>__importStar(require(_0x35f0be(0xdd)))),{agentKey:_0x1697d0}=_0x190935[_0x35f0be(0x112)]||{};if(!_0x1697d0)return _0x19e0de['status'](0x190)[_0x35f0be(0x109)]({'error':_0x35f0be(0xf6)});const _0x384fab=_0x18ebf0(_0x1697d0),_0x4a56a1=_0x384fab['find'](_0x335fd4=>fs['existsSync'](_0x335fd4))||_0x384fab[0x0];if(_0x4a56a1){if(!fs[_0x35f0be(0xfa)](_0x4a56a1))try{fs[_0x35f0be(0x119)](_0x4a56a1,{'recursive':!![]});}catch{}const {exec:_0x250cb0}=await Promise['resolve']()[_0x35f0be(0xdb)](()=>__importStar(require('child_process'))),_0x5a0a30=process[_0x35f0be(0x11f)]===_0x35f0be(0x106)?'explorer\x20\x22'+_0x4a56a1+'\x22':process[_0x35f0be(0x11f)]===_0x35f0be(0x101)?_0x35f0be(0x102)+_0x4a56a1+'\x22':'xdg-open\x20\x22'+_0x4a56a1+'\x22';return _0x250cb0(_0x5a0a30),_0x19e0de[_0x35f0be(0x109)]({'success':!![],'openedPath':_0x4a56a1});}_0x19e0de['status'](0x194)[_0x35f0be(0x109)]({'error':_0x35f0be(0x10f)});}),app[a0_0x5b0501(0xb4)]('/api/config/toggle',async(_0x5f2095,_0x469bea)=>{const _0x254c50=a0_0x5b0501,{saveConfig:_0x31f597}=await Promise['resolve']()[_0x254c50(0xdb)](()=>__importStar(require(_0x254c50(0xdd)))),{key:_0xfeb1fa,value:_0x48d1fc}=_0x5f2095[_0x254c50(0x112)]||{};if(_0xfeb1fa){const _0x42800e=_0x31f597({'conversation_toggles':{[_0xfeb1fa]:_0x48d1fc}});return _0x469bea[_0x254c50(0x109)](_0x42800e);}_0x469bea[_0x254c50(0xc7)](0x190)[_0x254c50(0x109)]({'error':_0x254c50(0x11b)});}),app[a0_0x5b0501(0xb4)](a0_0x5b0501(0xac),async(_0x25e680,_0x1199ca)=>{const _0x4d4e75=a0_0x5b0501,{saveConfig:_0x2904a4}=await Promise['resolve']()[_0x4d4e75(0xdb)](()=>__importStar(require('./file-watcher'))),{agentKey:_0x1b3937,path:_0xacc0b2}=_0x25e680[_0x4d4e75(0x112)]||{};if(_0x1b3937){const _0xadb1d8=_0x2904a4({'custom_storage_paths':{[_0x1b3937]:_0xacc0b2||null}});return _0x1199ca[_0x4d4e75(0x109)](_0xadb1d8);}_0x1199ca[_0x4d4e75(0xc7)](0x190)['json']({'error':_0x4d4e75(0xf6)});});function startDashboard(_0x3b69a9=0xfa0){const _0x202904=a0_0x5b0501;let _0x49d8ab=_0x3b69a9;const _0x57b9a3=process[_0x202904(0xfb)][_0x202904(0x113)](_0x202904(0x105))||process[_0x202904(0xcb)][_0x202904(0xf0)]==='1',_0x7abe42=app[_0x202904(0xee)](_0x49d8ab,()=>{const _0x253175=_0x202904,_0x1754f9=_0x253175(0xc3)+_0x49d8ab;!_0x57b9a3&&(console[_0x253175(0xd6)]('\x0a[TrimPrompt]\x20Dashboard\x20server\x20started\x20at:\x20'+_0x1754f9),console[_0x253175(0xd6)](_0x253175(0xa5))),Promise[_0x253175(0xaa)]()[_0x253175(0xdb)](()=>__importStar(require(_0x253175(0xdd))))[_0x253175(0xdb)](_0x5c5148=>_0x5c5148['startWatcherDaemon']())[_0x253175(0xd0)](()=>{}),!_0x57b9a3&&process[_0x253175(0xcb)][_0x253175(0x10d)]!=='1'&&(0x0,open_1[_0x253175(0xa1)])(_0x1754f9)[_0x253175(0xd0)](()=>{});});_0x7abe42['on']('error',_0x30c975=>{const _0x574fc6=_0x202904;_0x30c975['code']===_0x574fc6(0xeb)?startDashboard(_0x49d8ab+0x1):console[_0x574fc6(0xe7)](_0x574fc6(0x10a)+_0x30c975[_0x574fc6(0x117)]);});}
|
package/executor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var a0_0x3ee711=a0_0xcab9;function a0_0x36ee(){var _0x3facf9=['4022559NsCHET','2752696SLgakK','stdout','2XaOScx','288226OJedDm','includes','Failed\x20to\x20spawn\x20command\x20\x22','startsWith','default','847AaufgF','prototype','child_process','toString','PATH','1123737vJSejj','error','\x22:\x20','data','join','.trimprompt','__esModule','message','5dQyimF','1471792HXxphr','12tBftVT','trim','1957992qpaYcu','writable','length','call','__setModuleDefault','get','defineProperty','getOwnPropertyDescriptor','create','executeCommand','105650iDeyRq','filter','pipe','split','homedir','hasOwnProperty','delimiter','inherit','getOwnPropertyNames','toLowerCase','__createBinding'];a0_0x36ee=function(){return _0x3facf9;};return a0_0x36ee();}(function(_0x250757,_0x20d0ec){var _0x4d9ed5=a0_0xcab9,_0x3b95f1=_0x250757();while(!![]){try{var _0x2c58b4=parseInt(_0x4d9ed5(0x1e9))/0x1*(-parseInt(_0x4d9ed5(0x1e8))/0x2)+parseInt(_0x4d9ed5(0x1f3))/0x3+parseInt(_0x4d9ed5(0x1e6))/0x4*(-parseInt(_0x4d9ed5(0x1fb))/0x5)+-parseInt(_0x4d9ed5(0x1fd))/0x6*(-parseInt(_0x4d9ed5(0x1fc))/0x7)+parseInt(_0x4d9ed5(0x1ff))/0x8+-parseInt(_0x4d9ed5(0x1e5))/0x9+-parseInt(_0x4d9ed5(0x1da))/0xa*(-parseInt(_0x4d9ed5(0x1ee))/0xb);if(_0x2c58b4===_0x20d0ec)break;else _0x3b95f1['push'](_0x3b95f1['shift']());}catch(_0x1c6526){_0x3b95f1['push'](_0x3b95f1['shift']());}}}(a0_0x36ee,0x68faa));function a0_0xcab9(_0x574398,_0x88036){var _0x36ee9e=a0_0x36ee();return a0_0xcab9=function(_0xcab9df,_0x3f11d7){_0xcab9df=_0xcab9df-0x1d9;var _0x1d430b=_0x36ee9e[_0xcab9df];return _0x1d430b;},a0_0xcab9(_0x574398,_0x88036);}var __createBinding=this&&this[a0_0x3ee711(0x1e4)]||(Object[a0_0x3ee711(0x207)]?function(_0x326071,_0x3463fb,_0x514644,_0xf5ca0c){var _0x32301c=a0_0x3ee711;if(_0xf5ca0c===undefined)_0xf5ca0c=_0x514644;var _0x11814d=Object[_0x32301c(0x206)](_0x3463fb,_0x514644);(!_0x11814d||(_0x32301c(0x204)in _0x11814d?!_0x3463fb['__esModule']:_0x11814d[_0x32301c(0x200)]||_0x11814d['configurable']))&&(_0x11814d={'enumerable':!![],'get':function(){return _0x3463fb[_0x514644];}}),Object['defineProperty'](_0x326071,_0xf5ca0c,_0x11814d);}:function(_0x5c5a48,_0x4d9719,_0x2beed5,_0x51d77e){if(_0x51d77e===undefined)_0x51d77e=_0x2beed5;_0x5c5a48[_0x51d77e]=_0x4d9719[_0x2beed5];}),__setModuleDefault=this&&this[a0_0x3ee711(0x203)]||(Object[a0_0x3ee711(0x207)]?function(_0x115b45,_0x21e1c4){var _0x1895a7=a0_0x3ee711;Object['defineProperty'](_0x115b45,_0x1895a7(0x1ed),{'enumerable':!![],'value':_0x21e1c4});}:function(_0x4f9ef3,_0x442ee3){var _0x40273b=a0_0x3ee711;_0x4f9ef3[_0x40273b(0x1ed)]=_0x442ee3;}),__importStar=this&&this['__importStar']||(function(){var _0x40d071=function(_0x1793b9){var _0x43dd3d=a0_0xcab9;return _0x40d071=Object[_0x43dd3d(0x1e2)]||function(_0x194467){var _0x5f5a8e=_0x43dd3d,_0x4596f7=[];for(var _0x23d70b in _0x194467)if(Object[_0x5f5a8e(0x1ef)][_0x5f5a8e(0x1df)][_0x5f5a8e(0x202)](_0x194467,_0x23d70b))_0x4596f7[_0x4596f7[_0x5f5a8e(0x201)]]=_0x23d70b;return _0x4596f7;},_0x40d071(_0x1793b9);};return function(_0x5ae96e){var _0x39128b=a0_0xcab9;if(_0x5ae96e&&_0x5ae96e[_0x39128b(0x1f9)])return _0x5ae96e;var _0x59f90e={};if(_0x5ae96e!=null){for(var _0x373444=_0x40d071(_0x5ae96e),_0x59a205=0x0;_0x59a205<_0x373444[_0x39128b(0x201)];_0x59a205++)if(_0x373444[_0x59a205]!==_0x39128b(0x1ed))__createBinding(_0x59f90e,_0x5ae96e,_0x373444[_0x59a205]);}return __setModuleDefault(_0x59f90e,_0x5ae96e),_0x59f90e;};}());Object[a0_0x3ee711(0x205)](exports,a0_0x3ee711(0x1f9),{'value':!![]}),exports[a0_0x3ee711(0x1d9)]=executeCommand;const child_process_1=require(a0_0x3ee711(0x1f0)),path=__importStar(require('path')),os=__importStar(require('os'));function executeCommand(_0x30c2e2,_0xf42a14){return new Promise(_0x3447ea=>{var _0x45901a=a0_0xcab9;const _0x38c292=path[_0x45901a(0x1f7)](os[_0x45901a(0x1de)](),_0x45901a(0x1f8),'shims'),_0x4fba3d=(process['env'][_0x45901a(0x1f2)]||'')[_0x45901a(0x1dd)](path[_0x45901a(0x1e0)])[_0x45901a(0x1db)](_0x782cbb=>_0x782cbb[_0x45901a(0x1fe)]()[_0x45901a(0x1e3)]()!==_0x38c292[_0x45901a(0x1e3)]())[_0x45901a(0x1f7)](path[_0x45901a(0x1e0)]),_0x5e6939={...process['env'],'PATH':_0x4fba3d,'TRIMPROMPT_DISABLED':'1'},_0x1bd3d2=_0xf42a14['map'](_0x24f4c4=>_0x24f4c4[_0x45901a(0x1ea)]('\x20')&&!_0x24f4c4[_0x45901a(0x1ec)]('\x22')?'\x22'+_0x24f4c4+'\x22':_0x24f4c4),_0x2b21b3=[_0x30c2e2,..._0x1bd3d2][_0x45901a(0x1f7)]('\x20'),_0x3b10a6=(0x0,child_process_1['spawn'])(_0x2b21b3,[],{'stdio':[_0x45901a(0x1e1),_0x45901a(0x1dc),'pipe'],'shell':!![],'env':_0x5e6939});let _0x115a12='',_0x3e8399='';_0x3b10a6[_0x45901a(0x1e7)]?.['on'](_0x45901a(0x1f6),_0x13e53b=>{var _0x2437ea=_0x45901a;_0x115a12+=_0x13e53b[_0x2437ea(0x1f1)]();}),_0x3b10a6['stderr']?.['on']('data',_0x38d817=>{var _0x4e3bb6=_0x45901a;_0x3e8399+=_0x38d817[_0x4e3bb6(0x1f1)]();}),_0x3b10a6['on'](_0x45901a(0x1f4),_0x53186b=>{var _0x4a2d30=_0x45901a;_0x3447ea({'exitCode':0x1,'stdout':'','stderr':_0x4a2d30(0x1eb)+_0x30c2e2+_0x4a2d30(0x1f5)+_0x53186b[_0x4a2d30(0x1fa)]});}),_0x3b10a6['on']('close',_0x5e9c9c=>{_0x3447ea({'exitCode':_0x5e9c9c??0x0,'stdout':_0x115a12,'stderr':_0x3e8399});});});}
|
package/file-watcher.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';const a0_0x14bc19=a0_0x2798;function a0_0x2798(_0x4cb7f4,_0x3d1f36){const _0x17190b=a0_0x1719();return a0_0x2798=function(_0x27982c,_0x13350c){_0x27982c=_0x27982c-0x18b;let _0xd24a9c=_0x17190b[_0x27982c];return _0xd24a9c;},a0_0x2798(_0x4cb7f4,_0x3d1f36);}(function(_0x340720,_0x2e2967){const _0x59d632=a0_0x2798,_0x50c9b5=_0x340720();while(!![]){try{const _0x40ae42=-parseInt(_0x59d632(0x1c7))/0x1+-parseInt(_0x59d632(0x18b))/0x2*(-parseInt(_0x59d632(0x1d2))/0x3)+parseInt(_0x59d632(0x1ac))/0x4+parseInt(_0x59d632(0x19f))/0x5+-parseInt(_0x59d632(0x1a2))/0x6+parseInt(_0x59d632(0x1ad))/0x7*(parseInt(_0x59d632(0x1cd))/0x8)+-parseInt(_0x59d632(0x20a))/0x9*(parseInt(_0x59d632(0x199))/0xa);if(_0x40ae42===_0x2e2967)break;else _0x50c9b5['push'](_0x50c9b5['shift']());}catch(_0x2fc725){_0x50c9b5['push'](_0x50c9b5['shift']());}}}(a0_0x1719,0x573d0));var __createBinding=this&&this[a0_0x14bc19(0x1f9)]||(Object['create']?function(_0x29b554,_0x501a33,_0x2d9217,_0x556e7e){const _0x43edae=a0_0x14bc19;if(_0x556e7e===undefined)_0x556e7e=_0x2d9217;var _0x29accf=Object[_0x43edae(0x1c0)](_0x501a33,_0x2d9217);(!_0x29accf||(_0x43edae(0x209)in _0x29accf?!_0x501a33['__esModule']:_0x29accf[_0x43edae(0x222)]||_0x29accf[_0x43edae(0x19e)]))&&(_0x29accf={'enumerable':!![],'get':function(){return _0x501a33[_0x2d9217];}}),Object[_0x43edae(0x1c2)](_0x29b554,_0x556e7e,_0x29accf);}:function(_0x31c1c0,_0x4ccfc3,_0x448f12,_0xbf660f){if(_0xbf660f===undefined)_0xbf660f=_0x448f12;_0x31c1c0[_0xbf660f]=_0x4ccfc3[_0x448f12];}),__setModuleDefault=this&&this[a0_0x14bc19(0x218)]||(Object[a0_0x14bc19(0x1f8)]?function(_0x3be507,_0x557529){const _0x20189d=a0_0x14bc19;Object['defineProperty'](_0x3be507,_0x20189d(0x1e6),{'enumerable':!![],'value':_0x557529});}:function(_0x4fff73,_0x4c74ca){_0x4fff73['default']=_0x4c74ca;}),__importStar=this&&this[a0_0x14bc19(0x1ae)]||(function(){var _0x101012=function(_0x3392af){const _0x5b3cfe=a0_0x2798;return _0x101012=Object[_0x5b3cfe(0x1ec)]||function(_0x1e42f2){const _0x40faef=_0x5b3cfe;var _0x2c81fe=[];for(var _0x5f0538 in _0x1e42f2)if(Object['prototype'][_0x40faef(0x219)][_0x40faef(0x224)](_0x1e42f2,_0x5f0538))_0x2c81fe[_0x2c81fe[_0x40faef(0x1f4)]]=_0x5f0538;return _0x2c81fe;},_0x101012(_0x3392af);};return function(_0x524aaf){const _0x42ab40=a0_0x2798;if(_0x524aaf&&_0x524aaf[_0x42ab40(0x1db)])return _0x524aaf;var _0x297c70={};if(_0x524aaf!=null){for(var _0x5c5aea=_0x101012(_0x524aaf),_0x422e22=0x0;_0x422e22<_0x5c5aea[_0x42ab40(0x1f4)];_0x422e22++)if(_0x5c5aea[_0x422e22]!==_0x42ab40(0x1e6))__createBinding(_0x297c70,_0x524aaf,_0x5c5aea[_0x422e22]);}return __setModuleDefault(_0x297c70,_0x524aaf),_0x297c70;};}());Object[a0_0x14bc19(0x1c2)](exports,'__esModule',{'value':!![]}),exports[a0_0x14bc19(0x208)]=loadConfig,exports[a0_0x14bc19(0x1d8)]=saveConfig,exports[a0_0x14bc19(0x1e4)]=getAgentStoragePaths,exports[a0_0x14bc19(0x20f)]=getLatestSessionFile,exports['loadSessionsState']=loadSessionsState,exports['processSessionFile']=processSessionFile,exports['installWindowsStartupService']=installWindowsStartupService,exports[a0_0x14bc19(0x1f5)]=startWatcherDaemon;const fs=__importStar(require('fs')),path=__importStar(require(a0_0x14bc19(0x214))),os=__importStar(require('os')),cache_manager_1=require(a0_0x14bc19(0x223)),tracker_1=require(a0_0x14bc19(0x1a5)),baseDir=path['join'](os[a0_0x14bc19(0x1e3)](),a0_0x14bc19(0x21a)),configPath=path[a0_0x14bc19(0x217)](baseDir,'config.json'),DEFAULT_CONFIG={'autostart_enabled':!![],'conversation_toggles':{'conv_claude':!![],'conv_codex':!![],'conv_cursor':!![],'conv_aider':!![],'conv_copilot':!![],'conv_openclaw':!![],'conv_opencode':!![],'conv_cortex':!![]},'custom_storage_paths':{'claude':null,'codex':null,'cursor':null,'aider':null,'copilot':null,'openclaw':null,'opencode':null,'cortex':null}};function loadConfig(){const _0x6e5ff=a0_0x14bc19;try{if(!fs['existsSync'](baseDir))fs[_0x6e5ff(0x1b6)](baseDir,{'recursive':!![]});if(fs[_0x6e5ff(0x221)](configPath)){const _0xf3414a=JSON[_0x6e5ff(0x1d3)](fs[_0x6e5ff(0x1da)](configPath,'utf8'));return{...DEFAULT_CONFIG,..._0xf3414a,'conversation_toggles':{...DEFAULT_CONFIG[_0x6e5ff(0x191)],..._0xf3414a[_0x6e5ff(0x191)]||{}},'custom_storage_paths':{...DEFAULT_CONFIG[_0x6e5ff(0x1e1)],..._0xf3414a[_0x6e5ff(0x1e1)]||{}}};}}catch{}return DEFAULT_CONFIG;}function saveConfig(_0x4d60cd){const _0x5629ea=a0_0x14bc19,_0x2da764=loadConfig(),_0xb64c01={..._0x2da764,..._0x4d60cd,'conversation_toggles':{..._0x2da764[_0x5629ea(0x191)],..._0x4d60cd[_0x5629ea(0x191)]||{}},'custom_storage_paths':{..._0x2da764['custom_storage_paths'],..._0x4d60cd['custom_storage_paths']||{}}};try{if(!fs[_0x5629ea(0x221)](baseDir))fs['mkdirSync'](baseDir,{'recursive':!![]});fs[_0x5629ea(0x20b)](configPath,JSON[_0x5629ea(0x1fa)](_0xb64c01,null,0x2),_0x5629ea(0x1a3));}catch{}return _0xb64c01;}function getAgentStoragePaths(_0xde90d3){const _0x3994a9=a0_0x14bc19,_0x11719d=loadConfig(),_0x5b2081=_0x11719d['custom_storage_paths'][_0xde90d3];if(_0x5b2081&&fs[_0x3994a9(0x221)](_0x5b2081))return[_0x5b2081];const _0x3bebc0=os[_0x3994a9(0x1e3)](),_0xe3aca3=process[_0x3994a9(0x1cc)]===_0x3994a9(0x1c8),_0x30be2c=process['platform']==='darwin';switch(_0xde90d3){case _0x3994a9(0x1e0):return[path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1f2),_0x3994a9(0x202)),path[_0x3994a9(0x217)](_0x3bebc0,'.claude',_0x3994a9(0x1ef))];case'codex':return[path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1e7),_0x3994a9(0x18f)),path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1c6),_0x3994a9(0x1bd),'Codex')];case _0x3994a9(0x1cb):return[path['join'](_0x3bebc0,_0x3994a9(0x1ed),_0x3994a9(0x216)),path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1ed)),path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1c6),'Roaming',_0x3994a9(0x18d)),path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1c3),'gemini')];case _0x3994a9(0x18e):if(_0xe3aca3)return[path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1c6),'Roaming',_0x3994a9(0x1dd),'User','workspaceStorage')];if(_0x30be2c)return[path[_0x3994a9(0x217)](_0x3bebc0,'Library','Application\x20Support',_0x3994a9(0x1dd),'User','workspaceStorage')];return[path['join'](_0x3bebc0,_0x3994a9(0x1c3),'Cursor',_0x3994a9(0x1fb),_0x3994a9(0x21d))];case _0x3994a9(0x211):return[process[_0x3994a9(0x201)](),path['join'](_0x3bebc0,'.aider.chat.history.md')];case _0x3994a9(0x206):if(_0xe3aca3)return[path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x1c6),_0x3994a9(0x1df),_0x3994a9(0x205))];return[path['join'](_0x3bebc0,_0x3994a9(0x1c3),_0x3994a9(0x205))];case _0x3994a9(0x1ba):return[path[_0x3994a9(0x217)](_0x3bebc0,'.openclaw','storage'),path[_0x3994a9(0x217)](process[_0x3994a9(0x201)](),_0x3994a9(0x194),'context')];case _0x3994a9(0x1c4):return[path[_0x3994a9(0x217)](_0x3bebc0,_0x3994a9(0x197),_0x3994a9(0x18f))];case _0x3994a9(0x20d):return[path['join'](_0x3bebc0,_0x3994a9(0x1ce),'cache')];default:return[];}}function getLatestSessionFile(_0x8f90ca){const _0x1e9c3c=a0_0x14bc19,_0x295874=getAgentStoragePaths(_0x8f90ca);let _0x237513=null,_0x35dead=0x0,_0x5cb83c=null,_0x4f1fdc=null;for(const _0x4e172a of _0x295874){if(fs['existsSync'](_0x4e172a)){if(!_0x4f1fdc)_0x4f1fdc=_0x4e172a;const _0x35ff24=(_0x1cf536,_0x2e2bcf=0x0)=>{const _0x269d42=a0_0x2798;if(_0x2e2bcf>0x3)return;try{const _0x41db31=fs['readdirSync'](_0x1cf536,{'withFileTypes':!![]});for(const _0x3b963f of _0x41db31){const _0xfd8639=path[_0x269d42(0x217)](_0x1cf536,_0x3b963f[_0x269d42(0x220)]);if(_0x3b963f[_0x269d42(0x1a4)]())_0x35ff24(_0xfd8639,_0x2e2bcf+0x1);else{if(_0x3b963f[_0x269d42(0x21f)]()&&!_0x3b963f[_0x269d42(0x220)][_0x269d42(0x1f6)]('.')){const _0x51093a=_0x3b963f[_0x269d42(0x220)]['toLowerCase']();if(_0x51093a[_0x269d42(0x215)]('.png')||_0x51093a[_0x269d42(0x215)](_0x269d42(0x1e8))||_0x51093a['endsWith'](_0x269d42(0x1c1))||_0x51093a['endsWith']('.gif')||_0x51093a[_0x269d42(0x215)](_0x269d42(0x1a0))||_0x51093a[_0x269d42(0x215)](_0x269d42(0x21b))||_0x51093a['endsWith']('.wal')||_0x51093a[_0x269d42(0x215)](_0x269d42(0x1cf))||_0x51093a[_0x269d42(0x215)]('.tmp')||_0x51093a[_0x269d42(0x215)](_0x269d42(0x1e2))||_0x51093a[_0x269d42(0x215)]('.dat')||_0x51093a['startsWith']('media__')||_0x51093a[_0x269d42(0x1f6)](_0x269d42(0x193)))continue;const _0x534232=fs[_0x269d42(0x1d4)](_0xfd8639);_0x534232['mtimeMs']>_0x35dead&&(_0x35dead=_0x534232[_0x269d42(0x19a)],_0x237513=_0x3b963f[_0x269d42(0x220)],_0x5cb83c=_0xfd8639,_0x4f1fdc=_0x4e172a);}}}}catch{}};_0x35ff24(_0x4e172a);}}return{'fileName':_0x237513,'lastModified':_0x35dead>0x0?new Date(_0x35dead)[_0x1e9c3c(0x19d)]():null,'fullPath':_0x5cb83c,'dirPath':_0x4f1fdc};}const debounceTimers=new Map(),lastLoggedTimes=new Map();function compressMessageContent(_0xc18c2c,_0x1d66a8,_0x2f0c1c){const _0xf4f2=a0_0x14bc19;let _0x4be605=![],_0x150784=0x0;if(!_0xc18c2c)return{'modified':_0x4be605,'savedTokens':_0x150784};const _0x24d82c=_0x2ae0b9=>_0x2ae0b9[_0xf4f2(0x190)](/\r\n/g,'\x0a')[_0xf4f2(0x190)](/\n{3,}/g,'\x0a\x0a');if(typeof _0xc18c2c[_0xf4f2(0x1d9)]===_0xf4f2(0x198)){let _0x12f513=_0xc18c2c['content'],_0x3303de=_0x24d82c(_0x12f513);_0x3303de[_0xf4f2(0x1f4)]<_0x12f513[_0xf4f2(0x1f4)]&&(_0xc18c2c['content']=_0x3303de,_0x4be605=!![],_0x150784+=Math[_0xf4f2(0x203)]((_0x12f513[_0xf4f2(0x1f4)]-_0x3303de[_0xf4f2(0x1f4)])/0x4));if(_0xc18c2c['content'][_0xf4f2(0x1f4)]>0x12c&&!_0xc18c2c['content'][_0xf4f2(0x1b2)](_0xf4f2(0x1d6))){const _0x57d7c4=_0xf4f2(0x1b9)+Math[_0xf4f2(0x203)](_0xc18c2c[_0xf4f2(0x1d9)]['length']/0x4)+'\x20tokens).',_0x38a3dc=(0x0,cache_manager_1[_0xf4f2(0x1de)])(_0x1d66a8,_0x2f0c1c,_0xc18c2c['content'],_0x57d7c4);_0xc18c2c[_0xf4f2(0x1d9)]=_0xf4f2(0x20e)+_0x38a3dc[_0xf4f2(0x1b0)]+_0xf4f2(0x1f7)+_0x38a3dc[_0xf4f2(0x1c9)]+_0xf4f2(0x1a6)+_0x38a3dc[_0xf4f2(0x1c9)]+'`\x0a',_0x4be605=!![],_0x150784+=Math[_0xf4f2(0x1e5)](0x0,_0x38a3dc[_0xf4f2(0x1b0)]-_0x38a3dc[_0xf4f2(0x20c)]);}}else{if(Array[_0xf4f2(0x212)](_0xc18c2c[_0xf4f2(0x1d9)]))for(const _0x5dec0b of _0xc18c2c[_0xf4f2(0x1d9)]){if(_0x5dec0b&&typeof _0x5dec0b===_0xf4f2(0x1b5)){if(typeof _0x5dec0b[_0xf4f2(0x1a1)]==='string'){let _0x5bd31e=_0x5dec0b['text'],_0x46fd28=_0x24d82c(_0x5bd31e);_0x46fd28[_0xf4f2(0x1f4)]<_0x5bd31e[_0xf4f2(0x1f4)]&&(_0x5dec0b[_0xf4f2(0x1a1)]=_0x46fd28,_0x4be605=!![],_0x150784+=Math[_0xf4f2(0x203)]((_0x5bd31e[_0xf4f2(0x1f4)]-_0x46fd28['length'])/0x4));if(_0x5dec0b[_0xf4f2(0x1a1)][_0xf4f2(0x1f4)]>0x12c&&!_0x5dec0b[_0xf4f2(0x1a1)][_0xf4f2(0x1b2)](_0xf4f2(0x1d6))){const _0x822b89=_0xf4f2(0x1ab)+Math[_0xf4f2(0x203)](_0x5dec0b['text'][_0xf4f2(0x1f4)]/0x4)+_0xf4f2(0x1b1),_0x209e44=(0x0,cache_manager_1['saveChunk'])(_0x1d66a8,_0x2f0c1c,_0x5dec0b[_0xf4f2(0x1a1)],_0x822b89);_0x5dec0b[_0xf4f2(0x1a1)]='\x0a>\x20[!IMPORTANT]\x0a>\x20**[TrimPrompt\x20Cache\x20Engine\x20โ\x20Context\x20Offloaded]**\x0a>\x20**Chunk\x20Reference\x20ID:**\x20`'+_0x209e44[_0xf4f2(0x1c9)]+'`\x0a>\x20Retrieve\x20with:\x20`trim\x20retrieve\x20'+_0x209e44[_0xf4f2(0x1c9)]+'`\x0a',_0x4be605=!![],_0x150784+=Math[_0xf4f2(0x1e5)](0x0,_0x209e44[_0xf4f2(0x1b0)]-_0x209e44[_0xf4f2(0x20c)]);}}else{if(typeof _0x5dec0b[_0xf4f2(0x1d9)]===_0xf4f2(0x198)){let _0x34f7b2=_0x5dec0b[_0xf4f2(0x1d9)],_0x1afd8a=_0x24d82c(_0x34f7b2);_0x1afd8a[_0xf4f2(0x1f4)]<_0x34f7b2[_0xf4f2(0x1f4)]&&(_0x5dec0b[_0xf4f2(0x1d9)]=_0x1afd8a,_0x4be605=!![],_0x150784+=Math[_0xf4f2(0x203)]((_0x34f7b2[_0xf4f2(0x1f4)]-_0x1afd8a['length'])/0x4));if(_0x5dec0b[_0xf4f2(0x1d9)][_0xf4f2(0x1f4)]>0x12c&&!_0x5dec0b['content'][_0xf4f2(0x1b2)](_0xf4f2(0x1d6))){const _0x334d2c=_0xf4f2(0x1dc)+Math[_0xf4f2(0x203)](_0x5dec0b['content'][_0xf4f2(0x1f4)]/0x4)+'\x20tokens).',_0x93bde2=(0x0,cache_manager_1[_0xf4f2(0x1de)])(_0x1d66a8,_0x2f0c1c,_0x5dec0b[_0xf4f2(0x1d9)],_0x334d2c);_0x5dec0b[_0xf4f2(0x1d9)]=_0xf4f2(0x195)+_0x93bde2[_0xf4f2(0x1c9)]+_0xf4f2(0x1ff)+_0x93bde2[_0xf4f2(0x1c9)]+'`\x0a',_0x4be605=!![],_0x150784+=Math[_0xf4f2(0x1e5)](0x0,_0x93bde2[_0xf4f2(0x1b0)]-_0x93bde2[_0xf4f2(0x20c)]);}}}}}}return{'modified':_0x4be605,'savedTokens':_0x150784};}const sessionsStatePath=path['join'](baseDir,a0_0x14bc19(0x1b3));let sessionsStateMemoryCache=null;function loadSessionsState(){const _0x2485fc=a0_0x14bc19;try{if(fs[_0x2485fc(0x221)](sessionsStatePath)){const _0x4b077f=JSON['parse'](fs[_0x2485fc(0x1da)](sessionsStatePath,_0x2485fc(0x1a3)));if(_0x4b077f&&typeof _0x4b077f===_0x2485fc(0x1b5))return sessionsStateMemoryCache=_0x4b077f,_0x4b077f;}}catch{}return sessionsStateMemoryCache||{};}function saveSessionStateItem(_0x567c40,_0x2bb427,_0x14af53,_0x7b9f12=0x0,_0x3e3a92=0x0){const _0x5b9e32=a0_0x14bc19;try{const _0x27a161=loadSessionsState();_0x27a161[_0x567c40]={'lineCount':_0x2bb427,'activeSavedTokens':_0x14af53,'sideCacheSaved':_0x7b9f12,'officialCompactSaved':_0x3e3a92},sessionsStateMemoryCache=_0x27a161;if(!fs[_0x5b9e32(0x221)](baseDir))fs[_0x5b9e32(0x1b6)](baseDir,{'recursive':!![]});const _0x4ad677=sessionsStatePath+_0x5b9e32(0x1c5);fs[_0x5b9e32(0x20b)](_0x4ad677,JSON['stringify'](_0x27a161,null,0x2),_0x5b9e32(0x1a3)),fs['renameSync'](_0x4ad677,sessionsStatePath);}catch{}}function processSessionFile(_0x5547e9,_0x5baf3c){const _0x468f75=a0_0x14bc19;try{if(!fs[_0x468f75(0x221)](_0x5547e9))return;const _0x2bfbce=fs['statSync'](_0x5547e9);if(_0x2bfbce['isDirectory']()||_0x2bfbce['size']===0x0)return;const _0x4c005b=loadConfig(),_0x184afb='conv_'+_0x5baf3c;if(_0x4c005b[_0x468f75(0x191)][_0x184afb]===![])return;const _0x3e85c3=fs['readFileSync'](_0x5547e9,_0x468f75(0x1a3));let _0x19c7b4=![],_0x229be8=_0x3e85c3,_0x148ba5=0x0;const _0x1a4990=path[_0x468f75(0x204)](_0x5547e9)['toLowerCase'](),_0x31178e=path['basename'](_0x5547e9,_0x1a4990);let _0x2299d2=0x1;if(_0x5baf3c!==_0x468f75(0x1e0)){if(_0x1a4990===_0x468f75(0x192))try{const _0x35f515=JSON['parse'](_0x3e85c3),_0x401f5d=Array[_0x468f75(0x212)](_0x35f515[_0x468f75(0x1ea)])?_0x35f515[_0x468f75(0x1ea)]:Array[_0x468f75(0x212)](_0x35f515)?_0x35f515:null;if(_0x401f5d){_0x2299d2=_0x401f5d[_0x468f75(0x1f4)];for(let _0x2f85a8=0x0;_0x2f85a8<_0x401f5d[_0x468f75(0x1f4)];_0x2f85a8++){const _0x36e8e=compressMessageContent(_0x401f5d[_0x2f85a8],_0x31178e,_0x5baf3c);_0x36e8e[_0x468f75(0x1d7)]&&(_0x19c7b4=!![],_0x148ba5+=_0x36e8e['savedTokens']);}_0x19c7b4&&(_0x229be8=JSON[_0x468f75(0x1fa)](_0x35f515,null,0x2));}}catch{}else{if(_0x1a4990===_0x468f75(0x1b7)||_0x1a4990==='.json1')try{const _0x19877a=_0x3e85c3[_0x468f75(0x1fe)]('\x0a');_0x2299d2=_0x19877a[_0x468f75(0x1f4)];const _0x17c2aa=[];for(let _0x4632c5 of _0x19877a){if(!_0x4632c5[_0x468f75(0x213)]()){_0x17c2aa[_0x468f75(0x196)](_0x4632c5);continue;}try{const _0x5bb480=JSON[_0x468f75(0x1d3)](_0x4632c5),_0x59fce5=_0x5bb480[_0x468f75(0x1bc)]||_0x5bb480;if(_0x59fce5){const _0x211b3e=compressMessageContent(_0x59fce5,_0x31178e,_0x5baf3c);_0x211b3e[_0x468f75(0x1d7)]&&(_0x19c7b4=!![],_0x148ba5+=_0x211b3e[_0x468f75(0x1d5)],_0x4632c5=JSON[_0x468f75(0x1fa)](_0x5bb480));}}catch{}_0x17c2aa[_0x468f75(0x196)](_0x4632c5);}_0x19c7b4&&(_0x229be8=_0x17c2aa[_0x468f75(0x217)]('\x0a'));}catch{}}}else(_0x1a4990===_0x468f75(0x1b7)||_0x1a4990===_0x468f75(0x18c))&&(_0x2299d2=_0x3e85c3['split']('\x0a')[_0x468f75(0x1a9)](Boolean)[_0x468f75(0x1f4)]);let _0x5843d3=0x0;const _0x3c9b9a=_0x3e85c3[_0x468f75(0x1f0)](/(?:Compacted conversation\s*ยท\s*)?saved\s*([\d\.]+)k?\s*tokens/gi);for(const _0x5a0cd7 of _0x3c9b9a){let _0x1012a3=parseFloat(_0x5a0cd7[0x1]);_0x5a0cd7[0x0][_0x468f75(0x19c)]()[_0x468f75(0x1b2)]('k')&&(_0x1012a3=_0x1012a3*0x3e8),_0x5843d3+=Math[_0x468f75(0x21e)](_0x1012a3);}const _0x3a2400=loadSessionsState(),_0x53c7a4=_0x3a2400[_0x5547e9],_0x2736af=_0x53c7a4&&_0x53c7a4['sideCacheSaved']!==undefined?_0x53c7a4[_0x468f75(0x1f3)]:0x0,_0x29e9ac=_0x53c7a4&&_0x53c7a4[_0x468f75(0x1d1)]!==undefined?_0x53c7a4[_0x468f75(0x1d1)]:_0x53c7a4?_0x53c7a4['activeSavedTokens']:0x0,_0x4f0751=_0x53c7a4?_0x53c7a4[_0x468f75(0x19b)]:0x0,_0x456676=_0x2299d2>_0x4f0751;let _0x21d489=_0x2736af,_0x14e6d3=Math[_0x468f75(0x1e5)](_0x29e9ac,_0x5843d3);if(_0x19c7b4){fs[_0x468f75(0x20b)](_0x5547e9,_0x229be8,_0x468f75(0x1a3)),_0x21d489+=_0x148ba5;const _0x5cc743=_0x21d489+_0x14e6d3;saveSessionStateItem(_0x5547e9,_0x2299d2,_0x5cc743,_0x21d489,_0x14e6d3);const _0x51ca40='x'[_0x468f75(0x1be)](_0x5cc743*0x4);tracker_1[_0x468f75(0x207)][_0x468f75(0x200)](_0x468f75(0x1a7)+_0x5baf3c,_0x51ca40,'',0x0,undefined,['conv_'+_0x5baf3c,_0x468f75(0x1b8),_0x5baf3c,_0x468f75(0x1d0)]);}else{if(_0x5843d3>_0x29e9ac){_0x14e6d3=_0x5843d3;const _0x1234e3=_0x21d489+_0x14e6d3;saveSessionStateItem(_0x5547e9,_0x2299d2,_0x1234e3,_0x21d489,_0x14e6d3);const _0x20b33d='x'[_0x468f75(0x1be)](_0x1234e3*0x4);tracker_1[_0x468f75(0x207)][_0x468f75(0x200)](_0x468f75(0x1a7)+_0x5baf3c,_0x20b33d,'',0x0,undefined,[_0x468f75(0x1ca)+_0x5baf3c,'live-conv',_0x5baf3c,_0x468f75(0x1a8)]);}else{if(_0x456676){const _0x34b4d7=_0x21d489+_0x14e6d3;saveSessionStateItem(_0x5547e9,_0x2299d2,_0x34b4d7,_0x21d489,_0x14e6d3);if(_0x34b4d7>0x0){const _0x52f569='x'[_0x468f75(0x1be)](_0x34b4d7*0x4);tracker_1['tracker']['logExecution'](_0x468f75(0x1a7)+_0x5baf3c,_0x52f569,'',0x0,undefined,[_0x468f75(0x1ca)+_0x5baf3c,_0x468f75(0x1b8),_0x5baf3c,_0x468f75(0x1b4)]);}}else{const _0x21a8f4=_0x21d489+_0x14e6d3;saveSessionStateItem(_0x5547e9,_0x2299d2,_0x21a8f4,_0x21d489,_0x14e6d3);}}}}catch{}}function installWindowsStartupService(){const _0x546a29=a0_0x14bc19;if(process[_0x546a29(0x1cc)]!==_0x546a29(0x1c8))return;try{const _0x17f587=path[_0x546a29(0x217)](os[_0x546a29(0x1e3)](),_0x546a29(0x1c6),_0x546a29(0x1bd),'Microsoft',_0x546a29(0x1fc),_0x546a29(0x21c),_0x546a29(0x1f1),_0x546a29(0x1bb));if(!fs[_0x546a29(0x221)](_0x17f587))fs['mkdirSync'](_0x17f587,{'recursive':!![]});const _0x2af766=path['join'](_0x17f587,'TrimPromptDaemon.vbs'),_0x13d76e=path[_0x546a29(0x217)](__dirname,_0x546a29(0x1bf)),_0x568129=_0x13d76e['replace'](/\\/g,'\x5c\x5c'),_0x4cd165=_0x546a29(0x1ee)+_0x568129+_0x546a29(0x1af);fs['writeFileSync'](_0x2af766,_0x4cd165,'utf8');}catch{}}function startWatcherDaemon(){const _0xfb7f71=a0_0x14bc19;installWindowsStartupService();try{const {installClaudeHooks:_0x1024cf}=require(_0xfb7f71(0x1aa));_0x1024cf();}catch(_0x3ee9e8){}const _0x47b907=[_0xfb7f71(0x1e0),'gemini',_0xfb7f71(0x1eb),_0xfb7f71(0x18e),_0xfb7f71(0x211),_0xfb7f71(0x206),_0xfb7f71(0x1ba),_0xfb7f71(0x1c4),_0xfb7f71(0x20d)];for(const _0x5024d1 of _0x47b907){const _0x3dd82c=getAgentStoragePaths(_0x5024d1);for(const _0xd750e3 of _0x3dd82c){if(fs[_0xfb7f71(0x221)](_0xd750e3))try{fs[_0xfb7f71(0x1e9)](_0xd750e3,{'recursive':!![]},(_0x19182c,_0x2d661a)=>{const _0x32d428=_0xfb7f71;if(!_0x2d661a)return;const _0x30e1bc=path['join'](_0xd750e3,_0x2d661a);if(debounceTimers[_0x32d428(0x210)](_0x30e1bc))clearTimeout(debounceTimers['get'](_0x30e1bc));const _0x1c12ea=setTimeout(()=>processSessionFile(_0x30e1bc,_0x5024d1),0x1f4);debounceTimers['set'](_0x30e1bc,_0x1c12ea);});}catch{}}}setInterval(()=>{const _0x5d316d=_0xfb7f71;for(const _0x59356d of _0x47b907){try{const _0x5b026d=getLatestSessionFile(_0x59356d);_0x5b026d&&_0x5b026d['fullPath']&&processSessionFile(_0x5b026d[_0x5d316d(0x1fd)],_0x59356d);}catch{}}},0xbb8);}function a0_0x1719(){const _0x5dcac5=['toISOString','configurable','1259905diKUqJ','.webp','text','3726906KLqzVk','utf8','isDirectory','./tracker','`\x0a>\x20If\x20required,\x20execute:\x20`trim\x20retrieve\x20','conv:','official_compact','filter','./hooks/claude-hook','Summary:\x20Text\x20block\x20offloaded\x20(','304844ccSeAn','14iMPqeD','__importStar','\x22\x20&\x20\x22\x22\x22\x20ui\x20--headless\x22,\x200,\x20False\x0a','raw_tokens','\x20tokens).','includes','sessions_state.json','active_turn','object','mkdirSync','.jsonl','live-conv','Summary:\x20Content\x20offloaded\x20(','openclaw','Startup','message','Roaming','repeat','cli.js','getOwnPropertyDescriptor','.jpeg','defineProperty','.config','opencode','.tmp','AppData','325147TfiZvC','win32','chunk_id','conv_','gemini','platform','2211056FjhXzH','.cortex','.shm','trim_offload','officialCompactSaved','3DkAEiA','parse','statSync','savedTokens','TrimPrompt\x20Cache\x20Engine','modified','saveConfig','content','readFileSync','__esModule','Summary:\x20Tool\x20result\x20offloaded\x20(','Cursor','saveChunk','Local','claude','custom_storage_paths','.lock','homedir','getAgentStoragePaths','max','default','.codex','.jpg','watch','messages','codex','getOwnPropertyNames','.gemini','Set\x20WshShell\x20=\x20CreateObject(\x22WScript.Shell\x22)\x0aWshShell.Run\x20\x22node\x20\x22\x22\x22\x20&\x20\x22','history','matchAll','Programs','.claude','sideCacheSaved','length','startWatcherDaemon','startsWith','\x20tokens)\x20was\x20moved\x20to\x20local\x20side-cache.\x0a>\x20**Chunk\x20Reference\x20ID:**\x20`','create','__createBinding','stringify','User','Windows','fullPath','split','`\x0a>\x20Retrieve\x20with:\x20`trim\x20retrieve\x20','logExecution','cwd','projects','ceil','extname','github-copilot-cli','copilot','tracker','loadConfig','get','1076913MDSofU','writeFileSync','compressed_tokens','cortex','\x0a>\x20[!IMPORTANT]\x0a>\x20**[TrimPrompt\x20Cache\x20Engine\x20โ\x20Context\x20Offloaded]**\x0a>\x20The\x20raw\x20content\x20of\x20this\x20step\x20(','getLatestSessionFile','has','aider','isArray','trim','path','endsWith','antigravity','join','__setModuleDefault','hasOwnProperty','.trimprompt','.pb','Start\x20Menu','workspaceStorage','round','isFile','name','existsSync','writable','./cache-manager','call','1084654THNobv','.json1','Gemini','cursor','sessions','replace','conversation_toggles','.json','image_','.openclaw','\x0a>\x20[!IMPORTANT]\x0a>\x20**[TrimPrompt\x20Cache\x20Engine\x20โ\x20Context\x20Offloaded]**\x0a>\x20**Chunk\x20Reference\x20ID:**\x20`','push','.opencode','string','10MbOTgZ','mtimeMs','lineCount','toLowerCase'];a0_0x1719=function(){return _0x5dcac5;};return a0_0x1719();}
|