@treasuredata/tdx 0.13.1 → 0.13.2
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.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/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.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +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-push-command.js.map +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.js +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.d.ts +19 -3
- package/dist/sdk/journey.d.ts.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/journey.js.map +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.d.ts.map +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/pull-workflow.js.map +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.js +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
|
|
1
|
+
const a3_0x395baf=a3_0x2ccb;function a3_0x1dcc(){const _0x50a558=['32Llvdmj','List\x20activations\x20for\x20a\x20segment','704748iRPtwO','\x27...','Resolved\x20parent\x20ID:\x20','1084228SHdASe','name','cause','Site:\x20','6KsCKTx','18622miWxqq','verbose','1737379TORfKw','description','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','error','Error:\x20','1635055upiMMu','execute','Parent\x20name:\x20','\x20\x20Cause:\x20','Listing\x20activations\x20for\x20segment\x20\x27','activations','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Error:\x20Segment\x20name\x20is\x20required','11528970IRUHNn','Resolving\x20parent\x20segment\x20\x27','Resolved\x20child\x20ID:\x20','listActivations','resolveSegmentId','data','Child\x20name:\x20','resolveParentId','9DEHOZg','2011480sFaWDy','\x20activation','length','Resolving\x20child\x20segment\x20\x27','segment'];a3_0x1dcc=function(){return _0x50a558;};return a3_0x1dcc();}(function(_0x5b3f5c,_0x5eaf87){const _0x3aca04=a3_0x2ccb,_0x200e4b=_0x5b3f5c();while(!![]){try{const _0x2d44c1=parseInt(_0x3aca04(0xbd))/0x1*(-parseInt(_0x3aca04(0xda))/0x2)+-parseInt(_0x3aca04(0xb5))/0x3+-parseInt(_0x3aca04(0xb8))/0x4+-parseInt(_0x3aca04(0xc4))/0x5*(-parseInt(_0x3aca04(0xbc))/0x6)+-parseInt(_0x3aca04(0xbf))/0x7+-parseInt(_0x3aca04(0xd5))/0x8*(parseInt(_0x3aca04(0xd4))/0x9)+parseInt(_0x3aca04(0xcc))/0xa;if(_0x2d44c1===_0x5eaf87)break;else _0x200e4b['push'](_0x200e4b['shift']());}catch(_0xa1a2e5){_0x200e4b['push'](_0x200e4b['shift']());}}}(a3_0x1dcc,0x2b0df));import{BaseCommand}from'./command.js';function a3_0x2ccb(_0x4ff104,_0x7b61f3){_0x4ff104=_0x4ff104-0xb4;const _0x1dcce0=a3_0x1dcc();let _0x2ccb24=_0x1dcce0[_0x4ff104];return _0x2ccb24;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x395baf(0xb9)]=a3_0x395baf(0xc9);[a3_0x395baf(0xc0)]=a3_0x395baf(0xb4);async[a3_0x395baf(0xc5)](_0x52cba9){const _0x13fd9f=a3_0x395baf,{options:_0x13126b,args:_0x476da2,tdx:_0x3a818e}=_0x52cba9;if(_0x476da2[_0x13fd9f(0xd7)]===0x0)return console[_0x13fd9f(0xc2)](_0x13fd9f(0xcb)),console['error'](_0x13fd9f(0xc1)),0x1;try{const {parentId:_0x325186,childId:_0x30804c}=parseSegmentRef(_0x476da2[0x0]);if(!_0x30804c)return console[_0x13fd9f(0xc2)](_0x13fd9f(0xca)),console['error']('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;_0x13126b['verbose']&&(console[_0x13fd9f(0xc2)](_0x13fd9f(0xbb)+_0x13126b['site']),console[_0x13fd9f(0xc2)](_0x13fd9f(0xc6)+_0x325186),console[_0x13fd9f(0xc2)](_0x13fd9f(0xd2)+_0x30804c));const _0x46a731=await withSpinner(_0x13fd9f(0xcd)+_0x325186+_0x13fd9f(0xb6),()=>_0x3a818e[_0x13fd9f(0xd9)][_0x13fd9f(0xd3)](_0x325186),{'verbose':_0x13126b[_0x13fd9f(0xbe)]}),_0x212414=_0x46a731['data'];_0x13126b[_0x13fd9f(0xbe)]&&console[_0x13fd9f(0xc2)](_0x13fd9f(0xb7)+_0x212414);const _0x21f97d=await withSpinner(_0x13fd9f(0xd8)+_0x30804c+_0x13fd9f(0xb6),()=>_0x3a818e[_0x13fd9f(0xd9)][_0x13fd9f(0xd0)](_0x212414,_0x30804c),{'verbose':_0x13126b['verbose']}),_0x4fd727=_0x21f97d[_0x13fd9f(0xd1)];_0x13126b[_0x13fd9f(0xbe)]&&console[_0x13fd9f(0xc2)](_0x13fd9f(0xce)+_0x4fd727);const _0x37c46f=await withSpinner(_0x13fd9f(0xc8)+_0x30804c+'\x27...',()=>_0x3a818e[_0x13fd9f(0xd9)][_0x13fd9f(0xcf)](_0x212414,_0x4fd727),{'verbose':_0x13126b[_0x13fd9f(0xbe)]}),_0x481b86=_0x37c46f['data'];return console[_0x13fd9f(0xc2)]('✔\x20Found\x20'+_0x481b86[_0x13fd9f(0xd7)]+_0x13fd9f(0xd6)+(_0x481b86[_0x13fd9f(0xd7)]!==0x1?'s':'')),await handleSDKOutput(_0x481b86,_0x13126b),0x0;}catch(_0x5e9d79){if(_0x5e9d79 instanceof SDKError)return console['error'](_0x13fd9f(0xc3)+_0x5e9d79['message']),_0x5e9d79[_0x13fd9f(0xba)]&&console['error'](_0x13fd9f(0xc7)+_0x5e9d79[_0x13fd9f(0xba)]),0x1;throw _0x5e9d79;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a4_0x15a8b3=a4_0x1dc9;(function(_0x2ee0f6,_0x2ae361){const _0x12f41c=a4_0x1dc9,_0xe44d27=_0x2ee0f6();while(!![]){try{const _0x4bf4e7=-parseInt(_0x12f41c(0x258))/0x1*(-parseInt(_0x12f41c(0x27f))/0x2)+parseInt(_0x12f41c(0x278))/0x3+-parseInt(_0x12f41c(0x214))/0x4+parseInt(_0x12f41c(0x209))/0x5+parseInt(_0x12f41c(0x222))/0x6+-parseInt(_0x12f41c(0x1f6))/0x7+parseInt(_0x12f41c(0x241))/0x8*(parseInt(_0x12f41c(0x243))/0x9);if(_0x4bf4e7===_0x2ae361)break;else _0xe44d27['push'](_0xe44d27['shift']());}catch(_0x1833c3){_0xe44d27['push'](_0xe44d27['shift']());}}}(a4_0x3e4f,0xf3dde));import a4_0xba4cf from'chalk';import a4_0x1db266 from'path';function a4_0x3e4f(){const _0x23489d=['\x20total','Cannot\x20clone\x20from\x20context\x20project\x20\x22','Summary:','\x0aWrite\x20','\x20\x20Knowledge\x20Base\x20\x22','\x20--name\x20','1602336yudEyo','\x20created','red','pullAgent','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','tdx.json','green','dim','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Push\x20cancelled','Pull\x20cancelled','\x20\x20Agent\x20\x22','✔\x20Context\x20set:\x20','log','outputDir','parse','force','\x0aChanges\x20to\x20prompt\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','No\x20tdx.json\x20found\x20in\x20','agent:clone','agentName','Errors:','Output\x20path:\x20','newProjectId','10431477nlfEiF','pullProject','knowledgeBases','Output:\x20','isNew','\x20=\x20','errors','INVALID_ARGUMENT','pushProject','cyan','\x20\x20Text\x20Knowledge\x20Base\x20\x22','\x22...','\x20\x20Source:\x20','counts','pushAgent','\x0aChanges\x20to\x20agent\x20\x27','Using\x20project:\x20','\x20\x20Text\x20Knowledge\x20Bases:\x20','Agent:\x20','113785ZSfSYq','updated','execute','\x20\x20Target:\x20','\x20\x20Knowledge\x20Bases:\x20','Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','Clone\x20\x22','sourceProjectName','yellow','Project\x20cloned\x20with\x20errors','New\x20project\x20ID:\x20','1512480XvCnDc','push','\x20resources?','utf-8','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Chat:\x20','Project\x20cloned\x20successfully','Project:\x20','\x0aProject\x20pushed\x20with\x20errors','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','Cloning\x20\x22','\x20--profile\x20','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Agent\x20','267750HipWCY','error','session','outputPath','\x20\x20tdx\x20agent\x20clone\x20agents/','repeat','dirname','\x0a✔\x20Pulled\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','MISSING_ARGUMENT','Pulling\x20agent\x20\x22','agent:push','\x20new','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','created','New\x20project\x20name\x20is\x20required','textKnowledgeBases','Agent\x20pulled\x20successfully','\x22:\x20','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20Agents:\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','llm','projectName','llm_project','diff','dryRun','description','Using\x20project\x20from\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','yes','40AlpwXM','new','2026692yUEovl','name','site','\x20files\x20to\x20','\x20\x20tdx\x20agent\x20pull\x20','Would\x20clone:','action','Run\x20\x27tdx\x20agent\x20pull\x20','New\x20project:\x20','join','\x20successfully','Would\x20push\x20agent:\x20','Source:\x20','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','newProjectName','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','llmProject','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x0a✔\x20Pushed\x20','unchanged','agent.yml','1YjlKXq','gray','Status:\x20','\x0aPush\x20summary\x20for\x20\x27','hasChanges','\x22\x20to\x20\x22','\x20|\x20','\x0aErrors\x20found:','\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)','projectId','output','\x20\x20Prompts:\x20','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','Clone\x20cancelled','\x20errors','prompts','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x22\x20to\x20a\x20different\x20profile','cwd','Analyzing\x20project\x20\x22','\x20unchanged','agent:pull','cloneProject','Writing\x20files...','\x0aPush\x20','agents','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x20resources\x20to\x20\x27','\x0aChanges:','\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','\x0aPull\x20summary\x20for\x20\x27','Using\x20local\x20project:\x20','2618157couGDX'];a4_0x3e4f=function(){return _0x23489d;};return a4_0x3e4f();}import{existsSync,readFileSync}from'fs';function a4_0x1dc9(_0x186f26,_0x5c0658){_0x186f26=_0x186f26-0x1ec;const _0x3e4f99=a4_0x3e4f();let _0x1dc9d0=_0x3e4f99[_0x186f26];return _0x1dc9d0;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../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(_0x3c6311){const _0x18ba98=a4_0x1dc9,_0x11960e=[];if(_0x3c6311['total']!==undefined)_0x11960e['push'](_0x3c6311['total']+_0x18ba98(0x279));if(_0x3c6311['new']!==undefined&&_0x3c6311[_0x18ba98(0x242)]>0x0)_0x11960e[_0x18ba98(0x215)](a4_0xba4cf[_0x18ba98(0x285)](_0x3c6311[_0x18ba98(0x242)]+_0x18ba98(0x22e)));if(_0x3c6311[_0x18ba98(0x230)]!==undefined&&_0x3c6311[_0x18ba98(0x230)]>0x0)_0x11960e[_0x18ba98(0x215)](a4_0xba4cf['green'](_0x3c6311[_0x18ba98(0x230)]+_0x18ba98(0x280)));if(_0x3c6311[_0x18ba98(0x20a)]!==undefined&&_0x3c6311[_0x18ba98(0x20a)]>0x0)_0x11960e[_0x18ba98(0x215)](a4_0xba4cf[_0x18ba98(0x211)](_0x3c6311[_0x18ba98(0x20a)]+'\x20updated'));if(_0x3c6311[_0x18ba98(0x256)]!==undefined&&_0x3c6311[_0x18ba98(0x256)]>0x0)_0x11960e[_0x18ba98(0x215)](a4_0xba4cf[_0x18ba98(0x259)](_0x3c6311['unchanged']+_0x18ba98(0x26c)));if(_0x3c6311[_0x18ba98(0x1fc)]!==undefined&&_0x3c6311[_0x18ba98(0x1fc)]>0x0)_0x11960e['push'](a4_0xba4cf[_0x18ba98(0x281)](_0x3c6311[_0x18ba98(0x1fc)]+_0x18ba98(0x266)));return _0x11960e[_0x18ba98(0x24c)](',\x20');}function displayDiffs(_0x4a7b04,_0x45cc31,_0x2a840f,_0x1365d1){const _0x273f53=a4_0x1dc9;for(const _0x265c5b of _0x4a7b04){if(_0x265c5b[_0x273f53(0x23b)]){const _0x154eed=_0x265c5b[_0x273f53(0x1f2)]||_0x265c5b[_0x273f53(0x244)];console[_0x273f53(0x28c)](_0x273f53(0x205)+_0x154eed+'\x27:'),console['log']('─'[_0x273f53(0x227)](0x3c)),console[_0x273f53(0x28c)](_0x265c5b[_0x273f53(0x23b)]),console[_0x273f53(0x28c)]('─'[_0x273f53(0x227)](0x3c));}}for(const _0x477ebc of _0x45cc31){_0x477ebc['diff']&&(console[_0x273f53(0x28c)](_0x273f53(0x21d)+_0x477ebc[_0x273f53(0x244)]+'\x27:'),console[_0x273f53(0x28c)]('─'[_0x273f53(0x227)](0x3c)),console['log'](_0x477ebc[_0x273f53(0x23b)]),console[_0x273f53(0x28c)]('─'[_0x273f53(0x227)](0x3c)));}for(const _0xf15718 of _0x2a840f){_0xf15718[_0x273f53(0x23b)]&&(console['log'](_0x273f53(0x283)+_0xf15718['name']+'\x27:'),console[_0x273f53(0x28c)]('─'[_0x273f53(0x227)](0x3c)),console['log'](_0xf15718[_0x273f53(0x23b)]),console[_0x273f53(0x28c)]('─'['repeat'](0x3c)));}for(const _0x4fd30c of _0x1365d1){_0x4fd30c['diff']&&(console[_0x273f53(0x28c)](_0x273f53(0x1ee)+_0x4fd30c[_0x273f53(0x244)]+'\x27:'),console[_0x273f53(0x28c)]('─'[_0x273f53(0x227)](0x3c)),console[_0x273f53(0x28c)](_0x4fd30c[_0x273f53(0x23b)]),console[_0x273f53(0x28c)]('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{['name']=a4_0x15a8b3(0x26d);[a4_0x15a8b3(0x23d)]=a4_0x15a8b3(0x23f);async[a4_0x15a8b3(0x20b)](_0xfeee31){const _0x19c35f=a4_0x15a8b3,{options:_0x3bf8ef,args:_0x4eb759,tdx:_0x5ba5fc}=_0xfeee31,_0x2d1136=_0x4eb759[0x0],_0x3b6b10=_0x4eb759[0x1],_0x27313a=_0x3bf8ef[_0x19c35f(0x262)],_0x563a18=_0x3bf8ef[_0x19c35f(0x23c)],_0x3e8f49=_0x3bf8ef[_0x19c35f(0x1ed)],_0x409797=_0x3bf8ef[_0x19c35f(0x240)],_0x33f79c=_0x3bf8ef['llmProject'];let _0x4ef587,_0x1ea18e;const _0x335898=findAgentConfigPath(process[_0x19c35f(0x26a)]());if(_0x2d1136){const _0x51b0e9=a4_0x1db266[_0x19c35f(0x24c)](_0x2d1136,'tdx.json');if(existsSync(_0x51b0e9))try{const _0x5b6244=JSON[_0x19c35f(0x1ec)](readFileSync(_0x51b0e9,_0x19c35f(0x217)));_0x4ef587=_0x5b6244[_0x19c35f(0x23a)],_0x1ea18e=_0x2d1136,console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x286)](_0x19c35f(0x23e)+_0x51b0e9+':\x20'+_0x4ef587));}catch{_0x4ef587=_0x2d1136;}else _0x4ef587=_0x2d1136;}else{if(_0x335898)try{const _0x3ba1a1=JSON['parse'](readFileSync(_0x335898,_0x19c35f(0x217)));_0x4ef587=_0x3ba1a1[_0x19c35f(0x23a)],_0x1ea18e=a4_0x1db266[_0x19c35f(0x228)](_0x335898),console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x286)](_0x19c35f(0x206)+_0x4ef587));}catch{_0x4ef587=_0x33f79c;}else _0x4ef587=_0x33f79c;}if(!_0x4ef587)return console[_0x19c35f(0x28c)](a4_0xba4cf['yellow']('llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x19c35f(0x28c)](_0x19c35f(0x20e)),console[_0x19c35f(0x28c)](_0x19c35f(0x1ef)),console[_0x19c35f(0x28c)](_0x19c35f(0x275)),console['log'](_0x19c35f(0x272)),0x1;if(_0x3b6b10){const {data:_0x10e09f}=await withSpinner(_0x19c35f(0x22c)+_0x3b6b10+'\x22\x20from\x20project\x20\x22'+_0x4ef587+_0x19c35f(0x201),()=>_0x5ba5fc['llm'][_0x19c35f(0x282)](_0x4ef587,_0x3b6b10,_0x27313a,{'dryRun':_0x563a18,'force':_0x3e8f49}));if(_0x563a18)return console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x211)]('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0x19c35f(0x28c)]('Would\x20pull\x20agent:\x20'+_0x10e09f[_0x19c35f(0x1f2)]),console[_0x19c35f(0x28c)](_0x19c35f(0x1f4)+_0x10e09f['outputPath']),_0x10e09f[_0x19c35f(0x23b)]&&(console['log'](_0x19c35f(0x274)),console[_0x19c35f(0x28c)]('─'[_0x19c35f(0x227)](0x3c)),console[_0x19c35f(0x28c)](_0x10e09f[_0x19c35f(0x23b)]),console[_0x19c35f(0x28c)]('─'[_0x19c35f(0x227)](0x3c))),0x0;return console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x285)](_0x19c35f(0x233))),console['log']('Agent:\x20'+_0x10e09f[_0x19c35f(0x1f2)]),console[_0x19c35f(0x28c)](_0x19c35f(0x1f9)+_0x10e09f[_0x19c35f(0x225)]),console[_0x19c35f(0x28c)](_0x19c35f(0x25a)+(_0x10e09f[_0x19c35f(0x1fa)]?a4_0xba4cf['green'](_0x19c35f(0x242)):_0x10e09f[_0x19c35f(0x25c)]?a4_0xba4cf[_0x19c35f(0x211)](_0x19c35f(0x20a)):a4_0xba4cf[_0x19c35f(0x259)]('unchanged'))),0x0;}const _0x52bf15=_0x1ea18e||_0x27313a,{data:_0x541ef7}=await withSpinner(_0x19c35f(0x26b)+_0x4ef587+'\x22...',()=>_0x5ba5fc[_0x19c35f(0x238)][_0x19c35f(0x1f7)](_0x4ef587,_0x52bf15,{'dryRun':!![]})),_0x547eff=_0x541ef7['counts'][_0x19c35f(0x271)]['new']+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x1f8)]['new']+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x232)][_0x19c35f(0x242)]+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x267)]['new'],_0x2b8991=_0x541ef7[_0x19c35f(0x203)]['agents'][_0x19c35f(0x20a)]+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x1f8)]['updated']+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x232)]['updated']+_0x541ef7[_0x19c35f(0x203)]['prompts']['updated'],_0x3bffc2=_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x271)]['unchanged']+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x1f8)][_0x19c35f(0x256)]+_0x541ef7['counts'][_0x19c35f(0x232)][_0x19c35f(0x256)]+_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x267)][_0x19c35f(0x256)];console['log'](_0x19c35f(0x276)+_0x541ef7[_0x19c35f(0x239)]+'\x27:'),console[_0x19c35f(0x28c)]('\x20\x20'+a4_0xba4cf[_0x19c35f(0x285)]('+\x20'+_0x547eff+_0x19c35f(0x22e))+'\x20|\x20'+a4_0xba4cf[_0x19c35f(0x211)]('~\x20'+_0x2b8991+'\x20changed')+_0x19c35f(0x25e)+a4_0xba4cf['dim']('=\x20'+_0x3bffc2+_0x19c35f(0x26c))),console[_0x19c35f(0x28c)]('\x20\x20Agents:\x20'+formatCountSummary(_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x271)])),console[_0x19c35f(0x28c)](_0x19c35f(0x20d)+formatCountSummary(_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x1f8)])),console[_0x19c35f(0x28c)](_0x19c35f(0x207)+formatCountSummary(_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x232)])),console[_0x19c35f(0x28c)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x541ef7[_0x19c35f(0x203)][_0x19c35f(0x267)])),console['log'](_0x19c35f(0x20c)+a4_0xba4cf[_0x19c35f(0x1ff)](_0x541ef7[_0x19c35f(0x28d)])),displayDiffs(_0x541ef7[_0x19c35f(0x271)],_0x541ef7['knowledgeBases'],_0x541ef7[_0x19c35f(0x232)],_0x541ef7[_0x19c35f(0x267)]);if(_0x563a18)return console[_0x19c35f(0x28c)](a4_0xba4cf['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x547eff===0x0&&_0x2b8991===0x0)return console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x285)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x541ef7[_0x19c35f(0x239)]},_0x3bf8ef[_0x19c35f(0x224)]),console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x285)](_0x19c35f(0x28b)+a4_0xba4cf['dim'](_0x19c35f(0x23a))+_0x19c35f(0x1fb)+a4_0xba4cf['cyan'](_0x541ef7[_0x19c35f(0x239)]))),0x0;if(!_0x409797&&!_0x3e8f49){const _0x4c3e5d=await confirmKey(_0x19c35f(0x27c)+(_0x547eff+_0x2b8991)+'\x20files?');if(!_0x4c3e5d)return console[_0x19c35f(0x28c)](_0x19c35f(0x289)),0x0;}const {data:_0x30f2da}=await withSpinner(_0x19c35f(0x26f),()=>_0x5ba5fc[_0x19c35f(0x238)]['pullProject'](_0x4ef587,_0x52bf15,{'force':_0x3e8f49}));return console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x285)](_0x19c35f(0x229)+(_0x547eff+_0x2b8991)+_0x19c35f(0x246)+_0x30f2da[_0x19c35f(0x28d)])),saveSessionContext({'llm_project':_0x30f2da['projectName']},_0x3bf8ef[_0x19c35f(0x224)]),console[_0x19c35f(0x28c)](a4_0xba4cf[_0x19c35f(0x285)](_0x19c35f(0x28b)+a4_0xba4cf[_0x19c35f(0x286)]('llm_project')+_0x19c35f(0x1fb)+a4_0xba4cf[_0x19c35f(0x1ff)](_0x30f2da[_0x19c35f(0x239)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x15a8b3(0x244)]=a4_0x15a8b3(0x1f1);['description']=a4_0x15a8b3(0x250);async[a4_0x15a8b3(0x20b)](_0x1e037f){const _0x3c3595=a4_0x15a8b3,{options:_0x134917,args:_0x109753,tdx:_0x40a617}=_0x1e037f,_0x45d65f=_0x109753[0x0],_0x2fd1d3=_0x134917[_0x3c3595(0x244)],_0x520341=_0x134917[_0x3c3595(0x23c)],_0x4e0337=_0x134917[_0x3c3595(0x240)],_0xcde3c0=_0x134917[_0x3c3595(0x245)],_0x30f082=_0x134917[_0x3c3595(0x253)];let _0x3c10b7;const _0x296cd8=findAgentConfigPath(process[_0x3c3595(0x26a)]());if(_0x45d65f){const _0x220024=a4_0x1db266['join'](_0x45d65f,_0x3c3595(0x284));existsSync(_0x220024)?(_0x3c10b7=_0x45d65f,console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x286)](_0x3c3595(0x277)+_0x45d65f))):_0x3c10b7=_0x45d65f;}else{if(_0x296cd8)_0x3c10b7=a4_0x1db266[_0x3c3595(0x228)](_0x296cd8),console['log'](a4_0xba4cf['dim']('Using\x20current\x20project:\x20'+_0x3c10b7));else{if(_0x30f082){const _0x1c5d94=normalizeName(_0x30f082),_0x548957=a4_0x1db266[_0x3c3595(0x24c)](process[_0x3c3595(0x26a)](),'agents',_0x1c5d94,_0x3c3595(0x284));if(existsSync(_0x548957))_0x3c10b7=a4_0x1db266[_0x3c3595(0x228)](_0x548957),console[_0x3c3595(0x28c)](a4_0xba4cf['dim'](_0x3c3595(0x277)+_0x3c10b7));else{const _0x374039=_0x134917['profile'];if(_0x374039)throw new SDKError(ErrorCode[_0x3c3595(0x1fd)],_0x3c3595(0x27a)+_0x30f082+_0x3c3595(0x269),undefined,{'helpText':'When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a'+_0x3c3595(0x237)+(_0x3c3595(0x247)+_0x30f082+'\x0a')+(_0x3c3595(0x226)+_0x1c5d94+_0x3c3595(0x27e)+(_0x2fd1d3||'<new-name>')+_0x3c3595(0x21f)+_0x374039)});_0x3c10b7=_0x30f082,console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x286)]('Using\x20context\x20project:\x20'+_0x30f082));}}}}if(!_0x3c10b7)return console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x211)](_0x3c3595(0x252))),console[_0x3c3595(0x28c)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x3c3595(0x28c)](_0x3c3595(0x287)),console[_0x3c3595(0x28c)](_0x3c3595(0x260)),console[_0x3c3595(0x28c)](_0x3c3595(0x220)),0x1;if(!_0x2fd1d3)throw new SDKError(ErrorCode[_0x3c3595(0x22b)],_0x3c3595(0x231),undefined,{'helpText':_0x3c3595(0x268)});if(!_0x4e0337&&!_0x520341){const _0x5666a7=await confirmKey(_0x3c3595(0x20f)+_0x3c10b7+'\x22\x20to\x20new\x20project\x20\x22'+_0x2fd1d3+'\x22?');if(!_0x5666a7)return console[_0x3c3595(0x28c)](_0x3c3595(0x265)),0x0;}const {data:_0x642e27}=await withSpinner(_0x3c3595(0x21e)+_0x3c10b7+_0x3c3595(0x25d)+_0x2fd1d3+'\x22...',()=>_0x40a617['llm'][_0x3c3595(0x26e)](_0x3c10b7,_0x2fd1d3,{'dryRun':_0x520341}));if(_0x520341)return console['log'](a4_0xba4cf['yellow'](_0x3c3595(0x235))),console[_0x3c3595(0x28c)](_0x3c3595(0x24f)+_0x642e27[_0x3c3595(0x210)]),console['log']('New\x20project:\x20'+_0x2fd1d3),console[_0x3c3595(0x28c)](_0x3c3595(0x248)),console['log']('\x20\x20Agents:\x20'+_0x642e27[_0x3c3595(0x203)]['agents'][_0x3c3595(0x230)]),console[_0x3c3595(0x28c)]('\x20\x20Knowledge\x20Bases:\x20'+_0x642e27[_0x3c3595(0x203)][_0x3c3595(0x1f8)][_0x3c3595(0x230)]),console['log'](_0x3c3595(0x263)+_0x642e27[_0x3c3595(0x203)]['prompts'][_0x3c3595(0x230)]),0x0;const _0x260dc0=_0x642e27[_0x3c3595(0x203)][_0x3c3595(0x271)]['errors']>0x0||_0x642e27['counts'][_0x3c3595(0x1f8)]['errors']>0x0||_0x642e27['counts'][_0x3c3595(0x267)][_0x3c3595(0x1fc)]>0x0;_0x260dc0?console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x211)](_0x3c3595(0x212))):console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x285)](_0x3c3595(0x21a)));console['log'](_0x3c3595(0x24f)+_0x642e27[_0x3c3595(0x210)]),console[_0x3c3595(0x28c)](_0x3c3595(0x24b)+_0x642e27[_0x3c3595(0x251)]),console['log'](_0x3c3595(0x213)+_0x642e27[_0x3c3595(0x1f5)]),console[_0x3c3595(0x28c)](),console['log'](_0x3c3595(0x27b)),console[_0x3c3595(0x28c)]('\x20\x20Agents:\x20'+formatCountSummary(_0x642e27[_0x3c3595(0x203)]['agents'])),console[_0x3c3595(0x28c)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x642e27[_0x3c3595(0x203)]['knowledgeBases'])),console[_0x3c3595(0x28c)](_0x3c3595(0x263)+formatCountSummary(_0x642e27['counts'][_0x3c3595(0x267)]));if(_0x260dc0){console[_0x3c3595(0x28c)](),console['log'](a4_0xba4cf['red'](_0x3c3595(0x1f3)));for(const _0x171b06 of _0x642e27[_0x3c3595(0x271)]){_0x171b06[_0x3c3595(0x249)]==='error'&&console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x281)](_0x3c3595(0x28a)+_0x171b06['agentName']+_0x3c3595(0x234)+_0x171b06[_0x3c3595(0x223)]));}for(const _0x1abd74 of _0x642e27[_0x3c3595(0x1f8)]){_0x1abd74[_0x3c3595(0x249)]==='error'&&console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x281)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x1abd74[_0x3c3595(0x244)]+_0x3c3595(0x234)+_0x1abd74[_0x3c3595(0x223)]));}for(const _0x485cbc of _0x642e27[_0x3c3595(0x267)]){_0x485cbc[_0x3c3595(0x249)]===_0x3c3595(0x223)&&console[_0x3c3595(0x28c)](a4_0xba4cf[_0x3c3595(0x281)]('\x20\x20Prompt\x20\x22'+_0x485cbc['name']+_0x3c3595(0x234)+_0x485cbc[_0x3c3595(0x223)]));}return 0x1;}console['log']();const _0x5281ee=getLLMProjectUrl(_0xcde3c0,_0x642e27[_0x3c3595(0x1f5)]);return console['log']('Project:\x20'+a4_0xba4cf[_0x3c3595(0x1ff)](_0x5281ee)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x15a8b3(0x22d);['description']=a4_0x15a8b3(0x218);async[a4_0x15a8b3(0x20b)](_0x29b253){const _0xf2a324=a4_0x15a8b3,{options:_0x2b29d5,args:_0x942cdc,tdx:_0x4588a0}=_0x29b253;let _0x1de38b=_0x942cdc[0x0]||process[_0xf2a324(0x26a)]();const _0x4e6916=_0x2b29d5[_0xf2a324(0x23c)],_0x23494b=_0x2b29d5['force'],_0x3118ba=_0x2b29d5[_0xf2a324(0x240)],_0x49b310=_0x2b29d5[_0xf2a324(0x245)],_0x200bb8=a4_0x1db266[_0xf2a324(0x24c)](_0x1de38b,_0xf2a324(0x257)),_0x1d113c=existsSync(_0x200bb8);if(_0x1d113c){const {data:_0x5e4ba2}=await withSpinner('Pushing\x20agent\x20from\x20\x22'+_0x1de38b+_0xf2a324(0x201),()=>_0x4588a0['llm'][_0xf2a324(0x204)](_0x1de38b,{'dryRun':_0x4e6916,'force':_0x23494b}));if(_0x4e6916)return console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x211)](_0xf2a324(0x235))),console['log'](_0xf2a324(0x24e)+_0x5e4ba2['agentName']),0x0;if(_0x5e4ba2[_0xf2a324(0x249)]===_0xf2a324(0x223))return console['log'](a4_0xba4cf['red']('Failed\x20to\x20push\x20agent:\x20'+_0x5e4ba2['error'])),0x1;console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x285)](_0xf2a324(0x221)+_0x5e4ba2[_0xf2a324(0x249)]+_0xf2a324(0x24d))),console[_0xf2a324(0x28c)](_0xf2a324(0x208)+_0x5e4ba2[_0xf2a324(0x1f2)]);if(_0x5e4ba2['agentId']&&_0x5e4ba2[_0xf2a324(0x261)]){const _0x37bc4f=getLLMAgentChatUrl(_0x49b310,_0x5e4ba2[_0xf2a324(0x261)],_0x5e4ba2['agentId']);console[_0xf2a324(0x28c)](_0xf2a324(0x219)+a4_0xba4cf[_0xf2a324(0x1ff)](_0x37bc4f));}return 0x0;}let _0x2f0ba6=a4_0x1db266[_0xf2a324(0x24c)](_0x1de38b,_0xf2a324(0x284));if(!existsSync(_0x2f0ba6)){const _0x8aece=findAgentConfigPath(_0x1de38b);if(_0x8aece)_0x1de38b=a4_0x1db266[_0xf2a324(0x228)](_0x8aece),_0x2f0ba6=_0x8aece,console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x286)](_0xf2a324(0x206)+_0x1de38b));else{const _0x366fc4=_0x2b29d5[_0xf2a324(0x253)];if(_0x366fc4){const _0x64a29e=normalizeName(_0x366fc4),_0x22d4ac=a4_0x1db266[_0xf2a324(0x24c)](_0x1de38b,_0xf2a324(0x271)),_0x5d34b1=a4_0x1db266[_0xf2a324(0x24c)](_0x22d4ac,_0x64a29e,'tdx.json');existsSync(_0x5d34b1)&&(_0x1de38b=a4_0x1db266[_0xf2a324(0x228)](_0x5d34b1),_0x2f0ba6=_0x5d34b1,console['log'](a4_0xba4cf[_0xf2a324(0x286)](_0xf2a324(0x206)+_0x1de38b)));}if(!existsSync(_0x2f0ba6)){let _0x53fd86=_0xf2a324(0x264);_0x366fc4&&(_0x53fd86='Current\x20context\x20has\x20llm_project=\x22'+_0x366fc4+'\x22\x20but\x20no\x20local\x20folder\x20found.\x0a'+(_0xf2a324(0x24a)+_0x366fc4+_0xf2a324(0x22a)));throw new SDKError(ErrorCode[_0xf2a324(0x1fd)],_0xf2a324(0x1f0)+_0x1de38b,undefined,{'helpText':_0x53fd86});}}}const {data:_0x588a7a}=await withSpinner('Analyzing\x20changes\x20to\x20push...',()=>_0x4588a0[_0xf2a324(0x238)]['pushProject'](_0x1de38b,{'dryRun':!![]})),_0xaac923=_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x271)]['errors']>0x0;if(_0xaac923){console['log'](a4_0xba4cf[_0xf2a324(0x281)](_0xf2a324(0x25f)));for(const _0x17c16b of _0x588a7a[_0xf2a324(0x271)]){_0x17c16b[_0xf2a324(0x249)]===_0xf2a324(0x223)&&console[_0xf2a324(0x28c)](a4_0xba4cf['red'](_0xf2a324(0x28a)+_0x17c16b[_0xf2a324(0x1f2)]+_0xf2a324(0x234)+_0x17c16b['error']));}return 0x1;}const _0x4a2d07=_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x271)]['created']+_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x1f8)]['created']+_0x588a7a['counts'][_0xf2a324(0x232)][_0xf2a324(0x230)]+_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x267)][_0xf2a324(0x230)],_0x2fbf4e=_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x271)][_0xf2a324(0x20a)]+_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x1f8)]['updated']+_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x232)]['updated']+_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x267)][_0xf2a324(0x20a)],_0x344744=_0x588a7a['counts'][_0xf2a324(0x271)][_0xf2a324(0x256)]+_0x588a7a[_0xf2a324(0x203)]['knowledgeBases']['unchanged']+_0x588a7a['counts']['textKnowledgeBases'][_0xf2a324(0x256)]+_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x267)][_0xf2a324(0x256)];console['log'](_0xf2a324(0x25b)+_0x588a7a[_0xf2a324(0x239)]+'\x27:'),console[_0xf2a324(0x28c)]('\x20\x20'+a4_0xba4cf[_0xf2a324(0x285)]('+\x20'+_0x4a2d07+_0xf2a324(0x22e))+_0xf2a324(0x25e)+a4_0xba4cf['yellow']('~\x20'+_0x2fbf4e+'\x20changed')+'\x20|\x20'+a4_0xba4cf['dim']('=\x20'+_0x344744+_0xf2a324(0x26c))),console['log'](_0xf2a324(0x236)+formatCountSummary(_0x588a7a[_0xf2a324(0x203)]['agents'])),console[_0xf2a324(0x28c)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x1f8)])),console[_0xf2a324(0x28c)](_0xf2a324(0x207)+formatCountSummary(_0x588a7a[_0xf2a324(0x203)]['textKnowledgeBases'])),console[_0xf2a324(0x28c)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x588a7a[_0xf2a324(0x203)][_0xf2a324(0x267)])),console['log'](_0xf2a324(0x202)+a4_0xba4cf[_0xf2a324(0x1ff)](_0x1de38b)),displayDiffs(_0x588a7a[_0xf2a324(0x271)],_0x588a7a[_0xf2a324(0x1f8)],_0x588a7a[_0xf2a324(0x232)],_0x588a7a[_0xf2a324(0x267)]);if(_0x4e6916)return console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x211)](_0xf2a324(0x22f))),0x0;if(_0x4a2d07===0x0&&_0x2fbf4e===0x0){console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x285)](_0xf2a324(0x254)));const _0x3eddb2=getLLMProjectUrl(_0x49b310,_0x588a7a[_0xf2a324(0x261)]);return console['log'](_0xf2a324(0x21b)+a4_0xba4cf[_0xf2a324(0x1ff)](_0x3eddb2)),0x0;}if(!_0x3118ba&&!_0x23494b){const _0x5ef095=await confirmKey(_0xf2a324(0x270)+(_0x4a2d07+_0x2fbf4e)+_0xf2a324(0x216));if(!_0x5ef095)return console[_0xf2a324(0x28c)](_0xf2a324(0x288)),0x0;}const {data:_0x3964c9}=await withSpinner('Pushing\x20to\x20project...',()=>_0x4588a0[_0xf2a324(0x238)][_0xf2a324(0x1fe)](_0x1de38b,{'force':_0x23494b})),_0x380ea2=_0x3964c9['counts'][_0xf2a324(0x271)][_0xf2a324(0x1fc)]>0x0||_0x3964c9['counts'][_0xf2a324(0x1f8)][_0xf2a324(0x1fc)]>0x0||_0x3964c9[_0xf2a324(0x203)][_0xf2a324(0x232)][_0xf2a324(0x1fc)]>0x0||_0x3964c9[_0xf2a324(0x203)][_0xf2a324(0x267)][_0xf2a324(0x1fc)]>0x0;if(_0x380ea2){console[_0xf2a324(0x28c)](a4_0xba4cf['yellow'](_0xf2a324(0x21c))),console['log'](),console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x281)]('Errors:'));for(const _0x14e854 of _0x3964c9['agents']){_0x14e854['action']===_0xf2a324(0x223)&&console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x281)](_0xf2a324(0x28a)+_0x14e854['agentName']+_0xf2a324(0x234)+_0x14e854[_0xf2a324(0x223)]));}for(const _0x526233 of _0x3964c9[_0xf2a324(0x1f8)]){_0x526233[_0xf2a324(0x249)]===_0xf2a324(0x223)&&console['log'](a4_0xba4cf[_0xf2a324(0x281)](_0xf2a324(0x27d)+_0x526233['name']+'\x22:\x20'+_0x526233[_0xf2a324(0x223)]));}for(const _0x25a0b6 of _0x3964c9['textKnowledgeBases']){_0x25a0b6[_0xf2a324(0x249)]===_0xf2a324(0x223)&&console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x281)](_0xf2a324(0x200)+_0x25a0b6[_0xf2a324(0x244)]+_0xf2a324(0x234)+_0x25a0b6[_0xf2a324(0x223)]));}for(const _0x2de71e of _0x3964c9[_0xf2a324(0x267)]){_0x2de71e[_0xf2a324(0x249)]==='error'&&console[_0xf2a324(0x28c)](a4_0xba4cf['red']('\x20\x20Prompt\x20\x22'+_0x2de71e['name']+'\x22:\x20'+_0x2de71e['error']));}return 0x1;}console[_0xf2a324(0x28c)](a4_0xba4cf[_0xf2a324(0x285)](_0xf2a324(0x255)+(_0x4a2d07+_0x2fbf4e)+_0xf2a324(0x273)+_0x3964c9[_0xf2a324(0x239)]+'\x27'));const _0x5d5dc2=getLLMProjectUrl(_0x49b310,_0x3964c9['projectId']);return console[_0xf2a324(0x28c)](_0xf2a324(0x21b)+a4_0xba4cf[_0xf2a324(0x1ff)](_0x5d5dc2)),0x0;}}
|
|
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 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a5_0x5c43a3=a5_0x2660;(function(_0x32b090,_0x309555){const _0x2fea07=a5_0x2660,_0x74b3d6=_0x32b090();while(!![]){try{const _0x5d885e=parseInt(_0x2fea07(0x195))/0x1*(parseInt(_0x2fea07(0x19e))/0x2)+-parseInt(_0x2fea07(0x1c7))/0x3*(parseInt(_0x2fea07(0x198))/0x4)+-parseInt(_0x2fea07(0x1c4))/0x5+-parseInt(_0x2fea07(0x1c8))/0x6*(-parseInt(_0x2fea07(0x1a2))/0x7)+parseInt(_0x2fea07(0x1b5))/0x8*(parseInt(_0x2fea07(0x1ae))/0x9)+parseInt(_0x2fea07(0x1d1))/0xa+-parseInt(_0x2fea07(0x1ca))/0xb;if(_0x5d885e===_0x309555)break;else _0x74b3d6['push'](_0x74b3d6['shift']());}catch(_0x246b5c){_0x74b3d6['push'](_0x74b3d6['shift']());}}}(a5_0x49a0,0xe0a1a));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';function a5_0x2660(_0x1f29fd,_0x3ad8e2){_0x1f29fd=_0x1f29fd-0x18e;const _0x49a0c0=a5_0x49a0();let _0x26602b=_0x49a0c0[_0x1f29fd];return _0x26602b;}import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a5_0x5c43a3(0x192),a5_0x5c43a3(0x1ab),'cookie',a5_0x5c43a3(0x1be),a5_0x5c43a3(0x199),a5_0x5c43a3(0x1a1),a5_0x5c43a3(0x194),a5_0x5c43a3(0x1ad)]);function a5_0x49a0(){const _0x257b28=['Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','color','stack','status','request','api','cdp','set-cookie','PATCH','message','trim','indexOf','.\x20Valid\x20methods:\x20','8032905GDxsTo','file','llm','33CWsFXK','702xZLGxC','substring','2364208hOEDDD','GET','Invalid\x20HTTP\x20method:\x20','site','type','includes','toUpperCase','7432760SEtGlW','POST','readBodyFromFile','name','header','Invalid\x20API\x20type:\x20','body','headers','authorization','validate','x-auth-token','1lgtFCZ','error','.\x20Valid\x20types:\x20','528364MsqucZ','set-cookie2','Results\x20saved\x20to\x20','<\x20HTTP/1.1\x20','join','log','2360870qAyELt','DELETE','trino','x-xsrf-token','77609BqxHTw','method','length','output','Endpoint\x20must\x20start\x20with\x20/:\x20','\x0aStack\x20trace:\x0a','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','data','noColor','proxy-authorization','verbose','x-trino-user','4381695UweNMi','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','isArray','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','startsWith','entries','description','16SiTMzi','\x22.\x20'];a5_0x49a0=function(){return _0x257b28;};return a5_0x49a0();}function isSensitiveHeader(_0x3131d7){return SENSITIVE_HEADERS['has'](_0x3131d7['toLowerCase']());}function parseHeader(_0xef2839){const _0x72c0c0=a5_0x5c43a3,_0x423989=_0xef2839[_0x72c0c0(0x1c2)](':');if(_0x423989===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0xef2839+_0x72c0c0(0x1b6)+_0x72c0c0(0x1b1));const _0x43cba7=_0xef2839[_0x72c0c0(0x1c9)](0x0,_0x423989)[_0x72c0c0(0x1c1)](),_0x594d69=_0xef2839[_0x72c0c0(0x1c9)](_0x423989+0x1)[_0x72c0c0(0x1c1)]();if(!_0x43cba7)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0xef2839+'\x22');return[_0x43cba7,_0x594d69];}export class ApiCommand extends BaseCommand{[a5_0x5c43a3(0x1d4)]=a5_0x5c43a3(0x1bc);[a5_0x5c43a3(0x1b4)]=a5_0x5c43a3(0x1b7);[a5_0x5c43a3(0x193)](_0x595cc2){const _0x197271=a5_0x5c43a3,{args:_0x279b7e,options:_0x4844ba}=_0x595cc2,_0x3d5a3e=_0x4844ba;if(_0x279b7e['length']===0x0)return _0x197271(0x1a8);const _0x45f320=_0x279b7e[0x0];if(!_0x45f320[_0x197271(0x1b2)]('/'))return _0x197271(0x1a6)+_0x45f320;const _0x3685de=_0x3d5a3e[_0x197271(0x1a9)],_0x34c0f2=_0x3d5a3e[_0x197271(0x1c5)];if(_0x3685de&&_0x34c0f2)return _0x197271(0x1af);const _0x4b418f=_0x3d5a3e['method']||_0x197271(0x1cb),_0x13380c=[_0x197271(0x1cb),_0x197271(0x1d2),'PUT',_0x197271(0x19f),_0x197271(0x1bf)];if(!_0x13380c['includes'](_0x4b418f[_0x197271(0x1d0)]()))return _0x197271(0x1cc)+_0x4b418f+_0x197271(0x1c3)+_0x13380c[_0x197271(0x19c)](',\x20');const _0x51763c=_0x3d5a3e[_0x197271(0x1ce)]||'td',_0x259408=['td',_0x197271(0x1bd),'workflow',_0x197271(0x1a0),_0x197271(0x1c6)];if(!_0x259408[_0x197271(0x1cf)](_0x51763c))return _0x197271(0x18f)+_0x51763c+_0x197271(0x197)+_0x259408[_0x197271(0x19c)](',\x20');return undefined;}async['execute'](_0xe958c4){const _0x1b4db7=a5_0x5c43a3,{options:_0x38cd26,args:_0x313f05,tdx:_0x5f4319}=_0xe958c4,_0x5769b2=_0x38cd26,_0x22f6a5=_0x313f05[0x0],_0x3f8d04=(_0x5769b2[_0x1b4db7(0x1a3)]||'GET')[_0x1b4db7(0x1d0)](),_0x25d851=_0x5769b2[_0x1b4db7(0x1a9)],_0x33d079=_0x5769b2[_0x1b4db7(0x1c5)],_0xd20d5b=_0x5769b2[_0x1b4db7(0x18e)],_0x49cb9=_0x5769b2[_0x1b4db7(0x1ce)]||'td';try{const _0x5a3e33={};if(_0xd20d5b){const _0x5511e5=Array[_0x1b4db7(0x1b0)](_0xd20d5b)?_0xd20d5b:[_0xd20d5b];for(const _0x4825c3 of _0x5511e5){const [_0x4cdc05,_0x43899a]=parseHeader(_0x4825c3);_0x5a3e33[_0x4cdc05]=_0x43899a;}}let _0x207d47;if(_0x25d851)_0x207d47=_0x25d851;else{if(_0x33d079)try{_0x207d47=RawAPI[_0x1b4db7(0x1d3)](_0x33d079);}catch(_0x2f4dfd){return console[_0x1b4db7(0x196)]('Error:\x20'+(_0x2f4dfd instanceof Error?_0x2f4dfd[_0x1b4db7(0x1c0)]:String(_0x2f4dfd))),0x1;}}const _0x12d97b={'method':_0x3f8d04,'apiType':_0x49cb9,'includeHeaders':_0x38cd26[_0x1b4db7(0x1ac)]};_0x207d47&&(_0x12d97b[_0x1b4db7(0x190)]=_0x207d47);Object['keys'](_0x5a3e33)[_0x1b4db7(0x1a4)]>0x0&&(_0x12d97b[_0x1b4db7(0x191)]=_0x5a3e33);if(_0x38cd26[_0x1b4db7(0x1ac)]){const _0x21099a=resolveSite(_0x38cd26[_0x1b4db7(0x1cd)]),_0x50f708=getEndpoint(_0x21099a,_0x49cb9),_0x559453=''+_0x50f708+_0x22f6a5;console[_0x1b4db7(0x196)]('>\x20'+_0x3f8d04+'\x20'+_0x559453);const _0x587be8=getAuthHeaders(_0x21099a),_0xf06a52={..._0x587be8,..._0x5a3e33};for(const [_0x303b08,_0x55dc1f]of Object[_0x1b4db7(0x1b3)](_0xf06a52)){!isSensitiveHeader(_0x303b08)&&console[_0x1b4db7(0x196)]('>\x20'+_0x303b08+':\x20'+_0x55dc1f);}_0x207d47&&console[_0x1b4db7(0x196)]('>'),console[_0x1b4db7(0x196)]('');}const _0x2fdc55=await _0x5f4319[_0x1b4db7(0x1bc)][_0x1b4db7(0x1bb)](_0x22f6a5,_0x12d97b);if(_0x38cd26[_0x1b4db7(0x1ac)]&&_0x2fdc55['headers']){console[_0x1b4db7(0x196)](_0x1b4db7(0x19b)+_0x2fdc55[_0x1b4db7(0x1ba)]);for(const [_0x43a356,_0x1ddd3c]of Object[_0x1b4db7(0x1b3)](_0x2fdc55['headers'])){!isSensitiveHeader(_0x43a356)&&console[_0x1b4db7(0x196)]('<\x20'+_0x43a356+':\x20'+_0x1ddd3c);}console['error']('');}const _0x2c5d14=Boolean(_0x38cd26[_0x1b4db7(0x1a5)]),_0x60810f={'color':_0x38cd26[_0x1b4db7(0x1b8)],'noColor':_0x38cd26[_0x1b4db7(0x1aa)]||_0x2c5d14&&!_0x38cd26[_0x1b4db7(0x1b8)]},_0x5ea0bb=colorizeJSON(_0x2fdc55[_0x1b4db7(0x1a9)],_0x60810f);return _0x38cd26[_0x1b4db7(0x1a5)]?(writeFileSync(_0x38cd26[_0x1b4db7(0x1a5)],_0x5ea0bb),console[_0x1b4db7(0x196)](_0x1b4db7(0x19a)+_0x38cd26[_0x1b4db7(0x1a5)])):console[_0x1b4db7(0x19d)](_0x5ea0bb),0x0;}catch(_0x13200f){return _0x13200f instanceof Error?(console['error']('Error:\x20'+_0x13200f['message']),_0x38cd26[_0x1b4db7(0x1ac)]&&_0x13200f[_0x1b4db7(0x1b9)]&&console[_0x1b4db7(0x196)](_0x1b4db7(0x1a7)+_0x13200f[_0x1b4db7(0x1b9)])):console['error']('Error:\x20'+String(_0x13200f)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x3cd29e=a6_0x5234;(function(_0x1dfed4,_0x5df753){const _0x149ac1=a6_0x5234,_0x252285=_0x1dfed4();while(!![]){try{const _0x18f5f7=-parseInt(_0x149ac1(0x1b3))/0x1*(-parseInt(_0x149ac1(0x1ee))/0x2)+-parseInt(_0x149ac1(0x1ec))/0x3+parseInt(_0x149ac1(0x1f1))/0x4*(-parseInt(_0x149ac1(0x1e2))/0x5)+parseInt(_0x149ac1(0x1ba))/0x6+parseInt(_0x149ac1(0x1d8))/0x7*(parseInt(_0x149ac1(0x1c1))/0x8)+parseInt(_0x149ac1(0x1ac))/0x9*(parseInt(_0x149ac1(0x1c6))/0xa)+-parseInt(_0x149ac1(0x1c4))/0xb;if(_0x18f5f7===_0x5df753)break;else _0x252285['push'](_0x252285['shift']());}catch(_0x439f28){_0x252285['push'](_0x252285['shift']());}}}(a6_0x3621,0xc2c3a));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_0x11a3f4 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_0x304f51 from'chalk';export class AuthSetupCommand extends BaseCommand{[a6_0x3cd29e(0x1e5)]='auth:setup';['description']=a6_0x3cd29e(0x1f7);async[a6_0x3cd29e(0x1d1)](_0x597901){const _0x436b4a=a6_0x3cd29e,{options:_0x1215fe}=_0x597901,_0x2b1f3e=_0x1215fe[_0x436b4a(0x1cc)];console[_0x436b4a(0x1b2)](a6_0x304f51['bold'](_0x436b4a(0x1e4)));const _0x10e056=_0x1215fe[_0x436b4a(0x1b6)]||_0x436b4a(0x1c7),_0x2f7054=[{'title':_0x436b4a(0x1d7),'value':_0x436b4a(0x1c7)},{'title':_0x436b4a(0x1b8),'value':_0x436b4a(0x1bc)},{'title':_0x436b4a(0x1aa),'value':_0x436b4a(0x1dc)},{'title':_0x436b4a(0x1f8),'value':_0x436b4a(0x1e3)}];let _0x1b66e1=_0x2f7054['findIndex'](_0x163456=>_0x163456[_0x436b4a(0x1e6)]===_0x10e056);_0x1b66e1===-0x1&&_0x10e056!==_0x436b4a(0x1c7)&&(_0x2f7054[_0x436b4a(0x1cb)]({'title':_0x10e056,'value':_0x10e056}),_0x1b66e1=_0x2f7054[_0x436b4a(0x1a4)]-0x1);_0x2f7054[_0x436b4a(0x1cb)]({'title':'Enter\x20custom\x20site','value':_0x436b4a(0x1ae)});const _0x131d6c=_0x2b1f3e?_0x436b4a(0x1c3)+_0x2b1f3e+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x4663ad=await a6_0x11a3f4({'type':_0x436b4a(0x1af),'name':_0x436b4a(0x1b6),'message':_0x131d6c,'choices':_0x2f7054,'initial':_0x1b66e1>=0x0?_0x1b66e1:0x0});if(!_0x4663ad[_0x436b4a(0x1b6)])return console['log'](_0x436b4a(0x1ef)),0x1;let _0x50473f;if(_0x4663ad[_0x436b4a(0x1b6)]==='other'){const _0x321142=await a6_0x11a3f4({'type':_0x436b4a(0x1e9),'name':_0x436b4a(0x1d3),'message':_0x436b4a(0x1f2),'initial':_0x436b4a(0x1c7),'validate':_0x43b5b0=>{const _0x453987=_0x436b4a;if(!_0x43b5b0||!_0x43b5b0[_0x453987(0x1e0)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x453987(0x1a6)](_0x43b5b0[_0x453987(0x1e0)]()))return _0x453987(0x1d5);return!![];}});if(!_0x321142[_0x436b4a(0x1d3)])return console[_0x436b4a(0x1b2)](_0x436b4a(0x1ef)),0x1;_0x50473f=_0x321142['customSite'];}else _0x50473f=_0x4663ad['site'];const _0x31b386=resolveSite(_0x50473f);console[_0x436b4a(0x1b2)](_0x436b4a(0x1d4)+_0x31b386),console['log'](_0x436b4a(0x1a9)),console[_0x436b4a(0x1b2)]('\x20\x20'+getConsoleUrl(_0x31b386,'/app/mp/ak'));const _0x1f473f=await a6_0x11a3f4({'type':'password','name':_0x436b4a(0x1bb),'message':_0x436b4a(0x1f4),'validate':_0x40cda6=>{const _0x49c4be=_0x436b4a;if(!_0x40cda6||!_0x40cda6[_0x49c4be(0x1e0)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x1f473f[_0x436b4a(0x1bb)])return console[_0x436b4a(0x1b2)](_0x436b4a(0x1ef)),0x1;const _0x46f325=_0x1f473f[_0x436b4a(0x1bb)];console['log'](_0x436b4a(0x1e8));try{const _0x22d471=TDX[_0x436b4a(0x1a5)]({'site':_0x31b386,'apiKey':_0x46f325[_0x436b4a(0x1e0)](),'logLevel':_0x1215fe[_0x436b4a(0x1f6)]??LogLevel[_0x436b4a(0x1b4)]}),_0x405f7b=await _0x22d471[_0x436b4a(0x1b5)][_0x436b4a(0x1ea)]();console[_0x436b4a(0x1b2)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x405f7b[_0x436b4a(0x1d9)]+')');const _0x1a1130=await isKeychainAvailable();_0x1a1130?(await saveAPIKeyAsync(_0x46f325['trim'](),_0x31b386,_0x2b1f3e),console[_0x436b4a(0x1b2)](_0x436b4a(0x1b9)+(_0x2b1f3e?_0x436b4a(0x1de)+_0x2b1f3e+')':''))):(console[_0x436b4a(0x1ad)](a6_0x304f51[_0x436b4a(0x1ab)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x436b4a(0x1ad)](a6_0x304f51[_0x436b4a(0x1ab)](_0x436b4a(0x1a8))));if(_0x2b1f3e){const _0x17a367={'site':_0x31b386};saveProfileToUserConfig(_0x2b1f3e,_0x17a367),console[_0x436b4a(0x1b2)](_0x436b4a(0x1df)+_0x2b1f3e+_0x436b4a(0x1c5));}const _0x3eedf2=_0x2b1f3e?_0x436b4a(0x1e1)+_0x2b1f3e:'';return console[_0x436b4a(0x1b2)](),console[_0x436b4a(0x1b2)](_0x436b4a(0x1d6)),console[_0x436b4a(0x1b2)](_0x436b4a(0x1d2)+_0x3eedf2+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x436b4a(0x1b2)](_0x436b4a(0x1d2)+_0x3eedf2+_0x436b4a(0x1bd)),0x0;}catch(_0x33a10e){if(_0x33a10e instanceof HTTPClientError&&_0x33a10e[_0x436b4a(0x1b7)]===0x191)return printAuthError(_0x33a10e),0x1;return console[_0x436b4a(0x1a7)](a6_0x304f51['red'](_0x436b4a(0x1f3)+(_0x33a10e instanceof Error?_0x33a10e['message']:String(_0x33a10e)))),console[_0x436b4a(0x1a7)](_0x436b4a(0x1f5)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a6_0x3cd29e(0x1e5)]=a6_0x3cd29e(0x1c2);[a6_0x3cd29e(0x1ca)]=a6_0x3cd29e(0x1ed);async[a6_0x3cd29e(0x1d1)](_0x4867e0){const _0x5a4315=a6_0x3cd29e,{options:_0x42b9a4,tdx:_0x21dece}=_0x4867e0,_0x1f2e73=_0x42b9a4['site'],_0x3c0598=_0x42b9a4['profile'],_0x16ac88=_0x3c0598?_0x3c0598:_0x5a4315(0x1cf);console['log'](_0x5a4315(0x1eb)+_0x16ac88+_0x5a4315(0x1da)+_0x1f2e73+')');const _0x44726f=await resolveAPIKeyAsync(_0x1f2e73,_0x3c0598);if(_0x44726f){const {source:_0x2cf039,isDeprecated:_0x1ce3eb}=_0x44726f,_0x4ec247=_0x5a4315(0x1be)+_0x2cf039;console[_0x5a4315(0x1b2)](_0x1ce3eb?a6_0x304f51['yellow'](_0x4ec247):_0x4ec247);}else console[_0x5a4315(0x1b2)](a6_0x304f51[_0x5a4315(0x1ab)](_0x5a4315(0x1c8)));try{const _0x36dd0f=await _0x21dece[_0x5a4315(0x1b5)][_0x5a4315(0x1ea)]();return console[_0x5a4315(0x1b2)](a6_0x304f51[_0x5a4315(0x1b1)](_0x5a4315(0x1cd))),console['log'](_0x5a4315(0x1c9)+_0x36dd0f[_0x5a4315(0x1d9)]),(_0x36dd0f[_0x5a4315(0x1db)]||_0x36dd0f['last_name'])&&console[_0x5a4315(0x1b2)](_0x5a4315(0x1f0)+[_0x36dd0f[_0x5a4315(0x1db)],_0x36dd0f[_0x5a4315(0x1dd)]]['filter'](Boolean)[_0x5a4315(0x1ce)]('\x20')),0x0;}catch(_0x581a30){return _0x581a30 instanceof HTTPClientError&&_0x581a30[_0x5a4315(0x1b7)]===0x191?printAuthError(_0x581a30,!![],_0x3c0598):console['error'](a6_0x304f51[_0x5a4315(0x1d0)]('✗\x20Validation\x20failed:\x20'+(_0x581a30 instanceof Error?_0x581a30[_0x5a4315(0x1c0)]:String(_0x581a30)))),0x1;}}}function a6_0x5234(_0xed40ba,_0x4e933a){_0xed40ba=_0xed40ba-0x1a3;const _0x362140=a6_0x3621();let _0x5234a9=_0x362140[_0xed40ba];return _0x5234a9;}export class AuthClearCommand extends BaseCommand{['name']='auth:clear';[a6_0x3cd29e(0x1ca)]=a6_0x3cd29e(0x1a3);async[a6_0x3cd29e(0x1d1)](_0x4597ba){const _0x55e585=a6_0x3cd29e,{options:_0x1a29c9}=_0x4597ba,_0x20ab52=_0x1a29c9['profile'];console[_0x55e585(0x1b2)](a6_0x304f51['bold'](_0x55e585(0x1b0)));const _0x4ab202=await isKeychainAvailable();if(!_0x4ab202)return console[_0x55e585(0x1a7)](a6_0x304f51[_0x55e585(0x1d0)](_0x55e585(0x1bf))),0x1;const _0x7f89e3=await deleteKeychainAPIKey(_0x20ab52);return _0x7f89e3?(clearCredentialCache(),console[_0x55e585(0x1b2)](_0x55e585(0x1e7)+(_0x20ab52?_0x55e585(0x1de)+_0x20ab52+')':'')),0x0):(console[_0x55e585(0x1b2)]('No\x20API\x20key\x20found\x20in\x20keychain'+(_0x20ab52?'\x20for\x20profile:\x20'+_0x20ab52:'')),0x1);}}function a6_0x3621(){const _0x4517ab=['7348BhQTAc','Enter\x20site\x20name:','✗\x20Validation\x20failed:\x20','Enter\x20your\x20TD\x20API\x20key:','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','logLevel','Setup\x20API\x20key\x20authentication\x20interactively','ap02\x20-\x20Korea','Remove\x20API\x20key\x20from\x20system\x20keychain','length','create','test','error','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','You\x20can\x20find\x20your\x20API\x20key\x20at:','eu\x20\x20\x20-\x20Europe','yellow','90PXOkqf','warn','other','select','tdx:\x20auth\x20clear','green','log','1448253ZylfRh','ERROR','jobs','site','status','jp\x20\x20\x20-\x20Japan','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','1862316oLkcvp','apiKey','jp01','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Read\x20credential\x20from\x20','System\x20keychain\x20is\x20not\x20available','message','72uAArRq','auth','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','25144680znvRMv','\x27\x20registered','507890rcIBoR','us01','No\x20credential\x20found','User:\x20','description','push','profile','✓\x20Authentication\x20successful\x0a','join','N/A','red','execute','\x20\x20tdx','customSite','Setting\x20up\x20authentication\x20for\x20site:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','us\x20\x20\x20-\x20United\x20States','1055558AwGgzs','email','\x20(site:\x20','first_name','eu01','last_name','\x20(profile:\x20','✓\x20Profile\x20\x27','trim','\x20--profile\x20','920OvcvBS','ap02','tdx:\x20auth\x20setup','name','value','✓\x20API\x20key\x20removed\x20from\x20keychain','Validating\x20API\x20key...','text','getUserInfo','tdx\x20profile:\x20','606099HsiZET','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','2CivGeh','\x0aSetup\x20cancelled','Name:\x20'];a6_0x3621=function(){return _0x4517ab;};return a6_0x3621();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x4e28f2=a7_0x1c93;(function(_0x2658c6,_0x2d41a8){const _0x58e7fc=a7_0x1c93,_0x28cab0=_0x2658c6();while(!![]){try{const _0x934512=-parseInt(_0x58e7fc(0x107))/0x1+-parseInt(_0x58e7fc(0x11c))/0x2*(-parseInt(_0x58e7fc(0xee))/0x3)+-parseInt(_0x58e7fc(0xf8))/0x4*(parseInt(_0x58e7fc(0x114))/0x5)+parseInt(_0x58e7fc(0x11b))/0x6+-parseInt(_0x58e7fc(0x105))/0x7+-parseInt(_0x58e7fc(0x102))/0x8+parseInt(_0x58e7fc(0x117))/0x9;if(_0x934512===_0x2d41a8)break;else _0x28cab0['push'](_0x28cab0['shift']());}catch(_0x34f4bf){_0x28cab0['push'](_0x28cab0['shift']());}}}(a7_0x3930,0x755ad));import{BaseCommand}from'./command.js';function a7_0x3930(){const _0x2eb432=['Resolving\x20project\x20\x27','Error:\x20','resolveProjectId','name','message','cause','getAgentId','\x0aStack\x20trace:','chatId','type','2987715nFHofZ','getOrCreateDefaultAgent','Continuing\x20chat:\x20','16463889GRcPba','404','log','CHAT_NOT_FOUND','2555964PKrSIG','274960fdUbFz','agent','stack','error','getDefaultAgent','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','stdout','Using\x20cached\x20default\x20agent:\x20','verbose','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','llmProject','\x20\x20Cause:\x20','6nYTfDz','Using\x20agent\x20from\x20','streamChat','join','chat','\x27...','content','data','event','llm','4HAReOg','description','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','claude-4.5-haiku','includes','args','session\x20context','new','--agent\x20flag','execute','3100744UToVmd','Chat\x20session:\x20','resolveAgentId','3978296SnpwXs','Getting\x20default\x20agent...','496126kJzWQj','\x0aError:\x20','handleChatEvent'];a7_0x3930=function(){return _0x2eb432;};return a7_0x3930();}function a7_0x1c93(_0x1d0431,_0xf1eb59){_0x1d0431=_0x1d0431-0xe7;const _0x39307d=a7_0x3930();let _0x1c932c=_0x39307d[_0x1d0431];return _0x1c932c;}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 handleSDKError(_0x18d33b,_0xdd2b63){const _0x425d35=a7_0x1c93;if(_0x18d33b instanceof SDKError)console[_0x425d35(0x11f)](_0x425d35(0x10b)+_0x18d33b[_0x425d35(0x10e)]),_0xdd2b63[_0x425d35(0xea)]&&(_0x18d33b['cause']&&console[_0x425d35(0x11f)](_0x425d35(0xed)+_0x18d33b[_0x425d35(0x10f)]),_0x18d33b['stack']&&(console[_0x425d35(0x11f)](_0x425d35(0x111)),console[_0x425d35(0x11f)](_0x18d33b[_0x425d35(0x11e)])));else throw _0x18d33b;}export class ChatCommand extends BaseCommand{[a7_0x4e28f2(0x10d)]=a7_0x4e28f2(0xf2);[a7_0x4e28f2(0xf9)]=a7_0x4e28f2(0xfa);['validate'](_0x1c5f12){const _0x4cd158=a7_0x4e28f2,_0x36d84a=_0x1c5f12[_0x4cd158(0xfd)][_0x4cd158(0xf1)]('\x20');if(!_0x36d84a)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a7_0x4e28f2(0xf0)](_0x11da1b,_0x21018d,_0x985f11,_0x3a6905,_0x183178){const _0x5bc5ac=a7_0x4e28f2;for await(const _0x416b40 of _0x11da1b[_0x5bc5ac(0xf7)][_0x5bc5ac(0xf2)](_0x21018d,{'agentId':_0x985f11,'chatId':_0x3a6905})){if(_0x416b40['type']==='metadata'){const _0x39125a=_0x416b40[_0x5bc5ac(0xf5)][_0x5bc5ac(0x112)];saveLastChatId(_0x39125a),_0x183178&&console[_0x5bc5ac(0x11f)](_0x5bc5ac(0x103)+_0x39125a);}else _0x416b40[_0x5bc5ac(0x113)]===_0x5bc5ac(0xf6)&&this[_0x5bc5ac(0x109)](_0x416b40[_0x5bc5ac(0xf5)]);}}async[a7_0x4e28f2(0x110)](_0x43fd70,_0xa7490b,_0x11608b,_0x78b3,_0x31d18c){const _0x1faf22=a7_0x4e28f2,_0x3b7274=_0xa7490b||_0x11608b;if(_0x3b7274){const {projectName:_0x261994,agentName:_0x4a9479}=parseAgentRef(_0x3b7274),_0x59efb5=_0x4a9479||_0x3b7274,_0x16b907=_0x4a9479?_0x261994:_0x78b3;if(!_0x16b907)throw new Error(_0x1faf22(0xe7));if(_0x31d18c){const _0xa4513f=_0xa7490b?_0x1faf22(0x100):_0x1faf22(0xfe);console[_0x1faf22(0x11f)](_0x1faf22(0xef)+_0xa4513f+':\x20'+_0x16b907+'/'+_0x59efb5);}const _0x579395=await withSpinner(_0x1faf22(0x10a)+_0x16b907+'\x27...',()=>_0x43fd70[_0x1faf22(0xf7)][_0x1faf22(0x10c)](_0x16b907),{'verbose':_0x31d18c}),_0x207123=await withSpinner('Resolving\x20agent\x20\x27'+_0x59efb5+_0x1faf22(0xf3),()=>_0x43fd70[_0x1faf22(0xf7)][_0x1faf22(0x104)](_0x59efb5,_0x579395['data']),{'verbose':_0x31d18c});return _0x207123[_0x1faf22(0xf5)];}else{const _0x3336e1=_0x43fd70['llm'][_0x1faf22(0x120)]();if(_0x3336e1)return _0x31d18c&&console[_0x1faf22(0x11f)](_0x1faf22(0xe9)+_0x3336e1[_0x1faf22(0x10d)]),_0x3336e1['id'];const _0x27fff7=await withSpinner(_0x1faf22(0x106),()=>_0x43fd70['llm'][_0x1faf22(0x115)](_0x1faf22(0xfb),0x0),{'verbose':_0x31d18c});return _0x27fff7[_0x1faf22(0xf5)]['id'];}}async[a7_0x4e28f2(0x101)](_0x30d60b){const _0x39555b=a7_0x4e28f2,{options:_0x16b0bc,args:_0x1264c7,tdx:_0xe275da}=_0x30d60b,_0xdbc44e=_0x1264c7[_0x39555b(0xf1)]('\x20'),_0x2a7e92=_0x16b0bc,_0x492356=_0x2a7e92[_0x39555b(0x11d)],_0x1724f3=_0x2a7e92['llmAgent'],_0x203cc7=_0x2a7e92[_0x39555b(0xec)],_0x592c89=_0x2a7e92[_0x39555b(0xff)];try{let _0x1da610,_0x3d6bb9;!_0x592c89&&(_0x3d6bb9=loadLastChatId(),_0x3d6bb9&&_0x16b0bc[_0x39555b(0xea)]&&console[_0x39555b(0x11f)](_0x39555b(0x116)+_0x3d6bb9));(_0x592c89||!_0x3d6bb9)&&(_0x1da610=await this[_0x39555b(0x110)](_0xe275da,_0x492356,_0x1724f3,_0x203cc7,_0x16b0bc[_0x39555b(0xea)]));try{await this['streamChat'](_0xe275da,_0xdbc44e,_0x1da610,_0x3d6bb9,_0x16b0bc[_0x39555b(0xea)]);}catch(_0xc4b71){const _0x289fb6=_0xc4b71 instanceof SDKError&&_0xc4b71['code']===ErrorCode[_0x39555b(0x11a)]||_0xc4b71 instanceof Error&&_0xc4b71[_0x39555b(0x10e)][_0x39555b(0xfc)](_0x39555b(0x118));if(_0x289fb6)_0x16b0bc[_0x39555b(0xea)]&&console['error'](_0x39555b(0xeb)),!_0x1da610&&(_0x1da610=await this[_0x39555b(0x110)](_0xe275da,_0x492356,_0x1724f3,_0x203cc7,_0x16b0bc[_0x39555b(0xea)])),await this[_0x39555b(0xf0)](_0xe275da,_0xdbc44e,_0x1da610,undefined,_0x16b0bc['verbose']);else throw _0xc4b71;}return console[_0x39555b(0x119)](),0x0;}catch(_0x54e166){return console[_0x39555b(0x11f)](),handleSDKError(_0x54e166,_0x16b0bc),0x1;}}['handleChatEvent'](_0xebb069){const _0x26679e=a7_0x4e28f2;if(_0x26679e(0xf4)in _0xebb069)process[_0x26679e(0xe8)]['write'](_0xebb069['content']);else _0x26679e(0x11f)in _0xebb069&&console[_0x26679e(0x11f)](_0x26679e(0x108)+_0xebb069[_0x26679e(0x11f)]);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a8_0x3c13e5=a8_0x138c;(function(_0x3d2bc4,_0x17e0df){const _0x1a9037=a8_0x138c,_0x4c7df7=_0x3d2bc4();while(!![]){try{const _0x2ea2bb=parseInt(_0x1a9037(0x13e))/0x1*(parseInt(_0x1a9037(0x17a))/0x2)+-parseInt(_0x1a9037(0x188))/0x3+-parseInt(_0x1a9037(0x1a4))/0x4+parseInt(_0x1a9037(0x15d))/0x5+parseInt(_0x1a9037(0x127))/0x6+-parseInt(_0x1a9037(0x14c))/0x7*(-parseInt(_0x1a9037(0x166))/0x8)+-parseInt(_0x1a9037(0x11f))/0x9*(parseInt(_0x1a9037(0x12e))/0xa);if(_0x2ea2bb===_0x17e0df)break;else _0x4c7df7['push'](_0x4c7df7['shift']());}catch(_0x461ef3){_0x4c7df7['push'](_0x4c7df7['shift']());}}}(a8_0x2a16,0xcc505));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';function a8_0x138c(_0x202387,_0x2b3cc7){_0x202387=_0x202387-0x10e;const _0x2a1626=a8_0x2a16();let _0x138c13=_0x2a1626[_0x202387];return _0x138c13;}import a8_0x1a4a9b 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_0x3c13e5(0x13c);function handleInstallationError(_0x218bbb,_0x5a23ea,_0x118be4,_0x5099a7){const _0x8acccf=a8_0x3c13e5;errorContains(_0x218bbb,'already\x20exists',_0x8acccf(0x149),_0x8acccf(0x1a2))?(_0x118be4[_0x8acccf(0x12b)]='✓\x20'+_0x5a23ea+_0x8acccf(0x178),_0x5099a7?.[_0x8acccf(0x174)](_0x5a23ea+'\x20already\x20configured'),_0x218bbb instanceof SDKError&&_0x218bbb[_0x8acccf(0x15f)]&&_0x5099a7?.[_0x8acccf(0x177)](_0x8acccf(0x13b)+_0x218bbb[_0x8acccf(0x15f)][_0x8acccf(0x180)])):(_0x118be4['warn'](_0x8acccf(0x11c)+_0x5a23ea),_0x5099a7?.[_0x8acccf(0x12a)](_0x5a23ea+_0x8acccf(0x18d),_0x218bbb));}export function parseVersion(_0xb5fb9d){const _0xd0cafa=a8_0x3c13e5,_0x504a12=_0xb5fb9d[_0xd0cafa(0x171)]()[_0xd0cafa(0x167)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x504a12)return null;return{'major':parseInt(_0x504a12[0x1],0xa),'minor':parseInt(_0x504a12[0x2],0xa),'patch':parseInt(_0x504a12[0x3],0xa)};}export function compareVersions(_0x4cc5a3,_0x4b15aa){const _0x43ca77=a8_0x3c13e5;if(_0x4cc5a3[_0x43ca77(0x197)]!==_0x4b15aa[_0x43ca77(0x197)])return _0x4cc5a3[_0x43ca77(0x197)]-_0x4b15aa[_0x43ca77(0x197)];if(_0x4cc5a3[_0x43ca77(0x162)]!==_0x4b15aa[_0x43ca77(0x162)])return _0x4cc5a3[_0x43ca77(0x162)]-_0x4b15aa[_0x43ca77(0x162)];return _0x4cc5a3[_0x43ca77(0x129)]-_0x4b15aa['patch'];}async function checkClaudeVersion(_0x46bcca,_0x3a5fc4){const _0x115fcc=a8_0x3c13e5;_0x3a5fc4?.[_0x115fcc(0x177)](_0x115fcc(0x16e)+_0x46bcca+')');const _0x1978a4=await executeClaudeCommand([_0x115fcc(0x15c)],undefined,_0x3a5fc4),_0xfc62b9=parseVersion(_0x1978a4);if(!_0xfc62b9){_0x3a5fc4?.[_0x115fcc(0x185)](_0x115fcc(0x1a1)+_0x1978a4);return;}const _0x2dffd1=_0xfc62b9[_0x115fcc(0x197)]+'.'+_0xfc62b9[_0x115fcc(0x162)]+'.'+_0xfc62b9[_0x115fcc(0x129)],_0x59381c=parseVersion(_0x46bcca);if(!_0x59381c){_0x3a5fc4?.[_0x115fcc(0x185)](_0x115fcc(0x144)+_0x46bcca);return;}if(compareVersions(_0xfc62b9,_0x59381c)<0x0){_0x3a5fc4?.[_0x115fcc(0x12a)](_0x115fcc(0x16c)+_0x2dffd1+_0x115fcc(0x169)+_0x46bcca+')');throw new SDKError(ErrorCode['CLAUDE_CODE_UNSUPPORTED_VERSION'],'Claude\x20Code\x20version\x20'+_0x2dffd1+_0x115fcc(0x1a3)+_0x46bcca+_0x115fcc(0x12d),undefined,{'helpText':_0x115fcc(0x141)});}_0x3a5fc4?.[_0x115fcc(0x177)](_0x115fcc(0x16c)+_0x2dffd1+_0x115fcc(0x140));}async function executeClaudeCommand(_0x100b3e,_0x19bd1a,_0x109374){const _0x40fdfc=a8_0x3c13e5;return _0x109374?.['info'](_0x40fdfc(0x18b)+_0x100b3e['join']('\x20')),new Promise((_0x3cf39c,_0x1d4909)=>{const _0x3829c=_0x40fdfc,_0x599fc3=spawn(_0x3829c(0x143),_0x100b3e,{'stdio':_0x3829c(0x18e)});let _0x3fabdf='',_0x5d9832='';_0x599fc3[_0x3829c(0x153)]['on']('data',_0x2a68ab=>{const _0xe5826e=_0x3829c;_0x3fabdf+=_0x2a68ab[_0xe5826e(0x121)]();}),_0x599fc3['stderr']['on']('data',_0xd920e6=>{const _0x44b46e=_0x3829c;_0x5d9832+=_0xd920e6[_0x44b46e(0x121)]();}),_0x599fc3['on'](_0x3829c(0x12a),_0x1d3a46=>{const _0x4484e9=_0x3829c;_0x1d3a46[_0x4484e9(0x18f)]==='ENOENT'?(_0x109374?.[_0x4484e9(0x12a)](_0x4484e9(0x134)),_0x1d4909(new SDKError(ErrorCode[_0x4484e9(0x155)],_0x4484e9(0x134),_0x1d3a46,{'helpText':_0x4484e9(0x151)}))):(_0x109374?.['error']('Command\x20spawn\x20error:\x20'+_0x1d3a46[_0x4484e9(0x180)]),_0x1d4909(new SDKError(ErrorCode[_0x4484e9(0x11e)],_0x4484e9(0x116)+_0x1d3a46['message'],_0x1d3a46)));}),_0x599fc3['on'](_0x3829c(0x170),_0x57a85e=>{const _0x5c50b1=_0x3829c;if(_0x57a85e===0x0)_0x3cf39c(_0x3fabdf);else _0x19bd1a?(_0x109374?.['error'](_0x5c50b1(0x181)+_0x57a85e+_0x5c50b1(0x112)+_0x100b3e[_0x5c50b1(0x115)]('\x20')),_0x1d4909(new SDKError(ErrorCode[_0x5c50b1(0x113)],_0x19bd1a,new Error(_0x5d9832)))):_0x3cf39c('');});});}async function ensureMcpServer(_0x372e27,_0x3d9011,_0x4a5c42,_0x20a22f,_0x1ec372){const _0xf1163a=a8_0x3c13e5;_0x20a22f[_0xf1163a(0x12b)]='Configuring\x20MCP\x20server\x20\x27'+_0x372e27+_0xf1163a(0x192),await executeClaudeCommand([_0xf1163a(0x1a5),_0xf1163a(0x19c),_0x372e27,_0x3d9011,_0xf1163a(0x148),_0x4a5c42],_0xf1163a(0x184)+_0x372e27+'\x27',_0x1ec372),_0x20a22f[_0xf1163a(0x12b)]=_0xf1163a(0x159)+_0x372e27+_0xf1163a(0x198);}async function ensureMarketplace(_0x2b77b6,_0x26c724,_0x19c464,_0x15daaf){const _0x45261d=a8_0x3c13e5;_0x19c464[_0x45261d(0x12b)]='Configuring\x20marketplace\x20\x27'+_0x2b77b6+_0x45261d(0x192),await executeClaudeCommand(['plugin',_0x45261d(0x165),'add',_0x26c724],_0x45261d(0x150)+_0x2b77b6+'\x27',_0x15daaf),_0x19c464[_0x45261d(0x12b)]=_0x45261d(0x1a0)+_0x2b77b6+_0x45261d(0x198);}async function updateMarketplace(_0x4123a5,_0x51e454,_0x4e9317){const _0x421f24=a8_0x3c13e5;_0x51e454[_0x421f24(0x12b)]=_0x421f24(0x17c)+_0x4123a5+_0x421f24(0x192),await executeClaudeCommand(['plugin',_0x421f24(0x165),_0x421f24(0x14d)],_0x421f24(0x139)+_0x4123a5+'\x27',_0x4e9317),_0x51e454['text']=_0x421f24(0x1a0)+_0x4123a5+_0x421f24(0x18c);}async function ensurePlugin(_0x5341e8,_0x2b5b1c,_0x37a11f,_0x1fe67a){const _0xcccebe=a8_0x3c13e5;_0x37a11f[_0xcccebe(0x12b)]=_0xcccebe(0x15b)+_0x5341e8+_0xcccebe(0x192),await executeClaudeCommand(['plugin',_0xcccebe(0x173),_0x5341e8+'@'+_0x2b5b1c],_0xcccebe(0x154)+_0x5341e8+'\x27',_0x1fe67a),_0x37a11f[_0xcccebe(0x12b)]=_0xcccebe(0x147)+_0x5341e8+_0xcccebe(0x16b);}async function createClaudeSettings(_0x4cad04,_0x5dbf48='sonnet',_0x2a95fd){const _0x3cde60=a8_0x3c13e5,_0x5732b1=join(process[_0x3cde60(0x175)](),'.claude'),_0x301ff3=join(_0x5732b1,_0x3cde60(0x117));await mkdir(_0x5732b1,{'recursive':!![]});let _0x32f8fd={};if(existsSync(_0x301ff3))try{const _0x1bb5da=await readFile(_0x301ff3,_0x3cde60(0x110));_0x32f8fd=JSON[_0x3cde60(0x138)](_0x1bb5da);}catch{_0x32f8fd={};}const _0x49e97d=_0x32f8fd[_0x3cde60(0x195)]||{},_0x3723fe={'ANTHROPIC_BASE_URL':_0x49e97d['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x49e97d[_0x3cde60(0x118)],'ANTHROPIC_AUTH_TOKEN':_0x49e97d[_0x3cde60(0x190)],'statusLine':_0x32f8fd[_0x3cde60(0x12f)]},_0x1e5260={..._0x32f8fd,'env':{..._0x49e97d,'ANTHROPIC_BASE_URL':'http://127.0.0.1:'+_0x4cad04,'ANTHROPIC_MODEL':_0x5dbf48,'ANTHROPIC_AUTH_TOKEN':_0x3cde60(0x156)},'statusLine':{'type':'command','command':_0x2a95fd?_0x3cde60(0x18a)+_0x2a95fd+_0x3cde60(0x158):'tdx\x20claude\x20statusline'}};return await writeFile(_0x301ff3,JSON[_0x3cde60(0x168)](_0x1e5260,null,0x2)+'\x0a'),_0x3723fe;}async function restoreClaudeSettings(_0x2dc62d){const _0x54e331=a8_0x3c13e5,_0x4a7476=join(process[_0x54e331(0x175)](),'.claude'),_0x366a67=join(_0x4a7476,'settings.local.json');if(!existsSync(_0x366a67))return;try{const _0x2dbfa4=await readFile(_0x366a67,_0x54e331(0x110)),_0xc96f4e=JSON[_0x54e331(0x138)](_0x2dbfa4),_0x106535=_0xc96f4e[_0x54e331(0x195)]||{},_0x64bb38=_0x106535[_0x54e331(0x13a)],_0x3b5f52=((()=>{const _0x32a565=_0x54e331;if(typeof _0x64bb38!=='string')return![];try{const _0x457e2d=new URL(_0x64bb38);return _0x457e2d[_0x32a565(0x17d)]===_0x32a565(0x19f)||_0x457e2d[_0x32a565(0x17d)]===_0x32a565(0x119);}catch{return![];}})());_0x3b5f52?(delete _0x106535[_0x54e331(0x13a)],delete _0x106535[_0x54e331(0x118)],delete _0x106535[_0x54e331(0x190)]):(_0x2dc62d[_0x54e331(0x13a)]!==undefined?_0x106535[_0x54e331(0x13a)]=_0x2dc62d['ANTHROPIC_BASE_URL']:delete _0x106535[_0x54e331(0x13a)],_0x2dc62d['ANTHROPIC_MODEL']!==undefined?_0x106535[_0x54e331(0x118)]=_0x2dc62d[_0x54e331(0x118)]:delete _0x106535[_0x54e331(0x118)],_0x2dc62d[_0x54e331(0x190)]!==undefined?_0x106535['ANTHROPIC_AUTH_TOKEN']=_0x2dc62d[_0x54e331(0x190)]:delete _0x106535[_0x54e331(0x190)]);const _0x2e2d34=_0xc96f4e['statusLine'],_0x6f0959=((()=>{const _0x1ea000=_0x54e331;if(!_0x2e2d34||typeof _0x2e2d34!=='object')return![];if(_0x2e2d34[_0x1ea000(0x128)]!==_0x1ea000(0x11d))return![];if(typeof _0x2e2d34['command']!==_0x1ea000(0x14a))return![];return _0x2e2d34[_0x1ea000(0x11d)][_0x1ea000(0x142)](_0x1ea000(0x15a))&&_0x2e2d34[_0x1ea000(0x11d)][_0x1ea000(0x142)](_0x1ea000(0x132));})());if(_0x6f0959)delete _0xc96f4e['statusLine'];else _0x2dc62d[_0x54e331(0x12f)]!==undefined?_0xc96f4e[_0x54e331(0x12f)]=_0x2dc62d[_0x54e331(0x12f)]:delete _0xc96f4e[_0x54e331(0x12f)];_0xc96f4e[_0x54e331(0x195)]=_0x106535,await writeFile(_0x366a67,JSON[_0x54e331(0x168)](_0xc96f4e,null,0x2)+'\x0a');}catch{}}function a8_0x2a16(){const _0x1bbd25=['\x20already\x20configured','proxy','2sSkMlu','findClaudePath','Updating\x20marketplace\x20\x27','hostname','originalSettings','tdx-skills','message','Command\x20failed\x20(exit\x20','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','start','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','warn','data','attributes','47670QssucG','Setup\x20failed','tdx\x20--profile\x20','Executing:\x20claude\x20','\x27\x20updated','\x20configuration\x20failed','pipe','code','ANTHROPIC_AUTH_TOKEN','resume','\x27...','sonnet','init','env','verbose','major','\x27\x20configured','log','Checking\x20Claude\x20Code\x20version...','server','add','td-skills\x20Plugins','http://127.0.0.1:','localhost','✓\x20Marketplace\x20\x27','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','already\x20configured','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','4844016TsgYBH','mcp','logLevel','stop','utf-8','unshift','):\x20claude\x20','INSTALLATION_FAILED','fail','join','Failed\x20to\x20spawn\x20claude\x20command:\x20','settings.local.json','ANTHROPIC_MODEL','127.0.0.1','Initializing...','model','Warning:\x20Failed\x20to\x20configure\x20','command','INTERNAL','9lmRKEj','https://docs.treasuredata.com/mcp','toString','red','execute','port','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Creating\x20.claude/settings.local.json...','9938550OzYXZM','type','patch','error','text','TD\x20Docs\x20MCP\x20Server','\x20or\x20later.','21638020HSMnjn','statusLine','td-skills','getCurrent','statusline','✓\x20Using\x20project:\x20','Claude\x20Code\x20CLI\x20not\x20found','which','inherit','Initializing\x20proxy\x20logger...','parse','Failed\x20to\x20update\x20marketplace\x20\x27','ANTHROPIC_BASE_URL','Command\x20output:\x20','2.0.20','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','623099lpZScU','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','\x20meets\x20minimum\x20requirement','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','includes','claude','Invalid\x20minimum\x20version\x20format:\x20','Setting\x20up\x20project...','green','✓\x20Plugin\x20\x27','--transport','already\x20installed','string','sql-skills','7eaOdEv','update','Starting\x20TD\x20LLM\x20proxy\x20server...','workflow-skills','Failed\x20to\x20configure\x20marketplace\x20\x27','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','✓\x20Logs\x20saved\x20to\x20','stdout','Failed\x20to\x20install\x20plugin\x20\x27','CLAUDE_CODE_NOT_FOUND','tdx-managed-proxy','✓\x20Logging\x20to\x20','\x20claude\x20statusline','✓\x20MCP\x20server\x20\x27','tdx','Installing\x20plugin\x20\x27','--version','2314755XSuTIw','✓\x20Claude\x20Code\x20version\x20OK','cause','site','logger','minor','profile','user','marketplace','11880720FCyytS','match','stringify','\x20is\x20too\x20old\x20(minimum:\x20','Claude\x20Code\x20version\x20check\x20failed','\x27\x20installed','Claude\x20Code\x20version\x20','close','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','Finding\x20available\x20port...','exit','trim','name','install','info','cwd','continue','debug'];a8_0x2a16=function(){return _0x1bbd25;};return a8_0x2a16();}export class ClaudeCommand extends BaseCommand{[a8_0x3c13e5(0x172)]=a8_0x3c13e5(0x143);['description']=a8_0x3c13e5(0x13f);[a8_0x3c13e5(0x19b)];['originalSettings'];['logger'];[a8_0x3c13e5(0x124)];async[a8_0x3c13e5(0x123)](_0xeacd41){const _0x24e7fa=a8_0x3c13e5,{tdx:_0x1c9033,options:_0x440126,args:_0x4a9750}=_0xeacd41;try{const _0x354a8=_0x440126,_0x37b852=_0x354a8[_0x24e7fa(0x11b)]||_0x24e7fa(0x193),_0x3d2d43=_0x354a8[_0x24e7fa(0x179)]===![],_0x3a9b5b=_0x354a8[_0x24e7fa(0x176)]===!![],_0x4a14e0=_0x354a8[_0x24e7fa(0x191)]===!![],_0x2ae6e1=[..._0x4a9750];if(_0x3a9b5b)_0x2ae6e1[_0x24e7fa(0x111)]('-c');else _0x4a14e0&&_0x2ae6e1[_0x24e7fa(0x111)]('-r');const _0x47e794=createCommandSpinner(_0x24e7fa(0x11a),{'verbose':_0x440126[_0x24e7fa(0x196)]});_0x47e794[_0x24e7fa(0x183)]();try{if(!_0x3d2d43){_0x47e794['text']=_0x24e7fa(0x16f),this[_0x24e7fa(0x124)]=await findAvailablePort(0xfa0),_0x47e794['text']='✓\x20Port\x20'+this[_0x24e7fa(0x124)],_0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x145);const _0x5c855e=await _0x1c9033['llm']['getOrCreateDefaultProject'](),_0x1eef1f=_0x5c855e['id'];_0x47e794['text']=_0x24e7fa(0x133)+_0x5c855e[_0x24e7fa(0x187)]['name'];const _0x17cb54=_0x440126[_0x24e7fa(0x163)];try{const _0xbf8266=await _0x1c9033[_0x24e7fa(0x164)][_0x24e7fa(0x131)]();_0xbf8266['account_id']&&writeCachedAccountInfo(_0x440126[_0x24e7fa(0x160)],_0xbf8266['account_id'],_0x17cb54);}catch{}_0x47e794['text']=_0x24e7fa(0x137),this[_0x24e7fa(0x161)]=new TDXLogger(_0x440126[_0x24e7fa(0x10e)],!![]),await this['logger'][_0x24e7fa(0x194)]();const _0x366b33=this[_0x24e7fa(0x161)]['getLogPath']();_0x47e794['text']=_0x24e7fa(0x157)+_0x366b33,_0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x14e),this[_0x24e7fa(0x19b)]=new ProxyServer({'port':this['port'],'projectId':_0x1eef1f,'tdx':_0x1c9033,'logger':this[_0x24e7fa(0x161)],'site':_0x440126['site']}),await this[_0x24e7fa(0x19b)][_0x24e7fa(0x183)](),_0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x13d)+this[_0x24e7fa(0x124)],_0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x126),this['originalSettings']=await createClaudeSettings(this[_0x24e7fa(0x124)],_0x37b852,_0x17cb54),_0x47e794[_0x24e7fa(0x12b)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x125);try{_0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x19a),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x24e7fa(0x161)]),_0x47e794[_0x24e7fa(0x12b)]=_0x24e7fa(0x15e);}catch(_0x5dd525){_0x47e794[_0x24e7fa(0x114)](_0x24e7fa(0x16a));throw _0x5dd525;}try{await ensureMcpServer('td-docs',_0x24e7fa(0x120),'http',_0x47e794,this[_0x24e7fa(0x161)]);}catch(_0xe304d4){handleInstallationError(_0xe304d4,_0x24e7fa(0x12c),_0x47e794,this['logger']);}try{await ensureMarketplace('td-skills','https://github.com/treasure-data/td-skills',_0x47e794,this[_0x24e7fa(0x161)]),await updateMarketplace(_0x24e7fa(0x130),_0x47e794,this[_0x24e7fa(0x161)]),await ensurePlugin(_0x24e7fa(0x14b),_0x24e7fa(0x130),_0x47e794,this[_0x24e7fa(0x161)]),await ensurePlugin(_0x24e7fa(0x14f),_0x24e7fa(0x130),_0x47e794,this['logger']),await ensurePlugin(_0x24e7fa(0x17f),_0x24e7fa(0x130),_0x47e794,this['logger']);}catch(_0x14bbb4){handleInstallationError(_0x14bbb4,_0x24e7fa(0x19d),_0x47e794,this[_0x24e7fa(0x161)]);}_0x47e794[_0x24e7fa(0x10f)]();}catch(_0x186783){_0x47e794['fail'](_0x24e7fa(0x189));throw _0x186783;}const _0x31ef7c=await this['findClaudePath']();if(!_0x31ef7c)throw new SDKError(ErrorCode[_0x24e7fa(0x155)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x39fd9b={...process[_0x24e7fa(0x195)]};!_0x3d2d43&&(_0x39fd9b[_0x24e7fa(0x13a)]=_0x24e7fa(0x19e)+this['port'],_0x39fd9b[_0x24e7fa(0x118)]=_0x37b852,_0x39fd9b['ANTHROPIC_AUTH_TOKEN']=_0x24e7fa(0x156));const _0x590846=spawn(_0x31ef7c,_0x2ae6e1,{'stdio':_0x24e7fa(0x136),'env':_0x39fd9b}),_0x1e91c3=await new Promise(_0x3d59e0=>{const _0x5ecd21=_0x24e7fa;_0x590846['on'](_0x5ecd21(0x170),_0x2aff5e=>{_0x3d59e0(_0x2aff5e||0x0);}),_0x590846['on']('error',_0x462fe5=>{const _0x479bba=_0x5ecd21;console[_0x479bba(0x12a)](a8_0x1a4a9b[_0x479bba(0x122)]('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x462fe5[_0x479bba(0x180)])),_0x3d59e0(0x1);});});this['server']&&(await this[_0x24e7fa(0x19b)][_0x24e7fa(0x10f)](),console['log'](a8_0x1a4a9b['green'](_0x24e7fa(0x182))));if(this[_0x24e7fa(0x161)]){await this[_0x24e7fa(0x161)][_0x24e7fa(0x16d)]();const _0x446081=this[_0x24e7fa(0x161)]['getLogPath']();console[_0x24e7fa(0x199)](a8_0x1a4a9b[_0x24e7fa(0x146)](_0x24e7fa(0x152)+_0x446081));}return this[_0x24e7fa(0x17e)]&&(await restoreClaudeSettings(this[_0x24e7fa(0x17e)]),console['log'](a8_0x1a4a9b[_0x24e7fa(0x146)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x1e91c3;}catch(_0xc06ebf){this[_0x24e7fa(0x19b)]&&await this[_0x24e7fa(0x19b)][_0x24e7fa(0x10f)]();this['logger']&&await this['logger'][_0x24e7fa(0x16d)]();this['originalSettings']&&await restoreClaudeSettings(this['originalSettings']);throw _0xc06ebf;}}async[a8_0x3c13e5(0x17b)](){return new Promise(_0x35a8e3=>{const _0x2bea72=a8_0x138c,_0x3f61b1=spawn(_0x2bea72(0x135),[_0x2bea72(0x143)]);let _0x4ce8f5='';_0x3f61b1['stdout']['on'](_0x2bea72(0x186),_0x2a57ce=>{const _0x256fd6=_0x2bea72;_0x4ce8f5+=_0x2a57ce[_0x256fd6(0x121)]();}),_0x3f61b1['on']('exit',_0x42bc19=>{const _0x314f14=_0x2bea72;_0x42bc19===0x0&&_0x4ce8f5[_0x314f14(0x171)]()?_0x35a8e3(_0x4ce8f5[_0x314f14(0x171)]()):_0x35a8e3(null);});});}}
|
|
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 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a9_0x3ca5b2=a9_0x9b6c;function a9_0x9b6c(_0xaf2eb8,_0x269321){_0xaf2eb8=_0xaf2eb8-0x1e3;const _0x104fc7=a9_0x104f();let _0x9b6c37=_0x104fc7[_0xaf2eb8];return _0x9b6c37;}(function(_0x528860,_0x5b5ba2){const _0x47caec=a9_0x9b6c,_0x39cc5b=_0x528860();while(!![]){try{const _0x401921=parseInt(_0x47caec(0x20b))/0x1*(parseInt(_0x47caec(0x1e8))/0x2)+parseInt(_0x47caec(0x1fa))/0x3*(parseInt(_0x47caec(0x1eb))/0x4)+parseInt(_0x47caec(0x1f5))/0x5*(parseInt(_0x47caec(0x205))/0x6)+parseInt(_0x47caec(0x1f0))/0x7*(-parseInt(_0x47caec(0x1e7))/0x8)+parseInt(_0x47caec(0x1f7))/0x9+-parseInt(_0x47caec(0x1ed))/0xa*(-parseInt(_0x47caec(0x202))/0xb)+parseInt(_0x47caec(0x1ef))/0xc*(-parseInt(_0x47caec(0x203))/0xd);if(_0x401921===_0x5b5ba2)break;else _0x39cc5b['push'](_0x39cc5b['shift']());}catch(_0x5d5ca5){_0x39cc5b['push'](_0x39cc5b['shift']());}}}(a9_0x104f,0xbec45));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';function a9_0x104f(){const _0x25715e=['\x20today\x20/\x20','statusline','200qiTkmi','stdin','405240XkxkbR','description','3228zUVaWe','2894983MxeURo','tdx\x20','\x20session\x20/\x20','session_id','close','5ygmiVa','todayCredits','13378707SjiKQP','monthCredits','\x20-\x20','53886zAgTyo','options','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','accountId','\x20month','💎\x20tdx\x20-\x20Claude','name','Claude','11GmhdcS','53092TRxkBB','💎\x20','1213278VcvMHY','line','push','execute','latestInputTokens','\x20|\x20','179lpOKQt','sessionCredits','model','log','join','24SLqpMF','5512LTXKOM'];a9_0x104f=function(){return _0x25715e;};return a9_0x104f();}import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x542b84=0x64){return new Promise(_0x4e196d=>{const _0x4ea40d=a9_0x9b6c;let _0x22da0f='',_0x559d9c=![];const _0x3e94c2=createInterface({'input':process[_0x4ea40d(0x1ec)],'terminal':![]}),_0x31ad8a=_0x452fb3=>{const _0x406c3a=_0x4ea40d;if(_0x559d9c)return;_0x559d9c=!![],clearTimeout(_0x3b8fbb),_0x3e94c2[_0x406c3a(0x1f4)](),_0x4e196d(_0x452fb3);},_0x3b8fbb=setTimeout(()=>{_0x31ad8a(null);},_0x542b84);_0x3e94c2['on'](_0x4ea40d(0x206),_0x5a8024=>{_0x22da0f+=_0x5a8024;}),_0x3e94c2['on'](_0x4ea40d(0x1f4),()=>{if(_0x559d9c)return;try{const _0x3b5c7f=JSON['parse'](_0x22da0f);_0x31ad8a(_0x3b5c7f);}catch{_0x31ad8a(null);}});});}function formatCredits(_0x1634c1){return _0x1634c1['toFixed'](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a9_0x3ca5b2(0x200)]=a9_0x3ca5b2(0x1ea);[a9_0x3ca5b2(0x1ee)]=a9_0x3ca5b2(0x1fc);async[a9_0x3ca5b2(0x208)](_0x4a16be){const _0x1fe6fb=a9_0x3ca5b2;try{const _0x5021e1=await readStdinJson();if(!_0x5021e1?.[_0x1fe6fb(0x1f3)])return console[_0x1fe6fb(0x1e5)](_0x1fe6fb(0x1ff)),0x0;const _0x393424=_0x5021e1[_0x1fe6fb(0x1f3)],_0x3b8838=_0x5021e1[_0x1fe6fb(0x1e4)]?.['id']||'',_0x25c55d=_0x5021e1['profile']||_0x4a16be[_0x1fe6fb(0x1fb)]['profile'],_0x244876=await getUsageStats(_0x393424,_0x25c55d),_0x1b78a0=[],_0x327f4c=readCachedAccountInfo(_0x25c55d),_0x10f9d2=_0x327f4c?_0x1fe6fb(0x1f1)+_0x327f4c['site']+':'+_0x327f4c[_0x1fe6fb(0x1fd)]:'tdx',_0x5c33a7=_0x3b8838?getModelDisplayName(_0x3b8838):_0x1fe6fb(0x201);_0x1b78a0['push'](_0x1fe6fb(0x204)+_0x10f9d2+_0x1fe6fb(0x1f9)+_0x5c33a7);const _0x5bc86e=formatCredits(_0x244876[_0x1fe6fb(0x1e3)]),_0x328121=formatCredits(_0x244876[_0x1fe6fb(0x1f6)]),_0x3aa6f3=formatCredits(_0x244876[_0x1fe6fb(0x1f8)]);_0x1b78a0[_0x1fe6fb(0x207)]('🪙\x20credit:\x20'+_0x5bc86e+_0x1fe6fb(0x1f2)+_0x328121+_0x1fe6fb(0x1e9)+_0x3aa6f3+_0x1fe6fb(0x1fe));if(_0x244876[_0x1fe6fb(0x209)]>0x0&&_0x3b8838){const _0x2b984c=formatTokenCount(_0x244876['latestInputTokens']),_0x1438bb=calculateContextPercentage(_0x244876[_0x1fe6fb(0x209)],_0x3b8838);_0x1b78a0[_0x1fe6fb(0x207)]('🧠\x20'+_0x2b984c+'\x20('+_0x1438bb+'%)');}return console[_0x1fe6fb(0x1e5)](_0x1b78a0[_0x1fe6fb(0x1e6)](_0x1fe6fb(0x20a))),0x0;}catch{return console[_0x1fe6fb(0x1e5)](_0x1fe6fb(0x1ff)),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a10_0xc20cc2=a10_0x5350;function a10_0x5350(_0x5cb703,_0x1dd58d){_0x5cb703=_0x5cb703-0x123;const _0x217b63=a10_0x217b();let _0x535024=_0x217b63[_0x5cb703];return _0x535024;}(function(_0x1a474b,_0x25713d){const _0x54e1a5=a10_0x5350,_0x1e4ffa=_0x1a474b();while(!![]){try{const _0x159c10=parseInt(_0x54e1a5(0x151))/0x1+parseInt(_0x54e1a5(0x141))/0x2+-parseInt(_0x54e1a5(0x159))/0x3*(-parseInt(_0x54e1a5(0x123))/0x4)+parseInt(_0x54e1a5(0x12c))/0x5*(-parseInt(_0x54e1a5(0x135))/0x6)+parseInt(_0x54e1a5(0x13e))/0x7*(-parseInt(_0x54e1a5(0x156))/0x8)+parseInt(_0x54e1a5(0x158))/0x9*(parseInt(_0x54e1a5(0x15b))/0xa)+-parseInt(_0x54e1a5(0x14d))/0xb;if(_0x159c10===_0x25713d)break;else _0x1e4ffa['push'](_0x1e4ffa['shift']());}catch(_0x47d001){_0x1e4ffa['push'](_0x1e4ffa['shift']());}}}(a10_0x217b,0x72ed1));function a10_0x217b(){const _0x29c4bd=['description','\x20days\x20ago','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','Unknown\x20error','outputStructured','credits','today\x20','(default)','119aEBntd','usage','\x20\x20Total:\x20\x20\x20','764958ROoipK','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','getTime','entryCount','Error:\x20','max','outputTable','2-digit','format','message','Usage\x20by\x20Profile','toFixed','5375579oYMjcy','profile','\x20\x20Month:\x20\x20\x20','map','935569mMFIBC','lastUsedAt','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','log','bold','330248AwshOV','execute','8244FOMkVr','82524GtWLaF','en-CA','6780WYhCdg','Credits','all','never','cyan','toLocaleDateString','red','padStart','40SyDpdE','monthCredits','repeat','round','todayCredits','short','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','\x20credits','\x20\x20Today:\x20\x20\x20','6415ZRoYAM','numeric','padEnd','default','yesterday','en-US','json','dim','length','2586WnsawN'];a10_0x217b=function(){return _0x29c4bd;};return a10_0x217b();}import a10_0xf98f51 from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x5870b5){const _0x4aa2fa=a10_0x5350;return _0x5870b5[_0x4aa2fa(0x14c)](0x2);}function formatLastUsed(_0x4fc5ec){const _0x4dee57=a10_0x5350;if(!_0x4fc5ec)return _0x4dee57(0x15e);const _0x144f63=new Date(_0x4fc5ec),_0x3422f2=new Date(),_0x12ae9b=_0x144f63[_0x4dee57(0x160)](_0x4dee57(0x15a)),_0xfd2b97=_0x3422f2[_0x4dee57(0x160)](_0x4dee57(0x15a));if(_0x12ae9b===_0xfd2b97)return _0x4dee57(0x13c)+_0x144f63['toLocaleTimeString']('en-US',{'hour':_0x4dee57(0x148),'minute':_0x4dee57(0x148)});const _0x1c3876=new Date(_0x12ae9b),_0x300a3a=new Date(_0xfd2b97),_0xc85071=Math[_0x4dee57(0x126)]((_0x300a3a['getTime']()-_0x1c3876[_0x4dee57(0x143)]())/(0x18*0x3c*0x3c*0x3e8));if(_0xc85071===0x1)return _0x4dee57(0x130);else return _0xc85071>0x1&&_0xc85071<0x7?_0xc85071+_0x4dee57(0x137):_0x144f63['toLocaleDateString'](_0x4dee57(0x131),{'month':_0x4dee57(0x128),'day':_0x4dee57(0x12d)});}export class ClaudeUsageCommand extends BaseCommand{['name']=a10_0xc20cc2(0x13f);[a10_0xc20cc2(0x136)]=a10_0xc20cc2(0x129);async[a10_0xc20cc2(0x157)](_0x654439){const _0x46ea44=a10_0xc20cc2,{options:_0x3d6ceb}=_0x654439,_0x191406=_0x3d6ceb[_0x46ea44(0x149)]===_0x46ea44(0x132)||_0x3d6ceb[_0x46ea44(0x149)]==='jsonl'||_0x3d6ceb[_0x46ea44(0x132)];try{const [_0x3dd5b2,_0xdf31bf]=await Promise[_0x46ea44(0x15d)]([getAllProfileStats(),getUsageSummary()]);return _0x191406?await this[_0x46ea44(0x13a)](_0x3dd5b2,_0xdf31bf,_0x3d6ceb):this[_0x46ea44(0x147)](_0x3dd5b2,_0xdf31bf),0x0;}catch(_0x4672da){const _0x372066=_0x4672da instanceof Error?_0x4672da[_0x46ea44(0x14a)]:_0x46ea44(0x139);return console['error'](a10_0xf98f51[_0x46ea44(0x161)](_0x46ea44(0x145)+_0x372066)),0x1;}}async['outputStructured'](_0x413aba,_0x2b9434,_0x253f81){const _0x164e6c=a10_0xc20cc2,_0x59f528={'summary':{'todayCredits':_0x2b9434[_0x164e6c(0x127)],'monthCredits':_0x2b9434[_0x164e6c(0x124)],'totalCredits':_0x2b9434['totalCredits'],'profileCount':_0x2b9434['profileCount']},'profiles':_0x413aba['map'](_0x3b71ff=>({'profile':_0x3b71ff[_0x164e6c(0x14e)],'credits':_0x3b71ff[_0x164e6c(0x13b)],'requests':_0x3b71ff[_0x164e6c(0x144)],'lastUsedAt':_0x3b71ff[_0x164e6c(0x152)]}))};await handleSDKOutput([_0x59f528],_0x253f81);}[a10_0xc20cc2(0x147)](_0x81b194,_0x595584){const _0x1c6c02=a10_0xc20cc2;console[_0x1c6c02(0x154)](a10_0xf98f51[_0x1c6c02(0x155)]('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0x1c6c02(0x154)](a10_0xf98f51[_0x1c6c02(0x133)]('─'[_0x1c6c02(0x125)](0x32))),console[_0x1c6c02(0x154)](_0x1c6c02(0x12b)+a10_0xf98f51['cyan'](formatCredits(_0x595584['todayCredits']))+_0x1c6c02(0x12a)),console[_0x1c6c02(0x154)](_0x1c6c02(0x14f)+a10_0xf98f51[_0x1c6c02(0x15f)](formatCredits(_0x595584['monthCredits']))+_0x1c6c02(0x12a)),console[_0x1c6c02(0x154)](_0x1c6c02(0x140)+a10_0xf98f51[_0x1c6c02(0x15f)](formatCredits(_0x595584['totalCredits']))+'\x20credits'),console[_0x1c6c02(0x154)]();if(_0x81b194['length']===0x0){console[_0x1c6c02(0x154)](a10_0xf98f51['dim'](_0x1c6c02(0x138))),console[_0x1c6c02(0x154)](a10_0xf98f51[_0x1c6c02(0x133)](_0x1c6c02(0x142)));return;}console[_0x1c6c02(0x154)](a10_0xf98f51['bold'](_0x1c6c02(0x14b))),console[_0x1c6c02(0x154)](a10_0xf98f51['dim']('─'[_0x1c6c02(0x125)](0x3c)));const _0x2d3278=Math[_0x1c6c02(0x146)](0xc,..._0x81b194[_0x1c6c02(0x150)](_0x4891f4=>_0x4891f4['profile']===_0x1c6c02(0x12f)?_0x1c6c02(0x13d)[_0x1c6c02(0x134)]:_0x4891f4[_0x1c6c02(0x14e)]['length'])),_0x5b3061=0xa,_0xb82dcd=0xa;console[_0x1c6c02(0x154)]('\x20\x20'+'Profile'[_0x1c6c02(0x12e)](_0x2d3278)+'\x20\x20'+_0x1c6c02(0x15c)['padStart'](_0x5b3061)+'\x20\x20'+'Requests'[_0x1c6c02(0x162)](_0xb82dcd)+'\x20\x20'+'Last\x20Used');for(const _0x326af8 of _0x81b194){const _0x211039=_0x326af8[_0x1c6c02(0x14e)]===_0x1c6c02(0x12f)?'(default)':_0x326af8[_0x1c6c02(0x14e)],_0x281cc7=_0x211039['padEnd'](_0x2d3278),_0x1125b9=_0x326af8[_0x1c6c02(0x14e)]==='default'?a10_0xf98f51['dim'](_0x281cc7):_0x281cc7;console[_0x1c6c02(0x154)]('\x20\x20'+_0x1125b9+'\x20\x20'+a10_0xf98f51['cyan'](formatCredits(_0x326af8['credits'])[_0x1c6c02(0x162)](_0x5b3061))+'\x20\x20'+String(_0x326af8[_0x1c6c02(0x144)])[_0x1c6c02(0x162)](_0xb82dcd)+'\x20\x20'+a10_0xf98f51[_0x1c6c02(0x133)](formatLastUsed(_0x326af8[_0x1c6c02(0x152)])));}console[_0x1c6c02(0x154)](),console[_0x1c6c02(0x154)](a10_0xf98f51[_0x1c6c02(0x133)](_0x1c6c02(0x153))),console[_0x1c6c02(0x154)]();}}
|