@treasuredata/tdx 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/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.d.ts +19 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +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/claude-agent/types.d.ts +26 -0
- package/dist/sdk/claude-agent/types.d.ts.map +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_0x559176=a3_0x1eb9;(function(_0x587cea,_0x1a87ae){const _0x5382ec=a3_0x1eb9,_0x5bfd0d=_0x587cea();while(!![]){try{const _0x35001a=parseInt(_0x5382ec(0x174))/0x1+parseInt(_0x5382ec(0x169))/0x2+-parseInt(_0x5382ec(0x187))/0x3+-parseInt(_0x5382ec(0x172))/0x4+parseInt(_0x5382ec(0x16d))/0x5*(-parseInt(_0x5382ec(0x180))/0x6)+parseInt(_0x5382ec(0x183))/0x7*(parseInt(_0x5382ec(0x16a))/0x8)+parseInt(_0x5382ec(0x188))/0x9;if(_0x35001a===_0x1a87ae)break;else _0x5bfd0d['push'](_0x5bfd0d['shift']());}catch(_0x2e48b0){_0x5bfd0d['push'](_0x5bfd0d['shift']());}}}(a3_0x47b9,0x35817));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a3_0x1eb9(_0x37a02b,_0x2ae4c5){_0x37a02b=_0x37a02b-0x165;const _0x47b92c=a3_0x47b9();let _0x1eb900=_0x47b92c[_0x37a02b];return _0x1eb900;}function a3_0x47b9(){const _0x3efa15=['Resolving\x20child\x20segment\x20\x27','Resolved\x20parent\x20ID:\x20','\x20activation','431852pYVjnj','\x27...','224472MBgiKn','data','error','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','segment','Site:\x20','listActivations','name','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','description','Resolving\x20parent\x20segment\x20\x27','site','1029882QDBlGf','verbose','Parent\x20name:\x20','523453GPGpSe','message','resolveParentId','List\x20activations\x20for\x20a\x20segment','731838ZXjGMa','4897746jDofgF','Error:\x20Segment\x20name\x20is\x20required','✔\x20Found\x20','length','cause','Error:\x20','141834vAYHGV','8zkErCu','activations','Resolved\x20child\x20ID:\x20','10QVRXDZ','Listing\x20activations\x20for\x20segment\x20\x27'];a3_0x47b9=function(){return _0x3efa15;};return a3_0x47b9();}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x559176(0x17b)]=a3_0x559176(0x16b);[a3_0x559176(0x17d)]=a3_0x559176(0x186);async['execute'](_0x19f25b){const _0xd8a562=a3_0x559176,{options:_0x55fb13,args:_0x12ef15,tdx:_0x1b8f51}=_0x19f25b;if(_0x12ef15['length']===0x0)return console[_0xd8a562(0x176)](_0xd8a562(0x189)),console[_0xd8a562(0x176)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x558582,childId:_0x37cf07}=parseSegmentRef(_0x12ef15[0x0]);if(!_0x37cf07)return console[_0xd8a562(0x176)](_0xd8a562(0x177)),console[_0xd8a562(0x176)](_0xd8a562(0x17c)),0x1;_0x55fb13[_0xd8a562(0x181)]&&(console[_0xd8a562(0x176)](_0xd8a562(0x179)+_0x55fb13[_0xd8a562(0x17f)]),console[_0xd8a562(0x176)](_0xd8a562(0x182)+_0x558582),console[_0xd8a562(0x176)]('Child\x20name:\x20'+_0x37cf07));const _0x448a4e=await withSpinner(_0xd8a562(0x17e)+_0x558582+_0xd8a562(0x173),()=>_0x1b8f51[_0xd8a562(0x178)][_0xd8a562(0x185)](_0x558582),{'verbose':_0x55fb13[_0xd8a562(0x181)]}),_0x4ee690=_0x448a4e['data'];_0x55fb13['verbose']&&console[_0xd8a562(0x176)](_0xd8a562(0x170)+_0x4ee690);const _0x26b587=await withSpinner(_0xd8a562(0x16f)+_0x37cf07+_0xd8a562(0x173),()=>_0x1b8f51['segment']['resolveSegmentId'](_0x4ee690,_0x37cf07),{'verbose':_0x55fb13[_0xd8a562(0x181)]}),_0x14b07c=_0x26b587['data'];_0x55fb13[_0xd8a562(0x181)]&&console[_0xd8a562(0x176)](_0xd8a562(0x16c)+_0x14b07c);const _0x32e03a=await withSpinner(_0xd8a562(0x16e)+_0x37cf07+_0xd8a562(0x173),()=>_0x1b8f51[_0xd8a562(0x178)][_0xd8a562(0x17a)](_0x4ee690,_0x14b07c),{'verbose':_0x55fb13['verbose']}),_0x163567=_0x32e03a[_0xd8a562(0x175)];return console[_0xd8a562(0x176)](_0xd8a562(0x165)+_0x163567[_0xd8a562(0x166)]+_0xd8a562(0x171)+(_0x163567[_0xd8a562(0x166)]!==0x1?'s':'')),await handleSDKOutput(_0x163567,_0x55fb13),0x0;}catch(_0x56ce7f){if(_0x56ce7f instanceof SDKError)return console[_0xd8a562(0x176)](_0xd8a562(0x168)+_0x56ce7f[_0xd8a562(0x184)]),_0x56ce7f[_0xd8a562(0x167)]&&console[_0xd8a562(0x176)]('\x20\x20Cause:\x20'+_0x56ce7f[_0xd8a562(0x167)]),0x1;throw _0x56ce7f;}}}
|
|
@@ -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_0x32ac60=a4_0x2e2d;(function(_0x427d8f,_0x4c1067){const _0x2c6f3b=a4_0x2e2d,_0x54825c=_0x427d8f();while(!![]){try{const _0x4d954a=-parseInt(_0x2c6f3b(0x22f))/0x1+parseInt(_0x2c6f3b(0x291))/0x2*(parseInt(_0x2c6f3b(0x294))/0x3)+parseInt(_0x2c6f3b(0x242))/0x4+parseInt(_0x2c6f3b(0x28c))/0x5*(parseInt(_0x2c6f3b(0x1f3))/0x6)+parseInt(_0x2c6f3b(0x237))/0x7*(-parseInt(_0x2c6f3b(0x23e))/0x8)+-parseInt(_0x2c6f3b(0x207))/0x9*(parseInt(_0x2c6f3b(0x236))/0xa)+parseInt(_0x2c6f3b(0x205))/0xb;if(_0x4d954a===_0x4c1067)break;else _0x54825c['push'](_0x54825c['shift']());}catch(_0x3ed4c6){_0x54825c['push'](_0x54825c['shift']());}}}(a4_0x33f3,0x29ad7));import a4_0x34cdce from'chalk';import a4_0x23e823 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';function a4_0x33f3(){const _0x3e6f82=['Source:\x20','\x0aPush\x20','MISSING_ARGUMENT','errors','✔\x20Context\x20set:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','Cannot\x20clone\x20from\x20context\x20project\x20\x22','description','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','name','cwd','\x20resources?','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','334895shBFjs','Output:\x20','llm','pushAgent','\x20\x20tdx\x20agent\x20pull\x20','<new-name>','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','152890wUXXcc','662935bMUCJZ','\x0aChanges\x20to\x20prompt\x20\x27','textKnowledgeBases','\x20successfully','agentName','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20changed','8gTNNKv','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','agent:pull','repeat','565192mOaILR','Errors:','\x20\x20Knowledge\x20Bases:\x20','hasChanges','\x20files\x20to\x20','Pushing\x20agent\x20from\x20\x22','dim','diff','Cloning\x20\x22','unchanged','Writing\x20files...','INVALID_ARGUMENT','\x20files?','utf-8','join','pullProject','\x22\x20to\x20a\x20different\x20profile','\x20\x20Source:\x20','\x20\x20Agent\x20\x22','Agent\x20','tdx.json','projectId','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','Dry\x20run\x20-\x20no\x20changes\x20made','knowledgeBases','\x0aWrite\x20','\x22\x20to\x20new\x20project\x20\x22','\x22\x20to\x20\x22','Pulling\x20agent\x20\x22','Agent\x20pulled\x20successfully','newProjectName','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Clone\x20\x22','Pull\x20cancelled','pushProject','\x22:\x20','\x20\x20Knowledge\x20Base\x20\x22','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)','message','agent.yml','Analyzing\x20changes\x20to\x20push...','counts','Agent:\x20','reason','\x20\x20tdx\x20agent\x20clone\x20agents/','profile','new','dryRun','Using\x20project:\x20','\x20\x20Prompts:\x20','Using\x20local\x20project:\x20','\x20=\x20','Pushing\x20to\x20project...','outputDir','\x20created','llmProject','output','\x0a✔\x20Pushed\x20','source','Failed\x20to\x20push\x20agent:\x20','projectDir','\x20--name\x20','no_local_folder','Status:\x20','created','execute','\x20|\x20','outputPath','session','error','updated','\x0a✔\x20Pulled\x20','\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)','yellow','55vPWILT','\x22...','\x20\x20Text\x20Knowledge\x20Bases:\x20','context','\x20\x20Prompt\x20\x22','2150qOcHjf','push','\x0aPull\x20summary\x20for\x20\x27','75DeSqhE','Using\x20project\x20from\x20','Using\x20context\x20project:\x20','green','\x20\x20Agents:\x20','Clone\x20cancelled','Using\x20current\x20project:\x20','\x20new','125832cuJgwq','cyan','yes','action','\x0aChanges:','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','\x0aChanges\x20to\x20agent\x20\x27','\x27\x20to\x20create\x20the\x20folder\x20structure.','\x20unchanged','\x20--profile\x20','prompts','agentId','Would\x20clone:','New\x20project\x20ID:\x20','Project:\x20','agents','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','2552264ZhyFUt','Project\x20cloned\x20with\x20errors','18YKeLBL','\x22\x20from\x20project\x20\x22','Dry\x20run\x20-\x20no\x20files\x20written','\x20resources\x20to\x20\x27','sourceProjectName','Output\x20path:\x20','no_context','force','llm_project','\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','gray','log','newProjectId','Push\x20cancelled','\x20total','total','\x20errors','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','Project\x20cloned\x20successfully','Would\x20pull\x20agent:\x20','red','projectName','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','isNew','No\x20tdx.json\x20found\x20in\x20','Would\x20push\x20agent:\x20','parse'];a4_0x33f3=function(){return _0x3e6f82;};return a4_0x33f3();}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';function a4_0x2e2d(_0xdffb1b,_0x26113e){_0xdffb1b=_0xdffb1b-0x1f1;const _0x33f332=a4_0x33f3();let _0x2e2d23=_0x33f332[_0xdffb1b];return _0x2e2d23;}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x4ad6c9){const _0x25a93d=a4_0x2e2d,_0x107540=[];if(_0x4ad6c9[_0x25a93d(0x216)]!==undefined)_0x107540[_0x25a93d(0x292)](_0x4ad6c9[_0x25a93d(0x216)]+_0x25a93d(0x215));if(_0x4ad6c9[_0x25a93d(0x270)]!==undefined&&_0x4ad6c9[_0x25a93d(0x270)]>0x0)_0x107540[_0x25a93d(0x292)](a4_0x34cdce[_0x25a93d(0x297)](_0x4ad6c9[_0x25a93d(0x270)]+'\x20new'));if(_0x4ad6c9[_0x25a93d(0x282)]!==undefined&&_0x4ad6c9[_0x25a93d(0x282)]>0x0)_0x107540['push'](a4_0x34cdce[_0x25a93d(0x297)](_0x4ad6c9[_0x25a93d(0x282)]+_0x25a93d(0x278)));if(_0x4ad6c9[_0x25a93d(0x288)]!==undefined&&_0x4ad6c9[_0x25a93d(0x288)]>0x0)_0x107540[_0x25a93d(0x292)](a4_0x34cdce['yellow'](_0x4ad6c9[_0x25a93d(0x288)]+'\x20updated'));if(_0x4ad6c9[_0x25a93d(0x24b)]!==undefined&&_0x4ad6c9['unchanged']>0x0)_0x107540[_0x25a93d(0x292)](a4_0x34cdce[_0x25a93d(0x211)](_0x4ad6c9[_0x25a93d(0x24b)]+_0x25a93d(0x1fc)));if(_0x4ad6c9[_0x25a93d(0x225)]!==undefined&&_0x4ad6c9[_0x25a93d(0x225)]>0x0)_0x107540[_0x25a93d(0x292)](a4_0x34cdce[_0x25a93d(0x21b)](_0x4ad6c9['errors']+_0x25a93d(0x217)));return _0x107540[_0x25a93d(0x250)](',\x20');}function displayDiffs(_0x3caae3,_0x2758bd,_0xc3bc7f,_0x3db6e6){const _0xcc195a=a4_0x2e2d;for(const _0x4205d5 of _0x3caae3){if(_0x4205d5['diff']){const _0xc8efb2=_0x4205d5['agentName']||_0x4205d5['name'];console[_0xcc195a(0x212)](_0xcc195a(0x1fa)+_0xc8efb2+'\x27:'),console['log']('─'['repeat'](0x3c)),console[_0xcc195a(0x212)](_0x4205d5['diff']),console[_0xcc195a(0x212)]('─'[_0xcc195a(0x241)](0x3c));}}for(const _0x208d56 of _0x2758bd){_0x208d56[_0xcc195a(0x249)]&&(console[_0xcc195a(0x212)](_0xcc195a(0x23f)+_0x208d56[_0xcc195a(0x22b)]+'\x27:'),console[_0xcc195a(0x212)]('─'[_0xcc195a(0x241)](0x3c)),console[_0xcc195a(0x212)](_0x208d56[_0xcc195a(0x249)]),console[_0xcc195a(0x212)]('─'['repeat'](0x3c)));}for(const _0xb66ebf of _0xc3bc7f){_0xb66ebf[_0xcc195a(0x249)]&&(console['log']('\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27'+_0xb66ebf[_0xcc195a(0x22b)]+'\x27:'),console[_0xcc195a(0x212)]('─'[_0xcc195a(0x241)](0x3c)),console[_0xcc195a(0x212)](_0xb66ebf[_0xcc195a(0x249)]),console[_0xcc195a(0x212)]('─'[_0xcc195a(0x241)](0x3c)));}for(const _0xbbab14 of _0x3db6e6){_0xbbab14['diff']&&(console[_0xcc195a(0x212)](_0xcc195a(0x238)+_0xbbab14[_0xcc195a(0x22b)]+'\x27:'),console['log']('─'[_0xcc195a(0x241)](0x3c)),console[_0xcc195a(0x212)](_0xbbab14[_0xcc195a(0x249)]),console[_0xcc195a(0x212)]('─'[_0xcc195a(0x241)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x32ac60(0x22b)]=a4_0x32ac60(0x240);[a4_0x32ac60(0x229)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0x32ac60(0x283)](_0x5f5393){const _0x5c0384=a4_0x32ac60,{options:_0x231f8e,args:_0x5e2bde,tdx:_0x350035}=_0x5f5393,_0xa31f47=_0x5e2bde[0x0],_0x225387=_0x5e2bde[0x1],_0x2e4c43=_0x231f8e[_0x5c0384(0x27a)],_0x4b17e0=_0x231f8e[_0x5c0384(0x271)],_0x2e2077=_0x231f8e[_0x5c0384(0x20e)],_0x409dff=_0x231f8e[_0x5c0384(0x1f5)],_0x2ed664=_0x231f8e[_0x5c0384(0x279)];let _0x2452eb,_0xbc1141;const _0x2496fd=findAgentConfigPath(process[_0x5c0384(0x22c)]());if(_0xa31f47){const _0x4950f8=a4_0x23e823[_0x5c0384(0x250)](_0xa31f47,_0x5c0384(0x256));if(existsSync(_0x4950f8))try{const _0x4294e8=JSON[_0x5c0384(0x221)](readFileSync(_0x4950f8,'utf-8'));_0x2452eb=_0x4294e8[_0x5c0384(0x20f)],_0xbc1141=_0xa31f47,console[_0x5c0384(0x212)](a4_0x34cdce[_0x5c0384(0x248)](_0x5c0384(0x295)+_0x4950f8+':\x20'+_0x2452eb));}catch{_0x2452eb=_0xa31f47;}else _0x2452eb=_0xa31f47;}else{if(_0x2496fd)try{const _0x301a0d=JSON[_0x5c0384(0x221)](readFileSync(_0x2496fd,_0x5c0384(0x24f)));_0x2452eb=_0x301a0d[_0x5c0384(0x20f)],_0xbc1141=a4_0x23e823['dirname'](_0x2496fd),console['log'](a4_0x34cdce['dim'](_0x5c0384(0x272)+_0x2452eb));}catch{_0x2452eb=_0x2ed664;}else _0x2452eb=_0x2ed664;}if(!_0x2452eb)return console[_0x5c0384(0x212)](a4_0x34cdce[_0x5c0384(0x28b)](_0x5c0384(0x235))),console[_0x5c0384(0x212)](_0x5c0384(0x267)),console[_0x5c0384(0x212)](_0x5c0384(0x210)),console['log']('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory'),console['log'](_0x5c0384(0x258)),0x1;if(_0x225387){const {data:_0x8d52df}=await withSpinner(_0x5c0384(0x25e)+_0x225387+_0x5c0384(0x208)+_0x2452eb+_0x5c0384(0x28d),()=>_0x350035['llm']['pullAgent'](_0x2452eb,_0x225387,_0x2e4c43,{'dryRun':_0x4b17e0,'force':_0x2e2077}));if(_0x4b17e0)return console[_0x5c0384(0x212)](a4_0x34cdce[_0x5c0384(0x28b)](_0x5c0384(0x209))),console['log'](_0x5c0384(0x21a)+_0x8d52df[_0x5c0384(0x23b)]),console[_0x5c0384(0x212)](_0x5c0384(0x20c)+_0x8d52df[_0x5c0384(0x285)]),_0x8d52df[_0x5c0384(0x249)]&&(console['log'](_0x5c0384(0x1f7)),console['log']('─'['repeat'](0x3c)),console[_0x5c0384(0x212)](_0x8d52df[_0x5c0384(0x249)]),console[_0x5c0384(0x212)]('─'[_0x5c0384(0x241)](0x3c))),0x0;return console[_0x5c0384(0x212)](a4_0x34cdce[_0x5c0384(0x297)](_0x5c0384(0x25f))),console[_0x5c0384(0x212)](_0x5c0384(0x26c)+_0x8d52df[_0x5c0384(0x23b)]),console[_0x5c0384(0x212)](_0x5c0384(0x230)+_0x8d52df[_0x5c0384(0x285)]),console[_0x5c0384(0x212)](_0x5c0384(0x281)+(_0x8d52df[_0x5c0384(0x21e)]?a4_0x34cdce[_0x5c0384(0x297)](_0x5c0384(0x270)):_0x8d52df[_0x5c0384(0x245)]?a4_0x34cdce[_0x5c0384(0x28b)](_0x5c0384(0x288)):a4_0x34cdce[_0x5c0384(0x211)]('unchanged'))),0x0;}const _0x208fe7=_0xbc1141||_0x2e4c43,{data:_0x432dcd}=await withSpinner('Analyzing\x20project\x20\x22'+_0x2452eb+_0x5c0384(0x28d),()=>_0x350035[_0x5c0384(0x231)]['pullProject'](_0x2452eb,_0x208fe7,{'dryRun':!![]})),_0x3c3aab=_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x203)][_0x5c0384(0x270)]+_0x432dcd['counts'][_0x5c0384(0x25a)][_0x5c0384(0x270)]+_0x432dcd['counts'][_0x5c0384(0x239)][_0x5c0384(0x270)]+_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x1fe)][_0x5c0384(0x270)],_0x258aeb=_0x432dcd['counts'][_0x5c0384(0x203)][_0x5c0384(0x288)]+_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x25a)][_0x5c0384(0x288)]+_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x239)][_0x5c0384(0x288)]+_0x432dcd[_0x5c0384(0x26b)]['prompts']['updated'],_0x4c093d=_0x432dcd['counts'][_0x5c0384(0x203)][_0x5c0384(0x24b)]+_0x432dcd[_0x5c0384(0x26b)]['knowledgeBases'][_0x5c0384(0x24b)]+_0x432dcd['counts'][_0x5c0384(0x239)]['unchanged']+_0x432dcd['counts'][_0x5c0384(0x1fe)][_0x5c0384(0x24b)];console[_0x5c0384(0x212)](_0x5c0384(0x293)+_0x432dcd[_0x5c0384(0x21c)]+'\x27:'),console[_0x5c0384(0x212)]('\x20\x20'+a4_0x34cdce[_0x5c0384(0x297)]('+\x20'+_0x3c3aab+_0x5c0384(0x1f2))+_0x5c0384(0x284)+a4_0x34cdce[_0x5c0384(0x28b)]('~\x20'+_0x258aeb+_0x5c0384(0x23d))+_0x5c0384(0x284)+a4_0x34cdce[_0x5c0384(0x248)]('=\x20'+_0x4c093d+_0x5c0384(0x1fc))),console[_0x5c0384(0x212)](_0x5c0384(0x298)+formatCountSummary(_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x203)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x25a)])),console[_0x5c0384(0x212)](_0x5c0384(0x28e)+formatCountSummary(_0x432dcd[_0x5c0384(0x26b)]['textKnowledgeBases'])),console[_0x5c0384(0x212)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x432dcd[_0x5c0384(0x26b)][_0x5c0384(0x1fe)])),console[_0x5c0384(0x212)]('\x20\x20Target:\x20'+a4_0x34cdce['cyan'](_0x432dcd[_0x5c0384(0x277)])),displayDiffs(_0x432dcd[_0x5c0384(0x203)],_0x432dcd['knowledgeBases'],_0x432dcd[_0x5c0384(0x239)],_0x432dcd['prompts']);if(_0x4b17e0)return console[_0x5c0384(0x212)](a4_0x34cdce['yellow'](_0x5c0384(0x21d))),0x0;if(_0x3c3aab===0x0&&_0x258aeb===0x0)return console[_0x5c0384(0x212)](a4_0x34cdce[_0x5c0384(0x297)](_0x5c0384(0x227))),saveSessionContext({'llm_project':_0x432dcd[_0x5c0384(0x21c)]},_0x231f8e['session']),console[_0x5c0384(0x212)](a4_0x34cdce['green'](_0x5c0384(0x226)+a4_0x34cdce[_0x5c0384(0x248)]('llm_project')+_0x5c0384(0x275)+a4_0x34cdce[_0x5c0384(0x1f4)](_0x432dcd[_0x5c0384(0x21c)]))),0x0;if(!_0x409dff&&!_0x2e2077){const _0x553eb9=await confirmKey(_0x5c0384(0x25b)+(_0x3c3aab+_0x258aeb)+_0x5c0384(0x24e));if(!_0x553eb9)return console['log'](_0x5c0384(0x263)),0x0;}const {data:_0x18e5fb}=await withSpinner(_0x5c0384(0x24c),()=>_0x350035[_0x5c0384(0x231)][_0x5c0384(0x251)](_0x2452eb,_0x208fe7,{'force':_0x2e2077}));return console[_0x5c0384(0x212)](a4_0x34cdce['green'](_0x5c0384(0x289)+(_0x3c3aab+_0x258aeb)+_0x5c0384(0x246)+_0x18e5fb['outputDir'])),saveSessionContext({'llm_project':_0x18e5fb[_0x5c0384(0x21c)]},_0x231f8e[_0x5c0384(0x286)]),console[_0x5c0384(0x212)](a4_0x34cdce[_0x5c0384(0x297)](_0x5c0384(0x226)+a4_0x34cdce[_0x5c0384(0x248)](_0x5c0384(0x20f))+_0x5c0384(0x275)+a4_0x34cdce[_0x5c0384(0x1f4)](_0x18e5fb[_0x5c0384(0x21c)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x32ac60(0x22b)]='agent:clone';[a4_0x32ac60(0x229)]=a4_0x32ac60(0x218);async[a4_0x32ac60(0x283)](_0x46d823){const _0x27fec5=a4_0x32ac60,{options:_0x253154,args:_0x1fdecd,tdx:_0x118825}=_0x46d823,_0x3150a7=_0x1fdecd[0x0],_0x33d164=_0x253154[_0x27fec5(0x22b)],_0x84a4f4=_0x253154[_0x27fec5(0x271)],_0x4cd219=_0x253154[_0x27fec5(0x1f5)],_0x5ee890=_0x253154['site'],_0x12615a=_0x253154[_0x27fec5(0x279)];let _0x5289b5;const _0x5bb17a=findAgentConfigPath(process['cwd']());if(_0x3150a7){const _0x172429=a4_0x23e823[_0x27fec5(0x250)](_0x3150a7,_0x27fec5(0x256));existsSync(_0x172429)?(_0x5289b5=_0x3150a7,console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x248)](_0x27fec5(0x274)+_0x3150a7))):_0x5289b5=_0x3150a7;}else{if(_0x5bb17a)_0x5289b5=a4_0x23e823['dirname'](_0x5bb17a),console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x248)](_0x27fec5(0x1f1)+_0x5289b5));else{if(_0x12615a){const _0x42f650=sanitizeForFilesystem(_0x12615a);let _0x462aab=_0x42f650,_0x980a20=a4_0x23e823[_0x27fec5(0x250)](process['cwd'](),'agents',_0x42f650,'tdx.json');if(!existsSync(_0x980a20)){const _0xf89f48=normalizeName(_0x12615a),_0x5cf372=a4_0x23e823[_0x27fec5(0x250)](process[_0x27fec5(0x22c)](),_0x27fec5(0x203),_0xf89f48,_0x27fec5(0x256));existsSync(_0x5cf372)&&(_0x462aab=_0xf89f48,_0x980a20=_0x5cf372);}if(existsSync(_0x980a20))_0x5289b5=a4_0x23e823['dirname'](_0x980a20),console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x248)]('Using\x20local\x20project:\x20'+_0x5289b5));else{const _0x260dce=_0x253154[_0x27fec5(0x26f)];if(_0x260dce)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x27fec5(0x228)+_0x12615a+_0x27fec5(0x252),undefined,{'helpText':_0x27fec5(0x22a)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x27fec5(0x233)+_0x12615a+'\x0a')+(_0x27fec5(0x26e)+_0x462aab+_0x27fec5(0x27f)+(_0x33d164||_0x27fec5(0x234))+_0x27fec5(0x1fd)+_0x260dce)});_0x5289b5=_0x12615a,console['log'](a4_0x34cdce[_0x27fec5(0x248)](_0x27fec5(0x296)+_0x12615a));}}}}if(!_0x5289b5)return console['log'](a4_0x34cdce[_0x27fec5(0x28b)](_0x27fec5(0x23c))),console[_0x27fec5(0x212)](_0x27fec5(0x204)),console[_0x27fec5(0x212)]('\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory'),console[_0x27fec5(0x212)](_0x27fec5(0x28a)),console[_0x27fec5(0x212)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x33d164)throw new SDKError(ErrorCode[_0x27fec5(0x224)],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x4cd219&&!_0x84a4f4){const _0x3de430=await confirmKey(_0x27fec5(0x262)+_0x5289b5+_0x27fec5(0x25c)+_0x33d164+'\x22?');if(!_0x3de430)return console[_0x27fec5(0x212)](_0x27fec5(0x299)),0x0;}const {data:_0x13abbf}=await withSpinner(_0x27fec5(0x24a)+_0x5289b5+_0x27fec5(0x25d)+_0x33d164+_0x27fec5(0x28d),()=>_0x118825['llm']['cloneProject'](_0x5289b5,_0x33d164,{'dryRun':_0x84a4f4}));if(_0x84a4f4)return console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x28b)](_0x27fec5(0x259))),console[_0x27fec5(0x212)]('Source:\x20'+_0x13abbf[_0x27fec5(0x20b)]),console[_0x27fec5(0x212)]('New\x20project:\x20'+_0x33d164),console[_0x27fec5(0x212)](_0x27fec5(0x200)),console[_0x27fec5(0x212)]('\x20\x20Agents:\x20'+_0x13abbf['counts'][_0x27fec5(0x203)]['created']),console['log'](_0x27fec5(0x244)+_0x13abbf[_0x27fec5(0x26b)][_0x27fec5(0x25a)][_0x27fec5(0x282)]),console[_0x27fec5(0x212)]('\x20\x20Prompts:\x20'+_0x13abbf[_0x27fec5(0x26b)]['prompts'][_0x27fec5(0x282)]),0x0;const _0x5eea53=_0x13abbf[_0x27fec5(0x26b)][_0x27fec5(0x203)][_0x27fec5(0x225)]>0x0||_0x13abbf[_0x27fec5(0x26b)][_0x27fec5(0x25a)][_0x27fec5(0x225)]>0x0||_0x13abbf[_0x27fec5(0x26b)][_0x27fec5(0x1fe)][_0x27fec5(0x225)]>0x0;_0x5eea53?console[_0x27fec5(0x212)](a4_0x34cdce['yellow'](_0x27fec5(0x206))):console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x297)](_0x27fec5(0x219)));console[_0x27fec5(0x212)](_0x27fec5(0x222)+_0x13abbf['sourceProjectName']),console[_0x27fec5(0x212)]('New\x20project:\x20'+_0x13abbf[_0x27fec5(0x260)]),console[_0x27fec5(0x212)](_0x27fec5(0x201)+_0x13abbf['newProjectId']),console[_0x27fec5(0x212)](),console[_0x27fec5(0x212)]('Summary:'),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x13abbf[_0x27fec5(0x26b)][_0x27fec5(0x203)])),console['log'](_0x27fec5(0x244)+formatCountSummary(_0x13abbf['counts'][_0x27fec5(0x25a)])),console[_0x27fec5(0x212)](_0x27fec5(0x273)+formatCountSummary(_0x13abbf[_0x27fec5(0x26b)][_0x27fec5(0x1fe)]));if(_0x5eea53){console['log'](),console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x21b)](_0x27fec5(0x243)));for(const _0x2e6e0a of _0x13abbf[_0x27fec5(0x203)]){_0x2e6e0a[_0x27fec5(0x1f6)]===_0x27fec5(0x287)&&console[_0x27fec5(0x212)](a4_0x34cdce['red']('\x20\x20Agent\x20\x22'+_0x2e6e0a[_0x27fec5(0x23b)]+_0x27fec5(0x265)+_0x2e6e0a[_0x27fec5(0x287)]));}for(const _0x40f42c of _0x13abbf[_0x27fec5(0x25a)]){_0x40f42c[_0x27fec5(0x1f6)]===_0x27fec5(0x287)&&console[_0x27fec5(0x212)](a4_0x34cdce[_0x27fec5(0x21b)](_0x27fec5(0x266)+_0x40f42c[_0x27fec5(0x22b)]+_0x27fec5(0x265)+_0x40f42c[_0x27fec5(0x287)]));}for(const _0x42fa6c of _0x13abbf[_0x27fec5(0x1fe)]){_0x42fa6c[_0x27fec5(0x1f6)]===_0x27fec5(0x287)&&console['log'](a4_0x34cdce[_0x27fec5(0x21b)](_0x27fec5(0x290)+_0x42fa6c[_0x27fec5(0x22b)]+_0x27fec5(0x265)+_0x42fa6c[_0x27fec5(0x287)]));}return 0x1;}console[_0x27fec5(0x212)]();const _0x2dd71e=getLLMProjectUrl(_0x5ee890,_0x13abbf[_0x27fec5(0x213)]);return console[_0x27fec5(0x212)](_0x27fec5(0x202)+a4_0x34cdce[_0x27fec5(0x1f4)](_0x2dd71e)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x32ac60(0x22b)]='agent:push';[a4_0x32ac60(0x229)]=a4_0x32ac60(0x261);async[a4_0x32ac60(0x283)](_0x299381){const _0x5a5fd4=a4_0x32ac60,{options:_0x16b71c,args:_0x50352e,tdx:_0x293393}=_0x299381;let _0x5280dc=_0x50352e[0x0]||process['cwd']();const _0x7263fb=_0x16b71c[_0x5a5fd4(0x271)],_0x4a680c=_0x16b71c[_0x5a5fd4(0x20e)],_0x477296=_0x16b71c[_0x5a5fd4(0x1f5)],_0x5e3637=_0x16b71c['site'],_0x2343a3=a4_0x23e823[_0x5a5fd4(0x250)](_0x5280dc,_0x5a5fd4(0x269)),_0x3c5ce1=existsSync(_0x2343a3);if(_0x3c5ce1){const {data:_0x50a973}=await withSpinner(_0x5a5fd4(0x247)+_0x5280dc+'\x22...',()=>_0x293393['llm'][_0x5a5fd4(0x232)](_0x5280dc,{'dryRun':_0x7263fb,'force':_0x4a680c}));if(_0x7263fb)return console['log'](a4_0x34cdce[_0x5a5fd4(0x28b)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x220)+_0x50a973['agentName']),0x0;if(_0x50a973[_0x5a5fd4(0x1f6)]==='error')return console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x21b)](_0x5a5fd4(0x27d)+_0x50a973['error'])),0x1;console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x297)](_0x5a5fd4(0x255)+_0x50a973[_0x5a5fd4(0x1f6)]+_0x5a5fd4(0x23a))),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x26c)+_0x50a973['agentName']);if(_0x50a973[_0x5a5fd4(0x1ff)]&&_0x50a973['projectId']){const _0x594cb2=getLLMAgentChatUrl(_0x5e3637,_0x50a973[_0x5a5fd4(0x257)],_0x50a973[_0x5a5fd4(0x1ff)]);console[_0x5a5fd4(0x212)]('Chat:\x20'+a4_0x34cdce[_0x5a5fd4(0x1f4)](_0x594cb2));}return 0x0;}const _0x23b607=_0x16b71c[_0x5a5fd4(0x279)],_0x2a0c94=resolveProjectFromContext(_0x5280dc,_0x23b607);if(_0x2a0c94['found'])_0x5280dc=_0x2a0c94[_0x5a5fd4(0x27e)],_0x2a0c94[_0x5a5fd4(0x27c)]===_0x5a5fd4(0x28f)&&console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x248)](_0x5a5fd4(0x272)+_0x5280dc));else{let _0x3fbd50=_0x5a5fd4(0x1f8);_0x2a0c94[_0x5a5fd4(0x26d)]===_0x5a5fd4(0x280)&&(_0x3fbd50=_0x2a0c94[_0x5a5fd4(0x268)]+_0x5a5fd4(0x1f9)+_0x2a0c94['llmProject']+_0x5a5fd4(0x1fb));throw new SDKError(ErrorCode[_0x5a5fd4(0x24d)],_0x2a0c94[_0x5a5fd4(0x26d)]===_0x5a5fd4(0x20d)?_0x2a0c94[_0x5a5fd4(0x268)]:_0x5a5fd4(0x21f)+_0x5280dc,undefined,{'helpText':_0x3fbd50});}const {data:_0x46a19d}=await withSpinner(_0x5a5fd4(0x26a),()=>_0x293393[_0x5a5fd4(0x231)][_0x5a5fd4(0x264)](_0x5280dc,{'dryRun':!![]})),_0x246785=_0x46a19d[_0x5a5fd4(0x26b)]['agents']['errors']>0x0;if(_0x246785){console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x21b)]('\x0aErrors\x20found:'));for(const _0x77c205 of _0x46a19d[_0x5a5fd4(0x203)]){_0x77c205[_0x5a5fd4(0x1f6)]===_0x5a5fd4(0x287)&&console['log'](a4_0x34cdce[_0x5a5fd4(0x21b)](_0x5a5fd4(0x254)+_0x77c205['agentName']+_0x5a5fd4(0x265)+_0x77c205[_0x5a5fd4(0x287)]));}return 0x1;}const _0x26eda2=_0x46a19d['counts'][_0x5a5fd4(0x203)]['created']+_0x46a19d['counts'][_0x5a5fd4(0x25a)]['created']+_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x239)][_0x5a5fd4(0x282)]+_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x1fe)][_0x5a5fd4(0x282)],_0x2b9bc6=_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x203)]['updated']+_0x46a19d[_0x5a5fd4(0x26b)]['knowledgeBases'][_0x5a5fd4(0x288)]+_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x239)]['updated']+_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x1fe)][_0x5a5fd4(0x288)],_0x3204f4=_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x203)][_0x5a5fd4(0x24b)]+_0x46a19d['counts']['knowledgeBases'][_0x5a5fd4(0x24b)]+_0x46a19d['counts']['textKnowledgeBases'][_0x5a5fd4(0x24b)]+_0x46a19d['counts']['prompts'][_0x5a5fd4(0x24b)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x46a19d[_0x5a5fd4(0x21c)]+'\x27:'),console[_0x5a5fd4(0x212)]('\x20\x20'+a4_0x34cdce[_0x5a5fd4(0x297)]('+\x20'+_0x26eda2+_0x5a5fd4(0x1f2))+_0x5a5fd4(0x284)+a4_0x34cdce[_0x5a5fd4(0x28b)]('~\x20'+_0x2b9bc6+_0x5a5fd4(0x23d))+_0x5a5fd4(0x284)+a4_0x34cdce[_0x5a5fd4(0x248)]('=\x20'+_0x3204f4+'\x20unchanged')),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x298)+formatCountSummary(_0x46a19d['counts'][_0x5a5fd4(0x203)])),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x244)+formatCountSummary(_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x25a)])),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x28e)+formatCountSummary(_0x46a19d['counts']['textKnowledgeBases'])),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x273)+formatCountSummary(_0x46a19d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x1fe)])),console[_0x5a5fd4(0x212)](_0x5a5fd4(0x253)+a4_0x34cdce[_0x5a5fd4(0x1f4)](_0x5280dc)),displayDiffs(_0x46a19d[_0x5a5fd4(0x203)],_0x46a19d['knowledgeBases'],_0x46a19d[_0x5a5fd4(0x239)],_0x46a19d[_0x5a5fd4(0x1fe)]);if(_0x7263fb)return console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x28b)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x26eda2===0x0&&_0x2b9bc6===0x0){console[_0x5a5fd4(0x212)](a4_0x34cdce['green'](_0x5a5fd4(0x22e)));const _0x5ca32f=getLLMProjectUrl(_0x5e3637,_0x46a19d[_0x5a5fd4(0x257)]);return console['log'](_0x5a5fd4(0x202)+a4_0x34cdce[_0x5a5fd4(0x1f4)](_0x5ca32f)),0x0;}if(!_0x477296&&!_0x4a680c){const _0x3a6a68=await confirmKey(_0x5a5fd4(0x223)+(_0x26eda2+_0x2b9bc6)+_0x5a5fd4(0x22d));if(!_0x3a6a68)return console[_0x5a5fd4(0x212)](_0x5a5fd4(0x214)),0x0;}const {data:_0x5ed79d}=await withSpinner(_0x5a5fd4(0x276),()=>_0x293393[_0x5a5fd4(0x231)][_0x5a5fd4(0x264)](_0x5280dc,{'force':_0x4a680c})),_0xbceb3b=_0x5ed79d['counts'][_0x5a5fd4(0x203)]['errors']>0x0||_0x5ed79d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x25a)][_0x5a5fd4(0x225)]>0x0||_0x5ed79d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x239)][_0x5a5fd4(0x225)]>0x0||_0x5ed79d[_0x5a5fd4(0x26b)][_0x5a5fd4(0x1fe)]['errors']>0x0;if(_0xbceb3b){console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x28b)]('\x0aProject\x20pushed\x20with\x20errors')),console[_0x5a5fd4(0x212)](),console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x21b)](_0x5a5fd4(0x243)));for(const _0x23f7e7 of _0x5ed79d[_0x5a5fd4(0x203)]){_0x23f7e7[_0x5a5fd4(0x1f6)]===_0x5a5fd4(0x287)&&console[_0x5a5fd4(0x212)](a4_0x34cdce['red'](_0x5a5fd4(0x254)+_0x23f7e7[_0x5a5fd4(0x23b)]+'\x22:\x20'+_0x23f7e7[_0x5a5fd4(0x287)]));}for(const _0x587883 of _0x5ed79d[_0x5a5fd4(0x25a)]){_0x587883[_0x5a5fd4(0x1f6)]===_0x5a5fd4(0x287)&&console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x21b)](_0x5a5fd4(0x266)+_0x587883[_0x5a5fd4(0x22b)]+_0x5a5fd4(0x265)+_0x587883[_0x5a5fd4(0x287)]));}for(const _0x434a5f of _0x5ed79d['textKnowledgeBases']){_0x434a5f[_0x5a5fd4(0x1f6)]===_0x5a5fd4(0x287)&&console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x21b)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x434a5f[_0x5a5fd4(0x22b)]+_0x5a5fd4(0x265)+_0x434a5f[_0x5a5fd4(0x287)]));}for(const _0x363b20 of _0x5ed79d[_0x5a5fd4(0x1fe)]){_0x363b20['action']===_0x5a5fd4(0x287)&&console[_0x5a5fd4(0x212)](a4_0x34cdce[_0x5a5fd4(0x21b)]('\x20\x20Prompt\x20\x22'+_0x363b20[_0x5a5fd4(0x22b)]+_0x5a5fd4(0x265)+_0x363b20[_0x5a5fd4(0x287)]));}return 0x1;}console['log'](a4_0x34cdce[_0x5a5fd4(0x297)](_0x5a5fd4(0x27b)+(_0x26eda2+_0x2b9bc6)+_0x5a5fd4(0x20a)+_0x5ed79d[_0x5a5fd4(0x21c)]+'\x27'));const _0x478a7c=getLLMProjectUrl(_0x5e3637,_0x5ed79d[_0x5a5fd4(0x257)]);return console[_0x5a5fd4(0x212)]('Project:\x20'+a4_0x34cdce[_0x5a5fd4(0x1f4)](_0x478a7c)),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_0x585583=a5_0x4050;(function(_0x9c4d60,_0x50b10f){const _0x44abe3=a5_0x4050,_0x341ec4=_0x9c4d60();while(!![]){try{const _0x3b0a2f=-parseInt(_0x44abe3(0x188))/0x1*(parseInt(_0x44abe3(0x187))/0x2)+-parseInt(_0x44abe3(0x165))/0x3*(parseInt(_0x44abe3(0x1a5))/0x4)+-parseInt(_0x44abe3(0x15b))/0x5*(parseInt(_0x44abe3(0x197))/0x6)+parseInt(_0x44abe3(0x143))/0x7*(parseInt(_0x44abe3(0x162))/0x8)+parseInt(_0x44abe3(0x199))/0x9+-parseInt(_0x44abe3(0x190))/0xa+parseInt(_0x44abe3(0x183))/0xb*(parseInt(_0x44abe3(0x135))/0xc);if(_0x3b0a2f===_0x50b10f)break;else _0x341ec4['push'](_0x341ec4['shift']());}catch(_0x4b7817){_0x341ec4['push'](_0x341ec4['shift']());}}}(a5_0xc27d,0x1b571));function a5_0x4050(_0x4a63e1,_0x58142b){_0x4a63e1=_0x4a63e1-0x130;const _0xc27d22=a5_0xc27d();let _0x405049=_0xc27d22[_0x4a63e1];return _0x405049;}import*as a5_0x40d975 from'node:fs';import*as a5_0x3e65b1 from'node:path';import a5_0x11f297 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent}from'../sdk/agent/test/index.js';function a5_0xc27d(){const _0x496d24=['join','388tBJeov','\x20\x20Round\x20','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','no_tests','✗\x20ERROR:\x20Project\x20not\x20found:\x20','filter','Running\x20agent\x20tests...','Output\x20written\x20to:\x20','length','504rSlYQa','resolveProjectId','Duration:\x20','toLowerCase','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','red','writeFileSync','substring','Test\x20Summary','Tests\x20found:\x20','llmProject','round','resolveAgentId','multiple_agents','72492SsfaRM','table','push','Available\x20tests:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','Usage:','message','...\x20','status','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','json','Round\x201/','FAIL','cyan','conversation_url','text','projectDir','\x22:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','green','agentName','dim','toISOString','reason','350725acJvEb','white','Round\x20','rounds','Test\x20','execute','/<agent-name>','32wEtveK','repeat','\x20\x20Evaluating...\x20','1338umycof','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','yellow','tests','llm',':\x20Sending\x20user\x20input...','eval','Total:\x20\x20\x20\x20','✗\x20FAIL:\x20','Test\x20Configuration:','\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)','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','site','name','Site:\x20','no_context','test.yml','PASS','Project\x20path:\x20','Failed:\x20\x20\x20','tsv','\x20\x20Site:\x20','agent:test','context','Running\x20test:\x20','...','Conversation\x20URL:\x20','now','Run\x20\x27tdx\x20agent\x20pull\x20','output','110693WtsTXy','404','basename','Using\x20agent:\x20','104086sHINpY','3fcUMSQ','start','utf-8','map','agentDirs','projectName','includes','stop','2072950RCuonA','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','jsonl','No\x20tests\x20found\x20matching:\x20','✗\x20ERROR:\x20','\x20\x20-\x20','log','6WCbbPT','verbose','1122714hMQEiE','trim','Failed\x20Tests:','Evaluating\x20response...','Error\x20writing\x20output\x20file:\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','not\x20found','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','dryRun','ERROR','✓\x20PASS:\x20'];a5_0xc27d=function(){return _0x496d24;};return a5_0xc27d();}import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x585583(0x172)]=a5_0x585583(0x17b);['description']='Run\x20tests\x20for\x20an\x20LLM\x20agent';async[a5_0x585583(0x160)](_0x12c6ad){const _0x2799e8=a5_0x585583,{options:_0x1dbf91,args:_0x40a5f0,tdx:_0xb14f6b}=_0x12c6ad,_0xbce7e7=_0x40a5f0[0x0]||'.',_0x321132=_0x1dbf91[_0x2799e8(0x1a1)],_0x4c2b74=_0x1dbf91,_0x51083d=_0x4c2b74[_0x2799e8(0x16b)]===![],_0x444ca2=_0x4c2b74['name'],_0x1ba905=_0x1dbf91[_0x2799e8(0x171)],_0x2082ab=_0x4c2b74[_0x2799e8(0x182)];let _0xc12a76=_0x2799e8(0x144);if(_0x4c2b74[_0x2799e8(0x14d)])_0xc12a76=_0x2799e8(0x14d);else{if(_0x4c2b74[_0x2799e8(0x192)])_0xc12a76=_0x2799e8(0x192);else{if(_0x4c2b74[_0x2799e8(0x179)])_0xc12a76=_0x2799e8(0x179);else{if(_0x4c2b74['table'])_0xc12a76=_0x2799e8(0x144);}}}const _0x4fd864=_0x4c2b74[_0x2799e8(0x13f)];let _0x431f48=_0xbce7e7;const _0x47a9bd=a5_0x40d975['existsSync'](_0xbce7e7),_0x128179=_0xbce7e7==='.';if(!_0x47a9bd||_0x128179){const _0x225ba5=resolveProjectFromContext(_0xbce7e7,_0x4fd864,{'requireFile':_0x2799e8(0x175)});if(_0x225ba5['found'])_0x431f48=_0x225ba5[_0x2799e8(0x153)],_0x225ba5['source']===_0x2799e8(0x17c)&&console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x158)](_0x2799e8(0x186)+_0x431f48));else switch(_0x225ba5[_0x2799e8(0x15a)]){case _0x2799e8(0x174):console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x167)](_0x225ba5['message'])),console[_0x2799e8(0x196)](),console[_0x2799e8(0x196)](_0x2799e8(0x148)),console[_0x2799e8(0x196)](_0x2799e8(0x19e)),console[_0x2799e8(0x196)](_0x2799e8(0x16f)),console[_0x2799e8(0x196)](),console[_0x2799e8(0x196)](_0x2799e8(0x139));return 0x1;case'no_local_folder':console[_0x2799e8(0x196)](a5_0x11f297['yellow'](_0x225ba5[_0x2799e8(0x149)])),console[_0x2799e8(0x196)](),console['log'](_0x2799e8(0x181)+_0x225ba5[_0x2799e8(0x13f)]+_0x2799e8(0x155));return 0x1;case _0x2799e8(0x142):{const _0x590fab=a5_0x3e65b1[_0x2799e8(0x185)](_0x225ba5[_0x2799e8(0x153)]);console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x167)](_0x2799e8(0x1a7)+_0x225ba5[_0x2799e8(0x13f)]+'\x22:'));for(const _0x3b0ce6 of _0x225ba5[_0x2799e8(0x18c)]){console[_0x2799e8(0x196)](_0x2799e8(0x195)+_0x3b0ce6);}return console['log'](),console[_0x2799e8(0x196)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x590fab+_0x2799e8(0x161)),0x1;}case _0x2799e8(0x1a8):console[_0x2799e8(0x196)](a5_0x11f297['yellow'](_0x2799e8(0x166)+_0x225ba5[_0x2799e8(0x13f)]+'\x22.')),console['log'](a5_0x11f297[_0x2799e8(0x158)](_0x2799e8(0x177)+_0x225ba5['projectDir'])),console['log'](),console['log'](_0x2799e8(0x170));return 0x1;}}const {definition:_0x1e0338,agentInfo:_0x45d53f}=parseTestFile(_0x431f48);let _0x566d20=_0x1e0338['tests'];if(_0x444ca2){const _0x11bb1e=_0x444ca2['split'](',')[_0x2799e8(0x18b)](_0x1eb70f=>_0x1eb70f[_0x2799e8(0x19a)]());_0x566d20=_0x1e0338[_0x2799e8(0x168)][_0x2799e8(0x131)](_0xa3b796=>_0x11bb1e['includes'](_0xa3b796['name']));if(_0x566d20[_0x2799e8(0x134)]===0x0)return console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x167)](_0x2799e8(0x193)+_0x444ca2)),console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x158)](_0x2799e8(0x146)+_0x1e0338[_0x2799e8(0x168)][_0x2799e8(0x18b)](_0x5745ce=>_0x5745ce[_0x2799e8(0x172)])[_0x2799e8(0x1a4)](',\x20'))),0x1;}if(_0x321132){console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x150)](_0x2799e8(0x16e))),console[_0x2799e8(0x196)](_0x2799e8(0x17a)+a5_0x11f297[_0x2799e8(0x15c)](_0x1ba905)),console['log']('\x20\x20Project:\x20'+a5_0x11f297[_0x2799e8(0x15c)](_0x45d53f[_0x2799e8(0x18d)])),console['log']('\x20\x20Agent:\x20'+a5_0x11f297['white'](_0x45d53f['agentName'])),console[_0x2799e8(0x196)](),console[_0x2799e8(0x196)](_0x2799e8(0x13e)+a5_0x11f297[_0x2799e8(0x15c)](_0x566d20[_0x2799e8(0x134)]));for(let _0x22e14a=0x0;_0x22e14a<_0x566d20[_0x2799e8(0x134)];_0x22e14a++){const _0x3faa1f=_0x566d20[_0x22e14a],_0x393af5=_0x3faa1f[_0x2799e8(0x15e)][_0x2799e8(0x134)]===0x1?_0x2799e8(0x140):_0x2799e8(0x15e);console['log']('\x20\x20'+(_0x22e14a+0x1)+'.\x20'+a5_0x11f297[_0x2799e8(0x15c)](_0x3faa1f[_0x2799e8(0x172)])+'\x20('+_0x3faa1f[_0x2799e8(0x15e)][_0x2799e8(0x134)]+'\x20'+_0x393af5+')');}return 0x0;}let _0x47a6e7,_0x2207bc;try{_0x47a6e7=await _0xb14f6b['llm'][_0x2799e8(0x136)](_0x45d53f[_0x2799e8(0x18d)]);}catch(_0x23f9a7){const _0x216032=_0x23f9a7 instanceof Error?_0x23f9a7[_0x2799e8(0x149)]:String(_0x23f9a7);return _0x216032['includes'](_0x2799e8(0x184))||_0x216032[_0x2799e8(0x138)]()['includes']('not\x20found')?console['log'](a5_0x11f297[_0x2799e8(0x13a)](_0x2799e8(0x130)+_0x45d53f[_0x2799e8(0x18d)])):console['log'](a5_0x11f297[_0x2799e8(0x13a)](_0x2799e8(0x14c)+_0x45d53f[_0x2799e8(0x18d)]+_0x2799e8(0x154)+_0x216032)),0x1;}try{_0x2207bc=await _0xb14f6b['llm'][_0x2799e8(0x141)](_0x45d53f[_0x2799e8(0x157)],_0x47a6e7);}catch(_0x4bd082){const _0xfa18db=_0x4bd082 instanceof Error?_0x4bd082['message']:String(_0x4bd082);return _0xfa18db[_0x2799e8(0x18e)]('404')||_0xfa18db[_0x2799e8(0x138)]()[_0x2799e8(0x18e)](_0x2799e8(0x19f))?console[_0x2799e8(0x196)](a5_0x11f297['red'](_0x2799e8(0x1a0)+_0x45d53f[_0x2799e8(0x157)])):console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x13a)](_0x2799e8(0x147)+_0x45d53f[_0x2799e8(0x157)]+_0x2799e8(0x154)+_0xfa18db)),0x1;}let _0x5c2cb3;if(!_0x51083d)try{_0x5c2cb3=await setupEvaluatorAgent(_0xb14f6b['llm'],_0x1dbf91[_0x2799e8(0x198)]);}catch(_0x252016){const _0x1439fc=_0x252016 instanceof Error?_0x252016[_0x2799e8(0x149)]:String(_0x252016);return console[_0x2799e8(0x196)](a5_0x11f297['red'](_0x2799e8(0x191)+_0x1439fc)),0x1;}console['log'](a5_0x11f297[_0x2799e8(0x150)](_0x2799e8(0x132))),console[_0x2799e8(0x196)](_0x2799e8(0x173)+a5_0x11f297[_0x2799e8(0x15c)](_0x1ba905)),console[_0x2799e8(0x196)]('Agent:\x20'+a5_0x11f297[_0x2799e8(0x15c)](_0x45d53f[_0x2799e8(0x18d)]+'/'+_0x45d53f['agentName'])),console[_0x2799e8(0x196)]();const _0x4f6ce9=[],_0x5a5ff2=Date[_0x2799e8(0x180)]();for(let _0x93a190=0x0;_0x93a190<_0x566d20[_0x2799e8(0x134)];_0x93a190++){const _0x16cd4f=_0x566d20[_0x93a190];_0x566d20[_0x2799e8(0x134)]>0x1?console[_0x2799e8(0x196)](_0x2799e8(0x15f)+(_0x93a190+0x1)+'/'+_0x566d20[_0x2799e8(0x134)]+':\x20'+a5_0x11f297[_0x2799e8(0x15c)](_0x16cd4f[_0x2799e8(0x172)])):console[_0x2799e8(0x196)](_0x2799e8(0x17d)+a5_0x11f297[_0x2799e8(0x15c)](_0x16cd4f['name']));const _0x55fdc6=createCommandSpinner(_0x2799e8(0x14e)+_0x16cd4f[_0x2799e8(0x15e)][_0x2799e8(0x134)]+_0x2799e8(0x16a));_0x55fdc6[_0x2799e8(0x189)]();try{const {result:_0x4a4e71}=await runTest(_0xb14f6b[_0x2799e8(0x169)],_0x16cd4f,{'agentId':_0x2207bc,'projectId':_0x47a6e7,'site':_0x1ba905,'noEval':_0x51083d,'evaluatorId':_0x5c2cb3,'onRoundStart':(_0x3f427a,_0x5106bd)=>{const _0x5e13ae=_0x2799e8;_0x55fdc6[_0x5e13ae(0x152)]=_0x5e13ae(0x15d)+(_0x3f427a+0x1)+'/'+_0x5106bd+_0x5e13ae(0x16a);},'onRoundComplete':(_0x1cb0ac,_0x27b90c,_0x5b7938)=>{const _0x1fcbdc=_0x2799e8,_0x55c21a=formatElapsed(_0x27b90c);_0x5b7938?console[_0x1fcbdc(0x196)]('\x20\x20Round\x20'+(_0x1cb0ac+0x1)+'/'+_0x16cd4f[_0x1fcbdc(0x15e)][_0x1fcbdc(0x134)]+_0x1fcbdc(0x14a)+a5_0x11f297[_0x1fcbdc(0x156)]('✓')+'\x20('+_0x55c21a+')'):console['log'](_0x1fcbdc(0x1a6)+(_0x1cb0ac+0x1)+'/'+_0x16cd4f['rounds'][_0x1fcbdc(0x134)]+'...\x20'+a5_0x11f297[_0x1fcbdc(0x13a)]('✗'));},'onEvaluationStart':()=>{const _0x199a69=_0x2799e8;_0x55fdc6[_0x199a69(0x152)]=_0x199a69(0x19c);},'onEvaluationComplete':_0x56efaa=>{const _0x271bd1=_0x2799e8,_0x54ebdc=formatElapsed(_0x56efaa);console['log'](_0x271bd1(0x164)+a5_0x11f297[_0x271bd1(0x156)]('✓')+'\x20('+_0x54ebdc+')');}});_0x55fdc6[_0x2799e8(0x18f)](),_0x4f6ce9[_0x2799e8(0x145)](_0x4a4e71);if(_0x4a4e71[_0x2799e8(0x14b)]===_0x2799e8(0x176))console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x156)](_0x2799e8(0x1a3)+_0x4a4e71[_0x2799e8(0x15a)]));else _0x4a4e71['status']===_0x2799e8(0x14f)?console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x13a)](_0x2799e8(0x16d)+_0x4a4e71[_0x2799e8(0x15a)])):console['log'](a5_0x11f297[_0x2799e8(0x13a)]('✗\x20ERROR:\x20'+_0x4a4e71[_0x2799e8(0x15a)]));_0x4a4e71[_0x2799e8(0x151)]&&console[_0x2799e8(0x196)](a5_0x11f297[_0x2799e8(0x158)](_0x2799e8(0x17f)+_0x4a4e71['conversation_url'])),console['log']();}catch(_0x511a23){_0x55fdc6[_0x2799e8(0x18f)]();const _0x2d35b7=_0x511a23 instanceof Error?_0x511a23[_0x2799e8(0x149)]:String(_0x511a23);console['log'](a5_0x11f297[_0x2799e8(0x13a)](_0x2799e8(0x194)+_0x2d35b7)),console[_0x2799e8(0x196)](),_0x4f6ce9[_0x2799e8(0x145)]({'name':_0x16cd4f[_0x2799e8(0x172)],'status':_0x2799e8(0x1a2),'reason':_0x2d35b7,'timestamp':new Date()[_0x2799e8(0x159)](),'duration_ms':0x0});}}const _0x5b08b7=Date['now']()-_0x5a5ff2,_0x27b8f8=_0x4f6ce9['filter'](_0x57c170=>_0x57c170[_0x2799e8(0x14b)]===_0x2799e8(0x176))[_0x2799e8(0x134)],_0x44070f=_0x4f6ce9[_0x2799e8(0x131)](_0x3a7950=>_0x3a7950[_0x2799e8(0x14b)]===_0x2799e8(0x14f))[_0x2799e8(0x134)],_0x1a49b5=_0x4f6ce9['filter'](_0x705fbb=>_0x705fbb[_0x2799e8(0x14b)]===_0x2799e8(0x1a2))['length'];console[_0x2799e8(0x196)]('━'['repeat'](0x3c)),console['log'](_0x2799e8(0x13d)),console['log']('━'[_0x2799e8(0x163)](0x3c)),console[_0x2799e8(0x196)](_0x2799e8(0x16c)+_0x4f6ce9[_0x2799e8(0x134)]),console[_0x2799e8(0x196)]('Passed:\x20\x20\x20'+a5_0x11f297[_0x2799e8(0x156)](_0x27b8f8)),console[_0x2799e8(0x196)](_0x2799e8(0x178)+a5_0x11f297[_0x2799e8(0x13a)](_0x44070f));_0x1a49b5>0x0&&console['log']('Errors:\x20\x20\x20'+a5_0x11f297[_0x2799e8(0x13a)](_0x1a49b5));console[_0x2799e8(0x196)](_0x2799e8(0x137)+formatElapsed(_0x5b08b7)),console[_0x2799e8(0x196)]('━'[_0x2799e8(0x163)](0x3c));const _0x3b427f=_0x4f6ce9[_0x2799e8(0x131)](_0xf1b3aa=>_0xf1b3aa[_0x2799e8(0x14b)]!==_0x2799e8(0x176));if(_0x3b427f['length']>0x0){console['log'](),console[_0x2799e8(0x196)](_0x2799e8(0x19b));for(const _0x490da1 of _0x3b427f){const _0xb7198d=a5_0x11f297[_0x2799e8(0x13a)]('✗'),_0x5b7322=_0x490da1[_0x2799e8(0x15a)][_0x2799e8(0x134)]>0x32?_0x490da1[_0x2799e8(0x15a)][_0x2799e8(0x13c)](0x0,0x32)+_0x2799e8(0x17e):_0x490da1[_0x2799e8(0x15a)];console[_0x2799e8(0x196)]('\x20\x20'+_0xb7198d+'\x20'+_0x490da1[_0x2799e8(0x172)]+':\x20'+_0x5b7322);}}const _0x26c4ac={'summary':{'total':_0x4f6ce9['length'],'passed':_0x27b8f8,'failed':_0x44070f,'errors':_0x1a49b5>0x0?_0x1a49b5:undefined,'duration_ms':_0x5b08b7},'tests':_0x4f6ce9,'agent':{'project':_0x45d53f[_0x2799e8(0x18d)],'name':_0x45d53f[_0x2799e8(0x157)],'site':_0x1ba905},'timestamp':new Date(_0x5a5ff2)['toISOString']()};if(_0xc12a76!=='table'||_0x2082ab){const _0x29d117=formatResults(_0x26c4ac,_0xc12a76);if(_0x2082ab)try{a5_0x40d975[_0x2799e8(0x13b)](_0x2082ab,_0x29d117,_0x2799e8(0x18a)),console['log'](),console[_0x2799e8(0x196)](a5_0x11f297['dim'](_0x2799e8(0x133)+_0x2082ab));}catch(_0x12d5d8){return console[_0x2799e8(0x196)](),console[_0x2799e8(0x196)](a5_0x11f297['red'](_0x2799e8(0x19d)+_0x12d5d8)),0x1;}else console['log'](),console[_0x2799e8(0x196)](_0x29d117);}return _0x3b427f[_0x2799e8(0x134)]>0x0?0x1:0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x242fc8=a6_0xdf96;function a6_0xdf96(_0x60f5f0,_0x1e4cd1){_0x60f5f0=_0x60f5f0-0x156;const _0x4962ca=a6_0x4962();let _0xdf96f3=_0x4962ca[_0x60f5f0];return _0xdf96f3;}(function(_0x5edb47,_0x205449){const _0x5a3ecd=a6_0xdf96,_0x5ad0c1=_0x5edb47();while(!![]){try{const _0x3a1ddc=parseInt(_0x5a3ecd(0x193))/0x1*(-parseInt(_0x5a3ecd(0x166))/0x2)+parseInt(_0x5a3ecd(0x15e))/0x3*(parseInt(_0x5a3ecd(0x15d))/0x4)+-parseInt(_0x5a3ecd(0x163))/0x5+-parseInt(_0x5a3ecd(0x15f))/0x6*(parseInt(_0x5a3ecd(0x188))/0x7)+-parseInt(_0x5a3ecd(0x156))/0x8*(parseInt(_0x5a3ecd(0x160))/0x9)+-parseInt(_0x5a3ecd(0x178))/0xa*(-parseInt(_0x5a3ecd(0x17a))/0xb)+parseInt(_0x5a3ecd(0x196))/0xc*(parseInt(_0x5a3ecd(0x185))/0xd);if(_0x3a1ddc===_0x205449)break;else _0x5ad0c1['push'](_0x5ad0c1['shift']());}catch(_0xccfb0e){_0x5ad0c1['push'](_0x5ad0c1['shift']());}}}(a6_0x4962,0x1be03));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a6_0x242fc8(0x182),a6_0x242fc8(0x158),a6_0x242fc8(0x189),'set-cookie','set-cookie2',a6_0x242fc8(0x187),a6_0x242fc8(0x17e),a6_0x242fc8(0x183)]);function isSensitiveHeader(_0x1bbc98){const _0x202f25=a6_0x242fc8;return SENSITIVE_HEADERS['has'](_0x1bbc98[_0x202f25(0x171)]());}function parseHeader(_0x5d85fc){const _0x285af7=a6_0x242fc8,_0xdc2ebb=_0x5d85fc[_0x285af7(0x176)](':');if(_0xdc2ebb===-0x1)throw new Error(_0x285af7(0x184)+_0x5d85fc+_0x285af7(0x157)+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x284622=_0x5d85fc['substring'](0x0,_0xdc2ebb)[_0x285af7(0x15b)](),_0x177f16=_0x5d85fc['substring'](_0xdc2ebb+0x1)[_0x285af7(0x15b)]();if(!_0x284622)throw new Error(_0x285af7(0x194)+_0x5d85fc+'\x22');return[_0x284622,_0x177f16];}export class ApiCommand extends BaseCommand{[a6_0x242fc8(0x18d)]=a6_0x242fc8(0x161);[a6_0x242fc8(0x16e)]=a6_0x242fc8(0x169);[a6_0x242fc8(0x17f)](_0x12f9ff){const _0xe218f3=a6_0x242fc8,{args:_0x2569d4,options:_0x57d5a7}=_0x12f9ff,_0x2b6f6b=_0x57d5a7;if(_0x2569d4[_0xe218f3(0x17c)]===0x0)return'Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list';const _0x251640=_0x2569d4[0x0];if(!_0x251640['startsWith']('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x251640;const _0x1898e3=_0x2b6f6b['data'],_0x3b9be8=_0x2b6f6b[_0xe218f3(0x198)];if(_0x1898e3&&_0x3b9be8)return _0xe218f3(0x19a);const _0x1f8ce2=_0x2b6f6b['method']||_0xe218f3(0x191),_0x2e40e0=[_0xe218f3(0x191),_0xe218f3(0x170),_0xe218f3(0x165),'DELETE',_0xe218f3(0x168)];if(!_0x2e40e0[_0xe218f3(0x164)](_0x1f8ce2[_0xe218f3(0x186)]()))return _0xe218f3(0x16d)+_0x1f8ce2+_0xe218f3(0x190)+_0x2e40e0[_0xe218f3(0x15a)](',\x20');const _0x3c9908=_0x2b6f6b[_0xe218f3(0x174)]||'td',_0x547aa7=['td',_0xe218f3(0x181),'workflow',_0xe218f3(0x197),_0xe218f3(0x175),_0xe218f3(0x16f)];if(!_0x547aa7[_0xe218f3(0x164)](_0x3c9908))return _0xe218f3(0x17b)+_0x3c9908+_0xe218f3(0x172)+_0x547aa7['join'](',\x20');return undefined;}async['execute'](_0x370577){const _0x4ef0b0=a6_0x242fc8,{options:_0x312b84,args:_0x56ab30,tdx:_0x2738e4}=_0x370577,_0x481f86=_0x312b84,_0x25000d=_0x56ab30[0x0],_0x430e64=(_0x481f86[_0x4ef0b0(0x15c)]||_0x4ef0b0(0x191))[_0x4ef0b0(0x186)](),_0x58699f=_0x481f86[_0x4ef0b0(0x18c)],_0x5362ef=_0x481f86[_0x4ef0b0(0x198)],_0x5de5cb=_0x481f86[_0x4ef0b0(0x162)],_0x2fe591=_0x481f86[_0x4ef0b0(0x174)]||'td';try{const _0x598b82={};if(_0x5de5cb){const _0x54c2f5=Array[_0x4ef0b0(0x16b)](_0x5de5cb)?_0x5de5cb:[_0x5de5cb];for(const _0xf00e71 of _0x54c2f5){const [_0x4c2e0a,_0x58fe35]=parseHeader(_0xf00e71);_0x598b82[_0x4c2e0a]=_0x58fe35;}}let _0x108939;if(_0x58699f)_0x108939=_0x58699f;else{if(_0x5362ef)try{_0x108939=RawAPI[_0x4ef0b0(0x180)](_0x5362ef);}catch(_0x519c8e){return console['error'](_0x4ef0b0(0x16c)+(_0x519c8e instanceof Error?_0x519c8e['message']:String(_0x519c8e))),0x1;}}const _0x1f8065={'method':_0x430e64,'apiType':_0x2fe591,'includeHeaders':_0x312b84['verbose']};_0x108939&&(_0x1f8065[_0x4ef0b0(0x16a)]=_0x108939);Object['keys'](_0x598b82)[_0x4ef0b0(0x17c)]>0x0&&(_0x1f8065[_0x4ef0b0(0x167)]=_0x598b82);if(_0x312b84[_0x4ef0b0(0x177)]){const _0x4c40c0=resolveSite(_0x312b84[_0x4ef0b0(0x192)]),_0x3c5a44=getEndpoint(_0x4c40c0,_0x2fe591),_0x391c05=''+_0x3c5a44+_0x25000d;console[_0x4ef0b0(0x173)]('>\x20'+_0x430e64+'\x20'+_0x391c05);const _0x43d365=getAuthHeaders(_0x4c40c0),_0x247830={..._0x43d365,..._0x598b82};for(const [_0x558c2b,_0x31c4a2]of Object[_0x4ef0b0(0x195)](_0x247830)){!isSensitiveHeader(_0x558c2b)&&console['error']('>\x20'+_0x558c2b+':\x20'+_0x31c4a2);}_0x108939&&console[_0x4ef0b0(0x173)]('>'),console[_0x4ef0b0(0x173)]('');}const _0x46c6dc=await _0x2738e4[_0x4ef0b0(0x161)][_0x4ef0b0(0x18f)](_0x25000d,_0x1f8065);if(_0x312b84['verbose']&&_0x46c6dc[_0x4ef0b0(0x167)]){console[_0x4ef0b0(0x173)]('<\x20HTTP/1.1\x20'+_0x46c6dc[_0x4ef0b0(0x18a)]);for(const [_0x4de307,_0x5c3fb8]of Object[_0x4ef0b0(0x195)](_0x46c6dc['headers'])){!isSensitiveHeader(_0x4de307)&&console['error']('<\x20'+_0x4de307+':\x20'+_0x5c3fb8);}console[_0x4ef0b0(0x173)]('');}const _0x3206a9=Boolean(_0x312b84[_0x4ef0b0(0x199)]),_0x249255={'color':_0x312b84['color'],'noColor':_0x312b84['noColor']||_0x3206a9&&!_0x312b84[_0x4ef0b0(0x19b)]},_0xe3bceb=colorizeJSON(_0x46c6dc['data'],_0x249255);return _0x312b84[_0x4ef0b0(0x199)]?(writeFileSync(_0x312b84[_0x4ef0b0(0x199)],_0xe3bceb),console['error'](_0x4ef0b0(0x17d)+_0x312b84[_0x4ef0b0(0x199)])):console[_0x4ef0b0(0x18e)](_0xe3bceb),0x0;}catch(_0x2f9416){return _0x2f9416 instanceof Error?(console[_0x4ef0b0(0x173)]('Error:\x20'+_0x2f9416[_0x4ef0b0(0x159)]),_0x312b84[_0x4ef0b0(0x177)]&&_0x2f9416['stack']&&console[_0x4ef0b0(0x173)](_0x4ef0b0(0x179)+_0x2f9416[_0x4ef0b0(0x18b)])):console[_0x4ef0b0(0x173)](_0x4ef0b0(0x16c)+String(_0x2f9416)),0x1;}}}function a6_0x4962(){const _0xb274cf=['toLowerCase','.\x20Valid\x20types:\x20','error','type','llm','indexOf','verbose','20jFBkpp','\x0aStack\x20trace:\x0a','164120yXdaSg','Invalid\x20API\x20type:\x20','length','Results\x20saved\x20to\x20','x-auth-token','validate','readBodyFromFile','cdp','authorization','x-trino-user','Invalid\x20header\x20format:\x20\x22','65iRlAaU','toUpperCase','x-xsrf-token','14Ojdwlq','cookie','status','stack','data','name','log','request','.\x20Valid\x20methods:\x20','GET','site','69633wybPmx','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','entries','680100QsVabO','trino','file','output','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','color','1631536tDVoUb','\x22.\x20','proxy-authorization','message','join','trim','method','824928mFTpfk','3nzAEYI','30204JVtExi','9gMsaSM','api','header','608125gCNzzJ','includes','PUT','2mSIZwm','headers','PATCH','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','body','isArray','Error:\x20','Invalid\x20HTTP\x20method:\x20','description','llm-proxy','POST'];a6_0x4962=function(){return _0xb274cf;};return a6_0x4962();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x492031=a7_0x3fe7;(function(_0x3f88bb,_0x5bacb7){const _0x553cad=a7_0x3fe7,_0x567ede=_0x3f88bb();while(!![]){try{const _0x25f0d0=parseInt(_0x553cad(0x205))/0x1+parseInt(_0x553cad(0x1fb))/0x2+-parseInt(_0x553cad(0x20a))/0x3*(-parseInt(_0x553cad(0x241))/0x4)+parseInt(_0x553cad(0x20b))/0x5+parseInt(_0x553cad(0x22d))/0x6*(-parseInt(_0x553cad(0x232))/0x7)+-parseInt(_0x553cad(0x22f))/0x8+parseInt(_0x553cad(0x1f9))/0x9*(-parseInt(_0x553cad(0x1f7))/0xa);if(_0x25f0d0===_0x5bacb7)break;else _0x567ede['push'](_0x567ede['shift']());}catch(_0x312769){_0x567ede['push'](_0x567ede['shift']());}}}(a7_0x42cb,0x4a762));function a7_0x3fe7(_0x208acb,_0x37076c){_0x208acb=_0x208acb-0x1ee;const _0x42cbc2=a7_0x42cb();let _0x3fe770=_0x42cbc2[_0x208acb];return _0x3fe770;}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_0x42cb(){const _0x529dff=['✓\x20Default\x20site\x20set\x20to\x20','auth','N/A','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','us01','name','trim','red','jobs','449556GOdwfT','findIndex','2124440iCJtsw','logLevel','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','35hRvfQN','site','✓\x20Profile\x20\x27','\x20--profile\x20','\x0aSetup\x20cancelled','getUserInfo','✗\x20Validation\x20failed:\x20','\x20\x20tdx','yellow','Validating\x20API\x20key...','description','Site\x20name\x20cannot\x20be\x20empty','push','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','bold','190004LQQBDa','jp\x20\x20\x20-\x20Japan','error','✓\x20API\x20key\x20removed\x20from\x20keychain','tdx:\x20auth\x20clear','✓\x20Authentication\x20successful\x0a','Setup\x20API\x20key\x20authentication\x20interactively','apiKey','Enter\x20custom\x20site','ERROR','System\x20keychain\x20is\x20not\x20available','warn','email','eu01','execute','10itIOvN','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','3294909PXeakt','log','854106pbAOFJ','ap02','API\x20key\x20cannot\x20be\x20empty','ap02\x20-\x20Korea','Name:\x20','User:\x20','create','Setting\x20up\x20authentication\x20for\x20site:\x20','Enter\x20site\x20name:','\x20for\x20profile:\x20','170657AvPIRN','profile','\x20(site:\x20','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','33xVLPaA','955295alFwtM','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','filter','No\x20API\x20key\x20found\x20in\x20keychain','You\x20can\x20find\x20your\x20API\x20key\x20at:','green','\x20(profile:\x20','select','first_name','text','last_name','tdx:\x20auth\x20setup','Read\x20credential\x20from\x20','other','customSite','\x27\x20registered','password','test','auth:clear','us\x20\x20\x20-\x20United\x20States','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','Enter\x20your\x20TD\x20API\x20key:','Remove\x20API\x20key\x20from\x20system\x20keychain','Select\x20your\x20Treasure\x20Data\x20site:','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key'];a7_0x42cb=function(){return _0x529dff;};return a7_0x42cb();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a7_0x3e2327 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x2afc93 from'chalk';export class AuthSetupCommand extends BaseCommand{['name']='auth:setup';[a7_0x492031(0x23c)]=a7_0x492031(0x1ee);async[a7_0x492031(0x1f6)](_0x433b22){const _0x125660=a7_0x492031,{options:_0x2857aa}=_0x433b22,_0x2d300d=_0x2857aa[_0x125660(0x206)];console['log'](a7_0x2afc93[_0x125660(0x240)](_0x125660(0x216)));const _0x2a7c3e=_0x2857aa[_0x125660(0x233)]||_0x125660(0x228),_0x2e76b9=[{'title':_0x125660(0x21e),'value':'us01'},{'title':_0x125660(0x242),'value':'jp01'},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x125660(0x1f5)},{'title':_0x125660(0x1fe),'value':_0x125660(0x1fc)}];let _0x13d13e=_0x2e76b9[_0x125660(0x22e)](_0x207926=>_0x207926['value']===_0x2a7c3e);_0x13d13e===-0x1&&_0x2a7c3e!==_0x125660(0x228)&&(_0x2e76b9['push']({'title':_0x2a7c3e,'value':_0x2a7c3e}),_0x13d13e=_0x2e76b9['length']-0x1);_0x2e76b9[_0x125660(0x23e)]({'title':_0x125660(0x1f0),'value':_0x125660(0x218)});const _0x6c995b=_0x2d300d?_0x125660(0x209)+_0x2d300d+'):':_0x125660(0x222),_0x6278ec=await a7_0x3e2327({'type':_0x125660(0x212),'name':_0x125660(0x233),'message':_0x6c995b,'choices':_0x2e76b9,'initial':_0x13d13e>=0x0?_0x13d13e:0x0});if(!_0x6278ec[_0x125660(0x233)])return console[_0x125660(0x1fa)](_0x125660(0x236)),0x1;let _0x3a4407;if(_0x6278ec[_0x125660(0x233)]===_0x125660(0x218)){const _0x20c104=await a7_0x3e2327({'type':_0x125660(0x214),'name':_0x125660(0x219),'message':_0x125660(0x203),'initial':'us01','validate':_0x428a73=>{const _0x417ae3=_0x125660;if(!_0x428a73||!_0x428a73[_0x417ae3(0x22a)]())return _0x417ae3(0x23d);if(!/^[a-z0-9-]+$/[_0x417ae3(0x21c)](_0x428a73[_0x417ae3(0x22a)]()))return _0x417ae3(0x227);return!![];}});if(!_0x20c104[_0x125660(0x219)])return console[_0x125660(0x1fa)]('\x0aSetup\x20cancelled'),0x1;_0x3a4407=_0x20c104[_0x125660(0x219)];}else _0x3a4407=_0x6278ec[_0x125660(0x233)];const _0x127d55=resolveSite(_0x3a4407);console[_0x125660(0x1fa)](_0x125660(0x202)+_0x127d55),console[_0x125660(0x1fa)](_0x125660(0x20f)),console[_0x125660(0x1fa)]('\x20\x20'+getConsoleUrl(_0x127d55,'/app/mp/ak'));const _0x5eb758=await a7_0x3e2327({'type':_0x125660(0x21b),'name':'apiKey','message':_0x125660(0x220),'validate':_0x5a75d8=>{const _0x3ea60e=_0x125660;if(!_0x5a75d8||!_0x5a75d8['trim']())return _0x3ea60e(0x1fd);return!![];}});if(!_0x5eb758[_0x125660(0x1ef)])return console[_0x125660(0x1fa)](_0x125660(0x236)),0x1;const _0x51e92e=_0x5eb758[_0x125660(0x1ef)];console['log'](_0x125660(0x23b));try{const _0x556faa=TDX[_0x125660(0x201)]({'site':_0x127d55,'apiKey':_0x51e92e[_0x125660(0x22a)](),'logLevel':_0x2857aa[_0x125660(0x230)]??LogLevel[_0x125660(0x1f1)]}),_0x2eab8b=await _0x556faa[_0x125660(0x22c)][_0x125660(0x237)]();console[_0x125660(0x1fa)](_0x125660(0x208)+_0x2eab8b[_0x125660(0x1f4)]+')');const _0x1bbc5a=await isKeychainAvailable();_0x1bbc5a?(await saveAPIKeyAsync(_0x51e92e[_0x125660(0x22a)](),_0x127d55,_0x2d300d),console[_0x125660(0x1fa)](_0x125660(0x231)+(_0x2d300d?'\x20(profile:\x20'+_0x2d300d+')':''))):(console[_0x125660(0x1f3)](a7_0x2afc93[_0x125660(0x23a)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x125660(0x1f3)](a7_0x2afc93[_0x125660(0x23a)](_0x125660(0x1f8))));if(_0x2d300d){const _0x56df3e={'site':_0x127d55};saveProfileToUserConfig(_0x2d300d,_0x56df3e),console[_0x125660(0x1fa)](_0x125660(0x234)+_0x2d300d+_0x125660(0x21a));}else saveDefaultSiteToUserConfig(_0x127d55),console[_0x125660(0x1fa)](_0x125660(0x224)+_0x127d55);const _0x13ce24=_0x2d300d?_0x125660(0x235)+_0x2d300d:'';return console[_0x125660(0x1fa)](),console[_0x125660(0x1fa)](_0x125660(0x21f)),console[_0x125660(0x1fa)](_0x125660(0x239)+_0x13ce24+_0x125660(0x20c)),console[_0x125660(0x1fa)](_0x125660(0x239)+_0x13ce24+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x28e749){if(_0x28e749 instanceof HTTPClientError&&_0x28e749['status']===0x191)return printAuthError(_0x28e749),0x1;return console['error'](a7_0x2afc93['red'](_0x125660(0x238)+(_0x28e749 instanceof Error?_0x28e749['message']:String(_0x28e749)))),console[_0x125660(0x243)](_0x125660(0x23f)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x492031(0x229)]=a7_0x492031(0x225);[a7_0x492031(0x23c)]=a7_0x492031(0x223);async[a7_0x492031(0x1f6)](_0x4c0360){const _0x2a063e=a7_0x492031,{options:_0x485cd1,tdx:_0x1692ed}=_0x4c0360,_0x319f33=_0x485cd1[_0x2a063e(0x233)],_0x1b8ad2=_0x485cd1['profile'],_0x51829a=_0x1b8ad2?_0x1b8ad2:_0x2a063e(0x226);console[_0x2a063e(0x1fa)]('tdx\x20profile:\x20'+_0x51829a+_0x2a063e(0x207)+_0x319f33+')');const _0x784f03=await resolveAPIKeyAsync(_0x319f33,_0x1b8ad2);if(_0x784f03){const {source:_0x4413e6,isDeprecated:_0x501794}=_0x784f03,_0x5414e0=_0x2a063e(0x217)+_0x4413e6;console[_0x2a063e(0x1fa)](_0x501794?a7_0x2afc93[_0x2a063e(0x23a)](_0x5414e0):_0x5414e0);}else console[_0x2a063e(0x1fa)](a7_0x2afc93[_0x2a063e(0x23a)]('No\x20credential\x20found'));try{const _0x21ff02=await _0x1692ed[_0x2a063e(0x22c)]['getUserInfo']();return console['log'](a7_0x2afc93[_0x2a063e(0x210)](_0x2a063e(0x246))),console[_0x2a063e(0x1fa)](_0x2a063e(0x200)+_0x21ff02[_0x2a063e(0x1f4)]),(_0x21ff02[_0x2a063e(0x213)]||_0x21ff02['last_name'])&&console['log'](_0x2a063e(0x1ff)+[_0x21ff02[_0x2a063e(0x213)],_0x21ff02[_0x2a063e(0x215)]][_0x2a063e(0x20d)](Boolean)['join']('\x20')),0x0;}catch(_0x3da5b1){return _0x3da5b1 instanceof HTTPClientError&&_0x3da5b1['status']===0x191?printAuthError(_0x3da5b1,!![],_0x1b8ad2):console['error'](a7_0x2afc93[_0x2a063e(0x22b)](_0x2a063e(0x238)+(_0x3da5b1 instanceof Error?_0x3da5b1['message']:String(_0x3da5b1)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x492031(0x229)]=a7_0x492031(0x21d);[a7_0x492031(0x23c)]=a7_0x492031(0x221);async[a7_0x492031(0x1f6)](_0x1e359c){const _0x1b3fd4=a7_0x492031,{options:_0x3e6f6e}=_0x1e359c,_0x1e513b=_0x3e6f6e[_0x1b3fd4(0x206)];console[_0x1b3fd4(0x1fa)](a7_0x2afc93[_0x1b3fd4(0x240)](_0x1b3fd4(0x245)));const _0x3518b6=await isKeychainAvailable();if(!_0x3518b6)return console[_0x1b3fd4(0x243)](a7_0x2afc93[_0x1b3fd4(0x22b)](_0x1b3fd4(0x1f2))),0x1;const _0x2504e7=await deleteKeychainAPIKey(_0x1e513b);return _0x2504e7?(clearCredentialCache(),console[_0x1b3fd4(0x1fa)](_0x1b3fd4(0x244)+(_0x1e513b?_0x1b3fd4(0x211)+_0x1e513b+')':'')),0x0):(console[_0x1b3fd4(0x1fa)](_0x1b3fd4(0x20e)+(_0x1e513b?_0x1b3fd4(0x204)+_0x1e513b:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a8_0xa8c7ed=a8_0x53e1;function a8_0x53e1(_0x4208b6,_0x25603d){_0x4208b6=_0x4208b6-0x1a6;const _0x2391e6=a8_0x2391();let _0x53e146=_0x2391e6[_0x4208b6];return _0x53e146;}(function(_0xb1d7d3,_0x4e3865){const _0x3ed960=a8_0x53e1,_0x5e6885=_0xb1d7d3();while(!![]){try{const _0x436d34=parseInt(_0x3ed960(0x1b1))/0x1*(parseInt(_0x3ed960(0x1b0))/0x2)+-parseInt(_0x3ed960(0x1c9))/0x3*(parseInt(_0x3ed960(0x1d3))/0x4)+-parseInt(_0x3ed960(0x1ad))/0x5*(parseInt(_0x3ed960(0x1bb))/0x6)+-parseInt(_0x3ed960(0x1ab))/0x7*(-parseInt(_0x3ed960(0x1c0))/0x8)+-parseInt(_0x3ed960(0x1b5))/0x9*(parseInt(_0x3ed960(0x1ae))/0xa)+-parseInt(_0x3ed960(0x1d5))/0xb*(parseInt(_0x3ed960(0x1dd))/0xc)+parseInt(_0x3ed960(0x1bc))/0xd*(parseInt(_0x3ed960(0x1d7))/0xe);if(_0x436d34===_0x4e3865)break;else _0x5e6885['push'](_0x5e6885['shift']());}catch(_0x18276a){_0x5e6885['push'](_0x5e6885['shift']());}}}(a8_0x2391,0x72aaa));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';function a8_0x2391(){const _0x8e6c87=['content','name','\x20\x20Cause:\x20','1680gQGiNn','agent','type','log','message','validate','session\x20context','Using\x20cached\x20default\x20agent:\x20','data','9MweSmV','handleChatEvent','llmAgent','resolveAgentId','claude-4.5-haiku','join','write','verbose','Chat\x20session:\x20','chat','1106876OwmdFn','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','319PyQOyg','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','10928848vJMaAq','Resolving\x20project\x20\x27','description','getDefaultAgent','Getting\x20default\x20agent...','getOrCreateDefaultAgent','26436FiSigH','args','chatId','new','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','stack','streamChat','includes','18690wQoXTX','\x0aStack\x20trace:','100885Pnbkel','220mTDGGY','stdout','2IsrUbq','270057wrbefY','error','llm','\x27...','115263pWXVrn','CHAT_NOT_FOUND','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','Using\x20agent\x20from\x20','Resolving\x20agent\x20\x27','getAgentId','222UDguoQ','26IioQRY'];a8_0x2391=function(){return _0x8e6c87;};return a8_0x2391();}import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0x46c29d,_0x1dc2cb){const _0x56428a=a8_0x53e1;if(_0x46c29d instanceof SDKError)console[_0x56428a(0x1b2)]('Error:\x20'+_0x46c29d[_0x56428a(0x1c4)]),_0x1dc2cb[_0x56428a(0x1d0)]&&(_0x46c29d['cause']&&console[_0x56428a(0x1b2)](_0x56428a(0x1bf)+_0x46c29d['cause']),_0x46c29d[_0x56428a(0x1a8)]&&(console[_0x56428a(0x1b2)](_0x56428a(0x1ac)),console[_0x56428a(0x1b2)](_0x46c29d[_0x56428a(0x1a8)])));else throw _0x46c29d;}export class ChatCommand extends BaseCommand{[a8_0xa8c7ed(0x1be)]=a8_0xa8c7ed(0x1d2);[a8_0xa8c7ed(0x1d9)]=a8_0xa8c7ed(0x1a7);[a8_0xa8c7ed(0x1c5)](_0x41734b){const _0x3a5281=a8_0xa8c7ed,_0x163786=_0x41734b[_0x3a5281(0x1de)][_0x3a5281(0x1ce)]('\x20');if(!_0x163786)return _0x3a5281(0x1d4);return undefined;}async[a8_0xa8c7ed(0x1a9)](_0x23c073,_0x299b90,_0x56e740,_0x49bc8d,_0x1f469e){const _0x28823e=a8_0xa8c7ed;for await(const _0x18aea6 of _0x23c073[_0x28823e(0x1b3)][_0x28823e(0x1d2)](_0x299b90,{'agentId':_0x56e740,'chatId':_0x49bc8d})){if(_0x18aea6[_0x28823e(0x1c2)]==='metadata'){const _0x2722b5=_0x18aea6['data'][_0x28823e(0x1df)];saveLastChatId(_0x2722b5),_0x1f469e&&console[_0x28823e(0x1b2)](_0x28823e(0x1d1)+_0x2722b5);}else _0x18aea6[_0x28823e(0x1c2)]==='event'&&this['handleChatEvent'](_0x18aea6[_0x28823e(0x1c8)]);}}async[a8_0xa8c7ed(0x1ba)](_0x1db581,_0xf5a33a,_0x199c07,_0x1bbd86,_0x22b8fd){const _0x472c0c=a8_0xa8c7ed,_0x528e9d=_0xf5a33a||_0x199c07;if(_0x528e9d){const {projectName:_0x371fb4,agentName:_0x1940b5}=parseAgentRef(_0x528e9d),_0x49773d=_0x1940b5||_0x528e9d,_0x3d50e2=_0x1940b5?_0x371fb4:_0x1bbd86;if(!_0x3d50e2)throw new Error(_0x472c0c(0x1b7));if(_0x22b8fd){const _0x99a06a=_0xf5a33a?'--agent\x20flag':_0x472c0c(0x1c6);console[_0x472c0c(0x1b2)](_0x472c0c(0x1b8)+_0x99a06a+':\x20'+_0x3d50e2+'/'+_0x49773d);}const _0x30145d=await withSpinner(_0x472c0c(0x1d8)+_0x3d50e2+_0x472c0c(0x1b4),()=>_0x1db581['llm']['resolveProjectId'](_0x3d50e2),{'verbose':_0x22b8fd}),_0x40535a=await withSpinner(_0x472c0c(0x1b9)+_0x49773d+'\x27...',()=>_0x1db581['llm'][_0x472c0c(0x1cc)](_0x49773d,_0x30145d[_0x472c0c(0x1c8)]),{'verbose':_0x22b8fd});return _0x40535a[_0x472c0c(0x1c8)];}else{const _0xc63ab2=_0x1db581[_0x472c0c(0x1b3)][_0x472c0c(0x1da)]();if(_0xc63ab2)return _0x22b8fd&&console[_0x472c0c(0x1b2)](_0x472c0c(0x1c7)+_0xc63ab2['name']),_0xc63ab2['id'];const _0x2e6554=await withSpinner(_0x472c0c(0x1db),()=>_0x1db581[_0x472c0c(0x1b3)][_0x472c0c(0x1dc)](_0x472c0c(0x1cd),0x0),{'verbose':_0x22b8fd});return _0x2e6554[_0x472c0c(0x1c8)]['id'];}}async['execute'](_0x229501){const _0x310e1e=a8_0xa8c7ed,{options:_0xd38040,args:_0x130e4a,tdx:_0xf77e07}=_0x229501,_0x360540=_0x130e4a[_0x310e1e(0x1ce)]('\x20'),_0x501494=_0xd38040,_0x19c1e4=_0x501494[_0x310e1e(0x1c1)],_0x5a02a5=_0x501494[_0x310e1e(0x1cb)],_0x1d0edc=_0x501494['llmProject'],_0x5e25b0=_0x501494[_0x310e1e(0x1a6)];try{let _0x555df3,_0x579e23;!_0x5e25b0&&(_0x579e23=loadLastChatId(),_0x579e23&&_0xd38040[_0x310e1e(0x1d0)]&&console[_0x310e1e(0x1b2)]('Continuing\x20chat:\x20'+_0x579e23));(_0x5e25b0||!_0x579e23)&&(_0x555df3=await this[_0x310e1e(0x1ba)](_0xf77e07,_0x19c1e4,_0x5a02a5,_0x1d0edc,_0xd38040[_0x310e1e(0x1d0)]));try{await this[_0x310e1e(0x1a9)](_0xf77e07,_0x360540,_0x555df3,_0x579e23,_0xd38040[_0x310e1e(0x1d0)]);}catch(_0x27b119){const _0x2702c0=_0x27b119 instanceof SDKError&&_0x27b119['code']===ErrorCode[_0x310e1e(0x1b6)]||_0x27b119 instanceof Error&&_0x27b119[_0x310e1e(0x1c4)][_0x310e1e(0x1aa)]('404');if(_0x2702c0)_0xd38040[_0x310e1e(0x1d0)]&&console['error'](_0x310e1e(0x1d6)),!_0x555df3&&(_0x555df3=await this[_0x310e1e(0x1ba)](_0xf77e07,_0x19c1e4,_0x5a02a5,_0x1d0edc,_0xd38040[_0x310e1e(0x1d0)])),await this[_0x310e1e(0x1a9)](_0xf77e07,_0x360540,_0x555df3,undefined,_0xd38040['verbose']);else throw _0x27b119;}return console[_0x310e1e(0x1c3)](),0x0;}catch(_0x59f5d9){return console[_0x310e1e(0x1b2)](),handleSDKError(_0x59f5d9,_0xd38040),0x1;}}[a8_0xa8c7ed(0x1ca)](_0xe43772){const _0x303a02=a8_0xa8c7ed;if(_0x303a02(0x1bd)in _0xe43772)process[_0x303a02(0x1af)][_0x303a02(0x1cf)](_0xe43772['content']);else _0x303a02(0x1b2)in _0xe43772&&console['error']('\x0aError:\x20'+_0xe43772[_0x303a02(0x1b2)]);}}
|
|
@@ -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_0x10fb76=a9_0x1a9e;(function(_0x381010,_0x2a2431){const _0x34e096=a9_0x1a9e,_0xd76edc=_0x381010();while(!![]){try{const _0xf248ad=parseInt(_0x34e096(0x1d3))/0x1*(parseInt(_0x34e096(0x18c))/0x2)+parseInt(_0x34e096(0x142))/0x3*(parseInt(_0x34e096(0x1ab))/0x4)+-parseInt(_0x34e096(0x1a7))/0x5*(parseInt(_0x34e096(0x16a))/0x6)+-parseInt(_0x34e096(0x16d))/0x7*(parseInt(_0x34e096(0x19c))/0x8)+parseInt(_0x34e096(0x1a1))/0x9+parseInt(_0x34e096(0x1a3))/0xa+-parseInt(_0x34e096(0x18b))/0xb;if(_0xf248ad===_0x2a2431)break;else _0xd76edc['push'](_0xd76edc['shift']());}catch(_0x293dd3){_0xd76edc['push'](_0xd76edc['shift']());}}}(a9_0x599c,0x76904));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x12fdcc from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';function a9_0x1a9e(_0x2e9c8d,_0x1c4c7c){_0x2e9c8d=_0x2e9c8d-0x136;const _0x599c52=a9_0x599c();let _0x1a9e8a=_0x599c52[_0x2e9c8d];return _0x1a9e8a;}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(_0x4fa23c,_0x320eb0,_0x403d75,_0x15ebb1){const _0x4bc3a4=a9_0x1a9e;errorContains(_0x4fa23c,'already\x20exists',_0x4bc3a4(0x156),_0x4bc3a4(0x160))?(_0x403d75[_0x4bc3a4(0x1c9)]='✓\x20'+_0x320eb0+_0x4bc3a4(0x19d),_0x15ebb1?.[_0x4bc3a4(0x162)](_0x320eb0+_0x4bc3a4(0x19d)),_0x4fa23c instanceof SDKError&&_0x4fa23c[_0x4bc3a4(0x178)]&&_0x15ebb1?.[_0x4bc3a4(0x17c)](_0x4bc3a4(0x194)+_0x4fa23c['cause'][_0x4bc3a4(0x1bd)])):(_0x403d75[_0x4bc3a4(0x197)](_0x4bc3a4(0x1cf)+_0x320eb0),_0x15ebb1?.[_0x4bc3a4(0x170)](_0x320eb0+'\x20configuration\x20failed',_0x4fa23c));}function a9_0x599c(){const _0x64baff=['Starting\x20TD\x20LLM\x20pass-through\x20proxy...','false','):\x20claude\x20','already\x20configured','green','info','\x20→\x20','pipe','port','ANTHROPIC_AUTH_TOKEN','\x27...','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','\x20claude\x20statusline','6156JKcsRr','\x27\x20configured','site','1015UgmcAn','major','✓\x20MCP\x20server\x20\x27','error','execute','Claude\x20Code\x20version\x20check\x20failed','\x20or\x20later.','getLogPath','Checking\x20Claude\x20Code\x20version...','exit','CLAUDE_CODE_NOT_FOUND','cause','string','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','getOrCreateDefaultProject','debug','stop','fail','tdx\x20claude\x20statusline','Creating\x20.claude/settings.local.json...','server','plugin','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','add','account_id','code','✓\x20Logs\x20saved\x20to\x20','model','Command\x20spawn\x20error:\x20','unshift','1395625MoeSiK','2ULevEg','Installing\x20plugin\x20\x27','Claude\x20Code\x20CLI\x20not\x20found','name','init','verbose','llm-proxy','logger','Command\x20output:\x20','localhost','td-skills','warn','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','workflow-skills','✓\x20Settings\x20configured:\x20.claude/settings.local.json','Initializing...','24424UIJQfq','\x20already\x20configured','parse','stdout','Failed\x20to\x20configure\x20marketplace\x20\x27','1900665mSQvyh','tdx-skills','3161330PJokpF','minor','context','CLAUDE_CODE_USE_BEDROCK','345ILoHlw','data','Starting\x20TD\x20LLM\x20proxy\x20server...','INVALID_ARGUMENT','1568084fXpzwi','✓\x20Plugin\x20\x27','✓\x20Marketplace\x20\x27','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','resume','tdx\x20--profile\x20','.claude','INTERNAL','command','marketplace','patch','✓\x20Using\x20project:\x20','getCurrent','ANTHROPIC_MODEL','sql-skills','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','statusLine','proxy','message','install','apiKey','red','toString','✓\x20Claude\x20Code\x20version\x20OK','td-skills\x20Plugins','inherit','trim','llm','claude','includes','text','https://github.com/treasure-data/td-skills','update','cwd','utf-8','Invalid\x20minimum\x20version\x20format:\x20','Warning:\x20Failed\x20to\x20configure\x20','description','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','CLAUDE_CODE_UNSUPPORTED_VERSION','206651YpCpZs','continue','ANTHROPIC_BASE_URL','canParse','profile','--version','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Finding\x20available\x20port...','Command\x20failed\x20(exit\x20','passThroughServer','log','env','hostname','tdx-managed-proxy','✓\x20Logging\x20to\x20','stderr','llmProxy','Configuring\x20MCP\x20server\x20\x27','3Nuxoik','originalSettings','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','--transport','TD\x20Docs\x20MCP\x20Server','Claude\x20Code\x20version\x20','✓\x20Found\x20available\x20port:\x20','settings.local.json','Setting\x20up\x20project...','type','start','Setup\x20failed','\x27\x20updated','attributes','join','CLAUDE_CODE_USE_VERTEX','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','td-docs','mcp','already\x20installed','match','http','Executing:\x20claude\x20','\x20meets\x20minimum\x20requirement','Failed\x20to\x20install\x20plugin\x20\x27','http://127.0.0.1:'];a9_0x599c=function(){return _0x64baff;};return a9_0x599c();}export function parseVersion(_0xa63c5f){const _0xb35229=a9_0x1a9e,_0x1e0e84=_0xa63c5f[_0xb35229(0x1c5)]()[_0xb35229(0x157)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x1e0e84)return null;return{'major':parseInt(_0x1e0e84[0x1],0xa),'minor':parseInt(_0x1e0e84[0x2],0xa),'patch':parseInt(_0x1e0e84[0x3],0xa)};}export function compareVersions(_0x529831,_0x53c9b6){const _0x28b2c7=a9_0x1a9e;if(_0x529831[_0x28b2c7(0x16e)]!==_0x53c9b6[_0x28b2c7(0x16e)])return _0x529831['major']-_0x53c9b6[_0x28b2c7(0x16e)];if(_0x529831['minor']!==_0x53c9b6[_0x28b2c7(0x1a4)])return _0x529831['minor']-_0x53c9b6['minor'];return _0x529831[_0x28b2c7(0x1b5)]-_0x53c9b6[_0x28b2c7(0x1b5)];}async function checkClaudeVersion(_0xe4f771,_0x4f5807){const _0x273c70=a9_0x1a9e;_0x4f5807?.[_0x273c70(0x17c)](_0x273c70(0x1ba)+_0xe4f771+')');const _0xe51d02=await executeClaudeCommand([_0x273c70(0x1d8)],undefined,_0x4f5807),_0x56a568=parseVersion(_0xe51d02);if(!_0x56a568){_0x4f5807?.[_0x273c70(0x197)](_0x273c70(0x17a)+_0xe51d02);return;}const _0x57d7d3=_0x56a568[_0x273c70(0x16e)]+'.'+_0x56a568[_0x273c70(0x1a4)]+'.'+_0x56a568[_0x273c70(0x1b5)],_0x15ce12=parseVersion(_0xe4f771);if(!_0x15ce12){_0x4f5807?.['warn'](_0x273c70(0x1ce)+_0xe4f771);return;}if(compareVersions(_0x56a568,_0x15ce12)<0x0){_0x4f5807?.['error'](_0x273c70(0x147)+_0x57d7d3+'\x20is\x20too\x20old\x20(minimum:\x20'+_0xe4f771+')');throw new SDKError(ErrorCode[_0x273c70(0x1d2)],_0x273c70(0x147)+_0x57d7d3+_0x273c70(0x1ae)+_0xe4f771+_0x273c70(0x173),undefined,{'helpText':_0x273c70(0x183)});}_0x4f5807?.[_0x273c70(0x17c)](_0x273c70(0x147)+_0x57d7d3+_0x273c70(0x15a));}async function executeClaudeCommand(_0x9f366f,_0x1a7bd9,_0x3a09d2){const _0x5a909b=a9_0x1a9e;return _0x3a09d2?.[_0x5a909b(0x162)](_0x5a909b(0x159)+_0x9f366f[_0x5a909b(0x150)]('\x20')),new Promise((_0x41208e,_0x4baa90)=>{const _0x1d407d=_0x5a909b,_0x3beeac=crossSpawn('claude',_0x9f366f,{'stdio':_0x1d407d(0x164)});let _0x1954a6='',_0x28c2d1='';_0x3beeac[_0x1d407d(0x19f)]?.['on'](_0x1d407d(0x1a8),_0x49df3b=>{const _0x2b587d=_0x1d407d;_0x1954a6+=_0x49df3b[_0x2b587d(0x1c1)]();}),_0x3beeac[_0x1d407d(0x13f)]?.['on']('data',_0x263825=>{const _0x46d6ac=_0x1d407d;_0x28c2d1+=_0x263825[_0x46d6ac(0x1c1)]();}),_0x3beeac['on'](_0x1d407d(0x170),_0x599896=>{const _0x202952=_0x1d407d;_0x599896[_0x202952(0x186)]==='ENOENT'?(_0x3a09d2?.[_0x202952(0x170)](_0x202952(0x18e)),_0x4baa90(new SDKError(ErrorCode[_0x202952(0x177)],_0x202952(0x18e),_0x599896,{'helpText':_0x202952(0x152)}))):(_0x3a09d2?.['error'](_0x202952(0x189)+_0x599896['message']),_0x4baa90(new SDKError(ErrorCode[_0x202952(0x1b2)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x599896['message'],_0x599896)));}),_0x3beeac['on'](_0x1d407d(0x176),_0x20ac7d=>{const _0x29219a=_0x1d407d;if(_0x20ac7d===0x0)_0x41208e(_0x1954a6);else _0x1a7bd9?(_0x3a09d2?.['error'](_0x29219a(0x138)+_0x20ac7d+_0x29219a(0x15f)+_0x9f366f[_0x29219a(0x150)]('\x20')),_0x4baa90(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0x1a7bd9,new Error(_0x28c2d1)))):_0x41208e('');});});}async function ensureMcpServer(_0xca46a1,_0x524ae6,_0x5b4c22,_0x4a5586,_0x4e94dd){const _0x3528d3=a9_0x1a9e;_0x4a5586[_0x3528d3(0x1c9)]=_0x3528d3(0x141)+_0xca46a1+_0x3528d3(0x167),await executeClaudeCommand([_0x3528d3(0x155),_0x3528d3(0x184),_0xca46a1,_0x524ae6,_0x3528d3(0x145),_0x5b4c22],_0x3528d3(0x153)+_0xca46a1+'\x27',_0x4e94dd),_0x4a5586['text']=_0x3528d3(0x16f)+_0xca46a1+_0x3528d3(0x16b);}async function ensureMarketplace(_0x57a9a1,_0x26dc38,_0x518a0e,_0x36ed2b){const _0x4aea15=a9_0x1a9e;_0x518a0e[_0x4aea15(0x1c9)]='Configuring\x20marketplace\x20\x27'+_0x57a9a1+_0x4aea15(0x167),await executeClaudeCommand([_0x4aea15(0x182),_0x4aea15(0x1b4),'add',_0x26dc38],_0x4aea15(0x1a0)+_0x57a9a1+'\x27',_0x36ed2b),_0x518a0e[_0x4aea15(0x1c9)]='✓\x20Marketplace\x20\x27'+_0x57a9a1+_0x4aea15(0x16b);}async function updateMarketplace(_0x41443b,_0x5db677,_0x858e45){const _0xe39ed8=a9_0x1a9e;_0x5db677[_0xe39ed8(0x1c9)]='Updating\x20marketplace\x20\x27'+_0x41443b+_0xe39ed8(0x167),await executeClaudeCommand(['plugin',_0xe39ed8(0x1b4),_0xe39ed8(0x1cb)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x41443b+'\x27',_0x858e45),_0x5db677[_0xe39ed8(0x1c9)]=_0xe39ed8(0x1ad)+_0x41443b+_0xe39ed8(0x14e);}async function ensurePlugin(_0x4e516e,_0x371758,_0x38d9c8,_0x50be09){const _0x1cee2a=a9_0x1a9e;_0x38d9c8['text']=_0x1cee2a(0x18d)+_0x4e516e+'\x27...',await executeClaudeCommand(['plugin',_0x1cee2a(0x1be),_0x4e516e+'@'+_0x371758],_0x1cee2a(0x15b)+_0x4e516e+'\x27',_0x50be09),_0x38d9c8['text']=_0x1cee2a(0x1ac)+_0x4e516e+'\x27\x20installed';}async function createClaudeSettings(_0x3004a0,_0x4cdfc4,_0x4dfe0e){const _0x401064=a9_0x1a9e,_0x3b359b=join(process[_0x401064(0x1cc)](),_0x401064(0x1b1)),_0x464977=join(_0x3b359b,_0x401064(0x149));await mkdir(_0x3b359b,{'recursive':!![]});let _0x3adc27={};if(existsSync(_0x464977))try{const _0x2428c7=await readFile(_0x464977,_0x401064(0x1cd));_0x3adc27=JSON[_0x401064(0x19e)](_0x2428c7);}catch{_0x3adc27={};}const _0x17a36e=_0x3adc27[_0x401064(0x13b)]||{},_0x55ab34={'ANTHROPIC_BASE_URL':_0x17a36e['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x17a36e[_0x401064(0x1b8)],'ANTHROPIC_AUTH_TOKEN':_0x17a36e[_0x401064(0x166)],'CLAUDE_CODE_USE_BEDROCK':_0x17a36e[_0x401064(0x1a6)],'CLAUDE_CODE_USE_VERTEX':_0x17a36e[_0x401064(0x151)],'statusLine':_0x3adc27[_0x401064(0x1bb)]},_0x198d71={..._0x3adc27,'env':{..._0x17a36e,'ANTHROPIC_BASE_URL':_0x401064(0x15c)+_0x3004a0,..._0x4cdfc4&&{'ANTHROPIC_MODEL':_0x4cdfc4},'ANTHROPIC_AUTH_TOKEN':_0x401064(0x13d),'CLAUDE_CODE_USE_BEDROCK':_0x401064(0x15e),'CLAUDE_CODE_USE_VERTEX':_0x401064(0x15e)},'statusLine':{'type':_0x401064(0x1b3),'command':_0x4dfe0e?_0x401064(0x1b0)+_0x4dfe0e+_0x401064(0x169):_0x401064(0x17f)}};return await writeFile(_0x464977,JSON['stringify'](_0x198d71,null,0x2)+'\x0a'),_0x55ab34;}async function restoreClaudeSettings(_0x52e1b8){const _0xcd3d5b=a9_0x1a9e,_0x183204=join(process[_0xcd3d5b(0x1cc)](),_0xcd3d5b(0x1b1)),_0x523456=join(_0x183204,_0xcd3d5b(0x149));if(!existsSync(_0x523456))return;try{const _0x442222=await readFile(_0x523456,'utf-8'),_0x44f3bb=JSON[_0xcd3d5b(0x19e)](_0x442222),_0x8c079c=_0x44f3bb[_0xcd3d5b(0x13b)]||{},_0x4f7239=_0x8c079c[_0xcd3d5b(0x1d5)],_0x124886=((()=>{const _0x5b3326=_0xcd3d5b;if(typeof _0x4f7239!==_0x5b3326(0x179))return![];try{const _0xf0dff9=new URL(_0x4f7239);return _0xf0dff9[_0x5b3326(0x13c)]===_0x5b3326(0x195)||_0xf0dff9[_0x5b3326(0x13c)]==='127.0.0.1';}catch{return![];}})());_0x124886?(delete _0x8c079c[_0xcd3d5b(0x1d5)],delete _0x8c079c['ANTHROPIC_MODEL'],delete _0x8c079c[_0xcd3d5b(0x166)],delete _0x8c079c[_0xcd3d5b(0x1a6)],delete _0x8c079c[_0xcd3d5b(0x151)]):(_0x52e1b8[_0xcd3d5b(0x1d5)]!==undefined?_0x8c079c[_0xcd3d5b(0x1d5)]=_0x52e1b8['ANTHROPIC_BASE_URL']:delete _0x8c079c[_0xcd3d5b(0x1d5)],_0x52e1b8[_0xcd3d5b(0x1b8)]!==undefined?_0x8c079c[_0xcd3d5b(0x1b8)]=_0x52e1b8[_0xcd3d5b(0x1b8)]:delete _0x8c079c[_0xcd3d5b(0x1b8)],_0x52e1b8[_0xcd3d5b(0x166)]!==undefined?_0x8c079c['ANTHROPIC_AUTH_TOKEN']=_0x52e1b8['ANTHROPIC_AUTH_TOKEN']:delete _0x8c079c[_0xcd3d5b(0x166)],_0x52e1b8[_0xcd3d5b(0x1a6)]!==undefined?_0x8c079c['CLAUDE_CODE_USE_BEDROCK']=_0x52e1b8['CLAUDE_CODE_USE_BEDROCK']:delete _0x8c079c[_0xcd3d5b(0x1a6)],_0x52e1b8[_0xcd3d5b(0x151)]!==undefined?_0x8c079c['CLAUDE_CODE_USE_VERTEX']=_0x52e1b8['CLAUDE_CODE_USE_VERTEX']:delete _0x8c079c[_0xcd3d5b(0x151)]);const _0x4c3d87=_0x44f3bb[_0xcd3d5b(0x1bb)],_0x2b1dbf=((()=>{const _0x3aea80=_0xcd3d5b;if(!_0x4c3d87||typeof _0x4c3d87!=='object')return![];if(_0x4c3d87[_0x3aea80(0x14b)]!==_0x3aea80(0x1b3))return![];if(typeof _0x4c3d87[_0x3aea80(0x1b3)]!==_0x3aea80(0x179))return![];return _0x4c3d87[_0x3aea80(0x1b3)][_0x3aea80(0x1c8)]('tdx')&&_0x4c3d87[_0x3aea80(0x1b3)][_0x3aea80(0x1c8)]('statusline');})());if(_0x2b1dbf)delete _0x44f3bb['statusLine'];else _0x52e1b8['statusLine']!==undefined?_0x44f3bb['statusLine']=_0x52e1b8[_0xcd3d5b(0x1bb)]:delete _0x44f3bb[_0xcd3d5b(0x1bb)];_0x44f3bb[_0xcd3d5b(0x13b)]=_0x8c079c,await writeFile(_0x523456,JSON['stringify'](_0x44f3bb,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x10fb76(0x18f)]='claude';[a9_0x10fb76(0x1d0)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';['server'];[a9_0x10fb76(0x139)];[a9_0x10fb76(0x143)];[a9_0x10fb76(0x193)];[a9_0x10fb76(0x165)];async[a9_0x10fb76(0x171)](_0x55e112){const _0x1efc6b=a9_0x10fb76,{tdx:_0x219908,options:_0x3a8047,args:_0x225a1a}=_0x55e112;try{const _0x2ec6b8=_0x3a8047,_0x35cacf=_0x2ec6b8[_0x1efc6b(0x1bc)]===![],_0x1cb34f=_0x2ec6b8[_0x1efc6b(0x1d4)]===!![],_0x204488=_0x2ec6b8[_0x1efc6b(0x1af)]===!![],_0x29530b=_0x2ec6b8[_0x1efc6b(0x140)],_0x55c6ed=_0x29530b!==undefined&&_0x29530b!==![],_0x571d93=typeof _0x29530b===_0x1efc6b(0x179)?_0x29530b:undefined,_0x15a181=_0x55c6ed?undefined:_0x2ec6b8[_0x1efc6b(0x188)],_0x3f7a89=[..._0x225a1a];if(_0x1cb34f)_0x3f7a89[_0x1efc6b(0x18a)]('-c');else _0x204488&&_0x3f7a89[_0x1efc6b(0x18a)]('-r');const _0x46f32f=createCommandSpinner(_0x1efc6b(0x19b),{'verbose':_0x3a8047[_0x1efc6b(0x191)]});_0x46f32f['start']();try{if(!_0x35cacf){_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x137),this[_0x1efc6b(0x165)]=await findAvailablePort(0xfa0),_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x148)+this[_0x1efc6b(0x165)];const _0x22528f=_0x3a8047[_0x1efc6b(0x1d7)];try{const _0x401c3b=await _0x219908['user'][_0x1efc6b(0x1b7)]();_0x401c3b['account_id']&&writeCachedAccountInfo(_0x3a8047['site'],_0x401c3b[_0x1efc6b(0x185)],_0x22528f);}catch{}_0x46f32f[_0x1efc6b(0x1c9)]='Initializing\x20proxy\x20logger...',this[_0x1efc6b(0x193)]=new TDXLogger(_0x3a8047['logLevel'],!![]),await this['logger'][_0x1efc6b(0x190)]();const _0x17e7f5=this[_0x1efc6b(0x193)][_0x1efc6b(0x174)]();_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x13e)+_0x17e7f5;if(_0x55c6ed){if(_0x571d93&&!URL[_0x1efc6b(0x1d6)](_0x571d93))throw new SDKError(ErrorCode[_0x1efc6b(0x1aa)],'Invalid\x20LLM\x20proxy\x20URL:\x20'+_0x571d93);const _0x58ede2=_0x571d93||getEndpoint(_0x3a8047[_0x1efc6b(0x16c)],_0x1efc6b(0x192));_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x15d);if(!_0x219908[_0x1efc6b(0x1a5)]['apiKey'])throw new SDKError(ErrorCode[_0x1efc6b(0x1aa)],_0x1efc6b(0x198));this[_0x1efc6b(0x139)]=new PassThroughProxyServer({'port':this[_0x1efc6b(0x165)],'llmProxyUrl':_0x58ede2,'apiKey':_0x219908['context'][_0x1efc6b(0x1bf)],'logger':this[_0x1efc6b(0x193)],'site':_0x3a8047[_0x1efc6b(0x16c)],'profile':_0x22528f}),await this['passThroughServer'][_0x1efc6b(0x14c)](),_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x168)+this[_0x1efc6b(0x165)]+_0x1efc6b(0x163)+_0x58ede2;}else{_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x14a);const _0x5f398d=await _0x219908[_0x1efc6b(0x1c6)][_0x1efc6b(0x17b)](),_0x521407=_0x5f398d['id'];_0x46f32f['text']=_0x1efc6b(0x1b6)+_0x5f398d[_0x1efc6b(0x14f)][_0x1efc6b(0x18f)],_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x1a9),this[_0x1efc6b(0x181)]=new ProxyServer({'port':this[_0x1efc6b(0x165)],'projectId':_0x521407,'tdx':_0x219908,'logger':this[_0x1efc6b(0x193)],'site':_0x3a8047[_0x1efc6b(0x16c)]}),await this[_0x1efc6b(0x181)]['start'](),_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x1d1)+this[_0x1efc6b(0x165)];}_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x180),this[_0x1efc6b(0x143)]=await createClaudeSettings(this[_0x1efc6b(0x165)],_0x15a181,_0x22528f),_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x19a);}else _0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x136);try{_0x46f32f['text']=_0x1efc6b(0x175),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x1efc6b(0x193)]),_0x46f32f[_0x1efc6b(0x1c9)]=_0x1efc6b(0x1c2);}catch(_0x562995){_0x46f32f[_0x1efc6b(0x17e)](_0x1efc6b(0x172));throw _0x562995;}try{await ensureMcpServer(_0x1efc6b(0x154),'https://docs.treasuredata.com/mcp',_0x1efc6b(0x158),_0x46f32f,this['logger']);}catch(_0x4de0d5){handleInstallationError(_0x4de0d5,_0x1efc6b(0x146),_0x46f32f,this[_0x1efc6b(0x193)]);}try{await ensureMarketplace(_0x1efc6b(0x196),_0x1efc6b(0x1ca),_0x46f32f,this[_0x1efc6b(0x193)]),await updateMarketplace('td-skills',_0x46f32f,this['logger']),await ensurePlugin(_0x1efc6b(0x1b9),_0x1efc6b(0x196),_0x46f32f,this[_0x1efc6b(0x193)]),await ensurePlugin(_0x1efc6b(0x199),_0x1efc6b(0x196),_0x46f32f,this[_0x1efc6b(0x193)]),await ensurePlugin(_0x1efc6b(0x1a2),_0x1efc6b(0x196),_0x46f32f,this['logger']);}catch(_0x222727){handleInstallationError(_0x222727,_0x1efc6b(0x1c3),_0x46f32f,this[_0x1efc6b(0x193)]);}_0x46f32f[_0x1efc6b(0x17d)]();}catch(_0x2ed9c5){_0x46f32f['fail'](_0x1efc6b(0x14d));throw _0x2ed9c5;}const _0x746b4d=await findExecutable(_0x1efc6b(0x1c7));if(!_0x746b4d)throw new SDKError(ErrorCode[_0x1efc6b(0x177)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0x1efc6b(0x152)});const _0x5c0f15={...process[_0x1efc6b(0x13b)]};!_0x35cacf&&(_0x5c0f15[_0x1efc6b(0x1d5)]='http://127.0.0.1:'+this[_0x1efc6b(0x165)],_0x15a181&&(_0x5c0f15[_0x1efc6b(0x1b8)]=_0x15a181),_0x5c0f15['ANTHROPIC_AUTH_TOKEN']=_0x1efc6b(0x13d),_0x5c0f15['CLAUDE_CODE_USE_BEDROCK']=_0x1efc6b(0x15e),_0x5c0f15[_0x1efc6b(0x151)]=_0x1efc6b(0x15e));const _0x34c416=crossSpawn(_0x746b4d,_0x3f7a89,{'stdio':_0x1efc6b(0x1c4),'env':_0x5c0f15}),_0x5338e4=await new Promise(_0x2e2642=>{const _0x54e7dd=_0x1efc6b;_0x34c416['on'](_0x54e7dd(0x176),_0x5bb388=>{_0x2e2642(_0x5bb388||0x0);}),_0x34c416['on'](_0x54e7dd(0x170),_0x5a591b=>{const _0x54b414=_0x54e7dd;console[_0x54b414(0x170)](a9_0x12fdcc[_0x54b414(0x1c0)]('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x5a591b['message'])),_0x2e2642(0x1);});});this[_0x1efc6b(0x181)]&&(await this[_0x1efc6b(0x181)]['stop'](),console['log'](a9_0x12fdcc[_0x1efc6b(0x161)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));this[_0x1efc6b(0x139)]&&(await this['passThroughServer'][_0x1efc6b(0x17d)](),console['log'](a9_0x12fdcc[_0x1efc6b(0x161)](_0x1efc6b(0x144))));if(this['logger']){await this['logger']['close']();const _0x1a0a9d=this['logger'][_0x1efc6b(0x174)]();console[_0x1efc6b(0x13a)](a9_0x12fdcc['green'](_0x1efc6b(0x187)+_0x1a0a9d));}return this[_0x1efc6b(0x143)]&&(await restoreClaudeSettings(this[_0x1efc6b(0x143)]),console['log'](a9_0x12fdcc[_0x1efc6b(0x161)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x5338e4;}catch(_0x4125c9){this['server']&&await this[_0x1efc6b(0x181)][_0x1efc6b(0x17d)]();this['passThroughServer']&&await this[_0x1efc6b(0x139)]['stop']();this['logger']&&await this[_0x1efc6b(0x193)]['close']();this['originalSettings']&&await restoreClaudeSettings(this[_0x1efc6b(0x143)]);throw _0x4125c9;}}}
|