@treasuredata/tdx 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +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/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.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/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.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/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.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/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.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
|
-
|
|
1
|
+
const a3_0xac6d49=a3_0x5740;(function(_0x3e8bb3,_0x3c5364){const _0x5cf4be=a3_0x5740,_0x4a581a=_0x3e8bb3();while(!![]){try{const _0x50656d=parseInt(_0x5cf4be(0x73))/0x1+-parseInt(_0x5cf4be(0x82))/0x2*(-parseInt(_0x5cf4be(0x71))/0x3)+-parseInt(_0x5cf4be(0x85))/0x4+parseInt(_0x5cf4be(0x6c))/0x5+parseInt(_0x5cf4be(0x6a))/0x6+-parseInt(_0x5cf4be(0x7b))/0x7+-parseInt(_0x5cf4be(0x7d))/0x8*(parseInt(_0x5cf4be(0x77))/0x9);if(_0x50656d===_0x3c5364)break;else _0x4a581a['push'](_0x4a581a['shift']());}catch(_0x36d142){_0x4a581a['push'](_0x4a581a['shift']());}}}(a3_0x17e9,0x5808b));import{BaseCommand}from'./command.js';function a3_0x5740(_0x1aad31,_0x407be7){_0x1aad31=_0x1aad31-0x67;const _0x17e9e6=a3_0x17e9();let _0x574069=_0x17e9e6[_0x1aad31];return _0x574069;}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{['name']=a3_0xac6d49(0x7e);['description']='List\x20activations\x20for\x20a\x20segment';async[a3_0xac6d49(0x70)](_0x1a723e){const _0xa9dcfd=a3_0xac6d49,{options:_0x41c61c,args:_0x40978f,tdx:_0xba5de}=_0x1a723e;if(_0x40978f[_0xa9dcfd(0x86)]===0x0)return console['error'](_0xa9dcfd(0x7a)),console[_0xa9dcfd(0x6e)](_0xa9dcfd(0x74)),0x1;try{const {parentId:_0x15fecf,childId:_0xf3b3e6}=parseSegmentRef(_0x40978f[0x0]);if(!_0xf3b3e6)return console[_0xa9dcfd(0x6e)](_0xa9dcfd(0x81)),console['error']('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;_0x41c61c[_0xa9dcfd(0x76)]&&(console[_0xa9dcfd(0x6e)]('Site:\x20'+_0x41c61c[_0xa9dcfd(0x75)]),console['error'](_0xa9dcfd(0x6d)+_0x15fecf),console['error']('Child\x20name:\x20'+_0xf3b3e6));const _0x3b7be1=await withSpinner(_0xa9dcfd(0x78)+_0x15fecf+'\x27...',()=>_0xba5de[_0xa9dcfd(0x69)][_0xa9dcfd(0x6f)](_0x15fecf),{'verbose':_0x41c61c[_0xa9dcfd(0x76)]}),_0x23854c=_0x3b7be1[_0xa9dcfd(0x84)];_0x41c61c[_0xa9dcfd(0x76)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x23854c);const _0x2fb9d9=await withSpinner(_0xa9dcfd(0x72)+_0xf3b3e6+_0xa9dcfd(0x79),()=>_0xba5de[_0xa9dcfd(0x69)]['resolveSegmentId'](_0x23854c,_0xf3b3e6),{'verbose':_0x41c61c[_0xa9dcfd(0x76)]}),_0x4a0b99=_0x2fb9d9['data'];_0x41c61c[_0xa9dcfd(0x76)]&&console[_0xa9dcfd(0x6e)](_0xa9dcfd(0x7c)+_0x4a0b99);const _0xa1dbbb=await withSpinner(_0xa9dcfd(0x80)+_0xf3b3e6+_0xa9dcfd(0x79),()=>_0xba5de[_0xa9dcfd(0x69)][_0xa9dcfd(0x7f)](_0x23854c,_0x4a0b99),{'verbose':_0x41c61c[_0xa9dcfd(0x76)]}),_0x18864d=_0xa1dbbb['data'];return console[_0xa9dcfd(0x6e)](_0xa9dcfd(0x83)+_0x18864d['length']+_0xa9dcfd(0x88)+(_0x18864d['length']!==0x1?'s':'')),await handleSDKOutput(_0x18864d,_0x41c61c),0x0;}catch(_0x44dfb9){if(_0x44dfb9 instanceof SDKError)return console['error'](_0xa9dcfd(0x67)+_0x44dfb9[_0xa9dcfd(0x68)]),_0x44dfb9[_0xa9dcfd(0x87)]&&console[_0xa9dcfd(0x6e)](_0xa9dcfd(0x6b)+_0x44dfb9[_0xa9dcfd(0x87)]),0x1;throw _0x44dfb9;}}}function a3_0x17e9(){const _0x2ad6f7=['Parent\x20name:\x20','error','resolveParentId','execute','1425588AuwYaZ','Resolving\x20child\x20segment\x20\x27','50856siDkwM','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','site','verbose','1143cTavrK','Resolving\x20parent\x20segment\x20\x27','\x27...','Error:\x20Segment\x20name\x20is\x20required','2834055kjQpFG','Resolved\x20child\x20ID:\x20','12936dGUOzF','activations','listActivations','Listing\x20activations\x20for\x20segment\x20\x27','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','2teKwMW','✔\x20Found\x20','data','1062384DQIAtz','length','cause','\x20activation','Error:\x20','message','segment','948102jidYzO','\x20\x20Cause:\x20','2761690WdqdzU'];a3_0x17e9=function(){return _0x2ad6f7;};return a3_0x17e9();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a4_0x444dbf=a4_0x5e86;(function(_0x236f20,_0x7d2b1e){const _0x2ab67c=a4_0x5e86,_0x257837=_0x236f20();while(!![]){try{const _0x222b94=-parseInt(_0x2ab67c(0x164))/0x1*(-parseInt(_0x2ab67c(0x149))/0x2)+parseInt(_0x2ab67c(0x110))/0x3+-parseInt(_0x2ab67c(0x133))/0x4*(-parseInt(_0x2ab67c(0xe6))/0x5)+-parseInt(_0x2ab67c(0x13d))/0x6*(parseInt(_0x2ab67c(0x15f))/0x7)+parseInt(_0x2ab67c(0x14d))/0x8*(parseInt(_0x2ab67c(0x139))/0x9)+parseInt(_0x2ab67c(0x17e))/0xa*(-parseInt(_0x2ab67c(0xf6))/0xb)+parseInt(_0x2ab67c(0x11a))/0xc;if(_0x222b94===_0x7d2b1e)break;else _0x257837['push'](_0x257837['shift']());}catch(_0x1186a9){_0x257837['push'](_0x257837['shift']());}}}(a4_0x1ce2,0xf2072));import a4_0x575b5f from'chalk';import a4_0x8e2471 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';function a4_0x5e86(_0x2e5822,_0x997c98){_0x2e5822=_0x2e5822-0xe3;const _0x1ce282=a4_0x1ce2();let _0x5e8638=_0x1ce282[_0x2e5822];return _0x5e8638;}import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';function a4_0x1ce2(){const _0x5f50c5=['yellow','New\x20project:\x20','dryRun','output','\x20--profile\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','force','Would\x20push\x20agent:\x20','no_local_folder','\x0a✔\x20Pushed\x20','agent:push','no_context','yes','tdx.json','red','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Output\x20path:\x20','New\x20project\x20ID:\x20','pushProject','cwd','320YrvwHe','projectDir','\x20\x20tdx\x20agent\x20pull\x20','diff','Clone\x20\x22','utf-8','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','total','Agent:\x20','\x20errors','\x0aProject\x20pushed\x20with\x20errors','green','\x20changed','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','join','\x0aErrors\x20found:','agents','cloneProject','395qkGSQS','counts','MISSING_ARGUMENT','site','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Project\x20cloned\x20successfully','\x20successfully','unchanged','Would\x20pull\x20agent:\x20','Errors:','\x22\x20to\x20\x22','isNew','\x0aPull\x20summary\x20for\x20\x27','llm','\x20new','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','474155SwVOVZ','\x20\x20Prompts:\x20','Pushing\x20agent\x20from\x20\x22','\x20\x20tdx\x20agent\x20clone\x20agents/','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Agent\x20','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','agentName','Summary:','prompts','\x20\x20Knowledge\x20Base\x20\x22','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','llm_project','pushAgent','\x20created','Pull\x20cancelled','\x20\x20Agents:\x20','Analyzing\x20changes\x20to\x20push...','Dry\x20run\x20-\x20no\x20files\x20written','dirname','outputDir','\x0aPush\x20','found','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','1411545WaEofu','repeat','agent.yml','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','hasChanges','parse','\x20\x20Target:\x20','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x22\x20from\x20project\x20\x22','3203556DCYafQ','action','projectName','INVALID_ARGUMENT','Clone\x20cancelled','\x20unchanged','error','\x20files?','\x20\x20Source:\x20','Dry\x20run\x20-\x20no\x20changes\x20made','\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)','knowledgeBases','\x0aWrite\x20','Pulling\x20agent\x20\x22','source','Output:\x20','llmProject','agentId','\x20updated','\x20\x20Agent\x20\x22','Source:\x20','\x20\x20Knowledge\x20Bases:\x20','Would\x20clone:','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','reason','59864inoidV','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)','cyan','Project:\x20','name','\x20\x20Text\x20Knowledge\x20Base\x20\x22','9mZGxhg','errors','log','Using\x20local\x20project:\x20','9770874iLiWDC','\x20|\x20','push','sourceProjectName','message','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x0aChanges\x20to\x20prompt\x20\x27','\x20resources?','agent:clone','\x0a✔\x20Pulled\x20','outputPath','gray','4hnrJYY','\x22:\x20','projectId','pullProject','14829688ffnwOb','dim','textKnowledgeBases','description','created','Using\x20project:\x20','newProjectId','Cloning\x20\x22','\x22\x20to\x20a\x20different\x20profile','updated','Pushing\x20to\x20project...','newProjectName','\x22...','session','\x22\x20to\x20new\x20project\x20\x22','Failed\x20to\x20push\x20agent:\x20','agent:pull','\x0aChanges:','7FMtsfE','context','✔\x20Context\x20set:\x20','\x0aChanges\x20to\x20agent\x20\x27','\x20files\x20to\x20','112841Dfaxdm','Status:\x20','execute','\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'];a4_0x1ce2=function(){return _0x5f50c5;};return a4_0x1ce2();}import{findAgentConfigPath,resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0xdab9a1){const _0x4bc6c9=a4_0x5e86,_0x20750=[];if(_0xdab9a1[_0x4bc6c9(0x185)]!==undefined)_0x20750[_0x4bc6c9(0x13f)](_0xdab9a1['total']+'\x20total');if(_0xdab9a1[_0x4bc6c9(0x168)]!==undefined&&_0xdab9a1[_0x4bc6c9(0x168)]>0x0)_0x20750['push'](a4_0x575b5f['green'](_0xdab9a1['new']+'\x20new'));if(_0xdab9a1[_0x4bc6c9(0x151)]!==undefined&&_0xdab9a1[_0x4bc6c9(0x151)]>0x0)_0x20750['push'](a4_0x575b5f[_0x4bc6c9(0x189)](_0xdab9a1['created']+_0x4bc6c9(0x105)));if(_0xdab9a1[_0x4bc6c9(0x156)]!==undefined&&_0xdab9a1[_0x4bc6c9(0x156)]>0x0)_0x20750[_0x4bc6c9(0x13f)](a4_0x575b5f[_0x4bc6c9(0x169)](_0xdab9a1[_0x4bc6c9(0x156)]+_0x4bc6c9(0x12c)));if(_0xdab9a1[_0x4bc6c9(0xed)]!==undefined&&_0xdab9a1[_0x4bc6c9(0xed)]>0x0)_0x20750['push'](a4_0x575b5f[_0x4bc6c9(0x148)](_0xdab9a1[_0x4bc6c9(0xed)]+_0x4bc6c9(0x11f)));if(_0xdab9a1[_0x4bc6c9(0x13a)]!==undefined&&_0xdab9a1[_0x4bc6c9(0x13a)]>0x0)_0x20750[_0x4bc6c9(0x13f)](a4_0x575b5f[_0x4bc6c9(0x177)](_0xdab9a1[_0x4bc6c9(0x13a)]+_0x4bc6c9(0x187)));return _0x20750[_0x4bc6c9(0x18c)](',\x20');}function displayDiffs(_0x5714f6,_0x439182,_0x4b66b2,_0x3178de){const _0x2431a4=a4_0x5e86;for(const _0x1e9653 of _0x5714f6){if(_0x1e9653[_0x2431a4(0x181)]){const _0x19fe51=_0x1e9653[_0x2431a4(0xfe)]||_0x1e9653[_0x2431a4(0x137)];console[_0x2431a4(0x13b)](_0x2431a4(0x162)+_0x19fe51+'\x27:'),console[_0x2431a4(0x13b)]('─'[_0x2431a4(0x111)](0x3c)),console[_0x2431a4(0x13b)](_0x1e9653[_0x2431a4(0x181)]),console[_0x2431a4(0x13b)]('─'['repeat'](0x3c));}}for(const _0x1ee9ed of _0x439182){_0x1ee9ed['diff']&&(console['log'](_0x2431a4(0x117)+_0x1ee9ed[_0x2431a4(0x137)]+'\x27:'),console[_0x2431a4(0x13b)]('─'['repeat'](0x3c)),console['log'](_0x1ee9ed['diff']),console[_0x2431a4(0x13b)]('─'['repeat'](0x3c)));}for(const _0x41a122 of _0x4b66b2){_0x41a122['diff']&&(console[_0x2431a4(0x13b)](_0x2431a4(0x102)+_0x41a122[_0x2431a4(0x137)]+'\x27:'),console[_0x2431a4(0x13b)]('─'[_0x2431a4(0x111)](0x3c)),console[_0x2431a4(0x13b)](_0x41a122[_0x2431a4(0x181)]),console[_0x2431a4(0x13b)]('─'['repeat'](0x3c)));}for(const _0x523ee2 of _0x3178de){_0x523ee2[_0x2431a4(0x181)]&&(console['log'](_0x2431a4(0x143)+_0x523ee2[_0x2431a4(0x137)]+'\x27:'),console[_0x2431a4(0x13b)]('─'[_0x2431a4(0x111)](0x3c)),console[_0x2431a4(0x13b)](_0x523ee2['diff']),console[_0x2431a4(0x13b)]('─'[_0x2431a4(0x111)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x444dbf(0x137)]=a4_0x444dbf(0x15d);[a4_0x444dbf(0x150)]=a4_0x444dbf(0xf5);async[a4_0x444dbf(0x166)](_0x456287){const _0xb53380=a4_0x444dbf,{options:_0x3c68ef,args:_0x2918b1,tdx:_0x4af2b6}=_0x456287,_0x503169=_0x2918b1[0x0],_0xcd87b7=_0x2918b1[0x1],_0x1cd42f=_0x3c68ef[_0xb53380(0x16c)],_0xf5ee1a=_0x3c68ef[_0xb53380(0x16b)],_0x5cb515=_0x3c68ef[_0xb53380(0x16f)],_0x394e1a=_0x3c68ef[_0xb53380(0x175)],_0x1d068d=_0x3c68ef['llmProject'];let _0x26e151,_0x3c3ab7;const _0x3c408e=findAgentConfigPath(process['cwd']());if(_0x503169){const _0x31f775=a4_0x8e2471[_0xb53380(0x18c)](_0x503169,_0xb53380(0x176));if(existsSync(_0x31f775))try{const _0x2e17ef=JSON['parse'](readFileSync(_0x31f775,'utf-8'));_0x26e151=_0x2e17ef[_0xb53380(0x103)],_0x3c3ab7=_0x503169,console[_0xb53380(0x13b)](a4_0x575b5f[_0xb53380(0x14e)]('Using\x20project\x20from\x20'+_0x31f775+':\x20'+_0x26e151));}catch{_0x26e151=_0x503169;}else _0x26e151=_0x503169;}else{if(_0x3c408e)try{const _0x161fe5=JSON[_0xb53380(0x115)](readFileSync(_0x3c408e,_0xb53380(0x183)));_0x26e151=_0x161fe5[_0xb53380(0x103)],_0x3c3ab7=a4_0x8e2471[_0xb53380(0x10a)](_0x3c408e),console[_0xb53380(0x13b)](a4_0x575b5f['dim'](_0xb53380(0x152)+_0x26e151));}catch{_0x26e151=_0x1d068d;}else _0x26e151=_0x1d068d;}if(!_0x26e151)return console['log'](a4_0x575b5f[_0xb53380(0x169)](_0xb53380(0x142))),console[_0xb53380(0x13b)](_0xb53380(0x134)),console[_0xb53380(0x13b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project'),console[_0xb53380(0x13b)](_0xb53380(0x167)),console['log'](_0xb53380(0x131)),0x1;if(_0xcd87b7){const {data:_0x2d21e2}=await withSpinner(_0xb53380(0x127)+_0xcd87b7+_0xb53380(0x119)+_0x26e151+_0xb53380(0x159),()=>_0x4af2b6[_0xb53380(0xf3)]['pullAgent'](_0x26e151,_0xcd87b7,_0x1cd42f,{'dryRun':_0xf5ee1a,'force':_0x5cb515}));if(_0xf5ee1a)return console[_0xb53380(0x13b)](a4_0x575b5f['yellow'](_0xb53380(0x109))),console[_0xb53380(0x13b)](_0xb53380(0xee)+_0x2d21e2['agentName']),console[_0xb53380(0x13b)](_0xb53380(0x17a)+_0x2d21e2['outputPath']),_0x2d21e2[_0xb53380(0x181)]&&(console[_0xb53380(0x13b)](_0xb53380(0x15e)),console[_0xb53380(0x13b)]('─'[_0xb53380(0x111)](0x3c)),console[_0xb53380(0x13b)](_0x2d21e2[_0xb53380(0x181)]),console[_0xb53380(0x13b)]('─'[_0xb53380(0x111)](0x3c))),0x0;return console[_0xb53380(0x13b)](a4_0x575b5f[_0xb53380(0x189)]('Agent\x20pulled\x20successfully')),console[_0xb53380(0x13b)](_0xb53380(0x186)+_0x2d21e2[_0xb53380(0xfe)]),console['log'](_0xb53380(0x129)+_0x2d21e2[_0xb53380(0x147)]),console[_0xb53380(0x13b)](_0xb53380(0x165)+(_0x2d21e2[_0xb53380(0xf1)]?a4_0x575b5f[_0xb53380(0x189)](_0xb53380(0x168)):_0x2d21e2[_0xb53380(0x114)]?a4_0x575b5f[_0xb53380(0x169)]('updated'):a4_0x575b5f[_0xb53380(0x148)](_0xb53380(0xed)))),0x0;}const _0x2a7b95=_0x3c3ab7||_0x1cd42f,{data:_0x54d825}=await withSpinner('Analyzing\x20project\x20\x22'+_0x26e151+_0xb53380(0x159),()=>_0x4af2b6[_0xb53380(0xf3)][_0xb53380(0x14c)](_0x26e151,_0x2a7b95,{'dryRun':!![]})),_0x2a46bc=_0x54d825[_0xb53380(0xe7)][_0xb53380(0xe4)]['new']+_0x54d825[_0xb53380(0xe7)]['knowledgeBases'][_0xb53380(0x168)]+_0x54d825[_0xb53380(0xe7)][_0xb53380(0x14f)][_0xb53380(0x168)]+_0x54d825[_0xb53380(0xe7)][_0xb53380(0x100)]['new'],_0x4f8bdd=_0x54d825[_0xb53380(0xe7)]['agents'][_0xb53380(0x156)]+_0x54d825['counts'][_0xb53380(0x125)]['updated']+_0x54d825['counts'][_0xb53380(0x14f)][_0xb53380(0x156)]+_0x54d825[_0xb53380(0xe7)]['prompts'][_0xb53380(0x156)],_0x25ac38=_0x54d825[_0xb53380(0xe7)][_0xb53380(0xe4)][_0xb53380(0xed)]+_0x54d825[_0xb53380(0xe7)][_0xb53380(0x125)][_0xb53380(0xed)]+_0x54d825[_0xb53380(0xe7)]['textKnowledgeBases'][_0xb53380(0xed)]+_0x54d825['counts'][_0xb53380(0x100)]['unchanged'];console[_0xb53380(0x13b)](_0xb53380(0xf2)+_0x54d825['projectName']+'\x27:'),console[_0xb53380(0x13b)]('\x20\x20'+a4_0x575b5f[_0xb53380(0x189)]('+\x20'+_0x2a46bc+_0xb53380(0xf4))+_0xb53380(0x13e)+a4_0x575b5f[_0xb53380(0x169)]('~\x20'+_0x4f8bdd+_0xb53380(0x18a))+_0xb53380(0x13e)+a4_0x575b5f[_0xb53380(0x14e)]('=\x20'+_0x25ac38+'\x20unchanged')),console[_0xb53380(0x13b)]('\x20\x20Agents:\x20'+formatCountSummary(_0x54d825['counts'][_0xb53380(0xe4)])),console[_0xb53380(0x13b)](_0xb53380(0x12f)+formatCountSummary(_0x54d825[_0xb53380(0xe7)]['knowledgeBases'])),console[_0xb53380(0x13b)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x54d825[_0xb53380(0xe7)]['textKnowledgeBases'])),console[_0xb53380(0x13b)](_0xb53380(0xf7)+formatCountSummary(_0x54d825[_0xb53380(0xe7)]['prompts'])),console[_0xb53380(0x13b)](_0xb53380(0x116)+a4_0x575b5f[_0xb53380(0x135)](_0x54d825[_0xb53380(0x10b)])),displayDiffs(_0x54d825['agents'],_0x54d825['knowledgeBases'],_0x54d825[_0xb53380(0x14f)],_0x54d825['prompts']);if(_0xf5ee1a)return console['log'](a4_0x575b5f['yellow'](_0xb53380(0x113))),0x0;if(_0x2a46bc===0x0&&_0x4f8bdd===0x0)return console[_0xb53380(0x13b)](a4_0x575b5f['green'](_0xb53380(0x178))),saveSessionContext({'llm_project':_0x54d825[_0xb53380(0x11c)]},_0x3c68ef[_0xb53380(0x15a)]),console[_0xb53380(0x13b)](a4_0x575b5f[_0xb53380(0x189)](_0xb53380(0x161)+a4_0x575b5f[_0xb53380(0x14e)]('llm_project')+'\x20=\x20'+a4_0x575b5f[_0xb53380(0x135)](_0x54d825['projectName']))),0x0;if(!_0x394e1a&&!_0x5cb515){const _0x12ecab=await confirmKey(_0xb53380(0x126)+(_0x2a46bc+_0x4f8bdd)+_0xb53380(0x121));if(!_0x12ecab)return console[_0xb53380(0x13b)](_0xb53380(0x106)),0x0;}const {data:_0x289fb9}=await withSpinner('Writing\x20files...',()=>_0x4af2b6[_0xb53380(0xf3)][_0xb53380(0x14c)](_0x26e151,_0x2a7b95,{'force':_0x5cb515}));return console[_0xb53380(0x13b)](a4_0x575b5f['green'](_0xb53380(0x146)+(_0x2a46bc+_0x4f8bdd)+_0xb53380(0x163)+_0x289fb9[_0xb53380(0x10b)])),saveSessionContext({'llm_project':_0x289fb9[_0xb53380(0x11c)]},_0x3c68ef[_0xb53380(0x15a)]),console[_0xb53380(0x13b)](a4_0x575b5f['green']('✔\x20Context\x20set:\x20'+a4_0x575b5f[_0xb53380(0x14e)](_0xb53380(0x103))+'\x20=\x20'+a4_0x575b5f[_0xb53380(0x135)](_0x289fb9[_0xb53380(0x11c)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x444dbf(0x137)]=a4_0x444dbf(0x145);[a4_0x444dbf(0x150)]=a4_0x444dbf(0x18b);async['execute'](_0x4a8e45){const _0x1fd2b1=a4_0x444dbf,{options:_0x59ef6e,args:_0x506112,tdx:_0xe25e7}=_0x4a8e45,_0x50b2ea=_0x506112[0x0],_0x1f9c8f=_0x59ef6e[_0x1fd2b1(0x137)],_0x941c5a=_0x59ef6e['dryRun'],_0x153249=_0x59ef6e[_0x1fd2b1(0x175)],_0x556390=_0x59ef6e['site'],_0x32b10e=_0x59ef6e[_0x1fd2b1(0x12a)];let _0x591086;const _0x17160f=findAgentConfigPath(process[_0x1fd2b1(0x17d)]());if(_0x50b2ea){const _0x4e73e9=a4_0x8e2471[_0x1fd2b1(0x18c)](_0x50b2ea,'tdx.json');existsSync(_0x4e73e9)?(_0x591086=_0x50b2ea,console['log'](a4_0x575b5f[_0x1fd2b1(0x14e)]('Using\x20local\x20project:\x20'+_0x50b2ea))):_0x591086=_0x50b2ea;}else{if(_0x17160f)_0x591086=a4_0x8e2471['dirname'](_0x17160f),console[_0x1fd2b1(0x13b)](a4_0x575b5f['dim']('Using\x20current\x20project:\x20'+_0x591086));else{if(_0x32b10e){const _0x4c4689=sanitizeForFilesystem(_0x32b10e);let _0x26ac06=_0x4c4689,_0x4c7a2d=a4_0x8e2471['join'](process[_0x1fd2b1(0x17d)](),'agents',_0x4c4689,_0x1fd2b1(0x176));if(!existsSync(_0x4c7a2d)){const _0x25a0f1=normalizeName(_0x32b10e),_0xe201cf=a4_0x8e2471[_0x1fd2b1(0x18c)](process[_0x1fd2b1(0x17d)](),'agents',_0x25a0f1,_0x1fd2b1(0x176));existsSync(_0xe201cf)&&(_0x26ac06=_0x25a0f1,_0x4c7a2d=_0xe201cf);}if(existsSync(_0x4c7a2d))_0x591086=a4_0x8e2471['dirname'](_0x4c7a2d),console[_0x1fd2b1(0x13b)](a4_0x575b5f[_0x1fd2b1(0x14e)](_0x1fd2b1(0x13c)+_0x591086));else{const _0x3c7ff8=_0x59ef6e['profile'];if(_0x3c7ff8)throw new SDKError(ErrorCode[_0x1fd2b1(0x11d)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x32b10e+_0x1fd2b1(0x155),undefined,{'helpText':_0x1fd2b1(0xfd)+_0x1fd2b1(0x118)+(_0x1fd2b1(0x180)+_0x32b10e+'\x0a')+(_0x1fd2b1(0xf9)+_0x26ac06+'\x20--name\x20'+(_0x1f9c8f||'<new-name>')+_0x1fd2b1(0x16d)+_0x3c7ff8)});_0x591086=_0x32b10e,console['log'](a4_0x575b5f[_0x1fd2b1(0x14e)]('Using\x20context\x20project:\x20'+_0x32b10e));}}}}if(!_0x591086)return console[_0x1fd2b1(0x13b)](a4_0x575b5f['yellow'](_0x1fd2b1(0x10f))),console[_0x1fd2b1(0x13b)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0xea)),console['log'](_0x1fd2b1(0x124)),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0xfb)),0x1;if(!_0x1f9c8f)throw new SDKError(ErrorCode[_0x1fd2b1(0xe8)],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':_0x1fd2b1(0x184)});if(!_0x153249&&!_0x941c5a){const _0x388bda=await confirmKey(_0x1fd2b1(0x182)+_0x591086+_0x1fd2b1(0x15b)+_0x1f9c8f+'\x22?');if(!_0x388bda)return console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x11e)),0x0;}const {data:_0x213c17}=await withSpinner(_0x1fd2b1(0x154)+_0x591086+_0x1fd2b1(0xf0)+_0x1f9c8f+'\x22...',()=>_0xe25e7['llm'][_0x1fd2b1(0xe5)](_0x591086,_0x1f9c8f,{'dryRun':_0x941c5a}));if(_0x941c5a)return console[_0x1fd2b1(0x13b)](a4_0x575b5f[_0x1fd2b1(0x169)](_0x1fd2b1(0x123))),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x12e)+_0x213c17[_0x1fd2b1(0x140)]),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x16a)+_0x1f9c8f),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x130)),console[_0x1fd2b1(0x13b)]('\x20\x20Agents:\x20'+_0x213c17['counts'][_0x1fd2b1(0xe4)]['created']),console['log'](_0x1fd2b1(0x12f)+_0x213c17['counts'][_0x1fd2b1(0x125)]['created']),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0xf7)+_0x213c17['counts'][_0x1fd2b1(0x100)][_0x1fd2b1(0x151)]),0x0;const _0x2a7312=_0x213c17[_0x1fd2b1(0xe7)][_0x1fd2b1(0xe4)][_0x1fd2b1(0x13a)]>0x0||_0x213c17[_0x1fd2b1(0xe7)]['knowledgeBases']['errors']>0x0||_0x213c17['counts']['prompts'][_0x1fd2b1(0x13a)]>0x0;_0x2a7312?console[_0x1fd2b1(0x13b)](a4_0x575b5f[_0x1fd2b1(0x169)]('Project\x20cloned\x20with\x20errors')):console[_0x1fd2b1(0x13b)](a4_0x575b5f['green'](_0x1fd2b1(0xeb)));console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x12e)+_0x213c17['sourceProjectName']),console[_0x1fd2b1(0x13b)]('New\x20project:\x20'+_0x213c17[_0x1fd2b1(0x158)]),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x17b)+_0x213c17[_0x1fd2b1(0x153)]),console['log'](),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0xff)),console['log'](_0x1fd2b1(0x107)+formatCountSummary(_0x213c17[_0x1fd2b1(0xe7)][_0x1fd2b1(0xe4)])),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0x12f)+formatCountSummary(_0x213c17[_0x1fd2b1(0xe7)][_0x1fd2b1(0x125)])),console[_0x1fd2b1(0x13b)](_0x1fd2b1(0xf7)+formatCountSummary(_0x213c17[_0x1fd2b1(0xe7)]['prompts']));if(_0x2a7312){console[_0x1fd2b1(0x13b)](),console['log'](a4_0x575b5f[_0x1fd2b1(0x177)](_0x1fd2b1(0xef)));for(const _0x5c82db of _0x213c17[_0x1fd2b1(0xe4)]){_0x5c82db[_0x1fd2b1(0x11b)]===_0x1fd2b1(0x120)&&console[_0x1fd2b1(0x13b)](a4_0x575b5f[_0x1fd2b1(0x177)](_0x1fd2b1(0x12d)+_0x5c82db['agentName']+_0x1fd2b1(0x14a)+_0x5c82db[_0x1fd2b1(0x120)]));}for(const _0x1a177e of _0x213c17[_0x1fd2b1(0x125)]){_0x1a177e[_0x1fd2b1(0x11b)]===_0x1fd2b1(0x120)&&console[_0x1fd2b1(0x13b)](a4_0x575b5f[_0x1fd2b1(0x177)](_0x1fd2b1(0x101)+_0x1a177e[_0x1fd2b1(0x137)]+_0x1fd2b1(0x14a)+_0x1a177e[_0x1fd2b1(0x120)]));}for(const _0x13f9db of _0x213c17[_0x1fd2b1(0x100)]){_0x13f9db['action']===_0x1fd2b1(0x120)&&console[_0x1fd2b1(0x13b)](a4_0x575b5f[_0x1fd2b1(0x177)]('\x20\x20Prompt\x20\x22'+_0x13f9db[_0x1fd2b1(0x137)]+'\x22:\x20'+_0x13f9db[_0x1fd2b1(0x120)]));}return 0x1;}console['log']();const _0x18e071=getLLMProjectUrl(_0x556390,_0x213c17[_0x1fd2b1(0x153)]);return console['log']('Project:\x20'+a4_0x575b5f[_0x1fd2b1(0x135)](_0x18e071)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x444dbf(0x137)]=a4_0x444dbf(0x173);[a4_0x444dbf(0x150)]=a4_0x444dbf(0x179);async[a4_0x444dbf(0x166)](_0xccc020){const _0x1fde8a=a4_0x444dbf,{options:_0x5ebafb,args:_0x4e4768,tdx:_0x173b50}=_0xccc020;let _0x4d5e7c=_0x4e4768[0x0]||process[_0x1fde8a(0x17d)]();const _0x2bffb5=_0x5ebafb[_0x1fde8a(0x16b)],_0x50f634=_0x5ebafb[_0x1fde8a(0x16f)],_0x502ce7=_0x5ebafb[_0x1fde8a(0x175)],_0x4ab2b6=_0x5ebafb[_0x1fde8a(0xe9)],_0x1c5035=a4_0x8e2471['join'](_0x4d5e7c,_0x1fde8a(0x112)),_0x302bf5=existsSync(_0x1c5035);if(_0x302bf5){const {data:_0x424d76}=await withSpinner(_0x1fde8a(0xf8)+_0x4d5e7c+'\x22...',()=>_0x173b50[_0x1fde8a(0xf3)][_0x1fde8a(0x104)](_0x4d5e7c,{'dryRun':_0x2bffb5,'force':_0x50f634}));if(_0x2bffb5)return console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x169)](_0x1fde8a(0x123))),console[_0x1fde8a(0x13b)](_0x1fde8a(0x170)+_0x424d76[_0x1fde8a(0xfe)]),0x0;if(_0x424d76[_0x1fde8a(0x11b)]==='error')return console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x177)](_0x1fde8a(0x15c)+_0x424d76['error'])),0x1;console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x189)](_0x1fde8a(0xfc)+_0x424d76['action']+_0x1fde8a(0xec))),console[_0x1fde8a(0x13b)]('Agent:\x20'+_0x424d76[_0x1fde8a(0xfe)]);if(_0x424d76['agentId']&&_0x424d76[_0x1fde8a(0x14b)]){const _0x147c39=getLLMAgentChatUrl(_0x4ab2b6,_0x424d76[_0x1fde8a(0x14b)],_0x424d76[_0x1fde8a(0x12b)]);console['log']('Chat:\x20'+a4_0x575b5f['cyan'](_0x147c39));}return 0x0;}const _0x266681=_0x5ebafb[_0x1fde8a(0x12a)],_0x3259ae=resolveProjectFromContext(_0x4d5e7c,_0x266681);if(_0x3259ae[_0x1fde8a(0x10d)])_0x4d5e7c=_0x3259ae[_0x1fde8a(0x17f)],_0x3259ae[_0x1fde8a(0x128)]===_0x1fde8a(0x160)&&console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x14e)](_0x1fde8a(0x152)+_0x4d5e7c));else{let _0xd847ec='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0x3259ae[_0x1fde8a(0x132)]===_0x1fde8a(0x171)&&(_0xd847ec=_0x3259ae['message']+_0x1fde8a(0xfa)+_0x3259ae[_0x1fde8a(0x12a)]+_0x1fde8a(0x16e));throw new SDKError(ErrorCode[_0x1fde8a(0x11d)],_0x3259ae[_0x1fde8a(0x132)]===_0x1fde8a(0x174)?_0x3259ae[_0x1fde8a(0x141)]:'No\x20tdx.json\x20found\x20in\x20'+_0x4d5e7c,undefined,{'helpText':_0xd847ec});}const {data:_0x489d82}=await withSpinner(_0x1fde8a(0x108),()=>_0x173b50[_0x1fde8a(0xf3)][_0x1fde8a(0x17c)](_0x4d5e7c,{'dryRun':!![]})),_0x5f2c6a=_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0xe4)][_0x1fde8a(0x13a)]>0x0;if(_0x5f2c6a){console[_0x1fde8a(0x13b)](a4_0x575b5f['red'](_0x1fde8a(0xe3)));for(const _0x5d5366 of _0x489d82[_0x1fde8a(0xe4)]){_0x5d5366[_0x1fde8a(0x11b)]==='error'&&console[_0x1fde8a(0x13b)](a4_0x575b5f['red'](_0x1fde8a(0x12d)+_0x5d5366[_0x1fde8a(0xfe)]+'\x22:\x20'+_0x5d5366[_0x1fde8a(0x120)]));}return 0x1;}const _0x370e9d=_0x489d82['counts']['agents'][_0x1fde8a(0x151)]+_0x489d82['counts'][_0x1fde8a(0x125)][_0x1fde8a(0x151)]+_0x489d82[_0x1fde8a(0xe7)]['textKnowledgeBases'][_0x1fde8a(0x151)]+_0x489d82['counts'][_0x1fde8a(0x100)][_0x1fde8a(0x151)],_0x25e45a=_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0xe4)][_0x1fde8a(0x156)]+_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0x125)][_0x1fde8a(0x156)]+_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0x14f)][_0x1fde8a(0x156)]+_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0x100)][_0x1fde8a(0x156)],_0x3ef83d=_0x489d82[_0x1fde8a(0xe7)]['agents'][_0x1fde8a(0xed)]+_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0x125)][_0x1fde8a(0xed)]+_0x489d82['counts']['textKnowledgeBases']['unchanged']+_0x489d82[_0x1fde8a(0xe7)]['prompts'][_0x1fde8a(0xed)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x489d82[_0x1fde8a(0x11c)]+'\x27:'),console['log']('\x20\x20'+a4_0x575b5f['green']('+\x20'+_0x370e9d+'\x20new')+'\x20|\x20'+a4_0x575b5f['yellow']('~\x20'+_0x25e45a+_0x1fde8a(0x18a))+_0x1fde8a(0x13e)+a4_0x575b5f[_0x1fde8a(0x14e)]('=\x20'+_0x3ef83d+'\x20unchanged')),console[_0x1fde8a(0x13b)]('\x20\x20Agents:\x20'+formatCountSummary(_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0xe4)])),console[_0x1fde8a(0x13b)](_0x1fde8a(0x12f)+formatCountSummary(_0x489d82['counts']['knowledgeBases'])),console[_0x1fde8a(0x13b)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x489d82[_0x1fde8a(0xe7)][_0x1fde8a(0x14f)])),console[_0x1fde8a(0x13b)](_0x1fde8a(0xf7)+formatCountSummary(_0x489d82['counts'][_0x1fde8a(0x100)])),console[_0x1fde8a(0x13b)](_0x1fde8a(0x122)+a4_0x575b5f[_0x1fde8a(0x135)](_0x4d5e7c)),displayDiffs(_0x489d82[_0x1fde8a(0xe4)],_0x489d82[_0x1fde8a(0x125)],_0x489d82[_0x1fde8a(0x14f)],_0x489d82[_0x1fde8a(0x100)]);if(_0x2bffb5)return console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x169)](_0x1fde8a(0x10e))),0x0;if(_0x370e9d===0x0&&_0x25e45a===0x0){console['log'](a4_0x575b5f[_0x1fde8a(0x189)]('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x80652a=getLLMProjectUrl(_0x4ab2b6,_0x489d82['projectId']);return console[_0x1fde8a(0x13b)]('Project:\x20'+a4_0x575b5f['cyan'](_0x80652a)),0x0;}if(!_0x502ce7&&!_0x50f634){const _0x2c4553=await confirmKey(_0x1fde8a(0x10c)+(_0x370e9d+_0x25e45a)+_0x1fde8a(0x144));if(!_0x2c4553)return console[_0x1fde8a(0x13b)]('Push\x20cancelled'),0x0;}const {data:_0x85ec28}=await withSpinner(_0x1fde8a(0x157),()=>_0x173b50[_0x1fde8a(0xf3)]['pushProject'](_0x4d5e7c,{'force':_0x50f634})),_0x5c5f35=_0x85ec28[_0x1fde8a(0xe7)][_0x1fde8a(0xe4)][_0x1fde8a(0x13a)]>0x0||_0x85ec28[_0x1fde8a(0xe7)]['knowledgeBases'][_0x1fde8a(0x13a)]>0x0||_0x85ec28['counts'][_0x1fde8a(0x14f)][_0x1fde8a(0x13a)]>0x0||_0x85ec28[_0x1fde8a(0xe7)][_0x1fde8a(0x100)][_0x1fde8a(0x13a)]>0x0;if(_0x5c5f35){console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x169)](_0x1fde8a(0x188))),console['log'](),console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x177)](_0x1fde8a(0xef)));for(const _0x53b982 of _0x85ec28[_0x1fde8a(0xe4)]){_0x53b982[_0x1fde8a(0x11b)]===_0x1fde8a(0x120)&&console['log'](a4_0x575b5f[_0x1fde8a(0x177)]('\x20\x20Agent\x20\x22'+_0x53b982[_0x1fde8a(0xfe)]+_0x1fde8a(0x14a)+_0x53b982['error']));}for(const _0x5f3db6 of _0x85ec28['knowledgeBases']){_0x5f3db6[_0x1fde8a(0x11b)]===_0x1fde8a(0x120)&&console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x177)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x5f3db6[_0x1fde8a(0x137)]+'\x22:\x20'+_0x5f3db6[_0x1fde8a(0x120)]));}for(const _0x696567 of _0x85ec28['textKnowledgeBases']){_0x696567[_0x1fde8a(0x11b)]==='error'&&console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x177)](_0x1fde8a(0x138)+_0x696567[_0x1fde8a(0x137)]+'\x22:\x20'+_0x696567[_0x1fde8a(0x120)]));}for(const _0x11a8e3 of _0x85ec28['prompts']){_0x11a8e3['action']===_0x1fde8a(0x120)&&console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x177)]('\x20\x20Prompt\x20\x22'+_0x11a8e3[_0x1fde8a(0x137)]+_0x1fde8a(0x14a)+_0x11a8e3[_0x1fde8a(0x120)]));}return 0x1;}console[_0x1fde8a(0x13b)](a4_0x575b5f[_0x1fde8a(0x189)](_0x1fde8a(0x172)+(_0x370e9d+_0x25e45a)+'\x20resources\x20to\x20\x27'+_0x85ec28[_0x1fde8a(0x11c)]+'\x27'));const _0x5ddd27=getLLMProjectUrl(_0x4ab2b6,_0x85ec28[_0x1fde8a(0x14b)]);return console['log'](_0x1fde8a(0x136)+a4_0x575b5f[_0x1fde8a(0x135)](_0x5ddd27)),0x0;}}
|
|
1
|
+
const a4_0x4f49a5=a4_0x179c;(function(_0x1b124a,_0x23e6d3){const _0x542581=a4_0x179c,_0xae76a=_0x1b124a();while(!![]){try{const _0x4f7e2b=parseInt(_0x542581(0x279))/0x1*(parseInt(_0x542581(0x25b))/0x2)+parseInt(_0x542581(0x1e9))/0x3+parseInt(_0x542581(0x215))/0x4+-parseInt(_0x542581(0x27e))/0x5+-parseInt(_0x542581(0x200))/0x6+parseInt(_0x542581(0x232))/0x7+-parseInt(_0x542581(0x219))/0x8*(parseInt(_0x542581(0x285))/0x9);if(_0x4f7e2b===_0x23e6d3)break;else _0xae76a['push'](_0xae76a['shift']());}catch(_0x393189){_0xae76a['push'](_0xae76a['shift']());}}}(a4_0x17eb,0x7293a));import a4_0x4484d8 from'chalk';import a4_0x993bfa from'path';import{existsSync,readFileSync}from'fs';function a4_0x17eb(){const _0x421ae8=['\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20Knowledge\x20Bases:\x20','pullAgent','11EGfinB','Status:\x20','push','no_context','yes','3724620TGZqnR','new','yellow','\x20changed','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','INVALID_ARGUMENT','Pushing\x20to\x20project...','18405Dzalfn','force','\x20\x20Target:\x20','isNew','counts','knowledgeBases','Would\x20push\x20agent:\x20','agent:pull','\x0aChanges\x20to\x20agent\x20\x27','projectDir','agentName','\x20\x20Agents:\x20','join','\x20--name\x20','Summary:','Would\x20pull\x20agent:\x20','pullProject','repeat','408834eALzVP','prompts','Clone\x20cancelled','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','\x20\x20Prompts:\x20','\x20\x20Source:\x20','Using\x20project:\x20','session','\x22:\x20','description','\x20new','\x20resources\x20to\x20\x27','llm','\x20resources?','projectId','newProjectName','Using\x20current\x20project:\x20','New\x20project:\x20','\x22\x20to\x20new\x20project\x20\x22','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','\x20\x20Text\x20Knowledge\x20Base\x20\x22','\x0aProject\x20pushed\x20with\x20errors','4523364owmcuq','Writing\x20files...','\x20=\x20','\x20\x20tdx\x20agent\x20pull\x20','cloneProject','updated','Chat:\x20','agents','dirname','cwd','\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','Agent\x20','<new-name>','\x20\x20Text\x20Knowledge\x20Bases:\x20','Errors:','\x20updated','Push\x20cancelled','pushProject','newProjectId','\x20total','Source:\x20','3213220ENAfzS','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','source','1312VUEVyp','parse','\x20files?','Analyzing\x20changes\x20to\x20push...','Project\x20cloned\x20successfully','\x20\x20Agent\x20\x22','\x0aChanges\x20to\x20prompt\x20\x27','Using\x20project\x20from\x20','\x0aErrors\x20found:','Using\x20local\x20project:\x20','\x20\x20Prompt\x20\x22','\x20unchanged','\x0a✔\x20Pulled\x20','agent.yml','red','log','Cloning\x20\x22','llmProject','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','gray','cyan','site','Pushing\x20agent\x20from\x20\x22','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Pull\x20cancelled','6486081JpmGtD','Agent:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','dim','sourceProjectName','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','errors','diff','unchanged','llm_project','no_local_folder','execute','output','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','Pulling\x20agent\x20\x22','Cannot\x20clone\x20from\x20context\x20project\x20\x22','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','outputDir','\x0aPull\x20summary\x20for\x20\x27','agentId','\x20\x20tdx\x20agent\x20clone\x20agents/','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','\x0aPush\x20summary\x20for\x20\x27','Would\x20clone:','agent:push','name','tdx.json','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','found','\x22...','pushAgent','No\x20tdx.json\x20found\x20in\x20','Analyzing\x20project\x20\x22','\x20|\x20','Dry\x20run\x20-\x20no\x20files\x20written','total','\x22\x20to\x20\x22','\x20created','action','profile','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','79516JsMdYK','\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)','dryRun','textKnowledgeBases','created','\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','\x20errors','error','reason','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','Dry\x20run\x20-\x20no\x20changes\x20made','projectName','\x0aWrite\x20','Clone\x20\x22','Output\x20path:\x20','✔\x20Context\x20set:\x20','Project:\x20','green','message','context','utf-8','New\x20project\x20name\x20is\x20required','\x0a✔\x20Pushed\x20','\x20\x20Knowledge\x20Base\x20\x22','\x0aChanges:','New\x20project\x20ID:\x20','agent:clone'];a4_0x17eb=function(){return _0x421ae8;};return a4_0x17eb();}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,resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x46f308){const _0x2dd86f=a4_0x179c,_0x1c97cb=[];if(_0x46f308[_0x2dd86f(0x255)]!==undefined)_0x1c97cb[_0x2dd86f(0x27b)](_0x46f308[_0x2dd86f(0x255)]+_0x2dd86f(0x213));if(_0x46f308[_0x2dd86f(0x27f)]!==undefined&&_0x46f308['new']>0x0)_0x1c97cb[_0x2dd86f(0x27b)](a4_0x4484d8[_0x2dd86f(0x26c)](_0x46f308[_0x2dd86f(0x27f)]+'\x20new'));if(_0x46f308[_0x2dd86f(0x25f)]!==undefined&&_0x46f308[_0x2dd86f(0x25f)]>0x0)_0x1c97cb['push'](a4_0x4484d8[_0x2dd86f(0x26c)](_0x46f308[_0x2dd86f(0x25f)]+_0x2dd86f(0x257)));if(_0x46f308[_0x2dd86f(0x205)]!==undefined&&_0x46f308[_0x2dd86f(0x205)]>0x0)_0x1c97cb['push'](a4_0x4484d8['yellow'](_0x46f308['updated']+_0x2dd86f(0x20f)));if(_0x46f308[_0x2dd86f(0x23a)]!==undefined&&_0x46f308[_0x2dd86f(0x23a)]>0x0)_0x1c97cb[_0x2dd86f(0x27b)](a4_0x4484d8[_0x2dd86f(0x22c)](_0x46f308[_0x2dd86f(0x23a)]+_0x2dd86f(0x224)));if(_0x46f308[_0x2dd86f(0x238)]!==undefined&&_0x46f308[_0x2dd86f(0x238)]>0x0)_0x1c97cb[_0x2dd86f(0x27b)](a4_0x4484d8['red'](_0x46f308[_0x2dd86f(0x238)]+_0x2dd86f(0x261)));return _0x1c97cb['join'](',\x20');}function a4_0x179c(_0x198fb2,_0x5b5210){_0x198fb2=_0x198fb2-0x1da;const _0x17ebca=a4_0x17eb();let _0x179ce0=_0x17ebca[_0x198fb2];return _0x179ce0;}function displayDiffs(_0xa010e1,_0x1a902d,_0x47bd5d,_0x45ae27){const _0x333670=a4_0x179c;for(const _0x46a199 of _0xa010e1){if(_0x46a199[_0x333670(0x239)]){const _0x25676b=_0x46a199['agentName']||_0x46a199[_0x333670(0x24b)];console[_0x333670(0x228)](_0x333670(0x1df)+_0x25676b+'\x27:'),console[_0x333670(0x228)]('─'[_0x333670(0x1e8)](0x3c)),console[_0x333670(0x228)](_0x46a199[_0x333670(0x239)]),console[_0x333670(0x228)]('─'[_0x333670(0x1e8)](0x3c));}}for(const _0x3f2646 of _0x1a902d){_0x3f2646[_0x333670(0x239)]&&(console[_0x333670(0x228)](_0x333670(0x237)+_0x3f2646[_0x333670(0x24b)]+'\x27:'),console['log']('─'[_0x333670(0x1e8)](0x3c)),console[_0x333670(0x228)](_0x3f2646['diff']),console[_0x333670(0x228)]('─'['repeat'](0x3c)));}for(const _0x58a86e of _0x47bd5d){_0x58a86e[_0x333670(0x239)]&&(console[_0x333670(0x228)](_0x333670(0x25a)+_0x58a86e['name']+'\x27:'),console[_0x333670(0x228)]('─'['repeat'](0x3c)),console[_0x333670(0x228)](_0x58a86e[_0x333670(0x239)]),console[_0x333670(0x228)]('─'[_0x333670(0x1e8)](0x3c)));}for(const _0x2bfce5 of _0x45ae27){_0x2bfce5[_0x333670(0x239)]&&(console[_0x333670(0x228)](_0x333670(0x21f)+_0x2bfce5[_0x333670(0x24b)]+'\x27:'),console[_0x333670(0x228)]('─'[_0x333670(0x1e8)](0x3c)),console['log'](_0x2bfce5[_0x333670(0x239)]),console[_0x333670(0x228)]('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x4f49a5(0x24b)]=a4_0x4f49a5(0x1de);[a4_0x4f49a5(0x1f3)]=a4_0x4f49a5(0x22b);async[a4_0x4f49a5(0x23d)](_0x1d6bfe){const _0x266f71=a4_0x4f49a5,{options:_0x2c51fe,args:_0x39b65d,tdx:_0x30c2e2}=_0x1d6bfe,_0x502f58=_0x39b65d[0x0],_0x508936=_0x39b65d[0x1],_0x57e52c=_0x2c51fe[_0x266f71(0x23e)],_0x4ce7dc=_0x2c51fe[_0x266f71(0x25d)],_0x120486=_0x2c51fe[_0x266f71(0x286)],_0x580557=_0x2c51fe['yes'],_0x240a7f=_0x2c51fe['llmProject'];let _0x1c34c4,_0x53966f;const _0x3fcf33=findAgentConfigPath(process[_0x266f71(0x209)]());if(_0x502f58){const _0x258006=a4_0x993bfa[_0x266f71(0x1e3)](_0x502f58,_0x266f71(0x24c));if(existsSync(_0x258006))try{const _0x388f04=JSON[_0x266f71(0x21a)](readFileSync(_0x258006,_0x266f71(0x26f)));_0x1c34c4=_0x388f04[_0x266f71(0x23b)],_0x53966f=_0x502f58,console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x235)](_0x266f71(0x220)+_0x258006+':\x20'+_0x1c34c4));}catch{_0x1c34c4=_0x502f58;}else _0x1c34c4=_0x502f58;}else{if(_0x3fcf33)try{const _0x4acac8=JSON['parse'](readFileSync(_0x3fcf33,'utf-8'));_0x1c34c4=_0x4acac8[_0x266f71(0x23b)],_0x53966f=a4_0x993bfa[_0x266f71(0x208)](_0x3fcf33),console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x235)](_0x266f71(0x1f0)+_0x1c34c4));}catch{_0x1c34c4=_0x240a7f;}else _0x1c34c4=_0x240a7f;}if(!_0x1c34c4)return console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x280)](_0x266f71(0x264))),console[_0x266f71(0x228)]('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['log'](_0x266f71(0x260)),console[_0x266f71(0x228)](_0x266f71(0x20a)),console[_0x266f71(0x228)](_0x266f71(0x234)),0x1;if(_0x508936){const {data:_0x2ae8da}=await withSpinner(_0x266f71(0x240)+_0x508936+'\x22\x20from\x20project\x20\x22'+_0x1c34c4+'\x22...',()=>_0x30c2e2[_0x266f71(0x1f6)][_0x266f71(0x278)](_0x1c34c4,_0x508936,_0x57e52c,{'dryRun':_0x4ce7dc,'force':_0x120486}));if(_0x4ce7dc)return console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x280)](_0x266f71(0x254))),console[_0x266f71(0x228)](_0x266f71(0x1e6)+_0x2ae8da[_0x266f71(0x1e1)]),console[_0x266f71(0x228)](_0x266f71(0x269)+_0x2ae8da['outputPath']),_0x2ae8da[_0x266f71(0x239)]&&(console['log'](_0x266f71(0x273)),console[_0x266f71(0x228)]('─'['repeat'](0x3c)),console[_0x266f71(0x228)](_0x2ae8da[_0x266f71(0x239)]),console[_0x266f71(0x228)]('─'[_0x266f71(0x1e8)](0x3c))),0x0;return console['log'](a4_0x4484d8['green']('Agent\x20pulled\x20successfully')),console[_0x266f71(0x228)](_0x266f71(0x233)+_0x2ae8da[_0x266f71(0x1e1)]),console[_0x266f71(0x228)]('Output:\x20'+_0x2ae8da['outputPath']),console[_0x266f71(0x228)](_0x266f71(0x27a)+(_0x2ae8da[_0x266f71(0x1da)]?a4_0x4484d8[_0x266f71(0x26c)](_0x266f71(0x27f)):_0x2ae8da['hasChanges']?a4_0x4484d8[_0x266f71(0x280)](_0x266f71(0x205)):a4_0x4484d8['gray'](_0x266f71(0x23a)))),0x0;}const _0x177e4d=_0x53966f||_0x57e52c,{data:_0x5a354f}=await withSpinner(_0x266f71(0x252)+_0x1c34c4+_0x266f71(0x24f),()=>_0x30c2e2['llm'][_0x266f71(0x1e7)](_0x1c34c4,_0x177e4d,{'dryRun':!![]})),_0xe54a02=_0x5a354f[_0x266f71(0x1db)][_0x266f71(0x207)][_0x266f71(0x27f)]+_0x5a354f[_0x266f71(0x1db)][_0x266f71(0x1dc)][_0x266f71(0x27f)]+_0x5a354f[_0x266f71(0x1db)][_0x266f71(0x25e)][_0x266f71(0x27f)]+_0x5a354f['counts']['prompts'][_0x266f71(0x27f)],_0x179747=_0x5a354f['counts'][_0x266f71(0x207)][_0x266f71(0x205)]+_0x5a354f['counts']['knowledgeBases'][_0x266f71(0x205)]+_0x5a354f[_0x266f71(0x1db)]['textKnowledgeBases'][_0x266f71(0x205)]+_0x5a354f[_0x266f71(0x1db)][_0x266f71(0x1ea)][_0x266f71(0x205)],_0x21cdd5=_0x5a354f[_0x266f71(0x1db)]['agents'][_0x266f71(0x23a)]+_0x5a354f['counts'][_0x266f71(0x1dc)]['unchanged']+_0x5a354f['counts'][_0x266f71(0x25e)]['unchanged']+_0x5a354f['counts'][_0x266f71(0x1ea)][_0x266f71(0x23a)];console['log'](_0x266f71(0x244)+_0x5a354f['projectName']+'\x27:'),console[_0x266f71(0x228)]('\x20\x20'+a4_0x4484d8[_0x266f71(0x26c)]('+\x20'+_0xe54a02+_0x266f71(0x1f4))+'\x20|\x20'+a4_0x4484d8[_0x266f71(0x280)]('~\x20'+_0x179747+_0x266f71(0x281))+_0x266f71(0x253)+a4_0x4484d8[_0x266f71(0x235)]('=\x20'+_0x21cdd5+'\x20unchanged')),console['log'](_0x266f71(0x1e2)+formatCountSummary(_0x5a354f['counts'][_0x266f71(0x207)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x5a354f[_0x266f71(0x1db)]['knowledgeBases'])),console[_0x266f71(0x228)](_0x266f71(0x20d)+formatCountSummary(_0x5a354f[_0x266f71(0x1db)][_0x266f71(0x25e)])),console[_0x266f71(0x228)](_0x266f71(0x1ee)+formatCountSummary(_0x5a354f[_0x266f71(0x1db)][_0x266f71(0x1ea)])),console[_0x266f71(0x228)](_0x266f71(0x287)+a4_0x4484d8['cyan'](_0x5a354f[_0x266f71(0x243)])),displayDiffs(_0x5a354f[_0x266f71(0x207)],_0x5a354f[_0x266f71(0x1dc)],_0x5a354f[_0x266f71(0x25e)],_0x5a354f[_0x266f71(0x1ea)]);if(_0x4ce7dc)return console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x280)](_0x266f71(0x216))),0x0;if(_0xe54a02===0x0&&_0x179747===0x0)return console['log'](a4_0x4484d8[_0x266f71(0x26c)](_0x266f71(0x276))),saveSessionContext({'llm_project':_0x5a354f['projectName']},_0x2c51fe[_0x266f71(0x1f1)]),console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x26c)](_0x266f71(0x26a)+a4_0x4484d8[_0x266f71(0x235)](_0x266f71(0x23b))+_0x266f71(0x202)+a4_0x4484d8[_0x266f71(0x22d)](_0x5a354f[_0x266f71(0x266)]))),0x0;if(!_0x580557&&!_0x120486){const _0x18b3dc=await confirmKey(_0x266f71(0x267)+(_0xe54a02+_0x179747)+_0x266f71(0x21b));if(!_0x18b3dc)return console[_0x266f71(0x228)](_0x266f71(0x231)),0x0;}const {data:_0x557380}=await withSpinner(_0x266f71(0x201),()=>_0x30c2e2['llm']['pullProject'](_0x1c34c4,_0x177e4d,{'force':_0x120486}));return console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x26c)](_0x266f71(0x225)+(_0xe54a02+_0x179747)+'\x20files\x20to\x20'+_0x557380['outputDir'])),saveSessionContext({'llm_project':_0x557380[_0x266f71(0x266)]},_0x2c51fe[_0x266f71(0x1f1)]),console[_0x266f71(0x228)](a4_0x4484d8[_0x266f71(0x26c)](_0x266f71(0x26a)+a4_0x4484d8['dim'](_0x266f71(0x23b))+'\x20=\x20'+a4_0x4484d8['cyan'](_0x557380[_0x266f71(0x266)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x4f49a5(0x24b)]=a4_0x4f49a5(0x275);[a4_0x4f49a5(0x1f3)]=a4_0x4f49a5(0x282);async[a4_0x4f49a5(0x23d)](_0x2d29bb){const _0x4d47be=a4_0x4f49a5,{options:_0x5df384,args:_0xc16576,tdx:_0xaf6d40}=_0x2d29bb,_0x450d0a=_0xc16576[0x0],_0x36de87=_0x5df384[_0x4d47be(0x24b)],_0x9a4db=_0x5df384[_0x4d47be(0x25d)],_0x56131f=_0x5df384[_0x4d47be(0x27d)],_0x1471ea=_0x5df384[_0x4d47be(0x22e)],_0x804e85=_0x5df384['llmProject'];let _0x31a96e;const _0x533210=findAgentConfigPath(process[_0x4d47be(0x209)]());if(_0x450d0a){const _0x4932b5=a4_0x993bfa[_0x4d47be(0x1e3)](_0x450d0a,'tdx.json');existsSync(_0x4932b5)?(_0x31a96e=_0x450d0a,console['log'](a4_0x4484d8[_0x4d47be(0x235)](_0x4d47be(0x222)+_0x450d0a))):_0x31a96e=_0x450d0a;}else{if(_0x533210)_0x31a96e=a4_0x993bfa[_0x4d47be(0x208)](_0x533210),console[_0x4d47be(0x228)](a4_0x4484d8[_0x4d47be(0x235)](_0x4d47be(0x1fa)+_0x31a96e));else{if(_0x804e85){const _0x17ecbe=sanitizeForFilesystem(_0x804e85);let _0x57ab2c=_0x17ecbe,_0x340697=a4_0x993bfa[_0x4d47be(0x1e3)](process[_0x4d47be(0x209)](),_0x4d47be(0x207),_0x17ecbe,_0x4d47be(0x24c));if(!existsSync(_0x340697)){const _0x59430a=normalizeName(_0x804e85),_0x2aeb4c=a4_0x993bfa[_0x4d47be(0x1e3)](process[_0x4d47be(0x209)](),'agents',_0x59430a,_0x4d47be(0x24c));existsSync(_0x2aeb4c)&&(_0x57ab2c=_0x59430a,_0x340697=_0x2aeb4c);}if(existsSync(_0x340697))_0x31a96e=a4_0x993bfa['dirname'](_0x340697),console[_0x4d47be(0x228)](a4_0x4484d8[_0x4d47be(0x235)](_0x4d47be(0x222)+_0x31a96e));else{const _0x29d956=_0x5df384[_0x4d47be(0x259)];if(_0x29d956)throw new SDKError(ErrorCode[_0x4d47be(0x283)],_0x4d47be(0x241)+_0x804e85+'\x22\x20to\x20a\x20different\x20profile',undefined,{'helpText':_0x4d47be(0x1ec)+_0x4d47be(0x242)+(_0x4d47be(0x203)+_0x804e85+'\x0a')+(_0x4d47be(0x246)+_0x57ab2c+_0x4d47be(0x1e4)+(_0x36de87||_0x4d47be(0x20c))+'\x20--profile\x20'+_0x29d956)});_0x31a96e=_0x804e85,console[_0x4d47be(0x228)](a4_0x4484d8[_0x4d47be(0x235)]('Using\x20context\x20project:\x20'+_0x804e85));}}}}if(!_0x31a96e)return console[_0x4d47be(0x228)](a4_0x4484d8['yellow'](_0x4d47be(0x217))),console[_0x4d47be(0x228)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x4d47be(0x228)](_0x4d47be(0x230)),console['log'](_0x4d47be(0x25c)),console[_0x4d47be(0x228)](_0x4d47be(0x247)),0x1;if(!_0x36de87)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x4d47be(0x270),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x56131f&&!_0x9a4db){const _0x46029f=await confirmKey(_0x4d47be(0x268)+_0x31a96e+_0x4d47be(0x1fc)+_0x36de87+'\x22?');if(!_0x46029f)return console[_0x4d47be(0x228)](_0x4d47be(0x1eb)),0x0;}const {data:_0x41e8e4}=await withSpinner(_0x4d47be(0x229)+_0x31a96e+_0x4d47be(0x256)+_0x36de87+_0x4d47be(0x24f),()=>_0xaf6d40['llm'][_0x4d47be(0x204)](_0x31a96e,_0x36de87,{'dryRun':_0x9a4db}));if(_0x9a4db)return console[_0x4d47be(0x228)](a4_0x4484d8['yellow'](_0x4d47be(0x265))),console[_0x4d47be(0x228)](_0x4d47be(0x214)+_0x41e8e4[_0x4d47be(0x236)]),console['log'](_0x4d47be(0x1fb)+_0x36de87),console['log'](_0x4d47be(0x249)),console['log']('\x20\x20Agents:\x20'+_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x207)][_0x4d47be(0x25f)]),console['log'](_0x4d47be(0x277)+_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x1dc)][_0x4d47be(0x25f)]),console[_0x4d47be(0x228)](_0x4d47be(0x1ee)+_0x41e8e4['counts'][_0x4d47be(0x1ea)]['created']),0x0;const _0x2724d8=_0x41e8e4['counts'][_0x4d47be(0x207)][_0x4d47be(0x238)]>0x0||_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x1dc)][_0x4d47be(0x238)]>0x0||_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x1ea)][_0x4d47be(0x238)]>0x0;_0x2724d8?console['log'](a4_0x4484d8['yellow']('Project\x20cloned\x20with\x20errors')):console[_0x4d47be(0x228)](a4_0x4484d8['green'](_0x4d47be(0x21d)));console['log'](_0x4d47be(0x214)+_0x41e8e4['sourceProjectName']),console[_0x4d47be(0x228)]('New\x20project:\x20'+_0x41e8e4[_0x4d47be(0x1f9)]),console[_0x4d47be(0x228)](_0x4d47be(0x274)+_0x41e8e4[_0x4d47be(0x212)]),console[_0x4d47be(0x228)](),console[_0x4d47be(0x228)](_0x4d47be(0x1e5)),console[_0x4d47be(0x228)]('\x20\x20Agents:\x20'+formatCountSummary(_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x207)])),console[_0x4d47be(0x228)](_0x4d47be(0x277)+formatCountSummary(_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x1dc)])),console['log'](_0x4d47be(0x1ee)+formatCountSummary(_0x41e8e4[_0x4d47be(0x1db)][_0x4d47be(0x1ea)]));if(_0x2724d8){console[_0x4d47be(0x228)](),console['log'](a4_0x4484d8['red'](_0x4d47be(0x20e)));for(const _0x5b5596 of _0x41e8e4['agents']){_0x5b5596[_0x4d47be(0x258)]===_0x4d47be(0x262)&&console['log'](a4_0x4484d8[_0x4d47be(0x227)](_0x4d47be(0x21e)+_0x5b5596[_0x4d47be(0x1e1)]+_0x4d47be(0x1f2)+_0x5b5596[_0x4d47be(0x262)]));}for(const _0x49c603 of _0x41e8e4[_0x4d47be(0x1dc)]){_0x49c603[_0x4d47be(0x258)]==='error'&&console['log'](a4_0x4484d8[_0x4d47be(0x227)](_0x4d47be(0x272)+_0x49c603[_0x4d47be(0x24b)]+_0x4d47be(0x1f2)+_0x49c603[_0x4d47be(0x262)]));}for(const _0x10f100 of _0x41e8e4[_0x4d47be(0x1ea)]){_0x10f100['action']==='error'&&console[_0x4d47be(0x228)](a4_0x4484d8[_0x4d47be(0x227)](_0x4d47be(0x223)+_0x10f100[_0x4d47be(0x24b)]+_0x4d47be(0x1f2)+_0x10f100['error']));}return 0x1;}console[_0x4d47be(0x228)]();const _0x4c8098=getLLMProjectUrl(_0x1471ea,_0x41e8e4[_0x4d47be(0x212)]);return console[_0x4d47be(0x228)](_0x4d47be(0x26b)+a4_0x4484d8['cyan'](_0x4c8098)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x4f49a5(0x24a);[a4_0x4f49a5(0x1f3)]=a4_0x4f49a5(0x1ed);async[a4_0x4f49a5(0x23d)](_0x9990d){const _0x54f460=a4_0x4f49a5,{options:_0x4cd2f9,args:_0x12edca,tdx:_0x1168a5}=_0x9990d;let _0x56d335=_0x12edca[0x0]||process[_0x54f460(0x209)]();const _0x56eaa6=_0x4cd2f9['dryRun'],_0x4f9ec6=_0x4cd2f9[_0x54f460(0x286)],_0x2377b4=_0x4cd2f9[_0x54f460(0x27d)],_0xa200a6=_0x4cd2f9[_0x54f460(0x22e)],_0x5ccfc7=a4_0x993bfa['join'](_0x56d335,_0x54f460(0x226)),_0x4ade44=existsSync(_0x5ccfc7);if(_0x4ade44){const {data:_0x109935}=await withSpinner(_0x54f460(0x22f)+_0x56d335+_0x54f460(0x24f),()=>_0x1168a5[_0x54f460(0x1f6)][_0x54f460(0x250)](_0x56d335,{'dryRun':_0x56eaa6,'force':_0x4f9ec6}));if(_0x56eaa6)return console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x280)](_0x54f460(0x265))),console[_0x54f460(0x228)](_0x54f460(0x1dd)+_0x109935['agentName']),0x0;if(_0x109935[_0x54f460(0x258)]===_0x54f460(0x262))return console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x227)]('Failed\x20to\x20push\x20agent:\x20'+_0x109935[_0x54f460(0x262)])),0x1;console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x26c)](_0x54f460(0x20b)+_0x109935[_0x54f460(0x258)]+'\x20successfully')),console[_0x54f460(0x228)](_0x54f460(0x233)+_0x109935[_0x54f460(0x1e1)]);if(_0x109935[_0x54f460(0x245)]&&_0x109935['projectId']){const _0x408162=getLLMAgentChatUrl(_0xa200a6,_0x109935[_0x54f460(0x1f8)],_0x109935[_0x54f460(0x245)]);console[_0x54f460(0x228)](_0x54f460(0x206)+a4_0x4484d8[_0x54f460(0x22d)](_0x408162));}return 0x0;}const _0xe6a217=_0x4cd2f9[_0x54f460(0x22a)],_0x57db73=resolveProjectFromContext(_0x56d335,_0xe6a217);if(_0x57db73[_0x54f460(0x24e)])_0x56d335=_0x57db73[_0x54f460(0x1e0)],_0x57db73[_0x54f460(0x218)]===_0x54f460(0x26e)&&console['log'](a4_0x4484d8['dim']('Using\x20project:\x20'+_0x56d335));else{let _0x2abf96=_0x54f460(0x23f);_0x57db73[_0x54f460(0x263)]===_0x54f460(0x23c)&&(_0x2abf96=_0x57db73['message']+_0x54f460(0x24d)+_0x57db73[_0x54f460(0x22a)]+'\x27\x20to\x20create\x20the\x20folder\x20structure.');throw new SDKError(ErrorCode[_0x54f460(0x283)],_0x57db73[_0x54f460(0x263)]===_0x54f460(0x27c)?_0x57db73[_0x54f460(0x26d)]:_0x54f460(0x251)+_0x56d335,undefined,{'helpText':_0x2abf96});}const {data:_0x5d3998}=await withSpinner(_0x54f460(0x21c),()=>_0x1168a5[_0x54f460(0x1f6)][_0x54f460(0x211)](_0x56d335,{'dryRun':!![]})),_0x24ed9a=_0x5d3998['counts']['agents'][_0x54f460(0x238)]>0x0;if(_0x24ed9a){console['log'](a4_0x4484d8[_0x54f460(0x227)](_0x54f460(0x221)));for(const _0x548bb1 of _0x5d3998[_0x54f460(0x207)]){_0x548bb1[_0x54f460(0x258)]==='error'&&console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x227)](_0x54f460(0x21e)+_0x548bb1[_0x54f460(0x1e1)]+'\x22:\x20'+_0x548bb1[_0x54f460(0x262)]));}return 0x1;}const _0x302b52=_0x5d3998['counts']['agents'][_0x54f460(0x25f)]+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x1dc)]['created']+_0x5d3998[_0x54f460(0x1db)]['textKnowledgeBases']['created']+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x1ea)]['created'],_0x4f40bc=_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x207)][_0x54f460(0x205)]+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x1dc)][_0x54f460(0x205)]+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x25e)][_0x54f460(0x205)]+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x1ea)][_0x54f460(0x205)],_0x1626b1=_0x5d3998[_0x54f460(0x1db)]['agents']['unchanged']+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x1dc)][_0x54f460(0x23a)]+_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x25e)]['unchanged']+_0x5d3998['counts'][_0x54f460(0x1ea)][_0x54f460(0x23a)];console['log'](_0x54f460(0x248)+_0x5d3998['projectName']+'\x27:'),console[_0x54f460(0x228)]('\x20\x20'+a4_0x4484d8[_0x54f460(0x26c)]('+\x20'+_0x302b52+_0x54f460(0x1f4))+_0x54f460(0x253)+a4_0x4484d8[_0x54f460(0x280)]('~\x20'+_0x4f40bc+'\x20changed')+'\x20|\x20'+a4_0x4484d8[_0x54f460(0x235)]('=\x20'+_0x1626b1+_0x54f460(0x224))),console[_0x54f460(0x228)](_0x54f460(0x1e2)+formatCountSummary(_0x5d3998[_0x54f460(0x1db)]['agents'])),console[_0x54f460(0x228)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x5d3998[_0x54f460(0x1db)]['knowledgeBases'])),console[_0x54f460(0x228)](_0x54f460(0x20d)+formatCountSummary(_0x5d3998[_0x54f460(0x1db)]['textKnowledgeBases'])),console[_0x54f460(0x228)](_0x54f460(0x1ee)+formatCountSummary(_0x5d3998[_0x54f460(0x1db)][_0x54f460(0x1ea)])),console[_0x54f460(0x228)](_0x54f460(0x1ef)+a4_0x4484d8[_0x54f460(0x22d)](_0x56d335)),displayDiffs(_0x5d3998[_0x54f460(0x207)],_0x5d3998[_0x54f460(0x1dc)],_0x5d3998[_0x54f460(0x25e)],_0x5d3998[_0x54f460(0x1ea)]);if(_0x56eaa6)return console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x280)](_0x54f460(0x1fd))),0x0;if(_0x302b52===0x0&&_0x4f40bc===0x0){console[_0x54f460(0x228)](a4_0x4484d8['green']('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x2b0560=getLLMProjectUrl(_0xa200a6,_0x5d3998['projectId']);return console[_0x54f460(0x228)](_0x54f460(0x26b)+a4_0x4484d8[_0x54f460(0x22d)](_0x2b0560)),0x0;}if(!_0x2377b4&&!_0x4f9ec6){const _0x4f563c=await confirmKey('\x0aPush\x20'+(_0x302b52+_0x4f40bc)+_0x54f460(0x1f7));if(!_0x4f563c)return console[_0x54f460(0x228)](_0x54f460(0x210)),0x0;}const {data:_0x460d4b}=await withSpinner(_0x54f460(0x284),()=>_0x1168a5[_0x54f460(0x1f6)][_0x54f460(0x211)](_0x56d335,{'force':_0x4f9ec6})),_0x537c62=_0x460d4b[_0x54f460(0x1db)]['agents']['errors']>0x0||_0x460d4b[_0x54f460(0x1db)][_0x54f460(0x1dc)]['errors']>0x0||_0x460d4b[_0x54f460(0x1db)][_0x54f460(0x25e)][_0x54f460(0x238)]>0x0||_0x460d4b[_0x54f460(0x1db)][_0x54f460(0x1ea)][_0x54f460(0x238)]>0x0;if(_0x537c62){console['log'](a4_0x4484d8[_0x54f460(0x280)](_0x54f460(0x1ff))),console[_0x54f460(0x228)](),console['log'](a4_0x4484d8[_0x54f460(0x227)](_0x54f460(0x20e)));for(const _0x342daf of _0x460d4b['agents']){_0x342daf[_0x54f460(0x258)]===_0x54f460(0x262)&&console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x227)](_0x54f460(0x21e)+_0x342daf['agentName']+'\x22:\x20'+_0x342daf[_0x54f460(0x262)]));}for(const _0x384390 of _0x460d4b[_0x54f460(0x1dc)]){_0x384390[_0x54f460(0x258)]===_0x54f460(0x262)&&console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x227)](_0x54f460(0x272)+_0x384390[_0x54f460(0x24b)]+_0x54f460(0x1f2)+_0x384390[_0x54f460(0x262)]));}for(const _0x437723 of _0x460d4b[_0x54f460(0x25e)]){_0x437723[_0x54f460(0x258)]===_0x54f460(0x262)&&console[_0x54f460(0x228)](a4_0x4484d8['red'](_0x54f460(0x1fe)+_0x437723[_0x54f460(0x24b)]+_0x54f460(0x1f2)+_0x437723[_0x54f460(0x262)]));}for(const _0x118f17 of _0x460d4b['prompts']){_0x118f17['action']===_0x54f460(0x262)&&console[_0x54f460(0x228)](a4_0x4484d8[_0x54f460(0x227)](_0x54f460(0x223)+_0x118f17[_0x54f460(0x24b)]+_0x54f460(0x1f2)+_0x118f17[_0x54f460(0x262)]));}return 0x1;}console['log'](a4_0x4484d8['green'](_0x54f460(0x271)+(_0x302b52+_0x4f40bc)+_0x54f460(0x1f5)+_0x460d4b[_0x54f460(0x266)]+'\x27'));const _0x3c70d5=getLLMProjectUrl(_0xa200a6,_0x460d4b['projectId']);return console[_0x54f460(0x228)](_0x54f460(0x26b)+a4_0x4484d8['cyan'](_0x3c70d5)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a5_0x476c(_0x5df0d8,_0x144026){_0x5df0d8=_0x5df0d8-0x1e8;const _0x147d12=a5_0x147d();let _0x476c4a=_0x147d12[_0x5df0d8];return _0x476c4a;}function a5_0x147d(){const _0x204723=['table','output','Failed:\x20\x20\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','red','message','✗\x20ERROR:\x20','conversation_url','repeat','jsonl','agentDirs','Errors:\x20\x20\x20','Usage:','log','existsSync','dim','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','Using\x20agent:\x20','source','toLowerCase','stop','test.yml','65564jubTCf','\x20\x20Project:\x20','\x22:\x20','425ZWcRPG','projectName','PASS','\x20\x20Evaluating...\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','agentName','round','...\x20','569817AAsYLS','utf-8','resolveProjectId','substring','length','9824504wcmtXx','status','toISOString','Agent:\x20','Round\x20','includes','371030mcMMtl','Run\x20\x27tdx\x20agent\x20pull\x20','Conversation\x20URL:\x20','Running\x20agent\x20tests...','llmProject','found','✓\x20PASS:\x20','Failed\x20Tests:','llm','404','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','Test\x20','push','white','Project\x20path:\x20','tsv','rounds','no_local_folder','verbose','split','2712351FcHkfh','no_tests','json',':\x20Sending\x20user\x20input...','writeFileSync','yellow','reason','\x20\x20-\x20','now','start','cyan','\x20\x20Site:\x20','description','agent:test','name','Round\x201/','filter','\x20\x20Agent:\x20','map','7sNXswS','not\x20found','resolveAgentId','Test\x20Configuration:','projectDir','7652964uJWhXS','72811EhwSvG','Test\x20Summary','tests','Evaluating\x20response...','\x20\x20tdx\x20agent\x20test\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20from\x20path','green','context','✗\x20ERROR:\x20Project\x20not\x20found:\x20','16BTWgKh','ERROR','Total:\x20\x20\x20\x20','FAIL','/<agent-name>','Run\x20tests\x20for\x20an\x20LLM\x20agent','\x20\x20Round\x20','Tests\x20found:\x20','...','640DhsahO','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','trim','Error\x20writing\x20output\x20file:\x20'];a5_0x147d=function(){return _0x204723;};return a5_0x147d();}const a5_0xffbd61=a5_0x476c;(function(_0x26dffd,_0x376525){const _0x5e453e=a5_0x476c,_0x493011=_0x26dffd();while(!![]){try{const _0x44eda6=parseInt(_0x5e453e(0x20d))/0x1*(parseInt(_0x5e453e(0x215))/0x2)+parseInt(_0x5e453e(0x1f4))/0x3+parseInt(_0x5e453e(0x238))/0x4*(parseInt(_0x5e453e(0x23b))/0x5)+parseInt(_0x5e453e(0x20c))/0x6*(-parseInt(_0x5e453e(0x207))/0x7)+parseInt(_0x5e453e(0x248))/0x8+parseInt(_0x5e453e(0x243))/0x9+parseInt(_0x5e453e(0x21e))/0xa*(-parseInt(_0x5e453e(0x24e))/0xb);if(_0x44eda6===_0x376525)break;else _0x493011['push'](_0x493011['shift']());}catch(_0x286fc2){_0x493011['push'](_0x493011['shift']());}}}(a5_0x147d,0xb3eea));import*as a5_0x50707f from'node:fs';import*as a5_0x52c272 from'node:path';import a5_0xc38cd3 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0xffbd61(0x202)]=a5_0xffbd61(0x201);[a5_0xffbd61(0x200)]=a5_0xffbd61(0x21a);async['execute'](_0x4e42a8){const _0x23490d=a5_0xffbd61,{options:_0x5ae3df,args:_0x2ca136,tdx:_0x28a0ca}=_0x4e42a8,_0x575373=_0x2ca136[0x0]||'.',_0x31f6bd=_0x5ae3df['dryRun'],_0x4e61c5=_0x5ae3df,_0x534370=_0x4e61c5['eval']===![],_0x286362=_0x4e61c5['name'],_0x6b6c7a=_0x5ae3df['site'],_0x990c9b=_0x4e61c5[_0x23490d(0x223)];let _0x47a842=_0x23490d(0x222);if(_0x4e61c5[_0x23490d(0x1f6)])_0x47a842=_0x23490d(0x1f6);else{if(_0x4e61c5[_0x23490d(0x22b)])_0x47a842=_0x23490d(0x22b);else{if(_0x4e61c5['tsv'])_0x47a842=_0x23490d(0x1ef);else{if(_0x4e61c5[_0x23490d(0x222)])_0x47a842=_0x23490d(0x222);}}}const _0x59fed1=_0x4e61c5['llmProject'];let _0x443981=_0x575373;const _0x39bff0=a5_0x50707f[_0x23490d(0x230)](_0x575373),_0x578056=_0x575373==='.';if(!_0x39bff0||_0x578056){const _0x41f5e1=resolveProjectFromContext(_0x575373,_0x59fed1,{'requireFile':_0x23490d(0x237)});if(_0x41f5e1[_0x23490d(0x253)])_0x443981=_0x41f5e1[_0x23490d(0x20b)],_0x41f5e1[_0x23490d(0x234)]===_0x23490d(0x213)&&console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x231)](_0x23490d(0x233)+_0x443981));else switch(_0x41f5e1[_0x23490d(0x1fa)]){case'no_context':console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x1f9)](_0x41f5e1[_0x23490d(0x227)])),console['log'](),console[_0x23490d(0x22f)](_0x23490d(0x22e)),console[_0x23490d(0x22f)](_0x23490d(0x211)),console['log']('\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x23490d(0x22f)](),console['log']('Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>');return 0x1;case _0x23490d(0x1f1):console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x1f9)](_0x41f5e1[_0x23490d(0x227)])),console[_0x23490d(0x22f)](),console['log'](_0x23490d(0x24f)+_0x41f5e1[_0x23490d(0x252)]+'\x27\x20to\x20create\x20the\x20folder\x20structure.');return 0x1;case'multiple_agents':{const _0x575247=a5_0x52c272['basename'](_0x41f5e1[_0x23490d(0x20b)]);console['log'](a5_0xc38cd3[_0x23490d(0x1f9)]('Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22'+_0x41f5e1[_0x23490d(0x252)]+'\x22:'));for(const _0x1d4dba of _0x41f5e1[_0x23490d(0x22c)]){console[_0x23490d(0x22f)](_0x23490d(0x1fb)+_0x1d4dba);}return console[_0x23490d(0x22f)](),console[_0x23490d(0x22f)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x575247+_0x23490d(0x219)),0x1;}case _0x23490d(0x1f5):console['log'](a5_0xc38cd3[_0x23490d(0x1f9)](_0x23490d(0x21f)+_0x41f5e1['llmProject']+'\x22.')),console['log'](a5_0xc38cd3[_0x23490d(0x231)](_0x23490d(0x1ee)+_0x41f5e1[_0x23490d(0x20b)])),console['log'](),console['log']('Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.');return 0x1;}}const {definition:_0x5602f4,agentInfo:_0x421af9}=parseTestFile(_0x443981);let _0x223969=_0x5602f4[_0x23490d(0x20f)];if(_0x286362){const _0x473d74=_0x286362[_0x23490d(0x1f3)](',')[_0x23490d(0x206)](_0x1e1cb7=>_0x1e1cb7[_0x23490d(0x220)]());_0x223969=_0x5602f4[_0x23490d(0x20f)]['filter'](_0xe4bc6e=>_0x473d74['includes'](_0xe4bc6e['name']));if(_0x223969[_0x23490d(0x247)]===0x0)return console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x1f9)]('No\x20tests\x20found\x20matching:\x20'+_0x286362)),console['log'](a5_0xc38cd3[_0x23490d(0x231)]('Available\x20tests:\x20'+_0x5602f4[_0x23490d(0x20f)]['map'](_0x37a2b2=>_0x37a2b2['name'])['join'](',\x20'))),0x1;}if(_0x31f6bd){console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x1fe)](_0x23490d(0x20a))),console[_0x23490d(0x22f)](_0x23490d(0x1ff)+a5_0xc38cd3[_0x23490d(0x1ed)](_0x6b6c7a)),console['log'](_0x23490d(0x239)+a5_0xc38cd3[_0x23490d(0x1ed)](_0x421af9[_0x23490d(0x23c)])),console[_0x23490d(0x22f)](_0x23490d(0x205)+a5_0xc38cd3[_0x23490d(0x1ed)](_0x421af9[_0x23490d(0x240)])),console[_0x23490d(0x22f)](),console['log'](_0x23490d(0x21c)+a5_0xc38cd3[_0x23490d(0x1ed)](_0x223969[_0x23490d(0x247)]));for(let _0x336cfc=0x0;_0x336cfc<_0x223969[_0x23490d(0x247)];_0x336cfc++){const _0x28288a=_0x223969[_0x336cfc],_0xbd9edc=_0x28288a[_0x23490d(0x1f0)][_0x23490d(0x247)]===0x1?_0x23490d(0x241):_0x23490d(0x1f0);console['log']('\x20\x20'+(_0x336cfc+0x1)+'.\x20'+a5_0xc38cd3['white'](_0x28288a[_0x23490d(0x202)])+'\x20('+_0x28288a[_0x23490d(0x1f0)][_0x23490d(0x247)]+'\x20'+_0xbd9edc+')');}return 0x0;}let _0x142418,_0x3d3efc;try{_0x142418=await _0x28a0ca['llm'][_0x23490d(0x245)](_0x421af9['projectName']);}catch(_0x389609){const _0x1cde51=_0x389609 instanceof Error?_0x389609[_0x23490d(0x227)]:String(_0x389609);return _0x1cde51['includes'](_0x23490d(0x1e9))||_0x1cde51[_0x23490d(0x235)]()[_0x23490d(0x24d)]('not\x20found')?console['log'](a5_0xc38cd3['red'](_0x23490d(0x214)+_0x421af9[_0x23490d(0x23c)])):console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x226)](_0x23490d(0x225)+_0x421af9[_0x23490d(0x23c)]+_0x23490d(0x23a)+_0x1cde51)),0x1;}try{_0x3d3efc=await _0x28a0ca['llm'][_0x23490d(0x209)](_0x421af9[_0x23490d(0x240)],_0x142418);}catch(_0x4c836b){const _0x496967=_0x4c836b instanceof Error?_0x4c836b[_0x23490d(0x227)]:String(_0x4c836b);return _0x496967['includes'](_0x23490d(0x1e9))||_0x496967[_0x23490d(0x235)]()[_0x23490d(0x24d)](_0x23490d(0x208))?console[_0x23490d(0x22f)](a5_0xc38cd3['red'](_0x23490d(0x232)+_0x421af9['agentName'])):console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x226)](_0x23490d(0x23f)+_0x421af9[_0x23490d(0x240)]+_0x23490d(0x23a)+_0x496967)),0x1;}let _0x5e555f;if(!_0x534370)try{_0x5e555f=await setupEvaluatorAgent(_0x28a0ca[_0x23490d(0x1e8)],_0x5ae3df[_0x23490d(0x1f2)]);}catch(_0x5600f2){const _0x17c4a7=_0x5600f2 instanceof Error?_0x5600f2[_0x23490d(0x227)]:String(_0x5600f2);return console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x226)](_0x23490d(0x1ea)+_0x17c4a7)),0x1;}console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x1fe)](_0x23490d(0x251))),console[_0x23490d(0x22f)]('Site:\x20'+a5_0xc38cd3[_0x23490d(0x1ed)](_0x6b6c7a)),console[_0x23490d(0x22f)](_0x23490d(0x24b)+a5_0xc38cd3[_0x23490d(0x1ed)](_0x421af9[_0x23490d(0x23c)]+'/'+_0x421af9[_0x23490d(0x240)])),console[_0x23490d(0x22f)]();const _0x420300=[],_0xd8ed46=Date[_0x23490d(0x1fc)]();for(let _0x171544=0x0;_0x171544<_0x223969[_0x23490d(0x247)];_0x171544++){const _0x5566bd=_0x223969[_0x171544];_0x223969[_0x23490d(0x247)]>0x1?console[_0x23490d(0x22f)](_0x23490d(0x1eb)+(_0x171544+0x1)+'/'+_0x223969[_0x23490d(0x247)]+':\x20'+a5_0xc38cd3[_0x23490d(0x1ed)](_0x5566bd[_0x23490d(0x202)])):console['log']('Running\x20test:\x20'+a5_0xc38cd3[_0x23490d(0x1ed)](_0x5566bd[_0x23490d(0x202)]));const _0x275bb4=createCommandSpinner(_0x23490d(0x203)+_0x5566bd['rounds'][_0x23490d(0x247)]+':\x20Sending\x20user\x20input...');_0x275bb4[_0x23490d(0x1fd)]();try{const {result:_0x5c6667}=await runTest(_0x28a0ca[_0x23490d(0x1e8)],_0x5566bd,{'agentId':_0x3d3efc,'projectId':_0x142418,'site':_0x6b6c7a,'noEval':_0x534370,'evaluatorId':_0x5e555f,'onRoundStart':(_0x1386b3,_0x6ea636)=>{const _0x2888f0=_0x23490d;_0x275bb4['text']=_0x2888f0(0x24c)+(_0x1386b3+0x1)+'/'+_0x6ea636+_0x2888f0(0x1f7);},'onRoundComplete':(_0xc30e66,_0x35221c,_0x3fce0d)=>{const _0x222839=_0x23490d,_0x277ee2=formatElapsed(_0x35221c);_0x3fce0d?console[_0x222839(0x22f)](_0x222839(0x21b)+(_0xc30e66+0x1)+'/'+_0x5566bd[_0x222839(0x1f0)][_0x222839(0x247)]+_0x222839(0x242)+a5_0xc38cd3['green']('✓')+'\x20('+_0x277ee2+')'):console[_0x222839(0x22f)]('\x20\x20Round\x20'+(_0xc30e66+0x1)+'/'+_0x5566bd[_0x222839(0x1f0)]['length']+_0x222839(0x242)+a5_0xc38cd3[_0x222839(0x226)]('✗'));},'onEvaluationStart':()=>{const _0x529aad=_0x23490d;_0x275bb4['text']=_0x529aad(0x210);},'onEvaluationComplete':_0x18ad84=>{const _0x1763d2=_0x23490d,_0x166ac7=formatElapsed(_0x18ad84);console[_0x1763d2(0x22f)](_0x1763d2(0x23e)+a5_0xc38cd3[_0x1763d2(0x212)]('✓')+'\x20('+_0x166ac7+')');}});_0x275bb4['stop'](),_0x420300[_0x23490d(0x1ec)](_0x5c6667);if(_0x5c6667['status']===_0x23490d(0x23d))console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x212)](_0x23490d(0x254)+_0x5c6667['reason']));else _0x5c6667[_0x23490d(0x249)]===_0x23490d(0x218)?console['log'](a5_0xc38cd3['red']('✗\x20FAIL:\x20'+_0x5c6667[_0x23490d(0x1fa)])):console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x226)]('✗\x20ERROR:\x20'+_0x5c6667['reason']));_0x5c6667[_0x23490d(0x229)]&&console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x231)](_0x23490d(0x250)+_0x5c6667['conversation_url'])),console[_0x23490d(0x22f)]();}catch(_0x1a4462){_0x275bb4[_0x23490d(0x236)]();const _0x274a57=_0x1a4462 instanceof Error?_0x1a4462[_0x23490d(0x227)]:String(_0x1a4462);console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x226)](_0x23490d(0x228)+_0x274a57)),console[_0x23490d(0x22f)](),_0x420300[_0x23490d(0x1ec)]({'name':_0x5566bd['name'],'status':_0x23490d(0x216),'reason':_0x274a57,'timestamp':new Date()[_0x23490d(0x24a)](),'duration_ms':0x0});}}const _0x5ccba6=Date['now']()-_0xd8ed46,_0x56c1eb=_0x420300['filter'](_0x2209f3=>_0x2209f3[_0x23490d(0x249)]===_0x23490d(0x23d))['length'],_0x1b6576=_0x420300[_0x23490d(0x204)](_0x15dafa=>_0x15dafa[_0x23490d(0x249)]===_0x23490d(0x218))['length'],_0x5dd098=_0x420300['filter'](_0x2779f2=>_0x2779f2[_0x23490d(0x249)]===_0x23490d(0x216))[_0x23490d(0x247)];console[_0x23490d(0x22f)]('━'[_0x23490d(0x22a)](0x3c)),console['log'](_0x23490d(0x20e)),console['log']('━'['repeat'](0x3c)),console['log'](_0x23490d(0x217)+_0x420300[_0x23490d(0x247)]),console['log']('Passed:\x20\x20\x20'+a5_0xc38cd3['green'](_0x56c1eb)),console[_0x23490d(0x22f)](_0x23490d(0x224)+a5_0xc38cd3[_0x23490d(0x226)](_0x1b6576));_0x5dd098>0x0&&console[_0x23490d(0x22f)](_0x23490d(0x22d)+a5_0xc38cd3[_0x23490d(0x226)](_0x5dd098));console[_0x23490d(0x22f)]('Duration:\x20'+formatElapsed(_0x5ccba6)),console[_0x23490d(0x22f)]('━'[_0x23490d(0x22a)](0x3c));const _0x4cf03e=_0x420300[_0x23490d(0x204)](_0xdb17ab=>_0xdb17ab[_0x23490d(0x249)]!==_0x23490d(0x23d));if(_0x4cf03e['length']>0x0){console['log'](),console[_0x23490d(0x22f)](_0x23490d(0x255));for(const _0x361251 of _0x4cf03e){const _0x5d594d=a5_0xc38cd3['red']('✗'),_0x5f59af=_0x361251[_0x23490d(0x1fa)][_0x23490d(0x247)]>0x32?_0x361251[_0x23490d(0x1fa)][_0x23490d(0x246)](0x0,0x32)+_0x23490d(0x21d):_0x361251[_0x23490d(0x1fa)];console[_0x23490d(0x22f)]('\x20\x20'+_0x5d594d+'\x20'+_0x361251[_0x23490d(0x202)]+':\x20'+_0x5f59af);}}const _0x15d250={'summary':{'total':_0x420300[_0x23490d(0x247)],'passed':_0x56c1eb,'failed':_0x1b6576,'errors':_0x5dd098>0x0?_0x5dd098:undefined,'duration_ms':_0x5ccba6},'tests':_0x420300,'agent':{'project':_0x421af9['projectName'],'name':_0x421af9[_0x23490d(0x240)],'site':_0x6b6c7a},'timestamp':new Date(_0xd8ed46)['toISOString']()};if(_0x47a842!=='table'||_0x990c9b){const _0x2b9312=formatResults(_0x15d250,_0x47a842);if(_0x990c9b)try{a5_0x50707f[_0x23490d(0x1f8)](_0x990c9b,_0x2b9312,_0x23490d(0x244)),console[_0x23490d(0x22f)](),console[_0x23490d(0x22f)](a5_0xc38cd3['dim']('Output\x20written\x20to:\x20'+_0x990c9b));}catch(_0x1b70ce){return console[_0x23490d(0x22f)](),console[_0x23490d(0x22f)](a5_0xc38cd3[_0x23490d(0x226)](_0x23490d(0x221)+_0x1b70ce)),0x1;}else console['log'](),console['log'](_0x2b9312);}return _0x4cf03e[_0x23490d(0x247)]>0x0?0x1:0x0;}}
|
|
1
|
+
const a5_0x3ad796=a5_0x4aed;(function(_0x387722,_0x4390c7){const _0x2fbc2f=a5_0x4aed,_0x3f4461=_0x387722();while(!![]){try{const _0x5e5df4=parseInt(_0x2fbc2f(0x1af))/0x1*(-parseInt(_0x2fbc2f(0x202))/0x2)+parseInt(_0x2fbc2f(0x1cb))/0x3+-parseInt(_0x2fbc2f(0x1c6))/0x4+-parseInt(_0x2fbc2f(0x1ad))/0x5+parseInt(_0x2fbc2f(0x1ff))/0x6*(parseInt(_0x2fbc2f(0x1ee))/0x7)+-parseInt(_0x2fbc2f(0x1eb))/0x8*(-parseInt(_0x2fbc2f(0x1d9))/0x9)+-parseInt(_0x2fbc2f(0x1de))/0xa;if(_0x5e5df4===_0x4390c7)break;else _0x3f4461['push'](_0x3f4461['shift']());}catch(_0x285581){_0x3f4461['push'](_0x3f4461['shift']());}}}(a5_0x3845,0xa91ea));function a5_0x4aed(_0x13823d,_0x328d2a){_0x13823d=_0x13823d-0x1ac;const _0x384519=a5_0x3845();let _0x4aedac=_0x384519[_0x13823d];return _0x4aedac;}import*as a5_0x5dc76c from'node:fs';import*as a5_0x2750da from'node:path';import a5_0x5b9f50 from'chalk';function a5_0x3845(){const _0x32885b=['llm','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','join','/<agent-name>','\x27\x20to\x20create\x20the\x20folder\x20structure.','map','json','8Ypfiyw','Error\x20writing\x20output\x20file:\x20','test.yml','32081MPlUgS','Errors:\x20\x20\x20','\x20\x20tdx\x20agent\x20test\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20from\x20path','Failed\x20Tests:','utf-8','dim','\x20\x20-\x20','rounds','start','\x20\x20Project:\x20','cyan','name','\x20\x20Round\x20','no_tests','white','no_local_folder','resolveAgentId','1746wbZlFW','split','llmProject','33914IxxZNY','dryRun','Output\x20written\x20to:\x20',':\x20Sending\x20user\x20input...','Test\x20','includes','Site:\x20','Available\x20tests:\x20','agentName','length','toLowerCase','Run\x20tests\x20for\x20an\x20LLM\x20agent','round','projectDir','substring','context','existsSync','execute','662785ouVfPM','log','29shNYgb','agent:test','Round\x201/','✗\x20ERROR:\x20','Running\x20agent\x20tests...','resolveProjectId','tests','conversation_url','tsv','verbose','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','repeat','stop','found','message','basename','red','trim','description','Failed:\x20\x20\x20','404','projectName','\x20\x20Site:\x20','2616892lUbFWU','now','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','output','site','3526551tHophL','Test\x20Configuration:','text','status','filter','No\x20tests\x20found\x20matching:\x20','not\x20found','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','no_context','Tests\x20found:\x20','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','PASS','yellow','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','9376812AnCDeY','...\x20','reason','\x20\x20Evaluating...\x20','toISOString','15797910AsSsVL','FAIL','green','Test\x20Summary','table','Usage:'];a5_0x3845=function(){return _0x32885b;};return a5_0x3845();}import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{['name']=a5_0x3ad796(0x1b0);[a5_0x3ad796(0x1c1)]=a5_0x3ad796(0x20d);async[a5_0x3ad796(0x1ac)](_0x2b375c){const _0x4f2304=a5_0x3ad796,{options:_0x1df64d,args:_0x198980,tdx:_0x1ab0a7}=_0x2b375c,_0x4a010f=_0x198980[0x0]||'.',_0x47ea75=_0x1df64d[_0x4f2304(0x203)],_0x4a26ba=_0x1df64d,_0x366558=_0x4a26ba['eval']===![],_0x27ea9b=_0x4a26ba[_0x4f2304(0x1f9)],_0x2c859b=_0x1df64d[_0x4f2304(0x1ca)],_0x1a1e17=_0x4a26ba[_0x4f2304(0x1c9)];let _0x4117a8=_0x4f2304(0x1e2);if(_0x4a26ba[_0x4f2304(0x1ea)])_0x4117a8=_0x4f2304(0x1ea);else{if(_0x4a26ba['jsonl'])_0x4117a8='jsonl';else{if(_0x4a26ba[_0x4f2304(0x1b7)])_0x4117a8='tsv';else{if(_0x4a26ba['table'])_0x4117a8=_0x4f2304(0x1e2);}}}const _0x52b041=_0x4a26ba[_0x4f2304(0x201)];let _0x3240d8=_0x4a010f;const _0x3e2be2=a5_0x5dc76c[_0x4f2304(0x212)](_0x4a010f),_0x276186=_0x4a010f==='.';if(!_0x3e2be2||_0x276186){const _0x6e792f=resolveProjectFromContext(_0x4a010f,_0x52b041,{'requireFile':_0x4f2304(0x1ed)});if(_0x6e792f[_0x4f2304(0x1bc)])_0x3240d8=_0x6e792f[_0x4f2304(0x20f)],_0x6e792f['source']===_0x4f2304(0x211)&&console[_0x4f2304(0x1ae)](a5_0x5b9f50['dim']('Using\x20agent:\x20'+_0x3240d8));else switch(_0x6e792f['reason']){case _0x4f2304(0x1d3):console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1d7)](_0x6e792f['message'])),console[_0x4f2304(0x1ae)](),console['log'](_0x4f2304(0x1e3)),console[_0x4f2304(0x1ae)](_0x4f2304(0x1f0)),console[_0x4f2304(0x1ae)](_0x4f2304(0x1d5)),console[_0x4f2304(0x1ae)](),console['log'](_0x4f2304(0x1d2));return 0x1;case _0x4f2304(0x1fd):console['log'](a5_0x5b9f50[_0x4f2304(0x1d7)](_0x6e792f['message'])),console[_0x4f2304(0x1ae)](),console[_0x4f2304(0x1ae)]('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x6e792f[_0x4f2304(0x201)]+_0x4f2304(0x1e8));return 0x1;case'multiple_agents':{const _0x234137=a5_0x2750da[_0x4f2304(0x1be)](_0x6e792f[_0x4f2304(0x20f)]);console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1d7)](_0x4f2304(0x1b9)+_0x6e792f[_0x4f2304(0x201)]+'\x22:'));for(const _0x4e3a05 of _0x6e792f['agentDirs']){console[_0x4f2304(0x1ae)](_0x4f2304(0x1f4)+_0x4e3a05);}return console[_0x4f2304(0x1ae)](),console[_0x4f2304(0x1ae)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x234137+_0x4f2304(0x1e7)),0x1;}case _0x4f2304(0x1fb):console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1d7)]('No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22'+_0x6e792f[_0x4f2304(0x201)]+'\x22.')),console[_0x4f2304(0x1ae)](a5_0x5b9f50['dim']('Project\x20path:\x20'+_0x6e792f[_0x4f2304(0x20f)])),console['log'](),console[_0x4f2304(0x1ae)](_0x4f2304(0x1e5));return 0x1;}}const {definition:_0x4d1a0e,agentInfo:_0x473751}=parseTestFile(_0x3240d8);let _0x5c583c=_0x4d1a0e[_0x4f2304(0x1b5)];if(_0x27ea9b){const _0x2c3ec3=_0x27ea9b[_0x4f2304(0x200)](',')[_0x4f2304(0x1e9)](_0x5b35e5=>_0x5b35e5[_0x4f2304(0x1c0)]());_0x5c583c=_0x4d1a0e[_0x4f2304(0x1b5)][_0x4f2304(0x1cf)](_0x1a40db=>_0x2c3ec3['includes'](_0x1a40db[_0x4f2304(0x1f9)]));if(_0x5c583c[_0x4f2304(0x20b)]===0x0)return console['log'](a5_0x5b9f50[_0x4f2304(0x1d7)](_0x4f2304(0x1d0)+_0x27ea9b)),console['log'](a5_0x5b9f50['dim'](_0x4f2304(0x209)+_0x4d1a0e[_0x4f2304(0x1b5)]['map'](_0x388644=>_0x388644['name'])[_0x4f2304(0x1e6)](',\x20'))),0x1;}if(_0x47ea75){console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1f8)](_0x4f2304(0x1cc))),console[_0x4f2304(0x1ae)](_0x4f2304(0x1c5)+a5_0x5b9f50['white'](_0x2c859b)),console[_0x4f2304(0x1ae)](_0x4f2304(0x1f7)+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x473751[_0x4f2304(0x1c4)])),console[_0x4f2304(0x1ae)]('\x20\x20Agent:\x20'+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x473751[_0x4f2304(0x20a)])),console[_0x4f2304(0x1ae)](),console[_0x4f2304(0x1ae)](_0x4f2304(0x1d4)+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x5c583c[_0x4f2304(0x20b)]));for(let _0x47d99e=0x0;_0x47d99e<_0x5c583c[_0x4f2304(0x20b)];_0x47d99e++){const _0x43ebe2=_0x5c583c[_0x47d99e],_0x5f4c49=_0x43ebe2['rounds'][_0x4f2304(0x20b)]===0x1?_0x4f2304(0x20e):_0x4f2304(0x1f5);console[_0x4f2304(0x1ae)]('\x20\x20'+(_0x47d99e+0x1)+'.\x20'+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x43ebe2[_0x4f2304(0x1f9)])+'\x20('+_0x43ebe2['rounds'][_0x4f2304(0x20b)]+'\x20'+_0x5f4c49+')');}return 0x0;}let _0x28d375,_0x4de929;try{_0x28d375=await _0x1ab0a7[_0x4f2304(0x1e4)][_0x4f2304(0x1b4)](_0x473751[_0x4f2304(0x1c4)]);}catch(_0x2ac5aa){const _0x4f00b2=_0x2ac5aa instanceof Error?_0x2ac5aa[_0x4f2304(0x1bd)]:String(_0x2ac5aa);return _0x4f00b2[_0x4f2304(0x207)]('404')||_0x4f00b2[_0x4f2304(0x20c)]()['includes'](_0x4f2304(0x1d1))?console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1bf)]('✗\x20ERROR:\x20Project\x20not\x20found:\x20'+_0x473751[_0x4f2304(0x1c4)])):console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1bf)](_0x4f2304(0x1c8)+_0x473751[_0x4f2304(0x1c4)]+'\x22:\x20'+_0x4f00b2)),0x1;}try{_0x4de929=await _0x1ab0a7['llm'][_0x4f2304(0x1fe)](_0x473751[_0x4f2304(0x20a)],_0x28d375);}catch(_0xce899b){const _0x28ca52=_0xce899b instanceof Error?_0xce899b[_0x4f2304(0x1bd)]:String(_0xce899b);return _0x28ca52[_0x4f2304(0x207)](_0x4f2304(0x1c3))||_0x28ca52[_0x4f2304(0x20c)]()[_0x4f2304(0x207)](_0x4f2304(0x1d1))?console[_0x4f2304(0x1ae)](a5_0x5b9f50['red']('✗\x20ERROR:\x20Agent\x20not\x20found:\x20'+_0x473751[_0x4f2304(0x20a)])):console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1bf)](_0x4f2304(0x1d8)+_0x473751[_0x4f2304(0x20a)]+'\x22:\x20'+_0x28ca52)),0x1;}let _0xc945e5;if(!_0x366558)try{_0xc945e5=await setupEvaluatorAgent(_0x1ab0a7[_0x4f2304(0x1e4)],_0x1df64d[_0x4f2304(0x1b8)]);}catch(_0x1f8c50){const _0xcea842=_0x1f8c50 instanceof Error?_0x1f8c50['message']:String(_0x1f8c50);return console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1bf)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0xcea842)),0x1;}console['log'](a5_0x5b9f50['cyan'](_0x4f2304(0x1b3))),console[_0x4f2304(0x1ae)](_0x4f2304(0x208)+a5_0x5b9f50['white'](_0x2c859b)),console[_0x4f2304(0x1ae)]('Agent:\x20'+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x473751['projectName']+'/'+_0x473751[_0x4f2304(0x20a)])),console[_0x4f2304(0x1ae)]();const _0xc17a63=[],_0x3a2db5=Date[_0x4f2304(0x1c7)]();for(let _0x10225d=0x0;_0x10225d<_0x5c583c[_0x4f2304(0x20b)];_0x10225d++){const _0x507c2b=_0x5c583c[_0x10225d];_0x5c583c['length']>0x1?console[_0x4f2304(0x1ae)](_0x4f2304(0x206)+(_0x10225d+0x1)+'/'+_0x5c583c[_0x4f2304(0x20b)]+':\x20'+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x507c2b[_0x4f2304(0x1f9)])):console[_0x4f2304(0x1ae)]('Running\x20test:\x20'+a5_0x5b9f50[_0x4f2304(0x1fc)](_0x507c2b[_0x4f2304(0x1f9)]));const _0x12aad4=createCommandSpinner(_0x4f2304(0x1b1)+_0x507c2b['rounds']['length']+_0x4f2304(0x205));_0x12aad4[_0x4f2304(0x1f6)]();try{const {result:_0x1e7f5b}=await runTest(_0x1ab0a7[_0x4f2304(0x1e4)],_0x507c2b,{'agentId':_0x4de929,'projectId':_0x28d375,'site':_0x2c859b,'noEval':_0x366558,'evaluatorId':_0xc945e5,'onRoundStart':(_0x277e7b,_0x40781e)=>{const _0x3e42c6=_0x4f2304;_0x12aad4[_0x3e42c6(0x1cd)]='Round\x20'+(_0x277e7b+0x1)+'/'+_0x40781e+_0x3e42c6(0x205);},'onRoundComplete':(_0x2310e7,_0x11a22e,_0xcde1be)=>{const _0x58b168=_0x4f2304,_0x5d807c=formatElapsed(_0x11a22e);_0xcde1be?console[_0x58b168(0x1ae)](_0x58b168(0x1fa)+(_0x2310e7+0x1)+'/'+_0x507c2b[_0x58b168(0x1f5)][_0x58b168(0x20b)]+_0x58b168(0x1da)+a5_0x5b9f50[_0x58b168(0x1e0)]('✓')+'\x20('+_0x5d807c+')'):console[_0x58b168(0x1ae)](_0x58b168(0x1fa)+(_0x2310e7+0x1)+'/'+_0x507c2b[_0x58b168(0x1f5)][_0x58b168(0x20b)]+'...\x20'+a5_0x5b9f50[_0x58b168(0x1bf)]('✗'));},'onEvaluationStart':()=>{const _0xaa05c9=_0x4f2304;_0x12aad4[_0xaa05c9(0x1cd)]='Evaluating\x20response...';},'onEvaluationComplete':_0x1fc03e=>{const _0x2e6621=_0x4f2304,_0x8b4722=formatElapsed(_0x1fc03e);console['log'](_0x2e6621(0x1dc)+a5_0x5b9f50[_0x2e6621(0x1e0)]('✓')+'\x20('+_0x8b4722+')');}});_0x12aad4['stop'](),_0xc17a63['push'](_0x1e7f5b);if(_0x1e7f5b[_0x4f2304(0x1ce)]===_0x4f2304(0x1d6))console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1e0)]('✓\x20PASS:\x20'+_0x1e7f5b[_0x4f2304(0x1db)]));else _0x1e7f5b[_0x4f2304(0x1ce)]===_0x4f2304(0x1df)?console['log'](a5_0x5b9f50[_0x4f2304(0x1bf)]('✗\x20FAIL:\x20'+_0x1e7f5b[_0x4f2304(0x1db)])):console['log'](a5_0x5b9f50['red'](_0x4f2304(0x1b2)+_0x1e7f5b['reason']));_0x1e7f5b[_0x4f2304(0x1b6)]&&console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1f3)]('Conversation\x20URL:\x20'+_0x1e7f5b[_0x4f2304(0x1b6)])),console['log']();}catch(_0x5b7b04){_0x12aad4[_0x4f2304(0x1bb)]();const _0x5ae03e=_0x5b7b04 instanceof Error?_0x5b7b04['message']:String(_0x5b7b04);console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1bf)](_0x4f2304(0x1b2)+_0x5ae03e)),console[_0x4f2304(0x1ae)](),_0xc17a63['push']({'name':_0x507c2b['name'],'status':'ERROR','reason':_0x5ae03e,'timestamp':new Date()[_0x4f2304(0x1dd)](),'duration_ms':0x0});}}const _0x104aae=Date[_0x4f2304(0x1c7)]()-_0x3a2db5,_0x44a9c2=_0xc17a63[_0x4f2304(0x1cf)](_0x1679f0=>_0x1679f0[_0x4f2304(0x1ce)]===_0x4f2304(0x1d6))[_0x4f2304(0x20b)],_0x4556af=_0xc17a63[_0x4f2304(0x1cf)](_0x43ab0c=>_0x43ab0c[_0x4f2304(0x1ce)]===_0x4f2304(0x1df))[_0x4f2304(0x20b)],_0x581db3=_0xc17a63[_0x4f2304(0x1cf)](_0x3dd327=>_0x3dd327['status']==='ERROR')[_0x4f2304(0x20b)];console[_0x4f2304(0x1ae)]('━'[_0x4f2304(0x1ba)](0x3c)),console[_0x4f2304(0x1ae)](_0x4f2304(0x1e1)),console[_0x4f2304(0x1ae)]('━'[_0x4f2304(0x1ba)](0x3c)),console['log']('Total:\x20\x20\x20\x20'+_0xc17a63[_0x4f2304(0x20b)]),console[_0x4f2304(0x1ae)]('Passed:\x20\x20\x20'+a5_0x5b9f50[_0x4f2304(0x1e0)](_0x44a9c2)),console[_0x4f2304(0x1ae)](_0x4f2304(0x1c2)+a5_0x5b9f50[_0x4f2304(0x1bf)](_0x4556af));_0x581db3>0x0&&console[_0x4f2304(0x1ae)](_0x4f2304(0x1ef)+a5_0x5b9f50[_0x4f2304(0x1bf)](_0x581db3));console[_0x4f2304(0x1ae)]('Duration:\x20'+formatElapsed(_0x104aae)),console[_0x4f2304(0x1ae)]('━'[_0x4f2304(0x1ba)](0x3c));const _0x5561a0=_0xc17a63[_0x4f2304(0x1cf)](_0x5dc644=>_0x5dc644[_0x4f2304(0x1ce)]!==_0x4f2304(0x1d6));if(_0x5561a0[_0x4f2304(0x20b)]>0x0){console['log'](),console[_0x4f2304(0x1ae)](_0x4f2304(0x1f1));for(const _0x512997 of _0x5561a0){const _0x6c08a8=a5_0x5b9f50['red']('✗'),_0x126cfb=_0x512997[_0x4f2304(0x1db)][_0x4f2304(0x20b)]>0x32?_0x512997[_0x4f2304(0x1db)][_0x4f2304(0x210)](0x0,0x32)+'...':_0x512997[_0x4f2304(0x1db)];console[_0x4f2304(0x1ae)]('\x20\x20'+_0x6c08a8+'\x20'+_0x512997[_0x4f2304(0x1f9)]+':\x20'+_0x126cfb);}}const _0x29498c={'summary':{'total':_0xc17a63['length'],'passed':_0x44a9c2,'failed':_0x4556af,'errors':_0x581db3>0x0?_0x581db3:undefined,'duration_ms':_0x104aae},'tests':_0xc17a63,'agent':{'project':_0x473751[_0x4f2304(0x1c4)],'name':_0x473751[_0x4f2304(0x20a)],'site':_0x2c859b},'timestamp':new Date(_0x3a2db5)[_0x4f2304(0x1dd)]()};if(_0x4117a8!==_0x4f2304(0x1e2)||_0x1a1e17){const _0x2a86fa=formatResults(_0x29498c,_0x4117a8);if(_0x1a1e17)try{a5_0x5dc76c['writeFileSync'](_0x1a1e17,_0x2a86fa,_0x4f2304(0x1f2)),console[_0x4f2304(0x1ae)](),console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1f3)](_0x4f2304(0x204)+_0x1a1e17));}catch(_0x36e4e4){return console[_0x4f2304(0x1ae)](),console[_0x4f2304(0x1ae)](a5_0x5b9f50[_0x4f2304(0x1bf)](_0x4f2304(0x1ec)+_0x36e4e4)),0x1;}else console[_0x4f2304(0x1ae)](),console[_0x4f2304(0x1ae)](_0x2a86fa);}return _0x5561a0['length']>0x0?0x1:0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x294fd0=a6_0x5efb;(function(_0x31b19e,_0xc0dbeb){const _0x25c2d5=a6_0x5efb,_0x12187f=_0x31b19e();while(!![]){try{const _0x34d5c8=-parseInt(_0x25c2d5(0xa9))/0x1*(parseInt(_0x25c2d5(0xca))/0x2)+parseInt(_0x25c2d5(0x9b))/0x3+parseInt(_0x25c2d5(0xb7))/0x4+parseInt(_0x25c2d5(0xad))/0x5*(parseInt(_0x25c2d5(0xab))/0x6)+parseInt(_0x25c2d5(0x90))/0x7*(-parseInt(_0x25c2d5(0xc3))/0x8)+parseInt(_0x25c2d5(0xc8))/0x9+-parseInt(_0x25c2d5(0xa1))/0xa;if(_0x34d5c8===_0xc0dbeb)break;else _0x12187f['push'](_0x12187f['shift']());}catch(_0x51e97a){_0x12187f['push'](_0x12187f['shift']());}}}(a6_0x4f64,0xc07fd));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';function a6_0x4f64(){const _0x58b4d1=['startsWith','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','Invalid\x20header\x20format:\x20\x22','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','method','1096GJuFcT','llm','execute','trino','color','11188962ResRyN','isArray','107038UyKLZC','Results\x20saved\x20to\x20','site','cookie','request','validate','name','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','toUpperCase','29218FumFTI','indexOf','x-auth-token','\x0aStack\x20trace:\x0a','verbose','output','.\x20Valid\x20methods:\x20','authorization','Invalid\x20HTTP\x20method:\x20','has','Invalid\x20API\x20type:\x20','1033722yutnNJ','length','<\x20HTTP/1.1\x20','.\x20Valid\x20types:\x20','join','type','4091780WcIvaj','workflow','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','status','stack','llm-proxy','POST','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','8KJHJut','noColor','164586HUoKsG','cdp','15UYngTw','GET','entries','x-trino-user','headers','body','file','description','substring','error','2110240blbXIR','message','Error:\x20','\x22.\x20','data','includes','log'];a6_0x4f64=function(){return _0x58b4d1;};return a6_0x4f64();}import{writeFileSync}from'fs';function a6_0x5efb(_0x1fb170,_0x49973b){_0x1fb170=_0x1fb170-0x90;const _0x4f640b=a6_0x4f64();let _0x5efba7=_0x4f640b[_0x1fb170];return _0x5efba7;}import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a6_0x294fd0(0x97),'proxy-authorization',a6_0x294fd0(0xcd),'set-cookie','set-cookie2','x-xsrf-token',a6_0x294fd0(0x92),a6_0x294fd0(0xb0)]);function isSensitiveHeader(_0x52ef4a){const _0x185fc2=a6_0x294fd0;return SENSITIVE_HEADERS[_0x185fc2(0x99)](_0x52ef4a['toLowerCase']());}function parseHeader(_0x3c8106){const _0x2374e9=a6_0x294fd0,_0x21a9b1=_0x3c8106[_0x2374e9(0x91)](':');if(_0x21a9b1===-0x1)throw new Error(_0x2374e9(0xc0)+_0x3c8106+_0x2374e9(0xba)+_0x2374e9(0xa3));const _0x45b380=_0x3c8106[_0x2374e9(0xb5)](0x0,_0x21a9b1)['trim'](),_0x3c1260=_0x3c8106[_0x2374e9(0xb5)](_0x21a9b1+0x1)['trim']();if(!_0x45b380)throw new Error(_0x2374e9(0xd1)+_0x3c8106+'\x22');return[_0x45b380,_0x3c1260];}export class ApiCommand extends BaseCommand{[a6_0x294fd0(0xd0)]='api';[a6_0x294fd0(0xb4)]=a6_0x294fd0(0xbf);[a6_0x294fd0(0xcf)](_0x2372b9){const _0xdbdf95=a6_0x294fd0,{args:_0xd60947,options:_0x570e7c}=_0x2372b9,_0x3d4d92=_0x570e7c;if(_0xd60947[_0xdbdf95(0x9c)]===0x0)return _0xdbdf95(0xa8);const _0x599fe6=_0xd60947[0x0];if(!_0x599fe6[_0xdbdf95(0xbe)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x599fe6;const _0x32d779=_0x3d4d92[_0xdbdf95(0xbb)],_0x170b7c=_0x3d4d92['file'];if(_0x32d779&&_0x170b7c)return _0xdbdf95(0xc1);const _0x2250eb=_0x3d4d92[_0xdbdf95(0xc2)]||'GET',_0x95a908=['GET',_0xdbdf95(0xa7),'PUT','DELETE','PATCH'];if(!_0x95a908[_0xdbdf95(0xbc)](_0x2250eb[_0xdbdf95(0xd2)]()))return _0xdbdf95(0x98)+_0x2250eb+_0xdbdf95(0x96)+_0x95a908[_0xdbdf95(0x9f)](',\x20');const _0x39006f=_0x3d4d92[_0xdbdf95(0xa0)]||'td',_0x271f98=['td',_0xdbdf95(0xac),_0xdbdf95(0xa2),_0xdbdf95(0xc6),_0xdbdf95(0xc4),_0xdbdf95(0xa6)];if(!_0x271f98[_0xdbdf95(0xbc)](_0x39006f))return _0xdbdf95(0x9a)+_0x39006f+_0xdbdf95(0x9e)+_0x271f98[_0xdbdf95(0x9f)](',\x20');return undefined;}async[a6_0x294fd0(0xc5)](_0x37d25f){const _0xb291e8=a6_0x294fd0,{options:_0x5d577f,args:_0x4f4e6a,tdx:_0x4d1f69}=_0x37d25f,_0x3e51e5=_0x5d577f,_0x46c7f4=_0x4f4e6a[0x0],_0x2673ed=(_0x3e51e5[_0xb291e8(0xc2)]||_0xb291e8(0xae))[_0xb291e8(0xd2)](),_0x44fbe9=_0x3e51e5[_0xb291e8(0xbb)],_0x445e8a=_0x3e51e5[_0xb291e8(0xb3)],_0x4bd159=_0x3e51e5['header'],_0xe75ad2=_0x3e51e5[_0xb291e8(0xa0)]||'td';try{const _0x2ba6d4={};if(_0x4bd159){const _0x590b59=Array[_0xb291e8(0xc9)](_0x4bd159)?_0x4bd159:[_0x4bd159];for(const _0xd24b20 of _0x590b59){const [_0x500fac,_0x154ce1]=parseHeader(_0xd24b20);_0x2ba6d4[_0x500fac]=_0x154ce1;}}let _0x3f08b5;if(_0x44fbe9)_0x3f08b5=_0x44fbe9;else{if(_0x445e8a)try{_0x3f08b5=RawAPI['readBodyFromFile'](_0x445e8a);}catch(_0x178301){return console[_0xb291e8(0xb6)](_0xb291e8(0xb9)+(_0x178301 instanceof Error?_0x178301[_0xb291e8(0xb8)]:String(_0x178301))),0x1;}}const _0x176c75={'method':_0x2673ed,'apiType':_0xe75ad2,'includeHeaders':_0x5d577f['verbose']};_0x3f08b5&&(_0x176c75[_0xb291e8(0xb2)]=_0x3f08b5);Object['keys'](_0x2ba6d4)[_0xb291e8(0x9c)]>0x0&&(_0x176c75[_0xb291e8(0xb1)]=_0x2ba6d4);if(_0x5d577f['verbose']){const _0x3c098d=resolveSite(_0x5d577f[_0xb291e8(0xcc)]),_0x33249c=getEndpoint(_0x3c098d,_0xe75ad2),_0xed90d8=''+_0x33249c+_0x46c7f4;console[_0xb291e8(0xb6)]('>\x20'+_0x2673ed+'\x20'+_0xed90d8);const _0x2ec079=getAuthHeaders(_0x3c098d),_0x561ea0={..._0x2ec079,..._0x2ba6d4};for(const [_0x1853b5,_0x339610]of Object[_0xb291e8(0xaf)](_0x561ea0)){!isSensitiveHeader(_0x1853b5)&&console[_0xb291e8(0xb6)]('>\x20'+_0x1853b5+':\x20'+_0x339610);}_0x3f08b5&&console[_0xb291e8(0xb6)]('>'),console[_0xb291e8(0xb6)]('');}const _0xf1d322=await _0x4d1f69['api'][_0xb291e8(0xce)](_0x46c7f4,_0x176c75);if(_0x5d577f[_0xb291e8(0x94)]&&_0xf1d322['headers']){console[_0xb291e8(0xb6)](_0xb291e8(0x9d)+_0xf1d322[_0xb291e8(0xa4)]);for(const [_0xad48cb,_0x5ddb04]of Object[_0xb291e8(0xaf)](_0xf1d322[_0xb291e8(0xb1)])){!isSensitiveHeader(_0xad48cb)&&console[_0xb291e8(0xb6)]('<\x20'+_0xad48cb+':\x20'+_0x5ddb04);}console[_0xb291e8(0xb6)]('');}const _0x10f3b7=Boolean(_0x5d577f[_0xb291e8(0x95)]),_0x491c25={'color':_0x5d577f['color'],'noColor':_0x5d577f[_0xb291e8(0xaa)]||_0x10f3b7&&!_0x5d577f[_0xb291e8(0xc7)]},_0x22af57=colorizeJSON(_0xf1d322[_0xb291e8(0xbb)],_0x491c25);return _0x5d577f[_0xb291e8(0x95)]?(writeFileSync(_0x5d577f[_0xb291e8(0x95)],_0x22af57),console[_0xb291e8(0xb6)](_0xb291e8(0xcb)+_0x5d577f[_0xb291e8(0x95)])):console[_0xb291e8(0xbd)](_0x22af57),0x0;}catch(_0x5b5a29){return _0x5b5a29 instanceof Error?(console[_0xb291e8(0xb6)]('Error:\x20'+_0x5b5a29['message']),_0x5d577f[_0xb291e8(0x94)]&&_0x5b5a29[_0xb291e8(0xa5)]&&console[_0xb291e8(0xb6)](_0xb291e8(0x93)+_0x5b5a29[_0xb291e8(0xa5)])):console[_0xb291e8(0xb6)](_0xb291e8(0xb9)+String(_0x5b5a29)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x5222d9=a7_0xacd0;(function(_0x5869d0,_0x2ceaf5){const _0x1a7c3b=a7_0xacd0,_0x3875b5=_0x5869d0();while(!![]){try{const _0x2208bc=-parseInt(_0x1a7c3b(0xb0))/0x1*(-parseInt(_0x1a7c3b(0xc1))/0x2)+parseInt(_0x1a7c3b(0xb8))/0x3+parseInt(_0x1a7c3b(0xac))/0x4+parseInt(_0x1a7c3b(0x86))/0x5+-parseInt(_0x1a7c3b(0xb1))/0x6*(parseInt(_0x1a7c3b(0x81))/0x7)+parseInt(_0x1a7c3b(0xbb))/0x8*(parseInt(_0x1a7c3b(0xbe))/0x9)+parseInt(_0x1a7c3b(0xbd))/0xa*(-parseInt(_0x1a7c3b(0xae))/0xb);if(_0x2208bc===_0x2ceaf5)break;else _0x3875b5['push'](_0x3875b5['shift']());}catch(_0x3ab490){_0x3875b5['push'](_0x3875b5['shift']());}}}(a7_0x206f,0x5b494));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a7_0xacd0(_0x2a63a9,_0x572804){_0x2a63a9=_0x2a63a9-0x77;const _0x206fb8=a7_0x206f();let _0xacd04e=_0x206fb8[_0x2a63a9];return _0xacd04e;}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a7_0x5129c2 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a7_0x206f(){const _0x353a1f=['System\x20keychain\x20is\x20not\x20available','Enter\x20site\x20name:','User:\x20','eu01','apiKey','profile','2279328XPthXU','site','21241SPDYQF','create','214433fonhCo','546MQtHyT','ap02','customSite','other','red','auth:clear','Enter\x20your\x20TD\x20API\x20key:','131388RSYuET','green','Site\x20name\x20cannot\x20be\x20empty','8ZMihZA','findIndex','5260slmKSP','1966239ocfGmQ','Validating\x20API\x20key...','eu\x20\x20\x20-\x20Europe','2nXOudR','\x20(site:\x20','execute','auth:setup','Name:\x20','select','first_name','✓\x20API\x20key\x20removed\x20from\x20keychain','You\x20can\x20find\x20your\x20API\x20key\x20at:','error','Setting\x20up\x20authentication\x20for\x20site:\x20','✗\x20Validation\x20failed:\x20','Read\x20credential\x20from\x20','name','getUserInfo','description','email','\x27\x20registered','us\x20\x20\x20-\x20United\x20States','✓\x20Profile\x20\x27','N/A','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','15575bftGwi','\x20for\x20profile:\x20','jobs','\x20(profile:\x20','password','2727785mSuhyV','\x0aSetup\x20cancelled','join','status','Setup\x20API\x20key\x20authentication\x20interactively','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','log','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','logLevel','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','jp\x20\x20\x20-\x20Japan','us01','No\x20API\x20key\x20found\x20in\x20keychain','value','trim','ERROR','✓\x20Default\x20site\x20set\x20to\x20','Select\x20your\x20Treasure\x20Data\x20site:','tdx\x20profile:\x20','Remove\x20API\x20key\x20from\x20system\x20keychain','ap02\x20-\x20Korea','test','text','tdx:\x20auth\x20setup','push','yellow','✓\x20Authentication\x20successful\x0a','\x20\x20tdx'];a7_0x206f=function(){return _0x353a1f;};return a7_0x206f();}import{LogLevel}from'../utils/tdx-logger.js';import a7_0x2c8c80 from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x5222d9(0x78)]=a7_0x5222d9(0xc4);['description']=a7_0x5222d9(0x8a);async[a7_0x5222d9(0xc3)](_0x5eb65e){const _0x54cbb2=a7_0x5222d9,{options:_0x1fb495}=_0x5eb65e,_0x3eaa52=_0x1fb495[_0x54cbb2(0xab)];console['log'](a7_0x2c8c80['bold'](_0x54cbb2(0xa1)));const _0x573aad=_0x1fb495[_0x54cbb2(0xad)]||_0x54cbb2(0x95),_0x3859c2=[{'title':_0x54cbb2(0x7d),'value':_0x54cbb2(0x95)},{'title':_0x54cbb2(0x94),'value':'jp01'},{'title':_0x54cbb2(0xc0),'value':_0x54cbb2(0xa9)},{'title':_0x54cbb2(0x9e),'value':_0x54cbb2(0xb2)}];let _0x595106=_0x3859c2[_0x54cbb2(0xbc)](_0x3382a7=>_0x3382a7[_0x54cbb2(0x97)]===_0x573aad);_0x595106===-0x1&&_0x573aad!=='us01'&&(_0x3859c2[_0x54cbb2(0xa2)]({'title':_0x573aad,'value':_0x573aad}),_0x595106=_0x3859c2['length']-0x1);_0x3859c2['push']({'title':'Enter\x20custom\x20site','value':_0x54cbb2(0xb4)});const _0x107916=_0x3eaa52?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x3eaa52+'):':_0x54cbb2(0x9b),_0xe257cc=await a7_0x5129c2({'type':_0x54cbb2(0xc6),'name':_0x54cbb2(0xad),'message':_0x107916,'choices':_0x3859c2,'initial':_0x595106>=0x0?_0x595106:0x0});if(!_0xe257cc[_0x54cbb2(0xad)])return console[_0x54cbb2(0x8c)]('\x0aSetup\x20cancelled'),0x1;let _0x5f458a;if(_0xe257cc['site']===_0x54cbb2(0xb4)){const _0xd77ffe=await a7_0x5129c2({'type':_0x54cbb2(0xa0),'name':_0x54cbb2(0xb3),'message':_0x54cbb2(0xa7),'initial':'us01','validate':_0x2d23ca=>{const _0x5d5cc1=_0x54cbb2;if(!_0x2d23ca||!_0x2d23ca[_0x5d5cc1(0x98)]())return _0x5d5cc1(0xba);if(!/^[a-z0-9-]+$/[_0x5d5cc1(0x9f)](_0x2d23ca[_0x5d5cc1(0x98)]()))return _0x5d5cc1(0x8f);return!![];}});if(!_0xd77ffe[_0x54cbb2(0xb3)])return console[_0x54cbb2(0x8c)](_0x54cbb2(0x87)),0x1;_0x5f458a=_0xd77ffe['customSite'];}else _0x5f458a=_0xe257cc['site'];const _0x3fe181=resolveSite(_0x5f458a);console[_0x54cbb2(0x8c)](_0x54cbb2(0xcb)+_0x3fe181),console[_0x54cbb2(0x8c)](_0x54cbb2(0xc9)),console[_0x54cbb2(0x8c)]('\x20\x20'+getConsoleUrl(_0x3fe181,'/app/mp/ak'));const _0x5755d8=await a7_0x5129c2({'type':_0x54cbb2(0x85),'name':_0x54cbb2(0xaa),'message':_0x54cbb2(0xb7),'validate':_0xae412=>{const _0x4a11f2=_0x54cbb2;if(!_0xae412||!_0xae412[_0x4a11f2(0x98)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5755d8[_0x54cbb2(0xaa)])return console['log'](_0x54cbb2(0x87)),0x1;const _0x4bb3a9=_0x5755d8['apiKey'];console[_0x54cbb2(0x8c)](_0x54cbb2(0xbf));try{const _0x2e9cad=TDX[_0x54cbb2(0xaf)]({'site':_0x3fe181,'apiKey':_0x4bb3a9[_0x54cbb2(0x98)](),'logLevel':_0x1fb495[_0x54cbb2(0x8e)]??LogLevel[_0x54cbb2(0x99)]}),_0x504674=await _0x2e9cad['jobs'][_0x54cbb2(0x79)]();console[_0x54cbb2(0x8c)](_0x54cbb2(0x80)+_0x504674[_0x54cbb2(0x7b)]+')');const _0x248570=await isKeychainAvailable();_0x248570?(await saveAPIKeyAsync(_0x4bb3a9[_0x54cbb2(0x98)](),_0x3fe181,_0x3eaa52),console[_0x54cbb2(0x8c)](_0x54cbb2(0x8d)+(_0x3eaa52?_0x54cbb2(0x84)+_0x3eaa52+')':''))):(console['warn'](a7_0x2c8c80[_0x54cbb2(0xa3)](_0x54cbb2(0x92))),console['warn'](a7_0x2c8c80[_0x54cbb2(0xa3)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x3eaa52){const _0x166f26={'site':_0x3fe181};saveProfileToUserConfig(_0x3eaa52,_0x166f26),console[_0x54cbb2(0x8c)](_0x54cbb2(0x7e)+_0x3eaa52+_0x54cbb2(0x7c));}else saveDefaultSiteToUserConfig(_0x3fe181),console['log'](_0x54cbb2(0x9a)+_0x3fe181);const _0x4da5ac=_0x3eaa52?'\x20--profile\x20'+_0x3eaa52:'';return console[_0x54cbb2(0x8c)](),console[_0x54cbb2(0x8c)](_0x54cbb2(0x90)),console['log']('\x20\x20tdx'+_0x4da5ac+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x54cbb2(0xa5)+_0x4da5ac+_0x54cbb2(0x91)),0x0;}catch(_0x583570){if(_0x583570 instanceof HTTPClientError&&_0x583570[_0x54cbb2(0x89)]===0x191)return printAuthError(_0x583570),0x1;return console[_0x54cbb2(0xca)](a7_0x2c8c80[_0x54cbb2(0xb5)](_0x54cbb2(0xcc)+(_0x583570 instanceof Error?_0x583570['message']:String(_0x583570)))),console[_0x54cbb2(0xca)](_0x54cbb2(0x8b)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']='auth';[a7_0x5222d9(0x7a)]=a7_0x5222d9(0x93);async[a7_0x5222d9(0xc3)](_0x1e73a8){const _0x2037a0=a7_0x5222d9,{options:_0xa7992b,tdx:_0x2ba27c}=_0x1e73a8,_0x24c607=_0xa7992b[_0x2037a0(0xad)],_0x58d09f=_0xa7992b['profile'],_0x5ed850=_0x58d09f?_0x58d09f:_0x2037a0(0x7f);console['log'](_0x2037a0(0x9c)+_0x5ed850+_0x2037a0(0xc2)+_0x24c607+')');const _0x26fcc2=await resolveAPIKeyAsync(_0x24c607,_0x58d09f);if(_0x26fcc2){const {source:_0x493ae1,isDeprecated:_0x4e07f7}=_0x26fcc2,_0x2f91ee=_0x2037a0(0x77)+_0x493ae1;console[_0x2037a0(0x8c)](_0x4e07f7?a7_0x2c8c80['yellow'](_0x2f91ee):_0x2f91ee);}else console[_0x2037a0(0x8c)](a7_0x2c8c80[_0x2037a0(0xa3)]('No\x20credential\x20found'));try{const _0x20e044=await _0x2ba27c[_0x2037a0(0x83)]['getUserInfo']();return console[_0x2037a0(0x8c)](a7_0x2c8c80[_0x2037a0(0xb9)](_0x2037a0(0xa4))),console[_0x2037a0(0x8c)](_0x2037a0(0xa8)+_0x20e044[_0x2037a0(0x7b)]),(_0x20e044['first_name']||_0x20e044['last_name'])&&console['log'](_0x2037a0(0xc5)+[_0x20e044[_0x2037a0(0xc7)],_0x20e044['last_name']]['filter'](Boolean)[_0x2037a0(0x88)]('\x20')),0x0;}catch(_0x1f0aff){return _0x1f0aff instanceof HTTPClientError&&_0x1f0aff[_0x2037a0(0x89)]===0x191?printAuthError(_0x1f0aff,!![],_0x58d09f):console['error'](a7_0x2c8c80[_0x2037a0(0xb5)](_0x2037a0(0xcc)+(_0x1f0aff instanceof Error?_0x1f0aff['message']:String(_0x1f0aff)))),0x1;}}}export class AuthClearCommand extends BaseCommand{['name']=a7_0x5222d9(0xb6);['description']=a7_0x5222d9(0x9d);async['execute'](_0x26240f){const _0x2ea024=a7_0x5222d9,{options:_0x4c3bd1}=_0x26240f,_0x3086db=_0x4c3bd1[_0x2ea024(0xab)];console[_0x2ea024(0x8c)](a7_0x2c8c80['bold']('tdx:\x20auth\x20clear'));const _0xf86075=await isKeychainAvailable();if(!_0xf86075)return console[_0x2ea024(0xca)](a7_0x2c8c80[_0x2ea024(0xb5)](_0x2ea024(0xa6))),0x1;const _0x482c14=await deleteKeychainAPIKey(_0x3086db);return _0x482c14?(clearCredentialCache(),console[_0x2ea024(0x8c)](_0x2ea024(0xc8)+(_0x3086db?_0x2ea024(0x84)+_0x3086db+')':'')),0x0):(console[_0x2ea024(0x8c)](_0x2ea024(0x96)+(_0x3086db?_0x2ea024(0x82)+_0x3086db:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a8_0x5c6d1b=a8_0x15f9;(function(_0x32a745,_0x29707f){const _0x31b920=a8_0x15f9,_0x3ea98c=_0x32a745();while(!![]){try{const _0x49f983=parseInt(_0x31b920(0xcc))/0x1+parseInt(_0x31b920(0xc6))/0x2+parseInt(_0x31b920(0xc3))/0x3*(-parseInt(_0x31b920(0xab))/0x4)+-parseInt(_0x31b920(0xb7))/0x5*(parseInt(_0x31b920(0xd7))/0x6)+parseInt(_0x31b920(0xb2))/0x7*(-parseInt(_0x31b920(0xce))/0x8)+-parseInt(_0x31b920(0xbc))/0x9+parseInt(_0x31b920(0xaf))/0xa;if(_0x49f983===_0x29707f)break;else _0x3ea98c['push'](_0x3ea98c['shift']());}catch(_0x4770e2){_0x3ea98c['push'](_0x3ea98c['shift']());}}}(a8_0x4217,0x9d195));function a8_0x4217(){const _0x5ba97b=['metadata','257264tuXwVR','chatId','cause','Continuing\x20chat:\x20','getDefaultAgent','code','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','getOrCreateDefaultAgent','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','4605420hGQTid','\x20\x20Cause:\x20','message','CHAT_NOT_FOUND','event','llmProject','--agent\x20flag','4BgTPNt','\x0aStack\x20trace:','name','agent','21942900zBcagy','Resolving\x20project\x20\x27','handleChatEvent','49sMUKsA','llm','llmAgent','data','resolveProjectId','5uXzcQD','description','Chat\x20session:\x20','validate','content','1985058hgNTOo','join','Using\x20cached\x20default\x20agent:\x20','error','streamChat','new','Getting\x20default\x20agent...','3281139BtlzCC','chat','log','277052xUnOMW','\x27...','type','includes','verbose','stack','617612aOsziK'];a8_0x4217=function(){return _0x5ba97b;};return a8_0x4217();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0x1c476c,_0x12cdc2){const _0x36bcb3=a8_0x15f9;if(_0x1c476c instanceof SDKError)console[_0x36bcb3(0xbf)]('Error:\x20'+_0x1c476c[_0x36bcb3(0xd9)]),_0x12cdc2[_0x36bcb3(0xca)]&&(_0x1c476c[_0x36bcb3(0xd0)]&&console[_0x36bcb3(0xbf)](_0x36bcb3(0xd8)+_0x1c476c[_0x36bcb3(0xd0)]),_0x1c476c[_0x36bcb3(0xcb)]&&(console['error'](_0x36bcb3(0xac)),console[_0x36bcb3(0xbf)](_0x1c476c[_0x36bcb3(0xcb)])));else throw _0x1c476c;}function a8_0x15f9(_0x3ae5f6,_0x5b5128){_0x3ae5f6=_0x3ae5f6-0xa7;const _0x421765=a8_0x4217();let _0x15f94e=_0x421765[_0x3ae5f6];return _0x15f94e;}export class ChatCommand extends BaseCommand{[a8_0x5c6d1b(0xad)]=a8_0x5c6d1b(0xc4);[a8_0x5c6d1b(0xb8)]=a8_0x5c6d1b(0xd6);[a8_0x5c6d1b(0xba)](_0x146075){const _0x5b39cc=a8_0x5c6d1b,_0x104816=_0x146075['args'][_0x5b39cc(0xbd)]('\x20');if(!_0x104816)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async['streamChat'](_0x3e56a1,_0x160b60,_0x3b023f,_0x4794af,_0x112657){const _0x53f413=a8_0x5c6d1b;for await(const _0x44481a of _0x3e56a1[_0x53f413(0xb3)][_0x53f413(0xc4)](_0x160b60,{'agentId':_0x3b023f,'chatId':_0x4794af})){if(_0x44481a[_0x53f413(0xc8)]===_0x53f413(0xcd)){const _0x3191b2=_0x44481a[_0x53f413(0xb5)][_0x53f413(0xcf)];saveLastChatId(_0x3191b2),_0x112657&&console['error'](_0x53f413(0xb9)+_0x3191b2);}else _0x44481a['type']===_0x53f413(0xa8)&&this[_0x53f413(0xb1)](_0x44481a[_0x53f413(0xb5)]);}}async['getAgentId'](_0x410dea,_0x4670d0,_0x5b9370,_0x35ff52,_0x297b0f){const _0x541dba=a8_0x5c6d1b,_0x146b0e=_0x4670d0||_0x5b9370;if(_0x146b0e){const {projectName:_0x4db759,agentName:_0x4a1b55}=parseAgentRef(_0x146b0e),_0x24001f=_0x4a1b55||_0x146b0e,_0x3135dc=_0x4a1b55?_0x4db759:_0x35ff52;if(!_0x3135dc)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x297b0f){const _0xbacc7e=_0x4670d0?_0x541dba(0xaa):'session\x20context';console[_0x541dba(0xbf)]('Using\x20agent\x20from\x20'+_0xbacc7e+':\x20'+_0x3135dc+'/'+_0x24001f);}const _0x6b84a7=await withSpinner(_0x541dba(0xb0)+_0x3135dc+_0x541dba(0xc7),()=>_0x410dea[_0x541dba(0xb3)][_0x541dba(0xb6)](_0x3135dc),{'verbose':_0x297b0f}),_0xf8e337=await withSpinner('Resolving\x20agent\x20\x27'+_0x24001f+_0x541dba(0xc7),()=>_0x410dea['llm']['resolveAgentId'](_0x24001f,_0x6b84a7[_0x541dba(0xb5)]),{'verbose':_0x297b0f});return _0xf8e337[_0x541dba(0xb5)];}else{const _0x38d02e=_0x410dea[_0x541dba(0xb3)][_0x541dba(0xd2)]();if(_0x38d02e)return _0x297b0f&&console[_0x541dba(0xbf)](_0x541dba(0xbe)+_0x38d02e[_0x541dba(0xad)]),_0x38d02e['id'];const _0x2dfb26=await withSpinner(_0x541dba(0xc2),()=>_0x410dea[_0x541dba(0xb3)][_0x541dba(0xd5)]('claude-4.5-haiku',0x0),{'verbose':_0x297b0f});return _0x2dfb26[_0x541dba(0xb5)]['id'];}}async['execute'](_0x44bf37){const _0x1be05c=a8_0x5c6d1b,{options:_0x19d37a,args:_0x4913b1,tdx:_0xd7afc}=_0x44bf37,_0x3bee9f=_0x4913b1['join']('\x20'),_0x4ff5e0=_0x19d37a,_0x516c19=_0x4ff5e0[_0x1be05c(0xae)],_0x22c6b2=_0x4ff5e0[_0x1be05c(0xb4)],_0x15d5c7=_0x4ff5e0[_0x1be05c(0xa9)],_0x56502e=_0x4ff5e0[_0x1be05c(0xc1)];try{let _0x51df0b,_0x1d9849;!_0x56502e&&(_0x1d9849=loadLastChatId(),_0x1d9849&&_0x19d37a[_0x1be05c(0xca)]&&console[_0x1be05c(0xbf)](_0x1be05c(0xd1)+_0x1d9849));(_0x56502e||!_0x1d9849)&&(_0x51df0b=await this['getAgentId'](_0xd7afc,_0x516c19,_0x22c6b2,_0x15d5c7,_0x19d37a['verbose']));try{await this[_0x1be05c(0xc0)](_0xd7afc,_0x3bee9f,_0x51df0b,_0x1d9849,_0x19d37a[_0x1be05c(0xca)]);}catch(_0x2e10bf){const _0x5be2fe=_0x2e10bf instanceof SDKError&&_0x2e10bf[_0x1be05c(0xd3)]===ErrorCode[_0x1be05c(0xa7)]||_0x2e10bf instanceof Error&&_0x2e10bf['message'][_0x1be05c(0xc9)]('404');if(_0x5be2fe)_0x19d37a['verbose']&&console[_0x1be05c(0xbf)](_0x1be05c(0xd4)),!_0x51df0b&&(_0x51df0b=await this['getAgentId'](_0xd7afc,_0x516c19,_0x22c6b2,_0x15d5c7,_0x19d37a[_0x1be05c(0xca)])),await this['streamChat'](_0xd7afc,_0x3bee9f,_0x51df0b,undefined,_0x19d37a['verbose']);else throw _0x2e10bf;}return console[_0x1be05c(0xc5)](),0x0;}catch(_0x270ea8){return console[_0x1be05c(0xbf)](),handleSDKError(_0x270ea8,_0x19d37a),0x1;}}[a8_0x5c6d1b(0xb1)](_0x1a551a){const _0x587b9e=a8_0x5c6d1b;if(_0x587b9e(0xbb)in _0x1a551a)process['stdout']['write'](_0x1a551a[_0x587b9e(0xbb)]);else _0x587b9e(0xbf)in _0x1a551a&&console[_0x587b9e(0xbf)]('\x0aError:\x20'+_0x1a551a['error']);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a9_0x32c9(){const _0x7345e3=['Starting\x20TD\x20LLM\x20pass-through\x20proxy...','join','TD\x20Docs\x20MCP\x20Server','description','CLAUDE_CODE_UNSUPPORTED_VERSION','http://127.0.0.1:','data','stringify','Command\x20output:\x20','match','localhost','cwd','verbose','2738740sueVMr','name','false','ANTHROPIC_BASE_URL','✓\x20Found\x20available\x20port:\x20','start','fail','INSTALLATION_FAILED','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','stdout','--version','--transport','llm','ENOENT','red','✓\x20Settings\x20configured:\x20.claude/settings.local.json','Claude\x20Code\x20CLI\x20not\x20found','port','object','INTERNAL','Invalid\x20LLM\x20proxy\x20URL:\x20','tdx-skills','Configuring\x20MCP\x20server\x20\x27','llm-proxy','Configuring\x20marketplace\x20\x27','78658HPhmOF','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','getCurrent','tdx-managed-proxy','8698333HwiqoV','Command\x20spawn\x20error:\x20','add','attributes','✓\x20Marketplace\x20\x27','td-skills\x20Plugins','Failed\x20to\x20update\x20marketplace\x20\x27','\x20already\x20configured','marketplace','update','string','Claude\x20Code\x20version\x20','CLAUDE_CODE_USE_VERTEX','Initializing\x20proxy\x20logger...','\x20meets\x20minimum\x20requirement','mcp','warn','CLAUDE_CODE_NOT_FOUND','✓\x20Claude\x20Code\x20version\x20OK','✓\x20MCP\x20server\x20\x27','37uKvgRq','1989znGhTO','log','llmProxy','CLAUDE_CODE_USE_BEDROCK','90djsCjF','major','Initializing...','Checking\x20Claude\x20Code\x20version...','246tVZvzs','ANTHROPIC_AUTH_TOKEN','green','resume','\x27\x20updated','\x20or\x20later.','debug','error','already\x20installed','close','exit','Warning:\x20Failed\x20to\x20configure\x20','hostname','.claude','getLogPath','includes','settings.local.json','✓\x20Logs\x20saved\x20to\x20','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','\x20is\x20too\x20old\x20(minimum:\x20','continue','patch','statusLine','Failed\x20to\x20install\x20plugin\x20\x27','Command\x20failed\x20(exit\x20','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','info','apiKey','ANTHROPIC_MODEL','passThroughServer','install','claude','message','\x27\x20configured','parse','env','getOrCreateDefaultProject','Executing:\x20claude\x20','logger','user','7183oPqjnZ','https://github.com/treasure-data/td-skills','Setup\x20failed','already\x20exists','command','Creating\x20.claude/settings.local.json...','toString','unshift','cause','minor','\x20configuration\x20failed','inherit','✓\x20Settings\x20restored:\x20.claude/settings.local.json','127.0.0.1','account_id','text','originalSettings','server','site','workflow-skills','stop','td-skills','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','\x27...','init','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Setting\x20up\x20project...','tdx\x20--profile\x20','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','execute','https://docs.treasuredata.com/mcp','\x20→\x20','model','Installing\x20plugin\x20\x27','102192WCKzmC','41504JueBeS','stderr','INVALID_ARGUMENT','proxy','statusline','plugin','tdx','http','232684knbwOt','Claude\x20Code\x20version\x20check\x20failed','):\x20claude\x20','code','td-docs','context','✓\x20Plugin\x20\x27','142195UugOKc','trim'];a9_0x32c9=function(){return _0x7345e3;};return a9_0x32c9();}const a9_0x179477=a9_0x29aa;(function(_0x17c931,_0x21c202){const _0x5867a4=a9_0x29aa,_0x495f97=_0x17c931();while(!![]){try{const _0x164b0c=-parseInt(_0x5867a4(0x1df))/0x1*(-parseInt(_0x5867a4(0x26b))/0x2)+-parseInt(_0x5867a4(0x1e4))/0x3*(-parseInt(_0x5867a4(0x23c))/0x4)+-parseInt(_0x5867a4(0x243))/0x5*(-parseInt(_0x5867a4(0x1e8))/0x6)+parseInt(_0x5867a4(0x26f))/0x7+-parseInt(_0x5867a4(0x234))/0x8*(-parseInt(_0x5867a4(0x1e0))/0x9)+-parseInt(_0x5867a4(0x252))/0xa+parseInt(_0x5867a4(0x210))/0xb*(-parseInt(_0x5867a4(0x233))/0xc);if(_0x164b0c===_0x21c202)break;else _0x495f97['push'](_0x495f97['shift']());}catch(_0x723b77){_0x495f97['push'](_0x495f97['shift']());}}}(a9_0x32c9,0xe0c47));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x55b19c from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.js';import{findAvailablePort}from'../utils/port.js';import{findExecutable,crossSpawn}from'../utils/process.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='2.0.20';function handleInstallationError(_0x192658,_0x414080,_0xa1fcf0,_0x31906d){const _0x5342cb=a9_0x29aa;errorContains(_0x192658,_0x5342cb(0x213),_0x5342cb(0x1f0),'already\x20configured')?(_0xa1fcf0[_0x5342cb(0x21f)]='✓\x20'+_0x414080+_0x5342cb(0x1d2),_0x31906d?.['info'](_0x414080+'\x20already\x20configured'),_0x192658 instanceof SDKError&&_0x192658[_0x5342cb(0x218)]&&_0x31906d?.[_0x5342cb(0x1ee)](_0x5342cb(0x24d)+_0x192658[_0x5342cb(0x218)]['message'])):(_0xa1fcf0[_0x5342cb(0x1db)](_0x5342cb(0x1f3)+_0x414080),_0x31906d?.[_0x5342cb(0x1ef)](_0x414080+_0x5342cb(0x21a),_0x192658));}export function parseVersion(_0x331df2){const _0x2f1721=a9_0x29aa,_0x3e8905=_0x331df2[_0x2f1721(0x244)]()[_0x2f1721(0x24e)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x3e8905)return null;return{'major':parseInt(_0x3e8905[0x1],0xa),'minor':parseInt(_0x3e8905[0x2],0xa),'patch':parseInt(_0x3e8905[0x3],0xa)};}export function compareVersions(_0x5896b6,_0x18a956){const _0x156aa4=a9_0x29aa;if(_0x5896b6[_0x156aa4(0x1e5)]!==_0x18a956[_0x156aa4(0x1e5)])return _0x5896b6[_0x156aa4(0x1e5)]-_0x18a956[_0x156aa4(0x1e5)];if(_0x5896b6['minor']!==_0x18a956[_0x156aa4(0x219)])return _0x5896b6['minor']-_0x18a956[_0x156aa4(0x219)];return _0x5896b6[_0x156aa4(0x1fd)]-_0x18a956[_0x156aa4(0x1fd)];}async function checkClaudeVersion(_0x4689e3,_0x618e08){const _0x11d9b7=a9_0x29aa;_0x618e08?.[_0x11d9b7(0x1ee)](_0x11d9b7(0x226)+_0x4689e3+')');const _0x115449=await executeClaudeCommand([_0x11d9b7(0x25c)],undefined,_0x618e08),_0x1217b2=parseVersion(_0x115449);if(!_0x1217b2){_0x618e08?.['warn']('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x115449);return;}const _0x435926=_0x1217b2[_0x11d9b7(0x1e5)]+'.'+_0x1217b2[_0x11d9b7(0x219)]+'.'+_0x1217b2[_0x11d9b7(0x1fd)],_0x382d7c=parseVersion(_0x4689e3);if(!_0x382d7c){_0x618e08?.[_0x11d9b7(0x1db)]('Invalid\x20minimum\x20version\x20format:\x20'+_0x4689e3);return;}if(compareVersions(_0x1217b2,_0x382d7c)<0x0){_0x618e08?.['error'](_0x11d9b7(0x1d6)+_0x435926+_0x11d9b7(0x1fb)+_0x4689e3+')');throw new SDKError(ErrorCode[_0x11d9b7(0x249)],_0x11d9b7(0x1d6)+_0x435926+_0x11d9b7(0x26c)+_0x4689e3+_0x11d9b7(0x1ed),undefined,{'helpText':'Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code'});}_0x618e08?.[_0x11d9b7(0x1ee)](_0x11d9b7(0x1d6)+_0x435926+_0x11d9b7(0x1d9));}async function executeClaudeCommand(_0x561da8,_0x1dc7e7,_0x55eb90){const _0x36df8e=a9_0x29aa;return _0x55eb90?.[_0x36df8e(0x202)](_0x36df8e(0x20d)+_0x561da8['join']('\x20')),new Promise((_0x43f712,_0x5ebfb3)=>{const _0x2d0615=_0x36df8e,_0x513219=crossSpawn(_0x2d0615(0x207),_0x561da8,{'stdio':'pipe'});let _0x25ec0d='',_0x1793eb='';_0x513219[_0x2d0615(0x25b)]?.['on'](_0x2d0615(0x24b),_0x2013cf=>{_0x25ec0d+=_0x2013cf['toString']();}),_0x513219[_0x2d0615(0x235)]?.['on'](_0x2d0615(0x24b),_0x3b12dc=>{const _0x1c5f9b=_0x2d0615;_0x1793eb+=_0x3b12dc[_0x1c5f9b(0x216)]();}),_0x513219['on'](_0x2d0615(0x1ef),_0x3ec6f9=>{const _0x279fe9=_0x2d0615;_0x3ec6f9[_0x279fe9(0x23f)]===_0x279fe9(0x25f)?(_0x55eb90?.['error'](_0x279fe9(0x262)),_0x5ebfb3(new SDKError(ErrorCode[_0x279fe9(0x1dc)],'Claude\x20Code\x20CLI\x20not\x20found',_0x3ec6f9,{'helpText':_0x279fe9(0x25a)}))):(_0x55eb90?.[_0x279fe9(0x1ef)](_0x279fe9(0x1cc)+_0x3ec6f9[_0x279fe9(0x208)]),_0x5ebfb3(new SDKError(ErrorCode[_0x279fe9(0x265)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x3ec6f9['message'],_0x3ec6f9)));}),_0x513219['on'](_0x2d0615(0x1f2),_0x231707=>{const _0x5f280a=_0x2d0615;if(_0x231707===0x0)_0x43f712(_0x25ec0d);else _0x1dc7e7?(_0x55eb90?.['error'](_0x5f280a(0x200)+_0x231707+_0x5f280a(0x23e)+_0x561da8[_0x5f280a(0x246)]('\x20')),_0x5ebfb3(new SDKError(ErrorCode[_0x5f280a(0x259)],_0x1dc7e7,new Error(_0x1793eb)))):_0x43f712('');});});}async function ensureMcpServer(_0x2c4aa3,_0x21db8a,_0x15e314,_0x2e37ca,_0x1fd1fc){const _0x22f872=a9_0x29aa;_0x2e37ca[_0x22f872(0x21f)]=_0x22f872(0x268)+_0x2c4aa3+_0x22f872(0x227),await executeClaudeCommand([_0x22f872(0x1da),_0x22f872(0x1cd),_0x2c4aa3,_0x21db8a,_0x22f872(0x25d),_0x15e314],_0x22f872(0x229)+_0x2c4aa3+'\x27',_0x1fd1fc),_0x2e37ca[_0x22f872(0x21f)]=_0x22f872(0x1de)+_0x2c4aa3+_0x22f872(0x209);}async function ensureMarketplace(_0x134bea,_0x3d75ac,_0xc0a3bc,_0x3a0e19){const _0x1d9ec3=a9_0x29aa;_0xc0a3bc['text']=_0x1d9ec3(0x26a)+_0x134bea+'\x27...',await executeClaudeCommand(['plugin',_0x1d9ec3(0x1d3),_0x1d9ec3(0x1cd),_0x3d75ac],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x134bea+'\x27',_0x3a0e19),_0xc0a3bc[_0x1d9ec3(0x21f)]=_0x1d9ec3(0x1cf)+_0x134bea+_0x1d9ec3(0x209);}async function updateMarketplace(_0x2859e9,_0x565fde,_0x5ab143){const _0x477542=a9_0x29aa;_0x565fde[_0x477542(0x21f)]='Updating\x20marketplace\x20\x27'+_0x2859e9+_0x477542(0x227),await executeClaudeCommand([_0x477542(0x239),_0x477542(0x1d3),_0x477542(0x1d4)],_0x477542(0x1d1)+_0x2859e9+'\x27',_0x5ab143),_0x565fde['text']='✓\x20Marketplace\x20\x27'+_0x2859e9+_0x477542(0x1ec);}async function ensurePlugin(_0x3d9dc6,_0x7216c1,_0x7eaf29,_0x25220b){const _0x2242e8=a9_0x29aa;_0x7eaf29['text']=_0x2242e8(0x232)+_0x3d9dc6+_0x2242e8(0x227),await executeClaudeCommand([_0x2242e8(0x239),_0x2242e8(0x206),_0x3d9dc6+'@'+_0x7216c1],_0x2242e8(0x1ff)+_0x3d9dc6+'\x27',_0x25220b),_0x7eaf29['text']=_0x2242e8(0x242)+_0x3d9dc6+'\x27\x20installed';}async function createClaudeSettings(_0x5465b2,_0x3fae49,_0x178a15){const _0x518e00=a9_0x29aa,_0x3c639b=join(process[_0x518e00(0x250)](),_0x518e00(0x1f5)),_0x511907=join(_0x3c639b,_0x518e00(0x1f8));await mkdir(_0x3c639b,{'recursive':!![]});let _0x4da665={};if(existsSync(_0x511907))try{const _0x2930d4=await readFile(_0x511907,'utf-8');_0x4da665=JSON[_0x518e00(0x20a)](_0x2930d4);}catch{_0x4da665={};}const _0x37c411=_0x4da665[_0x518e00(0x20b)]||{},_0x2c112b={'ANTHROPIC_BASE_URL':_0x37c411[_0x518e00(0x255)],'ANTHROPIC_MODEL':_0x37c411[_0x518e00(0x204)],'ANTHROPIC_AUTH_TOKEN':_0x37c411[_0x518e00(0x1e9)],'CLAUDE_CODE_USE_BEDROCK':_0x37c411[_0x518e00(0x1e3)],'CLAUDE_CODE_USE_VERTEX':_0x37c411[_0x518e00(0x1d7)],'statusLine':_0x4da665[_0x518e00(0x1fe)]},_0x36b276={..._0x4da665,'env':{..._0x37c411,'ANTHROPIC_BASE_URL':_0x518e00(0x24a)+_0x5465b2,..._0x3fae49&&{'ANTHROPIC_MODEL':_0x3fae49},'ANTHROPIC_AUTH_TOKEN':_0x518e00(0x26e),'CLAUDE_CODE_USE_BEDROCK':_0x518e00(0x254),'CLAUDE_CODE_USE_VERTEX':_0x518e00(0x254)},'statusLine':{'type':_0x518e00(0x214),'command':_0x178a15?_0x518e00(0x22c)+_0x178a15+'\x20claude\x20statusline':'tdx\x20claude\x20statusline'}};return await writeFile(_0x511907,JSON[_0x518e00(0x24c)](_0x36b276,null,0x2)+'\x0a'),_0x2c112b;}function a9_0x29aa(_0x17726d,_0xbc9c22){_0x17726d=_0x17726d-0x1cc;const _0x32c9c7=a9_0x32c9();let _0x29aa29=_0x32c9c7[_0x17726d];return _0x29aa29;}async function restoreClaudeSettings(_0x34a23d){const _0xab261a=a9_0x29aa,_0xa92dd9=join(process[_0xab261a(0x250)](),_0xab261a(0x1f5)),_0x4b05fc=join(_0xa92dd9,_0xab261a(0x1f8));if(!existsSync(_0x4b05fc))return;try{const _0xcf25c2=await readFile(_0x4b05fc,'utf-8'),_0x490fe6=JSON[_0xab261a(0x20a)](_0xcf25c2),_0x1843d0=_0x490fe6[_0xab261a(0x20b)]||{},_0x2d6675=_0x1843d0[_0xab261a(0x255)],_0x757b8c=((()=>{const _0x54c5cf=_0xab261a;if(typeof _0x2d6675!==_0x54c5cf(0x1d5))return![];try{const _0x181152=new URL(_0x2d6675);return _0x181152[_0x54c5cf(0x1f4)]===_0x54c5cf(0x24f)||_0x181152[_0x54c5cf(0x1f4)]===_0x54c5cf(0x21d);}catch{return![];}})());_0x757b8c?(delete _0x1843d0[_0xab261a(0x255)],delete _0x1843d0[_0xab261a(0x204)],delete _0x1843d0['ANTHROPIC_AUTH_TOKEN'],delete _0x1843d0[_0xab261a(0x1e3)],delete _0x1843d0[_0xab261a(0x1d7)]):(_0x34a23d['ANTHROPIC_BASE_URL']!==undefined?_0x1843d0[_0xab261a(0x255)]=_0x34a23d[_0xab261a(0x255)]:delete _0x1843d0[_0xab261a(0x255)],_0x34a23d[_0xab261a(0x204)]!==undefined?_0x1843d0[_0xab261a(0x204)]=_0x34a23d[_0xab261a(0x204)]:delete _0x1843d0['ANTHROPIC_MODEL'],_0x34a23d[_0xab261a(0x1e9)]!==undefined?_0x1843d0[_0xab261a(0x1e9)]=_0x34a23d[_0xab261a(0x1e9)]:delete _0x1843d0[_0xab261a(0x1e9)],_0x34a23d[_0xab261a(0x1e3)]!==undefined?_0x1843d0[_0xab261a(0x1e3)]=_0x34a23d[_0xab261a(0x1e3)]:delete _0x1843d0[_0xab261a(0x1e3)],_0x34a23d[_0xab261a(0x1d7)]!==undefined?_0x1843d0[_0xab261a(0x1d7)]=_0x34a23d[_0xab261a(0x1d7)]:delete _0x1843d0['CLAUDE_CODE_USE_VERTEX']);const _0x1df62e=_0x490fe6[_0xab261a(0x1fe)],_0x37be11=((()=>{const _0x240580=_0xab261a;if(!_0x1df62e||typeof _0x1df62e!==_0x240580(0x264))return![];if(_0x1df62e['type']!=='command')return![];if(typeof _0x1df62e[_0x240580(0x214)]!==_0x240580(0x1d5))return![];return _0x1df62e[_0x240580(0x214)][_0x240580(0x1f7)](_0x240580(0x23a))&&_0x1df62e[_0x240580(0x214)][_0x240580(0x1f7)](_0x240580(0x238));})());if(_0x37be11)delete _0x490fe6[_0xab261a(0x1fe)];else _0x34a23d[_0xab261a(0x1fe)]!==undefined?_0x490fe6['statusLine']=_0x34a23d['statusLine']:delete _0x490fe6[_0xab261a(0x1fe)];_0x490fe6[_0xab261a(0x20b)]=_0x1843d0,await writeFile(_0x4b05fc,JSON[_0xab261a(0x24c)](_0x490fe6,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x179477(0x253)]='claude';[a9_0x179477(0x248)]=a9_0x179477(0x201);[a9_0x179477(0x221)];['passThroughServer'];[a9_0x179477(0x220)];[a9_0x179477(0x20e)];[a9_0x179477(0x263)];async[a9_0x179477(0x22e)](_0xadc890){const _0x1774b7=a9_0x179477,{tdx:_0x4151f1,options:_0x42106b,args:_0x1767e8}=_0xadc890;try{const _0x46d729=_0x42106b,_0x5148aa=_0x46d729[_0x1774b7(0x237)]===![],_0x1c4ee8=_0x46d729[_0x1774b7(0x1fc)]===!![],_0x1f2390=_0x46d729[_0x1774b7(0x1eb)]===!![],_0x37be78=_0x46d729[_0x1774b7(0x1e2)],_0x288efc=_0x37be78!==undefined&&_0x37be78!==![],_0x208977=typeof _0x37be78===_0x1774b7(0x1d5)?_0x37be78:undefined,_0x354769=_0x288efc?undefined:_0x46d729[_0x1774b7(0x231)],_0x15cdfe=[..._0x1767e8];if(_0x1c4ee8)_0x15cdfe[_0x1774b7(0x217)]('-c');else _0x1f2390&&_0x15cdfe[_0x1774b7(0x217)]('-r');const _0x5d631f=createCommandSpinner(_0x1774b7(0x1e6),{'verbose':_0x42106b[_0x1774b7(0x251)]});_0x5d631f[_0x1774b7(0x257)]();try{if(!_0x5148aa){_0x5d631f[_0x1774b7(0x21f)]='Finding\x20available\x20port...',this[_0x1774b7(0x263)]=await findAvailablePort(0xfa0),_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x256)+this[_0x1774b7(0x263)];const _0x51a09c=_0x42106b['profile'];try{const _0x423f93=await _0x4151f1[_0x1774b7(0x20f)][_0x1774b7(0x26d)]();_0x423f93[_0x1774b7(0x21e)]&&writeCachedAccountInfo(_0x42106b['site'],_0x423f93[_0x1774b7(0x21e)],_0x51a09c);}catch{}_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x1d8),this[_0x1774b7(0x20e)]=new TDXLogger(_0x42106b['logLevel'],!![]),await this[_0x1774b7(0x20e)][_0x1774b7(0x228)]();const _0x56e46c=this[_0x1774b7(0x20e)]['getLogPath']();_0x5d631f[_0x1774b7(0x21f)]='✓\x20Logging\x20to\x20'+_0x56e46c;if(_0x288efc){if(_0x208977&&!URL['canParse'](_0x208977))throw new SDKError(ErrorCode[_0x1774b7(0x236)],_0x1774b7(0x266)+_0x208977);const _0x43f068=_0x208977||getEndpoint(_0x42106b[_0x1774b7(0x222)],_0x1774b7(0x269));_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x245);if(!_0x4151f1[_0x1774b7(0x241)][_0x1774b7(0x203)])throw new SDKError(ErrorCode[_0x1774b7(0x236)],_0x1774b7(0x22d));this[_0x1774b7(0x205)]=new PassThroughProxyServer({'port':this[_0x1774b7(0x263)],'llmProxyUrl':_0x43f068,'apiKey':_0x4151f1['context']['apiKey'],'logger':this['logger'],'site':_0x42106b[_0x1774b7(0x222)],'profile':_0x51a09c}),await this[_0x1774b7(0x205)][_0x1774b7(0x257)](),_0x5d631f[_0x1774b7(0x21f)]='✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20'+this[_0x1774b7(0x263)]+_0x1774b7(0x230)+_0x43f068;}else{_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x22b);const _0x6b6415=await _0x4151f1[_0x1774b7(0x25e)][_0x1774b7(0x20c)](),_0x1a9b6e=_0x6b6415['id'];_0x5d631f[_0x1774b7(0x21f)]='✓\x20Using\x20project:\x20'+_0x6b6415[_0x1774b7(0x1ce)][_0x1774b7(0x253)],_0x5d631f['text']='Starting\x20TD\x20LLM\x20proxy\x20server...',this['server']=new ProxyServer({'port':this[_0x1774b7(0x263)],'projectId':_0x1a9b6e,'tdx':_0x4151f1,'logger':this[_0x1774b7(0x20e)],'site':_0x42106b['site']}),await this[_0x1774b7(0x221)]['start'](),_0x5d631f[_0x1774b7(0x21f)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+this[_0x1774b7(0x263)];}_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x215),this[_0x1774b7(0x220)]=await createClaudeSettings(this[_0x1774b7(0x263)],_0x354769,_0x51a09c),_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x261);}else _0x5d631f['text']='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x5d631f['text']=_0x1774b7(0x1e7),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x1774b7(0x20e)]),_0x5d631f[_0x1774b7(0x21f)]=_0x1774b7(0x1dd);}catch(_0x5ab67b){_0x5d631f[_0x1774b7(0x258)](_0x1774b7(0x23d));throw _0x5ab67b;}try{await ensureMcpServer(_0x1774b7(0x240),_0x1774b7(0x22f),_0x1774b7(0x23b),_0x5d631f,this[_0x1774b7(0x20e)]);}catch(_0x2cdd87){handleInstallationError(_0x2cdd87,_0x1774b7(0x247),_0x5d631f,this[_0x1774b7(0x20e)]);}try{await ensureMarketplace(_0x1774b7(0x225),_0x1774b7(0x211),_0x5d631f,this[_0x1774b7(0x20e)]),await updateMarketplace(_0x1774b7(0x225),_0x5d631f,this[_0x1774b7(0x20e)]),await ensurePlugin('sql-skills',_0x1774b7(0x225),_0x5d631f,this[_0x1774b7(0x20e)]),await ensurePlugin(_0x1774b7(0x223),_0x1774b7(0x225),_0x5d631f,this[_0x1774b7(0x20e)]),await ensurePlugin(_0x1774b7(0x267),'td-skills',_0x5d631f,this['logger']);}catch(_0x5286de){handleInstallationError(_0x5286de,_0x1774b7(0x1d0),_0x5d631f,this[_0x1774b7(0x20e)]);}_0x5d631f[_0x1774b7(0x224)]();}catch(_0x45bae4){_0x5d631f[_0x1774b7(0x258)](_0x1774b7(0x212));throw _0x45bae4;}const _0x22edf4=await findExecutable(_0x1774b7(0x207));if(!_0x22edf4)throw new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],_0x1774b7(0x262),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x3fe96b={...process[_0x1774b7(0x20b)]};!_0x5148aa&&(_0x3fe96b[_0x1774b7(0x255)]=_0x1774b7(0x24a)+this[_0x1774b7(0x263)],_0x354769&&(_0x3fe96b['ANTHROPIC_MODEL']=_0x354769),_0x3fe96b[_0x1774b7(0x1e9)]='tdx-managed-proxy',_0x3fe96b[_0x1774b7(0x1e3)]=_0x1774b7(0x254),_0x3fe96b[_0x1774b7(0x1d7)]=_0x1774b7(0x254));const _0x4fb79c=crossSpawn(_0x22edf4,_0x15cdfe,{'stdio':_0x1774b7(0x21b),'env':_0x3fe96b}),_0x15c39c=await new Promise(_0x39e599=>{_0x4fb79c['on']('exit',_0x42fb2c=>{_0x39e599(_0x42fb2c||0x0);}),_0x4fb79c['on']('error',_0x482bab=>{const _0x3ed6f6=a9_0x29aa;console[_0x3ed6f6(0x1ef)](a9_0x55b19c[_0x3ed6f6(0x260)](_0x3ed6f6(0x22a)+_0x482bab[_0x3ed6f6(0x208)])),_0x39e599(0x1);});});this[_0x1774b7(0x221)]&&(await this[_0x1774b7(0x221)]['stop'](),console[_0x1774b7(0x1e1)](a9_0x55b19c[_0x1774b7(0x1ea)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));this['passThroughServer']&&(await this[_0x1774b7(0x205)][_0x1774b7(0x224)](),console[_0x1774b7(0x1e1)](a9_0x55b19c['green'](_0x1774b7(0x1fa))));if(this[_0x1774b7(0x20e)]){await this['logger'][_0x1774b7(0x1f1)]();const _0x393c76=this[_0x1774b7(0x20e)][_0x1774b7(0x1f6)]();console[_0x1774b7(0x1e1)](a9_0x55b19c[_0x1774b7(0x1ea)](_0x1774b7(0x1f9)+_0x393c76));}return this[_0x1774b7(0x220)]&&(await restoreClaudeSettings(this[_0x1774b7(0x220)]),console[_0x1774b7(0x1e1)](a9_0x55b19c[_0x1774b7(0x1ea)](_0x1774b7(0x21c)))),_0x15c39c;}catch(_0xb83456){this['server']&&await this[_0x1774b7(0x221)]['stop']();this['passThroughServer']&&await this[_0x1774b7(0x205)][_0x1774b7(0x224)]();this['logger']&&await this[_0x1774b7(0x20e)][_0x1774b7(0x1f1)]();this['originalSettings']&&await restoreClaudeSettings(this[_0x1774b7(0x220)]);throw _0xb83456;}}}
|
|
1
|
+
const a9_0x47737c=a9_0x6147;(function(_0x59b453,_0x5c62bf){const _0x16d5f2=a9_0x6147,_0x405507=_0x59b453();while(!![]){try{const _0x29d16a=parseInt(_0x16d5f2(0x138))/0x1+parseInt(_0x16d5f2(0x1cc))/0x2*(-parseInt(_0x16d5f2(0x198))/0x3)+parseInt(_0x16d5f2(0x1bd))/0x4*(-parseInt(_0x16d5f2(0x150))/0x5)+-parseInt(_0x16d5f2(0x1be))/0x6+-parseInt(_0x16d5f2(0x183))/0x7*(-parseInt(_0x16d5f2(0x15b))/0x8)+parseInt(_0x16d5f2(0x189))/0x9+-parseInt(_0x16d5f2(0x13a))/0xa*(parseInt(_0x16d5f2(0x176))/0xb);if(_0x29d16a===_0x5c62bf)break;else _0x405507['push'](_0x405507['shift']());}catch(_0x416d93){_0x405507['push'](_0x405507['shift']());}}}(a9_0x44a7,0x8d796));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x131591 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.js';import{findAvailablePort}from'../utils/port.js';import{findExecutable,crossSpawn}from'../utils/process.js';function a9_0x6147(_0x1c4b96,_0x447675){_0x1c4b96=_0x1c4b96-0x136;const _0x44a7e8=a9_0x44a7();let _0x614715=_0x44a7e8[_0x1c4b96];return _0x614715;}import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';function a9_0x44a7(){const _0x5e69fe=['object','server','Failed\x20to\x20configure\x20marketplace\x20\x27','pipe','resume','2856952RdasFf','Initializing\x20proxy\x20logger...','CLAUDE_CODE_USE_VERTEX','https://github.com/treasure-data/td-skills','Claude\x20Code\x20CLI\x20not\x20found','parse','workflow-skills','✓\x20Logging\x20to\x20','tdx\x20claude\x20statusline','2.0.20','INVALID_ARGUMENT','update','ANTHROPIC_AUTH_TOKEN','site','error','Setup\x20failed','debug','Initializing...','ANTHROPIC_BASE_URL','\x27\x20installed','statusline','port','CLAUDE_CODE_USE_BEDROCK','canParse','warn','apiKey','✓\x20Settings\x20configured:\x20.claude/settings.local.json','77RzZbmR','false','Configuring\x20marketplace\x20\x27','Setting\x20up\x20project...','✓\x20MCP\x20server\x20\x27','profile','passThroughServer','✓\x20Logs\x20saved\x20to\x20','.claude','minor','logLevel','\x20configuration\x20failed','env','7pfmoIv','originalSettings','user','CLAUDE_CODE_UNSUPPORTED_VERSION','start','command','7964244ZAlgun','ENOENT','stringify','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','attributes','\x27\x20configured','match','context','mcp','cwd','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','td-skills','663FcggXs','log','Checking\x20Claude\x20Code\x20version...','\x20is\x20too\x20old\x20(minimum:\x20','tdx-skills','\x20→\x20','--transport','continue','proxy','red','✓\x20Settings\x20restored:\x20.claude/settings.local.json','type','tdx','inherit','init','info','account_id','already\x20configured','TD\x20Docs\x20MCP\x20Server','http://127.0.0.1:','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','INSTALLATION_FAILED','Invalid\x20LLM\x20proxy\x20URL:\x20','hostname','patch','Configuring\x20MCP\x20server\x20\x27','getOrCreateDefaultProject','llm','Creating\x20.claude/settings.local.json...','message','plugin','claude','getLogPath','✓\x20Marketplace\x20\x27','green','\x20claude\x20statusline','verbose','41588PpmoOV','2898498suPXhX','Claude\x20Code\x20version\x20','CLAUDE_CODE_NOT_FOUND','Invalid\x20minimum\x20version\x20format:\x20','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','code','description','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','add','includes','close','tdx-managed-proxy','\x27\x20updated','Command\x20spawn\x20error:\x20','1354wQQuEu','marketplace','stop','execute','llm-proxy','ANTHROPIC_MODEL','\x20already\x20configured','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','Warning:\x20Failed\x20to\x20configure\x20','755624lPwKnz','string','156680IMqntQ','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','utf-8','http','\x27...','name','logger','settings.local.json','stderr','toString','\x20meets\x20minimum\x20requirement','tdx\x20--profile\x20','td-skills\x20Plugins','already\x20installed','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','fail','exit','data','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','\x20or\x20later.','✓\x20Claude\x20Code\x20version\x20OK','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','325fhwLJs','text','statusLine','cause','major','unshift'];a9_0x44a7=function(){return _0x5e69fe;};return a9_0x44a7();}import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a9_0x47737c(0x164);function handleInstallationError(_0x5c711f,_0x27b7a3,_0x30e20e,_0x29601d){const _0x53f916=a9_0x47737c;errorContains(_0x5c711f,'already\x20exists',_0x53f916(0x147),_0x53f916(0x1a9))?(_0x30e20e['text']='✓\x20'+_0x27b7a3+_0x53f916(0x1d2),_0x29601d?.['info'](_0x27b7a3+_0x53f916(0x1d2)),_0x5c711f instanceof SDKError&&_0x5c711f['cause']&&_0x29601d?.['debug']('Command\x20output:\x20'+_0x5c711f[_0x53f916(0x153)]['message'])):(_0x30e20e[_0x53f916(0x173)](_0x53f916(0x137)+_0x27b7a3),_0x29601d?.[_0x53f916(0x169)](_0x27b7a3+_0x53f916(0x181),_0x5c711f));}export function parseVersion(_0x52486e){const _0x4fe542=a9_0x47737c,_0x14c90a=_0x52486e['trim']()[_0x4fe542(0x191)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x14c90a)return null;return{'major':parseInt(_0x14c90a[0x1],0xa),'minor':parseInt(_0x14c90a[0x2],0xa),'patch':parseInt(_0x14c90a[0x3],0xa)};}export function compareVersions(_0x5e5682,_0x349fa3){const _0x50ed36=a9_0x47737c;if(_0x5e5682[_0x50ed36(0x154)]!==_0x349fa3[_0x50ed36(0x154)])return _0x5e5682[_0x50ed36(0x154)]-_0x349fa3[_0x50ed36(0x154)];if(_0x5e5682['minor']!==_0x349fa3[_0x50ed36(0x17f)])return _0x5e5682['minor']-_0x349fa3[_0x50ed36(0x17f)];return _0x5e5682[_0x50ed36(0x1b0)]-_0x349fa3[_0x50ed36(0x1b0)];}async function checkClaudeVersion(_0x183ef6,_0x52ce4e){const _0x1599a6=a9_0x47737c;_0x52ce4e?.[_0x1599a6(0x16b)](_0x1599a6(0x1c5)+_0x183ef6+')');const _0x5b45fd=await executeClaudeCommand(['--version'],undefined,_0x52ce4e),_0xbf14e6=parseVersion(_0x5b45fd);if(!_0xbf14e6){_0x52ce4e?.[_0x1599a6(0x173)](_0x1599a6(0x195)+_0x5b45fd);return;}const _0x56ab9b=_0xbf14e6[_0x1599a6(0x154)]+'.'+_0xbf14e6['minor']+'.'+_0xbf14e6[_0x1599a6(0x1b0)],_0x5a2664=parseVersion(_0x183ef6);if(!_0x5a2664){_0x52ce4e?.[_0x1599a6(0x173)](_0x1599a6(0x1c1)+_0x183ef6);return;}if(compareVersions(_0xbf14e6,_0x5a2664)<0x0){_0x52ce4e?.[_0x1599a6(0x169)](_0x1599a6(0x1bf)+_0x56ab9b+_0x1599a6(0x19b)+_0x183ef6+')');throw new SDKError(ErrorCode[_0x1599a6(0x186)],_0x1599a6(0x1bf)+_0x56ab9b+_0x1599a6(0x13b)+_0x183ef6+_0x1599a6(0x14d),undefined,{'helpText':'Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code'});}_0x52ce4e?.[_0x1599a6(0x16b)](_0x1599a6(0x1bf)+_0x56ab9b+_0x1599a6(0x144));}async function executeClaudeCommand(_0x32fa00,_0x9fc22d,_0x1a4fa7){const _0x395f0e=a9_0x47737c;return _0x1a4fa7?.[_0x395f0e(0x1a7)]('Executing:\x20claude\x20'+_0x32fa00['join']('\x20')),new Promise((_0x25eb87,_0x253f19)=>{const _0x2f4e5e=_0x395f0e,_0x58f4cc=crossSpawn('claude',_0x32fa00,{'stdio':_0x2f4e5e(0x159)});let _0xc0f814='',_0x59b365='';_0x58f4cc['stdout']?.['on'](_0x2f4e5e(0x14b),_0x56c889=>{const _0x242bb5=_0x2f4e5e;_0xc0f814+=_0x56c889[_0x242bb5(0x143)]();}),_0x58f4cc[_0x2f4e5e(0x142)]?.['on'](_0x2f4e5e(0x14b),_0x34534e=>{const _0xdd6b19=_0x2f4e5e;_0x59b365+=_0x34534e[_0xdd6b19(0x143)]();}),_0x58f4cc['on'](_0x2f4e5e(0x169),_0x2ff8c6=>{const _0x45bd0d=_0x2f4e5e;_0x2ff8c6[_0x45bd0d(0x1c3)]===_0x45bd0d(0x18a)?(_0x1a4fa7?.['error'](_0x45bd0d(0x15f)),_0x253f19(new SDKError(ErrorCode[_0x45bd0d(0x1c0)],_0x45bd0d(0x15f),_0x2ff8c6,{'helpText':_0x45bd0d(0x14c)}))):(_0x1a4fa7?.[_0x45bd0d(0x169)](_0x45bd0d(0x1cb)+_0x2ff8c6[_0x45bd0d(0x1b5)]),_0x253f19(new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x2ff8c6[_0x45bd0d(0x1b5)],_0x2ff8c6)));}),_0x58f4cc['on'](_0x2f4e5e(0x14a),_0x4d88e2=>{const _0xcabd9e=_0x2f4e5e;if(_0x4d88e2===0x0)_0x25eb87(_0xc0f814);else _0x9fc22d?(_0x1a4fa7?.[_0xcabd9e(0x169)]('Command\x20failed\x20(exit\x20'+_0x4d88e2+'):\x20claude\x20'+_0x32fa00['join']('\x20')),_0x253f19(new SDKError(ErrorCode[_0xcabd9e(0x1ad)],_0x9fc22d,new Error(_0x59b365)))):_0x25eb87('');});});}async function ensureMcpServer(_0x84d5be,_0x5bf252,_0x2f0512,_0x539e3b,_0x26b774){const _0x432427=a9_0x47737c;_0x539e3b[_0x432427(0x151)]=_0x432427(0x1b1)+_0x84d5be+_0x432427(0x13e),await executeClaudeCommand([_0x432427(0x193),_0x432427(0x1c6),_0x84d5be,_0x5bf252,_0x432427(0x19e),_0x2f0512],_0x432427(0x18c)+_0x84d5be+'\x27',_0x26b774),_0x539e3b[_0x432427(0x151)]=_0x432427(0x17a)+_0x84d5be+_0x432427(0x190);}async function ensureMarketplace(_0x31ffe7,_0x14aa42,_0x22e5d8,_0x25aa96){const _0x4fa134=a9_0x47737c;_0x22e5d8[_0x4fa134(0x151)]=_0x4fa134(0x178)+_0x31ffe7+_0x4fa134(0x13e),await executeClaudeCommand([_0x4fa134(0x1b6),'marketplace',_0x4fa134(0x1c6),_0x14aa42],_0x4fa134(0x158)+_0x31ffe7+'\x27',_0x25aa96),_0x22e5d8[_0x4fa134(0x151)]=_0x4fa134(0x1b9)+_0x31ffe7+'\x27\x20configured';}async function updateMarketplace(_0x43d369,_0x59e9f7,_0x9c0fbc){const _0x41935f=a9_0x47737c;_0x59e9f7[_0x41935f(0x151)]='Updating\x20marketplace\x20\x27'+_0x43d369+_0x41935f(0x13e),await executeClaudeCommand([_0x41935f(0x1b6),_0x41935f(0x1cd),_0x41935f(0x166)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x43d369+'\x27',_0x9c0fbc),_0x59e9f7[_0x41935f(0x151)]='✓\x20Marketplace\x20\x27'+_0x43d369+_0x41935f(0x1ca);}async function ensurePlugin(_0x652ad6,_0x16e200,_0x598cac,_0x535cb4){const _0x22ed59=a9_0x47737c;_0x598cac[_0x22ed59(0x151)]='Installing\x20plugin\x20\x27'+_0x652ad6+_0x22ed59(0x13e),await executeClaudeCommand([_0x22ed59(0x1b6),'install',_0x652ad6+'@'+_0x16e200],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x652ad6+'\x27',_0x535cb4),_0x598cac[_0x22ed59(0x151)]='✓\x20Plugin\x20\x27'+_0x652ad6+_0x22ed59(0x16e);}async function createClaudeSettings(_0x16895e,_0x195069,_0x23c07d){const _0xdf9a1=a9_0x47737c,_0x10cc9c=join(process[_0xdf9a1(0x194)](),_0xdf9a1(0x17e)),_0x275fd5=join(_0x10cc9c,_0xdf9a1(0x141));await mkdir(_0x10cc9c,{'recursive':!![]});let _0xae4c56={};if(existsSync(_0x275fd5))try{const _0x568f38=await readFile(_0x275fd5,_0xdf9a1(0x13c));_0xae4c56=JSON[_0xdf9a1(0x160)](_0x568f38);}catch{_0xae4c56={};}const _0x1ca225=_0xae4c56[_0xdf9a1(0x182)]||{},_0x8c01e={'ANTHROPIC_BASE_URL':_0x1ca225['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x1ca225[_0xdf9a1(0x1d1)],'ANTHROPIC_AUTH_TOKEN':_0x1ca225[_0xdf9a1(0x167)],'CLAUDE_CODE_USE_BEDROCK':_0x1ca225[_0xdf9a1(0x171)],'CLAUDE_CODE_USE_VERTEX':_0x1ca225[_0xdf9a1(0x15d)],'statusLine':_0xae4c56[_0xdf9a1(0x152)]},_0x3a7761={..._0xae4c56,'env':{..._0x1ca225,'ANTHROPIC_BASE_URL':_0xdf9a1(0x1ab)+_0x16895e,..._0x195069&&{'ANTHROPIC_MODEL':_0x195069},'ANTHROPIC_AUTH_TOKEN':'tdx-managed-proxy','CLAUDE_CODE_USE_BEDROCK':'false','CLAUDE_CODE_USE_VERTEX':_0xdf9a1(0x177)},'statusLine':{'type':'command','command':_0x23c07d?_0xdf9a1(0x145)+_0x23c07d+_0xdf9a1(0x1bb):_0xdf9a1(0x163)}};return await writeFile(_0x275fd5,JSON[_0xdf9a1(0x18b)](_0x3a7761,null,0x2)+'\x0a'),_0x8c01e;}async function restoreClaudeSettings(_0x713192){const _0x1dd6e0=a9_0x47737c,_0x2a9706=join(process[_0x1dd6e0(0x194)](),_0x1dd6e0(0x17e)),_0x1ce1e8=join(_0x2a9706,_0x1dd6e0(0x141));if(!existsSync(_0x1ce1e8))return;try{const _0x380c65=await readFile(_0x1ce1e8,_0x1dd6e0(0x13c)),_0x28b628=JSON[_0x1dd6e0(0x160)](_0x380c65),_0x381a04=_0x28b628[_0x1dd6e0(0x182)]||{},_0x13a089=_0x381a04[_0x1dd6e0(0x16d)],_0x615b56=((()=>{const _0x2eab8a=_0x1dd6e0;if(typeof _0x13a089!==_0x2eab8a(0x139))return![];try{const _0x15d0e9=new URL(_0x13a089);return _0x15d0e9[_0x2eab8a(0x1af)]==='localhost'||_0x15d0e9['hostname']==='127.0.0.1';}catch{return![];}})());_0x615b56?(delete _0x381a04[_0x1dd6e0(0x16d)],delete _0x381a04[_0x1dd6e0(0x1d1)],delete _0x381a04[_0x1dd6e0(0x167)],delete _0x381a04['CLAUDE_CODE_USE_BEDROCK'],delete _0x381a04[_0x1dd6e0(0x15d)]):(_0x713192['ANTHROPIC_BASE_URL']!==undefined?_0x381a04[_0x1dd6e0(0x16d)]=_0x713192['ANTHROPIC_BASE_URL']:delete _0x381a04[_0x1dd6e0(0x16d)],_0x713192[_0x1dd6e0(0x1d1)]!==undefined?_0x381a04[_0x1dd6e0(0x1d1)]=_0x713192['ANTHROPIC_MODEL']:delete _0x381a04[_0x1dd6e0(0x1d1)],_0x713192['ANTHROPIC_AUTH_TOKEN']!==undefined?_0x381a04[_0x1dd6e0(0x167)]=_0x713192[_0x1dd6e0(0x167)]:delete _0x381a04[_0x1dd6e0(0x167)],_0x713192[_0x1dd6e0(0x171)]!==undefined?_0x381a04['CLAUDE_CODE_USE_BEDROCK']=_0x713192[_0x1dd6e0(0x171)]:delete _0x381a04[_0x1dd6e0(0x171)],_0x713192['CLAUDE_CODE_USE_VERTEX']!==undefined?_0x381a04[_0x1dd6e0(0x15d)]=_0x713192[_0x1dd6e0(0x15d)]:delete _0x381a04['CLAUDE_CODE_USE_VERTEX']);const _0x45f5d1=_0x28b628[_0x1dd6e0(0x152)],_0x508962=((()=>{const _0x1f22cc=_0x1dd6e0;if(!_0x45f5d1||typeof _0x45f5d1!==_0x1f22cc(0x156))return![];if(_0x45f5d1[_0x1f22cc(0x1a3)]!==_0x1f22cc(0x188))return![];if(typeof _0x45f5d1[_0x1f22cc(0x188)]!==_0x1f22cc(0x139))return![];return _0x45f5d1[_0x1f22cc(0x188)][_0x1f22cc(0x1c7)](_0x1f22cc(0x1a4))&&_0x45f5d1['command'][_0x1f22cc(0x1c7)](_0x1f22cc(0x16f));})());if(_0x508962)delete _0x28b628[_0x1dd6e0(0x152)];else _0x713192[_0x1dd6e0(0x152)]!==undefined?_0x28b628['statusLine']=_0x713192[_0x1dd6e0(0x152)]:delete _0x28b628['statusLine'];_0x28b628[_0x1dd6e0(0x182)]=_0x381a04,await writeFile(_0x1ce1e8,JSON['stringify'](_0x28b628,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a9_0x47737c(0x1b7);[a9_0x47737c(0x1c4)]=a9_0x47737c(0x136);[a9_0x47737c(0x157)];[a9_0x47737c(0x17c)];[a9_0x47737c(0x184)];[a9_0x47737c(0x140)];[a9_0x47737c(0x170)];async[a9_0x47737c(0x1cf)](_0x1dc858){const _0x2b2b67=a9_0x47737c,{tdx:_0x1a37a0,options:_0x360acc,args:_0x226f02}=_0x1dc858;try{const _0xa51b8=_0x360acc,_0x49bb2e=_0xa51b8[_0x2b2b67(0x1a0)]===![],_0x2a4bf8=_0xa51b8[_0x2b2b67(0x19f)]===!![],_0x8514d6=_0xa51b8[_0x2b2b67(0x15a)]===!![],_0x4168d9=_0xa51b8['llmProxy'],_0x401f60=_0x4168d9!==undefined&&_0x4168d9!==![],_0x2574be=typeof _0x4168d9===_0x2b2b67(0x139)?_0x4168d9:undefined,_0x51198e=_0x401f60?undefined:_0xa51b8['model'],_0x321d4b=[..._0x226f02];if(_0x2a4bf8)_0x321d4b[_0x2b2b67(0x155)]('-c');else _0x8514d6&&_0x321d4b[_0x2b2b67(0x155)]('-r');const _0x13ff02=createCommandSpinner(_0x2b2b67(0x16c),{'verbose':_0x360acc[_0x2b2b67(0x1bc)]});_0x13ff02[_0x2b2b67(0x187)]();try{if(!_0x49bb2e){_0x13ff02[_0x2b2b67(0x151)]='Finding\x20available\x20port...',this[_0x2b2b67(0x170)]=await findAvailablePort(0xfa0),_0x13ff02['text']='✓\x20Found\x20available\x20port:\x20'+this['port'];const _0x31caa2=_0x360acc[_0x2b2b67(0x17b)];try{const _0x405cad=await _0x1a37a0[_0x2b2b67(0x185)]['getCurrent']();_0x405cad[_0x2b2b67(0x1a8)]&&writeCachedAccountInfo(_0x360acc['site'],_0x405cad[_0x2b2b67(0x1a8)],_0x31caa2);}catch{}_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x15c),this[_0x2b2b67(0x140)]=new TDXLogger(_0x360acc[_0x2b2b67(0x180)],!![]),await this['logger'][_0x2b2b67(0x1a6)]();const _0x9ec86d=this[_0x2b2b67(0x140)][_0x2b2b67(0x1b8)]();_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x162)+_0x9ec86d;if(_0x401f60){if(_0x2574be&&!URL[_0x2b2b67(0x172)](_0x2574be))throw new SDKError(ErrorCode[_0x2b2b67(0x165)],_0x2b2b67(0x1ae)+_0x2574be);const _0x388762=_0x2574be||getEndpoint(_0x360acc[_0x2b2b67(0x168)],_0x2b2b67(0x1d0));_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x18e);if(!_0x1a37a0['context'][_0x2b2b67(0x174)])throw new SDKError(ErrorCode[_0x2b2b67(0x165)],_0x2b2b67(0x1ac));this[_0x2b2b67(0x17c)]=new PassThroughProxyServer({'port':this[_0x2b2b67(0x170)],'llmProxyUrl':_0x388762,'apiKey':_0x1a37a0[_0x2b2b67(0x192)][_0x2b2b67(0x174)],'logger':this['logger'],'site':_0x360acc[_0x2b2b67(0x168)],'profile':_0x31caa2}),await this[_0x2b2b67(0x17c)]['start'](),_0x13ff02[_0x2b2b67(0x151)]='✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20'+this[_0x2b2b67(0x170)]+_0x2b2b67(0x19d)+_0x388762;}else{_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x179);const _0x33ace8=await _0x1a37a0[_0x2b2b67(0x1b3)][_0x2b2b67(0x1b2)](),_0x593d79=_0x33ace8['id'];_0x13ff02[_0x2b2b67(0x151)]='✓\x20Using\x20project:\x20'+_0x33ace8[_0x2b2b67(0x18f)][_0x2b2b67(0x13f)],_0x13ff02[_0x2b2b67(0x151)]='Starting\x20TD\x20LLM\x20proxy\x20server...',this[_0x2b2b67(0x157)]=new ProxyServer({'port':this[_0x2b2b67(0x170)],'projectId':_0x593d79,'tdx':_0x1a37a0,'logger':this[_0x2b2b67(0x140)],'site':_0x360acc[_0x2b2b67(0x168)]}),await this[_0x2b2b67(0x157)][_0x2b2b67(0x187)](),_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x196)+this[_0x2b2b67(0x170)];}_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x1b4),this['originalSettings']=await createClaudeSettings(this['port'],_0x51198e,_0x31caa2),_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x175);}else _0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x1c2);try{_0x13ff02['text']=_0x2b2b67(0x19a),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x2b2b67(0x140)]),_0x13ff02[_0x2b2b67(0x151)]=_0x2b2b67(0x14e);}catch(_0x19875e){_0x13ff02[_0x2b2b67(0x149)]('Claude\x20Code\x20version\x20check\x20failed');throw _0x19875e;}try{await ensureMcpServer('td-docs','https://docs.treasuredata.com/mcp',_0x2b2b67(0x13d),_0x13ff02,this[_0x2b2b67(0x140)]);}catch(_0x402455){handleInstallationError(_0x402455,_0x2b2b67(0x1aa),_0x13ff02,this['logger']);}try{await ensureMarketplace(_0x2b2b67(0x197),_0x2b2b67(0x15e),_0x13ff02,this[_0x2b2b67(0x140)]),await updateMarketplace('td-skills',_0x13ff02,this[_0x2b2b67(0x140)]),await ensurePlugin('sql-skills',_0x2b2b67(0x197),_0x13ff02,this[_0x2b2b67(0x140)]),await ensurePlugin(_0x2b2b67(0x161),'td-skills',_0x13ff02,this[_0x2b2b67(0x140)]),await ensurePlugin(_0x2b2b67(0x19c),_0x2b2b67(0x197),_0x13ff02,this[_0x2b2b67(0x140)]);}catch(_0x16c0a0){handleInstallationError(_0x16c0a0,_0x2b2b67(0x146),_0x13ff02,this['logger']);}_0x13ff02[_0x2b2b67(0x1ce)]();}catch(_0x54e879){_0x13ff02[_0x2b2b67(0x149)](_0x2b2b67(0x16a));throw _0x54e879;}const _0x24eafa=await findExecutable(_0x2b2b67(0x1b7));if(!_0x24eafa)throw new SDKError(ErrorCode[_0x2b2b67(0x1c0)],_0x2b2b67(0x15f),undefined,{'helpText':_0x2b2b67(0x14c)});const _0x133380={...process[_0x2b2b67(0x182)]};!_0x49bb2e&&(_0x133380[_0x2b2b67(0x16d)]='http://127.0.0.1:'+this[_0x2b2b67(0x170)],_0x51198e&&(_0x133380[_0x2b2b67(0x1d1)]=_0x51198e),_0x133380[_0x2b2b67(0x167)]=_0x2b2b67(0x1c9),_0x133380['CLAUDE_CODE_USE_BEDROCK']=_0x2b2b67(0x177),_0x133380[_0x2b2b67(0x15d)]=_0x2b2b67(0x177));const _0x13d61e=crossSpawn(_0x24eafa,_0x321d4b,{'stdio':_0x2b2b67(0x1a5),'env':_0x133380}),_0x193f02=await new Promise(_0x554bce=>{const _0x206b8d=_0x2b2b67;_0x13d61e['on'](_0x206b8d(0x14a),_0x2bc3af=>{_0x554bce(_0x2bc3af||0x0);}),_0x13d61e['on'](_0x206b8d(0x169),_0x5e7977=>{const _0x4be15e=_0x206b8d;console[_0x4be15e(0x169)](a9_0x131591[_0x4be15e(0x1a1)](_0x4be15e(0x18d)+_0x5e7977['message'])),_0x554bce(0x1);});});this[_0x2b2b67(0x157)]&&(await this[_0x2b2b67(0x157)][_0x2b2b67(0x1ce)](),console['log'](a9_0x131591[_0x2b2b67(0x1ba)](_0x2b2b67(0x14f))));this[_0x2b2b67(0x17c)]&&(await this['passThroughServer'][_0x2b2b67(0x1ce)](),console[_0x2b2b67(0x199)](a9_0x131591['green'](_0x2b2b67(0x148))));if(this[_0x2b2b67(0x140)]){await this['logger'][_0x2b2b67(0x1c8)]();const _0x3854a4=this[_0x2b2b67(0x140)][_0x2b2b67(0x1b8)]();console[_0x2b2b67(0x199)](a9_0x131591['green'](_0x2b2b67(0x17d)+_0x3854a4));}return this[_0x2b2b67(0x184)]&&(await restoreClaudeSettings(this['originalSettings']),console[_0x2b2b67(0x199)](a9_0x131591[_0x2b2b67(0x1ba)](_0x2b2b67(0x1a2)))),_0x193f02;}catch(_0x22a3ed){this[_0x2b2b67(0x157)]&&await this['server'][_0x2b2b67(0x1ce)]();this[_0x2b2b67(0x17c)]&&await this['passThroughServer']['stop']();this['logger']&&await this[_0x2b2b67(0x140)][_0x2b2b67(0x1c8)]();this[_0x2b2b67(0x184)]&&await restoreClaudeSettings(this[_0x2b2b67(0x184)]);throw _0x22a3ed;}}}
|