trimprompt 1.0.40 → 1.0.42
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 +2 -3
- package/cache-manager.js +1 -1
- package/cache.js +1 -1
- package/ccr.js +1 -1
- package/cli.js +493 -1
- package/dashboard.js +1 -1
- package/executor.js +1 -1
- package/file-watcher.js +1 -1
- package/filters/devops.js +1 -1
- package/filters/generic.js +1 -1
- package/filters/git.js +1 -1
- package/filters/go.js +1 -1
- package/filters/index.js +1 -1
- package/filters/js.js +1 -1
- package/filters/python.js +1 -1
- package/filters/rust.js +1 -1
- package/filters/shell.js +1 -1
- package/hooks/claude-hook.js +1 -1
- package/mcp.js +1 -1
- package/package.json +2 -2
- package/postinstall.js +21 -0
- package/proxy-conv.js +1 -1
- package/proxy-resp.js +1 -1
- package/redactor.js +1 -1
- package/seed.js +1 -1
- package/shims.js +387 -1
- package/simulate.js +1 -1
- package/sync.js +1 -1
- package/tracker.js +1 -1
package/shims.js
CHANGED
|
@@ -1 +1,387 @@
|
|
|
1
|
-
'use strict';const a0_0x328f5b=a0_0x42c5;(function(_0x129212,_0x4e6ec6){const _0x29c62b=a0_0x42c5,_0x27fdfa=_0x129212();while(!![]){try{const _0x35ab3b=parseInt(_0x29c62b(0x167))/0x1+-parseInt(_0x29c62b(0x1b5))/0x2+-parseInt(_0x29c62b(0x185))/0x3*(-parseInt(_0x29c62b(0x195))/0x4)+parseInt(_0x29c62b(0x13a))/0x5*(parseInt(_0x29c62b(0x14b))/0x6)+-parseInt(_0x29c62b(0x1a7))/0x7*(-parseInt(_0x29c62b(0x1bf))/0x8)+parseInt(_0x29c62b(0x1bd))/0x9+-parseInt(_0x29c62b(0x176))/0xa*(parseInt(_0x29c62b(0x162))/0xb);if(_0x35ab3b===_0x4e6ec6)break;else _0x27fdfa['push'](_0x27fdfa['shift']());}catch(_0x143a81){_0x27fdfa['push'](_0x27fdfa['shift']());}}}(a0_0x4b03,0xe5a26));var __createBinding=this&&this['__createBinding']||(Object[a0_0x328f5b(0x163)]?function(_0x7ed6c7,_0x8cdb6f,_0x576b60,_0x54a79c){const _0xb905b7=a0_0x328f5b;if(_0x54a79c===undefined)_0x54a79c=_0x576b60;var _0x22007f=Object[_0xb905b7(0x179)](_0x8cdb6f,_0x576b60);(!_0x22007f||(_0xb905b7(0x1a0)in _0x22007f?!_0x8cdb6f[_0xb905b7(0x1af)]:_0x22007f['writable']||_0x22007f[_0xb905b7(0x187)]))&&(_0x22007f={'enumerable':!![],'get':function(){return _0x8cdb6f[_0x576b60];}}),Object['defineProperty'](_0x7ed6c7,_0x54a79c,_0x22007f);}:function(_0x3ae246,_0x36fa77,_0x3267ad,_0x16519f){if(_0x16519f===undefined)_0x16519f=_0x3267ad;_0x3ae246[_0x16519f]=_0x36fa77[_0x3267ad];}),__setModuleDefault=this&&this[a0_0x328f5b(0x164)]||(Object[a0_0x328f5b(0x163)]?function(_0x1f42e2,_0x11f01a){const _0x54d1f3=a0_0x328f5b;Object[_0x54d1f3(0x178)](_0x1f42e2,_0x54d1f3(0x16c),{'enumerable':!![],'value':_0x11f01a});}:function(_0x1cadcc,_0x530cf0){const _0x3a9a35=a0_0x328f5b;_0x1cadcc[_0x3a9a35(0x16c)]=_0x530cf0;}),__importStar=this&&this[a0_0x328f5b(0x15b)]||(function(){var _0x108d11=function(_0x29953b){const _0x452049=a0_0x42c5;return _0x108d11=Object[_0x452049(0x191)]||function(_0x2ded4a){const _0x3c0bb2=_0x452049;var _0x1f1a5e=[];for(var _0x3eec96 in _0x2ded4a)if(Object[_0x3c0bb2(0x16d)][_0x3c0bb2(0x188)]['call'](_0x2ded4a,_0x3eec96))_0x1f1a5e[_0x1f1a5e[_0x3c0bb2(0x17b)]]=_0x3eec96;return _0x1f1a5e;},_0x108d11(_0x29953b);};return function(_0x4fb1b0){const _0x5d550c=a0_0x42c5;if(_0x4fb1b0&&_0x4fb1b0['__esModule'])return _0x4fb1b0;var _0x227da7={};if(_0x4fb1b0!=null){for(var _0x5c00a4=_0x108d11(_0x4fb1b0),_0x159557=0x0;_0x159557<_0x5c00a4[_0x5d550c(0x17b)];_0x159557++)if(_0x5c00a4[_0x159557]!==_0x5d550c(0x16c))__createBinding(_0x227da7,_0x4fb1b0,_0x5c00a4[_0x159557]);}return __setModuleDefault(_0x227da7,_0x4fb1b0),_0x227da7;};}());Object[a0_0x328f5b(0x178)](exports,'__esModule',{'value':!![]}),exports[a0_0x328f5b(0x18e)]=installShims,exports[a0_0x328f5b(0x146)]=uninstallShims;function a0_0x4b03(){const _0x317e57=['map','TrimPrompt\x20successfully\x20installed\x20for\x20','push','\x20@args\x20}\x0a}\x20else\x20{\x0a\x20\x20&\x20','APPDATA','.bash_profile','[Environment]::SetEnvironmentVariable(\x27PATH\x27,\x20\x27','__importStar','pipe','if\x20\x22%AI_AGENT%\x22==\x22\x22\x20if\x20\x22%CURSOR_AGENT%\x22==\x22\x22\x20if\x20\x22%CLAUDECODE%\x22==\x22\x22\x20if\x20\x22%CLAUDE_CODE%\x22==\x22\x22\x20if\x20\x22%ANTIGRAVITY_AGENT%\x22==\x22\x22\x20if\x20\x22%GEMINI_CLI%\x22==\x22\x22\x20if\x20\x22%TRIMPROMPT_ACTIVE%\x22==\x22\x22\x20(','================================================================================','appendFileSync','.ps1','.bashrc','2876357ggnHBl','create','__setModuleDefault','try\x20{\x20(Get-ItemProperty\x20-Path\x20\x27','Please\x20add\x20the\x20following\x20path\x20to\x20the\x20front\x20of\x20your\x20User\x20PATH\x20environment\x20variable\x20manually:\x0a\x20\x20','1120297lDYoUq','mkdirSync','some','#!/bin/sh\x0aif\x20[\x20-n\x20\x22$AI_AGENT\x22\x20]\x20||\x20[\x20-n\x20\x22$CURSOR_AGENT\x22\x20]\x20||\x20[\x20-n\x20\x22$CLAUDECODE\x22\x20]\x20||\x20[\x20-n\x20\x22$CLAUDE_CODE\x22\x20]\x20||\x20[\x20-n\x20\x22$ANTIGRAVITY_AGENT\x22\x20]\x20||\x20[\x20-n\x20\x22$GEMINI_CLI\x22\x20]\x20||\x20[\x20-n\x20\x22$TRIMPROMPT_ACTIVE\x22\x20];\x20then\x0a\x20\x20if\x20command\x20-v\x20trim\x20>/dev/null\x202>&1;\x20then\x20exec\x20trim\x20','\x20\x22$@\x22;\x20fi\x0a','default','prototype','git','@echo\x20off','\x20&\x20','execFileSync','[Environment]::GetEnvironmentVariable(\x27PATH\x27,\x20\x27User\x27)','replace','.profile','dirname','130UGsRad','\x20\x20exit\x20/b\x20%ERRORLEVEL%','defineProperty','getOwnPropertyDescriptor','pwsh\x20-NoProfile\x20-Command\x20\x22exit\x200\x22','length','ruff','\x20\x20\x20👉\x20Please\x20restart\x20your\x20terminal\x20window\x20or\x20AI\x20editor\x20(Cursor/Claude)','trim.cmd','HKCU:\x5cSoftware\x5cMicrosoft\x5cCommand\x20Processor','\x0aexport\x20PATH=\x22','includes','\x0a#\x20','\x27\x20-Name\x20AutoRun\x20-ErrorAction\x20Stop).AutoRun\x20}\x20catch\x20{\x20\x27\x27\x20}','$PROFILE.CurrentUserAllHosts','381Tynaxu','.cmd','configurable','hasOwnProperty','existsSync','glab','child_process','TrimPrompt\x20Shims\x20PATH','message','installShims',';=%\x22','win32','getOwnPropertyNames',':||g\x22);\x20exec\x20env\x20PATH=\x22$CLEAN_PATH\x22\x20','env','\x20\x20trim\x20','43576mnvDWC','docker','$sig\x20=\x20\x27[DllImport(\x5c\x22user32.dll\x5c\x22,\x20SetLastError\x20=\x20true,\x20CharSet\x20=\x20CharSet.Auto)]\x20public\x20static\x20extern\x20IntPtr\x20SendMessageTimeout(IntPtr\x20hWnd,\x20uint\x20Msg,\x20IntPtr\x20wParam,\x20string\x20lParam,\x20uint\x20fuFlags,\x20uint\x20uTimeout,\x20out\x20IntPtr\x20lpdwResult);\x27;\x20Add-Type\x20-MemberDefinition\x20$sig\x20-Name\x20\x5c\x22Win32\x5c\x22\x20-Namespace\x20\x5c\x22Win32\x5c\x22\x20-PassThru\x20>\x20$null;\x20[IntPtr]$res\x20=\x200;\x20[void][Win32.Win32]::SendMessageTimeout([IntPtr]0xffff,\x200x001A,\x20[IntPtr]::Zero,\x20\x5c\x22Environment\x5c\x22,\x202,\x201000,\x20[ref]$res);','homedir','shims','platform','\x20-NoProfile\x20-Command\x20\x22','%~dp0..\x5c..\x5cAppData\x5cRoaming\x5cnpm\x5ctrim.cmd','-Command',':$PATH\x22',':$PATH\x22\x0a','get','TrimPrompt\x20shims\x20fully\x20uninstalled.\x20All\x20PATH\x20modifications,\x20shell\x20profiles,\x20and\x20registry\x20entries\x20have\x20been\x20cleaned\x20up.',')\x20else\x20(','\x20\x22$@\x22\x0afi\x0a','toLowerCase','Please\x20add\x20this\x20to\x20your\x20shell\x20profile\x20(~/.bashrc,\x20~/.zshrc)\x20manually:\x0a\x20\x20export\x20PATH=\x22','\x20\x20set\x20\x22PATH=%PATH:','3009202HusrCH','execSync','\x20@args\x20}\x20else\x20{\x20&\x20','\x20\x22$@\x22;\x20fi\x0aelse\x0a\x20\x20CLEAN_PATH=$(echo\x20\x22$PATH\x22\x20|\x20sed\x20\x22s|','pytest','powershell','\x0a$env:PATH\x20=\x20\x22','-NoProfile','__esModule','writeFileSync','powershell\x20-NoProfile\x20-Command\x20\x22','\x20commands.\x0a\x0a[WARNING]\x20Could\x20not\x20automatically\x20update\x20your\x20system\x20PATH.\x20','readdirSync','tree','210620sJIXMS','join','cat','split','\x20\x20\x20\x20\x20\x20for\x20the\x20installation\x20to\x20take\x20effect.','trim','\x27,\x20\x27User\x27)','pnpm','11740581QDBkzl','kubectl','8NPhTLQ','cargo','filter','readFileSync','5csjBML','.trimprompt','Failed\x20to\x20install\x20shims:\x20','#!/bin/sh\x0aif\x20command\x20-v\x20trim\x20>/dev/null\x202>&1;\x20then\x20exec\x20trim\x20','path','npm','utf8','yarn','$PROFILE.CurrentUserCurrentHost','Set-ItemProperty\x20-Path\x20\x27','ignore','\x27\x20-Name\x20AutoRun\x20-Value\x20\x27','uninstallShims','\x20%*','\x20\x20\x20\x20\x20\x20[IMPORTANT]\x20TrimPrompt\x20successfully\x20installed!','chmodSync','\x22\x20(','1241958pDzyMQ','find','Failed\x20to\x20uninstall\x20shims:\x20','trim.ps1','pip3','if\x20exist\x20\x22','\x20\x22$@\x22;\x20else\x20CLEAN_PATH=$(echo\x20\x22$PATH\x22\x20|\x20sed\x20\x27s|[^:]*\x5c.trimprompt/shims:||g\x27);\x20exec\x20env\x20PATH=\x22$CLEAN_PATH\x22\x20','.zshrc','export\x20PATH=\x22'];a0_0x4b03=function(){return _0x317e57;};return a0_0x4b03();}function a0_0x42c5(_0x1cdcac,_0x270ba4){const _0x4b0328=a0_0x4b03();return a0_0x42c5=function(_0x42c54f,_0x37399c){_0x42c54f=_0x42c54f-0x139;let _0x1628fc=_0x4b0328[_0x42c54f];return _0x1628fc;},a0_0x42c5(_0x1cdcac,_0x270ba4);}const fs=__importStar(require('fs')),path=__importStar(require(a0_0x328f5b(0x13e))),os=__importStar(require('os')),SHIMMED_COMMANDS=['ls',a0_0x328f5b(0x1b4),a0_0x328f5b(0x1b7),'read','grep','rg',a0_0x328f5b(0x17c),a0_0x328f5b(0x16e),'gh',a0_0x328f5b(0x18a),a0_0x328f5b(0x1c0),'npm',a0_0x328f5b(0x1bc),'npx',a0_0x328f5b(0x141),a0_0x328f5b(0x1be),a0_0x328f5b(0x196),a0_0x328f5b(0x1ab),'pip',a0_0x328f5b(0x14f),'go',a0_0x328f5b(0x14c)],PROFILE_MARKER=a0_0x328f5b(0x18c);function getExecSync(){const _0x46018f=a0_0x328f5b;return require(_0x46018f(0x18b))[_0x46018f(0x1a8)];}function getExecFileSync(){const _0x27a619=a0_0x328f5b;return require(_0x27a619(0x18b))[_0x27a619(0x171)];}function ensureProfileContains(_0x1ebf3c,_0x43df00,_0x27e76c){const _0x55efb6=a0_0x328f5b;try{const _0x39e197=path[_0x55efb6(0x175)](_0x1ebf3c);!fs[_0x55efb6(0x189)](_0x39e197)&&fs['mkdirSync'](_0x39e197,{'recursive':!![]});if(fs[_0x55efb6(0x189)](_0x1ebf3c)){const _0x5953e5=fs[_0x55efb6(0x139)](_0x1ebf3c,_0x55efb6(0x140));if(_0x5953e5[_0x55efb6(0x181)](_0x43df00))return;fs[_0x55efb6(0x15f)](_0x1ebf3c,_0x27e76c,_0x55efb6(0x140));}else fs[_0x55efb6(0x1b0)](_0x1ebf3c,_0x27e76c,_0x55efb6(0x140));}catch{}}function removeProfileBlock(_0x6b9156,_0x3ce612){const _0x597ca1=a0_0x328f5b;try{if(!fs[_0x597ca1(0x189)](_0x6b9156))return;const _0x6afd1a=fs[_0x597ca1(0x139)](_0x6b9156,'utf8');if(!_0x6afd1a[_0x597ca1(0x181)](_0x3ce612))return;const _0x25738f=_0x6afd1a[_0x597ca1(0x1b8)]('\x0a'),_0x45e698=[];let _0x1b3da0=![];for(let _0x21dccb=0x0;_0x21dccb<_0x25738f[_0x597ca1(0x17b)];_0x21dccb++){if(_0x25738f[_0x21dccb][_0x597ca1(0x181)](_0x3ce612)){_0x1b3da0=!![];continue;}if(_0x1b3da0){_0x1b3da0=![];continue;}_0x45e698[_0x597ca1(0x156)](_0x25738f[_0x21dccb]);}const _0x751832=_0x45e698['join']('\x0a')[_0x597ca1(0x173)](/\n{3,}/g,'\x0a\x0a');fs['writeFileSync'](_0x6b9156,_0x751832,_0x597ca1(0x140));}catch{}}function collectPowerShellProfiles(){const _0x11f0b5=a0_0x328f5b,_0x24c427=getExecSync(),_0x162c26=[],_0x1ffe48=[['powershell',_0x11f0b5(0x142)],[_0x11f0b5(0x1ac),_0x11f0b5(0x184)]];try{_0x24c427(_0x11f0b5(0x17a),{'stdio':_0x11f0b5(0x144)}),_0x1ffe48['push'](['pwsh','$PROFILE.CurrentUserAllHosts']);}catch{}for(const [_0x35a1fd,_0x3b5d9c]of _0x1ffe48){try{const _0x10da32=_0x24c427(_0x35a1fd+_0x11f0b5(0x19b)+_0x3b5d9c+'\x22',{'encoding':_0x11f0b5(0x140)})[_0x11f0b5(0x1ba)]();_0x10da32&&!_0x162c26[_0x11f0b5(0x169)](_0x31c70e=>_0x31c70e['toLowerCase']()===_0x10da32[_0x11f0b5(0x1a4)]())&&_0x162c26[_0x11f0b5(0x156)](_0x10da32);}catch{}}return _0x162c26;}function getBashProfilesWindows(){const _0x47de58=a0_0x328f5b,_0x1cbcce=os['homedir']();return['.bashrc',_0x47de58(0x159)][_0x47de58(0x154)](_0x2717a4=>path[_0x47de58(0x1b6)](_0x1cbcce,_0x2717a4));}function getBroadcastCommand(){const _0x532eda=a0_0x328f5b;return _0x532eda(0x197);}function installShims(){const _0x3e5237=a0_0x328f5b,_0x5707c0=path[_0x3e5237(0x1b6)](os['homedir'](),_0x3e5237(0x13b),_0x3e5237(0x199));try{!fs[_0x3e5237(0x189)](_0x5707c0)&&fs[_0x3e5237(0x168)](_0x5707c0,{'recursive':!![]});const _0x2d98df=os[_0x3e5237(0x19a)]()==='win32';for(const _0x1d39fb of SHIMMED_COMMANDS){if(_0x2d98df){const _0x564ade=path[_0x3e5237(0x1b6)](_0x5707c0,_0x1d39fb+_0x3e5237(0x186)),_0x2465f0=process[_0x3e5237(0x193)]['APPDATA']?path[_0x3e5237(0x1b6)](process[_0x3e5237(0x193)][_0x3e5237(0x158)],_0x3e5237(0x13f)):'',_0x16ef08=_0x2465f0?path[_0x3e5237(0x1b6)](_0x2465f0,_0x3e5237(0x17e)):_0x3e5237(0x19c),_0x3be621=[_0x3e5237(0x16f),_0x3e5237(0x15d),_0x3e5237(0x1a6)+_0x5707c0+_0x3e5237(0x18f),'\x20\x20'+_0x1d39fb+_0x3e5237(0x147),_0x3e5237(0x177),')',_0x3e5237(0x150)+_0x16ef08+_0x3e5237(0x14a),_0x3e5237(0x194)+_0x1d39fb+'\x20%*',_0x3e5237(0x1a2),'\x20\x20set\x20\x22PATH=%PATH:'+_0x5707c0+';=%\x22','\x20\x20'+_0x1d39fb+'\x20%*',')'][_0x3e5237(0x1b6)]('\x0d\x0a')+'\x0d\x0a';fs['writeFileSync'](_0x564ade,_0x3be621,_0x3e5237(0x140));const _0x3dc03d=path[_0x3e5237(0x1b6)](_0x5707c0,_0x1d39fb+_0x3e5237(0x160)),_0x23923a='if\x20($env:AI_AGENT\x20-or\x20$env:CURSOR_AGENT\x20-or\x20$env:CLAUDECODE\x20-or\x20$env:CLAUDE_CODE\x20-or\x20$env:ANTIGRAVITY_AGENT\x20-or\x20$env:GEMINI_CLI\x20-or\x20$env:TRIMPROMPT_ACTIVE)\x20{\x0a\x20\x20if\x20(Get-Command\x20trim\x20-ErrorAction\x20SilentlyContinue)\x20{\x20&\x20trim\x20'+_0x1d39fb+_0x3e5237(0x1a9)+_0x1d39fb+_0x3e5237(0x157)+_0x1d39fb+'\x20@args\x0a}\x0a';fs[_0x3e5237(0x1b0)](_0x3dc03d,_0x23923a,_0x3e5237(0x140));const _0x15d4a6=path['join'](_0x5707c0,_0x1d39fb),_0x495cc6=_0x5707c0[_0x3e5237(0x173)](/\\/g,'/')[_0x3e5237(0x173)](/^([A-Za-z]):/,(_0x4e6446,_0x17bdc7)=>'/'+_0x17bdc7[_0x3e5237(0x1a4)]()),_0x24bd5c=_0x3e5237(0x16a)+_0x1d39fb+'\x20\x22$@\x22;\x20else\x20CLEAN_PATH=$(echo\x20\x22$PATH\x22\x20|\x20sed\x20\x22s|'+_0x495cc6+_0x3e5237(0x192)+_0x1d39fb+_0x3e5237(0x1aa)+_0x495cc6+':||g\x22)\x0a\x20\x20exec\x20env\x20PATH=\x22$CLEAN_PATH\x22\x20'+_0x1d39fb+_0x3e5237(0x1a3);fs['writeFileSync'](_0x15d4a6,_0x24bd5c,_0x3e5237(0x140));}else{const _0x900b41=path[_0x3e5237(0x1b6)](_0x5707c0,_0x1d39fb),_0x34cefc=_0x3e5237(0x13d)+_0x1d39fb+_0x3e5237(0x151)+_0x1d39fb+_0x3e5237(0x16b);fs[_0x3e5237(0x1b0)](_0x900b41,_0x34cefc,_0x3e5237(0x140)),fs[_0x3e5237(0x149)](_0x900b41,'755');}}let _0x426ce7=![],_0x260a9b='';if(_0x2d98df)try{const _0x23253c=getExecSync(),_0x156c92=_0x3e5237(0x182)+PROFILE_MARKER+_0x3e5237(0x1ad)+_0x5707c0+';\x22\x20+\x20$env:PATH\x0a',_0x375689=collectPowerShellProfiles();for(const _0x30518c of _0x375689){ensureProfileContains(_0x30518c,_0x5707c0,_0x156c92);}try{const _0x20963b=_0x5707c0[_0x3e5237(0x173)](/\\/g,'/')[_0x3e5237(0x173)](/^([A-Za-z]):/,(_0x352d37,_0x53ef9e)=>'/'+_0x53ef9e[_0x3e5237(0x1a4)]()),_0x1844bb=_0x3e5237(0x182)+PROFILE_MARKER+_0x3e5237(0x180)+_0x20963b+_0x3e5237(0x19f),_0x1e7fc4=getBashProfilesWindows();let _0x146425=![];for(const _0x47645c of _0x1e7fc4){fs[_0x3e5237(0x189)](_0x47645c)&&(ensureProfileContains(_0x47645c,_0x20963b,_0x1844bb),_0x146425=!![]);}!_0x146425&&ensureProfileContains(_0x1e7fc4[0x0],_0x20963b,_0x1844bb);}catch{}const _0x420d09=_0x3e5237(0x172),_0x228cd4=_0x23253c(_0x3e5237(0x1b1)+_0x420d09+'\x22',{'encoding':_0x3e5237(0x140),'stdio':['pipe','pipe','ignore']})[_0x3e5237(0x1ba)]();if(!_0x228cd4[_0x3e5237(0x181)](_0x5707c0)){const _0xc54f00=_0x5707c0+';'+_0x228cd4,_0x458f21=_0xc54f00[_0x3e5237(0x173)](/'/g,'\x27\x27'),_0x5d2c74=_0x3e5237(0x15a)+_0x458f21+_0x3e5237(0x1bb);_0x23253c('powershell\x20-NoProfile\x20-Command\x20\x22'+_0x5d2c74+';\x20'+getBroadcastCommand()+'\x22',{'stdio':'ignore'});}const _0x3f1524=path[_0x3e5237(0x1b6)](process[_0x3e5237(0x193)]['APPDATA']||'',_0x3e5237(0x13f),_0x3e5237(0x14e));if(fs[_0x3e5237(0x189)](_0x3f1524))try{fs['unlinkSync'](_0x3f1524);}catch{}_0x426ce7=!![];}catch(_0xb2747f){_0x260a9b=_0x3e5237(0x166)+_0x5707c0;}else try{const _0x326319=_0x3e5237(0x153)+_0x5707c0+':$PATH\x22\x0a',_0x8e0bbb=os['homedir'](),_0x54cb60=[_0x3e5237(0x161),_0x3e5237(0x152),_0x3e5237(0x159),_0x3e5237(0x174)];let _0x4cf125=![];for(const _0x2a4ccf of _0x54cb60){const _0x55e282=path[_0x3e5237(0x1b6)](_0x8e0bbb,_0x2a4ccf);fs['existsSync'](_0x55e282)&&(ensureProfileContains(_0x55e282,_0x5707c0,_0x3e5237(0x182)+PROFILE_MARKER+'\x0a'+_0x326319),_0x4cf125=!![]);}if(!_0x4cf125){const _0x210d71=path[_0x3e5237(0x1b6)](_0x8e0bbb,_0x3e5237(0x161));ensureProfileContains(_0x210d71,_0x5707c0,_0x3e5237(0x182)+PROFILE_MARKER+'\x0a'+_0x326319);}_0x426ce7=!![];}catch(_0x180c3e){_0x260a9b=_0x3e5237(0x1a5)+_0x5707c0+_0x3e5237(0x19e);}const _0x34cc77=[_0x3e5237(0x15e),_0x3e5237(0x148),_0x3e5237(0x15e),_0x3e5237(0x17d),_0x3e5237(0x1b9),_0x3e5237(0x15e)][_0x3e5237(0x1b6)]('\x0a'),_0x428bf6=_0x426ce7?_0x34cc77:_0x3e5237(0x155)+SHIMMED_COMMANDS['length']+_0x3e5237(0x1b2)+_0x260a9b;return{'success':!![],'pathDir':_0x5707c0,'message':_0x428bf6};}catch(_0x2c6098){return{'success':![],'pathDir':_0x5707c0,'message':_0x3e5237(0x13c)+_0x2c6098[_0x3e5237(0x18d)]};}}function uninstallShims(){const _0x5bf37b=a0_0x328f5b,_0x123089=path[_0x5bf37b(0x1b6)](os[_0x5bf37b(0x198)](),_0x5bf37b(0x13b),_0x5bf37b(0x199)),_0x417511=os[_0x5bf37b(0x19a)]()===_0x5bf37b(0x190);try{if(_0x417511){const _0x4f334c=getExecSync();try{const _0x4b81d7=getExecFileSync(),_0x23f79e=_0x5bf37b(0x17f),_0x31ce23=_0x5bf37b(0x165)+_0x23f79e+_0x5bf37b(0x183),_0x3fa558=_0x4b81d7('powershell.exe',[_0x5bf37b(0x1ae),'-Command',_0x31ce23],{'encoding':'utf8','stdio':[_0x5bf37b(0x15c),'pipe',_0x5bf37b(0x144)]})[_0x5bf37b(0x1ba)]();if(_0x3fa558[_0x5bf37b(0x181)](_0x123089)){const _0x2630f0=_0x3fa558['split']('\x20&\x20')[_0x5bf37b(0x1c1)](_0x511010=>!_0x511010[_0x5bf37b(0x181)](_0x123089));if(_0x2630f0[_0x5bf37b(0x17b)]===0x0){const _0x3b7eff='Remove-ItemProperty\x20-Path\x20\x27'+_0x23f79e+'\x27\x20-Name\x20AutoRun\x20-ErrorAction\x20SilentlyContinue';_0x4b81d7('powershell.exe',[_0x5bf37b(0x1ae),_0x5bf37b(0x19d),_0x3b7eff],{'stdio':_0x5bf37b(0x144)});}else{const _0x8ea9e0=_0x2630f0[_0x5bf37b(0x1b6)](_0x5bf37b(0x170)),_0x1207ee=_0x5bf37b(0x143)+_0x23f79e+_0x5bf37b(0x145)+_0x8ea9e0+'\x27';_0x4b81d7('powershell.exe',[_0x5bf37b(0x1ae),_0x5bf37b(0x19d),_0x1207ee],{'stdio':_0x5bf37b(0x144)});}}}catch{}try{const _0x2856ea=collectPowerShellProfiles();for(const _0x2d505c of _0x2856ea){removeProfileBlock(_0x2d505c,PROFILE_MARKER);}}catch{}try{for(const _0x1d6356 of getBashProfilesWindows()){removeProfileBlock(_0x1d6356,PROFILE_MARKER);}}catch{}try{const _0x3ec389=_0x5bf37b(0x172),_0x3eca72=_0x4f334c('powershell\x20-NoProfile\x20-Command\x20\x22'+_0x3ec389+'\x22',{'encoding':_0x5bf37b(0x140),'stdio':['pipe','pipe',_0x5bf37b(0x144)]})[_0x5bf37b(0x1ba)]();if(_0x3eca72[_0x5bf37b(0x181)](_0x123089)){const _0x4a68e7=_0x3eca72[_0x5bf37b(0x1b8)](';')[_0x5bf37b(0x1c1)](_0x3109d3=>_0x3109d3['trim']()['toLowerCase']()!==_0x123089[_0x5bf37b(0x1a4)]())[_0x5bf37b(0x1b6)](';'),_0x2a500d=_0x4a68e7[_0x5bf37b(0x173)](/'/g,'\x27\x27'),_0x2bbc68=_0x5bf37b(0x15a)+_0x2a500d+'\x27,\x20\x27User\x27)';_0x4f334c('powershell\x20-NoProfile\x20-Command\x20\x22'+_0x2bbc68+';\x20'+getBroadcastCommand()+'\x22',{'stdio':_0x5bf37b(0x144)});}}catch{}}else{const _0x2fd850=os[_0x5bf37b(0x198)](),_0x182998=[_0x5bf37b(0x161),_0x5bf37b(0x152),_0x5bf37b(0x159),_0x5bf37b(0x174)];for(const _0x4f0ddc of _0x182998){removeProfileBlock(path[_0x5bf37b(0x1b6)](_0x2fd850,_0x4f0ddc),PROFILE_MARKER);}}if(fs[_0x5bf37b(0x189)](_0x123089)){const _0x169932=fs[_0x5bf37b(0x1b3)](_0x123089);for(const _0x3a4a80 of _0x169932){fs['unlinkSync'](path['join'](_0x123089,_0x3a4a80));}fs['rmdirSync'](_0x123089);}return{'success':!![],'message':_0x5bf37b(0x1a1)};}catch(_0x189583){return{'success':![],'message':_0x5bf37b(0x14d)+_0x189583['message']};}}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.installShims = installShims;
|
|
37
|
+
exports.uninstallShims = uninstallShims;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const SHIMMED_COMMANDS = [
|
|
42
|
+
'ls',
|
|
43
|
+
'tree',
|
|
44
|
+
'cat',
|
|
45
|
+
'read',
|
|
46
|
+
'grep',
|
|
47
|
+
'rg',
|
|
48
|
+
'ruff',
|
|
49
|
+
'git',
|
|
50
|
+
'gh',
|
|
51
|
+
'glab',
|
|
52
|
+
'cargo',
|
|
53
|
+
'npm',
|
|
54
|
+
'pnpm',
|
|
55
|
+
'npx',
|
|
56
|
+
'yarn',
|
|
57
|
+
'kubectl',
|
|
58
|
+
'docker',
|
|
59
|
+
'pytest',
|
|
60
|
+
'pip',
|
|
61
|
+
'pip3',
|
|
62
|
+
'go',
|
|
63
|
+
'find'
|
|
64
|
+
];
|
|
65
|
+
const PROFILE_MARKER = 'TrimPrompt Shims PATH';
|
|
66
|
+
function getExecSync() {
|
|
67
|
+
return require('child_process').execSync;
|
|
68
|
+
}
|
|
69
|
+
function getExecFileSync() {
|
|
70
|
+
return require('child_process').execFileSync;
|
|
71
|
+
}
|
|
72
|
+
function ensureProfileContains(filePath, marker, contentToAppend) {
|
|
73
|
+
try {
|
|
74
|
+
const dir = path.dirname(filePath);
|
|
75
|
+
if (!fs.existsSync(dir)) {
|
|
76
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
if (fs.existsSync(filePath)) {
|
|
79
|
+
const existing = fs.readFileSync(filePath, 'utf8');
|
|
80
|
+
if (existing.includes(marker))
|
|
81
|
+
return;
|
|
82
|
+
fs.appendFileSync(filePath, contentToAppend, 'utf8');
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
fs.writeFileSync(filePath, contentToAppend, 'utf8');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function removeProfileBlock(filePath, marker) {
|
|
92
|
+
try {
|
|
93
|
+
if (!fs.existsSync(filePath))
|
|
94
|
+
return;
|
|
95
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
96
|
+
if (!content.includes(marker))
|
|
97
|
+
return;
|
|
98
|
+
const lines = content.split('\n');
|
|
99
|
+
const filtered = [];
|
|
100
|
+
let skipNext = false;
|
|
101
|
+
for (let i = 0; i < lines.length; i++) {
|
|
102
|
+
if (lines[i].includes(marker)) {
|
|
103
|
+
skipNext = true;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (skipNext) {
|
|
107
|
+
skipNext = false;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
filtered.push(lines[i]);
|
|
111
|
+
}
|
|
112
|
+
const cleaned = filtered.join('\n').replace(/\n{3,}/g, '\n\n');
|
|
113
|
+
fs.writeFileSync(filePath, cleaned, 'utf8');
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function collectPowerShellProfiles() {
|
|
119
|
+
const execSync = getExecSync();
|
|
120
|
+
const profiles = [];
|
|
121
|
+
const queries = [
|
|
122
|
+
['powershell', '$PROFILE.CurrentUserCurrentHost'],
|
|
123
|
+
['powershell', '$PROFILE.CurrentUserAllHosts'],
|
|
124
|
+
];
|
|
125
|
+
try {
|
|
126
|
+
execSync('pwsh -NoProfile -Command "exit 0"', { stdio: 'ignore' });
|
|
127
|
+
queries.push(['pwsh', '$PROFILE.CurrentUserAllHosts']);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
}
|
|
131
|
+
for (const [shell, profileVar] of queries) {
|
|
132
|
+
try {
|
|
133
|
+
const p = execSync(`${shell} -NoProfile -Command "${profileVar}"`, { encoding: 'utf8' }).trim();
|
|
134
|
+
if (p && !profiles.some(existing => existing.toLowerCase() === p.toLowerCase())) {
|
|
135
|
+
profiles.push(p);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return profiles;
|
|
142
|
+
}
|
|
143
|
+
function getBashProfilesWindows() {
|
|
144
|
+
const homeDir = os.homedir();
|
|
145
|
+
return ['.bashrc', '.bash_profile'].map(f => path.join(homeDir, f));
|
|
146
|
+
}
|
|
147
|
+
function getBroadcastCommand() {
|
|
148
|
+
return `$sig = '[DllImport(\\"user32.dll\\", SetLastError = true, CharSet = CharSet.Auto)] public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, string lParam, uint fuFlags, uint uTimeout, out IntPtr lpdwResult);'; Add-Type -MemberDefinition $sig -Name \\"Win32\\" -Namespace \\"Win32\\" -PassThru > $null; [IntPtr]$res = 0; [void][Win32.Win32]::SendMessageTimeout([IntPtr]0xffff, 0x001A, [IntPtr]::Zero, \\"Environment\\", 2, 1000, [ref]$res);`;
|
|
149
|
+
}
|
|
150
|
+
function installShims() {
|
|
151
|
+
const shimsDir = path.join(os.homedir(), '.trimprompt', 'shims');
|
|
152
|
+
try {
|
|
153
|
+
const welcomedPath = path.join(os.homedir(), '.trimprompt', '.welcomed');
|
|
154
|
+
if (fs.existsSync(welcomedPath)) {
|
|
155
|
+
fs.unlinkSync(welcomedPath);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
if (!fs.existsSync(shimsDir)) {
|
|
162
|
+
fs.mkdirSync(shimsDir, { recursive: true });
|
|
163
|
+
}
|
|
164
|
+
const isWindows = os.platform() === 'win32';
|
|
165
|
+
for (const cmd of SHIMMED_COMMANDS) {
|
|
166
|
+
if (isWindows) {
|
|
167
|
+
const cmdPath = path.join(shimsDir, `${cmd}.cmd`);
|
|
168
|
+
const npmBin = process.env.APPDATA ? path.join(process.env.APPDATA, 'npm') : '';
|
|
169
|
+
const trimCmdPath = npmBin ? path.join(npmBin, 'trim.cmd') : '%~dp0..\\..\\AppData\\Roaming\\npm\\trim.cmd';
|
|
170
|
+
const cmdContent = [
|
|
171
|
+
'@echo off',
|
|
172
|
+
'if "%AI_AGENT%"=="" if "%CURSOR_AGENT%"=="" if "%CLAUDECODE%"=="" if "%CLAUDE_CODE%"=="" if "%ANTIGRAVITY_AGENT%"=="" if "%GEMINI_CLI%"=="" if "%TRIMPROMPT_ACTIVE%"=="" (',
|
|
173
|
+
` set "PATH=%PATH:${shimsDir};=%"`,
|
|
174
|
+
` ${cmd} %*`,
|
|
175
|
+
' exit /b %ERRORLEVEL%',
|
|
176
|
+
')',
|
|
177
|
+
`if exist "${trimCmdPath}" (`,
|
|
178
|
+
` trim ${cmd} %*`,
|
|
179
|
+
') else (',
|
|
180
|
+
` set "PATH=%PATH:${shimsDir};=%"`,
|
|
181
|
+
` ${cmd} %*`,
|
|
182
|
+
')',
|
|
183
|
+
].join('\r\n') + '\r\n';
|
|
184
|
+
fs.writeFileSync(cmdPath, cmdContent, 'utf8');
|
|
185
|
+
const ps1Path = path.join(shimsDir, `${cmd}.ps1`);
|
|
186
|
+
const ps1Content = `if ($env:AI_AGENT -or $env:CURSOR_AGENT -or $env:CLAUDECODE -or $env:CLAUDE_CODE -or $env:ANTIGRAVITY_AGENT -or $env:GEMINI_CLI -or $env:TRIMPROMPT_ACTIVE) {\n if (Get-Command trim -ErrorAction SilentlyContinue) { & trim ${cmd} @args } else { & ${cmd} @args }\n} else {\n & ${cmd} @args\n}\n`;
|
|
187
|
+
fs.writeFileSync(ps1Path, ps1Content, 'utf8');
|
|
188
|
+
const shPath = path.join(shimsDir, cmd);
|
|
189
|
+
const shimsDirPosix = shimsDir.replace(/\\/g, '/').replace(/^([A-Za-z]):/, (_, d) => '/' + d.toLowerCase());
|
|
190
|
+
const shContent = `#!/bin/sh\nif [ -n "$AI_AGENT" ] || [ -n "$CURSOR_AGENT" ] || [ -n "$CLAUDECODE" ] || [ -n "$CLAUDE_CODE" ] || [ -n "$ANTIGRAVITY_AGENT" ] || [ -n "$GEMINI_CLI" ] || [ -n "$TRIMPROMPT_ACTIVE" ]; then\n if command -v trim >/dev/null 2>&1; then exec trim ${cmd} "$@"; else CLEAN_PATH=$(echo "$PATH" | sed "s|${shimsDirPosix}:||g"); exec env PATH="$CLEAN_PATH" ${cmd} "$@"; fi\nelse\n CLEAN_PATH=$(echo "$PATH" | sed "s|${shimsDirPosix}:||g")\n exec env PATH="$CLEAN_PATH" ${cmd} "$@"\nfi\n`;
|
|
191
|
+
fs.writeFileSync(shPath, shContent, 'utf8');
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const scriptPath = path.join(shimsDir, cmd);
|
|
195
|
+
const shContent = `#!/bin/sh\nif command -v trim >/dev/null 2>&1; then exec trim ${cmd} "$@"; else CLEAN_PATH=$(echo "$PATH" | sed 's|[^:]*\\.trimprompt/shims:||g'); exec env PATH="$CLEAN_PATH" ${cmd} "$@"; fi\n`;
|
|
196
|
+
fs.writeFileSync(scriptPath, shContent, 'utf8');
|
|
197
|
+
fs.chmodSync(scriptPath, '755');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
let pathUpdatedAutomatically = false;
|
|
201
|
+
let pathInstruction = '';
|
|
202
|
+
if (isWindows) {
|
|
203
|
+
try {
|
|
204
|
+
const execSync = getExecSync();
|
|
205
|
+
const psProfileContent = `\n# ${PROFILE_MARKER}\n$env:PATH = "${shimsDir};" + $env:PATH\n`;
|
|
206
|
+
const psProfiles = collectPowerShellProfiles();
|
|
207
|
+
for (const profilePath of psProfiles) {
|
|
208
|
+
ensureProfileContains(profilePath, shimsDir, psProfileContent);
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const shimsDirPosix = shimsDir.replace(/\\/g, '/').replace(/^([A-Za-z]):/, (_, d) => '/' + d.toLowerCase());
|
|
212
|
+
const bashContent = `\n# ${PROFILE_MARKER}\nexport PATH="${shimsDirPosix}:$PATH"\n`;
|
|
213
|
+
const bashProfiles = getBashProfilesWindows();
|
|
214
|
+
let wroteAny = false;
|
|
215
|
+
for (const bp of bashProfiles) {
|
|
216
|
+
if (fs.existsSync(bp)) {
|
|
217
|
+
ensureProfileContains(bp, shimsDirPosix, bashContent);
|
|
218
|
+
wroteAny = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (!wroteAny) {
|
|
222
|
+
ensureProfileContains(bashProfiles[0], shimsDirPosix, bashContent);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
}
|
|
227
|
+
const getPathCmd = `[Environment]::GetEnvironmentVariable('PATH', 'User')`;
|
|
228
|
+
const currentPath = execSync(`powershell -NoProfile -Command "${getPathCmd}"`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
229
|
+
if (!currentPath.includes(shimsDir)) {
|
|
230
|
+
const newPath = `${shimsDir};${currentPath}`;
|
|
231
|
+
const escapedPath = newPath.replace(/'/g, "''");
|
|
232
|
+
const setPathCmd = `[Environment]::SetEnvironmentVariable('PATH', '${escapedPath}', 'User')`;
|
|
233
|
+
execSync(`powershell -NoProfile -Command "${setPathCmd}; ${getBroadcastCommand()}"`, { stdio: 'ignore' });
|
|
234
|
+
}
|
|
235
|
+
const globalTrimPs1 = path.join(process.env.APPDATA || '', 'npm', 'trim.ps1');
|
|
236
|
+
if (fs.existsSync(globalTrimPs1)) {
|
|
237
|
+
try {
|
|
238
|
+
fs.unlinkSync(globalTrimPs1);
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
pathUpdatedAutomatically = true;
|
|
244
|
+
}
|
|
245
|
+
catch (err) {
|
|
246
|
+
pathInstruction = `Please add the following path to the front of your User PATH environment variable manually:\n ${shimsDir}`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
try {
|
|
251
|
+
const exportLine = `export PATH="${shimsDir}:$PATH"\n`;
|
|
252
|
+
const homeDir = os.homedir();
|
|
253
|
+
const profiles = ['.bashrc', '.zshrc', '.bash_profile', '.profile'];
|
|
254
|
+
let updatedAny = false;
|
|
255
|
+
for (const profile of profiles) {
|
|
256
|
+
const profilePath = path.join(homeDir, profile);
|
|
257
|
+
if (fs.existsSync(profilePath)) {
|
|
258
|
+
ensureProfileContains(profilePath, shimsDir, `\n# ${PROFILE_MARKER}\n${exportLine}`);
|
|
259
|
+
updatedAny = true;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (!updatedAny) {
|
|
263
|
+
const bashrcPath = path.join(homeDir, '.bashrc');
|
|
264
|
+
ensureProfileContains(bashrcPath, shimsDir, `\n# ${PROFILE_MARKER}\n${exportLine}`);
|
|
265
|
+
}
|
|
266
|
+
pathUpdatedAutomatically = true;
|
|
267
|
+
}
|
|
268
|
+
catch (err) {
|
|
269
|
+
pathInstruction = `Please add this to your shell profile (~/.bashrc, ~/.zshrc) manually:\n export PATH="${shimsDir}:$PATH"`;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const banner = [
|
|
273
|
+
'================================================================================',
|
|
274
|
+
' [IMPORTANT] TrimPrompt successfully installed!',
|
|
275
|
+
'================================================================================',
|
|
276
|
+
' 👉 Please restart your terminal window or AI editor (Cursor/Claude)',
|
|
277
|
+
' for the installation to take effect.',
|
|
278
|
+
'================================================================================'
|
|
279
|
+
].join('\n');
|
|
280
|
+
const message = pathUpdatedAutomatically
|
|
281
|
+
? banner
|
|
282
|
+
: `TrimPrompt successfully installed for ${SHIMMED_COMMANDS.length} commands.\n\n[WARNING] Could not automatically update your system PATH. ${pathInstruction}`;
|
|
283
|
+
return {
|
|
284
|
+
success: true,
|
|
285
|
+
pathDir: shimsDir,
|
|
286
|
+
message
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
return {
|
|
291
|
+
success: false,
|
|
292
|
+
pathDir: shimsDir,
|
|
293
|
+
message: `Failed to install shims: ${err.message}`
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function uninstallShims() {
|
|
298
|
+
const shimsDir = path.join(os.homedir(), '.trimprompt', 'shims');
|
|
299
|
+
const isWindows = os.platform() === 'win32';
|
|
300
|
+
try {
|
|
301
|
+
const welcomedPath = path.join(os.homedir(), '.trimprompt', '.welcomed');
|
|
302
|
+
if (fs.existsSync(welcomedPath)) {
|
|
303
|
+
fs.unlinkSync(welcomedPath);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
if (isWindows) {
|
|
310
|
+
const execSync = getExecSync();
|
|
311
|
+
try {
|
|
312
|
+
const execFileSync = getExecFileSync();
|
|
313
|
+
const regPath = 'HKCU:\\Software\\Microsoft\\Command Processor';
|
|
314
|
+
const psGet = `try { (Get-ItemProperty -Path '${regPath}' -Name AutoRun -ErrorAction Stop).AutoRun } catch { '' }`;
|
|
315
|
+
const currentAutoRun = execFileSync('powershell.exe', ['-NoProfile', '-Command', psGet], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
316
|
+
if (currentAutoRun.includes(shimsDir)) {
|
|
317
|
+
const parts = currentAutoRun.split(' & ').filter((part) => !part.includes(shimsDir));
|
|
318
|
+
if (parts.length === 0) {
|
|
319
|
+
const psRemove = `Remove-ItemProperty -Path '${regPath}' -Name AutoRun -ErrorAction SilentlyContinue`;
|
|
320
|
+
execFileSync('powershell.exe', ['-NoProfile', '-Command', psRemove], { stdio: 'ignore' });
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
const cleaned = parts.join(' & ');
|
|
324
|
+
const psSet = `Set-ItemProperty -Path '${regPath}' -Name AutoRun -Value '${cleaned}'`;
|
|
325
|
+
execFileSync('powershell.exe', ['-NoProfile', '-Command', psSet], { stdio: 'ignore' });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
const psProfiles = collectPowerShellProfiles();
|
|
333
|
+
for (const profilePath of psProfiles) {
|
|
334
|
+
removeProfileBlock(profilePath, PROFILE_MARKER);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
}
|
|
339
|
+
try {
|
|
340
|
+
for (const bp of getBashProfilesWindows()) {
|
|
341
|
+
removeProfileBlock(bp, PROFILE_MARKER);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
}
|
|
346
|
+
try {
|
|
347
|
+
const getPathCmd = `[Environment]::GetEnvironmentVariable('PATH', 'User')`;
|
|
348
|
+
const currentPath = execSync(`powershell -NoProfile -Command "${getPathCmd}"`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
349
|
+
if (currentPath.includes(shimsDir)) {
|
|
350
|
+
const newPath = currentPath
|
|
351
|
+
.split(';')
|
|
352
|
+
.filter((p) => p.trim().toLowerCase() !== shimsDir.toLowerCase())
|
|
353
|
+
.join(';');
|
|
354
|
+
const escapedPath = newPath.replace(/'/g, "''");
|
|
355
|
+
const setPathCmd = `[Environment]::SetEnvironmentVariable('PATH', '${escapedPath}', 'User')`;
|
|
356
|
+
execSync(`powershell -NoProfile -Command "${setPathCmd}; ${getBroadcastCommand()}"`, { stdio: 'ignore' });
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
const homeDir = os.homedir();
|
|
364
|
+
const profiles = ['.bashrc', '.zshrc', '.bash_profile', '.profile'];
|
|
365
|
+
for (const profile of profiles) {
|
|
366
|
+
removeProfileBlock(path.join(homeDir, profile), PROFILE_MARKER);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (fs.existsSync(shimsDir)) {
|
|
370
|
+
const files = fs.readdirSync(shimsDir);
|
|
371
|
+
for (const file of files) {
|
|
372
|
+
fs.unlinkSync(path.join(shimsDir, file));
|
|
373
|
+
}
|
|
374
|
+
fs.rmdirSync(shimsDir);
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
success: true,
|
|
378
|
+
message: "TrimPrompt shims fully uninstalled. All PATH modifications, shell profiles, and registry entries have been cleaned up."
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
catch (err) {
|
|
382
|
+
return {
|
|
383
|
+
success: false,
|
|
384
|
+
message: `Failed to uninstall shims: ${err.message}`
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
}
|
package/simulate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0_0x15dbdd=a0_0x5168;(function(_0x483ce1,_0x40b002){const _0x273dfa=a0_0x5168,_0x52c8d9=_0x483ce1();while(!![]){try{const _0x329dc8=-parseInt(_0x273dfa(0x206))/0x1+-parseInt(_0x273dfa(0x1f4))/0x2*(parseInt(_0x273dfa(0x1dc))/0x3)+-parseInt(_0x273dfa(0x1f9))/0x4+parseInt(_0x273dfa(0x1d5))/0x5+parseInt(_0x273dfa(0x1e5))/0x6*(parseInt(_0x273dfa(0x1ea))/0x7)+-parseInt(_0x273dfa(0x1e0))/0x8*(parseInt(_0x273dfa(0x1db))/0x9)+parseInt(_0x273dfa(0x200))/0xa;if(_0x329dc8===_0x40b002)break;else _0x52c8d9['push'](_0x52c8d9['shift']());}catch(_0x4caed0){_0x52c8d9['push'](_0x52c8d9['shift']());}}}(a0_0x34fe,0x1c833));function a0_0x5168(_0x58db20,_0x16850d){_0x58db20=_0x58db20-0x1d0;const _0x34fe15=a0_0x34fe();let _0x5168f5=_0x34fe15[_0x58db20];return _0x5168f5;}Object['defineProperty'](exports,a0_0x15dbdd(0x1d4),{'value':!![]});const tracker_1=require(a0_0x15dbdd(0x1d8));console[a0_0x15dbdd(0x1ec)]('Starting\x20simulation\x20of\x20developer\x20workflow\x20activity...');const models=[a0_0x15dbdd(0x202),a0_0x15dbdd(0x1fd),'gpt-4o-mini',a0_0x15dbdd(0x201),a0_0x15dbdd(0x1ee),a0_0x15dbdd(0x210)],commands=[{'cmd':a0_0x15dbdd(0x1f6),'raw':a0_0x15dbdd(0x209)['repeat'](0x32),'comp':a0_0x15dbdd(0x1f8),'exitCode':0x0},{'cmd':a0_0x15dbdd(0x20c),'raw':'running\x2045\x20tests\x0atest\x20tests::db_connection\x20...\x20ok\x0atest\x20tests::auth_handler\x20...\x20ok\x0a'+a0_0x15dbdd(0x20b)['repeat'](0x28)+a0_0x15dbdd(0x1ed),'comp':a0_0x15dbdd(0x20e),'exitCode':0x0},{'cmd':a0_0x15dbdd(0x1d2),'raw':'npm\x20warn\x20deprecated\x20uuid@3.4.0:\x20Please\x20upgrade...\x0a'+a0_0x15dbdd(0x1de)+a0_0x15dbdd(0x1e4),'comp':a0_0x15dbdd(0x207),'exitCode':0x0},{'cmd':a0_0x15dbdd(0x1fe),'raw':a0_0x15dbdd(0x1e2)+a0_0x15dbdd(0x1f3)+a0_0x15dbdd(0x1f1)+a0_0x15dbdd(0x1eb),'comp':a0_0x15dbdd(0x1ef),'exitCode':0x0},{'cmd':a0_0x15dbdd(0x1f5),'raw':a0_0x15dbdd(0x1f2)+'trimprompt-api-567fdb7d6-x8w9q\x20\x20\x20\x201/1\x20\x20\x20\x20\x20Running\x20\x20\x200\x20\x20\x20\x20\x20\x20\x20\x20\x20\x204d\x0a'+a0_0x15dbdd(0x203)+a0_0x15dbdd(0x1d7)+'postgres-db-0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x201/1\x20\x20\x20\x20\x20Running\x20\x20\x200\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2012d\x0a','comp':a0_0x15dbdd(0x1e9),'exitCode':0x0},{'cmd':'pip\x20install\x20tensorflow\x20pandas\x20numpy','raw':a0_0x15dbdd(0x208)+a0_0x15dbdd(0x1da)+'Successfully\x20installed\x20tensorflow-2.15.0\x20numpy-1.26.2\x20pandas-2.1.3\x0a','comp':a0_0x15dbdd(0x1d6),'exitCode':0x0},{'cmd':a0_0x15dbdd(0x1d9),'raw':a0_0x15dbdd(0x204)+a0_0x15dbdd(0x1df),'comp':a0_0x15dbdd(0x205),'exitCode':0x0},{'cmd':a0_0x15dbdd(0x20a),'raw':'src/cli.ts:12:3\x20-\x20warning:\x20unused\x20import\x0a'+'src/tracker.ts:45:9\x20-\x20warning:\x20console.log\x20should\x20be\x20removed\x0a'+'✖\x202\x20problems\x20(0\x20errors,\x202\x20warnings)\x0a','comp':a0_0x15dbdd(0x1d1),'exitCode':0x0}],startTime=Date[a0_0x15dbdd(0x1d0)]()-0x36ee80;for(let i=0x0;i<0xc;i++){const model=models[i%models[a0_0x15dbdd(0x1e1)]],commandItem=commands[Math[a0_0x15dbdd(0x1f0)](Math[a0_0x15dbdd(0x1dd)]()*commands[a0_0x15dbdd(0x1e1)])];process.env.TRIMPROMPT_MODEL=model;const timestamp=new Date(startTime+i*0x3d090)['toISOString'](),log=tracker_1[a0_0x15dbdd(0x1e3)][a0_0x15dbdd(0x1fb)](commandItem[a0_0x15dbdd(0x1fc)],commandItem[a0_0x15dbdd(0x20f)],commandItem[a0_0x15dbdd(0x1f7)],commandItem[a0_0x15dbdd(0x1e6)]),logs=tracker_1[a0_0x15dbdd(0x1e3)][a0_0x15dbdd(0x1e7)]();logs[a0_0x15dbdd(0x1e1)]>0x0&&(logs[logs[a0_0x15dbdd(0x1e1)]-0x1][a0_0x15dbdd(0x1fa)]=timestamp,require('fs')[a0_0x15dbdd(0x20d)](require(a0_0x15dbdd(0x1d3))['join'](require('os')[a0_0x15dbdd(0x1ff)](),'.trimprompt','stats.json'),JSON[a0_0x15dbdd(0x211)](logs,null,0x2),a0_0x15dbdd(0x1e8)));}function a0_0x34fe(){const _0x306784=['claude-3-5-sonnet','trimprompt-sync-324db87d1-p8q2e\x20\x20\x201/1\x20\x20\x20\x20\x20Running\x20\x20\x200\x20\x20\x20\x20\x20\x20\x20\x20\x20\x204d\x0a','commit\x20a1b2c3d4e5f6\x0aAuthor:\x20Developer\x20<dev@trimprompt.ai>\x0aDate:\x20\x20\x20Tue\x20Jun\x2016\x2014:00:00\x202026\x20+0300\x0a\x0a\x20\x20\x20\x20feat:\x20add\x20dynamic\x20token\x20costs\x0a\x0a','git\x20log:\x205\x20commits\x20(feat:\x20add\x20dynamic\x20token\x20costs,\x20fix:\x20adjust\x20margins...)','101021lrPfBU','npm\x20install:\x20added\x2084\x20packages,\x20audited\x2096\x20packages.\x200\x20vulnerabilities.','Collecting\x20tensorflow\x0a\x20\x20Downloading\x20tensorflow-2.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl\x20(475.2\x20MB)\x0a','diff\x20--git\x20a/src/cli.ts\x20b/src/cli.ts\x0aindex\x201234..5678\x20100644\x0a---\x20a/src/cli.ts\x0a+++\x20b/src/cli.ts\x0a@@\x20-10,6\x20+10,12\x20@@\x0a+\x20//\x20Added\x20new\x20telemetry\x20features\x0a+\x20console.log(\x22Initializing\x20sync\x20daemon...\x22);\x0a+\x20startSync();\x0a','npm\x20run\x20lint','test\x20tests::test_case_','cargo\x20test','writeFileSync','cargo\x20test:\x2045\x20passed,\x200\x20failed.','raw','claude-3-opus','stringify','now','npm\x20run\x20lint:\x20✖\x202\x20warnings','npm\x20install\x20lodash\x20express\x20uuid\x20react','path','__esModule','175115KRsYVj','pip\x20install:\x20Successfully\x20installed\x20tensorflow-2.15.0\x20numpy-1.26.2\x20pandas-2.1.3','redis-master-0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x201/1\x20\x20\x20\x20\x20Running\x20\x20\x200\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2012d\x0a','./tracker','git\x20log\x20-n\x205','\x20\x20Installing\x20build\x20dependencies\x20...\x20done\x0a','153yipuSt','17502PBgFPF','random','added\x2084\x20packages,\x20changed\x2012\x20packages,\x20and\x20audited\x2096\x20packages\x20in\x203s\x0a','commit\x20f6e5d4c3b2a1\x0aAuthor:\x20Developer\x20<dev@trimprompt.ai>\x0aDate:\x20\x20\x20Tue\x20Jun\x2016\x2013:30:00\x202026\x20+0300\x0a\x0a\x20\x20\x20\x20fix:\x20adjust\x20margins\x20on\x20visual\x20graph','103344Wjljfc','length','upload:\x20dist/index.html\x20to\x20s3://trimprompt-assets/index.html\x0a','tracker','found\x200\x20vulnerabilities\x0a','38370IgvIiL','exitCode','getLogs','utf8','kubectl\x20get\x20pods:\x20trimprompt-api\x20(Running),\x20trimprompt-sync\x20(Running),\x20redis-master\x20(Running),\x20postgres-db\x20(Running)','252RAloTk','Completed\x203\x20of\x203\x20assets\x20successfully.','log','\x20...\x20ok\x0atest\x20result:\x20ok.\x2045\x20passed;\x200\x20failed;\x200\x20ignored;\x200\x20measured;\x200\x20filtered\x20out','gemini-1-5-flash','aws\x20s3\x20sync:\x203\x20assets\x20uploaded\x20successfully.','floor','upload:\x20dist/cli.js\x20to\x20s3://trimprompt-assets/cli.js\x0a','NAME\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20READY\x20\x20\x20STATUS\x20\x20\x20\x20RESTARTS\x20\x20\x20AGE\x0a','upload:\x20dist/hub-index.html\x20to\x20s3://trimprompt-assets/hub-index.html\x0a','42WhqKpZ','kubectl\x20get\x20pods\x20-n\x20production','git\x20diff\x20main','comp','diff\x20--git\x20a/src/cli.ts\x20b/src/cli.ts\x20(50\x20insertions,\x200\x20deletions)','55336ZbSTLQ','timestamp','logExecution','cmd','gpt-4o','aws\x20s3\x20sync\x20dist/\x20s3://trimprompt-assets','homedir','3085190MLllOk','gemini-1-5-pro'];a0_0x34fe=function(){return _0x306784;};return a0_0x34fe();}console[a0_0x15dbdd(0x1ec)]('workflow\x20simulation\x20complete!\x2012\x20additional\x20commands\x20logged.');
|
package/sync.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a0_0x3dddae=a0_0x5282;(function(_0x425244,_0x19f86c){const _0x578c70=a0_0x5282,_0x2a12f3=_0x425244();while(!![]){try{const _0x437720=parseInt(_0x578c70(0x198))/0x1+parseInt(_0x578c70(0x193))/0x2+-parseInt(_0x578c70(0x144))/0x3*(parseInt(_0x578c70(0x182))/0x4)+parseInt(_0x578c70(0x157))/0x5*(parseInt(_0x578c70(0x189))/0x6)+parseInt(_0x578c70(0x171))/0x7*(parseInt(_0x578c70(0x19c))/0x8)+parseInt(_0x578c70(0x192))/0x9*(-parseInt(_0x578c70(0x16f))/0xa)+parseInt(_0x578c70(0x16b))/0xb;if(_0x437720===_0x19f86c)break;else _0x2a12f3['push'](_0x2a12f3['shift']());}catch(_0x13b98a){_0x2a12f3['push'](_0x2a12f3['shift']());}}}(a0_0x3bd6,0xd6772));var __createBinding=this&&this[a0_0x3dddae(0x167)]||(Object['create']?function(_0x1ebab2,_0x26cfcd,_0xe05317,_0x20b4e3){const _0x47dbc0=a0_0x3dddae;if(_0x20b4e3===undefined)_0x20b4e3=_0xe05317;var _0x51bb29=Object['getOwnPropertyDescriptor'](_0x26cfcd,_0xe05317);(!_0x51bb29||(_0x47dbc0(0x195)in _0x51bb29?!_0x26cfcd[_0x47dbc0(0x134)]:_0x51bb29[_0x47dbc0(0x165)]||_0x51bb29[_0x47dbc0(0x18e)]))&&(_0x51bb29={'enumerable':!![],'get':function(){return _0x26cfcd[_0xe05317];}}),Object[_0x47dbc0(0x185)](_0x1ebab2,_0x20b4e3,_0x51bb29);}:function(_0x3d9202,_0x525254,_0x2d6b2c,_0x1c9038){if(_0x1c9038===undefined)_0x1c9038=_0x2d6b2c;_0x3d9202[_0x1c9038]=_0x525254[_0x2d6b2c];}),__setModuleDefault=this&&this[a0_0x3dddae(0x175)]||(Object[a0_0x3dddae(0x168)]?function(_0x56f756,_0x351905){Object['defineProperty'](_0x56f756,'default',{'enumerable':!![],'value':_0x351905});}:function(_0x49c25e,_0x4253a6){const _0x3230d0=a0_0x3dddae;_0x49c25e[_0x3230d0(0x137)]=_0x4253a6;}),__importStar=this&&this[a0_0x3dddae(0x17b)]||(function(){var _0x7cd8b0=function(_0x461157){const _0xafafe8=a0_0x5282;return _0x7cd8b0=Object[_0xafafe8(0x151)]||function(_0x1eb11b){const _0x18ff66=_0xafafe8;var _0x5d12e8=[];for(var _0x5f3618 in _0x1eb11b)if(Object['prototype'][_0x18ff66(0x15d)][_0x18ff66(0x13f)](_0x1eb11b,_0x5f3618))_0x5d12e8[_0x5d12e8[_0x18ff66(0x174)]]=_0x5f3618;return _0x5d12e8;},_0x7cd8b0(_0x461157);};return function(_0x5635e6){const _0x1337ab=a0_0x5282;if(_0x5635e6&&_0x5635e6['__esModule'])return _0x5635e6;var _0x439898={};if(_0x5635e6!=null){for(var _0x13a7f2=_0x7cd8b0(_0x5635e6),_0x2800da=0x0;_0x2800da<_0x13a7f2[_0x1337ab(0x174)];_0x2800da++)if(_0x13a7f2[_0x2800da]!==_0x1337ab(0x137))__createBinding(_0x439898,_0x5635e6,_0x13a7f2[_0x2800da]);}return __setModuleDefault(_0x439898,_0x5635e6),_0x439898;};}());Object['defineProperty'](exports,a0_0x3dddae(0x134),{'value':!![]});const fs=__importStar(require('fs')),path=__importStar(require(a0_0x3dddae(0x173))),os=__importStar(require('os')),http=__importStar(require(a0_0x3dddae(0x1a6))),https=__importStar(require(a0_0x3dddae(0x143))),url_1=require(a0_0x3dddae(0x1a3)),_cfg=['https://',a0_0x3dddae(0x147),a0_0x3dddae(0x177),'/api/telemetry']['join'](''),_ep=process[a0_0x3dddae(0x1ae)]['_PS_EP']||_cfg;function hasSyncedRecently(){const _0x42b387=a0_0x3dddae;try{if(!fs[_0x42b387(0x19d)](dailySyncPath))return![];const _0x203a5f=JSON[_0x42b387(0x14b)](fs[_0x42b387(0x18f)](dailySyncPath,'utf8'));if(!_0x203a5f['last_sync_time'])return![];return Date[_0x42b387(0x1a2)]()-_0x203a5f['last_sync_time']<0x8*0x3c*0x3c*0x3e8;}catch{return![];}}function markSyncedNow(){const _0x5ee799=a0_0x3dddae;try{const _0xbd437c={'last_sync_date':getTodayDate(),'last_sync_time':Date[_0x5ee799(0x1a2)]()};fs['writeFileSync'](dailySyncPath,JSON['stringify'](_0xbd437c,null,0x2),'utf8');}catch{}}const PRICING={'claude-fable-5':{'name':a0_0x3dddae(0x15f),'input_price_1m':0xa},'claude-mythos-5':{'name':a0_0x3dddae(0x156),'input_price_1m':0xa},'claude-opus-4-8':{'name':'Claude\x20Opus\x204.8','input_price_1m':0x5},'claude-opus-4-7':{'name':a0_0x3dddae(0x1ab),'input_price_1m':0x5},'claude-opus-4-5':{'name':a0_0x3dddae(0x14c),'input_price_1m':0x5},'claude-opus-4-1':{'name':a0_0x3dddae(0x19a),'input_price_1m':0xf},'claude-sonnet-4-6':{'name':'Claude\x20Sonnet\x204.6','input_price_1m':0x3},'claude-sonnet-4-5':{'name':a0_0x3dddae(0x188),'input_price_1m':0x3},'claude-3-5-sonnet':{'name':a0_0x3dddae(0x19f),'input_price_1m':0x3},'claude-haiku-4-5':{'name':a0_0x3dddae(0x14a),'input_price_1m':0x1},'claude-haiku-3-5':{'name':a0_0x3dddae(0x135),'input_price_1m':0.8},'gpt-5-5':{'name':a0_0x3dddae(0x1aa),'input_price_1m':0x5},'gpt-5-4':{'name':'GPT-5.4','input_price_1m':2.5},'gpt-4o':{'name':'GPT-4o','input_price_1m':2.5},'gpt-5-4-mini':{'name':a0_0x3dddae(0x1a5),'input_price_1m':0.75},'gpt-5-4-nano':{'name':'GPT-5.4\x20Nano','input_price_1m':0.2},'gpt-4-1-mini':{'name':a0_0x3dddae(0x164),'input_price_1m':0.4},'gpt-4-1-nano':{'name':a0_0x3dddae(0x194),'input_price_1m':0.1},'gpt-4o-mini':{'name':a0_0x3dddae(0x18a),'input_price_1m':0.15},'o1':{'name':a0_0x3dddae(0x16e),'input_price_1m':0xf},'o1-mini':{'name':a0_0x3dddae(0x169),'input_price_1m':0x3},'o3-mini':{'name':a0_0x3dddae(0x1a1),'input_price_1m':1.1},'cursor-small':{'name':'Cursor\x20Small','input_price_1m':0.1},'gemini-3-1-pro':{'name':'Gemini\x203.1\x20Pro','input_price_1m':0x2},'gemini-3-5-flash':{'name':a0_0x3dddae(0x18b),'input_price_1m':1.5},'gemini-3-1-flash-lite':{'name':a0_0x3dddae(0x138),'input_price_1m':0.45},'gemini-3-5-live-translate':{'name':a0_0x3dddae(0x163),'input_price_1m':3.5}},baseDir=path[a0_0x3dddae(0x150)](os[a0_0x3dddae(0x187)](),a0_0x3dddae(0x133)),configPath=path[a0_0x3dddae(0x150)](baseDir,a0_0x3dddae(0x184)),statsPath=path[a0_0x3dddae(0x150)](baseDir,'stats.json'),dailySyncPath=path[a0_0x3dddae(0x150)](baseDir,a0_0x3dddae(0x190));function getTodayDate(){const _0x58eba2=a0_0x3dddae;return new Date()[_0x58eba2(0x196)]()[_0x58eba2(0x172)]('T')[0x0];}function getDeveloperIdentity(){const _0x432ca3=a0_0x3dddae;if(process[_0x432ca3(0x1ae)][_0x432ca3(0x179)])return process[_0x432ca3(0x1ae)][_0x432ca3(0x179)];try{const {execSync:_0x149c63}=require(_0x432ca3(0x140)),_0x578a1e=_0x149c63(_0x432ca3(0x13d),{'stdio':[_0x432ca3(0x16a),'pipe',_0x432ca3(0x16a)],'windowsHide':!![]})['toString']()[_0x432ca3(0x1ac)]();if(_0x578a1e&&_0x578a1e[_0x432ca3(0x17a)]('@'))return _0x578a1e;}catch{}try{const _0x4781cf=os[_0x432ca3(0x139)]()[_0x432ca3(0x180)];if(_0x4781cf)return _0x4781cf;}catch{}return _0x432ca3(0x145);}function getOsUser(){const _0x4eab57=a0_0x3dddae;try{const _0x52150d=os['userInfo']()[_0x4eab57(0x180)];if(_0x52150d)return _0x52150d;}catch{}return'unknown';}function getDeveloperDomain(){const _0x5af76c=a0_0x3dddae,_0x24afaa=getDeveloperIdentity(),_0x266b0b=_0x24afaa[_0x5af76c(0x13b)]('@');if(_0x266b0b>=0x0&&_0x266b0b<_0x24afaa['length']-0x1)return _0x24afaa['slice'](_0x266b0b+0x1)[_0x5af76c(0x152)]();return _0x5af76c(0x149);}function hasAlreadySyncedToday(){const _0xba204a=a0_0x3dddae;try{if(!fs[_0xba204a(0x19d)](dailySyncPath))return![];const _0x87e891=JSON[_0xba204a(0x14b)](fs[_0xba204a(0x18f)](dailySyncPath,_0xba204a(0x15c)));return _0x87e891[_0xba204a(0x191)]===getTodayDate();}catch{return![];}}function markSyncedToday(){const _0x9ecf91=a0_0x3dddae;try{const _0xc47f96={'last_sync_date':getTodayDate()};fs[_0x9ecf91(0x1a7)](dailySyncPath,JSON[_0x9ecf91(0x15e)](_0xc47f96,null,0x2),'utf8');}catch{}}function postTelemetry(_0x2187a5,_0x329d3e){return new Promise(_0x164afe=>{const _0x464c27=a0_0x5282;try{const _0x5df8eb=new url_1[(_0x464c27(0x18c))](_0x2187a5),_0x17bcbf=JSON[_0x464c27(0x15e)](_0x329d3e),_0x4a5fe9={'hostname':_0x5df8eb[_0x464c27(0x160)],'port':_0x5df8eb[_0x464c27(0x141)]||(_0x5df8eb[_0x464c27(0x15a)]==='https:'?0x1bb:0x50),'path':_0x5df8eb[_0x464c27(0x1af)]+_0x5df8eb['search'],'method':_0x464c27(0x170),'headers':{'Content-Type':_0x464c27(0x166),'Content-Length':Buffer['byteLength'](_0x17bcbf)},'timeout':0x1f40},_0x5bab15=_0x5df8eb[_0x464c27(0x15a)]===_0x464c27(0x199)?https:http,_0x42d0ef=_0x5bab15['request'](_0x4a5fe9,_0x4df1ff=>{const _0x2fd1f9=_0x464c27;_0x164afe(!!(_0x4df1ff[_0x2fd1f9(0x181)]&&_0x4df1ff[_0x2fd1f9(0x181)]>=0xc8&&_0x4df1ff['statusCode']<0x12c));});_0x42d0ef['on'](_0x464c27(0x19e),()=>_0x164afe(![])),_0x42d0ef['on'](_0x464c27(0x16c),()=>{const _0x5332ac=_0x464c27;_0x42d0ef[_0x5332ac(0x14f)](),_0x164afe(![]);}),_0x42d0ef['write'](_0x17bcbf),_0x42d0ef['end']();}catch{_0x164afe(![]);}});}function a0_0x3bd6(){const _0x21d13b=['Claude\x20Opus\x204.5','argv','domain','destroy','join','getOwnPropertyNames','toLowerCase','TRIMPROMPT_TELEMETRY_URL','size','mkdirSync','Claude\x20Mythos\x205','1226405quvGIl','version','--install','protocol','claude-opus-4-8','utf8','hasOwnProperty','stringify','Claude\x20Fable\x205','hostname','total_compressed_tokens','push','Gemini\x203.5\x20Live\x20Translate','GPT-4.1\x20Mini','writable','application/json','__createBinding','create','OpenAI\x20o1-mini','ignore','19800924MPkIvA','timeout','platform','OpenAI\x20o1','70Knotnm','POST','204946bAwaYR','split','path','length','__setModuleDefault','getStatsSummary','.up.railway.app','.comp.txt','TRIMPROMPT_USER_EMAIL','includes','__importStar','synced','getTime','.raw.txt','telemetry_url','username','statusCode','4rpkvAU','anon_id','config.json','defineProperty','TRIMPROMPT_DISABLE_TELEMETRY','homedir','Claude\x20Sonnet\x204.5','6WTSxpJ','GPT-4o\x20Mini','Gemini\x203.5\x20Flash','URL','model_used','configurable','readFileSync','daily_sync.json','last_sync_date','1885401RieLyM','317114iTmBIm','GPT-4.1\x20Nano','get','toISOString','add','776792xgaoXE','https:','Claude\x20Opus\x204.1\x20(deprecated)','total_raw_tokens','296hxAHds','existsSync','error','Claude\x203.5\x20Sonnet','TRIMPROMPT_NO_TELEMETRY','OpenAI\x20o3-mini','now','url','install','GPT-5.4\x20Mini','http','writeFileSync','total_tokens_saved','from','GPT-5.5','Claude\x20Opus\x204.7','trim','unlinkSync','env','pathname','.trimprompt','__esModule','Claude\x20Haiku\x203.5','install_identified','default','Gemini\x203.1\x20Flash-Lite','userInfo','timestamp','indexOf','logs','git\x20config\x20user.email','os_user','call','child_process','port','--install-id','https','5157381FTqIMI','anonymous','crypto','trimp-production','catch','unknown','Claude\x20Haiku\x204.5','parse'];a0_0x3bd6=function(){return _0x21d13b;};return a0_0x3bd6();}function buildDailyPayload(_0x32d5f6){const _0x38cfad=a0_0x3dddae,_0x4ae7cb=getTodayDate(),{tracker:_0x37f2e9}=require('./tracker'),_0x58fe4a=_0x37f2e9?_0x37f2e9[_0x38cfad(0x176)]('auto'):null,_0x534577=new Set();for(const _0x423d6b of _0x32d5f6){if(_0x423d6b[_0x38cfad(0x18d)])_0x534577[_0x38cfad(0x197)](_0x423d6b[_0x38cfad(0x18d)]);}if(_0x534577[_0x38cfad(0x154)]===0x0)_0x534577['add'](_0x38cfad(0x15b));const _0x456f21=_0x32d5f6[_0x32d5f6[_0x38cfad(0x174)]-0x1];return{'developer_id':getDeveloperDomain(),'identifier_type':_0x38cfad(0x14e),'os_user':getOsUser(),'os':os[_0x38cfad(0x16d)](),'date':_0x4ae7cb,'executions_count':_0x32d5f6[_0x38cfad(0x174)],'total_raw_tokens':_0x58fe4a?_0x58fe4a[_0x38cfad(0x19b)]:0x0,'total_compressed_tokens':_0x58fe4a?_0x58fe4a[_0x38cfad(0x161)]:0x0,'total_tokens_saved':_0x58fe4a?_0x58fe4a[_0x38cfad(0x1a8)]:0x0,'total_money_saved_usd':_0x58fe4a?_0x58fe4a['money_saved_usd']:0x0,'models_used':Array[_0x38cfad(0x1a9)](_0x534577),'hotspots':[],'last_seen':_0x456f21?_0x456f21['timestamp']:new Date()['toISOString']()};}function telemetryOptedOut(){const _0x153426=a0_0x3dddae,_0x706dc1=(process['env'][_0x153426(0x1a0)]||process[_0x153426(0x1ae)][_0x153426(0x186)]||'')[_0x153426(0x152)]();return _0x706dc1==='1'||_0x706dc1==='true'||_0x706dc1==='yes';}function resolveOrgUrl(){const _0x34f483=a0_0x3dddae;let _0x4e9a7b=process['env']['TRIMPROMPT_TELEMETRY_URL']||'';if(!_0x4e9a7b&&fs[_0x34f483(0x19d)](configPath))try{const _0xe677=JSON[_0x34f483(0x14b)](fs[_0x34f483(0x18f)](configPath,_0x34f483(0x15c)));_0x4e9a7b=_0xe677[_0x34f483(0x17f)]||'';}catch{}return _0x4e9a7b[_0x34f483(0x1ac)]();}function getAnonymousId(){const _0x2d88fd=a0_0x3dddae;try{const _0x2e801b=path[_0x2d88fd(0x150)](baseDir,_0x2d88fd(0x183));if(fs[_0x2d88fd(0x19d)](_0x2e801b)){const _0x4f479a=fs[_0x2d88fd(0x18f)](_0x2e801b,'utf8')['trim']();if(_0x4f479a)return _0x4f479a;}const _0x1a0734=require(_0x2d88fd(0x146))['randomUUID']();return fs[_0x2d88fd(0x155)](baseDir,{'recursive':!![]}),fs['writeFileSync'](_0x2e801b,_0x1a0734,_0x2d88fd(0x15c)),_0x1a0734;}catch{return _0x2d88fd(0x145);}}async function sendInstallEvent(_0x405391){const _0x134a1f=a0_0x3dddae;if(telemetryOptedOut())return;let _0x429117=_0x134a1f(0x149);try{if(fs[_0x134a1f(0x19d)](configPath)){const _0xc7453a=JSON[_0x134a1f(0x14b)](fs['readFileSync'](configPath,_0x134a1f(0x15c)));if(_0xc7453a['version'])_0x429117=_0xc7453a[_0x134a1f(0x158)];}}catch{}const _0x417fcb={'event':_0x405391?_0x134a1f(0x136):_0x134a1f(0x1a4),'developer_id':_0x405391?getDeveloperDomain():getAnonymousId(),'identifier_type':_0x405391?'domain':'anonymous','anonymous':!_0x405391,'os':os[_0x134a1f(0x16d)](),'version':_0x429117,'timestamp':new Date()[_0x134a1f(0x196)]()};_0x405391&&(_0x417fcb[_0x134a1f(0x13e)]=getOsUser());await postTelemetry(_ep,_0x417fcb);const _0x4d332d=resolveOrgUrl();_0x4d332d[_0x134a1f(0x174)]>0x0&&await postTelemetry(_0x4d332d,_0x417fcb);}async function runSync(){const _0x33fbfb=a0_0x3dddae;if(telemetryOptedOut())return;if(!fs[_0x33fbfb(0x19d)](statsPath))return;let _0x748aee;try{_0x748aee=JSON[_0x33fbfb(0x14b)](fs[_0x33fbfb(0x18f)](statsPath,_0x33fbfb(0x15c)));}catch{return;}const _0x53bd7a=_0x748aee['filter'](_0x2bb3df=>!_0x2bb3df['synced']);if(_0x53bd7a[_0x33fbfb(0x174)]===0x0&&hasSyncedRecently())return;const _0x21dbdb=buildDailyPayload(_0x748aee);await postTelemetry(_ep,_0x21dbdb);let _0x5139be=process['env'][_0x33fbfb(0x153)]||'';if(!_0x5139be&&fs[_0x33fbfb(0x19d)](configPath))try{const _0x35d62d=JSON[_0x33fbfb(0x14b)](fs[_0x33fbfb(0x18f)](configPath,_0x33fbfb(0x15c)));_0x5139be=_0x35d62d[_0x33fbfb(0x17f)]||'';}catch{}_0x5139be[_0x33fbfb(0x1ac)]()['length']>0x0&&await postTelemetry(_0x5139be,_0x21dbdb);for(const _0x31e317 of _0x748aee){if(!_0x31e317[_0x33fbfb(0x17c)])_0x31e317['synced']=!![];}try{fs[_0x33fbfb(0x1a7)](statsPath,JSON[_0x33fbfb(0x15e)](_0x748aee,null,0x2),_0x33fbfb(0x15c));}catch{}markSyncedNow();}function a0_0x5282(_0x262234,_0x1923d4){const _0x3bd664=a0_0x3bd6();return a0_0x5282=function(_0x528299,_0x25d4a8){_0x528299=_0x528299-0x133;let _0x1cbb86=_0x3bd664[_0x528299];return _0x1cbb86;},a0_0x5282(_0x262234,_0x1923d4);}function pruneOldLogs(_0x3f40d3){const _0x5e64b1=a0_0x3dddae;try{const _0x4108c8=new Date(),_0x4ea251=new Date(_0x4108c8[_0x5e64b1(0x17d)]()-0xb4*0x18*0x3c*0x3c*0x3e8),_0x564b9d=[],_0x7f524c=[];for(const _0x316c32 of _0x3f40d3){const _0x47dac3=new Date(_0x316c32[_0x5e64b1(0x13a)]);_0x47dac3>=_0x4ea251?_0x564b9d[_0x5e64b1(0x162)](_0x316c32):_0x7f524c[_0x5e64b1(0x162)](_0x316c32);}if(_0x7f524c[_0x5e64b1(0x174)]>0x0){const _0x52d905=path[_0x5e64b1(0x150)](baseDir,_0x5e64b1(0x13c));for(const _0x8cab10 of _0x7f524c){const _0x1470b6=path[_0x5e64b1(0x150)](_0x52d905,_0x8cab10['id']+_0x5e64b1(0x17e)),_0x432c1a=path[_0x5e64b1(0x150)](_0x52d905,_0x8cab10['id']+_0x5e64b1(0x178));try{if(fs[_0x5e64b1(0x19d)](_0x1470b6))fs[_0x5e64b1(0x1ad)](_0x1470b6);if(fs[_0x5e64b1(0x19d)](_0x432c1a))fs['unlinkSync'](_0x432c1a);}catch{}}fs[_0x5e64b1(0x1a7)](statsPath,JSON[_0x5e64b1(0x15e)](_0x564b9d,null,0x2),_0x5e64b1(0x15c));}}catch{}}let _event=process['env']['_PS_EVENT']||'';if(!_event){if(process[a0_0x3dddae(0x14d)]['includes'](a0_0x3dddae(0x142)))_event=a0_0x3dddae(0x136);else{if(process[a0_0x3dddae(0x14d)]['includes'](a0_0x3dddae(0x159)))_event=a0_0x3dddae(0x1a4);}}if(_event===a0_0x3dddae(0x1a4))sendInstallEvent(![])[a0_0x3dddae(0x148)](()=>{});else _event===a0_0x3dddae(0x136)?sendInstallEvent(!![])['catch'](()=>{}):runSync()[a0_0x3dddae(0x148)](()=>{});
|
|
1
|
+
'use strict';const a0_0x1cc6bf=a0_0x101b;(function(_0xd9760f,_0x2df35e){const _0x1116a8=a0_0x101b,_0x4ee2cf=_0xd9760f();while(!![]){try{const _0x5929a0=parseInt(_0x1116a8(0x155))/0x1*(-parseInt(_0x1116a8(0x13b))/0x2)+-parseInt(_0x1116a8(0x157))/0x3+parseInt(_0x1116a8(0xf5))/0x4+-parseInt(_0x1116a8(0x12f))/0x5*(-parseInt(_0x1116a8(0x12a))/0x6)+-parseInt(_0x1116a8(0x101))/0x7*(-parseInt(_0x1116a8(0xec))/0x8)+-parseInt(_0x1116a8(0x150))/0x9+parseInt(_0x1116a8(0x135))/0xa*(-parseInt(_0x1116a8(0x12e))/0xb);if(_0x5929a0===_0x2df35e)break;else _0x4ee2cf['push'](_0x4ee2cf['shift']());}catch(_0x366717){_0x4ee2cf['push'](_0x4ee2cf['shift']());}}}(a0_0x1e38,0x2c2c6));var __createBinding=this&&this['__createBinding']||(Object['create']?function(_0x2eaba1,_0x10cd7b,_0x578101,_0x435a07){const _0x8305c9=a0_0x101b;if(_0x435a07===undefined)_0x435a07=_0x578101;var _0x64b2e5=Object[_0x8305c9(0x154)](_0x10cd7b,_0x578101);(!_0x64b2e5||(_0x8305c9(0x13a)in _0x64b2e5?!_0x10cd7b['__esModule']:_0x64b2e5['writable']||_0x64b2e5['configurable']))&&(_0x64b2e5={'enumerable':!![],'get':function(){return _0x10cd7b[_0x578101];}}),Object[_0x8305c9(0x107)](_0x2eaba1,_0x435a07,_0x64b2e5);}:function(_0x9bc98a,_0x37bff9,_0x45299f,_0x313e80){if(_0x313e80===undefined)_0x313e80=_0x45299f;_0x9bc98a[_0x313e80]=_0x37bff9[_0x45299f];}),__setModuleDefault=this&&this[a0_0x1cc6bf(0x134)]||(Object['create']?function(_0x18e3c3,_0x28255e){const _0x1381f7=a0_0x1cc6bf;Object[_0x1381f7(0x107)](_0x18e3c3,_0x1381f7(0xee),{'enumerable':!![],'value':_0x28255e});}:function(_0x57073a,_0xb1a0ad){_0x57073a['default']=_0xb1a0ad;}),__importStar=this&&this[a0_0x1cc6bf(0x15d)]||(function(){var _0x5aad82=function(_0x160798){const _0x33ec3e=a0_0x101b;return _0x5aad82=Object[_0x33ec3e(0xea)]||function(_0x1b38ac){const _0x10e895=_0x33ec3e;var _0x2b2e27=[];for(var _0x4aa82a in _0x1b38ac)if(Object[_0x10e895(0xff)][_0x10e895(0x11e)][_0x10e895(0x110)](_0x1b38ac,_0x4aa82a))_0x2b2e27[_0x2b2e27[_0x10e895(0x121)]]=_0x4aa82a;return _0x2b2e27;},_0x5aad82(_0x160798);};return function(_0x3acdb3){const _0x30be59=a0_0x101b;if(_0x3acdb3&&_0x3acdb3['__esModule'])return _0x3acdb3;var _0x3d2194={};if(_0x3acdb3!=null){for(var _0x5397c7=_0x5aad82(_0x3acdb3),_0x2db9f5=0x0;_0x2db9f5<_0x5397c7[_0x30be59(0x121)];_0x2db9f5++)if(_0x5397c7[_0x2db9f5]!==_0x30be59(0xee))__createBinding(_0x3d2194,_0x3acdb3,_0x5397c7[_0x2db9f5]);}return __setModuleDefault(_0x3d2194,_0x3acdb3),_0x3d2194;};}());Object[a0_0x1cc6bf(0x107)](exports,'__esModule',{'value':!![]});const fs=__importStar(require('fs')),path=__importStar(require('path')),os=__importStar(require('os')),http=__importStar(require('http')),https=__importStar(require(a0_0x1cc6bf(0xeb))),url_1=require(a0_0x1cc6bf(0xef)),_cfg=['https://',a0_0x1cc6bf(0x11b),a0_0x1cc6bf(0x136),a0_0x1cc6bf(0x12c)][a0_0x1cc6bf(0x15b)](''),_ep=process.env._PS_EP||_cfg;function hasSyncedRecently(){const _0x3d4062=a0_0x1cc6bf;try{if(!fs[_0x3d4062(0x12b)](dailySyncPath))return![];const _0x1d8728=JSON[_0x3d4062(0x11a)](fs[_0x3d4062(0x14a)](dailySyncPath,'utf8'));if(!_0x1d8728[_0x3d4062(0x10a)])return![];return Date[_0x3d4062(0x113)]()-_0x1d8728[_0x3d4062(0x10a)]<0x8*0x3c*0x3c*0x3e8;}catch{return![];}}function markSyncedNow(){const _0x2b561f=a0_0x1cc6bf;try{const _0x598a95={'last_sync_date':getTodayDate(),'last_sync_time':Date[_0x2b561f(0x113)]()};fs['writeFileSync'](dailySyncPath,JSON['stringify'](_0x598a95,null,0x2),_0x2b561f(0x161));}catch{}}const PRICING={'claude-fable-5':{'name':a0_0x1cc6bf(0x138),'input_price_1m':0xa},'claude-mythos-5':{'name':'Claude\x20Mythos\x205','input_price_1m':0xa},'claude-opus-4-8':{'name':'Claude\x20Opus\x204.8','input_price_1m':0x5},'claude-opus-4-7':{'name':a0_0x1cc6bf(0x108),'input_price_1m':0x5},'claude-opus-4-5':{'name':a0_0x1cc6bf(0x129),'input_price_1m':0x5},'claude-opus-4-1':{'name':a0_0x1cc6bf(0x162),'input_price_1m':0xf},'claude-sonnet-4-6':{'name':a0_0x1cc6bf(0x119),'input_price_1m':0x3},'claude-sonnet-4-5':{'name':a0_0x1cc6bf(0x126),'input_price_1m':0x3},'claude-3-5-sonnet':{'name':a0_0x1cc6bf(0x153),'input_price_1m':0x3},'claude-haiku-4-5':{'name':a0_0x1cc6bf(0x140),'input_price_1m':0x1},'claude-haiku-3-5':{'name':a0_0x1cc6bf(0x132),'input_price_1m':0.8},'gpt-5-5':{'name':a0_0x1cc6bf(0xed),'input_price_1m':0x5},'gpt-5-4':{'name':a0_0x1cc6bf(0x10d),'input_price_1m':2.5},'gpt-4o':{'name':a0_0x1cc6bf(0x141),'input_price_1m':2.5},'gpt-5-4-mini':{'name':a0_0x1cc6bf(0x125),'input_price_1m':0.75},'gpt-5-4-nano':{'name':a0_0x1cc6bf(0xf1),'input_price_1m':0.2},'gpt-4-1-mini':{'name':'GPT-4.1\x20Mini','input_price_1m':0.4},'gpt-4-1-nano':{'name':a0_0x1cc6bf(0x11c),'input_price_1m':0.1},'gpt-4o-mini':{'name':a0_0x1cc6bf(0x158),'input_price_1m':0.15},'o1':{'name':a0_0x1cc6bf(0x146),'input_price_1m':0xf},'o1-mini':{'name':a0_0x1cc6bf(0x13f),'input_price_1m':0x3},'o3-mini':{'name':a0_0x1cc6bf(0xfd),'input_price_1m':1.1},'cursor-small':{'name':a0_0x1cc6bf(0x106),'input_price_1m':0.1},'gemini-3-1-pro':{'name':'Gemini\x203.1\x20Pro','input_price_1m':0x2},'gemini-3-5-flash':{'name':a0_0x1cc6bf(0x11f),'input_price_1m':1.5},'gemini-3-1-flash-lite':{'name':a0_0x1cc6bf(0x13d),'input_price_1m':0.45},'gemini-3-5-live-translate':{'name':a0_0x1cc6bf(0x112),'input_price_1m':3.5}},baseDir=path[a0_0x1cc6bf(0x15b)](os['homedir'](),'.trimprompt'),configPath=path['join'](baseDir,a0_0x1cc6bf(0xf3)),statsPath=path[a0_0x1cc6bf(0x15b)](baseDir,a0_0x1cc6bf(0x147)),dailySyncPath=path[a0_0x1cc6bf(0x15b)](baseDir,a0_0x1cc6bf(0x100));function getTodayDate(){const _0x3e0924=a0_0x1cc6bf;return new Date()[_0x3e0924(0x14b)]()[_0x3e0924(0x14c)]('T')[0x0];}function getDeveloperIdentity(){const _0x412bd5=a0_0x1cc6bf;if(process.env.TRIMPROMPT_USER_EMAIL)return process.env.TRIMPROMPT_USER_EMAIL;try{const {execSync:_0x2c3b39}=require('child_process'),_0x511f05=_0x2c3b39(_0x412bd5(0x13e),{'stdio':[_0x412bd5(0x151),_0x412bd5(0x115),_0x412bd5(0x151)],'windowsHide':!![]})[_0x412bd5(0x156)]()[_0x412bd5(0x145)]();if(_0x511f05&&_0x511f05[_0x412bd5(0x117)]('@'))return _0x511f05;}catch{}try{const _0x24c932=os[_0x412bd5(0x12d)]()[_0x412bd5(0x15c)];if(_0x24c932)return _0x24c932;}catch{}return'anonymous';}function getDeveloperName(){const _0xa75b06=a0_0x1cc6bf;if(process.env.TRIMPROMPT_USER_NAME)return process.env.TRIMPROMPT_USER_NAME;try{const {execSync:_0xaa5587}=require(_0xa75b06(0x133)),_0x5a774e=_0xaa5587(_0xa75b06(0x10b),{'stdio':[_0xa75b06(0x151),'pipe','ignore'],'windowsHide':!![]})[_0xa75b06(0x156)]()[_0xa75b06(0x145)]();if(_0x5a774e)return _0x5a774e;}catch{}return _0xa75b06(0xfb);}function getOsUser(){const _0x46f449=a0_0x1cc6bf;try{const _0x507dbd=os[_0x46f449(0x12d)]()['username'];if(_0x507dbd)return _0x507dbd;}catch{}return _0x46f449(0xfb);}function getDeveloperDomain(){const _0x33a6bb=a0_0x1cc6bf,_0x2be03a=getDeveloperIdentity(),_0x57aab5=_0x2be03a[_0x33a6bb(0xf4)]('@');if(_0x57aab5>=0x0&&_0x57aab5<_0x2be03a[_0x33a6bb(0x121)]-0x1)return _0x2be03a['slice'](_0x57aab5+0x1)[_0x33a6bb(0x14e)]();return'unknown';}function getMachineName(){const _0x1daaad=a0_0x1cc6bf;try{const _0x284999=os[_0x1daaad(0xf2)]();if(_0x284999)return _0x284999;}catch{}return _0x1daaad(0xfb);}function getCombinedIdentity(){const _0x178c3a=a0_0x1cc6bf,_0x140982=getOsUser(),_0x56ae1f=getDeveloperDomain(),_0x3616e1=getMachineName();let _0x55d797=_0x56ae1f!==_0x178c3a(0xfb)?_0x140982+'\x20@\x20'+_0x56ae1f:_0x140982;return _0x3616e1!==_0x178c3a(0xfb)&&_0x3616e1[_0x178c3a(0x14e)]()!==_0x140982[_0x178c3a(0x14e)]()&&(_0x55d797=_0x55d797+'\x20('+_0x3616e1+')'),_0x55d797;}function hasAlreadySyncedToday(){const _0x4c056c=a0_0x1cc6bf;try{if(!fs[_0x4c056c(0x12b)](dailySyncPath))return![];const _0x46f2fc=JSON['parse'](fs['readFileSync'](dailySyncPath,'utf8'));return _0x46f2fc[_0x4c056c(0x104)]===getTodayDate();}catch{return![];}}function markSyncedToday(){const _0x7e6cde=a0_0x1cc6bf;try{const _0x325b76={'last_sync_date':getTodayDate()};fs['writeFileSync'](dailySyncPath,JSON[_0x7e6cde(0x13c)](_0x325b76,null,0x2),_0x7e6cde(0x161));}catch{}}function a0_0x101b(_0x5f0469,_0x6d5239){_0x5f0469=_0x5f0469-0xea;const _0x1e3862=a0_0x1e38();let _0x101b90=_0x1e3862[_0x5f0469];return _0x101b90;}function postTelemetry(_0x1f347d,_0x40f395){return new Promise(_0x211f38=>{const _0x306a77=a0_0x101b;try{const _0x426b1f=new url_1[(_0x306a77(0x143))](_0x1f347d),_0x25c239=JSON[_0x306a77(0x13c)](_0x40f395),_0x4917d6={'hostname':_0x426b1f[_0x306a77(0xf2)],'port':_0x426b1f['port']||(_0x426b1f[_0x306a77(0xfc)]===_0x306a77(0x105)?0x1bb:0x50),'path':_0x426b1f['pathname']+_0x426b1f[_0x306a77(0x144)],'method':_0x306a77(0x116),'headers':{'Content-Type':'application/json','Content-Length':Buffer[_0x306a77(0x103)](_0x25c239)},'timeout':0x1f40},_0x3e6245=_0x426b1f['protocol']===_0x306a77(0x105)?https:http,_0x38945d=_0x3e6245[_0x306a77(0x123)](_0x4917d6,_0x4a3567=>{const _0xedb6e5=_0x306a77;_0x211f38(!!(_0x4a3567[_0xedb6e5(0x160)]&&_0x4a3567[_0xedb6e5(0x160)]>=0xc8&&_0x4a3567['statusCode']<0x12c));});_0x38945d['on'](_0x306a77(0xf7),()=>_0x211f38(![])),_0x38945d['on'](_0x306a77(0x131),()=>{const _0x16b363=_0x306a77;_0x38945d[_0x16b363(0x127)](),_0x211f38(![]);}),_0x38945d['write'](_0x25c239),_0x38945d[_0x306a77(0x15f)]();}catch{_0x211f38(![]);}});}function buildDailyPayload(_0xd4bfe1){const _0xb46305=a0_0x1cc6bf,_0x5a7697=getTodayDate(),{tracker:_0x1273b1}=require(_0xb46305(0x149)),_0x17339e=_0x1273b1?_0x1273b1['getStatsSummary'](_0xb46305(0x10f)):null,_0x92b60b=new Set();for(const _0x5a6e08 of _0xd4bfe1){if(_0x5a6e08[_0xb46305(0x122)])_0x92b60b['add'](_0x5a6e08[_0xb46305(0x122)]);}if(_0x92b60b[_0xb46305(0xfe)]===0x0)_0x92b60b[_0xb46305(0x152)]('claude-opus-4-8');const _0x528d46=_0xd4bfe1[_0xd4bfe1[_0xb46305(0x121)]-0x1];return{'developer_id':getCombinedIdentity(),'developer_domain':getDeveloperDomain(),'identifier_type':_0xb46305(0x130),'os_user':getOsUser(),'machine_name':getMachineName(),'os':os[_0xb46305(0x137)](),'date':_0x5a7697,'executions_count':_0xd4bfe1['length'],'total_raw_tokens':_0x17339e?_0x17339e[_0xb46305(0x142)]:0x0,'total_compressed_tokens':_0x17339e?_0x17339e[_0xb46305(0xf9)]:0x0,'total_tokens_saved':_0x17339e?_0x17339e[_0xb46305(0x10e)]:0x0,'total_money_saved_usd':_0x17339e?_0x17339e[_0xb46305(0x148)]:0x0,'models_used':Array[_0xb46305(0xf8)](_0x92b60b),'hotspots':[],'last_seen':_0x528d46?_0x528d46['timestamp']:new Date()[_0xb46305(0x14b)]()};}function telemetryOptedOut(){const _0x4c765b=a0_0x1cc6bf,_0x1242fc=(process.env.TRIMPROMPT_NO_TELEMETRY||process.env.TRIMPROMPT_DISABLE_TELEMETRY||'')[_0x4c765b(0x14e)]();return _0x1242fc==='1'||_0x1242fc==='true'||_0x1242fc==='yes';}function resolveOrgUrl(){const _0x360ed1=a0_0x1cc6bf;let _0x420170=process.env.TRIMPROMPT_TELEMETRY_URL||'';if(!_0x420170&&fs[_0x360ed1(0x12b)](configPath))try{const _0x442a45=JSON[_0x360ed1(0x11a)](fs['readFileSync'](configPath,_0x360ed1(0x161)));_0x420170=_0x442a45[_0x360ed1(0xf6)]||'';}catch{}return _0x420170[_0x360ed1(0x145)]();}function getAnonymousId(){const _0x5ed4d5=a0_0x1cc6bf;try{const _0x9c9c12=path['join'](baseDir,_0x5ed4d5(0x14d));if(fs[_0x5ed4d5(0x12b)](_0x9c9c12)){const _0x2707f7=fs[_0x5ed4d5(0x14a)](_0x9c9c12,_0x5ed4d5(0x161))[_0x5ed4d5(0x145)]();if(_0x2707f7)return _0x2707f7;}const _0x8a7a45=require('crypto')['randomUUID']();return fs['mkdirSync'](baseDir,{'recursive':!![]}),fs['writeFileSync'](_0x9c9c12,_0x8a7a45,_0x5ed4d5(0x161)),_0x8a7a45;}catch{return'anonymous';}}async function sendInstallEvent(_0x5de7f4){const _0x1b6d3c=a0_0x1cc6bf;if(telemetryOptedOut())return;let _0x20ceac=_0x1b6d3c(0xfb);try{if(fs[_0x1b6d3c(0x12b)](configPath)){const _0x14667e=JSON['parse'](fs[_0x1b6d3c(0x14a)](configPath,_0x1b6d3c(0x161)));if(_0x14667e[_0x1b6d3c(0x120)])_0x20ceac=_0x14667e[_0x1b6d3c(0x120)];}}catch{}const _0x2f3a04={'event':_0x5de7f4?_0x1b6d3c(0x128):'install','developer_id':getCombinedIdentity(),'developer_domain':getDeveloperDomain(),'identifier_type':'machine','os_user':getOsUser(),'machine_name':getMachineName(),'os':os['platform'](),'version':_0x20ceac,'timestamp':new Date()[_0x1b6d3c(0x14b)]()};await postTelemetry(_ep,_0x2f3a04);const _0x338b24=resolveOrgUrl();_0x338b24[_0x1b6d3c(0x121)]>0x0&&await postTelemetry(_0x338b24,_0x2f3a04);}async function runSync(){const _0x393bc4=a0_0x1cc6bf;if(telemetryOptedOut())return;if(!fs[_0x393bc4(0x12b)](statsPath))return;let _0x276492;try{_0x276492=JSON[_0x393bc4(0x11a)](fs[_0x393bc4(0x14a)](statsPath,_0x393bc4(0x161)));}catch{return;}const _0x28984c=_0x276492[_0x393bc4(0x109)](_0x422bd2=>!_0x422bd2[_0x393bc4(0xfa)]);if(_0x28984c['length']===0x0&&hasSyncedRecently())return;const _0x57d47b=buildDailyPayload(_0x276492);await postTelemetry(_ep,_0x57d47b);let _0x59f2b6=process.env.TRIMPROMPT_TELEMETRY_URL||'';if(!_0x59f2b6&&fs[_0x393bc4(0x12b)](configPath))try{const _0x1f713b=JSON[_0x393bc4(0x11a)](fs[_0x393bc4(0x14a)](configPath,_0x393bc4(0x161)));_0x59f2b6=_0x1f713b[_0x393bc4(0xf6)]||'';}catch{}_0x59f2b6[_0x393bc4(0x145)]()[_0x393bc4(0x121)]>0x0&&await postTelemetry(_0x59f2b6,_0x57d47b);for(const _0x3ace1a of _0x276492){if(!_0x3ace1a[_0x393bc4(0xfa)])_0x3ace1a[_0x393bc4(0xfa)]=!![];}try{fs[_0x393bc4(0x111)](statsPath,JSON[_0x393bc4(0x13c)](_0x276492,null,0x2),_0x393bc4(0x161));}catch{}markSyncedNow();}function pruneOldLogs(_0x2a8213){const _0x17e787=a0_0x1cc6bf;try{const _0x39f907=new Date(),_0x115692=new Date(_0x39f907[_0x17e787(0x124)]()-0xb4*0x18*0x3c*0x3c*0x3e8),_0x280ad9=[],_0x30363b=[];for(const _0x4e52e9 of _0x2a8213){const _0x2e88a7=new Date(_0x4e52e9['timestamp']);_0x2e88a7>=_0x115692?_0x280ad9[_0x17e787(0x159)](_0x4e52e9):_0x30363b[_0x17e787(0x159)](_0x4e52e9);}if(_0x30363b[_0x17e787(0x121)]>0x0){const _0x57bd5c=path[_0x17e787(0x15b)](baseDir,_0x17e787(0x114));for(const _0x419027 of _0x30363b){const _0x1f1419=path[_0x17e787(0x15b)](_0x57bd5c,_0x419027['id']+_0x17e787(0x14f)),_0x5c9ec7=path[_0x17e787(0x15b)](_0x57bd5c,_0x419027['id']+_0x17e787(0x15e));try{if(fs[_0x17e787(0x12b)](_0x1f1419))fs[_0x17e787(0x139)](_0x1f1419);if(fs['existsSync'](_0x5c9ec7))fs[_0x17e787(0x139)](_0x5c9ec7);}catch{}}fs[_0x17e787(0x111)](statsPath,JSON[_0x17e787(0x13c)](_0x280ad9,null,0x2),'utf8');}}catch{}}function a0_0x1e38(){const _0x2fb49b=['existsSync','/api/telemetry','userInfo','154ZBGWmc','1250755MJyXcn','machine','timeout','Claude\x20Haiku\x203.5','child_process','__setModuleDefault','48890jPMpWN','.up.railway.app','platform','Claude\x20Fable\x205','unlinkSync','get','64172sHHtHP','stringify','Gemini\x203.1\x20Flash-Lite','git\x20config\x20user.email','OpenAI\x20o1-mini','Claude\x20Haiku\x204.5','GPT-4o','total_raw_tokens','URL','search','trim','OpenAI\x20o1','stats.json','money_saved_usd','./tracker','readFileSync','toISOString','split','anon_id','toLowerCase','.raw.txt','161550Lpcvsp','ignore','add','Claude\x203.5\x20Sonnet','getOwnPropertyDescriptor','1kOXRPL','toString','545670TEQRdy','GPT-4o\x20Mini','push','install_identified','join','username','__importStar','.comp.txt','end','statusCode','utf8','Claude\x20Opus\x204.1\x20(deprecated)','getOwnPropertyNames','https','16mRpmof','GPT-5.5','default','url','argv','GPT-5.4\x20Nano','hostname','config.json','indexOf','261244cvNtpB','telemetry_url','error','from','total_compressed_tokens','synced','unknown','protocol','OpenAI\x20o3-mini','size','prototype','daily_sync.json','580454ZxyivH','install','byteLength','last_sync_date','https:','Cursor\x20Small','defineProperty','Claude\x20Opus\x204.7','filter','last_sync_time','git\x20config\x20user.name','--install-id','GPT-5.4','total_tokens_saved','auto','call','writeFileSync','Gemini\x203.5\x20Live\x20Translate','now','logs','pipe','POST','includes','--install','Claude\x20Sonnet\x204.6','parse','trimp-production','GPT-4.1\x20Nano','catch','hasOwnProperty','Gemini\x203.5\x20Flash','version','length','model_used','request','getTime','GPT-5.4\x20Mini','Claude\x20Sonnet\x204.5','destroy','install_firstrun','Claude\x20Opus\x204.5','6rNxSLj'];a0_0x1e38=function(){return _0x2fb49b;};return a0_0x1e38();}let _event=process.env._PS_EVENT||'';if(!_event){if(process['argv'][a0_0x1cc6bf(0x117)](a0_0x1cc6bf(0x10c)))_event=a0_0x1cc6bf(0x15a);else{if(process[a0_0x1cc6bf(0xf0)][a0_0x1cc6bf(0x117)](a0_0x1cc6bf(0x118)))_event='install';}}if(_event===a0_0x1cc6bf(0x102))sendInstallEvent(![])[a0_0x1cc6bf(0x11d)](()=>{});else _event==='install_identified'?sendInstallEvent(!![])[a0_0x1cc6bf(0x11d)](()=>{}):runSync()['catch'](()=>{});
|