@treasuredata/tdx 2026.3.26 → 2026.3.28

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 (224) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +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/auth-login-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.d.ts +141 -2
  35. package/dist/commands/parent-segment-command.d.ts.map +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js.map +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-pull-command.js +1 -1
  47. package/dist/commands/segment-push-command.js +1 -1
  48. package/dist/commands/segment-update-command.js +1 -1
  49. package/dist/commands/segment-use-command.js +1 -1
  50. package/dist/commands/segment-validate-command.js +1 -1
  51. package/dist/commands/segments.js +1 -1
  52. package/dist/commands/show.js +1 -1
  53. package/dist/commands/status-command.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.js +1 -1
  63. package/dist/core/connection-cache.js +1 -1
  64. package/dist/core/constants.js +1 -1
  65. package/dist/core/credential-cache.js +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/keychain.js +1 -1
  68. package/dist/core/oauth-keychain.js +1 -1
  69. package/dist/core/oauth.d.ts.map +1 -1
  70. package/dist/core/oauth.js +1 -1
  71. package/dist/core/oauth.js.map +1 -1
  72. package/dist/core/profile.js +1 -1
  73. package/dist/core/project-config.js +1 -1
  74. package/dist/core/session.js +1 -1
  75. package/dist/core/user-cache.js +1 -1
  76. package/dist/core/version.js +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/mcp/server.js +1 -1
  79. package/dist/mcp/tools/index.js +1 -1
  80. package/dist/mcp/tools/tdx-run.js +1 -1
  81. package/dist/mcp/tools/tdx-search.js +1 -1
  82. package/dist/mcp/utils.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js +1 -1
  84. package/dist/proxy/passthrough-server.js +1 -1
  85. package/dist/proxy/sse-usage-parser.js +1 -1
  86. package/dist/sdk/agent/agent-config.js +1 -1
  87. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  88. package/dist/sdk/agent/agent-yaml.js +1 -1
  89. package/dist/sdk/agent/test/evaluator.js +1 -1
  90. package/dist/sdk/agent/test/executor.js +1 -1
  91. package/dist/sdk/agent/test/index.js +1 -1
  92. package/dist/sdk/agent/test/output.js +1 -1
  93. package/dist/sdk/agent/test/parser.js +1 -1
  94. package/dist/sdk/agent/tool-target-registry.js +1 -1
  95. package/dist/sdk/api.js +1 -1
  96. package/dist/sdk/client/cdp-api-client.d.ts +29 -1
  97. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  100. package/dist/sdk/client/delivery-api-client.js +1 -1
  101. package/dist/sdk/client/endpoints.js +1 -1
  102. package/dist/sdk/client/engage-api-client.js +1 -1
  103. package/dist/sdk/client/http-client.js +1 -1
  104. package/dist/sdk/client/llm-api-client.js +1 -1
  105. package/dist/sdk/client/oauth-refresh.js +1 -1
  106. package/dist/sdk/client/rate-limiter.js +1 -1
  107. package/dist/sdk/client/td-api-client.js +1 -1
  108. package/dist/sdk/client/trino-api-client.js +1 -1
  109. package/dist/sdk/client/workflow-client.js +1 -1
  110. package/dist/sdk/connection-validator.js +1 -1
  111. package/dist/sdk/connection.js +1 -1
  112. package/dist/sdk/delivery.js +1 -1
  113. package/dist/sdk/engage/campaign-pull.js +1 -1
  114. package/dist/sdk/engage/campaign-push.js +1 -1
  115. package/dist/sdk/engage/campaign-validator.js +1 -1
  116. package/dist/sdk/engage/campaign-yaml.js +1 -1
  117. package/dist/sdk/engage/template-pull.js +1 -1
  118. package/dist/sdk/engage/template-push.js +1 -1
  119. package/dist/sdk/engage/template-validator.js +1 -1
  120. package/dist/sdk/engage/template-yaml.js +1 -1
  121. package/dist/sdk/engage/types/campaign-def.js +1 -1
  122. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  123. package/dist/sdk/engage/types/template-schema.js +1 -1
  124. package/dist/sdk/engage.js +1 -1
  125. package/dist/sdk/errors.js +1 -1
  126. package/dist/sdk/index.js +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.d.ts +228 -0
  136. package/dist/sdk/personalization.d.ts.map +1 -1
  137. package/dist/sdk/personalization.js +1 -1
  138. package/dist/sdk/personalization.js.map +1 -1
  139. package/dist/sdk/policy.js +1 -1
  140. package/dist/sdk/query/index.js +1 -1
  141. package/dist/sdk/query/sql-parser.js +1 -1
  142. package/dist/sdk/realtime.d.ts +57 -0
  143. package/dist/sdk/realtime.d.ts.map +1 -1
  144. package/dist/sdk/realtime.js +1 -1
  145. package/dist/sdk/realtime.js.map +1 -1
  146. package/dist/sdk/schedule.js +1 -1
  147. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/fields-display.js +1 -1
  149. package/dist/sdk/segment/file-discovery.js +1 -1
  150. package/dist/sdk/segment/journey-utils.js +1 -1
  151. package/dist/sdk/segment/journey-validator.js +1 -1
  152. package/dist/sdk/segment/journey-yaml.js +1 -1
  153. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  154. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  155. package/dist/sdk/segment/pull-workflow.js +1 -1
  156. package/dist/sdk/segment/push-recovery.js +1 -1
  157. package/dist/sdk/segment/push-workflow.js +1 -1
  158. package/dist/sdk/segment/resolution-context.js +1 -1
  159. package/dist/sdk/segment/segment-path-parser.js +1 -1
  160. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  161. package/dist/sdk/segment/segment-validator.js +1 -1
  162. package/dist/sdk/segment/target-resolution.js +1 -1
  163. package/dist/sdk/segment/tdx-config.js +1 -1
  164. package/dist/sdk/segment/types/activation-schema.js +1 -1
  165. package/dist/sdk/segment/types/journey-def.js +1 -1
  166. package/dist/sdk/segment/types/journey-schema.js +1 -1
  167. package/dist/sdk/segment/types/segment-def.js +1 -1
  168. package/dist/sdk/segment/types/segment-schema.js +1 -1
  169. package/dist/sdk/segment/validate-files.js +1 -1
  170. package/dist/sdk/segment/yaml-validator.js +1 -1
  171. package/dist/sdk/segment.js +1 -1
  172. package/dist/sdk/types/cdp.d.ts +76 -0
  173. package/dist/sdk/types/cdp.d.ts.map +1 -1
  174. package/dist/sdk/types/index.d.ts +1 -1
  175. package/dist/sdk/types/index.d.ts.map +1 -1
  176. package/dist/sdk/types/index.js +1 -1
  177. package/dist/sdk/types/index.js.map +1 -1
  178. package/dist/sdk/types/progress.js +1 -1
  179. package/dist/sdk/user.js +1 -1
  180. package/dist/sdk/util/format-detector.js +1 -1
  181. package/dist/sdk/util/formatters.js +1 -1
  182. package/dist/sdk/util/index.js +1 -1
  183. package/dist/sdk/util/paginate.js +1 -1
  184. package/dist/sdk/util/tree-formatter.js +1 -1
  185. package/dist/sdk/workflow/archive-validation.js +1 -1
  186. package/dist/sdk/workflow/clone-workflow.js +1 -1
  187. package/dist/sdk/workflow/index.js +1 -1
  188. package/dist/sdk/workflow/pull-workflow.js +1 -1
  189. package/dist/sdk/workflow/push-workflow.js +1 -1
  190. package/dist/sdk/workflow/tdx-config.js +1 -1
  191. package/dist/sdk/workflow/workflow-utils.js +1 -1
  192. package/dist/test-utils/command-runner.js +1 -1
  193. package/dist/test-utils/factories.js +1 -1
  194. package/dist/test-utils/fixtures.js +1 -1
  195. package/dist/test-utils/http-mock.js +1 -1
  196. package/dist/test-utils/index.js +1 -1
  197. package/dist/utils/async.js +1 -1
  198. package/dist/utils/colors.js +1 -1
  199. package/dist/utils/diff.js +1 -1
  200. package/dist/utils/file-permissions.js +1 -1
  201. package/dist/utils/file-reader.js +1 -1
  202. package/dist/utils/github-releases.js +1 -1
  203. package/dist/utils/global-cache.js +1 -1
  204. package/dist/utils/json-loader.js +1 -1
  205. package/dist/utils/local-cache.js +1 -1
  206. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  207. package/dist/utils/logger/formatters/index.js +1 -1
  208. package/dist/utils/logger/handlers/console-handler.js +1 -1
  209. package/dist/utils/logger/handlers/file-handler.js +1 -1
  210. package/dist/utils/logger/handlers/index.js +1 -1
  211. package/dist/utils/logger/handlers/null-handler.js +1 -1
  212. package/dist/utils/logger/index.js +1 -1
  213. package/dist/utils/logger/logger.js +1 -1
  214. package/dist/utils/logger/types.js +1 -1
  215. package/dist/utils/option-validation.js +1 -1
  216. package/dist/utils/process.js +1 -1
  217. package/dist/utils/prompt.js +1 -1
  218. package/dist/utils/spinner.js +1 -1
  219. package/dist/utils/sse-parser.js +1 -1
  220. package/dist/utils/string-utils.js +1 -1
  221. package/dist/utils/table-ref-parser.js +1 -1
  222. package/dist/utils/tdx-logger.js +1 -1
  223. package/dist/utils/version-check.js +1 -1
  224. package/package.json +1 -1
