@treasuredata/tdx 0.21.0 → 0.22.0

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.
Files changed (175) hide show
  1. package/README.md +4 -13
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/mcp-command.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profile-command.js +1 -1
  28. package/dist/commands/profile-command.js.map +1 -1
  29. package/dist/commands/profiles-command.js +1 -1
  30. package/dist/commands/query-command.js +1 -1
  31. package/dist/commands/schedule-command.js +1 -1
  32. package/dist/commands/segment-command.js +1 -1
  33. package/dist/commands/segment-create-command.js +1 -1
  34. package/dist/commands/segment-fields-command.js +1 -1
  35. package/dist/commands/segment-pull-command.js +1 -1
  36. package/dist/commands/segment-push-command.js +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segment-validate-command.js +1 -1
  40. package/dist/commands/segments.js +1 -1
  41. package/dist/commands/show.js +1 -1
  42. package/dist/commands/status-command.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/unset-command.js +1 -1
  45. package/dist/commands/unset-command.js.map +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/use-command.js.map +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/command-output.js +1 -1
  52. package/dist/core/config.js +1 -1
  53. package/dist/core/config.js.map +1 -1
  54. package/dist/core/connection-cache.js +1 -1
  55. package/dist/core/constants.js +1 -1
  56. package/dist/core/credential-cache.js +1 -1
  57. package/dist/core/global-context.js +1 -1
  58. package/dist/core/global-context.js.map +1 -1
  59. package/dist/core/keychain.js +1 -1
  60. package/dist/core/profile.d.ts +1 -1
  61. package/dist/core/profile.js +1 -1
  62. package/dist/core/project-config.js +1 -1
  63. package/dist/core/session.d.ts.map +1 -1
  64. package/dist/core/session.js +1 -1
  65. package/dist/core/session.js.map +1 -1
  66. package/dist/core/user-cache.js +1 -1
  67. package/dist/core/version.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/mcp/server.js +1 -1
  70. package/dist/mcp/tools/index.js +1 -1
  71. package/dist/mcp/tools/tdx-run.js +1 -1
  72. package/dist/mcp/tools/tdx-run.js.map +1 -1
  73. package/dist/mcp/tools/tdx-search.js +1 -1
  74. package/dist/mcp/utils.js +1 -1
  75. package/dist/proxy/claude-usage-tracker.js +1 -1
  76. package/dist/proxy/passthrough-server.js +1 -1
  77. package/dist/proxy/sse-usage-parser.js +1 -1
  78. package/dist/sdk/agent/agent-config.js +1 -1
  79. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  80. package/dist/sdk/agent/agent-yaml.js +1 -1
  81. package/dist/sdk/agent/test/evaluator.js +1 -1
  82. package/dist/sdk/agent/test/executor.js +1 -1
  83. package/dist/sdk/agent/test/index.js +1 -1
  84. package/dist/sdk/agent/test/output.js +1 -1
  85. package/dist/sdk/agent/test/parser.js +1 -1
  86. package/dist/sdk/api.js +1 -1
  87. package/dist/sdk/client/cdp-api-client.js +1 -1
  88. package/dist/sdk/client/endpoints.js +1 -1
  89. package/dist/sdk/client/engage-api-client.js +1 -1
  90. package/dist/sdk/client/http-client.js +1 -1
  91. package/dist/sdk/client/llm-api-client.js +1 -1
  92. package/dist/sdk/client/rate-limiter.js +1 -1
  93. package/dist/sdk/client/td-api-client.js +1 -1
  94. package/dist/sdk/client/trino-api-client.js +1 -1
  95. package/dist/sdk/client/workflow-client.js +1 -1
  96. package/dist/sdk/connection-validator.js +1 -1
  97. package/dist/sdk/connection.js +1 -1
  98. package/dist/sdk/engage.js +1 -1
  99. package/dist/sdk/errors.js +1 -1
  100. package/dist/sdk/index.js +1 -1
  101. package/dist/sdk/io/index.js +1 -1
  102. package/dist/sdk/io/node-filesystem.js +1 -1
  103. package/dist/sdk/job.js +1 -1
  104. package/dist/sdk/journey.js +1 -1
  105. package/dist/sdk/llm/chat-cache.js +1 -1
  106. package/dist/sdk/llm/index.js +1 -1
  107. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  108. package/dist/sdk/llm/model-factors.js +1 -1
  109. package/dist/sdk/query/index.js +1 -1
  110. package/dist/sdk/query/sql-parser.js +1 -1
  111. package/dist/sdk/schedule.js +1 -1
  112. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/fields-display.js +1 -1
  114. package/dist/sdk/segment/file-discovery.js +1 -1
  115. package/dist/sdk/segment/journey-utils.js +1 -1
  116. package/dist/sdk/segment/journey-yaml.js +1 -1
  117. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  118. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  119. package/dist/sdk/segment/pull-workflow.js +1 -1
  120. package/dist/sdk/segment/push-workflow.js +1 -1
  121. package/dist/sdk/segment/resolution-context.js +1 -1
  122. package/dist/sdk/segment/segment-path-parser.js +1 -1
  123. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  124. package/dist/sdk/segment/target-resolution.js +1 -1
  125. package/dist/sdk/segment/tdx-config.js +1 -1
  126. package/dist/sdk/segment/validate-files.js +1 -1
  127. package/dist/sdk/segment/yaml-validator.js +1 -1
  128. package/dist/sdk/segment.js +1 -1
  129. package/dist/sdk/types/index.js +1 -1
  130. package/dist/sdk/types/progress.js +1 -1
  131. package/dist/sdk/user.js +1 -1
  132. package/dist/sdk/util/format-detector.js +1 -1
  133. package/dist/sdk/util/formatters.js +1 -1
  134. package/dist/sdk/util/index.js +1 -1
  135. package/dist/sdk/util/tree-formatter.js +1 -1
  136. package/dist/sdk/workflow/archive-validation.js +1 -1
  137. package/dist/sdk/workflow/clone-workflow.js +1 -1
  138. package/dist/sdk/workflow/index.js +1 -1
  139. package/dist/sdk/workflow/pull-workflow.js +1 -1
  140. package/dist/sdk/workflow/push-workflow.js +1 -1
  141. package/dist/sdk/workflow/tdx-config.js +1 -1
  142. package/dist/sdk/workflow/workflow-utils.js +1 -1
  143. package/dist/test-utils/command-runner.js +1 -1
  144. package/dist/test-utils/factories.js +1 -1
  145. package/dist/test-utils/fixtures.js +1 -1
  146. package/dist/test-utils/http-mock.js +1 -1
  147. package/dist/test-utils/index.js +1 -1
  148. package/dist/utils/async.js +1 -1
  149. package/dist/utils/colors.js +1 -1
  150. package/dist/utils/diff.js +1 -1
  151. package/dist/utils/file-permissions.js +1 -1
  152. package/dist/utils/global-cache.js +1 -1
  153. package/dist/utils/json-loader.js +1 -1
  154. package/dist/utils/local-cache.js +1 -1
  155. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  156. package/dist/utils/logger/formatters/index.js +1 -1
  157. package/dist/utils/logger/handlers/console-handler.js +1 -1
  158. package/dist/utils/logger/handlers/file-handler.js +1 -1
  159. package/dist/utils/logger/handlers/index.js +1 -1
  160. package/dist/utils/logger/handlers/null-handler.js +1 -1
  161. package/dist/utils/logger/index.js +1 -1
  162. package/dist/utils/logger/logger.js +1 -1
  163. package/dist/utils/logger/types.js +1 -1
  164. package/dist/utils/option-validation.js +1 -1
  165. package/dist/utils/port.js +1 -1
  166. package/dist/utils/process.js +1 -1
  167. package/dist/utils/process.js.map +1 -1
  168. package/dist/utils/prompt.js +1 -1
  169. package/dist/utils/spinner.js +1 -1
  170. package/dist/utils/sse-parser.js +1 -1
  171. package/dist/utils/string-utils.js +1 -1
  172. package/dist/utils/table-ref-parser.js +1 -1
  173. package/dist/utils/tdx-logger.js +1 -1
  174. package/dist/utils/version-check.js +1 -1
  175. package/package.json +1 -1
