@treasuredata/tdx 0.9.7 → 0.9.8
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/agent-command.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/connection-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/journey-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-pull-command.js +1 -1
- package/dist/commands/segment-push-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/user-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/connection-cache.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/core/user-cache.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/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.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/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts +36 -7
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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/user.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-config.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.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/journey-utils.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-config.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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a10_0x3b4d52=a10_0x3367;function a10_0x2a43(){const _0x55c5e6=['listAttempts','2576355BJrVlv','/api/workflows','task','sessionTime','retryAttemptName','last_id','status','/api/logs/','/api/projects?','request','GET','3980165cASYJv','project_name','limit','params','name','toString','to_time','append','/api/sessions','workflow','uploadProjectArchive','/files','name_pattern','project_id','from_time','httpClient','projectName','allowQueueing','projects','search_project_name','/sessions','POST','clearSchedule','/logs','lastId','48zJLNiF','retryAttempt','/archive?','deleteProject','/tasks','listSessions','listLogFiles','/archive','true','808800AuUXmC','filter','10bCYIAe','142142zjjWlc','/tasks/','from_task','schedule_from','listProjects','startAttempt','getAttempt','authHeaders','clear_schedule','/api/attempts','killAttempt','include_retried','PUT','readFile','/api/workflows?','clear_schedule_all','application/gzip','/api/attempts/','sessions','offset','tasks','getAttemptTasks','/api/sessions/','logs','837456hVqOEx','/files?','files','workflowName','retry_params','downloadProjectArchive','revision','force','/api/projects/','retrySession','/logs?','listWorkflows','replace','reason','/tasks?','include_subtasks','scheduleFrom','clearScheduleAll','2118476pINAuW','writeFile','workflowId','resume_from','/retry','1618524NvQipz','project','workflow_name','/api/projects','attempts'];a10_0x2a43=function(){return _0x55c5e6;};return a10_0x2a43();}(function(_0x5522dd,_0x269f29){const _0x219d0b=a10_0x3367,_0x594612=_0x5522dd();while(!![]){try{const _0x5228c2=parseInt(_0x219d0b(0x127))/0x1*(-parseInt(_0x219d0b(0x126))/0x2)+parseInt(_0x219d0b(0xf7))/0x3+-parseInt(_0x219d0b(0x151))/0x4+parseInt(_0x219d0b(0x124))/0x5+parseInt(_0x219d0b(0x13f))/0x6+-parseInt(_0x219d0b(0x102))/0x7+parseInt(_0x219d0b(0x11b))/0x8*(parseInt(_0x219d0b(0xf1))/0x9);if(_0x5228c2===_0x269f29)break;else _0x594612['push'](_0x594612['shift']());}catch(_0x43da33){_0x594612['push'](_0x594612['shift']());}}}(a10_0x2a43,0x69085));import{HTTPClient}from'./http-client.js';function a10_0x3367(_0x18e762,_0x12dc89){_0x18e762=_0x18e762-0xef;const _0x2a439d=a10_0x2a43();let _0x336764=_0x2a439d[_0x18e762];return _0x336764;}import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{[a10_0x3b4d52(0x111)];['authHeaders'];constructor(_0x8ecf3d,_0x22f6ff){const _0x3e4f24=a10_0x3b4d52,_0x4ec65d=getEndpoint(_0x8ecf3d['site'],_0x3e4f24(0x10b));this[_0x3e4f24(0x12e)]=toHeaderRecord(getAuthHeaders(_0x8ecf3d['site'],_0x8ecf3d['apiKey'])),this[_0x3e4f24(0x111)]=new HTTPClient(_0x4ec65d,this['authHeaders'],_0x22f6ff);}async[a10_0x3b4d52(0x12b)](_0x6d05d5){const _0x35c22=a10_0x3b4d52,_0x3525a9=new URLSearchParams();if(_0x6d05d5?.['limit'])_0x3525a9[_0x35c22(0x109)](_0x35c22(0x104),String(_0x6d05d5[_0x35c22(0x104)]));if(_0x6d05d5?.[_0x35c22(0xfc)])_0x3525a9[_0x35c22(0x109)](_0x35c22(0xfc),_0x6d05d5['last_id']);if(_0x6d05d5?.[_0x35c22(0x10e)]){const _0x16850f=_0x6d05d5[_0x35c22(0x10e)][_0x35c22(0x14b)](/[*?]/g,'');_0x16850f&&_0x3525a9[_0x35c22(0x109)](_0x35c22(0x10e),_0x16850f);}const _0x5d5f19=_0x3525a9['toString'](),_0x1e9c64=_0x5d5f19?_0x35c22(0xff)+_0x5d5f19:_0x35c22(0xf4),_0x3a81df=await this[_0x35c22(0x111)]['request'](_0x35c22(0x101),_0x1e9c64);let _0x1c980c=_0x3a81df[_0x35c22(0x114)]||[];return _0x6d05d5?.[_0x35c22(0x10e)]&&(_0x1c980c=_0x1c980c['filter'](_0x296949=>{const _0x4fca06=_0x35c22;return matchGlobPattern(_0x296949[_0x4fca06(0x106)],_0x6d05d5[_0x4fca06(0x10e)]);})),{'data':_0x1c980c,'lastId':_0x3a81df['lastId']};}async[a10_0x3b4d52(0x14a)](_0x359cbe){const _0x5bb27a=a10_0x3b4d52,_0x539bac=new URLSearchParams();if(_0x359cbe?.['limit'])_0x539bac['append'](_0x5bb27a(0x104),String(_0x359cbe['limit']));if(_0x359cbe?.['last_id'])_0x539bac[_0x5bb27a(0x109)](_0x5bb27a(0xfc),_0x359cbe[_0x5bb27a(0xfc)]);if(_0x359cbe?.[_0x5bb27a(0x103)]){const _0x4f8a29=_0x359cbe[_0x5bb27a(0x103)][_0x5bb27a(0x14b)](/[*?]/g,'');_0x4f8a29&&(_0x539bac['append'](_0x5bb27a(0x10e),_0x4f8a29),_0x539bac[_0x5bb27a(0x109)](_0x5bb27a(0x115),_0x5bb27a(0x123)));}const _0xeb8730=_0x539bac[_0x5bb27a(0x107)](),_0x3fdde7=_0xeb8730?_0x5bb27a(0x135)+_0xeb8730:_0x5bb27a(0xf8),_0x5a7e44=await this[_0x5bb27a(0x111)][_0x5bb27a(0x100)](_0x5bb27a(0x101),_0x3fdde7);let _0x38eee4=_0x5a7e44['workflows']||[];return _0x359cbe?.['project_name']&&(_0x38eee4=_0x38eee4[_0x5bb27a(0x125)](_0x55594d=>{const _0x4f9904=_0x5bb27a,_0x322716=_0x55594d[_0x4f9904(0xf2)]?.[_0x4f9904(0x106)];if(!_0x322716)return![];return matchGlobPattern(_0x322716,_0x359cbe['project_name']);})),{'data':_0x38eee4,'lastId':_0x5a7e44[_0x5bb27a(0x11a)]};}async[a10_0x3b4d52(0x120)](_0x1ba516){const _0x6bc0bf=a10_0x3b4d52;let _0x17542c=_0x6bc0bf(0x10a);_0x1ba516?.[_0x6bc0bf(0x10f)]&&(_0x17542c=_0x6bc0bf(0x147)+encodeURIComponent(_0x1ba516[_0x6bc0bf(0x10f)])+_0x6bc0bf(0x116));const _0x4d9591=new URLSearchParams();if(_0x1ba516?.[_0x6bc0bf(0xf3)])_0x4d9591['append'](_0x6bc0bf(0x10b),_0x1ba516[_0x6bc0bf(0xf3)]);if(_0x1ba516?.[_0x6bc0bf(0xfd)])_0x4d9591[_0x6bc0bf(0x109)](_0x6bc0bf(0xfd),_0x1ba516[_0x6bc0bf(0xfd)]);if(_0x1ba516?.[_0x6bc0bf(0x110)])_0x4d9591[_0x6bc0bf(0x109)]('from_time',_0x1ba516[_0x6bc0bf(0x110)]);if(_0x1ba516?.[_0x6bc0bf(0x108)])_0x4d9591[_0x6bc0bf(0x109)]('to_time',_0x1ba516[_0x6bc0bf(0x108)]);if(_0x1ba516?.[_0x6bc0bf(0x104)])_0x4d9591[_0x6bc0bf(0x109)](_0x6bc0bf(0x104),String(_0x1ba516[_0x6bc0bf(0x104)]));if(_0x1ba516?.[_0x6bc0bf(0xfc)])_0x4d9591[_0x6bc0bf(0x109)](_0x6bc0bf(0xfc),_0x1ba516[_0x6bc0bf(0xfc)]);const _0x183b00=_0x4d9591[_0x6bc0bf(0x107)]();_0x183b00&&(_0x17542c=_0x17542c+'?'+_0x183b00);const _0x2f47c0=await this[_0x6bc0bf(0x111)][_0x6bc0bf(0x100)]('GET',_0x17542c);return{'data':_0x2f47c0[_0x6bc0bf(0x139)]||[],'lastId':_0x2f47c0['lastId']};}async[a10_0x3b4d52(0xf6)](_0x4a8ed4){const _0x351653=a10_0x3b4d52,_0x55daa6=new URLSearchParams();if(_0x4a8ed4?.[_0x351653(0x103)])_0x55daa6[_0x351653(0x109)](_0x351653(0xf2),_0x4a8ed4[_0x351653(0x103)]);if(_0x4a8ed4?.['workflow_name'])_0x55daa6['append']('workflow',_0x4a8ed4['workflow_name']);if(_0x4a8ed4?.[_0x351653(0x132)])_0x55daa6[_0x351653(0x109)]('include_retried','1');if(_0x4a8ed4?.[_0x351653(0x104)])_0x55daa6[_0x351653(0x109)](_0x351653(0x104),String(_0x4a8ed4[_0x351653(0x104)]));if(_0x4a8ed4?.[_0x351653(0xfc)])_0x55daa6['append']('last_id',_0x4a8ed4['last_id']);const _0x415d8f=_0x55daa6[_0x351653(0x107)](),_0x2ee687=_0x415d8f?'/api/attempts?'+_0x415d8f:_0x351653(0x130),_0x20f2b4=await this[_0x351653(0x111)]['request'](_0x351653(0x101),_0x2ee687);return{'data':_0x20f2b4[_0x351653(0xf5)]||[],'lastId':_0x20f2b4[_0x351653(0x11a)]};}async[a10_0x3b4d52(0x12d)](_0x3dbe19){const _0x1dcfdc=a10_0x3b4d52;return await this[_0x1dcfdc(0x111)][_0x1dcfdc(0x100)]('GET',_0x1dcfdc(0x138)+encodeURIComponent(_0x3dbe19));}async[a10_0x3b4d52(0x13c)](_0x3c3591,_0x3675ff=![]){const _0x29a440=a10_0x3b4d52,_0x3a4ae8=new URLSearchParams();_0x3675ff&&_0x3a4ae8[_0x29a440(0x109)](_0x29a440(0x14e),_0x29a440(0x123));const _0x7f0e30=_0x3a4ae8['toString'](),_0x4cf593=_0x7f0e30?_0x29a440(0x138)+encodeURIComponent(_0x3c3591)+_0x29a440(0x14d)+_0x7f0e30:'/api/attempts/'+encodeURIComponent(_0x3c3591)+_0x29a440(0x11f),_0x6d5c70=await this['httpClient']['request'](_0x29a440(0x101),_0x4cf593);return _0x6d5c70[_0x29a440(0x13b)]||[];}async['getTaskLogs'](_0x547945,_0x11d57b,_0xee58c3){const _0x2694b3=a10_0x3b4d52,_0x3ad019=new URLSearchParams();_0xee58c3?.[_0x2694b3(0x13a)]!==undefined&&_0x3ad019[_0x2694b3(0x109)](_0x2694b3(0x13a),String(_0xee58c3[_0x2694b3(0x13a)]));_0xee58c3?.['limit']!==undefined&&_0x3ad019[_0x2694b3(0x109)](_0x2694b3(0x104),String(_0xee58c3[_0x2694b3(0x104)]));const _0x602097=_0x3ad019[_0x2694b3(0x107)](),_0x2859f2=_0x602097?_0x2694b3(0x138)+encodeURIComponent(_0x547945)+_0x2694b3(0x128)+encodeURIComponent(_0x11d57b)+_0x2694b3(0x149)+_0x602097:_0x2694b3(0x138)+encodeURIComponent(_0x547945)+'/tasks/'+encodeURIComponent(_0x11d57b)+_0x2694b3(0x119),_0x4da2ca=await this[_0x2694b3(0x111)][_0x2694b3(0x100)](_0x2694b3(0x101),_0x2859f2);return _0x4da2ca[_0x2694b3(0x13e)]||[];}async[a10_0x3b4d52(0x121)](_0x2aab1f,_0xec5e0f){const _0x319012=a10_0x3b4d52,_0x4fcd60=new URLSearchParams();_0xec5e0f&&_0x4fcd60[_0x319012(0x109)](_0x319012(0xf9),_0xec5e0f);const _0x5eff7e=_0x4fcd60[_0x319012(0x107)](),_0x38059a=_0x5eff7e?_0x319012(0xfe)+encodeURIComponent(_0x2aab1f)+_0x319012(0x140)+_0x5eff7e:_0x319012(0xfe)+encodeURIComponent(_0x2aab1f)+_0x319012(0x10d),_0x58d55d=await this[_0x319012(0x111)][_0x319012(0x100)](_0x319012(0x101),_0x38059a);return _0x58d55d[_0x319012(0x141)]||[];}async[a10_0x3b4d52(0x131)](_0x3d73a9,_0x38110c){const _0x336e3e=a10_0x3b4d52,_0x8807db={};return _0x38110c&&(_0x8807db[_0x336e3e(0x14c)]=_0x38110c),await this[_0x336e3e(0x111)][_0x336e3e(0x100)](_0x336e3e(0x117),_0x336e3e(0x138)+encodeURIComponent(_0x3d73a9)+'/kill',{'body':_0x8807db});}async[a10_0x3b4d52(0x148)](_0x4532ee,_0x1d764a){const _0x25ad23=a10_0x3b4d52,_0x496536={};return _0x1d764a?.[_0x25ad23(0x129)]&&(_0x496536[_0x25ad23(0x129)]=_0x1d764a['from_task']),_0x1d764a?.[_0x25ad23(0x143)]&&(_0x496536[_0x25ad23(0x143)]=_0x1d764a['retry_params']),await this[_0x25ad23(0x111)]['request']('POST',_0x25ad23(0x13d)+encodeURIComponent(_0x4532ee)+_0x25ad23(0xf0),{'body':_0x496536});}async[a10_0x3b4d52(0x11c)](_0x21ec76,_0x3f4605){const _0x40979f=a10_0x3b4d52,_0x31f649={};return _0x3f4605?.[_0x40979f(0xef)]&&(_0x31f649['resume_from']=_0x3f4605['resume_from']),_0x3f4605?.[_0x40979f(0x143)]&&(_0x31f649['retry_params']=_0x3f4605[_0x40979f(0x143)]),_0x3f4605?.['force']&&(_0x31f649[_0x40979f(0x146)]=_0x3f4605[_0x40979f(0x146)]),await this[_0x40979f(0x111)]['request'](_0x40979f(0x117),_0x40979f(0x138)+encodeURIComponent(_0x21ec76)+'/retry',{'body':_0x31f649});}async[a10_0x3b4d52(0x12c)](_0x1b8213){const _0x2e44d0=a10_0x3b4d52,_0x10cbf0={'sessionTime':_0x1b8213[_0x2e44d0(0xfa)],'params':_0x1b8213[_0x2e44d0(0x105)]};return _0x1b8213[_0x2e44d0(0x153)]&&(_0x10cbf0[_0x2e44d0(0x153)]=_0x1b8213[_0x2e44d0(0x153)]),_0x1b8213[_0x2e44d0(0x112)]&&(_0x10cbf0[_0x2e44d0(0x112)]=_0x1b8213[_0x2e44d0(0x112)]),_0x1b8213['workflowName']&&(_0x10cbf0[_0x2e44d0(0x142)]=_0x1b8213[_0x2e44d0(0x142)]),_0x1b8213[_0x2e44d0(0xfb)]&&(_0x10cbf0[_0x2e44d0(0xfb)]=_0x1b8213['retryAttemptName']),_0x1b8213[_0x2e44d0(0x113)]!==undefined&&(_0x10cbf0[_0x2e44d0(0x113)]=_0x1b8213[_0x2e44d0(0x113)]),await this[_0x2e44d0(0x111)][_0x2e44d0(0x100)](_0x2e44d0(0x133),'/api/attempts',{'body':_0x10cbf0});}async[a10_0x3b4d52(0x144)](_0x428991,_0x15dc6c,_0x1b0240){const _0x59bf05=a10_0x3b4d52,{promises:_0x38c1cd}=await import('fs'),_0x4b73bb=new URLSearchParams();_0x1b0240&&_0x4b73bb['append']('revision',_0x1b0240);const _0x34815b=_0x4b73bb['toString'](),_0x45f24a=_0x34815b?_0x59bf05(0x147)+encodeURIComponent(_0x428991)+_0x59bf05(0x11d)+_0x34815b:_0x59bf05(0x147)+encodeURIComponent(_0x428991)+_0x59bf05(0x122),_0x1ff63d=await this[_0x59bf05(0x111)][_0x59bf05(0x100)](_0x59bf05(0x101),_0x45f24a,{'headers':{'Accept':_0x59bf05(0x137)},'responseType':'arraybuffer'});return await _0x38c1cd[_0x59bf05(0x152)](_0x15dc6c,_0x1ff63d),_0x15dc6c;}async[a10_0x3b4d52(0x10c)](_0xebf74b,_0x5db86b,_0x5a66f9,_0x189abc){const _0x5a0bc3=a10_0x3b4d52,{promises:_0x4a80a2}=await import('fs'),_0x198288=new URLSearchParams();_0x198288[_0x5a0bc3(0x109)](_0x5a0bc3(0xf2),_0xebf74b),_0x198288[_0x5a0bc3(0x109)](_0x5a0bc3(0x145),_0x5db86b);_0x189abc?.[_0x5a0bc3(0x14f)]&&_0x198288[_0x5a0bc3(0x109)](_0x5a0bc3(0x12a),_0x189abc[_0x5a0bc3(0x14f)]);_0x189abc?.['clearSchedule']&&_0x189abc[_0x5a0bc3(0x118)]['forEach'](_0x14cfe7=>{const _0x23355a=_0x5a0bc3;_0x198288['append'](_0x23355a(0x12f),_0x14cfe7);});_0x189abc?.[_0x5a0bc3(0x150)]&&_0x198288[_0x5a0bc3(0x109)](_0x5a0bc3(0x136),_0x5a0bc3(0x123));const _0x3ea0e6=_0x198288[_0x5a0bc3(0x107)](),_0x9a07f2=_0x5a0bc3(0xff)+_0x3ea0e6,_0x387f6a=await _0x4a80a2[_0x5a0bc3(0x134)](_0x5a66f9);return await this[_0x5a0bc3(0x111)][_0x5a0bc3(0x100)]('PUT',_0x9a07f2,{'body':_0x387f6a,'headers':{'Content-Type':_0x5a0bc3(0x137)}});}async[a10_0x3b4d52(0x11e)](_0x244d51){const _0x49ae96=a10_0x3b4d52;return await this[_0x49ae96(0x111)][_0x49ae96(0x100)]('DELETE','/api/projects/'+encodeURIComponent(_0x244d51));}}
|
|
1
|
+
const a10_0x52d081=a10_0xd76d;function a10_0x4491(){const _0x3a726e=['/api/projects/','/api/attempts/','/retry','1006136INwndq','clear_schedule','projectName','true','projects','listAttempts','clearSchedule','/logs?','allowQueueing','include_subtasks','workflow_name','retrySession','status','/api/projects?','request','limit','reason','9rosdEY','18sOVdFV','listWorkflows','802230pGCMuf','application/gzip','revision','12ieAwIk','5350048hhLUbo','lastId','from_time','/api/sessions','workflows','offset','/api/logs/','PUT','name_pattern','/api/attempts','retry_params','/logs','clear_schedule_all','/archive','/kill','GET','24762iyHokT','63NZcXfK','/tasks?','project_id','readFile','uploadProjectArchive','/sessions','DELETE','params','httpClient','POST','project_name','writeFile','startAttempt','apiKey','retryAttempt','listLogFiles','last_id','attempts','to_time','/api/projects','getAttemptTasks','workflow','filter','search_project_name','/files?','/files','from_task','tasks','arraybuffer','1767965QlHjmw','name','append','workflowName','workflowId','replace','resume_from','/tasks/','force','sessionTime','listProjects','/api/attempts?','retryAttemptName','logs','deleteProject','include_retried','1248807wrbkQc','getAttempt','59829pnGVhy','task','authHeaders','scheduleFrom','site','sessions','project','toString'];a10_0x4491=function(){return _0x3a726e;};return a10_0x4491();}(function(_0x587f9c,_0x3db68b){const _0x42d7b5=a10_0xd76d,_0x1a50b6=_0x587f9c();while(!![]){try{const _0xb4c589=-parseInt(_0x42d7b5(0x116))/0x1*(-parseInt(_0x42d7b5(0x115))/0x2)+-parseInt(_0x42d7b5(0xfe))/0x3*(parseInt(_0x42d7b5(0x150))/0x4)+-parseInt(_0x42d7b5(0x133))/0x5*(-parseInt(_0x42d7b5(0x104))/0x6)+parseInt(_0x42d7b5(0x143))/0x7+-parseInt(_0x42d7b5(0x105))/0x8+-parseInt(_0x42d7b5(0xff))/0x9*(-parseInt(_0x42d7b5(0x101))/0xa)+-parseInt(_0x42d7b5(0x145))/0xb;if(_0xb4c589===_0x3db68b)break;else _0x1a50b6['push'](_0x1a50b6['shift']());}catch(_0x25d5b1){_0x1a50b6['push'](_0x1a50b6['shift']());}}}(a10_0x4491,0x60fb7));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';function a10_0xd76d(_0x4c16f4,_0x387fc1){_0x4c16f4=_0x4c16f4-0xf5;const _0x4491c3=a10_0x4491();let _0xd76db6=_0x4491c3[_0x4c16f4];return _0xd76db6;}export class WorkflowApiClient{[a10_0x52d081(0x11e)];['authHeaders'];constructor(_0x2c2e37,_0x3dd943){const _0x16515c=a10_0x52d081,_0xc44709=getEndpoint(_0x2c2e37[_0x16515c(0x149)],'workflow');this['authHeaders']=toHeaderRecord(getAuthHeaders(_0x2c2e37[_0x16515c(0x149)],_0x2c2e37[_0x16515c(0x123)])),this[_0x16515c(0x11e)]=new HTTPClient(_0xc44709,this[_0x16515c(0x147)],_0x3dd943);}async[a10_0x52d081(0x13d)](_0x5748eb){const _0x2d862d=a10_0x52d081,_0xd12e3f=new URLSearchParams();if(_0x5748eb?.[_0x2d862d(0xfc)])_0xd12e3f[_0x2d862d(0x135)]('limit',String(_0x5748eb[_0x2d862d(0xfc)]));if(_0x5748eb?.[_0x2d862d(0x126)])_0xd12e3f[_0x2d862d(0x135)](_0x2d862d(0x126),_0x5748eb[_0x2d862d(0x126)]);if(_0x5748eb?.['name_pattern']){const _0x1d9faf=_0x5748eb[_0x2d862d(0x10d)][_0x2d862d(0x138)](/[*?]/g,'');_0x1d9faf&&_0xd12e3f[_0x2d862d(0x135)](_0x2d862d(0x10d),_0x1d9faf);}const _0x108f78=_0xd12e3f[_0x2d862d(0x14c)](),_0x5681d6=_0x108f78?_0x2d862d(0xfa)+_0x108f78:_0x2d862d(0x129),_0x15f064=await this['httpClient'][_0x2d862d(0xfb)](_0x2d862d(0x114),_0x5681d6);let _0x430a5b=_0x15f064[_0x2d862d(0x154)]||[];return _0x5748eb?.[_0x2d862d(0x10d)]&&(_0x430a5b=_0x430a5b[_0x2d862d(0x12c)](_0x152e78=>{const _0x5793e9=_0x2d862d;return matchGlobPattern(_0x152e78[_0x5793e9(0x134)],_0x5748eb[_0x5793e9(0x10d)]);})),{'data':_0x430a5b,'lastId':_0x15f064[_0x2d862d(0x106)]};}async[a10_0x52d081(0x100)](_0x2bf008){const _0x4390d4=a10_0x52d081,_0x397815=new URLSearchParams();if(_0x2bf008?.[_0x4390d4(0xfc)])_0x397815['append'](_0x4390d4(0xfc),String(_0x2bf008[_0x4390d4(0xfc)]));if(_0x2bf008?.[_0x4390d4(0x126)])_0x397815['append'](_0x4390d4(0x126),_0x2bf008[_0x4390d4(0x126)]);if(_0x2bf008?.['project_name']){const _0x2c54a1=_0x2bf008[_0x4390d4(0x120)][_0x4390d4(0x138)](/[*?]/g,'');_0x2c54a1&&(_0x397815[_0x4390d4(0x135)](_0x4390d4(0x10d),_0x2c54a1),_0x397815[_0x4390d4(0x135)](_0x4390d4(0x12d),_0x4390d4(0x153)));}const _0x28b6b8=_0x397815[_0x4390d4(0x14c)](),_0x26d97e=_0x28b6b8?'/api/workflows?'+_0x28b6b8:'/api/workflows',_0x4c3373=await this[_0x4390d4(0x11e)]['request']('GET',_0x26d97e);let _0x4d90f4=_0x4c3373[_0x4390d4(0x109)]||[];return _0x2bf008?.['project_name']&&(_0x4d90f4=_0x4d90f4[_0x4390d4(0x12c)](_0x486d35=>{const _0x17968e=_0x4390d4,_0x354c42=_0x486d35[_0x17968e(0x14b)]?.[_0x17968e(0x134)];if(!_0x354c42)return![];return matchGlobPattern(_0x354c42,_0x2bf008[_0x17968e(0x120)]);})),{'data':_0x4d90f4,'lastId':_0x4c3373[_0x4390d4(0x106)]};}async['listSessions'](_0x1684f4){const _0x19582f=a10_0x52d081;let _0x58d6a9=_0x19582f(0x108);_0x1684f4?.[_0x19582f(0x118)]&&(_0x58d6a9='/api/projects/'+encodeURIComponent(_0x1684f4[_0x19582f(0x118)])+_0x19582f(0x11b));const _0x496b0f=new URLSearchParams();if(_0x1684f4?.[_0x19582f(0xf7)])_0x496b0f['append']('workflow',_0x1684f4[_0x19582f(0xf7)]);if(_0x1684f4?.[_0x19582f(0xf9)])_0x496b0f[_0x19582f(0x135)](_0x19582f(0xf9),_0x1684f4[_0x19582f(0xf9)]);if(_0x1684f4?.[_0x19582f(0x107)])_0x496b0f[_0x19582f(0x135)]('from_time',_0x1684f4[_0x19582f(0x107)]);if(_0x1684f4?.['to_time'])_0x496b0f[_0x19582f(0x135)]('to_time',_0x1684f4[_0x19582f(0x128)]);if(_0x1684f4?.['limit'])_0x496b0f[_0x19582f(0x135)](_0x19582f(0xfc),String(_0x1684f4[_0x19582f(0xfc)]));if(_0x1684f4?.[_0x19582f(0x126)])_0x496b0f[_0x19582f(0x135)]('last_id',_0x1684f4['last_id']);const _0x66516c=_0x496b0f[_0x19582f(0x14c)]();_0x66516c&&(_0x58d6a9=_0x58d6a9+'?'+_0x66516c);const _0x1dec2b=await this['httpClient']['request'](_0x19582f(0x114),_0x58d6a9);return{'data':_0x1dec2b[_0x19582f(0x14a)]||[],'lastId':_0x1dec2b[_0x19582f(0x106)]};}async[a10_0x52d081(0x155)](_0x434867){const _0x6b9efc=a10_0x52d081,_0x368340=new URLSearchParams();if(_0x434867?.['project_name'])_0x368340[_0x6b9efc(0x135)](_0x6b9efc(0x14b),_0x434867[_0x6b9efc(0x120)]);if(_0x434867?.[_0x6b9efc(0xf7)])_0x368340[_0x6b9efc(0x135)](_0x6b9efc(0x12b),_0x434867[_0x6b9efc(0xf7)]);if(_0x434867?.[_0x6b9efc(0x142)])_0x368340[_0x6b9efc(0x135)]('include_retried','1');if(_0x434867?.[_0x6b9efc(0xfc)])_0x368340[_0x6b9efc(0x135)](_0x6b9efc(0xfc),String(_0x434867[_0x6b9efc(0xfc)]));if(_0x434867?.['last_id'])_0x368340[_0x6b9efc(0x135)]('last_id',_0x434867[_0x6b9efc(0x126)]);const _0x1222c7=_0x368340['toString'](),_0x5322aa=_0x1222c7?_0x6b9efc(0x13e)+_0x1222c7:_0x6b9efc(0x10e),_0x4a0c67=await this['httpClient'][_0x6b9efc(0xfb)](_0x6b9efc(0x114),_0x5322aa);return{'data':_0x4a0c67[_0x6b9efc(0x127)]||[],'lastId':_0x4a0c67[_0x6b9efc(0x106)]};}async[a10_0x52d081(0x144)](_0x2288e9){const _0x2eeeee=a10_0x52d081;return await this[_0x2eeeee(0x11e)]['request'](_0x2eeeee(0x114),_0x2eeeee(0x14e)+encodeURIComponent(_0x2288e9));}async[a10_0x52d081(0x12a)](_0x42432f,_0x33bea7=![]){const _0x4f10d7=a10_0x52d081,_0x2f07bf=new URLSearchParams();_0x33bea7&&_0x2f07bf[_0x4f10d7(0x135)](_0x4f10d7(0xf6),'true');const _0x30b089=_0x2f07bf[_0x4f10d7(0x14c)](),_0x34aa86=_0x30b089?_0x4f10d7(0x14e)+encodeURIComponent(_0x42432f)+_0x4f10d7(0x117)+_0x30b089:_0x4f10d7(0x14e)+encodeURIComponent(_0x42432f)+'/tasks',_0x254529=await this['httpClient']['request'](_0x4f10d7(0x114),_0x34aa86);return _0x254529[_0x4f10d7(0x131)]||[];}async['getTaskLogs'](_0xaf194b,_0x4d69ec,_0x287cb8){const _0x27c4fa=a10_0x52d081,_0x5abcad=new URLSearchParams();_0x287cb8?.[_0x27c4fa(0x10a)]!==undefined&&_0x5abcad[_0x27c4fa(0x135)]('offset',String(_0x287cb8[_0x27c4fa(0x10a)]));_0x287cb8?.['limit']!==undefined&&_0x5abcad[_0x27c4fa(0x135)](_0x27c4fa(0xfc),String(_0x287cb8[_0x27c4fa(0xfc)]));const _0x4b6ad2=_0x5abcad[_0x27c4fa(0x14c)](),_0x33fa30=_0x4b6ad2?_0x27c4fa(0x14e)+encodeURIComponent(_0xaf194b)+_0x27c4fa(0x13a)+encodeURIComponent(_0x4d69ec)+_0x27c4fa(0x157)+_0x4b6ad2:'/api/attempts/'+encodeURIComponent(_0xaf194b)+_0x27c4fa(0x13a)+encodeURIComponent(_0x4d69ec)+_0x27c4fa(0x110),_0x1ef64c=await this['httpClient']['request'](_0x27c4fa(0x114),_0x33fa30);return _0x1ef64c[_0x27c4fa(0x140)]||[];}async[a10_0x52d081(0x125)](_0x2c710e,_0x25bd72){const _0x593fff=a10_0x52d081,_0x55002c=new URLSearchParams();_0x25bd72&&_0x55002c[_0x593fff(0x135)](_0x593fff(0x146),_0x25bd72);const _0x327258=_0x55002c[_0x593fff(0x14c)](),_0x49eb4f=_0x327258?_0x593fff(0x10b)+encodeURIComponent(_0x2c710e)+_0x593fff(0x12e)+_0x327258:_0x593fff(0x10b)+encodeURIComponent(_0x2c710e)+_0x593fff(0x12f),_0x129595=await this['httpClient'][_0x593fff(0xfb)](_0x593fff(0x114),_0x49eb4f);return _0x129595['files']||[];}async['killAttempt'](_0x432f18,_0xdb5e31){const _0x139d33=a10_0x52d081,_0x590665={};return _0xdb5e31&&(_0x590665[_0x139d33(0xfd)]=_0xdb5e31),await this['httpClient'][_0x139d33(0xfb)](_0x139d33(0x11f),_0x139d33(0x14e)+encodeURIComponent(_0x432f18)+_0x139d33(0x113),{'body':_0x590665});}async[a10_0x52d081(0xf8)](_0x33b9cd,_0x30b83f){const _0x524e28=a10_0x52d081,_0x17610d={};return _0x30b83f?.[_0x524e28(0x130)]&&(_0x17610d[_0x524e28(0x130)]=_0x30b83f[_0x524e28(0x130)]),_0x30b83f?.['retry_params']&&(_0x17610d[_0x524e28(0x10f)]=_0x30b83f[_0x524e28(0x10f)]),await this[_0x524e28(0x11e)]['request'](_0x524e28(0x11f),'/api/sessions/'+encodeURIComponent(_0x33b9cd)+_0x524e28(0x14f),{'body':_0x17610d});}async[a10_0x52d081(0x124)](_0x47dc55,_0x3cfe90){const _0x1273bd=a10_0x52d081,_0xfa4671={};return _0x3cfe90?.[_0x1273bd(0x139)]&&(_0xfa4671[_0x1273bd(0x139)]=_0x3cfe90[_0x1273bd(0x139)]),_0x3cfe90?.[_0x1273bd(0x10f)]&&(_0xfa4671[_0x1273bd(0x10f)]=_0x3cfe90[_0x1273bd(0x10f)]),_0x3cfe90?.[_0x1273bd(0x13b)]&&(_0xfa4671[_0x1273bd(0x13b)]=_0x3cfe90[_0x1273bd(0x13b)]),await this[_0x1273bd(0x11e)][_0x1273bd(0xfb)](_0x1273bd(0x11f),'/api/attempts/'+encodeURIComponent(_0x47dc55)+_0x1273bd(0x14f),{'body':_0xfa4671});}async[a10_0x52d081(0x122)](_0x1ee32a){const _0x501355=a10_0x52d081,_0x22211e={'sessionTime':_0x1ee32a[_0x501355(0x13c)],'params':_0x1ee32a[_0x501355(0x11d)]};return _0x1ee32a[_0x501355(0x137)]&&(_0x22211e[_0x501355(0x137)]=_0x1ee32a[_0x501355(0x137)]),_0x1ee32a[_0x501355(0x152)]&&(_0x22211e['projectName']=_0x1ee32a[_0x501355(0x152)]),_0x1ee32a[_0x501355(0x136)]&&(_0x22211e['workflowName']=_0x1ee32a[_0x501355(0x136)]),_0x1ee32a[_0x501355(0x13f)]&&(_0x22211e[_0x501355(0x13f)]=_0x1ee32a[_0x501355(0x13f)]),_0x1ee32a[_0x501355(0xf5)]!==undefined&&(_0x22211e['allowQueueing']=_0x1ee32a[_0x501355(0xf5)]),await this[_0x501355(0x11e)][_0x501355(0xfb)]('PUT','/api/attempts',{'body':_0x22211e});}async['downloadProjectArchive'](_0x292fd7,_0x455a13,_0x2a7812){const _0x17d08d=a10_0x52d081,{promises:_0x5d985f}=await import('fs'),_0x3e61b7=new URLSearchParams();_0x2a7812&&_0x3e61b7['append']('revision',_0x2a7812);const _0x3fb3ba=_0x3e61b7['toString'](),_0x1c5761=_0x3fb3ba?_0x17d08d(0x14d)+encodeURIComponent(_0x292fd7)+'/archive?'+_0x3fb3ba:'/api/projects/'+encodeURIComponent(_0x292fd7)+_0x17d08d(0x112),_0x9c3569=await this[_0x17d08d(0x11e)]['request'](_0x17d08d(0x114),_0x1c5761,{'headers':{'Accept':_0x17d08d(0x102)},'responseType':_0x17d08d(0x132)});return await _0x5d985f[_0x17d08d(0x121)](_0x455a13,_0x9c3569),_0x455a13;}async[a10_0x52d081(0x11a)](_0x3b1dee,_0x5eb43e,_0x56e783,_0x448167){const _0x13815f=a10_0x52d081,{promises:_0x460156}=await import('fs'),_0x26a733=new URLSearchParams();_0x26a733[_0x13815f(0x135)](_0x13815f(0x14b),_0x3b1dee),_0x26a733[_0x13815f(0x135)](_0x13815f(0x103),_0x5eb43e);_0x448167?.[_0x13815f(0x148)]&&_0x26a733[_0x13815f(0x135)]('schedule_from',_0x448167[_0x13815f(0x148)]);_0x448167?.[_0x13815f(0x156)]&&_0x448167[_0x13815f(0x156)]['forEach'](_0xa67e79=>{const _0x50037c=_0x13815f;_0x26a733['append'](_0x50037c(0x151),_0xa67e79);});_0x448167?.['clearScheduleAll']&&_0x26a733[_0x13815f(0x135)](_0x13815f(0x111),'true');const _0x396156=_0x26a733['toString'](),_0x47d236=_0x13815f(0xfa)+_0x396156,_0x222f8e=await _0x460156[_0x13815f(0x119)](_0x56e783);return await this[_0x13815f(0x11e)][_0x13815f(0xfb)](_0x13815f(0x10c),_0x47d236,{'body':_0x222f8e,'headers':{'Content-Type':_0x13815f(0x102)}});}async[a10_0x52d081(0x141)](_0x1e2156){const _0x2b64d9=a10_0x52d081;return await this[_0x2b64d9(0x11e)][_0x2b64d9(0xfb)](_0x2b64d9(0x11c),'/api/projects/'+encodeURIComponent(_0x1e2156));}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a11_0x21042f=a11_0x14a5;function a11_0x2e05(){const _0x45c693=['Site:\x20','\x27...','Error:\x20','name','data','verbose','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','Error:\x20Segment\x20name\x20is\x20required','description','activations','Resolved\x20child\x20ID:\x20','10821204inHAkF','Resolving\x20parent\x20segment\x20\x27','5476314PJwRUh','listActivations','execute','461530CKOOgX','resolveParentId','List\x20activations\x20for\x20a\x20segment','77EudwKd','Resolved\x20parent\x20ID:\x20','164841rjKQlm','100obNyId','2917996nlIOuW','5UnWKMZ','10116071xfKGTW','1206463YBKnHW','site','✔\x20Found\x20','cause','\x20activation','8rsLLeU','error','segment','length','resolveSegmentId'];a11_0x2e05=function(){return _0x45c693;};return a11_0x2e05();}(function(_0x4e82bb,_0x5c031c){const _0x5ed231=a11_0x14a5,_0x3566d2=_0x4e82bb();while(!![]){try{const _0x12a6c5=parseInt(_0x5ed231(0x9d))/0x1+parseInt(_0x5ed231(0x9a))/0x2+-parseInt(_0x5ed231(0x98))/0x3*(-parseInt(_0x5ed231(0x99))/0x4)+parseInt(_0x5ed231(0x9b))/0x5*(-parseInt(_0x5ed231(0x90))/0x6)+-parseInt(_0x5ed231(0x9c))/0x7*(parseInt(_0x5ed231(0xa2))/0x8)+-parseInt(_0x5ed231(0x8e))/0x9+parseInt(_0x5ed231(0x93))/0xa*(parseInt(_0x5ed231(0x96))/0xb);if(_0x12a6c5===_0x5c031c)break;else _0x3566d2['push'](_0x3566d2['shift']());}catch(_0x3ef34e){_0x3566d2['push'](_0x3566d2['shift']());}}}(a11_0x2e05,0xc3cbb));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a11_0x14a5(_0x4aa731,_0x1cd69a){_0x4aa731=_0x4aa731-0x88;const _0x2e05ac=a11_0x2e05();let _0x14a56d=_0x2e05ac[_0x4aa731];return _0x14a56d;}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a11_0x21042f(0xaa)]=a11_0x21042f(0x8c);[a11_0x21042f(0x8b)]=a11_0x21042f(0x95);async[a11_0x21042f(0x92)](_0x12acb9){const _0xce75cd=a11_0x21042f,{options:_0x337bf0,args:_0x37c9e9,tdx:_0x59d93e}=_0x12acb9;if(_0x37c9e9[_0xce75cd(0xa5)]===0x0)return console[_0xce75cd(0xa3)](_0xce75cd(0x8a)),console[_0xce75cd(0xa3)](_0xce75cd(0x89)),0x1;try{const {parentId:_0x42f4a3,childId:_0x5c7db6}=parseSegmentRef(_0x37c9e9[0x0]);if(!_0x5c7db6)return console[_0xce75cd(0xa3)]('Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations'),console[_0xce75cd(0xa3)](_0xce75cd(0x89)),0x1;_0x337bf0[_0xce75cd(0x88)]&&(console['error'](_0xce75cd(0xa7)+_0x337bf0[_0xce75cd(0x9e)]),console['error']('Parent\x20name:\x20'+_0x42f4a3),console[_0xce75cd(0xa3)]('Child\x20name:\x20'+_0x5c7db6));const _0x302552=await withSpinner(_0xce75cd(0x8f)+_0x42f4a3+_0xce75cd(0xa8),()=>_0x59d93e[_0xce75cd(0xa4)][_0xce75cd(0x94)](_0x42f4a3),{'verbose':_0x337bf0['verbose']}),_0x461856=_0x302552[_0xce75cd(0xab)];_0x337bf0[_0xce75cd(0x88)]&&console[_0xce75cd(0xa3)](_0xce75cd(0x97)+_0x461856);const _0x4b377a=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x5c7db6+_0xce75cd(0xa8),()=>_0x59d93e[_0xce75cd(0xa4)][_0xce75cd(0xa6)](_0x461856,_0x5c7db6),{'verbose':_0x337bf0['verbose']}),_0x128235=_0x4b377a[_0xce75cd(0xab)];_0x337bf0[_0xce75cd(0x88)]&&console['error'](_0xce75cd(0x8d)+_0x128235);const _0x2ab804=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0x5c7db6+_0xce75cd(0xa8),()=>_0x59d93e['segment'][_0xce75cd(0x91)](_0x461856,_0x128235),{'verbose':_0x337bf0[_0xce75cd(0x88)]}),_0x35b65a=_0x2ab804['data'];return console[_0xce75cd(0xa3)](_0xce75cd(0x9f)+_0x35b65a[_0xce75cd(0xa5)]+_0xce75cd(0xa1)+(_0x35b65a[_0xce75cd(0xa5)]!==0x1?'s':'')),await handleSDKOutput(_0x35b65a,_0x337bf0),0x0;}catch(_0x16e7aa){if(_0x16e7aa instanceof SDKError)return console[_0xce75cd(0xa3)](_0xce75cd(0xa9)+_0x16e7aa['message']),_0x16e7aa[_0xce75cd(0xa0)]&&console[_0xce75cd(0xa3)]('\x20\x20Cause:\x20'+_0x16e7aa[_0xce75cd(0xa0)]),0x1;throw _0x16e7aa;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a12_0x3068e7=a12_0x31fe;(function(_0x484de9,_0x4b2347){const _0x3a9424=a12_0x31fe,_0x27d179=_0x484de9();while(!![]){try{const _0x31ba4e=parseInt(_0x3a9424(0x137))/0x1*(-parseInt(_0x3a9424(0xf6))/0x2)+-parseInt(_0x3a9424(0x112))/0x3*(parseInt(_0x3a9424(0x167))/0x4)+parseInt(_0x3a9424(0x115))/0x5+-parseInt(_0x3a9424(0x17e))/0x6+parseInt(_0x3a9424(0x152))/0x7+parseInt(_0x3a9424(0x18a))/0x8+-parseInt(_0x3a9424(0x142))/0x9*(-parseInt(_0x3a9424(0x157))/0xa);if(_0x31ba4e===_0x4b2347)break;else _0x27d179['push'](_0x27d179['shift']());}catch(_0x43c90b){_0x27d179['push'](_0x27d179['shift']());}}}(a12_0x21d9,0xa98f1));function a12_0x31fe(_0x49ed15,_0x5b04b4){_0x49ed15=_0x49ed15-0xf5;const _0x21d9d7=a12_0x21d9();let _0x31fe59=_0x21d9d7[_0x49ed15];return _0x31fe59;}import a12_0x47c8b5 from'chalk';import a12_0x2188e8 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../utils/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';function a12_0x21d9(){const _0x22d4b0=['push','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','Pull\x20cancelled','\x20total','Analyzing\x20changes\x20to\x20push...','agents','Dry\x20run\x20-\x20no\x20changes\x20made','yes','\x20files?','\x22\x20to\x20\x22','isNew','3hYYIgN','site','Source:\x20','2648425DjAFRG','agentName','Using\x20project:\x20','\x20\x20Knowledge\x20Bases:\x20','New\x20project:\x20','Using\x20project\x20from\x20','Agent:\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','updated','output','Pulling\x20agent\x20\x22','newProjectId','\x20resources?','Project:\x20','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20\x20Prompts:\x20','\x0aPull\x20summary\x20for\x20\x27','repeat','\x20\x20Text\x20Knowledge\x20Base\x20\x22','agent:push','Pushing\x20agent\x20from\x20\x22','green','session','\x0aPush\x20summary\x20for\x20\x27','llmProject','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','\x20\x20Knowledge\x20Base\x20\x22','hasChanges','cloneProject','cyan','\x22\x20to\x20new\x20project\x20\x22','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','\x20=\x20','New\x20project\x20ID:\x20','1wMeKkM','New\x20project\x20name\x20is\x20required','error','\x20|\x20','Would\x20pull\x20agent:\x20','✔\x20Context\x20set:\x20','Context\x20set:\x20','Chat:\x20','gray','Using\x20local\x20project:\x20','Current\x20context\x20has\x20llm_project=\x22','15237iBsVUL','llm_project','description','\x20\x20Prompt\x20\x22','created','\x20\x20Source:\x20','INVALID_ARGUMENT','Output\x20path:\x20','dim','\x20--name\x20','prompts','Output:\x20','Push\x20cancelled','Analyzing\x20project\x20\x22','textKnowledgeBases','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','6991334NmmwKV','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','utf-8','force','Dry\x20run\x20-\x20no\x20files\x20written','5750DNksWz','Errors:','profile','\x20\x20Agents:\x20','\x20resources\x20to\x20\x27','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','projectName','dirname','\x0a✔\x20Pulled\x20','Run\x20\x27tdx\x20agent\x20pull\x20','agentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','Failed\x20to\x20push\x20agent:\x20','sourceProjectName','\x22...','errors','3225436mUyXBi','\x20--profile\x20','\x20\x20Target:\x20','newProjectName','\x20\x20Agent\x20\x22','new','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','projectId','Summary:','pushProject','\x20updated','yellow','\x20\x20Text\x20Knowledge\x20Bases:\x20','log','tdx.json','Would\x20push\x20agent:\x20','Pushing\x20to\x20project...','name','diff','Using\x20context\x20project:\x20','execute','\x20changed','\x0aChanges\x20to\x20prompt\x20\x27','4949346pGTKNp','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','unchanged','cwd','Agent\x20','\x20created','Writing\x20files...','outputPath','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0aPush\x20','join','knowledgeBases','8582304rEjqjh','action','\x20unchanged','\x0aProject\x20pushed\x20with\x20errors','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','MISSING_ARGUMENT','\x20new','<new-name>','Status:\x20','pullAgent','2497894cmwvqr','counts','\x20files\x20to\x20','No\x20tdx.json\x20found\x20in\x20','\x22:\x20','\x22\x20to\x20a\x20different\x20profile','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x27\x20to\x20create\x20the\x20folder\x20structure.','Project\x20cloned\x20successfully','outputDir','llm','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','dryRun','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','parse','Cloning\x20\x22','red'];a12_0x21d9=function(){return _0x22d4b0;};return a12_0x21d9();}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function formatCountSummary(_0x2fef32){const _0x47a029=a12_0x31fe,_0x3ea4e6=[];if(_0x2fef32['total']!==undefined)_0x3ea4e6[_0x47a029(0x107)](_0x2fef32['total']+_0x47a029(0x10a));if(_0x2fef32[_0x47a029(0x16c)]!==undefined&&_0x2fef32[_0x47a029(0x16c)]>0x0)_0x3ea4e6[_0x47a029(0x107)](a12_0x47c8b5[_0x47a029(0x12a)](_0x2fef32['new']+_0x47a029(0x190)));if(_0x2fef32[_0x47a029(0x146)]!==undefined&&_0x2fef32[_0x47a029(0x146)]>0x0)_0x3ea4e6[_0x47a029(0x107)](a12_0x47c8b5[_0x47a029(0x12a)](_0x2fef32[_0x47a029(0x146)]+_0x47a029(0x183)));if(_0x2fef32[_0x47a029(0x11d)]!==undefined&&_0x2fef32['updated']>0x0)_0x3ea4e6['push'](a12_0x47c8b5[_0x47a029(0x172)](_0x2fef32[_0x47a029(0x11d)]+_0x47a029(0x171)));if(_0x2fef32[_0x47a029(0x180)]!==undefined&&_0x2fef32[_0x47a029(0x180)]>0x0)_0x3ea4e6[_0x47a029(0x107)](a12_0x47c8b5['gray'](_0x2fef32[_0x47a029(0x180)]+_0x47a029(0x18c)));if(_0x2fef32['errors']!==undefined&&_0x2fef32[_0x47a029(0x166)]>0x0)_0x3ea4e6[_0x47a029(0x107)](a12_0x47c8b5['red'](_0x2fef32[_0x47a029(0x166)]+'\x20errors'));return _0x3ea4e6[_0x47a029(0x188)](',\x20');}function displayDiffs(_0x4758c2,_0x252ea9,_0x50b889,_0xcb2e8c){const _0x4793b9=a12_0x31fe;for(const _0x282dea of _0x4758c2){if(_0x282dea[_0x4793b9(0x179)]){const _0x244265=_0x282dea[_0x4793b9(0x116)]||_0x282dea['name'];console[_0x4793b9(0x174)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x244265+'\x27:'),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c)),console[_0x4793b9(0x174)](_0x282dea[_0x4793b9(0x179)]),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c));}}for(const _0x17c384 of _0x252ea9){_0x17c384[_0x4793b9(0x179)]&&(console[_0x4793b9(0x174)](_0x4793b9(0x123)+_0x17c384[_0x4793b9(0x178)]+'\x27:'),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c)),console[_0x4793b9(0x174)](_0x17c384['diff']),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c)));}for(const _0x53a4b9 of _0x50b889){_0x53a4b9[_0x4793b9(0x179)]&&(console[_0x4793b9(0x174)](_0x4793b9(0x108)+_0x53a4b9[_0x4793b9(0x178)]+'\x27:'),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c)),console['log'](_0x53a4b9[_0x4793b9(0x179)]),console['log']('─'[_0x4793b9(0x126)](0x3c)));}for(const _0x56baf1 of _0xcb2e8c){_0x56baf1[_0x4793b9(0x179)]&&(console['log'](_0x4793b9(0x17d)+_0x56baf1[_0x4793b9(0x178)]+'\x27:'),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c)),console[_0x4793b9(0x174)](_0x56baf1[_0x4793b9(0x179)]),console[_0x4793b9(0x174)]('─'[_0x4793b9(0x126)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a12_0x3068e7(0x178)]='agent:pull';['description']=a12_0x3068e7(0x17f);async[a12_0x3068e7(0x17b)](_0x430e03){const _0x4d5465=a12_0x3068e7,{options:_0x3c01eb,args:_0x58bb7e,tdx:_0x2b0dcf}=_0x430e03,_0x3b8a08=_0x58bb7e[0x0],_0x3df3ee=_0x58bb7e[0x1],_0x480591=_0x3c01eb[_0x4d5465(0x11e)],_0x7dfad0=_0x3c01eb[_0x4d5465(0x102)],_0x299b86=_0x3c01eb[_0x4d5465(0x155)],_0x2e2111=_0x3c01eb[_0x4d5465(0x10e)],_0xed5012=_0x3c01eb['llmProject'];let _0x39df7d,_0xbdc79a;const _0x23235=findAgentConfigPath(process[_0x4d5465(0x181)]());if(_0x3b8a08){const _0x41d0bf=a12_0x2188e8[_0x4d5465(0x188)](_0x3b8a08,'tdx.json');if(existsSync(_0x41d0bf))try{const _0x50d6ab=JSON['parse'](readFileSync(_0x41d0bf,_0x4d5465(0x154)));_0x39df7d=_0x50d6ab[_0x4d5465(0x143)],_0xbdc79a=_0x3b8a08,console[_0x4d5465(0x174)](a12_0x47c8b5['dim'](_0x4d5465(0x11a)+_0x41d0bf+':\x20'+_0x39df7d));}catch{_0x39df7d=_0x3b8a08;}else _0x39df7d=_0x3b8a08;}else{if(_0x23235)try{const _0x5d7e67=JSON[_0x4d5465(0x104)](readFileSync(_0x23235,_0x4d5465(0x154)));_0x39df7d=_0x5d7e67[_0x4d5465(0x143)],_0xbdc79a=a12_0x2188e8[_0x4d5465(0x15e)](_0x23235),console[_0x4d5465(0x174)](a12_0x47c8b5[_0x4d5465(0x14a)](_0x4d5465(0x117)+_0x39df7d));}catch{_0x39df7d=_0xed5012;}else _0x39df7d=_0xed5012;}if(!_0x39df7d)return console['log'](a12_0x47c8b5[_0x4d5465(0x172)](_0x4d5465(0x16d))),console['log']('Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x4d5465(0x174)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project'),console[_0x4d5465(0x174)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory'),console[_0x4d5465(0x174)](_0x4d5465(0x162)),0x1;if(_0x3df3ee){const {data:_0x455c1e}=await withSpinner(_0x4d5465(0x11f)+_0x3df3ee+'\x22\x20from\x20project\x20\x22'+_0x39df7d+_0x4d5465(0x165),()=>_0x2b0dcf['llm'][_0x4d5465(0xf5)](_0x39df7d,_0x3df3ee,_0x480591,{'dryRun':_0x7dfad0,'force':_0x299b86}));if(_0x7dfad0)return console['log'](a12_0x47c8b5[_0x4d5465(0x172)](_0x4d5465(0x156))),console[_0x4d5465(0x174)](_0x4d5465(0x13b)+_0x455c1e[_0x4d5465(0x116)]),console[_0x4d5465(0x174)](_0x4d5465(0x149)+_0x455c1e[_0x4d5465(0x185)]),_0x455c1e['diff']&&(console[_0x4d5465(0x174)]('\x0aChanges:'),console[_0x4d5465(0x174)]('─'[_0x4d5465(0x126)](0x3c)),console[_0x4d5465(0x174)](_0x455c1e['diff']),console[_0x4d5465(0x174)]('─'[_0x4d5465(0x126)](0x3c))),0x0;return console['log'](a12_0x47c8b5[_0x4d5465(0x12a)]('Agent\x20pulled\x20successfully')),console['log'](_0x4d5465(0x11b)+_0x455c1e[_0x4d5465(0x116)]),console[_0x4d5465(0x174)](_0x4d5465(0x14d)+_0x455c1e[_0x4d5465(0x185)]),console['log'](_0x4d5465(0x192)+(_0x455c1e[_0x4d5465(0x111)]?a12_0x47c8b5[_0x4d5465(0x12a)]('new'):_0x455c1e[_0x4d5465(0x130)]?a12_0x47c8b5[_0x4d5465(0x172)](_0x4d5465(0x11d)):a12_0x47c8b5[_0x4d5465(0x13f)](_0x4d5465(0x180)))),0x0;}const _0x5698a8=_0xbdc79a||_0x480591,{data:_0x25bff7}=await withSpinner(_0x4d5465(0x14f)+_0x39df7d+_0x4d5465(0x165),()=>_0x2b0dcf[_0x4d5465(0x100)]['pullProject'](_0x39df7d,_0x5698a8,{'dryRun':!![]})),_0x488ecf=_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x10c)][_0x4d5465(0x16c)]+_0x25bff7['counts'][_0x4d5465(0x189)][_0x4d5465(0x16c)]+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x150)][_0x4d5465(0x16c)]+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x14c)][_0x4d5465(0x16c)],_0x27efe2=_0x25bff7[_0x4d5465(0xf7)]['agents'][_0x4d5465(0x11d)]+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x189)][_0x4d5465(0x11d)]+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x150)][_0x4d5465(0x11d)]+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x14c)]['updated'],_0x50e886=_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x10c)][_0x4d5465(0x180)]+_0x25bff7[_0x4d5465(0xf7)]['knowledgeBases']['unchanged']+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x150)]['unchanged']+_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x14c)][_0x4d5465(0x180)];console[_0x4d5465(0x174)](_0x4d5465(0x125)+_0x25bff7['projectName']+'\x27:'),console[_0x4d5465(0x174)]('\x20\x20'+a12_0x47c8b5['green']('+\x20'+_0x488ecf+'\x20new')+'\x20|\x20'+a12_0x47c8b5[_0x4d5465(0x172)]('~\x20'+_0x27efe2+_0x4d5465(0x17c))+_0x4d5465(0x13a)+a12_0x47c8b5[_0x4d5465(0x14a)]('=\x20'+_0x50e886+_0x4d5465(0x18c))),console[_0x4d5465(0x174)]('\x20\x20Agents:\x20'+formatCountSummary(_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x10c)])),console['log'](_0x4d5465(0x118)+formatCountSummary(_0x25bff7[_0x4d5465(0xf7)]['knowledgeBases'])),console[_0x4d5465(0x174)](_0x4d5465(0x173)+formatCountSummary(_0x25bff7['counts'][_0x4d5465(0x150)])),console[_0x4d5465(0x174)](_0x4d5465(0x124)+formatCountSummary(_0x25bff7[_0x4d5465(0xf7)][_0x4d5465(0x14c)])),console[_0x4d5465(0x174)](_0x4d5465(0x169)+a12_0x47c8b5[_0x4d5465(0x132)](_0x25bff7[_0x4d5465(0xff)])),displayDiffs(_0x25bff7[_0x4d5465(0x10c)],_0x25bff7[_0x4d5465(0x189)],_0x25bff7['textKnowledgeBases'],_0x25bff7[_0x4d5465(0x14c)]);if(_0x7dfad0)return console[_0x4d5465(0x174)](a12_0x47c8b5[_0x4d5465(0x172)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x488ecf===0x0&&_0x27efe2===0x0)return console[_0x4d5465(0x174)](a12_0x47c8b5[_0x4d5465(0x12a)](_0x4d5465(0x186))),saveSessionContext({'llm_project':_0x25bff7['projectName']},_0x3c01eb['session']),console['log'](a12_0x47c8b5['green']('✔\x20Context\x20set:\x20'+a12_0x47c8b5[_0x4d5465(0x14a)](_0x4d5465(0x143))+_0x4d5465(0x135)+a12_0x47c8b5[_0x4d5465(0x132)](_0x25bff7[_0x4d5465(0x15d)]))),0x0;if(!_0x2e2111&&!_0x299b86){const _0x57dfa5=await confirmKey('\x0aWrite\x20'+(_0x488ecf+_0x27efe2)+_0x4d5465(0x10f));if(!_0x57dfa5)return console[_0x4d5465(0x174)](_0x4d5465(0x109)),0x0;}const {data:_0x2f8445}=await withSpinner(_0x4d5465(0x184),()=>_0x2b0dcf['llm']['pullProject'](_0x39df7d,_0x5698a8,{'force':_0x299b86}));return console[_0x4d5465(0x174)](a12_0x47c8b5[_0x4d5465(0x12a)](_0x4d5465(0x15f)+(_0x488ecf+_0x27efe2)+_0x4d5465(0xf8)+_0x2f8445['outputDir'])),saveSessionContext({'llm_project':_0x2f8445[_0x4d5465(0x15d)]},_0x3c01eb['session']),console[_0x4d5465(0x174)](a12_0x47c8b5[_0x4d5465(0x12a)](_0x4d5465(0x13c)+a12_0x47c8b5['dim'](_0x4d5465(0x143))+_0x4d5465(0x135)+a12_0x47c8b5[_0x4d5465(0x132)](_0x2f8445[_0x4d5465(0x15d)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a12_0x3068e7(0x178)]='agent:clone';[a12_0x3068e7(0x144)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a12_0x3068e7(0x17b)](_0x220bee){const _0x3a1280=a12_0x3068e7,{options:_0x335570,args:_0x2af62c,tdx:_0x4c1a3c}=_0x220bee,_0x20eea0=_0x2af62c[0x0],_0x292eac=_0x335570[_0x3a1280(0x178)],_0x6627ee=_0x335570[_0x3a1280(0x102)],_0x6f65ed=_0x335570['yes'],_0x11c826=_0x335570[_0x3a1280(0x113)],_0x6ebcd6=_0x335570[_0x3a1280(0x12d)];let _0x5d9a24;const _0x58ef4e=findAgentConfigPath(process['cwd']());if(_0x20eea0){const _0x3fa75d=a12_0x2188e8['join'](_0x20eea0,_0x3a1280(0x175));existsSync(_0x3fa75d)?(_0x5d9a24=_0x20eea0,console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x14a)](_0x3a1280(0x140)+_0x20eea0))):_0x5d9a24=_0x20eea0;}else{if(_0x58ef4e)_0x5d9a24=a12_0x2188e8[_0x3a1280(0x15e)](_0x58ef4e),console[_0x3a1280(0x174)](a12_0x47c8b5['dim']('Using\x20current\x20project:\x20'+_0x5d9a24));else{if(_0x6ebcd6){const _0x14ea53=normalizeName(_0x6ebcd6),_0x45380f=a12_0x2188e8[_0x3a1280(0x188)](process[_0x3a1280(0x181)](),'agents',_0x14ea53,_0x3a1280(0x175));if(existsSync(_0x45380f))_0x5d9a24=a12_0x2188e8[_0x3a1280(0x15e)](_0x45380f),console['log'](a12_0x47c8b5[_0x3a1280(0x14a)](_0x3a1280(0x140)+_0x5d9a24));else{const _0xe0c1a7=_0x335570[_0x3a1280(0x159)];if(_0xe0c1a7)throw new SDKError(ErrorCode[_0x3a1280(0x148)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x6ebcd6+_0x3a1280(0xfb),undefined,{'helpText':_0x3a1280(0x134)+_0x3a1280(0x151)+('\x20\x20tdx\x20agent\x20pull\x20'+_0x6ebcd6+'\x0a')+(_0x3a1280(0x11c)+_0x14ea53+_0x3a1280(0x14b)+(_0x292eac||_0x3a1280(0x191))+_0x3a1280(0x168)+_0xe0c1a7)});_0x5d9a24=_0x6ebcd6,console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x14a)](_0x3a1280(0x17a)+_0x6ebcd6));}}}}if(!_0x5d9a24)return console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x172)](_0x3a1280(0x153))),console[_0x3a1280(0x174)](_0x3a1280(0x18e)),console[_0x3a1280(0x174)]('\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory'),console[_0x3a1280(0x174)](_0x3a1280(0x103)),console[_0x3a1280(0x174)](_0x3a1280(0x15c)),0x1;if(!_0x292eac)throw new SDKError(ErrorCode[_0x3a1280(0x18f)],_0x3a1280(0x138),undefined,{'helpText':_0x3a1280(0xfc)});if(!_0x6f65ed&&!_0x6627ee){const _0x5d2b87=await confirmKey('Clone\x20\x22'+_0x5d9a24+_0x3a1280(0x133)+_0x292eac+'\x22?');if(!_0x5d2b87)return console[_0x3a1280(0x174)]('Clone\x20cancelled'),0x0;}const {data:_0x323820}=await withSpinner(_0x3a1280(0x105)+_0x5d9a24+_0x3a1280(0x110)+_0x292eac+_0x3a1280(0x165),()=>_0x4c1a3c['llm'][_0x3a1280(0x131)](_0x5d9a24,_0x292eac,{'dryRun':_0x6627ee}));if(_0x6627ee)return console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x172)](_0x3a1280(0x10d))),console[_0x3a1280(0x174)](_0x3a1280(0x114)+_0x323820[_0x3a1280(0x164)]),console[_0x3a1280(0x174)](_0x3a1280(0x119)+_0x292eac),console[_0x3a1280(0x174)]('Would\x20clone:'),console[_0x3a1280(0x174)]('\x20\x20Agents:\x20'+_0x323820[_0x3a1280(0xf7)][_0x3a1280(0x10c)][_0x3a1280(0x146)]),console[_0x3a1280(0x174)](_0x3a1280(0x118)+_0x323820[_0x3a1280(0xf7)]['knowledgeBases']['created']),console[_0x3a1280(0x174)]('\x20\x20Prompts:\x20'+_0x323820[_0x3a1280(0xf7)][_0x3a1280(0x14c)]['created']),0x0;const _0x589956=_0x323820[_0x3a1280(0xf7)][_0x3a1280(0x10c)][_0x3a1280(0x166)]>0x0||_0x323820[_0x3a1280(0xf7)][_0x3a1280(0x189)][_0x3a1280(0x166)]>0x0||_0x323820[_0x3a1280(0xf7)][_0x3a1280(0x14c)][_0x3a1280(0x166)]>0x0;_0x589956?console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x172)]('Project\x20cloned\x20with\x20errors')):console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x12a)](_0x3a1280(0xfe)));console[_0x3a1280(0x174)]('Source:\x20'+_0x323820['sourceProjectName']),console['log'](_0x3a1280(0x119)+_0x323820['newProjectName']),console[_0x3a1280(0x174)](_0x3a1280(0x136)+_0x323820[_0x3a1280(0x120)]),console[_0x3a1280(0x174)](),console['log'](_0x3a1280(0x16f)),console[_0x3a1280(0x174)](_0x3a1280(0x15a)+formatCountSummary(_0x323820[_0x3a1280(0xf7)]['agents'])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x323820[_0x3a1280(0xf7)][_0x3a1280(0x189)])),console[_0x3a1280(0x174)](_0x3a1280(0x124)+formatCountSummary(_0x323820[_0x3a1280(0xf7)]['prompts']));if(_0x589956){console[_0x3a1280(0x174)](),console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x106)](_0x3a1280(0x158)));for(const _0x5ac3e0 of _0x323820[_0x3a1280(0x10c)]){_0x5ac3e0[_0x3a1280(0x18b)]===_0x3a1280(0x139)&&console['log'](a12_0x47c8b5['red']('\x20\x20Agent\x20\x22'+_0x5ac3e0[_0x3a1280(0x116)]+_0x3a1280(0xfa)+_0x5ac3e0[_0x3a1280(0x139)]));}for(const _0x488374 of _0x323820[_0x3a1280(0x189)]){_0x488374[_0x3a1280(0x18b)]===_0x3a1280(0x139)&&console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x106)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x488374['name']+_0x3a1280(0xfa)+_0x488374['error']));}for(const _0xfdc85f of _0x323820[_0x3a1280(0x14c)]){_0xfdc85f[_0x3a1280(0x18b)]===_0x3a1280(0x139)&&console[_0x3a1280(0x174)](a12_0x47c8b5['red'](_0x3a1280(0x145)+_0xfdc85f[_0x3a1280(0x178)]+_0x3a1280(0xfa)+_0xfdc85f[_0x3a1280(0x139)]));}return 0x1;}saveSessionContext({'llm_project':_0x323820[_0x3a1280(0x16a)]},_0x335570[_0x3a1280(0x12b)]),console[_0x3a1280(0x174)](),console[_0x3a1280(0x174)](a12_0x47c8b5[_0x3a1280(0x12a)](_0x3a1280(0x13d)+a12_0x47c8b5[_0x3a1280(0x14a)]('llm_project')+_0x3a1280(0x135)+a12_0x47c8b5[_0x3a1280(0x132)](_0x323820[_0x3a1280(0x16a)])));const _0x5d7932=getLLMProjectUrl(_0x11c826,_0x323820[_0x3a1280(0x120)]);return console[_0x3a1280(0x174)]('Project:\x20'+a12_0x47c8b5[_0x3a1280(0x132)](_0x5d7932)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x3068e7(0x178)]=a12_0x3068e7(0x128);[a12_0x3068e7(0x144)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a12_0x3068e7(0x17b)](_0x10fb5b){const _0x47409e=a12_0x3068e7,{options:_0x33f7bb,args:_0x499adc,tdx:_0x2b192f}=_0x10fb5b;let _0x1e0368=_0x499adc[0x0]||process[_0x47409e(0x181)]();const _0x5ebae1=_0x33f7bb[_0x47409e(0x102)],_0x31c754=_0x33f7bb[_0x47409e(0x155)],_0x48681b=_0x33f7bb[_0x47409e(0x10e)],_0x3759a4=_0x33f7bb[_0x47409e(0x113)],_0x579091=a12_0x2188e8[_0x47409e(0x188)](_0x1e0368,'agent.yml'),_0x371a12=existsSync(_0x579091);if(_0x371a12){const {data:_0x9ac4a2}=await withSpinner(_0x47409e(0x129)+_0x1e0368+'\x22...',()=>_0x2b192f[_0x47409e(0x100)]['pushAgent'](_0x1e0368,{'dryRun':_0x5ebae1,'force':_0x31c754}));if(_0x5ebae1)return console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x172)](_0x47409e(0x10d))),console[_0x47409e(0x174)](_0x47409e(0x176)+_0x9ac4a2['agentName']),0x0;if(_0x9ac4a2[_0x47409e(0x18b)]===_0x47409e(0x139))return console['log'](a12_0x47c8b5[_0x47409e(0x106)](_0x47409e(0x163)+_0x9ac4a2['error'])),0x1;console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x12a)](_0x47409e(0x182)+_0x9ac4a2[_0x47409e(0x18b)]+'\x20successfully')),console['log'](_0x47409e(0x11b)+_0x9ac4a2[_0x47409e(0x116)]);if(_0x9ac4a2['agentId']&&_0x9ac4a2[_0x47409e(0x16e)]){const _0x34d6d0=getLLMAgentChatUrl(_0x3759a4,_0x9ac4a2[_0x47409e(0x16e)],_0x9ac4a2[_0x47409e(0x161)]);console[_0x47409e(0x174)](_0x47409e(0x13e)+a12_0x47c8b5['cyan'](_0x34d6d0));}return 0x0;}let _0x1392b1=a12_0x2188e8['join'](_0x1e0368,'tdx.json');if(!existsSync(_0x1392b1)){const _0x52fc42=findAgentConfigPath(_0x1e0368);if(_0x52fc42)_0x1e0368=a12_0x2188e8[_0x47409e(0x15e)](_0x52fc42),_0x1392b1=_0x52fc42,console[_0x47409e(0x174)](a12_0x47c8b5['dim'](_0x47409e(0x117)+_0x1e0368));else{const _0x148932=_0x33f7bb['llmProject'];if(_0x148932){const _0x344adb=normalizeName(_0x148932),_0x53854d=a12_0x2188e8[_0x47409e(0x188)](_0x1e0368,_0x47409e(0x10c)),_0x370c3a=a12_0x2188e8['join'](_0x53854d,_0x344adb,_0x47409e(0x175));existsSync(_0x370c3a)&&(_0x1e0368=a12_0x2188e8[_0x47409e(0x15e)](_0x370c3a),_0x1392b1=_0x370c3a,console[_0x47409e(0x174)](a12_0x47c8b5['dim'](_0x47409e(0x117)+_0x1e0368)));}if(!existsSync(_0x1392b1)){let _0x5d86e2='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0x148932&&(_0x5d86e2=_0x47409e(0x141)+_0x148932+_0x47409e(0x12e)+(_0x47409e(0x160)+_0x148932+_0x47409e(0xfd)));throw new SDKError(ErrorCode[_0x47409e(0x148)],_0x47409e(0xf9)+_0x1e0368,undefined,{'helpText':_0x5d86e2});}}}const {data:_0x2ab01b}=await withSpinner(_0x47409e(0x10b),()=>_0x2b192f['llm']['pushProject'](_0x1e0368,{'dryRun':!![]})),_0x17e1ff=_0x2ab01b['counts']['agents'][_0x47409e(0x166)]>0x0;if(_0x17e1ff){console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x106)]('\x0aErrors\x20found:'));for(const _0x5c0aef of _0x2ab01b[_0x47409e(0x10c)]){_0x5c0aef['action']===_0x47409e(0x139)&&console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x106)](_0x47409e(0x16b)+_0x5c0aef[_0x47409e(0x116)]+_0x47409e(0xfa)+_0x5c0aef[_0x47409e(0x139)]));}return 0x1;}const _0x2fcc07=_0x2ab01b['counts'][_0x47409e(0x10c)][_0x47409e(0x146)]+_0x2ab01b[_0x47409e(0xf7)][_0x47409e(0x189)][_0x47409e(0x146)]+_0x2ab01b['counts'][_0x47409e(0x150)][_0x47409e(0x146)]+_0x2ab01b[_0x47409e(0xf7)]['prompts'][_0x47409e(0x146)],_0x59022d=_0x2ab01b['counts']['agents'][_0x47409e(0x11d)]+_0x2ab01b[_0x47409e(0xf7)]['knowledgeBases']['updated']+_0x2ab01b[_0x47409e(0xf7)][_0x47409e(0x150)][_0x47409e(0x11d)]+_0x2ab01b[_0x47409e(0xf7)]['prompts'][_0x47409e(0x11d)],_0x581b43=_0x2ab01b[_0x47409e(0xf7)][_0x47409e(0x10c)][_0x47409e(0x180)]+_0x2ab01b[_0x47409e(0xf7)]['knowledgeBases'][_0x47409e(0x180)]+_0x2ab01b[_0x47409e(0xf7)][_0x47409e(0x150)]['unchanged']+_0x2ab01b['counts'][_0x47409e(0x14c)][_0x47409e(0x180)];console[_0x47409e(0x174)](_0x47409e(0x12c)+_0x2ab01b[_0x47409e(0x15d)]+'\x27:'),console['log']('\x20\x20'+a12_0x47c8b5['green']('+\x20'+_0x2fcc07+_0x47409e(0x190))+_0x47409e(0x13a)+a12_0x47c8b5[_0x47409e(0x172)]('~\x20'+_0x59022d+_0x47409e(0x17c))+_0x47409e(0x13a)+a12_0x47c8b5[_0x47409e(0x14a)]('=\x20'+_0x581b43+'\x20unchanged')),console['log'](_0x47409e(0x15a)+formatCountSummary(_0x2ab01b[_0x47409e(0xf7)]['agents'])),console['log'](_0x47409e(0x118)+formatCountSummary(_0x2ab01b['counts'][_0x47409e(0x189)])),console['log']('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2ab01b[_0x47409e(0xf7)][_0x47409e(0x150)])),console[_0x47409e(0x174)](_0x47409e(0x124)+formatCountSummary(_0x2ab01b['counts'][_0x47409e(0x14c)])),console['log'](_0x47409e(0x147)+a12_0x47c8b5[_0x47409e(0x132)](_0x1e0368)),displayDiffs(_0x2ab01b[_0x47409e(0x10c)],_0x2ab01b[_0x47409e(0x189)],_0x2ab01b['textKnowledgeBases'],_0x2ab01b[_0x47409e(0x14c)]);if(_0x5ebae1)return console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x172)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x2fcc07===0x0&&_0x59022d===0x0){console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x12a)](_0x47409e(0x101)));const _0x409f7a=getLLMProjectUrl(_0x3759a4,_0x2ab01b[_0x47409e(0x16e)]);return console[_0x47409e(0x174)](_0x47409e(0x122)+a12_0x47c8b5['cyan'](_0x409f7a)),0x0;}if(!_0x48681b&&!_0x31c754){const _0x25529f=await confirmKey(_0x47409e(0x187)+(_0x2fcc07+_0x59022d)+_0x47409e(0x121));if(!_0x25529f)return console[_0x47409e(0x174)](_0x47409e(0x14e)),0x0;}const {data:_0x5ea680}=await withSpinner(_0x47409e(0x177),()=>_0x2b192f['llm'][_0x47409e(0x170)](_0x1e0368,{'force':_0x31c754})),_0x5eae19=_0x5ea680['counts'][_0x47409e(0x10c)][_0x47409e(0x166)]>0x0||_0x5ea680[_0x47409e(0xf7)][_0x47409e(0x189)][_0x47409e(0x166)]>0x0||_0x5ea680[_0x47409e(0xf7)]['textKnowledgeBases']['errors']>0x0||_0x5ea680['counts'][_0x47409e(0x14c)][_0x47409e(0x166)]>0x0;if(_0x5eae19){console['log'](a12_0x47c8b5[_0x47409e(0x172)](_0x47409e(0x18d))),console[_0x47409e(0x174)](),console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x106)](_0x47409e(0x158)));for(const _0xdaf7ec of _0x5ea680[_0x47409e(0x10c)]){_0xdaf7ec[_0x47409e(0x18b)]===_0x47409e(0x139)&&console[_0x47409e(0x174)](a12_0x47c8b5['red'](_0x47409e(0x16b)+_0xdaf7ec[_0x47409e(0x116)]+_0x47409e(0xfa)+_0xdaf7ec[_0x47409e(0x139)]));}for(const _0x1923aa of _0x5ea680[_0x47409e(0x189)]){_0x1923aa[_0x47409e(0x18b)]===_0x47409e(0x139)&&console[_0x47409e(0x174)](a12_0x47c8b5['red'](_0x47409e(0x12f)+_0x1923aa[_0x47409e(0x178)]+_0x47409e(0xfa)+_0x1923aa['error']));}for(const _0xe81b42 of _0x5ea680['textKnowledgeBases']){_0xe81b42[_0x47409e(0x18b)]===_0x47409e(0x139)&&console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x106)](_0x47409e(0x127)+_0xe81b42['name']+_0x47409e(0xfa)+_0xe81b42[_0x47409e(0x139)]));}for(const _0x1b92a7 of _0x5ea680[_0x47409e(0x14c)]){_0x1b92a7[_0x47409e(0x18b)]===_0x47409e(0x139)&&console['log'](a12_0x47c8b5['red'](_0x47409e(0x145)+_0x1b92a7[_0x47409e(0x178)]+_0x47409e(0xfa)+_0x1b92a7[_0x47409e(0x139)]));}return 0x1;}console[_0x47409e(0x174)](a12_0x47c8b5[_0x47409e(0x12a)]('\x0a✔\x20Pushed\x20'+(_0x2fcc07+_0x59022d)+_0x47409e(0x15b)+_0x5ea680[_0x47409e(0x15d)]+'\x27'));const _0x377391=getLLMProjectUrl(_0x3759a4,_0x5ea680[_0x47409e(0x16e)]);return console[_0x47409e(0x174)](_0x47409e(0x122)+a12_0x47c8b5[_0x47409e(0x132)](_0x377391)),0x0;}}
|
|
1
|
+
const a12_0x1740f0=a12_0xf65b;(function(_0x5a4caa,_0x359a8e){const _0x2afc14=a12_0xf65b,_0x1c23ab=_0x5a4caa();while(!![]){try{const _0x38473f=parseInt(_0x2afc14(0x168))/0x1+-parseInt(_0x2afc14(0x1e6))/0x2+parseInt(_0x2afc14(0x1e1))/0x3+parseInt(_0x2afc14(0x1c7))/0x4*(-parseInt(_0x2afc14(0x1f5))/0x5)+-parseInt(_0x2afc14(0x15c))/0x6+parseInt(_0x2afc14(0x155))/0x7+-parseInt(_0x2afc14(0x1e5))/0x8*(parseInt(_0x2afc14(0x17c))/0x9);if(_0x38473f===_0x359a8e)break;else _0x1c23ab['push'](_0x1c23ab['shift']());}catch(_0x3a58d5){_0x1c23ab['push'](_0x1c23ab['shift']());}}}(a12_0x4aee,0x8d437));import a12_0xea4ea9 from'chalk';import a12_0x4816fb from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../utils/agent-config.js';function a12_0xf65b(_0x334e01,_0x52a4fd){_0x334e01=_0x334e01-0x155;const _0x4aee4f=a12_0x4aee();let _0xf65bca=_0x4aee4f[_0x334e01];return _0xf65bca;}import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';function a12_0x4aee(){const _0x2f95e1=['Using\x20project:\x20','Cannot\x20clone\x20from\x20context\x20project\x20\x22','red','\x20changed','Analyzing\x20project\x20\x22','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x20\x20Source:\x20','action','\x0aErrors\x20found:','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','join','output','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','Writing\x20files...','created','Dry\x20run\x20-\x20no\x20changes\x20made','\x22\x20to\x20a\x20different\x20profile','Project\x20cloned\x20successfully','utf-8','\x0aWrite\x20','New\x20project\x20ID:\x20','new','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','execute','No\x20tdx.json\x20found\x20in\x20','\x20\x20Text\x20Knowledge\x20Bases:\x20','gray','pullProject','unchanged','agents','Pulling\x20agent\x20\x22','site','Pull\x20cancelled','Cloning\x20\x22','Using\x20local\x20project:\x20','diff','Pushing\x20to\x20project...','newProjectId','\x0aChanges\x20to\x20prompt\x20\x27','newProjectName','llmProject','updated','textKnowledgeBases','\x0aChanges:','774232USgvZC','agentId','prompts','\x20files\x20to\x20','name','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20\x20Target:\x20','pushAgent','\x22\x20to\x20new\x20project\x20\x22','\x20\x20Prompts:\x20','llm','green','INVALID_ARGUMENT','\x20successfully','\x20=\x20','hasChanges','pullAgent','\x20unchanged','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','Chat:\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','<new-name>','New\x20project:\x20','Would\x20clone:','Analyzing\x20changes\x20to\x20push...','Project\x20cloned\x20with\x20errors','1939509QdhMlj','Failed\x20to\x20push\x20agent:\x20','dim','outputDir','16rZgART','257574vjBMSy','\x20files?','Clone\x20\x22','✔\x20Context\x20set:\x20','total','\x22...','\x20total','log','\x0aPush\x20','push','pushProject','New\x20project\x20name\x20is\x20required','\x20\x20tdx\x20agent\x20pull\x20','\x20--name\x20','\x0aProject\x20pushed\x20with\x20errors','5qyushf','repeat','projectName','3142762qBqTjl','\x0a✔\x20Pushed\x20','cwd','Project:\x20','dryRun','parse','description','3837108rTckGO','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','dirname','Source:\x20','\x0aPull\x20summary\x20for\x20\x27','Push\x20cancelled','\x20\x20Prompt\x20\x22','isNew','tdx.json','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','yes','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','451841QWRpUn','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','llm_project','cyan','\x20\x20Agents:\x20','agent:clone','profile','Summary:','agentName','Using\x20context\x20project:\x20','error','Agent\x20','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','Would\x20push\x20agent:\x20','\x20\x20Knowledge\x20Bases:\x20','\x20|\x20','counts','sourceProjectName','\x22:\x20','outputPath','30744XmURrc','\x22\x20from\x20project\x20\x22','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Agent:\x20','Errors:','\x27\x20to\x20create\x20the\x20folder\x20structure.','agent:pull','MISSING_ARGUMENT','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x20created','\x20\x20Agent\x20\x22','\x20new','Output\x20path:\x20','agent:push','Current\x20context\x20has\x20llm_project=\x22','Using\x20current\x20project:\x20','yellow','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','session','agent.yml','Status:\x20','cloneProject','knowledgeBases','\x20\x20Knowledge\x20Base\x20\x22','errors','force','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x0aChanges\x20to\x20agent\x20\x27','projectId','Pushing\x20agent\x20from\x20\x22'];a12_0x4aee=function(){return _0x2f95e1;};return a12_0x4aee();}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function formatCountSummary(_0x469a55){const _0x347167=a12_0xf65b,_0x35d190=[];if(_0x469a55[_0x347167(0x1ea)]!==undefined)_0x35d190[_0x347167(0x1ef)](_0x469a55[_0x347167(0x1ea)]+_0x347167(0x1ec));if(_0x469a55[_0x347167(0x1b0)]!==undefined&&_0x469a55['new']>0x0)_0x35d190['push'](a12_0xea4ea9[_0x347167(0x1d2)](_0x469a55[_0x347167(0x1b0)]+_0x347167(0x187)));if(_0x469a55[_0x347167(0x1a9)]!==undefined&&_0x469a55['created']>0x0)_0x35d190[_0x347167(0x1ef)](a12_0xea4ea9[_0x347167(0x1d2)](_0x469a55[_0x347167(0x1a9)]+_0x347167(0x185)));if(_0x469a55[_0x347167(0x1c4)]!==undefined&&_0x469a55[_0x347167(0x1c4)]>0x0)_0x35d190[_0x347167(0x1ef)](a12_0xea4ea9[_0x347167(0x18c)](_0x469a55[_0x347167(0x1c4)]+'\x20updated'));if(_0x469a55[_0x347167(0x1b7)]!==undefined&&_0x469a55[_0x347167(0x1b7)]>0x0)_0x35d190[_0x347167(0x1ef)](a12_0xea4ea9[_0x347167(0x1b5)](_0x469a55['unchanged']+_0x347167(0x1d8)));if(_0x469a55['errors']!==undefined&&_0x469a55[_0x347167(0x194)]>0x0)_0x35d190[_0x347167(0x1ef)](a12_0xea4ea9['red'](_0x469a55['errors']+'\x20errors'));return _0x35d190[_0x347167(0x1a5)](',\x20');}function displayDiffs(_0x7b2988,_0x2216f6,_0x52a5d0,_0x46a4d0){const _0x37a5a8=a12_0xf65b;for(const _0x18123c of _0x7b2988){if(_0x18123c[_0x37a5a8(0x1be)]){const _0x371a50=_0x18123c[_0x37a5a8(0x170)]||_0x18123c[_0x37a5a8(0x1cb)];console[_0x37a5a8(0x1ed)](_0x37a5a8(0x197)+_0x371a50+'\x27:'),console[_0x37a5a8(0x1ed)]('─'[_0x37a5a8(0x1f6)](0x3c)),console[_0x37a5a8(0x1ed)](_0x18123c['diff']),console[_0x37a5a8(0x1ed)]('─'[_0x37a5a8(0x1f6)](0x3c));}}for(const _0x141c63 of _0x2216f6){_0x141c63[_0x37a5a8(0x1be)]&&(console[_0x37a5a8(0x1ed)](_0x37a5a8(0x18d)+_0x141c63[_0x37a5a8(0x1cb)]+'\x27:'),console[_0x37a5a8(0x1ed)]('─'[_0x37a5a8(0x1f6)](0x3c)),console[_0x37a5a8(0x1ed)](_0x141c63[_0x37a5a8(0x1be)]),console[_0x37a5a8(0x1ed)]('─'[_0x37a5a8(0x1f6)](0x3c)));}for(const _0x2d9e75 of _0x52a5d0){_0x2d9e75[_0x37a5a8(0x1be)]&&(console['log']('\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27'+_0x2d9e75[_0x37a5a8(0x1cb)]+'\x27:'),console[_0x37a5a8(0x1ed)]('─'[_0x37a5a8(0x1f6)](0x3c)),console[_0x37a5a8(0x1ed)](_0x2d9e75[_0x37a5a8(0x1be)]),console['log']('─'['repeat'](0x3c)));}for(const _0x3c5a0a of _0x46a4d0){_0x3c5a0a[_0x37a5a8(0x1be)]&&(console[_0x37a5a8(0x1ed)](_0x37a5a8(0x1c1)+_0x3c5a0a[_0x37a5a8(0x1cb)]+'\x27:'),console['log']('─'[_0x37a5a8(0x1f6)](0x3c)),console[_0x37a5a8(0x1ed)](_0x3c5a0a[_0x37a5a8(0x1be)]),console[_0x37a5a8(0x1ed)]('─'[_0x37a5a8(0x1f6)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a12_0x1740f0(0x1cb)]=a12_0x1740f0(0x182);[a12_0x1740f0(0x15b)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async['execute'](_0x40ea01){const _0x26ef39=a12_0x1740f0,{options:_0x3b11f0,args:_0x2ea521,tdx:_0x3e42e5}=_0x40ea01,_0x562474=_0x2ea521[0x0],_0x4c52ca=_0x2ea521[0x1],_0x4d7bf9=_0x3b11f0[_0x26ef39(0x1a6)],_0x18ed45=_0x3b11f0[_0x26ef39(0x159)],_0xb8874d=_0x3b11f0['force'],_0x156067=_0x3b11f0[_0x26ef39(0x166)],_0x3f2881=_0x3b11f0[_0x26ef39(0x1c3)];let _0x3c76da,_0x33c5f4;const _0x3df00a=findAgentConfigPath(process[_0x26ef39(0x157)]());if(_0x562474){const _0x5d3f67=a12_0x4816fb[_0x26ef39(0x1a5)](_0x562474,'tdx.json');if(existsSync(_0x5d3f67))try{const _0x58f327=JSON['parse'](readFileSync(_0x5d3f67,_0x26ef39(0x1ad)));_0x3c76da=_0x58f327['llm_project'],_0x33c5f4=_0x562474,console['log'](a12_0xea4ea9[_0x26ef39(0x1e3)]('Using\x20project\x20from\x20'+_0x5d3f67+':\x20'+_0x3c76da));}catch{_0x3c76da=_0x562474;}else _0x3c76da=_0x562474;}else{if(_0x3df00a)try{const _0x36625d=JSON[_0x26ef39(0x15a)](readFileSync(_0x3df00a,_0x26ef39(0x1ad)));_0x3c76da=_0x36625d[_0x26ef39(0x16a)],_0x33c5f4=a12_0x4816fb['dirname'](_0x3df00a),console[_0x26ef39(0x1ed)](a12_0xea4ea9[_0x26ef39(0x1e3)](_0x26ef39(0x19a)+_0x3c76da));}catch{_0x3c76da=_0x3f2881;}else _0x3c76da=_0x3f2881;}if(!_0x3c76da)return console[_0x26ef39(0x1ed)](a12_0xea4ea9[_0x26ef39(0x18c)](_0x26ef39(0x15d))),console[_0x26ef39(0x1ed)]('Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x26ef39(0x1ed)](_0x26ef39(0x1d9)),console['log']('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory'),console[_0x26ef39(0x1ed)](_0x26ef39(0x196)),0x1;if(_0x4c52ca){const {data:_0x16924f}=await withSpinner(_0x26ef39(0x1b9)+_0x4c52ca+_0x26ef39(0x17d)+_0x3c76da+_0x26ef39(0x1eb),()=>_0x3e42e5[_0x26ef39(0x1d1)][_0x26ef39(0x1d7)](_0x3c76da,_0x4c52ca,_0x4d7bf9,{'dryRun':_0x18ed45,'force':_0xb8874d}));if(_0x18ed45)return console['log'](a12_0xea4ea9[_0x26ef39(0x18c)]('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0x26ef39(0x1ed)]('Would\x20pull\x20agent:\x20'+_0x16924f['agentName']),console[_0x26ef39(0x1ed)](_0x26ef39(0x188)+_0x16924f['outputPath']),_0x16924f[_0x26ef39(0x1be)]&&(console['log'](_0x26ef39(0x1c6)),console[_0x26ef39(0x1ed)]('─'[_0x26ef39(0x1f6)](0x3c)),console[_0x26ef39(0x1ed)](_0x16924f['diff']),console[_0x26ef39(0x1ed)]('─'[_0x26ef39(0x1f6)](0x3c))),0x0;return console['log'](a12_0xea4ea9[_0x26ef39(0x1d2)]('Agent\x20pulled\x20successfully')),console[_0x26ef39(0x1ed)]('Agent:\x20'+_0x16924f['agentName']),console['log']('Output:\x20'+_0x16924f[_0x26ef39(0x17b)]),console[_0x26ef39(0x1ed)](_0x26ef39(0x190)+(_0x16924f[_0x26ef39(0x163)]?a12_0xea4ea9[_0x26ef39(0x1d2)]('new'):_0x16924f[_0x26ef39(0x1d6)]?a12_0xea4ea9[_0x26ef39(0x18c)](_0x26ef39(0x1c4)):a12_0xea4ea9[_0x26ef39(0x1b5)](_0x26ef39(0x1b7)))),0x0;}const _0x2d614a=_0x33c5f4||_0x4d7bf9,{data:_0x53d288}=await withSpinner(_0x26ef39(0x19e)+_0x3c76da+'\x22...',()=>_0x3e42e5['llm'][_0x26ef39(0x1b6)](_0x3c76da,_0x2d614a,{'dryRun':!![]})),_0x4e63a9=_0x53d288[_0x26ef39(0x178)]['agents']['new']+_0x53d288[_0x26ef39(0x178)]['knowledgeBases']['new']+_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x1c5)][_0x26ef39(0x1b0)]+_0x53d288[_0x26ef39(0x178)]['prompts'][_0x26ef39(0x1b0)],_0x242422=_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x1b8)][_0x26ef39(0x1c4)]+_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x192)][_0x26ef39(0x1c4)]+_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x1c5)][_0x26ef39(0x1c4)]+_0x53d288['counts'][_0x26ef39(0x1c9)][_0x26ef39(0x1c4)],_0x3a812f=_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x1b8)][_0x26ef39(0x1b7)]+_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x192)][_0x26ef39(0x1b7)]+_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x1c5)][_0x26ef39(0x1b7)]+_0x53d288[_0x26ef39(0x178)]['prompts'][_0x26ef39(0x1b7)];console[_0x26ef39(0x1ed)](_0x26ef39(0x160)+_0x53d288[_0x26ef39(0x1f7)]+'\x27:'),console[_0x26ef39(0x1ed)]('\x20\x20'+a12_0xea4ea9[_0x26ef39(0x1d2)]('+\x20'+_0x4e63a9+_0x26ef39(0x187))+_0x26ef39(0x177)+a12_0xea4ea9[_0x26ef39(0x18c)]('~\x20'+_0x242422+_0x26ef39(0x19d))+'\x20|\x20'+a12_0xea4ea9[_0x26ef39(0x1e3)]('=\x20'+_0x3a812f+'\x20unchanged')),console['log'](_0x26ef39(0x16c)+formatCountSummary(_0x53d288[_0x26ef39(0x178)]['agents'])),console[_0x26ef39(0x1ed)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x53d288['counts'][_0x26ef39(0x192)])),console[_0x26ef39(0x1ed)](_0x26ef39(0x1b4)+formatCountSummary(_0x53d288[_0x26ef39(0x178)][_0x26ef39(0x1c5)])),console[_0x26ef39(0x1ed)](_0x26ef39(0x1d0)+formatCountSummary(_0x53d288['counts'][_0x26ef39(0x1c9)])),console[_0x26ef39(0x1ed)](_0x26ef39(0x1cd)+a12_0xea4ea9[_0x26ef39(0x16b)](_0x53d288[_0x26ef39(0x1e4)])),displayDiffs(_0x53d288[_0x26ef39(0x1b8)],_0x53d288[_0x26ef39(0x192)],_0x53d288[_0x26ef39(0x1c5)],_0x53d288[_0x26ef39(0x1c9)]);if(_0x18ed45)return console[_0x26ef39(0x1ed)](a12_0xea4ea9[_0x26ef39(0x18c)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x4e63a9===0x0&&_0x242422===0x0)return console[_0x26ef39(0x1ed)](a12_0xea4ea9[_0x26ef39(0x1d2)](_0x26ef39(0x1b1))),saveSessionContext({'llm_project':_0x53d288[_0x26ef39(0x1f7)]},_0x3b11f0[_0x26ef39(0x18e)]),console['log'](a12_0xea4ea9['green'](_0x26ef39(0x1e9)+a12_0xea4ea9[_0x26ef39(0x1e3)](_0x26ef39(0x16a))+_0x26ef39(0x1d5)+a12_0xea4ea9[_0x26ef39(0x16b)](_0x53d288[_0x26ef39(0x1f7)]))),0x0;if(!_0x156067&&!_0xb8874d){const _0x520fed=await confirmKey(_0x26ef39(0x1ae)+(_0x4e63a9+_0x242422)+_0x26ef39(0x1e7));if(!_0x520fed)return console[_0x26ef39(0x1ed)](_0x26ef39(0x1bb)),0x0;}const {data:_0x5341f3}=await withSpinner(_0x26ef39(0x1a8),()=>_0x3e42e5[_0x26ef39(0x1d1)]['pullProject'](_0x3c76da,_0x2d614a,{'force':_0xb8874d}));return console['log'](a12_0xea4ea9[_0x26ef39(0x1d2)]('\x0a✔\x20Pulled\x20'+(_0x4e63a9+_0x242422)+_0x26ef39(0x1ca)+_0x5341f3[_0x26ef39(0x1e4)])),saveSessionContext({'llm_project':_0x5341f3[_0x26ef39(0x1f7)]},_0x3b11f0[_0x26ef39(0x18e)]),console[_0x26ef39(0x1ed)](a12_0xea4ea9[_0x26ef39(0x1d2)](_0x26ef39(0x1e9)+a12_0xea4ea9[_0x26ef39(0x1e3)]('llm_project')+_0x26ef39(0x1d5)+a12_0xea4ea9[_0x26ef39(0x16b)](_0x5341f3[_0x26ef39(0x1f7)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a12_0x1740f0(0x1cb)]=a12_0x1740f0(0x16d);[a12_0x1740f0(0x15b)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a12_0x1740f0(0x1b2)](_0x2d3640){const _0x24bfef=a12_0x1740f0,{options:_0x15cca2,args:_0x1266d9,tdx:_0x31602a}=_0x2d3640,_0x37db62=_0x1266d9[0x0],_0x332987=_0x15cca2['name'],_0x58059a=_0x15cca2['dryRun'],_0x510eda=_0x15cca2[_0x24bfef(0x166)],_0x3626d5=_0x15cca2[_0x24bfef(0x1ba)],_0x1ea543=_0x15cca2[_0x24bfef(0x1c3)];let _0x386575;const _0x1ff733=findAgentConfigPath(process[_0x24bfef(0x157)]());if(_0x37db62){const _0x64a0cc=a12_0x4816fb[_0x24bfef(0x1a5)](_0x37db62,_0x24bfef(0x164));existsSync(_0x64a0cc)?(_0x386575=_0x37db62,console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x1e3)]('Using\x20local\x20project:\x20'+_0x37db62))):_0x386575=_0x37db62;}else{if(_0x1ff733)_0x386575=a12_0x4816fb['dirname'](_0x1ff733),console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x1e3)](_0x24bfef(0x18b)+_0x386575));else{if(_0x1ea543){const _0x57671c=normalizeName(_0x1ea543),_0x3b3dc8=a12_0x4816fb['join'](process[_0x24bfef(0x157)](),_0x24bfef(0x1b8),_0x57671c,_0x24bfef(0x164));if(existsSync(_0x3b3dc8))_0x386575=a12_0x4816fb[_0x24bfef(0x15e)](_0x3b3dc8),console['log'](a12_0xea4ea9[_0x24bfef(0x1e3)](_0x24bfef(0x1bd)+_0x386575));else{const _0x1f5f4d=_0x15cca2[_0x24bfef(0x16e)];if(_0x1f5f4d)throw new SDKError(ErrorCode[_0x24bfef(0x1d3)],_0x24bfef(0x19b)+_0x1ea543+_0x24bfef(0x1ab),undefined,{'helpText':_0x24bfef(0x1a4)+_0x24bfef(0x184)+(_0x24bfef(0x1f2)+_0x1ea543+'\x0a')+(_0x24bfef(0x1db)+_0x57671c+_0x24bfef(0x1f3)+(_0x332987||_0x24bfef(0x1dc))+'\x20--profile\x20'+_0x1f5f4d)});_0x386575=_0x1ea543,console[_0x24bfef(0x1ed)](a12_0xea4ea9['dim'](_0x24bfef(0x171)+_0x1ea543));}}}}if(!_0x386575)return console['log'](a12_0xea4ea9[_0x24bfef(0x18c)](_0x24bfef(0x165))),console[_0x24bfef(0x1ed)](_0x24bfef(0x167)),console[_0x24bfef(0x1ed)](_0x24bfef(0x1cc)),console['log'](_0x24bfef(0x1a7)),console[_0x24bfef(0x1ed)](_0x24bfef(0x19f)),0x1;if(!_0x332987)throw new SDKError(ErrorCode[_0x24bfef(0x183)],_0x24bfef(0x1f1),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x510eda&&!_0x58059a){const _0x118e22=await confirmKey(_0x24bfef(0x1e8)+_0x386575+_0x24bfef(0x1cf)+_0x332987+'\x22?');if(!_0x118e22)return console[_0x24bfef(0x1ed)]('Clone\x20cancelled'),0x0;}const {data:_0x5629bb}=await withSpinner(_0x24bfef(0x1bc)+_0x386575+'\x22\x20to\x20\x22'+_0x332987+'\x22...',()=>_0x31602a['llm'][_0x24bfef(0x191)](_0x386575,_0x332987,{'dryRun':_0x58059a}));if(_0x58059a)return console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x18c)](_0x24bfef(0x1aa))),console[_0x24bfef(0x1ed)](_0x24bfef(0x15f)+_0x5629bb['sourceProjectName']),console['log'](_0x24bfef(0x1dd)+_0x332987),console[_0x24bfef(0x1ed)](_0x24bfef(0x1de)),console[_0x24bfef(0x1ed)]('\x20\x20Agents:\x20'+_0x5629bb[_0x24bfef(0x178)][_0x24bfef(0x1b8)]['created']),console[_0x24bfef(0x1ed)](_0x24bfef(0x176)+_0x5629bb['counts']['knowledgeBases'][_0x24bfef(0x1a9)]),console[_0x24bfef(0x1ed)](_0x24bfef(0x1d0)+_0x5629bb['counts'][_0x24bfef(0x1c9)][_0x24bfef(0x1a9)]),0x0;const _0x1b4b7b=_0x5629bb[_0x24bfef(0x178)][_0x24bfef(0x1b8)][_0x24bfef(0x194)]>0x0||_0x5629bb['counts'][_0x24bfef(0x192)][_0x24bfef(0x194)]>0x0||_0x5629bb[_0x24bfef(0x178)][_0x24bfef(0x1c9)][_0x24bfef(0x194)]>0x0;_0x1b4b7b?console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x18c)](_0x24bfef(0x1e0))):console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x1d2)](_0x24bfef(0x1ac)));console['log'](_0x24bfef(0x15f)+_0x5629bb[_0x24bfef(0x179)]),console[_0x24bfef(0x1ed)](_0x24bfef(0x1dd)+_0x5629bb[_0x24bfef(0x1c2)]),console['log'](_0x24bfef(0x1af)+_0x5629bb['newProjectId']),console[_0x24bfef(0x1ed)](),console['log'](_0x24bfef(0x16f)),console[_0x24bfef(0x1ed)](_0x24bfef(0x16c)+formatCountSummary(_0x5629bb[_0x24bfef(0x178)][_0x24bfef(0x1b8)])),console[_0x24bfef(0x1ed)](_0x24bfef(0x176)+formatCountSummary(_0x5629bb['counts'][_0x24bfef(0x192)])),console[_0x24bfef(0x1ed)](_0x24bfef(0x1d0)+formatCountSummary(_0x5629bb[_0x24bfef(0x178)][_0x24bfef(0x1c9)]));if(_0x1b4b7b){console[_0x24bfef(0x1ed)](),console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x19c)](_0x24bfef(0x180)));for(const _0x49de30 of _0x5629bb[_0x24bfef(0x1b8)]){_0x49de30[_0x24bfef(0x1a2)]===_0x24bfef(0x172)&&console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x19c)](_0x24bfef(0x186)+_0x49de30[_0x24bfef(0x170)]+_0x24bfef(0x17a)+_0x49de30[_0x24bfef(0x172)]));}for(const _0x9a26bc of _0x5629bb[_0x24bfef(0x192)]){_0x9a26bc['action']==='error'&&console['log'](a12_0xea4ea9[_0x24bfef(0x19c)](_0x24bfef(0x193)+_0x9a26bc[_0x24bfef(0x1cb)]+'\x22:\x20'+_0x9a26bc[_0x24bfef(0x172)]));}for(const _0x3a7747 of _0x5629bb['prompts']){_0x3a7747[_0x24bfef(0x1a2)]===_0x24bfef(0x172)&&console[_0x24bfef(0x1ed)](a12_0xea4ea9[_0x24bfef(0x19c)]('\x20\x20Prompt\x20\x22'+_0x3a7747[_0x24bfef(0x1cb)]+_0x24bfef(0x17a)+_0x3a7747[_0x24bfef(0x172)]));}return 0x1;}saveSessionContext({'llm_project':_0x5629bb[_0x24bfef(0x1c2)]},_0x15cca2[_0x24bfef(0x18e)]),console[_0x24bfef(0x1ed)](),console['log'](a12_0xea4ea9[_0x24bfef(0x1d2)]('Context\x20set:\x20'+a12_0xea4ea9['dim'](_0x24bfef(0x16a))+_0x24bfef(0x1d5)+a12_0xea4ea9[_0x24bfef(0x16b)](_0x5629bb[_0x24bfef(0x1c2)])));const _0xa81ed2=getLLMProjectUrl(_0x3626d5,_0x5629bb[_0x24bfef(0x1c0)]);return console['log'](_0x24bfef(0x158)+a12_0xea4ea9['cyan'](_0xa81ed2)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x1740f0(0x1cb)]=a12_0x1740f0(0x189);[a12_0x1740f0(0x15b)]=a12_0x1740f0(0x17e);async['execute'](_0x1723c0){const _0x1e6e5d=a12_0x1740f0,{options:_0x5ef691,args:_0xd73314,tdx:_0x18c554}=_0x1723c0;let _0x18659c=_0xd73314[0x0]||process[_0x1e6e5d(0x157)]();const _0x24cdbc=_0x5ef691[_0x1e6e5d(0x159)],_0x30015d=_0x5ef691[_0x1e6e5d(0x195)],_0x26c504=_0x5ef691[_0x1e6e5d(0x166)],_0x1049a1=_0x5ef691[_0x1e6e5d(0x1ba)],_0x251967=a12_0x4816fb['join'](_0x18659c,_0x1e6e5d(0x18f)),_0xa373c7=existsSync(_0x251967);if(_0xa373c7){const {data:_0x264dbf}=await withSpinner(_0x1e6e5d(0x199)+_0x18659c+_0x1e6e5d(0x1eb),()=>_0x18c554[_0x1e6e5d(0x1d1)][_0x1e6e5d(0x1ce)](_0x18659c,{'dryRun':_0x24cdbc,'force':_0x30015d}));if(_0x24cdbc)return console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x18c)](_0x1e6e5d(0x1aa))),console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x175)+_0x264dbf['agentName']),0x0;if(_0x264dbf['action']==='error')return console['log'](a12_0xea4ea9['red'](_0x1e6e5d(0x1e2)+_0x264dbf[_0x1e6e5d(0x172)])),0x1;console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x1d2)](_0x1e6e5d(0x173)+_0x264dbf['action']+_0x1e6e5d(0x1d4))),console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x17f)+_0x264dbf['agentName']);if(_0x264dbf[_0x1e6e5d(0x1c8)]&&_0x264dbf['projectId']){const _0x563e80=getLLMAgentChatUrl(_0x1049a1,_0x264dbf[_0x1e6e5d(0x198)],_0x264dbf[_0x1e6e5d(0x1c8)]);console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x1da)+a12_0xea4ea9[_0x1e6e5d(0x16b)](_0x563e80));}return 0x0;}let _0x5250ca=a12_0x4816fb[_0x1e6e5d(0x1a5)](_0x18659c,'tdx.json');if(!existsSync(_0x5250ca)){const _0xdefadd=findAgentConfigPath(_0x18659c);if(_0xdefadd)_0x18659c=a12_0x4816fb['dirname'](_0xdefadd),_0x5250ca=_0xdefadd,console['log'](a12_0xea4ea9[_0x1e6e5d(0x1e3)](_0x1e6e5d(0x19a)+_0x18659c));else{const _0x2735b6=_0x5ef691[_0x1e6e5d(0x1c3)];if(_0x2735b6){const _0x33b67d=normalizeName(_0x2735b6),_0xffcb34=a12_0x4816fb[_0x1e6e5d(0x1a5)](_0x18659c,_0x1e6e5d(0x1b8)),_0x4fc0c7=a12_0x4816fb[_0x1e6e5d(0x1a5)](_0xffcb34,_0x33b67d,_0x1e6e5d(0x164));existsSync(_0x4fc0c7)&&(_0x18659c=a12_0x4816fb[_0x1e6e5d(0x15e)](_0x4fc0c7),_0x5250ca=_0x4fc0c7,console['log'](a12_0xea4ea9[_0x1e6e5d(0x1e3)](_0x1e6e5d(0x19a)+_0x18659c)));}if(!existsSync(_0x5250ca)){let _0x3e7483=_0x1e6e5d(0x1a0);_0x2735b6&&(_0x3e7483=_0x1e6e5d(0x18a)+_0x2735b6+_0x1e6e5d(0x174)+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x2735b6+_0x1e6e5d(0x181)));throw new SDKError(ErrorCode[_0x1e6e5d(0x1d3)],_0x1e6e5d(0x1b3)+_0x18659c,undefined,{'helpText':_0x3e7483});}}}const {data:_0x3f4f4d}=await withSpinner(_0x1e6e5d(0x1df),()=>_0x18c554[_0x1e6e5d(0x1d1)][_0x1e6e5d(0x1f0)](_0x18659c,{'dryRun':!![]})),_0x15ca72=_0x3f4f4d[_0x1e6e5d(0x178)]['agents'][_0x1e6e5d(0x194)]>0x0;if(_0x15ca72){console[_0x1e6e5d(0x1ed)](a12_0xea4ea9['red'](_0x1e6e5d(0x1a3)));for(const _0x4d19ec of _0x3f4f4d[_0x1e6e5d(0x1b8)]){_0x4d19ec[_0x1e6e5d(0x1a2)]===_0x1e6e5d(0x172)&&console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x19c)](_0x1e6e5d(0x186)+_0x4d19ec[_0x1e6e5d(0x170)]+'\x22:\x20'+_0x4d19ec[_0x1e6e5d(0x172)]));}return 0x1;}const _0xfb018f=_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1b8)][_0x1e6e5d(0x1a9)]+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x192)]['created']+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c5)][_0x1e6e5d(0x1a9)]+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c9)][_0x1e6e5d(0x1a9)],_0x5296bf=_0x3f4f4d['counts'][_0x1e6e5d(0x1b8)][_0x1e6e5d(0x1c4)]+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x192)]['updated']+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c5)][_0x1e6e5d(0x1c4)]+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c9)][_0x1e6e5d(0x1c4)],_0x3f4fb3=_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1b8)]['unchanged']+_0x3f4f4d[_0x1e6e5d(0x178)]['knowledgeBases'][_0x1e6e5d(0x1b7)]+_0x3f4f4d['counts'][_0x1e6e5d(0x1c5)][_0x1e6e5d(0x1b7)]+_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c9)][_0x1e6e5d(0x1b7)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x3f4f4d[_0x1e6e5d(0x1f7)]+'\x27:'),console['log']('\x20\x20'+a12_0xea4ea9[_0x1e6e5d(0x1d2)]('+\x20'+_0xfb018f+_0x1e6e5d(0x187))+_0x1e6e5d(0x177)+a12_0xea4ea9[_0x1e6e5d(0x18c)]('~\x20'+_0x5296bf+'\x20changed')+_0x1e6e5d(0x177)+a12_0xea4ea9[_0x1e6e5d(0x1e3)]('=\x20'+_0x3f4fb3+_0x1e6e5d(0x1d8))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1b8)])),console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x176)+formatCountSummary(_0x3f4f4d['counts'][_0x1e6e5d(0x192)])),console['log']('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c5)])),console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x1d0)+formatCountSummary(_0x3f4f4d[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c9)])),console['log'](_0x1e6e5d(0x1a1)+a12_0xea4ea9[_0x1e6e5d(0x16b)](_0x18659c)),displayDiffs(_0x3f4f4d[_0x1e6e5d(0x1b8)],_0x3f4f4d[_0x1e6e5d(0x192)],_0x3f4f4d[_0x1e6e5d(0x1c5)],_0x3f4f4d[_0x1e6e5d(0x1c9)]);if(_0x24cdbc)return console[_0x1e6e5d(0x1ed)](a12_0xea4ea9['yellow'](_0x1e6e5d(0x169))),0x0;if(_0xfb018f===0x0&&_0x5296bf===0x0){console['log'](a12_0xea4ea9[_0x1e6e5d(0x1d2)]('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x2c462d=getLLMProjectUrl(_0x1049a1,_0x3f4f4d[_0x1e6e5d(0x198)]);return console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x158)+a12_0xea4ea9[_0x1e6e5d(0x16b)](_0x2c462d)),0x0;}if(!_0x26c504&&!_0x30015d){const _0x4db8c0=await confirmKey(_0x1e6e5d(0x1ee)+(_0xfb018f+_0x5296bf)+'\x20resources?');if(!_0x4db8c0)return console[_0x1e6e5d(0x1ed)](_0x1e6e5d(0x161)),0x0;}const {data:_0x149965}=await withSpinner(_0x1e6e5d(0x1bf),()=>_0x18c554[_0x1e6e5d(0x1d1)]['pushProject'](_0x18659c,{'force':_0x30015d})),_0x4f3a0a=_0x149965['counts'][_0x1e6e5d(0x1b8)]['errors']>0x0||_0x149965['counts'][_0x1e6e5d(0x192)][_0x1e6e5d(0x194)]>0x0||_0x149965[_0x1e6e5d(0x178)]['textKnowledgeBases'][_0x1e6e5d(0x194)]>0x0||_0x149965[_0x1e6e5d(0x178)][_0x1e6e5d(0x1c9)][_0x1e6e5d(0x194)]>0x0;if(_0x4f3a0a){console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x18c)](_0x1e6e5d(0x1f4))),console[_0x1e6e5d(0x1ed)](),console['log'](a12_0xea4ea9['red'](_0x1e6e5d(0x180)));for(const _0x470d4f of _0x149965[_0x1e6e5d(0x1b8)]){_0x470d4f[_0x1e6e5d(0x1a2)]===_0x1e6e5d(0x172)&&console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x19c)]('\x20\x20Agent\x20\x22'+_0x470d4f[_0x1e6e5d(0x170)]+'\x22:\x20'+_0x470d4f[_0x1e6e5d(0x172)]));}for(const _0x26a9ec of _0x149965[_0x1e6e5d(0x192)]){_0x26a9ec[_0x1e6e5d(0x1a2)]===_0x1e6e5d(0x172)&&console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x19c)](_0x1e6e5d(0x193)+_0x26a9ec[_0x1e6e5d(0x1cb)]+_0x1e6e5d(0x17a)+_0x26a9ec[_0x1e6e5d(0x172)]));}for(const _0x2379fe of _0x149965[_0x1e6e5d(0x1c5)]){_0x2379fe[_0x1e6e5d(0x1a2)]===_0x1e6e5d(0x172)&&console['log'](a12_0xea4ea9[_0x1e6e5d(0x19c)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x2379fe[_0x1e6e5d(0x1cb)]+_0x1e6e5d(0x17a)+_0x2379fe['error']));}for(const _0x3808f8 of _0x149965[_0x1e6e5d(0x1c9)]){_0x3808f8[_0x1e6e5d(0x1a2)]===_0x1e6e5d(0x172)&&console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x19c)](_0x1e6e5d(0x162)+_0x3808f8[_0x1e6e5d(0x1cb)]+'\x22:\x20'+_0x3808f8[_0x1e6e5d(0x172)]));}return 0x1;}console[_0x1e6e5d(0x1ed)](a12_0xea4ea9[_0x1e6e5d(0x1d2)](_0x1e6e5d(0x156)+(_0xfb018f+_0x5296bf)+'\x20resources\x20to\x20\x27'+_0x149965[_0x1e6e5d(0x1f7)]+'\x27'));const _0x323f9d=getLLMProjectUrl(_0x1049a1,_0x149965[_0x1e6e5d(0x198)]);return console['log']('Project:\x20'+a12_0xea4ea9['cyan'](_0x323f9d)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a13_0x270dcd=a13_0x2fd2;(function(_0x358836,_0xc46845){const _0x80d943=a13_0x2fd2,_0x4e64fe=_0x358836();while(!![]){try{const _0xa3f2eb=parseInt(_0x80d943(0x150))/0x1*(-parseInt(_0x80d943(0x14f))/0x2)+-parseInt(_0x80d943(0x16c))/0x3+parseInt(_0x80d943(0x159))/0x4*(-parseInt(_0x80d943(0x16d))/0x5)+-parseInt(_0x80d943(0x182))/0x6+parseInt(_0x80d943(0x180))/0x7+parseInt(_0x80d943(0x16e))/0x8*(parseInt(_0x80d943(0x17e))/0x9)+parseInt(_0x80d943(0x149))/0xa;if(_0xa3f2eb===_0xc46845)break;else _0x4e64fe['push'](_0x4e64fe['shift']());}catch(_0x2d1974){_0x4e64fe['push'](_0x4e64fe['shift']());}}}(a13_0x5b69,0x4be61));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';function a13_0x2fd2(_0x167a08,_0x5b4511){_0x167a08=_0x167a08-0x148;const _0x5b69cc=a13_0x5b69();let _0x2fd2f6=_0x5b69cc[_0x167a08];return _0x2fd2f6;}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';function a13_0x5b69(){const _0x1a33c1=['log','startsWith','workflow','x-auth-token','trino','request','method','message','1150749dCjLea','43215OoDNCr','461984TuXzHX','file','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','status','llm','PATCH','Endpoint\x20must\x20start\x20with\x20/:\x20','keys','name','proxy-authorization','has','entries','cdp','.\x20Valid\x20types:\x20','body','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','36BcAqRs','noColor','2351153STkKrY','x-xsrf-token','556932OWDGVC','stack','output','<\x20HTTP/1.1\x20','verbose','includes','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','PUT','x-trino-user','Error:\x20','join','GET','readBodyFromFile','5938210jziHzX','description','\x0aStack\x20trace:\x0a','Invalid\x20API\x20type:\x20','authorization','api','18586cddMzi','16DTOkIz','Results\x20saved\x20to\x20','indexOf','substring','data','site','execute','trim','cookie','104UlKHgZ','\x22.\x20','isArray','type','error','set-cookie2','POST','headers','set-cookie','Invalid\x20header\x20format:\x20\x22','toUpperCase'];a13_0x5b69=function(){return _0x1a33c1;};return a13_0x5b69();}const SENSITIVE_HEADERS=new Set([a13_0x270dcd(0x14d),a13_0x270dcd(0x177),a13_0x270dcd(0x158),a13_0x270dcd(0x161),a13_0x270dcd(0x15e),a13_0x270dcd(0x181),a13_0x270dcd(0x167),a13_0x270dcd(0x18a)]);function isSensitiveHeader(_0x2551c1){const _0x38f84a=a13_0x270dcd;return SENSITIVE_HEADERS[_0x38f84a(0x178)](_0x2551c1['toLowerCase']());}function parseHeader(_0x3d8819){const _0x498772=a13_0x270dcd,_0x140192=_0x3d8819[_0x498772(0x152)](':');if(_0x140192===-0x1)throw new Error(_0x498772(0x162)+_0x3d8819+_0x498772(0x15a)+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x33a6c4=_0x3d8819[_0x498772(0x153)](0x0,_0x140192)[_0x498772(0x157)](),_0x1c1aa1=_0x3d8819[_0x498772(0x153)](_0x140192+0x1)['trim']();if(!_0x33a6c4)throw new Error(_0x498772(0x170)+_0x3d8819+'\x22');return[_0x33a6c4,_0x1c1aa1];}export class ApiCommand extends BaseCommand{[a13_0x270dcd(0x176)]='api';[a13_0x270dcd(0x14a)]=a13_0x270dcd(0x17d);['validate'](_0x12dbbe){const _0xc3ae1f=a13_0x270dcd,{args:_0x3e84f0,options:_0x375fd2}=_0x12dbbe,_0x27ab72=_0x375fd2;if(_0x3e84f0['length']===0x0)return _0xc3ae1f(0x188);const _0x227181=_0x3e84f0[0x0];if(!_0x227181[_0xc3ae1f(0x165)]('/'))return _0xc3ae1f(0x174)+_0x227181;const _0xcbc7=_0x27ab72[_0xc3ae1f(0x154)],_0x35a6a1=_0x27ab72[_0xc3ae1f(0x16f)];if(_0xcbc7&&_0x35a6a1)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x4b6d62=_0x27ab72[_0xc3ae1f(0x16a)]||_0xc3ae1f(0x18d),_0x585442=[_0xc3ae1f(0x18d),_0xc3ae1f(0x15f),_0xc3ae1f(0x189),'DELETE',_0xc3ae1f(0x173)];if(!_0x585442['includes'](_0x4b6d62['toUpperCase']()))return'Invalid\x20HTTP\x20method:\x20'+_0x4b6d62+'.\x20Valid\x20methods:\x20'+_0x585442[_0xc3ae1f(0x18c)](',\x20');const _0x556698=_0x27ab72[_0xc3ae1f(0x15c)]||'td',_0x562316=['td',_0xc3ae1f(0x17a),_0xc3ae1f(0x166),_0xc3ae1f(0x168),_0xc3ae1f(0x172)];if(!_0x562316[_0xc3ae1f(0x187)](_0x556698))return _0xc3ae1f(0x14c)+_0x556698+_0xc3ae1f(0x17b)+_0x562316[_0xc3ae1f(0x18c)](',\x20');return undefined;}async[a13_0x270dcd(0x156)](_0x4c7fd1){const _0x1ed653=a13_0x270dcd,{options:_0xcada8e,args:_0x465b30,tdx:_0x4c7457}=_0x4c7fd1,_0x4e9e3e=_0xcada8e,_0x391b3b=_0x465b30[0x0],_0x50b11d=(_0x4e9e3e['method']||_0x1ed653(0x18d))[_0x1ed653(0x163)](),_0x38d5ee=_0x4e9e3e[_0x1ed653(0x154)],_0x38fe81=_0x4e9e3e[_0x1ed653(0x16f)],_0x4beb8f=_0x4e9e3e['header'],_0x376e78=_0x4e9e3e['type']||'td';try{const _0x44a58a={};if(_0x4beb8f){const _0x144991=Array[_0x1ed653(0x15b)](_0x4beb8f)?_0x4beb8f:[_0x4beb8f];for(const _0x151dca of _0x144991){const [_0x3a1edc,_0x748eee]=parseHeader(_0x151dca);_0x44a58a[_0x3a1edc]=_0x748eee;}}let _0xf12254;if(_0x38d5ee)_0xf12254=_0x38d5ee;else{if(_0x38fe81)try{_0xf12254=RawAPI[_0x1ed653(0x148)](_0x38fe81);}catch(_0x190651){return console[_0x1ed653(0x15d)](_0x1ed653(0x18b)+(_0x190651 instanceof Error?_0x190651[_0x1ed653(0x16b)]:String(_0x190651))),0x1;}}const _0x138617={'method':_0x50b11d,'apiType':_0x376e78,'includeHeaders':_0xcada8e[_0x1ed653(0x186)]};_0xf12254&&(_0x138617[_0x1ed653(0x17c)]=_0xf12254);Object[_0x1ed653(0x175)](_0x44a58a)['length']>0x0&&(_0x138617[_0x1ed653(0x160)]=_0x44a58a);if(_0xcada8e['verbose']){const _0x54d716=resolveSite(_0xcada8e[_0x1ed653(0x155)]),_0x48ee28=getEndpoint(_0x54d716,_0x376e78),_0x54c4d3=''+_0x48ee28+_0x391b3b;console[_0x1ed653(0x15d)]('>\x20'+_0x50b11d+'\x20'+_0x54c4d3);const _0x17fb37=getAuthHeaders(_0x54d716),_0x3e9319={..._0x17fb37,..._0x44a58a};for(const [_0x5b4ad4,_0x991c42]of Object[_0x1ed653(0x179)](_0x3e9319)){!isSensitiveHeader(_0x5b4ad4)&&console['error']('>\x20'+_0x5b4ad4+':\x20'+_0x991c42);}_0xf12254&&console[_0x1ed653(0x15d)]('>'),console[_0x1ed653(0x15d)]('');}const _0x4bdaeb=await _0x4c7457[_0x1ed653(0x14e)][_0x1ed653(0x169)](_0x391b3b,_0x138617);if(_0xcada8e[_0x1ed653(0x186)]&&_0x4bdaeb[_0x1ed653(0x160)]){console[_0x1ed653(0x15d)](_0x1ed653(0x185)+_0x4bdaeb[_0x1ed653(0x171)]);for(const [_0x1d7591,_0x37bee9]of Object[_0x1ed653(0x179)](_0x4bdaeb[_0x1ed653(0x160)])){!isSensitiveHeader(_0x1d7591)&&console[_0x1ed653(0x15d)]('<\x20'+_0x1d7591+':\x20'+_0x37bee9);}console[_0x1ed653(0x15d)]('');}const _0x442e63=Boolean(_0xcada8e[_0x1ed653(0x184)]),_0x5f0d53={'color':_0xcada8e['color'],'noColor':_0xcada8e[_0x1ed653(0x17f)]||_0x442e63&&!_0xcada8e['color']},_0x2b5670=colorizeJSON(_0x4bdaeb[_0x1ed653(0x154)],_0x5f0d53);return _0xcada8e['output']?(writeFileSync(_0xcada8e['output'],_0x2b5670),console[_0x1ed653(0x15d)](_0x1ed653(0x151)+_0xcada8e[_0x1ed653(0x184)])):console[_0x1ed653(0x164)](_0x2b5670),0x0;}catch(_0x159419){return _0x159419 instanceof Error?(console['error']('Error:\x20'+_0x159419[_0x1ed653(0x16b)]),_0xcada8e[_0x1ed653(0x186)]&&_0x159419[_0x1ed653(0x183)]&&console[_0x1ed653(0x15d)](_0x1ed653(0x14b)+_0x159419[_0x1ed653(0x183)])):console[_0x1ed653(0x15d)](_0x1ed653(0x18b)+String(_0x159419)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a14_0x38cd4c=a14_0x4691;function a14_0x1cac(){const _0x7bd7b2=['ap02','✓\x20Profile\x20\x27','other','✓\x20API\x20key\x20removed\x20from\x20keychain','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','Select\x20your\x20Treasure\x20Data\x20site:','Read\x20credential\x20from\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','auth:clear','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x27\x20registered','bold','yellow','Setting\x20up\x20authentication\x20for\x20site:\x20','Remove\x20API\x20key\x20from\x20system\x20keychain','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Name:\x20','execute','User:\x20','getUserInfo','tdx:\x20auth\x20setup','\x20\x20tdx','description','ap02\x20-\x20Korea','923gqsMhM','Enter\x20your\x20TD\x20API\x20key:','1043964bajCny','email','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','eu01','text','filter','5015892MAdcvI','No\x20API\x20key\x20found\x20in\x20keychain','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','push','Enter\x20site\x20name:','jp\x20\x20\x20-\x20Japan','868600SoLHQK','join','\x20(profile:\x20','site','us01','327728HaPdby','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aSetup\x20cancelled','jp01','338YKDjsh','last_name','\x20(site:\x20','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','tdx:\x20auth\x20clear','2844LZJtTM','/app/mp/ak','status','tdx\x20profile:\x20','trim','24NiyJbD','create','ERROR','No\x20credential\x20found','value','message','findIndex','jobs','first_name','select','2287695MouVhy','customSite','✗\x20Validation\x20failed:\x20','error','logLevel','profile','System\x20keychain\x20is\x20not\x20available','test','name','auth:setup','29040nNdcoV','✓\x20Authentication\x20successful\x0a','eu\x20\x20\x20-\x20Europe','log','Site\x20name\x20cannot\x20be\x20empty','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','apiKey','\x20--profile\x20','red','warn'];a14_0x1cac=function(){return _0x7bd7b2;};return a14_0x1cac();}function a14_0x4691(_0x1441e6,_0x174aa1){_0x1441e6=_0x1441e6-0x1a1;const _0x1cac8d=a14_0x1cac();let _0x469197=_0x1cac8d[_0x1441e6];return _0x469197;}(function(_0x411641,_0x5b86ee){const _0x34a1fe=a14_0x4691,_0x24b6e5=_0x411641();while(!![]){try{const _0x287941=-parseInt(_0x34a1fe(0x1ba))/0x1*(-parseInt(_0x34a1fe(0x1d1))/0x2)+-parseInt(_0x34a1fe(0x1db))/0x3*(parseInt(_0x34a1fe(0x1cd))/0x4)+-parseInt(_0x34a1fe(0x1e5))/0x5+-parseInt(_0x34a1fe(0x1bc))/0x6+parseInt(_0x34a1fe(0x1c2))/0x7+parseInt(_0x34a1fe(0x1c8))/0x8+-parseInt(_0x34a1fe(0x1d6))/0x9*(-parseInt(_0x34a1fe(0x1ef))/0xa);if(_0x287941===_0x5b86ee)break;else _0x24b6e5['push'](_0x24b6e5['shift']());}catch(_0x402a8b){_0x24b6e5['push'](_0x24b6e5['shift']());}}}(a14_0x1cac,0x955d1));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';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a14_0x4fe337 from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a14_0x4b0de0 from'chalk';export class AuthSetupCommand extends BaseCommand{[a14_0x38cd4c(0x1ed)]=a14_0x38cd4c(0x1ee);[a14_0x38cd4c(0x1b8)]='Setup\x20API\x20key\x20authentication\x20interactively';async[a14_0x38cd4c(0x1b3)](_0x575517){const _0x257676=a14_0x38cd4c,{options:_0x1b0f2d}=_0x575517,_0xbfc25f=_0x1b0f2d[_0x257676(0x1ea)];console[_0x257676(0x1f2)](a14_0x4b0de0['bold'](_0x257676(0x1b6)));const _0x52f1b6=_0x1b0f2d[_0x257676(0x1cb)]||'us01',_0x1d28dd=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x257676(0x1cc)},{'title':_0x257676(0x1c7),'value':_0x257676(0x1d0)},{'title':_0x257676(0x1f1),'value':_0x257676(0x1bf)},{'title':_0x257676(0x1b9),'value':_0x257676(0x1a2)}];let _0x47a879=_0x1d28dd[_0x257676(0x1e1)](_0x5010cc=>_0x5010cc[_0x257676(0x1df)]===_0x52f1b6);_0x47a879===-0x1&&_0x52f1b6!==_0x257676(0x1cc)&&(_0x1d28dd[_0x257676(0x1c5)]({'title':_0x52f1b6,'value':_0x52f1b6}),_0x47a879=_0x1d28dd['length']-0x1);_0x1d28dd[_0x257676(0x1c5)]({'title':'Enter\x20custom\x20site','value':'other'});const _0x7c2a7a=_0xbfc25f?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0xbfc25f+'):':_0x257676(0x1a7),_0x4399fc=await a14_0x4fe337({'type':_0x257676(0x1e4),'name':'site','message':_0x7c2a7a,'choices':_0x1d28dd,'initial':_0x47a879>=0x0?_0x47a879:0x0});if(!_0x4399fc[_0x257676(0x1cb)])return console['log'](_0x257676(0x1cf)),0x1;let _0x490860;if(_0x4399fc[_0x257676(0x1cb)]===_0x257676(0x1a4)){const _0x46f7cb=await a14_0x4fe337({'type':_0x257676(0x1c0),'name':_0x257676(0x1e6),'message':_0x257676(0x1c6),'initial':_0x257676(0x1cc),'validate':_0x28dff3=>{const _0x52cf8d=_0x257676;if(!_0x28dff3||!_0x28dff3[_0x52cf8d(0x1da)]())return _0x52cf8d(0x1f3);if(!/^[a-z0-9-]+$/[_0x52cf8d(0x1ec)](_0x28dff3[_0x52cf8d(0x1da)]()))return _0x52cf8d(0x1a9);return!![];}});if(!_0x46f7cb['customSite'])return console[_0x257676(0x1f2)](_0x257676(0x1cf)),0x1;_0x490860=_0x46f7cb['customSite'];}else _0x490860=_0x4399fc[_0x257676(0x1cb)];const _0x1e1af8=resolveSite(_0x490860);console[_0x257676(0x1f2)](_0x257676(0x1af)+_0x1e1af8),console[_0x257676(0x1f2)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x257676(0x1f2)]('\x20\x20'+getConsoleUrl(_0x1e1af8,_0x257676(0x1d7)));const _0x36ede1=await a14_0x4fe337({'type':'password','name':_0x257676(0x1f5),'message':_0x257676(0x1bb),'validate':_0x14a486=>{const _0x1c53fa=_0x257676;if(!_0x14a486||!_0x14a486[_0x1c53fa(0x1da)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x36ede1[_0x257676(0x1f5)])return console[_0x257676(0x1f2)](_0x257676(0x1cf)),0x1;const _0x1fd7ee=_0x36ede1[_0x257676(0x1f5)];console[_0x257676(0x1f2)]('Validating\x20API\x20key...');try{const _0x56806c=TDX[_0x257676(0x1dc)]({'site':_0x1e1af8,'apiKey':_0x1fd7ee[_0x257676(0x1da)](),'logLevel':_0x1b0f2d[_0x257676(0x1e9)]??LogLevel[_0x257676(0x1dd)]}),_0x13cb1a=await _0x56806c[_0x257676(0x1e2)][_0x257676(0x1b5)]();console[_0x257676(0x1f2)](_0x257676(0x1f4)+_0x13cb1a[_0x257676(0x1bd)]+')');const _0x454aa5=await isKeychainAvailable();_0x454aa5?(await saveAPIKeyAsync(_0x1fd7ee[_0x257676(0x1da)](),_0x1e1af8,_0xbfc25f),console['log'](_0x257676(0x1ab)+(_0xbfc25f?_0x257676(0x1ca)+_0xbfc25f+')':''))):(console[_0x257676(0x1a1)](a14_0x4b0de0['yellow'](_0x257676(0x1b1))),console[_0x257676(0x1a1)](a14_0x4b0de0['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0xbfc25f){const _0x2ff03a={'site':_0x1e1af8};saveProfileToUserConfig(_0xbfc25f,_0x2ff03a),console[_0x257676(0x1f2)](_0x257676(0x1a3)+_0xbfc25f+_0x257676(0x1ac));}const _0x23f090=_0xbfc25f?_0x257676(0x1f6)+_0xbfc25f:'';return console['log'](),console[_0x257676(0x1f2)](_0x257676(0x1be)),console['log'](_0x257676(0x1b7)+_0x23f090+_0x257676(0x1ce)),console[_0x257676(0x1f2)]('\x20\x20tdx'+_0x23f090+_0x257676(0x1c4)),0x0;}catch(_0xacf1f5){if(_0xacf1f5 instanceof HTTPClientError&&_0xacf1f5[_0x257676(0x1d8)]===0x191)return printAuthError(_0xacf1f5),0x1;return console[_0x257676(0x1e8)](a14_0x4b0de0[_0x257676(0x1f7)](_0x257676(0x1e7)+(_0xacf1f5 instanceof Error?_0xacf1f5[_0x257676(0x1e0)]:String(_0xacf1f5)))),console[_0x257676(0x1e8)](_0x257676(0x1d4)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a14_0x38cd4c(0x1ed)]='auth';[a14_0x38cd4c(0x1b8)]=a14_0x38cd4c(0x1a6);async[a14_0x38cd4c(0x1b3)](_0x299beb){const _0x450f34=a14_0x38cd4c,{options:_0x43a6ba,tdx:_0x41384e}=_0x299beb,_0x34464f=_0x43a6ba[_0x450f34(0x1cb)],_0x4b3d4a=_0x43a6ba['profile'],_0x3b7f8d=_0x4b3d4a?_0x4b3d4a:'N/A';console[_0x450f34(0x1f2)](_0x450f34(0x1d9)+_0x3b7f8d+_0x450f34(0x1d3)+_0x34464f+')');const _0x17f121=await resolveAPIKeyAsync(_0x34464f,_0x4b3d4a);if(_0x17f121){const {source:_0x17801d,isDeprecated:_0x58dd41}=_0x17f121,_0x5b74cc=_0x450f34(0x1a8)+_0x17801d;console[_0x450f34(0x1f2)](_0x58dd41?a14_0x4b0de0[_0x450f34(0x1ae)](_0x5b74cc):_0x5b74cc);}else console[_0x450f34(0x1f2)](a14_0x4b0de0[_0x450f34(0x1ae)](_0x450f34(0x1de)));try{const _0x640299=await _0x41384e[_0x450f34(0x1e2)][_0x450f34(0x1b5)]();return console[_0x450f34(0x1f2)](a14_0x4b0de0['green'](_0x450f34(0x1f0))),console[_0x450f34(0x1f2)](_0x450f34(0x1b4)+_0x640299['email']),(_0x640299[_0x450f34(0x1e3)]||_0x640299[_0x450f34(0x1d2)])&&console['log'](_0x450f34(0x1b2)+[_0x640299[_0x450f34(0x1e3)],_0x640299[_0x450f34(0x1d2)]][_0x450f34(0x1c1)](Boolean)[_0x450f34(0x1c9)]('\x20')),0x0;}catch(_0x49cfa7){return _0x49cfa7 instanceof HTTPClientError&&_0x49cfa7[_0x450f34(0x1d8)]===0x191?printAuthError(_0x49cfa7,!![],_0x4b3d4a):console[_0x450f34(0x1e8)](a14_0x4b0de0['red']('✗\x20Validation\x20failed:\x20'+(_0x49cfa7 instanceof Error?_0x49cfa7[_0x450f34(0x1e0)]:String(_0x49cfa7)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a14_0x38cd4c(0x1ed)]=a14_0x38cd4c(0x1aa);[a14_0x38cd4c(0x1b8)]=a14_0x38cd4c(0x1b0);async[a14_0x38cd4c(0x1b3)](_0x4953f4){const _0x10e7c5=a14_0x38cd4c,{options:_0x26965c}=_0x4953f4,_0x92bb9f=_0x26965c[_0x10e7c5(0x1ea)];console[_0x10e7c5(0x1f2)](a14_0x4b0de0[_0x10e7c5(0x1ad)](_0x10e7c5(0x1d5)));const _0x239c63=await isKeychainAvailable();if(!_0x239c63)return console[_0x10e7c5(0x1e8)](a14_0x4b0de0[_0x10e7c5(0x1f7)](_0x10e7c5(0x1eb))),0x1;const _0x963e99=await deleteKeychainAPIKey(_0x92bb9f);return _0x963e99?(clearCredentialCache(),console[_0x10e7c5(0x1f2)](_0x10e7c5(0x1a5)+(_0x92bb9f?'\x20(profile:\x20'+_0x92bb9f+')':'')),0x0):(console[_0x10e7c5(0x1f2)](_0x10e7c5(0x1c3)+(_0x92bb9f?'\x20for\x20profile:\x20'+_0x92bb9f:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a15_0x3f72(){const _0x338982=['Error:\x20','metadata','--agent\x20flag','llmAgent','77tVcWay','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','4JlAhSv','llmProject','write','stack','data','event','handleChatEvent','4245810YyTLaf','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','chatId','424586SEaXWu','resolveProjectId','37008576gcCIMX','log','type','llm','verbose','name','getDefaultAgent','Continuing\x20chat:\x20','404','content','chat','error','getAgentId','Chat\x20session:\x20','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','6695428KvFxFV','Using\x20cached\x20default\x20agent:\x20','streamChat','CHAT_NOT_FOUND','validate','stdout','\x27...','1694730oxIwGd','getOrCreateDefaultAgent','Getting\x20default\x20agent...','\x0aStack\x20trace:','join','message','\x20\x20Cause:\x20','execute','code','10235136XurrdP','session\x20context','cause','claude-4.5-haiku','Resolving\x20agent\x20\x27','305466gVnOQZ'];a15_0x3f72=function(){return _0x338982;};return a15_0x3f72();}function a15_0x1c43(_0x137a1e,_0x230139){_0x137a1e=_0x137a1e-0x1ae;const _0x3f727d=a15_0x3f72();let _0x1c4360=_0x3f727d[_0x137a1e];return _0x1c4360;}const a15_0x20fbb4=a15_0x1c43;(function(_0x1a9f2e,_0x383efc){const _0x4c8c72=a15_0x1c43,_0x3efc40=_0x1a9f2e();while(!![]){try{const _0x145f91=-parseInt(_0x4c8c72(0x1cc))/0x1+-parseInt(_0x4c8c72(0x1c2))/0x2*(-parseInt(_0x4c8c72(0x1e4))/0x3)+parseInt(_0x4c8c72(0x1dd))/0x4+parseInt(_0x4c8c72(0x1c9))/0x5+parseInt(_0x4c8c72(0x1bb))/0x6*(parseInt(_0x4c8c72(0x1c0))/0x7)+parseInt(_0x4c8c72(0x1b6))/0x8+-parseInt(_0x4c8c72(0x1ce))/0x9;if(_0x145f91===_0x383efc)break;else _0x3efc40['push'](_0x3efc40['shift']());}catch(_0x10184d){_0x3efc40['push'](_0x3efc40['shift']());}}}(a15_0x3f72,0xe94d2));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 handleSDKError(_0x529ae0,_0x45d5f2){const _0x1fef99=a15_0x1c43;if(_0x529ae0 instanceof SDKError)console[_0x1fef99(0x1d9)](_0x1fef99(0x1bc)+_0x529ae0[_0x1fef99(0x1b2)]),_0x45d5f2[_0x1fef99(0x1d2)]&&(_0x529ae0['cause']&&console[_0x1fef99(0x1d9)](_0x1fef99(0x1b3)+_0x529ae0[_0x1fef99(0x1b8)]),_0x529ae0[_0x1fef99(0x1c5)]&&(console[_0x1fef99(0x1d9)](_0x1fef99(0x1b0)),console['error'](_0x529ae0['stack'])));else throw _0x529ae0;}export class ChatCommand extends BaseCommand{['name']=a15_0x20fbb4(0x1d8);['description']=a15_0x20fbb4(0x1dc);[a15_0x20fbb4(0x1e1)](_0x413138){const _0x45b52b=a15_0x20fbb4,_0x1bf609=_0x413138['args'][_0x45b52b(0x1b1)]('\x20');if(!_0x1bf609)return _0x45b52b(0x1c1);return undefined;}async[a15_0x20fbb4(0x1df)](_0x36d3ad,_0x2c8533,_0xca8a3c,_0x15ca40,_0x50c096){const _0x3cfaae=a15_0x20fbb4;for await(const _0x295ce8 of _0x36d3ad[_0x3cfaae(0x1d1)][_0x3cfaae(0x1d8)](_0x2c8533,{'agentId':_0xca8a3c,'chatId':_0x15ca40})){if(_0x295ce8[_0x3cfaae(0x1d0)]===_0x3cfaae(0x1bd)){const _0x49ec53=_0x295ce8['data'][_0x3cfaae(0x1cb)];saveLastChatId(_0x49ec53),_0x50c096&&console[_0x3cfaae(0x1d9)](_0x3cfaae(0x1db)+_0x49ec53);}else _0x295ce8['type']===_0x3cfaae(0x1c7)&&this[_0x3cfaae(0x1c8)](_0x295ce8[_0x3cfaae(0x1c6)]);}}async[a15_0x20fbb4(0x1da)](_0x262173,_0x1603f5,_0x34783c,_0x24cf62,_0x46591c){const _0x47464e=a15_0x20fbb4,_0x104d9a=_0x1603f5||_0x34783c;if(_0x104d9a){const {projectName:_0x593a84,agentName:_0x41e7dd}=parseAgentRef(_0x104d9a),_0x294efc=_0x41e7dd||_0x104d9a,_0x15c769=_0x41e7dd?_0x593a84:_0x24cf62;if(!_0x15c769)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x46591c){const _0x3e3bcc=_0x1603f5?_0x47464e(0x1be):_0x47464e(0x1b7);console[_0x47464e(0x1d9)]('Using\x20agent\x20from\x20'+_0x3e3bcc+':\x20'+_0x15c769+'/'+_0x294efc);}const _0x119fa1=await withSpinner('Resolving\x20project\x20\x27'+_0x15c769+_0x47464e(0x1e3),()=>_0x262173['llm'][_0x47464e(0x1cd)](_0x15c769),{'verbose':_0x46591c}),_0x1be4d7=await withSpinner(_0x47464e(0x1ba)+_0x294efc+'\x27...',()=>_0x262173[_0x47464e(0x1d1)]['resolveAgentId'](_0x294efc,_0x119fa1['data']),{'verbose':_0x46591c});return _0x1be4d7[_0x47464e(0x1c6)];}else{const _0x2551f0=_0x262173[_0x47464e(0x1d1)][_0x47464e(0x1d4)]();if(_0x2551f0)return _0x46591c&&console[_0x47464e(0x1d9)](_0x47464e(0x1de)+_0x2551f0[_0x47464e(0x1d3)]),_0x2551f0['id'];const _0x3de8db=await withSpinner(_0x47464e(0x1af),()=>_0x262173[_0x47464e(0x1d1)][_0x47464e(0x1ae)](_0x47464e(0x1b9),0x0),{'verbose':_0x46591c});return _0x3de8db['data']['id'];}}async[a15_0x20fbb4(0x1b4)](_0x58245b){const _0x1b8fc1=a15_0x20fbb4,{options:_0x518c09,args:_0xeaee6d,tdx:_0x1d628a}=_0x58245b,_0x26e742=_0xeaee6d['join']('\x20'),_0x51149d=_0x518c09,_0x12d2ae=_0x51149d['agent'],_0x53017c=_0x51149d[_0x1b8fc1(0x1bf)],_0x2621b2=_0x51149d[_0x1b8fc1(0x1c3)],_0x6289bd=_0x51149d['new'];try{let _0xa74460,_0x10759a;!_0x6289bd&&(_0x10759a=loadLastChatId(),_0x10759a&&_0x518c09[_0x1b8fc1(0x1d2)]&&console[_0x1b8fc1(0x1d9)](_0x1b8fc1(0x1d5)+_0x10759a));(_0x6289bd||!_0x10759a)&&(_0xa74460=await this[_0x1b8fc1(0x1da)](_0x1d628a,_0x12d2ae,_0x53017c,_0x2621b2,_0x518c09[_0x1b8fc1(0x1d2)]));try{await this[_0x1b8fc1(0x1df)](_0x1d628a,_0x26e742,_0xa74460,_0x10759a,_0x518c09['verbose']);}catch(_0x1a7338){const _0x38a2db=_0x1a7338 instanceof SDKError&&_0x1a7338[_0x1b8fc1(0x1b5)]===ErrorCode[_0x1b8fc1(0x1e0)]||_0x1a7338 instanceof Error&&_0x1a7338[_0x1b8fc1(0x1b2)]['includes'](_0x1b8fc1(0x1d6));if(_0x38a2db)_0x518c09['verbose']&&console[_0x1b8fc1(0x1d9)](_0x1b8fc1(0x1ca)),!_0xa74460&&(_0xa74460=await this[_0x1b8fc1(0x1da)](_0x1d628a,_0x12d2ae,_0x53017c,_0x2621b2,_0x518c09[_0x1b8fc1(0x1d2)])),await this['streamChat'](_0x1d628a,_0x26e742,_0xa74460,undefined,_0x518c09[_0x1b8fc1(0x1d2)]);else throw _0x1a7338;}return console[_0x1b8fc1(0x1cf)](),0x0;}catch(_0x5b63cf){return console[_0x1b8fc1(0x1d9)](),handleSDKError(_0x5b63cf,_0x518c09),0x1;}}[a15_0x20fbb4(0x1c8)](_0x211031){const _0xb08cc3=a15_0x20fbb4;if('content'in _0x211031)process[_0xb08cc3(0x1e2)][_0xb08cc3(0x1c4)](_0x211031[_0xb08cc3(0x1d7)]);else _0xb08cc3(0x1d9)in _0x211031&&console[_0xb08cc3(0x1d9)]('\x0aError:\x20'+_0x211031['error']);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a16_0x5dd802=a16_0x3fad;(function(_0x51c05a,_0x310a61){const _0x5ad3dd=a16_0x3fad,_0x45494b=_0x51c05a();while(!![]){try{const _0x92ec4c=parseInt(_0x5ad3dd(0xb7))/0x1*(-parseInt(_0x5ad3dd(0xf4))/0x2)+parseInt(_0x5ad3dd(0x101))/0x3+-parseInt(_0x5ad3dd(0xf2))/0x4+parseInt(_0x5ad3dd(0x139))/0x5+-parseInt(_0x5ad3dd(0xb8))/0x6*(parseInt(_0x5ad3dd(0xff))/0x7)+parseInt(_0x5ad3dd(0x13b))/0x8+parseInt(_0x5ad3dd(0x145))/0x9;if(_0x92ec4c===_0x310a61)break;else _0x45494b['push'](_0x45494b['shift']());}catch(_0x53830f){_0x45494b['push'](_0x45494b['shift']());}}}(a16_0x4d8a,0x43b02));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a16_0x338c2b from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a16_0x3fad(_0x2f3a96,_0x2acbb8){_0x2f3a96=_0x2f3a96-0xb2;const _0x4d8aca=a16_0x4d8a();let _0x3fad23=_0x4d8aca[_0x2f3a96];return _0x3fad23;}import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a16_0x5dd802(0x114);function handleInstallationError(_0x70ec59,_0x40db0c,_0x436008,_0x5551f6){const _0x4cbf68=a16_0x5dd802;errorContains(_0x70ec59,_0x4cbf68(0xca),'already\x20installed',_0x4cbf68(0x124))?(_0x436008[_0x4cbf68(0xef)]='✓\x20'+_0x40db0c+_0x4cbf68(0x13d),_0x5551f6?.['info'](_0x40db0c+_0x4cbf68(0x13d)),_0x70ec59 instanceof SDKError&&_0x70ec59[_0x4cbf68(0xc0)]&&_0x5551f6?.[_0x4cbf68(0x113)]('Command\x20output:\x20'+_0x70ec59[_0x4cbf68(0xc0)][_0x4cbf68(0x122)])):(_0x436008['warn']('Warning:\x20Failed\x20to\x20configure\x20'+_0x40db0c),_0x5551f6?.[_0x4cbf68(0x12b)](_0x40db0c+_0x4cbf68(0xfe),_0x70ec59));}export function parseVersion(_0x11d9fa){const _0x97b325=a16_0x5dd802,_0x6afb6e=_0x11d9fa['trim']()[_0x97b325(0x10d)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x6afb6e)return null;return{'major':parseInt(_0x6afb6e[0x1],0xa),'minor':parseInt(_0x6afb6e[0x2],0xa),'patch':parseInt(_0x6afb6e[0x3],0xa)};}export function compareVersions(_0x1b0333,_0x9a1164){const _0x4d303d=a16_0x5dd802;if(_0x1b0333[_0x4d303d(0x120)]!==_0x9a1164[_0x4d303d(0x120)])return _0x1b0333[_0x4d303d(0x120)]-_0x9a1164[_0x4d303d(0x120)];if(_0x1b0333[_0x4d303d(0xce)]!==_0x9a1164[_0x4d303d(0xce)])return _0x1b0333['minor']-_0x9a1164[_0x4d303d(0xce)];return _0x1b0333['patch']-_0x9a1164[_0x4d303d(0xf9)];}async function checkClaudeVersion(_0x54ff87,_0x7a8fa3){const _0x11e26a=a16_0x5dd802;_0x7a8fa3?.[_0x11e26a(0x113)](_0x11e26a(0xb2)+_0x54ff87+')');const _0x12adf2=await executeClaudeCommand([_0x11e26a(0xc4)],undefined,_0x7a8fa3),_0x37dd2=parseVersion(_0x12adf2);if(!_0x37dd2){_0x7a8fa3?.[_0x11e26a(0xb9)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x12adf2);return;}const _0x1be321=_0x37dd2[_0x11e26a(0x120)]+'.'+_0x37dd2[_0x11e26a(0xce)]+'.'+_0x37dd2[_0x11e26a(0xf9)],_0x3b214a=parseVersion(_0x54ff87);if(!_0x3b214a){_0x7a8fa3?.['warn']('Invalid\x20minimum\x20version\x20format:\x20'+_0x54ff87);return;}if(compareVersions(_0x37dd2,_0x3b214a)<0x0){_0x7a8fa3?.['error']('Claude\x20Code\x20version\x20'+_0x1be321+_0x11e26a(0x13f)+_0x54ff87+')');throw new SDKError(ErrorCode[_0x11e26a(0xd6)],'Claude\x20Code\x20version\x20'+_0x1be321+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x54ff87+_0x11e26a(0x136),undefined,{'helpText':_0x11e26a(0x115)});}_0x7a8fa3?.['debug'](_0x11e26a(0xbf)+_0x1be321+_0x11e26a(0x13c));}async function executeClaudeCommand(_0x34c28f,_0x25c089,_0x20fb93){const _0x26f989=a16_0x5dd802;return _0x20fb93?.['info'](_0x26f989(0x12c)+_0x34c28f[_0x26f989(0x12f)]('\x20')),new Promise((_0x22cdc0,_0x9ad702)=>{const _0x369cea=_0x26f989,_0x314cdd=spawn(_0x369cea(0x116),_0x34c28f,{'stdio':_0x369cea(0x138)});let _0x3aa391='',_0x20c37c='';_0x314cdd[_0x369cea(0xbb)]['on'](_0x369cea(0x13a),_0xba4494=>{const _0x50d3be=_0x369cea;_0x3aa391+=_0xba4494[_0x50d3be(0x103)]();}),_0x314cdd[_0x369cea(0xc7)]['on'](_0x369cea(0x13a),_0x3295f5=>{const _0x266622=_0x369cea;_0x20c37c+=_0x3295f5[_0x266622(0x103)]();}),_0x314cdd['on'](_0x369cea(0x12b),_0x33e8be=>{const _0xbfa10b=_0x369cea;_0x33e8be['code']===_0xbfa10b(0x102)?(_0x20fb93?.[_0xbfa10b(0x12b)]('Claude\x20Code\x20CLI\x20not\x20found'),_0x9ad702(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',_0x33e8be,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x20fb93?.['error']('Command\x20spawn\x20error:\x20'+_0x33e8be[_0xbfa10b(0x122)]),_0x9ad702(new SDKError(ErrorCode[_0xbfa10b(0x12d)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x33e8be[_0xbfa10b(0x122)],_0x33e8be)));}),_0x314cdd['on']('exit',_0x4559d8=>{const _0x599a4e=_0x369cea;if(_0x4559d8===0x0)_0x22cdc0(_0x3aa391);else _0x25c089?(_0x20fb93?.[_0x599a4e(0x12b)]('Command\x20failed\x20(exit\x20'+_0x4559d8+_0x599a4e(0x10e)+_0x34c28f[_0x599a4e(0x12f)]('\x20')),_0x9ad702(new SDKError(ErrorCode[_0x599a4e(0x13e)],_0x25c089,new Error(_0x20c37c)))):_0x22cdc0('');});});}async function ensureMcpServer(_0x4bc8cd,_0x3ceeef,_0x394a7e,_0x30d4c1,_0x1dfd8c){const _0xa8b026=a16_0x5dd802;_0x30d4c1[_0xa8b026(0xef)]=_0xa8b026(0x109)+_0x4bc8cd+_0xa8b026(0xcc),await executeClaudeCommand([_0xa8b026(0xd3),'add',_0x4bc8cd,_0x3ceeef,'--transport',_0x394a7e],_0xa8b026(0xbe)+_0x4bc8cd+'\x27',_0x1dfd8c),_0x30d4c1[_0xa8b026(0xef)]=_0xa8b026(0x131)+_0x4bc8cd+_0xa8b026(0x127);}async function ensureMarketplace(_0x223eb8,_0x33391f,_0x4838a5,_0x45fb4a){const _0xd25d4e=a16_0x5dd802;_0x4838a5[_0xd25d4e(0xef)]='Configuring\x20marketplace\x20\x27'+_0x223eb8+'\x27...',await executeClaudeCommand([_0xd25d4e(0xba),_0xd25d4e(0x11c),_0xd25d4e(0x12a),_0x33391f],_0xd25d4e(0x10f)+_0x223eb8+'\x27',_0x45fb4a),_0x4838a5[_0xd25d4e(0xef)]=_0xd25d4e(0xc1)+_0x223eb8+_0xd25d4e(0x127);}async function updateMarketplace(_0x2ed07e,_0xceebb9,_0x4e73f5){const _0x524e07=a16_0x5dd802;_0xceebb9[_0x524e07(0xef)]=_0x524e07(0x118)+_0x2ed07e+_0x524e07(0xcc),await executeClaudeCommand([_0x524e07(0xba),'marketplace',_0x524e07(0x107)],_0x524e07(0xdd)+_0x2ed07e+'\x27',_0x4e73f5),_0xceebb9[_0x524e07(0xef)]=_0x524e07(0xc1)+_0x2ed07e+_0x524e07(0xf0);}async function ensurePlugin(_0x4a1138,_0x36e756,_0xbffed3,_0x1867e4){const _0x2c7b04=a16_0x5dd802;_0xbffed3['text']=_0x2c7b04(0x143)+_0x4a1138+_0x2c7b04(0xcc),await executeClaudeCommand([_0x2c7b04(0xba),_0x2c7b04(0x133),_0x4a1138+'@'+_0x36e756],_0x2c7b04(0xbc)+_0x4a1138+'\x27',_0x1867e4),_0xbffed3[_0x2c7b04(0xef)]=_0x2c7b04(0xf7)+_0x4a1138+_0x2c7b04(0x11b);}async function createClaudeSettings(_0x1c592a,_0x15620b=a16_0x5dd802(0x10b),_0x298adb){const _0x27ad66=a16_0x5dd802,_0x327a5b=join(process['cwd'](),_0x27ad66(0xf6)),_0x316f05=join(_0x327a5b,_0x27ad66(0x11e));await mkdir(_0x327a5b,{'recursive':!![]});let _0xcce11a={};if(existsSync(_0x316f05))try{const _0x2a15b6=await readFile(_0x316f05,_0x27ad66(0xfd));_0xcce11a=JSON['parse'](_0x2a15b6);}catch{_0xcce11a={};}const _0x2277a2=_0xcce11a[_0x27ad66(0x111)]||{},_0x5a624b={'ANTHROPIC_BASE_URL':_0x2277a2[_0x27ad66(0xbd)],'ANTHROPIC_MODEL':_0x2277a2[_0x27ad66(0xdb)],'ANTHROPIC_AUTH_TOKEN':_0x2277a2['ANTHROPIC_AUTH_TOKEN'],'statusLine':_0xcce11a[_0x27ad66(0x125)]},_0x36b5e2={..._0xcce11a,'env':{..._0x2277a2,'ANTHROPIC_BASE_URL':_0x27ad66(0xb4)+_0x1c592a,'ANTHROPIC_MODEL':_0x15620b,'ANTHROPIC_AUTH_TOKEN':'tdx-managed-proxy'},'statusLine':{'type':_0x27ad66(0x123),'command':_0x298adb?_0x27ad66(0xea)+_0x298adb+_0x27ad66(0xf8):_0x27ad66(0x104)}};return await writeFile(_0x316f05,JSON[_0x27ad66(0x11f)](_0x36b5e2,null,0x2)+'\x0a'),_0x5a624b;}async function restoreClaudeSettings(_0x206639){const _0x464d64=a16_0x5dd802,_0x183f58=join(process[_0x464d64(0xf3)](),_0x464d64(0xf6)),_0x39c050=join(_0x183f58,_0x464d64(0x11e));if(!existsSync(_0x39c050))return;try{const _0x3de765=await readFile(_0x39c050,'utf-8'),_0x45501d=JSON[_0x464d64(0x10c)](_0x3de765),_0x527ec8=_0x45501d[_0x464d64(0x111)]||{},_0x390b90=_0x527ec8[_0x464d64(0xbd)],_0x1929b2=((()=>{const _0x53da9e=_0x464d64;if(typeof _0x390b90!==_0x53da9e(0xfb))return![];try{const _0x5cbd48=new URL(_0x390b90);return _0x5cbd48[_0x53da9e(0xee)]===_0x53da9e(0xdc)||_0x5cbd48[_0x53da9e(0xee)]===_0x53da9e(0xd0);}catch{return![];}})());_0x1929b2?(delete _0x527ec8[_0x464d64(0xbd)],delete _0x527ec8['ANTHROPIC_MODEL'],delete _0x527ec8[_0x464d64(0x100)]):(_0x206639[_0x464d64(0xbd)]!==undefined?_0x527ec8[_0x464d64(0xbd)]=_0x206639['ANTHROPIC_BASE_URL']:delete _0x527ec8[_0x464d64(0xbd)],_0x206639[_0x464d64(0xdb)]!==undefined?_0x527ec8[_0x464d64(0xdb)]=_0x206639[_0x464d64(0xdb)]:delete _0x527ec8[_0x464d64(0xdb)],_0x206639['ANTHROPIC_AUTH_TOKEN']!==undefined?_0x527ec8[_0x464d64(0x100)]=_0x206639[_0x464d64(0x100)]:delete _0x527ec8[_0x464d64(0x100)]);const _0x4d7ac3=_0x45501d[_0x464d64(0x125)],_0x545a14=((()=>{const _0x269beb=_0x464d64;if(!_0x4d7ac3||typeof _0x4d7ac3!==_0x269beb(0xd5))return![];if(_0x4d7ac3[_0x269beb(0x141)]!==_0x269beb(0x123))return![];if(typeof _0x4d7ac3[_0x269beb(0x123)]!=='string')return![];return _0x4d7ac3[_0x269beb(0x123)][_0x269beb(0x110)](_0x269beb(0xe4))&&_0x4d7ac3['command'][_0x269beb(0x110)]('statusline');})());if(_0x545a14)delete _0x45501d[_0x464d64(0x125)];else _0x206639['statusLine']!==undefined?_0x45501d['statusLine']=_0x206639['statusLine']:delete _0x45501d[_0x464d64(0x125)];_0x45501d[_0x464d64(0x111)]=_0x527ec8,await writeFile(_0x39c050,JSON[_0x464d64(0x11f)](_0x45501d,null,0x2)+'\x0a');}catch{}}function a16_0x4d8a(){const _0x26c4a0=['607659jAdSif','ENOENT','toString','tdx\x20claude\x20statusline','server','user','update','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','Configuring\x20MCP\x20server\x20\x27','Initializing\x20proxy\x20logger...','sonnet','parse','match','):\x20claude\x20','Failed\x20to\x20configure\x20marketplace\x20\x27','includes','env','getLogPath','debug','2.0.20','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','claude','Claude\x20Code\x20CLI\x20not\x20found','Updating\x20marketplace\x20\x27','CLAUDE_CODE_NOT_FOUND','site','\x27\x20installed','marketplace','log','settings.local.json','stringify','major','name','message','command','already\x20configured','statusLine','stop','\x27\x20configured','start','fail','add','error','Executing:\x20claude\x20','INTERNAL','Creating\x20.claude/settings.local.json...','join','account_id','✓\x20MCP\x20server\x20\x27','proxy','install','✓\x20Logs\x20saved\x20to\x20','llm','\x20or\x20later.','port','pipe','185345MvEnTx','data','754720NoJGcm','\x20meets\x20minimum\x20requirement','\x20already\x20configured','INSTALLATION_FAILED','\x20is\x20too\x20old\x20(minimum:\x20','trim','type','td-skills','Installing\x20plugin\x20\x27','Initializing...','6858576YJglEn','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','Failed\x20to\x20launch\x20Claude\x20Code:\x20','http://127.0.0.1:','Starting\x20TD\x20LLM\x20proxy\x20server...','getOrCreateDefaultProject','17857yPhkOe','76530kHDzUg','warn','plugin','stdout','Failed\x20to\x20install\x20plugin\x20\x27','ANTHROPIC_BASE_URL','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Claude\x20Code\x20version\x20','cause','✓\x20Marketplace\x20\x27','workflow-skills','Checking\x20Claude\x20Code\x20version...','--version','✓\x20Using\x20project:\x20','TD\x20Docs\x20MCP\x20Server','stderr','sql-skills','exit','already\x20exists','which','\x27...','logger','minor','td-skills\x20Plugins','127.0.0.1','✓\x20Settings\x20configured:\x20.claude/settings.local.json','resume','mcp','green','object','CLAUDE_CODE_UNSUPPORTED_VERSION','close','logLevel','getCurrent','https://docs.treasuredata.com/mcp','ANTHROPIC_MODEL','localhost','Failed\x20to\x20update\x20marketplace\x20\x27','model','findClaudePath','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Setup\x20failed','originalSettings','tdx','tdx-managed-proxy','Claude\x20Code\x20version\x20check\x20failed','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','Finding\x20available\x20port...','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','tdx\x20--profile\x20','continue','Setting\x20up\x20project...','✓\x20Port\x20','hostname','text','\x27\x20updated','attributes','469004cLrfsx','cwd','30wsnNhj','verbose','.claude','✓\x20Plugin\x20\x27','\x20claude\x20statusline','patch','✓\x20Settings\x20restored:\x20.claude/settings.local.json','string','unshift','utf-8','\x20configuration\x20failed','238ctTpqU','ANTHROPIC_AUTH_TOKEN'];a16_0x4d8a=function(){return _0x26c4a0;};return a16_0x4d8a();}export class ClaudeCommand extends BaseCommand{['name']='claude';['description']=a16_0x5dd802(0x108);[a16_0x5dd802(0x105)];[a16_0x5dd802(0xe3)];[a16_0x5dd802(0xcd)];[a16_0x5dd802(0x137)];async['execute'](_0x153c0b){const _0x5b69d6=a16_0x5dd802,{tdx:_0xae7f06,options:_0x101bc5,args:_0x79720a}=_0x153c0b;try{const _0x512afe=_0x101bc5,_0x1417cf=_0x512afe[_0x5b69d6(0xde)]||_0x5b69d6(0x10b),_0x2d5ada=_0x512afe[_0x5b69d6(0x132)]===![],_0x192c12=_0x512afe[_0x5b69d6(0xeb)]===!![],_0x13605e=_0x512afe[_0x5b69d6(0xd2)]===!![],_0x3d5788=[..._0x79720a];if(_0x192c12)_0x3d5788[_0x5b69d6(0xfc)]('-c');else _0x13605e&&_0x3d5788['unshift']('-r');const _0x38bb76=createCommandSpinner(_0x5b69d6(0x144),{'verbose':_0x101bc5[_0x5b69d6(0xf5)]});_0x38bb76['start']();try{if(!_0x2d5ada){_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xe8),this[_0x5b69d6(0x137)]=await findAvailablePort(0xfa0),_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xed)+this[_0x5b69d6(0x137)],_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xec);const _0xa06411=await _0xae7f06[_0x5b69d6(0x135)][_0x5b69d6(0xb6)](),_0x3457f5=_0xa06411['id'];_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xc5)+_0xa06411[_0x5b69d6(0xf1)][_0x5b69d6(0x121)];const _0x694cfc=_0x101bc5['profile'];try{const _0x271c84=await _0xae7f06[_0x5b69d6(0x106)][_0x5b69d6(0xd9)]();_0x271c84['account_id']&&writeCachedAccountInfo(_0x101bc5['site'],_0x271c84[_0x5b69d6(0x130)],_0x694cfc);}catch{}_0x38bb76['text']=_0x5b69d6(0x10a),this[_0x5b69d6(0xcd)]=new TDXLogger(_0x101bc5[_0x5b69d6(0xd8)],!![]),await this[_0x5b69d6(0xcd)]['init']();const _0xdb9012=this[_0x5b69d6(0xcd)][_0x5b69d6(0x112)]();_0x38bb76[_0x5b69d6(0xef)]='✓\x20Logging\x20to\x20'+_0xdb9012,_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xb5),this['server']=new ProxyServer({'port':this[_0x5b69d6(0x137)],'projectId':_0x3457f5,'tdx':_0xae7f06,'logger':this['logger'],'site':_0x101bc5[_0x5b69d6(0x11a)]}),await this[_0x5b69d6(0x105)][_0x5b69d6(0x128)](),_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xe0)+this[_0x5b69d6(0x137)],_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0x12e),this[_0x5b69d6(0xe3)]=await createClaudeSettings(this[_0x5b69d6(0x137)],_0x1417cf,_0x694cfc),_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xd1);}else _0x38bb76['text']=_0x5b69d6(0xe1);try{_0x38bb76[_0x5b69d6(0xef)]=_0x5b69d6(0xc3),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x5b69d6(0xcd)]),_0x38bb76[_0x5b69d6(0xef)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x4b9b74){_0x38bb76[_0x5b69d6(0x129)](_0x5b69d6(0xe6));throw _0x4b9b74;}try{await ensureMcpServer('td-docs',_0x5b69d6(0xda),'http',_0x38bb76,this[_0x5b69d6(0xcd)]);}catch(_0x51bdf5){handleInstallationError(_0x51bdf5,_0x5b69d6(0xc6),_0x38bb76,this[_0x5b69d6(0xcd)]);}try{await ensureMarketplace(_0x5b69d6(0x142),'https://github.com/treasure-data/td-skills',_0x38bb76,this[_0x5b69d6(0xcd)]),await updateMarketplace(_0x5b69d6(0x142),_0x38bb76,this[_0x5b69d6(0xcd)]),await ensurePlugin(_0x5b69d6(0xc8),_0x5b69d6(0x142),_0x38bb76,this[_0x5b69d6(0xcd)]),await ensurePlugin(_0x5b69d6(0xc2),'td-skills',_0x38bb76,this['logger']),await ensurePlugin('tdx-skills',_0x5b69d6(0x142),_0x38bb76,this[_0x5b69d6(0xcd)]);}catch(_0x3dea69){handleInstallationError(_0x3dea69,_0x5b69d6(0xcf),_0x38bb76,this[_0x5b69d6(0xcd)]);}_0x38bb76['stop']();}catch(_0x845a50){_0x38bb76[_0x5b69d6(0x129)](_0x5b69d6(0xe2));throw _0x845a50;}const _0x5cb81f=await this[_0x5b69d6(0xdf)]();if(!_0x5cb81f)throw new SDKError(ErrorCode[_0x5b69d6(0x119)],_0x5b69d6(0x117),undefined,{'helpText':_0x5b69d6(0xe7)});const _0x155bd2={...process[_0x5b69d6(0x111)]};!_0x2d5ada&&(_0x155bd2['ANTHROPIC_BASE_URL']=_0x5b69d6(0xb4)+this[_0x5b69d6(0x137)],_0x155bd2['ANTHROPIC_MODEL']=_0x1417cf,_0x155bd2['ANTHROPIC_AUTH_TOKEN']=_0x5b69d6(0xe5));const _0x212c76=spawn(_0x5cb81f,_0x3d5788,{'stdio':'inherit','env':_0x155bd2}),_0x5718c8=await new Promise(_0x81cc9a=>{const _0x16b4ca=_0x5b69d6;_0x212c76['on'](_0x16b4ca(0xc9),_0x316727=>{_0x81cc9a(_0x316727||0x0);}),_0x212c76['on'](_0x16b4ca(0x12b),_0x7a2e87=>{const _0x41fa09=_0x16b4ca;console[_0x41fa09(0x12b)](a16_0x338c2b['red'](_0x41fa09(0xb3)+_0x7a2e87['message'])),_0x81cc9a(0x1);});});this[_0x5b69d6(0x105)]&&(await this[_0x5b69d6(0x105)][_0x5b69d6(0x126)](),console['log'](a16_0x338c2b[_0x5b69d6(0xd4)](_0x5b69d6(0xe9))));if(this['logger']){await this[_0x5b69d6(0xcd)][_0x5b69d6(0xd7)]();const _0x2259c5=this[_0x5b69d6(0xcd)][_0x5b69d6(0x112)]();console[_0x5b69d6(0x11d)](a16_0x338c2b[_0x5b69d6(0xd4)](_0x5b69d6(0x134)+_0x2259c5));}return this[_0x5b69d6(0xe3)]&&(await restoreClaudeSettings(this['originalSettings']),console[_0x5b69d6(0x11d)](a16_0x338c2b[_0x5b69d6(0xd4)](_0x5b69d6(0xfa)))),_0x5718c8;}catch(_0x5a3d18){this[_0x5b69d6(0x105)]&&await this[_0x5b69d6(0x105)][_0x5b69d6(0x126)]();this['logger']&&await this[_0x5b69d6(0xcd)][_0x5b69d6(0xd7)]();this[_0x5b69d6(0xe3)]&&await restoreClaudeSettings(this[_0x5b69d6(0xe3)]);throw _0x5a3d18;}}async['findClaudePath'](){return new Promise(_0x12547d=>{const _0x1559cb=a16_0x3fad,_0xf88615=spawn(_0x1559cb(0xcb),[_0x1559cb(0x116)]);let _0x56a7c0='';_0xf88615['stdout']['on'](_0x1559cb(0x13a),_0x3f261f=>{_0x56a7c0+=_0x3f261f['toString']();}),_0xf88615['on'](_0x1559cb(0xc9),_0x2a5efd=>{const _0x53a3ee=_0x1559cb;_0x2a5efd===0x0&&_0x56a7c0[_0x53a3ee(0x140)]()?_0x12547d(_0x56a7c0['trim']()):_0x12547d(null);});});}}
|
|
1
|
+
const a16_0x41ede2=a16_0x3fa3;(function(_0x2a26b5,_0x3511f1){const _0x47d4e5=a16_0x3fa3,_0x22f94a=_0x2a26b5();while(!![]){try{const _0x4d5073=parseInt(_0x47d4e5(0x1d0))/0x1*(-parseInt(_0x47d4e5(0x19e))/0x2)+parseInt(_0x47d4e5(0x1f0))/0x3+parseInt(_0x47d4e5(0x187))/0x4+parseInt(_0x47d4e5(0x1ff))/0x5*(-parseInt(_0x47d4e5(0x184))/0x6)+parseInt(_0x47d4e5(0x20b))/0x7*(-parseInt(_0x47d4e5(0x1a9))/0x8)+-parseInt(_0x47d4e5(0x1b9))/0x9*(-parseInt(_0x47d4e5(0x210))/0xa)+parseInt(_0x47d4e5(0x1f1))/0xb;if(_0x4d5073===_0x3511f1)break;else _0x22f94a['push'](_0x22f94a['shift']());}catch(_0x5894c8){_0x22f94a['push'](_0x22f94a['shift']());}}}(a16_0x522b,0xcadbb));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';function a16_0x522b(){const _0x191cb5=['sql-skills','ANTHROPIC_MODEL','port','localhost','logLevel','ANTHROPIC_AUTH_TOKEN','install','error','Configuring\x20marketplace\x20\x27','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','4768305fjFcau','6688594xpUVcf','text','):\x20claude\x20','join','http://127.0.0.1:','\x27\x20installed','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','findClaudePath','tdx-managed-proxy','marketplace','close','INSTALLATION_FAILED','settings.local.json','utf-8','1198355hKotds','tdx\x20claude\x20statusline','✓\x20Logs\x20saved\x20to\x20','\x20claude\x20statusline','127.0.0.1','env','warn','\x20already\x20configured','\x27...','cause','ENOENT','\x20meets\x20minimum\x20requirement','5790218reRYhW','execute','unshift','claude','pipe','10mCUzYk','account_id','Checking\x20Claude\x20Code\x20version...','debug','✓\x20Marketplace\x20\x27','llm','plugin','cwd','18rMGIPX','string','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','1502572JPVDST','red','add','TD\x20Docs\x20MCP\x20Server','log','init','Claude\x20Code\x20CLI\x20not\x20found','Failed\x20to\x20update\x20marketplace\x20\x27','td-skills','green','trim','server','already\x20exists','Setting\x20up\x20project...','✓\x20Plugin\x20\x27','stringify','object','CLAUDE_CODE_NOT_FOUND','http','Creating\x20.claude/settings.local.json...','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','tdx-skills','type','716366EJDClo','info','exit','\x27\x20configured','Initializing...','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','2.0.20','INTERNAL','CLAUDE_CODE_UNSUPPORTED_VERSION','stdout','--version','16ewxcIb','td-skills\x20Plugins','workflow-skills','getCurrent','statusLine','https://github.com/treasure-data/td-skills','Finding\x20available\x20port...','ANTHROPIC_BASE_URL','✓\x20Port\x20','\x27\x20updated','start','stop','which','data','message','attributes','8903871LOjzba','name','verbose','includes','https://docs.treasuredata.com/mcp','Claude\x20Code\x20version\x20check\x20failed','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','toString','Failed\x20to\x20spawn\x20claude\x20command:\x20','✓\x20Using\x20project:\x20','continue','inherit','Command\x20spawn\x20error:\x20','hostname','parse','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','Claude\x20Code\x20version\x20','fail','--transport','mcp','minor','tdx','✓\x20Claude\x20Code\x20version\x20OK','1SeTVjv','.claude','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Command\x20failed\x20(exit\x20','logger','getLogPath','originalSettings','sonnet','Updating\x20marketplace\x20\x27','user','Invalid\x20minimum\x20version\x20format:\x20','site','\x20is\x20too\x20old\x20(minimum:\x20','td-docs','major','profile','code','getOrCreateDefaultProject','patch','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','command','model'];a16_0x522b=function(){return _0x191cb5;};return a16_0x522b();}import{join}from'node:path';import a16_0x27b69f from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a16_0x3fa3(_0x4e6a6d,_0x5ce794){_0x4e6a6d=_0x4e6a6d-0x183;const _0x522ba2=a16_0x522b();let _0x3fa32d=_0x522ba2[_0x4e6a6d];return _0x3fa32d;}import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a16_0x41ede2(0x1a4);function handleInstallationError(_0x445d78,_0x1774a6,_0x49609f,_0x337d5d){const _0x35db9f=a16_0x41ede2;errorContains(_0x445d78,_0x35db9f(0x193),'already\x20installed','already\x20configured')?(_0x49609f['text']='✓\x20'+_0x1774a6+'\x20already\x20configured',_0x337d5d?.[_0x35db9f(0x19f)](_0x1774a6+_0x35db9f(0x206)),_0x445d78 instanceof SDKError&&_0x445d78[_0x35db9f(0x208)]&&_0x337d5d?.[_0x35db9f(0x213)]('Command\x20output:\x20'+_0x445d78[_0x35db9f(0x208)][_0x35db9f(0x1b7)])):(_0x49609f[_0x35db9f(0x205)]('Warning:\x20Failed\x20to\x20configure\x20'+_0x1774a6),_0x337d5d?.['error'](_0x1774a6+'\x20configuration\x20failed',_0x445d78));}export function parseVersion(_0x4d92d7){const _0x3b60cd=a16_0x41ede2,_0x5e5f67=_0x4d92d7[_0x3b60cd(0x191)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x5e5f67)return null;return{'major':parseInt(_0x5e5f67[0x1],0xa),'minor':parseInt(_0x5e5f67[0x2],0xa),'patch':parseInt(_0x5e5f67[0x3],0xa)};}export function compareVersions(_0x1bf3f8,_0x2cee7f){const _0x55e481=a16_0x41ede2;if(_0x1bf3f8['major']!==_0x2cee7f[_0x55e481(0x1de)])return _0x1bf3f8['major']-_0x2cee7f[_0x55e481(0x1de)];if(_0x1bf3f8[_0x55e481(0x1cd)]!==_0x2cee7f[_0x55e481(0x1cd)])return _0x1bf3f8['minor']-_0x2cee7f['minor'];return _0x1bf3f8[_0x55e481(0x1e2)]-_0x2cee7f['patch'];}async function checkClaudeVersion(_0x5272de,_0x5984e2){const _0x1699ca=a16_0x41ede2;_0x5984e2?.[_0x1699ca(0x213)](_0x1699ca(0x1ef)+_0x5272de+')');const _0x2d8990=await executeClaudeCommand([_0x1699ca(0x1a8)],undefined,_0x5984e2),_0x4abc29=parseVersion(_0x2d8990);if(!_0x4abc29){_0x5984e2?.[_0x1699ca(0x205)](_0x1699ca(0x1c8)+_0x2d8990);return;}const _0x3b82bc=_0x4abc29[_0x1699ca(0x1de)]+'.'+_0x4abc29['minor']+'.'+_0x4abc29['patch'],_0x6f61c2=parseVersion(_0x5272de);if(!_0x6f61c2){_0x5984e2?.['warn'](_0x1699ca(0x1da)+_0x5272de);return;}if(compareVersions(_0x4abc29,_0x6f61c2)<0x0){_0x5984e2?.[_0x1699ca(0x1ed)](_0x1699ca(0x1c9)+_0x3b82bc+_0x1699ca(0x1dc)+_0x5272de+')');throw new SDKError(ErrorCode[_0x1699ca(0x1a6)],_0x1699ca(0x1c9)+_0x3b82bc+_0x1699ca(0x1bf)+_0x5272de+'\x20or\x20later.',undefined,{'helpText':_0x1699ca(0x1d2)});}_0x5984e2?.['debug'](_0x1699ca(0x1c9)+_0x3b82bc+_0x1699ca(0x20a));}async function executeClaudeCommand(_0x129c1a,_0x4249fb,_0x5a24d7){const _0x253cb9=a16_0x41ede2;return _0x5a24d7?.['info']('Executing:\x20claude\x20'+_0x129c1a[_0x253cb9(0x1f4)]('\x20')),new Promise((_0x594d04,_0x4ffaeb)=>{const _0x18898d=_0x253cb9,_0x92307c=spawn(_0x18898d(0x20e),_0x129c1a,{'stdio':_0x18898d(0x20f)});let _0x1f8dc6='',_0x49fa76='';_0x92307c[_0x18898d(0x1a7)]['on'](_0x18898d(0x1b6),_0x5a767f=>{const _0x42bf68=_0x18898d;_0x1f8dc6+=_0x5a767f[_0x42bf68(0x1c0)]();}),_0x92307c['stderr']['on']('data',_0x1fc024=>{const _0x496f71=_0x18898d;_0x49fa76+=_0x1fc024[_0x496f71(0x1c0)]();}),_0x92307c['on'](_0x18898d(0x1ed),_0x4e197c=>{const _0x7baeb2=_0x18898d;_0x4e197c[_0x7baeb2(0x1e0)]===_0x7baeb2(0x209)?(_0x5a24d7?.['error'](_0x7baeb2(0x18d)),_0x4ffaeb(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',_0x4e197c,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x5a24d7?.[_0x7baeb2(0x1ed)](_0x7baeb2(0x1c5)+_0x4e197c[_0x7baeb2(0x1b7)]),_0x4ffaeb(new SDKError(ErrorCode[_0x7baeb2(0x1a5)],_0x7baeb2(0x1c1)+_0x4e197c[_0x7baeb2(0x1b7)],_0x4e197c)));}),_0x92307c['on']('exit',_0x2d9563=>{const _0x43589c=_0x18898d;if(_0x2d9563===0x0)_0x594d04(_0x1f8dc6);else _0x4249fb?(_0x5a24d7?.[_0x43589c(0x1ed)](_0x43589c(0x1d3)+_0x2d9563+_0x43589c(0x1f3)+_0x129c1a[_0x43589c(0x1f4)]('\x20')),_0x4ffaeb(new SDKError(ErrorCode[_0x43589c(0x1fc)],_0x4249fb,new Error(_0x49fa76)))):_0x594d04('');});});}async function ensureMcpServer(_0x52d157,_0x2e19f4,_0x88705c,_0x77b871,_0x2a2142){const _0x4b42c3=a16_0x41ede2;_0x77b871['text']='Configuring\x20MCP\x20server\x20\x27'+_0x52d157+'\x27...',await executeClaudeCommand([_0x4b42c3(0x1cc),_0x4b42c3(0x189),_0x52d157,_0x2e19f4,_0x4b42c3(0x1cb),_0x88705c],_0x4b42c3(0x1e3)+_0x52d157+'\x27',_0x2a2142),_0x77b871['text']='✓\x20MCP\x20server\x20\x27'+_0x52d157+'\x27\x20configured';}async function ensureMarketplace(_0x4398f2,_0x1850a4,_0x1a3fd9,_0x2e56aa){const _0x3d8ef7=a16_0x41ede2;_0x1a3fd9['text']=_0x3d8ef7(0x1ee)+_0x4398f2+_0x3d8ef7(0x207),await executeClaudeCommand([_0x3d8ef7(0x216),_0x3d8ef7(0x1fa),_0x3d8ef7(0x189),_0x1850a4],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x4398f2+'\x27',_0x2e56aa),_0x1a3fd9[_0x3d8ef7(0x1f2)]=_0x3d8ef7(0x214)+_0x4398f2+_0x3d8ef7(0x1a1);}async function updateMarketplace(_0x4193b3,_0x313bb4,_0x3b1591){const _0x5567cd=a16_0x41ede2;_0x313bb4[_0x5567cd(0x1f2)]=_0x5567cd(0x1d8)+_0x4193b3+_0x5567cd(0x207),await executeClaudeCommand([_0x5567cd(0x216),_0x5567cd(0x1fa),'update'],_0x5567cd(0x18e)+_0x4193b3+'\x27',_0x3b1591),_0x313bb4[_0x5567cd(0x1f2)]='✓\x20Marketplace\x20\x27'+_0x4193b3+_0x5567cd(0x1b2);}async function ensurePlugin(_0x380545,_0x414daa,_0x3ba884,_0x5015ee){const _0x6e4475=a16_0x41ede2;_0x3ba884[_0x6e4475(0x1f2)]='Installing\x20plugin\x20\x27'+_0x380545+_0x6e4475(0x207),await executeClaudeCommand([_0x6e4475(0x216),_0x6e4475(0x1ec),_0x380545+'@'+_0x414daa],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x380545+'\x27',_0x5015ee),_0x3ba884[_0x6e4475(0x1f2)]=_0x6e4475(0x195)+_0x380545+_0x6e4475(0x1f6);}async function createClaudeSettings(_0x23afbd,_0x42795d=a16_0x41ede2(0x1d7),_0x3ee5e4){const _0x449222=a16_0x41ede2,_0x35de55=join(process['cwd'](),_0x449222(0x1d1)),_0x43e821=join(_0x35de55,_0x449222(0x1fd));await mkdir(_0x35de55,{'recursive':!![]});let _0x52e2ca={};if(existsSync(_0x43e821))try{const _0x52b8f8=await readFile(_0x43e821,'utf-8');_0x52e2ca=JSON[_0x449222(0x1c7)](_0x52b8f8);}catch{_0x52e2ca={};}const _0xf9cac3=_0x52e2ca['env']||{},_0x1f4124={'ANTHROPIC_BASE_URL':_0xf9cac3[_0x449222(0x1b0)],'ANTHROPIC_MODEL':_0xf9cac3[_0x449222(0x1e7)],'ANTHROPIC_AUTH_TOKEN':_0xf9cac3[_0x449222(0x1eb)],'statusLine':_0x52e2ca[_0x449222(0x1ad)]},_0x5f42fa={..._0x52e2ca,'env':{..._0xf9cac3,'ANTHROPIC_BASE_URL':_0x449222(0x1f5)+_0x23afbd,'ANTHROPIC_MODEL':_0x42795d,'ANTHROPIC_AUTH_TOKEN':_0x449222(0x1f9)},'statusLine':{'type':_0x449222(0x1e4),'command':_0x3ee5e4?'tdx\x20--profile\x20'+_0x3ee5e4+_0x449222(0x202):_0x449222(0x200)}};return await writeFile(_0x43e821,JSON['stringify'](_0x5f42fa,null,0x2)+'\x0a'),_0x1f4124;}async function restoreClaudeSettings(_0x30b197){const _0x546d9d=a16_0x41ede2,_0x4660dc=join(process[_0x546d9d(0x183)](),_0x546d9d(0x1d1)),_0x4db1fc=join(_0x4660dc,_0x546d9d(0x1fd));if(!existsSync(_0x4db1fc))return;try{const _0x52783d=await readFile(_0x4db1fc,_0x546d9d(0x1fe)),_0x264ee3=JSON[_0x546d9d(0x1c7)](_0x52783d),_0x46da4f=_0x264ee3[_0x546d9d(0x204)]||{},_0x19c839=_0x46da4f[_0x546d9d(0x1b0)],_0x5ca596=((()=>{const _0x17f54c=_0x546d9d;if(typeof _0x19c839!==_0x17f54c(0x185))return![];try{const _0x3ffd40=new URL(_0x19c839);return _0x3ffd40[_0x17f54c(0x1c6)]===_0x17f54c(0x1e9)||_0x3ffd40['hostname']===_0x17f54c(0x203);}catch{return![];}})());_0x5ca596?(delete _0x46da4f[_0x546d9d(0x1b0)],delete _0x46da4f['ANTHROPIC_MODEL'],delete _0x46da4f[_0x546d9d(0x1eb)]):(_0x30b197[_0x546d9d(0x1b0)]!==undefined?_0x46da4f[_0x546d9d(0x1b0)]=_0x30b197['ANTHROPIC_BASE_URL']:delete _0x46da4f[_0x546d9d(0x1b0)],_0x30b197['ANTHROPIC_MODEL']!==undefined?_0x46da4f[_0x546d9d(0x1e7)]=_0x30b197[_0x546d9d(0x1e7)]:delete _0x46da4f[_0x546d9d(0x1e7)],_0x30b197[_0x546d9d(0x1eb)]!==undefined?_0x46da4f[_0x546d9d(0x1eb)]=_0x30b197[_0x546d9d(0x1eb)]:delete _0x46da4f[_0x546d9d(0x1eb)]);const _0x1440d9=_0x264ee3[_0x546d9d(0x1ad)],_0x3b3096=((()=>{const _0xb1a7d0=_0x546d9d;if(!_0x1440d9||typeof _0x1440d9!==_0xb1a7d0(0x197))return![];if(_0x1440d9[_0xb1a7d0(0x19d)]!==_0xb1a7d0(0x1e4))return![];if(typeof _0x1440d9['command']!=='string')return![];return _0x1440d9['command'][_0xb1a7d0(0x1bc)](_0xb1a7d0(0x1ce))&&_0x1440d9[_0xb1a7d0(0x1e4)]['includes']('statusline');})());if(_0x3b3096)delete _0x264ee3[_0x546d9d(0x1ad)];else _0x30b197[_0x546d9d(0x1ad)]!==undefined?_0x264ee3[_0x546d9d(0x1ad)]=_0x30b197[_0x546d9d(0x1ad)]:delete _0x264ee3[_0x546d9d(0x1ad)];_0x264ee3[_0x546d9d(0x204)]=_0x46da4f,await writeFile(_0x4db1fc,JSON[_0x546d9d(0x196)](_0x264ee3,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a16_0x41ede2(0x20e);['description']=a16_0x41ede2(0x1f7);[a16_0x41ede2(0x192)];[a16_0x41ede2(0x1d6)];[a16_0x41ede2(0x1d4)];['port'];async[a16_0x41ede2(0x20c)](_0x38d536){const _0xb0cdc2=a16_0x41ede2,{tdx:_0x29385f,options:_0x5243ba,args:_0x261b40}=_0x38d536;try{const _0x425d2a=_0x5243ba,_0x2d4374=_0x425d2a[_0xb0cdc2(0x1e5)]||_0xb0cdc2(0x1d7),_0x38eb1b=_0x425d2a['proxy']===![],_0x1a3add=_0x425d2a[_0xb0cdc2(0x1c3)]===!![],_0x4ada58=_0x425d2a['resume']===!![],_0x298379=[..._0x261b40];if(_0x1a3add)_0x298379[_0xb0cdc2(0x20d)]('-c');else _0x4ada58&&_0x298379['unshift']('-r');const _0x1752ab=createCommandSpinner(_0xb0cdc2(0x1a2),{'verbose':_0x5243ba[_0xb0cdc2(0x1bb)]});_0x1752ab[_0xb0cdc2(0x1b3)]();try{if(!_0x38eb1b){_0x1752ab['text']=_0xb0cdc2(0x1af),this[_0xb0cdc2(0x1e8)]=await findAvailablePort(0xfa0),_0x1752ab[_0xb0cdc2(0x1f2)]=_0xb0cdc2(0x1b1)+this[_0xb0cdc2(0x1e8)],_0x1752ab[_0xb0cdc2(0x1f2)]=_0xb0cdc2(0x194);const _0x367f35=await _0x29385f[_0xb0cdc2(0x215)][_0xb0cdc2(0x1e1)](),_0x95ec1f=_0x367f35['id'];_0x1752ab[_0xb0cdc2(0x1f2)]=_0xb0cdc2(0x1c2)+_0x367f35[_0xb0cdc2(0x1b8)][_0xb0cdc2(0x1ba)];const _0x4c9035=_0x5243ba[_0xb0cdc2(0x1df)];try{const _0x12cc9e=await _0x29385f[_0xb0cdc2(0x1d9)][_0xb0cdc2(0x1ac)]();_0x12cc9e[_0xb0cdc2(0x211)]&&writeCachedAccountInfo(_0x5243ba[_0xb0cdc2(0x1db)],_0x12cc9e['account_id'],_0x4c9035);}catch{}_0x1752ab[_0xb0cdc2(0x1f2)]='Initializing\x20proxy\x20logger...',this['logger']=new TDXLogger(_0x5243ba[_0xb0cdc2(0x1ea)],!![]),await this[_0xb0cdc2(0x1d4)][_0xb0cdc2(0x18c)]();const _0xd8ba34=this['logger']['getLogPath']();_0x1752ab[_0xb0cdc2(0x1f2)]='✓\x20Logging\x20to\x20'+_0xd8ba34,_0x1752ab[_0xb0cdc2(0x1f2)]='Starting\x20TD\x20LLM\x20proxy\x20server...',this[_0xb0cdc2(0x192)]=new ProxyServer({'port':this[_0xb0cdc2(0x1e8)],'projectId':_0x95ec1f,'tdx':_0x29385f,'logger':this[_0xb0cdc2(0x1d4)],'site':_0x5243ba[_0xb0cdc2(0x1db)]}),await this[_0xb0cdc2(0x192)][_0xb0cdc2(0x1b3)](),_0x1752ab[_0xb0cdc2(0x1f2)]=_0xb0cdc2(0x19b)+this[_0xb0cdc2(0x1e8)],_0x1752ab['text']=_0xb0cdc2(0x19a),this[_0xb0cdc2(0x1d6)]=await createClaudeSettings(this['port'],_0x2d4374,_0x4c9035),_0x1752ab[_0xb0cdc2(0x1f2)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x1752ab['text']='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x1752ab[_0xb0cdc2(0x1f2)]=_0xb0cdc2(0x212),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0xb0cdc2(0x1d4)]),_0x1752ab['text']=_0xb0cdc2(0x1cf);}catch(_0x397e7c){_0x1752ab[_0xb0cdc2(0x1ca)](_0xb0cdc2(0x1be));throw _0x397e7c;}try{await ensureMcpServer(_0xb0cdc2(0x1dd),_0xb0cdc2(0x1bd),_0xb0cdc2(0x199),_0x1752ab,this[_0xb0cdc2(0x1d4)]);}catch(_0x45f087){handleInstallationError(_0x45f087,_0xb0cdc2(0x18a),_0x1752ab,this['logger']);}try{await ensureMarketplace(_0xb0cdc2(0x18f),_0xb0cdc2(0x1ae),_0x1752ab,this['logger']),await updateMarketplace(_0xb0cdc2(0x18f),_0x1752ab,this[_0xb0cdc2(0x1d4)]),await ensurePlugin(_0xb0cdc2(0x1e6),_0xb0cdc2(0x18f),_0x1752ab,this[_0xb0cdc2(0x1d4)]),await ensurePlugin(_0xb0cdc2(0x1ab),_0xb0cdc2(0x18f),_0x1752ab,this[_0xb0cdc2(0x1d4)]),await ensurePlugin(_0xb0cdc2(0x19c),_0xb0cdc2(0x18f),_0x1752ab,this[_0xb0cdc2(0x1d4)]);}catch(_0x5c6e0c){handleInstallationError(_0x5c6e0c,_0xb0cdc2(0x1aa),_0x1752ab,this['logger']);}_0x1752ab[_0xb0cdc2(0x1b4)]();}catch(_0xf33638){_0x1752ab['fail']('Setup\x20failed');throw _0xf33638;}const _0x4944b1=await this[_0xb0cdc2(0x1f8)]();if(!_0x4944b1)throw new SDKError(ErrorCode[_0xb0cdc2(0x198)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0xb0cdc2(0x1a3)});const _0x41fe3e={...process['env']};!_0x38eb1b&&(_0x41fe3e[_0xb0cdc2(0x1b0)]='http://127.0.0.1:'+this[_0xb0cdc2(0x1e8)],_0x41fe3e[_0xb0cdc2(0x1e7)]=_0x2d4374,_0x41fe3e[_0xb0cdc2(0x1eb)]=_0xb0cdc2(0x1f9));const _0xcca461=spawn(_0x4944b1,_0x298379,{'stdio':_0xb0cdc2(0x1c4),'env':_0x41fe3e}),_0x2b9744=await new Promise(_0x302be1=>{const _0x4747e8=_0xb0cdc2;_0xcca461['on']('exit',_0x129258=>{_0x302be1(_0x129258||0x0);}),_0xcca461['on'](_0x4747e8(0x1ed),_0x560894=>{const _0x4a9310=_0x4747e8;console['error'](a16_0x27b69f[_0x4a9310(0x188)]('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x560894[_0x4a9310(0x1b7)])),_0x302be1(0x1);});});this[_0xb0cdc2(0x192)]&&(await this['server'][_0xb0cdc2(0x1b4)](),console[_0xb0cdc2(0x18b)](a16_0x27b69f[_0xb0cdc2(0x190)](_0xb0cdc2(0x186))));if(this[_0xb0cdc2(0x1d4)]){await this['logger']['close']();const _0x36a4b5=this[_0xb0cdc2(0x1d4)][_0xb0cdc2(0x1d5)]();console[_0xb0cdc2(0x18b)](a16_0x27b69f[_0xb0cdc2(0x190)](_0xb0cdc2(0x201)+_0x36a4b5));}return this[_0xb0cdc2(0x1d6)]&&(await restoreClaudeSettings(this[_0xb0cdc2(0x1d6)]),console[_0xb0cdc2(0x18b)](a16_0x27b69f['green']('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x2b9744;}catch(_0x138ba8){this[_0xb0cdc2(0x192)]&&await this[_0xb0cdc2(0x192)][_0xb0cdc2(0x1b4)]();this['logger']&&await this[_0xb0cdc2(0x1d4)][_0xb0cdc2(0x1fb)]();this[_0xb0cdc2(0x1d6)]&&await restoreClaudeSettings(this[_0xb0cdc2(0x1d6)]);throw _0x138ba8;}}async[a16_0x41ede2(0x1f8)](){return new Promise(_0x5c210b=>{const _0x334d39=a16_0x3fa3,_0x5d2c61=spawn(_0x334d39(0x1b5),[_0x334d39(0x20e)]);let _0x2fe5a7='';_0x5d2c61[_0x334d39(0x1a7)]['on'](_0x334d39(0x1b6),_0x38a6f3=>{const _0x224355=_0x334d39;_0x2fe5a7+=_0x38a6f3[_0x224355(0x1c0)]();}),_0x5d2c61['on'](_0x334d39(0x1a0),_0x43b853=>{const _0x3131b6=_0x334d39;_0x43b853===0x0&&_0x2fe5a7[_0x3131b6(0x191)]()?_0x5c210b(_0x2fe5a7[_0x3131b6(0x191)]()):_0x5c210b(null);});});}}
|