@treasuredata/tdx 0.7.0 → 0.7.1
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/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pwd-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a12_0x4b9b74=a12_0x29c1;(function(_0x4993e7,_0x16d045){const _0x26ddc9=a12_0x29c1,_0x5f1292=_0x4993e7();while(!![]){try{const _0x37664b=parseInt(_0x26ddc9(0x16f))/0x1*(-parseInt(_0x26ddc9(0x16d))/0x2)+-parseInt(_0x26ddc9(0x167))/0x3*(parseInt(_0x26ddc9(0x155))/0x4)+parseInt(_0x26ddc9(0x17f))/0x5*(-parseInt(_0x26ddc9(0x178))/0x6)+parseInt(_0x26ddc9(0x17c))/0x7*(parseInt(_0x26ddc9(0x177))/0x8)+parseInt(_0x26ddc9(0x175))/0x9+parseInt(_0x26ddc9(0x161))/0xa*(-parseInt(_0x26ddc9(0x151))/0xb)+parseInt(_0x26ddc9(0x181))/0xc;if(_0x37664b===_0x16d045)break;else _0x5f1292['push'](_0x5f1292['shift']());}catch(_0x2e1c92){_0x5f1292['push'](_0x5f1292['shift']());}}}(a12_0x3324,0x6a821));function a12_0x3324(){const _0x42c6fe=['\x22.\x20','name','header','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','set-cookie2','444662Abslet','.\x20Valid\x20methods:\x20','1JUYkdz','toLowerCase','length','body','error','trino','3647313Zveuwh','headers','1493728cwfYjH','113418lkQBMR','verbose','trim','<\x20HTTP/1.1\x20','21vTnpkg','PATCH','keys','110JLyvrY','includes','9825744LsFKHV','Invalid\x20API\x20type:\x20','type','DELETE','stack','color','indexOf','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','Error:\x20','POST','join','validate','Invalid\x20HTTP\x20method:\x20','toUpperCase','file','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','proxy-authorization','has','output','269709cNbUYz','workflow','.\x20Valid\x20types:\x20','Endpoint\x20must\x20start\x20with\x20/:\x20','4dasyJb','startsWith','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','llm','noColor','set-cookie','message','isArray','GET','data','log','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','190OTkZLa','\x0aStack\x20trace:\x0a','x-xsrf-token','Results\x20saved\x20to\x20','api','entries','731706NBKgWn'];a12_0x3324=function(){return _0x42c6fe;};return a12_0x3324();}function a12_0x29c1(_0x5f1d81,_0xff8c4d){const _0x332498=a12_0x3324();return a12_0x29c1=function(_0x29c1b1,_0x43f725){_0x29c1b1=_0x29c1b1-0x14c;let _0x174b09=_0x332498[_0x29c1b1];return _0x174b09;},a12_0x29c1(_0x5f1d81,_0xff8c4d);}import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a12_0x4b9b74(0x14e),'cookie',a12_0x4b9b74(0x15a),a12_0x4b9b74(0x16c),a12_0x4b9b74(0x163),'x-auth-token','x-trino-user']);function isSensitiveHeader(_0x5ee5b){const _0x17d282=a12_0x4b9b74;return SENSITIVE_HEADERS[_0x17d282(0x14f)](_0x5ee5b[_0x17d282(0x170)]());}function parseHeader(_0x11b166){const _0x3d029f=a12_0x4b9b74,_0x44b8a4=_0x11b166[_0x3d029f(0x187)](':');if(_0x44b8a4===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x11b166+_0x3d029f(0x168)+_0x3d029f(0x14d));const _0x3c640e=_0x11b166['substring'](0x0,_0x44b8a4)[_0x3d029f(0x17a)](),_0x56d675=_0x11b166['substring'](_0x44b8a4+0x1)['trim']();if(!_0x3c640e)throw new Error(_0x3d029f(0x16b)+_0x11b166+'\x22');return[_0x3c640e,_0x56d675];}export class ApiCommand extends BaseCommand{[a12_0x4b9b74(0x169)]=a12_0x4b9b74(0x165);['description']=a12_0x4b9b74(0x160);[a12_0x4b9b74(0x18c)](_0x44bfac){const _0xe5b138=a12_0x4b9b74,{args:_0x4e446e,options:_0x4a8314}=_0x44bfac,_0x4e5aa4=_0x4a8314;if(_0x4e446e[_0xe5b138(0x171)]===0x0)return _0xe5b138(0x157);const _0x5af912=_0x4e446e[0x0];if(!_0x5af912[_0xe5b138(0x156)]('/'))return _0xe5b138(0x154)+_0x5af912;const _0xd89875=_0x4e5aa4[_0xe5b138(0x15e)],_0xa55d09=_0x4e5aa4[_0xe5b138(0x14c)];if(_0xd89875&&_0xa55d09)return _0xe5b138(0x188);const _0x2e4f0b=_0x4e5aa4['method']||_0xe5b138(0x15d),_0x3e106d=[_0xe5b138(0x15d),_0xe5b138(0x18a),'PUT',_0xe5b138(0x184),_0xe5b138(0x17d)];if(!_0x3e106d[_0xe5b138(0x180)](_0x2e4f0b[_0xe5b138(0x18e)]()))return _0xe5b138(0x18d)+_0x2e4f0b+_0xe5b138(0x16e)+_0x3e106d['join'](',\x20');const _0x5b5e4c=_0x4e5aa4['type']||'td',_0x501583=['td','cdp',_0xe5b138(0x152),_0xe5b138(0x174),_0xe5b138(0x158)];if(!_0x501583[_0xe5b138(0x180)](_0x5b5e4c))return _0xe5b138(0x182)+_0x5b5e4c+_0xe5b138(0x153)+_0x501583[_0xe5b138(0x18b)](',\x20');return undefined;}async['execute'](_0x5ddc9e){const _0x14c36e=a12_0x4b9b74,{options:_0x1695fa,args:_0x45d772,tdx:_0x2b94ec}=_0x5ddc9e,_0x1ce3c5=_0x1695fa,_0x4c1bf6=_0x45d772[0x0],_0x17d8ea=(_0x1ce3c5['method']||_0x14c36e(0x15d))[_0x14c36e(0x18e)](),_0x375739=_0x1ce3c5[_0x14c36e(0x15e)],_0x18848=_0x1ce3c5[_0x14c36e(0x14c)],_0x4d4938=_0x1ce3c5[_0x14c36e(0x16a)],_0x24f8e1=_0x1ce3c5[_0x14c36e(0x183)]||'td';try{const _0x5a0756={};if(_0x4d4938){const _0x3e0ad4=Array[_0x14c36e(0x15c)](_0x4d4938)?_0x4d4938:[_0x4d4938];for(const _0x5ed3e8 of _0x3e0ad4){const [_0x31ceec,_0x2f00d7]=parseHeader(_0x5ed3e8);_0x5a0756[_0x31ceec]=_0x2f00d7;}}let _0x191392;if(_0x375739)_0x191392=_0x375739;else{if(_0x18848)try{_0x191392=RawAPI['readBodyFromFile'](_0x18848);}catch(_0x49042d){return console['error']('Error:\x20'+(_0x49042d instanceof Error?_0x49042d['message']:String(_0x49042d))),0x1;}}const _0x3f8004={'method':_0x17d8ea,'apiType':_0x24f8e1,'includeHeaders':_0x1695fa['verbose']};_0x191392&&(_0x3f8004[_0x14c36e(0x172)]=_0x191392);Object[_0x14c36e(0x17e)](_0x5a0756)[_0x14c36e(0x171)]>0x0&&(_0x3f8004[_0x14c36e(0x176)]=_0x5a0756);if(_0x1695fa[_0x14c36e(0x179)]){const _0x1b3d86=resolveSite(_0x1695fa['site']),_0x4934d8=getEndpoint(_0x1b3d86,_0x24f8e1),_0x579e91=''+_0x4934d8+_0x4c1bf6;console[_0x14c36e(0x173)]('>\x20'+_0x17d8ea+'\x20'+_0x579e91);const _0x375a2a=getAuthHeaders(_0x1b3d86),_0x5f5519={..._0x375a2a,..._0x5a0756};for(const [_0x258e88,_0x59343f]of Object[_0x14c36e(0x166)](_0x5f5519)){!isSensitiveHeader(_0x258e88)&&console[_0x14c36e(0x173)]('>\x20'+_0x258e88+':\x20'+_0x59343f);}_0x191392&&console['error']('>'),console['error']('');}const _0x50de14=await _0x2b94ec[_0x14c36e(0x165)]['request'](_0x4c1bf6,_0x3f8004);if(_0x1695fa[_0x14c36e(0x179)]&&_0x50de14[_0x14c36e(0x176)]){console[_0x14c36e(0x173)](_0x14c36e(0x17b)+_0x50de14['status']);for(const [_0x1c1b3c,_0x38a3bc]of Object['entries'](_0x50de14[_0x14c36e(0x176)])){!isSensitiveHeader(_0x1c1b3c)&&console[_0x14c36e(0x173)]('<\x20'+_0x1c1b3c+':\x20'+_0x38a3bc);}console[_0x14c36e(0x173)]('');}const _0xd8391c=Boolean(_0x1695fa[_0x14c36e(0x150)]),_0x24215f={'color':_0x1695fa[_0x14c36e(0x186)],'noColor':_0x1695fa[_0x14c36e(0x159)]||_0xd8391c&&!_0x1695fa['color']},_0x3baba8=colorizeJSON(_0x50de14[_0x14c36e(0x15e)],_0x24215f);return _0x1695fa['output']?(writeFileSync(_0x1695fa[_0x14c36e(0x150)],_0x3baba8),console[_0x14c36e(0x173)](_0x14c36e(0x164)+_0x1695fa['output'])):console[_0x14c36e(0x15f)](_0x3baba8),0x0;}catch(_0x4d6771){return _0x4d6771 instanceof Error?(console['error']('Error:\x20'+_0x4d6771[_0x14c36e(0x15b)]),_0x1695fa[_0x14c36e(0x179)]&&_0x4d6771[_0x14c36e(0x185)]&&console[_0x14c36e(0x173)](_0x14c36e(0x162)+_0x4d6771[_0x14c36e(0x185)])):console['error'](_0x14c36e(0x189)+String(_0x4d6771)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a13_0x4db0ac=a13_0x31c2;(function(_0x865050,_0x325938){const _0xf5a54=a13_0x31c2,_0x2ae017=_0x865050();while(!![]){try{const _0x4fabf9=-parseInt(_0xf5a54(0x115))/0x1*(parseInt(_0xf5a54(0x126))/0x2)+parseInt(_0xf5a54(0x135))/0x3+parseInt(_0xf5a54(0x13f))/0x4*(-parseInt(_0xf5a54(0x134))/0x5)+parseInt(_0xf5a54(0x102))/0x6*(parseInt(_0xf5a54(0x123))/0x7)+-parseInt(_0xf5a54(0x12f))/0x8+-parseInt(_0xf5a54(0x136))/0x9+parseInt(_0xf5a54(0x100))/0xa*(parseInt(_0xf5a54(0x13b))/0xb);if(_0x4fabf9===_0x325938)break;else _0x2ae017['push'](_0x2ae017['shift']());}catch(_0x3d833f){_0x2ae017['push'](_0x2ae017['shift']());}}}(a13_0x462f,0xee163));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../types/endpoints.js';function a13_0x462f(){const _0x2209bf=['auth:setup','Name:\x20','300hMKDmg','No\x20API\x20key\x20found\x20in\x20keychain','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Read\x20credential\x20from\x20','auth','findIndex','Setting\x20up\x20authentication\x20for\x20site:\x20','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','us01','description','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','jp01','Enter\x20site\x20name:','length','red','test','execute','bold','last_name','\x20--profile\x20','70lGtTdT','trim','6zFitrx','Select\x20your\x20Treasure\x20Data\x20site:','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','error','ap02','warn','tdx:\x20auth\x20setup','getUserInfo','log','site','text','status','profile','Remove\x20API\x20key\x20from\x20system\x20keychain','\x0aSetup\x20cancelled','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','User:\x20','us\x20\x20\x20-\x20United\x20States','853SEPaVd','customSite','password','Enter\x20your\x20TD\x20API\x20key:','other','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','N/A','eu01','name','\x20(profile:\x20','yellow','\x20\x20tdx','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Enter\x20custom\x20site','5995934DEjKND','\x20for\x20profile:\x20','No\x20credential\x20found','2362Svliqj','System\x20keychain\x20is\x20not\x20available','Setup\x20API\x20key\x20authentication\x20interactively','apiKey','auth:clear','push','join','✓\x20Authentication\x20successful\x0a','ap02\x20-\x20Korea','1753336sCfAyc','create','tdx\x20profile:\x20','email','message','67415mvmFOf','1498926zsiPDI','24642EpufDD','jobs','\x27\x20registered','✗\x20Validation\x20failed:\x20','\x20\x20Set\x20TD_API_KEY\x20environment\x20variable\x20for\x20authentication.','2922106NFrQmO','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'];a13_0x462f=function(){return _0x2209bf;};return a13_0x462f();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';function a13_0x31c2(_0x5109a0,_0x29117c){const _0x462f06=a13_0x462f();return a13_0x31c2=function(_0x31c25d,_0x16f054){_0x31c25d=_0x31c25d-0xf3;let _0x35d489=_0x462f06[_0x31c25d];return _0x35d489;},a13_0x31c2(_0x5109a0,_0x29117c);}import a13_0x893c6c from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a13_0x5dd652 from'chalk';export class AuthSetupCommand extends BaseCommand{[a13_0x4db0ac(0x11d)]=a13_0x4db0ac(0x13d);[a13_0x4db0ac(0xf5)]=a13_0x4db0ac(0x128);async[a13_0x4db0ac(0xfc)](_0x9f0516){const _0x4c75cf=a13_0x4db0ac,{options:_0x20f3a8}=_0x9f0516,_0x36be0a=_0x20f3a8['profile'];console['log'](a13_0x5dd652[_0x4c75cf(0xfd)](_0x4c75cf(0x108)));const _0x3b18b9=_0x20f3a8[_0x4c75cf(0x10b)]||_0x4c75cf(0xf4),_0x30ab78=[{'title':_0x4c75cf(0x114),'value':_0x4c75cf(0xf4)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x4c75cf(0xf7)},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x4c75cf(0x11c)},{'title':_0x4c75cf(0x12e),'value':_0x4c75cf(0x106)}];let _0x30d2da=_0x30ab78[_0x4c75cf(0x144)](_0x5e1c19=>_0x5e1c19['value']===_0x3b18b9);_0x30d2da===-0x1&&_0x3b18b9!==_0x4c75cf(0xf4)&&(_0x30ab78[_0x4c75cf(0x12b)]({'title':_0x3b18b9,'value':_0x3b18b9}),_0x30d2da=_0x30ab78[_0x4c75cf(0xf9)]-0x1);_0x30ab78['push']({'title':_0x4c75cf(0x122),'value':_0x4c75cf(0x119)});const _0x286b34=_0x36be0a?_0x4c75cf(0xf3)+_0x36be0a+'):':_0x4c75cf(0x103),_0x217ded=await a13_0x893c6c({'type':'select','name':_0x4c75cf(0x10b),'message':_0x286b34,'choices':_0x30ab78,'initial':_0x30d2da>=0x0?_0x30d2da:0x0});if(!_0x217ded[_0x4c75cf(0x10b)])return console['log'](_0x4c75cf(0x110)),0x1;let _0x598310;if(_0x217ded[_0x4c75cf(0x10b)]==='other'){const _0x7468be=await a13_0x893c6c({'type':_0x4c75cf(0x10c),'name':_0x4c75cf(0x116),'message':_0x4c75cf(0xf8),'initial':_0x4c75cf(0xf4),'validate':_0x69aca7=>{const _0x3495c0=_0x4c75cf;if(!_0x69aca7||!_0x69aca7[_0x3495c0(0x101)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x3495c0(0xfb)](_0x69aca7[_0x3495c0(0x101)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x7468be[_0x4c75cf(0x116)])return console[_0x4c75cf(0x10a)]('\x0aSetup\x20cancelled'),0x1;_0x598310=_0x7468be['customSite'];}else _0x598310=_0x217ded[_0x4c75cf(0x10b)];const _0x147571=resolveSite(_0x598310);console[_0x4c75cf(0x10a)](_0x4c75cf(0x145)+_0x147571),console['log'](_0x4c75cf(0x112)),console['log']('\x20\x20'+getConsoleUrl(_0x147571,'/app/mp/ak'));const _0x15788a=await a13_0x893c6c({'type':_0x4c75cf(0x117),'name':_0x4c75cf(0x129),'message':_0x4c75cf(0x118),'validate':_0x4b5b03=>{if(!_0x4b5b03||!_0x4b5b03['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x15788a['apiKey'])return console[_0x4c75cf(0x10a)](_0x4c75cf(0x110)),0x1;const _0x3e4b4b=_0x15788a[_0x4c75cf(0x129)];console[_0x4c75cf(0x10a)]('Validating\x20API\x20key...');try{const _0x3b6187=TDX[_0x4c75cf(0x130)]({'site':_0x147571,'apiKey':_0x3e4b4b['trim'](),'logLevel':_0x20f3a8['logLevel']??LogLevel['ERROR']}),_0x5d0574=await _0x3b6187[_0x4c75cf(0x137)][_0x4c75cf(0x109)]();console[_0x4c75cf(0x10a)](_0x4c75cf(0x111)+_0x5d0574[_0x4c75cf(0x132)]+')');const _0x2139b4=await isKeychainAvailable();_0x2139b4?(await saveAPIKeyAsync(_0x3e4b4b[_0x4c75cf(0x101)](),_0x147571,_0x36be0a),console[_0x4c75cf(0x10a)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x36be0a?'\x20(profile:\x20'+_0x36be0a+')':''))):(console[_0x4c75cf(0x107)](a13_0x5dd652[_0x4c75cf(0x11f)](_0x4c75cf(0x121))),console['warn'](a13_0x5dd652[_0x4c75cf(0x11f)](_0x4c75cf(0x13a))));if(_0x36be0a){const _0xd2fa73={'site':_0x147571};saveProfileToUserConfig(_0x36be0a,_0xd2fa73),console[_0x4c75cf(0x10a)]('✓\x20Profile\x20\x27'+_0x36be0a+_0x4c75cf(0x138));}const _0x5007a6=_0x36be0a?_0x4c75cf(0xff)+_0x36be0a:'';return console['log'](),console[_0x4c75cf(0x10a)](_0x4c75cf(0x104)),console[_0x4c75cf(0x10a)](_0x4c75cf(0x120)+_0x5007a6+_0x4c75cf(0x141)),console[_0x4c75cf(0x10a)](_0x4c75cf(0x120)+_0x5007a6+_0x4c75cf(0x13c)),0x0;}catch(_0x594d9d){if(_0x594d9d instanceof HTTPClientError&&_0x594d9d['status']===0x191)return printAuthError(_0x594d9d),0x1;return console[_0x4c75cf(0x105)](a13_0x5dd652[_0x4c75cf(0xfa)](_0x4c75cf(0x139)+(_0x594d9d instanceof Error?_0x594d9d[_0x4c75cf(0x133)]:String(_0x594d9d)))),console[_0x4c75cf(0x105)](_0x4c75cf(0x11a)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a13_0x4db0ac(0x11d)]=a13_0x4db0ac(0x143);[a13_0x4db0ac(0xf5)]=a13_0x4db0ac(0xf6);async[a13_0x4db0ac(0xfc)](_0x3a89b3){const _0x2823cc=a13_0x4db0ac,{options:_0x5ec334,tdx:_0x53ea67}=_0x3a89b3,_0x3e1eda=_0x5ec334[_0x2823cc(0x10b)],_0x284a25=_0x5ec334['profile'],_0x278bf9=_0x284a25?_0x284a25:_0x2823cc(0x11b);console[_0x2823cc(0x10a)](_0x2823cc(0x131)+_0x278bf9+'\x20(site:\x20'+_0x3e1eda+')');const _0x548658=await resolveAPIKeyAsync(_0x3e1eda,_0x284a25);if(_0x548658){const {source:_0x4f2d1a,isDeprecated:_0x2132c0}=_0x548658,_0xee1027=_0x2823cc(0x142)+_0x4f2d1a;console[_0x2823cc(0x10a)](_0x2132c0?a13_0x5dd652[_0x2823cc(0x11f)](_0xee1027):_0xee1027);}else console['log'](a13_0x5dd652[_0x2823cc(0x11f)](_0x2823cc(0x125)));try{const _0x50f80a=await _0x53ea67[_0x2823cc(0x137)][_0x2823cc(0x109)]();return console[_0x2823cc(0x10a)](a13_0x5dd652['green'](_0x2823cc(0x12d))),console[_0x2823cc(0x10a)](_0x2823cc(0x113)+_0x50f80a['email']),(_0x50f80a['first_name']||_0x50f80a[_0x2823cc(0xfe)])&&console[_0x2823cc(0x10a)](_0x2823cc(0x13e)+[_0x50f80a['first_name'],_0x50f80a['last_name']]['filter'](Boolean)[_0x2823cc(0x12c)]('\x20')),0x0;}catch(_0xe72b35){return _0xe72b35 instanceof HTTPClientError&&_0xe72b35[_0x2823cc(0x10d)]===0x191?printAuthError(_0xe72b35,!![],_0x284a25):console[_0x2823cc(0x105)](a13_0x5dd652['red'](_0x2823cc(0x139)+(_0xe72b35 instanceof Error?_0xe72b35[_0x2823cc(0x133)]:String(_0xe72b35)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a13_0x4db0ac(0x11d)]=a13_0x4db0ac(0x12a);[a13_0x4db0ac(0xf5)]=a13_0x4db0ac(0x10f);async[a13_0x4db0ac(0xfc)](_0x16ff4c){const _0x47b691=a13_0x4db0ac,{options:_0x2ab50f}=_0x16ff4c,_0x477898=_0x2ab50f[_0x47b691(0x10e)];console[_0x47b691(0x10a)](a13_0x5dd652['bold']('tdx:\x20auth\x20clear'));const _0x264b5f=await isKeychainAvailable();if(!_0x264b5f)return console[_0x47b691(0x105)](a13_0x5dd652[_0x47b691(0xfa)](_0x47b691(0x127))),0x1;const _0x52effd=await deleteKeychainAPIKey(_0x477898);return _0x52effd?(clearCredentialCache(),console[_0x47b691(0x10a)]('✓\x20API\x20key\x20removed\x20from\x20keychain'+(_0x477898?_0x47b691(0x11e)+_0x477898+')':'')),0x0):(console[_0x47b691(0x10a)](_0x47b691(0x140)+(_0x477898?_0x47b691(0x124)+_0x477898:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a14_0x143b20=a14_0x620b;(function(_0xf1d3ef,_0x1253ea){const _0x36c1f3=a14_0x620b,_0x3434a3=_0xf1d3ef();while(!![]){try{const _0x326267=-parseInt(_0x36c1f3(0x13f))/0x1*(parseInt(_0x36c1f3(0x150))/0x2)+parseInt(_0x36c1f3(0x141))/0x3+-parseInt(_0x36c1f3(0x14a))/0x4*(-parseInt(_0x36c1f3(0x13c))/0x5)+-parseInt(_0x36c1f3(0x135))/0x6+-parseInt(_0x36c1f3(0x140))/0x7*(parseInt(_0x36c1f3(0x163))/0x8)+parseInt(_0x36c1f3(0x139))/0x9*(parseInt(_0x36c1f3(0x162))/0xa)+parseInt(_0x36c1f3(0x156))/0xb*(parseInt(_0x36c1f3(0x12c))/0xc);if(_0x326267===_0x1253ea)break;else _0x3434a3['push'](_0x3434a3['shift']());}catch(_0xcd3324){_0x3434a3['push'](_0x3434a3['shift']());}}}(a14_0x25b0,0x1a38a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';function a14_0x25b0(){const _0x46b8a9=['\x20\x20Cause:\x20','functionName','56590tYcJxK','335464SOIGar','verbose','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','agent','model','write','metadata','204nqcvxO','output','validate','temperature','type','execute','Resolving\x20project\x20\x27','streamChat','code','132006CIeEbh','chatId','\x0a[Error:\x20','[Tool\x20result:\x20','108KdLzJW','cause','stderr','3685oPRkOX','log','getOrCreateDefaultAgent','214SZozOH','21MXrkSX','202758yEDTSC','stdout','getAgentId','join','Chat\x20session:\x20','handleSSEEvent','tool_call','message','\x27...','464lJrcNp','Error:\x20','Getting\x20agent\x20for\x20model\x20\x27','event','description','tool','698VONfuh','name','llm','Continuing\x20chat:\x20','error','stack','70466VJxLdb','content','Resolving\x20agent\x20\x27','resolveProjectId','resolveAgentId','data','CHAT_NOT_FOUND','\x0aStack\x20trace:','404','\x0a[Output:\x20'];a14_0x25b0=function(){return _0x46b8a9;};return a14_0x25b0();}function a14_0x620b(_0x29dd9d,_0xe1d3f8){const _0x25b003=a14_0x25b0();return a14_0x620b=function(_0x620b0b,_0x4927fa){_0x620b0b=_0x620b0b-0x129;let _0x457574=_0x25b003[_0x620b0b];return _0x457574;},a14_0x620b(_0x29dd9d,_0xe1d3f8);}import{resolveModelAlias}from'../utils/model-aliases.js';function handleSDKError(_0x5d6c71,_0x452809){const _0x33f29f=a14_0x620b;if(_0x5d6c71 instanceof SDKError)console[_0x33f29f(0x154)](_0x33f29f(0x14b)+_0x5d6c71[_0x33f29f(0x148)]),_0x452809[_0x33f29f(0x164)]&&(_0x5d6c71[_0x33f29f(0x13a)]&&console[_0x33f29f(0x154)](_0x33f29f(0x160)+_0x5d6c71[_0x33f29f(0x13a)]),_0x5d6c71['stack']&&(console[_0x33f29f(0x154)](_0x33f29f(0x15d)),console[_0x33f29f(0x154)](_0x5d6c71[_0x33f29f(0x155)])));else throw _0x5d6c71;}export class ChatCommand extends BaseCommand{[a14_0x143b20(0x151)]='chat';[a14_0x143b20(0x14e)]='Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)';[a14_0x143b20(0x12e)](_0x4d250b){const _0x2c9c84=a14_0x143b20,_0x2c5ce7=_0x4d250b['args'][_0x2c9c84(0x144)]('\x20');if(!_0x2c5ce7)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a14_0x143b20(0x133)](_0x1c629d,_0x336219,_0x1e861d,_0x48aeaf,_0x2067c0){const _0x251998=a14_0x143b20;for await(const _0x3c1538 of _0x1c629d[_0x251998(0x152)]['chat'](_0x336219,{'agentId':_0x1e861d,'chatId':_0x48aeaf})){if(_0x3c1538[_0x251998(0x130)]===_0x251998(0x12b)){const _0x40aba8=_0x3c1538[_0x251998(0x15b)][_0x251998(0x136)];saveLastChatId(_0x40aba8),_0x2067c0&&console[_0x251998(0x154)](_0x251998(0x145)+_0x40aba8);}else _0x3c1538[_0x251998(0x130)]===_0x251998(0x14d)&&this['handleSSEEvent'](_0x3c1538[_0x251998(0x15b)]);}}async['getAgentId'](_0x433b47,_0x2c7d54,_0x4b6699,_0x1a52d0,_0x40c4a5){const _0x5c2b94=a14_0x143b20;if(_0x2c7d54){const {projectName:_0x2fa574,agentName:_0x436bec}=parseAgentRef(_0x2c7d54);if(!_0x436bec)throw new Error('Agent\x20reference\x20must\x20include\x20project\x20name.\x20Usage:\x20--agent\x20\x22Project/Agent\x22');const _0x7ef848=await withSpinner(_0x5c2b94(0x132)+_0x2fa574+_0x5c2b94(0x149),()=>_0x433b47[_0x5c2b94(0x152)][_0x5c2b94(0x159)](_0x2fa574),{'verbose':_0x40c4a5}),_0x78111e=await withSpinner(_0x5c2b94(0x158)+_0x436bec+_0x5c2b94(0x149),()=>_0x433b47[_0x5c2b94(0x152)][_0x5c2b94(0x15a)](_0x436bec,_0x7ef848[_0x5c2b94(0x15b)]),{'verbose':_0x40c4a5});return _0x78111e['data'];}else{const _0x3ba978=_0x4b6699||'haiku',_0x146269=resolveModelAlias(_0x3ba978),_0x41d0d8=await withSpinner(_0x5c2b94(0x14c)+_0x146269+'\x27...',()=>_0x433b47['llm'][_0x5c2b94(0x13e)](_0x146269,0x0,_0x1a52d0),{'verbose':_0x40c4a5});return _0x41d0d8['data']['id'];}}async[a14_0x143b20(0x131)](_0x35e546){const _0x17e21e=a14_0x143b20,{options:_0x14f873,args:_0x3e05be,tdx:_0x3b287c}=_0x35e546,_0x529127=_0x3e05be[_0x17e21e(0x144)]('\x20'),_0x3bc5a5=_0x14f873,_0x2e8396=_0x3bc5a5[_0x17e21e(0x166)],_0x2a2a9e=_0x3bc5a5[_0x17e21e(0x129)],_0x3e3727=_0x3bc5a5['temperature']?Number(_0x3bc5a5[_0x17e21e(0x12f)]):undefined,_0x5e6413=_0x3bc5a5['new'];try{let _0x5c367c,_0x239199;!_0x5e6413&&(_0x239199=loadLastChatId(),_0x239199&&_0x14f873[_0x17e21e(0x164)]&&console['error'](_0x17e21e(0x153)+_0x239199));(_0x5e6413||!_0x239199)&&(_0x5c367c=await this[_0x17e21e(0x143)](_0x3b287c,_0x2e8396,_0x2a2a9e,_0x3e3727,_0x14f873[_0x17e21e(0x164)]));try{await this['streamChat'](_0x3b287c,_0x529127,_0x5c367c,_0x239199,_0x14f873[_0x17e21e(0x164)]);}catch(_0xcc9bdb){const _0x1b6886=_0xcc9bdb instanceof SDKError&&_0xcc9bdb[_0x17e21e(0x134)]===ErrorCode[_0x17e21e(0x15c)]||_0xcc9bdb instanceof Error&&_0xcc9bdb[_0x17e21e(0x148)]['includes'](_0x17e21e(0x15e));if(_0x1b6886)_0x14f873[_0x17e21e(0x164)]&&console[_0x17e21e(0x154)](_0x17e21e(0x165)),!_0x5c367c&&(_0x5c367c=await this[_0x17e21e(0x143)](_0x3b287c,_0x2e8396,_0x2a2a9e,_0x3e3727,_0x14f873[_0x17e21e(0x164)])),await this[_0x17e21e(0x133)](_0x3b287c,_0x529127,_0x5c367c,undefined,_0x14f873[_0x17e21e(0x164)]);else throw _0xcc9bdb;}return console[_0x17e21e(0x13d)](),0x0;}catch(_0x5e0bf1){return console['error'](),handleSDKError(_0x5e0bf1,_0x14f873),0x1;}}[a14_0x143b20(0x146)](_0x1887ba){const _0xe6883d=a14_0x143b20;if('content'in _0x1887ba)process[_0xe6883d(0x142)][_0xe6883d(0x12a)](_0x1887ba['content']);else{if('tool_call'in _0x1887ba)process[_0xe6883d(0x13b)][_0xe6883d(0x12a)]('\x0a[Tool:\x20'+_0x1887ba[_0xe6883d(0x147)][_0xe6883d(0x161)]+']\x0a');else{if(_0xe6883d(0x14f)in _0x1887ba)process[_0xe6883d(0x13b)][_0xe6883d(0x12a)](_0xe6883d(0x138)+_0x1887ba[_0xe6883d(0x14f)][_0xe6883d(0x161)]+']\x0a');else{if('output'in _0x1887ba)process['stderr'][_0xe6883d(0x12a)](_0xe6883d(0x15f)+_0x1887ba[_0xe6883d(0x12d)][_0xe6883d(0x151)]+']\x0a'),process[_0xe6883d(0x13b)][_0xe6883d(0x12a)](_0x1887ba[_0xe6883d(0x12d)][_0xe6883d(0x157)]+'\x0a');else _0xe6883d(0x154)in _0x1887ba&&process[_0xe6883d(0x13b)][_0xe6883d(0x12a)](_0xe6883d(0x137)+_0x1887ba[_0xe6883d(0x154)]+']\x0a');}}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a15_0x32522a=a15_0x32ea;function a15_0x2b8e(){const _0x37eb46=['green','data','site','✓\x20Using\x20project:\x20','✓\x20Port\x20','Failed\x20to\x20configure\x20marketplace\x20\x27','inherit','trim','\x27\x20installed','✓\x20Logs\x20saved\x20to\x20','utf-8','already\x20installed','\x20already\x20configured','td-skills\x20Plugins','includes','sql-skills','INSTALLATION_FAILED','object','error','install','join','localhost','which','✓\x20Marketplace\x20\x27','close','llm','parse','toString','COMMAND_NOT_FOUND','3197858IvbQky','getLogPath','tdx','attributes','Updating\x20marketplace\x20\x27','Starting\x20TD\x20LLM\x20proxy\x20server...','sonnet','765hCEfMs','Failed\x20to\x20update\x20marketplace\x20\x27','td-skills','Executing:\x20claude\x20','fail','start','execute','settings.local.json','✓\x20Plugin\x20\x27','):\x20claude\x20','Command\x20output:\x20','plugin','claude','✓\x20Settings\x20restored:\x20.claude/settings.local.json','ANTHROPIC_MODEL','Failed\x20to\x20install\x20plugin\x20\x27','text','Failed\x20to\x20launch\x20Claude\x20Code:\x20','https://github.com/treasure-data/td-skills','cause','already\x20exists','env','debug','verbose','findClaudePath','cwd','7275790ZtyBJx','add','659950juZeNV','hostname','Warning:\x20Failed\x20to\x20configure\x20','string','2131136AsUhMK','Setting\x20up\x20project...','server','54500OjvwHx','http://127.0.0.1:','✓\x20MCP\x20server\x20\x27','message','name','warn','stringify','statusLine','profile','proxy','originalSettings','TD\x20Docs\x20MCP\x20Server','logger','tdx\x20claude\x20statusline','exit','log','\x27...','Configuring\x20marketplace\x20\x27','127.0.0.1','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','--transport','Creating\x20.claude/settings.local.json...','ANTHROPIC_BASE_URL','84AYUzvR','marketplace','.claude','command','red','model','140344APyimW','tdx-skills','tdx\x20--profile\x20','Finding\x20available\x20port...','Command\x20failed\x20(exit\x20','mcp','Configuring\x20MCP\x20server\x20\x27','Setup\x20failed','\x20claude\x20statusline','✓\x20Logging\x20to\x20','stop','\x20configuration\x20failed','714918gDePTe','3smSWqV'];a15_0x2b8e=function(){return _0x37eb46;};return a15_0x2b8e();}(function(_0x14e606,_0x202fe8){const _0x45df1e=a15_0x32ea,_0x59bc46=_0x14e606();while(!![]){try{const _0x564b41=parseInt(_0x45df1e(0x184))/0x1+-parseInt(_0x45df1e(0x15a))/0x2+-parseInt(_0x45df1e(0x13c))/0x3*(parseInt(_0x45df1e(0x12f))/0x4)+-parseInt(_0x45df1e(0x17b))/0x5+parseInt(_0x45df1e(0x13b))/0x6*(-parseInt(_0x45df1e(0x129))/0x7)+-parseInt(_0x45df1e(0x181))/0x8+-parseInt(_0x45df1e(0x161))/0x9*(-parseInt(_0x45df1e(0x17d))/0xa);if(_0x564b41===_0x202fe8)break;else _0x59bc46['push'](_0x59bc46['shift']());}catch(_0x442c11){_0x59bc46['push'](_0x59bc46['shift']());}}}(a15_0x2b8e,0xd6852));import{spawn}from'node:child_process';function a15_0x32ea(_0x539d27,_0x2e48e7){const _0x2b8e1f=a15_0x2b8e();return a15_0x32ea=function(_0x32ea49,_0x26c18b){_0x32ea49=_0x32ea49-0x123;let _0x2010e2=_0x2b8e1f[_0x32ea49];return _0x2010e2;},a15_0x32ea(_0x539d27,_0x2e48e7);}import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a15_0x3db7a8 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';function handleInstallationError(_0x5226bc,_0x4a6644,_0x17704d,_0x2a57ac){const _0x3b359f=a15_0x32ea;errorContains(_0x5226bc,_0x3b359f(0x175),_0x3b359f(0x148),'already\x20configured')?(_0x17704d[_0x3b359f(0x171)]='✓\x20'+_0x4a6644+_0x3b359f(0x149),_0x2a57ac?.['info'](_0x4a6644+_0x3b359f(0x149)),_0x5226bc instanceof SDKError&&_0x5226bc[_0x3b359f(0x174)]&&_0x2a57ac?.[_0x3b359f(0x177)](_0x3b359f(0x16b)+_0x5226bc[_0x3b359f(0x174)][_0x3b359f(0x187)])):(_0x17704d[_0x3b359f(0x189)](_0x3b359f(0x17f)+_0x4a6644),_0x2a57ac?.[_0x3b359f(0x14f)](_0x4a6644+_0x3b359f(0x13a),_0x5226bc));}async function executeClaudeCommand(_0x44e8cd,_0x493e73,_0x1236e6){const _0x2dca39=a15_0x32ea;return _0x1236e6?.['info'](_0x2dca39(0x164)+_0x44e8cd[_0x2dca39(0x151)]('\x20')),new Promise((_0x2dca9b,_0x4a3f57)=>{const _0x1de899=_0x2dca39,_0xc6024e=spawn(_0x1de899(0x16d),_0x44e8cd,{'stdio':'pipe'});let _0x181f4a='',_0x2b5e67='';_0xc6024e['stdout']['on'](_0x1de899(0x13e),_0x35bff9=>{const _0x407536=_0x1de899;_0x181f4a+=_0x35bff9[_0x407536(0x158)]();}),_0xc6024e['stderr']['on'](_0x1de899(0x13e),_0x5c5556=>{const _0x431e05=_0x1de899;_0x2b5e67+=_0x5c5556[_0x431e05(0x158)]();}),_0xc6024e['on'](_0x1de899(0x192),_0x4cc180=>{const _0xb9eddb=_0x1de899;if(_0x4cc180===0x0)_0x2dca9b(_0x181f4a);else _0x493e73?(_0x1236e6?.['error'](_0xb9eddb(0x133)+_0x4cc180+_0xb9eddb(0x16a)+_0x44e8cd['join']('\x20')),_0x4a3f57(new SDKError(ErrorCode[_0xb9eddb(0x14d)],_0x493e73,new Error(_0x2b5e67)))):_0x2dca9b('');});});}async function ensureMcpServer(_0x69c530,_0xb7735,_0x13882d,_0x8bab27,_0x52d572){const _0x2edf77=a15_0x32ea;_0x8bab27['text']=_0x2edf77(0x135)+_0x69c530+_0x2edf77(0x194),await executeClaudeCommand([_0x2edf77(0x134),'add',_0x69c530,_0xb7735,_0x2edf77(0x126),_0x13882d],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x69c530+'\x27',_0x52d572),_0x8bab27['text']=_0x2edf77(0x186)+_0x69c530+'\x27\x20configured';}async function ensureMarketplace(_0x3340f1,_0x2efec0,_0x447678,_0x28b8af){const _0xc02047=a15_0x32ea;_0x447678[_0xc02047(0x171)]=_0xc02047(0x123)+_0x3340f1+_0xc02047(0x194),await executeClaudeCommand([_0xc02047(0x16c),'marketplace',_0xc02047(0x17c),_0x2efec0],_0xc02047(0x142)+_0x3340f1+'\x27',_0x28b8af),_0x447678[_0xc02047(0x171)]=_0xc02047(0x154)+_0x3340f1+'\x27\x20configured';}async function updateMarketplace(_0x968a64,_0x11a012,_0x1be2ff){const _0x3faf26=a15_0x32ea;_0x11a012['text']=_0x3faf26(0x15e)+_0x968a64+_0x3faf26(0x194),await executeClaudeCommand([_0x3faf26(0x16c),_0x3faf26(0x12a),'update'],_0x3faf26(0x162)+_0x968a64+'\x27',_0x1be2ff),_0x11a012['text']='✓\x20Marketplace\x20\x27'+_0x968a64+'\x27\x20updated';}async function ensurePlugin(_0x5ec643,_0x5fbed3,_0x2c8fe1,_0x3da0ad){const _0x2be522=a15_0x32ea;_0x2c8fe1[_0x2be522(0x171)]='Installing\x20plugin\x20\x27'+_0x5ec643+_0x2be522(0x194),await executeClaudeCommand(['plugin',_0x2be522(0x150),_0x5ec643+'@'+_0x5fbed3],_0x2be522(0x170)+_0x5ec643+'\x27',_0x3da0ad),_0x2c8fe1[_0x2be522(0x171)]=_0x2be522(0x169)+_0x5ec643+_0x2be522(0x145);}async function createClaudeSettings(_0x292d5d,_0x34867b=a15_0x32522a(0x160),_0x49c362){const _0x25a7d5=a15_0x32522a,_0x1c8505=join(process[_0x25a7d5(0x17a)](),'.claude'),_0x35c217=join(_0x1c8505,_0x25a7d5(0x168));await mkdir(_0x1c8505,{'recursive':!![]});let _0x41cc4d={};if(existsSync(_0x35c217))try{const _0x7edfd9=await readFile(_0x35c217,_0x25a7d5(0x147));_0x41cc4d=JSON[_0x25a7d5(0x157)](_0x7edfd9);}catch{_0x41cc4d={};}const _0x3314e2=_0x41cc4d['env']||{},_0x3eeebf={'ANTHROPIC_BASE_URL':_0x3314e2[_0x25a7d5(0x128)],'ANTHROPIC_MODEL':_0x3314e2[_0x25a7d5(0x16f)],'statusLine':_0x41cc4d['statusLine']},_0x52bbf3={..._0x41cc4d,'env':{..._0x3314e2,'ANTHROPIC_BASE_URL':_0x25a7d5(0x185)+_0x292d5d,'ANTHROPIC_MODEL':_0x34867b},'statusLine':{'type':_0x25a7d5(0x12c),'command':_0x49c362?_0x25a7d5(0x131)+_0x49c362+_0x25a7d5(0x137):_0x25a7d5(0x191)}};return await writeFile(_0x35c217,JSON[_0x25a7d5(0x18a)](_0x52bbf3,null,0x2)+'\x0a'),_0x3eeebf;}async function restoreClaudeSettings(_0x5c4715){const _0x547378=a15_0x32522a,_0x564ed4=join(process[_0x547378(0x17a)](),_0x547378(0x12b)),_0x264584=join(_0x564ed4,_0x547378(0x168));if(!existsSync(_0x264584))return;try{const _0x3d2c9b=await readFile(_0x264584,_0x547378(0x147)),_0x30dc67=JSON[_0x547378(0x157)](_0x3d2c9b),_0x33f71f=_0x30dc67[_0x547378(0x176)]||{},_0x477fac=_0x33f71f[_0x547378(0x128)],_0x4d3f03=((()=>{const _0x30e966=_0x547378;if(typeof _0x477fac!==_0x30e966(0x180))return![];try{const _0x453d98=new URL(_0x477fac);return _0x453d98[_0x30e966(0x17e)]===_0x30e966(0x152)||_0x453d98[_0x30e966(0x17e)]===_0x30e966(0x124);}catch{return![];}})());_0x4d3f03?(delete _0x33f71f[_0x547378(0x128)],delete _0x33f71f[_0x547378(0x16f)]):(_0x5c4715[_0x547378(0x128)]!==undefined?_0x33f71f[_0x547378(0x128)]=_0x5c4715[_0x547378(0x128)]:delete _0x33f71f[_0x547378(0x128)],_0x5c4715[_0x547378(0x16f)]!==undefined?_0x33f71f[_0x547378(0x16f)]=_0x5c4715[_0x547378(0x16f)]:delete _0x33f71f[_0x547378(0x16f)]);const _0x2d5af6=_0x30dc67[_0x547378(0x18b)],_0x54ce69=((()=>{const _0x4b4e65=_0x547378;if(!_0x2d5af6||typeof _0x2d5af6!==_0x4b4e65(0x14e))return![];if(_0x2d5af6['type']!==_0x4b4e65(0x12c))return![];if(typeof _0x2d5af6[_0x4b4e65(0x12c)]!=='string')return![];return _0x2d5af6['command'][_0x4b4e65(0x14b)](_0x4b4e65(0x15c))&&_0x2d5af6['command'][_0x4b4e65(0x14b)]('statusline');})());if(_0x54ce69)delete _0x30dc67['statusLine'];else _0x5c4715[_0x547378(0x18b)]!==undefined?_0x30dc67[_0x547378(0x18b)]=_0x5c4715['statusLine']:delete _0x30dc67['statusLine'];_0x30dc67[_0x547378(0x176)]=_0x33f71f,await writeFile(_0x264584,JSON[_0x547378(0x18a)](_0x30dc67,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']='claude';['description']='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';['server'];[a15_0x32522a(0x18e)];[a15_0x32522a(0x190)];async[a15_0x32522a(0x167)](_0x39fd9d){const _0x5cd4c1=a15_0x32522a,{tdx:_0x1e0b3e,options:_0x69d0e4,args:_0x5c63da}=_0x39fd9d;try{const _0x2fc274=_0x69d0e4,_0x2b740b=_0x2fc274[_0x5cd4c1(0x12e)]||_0x5cd4c1(0x160),_0x5745be=_0x2fc274[_0x5cd4c1(0x18d)]===![],_0x451f58=createCommandSpinner('Initializing...',{'verbose':_0x69d0e4[_0x5cd4c1(0x178)]});_0x451f58[_0x5cd4c1(0x166)]();try{if(!_0x5745be){_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x132);const _0x46f7fb=await findAvailablePort(0xfa0);_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x141)+_0x46f7fb,_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x182);const _0x548426=await _0x1e0b3e[_0x5cd4c1(0x156)]['getOrCreateDefaultProject'](),_0x1d954e=_0x548426['id'];_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x140)+_0x548426[_0x5cd4c1(0x15d)][_0x5cd4c1(0x188)],_0x451f58[_0x5cd4c1(0x171)]='Initializing\x20proxy\x20logger...',this[_0x5cd4c1(0x190)]=new TDXLogger(_0x69d0e4['logLevel'],!![]),await this[_0x5cd4c1(0x190)]['init']();const _0x32faa6=this[_0x5cd4c1(0x190)][_0x5cd4c1(0x15b)]();_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x138)+_0x32faa6,_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x15f),this[_0x5cd4c1(0x183)]=new ProxyServer({'port':_0x46f7fb,'projectId':_0x1d954e,'tdx':_0x1e0b3e,'logger':this[_0x5cd4c1(0x190)],'site':_0x69d0e4[_0x5cd4c1(0x13f)]}),await this[_0x5cd4c1(0x183)][_0x5cd4c1(0x166)](),_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x125)+_0x46f7fb,_0x451f58[_0x5cd4c1(0x171)]=_0x5cd4c1(0x127);const _0x2c4620=_0x69d0e4[_0x5cd4c1(0x18c)];this[_0x5cd4c1(0x18e)]=await createClaudeSettings(_0x46f7fb,_0x2b740b,_0x2c4620),_0x451f58[_0x5cd4c1(0x171)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x451f58[_0x5cd4c1(0x171)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{await ensureMcpServer('td-docs','https://docs.treasuredata.com/mcp','http',_0x451f58,this['logger']);}catch(_0x529fc9){handleInstallationError(_0x529fc9,_0x5cd4c1(0x18f),_0x451f58,this['logger']);}try{await ensureMarketplace('td-skills',_0x5cd4c1(0x173),_0x451f58,this[_0x5cd4c1(0x190)]),await updateMarketplace(_0x5cd4c1(0x163),_0x451f58,this['logger']),await ensurePlugin(_0x5cd4c1(0x14c),_0x5cd4c1(0x163),_0x451f58,this[_0x5cd4c1(0x190)]),await ensurePlugin('workflow-skills',_0x5cd4c1(0x163),_0x451f58,this[_0x5cd4c1(0x190)]),await ensurePlugin(_0x5cd4c1(0x130),_0x5cd4c1(0x163),_0x451f58,this['logger']);}catch(_0x2bb314){handleInstallationError(_0x2bb314,_0x5cd4c1(0x14a),_0x451f58,this[_0x5cd4c1(0x190)]);}_0x451f58['stop']();}catch(_0x915b60){_0x451f58[_0x5cd4c1(0x165)](_0x5cd4c1(0x136));throw _0x915b60;}const _0x12cdd7=await this[_0x5cd4c1(0x179)]();if(!_0x12cdd7)throw new SDKError(ErrorCode[_0x5cd4c1(0x159)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x2de097=spawn(_0x12cdd7,_0x5c63da,{'stdio':_0x5cd4c1(0x143)}),_0xd44b09=await new Promise(_0x6ccd26=>{const _0x4f6675=_0x5cd4c1;_0x2de097['on'](_0x4f6675(0x192),_0x4a39d0=>{_0x6ccd26(_0x4a39d0||0x0);}),_0x2de097['on'](_0x4f6675(0x14f),_0x1d0c51=>{const _0x1353c2=_0x4f6675;console[_0x1353c2(0x14f)](a15_0x3db7a8[_0x1353c2(0x12d)](_0x1353c2(0x172)+_0x1d0c51['message'])),_0x6ccd26(0x1);});});this[_0x5cd4c1(0x183)]&&(await this[_0x5cd4c1(0x183)]['stop'](),console['log'](a15_0x3db7a8[_0x5cd4c1(0x13d)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));if(this[_0x5cd4c1(0x190)]){await this[_0x5cd4c1(0x190)][_0x5cd4c1(0x155)]();const _0x2a3b90=this[_0x5cd4c1(0x190)][_0x5cd4c1(0x15b)]();console['log'](a15_0x3db7a8[_0x5cd4c1(0x13d)](_0x5cd4c1(0x146)+_0x2a3b90));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x5cd4c1(0x18e)]),console[_0x5cd4c1(0x193)](a15_0x3db7a8['green'](_0x5cd4c1(0x16e)))),_0xd44b09;}catch(_0x567040){this[_0x5cd4c1(0x183)]&&await this[_0x5cd4c1(0x183)][_0x5cd4c1(0x139)]();this[_0x5cd4c1(0x190)]&&await this['logger']['close']();this[_0x5cd4c1(0x18e)]&&await restoreClaudeSettings(this[_0x5cd4c1(0x18e)]);throw _0x567040;}}async[a15_0x32522a(0x179)](){return new Promise(_0x49fafd=>{const _0x1dddb7=a15_0x32ea,_0x347e96=spawn(_0x1dddb7(0x153),[_0x1dddb7(0x16d)]);let _0x408a9e='';_0x347e96['stdout']['on'](_0x1dddb7(0x13e),_0x367012=>{const _0x2057fe=_0x1dddb7;_0x408a9e+=_0x367012[_0x2057fe(0x158)]();}),_0x347e96['on']('exit',_0x403eed=>{const _0x5380f5=_0x1dddb7;_0x403eed===0x0&&_0x408a9e[_0x5380f5(0x144)]()?_0x49fafd(_0x408a9e['trim']()):_0x49fafd('claude');});});}}
|
|
1
|
+
const a15_0x47d289=a15_0x61f9;function a15_0x4e94(){const _0x5edf63=['trim','add','start','already\x20installed','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','\x27\x20updated','Failed\x20to\x20configure\x20marketplace\x20\x27','✓\x20Logging\x20to\x20','red','data','✓\x20Marketplace\x20\x27','Installing\x20plugin\x20\x27','tdx','findClaudePath','string','execute','COMMAND_NOT_FOUND','56GCbdly','\x27...','log','debug','exit','INSTALLATION_FAILED','close','Configuring\x20MCP\x20server\x20\x27','workflow-skills','green','utf-8','cwd','info','ANTHROPIC_MODEL','site','marketplace','1348119aRzPqx','https://github.com/treasure-data/td-skills','5394292LHZAGe','https://docs.treasuredata.com/mcp','✓\x20Settings\x20configured:\x20.claude/settings.local.json','):\x20claude\x20','llm','cause','message','\x27\x20installed','Command\x20failed\x20(exit\x20','verbose','4367619yYmGkP','fail','which','logger','hostname','Creating\x20.claude/settings.local.json...','--transport','install','server','toString','tdx\x20--profile\x20','stderr','Setting\x20up\x20project...','getLogPath','\x20claude\x20statusline','error','includes','Failed\x20to\x20install\x20plugin\x20\x27','\x27\x20configured','ANTHROPIC_BASE_URL','stdout','type','Claude\x20Code\x20CLI\x20not\x20found','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Initializing\x20proxy\x20logger...','Starting\x20TD\x20LLM\x20proxy\x20server...','logLevel','\x20already\x20configured','td-docs','stringify','\x20configuration\x20failed','env','stop','settings.local.json','11759502ULpZeG','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','Executing:\x20claude\x20','update','statusline','.claude','✓\x20Logs\x20saved\x20to\x20','getOrCreateDefaultProject','description','754710nyXXxg','✓\x20Plugin\x20\x27','Warning:\x20Failed\x20to\x20configure\x20','command','name','already\x20configured','td-skills\x20Plugins','claude','TD\x20Docs\x20MCP\x20Server','5AxfWIq','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','originalSettings','statusLine','text','td-skills','20QVjniu','plugin','parse','12358430WhiFFT','join','mcp','http://127.0.0.1:','105767CrQZGl','model','sonnet','✓\x20Settings\x20restored:\x20.claude/settings.local.json','Updating\x20marketplace\x20\x27','2vYqpGs','Finding\x20available\x20port...'];a15_0x4e94=function(){return _0x5edf63;};return a15_0x4e94();}(function(_0xe47e47,_0x48d9c0){const _0x40296c=a15_0x61f9,_0x26fc4e=_0xe47e47();while(!![]){try{const _0x3384cd=parseInt(_0x40296c(0x1cb))/0x1+parseInt(_0x40296c(0x1d0))/0x2*(-parseInt(_0x40296c(0x18a))/0x3)+-parseInt(_0x40296c(0x180))/0x4*(-parseInt(_0x40296c(0x1be))/0x5)+-parseInt(_0x40296c(0x1ac))/0x6+parseInt(_0x40296c(0x1c7))/0x7+parseInt(_0x40296c(0x1e3))/0x8*(parseInt(_0x40296c(0x17e))/0x9)+-parseInt(_0x40296c(0x1c4))/0xa*(-parseInt(_0x40296c(0x1b5))/0xb);if(_0x3384cd===_0x48d9c0)break;else _0x26fc4e['push'](_0x26fc4e['shift']());}catch(_0x55558d){_0x26fc4e['push'](_0x26fc4e['shift']());}}}(a15_0x4e94,0xf1a65));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';function a15_0x61f9(_0x175f4c,_0x2da378){const _0x4e946f=a15_0x4e94();return a15_0x61f9=function(_0x61f929,_0x8a1bc2){_0x61f929=_0x61f929-0x17b;let _0x22806a=_0x4e946f[_0x61f929];return _0x22806a;},a15_0x61f9(_0x175f4c,_0x2da378);}import{existsSync}from'node:fs';import{join}from'node:path';import a15_0xb87d5d from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';function handleInstallationError(_0x3f18af,_0x58cb37,_0x36b633,_0x2e5111){const _0x254724=a15_0x61f9;errorContains(_0x3f18af,'already\x20exists',_0x254724(0x1d5),_0x254724(0x1ba))?(_0x36b633[_0x254724(0x1c2)]='✓\x20'+_0x58cb37+_0x254724(0x1a5),_0x2e5111?.['info'](_0x58cb37+_0x254724(0x1a5)),_0x3f18af instanceof SDKError&&_0x3f18af[_0x254724(0x185)]&&_0x2e5111?.[_0x254724(0x1e6)]('Command\x20output:\x20'+_0x3f18af['cause'][_0x254724(0x186)])):(_0x36b633['warn'](_0x254724(0x1b7)+_0x58cb37),_0x2e5111?.['error'](_0x58cb37+_0x254724(0x1a8),_0x3f18af));}async function executeClaudeCommand(_0x5c5983,_0x4770ce,_0x5e6d05){const _0x272d81=a15_0x61f9;return _0x5e6d05?.[_0x272d81(0x1ef)](_0x272d81(0x1ae)+_0x5c5983[_0x272d81(0x1c8)]('\x20')),new Promise((_0x56869d,_0x274a1e)=>{const _0x59d205=_0x272d81,_0x52d1fc=spawn('claude',_0x5c5983,{'stdio':'pipe'});let _0x3ca996='',_0x5360e6='';_0x52d1fc[_0x59d205(0x19e)]['on'](_0x59d205(0x1db),_0xf6d3e9=>{const _0x21c199=_0x59d205;_0x3ca996+=_0xf6d3e9[_0x21c199(0x193)]();}),_0x52d1fc[_0x59d205(0x195)]['on'](_0x59d205(0x1db),_0x558c57=>{_0x5360e6+=_0x558c57['toString']();}),_0x52d1fc['on'](_0x59d205(0x1e7),_0x280981=>{const _0x1c3286=_0x59d205;if(_0x280981===0x0)_0x56869d(_0x3ca996);else _0x4770ce?(_0x5e6d05?.[_0x1c3286(0x199)](_0x1c3286(0x188)+_0x280981+_0x1c3286(0x183)+_0x5c5983['join']('\x20')),_0x274a1e(new SDKError(ErrorCode[_0x1c3286(0x1e8)],_0x4770ce,new Error(_0x5360e6)))):_0x56869d('');});});}async function ensureMcpServer(_0xbbc1cb,_0x31f0ec,_0x51d91a,_0x338df4,_0x57fc13){const _0x4871f6=a15_0x61f9;_0x338df4[_0x4871f6(0x1c2)]=_0x4871f6(0x1ea)+_0xbbc1cb+_0x4871f6(0x1e4),await executeClaudeCommand([_0x4871f6(0x1c9),'add',_0xbbc1cb,_0x31f0ec,_0x4871f6(0x190),_0x51d91a],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0xbbc1cb+'\x27',_0x57fc13),_0x338df4[_0x4871f6(0x1c2)]='✓\x20MCP\x20server\x20\x27'+_0xbbc1cb+_0x4871f6(0x19c);}async function ensureMarketplace(_0x22a68b,_0x345937,_0x18e810,_0x3905f9){const _0x398451=a15_0x61f9;_0x18e810['text']='Configuring\x20marketplace\x20\x27'+_0x22a68b+'\x27...',await executeClaudeCommand([_0x398451(0x1c5),_0x398451(0x17d),_0x398451(0x1d3),_0x345937],_0x398451(0x1d8)+_0x22a68b+'\x27',_0x3905f9),_0x18e810[_0x398451(0x1c2)]=_0x398451(0x1dc)+_0x22a68b+_0x398451(0x19c);}async function updateMarketplace(_0x371019,_0x12c498,_0x73eb03){const _0x1d4635=a15_0x61f9;_0x12c498[_0x1d4635(0x1c2)]=_0x1d4635(0x1cf)+_0x371019+_0x1d4635(0x1e4),await executeClaudeCommand(['plugin',_0x1d4635(0x17d),_0x1d4635(0x1af)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x371019+'\x27',_0x73eb03),_0x12c498[_0x1d4635(0x1c2)]='✓\x20Marketplace\x20\x27'+_0x371019+_0x1d4635(0x1d7);}async function ensurePlugin(_0x2b9477,_0xe0968e,_0x1aa553,_0x190897){const _0x44813b=a15_0x61f9;_0x1aa553['text']=_0x44813b(0x1dd)+_0x2b9477+_0x44813b(0x1e4),await executeClaudeCommand(['plugin',_0x44813b(0x191),_0x2b9477+'@'+_0xe0968e],_0x44813b(0x19b)+_0x2b9477+'\x27',_0x190897),_0x1aa553[_0x44813b(0x1c2)]=_0x44813b(0x1b6)+_0x2b9477+_0x44813b(0x187);}async function createClaudeSettings(_0x4e34a4,_0x17b882=a15_0x47d289(0x1cd),_0x52cd33){const _0x22d63c=a15_0x47d289,_0x38164a=join(process[_0x22d63c(0x1ee)](),_0x22d63c(0x1b1)),_0x2a184c=join(_0x38164a,_0x22d63c(0x1ab));await mkdir(_0x38164a,{'recursive':!![]});let _0x44acdb={};if(existsSync(_0x2a184c))try{const _0xd107fe=await readFile(_0x2a184c,'utf-8');_0x44acdb=JSON['parse'](_0xd107fe);}catch{_0x44acdb={};}const _0x41b912=_0x44acdb[_0x22d63c(0x1a9)]||{},_0x321321={'ANTHROPIC_BASE_URL':_0x41b912[_0x22d63c(0x19d)],'ANTHROPIC_MODEL':_0x41b912[_0x22d63c(0x17b)],'statusLine':_0x44acdb[_0x22d63c(0x1c1)]},_0x3ddfd7={..._0x44acdb,'env':{..._0x41b912,'ANTHROPIC_BASE_URL':_0x22d63c(0x1ca)+_0x4e34a4,'ANTHROPIC_MODEL':_0x17b882},'statusLine':{'type':_0x22d63c(0x1b8),'command':_0x52cd33?_0x22d63c(0x194)+_0x52cd33+_0x22d63c(0x198):'tdx\x20claude\x20statusline'}};return await writeFile(_0x2a184c,JSON[_0x22d63c(0x1a7)](_0x3ddfd7,null,0x2)+'\x0a'),_0x321321;}async function restoreClaudeSettings(_0x200533){const _0x51af74=a15_0x47d289,_0x5986a2=join(process[_0x51af74(0x1ee)](),_0x51af74(0x1b1)),_0x43f263=join(_0x5986a2,_0x51af74(0x1ab));if(!existsSync(_0x43f263))return;try{const _0x5c7a4d=await readFile(_0x43f263,_0x51af74(0x1ed)),_0x2ef4dc=JSON[_0x51af74(0x1c6)](_0x5c7a4d),_0xb61892=_0x2ef4dc[_0x51af74(0x1a9)]||{},_0x3a47df=_0xb61892['ANTHROPIC_BASE_URL'],_0x4e337a=((()=>{const _0x2321d6=_0x51af74;if(typeof _0x3a47df!==_0x2321d6(0x1e0))return![];try{const _0x9c95f5=new URL(_0x3a47df);return _0x9c95f5['hostname']==='localhost'||_0x9c95f5[_0x2321d6(0x18e)]==='127.0.0.1';}catch{return![];}})());_0x4e337a?(delete _0xb61892['ANTHROPIC_BASE_URL'],delete _0xb61892[_0x51af74(0x17b)]):(_0x200533[_0x51af74(0x19d)]!==undefined?_0xb61892[_0x51af74(0x19d)]=_0x200533[_0x51af74(0x19d)]:delete _0xb61892[_0x51af74(0x19d)],_0x200533[_0x51af74(0x17b)]!==undefined?_0xb61892['ANTHROPIC_MODEL']=_0x200533[_0x51af74(0x17b)]:delete _0xb61892[_0x51af74(0x17b)]);const _0x235539=_0x2ef4dc[_0x51af74(0x1c1)],_0xf86ad6=((()=>{const _0x2438c5=_0x51af74;if(!_0x235539||typeof _0x235539!=='object')return![];if(_0x235539[_0x2438c5(0x19f)]!==_0x2438c5(0x1b8))return![];if(typeof _0x235539[_0x2438c5(0x1b8)]!=='string')return![];return _0x235539[_0x2438c5(0x1b8)][_0x2438c5(0x19a)](_0x2438c5(0x1de))&&_0x235539[_0x2438c5(0x1b8)][_0x2438c5(0x19a)](_0x2438c5(0x1b0));})());if(_0xf86ad6)delete _0x2ef4dc['statusLine'];else _0x200533['statusLine']!==undefined?_0x2ef4dc[_0x51af74(0x1c1)]=_0x200533[_0x51af74(0x1c1)]:delete _0x2ef4dc['statusLine'];_0x2ef4dc[_0x51af74(0x1a9)]=_0xb61892,await writeFile(_0x43f263,JSON['stringify'](_0x2ef4dc,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a15_0x47d289(0x1b9)]='claude';[a15_0x47d289(0x1b4)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';[a15_0x47d289(0x192)];[a15_0x47d289(0x1c0)];[a15_0x47d289(0x18d)];async[a15_0x47d289(0x1e1)](_0x101eb9){const _0x2655b1=a15_0x47d289,{tdx:_0x3471b3,options:_0x50470d,args:_0x40e413}=_0x101eb9;try{const _0x7583f8=_0x50470d,_0x2081a7=_0x7583f8[_0x2655b1(0x1cc)]||'sonnet',_0xae81e2=_0x7583f8['proxy']===![],_0x556e74=createCommandSpinner('Initializing...',{'verbose':_0x50470d[_0x2655b1(0x189)]});_0x556e74[_0x2655b1(0x1d4)]();try{if(!_0xae81e2){_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x1d1);const _0x426640=await findAvailablePort(0xfa0);_0x556e74[_0x2655b1(0x1c2)]='✓\x20Port\x20'+_0x426640,_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x196);const _0x91bc8d=await _0x3471b3[_0x2655b1(0x184)][_0x2655b1(0x1b3)](),_0x3baf8e=_0x91bc8d['id'];_0x556e74['text']='✓\x20Using\x20project:\x20'+_0x91bc8d['attributes'][_0x2655b1(0x1b9)],_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x1a2),this[_0x2655b1(0x18d)]=new TDXLogger(_0x50470d[_0x2655b1(0x1a4)],!![]),await this[_0x2655b1(0x18d)]['init']();const _0x525832=this[_0x2655b1(0x18d)][_0x2655b1(0x197)]();_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x1d9)+_0x525832,_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x1a3),this[_0x2655b1(0x192)]=new ProxyServer({'port':_0x426640,'projectId':_0x3baf8e,'tdx':_0x3471b3,'logger':this[_0x2655b1(0x18d)],'site':_0x50470d[_0x2655b1(0x17c)]}),await this['server'][_0x2655b1(0x1d4)](),_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x1d6)+_0x426640,_0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x18f);const _0x2ff204=_0x50470d['profile'];this[_0x2655b1(0x1c0)]=await createClaudeSettings(_0x426640,_0x2081a7,_0x2ff204),_0x556e74['text']=_0x2655b1(0x182);}else _0x556e74[_0x2655b1(0x1c2)]=_0x2655b1(0x1bf);try{await ensureMcpServer(_0x2655b1(0x1a6),_0x2655b1(0x181),'http',_0x556e74,this[_0x2655b1(0x18d)]);}catch(_0x4a0f35){handleInstallationError(_0x4a0f35,_0x2655b1(0x1bd),_0x556e74,this[_0x2655b1(0x18d)]);}try{await ensureMarketplace(_0x2655b1(0x1c3),_0x2655b1(0x17f),_0x556e74,this['logger']),await updateMarketplace(_0x2655b1(0x1c3),_0x556e74,this[_0x2655b1(0x18d)]),await ensurePlugin('sql-skills','td-skills',_0x556e74,this[_0x2655b1(0x18d)]),await ensurePlugin(_0x2655b1(0x1eb),_0x2655b1(0x1c3),_0x556e74,this['logger']),await ensurePlugin('tdx-skills',_0x2655b1(0x1c3),_0x556e74,this['logger']);}catch(_0x292c44){handleInstallationError(_0x292c44,_0x2655b1(0x1bb),_0x556e74,this[_0x2655b1(0x18d)]);}_0x556e74[_0x2655b1(0x1aa)]();}catch(_0x1d5626){_0x556e74[_0x2655b1(0x18b)]('Setup\x20failed');throw _0x1d5626;}const _0xa58e81=await this['findClaudePath']();if(!_0xa58e81)throw new SDKError(ErrorCode[_0x2655b1(0x1e2)],_0x2655b1(0x1a0),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x5359e9=spawn(_0xa58e81,_0x40e413,{'stdio':'inherit'}),_0x5362de=await new Promise(_0x1a9cea=>{const _0x1d4926=_0x2655b1;_0x5359e9['on'](_0x1d4926(0x1e7),_0x480799=>{_0x1a9cea(_0x480799||0x0);}),_0x5359e9['on'](_0x1d4926(0x199),_0xdf3b6f=>{const _0x2e0db5=_0x1d4926;console['error'](a15_0xb87d5d[_0x2e0db5(0x1da)](_0x2e0db5(0x1a1)+_0xdf3b6f[_0x2e0db5(0x186)])),_0x1a9cea(0x1);});});this[_0x2655b1(0x192)]&&(await this['server'][_0x2655b1(0x1aa)](),console['log'](a15_0xb87d5d[_0x2655b1(0x1ec)](_0x2655b1(0x1ad))));if(this['logger']){await this[_0x2655b1(0x18d)][_0x2655b1(0x1e9)]();const _0x5dc414=this[_0x2655b1(0x18d)][_0x2655b1(0x197)]();console[_0x2655b1(0x1e5)](a15_0xb87d5d[_0x2655b1(0x1ec)](_0x2655b1(0x1b2)+_0x5dc414));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x2655b1(0x1c0)]),console['log'](a15_0xb87d5d[_0x2655b1(0x1ec)](_0x2655b1(0x1ce)))),_0x5362de;}catch(_0x836eda){this['server']&&await this[_0x2655b1(0x192)][_0x2655b1(0x1aa)]();this['logger']&&await this[_0x2655b1(0x18d)][_0x2655b1(0x1e9)]();this['originalSettings']&&await restoreClaudeSettings(this[_0x2655b1(0x1c0)]);throw _0x836eda;}}async[a15_0x47d289(0x1df)](){return new Promise(_0x3f4ad6=>{const _0x444705=a15_0x61f9,_0x432572=spawn(_0x444705(0x18c),[_0x444705(0x1bc)]);let _0x4aae00='';_0x432572['stdout']['on'](_0x444705(0x1db),_0x422c67=>{const _0x3c3ba3=_0x444705;_0x4aae00+=_0x422c67[_0x3c3ba3(0x193)]();}),_0x432572['on'](_0x444705(0x1e7),_0x3e2cfb=>{const _0xd153d3=_0x444705;_0x3e2cfb===0x0&&_0x4aae00[_0xd153d3(0x1d2)]()?_0x3f4ad6(_0x4aae00[_0xd153d3(0x1d2)]()):_0x3f4ad6(_0xd153d3(0x1bc));});});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a16_0x2b50cb=a16_0x3c12;function a16_0x3801(){const _0x6ad8a4=['sessionCredits','🪙\x20credit:\x20','🤖\x20tdx\x20-\x20Claude','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','stdin','170296EODlfs','2948645GGLKsr','246574eAKcdF','statusline','Claude','line','options','\x20today\x20/\x20','monthCredits','537DjrGSh','5290344DyIXzT','latestInputTokens','\x20|\x20','🤖\x20tdx\x20-\x20','log','push','25772ZfiVfy','parse','session_id','join','\x20month','model','936696VeUiCo','close','1852DxaKoD','🧠\x20'];a16_0x3801=function(){return _0x6ad8a4;};return a16_0x3801();}(function(_0x400dfd,_0x1a6802){const _0x2aa18a=a16_0x3c12,_0x4e3523=_0x400dfd();while(!![]){try{const _0x1900c5=parseInt(_0x2aa18a(0xf3))/0x1+-parseInt(_0x2aa18a(0x109))/0x2*(-parseInt(_0x2aa18a(0xfa))/0x3)+-parseInt(_0x2aa18a(0x101))/0x4+-parseInt(_0x2aa18a(0xf2))/0x5+-parseInt(_0x2aa18a(0x107))/0x6+parseInt(_0x2aa18a(0xf1))/0x7+parseInt(_0x2aa18a(0xfb))/0x8;if(_0x1900c5===_0x1a6802)break;else _0x4e3523['push'](_0x4e3523['shift']());}catch(_0x55f728){_0x4e3523['push'](_0x4e3523['shift']());}}}(a16_0x3801,0x5463d));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';function a16_0x3c12(_0x14cf48,_0x23c7e4){const _0x380147=a16_0x3801();return a16_0x3c12=function(_0x3c128e,_0x37fea2){_0x3c128e=_0x3c128e-0xef;let _0x32f2b1=_0x380147[_0x3c128e];return _0x32f2b1;},a16_0x3c12(_0x14cf48,_0x23c7e4);}import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../utils/model-factors.js';async function readStdinJson(_0x2a14f8=0x64){return new Promise(_0x70bb55=>{const _0x45d454=a16_0x3c12;let _0x43ff42='',_0x248a87=![];const _0xce9643=createInterface({'input':process[_0x45d454(0xf0)],'terminal':![]}),_0x281f11=_0x59bb9f=>{const _0x34514a=_0x45d454;if(_0x248a87)return;_0x248a87=!![],clearTimeout(_0x395d83),_0xce9643[_0x34514a(0x108)](),_0x70bb55(_0x59bb9f);},_0x395d83=setTimeout(()=>{_0x281f11(null);},_0x2a14f8);_0xce9643['on'](_0x45d454(0xf6),_0x16bc87=>{_0x43ff42+=_0x16bc87;}),_0xce9643['on'](_0x45d454(0x108),()=>{const _0x5d728b=_0x45d454;if(_0x248a87)return;try{const _0x44408b=JSON[_0x5d728b(0x102)](_0x43ff42);_0x281f11(_0x44408b);}catch{_0x281f11(null);}});});}function formatCredits(_0x1dcdb8){return _0x1dcdb8['toFixed'](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a16_0x2b50cb(0xf4);['description']=a16_0x2b50cb(0xef);async['execute'](_0x18f2f6){const _0x272cc7=a16_0x2b50cb;try{const _0x236256=await readStdinJson();if(!_0x236256?.[_0x272cc7(0x103)])return console['log'](_0x272cc7(0x10d)),0x0;const _0x308612=_0x236256[_0x272cc7(0x103)],_0x23b4f0=_0x236256[_0x272cc7(0x106)]?.['id']||'',_0x42a818=_0x236256['profile']||_0x18f2f6[_0x272cc7(0xf7)]['profile'],_0x3dd6ef=await getUsageStats(_0x308612,_0x42a818),_0xed0683=[],_0x4b7106=_0x23b4f0?getModelDisplayName(_0x23b4f0):_0x272cc7(0xf5);_0xed0683[_0x272cc7(0x100)](_0x272cc7(0xfe)+_0x4b7106);const _0xb8f77a=formatCredits(_0x3dd6ef[_0x272cc7(0x10b)]),_0x3f99fe=formatCredits(_0x3dd6ef['todayCredits']),_0x454fe9=formatCredits(_0x3dd6ef[_0x272cc7(0xf9)]);_0xed0683['push'](_0x272cc7(0x10c)+_0xb8f77a+'\x20session\x20/\x20'+_0x3f99fe+_0x272cc7(0xf8)+_0x454fe9+_0x272cc7(0x105));if(_0x3dd6ef[_0x272cc7(0xfc)]>0x0&&_0x23b4f0){const _0x13b62a=formatTokenCount(_0x3dd6ef[_0x272cc7(0xfc)]),_0x444cca=calculateContextPercentage(_0x3dd6ef[_0x272cc7(0xfc)],_0x23b4f0);_0xed0683[_0x272cc7(0x100)](_0x272cc7(0x10a)+_0x13b62a+'\x20('+_0x444cca+'%)');}return console[_0x272cc7(0xff)](_0xed0683[_0x272cc7(0x104)](_0x272cc7(0xfd))),0x0;}catch{return console['log']('🤖\x20tdx\x20-\x20Claude'),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a17_0x1d7c(_0x608dd1,_0x280475){const _0x29d1fa=a17_0x29d1();return a17_0x1d7c=function(_0x1d7c8e,_0x30777c){_0x1d7c8e=_0x1d7c8e-0x10b;let _0x349e28=_0x29d1fa[_0x1d7c8e];return _0x349e28;},a17_0x1d7c(_0x608dd1,_0x280475);}const a17_0x5e1fff=a17_0x1d7c;(function(_0x1ad809,_0x2768de){const _0x58f039=a17_0x1d7c,_0x14a0d2=_0x1ad809();while(!![]){try{const _0xf82baa=parseInt(_0x58f039(0x10c))/0x1*(parseInt(_0x58f039(0x119))/0x2)+-parseInt(_0x58f039(0x12e))/0x3*(parseInt(_0x58f039(0x125))/0x4)+-parseInt(_0x58f039(0x128))/0x5*(parseInt(_0x58f039(0x110))/0x6)+parseInt(_0x58f039(0x130))/0x7*(parseInt(_0x58f039(0x120))/0x8)+-parseInt(_0x58f039(0x12f))/0x9+-parseInt(_0x58f039(0x11a))/0xa*(parseInt(_0x58f039(0x141))/0xb)+-parseInt(_0x58f039(0x129))/0xc*(-parseInt(_0x58f039(0x13c))/0xd);if(_0xf82baa===_0x2768de)break;else _0x14a0d2['push'](_0x14a0d2['shift']());}catch(_0x20af00){_0x14a0d2['push'](_0x14a0d2['shift']());}}}(a17_0x29d1,0xadfd8));import a17_0x4e3fcf from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x30dcb5){const _0x5447c9=a17_0x1d7c;return _0x30dcb5[_0x5447c9(0x12d)](0x2);}function a17_0x29d1(){const _0x1efffd=['execute','cyan','entryCount','profileCount','1RrnGaH','padStart','message','log','106332PYvVQR','map','Error:\x20','toLocaleTimeString','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','never','\x20\x20Today:\x20\x20\x20','Requests','Usage\x20by\x20Profile','1889042nnTayn','94310RFglDD','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','bold','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','format','jsonl','570320oYjowr','padEnd','(default)','outputStructured','dim','92vkhKnl','all','today\x20','145NjbUzC','1344hZXskY','\x20credits','repeat','\x20days\x20ago','toFixed','11940ZOPTQr','11566134ZhPcwa','7OCEGna','\x20\x20Total:\x20\x20\x20','totalCredits','round','description','en-CA','en-US','monthCredits','lastUsedAt','2-digit','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','toLocaleDateString','281684MpKqBm','yesterday','\x20\x20Month:\x20\x20\x20','max','outputTable','979ZWhrmp','json','Unknown\x20error','numeric','profile','Last\x20Used','length','todayCredits','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','default','credits','error'];a17_0x29d1=function(){return _0x1efffd;};return a17_0x29d1();}function formatLastUsed(_0x2bf58e){const _0x33cd5f=a17_0x1d7c;if(!_0x2bf58e)return _0x33cd5f(0x115);const _0x405d0f=new Date(_0x2bf58e),_0x3c5b70=new Date(),_0xf4b598=_0x405d0f['toLocaleDateString'](_0x33cd5f(0x135)),_0x159e78=_0x3c5b70[_0x33cd5f(0x13b)](_0x33cd5f(0x135));if(_0xf4b598===_0x159e78)return _0x33cd5f(0x127)+_0x405d0f[_0x33cd5f(0x113)](_0x33cd5f(0x136),{'hour':'2-digit','minute':_0x33cd5f(0x139)});const _0x15cd5c=new Date(_0xf4b598),_0x3e4de3=new Date(_0x159e78),_0x245132=Math[_0x33cd5f(0x133)]((_0x3e4de3['getTime']()-_0x15cd5c['getTime']())/(0x18*0x3c*0x3c*0x3e8));if(_0x245132===0x1)return _0x33cd5f(0x13d);else return _0x245132>0x1&&_0x245132<0x7?_0x245132+_0x33cd5f(0x12c):_0x405d0f[_0x33cd5f(0x13b)](_0x33cd5f(0x136),{'month':'short','day':_0x33cd5f(0x144)});}export class ClaudeUsageCommand extends BaseCommand{['name']='usage';[a17_0x5e1fff(0x134)]=a17_0x5e1fff(0x149);async[a17_0x5e1fff(0x14d)](_0x2bb7da){const _0x55b9f1=a17_0x5e1fff,{options:_0xd1647e}=_0x2bb7da,_0x3a50e2=_0xd1647e['format']===_0x55b9f1(0x142)||_0xd1647e[_0x55b9f1(0x11e)]===_0x55b9f1(0x11f)||_0xd1647e[_0x55b9f1(0x142)];try{const [_0xc26672,_0x4760d7]=await Promise[_0x55b9f1(0x126)]([getAllProfileStats(),getUsageSummary()]);return _0x3a50e2?await this[_0x55b9f1(0x123)](_0xc26672,_0x4760d7,_0xd1647e):this[_0x55b9f1(0x140)](_0xc26672,_0x4760d7),0x0;}catch(_0x3aa912){const _0x5bb672=_0x3aa912 instanceof Error?_0x3aa912[_0x55b9f1(0x10e)]:_0x55b9f1(0x143);return console[_0x55b9f1(0x14c)](a17_0x4e3fcf['red'](_0x55b9f1(0x112)+_0x5bb672)),0x1;}}async[a17_0x5e1fff(0x123)](_0x42d886,_0x2f4440,_0x1a59da){const _0x2a079c=a17_0x5e1fff,_0x34a3d7={'summary':{'todayCredits':_0x2f4440['todayCredits'],'monthCredits':_0x2f4440[_0x2a079c(0x137)],'totalCredits':_0x2f4440[_0x2a079c(0x132)],'profileCount':_0x2f4440[_0x2a079c(0x10b)]},'profiles':_0x42d886[_0x2a079c(0x111)](_0x46c641=>({'profile':_0x46c641['profile'],'credits':_0x46c641[_0x2a079c(0x14b)],'requests':_0x46c641['entryCount'],'lastUsedAt':_0x46c641['lastUsedAt']}))};await handleSDKOutput([_0x34a3d7],_0x1a59da);}[a17_0x5e1fff(0x140)](_0x1ae2ee,_0x668d1a){const _0x59ffcb=a17_0x5e1fff;console[_0x59ffcb(0x10f)](a17_0x4e3fcf[_0x59ffcb(0x11c)](_0x59ffcb(0x13a))),console['log'](a17_0x4e3fcf[_0x59ffcb(0x124)]('─'[_0x59ffcb(0x12b)](0x32))),console[_0x59ffcb(0x10f)](_0x59ffcb(0x116)+a17_0x4e3fcf[_0x59ffcb(0x14e)](formatCredits(_0x668d1a[_0x59ffcb(0x148)]))+_0x59ffcb(0x12a)),console[_0x59ffcb(0x10f)](_0x59ffcb(0x13e)+a17_0x4e3fcf['cyan'](formatCredits(_0x668d1a[_0x59ffcb(0x137)]))+'\x20credits'),console[_0x59ffcb(0x10f)](_0x59ffcb(0x131)+a17_0x4e3fcf[_0x59ffcb(0x14e)](formatCredits(_0x668d1a[_0x59ffcb(0x132)]))+_0x59ffcb(0x12a)),console[_0x59ffcb(0x10f)]();if(_0x1ae2ee[_0x59ffcb(0x147)]===0x0){console[_0x59ffcb(0x10f)](a17_0x4e3fcf[_0x59ffcb(0x124)](_0x59ffcb(0x11d))),console[_0x59ffcb(0x10f)](a17_0x4e3fcf[_0x59ffcb(0x124)](_0x59ffcb(0x114)));return;}console[_0x59ffcb(0x10f)](a17_0x4e3fcf[_0x59ffcb(0x11c)](_0x59ffcb(0x118))),console['log'](a17_0x4e3fcf[_0x59ffcb(0x124)]('─'['repeat'](0x3c)));const _0x2e0760=Math[_0x59ffcb(0x13f)](0xc,..._0x1ae2ee[_0x59ffcb(0x111)](_0x1d738a=>_0x1d738a['profile']===_0x59ffcb(0x14a)?'(default)'[_0x59ffcb(0x147)]:_0x1d738a['profile'][_0x59ffcb(0x147)])),_0x2aec7f=0xa,_0x1e8d52=0xa;console[_0x59ffcb(0x10f)]('\x20\x20'+'Profile'['padEnd'](_0x2e0760)+'\x20\x20'+'Credits'['padStart'](_0x2aec7f)+'\x20\x20'+_0x59ffcb(0x117)[_0x59ffcb(0x10d)](_0x1e8d52)+'\x20\x20'+_0x59ffcb(0x146));for(const _0x18ffe0 of _0x1ae2ee){const _0x14e8e6=_0x18ffe0[_0x59ffcb(0x145)]==='default'?_0x59ffcb(0x122):_0x18ffe0[_0x59ffcb(0x145)],_0x5f27a1=_0x14e8e6[_0x59ffcb(0x121)](_0x2e0760),_0x583d33=_0x18ffe0['profile']===_0x59ffcb(0x14a)?a17_0x4e3fcf[_0x59ffcb(0x124)](_0x5f27a1):_0x5f27a1;console[_0x59ffcb(0x10f)]('\x20\x20'+_0x583d33+'\x20\x20'+a17_0x4e3fcf['cyan'](formatCredits(_0x18ffe0[_0x59ffcb(0x14b)])[_0x59ffcb(0x10d)](_0x2aec7f))+'\x20\x20'+String(_0x18ffe0[_0x59ffcb(0x14f)])['padStart'](_0x1e8d52)+'\x20\x20'+a17_0x4e3fcf['dim'](formatLastUsed(_0x18ffe0[_0x59ffcb(0x138)])));}console[_0x59ffcb(0x10f)](),console[_0x59ffcb(0x10f)](a17_0x4e3fcf[_0x59ffcb(0x124)](_0x59ffcb(0x11b))),console[_0x59ffcb(0x10f)]();}}
|
package/dist/commands/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a18_0x2e7b68=a18_0x2ee0;function a18_0x2ee0(_0x20797b,_0xc49ed5){const _0x2fda4f=a18_0x2fda();return a18_0x2ee0=function(_0x2ee091,_0x38219e){_0x2ee091=_0x2ee091-0x118;let _0x1d5c9d=_0x2fda4f[_0x2ee091];return _0x1d5c9d;},a18_0x2ee0(_0x20797b,_0xc49ed5);}(function(_0x49a8bf,_0x26b31f){const _0x2ec457=a18_0x2ee0,_0x2d3477=_0x49a8bf();while(!![]){try{const _0x3262c6=parseInt(_0x2ec457(0x133))/0x1+-parseInt(_0x2ec457(0x141))/0x2*(-parseInt(_0x2ec457(0x11d))/0x3)+-parseInt(_0x2ec457(0x13b))/0x4+parseInt(_0x2ec457(0x131))/0x5*(parseInt(_0x2ec457(0x125))/0x6)+-parseInt(_0x2ec457(0x147))/0x7+parseInt(_0x2ec457(0x121))/0x8+parseInt(_0x2ec457(0x128))/0x9*(-parseInt(_0x2ec457(0x126))/0xa);if(_0x3262c6===_0x26b31f)break;else _0x2d3477['push'](_0x2d3477['shift']());}catch(_0x562a7a){_0x2d3477['push'](_0x2d3477['shift']());}}}(a18_0x2fda,0x2e72b));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';import a18_0x38b6ce from'chalk';function a18_0x2fda(){const _0x5df1f3=['Authentication\x20failed','has','error','number','red','To\x20check\x20your\x20current\x20auth\x20status:','limit','logger','.\x20Must\x20be\x20a\x20number.','124827IBcolZ','name','\x20\x20tdx\x20auth\x20setup','get','627688wDoGPv','validate','Error:\x20','\x0aTo\x20set\x20up\x20authentication:','14910yBNEUL','1998290sCjeuc','profile','9XuxvCo','execute','run','value','commands','\x20--profile\x20','\x0aStack\x20trace:\x0a','message','tdx','505zwMxZo','register','373491jVsnZR','set','debug','category','yellow','validateGlobalOptions','stack','values','793228CBCUil','Reason:\x20','USER_ERROR','\x27\x20is\x20already\x20registered','Authentication\x20error\x20stack\x20trace:','\x20\x20tdx\x20auth','2HfFQGF','helpText','problemDetails','Command\x20\x27','detail','getAll','1093113PecHyj','options'];a18_0x2fda=function(){return _0x5df1f3;};return a18_0x2fda();}export function printAuthError(_0x22fbb2,_0x21a985=![],_0x290e49){const _0x5762c4=a18_0x2ee0,_0x5d272f=_0x22fbb2[_0x5762c4(0x143)]?.[_0x5762c4(0x145)]||_0x22fbb2[_0x5762c4(0x12f)];console[_0x5762c4(0x14b)](a18_0x38b6ce[_0x5762c4(0x118)](_0x5762c4(0x149))),console[_0x5762c4(0x14b)](a18_0x38b6ce[_0x5762c4(0x118)](_0x5762c4(0x13c)+_0x5d272f));if(_0x21a985){const _0x5b0d43=_0x290e49?_0x5762c4(0x12d)+_0x290e49:'';console[_0x5762c4(0x14b)](_0x5762c4(0x124)),console[_0x5762c4(0x14b)](_0x5762c4(0x11f)+_0x5b0d43+'\x0a'),console[_0x5762c4(0x14b)](_0x5762c4(0x119)),console[_0x5762c4(0x14b)](_0x5762c4(0x140)+_0x5b0d43);}}export class BaseCommand{[a18_0x2e7b68(0x138)](_0x1ff3a8){const _0x4e568b=a18_0x2e7b68,{options:_0x383165}=_0x1ff3a8,_0x48675e=_0x383165[_0x4e568b(0x11a)];if(_0x48675e!==undefined){const _0x47f3ce=typeof _0x48675e===_0x4e568b(0x14c)?_0x48675e:parseInt(_0x48675e,0xa);if(isNaN(_0x47f3ce))return'Invalid\x20limit\x20value:\x20'+_0x48675e+_0x4e568b(0x11c);const _0x165a6e=validateLimitOption(_0x47f3ce);if(!_0x165a6e['isValid'])return _0x165a6e[_0x4e568b(0x14b)];_0x1ff3a8[_0x4e568b(0x148)][_0x4e568b(0x11a)]=_0x165a6e[_0x4e568b(0x12b)];}return undefined;}[a18_0x2e7b68(0x122)](_0x3d0d3b){return undefined;}async[a18_0x2e7b68(0x12a)](_0x529c02){const _0x7e8693=a18_0x2e7b68;try{const _0x34099c=this[_0x7e8693(0x138)](_0x529c02);if(_0x34099c)return console[_0x7e8693(0x14b)]('Error:\x20'+_0x34099c),0x1;const _0x41dcf6=this[_0x7e8693(0x122)](_0x529c02);if(_0x41dcf6){const _0x27e104=/^\s*(Usage|Note|Warning|Error):/i['test'](_0x41dcf6);return _0x27e104?console[_0x7e8693(0x14b)](_0x41dcf6):console['error'](_0x7e8693(0x123)+_0x41dcf6),0x1;}const _0xa09ad9=await this[_0x7e8693(0x129)](_0x529c02);return _0xa09ad9??0x0;}catch(_0x3055ac){if(_0x3055ac instanceof Error){if(_0x3055ac instanceof HTTPClientError&&_0x3055ac['status']===0x191){const _0x1bcc7c=_0x529c02[_0x7e8693(0x148)][_0x7e8693(0x127)];return printAuthError(_0x3055ac,!![],_0x1bcc7c),_0x3055ac[_0x7e8693(0x139)]&&_0x529c02[_0x7e8693(0x130)]&&(_0x529c02[_0x7e8693(0x130)][_0x7e8693(0x11b)][_0x7e8693(0x135)](_0x7e8693(0x13f)),_0x529c02[_0x7e8693(0x130)][_0x7e8693(0x11b)][_0x7e8693(0x135)](_0x3055ac[_0x7e8693(0x139)])),0x1;}console[_0x7e8693(0x14b)](a18_0x38b6ce[_0x7e8693(0x118)]('Error:\x20'+_0x3055ac['message']));_0x3055ac instanceof SDKError&&_0x3055ac[_0x7e8693(0x142)]&&console['error'](a18_0x38b6ce[_0x7e8693(0x137)](_0x3055ac[_0x7e8693(0x142)]));const _0x4eaf61=_0x3055ac instanceof SDKError&&_0x3055ac[_0x7e8693(0x136)]===ErrorCategory[_0x7e8693(0x13d)];_0x3055ac['stack']&&!_0x4eaf61&&console[_0x7e8693(0x14b)](_0x7e8693(0x12e)+_0x3055ac[_0x7e8693(0x139)]);}else console['error'](_0x7e8693(0x123)+String(_0x3055ac));return 0x1;}}}export class CommandRegistry{[a18_0x2e7b68(0x12c)]=new Map();[a18_0x2e7b68(0x132)](_0x156ece){const _0x538c4b=a18_0x2e7b68;if(this[_0x538c4b(0x12c)][_0x538c4b(0x14a)](_0x156ece[_0x538c4b(0x11e)]))throw new Error(_0x538c4b(0x144)+_0x156ece[_0x538c4b(0x11e)]+_0x538c4b(0x13e));this[_0x538c4b(0x12c)][_0x538c4b(0x134)](_0x156ece[_0x538c4b(0x11e)],_0x156ece);}['get'](_0x4a9dfe){const _0x5133fb=a18_0x2e7b68;return this[_0x5133fb(0x12c)][_0x5133fb(0x120)](_0x4a9dfe);}[a18_0x2e7b68(0x146)](){const _0x228779=a18_0x2e7b68;return Array['from'](this[_0x228779(0x12c)][_0x228779(0x13a)]());}[a18_0x2e7b68(0x14a)](_0x18b86f){const _0x2506c0=a18_0x2e7b68;return this[_0x2506c0(0x12c)][_0x2506c0(0x14a)](_0x18b86f);}}export const registry=new CommandRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a19_0x3a8b4c=a19_0x4b6d;function a19_0x298a(){const _0x397471=['11080CiGFuh','Error:\x20','warn','16241920LSmdHB','4282803qWCaYd','context','2038532vUBfxp','clear','3528szrSPW','message','5yVeEYL','session','error','displayWithSources','yellow','display','73936RpedcT','581AWflWK','Session\x20context\x20cleared\x20(session:\x20','debug','13746LlauNn','49195047dNuXXh','toString','execute','\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context','7oVAAJN','log'];a19_0x298a=function(){return _0x397471;};return a19_0x298a();}function a19_0x4b6d(_0x178262,_0x19fb8d){const _0x298a67=a19_0x298a();return a19_0x4b6d=function(_0x4b6dc2,_0x56e59d){_0x4b6dc2=_0x4b6dc2-0x118;let _0x122ae8=_0x298a67[_0x4b6dc2];return _0x122ae8;},a19_0x4b6d(_0x178262,_0x19fb8d);}(function(_0x27f1b7,_0x266a40){const _0x42aa70=a19_0x4b6d,_0x505f9b=_0x27f1b7();while(!![]){try{const _0x3a1866=parseInt(_0x42aa70(0x124))/0x1*(parseInt(_0x42aa70(0x11b))/0x2)+-parseInt(_0x42aa70(0x12a))/0x3+parseInt(_0x42aa70(0x12c))/0x4*(-parseInt(_0x42aa70(0x130))/0x5)+parseInt(_0x42aa70(0x11f))/0x6*(parseInt(_0x42aa70(0x11c))/0x7)+-parseInt(_0x42aa70(0x126))/0x8*(parseInt(_0x42aa70(0x12e))/0x9)+-parseInt(_0x42aa70(0x129))/0xa+parseInt(_0x42aa70(0x120))/0xb;if(_0x3a1866===_0x266a40)break;else _0x505f9b['push'](_0x505f9b['shift']());}catch(_0x1c945a){_0x505f9b['push'](_0x505f9b['shift']());}}}(a19_0x298a,0xc76dc));import{BaseCommand}from'./command.js';import{GlobalContext}from'../core/global-context.js';import{cleanExpiredSessions,clearSessionContext,getCurrentSessionPID}from'../core/session.js';import a19_0x587f09 from'chalk';export class ContextCommand extends BaseCommand{['name']=a19_0x3a8b4c(0x12b);['description']='Show\x20current\x20resolved\x20context';async[a19_0x3a8b4c(0x122)](_0x48c12b){const _0x2a8ab7=a19_0x3a8b4c,{options:_0x108385}=_0x48c12b,_0x427be0=_0x108385[_0x2a8ab7(0x11e)],_0x54b461=_0x108385[_0x2a8ab7(0x12d)];console[_0x2a8ab7(0x128)](a19_0x587f09['yellow']('Warning:\x20\x27tdx\x20context\x27\x20is\x20deprecated.\x20Use\x20\x27tdx\x20use\x27\x20instead.')),console['warn'](a19_0x587f09[_0x2a8ab7(0x119)](_0x2a8ab7(0x123))),console[_0x2a8ab7(0x128)](a19_0x587f09[_0x2a8ab7(0x119)]('\x20\x20tdx\x20use\x20--clear\x20\x20\x20#\x20Clear\x20session\x20context\x0a')),cleanExpiredSessions();try{if(_0x54b461){clearSessionContext(_0x108385[_0x2a8ab7(0x131)]);const _0xa5f5a0=_0x108385[_0x2a8ab7(0x131)]||getCurrentSessionPID()[_0x2a8ab7(0x121)]();return console[_0x2a8ab7(0x125)](_0x2a8ab7(0x11d)+_0xa5f5a0+')'),0x0;}const _0x240d17=new GlobalContext(_0x108385);return _0x427be0?_0x240d17[_0x2a8ab7(0x118)]():_0x240d17[_0x2a8ab7(0x11a)](),0x0;}catch(_0x2af4aa){return _0x2af4aa instanceof Error&&console[_0x2a8ab7(0x132)](_0x2a8ab7(0x127)+_0x2af4aa[_0x2a8ab7(0x12f)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a20_0x157b50=a20_0x4762;(function(_0x3f2ef0,_0x48ded6){const _0x33a25d=a20_0x4762,_0x418a1a=_0x3f2ef0();while(!![]){try{const _0x5dd7d0=parseInt(_0x33a25d(0xa7))/0x1*(-parseInt(_0x33a25d(0xa9))/0x2)+-parseInt(_0x33a25d(0xac))/0x3+parseInt(_0x33a25d(0xb5))/0x4+-parseInt(_0x33a25d(0xaf))/0x5*(-parseInt(_0x33a25d(0xba))/0x6)+parseInt(_0x33a25d(0xb2))/0x7*(parseInt(_0x33a25d(0xaa))/0x8)+parseInt(_0x33a25d(0xbc))/0x9*(parseInt(_0x33a25d(0xb4))/0xa)+parseInt(_0x33a25d(0xbb))/0xb*(parseInt(_0x33a25d(0xbd))/0xc);if(_0x5dd7d0===_0x48ded6)break;else _0x418a1a['push'](_0x418a1a['shift']());}catch(_0x1a0944){_0x418a1a['push'](_0x418a1a['shift']());}}}(a20_0x4715,0xaa6c8));import{BaseCommand}from'./command.js';function a20_0x4762(_0x19fede,_0x148101){const _0x471535=a20_0x4715();return a20_0x4762=function(_0x47620d,_0x5ab6ea){_0x47620d=_0x47620d-0xa3;let _0x5c6af7=_0x471535[_0x47620d];return _0x5c6af7;},a20_0x4762(_0x19fede,_0x148101);}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a20_0x4715(){const _0x104274=['94885mhhwQB','data','60790xrXGzj','1733984OPjvJj','description','\x20\x20Cause:\x20','length','execute','1936458CHMifL','10193304OWssVL','531yCotby','12KWuTiM','\x20database','Site:\x20','error','query','Pattern:\x20','message','134522TkvNkD','site','10yCUSuL','136nVmiMP','cause','2703999QOzEVk','listDatabases','List\x20all\x20databases','5ABGxca','verbose','✔\x20Found\x20'];a20_0x4715=function(){return _0x104274;};return a20_0x4715();}import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';export class DatabasesCommand extends BaseCommand{['name']='databases';[a20_0x157b50(0xb6)]=a20_0x157b50(0xae);async[a20_0x157b50(0xb9)](_0x27fdf3){const _0x952113=a20_0x157b50,{options:_0x3544e0,args:_0x7f3cf9,tdx:_0x11ea14}=_0x27fdf3,_0x52b743=_0x7f3cf9[0x0];try{_0x3544e0[_0x952113(0xb0)]&&(console[_0x952113(0xa3)](_0x952113(0xbf)+_0x3544e0[_0x952113(0xa8)]),_0x52b743&&console[_0x952113(0xa3)](_0x952113(0xa5)+_0x52b743));const _0x19a1a1=resolveLimit(_0x3544e0['limit'],DEFAULT_LISTING_LIMIT),_0x3cc716=await withSpinner('Listing\x20databases...',()=>_0x11ea14[_0x952113(0xa4)][_0x952113(0xad)](_0x52b743,_0x19a1a1),{'verbose':_0x3544e0[_0x952113(0xb0)]}),_0x36b562=_0x3cc716[_0x952113(0xb3)];return console[_0x952113(0xa3)](_0x952113(0xb1)+_0x36b562['length']+_0x952113(0xbe)+(_0x36b562[_0x952113(0xb8)]!==0x1?'s':'')),await handleSDKOutput(_0x36b562,{..._0x3544e0,'limit':_0x19a1a1}),0x0;}catch(_0x27089e){if(_0x27089e instanceof SDKError)return console['error']('Error:\x20'+_0x27089e[_0x952113(0xa6)]),_0x27089e[_0x952113(0xab)]&&console['error'](_0x952113(0xb7)+_0x27089e[_0x952113(0xab)]),0x1;throw _0x27089e;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a21_0x4070(){const _0x3a79c3=['message','22Ppddvl','data','\x20column','5893lMVqme','args','12fjkymx','✖\x20Table\x20not\x20found','query','verbose','\x27\x20does\x20not\x20exist','cause','...','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','error','Site:\x20','442072TpQVRa','5381299dlDXnE','site','name','5049GLRHXa','✔\x20Found\x20','Describe\x20table\x20schema','Database:\x20','1928570DjkkUW','execute','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','148NCXFZG','describe','Error:\x20','database','26930jdAxLO','Table:\x20','describeTable','Table\x20\x27','142mtxiIg','length','657gtzpbq','1252812OaukBv'];a21_0x4070=function(){return _0x3a79c3;};return a21_0x4070();}const a21_0x47b193=a21_0x529c;(function(_0x656690,_0xf756fc){const _0x3c9b56=a21_0x529c,_0x6010df=_0x656690();while(!![]){try{const _0x50b01d=parseInt(_0x3c9b56(0xcc))/0x1*(parseInt(_0x3c9b56(0xc4))/0x2)+parseInt(_0x3c9b56(0xb5))/0x3*(parseInt(_0x3c9b56(0xbc))/0x4)+parseInt(_0x3c9b56(0xb9))/0x5*(parseInt(_0x3c9b56(0xce))/0x6)+-parseInt(_0x3c9b56(0xb2))/0x7+-parseInt(_0x3c9b56(0xb1))/0x8+parseInt(_0x3c9b56(0xc6))/0x9*(parseInt(_0x3c9b56(0xc0))/0xa)+-parseInt(_0x3c9b56(0xc9))/0xb*(parseInt(_0x3c9b56(0xc7))/0xc);if(_0x50b01d===_0xf756fc)break;else _0x6010df['push'](_0x6010df['shift']());}catch(_0x15e94c){_0x6010df['push'](_0x6010df['shift']());}}}(a21_0x4070,0x65881));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';function a21_0x529c(_0x3af0f6,_0x51127d){const _0x407096=a21_0x4070();return a21_0x529c=function(_0x529c2f,_0x1cd21d){_0x529c2f=_0x529c2f-0xad;let _0x47b4f1=_0x407096[_0x529c2f];return _0x47b4f1;},a21_0x529c(_0x3af0f6,_0x51127d);}import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a21_0x47b193(0xb4)]=a21_0x47b193(0xbd);['description']=a21_0x47b193(0xb7);async[a21_0x47b193(0xba)](_0x5d4080){const _0x100b82=a21_0x47b193;return this[_0x100b82(0xc2)](_0x5d4080);}async[a21_0x47b193(0xc2)](_0x290a2b){const _0x4fd4e3=a21_0x47b193,{options:_0x5dad03,args:_0x316bc5,tdx:_0x5d0fe6}=_0x290a2b;let _0x4009be;try{_0x4009be=parseTableReference(_0x316bc5[0x0]);const _0x39c595=_0x5dad03[_0x4fd4e3(0xbf)];!_0x4009be['database']&&_0x39c595&&(_0x4009be[_0x4fd4e3(0xbf)]=_0x39c595);const _0xb05896=validateTableDescribeReference(_0x4009be);if(_0xb05896)return console[_0x4fd4e3(0xaf)](_0x4fd4e3(0xbe)+_0xb05896),0x1;}catch(_0x35336a){return console[_0x4fd4e3(0xaf)](_0x4fd4e3(0xbe)+_0x35336a[_0x4fd4e3(0xc8)]),0x1;}const _0x10fb72=_0x4009be[_0x4fd4e3(0xbf)],_0x21ccbe=_0x4009be['table'];try{_0x5dad03[_0x4fd4e3(0xd1)]&&(console[_0x4fd4e3(0xaf)](_0x4fd4e3(0xb0)+_0x5dad03[_0x4fd4e3(0xb3)]),console[_0x4fd4e3(0xaf)](_0x4fd4e3(0xb8)+_0x10fb72),console['error'](_0x4fd4e3(0xc1)+_0x21ccbe));const _0x32407e=await withSpinner('Describing\x20table\x20'+_0x10fb72+'.'+_0x21ccbe+_0x4fd4e3(0xad),()=>_0x5d0fe6[_0x4fd4e3(0xd0)][_0x4fd4e3(0xc2)](_0x10fb72,_0x21ccbe),{'verbose':_0x5dad03[_0x4fd4e3(0xd1)]}),_0x20fc01=_0x32407e[_0x4fd4e3(0xca)];if(_0x20fc01[_0x4fd4e3(0xc5)]===0x0)return console['error'](_0x4fd4e3(0xcf)),console[_0x4fd4e3(0xaf)](_0x4fd4e3(0xc3)+_0x10fb72+'.'+_0x21ccbe+_0x4fd4e3(0xd2)),0x1;return console[_0x4fd4e3(0xaf)](_0x4fd4e3(0xb6)+_0x20fc01['length']+_0x4fd4e3(0xcb)+(_0x20fc01[_0x4fd4e3(0xc5)]!==0x1?'s':'')+'\x20in\x20'+_0x10fb72+'.'+_0x21ccbe),await handleSDKOutput(_0x20fc01,_0x5dad03),0x0;}catch(_0x2dbb9b){if(_0x2dbb9b instanceof SDKError)return console['error'](_0x4fd4e3(0xbe)+_0x2dbb9b[_0x4fd4e3(0xc8)]),_0x2dbb9b[_0x4fd4e3(0xd3)]&&console[_0x4fd4e3(0xaf)]('\x20\x20Cause:\x20'+_0x2dbb9b['cause']),0x1;throw _0x2dbb9b;}}['validate'](_0x8e3169){const _0x21201b=a21_0x47b193;if(_0x8e3169[_0x21201b(0xcd)]['length']===0x0)return _0x21201b(0xae);if(_0x8e3169['args']['length']>0x1)return _0x21201b(0xbb);return undefined;}}
|