@treasuredata/tdx 0.9.6 → 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 +53 -18
- 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.d.ts +30 -0
- package/dist/utils/journey-utils.d.ts.map +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/journey-utils.js.map +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_0x5106de=a10_0x443d;(function(_0x315b4b,_0x6c816){const _0x2fff36=a10_0x443d,_0x50983f=_0x315b4b();while(!![]){try{const _0x41eb87=-parseInt(_0x2fff36(0x1b4))/0x1*(parseInt(_0x2fff36(0x1e2))/0x2)+parseInt(_0x2fff36(0x1e4))/0x3*(-parseInt(_0x2fff36(0x1d1))/0x4)+-parseInt(_0x2fff36(0x19d))/0x5+-parseInt(_0x2fff36(0x1a4))/0x6+parseInt(_0x2fff36(0x1d7))/0x7*(-parseInt(_0x2fff36(0x1ef))/0x8)+-parseInt(_0x2fff36(0x1bd))/0x9*(parseInt(_0x2fff36(0x1c9))/0xa)+parseInt(_0x2fff36(0x1d0))/0xb;if(_0x41eb87===_0x6c816)break;else _0x50983f['push'](_0x50983f['shift']());}catch(_0x16eb77){_0x50983f['push'](_0x50983f['shift']());}}}(a10_0xfb46,0x85ebc));function a10_0xfb46(){const _0x5ce84b=['5068950wjRmuS','project_name','allowQueueing','site','/api/sessions','listLogFiles','/api/sessions/','642156dmlBDU','listAttempts','resume_from','from_task','POST','clear_schedule','/api/workflows?','projectName','/api/projects','to_time','/api/attempts','status','readFile','retry_params','workflowName','name_pattern','4IHptnG','tasks','attempts','offset','revision','/api/projects?','/logs','task','/api/logs/','9iBqakt','request','search_project_name','workflow','application/gzip','append','writeFile','PUT','scheduleFrom','project_id','include_retried','getTaskLogs','39630MjEmHp','project','/api/workflows','arraybuffer','schedule_from','/api/attempts?','/api/projects/','38711904vReOPz','56splVIt','killAttempt','retryAttempt','/archive','/tasks/','include_subtasks','1029giBWoB','workflow_name','/tasks?','params','startAttempt','filter','/logs?','downloadProjectArchive','DELETE','/files','clear_schedule_all','349802yMnKAT','/sessions','41493oRAOIy','true','sessionTime','httpClient','reason','workflows','limit','retryAttemptName','workflowId','getAttempt','listProjects','51848VboNAE','replace','toString','listWorkflows','authHeaders','GET','clearSchedule','last_id','/kill','/api/attempts/','/archive?','apiKey','/retry','/files?','lastId','name','projects','from_time','force'];a10_0xfb46=function(){return _0x5ce84b;};return a10_0xfb46();}import{HTTPClient}from'./http-client.js';function a10_0x443d(_0x1454b5,_0x474c26){_0x1454b5=_0x1454b5-0x190;const _0xfb46f5=a10_0xfb46();let _0x443d9a=_0xfb46f5[_0x1454b5];return _0x443d9a;}import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{['httpClient'];[a10_0x5106de(0x1f3)];constructor(_0x2aaeb9,_0x4b9c91){const _0x5cedb2=a10_0x5106de,_0x67fe94=getEndpoint(_0x2aaeb9['site'],'workflow');this[_0x5cedb2(0x1f3)]=toHeaderRecord(getAuthHeaders(_0x2aaeb9[_0x5cedb2(0x1a0)],_0x2aaeb9[_0x5cedb2(0x195)])),this[_0x5cedb2(0x1e7)]=new HTTPClient(_0x67fe94,this[_0x5cedb2(0x1f3)],_0x4b9c91);}async[a10_0x5106de(0x1ee)](_0x2d158e){const _0x34077b=a10_0x5106de,_0x4dbc81=new URLSearchParams();if(_0x2d158e?.[_0x34077b(0x1ea)])_0x4dbc81[_0x34077b(0x1c2)]('limit',String(_0x2d158e[_0x34077b(0x1ea)]));if(_0x2d158e?.[_0x34077b(0x191)])_0x4dbc81[_0x34077b(0x1c2)](_0x34077b(0x191),_0x2d158e[_0x34077b(0x191)]);if(_0x2d158e?.[_0x34077b(0x1b3)]){const _0x18c77a=_0x2d158e[_0x34077b(0x1b3)][_0x34077b(0x1f0)](/[*?]/g,'');_0x18c77a&&_0x4dbc81['append'](_0x34077b(0x1b3),_0x18c77a);}const _0x252d87=_0x4dbc81[_0x34077b(0x1f1)](),_0x4684b6=_0x252d87?_0x34077b(0x1b9)+_0x252d87:_0x34077b(0x1ac),_0x1086bb=await this[_0x34077b(0x1e7)][_0x34077b(0x1be)](_0x34077b(0x1f4),_0x4684b6);let _0x4933e6=_0x1086bb[_0x34077b(0x19a)]||[];return _0x2d158e?.['name_pattern']&&(_0x4933e6=_0x4933e6[_0x34077b(0x1dc)](_0x522597=>{const _0x45d55b=_0x34077b;return matchGlobPattern(_0x522597[_0x45d55b(0x199)],_0x2d158e['name_pattern']);})),{'data':_0x4933e6,'lastId':_0x1086bb['lastId']};}async[a10_0x5106de(0x1f2)](_0x4fb978){const _0x162369=a10_0x5106de,_0x7424d5=new URLSearchParams();if(_0x4fb978?.['limit'])_0x7424d5[_0x162369(0x1c2)](_0x162369(0x1ea),String(_0x4fb978['limit']));if(_0x4fb978?.[_0x162369(0x191)])_0x7424d5['append'](_0x162369(0x191),_0x4fb978[_0x162369(0x191)]);if(_0x4fb978?.[_0x162369(0x19e)]){const _0x5e6dd8=_0x4fb978[_0x162369(0x19e)][_0x162369(0x1f0)](/[*?]/g,'');_0x5e6dd8&&(_0x7424d5['append'](_0x162369(0x1b3),_0x5e6dd8),_0x7424d5[_0x162369(0x1c2)](_0x162369(0x1bf),'true'));}const _0x559289=_0x7424d5[_0x162369(0x1f1)](),_0x3f2619=_0x559289?_0x162369(0x1aa)+_0x559289:_0x162369(0x1cb),_0x19a48c=await this[_0x162369(0x1e7)][_0x162369(0x1be)](_0x162369(0x1f4),_0x3f2619);let _0x35cf51=_0x19a48c[_0x162369(0x1e9)]||[];return _0x4fb978?.[_0x162369(0x19e)]&&(_0x35cf51=_0x35cf51['filter'](_0x547b3f=>{const _0x59577f=_0x162369,_0x1ff8e9=_0x547b3f[_0x59577f(0x1ca)]?.[_0x59577f(0x199)];if(!_0x1ff8e9)return![];return matchGlobPattern(_0x1ff8e9,_0x4fb978[_0x59577f(0x19e)]);})),{'data':_0x35cf51,'lastId':_0x19a48c[_0x162369(0x198)]};}async['listSessions'](_0x501983){const _0x2c5ff9=a10_0x5106de;let _0x442f69=_0x2c5ff9(0x1a1);_0x501983?.[_0x2c5ff9(0x1c6)]&&(_0x442f69=_0x2c5ff9(0x1cf)+encodeURIComponent(_0x501983[_0x2c5ff9(0x1c6)])+_0x2c5ff9(0x1e3));const _0x2065f5=new URLSearchParams();if(_0x501983?.[_0x2c5ff9(0x1d8)])_0x2065f5[_0x2c5ff9(0x1c2)](_0x2c5ff9(0x1c0),_0x501983[_0x2c5ff9(0x1d8)]);if(_0x501983?.['status'])_0x2065f5[_0x2c5ff9(0x1c2)](_0x2c5ff9(0x1af),_0x501983[_0x2c5ff9(0x1af)]);if(_0x501983?.[_0x2c5ff9(0x19b)])_0x2065f5['append'](_0x2c5ff9(0x19b),_0x501983[_0x2c5ff9(0x19b)]);if(_0x501983?.[_0x2c5ff9(0x1ad)])_0x2065f5[_0x2c5ff9(0x1c2)](_0x2c5ff9(0x1ad),_0x501983[_0x2c5ff9(0x1ad)]);if(_0x501983?.[_0x2c5ff9(0x1ea)])_0x2065f5['append']('limit',String(_0x501983['limit']));if(_0x501983?.[_0x2c5ff9(0x191)])_0x2065f5[_0x2c5ff9(0x1c2)](_0x2c5ff9(0x191),_0x501983['last_id']);const _0x10c2f3=_0x2065f5['toString']();_0x10c2f3&&(_0x442f69=_0x442f69+'?'+_0x10c2f3);const _0x555e9b=await this[_0x2c5ff9(0x1e7)]['request'](_0x2c5ff9(0x1f4),_0x442f69);return{'data':_0x555e9b['sessions']||[],'lastId':_0x555e9b['lastId']};}async[a10_0x5106de(0x1a5)](_0x32feec){const _0x17585e=a10_0x5106de,_0x12079b=new URLSearchParams();if(_0x32feec?.[_0x17585e(0x19e)])_0x12079b[_0x17585e(0x1c2)]('project',_0x32feec[_0x17585e(0x19e)]);if(_0x32feec?.[_0x17585e(0x1d8)])_0x12079b[_0x17585e(0x1c2)](_0x17585e(0x1c0),_0x32feec[_0x17585e(0x1d8)]);if(_0x32feec?.[_0x17585e(0x1c7)])_0x12079b[_0x17585e(0x1c2)](_0x17585e(0x1c7),'1');if(_0x32feec?.[_0x17585e(0x1ea)])_0x12079b[_0x17585e(0x1c2)](_0x17585e(0x1ea),String(_0x32feec[_0x17585e(0x1ea)]));if(_0x32feec?.[_0x17585e(0x191)])_0x12079b[_0x17585e(0x1c2)](_0x17585e(0x191),_0x32feec[_0x17585e(0x191)]);const _0x3bdb7f=_0x12079b[_0x17585e(0x1f1)](),_0x580745=_0x3bdb7f?_0x17585e(0x1ce)+_0x3bdb7f:_0x17585e(0x1ae),_0x4ffec4=await this[_0x17585e(0x1e7)][_0x17585e(0x1be)](_0x17585e(0x1f4),_0x580745);return{'data':_0x4ffec4[_0x17585e(0x1b6)]||[],'lastId':_0x4ffec4[_0x17585e(0x198)]};}async[a10_0x5106de(0x1ed)](_0x3fd8fa){const _0xfca72c=a10_0x5106de;return await this[_0xfca72c(0x1e7)][_0xfca72c(0x1be)](_0xfca72c(0x1f4),'/api/attempts/'+encodeURIComponent(_0x3fd8fa));}async['getAttemptTasks'](_0x3b6537,_0x1da6a2=![]){const _0xfee755=a10_0x5106de,_0x7f352e=new URLSearchParams();_0x1da6a2&&_0x7f352e[_0xfee755(0x1c2)](_0xfee755(0x1d6),_0xfee755(0x1e5));const _0x219153=_0x7f352e[_0xfee755(0x1f1)](),_0x31add4=_0x219153?'/api/attempts/'+encodeURIComponent(_0x3b6537)+_0xfee755(0x1d9)+_0x219153:'/api/attempts/'+encodeURIComponent(_0x3b6537)+'/tasks',_0x135d68=await this[_0xfee755(0x1e7)][_0xfee755(0x1be)](_0xfee755(0x1f4),_0x31add4);return _0x135d68[_0xfee755(0x1b5)]||[];}async[a10_0x5106de(0x1c8)](_0x3c8a9b,_0xa576d9,_0x53973e){const _0x4a69b8=a10_0x5106de,_0x46c4a7=new URLSearchParams();_0x53973e?.[_0x4a69b8(0x1b7)]!==undefined&&_0x46c4a7[_0x4a69b8(0x1c2)]('offset',String(_0x53973e['offset']));_0x53973e?.[_0x4a69b8(0x1ea)]!==undefined&&_0x46c4a7['append'](_0x4a69b8(0x1ea),String(_0x53973e['limit']));const _0x3cfb0a=_0x46c4a7['toString'](),_0x42fe8c=_0x3cfb0a?_0x4a69b8(0x193)+encodeURIComponent(_0x3c8a9b)+_0x4a69b8(0x1d5)+encodeURIComponent(_0xa576d9)+_0x4a69b8(0x1dd)+_0x3cfb0a:_0x4a69b8(0x193)+encodeURIComponent(_0x3c8a9b)+_0x4a69b8(0x1d5)+encodeURIComponent(_0xa576d9)+_0x4a69b8(0x1ba),_0x505be1=await this[_0x4a69b8(0x1e7)]['request'](_0x4a69b8(0x1f4),_0x42fe8c);return _0x505be1['logs']||[];}async[a10_0x5106de(0x1a2)](_0x354a1a,_0xe0034){const _0x1bfb1d=a10_0x5106de,_0x1eefaa=new URLSearchParams();_0xe0034&&_0x1eefaa[_0x1bfb1d(0x1c2)](_0x1bfb1d(0x1bb),_0xe0034);const _0x2fa2e7=_0x1eefaa[_0x1bfb1d(0x1f1)](),_0x105e37=_0x2fa2e7?_0x1bfb1d(0x1bc)+encodeURIComponent(_0x354a1a)+_0x1bfb1d(0x197)+_0x2fa2e7:_0x1bfb1d(0x1bc)+encodeURIComponent(_0x354a1a)+_0x1bfb1d(0x1e0),_0x978b49=await this['httpClient'][_0x1bfb1d(0x1be)]('GET',_0x105e37);return _0x978b49['files']||[];}async[a10_0x5106de(0x1d2)](_0x579bec,_0x242717){const _0x46ca72=a10_0x5106de,_0x1fff4d={};return _0x242717&&(_0x1fff4d[_0x46ca72(0x1e8)]=_0x242717),await this[_0x46ca72(0x1e7)]['request'](_0x46ca72(0x1a8),_0x46ca72(0x193)+encodeURIComponent(_0x579bec)+_0x46ca72(0x192),{'body':_0x1fff4d});}async['retrySession'](_0x332566,_0x1c3b45){const _0x3e3595=a10_0x5106de,_0x48930b={};return _0x1c3b45?.[_0x3e3595(0x1a7)]&&(_0x48930b['from_task']=_0x1c3b45[_0x3e3595(0x1a7)]),_0x1c3b45?.['retry_params']&&(_0x48930b[_0x3e3595(0x1b1)]=_0x1c3b45[_0x3e3595(0x1b1)]),await this[_0x3e3595(0x1e7)][_0x3e3595(0x1be)](_0x3e3595(0x1a8),_0x3e3595(0x1a3)+encodeURIComponent(_0x332566)+_0x3e3595(0x196),{'body':_0x48930b});}async[a10_0x5106de(0x1d3)](_0x137a9c,_0x399b7f){const _0x394d3c=a10_0x5106de,_0x2ea3f2={};return _0x399b7f?.[_0x394d3c(0x1a6)]&&(_0x2ea3f2[_0x394d3c(0x1a6)]=_0x399b7f[_0x394d3c(0x1a6)]),_0x399b7f?.['retry_params']&&(_0x2ea3f2['retry_params']=_0x399b7f[_0x394d3c(0x1b1)]),_0x399b7f?.[_0x394d3c(0x19c)]&&(_0x2ea3f2['force']=_0x399b7f[_0x394d3c(0x19c)]),await this[_0x394d3c(0x1e7)][_0x394d3c(0x1be)]('POST',_0x394d3c(0x193)+encodeURIComponent(_0x137a9c)+_0x394d3c(0x196),{'body':_0x2ea3f2});}async[a10_0x5106de(0x1db)](_0x172362){const _0x4ba5f9=a10_0x5106de,_0x21eaeb={'sessionTime':_0x172362[_0x4ba5f9(0x1e6)],'params':_0x172362[_0x4ba5f9(0x1da)]};return _0x172362[_0x4ba5f9(0x1ec)]&&(_0x21eaeb[_0x4ba5f9(0x1ec)]=_0x172362[_0x4ba5f9(0x1ec)]),_0x172362[_0x4ba5f9(0x1ab)]&&(_0x21eaeb[_0x4ba5f9(0x1ab)]=_0x172362[_0x4ba5f9(0x1ab)]),_0x172362[_0x4ba5f9(0x1b2)]&&(_0x21eaeb[_0x4ba5f9(0x1b2)]=_0x172362[_0x4ba5f9(0x1b2)]),_0x172362[_0x4ba5f9(0x1eb)]&&(_0x21eaeb[_0x4ba5f9(0x1eb)]=_0x172362['retryAttemptName']),_0x172362[_0x4ba5f9(0x19f)]!==undefined&&(_0x21eaeb[_0x4ba5f9(0x19f)]=_0x172362[_0x4ba5f9(0x19f)]),await this[_0x4ba5f9(0x1e7)][_0x4ba5f9(0x1be)](_0x4ba5f9(0x1c4),_0x4ba5f9(0x1ae),{'body':_0x21eaeb});}async[a10_0x5106de(0x1de)](_0x1af1d7,_0x2ecbaf,_0x3fa5b9){const _0x22c813=a10_0x5106de,{promises:_0x44c779}=await import('fs'),_0x389a9d=new URLSearchParams();_0x3fa5b9&&_0x389a9d['append'](_0x22c813(0x1b8),_0x3fa5b9);const _0x52e1db=_0x389a9d[_0x22c813(0x1f1)](),_0x1a2c4e=_0x52e1db?_0x22c813(0x1cf)+encodeURIComponent(_0x1af1d7)+_0x22c813(0x194)+_0x52e1db:'/api/projects/'+encodeURIComponent(_0x1af1d7)+_0x22c813(0x1d4),_0x138110=await this['httpClient']['request'](_0x22c813(0x1f4),_0x1a2c4e,{'headers':{'Accept':_0x22c813(0x1c1)},'responseType':_0x22c813(0x1cc)});return await _0x44c779[_0x22c813(0x1c3)](_0x2ecbaf,_0x138110),_0x2ecbaf;}async['uploadProjectArchive'](_0x296c44,_0x2a9556,_0x26f637,_0x5a8862){const _0x542b47=a10_0x5106de,{promises:_0xb8ef63}=await import('fs'),_0x118198=new URLSearchParams();_0x118198[_0x542b47(0x1c2)](_0x542b47(0x1ca),_0x296c44),_0x118198[_0x542b47(0x1c2)](_0x542b47(0x1b8),_0x2a9556);_0x5a8862?.[_0x542b47(0x1c5)]&&_0x118198[_0x542b47(0x1c2)](_0x542b47(0x1cd),_0x5a8862[_0x542b47(0x1c5)]);_0x5a8862?.[_0x542b47(0x190)]&&_0x5a8862[_0x542b47(0x190)]['forEach'](_0xd03390=>{const _0x5d64bd=_0x542b47;_0x118198[_0x5d64bd(0x1c2)](_0x5d64bd(0x1a9),_0xd03390);});_0x5a8862?.['clearScheduleAll']&&_0x118198[_0x542b47(0x1c2)](_0x542b47(0x1e1),_0x542b47(0x1e5));const _0x3922c3=_0x118198[_0x542b47(0x1f1)](),_0x5c3917=_0x542b47(0x1b9)+_0x3922c3,_0x4904d3=await _0xb8ef63[_0x542b47(0x1b0)](_0x26f637);return await this['httpClient'][_0x542b47(0x1be)]('PUT',_0x5c3917,{'body':_0x4904d3,'headers':{'Content-Type':'application/gzip'}});}async['deleteProject'](_0x16702e){const _0x599f96=a10_0x5106de;return await this[_0x599f96(0x1e7)][_0x599f96(0x1be)](_0x599f96(0x1df),_0x599f96(0x1cf)+encodeURIComponent(_0x16702e));}}
|
|
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_0x58e27b=a12_0x5625;(function(_0x57fdf6,_0x2a67f8){const _0x3ce209=a12_0x5625,_0x2ba9ff=_0x57fdf6();while(!![]){try{const _0x1ac9d5=parseInt(_0x3ce209(0x126))/0x1*(parseInt(_0x3ce209(0x104))/0x2)+parseInt(_0x3ce209(0xd8))/0x3*(-parseInt(_0x3ce209(0x143))/0x4)+parseInt(_0x3ce209(0x10a))/0x5+-parseInt(_0x3ce209(0x111))/0x6+-parseInt(_0x3ce209(0x125))/0x7*(parseInt(_0x3ce209(0x11a))/0x8)+-parseInt(_0x3ce209(0x109))/0x9+-parseInt(_0x3ce209(0xca))/0xa*(-parseInt(_0x3ce209(0x10d))/0xb);if(_0x1ac9d5===_0x2a67f8)break;else _0x2ba9ff['push'](_0x2ba9ff['shift']());}catch(_0x3aa5b1){_0x2ba9ff['push'](_0x2ba9ff['shift']());}}}(a12_0x1f12,0x87a87));import a12_0x26b355 from'chalk';import a12_0x10b840 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';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function a12_0x5625(_0x6693d5,_0xebbfbc){_0x6693d5=_0x6693d5-0xc5;const _0x1f12c3=a12_0x1f12();let _0x562550=_0x1f12c3[_0x6693d5];return _0x562550;}function formatCountSummary(_0xff738f){const _0x2cacf7=a12_0x5625,_0x3cb864=[];if(_0xff738f[_0x2cacf7(0x13d)]!==undefined)_0x3cb864[_0x2cacf7(0x11f)](_0xff738f[_0x2cacf7(0x13d)]+_0x2cacf7(0x10c));if(_0xff738f[_0x2cacf7(0xe0)]!==undefined&&_0xff738f[_0x2cacf7(0xe0)]>0x0)_0x3cb864[_0x2cacf7(0x11f)](a12_0x26b355[_0x2cacf7(0x119)](_0xff738f[_0x2cacf7(0xe0)]+'\x20new'));if(_0xff738f[_0x2cacf7(0xd9)]!==undefined&&_0xff738f[_0x2cacf7(0xd9)]>0x0)_0x3cb864[_0x2cacf7(0x11f)](a12_0x26b355[_0x2cacf7(0x119)](_0xff738f[_0x2cacf7(0xd9)]+_0x2cacf7(0xf6)));if(_0xff738f[_0x2cacf7(0x12c)]!==undefined&&_0xff738f[_0x2cacf7(0x12c)]>0x0)_0x3cb864[_0x2cacf7(0x11f)](a12_0x26b355['yellow'](_0xff738f['updated']+_0x2cacf7(0x118)));if(_0xff738f['unchanged']!==undefined&&_0xff738f[_0x2cacf7(0xf1)]>0x0)_0x3cb864[_0x2cacf7(0x11f)](a12_0x26b355[_0x2cacf7(0x10b)](_0xff738f['unchanged']+_0x2cacf7(0x103)));if(_0xff738f[_0x2cacf7(0xd2)]!==undefined&&_0xff738f['errors']>0x0)_0x3cb864['push'](a12_0x26b355[_0x2cacf7(0xe7)](_0xff738f['errors']+_0x2cacf7(0xe2)));return _0x3cb864['join'](',\x20');}function displayDiffs(_0x376712,_0x2a352e,_0x1b1642,_0x46dc4d){const _0x1b08d4=a12_0x5625;for(const _0x3b7e82 of _0x376712){if(_0x3b7e82[_0x1b08d4(0x12f)]){const _0x30e79b=_0x3b7e82[_0x1b08d4(0xf5)]||_0x3b7e82[_0x1b08d4(0x11e)];console[_0x1b08d4(0xf0)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x30e79b+'\x27:'),console[_0x1b08d4(0xf0)]('─'[_0x1b08d4(0xc7)](0x3c)),console[_0x1b08d4(0xf0)](_0x3b7e82[_0x1b08d4(0x12f)]),console['log']('─'[_0x1b08d4(0xc7)](0x3c));}}for(const _0x483eb7 of _0x2a352e){_0x483eb7['diff']&&(console[_0x1b08d4(0xf0)](_0x1b08d4(0xf7)+_0x483eb7[_0x1b08d4(0x11e)]+'\x27:'),console['log']('─'[_0x1b08d4(0xc7)](0x3c)),console[_0x1b08d4(0xf0)](_0x483eb7['diff']),console[_0x1b08d4(0xf0)]('─'['repeat'](0x3c)));}for(const _0x21b20b of _0x1b1642){_0x21b20b[_0x1b08d4(0x12f)]&&(console['log'](_0x1b08d4(0x108)+_0x21b20b[_0x1b08d4(0x11e)]+'\x27:'),console[_0x1b08d4(0xf0)]('─'[_0x1b08d4(0xc7)](0x3c)),console[_0x1b08d4(0xf0)](_0x21b20b[_0x1b08d4(0x12f)]),console[_0x1b08d4(0xf0)]('─'[_0x1b08d4(0xc7)](0x3c)));}for(const _0x135b0b of _0x46dc4d){_0x135b0b[_0x1b08d4(0x12f)]&&(console['log'](_0x1b08d4(0xed)+_0x135b0b[_0x1b08d4(0x11e)]+'\x27:'),console['log']('─'[_0x1b08d4(0xc7)](0x3c)),console[_0x1b08d4(0xf0)](_0x135b0b[_0x1b08d4(0x12f)]),console[_0x1b08d4(0xf0)]('─'[_0x1b08d4(0xc7)](0x3c)));}}export class AgentPullCommand extends BaseCommand{['name']=a12_0x58e27b(0x138);[a12_0x58e27b(0x136)]=a12_0x58e27b(0x115);async[a12_0x58e27b(0x101)](_0x282d57){const _0x25f992=a12_0x58e27b,{options:_0x52dafa,args:_0x408ce4,tdx:_0x3ad2fd}=_0x282d57,_0x2997fc=_0x408ce4[0x0],_0x46c80d=_0x408ce4[0x1],_0x247fd9=_0x52dafa[_0x25f992(0x110)],_0x5a9634=_0x52dafa[_0x25f992(0xf3)],_0x3387c2=_0x52dafa['force'],_0x1bc1ac=_0x52dafa['yes'],_0x401832=_0x52dafa[_0x25f992(0xce)];let _0x2b5c5e,_0x1c4251;const _0x4a947c=findAgentConfigPath(process[_0x25f992(0x10e)]());if(_0x2997fc){const _0x17f33b=a12_0x10b840[_0x25f992(0x149)](_0x2997fc,_0x25f992(0x106));if(existsSync(_0x17f33b))try{const _0x341092=JSON[_0x25f992(0xe3)](readFileSync(_0x17f33b,'utf-8'));_0x2b5c5e=_0x341092[_0x25f992(0xfa)],_0x1c4251=_0x2997fc,console[_0x25f992(0xf0)](a12_0x26b355[_0x25f992(0xd3)](_0x25f992(0x152)+_0x17f33b+':\x20'+_0x2b5c5e));}catch{_0x2b5c5e=_0x2997fc;}else _0x2b5c5e=_0x2997fc;}else{if(_0x4a947c)try{const _0x1e11e1=JSON[_0x25f992(0xe3)](readFileSync(_0x4a947c,'utf-8'));_0x2b5c5e=_0x1e11e1[_0x25f992(0xfa)],_0x1c4251=a12_0x10b840['dirname'](_0x4a947c),console[_0x25f992(0xf0)](a12_0x26b355['dim'](_0x25f992(0x156)+_0x2b5c5e));}catch{_0x2b5c5e=_0x401832;}else _0x2b5c5e=_0x401832;}if(!_0x2b5c5e)return console[_0x25f992(0xf0)](a12_0x26b355[_0x25f992(0x135)](_0x25f992(0x160))),console[_0x25f992(0xf0)](_0x25f992(0x14c)),console[_0x25f992(0xf0)]('\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[_0x25f992(0xf0)](_0x25f992(0x14d)),console[_0x25f992(0xf0)](_0x25f992(0xd7)),0x1;if(_0x46c80d){const {data:_0x503155}=await withSpinner(_0x25f992(0xe9)+_0x46c80d+'\x22\x20from\x20project\x20\x22'+_0x2b5c5e+_0x25f992(0x14f),()=>_0x3ad2fd['llm'][_0x25f992(0x13b)](_0x2b5c5e,_0x46c80d,_0x247fd9,{'dryRun':_0x5a9634,'force':_0x3387c2}));if(_0x5a9634)return console[_0x25f992(0xf0)](a12_0x26b355[_0x25f992(0x135)](_0x25f992(0x107))),console[_0x25f992(0xf0)]('Would\x20pull\x20agent:\x20'+_0x503155[_0x25f992(0xf5)]),console[_0x25f992(0xf0)](_0x25f992(0x146)+_0x503155[_0x25f992(0x151)]),_0x503155[_0x25f992(0x12f)]&&(console[_0x25f992(0xf0)](_0x25f992(0x139)),console[_0x25f992(0xf0)]('─'['repeat'](0x3c)),console['log'](_0x503155[_0x25f992(0x12f)]),console[_0x25f992(0xf0)]('─'[_0x25f992(0xc7)](0x3c))),0x0;return console[_0x25f992(0xf0)](a12_0x26b355['green'](_0x25f992(0xc8))),console[_0x25f992(0xf0)]('Agent:\x20'+_0x503155['agentName']),console[_0x25f992(0xf0)](_0x25f992(0x148)+_0x503155['outputPath']),console[_0x25f992(0xf0)]('Status:\x20'+(_0x503155['isNew']?a12_0x26b355[_0x25f992(0x119)](_0x25f992(0xe0)):_0x503155['hasChanges']?a12_0x26b355['yellow'](_0x25f992(0x12c)):a12_0x26b355['gray'](_0x25f992(0xf1)))),0x0;}const _0x4088e6=_0x1c4251||_0x247fd9,{data:_0x2b29be}=await withSpinner(_0x25f992(0x141)+_0x2b5c5e+'\x22...',()=>_0x3ad2fd[_0x25f992(0x105)]['pullProject'](_0x2b5c5e,_0x4088e6,{'dryRun':!![]})),_0x3fe570=_0x2b29be[_0x25f992(0x121)][_0x25f992(0xe5)]['new']+_0x2b29be['counts'][_0x25f992(0xcf)]['new']+_0x2b29be['counts']['textKnowledgeBases'][_0x25f992(0xe0)]+_0x2b29be[_0x25f992(0x121)][_0x25f992(0x122)][_0x25f992(0xe0)],_0x2ba005=_0x2b29be[_0x25f992(0x121)]['agents']['updated']+_0x2b29be[_0x25f992(0x121)][_0x25f992(0xcf)][_0x25f992(0x12c)]+_0x2b29be[_0x25f992(0x121)][_0x25f992(0xd5)][_0x25f992(0x12c)]+_0x2b29be[_0x25f992(0x121)][_0x25f992(0x122)]['updated'],_0x102699=_0x2b29be[_0x25f992(0x121)][_0x25f992(0xe5)]['unchanged']+_0x2b29be[_0x25f992(0x121)][_0x25f992(0xcf)]['unchanged']+_0x2b29be[_0x25f992(0x121)][_0x25f992(0xd5)][_0x25f992(0xf1)]+_0x2b29be[_0x25f992(0x121)][_0x25f992(0x122)][_0x25f992(0xf1)];console[_0x25f992(0xf0)](_0x25f992(0x142)+_0x2b29be[_0x25f992(0xee)]+'\x27:'),console[_0x25f992(0xf0)]('\x20\x20'+a12_0x26b355[_0x25f992(0x119)]('+\x20'+_0x3fe570+_0x25f992(0x157))+'\x20|\x20'+a12_0x26b355[_0x25f992(0x135)]('~\x20'+_0x2ba005+_0x25f992(0xde))+_0x25f992(0xfe)+a12_0x26b355['dim']('=\x20'+_0x102699+_0x25f992(0x103))),console[_0x25f992(0xf0)]('\x20\x20Agents:\x20'+formatCountSummary(_0x2b29be[_0x25f992(0x121)][_0x25f992(0xe5)])),console[_0x25f992(0xf0)](_0x25f992(0x145)+formatCountSummary(_0x2b29be[_0x25f992(0x121)]['knowledgeBases'])),console['log'](_0x25f992(0xd6)+formatCountSummary(_0x2b29be[_0x25f992(0x121)]['textKnowledgeBases'])),console[_0x25f992(0xf0)](_0x25f992(0xff)+formatCountSummary(_0x2b29be[_0x25f992(0x121)][_0x25f992(0x122)])),console['log']('\x20\x20Target:\x20'+a12_0x26b355[_0x25f992(0x159)](_0x2b29be[_0x25f992(0x153)])),displayDiffs(_0x2b29be[_0x25f992(0xe5)],_0x2b29be[_0x25f992(0xcf)],_0x2b29be[_0x25f992(0xd5)],_0x2b29be[_0x25f992(0x122)]);if(_0x5a9634)return console[_0x25f992(0xf0)](a12_0x26b355[_0x25f992(0x135)](_0x25f992(0x124))),0x0;if(_0x3fe570===0x0&&_0x2ba005===0x0)return console[_0x25f992(0xf0)](a12_0x26b355[_0x25f992(0x119)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x2b29be[_0x25f992(0xee)]},_0x52dafa[_0x25f992(0xcb)]),console[_0x25f992(0xf0)](a12_0x26b355[_0x25f992(0x119)](_0x25f992(0x114)+a12_0x26b355[_0x25f992(0xd3)](_0x25f992(0xfa))+_0x25f992(0x133)+a12_0x26b355[_0x25f992(0x159)](_0x2b29be[_0x25f992(0xee)]))),0x0;if(!_0x1bc1ac&&!_0x3387c2){const _0x3c0232=await confirmKey(_0x25f992(0x155)+(_0x3fe570+_0x2ba005)+'\x20files?');if(!_0x3c0232)return console[_0x25f992(0xf0)](_0x25f992(0xe4)),0x0;}const {data:_0x51a481}=await withSpinner(_0x25f992(0xdf),()=>_0x3ad2fd[_0x25f992(0x105)]['pullProject'](_0x2b5c5e,_0x4088e6,{'force':_0x3387c2}));return console[_0x25f992(0xf0)](a12_0x26b355['green'](_0x25f992(0x13c)+(_0x3fe570+_0x2ba005)+'\x20files\x20to\x20'+_0x51a481['outputDir'])),saveSessionContext({'llm_project':_0x51a481['projectName']},_0x52dafa[_0x25f992(0xcb)]),console[_0x25f992(0xf0)](a12_0x26b355['green'](_0x25f992(0x114)+a12_0x26b355[_0x25f992(0xd3)](_0x25f992(0xfa))+_0x25f992(0x133)+a12_0x26b355['cyan'](_0x51a481[_0x25f992(0xee)]))),0x0;}}function a12_0x1f12(){const _0x3f0ee4=['\x20resources\x20to\x20\x27','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','llmProject','knowledgeBases','<new-name>','Dry\x20run\x20-\x20no\x20changes\x20made','errors','dim','\x22\x20to\x20new\x20project\x20\x22','textKnowledgeBases','\x20\x20Text\x20Knowledge\x20Bases:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','512157xpQZCT','created','Using\x20context\x20project:\x20','\x20\x20Knowledge\x20Base\x20\x22','error','projectId','\x20changed','Writing\x20files...','new','\x20resources?','\x20errors','parse','Pull\x20cancelled','agents','Would\x20clone:','red','Cloning\x20\x22','Pulling\x20agent\x20\x22','\x0a✔\x20Pushed\x20','INVALID_ARGUMENT','Clone\x20cancelled','\x0aChanges\x20to\x20prompt\x20\x27','projectName','profile','log','unchanged','\x27\x20to\x20create\x20the\x20folder\x20structure.','dryRun','yes','agentName','\x20created','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x22:\x20','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','llm_project','\x20\x20Text\x20Knowledge\x20Base\x20\x22','sourceProjectName','pushProject','\x20|\x20','\x20\x20Prompts:\x20','\x0aProject\x20pushed\x20with\x20errors','execute','Push\x20cancelled','\x20unchanged','1084iUPCuq','llm','tdx.json','Dry\x20run\x20-\x20no\x20files\x20written','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','724023HRrBvw','858925IBdwlh','gray','\x20total','33sURSwL','cwd','Project\x20cloned\x20successfully','output','2111580ZxKXSW','Pushing\x20to\x20project...','New\x20project\x20name\x20is\x20required','✔\x20Context\x20set:\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','dirname','site','\x20updated','green','36056szpSlV','Using\x20current\x20project:\x20','Project:\x20','\x0aPush\x20','name','push','\x20successfully','counts','prompts','agent.yml','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','518fbbSiD','680eZRZKZ','\x20\x20tdx\x20agent\x20pull\x20','Current\x20context\x20has\x20llm_project=\x22','Summary:','newProjectId','Source:\x20','updated','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','\x20\x20Source:\x20','diff','Context\x20set:\x20','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x22\x20to\x20\x22','\x20=\x20','Agent:\x20','yellow','description','New\x20project:\x20','agent:pull','\x0aChanges:','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','pullAgent','\x0a✔\x20Pulled\x20','total','Project\x20cloned\x20with\x20errors','\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)','\x20\x20Agent\x20\x22','Analyzing\x20project\x20\x22','\x0aPull\x20summary\x20for\x20\x27','4LrUPkx','agentId','\x20\x20Knowledge\x20Bases:\x20','Output\x20path:\x20','action','Output:\x20','join','\x20\x20Agents:\x20','No\x20tdx.json\x20found\x20in\x20','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)','\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','cloneProject','\x22...','\x20\x20tdx\x20agent\x20clone\x20agents/','outputPath','Using\x20project\x20from\x20','outputDir','Failed\x20to\x20push\x20agent:\x20','\x0aWrite\x20','Using\x20project:\x20','\x20new','Analyzing\x20changes\x20to\x20push...','cyan','\x20--name\x20','agent:clone','Would\x20push\x20agent:\x20','Pushing\x20agent\x20from\x20\x22','Errors:','New\x20project\x20ID:\x20','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20Prompt\x20\x22','newProjectName','Using\x20local\x20project:\x20','repeat','Agent\x20pulled\x20successfully','\x20--profile\x20','3173080GTdbcf','session'];a12_0x1f12=function(){return _0x3f0ee4;};return a12_0x1f12();}export class AgentCloneCommand extends BaseCommand{[a12_0x58e27b(0x11e)]=a12_0x58e27b(0x15b);[a12_0x58e27b(0x136)]=a12_0x58e27b(0x12d);async[a12_0x58e27b(0x101)](_0x41573c){const _0x58780d=a12_0x58e27b,{options:_0x387ebe,args:_0x57c8dc,tdx:_0x3c88cc}=_0x41573c,_0x121ec3=_0x57c8dc[0x0],_0x22e3ec=_0x387ebe[_0x58780d(0x11e)],_0x3fbf1a=_0x387ebe[_0x58780d(0xf3)],_0x39f994=_0x387ebe[_0x58780d(0xf4)],_0x4fec39=_0x387ebe['site'],_0x30cf97=_0x387ebe[_0x58780d(0xce)];let _0x34542d;const _0x34150f=findAgentConfigPath(process['cwd']());if(_0x121ec3){const _0x10e326=a12_0x10b840[_0x58780d(0x149)](_0x121ec3,_0x58780d(0x106));existsSync(_0x10e326)?(_0x34542d=_0x121ec3,console['log'](a12_0x26b355[_0x58780d(0xd3)](_0x58780d(0xc6)+_0x121ec3))):_0x34542d=_0x121ec3;}else{if(_0x34150f)_0x34542d=a12_0x10b840[_0x58780d(0x116)](_0x34150f),console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0xd3)](_0x58780d(0x11b)+_0x34542d));else{if(_0x30cf97){const _0x3471a2=normalizeName(_0x30cf97),_0x1f5616=a12_0x10b840[_0x58780d(0x149)](process['cwd'](),_0x58780d(0xe5),_0x3471a2,'tdx.json');if(existsSync(_0x1f5616))_0x34542d=a12_0x10b840[_0x58780d(0x116)](_0x1f5616),console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0xd3)](_0x58780d(0xc6)+_0x34542d));else{const _0x14fa43=_0x387ebe[_0x58780d(0xef)];if(_0x14fa43)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x30cf97+'\x22\x20to\x20a\x20different\x20profile',undefined,{'helpText':'When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a'+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x58780d(0x127)+_0x30cf97+'\x0a')+(_0x58780d(0x150)+_0x3471a2+_0x58780d(0x15a)+(_0x22e3ec||_0x58780d(0xd0))+_0x58780d(0xc9)+_0x14fa43)});_0x34542d=_0x30cf97,console[_0x58780d(0xf0)](a12_0x26b355['dim'](_0x58780d(0xda)+_0x30cf97));}}}}if(!_0x34542d)return console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0x135)]('No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a')),console['log'](_0x58780d(0x13a)),console['log']('\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory'),console['log'](_0x58780d(0x13f)),console[_0x58780d(0xf0)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x22e3ec)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x58780d(0x113),undefined,{'helpText':_0x58780d(0xcd)});if(!_0x39f994&&!_0x3fbf1a){const _0x4aea37=await confirmKey('Clone\x20\x22'+_0x34542d+_0x58780d(0xd4)+_0x22e3ec+'\x22?');if(!_0x4aea37)return console[_0x58780d(0xf0)](_0x58780d(0xec)),0x0;}const {data:_0x1e7210}=await withSpinner(_0x58780d(0xe8)+_0x34542d+_0x58780d(0x132)+_0x22e3ec+_0x58780d(0x14f),()=>_0x3c88cc[_0x58780d(0x105)][_0x58780d(0x14e)](_0x34542d,_0x22e3ec,{'dryRun':_0x3fbf1a}));if(_0x3fbf1a)return console[_0x58780d(0xf0)](a12_0x26b355['yellow'](_0x58780d(0xd1))),console[_0x58780d(0xf0)]('Source:\x20'+_0x1e7210[_0x58780d(0xfc)]),console['log'](_0x58780d(0x137)+_0x22e3ec),console['log'](_0x58780d(0xe6)),console[_0x58780d(0xf0)](_0x58780d(0x14a)+_0x1e7210[_0x58780d(0x121)][_0x58780d(0xe5)]['created']),console[_0x58780d(0xf0)]('\x20\x20Knowledge\x20Bases:\x20'+_0x1e7210[_0x58780d(0x121)]['knowledgeBases'][_0x58780d(0xd9)]),console[_0x58780d(0xf0)](_0x58780d(0xff)+_0x1e7210[_0x58780d(0x121)]['prompts'][_0x58780d(0xd9)]),0x0;const _0x44c184=_0x1e7210[_0x58780d(0x121)]['agents'][_0x58780d(0xd2)]>0x0||_0x1e7210[_0x58780d(0x121)][_0x58780d(0xcf)][_0x58780d(0xd2)]>0x0||_0x1e7210[_0x58780d(0x121)][_0x58780d(0x122)][_0x58780d(0xd2)]>0x0;_0x44c184?console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0x135)](_0x58780d(0x13e))):console['log'](a12_0x26b355[_0x58780d(0x119)](_0x58780d(0x10f)));console[_0x58780d(0xf0)](_0x58780d(0x12b)+_0x1e7210['sourceProjectName']),console['log']('New\x20project:\x20'+_0x1e7210['newProjectName']),console['log'](_0x58780d(0x15f)+_0x1e7210[_0x58780d(0x12a)]),console[_0x58780d(0xf0)](),console[_0x58780d(0xf0)](_0x58780d(0x129)),console[_0x58780d(0xf0)](_0x58780d(0x14a)+formatCountSummary(_0x1e7210[_0x58780d(0x121)][_0x58780d(0xe5)])),console['log'](_0x58780d(0x145)+formatCountSummary(_0x1e7210[_0x58780d(0x121)][_0x58780d(0xcf)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x1e7210[_0x58780d(0x121)][_0x58780d(0x122)]));if(_0x44c184){console[_0x58780d(0xf0)](),console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0xe7)](_0x58780d(0x15e)));for(const _0x35b6ff of _0x1e7210[_0x58780d(0xe5)]){_0x35b6ff[_0x58780d(0x147)]===_0x58780d(0xdc)&&console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0xe7)](_0x58780d(0x140)+_0x35b6ff[_0x58780d(0xf5)]+'\x22:\x20'+_0x35b6ff[_0x58780d(0xdc)]));}for(const _0x5e7c9d of _0x1e7210[_0x58780d(0xcf)]){_0x5e7c9d['action']===_0x58780d(0xdc)&&console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0xe7)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x5e7c9d[_0x58780d(0x11e)]+_0x58780d(0xf8)+_0x5e7c9d[_0x58780d(0xdc)]));}for(const _0xd460d7 of _0x1e7210['prompts']){_0xd460d7[_0x58780d(0x147)]===_0x58780d(0xdc)&&console['log'](a12_0x26b355[_0x58780d(0xe7)](_0x58780d(0x161)+_0xd460d7['name']+_0x58780d(0xf8)+_0xd460d7['error']));}return 0x1;}saveSessionContext({'llm_project':_0x1e7210[_0x58780d(0xc5)]},_0x387ebe['session']),console[_0x58780d(0xf0)](),console[_0x58780d(0xf0)](a12_0x26b355[_0x58780d(0x119)](_0x58780d(0x130)+a12_0x26b355['dim']('llm_project')+_0x58780d(0x133)+a12_0x26b355[_0x58780d(0x159)](_0x1e7210[_0x58780d(0xc5)])));const _0x2c05ab=getLLMProjectUrl(_0x4fec39,_0x1e7210['newProjectId']);return console['log'](_0x58780d(0x11c)+a12_0x26b355['cyan'](_0x2c05ab)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x58e27b(0x11e)]='agent:push';[a12_0x58e27b(0x136)]=a12_0x58e27b(0xf9);async[a12_0x58e27b(0x101)](_0x5edb8d){const _0x3599fc=a12_0x58e27b,{options:_0x3c581c,args:_0x47cc40,tdx:_0x159839}=_0x5edb8d;let _0x2b1bf1=_0x47cc40[0x0]||process['cwd']();const _0x1a34a2=_0x3c581c[_0x3599fc(0xf3)],_0x4d44b9=_0x3c581c['force'],_0x2574c=_0x3c581c[_0x3599fc(0xf4)],_0x2bbed4=_0x3c581c[_0x3599fc(0x117)],_0x5495c1=a12_0x10b840[_0x3599fc(0x149)](_0x2b1bf1,_0x3599fc(0x123)),_0x3369f4=existsSync(_0x5495c1);if(_0x3369f4){const {data:_0xbb42f9}=await withSpinner(_0x3599fc(0x15d)+_0x2b1bf1+_0x3599fc(0x14f),()=>_0x159839[_0x3599fc(0x105)]['pushAgent'](_0x2b1bf1,{'dryRun':_0x1a34a2,'force':_0x4d44b9}));if(_0x1a34a2)return console[_0x3599fc(0xf0)](a12_0x26b355[_0x3599fc(0x135)](_0x3599fc(0xd1))),console['log'](_0x3599fc(0x15c)+_0xbb42f9[_0x3599fc(0xf5)]),0x0;if(_0xbb42f9[_0x3599fc(0x147)]===_0x3599fc(0xdc))return console['log'](a12_0x26b355[_0x3599fc(0xe7)](_0x3599fc(0x154)+_0xbb42f9[_0x3599fc(0xdc)])),0x1;console[_0x3599fc(0xf0)](a12_0x26b355['green']('Agent\x20'+_0xbb42f9[_0x3599fc(0x147)]+_0x3599fc(0x120))),console[_0x3599fc(0xf0)](_0x3599fc(0x134)+_0xbb42f9[_0x3599fc(0xf5)]);if(_0xbb42f9[_0x3599fc(0x144)]&&_0xbb42f9['projectId']){const _0x271c0b=getLLMAgentChatUrl(_0x2bbed4,_0xbb42f9[_0x3599fc(0xdd)],_0xbb42f9[_0x3599fc(0x144)]);console['log']('Chat:\x20'+a12_0x26b355[_0x3599fc(0x159)](_0x271c0b));}return 0x0;}let _0x57ca2e=a12_0x10b840[_0x3599fc(0x149)](_0x2b1bf1,'tdx.json');if(!existsSync(_0x57ca2e)){const _0x2164c7=findAgentConfigPath(_0x2b1bf1);if(_0x2164c7)_0x2b1bf1=a12_0x10b840[_0x3599fc(0x116)](_0x2164c7),_0x57ca2e=_0x2164c7,console['log'](a12_0x26b355[_0x3599fc(0xd3)](_0x3599fc(0x156)+_0x2b1bf1));else{const _0x59b7df=_0x3c581c['llmProject'];if(_0x59b7df){const _0x19cd54=normalizeName(_0x59b7df),_0x384d40=a12_0x10b840[_0x3599fc(0x149)](_0x2b1bf1,_0x3599fc(0xe5)),_0x13587d=a12_0x10b840[_0x3599fc(0x149)](_0x384d40,_0x19cd54,_0x3599fc(0x106));existsSync(_0x13587d)&&(_0x2b1bf1=a12_0x10b840['dirname'](_0x13587d),_0x57ca2e=_0x13587d,console[_0x3599fc(0xf0)](a12_0x26b355['dim'](_0x3599fc(0x156)+_0x2b1bf1)));}if(!existsSync(_0x57ca2e)){let _0x296ad5=_0x3599fc(0x131);_0x59b7df&&(_0x296ad5=_0x3599fc(0x128)+_0x59b7df+'\x22\x20but\x20no\x20local\x20folder\x20found.\x0a'+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x59b7df+_0x3599fc(0xf2)));throw new SDKError(ErrorCode[_0x3599fc(0xeb)],_0x3599fc(0x14b)+_0x2b1bf1,undefined,{'helpText':_0x296ad5});}}}const {data:_0x1e8cdf}=await withSpinner(_0x3599fc(0x158),()=>_0x159839[_0x3599fc(0x105)]['pushProject'](_0x2b1bf1,{'dryRun':!![]})),_0xbbaf2e=_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xe5)]['errors']>0x0;if(_0xbbaf2e){console[_0x3599fc(0xf0)](a12_0x26b355[_0x3599fc(0xe7)]('\x0aErrors\x20found:'));for(const _0x263c9e of _0x1e8cdf[_0x3599fc(0xe5)]){_0x263c9e[_0x3599fc(0x147)]==='error'&&console['log'](a12_0x26b355[_0x3599fc(0xe7)](_0x3599fc(0x140)+_0x263c9e[_0x3599fc(0xf5)]+_0x3599fc(0xf8)+_0x263c9e[_0x3599fc(0xdc)]));}return 0x1;}const _0x4ca03f=_0x1e8cdf['counts'][_0x3599fc(0xe5)][_0x3599fc(0xd9)]+_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xcf)][_0x3599fc(0xd9)]+_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xd5)]['created']+_0x1e8cdf['counts'][_0x3599fc(0x122)][_0x3599fc(0xd9)],_0x93188a=_0x1e8cdf['counts'][_0x3599fc(0xe5)][_0x3599fc(0x12c)]+_0x1e8cdf[_0x3599fc(0x121)]['knowledgeBases'][_0x3599fc(0x12c)]+_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xd5)]['updated']+_0x1e8cdf[_0x3599fc(0x121)]['prompts']['updated'],_0x51f97e=_0x1e8cdf['counts']['agents'][_0x3599fc(0xf1)]+_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xcf)][_0x3599fc(0xf1)]+_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xd5)][_0x3599fc(0xf1)]+_0x1e8cdf[_0x3599fc(0x121)]['prompts'][_0x3599fc(0xf1)];console[_0x3599fc(0xf0)]('\x0aPush\x20summary\x20for\x20\x27'+_0x1e8cdf['projectName']+'\x27:'),console[_0x3599fc(0xf0)]('\x20\x20'+a12_0x26b355['green']('+\x20'+_0x4ca03f+_0x3599fc(0x157))+_0x3599fc(0xfe)+a12_0x26b355[_0x3599fc(0x135)]('~\x20'+_0x93188a+'\x20changed')+'\x20|\x20'+a12_0x26b355[_0x3599fc(0xd3)]('=\x20'+_0x51f97e+_0x3599fc(0x103))),console[_0x3599fc(0xf0)](_0x3599fc(0x14a)+formatCountSummary(_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xe5)])),console['log'](_0x3599fc(0x145)+formatCountSummary(_0x1e8cdf[_0x3599fc(0x121)]['knowledgeBases'])),console[_0x3599fc(0xf0)](_0x3599fc(0xd6)+formatCountSummary(_0x1e8cdf[_0x3599fc(0x121)][_0x3599fc(0xd5)])),console[_0x3599fc(0xf0)](_0x3599fc(0xff)+formatCountSummary(_0x1e8cdf[_0x3599fc(0x121)]['prompts'])),console[_0x3599fc(0xf0)](_0x3599fc(0x12e)+a12_0x26b355['cyan'](_0x2b1bf1)),displayDiffs(_0x1e8cdf['agents'],_0x1e8cdf['knowledgeBases'],_0x1e8cdf[_0x3599fc(0xd5)],_0x1e8cdf[_0x3599fc(0x122)]);if(_0x1a34a2)return console[_0x3599fc(0xf0)](a12_0x26b355[_0x3599fc(0x135)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x4ca03f===0x0&&_0x93188a===0x0){console['log'](a12_0x26b355['green']('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x405492=getLLMProjectUrl(_0x2bbed4,_0x1e8cdf['projectId']);return console[_0x3599fc(0xf0)](_0x3599fc(0x11c)+a12_0x26b355[_0x3599fc(0x159)](_0x405492)),0x0;}if(!_0x2574c&&!_0x4d44b9){const _0x342162=await confirmKey(_0x3599fc(0x11d)+(_0x4ca03f+_0x93188a)+_0x3599fc(0xe1));if(!_0x342162)return console['log'](_0x3599fc(0x102)),0x0;}const {data:_0x3d6380}=await withSpinner(_0x3599fc(0x112),()=>_0x159839[_0x3599fc(0x105)][_0x3599fc(0xfd)](_0x2b1bf1,{'force':_0x4d44b9})),_0x57dc10=_0x3d6380[_0x3599fc(0x121)][_0x3599fc(0xe5)]['errors']>0x0||_0x3d6380['counts'][_0x3599fc(0xcf)]['errors']>0x0||_0x3d6380[_0x3599fc(0x121)]['textKnowledgeBases']['errors']>0x0||_0x3d6380['counts'][_0x3599fc(0x122)][_0x3599fc(0xd2)]>0x0;if(_0x57dc10){console['log'](a12_0x26b355[_0x3599fc(0x135)](_0x3599fc(0x100))),console['log'](),console[_0x3599fc(0xf0)](a12_0x26b355[_0x3599fc(0xe7)](_0x3599fc(0x15e)));for(const _0x420688 of _0x3d6380[_0x3599fc(0xe5)]){_0x420688['action']===_0x3599fc(0xdc)&&console[_0x3599fc(0xf0)](a12_0x26b355['red'](_0x3599fc(0x140)+_0x420688[_0x3599fc(0xf5)]+_0x3599fc(0xf8)+_0x420688['error']));}for(const _0x529b94 of _0x3d6380[_0x3599fc(0xcf)]){_0x529b94['action']===_0x3599fc(0xdc)&&console['log'](a12_0x26b355['red'](_0x3599fc(0xdb)+_0x529b94[_0x3599fc(0x11e)]+_0x3599fc(0xf8)+_0x529b94[_0x3599fc(0xdc)]));}for(const _0x3ea515 of _0x3d6380[_0x3599fc(0xd5)]){_0x3ea515['action']===_0x3599fc(0xdc)&&console['log'](a12_0x26b355[_0x3599fc(0xe7)](_0x3599fc(0xfb)+_0x3ea515['name']+_0x3599fc(0xf8)+_0x3ea515[_0x3599fc(0xdc)]));}for(const _0x33a94b of _0x3d6380['prompts']){_0x33a94b[_0x3599fc(0x147)]===_0x3599fc(0xdc)&&console['log'](a12_0x26b355[_0x3599fc(0xe7)](_0x3599fc(0x161)+_0x33a94b[_0x3599fc(0x11e)]+_0x3599fc(0xf8)+_0x33a94b[_0x3599fc(0xdc)]));}return 0x1;}console[_0x3599fc(0xf0)](a12_0x26b355[_0x3599fc(0x119)](_0x3599fc(0xea)+(_0x4ca03f+_0x93188a)+_0x3599fc(0xcc)+_0x3d6380[_0x3599fc(0xee)]+'\x27'));const _0x367e66=getLLMProjectUrl(_0x2bbed4,_0x3d6380['projectId']);return console[_0x3599fc(0xf0)](_0x3599fc(0x11c)+a12_0x26b355['cyan'](_0x367e66)),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
|
-
|
|
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
|
-
|
|
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_0x11c910=a16_0x51ef;(function(_0x3591ef,_0x2973f7){const _0x35a272=a16_0x51ef,_0x3621e8=_0x3591ef();while(!![]){try{const _0x5c9e58=parseInt(_0x35a272(0x192))/0x1*(-parseInt(_0x35a272(0x1ea))/0x2)+-parseInt(_0x35a272(0x1a1))/0x3*(parseInt(_0x35a272(0x201))/0x4)+-parseInt(_0x35a272(0x1df))/0x5*(parseInt(_0x35a272(0x1aa))/0x6)+-parseInt(_0x35a272(0x1ed))/0x7+parseInt(_0x35a272(0x1c5))/0x8*(parseInt(_0x35a272(0x1f0))/0x9)+parseInt(_0x35a272(0x1d1))/0xa+parseInt(_0x35a272(0x1cf))/0xb;if(_0x5c9e58===_0x2973f7)break;else _0x3621e8['push'](_0x3621e8['shift']());}catch(_0x313eef){_0x3621e8['push'](_0x3621e8['shift']());}}}(a16_0x12cb,0x4c803));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_0x780086 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';function a16_0x12cb(){const _0x27fced=['✓\x20Logs\x20saved\x20to\x20','✓\x20Using\x20project:\x20','stop','statusLine','unshift','✓\x20Port\x20','Claude\x20Code\x20CLI\x20not\x20found','install','Updating\x20marketplace\x20\x27','Invalid\x20minimum\x20version\x20format:\x20','which','getCurrent','--version','Failed\x20to\x20update\x20marketplace\x20\x27','parse','command','Failed\x20to\x20install\x20plugin\x20\x27','td-docs','settings.local.json','string','ANTHROPIC_BASE_URL','CLAUDE_CODE_NOT_FOUND','2083344plkAaa','Checking\x20Claude\x20Code\x20version...','Executing:\x20claude\x20','Command\x20spawn\x20error:\x20','llm','Warning:\x20Failed\x20to\x20configure\x20','cause','Failed\x20to\x20configure\x20marketplace\x20\x27','✓\x20Claude\x20Code\x20version\x20OK','sql-skills','8828974eEfKYX','http://127.0.0.1:','3390550sVsDFr','add','init','fail','\x27...','http','debug','utf-8','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','red','ANTHROPIC_AUTH_TOKEN','start','td-skills','server','305qkVyxq','claude','Failed\x20to\x20launch\x20Claude\x20Code:\x20','minor','tdx-managed-proxy','error','Creating\x20.claude/settings.local.json...','name','pipe','tdx-skills','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','76506ZRpFHH','major','plugin','3888234WoLqcS','✓\x20MCP\x20server\x20\x27','user','18MkVvQA','includes','Finding\x20available\x20port...','Command\x20failed\x20(exit\x20','findClaudePath','2.0.20','stdout','cwd','description','td-skills\x20Plugins','Claude\x20Code\x20version\x20','originalSettings','https://docs.treasuredata.com/mcp','type','account_id','\x27\x20updated','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','4AfvYTX','statusline','already\x20configured','logLevel','\x20meets\x20minimum\x20requirement','✓\x20Marketplace\x20\x27','inherit','already\x20installed','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','workflow-skills','marketplace','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','already\x20exists','getLogPath','env','warn','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','close','getOrCreateDefaultProject','\x20is\x20too\x20old\x20(minimum:\x20','trim','model','patch','Setting\x20up\x20project...','toString','proxy','127.0.0.1','data','stderr','info','Claude\x20Code\x20version\x20check\x20failed','sonnet','join','Command\x20output:\x20','14HtObuG','\x20or\x20later.','attributes','localhost','Configuring\x20marketplace\x20\x27','site','--transport','exit','✓\x20Plugin\x20\x27','object','.claude','port','continue','✓\x20Settings\x20restored:\x20.claude/settings.local.json','logger','176295SJYOEh','text','https://github.com/treasure-data/td-skills','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','green','code','message','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','ANTHROPIC_MODEL','19614JpFMRX','log','CLAUDE_CODE_UNSUPPORTED_VERSION','stringify','):\x20claude\x20'];a16_0x12cb=function(){return _0x27fced;};return a16_0x12cb();}import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a16_0x11c910(0x1f5);function a16_0x51ef(_0x3e1649,_0x1e070d){_0x3e1649=_0x3e1649-0x190;const _0x12cbbe=a16_0x12cb();let _0x51ef79=_0x12cbbe[_0x3e1649];return _0x51ef79;}function handleInstallationError(_0x44e803,_0x2b5871,_0x457134,_0x5ad877){const _0x505ebc=a16_0x11c910;errorContains(_0x44e803,_0x505ebc(0x20d),_0x505ebc(0x208),_0x505ebc(0x203))?(_0x457134['text']='✓\x20'+_0x2b5871+'\x20already\x20configured',_0x5ad877?.[_0x505ebc(0x21e)](_0x2b5871+'\x20already\x20configured'),_0x44e803 instanceof SDKError&&_0x44e803[_0x505ebc(0x1cb)]&&_0x5ad877?.[_0x505ebc(0x1d7)](_0x505ebc(0x191)+_0x44e803[_0x505ebc(0x1cb)][_0x505ebc(0x1a7)])):(_0x457134[_0x505ebc(0x210)](_0x505ebc(0x1ca)+_0x2b5871),_0x5ad877?.[_0x505ebc(0x1e4)](_0x2b5871+'\x20configuration\x20failed',_0x44e803));}export function parseVersion(_0xc587ed){const _0x4b3a1e=a16_0x11c910,_0x186a1c=_0xc587ed[_0x4b3a1e(0x215)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x186a1c)return null;return{'major':parseInt(_0x186a1c[0x1],0xa),'minor':parseInt(_0x186a1c[0x2],0xa),'patch':parseInt(_0x186a1c[0x3],0xa)};}export function compareVersions(_0xc6e1dc,_0x1e5ad9){const _0x5b612e=a16_0x11c910;if(_0xc6e1dc[_0x5b612e(0x1eb)]!==_0x1e5ad9[_0x5b612e(0x1eb)])return _0xc6e1dc['major']-_0x1e5ad9[_0x5b612e(0x1eb)];if(_0xc6e1dc[_0x5b612e(0x1e2)]!==_0x1e5ad9[_0x5b612e(0x1e2)])return _0xc6e1dc['minor']-_0x1e5ad9[_0x5b612e(0x1e2)];return _0xc6e1dc[_0x5b612e(0x217)]-_0x1e5ad9[_0x5b612e(0x217)];}async function checkClaudeVersion(_0x1ac0b7,_0x1f8ec1){const _0x1d29c7=a16_0x11c910;_0x1f8ec1?.[_0x1d29c7(0x1d7)](_0x1d29c7(0x1d9)+_0x1ac0b7+')');const _0x1df819=await executeClaudeCommand([_0x1d29c7(0x1bb)],undefined,_0x1f8ec1),_0x33f5a1=parseVersion(_0x1df819);if(!_0x33f5a1){_0x1f8ec1?.[_0x1d29c7(0x210)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x1df819);return;}const _0x1bb422=_0x33f5a1[_0x1d29c7(0x1eb)]+'.'+_0x33f5a1[_0x1d29c7(0x1e2)]+'.'+_0x33f5a1['patch'],_0x2a7e06=parseVersion(_0x1ac0b7);if(!_0x2a7e06){_0x1f8ec1?.[_0x1d29c7(0x210)](_0x1d29c7(0x1b8)+_0x1ac0b7);return;}if(compareVersions(_0x33f5a1,_0x2a7e06)<0x0){_0x1f8ec1?.['error']('Claude\x20Code\x20version\x20'+_0x1bb422+_0x1d29c7(0x214)+_0x1ac0b7+')');throw new SDKError(ErrorCode[_0x1d29c7(0x1ac)],_0x1d29c7(0x1fa)+_0x1bb422+_0x1d29c7(0x211)+_0x1ac0b7+_0x1d29c7(0x193),undefined,{'helpText':_0x1d29c7(0x1e9)});}_0x1f8ec1?.[_0x1d29c7(0x1d7)](_0x1d29c7(0x1fa)+_0x1bb422+_0x1d29c7(0x205));}async function executeClaudeCommand(_0x499b07,_0xd1db6e,_0x13f535){const _0x1d1e4d=a16_0x11c910;return _0x13f535?.['info'](_0x1d1e4d(0x1c7)+_0x499b07[_0x1d1e4d(0x190)]('\x20')),new Promise((_0x3bd052,_0x2c442c)=>{const _0x352c73=_0x1d1e4d,_0x4afa2d=spawn(_0x352c73(0x1e0),_0x499b07,{'stdio':_0x352c73(0x1e7)});let _0x5b1b4a='',_0x5524a5='';_0x4afa2d[_0x352c73(0x1f6)]['on'](_0x352c73(0x21c),_0x3f7f7d=>{const _0x32acb8=_0x352c73;_0x5b1b4a+=_0x3f7f7d[_0x32acb8(0x219)]();}),_0x4afa2d[_0x352c73(0x21d)]['on']('data',_0x19758f=>{const _0x58e06f=_0x352c73;_0x5524a5+=_0x19758f[_0x58e06f(0x219)]();}),_0x4afa2d['on'](_0x352c73(0x1e4),_0x1414f2=>{const _0x393dd2=_0x352c73;_0x1414f2[_0x393dd2(0x1a6)]==='ENOENT'?(_0x13f535?.['error']('Claude\x20Code\x20CLI\x20not\x20found'),_0x2c442c(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',_0x1414f2,{'helpText':_0x393dd2(0x1a4)}))):(_0x13f535?.[_0x393dd2(0x1e4)](_0x393dd2(0x1c8)+_0x1414f2['message']),_0x2c442c(new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x1414f2[_0x393dd2(0x1a7)],_0x1414f2)));}),_0x4afa2d['on'](_0x352c73(0x199),_0x7307ea=>{const _0xdda9ed=_0x352c73;if(_0x7307ea===0x0)_0x3bd052(_0x5b1b4a);else _0xd1db6e?(_0x13f535?.[_0xdda9ed(0x1e4)](_0xdda9ed(0x1f3)+_0x7307ea+_0xdda9ed(0x1ae)+_0x499b07[_0xdda9ed(0x190)]('\x20')),_0x2c442c(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0xd1db6e,new Error(_0x5524a5)))):_0x3bd052('');});});}async function ensureMcpServer(_0x543b9e,_0x596a1c,_0x22d65f,_0x1b3a01,_0xf687fa){const _0x537882=a16_0x11c910;_0x1b3a01[_0x537882(0x1a2)]='Configuring\x20MCP\x20server\x20\x27'+_0x543b9e+_0x537882(0x1d5),await executeClaudeCommand(['mcp',_0x537882(0x1d2),_0x543b9e,_0x596a1c,_0x537882(0x198),_0x22d65f],_0x537882(0x1a8)+_0x543b9e+'\x27',_0xf687fa),_0x1b3a01[_0x537882(0x1a2)]=_0x537882(0x1ee)+_0x543b9e+'\x27\x20configured';}async function ensureMarketplace(_0x5cf5eb,_0x3cc0d1,_0x41a233,_0xd46144){const _0xfa365f=a16_0x11c910;_0x41a233[_0xfa365f(0x1a2)]=_0xfa365f(0x196)+_0x5cf5eb+_0xfa365f(0x1d5),await executeClaudeCommand([_0xfa365f(0x1ec),'marketplace',_0xfa365f(0x1d2),_0x3cc0d1],_0xfa365f(0x1cc)+_0x5cf5eb+'\x27',_0xd46144),_0x41a233[_0xfa365f(0x1a2)]=_0xfa365f(0x206)+_0x5cf5eb+'\x27\x20configured';}async function updateMarketplace(_0x1a0481,_0x595ee2,_0xf74133){const _0x3342e1=a16_0x11c910;_0x595ee2['text']=_0x3342e1(0x1b7)+_0x1a0481+_0x3342e1(0x1d5),await executeClaudeCommand([_0x3342e1(0x1ec),_0x3342e1(0x20b),'update'],_0x3342e1(0x1bc)+_0x1a0481+'\x27',_0xf74133),_0x595ee2['text']=_0x3342e1(0x206)+_0x1a0481+_0x3342e1(0x1ff);}async function ensurePlugin(_0x375239,_0x31d977,_0x4dc357,_0x1b886d){const _0x3855e5=a16_0x11c910;_0x4dc357[_0x3855e5(0x1a2)]='Installing\x20plugin\x20\x27'+_0x375239+_0x3855e5(0x1d5),await executeClaudeCommand([_0x3855e5(0x1ec),_0x3855e5(0x1b6),_0x375239+'@'+_0x31d977],_0x3855e5(0x1bf)+_0x375239+'\x27',_0x1b886d),_0x4dc357['text']=_0x3855e5(0x19a)+_0x375239+'\x27\x20installed';}async function createClaudeSettings(_0xfac5d3,_0x3e7010=a16_0x11c910(0x220),_0x2b1f9f){const _0x247512=a16_0x11c910,_0x394401=join(process['cwd'](),_0x247512(0x19c)),_0x3a4112=join(_0x394401,_0x247512(0x1c1));await mkdir(_0x394401,{'recursive':!![]});let _0x197be6={};if(existsSync(_0x3a4112))try{const _0xcc98d7=await readFile(_0x3a4112,'utf-8');_0x197be6=JSON[_0x247512(0x1bd)](_0xcc98d7);}catch{_0x197be6={};}const _0x351a61=_0x197be6[_0x247512(0x20f)]||{},_0x21c34f={'ANTHROPIC_BASE_URL':_0x351a61[_0x247512(0x1c3)],'ANTHROPIC_MODEL':_0x351a61['ANTHROPIC_MODEL'],'ANTHROPIC_AUTH_TOKEN':_0x351a61[_0x247512(0x1db)],'statusLine':_0x197be6['statusLine']},_0x4a9041={..._0x197be6,'env':{..._0x351a61,'ANTHROPIC_BASE_URL':_0x247512(0x1d0)+_0xfac5d3,'ANTHROPIC_MODEL':_0x3e7010,'ANTHROPIC_AUTH_TOKEN':_0x247512(0x1e3)},'statusLine':{'type':_0x247512(0x1be),'command':_0x2b1f9f?'tdx\x20--profile\x20'+_0x2b1f9f+'\x20claude\x20statusline':'tdx\x20claude\x20statusline'}};return await writeFile(_0x3a4112,JSON[_0x247512(0x1ad)](_0x4a9041,null,0x2)+'\x0a'),_0x21c34f;}async function restoreClaudeSettings(_0x2494e6){const _0x5830f9=a16_0x11c910,_0x9375a0=join(process[_0x5830f9(0x1f7)](),_0x5830f9(0x19c)),_0x50f00d=join(_0x9375a0,_0x5830f9(0x1c1));if(!existsSync(_0x50f00d))return;try{const _0x302e83=await readFile(_0x50f00d,_0x5830f9(0x1d8)),_0x3a761a=JSON['parse'](_0x302e83),_0x14911c=_0x3a761a[_0x5830f9(0x20f)]||{},_0x2fb01c=_0x14911c[_0x5830f9(0x1c3)],_0x32356b=((()=>{const _0x31e8ea=_0x5830f9;if(typeof _0x2fb01c!==_0x31e8ea(0x1c2))return![];try{const _0x40f46c=new URL(_0x2fb01c);return _0x40f46c['hostname']===_0x31e8ea(0x195)||_0x40f46c['hostname']===_0x31e8ea(0x21b);}catch{return![];}})());_0x32356b?(delete _0x14911c[_0x5830f9(0x1c3)],delete _0x14911c[_0x5830f9(0x1a9)],delete _0x14911c[_0x5830f9(0x1db)]):(_0x2494e6[_0x5830f9(0x1c3)]!==undefined?_0x14911c[_0x5830f9(0x1c3)]=_0x2494e6[_0x5830f9(0x1c3)]:delete _0x14911c[_0x5830f9(0x1c3)],_0x2494e6[_0x5830f9(0x1a9)]!==undefined?_0x14911c['ANTHROPIC_MODEL']=_0x2494e6[_0x5830f9(0x1a9)]:delete _0x14911c[_0x5830f9(0x1a9)],_0x2494e6[_0x5830f9(0x1db)]!==undefined?_0x14911c[_0x5830f9(0x1db)]=_0x2494e6[_0x5830f9(0x1db)]:delete _0x14911c['ANTHROPIC_AUTH_TOKEN']);const _0x22f416=_0x3a761a[_0x5830f9(0x1b2)],_0x4353f6=((()=>{const _0x1a745b=_0x5830f9;if(!_0x22f416||typeof _0x22f416!==_0x1a745b(0x19b))return![];if(_0x22f416[_0x1a745b(0x1fd)]!=='command')return![];if(typeof _0x22f416[_0x1a745b(0x1be)]!==_0x1a745b(0x1c2))return![];return _0x22f416[_0x1a745b(0x1be)][_0x1a745b(0x1f1)]('tdx')&&_0x22f416[_0x1a745b(0x1be)][_0x1a745b(0x1f1)](_0x1a745b(0x202));})());if(_0x4353f6)delete _0x3a761a[_0x5830f9(0x1b2)];else _0x2494e6[_0x5830f9(0x1b2)]!==undefined?_0x3a761a[_0x5830f9(0x1b2)]=_0x2494e6[_0x5830f9(0x1b2)]:delete _0x3a761a[_0x5830f9(0x1b2)];_0x3a761a[_0x5830f9(0x20f)]=_0x14911c,await writeFile(_0x50f00d,JSON[_0x5830f9(0x1ad)](_0x3a761a,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a16_0x11c910(0x1e6)]=a16_0x11c910(0x1e0);[a16_0x11c910(0x1f8)]=a16_0x11c910(0x209);['server'];[a16_0x11c910(0x1fb)];[a16_0x11c910(0x1a0)];[a16_0x11c910(0x19d)];async['execute'](_0x134a11){const _0x510bbb=a16_0x11c910,{tdx:_0x14b773,options:_0x6c1d2,args:_0xc01b0b}=_0x134a11;try{const _0x5a9800=_0x6c1d2,_0xfab5e2=_0x5a9800[_0x510bbb(0x216)]||_0x510bbb(0x220),_0x56c9ef=_0x5a9800[_0x510bbb(0x21a)]===![],_0x21c27f=_0x5a9800[_0x510bbb(0x19e)]===!![],_0x5cbc18=_0x5a9800['resume']===!![],_0x5bfcd2=[..._0xc01b0b];if(_0x21c27f)_0x5bfcd2[_0x510bbb(0x1b3)]('-c');else _0x5cbc18&&_0x5bfcd2[_0x510bbb(0x1b3)]('-r');const _0x2436f0=createCommandSpinner('Initializing...',{'verbose':_0x6c1d2['verbose']});_0x2436f0[_0x510bbb(0x1dc)]();try{if(!_0x56c9ef){_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x1f2),this[_0x510bbb(0x19d)]=await findAvailablePort(0xfa0),_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x1b4)+this['port'],_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x218);const _0x5b0d9e=await _0x14b773[_0x510bbb(0x1c9)][_0x510bbb(0x213)](),_0x5db74f=_0x5b0d9e['id'];_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x1b0)+_0x5b0d9e[_0x510bbb(0x194)][_0x510bbb(0x1e6)];const _0x3e40e6=_0x6c1d2['profile'];try{const _0x4fe339=await _0x14b773[_0x510bbb(0x1ef)][_0x510bbb(0x1ba)]();_0x4fe339[_0x510bbb(0x1fe)]&&writeCachedAccountInfo(_0x6c1d2[_0x510bbb(0x197)],_0x4fe339[_0x510bbb(0x1fe)],_0x3e40e6);}catch{}_0x2436f0[_0x510bbb(0x1a2)]='Initializing\x20proxy\x20logger...',this[_0x510bbb(0x1a0)]=new TDXLogger(_0x6c1d2[_0x510bbb(0x204)],!![]),await this[_0x510bbb(0x1a0)][_0x510bbb(0x1d3)]();const _0x495bde=this['logger'][_0x510bbb(0x20e)]();_0x2436f0[_0x510bbb(0x1a2)]='✓\x20Logging\x20to\x20'+_0x495bde,_0x2436f0['text']='Starting\x20TD\x20LLM\x20proxy\x20server...',this[_0x510bbb(0x1de)]=new ProxyServer({'port':this['port'],'projectId':_0x5db74f,'tdx':_0x14b773,'logger':this[_0x510bbb(0x1a0)],'site':_0x6c1d2['site']}),await this[_0x510bbb(0x1de)][_0x510bbb(0x1dc)](),_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x20c)+this[_0x510bbb(0x19d)],_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x1e5),this[_0x510bbb(0x1fb)]=await createClaudeSettings(this[_0x510bbb(0x19d)],_0xfab5e2,_0x3e40e6),_0x2436f0['text']='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x200);try{_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x1c6),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x510bbb(0x1a0)]),_0x2436f0[_0x510bbb(0x1a2)]=_0x510bbb(0x1cd);}catch(_0x5bf7b2){_0x2436f0[_0x510bbb(0x1d4)](_0x510bbb(0x21f));throw _0x5bf7b2;}try{await ensureMcpServer(_0x510bbb(0x1c0),_0x510bbb(0x1fc),_0x510bbb(0x1d6),_0x2436f0,this[_0x510bbb(0x1a0)]);}catch(_0x4dde08){handleInstallationError(_0x4dde08,'TD\x20Docs\x20MCP\x20Server',_0x2436f0,this[_0x510bbb(0x1a0)]);}try{await ensureMarketplace('td-skills',_0x510bbb(0x1a3),_0x2436f0,this[_0x510bbb(0x1a0)]),await updateMarketplace(_0x510bbb(0x1dd),_0x2436f0,this[_0x510bbb(0x1a0)]),await ensurePlugin(_0x510bbb(0x1ce),'td-skills',_0x2436f0,this[_0x510bbb(0x1a0)]),await ensurePlugin(_0x510bbb(0x20a),_0x510bbb(0x1dd),_0x2436f0,this[_0x510bbb(0x1a0)]),await ensurePlugin(_0x510bbb(0x1e8),_0x510bbb(0x1dd),_0x2436f0,this['logger']);}catch(_0x1ab2dd){handleInstallationError(_0x1ab2dd,_0x510bbb(0x1f9),_0x2436f0,this[_0x510bbb(0x1a0)]);}_0x2436f0[_0x510bbb(0x1b1)]();}catch(_0x4dadcc){_0x2436f0[_0x510bbb(0x1d4)]('Setup\x20failed');throw _0x4dadcc;}const _0x49609d=await this[_0x510bbb(0x1f4)]();if(!_0x49609d)throw new SDKError(ErrorCode[_0x510bbb(0x1c4)],_0x510bbb(0x1b5),undefined,{'helpText':_0x510bbb(0x1a4)});const _0x3a6d92={...process[_0x510bbb(0x20f)]};!_0x56c9ef&&(_0x3a6d92[_0x510bbb(0x1c3)]=_0x510bbb(0x1d0)+this[_0x510bbb(0x19d)],_0x3a6d92[_0x510bbb(0x1a9)]=_0xfab5e2,_0x3a6d92[_0x510bbb(0x1db)]=_0x510bbb(0x1e3));const _0x11e7e0=spawn(_0x49609d,_0x5bfcd2,{'stdio':_0x510bbb(0x207),'env':_0x3a6d92}),_0x1c260d=await new Promise(_0x1425a9=>{const _0x326a6f=_0x510bbb;_0x11e7e0['on'](_0x326a6f(0x199),_0x105308=>{_0x1425a9(_0x105308||0x0);}),_0x11e7e0['on'](_0x326a6f(0x1e4),_0x38593c=>{const _0x312d7e=_0x326a6f;console[_0x312d7e(0x1e4)](a16_0x780086[_0x312d7e(0x1da)](_0x312d7e(0x1e1)+_0x38593c['message'])),_0x1425a9(0x1);});});this[_0x510bbb(0x1de)]&&(await this[_0x510bbb(0x1de)][_0x510bbb(0x1b1)](),console['log'](a16_0x780086[_0x510bbb(0x1a5)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));if(this['logger']){await this[_0x510bbb(0x1a0)]['close']();const _0x57f33b=this[_0x510bbb(0x1a0)][_0x510bbb(0x20e)]();console['log'](a16_0x780086[_0x510bbb(0x1a5)](_0x510bbb(0x1af)+_0x57f33b));}return this[_0x510bbb(0x1fb)]&&(await restoreClaudeSettings(this[_0x510bbb(0x1fb)]),console[_0x510bbb(0x1ab)](a16_0x780086['green'](_0x510bbb(0x19f)))),_0x1c260d;}catch(_0x46ee67){this['server']&&await this['server'][_0x510bbb(0x1b1)]();this[_0x510bbb(0x1a0)]&&await this[_0x510bbb(0x1a0)][_0x510bbb(0x212)]();this[_0x510bbb(0x1fb)]&&await restoreClaudeSettings(this['originalSettings']);throw _0x46ee67;}}async[a16_0x11c910(0x1f4)](){return new Promise(_0x12b2fc=>{const _0x46e987=a16_0x51ef,_0x119775=spawn(_0x46e987(0x1b9),[_0x46e987(0x1e0)]);let _0x24c593='';_0x119775[_0x46e987(0x1f6)]['on'](_0x46e987(0x21c),_0x10860d=>{const _0x5908cc=_0x46e987;_0x24c593+=_0x10860d[_0x5908cc(0x219)]();}),_0x119775['on'](_0x46e987(0x199),_0x460a9c=>{const _0xa23c7c=_0x46e987;_0x460a9c===0x0&&_0x24c593[_0xa23c7c(0x215)]()?_0x12b2fc(_0x24c593[_0xa23c7c(0x215)]()):_0x12b2fc(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);});});}}
|