@treasuredata/tdx 0.13.2 → 0.14.0
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 +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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/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/journey-validate-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/profile-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/segment-validate-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.d.ts +37 -0
- package/dist/commands/workflow-command.d.ts.map +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/commands/workflow-command.js.map +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.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/core/version.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-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.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/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.d.ts +1 -1
- package/dist/sdk/workflow/index.d.ts.map +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/index.js.map +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.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/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a4_0x52eb14=a4_0x55b9;(function(_0x1f3ca0,_0x538c7a){const _0x2d659c=a4_0x55b9,_0x5b55ec=_0x1f3ca0();while(!![]){try{const _0x30db34=parseInt(_0x2d659c(0x1db))/0x1*(parseInt(_0x2d659c(0x1a6))/0x2)+parseInt(_0x2d659c(0x225))/0x3*(parseInt(_0x2d659c(0x1d2))/0x4)+parseInt(_0x2d659c(0x1ae))/0x5*(parseInt(_0x2d659c(0x217))/0x6)+-parseInt(_0x2d659c(0x22f))/0x7+parseInt(_0x2d659c(0x1f7))/0x8*(parseInt(_0x2d659c(0x234))/0x9)+parseInt(_0x2d659c(0x1fb))/0xa*(-parseInt(_0x2d659c(0x224))/0xb)+-parseInt(_0x2d659c(0x1c9))/0xc;if(_0x30db34===_0x538c7a)break;else _0x5b55ec['push'](_0x5b55ec['shift']());}catch(_0x1a1168){_0x5b55ec['push'](_0x5b55ec['shift']());}}}(a4_0x4d88,0x67702));import a4_0xae88df from'chalk';import a4_0x2123f1 from'path';function a4_0x4d88(){const _0xdd239e=['\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x20resources?','Pushing\x20agent\x20from\x20\x22','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x20total','\x20\x20Text\x20Knowledge\x20Bases:\x20','green','pullProject','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Agent:\x20','action','\x20files\x20to\x20','agent.yml','\x20\x20tdx\x20agent\x20clone\x20agents/','newProjectId','\x20=\x20','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','prompts','Dry\x20run\x20-\x20no\x20files\x20written','2Sbucoe','\x20\x20Prompts:\x20','Clone\x20\x22','site','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','projectName','\x0a✔\x20Pulled\x20','cloneProject','175IukJSe','\x0aProject\x20pushed\x20with\x20errors','total','hasChanges','cyan','Using\x20context\x20project:\x20','Pull\x20cancelled','parse','Would\x20pull\x20agent:\x20','\x20\x20Source:\x20','pushProject','Status:\x20','Agent\x20pulled\x20successfully','INVALID_ARGUMENT','new','\x20\x20Prompt\x20\x22','agentId','dim','log','updated','Cannot\x20clone\x20from\x20context\x20project\x20\x22','dryRun','dirname','outputDir','newProjectName','\x0a✔\x20Pushed\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','12544872QMZTXX','knowledgeBases','description','Would\x20push\x20agent:\x20','projectId','llmProject','join','\x22...','\x0aChanges:','436WWQFij','agents','\x20|\x20','push','\x0aPush\x20','cwd','Source:\x20','execute','gray','460678IJaLze','Clone\x20cancelled','agentName','Project\x20cloned\x20successfully','repeat','Cloning\x20\x22','errors','\x0aPush\x20summary\x20for\x20\x27','Output:\x20','error','Would\x20clone:','diff','\x20\x20Knowledge\x20Bases:\x20','agent:pull','\x20\x20tdx\x20agent\x20pull\x20','\x20--profile\x20','Pushing\x20to\x20project...','\x20new','\x20\x20Target:\x20','Current\x20context\x20has\x20llm_project=\x22','\x22\x20to\x20a\x20different\x20profile','counts','Using\x20local\x20project:\x20','\x20\x20Agent\x20\x22','yes','created','\x20successfully','Project:\x20','2232QMiFkM','\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','New\x20project\x20ID:\x20','output','19070zgEjXb','agent:push','\x20resources\x20to\x20\x27','\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','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Output\x20path:\x20','Using\x20current\x20project:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','Failed\x20to\x20push\x20agent:\x20','\x20changed','force','isNew','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Push\x20cancelled','yellow','Summary:','unchanged','Using\x20project:\x20','\x20unchanged','utf-8','\x20\x20Agents:\x20','\x20--name\x20','sourceProjectName','textKnowledgeBases','\x27\x20to\x20create\x20the\x20folder\x20structure.','\x0aChanges\x20to\x20prompt\x20\x27','\x0aPull\x20summary\x20for\x20\x27','outputPath','67518GPigYs','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','✔\x20Context\x20set:\x20','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','New\x20project:\x20','\x22:\x20','\x20created','tdx.json','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Errors:','\x0aChanges\x20to\x20agent\x20\x27','pushAgent','llm_project','1001RkmRAu','22749vcUBVS','red','MISSING_ARGUMENT','\x20errors','name','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x22\x20to\x20new\x20project\x20\x22','agent:clone','\x20files?','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','4134172PIynfh','llm','Project\x20cloned\x20with\x20errors','Dry\x20run\x20-\x20no\x20changes\x20made','session','17811EEfQvN'];a4_0x4d88=function(){return _0xdd239e;};return a4_0x4d88();}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';function a4_0x55b9(_0x440f49,_0xef9a84){_0x440f49=_0x440f49-0x1a1;const _0x4d88f1=a4_0x4d88();let _0x55b9e1=_0x4d88f1[_0x440f49];return _0x55b9e1;}import{findAgentConfigPath}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x51d5bd){const _0x461304=a4_0x55b9,_0x1d00d6=[];if(_0x51d5bd[_0x461304(0x1b0)]!==undefined)_0x1d00d6[_0x461304(0x1d5)](_0x51d5bd['total']+_0x461304(0x239));if(_0x51d5bd[_0x461304(0x1bc)]!==undefined&&_0x51d5bd[_0x461304(0x1bc)]>0x0)_0x1d00d6[_0x461304(0x1d5)](a4_0xae88df[_0x461304(0x23b)](_0x51d5bd[_0x461304(0x1bc)]+_0x461304(0x1ec)));if(_0x51d5bd[_0x461304(0x1f4)]!==undefined&&_0x51d5bd[_0x461304(0x1f4)]>0x0)_0x1d00d6[_0x461304(0x1d5)](a4_0xae88df['green'](_0x51d5bd[_0x461304(0x1f4)]+_0x461304(0x21d)));if(_0x51d5bd[_0x461304(0x1c1)]!==undefined&&_0x51d5bd['updated']>0x0)_0x1d00d6[_0x461304(0x1d5)](a4_0xae88df[_0x461304(0x209)](_0x51d5bd[_0x461304(0x1c1)]+'\x20updated'));if(_0x51d5bd['unchanged']!==undefined&&_0x51d5bd[_0x461304(0x20b)]>0x0)_0x1d00d6[_0x461304(0x1d5)](a4_0xae88df['gray'](_0x51d5bd[_0x461304(0x20b)]+_0x461304(0x20d)));if(_0x51d5bd[_0x461304(0x1e1)]!==undefined&&_0x51d5bd[_0x461304(0x1e1)]>0x0)_0x1d00d6['push'](a4_0xae88df['red'](_0x51d5bd['errors']+_0x461304(0x228)));return _0x1d00d6[_0x461304(0x1cf)](',\x20');}function displayDiffs(_0x4f16a9,_0x35cedc,_0x4b3c2c,_0x5c6f5d){const _0x3b8a9a=a4_0x55b9;for(const _0x4f6128 of _0x4f16a9){if(_0x4f6128[_0x3b8a9a(0x1e6)]){const _0x38af72=_0x4f6128['agentName']||_0x4f6128['name'];console[_0x3b8a9a(0x1c0)](_0x3b8a9a(0x221)+_0x38af72+'\x27:'),console[_0x3b8a9a(0x1c0)]('─'[_0x3b8a9a(0x1df)](0x3c)),console[_0x3b8a9a(0x1c0)](_0x4f6128[_0x3b8a9a(0x1e6)]),console[_0x3b8a9a(0x1c0)]('─'[_0x3b8a9a(0x1df)](0x3c));}}for(const _0x317ae7 of _0x35cedc){_0x317ae7[_0x3b8a9a(0x1e6)]&&(console[_0x3b8a9a(0x1c0)]('\x0aChanges\x20to\x20knowledge\x20base\x20\x27'+_0x317ae7[_0x3b8a9a(0x229)]+'\x27:'),console[_0x3b8a9a(0x1c0)]('─'[_0x3b8a9a(0x1df)](0x3c)),console[_0x3b8a9a(0x1c0)](_0x317ae7[_0x3b8a9a(0x1e6)]),console[_0x3b8a9a(0x1c0)]('─'[_0x3b8a9a(0x1df)](0x3c)));}for(const _0x5baee2 of _0x4b3c2c){_0x5baee2[_0x3b8a9a(0x1e6)]&&(console[_0x3b8a9a(0x1c0)](_0x3b8a9a(0x21a)+_0x5baee2['name']+'\x27:'),console[_0x3b8a9a(0x1c0)]('─'[_0x3b8a9a(0x1df)](0x3c)),console[_0x3b8a9a(0x1c0)](_0x5baee2[_0x3b8a9a(0x1e6)]),console['log']('─'[_0x3b8a9a(0x1df)](0x3c)));}for(const _0x3dc97a of _0x5c6f5d){_0x3dc97a[_0x3b8a9a(0x1e6)]&&(console['log'](_0x3b8a9a(0x214)+_0x3dc97a['name']+'\x27:'),console['log']('─'[_0x3b8a9a(0x1df)](0x3c)),console[_0x3b8a9a(0x1c0)](_0x3dc97a[_0x3b8a9a(0x1e6)]),console[_0x3b8a9a(0x1c0)]('─'[_0x3b8a9a(0x1df)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x52eb14(0x229)]=a4_0x52eb14(0x1e8);['description']='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0x52eb14(0x1d9)](_0x227ee7){const _0x5850a6=a4_0x52eb14,{options:_0xdb2b9f,args:_0x4f74a0,tdx:_0x4cdccb}=_0x227ee7,_0x2e2275=_0x4f74a0[0x0],_0x49dc25=_0x4f74a0[0x1],_0x26a0cb=_0xdb2b9f[_0x5850a6(0x1fa)],_0x3e77db=_0xdb2b9f['dryRun'],_0x2d5ee4=_0xdb2b9f[_0x5850a6(0x205)],_0x561e9f=_0xdb2b9f[_0x5850a6(0x1f3)],_0x158a00=_0xdb2b9f['llmProject'];let _0x201bc7,_0x473de6;const _0x4d5dc9=findAgentConfigPath(process[_0x5850a6(0x1d7)]());if(_0x2e2275){const _0xbf1854=a4_0x2123f1[_0x5850a6(0x1cf)](_0x2e2275,_0x5850a6(0x21e));if(existsSync(_0xbf1854))try{const _0x4da602=JSON[_0x5850a6(0x1b5)](readFileSync(_0xbf1854,_0x5850a6(0x20e)));_0x201bc7=_0x4da602[_0x5850a6(0x223)],_0x473de6=_0x2e2275,console[_0x5850a6(0x1c0)](a4_0xae88df['dim']('Using\x20project\x20from\x20'+_0xbf1854+':\x20'+_0x201bc7));}catch{_0x201bc7=_0x2e2275;}else _0x201bc7=_0x2e2275;}else{if(_0x4d5dc9)try{const _0x5e7e58=JSON['parse'](readFileSync(_0x4d5dc9,_0x5850a6(0x20e)));_0x201bc7=_0x5e7e58['llm_project'],_0x473de6=a4_0x2123f1['dirname'](_0x4d5dc9),console[_0x5850a6(0x1c0)](a4_0xae88df[_0x5850a6(0x1bf)](_0x5850a6(0x20c)+_0x201bc7));}catch{_0x201bc7=_0x158a00;}else _0x201bc7=_0x158a00;}if(!_0x201bc7)return console[_0x5850a6(0x1c0)](a4_0xae88df[_0x5850a6(0x209)](_0x5850a6(0x238))),console[_0x5850a6(0x1c0)]('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[_0x5850a6(0x1c0)](_0x5850a6(0x1fe)),console[_0x5850a6(0x1c0)](_0x5850a6(0x1f8)),console[_0x5850a6(0x1c0)](_0x5850a6(0x202)),0x1;if(_0x49dc25){const {data:_0x394a7b}=await withSpinner('Pulling\x20agent\x20\x22'+_0x49dc25+'\x22\x20from\x20project\x20\x22'+_0x201bc7+'\x22...',()=>_0x4cdccb[_0x5850a6(0x230)]['pullAgent'](_0x201bc7,_0x49dc25,_0x26a0cb,{'dryRun':_0x3e77db,'force':_0x2d5ee4}));if(_0x3e77db)return console[_0x5850a6(0x1c0)](a4_0xae88df['yellow'](_0x5850a6(0x1a5))),console[_0x5850a6(0x1c0)](_0x5850a6(0x1b6)+_0x394a7b['agentName']),console[_0x5850a6(0x1c0)](_0x5850a6(0x200)+_0x394a7b[_0x5850a6(0x216)]),_0x394a7b['diff']&&(console[_0x5850a6(0x1c0)](_0x5850a6(0x1d1)),console[_0x5850a6(0x1c0)]('─'['repeat'](0x3c)),console[_0x5850a6(0x1c0)](_0x394a7b[_0x5850a6(0x1e6)]),console[_0x5850a6(0x1c0)]('─'[_0x5850a6(0x1df)](0x3c))),0x0;return console[_0x5850a6(0x1c0)](a4_0xae88df[_0x5850a6(0x23b)](_0x5850a6(0x1ba))),console['log'](_0x5850a6(0x23e)+_0x394a7b[_0x5850a6(0x1dd)]),console[_0x5850a6(0x1c0)](_0x5850a6(0x1e3)+_0x394a7b[_0x5850a6(0x216)]),console['log'](_0x5850a6(0x1b9)+(_0x394a7b[_0x5850a6(0x206)]?a4_0xae88df[_0x5850a6(0x23b)](_0x5850a6(0x1bc)):_0x394a7b[_0x5850a6(0x1b1)]?a4_0xae88df['yellow'](_0x5850a6(0x1c1)):a4_0xae88df[_0x5850a6(0x1da)](_0x5850a6(0x20b)))),0x0;}const _0x401739=_0x473de6||_0x26a0cb,{data:_0x2dc9f8}=await withSpinner('Analyzing\x20project\x20\x22'+_0x201bc7+_0x5850a6(0x1d0),()=>_0x4cdccb[_0x5850a6(0x230)][_0x5850a6(0x23c)](_0x201bc7,_0x401739,{'dryRun':!![]})),_0x4c0925=_0x2dc9f8[_0x5850a6(0x1f0)][_0x5850a6(0x1d3)]['new']+_0x2dc9f8[_0x5850a6(0x1f0)]['knowledgeBases']['new']+_0x2dc9f8['counts'][_0x5850a6(0x212)][_0x5850a6(0x1bc)]+_0x2dc9f8[_0x5850a6(0x1f0)][_0x5850a6(0x1a4)][_0x5850a6(0x1bc)],_0x56b7b4=_0x2dc9f8[_0x5850a6(0x1f0)]['agents'][_0x5850a6(0x1c1)]+_0x2dc9f8[_0x5850a6(0x1f0)]['knowledgeBases'][_0x5850a6(0x1c1)]+_0x2dc9f8[_0x5850a6(0x1f0)]['textKnowledgeBases'][_0x5850a6(0x1c1)]+_0x2dc9f8[_0x5850a6(0x1f0)][_0x5850a6(0x1a4)][_0x5850a6(0x1c1)],_0x3b1bba=_0x2dc9f8['counts'][_0x5850a6(0x1d3)][_0x5850a6(0x20b)]+_0x2dc9f8[_0x5850a6(0x1f0)][_0x5850a6(0x1ca)][_0x5850a6(0x20b)]+_0x2dc9f8[_0x5850a6(0x1f0)][_0x5850a6(0x212)][_0x5850a6(0x20b)]+_0x2dc9f8[_0x5850a6(0x1f0)][_0x5850a6(0x1a4)]['unchanged'];console[_0x5850a6(0x1c0)](_0x5850a6(0x215)+_0x2dc9f8[_0x5850a6(0x1ab)]+'\x27:'),console[_0x5850a6(0x1c0)]('\x20\x20'+a4_0xae88df[_0x5850a6(0x23b)]('+\x20'+_0x4c0925+'\x20new')+_0x5850a6(0x1d4)+a4_0xae88df[_0x5850a6(0x209)]('~\x20'+_0x56b7b4+_0x5850a6(0x204))+_0x5850a6(0x1d4)+a4_0xae88df[_0x5850a6(0x1bf)]('=\x20'+_0x3b1bba+_0x5850a6(0x20d))),console[_0x5850a6(0x1c0)]('\x20\x20Agents:\x20'+formatCountSummary(_0x2dc9f8['counts'][_0x5850a6(0x1d3)])),console[_0x5850a6(0x1c0)](_0x5850a6(0x1e7)+formatCountSummary(_0x2dc9f8['counts'][_0x5850a6(0x1ca)])),console['log'](_0x5850a6(0x23a)+formatCountSummary(_0x2dc9f8[_0x5850a6(0x1f0)]['textKnowledgeBases'])),console[_0x5850a6(0x1c0)](_0x5850a6(0x1a7)+formatCountSummary(_0x2dc9f8[_0x5850a6(0x1f0)]['prompts'])),console[_0x5850a6(0x1c0)](_0x5850a6(0x1ed)+a4_0xae88df[_0x5850a6(0x1b2)](_0x2dc9f8['outputDir'])),displayDiffs(_0x2dc9f8['agents'],_0x2dc9f8['knowledgeBases'],_0x2dc9f8[_0x5850a6(0x212)],_0x2dc9f8[_0x5850a6(0x1a4)]);if(_0x3e77db)return console[_0x5850a6(0x1c0)](a4_0xae88df[_0x5850a6(0x209)](_0x5850a6(0x1ff))),0x0;if(_0x4c0925===0x0&&_0x56b7b4===0x0)return console[_0x5850a6(0x1c0)](a4_0xae88df[_0x5850a6(0x23b)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x2dc9f8['projectName']},_0xdb2b9f[_0x5850a6(0x233)]),console['log'](a4_0xae88df['green'](_0x5850a6(0x219)+a4_0xae88df[_0x5850a6(0x1bf)](_0x5850a6(0x223))+'\x20=\x20'+a4_0xae88df['cyan'](_0x2dc9f8[_0x5850a6(0x1ab)]))),0x0;if(!_0x561e9f&&!_0x2d5ee4){const _0x419c89=await confirmKey('\x0aWrite\x20'+(_0x4c0925+_0x56b7b4)+_0x5850a6(0x22d));if(!_0x419c89)return console['log'](_0x5850a6(0x1b4)),0x0;}const {data:_0x5e1fe3}=await withSpinner('Writing\x20files...',()=>_0x4cdccb['llm'][_0x5850a6(0x23c)](_0x201bc7,_0x401739,{'force':_0x2d5ee4}));return console['log'](a4_0xae88df['green'](_0x5850a6(0x1ac)+(_0x4c0925+_0x56b7b4)+_0x5850a6(0x240)+_0x5e1fe3[_0x5850a6(0x1c5)])),saveSessionContext({'llm_project':_0x5e1fe3[_0x5850a6(0x1ab)]},_0xdb2b9f[_0x5850a6(0x233)]),console['log'](a4_0xae88df[_0x5850a6(0x23b)](_0x5850a6(0x219)+a4_0xae88df[_0x5850a6(0x1bf)](_0x5850a6(0x223))+_0x5850a6(0x1a2)+a4_0xae88df[_0x5850a6(0x1b2)](_0x5e1fe3['projectName']))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x52eb14(0x22c);['description']=a4_0x52eb14(0x1aa);async[a4_0x52eb14(0x1d9)](_0x93ae7e){const _0x53890f=a4_0x52eb14,{options:_0x4747f2,args:_0x206569,tdx:_0x59e3dc}=_0x93ae7e,_0x262589=_0x206569[0x0],_0x11b0ec=_0x4747f2[_0x53890f(0x229)],_0x2b0cbe=_0x4747f2['dryRun'],_0x22c3f4=_0x4747f2[_0x53890f(0x1f3)],_0x1cd0fa=_0x4747f2[_0x53890f(0x1a9)],_0xadf679=_0x4747f2[_0x53890f(0x1ce)];let _0x4f3f1b;const _0x108f28=findAgentConfigPath(process[_0x53890f(0x1d7)]());if(_0x262589){const _0x18467d=a4_0x2123f1[_0x53890f(0x1cf)](_0x262589,'tdx.json');existsSync(_0x18467d)?(_0x4f3f1b=_0x262589,console['log'](a4_0xae88df['dim']('Using\x20local\x20project:\x20'+_0x262589))):_0x4f3f1b=_0x262589;}else{if(_0x108f28)_0x4f3f1b=a4_0x2123f1[_0x53890f(0x1c4)](_0x108f28),console['log'](a4_0xae88df['dim'](_0x53890f(0x201)+_0x4f3f1b));else{if(_0xadf679){const _0x87f009=normalizeName(_0xadf679),_0x21765c=a4_0x2123f1[_0x53890f(0x1cf)](process[_0x53890f(0x1d7)](),'agents',_0x87f009,'tdx.json');if(existsSync(_0x21765c))_0x4f3f1b=a4_0x2123f1[_0x53890f(0x1c4)](_0x21765c),console[_0x53890f(0x1c0)](a4_0xae88df['dim'](_0x53890f(0x1f1)+_0x4f3f1b));else{const _0x13866b=_0x4747f2['profile'];if(_0x13866b)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x53890f(0x1c2)+_0xadf679+_0x53890f(0x1ef),undefined,{'helpText':'When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a'+_0x53890f(0x22a)+(_0x53890f(0x1e9)+_0xadf679+'\x0a')+(_0x53890f(0x242)+_0x87f009+_0x53890f(0x210)+(_0x11b0ec||'<new-name>')+_0x53890f(0x1ea)+_0x13866b)});_0x4f3f1b=_0xadf679,console[_0x53890f(0x1c0)](a4_0xae88df[_0x53890f(0x1bf)](_0x53890f(0x1b3)+_0xadf679));}}}}if(!_0x4f3f1b)return console['log'](a4_0xae88df[_0x53890f(0x209)](_0x53890f(0x23d))),console['log']('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x53890f(0x1c0)](_0x53890f(0x207)),console[_0x53890f(0x1c0)]('\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)'),console['log'](_0x53890f(0x1a3)),0x1;if(!_0x11b0ec)throw new SDKError(ErrorCode[_0x53890f(0x227)],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x22c3f4&&!_0x2b0cbe){const _0x54c6a8=await confirmKey(_0x53890f(0x1a8)+_0x4f3f1b+_0x53890f(0x22b)+_0x11b0ec+'\x22?');if(!_0x54c6a8)return console[_0x53890f(0x1c0)](_0x53890f(0x1dc)),0x0;}const {data:_0x1821d8}=await withSpinner(_0x53890f(0x1e0)+_0x4f3f1b+'\x22\x20to\x20\x22'+_0x11b0ec+'\x22...',()=>_0x59e3dc[_0x53890f(0x230)][_0x53890f(0x1ad)](_0x4f3f1b,_0x11b0ec,{'dryRun':_0x2b0cbe}));if(_0x2b0cbe)return console[_0x53890f(0x1c0)](a4_0xae88df[_0x53890f(0x209)](_0x53890f(0x232))),console[_0x53890f(0x1c0)]('Source:\x20'+_0x1821d8[_0x53890f(0x211)]),console['log'](_0x53890f(0x21b)+_0x11b0ec),console[_0x53890f(0x1c0)](_0x53890f(0x1e5)),console[_0x53890f(0x1c0)](_0x53890f(0x20f)+_0x1821d8[_0x53890f(0x1f0)][_0x53890f(0x1d3)][_0x53890f(0x1f4)]),console[_0x53890f(0x1c0)](_0x53890f(0x1e7)+_0x1821d8[_0x53890f(0x1f0)][_0x53890f(0x1ca)][_0x53890f(0x1f4)]),console[_0x53890f(0x1c0)](_0x53890f(0x1a7)+_0x1821d8['counts'][_0x53890f(0x1a4)][_0x53890f(0x1f4)]),0x0;const _0xa13276=_0x1821d8[_0x53890f(0x1f0)][_0x53890f(0x1d3)][_0x53890f(0x1e1)]>0x0||_0x1821d8['counts'][_0x53890f(0x1ca)]['errors']>0x0||_0x1821d8[_0x53890f(0x1f0)][_0x53890f(0x1a4)][_0x53890f(0x1e1)]>0x0;_0xa13276?console[_0x53890f(0x1c0)](a4_0xae88df[_0x53890f(0x209)](_0x53890f(0x231))):console[_0x53890f(0x1c0)](a4_0xae88df[_0x53890f(0x23b)](_0x53890f(0x1de)));console[_0x53890f(0x1c0)](_0x53890f(0x1d8)+_0x1821d8[_0x53890f(0x211)]),console['log'](_0x53890f(0x21b)+_0x1821d8[_0x53890f(0x1c6)]),console['log'](_0x53890f(0x1f9)+_0x1821d8[_0x53890f(0x1a1)]),console['log'](),console[_0x53890f(0x1c0)](_0x53890f(0x20a)),console[_0x53890f(0x1c0)](_0x53890f(0x20f)+formatCountSummary(_0x1821d8[_0x53890f(0x1f0)]['agents'])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x1821d8[_0x53890f(0x1f0)][_0x53890f(0x1ca)])),console['log'](_0x53890f(0x1a7)+formatCountSummary(_0x1821d8[_0x53890f(0x1f0)][_0x53890f(0x1a4)]));if(_0xa13276){console[_0x53890f(0x1c0)](),console['log'](a4_0xae88df[_0x53890f(0x226)](_0x53890f(0x220)));for(const _0x5eb89a of _0x1821d8[_0x53890f(0x1d3)]){_0x5eb89a[_0x53890f(0x23f)]===_0x53890f(0x1e4)&&console[_0x53890f(0x1c0)](a4_0xae88df[_0x53890f(0x226)](_0x53890f(0x1f2)+_0x5eb89a[_0x53890f(0x1dd)]+_0x53890f(0x21c)+_0x5eb89a['error']));}for(const _0x50c950 of _0x1821d8[_0x53890f(0x1ca)]){_0x50c950[_0x53890f(0x23f)]===_0x53890f(0x1e4)&&console[_0x53890f(0x1c0)](a4_0xae88df['red']('\x20\x20Knowledge\x20Base\x20\x22'+_0x50c950[_0x53890f(0x229)]+'\x22:\x20'+_0x50c950['error']));}for(const _0x5295e8 of _0x1821d8[_0x53890f(0x1a4)]){_0x5295e8[_0x53890f(0x23f)]===_0x53890f(0x1e4)&&console[_0x53890f(0x1c0)](a4_0xae88df[_0x53890f(0x226)](_0x53890f(0x1bd)+_0x5295e8[_0x53890f(0x229)]+'\x22:\x20'+_0x5295e8[_0x53890f(0x1e4)]));}return 0x1;}console[_0x53890f(0x1c0)]();const _0x369940=getLLMProjectUrl(_0x1cd0fa,_0x1821d8['newProjectId']);return console[_0x53890f(0x1c0)]('Project:\x20'+a4_0xae88df['cyan'](_0x369940)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x52eb14(0x229)]=a4_0x52eb14(0x1fc);[a4_0x52eb14(0x1cb)]=a4_0x52eb14(0x21f);async[a4_0x52eb14(0x1d9)](_0x49c83d){const _0x3ed437=a4_0x52eb14,{options:_0x454b58,args:_0x301a0f,tdx:_0x85b364}=_0x49c83d;let _0x1bc90a=_0x301a0f[0x0]||process['cwd']();const _0x39f3b1=_0x454b58[_0x3ed437(0x1c3)],_0x35d160=_0x454b58[_0x3ed437(0x205)],_0x8e9e1c=_0x454b58['yes'],_0xf759b9=_0x454b58[_0x3ed437(0x1a9)],_0x2fdf2f=a4_0x2123f1[_0x3ed437(0x1cf)](_0x1bc90a,_0x3ed437(0x241)),_0x4a41f8=existsSync(_0x2fdf2f);if(_0x4a41f8){const {data:_0x44e047}=await withSpinner(_0x3ed437(0x237)+_0x1bc90a+_0x3ed437(0x1d0),()=>_0x85b364[_0x3ed437(0x230)][_0x3ed437(0x222)](_0x1bc90a,{'dryRun':_0x39f3b1,'force':_0x35d160}));if(_0x39f3b1)return console[_0x3ed437(0x1c0)](a4_0xae88df['yellow'](_0x3ed437(0x232))),console[_0x3ed437(0x1c0)](_0x3ed437(0x1cc)+_0x44e047[_0x3ed437(0x1dd)]),0x0;if(_0x44e047[_0x3ed437(0x23f)]===_0x3ed437(0x1e4))return console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x226)](_0x3ed437(0x203)+_0x44e047['error'])),0x1;console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x23b)]('Agent\x20'+_0x44e047[_0x3ed437(0x23f)]+_0x3ed437(0x1f5))),console['log'](_0x3ed437(0x23e)+_0x44e047['agentName']);if(_0x44e047[_0x3ed437(0x1be)]&&_0x44e047[_0x3ed437(0x1cd)]){const _0x2aaba9=getLLMAgentChatUrl(_0xf759b9,_0x44e047[_0x3ed437(0x1cd)],_0x44e047[_0x3ed437(0x1be)]);console[_0x3ed437(0x1c0)]('Chat:\x20'+a4_0xae88df[_0x3ed437(0x1b2)](_0x2aaba9));}return 0x0;}let _0x125c3b=a4_0x2123f1['join'](_0x1bc90a,_0x3ed437(0x21e));if(!existsSync(_0x125c3b)){const _0x691b8e=findAgentConfigPath(_0x1bc90a);if(_0x691b8e)_0x1bc90a=a4_0x2123f1['dirname'](_0x691b8e),_0x125c3b=_0x691b8e,console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x1bf)](_0x3ed437(0x20c)+_0x1bc90a));else{const _0x5df27f=_0x454b58[_0x3ed437(0x1ce)];if(_0x5df27f){const _0x4a9b79=normalizeName(_0x5df27f),_0x5a3c61=a4_0x2123f1[_0x3ed437(0x1cf)](_0x1bc90a,_0x3ed437(0x1d3)),_0x3e4a64=a4_0x2123f1[_0x3ed437(0x1cf)](_0x5a3c61,_0x4a9b79,_0x3ed437(0x21e));existsSync(_0x3e4a64)&&(_0x1bc90a=a4_0x2123f1[_0x3ed437(0x1c4)](_0x3e4a64),_0x125c3b=_0x3e4a64,console['log'](a4_0xae88df[_0x3ed437(0x1bf)](_0x3ed437(0x20c)+_0x1bc90a)));}if(!existsSync(_0x125c3b)){let _0xa72fd9=_0x3ed437(0x22e);_0x5df27f&&(_0xa72fd9=_0x3ed437(0x1ee)+_0x5df27f+_0x3ed437(0x218)+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x5df27f+_0x3ed437(0x213)));throw new SDKError(ErrorCode[_0x3ed437(0x1bb)],'No\x20tdx.json\x20found\x20in\x20'+_0x1bc90a,undefined,{'helpText':_0xa72fd9});}}}const {data:_0x4e2c95}=await withSpinner('Analyzing\x20changes\x20to\x20push...',()=>_0x85b364[_0x3ed437(0x230)]['pushProject'](_0x1bc90a,{'dryRun':!![]})),_0x2cbb53=_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1d3)][_0x3ed437(0x1e1)]>0x0;if(_0x2cbb53){console['log'](a4_0xae88df[_0x3ed437(0x226)]('\x0aErrors\x20found:'));for(const _0xf42a25 of _0x4e2c95[_0x3ed437(0x1d3)]){_0xf42a25[_0x3ed437(0x23f)]==='error'&&console[_0x3ed437(0x1c0)](a4_0xae88df['red'](_0x3ed437(0x1f2)+_0xf42a25[_0x3ed437(0x1dd)]+_0x3ed437(0x21c)+_0xf42a25[_0x3ed437(0x1e4)]));}return 0x1;}const _0x3b2b50=_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1d3)]['created']+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1ca)][_0x3ed437(0x1f4)]+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x212)][_0x3ed437(0x1f4)]+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1a4)][_0x3ed437(0x1f4)],_0x450761=_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1d3)][_0x3ed437(0x1c1)]+_0x4e2c95['counts'][_0x3ed437(0x1ca)]['updated']+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x212)][_0x3ed437(0x1c1)]+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1a4)][_0x3ed437(0x1c1)],_0x46e043=_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1d3)]['unchanged']+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1ca)]['unchanged']+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x212)][_0x3ed437(0x20b)]+_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1a4)][_0x3ed437(0x20b)];console[_0x3ed437(0x1c0)](_0x3ed437(0x1e2)+_0x4e2c95[_0x3ed437(0x1ab)]+'\x27:'),console['log']('\x20\x20'+a4_0xae88df[_0x3ed437(0x23b)]('+\x20'+_0x3b2b50+_0x3ed437(0x1ec))+_0x3ed437(0x1d4)+a4_0xae88df[_0x3ed437(0x209)]('~\x20'+_0x450761+_0x3ed437(0x204))+_0x3ed437(0x1d4)+a4_0xae88df[_0x3ed437(0x1bf)]('=\x20'+_0x46e043+_0x3ed437(0x20d))),console[_0x3ed437(0x1c0)](_0x3ed437(0x20f)+formatCountSummary(_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x1d3)])),console['log'](_0x3ed437(0x1e7)+formatCountSummary(_0x4e2c95[_0x3ed437(0x1f0)]['knowledgeBases'])),console['log'](_0x3ed437(0x23a)+formatCountSummary(_0x4e2c95[_0x3ed437(0x1f0)][_0x3ed437(0x212)])),console[_0x3ed437(0x1c0)](_0x3ed437(0x1a7)+formatCountSummary(_0x4e2c95['counts'][_0x3ed437(0x1a4)])),console[_0x3ed437(0x1c0)](_0x3ed437(0x1b7)+a4_0xae88df[_0x3ed437(0x1b2)](_0x1bc90a)),displayDiffs(_0x4e2c95[_0x3ed437(0x1d3)],_0x4e2c95[_0x3ed437(0x1ca)],_0x4e2c95[_0x3ed437(0x212)],_0x4e2c95['prompts']);if(_0x39f3b1)return console[_0x3ed437(0x1c0)](a4_0xae88df['yellow'](_0x3ed437(0x1c8))),0x0;if(_0x3b2b50===0x0&&_0x450761===0x0){console[_0x3ed437(0x1c0)](a4_0xae88df['green'](_0x3ed437(0x235)));const _0x4f2d31=getLLMProjectUrl(_0xf759b9,_0x4e2c95['projectId']);return console[_0x3ed437(0x1c0)]('Project:\x20'+a4_0xae88df[_0x3ed437(0x1b2)](_0x4f2d31)),0x0;}if(!_0x8e9e1c&&!_0x35d160){const _0x3f834b=await confirmKey(_0x3ed437(0x1d6)+(_0x3b2b50+_0x450761)+_0x3ed437(0x236));if(!_0x3f834b)return console[_0x3ed437(0x1c0)](_0x3ed437(0x208)),0x0;}const {data:_0x2d7586}=await withSpinner(_0x3ed437(0x1eb),()=>_0x85b364[_0x3ed437(0x230)][_0x3ed437(0x1b8)](_0x1bc90a,{'force':_0x35d160})),_0x50008e=_0x2d7586[_0x3ed437(0x1f0)][_0x3ed437(0x1d3)][_0x3ed437(0x1e1)]>0x0||_0x2d7586[_0x3ed437(0x1f0)][_0x3ed437(0x1ca)][_0x3ed437(0x1e1)]>0x0||_0x2d7586[_0x3ed437(0x1f0)][_0x3ed437(0x212)][_0x3ed437(0x1e1)]>0x0||_0x2d7586[_0x3ed437(0x1f0)][_0x3ed437(0x1a4)][_0x3ed437(0x1e1)]>0x0;if(_0x50008e){console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x209)](_0x3ed437(0x1af))),console['log'](),console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x226)](_0x3ed437(0x220)));for(const _0x2c436f of _0x2d7586[_0x3ed437(0x1d3)]){_0x2c436f[_0x3ed437(0x23f)]===_0x3ed437(0x1e4)&&console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x226)]('\x20\x20Agent\x20\x22'+_0x2c436f[_0x3ed437(0x1dd)]+_0x3ed437(0x21c)+_0x2c436f['error']));}for(const _0x449213 of _0x2d7586[_0x3ed437(0x1ca)]){_0x449213[_0x3ed437(0x23f)]===_0x3ed437(0x1e4)&&console['log'](a4_0xae88df['red']('\x20\x20Knowledge\x20Base\x20\x22'+_0x449213['name']+_0x3ed437(0x21c)+_0x449213['error']));}for(const _0x11875f of _0x2d7586[_0x3ed437(0x212)]){_0x11875f[_0x3ed437(0x23f)]==='error'&&console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x226)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x11875f[_0x3ed437(0x229)]+_0x3ed437(0x21c)+_0x11875f['error']));}for(const _0x2f6f75 of _0x2d7586[_0x3ed437(0x1a4)]){_0x2f6f75[_0x3ed437(0x23f)]==='error'&&console['log'](a4_0xae88df[_0x3ed437(0x226)](_0x3ed437(0x1bd)+_0x2f6f75[_0x3ed437(0x229)]+_0x3ed437(0x21c)+_0x2f6f75[_0x3ed437(0x1e4)]));}return 0x1;}console[_0x3ed437(0x1c0)](a4_0xae88df[_0x3ed437(0x23b)](_0x3ed437(0x1c7)+(_0x3b2b50+_0x450761)+_0x3ed437(0x1fd)+_0x2d7586[_0x3ed437(0x1ab)]+'\x27'));const _0x24840e=getLLMProjectUrl(_0xf759b9,_0x2d7586[_0x3ed437(0x1cd)]);return console['log'](_0x3ed437(0x1f6)+a4_0xae88df[_0x3ed437(0x1b2)](_0x24840e)),0x0;}}
|
|
1
|
+
const a4_0x1295b4=a4_0x454c;(function(_0x4f7480,_0x255f3c){const _0x3b543f=a4_0x454c,_0xb6bc5b=_0x4f7480();while(!![]){try{const _0x4718f8=-parseInt(_0x3b543f(0x132))/0x1+parseInt(_0x3b543f(0x126))/0x2*(-parseInt(_0x3b543f(0xf4))/0x3)+parseInt(_0x3b543f(0x137))/0x4+-parseInt(_0x3b543f(0x10b))/0x5+parseInt(_0x3b543f(0xa3))/0x6+-parseInt(_0x3b543f(0xb7))/0x7*(parseInt(_0x3b543f(0xac))/0x8)+parseInt(_0x3b543f(0x9e))/0x9*(parseInt(_0x3b543f(0xf0))/0xa);if(_0x4718f8===_0x255f3c)break;else _0xb6bc5b['push'](_0xb6bc5b['shift']());}catch(_0x3c4f23){_0xb6bc5b['push'](_0xb6bc5b['shift']());}}}(a4_0x506c,0xbf924));import a4_0x1b05e3 from'chalk';import a4_0x2d4bec 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';function a4_0x454c(_0x5a811d,_0x413ccf){_0x5a811d=_0x5a811d-0x9b;const _0x506c63=a4_0x506c();let _0x454c65=_0x506c63[_0x5a811d];return _0x454c65;}import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../sdk/agent/agent-config.js';function a4_0x506c(){const _0x1a6725=['total','llm_project','\x20\x20tdx\x20agent\x20pull\x20','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','4087864ebnXOL','Run\x20\x27tdx\x20agent\x20pull\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','execute','\x22\x20to\x20new\x20project\x20\x22','117dTDsdB','tdx.json','yellow','Agent:\x20','\x20files?','9028326ZUCloq','\x22\x20from\x20project\x20\x22','Output:\x20','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','\x20\x20Source:\x20','\x0a✔\x20Pushed\x20','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','error','8992nqMYAQ','agent:clone','✔\x20Context\x20set:\x20','dryRun','dim','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','\x22:\x20','Would\x20push\x20agent:\x20','Pull\x20cancelled','\x0aPush\x20','No\x20tdx.json\x20found\x20in\x20','7483JooarK','log','\x20resources?','projectName','\x0aPull\x20summary\x20for\x20\x27','agents','Dry\x20run\x20-\x20no\x20changes\x20made','isNew','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','outputDir','\x20files\x20to\x20','\x20\x20Knowledge\x20Bases:\x20','newProjectName','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','Push\x20cancelled','\x20\x20Agent\x20\x22','red','textKnowledgeBases','Using\x20local\x20project:\x20','unchanged','<new-name>','prompts','pushAgent','\x0aWrite\x20','diff','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Would\x20pull\x20agent:\x20','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','llm','\x0aChanges:','\x20\x20Target:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20successfully','Status:\x20','\x20\x20Agents:\x20','force','join','\x20\x20Knowledge\x20Base\x20\x22','Project:\x20','action','Clone\x20cancelled','name','agent:pull','New\x20project\x20name\x20is\x20required','agent.yml','INVALID_ARGUMENT','hasChanges','Clone\x20\x22','yes','\x20=\x20','\x0aProject\x20pushed\x20with\x20errors','cwd','dirname','Failed\x20to\x20push\x20agent:\x20','new','cyan','session','1616820hMVnoo','created','Output\x20path:\x20','utf-8','66FKcmSb','\x22...','description','\x22\x20to\x20a\x20different\x20profile','\x20unchanged','Writing\x20files...','\x0aErrors\x20found:','knowledgeBases','counts','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','parse','\x22\x20to\x20\x22','\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)','\x20changed','Errors:','updated','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','pushProject','\x20created','Analyzing\x20project\x20\x22','gray','agentId','green','6449315BvAUjy','New\x20project:\x20','\x20new','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','pullAgent','cloneProject','\x20\x20tdx\x20agent\x20clone\x20agents/','push','site','agentName','Pulling\x20agent\x20\x22','Using\x20project:\x20','\x20\x20Prompts:\x20','\x0a✔\x20Pulled\x20','outputPath','\x20total','\x20--name\x20','\x20\x20Prompt\x20\x22','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\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','Summary:','\x20|\x20','\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','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x0aPush\x20summary\x20for\x20\x27','Cloning\x20\x22','\x20updated','101902bPCrxc','\x20--profile\x20','repeat','Using\x20project\x20from\x20','sourceProjectName','New\x20project\x20ID:\x20','projectId','profile','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','output','errors','Source:\x20','231536iqzjYQ'];a4_0x506c=function(){return _0x1a6725;};return a4_0x506c();}import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x4f4692){const _0x4cdbdd=a4_0x454c,_0x1684c2=[];if(_0x4f4692[_0x4cdbdd(0x133)]!==undefined)_0x1684c2[_0x4cdbdd(0x112)](_0x4f4692[_0x4cdbdd(0x133)]+_0x4cdbdd(0x11a));if(_0x4f4692['new']!==undefined&&_0x4f4692[_0x4cdbdd(0xed)]>0x0)_0x1684c2[_0x4cdbdd(0x112)](a4_0x1b05e3[_0x4cdbdd(0x10a)](_0x4f4692[_0x4cdbdd(0xed)]+_0x4cdbdd(0x10d)));if(_0x4f4692['created']!==undefined&&_0x4f4692[_0x4cdbdd(0xf1)]>0x0)_0x1684c2['push'](a4_0x1b05e3[_0x4cdbdd(0x10a)](_0x4f4692[_0x4cdbdd(0xf1)]+_0x4cdbdd(0x106)));if(_0x4f4692[_0x4cdbdd(0x103)]!==undefined&&_0x4f4692['updated']>0x0)_0x1684c2[_0x4cdbdd(0x112)](a4_0x1b05e3[_0x4cdbdd(0xa0)](_0x4f4692[_0x4cdbdd(0x103)]+_0x4cdbdd(0x125)));if(_0x4f4692[_0x4cdbdd(0xca)]!==undefined&&_0x4f4692['unchanged']>0x0)_0x1684c2[_0x4cdbdd(0x112)](a4_0x1b05e3[_0x4cdbdd(0x108)](_0x4f4692[_0x4cdbdd(0xca)]+_0x4cdbdd(0xf8)));if(_0x4f4692[_0x4cdbdd(0x130)]!==undefined&&_0x4f4692[_0x4cdbdd(0x130)]>0x0)_0x1684c2[_0x4cdbdd(0x112)](a4_0x1b05e3['red'](_0x4f4692[_0x4cdbdd(0x130)]+'\x20errors'));return _0x1684c2['join'](',\x20');}function displayDiffs(_0x5f24dc,_0x12dda1,_0x419c95,_0x6d4d80){const _0x58c198=a4_0x454c;for(const _0x2ceb86 of _0x5f24dc){if(_0x2ceb86['diff']){const _0x1dee86=_0x2ceb86[_0x58c198(0x114)]||_0x2ceb86[_0x58c198(0xe0)];console['log']('\x0aChanges\x20to\x20agent\x20\x27'+_0x1dee86+'\x27:'),console[_0x58c198(0xb8)]('─'['repeat'](0x3c)),console[_0x58c198(0xb8)](_0x2ceb86[_0x58c198(0xcf)]),console[_0x58c198(0xb8)]('─'[_0x58c198(0x128)](0x3c));}}for(const _0x7dd06b of _0x12dda1){_0x7dd06b['diff']&&(console[_0x58c198(0xb8)](_0x58c198(0x122)+_0x7dd06b['name']+'\x27:'),console['log']('─'[_0x58c198(0x128)](0x3c)),console['log'](_0x7dd06b[_0x58c198(0xcf)]),console['log']('─'[_0x58c198(0x128)](0x3c)));}for(const _0x5ef3f1 of _0x419c95){_0x5ef3f1[_0x58c198(0xcf)]&&(console[_0x58c198(0xb8)](_0x58c198(0xa6)+_0x5ef3f1['name']+'\x27:'),console[_0x58c198(0xb8)]('─'[_0x58c198(0x128)](0x3c)),console['log'](_0x5ef3f1[_0x58c198(0xcf)]),console['log']('─'['repeat'](0x3c)));}for(const _0x20e3fc of _0x6d4d80){_0x20e3fc['diff']&&(console[_0x58c198(0xb8)]('\x0aChanges\x20to\x20prompt\x20\x27'+_0x20e3fc[_0x58c198(0xe0)]+'\x27:'),console[_0x58c198(0xb8)]('─'[_0x58c198(0x128)](0x3c)),console[_0x58c198(0xb8)](_0x20e3fc[_0x58c198(0xcf)]),console[_0x58c198(0xb8)]('─'[_0x58c198(0x128)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x1295b4(0xe0)]=a4_0x1295b4(0xe1);[a4_0x1295b4(0xf6)]=a4_0x1295b4(0xfd);async[a4_0x1295b4(0x9c)](_0x366741){const _0x54eb15=a4_0x1295b4,{options:_0x9c8c21,args:_0x2eb9df,tdx:_0x10dc82}=_0x366741,_0x5d38a6=_0x2eb9df[0x0],_0x38d4dd=_0x2eb9df[0x1],_0xef7cf9=_0x9c8c21[_0x54eb15(0x12f)],_0x1cf2e0=_0x9c8c21[_0x54eb15(0xaf)],_0x873b62=_0x9c8c21[_0x54eb15(0xda)],_0x56e615=_0x9c8c21[_0x54eb15(0xe7)],_0x1c145f=_0x9c8c21['llmProject'];let _0x2d5d99,_0x1d1358;const _0x482734=findAgentConfigPath(process[_0x54eb15(0xea)]());if(_0x5d38a6){const _0x2f8734=a4_0x2d4bec['join'](_0x5d38a6,_0x54eb15(0x9f));if(existsSync(_0x2f8734))try{const _0x3e59a2=JSON[_0x54eb15(0xfe)](readFileSync(_0x2f8734,_0x54eb15(0xf3)));_0x2d5d99=_0x3e59a2[_0x54eb15(0x134)],_0x1d1358=_0x5d38a6,console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0xb0)](_0x54eb15(0x129)+_0x2f8734+':\x20'+_0x2d5d99));}catch{_0x2d5d99=_0x5d38a6;}else _0x2d5d99=_0x5d38a6;}else{if(_0x482734)try{const _0x5e0a07=JSON[_0x54eb15(0xfe)](readFileSync(_0x482734,_0x54eb15(0xf3)));_0x2d5d99=_0x5e0a07[_0x54eb15(0x134)],_0x1d1358=a4_0x2d4bec[_0x54eb15(0xeb)](_0x482734),console['log'](a4_0x1b05e3[_0x54eb15(0xb0)](_0x54eb15(0x116)+_0x2d5d99));}catch{_0x2d5d99=_0x1c145f;}else _0x2d5d99=_0x1c145f;}if(!_0x2d5d99)return console['log'](a4_0x1b05e3[_0x54eb15(0xa0)](_0x54eb15(0x104))),console[_0x54eb15(0xb8)]('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[_0x54eb15(0xb8)](_0x54eb15(0x121)),console[_0x54eb15(0xb8)](_0x54eb15(0x11e)),console['log'](_0x54eb15(0xc4)),0x1;if(_0x38d4dd){const {data:_0x285e49}=await withSpinner(_0x54eb15(0x115)+_0x38d4dd+_0x54eb15(0xa4)+_0x2d5d99+_0x54eb15(0xf5),()=>_0x10dc82[_0x54eb15(0xd3)][_0x54eb15(0x10f)](_0x2d5d99,_0x38d4dd,_0xef7cf9,{'dryRun':_0x1cf2e0,'force':_0x873b62}));if(_0x1cf2e0)return console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0xa0)]('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0x54eb15(0xb8)](_0x54eb15(0xd1)+_0x285e49[_0x54eb15(0x114)]),console['log'](_0x54eb15(0xf2)+_0x285e49['outputPath']),_0x285e49[_0x54eb15(0xcf)]&&(console['log'](_0x54eb15(0xd4)),console[_0x54eb15(0xb8)]('─'[_0x54eb15(0x128)](0x3c)),console[_0x54eb15(0xb8)](_0x285e49['diff']),console['log']('─'[_0x54eb15(0x128)](0x3c))),0x0;return console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0x10a)]('Agent\x20pulled\x20successfully')),console[_0x54eb15(0xb8)](_0x54eb15(0xa1)+_0x285e49[_0x54eb15(0x114)]),console['log'](_0x54eb15(0xa5)+_0x285e49[_0x54eb15(0x119)]),console[_0x54eb15(0xb8)](_0x54eb15(0xd8)+(_0x285e49[_0x54eb15(0xbe)]?a4_0x1b05e3[_0x54eb15(0x10a)](_0x54eb15(0xed)):_0x285e49[_0x54eb15(0xe5)]?a4_0x1b05e3[_0x54eb15(0xa0)]('updated'):a4_0x1b05e3[_0x54eb15(0x108)](_0x54eb15(0xca)))),0x0;}const _0x3aa3ac=_0x1d1358||_0xef7cf9,{data:_0x45b702}=await withSpinner(_0x54eb15(0x107)+_0x2d5d99+_0x54eb15(0xf5),()=>_0x10dc82[_0x54eb15(0xd3)]['pullProject'](_0x2d5d99,_0x3aa3ac,{'dryRun':!![]})),_0x35be98=_0x45b702[_0x54eb15(0xfc)]['agents'][_0x54eb15(0xed)]+_0x45b702['counts'][_0x54eb15(0xfb)][_0x54eb15(0xed)]+_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xc8)][_0x54eb15(0xed)]+_0x45b702['counts'][_0x54eb15(0xcc)][_0x54eb15(0xed)],_0x3d02c=_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xbc)][_0x54eb15(0x103)]+_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xfb)][_0x54eb15(0x103)]+_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xc8)]['updated']+_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xcc)][_0x54eb15(0x103)],_0x471011=_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xbc)][_0x54eb15(0xca)]+_0x45b702['counts'][_0x54eb15(0xfb)]['unchanged']+_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xc8)][_0x54eb15(0xca)]+_0x45b702[_0x54eb15(0xfc)]['prompts']['unchanged'];console[_0x54eb15(0xb8)](_0x54eb15(0xbb)+_0x45b702[_0x54eb15(0xba)]+'\x27:'),console[_0x54eb15(0xb8)]('\x20\x20'+a4_0x1b05e3[_0x54eb15(0x10a)]('+\x20'+_0x35be98+_0x54eb15(0x10d))+_0x54eb15(0x120)+a4_0x1b05e3[_0x54eb15(0xa0)]('~\x20'+_0x3d02c+_0x54eb15(0x101))+_0x54eb15(0x120)+a4_0x1b05e3[_0x54eb15(0xb0)]('=\x20'+_0x471011+_0x54eb15(0xf8))),console[_0x54eb15(0xb8)](_0x54eb15(0xd9)+formatCountSummary(_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xbc)])),console['log'](_0x54eb15(0xc2)+formatCountSummary(_0x45b702[_0x54eb15(0xfc)]['knowledgeBases'])),console[_0x54eb15(0xb8)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x45b702[_0x54eb15(0xfc)][_0x54eb15(0xc8)])),console[_0x54eb15(0xb8)](_0x54eb15(0x117)+formatCountSummary(_0x45b702[_0x54eb15(0xfc)]['prompts'])),console[_0x54eb15(0xb8)](_0x54eb15(0xd5)+a4_0x1b05e3['cyan'](_0x45b702['outputDir'])),displayDiffs(_0x45b702[_0x54eb15(0xbc)],_0x45b702[_0x54eb15(0xfb)],_0x45b702[_0x54eb15(0xc8)],_0x45b702[_0x54eb15(0xcc)]);if(_0x1cf2e0)return console['log'](a4_0x1b05e3[_0x54eb15(0xa0)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x35be98===0x0&&_0x3d02c===0x0)return console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0x10a)](_0x54eb15(0xd6))),saveSessionContext({'llm_project':_0x45b702[_0x54eb15(0xba)]},_0x9c8c21['session']),console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0x10a)](_0x54eb15(0xae)+a4_0x1b05e3[_0x54eb15(0xb0)](_0x54eb15(0x134))+_0x54eb15(0xe8)+a4_0x1b05e3[_0x54eb15(0xee)](_0x45b702[_0x54eb15(0xba)]))),0x0;if(!_0x56e615&&!_0x873b62){const _0xc780a2=await confirmKey(_0x54eb15(0xce)+(_0x35be98+_0x3d02c)+_0x54eb15(0xa2));if(!_0xc780a2)return console['log'](_0x54eb15(0xb4)),0x0;}const {data:_0x133775}=await withSpinner(_0x54eb15(0xf9),()=>_0x10dc82[_0x54eb15(0xd3)]['pullProject'](_0x2d5d99,_0x3aa3ac,{'force':_0x873b62}));return console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0x10a)](_0x54eb15(0x118)+(_0x35be98+_0x3d02c)+_0x54eb15(0xc1)+_0x133775[_0x54eb15(0xc0)])),saveSessionContext({'llm_project':_0x133775[_0x54eb15(0xba)]},_0x9c8c21[_0x54eb15(0xef)]),console[_0x54eb15(0xb8)](a4_0x1b05e3[_0x54eb15(0x10a)](_0x54eb15(0xae)+a4_0x1b05e3[_0x54eb15(0xb0)](_0x54eb15(0x134))+_0x54eb15(0xe8)+a4_0x1b05e3[_0x54eb15(0xee)](_0x133775[_0x54eb15(0xba)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x1295b4(0xad);[a4_0x1295b4(0xf6)]=a4_0x1295b4(0xb1);async['execute'](_0xde18b1){const _0x9c0674=a4_0x1295b4,{options:_0x302747,args:_0x51db7e,tdx:_0x345ff5}=_0xde18b1,_0x442cb2=_0x51db7e[0x0],_0x1b5cb4=_0x302747['name'],_0x44f01c=_0x302747[_0x9c0674(0xaf)],_0x872c4=_0x302747[_0x9c0674(0xe7)],_0x3b5f5c=_0x302747['site'],_0x5dfab0=_0x302747['llmProject'];let _0x1bc104;const _0x511d88=findAgentConfigPath(process[_0x9c0674(0xea)]());if(_0x442cb2){const _0xce1f8a=a4_0x2d4bec[_0x9c0674(0xdb)](_0x442cb2,'tdx.json');existsSync(_0xce1f8a)?(_0x1bc104=_0x442cb2,console[_0x9c0674(0xb8)](a4_0x1b05e3['dim'](_0x9c0674(0xc9)+_0x442cb2))):_0x1bc104=_0x442cb2;}else{if(_0x511d88)_0x1bc104=a4_0x2d4bec[_0x9c0674(0xeb)](_0x511d88),console[_0x9c0674(0xb8)](a4_0x1b05e3['dim']('Using\x20current\x20project:\x20'+_0x1bc104));else{if(_0x5dfab0){const _0x53690f=normalizeName(_0x5dfab0),_0x25b951=a4_0x2d4bec[_0x9c0674(0xdb)](process['cwd'](),_0x9c0674(0xbc),_0x53690f,_0x9c0674(0x9f));if(existsSync(_0x25b951))_0x1bc104=a4_0x2d4bec[_0x9c0674(0xeb)](_0x25b951),console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xb0)](_0x9c0674(0xc9)+_0x1bc104));else{const _0xb069f0=_0x302747[_0x9c0674(0x12d)];if(_0xb069f0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x5dfab0+_0x9c0674(0xf7),undefined,{'helpText':_0x9c0674(0xd2)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x9c0674(0x135)+_0x5dfab0+'\x0a')+(_0x9c0674(0x111)+_0x53690f+_0x9c0674(0x11b)+(_0x1b5cb4||_0x9c0674(0xcb))+_0x9c0674(0x127)+_0xb069f0)});_0x1bc104=_0x5dfab0,console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xb0)]('Using\x20context\x20project:\x20'+_0x5dfab0));}}}}if(!_0x1bc104)return console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xa0)](_0x9c0674(0xbf))),console[_0x9c0674(0xb8)](_0x9c0674(0x12e)),console[_0x9c0674(0xb8)]('\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory'),console[_0x9c0674(0xb8)](_0x9c0674(0x100)),console[_0x9c0674(0xb8)](_0x9c0674(0xd0)),0x1;if(!_0x1b5cb4)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x9c0674(0xe2),undefined,{'helpText':_0x9c0674(0x11d)});if(!_0x872c4&&!_0x44f01c){const _0xea8ba2=await confirmKey(_0x9c0674(0xe6)+_0x1bc104+_0x9c0674(0x9d)+_0x1b5cb4+'\x22?');if(!_0xea8ba2)return console['log'](_0x9c0674(0xdf)),0x0;}const {data:_0x5df34b}=await withSpinner(_0x9c0674(0x124)+_0x1bc104+_0x9c0674(0xff)+_0x1b5cb4+_0x9c0674(0xf5),()=>_0x345ff5[_0x9c0674(0xd3)][_0x9c0674(0x110)](_0x1bc104,_0x1b5cb4,{'dryRun':_0x44f01c}));if(_0x44f01c)return console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xa0)](_0x9c0674(0xbd))),console[_0x9c0674(0xb8)](_0x9c0674(0x131)+_0x5df34b[_0x9c0674(0x12a)]),console['log'](_0x9c0674(0x10c)+_0x1b5cb4),console['log']('Would\x20clone:'),console[_0x9c0674(0xb8)](_0x9c0674(0xd9)+_0x5df34b[_0x9c0674(0xfc)]['agents'][_0x9c0674(0xf1)]),console[_0x9c0674(0xb8)]('\x20\x20Knowledge\x20Bases:\x20'+_0x5df34b['counts'][_0x9c0674(0xfb)]['created']),console['log']('\x20\x20Prompts:\x20'+_0x5df34b['counts']['prompts'][_0x9c0674(0xf1)]),0x0;const _0x7d800e=_0x5df34b[_0x9c0674(0xfc)][_0x9c0674(0xbc)]['errors']>0x0||_0x5df34b[_0x9c0674(0xfc)][_0x9c0674(0xfb)]['errors']>0x0||_0x5df34b[_0x9c0674(0xfc)][_0x9c0674(0xcc)][_0x9c0674(0x130)]>0x0;_0x7d800e?console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xa0)]('Project\x20cloned\x20with\x20errors')):console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0x10a)]('Project\x20cloned\x20successfully'));console['log']('Source:\x20'+_0x5df34b[_0x9c0674(0x12a)]),console[_0x9c0674(0xb8)]('New\x20project:\x20'+_0x5df34b[_0x9c0674(0xc3)]),console[_0x9c0674(0xb8)](_0x9c0674(0x12b)+_0x5df34b['newProjectId']),console['log'](),console[_0x9c0674(0xb8)](_0x9c0674(0x11f)),console[_0x9c0674(0xb8)](_0x9c0674(0xd9)+formatCountSummary(_0x5df34b[_0x9c0674(0xfc)]['agents'])),console[_0x9c0674(0xb8)](_0x9c0674(0xc2)+formatCountSummary(_0x5df34b['counts'][_0x9c0674(0xfb)])),console[_0x9c0674(0xb8)](_0x9c0674(0x117)+formatCountSummary(_0x5df34b[_0x9c0674(0xfc)][_0x9c0674(0xcc)]));if(_0x7d800e){console['log'](),console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xc7)](_0x9c0674(0x102)));for(const _0x220066 of _0x5df34b[_0x9c0674(0xbc)]){_0x220066[_0x9c0674(0xde)]===_0x9c0674(0xab)&&console[_0x9c0674(0xb8)](a4_0x1b05e3['red'](_0x9c0674(0xc6)+_0x220066[_0x9c0674(0x114)]+_0x9c0674(0xb2)+_0x220066[_0x9c0674(0xab)]));}for(const _0x3df15f of _0x5df34b['knowledgeBases']){_0x3df15f[_0x9c0674(0xde)]===_0x9c0674(0xab)&&console['log'](a4_0x1b05e3['red'](_0x9c0674(0xdc)+_0x3df15f[_0x9c0674(0xe0)]+_0x9c0674(0xb2)+_0x3df15f['error']));}for(const _0x1de72e of _0x5df34b[_0x9c0674(0xcc)]){_0x1de72e[_0x9c0674(0xde)]==='error'&&console[_0x9c0674(0xb8)](a4_0x1b05e3[_0x9c0674(0xc7)](_0x9c0674(0x11c)+_0x1de72e[_0x9c0674(0xe0)]+_0x9c0674(0xb2)+_0x1de72e[_0x9c0674(0xab)]));}return 0x1;}console[_0x9c0674(0xb8)]();const _0x204dca=getLLMProjectUrl(_0x3b5f5c,_0x5df34b['newProjectId']);return console[_0x9c0674(0xb8)](_0x9c0674(0xdd)+a4_0x1b05e3['cyan'](_0x204dca)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x1295b4(0xe0)]='agent:push';[a4_0x1295b4(0xf6)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async['execute'](_0x24ebbf){const _0x16a15c=a4_0x1295b4,{options:_0x4e6f65,args:_0x4dc36d,tdx:_0x47249f}=_0x24ebbf;let _0x4b6759=_0x4dc36d[0x0]||process[_0x16a15c(0xea)]();const _0x4090e1=_0x4e6f65['dryRun'],_0x18bef7=_0x4e6f65[_0x16a15c(0xda)],_0x4b175e=_0x4e6f65[_0x16a15c(0xe7)],_0x2623e1=_0x4e6f65[_0x16a15c(0x113)],_0x4aec08=a4_0x2d4bec[_0x16a15c(0xdb)](_0x4b6759,_0x16a15c(0xe3)),_0x164718=existsSync(_0x4aec08);if(_0x164718){const {data:_0x3d1e3a}=await withSpinner('Pushing\x20agent\x20from\x20\x22'+_0x4b6759+_0x16a15c(0xf5),()=>_0x47249f['llm'][_0x16a15c(0xcd)](_0x4b6759,{'dryRun':_0x4090e1,'force':_0x18bef7}));if(_0x4090e1)return console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xa0)](_0x16a15c(0xbd))),console[_0x16a15c(0xb8)](_0x16a15c(0xb3)+_0x3d1e3a['agentName']),0x0;if(_0x3d1e3a['action']===_0x16a15c(0xab))return console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xc7)](_0x16a15c(0xec)+_0x3d1e3a[_0x16a15c(0xab)])),0x1;console['log'](a4_0x1b05e3[_0x16a15c(0x10a)]('Agent\x20'+_0x3d1e3a['action']+_0x16a15c(0xd7))),console[_0x16a15c(0xb8)](_0x16a15c(0xa1)+_0x3d1e3a['agentName']);if(_0x3d1e3a[_0x16a15c(0x109)]&&_0x3d1e3a[_0x16a15c(0x12c)]){const _0x116eed=getLLMAgentChatUrl(_0x2623e1,_0x3d1e3a[_0x16a15c(0x12c)],_0x3d1e3a[_0x16a15c(0x109)]);console[_0x16a15c(0xb8)]('Chat:\x20'+a4_0x1b05e3['cyan'](_0x116eed));}return 0x0;}let _0x3f0de2=a4_0x2d4bec['join'](_0x4b6759,_0x16a15c(0x9f));if(!existsSync(_0x3f0de2)){const _0x2a92fd=findAgentConfigPath(_0x4b6759);if(_0x2a92fd)_0x4b6759=a4_0x2d4bec['dirname'](_0x2a92fd),_0x3f0de2=_0x2a92fd,console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xb0)](_0x16a15c(0x116)+_0x4b6759));else{const _0x633c0c=_0x4e6f65['llmProject'];if(_0x633c0c){const _0x9caf70=normalizeName(_0x633c0c),_0xf2256c=a4_0x2d4bec[_0x16a15c(0xdb)](_0x4b6759,'agents'),_0x2276f5=a4_0x2d4bec[_0x16a15c(0xdb)](_0xf2256c,_0x9caf70,_0x16a15c(0x9f));existsSync(_0x2276f5)&&(_0x4b6759=a4_0x2d4bec[_0x16a15c(0xeb)](_0x2276f5),_0x3f0de2=_0x2276f5,console[_0x16a15c(0xb8)](a4_0x1b05e3['dim'](_0x16a15c(0x116)+_0x4b6759)));}if(!existsSync(_0x3f0de2)){let _0x2b91ac=_0x16a15c(0x136);_0x633c0c&&(_0x2b91ac='Current\x20context\x20has\x20llm_project=\x22'+_0x633c0c+_0x16a15c(0xa7)+(_0x16a15c(0x138)+_0x633c0c+_0x16a15c(0x9b)));throw new SDKError(ErrorCode[_0x16a15c(0xe4)],_0x16a15c(0xb6)+_0x4b6759,undefined,{'helpText':_0x2b91ac});}}}const {data:_0xdad19c}=await withSpinner('Analyzing\x20changes\x20to\x20push...',()=>_0x47249f['llm']['pushProject'](_0x4b6759,{'dryRun':!![]})),_0x144492=_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xbc)][_0x16a15c(0x130)]>0x0;if(_0x144492){console[_0x16a15c(0xb8)](a4_0x1b05e3['red'](_0x16a15c(0xfa)));for(const _0x1148f6 of _0xdad19c['agents']){_0x1148f6['action']===_0x16a15c(0xab)&&console['log'](a4_0x1b05e3[_0x16a15c(0xc7)](_0x16a15c(0xc6)+_0x1148f6[_0x16a15c(0x114)]+'\x22:\x20'+_0x1148f6[_0x16a15c(0xab)]));}return 0x1;}const _0x3bda22=_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xbc)][_0x16a15c(0xf1)]+_0xdad19c['counts']['knowledgeBases'][_0x16a15c(0xf1)]+_0xdad19c['counts'][_0x16a15c(0xc8)][_0x16a15c(0xf1)]+_0xdad19c[_0x16a15c(0xfc)]['prompts'][_0x16a15c(0xf1)],_0x46ee74=_0xdad19c[_0x16a15c(0xfc)]['agents'][_0x16a15c(0x103)]+_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xfb)][_0x16a15c(0x103)]+_0xdad19c['counts'][_0x16a15c(0xc8)][_0x16a15c(0x103)]+_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xcc)][_0x16a15c(0x103)],_0x436c7d=_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xbc)][_0x16a15c(0xca)]+_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xfb)][_0x16a15c(0xca)]+_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xc8)][_0x16a15c(0xca)]+_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xcc)][_0x16a15c(0xca)];console['log'](_0x16a15c(0x123)+_0xdad19c['projectName']+'\x27:'),console['log']('\x20\x20'+a4_0x1b05e3[_0x16a15c(0x10a)]('+\x20'+_0x3bda22+_0x16a15c(0x10d))+_0x16a15c(0x120)+a4_0x1b05e3[_0x16a15c(0xa0)]('~\x20'+_0x46ee74+_0x16a15c(0x101))+_0x16a15c(0x120)+a4_0x1b05e3[_0x16a15c(0xb0)]('=\x20'+_0x436c7d+_0x16a15c(0xf8))),console['log'](_0x16a15c(0xd9)+formatCountSummary(_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xbc)])),console[_0x16a15c(0xb8)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0xdad19c[_0x16a15c(0xfc)][_0x16a15c(0xfb)])),console['log']('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0xdad19c['counts'][_0x16a15c(0xc8)])),console[_0x16a15c(0xb8)](_0x16a15c(0x117)+formatCountSummary(_0xdad19c['counts'][_0x16a15c(0xcc)])),console[_0x16a15c(0xb8)](_0x16a15c(0xa8)+a4_0x1b05e3[_0x16a15c(0xee)](_0x4b6759)),displayDiffs(_0xdad19c[_0x16a15c(0xbc)],_0xdad19c[_0x16a15c(0xfb)],_0xdad19c[_0x16a15c(0xc8)],_0xdad19c[_0x16a15c(0xcc)]);if(_0x4090e1)return console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xa0)](_0x16a15c(0x10e))),0x0;if(_0x3bda22===0x0&&_0x46ee74===0x0){console[_0x16a15c(0xb8)](a4_0x1b05e3['green'](_0x16a15c(0xaa)));const _0x1dab75=getLLMProjectUrl(_0x2623e1,_0xdad19c[_0x16a15c(0x12c)]);return console[_0x16a15c(0xb8)](_0x16a15c(0xdd)+a4_0x1b05e3['cyan'](_0x1dab75)),0x0;}if(!_0x4b175e&&!_0x18bef7){const _0x195cda=await confirmKey(_0x16a15c(0xb5)+(_0x3bda22+_0x46ee74)+_0x16a15c(0xb9));if(!_0x195cda)return console[_0x16a15c(0xb8)](_0x16a15c(0xc5)),0x0;}const {data:_0x39e5a7}=await withSpinner('Pushing\x20to\x20project...',()=>_0x47249f[_0x16a15c(0xd3)][_0x16a15c(0x105)](_0x4b6759,{'force':_0x18bef7})),_0x859824=_0x39e5a7[_0x16a15c(0xfc)][_0x16a15c(0xbc)]['errors']>0x0||_0x39e5a7[_0x16a15c(0xfc)][_0x16a15c(0xfb)]['errors']>0x0||_0x39e5a7[_0x16a15c(0xfc)][_0x16a15c(0xc8)]['errors']>0x0||_0x39e5a7['counts'][_0x16a15c(0xcc)][_0x16a15c(0x130)]>0x0;if(_0x859824){console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xa0)](_0x16a15c(0xe9))),console[_0x16a15c(0xb8)](),console['log'](a4_0x1b05e3[_0x16a15c(0xc7)](_0x16a15c(0x102)));for(const _0x4a4d82 of _0x39e5a7['agents']){_0x4a4d82['action']===_0x16a15c(0xab)&&console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xc7)](_0x16a15c(0xc6)+_0x4a4d82['agentName']+_0x16a15c(0xb2)+_0x4a4d82[_0x16a15c(0xab)]));}for(const _0x31b801 of _0x39e5a7[_0x16a15c(0xfb)]){_0x31b801[_0x16a15c(0xde)]===_0x16a15c(0xab)&&console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0xc7)](_0x16a15c(0xdc)+_0x31b801[_0x16a15c(0xe0)]+'\x22:\x20'+_0x31b801['error']));}for(const _0x5d36f5 of _0x39e5a7[_0x16a15c(0xc8)]){_0x5d36f5['action']==='error'&&console[_0x16a15c(0xb8)](a4_0x1b05e3['red']('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x5d36f5[_0x16a15c(0xe0)]+_0x16a15c(0xb2)+_0x5d36f5['error']));}for(const _0xdeb753 of _0x39e5a7[_0x16a15c(0xcc)]){_0xdeb753[_0x16a15c(0xde)]===_0x16a15c(0xab)&&console['log'](a4_0x1b05e3['red'](_0x16a15c(0x11c)+_0xdeb753[_0x16a15c(0xe0)]+'\x22:\x20'+_0xdeb753[_0x16a15c(0xab)]));}return 0x1;}console[_0x16a15c(0xb8)](a4_0x1b05e3[_0x16a15c(0x10a)](_0x16a15c(0xa9)+(_0x3bda22+_0x46ee74)+'\x20resources\x20to\x20\x27'+_0x39e5a7[_0x16a15c(0xba)]+'\x27'));const _0x3c10cd=getLLMProjectUrl(_0x2623e1,_0x39e5a7['projectId']);return console[_0x16a15c(0xb8)](_0x16a15c(0xdd)+a4_0x1b05e3[_0x16a15c(0xee)](_0x3c10cd)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a5_0x313c(_0x13ea73,_0x51b40b){_0x13ea73=_0x13ea73-0xdc;const _0xfe63eb=a5_0xfe63();let _0x313cd1=_0xfe63eb[_0x13ea73];return _0x313cd1;}const a5_0x36aded=a5_0x313c;(function(_0x37562b,_0x310992){const _0x48eebc=a5_0x313c,_0x52c156=_0x37562b();while(!![]){try{const _0x4cc77b=-parseInt(_0x48eebc(0xf3))/0x1+-parseInt(_0x48eebc(0xdf))/0x2+-parseInt(_0x48eebc(0xe0))/0x3+-parseInt(_0x48eebc(0xdd))/0x4*(-parseInt(_0x48eebc(0xe2))/0x5)+parseInt(_0x48eebc(0x119))/0x6*(parseInt(_0x48eebc(0xff))/0x7)+parseInt(_0x48eebc(0xf8))/0x8+parseInt(_0x48eebc(0x118))/0x9;if(_0x4cc77b===_0x310992)break;else _0x52c156['push'](_0x52c156['shift']());}catch(_0x15c8ca){_0x52c156['push'](_0x52c156['shift']());}}}(a5_0xfe63,0x41a99));function a5_0xfe63(){const _0x4799d0=['5864175kpjnfS','90zYhZtq','x-trino-user','api','workflow','PUT','has','186580aTmxRv','method','898524QuiQUu','1354638BuMgEk','log','10rJdFVu','.\x20Valid\x20methods:\x20','error','message','validate','POST','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','<\x20HTTP/1.1\x20','type','join','GET','entries','trim','toLowerCase','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','stack','Error:\x20','189474WDELrk','authorization','name','verbose','isArray','1127160OAgPlo','description','trino','readBodyFromFile','headers','Invalid\x20API\x20type:\x20','site','220955djbMFp','request','Results\x20saved\x20to\x20','.\x20Valid\x20types:\x20','Invalid\x20header\x20format:\x20\x22','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','PATCH','length','set-cookie','color','proxy-authorization','includes','set-cookie2','output','cdp','llm','x-xsrf-token','Endpoint\x20must\x20start\x20with\x20/:\x20','data','body','substring','DELETE','startsWith','file','header'];a5_0xfe63=function(){return _0x4799d0;};return a5_0xfe63();}import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a5_0x36aded(0xf4),a5_0x36aded(0x109),'cookie',a5_0x36aded(0x107),a5_0x36aded(0x10b),a5_0x36aded(0x10f),'x-auth-token',a5_0x36aded(0x11a)]);function isSensitiveHeader(_0x4ba918){const _0x5ae0ce=a5_0x36aded;return SENSITIVE_HEADERS[_0x5ae0ce(0xdc)](_0x4ba918[_0x5ae0ce(0xef)]());}function parseHeader(_0x7b6e12){const _0x513083=a5_0x36aded,_0x2363ad=_0x7b6e12['indexOf'](':');if(_0x2363ad===-0x1)throw new Error(_0x513083(0x103)+_0x7b6e12+'\x22.\x20'+_0x513083(0x104));const _0x31467c=_0x7b6e12[_0x513083(0x113)](0x0,_0x2363ad)[_0x513083(0xee)](),_0x48fe53=_0x7b6e12[_0x513083(0x113)](_0x2363ad+0x1)[_0x513083(0xee)]();if(!_0x31467c)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x7b6e12+'\x22');return[_0x31467c,_0x48fe53];}export class ApiCommand extends BaseCommand{[a5_0x36aded(0xf5)]=a5_0x36aded(0x11b);[a5_0x36aded(0xf9)]='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a5_0x36aded(0xe6)](_0x5c7b76){const _0x1da3b9=a5_0x36aded,{args:_0x196f8a,options:_0x528482}=_0x5c7b76,_0x7ae59e=_0x528482;if(_0x196f8a[_0x1da3b9(0x106)]===0x0)return _0x1da3b9(0xf0);const _0x41f47e=_0x196f8a[0x0];if(!_0x41f47e[_0x1da3b9(0x115)]('/'))return _0x1da3b9(0x110)+_0x41f47e;const _0xaf575f=_0x7ae59e[_0x1da3b9(0x111)],_0xeecf8e=_0x7ae59e[_0x1da3b9(0x116)];if(_0xaf575f&&_0xeecf8e)return _0x1da3b9(0xe8);const _0x331ec7=_0x7ae59e[_0x1da3b9(0xde)]||_0x1da3b9(0xec),_0x47cae1=['GET',_0x1da3b9(0xe7),_0x1da3b9(0x11d),_0x1da3b9(0x114),_0x1da3b9(0x105)];if(!_0x47cae1[_0x1da3b9(0x10a)](_0x331ec7['toUpperCase']()))return'Invalid\x20HTTP\x20method:\x20'+_0x331ec7+_0x1da3b9(0xe3)+_0x47cae1['join'](',\x20');const _0x1e7c5a=_0x7ae59e[_0x1da3b9(0xea)]||'td',_0x4ad83d=['td',_0x1da3b9(0x10d),_0x1da3b9(0x11c),_0x1da3b9(0xfa),_0x1da3b9(0x10e)];if(!_0x4ad83d[_0x1da3b9(0x10a)](_0x1e7c5a))return _0x1da3b9(0xfd)+_0x1e7c5a+_0x1da3b9(0x102)+_0x4ad83d[_0x1da3b9(0xeb)](',\x20');return undefined;}async['execute'](_0xf004e2){const _0x25f655=a5_0x36aded,{options:_0x346ec4,args:_0x386e76,tdx:_0x20e839}=_0xf004e2,_0x3d8ff3=_0x346ec4,_0x2de144=_0x386e76[0x0],_0x54a879=(_0x3d8ff3['method']||_0x25f655(0xec))['toUpperCase'](),_0x12f15c=_0x3d8ff3[_0x25f655(0x111)],_0x554145=_0x3d8ff3['file'],_0x58f63d=_0x3d8ff3[_0x25f655(0x117)],_0x3e00e6=_0x3d8ff3[_0x25f655(0xea)]||'td';try{const _0xa3fee9={};if(_0x58f63d){const _0x372add=Array[_0x25f655(0xf7)](_0x58f63d)?_0x58f63d:[_0x58f63d];for(const _0x3eed22 of _0x372add){const [_0x2e44e1,_0x140941]=parseHeader(_0x3eed22);_0xa3fee9[_0x2e44e1]=_0x140941;}}let _0x39ceba;if(_0x12f15c)_0x39ceba=_0x12f15c;else{if(_0x554145)try{_0x39ceba=RawAPI[_0x25f655(0xfb)](_0x554145);}catch(_0x58140b){return console[_0x25f655(0xe4)](_0x25f655(0xf2)+(_0x58140b instanceof Error?_0x58140b[_0x25f655(0xe5)]:String(_0x58140b))),0x1;}}const _0x5ee30d={'method':_0x54a879,'apiType':_0x3e00e6,'includeHeaders':_0x346ec4[_0x25f655(0xf6)]};_0x39ceba&&(_0x5ee30d[_0x25f655(0x112)]=_0x39ceba);Object['keys'](_0xa3fee9)[_0x25f655(0x106)]>0x0&&(_0x5ee30d[_0x25f655(0xfc)]=_0xa3fee9);if(_0x346ec4[_0x25f655(0xf6)]){const _0x1e2b07=resolveSite(_0x346ec4[_0x25f655(0xfe)]),_0x16097a=getEndpoint(_0x1e2b07,_0x3e00e6),_0x1fdc07=''+_0x16097a+_0x2de144;console['error']('>\x20'+_0x54a879+'\x20'+_0x1fdc07);const _0x5ca65d=getAuthHeaders(_0x1e2b07),_0x27be97={..._0x5ca65d,..._0xa3fee9};for(const [_0x15d23c,_0x5a5051]of Object[_0x25f655(0xed)](_0x27be97)){!isSensitiveHeader(_0x15d23c)&&console[_0x25f655(0xe4)]('>\x20'+_0x15d23c+':\x20'+_0x5a5051);}_0x39ceba&&console[_0x25f655(0xe4)]('>'),console[_0x25f655(0xe4)]('');}const _0x5c0480=await _0x20e839[_0x25f655(0x11b)][_0x25f655(0x100)](_0x2de144,_0x5ee30d);if(_0x346ec4[_0x25f655(0xf6)]&&_0x5c0480['headers']){console[_0x25f655(0xe4)](_0x25f655(0xe9)+_0x5c0480['status']);for(const [_0x1dfa35,_0xafc8a7]of Object[_0x25f655(0xed)](_0x5c0480['headers'])){!isSensitiveHeader(_0x1dfa35)&&console[_0x25f655(0xe4)]('<\x20'+_0x1dfa35+':\x20'+_0xafc8a7);}console['error']('');}const _0x27753c=Boolean(_0x346ec4[_0x25f655(0x10c)]),_0x68c895={'color':_0x346ec4[_0x25f655(0x108)],'noColor':_0x346ec4['noColor']||_0x27753c&&!_0x346ec4[_0x25f655(0x108)]},_0x605c39=colorizeJSON(_0x5c0480[_0x25f655(0x111)],_0x68c895);return _0x346ec4['output']?(writeFileSync(_0x346ec4[_0x25f655(0x10c)],_0x605c39),console[_0x25f655(0xe4)](_0x25f655(0x101)+_0x346ec4[_0x25f655(0x10c)])):console[_0x25f655(0xe1)](_0x605c39),0x0;}catch(_0x119531){return _0x119531 instanceof Error?(console[_0x25f655(0xe4)](_0x25f655(0xf2)+_0x119531[_0x25f655(0xe5)]),_0x346ec4[_0x25f655(0xf6)]&&_0x119531['stack']&&console[_0x25f655(0xe4)]('\x0aStack\x20trace:\x0a'+_0x119531[_0x25f655(0xf1)])):console[_0x25f655(0xe4)](_0x25f655(0xf2)+String(_0x119531)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0xe622f4=a6_0x1583;(function(_0x26a1fc,_0x27cdc3){const _0x4d0b0c=a6_0x1583,_0x377f23=_0x26a1fc();while(!![]){try{const _0x7fd960=parseInt(_0x4d0b0c(0x189))/0x1*(-parseInt(_0x4d0b0c(0x193))/0x2)+-parseInt(_0x4d0b0c(0x18f))/0x3*(-parseInt(_0x4d0b0c(0x19c))/0x4)+parseInt(_0x4d0b0c(0x173))/0x5+parseInt(_0x4d0b0c(0x165))/0x6*(-parseInt(_0x4d0b0c(0x166))/0x7)+parseInt(_0x4d0b0c(0x186))/0x8*(-parseInt(_0x4d0b0c(0x170))/0x9)+-parseInt(_0x4d0b0c(0x16d))/0xa*(parseInt(_0x4d0b0c(0x168))/0xb)+parseInt(_0x4d0b0c(0x17f))/0xc*(parseInt(_0x4d0b0c(0x163))/0xd);if(_0x7fd960===_0x27cdc3)break;else _0x377f23['push'](_0x377f23['shift']());}catch(_0x4d109c){_0x377f23['push'](_0x377f23['shift']());}}}(a6_0x4e4d,0x7b755));function a6_0x1583(_0x398a61,_0x5c0c21){_0x398a61=_0x398a61-0x14e;const _0x4e4db2=a6_0x4e4d();let _0x1583c6=_0x4e4db2[_0x398a61];return _0x1583c6;}import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a6_0x221830 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a6_0x32dc4b from'chalk';function a6_0x4e4d(){const _0x528809=['N/A','4214040SUjEcY','7VoRGVJ','ERROR','907973TkZbWq','select','push','last_name','Enter\x20site\x20name:','20wQthKG','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','trim','432lusmHS','green','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','794790QZnaea','Name:\x20','description','create','bold','\x0aSetup\x20cancelled','\x20--profile\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','value','message','Enter\x20your\x20TD\x20API\x20key:','getUserInfo','13971420RHxqOo','jp\x20\x20\x20-\x20Japan','password','execute','tdx\x20profile:\x20','profile','User:\x20','107960Qgytec','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','Enter\x20custom\x20site','2143lUjrHa','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','filter','auth:clear','apiKey','3HFcyon','System\x20keychain\x20is\x20not\x20available','You\x20can\x20find\x20your\x20API\x20key\x20at:','email','514IPdRLh','logLevel','Read\x20credential\x20from\x20','us01','yellow','eu01','\x20(site:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','name','336376jSOEoq','\x27\x20registered','log','site','join','tdx:\x20auth\x20clear','ap02','customSite','No\x20credential\x20found','✓\x20Profile\x20\x27','jp01','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','red','findIndex','eu\x20\x20\x20-\x20Europe','error','Remove\x20API\x20key\x20from\x20system\x20keychain','✓\x20Authentication\x20successful\x0a','\x20for\x20profile:\x20','Validating\x20API\x20key...','auth:setup','status','test','API\x20key\x20cannot\x20be\x20empty','Setting\x20up\x20authentication\x20for\x20site:\x20','\x20(profile:\x20','other','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Select\x20your\x20Treasure\x20Data\x20site:','Setup\x20API\x20key\x20authentication\x20interactively','No\x20API\x20key\x20found\x20in\x20keychain','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x20\x20tdx','length','Site\x20name\x20cannot\x20be\x20empty','26KZwtsT'];a6_0x4e4d=function(){return _0x528809;};return a6_0x4e4d();}export class AuthSetupCommand extends BaseCommand{[a6_0xe622f4(0x19b)]=a6_0xe622f4(0x154);[a6_0xe622f4(0x175)]=a6_0xe622f4(0x15d);async[a6_0xe622f4(0x182)](_0x2128de){const _0x1cea3d=a6_0xe622f4,{options:_0x29fd88}=_0x2128de,_0x256cdc=_0x29fd88[_0x1cea3d(0x184)];console[_0x1cea3d(0x19e)](a6_0x32dc4b['bold']('tdx:\x20auth\x20setup'));const _0x36488b=_0x29fd88['site']||_0x1cea3d(0x196),_0x58b063=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x1cea3d(0x196)},{'title':_0x1cea3d(0x180),'value':_0x1cea3d(0x1a6)},{'title':_0x1cea3d(0x14e),'value':_0x1cea3d(0x198)},{'title':'ap02\x20-\x20Korea','value':_0x1cea3d(0x1a2)}];let _0x45423a=_0x58b063[_0x1cea3d(0x1a9)](_0x5117ad=>_0x5117ad[_0x1cea3d(0x17b)]===_0x36488b);_0x45423a===-0x1&&_0x36488b!==_0x1cea3d(0x196)&&(_0x58b063['push']({'title':_0x36488b,'value':_0x36488b}),_0x45423a=_0x58b063[_0x1cea3d(0x161)]-0x1);_0x58b063[_0x1cea3d(0x16a)]({'title':_0x1cea3d(0x188),'value':_0x1cea3d(0x15a)});const _0x1e3b9d=_0x256cdc?_0x1cea3d(0x15b)+_0x256cdc+'):':_0x1cea3d(0x15c),_0x130fae=await a6_0x221830({'type':_0x1cea3d(0x169),'name':'site','message':_0x1e3b9d,'choices':_0x58b063,'initial':_0x45423a>=0x0?_0x45423a:0x0});if(!_0x130fae['site'])return console[_0x1cea3d(0x19e)](_0x1cea3d(0x178)),0x1;let _0x590356;if(_0x130fae[_0x1cea3d(0x19f)]===_0x1cea3d(0x15a)){const _0x52d93f=await a6_0x221830({'type':'text','name':_0x1cea3d(0x1a3),'message':_0x1cea3d(0x16c),'initial':_0x1cea3d(0x196),'validate':_0x5912ac=>{const _0xdce4f1=_0x1cea3d;if(!_0x5912ac||!_0x5912ac[_0xdce4f1(0x16f)]())return _0xdce4f1(0x162);if(!/^[a-z0-9-]+$/[_0xdce4f1(0x156)](_0x5912ac[_0xdce4f1(0x16f)]()))return _0xdce4f1(0x15f);return!![];}});if(!_0x52d93f['customSite'])return console[_0x1cea3d(0x19e)](_0x1cea3d(0x178)),0x1;_0x590356=_0x52d93f[_0x1cea3d(0x1a3)];}else _0x590356=_0x130fae[_0x1cea3d(0x19f)];const _0x1b0101=resolveSite(_0x590356);console['log'](_0x1cea3d(0x158)+_0x1b0101),console['log'](_0x1cea3d(0x191)),console[_0x1cea3d(0x19e)]('\x20\x20'+getConsoleUrl(_0x1b0101,'/app/mp/ak'));const _0x505094=await a6_0x221830({'type':_0x1cea3d(0x181),'name':'apiKey','message':_0x1cea3d(0x17d),'validate':_0x155d6d=>{const _0x38a9ee=_0x1cea3d;if(!_0x155d6d||!_0x155d6d[_0x38a9ee(0x16f)]())return _0x38a9ee(0x157);return!![];}});if(!_0x505094[_0x1cea3d(0x18e)])return console[_0x1cea3d(0x19e)](_0x1cea3d(0x178)),0x1;const _0x406eac=_0x505094['apiKey'];console[_0x1cea3d(0x19e)](_0x1cea3d(0x153));try{const _0x339e0d=TDX[_0x1cea3d(0x176)]({'site':_0x1b0101,'apiKey':_0x406eac[_0x1cea3d(0x16f)](),'logLevel':_0x29fd88[_0x1cea3d(0x194)]??LogLevel[_0x1cea3d(0x167)]}),_0xc9a5af=await _0x339e0d['jobs'][_0x1cea3d(0x17e)]();console[_0x1cea3d(0x19e)](_0x1cea3d(0x18b)+_0xc9a5af[_0x1cea3d(0x192)]+')');const _0x48de81=await isKeychainAvailable();_0x48de81?(await saveAPIKeyAsync(_0x406eac[_0x1cea3d(0x16f)](),_0x1b0101,_0x256cdc),console[_0x1cea3d(0x19e)](_0x1cea3d(0x16e)+(_0x256cdc?_0x1cea3d(0x159)+_0x256cdc+')':''))):(console['warn'](a6_0x32dc4b[_0x1cea3d(0x197)](_0x1cea3d(0x18a))),console['warn'](a6_0x32dc4b[_0x1cea3d(0x197)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x256cdc){const _0x5a1232={'site':_0x1b0101};saveProfileToUserConfig(_0x256cdc,_0x5a1232),console['log'](_0x1cea3d(0x1a5)+_0x256cdc+_0x1cea3d(0x19d));}const _0x1898a3=_0x256cdc?_0x1cea3d(0x179)+_0x256cdc:'';return console[_0x1cea3d(0x19e)](),console[_0x1cea3d(0x19e)](_0x1cea3d(0x1a7)),console[_0x1cea3d(0x19e)](_0x1cea3d(0x160)+_0x1898a3+_0x1cea3d(0x17a)),console[_0x1cea3d(0x19e)]('\x20\x20tdx'+_0x1898a3+_0x1cea3d(0x19a)),0x0;}catch(_0x2e8a94){if(_0x2e8a94 instanceof HTTPClientError&&_0x2e8a94[_0x1cea3d(0x155)]===0x191)return printAuthError(_0x2e8a94),0x1;return console[_0x1cea3d(0x14f)](a6_0x32dc4b[_0x1cea3d(0x1a8)]('✗\x20Validation\x20failed:\x20'+(_0x2e8a94 instanceof Error?_0x2e8a94[_0x1cea3d(0x17c)]:String(_0x2e8a94)))),console[_0x1cea3d(0x14f)](_0x1cea3d(0x172)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a6_0xe622f4(0x19b)]='auth';['description']=a6_0xe622f4(0x187);async[a6_0xe622f4(0x182)](_0xb1126){const _0x387817=a6_0xe622f4,{options:_0x1f314a,tdx:_0x3c1ff7}=_0xb1126,_0x53ba86=_0x1f314a[_0x387817(0x19f)],_0x9d9ae9=_0x1f314a[_0x387817(0x184)],_0x585f3d=_0x9d9ae9?_0x9d9ae9:_0x387817(0x164);console['log'](_0x387817(0x183)+_0x585f3d+_0x387817(0x199)+_0x53ba86+')');const _0x54b475=await resolveAPIKeyAsync(_0x53ba86,_0x9d9ae9);if(_0x54b475){const {source:_0x5252d5,isDeprecated:_0x3ae53f}=_0x54b475,_0x4b2f74=_0x387817(0x195)+_0x5252d5;console[_0x387817(0x19e)](_0x3ae53f?a6_0x32dc4b[_0x387817(0x197)](_0x4b2f74):_0x4b2f74);}else console[_0x387817(0x19e)](a6_0x32dc4b[_0x387817(0x197)](_0x387817(0x1a4)));try{const _0x64469=await _0x3c1ff7['jobs']['getUserInfo']();return console[_0x387817(0x19e)](a6_0x32dc4b[_0x387817(0x171)](_0x387817(0x151))),console[_0x387817(0x19e)](_0x387817(0x185)+_0x64469[_0x387817(0x192)]),(_0x64469['first_name']||_0x64469[_0x387817(0x16b)])&&console[_0x387817(0x19e)](_0x387817(0x174)+[_0x64469['first_name'],_0x64469[_0x387817(0x16b)]][_0x387817(0x18c)](Boolean)[_0x387817(0x1a0)]('\x20')),0x0;}catch(_0x51443b){return _0x51443b instanceof HTTPClientError&&_0x51443b[_0x387817(0x155)]===0x191?printAuthError(_0x51443b,!![],_0x9d9ae9):console['error'](a6_0x32dc4b[_0x387817(0x1a8)]('✗\x20Validation\x20failed:\x20'+(_0x51443b instanceof Error?_0x51443b[_0x387817(0x17c)]:String(_0x51443b)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a6_0xe622f4(0x19b)]=a6_0xe622f4(0x18d);['description']=a6_0xe622f4(0x150);async[a6_0xe622f4(0x182)](_0x3060c5){const _0x1b7ff9=a6_0xe622f4,{options:_0x459fd1}=_0x3060c5,_0x26f45d=_0x459fd1[_0x1b7ff9(0x184)];console[_0x1b7ff9(0x19e)](a6_0x32dc4b[_0x1b7ff9(0x177)](_0x1b7ff9(0x1a1)));const _0x45a851=await isKeychainAvailable();if(!_0x45a851)return console['error'](a6_0x32dc4b[_0x1b7ff9(0x1a8)](_0x1b7ff9(0x190))),0x1;const _0x1fa02f=await deleteKeychainAPIKey(_0x26f45d);return _0x1fa02f?(clearCredentialCache(),console[_0x1b7ff9(0x19e)]('✓\x20API\x20key\x20removed\x20from\x20keychain'+(_0x26f45d?_0x1b7ff9(0x159)+_0x26f45d+')':'')),0x0):(console[_0x1b7ff9(0x19e)](_0x1b7ff9(0x15e)+(_0x26f45d?_0x1b7ff9(0x152)+_0x26f45d:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x29bcdb=a7_0x12df;(function(_0x31cf1d,_0x81244d){const _0x7c67f1=a7_0x12df,_0x1fda49=_0x31cf1d();while(!![]){try{const _0x3831a3=-parseInt(_0x7c67f1(0x1b7))/0x1+parseInt(_0x7c67f1(0x1b9))/0x2+-parseInt(_0x7c67f1(0x1e6))/0x3+parseInt(_0x7c67f1(0x1d4))/0x4+-parseInt(_0x7c67f1(0x1c7))/0x5*(-parseInt(_0x7c67f1(0x1e1))/0x6)+-parseInt(_0x7c67f1(0x1b8))/0x7+parseInt(_0x7c67f1(0x1d5))/0x8*(-parseInt(_0x7c67f1(0x1c1))/0x9);if(_0x3831a3===_0x81244d)break;else _0x1fda49['push'](_0x1fda49['shift']());}catch(_0x353690){_0x1fda49['push'](_0x1fda49['shift']());}}}(a7_0x418a,0xcb55b));function a7_0x418a(){const _0x406fbd=['llmProject','15003XhukSE','join','new','chatId','Continuing\x20chat:\x20','log','2315fezNtZ','verbose','\x27...','resolveProjectId','cause','getDefaultAgent','write','stdout','name','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','event','\x0aStack\x20trace:','CHAT_NOT_FOUND','4844116CpewyS','120AEihWX','\x20\x20Cause:\x20','\x0aError:\x20','session\x20context','data','llm','Using\x20cached\x20default\x20agent:\x20','agent','404','content','getOrCreateDefaultAgent','Using\x20agent\x20from\x20','9894YKtaaG','validate','stack','resolveAgentId','Chat\x20session:\x20','1204734ZUpbZU','handleChatEvent','message','Getting\x20default\x20agent...','Resolving\x20agent\x20\x27','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','type','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','error','32296LWZlnk','6120583AwcSGM','383182VXNdbu','execute','streamChat','getAgentId','chat','code','llmAgent'];a7_0x418a=function(){return _0x406fbd;};return a7_0x418a();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function a7_0x12df(_0x260aa4,_0x1f447e){_0x260aa4=_0x260aa4-0x1b2;const _0x418a10=a7_0x418a();let _0x12dfe8=_0x418a10[_0x260aa4];return _0x12dfe8;}function handleSDKError(_0x380a7f,_0x225eb){const _0x347477=a7_0x12df;if(_0x380a7f instanceof SDKError)console[_0x347477(0x1b6)]('Error:\x20'+_0x380a7f[_0x347477(0x1e8)]),_0x225eb[_0x347477(0x1c8)]&&(_0x380a7f[_0x347477(0x1cb)]&&console[_0x347477(0x1b6)](_0x347477(0x1d6)+_0x380a7f[_0x347477(0x1cb)]),_0x380a7f['stack']&&(console[_0x347477(0x1b6)](_0x347477(0x1d2)),console[_0x347477(0x1b6)](_0x380a7f[_0x347477(0x1e3)])));else throw _0x380a7f;}export class ChatCommand extends BaseCommand{[a7_0x29bcdb(0x1cf)]=a7_0x29bcdb(0x1bd);['description']=a7_0x29bcdb(0x1b3);[a7_0x29bcdb(0x1e2)](_0xeb4360){const _0x3f4594=a7_0x29bcdb,_0x37435e=_0xeb4360['args'][_0x3f4594(0x1c2)]('\x20');if(!_0x37435e)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async['streamChat'](_0x1cc0c8,_0x251543,_0x29e8a1,_0xe1e2be,_0x4bf97a){const _0x481cb5=a7_0x29bcdb;for await(const _0x267341 of _0x1cc0c8[_0x481cb5(0x1da)]['chat'](_0x251543,{'agentId':_0x29e8a1,'chatId':_0xe1e2be})){if(_0x267341['type']==='metadata'){const _0x3878da=_0x267341['data'][_0x481cb5(0x1c4)];saveLastChatId(_0x3878da),_0x4bf97a&&console[_0x481cb5(0x1b6)](_0x481cb5(0x1e5)+_0x3878da);}else _0x267341[_0x481cb5(0x1b4)]===_0x481cb5(0x1d1)&&this[_0x481cb5(0x1e7)](_0x267341['data']);}}async['getAgentId'](_0x228e19,_0x10f7a9,_0x107ac5,_0x2583c7,_0x25f4a2){const _0x4582e6=a7_0x29bcdb,_0x1ffcc6=_0x10f7a9||_0x107ac5;if(_0x1ffcc6){const {projectName:_0x2b6baa,agentName:_0x53e796}=parseAgentRef(_0x1ffcc6),_0x66b3e2=_0x53e796||_0x1ffcc6,_0x1aa997=_0x53e796?_0x2b6baa:_0x2583c7;if(!_0x1aa997)throw new Error(_0x4582e6(0x1d0));if(_0x25f4a2){const _0x18dda6=_0x10f7a9?'--agent\x20flag':_0x4582e6(0x1d8);console['error'](_0x4582e6(0x1e0)+_0x18dda6+':\x20'+_0x1aa997+'/'+_0x66b3e2);}const _0x1e8f01=await withSpinner('Resolving\x20project\x20\x27'+_0x1aa997+_0x4582e6(0x1c9),()=>_0x228e19[_0x4582e6(0x1da)][_0x4582e6(0x1ca)](_0x1aa997),{'verbose':_0x25f4a2}),_0x54203b=await withSpinner(_0x4582e6(0x1b2)+_0x66b3e2+_0x4582e6(0x1c9),()=>_0x228e19[_0x4582e6(0x1da)][_0x4582e6(0x1e4)](_0x66b3e2,_0x1e8f01[_0x4582e6(0x1d9)]),{'verbose':_0x25f4a2});return _0x54203b[_0x4582e6(0x1d9)];}else{const _0x545593=_0x228e19[_0x4582e6(0x1da)][_0x4582e6(0x1cc)]();if(_0x545593)return _0x25f4a2&&console[_0x4582e6(0x1b6)](_0x4582e6(0x1db)+_0x545593[_0x4582e6(0x1cf)]),_0x545593['id'];const _0x585819=await withSpinner(_0x4582e6(0x1e9),()=>_0x228e19[_0x4582e6(0x1da)][_0x4582e6(0x1df)]('claude-4.5-haiku',0x0),{'verbose':_0x25f4a2});return _0x585819['data']['id'];}}async[a7_0x29bcdb(0x1ba)](_0x117f96){const _0x40ffeb=a7_0x29bcdb,{options:_0x4f6108,args:_0x25f9d6,tdx:_0x4bc348}=_0x117f96,_0x195ebb=_0x25f9d6[_0x40ffeb(0x1c2)]('\x20'),_0x532441=_0x4f6108,_0x3eccf4=_0x532441[_0x40ffeb(0x1dc)],_0x109d70=_0x532441[_0x40ffeb(0x1bf)],_0x43d7a9=_0x532441[_0x40ffeb(0x1c0)],_0x510ef4=_0x532441[_0x40ffeb(0x1c3)];try{let _0x2e33fc,_0x4ae866;!_0x510ef4&&(_0x4ae866=loadLastChatId(),_0x4ae866&&_0x4f6108[_0x40ffeb(0x1c8)]&&console['error'](_0x40ffeb(0x1c5)+_0x4ae866));(_0x510ef4||!_0x4ae866)&&(_0x2e33fc=await this[_0x40ffeb(0x1bc)](_0x4bc348,_0x3eccf4,_0x109d70,_0x43d7a9,_0x4f6108[_0x40ffeb(0x1c8)]));try{await this[_0x40ffeb(0x1bb)](_0x4bc348,_0x195ebb,_0x2e33fc,_0x4ae866,_0x4f6108['verbose']);}catch(_0x5a8758){const _0x1e6e40=_0x5a8758 instanceof SDKError&&_0x5a8758[_0x40ffeb(0x1be)]===ErrorCode[_0x40ffeb(0x1d3)]||_0x5a8758 instanceof Error&&_0x5a8758[_0x40ffeb(0x1e8)]['includes'](_0x40ffeb(0x1dd));if(_0x1e6e40)_0x4f6108[_0x40ffeb(0x1c8)]&&console['error'](_0x40ffeb(0x1b5)),!_0x2e33fc&&(_0x2e33fc=await this['getAgentId'](_0x4bc348,_0x3eccf4,_0x109d70,_0x43d7a9,_0x4f6108['verbose'])),await this[_0x40ffeb(0x1bb)](_0x4bc348,_0x195ebb,_0x2e33fc,undefined,_0x4f6108[_0x40ffeb(0x1c8)]);else throw _0x5a8758;}return console[_0x40ffeb(0x1c6)](),0x0;}catch(_0x947d85){return console[_0x40ffeb(0x1b6)](),handleSDKError(_0x947d85,_0x4f6108),0x1;}}[a7_0x29bcdb(0x1e7)](_0x1dc5fc){const _0x3d6d39=a7_0x29bcdb;if('content'in _0x1dc5fc)process[_0x3d6d39(0x1ce)][_0x3d6d39(0x1cd)](_0x1dc5fc[_0x3d6d39(0x1de)]);else'error'in _0x1dc5fc&&console[_0x3d6d39(0x1b6)](_0x3d6d39(0x1d7)+_0x1dc5fc['error']);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a8_0x288b8b=a8_0x1d94;(function(_0x2aeac5,_0x1c2d40){const _0x5bb2bf=a8_0x1d94,_0x69d540=_0x2aeac5();while(!![]){try{const _0x6c25a5=parseInt(_0x5bb2bf(0x15a))/0x1*(parseInt(_0x5bb2bf(0x16a))/0x2)+-parseInt(_0x5bb2bf(0x1c3))/0x3+parseInt(_0x5bb2bf(0x1c1))/0x4*(parseInt(_0x5bb2bf(0x13b))/0x5)+parseInt(_0x5bb2bf(0x17b))/0x6+parseInt(_0x5bb2bf(0x146))/0x7+-parseInt(_0x5bb2bf(0x154))/0x8+parseInt(_0x5bb2bf(0x180))/0x9*(-parseInt(_0x5bb2bf(0x140))/0xa);if(_0x6c25a5===_0x1c2d40)break;else _0x69d540['push'](_0x69d540['shift']());}catch(_0x2c9b88){_0x69d540['push'](_0x69d540['shift']());}}}(a8_0x2aa6,0x6e30a));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 a8_0x278a84 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a8_0x288b8b(0x148);function handleInstallationError(_0x2b8769,_0x3c28ae,_0x4288d4,_0x506c2a){const _0x25f930=a8_0x288b8b;errorContains(_0x2b8769,_0x25f930(0x15e),_0x25f930(0x19d),_0x25f930(0x13e))?(_0x4288d4['text']='✓\x20'+_0x3c28ae+_0x25f930(0x169),_0x506c2a?.['info'](_0x3c28ae+_0x25f930(0x169)),_0x2b8769 instanceof SDKError&&_0x2b8769[_0x25f930(0x184)]&&_0x506c2a?.[_0x25f930(0x1b2)](_0x25f930(0x1ac)+_0x2b8769[_0x25f930(0x184)][_0x25f930(0x1b7)])):(_0x4288d4[_0x25f930(0x176)](_0x25f930(0x1b9)+_0x3c28ae),_0x506c2a?.[_0x25f930(0x158)](_0x3c28ae+_0x25f930(0x194),_0x2b8769));}export function parseVersion(_0x2e086f){const _0x1e6d46=a8_0x288b8b,_0x5b52e9=_0x2e086f[_0x1e6d46(0x168)]()[_0x1e6d46(0x14e)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x5b52e9)return null;return{'major':parseInt(_0x5b52e9[0x1],0xa),'minor':parseInt(_0x5b52e9[0x2],0xa),'patch':parseInt(_0x5b52e9[0x3],0xa)};}export function compareVersions(_0x49ea45,_0x31230f){const _0x43a06b=a8_0x288b8b;if(_0x49ea45[_0x43a06b(0x177)]!==_0x31230f[_0x43a06b(0x177)])return _0x49ea45[_0x43a06b(0x177)]-_0x31230f['major'];if(_0x49ea45[_0x43a06b(0x1a6)]!==_0x31230f[_0x43a06b(0x1a6)])return _0x49ea45[_0x43a06b(0x1a6)]-_0x31230f[_0x43a06b(0x1a6)];return _0x49ea45[_0x43a06b(0x192)]-_0x31230f['patch'];}async function checkClaudeVersion(_0x588722,_0x256bbe){const _0x4977dc=a8_0x288b8b;_0x256bbe?.['debug'](_0x4977dc(0x137)+_0x588722+')');const _0x1b5bea=await executeClaudeCommand([_0x4977dc(0x19c)],undefined,_0x256bbe),_0x231868=parseVersion(_0x1b5bea);if(!_0x231868){_0x256bbe?.[_0x4977dc(0x176)](_0x4977dc(0x1cb)+_0x1b5bea);return;}const _0x36c71e=_0x231868[_0x4977dc(0x177)]+'.'+_0x231868[_0x4977dc(0x1a6)]+'.'+_0x231868[_0x4977dc(0x192)],_0xff130d=parseVersion(_0x588722);if(!_0xff130d){_0x256bbe?.[_0x4977dc(0x176)](_0x4977dc(0x13c)+_0x588722);return;}if(compareVersions(_0x231868,_0xff130d)<0x0){_0x256bbe?.[_0x4977dc(0x158)](_0x4977dc(0x166)+_0x36c71e+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x588722+')');throw new SDKError(ErrorCode[_0x4977dc(0x172)],'Claude\x20Code\x20version\x20'+_0x36c71e+_0x4977dc(0x1b3)+_0x588722+_0x4977dc(0x15b),undefined,{'helpText':_0x4977dc(0x1a5)});}_0x256bbe?.[_0x4977dc(0x1b2)](_0x4977dc(0x166)+_0x36c71e+_0x4977dc(0x1c6));}function a8_0x1d94(_0x3bc330,_0x478f99){_0x3bc330=_0x3bc330-0x133;const _0x2aa6c5=a8_0x2aa6();let _0x1d949c=_0x2aa6c5[_0x3bc330];return _0x1d949c;}async function executeClaudeCommand(_0x4667e6,_0x2158d1,_0x2dc170){const _0x5d08f6=a8_0x288b8b;return _0x2dc170?.[_0x5d08f6(0x153)](_0x5d08f6(0x16f)+_0x4667e6[_0x5d08f6(0x139)]('\x20')),new Promise((_0x4f521b,_0x2151c6)=>{const _0x9d6d=_0x5d08f6,_0x24949d=spawn(_0x9d6d(0x181),_0x4667e6,{'stdio':_0x9d6d(0x1a1)});let _0x129d85='',_0x5c3362='';_0x24949d['stdout']['on'](_0x9d6d(0x1c9),_0x4a66af=>{const _0x498b9b=_0x9d6d;_0x129d85+=_0x4a66af[_0x498b9b(0x17d)]();}),_0x24949d['stderr']['on'](_0x9d6d(0x1c9),_0x1142bb=>{_0x5c3362+=_0x1142bb['toString']();}),_0x24949d['on']('error',_0xa0426c=>{const _0x30e1c6=_0x9d6d;_0xa0426c[_0x30e1c6(0x17a)]===_0x30e1c6(0x1ba)?(_0x2dc170?.[_0x30e1c6(0x158)](_0x30e1c6(0x1b5)),_0x2151c6(new SDKError(ErrorCode[_0x30e1c6(0x189)],_0x30e1c6(0x1b5),_0xa0426c,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x2dc170?.[_0x30e1c6(0x158)](_0x30e1c6(0x133)+_0xa0426c[_0x30e1c6(0x1b7)]),_0x2151c6(new SDKError(ErrorCode[_0x30e1c6(0x160)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0xa0426c['message'],_0xa0426c)));}),_0x24949d['on'](_0x9d6d(0x188),_0x12e884=>{const _0x11bfe8=_0x9d6d;if(_0x12e884===0x0)_0x4f521b(_0x129d85);else _0x2158d1?(_0x2dc170?.['error'](_0x11bfe8(0x1ab)+_0x12e884+_0x11bfe8(0x14f)+_0x4667e6[_0x11bfe8(0x139)]('\x20')),_0x2151c6(new SDKError(ErrorCode[_0x11bfe8(0x1a0)],_0x2158d1,new Error(_0x5c3362)))):_0x4f521b('');});});}async function ensureMcpServer(_0x2d550e,_0x277384,_0x34f289,_0x2b6d06,_0x57cb25){const _0x46647c=a8_0x288b8b;_0x2b6d06[_0x46647c(0x134)]=_0x46647c(0x199)+_0x2d550e+_0x46647c(0x1af),await executeClaudeCommand([_0x46647c(0x1c7),_0x46647c(0x1c2),_0x2d550e,_0x277384,_0x46647c(0x15c),_0x34f289],_0x46647c(0x16e)+_0x2d550e+'\x27',_0x57cb25),_0x2b6d06[_0x46647c(0x134)]=_0x46647c(0x13d)+_0x2d550e+'\x27\x20configured';}async function ensureMarketplace(_0x257961,_0x373c79,_0x67b84,_0x274dcb){const _0x1bb9f7=a8_0x288b8b;_0x67b84[_0x1bb9f7(0x134)]=_0x1bb9f7(0x1a3)+_0x257961+_0x1bb9f7(0x1af),await executeClaudeCommand(['plugin',_0x1bb9f7(0x19a),_0x1bb9f7(0x1c2),_0x373c79],_0x1bb9f7(0x19f)+_0x257961+'\x27',_0x274dcb),_0x67b84[_0x1bb9f7(0x134)]=_0x1bb9f7(0x178)+_0x257961+_0x1bb9f7(0x186);}async function updateMarketplace(_0x21e709,_0x47b8ba,_0x449424){const _0xd672a1=a8_0x288b8b;_0x47b8ba[_0xd672a1(0x134)]=_0xd672a1(0x1a4)+_0x21e709+'\x27...',await executeClaudeCommand(['plugin',_0xd672a1(0x19a),_0xd672a1(0x149)],_0xd672a1(0x1cf)+_0x21e709+'\x27',_0x449424),_0x47b8ba[_0xd672a1(0x134)]=_0xd672a1(0x178)+_0x21e709+_0xd672a1(0x156);}async function ensurePlugin(_0x27e727,_0x205807,_0x22b874,_0x4a55d5){const _0x2d2395=a8_0x288b8b;_0x22b874[_0x2d2395(0x134)]='Installing\x20plugin\x20\x27'+_0x27e727+'\x27...',await executeClaudeCommand([_0x2d2395(0x1ad),_0x2d2395(0x174),_0x27e727+'@'+_0x205807],_0x2d2395(0x195)+_0x27e727+'\x27',_0x4a55d5),_0x22b874[_0x2d2395(0x134)]='✓\x20Plugin\x20\x27'+_0x27e727+_0x2d2395(0x144);}function a8_0x2aa6(){const _0x5d5758=['Command\x20spawn\x20error:\x20','text','resume','Checking\x20Claude\x20Code\x20version...','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','✓\x20Claude\x20Code\x20version\x20OK','join','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','4225IIVdWD','Invalid\x20minimum\x20version\x20format:\x20','✓\x20MCP\x20server\x20\x27','already\x20configured','tdx\x20claude\x20statusline','24700FSmeIY','cwd','.claude','getLogPath','\x27\x20installed','localhost','6171991WuRUgd','parse','2.0.20','update','Creating\x20.claude/settings.local.json...','✓\x20Logging\x20to\x20','attributes','env','match','):\x20claude\x20','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','logLevel','stdout','info','1852776XSfMns','type','\x27\x20updated','log','error','logger','14747BgnMQj','\x20or\x20later.','--transport','close','already\x20exists','127.0.0.1','INTERNAL','port','getCurrent','llm','workflow-skills','td-docs','Claude\x20Code\x20version\x20','tdx-managed-proxy','trim','\x20already\x20configured','22hRQrPt','ANTHROPIC_BASE_URL','site','red','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Executing:\x20claude\x20','ANTHROPIC_MODEL','object','CLAUDE_CODE_UNSUPPORTED_VERSION','execute','install','sonnet','warn','major','✓\x20Marketplace\x20\x27','TD\x20Docs\x20MCP\x20Server','code','5351454WEyqIY','sql-skills','toString','green','inherit','5202YWacoc','claude','init','Setting\x20up\x20project...','cause','hostname','\x27\x20configured','td-skills\x20Plugins','exit','CLAUDE_CODE_NOT_FOUND','settings.local.json','start','✓\x20Logs\x20saved\x20to\x20','stringify','tdx\x20--profile\x20','includes','fail','Setup\x20failed','patch','utf-8','\x20configuration\x20failed','Failed\x20to\x20install\x20plugin\x20\x27','statusline','tdx-skills','model','Configuring\x20MCP\x20server\x20\x27','marketplace','account_id','--version','already\x20installed','Finding\x20available\x20port...','Failed\x20to\x20configure\x20marketplace\x20\x27','INSTALLATION_FAILED','pipe','statusLine','Configuring\x20marketplace\x20\x27','Updating\x20marketplace\x20\x27','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','minor','✓\x20Settings\x20restored:\x20.claude/settings.local.json','td-skills','https://github.com/treasure-data/td-skills','http://127.0.0.1:','Command\x20failed\x20(exit\x20','Command\x20output:\x20','plugin','continue','\x27...','Starting\x20TD\x20LLM\x20proxy\x20server...','originalSettings','debug','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','getOrCreateDefaultProject','Claude\x20Code\x20CLI\x20not\x20found','command','message','proxy','Warning:\x20Failed\x20to\x20configure\x20','ENOENT','stop','tdx','description','name','✓\x20Settings\x20configured:\x20.claude/settings.local.json','unshift','4216tgbnjT','add','2147622ruGqkW','user','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','\x20meets\x20minimum\x20requirement','mcp','string','data','server','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','ANTHROPIC_AUTH_TOKEN','findClaudePath','Initializing\x20proxy\x20logger...','Failed\x20to\x20update\x20marketplace\x20\x27'];a8_0x2aa6=function(){return _0x5d5758;};return a8_0x2aa6();}async function createClaudeSettings(_0x405d91,_0x2ddbde=a8_0x288b8b(0x175),_0x201e6b){const _0x31b8b1=a8_0x288b8b,_0x40e229=join(process[_0x31b8b1(0x141)](),_0x31b8b1(0x142)),_0x5582d2=join(_0x40e229,_0x31b8b1(0x18a));await mkdir(_0x40e229,{'recursive':!![]});let _0x5d3475={};if(existsSync(_0x5582d2))try{const _0x52bf1e=await readFile(_0x5582d2,_0x31b8b1(0x193));_0x5d3475=JSON['parse'](_0x52bf1e);}catch{_0x5d3475={};}const _0x58756e=_0x5d3475[_0x31b8b1(0x14d)]||{},_0x32a985={'ANTHROPIC_BASE_URL':_0x58756e[_0x31b8b1(0x16b)],'ANTHROPIC_MODEL':_0x58756e[_0x31b8b1(0x170)],'ANTHROPIC_AUTH_TOKEN':_0x58756e[_0x31b8b1(0x1cc)],'statusLine':_0x5d3475['statusLine']},_0xcbade4={..._0x5d3475,'env':{..._0x58756e,'ANTHROPIC_BASE_URL':_0x31b8b1(0x1aa)+_0x405d91,'ANTHROPIC_MODEL':_0x2ddbde,'ANTHROPIC_AUTH_TOKEN':_0x31b8b1(0x167)},'statusLine':{'type':'command','command':_0x201e6b?_0x31b8b1(0x18e)+_0x201e6b+'\x20claude\x20statusline':_0x31b8b1(0x13f)}};return await writeFile(_0x5582d2,JSON[_0x31b8b1(0x18d)](_0xcbade4,null,0x2)+'\x0a'),_0x32a985;}async function restoreClaudeSettings(_0x2db8d2){const _0x5e2a27=a8_0x288b8b,_0x2a7ed2=join(process[_0x5e2a27(0x141)](),_0x5e2a27(0x142)),_0x35dec7=join(_0x2a7ed2,_0x5e2a27(0x18a));if(!existsSync(_0x35dec7))return;try{const _0x3b1d59=await readFile(_0x35dec7,'utf-8'),_0x108944=JSON[_0x5e2a27(0x147)](_0x3b1d59),_0x55efeb=_0x108944[_0x5e2a27(0x14d)]||{},_0x5dc40a=_0x55efeb[_0x5e2a27(0x16b)],_0x517bf3=((()=>{const _0x500a88=_0x5e2a27;if(typeof _0x5dc40a!==_0x500a88(0x1c8))return![];try{const _0x1a33a4=new URL(_0x5dc40a);return _0x1a33a4['hostname']===_0x500a88(0x145)||_0x1a33a4[_0x500a88(0x185)]===_0x500a88(0x15f);}catch{return![];}})());_0x517bf3?(delete _0x55efeb['ANTHROPIC_BASE_URL'],delete _0x55efeb[_0x5e2a27(0x170)],delete _0x55efeb[_0x5e2a27(0x1cc)]):(_0x2db8d2['ANTHROPIC_BASE_URL']!==undefined?_0x55efeb['ANTHROPIC_BASE_URL']=_0x2db8d2[_0x5e2a27(0x16b)]:delete _0x55efeb[_0x5e2a27(0x16b)],_0x2db8d2[_0x5e2a27(0x170)]!==undefined?_0x55efeb[_0x5e2a27(0x170)]=_0x2db8d2[_0x5e2a27(0x170)]:delete _0x55efeb[_0x5e2a27(0x170)],_0x2db8d2[_0x5e2a27(0x1cc)]!==undefined?_0x55efeb[_0x5e2a27(0x1cc)]=_0x2db8d2['ANTHROPIC_AUTH_TOKEN']:delete _0x55efeb[_0x5e2a27(0x1cc)]);const _0x3e340b=_0x108944[_0x5e2a27(0x1a2)],_0x528447=((()=>{const _0x5c1706=_0x5e2a27;if(!_0x3e340b||typeof _0x3e340b!==_0x5c1706(0x171))return![];if(_0x3e340b[_0x5c1706(0x155)]!==_0x5c1706(0x1b6))return![];if(typeof _0x3e340b[_0x5c1706(0x1b6)]!=='string')return![];return _0x3e340b['command']['includes'](_0x5c1706(0x1bc))&&_0x3e340b[_0x5c1706(0x1b6)][_0x5c1706(0x18f)](_0x5c1706(0x196));})());if(_0x528447)delete _0x108944[_0x5e2a27(0x1a2)];else _0x2db8d2[_0x5e2a27(0x1a2)]!==undefined?_0x108944[_0x5e2a27(0x1a2)]=_0x2db8d2[_0x5e2a27(0x1a2)]:delete _0x108944[_0x5e2a27(0x1a2)];_0x108944['env']=_0x55efeb,await writeFile(_0x35dec7,JSON['stringify'](_0x108944,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a8_0x288b8b(0x1be)]=a8_0x288b8b(0x181);[a8_0x288b8b(0x1bd)]=a8_0x288b8b(0x13a);[a8_0x288b8b(0x1ca)];[a8_0x288b8b(0x1b1)];[a8_0x288b8b(0x159)];[a8_0x288b8b(0x161)];async[a8_0x288b8b(0x173)](_0x3cff46){const _0x4b1271=a8_0x288b8b,{tdx:_0x2e2c78,options:_0x3e526b,args:_0x524c3a}=_0x3cff46;try{const _0x17046d=_0x3e526b,_0x55bfcf=_0x17046d[_0x4b1271(0x198)]||_0x4b1271(0x175),_0xe7b938=_0x17046d[_0x4b1271(0x1b8)]===![],_0x52d107=_0x17046d[_0x4b1271(0x1ae)]===!![],_0x2cf5fc=_0x17046d[_0x4b1271(0x135)]===!![],_0x536e0e=[..._0x524c3a];if(_0x52d107)_0x536e0e[_0x4b1271(0x1c0)]('-c');else _0x2cf5fc&&_0x536e0e['unshift']('-r');const _0x78d954=createCommandSpinner('Initializing...',{'verbose':_0x3e526b['verbose']});_0x78d954[_0x4b1271(0x18b)]();try{if(!_0xe7b938){_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x19e),this['port']=await findAvailablePort(0xfa0),_0x78d954[_0x4b1271(0x134)]='✓\x20Port\x20'+this[_0x4b1271(0x161)],_0x78d954['text']=_0x4b1271(0x183);const _0x1883d5=await _0x2e2c78[_0x4b1271(0x163)][_0x4b1271(0x1b4)](),_0x832320=_0x1883d5['id'];_0x78d954[_0x4b1271(0x134)]='✓\x20Using\x20project:\x20'+_0x1883d5[_0x4b1271(0x14c)][_0x4b1271(0x1be)];const _0x3795c8=_0x3e526b['profile'];try{const _0x10e6d9=await _0x2e2c78[_0x4b1271(0x1c4)][_0x4b1271(0x162)]();_0x10e6d9[_0x4b1271(0x19b)]&&writeCachedAccountInfo(_0x3e526b[_0x4b1271(0x16c)],_0x10e6d9[_0x4b1271(0x19b)],_0x3795c8);}catch{}_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x1ce),this['logger']=new TDXLogger(_0x3e526b[_0x4b1271(0x151)],!![]),await this[_0x4b1271(0x159)][_0x4b1271(0x182)]();const _0x4b9d72=this['logger']['getLogPath']();_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x14b)+_0x4b9d72,_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x1b0),this[_0x4b1271(0x1ca)]=new ProxyServer({'port':this['port'],'projectId':_0x832320,'tdx':_0x2e2c78,'logger':this[_0x4b1271(0x159)],'site':_0x3e526b[_0x4b1271(0x16c)]}),await this[_0x4b1271(0x1ca)][_0x4b1271(0x18b)](),_0x78d954[_0x4b1271(0x134)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+this['port'],_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x14a),this[_0x4b1271(0x1b1)]=await createClaudeSettings(this[_0x4b1271(0x161)],_0x55bfcf,_0x3795c8),_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x1bf);}else _0x78d954[_0x4b1271(0x134)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x136),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x4b1271(0x159)]),_0x78d954[_0x4b1271(0x134)]=_0x4b1271(0x138);}catch(_0x404066){_0x78d954['fail']('Claude\x20Code\x20version\x20check\x20failed');throw _0x404066;}try{await ensureMcpServer(_0x4b1271(0x165),'https://docs.treasuredata.com/mcp','http',_0x78d954,this[_0x4b1271(0x159)]);}catch(_0x278a23){handleInstallationError(_0x278a23,_0x4b1271(0x179),_0x78d954,this[_0x4b1271(0x159)]);}try{await ensureMarketplace(_0x4b1271(0x1a8),_0x4b1271(0x1a9),_0x78d954,this[_0x4b1271(0x159)]),await updateMarketplace(_0x4b1271(0x1a8),_0x78d954,this[_0x4b1271(0x159)]),await ensurePlugin(_0x4b1271(0x17c),_0x4b1271(0x1a8),_0x78d954,this[_0x4b1271(0x159)]),await ensurePlugin(_0x4b1271(0x164),'td-skills',_0x78d954,this[_0x4b1271(0x159)]),await ensurePlugin(_0x4b1271(0x197),_0x4b1271(0x1a8),_0x78d954,this[_0x4b1271(0x159)]);}catch(_0x1bbeca){handleInstallationError(_0x1bbeca,_0x4b1271(0x187),_0x78d954,this[_0x4b1271(0x159)]);}_0x78d954['stop']();}catch(_0x5a886d){_0x78d954[_0x4b1271(0x190)](_0x4b1271(0x191));throw _0x5a886d;}const _0xa64bfe=await this[_0x4b1271(0x1cd)]();if(!_0xa64bfe)throw new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0x4b1271(0x1c5)});const _0x128f19={...process['env']};!_0xe7b938&&(_0x128f19[_0x4b1271(0x16b)]=_0x4b1271(0x1aa)+this[_0x4b1271(0x161)],_0x128f19['ANTHROPIC_MODEL']=_0x55bfcf,_0x128f19[_0x4b1271(0x1cc)]=_0x4b1271(0x167));const _0x2f1560=spawn(_0xa64bfe,_0x536e0e,{'stdio':_0x4b1271(0x17f),'env':_0x128f19}),_0x6d119d=await new Promise(_0x3ec6f5=>{const _0x385a7c=_0x4b1271;_0x2f1560['on'](_0x385a7c(0x188),_0x5f4eeb=>{_0x3ec6f5(_0x5f4eeb||0x0);}),_0x2f1560['on'](_0x385a7c(0x158),_0x10342d=>{const _0x498d1c=_0x385a7c;console[_0x498d1c(0x158)](a8_0x278a84[_0x498d1c(0x16d)]('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x10342d[_0x498d1c(0x1b7)])),_0x3ec6f5(0x1);});});this[_0x4b1271(0x1ca)]&&(await this[_0x4b1271(0x1ca)][_0x4b1271(0x1bb)](),console[_0x4b1271(0x157)](a8_0x278a84[_0x4b1271(0x17e)](_0x4b1271(0x150))));if(this[_0x4b1271(0x159)]){await this[_0x4b1271(0x159)]['close']();const _0xa75cc4=this[_0x4b1271(0x159)][_0x4b1271(0x143)]();console['log'](a8_0x278a84[_0x4b1271(0x17e)](_0x4b1271(0x18c)+_0xa75cc4));}return this[_0x4b1271(0x1b1)]&&(await restoreClaudeSettings(this['originalSettings']),console[_0x4b1271(0x157)](a8_0x278a84[_0x4b1271(0x17e)](_0x4b1271(0x1a7)))),_0x6d119d;}catch(_0x57797b){this['server']&&await this['server'][_0x4b1271(0x1bb)]();this['logger']&&await this['logger'][_0x4b1271(0x15d)]();this[_0x4b1271(0x1b1)]&&await restoreClaudeSettings(this['originalSettings']);throw _0x57797b;}}async['findClaudePath'](){return new Promise(_0x223035=>{const _0x37a8ee=a8_0x1d94,_0x12de1c=spawn('which',[_0x37a8ee(0x181)]);let _0x61c98='';_0x12de1c[_0x37a8ee(0x152)]['on'](_0x37a8ee(0x1c9),_0x13d8ad=>{_0x61c98+=_0x13d8ad['toString']();}),_0x12de1c['on']('exit',_0x28ad5d=>{const _0x125446=_0x37a8ee;_0x28ad5d===0x0&&_0x61c98['trim']()?_0x223035(_0x61c98[_0x125446(0x168)]()):_0x223035(null);});});}}
|
|
1
|
+
const a8_0x2c44a1=a8_0x4ba4;(function(_0x19c942,_0x51bfa2){const _0x58ae9e=a8_0x4ba4,_0x2f88d6=_0x19c942();while(!![]){try{const _0x555a19=parseInt(_0x58ae9e(0x164))/0x1+parseInt(_0x58ae9e(0x111))/0x2*(-parseInt(_0x58ae9e(0x126))/0x3)+parseInt(_0x58ae9e(0x120))/0x4*(-parseInt(_0x58ae9e(0x128))/0x5)+-parseInt(_0x58ae9e(0x108))/0x6*(-parseInt(_0x58ae9e(0x11a))/0x7)+-parseInt(_0x58ae9e(0x12a))/0x8*(-parseInt(_0x58ae9e(0x176))/0x9)+-parseInt(_0x58ae9e(0xfe))/0xa*(parseInt(_0x58ae9e(0xee))/0xb)+parseInt(_0x58ae9e(0x142))/0xc;if(_0x555a19===_0x51bfa2)break;else _0x2f88d6['push'](_0x2f88d6['shift']());}catch(_0x499468){_0x2f88d6['push'](_0x2f88d6['shift']());}}}(a8_0x4ec8,0xc6347));import{spawn}from'node:child_process';function a8_0x4ba4(_0x107637,_0x483084){_0x107637=_0x107637-0xdf;const _0x4ec8f0=a8_0x4ec8();let _0x4ba474=_0x4ec8f0[_0x107637];return _0x4ba474;}import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a8_0x493afd from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a8_0x2c44a1(0x161);function handleInstallationError(_0x525351,_0x221061,_0x31e54f,_0x408591){const _0x21497d=a8_0x2c44a1;errorContains(_0x525351,_0x21497d(0x166),_0x21497d(0x137),_0x21497d(0x130))?(_0x31e54f[_0x21497d(0x174)]='✓\x20'+_0x221061+_0x21497d(0x11e),_0x408591?.[_0x21497d(0x132)](_0x221061+_0x21497d(0x11e)),_0x525351 instanceof SDKError&&_0x525351[_0x21497d(0x103)]&&_0x408591?.[_0x21497d(0x15f)]('Command\x20output:\x20'+_0x525351[_0x21497d(0x103)][_0x21497d(0x122)])):(_0x31e54f['warn'](_0x21497d(0x127)+_0x221061),_0x408591?.[_0x21497d(0x145)](_0x221061+_0x21497d(0x163),_0x525351));}export function parseVersion(_0x431b9e){const _0x4993d9=a8_0x2c44a1,_0x31ea56=_0x431b9e[_0x4993d9(0xfd)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x31ea56)return null;return{'major':parseInt(_0x31ea56[0x1],0xa),'minor':parseInt(_0x31ea56[0x2],0xa),'patch':parseInt(_0x31ea56[0x3],0xa)};}export function compareVersions(_0x8ecb8d,_0x5391f1){const _0x38eece=a8_0x2c44a1;if(_0x8ecb8d[_0x38eece(0x11d)]!==_0x5391f1[_0x38eece(0x11d)])return _0x8ecb8d[_0x38eece(0x11d)]-_0x5391f1[_0x38eece(0x11d)];if(_0x8ecb8d['minor']!==_0x5391f1[_0x38eece(0x172)])return _0x8ecb8d[_0x38eece(0x172)]-_0x5391f1[_0x38eece(0x172)];return _0x8ecb8d[_0x38eece(0x16c)]-_0x5391f1[_0x38eece(0x16c)];}async function checkClaudeVersion(_0x485a4,_0x529bd4){const _0x33aa8e=a8_0x2c44a1;_0x529bd4?.[_0x33aa8e(0x15f)](_0x33aa8e(0x104)+_0x485a4+')');const _0x3b77f4=await executeClaudeCommand([_0x33aa8e(0xe3)],undefined,_0x529bd4),_0x432bb6=parseVersion(_0x3b77f4);if(!_0x432bb6){_0x529bd4?.['warn'](_0x33aa8e(0x159)+_0x3b77f4);return;}const _0x117ac9=_0x432bb6[_0x33aa8e(0x11d)]+'.'+_0x432bb6[_0x33aa8e(0x172)]+'.'+_0x432bb6[_0x33aa8e(0x16c)],_0x4a4f93=parseVersion(_0x485a4);if(!_0x4a4f93){_0x529bd4?.[_0x33aa8e(0x150)](_0x33aa8e(0x13a)+_0x485a4);return;}if(compareVersions(_0x432bb6,_0x4a4f93)<0x0){_0x529bd4?.['error'](_0x33aa8e(0x165)+_0x117ac9+_0x33aa8e(0x140)+_0x485a4+')');throw new SDKError(ErrorCode[_0x33aa8e(0x168)],_0x33aa8e(0x165)+_0x117ac9+_0x33aa8e(0x113)+_0x485a4+_0x33aa8e(0x14f),undefined,{'helpText':'Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code'});}_0x529bd4?.[_0x33aa8e(0x15f)]('Claude\x20Code\x20version\x20'+_0x117ac9+'\x20meets\x20minimum\x20requirement');}function a8_0x4ec8(){const _0x31d490=['Warning:\x20Failed\x20to\x20configure\x20','15sGqGPo','originalSettings','186568WpgyHw','✓\x20Marketplace\x20\x27','Creating\x20.claude/settings.local.json...','verbose','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','td-skills','already\x20configured','execute','info','server','settings.local.json','data','includes','already\x20installed','utf-8','inherit','Invalid\x20minimum\x20version\x20format:\x20','workflow-skills','parse','logLevel','\x27...','\x27\x20updated','\x20is\x20too\x20old\x20(minimum:\x20','user','13710756xAVQcE','join','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','error','resume','profile','Updating\x20marketplace\x20\x27','proxy','✓\x20Port\x20','ANTHROPIC_AUTH_TOKEN','Starting\x20TD\x20LLM\x20proxy\x20server...','start','Configuring\x20MCP\x20server\x20\x27','\x20or\x20later.','warn','close','✓\x20Settings\x20restored:\x20.claude/settings.local.json','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','cwd','stdout','Failed\x20to\x20launch\x20Claude\x20Code:\x20','init','account_id','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','Failed\x20to\x20spawn\x20claude\x20command:\x20','plugin','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','name','sonnet','debug','continue','2.0.20','string','\x20configuration\x20failed','51900NLLUkc','Claude\x20Code\x20version\x20','already\x20exists','\x27\x20configured','CLAUDE_CODE_UNSUPPORTED_VERSION','ANTHROPIC_BASE_URL','log','INSTALLATION_FAILED','patch','tdx','getCurrent','findClaudePath','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','Failed\x20to\x20update\x20marketplace\x20\x27','minor','logger','text','http://127.0.0.1:','72JHHzhB','fail','✓\x20Settings\x20configured:\x20.claude/settings.local.json','\x27\x20installed','✓\x20Logging\x20to\x20','code','--version','CLAUDE_CODE_NOT_FOUND','red','td-skills\x20Plugins','env','Initializing\x20proxy\x20logger...','statusline','stderr','which','statusLine','tdx-managed-proxy','1008502VNEHqt','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','marketplace','stringify','localhost','attributes','mcp','Claude\x20Code\x20CLI\x20not\x20found','Checking\x20Claude\x20Code\x20version...','sql-skills','port','Setting\x20up\x20project...','.claude','description','hostname','trim','20VzKQgE','Command\x20spawn\x20error:\x20','127.0.0.1','getLogPath','Executing:\x20claude\x20','cause','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','Claude\x20Code\x20version\x20check\x20failed','Command\x20failed\x20(exit\x20','llm','7910202FrgytX','Finding\x20available\x20port...','site','type','✓\x20Claude\x20Code\x20version\x20OK','claude','object','td-docs','green','2rmUGWm','exit','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','add','Setup\x20failed','stop','unshift','tdx-skills','ANTHROPIC_MODEL','7LqyafP','Configuring\x20marketplace\x20\x27','getOrCreateDefaultProject','major','\x20already\x20configured','Failed\x20to\x20install\x20plugin\x20\x27','535840LQpPJi','toString','message','install','pipe','command','3906921VcbGpq'];a8_0x4ec8=function(){return _0x31d490;};return a8_0x4ec8();}async function executeClaudeCommand(_0x10fffa,_0x4e6c7b,_0x2653ef){const _0x4cec35=a8_0x2c44a1;return _0x2653ef?.['info'](_0x4cec35(0x102)+_0x10fffa[_0x4cec35(0x143)]('\x20')),new Promise((_0x1e4208,_0x3e6e07)=>{const _0x298a7a=_0x4cec35,_0x4e956c=spawn('claude',_0x10fffa,{'stdio':_0x298a7a(0x124)});let _0xc254cb='',_0xa0feeb='';_0x4e956c[_0x298a7a(0x155)]['on'](_0x298a7a(0x135),_0x230444=>{const _0x35abdc=_0x298a7a;_0xc254cb+=_0x230444[_0x35abdc(0x121)]();}),_0x4e956c[_0x298a7a(0xea)]['on'](_0x298a7a(0x135),_0x4a4040=>{const _0x370905=_0x298a7a;_0xa0feeb+=_0x4a4040[_0x370905(0x121)]();}),_0x4e956c['on'](_0x298a7a(0x145),_0x40983a=>{const _0x57fe3d=_0x298a7a;_0x40983a[_0x57fe3d(0xe2)]==='ENOENT'?(_0x2653ef?.[_0x57fe3d(0x145)](_0x57fe3d(0xf5)),_0x3e6e07(new SDKError(ErrorCode[_0x57fe3d(0xe4)],_0x57fe3d(0xf5),_0x40983a,{'helpText':_0x57fe3d(0x170)}))):(_0x2653ef?.[_0x57fe3d(0x145)](_0x57fe3d(0xff)+_0x40983a[_0x57fe3d(0x122)]),_0x3e6e07(new SDKError(ErrorCode['INTERNAL'],_0x57fe3d(0x15a)+_0x40983a[_0x57fe3d(0x122)],_0x40983a)));}),_0x4e956c['on'](_0x298a7a(0x112),_0x27fa28=>{const _0x238da1=_0x298a7a;if(_0x27fa28===0x0)_0x1e4208(_0xc254cb);else _0x4e6c7b?(_0x2653ef?.[_0x238da1(0x145)](_0x238da1(0x106)+_0x27fa28+'):\x20claude\x20'+_0x10fffa['join']('\x20')),_0x3e6e07(new SDKError(ErrorCode[_0x238da1(0x16b)],_0x4e6c7b,new Error(_0xa0feeb)))):_0x1e4208('');});});}async function ensureMcpServer(_0x9d750b,_0x1b12c1,_0x1fb972,_0xaefc25,_0x357743){const _0x3b2c51=a8_0x2c44a1;_0xaefc25['text']=_0x3b2c51(0x14e)+_0x9d750b+_0x3b2c51(0x13e),await executeClaudeCommand([_0x3b2c51(0xf4),_0x3b2c51(0x114),_0x9d750b,_0x1b12c1,'--transport',_0x1fb972],_0x3b2c51(0xef)+_0x9d750b+'\x27',_0x357743),_0xaefc25[_0x3b2c51(0x174)]='✓\x20MCP\x20server\x20\x27'+_0x9d750b+'\x27\x20configured';}async function ensureMarketplace(_0x29095b,_0x343b1c,_0x474468,_0x22f702){const _0x3c1c76=a8_0x2c44a1;_0x474468['text']=_0x3c1c76(0x11b)+_0x29095b+'\x27...',await executeClaudeCommand(['plugin',_0x3c1c76(0xf0),_0x3c1c76(0x114),_0x343b1c],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x29095b+'\x27',_0x22f702),_0x474468[_0x3c1c76(0x174)]=_0x3c1c76(0x12b)+_0x29095b+_0x3c1c76(0x167);}async function updateMarketplace(_0x3b9df0,_0x4fa626,_0x358dd0){const _0xc88a3d=a8_0x2c44a1;_0x4fa626[_0xc88a3d(0x174)]=_0xc88a3d(0x148)+_0x3b9df0+_0xc88a3d(0x13e),await executeClaudeCommand([_0xc88a3d(0x15b),_0xc88a3d(0xf0),'update'],_0xc88a3d(0x171)+_0x3b9df0+'\x27',_0x358dd0),_0x4fa626[_0xc88a3d(0x174)]=_0xc88a3d(0x12b)+_0x3b9df0+_0xc88a3d(0x13f);}async function ensurePlugin(_0x33a1eb,_0x37d2d8,_0x3e7e90,_0x2aa6a2){const _0x3d80e2=a8_0x2c44a1;_0x3e7e90['text']='Installing\x20plugin\x20\x27'+_0x33a1eb+_0x3d80e2(0x13e),await executeClaudeCommand([_0x3d80e2(0x15b),_0x3d80e2(0x123),_0x33a1eb+'@'+_0x37d2d8],_0x3d80e2(0x11f)+_0x33a1eb+'\x27',_0x2aa6a2),_0x3e7e90[_0x3d80e2(0x174)]='✓\x20Plugin\x20\x27'+_0x33a1eb+_0x3d80e2(0xe0);}async function createClaudeSettings(_0x357820,_0x1c701a=a8_0x2c44a1(0x15e),_0x418639){const _0x1b9fca=a8_0x2c44a1,_0x8c5a73=join(process['cwd'](),_0x1b9fca(0xfa)),_0x244e7e=join(_0x8c5a73,_0x1b9fca(0x134));await mkdir(_0x8c5a73,{'recursive':!![]});let _0x66a4da={};if(existsSync(_0x244e7e))try{const _0x14ed02=await readFile(_0x244e7e,_0x1b9fca(0x138));_0x66a4da=JSON[_0x1b9fca(0x13c)](_0x14ed02);}catch{_0x66a4da={};}const _0x207fbf=_0x66a4da[_0x1b9fca(0xe7)]||{},_0x4f58a4={'ANTHROPIC_BASE_URL':_0x207fbf['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x207fbf[_0x1b9fca(0x119)],'ANTHROPIC_AUTH_TOKEN':_0x207fbf[_0x1b9fca(0x14b)],'statusLine':_0x66a4da[_0x1b9fca(0xec)]},_0x2e72d3={..._0x66a4da,'env':{..._0x207fbf,'ANTHROPIC_BASE_URL':_0x1b9fca(0x175)+_0x357820,'ANTHROPIC_MODEL':_0x1c701a,'ANTHROPIC_AUTH_TOKEN':'tdx-managed-proxy'},'statusLine':{'type':_0x1b9fca(0x125),'command':_0x418639?'tdx\x20--profile\x20'+_0x418639+'\x20claude\x20statusline':'tdx\x20claude\x20statusline'}};return await writeFile(_0x244e7e,JSON['stringify'](_0x2e72d3,null,0x2)+'\x0a'),_0x4f58a4;}async function restoreClaudeSettings(_0x29f12e){const _0x50c918=a8_0x2c44a1,_0x73e9d8=join(process[_0x50c918(0x154)](),_0x50c918(0xfa)),_0x599483=join(_0x73e9d8,_0x50c918(0x134));if(!existsSync(_0x599483))return;try{const _0x4668aa=await readFile(_0x599483,_0x50c918(0x138)),_0x2361d2=JSON[_0x50c918(0x13c)](_0x4668aa),_0x5cb4be=_0x2361d2[_0x50c918(0xe7)]||{},_0x58f109=_0x5cb4be['ANTHROPIC_BASE_URL'],_0x4b99f9=((()=>{const _0x94226b=_0x50c918;if(typeof _0x58f109!==_0x94226b(0x162))return![];try{const _0x4db4ca=new URL(_0x58f109);return _0x4db4ca[_0x94226b(0xfc)]===_0x94226b(0xf2)||_0x4db4ca[_0x94226b(0xfc)]===_0x94226b(0x100);}catch{return![];}})());_0x4b99f9?(delete _0x5cb4be['ANTHROPIC_BASE_URL'],delete _0x5cb4be[_0x50c918(0x119)],delete _0x5cb4be[_0x50c918(0x14b)]):(_0x29f12e[_0x50c918(0x169)]!==undefined?_0x5cb4be[_0x50c918(0x169)]=_0x29f12e[_0x50c918(0x169)]:delete _0x5cb4be[_0x50c918(0x169)],_0x29f12e[_0x50c918(0x119)]!==undefined?_0x5cb4be[_0x50c918(0x119)]=_0x29f12e[_0x50c918(0x119)]:delete _0x5cb4be['ANTHROPIC_MODEL'],_0x29f12e['ANTHROPIC_AUTH_TOKEN']!==undefined?_0x5cb4be[_0x50c918(0x14b)]=_0x29f12e[_0x50c918(0x14b)]:delete _0x5cb4be[_0x50c918(0x14b)]);const _0x3db0f2=_0x2361d2[_0x50c918(0xec)],_0x5d0708=((()=>{const _0x3a21e2=_0x50c918;if(!_0x3db0f2||typeof _0x3db0f2!==_0x3a21e2(0x10e))return![];if(_0x3db0f2[_0x3a21e2(0x10b)]!=='command')return![];if(typeof _0x3db0f2[_0x3a21e2(0x125)]!==_0x3a21e2(0x162))return![];return _0x3db0f2['command']['includes'](_0x3a21e2(0x16d))&&_0x3db0f2[_0x3a21e2(0x125)][_0x3a21e2(0x136)](_0x3a21e2(0xe9));})());if(_0x5d0708)delete _0x2361d2[_0x50c918(0xec)];else _0x29f12e[_0x50c918(0xec)]!==undefined?_0x2361d2[_0x50c918(0xec)]=_0x29f12e['statusLine']:delete _0x2361d2['statusLine'];_0x2361d2[_0x50c918(0xe7)]=_0x5cb4be,await writeFile(_0x599483,JSON[_0x50c918(0xf1)](_0x2361d2,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a8_0x2c44a1(0x15d)]=a8_0x2c44a1(0x10d);[a8_0x2c44a1(0xfb)]=a8_0x2c44a1(0x12e);[a8_0x2c44a1(0x133)];[a8_0x2c44a1(0x129)];[a8_0x2c44a1(0x173)];[a8_0x2c44a1(0xf8)];async[a8_0x2c44a1(0x131)](_0x1af747){const _0x1700c2=a8_0x2c44a1,{tdx:_0x3c61a3,options:_0x308e30,args:_0x17d44a}=_0x1af747;try{const _0x3a3c92=_0x308e30,_0x4a74a1=_0x3a3c92['model']||_0x1700c2(0x15e),_0x390f94=_0x3a3c92[_0x1700c2(0x149)]===![],_0x53fec5=_0x3a3c92[_0x1700c2(0x160)]===!![],_0x18d900=_0x3a3c92[_0x1700c2(0x146)]===!![],_0x35a1c7=[..._0x17d44a];if(_0x53fec5)_0x35a1c7[_0x1700c2(0x117)]('-c');else _0x18d900&&_0x35a1c7['unshift']('-r');const _0x2e0f49=createCommandSpinner('Initializing...',{'verbose':_0x308e30[_0x1700c2(0x12d)]});_0x2e0f49['start']();try{if(!_0x390f94){_0x2e0f49['text']=_0x1700c2(0x109),this['port']=await findAvailablePort(0xfa0),_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0x14a)+this['port'],_0x2e0f49['text']=_0x1700c2(0xf9);const _0x476303=await _0x3c61a3[_0x1700c2(0x107)][_0x1700c2(0x11c)](),_0x516423=_0x476303['id'];_0x2e0f49['text']='✓\x20Using\x20project:\x20'+_0x476303[_0x1700c2(0xf3)][_0x1700c2(0x15d)];const _0x3e0020=_0x308e30[_0x1700c2(0x147)];try{const _0x5036ea=await _0x3c61a3[_0x1700c2(0x141)][_0x1700c2(0x16e)]();_0x5036ea[_0x1700c2(0x158)]&&writeCachedAccountInfo(_0x308e30[_0x1700c2(0x10a)],_0x5036ea['account_id'],_0x3e0020);}catch{}_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0xe8),this[_0x1700c2(0x173)]=new TDXLogger(_0x308e30[_0x1700c2(0x13d)],!![]),await this[_0x1700c2(0x173)][_0x1700c2(0x157)]();const _0x24bdc9=this[_0x1700c2(0x173)]['getLogPath']();_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0xe1)+_0x24bdc9,_0x2e0f49['text']=_0x1700c2(0x14c),this[_0x1700c2(0x133)]=new ProxyServer({'port':this['port'],'projectId':_0x516423,'tdx':_0x3c61a3,'logger':this['logger'],'site':_0x308e30[_0x1700c2(0x10a)]}),await this['server'][_0x1700c2(0x14d)](),_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0x153)+this[_0x1700c2(0xf8)],_0x2e0f49['text']=_0x1700c2(0x12c),this[_0x1700c2(0x129)]=await createClaudeSettings(this[_0x1700c2(0xf8)],_0x4a74a1,_0x3e0020),_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0xdf);}else _0x2e0f49['text']=_0x1700c2(0x144);try{_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0xf6),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x1700c2(0x173)]),_0x2e0f49[_0x1700c2(0x174)]=_0x1700c2(0x10c);}catch(_0xd8e7fc){_0x2e0f49[_0x1700c2(0x177)](_0x1700c2(0x105));throw _0xd8e7fc;}try{await ensureMcpServer(_0x1700c2(0x10f),'https://docs.treasuredata.com/mcp','http',_0x2e0f49,this[_0x1700c2(0x173)]);}catch(_0x54176b){handleInstallationError(_0x54176b,'TD\x20Docs\x20MCP\x20Server',_0x2e0f49,this[_0x1700c2(0x173)]);}try{await ensureMarketplace(_0x1700c2(0x12f),'https://github.com/treasure-data/td-skills',_0x2e0f49,this[_0x1700c2(0x173)]),await updateMarketplace(_0x1700c2(0x12f),_0x2e0f49,this[_0x1700c2(0x173)]),await ensurePlugin(_0x1700c2(0xf7),'td-skills',_0x2e0f49,this[_0x1700c2(0x173)]),await ensurePlugin(_0x1700c2(0x13b),_0x1700c2(0x12f),_0x2e0f49,this[_0x1700c2(0x173)]),await ensurePlugin(_0x1700c2(0x118),_0x1700c2(0x12f),_0x2e0f49,this[_0x1700c2(0x173)]);}catch(_0x2f55f1){handleInstallationError(_0x2f55f1,_0x1700c2(0xe6),_0x2e0f49,this['logger']);}_0x2e0f49[_0x1700c2(0x116)]();}catch(_0x584aa4){_0x2e0f49[_0x1700c2(0x177)](_0x1700c2(0x115));throw _0x584aa4;}const _0x25a390=await this[_0x1700c2(0x16f)]();if(!_0x25a390)throw new SDKError(ErrorCode[_0x1700c2(0xe4)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0x1700c2(0x170)});const _0x323c03={...process[_0x1700c2(0xe7)]};!_0x390f94&&(_0x323c03[_0x1700c2(0x169)]='http://127.0.0.1:'+this[_0x1700c2(0xf8)],_0x323c03['ANTHROPIC_MODEL']=_0x4a74a1,_0x323c03[_0x1700c2(0x14b)]=_0x1700c2(0xed));const _0x49bb32=spawn(_0x25a390,_0x35a1c7,{'stdio':_0x1700c2(0x139),'env':_0x323c03}),_0x3f41bd=await new Promise(_0x2e0220=>{const _0x9ad76c=_0x1700c2;_0x49bb32['on'](_0x9ad76c(0x112),_0xe03782=>{_0x2e0220(_0xe03782||0x0);}),_0x49bb32['on']('error',_0x242ff8=>{const _0x4cce92=_0x9ad76c;console[_0x4cce92(0x145)](a8_0x493afd[_0x4cce92(0xe5)](_0x4cce92(0x156)+_0x242ff8[_0x4cce92(0x122)])),_0x2e0220(0x1);});});this[_0x1700c2(0x133)]&&(await this[_0x1700c2(0x133)][_0x1700c2(0x116)](),console[_0x1700c2(0x16a)](a8_0x493afd[_0x1700c2(0x110)](_0x1700c2(0x15c))));if(this['logger']){await this[_0x1700c2(0x173)][_0x1700c2(0x151)]();const _0xc6b837=this['logger'][_0x1700c2(0x101)]();console[_0x1700c2(0x16a)](a8_0x493afd[_0x1700c2(0x110)]('✓\x20Logs\x20saved\x20to\x20'+_0xc6b837));}return this[_0x1700c2(0x129)]&&(await restoreClaudeSettings(this[_0x1700c2(0x129)]),console[_0x1700c2(0x16a)](a8_0x493afd['green'](_0x1700c2(0x152)))),_0x3f41bd;}catch(_0x7bd168){this['server']&&await this['server'][_0x1700c2(0x116)]();this['logger']&&await this[_0x1700c2(0x173)]['close']();this[_0x1700c2(0x129)]&&await restoreClaudeSettings(this[_0x1700c2(0x129)]);throw _0x7bd168;}}async['findClaudePath'](){return new Promise(_0x237dd2=>{const _0x215069=a8_0x4ba4,_0x3ecc0b=spawn(_0x215069(0xeb),['claude']);let _0x1db51f='';_0x3ecc0b[_0x215069(0x155)]['on']('data',_0x476701=>{const _0x8cf387=_0x215069;_0x1db51f+=_0x476701[_0x8cf387(0x121)]();}),_0x3ecc0b['on']('exit',_0x1f9eb5=>{const _0x207f30=_0x215069;_0x1f9eb5===0x0&&_0x1db51f[_0x207f30(0xfd)]()?_0x237dd2(_0x1db51f[_0x207f30(0xfd)]()):_0x237dd2(null);});});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a9_0x464cfb=a9_0x3f3c;(function(_0x482887,_0x4abc11){const _0x2a6815=a9_0x3f3c,_0x56e3be=_0x482887();while(!![]){try{const _0x4b5d47=parseInt(_0x2a6815(0xfa))/0x1*(parseInt(_0x2a6815(0xe6))/0x2)+-parseInt(_0x2a6815(0xe7))/0x3*(-parseInt(_0x2a6815(0xda))/0x4)+-parseInt(_0x2a6815(0xdb))/0x5+-parseInt(_0x2a6815(0xe3))/0x6+-parseInt(_0x2a6815(0xf7))/0x7*(parseInt(_0x2a6815(0xe5))/0x8)+parseInt(_0x2a6815(0xf1))/0x9*(-parseInt(_0x2a6815(0xdf))/0xa)+parseInt(_0x2a6815(0xdc))/0xb;if(_0x4b5d47===_0x4abc11)break;else _0x56e3be['push'](_0x56e3be['shift']());}catch(_0x4de721){_0x56e3be['push'](_0x56e3be['shift']());}}}(a9_0x4ccb,0xdc74f));function a9_0x3f3c(_0x1649a3,_0x2f52f7){_0x1649a3=_0x1649a3-0xd3;const _0x4ccbad=a9_0x4ccb();let _0x3f3c61=_0x4ccbad[_0x1649a3];return _0x3f3c61;}import{createInterface}from'node:readline';function a9_0x4ccb(){const _0x517619=['🧠\x20','line','latestInputTokens','tdx\x20','\x20month','\x20-\x20','push','options','toFixed','3404520jaDXJn','session_id','join','log','monthCredits','profile','4886AYyhgp','tdx','\x20session\x20/\x20','58831ElYuMx','model','site','sessionCredits','close','name','\x20today\x20/\x20','parse','72FcjrBK','2500730KlppSD','20299609kUxeJy','💎\x20tdx\x20-\x20Claude','🪙\x20credit:\x20','30wFbLTk','💎\x20','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','statusline','8504676JvaNqm','Claude','7816xNaXdk','48ngaoRw','230001kkTNlO'];a9_0x4ccb=function(){return _0x517619;};return a9_0x4ccb();}import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x1a721c=0x64){return new Promise(_0x248b91=>{const _0x314676=a9_0x3f3c;let _0x2a97e5='',_0x3483f5=![];const _0x1859dc=createInterface({'input':process['stdin'],'terminal':![]}),_0x117aa3=_0x5ae87e=>{const _0x5fb822=a9_0x3f3c;if(_0x3483f5)return;_0x3483f5=!![],clearTimeout(_0x29bf41),_0x1859dc[_0x5fb822(0xd6)](),_0x248b91(_0x5ae87e);},_0x29bf41=setTimeout(()=>{_0x117aa3(null);},_0x1a721c);_0x1859dc['on'](_0x314676(0xe9),_0x5b2fca=>{_0x2a97e5+=_0x5b2fca;}),_0x1859dc['on'](_0x314676(0xd6),()=>{const _0x5e9388=_0x314676;if(_0x3483f5)return;try{const _0xe8ec98=JSON[_0x5e9388(0xd9)](_0x2a97e5);_0x117aa3(_0xe8ec98);}catch{_0x117aa3(null);}});});}function formatCredits(_0x45e44f){const _0x3dee6d=a9_0x3f3c;return _0x45e44f[_0x3dee6d(0xf0)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a9_0x464cfb(0xd7)]=a9_0x464cfb(0xe2);['description']=a9_0x464cfb(0xe1);async['execute'](_0x1dffd7){const _0x547ea8=a9_0x464cfb;try{const _0x4612fd=await readStdinJson();if(!_0x4612fd?.[_0x547ea8(0xf2)])return console[_0x547ea8(0xf4)](_0x547ea8(0xdd)),0x0;const _0x213314=_0x4612fd[_0x547ea8(0xf2)],_0x43ccc=_0x4612fd[_0x547ea8(0xd3)]?.['id']||'',_0x1aa2da=_0x4612fd[_0x547ea8(0xf6)]||_0x1dffd7[_0x547ea8(0xef)]['profile'],_0x1a643d=await getUsageStats(_0x213314,_0x1aa2da),_0x169514=[],_0xe9db72=readCachedAccountInfo(_0x1aa2da),_0x1f553d=_0xe9db72?_0x547ea8(0xeb)+_0xe9db72[_0x547ea8(0xd4)]+':'+_0xe9db72['accountId']:_0x547ea8(0xf8),_0x3fb8b4=_0x43ccc?getModelDisplayName(_0x43ccc):_0x547ea8(0xe4);_0x169514[_0x547ea8(0xee)](_0x547ea8(0xe0)+_0x1f553d+_0x547ea8(0xed)+_0x3fb8b4);const _0x74688=formatCredits(_0x1a643d[_0x547ea8(0xd5)]),_0x195ad6=formatCredits(_0x1a643d['todayCredits']),_0x1fc54c=formatCredits(_0x1a643d[_0x547ea8(0xf5)]);_0x169514['push'](_0x547ea8(0xde)+_0x74688+_0x547ea8(0xf9)+_0x195ad6+_0x547ea8(0xd8)+_0x1fc54c+_0x547ea8(0xec));if(_0x1a643d[_0x547ea8(0xea)]>0x0&&_0x43ccc){const _0x6544a9=formatTokenCount(_0x1a643d[_0x547ea8(0xea)]),_0x43d90b=calculateContextPercentage(_0x1a643d[_0x547ea8(0xea)],_0x43ccc);_0x169514[_0x547ea8(0xee)](_0x547ea8(0xe8)+_0x6544a9+'\x20('+_0x43d90b+'%)');}return console['log'](_0x169514[_0x547ea8(0xf3)]('\x20|\x20')),0x0;}catch{return console[_0x547ea8(0xf4)](_0x547ea8(0xdd)),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a10_0x452aac=a10_0x1e4a;(function(_0x12fa0f,_0x37df70){const _0xa03144=a10_0x1e4a,_0x3b5cef=_0x12fa0f();while(!![]){try{const _0x13dfa3=-parseInt(_0xa03144(0x169))/0x1+-parseInt(_0xa03144(0x166))/0x2*(parseInt(_0xa03144(0x16b))/0x3)+-parseInt(_0xa03144(0x16a))/0x4*(-parseInt(_0xa03144(0x195))/0x5)+parseInt(_0xa03144(0x194))/0x6+parseInt(_0xa03144(0x167))/0x7+parseInt(_0xa03144(0x19a))/0x8*(parseInt(_0xa03144(0x188))/0x9)+-parseInt(_0xa03144(0x170))/0xa;if(_0x13dfa3===_0x37df70)break;else _0x3b5cef['push'](_0x3b5cef['shift']());}catch(_0x3f6889){_0x3b5cef['push'](_0x3b5cef['shift']());}}}(a10_0x29b4,0xe9aa9));import a10_0x18caa8 from'chalk';function a10_0x1e4a(_0x979db1,_0x2d84ea){_0x979db1=_0x979db1-0x160;const _0x29b497=a10_0x29b4();let _0x1e4ad7=_0x29b497[_0x979db1];return _0x1e4ad7;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x41f660){return _0x41f660['toFixed'](0x2);}function a10_0x29b4(){const _0x52b43b=['lastUsedAt','cyan','en-US','red','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','numeric','toLocaleTimeString','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','outputStructured','length','9IxTMka','\x20\x20Today:\x20\x20\x20','never','monthCredits','Requests','padStart','Credits','dim','default','repeat','log','2-digit','7453020nNxxbs','4395zOtHmr','json','padEnd','getTime','entryCount','4866920SLIcve','totalCredits','bold','\x20credits','description','profile','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','1262392hlOdWt','9815372PgsXxs','Usage\x20by\x20Profile','639230iJCNVW','7804bQKWtO','3xBRwwc','max','Profile','usage','Unknown\x20error','27401370ZIDghu','\x20\x20Total:\x20\x20\x20','round','toLocaleDateString','todayCredits','short','\x20days\x20ago','today\x20','jsonl','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','execute','error','en-CA','(default)'];a10_0x29b4=function(){return _0x52b43b;};return a10_0x29b4();}function formatLastUsed(_0x525998){const _0xf466d6=a10_0x1e4a;if(!_0x525998)return _0xf466d6(0x18a);const _0x4efb9f=new Date(_0x525998),_0x1b4ce8=new Date(),_0x5b3025=_0x4efb9f[_0xf466d6(0x173)](_0xf466d6(0x17c)),_0x14a57d=_0x1b4ce8['toLocaleDateString']('en-CA');if(_0x5b3025===_0x14a57d)return _0xf466d6(0x177)+_0x4efb9f[_0xf466d6(0x184)](_0xf466d6(0x180),{'hour':'2-digit','minute':_0xf466d6(0x193)});const _0x5e2489=new Date(_0x5b3025),_0x8cea5a=new Date(_0x14a57d),_0x4c32ff=Math[_0xf466d6(0x172)]((_0x8cea5a[_0xf466d6(0x198)]()-_0x5e2489[_0xf466d6(0x198)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x4c32ff===0x1)return'yesterday';else return _0x4c32ff>0x1&&_0x4c32ff<0x7?_0x4c32ff+_0xf466d6(0x176):_0x4efb9f[_0xf466d6(0x173)]('en-US',{'month':_0xf466d6(0x175),'day':_0xf466d6(0x183)});}export class ClaudeUsageCommand extends BaseCommand{['name']=a10_0x452aac(0x16e);[a10_0x452aac(0x163)]=a10_0x452aac(0x179);async[a10_0x452aac(0x17a)](_0x3df6b0){const _0x346470=a10_0x452aac,{options:_0x6c6a0b}=_0x3df6b0,_0xa52d80=_0x6c6a0b['format']===_0x346470(0x196)||_0x6c6a0b['format']===_0x346470(0x178)||_0x6c6a0b['json'];try{const [_0x2ecb97,_0x41a246]=await Promise['all']([getAllProfileStats(),getUsageSummary()]);return _0xa52d80?await this['outputStructured'](_0x2ecb97,_0x41a246,_0x6c6a0b):this['outputTable'](_0x2ecb97,_0x41a246),0x0;}catch(_0x263501){const _0x8ca928=_0x263501 instanceof Error?_0x263501['message']:_0x346470(0x16f);return console[_0x346470(0x17b)](a10_0x18caa8[_0x346470(0x181)]('Error:\x20'+_0x8ca928)),0x1;}}async[a10_0x452aac(0x186)](_0x5e7ff8,_0x526543,_0x4d57a6){const _0x2bf265=a10_0x452aac,_0x212b7b={'summary':{'todayCredits':_0x526543[_0x2bf265(0x174)],'monthCredits':_0x526543[_0x2bf265(0x18b)],'totalCredits':_0x526543[_0x2bf265(0x160)],'profileCount':_0x526543['profileCount']},'profiles':_0x5e7ff8['map'](_0x2bb2d2=>({'profile':_0x2bb2d2['profile'],'credits':_0x2bb2d2['credits'],'requests':_0x2bb2d2['entryCount'],'lastUsedAt':_0x2bb2d2[_0x2bf265(0x17e)]}))};await handleSDKOutput([_0x212b7b],_0x4d57a6);}['outputTable'](_0x3327f9,_0x1e073b){const _0x2d4f75=a10_0x452aac;console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x161)]('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x18f)]('─'[_0x2d4f75(0x191)](0x32))),console[_0x2d4f75(0x192)](_0x2d4f75(0x189)+a10_0x18caa8[_0x2d4f75(0x17f)](formatCredits(_0x1e073b[_0x2d4f75(0x174)]))+_0x2d4f75(0x162)),console[_0x2d4f75(0x192)]('\x20\x20Month:\x20\x20\x20'+a10_0x18caa8[_0x2d4f75(0x17f)](formatCredits(_0x1e073b[_0x2d4f75(0x18b)]))+'\x20credits'),console[_0x2d4f75(0x192)](_0x2d4f75(0x171)+a10_0x18caa8[_0x2d4f75(0x17f)](formatCredits(_0x1e073b[_0x2d4f75(0x160)]))+_0x2d4f75(0x162)),console['log']();if(_0x3327f9[_0x2d4f75(0x187)]===0x0){console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x18f)](_0x2d4f75(0x165))),console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x18f)](_0x2d4f75(0x185)));return;}console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x161)](_0x2d4f75(0x168))),console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x18f)]('─'[_0x2d4f75(0x191)](0x3c)));const _0x3ede09=Math[_0x2d4f75(0x16c)](0xc,..._0x3327f9['map'](_0x390a33=>_0x390a33['profile']===_0x2d4f75(0x190)?_0x2d4f75(0x17d)['length']:_0x390a33[_0x2d4f75(0x164)][_0x2d4f75(0x187)])),_0x30eefa=0xa,_0x26c2fc=0xa;console[_0x2d4f75(0x192)]('\x20\x20'+_0x2d4f75(0x16d)['padEnd'](_0x3ede09)+'\x20\x20'+_0x2d4f75(0x18e)[_0x2d4f75(0x18d)](_0x30eefa)+'\x20\x20'+_0x2d4f75(0x18c)[_0x2d4f75(0x18d)](_0x26c2fc)+'\x20\x20'+'Last\x20Used');for(const _0x2f5891 of _0x3327f9){const _0x2bf414=_0x2f5891[_0x2d4f75(0x164)]===_0x2d4f75(0x190)?_0x2d4f75(0x17d):_0x2f5891[_0x2d4f75(0x164)],_0x41fd7a=_0x2bf414[_0x2d4f75(0x197)](_0x3ede09),_0x58c396=_0x2f5891[_0x2d4f75(0x164)]===_0x2d4f75(0x190)?a10_0x18caa8[_0x2d4f75(0x18f)](_0x41fd7a):_0x41fd7a;console[_0x2d4f75(0x192)]('\x20\x20'+_0x58c396+'\x20\x20'+a10_0x18caa8[_0x2d4f75(0x17f)](formatCredits(_0x2f5891['credits'])['padStart'](_0x30eefa))+'\x20\x20'+String(_0x2f5891[_0x2d4f75(0x199)])[_0x2d4f75(0x18d)](_0x26c2fc)+'\x20\x20'+a10_0x18caa8[_0x2d4f75(0x18f)](formatLastUsed(_0x2f5891['lastUsedAt'])));}console[_0x2d4f75(0x192)](),console[_0x2d4f75(0x192)](a10_0x18caa8[_0x2d4f75(0x18f)](_0x2d4f75(0x182))),console[_0x2d4f75(0x192)]();}}
|