@@ -1 +1 @@
1
- const a4_0x2bd6c2=a4_0x14ff;(function(_0x2fd52d,_0x58f3a4){const _0x57fc4f=a4_0x14ff,_0x335f33=_0x2fd52d();while(!![]){try{const _0x2f447c=parseInt(_0x57fc4f(0x1e8))/0x1*(parseInt(_0x57fc4f(0x197))/0x2)+parseInt(_0x57fc4f(0x1b5))/0x3+-parseInt(_0x57fc4f(0x1a0))/0x4*(parseInt(_0x57fc4f(0x1e3))/0x5)+-parseInt(_0x57fc4f(0x199))/0x6*(-parseInt(_0x57fc4f(0x1a1))/0x7)+-parseInt(_0x57fc4f(0x19b))/0x8+-parseInt(_0x57fc4f(0x1f5))/0x9+-parseInt(_0x57fc4f(0x1d7))/0xa;if(_0x2f447c===_0x58f3a4)break;else _0x335f33['push'](_0x335f33['shift']());}catch(_0x2d7072){_0x335f33['push'](_0x335f33['shift']());}}}(a4_0x1bd1,0x49ef6));import a4_0x16ef45 from'chalk';import a4_0x34ce8e 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,resolveAgentPullArgs}from'../sdk/agent/agent-config.js';function a4_0x14ff(_0x107dcb,_0x2f907d){_0x107dcb=_0x107dcb-0x18d;const _0x1bd1d2=a4_0x1bd1();let _0x14ff86=_0x1bd1d2[_0x107dcb];return _0x14ff86;}function a4_0x1bd1(){const _0x5855f1=['\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','cwd','yes','green','description','\x20resources\x20to\x20\x27','New\x20project:\x20','Would\x20clone:','llm','Failed\x20to\x20push\x20agent:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','Would\x20pull\x20agent:\x20','\x20total','Output:\x20','<new-name>','textKnowledgeBases','\x20--name\x20','Agent\x20','Using\x20context\x20project:\x20','repeat','action','\x20\x20Integrations:\x20','Summary:','No\x20tdx.json\x20found\x20in\x20','\x0aChanges\x20to\x20integration\x20\x27','dirname','output','1206880ACXjOh','arg-dir','found','force','outputPath','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','new','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','Chat:\x20','\x20\x20Knowledge\x20Bases:\x20','llm_project','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20--agent\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20context\x20project','940DCJZQi','pullAgent','\x0aPush\x20summary\x20for\x20\x27','Writing\x20files...','\x20updated','261UUtZwD','\x0aError:','errors','total','Using\x20project\x20from\x20','Using\x20project\x20from\x20context:\x20','Using\x20project:\x20','pushProject','diff','Project\x20cloned\x20successfully','✔\x20Context\x20set:\x20','\x22:\x20','site','1202643YpmZro','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','\x0aChanges\x20to\x20agent\x20\x27','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','hasChanges','newProjectName','agentId','Source:\x20','\x20files?','Errors:','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a','Pushing\x20agent\x20from\x20\x22','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','yellow','projectId','message','agent:push','New\x20project\x20ID:\x20','\x20errors','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20project','\x20\x20Integration\x20\x22','dim','session','agent.yml','log','\x20\x20Prompts:\x20','utf-8','New\x20project\x20name\x20is\x20required','\x20files\x20to\x20','unchanged','\x20\x20Knowledge\x20Base\x20\x22','\x20unchanged','\x20\x20Experimental\x20Knowledge\x20Base\x20\x22','\x20new','experimentalKnowledgeBases','Agent\x20pulled\x20successfully','pullProject','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','no_local_folder','Status:\x20','prompts','llmProject','\x20\x20Text\x20Knowledge\x20Base\x20\x22','\x0aPush\x20','\x22\x20to\x20new\x20project\x20\x22','sourceProjectName','experimentalArtifacts','\x0aProject\x20pushed\x20with\x20errors','\x20changed','\x0aChanges\x20to\x20prompt\x20\x27','\x22...','agent','\x0aWrite\x20','projectName','agent:clone','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','\x20--profile\x20','Agent:\x20','join','integrations','name','Would\x20push\x20agent:\x20','Cancelled','knowledgeBases','context','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','profile','\x20\x20Agents:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','source','projectDir','cyan','\x20|\x20','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','\x0aChanges:','updated','Cloning\x20\x22','red','execute','\x20\x20Experimental\x20Artifacts:\x20','\x20\x20Target:\x20','-\x20nothing\x20pushed','Analyzing\x20changes\x20to\x20push...','Project\x20cloned\x20with\x20errors','\x20\x20Prompt\x20\x22','\x20\x20Text\x20Knowledge\x20Bases:\x20','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','1474BsxNjh','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','260070vqedwY','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','462696fccIgW','dryRun','\x20created','INVALID_ARGUMENT','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','4080lgsZRf','7sMPqCB','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','Project:\x20','cloneProject','Dry\x20run\x20-\x20no\x20files\x20written','agentName','Analyzing\x20project\x20\x22','-\x20no\x20files\x20written','\x27\x20to\x20create\x20the\x20folder\x20structure.','tdx.json','created','\x20\x20tdx\x20agent\x20pull\x20','counts','error','no_context','Using\x20current\x20project:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','agents','push','1713144dkjTuL','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','Pulling\x20agent\x20\x22','\x20\x20Agent\x20\x22','Using\x20local\x20project:\x20','newProjectId'];a4_0x1bd1=function(){return _0x5855f1;};return a4_0x1bd1();}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(_0x2aee48){const _0x2f778a=a4_0x14ff,_0x4a371e=[];if(_0x2aee48[_0x2f778a(0x1eb)]!==undefined)_0x4a371e[_0x2f778a(0x1b4)](_0x2aee48[_0x2f778a(0x1eb)]+_0x2f778a(0x1c8));if(_0x2aee48[_0x2f778a(0x1dd)]!==undefined&&_0x2aee48[_0x2f778a(0x1dd)]>0x0)_0x4a371e['push'](a4_0x16ef45[_0x2f778a(0x1bf)](_0x2aee48[_0x2f778a(0x1dd)]+_0x2f778a(0x217)));if(_0x2aee48['created']!==undefined&&_0x2aee48['created']>0x0)_0x4a371e['push'](a4_0x16ef45[_0x2f778a(0x1bf)](_0x2aee48[_0x2f778a(0x1ab)]+_0x2f778a(0x19d)));if(_0x2aee48['updated']!==undefined&&_0x2aee48[_0x2f778a(0x241)]>0x0)_0x4a371e[_0x2f778a(0x1b4)](a4_0x16ef45[_0x2f778a(0x203)](_0x2aee48['updated']+_0x2f778a(0x1e7)));if(_0x2aee48['unchanged']!==undefined&&_0x2aee48['unchanged']>0x0)_0x4a371e[_0x2f778a(0x1b4)](a4_0x16ef45['gray'](_0x2aee48[_0x2f778a(0x213)]+_0x2f778a(0x215)));if(_0x2aee48['errors']!==undefined&&_0x2aee48[_0x2f778a(0x1ea)]>0x0)_0x4a371e[_0x2f778a(0x1b4)](a4_0x16ef45[_0x2f778a(0x243)](_0x2aee48[_0x2f778a(0x1ea)]+_0x2f778a(0x208)));return _0x4a371e[_0x2f778a(0x230)](',\x20');}function displayDiffs(_0x214f00,_0x2fbbc0,_0x1a837f,_0x253091,_0x294b86,_0x20dd40,_0x1fc696){const _0x484e82=a4_0x14ff;for(const _0x28d9f0 of _0x214f00){if(_0x28d9f0[_0x484e82(0x1f0)]){const _0x3fddad=_0x28d9f0[_0x484e82(0x1a6)]||_0x28d9f0['name'];console[_0x484e82(0x20e)](_0x484e82(0x1f7)+_0x3fddad+'\x27:'),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)),console['log'](_0x28d9f0[_0x484e82(0x1f0)]),console['log']('─'['repeat'](0x3c));}}for(const _0x691aaf of _0x2fbbc0){_0x691aaf[_0x484e82(0x1f0)]&&(console[_0x484e82(0x20e)](_0x484e82(0x237)+_0x691aaf['name']+'\x27:'),console['log']('─'['repeat'](0x3c)),console[_0x484e82(0x20e)](_0x691aaf[_0x484e82(0x1f0)]),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)));}for(const _0x422ee8 of _0x1a837f){_0x422ee8[_0x484e82(0x1f0)]&&(console['log'](_0x484e82(0x23f)+_0x422ee8['name']+'\x27:'),console[_0x484e82(0x20e)]('─'['repeat'](0x3c)),console[_0x484e82(0x20e)](_0x422ee8[_0x484e82(0x1f0)]),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)));}for(const _0xec8b4b of _0x253091){_0xec8b4b[_0x484e82(0x1f0)]&&(console['log'](_0x484e82(0x227)+_0xec8b4b[_0x484e82(0x232)]+'\x27:'),console['log']('─'['repeat'](0x3c)),console[_0x484e82(0x20e)](_0xec8b4b['diff']),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)));}for(const _0xced836 of _0x294b86){_0xced836['diff']&&(console[_0x484e82(0x20e)](_0x484e82(0x1d4)+_0xced836[_0x484e82(0x232)]+'\x27:'),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)),console[_0x484e82(0x20e)](_0xced836['diff']),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)));}for(const _0x31eb37 of _0x20dd40){_0x31eb37[_0x484e82(0x1f0)]&&(console[_0x484e82(0x20e)]('\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27'+_0x31eb37['name']+'\x27:'),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)),console[_0x484e82(0x20e)](_0x31eb37[_0x484e82(0x1f0)]),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)));}for(const _0x25ac68 of _0x1fc696){_0x25ac68[_0x484e82(0x1f0)]&&(console[_0x484e82(0x20e)](_0x484e82(0x1f6)+_0x25ac68[_0x484e82(0x232)]+'\x27:'),console[_0x484e82(0x20e)]('─'[_0x484e82(0x1cf)](0x3c)),console[_0x484e82(0x20e)](_0x25ac68['diff']),console[_0x484e82(0x20e)]('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x2bd6c2(0x232)]='agent:pull';[a4_0x2bd6c2(0x1c0)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0x2bd6c2(0x18d)](_0x35fe7d){const _0x57942c=a4_0x2bd6c2,{options:_0x20e1b6,args:_0x14dedf,tdx:_0x148395}=_0x35fe7d,_0x175875=_0x14dedf[0x0],_0x1c1125=_0x14dedf[0x1],_0x30efca=_0x20e1b6[_0x57942c(0x1d6)],_0x2f9bd8=_0x20e1b6[_0x57942c(0x19c)],_0x4b2e91=_0x20e1b6[_0x57942c(0x1da)],_0x313e26=_0x20e1b6[_0x57942c(0x1be)],_0x160fec=_0x20e1b6[_0x57942c(0x21f)],_0x34612f=_0x20e1b6[_0x57942c(0x229)];let _0x55e0da;if(_0x175875){const _0x24f0d8=a4_0x34ce8e[_0x57942c(0x230)](_0x175875,'tdx.json');if(existsSync(_0x24f0d8))try{const _0x3984da=JSON['parse'](readFileSync(_0x24f0d8,'utf-8'));_0x3984da[_0x57942c(0x1e1)]&&(_0x55e0da={'llm_project':_0x3984da['llm_project']});}catch{}}const _0x24cc9c=findAgentConfigPath(process[_0x57942c(0x1bd)]());let _0x165c07;if(_0x24cc9c)try{const _0x4ff139=JSON['parse'](readFileSync(_0x24cc9c,_0x57942c(0x210)));_0x4ff139[_0x57942c(0x1e1)]&&(_0x165c07={'llm_project':_0x4ff139[_0x57942c(0x1e1)]});}catch{}const _0x3a1e54=resolveAgentPullArgs({'arg':_0x175875,'agentNameArg':_0x1c1125,'agentFlag':_0x34612f,'contextProject':_0x160fec,'argDirConfig':_0x55e0da,'cwdConfigPath':_0x24cc9c||undefined,'cwdConfig':_0x165c07}),{projectNameOrId:_0x240aa9,targetAgentName:_0x1b757e,existingOutputDir:_0x4cfe2c,source:_0x3d868c}=_0x3a1e54;if(_0x3d868c===_0x57942c(0x1d8))console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x20b)](_0x57942c(0x1ec)+a4_0x34ce8e['join'](_0x175875,'tdx.json')+':\x20'+_0x240aa9));else{if(_0x3d868c==='cwd-config')console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x20b)](_0x57942c(0x1ee)+_0x240aa9));else _0x3d868c===_0x57942c(0x236)&&console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x20b)](_0x57942c(0x1ed)+_0x240aa9));}if(!_0x240aa9)return _0x34612f?(console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x203)](_0x57942c(0x200))),console[_0x57942c(0x20e)](_0x57942c(0x1a2)),console[_0x57942c(0x20e)](_0x57942c(0x21b))):(console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x203)]('llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x57942c(0x20e)]('Usage:\x20tdx\x20agent\x20pull\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#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)'),console['log'](_0x57942c(0x23a)),console[_0x57942c(0x20e)](_0x57942c(0x1b7)),console[_0x57942c(0x20e)](_0x57942c(0x1e2)),console[_0x57942c(0x20e)](_0x57942c(0x209))),0x1;if(_0x1b757e){const {data:_0x5d16d5}=await withSpinner(_0x57942c(0x1b8)+_0x1b757e+'\x22\x20from\x20project\x20\x22'+_0x240aa9+'\x22...',()=>_0x148395[_0x57942c(0x1c4)][_0x57942c(0x1e4)](_0x240aa9,_0x1b757e,_0x30efca,{'dryRun':_0x2f9bd8,'force':_0x4b2e91}));if(_0x2f9bd8)return console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x203)](_0x57942c(0x1a5))),console[_0x57942c(0x20e)](_0x57942c(0x1c7)+_0x5d16d5[_0x57942c(0x1a6)]),console[_0x57942c(0x20e)]('Output\x20path:\x20'+_0x5d16d5[_0x57942c(0x1db)]),_0x5d16d5['diff']&&(console['log'](_0x57942c(0x240)),console[_0x57942c(0x20e)]('─'[_0x57942c(0x1cf)](0x3c)),console[_0x57942c(0x20e)](_0x5d16d5[_0x57942c(0x1f0)]),console[_0x57942c(0x20e)]('─'[_0x57942c(0x1cf)](0x3c))),0x0;return console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x1bf)](_0x57942c(0x219))),console[_0x57942c(0x20e)](_0x57942c(0x22f)+_0x5d16d5['agentName']),console[_0x57942c(0x20e)](_0x57942c(0x1c9)+_0x5d16d5[_0x57942c(0x1db)]),console[_0x57942c(0x20e)](_0x57942c(0x21d)+(_0x5d16d5['isNew']?a4_0x16ef45['green']('new'):_0x5d16d5[_0x57942c(0x1f9)]?a4_0x16ef45[_0x57942c(0x203)](_0x57942c(0x241)):a4_0x16ef45['gray'](_0x57942c(0x213)))),0x0;}const _0x34a936=_0x4cfe2c||_0x30efca,{data:_0x26373c}=await withSpinner(_0x57942c(0x1a7)+_0x240aa9+'\x22...',()=>_0x148395[_0x57942c(0x1c4)][_0x57942c(0x21a)](_0x240aa9,_0x34a936,{'dryRun':!![]})),_0x32b5ba=_0x26373c['counts'][_0x57942c(0x1b3)][_0x57942c(0x1dd)]+_0x26373c['counts'][_0x57942c(0x235)][_0x57942c(0x1dd)]+_0x26373c[_0x57942c(0x1ad)]['textKnowledgeBases'][_0x57942c(0x1dd)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x21e)]['new']+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x231)][_0x57942c(0x1dd)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x218)][_0x57942c(0x1dd)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x224)]['new'],_0x1985ff=_0x26373c['counts']['agents']['updated']+_0x26373c['counts'][_0x57942c(0x235)][_0x57942c(0x241)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x1cb)][_0x57942c(0x241)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x21e)][_0x57942c(0x241)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x231)][_0x57942c(0x241)]+_0x26373c[_0x57942c(0x1ad)]['experimentalKnowledgeBases'][_0x57942c(0x241)]+_0x26373c[_0x57942c(0x1ad)]['experimentalArtifacts'][_0x57942c(0x241)],_0x342a73=_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x1b3)][_0x57942c(0x213)]+_0x26373c['counts'][_0x57942c(0x235)][_0x57942c(0x213)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x1cb)][_0x57942c(0x213)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x21e)][_0x57942c(0x213)]+_0x26373c[_0x57942c(0x1ad)]['integrations']['unchanged']+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x218)][_0x57942c(0x213)]+_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x224)][_0x57942c(0x213)];console[_0x57942c(0x20e)]('\x0aPull\x20summary\x20for\x20\x27'+_0x26373c[_0x57942c(0x22b)]+'\x27:'),console['log']('\x20\x20'+a4_0x16ef45[_0x57942c(0x1bf)]('+\x20'+_0x32b5ba+_0x57942c(0x217))+_0x57942c(0x23e)+a4_0x16ef45[_0x57942c(0x203)]('~\x20'+_0x1985ff+_0x57942c(0x226))+'\x20|\x20'+a4_0x16ef45[_0x57942c(0x20b)]('=\x20'+_0x342a73+_0x57942c(0x215))),console['log'](_0x57942c(0x239)+formatCountSummary(_0x26373c[_0x57942c(0x1ad)]['agents'])),console[_0x57942c(0x20e)](_0x57942c(0x1e0)+formatCountSummary(_0x26373c[_0x57942c(0x1ad)]['knowledgeBases'])),console['log'](_0x57942c(0x194)+formatCountSummary(_0x26373c['counts'][_0x57942c(0x1cb)])),console[_0x57942c(0x20e)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x21e)])),console['log']('\x20\x20Integrations:\x20'+formatCountSummary(_0x26373c[_0x57942c(0x1ad)]['integrations']));const _0x3c251f=_0x26373c['counts'][_0x57942c(0x218)][_0x57942c(0x1eb)]>0x0||_0x26373c['counts'][_0x57942c(0x224)][_0x57942c(0x1eb)]>0x0;_0x3c251f&&(console[_0x57942c(0x20e)](_0x57942c(0x1de)+formatCountSummary(_0x26373c[_0x57942c(0x1ad)][_0x57942c(0x218)])),console[_0x57942c(0x20e)](_0x57942c(0x18e)+formatCountSummary(_0x26373c[_0x57942c(0x1ad)]['experimentalArtifacts'])));console[_0x57942c(0x20e)](_0x57942c(0x18f)+a4_0x16ef45[_0x57942c(0x23d)](_0x26373c['outputDir'])),displayDiffs(_0x26373c['agents'],_0x26373c['knowledgeBases'],_0x26373c[_0x57942c(0x1cb)],_0x26373c[_0x57942c(0x21e)],_0x26373c[_0x57942c(0x231)],_0x26373c[_0x57942c(0x218)],_0x26373c[_0x57942c(0x224)]);if(_0x2f9bd8)return console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x203)](_0x57942c(0x19f))),0x0;if(_0x32b5ba===0x0&&_0x1985ff===0x0)return console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x1bf)](_0x57942c(0x1c6))),saveSessionContext({'llm_project':_0x26373c['projectName']},_0x20e1b6[_0x57942c(0x20c)]),console['log'](a4_0x16ef45[_0x57942c(0x1bf)]('✔\x20Context\x20set:\x20'+a4_0x16ef45['dim'](_0x57942c(0x1e1))+'\x20=\x20'+a4_0x16ef45[_0x57942c(0x23d)](_0x26373c[_0x57942c(0x22b)]))),0x0;if(!_0x313e26&&!_0x4b2e91){if(!isInteractive())return console['error'](a4_0x16ef45[_0x57942c(0x243)](_0x57942c(0x1e9)),_0x57942c(0x196)),console['error'](a4_0x16ef45['dim'](_0x57942c(0x198))),0x1;const _0x3ac6b7=await confirmKey(_0x57942c(0x22a)+(_0x32b5ba+_0x1985ff)+_0x57942c(0x1fd));if(!_0x3ac6b7)return console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x203)](_0x57942c(0x234)),_0x57942c(0x1a8)),0x1;}const {data:_0x4fea0d}=await withSpinner(_0x57942c(0x1e6),()=>_0x148395[_0x57942c(0x1c4)][_0x57942c(0x21a)](_0x240aa9,_0x34a936,{'force':_0x4b2e91}));return console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x1bf)]('\x0a✔\x20Pulled\x20'+(_0x32b5ba+_0x1985ff)+_0x57942c(0x212)+_0x4fea0d['outputDir'])),saveSessionContext({'llm_project':_0x4fea0d[_0x57942c(0x22b)]},_0x20e1b6[_0x57942c(0x20c)]),console[_0x57942c(0x20e)](a4_0x16ef45[_0x57942c(0x1bf)](_0x57942c(0x1f2)+a4_0x16ef45['dim'](_0x57942c(0x1e1))+'\x20=\x20'+a4_0x16ef45[_0x57942c(0x23d)](_0x4fea0d[_0x57942c(0x22b)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x2bd6c2(0x232)]=a4_0x2bd6c2(0x22c);[a4_0x2bd6c2(0x1c0)]=a4_0x2bd6c2(0x195);async['execute'](_0x19b8c4){const _0x21f6b8=a4_0x2bd6c2,{options:_0x412c70,args:_0x2f54c7,tdx:_0x440a88}=_0x19b8c4,_0x5442fd=_0x2f54c7[0x0],_0x1ba377=_0x412c70[_0x21f6b8(0x232)],_0x5b16e5=_0x412c70[_0x21f6b8(0x19c)],_0x4a65b1=_0x412c70[_0x21f6b8(0x1be)],_0xfb8699=_0x412c70[_0x21f6b8(0x1f4)],_0x8de3e0=_0x412c70['llmProject'];let _0x183b77;const _0x3a2250=findAgentConfigPath(process[_0x21f6b8(0x1bd)]());if(_0x5442fd){const _0x561fd5=a4_0x34ce8e['join'](_0x5442fd,_0x21f6b8(0x1aa));existsSync(_0x561fd5)?(_0x183b77=_0x5442fd,console['log'](a4_0x16ef45[_0x21f6b8(0x20b)](_0x21f6b8(0x1ba)+_0x5442fd))):_0x183b77=_0x5442fd;}else{if(_0x3a2250)_0x183b77=a4_0x34ce8e[_0x21f6b8(0x1d5)](_0x3a2250),console['log'](a4_0x16ef45[_0x21f6b8(0x20b)](_0x21f6b8(0x1b0)+_0x183b77));else{if(_0x8de3e0){const _0x1c8448=sanitizeForFilesystem(_0x8de3e0);let _0x51d7fe=_0x1c8448,_0x3365fb=a4_0x34ce8e[_0x21f6b8(0x230)](process[_0x21f6b8(0x1bd)](),_0x21f6b8(0x1b3),_0x1c8448,_0x21f6b8(0x1aa));if(!existsSync(_0x3365fb)){const _0x3e94e5=normalizeName(_0x8de3e0),_0x3e3f20=a4_0x34ce8e[_0x21f6b8(0x230)](process[_0x21f6b8(0x1bd)](),_0x21f6b8(0x1b3),_0x3e94e5,_0x21f6b8(0x1aa));existsSync(_0x3e3f20)&&(_0x51d7fe=_0x3e94e5,_0x3365fb=_0x3e3f20);}if(existsSync(_0x3365fb))_0x183b77=a4_0x34ce8e['dirname'](_0x3365fb),console['log'](a4_0x16ef45['dim'](_0x21f6b8(0x1ba)+_0x183b77));else{const _0x137830=_0x412c70[_0x21f6b8(0x238)];if(_0x137830)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x8de3e0+'\x22\x20to\x20a\x20different\x20profile',undefined,{'helpText':_0x21f6b8(0x19a)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x21f6b8(0x1ac)+_0x8de3e0+'\x0a')+('\x20\x20tdx\x20agent\x20clone\x20agents/'+_0x51d7fe+_0x21f6b8(0x1cc)+(_0x1ba377||_0x21f6b8(0x1ca))+_0x21f6b8(0x22e)+_0x137830)});_0x183b77=_0x8de3e0,console['log'](a4_0x16ef45[_0x21f6b8(0x20b)](_0x21f6b8(0x1ce)+_0x8de3e0));}}}}if(!_0x183b77)return console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x203)](_0x21f6b8(0x1b1))),console[_0x21f6b8(0x20e)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x21f6b8(0x20e)](_0x21f6b8(0x1dc)),console[_0x21f6b8(0x20e)]('\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)'),console[_0x21f6b8(0x20e)](_0x21f6b8(0x1ff)),0x1;if(!_0x1ba377)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x21f6b8(0x211),undefined,{'helpText':_0x21f6b8(0x202)});if(!_0x4a65b1&&!_0x5b16e5){if(!isInteractive())return console[_0x21f6b8(0x1ae)](a4_0x16ef45['red'](_0x21f6b8(0x1e9)),_0x21f6b8(0x196)),console['error'](a4_0x16ef45['dim'](_0x21f6b8(0x198))),0x1;const _0x5ab7da=await confirmKey('Clone\x20\x22'+_0x183b77+_0x21f6b8(0x222)+_0x1ba377+'\x22?');if(!_0x5ab7da)return console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x203)](_0x21f6b8(0x234))),0x1;}const {data:_0x5b4a7b}=await withSpinner(_0x21f6b8(0x242)+_0x183b77+'\x22\x20to\x20\x22'+_0x1ba377+_0x21f6b8(0x228),()=>_0x440a88['llm'][_0x21f6b8(0x1a4)](_0x183b77,_0x1ba377,{'dryRun':_0x5b16e5}));if(_0x5b16e5){console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x203)](_0x21f6b8(0x1b6))),console[_0x21f6b8(0x20e)](_0x21f6b8(0x1fc)+_0x5b4a7b['sourceProjectName']),console[_0x21f6b8(0x20e)]('New\x20project:\x20'+_0x1ba377),console[_0x21f6b8(0x20e)](_0x21f6b8(0x1c3)),console[_0x21f6b8(0x20e)]('\x20\x20Agents:\x20'+_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x1b3)][_0x21f6b8(0x1ab)]),console['log'](_0x21f6b8(0x1e0)+_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x235)][_0x21f6b8(0x1ab)]),console[_0x21f6b8(0x20e)](_0x21f6b8(0x20f)+_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x21e)][_0x21f6b8(0x1ab)]);const _0x3473b5=_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x218)]['created']>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)]['experimentalArtifacts'][_0x21f6b8(0x1ab)]>0x0;return _0x3473b5&&(console[_0x21f6b8(0x20e)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x218)]['created']),console['log'](_0x21f6b8(0x18e)+_0x5b4a7b['counts'][_0x21f6b8(0x224)][_0x21f6b8(0x1ab)])),0x0;}const _0x517987=_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x1b3)][_0x21f6b8(0x1ea)]>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x235)][_0x21f6b8(0x1ea)]>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x21e)][_0x21f6b8(0x1ea)]>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)]['experimentalKnowledgeBases']['errors']>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)]['experimentalArtifacts'][_0x21f6b8(0x1ea)]>0x0;_0x517987?console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x203)](_0x21f6b8(0x192))):console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x1bf)](_0x21f6b8(0x1f1)));console[_0x21f6b8(0x20e)](_0x21f6b8(0x1fc)+_0x5b4a7b[_0x21f6b8(0x223)]),console['log'](_0x21f6b8(0x1c2)+_0x5b4a7b[_0x21f6b8(0x1fa)]),console['log'](_0x21f6b8(0x207)+_0x5b4a7b[_0x21f6b8(0x1bb)]),console['log'](),console['log'](_0x21f6b8(0x1d2)),console[_0x21f6b8(0x20e)](_0x21f6b8(0x239)+formatCountSummary(_0x5b4a7b['counts'][_0x21f6b8(0x1b3)])),console[_0x21f6b8(0x20e)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x5b4a7b[_0x21f6b8(0x1ad)]['knowledgeBases'])),console['log'](_0x21f6b8(0x20f)+formatCountSummary(_0x5b4a7b['counts']['prompts'])),console[_0x21f6b8(0x20e)](_0x21f6b8(0x1d1)+formatCountSummary(_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x231)]));const _0x2de6dc=_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x218)][_0x21f6b8(0x1ab)]>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x218)][_0x21f6b8(0x241)]>0x0||_0x5b4a7b['counts'][_0x21f6b8(0x218)][_0x21f6b8(0x213)]>0x0||_0x5b4a7b['counts']['experimentalArtifacts'][_0x21f6b8(0x1ab)]>0x0||_0x5b4a7b['counts'][_0x21f6b8(0x224)][_0x21f6b8(0x241)]>0x0||_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x224)][_0x21f6b8(0x213)]>0x0;_0x2de6dc&&(console['log'](_0x21f6b8(0x1de)+formatCountSummary(_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x218)])),console[_0x21f6b8(0x20e)](_0x21f6b8(0x18e)+formatCountSummary(_0x5b4a7b[_0x21f6b8(0x1ad)][_0x21f6b8(0x224)])));if(_0x517987){console[_0x21f6b8(0x20e)](),console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x243)](_0x21f6b8(0x1fe)));for(const _0x5b6349 of _0x5b4a7b['agents']){_0x5b6349[_0x21f6b8(0x1d0)]===_0x21f6b8(0x1ae)&&console['log'](a4_0x16ef45[_0x21f6b8(0x243)](_0x21f6b8(0x1b9)+_0x5b6349[_0x21f6b8(0x1a6)]+_0x21f6b8(0x1f3)+_0x5b6349[_0x21f6b8(0x1ae)]));}for(const _0x1faa48 of _0x5b4a7b[_0x21f6b8(0x235)]){_0x1faa48[_0x21f6b8(0x1d0)]===_0x21f6b8(0x1ae)&&console[_0x21f6b8(0x20e)](a4_0x16ef45['red'](_0x21f6b8(0x214)+_0x1faa48[_0x21f6b8(0x232)]+_0x21f6b8(0x1f3)+_0x1faa48[_0x21f6b8(0x1ae)]));}for(const _0x59c0eb of _0x5b4a7b['prompts']){_0x59c0eb[_0x21f6b8(0x1d0)]===_0x21f6b8(0x1ae)&&console[_0x21f6b8(0x20e)](a4_0x16ef45[_0x21f6b8(0x243)](_0x21f6b8(0x193)+_0x59c0eb[_0x21f6b8(0x232)]+_0x21f6b8(0x1f3)+_0x59c0eb[_0x21f6b8(0x1ae)]));}for(const _0x390e63 of _0x5b4a7b[_0x21f6b8(0x231)]){_0x390e63[_0x21f6b8(0x1d0)]===_0x21f6b8(0x1ae)&&console[_0x21f6b8(0x20e)](a4_0x16ef45['red']('\x20\x20Integration\x20\x22'+_0x390e63[_0x21f6b8(0x232)]+_0x21f6b8(0x1f3)+_0x390e63[_0x21f6b8(0x1ae)]));}for(const _0x5cdaab of _0x5b4a7b[_0x21f6b8(0x218)]){_0x5cdaab[_0x21f6b8(0x1d0)]==='error'&&console['log'](a4_0x16ef45['red'](_0x21f6b8(0x216)+_0x5cdaab['name']+_0x21f6b8(0x1f3)+_0x5cdaab[_0x21f6b8(0x1ae)]));}for(const _0x5b3dd6 of _0x5b4a7b[_0x21f6b8(0x224)]){_0x5b3dd6['action']==='error'&&console[_0x21f6b8(0x20e)](a4_0x16ef45['red']('\x20\x20Experimental\x20Artifact\x20\x22'+_0x5b3dd6['name']+_0x21f6b8(0x1f3)+_0x5b3dd6[_0x21f6b8(0x1ae)]));}return 0x1;}console[_0x21f6b8(0x20e)]();const _0x314974=getLLMProjectUrl(_0xfb8699,_0x5b4a7b[_0x21f6b8(0x1bb)]);return console[_0x21f6b8(0x20e)]('Project:\x20'+a4_0x16ef45[_0x21f6b8(0x23d)](_0x314974)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x2bd6c2(0x232)]=a4_0x2bd6c2(0x206);[a4_0x2bd6c2(0x1c0)]=a4_0x2bd6c2(0x22d);async[a4_0x2bd6c2(0x18d)](_0x37ac38){const _0x5dfbb0=a4_0x2bd6c2,{options:_0x271612,args:_0x173abe,tdx:_0x18997e}=_0x37ac38;let _0x1f63b6=_0x173abe[0x0]||process['cwd']();const _0x43fe18=_0x271612[_0x5dfbb0(0x19c)],_0x18322d=_0x271612['force'],_0x4124f4=_0x271612[_0x5dfbb0(0x1be)],_0x4a9c97=_0x271612[_0x5dfbb0(0x1f4)],_0x5cd2f3=a4_0x34ce8e['join'](_0x1f63b6,_0x5dfbb0(0x20d)),_0x1265c5=existsSync(_0x5cd2f3);if(_0x1265c5){const {data:_0x24c872}=await withSpinner(_0x5dfbb0(0x201)+_0x1f63b6+_0x5dfbb0(0x228),()=>_0x18997e[_0x5dfbb0(0x1c4)]['pushAgent'](_0x1f63b6,{'dryRun':_0x43fe18,'force':_0x18322d}));if(_0x43fe18)return console['log'](a4_0x16ef45['yellow'](_0x5dfbb0(0x1b6))),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x233)+_0x24c872[_0x5dfbb0(0x1a6)]),0x0;if(_0x24c872[_0x5dfbb0(0x1d0)]===_0x5dfbb0(0x1ae))return console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x243)](_0x5dfbb0(0x1c5)+_0x24c872[_0x5dfbb0(0x1ae)])),0x1;console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x1bf)](_0x5dfbb0(0x1cd)+_0x24c872[_0x5dfbb0(0x1d0)]+'\x20successfully')),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x22f)+_0x24c872[_0x5dfbb0(0x1a6)]);if(_0x24c872[_0x5dfbb0(0x1fb)]&&_0x24c872[_0x5dfbb0(0x204)]){const _0x531a56=getLLMAgentChatUrl(_0x4a9c97,_0x24c872[_0x5dfbb0(0x204)],_0x24c872[_0x5dfbb0(0x1fb)]);console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x1df)+a4_0x16ef45[_0x5dfbb0(0x23d)](_0x531a56));}return 0x0;}const _0x3c113a=_0x271612[_0x5dfbb0(0x21f)],_0x563845=resolveProjectFromContext(_0x1f63b6,_0x3c113a);if(_0x563845[_0x5dfbb0(0x1d9)])_0x1f63b6=_0x563845[_0x5dfbb0(0x23c)],_0x563845[_0x5dfbb0(0x23b)]===_0x5dfbb0(0x236)&&console['log'](a4_0x16ef45[_0x5dfbb0(0x20b)](_0x5dfbb0(0x1ee)+_0x1f63b6));else{let _0x4cbbf0=_0x5dfbb0(0x1b2);_0x563845['reason']===_0x5dfbb0(0x21c)&&(_0x4cbbf0=_0x563845[_0x5dfbb0(0x205)]+_0x5dfbb0(0x1f8)+_0x563845[_0x5dfbb0(0x21f)]+_0x5dfbb0(0x1a9));throw new SDKError(ErrorCode[_0x5dfbb0(0x19e)],_0x563845['reason']===_0x5dfbb0(0x1af)?_0x563845['message']:_0x5dfbb0(0x1d3)+_0x1f63b6,undefined,{'helpText':_0x4cbbf0});}const {data:_0x4aa480}=await withSpinner(_0x5dfbb0(0x191),()=>_0x18997e[_0x5dfbb0(0x1c4)][_0x5dfbb0(0x1ef)](_0x1f63b6,{'dryRun':!![]})),_0x402add=_0x4aa480['counts'][_0x5dfbb0(0x1b3)]['errors']>0x0;if(_0x402add){console[_0x5dfbb0(0x20e)](a4_0x16ef45['red']('\x0aErrors\x20found:'));for(const _0x318f4e of _0x4aa480['agents']){_0x318f4e['action']===_0x5dfbb0(0x1ae)&&console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x243)](_0x5dfbb0(0x1b9)+_0x318f4e[_0x5dfbb0(0x1a6)]+'\x22:\x20'+_0x318f4e[_0x5dfbb0(0x1ae)]));}return 0x1;}const _0x545903=_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x1b3)][_0x5dfbb0(0x1ab)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x235)]['created']+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x1cb)][_0x5dfbb0(0x1ab)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x21e)]['created']+_0x4aa480['counts'][_0x5dfbb0(0x231)][_0x5dfbb0(0x1ab)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x218)][_0x5dfbb0(0x1ab)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x224)][_0x5dfbb0(0x1ab)],_0x47dcad=_0x4aa480['counts'][_0x5dfbb0(0x1b3)][_0x5dfbb0(0x241)]+_0x4aa480['counts'][_0x5dfbb0(0x235)][_0x5dfbb0(0x241)]+_0x4aa480['counts'][_0x5dfbb0(0x1cb)]['updated']+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x21e)][_0x5dfbb0(0x241)]+_0x4aa480['counts'][_0x5dfbb0(0x231)][_0x5dfbb0(0x241)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x218)][_0x5dfbb0(0x241)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x224)][_0x5dfbb0(0x241)],_0x976da4=_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x1b3)][_0x5dfbb0(0x213)]+_0x4aa480['counts'][_0x5dfbb0(0x235)][_0x5dfbb0(0x213)]+_0x4aa480['counts'][_0x5dfbb0(0x1cb)]['unchanged']+_0x4aa480[_0x5dfbb0(0x1ad)]['prompts']['unchanged']+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x231)][_0x5dfbb0(0x213)]+_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x218)][_0x5dfbb0(0x213)]+_0x4aa480['counts'][_0x5dfbb0(0x224)][_0x5dfbb0(0x213)];console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x1e5)+_0x4aa480[_0x5dfbb0(0x22b)]+'\x27:'),console['log']('\x20\x20'+a4_0x16ef45[_0x5dfbb0(0x1bf)]('+\x20'+_0x545903+_0x5dfbb0(0x217))+_0x5dfbb0(0x23e)+a4_0x16ef45[_0x5dfbb0(0x203)]('~\x20'+_0x47dcad+_0x5dfbb0(0x226))+_0x5dfbb0(0x23e)+a4_0x16ef45[_0x5dfbb0(0x20b)]('=\x20'+_0x976da4+_0x5dfbb0(0x215))),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x239)+formatCountSummary(_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x1b3)])),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x1e0)+formatCountSummary(_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x235)])),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x194)+formatCountSummary(_0x4aa480['counts'][_0x5dfbb0(0x1cb)])),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x20f)+formatCountSummary(_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x21e)])),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x1d1)+formatCountSummary(_0x4aa480['counts']['integrations']));const _0x3b9a8a=_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x218)]['created']>0x0||_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x218)][_0x5dfbb0(0x241)]>0x0||_0x4aa480[_0x5dfbb0(0x1ad)]['experimentalKnowledgeBases'][_0x5dfbb0(0x213)]>0x0||_0x4aa480[_0x5dfbb0(0x1ad)]['experimentalArtifacts'][_0x5dfbb0(0x1ab)]>0x0||_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x224)][_0x5dfbb0(0x241)]>0x0||_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x224)][_0x5dfbb0(0x213)]>0x0;_0x3b9a8a&&(console['log'](_0x5dfbb0(0x1de)+formatCountSummary(_0x4aa480[_0x5dfbb0(0x1ad)]['experimentalKnowledgeBases'])),console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x18e)+formatCountSummary(_0x4aa480[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x224)])));console[_0x5dfbb0(0x20e)]('\x20\x20Source:\x20'+a4_0x16ef45[_0x5dfbb0(0x23d)](_0x1f63b6)),displayDiffs(_0x4aa480[_0x5dfbb0(0x1b3)],_0x4aa480[_0x5dfbb0(0x235)],_0x4aa480[_0x5dfbb0(0x1cb)],_0x4aa480['prompts'],_0x4aa480[_0x5dfbb0(0x231)],_0x4aa480['experimentalKnowledgeBases'],_0x4aa480[_0x5dfbb0(0x224)]);if(_0x43fe18)return console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x203)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x545903===0x0&&_0x47dcad===0x0){console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x1bf)](_0x5dfbb0(0x1bc)));const _0x3d8efa=getLLMProjectUrl(_0x4a9c97,_0x4aa480[_0x5dfbb0(0x204)]);return console[_0x5dfbb0(0x20e)]('Project:\x20'+a4_0x16ef45[_0x5dfbb0(0x23d)](_0x3d8efa)),0x0;}if(!_0x4124f4&&!_0x18322d){if(!isInteractive())return console[_0x5dfbb0(0x1ae)](a4_0x16ef45[_0x5dfbb0(0x243)]('\x0aError:'),_0x5dfbb0(0x196)),console['error'](a4_0x16ef45[_0x5dfbb0(0x20b)](_0x5dfbb0(0x198))),0x1;const _0x5e9452=await confirmKey(_0x5dfbb0(0x221)+(_0x545903+_0x47dcad)+'\x20resources?');if(!_0x5e9452)return console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x203)](_0x5dfbb0(0x234)),_0x5dfbb0(0x190)),0x1;}const {data:_0x2ecfdc}=await withSpinner('Pushing\x20to\x20project...',()=>_0x18997e['llm'][_0x5dfbb0(0x1ef)](_0x1f63b6,{'force':_0x18322d})),_0x3e757a=_0x2ecfdc[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x1b3)][_0x5dfbb0(0x1ea)]>0x0||_0x2ecfdc['counts'][_0x5dfbb0(0x235)][_0x5dfbb0(0x1ea)]>0x0||_0x2ecfdc[_0x5dfbb0(0x1ad)][_0x5dfbb0(0x1cb)][_0x5dfbb0(0x1ea)]>0x0||_0x2ecfdc['counts'][_0x5dfbb0(0x21e)][_0x5dfbb0(0x1ea)]>0x0;if(_0x3e757a){console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x203)](_0x5dfbb0(0x225))),console[_0x5dfbb0(0x20e)](),console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x243)](_0x5dfbb0(0x1fe)));for(const _0x21cec7 of _0x2ecfdc[_0x5dfbb0(0x1b3)]){_0x21cec7[_0x5dfbb0(0x1d0)]===_0x5dfbb0(0x1ae)&&console[_0x5dfbb0(0x20e)](a4_0x16ef45['red'](_0x5dfbb0(0x1b9)+_0x21cec7['agentName']+'\x22:\x20'+_0x21cec7[_0x5dfbb0(0x1ae)]));}for(const _0x23b465 of _0x2ecfdc[_0x5dfbb0(0x235)]){_0x23b465[_0x5dfbb0(0x1d0)]===_0x5dfbb0(0x1ae)&&console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x243)](_0x5dfbb0(0x214)+_0x23b465['name']+_0x5dfbb0(0x1f3)+_0x23b465[_0x5dfbb0(0x1ae)]));}for(const _0x4edefa of _0x2ecfdc[_0x5dfbb0(0x1cb)]){_0x4edefa[_0x5dfbb0(0x1d0)]===_0x5dfbb0(0x1ae)&&console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x243)](_0x5dfbb0(0x220)+_0x4edefa['name']+'\x22:\x20'+_0x4edefa[_0x5dfbb0(0x1ae)]));}for(const _0x443367 of _0x2ecfdc[_0x5dfbb0(0x21e)]){_0x443367['action']===_0x5dfbb0(0x1ae)&&console['log'](a4_0x16ef45['red'](_0x5dfbb0(0x193)+_0x443367[_0x5dfbb0(0x232)]+_0x5dfbb0(0x1f3)+_0x443367[_0x5dfbb0(0x1ae)]));}for(const _0x5b000a of _0x2ecfdc[_0x5dfbb0(0x231)]){_0x5b000a[_0x5dfbb0(0x1d0)]===_0x5dfbb0(0x1ae)&&console[_0x5dfbb0(0x20e)](a4_0x16ef45['red'](_0x5dfbb0(0x20a)+_0x5b000a['name']+_0x5dfbb0(0x1f3)+_0x5b000a[_0x5dfbb0(0x1ae)]));}return 0x1;}console[_0x5dfbb0(0x20e)](a4_0x16ef45[_0x5dfbb0(0x1bf)]('\x0a✔\x20Pushed\x20'+(_0x545903+_0x47dcad)+_0x5dfbb0(0x1c1)+_0x2ecfdc[_0x5dfbb0(0x22b)]+'\x27'));const _0x2304cb=getLLMProjectUrl(_0x4a9c97,_0x2ecfdc['projectId']);return console[_0x5dfbb0(0x20e)](_0x5dfbb0(0x1a3)+a4_0x16ef45[_0x5dfbb0(0x23d)](_0x2304cb)),0x0;}}
1
+ const a4_0x5c2a22=a4_0x2a41;function a4_0x2a41(_0x36de48,_0x126ee4){_0x36de48=_0x36de48-0x96;const _0x160342=a4_0x1603();let _0x2a4149=_0x160342[_0x36de48];return _0x2a4149;}(function(_0x387935,_0x2f5cc2){const _0x4a2edb=a4_0x2a41,_0x535eb3=_0x387935();while(!![]){try{const _0x563b9e=parseInt(_0x4a2edb(0xb9))/0x1*(-parseInt(_0x4a2edb(0x140))/0x2)+-parseInt(_0x4a2edb(0x142))/0x3+-parseInt(_0x4a2edb(0xc7))/0x4+-parseInt(_0x4a2edb(0x120))/0x5*(parseInt(_0x4a2edb(0xe6))/0x6)+-parseInt(_0x4a2edb(0xf3))/0x7*(parseInt(_0x4a2edb(0x97))/0x8)+-parseInt(_0x4a2edb(0x96))/0x9+parseInt(_0x4a2edb(0xdd))/0xa*(parseInt(_0x4a2edb(0x117))/0xb);if(_0x563b9e===_0x2f5cc2)break;else _0x535eb3['push'](_0x535eb3['shift']());}catch(_0x43737d){_0x535eb3['push'](_0x535eb3['shift']());}}}(a4_0x1603,0x41bd0));import a4_0x4cef50 from'chalk';import a4_0x4fc3a8 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,resolveAgentPullArgs}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(_0x25cb9a){const _0x35a90f=a4_0x2a41,_0x32a31a=[];if(_0x25cb9a[_0x35a90f(0xbf)]!==undefined)_0x32a31a[_0x35a90f(0xd2)](_0x25cb9a[_0x35a90f(0xbf)]+_0x35a90f(0xbe));if(_0x25cb9a[_0x35a90f(0x100)]!==undefined&&_0x25cb9a['new']>0x0)_0x32a31a[_0x35a90f(0xd2)](a4_0x4cef50[_0x35a90f(0xed)](_0x25cb9a['new']+_0x35a90f(0x9c)));if(_0x25cb9a[_0x35a90f(0xeb)]!==undefined&&_0x25cb9a[_0x35a90f(0xeb)]>0x0)_0x32a31a[_0x35a90f(0xd2)](a4_0x4cef50['green'](_0x25cb9a[_0x35a90f(0xeb)]+_0x35a90f(0x122)));if(_0x25cb9a[_0x35a90f(0xb0)]!==undefined&&_0x25cb9a[_0x35a90f(0xb0)]>0x0)_0x32a31a[_0x35a90f(0xd2)](a4_0x4cef50['yellow'](_0x25cb9a[_0x35a90f(0xb0)]+_0x35a90f(0xec)));if(_0x25cb9a['unchanged']!==undefined&&_0x25cb9a['unchanged']>0x0)_0x32a31a[_0x35a90f(0xd2)](a4_0x4cef50[_0x35a90f(0x113)](_0x25cb9a[_0x35a90f(0x13f)]+_0x35a90f(0xa2)));if(_0x25cb9a['errors']!==undefined&&_0x25cb9a[_0x35a90f(0x139)]>0x0)_0x32a31a[_0x35a90f(0xd2)](a4_0x4cef50['red'](_0x25cb9a['errors']+_0x35a90f(0xd1)));return _0x32a31a[_0x35a90f(0x9a)](',\x20');}function displayDiffs(_0x3c2e53,_0x1d41f5,_0x235632,_0x3e691d,_0x29ae17,_0x5884bf,_0x5ce4d1){const _0x21f6ce=a4_0x2a41;for(const _0x2c1489 of _0x3c2e53){if(_0x2c1489[_0x21f6ce(0x132)]){const _0x15fedd=_0x2c1489[_0x21f6ce(0x123)]||_0x2c1489[_0x21f6ce(0xf9)];console['log'](_0x21f6ce(0x125)+_0x15fedd+'\x27:'),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)),console['log'](_0x2c1489[_0x21f6ce(0x132)]),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c));}}for(const _0xa0dcdd of _0x1d41f5){_0xa0dcdd[_0x21f6ce(0x132)]&&(console[_0x21f6ce(0xc0)](_0x21f6ce(0xb1)+_0xa0dcdd[_0x21f6ce(0xf9)]+'\x27:'),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)),console['log'](_0xa0dcdd[_0x21f6ce(0x132)]),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)));}for(const _0x5797c1 of _0x235632){_0x5797c1[_0x21f6ce(0x132)]&&(console[_0x21f6ce(0xc0)](_0x21f6ce(0xf8)+_0x5797c1[_0x21f6ce(0xf9)]+'\x27:'),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)),console[_0x21f6ce(0xc0)](_0x5797c1[_0x21f6ce(0x132)]),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)));}for(const _0x108afb of _0x3e691d){_0x108afb[_0x21f6ce(0x132)]&&(console[_0x21f6ce(0xc0)](_0x21f6ce(0xae)+_0x108afb[_0x21f6ce(0xf9)]+'\x27:'),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)),console['log'](_0x108afb[_0x21f6ce(0x132)]),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)));}for(const _0x194a32 of _0x29ae17){_0x194a32[_0x21f6ce(0x132)]&&(console[_0x21f6ce(0xc0)](_0x21f6ce(0xcf)+_0x194a32[_0x21f6ce(0xf9)]+'\x27:'),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)),console[_0x21f6ce(0xc0)](_0x194a32[_0x21f6ce(0x132)]),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)));}for(const _0x28ec6c of _0x5884bf){_0x28ec6c[_0x21f6ce(0x132)]&&(console['log'](_0x21f6ce(0x134)+_0x28ec6c[_0x21f6ce(0xf9)]+'\x27:'),console['log']('─'[_0x21f6ce(0xad)](0x3c)),console[_0x21f6ce(0xc0)](_0x28ec6c[_0x21f6ce(0x132)]),console['log']('─'[_0x21f6ce(0xad)](0x3c)));}for(const _0x1dc11e of _0x5ce4d1){_0x1dc11e[_0x21f6ce(0x132)]&&(console['log'](_0x21f6ce(0x146)+_0x1dc11e['name']+'\x27:'),console[_0x21f6ce(0xc0)]('─'['repeat'](0x3c)),console[_0x21f6ce(0xc0)](_0x1dc11e[_0x21f6ce(0x132)]),console[_0x21f6ce(0xc0)]('─'[_0x21f6ce(0xad)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x5c2a22(0xf9)]=a4_0x5c2a22(0xb5);[a4_0x5c2a22(0x141)]=a4_0x5c2a22(0x101);async[a4_0x5c2a22(0x9b)](_0xc96a13){const _0x208e5d=a4_0x5c2a22,{options:_0x4ba1c1,args:_0x4b89f8,tdx:_0x250b84}=_0xc96a13,_0xf37da3=_0x4b89f8[0x0],_0x3c8a2b=_0x4b89f8[0x1],_0x238bcb=_0x4ba1c1[_0x208e5d(0xa0)],_0xe3baa4=_0x4ba1c1[_0x208e5d(0xb4)],_0x54c695=_0x4ba1c1['force'],_0x153582=_0x4ba1c1[_0x208e5d(0xe5)],_0x4d34c2=_0x4ba1c1[_0x208e5d(0xd3)],_0x2779e7=_0x4ba1c1[_0x208e5d(0xde)];let _0x3a83eb;if(_0xf37da3){const _0x5ba4a9=a4_0x4fc3a8['join'](_0xf37da3,_0x208e5d(0xba));if(existsSync(_0x5ba4a9))try{const _0x27cfd6=JSON['parse'](readFileSync(_0x5ba4a9,_0x208e5d(0xef)));_0x27cfd6[_0x208e5d(0xd7)]&&(_0x3a83eb={'llm_project':_0x27cfd6['llm_project']});}catch{}}const _0x2ed98c=findAgentConfigPath(process[_0x208e5d(0x112)]());let _0x1186bb;if(_0x2ed98c)try{const _0x1c51e5=JSON['parse'](readFileSync(_0x2ed98c,_0x208e5d(0xef)));_0x1c51e5[_0x208e5d(0xd7)]&&(_0x1186bb={'llm_project':_0x1c51e5['llm_project']});}catch{}const _0x527071=resolveAgentPullArgs({'arg':_0xf37da3,'agentNameArg':_0x3c8a2b,'agentFlag':_0x2779e7,'contextProject':_0x4d34c2,'argDirConfig':_0x3a83eb,'cwdConfigPath':_0x2ed98c||undefined,'cwdConfig':_0x1186bb}),{projectNameOrId:_0x1350a0,targetAgentName:_0x2a4bef,existingOutputDir:_0x25919e,source:_0x3d4e8f}=_0x527071;if(_0x3d4e8f===_0x208e5d(0x9e))console[_0x208e5d(0xc0)](a4_0x4cef50['dim'](_0x208e5d(0xa5)+a4_0x4fc3a8['join'](_0xf37da3,'tdx.json')+':\x20'+_0x1350a0));else{if(_0x3d4e8f===_0x208e5d(0x111))console[_0x208e5d(0xc0)](a4_0x4cef50[_0x208e5d(0xda)](_0x208e5d(0xe4)+_0x1350a0));else _0x3d4e8f===_0x208e5d(0x130)&&console[_0x208e5d(0xc0)](a4_0x4cef50[_0x208e5d(0xda)]('Using\x20project\x20from\x20context:\x20'+_0x1350a0));}if(!_0x1350a0)return _0x2779e7?(console[_0x208e5d(0xc0)](a4_0x4cef50['yellow'](_0x208e5d(0xfe))),console['log'](_0x208e5d(0xa4)),console[_0x208e5d(0xc0)](_0x208e5d(0xc6))):(console[_0x208e5d(0xc0)](a4_0x4cef50['yellow']('llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x208e5d(0xc0)](_0x208e5d(0xee)),console[_0x208e5d(0xc0)](_0x208e5d(0x10b)),console['log'](_0x208e5d(0x119)),console[_0x208e5d(0xc0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20--agent\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20context\x20project'),console['log'](_0x208e5d(0x9f))),0x1;if(_0x2a4bef){const {data:_0x3e6d25}=await withSpinner(_0x208e5d(0xf4)+_0x2a4bef+'\x22\x20from\x20project\x20\x22'+_0x1350a0+'\x22...',()=>_0x250b84[_0x208e5d(0xd9)]['pullAgent'](_0x1350a0,_0x2a4bef,_0x238bcb,{'dryRun':_0xe3baa4,'force':_0x54c695}));if(_0xe3baa4)return console[_0x208e5d(0xc0)](a4_0x4cef50['yellow']('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0x208e5d(0xc0)](_0x208e5d(0x12e)+_0x3e6d25[_0x208e5d(0x123)]),console[_0x208e5d(0xc0)](_0x208e5d(0x107)+_0x3e6d25[_0x208e5d(0xff)]),_0x3e6d25[_0x208e5d(0x132)]&&(console[_0x208e5d(0xc0)](_0x208e5d(0x127)),console[_0x208e5d(0xc0)]('─'['repeat'](0x3c)),console['log'](_0x3e6d25[_0x208e5d(0x132)]),console[_0x208e5d(0xc0)]('─'[_0x208e5d(0xad)](0x3c))),0x0;return console[_0x208e5d(0xc0)](a4_0x4cef50[_0x208e5d(0xed)](_0x208e5d(0x118))),console['log'](_0x208e5d(0x105)+_0x3e6d25[_0x208e5d(0x123)]),console[_0x208e5d(0xc0)]('Output:\x20'+_0x3e6d25[_0x208e5d(0xff)]),console[_0x208e5d(0xc0)](_0x208e5d(0x136)+(_0x3e6d25[_0x208e5d(0x135)]?a4_0x4cef50['green'](_0x208e5d(0x100)):_0x3e6d25[_0x208e5d(0x115)]?a4_0x4cef50[_0x208e5d(0x114)](_0x208e5d(0xb0)):a4_0x4cef50['gray']('unchanged'))),0x0;}const _0xb38fc8=_0x25919e||_0x238bcb,{data:_0x2ae40a}=await withSpinner(_0x208e5d(0x12b)+_0x1350a0+'\x22...',()=>_0x250b84[_0x208e5d(0xd9)][_0x208e5d(0x13d)](_0x1350a0,_0xb38fc8,{'dryRun':!![]})),_0x4769a1=_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd6)][_0x208e5d(0x100)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xf2)]['new']+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0x10a)][_0x208e5d(0x100)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd0)][_0x208e5d(0x100)]+_0x2ae40a['counts'][_0x208e5d(0xd8)][_0x208e5d(0x100)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xb6)][_0x208e5d(0x100)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0x13e)][_0x208e5d(0x100)],_0x388ca3=_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd6)][_0x208e5d(0xb0)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xf2)]['updated']+_0x2ae40a[_0x208e5d(0x98)]['textKnowledgeBases'][_0x208e5d(0xb0)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd0)][_0x208e5d(0xb0)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd8)][_0x208e5d(0xb0)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xb6)]['updated']+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0x13e)][_0x208e5d(0xb0)],_0x399d17=_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd6)][_0x208e5d(0x13f)]+_0x2ae40a['counts'][_0x208e5d(0xf2)]['unchanged']+_0x2ae40a['counts']['textKnowledgeBases'][_0x208e5d(0x13f)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd0)][_0x208e5d(0x13f)]+_0x2ae40a[_0x208e5d(0x98)]['integrations'][_0x208e5d(0x13f)]+_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xb6)][_0x208e5d(0x13f)]+_0x2ae40a[_0x208e5d(0x98)]['experimentalArtifacts']['unchanged'];console[_0x208e5d(0xc0)](_0x208e5d(0xc3)+_0x2ae40a[_0x208e5d(0x124)]+'\x27:'),console[_0x208e5d(0xc0)]('\x20\x20'+a4_0x4cef50[_0x208e5d(0xed)]('+\x20'+_0x4769a1+'\x20new')+_0x208e5d(0x11b)+a4_0x4cef50['yellow']('~\x20'+_0x388ca3+'\x20changed')+_0x208e5d(0x11b)+a4_0x4cef50[_0x208e5d(0xda)]('=\x20'+_0x399d17+'\x20unchanged')),console[_0x208e5d(0xc0)](_0x208e5d(0xdc)+formatCountSummary(_0x2ae40a[_0x208e5d(0x98)]['agents'])),console[_0x208e5d(0xc0)](_0x208e5d(0x10c)+formatCountSummary(_0x2ae40a[_0x208e5d(0x98)]['knowledgeBases'])),console[_0x208e5d(0xc0)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2ae40a[_0x208e5d(0x98)]['textKnowledgeBases'])),console[_0x208e5d(0xc0)](_0x208e5d(0xf6)+formatCountSummary(_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xd0)])),console[_0x208e5d(0xc0)]('\x20\x20Integrations:\x20'+formatCountSummary(_0x2ae40a['counts'][_0x208e5d(0xd8)]));const _0xc596b9=_0x2ae40a['counts'][_0x208e5d(0xb6)][_0x208e5d(0xbf)]>0x0||_0x2ae40a['counts'][_0x208e5d(0x13e)][_0x208e5d(0xbf)]>0x0;_0xc596b9&&(console[_0x208e5d(0xc0)](_0x208e5d(0xc5)+formatCountSummary(_0x2ae40a[_0x208e5d(0x98)][_0x208e5d(0xb6)])),console[_0x208e5d(0xc0)](_0x208e5d(0xb7)+formatCountSummary(_0x2ae40a['counts'][_0x208e5d(0x13e)])));console[_0x208e5d(0xc0)]('\x20\x20Target:\x20'+a4_0x4cef50[_0x208e5d(0xe3)](_0x2ae40a[_0x208e5d(0xe8)])),displayDiffs(_0x2ae40a['agents'],_0x2ae40a[_0x208e5d(0xf2)],_0x2ae40a[_0x208e5d(0x10a)],_0x2ae40a['prompts'],_0x2ae40a[_0x208e5d(0xd8)],_0x2ae40a['experimentalKnowledgeBases'],_0x2ae40a['experimentalArtifacts']);if(_0xe3baa4)return console[_0x208e5d(0xc0)](a4_0x4cef50[_0x208e5d(0x114)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x4769a1===0x0&&_0x388ca3===0x0)return console['log'](a4_0x4cef50[_0x208e5d(0xed)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x2ae40a[_0x208e5d(0x124)]},_0x4ba1c1[_0x208e5d(0x11c)]),console['log'](a4_0x4cef50[_0x208e5d(0xed)](_0x208e5d(0x11a)+a4_0x4cef50['dim'](_0x208e5d(0xd7))+_0x208e5d(0x128)+a4_0x4cef50[_0x208e5d(0xe3)](_0x2ae40a[_0x208e5d(0x124)]))),0x0;if(!_0x153582&&!_0x54c695){if(!isInteractive())return console[_0x208e5d(0xca)](a4_0x4cef50[_0x208e5d(0x110)](_0x208e5d(0x138)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x208e5d(0xca)](a4_0x4cef50[_0x208e5d(0xda)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2f9b79=await confirmKey(_0x208e5d(0xa7)+(_0x4769a1+_0x388ca3)+'\x20files?');if(!_0x2f9b79)return console[_0x208e5d(0xc0)](a4_0x4cef50[_0x208e5d(0x114)](_0x208e5d(0xd5)),_0x208e5d(0xc2)),0x1;}const {data:_0x358816}=await withSpinner('Writing\x20files...',()=>_0x250b84['llm']['pullProject'](_0x1350a0,_0xb38fc8,{'force':_0x54c695}));return console['log'](a4_0x4cef50['green'](_0x208e5d(0xfd)+(_0x4769a1+_0x388ca3)+_0x208e5d(0x11f)+_0x358816['outputDir'])),saveSessionContext({'llm_project':_0x358816['projectName']},_0x4ba1c1[_0x208e5d(0x11c)]),console[_0x208e5d(0xc0)](a4_0x4cef50[_0x208e5d(0xed)](_0x208e5d(0x11a)+a4_0x4cef50[_0x208e5d(0xda)](_0x208e5d(0xd7))+_0x208e5d(0x128)+a4_0x4cef50[_0x208e5d(0xe3)](_0x358816[_0x208e5d(0x124)]))),0x0;}}function a4_0x1603(){const _0x593548=['1200rYzNqZ','agent','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','New\x20project\x20name\x20is\x20required','reason','cyan','Using\x20project:\x20','yes','870FHWPnj','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','outputDir','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20\x20Agent\x20\x22','created','\x20updated','green','Usage:\x20tdx\x20agent\x20pull\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#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','utf-8','\x20\x20Experimental\x20Artifact\x20\x22','Would\x20push\x20agent:\x20','knowledgeBases','7XApXMZ','Pulling\x20agent\x20\x22','MISSING_ARGUMENT','\x20\x20Prompts:\x20','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','name','\x20resources?','agent:push','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x0a✔\x20Pulled\x20','The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a','outputPath','new','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x0a✔\x20Pushed\x20','\x20successfully','Agent:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Output\x20path:\x20','\x20\x20Integrations:\x20','newProjectName','textKnowledgeBases','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','\x20\x20Knowledge\x20Bases:\x20','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','Would\x20clone:','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','red','cwd-config','cwd','gray','yellow','hasChanges','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','118393IupeZH','Agent\x20pulled\x20successfully','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','✔\x20Context\x20set:\x20','\x20|\x20','session','\x22\x20to\x20\x22','\x20\x20Knowledge\x20Base\x20\x22','\x20files\x20to\x20','3905BMUYND','\x22:\x20','\x20created','agentName','projectName','\x0aChanges\x20to\x20agent\x20\x27','Cloning\x20\x22','\x0aChanges:','\x20=\x20','Pushing\x20agent\x20from\x20\x22','\x20\x20Text\x20Knowledge\x20Bases:\x20','Analyzing\x20project\x20\x22','Project\x20cloned\x20successfully','\x0aErrors\x20found:','Would\x20pull\x20agent:\x20','Agent\x20','context','source','diff','\x20--name\x20','\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27','isNew','Status:\x20','action','\x0aError:','errors','pushAgent','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','\x20resources\x20to\x20\x27','pullProject','experimentalArtifacts','unchanged','4978mgjWRS','description','41166OUKtEY','dirname','\x22\x20to\x20a\x20different\x20profile','no_local_folder','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','Dry\x20run\x20-\x20no\x20changes\x20made','Errors:','\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)','Source:\x20','\x20--profile\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','message','4374873PnvwJm','308616cAmmCI','counts','Using\x20current\x20project:\x20','join','execute','\x20new','Clone\x20\x22','arg-dir','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20project','output','\x20\x20Experimental\x20Knowledge\x20Base\x20\x22','\x20unchanged','Project\x20cloned\x20with\x20errors','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','Using\x20project\x20from\x20','\x20\x20Prompt\x20\x22','\x0aWrite\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','Pushing\x20to\x20project...','\x0aPush\x20','\x22\x20to\x20new\x20project\x20\x22','no_context','repeat','\x0aChanges\x20to\x20prompt\x20\x27','agent.yml','updated','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','newProjectId','Project:\x20','dryRun','agent:pull','experimentalKnowledgeBases','\x20\x20Experimental\x20Artifacts:\x20','\x20\x20tdx\x20agent\x20pull\x20','137QiLdeN','tdx.json','INVALID_ARGUMENT','\x22...','found','\x20total','total','log','Using\x20local\x20project:\x20','-\x20no\x20files\x20written','\x0aPull\x20summary\x20for\x20\x27','Cannot\x20clone\x20from\x20context\x20project\x20\x22','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','118648krGGfN','\x20\x20Integration\x20\x22','New\x20project\x20ID:\x20','error','force','\x20\x20Source:\x20','projectDir','sourceProjectName','\x0aChanges\x20to\x20integration\x20\x27','prompts','\x20errors','push','llmProject','projectId','Cancelled','agents','llm_project','integrations','llm','dim','site','\x20\x20Agents:\x20'];a4_0x1603=function(){return _0x593548;};return a4_0x1603();}export class AgentCloneCommand extends BaseCommand{['name']='agent:clone';[a4_0x5c2a22(0x141)]=a4_0x5c2a22(0x13b);async[a4_0x5c2a22(0x9b)](_0x4820ca){const _0x1b7063=a4_0x5c2a22,{options:_0x11bd00,args:_0x3c0fb8,tdx:_0x17e42b}=_0x4820ca,_0x340404=_0x3c0fb8[0x0],_0xb20605=_0x11bd00[_0x1b7063(0xf9)],_0x192705=_0x11bd00['dryRun'],_0x413348=_0x11bd00[_0x1b7063(0xe5)],_0x3ed7a4=_0x11bd00['site'],_0x5a1bf2=_0x11bd00[_0x1b7063(0xd3)];let _0x472edb;const _0x1f5b63=findAgentConfigPath(process[_0x1b7063(0x112)]());if(_0x340404){const _0x2c55cd=a4_0x4fc3a8[_0x1b7063(0x9a)](_0x340404,_0x1b7063(0xba));existsSync(_0x2c55cd)?(_0x472edb=_0x340404,console[_0x1b7063(0xc0)](a4_0x4cef50['dim'](_0x1b7063(0xc1)+_0x340404))):_0x472edb=_0x340404;}else{if(_0x1f5b63)_0x472edb=a4_0x4fc3a8[_0x1b7063(0x143)](_0x1f5b63),console[_0x1b7063(0xc0)](a4_0x4cef50['dim'](_0x1b7063(0x99)+_0x472edb));else{if(_0x5a1bf2){const _0x14876a=sanitizeForFilesystem(_0x5a1bf2);let _0x5a5247=_0x14876a,_0x3709eb=a4_0x4fc3a8[_0x1b7063(0x9a)](process[_0x1b7063(0x112)](),_0x1b7063(0xd6),_0x14876a,_0x1b7063(0xba));if(!existsSync(_0x3709eb)){const _0x39678d=normalizeName(_0x5a1bf2),_0x47f908=a4_0x4fc3a8[_0x1b7063(0x9a)](process['cwd'](),_0x1b7063(0xd6),_0x39678d,_0x1b7063(0xba));existsSync(_0x47f908)&&(_0x5a5247=_0x39678d,_0x3709eb=_0x47f908);}if(existsSync(_0x3709eb))_0x472edb=a4_0x4fc3a8['dirname'](_0x3709eb),console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0xda)](_0x1b7063(0xc1)+_0x472edb));else{const _0x400ab3=_0x11bd00['profile'];if(_0x400ab3)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1b7063(0xc4)+_0x5a1bf2+_0x1b7063(0x144),undefined,{'helpText':_0x1b7063(0x10d)+_0x1b7063(0xdf)+(_0x1b7063(0xb8)+_0x5a1bf2+'\x0a')+(_0x1b7063(0xa8)+_0x5a5247+_0x1b7063(0x133)+(_0xb20605||'<new-name>')+_0x1b7063(0x14b)+_0x400ab3)});_0x472edb=_0x5a1bf2,console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0xda)]('Using\x20context\x20project:\x20'+_0x5a1bf2));}}}}if(!_0x472edb)return console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x114)](_0x1b7063(0x106))),console[_0x1b7063(0xc0)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console['log'](_0x1b7063(0xe9)),console[_0x1b7063(0xc0)](_0x1b7063(0x149)),console[_0x1b7063(0xc0)](_0x1b7063(0xe7)),0x1;if(!_0xb20605)throw new SDKError(ErrorCode[_0x1b7063(0xf5)],_0x1b7063(0xe1),undefined,{'helpText':_0x1b7063(0xe0)});if(!_0x413348&&!_0x192705){if(!isInteractive())return console[_0x1b7063(0xca)](a4_0x4cef50['red'](_0x1b7063(0x138)),_0x1b7063(0x14c)),console['error'](a4_0x4cef50[_0x1b7063(0xda)](_0x1b7063(0x102))),0x1;const _0x2f2543=await confirmKey(_0x1b7063(0x9d)+_0x472edb+_0x1b7063(0xab)+_0xb20605+'\x22?');if(!_0x2f2543)return console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x114)]('Cancelled')),0x1;}const {data:_0x41db4d}=await withSpinner(_0x1b7063(0x126)+_0x472edb+_0x1b7063(0x11d)+_0xb20605+_0x1b7063(0xbc),()=>_0x17e42b[_0x1b7063(0xd9)]['cloneProject'](_0x472edb,_0xb20605,{'dryRun':_0x192705}));if(_0x192705){console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x114)](_0x1b7063(0x147))),console['log'](_0x1b7063(0x14a)+_0x41db4d[_0x1b7063(0xce)]),console[_0x1b7063(0xc0)]('New\x20project:\x20'+_0xb20605),console[_0x1b7063(0xc0)](_0x1b7063(0x10e)),console['log'](_0x1b7063(0xdc)+_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xd6)][_0x1b7063(0xeb)]),console[_0x1b7063(0xc0)](_0x1b7063(0x10c)+_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xf2)][_0x1b7063(0xeb)]),console[_0x1b7063(0xc0)]('\x20\x20Prompts:\x20'+_0x41db4d['counts'][_0x1b7063(0xd0)][_0x1b7063(0xeb)]);const _0x1c6d35=_0x41db4d[_0x1b7063(0x98)]['experimentalKnowledgeBases'][_0x1b7063(0xeb)]>0x0||_0x41db4d[_0x1b7063(0x98)]['experimentalArtifacts'][_0x1b7063(0xeb)]>0x0;return _0x1c6d35&&(console['log']('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+_0x41db4d['counts']['experimentalKnowledgeBases']['created']),console[_0x1b7063(0xc0)](_0x1b7063(0xb7)+_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0x13e)][_0x1b7063(0xeb)])),0x0;}const _0x1a9ec2=_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xd6)][_0x1b7063(0x139)]>0x0||_0x41db4d['counts']['knowledgeBases'][_0x1b7063(0x139)]>0x0||_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xd0)]['errors']>0x0||_0x41db4d[_0x1b7063(0x98)]['experimentalKnowledgeBases']['errors']>0x0||_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0x13e)][_0x1b7063(0x139)]>0x0;_0x1a9ec2?console[_0x1b7063(0xc0)](a4_0x4cef50['yellow'](_0x1b7063(0xa3))):console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0xed)](_0x1b7063(0x12c)));console[_0x1b7063(0xc0)](_0x1b7063(0x14a)+_0x41db4d[_0x1b7063(0xce)]),console[_0x1b7063(0xc0)]('New\x20project:\x20'+_0x41db4d[_0x1b7063(0x109)]),console[_0x1b7063(0xc0)](_0x1b7063(0xc9)+_0x41db4d[_0x1b7063(0xb2)]),console[_0x1b7063(0xc0)](),console['log']('Summary:'),console[_0x1b7063(0xc0)](_0x1b7063(0xdc)+formatCountSummary(_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xd6)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x41db4d['counts'][_0x1b7063(0xf2)])),console[_0x1b7063(0xc0)](_0x1b7063(0xf6)+formatCountSummary(_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xd0)])),console[_0x1b7063(0xc0)](_0x1b7063(0x108)+formatCountSummary(_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xd8)]));const _0x1c1fec=_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xb6)]['created']>0x0||_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0xb6)][_0x1b7063(0xb0)]>0x0||_0x41db4d['counts'][_0x1b7063(0xb6)][_0x1b7063(0x13f)]>0x0||_0x41db4d['counts'][_0x1b7063(0x13e)][_0x1b7063(0xeb)]>0x0||_0x41db4d['counts'][_0x1b7063(0x13e)][_0x1b7063(0xb0)]>0x0||_0x41db4d['counts'][_0x1b7063(0x13e)]['unchanged']>0x0;_0x1c1fec&&(console[_0x1b7063(0xc0)](_0x1b7063(0xc5)+formatCountSummary(_0x41db4d['counts']['experimentalKnowledgeBases'])),console[_0x1b7063(0xc0)](_0x1b7063(0xb7)+formatCountSummary(_0x41db4d[_0x1b7063(0x98)][_0x1b7063(0x13e)])));if(_0x1a9ec2){console[_0x1b7063(0xc0)](),console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x110)](_0x1b7063(0x148)));for(const _0xbc42 of _0x41db4d['agents']){_0xbc42['action']===_0x1b7063(0xca)&&console['log'](a4_0x4cef50[_0x1b7063(0x110)](_0x1b7063(0xea)+_0xbc42[_0x1b7063(0x123)]+_0x1b7063(0x121)+_0xbc42[_0x1b7063(0xca)]));}for(const _0x36a81 of _0x41db4d[_0x1b7063(0xf2)]){_0x36a81[_0x1b7063(0x137)]===_0x1b7063(0xca)&&console[_0x1b7063(0xc0)](a4_0x4cef50['red'](_0x1b7063(0x11e)+_0x36a81[_0x1b7063(0xf9)]+_0x1b7063(0x121)+_0x36a81[_0x1b7063(0xca)]));}for(const _0x5b2065 of _0x41db4d[_0x1b7063(0xd0)]){_0x5b2065['action']===_0x1b7063(0xca)&&console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x110)](_0x1b7063(0xa6)+_0x5b2065[_0x1b7063(0xf9)]+_0x1b7063(0x121)+_0x5b2065[_0x1b7063(0xca)]));}for(const _0x1920ba of _0x41db4d['integrations']){_0x1920ba[_0x1b7063(0x137)]===_0x1b7063(0xca)&&console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x110)](_0x1b7063(0xc8)+_0x1920ba['name']+_0x1b7063(0x121)+_0x1920ba[_0x1b7063(0xca)]));}for(const _0x313b30 of _0x41db4d[_0x1b7063(0xb6)]){_0x313b30[_0x1b7063(0x137)]===_0x1b7063(0xca)&&console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x110)](_0x1b7063(0xa1)+_0x313b30[_0x1b7063(0xf9)]+_0x1b7063(0x121)+_0x313b30[_0x1b7063(0xca)]));}for(const _0x54940d of _0x41db4d['experimentalArtifacts']){_0x54940d[_0x1b7063(0x137)]===_0x1b7063(0xca)&&console[_0x1b7063(0xc0)](a4_0x4cef50[_0x1b7063(0x110)](_0x1b7063(0xf0)+_0x54940d[_0x1b7063(0xf9)]+_0x1b7063(0x121)+_0x54940d['error']));}return 0x1;}console[_0x1b7063(0xc0)]();const _0x1f05f1=getLLMProjectUrl(_0x3ed7a4,_0x41db4d[_0x1b7063(0xb2)]);return console[_0x1b7063(0xc0)](_0x1b7063(0xb3)+a4_0x4cef50['cyan'](_0x1f05f1)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x5c2a22(0xfb);[a4_0x5c2a22(0x141)]=a4_0x5c2a22(0x116);async[a4_0x5c2a22(0x9b)](_0xadaebf){const _0x3e8396=a4_0x5c2a22,{options:_0x2b55a8,args:_0x36e506,tdx:_0x5d0c92}=_0xadaebf;let _0x13ab57=_0x36e506[0x0]||process[_0x3e8396(0x112)]();const _0x11f0f0=_0x2b55a8[_0x3e8396(0xb4)],_0xd1e2d8=_0x2b55a8[_0x3e8396(0xcb)],_0x4e8931=_0x2b55a8[_0x3e8396(0xe5)],_0x1814c9=_0x2b55a8[_0x3e8396(0xdb)],_0x2811a2=a4_0x4fc3a8[_0x3e8396(0x9a)](_0x13ab57,_0x3e8396(0xaf)),_0x526a13=existsSync(_0x2811a2);if(_0x526a13){const {data:_0x13b0f1}=await withSpinner(_0x3e8396(0x129)+_0x13ab57+'\x22...',()=>_0x5d0c92[_0x3e8396(0xd9)][_0x3e8396(0x13a)](_0x13ab57,{'dryRun':_0x11f0f0,'force':_0xd1e2d8}));if(_0x11f0f0)return console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x114)](_0x3e8396(0x147))),console[_0x3e8396(0xc0)](_0x3e8396(0xf1)+_0x13b0f1[_0x3e8396(0x123)]),0x0;if(_0x13b0f1[_0x3e8396(0x137)]===_0x3e8396(0xca))return console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)]('Failed\x20to\x20push\x20agent:\x20'+_0x13b0f1[_0x3e8396(0xca)])),0x1;console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0xed)](_0x3e8396(0x12f)+_0x13b0f1[_0x3e8396(0x137)]+_0x3e8396(0x104))),console['log']('Agent:\x20'+_0x13b0f1['agentName']);if(_0x13b0f1['agentId']&&_0x13b0f1[_0x3e8396(0xd4)]){const _0xc244b3=getLLMAgentChatUrl(_0x1814c9,_0x13b0f1[_0x3e8396(0xd4)],_0x13b0f1['agentId']);console['log']('Chat:\x20'+a4_0x4cef50[_0x3e8396(0xe3)](_0xc244b3));}return 0x0;}const _0x344fa7=_0x2b55a8['llmProject'],_0x194b64=resolveProjectFromContext(_0x13ab57,_0x344fa7);if(_0x194b64[_0x3e8396(0xbd)])_0x13ab57=_0x194b64[_0x3e8396(0xcd)],_0x194b64[_0x3e8396(0x131)]===_0x3e8396(0x130)&&console[_0x3e8396(0xc0)](a4_0x4cef50['dim'](_0x3e8396(0xe4)+_0x13ab57));else{let _0x27f27e=_0x3e8396(0xf7);_0x194b64[_0x3e8396(0xe2)]===_0x3e8396(0x145)&&(_0x27f27e=_0x194b64['message']+'\x0aRun\x20\x27tdx\x20agent\x20pull\x20'+_0x194b64[_0x3e8396(0xd3)]+'\x27\x20to\x20create\x20the\x20folder\x20structure.');throw new SDKError(ErrorCode[_0x3e8396(0xbb)],_0x194b64[_0x3e8396(0xe2)]===_0x3e8396(0xac)?_0x194b64[_0x3e8396(0x14d)]:'No\x20tdx.json\x20found\x20in\x20'+_0x13ab57,undefined,{'helpText':_0x27f27e});}const {data:_0x5c5a87}=await withSpinner('Analyzing\x20changes\x20to\x20push...',()=>_0x5d0c92[_0x3e8396(0xd9)]['pushProject'](_0x13ab57,{'dryRun':!![]})),_0x20ea5c=_0x5c5a87[_0x3e8396(0x98)]['agents']['errors']>0x0;if(_0x20ea5c){console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)](_0x3e8396(0x12d)));for(const _0x44cf8c of _0x5c5a87[_0x3e8396(0xd6)]){_0x44cf8c[_0x3e8396(0x137)]===_0x3e8396(0xca)&&console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)](_0x3e8396(0xea)+_0x44cf8c[_0x3e8396(0x123)]+_0x3e8396(0x121)+_0x44cf8c[_0x3e8396(0xca)]));}return 0x1;}const _0x25da59=_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd6)]['created']+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xf2)]['created']+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0x10a)][_0x3e8396(0xeb)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd0)]['created']+_0x5c5a87[_0x3e8396(0x98)]['integrations']['created']+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xb6)][_0x3e8396(0xeb)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0x13e)][_0x3e8396(0xeb)],_0x2f5d4f=_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd6)][_0x3e8396(0xb0)]+_0x5c5a87[_0x3e8396(0x98)]['knowledgeBases'][_0x3e8396(0xb0)]+_0x5c5a87[_0x3e8396(0x98)]['textKnowledgeBases'][_0x3e8396(0xb0)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd0)][_0x3e8396(0xb0)]+_0x5c5a87['counts'][_0x3e8396(0xd8)][_0x3e8396(0xb0)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xb6)][_0x3e8396(0xb0)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0x13e)][_0x3e8396(0xb0)],_0x5bcee6=_0x5c5a87[_0x3e8396(0x98)]['agents'][_0x3e8396(0x13f)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xf2)][_0x3e8396(0x13f)]+_0x5c5a87[_0x3e8396(0x98)]['textKnowledgeBases']['unchanged']+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd0)][_0x3e8396(0x13f)]+_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd8)][_0x3e8396(0x13f)]+_0x5c5a87[_0x3e8396(0x98)]['experimentalKnowledgeBases'][_0x3e8396(0x13f)]+_0x5c5a87[_0x3e8396(0x98)]['experimentalArtifacts'][_0x3e8396(0x13f)];console[_0x3e8396(0xc0)]('\x0aPush\x20summary\x20for\x20\x27'+_0x5c5a87[_0x3e8396(0x124)]+'\x27:'),console[_0x3e8396(0xc0)]('\x20\x20'+a4_0x4cef50[_0x3e8396(0xed)]('+\x20'+_0x25da59+_0x3e8396(0x9c))+'\x20|\x20'+a4_0x4cef50[_0x3e8396(0x114)]('~\x20'+_0x2f5d4f+'\x20changed')+_0x3e8396(0x11b)+a4_0x4cef50[_0x3e8396(0xda)]('=\x20'+_0x5bcee6+_0x3e8396(0xa2))),console[_0x3e8396(0xc0)](_0x3e8396(0xdc)+formatCountSummary(_0x5c5a87[_0x3e8396(0x98)]['agents'])),console[_0x3e8396(0xc0)](_0x3e8396(0x10c)+formatCountSummary(_0x5c5a87['counts']['knowledgeBases'])),console[_0x3e8396(0xc0)](_0x3e8396(0x12a)+formatCountSummary(_0x5c5a87['counts']['textKnowledgeBases'])),console[_0x3e8396(0xc0)](_0x3e8396(0xf6)+formatCountSummary(_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd0)])),console[_0x3e8396(0xc0)](_0x3e8396(0x108)+formatCountSummary(_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xd8)]));const _0x195569=_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0xb6)]['created']>0x0||_0x5c5a87[_0x3e8396(0x98)]['experimentalKnowledgeBases'][_0x3e8396(0xb0)]>0x0||_0x5c5a87['counts'][_0x3e8396(0xb6)][_0x3e8396(0x13f)]>0x0||_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0x13e)][_0x3e8396(0xeb)]>0x0||_0x5c5a87[_0x3e8396(0x98)]['experimentalArtifacts']['updated']>0x0||_0x5c5a87[_0x3e8396(0x98)]['experimentalArtifacts']['unchanged']>0x0;_0x195569&&(console['log']('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x5c5a87['counts'][_0x3e8396(0xb6)])),console['log'](_0x3e8396(0xb7)+formatCountSummary(_0x5c5a87[_0x3e8396(0x98)][_0x3e8396(0x13e)])));console[_0x3e8396(0xc0)](_0x3e8396(0xcc)+a4_0x4cef50[_0x3e8396(0xe3)](_0x13ab57)),displayDiffs(_0x5c5a87[_0x3e8396(0xd6)],_0x5c5a87[_0x3e8396(0xf2)],_0x5c5a87[_0x3e8396(0x10a)],_0x5c5a87['prompts'],_0x5c5a87[_0x3e8396(0xd8)],_0x5c5a87[_0x3e8396(0xb6)],_0x5c5a87[_0x3e8396(0x13e)]);if(_0x11f0f0)return console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x114)](_0x3e8396(0x10f))),0x0;if(_0x25da59===0x0&&_0x2f5d4f===0x0){console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0xed)](_0x3e8396(0xfc)));const _0x4e7d4f=getLLMProjectUrl(_0x1814c9,_0x5c5a87[_0x3e8396(0xd4)]);return console[_0x3e8396(0xc0)](_0x3e8396(0xb3)+a4_0x4cef50[_0x3e8396(0xe3)](_0x4e7d4f)),0x0;}if(!_0x4e8931&&!_0xd1e2d8){if(!isInteractive())return console['error'](a4_0x4cef50[_0x3e8396(0x110)](_0x3e8396(0x138)),_0x3e8396(0x14c)),console[_0x3e8396(0xca)](a4_0x4cef50['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x35fcde=await confirmKey(_0x3e8396(0xaa)+(_0x25da59+_0x2f5d4f)+_0x3e8396(0xfa));if(!_0x35fcde)return console['log'](a4_0x4cef50['yellow']('Cancelled'),'-\x20nothing\x20pushed'),0x1;}const {data:_0x201a58}=await withSpinner(_0x3e8396(0xa9),()=>_0x5d0c92[_0x3e8396(0xd9)]['pushProject'](_0x13ab57,{'force':_0xd1e2d8})),_0x465ea3=_0x201a58[_0x3e8396(0x98)][_0x3e8396(0xd6)]['errors']>0x0||_0x201a58[_0x3e8396(0x98)][_0x3e8396(0xf2)][_0x3e8396(0x139)]>0x0||_0x201a58[_0x3e8396(0x98)][_0x3e8396(0x10a)][_0x3e8396(0x139)]>0x0||_0x201a58[_0x3e8396(0x98)][_0x3e8396(0xd0)]['errors']>0x0;if(_0x465ea3){console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x114)]('\x0aProject\x20pushed\x20with\x20errors')),console[_0x3e8396(0xc0)](),console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)](_0x3e8396(0x148)));for(const _0xe48435 of _0x201a58[_0x3e8396(0xd6)]){_0xe48435[_0x3e8396(0x137)]===_0x3e8396(0xca)&&console[_0x3e8396(0xc0)](a4_0x4cef50['red']('\x20\x20Agent\x20\x22'+_0xe48435[_0x3e8396(0x123)]+'\x22:\x20'+_0xe48435[_0x3e8396(0xca)]));}for(const _0x6a18a6 of _0x201a58[_0x3e8396(0xf2)]){_0x6a18a6[_0x3e8396(0x137)]===_0x3e8396(0xca)&&console['log'](a4_0x4cef50[_0x3e8396(0x110)](_0x3e8396(0x11e)+_0x6a18a6['name']+_0x3e8396(0x121)+_0x6a18a6[_0x3e8396(0xca)]));}for(const _0x20c490 of _0x201a58['textKnowledgeBases']){_0x20c490[_0x3e8396(0x137)]===_0x3e8396(0xca)&&console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x20c490[_0x3e8396(0xf9)]+'\x22:\x20'+_0x20c490[_0x3e8396(0xca)]));}for(const _0x475a8c of _0x201a58[_0x3e8396(0xd0)]){_0x475a8c[_0x3e8396(0x137)]===_0x3e8396(0xca)&&console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)]('\x20\x20Prompt\x20\x22'+_0x475a8c[_0x3e8396(0xf9)]+_0x3e8396(0x121)+_0x475a8c[_0x3e8396(0xca)]));}for(const _0xd7dd7d of _0x201a58['integrations']){_0xd7dd7d['action']===_0x3e8396(0xca)&&console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0x110)](_0x3e8396(0xc8)+_0xd7dd7d[_0x3e8396(0xf9)]+_0x3e8396(0x121)+_0xd7dd7d[_0x3e8396(0xca)]));}return 0x1;}console[_0x3e8396(0xc0)](a4_0x4cef50[_0x3e8396(0xed)](_0x3e8396(0x103)+(_0x25da59+_0x2f5d4f)+_0x3e8396(0x13c)+_0x201a58['projectName']+'\x27'));const _0xa58931=getLLMProjectUrl(_0x1814c9,_0x201a58[_0x3e8396(0xd4)]);return console[_0x3e8396(0xc0)](_0x3e8396(0xb3)+a4_0x4cef50[_0x3e8396(0xe3)](_0xa58931)),0x0;}}
@@ -1 +1 @@
1
- function a5_0x1b7b(_0x1d7dc9,_0x18d07f){_0x1d7dc9=_0x1d7dc9-0x126;const _0x5679d0=a5_0x5679();let _0x1b7bdf=_0x5679d0[_0x1d7dc9];return _0x1b7bdf;}const a5_0x18a3ac=a5_0x1b7b;(function(_0x25912a,_0x39a207){const _0x3dabfc=a5_0x1b7b,_0x5aebef=_0x25912a();while(!![]){try{const _0x2c5f2f=-parseInt(_0x3dabfc(0x143))/0x1+-parseInt(_0x3dabfc(0x174))/0x2+-parseInt(_0x3dabfc(0x173))/0x3+-parseInt(_0x3dabfc(0x12d))/0x4+-parseInt(_0x3dabfc(0x18f))/0x5+-parseInt(_0x3dabfc(0x1b5))/0x6*(parseInt(_0x3dabfc(0x179))/0x7)+-parseInt(_0x3dabfc(0x19a))/0x8*(-parseInt(_0x3dabfc(0x1a4))/0x9);if(_0x2c5f2f===_0x39a207)break;else _0x5aebef['push'](_0x5aebef['shift']());}catch(_0x54aabe){_0x5aebef['push'](_0x5aebef['shift']());}}}(a5_0x5679,0x2c3ab));import*as a5_0x3fec7f from'node:fs';import*as a5_0x4216f6 from'node:path';import a5_0x4fd7a0 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a5_0x5679(){const _0x128bca=['/<agent-name>','conversations','Executing\x20new\x20tests...','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Round\x201/','\x20\x20-\x20','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','\x20-\x20','projectDir','testName','Site:\x20','writeFileSync','Round\x20','resolve','Duration:\x20','log','No\x20tests\x20have\x20tags\x20defined.','basename','\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','cyan','Test\x20','48576QKxric','resolveProjectId','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','FAIL','New\x20tests\x20to\x20execute:\x20','white','length','includes','\x20(new)','agentName','find','round','Cached\x20run\x20is\x20from\x20site\x20\x22','start','tsv','404','ERROR','tests','Usage:','✗\x20FAIL:\x20','✓\x20PASS:\x20','Error\x20writing\x20output\x20file:\x20','Agent:\x20','yellow','\x27\x20to\x20create\x20the\x20folder\x20structure.','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','\x22:\x20','rounds','site','push','Available\x20tags:\x20','now','green','conversation_url','\x20(cached)','Using\x20agent:\x20','llmProject','eval','source','forEach','description','map','execute','Failed\x20Tests:','reeval','\x20\x20Conversation:\x20','join','red','497397qUZNyV','251160Uhiwhp','Conversation\x20URL:\x20','timestamp','Test\x20Summary','\x20\x20Round\x20','133eBzmad','Tests\x20found:\x20','dim','tags','No\x20tests\x20found\x20matching:\x20','llm','testYmlPath','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','multiple_agents','name','not\x20found','\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)','\x20\x20Evaluating...\x20','no_local_folder','verbose',':\x20Sending\x20user\x20input...','Total:\x20\x20\x20\x20','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','utf-8','isSpinning','substring','resolveAgentId','1348785LqlurZ','json','toISOString','Available\x20tests:\x20','Test\x20Configuration:','Evaluating\x20response...','\x22,\x20but\x20current\x20site\x20is\x20\x22','has','⚠\x20SKIPPED:\x20','agent','jsonl','9980648jYhGap','dryRun','filter','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','stop','Re-evaluating\x20cached\x20test\x20run...','reason','✗\x20ERROR:\x20Project\x20not\x20found:\x20','agentDirs','PASS','9pPMYWI','Either\x20switch\x20to\x20the\x20\x22','no_context','Passed:\x20\x20\x20','✗\x20ERROR:\x20','projectName','existsSync','No\x20tests\x20found\x20with\x20tags:\x20','...','context','Run\x20\x27tdx\x20agent\x20pull\x20','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','Run\x20tests\x20for\x20an\x20LLM\x20agent','Re-evaluating\x20','table','message','72678feIFXM','Output\x20written\x20to:\x20','found','Running\x20test:\x20','split','size','toLowerCase','add','repeat','no_tests','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','executeReeval','Cached\x20run\x20from:\x20','Re-evaluation\x20Summary','status','Errors:\x20\x20\x20','...\x20','text','\x20\x20Agent:\x20','906236UvRKEk'];a5_0x5679=function(){return _0x128bca;};return a5_0x5679();}export class AgentTestCommand extends BaseCommand{[a5_0x18a3ac(0x182)]='agent:test';[a5_0x18a3ac(0x16b)]=a5_0x18a3ac(0x1b1);async[a5_0x18a3ac(0x16d)](_0xd31cc){const _0x1d182d=a5_0x18a3ac,{options:_0x158b05,args:_0x3b94d8,tdx:_0x34ad35}=_0xd31cc,_0x1627b4=_0x3b94d8[0x0]||'.',_0x43be27=_0x158b05[_0x1d182d(0x19b)],_0x47719b=_0x158b05,_0x432bd8=_0x47719b[_0x1d182d(0x168)]===![],_0x315342=_0x47719b[_0x1d182d(0x16f)],_0x14b2d8=_0x47719b[_0x1d182d(0x182)],_0x23b656=_0x47719b[_0x1d182d(0x17c)],_0x4e92ab=_0x158b05['site'],_0x395bfe=_0x47719b['output'];if(_0x315342&&_0x432bd8)return console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)](_0x1d182d(0x1bf))),0x1;let _0x5b2ac7=_0x1d182d(0x1b3);if(_0x47719b[_0x1d182d(0x190)])_0x5b2ac7=_0x1d182d(0x190);else{if(_0x47719b[_0x1d182d(0x199)])_0x5b2ac7=_0x1d182d(0x199);else{if(_0x47719b['tsv'])_0x5b2ac7=_0x1d182d(0x151);else{if(_0x47719b[_0x1d182d(0x1b3)])_0x5b2ac7='table';}}}const _0x45c075=_0x47719b['llmProject'];let _0x5255b5=_0x1627b4;const _0x13b412=a5_0x3fec7f[_0x1d182d(0x1aa)](_0x1627b4),_0x332668=_0x1627b4==='.';if(!_0x13b412||_0x332668){const _0x275722=resolveProjectFromContext(_0x1627b4,_0x45c075,{'requireFile':'test.yml'});if(_0x275722[_0x1d182d(0x1b7)])_0x5255b5=_0x275722[_0x1d182d(0x136)],_0x275722[_0x1d182d(0x169)]===_0x1d182d(0x1ad)&&console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x17b)](_0x1d182d(0x166)+_0x5255b5));else switch(_0x275722[_0x1d182d(0x1a0)]){case _0x1d182d(0x1a6):console[_0x1d182d(0x13d)](a5_0x4fd7a0['yellow'](_0x275722[_0x1d182d(0x1b4)])),console['log'](),console[_0x1d182d(0x13d)](_0x1d182d(0x155)),console['log'](_0x1d182d(0x140)),console[_0x1d182d(0x13d)](_0x1d182d(0x184)),console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](_0x1d182d(0x131));return 0x1;case _0x1d182d(0x186):console['log'](a5_0x4fd7a0[_0x1d182d(0x15a)](_0x275722[_0x1d182d(0x1b4)])),console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](_0x1d182d(0x1ae)+_0x275722['llmProject']+_0x1d182d(0x15b));return 0x1;case _0x1d182d(0x181):{const _0x1b9c49=a5_0x4216f6[_0x1d182d(0x13f)](_0x275722[_0x1d182d(0x136)]);console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x15a)](_0x1d182d(0x15c)+_0x275722[_0x1d182d(0x167)]+'\x22:'));for(const _0x4374c8 of _0x275722[_0x1d182d(0x1a2)]){console[_0x1d182d(0x13d)](_0x1d182d(0x133)+_0x4374c8);}return console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x1b9c49+_0x1d182d(0x12e)),0x1;}case _0x1d182d(0x1be):console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x15a)]('No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22'+_0x275722[_0x1d182d(0x167)]+'\x22.')),console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x17b)]('Project\x20path:\x20'+_0x275722['projectDir'])),console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](_0x1d182d(0x134));return 0x1;}}const {definition:_0x2cc8e3,agentInfo:_0x19dda8}=parseTestFile(_0x5255b5);let _0x68cffb=_0x2cc8e3[_0x1d182d(0x154)];if(_0x14b2d8){const _0x28785e=_0x14b2d8[_0x1d182d(0x1b9)](',')['map'](_0x1bd0b2=>_0x1bd0b2['trim']());_0x68cffb=_0x2cc8e3[_0x1d182d(0x154)][_0x1d182d(0x19c)](_0x1f4862=>_0x28785e[_0x1d182d(0x14a)](_0x1f4862[_0x1d182d(0x182)]));if(_0x68cffb[_0x1d182d(0x149)]===0x0)return console[_0x1d182d(0x13d)](a5_0x4fd7a0['yellow'](_0x1d182d(0x17d)+_0x14b2d8)),console[_0x1d182d(0x13d)](a5_0x4fd7a0['dim'](_0x1d182d(0x192)+_0x2cc8e3['tests'][_0x1d182d(0x16c)](_0xc21f38=>_0xc21f38[_0x1d182d(0x182)])[_0x1d182d(0x171)](',\x20'))),0x1;}if(_0x23b656){const _0x3615f3=_0x23b656[_0x1d182d(0x1b9)](',')[_0x1d182d(0x16c)](_0x1c7ada=>_0x1c7ada['trim']()[_0x1d182d(0x1bb)]());_0x68cffb=_0x68cffb[_0x1d182d(0x19c)](_0x33eeb1=>_0x33eeb1['tags']?.['some'](_0x1dd700=>_0x3615f3[_0x1d182d(0x14a)](_0x1dd700['toLowerCase']())));if(_0x68cffb['length']===0x0){console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x15a)](_0x1d182d(0x1ab)+_0x23b656));const _0x4d011a=new Set();return _0x2cc8e3['tests'][_0x1d182d(0x16a)](_0xd5ae5d=>_0xd5ae5d[_0x1d182d(0x17c)]?.[_0x1d182d(0x16a)](_0x1e60ca=>_0x4d011a[_0x1d182d(0x1bc)](_0x1e60ca))),_0x4d011a[_0x1d182d(0x1ba)]>0x0?console[_0x1d182d(0x13d)](a5_0x4fd7a0['dim'](_0x1d182d(0x161)+[..._0x4d011a][_0x1d182d(0x171)](',\x20'))):console['log'](a5_0x4fd7a0[_0x1d182d(0x17b)](_0x1d182d(0x13e))),0x1;}}if(_0x315342)return this[_0x1d182d(0x1c0)](_0xd31cc,{'definition':{'tests':_0x68cffb},'agentInfo':_0x19dda8,'outputFormat':_0x5b2ac7,'outputFile':_0x395bfe,'testNames':_0x14b2d8});if(_0x43be27){console[_0x1d182d(0x13d)](a5_0x4fd7a0['cyan'](_0x1d182d(0x193))),console[_0x1d182d(0x13d)]('\x20\x20Site:\x20'+a5_0x4fd7a0[_0x1d182d(0x148)](_0x4e92ab)),console[_0x1d182d(0x13d)]('\x20\x20Project:\x20'+a5_0x4fd7a0['white'](_0x19dda8[_0x1d182d(0x1a9)])),console['log'](_0x1d182d(0x12c)+a5_0x4fd7a0['white'](_0x19dda8['agentName'])),console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](_0x1d182d(0x17a)+a5_0x4fd7a0[_0x1d182d(0x148)](_0x68cffb[_0x1d182d(0x149)]));for(let _0x15e1da=0x0;_0x15e1da<_0x68cffb[_0x1d182d(0x149)];_0x15e1da++){const _0x32186b=_0x68cffb[_0x15e1da],_0x4a897c=_0x32186b[_0x1d182d(0x15e)][_0x1d182d(0x149)]===0x1?_0x1d182d(0x14e):_0x1d182d(0x15e),_0x19e887=_0x32186b['tags']?.[_0x1d182d(0x149)]?'\x20['+_0x32186b[_0x1d182d(0x17c)][_0x1d182d(0x171)](',\x20')+']':'';console[_0x1d182d(0x13d)]('\x20\x20'+(_0x15e1da+0x1)+'.\x20'+a5_0x4fd7a0[_0x1d182d(0x148)](_0x32186b[_0x1d182d(0x182)])+'\x20('+_0x32186b[_0x1d182d(0x15e)][_0x1d182d(0x149)]+'\x20'+_0x4a897c+')'+a5_0x4fd7a0[_0x1d182d(0x17b)](_0x19e887));}return 0x0;}let _0x3946ae,_0x14227a;try{_0x3946ae=await _0x34ad35['llm'][_0x1d182d(0x144)](_0x19dda8['projectName']);}catch(_0x1d6fe2){const _0x45df89=_0x1d6fe2 instanceof Error?_0x1d6fe2[_0x1d182d(0x1b4)]:String(_0x1d6fe2);return _0x45df89[_0x1d182d(0x14a)](_0x1d182d(0x152))||_0x45df89[_0x1d182d(0x1bb)]()[_0x1d182d(0x14a)](_0x1d182d(0x183))?console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)](_0x1d182d(0x1a1)+_0x19dda8[_0x1d182d(0x1a9)])):console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22'+_0x19dda8[_0x1d182d(0x1a9)]+'\x22:\x20'+_0x45df89)),0x1;}try{_0x14227a=await _0x34ad35['llm'][_0x1d182d(0x18e)](_0x19dda8[_0x1d182d(0x14c)],_0x3946ae);}catch(_0x210355){const _0x1a643d=_0x210355 instanceof Error?_0x210355[_0x1d182d(0x1b4)]:String(_0x210355);return _0x1a643d[_0x1d182d(0x14a)]('404')||_0x1a643d['toLowerCase']()[_0x1d182d(0x14a)](_0x1d182d(0x183))?console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)](_0x1d182d(0x1af)+_0x19dda8[_0x1d182d(0x14c)])):console[_0x1d182d(0x13d)](a5_0x4fd7a0['red'](_0x1d182d(0x1b0)+_0x19dda8['agentName']+_0x1d182d(0x15d)+_0x1a643d)),0x1;}let _0x286c4c;if(!_0x432bd8)try{_0x286c4c=await setupEvaluatorAgent(_0x34ad35[_0x1d182d(0x17e)],_0x158b05[_0x1d182d(0x187)]);}catch(_0x921622){const _0x5e3139=_0x921622 instanceof Error?_0x921622[_0x1d182d(0x1b4)]:String(_0x921622);return console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)](_0x1d182d(0x180)+_0x5e3139)),0x1;}console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x141)]('Running\x20agent\x20tests...')),console['log'](_0x1d182d(0x138)+a5_0x4fd7a0[_0x1d182d(0x148)](_0x4e92ab)),console[_0x1d182d(0x13d)]('Agent:\x20'+a5_0x4fd7a0['white'](_0x19dda8[_0x1d182d(0x1a9)]+'/'+_0x19dda8[_0x1d182d(0x14c)])),console['log']();const _0x511cb8=[],_0x3e42be=[],_0x2e37cc=Date[_0x1d182d(0x162)]();for(let _0x5e9ff9=0x0;_0x5e9ff9<_0x68cffb['length'];_0x5e9ff9++){const _0x4bd725=_0x68cffb[_0x5e9ff9];_0x68cffb[_0x1d182d(0x149)]>0x1?console['log'](_0x1d182d(0x142)+(_0x5e9ff9+0x1)+'/'+_0x68cffb[_0x1d182d(0x149)]+':\x20'+a5_0x4fd7a0[_0x1d182d(0x148)](_0x4bd725[_0x1d182d(0x182)])):console[_0x1d182d(0x13d)](_0x1d182d(0x1b8)+a5_0x4fd7a0[_0x1d182d(0x148)](_0x4bd725['name']));const _0x18e9ba=createCommandSpinner(_0x1d182d(0x132)+_0x4bd725[_0x1d182d(0x15e)][_0x1d182d(0x149)]+_0x1d182d(0x188));_0x18e9ba[_0x1d182d(0x150)]();try{const {result:_0x36a3af,conversation:_0x2807af}=await runTest(_0x34ad35[_0x1d182d(0x17e)],_0x4bd725,{'agentId':_0x14227a,'projectId':_0x3946ae,'site':_0x4e92ab,'noEval':_0x432bd8,'evaluatorId':_0x286c4c,'onRoundStart':(_0x5d4f56,_0x232519)=>{const _0x295668=_0x1d182d;_0x18e9ba[_0x295668(0x12b)]='Round\x20'+(_0x5d4f56+0x1)+'/'+_0x232519+_0x295668(0x188);},'onRoundComplete':(_0x50c9a6,_0x23929e,_0x213331)=>{const _0x1afc5c=_0x1d182d,_0x27ab43=formatElapsed(_0x23929e);_0x213331?console[_0x1afc5c(0x13d)]('\x20\x20Round\x20'+(_0x50c9a6+0x1)+'/'+_0x4bd725['rounds'][_0x1afc5c(0x149)]+_0x1afc5c(0x12a)+a5_0x4fd7a0[_0x1afc5c(0x163)]('✓')+'\x20('+_0x27ab43+')'):console[_0x1afc5c(0x13d)]('\x20\x20Round\x20'+(_0x50c9a6+0x1)+'/'+_0x4bd725[_0x1afc5c(0x15e)]['length']+_0x1afc5c(0x12a)+a5_0x4fd7a0['red']('✗'));},'onEvaluationStart':()=>{const _0x40a28e=_0x1d182d;_0x18e9ba[_0x40a28e(0x12b)]=_0x40a28e(0x194);},'onEvaluationComplete':_0x412121=>{const _0x105419=_0x1d182d,_0x40960d=formatElapsed(_0x412121);console[_0x105419(0x13d)](_0x105419(0x185)+a5_0x4fd7a0[_0x105419(0x163)]('✓')+'\x20('+_0x40960d+')');}});_0x18e9ba[_0x1d182d(0x19e)](),_0x511cb8[_0x1d182d(0x160)](_0x36a3af),_0x3e42be[_0x1d182d(0x160)](_0x2807af);if(_0x36a3af[_0x1d182d(0x128)]===_0x1d182d(0x1a3))console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x163)](_0x1d182d(0x157)+_0x36a3af[_0x1d182d(0x1a0)]));else _0x36a3af[_0x1d182d(0x128)]===_0x1d182d(0x146)?console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)](_0x1d182d(0x156)+_0x36a3af['reason'])):console[_0x1d182d(0x13d)](a5_0x4fd7a0['red'](_0x1d182d(0x1a8)+_0x36a3af[_0x1d182d(0x1a0)]));_0x36a3af[_0x1d182d(0x164)]&&console['log'](a5_0x4fd7a0[_0x1d182d(0x17b)](_0x1d182d(0x175)+_0x36a3af['conversation_url'])),console[_0x1d182d(0x13d)]();}catch(_0x117fef){_0x18e9ba[_0x1d182d(0x19e)]();const _0x204d5c=_0x117fef instanceof Error?_0x117fef[_0x1d182d(0x1b4)]:String(_0x117fef);console[_0x1d182d(0x13d)](a5_0x4fd7a0['red'](_0x1d182d(0x1a8)+_0x204d5c)),console[_0x1d182d(0x13d)](),_0x511cb8[_0x1d182d(0x160)]({'name':_0x4bd725[_0x1d182d(0x182)],'status':_0x1d182d(0x153),'reason':_0x204d5c,'timestamp':new Date()[_0x1d182d(0x191)](),'duration_ms':0x0});}}const _0x5d5c48=Date[_0x1d182d(0x162)]()-_0x2e37cc,_0x30eb9a=_0x511cb8[_0x1d182d(0x19c)](_0x347883=>_0x347883[_0x1d182d(0x128)]===_0x1d182d(0x1a3))[_0x1d182d(0x149)],_0x3f2fd3=_0x511cb8['filter'](_0x5d1375=>_0x5d1375['status']===_0x1d182d(0x146))['length'],_0x553655=_0x511cb8[_0x1d182d(0x19c)](_0x2fd6fe=>_0x2fd6fe['status']===_0x1d182d(0x153))[_0x1d182d(0x149)];console[_0x1d182d(0x13d)]('━'[_0x1d182d(0x1bd)](0x3c)),console[_0x1d182d(0x13d)](_0x1d182d(0x177)),console[_0x1d182d(0x13d)]('━'[_0x1d182d(0x1bd)](0x3c)),console[_0x1d182d(0x13d)](_0x1d182d(0x189)+_0x511cb8[_0x1d182d(0x149)]),console[_0x1d182d(0x13d)](_0x1d182d(0x1a7)+a5_0x4fd7a0[_0x1d182d(0x163)](_0x30eb9a)),console['log']('Failed:\x20\x20\x20'+a5_0x4fd7a0[_0x1d182d(0x172)](_0x3f2fd3));_0x553655>0x0&&console[_0x1d182d(0x13d)](_0x1d182d(0x129)+a5_0x4fd7a0[_0x1d182d(0x172)](_0x553655));console['log'](_0x1d182d(0x13c)+formatElapsed(_0x5d5c48)),console[_0x1d182d(0x13d)]('━'[_0x1d182d(0x1bd)](0x3c));const _0x176d97=_0x511cb8[_0x1d182d(0x19c)](_0x2e1d39=>_0x2e1d39[_0x1d182d(0x128)]!=='PASS');if(_0x176d97[_0x1d182d(0x149)]>0x0){console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](_0x1d182d(0x16e));for(const _0x1c1b74 of _0x176d97){const _0x57cbc6=a5_0x4fd7a0[_0x1d182d(0x172)]('✗'),_0x557c75=_0x1c1b74[_0x1d182d(0x1a0)]['length']>0x32?_0x1c1b74[_0x1d182d(0x1a0)][_0x1d182d(0x18d)](0x0,0x32)+'...':_0x1c1b74[_0x1d182d(0x1a0)];console['log']('\x20\x20'+_0x57cbc6+'\x20'+_0x1c1b74[_0x1d182d(0x182)]+':\x20'+_0x557c75);}}const _0x3339f3={'summary':{'total':_0x511cb8[_0x1d182d(0x149)],'passed':_0x30eb9a,'failed':_0x3f2fd3,'errors':_0x553655>0x0?_0x553655:undefined,'duration_ms':_0x5d5c48},'tests':_0x511cb8,'agent':{'project':_0x19dda8['projectName'],'name':_0x19dda8[_0x1d182d(0x14c)],'site':_0x4e92ab},'timestamp':new Date(_0x2e37cc)['toISOString']()};try{const _0x27d902=buildCachedTestRun(_0x3e42be,{'site':_0x4e92ab,'projectId':_0x3946ae,'projectName':_0x19dda8[_0x1d182d(0x1a9)],'agentId':_0x14227a,'agentName':_0x19dda8[_0x1d182d(0x14c)],'testYmlPath':a5_0x4216f6[_0x1d182d(0x13b)](_0x19dda8[_0x1d182d(0x17f)])});saveLastTestRun(_0x27d902);}catch{}if(_0x5b2ac7!==_0x1d182d(0x1b3)||_0x395bfe){const _0x177f3f=formatResults(_0x3339f3,_0x5b2ac7);if(_0x395bfe)try{a5_0x3fec7f[_0x1d182d(0x139)](_0x395bfe,_0x177f3f,'utf-8'),console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](a5_0x4fd7a0['dim']('Output\x20written\x20to:\x20'+_0x395bfe));}catch(_0x5c913c){return console['log'](),console[_0x1d182d(0x13d)](a5_0x4fd7a0[_0x1d182d(0x172)](_0x1d182d(0x158)+_0x5c913c)),0x1;}else console[_0x1d182d(0x13d)](),console[_0x1d182d(0x13d)](_0x177f3f);}return _0x176d97['length']>0x0?0x1:0x0;}async['executeReeval'](_0x20318a,_0x4a739a){const _0x189c65=a5_0x18a3ac,{options:_0x3c0dd5,tdx:_0x3c1625}=_0x20318a,{definition:_0x50e3c0,agentInfo:_0x5b9542,outputFormat:_0x3a8ced,outputFile:_0x296bbd}=_0x4a739a,_0x21ea41=_0x3c0dd5[_0x189c65(0x15f)],_0x508c4a=loadLastTestRun();if(!_0x508c4a)return console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)]('Error:\x20No\x20previous\x20test\x20run\x20found.')),console[_0x189c65(0x13d)](a5_0x4fd7a0['dim'](_0x189c65(0x145))),0x1;if(_0x508c4a['agent'][_0x189c65(0x14c)]!==_0x5b9542['agentName'])return console[_0x189c65(0x13d)](a5_0x4fd7a0['red'](_0x189c65(0x19d)+_0x508c4a[_0x189c65(0x198)]['agentName']+'\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22'+_0x5b9542[_0x189c65(0x14c)]+'\x22.')),console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x17b)]('Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.')),0x1;const _0xba7891=new Set(_0x508c4a[_0x189c65(0x12f)]['map'](_0x586d1c=>_0x586d1c[_0x189c65(0x137)])),_0x5ad5a8=_0x50e3c0[_0x189c65(0x154)][_0x189c65(0x19c)](_0x298ef0=>!_0xba7891[_0x189c65(0x196)](_0x298ef0['name']));if(_0x5ad5a8[_0x189c65(0x149)]>0x0&&_0x508c4a[_0x189c65(0x15f)]!==_0x21ea41)return console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)](_0x189c65(0x18a))),console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x17b)](_0x189c65(0x14f)+_0x508c4a[_0x189c65(0x15f)]+_0x189c65(0x195)+_0x21ea41+'\x22.')),console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x17b)](_0x189c65(0x1a5)+_0x508c4a['site']+'\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.')),0x1;const _0x17828e=_0x50e3c0['tests'][_0x189c65(0x19c)](_0x19b29d=>_0xba7891[_0x189c65(0x196)](_0x19b29d['name'])),_0x24bac8=_0x5ad5a8;let _0x298ee9;try{_0x298ee9=await setupEvaluatorAgent(_0x3c1625[_0x189c65(0x17e)],_0x3c0dd5[_0x189c65(0x187)]);}catch(_0x49c963){const _0x1a0c43=_0x49c963 instanceof Error?_0x49c963[_0x189c65(0x1b4)]:String(_0x49c963);return console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x1a0c43)),0x1;}console[_0x189c65(0x13d)](a5_0x4fd7a0['cyan'](_0x189c65(0x19f))),console[_0x189c65(0x13d)](_0x189c65(0x126)+a5_0x4fd7a0['white'](_0x508c4a[_0x189c65(0x176)])),console['log'](_0x189c65(0x159)+a5_0x4fd7a0[_0x189c65(0x148)](_0x508c4a[_0x189c65(0x198)][_0x189c65(0x1a9)]+'/'+_0x508c4a[_0x189c65(0x198)][_0x189c65(0x14c)]));_0x24bac8[_0x189c65(0x149)]>0x0&&console[_0x189c65(0x13d)](_0x189c65(0x147)+a5_0x4fd7a0[_0x189c65(0x15a)](_0x24bac8[_0x189c65(0x149)]));console[_0x189c65(0x13d)]();const _0x209229=[],_0x5bea51=Date[_0x189c65(0x162)](),_0x33783f=createCommandSpinner('Re-evaluating...');if(_0x17828e[_0x189c65(0x149)]>0x0)try{const _0x26ab43=await reevaluateFromCache(_0x3c1625['llm'],_0x508c4a,{'tests':_0x17828e},{'evaluatorId':_0x298ee9,'onTestStart':(_0x4e8450,_0xc7516b,_0x38ba2d)=>{const _0x4d1fb6=_0x189c65;_0x33783f[_0x4d1fb6(0x12b)]=_0x4d1fb6(0x1b2)+(_0xc7516b+0x1)+'/'+_0x38ba2d+':\x20'+_0x4e8450+_0x4d1fb6(0x1ac);if(!_0x33783f[_0x4d1fb6(0x18c)])_0x33783f[_0x4d1fb6(0x150)]();},'onTestComplete':(_0x71f4b2,_0x400328)=>{const _0x30be85=_0x189c65;_0x33783f[_0x30be85(0x19e)]();if(_0x400328[_0x30be85(0x128)]===_0x30be85(0x1a3))console['log'](a5_0x4fd7a0[_0x30be85(0x163)]('✓\x20PASS:\x20'+_0x71f4b2)+a5_0x4fd7a0[_0x30be85(0x17b)](_0x30be85(0x165)));else _0x400328[_0x30be85(0x128)]===_0x30be85(0x146)?console['log'](a5_0x4fd7a0[_0x30be85(0x172)]('✗\x20FAIL:\x20'+_0x71f4b2+_0x30be85(0x135)+_0x400328['reason'])+a5_0x4fd7a0[_0x30be85(0x17b)](_0x30be85(0x165))):console[_0x30be85(0x13d)](a5_0x4fd7a0['red'](_0x30be85(0x1a8)+_0x71f4b2+_0x30be85(0x135)+_0x400328[_0x30be85(0x1a0)]));_0x400328[_0x30be85(0x164)]&&console[_0x30be85(0x13d)](a5_0x4fd7a0['dim'](_0x30be85(0x170)+_0x400328[_0x30be85(0x164)])),_0x209229[_0x30be85(0x160)](_0x400328);},'onTestSkipped':(_0x21b743,_0x58326d)=>{const _0x4f14b3=_0x189c65;_0x33783f[_0x4f14b3(0x19e)](),console[_0x4f14b3(0x13d)](a5_0x4fd7a0['yellow'](_0x4f14b3(0x197)+_0x21b743+'\x20-\x20'+_0x58326d));}});for(const _0xa062d2 of _0x26ab43){!_0x209229[_0x189c65(0x14d)](_0x17183e=>_0x17183e['name']===_0xa062d2[_0x189c65(0x182)])&&_0x209229[_0x189c65(0x160)](_0xa062d2);}}catch(_0x36099a){_0x33783f[_0x189c65(0x19e)]();const _0x3d26c4=_0x36099a instanceof Error?_0x36099a[_0x189c65(0x1b4)]:String(_0x36099a);return console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)]('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0x3d26c4)),0x1;}_0x33783f[_0x189c65(0x19e)]();if(_0x24bac8[_0x189c65(0x149)]>0x0){console[_0x189c65(0x13d)](),console['log'](a5_0x4fd7a0[_0x189c65(0x141)](_0x189c65(0x130)));const {projectId:_0x552af8,agentId:_0x4fa780}=_0x508c4a[_0x189c65(0x198)];for(const _0x1231c1 of _0x24bac8){console[_0x189c65(0x13d)]('Running:\x20'+a5_0x4fd7a0[_0x189c65(0x148)](_0x1231c1[_0x189c65(0x182)]));const _0x3a2698=createCommandSpinner(_0x189c65(0x132)+_0x1231c1[_0x189c65(0x15e)]['length']+_0x189c65(0x188));_0x3a2698['start']();try{const {result:_0x18e917}=await runTest(_0x3c1625[_0x189c65(0x17e)],_0x1231c1,{'agentId':_0x4fa780,'projectId':_0x552af8,'site':_0x508c4a[_0x189c65(0x15f)],'noEval':![],'evaluatorId':_0x298ee9,'onRoundStart':(_0x9962c4,_0x2f4e24)=>{const _0x1126d8=_0x189c65;_0x3a2698[_0x1126d8(0x12b)]=_0x1126d8(0x13a)+(_0x9962c4+0x1)+'/'+_0x2f4e24+_0x1126d8(0x188);},'onRoundComplete':(_0x8d646b,_0x31a842,_0x24d9c3)=>{const _0x285147=_0x189c65,_0x547f8d=formatElapsed(_0x31a842);_0x24d9c3?console[_0x285147(0x13d)](_0x285147(0x178)+(_0x8d646b+0x1)+'/'+_0x1231c1[_0x285147(0x15e)]['length']+_0x285147(0x12a)+a5_0x4fd7a0[_0x285147(0x163)]('✓')+'\x20('+_0x547f8d+')'):console['log'](_0x285147(0x178)+(_0x8d646b+0x1)+'/'+_0x1231c1[_0x285147(0x15e)][_0x285147(0x149)]+'...\x20'+a5_0x4fd7a0[_0x285147(0x172)]('✗'));},'onEvaluationStart':()=>{const _0x4df3b4=_0x189c65;_0x3a2698[_0x4df3b4(0x12b)]='Evaluating\x20response...';},'onEvaluationComplete':_0x3de95a=>{const _0x2698a9=_0x189c65,_0x3c080f=formatElapsed(_0x3de95a);console[_0x2698a9(0x13d)](_0x2698a9(0x185)+a5_0x4fd7a0[_0x2698a9(0x163)]('✓')+'\x20('+_0x3c080f+')');}});_0x3a2698[_0x189c65(0x19e)](),_0x209229[_0x189c65(0x160)](_0x18e917);if(_0x18e917[_0x189c65(0x128)]==='PASS')console['log'](a5_0x4fd7a0[_0x189c65(0x163)](_0x189c65(0x157)+_0x18e917[_0x189c65(0x1a0)])+a5_0x4fd7a0[_0x189c65(0x17b)](_0x189c65(0x14b)));else _0x18e917[_0x189c65(0x128)]===_0x189c65(0x146)?console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)](_0x189c65(0x156)+_0x18e917['reason'])+a5_0x4fd7a0[_0x189c65(0x17b)](_0x189c65(0x14b))):console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)](_0x189c65(0x1a8)+_0x18e917[_0x189c65(0x1a0)]));_0x18e917[_0x189c65(0x164)]&&console[_0x189c65(0x13d)](a5_0x4fd7a0['dim'](_0x189c65(0x170)+_0x18e917[_0x189c65(0x164)]));}catch(_0x3adb6f){_0x3a2698[_0x189c65(0x19e)]();const _0x2cfdff=_0x3adb6f instanceof Error?_0x3adb6f[_0x189c65(0x1b4)]:String(_0x3adb6f);console[_0x189c65(0x13d)](a5_0x4fd7a0['red'](_0x189c65(0x1a8)+_0x2cfdff)),_0x209229[_0x189c65(0x160)]({'name':_0x1231c1['name'],'status':'ERROR','reason':_0x2cfdff,'timestamp':new Date()[_0x189c65(0x191)](),'duration_ms':0x0});}}}console['log']();const _0x56a9f5=Date[_0x189c65(0x162)]()-_0x5bea51,_0x39549c=_0x209229[_0x189c65(0x19c)](_0x3cf9be=>_0x3cf9be[_0x189c65(0x128)]===_0x189c65(0x1a3))[_0x189c65(0x149)],_0x49c485=_0x209229[_0x189c65(0x19c)](_0x473e72=>_0x473e72[_0x189c65(0x128)]===_0x189c65(0x146))[_0x189c65(0x149)],_0x2729b2=_0x209229[_0x189c65(0x19c)](_0x9d3c5c=>_0x9d3c5c['status']===_0x189c65(0x153))['length'];console['log']('━'['repeat'](0x3c)),console[_0x189c65(0x13d)](_0x189c65(0x127)),console[_0x189c65(0x13d)]('━'[_0x189c65(0x1bd)](0x3c)),console[_0x189c65(0x13d)](_0x189c65(0x189)+_0x209229[_0x189c65(0x149)]),console['log'](_0x189c65(0x1a7)+a5_0x4fd7a0[_0x189c65(0x163)](_0x39549c)),console[_0x189c65(0x13d)]('Failed:\x20\x20\x20'+a5_0x4fd7a0[_0x189c65(0x172)](_0x49c485));_0x2729b2>0x0&&console[_0x189c65(0x13d)](_0x189c65(0x129)+a5_0x4fd7a0['red'](_0x2729b2));console[_0x189c65(0x13d)](_0x189c65(0x13c)+formatElapsed(_0x56a9f5)),console[_0x189c65(0x13d)]('━'['repeat'](0x3c));const _0x203c38={'summary':{'total':_0x209229[_0x189c65(0x149)],'passed':_0x39549c,'failed':_0x49c485,'errors':_0x2729b2>0x0?_0x2729b2:undefined,'duration_ms':_0x56a9f5},'tests':_0x209229,'agent':{'project':_0x5b9542[_0x189c65(0x1a9)],'name':_0x5b9542[_0x189c65(0x14c)],'site':_0x21ea41},'timestamp':new Date(_0x5bea51)[_0x189c65(0x191)]()};if(_0x3a8ced!==_0x189c65(0x1b3)||_0x296bbd){const _0x7112fb=formatResults(_0x203c38,_0x3a8ced);if(_0x296bbd)try{a5_0x3fec7f[_0x189c65(0x139)](_0x296bbd,_0x7112fb,_0x189c65(0x18b)),console[_0x189c65(0x13d)](),console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x17b)](_0x189c65(0x1b6)+_0x296bbd));}catch(_0x2366b0){return console[_0x189c65(0x13d)](),console[_0x189c65(0x13d)](a5_0x4fd7a0[_0x189c65(0x172)](_0x189c65(0x158)+_0x2366b0)),0x1;}else console[_0x189c65(0x13d)](),console[_0x189c65(0x13d)](_0x7112fb);}const _0x20e286=_0x209229[_0x189c65(0x19c)](_0x55174e=>_0x55174e[_0x189c65(0x128)]!==_0x189c65(0x1a3));return _0x20e286[_0x189c65(0x149)]>0x0?0x1:0x0;}}
1
+ const a5_0x5c6f56=a5_0x3b66;function a5_0xf5d0(){const _0x5dacff=['description','json','status','Round\x20',':\x20Sending\x20user\x20input...','toLowerCase','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','llmProject','conversations','green','Round\x201/','Errors:\x20\x20\x20','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','2IKkADy','agentName','timestamp','Using\x20agent:\x20','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','Total:\x20\x20\x20\x20','\x20-\x20','\x20\x20Evaluating...\x20','/<agent-name>','\x20\x20Conversation:\x20','✗\x20ERROR:\x20Project\x20not\x20found:\x20','projectDir','toISOString','resolve','name','message','Conversation\x20URL:\x20','round','4900036quSopT','Usage:','...\x20','includes','resolveAgentId','Duration:\x20','Running\x20agent\x20tests...','Cached\x20run\x20from:\x20','tags','jsonl','length','337472RyHoLa','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','existsSync','Error\x20writing\x20output\x20file:\x20','has','\x22:\x20','white','...','Test\x20Summary','site','Test\x20Configuration:','some','writeFileSync','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','conversation_url','execute','basename','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','log','\x27\x20to\x20create\x20the\x20folder\x20structure.','Tests\x20found:\x20','Re-evaluation\x20Summary','Output\x20written\x20to:\x20','red','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','map','\x20\x20Round\x20','agent:test','test.yml','\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','testName','output','Available\x20tags:\x20','no_tests','ERROR','projectName','no_local_folder','FAIL','Executing\x20new\x20tests...','\x20(new)','found','Re-evaluating...','forEach','resolveProjectId','start','\x20(cached)','utf-8','Evaluating\x20response...','tsv','tests','Test\x20','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','reason','42835thqjmB','find','not\x20found','Running:\x20','Run\x20tests\x20for\x20an\x20LLM\x20agent','Failed:\x20\x20\x20','context','rounds','repeat','11302128zYKExr','Run\x20\x27tdx\x20agent\x20pull\x20','Running\x20test:\x20','No\x20tests\x20found\x20with\x20tags:\x20','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','354PItwQA','Error:\x20No\x20previous\x20test\x20run\x20found.','executeReeval','✗\x20ERROR:\x20','split','text','push','size','Re-evaluating\x20cached\x20test\x20run...','11459952jRvfcP','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','PASS','table','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','stop','isSpinning','2874927xIvwDA','trim','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','llm','Passed:\x20\x20\x20','5560527xgKrko','\x20\x20Site:\x20','filter','Project\x20path:\x20','No\x20tests\x20have\x20tags\x20defined.','⚠\x20SKIPPED:\x20','✓\x20PASS:\x20','multiple_agents','404','yellow','\x20\x20Project:\x20','Agent:\x20','dim','✗\x20FAIL:\x20','agent','agentDirs','now','cyan'];a5_0xf5d0=function(){return _0x5dacff;};return a5_0xf5d0();}(function(_0x4f0f33,_0x46abde){const _0x266eb3=a5_0x3b66,_0x6deaf9=_0x4f0f33();while(!![]){try{const _0x48c836=-parseInt(_0x266eb3(0x163))/0x1+parseInt(_0x266eb3(0x146))/0x2*(parseInt(_0x266eb3(0x1b8))/0x3)+parseInt(_0x266eb3(0x158))/0x4+-parseInt(_0x266eb3(0x199))/0x5*(parseInt(_0x266eb3(0x1a7))/0x6)+-parseInt(_0x266eb3(0x1bd))/0x7+parseInt(_0x266eb3(0x1b0))/0x8+-parseInt(_0x266eb3(0x1a2))/0x9;if(_0x48c836===_0x46abde)break;else _0x6deaf9['push'](_0x6deaf9['shift']());}catch(_0x107a4d){_0x6deaf9['push'](_0x6deaf9['shift']());}}}(a5_0xf5d0,0xb072e));import*as a5_0x362934 from'node:fs';import*as a5_0x444c23 from'node:path';function a5_0x3b66(_0x20eff4,_0x57ccf6){_0x20eff4=_0x20eff4-0x13c;const _0xf5d073=a5_0xf5d0();let _0x3b66e2=_0xf5d073[_0x20eff4];return _0x3b66e2;}import a5_0x156914 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x5c6f56(0x154)]=a5_0x5c6f56(0x17f);[a5_0x5c6f56(0x1cf)]=a5_0x5c6f56(0x19d);async[a5_0x5c6f56(0x173)](_0x4c4913){const _0x1ee8d7=a5_0x5c6f56,{options:_0x3a87f5,args:_0x548d7a,tdx:_0x1e6396}=_0x4c4913,_0x2b627f=_0x548d7a[0x0]||'.',_0x19ebee=_0x3a87f5['dryRun'],_0x38c40a=_0x3a87f5,_0x486648=_0x38c40a['eval']===![],_0x3360ab=_0x38c40a['reeval'],_0x516502=_0x38c40a[_0x1ee8d7(0x154)],_0x8af142=_0x38c40a[_0x1ee8d7(0x160)],_0x174dd3=_0x3a87f5[_0x1ee8d7(0x16c)],_0x43614f=_0x38c40a[_0x1ee8d7(0x183)];if(_0x3360ab&&_0x486648)return console['log'](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x170))),0x1;let _0x1a7aaa='table';if(_0x38c40a[_0x1ee8d7(0x1d0)])_0x1a7aaa='json';else{if(_0x38c40a[_0x1ee8d7(0x161)])_0x1a7aaa=_0x1ee8d7(0x161);else{if(_0x38c40a[_0x1ee8d7(0x194)])_0x1a7aaa=_0x1ee8d7(0x194);else{if(_0x38c40a[_0x1ee8d7(0x1b3)])_0x1a7aaa='table';}}}const _0x3d929b=_0x38c40a[_0x1ee8d7(0x140)];let _0x38c3f8=_0x2b627f;const _0x41a92e=a5_0x362934[_0x1ee8d7(0x165)](_0x2b627f),_0x15da1d=_0x2b627f==='.';if(!_0x41a92e||_0x15da1d){const _0x374587=resolveProjectFromContext(_0x2b627f,_0x3d929b,{'requireFile':_0x1ee8d7(0x180)});if(_0x374587[_0x1ee8d7(0x18c)])_0x38c3f8=_0x374587[_0x1ee8d7(0x151)],_0x374587['source']===_0x1ee8d7(0x19f)&&console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c9)](_0x1ee8d7(0x149)+_0x38c3f8));else switch(_0x374587[_0x1ee8d7(0x198)]){case'no_context':console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c6)](_0x374587[_0x1ee8d7(0x155)])),console[_0x1ee8d7(0x176)](),console['log'](_0x1ee8d7(0x159)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x181)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x145)),console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x1b1));return 0x1;case _0x1ee8d7(0x188):console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c6)](_0x374587[_0x1ee8d7(0x155)])),console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x1a3)+_0x374587['llmProject']+_0x1ee8d7(0x177));return 0x1;case _0x1ee8d7(0x1c4):{const _0x769157=a5_0x444c23[_0x1ee8d7(0x174)](_0x374587['projectDir']);console['log'](a5_0x156914[_0x1ee8d7(0x1c6)](_0x1ee8d7(0x164)+_0x374587[_0x1ee8d7(0x140)]+'\x22:'));for(const _0x129604 of _0x374587[_0x1ee8d7(0x1cc)]){console[_0x1ee8d7(0x176)]('\x20\x20-\x20'+_0x129604);}return console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x769157+_0x1ee8d7(0x14e)),0x1;}case _0x1ee8d7(0x185):console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c6)](_0x1ee8d7(0x13f)+_0x374587[_0x1ee8d7(0x140)]+'\x22.')),console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c9)](_0x1ee8d7(0x1c0)+_0x374587[_0x1ee8d7(0x151)])),console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x197));return 0x1;}}const {definition:_0x2ad207,agentInfo:_0x5eb5db}=parseTestFile(_0x38c3f8);let _0x3e36b6=_0x2ad207['tests'];if(_0x516502){const _0xe41f2d=_0x516502['split'](',')['map'](_0x5a5de4=>_0x5a5de4[_0x1ee8d7(0x1b9)]());_0x3e36b6=_0x2ad207[_0x1ee8d7(0x195)][_0x1ee8d7(0x1bf)](_0x16f064=>_0xe41f2d[_0x1ee8d7(0x15b)](_0x16f064[_0x1ee8d7(0x154)]));if(_0x3e36b6[_0x1ee8d7(0x162)]===0x0)return console['log'](a5_0x156914[_0x1ee8d7(0x1c6)]('No\x20tests\x20found\x20matching:\x20'+_0x516502)),console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c9)]('Available\x20tests:\x20'+_0x2ad207[_0x1ee8d7(0x195)][_0x1ee8d7(0x17d)](_0x1a1650=>_0x1a1650[_0x1ee8d7(0x154)])['join'](',\x20'))),0x1;}if(_0x8af142){const _0x1ea559=_0x8af142[_0x1ee8d7(0x1ab)](',')[_0x1ee8d7(0x17d)](_0x50351c=>_0x50351c['trim']()[_0x1ee8d7(0x13e)]());_0x3e36b6=_0x3e36b6[_0x1ee8d7(0x1bf)](_0x48020b=>_0x48020b[_0x1ee8d7(0x160)]?.[_0x1ee8d7(0x16e)](_0x4acfa3=>_0x1ea559['includes'](_0x4acfa3[_0x1ee8d7(0x13e)]())));if(_0x3e36b6[_0x1ee8d7(0x162)]===0x0){console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c6)](_0x1ee8d7(0x1a5)+_0x8af142));const _0x531d4d=new Set();return _0x2ad207[_0x1ee8d7(0x195)][_0x1ee8d7(0x18e)](_0x1a6bd8=>_0x1a6bd8[_0x1ee8d7(0x160)]?.[_0x1ee8d7(0x18e)](_0x20dca9=>_0x531d4d['add'](_0x20dca9))),_0x531d4d[_0x1ee8d7(0x1ae)]>0x0?console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c9)](_0x1ee8d7(0x184)+[..._0x531d4d]['join'](',\x20'))):console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c9)](_0x1ee8d7(0x1c1))),0x1;}}if(_0x3360ab)return this[_0x1ee8d7(0x1a9)](_0x4c4913,{'definition':{'tests':_0x3e36b6},'agentInfo':_0x5eb5db,'outputFormat':_0x1a7aaa,'outputFile':_0x43614f,'testNames':_0x516502});if(_0x19ebee){console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1ce)](_0x1ee8d7(0x16d))),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x1be)+a5_0x156914[_0x1ee8d7(0x169)](_0x174dd3)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x1c7)+a5_0x156914[_0x1ee8d7(0x169)](_0x5eb5db[_0x1ee8d7(0x187)])),console['log']('\x20\x20Agent:\x20'+a5_0x156914['white'](_0x5eb5db[_0x1ee8d7(0x147)])),console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x178)+a5_0x156914[_0x1ee8d7(0x169)](_0x3e36b6[_0x1ee8d7(0x162)]));for(let _0x4226fc=0x0;_0x4226fc<_0x3e36b6[_0x1ee8d7(0x162)];_0x4226fc++){const _0x1a1e42=_0x3e36b6[_0x4226fc],_0x1102d8=_0x1a1e42[_0x1ee8d7(0x1a0)]['length']===0x1?_0x1ee8d7(0x157):_0x1ee8d7(0x1a0),_0x26a7e9=_0x1a1e42[_0x1ee8d7(0x160)]?.[_0x1ee8d7(0x162)]?'\x20['+_0x1a1e42[_0x1ee8d7(0x160)]['join'](',\x20')+']':'';console[_0x1ee8d7(0x176)]('\x20\x20'+(_0x4226fc+0x1)+'.\x20'+a5_0x156914[_0x1ee8d7(0x169)](_0x1a1e42[_0x1ee8d7(0x154)])+'\x20('+_0x1a1e42['rounds'][_0x1ee8d7(0x162)]+'\x20'+_0x1102d8+')'+a5_0x156914['dim'](_0x26a7e9));}return 0x0;}let _0x2af4a9,_0xf8b550;try{_0x2af4a9=await _0x1e6396[_0x1ee8d7(0x1bb)][_0x1ee8d7(0x18f)](_0x5eb5db[_0x1ee8d7(0x187)]);}catch(_0x7fab91){const _0x5ba0df=_0x7fab91 instanceof Error?_0x7fab91[_0x1ee8d7(0x155)]:String(_0x7fab91);return _0x5ba0df['includes'](_0x1ee8d7(0x1c5))||_0x5ba0df[_0x1ee8d7(0x13e)]()['includes'](_0x1ee8d7(0x19b))?console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x150)+_0x5eb5db[_0x1ee8d7(0x187)])):console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22'+_0x5eb5db[_0x1ee8d7(0x187)]+_0x1ee8d7(0x168)+_0x5ba0df)),0x1;}try{_0xf8b550=await _0x1e6396[_0x1ee8d7(0x1bb)][_0x1ee8d7(0x15c)](_0x5eb5db[_0x1ee8d7(0x147)],_0x2af4a9);}catch(_0x319751){const _0x40ce9f=_0x319751 instanceof Error?_0x319751[_0x1ee8d7(0x155)]:String(_0x319751);return _0x40ce9f[_0x1ee8d7(0x15b)](_0x1ee8d7(0x1c5))||_0x40ce9f[_0x1ee8d7(0x13e)]()['includes'](_0x1ee8d7(0x19b))?console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x175)+_0x5eb5db[_0x1ee8d7(0x147)])):console['log'](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x1ba)+_0x5eb5db[_0x1ee8d7(0x147)]+_0x1ee8d7(0x168)+_0x40ce9f)),0x1;}let _0x572c09;if(!_0x486648)try{_0x572c09=await setupEvaluatorAgent(_0x1e6396['llm'],_0x3a87f5['verbose']);}catch(_0xe4675d){const _0x547243=_0xe4675d instanceof Error?_0xe4675d[_0x1ee8d7(0x155)]:String(_0xe4675d);return console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x547243)),0x1;}console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1ce)](_0x1ee8d7(0x15e))),console['log']('Site:\x20'+a5_0x156914[_0x1ee8d7(0x169)](_0x174dd3)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x1c8)+a5_0x156914['white'](_0x5eb5db[_0x1ee8d7(0x187)]+'/'+_0x5eb5db[_0x1ee8d7(0x147)])),console['log']();const _0x5ec3ef=[],_0x2ed3c1=[],_0x5c40dd=Date[_0x1ee8d7(0x1cd)]();for(let _0x386a84=0x0;_0x386a84<_0x3e36b6['length'];_0x386a84++){const _0x3cfca3=_0x3e36b6[_0x386a84];_0x3e36b6['length']>0x1?console[_0x1ee8d7(0x176)](_0x1ee8d7(0x196)+(_0x386a84+0x1)+'/'+_0x3e36b6['length']+':\x20'+a5_0x156914[_0x1ee8d7(0x169)](_0x3cfca3[_0x1ee8d7(0x154)])):console[_0x1ee8d7(0x176)](_0x1ee8d7(0x1a4)+a5_0x156914[_0x1ee8d7(0x169)](_0x3cfca3['name']));const _0x28a1cf=createCommandSpinner(_0x1ee8d7(0x143)+_0x3cfca3['rounds'][_0x1ee8d7(0x162)]+_0x1ee8d7(0x13d));_0x28a1cf[_0x1ee8d7(0x190)]();try{const {result:_0x595b24,conversation:_0x58e26c}=await runTest(_0x1e6396[_0x1ee8d7(0x1bb)],_0x3cfca3,{'agentId':_0xf8b550,'projectId':_0x2af4a9,'site':_0x174dd3,'noEval':_0x486648,'evaluatorId':_0x572c09,'onRoundStart':(_0x4369be,_0x18ee46)=>{const _0x49f3c3=_0x1ee8d7;_0x28a1cf['text']=_0x49f3c3(0x13c)+(_0x4369be+0x1)+'/'+_0x18ee46+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x2a758c,_0x4e4284,_0x2a2dae)=>{const _0x2b396d=_0x1ee8d7,_0x4288fb=formatElapsed(_0x4e4284);_0x2a2dae?console[_0x2b396d(0x176)](_0x2b396d(0x17e)+(_0x2a758c+0x1)+'/'+_0x3cfca3[_0x2b396d(0x1a0)][_0x2b396d(0x162)]+'...\x20'+a5_0x156914[_0x2b396d(0x142)]('✓')+'\x20('+_0x4288fb+')'):console[_0x2b396d(0x176)](_0x2b396d(0x17e)+(_0x2a758c+0x1)+'/'+_0x3cfca3[_0x2b396d(0x1a0)][_0x2b396d(0x162)]+'...\x20'+a5_0x156914[_0x2b396d(0x17b)]('✗'));},'onEvaluationStart':()=>{const _0x132dd4=_0x1ee8d7;_0x28a1cf['text']=_0x132dd4(0x193);},'onEvaluationComplete':_0x162c38=>{const _0x50b8c1=_0x1ee8d7,_0x1fc824=formatElapsed(_0x162c38);console['log']('\x20\x20Evaluating...\x20'+a5_0x156914[_0x50b8c1(0x142)]('✓')+'\x20('+_0x1fc824+')');}});_0x28a1cf['stop'](),_0x5ec3ef[_0x1ee8d7(0x1ad)](_0x595b24),_0x2ed3c1[_0x1ee8d7(0x1ad)](_0x58e26c);if(_0x595b24[_0x1ee8d7(0x1d1)]===_0x1ee8d7(0x1b2))console[_0x1ee8d7(0x176)](a5_0x156914['green'](_0x1ee8d7(0x1c3)+_0x595b24['reason']));else _0x595b24[_0x1ee8d7(0x1d1)]===_0x1ee8d7(0x189)?console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x1ca)+_0x595b24['reason'])):console['log'](a5_0x156914[_0x1ee8d7(0x17b)]('✗\x20ERROR:\x20'+_0x595b24[_0x1ee8d7(0x198)]));_0x595b24[_0x1ee8d7(0x172)]&&console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x1c9)](_0x1ee8d7(0x156)+_0x595b24[_0x1ee8d7(0x172)])),console[_0x1ee8d7(0x176)]();}catch(_0x28ffff){_0x28a1cf[_0x1ee8d7(0x1b6)]();const _0x2df2f3=_0x28ffff instanceof Error?_0x28ffff[_0x1ee8d7(0x155)]:String(_0x28ffff);console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x1aa)+_0x2df2f3)),console[_0x1ee8d7(0x176)](),_0x5ec3ef[_0x1ee8d7(0x1ad)]({'name':_0x3cfca3[_0x1ee8d7(0x154)],'status':_0x1ee8d7(0x186),'reason':_0x2df2f3,'timestamp':new Date()[_0x1ee8d7(0x152)](),'duration_ms':0x0});}}const _0xd6b5dc=Date['now']()-_0x5c40dd,_0x369625=_0x5ec3ef[_0x1ee8d7(0x1bf)](_0x29c268=>_0x29c268[_0x1ee8d7(0x1d1)]==='PASS')[_0x1ee8d7(0x162)],_0x4756f7=_0x5ec3ef[_0x1ee8d7(0x1bf)](_0x5a17c0=>_0x5a17c0[_0x1ee8d7(0x1d1)]===_0x1ee8d7(0x189))['length'],_0x2e9c2e=_0x5ec3ef[_0x1ee8d7(0x1bf)](_0x2a8b57=>_0x2a8b57[_0x1ee8d7(0x1d1)]===_0x1ee8d7(0x186))[_0x1ee8d7(0x162)];console[_0x1ee8d7(0x176)]('━'[_0x1ee8d7(0x1a1)](0x3c)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x16b)),console[_0x1ee8d7(0x176)]('━'['repeat'](0x3c)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x14b)+_0x5ec3ef[_0x1ee8d7(0x162)]),console['log'](_0x1ee8d7(0x1bc)+a5_0x156914[_0x1ee8d7(0x142)](_0x369625)),console[_0x1ee8d7(0x176)](_0x1ee8d7(0x19e)+a5_0x156914[_0x1ee8d7(0x17b)](_0x4756f7));_0x2e9c2e>0x0&&console['log'](_0x1ee8d7(0x144)+a5_0x156914['red'](_0x2e9c2e));console[_0x1ee8d7(0x176)](_0x1ee8d7(0x15d)+formatElapsed(_0xd6b5dc)),console[_0x1ee8d7(0x176)]('━'[_0x1ee8d7(0x1a1)](0x3c));const _0x281574=_0x5ec3ef[_0x1ee8d7(0x1bf)](_0x3b419a=>_0x3b419a[_0x1ee8d7(0x1d1)]!==_0x1ee8d7(0x1b2));if(_0x281574[_0x1ee8d7(0x162)]>0x0){console[_0x1ee8d7(0x176)](),console['log']('Failed\x20Tests:');for(const _0x13857c of _0x281574){const _0x10ba69=a5_0x156914['red']('✗'),_0x27cd77=_0x13857c[_0x1ee8d7(0x198)][_0x1ee8d7(0x162)]>0x32?_0x13857c['reason']['substring'](0x0,0x32)+_0x1ee8d7(0x16a):_0x13857c['reason'];console['log']('\x20\x20'+_0x10ba69+'\x20'+_0x13857c[_0x1ee8d7(0x154)]+':\x20'+_0x27cd77);}}const _0x24d349={'summary':{'total':_0x5ec3ef[_0x1ee8d7(0x162)],'passed':_0x369625,'failed':_0x4756f7,'errors':_0x2e9c2e>0x0?_0x2e9c2e:undefined,'duration_ms':_0xd6b5dc},'tests':_0x5ec3ef,'agent':{'project':_0x5eb5db['projectName'],'name':_0x5eb5db['agentName'],'site':_0x174dd3},'timestamp':new Date(_0x5c40dd)[_0x1ee8d7(0x152)]()};try{const _0x384967=buildCachedTestRun(_0x2ed3c1,{'site':_0x174dd3,'projectId':_0x2af4a9,'projectName':_0x5eb5db[_0x1ee8d7(0x187)],'agentId':_0xf8b550,'agentName':_0x5eb5db[_0x1ee8d7(0x147)],'testYmlPath':a5_0x444c23[_0x1ee8d7(0x153)](_0x5eb5db['testYmlPath'])});saveLastTestRun(_0x384967);}catch{}if(_0x1a7aaa!==_0x1ee8d7(0x1b3)||_0x43614f){const _0x4c7cc8=formatResults(_0x24d349,_0x1a7aaa);if(_0x43614f)try{a5_0x362934['writeFileSync'](_0x43614f,_0x4c7cc8,_0x1ee8d7(0x192)),console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](a5_0x156914['dim'](_0x1ee8d7(0x17a)+_0x43614f));}catch(_0x46938b){return console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](a5_0x156914[_0x1ee8d7(0x17b)](_0x1ee8d7(0x166)+_0x46938b)),0x1;}else console[_0x1ee8d7(0x176)](),console[_0x1ee8d7(0x176)](_0x4c7cc8);}return _0x281574[_0x1ee8d7(0x162)]>0x0?0x1:0x0;}async[a5_0x5c6f56(0x1a9)](_0x324d21,_0x86412d){const _0x1469b4=a5_0x5c6f56,{options:_0x34844a,tdx:_0x2433cb}=_0x324d21,{definition:_0x29f553,agentInfo:_0x20f334,outputFormat:_0x542bf3,outputFile:_0x5ea39a}=_0x86412d,_0xdf4ef9=_0x34844a[_0x1469b4(0x16c)],_0xd8d9c6=loadLastTestRun();if(!_0xd8d9c6)return console[_0x1469b4(0x176)](a5_0x156914['red'](_0x1469b4(0x1a8))),console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x1c9)](_0x1469b4(0x17c))),0x1;if(_0xd8d9c6['agent'][_0x1469b4(0x147)]!==_0x20f334[_0x1469b4(0x147)])return console['log'](a5_0x156914[_0x1469b4(0x17b)](_0x1469b4(0x1a6)+_0xd8d9c6[_0x1469b4(0x1cb)][_0x1469b4(0x147)]+_0x1469b4(0x1b4)+_0x20f334[_0x1469b4(0x147)]+'\x22.')),console[_0x1469b4(0x176)](a5_0x156914['dim'](_0x1469b4(0x171))),0x1;const _0x30609f=new Set(_0xd8d9c6[_0x1469b4(0x141)]['map'](_0x1de62d=>_0x1de62d[_0x1469b4(0x182)])),_0x1a3bd9=_0x29f553[_0x1469b4(0x195)][_0x1469b4(0x1bf)](_0x4f9898=>!_0x30609f[_0x1469b4(0x167)](_0x4f9898[_0x1469b4(0x154)]));if(_0x1a3bd9[_0x1469b4(0x162)]>0x0&&_0xd8d9c6[_0x1469b4(0x16c)]!==_0xdf4ef9)return console['log'](a5_0x156914['red'](_0x1469b4(0x14a))),console['log'](a5_0x156914[_0x1469b4(0x1c9)]('Cached\x20run\x20is\x20from\x20site\x20\x22'+_0xd8d9c6['site']+'\x22,\x20but\x20current\x20site\x20is\x20\x22'+_0xdf4ef9+'\x22.')),console[_0x1469b4(0x176)](a5_0x156914['dim']('Either\x20switch\x20to\x20the\x20\x22'+_0xd8d9c6['site']+_0x1469b4(0x1b5))),0x1;const _0x5b6ffd=_0x29f553['tests']['filter'](_0x192077=>_0x30609f[_0x1469b4(0x167)](_0x192077[_0x1469b4(0x154)])),_0x228c38=_0x1a3bd9;let _0x10e25a;try{_0x10e25a=await setupEvaluatorAgent(_0x2433cb[_0x1469b4(0x1bb)],_0x34844a['verbose']);}catch(_0x4050c9){const _0x5949ce=_0x4050c9 instanceof Error?_0x4050c9['message']:String(_0x4050c9);return console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x17b)]('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x5949ce)),0x1;}console['log'](a5_0x156914['cyan'](_0x1469b4(0x1af))),console['log'](_0x1469b4(0x15f)+a5_0x156914[_0x1469b4(0x169)](_0xd8d9c6[_0x1469b4(0x148)])),console[_0x1469b4(0x176)](_0x1469b4(0x1c8)+a5_0x156914[_0x1469b4(0x169)](_0xd8d9c6['agent']['projectName']+'/'+_0xd8d9c6['agent'][_0x1469b4(0x147)]));_0x228c38['length']>0x0&&console[_0x1469b4(0x176)]('New\x20tests\x20to\x20execute:\x20'+a5_0x156914[_0x1469b4(0x1c6)](_0x228c38['length']));console['log']();const _0x13687e=[],_0x3b27e5=Date[_0x1469b4(0x1cd)](),_0x39fdf5=createCommandSpinner(_0x1469b4(0x18d));if(_0x5b6ffd[_0x1469b4(0x162)]>0x0)try{const _0x335c37=await reevaluateFromCache(_0x2433cb[_0x1469b4(0x1bb)],_0xd8d9c6,{'tests':_0x5b6ffd},{'evaluatorId':_0x10e25a,'onTestStart':(_0x2e4015,_0x5bd6bc,_0x211189)=>{const _0x534917=_0x1469b4;_0x39fdf5['text']='Re-evaluating\x20'+(_0x5bd6bc+0x1)+'/'+_0x211189+':\x20'+_0x2e4015+_0x534917(0x16a);if(!_0x39fdf5[_0x534917(0x1b7)])_0x39fdf5['start']();},'onTestComplete':(_0x176cd1,_0x477f6f)=>{const _0x1b0c2d=_0x1469b4;_0x39fdf5[_0x1b0c2d(0x1b6)]();if(_0x477f6f[_0x1b0c2d(0x1d1)]===_0x1b0c2d(0x1b2))console[_0x1b0c2d(0x176)](a5_0x156914[_0x1b0c2d(0x142)]('✓\x20PASS:\x20'+_0x176cd1)+a5_0x156914[_0x1b0c2d(0x1c9)](_0x1b0c2d(0x191)));else _0x477f6f[_0x1b0c2d(0x1d1)]===_0x1b0c2d(0x189)?console[_0x1b0c2d(0x176)](a5_0x156914[_0x1b0c2d(0x17b)](_0x1b0c2d(0x1ca)+_0x176cd1+_0x1b0c2d(0x14c)+_0x477f6f[_0x1b0c2d(0x198)])+a5_0x156914[_0x1b0c2d(0x1c9)](_0x1b0c2d(0x191))):console[_0x1b0c2d(0x176)](a5_0x156914[_0x1b0c2d(0x17b)](_0x1b0c2d(0x1aa)+_0x176cd1+_0x1b0c2d(0x14c)+_0x477f6f['reason']));_0x477f6f[_0x1b0c2d(0x172)]&&console['log'](a5_0x156914['dim'](_0x1b0c2d(0x14f)+_0x477f6f[_0x1b0c2d(0x172)])),_0x13687e[_0x1b0c2d(0x1ad)](_0x477f6f);},'onTestSkipped':(_0x2f7b19,_0x10e678)=>{const _0x213c00=_0x1469b4;_0x39fdf5[_0x213c00(0x1b6)](),console[_0x213c00(0x176)](a5_0x156914[_0x213c00(0x1c6)](_0x213c00(0x1c2)+_0x2f7b19+_0x213c00(0x14c)+_0x10e678));}});for(const _0x493b75 of _0x335c37){!_0x13687e[_0x1469b4(0x19a)](_0xa9c713=>_0xa9c713[_0x1469b4(0x154)]===_0x493b75['name'])&&_0x13687e[_0x1469b4(0x1ad)](_0x493b75);}}catch(_0x119d49){_0x39fdf5[_0x1469b4(0x1b6)]();const _0x52e56a=_0x119d49 instanceof Error?_0x119d49[_0x1469b4(0x155)]:String(_0x119d49);return console[_0x1469b4(0x176)](a5_0x156914['red']('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0x52e56a)),0x1;}_0x39fdf5[_0x1469b4(0x1b6)]();if(_0x228c38[_0x1469b4(0x162)]>0x0){console[_0x1469b4(0x176)](),console['log'](a5_0x156914[_0x1469b4(0x1ce)](_0x1469b4(0x18a)));const {projectId:_0xe0fffe,agentId:_0x527876}=_0xd8d9c6[_0x1469b4(0x1cb)];for(const _0x257d6b of _0x228c38){console['log'](_0x1469b4(0x19c)+a5_0x156914[_0x1469b4(0x169)](_0x257d6b['name']));const _0x42a0e2=createCommandSpinner(_0x1469b4(0x143)+_0x257d6b['rounds'][_0x1469b4(0x162)]+_0x1469b4(0x13d));_0x42a0e2['start']();try{const {result:_0x4f2998}=await runTest(_0x2433cb['llm'],_0x257d6b,{'agentId':_0x527876,'projectId':_0xe0fffe,'site':_0xd8d9c6[_0x1469b4(0x16c)],'noEval':![],'evaluatorId':_0x10e25a,'onRoundStart':(_0x28157a,_0x89edf9)=>{const _0x1efce2=_0x1469b4;_0x42a0e2[_0x1efce2(0x1ac)]=_0x1efce2(0x13c)+(_0x28157a+0x1)+'/'+_0x89edf9+_0x1efce2(0x13d);},'onRoundComplete':(_0x2bae53,_0x5c6509,_0x41c5f3)=>{const _0x5bcb3c=_0x1469b4,_0x4b2ab5=formatElapsed(_0x5c6509);_0x41c5f3?console['log'](_0x5bcb3c(0x17e)+(_0x2bae53+0x1)+'/'+_0x257d6b[_0x5bcb3c(0x1a0)][_0x5bcb3c(0x162)]+_0x5bcb3c(0x15a)+a5_0x156914[_0x5bcb3c(0x142)]('✓')+'\x20('+_0x4b2ab5+')'):console[_0x5bcb3c(0x176)](_0x5bcb3c(0x17e)+(_0x2bae53+0x1)+'/'+_0x257d6b[_0x5bcb3c(0x1a0)][_0x5bcb3c(0x162)]+'...\x20'+a5_0x156914[_0x5bcb3c(0x17b)]('✗'));},'onEvaluationStart':()=>{_0x42a0e2['text']='Evaluating\x20response...';},'onEvaluationComplete':_0x284c1e=>{const _0x4d51a0=_0x1469b4,_0x4d1679=formatElapsed(_0x284c1e);console[_0x4d51a0(0x176)](_0x4d51a0(0x14d)+a5_0x156914[_0x4d51a0(0x142)]('✓')+'\x20('+_0x4d1679+')');}});_0x42a0e2[_0x1469b4(0x1b6)](),_0x13687e[_0x1469b4(0x1ad)](_0x4f2998);if(_0x4f2998['status']===_0x1469b4(0x1b2))console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x142)](_0x1469b4(0x1c3)+_0x4f2998[_0x1469b4(0x198)])+a5_0x156914[_0x1469b4(0x1c9)](_0x1469b4(0x18b)));else _0x4f2998[_0x1469b4(0x1d1)]===_0x1469b4(0x189)?console['log'](a5_0x156914[_0x1469b4(0x17b)](_0x1469b4(0x1ca)+_0x4f2998[_0x1469b4(0x198)])+a5_0x156914[_0x1469b4(0x1c9)]('\x20(new)')):console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x17b)](_0x1469b4(0x1aa)+_0x4f2998['reason']));_0x4f2998[_0x1469b4(0x172)]&&console['log'](a5_0x156914['dim'](_0x1469b4(0x14f)+_0x4f2998[_0x1469b4(0x172)]));}catch(_0x131be3){_0x42a0e2['stop']();const _0x2d8478=_0x131be3 instanceof Error?_0x131be3[_0x1469b4(0x155)]:String(_0x131be3);console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x17b)](_0x1469b4(0x1aa)+_0x2d8478)),_0x13687e[_0x1469b4(0x1ad)]({'name':_0x257d6b[_0x1469b4(0x154)],'status':_0x1469b4(0x186),'reason':_0x2d8478,'timestamp':new Date()[_0x1469b4(0x152)](),'duration_ms':0x0});}}}console[_0x1469b4(0x176)]();const _0x245cd5=Date[_0x1469b4(0x1cd)]()-_0x3b27e5,_0x1ea1e5=_0x13687e[_0x1469b4(0x1bf)](_0xf1cd71=>_0xf1cd71['status']===_0x1469b4(0x1b2))['length'],_0x49017f=_0x13687e['filter'](_0x33a189=>_0x33a189['status']==='FAIL')[_0x1469b4(0x162)],_0x1dfe78=_0x13687e[_0x1469b4(0x1bf)](_0x219dd8=>_0x219dd8[_0x1469b4(0x1d1)]===_0x1469b4(0x186))[_0x1469b4(0x162)];console['log']('━'[_0x1469b4(0x1a1)](0x3c)),console[_0x1469b4(0x176)](_0x1469b4(0x179)),console[_0x1469b4(0x176)]('━'['repeat'](0x3c)),console[_0x1469b4(0x176)](_0x1469b4(0x14b)+_0x13687e[_0x1469b4(0x162)]),console[_0x1469b4(0x176)](_0x1469b4(0x1bc)+a5_0x156914['green'](_0x1ea1e5)),console[_0x1469b4(0x176)](_0x1469b4(0x19e)+a5_0x156914['red'](_0x49017f));_0x1dfe78>0x0&&console[_0x1469b4(0x176)]('Errors:\x20\x20\x20'+a5_0x156914[_0x1469b4(0x17b)](_0x1dfe78));console[_0x1469b4(0x176)](_0x1469b4(0x15d)+formatElapsed(_0x245cd5)),console[_0x1469b4(0x176)]('━'[_0x1469b4(0x1a1)](0x3c));const _0x361f8f={'summary':{'total':_0x13687e['length'],'passed':_0x1ea1e5,'failed':_0x49017f,'errors':_0x1dfe78>0x0?_0x1dfe78:undefined,'duration_ms':_0x245cd5},'tests':_0x13687e,'agent':{'project':_0x20f334[_0x1469b4(0x187)],'name':_0x20f334[_0x1469b4(0x147)],'site':_0xdf4ef9},'timestamp':new Date(_0x3b27e5)[_0x1469b4(0x152)]()};if(_0x542bf3!=='table'||_0x5ea39a){const _0x113449=formatResults(_0x361f8f,_0x542bf3);if(_0x5ea39a)try{a5_0x362934[_0x1469b4(0x16f)](_0x5ea39a,_0x113449,_0x1469b4(0x192)),console[_0x1469b4(0x176)](),console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x1c9)](_0x1469b4(0x17a)+_0x5ea39a));}catch(_0x50def4){return console[_0x1469b4(0x176)](),console[_0x1469b4(0x176)](a5_0x156914[_0x1469b4(0x17b)](_0x1469b4(0x166)+_0x50def4)),0x1;}else console['log'](),console[_0x1469b4(0x176)](_0x113449);}const _0x3e6743=_0x13687e[_0x1469b4(0x1bf)](_0x12b761=>_0x12b761[_0x1469b4(0x1d1)]!==_0x1469b4(0x1b2));return _0x3e6743[_0x1469b4(0x162)]>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a6_0x4604df=a6_0xf9e6;(function(_0x24e9cd,_0x432071){const _0x146494=a6_0xf9e6,_0x55f1a3=_0x24e9cd();while(!![]){try{const _0x2856ce=parseInt(_0x146494(0x133))/0x1+parseInt(_0x146494(0x126))/0x2+-parseInt(_0x146494(0x12f))/0x3+-parseInt(_0x146494(0x11f))/0x4*(-parseInt(_0x146494(0x128))/0x5)+-parseInt(_0x146494(0x115))/0x6+parseInt(_0x146494(0x12b))/0x7*(parseInt(_0x146494(0x136))/0x8)+-parseInt(_0x146494(0x10e))/0x9;if(_0x2856ce===_0x432071)break;else _0x55f1a3['push'](_0x55f1a3['shift']());}catch(_0x58dfa2){_0x55f1a3['push'](_0x55f1a3['shift']());}}}(a6_0x2500,0x69174));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';function a6_0xf9e6(_0x430203,_0x424726){_0x430203=_0x430203-0xf8;const _0x2500de=a6_0x2500();let _0xf9e6c5=_0x2500de[_0x430203];return _0xf9e6c5;}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_0x4604df(0xff),'proxy-authorization',a6_0x4604df(0x104),a6_0x4604df(0xfb),a6_0x4604df(0x123),a6_0x4604df(0xfd),a6_0x4604df(0x129),a6_0x4604df(0x135)]);function isSensitiveHeader(_0x12f4ca){const _0x29388d=a6_0x4604df;return SENSITIVE_HEADERS[_0x29388d(0x122)](_0x12f4ca[_0x29388d(0x108)]());}function parseHeader(_0x49e8d9){const _0x3889d3=a6_0x4604df,_0x56d1e6=_0x49e8d9['indexOf'](':');if(_0x56d1e6===-0x1)throw new Error(_0x3889d3(0x132)+_0x49e8d9+_0x3889d3(0x131)+_0x3889d3(0x138));const _0x267565=_0x49e8d9[_0x3889d3(0x106)](0x0,_0x56d1e6)[_0x3889d3(0x103)](),_0x236669=_0x49e8d9[_0x3889d3(0x106)](_0x56d1e6+0x1)['trim']();if(!_0x267565)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x49e8d9+'\x22');return[_0x267565,_0x236669];}export class ApiCommand extends BaseCommand{['name']=a6_0x4604df(0xfa);[a6_0x4604df(0x117)]=a6_0x4604df(0x112);[a6_0x4604df(0xfc)](_0x310345){const _0x5abe26=a6_0x4604df,{args:_0x1b4a75,options:_0x1a822b}=_0x310345,_0x25664a=_0x1a822b;if(_0x1b4a75[_0x5abe26(0x105)]===0x0)return _0x5abe26(0x119);const _0x47d39f=_0x1b4a75[0x0];if(!_0x47d39f[_0x5abe26(0x113)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x47d39f;const _0x5de724=_0x25664a[_0x5abe26(0xf9)],_0x5874a0=_0x25664a[_0x5abe26(0x102)];if(_0x5de724&&_0x5874a0)return _0x5abe26(0x118);const _0x5ac2cd=_0x25664a[_0x5abe26(0x10f)]||'GET',_0x365dda=[_0x5abe26(0x101),'POST',_0x5abe26(0x124),_0x5abe26(0x11a),_0x5abe26(0x11d)];if(!_0x365dda['includes'](_0x5ac2cd[_0x5abe26(0xfe)]()))return _0x5abe26(0x11c)+_0x5ac2cd+'.\x20Valid\x20methods:\x20'+_0x365dda[_0x5abe26(0x10c)](',\x20');const _0xf3bfac=_0x25664a['type']||'td',_0x667655=['td',_0x5abe26(0x134),_0x5abe26(0x110),_0x5abe26(0x109),'llm',_0x5abe26(0x10b)];if(!_0x667655['includes'](_0xf3bfac))return'Invalid\x20API\x20type:\x20'+_0xf3bfac+_0x5abe26(0x130)+_0x667655[_0x5abe26(0x10c)](',\x20');return undefined;}async[a6_0x4604df(0x137)](_0x5b794f){const _0x33ff8e=a6_0x4604df,{options:_0x47e3c3,args:_0x776578,tdx:_0x371d0b}=_0x5b794f,_0x5f5985=_0x47e3c3,_0x1b34d3=_0x776578[0x0],_0x5e3b11=(_0x5f5985[_0x33ff8e(0x10f)]||_0x33ff8e(0x101))[_0x33ff8e(0xfe)](),_0x5a6994=_0x5f5985['data'],_0x1f1f69=_0x5f5985[_0x33ff8e(0x102)],_0x52c352=_0x5f5985[_0x33ff8e(0xf8)],_0xa2ada1=_0x5f5985[_0x33ff8e(0x139)]||'td';try{const _0x52e150={};if(_0x52c352){const _0x4482cd=Array[_0x33ff8e(0x11b)](_0x52c352)?_0x52c352:[_0x52c352];for(const _0x1c6964 of _0x4482cd){const [_0x57e807,_0x34d359]=parseHeader(_0x1c6964);_0x52e150[_0x57e807]=_0x34d359;}}let _0x2d1c32;if(_0x5a6994)_0x2d1c32=_0x5a6994;else{if(_0x1f1f69)try{_0x2d1c32=RawAPI[_0x33ff8e(0x127)](_0x1f1f69);}catch(_0x10e227){return console[_0x33ff8e(0x111)]('Error:\x20'+(_0x10e227 instanceof Error?_0x10e227['message']:String(_0x10e227))),0x1;}}const _0x6c067b={'method':_0x5e3b11,'apiType':_0xa2ada1,'includeHeaders':_0x47e3c3[_0x33ff8e(0x116)]};_0x2d1c32&&(_0x6c067b[_0x33ff8e(0x12e)]=_0x2d1c32);Object[_0x33ff8e(0x107)](_0x52e150)[_0x33ff8e(0x105)]>0x0&&(_0x6c067b[_0x33ff8e(0x10a)]=_0x52e150);if(_0x47e3c3[_0x33ff8e(0x116)]){const _0x2fe248=resolveSite(_0x47e3c3[_0x33ff8e(0x114)]),_0x4da452=getEndpoint(_0x2fe248,_0xa2ada1),_0x5c5e13=''+_0x4da452+_0x1b34d3;console[_0x33ff8e(0x111)]('>\x20'+_0x5e3b11+'\x20'+_0x5c5e13);const _0x3fcafa=getAuthHeaders(_0x2fe248),_0x27eefe={..._0x3fcafa,..._0x52e150};for(const [_0x84436f,_0x31944e]of Object['entries'](_0x27eefe)){!isSensitiveHeader(_0x84436f)&&console[_0x33ff8e(0x111)]('>\x20'+_0x84436f+':\x20'+_0x31944e);}_0x2d1c32&&console[_0x33ff8e(0x111)]('>'),console[_0x33ff8e(0x111)]('');}const _0x48cf71=await _0x371d0b['api'][_0x33ff8e(0x12d)](_0x1b34d3,_0x6c067b);if(_0x47e3c3[_0x33ff8e(0x116)]&&_0x48cf71[_0x33ff8e(0x10a)]){console[_0x33ff8e(0x111)](_0x33ff8e(0x10d)+_0x48cf71[_0x33ff8e(0x12a)]);for(const [_0xc97726,_0x17844f]of Object['entries'](_0x48cf71[_0x33ff8e(0x10a)])){!isSensitiveHeader(_0xc97726)&&console[_0x33ff8e(0x111)]('<\x20'+_0xc97726+':\x20'+_0x17844f);}console[_0x33ff8e(0x111)]('');}const _0x1eb196=Boolean(_0x47e3c3['output']),_0x5c9911={'color':_0x47e3c3[_0x33ff8e(0x100)],'noColor':_0x47e3c3['noColor']||_0x1eb196&&!_0x47e3c3['color']},_0xe71e47=colorizeJSON(_0x48cf71[_0x33ff8e(0xf9)],_0x5c9911);return _0x47e3c3[_0x33ff8e(0x125)]?(writeFileSync(_0x47e3c3['output'],_0xe71e47),console[_0x33ff8e(0x111)]('Results\x20saved\x20to\x20'+_0x47e3c3[_0x33ff8e(0x125)])):console[_0x33ff8e(0x11e)](_0xe71e47),0x0;}catch(_0x374663){return _0x374663 instanceof Error?(console[_0x33ff8e(0x111)](_0x33ff8e(0x12c)+_0x374663['message']),_0x47e3c3[_0x33ff8e(0x116)]&&_0x374663[_0x33ff8e(0x121)]&&console[_0x33ff8e(0x111)](_0x33ff8e(0x120)+_0x374663[_0x33ff8e(0x121)])):console[_0x33ff8e(0x111)](_0x33ff8e(0x12c)+String(_0x374663)),0x1;}}}function a6_0x2500(){const _0x140680=['output','388170ktnzFh','readBodyFromFile','1051465pttNsc','x-auth-token','status','999397zfwtcc','Error:\x20','request','body','1865268hnbUyK','.\x20Valid\x20types:\x20','\x22.\x20','Invalid\x20header\x20format:\x20\x22','602728kQBlhK','cdp','x-trino-user','8DURXRy','execute','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','type','header','data','api','set-cookie','validate','x-xsrf-token','toUpperCase','authorization','color','GET','file','trim','cookie','length','substring','keys','toLowerCase','trino','headers','llm-proxy','join','<\x20HTTP/1.1\x20','165942qhsjUl','method','workflow','error','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','startsWith','site','475386tKeHPg','verbose','description','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','DELETE','isArray','Invalid\x20HTTP\x20method:\x20','PATCH','log','4swBPdH','\x0aStack\x20trace:\x0a','stack','has','set-cookie2','PUT'];a6_0x2500=function(){return _0x140680;};return a6_0x2500();}
1
+ const a6_0x5d41cc=a6_0x17fb;(function(_0xca989a,_0x4c1057){const _0x1c62ed=a6_0x17fb,_0x5976fc=_0xca989a();while(!![]){try{const _0x328a79=parseInt(_0x1c62ed(0xc7))/0x1+-parseInt(_0x1c62ed(0x104))/0x2+-parseInt(_0x1c62ed(0xcc))/0x3*(-parseInt(_0x1c62ed(0xe0))/0x4)+parseInt(_0x1c62ed(0xfa))/0x5*(parseInt(_0x1c62ed(0xfd))/0x6)+-parseInt(_0x1c62ed(0x101))/0x7*(parseInt(_0x1c62ed(0xf0))/0x8)+-parseInt(_0x1c62ed(0xf1))/0x9*(parseInt(_0x1c62ed(0xe2))/0xa)+-parseInt(_0x1c62ed(0xda))/0xb*(-parseInt(_0x1c62ed(0xce))/0xc);if(_0x328a79===_0x4c1057)break;else _0x5976fc['push'](_0x5976fc['shift']());}catch(_0x5bd3da){_0x5976fc['push'](_0x5976fc['shift']());}}}(a6_0x460f,0x33c2d));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';function a6_0x460f(){const _0x27a190=['72RCCRDv','1152FyFPsh','x-auth-token','Endpoint\x20must\x20start\x20with\x20/:\x20','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','Invalid\x20HTTP\x20method:\x20','message','api','status','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','1753220nBJBZX','authorization','length','6FaQltI','file','set-cookie','description','65072YUONjW','includes','validate','654854AzjrID','substring','site','name','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','color','entries','set-cookie2','304066kOPFLV','cdp','request','\x0aStack\x20trace:\x0a','workflow','39MBNRZg','Error:\x20','276852skLAao','proxy-authorization','log','method','type','data','join','.\x20Valid\x20methods:\x20','x-xsrf-token','trim','Invalid\x20header\x20format:\x20\x22','\x22.\x20','11aNYbIr','llm','cookie','headers','body','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','13148wMEsoT','GET','7610xVXxTE','<\x20HTTP/1.1\x20','stack','POST','llm-proxy','output','error','indexOf','has','isArray','.\x20Valid\x20types:\x20','verbose','readBodyFromFile','noColor'];a6_0x460f=function(){return _0x27a190;};return a6_0x460f();}function a6_0x17fb(_0x298c84,_0x3e795a){_0x298c84=_0x298c84-0xc4;const _0x460f8e=a6_0x460f();let _0x17fbef=_0x460f8e[_0x298c84];return _0x17fbef;}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_0x5d41cc(0xfb),a6_0x5d41cc(0xcf),a6_0x5d41cc(0xdc),a6_0x5d41cc(0xff),a6_0x5d41cc(0xc6),a6_0x5d41cc(0xd6),a6_0x5d41cc(0xf2),'x-trino-user']);function isSensitiveHeader(_0x5e5424){const _0x5260d3=a6_0x5d41cc;return SENSITIVE_HEADERS[_0x5260d3(0xea)](_0x5e5424['toLowerCase']());}function parseHeader(_0x57e1fe){const _0x4495ec=a6_0x5d41cc,_0x3fe092=_0x57e1fe[_0x4495ec(0xe9)](':');if(_0x3fe092===-0x1)throw new Error(_0x4495ec(0xd8)+_0x57e1fe+_0x4495ec(0xd9)+_0x4495ec(0xdf));const _0xc14749=_0x57e1fe[_0x4495ec(0x105)](0x0,_0x3fe092)[_0x4495ec(0xd7)](),_0x2de605=_0x57e1fe[_0x4495ec(0x105)](_0x3fe092+0x1)[_0x4495ec(0xd7)]();if(!_0xc14749)throw new Error(_0x4495ec(0xf4)+_0x57e1fe+'\x22');return[_0xc14749,_0x2de605];}export class ApiCommand extends BaseCommand{[a6_0x5d41cc(0x107)]=a6_0x5d41cc(0xf7);[a6_0x5d41cc(0x100)]=a6_0x5d41cc(0xf9);[a6_0x5d41cc(0x103)](_0xcddbe8){const _0x4b973c=a6_0x5d41cc,{args:_0xc0ea8a,options:_0x4ec532}=_0xcddbe8,_0xadb9e5=_0x4ec532;if(_0xc0ea8a[_0x4b973c(0xfc)]===0x0)return _0x4b973c(0x108);const _0x5b6279=_0xc0ea8a[0x0];if(!_0x5b6279['startsWith']('/'))return _0x4b973c(0xf3)+_0x5b6279;const _0x3cb2f0=_0xadb9e5['data'],_0x23e2fe=_0xadb9e5[_0x4b973c(0xfe)];if(_0x3cb2f0&&_0x23e2fe)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x4e781f=_0xadb9e5['method']||'GET',_0x1c4810=[_0x4b973c(0xe1),_0x4b973c(0xe5),'PUT','DELETE','PATCH'];if(!_0x1c4810['includes'](_0x4e781f['toUpperCase']()))return _0x4b973c(0xf5)+_0x4e781f+_0x4b973c(0xd5)+_0x1c4810[_0x4b973c(0xd4)](',\x20');const _0x26db27=_0xadb9e5[_0x4b973c(0xd2)]||'td',_0x158363=['td',_0x4b973c(0xc8),_0x4b973c(0xcb),'trino',_0x4b973c(0xdb),_0x4b973c(0xe6)];if(!_0x158363[_0x4b973c(0x102)](_0x26db27))return'Invalid\x20API\x20type:\x20'+_0x26db27+_0x4b973c(0xec)+_0x158363['join'](',\x20');return undefined;}async['execute'](_0x4bb55a){const _0x7e025f=a6_0x5d41cc,{options:_0x473c7f,args:_0x6b15de,tdx:_0x49f938}=_0x4bb55a,_0x4338bb=_0x473c7f,_0xc86e31=_0x6b15de[0x0],_0x45d9f1=(_0x4338bb[_0x7e025f(0xd1)]||_0x7e025f(0xe1))['toUpperCase'](),_0x22c363=_0x4338bb[_0x7e025f(0xd3)],_0xe488fa=_0x4338bb['file'],_0xef8d01=_0x4338bb['header'],_0x13b74f=_0x4338bb[_0x7e025f(0xd2)]||'td';try{const _0x3c7b9b={};if(_0xef8d01){const _0xd8f1ed=Array[_0x7e025f(0xeb)](_0xef8d01)?_0xef8d01:[_0xef8d01];for(const _0xe264db of _0xd8f1ed){const [_0x5c8b20,_0x44d5e8]=parseHeader(_0xe264db);_0x3c7b9b[_0x5c8b20]=_0x44d5e8;}}let _0x1d80e;if(_0x22c363)_0x1d80e=_0x22c363;else{if(_0xe488fa)try{_0x1d80e=RawAPI[_0x7e025f(0xee)](_0xe488fa);}catch(_0x5a800d){return console[_0x7e025f(0xe8)](_0x7e025f(0xcd)+(_0x5a800d instanceof Error?_0x5a800d['message']:String(_0x5a800d))),0x1;}}const _0x1b6bb6={'method':_0x45d9f1,'apiType':_0x13b74f,'includeHeaders':_0x473c7f[_0x7e025f(0xed)]};_0x1d80e&&(_0x1b6bb6[_0x7e025f(0xde)]=_0x1d80e);Object['keys'](_0x3c7b9b)['length']>0x0&&(_0x1b6bb6[_0x7e025f(0xdd)]=_0x3c7b9b);if(_0x473c7f[_0x7e025f(0xed)]){const _0xebf240=resolveSite(_0x473c7f[_0x7e025f(0x106)]),_0x5cc1a1=getEndpoint(_0xebf240,_0x13b74f),_0x2933a0=''+_0x5cc1a1+_0xc86e31;console[_0x7e025f(0xe8)]('>\x20'+_0x45d9f1+'\x20'+_0x2933a0);const _0x5d85ff=getAuthHeaders(_0xebf240),_0x5c64fb={..._0x5d85ff,..._0x3c7b9b};for(const [_0x28e67c,_0x1cd11e]of Object[_0x7e025f(0xc5)](_0x5c64fb)){!isSensitiveHeader(_0x28e67c)&&console[_0x7e025f(0xe8)]('>\x20'+_0x28e67c+':\x20'+_0x1cd11e);}_0x1d80e&&console[_0x7e025f(0xe8)]('>'),console[_0x7e025f(0xe8)]('');}const _0x8d69c5=await _0x49f938[_0x7e025f(0xf7)][_0x7e025f(0xc9)](_0xc86e31,_0x1b6bb6);if(_0x473c7f[_0x7e025f(0xed)]&&_0x8d69c5[_0x7e025f(0xdd)]){console['error'](_0x7e025f(0xe3)+_0x8d69c5[_0x7e025f(0xf8)]);for(const [_0x67b606,_0x285eed]of Object['entries'](_0x8d69c5[_0x7e025f(0xdd)])){!isSensitiveHeader(_0x67b606)&&console[_0x7e025f(0xe8)]('<\x20'+_0x67b606+':\x20'+_0x285eed);}console[_0x7e025f(0xe8)]('');}const _0x51d229=Boolean(_0x473c7f[_0x7e025f(0xe7)]),_0x8dd76f={'color':_0x473c7f[_0x7e025f(0xc4)],'noColor':_0x473c7f[_0x7e025f(0xef)]||_0x51d229&&!_0x473c7f['color']},_0x5dbda1=colorizeJSON(_0x8d69c5['data'],_0x8dd76f);return _0x473c7f['output']?(writeFileSync(_0x473c7f[_0x7e025f(0xe7)],_0x5dbda1),console[_0x7e025f(0xe8)]('Results\x20saved\x20to\x20'+_0x473c7f[_0x7e025f(0xe7)])):console[_0x7e025f(0xd0)](_0x5dbda1),0x0;}catch(_0x7e7a2c){return _0x7e7a2c instanceof Error?(console[_0x7e025f(0xe8)](_0x7e025f(0xcd)+_0x7e7a2c[_0x7e025f(0xf6)]),_0x473c7f['verbose']&&_0x7e7a2c[_0x7e025f(0xe4)]&&console[_0x7e025f(0xe8)](_0x7e025f(0xca)+_0x7e7a2c[_0x7e025f(0xe4)])):console[_0x7e025f(0xe8)](_0x7e025f(0xcd)+String(_0x7e7a2c)),0x1;}}}
@@ -1 +1 @@
1
- const a7_0x1a0ba9=a7_0x2673;(function(_0xf66a3e,_0x393d90){const _0x3c89ad=a7_0x2673,_0x4707dd=_0xf66a3e();while(!![]){try{const _0x263031=parseInt(_0x3c89ad(0x72))/0x1+-parseInt(_0x3c89ad(0xb2))/0x2+parseInt(_0x3c89ad(0x76))/0x3+parseInt(_0x3c89ad(0x9d))/0x4*(parseInt(_0x3c89ad(0xb7))/0x5)+-parseInt(_0x3c89ad(0x7c))/0x6+-parseInt(_0x3c89ad(0xb6))/0x7+parseInt(_0x3c89ad(0xad))/0x8*(parseInt(_0x3c89ad(0xbc))/0x9);if(_0x263031===_0x393d90)break;else _0x4707dd['push'](_0x4707dd['shift']());}catch(_0x2b216f){_0x4707dd['push'](_0x4707dd['shift']());}}}(a7_0x2507,0x6d037));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';function a7_0x2673(_0x4443c6,_0x2810d4){_0x4443c6=_0x4443c6-0x72;const _0x2507ef=a7_0x2507();let _0x2673b6=_0x2507ef[_0x4443c6];return _0x2673b6;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import{isOAuthSupported}from'../core/oauth.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x5c1f19 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x2beedd from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x1a0ba9(0xb8)]=a7_0x1a0ba9(0x9c);['description']='Setup\x20API\x20key\x20authentication\x20interactively';async[a7_0x1a0ba9(0xab)](_0x11a477){const _0x3e44af=a7_0x1a0ba9,{options:_0x864a9}=_0x11a477,_0xc11819=_0x864a9[_0x3e44af(0x82)];console[_0x3e44af(0x8c)](a7_0x2beedd[_0x3e44af(0xa8)](_0x3e44af(0xb0)));const _0x248605=_0x864a9['site']||_0x3e44af(0x8f),_0x44eec0=await promptSiteSelection(_0x248605,_0xc11819,_0x3e44af(0x7a));if(!_0x44eec0)return 0x1;const _0x4ea2c2=resolveSite(_0x44eec0);if(isOAuthSupported(_0x4ea2c2)){const _0x4be81e=await a7_0x5c1f19({'type':_0x3e44af(0x95),'name':_0x3e44af(0xa9),'message':_0x3e44af(0x8b),'choices':[{'title':_0x3e44af(0x80),'value':_0x3e44af(0x84)},{'title':_0x3e44af(0x8e),'value':'apikey'}]});if(!_0x4be81e[_0x3e44af(0xa9)])return console[_0x3e44af(0x8c)]('\x0aSetup\x20cancelled'),0x1;if(_0x4be81e[_0x3e44af(0xa9)]===_0x3e44af(0x84))return await runOAuthLoginFlow(_0x4ea2c2,_0xc11819,_0x864a9[_0x3e44af(0xbf)]??LogLevel[_0x3e44af(0xbd)]),0x0;}console[_0x3e44af(0x8c)](_0x3e44af(0x93)+_0x4ea2c2),console[_0x3e44af(0x8c)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3e44af(0x8c)]('\x20\x20'+getConsoleUrl(_0x4ea2c2,_0x3e44af(0x9f)));const _0x1f2093=await a7_0x5c1f19({'type':_0x3e44af(0x85),'name':_0x3e44af(0xb3),'message':_0x3e44af(0x94),'validate':_0x434198=>{const _0x3a275b=_0x3e44af;if(!_0x434198||!_0x434198[_0x3a275b(0xb1)]())return _0x3a275b(0xaf);return!![];}});if(!_0x1f2093[_0x3e44af(0xb3)])return console[_0x3e44af(0x8c)](_0x3e44af(0xc1)),0x1;const _0x4fc748=_0x1f2093['apiKey'];console[_0x3e44af(0x8c)](_0x3e44af(0xa2));try{const _0x8b4e39=TDX[_0x3e44af(0xa5)]({'site':_0x4ea2c2,'apiKey':_0x4fc748['trim'](),'logLevel':_0x864a9['logLevel']??LogLevel[_0x3e44af(0xbd)]}),_0x3896de=await _0x8b4e39[_0x3e44af(0xb9)][_0x3e44af(0x7e)]();console['log'](_0x3e44af(0xae)+_0x3896de[_0x3e44af(0xa4)]+')');const _0x95f7ac=await isKeychainAvailable();_0x95f7ac?(await saveAPIKeyAsync(_0x4fc748[_0x3e44af(0xb1)](),_0x4ea2c2,_0xc11819),console[_0x3e44af(0x8c)](_0x3e44af(0x78)+(_0xc11819?'\x20(profile:\x20'+_0xc11819+')':''))):(console[_0x3e44af(0xb5)](a7_0x2beedd[_0x3e44af(0x7d)](_0x3e44af(0x7f))),console[_0x3e44af(0xb5)](a7_0x2beedd[_0x3e44af(0x7d)](_0x3e44af(0x75))));if(_0xc11819){const _0x38e6da={'site':_0x4ea2c2};saveProfileToUserConfig(_0xc11819,_0x38e6da),console[_0x3e44af(0x8c)](_0x3e44af(0x7b)+_0xc11819+_0x3e44af(0x81));}else saveDefaultSiteToUserConfig(_0x4ea2c2),console[_0x3e44af(0x8c)]('✓\x20Default\x20site\x20set\x20to\x20'+_0x4ea2c2);const _0x4110b9=_0xc11819?_0x3e44af(0x99)+_0xc11819:'';return console['log'](),console[_0x3e44af(0x8c)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x3e44af(0x8c)](_0x3e44af(0xa7)+_0x4110b9+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x3e44af(0x8c)](_0x3e44af(0xa7)+_0x4110b9+_0x3e44af(0xc0)),0x0;}catch(_0x5d3411){if(_0x5d3411 instanceof HTTPClientError&&_0x5d3411[_0x3e44af(0x9a)]===0x191)return printAuthError(_0x5d3411),0x1;return console[_0x3e44af(0xc2)](a7_0x2beedd[_0x3e44af(0xa3)]('✗\x20Validation\x20failed:\x20'+(_0x5d3411 instanceof Error?_0x5d3411[_0x3e44af(0x79)]:String(_0x5d3411)))),console[_0x3e44af(0xc2)](_0x3e44af(0xac)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x1a0ba9(0xb8)]='auth';[a7_0x1a0ba9(0xba)]=a7_0x1a0ba9(0x9e);async[a7_0x1a0ba9(0xab)](_0xe15c7a){const _0x2e3088=a7_0x1a0ba9,{options:_0x5b70dc,tdx:_0x570da5}=_0xe15c7a,_0x5d0386=_0x5b70dc[_0x2e3088(0x8d)],_0x2a857d=_0x5b70dc[_0x2e3088(0x82)],_0x5f4570=_0x2a857d?_0x2a857d:_0x2e3088(0x86);console[_0x2e3088(0x8c)](_0x2e3088(0xa1)+_0x5f4570+_0x2e3088(0x92)+_0x5d0386+')');const _0x2e8060=await getOAuthTokens(_0x2a857d);if(_0x2e8060)console['log'](_0x2e3088(0xa0)),console[_0x2e3088(0x8c)](_0x2e3088(0x97)+(_0x2a857d?_0x2e3088(0xbe)+_0x2a857d+')':''));else{const _0x4d8856=await resolveAPIKeyAsync(_0x5d0386,_0x2a857d);if(_0x4d8856){const {source:_0x5a2a48,isDeprecated:_0x1b9f3a}=_0x4d8856,_0x4458e0=_0x2e3088(0x96)+_0x5a2a48;console[_0x2e3088(0x8c)](_0x1b9f3a?a7_0x2beedd[_0x2e3088(0x7d)](_0x4458e0):_0x4458e0);}else console[_0x2e3088(0x8c)](a7_0x2beedd[_0x2e3088(0x7d)](_0x2e3088(0x90)));}try{const _0x6aa4cc=await _0x570da5[_0x2e3088(0xb9)]['getUserInfo']();return console[_0x2e3088(0x8c)](a7_0x2beedd['green'](_0x2e3088(0x73))),console[_0x2e3088(0x8c)](_0x2e3088(0x8a)+_0x6aa4cc['email']),(_0x6aa4cc[_0x2e3088(0x74)]||_0x6aa4cc[_0x2e3088(0xb4)])&&console[_0x2e3088(0x8c)]('Name:\x20'+[_0x6aa4cc[_0x2e3088(0x74)],_0x6aa4cc[_0x2e3088(0xb4)]][_0x2e3088(0x91)](Boolean)[_0x2e3088(0xaa)]('\x20')),0x0;}catch(_0x9f140f){return _0x9f140f instanceof HTTPClientError&&_0x9f140f[_0x2e3088(0x9a)]===0x191?printAuthError(_0x9f140f,!![],_0x2a857d):console['error'](a7_0x2beedd[_0x2e3088(0xa3)](_0x2e3088(0xbb)+(_0x9f140f instanceof Error?_0x9f140f[_0x2e3088(0x79)]:String(_0x9f140f)))),0x1;}}}function a7_0x2507(){const _0x1ade1a=['filter','\x20(site:\x20','Setting\x20up\x20authentication\x20for\x20site:\x20','Enter\x20your\x20TD\x20API\x20key:','select','Read\x20credential\x20from\x20','Read\x20credential\x20from\x20keychain','Remove\x20API\x20key\x20from\x20system\x20keychain','\x20--profile\x20','status','\x20and\x20','auth:setup','4DtidFK','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','/app/mp/ak','Credential\x20type:\x20OAuth','tdx\x20profile:\x20','Validating\x20API\x20key...','red','email','create','tdx:\x20auth\x20clear','\x20\x20tdx','bold','method','join','execute','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','24664aGGFSA','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','API\x20key\x20cannot\x20be\x20empty','tdx:\x20auth\x20setup','trim','1030172DbsyCd','apiKey','last_name','warn','2924698anuwsb','4259145uebJXC','name','jobs','description','✗\x20Validation\x20failed:\x20','1197DXzZhG','ERROR','\x20(profile:\x20','logLevel','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x0aSetup\x20cancelled','error','System\x20keychain\x20is\x20not\x20available','111476lXDtSs','✓\x20Authentication\x20successful\x0a','first_name','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','982449DsyXrE','OAuth\x20tokens','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','message','Setup\x20cancelled','✓\x20Profile\x20\x27','1928448QpHwet','yellow','getUserInfo','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','OAuth\x20(browser\x20login)','\x27\x20registered','profile','all','oauth','password','N/A','auth:clear','API\x20key','No\x20credentials\x20found\x20in\x20keychain','User:\x20','Choose\x20authentication\x20method:','log','site','API\x20Key','us01','No\x20credential\x20found'];a7_0x2507=function(){return _0x1ade1a;};return a7_0x2507();}export class AuthClearCommand extends BaseCommand{['name']=a7_0x1a0ba9(0x87);[a7_0x1a0ba9(0xba)]=a7_0x1a0ba9(0x98);async[a7_0x1a0ba9(0xab)](_0x5e4bf6){const _0x444eaa=a7_0x1a0ba9,{options:_0x5c4079}=_0x5e4bf6,_0x40be30=_0x5c4079[_0x444eaa(0x82)];console[_0x444eaa(0x8c)](a7_0x2beedd[_0x444eaa(0xa8)](_0x444eaa(0xa6)));const _0x434c1d=await isKeychainAvailable();if(!_0x434c1d)return console[_0x444eaa(0xc2)](a7_0x2beedd[_0x444eaa(0xa3)](_0x444eaa(0xc3))),0x1;const [_0x15dade,_0x196fe2]=await Promise[_0x444eaa(0x83)]([deleteKeychainAPIKey(_0x40be30),deleteOAuthTokens(_0x40be30)]);if(_0x15dade||_0x196fe2){clearCredentialCache();const _0x4490e1=[_0x15dade&&_0x444eaa(0x88),_0x196fe2&&_0x444eaa(0x77)]['filter'](Boolean)['join'](_0x444eaa(0x9b));return console[_0x444eaa(0x8c)]('✓\x20'+_0x4490e1+'\x20removed\x20from\x20keychain'+(_0x40be30?_0x444eaa(0xbe)+_0x40be30+')':'')),0x0;}else return console[_0x444eaa(0x8c)](_0x444eaa(0x89)+(_0x40be30?'\x20for\x20profile:\x20'+_0x40be30:'')),0x1;}}
1
+ function a7_0x3d01(_0xaf82b8,_0x4da564){_0xaf82b8=_0xaf82b8-0x1c6;const _0x5019ef=a7_0x5019();let _0x3d013d=_0x5019ef[_0xaf82b8];return _0x3d013d;}const a7_0xcfaafc=a7_0x3d01;(function(_0x3ea967,_0x43e246){const _0x41cec7=a7_0x3d01,_0x437b90=_0x3ea967();while(!![]){try{const _0x558bf2=parseInt(_0x41cec7(0x1ed))/0x1+parseInt(_0x41cec7(0x1e0))/0x2*(parseInt(_0x41cec7(0x1fa))/0x3)+parseInt(_0x41cec7(0x1fc))/0x4*(-parseInt(_0x41cec7(0x1fb))/0x5)+parseInt(_0x41cec7(0x1e5))/0x6+-parseInt(_0x41cec7(0x1f5))/0x7+-parseInt(_0x41cec7(0x1ce))/0x8*(-parseInt(_0x41cec7(0x1c8))/0x9)+-parseInt(_0x41cec7(0x1ee))/0xa;if(_0x558bf2===_0x43e246)break;else _0x437b90['push'](_0x437b90['shift']());}catch(_0x13b967){_0x437b90['push'](_0x437b90['shift']());}}}(a7_0x5019,0x93a6f));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import{isOAuthSupported}from'../core/oauth.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x537335 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x44e8a9 from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0xcfaafc(0x1cd)]=a7_0xcfaafc(0x1e7);['description']=a7_0xcfaafc(0x1c6);async[a7_0xcfaafc(0x1db)](_0x21bf54){const _0x114639=a7_0xcfaafc,{options:_0x36d4d4}=_0x21bf54,_0x2c3ca7=_0x36d4d4[_0x114639(0x210)];console[_0x114639(0x209)](a7_0x44e8a9[_0x114639(0x1f3)](_0x114639(0x1d0)));const _0x2ae07c=_0x36d4d4[_0x114639(0x1c9)]||_0x114639(0x1ff),_0x36cfb6=await promptSiteSelection(_0x2ae07c,_0x2c3ca7,_0x114639(0x211));if(!_0x36cfb6)return 0x1;const _0x54d7af=resolveSite(_0x36cfb6);if(isOAuthSupported(_0x54d7af)){const _0x2c7147=await a7_0x537335({'type':_0x114639(0x1eb),'name':_0x114639(0x1d7),'message':_0x114639(0x1f2),'choices':[{'title':_0x114639(0x1de),'value':_0x114639(0x1e3)},{'title':_0x114639(0x1f8),'value':'apikey'}]});if(!_0x2c7147['method'])return console[_0x114639(0x209)](_0x114639(0x1ec)),0x1;if(_0x2c7147[_0x114639(0x1d7)]===_0x114639(0x1e3))return await runOAuthLoginFlow(_0x54d7af,_0x2c3ca7,_0x36d4d4[_0x114639(0x20f)]??LogLevel[_0x114639(0x20c)]),0x0;}console['log'](_0x114639(0x1dd)+_0x54d7af),console[_0x114639(0x209)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x114639(0x209)]('\x20\x20'+getConsoleUrl(_0x54d7af,_0x114639(0x1e8)));const _0x5113cb=await a7_0x537335({'type':_0x114639(0x1f1),'name':_0x114639(0x1f4),'message':_0x114639(0x1e1),'validate':_0xdbd6af=>{const _0x89615b=_0x114639;if(!_0xdbd6af||!_0xdbd6af[_0x89615b(0x1d3)]())return _0x89615b(0x1dc);return!![];}});if(!_0x5113cb[_0x114639(0x1f4)])return console['log'](_0x114639(0x1ec)),0x1;const _0x4089a7=_0x5113cb[_0x114639(0x1f4)];console[_0x114639(0x209)]('Validating\x20API\x20key...');try{const _0x1a85ec=TDX[_0x114639(0x1d1)]({'site':_0x54d7af,'apiKey':_0x4089a7[_0x114639(0x1d3)](),'logLevel':_0x36d4d4[_0x114639(0x20f)]??LogLevel[_0x114639(0x20c)]}),_0x38c4e1=await _0x1a85ec[_0x114639(0x20d)][_0x114639(0x1f7)]();console[_0x114639(0x209)](_0x114639(0x1e6)+_0x38c4e1[_0x114639(0x1ef)]+')');const _0x427a79=await isKeychainAvailable();_0x427a79?(await saveAPIKeyAsync(_0x4089a7[_0x114639(0x1d3)](),_0x54d7af,_0x2c3ca7),console['log'](_0x114639(0x212)+(_0x2c3ca7?_0x114639(0x1d2)+_0x2c3ca7+')':''))):(console[_0x114639(0x1f6)](a7_0x44e8a9[_0x114639(0x208)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x114639(0x1f6)](a7_0x44e8a9['yellow'](_0x114639(0x215))));if(_0x2c3ca7){const _0x2ccd1e={'site':_0x54d7af};saveProfileToUserConfig(_0x2c3ca7,_0x2ccd1e),console[_0x114639(0x209)](_0x114639(0x214)+_0x2c3ca7+_0x114639(0x201));}else saveDefaultSiteToUserConfig(_0x54d7af),console[_0x114639(0x209)](_0x114639(0x1d8)+_0x54d7af);const _0x2fcebb=_0x2c3ca7?_0x114639(0x1da)+_0x2c3ca7:'';return console[_0x114639(0x209)](),console[_0x114639(0x209)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x114639(0x209)](_0x114639(0x1d5)+_0x2fcebb+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x114639(0x209)]('\x20\x20tdx'+_0x2fcebb+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x87179e){if(_0x87179e instanceof HTTPClientError&&_0x87179e[_0x114639(0x1ca)]===0x191)return printAuthError(_0x87179e),0x1;return console[_0x114639(0x1cb)](a7_0x44e8a9['red']('✗\x20Validation\x20failed:\x20'+(_0x87179e instanceof Error?_0x87179e[_0x114639(0x1d4)]:String(_0x87179e)))),console[_0x114639(0x1cb)](_0x114639(0x1f9)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']=a7_0xcfaafc(0x1df);[a7_0xcfaafc(0x1cf)]=a7_0xcfaafc(0x1e4);async[a7_0xcfaafc(0x1db)](_0x4954fd){const _0x5c6565=a7_0xcfaafc,{options:_0x3c6392,tdx:_0x54d117}=_0x4954fd,_0x4ba0d4=_0x3c6392[_0x5c6565(0x1c9)],_0x2f8642=_0x3c6392[_0x5c6565(0x210)],_0x5dceb2=_0x2f8642?_0x2f8642:_0x5c6565(0x20b);console[_0x5c6565(0x209)](_0x5c6565(0x1ea)+_0x5dceb2+_0x5c6565(0x206)+_0x4ba0d4+')');const _0x241f5f=await getOAuthTokens(_0x2f8642);if(_0x241f5f)console['log']('Credential\x20type:\x20OAuth'),console['log'](_0x5c6565(0x216)+(_0x2f8642?'\x20(profile:\x20'+_0x2f8642+')':''));else{const _0x1c6482=await resolveAPIKeyAsync(_0x4ba0d4,_0x2f8642);if(_0x1c6482){const {source:_0xb1d383,isDeprecated:_0x2775ff}=_0x1c6482,_0xe2e348=_0x5c6565(0x1e2)+_0xb1d383;console['log'](_0x2775ff?a7_0x44e8a9[_0x5c6565(0x208)](_0xe2e348):_0xe2e348);}else console[_0x5c6565(0x209)](a7_0x44e8a9['yellow']('No\x20credential\x20found'));}try{const _0x118a30=await _0x54d117['jobs']['getUserInfo']();return console['log'](a7_0x44e8a9[_0x5c6565(0x203)](_0x5c6565(0x213))),console[_0x5c6565(0x209)](_0x5c6565(0x1f0)+_0x118a30[_0x5c6565(0x1ef)]),(_0x118a30['first_name']||_0x118a30[_0x5c6565(0x1d9)])&&console[_0x5c6565(0x209)]('Name:\x20'+[_0x118a30[_0x5c6565(0x207)],_0x118a30['last_name']][_0x5c6565(0x1fe)](Boolean)['join']('\x20')),0x0;}catch(_0x2978c6){return _0x2978c6 instanceof HTTPClientError&&_0x2978c6[_0x5c6565(0x1ca)]===0x191?printAuthError(_0x2978c6,!![],_0x2f8642):console[_0x5c6565(0x1cb)](a7_0x44e8a9[_0x5c6565(0x202)](_0x5c6565(0x1d6)+(_0x2978c6 instanceof Error?_0x2978c6['message']:String(_0x2978c6)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0xcfaafc(0x1cd)]=a7_0xcfaafc(0x205);['description']=a7_0xcfaafc(0x20a);async[a7_0xcfaafc(0x1db)](_0x448398){const _0x44ccb8=a7_0xcfaafc,{options:_0x40e9f8}=_0x448398,_0x471f52=_0x40e9f8[_0x44ccb8(0x210)];console[_0x44ccb8(0x209)](a7_0x44e8a9[_0x44ccb8(0x1f3)](_0x44ccb8(0x1c7)));const _0x9db354=await isKeychainAvailable();if(!_0x9db354)return console[_0x44ccb8(0x1cb)](a7_0x44e8a9[_0x44ccb8(0x202)]('System\x20keychain\x20is\x20not\x20available')),0x1;const [_0x3d7f5c,_0x3fb994]=await Promise[_0x44ccb8(0x204)]([deleteKeychainAPIKey(_0x471f52),deleteOAuthTokens(_0x471f52)]);if(_0x3d7f5c||_0x3fb994){clearCredentialCache();const _0x317f3f=[_0x3d7f5c&&'API\x20key',_0x3fb994&&_0x44ccb8(0x1e9)][_0x44ccb8(0x1fe)](Boolean)[_0x44ccb8(0x200)](_0x44ccb8(0x20e));return console['log']('✓\x20'+_0x317f3f+_0x44ccb8(0x1fd)+(_0x471f52?_0x44ccb8(0x1d2)+_0x471f52+')':'')),0x0;}else return console[_0x44ccb8(0x209)]('No\x20credentials\x20found\x20in\x20keychain'+(_0x471f52?_0x44ccb8(0x1cc)+_0x471f52:'')),0x1;}}function a7_0x5019(){const _0x55352d=['profile','Setup\x20cancelled','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','✓\x20Authentication\x20successful\x0a','✓\x20Profile\x20\x27','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Read\x20credential\x20from\x20keychain','Setup\x20API\x20key\x20authentication\x20interactively','tdx:\x20auth\x20clear','63GQypOr','site','status','error','\x20for\x20profile:\x20','name','1274216Rlehcu','description','tdx:\x20auth\x20setup','create','\x20(profile:\x20','trim','message','\x20\x20tdx','✗\x20Validation\x20failed:\x20','method','✓\x20Default\x20site\x20set\x20to\x20','last_name','\x20--profile\x20','execute','API\x20key\x20cannot\x20be\x20empty','Setting\x20up\x20authentication\x20for\x20site:\x20','OAuth\x20(browser\x20login)','auth','838ePHXDW','Enter\x20your\x20TD\x20API\x20key:','Read\x20credential\x20from\x20','oauth','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','5632332HtKBfu','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','auth:setup','/app/mp/ak','OAuth\x20tokens','tdx\x20profile:\x20','select','\x0aSetup\x20cancelled','1152063qqJsPL','6559590VdiwPi','email','User:\x20','password','Choose\x20authentication\x20method:','bold','apiKey','8076278KivfzJ','warn','getUserInfo','API\x20Key','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','1527yuPHZM','558055eNkAQg','36hxDTnn','\x20removed\x20from\x20keychain','filter','us01','join','\x27\x20registered','red','green','all','auth:clear','\x20(site:\x20','first_name','yellow','log','Remove\x20API\x20key\x20from\x20system\x20keychain','N/A','ERROR','jobs','\x20and\x20','logLevel'];a7_0x5019=function(){return _0x55352d;};return a7_0x5019();}
@@ -1 +1 @@
1
- const a8_0x305239=a8_0x5501;(function(_0x546ada,_0x5f4c49){const _0x4f70ac=a8_0x5501,_0xa39651=_0x546ada();while(!![]){try{const _0x18e6d4=parseInt(_0x4f70ac(0x76))/0x1*(parseInt(_0x4f70ac(0x80))/0x2)+parseInt(_0x4f70ac(0x89))/0x3+-parseInt(_0x4f70ac(0x85))/0x4+-parseInt(_0x4f70ac(0x8c))/0x5+parseInt(_0x4f70ac(0x92))/0x6*(parseInt(_0x4f70ac(0x8d))/0x7)+-parseInt(_0x4f70ac(0x93))/0x8+parseInt(_0x4f70ac(0x91))/0x9*(parseInt(_0x4f70ac(0x96))/0xa);if(_0x18e6d4===_0x5f4c49)break;else _0xa39651['push'](_0xa39651['shift']());}catch(_0x474823){_0xa39651['push'](_0xa39651['shift']());}}}(a8_0x1148,0x624e9));import{BaseCommand}from'./command.js';import{resolveSite}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{isKeychainAvailable}from'../core/keychain.js';import{saveOAuthTokens}from'../core/oauth-keychain.js';import{startOAuthFlow,isOAuthSupported}from'../core/oauth.js';function a8_0x1148(){const _0x1a69b9=['377355ecyRIn','✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain','tdx:\x20auth\x20login','2216035CJfdGT','7RIQPcU','System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20','OAuth\x20is\x20currently\x20supported\x20on\x20dev-us01\x20and\x20dev-eu01\x20only.\x20','description','13094253fxIrEi','2028090fycnwx','5561216cKxJsA','\x20--profile\x20','profile','10tzsCDH','execute','site','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','Login\x20via\x20OAuth\x20(opens\x20browser)','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','✓\x20Authentication\x20successful\x20(User:\x20','log','22cAbtrK','\x20(profile:\x20','access_token','getUserInfo','Authenticating\x20via\x20OAuth\x20for\x20site:\x20','auth:login','green','Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.','us01','\x20\x20tdx','38838DggSOM','Opening\x20browser\x20for\x20authentication...','jobs','/oauth/authorize','✓\x20Profile\x20\x27','3219644FZaxce','logLevel','ERROR','Login\x20cancelled'];a8_0x1148=function(){return _0x1a69b9;};return a8_0x1148();}import{promptSiteSelection}from'../core/constants.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a8_0x5501(_0x51fbb9,_0x58f031){_0x51fbb9=_0x51fbb9-0x73;const _0x114869=a8_0x1148();let _0x550196=_0x114869[_0x51fbb9];return _0x550196;}import a8_0x458a20 from'chalk';export async function runOAuthLoginFlow(_0x24b455,_0xa4cd10,_0x2a0279){const _0x48b380=a8_0x5501;if(!isOAuthSupported(_0x24b455))throw new Error('OAuth\x20login\x20is\x20not\x20yet\x20available\x20for\x20site:\x20'+_0x24b455+'.\x20'+_0x48b380(0x8f)+_0x48b380(0x7d));const _0x30235d=await isKeychainAvailable();if(!_0x30235d)throw new Error(_0x48b380(0x8e)+'Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.');const _0x257da6=getConsoleUrl(_0x24b455);console['log'](_0x48b380(0x81)),console[_0x48b380(0x75)]('\x20\x20'+_0x257da6+_0x48b380(0x83)),console['log'](_0x48b380(0x99));const _0x2010f5=await startOAuthFlow(_0x24b455);console[_0x48b380(0x75)]('Validating\x20OAuth\x20tokens...');const _0x4798ac=TDX['create']({'site':_0x24b455,'accessToken':_0x2010f5[_0x48b380(0x78)],'logLevel':_0x2a0279??LogLevel[_0x48b380(0x87)]}),_0x3f546b=await _0x4798ac[_0x48b380(0x82)][_0x48b380(0x79)]();console['log'](a8_0x458a20[_0x48b380(0x7c)](_0x48b380(0x74)+_0x3f546b['email']+')')),await saveOAuthTokens(_0x2010f5,_0xa4cd10),console['log'](_0x48b380(0x8a)+(_0xa4cd10?_0x48b380(0x77)+_0xa4cd10+')':''));if(_0xa4cd10){const _0x37d879={'site':_0x24b455};saveProfileToUserConfig(_0xa4cd10,_0x37d879),console[_0x48b380(0x75)](_0x48b380(0x84)+_0xa4cd10+'\x27\x20registered');}const _0x5ee2b9=_0xa4cd10?_0x48b380(0x94)+_0xa4cd10:'';console[_0x48b380(0x75)](),console[_0x48b380(0x75)](_0x48b380(0x73)),console['log'](_0x48b380(0x7f)+_0x5ee2b9+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x48b380(0x75)](_0x48b380(0x7f)+_0x5ee2b9+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases');}export class AuthLoginCommand extends BaseCommand{['name']=a8_0x305239(0x7b);[a8_0x305239(0x90)]=a8_0x305239(0x9a);async[a8_0x305239(0x97)](_0x1ae9ee){const _0x5a02f1=a8_0x305239,{options:_0xd5179d}=_0x1ae9ee,_0xcece3b=_0xd5179d[_0x5a02f1(0x95)];console[_0x5a02f1(0x75)](a8_0x458a20['bold'](_0x5a02f1(0x8b)));const _0x2aa8f0=_0xd5179d[_0x5a02f1(0x98)]||_0x5a02f1(0x7e),_0x29a9ea=await promptSiteSelection(_0x2aa8f0,_0xcece3b,_0x5a02f1(0x88));if(!_0x29a9ea)return 0x1;const _0x4de02d=resolveSite(_0x29a9ea);return console['log'](_0x5a02f1(0x7a)+_0x4de02d),await runOAuthLoginFlow(_0x4de02d,_0xcece3b,_0xd5179d[_0x5a02f1(0x86)]??LogLevel[_0x5a02f1(0x87)]),0x0;}}
1
+ const a8_0x46958c=a8_0xd147;function a8_0x5d1e(){const _0x51d062=['Opening\x20browser\x20for\x20authentication...','1669927jTtaUu','description','Validating\x20OAuth\x20tokens...','Authenticating\x20via\x20OAuth\x20for\x20site:\x20','209450PETlBG','✓\x20Authentication\x20successful\x20(User:\x20','179930tMVDVK','1263006hUPwyi','\x20(profile:\x20','/oauth/authorize','us01','✓\x20Profile\x20\x27','jobs','log','System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20','73756JraksU','name','email','103380sbLQkF','\x20\x20tdx','OAuth\x20is\x20currently\x20supported\x20on\x20dev-us01\x20and\x20dev-eu01\x20only.\x20','9gAEHgl','1535268DOHXjO','\x27\x20registered','tdx:\x20auth\x20login','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','site','Login\x20via\x20OAuth\x20(opens\x20browser)','ERROR','16VKfiDv','bold','\x20--profile\x20','access_token','profile'];a8_0x5d1e=function(){return _0x51d062;};return a8_0x5d1e();}(function(_0x5237ff,_0x1f5733){const _0x1cf4e8=a8_0xd147,_0x11e71a=_0x5237ff();while(!![]){try{const _0x3edcb8=-parseInt(_0x1cf4e8(0x1f3))/0x1+-parseInt(_0x1cf4e8(0x1ff))/0x2+parseInt(_0x1cf4e8(0x202))/0x3*(parseInt(_0x1cf4e8(0x1fc))/0x4)+parseInt(_0x1cf4e8(0x1f1))/0x5+parseInt(_0x1cf4e8(0x203))/0x6+-parseInt(_0x1cf4e8(0x1ed))/0x7+-parseInt(_0x1cf4e8(0x1e7))/0x8*(-parseInt(_0x1cf4e8(0x1f4))/0x9);if(_0x3edcb8===_0x1f5733)break;else _0x11e71a['push'](_0x11e71a['shift']());}catch(_0x57a0c6){_0x11e71a['push'](_0x11e71a['shift']());}}}(a8_0x5d1e,0x27ef4));import{BaseCommand}from'./command.js';import{resolveSite}from'../core/config.js';function a8_0xd147(_0x28e327,_0x63fb58){_0x28e327=_0x28e327-0x1e6;const _0x5d1edc=a8_0x5d1e();let _0xd147f=_0x5d1edc[_0x28e327];return _0xd147f;}import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{isKeychainAvailable}from'../core/keychain.js';import{saveOAuthTokens}from'../core/oauth-keychain.js';import{startOAuthFlow,isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a8_0x17c295 from'chalk';export async function runOAuthLoginFlow(_0x84f4f8,_0x457064,_0x478f23){const _0x18b80c=a8_0xd147;if(!isOAuthSupported(_0x84f4f8))throw new Error('OAuth\x20login\x20is\x20not\x20yet\x20available\x20for\x20site:\x20'+_0x84f4f8+'.\x20'+_0x18b80c(0x201)+'Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.');const _0x36a100=await isKeychainAvailable();if(!_0x36a100)throw new Error(_0x18b80c(0x1fb)+'Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.');const _0x16e50e=getConsoleUrl(_0x84f4f8);console['log'](_0x18b80c(0x1ec)),console['log']('\x20\x20'+_0x16e50e+_0x18b80c(0x1f6)),console['log'](_0x18b80c(0x206));const _0x5c482f=await startOAuthFlow(_0x84f4f8);console['log'](_0x18b80c(0x1ef));const _0x58845b=TDX['create']({'site':_0x84f4f8,'accessToken':_0x5c482f[_0x18b80c(0x1ea)],'logLevel':_0x478f23??LogLevel[_0x18b80c(0x1e6)]}),_0x3d2f79=await _0x58845b[_0x18b80c(0x1f9)]['getUserInfo']();console['log'](a8_0x17c295['green'](_0x18b80c(0x1f2)+_0x3d2f79[_0x18b80c(0x1fe)]+')')),await saveOAuthTokens(_0x5c482f,_0x457064),console[_0x18b80c(0x1fa)]('✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain'+(_0x457064?_0x18b80c(0x1f5)+_0x457064+')':''));if(_0x457064){const _0x814b1d={'site':_0x84f4f8};saveProfileToUserConfig(_0x457064,_0x814b1d),console[_0x18b80c(0x1fa)](_0x18b80c(0x1f8)+_0x457064+_0x18b80c(0x204));}const _0x596900=_0x457064?_0x18b80c(0x1e9)+_0x457064:'';console[_0x18b80c(0x1fa)](),console[_0x18b80c(0x1fa)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console['log'](_0x18b80c(0x200)+_0x596900+_0x18b80c(0x207)),console['log']('\x20\x20tdx'+_0x596900+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases');}export class AuthLoginCommand extends BaseCommand{[a8_0x46958c(0x1fd)]='auth:login';[a8_0x46958c(0x1ee)]=a8_0x46958c(0x209);async['execute'](_0x4a72c6){const _0x1bd370=a8_0x46958c,{options:_0x237a4f}=_0x4a72c6,_0x2d23d6=_0x237a4f[_0x1bd370(0x1eb)];console[_0x1bd370(0x1fa)](a8_0x17c295[_0x1bd370(0x1e8)](_0x1bd370(0x205)));const _0x9e32fc=_0x237a4f[_0x1bd370(0x208)]||_0x1bd370(0x1f7),_0x1d04ee=await promptSiteSelection(_0x9e32fc,_0x2d23d6,'Login\x20cancelled');if(!_0x1d04ee)return 0x1;const _0x316d7d=resolveSite(_0x1d04ee);return console[_0x1bd370(0x1fa)](_0x1bd370(0x1f0)+_0x316d7d),await runOAuthLoginFlow(_0x316d7d,_0x2d23d6,_0x237a4f['logLevel']??LogLevel['ERROR']),0x0;}}
@@ -1 +1 @@
1
- const a9_0x54c225=a9_0x1ec2;(function(_0x47d91c,_0x45b485){const _0x4f301f=a9_0x1ec2,_0x22b294=_0x47d91c();while(!![]){try{const _0x4e5b24=parseInt(_0x4f301f(0x173))/0x1*(parseInt(_0x4f301f(0x177))/0x2)+-parseInt(_0x4f301f(0x13a))/0x3*(parseInt(_0x4f301f(0x16d))/0x4)+parseInt(_0x4f301f(0x16b))/0x5+-parseInt(_0x4f301f(0x169))/0x6*(-parseInt(_0x4f301f(0x17b))/0x7)+-parseInt(_0x4f301f(0x14e))/0x8*(-parseInt(_0x4f301f(0x148))/0x9)+-parseInt(_0x4f301f(0x15b))/0xa+-parseInt(_0x4f301f(0x145))/0xb*(parseInt(_0x4f301f(0x14b))/0xc);if(_0x4e5b24===_0x45b485)break;else _0x22b294['push'](_0x22b294['shift']());}catch(_0x4c7ab0){_0x22b294['push'](_0x22b294['shift']());}}}(a9_0x5ee9,0xc3eeb));function a9_0x5ee9(){const _0xc84d87=['llm','startChat','stringify','done','404','message','data','targetWebSearchTool','join','llmProject','18nUwwyL','\x0aError:\x20','1128155dtDodC','streamChat','243676WWgrwu','handleChatEvent','execute','log','includes','targetKnowledgeBase','1396491pBYlbH','targetAgent','stream','getDefaultAgent','2EdxwsM','llmAgent','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','chatId','3026247QvLelk','verbose','type','error','args','content','code','\x20\x20Cause:\x20','Create\x20a\x20new\x20chat\x20session','agentId','name','chat','tool_result','Error:\x20','3FdxLnc','Continuing\x20chat:\x20','\x0aStack\x20trace:','streamChatJsonl','chat-create','--agent\x20flag','Chat\x20session:\x20','context','projectId','resolveProjectId','Error:\x20Chat\x20session\x20\x27','23060477YbrfZr','string','tool','387BEzSLn','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','description','12TNqOhg','Using\x20cached\x20default\x20agent:\x20','resolveAgentId','35096XxezaA','write','Resolving\x20project\x20\x27','slice','metadata','agent','functionName','cause','session\x20context','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','\x27\x20not\x20found','Using\x20agent\x20from\x20','stack','1478610xlksxz','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','tool_call','stdout'];a9_0x5ee9=function(){return _0xc84d87;};return a9_0x5ee9();}function a9_0x1ec2(_0x59d1c3,_0x488c15){_0x59d1c3=_0x59d1c3-0x137;const _0x5ee977=a9_0x5ee9();let _0x1ec23f=_0x5ee977[_0x59d1c3];return _0x1ec23f;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x276c45,_0x3baed5){const _0x1d493d=a9_0x1ec2;if(_0x276c45 instanceof SDKError)console['error'](_0x1d493d(0x139)+_0x276c45['message']),_0x3baed5[_0x1d493d(0x17c)]&&(_0x276c45[_0x1d493d(0x155)]&&console[_0x1d493d(0x17e)](_0x1d493d(0x182)+_0x276c45['cause']),_0x276c45[_0x1d493d(0x15a)]&&(console[_0x1d493d(0x17e)](_0x1d493d(0x13c)),console['error'](_0x276c45[_0x1d493d(0x15a)])));else throw _0x276c45;}async function resolveAgentId(_0x14eec3,_0x57d851,_0x52336d,_0x3ad2a4,_0x3dea70){const _0x42879b=a9_0x1ec2,_0x523ea0=_0x57d851||_0x52336d;if(_0x523ea0){const {projectName:_0xe1e25b,agentName:_0x52895b}=parseAgentRef(_0x523ea0),_0x4f95d9=_0x52895b||_0x523ea0,_0x63c232=_0x52895b?_0xe1e25b:_0x3ad2a4;if(!_0x63c232)throw new Error(_0x42879b(0x149));if(_0x3dea70){const _0x258702=_0x57d851?_0x42879b(0x13f):_0x42879b(0x156);console['error'](_0x42879b(0x159)+_0x258702+':\x20'+_0x63c232+'/'+_0x4f95d9);}const _0x57e5fd=await withSpinner(_0x42879b(0x150)+_0x63c232+'\x27...',()=>_0x14eec3[_0x42879b(0x15f)][_0x42879b(0x143)](_0x63c232),{'verbose':_0x3dea70}),_0x4ae7f5=await withSpinner('Resolving\x20agent\x20\x27'+_0x4f95d9+'\x27...',()=>_0x14eec3[_0x42879b(0x15f)][_0x42879b(0x14d)](_0x4f95d9,_0x57e5fd[_0x42879b(0x165)]),{'verbose':_0x3dea70});return _0x4ae7f5['data'];}else{const _0x4ba832=_0x14eec3[_0x42879b(0x15f)][_0x42879b(0x176)]();if(_0x4ba832)return _0x3dea70&&console[_0x42879b(0x17e)](_0x42879b(0x14c)+_0x4ba832[_0x42879b(0x185)]),_0x4ba832['id'];const _0x310082=await withSpinner('Getting\x20default\x20agent...',()=>_0x14eec3[_0x42879b(0x15f)]['getOrCreateDefaultAgent']('claude-4.5-haiku',0x0),{'verbose':_0x3dea70});return _0x310082[_0x42879b(0x165)]['id'];}}export class ChatCommand extends BaseCommand{['name']=a9_0x54c225(0x137);[a9_0x54c225(0x14a)]=a9_0x54c225(0x179);['validate'](_0x50deeb){const _0xde8a41=a9_0x54c225,_0x4f7ad7=_0x50deeb[_0xde8a41(0x17f)][_0xde8a41(0x167)]('\x20');if(!_0x4f7ad7)return _0xde8a41(0x157);return undefined;}async['streamChat'](_0x4273d2,_0x8a3a8c,_0xdac451,_0x4cea92,_0x4ef627){const _0x39c021=a9_0x54c225;for await(const _0x334fc8 of _0x4273d2[_0x39c021(0x15f)][_0x39c021(0x137)](_0x8a3a8c,{'agentId':_0xdac451,'chatId':_0x4cea92})){if(_0x334fc8['type']==='metadata'){const _0x8440d4=_0x334fc8['data'][_0x39c021(0x17a)];saveLastChatId(_0x8440d4),_0x4ef627&&console[_0x39c021(0x17e)](_0x39c021(0x140)+_0x8440d4);}else _0x334fc8[_0x39c021(0x17d)]==='event'&&this[_0x39c021(0x16e)](_0x334fc8[_0x39c021(0x165)]);}}async[a9_0x54c225(0x13d)](_0x4e3de0,_0x49156c,_0x4e86af,_0xd8db23){const _0x4f2d0e=a9_0x54c225,_0x394d19=_0x4e3de0[_0x4f2d0e(0x141)]['site'];let _0x491870=![];for await(const _0x21c014 of _0x4e3de0[_0x4f2d0e(0x15f)][_0x4f2d0e(0x137)](_0x49156c,{'agentId':_0x4e86af,'chatId':_0xd8db23})){if(_0x21c014[_0x4f2d0e(0x17d)]==='metadata'){const _0x2268f3=_0x21c014['data'];saveLastChatId(_0x2268f3['chatId']);const _0x8d3354=_0x2268f3[_0x4f2d0e(0x142)]&&_0x2268f3[_0x4f2d0e(0x184)]?getLLMConversationUrl(_0x394d19,_0x2268f3[_0x4f2d0e(0x142)],_0x2268f3[_0x4f2d0e(0x184)],_0x2268f3['chatId']):undefined;console[_0x4f2d0e(0x170)](JSON[_0x4f2d0e(0x161)]({'type':_0x4f2d0e(0x152),'data':{'chatId':_0x2268f3[_0x4f2d0e(0x17a)],'agentId':_0x2268f3[_0x4f2d0e(0x184)],'consoleUrl':_0x8d3354}})),_0x491870=!![];}else{if(_0x21c014[_0x4f2d0e(0x17d)]==='event'){!_0x491870&&_0xd8db23&&(console[_0x4f2d0e(0x170)](JSON[_0x4f2d0e(0x161)]({'type':'metadata','data':{'chatId':_0xd8db23}})),_0x491870=!![]);const _0x587c98=_0x21c014[_0x4f2d0e(0x165)];if('content'in _0x587c98)console[_0x4f2d0e(0x170)](JSON[_0x4f2d0e(0x161)]({'type':_0x4f2d0e(0x180),'data':{'content':_0x587c98[_0x4f2d0e(0x180)]}}));else{if(_0x4f2d0e(0x15d)in _0x587c98){const _0x46e160=_0x587c98[_0x4f2d0e(0x15d)];console[_0x4f2d0e(0x170)](JSON[_0x4f2d0e(0x161)]({'type':_0x4f2d0e(0x15d),'data':{'id':_0x46e160['id'],'name':_0x46e160[_0x4f2d0e(0x154)],'target':_0x46e160[_0x4f2d0e(0x172)]?.[_0x4f2d0e(0x185)]||_0x46e160[_0x4f2d0e(0x174)]?.[_0x4f2d0e(0x185)]||_0x46e160[_0x4f2d0e(0x166)]?.[_0x4f2d0e(0x185)]||_0x46e160['targetFunction']}}));}else{if(_0x4f2d0e(0x147)in _0x587c98)console[_0x4f2d0e(0x170)](JSON[_0x4f2d0e(0x161)]({'type':_0x4f2d0e(0x138),'data':{'id':_0x587c98[_0x4f2d0e(0x147)]['id'],'name':_0x587c98[_0x4f2d0e(0x147)][_0x4f2d0e(0x154)],'result':typeof _0x587c98[_0x4f2d0e(0x147)][_0x4f2d0e(0x180)]===_0x4f2d0e(0x146)?_0x587c98[_0x4f2d0e(0x147)][_0x4f2d0e(0x180)][_0x4f2d0e(0x151)](0x0,0x1f4):''}}));else _0x4f2d0e(0x17e)in _0x587c98&&console[_0x4f2d0e(0x170)](JSON['stringify']({'type':'error','data':{'error':_0x587c98[_0x4f2d0e(0x17e)]}}));}}}}}console[_0x4f2d0e(0x170)](JSON[_0x4f2d0e(0x161)]({'type':_0x4f2d0e(0x162)}));}async[a9_0x54c225(0x16f)](_0x3546b7){const _0x349709=a9_0x54c225,{options:_0x49782f,args:_0x8bd23d,tdx:_0x2d0eef}=_0x3546b7,_0x2b7962=_0x8bd23d[_0x349709(0x167)]('\x20'),_0x1241b0=_0x49782f,_0x452ea0=_0x1241b0[_0x349709(0x153)],_0x2831b0=_0x1241b0[_0x349709(0x178)],_0x57dc18=_0x1241b0[_0x349709(0x168)],_0x3b5024=_0x1241b0['new'],_0x2de55a=_0x1241b0[_0x349709(0x17a)],_0x532384=_0x1241b0[_0x349709(0x175)];if(_0x3b5024&&_0x2de55a)return console[_0x349709(0x17e)]('Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together'),0x1;try{let _0x317df2,_0x4531f9;if(_0x2de55a)_0x4531f9=_0x2de55a;else!_0x3b5024&&(_0x4531f9=loadLastChatId(),_0x4531f9&&_0x49782f[_0x349709(0x17c)]&&console['error'](_0x349709(0x13b)+_0x4531f9));!_0x2de55a&&(_0x3b5024||!_0x4531f9)&&(_0x317df2=await resolveAgentId(_0x2d0eef,_0x452ea0,_0x2831b0,_0x57dc18,_0x49782f[_0x349709(0x17c)]));const _0x5ad1f2=_0x532384?(_0x26df19,_0x52fcf9,_0x268cda)=>this[_0x349709(0x13d)](_0x2d0eef,_0x26df19,_0x52fcf9,_0x268cda):(_0x5a3617,_0x291fca,_0x255e03)=>this[_0x349709(0x16c)](_0x2d0eef,_0x5a3617,_0x291fca,_0x255e03,_0x49782f[_0x349709(0x17c)]);try{await _0x5ad1f2(_0x2b7962,_0x317df2,_0x4531f9);}catch(_0x5ce389){const _0x435e9d=_0x5ce389 instanceof SDKError&&_0x5ce389[_0x349709(0x181)]===ErrorCode['CHAT_NOT_FOUND']||_0x5ce389 instanceof Error&&_0x5ce389[_0x349709(0x164)][_0x349709(0x171)](_0x349709(0x163));if(_0x435e9d&&_0x2de55a)return console['error'](_0x349709(0x144)+_0x2de55a+_0x349709(0x158)),0x1;if(_0x435e9d)_0x49782f[_0x349709(0x17c)]&&console['error']('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x317df2&&(_0x317df2=await resolveAgentId(_0x2d0eef,_0x452ea0,_0x2831b0,_0x57dc18,_0x49782f[_0x349709(0x17c)])),await _0x5ad1f2(_0x2b7962,_0x317df2,undefined);else throw _0x5ce389;}return!_0x532384&&console['log'](),0x0;}catch(_0x15a08c){return console['error'](),handleSDKError(_0x15a08c,_0x49782f),0x1;}}[a9_0x54c225(0x16e)](_0x230be1){const _0x16616f=a9_0x54c225;if(_0x16616f(0x180)in _0x230be1)process[_0x16616f(0x15e)][_0x16616f(0x14f)](_0x230be1[_0x16616f(0x180)]);else'error'in _0x230be1&&console['error'](_0x16616f(0x16a)+_0x230be1[_0x16616f(0x17e)]);}}export class ChatCreateCommand extends BaseCommand{[a9_0x54c225(0x185)]=a9_0x54c225(0x13e);[a9_0x54c225(0x14a)]=a9_0x54c225(0x183);['validate'](_0x1cc0d2){const _0x4793a3=a9_0x54c225,_0x1cc0b2=_0x1cc0d2['options'],_0x42684f=_0x1cc0b2[_0x4793a3(0x153)],_0x3ec941=_0x1cc0b2['llmAgent'];if(!_0x42684f&&!_0x3ec941)return _0x4793a3(0x15c);return undefined;}async[a9_0x54c225(0x16f)](_0x5d7466){const _0x230b91=a9_0x54c225,{options:_0x4be4d0,tdx:_0xedccb4}=_0x5d7466,_0x14119f=_0x4be4d0,_0x1a4d97=_0x14119f[_0x230b91(0x153)],_0x33b01c=_0x14119f[_0x230b91(0x178)],_0x2243b0=_0x14119f[_0x230b91(0x168)];try{const _0x237bda=await resolveAgentId(_0xedccb4,_0x1a4d97,_0x33b01c,_0x2243b0,_0x4be4d0['verbose']),_0x58fef5=await _0xedccb4[_0x230b91(0x15f)][_0x230b91(0x160)](_0x237bda);return saveLastChatId(_0x58fef5['id']),console[_0x230b91(0x170)](JSON[_0x230b91(0x161)]({'chatId':_0x58fef5['id'],'agentId':_0x237bda})),0x0;}catch(_0x152ecd){return handleSDKError(_0x152ecd,_0x4be4d0),0x1;}}}
1
+ const a9_0x5092e1=a9_0x5778;function a9_0x3c22(){const _0x6a5e47=['description','180051mxsTCq','getDefaultAgent','type','5596514MypMxI','tool','execute','557123wUZBJh','tool_call','targetWebSearchTool','string','stream','error','resolveProjectId','llm','12XXUsHR','\x0aStack\x20trace:','streamChatJsonl','event','new','done','\x27\x20not\x20found','site','Continuing\x20chat:\x20','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','24JjmoRR','join','handleChatEvent','chat','--agent\x20flag','9550qMokIT','llmProject','chatId','Resolving\x20project\x20\x27','cause','write','data','streamChat','validate','startChat','message','Error:\x20Chat\x20session\x20\x27','chat-create','log','78140oIhgbG','1013436VpctFr','stringify','args','24xKRZgK','tool_result','Using\x20cached\x20default\x20agent:\x20','resolveAgentId','5517VDvWgf','\x20\x20Cause:\x20','Resolving\x20agent\x20\x27','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','projectId','claude-4.5-haiku','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','slice','options','Getting\x20default\x20agent...','targetAgent','includes','verbose','404','content','stdout','targetKnowledgeBase','name','functionName','metadata','\x27...','stack','6QBViAO','agentId','llmAgent','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','context','Using\x20agent\x20from\x20','agent','627346dcpdAY'];a9_0x3c22=function(){return _0x6a5e47;};return a9_0x3c22();}(function(_0x303def,_0x1282d3){const _0x3f8d52=a9_0x5778,_0x1e65a2=_0x303def();while(!![]){try{const _0x264f06=-parseInt(_0x3f8d52(0xec))/0x1+-parseInt(_0x3f8d52(0xe5))/0x2*(-parseInt(_0x3f8d52(0xee))/0x3)+parseInt(_0x3f8d52(0xaa))/0x4*(parseInt(_0x3f8d52(0xc7))/0x5)+parseInt(_0x3f8d52(0xc8))/0x6+-parseInt(_0x3f8d52(0xf4))/0x7*(-parseInt(_0x3f8d52(0xb4))/0x8)+parseInt(_0x3f8d52(0xcf))/0x9*(-parseInt(_0x3f8d52(0xb9))/0xa)+parseInt(_0x3f8d52(0xf1))/0xb*(parseInt(_0x3f8d52(0xcb))/0xc);if(_0x264f06===_0x1282d3)break;else _0x1e65a2['push'](_0x1e65a2['shift']());}catch(_0x591800){_0x1e65a2['push'](_0x1e65a2['shift']());}}}(a9_0x3c22,0x6b463));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0xe839c,_0x494a13){const _0xb854a4=a9_0x5778;if(_0xe839c instanceof SDKError)console[_0xb854a4(0xa7)]('Error:\x20'+_0xe839c[_0xb854a4(0xc3)]),_0x494a13['verbose']&&(_0xe839c[_0xb854a4(0xbd)]&&console[_0xb854a4(0xa7)](_0xb854a4(0xd0)+_0xe839c[_0xb854a4(0xbd)]),_0xe839c[_0xb854a4(0xe4)]&&(console[_0xb854a4(0xa7)](_0xb854a4(0xab)),console[_0xb854a4(0xa7)](_0xe839c[_0xb854a4(0xe4)])));else throw _0xe839c;}function a9_0x5778(_0x25d352,_0x321b5f){_0x25d352=_0x25d352-0xa3;const _0x3c223e=a9_0x3c22();let _0x5778bd=_0x3c223e[_0x25d352];return _0x5778bd;}async function resolveAgentId(_0xf07cd2,_0xd4cfd2,_0x215795,_0x115f4a,_0x4c3e14){const _0x2b164f=a9_0x5778,_0x7f0d72=_0xd4cfd2||_0x215795;if(_0x7f0d72){const {projectName:_0x5cf37e,agentName:_0x3f61e1}=parseAgentRef(_0x7f0d72),_0x3f9de9=_0x3f61e1||_0x7f0d72,_0x42a6e9=_0x3f61e1?_0x5cf37e:_0x115f4a;if(!_0x42a6e9)throw new Error(_0x2b164f(0xb3));if(_0x4c3e14){const _0x522807=_0xd4cfd2?_0x2b164f(0xb8):'session\x20context';console[_0x2b164f(0xa7)](_0x2b164f(0xea)+_0x522807+':\x20'+_0x42a6e9+'/'+_0x3f9de9);}const _0x5e9f20=await withSpinner(_0x2b164f(0xbc)+_0x42a6e9+_0x2b164f(0xe3),()=>_0xf07cd2[_0x2b164f(0xa9)][_0x2b164f(0xa8)](_0x42a6e9),{'verbose':_0x4c3e14}),_0x214ed9=await withSpinner(_0x2b164f(0xd1)+_0x3f9de9+_0x2b164f(0xe3),()=>_0xf07cd2[_0x2b164f(0xa9)][_0x2b164f(0xce)](_0x3f9de9,_0x5e9f20[_0x2b164f(0xbf)]),{'verbose':_0x4c3e14});return _0x214ed9[_0x2b164f(0xbf)];}else{const _0x271702=_0xf07cd2['llm'][_0x2b164f(0xef)]();if(_0x271702)return _0x4c3e14&&console[_0x2b164f(0xa7)](_0x2b164f(0xcd)+_0x271702[_0x2b164f(0xe0)]),_0x271702['id'];const _0x34acb6=await withSpinner(_0x2b164f(0xd8),()=>_0xf07cd2[_0x2b164f(0xa9)]['getOrCreateDefaultAgent'](_0x2b164f(0xd4),0x0),{'verbose':_0x4c3e14});return _0x34acb6['data']['id'];}}export class ChatCommand extends BaseCommand{[a9_0x5092e1(0xe0)]=a9_0x5092e1(0xb7);[a9_0x5092e1(0xed)]=a9_0x5092e1(0xd2);[a9_0x5092e1(0xc1)](_0x4e197e){const _0x48e98f=a9_0x5092e1,_0x17932b=_0x4e197e[_0x48e98f(0xca)]['join']('\x20');if(!_0x17932b)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a9_0x5092e1(0xc0)](_0x1967db,_0x4f1b2f,_0x43013c,_0x5a517b,_0x3b06b7){const _0x38c2c7=a9_0x5092e1;for await(const _0x20718d of _0x1967db['llm'][_0x38c2c7(0xb7)](_0x4f1b2f,{'agentId':_0x43013c,'chatId':_0x5a517b})){if(_0x20718d[_0x38c2c7(0xf0)]===_0x38c2c7(0xe2)){const _0x3e3ed3=_0x20718d[_0x38c2c7(0xbf)][_0x38c2c7(0xbb)];saveLastChatId(_0x3e3ed3),_0x3b06b7&&console[_0x38c2c7(0xa7)]('Chat\x20session:\x20'+_0x3e3ed3);}else _0x20718d[_0x38c2c7(0xf0)]==='event'&&this[_0x38c2c7(0xb6)](_0x20718d[_0x38c2c7(0xbf)]);}}async[a9_0x5092e1(0xac)](_0x548882,_0x14aa31,_0x453cba,_0x11b0d4){const _0x58a140=a9_0x5092e1,_0xef8037=_0x548882[_0x58a140(0xe9)][_0x58a140(0xb1)];let _0xb984ce=![];for await(const _0x59b034 of _0x548882['llm'][_0x58a140(0xb7)](_0x14aa31,{'agentId':_0x453cba,'chatId':_0x11b0d4})){if(_0x59b034[_0x58a140(0xf0)]===_0x58a140(0xe2)){const _0x3e69ff=_0x59b034[_0x58a140(0xbf)];saveLastChatId(_0x3e69ff['chatId']);const _0x4cbb93=_0x3e69ff[_0x58a140(0xd3)]&&_0x3e69ff[_0x58a140(0xe6)]?getLLMConversationUrl(_0xef8037,_0x3e69ff[_0x58a140(0xd3)],_0x3e69ff['agentId'],_0x3e69ff[_0x58a140(0xbb)]):undefined;console[_0x58a140(0xc6)](JSON['stringify']({'type':'metadata','data':{'chatId':_0x3e69ff['chatId'],'agentId':_0x3e69ff[_0x58a140(0xe6)],'consoleUrl':_0x4cbb93}})),_0xb984ce=!![];}else{if(_0x59b034[_0x58a140(0xf0)]===_0x58a140(0xad)){!_0xb984ce&&_0x11b0d4&&(console[_0x58a140(0xc6)](JSON[_0x58a140(0xc9)]({'type':_0x58a140(0xe2),'data':{'chatId':_0x11b0d4}})),_0xb984ce=!![]);const _0x4c1215=_0x59b034['data'];if(_0x58a140(0xdd)in _0x4c1215)console[_0x58a140(0xc6)](JSON[_0x58a140(0xc9)]({'type':'content','data':{'content':_0x4c1215[_0x58a140(0xdd)]}}));else{if(_0x58a140(0xa3)in _0x4c1215){const _0x23b5ed=_0x4c1215[_0x58a140(0xa3)];console[_0x58a140(0xc6)](JSON[_0x58a140(0xc9)]({'type':_0x58a140(0xa3),'data':{'id':_0x23b5ed['id'],'name':_0x23b5ed['functionName'],'target':_0x23b5ed[_0x58a140(0xdf)]?.['name']||_0x23b5ed[_0x58a140(0xd9)]?.[_0x58a140(0xe0)]||_0x23b5ed[_0x58a140(0xa4)]?.[_0x58a140(0xe0)]||_0x23b5ed['targetFunction']}}));}else{if(_0x58a140(0xf2)in _0x4c1215)console[_0x58a140(0xc6)](JSON[_0x58a140(0xc9)]({'type':_0x58a140(0xcc),'data':{'id':_0x4c1215[_0x58a140(0xf2)]['id'],'name':_0x4c1215[_0x58a140(0xf2)][_0x58a140(0xe1)],'result':typeof _0x4c1215[_0x58a140(0xf2)][_0x58a140(0xdd)]===_0x58a140(0xa5)?_0x4c1215[_0x58a140(0xf2)]['content'][_0x58a140(0xd6)](0x0,0x1f4):''}}));else _0x58a140(0xa7)in _0x4c1215&&console[_0x58a140(0xc6)](JSON[_0x58a140(0xc9)]({'type':_0x58a140(0xa7),'data':{'error':_0x4c1215[_0x58a140(0xa7)]}}));}}}}}console[_0x58a140(0xc6)](JSON[_0x58a140(0xc9)]({'type':_0x58a140(0xaf)}));}async[a9_0x5092e1(0xf3)](_0x3100ef){const _0x15664d=a9_0x5092e1,{options:_0x2b983f,args:_0x19ed8a,tdx:_0x11f52c}=_0x3100ef,_0x27cf1d=_0x19ed8a[_0x15664d(0xb5)]('\x20'),_0x3af230=_0x2b983f,_0x1ec833=_0x3af230[_0x15664d(0xeb)],_0x450cb6=_0x3af230[_0x15664d(0xe7)],_0x1bf503=_0x3af230[_0x15664d(0xba)],_0x4083a8=_0x3af230[_0x15664d(0xae)],_0x438a69=_0x3af230['chatId'],_0x22cbaa=_0x3af230[_0x15664d(0xa6)];if(_0x4083a8&&_0x438a69)return console[_0x15664d(0xa7)]('Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together'),0x1;try{let _0x5b37cd,_0x40163a;if(_0x438a69)_0x40163a=_0x438a69;else!_0x4083a8&&(_0x40163a=loadLastChatId(),_0x40163a&&_0x2b983f[_0x15664d(0xdb)]&&console[_0x15664d(0xa7)](_0x15664d(0xb2)+_0x40163a));!_0x438a69&&(_0x4083a8||!_0x40163a)&&(_0x5b37cd=await resolveAgentId(_0x11f52c,_0x1ec833,_0x450cb6,_0x1bf503,_0x2b983f[_0x15664d(0xdb)]));const _0x1a84d8=_0x22cbaa?(_0x452593,_0x2ffeaa,_0x4a4cfc)=>this[_0x15664d(0xac)](_0x11f52c,_0x452593,_0x2ffeaa,_0x4a4cfc):(_0x2158af,_0xe5c52b,_0x2eb340)=>this['streamChat'](_0x11f52c,_0x2158af,_0xe5c52b,_0x2eb340,_0x2b983f[_0x15664d(0xdb)]);try{await _0x1a84d8(_0x27cf1d,_0x5b37cd,_0x40163a);}catch(_0x41700a){const _0x195a64=_0x41700a instanceof SDKError&&_0x41700a['code']===ErrorCode['CHAT_NOT_FOUND']||_0x41700a instanceof Error&&_0x41700a['message'][_0x15664d(0xda)](_0x15664d(0xdc));if(_0x195a64&&_0x438a69)return console['error'](_0x15664d(0xc4)+_0x438a69+_0x15664d(0xb0)),0x1;if(_0x195a64)_0x2b983f[_0x15664d(0xdb)]&&console[_0x15664d(0xa7)](_0x15664d(0xe8)),!_0x5b37cd&&(_0x5b37cd=await resolveAgentId(_0x11f52c,_0x1ec833,_0x450cb6,_0x1bf503,_0x2b983f['verbose'])),await _0x1a84d8(_0x27cf1d,_0x5b37cd,undefined);else throw _0x41700a;}return!_0x22cbaa&&console[_0x15664d(0xc6)](),0x0;}catch(_0x34ec28){return console[_0x15664d(0xa7)](),handleSDKError(_0x34ec28,_0x2b983f),0x1;}}[a9_0x5092e1(0xb6)](_0x28a275){const _0x2277dd=a9_0x5092e1;if(_0x2277dd(0xdd)in _0x28a275)process[_0x2277dd(0xde)][_0x2277dd(0xbe)](_0x28a275[_0x2277dd(0xdd)]);else _0x2277dd(0xa7)in _0x28a275&&console[_0x2277dd(0xa7)]('\x0aError:\x20'+_0x28a275['error']);}}export class ChatCreateCommand extends BaseCommand{[a9_0x5092e1(0xe0)]=a9_0x5092e1(0xc5);[a9_0x5092e1(0xed)]='Create\x20a\x20new\x20chat\x20session';[a9_0x5092e1(0xc1)](_0x3cd906){const _0x27d417=a9_0x5092e1,_0x1a8fcd=_0x3cd906[_0x27d417(0xd7)],_0x1ede94=_0x1a8fcd[_0x27d417(0xeb)],_0x4c1ad1=_0x1a8fcd['llmAgent'];if(!_0x1ede94&&!_0x4c1ad1)return _0x27d417(0xd5);return undefined;}async[a9_0x5092e1(0xf3)](_0x5128aa){const _0x56bbd9=a9_0x5092e1,{options:_0x26226b,tdx:_0x2df923}=_0x5128aa,_0x24b11f=_0x26226b,_0x430502=_0x24b11f['agent'],_0x2a106b=_0x24b11f['llmAgent'],_0x11ae95=_0x24b11f[_0x56bbd9(0xba)];try{const _0x4c9be0=await resolveAgentId(_0x2df923,_0x430502,_0x2a106b,_0x11ae95,_0x26226b['verbose']),_0x35f84d=await _0x2df923[_0x56bbd9(0xa9)][_0x56bbd9(0xc2)](_0x4c9be0);return saveLastChatId(_0x35f84d['id']),console[_0x56bbd9(0xc6)](JSON[_0x56bbd9(0xc9)]({'chatId':_0x35f84d['id'],'agentId':_0x4c9be0})),0x0;}catch(_0x5e95ef){return handleSDKError(_0x5e95ef,_0x26226b),0x1;}}}