@@ -1 +1 @@
1
- const a4_0x3f4182=a4_0x5d21;function a4_0x5d21(_0x530da2,_0xdca889){_0x530da2=_0x530da2-0x16d;const _0x312a9a=a4_0x312a();let _0x5d21c1=_0x312a9a[_0x530da2];return _0x5d21c1;}(function(_0x2f283b,_0x43aa03){const _0x249efd=a4_0x5d21,_0x571003=_0x2f283b();while(!![]){try{const _0x517aba=-parseInt(_0x249efd(0x185))/0x1+-parseInt(_0x249efd(0x16d))/0x2*(-parseInt(_0x249efd(0x208))/0x3)+-parseInt(_0x249efd(0x186))/0x4*(-parseInt(_0x249efd(0x1e4))/0x5)+parseInt(_0x249efd(0x219))/0x6+-parseInt(_0x249efd(0x195))/0x7*(-parseInt(_0x249efd(0x1b4))/0x8)+parseInt(_0x249efd(0x1f0))/0x9+-parseInt(_0x249efd(0x16f))/0xa*(parseInt(_0x249efd(0x1d0))/0xb);if(_0x517aba===_0x43aa03)break;else _0x571003['push'](_0x571003['shift']());}catch(_0x135409){_0x571003['push'](_0x571003['shift']());}}}(a4_0x312a,0x9ac23));import a4_0x583209 from'chalk';import a4_0x3ba644 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,isInteractive}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(_0x9be18e){const _0x36e705=a4_0x5d21,_0xb63487=[];if(_0x9be18e[_0x36e705(0x182)]!==undefined)_0xb63487['push'](_0x9be18e['total']+_0x36e705(0x1d1));if(_0x9be18e[_0x36e705(0x170)]!==undefined&&_0x9be18e[_0x36e705(0x170)]>0x0)_0xb63487[_0x36e705(0x1aa)](a4_0x583209[_0x36e705(0x21a)](_0x9be18e[_0x36e705(0x170)]+'\x20new'));if(_0x9be18e[_0x36e705(0x1d3)]!==undefined&&_0x9be18e['created']>0x0)_0xb63487['push'](a4_0x583209[_0x36e705(0x21a)](_0x9be18e[_0x36e705(0x1d3)]+_0x36e705(0x1ba)));if(_0x9be18e[_0x36e705(0x1bd)]!==undefined&&_0x9be18e[_0x36e705(0x1bd)]>0x0)_0xb63487[_0x36e705(0x1aa)](a4_0x583209[_0x36e705(0x21c)](_0x9be18e[_0x36e705(0x1bd)]+_0x36e705(0x1db)));if(_0x9be18e['unchanged']!==undefined&&_0x9be18e[_0x36e705(0x1ca)]>0x0)_0xb63487[_0x36e705(0x1aa)](a4_0x583209[_0x36e705(0x1ce)](_0x9be18e[_0x36e705(0x1ca)]+_0x36e705(0x1a2)));if(_0x9be18e['errors']!==undefined&&_0x9be18e[_0x36e705(0x18f)]>0x0)_0xb63487['push'](a4_0x583209[_0x36e705(0x17a)](_0x9be18e[_0x36e705(0x18f)]+_0x36e705(0x1e8)));return _0xb63487['join'](',\x20');}function displayDiffs(_0x1ed3d7,_0x1ea239,_0x485a91,_0x350443,_0x5e100f=[]){const _0x5227b0=a4_0x5d21;for(const _0x97012e of _0x1ed3d7){if(_0x97012e[_0x5227b0(0x211)]){const _0x269c14=_0x97012e[_0x5227b0(0x1cf)]||_0x97012e[_0x5227b0(0x193)];console[_0x5227b0(0x1c3)](_0x5227b0(0x1bb)+_0x269c14+'\x27:'),console[_0x5227b0(0x1c3)]('─'['repeat'](0x3c)),console[_0x5227b0(0x1c3)](_0x97012e[_0x5227b0(0x211)]),console['log']('─'['repeat'](0x3c));}}for(const _0x4051a7 of _0x1ea239){_0x4051a7['diff']&&(console['log'](_0x5227b0(0x18d)+_0x4051a7['name']+'\x27:'),console['log']('─'['repeat'](0x3c)),console['log'](_0x4051a7['diff']),console['log']('─'['repeat'](0x3c)));}for(const _0x36f6cd of _0x485a91){_0x36f6cd['diff']&&(console[_0x5227b0(0x1c3)](_0x5227b0(0x1c1)+_0x36f6cd['name']+'\x27:'),console[_0x5227b0(0x1c3)]('─'[_0x5227b0(0x1b9)](0x3c)),console[_0x5227b0(0x1c3)](_0x36f6cd[_0x5227b0(0x211)]),console[_0x5227b0(0x1c3)]('─'[_0x5227b0(0x1b9)](0x3c)));}for(const _0x1db46c of _0x350443){_0x1db46c[_0x5227b0(0x211)]&&(console['log'](_0x5227b0(0x187)+_0x1db46c['name']+'\x27:'),console[_0x5227b0(0x1c3)]('─'['repeat'](0x3c)),console['log'](_0x1db46c[_0x5227b0(0x211)]),console[_0x5227b0(0x1c3)]('─'[_0x5227b0(0x1b9)](0x3c)));}for(const _0x41461d of _0x5e100f){_0x41461d[_0x5227b0(0x211)]&&(console[_0x5227b0(0x1c3)](_0x5227b0(0x20f)+_0x41461d[_0x5227b0(0x193)]+'\x27:'),console[_0x5227b0(0x1c3)]('─'[_0x5227b0(0x1b9)](0x3c)),console['log'](_0x41461d[_0x5227b0(0x211)]),console[_0x5227b0(0x1c3)]('─'[_0x5227b0(0x1b9)](0x3c)));}}function a4_0x312a(){const _0x510c3d=['\x0aChanges\x20to\x20knowledge\x20base\x20\x27','Cloning\x20\x22','errors','counts','Project\x20cloned\x20successfully','Failed\x20to\x20push\x20agent:\x20','name','\x22\x20to\x20new\x20project\x20\x22','684250HVJqJb','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','llm_project','Would\x20clone:','sourceProjectName','action','newProjectId','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','New\x20project:\x20','dryRun','\x20\x20Knowledge\x20Base\x20\x22','agent.yml','\x20unchanged','Using\x20local\x20project:\x20','Project:\x20','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','projectName','\x20\x20Prompt\x20\x22','\x0aError:','parse','push','\x20\x20Prompts:\x20','\x22\x20to\x20\x22','\x20=\x20','\x20\x20Integrations:\x20','\x0aPull\x20summary\x20for\x20\x27','pullProject','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','hasChanges','llmProject','96GeDqMN','\x22...','agentId','INVALID_ARGUMENT','profile','repeat','\x20created','\x0aChanges\x20to\x20agent\x20\x27','Would\x20push\x20agent:\x20','updated','\x20\x20Integration\x20\x22','\x20successfully','\x0aPush\x20summary\x20for\x20\x27','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','pushProject','log','Clone\x20\x22','\x22:\x20','\x0a✔\x20Pulled\x20','\x20\x20tdx\x20agent\x20pull\x20','dirname','cwd','unchanged','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','newProjectName','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)','gray','agentName','77JWpHdh','\x20total','Errors:','created','reason','\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','Status:\x20','yes','Analyzing\x20changes\x20to\x20push...','\x20updated','\x20--profile\x20','found','outputDir','Cancelled','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','context','agents','source','1895kATABl','projectDir','\x20\x20Agent\x20\x22','agent:push','\x20errors','cyan','outputPath','\x20files\x20to\x20','Source:\x20','Pushing\x20agent\x20from\x20\x22','message','Summary:','7996725eBGEmA','\x20\x20tdx\x20agent\x20clone\x20agents/','site','cloneProject','Using\x20context\x20project:\x20','\x20changed','execute','dim','Using\x20current\x20project:\x20','\x20|\x20','textKnowledgeBases','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20\x20Text\x20Knowledge\x20Base\x20\x22','\x20\x20Knowledge\x20Bases:\x20','Using\x20project:\x20','Dry\x20run\x20-\x20no\x20files\x20written','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','✔\x20Context\x20set:\x20','Chat:\x20','\x20resources?','\x20\x20Source:\x20','\x22\x20from\x20project\x20\x22','force','\x20new','3515466AEJEjI','-\x20no\x20files\x20written','\x0aWrite\x20','\x0aErrors\x20found:','Writing\x20files...','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x0aChanges\x20to\x20integration\x20\x27','knowledgeBases','diff','description','projectId','session','pullAgent','\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','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','Agent:\x20','7414080CbaBKI','green','MISSING_ARGUMENT','yellow','2uzbXbu','utf-8','5276330YQcuFh','new','Analyzing\x20project\x20\x22','tdx.json','integrations','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','join','\x20resources\x20to\x20\x27','\x20--name\x20','agent:clone','\x22\x20to\x20a\x20different\x20profile','red','\x0aProject\x20pushed\x20with\x20errors','New\x20project\x20name\x20is\x20required','\x20\x20Agents:\x20','Agent\x20pulled\x20successfully','prompts','\x20\x20Target:\x20','Output\x20path:\x20','total','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','error','911454LLSUHt','8124BSOrEq','\x0aChanges\x20to\x20prompt\x20\x27','No\x20tdx.json\x20found\x20in\x20','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Pulling\x20agent\x20\x22','Using\x20project\x20from\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'];a4_0x312a=function(){return _0x510c3d;};return a4_0x312a();}export class AgentPullCommand extends BaseCommand{['name']='agent:pull';[a4_0x3f4182(0x212)]=a4_0x3f4182(0x1e0);async[a4_0x3f4182(0x1f6)](_0x2375c6){const _0x549453=a4_0x3f4182,{options:_0x3fab38,args:_0x3c72c8,tdx:_0xe45ee2}=_0x2375c6,_0x535129=_0x3c72c8[0x0],_0x168330=_0x3c72c8[0x1],_0xadefde=_0x3fab38['output'],_0x16f910=_0x3fab38['dryRun'],_0x8674b9=_0x3fab38[_0x549453(0x206)],_0x46ecfb=_0x3fab38[_0x549453(0x1d9)],_0x2cc794=_0x3fab38[_0x549453(0x1b3)];let _0x3810cc,_0x163684;const _0x57583f=findAgentConfigPath(process['cwd']());if(_0x535129){const _0x1f73da=a4_0x3ba644['join'](_0x535129,_0x549453(0x172));if(existsSync(_0x1f73da))try{const _0x2b0d96=JSON[_0x549453(0x1a9)](readFileSync(_0x1f73da,_0x549453(0x16e)));_0x3810cc=_0x2b0d96['llm_project'],_0x163684=_0x535129,console[_0x549453(0x1c3)](a4_0x583209['dim'](_0x549453(0x18b)+_0x1f73da+':\x20'+_0x3810cc));}catch{_0x3810cc=_0x535129;}else _0x3810cc=_0x535129;}else{if(_0x57583f)try{const _0x3b8f97=JSON[_0x549453(0x1a9)](readFileSync(_0x57583f,'utf-8'));_0x3810cc=_0x3b8f97[_0x549453(0x198)],_0x163684=a4_0x3ba644[_0x549453(0x1c8)](_0x57583f),console[_0x549453(0x1c3)](a4_0x583209[_0x549453(0x1f7)]('Using\x20project:\x20'+_0x3810cc));}catch{_0x3810cc=_0x2cc794;}else _0x3810cc=_0x2cc794;}if(!_0x3810cc)return console[_0x549453(0x1c3)](a4_0x583209[_0x549453(0x21c)](_0x549453(0x1a5))),console[_0x549453(0x1c3)](_0x549453(0x1cd)),console[_0x549453(0x1c3)]('\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[_0x549453(0x1c3)](_0x549453(0x216)),console[_0x549453(0x1c3)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent'),0x1;if(_0x168330){const {data:_0x3714ea}=await withSpinner(_0x549453(0x18a)+_0x168330+_0x549453(0x205)+_0x3810cc+'\x22...',()=>_0xe45ee2['llm'][_0x549453(0x215)](_0x3810cc,_0x168330,_0xadefde,{'dryRun':_0x16f910,'force':_0x8674b9}));if(_0x16f910)return console[_0x549453(0x1c3)](a4_0x583209[_0x549453(0x21c)](_0x549453(0x1ff))),console[_0x549453(0x1c3)]('Would\x20pull\x20agent:\x20'+_0x3714ea[_0x549453(0x1cf)]),console['log'](_0x549453(0x181)+_0x3714ea[_0x549453(0x1ea)]),_0x3714ea[_0x549453(0x211)]&&(console['log']('\x0aChanges:'),console[_0x549453(0x1c3)]('─'[_0x549453(0x1b9)](0x3c)),console['log'](_0x3714ea[_0x549453(0x211)]),console[_0x549453(0x1c3)]('─'[_0x549453(0x1b9)](0x3c))),0x0;return console['log'](a4_0x583209[_0x549453(0x21a)](_0x549453(0x17e))),console[_0x549453(0x1c3)](_0x549453(0x218)+_0x3714ea['agentName']),console[_0x549453(0x1c3)]('Output:\x20'+_0x3714ea[_0x549453(0x1ea)]),console[_0x549453(0x1c3)](_0x549453(0x1d8)+(_0x3714ea['isNew']?a4_0x583209['green']('new'):_0x3714ea[_0x549453(0x1b2)]?a4_0x583209[_0x549453(0x21c)](_0x549453(0x1bd)):a4_0x583209[_0x549453(0x1ce)](_0x549453(0x1ca)))),0x0;}const _0x336262=_0x163684||_0xadefde,{data:_0x2a4411}=await withSpinner(_0x549453(0x171)+_0x3810cc+_0x549453(0x1b5),()=>_0xe45ee2[_0x549453(0x1d7)][_0x549453(0x1b0)](_0x3810cc,_0x336262,{'dryRun':!![]})),_0x2eedcc=_0x2a4411[_0x549453(0x190)]['agents'][_0x549453(0x170)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x210)][_0x549453(0x170)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x1fa)][_0x549453(0x170)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x17f)][_0x549453(0x170)]+_0x2a4411[_0x549453(0x190)]['integrations'][_0x549453(0x170)],_0x55fc9d=_0x2a4411[_0x549453(0x190)]['agents'][_0x549453(0x1bd)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x210)][_0x549453(0x1bd)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x1fa)][_0x549453(0x1bd)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x17f)][_0x549453(0x1bd)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x173)][_0x549453(0x1bd)],_0x410db9=_0x2a4411[_0x549453(0x190)]['agents'][_0x549453(0x1ca)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x210)][_0x549453(0x1ca)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x1fa)][_0x549453(0x1ca)]+_0x2a4411['counts'][_0x549453(0x17f)][_0x549453(0x1ca)]+_0x2a4411[_0x549453(0x190)][_0x549453(0x173)][_0x549453(0x1ca)];console[_0x549453(0x1c3)](_0x549453(0x1af)+_0x2a4411[_0x549453(0x1a6)]+'\x27:'),console['log']('\x20\x20'+a4_0x583209[_0x549453(0x21a)]('+\x20'+_0x2eedcc+_0x549453(0x207))+_0x549453(0x1f9)+a4_0x583209['yellow']('~\x20'+_0x55fc9d+'\x20changed')+'\x20|\x20'+a4_0x583209[_0x549453(0x1f7)]('=\x20'+_0x410db9+'\x20unchanged')),console['log'](_0x549453(0x17d)+formatCountSummary(_0x2a4411[_0x549453(0x190)][_0x549453(0x1e2)])),console['log'](_0x549453(0x1fd)+formatCountSummary(_0x2a4411[_0x549453(0x190)][_0x549453(0x210)])),console[_0x549453(0x1c3)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2a4411[_0x549453(0x190)][_0x549453(0x1fa)])),console[_0x549453(0x1c3)](_0x549453(0x1ab)+formatCountSummary(_0x2a4411[_0x549453(0x190)]['prompts'])),console['log'](_0x549453(0x1ae)+formatCountSummary(_0x2a4411[_0x549453(0x190)]['integrations'])),console[_0x549453(0x1c3)](_0x549453(0x180)+a4_0x583209[_0x549453(0x1e9)](_0x2a4411['outputDir'])),displayDiffs(_0x2a4411[_0x549453(0x1e2)],_0x2a4411['knowledgeBases'],_0x2a4411[_0x549453(0x1fa)],_0x2a4411[_0x549453(0x17f)],_0x2a4411['integrations']);if(_0x16f910)return console[_0x549453(0x1c3)](a4_0x583209['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x2eedcc===0x0&&_0x55fc9d===0x0)return console[_0x549453(0x1c3)](a4_0x583209['green'](_0x549453(0x200))),saveSessionContext({'llm_project':_0x2a4411[_0x549453(0x1a6)]},_0x3fab38[_0x549453(0x214)]),console[_0x549453(0x1c3)](a4_0x583209['green'](_0x549453(0x201)+a4_0x583209[_0x549453(0x1f7)]('llm_project')+_0x549453(0x1ad)+a4_0x583209[_0x549453(0x1e9)](_0x2a4411[_0x549453(0x1a6)]))),0x0;if(!_0x46ecfb&&!_0x8674b9){if(!isInteractive())return console[_0x549453(0x184)](a4_0x583209[_0x549453(0x17a)](_0x549453(0x1a8)),_0x549453(0x19d)),console[_0x549453(0x184)](a4_0x583209[_0x549453(0x1f7)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x12c291=await confirmKey(_0x549453(0x20a)+(_0x2eedcc+_0x55fc9d)+'\x20files?');if(!_0x12c291)return console[_0x549453(0x1c3)](a4_0x583209['yellow'](_0x549453(0x1df)),_0x549453(0x209)),0x1;}const {data:_0x5b26e7}=await withSpinner(_0x549453(0x20c),()=>_0xe45ee2['llm'][_0x549453(0x1b0)](_0x3810cc,_0x336262,{'force':_0x8674b9}));return console[_0x549453(0x1c3)](a4_0x583209['green'](_0x549453(0x1c6)+(_0x2eedcc+_0x55fc9d)+_0x549453(0x1eb)+_0x5b26e7[_0x549453(0x1de)])),saveSessionContext({'llm_project':_0x5b26e7[_0x549453(0x1a6)]},_0x3fab38[_0x549453(0x214)]),console['log'](a4_0x583209[_0x549453(0x21a)](_0x549453(0x201)+a4_0x583209[_0x549453(0x1f7)](_0x549453(0x198))+'\x20=\x20'+a4_0x583209[_0x549453(0x1e9)](_0x5b26e7['projectName']))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x3f4182(0x178);[a4_0x3f4182(0x212)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async['execute'](_0xc1e639){const _0x257f9e=a4_0x3f4182,{options:_0x2ab643,args:_0x3600ec,tdx:_0x5b85a0}=_0xc1e639,_0x4a7661=_0x3600ec[0x0],_0x3911da=_0x2ab643[_0x257f9e(0x193)],_0x4b05d8=_0x2ab643[_0x257f9e(0x19f)],_0x1b1b14=_0x2ab643[_0x257f9e(0x1d9)],_0x55e1f4=_0x2ab643[_0x257f9e(0x1f2)],_0x55ba11=_0x2ab643[_0x257f9e(0x1b3)];let _0xe05179;const _0x5c76c4=findAgentConfigPath(process[_0x257f9e(0x1c9)]());if(_0x4a7661){const _0x381a9e=a4_0x3ba644[_0x257f9e(0x175)](_0x4a7661,_0x257f9e(0x172));existsSync(_0x381a9e)?(_0xe05179=_0x4a7661,console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x1f7)](_0x257f9e(0x1a3)+_0x4a7661))):_0xe05179=_0x4a7661;}else{if(_0x5c76c4)_0xe05179=a4_0x3ba644[_0x257f9e(0x1c8)](_0x5c76c4),console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x1f7)](_0x257f9e(0x1f8)+_0xe05179));else{if(_0x55ba11){const _0x2ba0b8=sanitizeForFilesystem(_0x55ba11);let _0x460974=_0x2ba0b8,_0x17b0a9=a4_0x3ba644[_0x257f9e(0x175)](process[_0x257f9e(0x1c9)](),'agents',_0x2ba0b8,'tdx.json');if(!existsSync(_0x17b0a9)){const _0xfe9b00=normalizeName(_0x55ba11),_0x47da59=a4_0x3ba644[_0x257f9e(0x175)](process[_0x257f9e(0x1c9)](),_0x257f9e(0x1e2),_0xfe9b00,'tdx.json');existsSync(_0x47da59)&&(_0x460974=_0xfe9b00,_0x17b0a9=_0x47da59);}if(existsSync(_0x17b0a9))_0xe05179=a4_0x3ba644[_0x257f9e(0x1c8)](_0x17b0a9),console[_0x257f9e(0x1c3)](a4_0x583209['dim'](_0x257f9e(0x1a3)+_0xe05179));else{const _0x7dacfb=_0x2ab643[_0x257f9e(0x1b8)];if(_0x7dacfb)throw new SDKError(ErrorCode[_0x257f9e(0x1b7)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x55ba11+_0x257f9e(0x179),undefined,{'helpText':_0x257f9e(0x217)+_0x257f9e(0x18c)+(_0x257f9e(0x1c7)+_0x55ba11+'\x0a')+(_0x257f9e(0x1f1)+_0x460974+_0x257f9e(0x177)+(_0x3911da||'<new-name>')+_0x257f9e(0x1dc)+_0x7dacfb)});_0xe05179=_0x55ba11,console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x1f7)](_0x257f9e(0x1f4)+_0x55ba11));}}}}if(!_0xe05179)return console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x21c)](_0x257f9e(0x1fb))),console[_0x257f9e(0x1c3)](_0x257f9e(0x196)),console[_0x257f9e(0x1c3)](_0x257f9e(0x20e)),console[_0x257f9e(0x1c3)](_0x257f9e(0x1d5)),console[_0x257f9e(0x1c3)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x3911da)throw new SDKError(ErrorCode[_0x257f9e(0x21b)],_0x257f9e(0x17c),undefined,{'helpText':_0x257f9e(0x183)});if(!_0x1b1b14&&!_0x4b05d8){if(!isInteractive())return console[_0x257f9e(0x184)](a4_0x583209[_0x257f9e(0x17a)](_0x257f9e(0x1a8)),_0x257f9e(0x19d)),console[_0x257f9e(0x184)](a4_0x583209[_0x257f9e(0x1f7)](_0x257f9e(0x1cb))),0x1;const _0x53d168=await confirmKey(_0x257f9e(0x1c4)+_0xe05179+_0x257f9e(0x194)+_0x3911da+'\x22?');if(!_0x53d168)return console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x21c)](_0x257f9e(0x1df))),0x1;}const {data:_0x160a15}=await withSpinner(_0x257f9e(0x18e)+_0xe05179+_0x257f9e(0x1ac)+_0x3911da+_0x257f9e(0x1b5),()=>_0x5b85a0[_0x257f9e(0x1d7)][_0x257f9e(0x1f3)](_0xe05179,_0x3911da,{'dryRun':_0x4b05d8}));if(_0x4b05d8)return console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x21c)](_0x257f9e(0x20d))),console[_0x257f9e(0x1c3)]('Source:\x20'+_0x160a15['sourceProjectName']),console[_0x257f9e(0x1c3)](_0x257f9e(0x19e)+_0x3911da),console[_0x257f9e(0x1c3)](_0x257f9e(0x199)),console['log'](_0x257f9e(0x17d)+_0x160a15['counts'][_0x257f9e(0x1e2)]['created']),console[_0x257f9e(0x1c3)]('\x20\x20Knowledge\x20Bases:\x20'+_0x160a15[_0x257f9e(0x190)][_0x257f9e(0x210)][_0x257f9e(0x1d3)]),console['log'](_0x257f9e(0x1ab)+_0x160a15['counts'][_0x257f9e(0x17f)][_0x257f9e(0x1d3)]),0x0;const _0x2ba13a=_0x160a15[_0x257f9e(0x190)]['agents'][_0x257f9e(0x18f)]>0x0||_0x160a15['counts']['knowledgeBases'][_0x257f9e(0x18f)]>0x0||_0x160a15[_0x257f9e(0x190)]['prompts'][_0x257f9e(0x18f)]>0x0;_0x2ba13a?console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x21c)]('Project\x20cloned\x20with\x20errors')):console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x21a)](_0x257f9e(0x191)));console[_0x257f9e(0x1c3)](_0x257f9e(0x1ec)+_0x160a15[_0x257f9e(0x19a)]),console[_0x257f9e(0x1c3)](_0x257f9e(0x19e)+_0x160a15[_0x257f9e(0x1cc)]),console['log']('New\x20project\x20ID:\x20'+_0x160a15['newProjectId']),console[_0x257f9e(0x1c3)](),console['log'](_0x257f9e(0x1ef)),console[_0x257f9e(0x1c3)]('\x20\x20Agents:\x20'+formatCountSummary(_0x160a15[_0x257f9e(0x190)][_0x257f9e(0x1e2)])),console[_0x257f9e(0x1c3)](_0x257f9e(0x1fd)+formatCountSummary(_0x160a15['counts'][_0x257f9e(0x210)])),console[_0x257f9e(0x1c3)](_0x257f9e(0x1ab)+formatCountSummary(_0x160a15[_0x257f9e(0x190)][_0x257f9e(0x17f)])),console['log'](_0x257f9e(0x1ae)+formatCountSummary(_0x160a15[_0x257f9e(0x190)][_0x257f9e(0x173)]));if(_0x2ba13a){console['log'](),console['log'](a4_0x583209['red']('Errors:'));for(const _0x435502 of _0x160a15[_0x257f9e(0x1e2)]){_0x435502['action']===_0x257f9e(0x184)&&console['log'](a4_0x583209[_0x257f9e(0x17a)](_0x257f9e(0x1e6)+_0x435502[_0x257f9e(0x1cf)]+'\x22:\x20'+_0x435502[_0x257f9e(0x184)]));}for(const _0xdc50d of _0x160a15[_0x257f9e(0x210)]){_0xdc50d[_0x257f9e(0x19b)]===_0x257f9e(0x184)&&console['log'](a4_0x583209[_0x257f9e(0x17a)](_0x257f9e(0x1a0)+_0xdc50d[_0x257f9e(0x193)]+_0x257f9e(0x1c5)+_0xdc50d[_0x257f9e(0x184)]));}for(const _0x267f3f of _0x160a15['prompts']){_0x267f3f['action']===_0x257f9e(0x184)&&console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x17a)](_0x257f9e(0x1a7)+_0x267f3f[_0x257f9e(0x193)]+_0x257f9e(0x1c5)+_0x267f3f[_0x257f9e(0x184)]));}for(const _0x5933ea of _0x160a15['integrations']){_0x5933ea[_0x257f9e(0x19b)]===_0x257f9e(0x184)&&console[_0x257f9e(0x1c3)](a4_0x583209[_0x257f9e(0x17a)]('\x20\x20Integration\x20\x22'+_0x5933ea[_0x257f9e(0x193)]+_0x257f9e(0x1c5)+_0x5933ea[_0x257f9e(0x184)]));}return 0x1;}console[_0x257f9e(0x1c3)]();const _0x26b927=getLLMProjectUrl(_0x55e1f4,_0x160a15[_0x257f9e(0x19c)]);return console[_0x257f9e(0x1c3)]('Project:\x20'+a4_0x583209['cyan'](_0x26b927)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x3f4182(0x193)]=a4_0x3f4182(0x1e7);['description']=a4_0x3f4182(0x189);async[a4_0x3f4182(0x1f6)](_0x977816){const _0x39f125=a4_0x3f4182,{options:_0x43af3b,args:_0x20b255,tdx:_0x284ee7}=_0x977816;let _0x14c9bd=_0x20b255[0x0]||process['cwd']();const _0x4cdcbe=_0x43af3b['dryRun'],_0x2d2f00=_0x43af3b[_0x39f125(0x206)],_0x2bd2f5=_0x43af3b[_0x39f125(0x1d9)],_0x179a3f=_0x43af3b[_0x39f125(0x1f2)],_0x322bc0=a4_0x3ba644[_0x39f125(0x175)](_0x14c9bd,_0x39f125(0x1a1)),_0x1cec8a=existsSync(_0x322bc0);if(_0x1cec8a){const {data:_0x2ef081}=await withSpinner(_0x39f125(0x1ed)+_0x14c9bd+_0x39f125(0x1b5),()=>_0x284ee7[_0x39f125(0x1d7)]['pushAgent'](_0x14c9bd,{'dryRun':_0x4cdcbe,'force':_0x2d2f00}));if(_0x4cdcbe)return console[_0x39f125(0x1c3)](a4_0x583209[_0x39f125(0x21c)](_0x39f125(0x20d))),console[_0x39f125(0x1c3)](_0x39f125(0x1bc)+_0x2ef081[_0x39f125(0x1cf)]),0x0;if(_0x2ef081[_0x39f125(0x19b)]===_0x39f125(0x184))return console[_0x39f125(0x1c3)](a4_0x583209['red'](_0x39f125(0x192)+_0x2ef081[_0x39f125(0x184)])),0x1;console['log'](a4_0x583209[_0x39f125(0x21a)]('Agent\x20'+_0x2ef081['action']+_0x39f125(0x1bf))),console[_0x39f125(0x1c3)](_0x39f125(0x218)+_0x2ef081[_0x39f125(0x1cf)]);if(_0x2ef081[_0x39f125(0x1b6)]&&_0x2ef081[_0x39f125(0x213)]){const _0xb96004=getLLMAgentChatUrl(_0x179a3f,_0x2ef081['projectId'],_0x2ef081['agentId']);console[_0x39f125(0x1c3)](_0x39f125(0x202)+a4_0x583209[_0x39f125(0x1e9)](_0xb96004));}return 0x0;}const _0x1e608f=_0x43af3b[_0x39f125(0x1b3)],_0x5f1dd0=resolveProjectFromContext(_0x14c9bd,_0x1e608f);if(_0x5f1dd0[_0x39f125(0x1dd)])_0x14c9bd=_0x5f1dd0[_0x39f125(0x1e5)],_0x5f1dd0[_0x39f125(0x1e3)]===_0x39f125(0x1e1)&&console[_0x39f125(0x1c3)](a4_0x583209[_0x39f125(0x1f7)](_0x39f125(0x1fe)+_0x14c9bd));else{let _0x320bfe=_0x39f125(0x174);_0x5f1dd0[_0x39f125(0x1d4)]===_0x39f125(0x1d6)&&(_0x320bfe=_0x5f1dd0[_0x39f125(0x1ee)]+_0x39f125(0x1b1)+_0x5f1dd0['llmProject']+'\x27\x20to\x20create\x20the\x20folder\x20structure.');throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5f1dd0[_0x39f125(0x1d4)]==='no_context'?_0x5f1dd0[_0x39f125(0x1ee)]:_0x39f125(0x188)+_0x14c9bd,undefined,{'helpText':_0x320bfe});}const {data:_0x569174}=await withSpinner(_0x39f125(0x1da),()=>_0x284ee7[_0x39f125(0x1d7)][_0x39f125(0x1c2)](_0x14c9bd,{'dryRun':!![]})),_0x2458c4=_0x569174[_0x39f125(0x190)][_0x39f125(0x1e2)]['errors']>0x0;if(_0x2458c4){console[_0x39f125(0x1c3)](a4_0x583209[_0x39f125(0x17a)](_0x39f125(0x20b)));for(const _0x38410f of _0x569174['agents']){_0x38410f[_0x39f125(0x19b)]===_0x39f125(0x184)&&console[_0x39f125(0x1c3)](a4_0x583209[_0x39f125(0x17a)](_0x39f125(0x1e6)+_0x38410f[_0x39f125(0x1cf)]+'\x22:\x20'+_0x38410f[_0x39f125(0x184)]));}return 0x1;}const _0x1d0c14=_0x569174[_0x39f125(0x190)][_0x39f125(0x1e2)]['created']+_0x569174[_0x39f125(0x190)][_0x39f125(0x210)][_0x39f125(0x1d3)]+_0x569174[_0x39f125(0x190)][_0x39f125(0x1fa)][_0x39f125(0x1d3)]+_0x569174[_0x39f125(0x190)][_0x39f125(0x17f)][_0x39f125(0x1d3)]+_0x569174[_0x39f125(0x190)][_0x39f125(0x173)][_0x39f125(0x1d3)],_0x54f0f9=_0x569174[_0x39f125(0x190)][_0x39f125(0x1e2)]['updated']+_0x569174[_0x39f125(0x190)][_0x39f125(0x210)][_0x39f125(0x1bd)]+_0x569174[_0x39f125(0x190)][_0x39f125(0x1fa)]['updated']+_0x569174[_0x39f125(0x190)][_0x39f125(0x17f)][_0x39f125(0x1bd)]+_0x569174['counts'][_0x39f125(0x173)][_0x39f125(0x1bd)],_0x324ed9=_0x569174[_0x39f125(0x190)][_0x39f125(0x1e2)][_0x39f125(0x1ca)]+_0x569174[_0x39f125(0x190)][_0x39f125(0x210)]['unchanged']+_0x569174[_0x39f125(0x190)][_0x39f125(0x1fa)]['unchanged']+_0x569174[_0x39f125(0x190)][_0x39f125(0x17f)][_0x39f125(0x1ca)]+_0x569174[_0x39f125(0x190)]['integrations'][_0x39f125(0x1ca)];console[_0x39f125(0x1c3)](_0x39f125(0x1c0)+_0x569174['projectName']+'\x27:'),console[_0x39f125(0x1c3)]('\x20\x20'+a4_0x583209[_0x39f125(0x21a)]('+\x20'+_0x1d0c14+'\x20new')+'\x20|\x20'+a4_0x583209[_0x39f125(0x21c)]('~\x20'+_0x54f0f9+_0x39f125(0x1f5))+_0x39f125(0x1f9)+a4_0x583209['dim']('=\x20'+_0x324ed9+_0x39f125(0x1a2))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x569174[_0x39f125(0x190)][_0x39f125(0x1e2)])),console['log'](_0x39f125(0x1fd)+formatCountSummary(_0x569174[_0x39f125(0x190)][_0x39f125(0x210)])),console[_0x39f125(0x1c3)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x569174[_0x39f125(0x190)][_0x39f125(0x1fa)])),console[_0x39f125(0x1c3)](_0x39f125(0x1ab)+formatCountSummary(_0x569174[_0x39f125(0x190)]['prompts'])),console[_0x39f125(0x1c3)](_0x39f125(0x1ae)+formatCountSummary(_0x569174[_0x39f125(0x190)]['integrations'])),console[_0x39f125(0x1c3)](_0x39f125(0x204)+a4_0x583209['cyan'](_0x14c9bd)),displayDiffs(_0x569174[_0x39f125(0x1e2)],_0x569174[_0x39f125(0x210)],_0x569174[_0x39f125(0x1fa)],_0x569174['prompts'],_0x569174[_0x39f125(0x173)]);if(_0x4cdcbe)return console['log'](a4_0x583209['yellow']('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x1d0c14===0x0&&_0x54f0f9===0x0){console[_0x39f125(0x1c3)](a4_0x583209['green'](_0x39f125(0x197)));const _0x3a650e=getLLMProjectUrl(_0x179a3f,_0x569174[_0x39f125(0x213)]);return console[_0x39f125(0x1c3)](_0x39f125(0x1a4)+a4_0x583209[_0x39f125(0x1e9)](_0x3a650e)),0x0;}if(!_0x2bd2f5&&!_0x2d2f00){if(!isInteractive())return console[_0x39f125(0x184)](a4_0x583209[_0x39f125(0x17a)](_0x39f125(0x1a8)),_0x39f125(0x19d)),console[_0x39f125(0x184)](a4_0x583209[_0x39f125(0x1f7)](_0x39f125(0x1cb))),0x1;const _0x3b376f=await confirmKey('\x0aPush\x20'+(_0x1d0c14+_0x54f0f9)+_0x39f125(0x203));if(!_0x3b376f)return console['log'](a4_0x583209[_0x39f125(0x21c)](_0x39f125(0x1df)),'-\x20nothing\x20pushed'),0x1;}const {data:_0x368421}=await withSpinner('Pushing\x20to\x20project...',()=>_0x284ee7[_0x39f125(0x1d7)][_0x39f125(0x1c2)](_0x14c9bd,{'force':_0x2d2f00})),_0x12bbaa=_0x368421[_0x39f125(0x190)]['agents'][_0x39f125(0x18f)]>0x0||_0x368421['counts'][_0x39f125(0x210)]['errors']>0x0||_0x368421['counts'][_0x39f125(0x1fa)][_0x39f125(0x18f)]>0x0||_0x368421[_0x39f125(0x190)][_0x39f125(0x17f)][_0x39f125(0x18f)]>0x0;if(_0x12bbaa){console['log'](a4_0x583209[_0x39f125(0x21c)](_0x39f125(0x17b))),console[_0x39f125(0x1c3)](),console[_0x39f125(0x1c3)](a4_0x583209['red'](_0x39f125(0x1d2)));for(const _0x437ef6 of _0x368421[_0x39f125(0x1e2)]){_0x437ef6[_0x39f125(0x19b)]===_0x39f125(0x184)&&console[_0x39f125(0x1c3)](a4_0x583209[_0x39f125(0x17a)](_0x39f125(0x1e6)+_0x437ef6[_0x39f125(0x1cf)]+_0x39f125(0x1c5)+_0x437ef6[_0x39f125(0x184)]));}for(const _0x3c1991 of _0x368421['knowledgeBases']){_0x3c1991[_0x39f125(0x19b)]===_0x39f125(0x184)&&console[_0x39f125(0x1c3)](a4_0x583209[_0x39f125(0x17a)](_0x39f125(0x1a0)+_0x3c1991['name']+_0x39f125(0x1c5)+_0x3c1991['error']));}for(const _0x1492e0 of _0x368421['textKnowledgeBases']){_0x1492e0[_0x39f125(0x19b)]===_0x39f125(0x184)&&console[_0x39f125(0x1c3)](a4_0x583209['red'](_0x39f125(0x1fc)+_0x1492e0['name']+_0x39f125(0x1c5)+_0x1492e0[_0x39f125(0x184)]));}for(const _0x472490 of _0x368421['prompts']){_0x472490[_0x39f125(0x19b)]===_0x39f125(0x184)&&console['log'](a4_0x583209[_0x39f125(0x17a)](_0x39f125(0x1a7)+_0x472490['name']+_0x39f125(0x1c5)+_0x472490[_0x39f125(0x184)]));}for(const _0x38aca0 of _0x368421['integrations']){_0x38aca0[_0x39f125(0x19b)]===_0x39f125(0x184)&&console[_0x39f125(0x1c3)](a4_0x583209['red'](_0x39f125(0x1be)+_0x38aca0['name']+_0x39f125(0x1c5)+_0x38aca0[_0x39f125(0x184)]));}return 0x1;}console['log'](a4_0x583209[_0x39f125(0x21a)]('\x0a✔\x20Pushed\x20'+(_0x1d0c14+_0x54f0f9)+_0x39f125(0x176)+_0x368421[_0x39f125(0x1a6)]+'\x27'));const _0x49c733=getLLMProjectUrl(_0x179a3f,_0x368421[_0x39f125(0x213)]);return console[_0x39f125(0x1c3)](_0x39f125(0x1a4)+a4_0x583209['cyan'](_0x49c733)),0x0;}}
1
+ const a4_0x375987=a4_0x41b7;(function(_0x21c67e,_0x4aaa6f){const _0x7f748e=a4_0x41b7,_0x204923=_0x21c67e();while(!![]){try{const _0x1c55bc=-parseInt(_0x7f748e(0x1c6))/0x1+-parseInt(_0x7f748e(0x1cc))/0x2+parseInt(_0x7f748e(0x1b9))/0x3*(parseInt(_0x7f748e(0x175))/0x4)+parseInt(_0x7f748e(0x148))/0x5+-parseInt(_0x7f748e(0x162))/0x6*(parseInt(_0x7f748e(0x190))/0x7)+-parseInt(_0x7f748e(0x176))/0x8*(-parseInt(_0x7f748e(0x154))/0x9)+parseInt(_0x7f748e(0x1ac))/0xa;if(_0x1c55bc===_0x4aaa6f)break;else _0x204923['push'](_0x204923['shift']());}catch(_0x187011){_0x204923['push'](_0x204923['shift']());}}}(a4_0x1c61,0x9b118));import a4_0x61008e from'chalk';import a4_0xb953b7 from'path';function a4_0x41b7(_0x15e7b6,_0x14740a){_0x15e7b6=_0x15e7b6-0x13d;const _0x1c6158=a4_0x1c61();let _0x41b775=_0x1c6158[_0x15e7b6];return _0x41b775;}import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a4_0x1c61(){const _0x5c2f50=['\x20successfully','description','Analyzing\x20changes\x20to\x20push...','new','9hVQVKH','\x20\x20Integrations:\x20','agentName','\x0aPush\x20','\x0aErrors\x20found:','\x0aPull\x20summary\x20for\x20\x27','action','\x0aChanges\x20to\x20agent\x20\x27','agents','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','agent:push','\x22\x20to\x20a\x20different\x20profile','\x27\x20to\x20create\x20the\x20folder\x20structure.','83728IrVrNf','updated','\x22\x20from\x20project\x20\x22','parse','✔\x20Context\x20set:\x20','\x20\x20Knowledge\x20Base\x20\x22','2433228thlJIi','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','Errors:','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','\x20resources\x20to\x20\x27','created','sourceProjectName','unchanged','Cloning\x20\x22','Output\x20path:\x20','\x20\x20tdx\x20agent\x20pull\x20','yes','knowledgeBases','name','Analyzing\x20project\x20\x22','Source:\x20','force','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x20unchanged','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20\x20Text\x20Knowledge\x20Bases:\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','Pushing\x20agent\x20from\x20\x22','Output:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','site','dirname','\x0aWrite\x20','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','Using\x20current\x20project:\x20','\x20\x20Source:\x20','outputDir','Failed\x20to\x20push\x20agent:\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','agent:clone','total','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','1550555WDCnAH','log','\x22...','agentId','Would\x20clone:','error','llm','Pushing\x20to\x20project...','\x0aChanges\x20to\x20integration\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','-\x20nothing\x20pushed','\x20\x20Text\x20Knowledge\x20Base\x20\x22','6856353DDaahh','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','cwd','projectId','red','profile','session','cyan','\x20|\x20','\x20\x20Prompts:\x20','execute','Agent\x20','hasChanges','\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','18zgVrLU','Status:\x20','agent.yml','repeat','\x20total','\x22:\x20','push','MISSING_ARGUMENT','context','green','Agent\x20pulled\x20successfully','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','Using\x20project:\x20','message','source','utf-8','dim','diff','New\x20project\x20name\x20is\x20required','838876CDabxL','8mNoDWF','Cancelled','no_local_folder','pushProject','Would\x20push\x20agent:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','errors','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','newProjectName','counts','No\x20tdx.json\x20found\x20in\x20','\x20\x20Agent\x20\x22','Agent:\x20','yellow','projectName','llmProject','\x20--profile\x20','\x0aError:','llm_project','\x20files?','Using\x20local\x20project:\x20','integrations','-\x20no\x20files\x20written','join','Chat:\x20','101745IDEvoL','New\x20project:\x20','reason','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','New\x20project\x20ID:\x20','\x20\x20Prompt\x20\x22','\x20\x20Agents:\x20','textKnowledgeBases','\x22\x20to\x20\x22','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','cloneProject','outputPath','\x20=\x20','newProjectId','\x20changed','projectDir','pullProject','\x20\x20Knowledge\x20Bases:\x20','\x22\x20to\x20new\x20project\x20\x22','\x0aChanges\x20to\x20prompt\x20\x27','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','dryRun','\x20updated','\x0aChanges:','tdx.json','Dry\x20run\x20-\x20no\x20changes\x20made','Pulling\x20agent\x20\x22','2780220qHTqFa','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)','prompts','INVALID_ARGUMENT','output','Project:\x20','\x20new','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Using\x20context\x20project:\x20'];a4_0x1c61=function(){return _0x5c2f50;};return a4_0x1c61();}import{withSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}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(_0x10222a){const _0x498975=a4_0x41b7,_0x15d376=[];if(_0x10222a[_0x498975(0x146)]!==undefined)_0x15d376[_0x498975(0x168)](_0x10222a[_0x498975(0x146)]+_0x498975(0x166));if(_0x10222a['new']!==undefined&&_0x10222a[_0x498975(0x1b8)]>0x0)_0x15d376[_0x498975(0x168)](a4_0x61008e[_0x498975(0x16b)](_0x10222a[_0x498975(0x1b8)]+_0x498975(0x1b2)));if(_0x10222a[_0x498975(0x1d1)]!==undefined&&_0x10222a[_0x498975(0x1d1)]>0x0)_0x15d376[_0x498975(0x168)](a4_0x61008e['green'](_0x10222a[_0x498975(0x1d1)]+'\x20created'));if(_0x10222a['updated']!==undefined&&_0x10222a[_0x498975(0x1c7)]>0x0)_0x15d376[_0x498975(0x168)](a4_0x61008e[_0x498975(0x184)](_0x10222a[_0x498975(0x1c7)]+_0x498975(0x1a7)));if(_0x10222a[_0x498975(0x1d3)]!==undefined&&_0x10222a[_0x498975(0x1d3)]>0x0)_0x15d376[_0x498975(0x168)](a4_0x61008e['gray'](_0x10222a[_0x498975(0x1d3)]+_0x498975(0x1de)));if(_0x10222a['errors']!==undefined&&_0x10222a[_0x498975(0x17d)]>0x0)_0x15d376[_0x498975(0x168)](a4_0x61008e['red'](_0x10222a[_0x498975(0x17d)]+'\x20errors'));return _0x15d376['join'](',\x20');}function displayDiffs(_0x34ab92,_0x3f74cb,_0x3ccc6d,_0x4b6d05,_0x5e2571=[]){const _0x425002=a4_0x41b7;for(const _0xd2719 of _0x34ab92){if(_0xd2719['diff']){const _0x1ee5a6=_0xd2719[_0x425002(0x1bb)]||_0xd2719[_0x425002(0x1d9)];console[_0x425002(0x149)](_0x425002(0x1c0)+_0x1ee5a6+'\x27:'),console['log']('─'[_0x425002(0x165)](0x3c)),console['log'](_0xd2719[_0x425002(0x173)]),console[_0x425002(0x149)]('─'[_0x425002(0x165)](0x3c));}}for(const _0x53072b of _0x3f74cb){_0x53072b[_0x425002(0x173)]&&(console['log'](_0x425002(0x1df)+_0x53072b['name']+'\x27:'),console[_0x425002(0x149)]('─'[_0x425002(0x165)](0x3c)),console['log'](_0x53072b[_0x425002(0x173)]),console[_0x425002(0x149)]('─'[_0x425002(0x165)](0x3c)));}for(const _0x5f2563 of _0x3ccc6d){_0x5f2563[_0x425002(0x173)]&&(console[_0x425002(0x149)]('\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27'+_0x5f2563[_0x425002(0x1d9)]+'\x27:'),console['log']('─'[_0x425002(0x165)](0x3c)),console['log'](_0x5f2563['diff']),console[_0x425002(0x149)]('─'[_0x425002(0x165)](0x3c)));}for(const _0x5387db of _0x4b6d05){_0x5387db['diff']&&(console[_0x425002(0x149)](_0x425002(0x1a4)+_0x5387db['name']+'\x27:'),console[_0x425002(0x149)]('─'['repeat'](0x3c)),console['log'](_0x5387db[_0x425002(0x173)]),console[_0x425002(0x149)]('─'['repeat'](0x3c)));}for(const _0x1421b1 of _0x5e2571){_0x1421b1[_0x425002(0x173)]&&(console[_0x425002(0x149)](_0x425002(0x150)+_0x1421b1[_0x425002(0x1d9)]+'\x27:'),console[_0x425002(0x149)]('─'[_0x425002(0x165)](0x3c)),console[_0x425002(0x149)](_0x1421b1['diff']),console['log']('─'[_0x425002(0x165)](0x3c)));}}export class AgentPullCommand extends BaseCommand{['name']='agent:pull';[a4_0x375987(0x1b6)]=a4_0x375987(0x1e1);async['execute'](_0x36be66){const _0x3b4155=a4_0x375987,{options:_0x5af639,args:_0x2b2f81,tdx:_0x4d60e0}=_0x36be66,_0x394bc1=_0x2b2f81[0x0],_0x17d45d=_0x2b2f81[0x1],_0x342c75=_0x5af639[_0x3b4155(0x1b0)],_0x21b598=_0x5af639[_0x3b4155(0x1a6)],_0x111a60=_0x5af639[_0x3b4155(0x1dc)],_0x4ed390=_0x5af639['yes'],_0x5b26fd=_0x5af639[_0x3b4155(0x186)];let _0x3fd404,_0x3766bc;const _0x5a132b=findAgentConfigPath(process[_0x3b4155(0x156)]());if(_0x394bc1){const _0x15d45b=a4_0xb953b7['join'](_0x394bc1,'tdx.json');if(existsSync(_0x15d45b))try{const _0x34bae2=JSON[_0x3b4155(0x1c9)](readFileSync(_0x15d45b,_0x3b4155(0x171)));_0x3fd404=_0x34bae2[_0x3b4155(0x189)],_0x3766bc=_0x394bc1,console['log'](a4_0x61008e[_0x3b4155(0x172)]('Using\x20project\x20from\x20'+_0x15d45b+':\x20'+_0x3fd404));}catch{_0x3fd404=_0x394bc1;}else _0x3fd404=_0x394bc1;}else{if(_0x5a132b)try{const _0x567ca2=JSON[_0x3b4155(0x1c9)](readFileSync(_0x5a132b,_0x3b4155(0x171)));_0x3fd404=_0x567ca2[_0x3b4155(0x189)],_0x3766bc=a4_0xb953b7[_0x3b4155(0x13d)](_0x5a132b),console[_0x3b4155(0x149)](a4_0x61008e[_0x3b4155(0x172)](_0x3b4155(0x16e)+_0x3fd404));}catch{_0x3fd404=_0x5b26fd;}else _0x3fd404=_0x5b26fd;}if(!_0x3fd404)return console['log'](a4_0x61008e[_0x3b4155(0x184)](_0x3b4155(0x17c))),console[_0x3b4155(0x149)](_0x3b4155(0x1ad)),console[_0x3b4155(0x149)](_0x3b4155(0x161)),console['log'](_0x3b4155(0x194)),console['log']('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent'),0x1;if(_0x17d45d){const {data:_0x131c98}=await withSpinner(_0x3b4155(0x1ab)+_0x17d45d+_0x3b4155(0x1c8)+_0x3fd404+_0x3b4155(0x14a),()=>_0x4d60e0[_0x3b4155(0x14e)]['pullAgent'](_0x3fd404,_0x17d45d,_0x342c75,{'dryRun':_0x21b598,'force':_0x111a60}));if(_0x21b598)return console['log'](a4_0x61008e[_0x3b4155(0x184)]('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0x3b4155(0x149)]('Would\x20pull\x20agent:\x20'+_0x131c98[_0x3b4155(0x1bb)]),console[_0x3b4155(0x149)](_0x3b4155(0x1d5)+_0x131c98[_0x3b4155(0x19c)]),_0x131c98[_0x3b4155(0x173)]&&(console[_0x3b4155(0x149)](_0x3b4155(0x1a8)),console[_0x3b4155(0x149)]('─'[_0x3b4155(0x165)](0x3c)),console[_0x3b4155(0x149)](_0x131c98[_0x3b4155(0x173)]),console[_0x3b4155(0x149)]('─'['repeat'](0x3c))),0x0;return console[_0x3b4155(0x149)](a4_0x61008e[_0x3b4155(0x16b)](_0x3b4155(0x16c))),console[_0x3b4155(0x149)]('Agent:\x20'+_0x131c98['agentName']),console[_0x3b4155(0x149)](_0x3b4155(0x1e3)+_0x131c98[_0x3b4155(0x19c)]),console[_0x3b4155(0x149)](_0x3b4155(0x163)+(_0x131c98['isNew']?a4_0x61008e['green'](_0x3b4155(0x1b8)):_0x131c98[_0x3b4155(0x160)]?a4_0x61008e['yellow'](_0x3b4155(0x1c7)):a4_0x61008e['gray'](_0x3b4155(0x1d3)))),0x0;}const _0x47d0a4=_0x3766bc||_0x342c75,{data:_0x90664a}=await withSpinner(_0x3b4155(0x1da)+_0x3fd404+_0x3b4155(0x14a),()=>_0x4d60e0[_0x3b4155(0x14e)]['pullProject'](_0x3fd404,_0x47d0a4,{'dryRun':!![]})),_0x59e8a0=_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1c1)][_0x3b4155(0x1b8)]+_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1d8)]['new']+_0x90664a[_0x3b4155(0x180)]['textKnowledgeBases']['new']+_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1ae)][_0x3b4155(0x1b8)]+_0x90664a['counts'][_0x3b4155(0x18c)][_0x3b4155(0x1b8)],_0x429659=_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1c1)][_0x3b4155(0x1c7)]+_0x90664a[_0x3b4155(0x180)]['knowledgeBases']['updated']+_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x198)][_0x3b4155(0x1c7)]+_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1ae)][_0x3b4155(0x1c7)]+_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x18c)]['updated'],_0xc24b51=_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1c1)][_0x3b4155(0x1d3)]+_0x90664a['counts']['knowledgeBases'][_0x3b4155(0x1d3)]+_0x90664a['counts']['textKnowledgeBases']['unchanged']+_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1ae)][_0x3b4155(0x1d3)]+_0x90664a[_0x3b4155(0x180)]['integrations'][_0x3b4155(0x1d3)];console['log'](_0x3b4155(0x1be)+_0x90664a[_0x3b4155(0x185)]+'\x27:'),console[_0x3b4155(0x149)]('\x20\x20'+a4_0x61008e[_0x3b4155(0x16b)]('+\x20'+_0x59e8a0+_0x3b4155(0x1b2))+'\x20|\x20'+a4_0x61008e[_0x3b4155(0x184)]('~\x20'+_0x429659+_0x3b4155(0x19f))+_0x3b4155(0x15c)+a4_0x61008e[_0x3b4155(0x172)]('=\x20'+_0xc24b51+_0x3b4155(0x1de))),console[_0x3b4155(0x149)](_0x3b4155(0x197)+formatCountSummary(_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1c1)])),console[_0x3b4155(0x149)](_0x3b4155(0x1a2)+formatCountSummary(_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x1d8)])),console[_0x3b4155(0x149)](_0x3b4155(0x1e0)+formatCountSummary(_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x198)])),console[_0x3b4155(0x149)](_0x3b4155(0x15d)+formatCountSummary(_0x90664a[_0x3b4155(0x180)]['prompts'])),console['log']('\x20\x20Integrations:\x20'+formatCountSummary(_0x90664a[_0x3b4155(0x180)][_0x3b4155(0x18c)])),console[_0x3b4155(0x149)]('\x20\x20Target:\x20'+a4_0x61008e[_0x3b4155(0x15b)](_0x90664a[_0x3b4155(0x142)])),displayDiffs(_0x90664a[_0x3b4155(0x1c1)],_0x90664a[_0x3b4155(0x1d8)],_0x90664a[_0x3b4155(0x198)],_0x90664a['prompts'],_0x90664a[_0x3b4155(0x18c)]);if(_0x21b598)return console[_0x3b4155(0x149)](a4_0x61008e[_0x3b4155(0x184)](_0x3b4155(0x147))),0x0;if(_0x59e8a0===0x0&&_0x429659===0x0)return console[_0x3b4155(0x149)](a4_0x61008e[_0x3b4155(0x16b)](_0x3b4155(0x1e4))),saveSessionContext({'llm_project':_0x90664a['projectName']},_0x5af639[_0x3b4155(0x15a)]),console['log'](a4_0x61008e[_0x3b4155(0x16b)](_0x3b4155(0x1ca)+a4_0x61008e[_0x3b4155(0x172)](_0x3b4155(0x189))+_0x3b4155(0x19d)+a4_0x61008e['cyan'](_0x90664a[_0x3b4155(0x185)]))),0x0;if(!_0x4ed390&&!_0x111a60){if(!isInteractive())return console[_0x3b4155(0x14d)](a4_0x61008e[_0x3b4155(0x158)](_0x3b4155(0x188)),_0x3b4155(0x151)),console[_0x3b4155(0x14d)](a4_0x61008e[_0x3b4155(0x172)](_0x3b4155(0x1c2))),0x1;const _0x44893b=await confirmKey(_0x3b4155(0x13e)+(_0x59e8a0+_0x429659)+_0x3b4155(0x18a));if(!_0x44893b)return console[_0x3b4155(0x149)](a4_0x61008e['yellow']('Cancelled'),_0x3b4155(0x18d)),0x1;}const {data:_0x99963d}=await withSpinner('Writing\x20files...',()=>_0x4d60e0['llm'][_0x3b4155(0x1a1)](_0x3fd404,_0x47d0a4,{'force':_0x111a60}));return console['log'](a4_0x61008e['green']('\x0a✔\x20Pulled\x20'+(_0x59e8a0+_0x429659)+'\x20files\x20to\x20'+_0x99963d[_0x3b4155(0x142)])),saveSessionContext({'llm_project':_0x99963d[_0x3b4155(0x185)]},_0x5af639[_0x3b4155(0x15a)]),console[_0x3b4155(0x149)](a4_0x61008e[_0x3b4155(0x16b)](_0x3b4155(0x1ca)+a4_0x61008e['dim'](_0x3b4155(0x189))+_0x3b4155(0x19d)+a4_0x61008e[_0x3b4155(0x15b)](_0x99963d[_0x3b4155(0x185)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x375987(0x1d9)]=a4_0x375987(0x145);[a4_0x375987(0x1b6)]=a4_0x375987(0x13f);async[a4_0x375987(0x15e)](_0x31affe){const _0x3f0ff0=a4_0x375987,{options:_0x49da38,args:_0x5f4d12,tdx:_0x22d0fd}=_0x31affe,_0x136f9=_0x5f4d12[0x0],_0x1a1d76=_0x49da38[_0x3f0ff0(0x1d9)],_0x2e0ba7=_0x49da38['dryRun'],_0x2b91b8=_0x49da38['yes'],_0x10a1d9=_0x49da38[_0x3f0ff0(0x1e5)],_0x292d3f=_0x49da38[_0x3f0ff0(0x186)];let _0x22770d;const _0x288ee5=findAgentConfigPath(process[_0x3f0ff0(0x156)]());if(_0x136f9){const _0x475d4d=a4_0xb953b7[_0x3f0ff0(0x18e)](_0x136f9,'tdx.json');existsSync(_0x475d4d)?(_0x22770d=_0x136f9,console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x172)](_0x3f0ff0(0x18b)+_0x136f9))):_0x22770d=_0x136f9;}else{if(_0x288ee5)_0x22770d=a4_0xb953b7[_0x3f0ff0(0x13d)](_0x288ee5),console['log'](a4_0x61008e[_0x3f0ff0(0x172)](_0x3f0ff0(0x140)+_0x22770d));else{if(_0x292d3f){const _0x4feaa9=sanitizeForFilesystem(_0x292d3f);let _0x349d3=_0x4feaa9,_0x52bbe1=a4_0xb953b7['join'](process['cwd'](),'agents',_0x4feaa9,'tdx.json');if(!existsSync(_0x52bbe1)){const _0x5aec01=normalizeName(_0x292d3f),_0x464970=a4_0xb953b7[_0x3f0ff0(0x18e)](process[_0x3f0ff0(0x156)](),_0x3f0ff0(0x1c1),_0x5aec01,_0x3f0ff0(0x1a9));existsSync(_0x464970)&&(_0x349d3=_0x5aec01,_0x52bbe1=_0x464970);}if(existsSync(_0x52bbe1))_0x22770d=a4_0xb953b7[_0x3f0ff0(0x13d)](_0x52bbe1),console['log'](a4_0x61008e[_0x3f0ff0(0x172)](_0x3f0ff0(0x18b)+_0x22770d));else{const _0x6b2deb=_0x49da38[_0x3f0ff0(0x159)];if(_0x6b2deb)throw new SDKError(ErrorCode[_0x3f0ff0(0x1af)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x292d3f+_0x3f0ff0(0x1c4),undefined,{'helpText':_0x3f0ff0(0x155)+_0x3f0ff0(0x16d)+(_0x3f0ff0(0x1d6)+_0x292d3f+'\x0a')+(_0x3f0ff0(0x144)+_0x349d3+'\x20--name\x20'+(_0x1a1d76||'<new-name>')+_0x3f0ff0(0x187)+_0x6b2deb)});_0x22770d=_0x292d3f,console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x172)](_0x3f0ff0(0x1b4)+_0x292d3f));}}}}if(!_0x22770d)return console['log'](a4_0x61008e[_0x3f0ff0(0x184)](_0x3f0ff0(0x17b))),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x1cd)),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x1b3)),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x1a5)),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x17e)),0x1;if(!_0x1a1d76)throw new SDKError(ErrorCode[_0x3f0ff0(0x169)],_0x3f0ff0(0x174),undefined,{'helpText':_0x3f0ff0(0x1dd)});if(!_0x2b91b8&&!_0x2e0ba7){if(!isInteractive())return console[_0x3f0ff0(0x14d)](a4_0x61008e[_0x3f0ff0(0x158)](_0x3f0ff0(0x188)),_0x3f0ff0(0x151)),console[_0x3f0ff0(0x14d)](a4_0x61008e[_0x3f0ff0(0x172)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x54e53a=await confirmKey('Clone\x20\x22'+_0x22770d+_0x3f0ff0(0x1a3)+_0x1a1d76+'\x22?');if(!_0x54e53a)return console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x184)]('Cancelled')),0x1;}const {data:_0x65a4f8}=await withSpinner(_0x3f0ff0(0x1d4)+_0x22770d+_0x3f0ff0(0x199)+_0x1a1d76+_0x3f0ff0(0x14a),()=>_0x22d0fd[_0x3f0ff0(0x14e)][_0x3f0ff0(0x19b)](_0x22770d,_0x1a1d76,{'dryRun':_0x2e0ba7}));if(_0x2e0ba7)return console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x184)](_0x3f0ff0(0x1aa))),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x1db)+_0x65a4f8['sourceProjectName']),console['log'](_0x3f0ff0(0x191)+_0x1a1d76),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x14c)),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x197)+_0x65a4f8[_0x3f0ff0(0x180)]['agents'][_0x3f0ff0(0x1d1)]),console['log'](_0x3f0ff0(0x1a2)+_0x65a4f8[_0x3f0ff0(0x180)][_0x3f0ff0(0x1d8)]['created']),console['log'](_0x3f0ff0(0x15d)+_0x65a4f8['counts'][_0x3f0ff0(0x1ae)][_0x3f0ff0(0x1d1)]),0x0;const _0x1c6fc4=_0x65a4f8[_0x3f0ff0(0x180)][_0x3f0ff0(0x1c1)][_0x3f0ff0(0x17d)]>0x0||_0x65a4f8[_0x3f0ff0(0x180)][_0x3f0ff0(0x1d8)]['errors']>0x0||_0x65a4f8['counts'][_0x3f0ff0(0x1ae)][_0x3f0ff0(0x17d)]>0x0;_0x1c6fc4?console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x184)]('Project\x20cloned\x20with\x20errors')):console[_0x3f0ff0(0x149)](a4_0x61008e['green']('Project\x20cloned\x20successfully'));console['log'](_0x3f0ff0(0x1db)+_0x65a4f8[_0x3f0ff0(0x1d2)]),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x191)+_0x65a4f8[_0x3f0ff0(0x17f)]),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x195)+_0x65a4f8['newProjectId']),console[_0x3f0ff0(0x149)](),console[_0x3f0ff0(0x149)]('Summary:'),console['log'](_0x3f0ff0(0x197)+formatCountSummary(_0x65a4f8[_0x3f0ff0(0x180)][_0x3f0ff0(0x1c1)])),console['log'](_0x3f0ff0(0x1a2)+formatCountSummary(_0x65a4f8[_0x3f0ff0(0x180)][_0x3f0ff0(0x1d8)])),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x15d)+formatCountSummary(_0x65a4f8[_0x3f0ff0(0x180)][_0x3f0ff0(0x1ae)])),console[_0x3f0ff0(0x149)](_0x3f0ff0(0x1ba)+formatCountSummary(_0x65a4f8['counts'][_0x3f0ff0(0x18c)]));if(_0x1c6fc4){console[_0x3f0ff0(0x149)](),console['log'](a4_0x61008e[_0x3f0ff0(0x158)](_0x3f0ff0(0x1ce)));for(const _0x537b5c of _0x65a4f8[_0x3f0ff0(0x1c1)]){_0x537b5c[_0x3f0ff0(0x1bf)]===_0x3f0ff0(0x14d)&&console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x158)](_0x3f0ff0(0x182)+_0x537b5c[_0x3f0ff0(0x1bb)]+'\x22:\x20'+_0x537b5c[_0x3f0ff0(0x14d)]));}for(const _0x1c0044 of _0x65a4f8['knowledgeBases']){_0x1c0044[_0x3f0ff0(0x1bf)]===_0x3f0ff0(0x14d)&&console['log'](a4_0x61008e[_0x3f0ff0(0x158)](_0x3f0ff0(0x1cb)+_0x1c0044[_0x3f0ff0(0x1d9)]+_0x3f0ff0(0x167)+_0x1c0044[_0x3f0ff0(0x14d)]));}for(const _0x5c63dc of _0x65a4f8[_0x3f0ff0(0x1ae)]){_0x5c63dc[_0x3f0ff0(0x1bf)]===_0x3f0ff0(0x14d)&&console['log'](a4_0x61008e[_0x3f0ff0(0x158)](_0x3f0ff0(0x196)+_0x5c63dc[_0x3f0ff0(0x1d9)]+_0x3f0ff0(0x167)+_0x5c63dc[_0x3f0ff0(0x14d)]));}for(const _0x4cd372 of _0x65a4f8[_0x3f0ff0(0x18c)]){_0x4cd372[_0x3f0ff0(0x1bf)]===_0x3f0ff0(0x14d)&&console[_0x3f0ff0(0x149)](a4_0x61008e[_0x3f0ff0(0x158)]('\x20\x20Integration\x20\x22'+_0x4cd372['name']+'\x22:\x20'+_0x4cd372[_0x3f0ff0(0x14d)]));}return 0x1;}console[_0x3f0ff0(0x149)]();const _0x5d8d7d=getLLMProjectUrl(_0x10a1d9,_0x65a4f8[_0x3f0ff0(0x19e)]);return console[_0x3f0ff0(0x149)](_0x3f0ff0(0x1b1)+a4_0x61008e[_0x3f0ff0(0x15b)](_0x5d8d7d)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x375987(0x1c3);[a4_0x375987(0x1b6)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async['execute'](_0x319833){const _0x5e937e=a4_0x375987,{options:_0x323601,args:_0x37811e,tdx:_0x4f57d0}=_0x319833;let _0x1783a2=_0x37811e[0x0]||process[_0x5e937e(0x156)]();const _0x1f350e=_0x323601[_0x5e937e(0x1a6)],_0x89cfd2=_0x323601['force'],_0xb34f37=_0x323601[_0x5e937e(0x1d7)],_0x24d651=_0x323601[_0x5e937e(0x1e5)],_0x2fc9e5=a4_0xb953b7[_0x5e937e(0x18e)](_0x1783a2,_0x5e937e(0x164)),_0xfef90b=existsSync(_0x2fc9e5);if(_0xfef90b){const {data:_0x5bf263}=await withSpinner(_0x5e937e(0x1e2)+_0x1783a2+_0x5e937e(0x14a),()=>_0x4f57d0[_0x5e937e(0x14e)]['pushAgent'](_0x1783a2,{'dryRun':_0x1f350e,'force':_0x89cfd2}));if(_0x1f350e)return console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x184)](_0x5e937e(0x1aa))),console[_0x5e937e(0x149)](_0x5e937e(0x17a)+_0x5bf263[_0x5e937e(0x1bb)]),0x0;if(_0x5bf263[_0x5e937e(0x1bf)]===_0x5e937e(0x14d))return console[_0x5e937e(0x149)](a4_0x61008e['red'](_0x5e937e(0x143)+_0x5bf263['error'])),0x1;console['log'](a4_0x61008e['green'](_0x5e937e(0x15f)+_0x5bf263['action']+_0x5e937e(0x1b5))),console[_0x5e937e(0x149)](_0x5e937e(0x183)+_0x5bf263[_0x5e937e(0x1bb)]);if(_0x5bf263[_0x5e937e(0x14b)]&&_0x5bf263[_0x5e937e(0x157)]){const _0x487227=getLLMAgentChatUrl(_0x24d651,_0x5bf263[_0x5e937e(0x157)],_0x5bf263['agentId']);console[_0x5e937e(0x149)](_0x5e937e(0x18f)+a4_0x61008e[_0x5e937e(0x15b)](_0x487227));}return 0x0;}const _0x2e1364=_0x323601[_0x5e937e(0x186)],_0x56dd13=resolveProjectFromContext(_0x1783a2,_0x2e1364);if(_0x56dd13['found'])_0x1783a2=_0x56dd13[_0x5e937e(0x1a0)],_0x56dd13[_0x5e937e(0x170)]===_0x5e937e(0x16a)&&console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x172)]('Using\x20project:\x20'+_0x1783a2));else{let _0x1c10c7=_0x5e937e(0x193);_0x56dd13[_0x5e937e(0x192)]===_0x5e937e(0x178)&&(_0x1c10c7=_0x56dd13[_0x5e937e(0x16f)]+_0x5e937e(0x1cf)+_0x56dd13[_0x5e937e(0x186)]+_0x5e937e(0x1c5));throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x56dd13[_0x5e937e(0x192)]==='no_context'?_0x56dd13['message']:_0x5e937e(0x181)+_0x1783a2,undefined,{'helpText':_0x1c10c7});}const {data:_0x4a05a2}=await withSpinner(_0x5e937e(0x1b7),()=>_0x4f57d0[_0x5e937e(0x14e)]['pushProject'](_0x1783a2,{'dryRun':!![]})),_0x440e48=_0x4a05a2['counts'][_0x5e937e(0x1c1)][_0x5e937e(0x17d)]>0x0;if(_0x440e48){console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x158)](_0x5e937e(0x1bd)));for(const _0x5a50bd of _0x4a05a2[_0x5e937e(0x1c1)]){_0x5a50bd[_0x5e937e(0x1bf)]==='error'&&console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x158)](_0x5e937e(0x182)+_0x5a50bd['agentName']+_0x5e937e(0x167)+_0x5a50bd[_0x5e937e(0x14d)]));}return 0x1;}const _0x10b4a5=_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1c1)][_0x5e937e(0x1d1)]+_0x4a05a2['counts'][_0x5e937e(0x1d8)][_0x5e937e(0x1d1)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x198)][_0x5e937e(0x1d1)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1ae)][_0x5e937e(0x1d1)]+_0x4a05a2['counts'][_0x5e937e(0x18c)][_0x5e937e(0x1d1)],_0xef6e2b=_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1c1)][_0x5e937e(0x1c7)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1d8)][_0x5e937e(0x1c7)]+_0x4a05a2[_0x5e937e(0x180)]['textKnowledgeBases'][_0x5e937e(0x1c7)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1ae)][_0x5e937e(0x1c7)]+_0x4a05a2[_0x5e937e(0x180)]['integrations']['updated'],_0xa29e7a=_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1c1)][_0x5e937e(0x1d3)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1d8)][_0x5e937e(0x1d3)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x198)][_0x5e937e(0x1d3)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1ae)][_0x5e937e(0x1d3)]+_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x18c)][_0x5e937e(0x1d3)];console[_0x5e937e(0x149)]('\x0aPush\x20summary\x20for\x20\x27'+_0x4a05a2[_0x5e937e(0x185)]+'\x27:'),console['log']('\x20\x20'+a4_0x61008e[_0x5e937e(0x16b)]('+\x20'+_0x10b4a5+_0x5e937e(0x1b2))+_0x5e937e(0x15c)+a4_0x61008e[_0x5e937e(0x184)]('~\x20'+_0xef6e2b+_0x5e937e(0x19f))+_0x5e937e(0x15c)+a4_0x61008e[_0x5e937e(0x172)]('=\x20'+_0xa29e7a+_0x5e937e(0x1de))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x4a05a2[_0x5e937e(0x180)][_0x5e937e(0x1c1)])),console[_0x5e937e(0x149)](_0x5e937e(0x1a2)+formatCountSummary(_0x4a05a2[_0x5e937e(0x180)]['knowledgeBases'])),console[_0x5e937e(0x149)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x4a05a2[_0x5e937e(0x180)]['textKnowledgeBases'])),console[_0x5e937e(0x149)](_0x5e937e(0x15d)+formatCountSummary(_0x4a05a2['counts']['prompts'])),console[_0x5e937e(0x149)](_0x5e937e(0x1ba)+formatCountSummary(_0x4a05a2['counts'][_0x5e937e(0x18c)])),console['log'](_0x5e937e(0x141)+a4_0x61008e[_0x5e937e(0x15b)](_0x1783a2)),displayDiffs(_0x4a05a2['agents'],_0x4a05a2[_0x5e937e(0x1d8)],_0x4a05a2[_0x5e937e(0x198)],_0x4a05a2[_0x5e937e(0x1ae)],_0x4a05a2[_0x5e937e(0x18c)]);if(_0x1f350e)return console['log'](a4_0x61008e[_0x5e937e(0x184)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x10b4a5===0x0&&_0xef6e2b===0x0){console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x16b)](_0x5e937e(0x19a)));const _0x985669=getLLMProjectUrl(_0x24d651,_0x4a05a2[_0x5e937e(0x157)]);return console['log'](_0x5e937e(0x1b1)+a4_0x61008e[_0x5e937e(0x15b)](_0x985669)),0x0;}if(!_0xb34f37&&!_0x89cfd2){if(!isInteractive())return console[_0x5e937e(0x14d)](a4_0x61008e[_0x5e937e(0x158)]('\x0aError:'),_0x5e937e(0x151)),console['error'](a4_0x61008e['dim'](_0x5e937e(0x1c2))),0x1;const _0x3f160f=await confirmKey(_0x5e937e(0x1bc)+(_0x10b4a5+_0xef6e2b)+'\x20resources?');if(!_0x3f160f)return console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x184)](_0x5e937e(0x177)),_0x5e937e(0x152)),0x1;}const {data:_0x2d1627}=await withSpinner(_0x5e937e(0x14f),()=>_0x4f57d0[_0x5e937e(0x14e)][_0x5e937e(0x179)](_0x1783a2,{'force':_0x89cfd2})),_0x25be7f=_0x2d1627[_0x5e937e(0x180)][_0x5e937e(0x1c1)][_0x5e937e(0x17d)]>0x0||_0x2d1627[_0x5e937e(0x180)]['knowledgeBases']['errors']>0x0||_0x2d1627[_0x5e937e(0x180)][_0x5e937e(0x198)][_0x5e937e(0x17d)]>0x0||_0x2d1627['counts'][_0x5e937e(0x1ae)]['errors']>0x0;if(_0x25be7f){console['log'](a4_0x61008e[_0x5e937e(0x184)]('\x0aProject\x20pushed\x20with\x20errors')),console['log'](),console['log'](a4_0x61008e[_0x5e937e(0x158)](_0x5e937e(0x1ce)));for(const _0xfbf198 of _0x2d1627['agents']){_0xfbf198[_0x5e937e(0x1bf)]===_0x5e937e(0x14d)&&console[_0x5e937e(0x149)](a4_0x61008e['red']('\x20\x20Agent\x20\x22'+_0xfbf198[_0x5e937e(0x1bb)]+_0x5e937e(0x167)+_0xfbf198[_0x5e937e(0x14d)]));}for(const _0x3f31c8 of _0x2d1627[_0x5e937e(0x1d8)]){_0x3f31c8['action']===_0x5e937e(0x14d)&&console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x158)](_0x5e937e(0x1cb)+_0x3f31c8[_0x5e937e(0x1d9)]+_0x5e937e(0x167)+_0x3f31c8[_0x5e937e(0x14d)]));}for(const _0x34a98c of _0x2d1627['textKnowledgeBases']){_0x34a98c[_0x5e937e(0x1bf)]===_0x5e937e(0x14d)&&console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x158)](_0x5e937e(0x153)+_0x34a98c[_0x5e937e(0x1d9)]+_0x5e937e(0x167)+_0x34a98c[_0x5e937e(0x14d)]));}for(const _0xce0024 of _0x2d1627[_0x5e937e(0x1ae)]){_0xce0024[_0x5e937e(0x1bf)]==='error'&&console[_0x5e937e(0x149)](a4_0x61008e[_0x5e937e(0x158)](_0x5e937e(0x196)+_0xce0024['name']+_0x5e937e(0x167)+_0xce0024['error']));}for(const _0x3b2043 of _0x2d1627[_0x5e937e(0x18c)]){_0x3b2043['action']===_0x5e937e(0x14d)&&console[_0x5e937e(0x149)](a4_0x61008e['red']('\x20\x20Integration\x20\x22'+_0x3b2043[_0x5e937e(0x1d9)]+_0x5e937e(0x167)+_0x3b2043['error']));}return 0x1;}console['log'](a4_0x61008e[_0x5e937e(0x16b)]('\x0a✔\x20Pushed\x20'+(_0x10b4a5+_0xef6e2b)+_0x5e937e(0x1d0)+_0x2d1627[_0x5e937e(0x185)]+'\x27'));const _0x1bfacf=getLLMProjectUrl(_0x24d651,_0x2d1627[_0x5e937e(0x157)]);return console[_0x5e937e(0x149)](_0x5e937e(0x1b1)+a4_0x61008e[_0x5e937e(0x15b)](_0x1bfacf)),0x0;}}
@@ -1 +1 @@
1
- const a5_0xea0d6f=a5_0x19f4;function a5_0xfcc8(){const _0x2886ef=['Failed:\x20\x20\x20','no_tests','join','some','rounds','15823290HVOauB','Project\x20path:\x20','Agent:\x20','size','log','llmProject','start','Evaluating\x20response...','5705682DVKKEx','executeReeval','Run\x20\x27tdx\x20agent\x20pull\x20','projectName','testYmlPath','✗\x20FAIL:\x20','tags','\x20\x20Site:\x20','site','Test\x20Summary','\x20\x20Conversation:\x20','writeFileSync','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','Errors:\x20\x20\x20','agent:test','now','tsv','9061595xWqmBO','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','text','\x20\x20Project:\x20','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','json','\x27\x20to\x20create\x20the\x20folder\x20structure.','Available\x20tags:\x20','694CEKYVY','includes','12222909VoIUYI','Error:\x20No\x20previous\x20test\x20run\x20found.','not\x20found','✓\x20PASS:\x20','No\x20tests\x20have\x20tags\x20defined.','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','table','Output\x20written\x20to:\x20','toLowerCase','green','eval','3350312TfMsvn','source','verbose','agentName','4PgHvXW',':\x20Sending\x20user\x20input...','No\x20tests\x20found\x20with\x20tags:\x20','isSpinning','testName','dim','execute','...\x20','find','Usage:','Cached\x20run\x20from:\x20','Tests\x20found:\x20','white','Round\x201/','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','reason','resolveAgentId','no_context','\x22,\x20but\x20current\x20site\x20is\x20\x22','/<agent-name>','dryRun','Re-evaluating...','Run\x20tests\x20for\x20an\x20LLM\x20agent','✗\x20ERROR:\x20','round','push','name','yellow','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','cyan','Re-evaluation\x20Summary','tests','ERROR','output','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','\x20-\x20','\x20\x20Agent:\x20','reeval','✗\x20ERROR:\x20Project\x20not\x20found:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','conversations','existsSync','resolveProjectId','Duration:\x20','agentDirs','Executing\x20new\x20tests...','description','message','test.yml','Test\x20','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','timestamp','...','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','length','projectDir','trim','Running:\x20','\x22:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','No\x20tests\x20found\x20matching:\x20','context','utf-8','Error\x20writing\x20output\x20file:\x20','\x20\x20Round\x20','has','11091BRYeWz','map','Total:\x20\x20\x20\x20','jsonl','status','toISOString','filter','\x20\x20-\x20','forEach','11wDFNca','red','split','conversation_url','resolve','Using\x20agent:\x20','stop','\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)','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','agent','PASS','Running\x20test:\x20','Test\x20Configuration:','Passed:\x20\x20\x20','\x20(cached)','repeat','8PujpSj','276383xRrviT','FAIL','llm','Failed\x20Tests:'];a5_0xfcc8=function(){return _0x2886ef;};return a5_0xfcc8();}(function(_0x5907ee,_0x1a1ea3){const _0x2aacb7=a5_0x19f4,_0x4dd10b=_0x5907ee();while(!![]){try{const _0x144d95=-parseInt(_0x2aacb7(0xa2))/0x1+parseInt(_0x2aacb7(0xcc))/0x2*(-parseInt(_0x2aacb7(0x11f))/0x3)+-parseInt(_0x2aacb7(0xdd))/0x4*(-parseInt(_0x2aacb7(0xc4))/0x5)+parseInt(_0x2aacb7(0xb3))/0x6+-parseInt(_0x2aacb7(0xd9))/0x7+parseInt(_0x2aacb7(0xa1))/0x8*(-parseInt(_0x2aacb7(0xce))/0x9)+-parseInt(_0x2aacb7(0xab))/0xa*(-parseInt(_0x2aacb7(0x91))/0xb);if(_0x144d95===_0x1a1ea3)break;else _0x4dd10b['push'](_0x4dd10b['shift']());}catch(_0x13a872){_0x4dd10b['push'](_0x4dd10b['shift']());}}}(a5_0xfcc8,0xe7d84));import*as a5_0x4b344f from'node:fs';import*as a5_0x5261cd from'node:path';import a5_0x1043b6 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';function a5_0x19f4(_0x679fe7,_0x145ca6){_0x679fe7=_0x679fe7-0x8f;const _0xfcc82=a5_0xfcc8();let _0x19f446=_0xfcc82[_0x679fe7];return _0x19f446;}import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{['name']=a5_0xea0d6f(0xc1);[a5_0xea0d6f(0x10b)]=a5_0xea0d6f(0xf3);async[a5_0xea0d6f(0xe3)](_0x3025e0){const _0x10bed6=a5_0xea0d6f,{options:_0x470169,args:_0x340da8,tdx:_0x36380c}=_0x3025e0,_0x2473e3=_0x340da8[0x0]||'.',_0x3a9219=_0x470169[_0x10bed6(0xf1)],_0x11baa0=_0x470169,_0x16da1e=_0x11baa0[_0x10bed6(0xd8)]===![],_0x343e14=_0x11baa0[_0x10bed6(0x102)],_0x51639e=_0x11baa0[_0x10bed6(0xf7)],_0x5e3051=_0x11baa0[_0x10bed6(0xb9)],_0x38bc5b=_0x470169[_0x10bed6(0xbb)],_0x38eb35=_0x11baa0[_0x10bed6(0xfe)];if(_0x343e14&&_0x16da1e)return console['log'](a5_0x1043b6[_0x10bed6(0x92)]('Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval')),0x1;let _0x39412a=_0x10bed6(0xd4);if(_0x11baa0[_0x10bed6(0xc9)])_0x39412a='json';else{if(_0x11baa0[_0x10bed6(0x122)])_0x39412a=_0x10bed6(0x122);else{if(_0x11baa0[_0x10bed6(0xc3)])_0x39412a=_0x10bed6(0xc3);else{if(_0x11baa0['table'])_0x39412a=_0x10bed6(0xd4);}}}const _0x5742f8=_0x11baa0[_0x10bed6(0xb0)];let _0x5a22c5=_0x2473e3;const _0x17a77=a5_0x4b344f[_0x10bed6(0x106)](_0x2473e3),_0x998bc8=_0x2473e3==='.';if(!_0x17a77||_0x998bc8){const _0x19048c=resolveProjectFromContext(_0x2473e3,_0x5742f8,{'requireFile':_0x10bed6(0x10d)});if(_0x19048c['found'])_0x5a22c5=_0x19048c[_0x10bed6(0x114)],_0x19048c[_0x10bed6(0xda)]===_0x10bed6(0x11a)&&console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0xe2)](_0x10bed6(0x96)+_0x5a22c5));else switch(_0x19048c['reason']){case _0x10bed6(0xee):console[_0x10bed6(0xaf)](a5_0x1043b6['yellow'](_0x19048c['message'])),console[_0x10bed6(0xaf)](),console[_0x10bed6(0xaf)](_0x10bed6(0xe6)),console[_0x10bed6(0xaf)]('\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[_0x10bed6(0xaf)](_0x10bed6(0x98)),console[_0x10bed6(0xaf)](),console[_0x10bed6(0xaf)](_0x10bed6(0x99));return 0x1;case'no_local_folder':console['log'](a5_0x1043b6['yellow'](_0x19048c[_0x10bed6(0x10c)])),console[_0x10bed6(0xaf)](),console[_0x10bed6(0xaf)](_0x10bed6(0xb5)+_0x19048c[_0x10bed6(0xb0)]+_0x10bed6(0xca));return 0x1;case'multiple_agents':{const _0x403339=a5_0x5261cd['basename'](_0x19048c[_0x10bed6(0x114)]);console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0xf8)](_0x10bed6(0xf9)+_0x19048c[_0x10bed6(0xb0)]+'\x22:'));for(const _0x3e1279 of _0x19048c[_0x10bed6(0x109)]){console[_0x10bed6(0xaf)](_0x10bed6(0x8f)+_0x3e1279);}return console[_0x10bed6(0xaf)](),console['log'](_0x10bed6(0xd3)+_0x403339+_0x10bed6(0xf0)),0x1;}case _0x10bed6(0xa7):console['log'](a5_0x1043b6[_0x10bed6(0xf8)]('No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22'+_0x19048c[_0x10bed6(0xb0)]+'\x22.')),console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0xe2)](_0x10bed6(0xac)+_0x19048c[_0x10bed6(0x114)])),console['log'](),console[_0x10bed6(0xaf)](_0x10bed6(0x112));return 0x1;}}const {definition:_0x51ffa2,agentInfo:_0x390df7}=parseTestFile(_0x5a22c5);let _0x21486f=_0x51ffa2[_0x10bed6(0xfc)];if(_0x51639e){const _0x1a2a22=_0x51639e[_0x10bed6(0x93)](',')[_0x10bed6(0x120)](_0x5dfa04=>_0x5dfa04[_0x10bed6(0x115)]());_0x21486f=_0x51ffa2['tests'][_0x10bed6(0x125)](_0x47f7d0=>_0x1a2a22[_0x10bed6(0xcd)](_0x47f7d0[_0x10bed6(0xf7)]));if(_0x21486f[_0x10bed6(0x113)]===0x0)return console['log'](a5_0x1043b6[_0x10bed6(0xf8)](_0x10bed6(0x119)+_0x51639e)),console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0xe2)]('Available\x20tests:\x20'+_0x51ffa2['tests'][_0x10bed6(0x120)](_0x2e7b73=>_0x2e7b73[_0x10bed6(0xf7)])['join'](',\x20'))),0x1;}if(_0x5e3051){const _0x947329=_0x5e3051[_0x10bed6(0x93)](',')[_0x10bed6(0x120)](_0x131a22=>_0x131a22[_0x10bed6(0x115)]()[_0x10bed6(0xd6)]());_0x21486f=_0x21486f['filter'](_0x180232=>_0x180232[_0x10bed6(0xb9)]?.[_0x10bed6(0xa9)](_0x221b94=>_0x947329['includes'](_0x221b94[_0x10bed6(0xd6)]())));if(_0x21486f[_0x10bed6(0x113)]===0x0){console['log'](a5_0x1043b6[_0x10bed6(0xf8)](_0x10bed6(0xdf)+_0x5e3051));const _0xce7512=new Set();return _0x51ffa2[_0x10bed6(0xfc)]['forEach'](_0x23f1d7=>_0x23f1d7[_0x10bed6(0xb9)]?.[_0x10bed6(0x90)](_0x3fe81d=>_0xce7512['add'](_0x3fe81d))),_0xce7512[_0x10bed6(0xae)]>0x0?console[_0x10bed6(0xaf)](a5_0x1043b6['dim'](_0x10bed6(0xcb)+[..._0xce7512][_0x10bed6(0xa8)](',\x20'))):console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0xe2)](_0x10bed6(0xd2))),0x1;}}if(_0x343e14)return this[_0x10bed6(0xb4)](_0x3025e0,{'definition':{'tests':_0x21486f},'agentInfo':_0x390df7,'outputFormat':_0x39412a,'outputFile':_0x38eb35,'testNames':_0x51639e});if(_0x3a9219){console['log'](a5_0x1043b6[_0x10bed6(0xfa)](_0x10bed6(0x9d))),console['log'](_0x10bed6(0xba)+a5_0x1043b6[_0x10bed6(0xe9)](_0x38bc5b)),console[_0x10bed6(0xaf)](_0x10bed6(0xc7)+a5_0x1043b6[_0x10bed6(0xe9)](_0x390df7['projectName'])),console[_0x10bed6(0xaf)](_0x10bed6(0x101)+a5_0x1043b6[_0x10bed6(0xe9)](_0x390df7[_0x10bed6(0xdc)])),console['log'](),console['log'](_0x10bed6(0xe8)+a5_0x1043b6[_0x10bed6(0xe9)](_0x21486f[_0x10bed6(0x113)]));for(let _0x22f610=0x0;_0x22f610<_0x21486f[_0x10bed6(0x113)];_0x22f610++){const _0x4396fd=_0x21486f[_0x22f610],_0x317be2=_0x4396fd[_0x10bed6(0xaa)][_0x10bed6(0x113)]===0x1?_0x10bed6(0xf5):'rounds',_0x41c788=_0x4396fd[_0x10bed6(0xb9)]?.[_0x10bed6(0x113)]?'\x20['+_0x4396fd['tags'][_0x10bed6(0xa8)](',\x20')+']':'';console[_0x10bed6(0xaf)]('\x20\x20'+(_0x22f610+0x1)+'.\x20'+a5_0x1043b6['white'](_0x4396fd[_0x10bed6(0xf7)])+'\x20('+_0x4396fd[_0x10bed6(0xaa)]['length']+'\x20'+_0x317be2+')'+a5_0x1043b6['dim'](_0x41c788));}return 0x0;}let _0x3e1515,_0x112d57;try{_0x3e1515=await _0x36380c[_0x10bed6(0xa4)][_0x10bed6(0x107)](_0x390df7['projectName']);}catch(_0x4e0e3c){const _0x233f1d=_0x4e0e3c instanceof Error?_0x4e0e3c[_0x10bed6(0x10c)]:String(_0x4e0e3c);return _0x233f1d[_0x10bed6(0xcd)]('404')||_0x233f1d[_0x10bed6(0xd6)]()[_0x10bed6(0xcd)](_0x10bed6(0xd0))?console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0x103)+_0x390df7[_0x10bed6(0xb6)])):console[_0x10bed6(0xaf)](a5_0x1043b6['red'](_0x10bed6(0x118)+_0x390df7[_0x10bed6(0xb6)]+_0x10bed6(0x117)+_0x233f1d)),0x1;}try{_0x112d57=await _0x36380c[_0x10bed6(0xa4)][_0x10bed6(0xed)](_0x390df7['agentName'],_0x3e1515);}catch(_0x21b610){const _0x3c2507=_0x21b610 instanceof Error?_0x21b610[_0x10bed6(0x10c)]:String(_0x21b610);return _0x3c2507[_0x10bed6(0xcd)]('404')||_0x3c2507[_0x10bed6(0xd6)]()['includes'](_0x10bed6(0xd0))?console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0xeb)+_0x390df7[_0x10bed6(0xdc)])):console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0x104)+_0x390df7['agentName']+_0x10bed6(0x117)+_0x3c2507)),0x1;}let _0x111215;if(!_0x16da1e)try{_0x111215=await setupEvaluatorAgent(_0x36380c[_0x10bed6(0xa4)],_0x470169[_0x10bed6(0xdb)]);}catch(_0xda5ffc){const _0x1ebc84=_0xda5ffc instanceof Error?_0xda5ffc[_0x10bed6(0x10c)]:String(_0xda5ffc);return console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0x10f)+_0x1ebc84)),0x1;}console['log'](a5_0x1043b6[_0x10bed6(0xfa)]('Running\x20agent\x20tests...')),console[_0x10bed6(0xaf)]('Site:\x20'+a5_0x1043b6[_0x10bed6(0xe9)](_0x38bc5b)),console[_0x10bed6(0xaf)](_0x10bed6(0xad)+a5_0x1043b6[_0x10bed6(0xe9)](_0x390df7['projectName']+'/'+_0x390df7[_0x10bed6(0xdc)])),console[_0x10bed6(0xaf)]();const _0x45187c=[],_0x1075c6=[],_0x813f3e=Date[_0x10bed6(0xc2)]();for(let _0x43c358=0x0;_0x43c358<_0x21486f[_0x10bed6(0x113)];_0x43c358++){const _0x3802bf=_0x21486f[_0x43c358];_0x21486f[_0x10bed6(0x113)]>0x1?console['log'](_0x10bed6(0x10e)+(_0x43c358+0x1)+'/'+_0x21486f[_0x10bed6(0x113)]+':\x20'+a5_0x1043b6[_0x10bed6(0xe9)](_0x3802bf[_0x10bed6(0xf7)])):console[_0x10bed6(0xaf)](_0x10bed6(0x9c)+a5_0x1043b6[_0x10bed6(0xe9)](_0x3802bf['name']));const _0x5e4c3b=createCommandSpinner(_0x10bed6(0xea)+_0x3802bf[_0x10bed6(0xaa)][_0x10bed6(0x113)]+_0x10bed6(0xde));_0x5e4c3b[_0x10bed6(0xb1)]();try{const {result:_0x24fc3c,conversation:_0x2047b1}=await runTest(_0x36380c[_0x10bed6(0xa4)],_0x3802bf,{'agentId':_0x112d57,'projectId':_0x3e1515,'site':_0x38bc5b,'noEval':_0x16da1e,'evaluatorId':_0x111215,'onRoundStart':(_0x470747,_0x345be7)=>{const _0x4c323f=_0x10bed6;_0x5e4c3b[_0x4c323f(0xc6)]='Round\x20'+(_0x470747+0x1)+'/'+_0x345be7+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x583725,_0x18ae24,_0x3c55e3)=>{const _0x3f2e18=_0x10bed6,_0x4aa9bf=formatElapsed(_0x18ae24);_0x3c55e3?console[_0x3f2e18(0xaf)]('\x20\x20Round\x20'+(_0x583725+0x1)+'/'+_0x3802bf[_0x3f2e18(0xaa)][_0x3f2e18(0x113)]+_0x3f2e18(0xe4)+a5_0x1043b6[_0x3f2e18(0xd7)]('✓')+'\x20('+_0x4aa9bf+')'):console[_0x3f2e18(0xaf)]('\x20\x20Round\x20'+(_0x583725+0x1)+'/'+_0x3802bf[_0x3f2e18(0xaa)][_0x3f2e18(0x113)]+_0x3f2e18(0xe4)+a5_0x1043b6[_0x3f2e18(0x92)]('✗'));},'onEvaluationStart':()=>{const _0xce0028=_0x10bed6;_0x5e4c3b[_0xce0028(0xc6)]=_0xce0028(0xb2);},'onEvaluationComplete':_0x122d76=>{const _0x4917d5=_0x10bed6,_0x3970d2=formatElapsed(_0x122d76);console[_0x4917d5(0xaf)]('\x20\x20Evaluating...\x20'+a5_0x1043b6[_0x4917d5(0xd7)]('✓')+'\x20('+_0x3970d2+')');}});_0x5e4c3b['stop'](),_0x45187c[_0x10bed6(0xf6)](_0x24fc3c),_0x1075c6[_0x10bed6(0xf6)](_0x2047b1);if(_0x24fc3c['status']===_0x10bed6(0x9b))console[_0x10bed6(0xaf)](a5_0x1043b6['green'](_0x10bed6(0xd1)+_0x24fc3c[_0x10bed6(0xec)]));else _0x24fc3c[_0x10bed6(0x123)]===_0x10bed6(0xa3)?console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0xb8)+_0x24fc3c[_0x10bed6(0xec)])):console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0xf4)+_0x24fc3c[_0x10bed6(0xec)]));_0x24fc3c[_0x10bed6(0x94)]&&console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0xe2)]('Conversation\x20URL:\x20'+_0x24fc3c[_0x10bed6(0x94)])),console[_0x10bed6(0xaf)]();}catch(_0x6cfd96){_0x5e4c3b[_0x10bed6(0x97)]();const _0x5bce3a=_0x6cfd96 instanceof Error?_0x6cfd96[_0x10bed6(0x10c)]:String(_0x6cfd96);console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)](_0x10bed6(0xf4)+_0x5bce3a)),console[_0x10bed6(0xaf)](),_0x45187c[_0x10bed6(0xf6)]({'name':_0x3802bf[_0x10bed6(0xf7)],'status':_0x10bed6(0xfd),'reason':_0x5bce3a,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}const _0x54c7e2=Date[_0x10bed6(0xc2)]()-_0x813f3e,_0x1c677c=_0x45187c[_0x10bed6(0x125)](_0x4e9c11=>_0x4e9c11[_0x10bed6(0x123)]===_0x10bed6(0x9b))['length'],_0x5ee8e4=_0x45187c[_0x10bed6(0x125)](_0x21c51d=>_0x21c51d[_0x10bed6(0x123)]===_0x10bed6(0xa3))['length'],_0x587784=_0x45187c['filter'](_0x34e67d=>_0x34e67d[_0x10bed6(0x123)]==='ERROR')['length'];console[_0x10bed6(0xaf)]('━'[_0x10bed6(0xa0)](0x3c)),console[_0x10bed6(0xaf)](_0x10bed6(0xbc)),console[_0x10bed6(0xaf)]('━'[_0x10bed6(0xa0)](0x3c)),console['log'](_0x10bed6(0x121)+_0x45187c['length']),console[_0x10bed6(0xaf)](_0x10bed6(0x9e)+a5_0x1043b6[_0x10bed6(0xd7)](_0x1c677c)),console[_0x10bed6(0xaf)](_0x10bed6(0xa6)+a5_0x1043b6['red'](_0x5ee8e4));_0x587784>0x0&&console[_0x10bed6(0xaf)]('Errors:\x20\x20\x20'+a5_0x1043b6['red'](_0x587784));console['log'](_0x10bed6(0x108)+formatElapsed(_0x54c7e2)),console[_0x10bed6(0xaf)]('━'[_0x10bed6(0xa0)](0x3c));const _0x19cef3=_0x45187c[_0x10bed6(0x125)](_0x1e9a43=>_0x1e9a43[_0x10bed6(0x123)]!==_0x10bed6(0x9b));if(_0x19cef3[_0x10bed6(0x113)]>0x0){console[_0x10bed6(0xaf)](),console[_0x10bed6(0xaf)](_0x10bed6(0xa5));for(const _0xb5b77d of _0x19cef3){const _0xb035c9=a5_0x1043b6[_0x10bed6(0x92)]('✗'),_0x1838a8=_0xb5b77d[_0x10bed6(0xec)][_0x10bed6(0x113)]>0x32?_0xb5b77d[_0x10bed6(0xec)]['substring'](0x0,0x32)+_0x10bed6(0x111):_0xb5b77d[_0x10bed6(0xec)];console[_0x10bed6(0xaf)]('\x20\x20'+_0xb035c9+'\x20'+_0xb5b77d[_0x10bed6(0xf7)]+':\x20'+_0x1838a8);}}const _0x1093d5={'summary':{'total':_0x45187c['length'],'passed':_0x1c677c,'failed':_0x5ee8e4,'errors':_0x587784>0x0?_0x587784:undefined,'duration_ms':_0x54c7e2},'tests':_0x45187c,'agent':{'project':_0x390df7['projectName'],'name':_0x390df7['agentName'],'site':_0x38bc5b},'timestamp':new Date(_0x813f3e)['toISOString']()};try{const _0x4d2d72=buildCachedTestRun(_0x1075c6,{'site':_0x38bc5b,'projectId':_0x3e1515,'projectName':_0x390df7[_0x10bed6(0xb6)],'agentId':_0x112d57,'agentName':_0x390df7['agentName'],'testYmlPath':a5_0x5261cd[_0x10bed6(0x95)](_0x390df7[_0x10bed6(0xb7)])});saveLastTestRun(_0x4d2d72);}catch{}if(_0x39412a!==_0x10bed6(0xd4)||_0x38eb35){const _0x4e2e22=formatResults(_0x1093d5,_0x39412a);if(_0x38eb35)try{a5_0x4b344f[_0x10bed6(0xbe)](_0x38eb35,_0x4e2e22,_0x10bed6(0x11b)),console[_0x10bed6(0xaf)](),console['log'](a5_0x1043b6['dim'](_0x10bed6(0xd5)+_0x38eb35));}catch(_0xd55535){return console[_0x10bed6(0xaf)](),console[_0x10bed6(0xaf)](a5_0x1043b6[_0x10bed6(0x92)]('Error\x20writing\x20output\x20file:\x20'+_0xd55535)),0x1;}else console['log'](),console[_0x10bed6(0xaf)](_0x4e2e22);}return _0x19cef3[_0x10bed6(0x113)]>0x0?0x1:0x0;}async[a5_0xea0d6f(0xb4)](_0x17e1b3,_0x472cf9){const _0x20e0f3=a5_0xea0d6f,{options:_0x4f6d2e,tdx:_0x52e005}=_0x17e1b3,{definition:_0x3922fb,agentInfo:_0x5f4193,outputFormat:_0xa85fdf,outputFile:_0x1bc602}=_0x472cf9,_0x2fef40=_0x4f6d2e[_0x20e0f3(0xbb)],_0x156b35=loadLastTestRun();if(!_0x156b35)return console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)](_0x20e0f3(0xcf))),console['log'](a5_0x1043b6[_0x20e0f3(0xe2)]('Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.')),0x1;if(_0x156b35[_0x20e0f3(0x9a)][_0x20e0f3(0xdc)]!==_0x5f4193[_0x20e0f3(0xdc)])return console[_0x20e0f3(0xaf)](a5_0x1043b6['red']('Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22'+_0x156b35['agent'][_0x20e0f3(0xdc)]+_0x20e0f3(0xc5)+_0x5f4193[_0x20e0f3(0xdc)]+'\x22.')),console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0xe2)]('Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.')),0x1;const _0x2d1967=new Set(_0x156b35[_0x20e0f3(0x105)][_0x20e0f3(0x120)](_0x48e28f=>_0x48e28f[_0x20e0f3(0xe1)])),_0x34ef13=_0x3922fb[_0x20e0f3(0xfc)][_0x20e0f3(0x125)](_0x22cec4=>!_0x2d1967[_0x20e0f3(0x11e)](_0x22cec4[_0x20e0f3(0xf7)]));if(_0x34ef13[_0x20e0f3(0x113)]>0x0&&_0x156b35[_0x20e0f3(0xbb)]!==_0x2fef40)return console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)](_0x20e0f3(0xff))),console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0xe2)]('Cached\x20run\x20is\x20from\x20site\x20\x22'+_0x156b35[_0x20e0f3(0xbb)]+_0x20e0f3(0xef)+_0x2fef40+'\x22.')),console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0xe2)]('Either\x20switch\x20to\x20the\x20\x22'+_0x156b35[_0x20e0f3(0xbb)]+_0x20e0f3(0xc8))),0x1;const _0x1aee3c=_0x3922fb[_0x20e0f3(0xfc)][_0x20e0f3(0x125)](_0x23349b=>_0x2d1967[_0x20e0f3(0x11e)](_0x23349b['name'])),_0x3ab7ba=_0x34ef13;let _0xfd332f;try{_0xfd332f=await setupEvaluatorAgent(_0x52e005[_0x20e0f3(0xa4)],_0x4f6d2e[_0x20e0f3(0xdb)]);}catch(_0xb6f47a){const _0x5c4bf3=_0xb6f47a instanceof Error?_0xb6f47a['message']:String(_0xb6f47a);return console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x5c4bf3)),0x1;}console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0xfa)]('Re-evaluating\x20cached\x20test\x20run...')),console[_0x20e0f3(0xaf)](_0x20e0f3(0xe7)+a5_0x1043b6['white'](_0x156b35[_0x20e0f3(0x110)])),console['log']('Agent:\x20'+a5_0x1043b6[_0x20e0f3(0xe9)](_0x156b35[_0x20e0f3(0x9a)][_0x20e0f3(0xb6)]+'/'+_0x156b35['agent'][_0x20e0f3(0xdc)]));_0x3ab7ba[_0x20e0f3(0x113)]>0x0&&console[_0x20e0f3(0xaf)]('New\x20tests\x20to\x20execute:\x20'+a5_0x1043b6['yellow'](_0x3ab7ba['length']));console[_0x20e0f3(0xaf)]();const _0x13425a=[],_0xc6ff72=Date[_0x20e0f3(0xc2)](),_0x5e8596=createCommandSpinner(_0x20e0f3(0xf2));if(_0x1aee3c[_0x20e0f3(0x113)]>0x0)try{const _0x52d5ca=await reevaluateFromCache(_0x52e005[_0x20e0f3(0xa4)],_0x156b35,{'tests':_0x1aee3c},{'evaluatorId':_0xfd332f,'onTestStart':(_0x2872e8,_0x228bbd,_0x5b2b4f)=>{const _0x1d0c01=_0x20e0f3;_0x5e8596[_0x1d0c01(0xc6)]='Re-evaluating\x20'+(_0x228bbd+0x1)+'/'+_0x5b2b4f+':\x20'+_0x2872e8+_0x1d0c01(0x111);if(!_0x5e8596[_0x1d0c01(0xe0)])_0x5e8596[_0x1d0c01(0xb1)]();},'onTestComplete':(_0x5094e7,_0x29f0b3)=>{const _0x2f5b87=_0x20e0f3;_0x5e8596['stop']();if(_0x29f0b3[_0x2f5b87(0x123)]===_0x2f5b87(0x9b))console[_0x2f5b87(0xaf)](a5_0x1043b6[_0x2f5b87(0xd7)](_0x2f5b87(0xd1)+_0x5094e7)+a5_0x1043b6['dim']('\x20(cached)'));else _0x29f0b3[_0x2f5b87(0x123)]===_0x2f5b87(0xa3)?console[_0x2f5b87(0xaf)](a5_0x1043b6['red'](_0x2f5b87(0xb8)+_0x5094e7+_0x2f5b87(0x100)+_0x29f0b3[_0x2f5b87(0xec)])+a5_0x1043b6[_0x2f5b87(0xe2)](_0x2f5b87(0x9f))):console[_0x2f5b87(0xaf)](a5_0x1043b6[_0x2f5b87(0x92)](_0x2f5b87(0xf4)+_0x5094e7+_0x2f5b87(0x100)+_0x29f0b3[_0x2f5b87(0xec)]));_0x29f0b3[_0x2f5b87(0x94)]&&console[_0x2f5b87(0xaf)](a5_0x1043b6[_0x2f5b87(0xe2)](_0x2f5b87(0xbd)+_0x29f0b3[_0x2f5b87(0x94)])),_0x13425a['push'](_0x29f0b3);},'onTestSkipped':(_0x14cd24,_0x1e6efa)=>{const _0x1c8fea=_0x20e0f3;_0x5e8596['stop'](),console[_0x1c8fea(0xaf)](a5_0x1043b6[_0x1c8fea(0xf8)]('⚠\x20SKIPPED:\x20'+_0x14cd24+_0x1c8fea(0x100)+_0x1e6efa));}});for(const _0x3b2098 of _0x52d5ca){!_0x13425a[_0x20e0f3(0xe5)](_0x3220f2=>_0x3220f2['name']===_0x3b2098['name'])&&_0x13425a[_0x20e0f3(0xf6)](_0x3b2098);}}catch(_0x2978dc){_0x5e8596[_0x20e0f3(0x97)]();const _0x3bfb37=_0x2978dc instanceof Error?_0x2978dc[_0x20e0f3(0x10c)]:String(_0x2978dc);return console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)](_0x20e0f3(0xbf)+_0x3bfb37)),0x1;}_0x5e8596['stop']();if(_0x3ab7ba[_0x20e0f3(0x113)]>0x0){console[_0x20e0f3(0xaf)](),console[_0x20e0f3(0xaf)](a5_0x1043b6['cyan'](_0x20e0f3(0x10a)));const {projectId:_0x191747,agentId:_0x2cbfbb}=_0x156b35[_0x20e0f3(0x9a)];for(const _0x3663bb of _0x3ab7ba){console['log'](_0x20e0f3(0x116)+a5_0x1043b6[_0x20e0f3(0xe9)](_0x3663bb[_0x20e0f3(0xf7)]));const _0x5bc9cb=createCommandSpinner(_0x20e0f3(0xea)+_0x3663bb[_0x20e0f3(0xaa)][_0x20e0f3(0x113)]+_0x20e0f3(0xde));_0x5bc9cb[_0x20e0f3(0xb1)]();try{const {result:_0x236a33}=await runTest(_0x52e005[_0x20e0f3(0xa4)],_0x3663bb,{'agentId':_0x2cbfbb,'projectId':_0x191747,'site':_0x156b35[_0x20e0f3(0xbb)],'noEval':![],'evaluatorId':_0xfd332f,'onRoundStart':(_0x5158fe,_0x430c01)=>{const _0x3a6979=_0x20e0f3;_0x5bc9cb[_0x3a6979(0xc6)]='Round\x20'+(_0x5158fe+0x1)+'/'+_0x430c01+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x938d00,_0x5ca59b,_0x1b689)=>{const _0x4727cd=_0x20e0f3,_0x2d032b=formatElapsed(_0x5ca59b);_0x1b689?console[_0x4727cd(0xaf)](_0x4727cd(0x11d)+(_0x938d00+0x1)+'/'+_0x3663bb[_0x4727cd(0xaa)][_0x4727cd(0x113)]+_0x4727cd(0xe4)+a5_0x1043b6[_0x4727cd(0xd7)]('✓')+'\x20('+_0x2d032b+')'):console[_0x4727cd(0xaf)](_0x4727cd(0x11d)+(_0x938d00+0x1)+'/'+_0x3663bb[_0x4727cd(0xaa)][_0x4727cd(0x113)]+'...\x20'+a5_0x1043b6['red']('✗'));},'onEvaluationStart':()=>{const _0x3598ce=_0x20e0f3;_0x5bc9cb[_0x3598ce(0xc6)]=_0x3598ce(0xb2);},'onEvaluationComplete':_0x33ce50=>{const _0x4745e6=_0x20e0f3,_0x9b6e89=formatElapsed(_0x33ce50);console['log']('\x20\x20Evaluating...\x20'+a5_0x1043b6[_0x4745e6(0xd7)]('✓')+'\x20('+_0x9b6e89+')');}});_0x5bc9cb[_0x20e0f3(0x97)](),_0x13425a[_0x20e0f3(0xf6)](_0x236a33);if(_0x236a33[_0x20e0f3(0x123)]===_0x20e0f3(0x9b))console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0xd7)](_0x20e0f3(0xd1)+_0x236a33[_0x20e0f3(0xec)])+a5_0x1043b6[_0x20e0f3(0xe2)]('\x20(new)'));else _0x236a33['status']===_0x20e0f3(0xa3)?console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)](_0x20e0f3(0xb8)+_0x236a33[_0x20e0f3(0xec)])+a5_0x1043b6[_0x20e0f3(0xe2)]('\x20(new)')):console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)]('✗\x20ERROR:\x20'+_0x236a33['reason']));_0x236a33[_0x20e0f3(0x94)]&&console['log'](a5_0x1043b6[_0x20e0f3(0xe2)](_0x20e0f3(0xbd)+_0x236a33[_0x20e0f3(0x94)]));}catch(_0x41985b){_0x5bc9cb[_0x20e0f3(0x97)]();const _0x51e909=_0x41985b instanceof Error?_0x41985b[_0x20e0f3(0x10c)]:String(_0x41985b);console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)](_0x20e0f3(0xf4)+_0x51e909)),_0x13425a['push']({'name':_0x3663bb[_0x20e0f3(0xf7)],'status':_0x20e0f3(0xfd),'reason':_0x51e909,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}}console['log']();const _0x28d6c0=Date['now']()-_0xc6ff72,_0x24105a=_0x13425a[_0x20e0f3(0x125)](_0x113fa1=>_0x113fa1[_0x20e0f3(0x123)]==='PASS')[_0x20e0f3(0x113)],_0x3b54a1=_0x13425a[_0x20e0f3(0x125)](_0x5d1cfd=>_0x5d1cfd['status']===_0x20e0f3(0xa3))[_0x20e0f3(0x113)],_0xa70c6e=_0x13425a[_0x20e0f3(0x125)](_0x561359=>_0x561359[_0x20e0f3(0x123)]===_0x20e0f3(0xfd))[_0x20e0f3(0x113)];console[_0x20e0f3(0xaf)]('━'[_0x20e0f3(0xa0)](0x3c)),console[_0x20e0f3(0xaf)](_0x20e0f3(0xfb)),console[_0x20e0f3(0xaf)]('━'[_0x20e0f3(0xa0)](0x3c)),console[_0x20e0f3(0xaf)](_0x20e0f3(0x121)+_0x13425a['length']),console[_0x20e0f3(0xaf)]('Passed:\x20\x20\x20'+a5_0x1043b6['green'](_0x24105a)),console[_0x20e0f3(0xaf)](_0x20e0f3(0xa6)+a5_0x1043b6[_0x20e0f3(0x92)](_0x3b54a1));_0xa70c6e>0x0&&console[_0x20e0f3(0xaf)](_0x20e0f3(0xc0)+a5_0x1043b6[_0x20e0f3(0x92)](_0xa70c6e));console['log']('Duration:\x20'+formatElapsed(_0x28d6c0)),console[_0x20e0f3(0xaf)]('━'[_0x20e0f3(0xa0)](0x3c));const _0x5706ec={'summary':{'total':_0x13425a[_0x20e0f3(0x113)],'passed':_0x24105a,'failed':_0x3b54a1,'errors':_0xa70c6e>0x0?_0xa70c6e:undefined,'duration_ms':_0x28d6c0},'tests':_0x13425a,'agent':{'project':_0x5f4193[_0x20e0f3(0xb6)],'name':_0x5f4193[_0x20e0f3(0xdc)],'site':_0x2fef40},'timestamp':new Date(_0xc6ff72)[_0x20e0f3(0x124)]()};if(_0xa85fdf!==_0x20e0f3(0xd4)||_0x1bc602){const _0x2aa917=formatResults(_0x5706ec,_0xa85fdf);if(_0x1bc602)try{a5_0x4b344f['writeFileSync'](_0x1bc602,_0x2aa917,_0x20e0f3(0x11b)),console[_0x20e0f3(0xaf)](),console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0xe2)](_0x20e0f3(0xd5)+_0x1bc602));}catch(_0x1bc867){return console[_0x20e0f3(0xaf)](),console[_0x20e0f3(0xaf)](a5_0x1043b6[_0x20e0f3(0x92)](_0x20e0f3(0x11c)+_0x1bc867)),0x1;}else console['log'](),console[_0x20e0f3(0xaf)](_0x2aa917);}const _0xd9d637=_0x13425a[_0x20e0f3(0x125)](_0x5bd217=>_0x5bd217[_0x20e0f3(0x123)]!==_0x20e0f3(0x9b));return _0xd9d637[_0x20e0f3(0x113)]>0x0?0x1:0x0;}}
1
+ const a5_0x16b20c=a5_0x3068;(function(_0x1aa731,_0x3410c0){const _0x2416ba=a5_0x3068,_0x422464=_0x1aa731();while(!![]){try{const _0x353973=parseInt(_0x2416ba(0x11d))/0x1*(parseInt(_0x2416ba(0x11f))/0x2)+parseInt(_0x2416ba(0x166))/0x3+parseInt(_0x2416ba(0x15f))/0x4*(-parseInt(_0x2416ba(0x13b))/0x5)+parseInt(_0x2416ba(0x189))/0x6+-parseInt(_0x2416ba(0x128))/0x7*(parseInt(_0x2416ba(0x115))/0x8)+parseInt(_0x2416ba(0x15a))/0x9+-parseInt(_0x2416ba(0x13f))/0xa*(-parseInt(_0x2416ba(0x17b))/0xb);if(_0x353973===_0x3410c0)break;else _0x422464['push'](_0x422464['shift']());}catch(_0x5d05de){_0x422464['push'](_0x422464['shift']());}}}(a5_0x8649,0x34c17));function a5_0x3068(_0x3fa6fb,_0x3d7a4c){_0x3fa6fb=_0x3fa6fb-0x101;const _0x86495=a5_0x8649();let _0x3068a1=_0x86495[_0x3fa6fb];return _0x3068a1;}import*as a5_0x2efd97 from'node:fs';import*as a5_0x2d59c5 from'node:path';import a5_0x4c6d88 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';function a5_0x8649(){const _0x37eda0=['agent','repeat','some','Evaluating\x20response...','...\x20','basename','Failed\x20Tests:','toISOString','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','\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)','Tests\x20found:\x20','Re-evaluating...','Error\x20writing\x20output\x20file:\x20','start','Either\x20switch\x20to\x20the\x20\x22','301741wbfSmz','llm','projectName','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','timestamp','Cached\x20run\x20from:\x20','Output\x20written\x20to:\x20','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','has','stop','green','message','executeReeval','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','882696dNbKFk','eval','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','status','Errors:\x20\x20\x20','description','\x20\x20Evaluating...\x20','log','split','Running\x20agent\x20tests...','No\x20tests\x20have\x20tags\x20defined.','reeval','✗\x20ERROR:\x20Project\x20not\x20found:\x20','multiple_agents','\x22,\x20but\x20current\x20site\x20is\x20\x22','Agent:\x20','isSpinning','name','source','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','\x20-\x20','reason','Re-evaluating\x20','dim','agent:test','push','agentDirs','✗\x20ERROR:\x20','site','json','No\x20tests\x20found\x20matching:\x20','test.yml','Run\x20\x27tdx\x20agent\x20pull\x20','\x20(cached)','found','16uAmEcQ','text','table','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','Cached\x20run\x20is\x20from\x20site\x20\x22','Available\x20tags:\x20','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','404','5UICADL','not\x20found','147342GskxzH','Available\x20tests:\x20','Test\x20Configuration:','forEach','\x27\x20to\x20create\x20the\x20folder\x20structure.','projectDir','Conversation\x20URL:\x20','Using\x20agent:\x20','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','1329139RAMiCO','length','Total:\x20\x20\x20\x20','add','PASS','round','\x20\x20Round\x20','Re-evaluation\x20Summary','jsonl','output','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','verbose','red','context','agentName','utf-8','Executing\x20new\x20tests...','resolveAgentId','Round\x201/','75qhIjqq','tests','toLowerCase','⚠\x20SKIPPED:\x20','10BIUviL','Passed:\x20\x20\x20','New\x20tests\x20to\x20execute:\x20','\x20(new)','cyan','Failed:\x20\x20\x20','tsv','find','rounds','\x22:\x20','filter','Running\x20test:\x20','Error:\x20No\x20previous\x20test\x20run\x20found.','tags','Project\x20path:\x20','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','Test\x20','conversation_url','llmProject','✗\x20FAIL:\x20','✓\x20PASS:\x20','yellow','ERROR','testName','writeFileSync','\x20\x20Conversation:\x20','existsSync','1815687XpddDR','white','resolve','...','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','87020CJAQBk','resolveProjectId','no_local_folder','map','conversations','FAIL',':\x20Sending\x20user\x20input...','532563alrhHn','join','now','includes','\x20\x20Site:\x20'];a5_0x8649=function(){return _0x37eda0;};return a5_0x8649();}import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x16b20c(0x103)]=a5_0x16b20c(0x10a);[a5_0x16b20c(0x18e)]='Run\x20tests\x20for\x20an\x20LLM\x20agent';async['execute'](_0x3e4d34){const _0xf8f4fb=a5_0x16b20c,{options:_0x56f7b3,args:_0x31c33e,tdx:_0x5dadae}=_0x3e4d34,_0x4fda5d=_0x31c33e[0x0]||'.',_0x4bb226=_0x56f7b3['dryRun'],_0x48b1eb=_0x56f7b3,_0x16384c=_0x48b1eb[_0xf8f4fb(0x18a)]===![],_0x28e159=_0x48b1eb[_0xf8f4fb(0x194)],_0xef2f87=_0x48b1eb['name'],_0x1efccf=_0x48b1eb[_0xf8f4fb(0x14c)],_0x172b2f=_0x56f7b3['site'],_0x4b941a=_0x48b1eb[_0xf8f4fb(0x131)];if(_0x28e159&&_0x16384c)return console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)](_0xf8f4fb(0x127))),0x1;let _0x3d9fb4='table';if(_0x48b1eb['json'])_0x3d9fb4=_0xf8f4fb(0x10f);else{if(_0x48b1eb['jsonl'])_0x3d9fb4=_0xf8f4fb(0x130);else{if(_0x48b1eb[_0xf8f4fb(0x145)])_0x3d9fb4='tsv';else{if(_0x48b1eb[_0xf8f4fb(0x117)])_0x3d9fb4=_0xf8f4fb(0x117);}}}const _0x521e5f=_0x48b1eb['llmProject'];let _0x47ab6b=_0x4fda5d;const _0xe55525=a5_0x2efd97[_0xf8f4fb(0x159)](_0x4fda5d),_0x44fdcf=_0x4fda5d==='.';if(!_0xe55525||_0x44fdcf){const _0x5a380d=resolveProjectFromContext(_0x4fda5d,_0x521e5f,{'requireFile':_0xf8f4fb(0x111)});if(_0x5a380d[_0xf8f4fb(0x114)])_0x47ab6b=_0x5a380d[_0xf8f4fb(0x124)],_0x5a380d[_0xf8f4fb(0x104)]===_0xf8f4fb(0x135)&&console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x109)](_0xf8f4fb(0x126)+_0x47ab6b));else switch(_0x5a380d['reason']){case'no_context':console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x154)](_0x5a380d[_0xf8f4fb(0x186)])),console[_0xf8f4fb(0x190)](),console[_0xf8f4fb(0x190)]('Usage:'),console[_0xf8f4fb(0x190)]('\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[_0xf8f4fb(0x190)](_0xf8f4fb(0x175)),console['log'](),console['log'](_0xf8f4fb(0x188));return 0x1;case _0xf8f4fb(0x161):console['log'](a5_0x4c6d88[_0xf8f4fb(0x154)](_0x5a380d['message'])),console[_0xf8f4fb(0x190)](),console[_0xf8f4fb(0x190)](_0xf8f4fb(0x112)+_0x5a380d[_0xf8f4fb(0x151)]+_0xf8f4fb(0x123));return 0x1;case _0xf8f4fb(0x196):{const _0x2d4bb2=a5_0x2d59c5[_0xf8f4fb(0x170)](_0x5a380d[_0xf8f4fb(0x124)]);console[_0xf8f4fb(0x190)](a5_0x4c6d88['yellow'](_0xf8f4fb(0x18b)+_0x5a380d[_0xf8f4fb(0x151)]+'\x22:'));for(const _0x34a2e2 of _0x5a380d[_0xf8f4fb(0x10c)]){console['log']('\x20\x20-\x20'+_0x34a2e2);}return console['log'](),console['log'](_0xf8f4fb(0x105)+_0x2d4bb2+'/<agent-name>'),0x1;}case'no_tests':console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x154)](_0xf8f4fb(0x182)+_0x5a380d['llmProject']+'\x22.')),console[_0xf8f4fb(0x190)](a5_0x4c6d88['dim'](_0xf8f4fb(0x14d)+_0x5a380d[_0xf8f4fb(0x124)])),console[_0xf8f4fb(0x190)](),console[_0xf8f4fb(0x190)](_0xf8f4fb(0x15e));return 0x1;}}const {definition:_0x499b34,agentInfo:_0x179233}=parseTestFile(_0x47ab6b);let _0x9d2432=_0x499b34[_0xf8f4fb(0x13c)];if(_0xef2f87){const _0xfbc3ee=_0xef2f87[_0xf8f4fb(0x191)](',')[_0xf8f4fb(0x162)](_0x14e016=>_0x14e016['trim']());_0x9d2432=_0x499b34['tests'][_0xf8f4fb(0x149)](_0x4e8cbc=>_0xfbc3ee[_0xf8f4fb(0x169)](_0x4e8cbc['name']));if(_0x9d2432['length']===0x0)return console['log'](a5_0x4c6d88['yellow'](_0xf8f4fb(0x110)+_0xef2f87)),console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x109)](_0xf8f4fb(0x120)+_0x499b34[_0xf8f4fb(0x13c)][_0xf8f4fb(0x162)](_0x319fc0=>_0x319fc0['name'])[_0xf8f4fb(0x167)](',\x20'))),0x1;}if(_0x1efccf){const _0x2ddbe3=_0x1efccf[_0xf8f4fb(0x191)](',')['map'](_0x48c540=>_0x48c540['trim']()[_0xf8f4fb(0x13d)]());_0x9d2432=_0x9d2432[_0xf8f4fb(0x149)](_0x30439d=>_0x30439d[_0xf8f4fb(0x14c)]?.[_0xf8f4fb(0x16d)](_0x52dc9c=>_0x2ddbe3[_0xf8f4fb(0x169)](_0x52dc9c['toLowerCase']())));if(_0x9d2432[_0xf8f4fb(0x129)]===0x0){console[_0xf8f4fb(0x190)](a5_0x4c6d88['yellow']('No\x20tests\x20found\x20with\x20tags:\x20'+_0x1efccf));const _0x3a856b=new Set();return _0x499b34[_0xf8f4fb(0x13c)][_0xf8f4fb(0x122)](_0x56170c=>_0x56170c[_0xf8f4fb(0x14c)]?.[_0xf8f4fb(0x122)](_0x395849=>_0x3a856b[_0xf8f4fb(0x12b)](_0x395849))),_0x3a856b['size']>0x0?console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x109)](_0xf8f4fb(0x11a)+[..._0x3a856b][_0xf8f4fb(0x167)](',\x20'))):console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x109)](_0xf8f4fb(0x193))),0x1;}}if(_0x28e159)return this['executeReeval'](_0x3e4d34,{'definition':{'tests':_0x9d2432},'agentInfo':_0x179233,'outputFormat':_0x3d9fb4,'outputFile':_0x4b941a,'testNames':_0xef2f87});if(_0x4bb226){console['log'](a5_0x4c6d88[_0xf8f4fb(0x143)](_0xf8f4fb(0x121))),console[_0xf8f4fb(0x190)](_0xf8f4fb(0x16a)+a5_0x4c6d88[_0xf8f4fb(0x15b)](_0x172b2f)),console[_0xf8f4fb(0x190)]('\x20\x20Project:\x20'+a5_0x4c6d88[_0xf8f4fb(0x15b)](_0x179233[_0xf8f4fb(0x17d)])),console[_0xf8f4fb(0x190)]('\x20\x20Agent:\x20'+a5_0x4c6d88[_0xf8f4fb(0x15b)](_0x179233[_0xf8f4fb(0x136)])),console[_0xf8f4fb(0x190)](),console[_0xf8f4fb(0x190)](_0xf8f4fb(0x176)+a5_0x4c6d88[_0xf8f4fb(0x15b)](_0x9d2432['length']));for(let _0x5557ef=0x0;_0x5557ef<_0x9d2432['length'];_0x5557ef++){const _0x3ca0a8=_0x9d2432[_0x5557ef],_0x244131=_0x3ca0a8[_0xf8f4fb(0x147)]['length']===0x1?_0xf8f4fb(0x12d):_0xf8f4fb(0x147),_0x3d5ea2=_0x3ca0a8[_0xf8f4fb(0x14c)]?.[_0xf8f4fb(0x129)]?'\x20['+_0x3ca0a8['tags'][_0xf8f4fb(0x167)](',\x20')+']':'';console[_0xf8f4fb(0x190)]('\x20\x20'+(_0x5557ef+0x1)+'.\x20'+a5_0x4c6d88[_0xf8f4fb(0x15b)](_0x3ca0a8[_0xf8f4fb(0x103)])+'\x20('+_0x3ca0a8['rounds']['length']+'\x20'+_0x244131+')'+a5_0x4c6d88[_0xf8f4fb(0x109)](_0x3d5ea2));}return 0x0;}let _0x4f1f54,_0x59e3ac;try{_0x4f1f54=await _0x5dadae[_0xf8f4fb(0x17c)][_0xf8f4fb(0x160)](_0x179233['projectName']);}catch(_0x2c3f2a){const _0x1abdea=_0x2c3f2a instanceof Error?_0x2c3f2a['message']:String(_0x2c3f2a);return _0x1abdea['includes'](_0xf8f4fb(0x11c))||_0x1abdea['toLowerCase']()['includes'](_0xf8f4fb(0x11e))?console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)](_0xf8f4fb(0x195)+_0x179233[_0xf8f4fb(0x17d)])):console['log'](a5_0x4c6d88[_0xf8f4fb(0x134)](_0xf8f4fb(0x17e)+_0x179233[_0xf8f4fb(0x17d)]+'\x22:\x20'+_0x1abdea)),0x1;}try{_0x59e3ac=await _0x5dadae['llm'][_0xf8f4fb(0x139)](_0x179233['agentName'],_0x4f1f54);}catch(_0x274277){const _0xe9fda1=_0x274277 instanceof Error?_0x274277[_0xf8f4fb(0x186)]:String(_0x274277);return _0xe9fda1[_0xf8f4fb(0x169)](_0xf8f4fb(0x11c))||_0xe9fda1[_0xf8f4fb(0x13d)]()[_0xf8f4fb(0x169)](_0xf8f4fb(0x11e))?console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)](_0xf8f4fb(0x173)+_0x179233['agentName'])):console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22'+_0x179233[_0xf8f4fb(0x136)]+_0xf8f4fb(0x148)+_0xe9fda1)),0x1;}let _0x13fa07;if(!_0x16384c)try{_0x13fa07=await setupEvaluatorAgent(_0x5dadae['llm'],_0x56f7b3['verbose']);}catch(_0x1808f9){const _0x429f5f=_0x1808f9 instanceof Error?_0x1808f9[_0xf8f4fb(0x186)]:String(_0x1808f9);return console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x429f5f)),0x1;}console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x143)](_0xf8f4fb(0x192))),console[_0xf8f4fb(0x190)]('Site:\x20'+a5_0x4c6d88[_0xf8f4fb(0x15b)](_0x172b2f)),console['log'](_0xf8f4fb(0x101)+a5_0x4c6d88['white'](_0x179233[_0xf8f4fb(0x17d)]+'/'+_0x179233['agentName'])),console['log']();const _0x5078f7=[],_0x351b5a=[],_0x247ebb=Date['now']();for(let _0x3df30e=0x0;_0x3df30e<_0x9d2432[_0xf8f4fb(0x129)];_0x3df30e++){const _0x39167b=_0x9d2432[_0x3df30e];_0x9d2432[_0xf8f4fb(0x129)]>0x1?console['log'](_0xf8f4fb(0x14f)+(_0x3df30e+0x1)+'/'+_0x9d2432['length']+':\x20'+a5_0x4c6d88['white'](_0x39167b['name'])):console[_0xf8f4fb(0x190)](_0xf8f4fb(0x14a)+a5_0x4c6d88['white'](_0x39167b[_0xf8f4fb(0x103)]));const _0x1512c8=createCommandSpinner(_0xf8f4fb(0x13a)+_0x39167b[_0xf8f4fb(0x147)][_0xf8f4fb(0x129)]+_0xf8f4fb(0x165));_0x1512c8[_0xf8f4fb(0x179)]();try{const {result:_0xd9a89,conversation:_0x354b95}=await runTest(_0x5dadae[_0xf8f4fb(0x17c)],_0x39167b,{'agentId':_0x59e3ac,'projectId':_0x4f1f54,'site':_0x172b2f,'noEval':_0x16384c,'evaluatorId':_0x13fa07,'onRoundStart':(_0x3f61fc,_0x35e649)=>{const _0x40394c=_0xf8f4fb;_0x1512c8[_0x40394c(0x116)]='Round\x20'+(_0x3f61fc+0x1)+'/'+_0x35e649+_0x40394c(0x165);},'onRoundComplete':(_0xfefbe8,_0x575404,_0x3aebaa)=>{const _0x1bf669=_0xf8f4fb,_0x5bec37=formatElapsed(_0x575404);_0x3aebaa?console[_0x1bf669(0x190)]('\x20\x20Round\x20'+(_0xfefbe8+0x1)+'/'+_0x39167b[_0x1bf669(0x147)]['length']+_0x1bf669(0x16f)+a5_0x4c6d88[_0x1bf669(0x185)]('✓')+'\x20('+_0x5bec37+')'):console['log'](_0x1bf669(0x12e)+(_0xfefbe8+0x1)+'/'+_0x39167b[_0x1bf669(0x147)][_0x1bf669(0x129)]+_0x1bf669(0x16f)+a5_0x4c6d88[_0x1bf669(0x134)]('✗'));},'onEvaluationStart':()=>{const _0x4e5cd5=_0xf8f4fb;_0x1512c8[_0x4e5cd5(0x116)]=_0x4e5cd5(0x16e);},'onEvaluationComplete':_0x1596ad=>{const _0x4f3234=_0xf8f4fb,_0x218959=formatElapsed(_0x1596ad);console[_0x4f3234(0x190)](_0x4f3234(0x18f)+a5_0x4c6d88[_0x4f3234(0x185)]('✓')+'\x20('+_0x218959+')');}});_0x1512c8[_0xf8f4fb(0x184)](),_0x5078f7[_0xf8f4fb(0x10b)](_0xd9a89),_0x351b5a[_0xf8f4fb(0x10b)](_0x354b95);if(_0xd9a89[_0xf8f4fb(0x18c)]===_0xf8f4fb(0x12c))console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x185)](_0xf8f4fb(0x153)+_0xd9a89[_0xf8f4fb(0x107)]));else _0xd9a89[_0xf8f4fb(0x18c)]===_0xf8f4fb(0x164)?console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)]('✗\x20FAIL:\x20'+_0xd9a89[_0xf8f4fb(0x107)])):console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)]('✗\x20ERROR:\x20'+_0xd9a89[_0xf8f4fb(0x107)]));_0xd9a89['conversation_url']&&console[_0xf8f4fb(0x190)](a5_0x4c6d88['dim'](_0xf8f4fb(0x125)+_0xd9a89['conversation_url'])),console[_0xf8f4fb(0x190)]();}catch(_0x47ff6c){_0x1512c8[_0xf8f4fb(0x184)]();const _0x390be3=_0x47ff6c instanceof Error?_0x47ff6c[_0xf8f4fb(0x186)]:String(_0x47ff6c);console[_0xf8f4fb(0x190)](a5_0x4c6d88['red']('✗\x20ERROR:\x20'+_0x390be3)),console[_0xf8f4fb(0x190)](),_0x5078f7[_0xf8f4fb(0x10b)]({'name':_0x39167b['name'],'status':_0xf8f4fb(0x155),'reason':_0x390be3,'timestamp':new Date()[_0xf8f4fb(0x172)](),'duration_ms':0x0});}}const _0x1a1271=Date[_0xf8f4fb(0x168)]()-_0x247ebb,_0x4105c6=_0x5078f7['filter'](_0x1ed7d6=>_0x1ed7d6[_0xf8f4fb(0x18c)]==='PASS')[_0xf8f4fb(0x129)],_0x3ffaa6=_0x5078f7['filter'](_0x9192a5=>_0x9192a5['status']===_0xf8f4fb(0x164))[_0xf8f4fb(0x129)],_0x25dd14=_0x5078f7['filter'](_0x5f4ee7=>_0x5f4ee7[_0xf8f4fb(0x18c)]===_0xf8f4fb(0x155))[_0xf8f4fb(0x129)];console[_0xf8f4fb(0x190)]('━'[_0xf8f4fb(0x16c)](0x3c)),console[_0xf8f4fb(0x190)]('Test\x20Summary'),console[_0xf8f4fb(0x190)]('━'[_0xf8f4fb(0x16c)](0x3c)),console[_0xf8f4fb(0x190)](_0xf8f4fb(0x12a)+_0x5078f7[_0xf8f4fb(0x129)]),console['log'](_0xf8f4fb(0x140)+a5_0x4c6d88[_0xf8f4fb(0x185)](_0x4105c6)),console['log'](_0xf8f4fb(0x144)+a5_0x4c6d88['red'](_0x3ffaa6));_0x25dd14>0x0&&console[_0xf8f4fb(0x190)](_0xf8f4fb(0x18d)+a5_0x4c6d88['red'](_0x25dd14));console[_0xf8f4fb(0x190)]('Duration:\x20'+formatElapsed(_0x1a1271)),console[_0xf8f4fb(0x190)]('━'[_0xf8f4fb(0x16c)](0x3c));const _0x36aa1f=_0x5078f7[_0xf8f4fb(0x149)](_0xc51a18=>_0xc51a18['status']!=='PASS');if(_0x36aa1f['length']>0x0){console[_0xf8f4fb(0x190)](),console[_0xf8f4fb(0x190)](_0xf8f4fb(0x171));for(const _0x262fc4 of _0x36aa1f){const _0x11e443=a5_0x4c6d88[_0xf8f4fb(0x134)]('✗'),_0x15af83=_0x262fc4[_0xf8f4fb(0x107)]['length']>0x32?_0x262fc4[_0xf8f4fb(0x107)]['substring'](0x0,0x32)+_0xf8f4fb(0x15d):_0x262fc4['reason'];console[_0xf8f4fb(0x190)]('\x20\x20'+_0x11e443+'\x20'+_0x262fc4[_0xf8f4fb(0x103)]+':\x20'+_0x15af83);}}const _0x2fb69a={'summary':{'total':_0x5078f7['length'],'passed':_0x4105c6,'failed':_0x3ffaa6,'errors':_0x25dd14>0x0?_0x25dd14:undefined,'duration_ms':_0x1a1271},'tests':_0x5078f7,'agent':{'project':_0x179233[_0xf8f4fb(0x17d)],'name':_0x179233[_0xf8f4fb(0x136)],'site':_0x172b2f},'timestamp':new Date(_0x247ebb)[_0xf8f4fb(0x172)]()};try{const _0x4926c7=buildCachedTestRun(_0x351b5a,{'site':_0x172b2f,'projectId':_0x4f1f54,'projectName':_0x179233[_0xf8f4fb(0x17d)],'agentId':_0x59e3ac,'agentName':_0x179233[_0xf8f4fb(0x136)],'testYmlPath':a5_0x2d59c5[_0xf8f4fb(0x15c)](_0x179233['testYmlPath'])});saveLastTestRun(_0x4926c7);}catch{}if(_0x3d9fb4!==_0xf8f4fb(0x117)||_0x4b941a){const _0x24c0d1=formatResults(_0x2fb69a,_0x3d9fb4);if(_0x4b941a)try{a5_0x2efd97[_0xf8f4fb(0x157)](_0x4b941a,_0x24c0d1,_0xf8f4fb(0x137)),console[_0xf8f4fb(0x190)](),console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x109)](_0xf8f4fb(0x181)+_0x4b941a));}catch(_0x1ed37e){return console['log'](),console[_0xf8f4fb(0x190)](a5_0x4c6d88[_0xf8f4fb(0x134)](_0xf8f4fb(0x178)+_0x1ed37e)),0x1;}else console['log'](),console['log'](_0x24c0d1);}return _0x36aa1f[_0xf8f4fb(0x129)]>0x0?0x1:0x0;}async[a5_0x16b20c(0x187)](_0x293791,_0x472e1f){const _0x48e90a=a5_0x16b20c,{options:_0x1e8211,tdx:_0x106e0a}=_0x293791,{definition:_0x4dca93,agentInfo:_0x45b5a,outputFormat:_0x44ed6b,outputFile:_0x5c4957}=_0x472e1f,_0x5dc3db=_0x1e8211[_0x48e90a(0x10e)],_0x2fe8e6=loadLastTestRun();if(!_0x2fe8e6)return console[_0x48e90a(0x190)](a5_0x4c6d88['red'](_0x48e90a(0x14b))),console['log'](a5_0x4c6d88[_0x48e90a(0x109)](_0x48e90a(0x174))),0x1;if(_0x2fe8e6[_0x48e90a(0x16b)][_0x48e90a(0x136)]!==_0x45b5a[_0x48e90a(0x136)])return console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x134)](_0x48e90a(0x118)+_0x2fe8e6[_0x48e90a(0x16b)][_0x48e90a(0x136)]+_0x48e90a(0x132)+_0x45b5a[_0x48e90a(0x136)]+'\x22.')),console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x109)]('Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.')),0x1;const _0x35b451=new Set(_0x2fe8e6[_0x48e90a(0x163)][_0x48e90a(0x162)](_0x10167b=>_0x10167b[_0x48e90a(0x156)])),_0x4dd572=_0x4dca93[_0x48e90a(0x13c)][_0x48e90a(0x149)](_0x535dfb=>!_0x35b451[_0x48e90a(0x183)](_0x535dfb[_0x48e90a(0x103)]));if(_0x4dd572[_0x48e90a(0x129)]>0x0&&_0x2fe8e6['site']!==_0x5dc3db)return console['log'](a5_0x4c6d88[_0x48e90a(0x134)]('Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.')),console['log'](a5_0x4c6d88[_0x48e90a(0x109)](_0x48e90a(0x119)+_0x2fe8e6[_0x48e90a(0x10e)]+_0x48e90a(0x197)+_0x5dc3db+'\x22.')),console[_0x48e90a(0x190)](a5_0x4c6d88['dim'](_0x48e90a(0x17a)+_0x2fe8e6[_0x48e90a(0x10e)]+_0x48e90a(0x14e))),0x1;const _0x33f380=_0x4dca93['tests'][_0x48e90a(0x149)](_0x184bdc=>_0x35b451['has'](_0x184bdc[_0x48e90a(0x103)])),_0x5046bc=_0x4dd572;let _0xa306de;try{_0xa306de=await setupEvaluatorAgent(_0x106e0a[_0x48e90a(0x17c)],_0x1e8211[_0x48e90a(0x133)]);}catch(_0x61c32c){const _0x5e617b=_0x61c32c instanceof Error?_0x61c32c[_0x48e90a(0x186)]:String(_0x61c32c);return console['log'](a5_0x4c6d88[_0x48e90a(0x134)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x5e617b)),0x1;}console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x143)]('Re-evaluating\x20cached\x20test\x20run...')),console['log'](_0x48e90a(0x180)+a5_0x4c6d88[_0x48e90a(0x15b)](_0x2fe8e6[_0x48e90a(0x17f)])),console[_0x48e90a(0x190)]('Agent:\x20'+a5_0x4c6d88[_0x48e90a(0x15b)](_0x2fe8e6['agent'][_0x48e90a(0x17d)]+'/'+_0x2fe8e6[_0x48e90a(0x16b)][_0x48e90a(0x136)]));_0x5046bc[_0x48e90a(0x129)]>0x0&&console[_0x48e90a(0x190)](_0x48e90a(0x141)+a5_0x4c6d88[_0x48e90a(0x154)](_0x5046bc[_0x48e90a(0x129)]));console[_0x48e90a(0x190)]();const _0x6e2aa3=[],_0x83539d=Date[_0x48e90a(0x168)](),_0x68e053=createCommandSpinner(_0x48e90a(0x177));if(_0x33f380['length']>0x0)try{const _0x467e0d=await reevaluateFromCache(_0x106e0a['llm'],_0x2fe8e6,{'tests':_0x33f380},{'evaluatorId':_0xa306de,'onTestStart':(_0x22ad1a,_0x1ce086,_0x177cd2)=>{const _0x6cfaae=_0x48e90a;_0x68e053[_0x6cfaae(0x116)]=_0x6cfaae(0x108)+(_0x1ce086+0x1)+'/'+_0x177cd2+':\x20'+_0x22ad1a+_0x6cfaae(0x15d);if(!_0x68e053[_0x6cfaae(0x102)])_0x68e053[_0x6cfaae(0x179)]();},'onTestComplete':(_0x5bdaa4,_0x189eb8)=>{const _0x19293e=_0x48e90a;_0x68e053[_0x19293e(0x184)]();if(_0x189eb8['status']==='PASS')console['log'](a5_0x4c6d88[_0x19293e(0x185)](_0x19293e(0x153)+_0x5bdaa4)+a5_0x4c6d88[_0x19293e(0x109)](_0x19293e(0x113)));else _0x189eb8[_0x19293e(0x18c)]===_0x19293e(0x164)?console[_0x19293e(0x190)](a5_0x4c6d88[_0x19293e(0x134)](_0x19293e(0x152)+_0x5bdaa4+'\x20-\x20'+_0x189eb8[_0x19293e(0x107)])+a5_0x4c6d88['dim'](_0x19293e(0x113))):console[_0x19293e(0x190)](a5_0x4c6d88[_0x19293e(0x134)](_0x19293e(0x10d)+_0x5bdaa4+_0x19293e(0x106)+_0x189eb8[_0x19293e(0x107)]));_0x189eb8[_0x19293e(0x150)]&&console[_0x19293e(0x190)](a5_0x4c6d88[_0x19293e(0x109)]('\x20\x20Conversation:\x20'+_0x189eb8[_0x19293e(0x150)])),_0x6e2aa3[_0x19293e(0x10b)](_0x189eb8);},'onTestSkipped':(_0x1f6226,_0x46500a)=>{const _0x555cbd=_0x48e90a;_0x68e053[_0x555cbd(0x184)](),console[_0x555cbd(0x190)](a5_0x4c6d88[_0x555cbd(0x154)](_0x555cbd(0x13e)+_0x1f6226+_0x555cbd(0x106)+_0x46500a));}});for(const _0x289853 of _0x467e0d){!_0x6e2aa3[_0x48e90a(0x146)](_0x3d4e37=>_0x3d4e37['name']===_0x289853[_0x48e90a(0x103)])&&_0x6e2aa3[_0x48e90a(0x10b)](_0x289853);}}catch(_0x4a9f5e){_0x68e053[_0x48e90a(0x184)]();const _0x445c35=_0x4a9f5e instanceof Error?_0x4a9f5e[_0x48e90a(0x186)]:String(_0x4a9f5e);return console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x134)](_0x48e90a(0x11b)+_0x445c35)),0x1;}_0x68e053[_0x48e90a(0x184)]();if(_0x5046bc[_0x48e90a(0x129)]>0x0){console['log'](),console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x143)](_0x48e90a(0x138)));const {projectId:_0x1f791b,agentId:_0x30d74d}=_0x2fe8e6['agent'];for(const _0xd1e403 of _0x5046bc){console[_0x48e90a(0x190)]('Running:\x20'+a5_0x4c6d88[_0x48e90a(0x15b)](_0xd1e403[_0x48e90a(0x103)]));const _0x1ff200=createCommandSpinner(_0x48e90a(0x13a)+_0xd1e403[_0x48e90a(0x147)][_0x48e90a(0x129)]+_0x48e90a(0x165));_0x1ff200[_0x48e90a(0x179)]();try{const {result:_0x3d2ca0}=await runTest(_0x106e0a['llm'],_0xd1e403,{'agentId':_0x30d74d,'projectId':_0x1f791b,'site':_0x2fe8e6[_0x48e90a(0x10e)],'noEval':![],'evaluatorId':_0xa306de,'onRoundStart':(_0x1fe20e,_0x465e84)=>{const _0x5ba848=_0x48e90a;_0x1ff200[_0x5ba848(0x116)]='Round\x20'+(_0x1fe20e+0x1)+'/'+_0x465e84+_0x5ba848(0x165);},'onRoundComplete':(_0xe528cb,_0x479937,_0x530888)=>{const _0x35d221=_0x48e90a,_0x4826d3=formatElapsed(_0x479937);_0x530888?console[_0x35d221(0x190)](_0x35d221(0x12e)+(_0xe528cb+0x1)+'/'+_0xd1e403[_0x35d221(0x147)][_0x35d221(0x129)]+_0x35d221(0x16f)+a5_0x4c6d88['green']('✓')+'\x20('+_0x4826d3+')'):console[_0x35d221(0x190)](_0x35d221(0x12e)+(_0xe528cb+0x1)+'/'+_0xd1e403[_0x35d221(0x147)][_0x35d221(0x129)]+_0x35d221(0x16f)+a5_0x4c6d88['red']('✗'));},'onEvaluationStart':()=>{const _0x3fda1b=_0x48e90a;_0x1ff200[_0x3fda1b(0x116)]='Evaluating\x20response...';},'onEvaluationComplete':_0x39008e=>{const _0x1af052=_0x48e90a,_0x1fc4c1=formatElapsed(_0x39008e);console['log'](_0x1af052(0x18f)+a5_0x4c6d88[_0x1af052(0x185)]('✓')+'\x20('+_0x1fc4c1+')');}});_0x1ff200[_0x48e90a(0x184)](),_0x6e2aa3[_0x48e90a(0x10b)](_0x3d2ca0);if(_0x3d2ca0['status']==='PASS')console['log'](a5_0x4c6d88[_0x48e90a(0x185)](_0x48e90a(0x153)+_0x3d2ca0[_0x48e90a(0x107)])+a5_0x4c6d88[_0x48e90a(0x109)](_0x48e90a(0x142)));else _0x3d2ca0[_0x48e90a(0x18c)]==='FAIL'?console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x134)](_0x48e90a(0x152)+_0x3d2ca0['reason'])+a5_0x4c6d88[_0x48e90a(0x109)](_0x48e90a(0x142))):console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x134)]('✗\x20ERROR:\x20'+_0x3d2ca0['reason']));_0x3d2ca0[_0x48e90a(0x150)]&&console['log'](a5_0x4c6d88['dim'](_0x48e90a(0x158)+_0x3d2ca0[_0x48e90a(0x150)]));}catch(_0x326277){_0x1ff200['stop']();const _0xcc655f=_0x326277 instanceof Error?_0x326277['message']:String(_0x326277);console[_0x48e90a(0x190)](a5_0x4c6d88['red']('✗\x20ERROR:\x20'+_0xcc655f)),_0x6e2aa3[_0x48e90a(0x10b)]({'name':_0xd1e403['name'],'status':_0x48e90a(0x155),'reason':_0xcc655f,'timestamp':new Date()[_0x48e90a(0x172)](),'duration_ms':0x0});}}}console['log']();const _0x280cc3=Date[_0x48e90a(0x168)]()-_0x83539d,_0x15b168=_0x6e2aa3[_0x48e90a(0x149)](_0x40c547=>_0x40c547[_0x48e90a(0x18c)]===_0x48e90a(0x12c))['length'],_0x45b9b0=_0x6e2aa3['filter'](_0x3effe7=>_0x3effe7[_0x48e90a(0x18c)]==='FAIL')['length'],_0x2d70bc=_0x6e2aa3[_0x48e90a(0x149)](_0x4f2ca5=>_0x4f2ca5[_0x48e90a(0x18c)]===_0x48e90a(0x155))['length'];console['log']('━'[_0x48e90a(0x16c)](0x3c)),console[_0x48e90a(0x190)](_0x48e90a(0x12f)),console[_0x48e90a(0x190)]('━'[_0x48e90a(0x16c)](0x3c)),console['log']('Total:\x20\x20\x20\x20'+_0x6e2aa3[_0x48e90a(0x129)]),console[_0x48e90a(0x190)](_0x48e90a(0x140)+a5_0x4c6d88[_0x48e90a(0x185)](_0x15b168)),console[_0x48e90a(0x190)](_0x48e90a(0x144)+a5_0x4c6d88[_0x48e90a(0x134)](_0x45b9b0));_0x2d70bc>0x0&&console[_0x48e90a(0x190)](_0x48e90a(0x18d)+a5_0x4c6d88[_0x48e90a(0x134)](_0x2d70bc));console[_0x48e90a(0x190)]('Duration:\x20'+formatElapsed(_0x280cc3)),console[_0x48e90a(0x190)]('━'[_0x48e90a(0x16c)](0x3c));const _0x1d2551={'summary':{'total':_0x6e2aa3['length'],'passed':_0x15b168,'failed':_0x45b9b0,'errors':_0x2d70bc>0x0?_0x2d70bc:undefined,'duration_ms':_0x280cc3},'tests':_0x6e2aa3,'agent':{'project':_0x45b5a['projectName'],'name':_0x45b5a[_0x48e90a(0x136)],'site':_0x5dc3db},'timestamp':new Date(_0x83539d)['toISOString']()};if(_0x44ed6b!==_0x48e90a(0x117)||_0x5c4957){const _0x106e69=formatResults(_0x1d2551,_0x44ed6b);if(_0x5c4957)try{a5_0x2efd97['writeFileSync'](_0x5c4957,_0x106e69,'utf-8'),console[_0x48e90a(0x190)](),console[_0x48e90a(0x190)](a5_0x4c6d88[_0x48e90a(0x109)](_0x48e90a(0x181)+_0x5c4957));}catch(_0x43020f){return console[_0x48e90a(0x190)](),console['log'](a5_0x4c6d88[_0x48e90a(0x134)](_0x48e90a(0x178)+_0x43020f)),0x1;}else console[_0x48e90a(0x190)](),console[_0x48e90a(0x190)](_0x106e69);}const _0x5d6ed3=_0x6e2aa3[_0x48e90a(0x149)](_0xe1b67e=>_0xe1b67e[_0x48e90a(0x18c)]!==_0x48e90a(0x12c));return _0x5d6ed3[_0x48e90a(0x129)]>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a6_0x26cc9a=a6_0x1c45;(function(_0x12047b,_0x127122){const _0x3300fb=a6_0x1c45,_0x27f73c=_0x12047b();while(!![]){try{const _0x490ddf=-parseInt(_0x3300fb(0x1f7))/0x1*(-parseInt(_0x3300fb(0x1e1))/0x2)+parseInt(_0x3300fb(0x1db))/0x3*(parseInt(_0x3300fb(0x1eb))/0x4)+parseInt(_0x3300fb(0x1f1))/0x5*(-parseInt(_0x3300fb(0x1c4))/0x6)+parseInt(_0x3300fb(0x201))/0x7*(-parseInt(_0x3300fb(0x1d7))/0x8)+-parseInt(_0x3300fb(0x1ea))/0x9+-parseInt(_0x3300fb(0x1e5))/0xa*(-parseInt(_0x3300fb(0x1c8))/0xb)+parseInt(_0x3300fb(0x1d9))/0xc;if(_0x490ddf===_0x127122)break;else _0x27f73c['push'](_0x27f73c['shift']());}catch(_0x2ca5e6){_0x27f73c['push'](_0x27f73c['shift']());}}}(a6_0x36ad,0x9983e));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';function a6_0x36ad(){const _0x9bf1ad=['api','indexOf','verbose','POST','readBodyFromFile','file','message','proxy-authorization','llm','status','type','\x0aStack\x20trace:\x0a','execute','set-cookie2','1628696cYDmDK','headers','20299188kXdeiu','\x22.\x20','2298ffmsfL','request','.\x20Valid\x20types:\x20','data','trim','toLowerCase','186454qJoliB','cookie','Invalid\x20HTTP\x20method:\x20','Invalid\x20API\x20type:\x20','1841940HTKKfv','set-cookie','.\x20Valid\x20methods:\x20','<\x20HTTP/1.1\x20','error','11025144HbqzoH','592xVugWE','log','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','output','name','toUpperCase','40LZgNXr','method','keys','description','cdp','color','8WHTTbF','Error:\x20','substring','stack','validate','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','authorization','has','includes','llm-proxy','7efKyXw','x-xsrf-token','join','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','GET','startsWith','508182JTpakI','DELETE','length','header','11tKOqfJ'];a6_0x36ad=function(){return _0x9bf1ad;};return a6_0x36ad();}import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a6_0x26cc9a(0x1fd),a6_0x26cc9a(0x1d0),a6_0x26cc9a(0x1e2),a6_0x26cc9a(0x1e6),a6_0x26cc9a(0x1d6),a6_0x26cc9a(0x1bf),'x-auth-token','x-trino-user']);function isSensitiveHeader(_0x4e9422){const _0x4befa7=a6_0x26cc9a;return SENSITIVE_HEADERS[_0x4befa7(0x1fe)](_0x4e9422[_0x4befa7(0x1e0)]());}function parseHeader(_0x165b57){const _0x4fb2e2=a6_0x26cc9a,_0x2d4162=_0x165b57[_0x4fb2e2(0x1ca)](':');if(_0x2d4162===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x165b57+_0x4fb2e2(0x1da)+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x27b34e=_0x165b57['substring'](0x0,_0x2d4162)['trim'](),_0x21d731=_0x165b57[_0x4fb2e2(0x1f9)](_0x2d4162+0x1)[_0x4fb2e2(0x1df)]();if(!_0x27b34e)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x165b57+'\x22');return[_0x27b34e,_0x21d731];}function a6_0x1c45(_0x4d8e85,_0x4b19e5){_0x4d8e85=_0x4d8e85-0x1bf;const _0x36ad7a=a6_0x36ad();let _0x1c45a9=_0x36ad7a[_0x4d8e85];return _0x1c45a9;}export class ApiCommand extends BaseCommand{[a6_0x26cc9a(0x1ef)]=a6_0x26cc9a(0x1c9);[a6_0x26cc9a(0x1f4)]=a6_0x26cc9a(0x1ed);[a6_0x26cc9a(0x1fb)](_0x41adf4){const _0x7e3f04=a6_0x26cc9a,{args:_0x3fcfe0,options:_0x1dd2f2}=_0x41adf4,_0x402b73=_0x1dd2f2;if(_0x3fcfe0['length']===0x0)return _0x7e3f04(0x1c1);const _0x448cf4=_0x3fcfe0[0x0];if(!_0x448cf4[_0x7e3f04(0x1c3)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x448cf4;const _0x5a3ac5=_0x402b73[_0x7e3f04(0x1de)],_0x2adfa3=_0x402b73[_0x7e3f04(0x1ce)];if(_0x5a3ac5&&_0x2adfa3)return _0x7e3f04(0x1fc);const _0x1a20ea=_0x402b73[_0x7e3f04(0x1f2)]||'GET',_0x3909e8=[_0x7e3f04(0x1c2),_0x7e3f04(0x1cc),'PUT',_0x7e3f04(0x1c5),'PATCH'];if(!_0x3909e8[_0x7e3f04(0x1ff)](_0x1a20ea[_0x7e3f04(0x1f0)]()))return _0x7e3f04(0x1e3)+_0x1a20ea+_0x7e3f04(0x1e7)+_0x3909e8[_0x7e3f04(0x1c0)](',\x20');const _0x56c962=_0x402b73['type']||'td',_0x28565e=['td',_0x7e3f04(0x1f5),'workflow','trino',_0x7e3f04(0x1d1),_0x7e3f04(0x200)];if(!_0x28565e[_0x7e3f04(0x1ff)](_0x56c962))return _0x7e3f04(0x1e4)+_0x56c962+_0x7e3f04(0x1dd)+_0x28565e['join'](',\x20');return undefined;}async[a6_0x26cc9a(0x1d5)](_0xc78941){const _0xa30ca9=a6_0x26cc9a,{options:_0x50c21d,args:_0x561dea,tdx:_0x1677f5}=_0xc78941,_0x47e7ee=_0x50c21d,_0x19523b=_0x561dea[0x0],_0x2454a8=(_0x47e7ee[_0xa30ca9(0x1f2)]||_0xa30ca9(0x1c2))[_0xa30ca9(0x1f0)](),_0x231a51=_0x47e7ee[_0xa30ca9(0x1de)],_0x2193b6=_0x47e7ee['file'],_0x3b6210=_0x47e7ee[_0xa30ca9(0x1c7)],_0x56cdb0=_0x47e7ee[_0xa30ca9(0x1d3)]||'td';try{const _0x5c1f46={};if(_0x3b6210){const _0x2980b0=Array['isArray'](_0x3b6210)?_0x3b6210:[_0x3b6210];for(const _0x4b9266 of _0x2980b0){const [_0x3d30ff,_0x3eb570]=parseHeader(_0x4b9266);_0x5c1f46[_0x3d30ff]=_0x3eb570;}}let _0x4eb252;if(_0x231a51)_0x4eb252=_0x231a51;else{if(_0x2193b6)try{_0x4eb252=RawAPI[_0xa30ca9(0x1cd)](_0x2193b6);}catch(_0x253ba2){return console[_0xa30ca9(0x1e9)]('Error:\x20'+(_0x253ba2 instanceof Error?_0x253ba2[_0xa30ca9(0x1cf)]:String(_0x253ba2))),0x1;}}const _0x7beec8={'method':_0x2454a8,'apiType':_0x56cdb0,'includeHeaders':_0x50c21d[_0xa30ca9(0x1cb)]};_0x4eb252&&(_0x7beec8['body']=_0x4eb252);Object[_0xa30ca9(0x1f3)](_0x5c1f46)[_0xa30ca9(0x1c6)]>0x0&&(_0x7beec8[_0xa30ca9(0x1d8)]=_0x5c1f46);if(_0x50c21d['verbose']){const _0x5e6587=resolveSite(_0x50c21d['site']),_0x4baf15=getEndpoint(_0x5e6587,_0x56cdb0),_0x561b7d=''+_0x4baf15+_0x19523b;console['error']('>\x20'+_0x2454a8+'\x20'+_0x561b7d);const _0x220cf9=getAuthHeaders(_0x5e6587),_0xf941d4={..._0x220cf9,..._0x5c1f46};for(const [_0x1c3bb6,_0x191403]of Object['entries'](_0xf941d4)){!isSensitiveHeader(_0x1c3bb6)&&console[_0xa30ca9(0x1e9)]('>\x20'+_0x1c3bb6+':\x20'+_0x191403);}_0x4eb252&&console['error']('>'),console[_0xa30ca9(0x1e9)]('');}const _0x82b68a=await _0x1677f5['api'][_0xa30ca9(0x1dc)](_0x19523b,_0x7beec8);if(_0x50c21d[_0xa30ca9(0x1cb)]&&_0x82b68a[_0xa30ca9(0x1d8)]){console[_0xa30ca9(0x1e9)](_0xa30ca9(0x1e8)+_0x82b68a[_0xa30ca9(0x1d2)]);for(const [_0x59ceaa,_0x1aaa64]of Object['entries'](_0x82b68a[_0xa30ca9(0x1d8)])){!isSensitiveHeader(_0x59ceaa)&&console['error']('<\x20'+_0x59ceaa+':\x20'+_0x1aaa64);}console[_0xa30ca9(0x1e9)]('');}const _0x55a113=Boolean(_0x50c21d[_0xa30ca9(0x1ee)]),_0x4d0aef={'color':_0x50c21d[_0xa30ca9(0x1f6)],'noColor':_0x50c21d['noColor']||_0x55a113&&!_0x50c21d[_0xa30ca9(0x1f6)]},_0x2f4875=colorizeJSON(_0x82b68a['data'],_0x4d0aef);return _0x50c21d[_0xa30ca9(0x1ee)]?(writeFileSync(_0x50c21d[_0xa30ca9(0x1ee)],_0x2f4875),console[_0xa30ca9(0x1e9)]('Results\x20saved\x20to\x20'+_0x50c21d[_0xa30ca9(0x1ee)])):console[_0xa30ca9(0x1ec)](_0x2f4875),0x0;}catch(_0x75ca2c){return _0x75ca2c instanceof Error?(console[_0xa30ca9(0x1e9)](_0xa30ca9(0x1f8)+_0x75ca2c['message']),_0x50c21d[_0xa30ca9(0x1cb)]&&_0x75ca2c[_0xa30ca9(0x1fa)]&&console['error'](_0xa30ca9(0x1d4)+_0x75ca2c[_0xa30ca9(0x1fa)])):console['error']('Error:\x20'+String(_0x75ca2c)),0x1;}}}
1
+ const a6_0x53ca8e=a6_0x2e2d;(function(_0x1031e0,_0x30f156){const _0x154107=a6_0x2e2d,_0x126847=_0x1031e0();while(!![]){try{const _0x4054e1=parseInt(_0x154107(0x9f))/0x1+parseInt(_0x154107(0xa0))/0x2*(parseInt(_0x154107(0x8f))/0x3)+parseInt(_0x154107(0x8d))/0x4+-parseInt(_0x154107(0xa2))/0x5*(-parseInt(_0x154107(0x74))/0x6)+parseInt(_0x154107(0xad))/0x7+-parseInt(_0x154107(0x7f))/0x8+-parseInt(_0x154107(0x88))/0x9;if(_0x4054e1===_0x30f156)break;else _0x126847['push'](_0x126847['shift']());}catch(_0x321073){_0x126847['push'](_0x126847['shift']());}}}(a6_0xe639,0x90229));function a6_0x2e2d(_0x41e2b2,_0x23eb7e){_0x41e2b2=_0x41e2b2-0x73;const _0xe639d0=a6_0xe639();let _0x2e2d1a=_0xe639d0[_0x41e2b2];return _0x2e2d1a;}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_0xe639(){const _0x1602ad=['741849qUrmpi','readBodyFromFile','indexOf','status','join','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','cookie','trino','execute','authorization','\x22.\x20','DELETE','llm','.\x20Valid\x20methods:\x20','name','Invalid\x20API\x20type:\x20','171385YhZxIe','2MgvxAz','data','4847255wJQBGP','entries','site','PUT','api','message','output','Invalid\x20header\x20format:\x20\x22','startsWith','\x0aStack\x20trace:\x0a','Error:\x20','3575880FPGjGq','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','x-xsrf-token','llm-proxy','headers','file','Invalid\x20HTTP\x20method:\x20','Results\x20saved\x20to\x20','verbose','6PSvQLf','substring','set-cookie','type','Endpoint\x20must\x20start\x20with\x20/:\x20','noColor','log','length','PATCH','GET','color','930480xAbPMc','workflow','validate','toLowerCase','set-cookie2','error','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','cdp','trim','11649663jziDEP','toUpperCase','x-trino-user','body','stack','408540TOshep','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22'];a6_0xe639=function(){return _0x1602ad;};return a6_0xe639();}const SENSITIVE_HEADERS=new Set([a6_0x53ca8e(0x98),'proxy-authorization',a6_0x53ca8e(0x95),a6_0x53ca8e(0x76),a6_0x53ca8e(0x83),a6_0x53ca8e(0xaf),'x-auth-token',a6_0x53ca8e(0x8a)]);function isSensitiveHeader(_0x4c79be){const _0x63da87=a6_0x53ca8e;return SENSITIVE_HEADERS['has'](_0x4c79be[_0x63da87(0x82)]());}function parseHeader(_0x48a0e4){const _0x5b7d74=a6_0x53ca8e,_0x5be614=_0x48a0e4[_0x5b7d74(0x91)](':');if(_0x5be614===-0x1)throw new Error(_0x5b7d74(0xa9)+_0x48a0e4+_0x5b7d74(0x99)+_0x5b7d74(0x8e));const _0x620a85=_0x48a0e4['substring'](0x0,_0x5be614)[_0x5b7d74(0x87)](),_0x3fd37c=_0x48a0e4[_0x5b7d74(0x75)](_0x5be614+0x1)[_0x5b7d74(0x87)]();if(!_0x620a85)throw new Error(_0x5b7d74(0xae)+_0x48a0e4+'\x22');return[_0x620a85,_0x3fd37c];}export class ApiCommand extends BaseCommand{[a6_0x53ca8e(0x9d)]=a6_0x53ca8e(0xa6);['description']='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a6_0x53ca8e(0x81)](_0x4c84a7){const _0x406ed7=a6_0x53ca8e,{args:_0xb6388b,options:_0xacb5d9}=_0x4c84a7,_0x6dcb8e=_0xacb5d9;if(_0xb6388b[_0x406ed7(0x7b)]===0x0)return _0x406ed7(0x94);const _0x1e3936=_0xb6388b[0x0];if(!_0x1e3936[_0x406ed7(0xaa)]('/'))return _0x406ed7(0x78)+_0x1e3936;const _0x7289ec=_0x6dcb8e[_0x406ed7(0xa1)],_0x272e33=_0x6dcb8e[_0x406ed7(0xb2)];if(_0x7289ec&&_0x272e33)return _0x406ed7(0x85);const _0x40d4a5=_0x6dcb8e['method']||'GET',_0x1616a1=[_0x406ed7(0x7d),'POST',_0x406ed7(0xa5),_0x406ed7(0x9a),_0x406ed7(0x7c)];if(!_0x1616a1['includes'](_0x40d4a5[_0x406ed7(0x89)]()))return _0x406ed7(0xb3)+_0x40d4a5+_0x406ed7(0x9c)+_0x1616a1[_0x406ed7(0x93)](',\x20');const _0x54bc36=_0x6dcb8e[_0x406ed7(0x77)]||'td',_0x370dfd=['td',_0x406ed7(0x86),_0x406ed7(0x80),_0x406ed7(0x96),_0x406ed7(0x9b),_0x406ed7(0xb0)];if(!_0x370dfd['includes'](_0x54bc36))return _0x406ed7(0x9e)+_0x54bc36+'.\x20Valid\x20types:\x20'+_0x370dfd[_0x406ed7(0x93)](',\x20');return undefined;}async[a6_0x53ca8e(0x97)](_0xbcdc5d){const _0x51aa12=a6_0x53ca8e,{options:_0x116221,args:_0x2b5b3f,tdx:_0x2f4897}=_0xbcdc5d,_0x5537f6=_0x116221,_0x23934f=_0x2b5b3f[0x0],_0x416249=(_0x5537f6['method']||'GET')[_0x51aa12(0x89)](),_0x1a14f6=_0x5537f6[_0x51aa12(0xa1)],_0x4c6751=_0x5537f6['file'],_0x53b2ef=_0x5537f6['header'],_0x1123df=_0x5537f6[_0x51aa12(0x77)]||'td';try{const _0x3fad91={};if(_0x53b2ef){const _0x3a0a85=Array['isArray'](_0x53b2ef)?_0x53b2ef:[_0x53b2ef];for(const _0x2befb5 of _0x3a0a85){const [_0x352d5a,_0x2296a1]=parseHeader(_0x2befb5);_0x3fad91[_0x352d5a]=_0x2296a1;}}let _0x5680c2;if(_0x1a14f6)_0x5680c2=_0x1a14f6;else{if(_0x4c6751)try{_0x5680c2=RawAPI[_0x51aa12(0x90)](_0x4c6751);}catch(_0x3aaa83){return console[_0x51aa12(0x84)]('Error:\x20'+(_0x3aaa83 instanceof Error?_0x3aaa83['message']:String(_0x3aaa83))),0x1;}}const _0x2d4541={'method':_0x416249,'apiType':_0x1123df,'includeHeaders':_0x116221[_0x51aa12(0x73)]};_0x5680c2&&(_0x2d4541[_0x51aa12(0x8b)]=_0x5680c2);Object['keys'](_0x3fad91)[_0x51aa12(0x7b)]>0x0&&(_0x2d4541['headers']=_0x3fad91);if(_0x116221[_0x51aa12(0x73)]){const _0x2d17c3=resolveSite(_0x116221[_0x51aa12(0xa4)]),_0x47acf1=getEndpoint(_0x2d17c3,_0x1123df),_0x4378de=''+_0x47acf1+_0x23934f;console[_0x51aa12(0x84)]('>\x20'+_0x416249+'\x20'+_0x4378de);const _0x425125=getAuthHeaders(_0x2d17c3),_0x59ccea={..._0x425125,..._0x3fad91};for(const [_0x40cdaf,_0x5739b8]of Object[_0x51aa12(0xa3)](_0x59ccea)){!isSensitiveHeader(_0x40cdaf)&&console[_0x51aa12(0x84)]('>\x20'+_0x40cdaf+':\x20'+_0x5739b8);}_0x5680c2&&console[_0x51aa12(0x84)]('>'),console['error']('');}const _0x2da978=await _0x2f4897['api']['request'](_0x23934f,_0x2d4541);if(_0x116221[_0x51aa12(0x73)]&&_0x2da978[_0x51aa12(0xb1)]){console[_0x51aa12(0x84)]('<\x20HTTP/1.1\x20'+_0x2da978[_0x51aa12(0x92)]);for(const [_0x450a41,_0x593b1f]of Object[_0x51aa12(0xa3)](_0x2da978[_0x51aa12(0xb1)])){!isSensitiveHeader(_0x450a41)&&console[_0x51aa12(0x84)]('<\x20'+_0x450a41+':\x20'+_0x593b1f);}console[_0x51aa12(0x84)]('');}const _0x76e01c=Boolean(_0x116221[_0x51aa12(0xa8)]),_0x4bb86b={'color':_0x116221[_0x51aa12(0x7e)],'noColor':_0x116221[_0x51aa12(0x79)]||_0x76e01c&&!_0x116221[_0x51aa12(0x7e)]},_0x9bc241=colorizeJSON(_0x2da978['data'],_0x4bb86b);return _0x116221[_0x51aa12(0xa8)]?(writeFileSync(_0x116221[_0x51aa12(0xa8)],_0x9bc241),console[_0x51aa12(0x84)](_0x51aa12(0xb4)+_0x116221['output'])):console[_0x51aa12(0x7a)](_0x9bc241),0x0;}catch(_0x547520){return _0x547520 instanceof Error?(console[_0x51aa12(0x84)](_0x51aa12(0xac)+_0x547520[_0x51aa12(0xa7)]),_0x116221['verbose']&&_0x547520[_0x51aa12(0x8c)]&&console[_0x51aa12(0x84)](_0x51aa12(0xab)+_0x547520[_0x51aa12(0x8c)])):console[_0x51aa12(0x84)](_0x51aa12(0xac)+String(_0x547520)),0x1;}}}
@@ -1 +1 @@
1
- const a7_0x557d87=a7_0x4452;(function(_0x52f4e6,_0x4cd77d){const _0x847e35=a7_0x4452,_0x5a0f4b=_0x52f4e6();while(!![]){try{const _0x4ea839=parseInt(_0x847e35(0xaa))/0x1*(parseInt(_0x847e35(0xa6))/0x2)+parseInt(_0x847e35(0xaf))/0x3+parseInt(_0x847e35(0xa1))/0x4*(-parseInt(_0x847e35(0x95))/0x5)+-parseInt(_0x847e35(0xba))/0x6+-parseInt(_0x847e35(0x8e))/0x7+parseInt(_0x847e35(0x91))/0x8+-parseInt(_0x847e35(0xab))/0x9;if(_0x4ea839===_0x4cd77d)break;else _0x5a0f4b['push'](_0x5a0f4b['shift']());}catch(_0x1d9cb1){_0x5a0f4b['push'](_0x5a0f4b['shift']());}}}(a7_0x3f6d,0x8a49c));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_0x3d9e84 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';function a7_0x4452(_0x45ea83,_0x4355eb){_0x45ea83=_0x45ea83-0x8e;const _0x3f6d70=a7_0x3f6d();let _0x4452f1=_0x3f6d70[_0x45ea83];return _0x4452f1;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x4afca1 from'chalk';function a7_0x3f6d(){const _0x420d27=['5765417OTfnao','trim','✗\x20Validation\x20failed:\x20','3646312XTzUct','auth:setup','You\x20can\x20find\x20your\x20API\x20key\x20at:','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','23575ofzvkP','last_name','text','name','logLevel','log','Setup\x20API\x20key\x20authentication\x20interactively','Select\x20your\x20Treasure\x20Data\x20site:','profile','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','red','getUserInfo','492oJagDK','/app/mp/ak','Read\x20credential\x20from\x20','auth','execute','2248914ARrCbE','password','\x20(site:\x20','customSite','1PTjDSP','2788902LoMtMB','other','green','No\x20credential\x20found','2126016eSZmJG','\x20--profile\x20','jobs','warn','tdx\x20profile:\x20','User:\x20','ERROR','tdx:\x20auth\x20setup','first_name','Enter\x20site\x20name:','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','54216ZopUTb','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','yellow','\x20\x20tdx','tdx:\x20auth\x20clear','✓\x20Default\x20site\x20set\x20to\x20','Remove\x20API\x20key\x20from\x20system\x20keychain','create','\x20for\x20profile:\x20','email','\x0aSetup\x20cancelled','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','bold','select','\x27\x20registered','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','us01','join','site','N/A','No\x20API\x20key\x20found\x20in\x20keychain','Enter\x20your\x20TD\x20API\x20key:','✓\x20Profile\x20\x27','description','message','\x20(profile:\x20','status','error','Name:\x20'];a7_0x3f6d=function(){return _0x420d27;};return a7_0x3f6d();}export class AuthSetupCommand extends BaseCommand{[a7_0x557d87(0x98)]=a7_0x557d87(0x92);[a7_0x557d87(0xd1)]=a7_0x557d87(0x9b);async['execute'](_0x431ada){const _0x2952b7=a7_0x557d87,{options:_0x36ac56}=_0x431ada,_0x14d5de=_0x36ac56[_0x2952b7(0x9d)];console['log'](a7_0x4afca1[_0x2952b7(0xc6)](_0x2952b7(0xb6)));const _0x1721c5=_0x36ac56['site']||_0x2952b7(0xca),{choices:_0xceabdc,initialIndex:_0x40953f}=buildSiteChoices(_0x1721c5),_0x45d82e=_0x14d5de?_0x2952b7(0xbb)+_0x14d5de+'):':_0x2952b7(0x9c),_0x217d88=await a7_0x3d9e84({'type':_0x2952b7(0xc7),'name':'site','message':_0x45d82e,'choices':_0xceabdc,'initial':_0x40953f});if(!_0x217d88[_0x2952b7(0xcc)])return console[_0x2952b7(0x9a)](_0x2952b7(0xc4)),0x1;let _0x1e567b;if(_0x217d88[_0x2952b7(0xcc)]===_0x2952b7(0xac)){const _0x2ba649=await a7_0x3d9e84({'type':_0x2952b7(0x97),'name':'customSite','message':_0x2952b7(0xb8),'initial':'us01','validate':_0x297988=>{const _0x2fe38e=_0x2952b7;if(!_0x297988||!_0x297988[_0x2fe38e(0x8f)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x297988[_0x2fe38e(0x8f)]()))return _0x2fe38e(0x94);return!![];}});if(!_0x2ba649['customSite'])return console[_0x2952b7(0x9a)]('\x0aSetup\x20cancelled'),0x1;_0x1e567b=_0x2ba649[_0x2952b7(0xa9)];}else _0x1e567b=_0x217d88[_0x2952b7(0xcc)];const _0x3b458e=resolveSite(_0x1e567b);console[_0x2952b7(0x9a)]('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x3b458e),console['log'](_0x2952b7(0x93)),console['log']('\x20\x20'+getConsoleUrl(_0x3b458e,_0x2952b7(0xa2)));const _0x56c363=await a7_0x3d9e84({'type':_0x2952b7(0xa7),'name':'apiKey','message':_0x2952b7(0xcf),'validate':_0x597377=>{const _0x510cca=_0x2952b7;if(!_0x597377||!_0x597377[_0x510cca(0x8f)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x56c363['apiKey'])return console[_0x2952b7(0x9a)](_0x2952b7(0xc4)),0x1;const _0x290b3e=_0x56c363['apiKey'];console[_0x2952b7(0x9a)]('Validating\x20API\x20key...');try{const _0x1d717e=TDX[_0x2952b7(0xc1)]({'site':_0x3b458e,'apiKey':_0x290b3e['trim'](),'logLevel':_0x36ac56[_0x2952b7(0x99)]??LogLevel[_0x2952b7(0xb5)]}),_0x48e495=await _0x1d717e[_0x2952b7(0xb1)][_0x2952b7(0xa0)]();console[_0x2952b7(0x9a)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x48e495[_0x2952b7(0xc3)]+')');const _0x243d4b=await isKeychainAvailable();_0x243d4b?(await saveAPIKeyAsync(_0x290b3e[_0x2952b7(0x8f)](),_0x3b458e,_0x14d5de),console[_0x2952b7(0x9a)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x14d5de?_0x2952b7(0xd3)+_0x14d5de+')':''))):(console[_0x2952b7(0xb2)](a7_0x4afca1[_0x2952b7(0xbc)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x2952b7(0xb2)](a7_0x4afca1[_0x2952b7(0xbc)](_0x2952b7(0x9e))));if(_0x14d5de){const _0x5d2144={'site':_0x3b458e};saveProfileToUserConfig(_0x14d5de,_0x5d2144),console[_0x2952b7(0x9a)](_0x2952b7(0xd0)+_0x14d5de+_0x2952b7(0xc8));}else saveDefaultSiteToUserConfig(_0x3b458e),console['log'](_0x2952b7(0xbf)+_0x3b458e);const _0x2d3103=_0x14d5de?_0x2952b7(0xb0)+_0x14d5de:'';return console[_0x2952b7(0x9a)](),console[_0x2952b7(0x9a)](_0x2952b7(0xb9)),console[_0x2952b7(0x9a)](_0x2952b7(0xbd)+_0x2d3103+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log']('\x20\x20tdx'+_0x2d3103+_0x2952b7(0xc9)),0x0;}catch(_0x1451b2){if(_0x1451b2 instanceof HTTPClientError&&_0x1451b2[_0x2952b7(0xd4)]===0x191)return printAuthError(_0x1451b2),0x1;return console[_0x2952b7(0xd5)](a7_0x4afca1[_0x2952b7(0x9f)](_0x2952b7(0x90)+(_0x1451b2 instanceof Error?_0x1451b2[_0x2952b7(0xd2)]:String(_0x1451b2)))),console[_0x2952b7(0xd5)](_0x2952b7(0xc5)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x557d87(0x98)]=a7_0x557d87(0xa4);[a7_0x557d87(0xd1)]='Show\x20authentication\x20status\x20and\x20validate\x20API\x20key';async[a7_0x557d87(0xa5)](_0x268a93){const _0x5e7ede=a7_0x557d87,{options:_0x2d87e1,tdx:_0x2c764a}=_0x268a93,_0xdfcbe2=_0x2d87e1[_0x5e7ede(0xcc)],_0x2d47cf=_0x2d87e1[_0x5e7ede(0x9d)],_0x360186=_0x2d47cf?_0x2d47cf:_0x5e7ede(0xcd);console[_0x5e7ede(0x9a)](_0x5e7ede(0xb3)+_0x360186+_0x5e7ede(0xa8)+_0xdfcbe2+')');const _0x1a1ca1=await resolveAPIKeyAsync(_0xdfcbe2,_0x2d47cf);if(_0x1a1ca1){const {source:_0x3b3393,isDeprecated:_0x30230d}=_0x1a1ca1,_0x5743b0=_0x5e7ede(0xa3)+_0x3b3393;console['log'](_0x30230d?a7_0x4afca1[_0x5e7ede(0xbc)](_0x5743b0):_0x5743b0);}else console['log'](a7_0x4afca1['yellow'](_0x5e7ede(0xae)));try{const _0x5a49b8=await _0x2c764a['jobs'][_0x5e7ede(0xa0)]();return console[_0x5e7ede(0x9a)](a7_0x4afca1[_0x5e7ede(0xad)]('✓\x20Authentication\x20successful\x0a')),console[_0x5e7ede(0x9a)](_0x5e7ede(0xb4)+_0x5a49b8['email']),(_0x5a49b8[_0x5e7ede(0xb7)]||_0x5a49b8['last_name'])&&console[_0x5e7ede(0x9a)](_0x5e7ede(0xd6)+[_0x5a49b8[_0x5e7ede(0xb7)],_0x5a49b8[_0x5e7ede(0x96)]]['filter'](Boolean)[_0x5e7ede(0xcb)]('\x20')),0x0;}catch(_0x5f3007){return _0x5f3007 instanceof HTTPClientError&&_0x5f3007[_0x5e7ede(0xd4)]===0x191?printAuthError(_0x5f3007,!![],_0x2d47cf):console[_0x5e7ede(0xd5)](a7_0x4afca1[_0x5e7ede(0x9f)](_0x5e7ede(0x90)+(_0x5f3007 instanceof Error?_0x5f3007[_0x5e7ede(0xd2)]:String(_0x5f3007)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x557d87(0x98)]='auth:clear';[a7_0x557d87(0xd1)]=a7_0x557d87(0xc0);async[a7_0x557d87(0xa5)](_0xe89a39){const _0x1dd781=a7_0x557d87,{options:_0x52da27}=_0xe89a39,_0x13c4fd=_0x52da27[_0x1dd781(0x9d)];console[_0x1dd781(0x9a)](a7_0x4afca1[_0x1dd781(0xc6)](_0x1dd781(0xbe)));const _0x26144f=await isKeychainAvailable();if(!_0x26144f)return console[_0x1dd781(0xd5)](a7_0x4afca1[_0x1dd781(0x9f)]('System\x20keychain\x20is\x20not\x20available')),0x1;const _0x152a77=await deleteKeychainAPIKey(_0x13c4fd);return _0x152a77?(clearCredentialCache(),console['log']('✓\x20API\x20key\x20removed\x20from\x20keychain'+(_0x13c4fd?_0x1dd781(0xd3)+_0x13c4fd+')':'')),0x0):(console[_0x1dd781(0x9a)](_0x1dd781(0xce)+(_0x13c4fd?_0x1dd781(0xc2)+_0x13c4fd:'')),0x1);}}
1
+ const a7_0x124a88=a7_0x396f;(function(_0x1b3152,_0x2275d0){const _0x3b10bc=a7_0x396f,_0x4d1838=_0x1b3152();while(!![]){try{const _0x254fac=-parseInt(_0x3b10bc(0x16e))/0x1*(parseInt(_0x3b10bc(0x16c))/0x2)+-parseInt(_0x3b10bc(0x18b))/0x3+parseInt(_0x3b10bc(0x169))/0x4*(-parseInt(_0x3b10bc(0x161))/0x5)+parseInt(_0x3b10bc(0x199))/0x6+-parseInt(_0x3b10bc(0x19a))/0x7*(-parseInt(_0x3b10bc(0x17f))/0x8)+parseInt(_0x3b10bc(0x1a1))/0x9*(-parseInt(_0x3b10bc(0x1ab))/0xa)+parseInt(_0x3b10bc(0x16d))/0xb;if(_0x254fac===_0x2275d0)break;else _0x4d1838['push'](_0x4d1838['shift']());}catch(_0x49b8fc){_0x4d1838['push'](_0x4d1838['shift']());}}}(a7_0x2727,0xe14f0));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';function a7_0x396f(_0x40181e,_0x1d1001){_0x40181e=_0x40181e-0x161;const _0x272796=a7_0x2727();let _0x396fdc=_0x272796[_0x40181e];return _0x396fdc;}import a7_0x19db2c from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';function a7_0x2727(){const _0x49c83a=['API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','2IuDfFq','39822981swwfEH','562381mAGKfH','\x20(site:\x20','error','User:\x20','No\x20credential\x20found','logLevel','us01','filter','✓\x20Authentication\x20successful\x0a','Remove\x20API\x20key\x20from\x20system\x20keychain','API\x20key\x20cannot\x20be\x20empty','Enter\x20site\x20name:','\x20(profile:\x20','/app/mp/ak','first_name','Select\x20your\x20Treasure\x20Data\x20site:','customSite','36352XNerOf','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Name:\x20','\x20\x20tdx','tdx:\x20auth\x20clear','warn','red','text','tdx\x20profile:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','Setup\x20API\x20key\x20authentication\x20interactively','2507694bpMUoP','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','trim','\x20for\x20profile:\x20','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','System\x20keychain\x20is\x20not\x20available','getUserInfo','password','test','✓\x20Default\x20site\x20set\x20to\x20','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','status','ERROR','2879598xcMFsy','602rnGMKq','No\x20API\x20key\x20found\x20in\x20keychain','profile','execute','green','description','\x27\x20registered','9fLrXcV','log','email','apiKey','yellow','site','You\x20can\x20find\x20your\x20API\x20key\x20at:','message','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','other','7956660pUumMH','✗\x20Validation\x20failed:\x20','✓\x20API\x20key\x20removed\x20from\x20keychain','✓\x20Profile\x20\x27','auth','5XizdEG','auth:setup','Enter\x20your\x20TD\x20API\x20key:','last_name','\x20--profile\x20','bold','name','Site\x20name\x20cannot\x20be\x20empty','5496716UWdEvx','Setting\x20up\x20authentication\x20for\x20site:\x20'];a7_0x2727=function(){return _0x49c83a;};return a7_0x2727();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x1d493b from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x124a88(0x167)]=a7_0x124a88(0x162);['description']=a7_0x124a88(0x18a);async[a7_0x124a88(0x19d)](_0x254963){const _0x4bcdc1=a7_0x124a88,{options:_0x3d669b}=_0x254963,_0x35b101=_0x3d669b[_0x4bcdc1(0x19c)];console[_0x4bcdc1(0x1a2)](a7_0x1d493b[_0x4bcdc1(0x166)]('tdx:\x20auth\x20setup'));const _0x535f00=_0x3d669b[_0x4bcdc1(0x1a6)]||_0x4bcdc1(0x174),{choices:_0x4e99ff,initialIndex:_0xe11650}=buildSiteChoices(_0x535f00),_0x356145=_0x35b101?_0x4bcdc1(0x190)+_0x35b101+'):':_0x4bcdc1(0x17d),_0x50b900=await a7_0x19db2c({'type':'select','name':_0x4bcdc1(0x1a6),'message':_0x356145,'choices':_0x4e99ff,'initial':_0xe11650});if(!_0x50b900[_0x4bcdc1(0x1a6)])return console[_0x4bcdc1(0x1a2)]('\x0aSetup\x20cancelled'),0x1;let _0x4af235;if(_0x50b900[_0x4bcdc1(0x1a6)]===_0x4bcdc1(0x1aa)){const _0x2d827e=await a7_0x19db2c({'type':_0x4bcdc1(0x186),'name':_0x4bcdc1(0x17e),'message':_0x4bcdc1(0x179),'initial':_0x4bcdc1(0x174),'validate':_0x47188a=>{const _0xac399f=_0x4bcdc1;if(!_0x47188a||!_0x47188a[_0xac399f(0x18e)]())return _0xac399f(0x168);if(!/^[a-z0-9-]+$/[_0xac399f(0x194)](_0x47188a['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x2d827e[_0x4bcdc1(0x17e)])return console[_0x4bcdc1(0x1a2)]('\x0aSetup\x20cancelled'),0x1;_0x4af235=_0x2d827e[_0x4bcdc1(0x17e)];}else _0x4af235=_0x50b900[_0x4bcdc1(0x1a6)];const _0x457b48=resolveSite(_0x4af235);console['log'](_0x4bcdc1(0x16a)+_0x457b48),console[_0x4bcdc1(0x1a2)](_0x4bcdc1(0x1a7)),console['log']('\x20\x20'+getConsoleUrl(_0x457b48,_0x4bcdc1(0x17b)));const _0x52a004=await a7_0x19db2c({'type':_0x4bcdc1(0x193),'name':_0x4bcdc1(0x1a4),'message':_0x4bcdc1(0x163),'validate':_0x59e50f=>{const _0x2416a6=_0x4bcdc1;if(!_0x59e50f||!_0x59e50f[_0x2416a6(0x18e)]())return _0x2416a6(0x178);return!![];}});if(!_0x52a004[_0x4bcdc1(0x1a4)])return console[_0x4bcdc1(0x1a2)]('\x0aSetup\x20cancelled'),0x1;const _0x31f1ec=_0x52a004[_0x4bcdc1(0x1a4)];console[_0x4bcdc1(0x1a2)]('Validating\x20API\x20key...');try{const _0x3ce586=TDX['create']({'site':_0x457b48,'apiKey':_0x31f1ec[_0x4bcdc1(0x18e)](),'logLevel':_0x3d669b[_0x4bcdc1(0x173)]??LogLevel[_0x4bcdc1(0x198)]}),_0x2cf758=await _0x3ce586['jobs'][_0x4bcdc1(0x192)]();console[_0x4bcdc1(0x1a2)](_0x4bcdc1(0x18c)+_0x2cf758[_0x4bcdc1(0x1a3)]+')');const _0xc84c44=await isKeychainAvailable();_0xc84c44?(await saveAPIKeyAsync(_0x31f1ec[_0x4bcdc1(0x18e)](),_0x457b48,_0x35b101),console[_0x4bcdc1(0x1a2)](_0x4bcdc1(0x189)+(_0x35b101?'\x20(profile:\x20'+_0x35b101+')':''))):(console['warn'](a7_0x1d493b[_0x4bcdc1(0x1a5)](_0x4bcdc1(0x180))),console[_0x4bcdc1(0x184)](a7_0x1d493b[_0x4bcdc1(0x1a5)](_0x4bcdc1(0x1a9))));if(_0x35b101){const _0x414135={'site':_0x457b48};saveProfileToUserConfig(_0x35b101,_0x414135),console[_0x4bcdc1(0x1a2)](_0x4bcdc1(0x1ae)+_0x35b101+_0x4bcdc1(0x1a0));}else saveDefaultSiteToUserConfig(_0x457b48),console[_0x4bcdc1(0x1a2)](_0x4bcdc1(0x195)+_0x457b48);const _0x4c84ec=_0x35b101?_0x4bcdc1(0x165)+_0x35b101:'';return console[_0x4bcdc1(0x1a2)](),console['log'](_0x4bcdc1(0x196)),console[_0x4bcdc1(0x1a2)](_0x4bcdc1(0x182)+_0x4c84ec+_0x4bcdc1(0x18d)),console['log']('\x20\x20tdx'+_0x4c84ec+_0x4bcdc1(0x188)),0x0;}catch(_0x496727){if(_0x496727 instanceof HTTPClientError&&_0x496727[_0x4bcdc1(0x197)]===0x191)return printAuthError(_0x496727),0x1;return console[_0x4bcdc1(0x170)](a7_0x1d493b[_0x4bcdc1(0x185)]('✗\x20Validation\x20failed:\x20'+(_0x496727 instanceof Error?_0x496727[_0x4bcdc1(0x1a8)]:String(_0x496727)))),console['error'](_0x4bcdc1(0x16b)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x124a88(0x167)]=a7_0x124a88(0x1af);['description']='Show\x20authentication\x20status\x20and\x20validate\x20API\x20key';async[a7_0x124a88(0x19d)](_0x4ad555){const _0x3048ce=a7_0x124a88,{options:_0x3220b4,tdx:_0x5a993d}=_0x4ad555,_0x10b68e=_0x3220b4[_0x3048ce(0x1a6)],_0x225c9f=_0x3220b4[_0x3048ce(0x19c)],_0x3acafa=_0x225c9f?_0x225c9f:'N/A';console[_0x3048ce(0x1a2)](_0x3048ce(0x187)+_0x3acafa+_0x3048ce(0x16f)+_0x10b68e+')');const _0x12e29c=await resolveAPIKeyAsync(_0x10b68e,_0x225c9f);if(_0x12e29c){const {source:_0x5bdaa8,isDeprecated:_0x4eb143}=_0x12e29c,_0x498b6e='Read\x20credential\x20from\x20'+_0x5bdaa8;console[_0x3048ce(0x1a2)](_0x4eb143?a7_0x1d493b['yellow'](_0x498b6e):_0x498b6e);}else console[_0x3048ce(0x1a2)](a7_0x1d493b['yellow'](_0x3048ce(0x172)));try{const _0x1f2869=await _0x5a993d['jobs'][_0x3048ce(0x192)]();return console[_0x3048ce(0x1a2)](a7_0x1d493b[_0x3048ce(0x19e)](_0x3048ce(0x176))),console['log'](_0x3048ce(0x171)+_0x1f2869['email']),(_0x1f2869['first_name']||_0x1f2869['last_name'])&&console[_0x3048ce(0x1a2)](_0x3048ce(0x181)+[_0x1f2869[_0x3048ce(0x17c)],_0x1f2869[_0x3048ce(0x164)]][_0x3048ce(0x175)](Boolean)['join']('\x20')),0x0;}catch(_0x108aad){return _0x108aad instanceof HTTPClientError&&_0x108aad[_0x3048ce(0x197)]===0x191?printAuthError(_0x108aad,!![],_0x225c9f):console[_0x3048ce(0x170)](a7_0x1d493b[_0x3048ce(0x185)](_0x3048ce(0x1ac)+(_0x108aad instanceof Error?_0x108aad['message']:String(_0x108aad)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x124a88(0x167)]='auth:clear';[a7_0x124a88(0x19f)]=a7_0x124a88(0x177);async[a7_0x124a88(0x19d)](_0x310073){const _0x2833d6=a7_0x124a88,{options:_0x37680f}=_0x310073,_0x4309e4=_0x37680f[_0x2833d6(0x19c)];console['log'](a7_0x1d493b[_0x2833d6(0x166)](_0x2833d6(0x183)));const _0x2be168=await isKeychainAvailable();if(!_0x2be168)return console['error'](a7_0x1d493b[_0x2833d6(0x185)](_0x2833d6(0x191))),0x1;const _0x1a3c58=await deleteKeychainAPIKey(_0x4309e4);return _0x1a3c58?(clearCredentialCache(),console[_0x2833d6(0x1a2)](_0x2833d6(0x1ad)+(_0x4309e4?_0x2833d6(0x17a)+_0x4309e4+')':'')),0x0):(console[_0x2833d6(0x1a2)](_0x2833d6(0x19b)+(_0x4309e4?_0x2833d6(0x18f)+_0x4309e4:'')),0x1);}}
@@ -1 +1 @@
1
- const a8_0x3b3b00=a8_0x28f8;(function(_0x39f45d,_0x2de490){const _0x572887=a8_0x28f8,_0x295d1f=_0x39f45d();while(!![]){try{const _0x1edb9c=parseInt(_0x572887(0x1b0))/0x1*(-parseInt(_0x572887(0x18d))/0x2)+-parseInt(_0x572887(0x191))/0x3+parseInt(_0x572887(0x1bf))/0x4*(parseInt(_0x572887(0x19a))/0x5)+-parseInt(_0x572887(0x1c0))/0x6*(parseInt(_0x572887(0x187))/0x7)+-parseInt(_0x572887(0x1b3))/0x8+-parseInt(_0x572887(0x1ba))/0x9*(parseInt(_0x572887(0x18c))/0xa)+parseInt(_0x572887(0x186))/0xb*(parseInt(_0x572887(0x1c1))/0xc);if(_0x1edb9c===_0x2de490)break;else _0x295d1f['push'](_0x295d1f['shift']());}catch(_0x2c56e0){_0x295d1f['push'](_0x295d1f['shift']());}}}(a8_0x2d82,0x1d95b));function a8_0x2d82(){const _0x5b08f3=['claude-4.5-haiku','Error:\x20','streamChat','504411MKRvfh','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','llm','data','chat','--agent\x20flag','\x20\x20Cause:\x20','Chat\x20session:\x20','type','72855gURzZb','session\x20context','Using\x20cached\x20default\x20agent:\x20','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','description','args','cause','llmAgent','validate','includes','message','join','\x0aStack\x20trace:','code','stdout','resolveProjectId','name','resolveAgentId','error','Resolving\x20agent\x20\x27','event','verbose','34649KvZszA','CHAT_NOT_FOUND','\x0aError:\x20','754480UPsNMS','stack','chatId','new','404','\x27...','llmProject','569979lHhaDE','content','Continuing\x20chat:\x20','getDefaultAgent','getAgentId','4OWXnRY','126JaBRIS','9690492JJUEmX','11Rhmfcm','46193WEPqIv','handleChatEvent','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','metadata','log','20vpweFy','10FXhlGQ'];a8_0x2d82=function(){return _0x5b08f3;};return a8_0x2d82();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';function a8_0x28f8(_0x345bcd,_0x309524){_0x345bcd=_0x345bcd-0x186;const _0x2d8250=a8_0x2d82();let _0x28f82f=_0x2d8250[_0x345bcd];return _0x28f82f;}import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0x1a4dfc,_0x40c842){const _0x425f42=a8_0x28f8;if(_0x1a4dfc instanceof SDKError)console[_0x425f42(0x1ac)](_0x425f42(0x18f)+_0x1a4dfc[_0x425f42(0x1a4)]),_0x40c842[_0x425f42(0x1af)]&&(_0x1a4dfc[_0x425f42(0x1a0)]&&console[_0x425f42(0x1ac)](_0x425f42(0x197)+_0x1a4dfc[_0x425f42(0x1a0)]),_0x1a4dfc[_0x425f42(0x1b4)]&&(console['error'](_0x425f42(0x1a6)),console['error'](_0x1a4dfc['stack'])));else throw _0x1a4dfc;}export class ChatCommand extends BaseCommand{['name']=a8_0x3b3b00(0x195);[a8_0x3b3b00(0x19e)]=a8_0x3b3b00(0x192);[a8_0x3b3b00(0x1a2)](_0x51a394){const _0x15ab37=a8_0x3b3b00,_0xc1d9ac=_0x51a394[_0x15ab37(0x19f)][_0x15ab37(0x1a5)]('\x20');if(!_0xc1d9ac)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a8_0x3b3b00(0x190)](_0x27d848,_0x830bf4,_0x10c8e1,_0x5f8071,_0x6544d1){const _0x329d77=a8_0x3b3b00;for await(const _0x52e6d4 of _0x27d848['llm'][_0x329d77(0x195)](_0x830bf4,{'agentId':_0x10c8e1,'chatId':_0x5f8071})){if(_0x52e6d4[_0x329d77(0x199)]===_0x329d77(0x18a)){const _0x485bc2=_0x52e6d4[_0x329d77(0x194)][_0x329d77(0x1b5)];saveLastChatId(_0x485bc2),_0x6544d1&&console[_0x329d77(0x1ac)](_0x329d77(0x198)+_0x485bc2);}else _0x52e6d4[_0x329d77(0x199)]===_0x329d77(0x1ae)&&this[_0x329d77(0x188)](_0x52e6d4[_0x329d77(0x194)]);}}async[a8_0x3b3b00(0x1be)](_0x558e0f,_0x5a9f4f,_0x5b929c,_0x57e581,_0x4f96e8){const _0x5c5306=a8_0x3b3b00,_0x2b0554=_0x5a9f4f||_0x5b929c;if(_0x2b0554){const {projectName:_0x578514,agentName:_0xf6b29}=parseAgentRef(_0x2b0554),_0x298566=_0xf6b29||_0x2b0554,_0x184a28=_0xf6b29?_0x578514:_0x57e581;if(!_0x184a28)throw new Error(_0x5c5306(0x19d));if(_0x4f96e8){const _0x106f49=_0x5a9f4f?_0x5c5306(0x196):_0x5c5306(0x19b);console[_0x5c5306(0x1ac)]('Using\x20agent\x20from\x20'+_0x106f49+':\x20'+_0x184a28+'/'+_0x298566);}const _0x148342=await withSpinner('Resolving\x20project\x20\x27'+_0x184a28+_0x5c5306(0x1b8),()=>_0x558e0f[_0x5c5306(0x193)][_0x5c5306(0x1a9)](_0x184a28),{'verbose':_0x4f96e8}),_0x23e34f=await withSpinner(_0x5c5306(0x1ad)+_0x298566+'\x27...',()=>_0x558e0f['llm'][_0x5c5306(0x1ab)](_0x298566,_0x148342[_0x5c5306(0x194)]),{'verbose':_0x4f96e8});return _0x23e34f[_0x5c5306(0x194)];}else{const _0x28368a=_0x558e0f[_0x5c5306(0x193)][_0x5c5306(0x1bd)]();if(_0x28368a)return _0x4f96e8&&console[_0x5c5306(0x1ac)](_0x5c5306(0x19c)+_0x28368a[_0x5c5306(0x1aa)]),_0x28368a['id'];const _0x403447=await withSpinner('Getting\x20default\x20agent...',()=>_0x558e0f[_0x5c5306(0x193)]['getOrCreateDefaultAgent'](_0x5c5306(0x18e),0x0),{'verbose':_0x4f96e8});return _0x403447[_0x5c5306(0x194)]['id'];}}async['execute'](_0x428187){const _0x53dab0=a8_0x3b3b00,{options:_0xe09596,args:_0x3c8732,tdx:_0x544d49}=_0x428187,_0x79545e=_0x3c8732['join']('\x20'),_0xb2de87=_0xe09596,_0x4e94b7=_0xb2de87['agent'],_0x182df9=_0xb2de87[_0x53dab0(0x1a1)],_0x4ee295=_0xb2de87[_0x53dab0(0x1b9)],_0x3cb209=_0xb2de87[_0x53dab0(0x1b6)];try{let _0x4dd49a,_0x2dd442;!_0x3cb209&&(_0x2dd442=loadLastChatId(),_0x2dd442&&_0xe09596[_0x53dab0(0x1af)]&&console['error'](_0x53dab0(0x1bc)+_0x2dd442));(_0x3cb209||!_0x2dd442)&&(_0x4dd49a=await this['getAgentId'](_0x544d49,_0x4e94b7,_0x182df9,_0x4ee295,_0xe09596['verbose']));try{await this[_0x53dab0(0x190)](_0x544d49,_0x79545e,_0x4dd49a,_0x2dd442,_0xe09596[_0x53dab0(0x1af)]);}catch(_0x585d6f){const _0x5b90ab=_0x585d6f instanceof SDKError&&_0x585d6f[_0x53dab0(0x1a7)]===ErrorCode[_0x53dab0(0x1b1)]||_0x585d6f instanceof Error&&_0x585d6f[_0x53dab0(0x1a4)][_0x53dab0(0x1a3)](_0x53dab0(0x1b7));if(_0x5b90ab)_0xe09596[_0x53dab0(0x1af)]&&console['error'](_0x53dab0(0x189)),!_0x4dd49a&&(_0x4dd49a=await this[_0x53dab0(0x1be)](_0x544d49,_0x4e94b7,_0x182df9,_0x4ee295,_0xe09596[_0x53dab0(0x1af)])),await this[_0x53dab0(0x190)](_0x544d49,_0x79545e,_0x4dd49a,undefined,_0xe09596[_0x53dab0(0x1af)]);else throw _0x585d6f;}return console[_0x53dab0(0x18b)](),0x0;}catch(_0x47bc5b){return console['error'](),handleSDKError(_0x47bc5b,_0xe09596),0x1;}}[a8_0x3b3b00(0x188)](_0x507bc4){const _0x4fce26=a8_0x3b3b00;if(_0x4fce26(0x1bb)in _0x507bc4)process[_0x4fce26(0x1a8)]['write'](_0x507bc4[_0x4fce26(0x1bb)]);else _0x4fce26(0x1ac)in _0x507bc4&&console[_0x4fce26(0x1ac)](_0x4fce26(0x1b2)+_0x507bc4[_0x4fce26(0x1ac)]);}}
1
+ const a8_0x540998=a8_0x1c5d;function a8_0x1100(){const _0x5a9806=['join','message','log','Using\x20cached\x20default\x20agent:\x20','5036680mFcvUR','3177110lzmkGb','Chat\x20session:\x20','claude-4.5-haiku','handleChatEvent','294OqlIhJ','execute','Resolving\x20project\x20\x27','1341xDHqMn','verbose','--agent\x20flag','cause','getOrCreateDefaultAgent','event','streamChat','\x27...','name','llm','2LPnQHN','agent','\x0aStack\x20trace:','session\x20context','getAgentId','stack','56216zazLhN','1045485nmpjoG','metadata','212821dSePsw','4466889aknBai','48687820BWNHtV','description','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','Resolving\x20agent\x20\x27','\x20\x20Cause:\x20','chatId','getDefaultAgent','error','llmProject','data','new','chat','Getting\x20default\x20agent...','write','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','stdout','resolveProjectId','Continuing\x20chat:\x20'];a8_0x1100=function(){return _0x5a9806;};return a8_0x1100();}(function(_0x2cc4b5,_0x41ae49){const _0xe5f0df=a8_0x1c5d,_0x446e69=_0x2cc4b5();while(!![]){try{const _0x5eb451=-parseInt(_0xe5f0df(0x1a0))/0x1*(parseInt(_0xe5f0df(0x199))/0x2)+parseInt(_0xe5f0df(0x16f))/0x3+-parseInt(_0xe5f0df(0x187))/0x4+-parseInt(_0xe5f0df(0x188))/0x5+-parseInt(_0xe5f0df(0x18c))/0x6*(parseInt(_0xe5f0df(0x1a2))/0x7)+-parseInt(_0xe5f0df(0x19f))/0x8*(parseInt(_0xe5f0df(0x18f))/0x9)+parseInt(_0xe5f0df(0x170))/0xa;if(_0x5eb451===_0x41ae49)break;else _0x446e69['push'](_0x446e69['shift']());}catch(_0x89bdf3){_0x446e69['push'](_0x446e69['shift']());}}}(a8_0x1100,0xd7102));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a8_0x1c5d(_0x57d1ce,_0x753c4b){_0x57d1ce=_0x57d1ce-0x16f;const _0x1100df=a8_0x1100();let _0x1c5d1d=_0x1100df[_0x57d1ce];return _0x1c5d1d;}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(_0x257b96,_0x367af4){const _0x432ac6=a8_0x1c5d;if(_0x257b96 instanceof SDKError)console[_0x432ac6(0x177)]('Error:\x20'+_0x257b96['message']),_0x367af4[_0x432ac6(0x190)]&&(_0x257b96[_0x432ac6(0x192)]&&console[_0x432ac6(0x177)](_0x432ac6(0x174)+_0x257b96['cause']),_0x257b96[_0x432ac6(0x19e)]&&(console[_0x432ac6(0x177)](_0x432ac6(0x19b)),console['error'](_0x257b96[_0x432ac6(0x19e)])));else throw _0x257b96;}export class ChatCommand extends BaseCommand{[a8_0x540998(0x197)]=a8_0x540998(0x17b);[a8_0x540998(0x171)]=a8_0x540998(0x172);['validate'](_0xe9f88e){const _0x569c32=a8_0x540998,_0x58df3e=_0xe9f88e['args'][_0x569c32(0x183)]('\x20');if(!_0x58df3e)return _0x569c32(0x17e);return undefined;}async[a8_0x540998(0x195)](_0x5141ca,_0x13149b,_0x18ecf4,_0x416384,_0x17e558){const _0x48bd65=a8_0x540998;for await(const _0x120d29 of _0x5141ca['llm']['chat'](_0x13149b,{'agentId':_0x18ecf4,'chatId':_0x416384})){if(_0x120d29['type']===_0x48bd65(0x1a1)){const _0x379b3d=_0x120d29[_0x48bd65(0x179)][_0x48bd65(0x175)];saveLastChatId(_0x379b3d),_0x17e558&&console[_0x48bd65(0x177)](_0x48bd65(0x189)+_0x379b3d);}else _0x120d29['type']===_0x48bd65(0x194)&&this['handleChatEvent'](_0x120d29['data']);}}async[a8_0x540998(0x19d)](_0x20a912,_0x3ef1a1,_0x3050dd,_0x3f1389,_0x707ec2){const _0x4d1389=a8_0x540998,_0x167588=_0x3ef1a1||_0x3050dd;if(_0x167588){const {projectName:_0x923c8e,agentName:_0x8c64e4}=parseAgentRef(_0x167588),_0xa2bc2c=_0x8c64e4||_0x167588,_0x4d9881=_0x8c64e4?_0x923c8e:_0x3f1389;if(!_0x4d9881)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x707ec2){const _0x4d6610=_0x3ef1a1?_0x4d1389(0x191):_0x4d1389(0x19c);console[_0x4d1389(0x177)]('Using\x20agent\x20from\x20'+_0x4d6610+':\x20'+_0x4d9881+'/'+_0xa2bc2c);}const _0x411738=await withSpinner(_0x4d1389(0x18e)+_0x4d9881+_0x4d1389(0x196),()=>_0x20a912[_0x4d1389(0x198)][_0x4d1389(0x181)](_0x4d9881),{'verbose':_0x707ec2}),_0x275105=await withSpinner(_0x4d1389(0x173)+_0xa2bc2c+_0x4d1389(0x196),()=>_0x20a912[_0x4d1389(0x198)]['resolveAgentId'](_0xa2bc2c,_0x411738[_0x4d1389(0x179)]),{'verbose':_0x707ec2});return _0x275105[_0x4d1389(0x179)];}else{const _0xf5e2af=_0x20a912[_0x4d1389(0x198)][_0x4d1389(0x176)]();if(_0xf5e2af)return _0x707ec2&&console['error'](_0x4d1389(0x186)+_0xf5e2af[_0x4d1389(0x197)]),_0xf5e2af['id'];const _0x51d4c1=await withSpinner(_0x4d1389(0x17c),()=>_0x20a912['llm'][_0x4d1389(0x193)](_0x4d1389(0x18a),0x0),{'verbose':_0x707ec2});return _0x51d4c1['data']['id'];}}async[a8_0x540998(0x18d)](_0xed96a8){const _0x4d3789=a8_0x540998,{options:_0x421711,args:_0x3892a5,tdx:_0x27fdf8}=_0xed96a8,_0x4af9f7=_0x3892a5[_0x4d3789(0x183)]('\x20'),_0x5ce36b=_0x421711,_0x2a2d2e=_0x5ce36b[_0x4d3789(0x19a)],_0x3482f2=_0x5ce36b['llmAgent'],_0xe3d854=_0x5ce36b[_0x4d3789(0x178)],_0x4be124=_0x5ce36b[_0x4d3789(0x17a)];try{let _0x399916,_0x210989;!_0x4be124&&(_0x210989=loadLastChatId(),_0x210989&&_0x421711[_0x4d3789(0x190)]&&console[_0x4d3789(0x177)](_0x4d3789(0x182)+_0x210989));(_0x4be124||!_0x210989)&&(_0x399916=await this[_0x4d3789(0x19d)](_0x27fdf8,_0x2a2d2e,_0x3482f2,_0xe3d854,_0x421711[_0x4d3789(0x190)]));try{await this[_0x4d3789(0x195)](_0x27fdf8,_0x4af9f7,_0x399916,_0x210989,_0x421711[_0x4d3789(0x190)]);}catch(_0x44a93d){const _0x11b8b6=_0x44a93d instanceof SDKError&&_0x44a93d['code']===ErrorCode['CHAT_NOT_FOUND']||_0x44a93d instanceof Error&&_0x44a93d[_0x4d3789(0x184)]['includes']('404');if(_0x11b8b6)_0x421711[_0x4d3789(0x190)]&&console['error'](_0x4d3789(0x17f)),!_0x399916&&(_0x399916=await this['getAgentId'](_0x27fdf8,_0x2a2d2e,_0x3482f2,_0xe3d854,_0x421711[_0x4d3789(0x190)])),await this['streamChat'](_0x27fdf8,_0x4af9f7,_0x399916,undefined,_0x421711[_0x4d3789(0x190)]);else throw _0x44a93d;}return console[_0x4d3789(0x185)](),0x0;}catch(_0x37e8d3){return console['error'](),handleSDKError(_0x37e8d3,_0x421711),0x1;}}[a8_0x540998(0x18b)](_0x487546){const _0x261b8d=a8_0x540998;if('content'in _0x487546)process[_0x261b8d(0x180)][_0x261b8d(0x17d)](_0x487546['content']);else _0x261b8d(0x177)in _0x487546&&console[_0x261b8d(0x177)]('\x0aError:\x20'+_0x487546[_0x261b8d(0x177)]);}}