@treasuredata/tdx 0.16.6 → 0.16.7
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.d.ts +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/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/command.js.map +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.d.ts +20 -0
- package/dist/commands/status-command.d.ts.map +1 -0
- package/dist/commands/status-command.js +1 -0
- package/dist/commands/status-command.js.map +1 -0
- 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.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +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.d.ts +3 -1
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +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/agent/types/agent-def.d.ts +3 -3
- package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.d.ts +9 -1
- package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js.map +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.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +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.d.ts +1 -1
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/llm.d.ts +36 -1
- package/dist/sdk/types/llm.d.ts.map +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/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.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
|
-
function a4_0x14a8(_0x3a1270,_0x31ca73){_0x3a1270=_0x3a1270-0x103;const _0x4732bd=a4_0x4732();let _0x14a863=_0x4732bd[_0x3a1270];return _0x14a863;}const a4_0x59c3f0=a4_0x14a8;(function(_0x5a35b2,_0x164bc3){const _0x2f3ef2=a4_0x14a8,_0x27042a=_0x5a35b2();while(!![]){try{const _0x3481cc=-parseInt(_0x2f3ef2(0x181))/0x1+-parseInt(_0x2f3ef2(0x1a5))/0x2+parseInt(_0x2f3ef2(0x188))/0x3+-parseInt(_0x2f3ef2(0x1a3))/0x4+-parseInt(_0x2f3ef2(0x15b))/0x5*(-parseInt(_0x2f3ef2(0x130))/0x6)+parseInt(_0x2f3ef2(0x147))/0x7*(parseInt(_0x2f3ef2(0x10d))/0x8)+parseInt(_0x2f3ef2(0x16c))/0x9*(-parseInt(_0x2f3ef2(0x1a4))/0xa);if(_0x3481cc===_0x164bc3)break;else _0x27042a['push'](_0x27042a['shift']());}catch(_0x202cef){_0x27042a['push'](_0x27042a['shift']());}}}(a4_0x4732,0x1e467));import a4_0x16b09a from'chalk';import a4_0x1b7e2f from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';function a4_0x4732(){const _0x24f5ff=['Status:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','textKnowledgeBases','yellow','\x20\x20Agents:\x20','outputPath','agentName','green','updated','\x0aChanges\x20to\x20agent\x20\x27','Using\x20current\x20project:\x20','Would\x20push\x20agent:\x20','agent.yml','\x20errors','profile','6YrAwTo','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','join','\x20--name\x20','New\x20project\x20ID:\x20','counts','projectName','source','\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)','\x20\x20Prompts:\x20','Pull\x20cancelled','message','Agent\x20','pushProject','\x20\x20Text\x20Knowledge\x20Base\x20\x22','Analyzing\x20changes\x20to\x20push...','agents','dirname','Output:\x20','name','\x0aWrite\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','Would\x20clone:','1848wBmqxR','force','action','\x22:\x20','\x20created','Dry\x20run\x20-\x20no\x20changes\x20made','repeat','Using\x20project\x20from\x20','\x20files?','error','Using\x20project:\x20','red','\x20\x20tdx\x20agent\x20pull\x20','\x20total','projectDir','execute','<new-name>','Using\x20local\x20project:\x20','utf-8','\x0aPull\x20summary\x20for\x20\x27','1050565LuifwS','prompts','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','diff','\x20updated','Writing\x20files...','\x20\x20Integrations:\x20','\x20unchanged','sourceProjectName','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','no_local_folder','output','Push\x20cancelled','Using\x20context\x20project:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','llm_project','Project\x20cloned\x20with\x20errors','144AEudHj','\x20resources?','\x20\x20Knowledge\x20Bases:\x20','Failed\x20to\x20push\x20agent:\x20','Pushing\x20to\x20project...','knowledgeBases','Cloning\x20\x22','newProjectId','\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','integrations','\x20new','\x20\x20Prompt\x20\x22','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20files\x20to\x20','Clone\x20\x22','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','\x20\x20tdx\x20agent\x20clone\x20agents/','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)','pullAgent','Cannot\x20clone\x20from\x20context\x20project\x20\x22','parse','82877XsaHSo','\x0aPush\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','agentId','reason','\x0a✔\x20Pushed\x20','errors','400449OHamFo','isNew','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','\x20--profile\x20','log','\x20=\x20','dim','\x20successfully','\x0aChanges\x20to\x20integration\x20\x27','Project\x20cloned\x20successfully','dryRun','Analyzing\x20project\x20\x22','Agent\x20pulled\x20successfully','\x0aErrors\x20found:','pullProject','description','site','\x20|\x20','agent:push','llm','\x20\x20Agent\x20\x22','Clone\x20cancelled','cyan','✔\x20Context\x20set:\x20','new','cwd','created','248960cdHMbO','88170zgkbmA','24144CFtINm','gray','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x20\x20Knowledge\x20Base\x20\x22','llmProject','Output\x20path:\x20','\x0aChanges\x20to\x20prompt\x20\x27','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','no_context','\x20\x20Text\x20Knowledge\x20Bases:\x20','tdx.json','New\x20project:\x20','unchanged','total','push','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','newProjectName','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','\x22...','No\x20tdx.json\x20found\x20in\x20','yes','Summary:','agent:pull','2384KKJWyP','Agent:\x20','hasChanges','Project:\x20','Errors:','\x0aProject\x20pushed\x20with\x20errors','\x22\x20to\x20new\x20project\x20\x22','\x22\x20from\x20project\x20\x22','INVALID_ARGUMENT','cloneProject','Chat:\x20','\x20\x20Integration\x20\x22','projectId','\x22\x20to\x20\x22','\x20\x20Source:\x20','Would\x20pull\x20agent:\x20','\x22\x20to\x20a\x20different\x20profile','agent:clone','session','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a'];a4_0x4732=function(){return _0x24f5ff;};return a4_0x4732();}import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath,resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x333d57){const _0x2b7284=a4_0x14a8,_0x2ed4c0=[];if(_0x333d57[_0x2b7284(0x103)]!==undefined)_0x2ed4c0[_0x2b7284(0x104)](_0x333d57[_0x2b7284(0x103)]+_0x2b7284(0x154));if(_0x333d57[_0x2b7284(0x1a0)]!==undefined&&_0x333d57['new']>0x0)_0x2ed4c0[_0x2b7284(0x104)](a4_0x16b09a[_0x2b7284(0x128)](_0x333d57[_0x2b7284(0x1a0)]+_0x2b7284(0x176)));if(_0x333d57[_0x2b7284(0x1a2)]!==undefined&&_0x333d57['created']>0x0)_0x2ed4c0['push'](a4_0x16b09a[_0x2b7284(0x128)](_0x333d57[_0x2b7284(0x1a2)]+_0x2b7284(0x14b)));if(_0x333d57[_0x2b7284(0x129)]!==undefined&&_0x333d57[_0x2b7284(0x129)]>0x0)_0x2ed4c0['push'](a4_0x16b09a[_0x2b7284(0x124)](_0x333d57[_0x2b7284(0x129)]+_0x2b7284(0x15f)));if(_0x333d57[_0x2b7284(0x1b1)]!==undefined&&_0x333d57[_0x2b7284(0x1b1)]>0x0)_0x2ed4c0[_0x2b7284(0x104)](a4_0x16b09a[_0x2b7284(0x1a6)](_0x333d57[_0x2b7284(0x1b1)]+_0x2b7284(0x162)));if(_0x333d57[_0x2b7284(0x187)]!==undefined&&_0x333d57['errors']>0x0)_0x2ed4c0[_0x2b7284(0x104)](a4_0x16b09a[_0x2b7284(0x152)](_0x333d57[_0x2b7284(0x187)]+_0x2b7284(0x12e)));return _0x2ed4c0['join'](',\x20');}function displayDiffs(_0x52959c,_0x5a2af9,_0xf2e267,_0x55fae7,_0x5c1dae=[]){const _0xc72057=a4_0x14a8;for(const _0x24f4f6 of _0x52959c){if(_0x24f4f6['diff']){const _0x4e7a2b=_0x24f4f6[_0xc72057(0x127)]||_0x24f4f6[_0xc72057(0x143)];console[_0xc72057(0x18c)](_0xc72057(0x12a)+_0x4e7a2b+'\x27:'),console['log']('─'[_0xc72057(0x14d)](0x3c)),console[_0xc72057(0x18c)](_0x24f4f6[_0xc72057(0x15e)]),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c));}}for(const _0x15680c of _0x5a2af9){_0x15680c[_0xc72057(0x15e)]&&(console[_0xc72057(0x18c)]('\x0aChanges\x20to\x20knowledge\x20base\x20\x27'+_0x15680c[_0xc72057(0x143)]+'\x27:'),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c)),console['log'](_0x15680c['diff']),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c)));}for(const _0x1153b0 of _0xf2e267){_0x1153b0[_0xc72057(0x15e)]&&(console['log']('\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27'+_0x1153b0[_0xc72057(0x143)]+'\x27:'),console[_0xc72057(0x18c)]('─'['repeat'](0x3c)),console[_0xc72057(0x18c)](_0x1153b0[_0xc72057(0x15e)]),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c)));}for(const _0x2afbea of _0x55fae7){_0x2afbea[_0xc72057(0x15e)]&&(console['log'](_0xc72057(0x1ab)+_0x2afbea[_0xc72057(0x143)]+'\x27:'),console['log']('─'[_0xc72057(0x14d)](0x3c)),console[_0xc72057(0x18c)](_0x2afbea['diff']),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c)));}for(const _0x713f8d of _0x5c1dae){_0x713f8d[_0xc72057(0x15e)]&&(console[_0xc72057(0x18c)](_0xc72057(0x190)+_0x713f8d[_0xc72057(0x143)]+'\x27:'),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c)),console[_0xc72057(0x18c)](_0x713f8d[_0xc72057(0x15e)]),console[_0xc72057(0x18c)]('─'[_0xc72057(0x14d)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x59c3f0(0x143)]=a4_0x59c3f0(0x10c);['description']=a4_0x59c3f0(0x18a);async[a4_0x59c3f0(0x156)](_0xa843ed){const _0x1edb42=a4_0x59c3f0,{options:_0x41cb67,args:_0x404c9b,tdx:_0x47ba7d}=_0xa843ed,_0x2b0302=_0x404c9b[0x0],_0x91e6bf=_0x404c9b[0x1],_0x22aaea=_0x41cb67[_0x1edb42(0x166)],_0x367b3f=_0x41cb67['dryRun'],_0x3e8988=_0x41cb67[_0x1edb42(0x148)],_0x4639f1=_0x41cb67['yes'],_0x5de458=_0x41cb67['llmProject'];let _0x221053,_0x56ecea;const _0x3c60f1=findAgentConfigPath(process['cwd']());if(_0x2b0302){const _0x419848=a4_0x1b7e2f[_0x1edb42(0x132)](_0x2b0302,_0x1edb42(0x1af));if(existsSync(_0x419848))try{const _0x3c6f7c=JSON[_0x1edb42(0x180)](readFileSync(_0x419848,_0x1edb42(0x159)));_0x221053=_0x3c6f7c[_0x1edb42(0x16a)],_0x56ecea=_0x2b0302,console[_0x1edb42(0x18c)](a4_0x16b09a[_0x1edb42(0x18e)](_0x1edb42(0x14e)+_0x419848+':\x20'+_0x221053));}catch{_0x221053=_0x2b0302;}else _0x221053=_0x2b0302;}else{if(_0x3c60f1)try{const _0x48c2f6=JSON[_0x1edb42(0x180)](readFileSync(_0x3c60f1,'utf-8'));_0x221053=_0x48c2f6[_0x1edb42(0x16a)],_0x56ecea=a4_0x1b7e2f['dirname'](_0x3c60f1),console['log'](a4_0x16b09a['dim']('Using\x20project:\x20'+_0x221053));}catch{_0x221053=_0x5de458;}else _0x221053=_0x5de458;}if(!_0x221053)return console[_0x1edb42(0x18c)](a4_0x16b09a['yellow'](_0x1edb42(0x120))),console[_0x1edb42(0x18c)](_0x1edb42(0x17d)),console[_0x1edb42(0x18c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project'),console[_0x1edb42(0x18c)](_0x1edb42(0x174)),console[_0x1edb42(0x18c)](_0x1edb42(0x169)),0x1;if(_0x91e6bf){const {data:_0x736b0}=await withSpinner('Pulling\x20agent\x20\x22'+_0x91e6bf+_0x1edb42(0x114)+_0x221053+_0x1edb42(0x108),()=>_0x47ba7d[_0x1edb42(0x19b)][_0x1edb42(0x17e)](_0x221053,_0x91e6bf,_0x22aaea,{'dryRun':_0x367b3f,'force':_0x3e8988}));if(_0x367b3f)return console[_0x1edb42(0x18c)](a4_0x16b09a[_0x1edb42(0x124)]('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0x1edb42(0x18c)](_0x1edb42(0x11c)+_0x736b0[_0x1edb42(0x127)]),console[_0x1edb42(0x18c)](_0x1edb42(0x1aa)+_0x736b0['outputPath']),_0x736b0[_0x1edb42(0x15e)]&&(console[_0x1edb42(0x18c)]('\x0aChanges:'),console[_0x1edb42(0x18c)]('─'[_0x1edb42(0x14d)](0x3c)),console[_0x1edb42(0x18c)](_0x736b0['diff']),console[_0x1edb42(0x18c)]('─'['repeat'](0x3c))),0x0;return console[_0x1edb42(0x18c)](a4_0x16b09a[_0x1edb42(0x128)](_0x1edb42(0x194))),console[_0x1edb42(0x18c)](_0x1edb42(0x10e)+_0x736b0[_0x1edb42(0x127)]),console[_0x1edb42(0x18c)](_0x1edb42(0x142)+_0x736b0[_0x1edb42(0x126)]),console[_0x1edb42(0x18c)](_0x1edb42(0x121)+(_0x736b0[_0x1edb42(0x189)]?a4_0x16b09a[_0x1edb42(0x128)]('new'):_0x736b0[_0x1edb42(0x10f)]?a4_0x16b09a['yellow']('updated'):a4_0x16b09a[_0x1edb42(0x1a6)](_0x1edb42(0x1b1)))),0x0;}const _0x30ec84=_0x56ecea||_0x22aaea,{data:_0x5e957b}=await withSpinner(_0x1edb42(0x193)+_0x221053+'\x22...',()=>_0x47ba7d['llm']['pullProject'](_0x221053,_0x30ec84,{'dryRun':!![]})),_0x5c6e03=_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x140)][_0x1edb42(0x1a0)]+_0x5e957b['counts'][_0x1edb42(0x171)][_0x1edb42(0x1a0)]+_0x5e957b['counts']['textKnowledgeBases']['new']+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x15c)][_0x1edb42(0x1a0)]+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x175)][_0x1edb42(0x1a0)],_0x13dc72=_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x140)]['updated']+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x171)]['updated']+_0x5e957b[_0x1edb42(0x135)]['textKnowledgeBases'][_0x1edb42(0x129)]+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x15c)][_0x1edb42(0x129)]+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x175)][_0x1edb42(0x129)],_0x504ce1=_0x5e957b[_0x1edb42(0x135)]['agents'][_0x1edb42(0x1b1)]+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x171)][_0x1edb42(0x1b1)]+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x123)][_0x1edb42(0x1b1)]+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x15c)]['unchanged']+_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x175)]['unchanged'];console[_0x1edb42(0x18c)](_0x1edb42(0x15a)+_0x5e957b[_0x1edb42(0x136)]+'\x27:'),console[_0x1edb42(0x18c)]('\x20\x20'+a4_0x16b09a[_0x1edb42(0x128)]('+\x20'+_0x5c6e03+_0x1edb42(0x176))+_0x1edb42(0x199)+a4_0x16b09a['yellow']('~\x20'+_0x13dc72+'\x20changed')+'\x20|\x20'+a4_0x16b09a[_0x1edb42(0x18e)]('=\x20'+_0x504ce1+'\x20unchanged')),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x5e957b['counts'][_0x1edb42(0x140)])),console[_0x1edb42(0x18c)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x171)])),console[_0x1edb42(0x18c)](_0x1edb42(0x1ae)+formatCountSummary(_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x123)])),console[_0x1edb42(0x18c)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x15c)])),console[_0x1edb42(0x18c)](_0x1edb42(0x161)+formatCountSummary(_0x5e957b[_0x1edb42(0x135)][_0x1edb42(0x175)])),console[_0x1edb42(0x18c)]('\x20\x20Target:\x20'+a4_0x16b09a[_0x1edb42(0x19e)](_0x5e957b['outputDir'])),displayDiffs(_0x5e957b[_0x1edb42(0x140)],_0x5e957b[_0x1edb42(0x171)],_0x5e957b[_0x1edb42(0x123)],_0x5e957b[_0x1edb42(0x15c)],_0x5e957b[_0x1edb42(0x175)]);if(_0x367b3f)return console[_0x1edb42(0x18c)](a4_0x16b09a[_0x1edb42(0x124)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x5c6e03===0x0&&_0x13dc72===0x0)return console['log'](a4_0x16b09a[_0x1edb42(0x128)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x5e957b[_0x1edb42(0x136)]},_0x41cb67[_0x1edb42(0x11f)]),console[_0x1edb42(0x18c)](a4_0x16b09a[_0x1edb42(0x128)](_0x1edb42(0x19f)+a4_0x16b09a[_0x1edb42(0x18e)](_0x1edb42(0x16a))+_0x1edb42(0x18d)+a4_0x16b09a[_0x1edb42(0x19e)](_0x5e957b[_0x1edb42(0x136)]))),0x0;if(!_0x4639f1&&!_0x3e8988){const _0x3f312d=await confirmKey(_0x1edb42(0x144)+(_0x5c6e03+_0x13dc72)+_0x1edb42(0x14f));if(!_0x3f312d)return console[_0x1edb42(0x18c)](_0x1edb42(0x13a)),0x0;}const {data:_0x3ac398}=await withSpinner(_0x1edb42(0x160),()=>_0x47ba7d[_0x1edb42(0x19b)][_0x1edb42(0x196)](_0x221053,_0x30ec84,{'force':_0x3e8988}));return console['log'](a4_0x16b09a['green']('\x0a✔\x20Pulled\x20'+(_0x5c6e03+_0x13dc72)+_0x1edb42(0x179)+_0x3ac398['outputDir'])),saveSessionContext({'llm_project':_0x3ac398[_0x1edb42(0x136)]},_0x41cb67['session']),console[_0x1edb42(0x18c)](a4_0x16b09a[_0x1edb42(0x128)](_0x1edb42(0x19f)+a4_0x16b09a['dim'](_0x1edb42(0x16a))+'\x20=\x20'+a4_0x16b09a[_0x1edb42(0x19e)](_0x3ac398[_0x1edb42(0x136)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x59c3f0(0x143)]=a4_0x59c3f0(0x11e);[a4_0x59c3f0(0x197)]=a4_0x59c3f0(0x1ac);async[a4_0x59c3f0(0x156)](_0x3df021){const _0x5f5932=a4_0x59c3f0,{options:_0x3a435d,args:_0x3affcb,tdx:_0x169e3c}=_0x3df021,_0x3ddf9d=_0x3affcb[0x0],_0x43c066=_0x3a435d[_0x5f5932(0x143)],_0x1b7187=_0x3a435d[_0x5f5932(0x192)],_0x1b4e60=_0x3a435d[_0x5f5932(0x10a)],_0x9dc9f4=_0x3a435d[_0x5f5932(0x198)],_0x1f8b0f=_0x3a435d[_0x5f5932(0x1a9)];let _0x585dee;const _0x5f4a36=findAgentConfigPath(process[_0x5f5932(0x1a1)]());if(_0x3ddf9d){const _0x27ccda=a4_0x1b7e2f[_0x5f5932(0x132)](_0x3ddf9d,_0x5f5932(0x1af));existsSync(_0x27ccda)?(_0x585dee=_0x3ddf9d,console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x18e)](_0x5f5932(0x158)+_0x3ddf9d))):_0x585dee=_0x3ddf9d;}else{if(_0x5f4a36)_0x585dee=a4_0x1b7e2f[_0x5f5932(0x141)](_0x5f4a36),console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x18e)](_0x5f5932(0x12b)+_0x585dee));else{if(_0x1f8b0f){const _0xe854d=sanitizeForFilesystem(_0x1f8b0f);let _0x2f9783=_0xe854d,_0x5f46a3=a4_0x1b7e2f['join'](process[_0x5f5932(0x1a1)](),'agents',_0xe854d,'tdx.json');if(!existsSync(_0x5f46a3)){const _0xcab380=normalizeName(_0x1f8b0f),_0x30d642=a4_0x1b7e2f['join'](process[_0x5f5932(0x1a1)](),_0x5f5932(0x140),_0xcab380,_0x5f5932(0x1af));existsSync(_0x30d642)&&(_0x2f9783=_0xcab380,_0x5f46a3=_0x30d642);}if(existsSync(_0x5f46a3))_0x585dee=a4_0x1b7e2f[_0x5f5932(0x141)](_0x5f46a3),console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x18e)]('Using\x20local\x20project:\x20'+_0x585dee));else{const _0x201161=_0x3a435d[_0x5f5932(0x12f)];if(_0x201161)throw new SDKError(ErrorCode[_0x5f5932(0x115)],_0x5f5932(0x17f)+_0x1f8b0f+_0x5f5932(0x11d),undefined,{'helpText':_0x5f5932(0x17b)+_0x5f5932(0x183)+(_0x5f5932(0x153)+_0x1f8b0f+'\x0a')+(_0x5f5932(0x17c)+_0x2f9783+_0x5f5932(0x133)+(_0x43c066||_0x5f5932(0x157))+_0x5f5932(0x18b)+_0x201161)});_0x585dee=_0x1f8b0f,console[_0x5f5932(0x18c)](a4_0x16b09a['dim'](_0x5f5932(0x168)+_0x1f8b0f));}}}}if(!_0x585dee)return console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x124)]('No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a')),console['log'](_0x5f5932(0x107)),console[_0x5f5932(0x18c)](_0x5f5932(0x178)),console[_0x5f5932(0x18c)](_0x5f5932(0x138)),console[_0x5f5932(0x18c)](_0x5f5932(0x131)),0x1;if(!_0x43c066)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':_0x5f5932(0x105)});if(!_0x1b4e60&&!_0x1b7187){const _0x906076=await confirmKey(_0x5f5932(0x17a)+_0x585dee+_0x5f5932(0x113)+_0x43c066+'\x22?');if(!_0x906076)return console[_0x5f5932(0x18c)](_0x5f5932(0x19d)),0x0;}const {data:_0x5d0769}=await withSpinner(_0x5f5932(0x172)+_0x585dee+_0x5f5932(0x11a)+_0x43c066+'\x22...',()=>_0x169e3c[_0x5f5932(0x19b)][_0x5f5932(0x116)](_0x585dee,_0x43c066,{'dryRun':_0x1b7187}));if(_0x1b7187)return console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x124)](_0x5f5932(0x14c))),console[_0x5f5932(0x18c)]('Source:\x20'+_0x5d0769['sourceProjectName']),console[_0x5f5932(0x18c)](_0x5f5932(0x1b0)+_0x43c066),console[_0x5f5932(0x18c)](_0x5f5932(0x146)),console[_0x5f5932(0x18c)](_0x5f5932(0x125)+_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x140)]['created']),console[_0x5f5932(0x18c)](_0x5f5932(0x16e)+_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x171)][_0x5f5932(0x1a2)]),console['log']('\x20\x20Prompts:\x20'+_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x15c)][_0x5f5932(0x1a2)]),0x0;const _0x3fd125=_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x140)][_0x5f5932(0x187)]>0x0||_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x171)][_0x5f5932(0x187)]>0x0||_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x15c)][_0x5f5932(0x187)]>0x0;_0x3fd125?console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x124)](_0x5f5932(0x16b))):console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x128)](_0x5f5932(0x191)));console[_0x5f5932(0x18c)]('Source:\x20'+_0x5d0769[_0x5f5932(0x163)]),console[_0x5f5932(0x18c)](_0x5f5932(0x1b0)+_0x5d0769[_0x5f5932(0x106)]),console[_0x5f5932(0x18c)](_0x5f5932(0x134)+_0x5d0769['newProjectId']),console[_0x5f5932(0x18c)](),console[_0x5f5932(0x18c)](_0x5f5932(0x10b)),console[_0x5f5932(0x18c)](_0x5f5932(0x125)+formatCountSummary(_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x140)])),console[_0x5f5932(0x18c)](_0x5f5932(0x16e)+formatCountSummary(_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x171)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x15c)])),console[_0x5f5932(0x18c)]('\x20\x20Integrations:\x20'+formatCountSummary(_0x5d0769[_0x5f5932(0x135)][_0x5f5932(0x175)]));if(_0x3fd125){console[_0x5f5932(0x18c)](),console['log'](a4_0x16b09a[_0x5f5932(0x152)](_0x5f5932(0x111)));for(const _0x243fdf of _0x5d0769[_0x5f5932(0x140)]){_0x243fdf['action']===_0x5f5932(0x150)&&console[_0x5f5932(0x18c)](a4_0x16b09a[_0x5f5932(0x152)](_0x5f5932(0x19c)+_0x243fdf[_0x5f5932(0x127)]+_0x5f5932(0x14a)+_0x243fdf[_0x5f5932(0x150)]));}for(const _0x2ea0f1 of _0x5d0769[_0x5f5932(0x171)]){_0x2ea0f1[_0x5f5932(0x149)]==='error'&&console[_0x5f5932(0x18c)](a4_0x16b09a['red'](_0x5f5932(0x1a8)+_0x2ea0f1[_0x5f5932(0x143)]+_0x5f5932(0x14a)+_0x2ea0f1['error']));}for(const _0x18886f of _0x5d0769[_0x5f5932(0x15c)]){_0x18886f[_0x5f5932(0x149)]===_0x5f5932(0x150)&&console[_0x5f5932(0x18c)](a4_0x16b09a['red'](_0x5f5932(0x177)+_0x18886f['name']+_0x5f5932(0x14a)+_0x18886f[_0x5f5932(0x150)]));}for(const _0x46868e of _0x5d0769[_0x5f5932(0x175)]){_0x46868e[_0x5f5932(0x149)]===_0x5f5932(0x150)&&console['log'](a4_0x16b09a[_0x5f5932(0x152)](_0x5f5932(0x118)+_0x46868e['name']+_0x5f5932(0x14a)+_0x46868e[_0x5f5932(0x150)]));}return 0x1;}console[_0x5f5932(0x18c)]();const _0x3cb3aa=getLLMProjectUrl(_0x9dc9f4,_0x5d0769[_0x5f5932(0x173)]);return console[_0x5f5932(0x18c)](_0x5f5932(0x110)+a4_0x16b09a[_0x5f5932(0x19e)](_0x3cb3aa)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x59c3f0(0x19a);[a4_0x59c3f0(0x197)]=a4_0x59c3f0(0x15d);async['execute'](_0x4bdb66){const _0x3b9a40=a4_0x59c3f0,{options:_0x46f62b,args:_0xa4eab6,tdx:_0x2243cd}=_0x4bdb66;let _0x2ba9e3=_0xa4eab6[0x0]||process[_0x3b9a40(0x1a1)]();const _0x20321e=_0x46f62b[_0x3b9a40(0x192)],_0x24882b=_0x46f62b[_0x3b9a40(0x148)],_0x3fed7f=_0x46f62b[_0x3b9a40(0x10a)],_0x12ba4c=_0x46f62b[_0x3b9a40(0x198)],_0x227cd7=a4_0x1b7e2f[_0x3b9a40(0x132)](_0x2ba9e3,_0x3b9a40(0x12d)),_0x3d43a2=existsSync(_0x227cd7);if(_0x3d43a2){const {data:_0x5075c9}=await withSpinner('Pushing\x20agent\x20from\x20\x22'+_0x2ba9e3+_0x3b9a40(0x108),()=>_0x2243cd[_0x3b9a40(0x19b)]['pushAgent'](_0x2ba9e3,{'dryRun':_0x20321e,'force':_0x24882b}));if(_0x20321e)return console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x124)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console[_0x3b9a40(0x18c)](_0x3b9a40(0x12c)+_0x5075c9['agentName']),0x0;if(_0x5075c9[_0x3b9a40(0x149)]===_0x3b9a40(0x150))return console['log'](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x16f)+_0x5075c9[_0x3b9a40(0x150)])),0x1;console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x128)](_0x3b9a40(0x13c)+_0x5075c9[_0x3b9a40(0x149)]+_0x3b9a40(0x18f))),console[_0x3b9a40(0x18c)](_0x3b9a40(0x10e)+_0x5075c9['agentName']);if(_0x5075c9[_0x3b9a40(0x184)]&&_0x5075c9[_0x3b9a40(0x119)]){const _0x160fca=getLLMAgentChatUrl(_0x12ba4c,_0x5075c9[_0x3b9a40(0x119)],_0x5075c9['agentId']);console['log'](_0x3b9a40(0x117)+a4_0x16b09a[_0x3b9a40(0x19e)](_0x160fca));}return 0x0;}const _0x51b924=_0x46f62b[_0x3b9a40(0x1a9)],_0x491d7a=resolveProjectFromContext(_0x2ba9e3,_0x51b924);if(_0x491d7a['found'])_0x2ba9e3=_0x491d7a[_0x3b9a40(0x155)],_0x491d7a[_0x3b9a40(0x137)]==='context'&&console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x18e)](_0x3b9a40(0x151)+_0x2ba9e3));else{let _0xc680f4=_0x3b9a40(0x1a7);_0x491d7a['reason']===_0x3b9a40(0x165)&&(_0xc680f4=_0x491d7a[_0x3b9a40(0x13b)]+_0x3b9a40(0x164)+_0x491d7a['llmProject']+_0x3b9a40(0x122));throw new SDKError(ErrorCode[_0x3b9a40(0x115)],_0x491d7a[_0x3b9a40(0x185)]===_0x3b9a40(0x1ad)?_0x491d7a[_0x3b9a40(0x13b)]:_0x3b9a40(0x109)+_0x2ba9e3,undefined,{'helpText':_0xc680f4});}const {data:_0xd66cb5}=await withSpinner(_0x3b9a40(0x13f),()=>_0x2243cd['llm'][_0x3b9a40(0x13d)](_0x2ba9e3,{'dryRun':!![]})),_0x5b1dbe=_0xd66cb5['counts']['agents'][_0x3b9a40(0x187)]>0x0;if(_0x5b1dbe){console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x195)));for(const _0x452ad3 of _0xd66cb5[_0x3b9a40(0x140)]){_0x452ad3['action']==='error'&&console['log'](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x19c)+_0x452ad3[_0x3b9a40(0x127)]+_0x3b9a40(0x14a)+_0x452ad3[_0x3b9a40(0x150)]));}return 0x1;}const _0x1a1aeb=_0xd66cb5[_0x3b9a40(0x135)]['agents'][_0x3b9a40(0x1a2)]+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x171)][_0x3b9a40(0x1a2)]+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x123)][_0x3b9a40(0x1a2)]+_0xd66cb5['counts'][_0x3b9a40(0x15c)]['created']+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x175)]['created'],_0x1e807f=_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x140)]['updated']+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x171)][_0x3b9a40(0x129)]+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x123)][_0x3b9a40(0x129)]+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x15c)][_0x3b9a40(0x129)]+_0xd66cb5['counts']['integrations'][_0x3b9a40(0x129)],_0x3851c7=_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x140)][_0x3b9a40(0x1b1)]+_0xd66cb5['counts']['knowledgeBases'][_0x3b9a40(0x1b1)]+_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x123)]['unchanged']+_0xd66cb5[_0x3b9a40(0x135)]['prompts']['unchanged']+_0xd66cb5[_0x3b9a40(0x135)]['integrations']['unchanged'];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0xd66cb5[_0x3b9a40(0x136)]+'\x27:'),console['log']('\x20\x20'+a4_0x16b09a['green']('+\x20'+_0x1a1aeb+'\x20new')+_0x3b9a40(0x199)+a4_0x16b09a[_0x3b9a40(0x124)]('~\x20'+_0x1e807f+'\x20changed')+_0x3b9a40(0x199)+a4_0x16b09a[_0x3b9a40(0x18e)]('=\x20'+_0x3851c7+'\x20unchanged')),console[_0x3b9a40(0x18c)]('\x20\x20Agents:\x20'+formatCountSummary(_0xd66cb5['counts'][_0x3b9a40(0x140)])),console['log'](_0x3b9a40(0x16e)+formatCountSummary(_0xd66cb5['counts'][_0x3b9a40(0x171)])),console[_0x3b9a40(0x18c)](_0x3b9a40(0x1ae)+formatCountSummary(_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x123)])),console['log'](_0x3b9a40(0x139)+formatCountSummary(_0xd66cb5[_0x3b9a40(0x135)]['prompts'])),console[_0x3b9a40(0x18c)](_0x3b9a40(0x161)+formatCountSummary(_0xd66cb5[_0x3b9a40(0x135)][_0x3b9a40(0x175)])),console[_0x3b9a40(0x18c)](_0x3b9a40(0x11b)+a4_0x16b09a['cyan'](_0x2ba9e3)),displayDiffs(_0xd66cb5['agents'],_0xd66cb5[_0x3b9a40(0x171)],_0xd66cb5[_0x3b9a40(0x123)],_0xd66cb5[_0x3b9a40(0x15c)],_0xd66cb5['integrations']);if(_0x20321e)return console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x124)](_0x3b9a40(0x145))),0x0;if(_0x1a1aeb===0x0&&_0x1e807f===0x0){console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x128)]('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x41d26b=getLLMProjectUrl(_0x12ba4c,_0xd66cb5[_0x3b9a40(0x119)]);return console[_0x3b9a40(0x18c)](_0x3b9a40(0x110)+a4_0x16b09a[_0x3b9a40(0x19e)](_0x41d26b)),0x0;}if(!_0x3fed7f&&!_0x24882b){const _0x3cbaae=await confirmKey(_0x3b9a40(0x182)+(_0x1a1aeb+_0x1e807f)+_0x3b9a40(0x16d));if(!_0x3cbaae)return console['log'](_0x3b9a40(0x167)),0x0;}const {data:_0x2b5cf2}=await withSpinner(_0x3b9a40(0x170),()=>_0x2243cd[_0x3b9a40(0x19b)][_0x3b9a40(0x13d)](_0x2ba9e3,{'force':_0x24882b})),_0x4ed096=_0x2b5cf2[_0x3b9a40(0x135)]['agents']['errors']>0x0||_0x2b5cf2['counts'][_0x3b9a40(0x171)][_0x3b9a40(0x187)]>0x0||_0x2b5cf2[_0x3b9a40(0x135)][_0x3b9a40(0x123)]['errors']>0x0||_0x2b5cf2[_0x3b9a40(0x135)][_0x3b9a40(0x15c)]['errors']>0x0;if(_0x4ed096){console[_0x3b9a40(0x18c)](a4_0x16b09a['yellow'](_0x3b9a40(0x112))),console[_0x3b9a40(0x18c)](),console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x111)));for(const _0x35586c of _0x2b5cf2[_0x3b9a40(0x140)]){_0x35586c[_0x3b9a40(0x149)]===_0x3b9a40(0x150)&&console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x19c)+_0x35586c[_0x3b9a40(0x127)]+_0x3b9a40(0x14a)+_0x35586c[_0x3b9a40(0x150)]));}for(const _0xcdd4ba of _0x2b5cf2[_0x3b9a40(0x171)]){_0xcdd4ba[_0x3b9a40(0x149)]===_0x3b9a40(0x150)&&console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x1a8)+_0xcdd4ba['name']+_0x3b9a40(0x14a)+_0xcdd4ba[_0x3b9a40(0x150)]));}for(const _0x4f3dde of _0x2b5cf2[_0x3b9a40(0x123)]){_0x4f3dde['action']===_0x3b9a40(0x150)&&console[_0x3b9a40(0x18c)](a4_0x16b09a['red'](_0x3b9a40(0x13e)+_0x4f3dde['name']+_0x3b9a40(0x14a)+_0x4f3dde[_0x3b9a40(0x150)]));}for(const _0x2519d3 of _0x2b5cf2['prompts']){_0x2519d3['action']==='error'&&console[_0x3b9a40(0x18c)](a4_0x16b09a['red'](_0x3b9a40(0x177)+_0x2519d3['name']+_0x3b9a40(0x14a)+_0x2519d3[_0x3b9a40(0x150)]));}for(const _0x3f099a of _0x2b5cf2[_0x3b9a40(0x175)]){_0x3f099a['action']==='error'&&console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x152)](_0x3b9a40(0x118)+_0x3f099a['name']+_0x3b9a40(0x14a)+_0x3f099a['error']));}return 0x1;}console[_0x3b9a40(0x18c)](a4_0x16b09a[_0x3b9a40(0x128)](_0x3b9a40(0x186)+(_0x1a1aeb+_0x1e807f)+'\x20resources\x20to\x20\x27'+_0x2b5cf2[_0x3b9a40(0x136)]+'\x27'));const _0x2cef4f=getLLMProjectUrl(_0x12ba4c,_0x2b5cf2['projectId']);return console['log']('Project:\x20'+a4_0x16b09a[_0x3b9a40(0x19e)](_0x2cef4f)),0x0;}}
|
|
1
|
+
function a4_0x14dd(_0x30146f,_0x57ca5c){_0x30146f=_0x30146f-0x180;const _0x52ef97=a4_0x52ef();let _0x14ddf5=_0x52ef97[_0x30146f];return _0x14ddf5;}const a4_0x2b58b9=a4_0x14dd;(function(_0xd4552c,_0x283bcb){const _0x3e7e05=a4_0x14dd,_0x216af2=_0xd4552c();while(!![]){try{const _0x54c2fd=parseInt(_0x3e7e05(0x1a1))/0x1*(-parseInt(_0x3e7e05(0x1eb))/0x2)+parseInt(_0x3e7e05(0x1ff))/0x3*(-parseInt(_0x3e7e05(0x1a6))/0x4)+parseInt(_0x3e7e05(0x223))/0x5*(parseInt(_0x3e7e05(0x1f4))/0x6)+-parseInt(_0x3e7e05(0x200))/0x7*(-parseInt(_0x3e7e05(0x1f7))/0x8)+-parseInt(_0x3e7e05(0x194))/0x9+parseInt(_0x3e7e05(0x1dc))/0xa*(parseInt(_0x3e7e05(0x1b7))/0xb)+parseInt(_0x3e7e05(0x1a4))/0xc*(parseInt(_0x3e7e05(0x20d))/0xd);if(_0x54c2fd===_0x283bcb)break;else _0x216af2['push'](_0x216af2['shift']());}catch(_0x4484ce){_0x216af2['push'](_0x216af2['shift']());}}}(a4_0x52ef,0x4b43e));import a4_0x165195 from'chalk';import a4_0x13ae77 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';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';function a4_0x52ef(){const _0x36ef1c=['\x22\x20to\x20new\x20project\x20\x22','Dry\x20run\x20-\x20no\x20changes\x20made','Using\x20context\x20project:\x20','green','Agent\x20pulled\x20successfully','Would\x20clone:','cloneProject','\x20\x20Knowledge\x20Bases:\x20','Project:\x20','pullProject','Clone\x20\x22','Writing\x20files...','Failed\x20to\x20push\x20agent:\x20','utf-8','\x22:\x20','counts','\x20new','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','Analyzing\x20project\x20\x22','Status:\x20','Source:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','unchanged','\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','site','agent.yml','diff','pushProject','outputDir','Cloning\x20\x22','Pulling\x20agent\x20\x22','20lzqDyC','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x22\x20to\x20a\x20different\x20profile','error','errors','no_context','agentId','tdx.json','\x0aPush\x20summary\x20for\x20\x27','log','Would\x20pull\x20agent:\x20','agentName','Pushing\x20agent\x20from\x20\x22','New\x20project\x20ID:\x20','dirname','1202Xnezgt','agent:pull','Pull\x20cancelled','gray','prompts','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x0aChanges\x20to\x20prompt\x20\x27','isNew','\x0aChanges\x20to\x20agent\x20\x27','930378nNUcJc','sourceProjectName','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)','8YQSSmK','\x20errors','force','\x0a✔\x20Pulled\x20','Clone\x20cancelled','Would\x20push\x20agent:\x20','\x20\x20Text\x20Knowledge\x20Bases:\x20','newProjectName','511968hAGVZG','100219uBjQmp','outputPath','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Pushing\x20to\x20project...','session','yes','message','cyan','projectId','\x0aPull\x20summary\x20for\x20\x27','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','\x22\x20from\x20project\x20\x22','71981LTSDOO','projectDir','New\x20project\x20name\x20is\x20required','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','\x20changed','\x20\x20Target:\x20','repeat','integrations','\x20resources\x20to\x20\x27','\x0a✔\x20Pushed\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','red','Chat:\x20','\x20resources?','\x20updated','\x20\x20Prompts:\x20','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','newProjectId','Using\x20local\x20project:\x20','dryRun','\x22...','\x20\x20Source:\x20','5lrDirR','\x20=\x20','action','\x20unchanged','\x22\x20to\x20\x22','push','Using\x20project:\x20','\x20--profile\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','Using\x20project\x20from\x20','hasChanges','\x20\x20Agents:\x20','\x20\x20Prompt\x20\x22','<new-name>','agents','description','created','agent:push','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x20\x20Integrations:\x20','llm','reason','\x20files\x20to\x20','✔\x20Context\x20set:\x20','\x20|\x20','knowledgeBases','\x0aProject\x20pushed\x20with\x20errors','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','\x20\x20Text\x20Knowledge\x20Base\x20\x22','Agent:\x20','\x0aChanges\x20to\x20integration\x20\x27','projectName','profile','\x0aWrite\x20','1926378ANsbOb','dim','\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)','no_local_folder','llm_project','textKnowledgeBases','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','llmProject','name','\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','\x20\x20Integration\x20\x22','Output\x20path:\x20','\x20--name\x20','971KtITjF','new','source','2292THFCid','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','8zlPxDj','found','output','Dry\x20run\x20-\x20no\x20files\x20written','\x20total','join','INVALID_ARGUMENT','parse','\x20successfully','Errors:','cwd','total','\x20\x20Agent\x20\x22','New\x20project:\x20','\x0aPush\x20','No\x20tdx.json\x20found\x20in\x20','MISSING_ARGUMENT','1211452rBjDaD','agent:clone','updated','\x20created','yellow','execute'];a4_0x52ef=function(){return _0x36ef1c;};return a4_0x52ef();}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x527f08){const _0x713033=a4_0x14dd,_0x585f72=[];if(_0x527f08[_0x713033(0x1b1)]!==undefined)_0x585f72[_0x713033(0x228)](_0x527f08[_0x713033(0x1b1)]+_0x713033(0x1aa));if(_0x527f08[_0x713033(0x1a2)]!==undefined&&_0x527f08[_0x713033(0x1a2)]>0x0)_0x585f72['push'](a4_0x165195[_0x713033(0x1c0)](_0x527f08[_0x713033(0x1a2)]+_0x713033(0x1cd)));if(_0x527f08['created']!==undefined&&_0x527f08['created']>0x0)_0x585f72['push'](a4_0x165195[_0x713033(0x1c0)](_0x527f08[_0x713033(0x181)]+_0x713033(0x1ba)));if(_0x527f08[_0x713033(0x1b9)]!==undefined&&_0x527f08[_0x713033(0x1b9)]>0x0)_0x585f72[_0x713033(0x228)](a4_0x165195[_0x713033(0x1bb)](_0x527f08[_0x713033(0x1b9)]+_0x713033(0x21b)));if(_0x527f08[_0x713033(0x1d3)]!==undefined&&_0x527f08[_0x713033(0x1d3)]>0x0)_0x585f72[_0x713033(0x228)](a4_0x165195[_0x713033(0x1ee)](_0x527f08['unchanged']+_0x713033(0x226)));if(_0x527f08[_0x713033(0x1e0)]!==undefined&&_0x527f08['errors']>0x0)_0x585f72[_0x713033(0x228)](a4_0x165195[_0x713033(0x218)](_0x527f08['errors']+_0x713033(0x1f8)));return _0x585f72[_0x713033(0x1ab)](',\x20');}function displayDiffs(_0x18d3c7,_0x4e9f89,_0x53a359,_0x4ed19c,_0x7f826=[]){const _0x4febe1=a4_0x14dd;for(const _0x5a8498 of _0x18d3c7){if(_0x5a8498[_0x4febe1(0x1d7)]){const _0x35d570=_0x5a8498[_0x4febe1(0x1e7)]||_0x5a8498[_0x4febe1(0x19c)];console[_0x4febe1(0x1e5)](_0x4febe1(0x1f3)+_0x35d570+'\x27:'),console[_0x4febe1(0x1e5)]('─'['repeat'](0x3c)),console['log'](_0x5a8498[_0x4febe1(0x1d7)]),console[_0x4febe1(0x1e5)]('─'[_0x4febe1(0x213)](0x3c));}}for(const _0x314405 of _0x4e9f89){_0x314405[_0x4febe1(0x1d7)]&&(console[_0x4febe1(0x1e5)]('\x0aChanges\x20to\x20knowledge\x20base\x20\x27'+_0x314405['name']+'\x27:'),console[_0x4febe1(0x1e5)]('─'[_0x4febe1(0x213)](0x3c)),console[_0x4febe1(0x1e5)](_0x314405[_0x4febe1(0x1d7)]),console[_0x4febe1(0x1e5)]('─'[_0x4febe1(0x213)](0x3c)));}for(const _0x1e10a9 of _0x53a359){_0x1e10a9[_0x4febe1(0x1d7)]&&(console['log'](_0x4febe1(0x19a)+_0x1e10a9['name']+'\x27:'),console[_0x4febe1(0x1e5)]('─'['repeat'](0x3c)),console[_0x4febe1(0x1e5)](_0x1e10a9[_0x4febe1(0x1d7)]),console['log']('─'['repeat'](0x3c)));}for(const _0x29a053 of _0x4ed19c){_0x29a053[_0x4febe1(0x1d7)]&&(console[_0x4febe1(0x1e5)](_0x4febe1(0x1f1)+_0x29a053[_0x4febe1(0x19c)]+'\x27:'),console[_0x4febe1(0x1e5)]('─'[_0x4febe1(0x213)](0x3c)),console['log'](_0x29a053[_0x4febe1(0x1d7)]),console['log']('─'[_0x4febe1(0x213)](0x3c)));}for(const _0x3709c6 of _0x7f826){_0x3709c6[_0x4febe1(0x1d7)]&&(console[_0x4febe1(0x1e5)](_0x4febe1(0x190)+_0x3709c6[_0x4febe1(0x19c)]+'\x27:'),console['log']('─'['repeat'](0x3c)),console[_0x4febe1(0x1e5)](_0x3709c6[_0x4febe1(0x1d7)]),console[_0x4febe1(0x1e5)]('─'[_0x4febe1(0x213)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x2b58b9(0x19c)]=a4_0x2b58b9(0x1ec);[a4_0x2b58b9(0x180)]=a4_0x2b58b9(0x20b);async[a4_0x2b58b9(0x1bc)](_0x25addc){const _0x4501b5=a4_0x2b58b9,{options:_0x342e23,args:_0x392371,tdx:_0x5a33f8}=_0x25addc,_0x292983=_0x392371[0x0],_0x45f8e4=_0x392371[0x1],_0x2731eb=_0x342e23[_0x4501b5(0x1a8)],_0x2b0053=_0x342e23[_0x4501b5(0x220)],_0xff2d99=_0x342e23['force'],_0x365373=_0x342e23['yes'],_0x3f405b=_0x342e23['llmProject'];let _0x5cc354,_0x2f5dd3;const _0x591596=findAgentConfigPath(process[_0x4501b5(0x1b0)]());if(_0x292983){const _0x21b3d4=a4_0x13ae77['join'](_0x292983,'tdx.json');if(existsSync(_0x21b3d4))try{const _0x5313cb=JSON[_0x4501b5(0x1ad)](readFileSync(_0x21b3d4,'utf-8'));_0x5cc354=_0x5313cb['llm_project'],_0x2f5dd3=_0x292983,console[_0x4501b5(0x1e5)](a4_0x165195['dim'](_0x4501b5(0x22c)+_0x21b3d4+':\x20'+_0x5cc354));}catch{_0x5cc354=_0x292983;}else _0x5cc354=_0x292983;}else{if(_0x591596)try{const _0x30fe89=JSON[_0x4501b5(0x1ad)](readFileSync(_0x591596,_0x4501b5(0x1ca)));_0x5cc354=_0x30fe89[_0x4501b5(0x198)],_0x2f5dd3=a4_0x13ae77[_0x4501b5(0x1ea)](_0x591596),console[_0x4501b5(0x1e5)](a4_0x165195[_0x4501b5(0x195)](_0x4501b5(0x229)+_0x5cc354));}catch{_0x5cc354=_0x3f405b;}else _0x5cc354=_0x3f405b;}if(!_0x5cc354)return console['log'](a4_0x165195['yellow']('llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x4501b5(0x1e5)](_0x4501b5(0x1f6)),console[_0x4501b5(0x1e5)](_0x4501b5(0x19d)),console[_0x4501b5(0x1e5)](_0x4501b5(0x1d4)),console[_0x4501b5(0x1e5)](_0x4501b5(0x184)),0x1;if(_0x45f8e4){const {data:_0xc7cf44}=await withSpinner(_0x4501b5(0x1db)+_0x45f8e4+_0x4501b5(0x20c)+_0x5cc354+_0x4501b5(0x221),()=>_0x5a33f8['llm']['pullAgent'](_0x5cc354,_0x45f8e4,_0x2731eb,{'dryRun':_0x2b0053,'force':_0xff2d99}));if(_0x2b0053)return console[_0x4501b5(0x1e5)](a4_0x165195[_0x4501b5(0x1bb)](_0x4501b5(0x1a9))),console[_0x4501b5(0x1e5)](_0x4501b5(0x1e6)+_0xc7cf44[_0x4501b5(0x1e7)]),console[_0x4501b5(0x1e5)](_0x4501b5(0x19f)+_0xc7cf44['outputPath']),_0xc7cf44[_0x4501b5(0x1d7)]&&(console[_0x4501b5(0x1e5)]('\x0aChanges:'),console[_0x4501b5(0x1e5)]('─'['repeat'](0x3c)),console[_0x4501b5(0x1e5)](_0xc7cf44[_0x4501b5(0x1d7)]),console[_0x4501b5(0x1e5)]('─'[_0x4501b5(0x213)](0x3c))),0x0;return console['log'](a4_0x165195[_0x4501b5(0x1c0)](_0x4501b5(0x1c1))),console['log'](_0x4501b5(0x18f)+_0xc7cf44[_0x4501b5(0x1e7)]),console['log']('Output:\x20'+_0xc7cf44[_0x4501b5(0x201)]),console[_0x4501b5(0x1e5)](_0x4501b5(0x1d0)+(_0xc7cf44[_0x4501b5(0x1f2)]?a4_0x165195[_0x4501b5(0x1c0)](_0x4501b5(0x1a2)):_0xc7cf44[_0x4501b5(0x22d)]?a4_0x165195['yellow'](_0x4501b5(0x1b9)):a4_0x165195[_0x4501b5(0x1ee)](_0x4501b5(0x1d3)))),0x0;}const _0x46eccd=_0x2f5dd3||_0x2731eb,{data:_0xbf1b98}=await withSpinner(_0x4501b5(0x1cf)+_0x5cc354+_0x4501b5(0x221),()=>_0x5a33f8[_0x4501b5(0x186)]['pullProject'](_0x5cc354,_0x46eccd,{'dryRun':!![]})),_0x30042a=_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x231)]['new']+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x18b)][_0x4501b5(0x1a2)]+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x199)][_0x4501b5(0x1a2)]+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x1ef)]['new']+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x214)]['new'],_0x1691a0=_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x231)][_0x4501b5(0x1b9)]+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x18b)]['updated']+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x199)][_0x4501b5(0x1b9)]+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x1ef)][_0x4501b5(0x1b9)]+_0xbf1b98['counts'][_0x4501b5(0x214)][_0x4501b5(0x1b9)],_0x58c5df=_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x231)]['unchanged']+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x18b)]['unchanged']+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x199)]['unchanged']+_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x1ef)][_0x4501b5(0x1d3)]+_0xbf1b98['counts']['integrations'][_0x4501b5(0x1d3)];console[_0x4501b5(0x1e5)](_0x4501b5(0x20a)+_0xbf1b98[_0x4501b5(0x191)]+'\x27:'),console[_0x4501b5(0x1e5)]('\x20\x20'+a4_0x165195[_0x4501b5(0x1c0)]('+\x20'+_0x30042a+_0x4501b5(0x1cd))+'\x20|\x20'+a4_0x165195[_0x4501b5(0x1bb)]('~\x20'+_0x1691a0+_0x4501b5(0x211))+_0x4501b5(0x18a)+a4_0x165195[_0x4501b5(0x195)]('=\x20'+_0x58c5df+_0x4501b5(0x226))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0xbf1b98[_0x4501b5(0x1cc)]['agents'])),console[_0x4501b5(0x1e5)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0xbf1b98['counts'][_0x4501b5(0x18b)])),console[_0x4501b5(0x1e5)](_0x4501b5(0x1fd)+formatCountSummary(_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x199)])),console[_0x4501b5(0x1e5)](_0x4501b5(0x21c)+formatCountSummary(_0xbf1b98[_0x4501b5(0x1cc)][_0x4501b5(0x1ef)])),console[_0x4501b5(0x1e5)](_0x4501b5(0x185)+formatCountSummary(_0xbf1b98['counts'][_0x4501b5(0x214)])),console[_0x4501b5(0x1e5)](_0x4501b5(0x212)+a4_0x165195[_0x4501b5(0x208)](_0xbf1b98[_0x4501b5(0x1d9)])),displayDiffs(_0xbf1b98['agents'],_0xbf1b98[_0x4501b5(0x18b)],_0xbf1b98[_0x4501b5(0x199)],_0xbf1b98[_0x4501b5(0x1ef)],_0xbf1b98[_0x4501b5(0x214)]);if(_0x2b0053)return console['log'](a4_0x165195['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x30042a===0x0&&_0x1691a0===0x0)return console[_0x4501b5(0x1e5)](a4_0x165195[_0x4501b5(0x1c0)](_0x4501b5(0x1d2))),saveSessionContext({'llm_project':_0xbf1b98[_0x4501b5(0x191)]},_0x342e23[_0x4501b5(0x205)]),console['log'](a4_0x165195[_0x4501b5(0x1c0)](_0x4501b5(0x189)+a4_0x165195['dim']('llm_project')+_0x4501b5(0x224)+a4_0x165195[_0x4501b5(0x208)](_0xbf1b98[_0x4501b5(0x191)]))),0x0;if(!_0x365373&&!_0xff2d99){const _0x56ddbe=await confirmKey(_0x4501b5(0x193)+(_0x30042a+_0x1691a0)+'\x20files?');if(!_0x56ddbe)return console['log'](_0x4501b5(0x1ed)),0x0;}const {data:_0xbd913c}=await withSpinner(_0x4501b5(0x1c8),()=>_0x5a33f8[_0x4501b5(0x186)][_0x4501b5(0x1c6)](_0x5cc354,_0x46eccd,{'force':_0xff2d99}));return console[_0x4501b5(0x1e5)](a4_0x165195[_0x4501b5(0x1c0)](_0x4501b5(0x1fa)+(_0x30042a+_0x1691a0)+_0x4501b5(0x188)+_0xbd913c[_0x4501b5(0x1d9)])),saveSessionContext({'llm_project':_0xbd913c[_0x4501b5(0x191)]},_0x342e23['session']),console[_0x4501b5(0x1e5)](a4_0x165195[_0x4501b5(0x1c0)](_0x4501b5(0x189)+a4_0x165195[_0x4501b5(0x195)](_0x4501b5(0x198))+'\x20=\x20'+a4_0x165195[_0x4501b5(0x208)](_0xbd913c[_0x4501b5(0x191)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x2b58b9(0x1b8);[a4_0x2b58b9(0x180)]=a4_0x2b58b9(0x21d);async[a4_0x2b58b9(0x1bc)](_0x66b4b){const _0x5f3246=a4_0x2b58b9,{options:_0xa3e22e,args:_0x5f1c8b,tdx:_0x25a97b}=_0x66b4b,_0x3cb88d=_0x5f1c8b[0x0],_0x1b1fe9=_0xa3e22e[_0x5f3246(0x19c)],_0xc8c7e5=_0xa3e22e[_0x5f3246(0x220)],_0x213c17=_0xa3e22e['yes'],_0x574a93=_0xa3e22e[_0x5f3246(0x1d5)],_0xc8fc0a=_0xa3e22e[_0x5f3246(0x19b)];let _0x57b700;const _0x290cad=findAgentConfigPath(process[_0x5f3246(0x1b0)]());if(_0x3cb88d){const _0x24ed28=a4_0x13ae77[_0x5f3246(0x1ab)](_0x3cb88d,_0x5f3246(0x1e3));existsSync(_0x24ed28)?(_0x57b700=_0x3cb88d,console[_0x5f3246(0x1e5)](a4_0x165195['dim'](_0x5f3246(0x21f)+_0x3cb88d))):_0x57b700=_0x3cb88d;}else{if(_0x290cad)_0x57b700=a4_0x13ae77['dirname'](_0x290cad),console[_0x5f3246(0x1e5)](a4_0x165195[_0x5f3246(0x195)]('Using\x20current\x20project:\x20'+_0x57b700));else{if(_0xc8fc0a){const _0x1d9788=sanitizeForFilesystem(_0xc8fc0a);let _0x22cc15=_0x1d9788,_0x163271=a4_0x13ae77[_0x5f3246(0x1ab)](process['cwd'](),_0x5f3246(0x231),_0x1d9788,'tdx.json');if(!existsSync(_0x163271)){const _0x5e39f2=normalizeName(_0xc8fc0a),_0x507c1d=a4_0x13ae77[_0x5f3246(0x1ab)](process[_0x5f3246(0x1b0)](),_0x5f3246(0x231),_0x5e39f2,_0x5f3246(0x1e3));existsSync(_0x507c1d)&&(_0x22cc15=_0x5e39f2,_0x163271=_0x507c1d);}if(existsSync(_0x163271))_0x57b700=a4_0x13ae77[_0x5f3246(0x1ea)](_0x163271),console['log'](a4_0x165195[_0x5f3246(0x195)](_0x5f3246(0x21f)+_0x57b700));else{const _0x2d3f70=_0xa3e22e[_0x5f3246(0x192)];if(_0x2d3f70)throw new SDKError(ErrorCode[_0x5f3246(0x1ac)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0xc8fc0a+_0x5f3246(0x1de),undefined,{'helpText':_0x5f3246(0x202)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+('\x20\x20tdx\x20agent\x20pull\x20'+_0xc8fc0a+'\x0a')+(_0x5f3246(0x217)+_0x22cc15+_0x5f3246(0x1a0)+(_0x1b1fe9||_0x5f3246(0x230))+_0x5f3246(0x22a)+_0x2d3f70)});_0x57b700=_0xc8fc0a,console[_0x5f3246(0x1e5)](a4_0x165195[_0x5f3246(0x195)](_0x5f3246(0x1bf)+_0xc8fc0a));}}}}if(!_0x57b700)return console[_0x5f3246(0x1e5)](a4_0x165195[_0x5f3246(0x1bb)](_0x5f3246(0x203))),console[_0x5f3246(0x1e5)](_0x5f3246(0x1ce)),console[_0x5f3246(0x1e5)](_0x5f3246(0x1dd)),console[_0x5f3246(0x1e5)](_0x5f3246(0x196)),console['log'](_0x5f3246(0x210)),0x1;if(!_0x1b1fe9)throw new SDKError(ErrorCode[_0x5f3246(0x1b6)],_0x5f3246(0x20f),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x213c17&&!_0xc8c7e5){const _0x5efb5e=await confirmKey(_0x5f3246(0x1c7)+_0x57b700+_0x5f3246(0x1bd)+_0x1b1fe9+'\x22?');if(!_0x5efb5e)return console[_0x5f3246(0x1e5)](_0x5f3246(0x1fb)),0x0;}const {data:_0x11a7dd}=await withSpinner(_0x5f3246(0x1da)+_0x57b700+_0x5f3246(0x227)+_0x1b1fe9+_0x5f3246(0x221),()=>_0x25a97b[_0x5f3246(0x186)][_0x5f3246(0x1c3)](_0x57b700,_0x1b1fe9,{'dryRun':_0xc8c7e5}));if(_0xc8c7e5)return console['log'](a4_0x165195[_0x5f3246(0x1bb)](_0x5f3246(0x1be))),console[_0x5f3246(0x1e5)](_0x5f3246(0x1d1)+_0x11a7dd[_0x5f3246(0x1f5)]),console[_0x5f3246(0x1e5)](_0x5f3246(0x1b3)+_0x1b1fe9),console['log'](_0x5f3246(0x1c2)),console[_0x5f3246(0x1e5)](_0x5f3246(0x22e)+_0x11a7dd['counts'][_0x5f3246(0x231)][_0x5f3246(0x181)]),console[_0x5f3246(0x1e5)](_0x5f3246(0x1c4)+_0x11a7dd[_0x5f3246(0x1cc)][_0x5f3246(0x18b)][_0x5f3246(0x181)]),console[_0x5f3246(0x1e5)](_0x5f3246(0x21c)+_0x11a7dd['counts'][_0x5f3246(0x1ef)][_0x5f3246(0x181)]),0x0;const _0xb6d615=_0x11a7dd['counts'][_0x5f3246(0x231)][_0x5f3246(0x1e0)]>0x0||_0x11a7dd['counts']['knowledgeBases'][_0x5f3246(0x1e0)]>0x0||_0x11a7dd[_0x5f3246(0x1cc)]['prompts'][_0x5f3246(0x1e0)]>0x0;_0xb6d615?console[_0x5f3246(0x1e5)](a4_0x165195[_0x5f3246(0x1bb)]('Project\x20cloned\x20with\x20errors')):console[_0x5f3246(0x1e5)](a4_0x165195['green']('Project\x20cloned\x20successfully'));console[_0x5f3246(0x1e5)](_0x5f3246(0x1d1)+_0x11a7dd[_0x5f3246(0x1f5)]),console[_0x5f3246(0x1e5)]('New\x20project:\x20'+_0x11a7dd[_0x5f3246(0x1fe)]),console['log'](_0x5f3246(0x1e9)+_0x11a7dd[_0x5f3246(0x21e)]),console[_0x5f3246(0x1e5)](),console[_0x5f3246(0x1e5)]('Summary:'),console[_0x5f3246(0x1e5)](_0x5f3246(0x22e)+formatCountSummary(_0x11a7dd[_0x5f3246(0x1cc)]['agents'])),console[_0x5f3246(0x1e5)](_0x5f3246(0x1c4)+formatCountSummary(_0x11a7dd['counts'][_0x5f3246(0x18b)])),console['log'](_0x5f3246(0x21c)+formatCountSummary(_0x11a7dd[_0x5f3246(0x1cc)][_0x5f3246(0x1ef)])),console[_0x5f3246(0x1e5)](_0x5f3246(0x185)+formatCountSummary(_0x11a7dd[_0x5f3246(0x1cc)]['integrations']));if(_0xb6d615){console[_0x5f3246(0x1e5)](),console[_0x5f3246(0x1e5)](a4_0x165195[_0x5f3246(0x218)](_0x5f3246(0x1af)));for(const _0x34a8b0 of _0x11a7dd['agents']){_0x34a8b0[_0x5f3246(0x225)]==='error'&&console['log'](a4_0x165195['red'](_0x5f3246(0x1b2)+_0x34a8b0['agentName']+_0x5f3246(0x1cb)+_0x34a8b0[_0x5f3246(0x1df)]));}for(const _0x309f37 of _0x11a7dd['knowledgeBases']){_0x309f37['action']===_0x5f3246(0x1df)&&console['log'](a4_0x165195[_0x5f3246(0x218)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x309f37[_0x5f3246(0x19c)]+_0x5f3246(0x1cb)+_0x309f37['error']));}for(const _0x194347 of _0x11a7dd[_0x5f3246(0x1ef)]){_0x194347['action']===_0x5f3246(0x1df)&&console[_0x5f3246(0x1e5)](a4_0x165195['red'](_0x5f3246(0x22f)+_0x194347[_0x5f3246(0x19c)]+_0x5f3246(0x1cb)+_0x194347[_0x5f3246(0x1df)]));}for(const _0x3816c6 of _0x11a7dd[_0x5f3246(0x214)]){_0x3816c6[_0x5f3246(0x225)]===_0x5f3246(0x1df)&&console[_0x5f3246(0x1e5)](a4_0x165195['red']('\x20\x20Integration\x20\x22'+_0x3816c6[_0x5f3246(0x19c)]+'\x22:\x20'+_0x3816c6[_0x5f3246(0x1df)]));}return 0x1;}console[_0x5f3246(0x1e5)]();const _0x4c92be=getLLMProjectUrl(_0x574a93,_0x11a7dd[_0x5f3246(0x21e)]);return console['log']('Project:\x20'+a4_0x165195[_0x5f3246(0x208)](_0x4c92be)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x2b58b9(0x182);[a4_0x2b58b9(0x180)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x2b58b9(0x1bc)](_0x408e50){const _0x3a537d=a4_0x2b58b9,{options:_0x52bd58,args:_0x3cf475,tdx:_0x163940}=_0x408e50;let _0x55a63d=_0x3cf475[0x0]||process[_0x3a537d(0x1b0)]();const _0x486f77=_0x52bd58[_0x3a537d(0x220)],_0x5c8bbf=_0x52bd58[_0x3a537d(0x1f9)],_0x570fcd=_0x52bd58[_0x3a537d(0x206)],_0x30889d=_0x52bd58['site'],_0x783137=a4_0x13ae77['join'](_0x55a63d,_0x3a537d(0x1d6)),_0x5e47bf=existsSync(_0x783137);if(_0x5e47bf){const {data:_0x2d3d63}=await withSpinner(_0x3a537d(0x1e8)+_0x55a63d+_0x3a537d(0x221),()=>_0x163940[_0x3a537d(0x186)]['pushAgent'](_0x55a63d,{'dryRun':_0x486f77,'force':_0x5c8bbf}));if(_0x486f77)return console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x1bb)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console['log'](_0x3a537d(0x1fc)+_0x2d3d63['agentName']),0x0;if(_0x2d3d63[_0x3a537d(0x225)]==='error')return console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x218)](_0x3a537d(0x1c9)+_0x2d3d63[_0x3a537d(0x1df)])),0x1;console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x1c0)]('Agent\x20'+_0x2d3d63[_0x3a537d(0x225)]+_0x3a537d(0x1ae))),console[_0x3a537d(0x1e5)](_0x3a537d(0x18f)+_0x2d3d63[_0x3a537d(0x1e7)]);if(_0x2d3d63[_0x3a537d(0x1e2)]&&_0x2d3d63['projectId']){const _0xcccdb0=getLLMAgentChatUrl(_0x30889d,_0x2d3d63[_0x3a537d(0x209)],_0x2d3d63['agentId']);console['log'](_0x3a537d(0x219)+a4_0x165195['cyan'](_0xcccdb0));}return 0x0;}const _0x4a1b49=_0x52bd58[_0x3a537d(0x19b)],_0x1465af=resolveProjectFromContext(_0x55a63d,_0x4a1b49);if(_0x1465af[_0x3a537d(0x1a7)])_0x55a63d=_0x1465af[_0x3a537d(0x20e)],_0x1465af[_0x3a537d(0x1a3)]==='context'&&console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x195)](_0x3a537d(0x229)+_0x55a63d));else{let _0x12bd66=_0x3a537d(0x1f0);_0x1465af['reason']===_0x3a537d(0x197)&&(_0x12bd66=_0x1465af['message']+_0x3a537d(0x18d)+_0x1465af[_0x3a537d(0x19b)]+_0x3a537d(0x22b));throw new SDKError(ErrorCode[_0x3a537d(0x1ac)],_0x1465af[_0x3a537d(0x187)]===_0x3a537d(0x1e1)?_0x1465af[_0x3a537d(0x207)]:_0x3a537d(0x1b5)+_0x55a63d,undefined,{'helpText':_0x12bd66});}const {data:_0x63eb1b}=await withSpinner('Analyzing\x20changes\x20to\x20push...',()=>_0x163940['llm']['pushProject'](_0x55a63d,{'dryRun':!![]})),_0x48e818=_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x231)][_0x3a537d(0x1e0)]>0x0;if(_0x48e818){console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x218)]('\x0aErrors\x20found:'));for(const _0x3974cd of _0x63eb1b['agents']){_0x3974cd['action']==='error'&&console[_0x3a537d(0x1e5)](a4_0x165195['red']('\x20\x20Agent\x20\x22'+_0x3974cd[_0x3a537d(0x1e7)]+_0x3a537d(0x1cb)+_0x3974cd['error']));}return 0x1;}const _0x5f0496=_0x63eb1b[_0x3a537d(0x1cc)]['agents'][_0x3a537d(0x181)]+_0x63eb1b[_0x3a537d(0x1cc)]['knowledgeBases']['created']+_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x199)][_0x3a537d(0x181)]+_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x1ef)]['created']+_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x214)][_0x3a537d(0x181)],_0xc53fb5=_0x63eb1b[_0x3a537d(0x1cc)]['agents'][_0x3a537d(0x1b9)]+_0x63eb1b[_0x3a537d(0x1cc)]['knowledgeBases'][_0x3a537d(0x1b9)]+_0x63eb1b[_0x3a537d(0x1cc)]['textKnowledgeBases'][_0x3a537d(0x1b9)]+_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x1ef)]['updated']+_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x214)][_0x3a537d(0x1b9)],_0x130d4d=_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x231)]['unchanged']+_0x63eb1b['counts'][_0x3a537d(0x18b)]['unchanged']+_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x199)][_0x3a537d(0x1d3)]+_0x63eb1b['counts'][_0x3a537d(0x1ef)][_0x3a537d(0x1d3)]+_0x63eb1b[_0x3a537d(0x1cc)]['integrations'][_0x3a537d(0x1d3)];console[_0x3a537d(0x1e5)](_0x3a537d(0x1e4)+_0x63eb1b[_0x3a537d(0x191)]+'\x27:'),console[_0x3a537d(0x1e5)]('\x20\x20'+a4_0x165195[_0x3a537d(0x1c0)]('+\x20'+_0x5f0496+'\x20new')+'\x20|\x20'+a4_0x165195['yellow']('~\x20'+_0xc53fb5+_0x3a537d(0x211))+_0x3a537d(0x18a)+a4_0x165195[_0x3a537d(0x195)]('=\x20'+_0x130d4d+'\x20unchanged')),console['log'](_0x3a537d(0x22e)+formatCountSummary(_0x63eb1b['counts'][_0x3a537d(0x231)])),console[_0x3a537d(0x1e5)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x18b)])),console[_0x3a537d(0x1e5)](_0x3a537d(0x1fd)+formatCountSummary(_0x63eb1b['counts'][_0x3a537d(0x199)])),console[_0x3a537d(0x1e5)](_0x3a537d(0x21c)+formatCountSummary(_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x1ef)])),console[_0x3a537d(0x1e5)](_0x3a537d(0x185)+formatCountSummary(_0x63eb1b[_0x3a537d(0x1cc)][_0x3a537d(0x214)])),console[_0x3a537d(0x1e5)](_0x3a537d(0x222)+a4_0x165195['cyan'](_0x55a63d)),displayDiffs(_0x63eb1b[_0x3a537d(0x231)],_0x63eb1b[_0x3a537d(0x18b)],_0x63eb1b['textKnowledgeBases'],_0x63eb1b[_0x3a537d(0x1ef)],_0x63eb1b[_0x3a537d(0x214)]);if(_0x486f77)return console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x1bb)](_0x3a537d(0x1a5))),0x0;if(_0x5f0496===0x0&&_0xc53fb5===0x0){console[_0x3a537d(0x1e5)](a4_0x165195['green'](_0x3a537d(0x183)));const _0x1d8f75=getLLMProjectUrl(_0x30889d,_0x63eb1b['projectId']);return console['log']('Project:\x20'+a4_0x165195[_0x3a537d(0x208)](_0x1d8f75)),0x0;}if(!_0x570fcd&&!_0x5c8bbf){const _0x516c98=await confirmKey(_0x3a537d(0x1b4)+(_0x5f0496+_0xc53fb5)+_0x3a537d(0x21a));if(!_0x516c98)return console[_0x3a537d(0x1e5)]('Push\x20cancelled'),0x0;}const {data:_0x32ff64}=await withSpinner(_0x3a537d(0x204),()=>_0x163940['llm'][_0x3a537d(0x1d8)](_0x55a63d,{'force':_0x5c8bbf})),_0x48626a=_0x32ff64[_0x3a537d(0x1cc)]['agents'][_0x3a537d(0x1e0)]>0x0||_0x32ff64[_0x3a537d(0x1cc)][_0x3a537d(0x18b)][_0x3a537d(0x1e0)]>0x0||_0x32ff64[_0x3a537d(0x1cc)][_0x3a537d(0x199)]['errors']>0x0||_0x32ff64[_0x3a537d(0x1cc)][_0x3a537d(0x1ef)]['errors']>0x0;if(_0x48626a){console[_0x3a537d(0x1e5)](a4_0x165195['yellow'](_0x3a537d(0x18c))),console['log'](),console['log'](a4_0x165195[_0x3a537d(0x218)](_0x3a537d(0x1af)));for(const _0x45d764 of _0x32ff64['agents']){_0x45d764[_0x3a537d(0x225)]==='error'&&console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x218)]('\x20\x20Agent\x20\x22'+_0x45d764['agentName']+_0x3a537d(0x1cb)+_0x45d764[_0x3a537d(0x1df)]));}for(const _0x56d3f1 of _0x32ff64[_0x3a537d(0x18b)]){_0x56d3f1['action']===_0x3a537d(0x1df)&&console['log'](a4_0x165195[_0x3a537d(0x218)]('\x20\x20Knowledge\x20Base\x20\x22'+_0x56d3f1[_0x3a537d(0x19c)]+_0x3a537d(0x1cb)+_0x56d3f1['error']));}for(const _0x214248 of _0x32ff64[_0x3a537d(0x199)]){_0x214248[_0x3a537d(0x225)]===_0x3a537d(0x1df)&&console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x218)](_0x3a537d(0x18e)+_0x214248[_0x3a537d(0x19c)]+_0x3a537d(0x1cb)+_0x214248[_0x3a537d(0x1df)]));}for(const _0x295713 of _0x32ff64['prompts']){_0x295713[_0x3a537d(0x225)]===_0x3a537d(0x1df)&&console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x218)](_0x3a537d(0x22f)+_0x295713[_0x3a537d(0x19c)]+_0x3a537d(0x1cb)+_0x295713[_0x3a537d(0x1df)]));}for(const _0x5b1575 of _0x32ff64['integrations']){_0x5b1575[_0x3a537d(0x225)]===_0x3a537d(0x1df)&&console[_0x3a537d(0x1e5)](a4_0x165195[_0x3a537d(0x218)](_0x3a537d(0x19e)+_0x5b1575['name']+_0x3a537d(0x1cb)+_0x5b1575['error']));}return 0x1;}console[_0x3a537d(0x1e5)](a4_0x165195['green'](_0x3a537d(0x216)+(_0x5f0496+_0xc53fb5)+_0x3a537d(0x215)+_0x32ff64[_0x3a537d(0x191)]+'\x27'));const _0x548c07=getLLMProjectUrl(_0x30889d,_0x32ff64[_0x3a537d(0x209)]);return console[_0x3a537d(0x1e5)](_0x3a537d(0x1c5)+a4_0x165195['cyan'](_0x548c07)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a5_0x2b2139=a5_0x39d4;function a5_0x39d4(_0x36d2cf,_0x16bdc6){_0x36d2cf=_0x36d2cf-0xb8;const _0x4f2cc2=a5_0x4f2c();let _0x39d4d4=_0x4f2cc2[_0x36d2cf];return _0x39d4d4;}(function(_0x1e3d1f,_0x4b7e5d){const _0x2d5e3f=a5_0x39d4,_0x5c1d50=_0x1e3d1f();while(!![]){try{const _0x88a8d=-parseInt(_0x2d5e3f(0xfe))/0x1*(-parseInt(_0x2d5e3f(0xe6))/0x2)+-parseInt(_0x2d5e3f(0x11d))/0x3*(parseInt(_0x2d5e3f(0x10f))/0x4)+-parseInt(_0x2d5e3f(0xc1))/0x5*(parseInt(_0x2d5e3f(0xe1))/0x6)+-parseInt(_0x2d5e3f(0xf1))/0x7*(-parseInt(_0x2d5e3f(0xc0))/0x8)+-parseInt(_0x2d5e3f(0xc4))/0x9*(parseInt(_0x2d5e3f(0x134))/0xa)+parseInt(_0x2d5e3f(0x10a))/0xb+-parseInt(_0x2d5e3f(0x13e))/0xc*(-parseInt(_0x2d5e3f(0xdb))/0xd);if(_0x88a8d===_0x4b7e5d)break;else _0x5c1d50['push'](_0x5c1d50['shift']());}catch(_0x4ca83e){_0x5c1d50['push'](_0x5c1d50['shift']());}}}(a5_0x4f2c,0x54cdc));import*as a5_0x300f72 from'node:fs';import*as a5_0x1da603 from'node:path';import a5_0x37fb0b from'chalk';function a5_0x4f2c(){const _0x4c9134=['Running\x20agent\x20tests...','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','reason','status','Duration:\x20','join','...','jsonl','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','log','3730454QrjuwD','Error:\x20No\x20previous\x20test\x20run\x20found.','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','Errors:\x20\x20\x20','Using\x20agent:\x20','404','108KmdlEi','\x20\x20Agent:\x20','tsv','json','start','14eqibyD','filter','\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)','timestamp','resolveAgentId','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','Round\x20','message','stop','llm','Total:\x20\x20\x20\x20','7742zLFRDJ','\x20\x20Conversation:\x20','substring','writeFileSync','Site:\x20','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','trim','conversation_url','✓\x20PASS:\x20','\x20\x20Site:\x20','round','cyan','\x20(new)','86429KBvJvv','map','Cached\x20run\x20is\x20from\x20site\x20\x22','tests','✗\x20FAIL:\x20','Failed:\x20\x20\x20','reeval','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','push','\x20\x20Evaluating...\x20','PASS','isSpinning','5684305RxSUOn','Evaluating\x20response...','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','text','conversations','16NpOfqT','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','\x20-\x20','agentName','Run\x20\x27tdx\x20agent\x20pull\x20','Either\x20switch\x20to\x20the\x20\x22','Test\x20','Test\x20Summary','Re-evaluating\x20cached\x20test\x20run...','no_tests','existsSync','FAIL','Re-evaluating\x20','output','308973jBxmIJ','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','toISOString','white','has','basename','...\x20','Available\x20tests:\x20','includes','testName','yellow','resolve','\x22:\x20','now','dryRun','rounds','verbose','\x20\x20Project:\x20','Running\x20test:\x20','found','dim','table','Usage:','100fqszgM','not\x20found','\x20(cached)','length','\x20\x20-\x20','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','Tests\x20found:\x20','utf-8','Running:\x20','projectDir','12jyRIKW','ERROR','source','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','Round\x201/','llmProject','\x27\x20to\x20create\x20the\x20folder\x20structure.','execute','Error\x20writing\x20output\x20file:\x20','\x20\x20Round\x20','✗\x20ERROR:\x20Project\x20not\x20found:\x20','green','Cached\x20run\x20from:\x20','agentDirs','context','split','agent','multiple_agents','no_local_folder',':\x20Sending\x20user\x20input...','928dWLryY','40645jkWiPP','red','site','568233wCPghV','repeat','projectName','Executing\x20new\x20tests...','Conversation\x20URL:\x20','Passed:\x20\x20\x20','New\x20tests\x20to\x20execute:\x20','no_context','Re-evaluation\x20Summary','Run\x20tests\x20for\x20an\x20LLM\x20agent','eval','name','Output\x20written\x20to:\x20'];a5_0x4f2c=function(){return _0x4c9134;};return a5_0x4f2c();}import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}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']='agent:test';['description']=a5_0x2b2139(0xcd);async[a5_0x2b2139(0x145)](_0x453ff5){const _0x488ac3=a5_0x2b2139,{options:_0x14cdf4,args:_0x209cfb,tdx:_0x1c4d6d}=_0x453ff5,_0x4c29ad=_0x209cfb[0x0]||'.',_0x33df4d=_0x14cdf4[_0x488ac3(0x12b)],_0x31b79a=_0x14cdf4,_0x5d9600=_0x31b79a[_0x488ac3(0xce)]===![],_0x11f103=_0x31b79a[_0x488ac3(0x104)],_0x33db54=_0x31b79a[_0x488ac3(0xcf)],_0x15dcb3=_0x14cdf4[_0x488ac3(0xc3)],_0x257a65=_0x31b79a[_0x488ac3(0x11c)];if(_0x11f103&&_0x5d9600)return console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)](_0x488ac3(0x110))),0x1;let _0x1afa02=_0x488ac3(0x132);if(_0x31b79a[_0x488ac3(0xe4)])_0x1afa02='json';else{if(_0x31b79a[_0x488ac3(0xd8)])_0x1afa02='jsonl';else{if(_0x31b79a['tsv'])_0x1afa02=_0x488ac3(0xe3);else{if(_0x31b79a[_0x488ac3(0x132)])_0x1afa02=_0x488ac3(0x132);}}}const _0x281b01=_0x31b79a['llmProject'];let _0x3c518c=_0x4c29ad;const _0x19dc93=a5_0x300f72[_0x488ac3(0x119)](_0x4c29ad),_0x3319bf=_0x4c29ad==='.';if(!_0x19dc93||_0x3319bf){const _0x31f38a=resolveProjectFromContext(_0x4c29ad,_0x281b01,{'requireFile':'test.yml'});if(_0x31f38a[_0x488ac3(0x130)])_0x3c518c=_0x31f38a[_0x488ac3(0x13d)],_0x31f38a[_0x488ac3(0x140)]===_0x488ac3(0xba)&&console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x131)](_0x488ac3(0xdf)+_0x3c518c));else switch(_0x31f38a['reason']){case _0x488ac3(0xcb):console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x127)](_0x31f38a[_0x488ac3(0xed)])),console[_0x488ac3(0xda)](),console[_0x488ac3(0xda)](_0x488ac3(0x133)),console[_0x488ac3(0xda)]('\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'),console[_0x488ac3(0xda)](_0x488ac3(0xe8)),console['log'](),console[_0x488ac3(0xda)]('Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>');return 0x1;case _0x488ac3(0xbe):console[_0x488ac3(0xda)](a5_0x37fb0b['yellow'](_0x31f38a['message'])),console[_0x488ac3(0xda)](),console[_0x488ac3(0xda)](_0x488ac3(0x113)+_0x31f38a[_0x488ac3(0x143)]+_0x488ac3(0x144));return 0x1;case _0x488ac3(0xbd):{const _0x5a88b6=a5_0x1da603[_0x488ac3(0x122)](_0x31f38a[_0x488ac3(0x13d)]);console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x127)](_0x488ac3(0xd2)+_0x31f38a[_0x488ac3(0x143)]+'\x22:'));for(const _0x521e41 of _0x31f38a[_0x488ac3(0xb9)]){console[_0x488ac3(0xda)](_0x488ac3(0x138)+_0x521e41);}return console['log'](),console[_0x488ac3(0xda)](_0x488ac3(0x139)+_0x5a88b6+'/<agent-name>'),0x1;}case _0x488ac3(0x118):console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x127)](_0x488ac3(0x11e)+_0x31f38a[_0x488ac3(0x143)]+'\x22.')),console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x131)]('Project\x20path:\x20'+_0x31f38a[_0x488ac3(0x13d)])),console['log'](),console[_0x488ac3(0xda)](_0x488ac3(0xd9));return 0x1;}}const {definition:_0x3a4480,agentInfo:_0x2b09c4}=parseTestFile(_0x3c518c);let _0x34f2a3=_0x3a4480['tests'];if(_0x33db54){const _0x43c949=_0x33db54[_0x488ac3(0xbb)](',')[_0x488ac3(0xff)](_0x5f0b65=>_0x5f0b65[_0x488ac3(0xf7)]());_0x34f2a3=_0x3a4480[_0x488ac3(0x101)][_0x488ac3(0xe7)](_0x5ac972=>_0x43c949[_0x488ac3(0x125)](_0x5ac972['name']));if(_0x34f2a3['length']===0x0)return console['log'](a5_0x37fb0b[_0x488ac3(0x127)]('No\x20tests\x20found\x20matching:\x20'+_0x33db54)),console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x131)](_0x488ac3(0x124)+_0x3a4480[_0x488ac3(0x101)][_0x488ac3(0xff)](_0x2571e9=>_0x2571e9['name'])[_0x488ac3(0xd6)](',\x20'))),0x1;}if(_0x11f103)return this['executeReeval'](_0x453ff5,{'definition':{'tests':_0x34f2a3},'agentInfo':_0x2b09c4,'outputFormat':_0x1afa02,'outputFile':_0x257a65,'testNames':_0x33db54});if(_0x33df4d){console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xfc)]('Test\x20Configuration:')),console[_0x488ac3(0xda)](_0x488ac3(0xfa)+a5_0x37fb0b[_0x488ac3(0x120)](_0x15dcb3)),console[_0x488ac3(0xda)](_0x488ac3(0x12e)+a5_0x37fb0b[_0x488ac3(0x120)](_0x2b09c4[_0x488ac3(0xc6)])),console[_0x488ac3(0xda)](_0x488ac3(0xe2)+a5_0x37fb0b[_0x488ac3(0x120)](_0x2b09c4['agentName'])),console[_0x488ac3(0xda)](),console[_0x488ac3(0xda)](_0x488ac3(0x13a)+a5_0x37fb0b['white'](_0x34f2a3[_0x488ac3(0x137)]));for(let _0x44ba51=0x0;_0x44ba51<_0x34f2a3['length'];_0x44ba51++){const _0x325e05=_0x34f2a3[_0x44ba51],_0x1dbb15=_0x325e05[_0x488ac3(0x12c)][_0x488ac3(0x137)]===0x1?_0x488ac3(0xfb):'rounds';console[_0x488ac3(0xda)]('\x20\x20'+(_0x44ba51+0x1)+'.\x20'+a5_0x37fb0b['white'](_0x325e05[_0x488ac3(0xcf)])+'\x20('+_0x325e05['rounds'][_0x488ac3(0x137)]+'\x20'+_0x1dbb15+')');}return 0x0;}let _0x7d9995,_0xbdfe14;try{_0x7d9995=await _0x1c4d6d[_0x488ac3(0xef)]['resolveProjectId'](_0x2b09c4[_0x488ac3(0xc6)]);}catch(_0x1d9965){const _0x59fa0d=_0x1d9965 instanceof Error?_0x1d9965[_0x488ac3(0xed)]:String(_0x1d9965);return _0x59fa0d['includes'](_0x488ac3(0xe0))||_0x59fa0d['toLowerCase']()['includes'](_0x488ac3(0x135))?console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)](_0x488ac3(0x148)+_0x2b09c4['projectName'])):console[_0x488ac3(0xda)](a5_0x37fb0b['red'](_0x488ac3(0xdd)+_0x2b09c4[_0x488ac3(0xc6)]+_0x488ac3(0x129)+_0x59fa0d)),0x1;}try{_0xbdfe14=await _0x1c4d6d[_0x488ac3(0xef)][_0x488ac3(0xea)](_0x2b09c4['agentName'],_0x7d9995);}catch(_0x427644){const _0x54abe0=_0x427644 instanceof Error?_0x427644[_0x488ac3(0xed)]:String(_0x427644);return _0x54abe0['includes']('404')||_0x54abe0['toLowerCase']()['includes'](_0x488ac3(0x135))?console['log'](a5_0x37fb0b[_0x488ac3(0xc2)](_0x488ac3(0xeb)+_0x2b09c4[_0x488ac3(0x112)])):console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22'+_0x2b09c4['agentName']+_0x488ac3(0x129)+_0x54abe0)),0x1;}let _0x3d5793;if(!_0x5d9600)try{_0x3d5793=await setupEvaluatorAgent(_0x1c4d6d['llm'],_0x14cdf4[_0x488ac3(0x12d)]);}catch(_0x36c993){const _0x2100d9=_0x36c993 instanceof Error?_0x36c993['message']:String(_0x36c993);return console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x2100d9)),0x1;}console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xfc)](_0x488ac3(0xd1))),console[_0x488ac3(0xda)](_0x488ac3(0xf5)+a5_0x37fb0b[_0x488ac3(0x120)](_0x15dcb3)),console[_0x488ac3(0xda)]('Agent:\x20'+a5_0x37fb0b['white'](_0x2b09c4['projectName']+'/'+_0x2b09c4[_0x488ac3(0x112)])),console[_0x488ac3(0xda)]();const _0x42eb1f=[],_0x5c3649=[],_0x2ced28=Date[_0x488ac3(0x12a)]();for(let _0x25364e=0x0;_0x25364e<_0x34f2a3[_0x488ac3(0x137)];_0x25364e++){const _0x3af0d7=_0x34f2a3[_0x25364e];_0x34f2a3[_0x488ac3(0x137)]>0x1?console[_0x488ac3(0xda)](_0x488ac3(0x115)+(_0x25364e+0x1)+'/'+_0x34f2a3[_0x488ac3(0x137)]+':\x20'+a5_0x37fb0b['white'](_0x3af0d7[_0x488ac3(0xcf)])):console[_0x488ac3(0xda)](_0x488ac3(0x12f)+a5_0x37fb0b[_0x488ac3(0x120)](_0x3af0d7['name']));const _0x1c258b=createCommandSpinner(_0x488ac3(0x142)+_0x3af0d7[_0x488ac3(0x12c)][_0x488ac3(0x137)]+_0x488ac3(0xbf));_0x1c258b[_0x488ac3(0xe5)]();try{const {result:_0x22c218,conversation:_0xca379}=await runTest(_0x1c4d6d['llm'],_0x3af0d7,{'agentId':_0xbdfe14,'projectId':_0x7d9995,'site':_0x15dcb3,'noEval':_0x5d9600,'evaluatorId':_0x3d5793,'onRoundStart':(_0x4761b3,_0x4cba0b)=>{const _0x356dec=_0x488ac3;_0x1c258b['text']=_0x356dec(0xec)+(_0x4761b3+0x1)+'/'+_0x4cba0b+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x5f55ec,_0x289cc6,_0x209d92)=>{const _0x48ded0=_0x488ac3,_0x916751=formatElapsed(_0x289cc6);_0x209d92?console['log'](_0x48ded0(0x147)+(_0x5f55ec+0x1)+'/'+_0x3af0d7['rounds'][_0x48ded0(0x137)]+_0x48ded0(0x123)+a5_0x37fb0b['green']('✓')+'\x20('+_0x916751+')'):console[_0x48ded0(0xda)]('\x20\x20Round\x20'+(_0x5f55ec+0x1)+'/'+_0x3af0d7[_0x48ded0(0x12c)][_0x48ded0(0x137)]+_0x48ded0(0x123)+a5_0x37fb0b[_0x48ded0(0xc2)]('✗'));},'onEvaluationStart':()=>{const _0x26894f=_0x488ac3;_0x1c258b['text']=_0x26894f(0x10b);},'onEvaluationComplete':_0x1a825d=>{const _0x33c359=_0x488ac3,_0x3dc06e=formatElapsed(_0x1a825d);console[_0x33c359(0xda)](_0x33c359(0x107)+a5_0x37fb0b[_0x33c359(0x149)]('✓')+'\x20('+_0x3dc06e+')');}});_0x1c258b[_0x488ac3(0xee)](),_0x42eb1f[_0x488ac3(0x106)](_0x22c218),_0x5c3649[_0x488ac3(0x106)](_0xca379);if(_0x22c218[_0x488ac3(0xd4)]===_0x488ac3(0x108))console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x149)](_0x488ac3(0xf9)+_0x22c218['reason']));else _0x22c218['status']===_0x488ac3(0x11a)?console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)]('✗\x20FAIL:\x20'+_0x22c218[_0x488ac3(0xd3)])):console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)]('✗\x20ERROR:\x20'+_0x22c218['reason']));_0x22c218[_0x488ac3(0xf8)]&&console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0x131)](_0x488ac3(0xc8)+_0x22c218[_0x488ac3(0xf8)])),console[_0x488ac3(0xda)]();}catch(_0x38e291){_0x1c258b[_0x488ac3(0xee)]();const _0x453cc4=_0x38e291 instanceof Error?_0x38e291[_0x488ac3(0xed)]:String(_0x38e291);console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)]('✗\x20ERROR:\x20'+_0x453cc4)),console[_0x488ac3(0xda)](),_0x42eb1f[_0x488ac3(0x106)]({'name':_0x3af0d7[_0x488ac3(0xcf)],'status':'ERROR','reason':_0x453cc4,'timestamp':new Date()[_0x488ac3(0x11f)](),'duration_ms':0x0});}}const _0x11a1d3=Date['now']()-_0x2ced28,_0x2455a7=_0x42eb1f[_0x488ac3(0xe7)](_0x4715bb=>_0x4715bb[_0x488ac3(0xd4)]===_0x488ac3(0x108))[_0x488ac3(0x137)],_0x1381a5=_0x42eb1f[_0x488ac3(0xe7)](_0x5144f7=>_0x5144f7[_0x488ac3(0xd4)]==='FAIL')[_0x488ac3(0x137)],_0x3e5e0a=_0x42eb1f[_0x488ac3(0xe7)](_0x1fa238=>_0x1fa238['status']===_0x488ac3(0x13f))[_0x488ac3(0x137)];console[_0x488ac3(0xda)]('━'[_0x488ac3(0xc5)](0x3c)),console[_0x488ac3(0xda)](_0x488ac3(0x116)),console[_0x488ac3(0xda)]('━'[_0x488ac3(0xc5)](0x3c)),console[_0x488ac3(0xda)](_0x488ac3(0xf0)+_0x42eb1f[_0x488ac3(0x137)]),console[_0x488ac3(0xda)](_0x488ac3(0xc9)+a5_0x37fb0b[_0x488ac3(0x149)](_0x2455a7)),console[_0x488ac3(0xda)]('Failed:\x20\x20\x20'+a5_0x37fb0b[_0x488ac3(0xc2)](_0x1381a5));_0x3e5e0a>0x0&&console[_0x488ac3(0xda)](_0x488ac3(0xde)+a5_0x37fb0b[_0x488ac3(0xc2)](_0x3e5e0a));console[_0x488ac3(0xda)](_0x488ac3(0xd5)+formatElapsed(_0x11a1d3)),console[_0x488ac3(0xda)]('━'['repeat'](0x3c));const _0x5def20=_0x42eb1f[_0x488ac3(0xe7)](_0x4ed020=>_0x4ed020[_0x488ac3(0xd4)]!==_0x488ac3(0x108));if(_0x5def20[_0x488ac3(0x137)]>0x0){console[_0x488ac3(0xda)](),console[_0x488ac3(0xda)]('Failed\x20Tests:');for(const _0x4e1419 of _0x5def20){const _0x320cf9=a5_0x37fb0b[_0x488ac3(0xc2)]('✗'),_0x5c5243=_0x4e1419[_0x488ac3(0xd3)]['length']>0x32?_0x4e1419[_0x488ac3(0xd3)][_0x488ac3(0xf3)](0x0,0x32)+_0x488ac3(0xd7):_0x4e1419[_0x488ac3(0xd3)];console['log']('\x20\x20'+_0x320cf9+'\x20'+_0x4e1419[_0x488ac3(0xcf)]+':\x20'+_0x5c5243);}}const _0x600812={'summary':{'total':_0x42eb1f[_0x488ac3(0x137)],'passed':_0x2455a7,'failed':_0x1381a5,'errors':_0x3e5e0a>0x0?_0x3e5e0a:undefined,'duration_ms':_0x11a1d3},'tests':_0x42eb1f,'agent':{'project':_0x2b09c4[_0x488ac3(0xc6)],'name':_0x2b09c4[_0x488ac3(0x112)],'site':_0x15dcb3},'timestamp':new Date(_0x2ced28)['toISOString']()};try{const _0x580cca=buildCachedTestRun(_0x5c3649,{'site':_0x15dcb3,'projectId':_0x7d9995,'projectName':_0x2b09c4['projectName'],'agentId':_0xbdfe14,'agentName':_0x2b09c4[_0x488ac3(0x112)],'testYmlPath':a5_0x1da603[_0x488ac3(0x128)](_0x2b09c4['testYmlPath'])});saveLastTestRun(_0x580cca);}catch{}if(_0x1afa02!==_0x488ac3(0x132)||_0x257a65){const _0x530858=formatResults(_0x600812,_0x1afa02);if(_0x257a65)try{a5_0x300f72[_0x488ac3(0xf4)](_0x257a65,_0x530858,'utf-8'),console[_0x488ac3(0xda)](),console['log'](a5_0x37fb0b[_0x488ac3(0x131)](_0x488ac3(0xd0)+_0x257a65));}catch(_0x20ef33){return console['log'](),console[_0x488ac3(0xda)](a5_0x37fb0b[_0x488ac3(0xc2)]('Error\x20writing\x20output\x20file:\x20'+_0x20ef33)),0x1;}else console[_0x488ac3(0xda)](),console[_0x488ac3(0xda)](_0x530858);}return _0x5def20[_0x488ac3(0x137)]>0x0?0x1:0x0;}async['executeReeval'](_0x31184f,_0x3fbe4a){const _0x343e2a=a5_0x2b2139,{options:_0x5ce50c,tdx:_0x102d6b}=_0x31184f,{definition:_0x1b5fdc,agentInfo:_0x4f0025,outputFormat:_0x10831d,outputFile:_0x585e50}=_0x3fbe4a,_0x37fb24=_0x5ce50c[_0x343e2a(0xc3)],_0x599ac4=loadLastTestRun();if(!_0x599ac4)return console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0xc2)](_0x343e2a(0xdc))),console['log'](a5_0x37fb0b['dim'](_0x343e2a(0x105))),0x1;if(_0x599ac4[_0x343e2a(0xbc)][_0x343e2a(0x112)]!==_0x4f0025[_0x343e2a(0x112)])return console['log'](a5_0x37fb0b['red'](_0x343e2a(0x141)+_0x599ac4[_0x343e2a(0xbc)][_0x343e2a(0x112)]+_0x343e2a(0x10c)+_0x4f0025[_0x343e2a(0x112)]+'\x22.')),console[_0x343e2a(0xda)](a5_0x37fb0b['dim']('Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.')),0x1;const _0x56217a=new Set(_0x599ac4[_0x343e2a(0x10e)][_0x343e2a(0xff)](_0x15216b=>_0x15216b[_0x343e2a(0x126)])),_0x2e03d2=_0x1b5fdc[_0x343e2a(0x101)]['filter'](_0x4037cb=>!_0x56217a[_0x343e2a(0x121)](_0x4037cb[_0x343e2a(0xcf)]));if(_0x2e03d2[_0x343e2a(0x137)]>0x0&&_0x599ac4[_0x343e2a(0xc3)]!==_0x37fb24)return console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0xc2)](_0x343e2a(0xf6))),console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0x131)](_0x343e2a(0x100)+_0x599ac4['site']+'\x22,\x20but\x20current\x20site\x20is\x20\x22'+_0x37fb24+'\x22.')),console['log'](a5_0x37fb0b[_0x343e2a(0x131)](_0x343e2a(0x114)+_0x599ac4['site']+'\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.')),0x1;const _0x2626d9=_0x1b5fdc['tests']['filter'](_0x3ed01a=>_0x56217a[_0x343e2a(0x121)](_0x3ed01a['name'])),_0x47fcc0=_0x2e03d2;let _0xb852b6;try{_0xb852b6=await setupEvaluatorAgent(_0x102d6b[_0x343e2a(0xef)],_0x5ce50c[_0x343e2a(0x12d)]);}catch(_0x163c2e){const _0x4a8ad2=_0x163c2e instanceof Error?_0x163c2e['message']:String(_0x163c2e);return console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0xc2)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x4a8ad2)),0x1;}console['log'](a5_0x37fb0b['cyan'](_0x343e2a(0x117))),console['log'](_0x343e2a(0xb8)+a5_0x37fb0b[_0x343e2a(0x120)](_0x599ac4[_0x343e2a(0xe9)])),console[_0x343e2a(0xda)]('Agent:\x20'+a5_0x37fb0b['white'](_0x599ac4['agent'][_0x343e2a(0xc6)]+'/'+_0x599ac4['agent'][_0x343e2a(0x112)]));_0x47fcc0[_0x343e2a(0x137)]>0x0&&console[_0x343e2a(0xda)](_0x343e2a(0xca)+a5_0x37fb0b['yellow'](_0x47fcc0['length']));console[_0x343e2a(0xda)]();const _0x15c7ab=[],_0x167a7a=Date[_0x343e2a(0x12a)](),_0x558b9f=createCommandSpinner('Re-evaluating...');if(_0x2626d9[_0x343e2a(0x137)]>0x0)try{const _0x1cf683=await reevaluateFromCache(_0x102d6b[_0x343e2a(0xef)],_0x599ac4,{'tests':_0x2626d9},{'evaluatorId':_0xb852b6,'onTestStart':(_0xa863d9,_0x3c89d1,_0x4ea14b)=>{const _0x433a46=_0x343e2a;_0x558b9f[_0x433a46(0x10d)]=_0x433a46(0x11b)+(_0x3c89d1+0x1)+'/'+_0x4ea14b+':\x20'+_0xa863d9+_0x433a46(0xd7);if(!_0x558b9f[_0x433a46(0x109)])_0x558b9f['start']();},'onTestComplete':(_0x67b6b3,_0x2b71a5)=>{const _0x11b1ed=_0x343e2a;_0x558b9f['stop']();if(_0x2b71a5['status']===_0x11b1ed(0x108))console[_0x11b1ed(0xda)](a5_0x37fb0b['green'](_0x11b1ed(0xf9)+_0x67b6b3)+a5_0x37fb0b[_0x11b1ed(0x131)](_0x11b1ed(0x136)));else _0x2b71a5[_0x11b1ed(0xd4)]===_0x11b1ed(0x11a)?console[_0x11b1ed(0xda)](a5_0x37fb0b[_0x11b1ed(0xc2)](_0x11b1ed(0x102)+_0x67b6b3+_0x11b1ed(0x111)+_0x2b71a5[_0x11b1ed(0xd3)])+a5_0x37fb0b[_0x11b1ed(0x131)]('\x20(cached)')):console['log'](a5_0x37fb0b[_0x11b1ed(0xc2)]('✗\x20ERROR:\x20'+_0x67b6b3+_0x11b1ed(0x111)+_0x2b71a5[_0x11b1ed(0xd3)]));_0x2b71a5[_0x11b1ed(0xf8)]&&console[_0x11b1ed(0xda)](a5_0x37fb0b[_0x11b1ed(0x131)](_0x11b1ed(0xf2)+_0x2b71a5[_0x11b1ed(0xf8)])),_0x15c7ab['push'](_0x2b71a5);},'onTestSkipped':(_0x5b7635,_0x4ce81c)=>{const _0x5f1efd=_0x343e2a;_0x558b9f[_0x5f1efd(0xee)](),console[_0x5f1efd(0xda)](a5_0x37fb0b[_0x5f1efd(0x127)]('⚠\x20SKIPPED:\x20'+_0x5b7635+_0x5f1efd(0x111)+_0x4ce81c));}});for(const _0x5b8fb5 of _0x1cf683){!_0x15c7ab['find'](_0x3a222a=>_0x3a222a[_0x343e2a(0xcf)]===_0x5b8fb5['name'])&&_0x15c7ab[_0x343e2a(0x106)](_0x5b8fb5);}}catch(_0x4ac911){_0x558b9f['stop']();const _0x4a6ec7=_0x4ac911 instanceof Error?_0x4ac911[_0x343e2a(0xed)]:String(_0x4ac911);return console['log'](a5_0x37fb0b['red']('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0x4a6ec7)),0x1;}_0x558b9f[_0x343e2a(0xee)]();if(_0x47fcc0[_0x343e2a(0x137)]>0x0){console[_0x343e2a(0xda)](),console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0xfc)](_0x343e2a(0xc7)));const {projectId:_0x26d8ae,agentId:_0x3c2b2f}=_0x599ac4[_0x343e2a(0xbc)];for(const _0x410f80 of _0x47fcc0){console[_0x343e2a(0xda)](_0x343e2a(0x13c)+a5_0x37fb0b[_0x343e2a(0x120)](_0x410f80[_0x343e2a(0xcf)]));const _0x5d7b3d=createCommandSpinner('Round\x201/'+_0x410f80[_0x343e2a(0x12c)][_0x343e2a(0x137)]+_0x343e2a(0xbf));_0x5d7b3d[_0x343e2a(0xe5)]();try{const {result:_0x53f0d9}=await runTest(_0x102d6b[_0x343e2a(0xef)],_0x410f80,{'agentId':_0x3c2b2f,'projectId':_0x26d8ae,'site':_0x599ac4[_0x343e2a(0xc3)],'noEval':![],'evaluatorId':_0xb852b6,'onRoundStart':(_0xde31a2,_0x2c99f7)=>{const _0xdabae9=_0x343e2a;_0x5d7b3d[_0xdabae9(0x10d)]=_0xdabae9(0xec)+(_0xde31a2+0x1)+'/'+_0x2c99f7+_0xdabae9(0xbf);},'onRoundComplete':(_0x548993,_0x115bf2,_0x515ecc)=>{const _0x4f6fef=_0x343e2a,_0x26a6fe=formatElapsed(_0x115bf2);_0x515ecc?console[_0x4f6fef(0xda)](_0x4f6fef(0x147)+(_0x548993+0x1)+'/'+_0x410f80['rounds']['length']+_0x4f6fef(0x123)+a5_0x37fb0b['green']('✓')+'\x20('+_0x26a6fe+')'):console[_0x4f6fef(0xda)](_0x4f6fef(0x147)+(_0x548993+0x1)+'/'+_0x410f80[_0x4f6fef(0x12c)][_0x4f6fef(0x137)]+_0x4f6fef(0x123)+a5_0x37fb0b[_0x4f6fef(0xc2)]('✗'));},'onEvaluationStart':()=>{const _0x5d887a=_0x343e2a;_0x5d7b3d[_0x5d887a(0x10d)]=_0x5d887a(0x10b);},'onEvaluationComplete':_0x242402=>{const _0x168712=_0x343e2a,_0x3d7e6c=formatElapsed(_0x242402);console[_0x168712(0xda)](_0x168712(0x107)+a5_0x37fb0b[_0x168712(0x149)]('✓')+'\x20('+_0x3d7e6c+')');}});_0x5d7b3d[_0x343e2a(0xee)](),_0x15c7ab[_0x343e2a(0x106)](_0x53f0d9);if(_0x53f0d9[_0x343e2a(0xd4)]==='PASS')console['log'](a5_0x37fb0b[_0x343e2a(0x149)](_0x343e2a(0xf9)+_0x53f0d9[_0x343e2a(0xd3)])+a5_0x37fb0b[_0x343e2a(0x131)]('\x20(new)'));else _0x53f0d9[_0x343e2a(0xd4)]==='FAIL'?console['log'](a5_0x37fb0b[_0x343e2a(0xc2)](_0x343e2a(0x102)+_0x53f0d9['reason'])+a5_0x37fb0b[_0x343e2a(0x131)](_0x343e2a(0xfd))):console['log'](a5_0x37fb0b['red']('✗\x20ERROR:\x20'+_0x53f0d9[_0x343e2a(0xd3)]));_0x53f0d9[_0x343e2a(0xf8)]&&console[_0x343e2a(0xda)](a5_0x37fb0b['dim'](_0x343e2a(0xf2)+_0x53f0d9[_0x343e2a(0xf8)]));}catch(_0x37ed96){_0x5d7b3d['stop']();const _0x22c57d=_0x37ed96 instanceof Error?_0x37ed96[_0x343e2a(0xed)]:String(_0x37ed96);console['log'](a5_0x37fb0b[_0x343e2a(0xc2)]('✗\x20ERROR:\x20'+_0x22c57d)),_0x15c7ab[_0x343e2a(0x106)]({'name':_0x410f80[_0x343e2a(0xcf)],'status':_0x343e2a(0x13f),'reason':_0x22c57d,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}}console['log']();const _0x42fbd0=Date[_0x343e2a(0x12a)]()-_0x167a7a,_0x57ece6=_0x15c7ab['filter'](_0x2d888f=>_0x2d888f['status']===_0x343e2a(0x108))[_0x343e2a(0x137)],_0x3f1b90=_0x15c7ab[_0x343e2a(0xe7)](_0x416d8d=>_0x416d8d[_0x343e2a(0xd4)]===_0x343e2a(0x11a))[_0x343e2a(0x137)],_0x184d8e=_0x15c7ab[_0x343e2a(0xe7)](_0x431813=>_0x431813[_0x343e2a(0xd4)]===_0x343e2a(0x13f))[_0x343e2a(0x137)];console[_0x343e2a(0xda)]('━'['repeat'](0x3c)),console['log'](_0x343e2a(0xcc)),console[_0x343e2a(0xda)]('━'[_0x343e2a(0xc5)](0x3c)),console[_0x343e2a(0xda)](_0x343e2a(0xf0)+_0x15c7ab['length']),console[_0x343e2a(0xda)]('Passed:\x20\x20\x20'+a5_0x37fb0b[_0x343e2a(0x149)](_0x57ece6)),console[_0x343e2a(0xda)](_0x343e2a(0x103)+a5_0x37fb0b[_0x343e2a(0xc2)](_0x3f1b90));_0x184d8e>0x0&&console[_0x343e2a(0xda)]('Errors:\x20\x20\x20'+a5_0x37fb0b[_0x343e2a(0xc2)](_0x184d8e));console[_0x343e2a(0xda)](_0x343e2a(0xd5)+formatElapsed(_0x42fbd0)),console['log']('━'['repeat'](0x3c));const _0xbc157c={'summary':{'total':_0x15c7ab['length'],'passed':_0x57ece6,'failed':_0x3f1b90,'errors':_0x184d8e>0x0?_0x184d8e:undefined,'duration_ms':_0x42fbd0},'tests':_0x15c7ab,'agent':{'project':_0x4f0025[_0x343e2a(0xc6)],'name':_0x4f0025['agentName'],'site':_0x37fb24},'timestamp':new Date(_0x167a7a)[_0x343e2a(0x11f)]()};if(_0x10831d!==_0x343e2a(0x132)||_0x585e50){const _0x38020a=formatResults(_0xbc157c,_0x10831d);if(_0x585e50)try{a5_0x300f72[_0x343e2a(0xf4)](_0x585e50,_0x38020a,_0x343e2a(0x13b)),console[_0x343e2a(0xda)](),console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0x131)](_0x343e2a(0xd0)+_0x585e50));}catch(_0x47fe2c){return console[_0x343e2a(0xda)](),console[_0x343e2a(0xda)](a5_0x37fb0b[_0x343e2a(0xc2)](_0x343e2a(0x146)+_0x47fe2c)),0x1;}else console[_0x343e2a(0xda)](),console[_0x343e2a(0xda)](_0x38020a);}const _0x11e08d=_0x15c7ab[_0x343e2a(0xe7)](_0x44bedf=>_0x44bedf[_0x343e2a(0xd4)]!=='PASS');return _0x11e08d[_0x343e2a(0x137)]>0x0?0x1:0x0;}}
|
|
1
|
+
const a5_0x520f87=a5_0x3ef1;function a5_0x4868(){const _0xb47ca1=['Round\x201/','resolveProjectId','description','Duration:\x20','Re-evaluating...','green','utf-8','rounds','9qSMfYB','Total:\x20\x20\x20\x20','basename','\x22,\x20but\x20current\x20site\x20is\x20\x22','Project\x20path:\x20','status','output','Tests\x20found:\x20','FAIL','Conversation\x20URL:\x20','PASS','\x22:\x20','split','Either\x20switch\x20to\x20the\x20\x22','\x27\x20to\x20create\x20the\x20folder\x20structure.','Failed\x20Tests:','Executing\x20new\x20tests...','...','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','no_tests','\x20(cached)','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','No\x20tests\x20found\x20matching:\x20','Usage:','✗\x20ERROR:\x20','json','agentName','now','129346QMOSOz','no_context','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','Running\x20test:\x20','ERROR','join','found','agentDirs','336664aFxzrL','Site:\x20','white','reeval','Running\x20agent\x20tests...','Evaluating\x20response...','✗\x20ERROR:\x20Project\x20not\x20found:\x20','table','agent:test','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','agent','source','\x20\x20Site:\x20','531615mriUxs','toISOString','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','Errors:\x20\x20\x20','Failed:\x20\x20\x20','✓\x20PASS:\x20','Test\x20Summary','...\x20','1182714yBpWPL','map','Test\x20Configuration:','Running:\x20','New\x20tests\x20to\x20execute:\x20','message','not\x20found','text','multiple_agents','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','3576180KHEldV','202564SjaJLo','Round\x20','no_local_folder','toLowerCase','find','Re-evaluation\x20Summary','Re-evaluating\x20','llmProject','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','includes','site','tsv','Run\x20\x27tdx\x20agent\x20pull\x20','writeFileSync','Passed:\x20\x20\x20','trim','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','Error:\x20No\x20previous\x20test\x20run\x20found.','1928AnugUr','\x20\x20Project:\x20','Cached\x20run\x20is\x20from\x20site\x20\x22','filter','Re-evaluating\x20cached\x20test\x20run...','✗\x20FAIL:\x20','resolveAgentId','repeat','reason','verbose','push','context','red','yellow','stop','jsonl','llm','dim','\x20\x20-\x20','350SpkLRV','test.yml','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','length','Test\x20','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','Error\x20writing\x20output\x20file:\x20','conversation_url','log','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','\x20\x20Round\x20','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','round','Agent:\x20','404','name','Cached\x20run\x20from:\x20','conversations','projectDir','testName','\x20\x20Evaluating...\x20','\x20\x20Conversation:\x20','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','cyan',':\x20Sending\x20user\x20input...','Available\x20tests:\x20','testYmlPath','executeReeval','timestamp','tests','existsSync','3HpSdJn','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','Output\x20written\x20to:\x20','start','\x20(new)','projectName','⚠\x20SKIPPED:\x20','\x20-\x20'];a5_0x4868=function(){return _0xb47ca1;};return a5_0x4868();}(function(_0x1f0994,_0x18f881){const _0x4636bc=a5_0x3ef1,_0x1f2594=_0x1f0994();while(!![]){try{const _0x24d1a0=parseInt(_0x4636bc(0x1cd))/0x1*(-parseInt(_0x4636bc(0x146))/0x2)+-parseInt(_0x4636bc(0x166))/0x3*(parseInt(_0x4636bc(0x1bb))/0x4)+parseInt(_0x4636bc(0x1a8))/0x5+parseInt(_0x4636bc(0x1b0))/0x6+-parseInt(_0x4636bc(0x192))/0x7+parseInt(_0x4636bc(0x19b))/0x8*(-parseInt(_0x4636bc(0x176))/0x9)+parseInt(_0x4636bc(0x1ba))/0xa;if(_0x24d1a0===_0x18f881)break;else _0x1f2594['push'](_0x1f2594['shift']());}catch(_0x5eb7ed){_0x1f2594['push'](_0x1f2594['shift']());}}}(a5_0x4868,0x33dea));import*as a5_0x39a1b0 from'node:fs';function a5_0x3ef1(_0x306b0b,_0x49cb40){_0x306b0b=_0x306b0b-0x146;const _0x48688a=a5_0x4868();let _0x3ef172=_0x48688a[_0x306b0b];return _0x3ef172;}import*as a5_0x5a5509 from'node:path';import a5_0x4fbbcb from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x520f87(0x156)]=a5_0x520f87(0x1a3);[a5_0x520f87(0x170)]='Run\x20tests\x20for\x20an\x20LLM\x20agent';async['execute'](_0x4d5cb8){const _0x57e47f=a5_0x520f87,{options:_0x5a79b8,args:_0x4da7ad,tdx:_0xa5a1fb}=_0x4d5cb8,_0x3f897b=_0x4da7ad[0x0]||'.',_0x98acd2=_0x5a79b8['dryRun'],_0x49b579=_0x5a79b8,_0x339ae6=_0x49b579['eval']===![],_0x3649ff=_0x49b579[_0x57e47f(0x19e)],_0x2efad3=_0x49b579['name'],_0x514938=_0x5a79b8[_0x57e47f(0x1c5)],_0xff957f=_0x49b579[_0x57e47f(0x17c)];if(_0x3649ff&&_0x339ae6)return console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x57e47f(0x194))),0x1;let _0x3e12fe=_0x57e47f(0x1a2);if(_0x49b579[_0x57e47f(0x18f)])_0x3e12fe=_0x57e47f(0x18f);else{if(_0x49b579['jsonl'])_0x3e12fe=_0x57e47f(0x1dc);else{if(_0x49b579[_0x57e47f(0x1c6)])_0x3e12fe=_0x57e47f(0x1c6);else{if(_0x49b579['table'])_0x3e12fe=_0x57e47f(0x1a2);}}}const _0x3fcbf1=_0x49b579[_0x57e47f(0x1c2)];let _0x4ccbad=_0x3f897b;const _0x4d7138=a5_0x39a1b0[_0x57e47f(0x165)](_0x3f897b),_0xd9e376=_0x3f897b==='.';if(!_0x4d7138||_0xd9e376){const _0x5731a8=resolveProjectFromContext(_0x3f897b,_0x3fcbf1,{'requireFile':_0x57e47f(0x147)});if(_0x5731a8[_0x57e47f(0x199)])_0x4ccbad=_0x5731a8[_0x57e47f(0x159)],_0x5731a8[_0x57e47f(0x1a6)]===_0x57e47f(0x1d8)&&console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1de)]('Using\x20agent:\x20'+_0x4ccbad));else switch(_0x5731a8[_0x57e47f(0x1d5)]){case _0x57e47f(0x193):console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1da)](_0x5731a8[_0x57e47f(0x1b5)])),console[_0x57e47f(0x14f)](),console['log'](_0x57e47f(0x18d)),console[_0x57e47f(0x14f)]('\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'),console['log'](_0x57e47f(0x15d)),console[_0x57e47f(0x14f)](),console[_0x57e47f(0x14f)](_0x57e47f(0x18b));return 0x1;case _0x57e47f(0x1bd):console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1da)](_0x5731a8[_0x57e47f(0x1b5)])),console[_0x57e47f(0x14f)](),console[_0x57e47f(0x14f)](_0x57e47f(0x1c7)+_0x5731a8['llmProject']+_0x57e47f(0x184));return 0x1;case _0x57e47f(0x1b8):{const _0x29f486=a5_0x5a5509[_0x57e47f(0x178)](_0x5731a8[_0x57e47f(0x159)]);console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1da)](_0x57e47f(0x167)+_0x5731a8[_0x57e47f(0x1c2)]+'\x22:'));for(const _0x2e860f of _0x5731a8[_0x57e47f(0x19a)]){console[_0x57e47f(0x14f)](_0x57e47f(0x1df)+_0x2e860f);}return console[_0x57e47f(0x14f)](),console[_0x57e47f(0x14f)](_0x57e47f(0x1b9)+_0x29f486+'/<agent-name>'),0x1;}case _0x57e47f(0x189):console[_0x57e47f(0x14f)](a5_0x4fbbcb['yellow'](_0x57e47f(0x1aa)+_0x5731a8['llmProject']+'\x22.')),console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1de)](_0x57e47f(0x17a)+_0x5731a8[_0x57e47f(0x159)])),console['log'](),console['log'](_0x57e47f(0x148));return 0x1;}}const {definition:_0x4d0edf,agentInfo:_0x2d38ae}=parseTestFile(_0x4ccbad);let _0x28654b=_0x4d0edf[_0x57e47f(0x164)];if(_0x2efad3){const _0x2cfbc8=_0x2efad3[_0x57e47f(0x182)](',')[_0x57e47f(0x1b1)](_0x118b71=>_0x118b71[_0x57e47f(0x1ca)]());_0x28654b=_0x4d0edf[_0x57e47f(0x164)][_0x57e47f(0x1d0)](_0x517759=>_0x2cfbc8[_0x57e47f(0x1c4)](_0x517759[_0x57e47f(0x156)]));if(_0x28654b[_0x57e47f(0x149)]===0x0)return console['log'](a5_0x4fbbcb[_0x57e47f(0x1da)](_0x57e47f(0x18c)+_0x2efad3)),console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1de)](_0x57e47f(0x160)+_0x4d0edf[_0x57e47f(0x164)][_0x57e47f(0x1b1)](_0x251a56=>_0x251a56[_0x57e47f(0x156)])[_0x57e47f(0x198)](',\x20'))),0x1;}if(_0x3649ff)return this[_0x57e47f(0x162)](_0x4d5cb8,{'definition':{'tests':_0x28654b},'agentInfo':_0x2d38ae,'outputFormat':_0x3e12fe,'outputFile':_0xff957f,'testNames':_0x2efad3});if(_0x98acd2){console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x15e)](_0x57e47f(0x1b2))),console[_0x57e47f(0x14f)](_0x57e47f(0x1a7)+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x514938)),console['log'](_0x57e47f(0x1ce)+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x2d38ae['projectName'])),console[_0x57e47f(0x14f)]('\x20\x20Agent:\x20'+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x2d38ae[_0x57e47f(0x190)])),console['log'](),console['log'](_0x57e47f(0x17d)+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x28654b[_0x57e47f(0x149)]));for(let _0x7cb858=0x0;_0x7cb858<_0x28654b[_0x57e47f(0x149)];_0x7cb858++){const _0x39d78b=_0x28654b[_0x7cb858],_0x485661=_0x39d78b[_0x57e47f(0x175)][_0x57e47f(0x149)]===0x1?_0x57e47f(0x153):'rounds';console[_0x57e47f(0x14f)]('\x20\x20'+(_0x7cb858+0x1)+'.\x20'+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x39d78b['name'])+'\x20('+_0x39d78b['rounds'][_0x57e47f(0x149)]+'\x20'+_0x485661+')');}return 0x0;}let _0x308d46,_0x60d406;try{_0x308d46=await _0xa5a1fb['llm'][_0x57e47f(0x16f)](_0x2d38ae[_0x57e47f(0x16b)]);}catch(_0x2e4f59){const _0x2c3470=_0x2e4f59 instanceof Error?_0x2e4f59[_0x57e47f(0x1b5)]:String(_0x2e4f59);return _0x2c3470[_0x57e47f(0x1c4)](_0x57e47f(0x155))||_0x2c3470['toLowerCase']()[_0x57e47f(0x1c4)](_0x57e47f(0x1b6))?console[_0x57e47f(0x14f)](a5_0x4fbbcb['red'](_0x57e47f(0x1a1)+_0x2d38ae[_0x57e47f(0x16b)])):console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22'+_0x2d38ae[_0x57e47f(0x16b)]+_0x57e47f(0x181)+_0x2c3470)),0x1;}try{_0x60d406=await _0xa5a1fb[_0x57e47f(0x1dd)][_0x57e47f(0x1d3)](_0x2d38ae['agentName'],_0x308d46);}catch(_0x402e88){const _0x42d0f1=_0x402e88 instanceof Error?_0x402e88['message']:String(_0x402e88);return _0x42d0f1[_0x57e47f(0x1c4)](_0x57e47f(0x155))||_0x42d0f1[_0x57e47f(0x1be)]()[_0x57e47f(0x1c4)]('not\x20found')?console[_0x57e47f(0x14f)](a5_0x4fbbcb['red'](_0x57e47f(0x150)+_0x2d38ae[_0x57e47f(0x190)])):console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x57e47f(0x195)+_0x2d38ae[_0x57e47f(0x190)]+'\x22:\x20'+_0x42d0f1)),0x1;}let _0x8c39ab;if(!_0x339ae6)try{_0x8c39ab=await setupEvaluatorAgent(_0xa5a1fb[_0x57e47f(0x1dd)],_0x5a79b8[_0x57e47f(0x1d6)]);}catch(_0x130123){const _0x5d70aa=_0x130123 instanceof Error?_0x130123[_0x57e47f(0x1b5)]:String(_0x130123);return console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x57e47f(0x1cb)+_0x5d70aa)),0x1;}console['log'](a5_0x4fbbcb['cyan'](_0x57e47f(0x19f))),console[_0x57e47f(0x14f)](_0x57e47f(0x19c)+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x514938)),console[_0x57e47f(0x14f)](_0x57e47f(0x154)+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x2d38ae[_0x57e47f(0x16b)]+'/'+_0x2d38ae[_0x57e47f(0x190)])),console[_0x57e47f(0x14f)]();const _0x2f486e=[],_0x5e5211=[],_0x2b6185=Date[_0x57e47f(0x191)]();for(let _0xcdee52=0x0;_0xcdee52<_0x28654b[_0x57e47f(0x149)];_0xcdee52++){const _0x1c745d=_0x28654b[_0xcdee52];_0x28654b[_0x57e47f(0x149)]>0x1?console[_0x57e47f(0x14f)](_0x57e47f(0x14a)+(_0xcdee52+0x1)+'/'+_0x28654b['length']+':\x20'+a5_0x4fbbcb[_0x57e47f(0x19d)](_0x1c745d[_0x57e47f(0x156)])):console[_0x57e47f(0x14f)](_0x57e47f(0x196)+a5_0x4fbbcb['white'](_0x1c745d[_0x57e47f(0x156)]));const _0x52a7c=createCommandSpinner(_0x57e47f(0x16e)+_0x1c745d[_0x57e47f(0x175)]['length']+_0x57e47f(0x15f));_0x52a7c[_0x57e47f(0x169)]();try{const {result:_0x133c57,conversation:_0x1287c2}=await runTest(_0xa5a1fb[_0x57e47f(0x1dd)],_0x1c745d,{'agentId':_0x60d406,'projectId':_0x308d46,'site':_0x514938,'noEval':_0x339ae6,'evaluatorId':_0x8c39ab,'onRoundStart':(_0x16caba,_0x8d249d)=>{const _0x5478e0=_0x57e47f;_0x52a7c[_0x5478e0(0x1b7)]=_0x5478e0(0x1bc)+(_0x16caba+0x1)+'/'+_0x8d249d+_0x5478e0(0x15f);},'onRoundComplete':(_0x4aa411,_0x4f72ab,_0x3e0562)=>{const _0x5bda7f=_0x57e47f,_0x2cc467=formatElapsed(_0x4f72ab);_0x3e0562?console[_0x5bda7f(0x14f)](_0x5bda7f(0x151)+(_0x4aa411+0x1)+'/'+_0x1c745d[_0x5bda7f(0x175)][_0x5bda7f(0x149)]+_0x5bda7f(0x1af)+a5_0x4fbbcb['green']('✓')+'\x20('+_0x2cc467+')'):console[_0x5bda7f(0x14f)](_0x5bda7f(0x151)+(_0x4aa411+0x1)+'/'+_0x1c745d[_0x5bda7f(0x175)][_0x5bda7f(0x149)]+_0x5bda7f(0x1af)+a5_0x4fbbcb[_0x5bda7f(0x1d9)]('✗'));},'onEvaluationStart':()=>{const _0x3d1475=_0x57e47f;_0x52a7c[_0x3d1475(0x1b7)]=_0x3d1475(0x1a0);},'onEvaluationComplete':_0x24ee9d=>{const _0x10326a=_0x57e47f,_0x2fc355=formatElapsed(_0x24ee9d);console[_0x10326a(0x14f)](_0x10326a(0x15b)+a5_0x4fbbcb['green']('✓')+'\x20('+_0x2fc355+')');}});_0x52a7c[_0x57e47f(0x1db)](),_0x2f486e[_0x57e47f(0x1d7)](_0x133c57),_0x5e5211[_0x57e47f(0x1d7)](_0x1287c2);if(_0x133c57['status']===_0x57e47f(0x180))console[_0x57e47f(0x14f)](a5_0x4fbbcb['green'](_0x57e47f(0x1ad)+_0x133c57[_0x57e47f(0x1d5)]));else _0x133c57[_0x57e47f(0x17b)]==='FAIL'?console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x57e47f(0x1d2)+_0x133c57[_0x57e47f(0x1d5)])):console['log'](a5_0x4fbbcb[_0x57e47f(0x1d9)]('✗\x20ERROR:\x20'+_0x133c57['reason']));_0x133c57[_0x57e47f(0x14e)]&&console['log'](a5_0x4fbbcb['dim'](_0x57e47f(0x17f)+_0x133c57[_0x57e47f(0x14e)])),console[_0x57e47f(0x14f)]();}catch(_0x2575b5){_0x52a7c['stop']();const _0x550452=_0x2575b5 instanceof Error?_0x2575b5[_0x57e47f(0x1b5)]:String(_0x2575b5);console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x57e47f(0x18e)+_0x550452)),console['log'](),_0x2f486e[_0x57e47f(0x1d7)]({'name':_0x1c745d[_0x57e47f(0x156)],'status':_0x57e47f(0x197),'reason':_0x550452,'timestamp':new Date()[_0x57e47f(0x1a9)](),'duration_ms':0x0});}}const _0x5f0f2a=Date[_0x57e47f(0x191)]()-_0x2b6185,_0x46d10b=_0x2f486e[_0x57e47f(0x1d0)](_0x4f702a=>_0x4f702a['status']===_0x57e47f(0x180))['length'],_0x474788=_0x2f486e[_0x57e47f(0x1d0)](_0x358eb1=>_0x358eb1[_0x57e47f(0x17b)]===_0x57e47f(0x17e))[_0x57e47f(0x149)],_0x490d28=_0x2f486e[_0x57e47f(0x1d0)](_0x3ab2b4=>_0x3ab2b4[_0x57e47f(0x17b)]===_0x57e47f(0x197))[_0x57e47f(0x149)];console[_0x57e47f(0x14f)]('━'[_0x57e47f(0x1d4)](0x3c)),console[_0x57e47f(0x14f)](_0x57e47f(0x1ae)),console[_0x57e47f(0x14f)]('━'[_0x57e47f(0x1d4)](0x3c)),console[_0x57e47f(0x14f)](_0x57e47f(0x177)+_0x2f486e['length']),console[_0x57e47f(0x14f)](_0x57e47f(0x1c9)+a5_0x4fbbcb[_0x57e47f(0x173)](_0x46d10b)),console[_0x57e47f(0x14f)](_0x57e47f(0x1ac)+a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x474788));_0x490d28>0x0&&console[_0x57e47f(0x14f)](_0x57e47f(0x1ab)+a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x490d28));console['log'](_0x57e47f(0x171)+formatElapsed(_0x5f0f2a)),console[_0x57e47f(0x14f)]('━'['repeat'](0x3c));const _0x5d0569=_0x2f486e['filter'](_0x51bbca=>_0x51bbca['status']!==_0x57e47f(0x180));if(_0x5d0569[_0x57e47f(0x149)]>0x0){console[_0x57e47f(0x14f)](),console[_0x57e47f(0x14f)](_0x57e47f(0x185));for(const _0x203cf1 of _0x5d0569){const _0x3ec246=a5_0x4fbbcb[_0x57e47f(0x1d9)]('✗'),_0x5bbd33=_0x203cf1[_0x57e47f(0x1d5)][_0x57e47f(0x149)]>0x32?_0x203cf1[_0x57e47f(0x1d5)]['substring'](0x0,0x32)+'...':_0x203cf1['reason'];console['log']('\x20\x20'+_0x3ec246+'\x20'+_0x203cf1[_0x57e47f(0x156)]+':\x20'+_0x5bbd33);}}const _0x148d66={'summary':{'total':_0x2f486e[_0x57e47f(0x149)],'passed':_0x46d10b,'failed':_0x474788,'errors':_0x490d28>0x0?_0x490d28:undefined,'duration_ms':_0x5f0f2a},'tests':_0x2f486e,'agent':{'project':_0x2d38ae['projectName'],'name':_0x2d38ae[_0x57e47f(0x190)],'site':_0x514938},'timestamp':new Date(_0x2b6185)[_0x57e47f(0x1a9)]()};try{const _0x444f36=buildCachedTestRun(_0x5e5211,{'site':_0x514938,'projectId':_0x308d46,'projectName':_0x2d38ae[_0x57e47f(0x16b)],'agentId':_0x60d406,'agentName':_0x2d38ae[_0x57e47f(0x190)],'testYmlPath':a5_0x5a5509['resolve'](_0x2d38ae[_0x57e47f(0x161)])});saveLastTestRun(_0x444f36);}catch{}if(_0x3e12fe!==_0x57e47f(0x1a2)||_0xff957f){const _0x51818b=formatResults(_0x148d66,_0x3e12fe);if(_0xff957f)try{a5_0x39a1b0[_0x57e47f(0x1c8)](_0xff957f,_0x51818b,_0x57e47f(0x174)),console['log'](),console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1de)](_0x57e47f(0x168)+_0xff957f));}catch(_0x41da45){return console['log'](),console[_0x57e47f(0x14f)](a5_0x4fbbcb[_0x57e47f(0x1d9)](_0x57e47f(0x14d)+_0x41da45)),0x1;}else console[_0x57e47f(0x14f)](),console['log'](_0x51818b);}return _0x5d0569[_0x57e47f(0x149)]>0x0?0x1:0x0;}async['executeReeval'](_0x3cfe36,_0x24596b){const _0x163a1e=a5_0x520f87,{options:_0x367edf,tdx:_0x1444cd}=_0x3cfe36,{definition:_0x3e4ed5,agentInfo:_0x1ee463,outputFormat:_0x3a4452,outputFile:_0x3936bc}=_0x24596b,_0x4325b0=_0x367edf[_0x163a1e(0x1c5)],_0x3622df=loadLastTestRun();if(!_0x3622df)return console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x163a1e(0x1cc))),console['log'](a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x1c3))),0x1;if(_0x3622df[_0x163a1e(0x1a5)][_0x163a1e(0x190)]!==_0x1ee463['agentName'])return console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x163a1e(0x152)+_0x3622df[_0x163a1e(0x1a5)]['agentName']+_0x163a1e(0x188)+_0x1ee463[_0x163a1e(0x190)]+'\x22.')),console['log'](a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x14c))),0x1;const _0x5f14eb=new Set(_0x3622df[_0x163a1e(0x158)][_0x163a1e(0x1b1)](_0x51b476=>_0x51b476[_0x163a1e(0x15a)])),_0x394867=_0x3e4ed5['tests']['filter'](_0x13e163=>!_0x5f14eb['has'](_0x13e163[_0x163a1e(0x156)]));if(_0x394867[_0x163a1e(0x149)]>0x0&&_0x3622df[_0x163a1e(0x1c5)]!==_0x4325b0)return console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1d9)]('Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.')),console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x1cf)+_0x3622df[_0x163a1e(0x1c5)]+_0x163a1e(0x179)+_0x4325b0+'\x22.')),console['log'](a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x183)+_0x3622df[_0x163a1e(0x1c5)]+_0x163a1e(0x14b))),0x1;const _0xa5c0b6=_0x3e4ed5['tests'][_0x163a1e(0x1d0)](_0x14129b=>_0x5f14eb['has'](_0x14129b['name'])),_0x2be6ae=_0x394867;let _0x4bb32e;try{_0x4bb32e=await setupEvaluatorAgent(_0x1444cd[_0x163a1e(0x1dd)],_0x367edf[_0x163a1e(0x1d6)]);}catch(_0x37be1b){const _0x48b444=_0x37be1b instanceof Error?_0x37be1b[_0x163a1e(0x1b5)]:String(_0x37be1b);return console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x163a1e(0x1cb)+_0x48b444)),0x1;}console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x15e)](_0x163a1e(0x1d1))),console[_0x163a1e(0x14f)](_0x163a1e(0x157)+a5_0x4fbbcb[_0x163a1e(0x19d)](_0x3622df[_0x163a1e(0x163)])),console[_0x163a1e(0x14f)](_0x163a1e(0x154)+a5_0x4fbbcb[_0x163a1e(0x19d)](_0x3622df[_0x163a1e(0x1a5)][_0x163a1e(0x16b)]+'/'+_0x3622df[_0x163a1e(0x1a5)][_0x163a1e(0x190)]));_0x2be6ae['length']>0x0&&console[_0x163a1e(0x14f)](_0x163a1e(0x1b4)+a5_0x4fbbcb['yellow'](_0x2be6ae['length']));console[_0x163a1e(0x14f)]();const _0x25d2d5=[],_0x134ae3=Date[_0x163a1e(0x191)](),_0x3fd91b=createCommandSpinner(_0x163a1e(0x172));if(_0xa5c0b6[_0x163a1e(0x149)]>0x0)try{const _0x161642=await reevaluateFromCache(_0x1444cd[_0x163a1e(0x1dd)],_0x3622df,{'tests':_0xa5c0b6},{'evaluatorId':_0x4bb32e,'onTestStart':(_0x5bea2b,_0x208fa6,_0x1fe8fb)=>{const _0x2aa24d=_0x163a1e;_0x3fd91b['text']=_0x2aa24d(0x1c1)+(_0x208fa6+0x1)+'/'+_0x1fe8fb+':\x20'+_0x5bea2b+_0x2aa24d(0x187);if(!_0x3fd91b['isSpinning'])_0x3fd91b['start']();},'onTestComplete':(_0x4bdf1a,_0x3dde99)=>{const _0x1ed63c=_0x163a1e;_0x3fd91b[_0x1ed63c(0x1db)]();if(_0x3dde99[_0x1ed63c(0x17b)]===_0x1ed63c(0x180))console[_0x1ed63c(0x14f)](a5_0x4fbbcb[_0x1ed63c(0x173)]('✓\x20PASS:\x20'+_0x4bdf1a)+a5_0x4fbbcb[_0x1ed63c(0x1de)]('\x20(cached)'));else _0x3dde99[_0x1ed63c(0x17b)]===_0x1ed63c(0x17e)?console[_0x1ed63c(0x14f)](a5_0x4fbbcb[_0x1ed63c(0x1d9)](_0x1ed63c(0x1d2)+_0x4bdf1a+_0x1ed63c(0x16d)+_0x3dde99[_0x1ed63c(0x1d5)])+a5_0x4fbbcb[_0x1ed63c(0x1de)](_0x1ed63c(0x18a))):console['log'](a5_0x4fbbcb['red'](_0x1ed63c(0x18e)+_0x4bdf1a+_0x1ed63c(0x16d)+_0x3dde99['reason']));_0x3dde99[_0x1ed63c(0x14e)]&&console[_0x1ed63c(0x14f)](a5_0x4fbbcb[_0x1ed63c(0x1de)](_0x1ed63c(0x15c)+_0x3dde99[_0x1ed63c(0x14e)])),_0x25d2d5[_0x1ed63c(0x1d7)](_0x3dde99);},'onTestSkipped':(_0x3b4a5b,_0x5896a5)=>{const _0x8509ad=_0x163a1e;_0x3fd91b[_0x8509ad(0x1db)](),console[_0x8509ad(0x14f)](a5_0x4fbbcb['yellow'](_0x8509ad(0x16c)+_0x3b4a5b+_0x8509ad(0x16d)+_0x5896a5));}});for(const _0x556aa5 of _0x161642){!_0x25d2d5[_0x163a1e(0x1bf)](_0x3d8ccc=>_0x3d8ccc[_0x163a1e(0x156)]===_0x556aa5[_0x163a1e(0x156)])&&_0x25d2d5[_0x163a1e(0x1d7)](_0x556aa5);}}catch(_0x5adf6e){_0x3fd91b[_0x163a1e(0x1db)]();const _0x23cc3d=_0x5adf6e instanceof Error?_0x5adf6e['message']:String(_0x5adf6e);return console[_0x163a1e(0x14f)](a5_0x4fbbcb['red'](_0x163a1e(0x1a4)+_0x23cc3d)),0x1;}_0x3fd91b[_0x163a1e(0x1db)]();if(_0x2be6ae[_0x163a1e(0x149)]>0x0){console[_0x163a1e(0x14f)](),console[_0x163a1e(0x14f)](a5_0x4fbbcb['cyan'](_0x163a1e(0x186)));const {projectId:_0x285fc4,agentId:_0x5382be}=_0x3622df[_0x163a1e(0x1a5)];for(const _0xbf0536 of _0x2be6ae){console['log'](_0x163a1e(0x1b3)+a5_0x4fbbcb['white'](_0xbf0536[_0x163a1e(0x156)]));const _0x11984e=createCommandSpinner('Round\x201/'+_0xbf0536[_0x163a1e(0x175)]['length']+':\x20Sending\x20user\x20input...');_0x11984e['start']();try{const {result:_0x54a01b}=await runTest(_0x1444cd[_0x163a1e(0x1dd)],_0xbf0536,{'agentId':_0x5382be,'projectId':_0x285fc4,'site':_0x3622df['site'],'noEval':![],'evaluatorId':_0x4bb32e,'onRoundStart':(_0x514726,_0x134bda)=>{const _0x48f865=_0x163a1e;_0x11984e[_0x48f865(0x1b7)]='Round\x20'+(_0x514726+0x1)+'/'+_0x134bda+_0x48f865(0x15f);},'onRoundComplete':(_0x53fd5b,_0x226e14,_0x5225c1)=>{const _0x584476=_0x163a1e,_0x4b65cc=formatElapsed(_0x226e14);_0x5225c1?console[_0x584476(0x14f)]('\x20\x20Round\x20'+(_0x53fd5b+0x1)+'/'+_0xbf0536['rounds'][_0x584476(0x149)]+_0x584476(0x1af)+a5_0x4fbbcb[_0x584476(0x173)]('✓')+'\x20('+_0x4b65cc+')'):console[_0x584476(0x14f)]('\x20\x20Round\x20'+(_0x53fd5b+0x1)+'/'+_0xbf0536['rounds'][_0x584476(0x149)]+'...\x20'+a5_0x4fbbcb[_0x584476(0x1d9)]('✗'));},'onEvaluationStart':()=>{const _0xe5da7d=_0x163a1e;_0x11984e[_0xe5da7d(0x1b7)]='Evaluating\x20response...';},'onEvaluationComplete':_0x3619f1=>{const _0x2ffb4d=_0x163a1e,_0x44ccd2=formatElapsed(_0x3619f1);console[_0x2ffb4d(0x14f)](_0x2ffb4d(0x15b)+a5_0x4fbbcb['green']('✓')+'\x20('+_0x44ccd2+')');}});_0x11984e[_0x163a1e(0x1db)](),_0x25d2d5[_0x163a1e(0x1d7)](_0x54a01b);if(_0x54a01b[_0x163a1e(0x17b)]===_0x163a1e(0x180))console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x173)](_0x163a1e(0x1ad)+_0x54a01b[_0x163a1e(0x1d5)])+a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x16a)));else _0x54a01b[_0x163a1e(0x17b)]===_0x163a1e(0x17e)?console['log'](a5_0x4fbbcb['red']('✗\x20FAIL:\x20'+_0x54a01b['reason'])+a5_0x4fbbcb['dim'](_0x163a1e(0x16a))):console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x163a1e(0x18e)+_0x54a01b[_0x163a1e(0x1d5)]));_0x54a01b['conversation_url']&&console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x15c)+_0x54a01b[_0x163a1e(0x14e)]));}catch(_0x2688ba){_0x11984e['stop']();const _0xfc5d9=_0x2688ba instanceof Error?_0x2688ba['message']:String(_0x2688ba);console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x163a1e(0x18e)+_0xfc5d9)),_0x25d2d5[_0x163a1e(0x1d7)]({'name':_0xbf0536['name'],'status':_0x163a1e(0x197),'reason':_0xfc5d9,'timestamp':new Date()[_0x163a1e(0x1a9)](),'duration_ms':0x0});}}}console['log']();const _0x490170=Date[_0x163a1e(0x191)]()-_0x134ae3,_0x9c33e0=_0x25d2d5[_0x163a1e(0x1d0)](_0x1df28f=>_0x1df28f[_0x163a1e(0x17b)]===_0x163a1e(0x180))[_0x163a1e(0x149)],_0x5944c0=_0x25d2d5['filter'](_0x355268=>_0x355268[_0x163a1e(0x17b)]==='FAIL')[_0x163a1e(0x149)],_0x53bca5=_0x25d2d5['filter'](_0x1936b3=>_0x1936b3[_0x163a1e(0x17b)]===_0x163a1e(0x197))['length'];console[_0x163a1e(0x14f)]('━'[_0x163a1e(0x1d4)](0x3c)),console['log'](_0x163a1e(0x1c0)),console[_0x163a1e(0x14f)]('━'[_0x163a1e(0x1d4)](0x3c)),console['log'](_0x163a1e(0x177)+_0x25d2d5['length']),console[_0x163a1e(0x14f)]('Passed:\x20\x20\x20'+a5_0x4fbbcb[_0x163a1e(0x173)](_0x9c33e0)),console[_0x163a1e(0x14f)]('Failed:\x20\x20\x20'+a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x5944c0));_0x53bca5>0x0&&console[_0x163a1e(0x14f)](_0x163a1e(0x1ab)+a5_0x4fbbcb[_0x163a1e(0x1d9)](_0x53bca5));console[_0x163a1e(0x14f)](_0x163a1e(0x171)+formatElapsed(_0x490170)),console['log']('━'[_0x163a1e(0x1d4)](0x3c));const _0x54839f={'summary':{'total':_0x25d2d5[_0x163a1e(0x149)],'passed':_0x9c33e0,'failed':_0x5944c0,'errors':_0x53bca5>0x0?_0x53bca5:undefined,'duration_ms':_0x490170},'tests':_0x25d2d5,'agent':{'project':_0x1ee463[_0x163a1e(0x16b)],'name':_0x1ee463[_0x163a1e(0x190)],'site':_0x4325b0},'timestamp':new Date(_0x134ae3)['toISOString']()};if(_0x3a4452!==_0x163a1e(0x1a2)||_0x3936bc){const _0x5851f5=formatResults(_0x54839f,_0x3a4452);if(_0x3936bc)try{a5_0x39a1b0[_0x163a1e(0x1c8)](_0x3936bc,_0x5851f5,_0x163a1e(0x174)),console[_0x163a1e(0x14f)](),console[_0x163a1e(0x14f)](a5_0x4fbbcb[_0x163a1e(0x1de)](_0x163a1e(0x168)+_0x3936bc));}catch(_0x5ed89a){return console[_0x163a1e(0x14f)](),console['log'](a5_0x4fbbcb['red'](_0x163a1e(0x14d)+_0x5ed89a)),0x1;}else console[_0x163a1e(0x14f)](),console[_0x163a1e(0x14f)](_0x5851f5);}const _0x2e4b53=_0x25d2d5['filter'](_0x3a837b=>_0x3a837b[_0x163a1e(0x17b)]!==_0x163a1e(0x180));return _0x2e4b53[_0x163a1e(0x149)]>0x0?0x1:0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a6_0x228f(){const _0x40d797=['has','error','7YpKYZQ','16zMWJTx','22URLxsm','entries','validate','Invalid\x20header\x20format:\x20\x22','set-cookie','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','PUT','log','description','toUpperCase','name','1888oZfpNI','754920NMOtEz','Invalid\x20API\x20type:\x20','length','cdp','POST','cookie','message','color','1650218zjixXV','readBodyFromFile','GET','stack','keys','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','headers','method','output','\x0aStack\x20trace:\x0a','DELETE','request','type','join','file','\x22.\x20','includes','startsWith','2665668eAWPvq','trino','status','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','authorization','Error:\x20','data','x-xsrf-token','body','verbose','.\x20Valid\x20types:\x20','<\x20HTTP/1.1\x20','1001706LOYhUF','596930wIJYvN','.\x20Valid\x20methods:\x20','toLowerCase','6147gZIXNp','substring','api','site','PATCH','trim','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','x-trino-user','workflow','898118pOIWEA','header','llm'];a6_0x228f=function(){return _0x40d797;};return a6_0x228f();}const a6_0x17ef3=a6_0xcb22;(function(_0x31edb6,_0x260ea5){const _0x122575=a6_0xcb22,_0x239153=_0x31edb6();while(!![]){try{const _0x204331=-parseInt(_0x122575(0x11e))/0x1+parseInt(_0x122575(0x139))/0x2+parseInt(_0x122575(0x14b))/0x3+parseInt(_0x122575(0x124))/0x4*(-parseInt(_0x122575(0x112))/0x5)+parseInt(_0x122575(0x111))/0x6*(parseInt(_0x122575(0x123))/0x7)+parseInt(_0x122575(0x130))/0x8*(parseInt(_0x122575(0x115))/0x9)+parseInt(_0x122575(0x131))/0xa*(-parseInt(_0x122575(0x125))/0xb);if(_0x204331===_0x260ea5)break;else _0x239153['push'](_0x239153['shift']());}catch(_0x53ce2b){_0x239153['push'](_0x239153['shift']());}}}(a6_0x228f,0x7dc56));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';function a6_0xcb22(_0x3ee8b2,_0x38e794){_0x3ee8b2=_0x3ee8b2-0x109;const _0x228f58=a6_0x228f();let _0xcb22f6=_0x228f58[_0x3ee8b2];return _0xcb22f6;}const SENSITIVE_HEADERS=new Set([a6_0x17ef3(0x109),'proxy-authorization',a6_0x17ef3(0x136),a6_0x17ef3(0x129),'set-cookie2',a6_0x17ef3(0x10c),'x-auth-token',a6_0x17ef3(0x11c)]);function isSensitiveHeader(_0x2adf90){const _0x5ec560=a6_0x17ef3;return SENSITIVE_HEADERS[_0x5ec560(0x121)](_0x2adf90[_0x5ec560(0x114)]());}function parseHeader(_0x4106c1){const _0x33cd5e=a6_0x17ef3,_0x4de142=_0x4106c1['indexOf'](':');if(_0x4de142===-0x1)throw new Error(_0x33cd5e(0x128)+_0x4106c1+_0x33cd5e(0x148)+_0x33cd5e(0x12a));const _0x4ab4d5=_0x4106c1['substring'](0x0,_0x4de142)['trim'](),_0x17e30f=_0x4106c1[_0x33cd5e(0x116)](_0x4de142+0x1)[_0x33cd5e(0x11a)]();if(!_0x4ab4d5)throw new Error(_0x33cd5e(0x14e)+_0x4106c1+'\x22');return[_0x4ab4d5,_0x17e30f];}export class ApiCommand extends BaseCommand{[a6_0x17ef3(0x12f)]=a6_0x17ef3(0x117);[a6_0x17ef3(0x12d)]=a6_0x17ef3(0x11b);[a6_0x17ef3(0x127)](_0x2b5347){const _0xd0d5cd=a6_0x17ef3,{args:_0x34c54b,options:_0x49b541}=_0x2b5347,_0x59096c=_0x49b541;if(_0x34c54b['length']===0x0)return'Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list';const _0x38baeb=_0x34c54b[0x0];if(!_0x38baeb[_0xd0d5cd(0x14a)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x38baeb;const _0x34a6a2=_0x59096c[_0xd0d5cd(0x10b)],_0x3c403a=_0x59096c['file'];if(_0x34a6a2&&_0x3c403a)return _0xd0d5cd(0x13e);const _0x1a33c9=_0x59096c[_0xd0d5cd(0x140)]||_0xd0d5cd(0x13b),_0x6ea63d=[_0xd0d5cd(0x13b),_0xd0d5cd(0x135),_0xd0d5cd(0x12b),_0xd0d5cd(0x143),_0xd0d5cd(0x119)];if(!_0x6ea63d['includes'](_0x1a33c9[_0xd0d5cd(0x12e)]()))return'Invalid\x20HTTP\x20method:\x20'+_0x1a33c9+_0xd0d5cd(0x113)+_0x6ea63d[_0xd0d5cd(0x146)](',\x20');const _0x304809=_0x59096c[_0xd0d5cd(0x145)]||'td',_0x550b0a=['td',_0xd0d5cd(0x134),_0xd0d5cd(0x11d),_0xd0d5cd(0x14c),_0xd0d5cd(0x120),'llm-proxy'];if(!_0x550b0a[_0xd0d5cd(0x149)](_0x304809))return _0xd0d5cd(0x132)+_0x304809+_0xd0d5cd(0x10f)+_0x550b0a[_0xd0d5cd(0x146)](',\x20');return undefined;}async['execute'](_0x5ccdfc){const _0x3302a3=a6_0x17ef3,{options:_0xe861a4,args:_0x147a55,tdx:_0x46b4b0}=_0x5ccdfc,_0x3ff6e1=_0xe861a4,_0x5c3f44=_0x147a55[0x0],_0xa3baca=(_0x3ff6e1['method']||_0x3302a3(0x13b))[_0x3302a3(0x12e)](),_0x33c8d3=_0x3ff6e1[_0x3302a3(0x10b)],_0x45410f=_0x3ff6e1[_0x3302a3(0x147)],_0x4d0d60=_0x3ff6e1[_0x3302a3(0x11f)],_0x5870d0=_0x3ff6e1['type']||'td';try{const _0x358b7d={};if(_0x4d0d60){const _0x58daa8=Array['isArray'](_0x4d0d60)?_0x4d0d60:[_0x4d0d60];for(const _0x11bc1f of _0x58daa8){const [_0x4e66c8,_0x1c13a4]=parseHeader(_0x11bc1f);_0x358b7d[_0x4e66c8]=_0x1c13a4;}}let _0x4f5bc4;if(_0x33c8d3)_0x4f5bc4=_0x33c8d3;else{if(_0x45410f)try{_0x4f5bc4=RawAPI[_0x3302a3(0x13a)](_0x45410f);}catch(_0x109abb){return console[_0x3302a3(0x122)](_0x3302a3(0x10a)+(_0x109abb instanceof Error?_0x109abb[_0x3302a3(0x137)]:String(_0x109abb))),0x1;}}const _0x3b3460={'method':_0xa3baca,'apiType':_0x5870d0,'includeHeaders':_0xe861a4[_0x3302a3(0x10e)]};_0x4f5bc4&&(_0x3b3460[_0x3302a3(0x10d)]=_0x4f5bc4);Object[_0x3302a3(0x13d)](_0x358b7d)[_0x3302a3(0x133)]>0x0&&(_0x3b3460['headers']=_0x358b7d);if(_0xe861a4[_0x3302a3(0x10e)]){const _0x13c350=resolveSite(_0xe861a4[_0x3302a3(0x118)]),_0xb075a2=getEndpoint(_0x13c350,_0x5870d0),_0x3ce0a0=''+_0xb075a2+_0x5c3f44;console['error']('>\x20'+_0xa3baca+'\x20'+_0x3ce0a0);const _0x1aadb9=getAuthHeaders(_0x13c350),_0x351a2e={..._0x1aadb9,..._0x358b7d};for(const [_0xfcf5cc,_0x1efa7b]of Object[_0x3302a3(0x126)](_0x351a2e)){!isSensitiveHeader(_0xfcf5cc)&&console[_0x3302a3(0x122)]('>\x20'+_0xfcf5cc+':\x20'+_0x1efa7b);}_0x4f5bc4&&console[_0x3302a3(0x122)]('>'),console[_0x3302a3(0x122)]('');}const _0x54a84b=await _0x46b4b0[_0x3302a3(0x117)][_0x3302a3(0x144)](_0x5c3f44,_0x3b3460);if(_0xe861a4['verbose']&&_0x54a84b['headers']){console[_0x3302a3(0x122)](_0x3302a3(0x110)+_0x54a84b[_0x3302a3(0x14d)]);for(const [_0x280135,_0x105a05]of Object['entries'](_0x54a84b[_0x3302a3(0x13f)])){!isSensitiveHeader(_0x280135)&&console[_0x3302a3(0x122)]('<\x20'+_0x280135+':\x20'+_0x105a05);}console[_0x3302a3(0x122)]('');}const _0x33daf5=Boolean(_0xe861a4['output']),_0x25bc39={'color':_0xe861a4[_0x3302a3(0x138)],'noColor':_0xe861a4['noColor']||_0x33daf5&&!_0xe861a4[_0x3302a3(0x138)]},_0x2cdc57=colorizeJSON(_0x54a84b[_0x3302a3(0x10b)],_0x25bc39);return _0xe861a4[_0x3302a3(0x141)]?(writeFileSync(_0xe861a4[_0x3302a3(0x141)],_0x2cdc57),console[_0x3302a3(0x122)]('Results\x20saved\x20to\x20'+_0xe861a4[_0x3302a3(0x141)])):console[_0x3302a3(0x12c)](_0x2cdc57),0x0;}catch(_0x5739ae){return _0x5739ae instanceof Error?(console[_0x3302a3(0x122)](_0x3302a3(0x10a)+_0x5739ae[_0x3302a3(0x137)]),_0xe861a4[_0x3302a3(0x10e)]&&_0x5739ae[_0x3302a3(0x13c)]&&console[_0x3302a3(0x122)](_0x3302a3(0x142)+_0x5739ae[_0x3302a3(0x13c)])):console['error'](_0x3302a3(0x10a)+String(_0x5739ae)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x54826f=a7_0x1b49;(function(_0x4257d0,_0x2f5871){const _0x3b70a3=a7_0x1b49,_0xc75cf2=_0x4257d0();while(!![]){try{const _0x4bf1d1=parseInt(_0x3b70a3(0x184))/0x1*(parseInt(_0x3b70a3(0x191))/0x2)+-parseInt(_0x3b70a3(0x144))/0x3+-parseInt(_0x3b70a3(0x166))/0x4*(-parseInt(_0x3b70a3(0x182))/0x5)+-parseInt(_0x3b70a3(0x153))/0x6+-parseInt(_0x3b70a3(0x18d))/0x7*(parseInt(_0x3b70a3(0x145))/0x8)+parseInt(_0x3b70a3(0x164))/0x9*(parseInt(_0x3b70a3(0x169))/0xa)+parseInt(_0x3b70a3(0x175))/0xb*(parseInt(_0x3b70a3(0x15b))/0xc);if(_0x4bf1d1===_0x2f5871)break;else _0xc75cf2['push'](_0xc75cf2['shift']());}catch(_0x10c660){_0xc75cf2['push'](_0xc75cf2['shift']());}}}(a7_0x30db,0x52690));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';import{buildSiteChoices}from'../core/constants.js';import a7_0x4b784f from'prompts';function a7_0x30db(){const _0x1e076d=['970gPpbYU','\x0aSetup\x20cancelled','97346uxjdKz','yellow','tdx:\x20auth\x20setup','\x20(site:\x20','first_name','apiKey','description','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','select','399KnVdSg','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20registered','4BMbPTp','Remove\x20API\x20key\x20from\x20system\x20keychain','✓\x20Profile\x20\x27','Enter\x20your\x20TD\x20API\x20key:','1558614uotTBH','27072qPNWnn','join','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','\x20\x20tdx','warn','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','create','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','Enter\x20site\x20name:','execute','test','API\x20key\x20cannot\x20be\x20empty','message','\x20--profile\x20','2275800qnGYSd','N/A','tdx\x20profile:\x20','✓\x20Default\x20site\x20set\x20to\x20','status','name','getUserInfo','green','276aoBFfG','email','trim','us01','✓\x20API\x20key\x20removed\x20from\x20keychain','jobs','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','site','✗\x20Validation\x20failed:\x20','3751218ixNged','log','4028XwQAuw','Read\x20credential\x20from\x20','Site\x20name\x20cannot\x20be\x20empty','10phwpMR','No\x20credential\x20found','ERROR','✓\x20Authentication\x20successful\x0a','error','tdx:\x20auth\x20clear','User:\x20','Setting\x20up\x20authentication\x20for\x20site:\x20','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','text','customSite','297682ECyaFl','other','profile','\x20for\x20profile:\x20','red','filter','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','auth:clear','auth','Name:\x20','last_name','/app/mp/ak','\x20(profile:\x20'];a7_0x30db=function(){return _0x1e076d;};return a7_0x30db();}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x396bc4 from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x54826f(0x158)]='auth:setup';['description']='Setup\x20API\x20key\x20authentication\x20interactively';async['execute'](_0x51bcf4){const _0x5c021b=a7_0x54826f,{options:_0x9f2858}=_0x51bcf4,_0x3bbf13=_0x9f2858[_0x5c021b(0x177)];console[_0x5c021b(0x165)](a7_0x396bc4['bold'](_0x5c021b(0x186)));const _0x443527=_0x9f2858[_0x5c021b(0x162)]||_0x5c021b(0x15e),{choices:_0xab85a3,initialIndex:_0x8a7fc9}=buildSiteChoices(_0x443527),_0x18f38c=_0x3bbf13?_0x5c021b(0x147)+_0x3bbf13+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x471d9b=await a7_0x4b784f({'type':_0x5c021b(0x18c),'name':'site','message':_0x18f38c,'choices':_0xab85a3,'initial':_0x8a7fc9});if(!_0x471d9b[_0x5c021b(0x162)])return console['log'](_0x5c021b(0x183)),0x1;let _0xb44c99;if(_0x471d9b[_0x5c021b(0x162)]===_0x5c021b(0x176)){const _0x35e299=await a7_0x4b784f({'type':_0x5c021b(0x173),'name':_0x5c021b(0x174),'message':_0x5c021b(0x14d),'initial':'us01','validate':_0x4a6e85=>{const _0x3ea916=_0x5c021b;if(!_0x4a6e85||!_0x4a6e85[_0x3ea916(0x15d)]())return _0x3ea916(0x168);if(!/^[a-z0-9-]+$/[_0x3ea916(0x14f)](_0x4a6e85[_0x3ea916(0x15d)]()))return _0x3ea916(0x17b);return!![];}});if(!_0x35e299[_0x5c021b(0x174)])return console[_0x5c021b(0x165)](_0x5c021b(0x183)),0x1;_0xb44c99=_0x35e299[_0x5c021b(0x174)];}else _0xb44c99=_0x471d9b[_0x5c021b(0x162)];const _0x25513e=resolveSite(_0xb44c99);console[_0x5c021b(0x165)](_0x5c021b(0x170)+_0x25513e),console[_0x5c021b(0x165)](_0x5c021b(0x18f)),console['log']('\x20\x20'+getConsoleUrl(_0x25513e,_0x5c021b(0x180)));const _0x4d51eb=await a7_0x4b784f({'type':'password','name':'apiKey','message':_0x5c021b(0x143),'validate':_0x5d0286=>{const _0x2b2cea=_0x5c021b;if(!_0x5d0286||!_0x5d0286[_0x2b2cea(0x15d)]())return _0x2b2cea(0x150);return!![];}});if(!_0x4d51eb[_0x5c021b(0x189)])return console[_0x5c021b(0x165)]('\x0aSetup\x20cancelled'),0x1;const _0x33af21=_0x4d51eb[_0x5c021b(0x189)];console[_0x5c021b(0x165)]('Validating\x20API\x20key...');try{const _0xf13799=TDX[_0x5c021b(0x14b)]({'site':_0x25513e,'apiKey':_0x33af21['trim'](),'logLevel':_0x9f2858['logLevel']??LogLevel[_0x5c021b(0x16b)]}),_0x12498e=await _0xf13799[_0x5c021b(0x160)][_0x5c021b(0x159)]();console[_0x5c021b(0x165)](_0x5c021b(0x172)+_0x12498e[_0x5c021b(0x15c)]+')');const _0x47b353=await isKeychainAvailable();_0x47b353?(await saveAPIKeyAsync(_0x33af21[_0x5c021b(0x15d)](),_0x25513e,_0x3bbf13),console[_0x5c021b(0x165)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x3bbf13?_0x5c021b(0x181)+_0x3bbf13+')':''))):(console['warn'](a7_0x396bc4['yellow'](_0x5c021b(0x14a))),console[_0x5c021b(0x149)](a7_0x396bc4[_0x5c021b(0x185)](_0x5c021b(0x161))));if(_0x3bbf13){const _0x19edfa={'site':_0x25513e};saveProfileToUserConfig(_0x3bbf13,_0x19edfa),console[_0x5c021b(0x165)](_0x5c021b(0x193)+_0x3bbf13+_0x5c021b(0x190));}else saveDefaultSiteToUserConfig(_0x25513e),console[_0x5c021b(0x165)](_0x5c021b(0x156)+_0x25513e);const _0x1b4aa3=_0x3bbf13?_0x5c021b(0x152)+_0x3bbf13:'';return console['log'](),console['log'](_0x5c021b(0x14c)),console[_0x5c021b(0x165)](_0x5c021b(0x148)+_0x1b4aa3+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x5c021b(0x165)](_0x5c021b(0x148)+_0x1b4aa3+_0x5c021b(0x18b)),0x0;}catch(_0x11122e){if(_0x11122e instanceof HTTPClientError&&_0x11122e['status']===0x191)return printAuthError(_0x11122e),0x1;return console['error'](a7_0x396bc4[_0x5c021b(0x179)](_0x5c021b(0x163)+(_0x11122e instanceof Error?_0x11122e[_0x5c021b(0x151)]:String(_0x11122e)))),console['error'](_0x5c021b(0x18e)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x54826f(0x158)]=a7_0x54826f(0x17d);[a7_0x54826f(0x18a)]=a7_0x54826f(0x171);async['execute'](_0x9f0a7b){const _0xbb204a=a7_0x54826f,{options:_0x5f0196,tdx:_0x43ed23}=_0x9f0a7b,_0x1f4337=_0x5f0196[_0xbb204a(0x162)],_0x101b8e=_0x5f0196[_0xbb204a(0x177)],_0x43a433=_0x101b8e?_0x101b8e:_0xbb204a(0x154);console['log'](_0xbb204a(0x155)+_0x43a433+_0xbb204a(0x187)+_0x1f4337+')');const _0xaba69a=await resolveAPIKeyAsync(_0x1f4337,_0x101b8e);if(_0xaba69a){const {source:_0x3e1c6d,isDeprecated:_0x6d10b9}=_0xaba69a,_0x10fca4=_0xbb204a(0x167)+_0x3e1c6d;console[_0xbb204a(0x165)](_0x6d10b9?a7_0x396bc4[_0xbb204a(0x185)](_0x10fca4):_0x10fca4);}else console[_0xbb204a(0x165)](a7_0x396bc4[_0xbb204a(0x185)](_0xbb204a(0x16a)));try{const _0x22afcd=await _0x43ed23[_0xbb204a(0x160)][_0xbb204a(0x159)]();return console[_0xbb204a(0x165)](a7_0x396bc4[_0xbb204a(0x15a)](_0xbb204a(0x16c))),console['log'](_0xbb204a(0x16f)+_0x22afcd[_0xbb204a(0x15c)]),(_0x22afcd[_0xbb204a(0x188)]||_0x22afcd[_0xbb204a(0x17f)])&&console[_0xbb204a(0x165)](_0xbb204a(0x17e)+[_0x22afcd['first_name'],_0x22afcd[_0xbb204a(0x17f)]][_0xbb204a(0x17a)](Boolean)[_0xbb204a(0x146)]('\x20')),0x0;}catch(_0x3ab606){return _0x3ab606 instanceof HTTPClientError&&_0x3ab606[_0xbb204a(0x157)]===0x191?printAuthError(_0x3ab606,!![],_0x101b8e):console[_0xbb204a(0x16d)](a7_0x396bc4[_0xbb204a(0x179)]('✗\x20Validation\x20failed:\x20'+(_0x3ab606 instanceof Error?_0x3ab606[_0xbb204a(0x151)]:String(_0x3ab606)))),0x1;}}}function a7_0x1b49(_0x5757fa,_0x458208){_0x5757fa=_0x5757fa-0x143;const _0x30db83=a7_0x30db();let _0x1b497c=_0x30db83[_0x5757fa];return _0x1b497c;}export class AuthClearCommand extends BaseCommand{[a7_0x54826f(0x158)]=a7_0x54826f(0x17c);[a7_0x54826f(0x18a)]=a7_0x54826f(0x192);async[a7_0x54826f(0x14e)](_0x22674a){const _0x11f789=a7_0x54826f,{options:_0x18bad1}=_0x22674a,_0x5424b7=_0x18bad1[_0x11f789(0x177)];console[_0x11f789(0x165)](a7_0x396bc4['bold'](_0x11f789(0x16e)));const _0xde06e0=await isKeychainAvailable();if(!_0xde06e0)return console['error'](a7_0x396bc4[_0x11f789(0x179)]('System\x20keychain\x20is\x20not\x20available')),0x1;const _0x40cae3=await deleteKeychainAPIKey(_0x5424b7);return _0x40cae3?(clearCredentialCache(),console[_0x11f789(0x165)](_0x11f789(0x15f)+(_0x5424b7?_0x11f789(0x181)+_0x5424b7+')':'')),0x0):(console[_0x11f789(0x165)]('No\x20API\x20key\x20found\x20in\x20keychain'+(_0x5424b7?_0x11f789(0x178)+_0x5424b7:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a8_0x2c570e=a8_0x1113;function a8_0x5bbc(){const _0x253dee=['resolveProjectId','session\x20context','--agent\x20flag','args','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','5072FltLuj','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','resolveAgentId','error','includes','agent','Chat\x20session:\x20','chatId','3371538wSYAMU','782676bECEus','10XwPrRA','data','2125554owXCNY','type','handleChatEvent','1719380SMPxBn','getDefaultAgent','validate','1211PbKTKR','Using\x20agent\x20from\x20','streamChat','verbose','new','content','execute','claude-4.5-haiku','1101476QYZKnV','name','stack','llmAgent','\x0aError:\x20','Resolving\x20project\x20\x27','join','Resolving\x20agent\x20\x27','Continuing\x20chat:\x20','54aKaHXJ','\x27...','code','13388NTGiNX','stdout','chat','Getting\x20default\x20agent...','llmProject','log','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','cause','Error:\x20','CHAT_NOT_FOUND','\x20\x20Cause:\x20','getAgentId','404','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','event','message','llm'];a8_0x5bbc=function(){return _0x253dee;};return a8_0x5bbc();}(function(_0x144074,_0x1ba002){const _0x3fd583=a8_0x1113,_0x23354d=_0x144074();while(!![]){try{const _0x386466=-parseInt(_0x3fd583(0xd7))/0x1*(parseInt(_0x3fd583(0xd4))/0x2)+parseInt(_0x3fd583(0xbd))/0x3+parseInt(_0x3fd583(0xcb))/0x4*(-parseInt(_0x3fd583(0xbb))/0x5)+parseInt(_0x3fd583(0xf5))/0x6+-parseInt(_0x3fd583(0xc3))/0x7*(parseInt(_0x3fd583(0xed))/0x8)+parseInt(_0x3fd583(0xf6))/0x9+parseInt(_0x3fd583(0xc0))/0xa;if(_0x386466===_0x1ba002)break;else _0x23354d['push'](_0x23354d['shift']());}catch(_0x262f96){_0x23354d['push'](_0x23354d['shift']());}}}(a8_0x5bbc,0x7be37));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0xb16a0,_0x684f03){const _0x4e1943=a8_0x1113;if(_0xb16a0 instanceof SDKError)console['error'](_0x4e1943(0xdf)+_0xb16a0[_0x4e1943(0xe6)]),_0x684f03[_0x4e1943(0xc6)]&&(_0xb16a0['cause']&&console['error'](_0x4e1943(0xe1)+_0xb16a0[_0x4e1943(0xde)]),_0xb16a0[_0x4e1943(0xcd)]&&(console[_0x4e1943(0xf0)]('\x0aStack\x20trace:'),console[_0x4e1943(0xf0)](_0xb16a0[_0x4e1943(0xcd)])));else throw _0xb16a0;}function a8_0x1113(_0x549859,_0x4a1ca){_0x549859=_0x549859-0xbb;const _0x5bbc9a=a8_0x5bbc();let _0x1113df=_0x5bbc9a[_0x549859];return _0x1113df;}export class ChatCommand extends BaseCommand{[a8_0x2c570e(0xcc)]=a8_0x2c570e(0xd9);['description']=a8_0x2c570e(0xe4);[a8_0x2c570e(0xc2)](_0x2bdfe7){const _0x532b27=a8_0x2c570e,_0x1b5bc4=_0x2bdfe7[_0x532b27(0xeb)][_0x532b27(0xd1)]('\x20');if(!_0x1b5bc4)return _0x532b27(0xdd);return undefined;}async['streamChat'](_0x5244f9,_0x4b1271,_0x2c0350,_0x5247f6,_0x5c800e){const _0x5556a6=a8_0x2c570e;for await(const _0x19ade4 of _0x5244f9[_0x5556a6(0xe7)][_0x5556a6(0xd9)](_0x4b1271,{'agentId':_0x2c0350,'chatId':_0x5247f6})){if(_0x19ade4[_0x5556a6(0xbe)]==='metadata'){const _0x2f8326=_0x19ade4[_0x5556a6(0xbc)][_0x5556a6(0xf4)];saveLastChatId(_0x2f8326),_0x5c800e&&console[_0x5556a6(0xf0)](_0x5556a6(0xf3)+_0x2f8326);}else _0x19ade4[_0x5556a6(0xbe)]===_0x5556a6(0xe5)&&this[_0x5556a6(0xbf)](_0x19ade4[_0x5556a6(0xbc)]);}}async[a8_0x2c570e(0xe2)](_0xff8f14,_0x792331,_0x4f1c4b,_0x45365b,_0x4069da){const _0x351415=a8_0x2c570e,_0x52e763=_0x792331||_0x4f1c4b;if(_0x52e763){const {projectName:_0x356189,agentName:_0x579683}=parseAgentRef(_0x52e763),_0x2e44e1=_0x579683||_0x52e763,_0x52b003=_0x579683?_0x356189:_0x45365b;if(!_0x52b003)throw new Error(_0x351415(0xec));if(_0x4069da){const _0x4e34d5=_0x792331?_0x351415(0xea):_0x351415(0xe9);console[_0x351415(0xf0)](_0x351415(0xc4)+_0x4e34d5+':\x20'+_0x52b003+'/'+_0x2e44e1);}const _0x42669c=await withSpinner(_0x351415(0xd0)+_0x52b003+_0x351415(0xd5),()=>_0xff8f14[_0x351415(0xe7)][_0x351415(0xe8)](_0x52b003),{'verbose':_0x4069da}),_0x1ff6e8=await withSpinner(_0x351415(0xd2)+_0x2e44e1+_0x351415(0xd5),()=>_0xff8f14[_0x351415(0xe7)][_0x351415(0xef)](_0x2e44e1,_0x42669c[_0x351415(0xbc)]),{'verbose':_0x4069da});return _0x1ff6e8[_0x351415(0xbc)];}else{const _0x3e5c52=_0xff8f14[_0x351415(0xe7)][_0x351415(0xc1)]();if(_0x3e5c52)return _0x4069da&&console[_0x351415(0xf0)]('Using\x20cached\x20default\x20agent:\x20'+_0x3e5c52[_0x351415(0xcc)]),_0x3e5c52['id'];const _0x45de1a=await withSpinner(_0x351415(0xda),()=>_0xff8f14['llm']['getOrCreateDefaultAgent'](_0x351415(0xca),0x0),{'verbose':_0x4069da});return _0x45de1a['data']['id'];}}async[a8_0x2c570e(0xc9)](_0x105eff){const _0x285d6=a8_0x2c570e,{options:_0x348e70,args:_0x378aa6,tdx:_0x107c3a}=_0x105eff,_0x512a76=_0x378aa6[_0x285d6(0xd1)]('\x20'),_0x12a6e1=_0x348e70,_0x20786e=_0x12a6e1[_0x285d6(0xf2)],_0x52af13=_0x12a6e1[_0x285d6(0xce)],_0x55af5e=_0x12a6e1[_0x285d6(0xdb)],_0x1a321a=_0x12a6e1[_0x285d6(0xc7)];try{let _0x1611eb,_0x53bee9;!_0x1a321a&&(_0x53bee9=loadLastChatId(),_0x53bee9&&_0x348e70[_0x285d6(0xc6)]&&console[_0x285d6(0xf0)](_0x285d6(0xd3)+_0x53bee9));(_0x1a321a||!_0x53bee9)&&(_0x1611eb=await this[_0x285d6(0xe2)](_0x107c3a,_0x20786e,_0x52af13,_0x55af5e,_0x348e70['verbose']));try{await this[_0x285d6(0xc5)](_0x107c3a,_0x512a76,_0x1611eb,_0x53bee9,_0x348e70[_0x285d6(0xc6)]);}catch(_0x503798){const _0x153359=_0x503798 instanceof SDKError&&_0x503798[_0x285d6(0xd6)]===ErrorCode[_0x285d6(0xe0)]||_0x503798 instanceof Error&&_0x503798[_0x285d6(0xe6)][_0x285d6(0xf1)](_0x285d6(0xe3));if(_0x153359)_0x348e70['verbose']&&console[_0x285d6(0xf0)](_0x285d6(0xee)),!_0x1611eb&&(_0x1611eb=await this['getAgentId'](_0x107c3a,_0x20786e,_0x52af13,_0x55af5e,_0x348e70['verbose'])),await this[_0x285d6(0xc5)](_0x107c3a,_0x512a76,_0x1611eb,undefined,_0x348e70[_0x285d6(0xc6)]);else throw _0x503798;}return console[_0x285d6(0xdc)](),0x0;}catch(_0x2cd999){return console[_0x285d6(0xf0)](),handleSDKError(_0x2cd999,_0x348e70),0x1;}}['handleChatEvent'](_0x50f0a1){const _0x1cbb50=a8_0x2c570e;if(_0x1cbb50(0xc8)in _0x50f0a1)process[_0x1cbb50(0xd8)]['write'](_0x50f0a1[_0x1cbb50(0xc8)]);else _0x1cbb50(0xf0)in _0x50f0a1&&console[_0x1cbb50(0xf0)](_0x1cbb50(0xcf)+_0x50f0a1[_0x1cbb50(0xf0)]);}}
|