@treasuredata/tdx 0.16.2 → 0.16.4
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.d.ts +3 -0
- package/dist/commands/mcp-command.d.ts.map +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/mcp-command.js.map +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.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.d.ts +9 -0
- package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/environment.js.map +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a3_0x2b7a9a=a3_0x5100;(function(_0x5f095e,_0x3eb200){const _0x3d4de5=a3_0x5100,_0x5e980e=_0x5f095e();while(!![]){try{const _0x399397=-parseInt(_0x3d4de5(0x172))/0x1+-parseInt(_0x3d4de5(0x16b))/0x2+-parseInt(_0x3d4de5(0x154))/0x3*(-parseInt(_0x3d4de5(0x15e))/0x4)+-parseInt(_0x3d4de5(0x171))/0x5*(parseInt(_0x3d4de5(0x162))/0x6)+-parseInt(_0x3d4de5(0x152))/0x7*(parseInt(_0x3d4de5(0x175))/0x8)+parseInt(_0x3d4de5(0x174))/0x9+-parseInt(_0x3d4de5(0x158))/0xa*(-parseInt(_0x3d4de5(0x165))/0xb);if(_0x399397===_0x3eb200)break;else _0x5e980e['push'](_0x5e980e['shift']());}catch(_0x2fff75){_0x5e980e['push'](_0x5e980e['shift']());}}}(a3_0x1b2f,0x877ea));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_0x5100(_0x175139,_0x1e23d3){_0x175139=_0x175139-0x152;const _0x1b2f24=a3_0x1b2f();let _0x51008a=_0x1b2f24[_0x175139];return _0x51008a;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a3_0x1b2f(){const _0x44106c=['7637ROApUe','Parent\x20name:\x20','1289559abPYEd','data','execute','\x20activation','270eERxzY','Error:\x20','listActivations','✔\x20Found\x20','List\x20activations\x20for\x20a\x20segment','Resolved\x20parent\x20ID:\x20','4bCqAmK','length','verbose','\x27...','769722CaJakT','error','activations','1248698QxyRMX','resolveParentId','cause','site','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','1060710GZaZtl','Error:\x20Segment\x20name\x20is\x20required','segment','Resolved\x20child\x20ID:\x20','name','message','30lfMFAu','897155xPnOqU','resolveSegmentId','2340072qFeDAn','7352IyWyhr'];a3_0x1b2f=function(){return _0x44106c;};return a3_0x1b2f();}export class ActivationsCommand extends BaseCommand{[a3_0x2b7a9a(0x16f)]=a3_0x2b7a9a(0x164);['description']=a3_0x2b7a9a(0x15c);async[a3_0x2b7a9a(0x156)](_0x29d960){const _0x2baf82=a3_0x2b7a9a,{options:_0x28c454,args:_0x2de274,tdx:_0x44536e}=_0x29d960;if(_0x2de274[_0x2baf82(0x15f)]===0x0)return console['error'](_0x2baf82(0x16c)),console[_0x2baf82(0x163)](_0x2baf82(0x169)),0x1;try{const {parentId:_0x3e5b42,childId:_0xf1a649}=parseSegmentRef(_0x2de274[0x0]);if(!_0xf1a649)return console[_0x2baf82(0x163)](_0x2baf82(0x16a)),console['error'](_0x2baf82(0x169)),0x1;_0x28c454['verbose']&&(console[_0x2baf82(0x163)]('Site:\x20'+_0x28c454[_0x2baf82(0x168)]),console['error'](_0x2baf82(0x153)+_0x3e5b42),console[_0x2baf82(0x163)]('Child\x20name:\x20'+_0xf1a649));const _0x5b0e1a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3e5b42+_0x2baf82(0x161),()=>_0x44536e[_0x2baf82(0x16d)][_0x2baf82(0x166)](_0x3e5b42),{'verbose':_0x28c454[_0x2baf82(0x160)]}),_0x3c2f79=_0x5b0e1a[_0x2baf82(0x155)];_0x28c454[_0x2baf82(0x160)]&&console[_0x2baf82(0x163)](_0x2baf82(0x15d)+_0x3c2f79);const _0x32bf14=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0xf1a649+_0x2baf82(0x161),()=>_0x44536e[_0x2baf82(0x16d)][_0x2baf82(0x173)](_0x3c2f79,_0xf1a649),{'verbose':_0x28c454['verbose']}),_0x52942e=_0x32bf14['data'];_0x28c454[_0x2baf82(0x160)]&&console[_0x2baf82(0x163)](_0x2baf82(0x16e)+_0x52942e);const _0x4a7609=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0xf1a649+_0x2baf82(0x161),()=>_0x44536e[_0x2baf82(0x16d)][_0x2baf82(0x15a)](_0x3c2f79,_0x52942e),{'verbose':_0x28c454['verbose']}),_0x3a6016=_0x4a7609[_0x2baf82(0x155)];return console[_0x2baf82(0x163)](_0x2baf82(0x15b)+_0x3a6016[_0x2baf82(0x15f)]+_0x2baf82(0x157)+(_0x3a6016[_0x2baf82(0x15f)]!==0x1?'s':'')),await handleSDKOutput(_0x3a6016,_0x28c454),0x0;}catch(_0x57d596){if(_0x57d596 instanceof SDKError)return console[_0x2baf82(0x163)](_0x2baf82(0x159)+_0x57d596[_0x2baf82(0x170)]),_0x57d596[_0x2baf82(0x167)]&&console[_0x2baf82(0x163)]('\x20\x20Cause:\x20'+_0x57d596[_0x2baf82(0x167)]),0x1;throw _0x57d596;}}}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
const a4_0x1c3aa5=a4_0x1b7c;(function(_0x2fe5a0,_0x4e31f7){const _0x4beed1=a4_0x1b7c,_0x719e33=_0x2fe5a0();while(!![]){try{const _0x23f640=-parseInt(_0x4beed1(0x1cd))/0x1+-parseInt(_0x4beed1(0x238))/0x2+parseInt(_0x4beed1(0x230))/0x3*(parseInt(_0x4beed1(0x1fd))/0x4)+parseInt(_0x4beed1(0x1d3))/0x5*(parseInt(_0x4beed1(0x1f1))/0x6)+parseInt(_0x4beed1(0x21a))/0x7+parseInt(_0x4beed1(0x202))/0x8+parseInt(_0x4beed1(0x1bd))/0x9*(-parseInt(_0x4beed1(0x24f))/0xa);if(_0x23f640===_0x4e31f7)break;else _0x719e33['push'](_0x719e33['shift']());}catch(_0x4fe6a5){_0x719e33['push'](_0x719e33['shift']());}}}(a4_0x4835,0x94001));import a4_0x3458ff from'chalk';import a4_0x5079e8 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath,resolveProjectFromContext}from'../sdk/agent/agent-config.js';function a4_0x4835(){const _0x5c7a6d=['\x20errors','outputDir','Pulling\x20agent\x20\x22','agent:push','\x20\x20Agent\x20\x22','execute','Analyzing\x20project\x20\x22','Chat:\x20','cloneProject','Clone\x20cancelled','unchanged','Dry\x20run\x20-\x20no\x20changes\x20made','\x20--profile\x20','llm','Using\x20context\x20project:\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','69880RIHKqI','name','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','Agent\x20pulled\x20successfully','Dry\x20run\x20-\x20no\x20files\x20written','context','New\x20project:\x20','\x22\x20to\x20a\x20different\x20profile','message','\x20=\x20','\x22...','found','log','\x20\x20Target:\x20','Agent:\x20','pullProject','join','new','999CEQARO','\x20changed','Using\x20local\x20project:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','yes','Would\x20push\x20agent:\x20','diff','\x20\x20Text\x20Knowledge\x20Bases:\x20','updated','\x20resources?','pullAgent','\x20\x20tdx\x20agent\x20clone\x20agents/','Using\x20current\x20project:\x20','gray','dirname','pushProject','331683YsVYhp','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)','cwd','\x27\x20to\x20create\x20the\x20folder\x20structure.','\x0aPull\x20summary\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','35aRXQiJ','\x0aPush\x20summary\x20for\x20\x27','Project\x20cloned\x20with\x20errors','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','Errors:','\x0aChanges:','Status:\x20','Clone\x20\x22','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','\x20updated','\x20files?','tdx.json','projectName','\x0a✔\x20Pushed\x20','New\x20project\x20ID:\x20','yellow','✔\x20Context\x20set:\x20','Agent\x20','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','dim','error','force','\x22\x20to\x20\x22','Would\x20clone:','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20\x20Knowledge\x20Bases:\x20','textKnowledgeBases','Output\x20path:\x20','agentName','224286aplGPS','outputPath','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20\x20Text\x20Knowledge\x20Base\x20\x22','prompts','\x22\x20from\x20project\x20\x22','projectDir','knowledgeBases','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x20\x20Source:\x20','Using\x20project:\x20','push','4tSAMSQ','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','No\x20tdx.json\x20found\x20in\x20','output','description','8231848Wznstu','Project:\x20','sourceProjectName','reason','\x20\x20Prompts:\x20','llm_project','\x0aPush\x20','\x20new','pushAgent','counts','Push\x20cancelled','created','\x22:\x20','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Source:\x20','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','Cannot\x20clone\x20from\x20context\x20project\x20\x22','\x20unchanged','Project\x20cloned\x20successfully','newProjectId','Cloning\x20\x22','agentId','red','repeat','3367728VMdtCM','MISSING_ARGUMENT','\x20--name\x20','errors','total','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x0aErrors\x20found:','newProjectName','\x20\x20tdx\x20agent\x20pull\x20','utf-8','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','Analyzing\x20changes\x20to\x20push...','\x20successfully','no_context','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','agent:pull','\x0aChanges\x20to\x20agent\x20\x27','New\x20project\x20name\x20is\x20required','profile','dryRun','llmProject','2071926teJnsi','projectId','\x20files\x20to\x20','action','\x0aWrite\x20','\x20|\x20','green','cyan','1497668ZElhQN','Pushing\x20to\x20project...','\x20\x20Agents:\x20','agents','\x22\x20to\x20new\x20project\x20\x22','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','no_local_folder'];a4_0x4835=function(){return _0x5c7a6d;};return a4_0x4835();}import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';function a4_0x1b7c(_0x58acaa,_0x220a0e){_0x58acaa=_0x58acaa-0x1ba;const _0x48359d=a4_0x4835();let _0x1b7c3d=_0x48359d[_0x58acaa];return _0x1b7c3d;}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x340978){const _0x4dc47b=a4_0x1b7c,_0x4dc11a=[];if(_0x340978[_0x4dc47b(0x21e)]!==undefined)_0x4dc11a['push'](_0x340978['total']+'\x20total');if(_0x340978[_0x4dc47b(0x1bc)]!==undefined&&_0x340978[_0x4dc47b(0x1bc)]>0x0)_0x4dc11a[_0x4dc47b(0x1fc)](a4_0x3458ff[_0x4dc47b(0x236)](_0x340978[_0x4dc47b(0x1bc)]+_0x4dc47b(0x209)));if(_0x340978[_0x4dc47b(0x20d)]!==undefined&&_0x340978[_0x4dc47b(0x20d)]>0x0)_0x4dc11a[_0x4dc47b(0x1fc)](a4_0x3458ff['green'](_0x340978['created']+'\x20created'));if(_0x340978[_0x4dc47b(0x1c5)]!==undefined&&_0x340978[_0x4dc47b(0x1c5)]>0x0)_0x4dc11a['push'](a4_0x3458ff[_0x4dc47b(0x1e3)](_0x340978[_0x4dc47b(0x1c5)]+_0x4dc47b(0x1dd)));if(_0x340978['unchanged']!==undefined&&_0x340978[_0x4dc47b(0x249)]>0x0)_0x4dc11a[_0x4dc47b(0x1fc)](a4_0x3458ff[_0x4dc47b(0x1ca)](_0x340978[_0x4dc47b(0x249)]+_0x4dc47b(0x213)));if(_0x340978['errors']!==undefined&&_0x340978[_0x4dc47b(0x21d)]>0x0)_0x4dc11a[_0x4dc47b(0x1fc)](a4_0x3458ff[_0x4dc47b(0x218)](_0x340978[_0x4dc47b(0x21d)]+_0x4dc47b(0x23f)));return _0x4dc11a['join'](',\x20');}function displayDiffs(_0x33029d,_0x59380e,_0xba66c,_0x19603b){const _0x4a0af4=a4_0x1b7c;for(const _0x41f4c6 of _0x33029d){if(_0x41f4c6[_0x4a0af4(0x1c3)]){const _0x52e7ba=_0x41f4c6['agentName']||_0x41f4c6[_0x4a0af4(0x250)];console['log'](_0x4a0af4(0x22b)+_0x52e7ba+'\x27:'),console[_0x4a0af4(0x25b)]('─'['repeat'](0x3c)),console[_0x4a0af4(0x25b)](_0x41f4c6['diff']),console['log']('─'[_0x4a0af4(0x219)](0x3c));}}for(const _0x538e1f of _0x59380e){_0x538e1f['diff']&&(console[_0x4a0af4(0x25b)]('\x0aChanges\x20to\x20knowledge\x20base\x20\x27'+_0x538e1f[_0x4a0af4(0x250)]+'\x27:'),console[_0x4a0af4(0x25b)]('─'[_0x4a0af4(0x219)](0x3c)),console[_0x4a0af4(0x25b)](_0x538e1f[_0x4a0af4(0x1c3)]),console[_0x4a0af4(0x25b)]('─'[_0x4a0af4(0x219)](0x3c)));}for(const _0x568840 of _0xba66c){_0x568840[_0x4a0af4(0x1c3)]&&(console['log'](_0x4a0af4(0x1e6)+_0x568840[_0x4a0af4(0x250)]+'\x27:'),console[_0x4a0af4(0x25b)]('─'[_0x4a0af4(0x219)](0x3c)),console['log'](_0x568840['diff']),console['log']('─'['repeat'](0x3c)));}for(const _0x3c26ee of _0x19603b){_0x3c26ee['diff']&&(console['log']('\x0aChanges\x20to\x20prompt\x20\x27'+_0x3c26ee[_0x4a0af4(0x250)]+'\x27:'),console[_0x4a0af4(0x25b)]('─'[_0x4a0af4(0x219)](0x3c)),console[_0x4a0af4(0x25b)](_0x3c26ee[_0x4a0af4(0x1c3)]),console['log']('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x1c3aa5(0x250)]=a4_0x1c3aa5(0x22a);[a4_0x1c3aa5(0x201)]=a4_0x1c3aa5(0x24e);async[a4_0x1c3aa5(0x244)](_0x537987){const _0x30b69e=a4_0x1c3aa5,{options:_0x2a36d2,args:_0x3c204f,tdx:_0x5a1b81}=_0x537987,_0x6561cd=_0x3c204f[0x0],_0x29c527=_0x3c204f[0x1],_0x330eff=_0x2a36d2[_0x30b69e(0x200)],_0x519802=_0x2a36d2[_0x30b69e(0x22e)],_0x33ab13=_0x2a36d2['force'],_0xc08e9d=_0x2a36d2[_0x30b69e(0x1c1)],_0x52b6e1=_0x2a36d2['llmProject'];let _0x5c1d38,_0xf8fe9;const _0x30aee1=findAgentConfigPath(process['cwd']());if(_0x6561cd){const _0x101263=a4_0x5079e8[_0x30b69e(0x1bb)](_0x6561cd,'tdx.json');if(existsSync(_0x101263))try{const _0x324b17=JSON['parse'](readFileSync(_0x101263,_0x30b69e(0x223)));_0x5c1d38=_0x324b17[_0x30b69e(0x207)],_0xf8fe9=_0x6561cd,console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x1e7)]('Using\x20project\x20from\x20'+_0x101263+':\x20'+_0x5c1d38));}catch{_0x5c1d38=_0x6561cd;}else _0x5c1d38=_0x6561cd;}else{if(_0x30aee1)try{const _0x36a27c=JSON['parse'](readFileSync(_0x30aee1,_0x30b69e(0x223)));_0x5c1d38=_0x36a27c[_0x30b69e(0x207)],_0xf8fe9=a4_0x5079e8[_0x30b69e(0x1cb)](_0x30aee1),console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x1e7)](_0x30b69e(0x1fb)+_0x5c1d38));}catch{_0x5c1d38=_0x52b6e1;}else _0x5c1d38=_0x52b6e1;}if(!_0x5c1d38)return console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x1e3)]('llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x30b69e(0x25b)](_0x30b69e(0x1ce)),console[_0x30b69e(0x25b)](_0x30b69e(0x1d2)),console[_0x30b69e(0x25b)]('\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[_0x30b69e(0x25b)](_0x30b69e(0x1c0)),0x1;if(_0x29c527){const {data:_0x3d7c3b}=await withSpinner(_0x30b69e(0x241)+_0x29c527+_0x30b69e(0x1f6)+_0x5c1d38+_0x30b69e(0x259),()=>_0x5a1b81['llm'][_0x30b69e(0x1c7)](_0x5c1d38,_0x29c527,_0x330eff,{'dryRun':_0x519802,'force':_0x33ab13}));if(_0x519802)return console[_0x30b69e(0x25b)](a4_0x3458ff['yellow'](_0x30b69e(0x253))),console[_0x30b69e(0x25b)]('Would\x20pull\x20agent:\x20'+_0x3d7c3b[_0x30b69e(0x1f0)]),console[_0x30b69e(0x25b)](_0x30b69e(0x1ef)+_0x3d7c3b[_0x30b69e(0x1f2)]),_0x3d7c3b[_0x30b69e(0x1c3)]&&(console['log'](_0x30b69e(0x1d8)),console[_0x30b69e(0x25b)]('─'[_0x30b69e(0x219)](0x3c)),console[_0x30b69e(0x25b)](_0x3d7c3b[_0x30b69e(0x1c3)]),console['log']('─'[_0x30b69e(0x219)](0x3c))),0x0;return console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x236)](_0x30b69e(0x252))),console[_0x30b69e(0x25b)]('Agent:\x20'+_0x3d7c3b[_0x30b69e(0x1f0)]),console['log']('Output:\x20'+_0x3d7c3b[_0x30b69e(0x1f2)]),console['log'](_0x30b69e(0x1d9)+(_0x3d7c3b['isNew']?a4_0x3458ff[_0x30b69e(0x236)]('new'):_0x3d7c3b['hasChanges']?a4_0x3458ff[_0x30b69e(0x1e3)](_0x30b69e(0x1c5)):a4_0x3458ff[_0x30b69e(0x1ca)](_0x30b69e(0x249)))),0x0;}const _0x2a8f15=_0xf8fe9||_0x330eff,{data:_0x4fbd17}=await withSpinner(_0x30b69e(0x245)+_0x5c1d38+_0x30b69e(0x259),()=>_0x5a1b81[_0x30b69e(0x24c)]['pullProject'](_0x5c1d38,_0x2a8f15,{'dryRun':!![]})),_0x18162d=_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x23b)][_0x30b69e(0x1bc)]+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1f8)][_0x30b69e(0x1bc)]+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1ee)][_0x30b69e(0x1bc)]+_0x4fbd17[_0x30b69e(0x20b)]['prompts'][_0x30b69e(0x1bc)],_0x13bb16=_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x23b)]['updated']+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1f8)][_0x30b69e(0x1c5)]+_0x4fbd17[_0x30b69e(0x20b)]['textKnowledgeBases']['updated']+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1f5)][_0x30b69e(0x1c5)],_0x35baf6=_0x4fbd17['counts'][_0x30b69e(0x23b)][_0x30b69e(0x249)]+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1f8)][_0x30b69e(0x249)]+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1ee)]['unchanged']+_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1f5)][_0x30b69e(0x249)];console['log'](_0x30b69e(0x1d1)+_0x4fbd17[_0x30b69e(0x1e0)]+'\x27:'),console['log']('\x20\x20'+a4_0x3458ff[_0x30b69e(0x236)]('+\x20'+_0x18162d+_0x30b69e(0x209))+'\x20|\x20'+a4_0x3458ff[_0x30b69e(0x1e3)]('~\x20'+_0x13bb16+_0x30b69e(0x1be))+_0x30b69e(0x235)+a4_0x3458ff[_0x30b69e(0x1e7)]('=\x20'+_0x35baf6+'\x20unchanged')),console[_0x30b69e(0x25b)](_0x30b69e(0x23a)+formatCountSummary(_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x23b)])),console['log'](_0x30b69e(0x1ed)+formatCountSummary(_0x4fbd17[_0x30b69e(0x20b)]['knowledgeBases'])),console['log'](_0x30b69e(0x1c4)+formatCountSummary(_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1ee)])),console[_0x30b69e(0x25b)](_0x30b69e(0x206)+formatCountSummary(_0x4fbd17[_0x30b69e(0x20b)][_0x30b69e(0x1f5)])),console['log'](_0x30b69e(0x25c)+a4_0x3458ff[_0x30b69e(0x237)](_0x4fbd17['outputDir'])),displayDiffs(_0x4fbd17['agents'],_0x4fbd17[_0x30b69e(0x1f8)],_0x4fbd17['textKnowledgeBases'],_0x4fbd17['prompts']);if(_0x519802)return console['log'](a4_0x3458ff[_0x30b69e(0x1e3)](_0x30b69e(0x1f3))),0x0;if(_0x18162d===0x0&&_0x13bb16===0x0)return console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x236)](_0x30b69e(0x224))),saveSessionContext({'llm_project':_0x4fbd17['projectName']},_0x2a36d2['session']),console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x236)](_0x30b69e(0x1e4)+a4_0x3458ff['dim'](_0x30b69e(0x207))+_0x30b69e(0x258)+a4_0x3458ff[_0x30b69e(0x237)](_0x4fbd17[_0x30b69e(0x1e0)]))),0x0;if(!_0xc08e9d&&!_0x33ab13){const _0xbccde6=await confirmKey(_0x30b69e(0x234)+(_0x18162d+_0x13bb16)+_0x30b69e(0x1de));if(!_0xbccde6)return console[_0x30b69e(0x25b)]('Pull\x20cancelled'),0x0;}const {data:_0x129a5e}=await withSpinner('Writing\x20files...',()=>_0x5a1b81[_0x30b69e(0x24c)][_0x30b69e(0x1ba)](_0x5c1d38,_0x2a8f15,{'force':_0x33ab13}));return console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x236)]('\x0a✔\x20Pulled\x20'+(_0x18162d+_0x13bb16)+_0x30b69e(0x232)+_0x129a5e[_0x30b69e(0x240)])),saveSessionContext({'llm_project':_0x129a5e[_0x30b69e(0x1e0)]},_0x2a36d2['session']),console[_0x30b69e(0x25b)](a4_0x3458ff[_0x30b69e(0x236)](_0x30b69e(0x1e4)+a4_0x3458ff[_0x30b69e(0x1e7)](_0x30b69e(0x207))+_0x30b69e(0x258)+a4_0x3458ff[_0x30b69e(0x237)](_0x129a5e[_0x30b69e(0x1e0)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x1c3aa5(0x250)]='agent:clone';['description']=a4_0x1c3aa5(0x211);async[a4_0x1c3aa5(0x244)](_0x26ea1c){const _0x5e161c=a4_0x1c3aa5,{options:_0x211974,args:_0x2392aa,tdx:_0xcc99fa}=_0x26ea1c,_0x5f0eee=_0x2392aa[0x0],_0x5bea10=_0x211974[_0x5e161c(0x250)],_0x4a6e8a=_0x211974['dryRun'],_0x28479d=_0x211974[_0x5e161c(0x1c1)],_0x1d0982=_0x211974['site'],_0x53ba08=_0x211974[_0x5e161c(0x22f)];let _0x361d97;const _0xfb622e=findAgentConfigPath(process[_0x5e161c(0x1cf)]());if(_0x5f0eee){const _0x69eca8=a4_0x5079e8[_0x5e161c(0x1bb)](_0x5f0eee,_0x5e161c(0x1df));existsSync(_0x69eca8)?(_0x361d97=_0x5f0eee,console['log'](a4_0x3458ff[_0x5e161c(0x1e7)](_0x5e161c(0x1bf)+_0x5f0eee))):_0x361d97=_0x5f0eee;}else{if(_0xfb622e)_0x361d97=a4_0x5079e8[_0x5e161c(0x1cb)](_0xfb622e),console[_0x5e161c(0x25b)](a4_0x3458ff[_0x5e161c(0x1e7)](_0x5e161c(0x1c9)+_0x361d97));else{if(_0x53ba08){const _0x148b15=sanitizeForFilesystem(_0x53ba08);let _0x5d8e93=_0x148b15,_0x250491=a4_0x5079e8[_0x5e161c(0x1bb)](process[_0x5e161c(0x1cf)](),_0x5e161c(0x23b),_0x148b15,_0x5e161c(0x1df));if(!existsSync(_0x250491)){const _0x15e83e=normalizeName(_0x53ba08),_0x260131=a4_0x5079e8['join'](process['cwd'](),_0x5e161c(0x23b),_0x15e83e,_0x5e161c(0x1df));existsSync(_0x260131)&&(_0x5d8e93=_0x15e83e,_0x250491=_0x260131);}if(existsSync(_0x250491))_0x361d97=a4_0x5079e8[_0x5e161c(0x1cb)](_0x250491),console[_0x5e161c(0x25b)](a4_0x3458ff[_0x5e161c(0x1e7)](_0x5e161c(0x1bf)+_0x361d97));else{const _0x275fa9=_0x211974[_0x5e161c(0x22d)];if(_0x275fa9)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5e161c(0x212)+_0x53ba08+_0x5e161c(0x256),undefined,{'helpText':_0x5e161c(0x1d6)+_0x5e161c(0x1f9)+(_0x5e161c(0x222)+_0x53ba08+'\x0a')+(_0x5e161c(0x1c8)+_0x5d8e93+_0x5e161c(0x21c)+(_0x5bea10||'<new-name>')+_0x5e161c(0x24b)+_0x275fa9)});_0x361d97=_0x53ba08,console[_0x5e161c(0x25b)](a4_0x3458ff[_0x5e161c(0x1e7)](_0x5e161c(0x24d)+_0x53ba08));}}}}if(!_0x361d97)return console[_0x5e161c(0x25b)](a4_0x3458ff['yellow'](_0x5e161c(0x1ec))),console[_0x5e161c(0x25b)](_0x5e161c(0x1fe)),console[_0x5e161c(0x25b)](_0x5e161c(0x20f)),console[_0x5e161c(0x25b)]('\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)'),console[_0x5e161c(0x25b)](_0x5e161c(0x229)),0x1;if(!_0x5bea10)throw new SDKError(ErrorCode[_0x5e161c(0x21b)],_0x5e161c(0x22c),undefined,{'helpText':_0x5e161c(0x251)});if(!_0x28479d&&!_0x4a6e8a){const _0x3be8e6=await confirmKey(_0x5e161c(0x1da)+_0x361d97+_0x5e161c(0x23c)+_0x5bea10+'\x22?');if(!_0x3be8e6)return console[_0x5e161c(0x25b)](_0x5e161c(0x248)),0x0;}const {data:_0x1c21c6}=await withSpinner(_0x5e161c(0x216)+_0x361d97+_0x5e161c(0x1ea)+_0x5bea10+'\x22...',()=>_0xcc99fa[_0x5e161c(0x24c)][_0x5e161c(0x247)](_0x361d97,_0x5bea10,{'dryRun':_0x4a6e8a}));if(_0x4a6e8a)return console['log'](a4_0x3458ff[_0x5e161c(0x1e3)](_0x5e161c(0x24a))),console[_0x5e161c(0x25b)](_0x5e161c(0x210)+_0x1c21c6[_0x5e161c(0x204)]),console[_0x5e161c(0x25b)]('New\x20project:\x20'+_0x5bea10),console[_0x5e161c(0x25b)](_0x5e161c(0x1eb)),console[_0x5e161c(0x25b)](_0x5e161c(0x23a)+_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x23b)]['created']),console[_0x5e161c(0x25b)](_0x5e161c(0x1ed)+_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x1f8)][_0x5e161c(0x20d)]),console['log'](_0x5e161c(0x206)+_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x1f5)][_0x5e161c(0x20d)]),0x0;const _0x44636d=_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x23b)][_0x5e161c(0x21d)]>0x0||_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x1f8)][_0x5e161c(0x21d)]>0x0||_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x1f5)][_0x5e161c(0x21d)]>0x0;_0x44636d?console['log'](a4_0x3458ff[_0x5e161c(0x1e3)](_0x5e161c(0x1d5))):console[_0x5e161c(0x25b)](a4_0x3458ff['green'](_0x5e161c(0x214)));console[_0x5e161c(0x25b)](_0x5e161c(0x210)+_0x1c21c6['sourceProjectName']),console[_0x5e161c(0x25b)](_0x5e161c(0x255)+_0x1c21c6[_0x5e161c(0x221)]),console[_0x5e161c(0x25b)](_0x5e161c(0x1e2)+_0x1c21c6['newProjectId']),console[_0x5e161c(0x25b)](),console['log']('Summary:'),console[_0x5e161c(0x25b)](_0x5e161c(0x23a)+formatCountSummary(_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x23b)])),console[_0x5e161c(0x25b)](_0x5e161c(0x1ed)+formatCountSummary(_0x1c21c6[_0x5e161c(0x20b)][_0x5e161c(0x1f8)])),console[_0x5e161c(0x25b)](_0x5e161c(0x206)+formatCountSummary(_0x1c21c6[_0x5e161c(0x20b)]['prompts']));if(_0x44636d){console[_0x5e161c(0x25b)](),console[_0x5e161c(0x25b)](a4_0x3458ff[_0x5e161c(0x218)](_0x5e161c(0x1d7)));for(const _0x3ad8c8 of _0x1c21c6[_0x5e161c(0x23b)]){_0x3ad8c8[_0x5e161c(0x233)]===_0x5e161c(0x1e8)&&console[_0x5e161c(0x25b)](a4_0x3458ff['red']('\x20\x20Agent\x20\x22'+_0x3ad8c8[_0x5e161c(0x1f0)]+_0x5e161c(0x20e)+_0x3ad8c8[_0x5e161c(0x1e8)]));}for(const _0x40fbe0 of _0x1c21c6['knowledgeBases']){_0x40fbe0[_0x5e161c(0x233)]===_0x5e161c(0x1e8)&&console['log'](a4_0x3458ff['red']('\x20\x20Knowledge\x20Base\x20\x22'+_0x40fbe0['name']+_0x5e161c(0x20e)+_0x40fbe0[_0x5e161c(0x1e8)]));}for(const _0x52404e of _0x1c21c6[_0x5e161c(0x1f5)]){_0x52404e[_0x5e161c(0x233)]===_0x5e161c(0x1e8)&&console['log'](a4_0x3458ff[_0x5e161c(0x218)]('\x20\x20Prompt\x20\x22'+_0x52404e[_0x5e161c(0x250)]+'\x22:\x20'+_0x52404e[_0x5e161c(0x1e8)]));}return 0x1;}console[_0x5e161c(0x25b)]();const _0x136b8a=getLLMProjectUrl(_0x1d0982,_0x1c21c6[_0x5e161c(0x215)]);return console[_0x5e161c(0x25b)](_0x5e161c(0x203)+a4_0x3458ff[_0x5e161c(0x237)](_0x136b8a)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x1c3aa5(0x250)]=a4_0x1c3aa5(0x242);[a4_0x1c3aa5(0x201)]=a4_0x1c3aa5(0x23d);async[a4_0x1c3aa5(0x244)](_0x1b1ba5){const _0x5c7b8b=a4_0x1c3aa5,{options:_0x5e3455,args:_0xc10c0e,tdx:_0x2f2ec0}=_0x1b1ba5;let _0x3d92af=_0xc10c0e[0x0]||process[_0x5c7b8b(0x1cf)]();const _0x215bfb=_0x5e3455[_0x5c7b8b(0x22e)],_0x2e94e1=_0x5e3455[_0x5c7b8b(0x1e9)],_0x39b177=_0x5e3455[_0x5c7b8b(0x1c1)],_0x381e5b=_0x5e3455['site'],_0x3c0dee=a4_0x5079e8[_0x5c7b8b(0x1bb)](_0x3d92af,'agent.yml'),_0x285b74=existsSync(_0x3c0dee);if(_0x285b74){const {data:_0x5070eb}=await withSpinner('Pushing\x20agent\x20from\x20\x22'+_0x3d92af+_0x5c7b8b(0x259),()=>_0x2f2ec0[_0x5c7b8b(0x24c)][_0x5c7b8b(0x20a)](_0x3d92af,{'dryRun':_0x215bfb,'force':_0x2e94e1}));if(_0x215bfb)return console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x1e3)](_0x5c7b8b(0x24a))),console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x1c2)+_0x5070eb[_0x5c7b8b(0x1f0)]),0x0;if(_0x5070eb[_0x5c7b8b(0x233)]===_0x5c7b8b(0x1e8))return console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)]('Failed\x20to\x20push\x20agent:\x20'+_0x5070eb[_0x5c7b8b(0x1e8)])),0x1;console['log'](a4_0x3458ff[_0x5c7b8b(0x236)](_0x5c7b8b(0x1e5)+_0x5070eb['action']+_0x5c7b8b(0x227))),console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x25d)+_0x5070eb[_0x5c7b8b(0x1f0)]);if(_0x5070eb[_0x5c7b8b(0x217)]&&_0x5070eb['projectId']){const _0x5430ea=getLLMAgentChatUrl(_0x381e5b,_0x5070eb[_0x5c7b8b(0x231)],_0x5070eb[_0x5c7b8b(0x217)]);console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x246)+a4_0x3458ff[_0x5c7b8b(0x237)](_0x5430ea));}return 0x0;}const _0x15c902=_0x5e3455[_0x5c7b8b(0x22f)],_0x2b2b52=resolveProjectFromContext(_0x3d92af,_0x15c902);if(_0x2b2b52[_0x5c7b8b(0x25a)])_0x3d92af=_0x2b2b52[_0x5c7b8b(0x1f7)],_0x2b2b52['source']===_0x5c7b8b(0x254)&&console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x1e7)]('Using\x20project:\x20'+_0x3d92af));else{let _0x17f41b=_0x5c7b8b(0x1db);_0x2b2b52[_0x5c7b8b(0x205)]===_0x5c7b8b(0x23e)&&(_0x17f41b=_0x2b2b52[_0x5c7b8b(0x257)]+_0x5c7b8b(0x1dc)+_0x2b2b52[_0x5c7b8b(0x22f)]+_0x5c7b8b(0x1d0));throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2b2b52[_0x5c7b8b(0x205)]===_0x5c7b8b(0x228)?_0x2b2b52[_0x5c7b8b(0x257)]:_0x5c7b8b(0x1ff)+_0x3d92af,undefined,{'helpText':_0x17f41b});}const {data:_0x5826c7}=await withSpinner(_0x5c7b8b(0x226),()=>_0x2f2ec0[_0x5c7b8b(0x24c)]['pushProject'](_0x3d92af,{'dryRun':!![]})),_0x4638ae=_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x23b)][_0x5c7b8b(0x21d)]>0x0;if(_0x4638ae){console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)](_0x5c7b8b(0x220)));for(const _0x411086 of _0x5826c7[_0x5c7b8b(0x23b)]){_0x411086['action']==='error'&&console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)]('\x20\x20Agent\x20\x22'+_0x411086[_0x5c7b8b(0x1f0)]+_0x5c7b8b(0x20e)+_0x411086[_0x5c7b8b(0x1e8)]));}return 0x1;}const _0x12eec1=_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x23b)][_0x5c7b8b(0x20d)]+_0x5826c7[_0x5c7b8b(0x20b)]['knowledgeBases'][_0x5c7b8b(0x20d)]+_0x5826c7[_0x5c7b8b(0x20b)]['textKnowledgeBases'][_0x5c7b8b(0x20d)]+_0x5826c7['counts']['prompts'][_0x5c7b8b(0x20d)],_0x52e1c7=_0x5826c7['counts']['agents'][_0x5c7b8b(0x1c5)]+_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x1f8)][_0x5c7b8b(0x1c5)]+_0x5826c7['counts']['textKnowledgeBases'][_0x5c7b8b(0x1c5)]+_0x5826c7['counts'][_0x5c7b8b(0x1f5)][_0x5c7b8b(0x1c5)],_0x2c972a=_0x5826c7[_0x5c7b8b(0x20b)]['agents'][_0x5c7b8b(0x249)]+_0x5826c7['counts']['knowledgeBases']['unchanged']+_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x1ee)][_0x5c7b8b(0x249)]+_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x1f5)][_0x5c7b8b(0x249)];console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x1d4)+_0x5826c7['projectName']+'\x27:'),console[_0x5c7b8b(0x25b)]('\x20\x20'+a4_0x3458ff['green']('+\x20'+_0x12eec1+'\x20new')+_0x5c7b8b(0x235)+a4_0x3458ff[_0x5c7b8b(0x1e3)]('~\x20'+_0x52e1c7+'\x20changed')+_0x5c7b8b(0x235)+a4_0x3458ff[_0x5c7b8b(0x1e7)]('=\x20'+_0x2c972a+_0x5c7b8b(0x213))),console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x23a)+formatCountSummary(_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x23b)])),console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x1ed)+formatCountSummary(_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x1f8)])),console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x1c4)+formatCountSummary(_0x5826c7[_0x5c7b8b(0x20b)][_0x5c7b8b(0x1ee)])),console[_0x5c7b8b(0x25b)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x5826c7['counts'][_0x5c7b8b(0x1f5)])),console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x1fa)+a4_0x3458ff[_0x5c7b8b(0x237)](_0x3d92af)),displayDiffs(_0x5826c7[_0x5c7b8b(0x23b)],_0x5826c7[_0x5c7b8b(0x1f8)],_0x5826c7['textKnowledgeBases'],_0x5826c7[_0x5c7b8b(0x1f5)]);if(_0x215bfb)return console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x1e3)](_0x5c7b8b(0x225))),0x0;if(_0x12eec1===0x0&&_0x52e1c7===0x0){console['log'](a4_0x3458ff['green'](_0x5c7b8b(0x21f)));const _0x3d0888=getLLMProjectUrl(_0x381e5b,_0x5826c7[_0x5c7b8b(0x231)]);return console[_0x5c7b8b(0x25b)]('Project:\x20'+a4_0x3458ff['cyan'](_0x3d0888)),0x0;}if(!_0x39b177&&!_0x2e94e1){const _0x5b7701=await confirmKey(_0x5c7b8b(0x208)+(_0x12eec1+_0x52e1c7)+_0x5c7b8b(0x1c6));if(!_0x5b7701)return console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x20c)),0x0;}const {data:_0x2515de}=await withSpinner(_0x5c7b8b(0x239),()=>_0x2f2ec0['llm'][_0x5c7b8b(0x1cc)](_0x3d92af,{'force':_0x2e94e1})),_0xf2a5f3=_0x2515de['counts']['agents']['errors']>0x0||_0x2515de[_0x5c7b8b(0x20b)]['knowledgeBases'][_0x5c7b8b(0x21d)]>0x0||_0x2515de[_0x5c7b8b(0x20b)][_0x5c7b8b(0x1ee)][_0x5c7b8b(0x21d)]>0x0||_0x2515de['counts'][_0x5c7b8b(0x1f5)][_0x5c7b8b(0x21d)]>0x0;if(_0xf2a5f3){console['log'](a4_0x3458ff[_0x5c7b8b(0x1e3)]('\x0aProject\x20pushed\x20with\x20errors')),console['log'](),console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)]('Errors:'));for(const _0x561712 of _0x2515de[_0x5c7b8b(0x23b)]){_0x561712[_0x5c7b8b(0x233)]==='error'&&console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)](_0x5c7b8b(0x243)+_0x561712[_0x5c7b8b(0x1f0)]+_0x5c7b8b(0x20e)+_0x561712['error']));}for(const _0x4f5e4f of _0x2515de['knowledgeBases']){_0x4f5e4f['action']==='error'&&console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x4f5e4f[_0x5c7b8b(0x250)]+'\x22:\x20'+_0x4f5e4f[_0x5c7b8b(0x1e8)]));}for(const _0x4c6845 of _0x2515de[_0x5c7b8b(0x1ee)]){_0x4c6845[_0x5c7b8b(0x233)]===_0x5c7b8b(0x1e8)&&console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)](_0x5c7b8b(0x1f4)+_0x4c6845[_0x5c7b8b(0x250)]+_0x5c7b8b(0x20e)+_0x4c6845[_0x5c7b8b(0x1e8)]));}for(const _0x3304b9 of _0x2515de[_0x5c7b8b(0x1f5)]){_0x3304b9[_0x5c7b8b(0x233)]==='error'&&console[_0x5c7b8b(0x25b)](a4_0x3458ff[_0x5c7b8b(0x218)]('\x20\x20Prompt\x20\x22'+_0x3304b9[_0x5c7b8b(0x250)]+_0x5c7b8b(0x20e)+_0x3304b9[_0x5c7b8b(0x1e8)]));}return 0x1;}console['log'](a4_0x3458ff['green'](_0x5c7b8b(0x1e1)+(_0x12eec1+_0x52e1c7)+'\x20resources\x20to\x20\x27'+_0x2515de['projectName']+'\x27'));const _0x2eb9d4=getLLMProjectUrl(_0x381e5b,_0x2515de['projectId']);return console[_0x5c7b8b(0x25b)](_0x5c7b8b(0x203)+a4_0x3458ff['cyan'](_0x2eb9d4)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
function a5_0x24b3(){const _0x4d0a25=['27351lRZCjl','Test\x20Configuration:','6MqcVMa','7733AvaihW','Using\x20agent:\x20','Duration:\x20','reason','2FfocPe','tsv','description','repeat','basename','1969852XzAgOf','ERROR','name','rounds','dryRun','/<agent-name>','159066WCbusm','found','\x20\x20Agent:\x20','Project\x20path:\x20','FAIL','5132170voKwaM','448MIjrmU','green','PASS','\x20\x20Evaluating...\x20','1076747fRbQKE','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','Errors:\x20\x20\x20','round','table','Test\x20','404','no_local_folder','5LOguZT','text','output','site','resolveAgentId','start','resolveProjectId','message','Failed\x20Tests:','toLowerCase','verbose','llmProject','\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)','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','context','log','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','writeFileSync','\x20\x20Site:\x20','Total:\x20\x20\x20\x20','✗\x20FAIL:\x20','jsonl','agentName','status','Failed:\x20\x20\x20','1001365CQhWKI','trim','✗\x20ERROR:\x20','no_tests','Evaluating\x20response...','agentDirs','red','\x22:\x20','Error\x20writing\x20output\x20file:\x20','projectName','push','✗\x20ERROR:\x20Project\x20not\x20found:\x20','Test\x20Summary','projectDir','\x20\x20-\x20','now','source','test.yml','Round\x201/','conversation_url','yellow','Conversation\x20URL:\x20','stop','\x20\x20Project:\x20','\x20\x20Round\x20','...\x20','join','toISOString','Usage:','multiple_agents','\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','eval','json','white','llm','agent:test','map','includes','filter','split','length','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','\x27\x20to\x20create\x20the\x20folder\x20structure.','cyan','Run\x20tests\x20for\x20an\x20LLM\x20agent','tests','utf-8','8388TQFcIO','dim','not\x20found','Tests\x20found:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22'];a5_0x24b3=function(){return _0x4d0a25;};return a5_0x24b3();}const a5_0x1a16dd=a5_0x1730;(function(_0x2e4e33,_0x254b1b){const _0xc7c0f1=a5_0x1730,_0x1acacc=_0x2e4e33();while(!![]){try{const _0x51b835=parseInt(_0xc7c0f1(0x1d7))/0x1+-parseInt(_0xc7c0f1(0x213))/0x2*(-parseInt(_0xc7c0f1(0x20c))/0x3)+-parseInt(_0xc7c0f1(0x218))/0x4*(parseInt(_0xc7c0f1(0x230))/0x5)+parseInt(_0xc7c0f1(0x20e))/0x6*(parseInt(_0xc7c0f1(0x228))/0x7)+parseInt(_0xc7c0f1(0x224))/0x8*(parseInt(_0xc7c0f1(0x21e))/0x9)+-parseInt(_0xc7c0f1(0x223))/0xa+-parseInt(_0xc7c0f1(0x20f))/0xb*(parseInt(_0xc7c0f1(0x207))/0xc);if(_0x51b835===_0x254b1b)break;else _0x1acacc['push'](_0x1acacc['shift']());}catch(_0x2d9505){_0x1acacc['push'](_0x1acacc['shift']());}}}(a5_0x24b3,0xa064a));import*as a5_0x11719c from'node:fs';function a5_0x1730(_0x40cb2c,_0x1fee8c){_0x40cb2c=_0x40cb2c-0x1c8;const _0x24b370=a5_0x24b3();let _0x17306d=_0x24b370[_0x40cb2c];return _0x17306d;}import*as a5_0x305696 from'node:path';import a5_0x53c258 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{['name']=a5_0x1a16dd(0x1fa);[a5_0x1a16dd(0x215)]=a5_0x1a16dd(0x204);async['execute'](_0x20209f){const _0x295b9d=a5_0x1a16dd,{options:_0x57fc41,args:_0x38090e,tdx:_0xdcfb63}=_0x20209f,_0x4fc6b4=_0x38090e[0x0]||'.',_0x3a5818=_0x57fc41[_0x295b9d(0x21c)],_0x398645=_0x57fc41,_0x8c6afd=_0x398645[_0x295b9d(0x1f6)]===![],_0x29a84c=_0x398645[_0x295b9d(0x21a)],_0x3f24c9=_0x57fc41[_0x295b9d(0x233)],_0x105abb=_0x398645[_0x295b9d(0x232)];let _0x5348da=_0x295b9d(0x22c);if(_0x398645[_0x295b9d(0x1f7)])_0x5348da=_0x295b9d(0x1f7);else{if(_0x398645[_0x295b9d(0x1d3)])_0x5348da='jsonl';else{if(_0x398645['tsv'])_0x5348da=_0x295b9d(0x214);else{if(_0x398645[_0x295b9d(0x22c)])_0x5348da=_0x295b9d(0x22c);}}}const _0x363ddc=_0x398645[_0x295b9d(0x1c9)];let _0x4767b4=_0x4fc6b4;const _0x4b3cce=a5_0x11719c['existsSync'](_0x4fc6b4),_0x2320a3=_0x4fc6b4==='.';if(!_0x4b3cce||_0x2320a3){const _0x21af42=resolveProjectFromContext(_0x4fc6b4,_0x363ddc,{'requireFile':_0x295b9d(0x1e8)});if(_0x21af42[_0x295b9d(0x21f)])_0x4767b4=_0x21af42[_0x295b9d(0x1e4)],_0x21af42[_0x295b9d(0x1e7)]===_0x295b9d(0x1cc)&&console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x208)](_0x295b9d(0x210)+_0x4767b4));else switch(_0x21af42[_0x295b9d(0x212)]){case'no_context':console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1eb)](_0x21af42[_0x295b9d(0x237)])),console[_0x295b9d(0x1cd)](),console[_0x295b9d(0x1cd)](_0x295b9d(0x1f3)),console[_0x295b9d(0x1cd)](_0x295b9d(0x1f5)),console[_0x295b9d(0x1cd)](_0x295b9d(0x1ca)),console['log'](),console['log'](_0x295b9d(0x1ce));return 0x1;case _0x295b9d(0x22f):console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1eb)](_0x21af42['message'])),console['log'](),console[_0x295b9d(0x1cd)]('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x21af42[_0x295b9d(0x1c9)]+_0x295b9d(0x202));return 0x1;case _0x295b9d(0x1f4):{const _0x544f96=a5_0x305696[_0x295b9d(0x217)](_0x21af42[_0x295b9d(0x1e4)]);console[_0x295b9d(0x1cd)](a5_0x53c258['yellow']('Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22'+_0x21af42['llmProject']+'\x22:'));for(const _0x4bcdfc of _0x21af42[_0x295b9d(0x1dc)]){console['log'](_0x295b9d(0x1e5)+_0x4bcdfc);}return console[_0x295b9d(0x1cd)](),console[_0x295b9d(0x1cd)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x544f96+_0x295b9d(0x21d)),0x1;}case _0x295b9d(0x1da):console[_0x295b9d(0x1cd)](a5_0x53c258['yellow'](_0x295b9d(0x1cb)+_0x21af42[_0x295b9d(0x1c9)]+'\x22.')),console['log'](a5_0x53c258[_0x295b9d(0x208)](_0x295b9d(0x221)+_0x21af42[_0x295b9d(0x1e4)])),console['log'](),console[_0x295b9d(0x1cd)](_0x295b9d(0x200));return 0x1;}}const {definition:_0x35dfd2,agentInfo:_0x189094}=parseTestFile(_0x4767b4);let _0x5eafbb=_0x35dfd2[_0x295b9d(0x205)];if(_0x29a84c){const _0x490ad4=_0x29a84c[_0x295b9d(0x1fe)](',')['map'](_0x2d300a=>_0x2d300a[_0x295b9d(0x1d8)]());_0x5eafbb=_0x35dfd2[_0x295b9d(0x205)][_0x295b9d(0x1fd)](_0x4cc294=>_0x490ad4['includes'](_0x4cc294[_0x295b9d(0x21a)]));if(_0x5eafbb['length']===0x0)return console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1eb)]('No\x20tests\x20found\x20matching:\x20'+_0x29a84c)),console[_0x295b9d(0x1cd)](a5_0x53c258['dim']('Available\x20tests:\x20'+_0x35dfd2['tests'][_0x295b9d(0x1fb)](_0x5c0432=>_0x5c0432[_0x295b9d(0x21a)])[_0x295b9d(0x1f1)](',\x20'))),0x1;}if(_0x3a5818){console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x203)](_0x295b9d(0x20d))),console['log'](_0x295b9d(0x1d0)+a5_0x53c258['white'](_0x3f24c9)),console[_0x295b9d(0x1cd)](_0x295b9d(0x1ee)+a5_0x53c258[_0x295b9d(0x1f8)](_0x189094[_0x295b9d(0x1e0)])),console[_0x295b9d(0x1cd)](_0x295b9d(0x220)+a5_0x53c258[_0x295b9d(0x1f8)](_0x189094['agentName'])),console[_0x295b9d(0x1cd)](),console[_0x295b9d(0x1cd)](_0x295b9d(0x20a)+a5_0x53c258[_0x295b9d(0x1f8)](_0x5eafbb[_0x295b9d(0x1ff)]));for(let _0x59ca35=0x0;_0x59ca35<_0x5eafbb[_0x295b9d(0x1ff)];_0x59ca35++){const _0x2c6dad=_0x5eafbb[_0x59ca35],_0x2834dd=_0x2c6dad[_0x295b9d(0x21b)][_0x295b9d(0x1ff)]===0x1?_0x295b9d(0x22b):_0x295b9d(0x21b);console[_0x295b9d(0x1cd)]('\x20\x20'+(_0x59ca35+0x1)+'.\x20'+a5_0x53c258[_0x295b9d(0x1f8)](_0x2c6dad[_0x295b9d(0x21a)])+'\x20('+_0x2c6dad['rounds'][_0x295b9d(0x1ff)]+'\x20'+_0x2834dd+')');}return 0x0;}let _0x54ceee,_0x2bae7f;try{_0x54ceee=await _0xdcfb63['llm'][_0x295b9d(0x236)](_0x189094['projectName']);}catch(_0x320b3c){const _0x305cef=_0x320b3c instanceof Error?_0x320b3c[_0x295b9d(0x237)]:String(_0x320b3c);return _0x305cef[_0x295b9d(0x1fc)](_0x295b9d(0x22e))||_0x305cef['toLowerCase']()[_0x295b9d(0x1fc)](_0x295b9d(0x209))?console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1dd)](_0x295b9d(0x1e2)+_0x189094[_0x295b9d(0x1e0)])):console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1dd)](_0x295b9d(0x201)+_0x189094[_0x295b9d(0x1e0)]+'\x22:\x20'+_0x305cef)),0x1;}try{_0x2bae7f=await _0xdcfb63[_0x295b9d(0x1f9)][_0x295b9d(0x234)](_0x189094[_0x295b9d(0x1d4)],_0x54ceee);}catch(_0x59946a){const _0x23c43f=_0x59946a instanceof Error?_0x59946a['message']:String(_0x59946a);return _0x23c43f[_0x295b9d(0x1fc)](_0x295b9d(0x22e))||_0x23c43f[_0x295b9d(0x239)]()[_0x295b9d(0x1fc)](_0x295b9d(0x209))?console[_0x295b9d(0x1cd)](a5_0x53c258['red'](_0x295b9d(0x229)+_0x189094[_0x295b9d(0x1d4)])):console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1dd)](_0x295b9d(0x20b)+_0x189094[_0x295b9d(0x1d4)]+_0x295b9d(0x1de)+_0x23c43f)),0x1;}let _0x2b52bf;if(!_0x8c6afd)try{_0x2b52bf=await setupEvaluatorAgent(_0xdcfb63[_0x295b9d(0x1f9)],_0x57fc41[_0x295b9d(0x1c8)]);}catch(_0x7e1984){const _0x197166=_0x7e1984 instanceof Error?_0x7e1984[_0x295b9d(0x237)]:String(_0x7e1984);return console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x1dd)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x197166)),0x1;}console['log'](a5_0x53c258[_0x295b9d(0x203)]('Running\x20agent\x20tests...')),console['log']('Site:\x20'+a5_0x53c258[_0x295b9d(0x1f8)](_0x3f24c9)),console[_0x295b9d(0x1cd)]('Agent:\x20'+a5_0x53c258['white'](_0x189094['projectName']+'/'+_0x189094['agentName'])),console['log']();const _0x19f21c=[],_0xa1d807=Date[_0x295b9d(0x1e6)]();for(let _0x19f05b=0x0;_0x19f05b<_0x5eafbb[_0x295b9d(0x1ff)];_0x19f05b++){const _0x16182f=_0x5eafbb[_0x19f05b];_0x5eafbb['length']>0x1?console[_0x295b9d(0x1cd)](_0x295b9d(0x22d)+(_0x19f05b+0x1)+'/'+_0x5eafbb['length']+':\x20'+a5_0x53c258[_0x295b9d(0x1f8)](_0x16182f[_0x295b9d(0x21a)])):console[_0x295b9d(0x1cd)]('Running\x20test:\x20'+a5_0x53c258['white'](_0x16182f[_0x295b9d(0x21a)]));const _0x1d19fe=createCommandSpinner(_0x295b9d(0x1e9)+_0x16182f[_0x295b9d(0x21b)][_0x295b9d(0x1ff)]+':\x20Sending\x20user\x20input...');_0x1d19fe[_0x295b9d(0x235)]();try{const {result:_0x49d660}=await runTest(_0xdcfb63[_0x295b9d(0x1f9)],_0x16182f,{'agentId':_0x2bae7f,'projectId':_0x54ceee,'site':_0x3f24c9,'noEval':_0x8c6afd,'evaluatorId':_0x2b52bf,'onRoundStart':(_0x341004,_0x3c3348)=>{_0x1d19fe['text']='Round\x20'+(_0x341004+0x1)+'/'+_0x3c3348+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x1eff54,_0x145de9,_0x5b4b54)=>{const _0x4d45ab=_0x295b9d,_0x1a716b=formatElapsed(_0x145de9);_0x5b4b54?console['log'](_0x4d45ab(0x1ef)+(_0x1eff54+0x1)+'/'+_0x16182f[_0x4d45ab(0x21b)][_0x4d45ab(0x1ff)]+'...\x20'+a5_0x53c258[_0x4d45ab(0x225)]('✓')+'\x20('+_0x1a716b+')'):console['log'](_0x4d45ab(0x1ef)+(_0x1eff54+0x1)+'/'+_0x16182f['rounds'][_0x4d45ab(0x1ff)]+_0x4d45ab(0x1f0)+a5_0x53c258[_0x4d45ab(0x1dd)]('✗'));},'onEvaluationStart':()=>{const _0x292ef6=_0x295b9d;_0x1d19fe[_0x292ef6(0x231)]=_0x292ef6(0x1db);},'onEvaluationComplete':_0x942a1f=>{const _0xc345e9=_0x295b9d,_0x55e5b5=formatElapsed(_0x942a1f);console[_0xc345e9(0x1cd)](_0xc345e9(0x227)+a5_0x53c258['green']('✓')+'\x20('+_0x55e5b5+')');}});_0x1d19fe[_0x295b9d(0x1ed)](),_0x19f21c[_0x295b9d(0x1e1)](_0x49d660);if(_0x49d660[_0x295b9d(0x1d5)]===_0x295b9d(0x226))console[_0x295b9d(0x1cd)](a5_0x53c258[_0x295b9d(0x225)]('✓\x20PASS:\x20'+_0x49d660[_0x295b9d(0x212)]));else _0x49d660[_0x295b9d(0x1d5)]===_0x295b9d(0x222)?console['log'](a5_0x53c258[_0x295b9d(0x1dd)](_0x295b9d(0x1d2)+_0x49d660[_0x295b9d(0x212)])):console[_0x295b9d(0x1cd)](a5_0x53c258['red']('✗\x20ERROR:\x20'+_0x49d660[_0x295b9d(0x212)]));_0x49d660[_0x295b9d(0x1ea)]&&console['log'](a5_0x53c258[_0x295b9d(0x208)](_0x295b9d(0x1ec)+_0x49d660[_0x295b9d(0x1ea)])),console[_0x295b9d(0x1cd)]();}catch(_0xb89e1f){_0x1d19fe[_0x295b9d(0x1ed)]();const _0x5c834d=_0xb89e1f instanceof Error?_0xb89e1f[_0x295b9d(0x237)]:String(_0xb89e1f);console[_0x295b9d(0x1cd)](a5_0x53c258['red'](_0x295b9d(0x1d9)+_0x5c834d)),console[_0x295b9d(0x1cd)](),_0x19f21c[_0x295b9d(0x1e1)]({'name':_0x16182f[_0x295b9d(0x21a)],'status':_0x295b9d(0x219),'reason':_0x5c834d,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}const _0x551e7f=Date[_0x295b9d(0x1e6)]()-_0xa1d807,_0x383240=_0x19f21c['filter'](_0x26030f=>_0x26030f[_0x295b9d(0x1d5)]===_0x295b9d(0x226))[_0x295b9d(0x1ff)],_0x16a2f6=_0x19f21c[_0x295b9d(0x1fd)](_0x2606c8=>_0x2606c8['status']===_0x295b9d(0x222))[_0x295b9d(0x1ff)],_0x480e30=_0x19f21c[_0x295b9d(0x1fd)](_0x1fdc9d=>_0x1fdc9d[_0x295b9d(0x1d5)]==='ERROR')[_0x295b9d(0x1ff)];console['log']('━'[_0x295b9d(0x216)](0x3c)),console[_0x295b9d(0x1cd)](_0x295b9d(0x1e3)),console['log']('━'[_0x295b9d(0x216)](0x3c)),console['log'](_0x295b9d(0x1d1)+_0x19f21c[_0x295b9d(0x1ff)]),console['log']('Passed:\x20\x20\x20'+a5_0x53c258[_0x295b9d(0x225)](_0x383240)),console[_0x295b9d(0x1cd)](_0x295b9d(0x1d6)+a5_0x53c258[_0x295b9d(0x1dd)](_0x16a2f6));_0x480e30>0x0&&console['log'](_0x295b9d(0x22a)+a5_0x53c258['red'](_0x480e30));console['log'](_0x295b9d(0x211)+formatElapsed(_0x551e7f)),console['log']('━'[_0x295b9d(0x216)](0x3c));const _0x4ac6b0=_0x19f21c[_0x295b9d(0x1fd)](_0x2933df=>_0x2933df[_0x295b9d(0x1d5)]!==_0x295b9d(0x226));if(_0x4ac6b0[_0x295b9d(0x1ff)]>0x0){console[_0x295b9d(0x1cd)](),console[_0x295b9d(0x1cd)](_0x295b9d(0x238));for(const _0xacb3db of _0x4ac6b0){const _0x40c812=a5_0x53c258[_0x295b9d(0x1dd)]('✗'),_0x37d80f=_0xacb3db[_0x295b9d(0x212)][_0x295b9d(0x1ff)]>0x32?_0xacb3db[_0x295b9d(0x212)]['substring'](0x0,0x32)+'...':_0xacb3db[_0x295b9d(0x212)];console[_0x295b9d(0x1cd)]('\x20\x20'+_0x40c812+'\x20'+_0xacb3db['name']+':\x20'+_0x37d80f);}}const _0x1bbf26={'summary':{'total':_0x19f21c['length'],'passed':_0x383240,'failed':_0x16a2f6,'errors':_0x480e30>0x0?_0x480e30:undefined,'duration_ms':_0x551e7f},'tests':_0x19f21c,'agent':{'project':_0x189094[_0x295b9d(0x1e0)],'name':_0x189094['agentName'],'site':_0x3f24c9},'timestamp':new Date(_0xa1d807)[_0x295b9d(0x1f2)]()};if(_0x5348da!==_0x295b9d(0x22c)||_0x105abb){const _0x23c552=formatResults(_0x1bbf26,_0x5348da);if(_0x105abb)try{a5_0x11719c[_0x295b9d(0x1cf)](_0x105abb,_0x23c552,_0x295b9d(0x206)),console['log'](),console['log'](a5_0x53c258[_0x295b9d(0x208)]('Output\x20written\x20to:\x20'+_0x105abb));}catch(_0x357845){return console[_0x295b9d(0x1cd)](),console['log'](a5_0x53c258[_0x295b9d(0x1dd)](_0x295b9d(0x1df)+_0x357845)),0x1;}else console[_0x295b9d(0x1cd)](),console[_0x295b9d(0x1cd)](_0x23c552);}return _0x4ac6b0[_0x295b9d(0x1ff)]>0x0?0x1:0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a6_0x3ac0(_0x5a330c,_0x12814b){_0x5a330c=_0x5a330c-0x73;const _0x4c56cc=a6_0x4c56();let _0x3ac061=_0x4c56cc[_0x5a330c];return _0x3ac061;}const a6_0x17138c=a6_0x3ac0;(function(_0x233a4d,_0x5e1b08){const _0x268309=a6_0x3ac0,_0xd77879=_0x233a4d();while(!![]){try{const _0x4870b4=-parseInt(_0x268309(0x81))/0x1*(-parseInt(_0x268309(0xa5))/0x2)+-parseInt(_0x268309(0xa4))/0x3*(-parseInt(_0x268309(0x7f))/0x4)+parseInt(_0x268309(0x89))/0x5+-parseInt(_0x268309(0x97))/0x6+-parseInt(_0x268309(0xac))/0x7+-parseInt(_0x268309(0xa1))/0x8+parseInt(_0x268309(0x7e))/0x9;if(_0x4870b4===_0x5e1b08)break;else _0xd77879['push'](_0xd77879['shift']());}catch(_0x2c8eaa){_0xd77879['push'](_0xd77879['shift']());}}}(a6_0x4c56,0x6d8db));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';function a6_0x4c56(){const _0x493b76=['set-cookie','header','verbose','headers','file','stack','x-trino-user','method','set-cookie2','Error:\x20','error','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','site','type','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','trim','body','toLowerCase','description','api','\x0aStack\x20trace:\x0a','authorization','execute','message','3034899IgxKPA','1351412XYUXvO','includes','21313SMDQSk','readBodyFromFile','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','x-auth-token','name','startsWith','data','GET','2222655NjTIVv','keys','PUT','entries','substring','Results\x20saved\x20to\x20','\x22.\x20','request','Endpoint\x20must\x20start\x20with\x20/:\x20','length','join','Invalid\x20header\x20format:\x20\x22','color','validate','214998JKqaqV','output','status','llm-proxy','workflow','x-xsrf-token','.\x20Valid\x20types:\x20','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','isArray','proxy-authorization','6417760ltRhKG','indexOf','cdp','3TeqwGH','20QhMkHd','trino','Invalid\x20API\x20type:\x20','toUpperCase','has','.\x20Valid\x20methods:\x20','<\x20HTTP/1.1\x20','321587MHoITX'];a6_0x4c56=function(){return _0x493b76;};return a6_0x4c56();}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_0x17138c(0x7b),a6_0x17138c(0xa0),'cookie',a6_0x17138c(0xad),a6_0x17138c(0xb5),a6_0x17138c(0x9c),a6_0x17138c(0x84),a6_0x17138c(0xb3)]);function isSensitiveHeader(_0x1205e0){const _0x496f4c=a6_0x17138c;return SENSITIVE_HEADERS[_0x496f4c(0xa9)](_0x1205e0[_0x496f4c(0x77)]());}function parseHeader(_0x5a261b){const _0x149040=a6_0x17138c,_0x8cd306=_0x5a261b[_0x149040(0xa2)](':');if(_0x8cd306===-0x1)throw new Error(_0x149040(0x94)+_0x5a261b+_0x149040(0x8f)+_0x149040(0x83));const _0x3c8f1f=_0x5a261b[_0x149040(0x8d)](0x0,_0x8cd306)[_0x149040(0x75)](),_0x2387c7=_0x5a261b['substring'](_0x8cd306+0x1)['trim']();if(!_0x3c8f1f)throw new Error(_0x149040(0x9e)+_0x5a261b+'\x22');return[_0x3c8f1f,_0x2387c7];}export class ApiCommand extends BaseCommand{[a6_0x17138c(0x85)]=a6_0x17138c(0x79);[a6_0x17138c(0x78)]=a6_0x17138c(0x74);[a6_0x17138c(0x96)](_0x96bfcc){const _0x490070=a6_0x17138c,{args:_0x40afee,options:_0x2b2726}=_0x96bfcc,_0xcb2b1d=_0x2b2726;if(_0x40afee[_0x490070(0x92)]===0x0)return _0x490070(0xb8);const _0xf3ecfb=_0x40afee[0x0];if(!_0xf3ecfb[_0x490070(0x86)]('/'))return _0x490070(0x91)+_0xf3ecfb;const _0x28610a=_0xcb2b1d[_0x490070(0x87)],_0x1c7352=_0xcb2b1d[_0x490070(0xb1)];if(_0x28610a&&_0x1c7352)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x1fbc87=_0xcb2b1d[_0x490070(0xb4)]||_0x490070(0x88),_0x2c72bb=[_0x490070(0x88),'POST',_0x490070(0x8b),'DELETE','PATCH'];if(!_0x2c72bb[_0x490070(0x80)](_0x1fbc87[_0x490070(0xa8)]()))return'Invalid\x20HTTP\x20method:\x20'+_0x1fbc87+_0x490070(0xaa)+_0x2c72bb[_0x490070(0x93)](',\x20');const _0x59322c=_0xcb2b1d[_0x490070(0x73)]||'td',_0x5023f1=['td',_0x490070(0xa3),_0x490070(0x9b),_0x490070(0xa6),'llm',_0x490070(0x9a)];if(!_0x5023f1[_0x490070(0x80)](_0x59322c))return _0x490070(0xa7)+_0x59322c+_0x490070(0x9d)+_0x5023f1[_0x490070(0x93)](',\x20');return undefined;}async[a6_0x17138c(0x7c)](_0x1af27f){const _0x48df18=a6_0x17138c,{options:_0xfbe3ab,args:_0x1ba402,tdx:_0x214537}=_0x1af27f,_0x1de088=_0xfbe3ab,_0x2983dc=_0x1ba402[0x0],_0x333c8b=(_0x1de088[_0x48df18(0xb4)]||'GET')[_0x48df18(0xa8)](),_0x4b7b73=_0x1de088[_0x48df18(0x87)],_0x16fd0f=_0x1de088[_0x48df18(0xb1)],_0x1edbb4=_0x1de088[_0x48df18(0xae)],_0x5ad8c1=_0x1de088[_0x48df18(0x73)]||'td';try{const _0x4ab768={};if(_0x1edbb4){const _0x226806=Array[_0x48df18(0x9f)](_0x1edbb4)?_0x1edbb4:[_0x1edbb4];for(const _0x11e960 of _0x226806){const [_0x334454,_0x1a5057]=parseHeader(_0x11e960);_0x4ab768[_0x334454]=_0x1a5057;}}let _0x1773c4;if(_0x4b7b73)_0x1773c4=_0x4b7b73;else{if(_0x16fd0f)try{_0x1773c4=RawAPI[_0x48df18(0x82)](_0x16fd0f);}catch(_0x2f4773){return console[_0x48df18(0xb7)](_0x48df18(0xb6)+(_0x2f4773 instanceof Error?_0x2f4773[_0x48df18(0x7d)]:String(_0x2f4773))),0x1;}}const _0x1bf8b0={'method':_0x333c8b,'apiType':_0x5ad8c1,'includeHeaders':_0xfbe3ab[_0x48df18(0xaf)]};_0x1773c4&&(_0x1bf8b0[_0x48df18(0x76)]=_0x1773c4);Object[_0x48df18(0x8a)](_0x4ab768)[_0x48df18(0x92)]>0x0&&(_0x1bf8b0[_0x48df18(0xb0)]=_0x4ab768);if(_0xfbe3ab[_0x48df18(0xaf)]){const _0x75185d=resolveSite(_0xfbe3ab[_0x48df18(0xb9)]),_0x3791ca=getEndpoint(_0x75185d,_0x5ad8c1),_0x54c154=''+_0x3791ca+_0x2983dc;console[_0x48df18(0xb7)]('>\x20'+_0x333c8b+'\x20'+_0x54c154);const _0x35e5bd=getAuthHeaders(_0x75185d),_0x9a20cc={..._0x35e5bd,..._0x4ab768};for(const [_0x1c13b9,_0x345600]of Object[_0x48df18(0x8c)](_0x9a20cc)){!isSensitiveHeader(_0x1c13b9)&&console[_0x48df18(0xb7)]('>\x20'+_0x1c13b9+':\x20'+_0x345600);}_0x1773c4&&console[_0x48df18(0xb7)]('>'),console[_0x48df18(0xb7)]('');}const _0x73a490=await _0x214537[_0x48df18(0x79)][_0x48df18(0x90)](_0x2983dc,_0x1bf8b0);if(_0xfbe3ab['verbose']&&_0x73a490['headers']){console[_0x48df18(0xb7)](_0x48df18(0xab)+_0x73a490[_0x48df18(0x99)]);for(const [_0x4c666b,_0x46acfe]of Object[_0x48df18(0x8c)](_0x73a490['headers'])){!isSensitiveHeader(_0x4c666b)&&console[_0x48df18(0xb7)]('<\x20'+_0x4c666b+':\x20'+_0x46acfe);}console[_0x48df18(0xb7)]('');}const _0x250dd3=Boolean(_0xfbe3ab[_0x48df18(0x98)]),_0x23e2dd={'color':_0xfbe3ab['color'],'noColor':_0xfbe3ab['noColor']||_0x250dd3&&!_0xfbe3ab[_0x48df18(0x95)]},_0x2e9598=colorizeJSON(_0x73a490[_0x48df18(0x87)],_0x23e2dd);return _0xfbe3ab[_0x48df18(0x98)]?(writeFileSync(_0xfbe3ab[_0x48df18(0x98)],_0x2e9598),console['error'](_0x48df18(0x8e)+_0xfbe3ab[_0x48df18(0x98)])):console['log'](_0x2e9598),0x0;}catch(_0x11ebe1){return _0x11ebe1 instanceof Error?(console[_0x48df18(0xb7)]('Error:\x20'+_0x11ebe1[_0x48df18(0x7d)]),_0xfbe3ab[_0x48df18(0xaf)]&&_0x11ebe1[_0x48df18(0xb2)]&&console['error'](_0x48df18(0x7a)+_0x11ebe1[_0x48df18(0xb2)])):console[_0x48df18(0xb7)](_0x48df18(0xb6)+String(_0x11ebe1)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x50acd0=a7_0x5cae;(function(_0x407ce1,_0x19cec3){const _0x36d496=a7_0x5cae,_0x3a7e92=_0x407ce1();while(!![]){try{const _0x282ab2=-parseInt(_0x36d496(0xd1))/0x1+parseInt(_0x36d496(0xb4))/0x2+parseInt(_0x36d496(0x96))/0x3*(parseInt(_0x36d496(0xa0))/0x4)+parseInt(_0x36d496(0xa3))/0x5*(-parseInt(_0x36d496(0x8c))/0x6)+-parseInt(_0x36d496(0xd9))/0x7+parseInt(_0x36d496(0xcf))/0x8+-parseInt(_0x36d496(0xd7))/0x9;if(_0x282ab2===_0x19cec3)break;else _0x3a7e92['push'](_0x3a7e92['shift']());}catch(_0x8aa8ce){_0x3a7e92['push'](_0x3a7e92['shift']());}}}(a7_0x12df,0xabd92));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';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';function a7_0x5cae(_0x4adafd,_0x21e311){_0x4adafd=_0x4adafd-0x8b;const _0x12dfcf=a7_0x12df();let _0x5cae9e=_0x12dfcf[_0x4adafd];return _0x5cae9e;}import a7_0x23f02a from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';function a7_0x12df(){const _0x49bef8=['name','Enter\x20site\x20name:','join','You\x20can\x20find\x20your\x20API\x20key\x20at:','11040544gYeNxl','warn','1182415ARDHMk','✓\x20Default\x20site\x20set\x20to\x20','/app/mp/ak','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','filter','No\x20credential\x20found','2150181ncRdUE','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','3934238vsdrkH','profile','API\x20key\x20cannot\x20be\x20empty','\x0aSetup\x20cancelled','error','\x20\x20tdx','Site\x20name\x20cannot\x20be\x20empty','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','Enter\x20your\x20TD\x20API\x20key:','log','6UKrQKw','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','value','email','Validating\x20API\x20key...','last_name','status','text','yellow','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','2340XLwxmh','eu\x20\x20\x20-\x20Europe','Select\x20your\x20Treasure\x20Data\x20site:','trim','first_name','auth:setup','push','auth:clear','System\x20keychain\x20is\x20not\x20available','green','4272QinEcE','message','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','4341535bUKhBj','us\x20\x20\x20-\x20United\x20States','site','jobs','select','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Remove\x20API\x20key\x20from\x20system\x20keychain','\x27\x20registered','bold','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','getUserInfo','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','User:\x20','jp01','\x20(profile:\x20','No\x20API\x20key\x20found\x20in\x20keychain','2684894IlYUew','us01','length','tdx\x20profile:\x20','tdx:\x20auth\x20clear','jp\x20\x20\x20-\x20Japan','✗\x20Validation\x20failed:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Enter\x20custom\x20site','description','Setting\x20up\x20authentication\x20for\x20site:\x20','other','execute','Read\x20credential\x20from\x20','✓\x20API\x20key\x20removed\x20from\x20keychain','red','auth','\x20(site:\x20','password','Name:\x20','apiKey','Setup\x20API\x20key\x20authentication\x20interactively','ap02\x20-\x20Korea'];a7_0x12df=function(){return _0x49bef8;};return a7_0x12df();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x224dde from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x50acd0(0xcb)]=a7_0x50acd0(0x9b);[a7_0x50acd0(0xbd)]=a7_0x50acd0(0xc9);async['execute'](_0x101277){const _0x12c03b=a7_0x50acd0,{options:_0x512bbb}=_0x101277,_0x4d2ed6=_0x512bbb['profile'];console['log'](a7_0x224dde[_0x12c03b(0xab)]('tdx:\x20auth\x20setup'));const _0x245a08=_0x512bbb[_0x12c03b(0xa5)]||_0x12c03b(0xb5),_0xeb786f=[{'title':_0x12c03b(0xa4),'value':'us01'},{'title':_0x12c03b(0xb9),'value':_0x12c03b(0xb1)},{'title':_0x12c03b(0x97),'value':'eu01'},{'title':_0x12c03b(0xca),'value':'ap02'}];let _0x586352=_0xeb786f['findIndex'](_0x578098=>_0x578098[_0x12c03b(0x8e)]===_0x245a08);_0x586352===-0x1&&_0x245a08!==_0x12c03b(0xb5)&&(_0xeb786f[_0x12c03b(0x9c)]({'title':_0x245a08,'value':_0x245a08}),_0x586352=_0xeb786f[_0x12c03b(0xb6)]-0x1);_0xeb786f[_0x12c03b(0x9c)]({'title':_0x12c03b(0xbc),'value':_0x12c03b(0xbf)});const _0x135546=_0x4d2ed6?_0x12c03b(0xd4)+_0x4d2ed6+'):':_0x12c03b(0x98),_0x4457a2=await a7_0x23f02a({'type':_0x12c03b(0xa7),'name':_0x12c03b(0xa5),'message':_0x135546,'choices':_0xeb786f,'initial':_0x586352>=0x0?_0x586352:0x0});if(!_0x4457a2[_0x12c03b(0xa5)])return console[_0x12c03b(0x8b)]('\x0aSetup\x20cancelled'),0x1;let _0x34152f;if(_0x4457a2[_0x12c03b(0xa5)]===_0x12c03b(0xbf)){const _0x21adf4=await a7_0x23f02a({'type':_0x12c03b(0x93),'name':'customSite','message':_0x12c03b(0xcc),'initial':'us01','validate':_0x5009d8=>{const _0x5a34f7=_0x12c03b;if(!_0x5009d8||!_0x5009d8[_0x5a34f7(0x99)]())return _0x5a34f7(0xdf);if(!/^[a-z0-9-]+$/['test'](_0x5009d8[_0x5a34f7(0x99)]()))return _0x5a34f7(0xbb);return!![];}});if(!_0x21adf4['customSite'])return console['log'](_0x12c03b(0xdc)),0x1;_0x34152f=_0x21adf4['customSite'];}else _0x34152f=_0x4457a2['site'];const _0x31994f=resolveSite(_0x34152f);console[_0x12c03b(0x8b)](_0x12c03b(0xbe)+_0x31994f),console['log'](_0x12c03b(0xce)),console[_0x12c03b(0x8b)]('\x20\x20'+getConsoleUrl(_0x31994f,_0x12c03b(0xd3)));const _0x40a89c=await a7_0x23f02a({'type':_0x12c03b(0xc6),'name':_0x12c03b(0xc8),'message':_0x12c03b(0xe1),'validate':_0x33746e=>{const _0x44a9f0=_0x12c03b;if(!_0x33746e||!_0x33746e[_0x44a9f0(0x99)]())return _0x44a9f0(0xdb);return!![];}});if(!_0x40a89c[_0x12c03b(0xc8)])return console[_0x12c03b(0x8b)](_0x12c03b(0xdc)),0x1;const _0x44f3fc=_0x40a89c[_0x12c03b(0xc8)];console['log'](_0x12c03b(0x90));try{const _0x28ca82=TDX['create']({'site':_0x31994f,'apiKey':_0x44f3fc[_0x12c03b(0x99)](),'logLevel':_0x512bbb['logLevel']??LogLevel['ERROR']}),_0x5a9497=await _0x28ca82[_0x12c03b(0xa6)][_0x12c03b(0xae)]();console[_0x12c03b(0x8b)](_0x12c03b(0x8d)+_0x5a9497['email']+')');const _0x10b417=await isKeychainAvailable();_0x10b417?(await saveAPIKeyAsync(_0x44f3fc[_0x12c03b(0x99)](),_0x31994f,_0x4d2ed6),console[_0x12c03b(0x8b)](_0x12c03b(0xd8)+(_0x4d2ed6?'\x20(profile:\x20'+_0x4d2ed6+')':''))):(console[_0x12c03b(0xd0)](a7_0x224dde[_0x12c03b(0x94)](_0x12c03b(0xaf))),console[_0x12c03b(0xd0)](a7_0x224dde[_0x12c03b(0x94)](_0x12c03b(0xad))));if(_0x4d2ed6){const _0x914f2c={'site':_0x31994f};saveProfileToUserConfig(_0x4d2ed6,_0x914f2c),console[_0x12c03b(0x8b)]('✓\x20Profile\x20\x27'+_0x4d2ed6+_0x12c03b(0xaa));}else saveDefaultSiteToUserConfig(_0x31994f),console['log'](_0x12c03b(0xd2)+_0x31994f);const _0x30e195=_0x4d2ed6?'\x20--profile\x20'+_0x4d2ed6:'';return console['log'](),console[_0x12c03b(0x8b)](_0x12c03b(0x95)),console[_0x12c03b(0x8b)](_0x12c03b(0xde)+_0x30e195+_0x12c03b(0xa2)),console['log'](_0x12c03b(0xde)+_0x30e195+_0x12c03b(0xa8)),0x0;}catch(_0x252e05){if(_0x252e05 instanceof HTTPClientError&&_0x252e05['status']===0x191)return printAuthError(_0x252e05),0x1;return console[_0x12c03b(0xdd)](a7_0x224dde[_0x12c03b(0xc3)](_0x12c03b(0xba)+(_0x252e05 instanceof Error?_0x252e05[_0x12c03b(0xa1)]:String(_0x252e05)))),console[_0x12c03b(0xdd)](_0x12c03b(0xe0)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x50acd0(0xcb)]=a7_0x50acd0(0xc4);[a7_0x50acd0(0xbd)]=a7_0x50acd0(0xac);async[a7_0x50acd0(0xc0)](_0x41a1a2){const _0x5524cb=a7_0x50acd0,{options:_0x324f13,tdx:_0x48b905}=_0x41a1a2,_0x2de11d=_0x324f13[_0x5524cb(0xa5)],_0x2633ab=_0x324f13[_0x5524cb(0xda)],_0x920be=_0x2633ab?_0x2633ab:'N/A';console[_0x5524cb(0x8b)](_0x5524cb(0xb7)+_0x920be+_0x5524cb(0xc5)+_0x2de11d+')');const _0x456f30=await resolveAPIKeyAsync(_0x2de11d,_0x2633ab);if(_0x456f30){const {source:_0x2f585e,isDeprecated:_0x50fe5b}=_0x456f30,_0x570eae=_0x5524cb(0xc1)+_0x2f585e;console['log'](_0x50fe5b?a7_0x224dde[_0x5524cb(0x94)](_0x570eae):_0x570eae);}else console[_0x5524cb(0x8b)](a7_0x224dde[_0x5524cb(0x94)](_0x5524cb(0xd6)));try{const _0x5470f2=await _0x48b905[_0x5524cb(0xa6)]['getUserInfo']();return console[_0x5524cb(0x8b)](a7_0x224dde[_0x5524cb(0x9f)]('✓\x20Authentication\x20successful\x0a')),console[_0x5524cb(0x8b)](_0x5524cb(0xb0)+_0x5470f2[_0x5524cb(0x8f)]),(_0x5470f2[_0x5524cb(0x9a)]||_0x5470f2['last_name'])&&console['log'](_0x5524cb(0xc7)+[_0x5470f2[_0x5524cb(0x9a)],_0x5470f2[_0x5524cb(0x91)]][_0x5524cb(0xd5)](Boolean)[_0x5524cb(0xcd)]('\x20')),0x0;}catch(_0x5a6c1b){return _0x5a6c1b instanceof HTTPClientError&&_0x5a6c1b[_0x5524cb(0x92)]===0x191?printAuthError(_0x5a6c1b,!![],_0x2633ab):console[_0x5524cb(0xdd)](a7_0x224dde[_0x5524cb(0xc3)]('✗\x20Validation\x20failed:\x20'+(_0x5a6c1b instanceof Error?_0x5a6c1b[_0x5524cb(0xa1)]:String(_0x5a6c1b)))),0x1;}}}export class AuthClearCommand extends BaseCommand{['name']=a7_0x50acd0(0x9d);[a7_0x50acd0(0xbd)]=a7_0x50acd0(0xa9);async['execute'](_0x320bdd){const _0xc8eeab=a7_0x50acd0,{options:_0x1afa21}=_0x320bdd,_0x54d538=_0x1afa21[_0xc8eeab(0xda)];console[_0xc8eeab(0x8b)](a7_0x224dde[_0xc8eeab(0xab)](_0xc8eeab(0xb8)));const _0x47a67f=await isKeychainAvailable();if(!_0x47a67f)return console[_0xc8eeab(0xdd)](a7_0x224dde['red'](_0xc8eeab(0x9e))),0x1;const _0xb7e59=await deleteKeychainAPIKey(_0x54d538);return _0xb7e59?(clearCredentialCache(),console[_0xc8eeab(0x8b)](_0xc8eeab(0xc2)+(_0x54d538?_0xc8eeab(0xb2)+_0x54d538+')':'')),0x0):(console[_0xc8eeab(0x8b)](_0xc8eeab(0xb3)+(_0x54d538?'\x20for\x20profile:\x20'+_0x54d538:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a8_0x104de4=a8_0x3d71;(function(_0x224bda,_0x202a0f){const _0x173afb=a8_0x3d71,_0x5b8970=_0x224bda();while(!![]){try{const _0x2a5adc=parseInt(_0x173afb(0xb6))/0x1+-parseInt(_0x173afb(0xd1))/0x2*(-parseInt(_0x173afb(0xb9))/0x3)+-parseInt(_0x173afb(0xc6))/0x4*(-parseInt(_0x173afb(0xd4))/0x5)+-parseInt(_0x173afb(0xd2))/0x6+-parseInt(_0x173afb(0xcb))/0x7*(parseInt(_0x173afb(0xd9))/0x8)+parseInt(_0x173afb(0xc2))/0x9*(parseInt(_0x173afb(0xe5))/0xa)+parseInt(_0x173afb(0xc1))/0xb*(parseInt(_0x173afb(0xe8))/0xc);if(_0x2a5adc===_0x202a0f)break;else _0x5b8970['push'](_0x5b8970['shift']());}catch(_0x31e4ed){_0x5b8970['push'](_0x5b8970['shift']());}}}(a8_0x5c52,0x516db));import{BaseCommand}from'./command.js';function a8_0x3d71(_0x35a00a,_0x4fafca){_0x35a00a=_0x35a00a-0xb1;const _0x5c52e8=a8_0x5c52();let _0x3d711d=_0x5c52e8[_0x35a00a];return _0x3d711d;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function a8_0x5c52(){const _0x49a10a=['join','metadata','content','48990qLEvwa','message','404','591jaPzQI','Using\x20agent\x20from\x20','llm','type','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','getOrCreateDefaultAgent','write','\x0aStack\x20trace:','11jvJDmp','92466YKRWoh','session\x20context','data','CHAT_NOT_FOUND','1546052pAxfqR','verbose','execute','getAgentId','agent','226051wuqKZM','chat','includes','claude-4.5-haiku','getDefaultAgent','event','2934lBOiGA','3361626LCwRHr','validate','5TFKFEM','code','Using\x20cached\x20default\x20agent:\x20','resolveProjectId','Getting\x20default\x20agent...','136iLwKEI','args','--agent\x20flag','llmAgent','error','chatId','Resolving\x20agent\x20\x27','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','name','\x27...','handleChatEvent','streamChat','280HpYaEJ','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','\x20\x20Cause:\x20','5167308hOJLNz','llmProject','cause','stack'];a8_0x5c52=function(){return _0x49a10a;};return a8_0x5c52();}function handleSDKError(_0x38828e,_0x490211){const _0x7385f6=a8_0x3d71;if(_0x38828e instanceof SDKError)console['error']('Error:\x20'+_0x38828e[_0x7385f6(0xb7)]),_0x490211[_0x7385f6(0xc7)]&&(_0x38828e[_0x7385f6(0xb1)]&&console[_0x7385f6(0xdd)](_0x7385f6(0xe7)+_0x38828e[_0x7385f6(0xb1)]),_0x38828e[_0x7385f6(0xb2)]&&(console[_0x7385f6(0xdd)](_0x7385f6(0xc0)),console[_0x7385f6(0xdd)](_0x38828e['stack'])));else throw _0x38828e;}export class ChatCommand extends BaseCommand{['name']=a8_0x104de4(0xcc);['description']=a8_0x104de4(0xe0);[a8_0x104de4(0xd3)](_0x2dc0c3){const _0x2508db=a8_0x104de4,_0x34d076=_0x2dc0c3[_0x2508db(0xda)][_0x2508db(0xb3)]('\x20');if(!_0x34d076)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a8_0x104de4(0xe4)](_0x208b83,_0x284fee,_0x10276c,_0x4b5d59,_0x3d246a){const _0x4c2aac=a8_0x104de4;for await(const _0x5916bb of _0x208b83['llm'][_0x4c2aac(0xcc)](_0x284fee,{'agentId':_0x10276c,'chatId':_0x4b5d59})){if(_0x5916bb[_0x4c2aac(0xbc)]===_0x4c2aac(0xb4)){const _0x4c0e01=_0x5916bb[_0x4c2aac(0xc4)][_0x4c2aac(0xde)];saveLastChatId(_0x4c0e01),_0x3d246a&&console[_0x4c2aac(0xdd)]('Chat\x20session:\x20'+_0x4c0e01);}else _0x5916bb['type']===_0x4c2aac(0xd0)&&this['handleChatEvent'](_0x5916bb[_0x4c2aac(0xc4)]);}}async[a8_0x104de4(0xc9)](_0x3ee558,_0x4c8a0c,_0x4ecaf6,_0x5c2604,_0x4c7df4){const _0x8d18e1=a8_0x104de4,_0xe48d3c=_0x4c8a0c||_0x4ecaf6;if(_0xe48d3c){const {projectName:_0xbc5194,agentName:_0x21c527}=parseAgentRef(_0xe48d3c),_0x267613=_0x21c527||_0xe48d3c,_0x36603b=_0x21c527?_0xbc5194:_0x5c2604;if(!_0x36603b)throw new Error(_0x8d18e1(0xbd));if(_0x4c7df4){const _0x5e5041=_0x4c8a0c?_0x8d18e1(0xdb):_0x8d18e1(0xc3);console[_0x8d18e1(0xdd)](_0x8d18e1(0xba)+_0x5e5041+':\x20'+_0x36603b+'/'+_0x267613);}const _0xb4be41=await withSpinner('Resolving\x20project\x20\x27'+_0x36603b+'\x27...',()=>_0x3ee558[_0x8d18e1(0xbb)][_0x8d18e1(0xd7)](_0x36603b),{'verbose':_0x4c7df4}),_0x1682e7=await withSpinner(_0x8d18e1(0xdf)+_0x267613+_0x8d18e1(0xe2),()=>_0x3ee558[_0x8d18e1(0xbb)]['resolveAgentId'](_0x267613,_0xb4be41[_0x8d18e1(0xc4)]),{'verbose':_0x4c7df4});return _0x1682e7[_0x8d18e1(0xc4)];}else{const _0x5e624a=_0x3ee558[_0x8d18e1(0xbb)][_0x8d18e1(0xcf)]();if(_0x5e624a)return _0x4c7df4&&console[_0x8d18e1(0xdd)](_0x8d18e1(0xd6)+_0x5e624a[_0x8d18e1(0xe1)]),_0x5e624a['id'];const _0x13cfd1=await withSpinner(_0x8d18e1(0xd8),()=>_0x3ee558[_0x8d18e1(0xbb)][_0x8d18e1(0xbe)](_0x8d18e1(0xce),0x0),{'verbose':_0x4c7df4});return _0x13cfd1['data']['id'];}}async[a8_0x104de4(0xc8)](_0x5af5a6){const _0x4fa507=a8_0x104de4,{options:_0x32464e,args:_0x3d55bc,tdx:_0x4dc35d}=_0x5af5a6,_0x175280=_0x3d55bc[_0x4fa507(0xb3)]('\x20'),_0x5bcdc5=_0x32464e,_0x1ea852=_0x5bcdc5[_0x4fa507(0xca)],_0x1f3cf0=_0x5bcdc5[_0x4fa507(0xdc)],_0x4b3f75=_0x5bcdc5[_0x4fa507(0xe9)],_0x5aa35e=_0x5bcdc5['new'];try{let _0x2ac780,_0x58691f;!_0x5aa35e&&(_0x58691f=loadLastChatId(),_0x58691f&&_0x32464e['verbose']&&console[_0x4fa507(0xdd)]('Continuing\x20chat:\x20'+_0x58691f));(_0x5aa35e||!_0x58691f)&&(_0x2ac780=await this[_0x4fa507(0xc9)](_0x4dc35d,_0x1ea852,_0x1f3cf0,_0x4b3f75,_0x32464e[_0x4fa507(0xc7)]));try{await this[_0x4fa507(0xe4)](_0x4dc35d,_0x175280,_0x2ac780,_0x58691f,_0x32464e[_0x4fa507(0xc7)]);}catch(_0x1c169f){const _0x5058ca=_0x1c169f instanceof SDKError&&_0x1c169f[_0x4fa507(0xd5)]===ErrorCode[_0x4fa507(0xc5)]||_0x1c169f instanceof Error&&_0x1c169f[_0x4fa507(0xb7)][_0x4fa507(0xcd)](_0x4fa507(0xb8));if(_0x5058ca)_0x32464e['verbose']&&console[_0x4fa507(0xdd)](_0x4fa507(0xe6)),!_0x2ac780&&(_0x2ac780=await this[_0x4fa507(0xc9)](_0x4dc35d,_0x1ea852,_0x1f3cf0,_0x4b3f75,_0x32464e[_0x4fa507(0xc7)])),await this[_0x4fa507(0xe4)](_0x4dc35d,_0x175280,_0x2ac780,undefined,_0x32464e[_0x4fa507(0xc7)]);else throw _0x1c169f;}return console['log'](),0x0;}catch(_0xedb8f8){return console[_0x4fa507(0xdd)](),handleSDKError(_0xedb8f8,_0x32464e),0x1;}}[a8_0x104de4(0xe3)](_0x10544f){const _0x2bbc16=a8_0x104de4;if(_0x2bbc16(0xb5)in _0x10544f)process['stdout'][_0x2bbc16(0xbf)](_0x10544f[_0x2bbc16(0xb5)]);else'error'in _0x10544f&&console['error']('\x0aError:\x20'+_0x10544f[_0x2bbc16(0xdd)]);}}
|
|
@@ -1 +1 @@
|
|
|
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;}}}
|
|
1
|
+
const a9_0x5add6b=a9_0x2e6c;(function(_0x2e7208,_0x12d131){const _0x27d6d4=a9_0x2e6c,_0x4e39e6=_0x2e7208();while(!![]){try{const _0x155928=-parseInt(_0x27d6d4(0x186))/0x1*(parseInt(_0x27d6d4(0x12c))/0x2)+parseInt(_0x27d6d4(0x12b))/0x3+-parseInt(_0x27d6d4(0x151))/0x4*(parseInt(_0x27d6d4(0x165))/0x5)+parseInt(_0x27d6d4(0x190))/0x6+parseInt(_0x27d6d4(0x178))/0x7+-parseInt(_0x27d6d4(0x10f))/0x8*(-parseInt(_0x27d6d4(0x166))/0x9)+-parseInt(_0x27d6d4(0x160))/0xa*(parseInt(_0x27d6d4(0x142))/0xb);if(_0x155928===_0x12d131)break;else _0x4e39e6['push'](_0x4e39e6['shift']());}catch(_0x43b06a){_0x4e39e6['push'](_0x4e39e6['shift']());}}}(a9_0x132a,0xb0900));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x2bccd9 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';function a9_0x2e6c(_0x2c6fb4,_0x44935e){_0x2c6fb4=_0x2c6fb4-0x100;const _0x132a80=a9_0x132a();let _0x2e6cb7=_0x132a80[_0x2c6fb4];return _0x2e6cb7;}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=a9_0x5add6b(0x174);function handleInstallationError(_0x2be884,_0x234fa8,_0x582201,_0x494f99){const _0x19ba75=a9_0x5add6b;errorContains(_0x2be884,_0x19ba75(0x188),_0x19ba75(0x121),_0x19ba75(0x19c))?(_0x582201['text']='✓\x20'+_0x234fa8+_0x19ba75(0x11c),_0x494f99?.[_0x19ba75(0x181)](_0x234fa8+_0x19ba75(0x11c)),_0x2be884 instanceof SDKError&&_0x2be884[_0x19ba75(0x18b)]&&_0x494f99?.['debug'](_0x19ba75(0x17e)+_0x2be884[_0x19ba75(0x18b)][_0x19ba75(0x13a)])):(_0x582201[_0x19ba75(0x193)](_0x19ba75(0x177)+_0x234fa8),_0x494f99?.[_0x19ba75(0x10b)](_0x234fa8+_0x19ba75(0x196),_0x2be884));}export function parseVersion(_0x1e4faa){const _0x4d96a1=a9_0x5add6b,_0x858af7=_0x1e4faa[_0x4d96a1(0x14c)]()[_0x4d96a1(0x162)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x858af7)return null;return{'major':parseInt(_0x858af7[0x1],0xa),'minor':parseInt(_0x858af7[0x2],0xa),'patch':parseInt(_0x858af7[0x3],0xa)};}export function compareVersions(_0x538096,_0x2e2b17){const _0x2b11e1=a9_0x5add6b;if(_0x538096[_0x2b11e1(0x10a)]!==_0x2e2b17[_0x2b11e1(0x10a)])return _0x538096['major']-_0x2e2b17['major'];if(_0x538096[_0x2b11e1(0x127)]!==_0x2e2b17[_0x2b11e1(0x127)])return _0x538096[_0x2b11e1(0x127)]-_0x2e2b17[_0x2b11e1(0x127)];return _0x538096[_0x2b11e1(0x155)]-_0x2e2b17[_0x2b11e1(0x155)];}async function checkClaudeVersion(_0x6d1936,_0x17bb03){const _0x2860ea=a9_0x5add6b;_0x17bb03?.[_0x2860ea(0x13c)](_0x2860ea(0x103)+_0x6d1936+')');const _0x5328b5=await executeClaudeCommand([_0x2860ea(0x170)],undefined,_0x17bb03),_0x1f63f8=parseVersion(_0x5328b5);if(!_0x1f63f8){_0x17bb03?.[_0x2860ea(0x193)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x5328b5);return;}const _0x10bb7a=_0x1f63f8['major']+'.'+_0x1f63f8[_0x2860ea(0x127)]+'.'+_0x1f63f8[_0x2860ea(0x155)],_0x45b956=parseVersion(_0x6d1936);if(!_0x45b956){_0x17bb03?.[_0x2860ea(0x193)](_0x2860ea(0x11b)+_0x6d1936);return;}if(compareVersions(_0x1f63f8,_0x45b956)<0x0){_0x17bb03?.['error'](_0x2860ea(0x139)+_0x10bb7a+_0x2860ea(0x110)+_0x6d1936+')');throw new SDKError(ErrorCode[_0x2860ea(0x11a)],_0x2860ea(0x139)+_0x10bb7a+_0x2860ea(0x16e)+_0x6d1936+'\x20or\x20later.',undefined,{'helpText':_0x2860ea(0x189)});}_0x17bb03?.['debug']('Claude\x20Code\x20version\x20'+_0x10bb7a+_0x2860ea(0x173));}async function executeClaudeCommand(_0x5bb1e2,_0x5c9972,_0x1e96d4){const _0x31dde0=a9_0x5add6b;return _0x1e96d4?.['info'](_0x31dde0(0x149)+_0x5bb1e2['join']('\x20')),new Promise((_0x3b26c8,_0x36d8a0)=>{const _0x2957c2=_0x31dde0,_0x277872=crossSpawn(_0x2957c2(0x161),_0x5bb1e2,{'stdio':'pipe'});let _0x452751='',_0x36f65b='';_0x277872[_0x2957c2(0x118)]?.['on']('data',_0x3fbb40=>{const _0x5c2766=_0x2957c2;_0x452751+=_0x3fbb40[_0x5c2766(0x13d)]();}),_0x277872[_0x2957c2(0x10e)]?.['on'](_0x2957c2(0x199),_0x53efb1=>{const _0x5a9b16=_0x2957c2;_0x36f65b+=_0x53efb1[_0x5a9b16(0x13d)]();}),_0x277872['on'](_0x2957c2(0x10b),_0x24ec04=>{const _0x59936b=_0x2957c2;_0x24ec04['code']===_0x59936b(0x19a)?(_0x1e96d4?.[_0x59936b(0x10b)](_0x59936b(0x124)),_0x36d8a0(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],_0x59936b(0x124),_0x24ec04,{'helpText':_0x59936b(0x17a)}))):(_0x1e96d4?.[_0x59936b(0x10b)]('Command\x20spawn\x20error:\x20'+_0x24ec04['message']),_0x36d8a0(new SDKError(ErrorCode[_0x59936b(0x109)],_0x59936b(0x192)+_0x24ec04['message'],_0x24ec04)));}),_0x277872['on'](_0x2957c2(0x104),_0x5df13d=>{const _0x16d6a1=_0x2957c2;if(_0x5df13d===0x0)_0x3b26c8(_0x452751);else _0x5c9972?(_0x1e96d4?.[_0x16d6a1(0x10b)]('Command\x20failed\x20(exit\x20'+_0x5df13d+_0x16d6a1(0x16a)+_0x5bb1e2[_0x16d6a1(0x17b)]('\x20')),_0x36d8a0(new SDKError(ErrorCode[_0x16d6a1(0x16d)],_0x5c9972,new Error(_0x36f65b)))):_0x3b26c8('');});});}async function ensureMcpServer(_0x3e012b,_0x3b52b6,_0x503558,_0x43a5be,_0x101ac6){const _0x222159=a9_0x5add6b;_0x43a5be['text']=_0x222159(0x11e)+_0x3e012b+_0x222159(0x15d),await executeClaudeCommand([_0x222159(0x116),'add',_0x3e012b,_0x3b52b6,_0x222159(0x15f),_0x503558],_0x222159(0x16c)+_0x3e012b+'\x27',_0x101ac6),_0x43a5be[_0x222159(0x123)]=_0x222159(0x13f)+_0x3e012b+_0x222159(0x156);}function a9_0x132a(){const _0x488069=['statusline','\x20configuration\x20failed','site','utf-8','data','ENOENT','Invalid\x20LLM\x20proxy\x20URL:\x20','already\x20configured','log','logger','getOrCreateDefaultProject','add','server','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','exit','✓\x20Logs\x20saved\x20to\x20','workflow-skills','Failed\x20to\x20launch\x20Claude\x20Code:\x20','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','INTERNAL','major','error','CLAUDE_CODE_USE_BEDROCK','env','stderr','31944ycEdVr','\x20is\x20too\x20old\x20(minimum:\x20','tdx-managed-proxy','marketplace','update','http','ANTHROPIC_AUTH_TOKEN','mcp','✓\x20Found\x20available\x20port:\x20','stdout','close','CLAUDE_CODE_UNSUPPORTED_VERSION','Invalid\x20minimum\x20version\x20format:\x20','\x20already\x20configured','ANTHROPIC_MODEL','Configuring\x20MCP\x20server\x20\x27','TD\x20Docs\x20MCP\x20Server','includes','already\x20installed','Failed\x20to\x20update\x20marketplace\x20\x27','text','Claude\x20Code\x20CLI\x20not\x20found','command','start','minor','llm-proxy','verbose','.claude','1813992USepEC','2844ORGzQP','object','getCurrent','Installing\x20plugin\x20\x27','cwd','✓\x20Settings\x20configured:\x20.claude/settings.local.json','\x27\x20installed','settings.local.json','port','hostname','td-skills','context','logLevel','Claude\x20Code\x20version\x20','message','canParse','debug','toString','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','✓\x20MCP\x20server\x20\x27','apiKey','name','528SdKPJE','td-docs','getLogPath','CLAUDE_CODE_USE_VERTEX','continue','plugin','originalSettings','Executing:\x20claude\x20','account_id','inherit','trim','llmProxy','✓\x20Using\x20project:\x20','INVALID_ARGUMENT','Failed\x20to\x20configure\x20marketplace\x20\x27','6084HiuvFx','parse','CLAUDE_CODE_NOT_FOUND','resume','patch','\x27\x20configured','http://127.0.0.1:','td-skills\x20Plugins','statusLine','stop','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','unshift','\x27...','Initializing...','--transport','8270AICOQJ','claude','match','description','passThroughServer','3265xBzCTD','1521bFYADa','Finding\x20available\x20port...','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','user','):\x20claude\x20','\x27\x20updated','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','INSTALLATION_FAILED','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','✓\x20Plugin\x20\x27','--version','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','red','\x20meets\x20minimum\x20requirement','2.0.20','Claude\x20Code\x20version\x20check\x20failed','string','Warning:\x20Failed\x20to\x20configure\x20','8189748fzYbha','green','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','join','init','tdx\x20claude\x20statusline','Command\x20output:\x20','✓\x20Marketplace\x20\x27','sql-skills','info','profile','Creating\x20.claude/settings.local.json...','type','Checking\x20Claude\x20Code\x20version...','911ECYRib','execute','already\x20exists','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','✓\x20Settings\x20restored:\x20.claude/settings.local.json','cause','stringify','ANTHROPIC_BASE_URL','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','tdx\x20--profile\x20','3612636gTBSmb','proxy','Failed\x20to\x20spawn\x20claude\x20command:\x20','warn','false'];a9_0x132a=function(){return _0x488069;};return a9_0x132a();}async function ensureMarketplace(_0x1ea294,_0x3156af,_0x55181b,_0x21ef0f){const _0x817fb5=a9_0x5add6b;_0x55181b['text']='Configuring\x20marketplace\x20\x27'+_0x1ea294+_0x817fb5(0x15d),await executeClaudeCommand([_0x817fb5(0x147),_0x817fb5(0x112),_0x817fb5(0x101),_0x3156af],_0x817fb5(0x150)+_0x1ea294+'\x27',_0x21ef0f),_0x55181b[_0x817fb5(0x123)]=_0x817fb5(0x17f)+_0x1ea294+_0x817fb5(0x156);}async function updateMarketplace(_0x1516ba,_0x2cbcf1,_0x457215){const _0x44f84c=a9_0x5add6b;_0x2cbcf1['text']='Updating\x20marketplace\x20\x27'+_0x1516ba+_0x44f84c(0x15d),await executeClaudeCommand(['plugin',_0x44f84c(0x112),_0x44f84c(0x113)],_0x44f84c(0x122)+_0x1516ba+'\x27',_0x457215),_0x2cbcf1[_0x44f84c(0x123)]=_0x44f84c(0x17f)+_0x1516ba+_0x44f84c(0x16b);}async function ensurePlugin(_0x2514ff,_0xfcdd0f,_0x7b1004,_0x46c61f){const _0xf83a4a=a9_0x5add6b;_0x7b1004['text']=_0xf83a4a(0x12f)+_0x2514ff+_0xf83a4a(0x15d),await executeClaudeCommand(['plugin','install',_0x2514ff+'@'+_0xfcdd0f],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x2514ff+'\x27',_0x46c61f),_0x7b1004[_0xf83a4a(0x123)]=_0xf83a4a(0x16f)+_0x2514ff+_0xf83a4a(0x132);}async function createClaudeSettings(_0x14dcd3,_0x4d356a,_0x12c10a){const _0x272f7c=a9_0x5add6b,_0x374ead=join(process[_0x272f7c(0x130)](),_0x272f7c(0x12a)),_0x34bffb=join(_0x374ead,'settings.local.json');await mkdir(_0x374ead,{'recursive':!![]});let _0x421cbb={};if(existsSync(_0x34bffb))try{const _0x4db495=await readFile(_0x34bffb,_0x272f7c(0x198));_0x421cbb=JSON[_0x272f7c(0x152)](_0x4db495);}catch{_0x421cbb={};}const _0x151fbc=_0x421cbb[_0x272f7c(0x10d)]||{},_0x51baf3={'ANTHROPIC_BASE_URL':_0x151fbc[_0x272f7c(0x18d)],'ANTHROPIC_MODEL':_0x151fbc[_0x272f7c(0x11d)],'ANTHROPIC_AUTH_TOKEN':_0x151fbc['ANTHROPIC_AUTH_TOKEN'],'CLAUDE_CODE_USE_BEDROCK':_0x151fbc['CLAUDE_CODE_USE_BEDROCK'],'CLAUDE_CODE_USE_VERTEX':_0x151fbc[_0x272f7c(0x145)],'statusLine':_0x421cbb[_0x272f7c(0x159)]},_0x325279={..._0x421cbb,'env':{..._0x151fbc,'ANTHROPIC_BASE_URL':_0x272f7c(0x157)+_0x14dcd3,..._0x4d356a&&{'ANTHROPIC_MODEL':_0x4d356a},'ANTHROPIC_AUTH_TOKEN':_0x272f7c(0x111),'CLAUDE_CODE_USE_BEDROCK':_0x272f7c(0x194),'CLAUDE_CODE_USE_VERTEX':_0x272f7c(0x194)},'statusLine':{'type':_0x272f7c(0x125),'command':_0x12c10a?_0x272f7c(0x18f)+_0x12c10a+'\x20claude\x20statusline':_0x272f7c(0x17d)}};return await writeFile(_0x34bffb,JSON[_0x272f7c(0x18c)](_0x325279,null,0x2)+'\x0a'),_0x51baf3;}async function restoreClaudeSettings(_0x4f7036){const _0x331d9f=a9_0x5add6b,_0x4fce79=join(process[_0x331d9f(0x130)](),_0x331d9f(0x12a)),_0x446c26=join(_0x4fce79,_0x331d9f(0x133));if(!existsSync(_0x446c26))return;try{const _0x5e6b4b=await readFile(_0x446c26,_0x331d9f(0x198)),_0x41a472=JSON['parse'](_0x5e6b4b),_0xb065fb=_0x41a472[_0x331d9f(0x10d)]||{},_0x59b6b4=_0xb065fb['ANTHROPIC_BASE_URL'],_0x3af6a0=((()=>{const _0x4a6d3f=_0x331d9f;if(typeof _0x59b6b4!==_0x4a6d3f(0x176))return![];try{const _0x5e52fc=new URL(_0x59b6b4);return _0x5e52fc[_0x4a6d3f(0x135)]==='localhost'||_0x5e52fc['hostname']==='127.0.0.1';}catch{return![];}})());_0x3af6a0?(delete _0xb065fb['ANTHROPIC_BASE_URL'],delete _0xb065fb[_0x331d9f(0x11d)],delete _0xb065fb[_0x331d9f(0x115)],delete _0xb065fb[_0x331d9f(0x10c)],delete _0xb065fb[_0x331d9f(0x145)]):(_0x4f7036[_0x331d9f(0x18d)]!==undefined?_0xb065fb['ANTHROPIC_BASE_URL']=_0x4f7036['ANTHROPIC_BASE_URL']:delete _0xb065fb[_0x331d9f(0x18d)],_0x4f7036['ANTHROPIC_MODEL']!==undefined?_0xb065fb['ANTHROPIC_MODEL']=_0x4f7036[_0x331d9f(0x11d)]:delete _0xb065fb[_0x331d9f(0x11d)],_0x4f7036[_0x331d9f(0x115)]!==undefined?_0xb065fb[_0x331d9f(0x115)]=_0x4f7036[_0x331d9f(0x115)]:delete _0xb065fb['ANTHROPIC_AUTH_TOKEN'],_0x4f7036[_0x331d9f(0x10c)]!==undefined?_0xb065fb[_0x331d9f(0x10c)]=_0x4f7036[_0x331d9f(0x10c)]:delete _0xb065fb['CLAUDE_CODE_USE_BEDROCK'],_0x4f7036[_0x331d9f(0x145)]!==undefined?_0xb065fb[_0x331d9f(0x145)]=_0x4f7036[_0x331d9f(0x145)]:delete _0xb065fb[_0x331d9f(0x145)]);const _0xd536b5=_0x41a472[_0x331d9f(0x159)],_0x373152=((()=>{const _0x554040=_0x331d9f;if(!_0xd536b5||typeof _0xd536b5!==_0x554040(0x12d))return![];if(_0xd536b5[_0x554040(0x184)]!==_0x554040(0x125))return![];if(typeof _0xd536b5[_0x554040(0x125)]!==_0x554040(0x176))return![];return _0xd536b5[_0x554040(0x125)][_0x554040(0x120)]('tdx')&&_0xd536b5['command'][_0x554040(0x120)](_0x554040(0x195));})());if(_0x373152)delete _0x41a472['statusLine'];else _0x4f7036[_0x331d9f(0x159)]!==undefined?_0x41a472[_0x331d9f(0x159)]=_0x4f7036['statusLine']:delete _0x41a472[_0x331d9f(0x159)];_0x41a472[_0x331d9f(0x10d)]=_0xb065fb,await writeFile(_0x446c26,JSON['stringify'](_0x41a472,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x5add6b(0x141)]=a9_0x5add6b(0x161);[a9_0x5add6b(0x163)]=a9_0x5add6b(0x18e);['server'];['passThroughServer'];['originalSettings'];['logger'];['port'];async[a9_0x5add6b(0x187)](_0x5e173a){const _0x1ab173=a9_0x5add6b,{tdx:_0x18ed24,options:_0x3dd36d,args:_0x3e3154}=_0x5e173a;try{const _0xfc0384=_0x3dd36d,_0x1edeb7=_0xfc0384[_0x1ab173(0x191)]===![],_0x44b8ea=_0xfc0384[_0x1ab173(0x146)]===!![],_0x301b06=_0xfc0384[_0x1ab173(0x154)]===!![],_0x41a5a9=_0xfc0384[_0x1ab173(0x14d)],_0x4ee8c3=_0x41a5a9!==undefined&&_0x41a5a9!==![],_0x2b9265=typeof _0x41a5a9===_0x1ab173(0x176)?_0x41a5a9:undefined,_0x12f89e=_0x4ee8c3?undefined:_0xfc0384['model'],_0x2ad8fd=[..._0x3e3154];if(_0x44b8ea)_0x2ad8fd['unshift']('-c');else _0x301b06&&_0x2ad8fd[_0x1ab173(0x15c)]('-r');const _0x226434=createCommandSpinner(_0x1ab173(0x15e),{'verbose':_0x3dd36d[_0x1ab173(0x129)]});_0x226434[_0x1ab173(0x126)]();try{if(!_0x1edeb7){_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x167),this[_0x1ab173(0x134)]=await findAvailablePort(0xfa0),_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x117)+this[_0x1ab173(0x134)];const _0x49e642=_0x3dd36d[_0x1ab173(0x182)];try{const _0x597689=await _0x18ed24[_0x1ab173(0x169)][_0x1ab173(0x12e)]();_0x597689['account_id']&&writeCachedAccountInfo(_0x3dd36d[_0x1ab173(0x197)],_0x597689[_0x1ab173(0x14a)],_0x49e642);}catch{}_0x226434[_0x1ab173(0x123)]='Initializing\x20proxy\x20logger...',this[_0x1ab173(0x19e)]=new TDXLogger(_0x3dd36d[_0x1ab173(0x138)],!![]),await this[_0x1ab173(0x19e)][_0x1ab173(0x17c)]();const _0xcadd0d=this[_0x1ab173(0x19e)]['getLogPath']();_0x226434[_0x1ab173(0x123)]='✓\x20Logging\x20to\x20'+_0xcadd0d;if(_0x4ee8c3){if(_0x2b9265&&!URL[_0x1ab173(0x13b)](_0x2b9265))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ab173(0x19b)+_0x2b9265);const _0x4dfddb=_0x2b9265||getEndpoint(_0x3dd36d[_0x1ab173(0x197)],_0x1ab173(0x128));_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x13e);if(!_0x18ed24[_0x1ab173(0x137)][_0x1ab173(0x140)])throw new SDKError(ErrorCode[_0x1ab173(0x14f)],'API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode');this[_0x1ab173(0x164)]=new PassThroughProxyServer({'port':this['port'],'llmProxyUrl':_0x4dfddb,'apiKey':_0x18ed24[_0x1ab173(0x137)][_0x1ab173(0x140)],'logger':this[_0x1ab173(0x19e)],'site':_0x3dd36d[_0x1ab173(0x197)],'profile':_0x49e642}),await this[_0x1ab173(0x164)][_0x1ab173(0x126)](),_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x108)+this[_0x1ab173(0x134)]+'\x20→\x20'+_0x4dfddb;}else{_0x226434['text']='Setting\x20up\x20project...';const _0x1c5c32=await _0x18ed24['llm'][_0x1ab173(0x100)](),_0x26c3fb=_0x1c5c32['id'];_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x14e)+_0x1c5c32['attributes'][_0x1ab173(0x141)],_0x226434['text']='Starting\x20TD\x20LLM\x20proxy\x20server...',this[_0x1ab173(0x102)]=new ProxyServer({'port':this[_0x1ab173(0x134)],'projectId':_0x26c3fb,'tdx':_0x18ed24,'logger':this['logger'],'site':_0x3dd36d[_0x1ab173(0x197)]}),await this[_0x1ab173(0x102)][_0x1ab173(0x126)](),_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x171)+this[_0x1ab173(0x134)];}_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x183),this[_0x1ab173(0x148)]=await createClaudeSettings(this[_0x1ab173(0x134)],_0x12f89e,_0x49e642),_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x131);}else _0x226434[_0x1ab173(0x123)]=_0x1ab173(0x15b);try{_0x226434[_0x1ab173(0x123)]=_0x1ab173(0x185),await checkClaudeVersion(MIN_CLAUDE_VERSION,this['logger']),_0x226434['text']='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x24515b){_0x226434['fail'](_0x1ab173(0x175));throw _0x24515b;}try{await ensureMcpServer(_0x1ab173(0x143),'https://docs.treasuredata.com/mcp',_0x1ab173(0x114),_0x226434,this[_0x1ab173(0x19e)]);}catch(_0x48646c){handleInstallationError(_0x48646c,_0x1ab173(0x11f),_0x226434,this[_0x1ab173(0x19e)]);}try{await ensureMarketplace(_0x1ab173(0x136),'https://github.com/treasure-data/td-skills',_0x226434,this[_0x1ab173(0x19e)]),await updateMarketplace(_0x1ab173(0x136),_0x226434,this[_0x1ab173(0x19e)]),await ensurePlugin(_0x1ab173(0x180),'td-skills',_0x226434,this[_0x1ab173(0x19e)]),await ensurePlugin(_0x1ab173(0x106),_0x1ab173(0x136),_0x226434,this[_0x1ab173(0x19e)]),await ensurePlugin('tdx-skills',_0x1ab173(0x136),_0x226434,this[_0x1ab173(0x19e)]);}catch(_0x271af2){handleInstallationError(_0x271af2,_0x1ab173(0x158),_0x226434,this['logger']);}_0x226434[_0x1ab173(0x15a)]();}catch(_0x32d234){_0x226434['fail']('Setup\x20failed');throw _0x32d234;}const _0x29934a=await findExecutable(_0x1ab173(0x161));if(!_0x29934a)throw new SDKError(ErrorCode[_0x1ab173(0x153)],_0x1ab173(0x124),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x48297d={...process['env']};!_0x1edeb7&&(_0x48297d['ANTHROPIC_BASE_URL']=_0x1ab173(0x157)+this[_0x1ab173(0x134)],_0x12f89e&&(_0x48297d[_0x1ab173(0x11d)]=_0x12f89e),_0x48297d[_0x1ab173(0x115)]=_0x1ab173(0x111),_0x48297d[_0x1ab173(0x10c)]=_0x1ab173(0x194),_0x48297d[_0x1ab173(0x145)]='false');const _0x6f6d8b=crossSpawn(_0x29934a,_0x2ad8fd,{'stdio':_0x1ab173(0x14b),'env':_0x48297d}),_0x199cfa=await new Promise(_0x39c48a=>{_0x6f6d8b['on']('exit',_0x192216=>{_0x39c48a(_0x192216||0x0);}),_0x6f6d8b['on']('error',_0x221eac=>{const _0x5b129d=a9_0x2e6c;console[_0x5b129d(0x10b)](a9_0x2bccd9[_0x5b129d(0x172)](_0x5b129d(0x107)+_0x221eac[_0x5b129d(0x13a)])),_0x39c48a(0x1);});});this['server']&&(await this[_0x1ab173(0x102)][_0x1ab173(0x15a)](),console['log'](a9_0x2bccd9[_0x1ab173(0x179)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));this[_0x1ab173(0x164)]&&(await this['passThroughServer'][_0x1ab173(0x15a)](),console[_0x1ab173(0x19d)](a9_0x2bccd9[_0x1ab173(0x179)](_0x1ab173(0x168))));if(this[_0x1ab173(0x19e)]){await this[_0x1ab173(0x19e)][_0x1ab173(0x119)]();const _0x4d4452=this[_0x1ab173(0x19e)][_0x1ab173(0x144)]();console[_0x1ab173(0x19d)](a9_0x2bccd9[_0x1ab173(0x179)](_0x1ab173(0x105)+_0x4d4452));}return this[_0x1ab173(0x148)]&&(await restoreClaudeSettings(this[_0x1ab173(0x148)]),console['log'](a9_0x2bccd9[_0x1ab173(0x179)](_0x1ab173(0x18a)))),_0x199cfa;}catch(_0x584245){this['server']&&await this[_0x1ab173(0x102)]['stop']();this[_0x1ab173(0x164)]&&await this['passThroughServer'][_0x1ab173(0x15a)]();this[_0x1ab173(0x19e)]&&await this[_0x1ab173(0x19e)][_0x1ab173(0x119)]();this[_0x1ab173(0x148)]&&await restoreClaudeSettings(this[_0x1ab173(0x148)]);throw _0x584245;}}}
|