@treasuredata/tdx 2026.6.1 → 2026.6.3

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 (241) 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/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-command.js.map +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.js +1 -1
  38. package/dist/commands/profile-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/schedule-command.js +1 -1
  42. package/dist/commands/segment-command.js +1 -1
  43. package/dist/commands/segment-create-command.js +1 -1
  44. package/dist/commands/segment-fields-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/table-deleted.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/work-command.js +1 -1
  60. package/dist/commands/workflow-command.d.ts +2 -2
  61. package/dist/commands/workflow-command.d.ts.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/commands/workflow-command.js.map +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.d.ts +23 -1
  116. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/client/workflow-client.js.map +1 -1
  119. package/dist/sdk/connection-validator.js +1 -1
  120. package/dist/sdk/connection.js +1 -1
  121. package/dist/sdk/delivery.js +1 -1
  122. package/dist/sdk/engage/campaign-pull.js +1 -1
  123. package/dist/sdk/engage/campaign-push.js +1 -1
  124. package/dist/sdk/engage/campaign-validator.js +1 -1
  125. package/dist/sdk/engage/campaign-yaml.js +1 -1
  126. package/dist/sdk/engage/template-pull.js +1 -1
  127. package/dist/sdk/engage/template-push.js +1 -1
  128. package/dist/sdk/engage/template-validator.js +1 -1
  129. package/dist/sdk/engage/template-yaml.js +1 -1
  130. package/dist/sdk/engage/types/campaign-def.js +1 -1
  131. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  132. package/dist/sdk/engage/types/template-schema.js +1 -1
  133. package/dist/sdk/engage.js +1 -1
  134. package/dist/sdk/errors.js +1 -1
  135. package/dist/sdk/index.js +1 -1
  136. package/dist/sdk/io/index.js +1 -1
  137. package/dist/sdk/io/node-filesystem.js +1 -1
  138. package/dist/sdk/job.js +1 -1
  139. package/dist/sdk/journey.js +1 -1
  140. package/dist/sdk/llm/chat-cache.js +1 -1
  141. package/dist/sdk/llm/index.js +1 -1
  142. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  143. package/dist/sdk/llm/model-factors.js +1 -1
  144. package/dist/sdk/llm/user-settings.js +1 -1
  145. package/dist/sdk/personalization.js +1 -1
  146. package/dist/sdk/policy.js +1 -1
  147. package/dist/sdk/query/deleted-table-validation.js +1 -1
  148. package/dist/sdk/query/index.js +1 -1
  149. package/dist/sdk/query/sql-parser.js +1 -1
  150. package/dist/sdk/realtime.js +1 -1
  151. package/dist/sdk/schedule.js +1 -1
  152. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/fields-display.js +1 -1
  154. package/dist/sdk/segment/file-discovery.js +1 -1
  155. package/dist/sdk/segment/journey-utils.js +1 -1
  156. package/dist/sdk/segment/journey-validator.js +1 -1
  157. package/dist/sdk/segment/journey-yaml.js +1 -1
  158. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  159. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/pull-workflow.js +1 -1
  161. package/dist/sdk/segment/push-recovery.js +1 -1
  162. package/dist/sdk/segment/push-workflow.js +1 -1
  163. package/dist/sdk/segment/resolution-context.js +1 -1
  164. package/dist/sdk/segment/segment-path-parser.js +1 -1
  165. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  166. package/dist/sdk/segment/segment-validator.js +1 -1
  167. package/dist/sdk/segment/target-resolution.js +1 -1
  168. package/dist/sdk/segment/tdx-config.js +1 -1
  169. package/dist/sdk/segment/types/activation-schema.js +1 -1
  170. package/dist/sdk/segment/types/journey-def.js +1 -1
  171. package/dist/sdk/segment/types/journey-schema.js +1 -1
  172. package/dist/sdk/segment/types/segment-def.js +1 -1
  173. package/dist/sdk/segment/types/segment-schema.js +1 -1
  174. package/dist/sdk/segment/validate-files.js +1 -1
  175. package/dist/sdk/segment/yaml-validator.js +1 -1
  176. package/dist/sdk/segment.js +1 -1
  177. package/dist/sdk/types/index.js +1 -1
  178. package/dist/sdk/types/progress.js +1 -1
  179. package/dist/sdk/types/workflow.d.ts +1 -1
  180. package/dist/sdk/types/workflow.d.ts.map +1 -1
  181. package/dist/sdk/types/workspace.js +1 -1
  182. package/dist/sdk/user.js +1 -1
  183. package/dist/sdk/util/format-detector.js +1 -1
  184. package/dist/sdk/util/formatters.js +1 -1
  185. package/dist/sdk/util/index.js +1 -1
  186. package/dist/sdk/util/paginate.js +1 -1
  187. package/dist/sdk/util/tree-formatter.js +1 -1
  188. package/dist/sdk/workflow/archive-validation.js +1 -1
  189. package/dist/sdk/workflow/clone-workflow.js +1 -1
  190. package/dist/sdk/workflow/index.d.ts +23 -2
  191. package/dist/sdk/workflow/index.d.ts.map +1 -1
  192. package/dist/sdk/workflow/index.js +1 -1
  193. package/dist/sdk/workflow/index.js.map +1 -1
  194. package/dist/sdk/workflow/pull-workflow.js +1 -1
  195. package/dist/sdk/workflow/push-workflow.d.ts +4 -0
  196. package/dist/sdk/workflow/push-workflow.d.ts.map +1 -1
  197. package/dist/sdk/workflow/push-workflow.js +1 -1
  198. package/dist/sdk/workflow/push-workflow.js.map +1 -1
  199. package/dist/sdk/workflow/task-graph.js +1 -1
  200. package/dist/sdk/workflow/tdx-config.js +1 -1
  201. package/dist/sdk/workflow/workflow-utils.js +1 -1
  202. package/dist/sdk/workspace/access-tracker.js +1 -1
  203. package/dist/sdk/workspace/frontmatter.js +1 -1
  204. package/dist/sdk/workspace/git.js +1 -1
  205. package/dist/sdk/workspace/index.js +1 -1
  206. package/dist/sdk/workspace/templates.js +1 -1
  207. package/dist/sdk/workspace/weekly.js +1 -1
  208. package/dist/sdk/workspace/wikilinks.js +1 -1
  209. package/dist/test-utils/command-runner.js +1 -1
  210. package/dist/test-utils/factories.js +1 -1
  211. package/dist/test-utils/fixtures.js +1 -1
  212. package/dist/test-utils/http-mock.js +1 -1
  213. package/dist/test-utils/index.js +1 -1
  214. package/dist/utils/async.js +1 -1
  215. package/dist/utils/colors.js +1 -1
  216. package/dist/utils/diff.js +1 -1
  217. package/dist/utils/file-permissions.js +1 -1
  218. package/dist/utils/file-reader.js +1 -1
  219. package/dist/utils/github-releases.js +1 -1
  220. package/dist/utils/global-cache.js +1 -1
  221. package/dist/utils/json-loader.js +1 -1
  222. package/dist/utils/local-cache.js +1 -1
  223. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  224. package/dist/utils/logger/formatters/index.js +1 -1
  225. package/dist/utils/logger/handlers/console-handler.js +1 -1
  226. package/dist/utils/logger/handlers/file-handler.js +1 -1
  227. package/dist/utils/logger/handlers/index.js +1 -1
  228. package/dist/utils/logger/handlers/null-handler.js +1 -1
  229. package/dist/utils/logger/index.js +1 -1
  230. package/dist/utils/logger/logger.js +1 -1
  231. package/dist/utils/logger/types.js +1 -1
  232. package/dist/utils/option-validation.js +1 -1
  233. package/dist/utils/process.js +1 -1
  234. package/dist/utils/prompt.js +1 -1
  235. package/dist/utils/spinner.js +1 -1
  236. package/dist/utils/sse-parser.js +1 -1
  237. package/dist/utils/string-utils.js +1 -1
  238. package/dist/utils/table-ref-parser.js +1 -1
  239. package/dist/utils/tdx-logger.js +1 -1
  240. package/dist/utils/version-check.js +1 -1
  241. package/package.json +1 -1
@@ -1 +1 @@
1
- const a3_0xc2911b=a3_0x1b4f;(function(_0x4bd81a,_0x238dd7){const _0x1fb7bd=a3_0x1b4f,_0x1d1127=_0x4bd81a();while(!![]){try{const _0x547c15=-parseInt(_0x1fb7bd(0xaf))/0x1+parseInt(_0x1fb7bd(0xb7))/0x2+-parseInt(_0x1fb7bd(0xbb))/0x3*(-parseInt(_0x1fb7bd(0xc1))/0x4)+-parseInt(_0x1fb7bd(0xb1))/0x5+-parseInt(_0x1fb7bd(0xab))/0x6+parseInt(_0x1fb7bd(0xb8))/0x7*(parseInt(_0x1fb7bd(0xb5))/0x8)+parseInt(_0x1fb7bd(0xa4))/0x9;if(_0x547c15===_0x238dd7)break;else _0x1d1127['push'](_0x1d1127['shift']());}catch(_0x334569){_0x1d1127['push'](_0x1d1127['shift']());}}}(a3_0x5cdb,0x8d22c));import{BaseCommand}from'./command.js';function a3_0x5cdb(){const _0x55ec41=['site','664127UossXB','Error:\x20','5245270rrpNoj','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Parent\x20name:\x20','Resolving\x20child\x20segment\x20\x27','32UwuTfv','\x27...','613954dCLTQc','1719592DiFQpz','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','✔\x20Found\x20','54fCDuAu','name','error','Resolved\x20parent\x20ID:\x20','Child\x20name:\x20','resolveParentId','61452zbzmpO','Resolved\x20child\x20ID:\x20','Error:\x20Segment\x20name\x20is\x20required','length','verbose','message','resolveSegmentId','\x20\x20Cause:\x20','16581186beIPVL','execute','Listing\x20activations\x20for\x20segment\x20\x27','description','data','cause','Resolving\x20parent\x20segment\x20\x27','6703296sRIFsG','segment','listActivations'];a3_0x5cdb=function(){return _0x55ec41;};return a3_0x5cdb();}import{SDKError}from'../sdk/index.js';function a3_0x1b4f(_0x5340f5,_0x42a0b0){_0x5340f5=_0x5340f5-0xa3;const _0x5cdbe5=a3_0x5cdb();let _0x1b4f79=_0x5cdbe5[_0x5340f5];return _0x1b4f79;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0xc2911b(0xbc)]='activations';[a3_0xc2911b(0xa7)]='List\x20activations\x20for\x20a\x20segment';async[a3_0xc2911b(0xa5)](_0x5b8c42){const _0x3cbaa4=a3_0xc2911b,{options:_0x2a6fa4,args:_0x534782,tdx:_0x1264b1}=_0x5b8c42;if(_0x534782[_0x3cbaa4(0xc4)]===0x0)return console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xc3)),console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xb9)),0x1;try{const {parentId:_0x136eea,childId:_0x5da37a}=parseSegmentRef(_0x534782[0x0]);if(!_0x5da37a)return console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xb2)),console['error']('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;_0x2a6fa4[_0x3cbaa4(0xc5)]&&(console['error']('Site:\x20'+_0x2a6fa4[_0x3cbaa4(0xae)]),console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xb3)+_0x136eea),console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xbf)+_0x5da37a));const _0x5affc2=await withSpinner(_0x3cbaa4(0xaa)+_0x136eea+_0x3cbaa4(0xb6),()=>_0x1264b1[_0x3cbaa4(0xac)][_0x3cbaa4(0xc0)](_0x136eea),{'verbose':_0x2a6fa4['verbose']}),_0x44fc79=_0x5affc2[_0x3cbaa4(0xa8)];_0x2a6fa4[_0x3cbaa4(0xc5)]&&console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xbe)+_0x44fc79);const _0x4a5ae3=await withSpinner(_0x3cbaa4(0xb4)+_0x5da37a+_0x3cbaa4(0xb6),()=>_0x1264b1[_0x3cbaa4(0xac)][_0x3cbaa4(0xc7)](_0x44fc79,_0x5da37a),{'verbose':_0x2a6fa4[_0x3cbaa4(0xc5)]}),_0x157734=_0x4a5ae3[_0x3cbaa4(0xa8)];_0x2a6fa4[_0x3cbaa4(0xc5)]&&console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xc2)+_0x157734);const _0xc161fd=await withSpinner(_0x3cbaa4(0xa6)+_0x5da37a+'\x27...',()=>_0x1264b1[_0x3cbaa4(0xac)][_0x3cbaa4(0xad)](_0x44fc79,_0x157734),{'verbose':_0x2a6fa4[_0x3cbaa4(0xc5)]}),_0x3ceb98=_0xc161fd[_0x3cbaa4(0xa8)];return console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xba)+_0x3ceb98[_0x3cbaa4(0xc4)]+'\x20activation'+(_0x3ceb98[_0x3cbaa4(0xc4)]!==0x1?'s':'')),await handleSDKOutput(_0x3ceb98,_0x2a6fa4),0x0;}catch(_0x3295df){if(_0x3295df instanceof SDKError)return console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xb0)+_0x3295df[_0x3cbaa4(0xc6)]),_0x3295df['cause']&&console[_0x3cbaa4(0xbd)](_0x3cbaa4(0xa3)+_0x3295df[_0x3cbaa4(0xa9)]),0x1;throw _0x3295df;}}}
1
+ const a3_0x4105c6=a3_0x29d9;(function(_0x30e124,_0x4410f2){const _0x502866=a3_0x29d9,_0xa1f060=_0x30e124();while(!![]){try{const _0x5c964a=-parseInt(_0x502866(0xd6))/0x1+-parseInt(_0x502866(0xe4))/0x2+-parseInt(_0x502866(0xe0))/0x3+-parseInt(_0x502866(0xe1))/0x4*(-parseInt(_0x502866(0xc9))/0x5)+parseInt(_0x502866(0xcc))/0x6+parseInt(_0x502866(0xdb))/0x7+-parseInt(_0x502866(0xda))/0x8*(-parseInt(_0x502866(0xcb))/0x9);if(_0x5c964a===_0x4410f2)break;else _0xa1f060['push'](_0xa1f060['shift']());}catch(_0x2d1d67){_0xa1f060['push'](_0xa1f060['shift']());}}}(a3_0x33fa,0x35c51));function a3_0x29d9(_0x2647c9,_0x544298){_0x2647c9=_0x2647c9-0xc7;const _0x33fa4b=a3_0x33fa();let _0x29d965=_0x33fa4b[_0x2647c9];return _0x29d965;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{['name']=a3_0x4105c6(0xca);[a3_0x4105c6(0xc8)]=a3_0x4105c6(0xd4);async['execute'](_0xf3793){const _0x32d991=a3_0x4105c6,{options:_0xc2d8d8,args:_0x42be00,tdx:_0x1b0a9e}=_0xf3793;if(_0x42be00[_0x32d991(0xce)]===0x0)return console['error'](_0x32d991(0xcd)),console[_0x32d991(0xdd)](_0x32d991(0xd3)),0x1;try{const {parentId:_0x2150ea,childId:_0xe20b9c}=parseSegmentRef(_0x42be00[0x0]);if(!_0xe20b9c)return console[_0x32d991(0xdd)](_0x32d991(0xe3)),console['error'](_0x32d991(0xd3)),0x1;_0xc2d8d8['verbose']&&(console[_0x32d991(0xdd)]('Site:\x20'+_0xc2d8d8[_0x32d991(0xc7)]),console['error'](_0x32d991(0xde)+_0x2150ea),console['error'](_0x32d991(0xdc)+_0xe20b9c));const _0x104780=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2150ea+'\x27...',()=>_0x1b0a9e[_0x32d991(0xd7)][_0x32d991(0xd1)](_0x2150ea),{'verbose':_0xc2d8d8[_0x32d991(0xd2)]}),_0x384d45=_0x104780[_0x32d991(0xd9)];_0xc2d8d8[_0x32d991(0xd2)]&&console[_0x32d991(0xdd)](_0x32d991(0xd8)+_0x384d45);const _0x35a5e4=await withSpinner(_0x32d991(0xd0)+_0xe20b9c+'\x27...',()=>_0x1b0a9e[_0x32d991(0xd7)]['resolveSegmentId'](_0x384d45,_0xe20b9c),{'verbose':_0xc2d8d8['verbose']}),_0xe36423=_0x35a5e4[_0x32d991(0xd9)];_0xc2d8d8[_0x32d991(0xd2)]&&console[_0x32d991(0xdd)](_0x32d991(0xe2)+_0xe36423);const _0x2375de=await withSpinner(_0x32d991(0xd5)+_0xe20b9c+'\x27...',()=>_0x1b0a9e[_0x32d991(0xd7)]['listActivations'](_0x384d45,_0xe36423),{'verbose':_0xc2d8d8['verbose']}),_0x46fc00=_0x2375de[_0x32d991(0xd9)];return console[_0x32d991(0xdd)]('✔\x20Found\x20'+_0x46fc00[_0x32d991(0xce)]+'\x20activation'+(_0x46fc00['length']!==0x1?'s':'')),await handleSDKOutput(_0x46fc00,_0xc2d8d8),0x0;}catch(_0x2ea59b){if(_0x2ea59b instanceof SDKError)return console['error']('Error:\x20'+_0x2ea59b['message']),_0x2ea59b[_0x32d991(0xcf)]&&console[_0x32d991(0xdd)](_0x32d991(0xdf)+_0x2ea59b['cause']),0x1;throw _0x2ea59b;}}}function a3_0x33fa(){const _0x573213=['segment','Resolved\x20parent\x20ID:\x20','data','8SnxWsf','173103vFXHgB','Child\x20name:\x20','error','Parent\x20name:\x20','\x20\x20Cause:\x20','997059DMueCT','17348UIQOHf','Resolved\x20child\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','763350VGbRrH','site','description','415eKNXns','activations','1159479eiahkS','2610624juSMNt','Error:\x20Segment\x20name\x20is\x20required','length','cause','Resolving\x20child\x20segment\x20\x27','resolveParentId','verbose','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','List\x20activations\x20for\x20a\x20segment','Listing\x20activations\x20for\x20segment\x20\x27','14366JNZjOP'];a3_0x33fa=function(){return _0x573213;};return a3_0x33fa();}
@@ -1 +1 @@
1
- const a4_0x266e20=a4_0x2c69;function a4_0x2c69(_0x1d65f4,_0x41b0e4){_0x1d65f4=_0x1d65f4-0xba;const _0x4337b1=a4_0x4337();let _0x2c6956=_0x4337b1[_0x1d65f4];return _0x2c6956;}(function(_0x4632ea,_0x18b60a){const _0x27d007=a4_0x2c69,_0x2f89fe=_0x4632ea();while(!![]){try{const _0x446c82=parseInt(_0x27d007(0x168))/0x1*(parseInt(_0x27d007(0xc3))/0x2)+-parseInt(_0x27d007(0xbf))/0x3+parseInt(_0x27d007(0xc2))/0x4*(parseInt(_0x27d007(0x126))/0x5)+-parseInt(_0x27d007(0x15d))/0x6*(-parseInt(_0x27d007(0x103))/0x7)+-parseInt(_0x27d007(0x12f))/0x8*(-parseInt(_0x27d007(0x141))/0x9)+-parseInt(_0x27d007(0xfd))/0xa+-parseInt(_0x27d007(0x146))/0xb*(parseInt(_0x27d007(0x138))/0xc);if(_0x446c82===_0x18b60a)break;else _0x2f89fe['push'](_0x2f89fe['shift']());}catch(_0x863158){_0x2f89fe['push'](_0x2f89fe['shift']());}}}(a4_0x4337,0x60566));function a4_0x4337(){const _0x2799e1=['newProjectId','Using\x20project\x20from\x20','message','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)','8MtmiHg','Analyzing\x20project\x20\x22','\x20errors','\x0aPush\x20','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','source','\x0aChanges\x20to\x20form\x20interface\x20\x27','Dry\x20run\x20-\x20no\x20changes\x20made','site','376176KwypIx','-\x20nothing\x20pushed','Project:\x20','The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a','force','diff','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','description','\x20\x20tdx\x20agent\x20clone\x20agents/','5226255RsDEst','cwd-config','\x20\x20Target:\x20','Using\x20project:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','352kyPEPf','\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','\x20\x20Knowledge\x20Bases:\x20','counts','\x22\x20to\x20\x22','\x20\x20Knowledge\x20Base\x20\x22','\x22\x20to\x20new\x20project\x20\x22','\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','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x0aError:','\x20files\x20to\x20','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','Using\x20project\x20from\x20context:\x20','error','formInterfaces','\x20\x20Integrations:\x20','\x20successfully','\x0aProject\x20pushed\x20with\x20errors','<new-name>','agents','textKnowledgeBases','cloneProject','outputPath','19308grigkU','unchanged','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','Source:\x20','\x20\x20Text\x20Knowledge\x20Base\x20\x22','Cannot\x20clone\x20from\x20context\x20project\x20\x22','New\x20project\x20ID:\x20','dim','Pulling\x20agent\x20\x22','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','\x0a✔\x20Pushed\x20','69473cXbeRY','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','Cancelled','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','projectId','action','\x20resources?','dryRun','session','\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','\x20=\x20','\x20\x20Text\x20Knowledge\x20Bases:\x20','profile','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','\x22:\x20','red','Agent:\x20','\x20total','errors','Chat:\x20','\x20\x20Experimental\x20Artifacts:\x20','New\x20project:\x20','repeat','1652967xOrIDp','Agent\x20pulled\x20successfully','new','8vgRlxA','20AmkLhF','Project\x20cloned\x20with\x20errors','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','\x20unchanged','\x20changed','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','cyan','\x22...','dirname','found','prompts','\x20\x20Form\x20Interfaces:\x20','\x20created','Dry\x20run\x20-\x20no\x20files\x20written','\x20--name\x20','Using\x20local\x20project:\x20','Analyzing\x20changes\x20to\x20push...','\x20|\x20','execute','\x20\x20Prompts:\x20','chatInterfaces','no_local_folder','integrations','knowledgeBases','updated','projectName','✔\x20Context\x20set:\x20','agent:pull','Pushing\x20to\x20project...','llm','yes','\x0aErrors\x20found:','experimentalArtifacts','\x0aChanges:','\x0aChanges\x20to\x20integration\x20\x27','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','total','llmProject','pullProject','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','output','newProjectName','\x20\x20Prompt\x20\x22','\x0a✔\x20Pulled\x20','INVALID_ARGUMENT','utf-8','cwd','outputDir','\x20resources\x20to\x20\x27','log','Failed\x20to\x20push\x20agent:\x20','\x0aChanges\x20to\x20chat\x20interface\x20\x27','Using\x20current\x20project:\x20','green','Project\x20cloned\x20successfully','\x20updated','join','1972300nQKiVV','\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)','parse','yellow','\x20\x20Experimental\x20Artifact\x20\x22','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','455ziSaBG','Agent\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','agentId','\x22\x20from\x20project\x20\x22','\x20files?','experimentalKnowledgeBases','-\x20no\x20files\x20written','\x20\x20Chat\x20Interface\x20\x22','created','agent:push','agent:clone','tdx.json','\x20\x20Chat\x20Interfaces:\x20','llm_project','Using\x20context\x20project:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','name','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20\x20Integration\x20\x22','\x20\x20Agents:\x20','push','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','\x20\x20Form\x20Interface\x20\x22','\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','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Pushing\x20agent\x20from\x20\x22','sourceProjectName','agentName','\x0aWrite\x20','Errors:','context','Writing\x20files...','no_context','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','1653395lrPMCN','New\x20project\x20name\x20is\x20required','\x20\x20Agent\x20\x22','Cloning\x20\x22','\x20new'];a4_0x4337=function(){return _0x2799e1;};return a4_0x4337();}import a4_0x3d8a18 from'chalk';import a4_0x213baf 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(_0x51ae73){const _0x3bc71e=a4_0x2c69,_0x39d6db=[];if(_0x51ae73['total']!==undefined)_0x39d6db['push'](_0x51ae73[_0x3bc71e(0xe7)]+_0x3bc71e(0x179));if(_0x51ae73[_0x3bc71e(0xc1)]!==undefined&&_0x51ae73['new']>0x0)_0x39d6db[_0x3bc71e(0x118)](a4_0x3d8a18[_0x3bc71e(0xf9)](_0x51ae73['new']+_0x3bc71e(0x12a)));if(_0x51ae73[_0x3bc71e(0x10c)]!==undefined&&_0x51ae73[_0x3bc71e(0x10c)]>0x0)_0x39d6db[_0x3bc71e(0x118)](a4_0x3d8a18[_0x3bc71e(0xf9)](_0x51ae73[_0x3bc71e(0x10c)]+_0x3bc71e(0xcf)));if(_0x51ae73['updated']!==undefined&&_0x51ae73[_0x3bc71e(0xdb)]>0x0)_0x39d6db[_0x3bc71e(0x118)](a4_0x3d8a18[_0x3bc71e(0x100)](_0x51ae73[_0x3bc71e(0xdb)]+_0x3bc71e(0xfb)));if(_0x51ae73[_0x3bc71e(0x15e)]!==undefined&&_0x51ae73['unchanged']>0x0)_0x39d6db[_0x3bc71e(0x118)](a4_0x3d8a18['gray'](_0x51ae73[_0x3bc71e(0x15e)]+_0x3bc71e(0xc6)));if(_0x51ae73[_0x3bc71e(0xba)]!==undefined&&_0x51ae73['errors']>0x0)_0x39d6db[_0x3bc71e(0x118)](a4_0x3d8a18[_0x3bc71e(0x177)](_0x51ae73[_0x3bc71e(0xba)]+_0x3bc71e(0x131)));return _0x39d6db[_0x3bc71e(0xfc)](',\x20');}function displayDiffs(_0x23f3c2,_0x33b9e,_0x49881e,_0x2598ed,_0x58c4bd,_0x403e8c,_0x5b314a,_0x3dd3d7,_0x4a7168){const _0x405235=a4_0x2c69;for(const _0x464180 of _0x23f3c2){if(_0x464180[_0x405235(0x13d)]){const _0x567ea6=_0x464180['agentName']||_0x464180[_0x405235(0x114)];console['log']('\x0aChanges\x20to\x20agent\x20\x27'+_0x567ea6+'\x27:'),console[_0x405235(0xf5)]('─'['repeat'](0x3c)),console[_0x405235(0xf5)](_0x464180['diff']),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c));}}for(const _0x11cadc of _0x33b9e){_0x11cadc[_0x405235(0x13d)]&&(console[_0x405235(0xf5)](_0x405235(0x115)+_0x11cadc[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'['repeat'](0x3c)),console[_0x405235(0xf5)](_0x11cadc['diff']),console['log']('─'[_0x405235(0xbe)](0x3c)));}for(const _0x5bd337 of _0x49881e){_0x5bd337[_0x405235(0x13d)]&&(console['log'](_0x405235(0x119)+_0x5bd337[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'['repeat'](0x3c)),console[_0x405235(0xf5)](_0x5bd337[_0x405235(0x13d)]),console[_0x405235(0xf5)]('─'['repeat'](0x3c)));}for(const _0x2f2ba5 of _0x2598ed){_0x2f2ba5[_0x405235(0x13d)]&&(console[_0x405235(0xf5)]('\x0aChanges\x20to\x20prompt\x20\x27'+_0x2f2ba5[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)),console[_0x405235(0xf5)](_0x2f2ba5[_0x405235(0x13d)]),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)));}for(const _0x510fd5 of _0x58c4bd){_0x510fd5[_0x405235(0x13d)]&&(console[_0x405235(0xf5)](_0x405235(0xe5)+_0x510fd5[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)),console['log'](_0x510fd5[_0x405235(0x13d)]),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)));}for(const _0x176fa1 of _0x403e8c){_0x176fa1[_0x405235(0x13d)]&&(console[_0x405235(0xf5)]('\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27'+_0x176fa1[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)),console[_0x405235(0xf5)](_0x176fa1[_0x405235(0x13d)]),console['log']('─'[_0x405235(0xbe)](0x3c)));}for(const _0x5d8aad of _0x5b314a){_0x5d8aad[_0x405235(0x13d)]&&(console['log'](_0x405235(0xe6)+_0x5d8aad[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'['repeat'](0x3c)),console[_0x405235(0xf5)](_0x5d8aad[_0x405235(0x13d)]),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)));}for(const _0x4b75c1 of _0x3dd3d7){_0x4b75c1[_0x405235(0x13d)]&&(console[_0x405235(0xf5)](_0x405235(0x135)+_0x4b75c1[_0x405235(0x114)]+'\x27:'),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)),console[_0x405235(0xf5)](_0x4b75c1[_0x405235(0x13d)]),console[_0x405235(0xf5)]('─'['repeat'](0x3c)));}for(const _0x31fda6 of _0x4a7168){_0x31fda6[_0x405235(0x13d)]&&(console[_0x405235(0xf5)](_0x405235(0xf7)+_0x31fda6['name']+'\x27:'),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)),console[_0x405235(0xf5)](_0x31fda6[_0x405235(0x13d)]),console[_0x405235(0xf5)]('─'[_0x405235(0xbe)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x266e20(0x114)]=a4_0x266e20(0xde);['description']=a4_0x266e20(0x105);async[a4_0x266e20(0xd5)](_0x48518c){const _0x3f59ed=a4_0x266e20,{options:_0x312f63,args:_0x11e3f7,tdx:_0x5d9a1a}=_0x48518c,_0x60b774=_0x11e3f7[0x0],_0x30f84b=_0x11e3f7[0x1],_0x420fbf=_0x312f63[_0x3f59ed(0xec)],_0x3ec6f5=_0x312f63[_0x3f59ed(0x16f)],_0x3350e2=_0x312f63[_0x3f59ed(0x13c)],_0x5a83e0=_0x312f63['yes'],_0x5e85de=_0x312f63[_0x3f59ed(0xe8)],_0x280c4b=_0x312f63['agent'];let _0x29bad7;if(_0x60b774){const _0x18cd3b=a4_0x213baf[_0x3f59ed(0xfc)](_0x60b774,_0x3f59ed(0x10f));if(existsSync(_0x18cd3b))try{const _0x9a85b3=JSON[_0x3f59ed(0xff)](readFileSync(_0x18cd3b,_0x3f59ed(0xf1)));_0x9a85b3['llm_project']&&(_0x29bad7={'llm_project':_0x9a85b3[_0x3f59ed(0x111)]});}catch{}}const _0x296137=findAgentConfigPath(process[_0x3f59ed(0xf2)]());let _0x952b72;if(_0x296137)try{const _0x2e5942=JSON[_0x3f59ed(0xff)](readFileSync(_0x296137,_0x3f59ed(0xf1)));_0x2e5942[_0x3f59ed(0x111)]&&(_0x952b72={'llm_project':_0x2e5942[_0x3f59ed(0x111)]});}catch{}const _0x46ceb5=resolveAgentPullArgs({'arg':_0x60b774,'agentNameArg':_0x30f84b,'agentFlag':_0x280c4b,'contextProject':_0x5e85de,'argDirConfig':_0x29bad7,'cwdConfigPath':_0x296137||undefined,'cwdConfig':_0x952b72}),{projectNameOrId:_0xb8ea28,targetAgentName:_0x25137e,existingOutputDir:_0x2eecd2,source:_0x2494e9}=_0x46ceb5;if(_0x2494e9==='arg-dir')console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0x164)](_0x3f59ed(0x12c)+a4_0x213baf[_0x3f59ed(0xfc)](_0x60b774,_0x3f59ed(0x10f))+':\x20'+_0xb8ea28));else{if(_0x2494e9===_0x3f59ed(0x142))console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0x164)](_0x3f59ed(0x144)+_0xb8ea28));else _0x2494e9===_0x3f59ed(0x122)&&console[_0x3f59ed(0xf5)](a4_0x3d8a18['dim'](_0x3f59ed(0x152)+_0xb8ea28));}if(!_0xb8ea28)return _0x280c4b?(console['log'](a4_0x3d8a18[_0x3f59ed(0x100)](_0x3f59ed(0x13b))),console[_0x3f59ed(0xf5)](_0x3f59ed(0x133)),console[_0x3f59ed(0xf5)](_0x3f59ed(0x169))):(console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0x100)](_0x3f59ed(0x102))),console[_0x3f59ed(0xf5)](_0x3f59ed(0x12e)),console[_0x3f59ed(0xf5)](_0x3f59ed(0x11b)),console[_0x3f59ed(0xf5)](_0x3f59ed(0x147)),console['log'](_0x3f59ed(0x171)),console[_0x3f59ed(0xf5)](_0x3f59ed(0x14d))),0x1;if(_0x25137e){const {data:_0x330f10}=await withSpinner(_0x3f59ed(0x165)+_0x25137e+_0x3f59ed(0x107)+_0xb8ea28+_0x3f59ed(0xca),()=>_0x5d9a1a[_0x3f59ed(0xe0)]['pullAgent'](_0xb8ea28,_0x25137e,_0x420fbf,{'dryRun':_0x3ec6f5,'force':_0x3350e2}));if(_0x3ec6f5)return console['log'](a4_0x3d8a18[_0x3f59ed(0x100)](_0x3f59ed(0xd0))),console['log']('Would\x20pull\x20agent:\x20'+_0x330f10['agentName']),console['log']('Output\x20path:\x20'+_0x330f10[_0x3f59ed(0x15c)]),_0x330f10[_0x3f59ed(0x13d)]&&(console[_0x3f59ed(0xf5)](_0x3f59ed(0xe4)),console[_0x3f59ed(0xf5)]('─'[_0x3f59ed(0xbe)](0x3c)),console[_0x3f59ed(0xf5)](_0x330f10[_0x3f59ed(0x13d)]),console[_0x3f59ed(0xf5)]('─'[_0x3f59ed(0xbe)](0x3c))),0x0;return console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0xf9)](_0x3f59ed(0xc0))),console[_0x3f59ed(0xf5)](_0x3f59ed(0x178)+_0x330f10['agentName']),console[_0x3f59ed(0xf5)]('Output:\x20'+_0x330f10[_0x3f59ed(0x15c)]),console[_0x3f59ed(0xf5)]('Status:\x20'+(_0x330f10['isNew']?a4_0x3d8a18[_0x3f59ed(0xf9)](_0x3f59ed(0xc1)):_0x330f10['hasChanges']?a4_0x3d8a18[_0x3f59ed(0x100)](_0x3f59ed(0xdb)):a4_0x3d8a18['gray'](_0x3f59ed(0x15e)))),0x0;}const _0x5f3e32=_0x2eecd2||_0x420fbf,{data:_0x7f6206}=await withSpinner(_0x3f59ed(0x130)+_0xb8ea28+'\x22...',()=>_0x5d9a1a[_0x3f59ed(0xe0)][_0x3f59ed(0xe9)](_0xb8ea28,_0x5f3e32,{'dryRun':!![]})),_0x595aa8=_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x159)][_0x3f59ed(0xc1)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xda)][_0x3f59ed(0xc1)]+_0x7f6206[_0x3f59ed(0x149)]['textKnowledgeBases'][_0x3f59ed(0xc1)]+_0x7f6206['counts']['prompts']['new']+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd9)]['new']+_0x7f6206[_0x3f59ed(0x149)]['experimentalKnowledgeBases'][_0x3f59ed(0xc1)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xe3)][_0x3f59ed(0xc1)]+_0x7f6206['counts'][_0x3f59ed(0x154)][_0x3f59ed(0xc1)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd7)][_0x3f59ed(0xc1)],_0x5e77c7=_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x159)][_0x3f59ed(0xdb)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xda)][_0x3f59ed(0xdb)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x15a)][_0x3f59ed(0xdb)]+_0x7f6206[_0x3f59ed(0x149)]['prompts'][_0x3f59ed(0xdb)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd9)][_0x3f59ed(0xdb)]+_0x7f6206['counts']['experimentalKnowledgeBases']['updated']+_0x7f6206['counts'][_0x3f59ed(0xe3)]['updated']+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x154)][_0x3f59ed(0xdb)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd7)][_0x3f59ed(0xdb)],_0x18e514=_0x7f6206['counts'][_0x3f59ed(0x159)][_0x3f59ed(0x15e)]+_0x7f6206[_0x3f59ed(0x149)]['knowledgeBases'][_0x3f59ed(0x15e)]+_0x7f6206[_0x3f59ed(0x149)]['textKnowledgeBases'][_0x3f59ed(0x15e)]+_0x7f6206['counts']['prompts'][_0x3f59ed(0x15e)]+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd9)][_0x3f59ed(0x15e)]+_0x7f6206[_0x3f59ed(0x149)]['experimentalKnowledgeBases'][_0x3f59ed(0x15e)]+_0x7f6206['counts']['experimentalArtifacts']['unchanged']+_0x7f6206[_0x3f59ed(0x149)]['formInterfaces']['unchanged']+_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd7)][_0x3f59ed(0x15e)];console[_0x3f59ed(0xf5)]('\x0aPull\x20summary\x20for\x20\x27'+_0x7f6206[_0x3f59ed(0xdc)]+'\x27:'),console[_0x3f59ed(0xf5)]('\x20\x20'+a4_0x3d8a18[_0x3f59ed(0xf9)]('+\x20'+_0x595aa8+_0x3f59ed(0x12a))+_0x3f59ed(0xd4)+a4_0x3d8a18[_0x3f59ed(0x100)]('~\x20'+_0x5e77c7+'\x20changed')+_0x3f59ed(0xd4)+a4_0x3d8a18[_0x3f59ed(0x164)]('=\x20'+_0x18e514+_0x3f59ed(0xc6))),console[_0x3f59ed(0xf5)](_0x3f59ed(0x117)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x159)])),console[_0x3f59ed(0xf5)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x7f6206['counts']['knowledgeBases'])),console[_0x3f59ed(0xf5)](_0x3f59ed(0x173)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x15a)])),console[_0x3f59ed(0xf5)](_0x3f59ed(0xd6)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)]['prompts'])),console[_0x3f59ed(0xf5)](_0x3f59ed(0x155)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)]['integrations'])),console[_0x3f59ed(0xf5)](_0x3f59ed(0xce)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)]['formInterfaces'])),console[_0x3f59ed(0xf5)](_0x3f59ed(0x110)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xd7)]));const _0x3b4143=_0x7f6206[_0x3f59ed(0x149)]['experimentalKnowledgeBases'][_0x3f59ed(0xe7)]>0x0||_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xe3)][_0x3f59ed(0xe7)]>0x0;_0x3b4143&&(console[_0x3f59ed(0xf5)](_0x3f59ed(0x125)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0x109)])),console['log'](_0x3f59ed(0xbc)+formatCountSummary(_0x7f6206[_0x3f59ed(0x149)][_0x3f59ed(0xe3)])));console[_0x3f59ed(0xf5)](_0x3f59ed(0x143)+a4_0x3d8a18['cyan'](_0x7f6206[_0x3f59ed(0xf3)])),displayDiffs(_0x7f6206[_0x3f59ed(0x159)],_0x7f6206[_0x3f59ed(0xda)],_0x7f6206['textKnowledgeBases'],_0x7f6206[_0x3f59ed(0xcd)],_0x7f6206[_0x3f59ed(0xd9)],_0x7f6206[_0x3f59ed(0x109)],_0x7f6206[_0x3f59ed(0xe3)],_0x7f6206[_0x3f59ed(0x154)],_0x7f6206[_0x3f59ed(0xd7)]);if(_0x3ec6f5)return console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0x100)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x595aa8===0x0&&_0x5e77c7===0x0)return console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0xf9)](_0x3f59ed(0xea))),saveSessionContext({'llm_project':_0x7f6206[_0x3f59ed(0xdc)]},_0x312f63[_0x3f59ed(0x170)]),console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0xf9)](_0x3f59ed(0xdd)+a4_0x3d8a18[_0x3f59ed(0x164)](_0x3f59ed(0x111))+_0x3f59ed(0x172)+a4_0x3d8a18['cyan'](_0x7f6206[_0x3f59ed(0xdc)]))),0x0;if(!_0x5a83e0&&!_0x3350e2){if(!isInteractive())return console['error'](a4_0x3d8a18[_0x3f59ed(0x177)](_0x3f59ed(0x14f)),_0x3f59ed(0x16b)),console['error'](a4_0x3d8a18['dim'](_0x3f59ed(0x113))),0x1;const _0x5845f3=await confirmKey(_0x3f59ed(0x120)+(_0x595aa8+_0x5e77c7)+_0x3f59ed(0x108));if(!_0x5845f3)return console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0x100)]('Cancelled'),_0x3f59ed(0x10a)),0x1;}const {data:_0x37a8ba}=await withSpinner(_0x3f59ed(0x123),()=>_0x5d9a1a[_0x3f59ed(0xe0)][_0x3f59ed(0xe9)](_0xb8ea28,_0x5f3e32,{'force':_0x3350e2}));return console['log'](a4_0x3d8a18[_0x3f59ed(0xf9)](_0x3f59ed(0xef)+(_0x595aa8+_0x5e77c7)+_0x3f59ed(0x150)+_0x37a8ba['outputDir'])),saveSessionContext({'llm_project':_0x37a8ba[_0x3f59ed(0xdc)]},_0x312f63['session']),console[_0x3f59ed(0xf5)](a4_0x3d8a18[_0x3f59ed(0xf9)](_0x3f59ed(0xdd)+a4_0x3d8a18['dim'](_0x3f59ed(0x111))+_0x3f59ed(0x172)+a4_0x3d8a18[_0x3f59ed(0xc9)](_0x37a8ba[_0x3f59ed(0xdc)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x266e20(0x10e);[a4_0x266e20(0x13f)]=a4_0x266e20(0xc8);async[a4_0x266e20(0xd5)](_0x2538f9){const _0x15d91a=a4_0x266e20,{options:_0x149910,args:_0x4cf8fa,tdx:_0x483d0d}=_0x2538f9,_0x418301=_0x4cf8fa[0x0],_0x304293=_0x149910['name'],_0x4e26b6=_0x149910[_0x15d91a(0x16f)],_0x3bdd5e=_0x149910[_0x15d91a(0xe1)],_0x4237a4=_0x149910[_0x15d91a(0x137)],_0x16dcdb=_0x149910[_0x15d91a(0xe8)];let _0x3e458b;const _0x19ab2a=findAgentConfigPath(process['cwd']());if(_0x418301){const _0x3e0e96=a4_0x213baf[_0x15d91a(0xfc)](_0x418301,_0x15d91a(0x10f));existsSync(_0x3e0e96)?(_0x3e458b=_0x418301,console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x164)](_0x15d91a(0xd2)+_0x418301))):_0x3e458b=_0x418301;}else{if(_0x19ab2a)_0x3e458b=a4_0x213baf[_0x15d91a(0xcb)](_0x19ab2a),console['log'](a4_0x3d8a18[_0x15d91a(0x164)](_0x15d91a(0xf8)+_0x3e458b));else{if(_0x16dcdb){const _0x124dcc=sanitizeForFilesystem(_0x16dcdb);let _0x22ee77=_0x124dcc,_0x4a4b24=a4_0x213baf[_0x15d91a(0xfc)](process[_0x15d91a(0xf2)](),_0x15d91a(0x159),_0x124dcc,'tdx.json');if(!existsSync(_0x4a4b24)){const _0x21d524=normalizeName(_0x16dcdb),_0x415de0=a4_0x213baf[_0x15d91a(0xfc)](process[_0x15d91a(0xf2)](),_0x15d91a(0x159),_0x21d524,_0x15d91a(0x10f));existsSync(_0x415de0)&&(_0x22ee77=_0x21d524,_0x4a4b24=_0x415de0);}if(existsSync(_0x4a4b24))_0x3e458b=a4_0x213baf[_0x15d91a(0xcb)](_0x4a4b24),console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x164)](_0x15d91a(0xd2)+_0x3e458b));else{const _0x1a6713=_0x149910[_0x15d91a(0x174)];if(_0x1a6713)throw new SDKError(ErrorCode[_0x15d91a(0xf0)],_0x15d91a(0x162)+_0x16dcdb+'\x22\x20to\x20a\x20different\x20profile',undefined,{'helpText':_0x15d91a(0x175)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+('\x20\x20tdx\x20agent\x20pull\x20'+_0x16dcdb+'\x0a')+(_0x15d91a(0x140)+_0x22ee77+_0x15d91a(0xd1)+(_0x304293||_0x15d91a(0x158))+'\x20--profile\x20'+_0x1a6713)});_0x3e458b=_0x16dcdb,console['log'](a4_0x3d8a18[_0x15d91a(0x164)](_0x15d91a(0x112)+_0x16dcdb));}}}}if(!_0x3e458b)return console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x100)](_0x15d91a(0x11c))),console[_0x15d91a(0xf5)](_0x15d91a(0x151)),console['log'](_0x15d91a(0xeb)),console[_0x15d91a(0xf5)](_0x15d91a(0xfe)),console[_0x15d91a(0xf5)](_0x15d91a(0x166)),0x1;if(!_0x304293)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x15d91a(0x127),undefined,{'helpText':_0x15d91a(0x15f)});if(!_0x3bdd5e&&!_0x4e26b6){if(!isInteractive())return console[_0x15d91a(0x153)](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0x14f)),_0x15d91a(0x16b)),console['error'](a4_0x3d8a18[_0x15d91a(0x164)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xc5c6b2=await confirmKey('Clone\x20\x22'+_0x3e458b+_0x15d91a(0x14c)+_0x304293+'\x22?');if(!_0xc5c6b2)return console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x100)](_0x15d91a(0x16a))),0x1;}const {data:_0x183914}=await withSpinner(_0x15d91a(0x129)+_0x3e458b+_0x15d91a(0x14a)+_0x304293+_0x15d91a(0xca),()=>_0x483d0d['llm'][_0x15d91a(0x15b)](_0x3e458b,_0x304293,{'dryRun':_0x4e26b6}));if(_0x4e26b6){console[_0x15d91a(0xf5)](a4_0x3d8a18['yellow'](_0x15d91a(0x136))),console[_0x15d91a(0xf5)](_0x15d91a(0x160)+_0x183914[_0x15d91a(0x11e)]),console[_0x15d91a(0xf5)](_0x15d91a(0xbd)+_0x304293),console[_0x15d91a(0xf5)]('Would\x20clone:'),console[_0x15d91a(0xf5)](_0x15d91a(0x117)+_0x183914[_0x15d91a(0x149)][_0x15d91a(0x159)][_0x15d91a(0x10c)]),console[_0x15d91a(0xf5)](_0x15d91a(0x148)+_0x183914[_0x15d91a(0x149)][_0x15d91a(0xda)]['created']),console[_0x15d91a(0xf5)]('\x20\x20Prompts:\x20'+_0x183914[_0x15d91a(0x149)][_0x15d91a(0xcd)][_0x15d91a(0x10c)]),console[_0x15d91a(0xf5)](_0x15d91a(0xce)+_0x183914['counts'][_0x15d91a(0x154)][_0x15d91a(0x10c)]),console[_0x15d91a(0xf5)](_0x15d91a(0x110)+_0x183914['counts']['chatInterfaces'][_0x15d91a(0x10c)]);const _0x73beb5=_0x183914[_0x15d91a(0x149)][_0x15d91a(0x109)][_0x15d91a(0x10c)]>0x0||_0x183914[_0x15d91a(0x149)][_0x15d91a(0xe3)][_0x15d91a(0x10c)]>0x0;return _0x73beb5&&(console['log'](_0x15d91a(0x125)+_0x183914[_0x15d91a(0x149)][_0x15d91a(0x109)]['created']),console[_0x15d91a(0xf5)]('\x20\x20Experimental\x20Artifacts:\x20'+_0x183914[_0x15d91a(0x149)][_0x15d91a(0xe3)][_0x15d91a(0x10c)])),0x0;}const _0x296f10=_0x183914[_0x15d91a(0x149)][_0x15d91a(0x159)][_0x15d91a(0xba)]>0x0||_0x183914[_0x15d91a(0x149)][_0x15d91a(0xda)]['errors']>0x0||_0x183914['counts'][_0x15d91a(0xcd)][_0x15d91a(0xba)]>0x0||_0x183914[_0x15d91a(0x149)][_0x15d91a(0x154)][_0x15d91a(0xba)]>0x0||_0x183914['counts'][_0x15d91a(0xd7)][_0x15d91a(0xba)]>0x0||_0x183914[_0x15d91a(0x149)]['experimentalKnowledgeBases'][_0x15d91a(0xba)]>0x0||_0x183914[_0x15d91a(0x149)][_0x15d91a(0xe3)]['errors']>0x0;_0x296f10?console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x100)](_0x15d91a(0xc4))):console[_0x15d91a(0xf5)](a4_0x3d8a18['green'](_0x15d91a(0xfa)));console[_0x15d91a(0xf5)]('Source:\x20'+_0x183914[_0x15d91a(0x11e)]),console[_0x15d91a(0xf5)](_0x15d91a(0xbd)+_0x183914[_0x15d91a(0xed)]),console['log'](_0x15d91a(0x163)+_0x183914[_0x15d91a(0x12b)]),console[_0x15d91a(0xf5)](),console[_0x15d91a(0xf5)]('Summary:'),console['log'](_0x15d91a(0x117)+formatCountSummary(_0x183914[_0x15d91a(0x149)][_0x15d91a(0x159)])),console[_0x15d91a(0xf5)](_0x15d91a(0x148)+formatCountSummary(_0x183914[_0x15d91a(0x149)]['knowledgeBases'])),console['log'](_0x15d91a(0xd6)+formatCountSummary(_0x183914['counts'][_0x15d91a(0xcd)])),console['log'](_0x15d91a(0x155)+formatCountSummary(_0x183914[_0x15d91a(0x149)][_0x15d91a(0xd9)])),console[_0x15d91a(0xf5)](_0x15d91a(0xce)+formatCountSummary(_0x183914[_0x15d91a(0x149)][_0x15d91a(0x154)])),console[_0x15d91a(0xf5)](_0x15d91a(0x110)+formatCountSummary(_0x183914['counts']['chatInterfaces']));const _0x43df06=_0x183914[_0x15d91a(0x149)][_0x15d91a(0x109)][_0x15d91a(0x10c)]>0x0||_0x183914['counts'][_0x15d91a(0x109)][_0x15d91a(0xdb)]>0x0||_0x183914['counts'][_0x15d91a(0x109)]['unchanged']>0x0||_0x183914[_0x15d91a(0x149)][_0x15d91a(0xe3)]['created']>0x0||_0x183914['counts'][_0x15d91a(0xe3)][_0x15d91a(0xdb)]>0x0||_0x183914[_0x15d91a(0x149)][_0x15d91a(0xe3)][_0x15d91a(0x15e)]>0x0;_0x43df06&&(console['log'](_0x15d91a(0x125)+formatCountSummary(_0x183914[_0x15d91a(0x149)][_0x15d91a(0x109)])),console['log'](_0x15d91a(0xbc)+formatCountSummary(_0x183914[_0x15d91a(0x149)][_0x15d91a(0xe3)])));if(_0x296f10){console[_0x15d91a(0xf5)](),console['log'](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0x121)));for(const _0x3bac60 of _0x183914[_0x15d91a(0x159)]){_0x3bac60[_0x15d91a(0x16d)]===_0x15d91a(0x153)&&console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0x128)+_0x3bac60[_0x15d91a(0x11f)]+_0x15d91a(0x176)+_0x3bac60[_0x15d91a(0x153)]));}for(const _0x81917f of _0x183914['knowledgeBases']){_0x81917f[_0x15d91a(0x16d)]===_0x15d91a(0x153)&&console['log'](a4_0x3d8a18['red']('\x20\x20Knowledge\x20Base\x20\x22'+_0x81917f['name']+_0x15d91a(0x176)+_0x81917f[_0x15d91a(0x153)]));}for(const _0x52962a of _0x183914['prompts']){_0x52962a['action']===_0x15d91a(0x153)&&console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0xee)+_0x52962a[_0x15d91a(0x114)]+_0x15d91a(0x176)+_0x52962a[_0x15d91a(0x153)]));}for(const _0xad4fb6 of _0x183914[_0x15d91a(0xd9)]){_0xad4fb6[_0x15d91a(0x16d)]==='error'&&console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0x116)+_0xad4fb6[_0x15d91a(0x114)]+_0x15d91a(0x176)+_0xad4fb6[_0x15d91a(0x153)]));}for(const _0x2bda7a of _0x183914[_0x15d91a(0x154)]){_0x2bda7a[_0x15d91a(0x16d)]===_0x15d91a(0x153)&&console['log'](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0x11a)+_0x2bda7a['name']+_0x15d91a(0x176)+_0x2bda7a[_0x15d91a(0x153)]));}for(const _0x13e47e of _0x183914[_0x15d91a(0xd7)]){_0x13e47e[_0x15d91a(0x16d)]==='error'&&console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x177)]('\x20\x20Chat\x20Interface\x20\x22'+_0x13e47e[_0x15d91a(0x114)]+_0x15d91a(0x176)+_0x13e47e[_0x15d91a(0x153)]));}for(const _0x3dbb4b of _0x183914[_0x15d91a(0x109)]){_0x3dbb4b['action']===_0x15d91a(0x153)&&console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x177)]('\x20\x20Experimental\x20Knowledge\x20Base\x20\x22'+_0x3dbb4b['name']+'\x22:\x20'+_0x3dbb4b[_0x15d91a(0x153)]));}for(const _0xd2677b of _0x183914[_0x15d91a(0xe3)]){_0xd2677b[_0x15d91a(0x16d)]===_0x15d91a(0x153)&&console[_0x15d91a(0xf5)](a4_0x3d8a18[_0x15d91a(0x177)](_0x15d91a(0x101)+_0xd2677b[_0x15d91a(0x114)]+'\x22:\x20'+_0xd2677b['error']));}return 0x1;}console['log']();const _0x14a475=getLLMProjectUrl(_0x4237a4,_0x183914['newProjectId']);return console[_0x15d91a(0xf5)](_0x15d91a(0x13a)+a4_0x3d8a18[_0x15d91a(0xc9)](_0x14a475)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x266e20(0x114)]=a4_0x266e20(0x10d);[a4_0x266e20(0x13f)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x266e20(0xd5)](_0x42cefe){const _0x26aa54=a4_0x266e20,{options:_0x7efd54,args:_0x19241d,tdx:_0x411daa}=_0x42cefe;let _0x17bafc=_0x19241d[0x0]||process['cwd']();const _0x4814b7=_0x7efd54['dryRun'],_0x1f921a=_0x7efd54['force'],_0x5da212=_0x7efd54[_0x26aa54(0xe1)],_0x599b92=_0x7efd54[_0x26aa54(0x137)],_0x2d45e7=a4_0x213baf[_0x26aa54(0xfc)](_0x17bafc,'agent.yml'),_0x259574=existsSync(_0x2d45e7);if(_0x259574){const {data:_0x51c6e7}=await withSpinner(_0x26aa54(0x11d)+_0x17bafc+_0x26aa54(0xca),()=>_0x411daa[_0x26aa54(0xe0)]['pushAgent'](_0x17bafc,{'dryRun':_0x4814b7,'force':_0x1f921a}));if(_0x4814b7)return console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x100)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console[_0x26aa54(0xf5)]('Would\x20push\x20agent:\x20'+_0x51c6e7[_0x26aa54(0x11f)]),0x0;if(_0x51c6e7[_0x26aa54(0x16d)]===_0x26aa54(0x153))return console[_0x26aa54(0xf5)](a4_0x3d8a18['red'](_0x26aa54(0xf6)+_0x51c6e7[_0x26aa54(0x153)])),0x1;console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0xf9)](_0x26aa54(0x104)+_0x51c6e7[_0x26aa54(0x16d)]+_0x26aa54(0x156))),console[_0x26aa54(0xf5)](_0x26aa54(0x178)+_0x51c6e7[_0x26aa54(0x11f)]);if(_0x51c6e7['agentId']&&_0x51c6e7[_0x26aa54(0x16c)]){const _0x43af4f=getLLMAgentChatUrl(_0x599b92,_0x51c6e7['projectId'],_0x51c6e7[_0x26aa54(0x106)]);console[_0x26aa54(0xf5)](_0x26aa54(0xbb)+a4_0x3d8a18[_0x26aa54(0xc9)](_0x43af4f));}return 0x0;}const _0x321574=_0x7efd54[_0x26aa54(0xe8)],_0x50c8e7=resolveProjectFromContext(_0x17bafc,_0x321574);if(_0x50c8e7[_0x26aa54(0xcc)])_0x17bafc=_0x50c8e7['projectDir'],_0x50c8e7[_0x26aa54(0x134)]==='context'&&console[_0x26aa54(0xf5)](a4_0x3d8a18['dim']('Using\x20project:\x20'+_0x17bafc));else{let _0x397883=_0x26aa54(0x14e);_0x50c8e7['reason']===_0x26aa54(0xd8)&&(_0x397883=_0x50c8e7[_0x26aa54(0x12d)]+_0x26aa54(0xc5)+_0x50c8e7[_0x26aa54(0xe8)]+_0x26aa54(0x145));throw new SDKError(ErrorCode[_0x26aa54(0xf0)],_0x50c8e7['reason']===_0x26aa54(0x124)?_0x50c8e7['message']:'No\x20tdx.json\x20found\x20in\x20'+_0x17bafc,undefined,{'helpText':_0x397883});}const {data:_0x59d71b}=await withSpinner(_0x26aa54(0xd3),()=>_0x411daa[_0x26aa54(0xe0)]['pushProject'](_0x17bafc,{'dryRun':!![]})),_0x33c197=_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x159)]['errors']>0x0;if(_0x33c197){console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0xe2)));for(const _0x1c146b of _0x59d71b[_0x26aa54(0x159)]){_0x1c146b[_0x26aa54(0x16d)]===_0x26aa54(0x153)&&console[_0x26aa54(0xf5)](a4_0x3d8a18['red']('\x20\x20Agent\x20\x22'+_0x1c146b[_0x26aa54(0x11f)]+'\x22:\x20'+_0x1c146b[_0x26aa54(0x153)]));}return 0x1;}const _0x5c233f=_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x159)][_0x26aa54(0x10c)]+_0x59d71b['counts'][_0x26aa54(0xda)]['created']+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x15a)][_0x26aa54(0x10c)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xcd)][_0x26aa54(0x10c)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xd9)][_0x26aa54(0x10c)]+_0x59d71b['counts'][_0x26aa54(0x109)][_0x26aa54(0x10c)]+_0x59d71b['counts']['experimentalArtifacts']['created']+_0x59d71b['counts']['formInterfaces']['created']+_0x59d71b['counts'][_0x26aa54(0xd7)]['created'],_0x9cc5c3=_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x159)][_0x26aa54(0xdb)]+_0x59d71b['counts'][_0x26aa54(0xda)][_0x26aa54(0xdb)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x15a)][_0x26aa54(0xdb)]+_0x59d71b['counts'][_0x26aa54(0xcd)][_0x26aa54(0xdb)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xd9)]['updated']+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x109)][_0x26aa54(0xdb)]+_0x59d71b['counts'][_0x26aa54(0xe3)][_0x26aa54(0xdb)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x154)][_0x26aa54(0xdb)]+_0x59d71b['counts'][_0x26aa54(0xd7)][_0x26aa54(0xdb)],_0x17c5f0=_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x159)][_0x26aa54(0x15e)]+_0x59d71b['counts'][_0x26aa54(0xda)]['unchanged']+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x15a)][_0x26aa54(0x15e)]+_0x59d71b['counts'][_0x26aa54(0xcd)][_0x26aa54(0x15e)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xd9)]['unchanged']+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x109)][_0x26aa54(0x15e)]+_0x59d71b[_0x26aa54(0x149)]['experimentalArtifacts']['unchanged']+_0x59d71b[_0x26aa54(0x149)]['formInterfaces'][_0x26aa54(0x15e)]+_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xd7)][_0x26aa54(0x15e)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x59d71b[_0x26aa54(0xdc)]+'\x27:'),console[_0x26aa54(0xf5)]('\x20\x20'+a4_0x3d8a18[_0x26aa54(0xf9)]('+\x20'+_0x5c233f+_0x26aa54(0x12a))+'\x20|\x20'+a4_0x3d8a18[_0x26aa54(0x100)]('~\x20'+_0x9cc5c3+_0x26aa54(0xc7))+_0x26aa54(0xd4)+a4_0x3d8a18[_0x26aa54(0x164)]('=\x20'+_0x17c5f0+'\x20unchanged')),console[_0x26aa54(0xf5)](_0x26aa54(0x117)+formatCountSummary(_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x159)])),console[_0x26aa54(0xf5)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x59d71b[_0x26aa54(0x149)]['knowledgeBases'])),console['log'](_0x26aa54(0x173)+formatCountSummary(_0x59d71b['counts']['textKnowledgeBases'])),console[_0x26aa54(0xf5)](_0x26aa54(0xd6)+formatCountSummary(_0x59d71b['counts'][_0x26aa54(0xcd)])),console[_0x26aa54(0xf5)](_0x26aa54(0x155)+formatCountSummary(_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xd9)])),console[_0x26aa54(0xf5)](_0x26aa54(0xce)+formatCountSummary(_0x59d71b['counts'][_0x26aa54(0x154)])),console[_0x26aa54(0xf5)](_0x26aa54(0x110)+formatCountSummary(_0x59d71b[_0x26aa54(0x149)]['chatInterfaces']));const _0x15974c=_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x109)][_0x26aa54(0x10c)]>0x0||_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x109)][_0x26aa54(0xdb)]>0x0||_0x59d71b[_0x26aa54(0x149)]['experimentalKnowledgeBases'][_0x26aa54(0x15e)]>0x0||_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xe3)]['created']>0x0||_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xe3)][_0x26aa54(0xdb)]>0x0||_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xe3)][_0x26aa54(0x15e)]>0x0;_0x15974c&&(console[_0x26aa54(0xf5)](_0x26aa54(0x125)+formatCountSummary(_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0x109)])),console['log'](_0x26aa54(0xbc)+formatCountSummary(_0x59d71b[_0x26aa54(0x149)][_0x26aa54(0xe3)])));console[_0x26aa54(0xf5)]('\x20\x20Source:\x20'+a4_0x3d8a18[_0x26aa54(0xc9)](_0x17bafc)),displayDiffs(_0x59d71b['agents'],_0x59d71b[_0x26aa54(0xda)],_0x59d71b[_0x26aa54(0x15a)],_0x59d71b[_0x26aa54(0xcd)],_0x59d71b['integrations'],_0x59d71b[_0x26aa54(0x109)],_0x59d71b['experimentalArtifacts'],_0x59d71b[_0x26aa54(0x154)],_0x59d71b[_0x26aa54(0xd7)]);if(_0x4814b7)return console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x100)](_0x26aa54(0x13e))),0x0;if(_0x5c233f===0x0&&_0x9cc5c3===0x0){console['log'](a4_0x3d8a18['green']('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x4385e9=getLLMProjectUrl(_0x599b92,_0x59d71b['projectId']);return console[_0x26aa54(0xf5)](_0x26aa54(0x13a)+a4_0x3d8a18['cyan'](_0x4385e9)),0x0;}if(!_0x5da212&&!_0x1f921a){if(!isInteractive())return console[_0x26aa54(0x153)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0x14f)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x26aa54(0x153)](a4_0x3d8a18[_0x26aa54(0x164)](_0x26aa54(0x113))),0x1;const _0x26118f=await confirmKey(_0x26aa54(0x132)+(_0x5c233f+_0x9cc5c3)+_0x26aa54(0x16e));if(!_0x26118f)return console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x100)](_0x26aa54(0x16a)),_0x26aa54(0x139)),0x1;}const {data:_0x34fe8e}=await withSpinner(_0x26aa54(0xdf),()=>_0x411daa[_0x26aa54(0xe0)]['pushProject'](_0x17bafc,{'force':_0x1f921a})),_0x38f0a4=_0x34fe8e[_0x26aa54(0x149)][_0x26aa54(0x159)]['errors']>0x0||_0x34fe8e['counts']['knowledgeBases'][_0x26aa54(0xba)]>0x0||_0x34fe8e['counts'][_0x26aa54(0x15a)][_0x26aa54(0xba)]>0x0||_0x34fe8e[_0x26aa54(0x149)][_0x26aa54(0xcd)][_0x26aa54(0xba)]>0x0||_0x34fe8e[_0x26aa54(0x149)][_0x26aa54(0x154)][_0x26aa54(0xba)]>0x0||_0x34fe8e['counts'][_0x26aa54(0xd7)]['errors']>0x0;if(_0x38f0a4){console['log'](a4_0x3d8a18[_0x26aa54(0x100)](_0x26aa54(0x157))),console[_0x26aa54(0xf5)](),console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0x121)));for(const _0x324bad of _0x34fe8e[_0x26aa54(0x159)]){_0x324bad[_0x26aa54(0x16d)]===_0x26aa54(0x153)&&console[_0x26aa54(0xf5)](a4_0x3d8a18['red'](_0x26aa54(0x128)+_0x324bad['agentName']+'\x22:\x20'+_0x324bad[_0x26aa54(0x153)]));}for(const _0x8e3336 of _0x34fe8e['knowledgeBases']){_0x8e3336[_0x26aa54(0x16d)]===_0x26aa54(0x153)&&console[_0x26aa54(0xf5)](a4_0x3d8a18['red'](_0x26aa54(0x14b)+_0x8e3336[_0x26aa54(0x114)]+_0x26aa54(0x176)+_0x8e3336[_0x26aa54(0x153)]));}for(const _0x3ae8fa of _0x34fe8e[_0x26aa54(0x15a)]){_0x3ae8fa[_0x26aa54(0x16d)]===_0x26aa54(0x153)&&console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0x161)+_0x3ae8fa['name']+_0x26aa54(0x176)+_0x3ae8fa['error']));}for(const _0x1b9c26 of _0x34fe8e[_0x26aa54(0xcd)]){_0x1b9c26[_0x26aa54(0x16d)]===_0x26aa54(0x153)&&console[_0x26aa54(0xf5)](a4_0x3d8a18['red'](_0x26aa54(0xee)+_0x1b9c26[_0x26aa54(0x114)]+'\x22:\x20'+_0x1b9c26[_0x26aa54(0x153)]));}for(const _0x10a897 of _0x34fe8e[_0x26aa54(0xd9)]){_0x10a897[_0x26aa54(0x16d)]===_0x26aa54(0x153)&&console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0x116)+_0x10a897[_0x26aa54(0x114)]+'\x22:\x20'+_0x10a897[_0x26aa54(0x153)]));}for(const _0x4458e4 of _0x34fe8e['formInterfaces']){_0x4458e4[_0x26aa54(0x16d)]==='error'&&console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0x11a)+_0x4458e4[_0x26aa54(0x114)]+_0x26aa54(0x176)+_0x4458e4[_0x26aa54(0x153)]));}for(const _0x3bdf9c of _0x34fe8e[_0x26aa54(0xd7)]){_0x3bdf9c[_0x26aa54(0x16d)]==='error'&&console[_0x26aa54(0xf5)](a4_0x3d8a18[_0x26aa54(0x177)](_0x26aa54(0x10b)+_0x3bdf9c[_0x26aa54(0x114)]+_0x26aa54(0x176)+_0x3bdf9c[_0x26aa54(0x153)]));}return 0x1;}console['log'](a4_0x3d8a18[_0x26aa54(0xf9)](_0x26aa54(0x167)+(_0x5c233f+_0x9cc5c3)+_0x26aa54(0xf4)+_0x34fe8e['projectName']+'\x27'));const _0x15f0ba=getLLMProjectUrl(_0x599b92,_0x34fe8e[_0x26aa54(0x16c)]);return console[_0x26aa54(0xf5)]('Project:\x20'+a4_0x3d8a18[_0x26aa54(0xc9)](_0x15f0ba)),0x0;}}
1
+ const a4_0x22da09=a4_0x11c4;(function(_0x89ce98,_0x5c5633){const _0x645ac7=a4_0x11c4,_0x585f45=_0x89ce98();while(!![]){try{const _0x2fed2a=parseInt(_0x645ac7(0x1b2))/0x1*(-parseInt(_0x645ac7(0x1e5))/0x2)+parseInt(_0x645ac7(0x143))/0x3+parseInt(_0x645ac7(0x13a))/0x4+-parseInt(_0x645ac7(0x138))/0x5+-parseInt(_0x645ac7(0x171))/0x6+parseInt(_0x645ac7(0x1ac))/0x7*(parseInt(_0x645ac7(0x192))/0x8)+-parseInt(_0x645ac7(0x19d))/0x9*(-parseInt(_0x645ac7(0x18d))/0xa);if(_0x2fed2a===_0x5c5633)break;else _0x585f45['push'](_0x585f45['shift']());}catch(_0x2f29a7){_0x585f45['push'](_0x585f45['shift']());}}}(a4_0xcc15,0xca968));import a4_0x4cf241 from'chalk';import a4_0x1b2a22 from'path';import{existsSync,readFileSync}from'fs';function a4_0xcc15(){const _0x180805=['\x20--profile\x20','join','Using\x20project\x20from\x20context:\x20','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','Failed\x20to\x20push\x20agent:\x20','\x20\x20Form\x20Interface\x20\x22','\x20\x20Chat\x20Interfaces:\x20','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','context','knowledgeBases','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','integrations','\x0aChanges\x20to\x20form\x20interface\x20\x27','output','INVALID_ARGUMENT','4044504dOoVlC','\x20successfully','agentId','Project\x20cloned\x20successfully','Using\x20project:\x20','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','hasChanges','created','\x0aProject\x20pushed\x20with\x20errors','\x20\x20Prompts:\x20','parse','Agent:\x20','unchanged','Cloning\x20\x22','no_context','\x20\x20Agent\x20\x22','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','New\x20project\x20name\x20is\x20required','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20tdx\x20agent\x20pull\x20','formInterfaces','Cancelled','\x20--name\x20','-\x20nothing\x20pushed','\x20resources?','action','10xHPXDL','\x22...','force','Using\x20current\x20project:\x20','\x20\x20Knowledge\x20Bases:\x20','12000QoQnXN','yellow','repeat','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','llm','✔\x20Context\x20set:\x20','arg-dir','Output:\x20','yes','\x20\x20tdx\x20agent\x20clone\x20agents/','prompts','8251587ynULBy','pushAgent','errors','\x20files?','\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','\x22\x20to\x20a\x20different\x20profile','\x20\x20Form\x20Interfaces:\x20','Would\x20clone:','Chat:\x20','\x22:\x20','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','llmProject','\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','\x0aChanges\x20to\x20prompt\x20\x27','Status:\x20','5502jKfuyj','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x0aPush\x20summary\x20for\x20\x27','\x20|\x20','\x20resources\x20to\x20\x27','reason','6XvcVTs','name','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','agentName','\x20\x20Text\x20Knowledge\x20Base\x20\x22','session','Summary:','Analyzing\x20changes\x20to\x20push...','\x0aPush\x20','agent:clone','error','textKnowledgeBases','diff','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','projectId','\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)','\x0aChanges:','outputPath','total','cyan','dirname','\x20=\x20','execute','Cannot\x20clone\x20from\x20context\x20project\x20\x22','tdx.json','Errors:','\x20\x20Chat\x20Interface\x20\x22','\x0aChanges\x20to\x20chat\x20interface\x20\x27','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','dim','\x20\x20Agents:\x20','newProjectId','updated','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','chatInterfaces','gray','<new-name>','\x20total','newProjectName','\x20updated','Would\x20push\x20agent:\x20','\x20changed','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','Using\x20local\x20project:\x20','\x0aChanges\x20to\x20agent\x20\x27','pullProject','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','New\x20project:\x20','198236VZvbVp','\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','\x20\x20Prompt\x20\x22','\x20\x20Integration\x20\x22','agent:pull','\x0a✔\x20Pushed\x20','\x20\x20Source:\x20','log','\x20\x20Experimental\x20Artifact\x20\x22','\x20\x20Integrations:\x20','agent:push','experimentalKnowledgeBases','Project:\x20','no_local_folder','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','Agent\x20pulled\x20successfully','message','agents','\x20\x20Experimental\x20Artifacts:\x20','No\x20tdx.json\x20found\x20in\x20','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','7267280gmPmdp','\x0a✔\x20Pulled\x20','5045732yYfgzQ','projectName','pullAgent','\x20new','push','Source:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','-\x20no\x20files\x20written','isNew','584316kbyAAC','outputDir','\x22\x20from\x20project\x20\x22','red','dryRun','Using\x20project\x20from\x20','\x20unchanged','description','cwd-config','\x0aChanges\x20to\x20integration\x20\x27','Project\x20cloned\x20with\x20errors','Pushing\x20agent\x20from\x20\x22','llm_project','site','\x0aError:','\x20\x20Target:\x20','counts','Pulling\x20agent\x20\x22','experimentalArtifacts','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x22\x20to\x20\x22','new','\x20\x20Text\x20Knowledge\x20Bases:\x20','sourceProjectName','pushProject','cwd','Clone\x20\x22','\x20\x20Knowledge\x20Base\x20\x22','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','utf-8','green'];a4_0xcc15=function(){return _0x180805;};return a4_0xcc15();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';function a4_0x11c4(_0x342929,_0x3ed58e){_0x342929=_0x342929-0x124;const _0xcc1598=a4_0xcc15();let _0x11c4f0=_0xcc1598[_0x342929];return _0x11c4f0;}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(_0x114f84){const _0x59e6fe=a4_0x11c4,_0x39a7ff=[];if(_0x114f84['total']!==undefined)_0x39a7ff['push'](_0x114f84[_0x59e6fe(0x1c6)]+_0x59e6fe(0x1da));if(_0x114f84[_0x59e6fe(0x158)]!==undefined&&_0x114f84['new']>0x0)_0x39a7ff['push'](a4_0x4cf241[_0x59e6fe(0x161)](_0x114f84[_0x59e6fe(0x158)]+_0x59e6fe(0x13d)));if(_0x114f84[_0x59e6fe(0x179)]!==undefined&&_0x114f84[_0x59e6fe(0x179)]>0x0)_0x39a7ff[_0x59e6fe(0x13e)](a4_0x4cf241[_0x59e6fe(0x161)](_0x114f84['created']+'\x20created'));if(_0x114f84[_0x59e6fe(0x1d4)]!==undefined&&_0x114f84['updated']>0x0)_0x39a7ff['push'](a4_0x4cf241['yellow'](_0x114f84[_0x59e6fe(0x1d4)]+_0x59e6fe(0x1dc)));if(_0x114f84['unchanged']!==undefined&&_0x114f84[_0x59e6fe(0x17e)]>0x0)_0x39a7ff['push'](a4_0x4cf241[_0x59e6fe(0x1d8)](_0x114f84['unchanged']+_0x59e6fe(0x149)));if(_0x114f84[_0x59e6fe(0x19f)]!==undefined&&_0x114f84[_0x59e6fe(0x19f)]>0x0)_0x39a7ff[_0x59e6fe(0x13e)](a4_0x4cf241['red'](_0x114f84[_0x59e6fe(0x19f)]+'\x20errors'));return _0x39a7ff[_0x59e6fe(0x163)](',\x20');}function displayDiffs(_0x15ed97,_0x339940,_0x23ceeb,_0x1a1b81,_0x16027d,_0x279460,_0x5524a7,_0x165b50,_0x3a255d){const _0x3b14e6=a4_0x11c4;for(const _0x141171 of _0x15ed97){if(_0x141171[_0x3b14e6(0x1bf)]){const _0x225ff6=_0x141171['agentName']||_0x141171[_0x3b14e6(0x1b3)];console[_0x3b14e6(0x12a)](_0x3b14e6(0x1e1)+_0x225ff6+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x141171[_0x3b14e6(0x1bf)]),console['log']('─'[_0x3b14e6(0x194)](0x3c));}}for(const _0x277ad5 of _0x339940){_0x277ad5['diff']&&(console['log'](_0x3b14e6(0x156)+_0x277ad5[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console['log'](_0x277ad5[_0x3b14e6(0x1bf)]),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)));}for(const _0x469028 of _0x23ceeb){_0x469028[_0x3b14e6(0x1bf)]&&(console['log'](_0x3b14e6(0x16c)+_0x469028[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x469028[_0x3b14e6(0x1bf)]),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)));}for(const _0x134ed8 of _0x1a1b81){_0x134ed8[_0x3b14e6(0x1bf)]&&(console[_0x3b14e6(0x12a)](_0x3b14e6(0x1aa)+_0x134ed8[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x134ed8['diff']),console['log']('─'[_0x3b14e6(0x194)](0x3c)));}for(const _0x554d98 of _0x16027d){_0x554d98[_0x3b14e6(0x1bf)]&&(console['log'](_0x3b14e6(0x14c)+_0x554d98[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x554d98[_0x3b14e6(0x1bf)]),console['log']('─'['repeat'](0x3c)));}for(const _0x4256c8 of _0x279460){_0x4256c8[_0x3b14e6(0x1bf)]&&(console[_0x3b14e6(0x12a)]('\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27'+_0x4256c8[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x4256c8[_0x3b14e6(0x1bf)]),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)));}for(const _0x16ec10 of _0x5524a7){_0x16ec10['diff']&&(console[_0x3b14e6(0x12a)](_0x3b14e6(0x1d0)+_0x16ec10['name']+'\x27:'),console['log']('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x16ec10[_0x3b14e6(0x1bf)]),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)));}for(const _0xb298c8 of _0x165b50){_0xb298c8['diff']&&(console['log'](_0x3b14e6(0x16e)+_0xb298c8[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0xb298c8['diff']),console[_0x3b14e6(0x12a)]('─'['repeat'](0x3c)));}for(const _0x990e98 of _0x3a255d){_0x990e98['diff']&&(console['log'](_0x3b14e6(0x1cf)+_0x990e98[_0x3b14e6(0x1b3)]+'\x27:'),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)),console[_0x3b14e6(0x12a)](_0x990e98[_0x3b14e6(0x1bf)]),console[_0x3b14e6(0x12a)]('─'[_0x3b14e6(0x194)](0x3c)));}}export class AgentPullCommand extends BaseCommand{['name']=a4_0x22da09(0x127);[a4_0x22da09(0x14a)]=a4_0x22da09(0x1e3);async[a4_0x22da09(0x1ca)](_0x282b41){const _0x188842=a4_0x22da09,{options:_0x39392d,args:_0x3cca44,tdx:_0x23af4c}=_0x282b41,_0x3735fd=_0x3cca44[0x0],_0x5b7e55=_0x3cca44[0x1],_0x1b69e1=_0x39392d[_0x188842(0x16f)],_0x560954=_0x39392d[_0x188842(0x147)],_0xffead5=_0x39392d[_0x188842(0x18f)],_0x112459=_0x39392d[_0x188842(0x19a)],_0xd1be9d=_0x39392d[_0x188842(0x1a8)],_0x38eff5=_0x39392d['agent'];let _0x3b7950;if(_0x3735fd){const _0x317bb0=a4_0x1b2a22[_0x188842(0x163)](_0x3735fd,_0x188842(0x1cc));if(existsSync(_0x317bb0))try{const _0x10998d=JSON[_0x188842(0x17c)](readFileSync(_0x317bb0,_0x188842(0x160)));_0x10998d[_0x188842(0x14f)]&&(_0x3b7950={'llm_project':_0x10998d[_0x188842(0x14f)]});}catch{}}const _0x13ad54=findAgentConfigPath(process[_0x188842(0x15c)]());let _0x595f35;if(_0x13ad54)try{const _0x5f12a1=JSON[_0x188842(0x17c)](readFileSync(_0x13ad54,_0x188842(0x160)));_0x5f12a1[_0x188842(0x14f)]&&(_0x595f35={'llm_project':_0x5f12a1[_0x188842(0x14f)]});}catch{}const _0x337a4d=resolveAgentPullArgs({'arg':_0x3735fd,'agentNameArg':_0x5b7e55,'agentFlag':_0x38eff5,'contextProject':_0xd1be9d,'argDirConfig':_0x3b7950,'cwdConfigPath':_0x13ad54||undefined,'cwdConfig':_0x595f35}),{projectNameOrId:_0x44b86a,targetAgentName:_0x3e1dd2,existingOutputDir:_0x23a08b,source:_0x55832c}=_0x337a4d;if(_0x55832c===_0x188842(0x198))console[_0x188842(0x12a)](a4_0x4cf241['dim'](_0x188842(0x148)+a4_0x1b2a22[_0x188842(0x163)](_0x3735fd,_0x188842(0x1cc))+':\x20'+_0x44b86a));else{if(_0x55832c===_0x188842(0x14b))console[_0x188842(0x12a)](a4_0x4cf241[_0x188842(0x1d1)](_0x188842(0x175)+_0x44b86a));else _0x55832c==='context'&&console['log'](a4_0x4cf241[_0x188842(0x1d1)](_0x188842(0x164)+_0x44b86a));}if(!_0x44b86a)return _0x38eff5?(console['log'](a4_0x4cf241[_0x188842(0x193)]('The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a')),console['log'](_0x188842(0x131)),console[_0x188842(0x12a)](_0x188842(0x165))):(console['log'](a4_0x4cf241['yellow'](_0x188842(0x1b5))),console['log']('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[_0x188842(0x12a)](_0x188842(0x1a1)),console[_0x188842(0x12a)](_0x188842(0x124)),console[_0x188842(0x12a)](_0x188842(0x1a9)),console[_0x188842(0x12a)]('\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')),0x1;if(_0x3e1dd2){const {data:_0x86befd}=await withSpinner(_0x188842(0x154)+_0x3e1dd2+_0x188842(0x145)+_0x44b86a+_0x188842(0x18e),()=>_0x23af4c['llm'][_0x188842(0x13c)](_0x44b86a,_0x3e1dd2,_0x1b69e1,{'dryRun':_0x560954,'force':_0xffead5}));if(_0x560954)return console['log'](a4_0x4cf241[_0x188842(0x193)]('Dry\x20run\x20-\x20no\x20files\x20written')),console['log']('Would\x20pull\x20agent:\x20'+_0x86befd[_0x188842(0x1b6)]),console[_0x188842(0x12a)]('Output\x20path:\x20'+_0x86befd[_0x188842(0x1c5)]),_0x86befd[_0x188842(0x1bf)]&&(console[_0x188842(0x12a)](_0x188842(0x1c4)),console[_0x188842(0x12a)]('─'[_0x188842(0x194)](0x3c)),console['log'](_0x86befd['diff']),console['log']('─'[_0x188842(0x194)](0x3c))),0x0;return console['log'](a4_0x4cf241[_0x188842(0x161)](_0x188842(0x132))),console[_0x188842(0x12a)](_0x188842(0x17d)+_0x86befd[_0x188842(0x1b6)]),console[_0x188842(0x12a)](_0x188842(0x199)+_0x86befd['outputPath']),console[_0x188842(0x12a)](_0x188842(0x1ab)+(_0x86befd[_0x188842(0x142)]?a4_0x4cf241[_0x188842(0x161)](_0x188842(0x158)):_0x86befd[_0x188842(0x178)]?a4_0x4cf241[_0x188842(0x193)](_0x188842(0x1d4)):a4_0x4cf241['gray']('unchanged'))),0x0;}const _0x4c1c99=_0x23a08b||_0x1b69e1,{data:_0x35a527}=await withSpinner('Analyzing\x20project\x20\x22'+_0x44b86a+'\x22...',()=>_0x23af4c[_0x188842(0x196)][_0x188842(0x1e2)](_0x44b86a,_0x4c1c99,{'dryRun':!![]})),_0x32c147=_0x35a527[_0x188842(0x153)][_0x188842(0x134)][_0x188842(0x158)]+_0x35a527[_0x188842(0x153)]['knowledgeBases']['new']+_0x35a527[_0x188842(0x153)][_0x188842(0x1be)][_0x188842(0x158)]+_0x35a527[_0x188842(0x153)][_0x188842(0x19c)]['new']+_0x35a527[_0x188842(0x153)][_0x188842(0x16d)][_0x188842(0x158)]+_0x35a527['counts'][_0x188842(0x12e)][_0x188842(0x158)]+_0x35a527['counts'][_0x188842(0x155)][_0x188842(0x158)]+_0x35a527[_0x188842(0x153)][_0x188842(0x187)]['new']+_0x35a527[_0x188842(0x153)][_0x188842(0x1d7)][_0x188842(0x158)],_0xcd7b60=_0x35a527['counts'][_0x188842(0x134)][_0x188842(0x1d4)]+_0x35a527['counts'][_0x188842(0x16b)]['updated']+_0x35a527[_0x188842(0x153)][_0x188842(0x1be)]['updated']+_0x35a527[_0x188842(0x153)][_0x188842(0x19c)][_0x188842(0x1d4)]+_0x35a527[_0x188842(0x153)][_0x188842(0x16d)][_0x188842(0x1d4)]+_0x35a527['counts'][_0x188842(0x12e)][_0x188842(0x1d4)]+_0x35a527[_0x188842(0x153)][_0x188842(0x155)][_0x188842(0x1d4)]+_0x35a527['counts']['formInterfaces'][_0x188842(0x1d4)]+_0x35a527['counts'][_0x188842(0x1d7)][_0x188842(0x1d4)],_0x31bbef=_0x35a527['counts'][_0x188842(0x134)][_0x188842(0x17e)]+_0x35a527[_0x188842(0x153)][_0x188842(0x16b)]['unchanged']+_0x35a527[_0x188842(0x153)][_0x188842(0x1be)][_0x188842(0x17e)]+_0x35a527[_0x188842(0x153)][_0x188842(0x19c)][_0x188842(0x17e)]+_0x35a527[_0x188842(0x153)][_0x188842(0x16d)][_0x188842(0x17e)]+_0x35a527[_0x188842(0x153)][_0x188842(0x12e)]['unchanged']+_0x35a527[_0x188842(0x153)][_0x188842(0x155)]['unchanged']+_0x35a527[_0x188842(0x153)][_0x188842(0x187)]['unchanged']+_0x35a527[_0x188842(0x153)][_0x188842(0x1d7)][_0x188842(0x17e)];console[_0x188842(0x12a)]('\x0aPull\x20summary\x20for\x20\x27'+_0x35a527[_0x188842(0x13b)]+'\x27:'),console['log']('\x20\x20'+a4_0x4cf241[_0x188842(0x161)]('+\x20'+_0x32c147+'\x20new')+'\x20|\x20'+a4_0x4cf241[_0x188842(0x193)]('~\x20'+_0xcd7b60+_0x188842(0x1de))+_0x188842(0x1af)+a4_0x4cf241[_0x188842(0x1d1)]('=\x20'+_0x31bbef+_0x188842(0x149))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x35a527[_0x188842(0x153)]['agents'])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x35a527['counts'][_0x188842(0x16b)])),console['log'](_0x188842(0x159)+formatCountSummary(_0x35a527[_0x188842(0x153)][_0x188842(0x1be)])),console['log'](_0x188842(0x17b)+formatCountSummary(_0x35a527[_0x188842(0x153)][_0x188842(0x19c)])),console[_0x188842(0x12a)](_0x188842(0x12c)+formatCountSummary(_0x35a527[_0x188842(0x153)]['integrations'])),console['log'](_0x188842(0x1a3)+formatCountSummary(_0x35a527[_0x188842(0x153)][_0x188842(0x187)])),console[_0x188842(0x12a)]('\x20\x20Chat\x20Interfaces:\x20'+formatCountSummary(_0x35a527['counts'][_0x188842(0x1d7)]));const _0x2d676e=_0x35a527[_0x188842(0x153)][_0x188842(0x12e)][_0x188842(0x1c6)]>0x0||_0x35a527['counts'][_0x188842(0x155)]['total']>0x0;_0x2d676e&&(console[_0x188842(0x12a)](_0x188842(0x183)+formatCountSummary(_0x35a527[_0x188842(0x153)][_0x188842(0x12e)])),console[_0x188842(0x12a)](_0x188842(0x135)+formatCountSummary(_0x35a527['counts'][_0x188842(0x155)])));console['log'](_0x188842(0x152)+a4_0x4cf241['cyan'](_0x35a527[_0x188842(0x144)])),displayDiffs(_0x35a527[_0x188842(0x134)],_0x35a527['knowledgeBases'],_0x35a527[_0x188842(0x1be)],_0x35a527[_0x188842(0x19c)],_0x35a527[_0x188842(0x16d)],_0x35a527[_0x188842(0x12e)],_0x35a527['experimentalArtifacts'],_0x35a527[_0x188842(0x187)],_0x35a527[_0x188842(0x1d7)]);if(_0x560954)return console[_0x188842(0x12a)](a4_0x4cf241[_0x188842(0x193)](_0x188842(0x1b4))),0x0;if(_0x32c147===0x0&&_0xcd7b60===0x0)return console['log'](a4_0x4cf241[_0x188842(0x161)](_0x188842(0x177))),saveSessionContext({'llm_project':_0x35a527[_0x188842(0x13b)]},_0x39392d[_0x188842(0x1b8)]),console[_0x188842(0x12a)](a4_0x4cf241[_0x188842(0x161)](_0x188842(0x197)+a4_0x4cf241['dim']('llm_project')+_0x188842(0x1c9)+a4_0x4cf241[_0x188842(0x1c7)](_0x35a527[_0x188842(0x13b)]))),0x0;if(!_0x112459&&!_0xffead5){if(!isInteractive())return console[_0x188842(0x1bd)](a4_0x4cf241['red'](_0x188842(0x151)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x188842(0x1bd)](a4_0x4cf241[_0x188842(0x1d1)](_0x188842(0x1ad))),0x1;const _0x33e7a0=await confirmKey('\x0aWrite\x20'+(_0x32c147+_0xcd7b60)+_0x188842(0x1a0));if(!_0x33e7a0)return console[_0x188842(0x12a)](a4_0x4cf241[_0x188842(0x193)](_0x188842(0x188)),_0x188842(0x141)),0x1;}const {data:_0x77de1c}=await withSpinner('Writing\x20files...',()=>_0x23af4c['llm'][_0x188842(0x1e2)](_0x44b86a,_0x4c1c99,{'force':_0xffead5}));return console[_0x188842(0x12a)](a4_0x4cf241[_0x188842(0x161)](_0x188842(0x139)+(_0x32c147+_0xcd7b60)+'\x20files\x20to\x20'+_0x77de1c[_0x188842(0x144)])),saveSessionContext({'llm_project':_0x77de1c[_0x188842(0x13b)]},_0x39392d[_0x188842(0x1b8)]),console[_0x188842(0x12a)](a4_0x4cf241[_0x188842(0x161)](_0x188842(0x197)+a4_0x4cf241['dim'](_0x188842(0x14f))+_0x188842(0x1c9)+a4_0x4cf241[_0x188842(0x1c7)](_0x77de1c[_0x188842(0x13b)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x22da09(0x1b3)]=a4_0x22da09(0x1bc);[a4_0x22da09(0x14a)]=a4_0x22da09(0x1c0);async[a4_0x22da09(0x1ca)](_0x914e31){const _0x283b3f=a4_0x22da09,{options:_0x251c22,args:_0x5004a6,tdx:_0x30cc75}=_0x914e31,_0x2f566e=_0x5004a6[0x0],_0x21504f=_0x251c22[_0x283b3f(0x1b3)],_0x14e17f=_0x251c22['dryRun'],_0x10506b=_0x251c22[_0x283b3f(0x19a)],_0x1d5f2c=_0x251c22[_0x283b3f(0x150)],_0x29ec85=_0x251c22[_0x283b3f(0x1a8)];let _0x107364;const _0x32377b=findAgentConfigPath(process['cwd']());if(_0x2f566e){const _0x5352cf=a4_0x1b2a22[_0x283b3f(0x163)](_0x2f566e,_0x283b3f(0x1cc));existsSync(_0x5352cf)?(_0x107364=_0x2f566e,console[_0x283b3f(0x12a)](a4_0x4cf241['dim'](_0x283b3f(0x1e0)+_0x2f566e))):_0x107364=_0x2f566e;}else{if(_0x32377b)_0x107364=a4_0x1b2a22[_0x283b3f(0x1c8)](_0x32377b),console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x1d1)](_0x283b3f(0x190)+_0x107364));else{if(_0x29ec85){const _0x2d9745=sanitizeForFilesystem(_0x29ec85);let _0x17b619=_0x2d9745,_0x1d2361=a4_0x1b2a22['join'](process[_0x283b3f(0x15c)](),_0x283b3f(0x134),_0x2d9745,_0x283b3f(0x1cc));if(!existsSync(_0x1d2361)){const _0x44c64e=normalizeName(_0x29ec85),_0x45c730=a4_0x1b2a22[_0x283b3f(0x163)](process[_0x283b3f(0x15c)](),_0x283b3f(0x134),_0x44c64e,_0x283b3f(0x1cc));existsSync(_0x45c730)&&(_0x17b619=_0x44c64e,_0x1d2361=_0x45c730);}if(existsSync(_0x1d2361))_0x107364=a4_0x1b2a22[_0x283b3f(0x1c8)](_0x1d2361),console['log'](a4_0x4cf241['dim']('Using\x20local\x20project:\x20'+_0x107364));else{const _0x51a657=_0x251c22['profile'];if(_0x51a657)throw new SDKError(ErrorCode[_0x283b3f(0x170)],_0x283b3f(0x1cb)+_0x29ec85+_0x283b3f(0x1a2),undefined,{'helpText':_0x283b3f(0x1a7)+_0x283b3f(0x15f)+(_0x283b3f(0x186)+_0x29ec85+'\x0a')+(_0x283b3f(0x19b)+_0x17b619+_0x283b3f(0x189)+(_0x21504f||_0x283b3f(0x1d9))+_0x283b3f(0x162)+_0x51a657)});_0x107364=_0x29ec85,console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x1d1)]('Using\x20context\x20project:\x20'+_0x29ec85));}}}}if(!_0x107364)return console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x193)](_0x283b3f(0x182))),console[_0x283b3f(0x12a)](_0x283b3f(0x169)),console[_0x283b3f(0x12a)](_0x283b3f(0x1c1)),console[_0x283b3f(0x12a)](_0x283b3f(0x1c3)),console[_0x283b3f(0x12a)](_0x283b3f(0x195)),0x1;if(!_0x21504f)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x283b3f(0x184),undefined,{'helpText':_0x283b3f(0x1d6)});if(!_0x10506b&&!_0x14e17f){if(!isInteractive())return console[_0x283b3f(0x1bd)](a4_0x4cf241['red'](_0x283b3f(0x151)),_0x283b3f(0x140)),console['error'](a4_0x4cf241[_0x283b3f(0x1d1)](_0x283b3f(0x1ad))),0x1;const _0x3018ec=await confirmKey(_0x283b3f(0x15d)+_0x107364+'\x22\x20to\x20new\x20project\x20\x22'+_0x21504f+'\x22?');if(!_0x3018ec)return console['log'](a4_0x4cf241['yellow'](_0x283b3f(0x188))),0x1;}const {data:_0x41e2cc}=await withSpinner(_0x283b3f(0x17f)+_0x107364+_0x283b3f(0x157)+_0x21504f+_0x283b3f(0x18e),()=>_0x30cc75[_0x283b3f(0x196)]['cloneProject'](_0x107364,_0x21504f,{'dryRun':_0x14e17f}));if(_0x14e17f){console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x193)](_0x283b3f(0x185))),console[_0x283b3f(0x12a)](_0x283b3f(0x13f)+_0x41e2cc[_0x283b3f(0x15a)]),console['log'](_0x283b3f(0x1e4)+_0x21504f),console[_0x283b3f(0x12a)](_0x283b3f(0x1a4)),console['log'](_0x283b3f(0x1d2)+_0x41e2cc['counts'][_0x283b3f(0x134)][_0x283b3f(0x179)]),console[_0x283b3f(0x12a)](_0x283b3f(0x191)+_0x41e2cc['counts'][_0x283b3f(0x16b)][_0x283b3f(0x179)]),console[_0x283b3f(0x12a)](_0x283b3f(0x17b)+_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x19c)][_0x283b3f(0x179)]),console[_0x283b3f(0x12a)](_0x283b3f(0x1a3)+_0x41e2cc['counts']['formInterfaces']['created']),console[_0x283b3f(0x12a)](_0x283b3f(0x168)+_0x41e2cc[_0x283b3f(0x153)]['chatInterfaces'][_0x283b3f(0x179)]);const _0x979f7a=_0x41e2cc[_0x283b3f(0x153)]['experimentalKnowledgeBases'][_0x283b3f(0x179)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x155)][_0x283b3f(0x179)]>0x0;return _0x979f7a&&(console[_0x283b3f(0x12a)](_0x283b3f(0x183)+_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x12e)][_0x283b3f(0x179)]),console[_0x283b3f(0x12a)](_0x283b3f(0x135)+_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x155)][_0x283b3f(0x179)])),0x0;}const _0x1924b4=_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x134)][_0x283b3f(0x19f)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x16b)][_0x283b3f(0x19f)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x19c)][_0x283b3f(0x19f)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x187)][_0x283b3f(0x19f)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x1d7)][_0x283b3f(0x19f)]>0x0||_0x41e2cc[_0x283b3f(0x153)]['experimentalKnowledgeBases'][_0x283b3f(0x19f)]>0x0||_0x41e2cc['counts']['experimentalArtifacts'][_0x283b3f(0x19f)]>0x0;_0x1924b4?console['log'](a4_0x4cf241[_0x283b3f(0x193)](_0x283b3f(0x14d))):console['log'](a4_0x4cf241[_0x283b3f(0x161)](_0x283b3f(0x174)));console[_0x283b3f(0x12a)](_0x283b3f(0x13f)+_0x41e2cc[_0x283b3f(0x15a)]),console[_0x283b3f(0x12a)]('New\x20project:\x20'+_0x41e2cc[_0x283b3f(0x1db)]),console[_0x283b3f(0x12a)]('New\x20project\x20ID:\x20'+_0x41e2cc[_0x283b3f(0x1d3)]),console[_0x283b3f(0x12a)](),console[_0x283b3f(0x12a)](_0x283b3f(0x1b9)),console[_0x283b3f(0x12a)](_0x283b3f(0x1d2)+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x134)])),console[_0x283b3f(0x12a)](_0x283b3f(0x191)+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x16b)])),console[_0x283b3f(0x12a)](_0x283b3f(0x17b)+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x19c)])),console[_0x283b3f(0x12a)](_0x283b3f(0x12c)+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x16d)])),console['log'](_0x283b3f(0x1a3)+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x187)])),console[_0x283b3f(0x12a)]('\x20\x20Chat\x20Interfaces:\x20'+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x1d7)]));const _0x1d8a9f=_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x12e)]['created']>0x0||_0x41e2cc['counts'][_0x283b3f(0x12e)][_0x283b3f(0x1d4)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x12e)][_0x283b3f(0x17e)]>0x0||_0x41e2cc[_0x283b3f(0x153)]['experimentalArtifacts']['created']>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x155)][_0x283b3f(0x1d4)]>0x0||_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x155)][_0x283b3f(0x17e)]>0x0;_0x1d8a9f&&(console[_0x283b3f(0x12a)](_0x283b3f(0x183)+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)]['experimentalKnowledgeBases'])),console[_0x283b3f(0x12a)]('\x20\x20Experimental\x20Artifacts:\x20'+formatCountSummary(_0x41e2cc[_0x283b3f(0x153)][_0x283b3f(0x155)])));if(_0x1924b4){console[_0x283b3f(0x12a)](),console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x1cd)));for(const _0x3ad28f of _0x41e2cc[_0x283b3f(0x134)]){_0x3ad28f[_0x283b3f(0x18c)]===_0x283b3f(0x1bd)&&console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x181)+_0x3ad28f['agentName']+_0x283b3f(0x1a6)+_0x3ad28f['error']));}for(const _0x2b3514 of _0x41e2cc[_0x283b3f(0x16b)]){_0x2b3514[_0x283b3f(0x18c)]===_0x283b3f(0x1bd)&&console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x15e)+_0x2b3514['name']+_0x283b3f(0x1a6)+_0x2b3514['error']));}for(const _0x43694b of _0x41e2cc[_0x283b3f(0x19c)]){_0x43694b['action']===_0x283b3f(0x1bd)&&console['log'](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x125)+_0x43694b['name']+'\x22:\x20'+_0x43694b[_0x283b3f(0x1bd)]));}for(const _0x41f3c7 of _0x41e2cc[_0x283b3f(0x16d)]){_0x41f3c7[_0x283b3f(0x18c)]===_0x283b3f(0x1bd)&&console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x126)+_0x41f3c7['name']+'\x22:\x20'+_0x41f3c7[_0x283b3f(0x1bd)]));}for(const _0x58b1aa of _0x41e2cc[_0x283b3f(0x187)]){_0x58b1aa[_0x283b3f(0x18c)]==='error'&&console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x167)+_0x58b1aa[_0x283b3f(0x1b3)]+_0x283b3f(0x1a6)+_0x58b1aa['error']));}for(const _0x57c353 of _0x41e2cc[_0x283b3f(0x1d7)]){_0x57c353[_0x283b3f(0x18c)]===_0x283b3f(0x1bd)&&console[_0x283b3f(0x12a)](a4_0x4cf241['red']('\x20\x20Chat\x20Interface\x20\x22'+_0x57c353[_0x283b3f(0x1b3)]+_0x283b3f(0x1a6)+_0x57c353[_0x283b3f(0x1bd)]));}for(const _0x52794a of _0x41e2cc['experimentalKnowledgeBases']){_0x52794a[_0x283b3f(0x18c)]===_0x283b3f(0x1bd)&&console['log'](a4_0x4cf241['red']('\x20\x20Experimental\x20Knowledge\x20Base\x20\x22'+_0x52794a[_0x283b3f(0x1b3)]+_0x283b3f(0x1a6)+_0x52794a[_0x283b3f(0x1bd)]));}for(const _0x8c5139 of _0x41e2cc[_0x283b3f(0x155)]){_0x8c5139['action']==='error'&&console[_0x283b3f(0x12a)](a4_0x4cf241[_0x283b3f(0x146)](_0x283b3f(0x12b)+_0x8c5139['name']+'\x22:\x20'+_0x8c5139[_0x283b3f(0x1bd)]));}return 0x1;}console[_0x283b3f(0x12a)]();const _0x334def=getLLMProjectUrl(_0x1d5f2c,_0x41e2cc[_0x283b3f(0x1d3)]);return console[_0x283b3f(0x12a)](_0x283b3f(0x12f)+a4_0x4cf241[_0x283b3f(0x1c7)](_0x334def)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x22da09(0x1b3)]=a4_0x22da09(0x12d);['description']=a4_0x22da09(0x176);async[a4_0x22da09(0x1ca)](_0xda7538){const _0x6f0805=a4_0x22da09,{options:_0xad6dd9,args:_0x390a58,tdx:_0x46f8d9}=_0xda7538;let _0x4b16f2=_0x390a58[0x0]||process['cwd']();const _0x569cc4=_0xad6dd9[_0x6f0805(0x147)],_0x1368dc=_0xad6dd9[_0x6f0805(0x18f)],_0x48f67d=_0xad6dd9[_0x6f0805(0x19a)],_0x19048d=_0xad6dd9[_0x6f0805(0x150)],_0x3a4a91=a4_0x1b2a22[_0x6f0805(0x163)](_0x4b16f2,'agent.yml'),_0x5882f3=existsSync(_0x3a4a91);if(_0x5882f3){const {data:_0x1e2ce2}=await withSpinner(_0x6f0805(0x14e)+_0x4b16f2+_0x6f0805(0x18e),()=>_0x46f8d9[_0x6f0805(0x196)][_0x6f0805(0x19e)](_0x4b16f2,{'dryRun':_0x569cc4,'force':_0x1368dc}));if(_0x569cc4)return console[_0x6f0805(0x12a)](a4_0x4cf241[_0x6f0805(0x193)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console[_0x6f0805(0x12a)](_0x6f0805(0x1dd)+_0x1e2ce2['agentName']),0x0;if(_0x1e2ce2['action']===_0x6f0805(0x1bd))return console[_0x6f0805(0x12a)](a4_0x4cf241[_0x6f0805(0x146)](_0x6f0805(0x166)+_0x1e2ce2['error'])),0x1;console[_0x6f0805(0x12a)](a4_0x4cf241['green']('Agent\x20'+_0x1e2ce2['action']+_0x6f0805(0x172))),console[_0x6f0805(0x12a)]('Agent:\x20'+_0x1e2ce2['agentName']);if(_0x1e2ce2[_0x6f0805(0x173)]&&_0x1e2ce2[_0x6f0805(0x1c2)]){const _0x132d54=getLLMAgentChatUrl(_0x19048d,_0x1e2ce2['projectId'],_0x1e2ce2[_0x6f0805(0x173)]);console[_0x6f0805(0x12a)](_0x6f0805(0x1a5)+a4_0x4cf241[_0x6f0805(0x1c7)](_0x132d54));}return 0x0;}const _0x79e776=_0xad6dd9[_0x6f0805(0x1a8)],_0x5f1fe3=resolveProjectFromContext(_0x4b16f2,_0x79e776);if(_0x5f1fe3['found'])_0x4b16f2=_0x5f1fe3['projectDir'],_0x5f1fe3['source']===_0x6f0805(0x16a)&&console['log'](a4_0x4cf241['dim'](_0x6f0805(0x175)+_0x4b16f2));else{let _0x6a1bbc=_0x6f0805(0x1df);_0x5f1fe3[_0x6f0805(0x1b1)]===_0x6f0805(0x130)&&(_0x6a1bbc=_0x5f1fe3[_0x6f0805(0x133)]+_0x6f0805(0x137)+_0x5f1fe3['llmProject']+'\x27\x20to\x20create\x20the\x20folder\x20structure.');throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5f1fe3[_0x6f0805(0x1b1)]===_0x6f0805(0x180)?_0x5f1fe3[_0x6f0805(0x133)]:_0x6f0805(0x136)+_0x4b16f2,undefined,{'helpText':_0x6a1bbc});}const {data:_0x599b04}=await withSpinner(_0x6f0805(0x1ba),()=>_0x46f8d9[_0x6f0805(0x196)][_0x6f0805(0x15b)](_0x4b16f2,{'dryRun':!![]})),_0x1bf5c6=_0x599b04['counts'][_0x6f0805(0x134)][_0x6f0805(0x19f)]>0x0;if(_0x1bf5c6){console[_0x6f0805(0x12a)](a4_0x4cf241['red']('\x0aErrors\x20found:'));for(const _0x2cd19e of _0x599b04['agents']){_0x2cd19e[_0x6f0805(0x18c)]===_0x6f0805(0x1bd)&&console['log'](a4_0x4cf241[_0x6f0805(0x146)](_0x6f0805(0x181)+_0x2cd19e['agentName']+_0x6f0805(0x1a6)+_0x2cd19e[_0x6f0805(0x1bd)]));}return 0x1;}const _0x3845c0=_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x134)][_0x6f0805(0x179)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x16b)][_0x6f0805(0x179)]+_0x599b04['counts'][_0x6f0805(0x1be)]['created']+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x19c)][_0x6f0805(0x179)]+_0x599b04[_0x6f0805(0x153)]['integrations'][_0x6f0805(0x179)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x12e)]['created']+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x155)][_0x6f0805(0x179)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x187)][_0x6f0805(0x179)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x1d7)][_0x6f0805(0x179)],_0x491619=_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x134)][_0x6f0805(0x1d4)]+_0x599b04['counts'][_0x6f0805(0x16b)][_0x6f0805(0x1d4)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x1be)][_0x6f0805(0x1d4)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x19c)]['updated']+_0x599b04[_0x6f0805(0x153)]['integrations'][_0x6f0805(0x1d4)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x12e)][_0x6f0805(0x1d4)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x155)][_0x6f0805(0x1d4)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x187)][_0x6f0805(0x1d4)]+_0x599b04[_0x6f0805(0x153)]['chatInterfaces'][_0x6f0805(0x1d4)],_0x1fd967=_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x134)][_0x6f0805(0x17e)]+_0x599b04[_0x6f0805(0x153)]['knowledgeBases'][_0x6f0805(0x17e)]+_0x599b04[_0x6f0805(0x153)]['textKnowledgeBases']['unchanged']+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x19c)][_0x6f0805(0x17e)]+_0x599b04[_0x6f0805(0x153)]['integrations'][_0x6f0805(0x17e)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x12e)][_0x6f0805(0x17e)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x155)]['unchanged']+_0x599b04['counts'][_0x6f0805(0x187)][_0x6f0805(0x17e)]+_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x1d7)]['unchanged'];console['log'](_0x6f0805(0x1ae)+_0x599b04[_0x6f0805(0x13b)]+'\x27:'),console['log']('\x20\x20'+a4_0x4cf241[_0x6f0805(0x161)]('+\x20'+_0x3845c0+_0x6f0805(0x13d))+'\x20|\x20'+a4_0x4cf241['yellow']('~\x20'+_0x491619+_0x6f0805(0x1de))+_0x6f0805(0x1af)+a4_0x4cf241[_0x6f0805(0x1d1)]('=\x20'+_0x1fd967+'\x20unchanged')),console['log'](_0x6f0805(0x1d2)+formatCountSummary(_0x599b04[_0x6f0805(0x153)]['agents'])),console[_0x6f0805(0x12a)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x599b04[_0x6f0805(0x153)]['knowledgeBases'])),console[_0x6f0805(0x12a)](_0x6f0805(0x159)+formatCountSummary(_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x1be)])),console['log'](_0x6f0805(0x17b)+formatCountSummary(_0x599b04['counts'][_0x6f0805(0x19c)])),console[_0x6f0805(0x12a)](_0x6f0805(0x12c)+formatCountSummary(_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x16d)])),console[_0x6f0805(0x12a)]('\x20\x20Form\x20Interfaces:\x20'+formatCountSummary(_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x187)])),console['log'](_0x6f0805(0x168)+formatCountSummary(_0x599b04['counts'][_0x6f0805(0x1d7)]));const _0x98e2dc=_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x12e)][_0x6f0805(0x179)]>0x0||_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x12e)][_0x6f0805(0x1d4)]>0x0||_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x12e)]['unchanged']>0x0||_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x155)]['created']>0x0||_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x155)]['updated']>0x0||_0x599b04[_0x6f0805(0x153)]['experimentalArtifacts'][_0x6f0805(0x17e)]>0x0;_0x98e2dc&&(console[_0x6f0805(0x12a)](_0x6f0805(0x183)+formatCountSummary(_0x599b04[_0x6f0805(0x153)]['experimentalKnowledgeBases'])),console[_0x6f0805(0x12a)](_0x6f0805(0x135)+formatCountSummary(_0x599b04[_0x6f0805(0x153)][_0x6f0805(0x155)])));console[_0x6f0805(0x12a)](_0x6f0805(0x129)+a4_0x4cf241[_0x6f0805(0x1c7)](_0x4b16f2)),displayDiffs(_0x599b04[_0x6f0805(0x134)],_0x599b04[_0x6f0805(0x16b)],_0x599b04[_0x6f0805(0x1be)],_0x599b04[_0x6f0805(0x19c)],_0x599b04['integrations'],_0x599b04[_0x6f0805(0x12e)],_0x599b04[_0x6f0805(0x155)],_0x599b04[_0x6f0805(0x187)],_0x599b04[_0x6f0805(0x1d7)]);if(_0x569cc4)return console['log'](a4_0x4cf241[_0x6f0805(0x193)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x3845c0===0x0&&_0x491619===0x0){console['log'](a4_0x4cf241[_0x6f0805(0x161)](_0x6f0805(0x1d5)));const _0x3f2ac5=getLLMProjectUrl(_0x19048d,_0x599b04[_0x6f0805(0x1c2)]);return console[_0x6f0805(0x12a)](_0x6f0805(0x12f)+a4_0x4cf241['cyan'](_0x3f2ac5)),0x0;}if(!_0x48f67d&&!_0x1368dc){if(!isInteractive())return console[_0x6f0805(0x1bd)](a4_0x4cf241[_0x6f0805(0x146)](_0x6f0805(0x151)),_0x6f0805(0x140)),console['error'](a4_0x4cf241['dim'](_0x6f0805(0x1ad))),0x1;const _0x4874b0=await confirmKey(_0x6f0805(0x1bb)+(_0x3845c0+_0x491619)+_0x6f0805(0x18b));if(!_0x4874b0)return console[_0x6f0805(0x12a)](a4_0x4cf241[_0x6f0805(0x193)]('Cancelled'),_0x6f0805(0x18a)),0x1;}const {data:_0x2dfdaf}=await withSpinner('Pushing\x20to\x20project...',()=>_0x46f8d9[_0x6f0805(0x196)][_0x6f0805(0x15b)](_0x4b16f2,{'force':_0x1368dc})),_0x802148=_0x2dfdaf[_0x6f0805(0x153)][_0x6f0805(0x134)][_0x6f0805(0x19f)]>0x0||_0x2dfdaf[_0x6f0805(0x153)]['knowledgeBases']['errors']>0x0||_0x2dfdaf['counts']['textKnowledgeBases'][_0x6f0805(0x19f)]>0x0||_0x2dfdaf[_0x6f0805(0x153)][_0x6f0805(0x19c)][_0x6f0805(0x19f)]>0x0||_0x2dfdaf[_0x6f0805(0x153)]['formInterfaces']['errors']>0x0||_0x2dfdaf[_0x6f0805(0x153)]['chatInterfaces'][_0x6f0805(0x19f)]>0x0;if(_0x802148){console[_0x6f0805(0x12a)](a4_0x4cf241['yellow'](_0x6f0805(0x17a))),console[_0x6f0805(0x12a)](),console[_0x6f0805(0x12a)](a4_0x4cf241['red']('Errors:'));for(const _0xedeee9 of _0x2dfdaf[_0x6f0805(0x134)]){_0xedeee9[_0x6f0805(0x18c)]==='error'&&console['log'](a4_0x4cf241[_0x6f0805(0x146)](_0x6f0805(0x181)+_0xedeee9['agentName']+'\x22:\x20'+_0xedeee9[_0x6f0805(0x1bd)]));}for(const _0x4a2107 of _0x2dfdaf[_0x6f0805(0x16b)]){_0x4a2107[_0x6f0805(0x18c)]===_0x6f0805(0x1bd)&&console[_0x6f0805(0x12a)](a4_0x4cf241['red'](_0x6f0805(0x15e)+_0x4a2107[_0x6f0805(0x1b3)]+_0x6f0805(0x1a6)+_0x4a2107[_0x6f0805(0x1bd)]));}for(const _0x4d495e of _0x2dfdaf[_0x6f0805(0x1be)]){_0x4d495e['action']===_0x6f0805(0x1bd)&&console[_0x6f0805(0x12a)](a4_0x4cf241[_0x6f0805(0x146)](_0x6f0805(0x1b7)+_0x4d495e[_0x6f0805(0x1b3)]+_0x6f0805(0x1a6)+_0x4d495e['error']));}for(const _0x17aabd of _0x2dfdaf[_0x6f0805(0x19c)]){_0x17aabd[_0x6f0805(0x18c)]==='error'&&console[_0x6f0805(0x12a)](a4_0x4cf241[_0x6f0805(0x146)]('\x20\x20Prompt\x20\x22'+_0x17aabd[_0x6f0805(0x1b3)]+_0x6f0805(0x1a6)+_0x17aabd[_0x6f0805(0x1bd)]));}for(const _0x5e55c6 of _0x2dfdaf[_0x6f0805(0x16d)]){_0x5e55c6['action']==='error'&&console[_0x6f0805(0x12a)](a4_0x4cf241['red'](_0x6f0805(0x126)+_0x5e55c6[_0x6f0805(0x1b3)]+_0x6f0805(0x1a6)+_0x5e55c6[_0x6f0805(0x1bd)]));}for(const _0x5b0cd8 of _0x2dfdaf[_0x6f0805(0x187)]){_0x5b0cd8['action']===_0x6f0805(0x1bd)&&console[_0x6f0805(0x12a)](a4_0x4cf241[_0x6f0805(0x146)](_0x6f0805(0x167)+_0x5b0cd8[_0x6f0805(0x1b3)]+'\x22:\x20'+_0x5b0cd8[_0x6f0805(0x1bd)]));}for(const _0x5d1ccd of _0x2dfdaf[_0x6f0805(0x1d7)]){_0x5d1ccd[_0x6f0805(0x18c)]===_0x6f0805(0x1bd)&&console[_0x6f0805(0x12a)](a4_0x4cf241['red'](_0x6f0805(0x1ce)+_0x5d1ccd['name']+_0x6f0805(0x1a6)+_0x5d1ccd[_0x6f0805(0x1bd)]));}return 0x1;}console['log'](a4_0x4cf241[_0x6f0805(0x161)](_0x6f0805(0x128)+(_0x3845c0+_0x491619)+_0x6f0805(0x1b0)+_0x2dfdaf[_0x6f0805(0x13b)]+'\x27'));const _0x2748d0=getLLMProjectUrl(_0x19048d,_0x2dfdaf[_0x6f0805(0x1c2)]);return console['log'](_0x6f0805(0x12f)+a4_0x4cf241[_0x6f0805(0x1c7)](_0x2748d0)),0x0;}}
@@ -1 +1 @@
1
- const a5_0x4cd0c8=a5_0x1204;function a5_0x2454(){const _0x29ca2c=[':\x20Sending\x20user\x20input...','filter','✗\x20ERROR:\x20','\x20\x20Project:\x20','writeFileSync','\x20(new)','58508hVVqTC','7EQTpwc','length','toLowerCase','resolve','testYmlPath','output','split','testName','agent','table','\x20\x20Agent:\x20','PASS','find','push','no_context','utf-8','some','start','Duration:\x20','log','reason','resolveProjectId','name','\x20(cached)','stop','Re-evaluating...','Failed\x20Tests:','projectName','/<agent-name>','map','Error\x20writing\x20output\x20file:\x20','✗\x20FAIL:\x20','3608100rAYYSq','add','No\x20tests\x20have\x20tags\x20defined.','tsv','Passed:\x20\x20\x20','808545iiZukr','\x20-\x20','Re-evaluating\x20','status','substring','repeat','69jMJaZv','\x20\x20Evaluating...\x20','trim','1486024AatDrk','conversation_url','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','not\x20found','Round\x20','Test\x20','7021860vtSRMa','Site:\x20','ERROR','Cached\x20run\x20is\x20from\x20site\x20\x22','text','FAIL','Usage:','Output\x20written\x20to:\x20','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','Conversation\x20URL:\x20','verbose','cyan','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','\x20\x20Round\x20','size','19226nHYwwo','basename','tests','json','8txtezq','No\x20tests\x20found\x20with\x20tags:\x20','Evaluating\x20response...','llm','llmProject','timestamp','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','\x20\x20Conversation:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','Error:\x20No\x20previous\x20test\x20run\x20found.','...','Executing\x20new\x20tests...','description','Available\x20tags:\x20','Test\x20Configuration:','resolveAgentId','Total:\x20\x20\x20\x20','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','found','no_tests','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','eval','site','existsSync','context','agentName','Round\x201/','has','Running:\x20','Either\x20switch\x20to\x20the\x20\x22','execute','no_local_folder','rounds','Re-evaluating\x20cached\x20test\x20run...','join','dim','toISOString','yellow','Cached\x20run\x20from:\x20','test.yml','\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)','jsonl','Running\x20test:\x20','\x22:\x20','white','\x22,\x20but\x20current\x20site\x20is\x20\x22','\x20\x20-\x20','agent:test','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','Re-evaluation\x20Summary','Agent:\x20','green','Running\x20agent\x20tests...','Run\x20\x27tdx\x20agent\x20pull\x20','red','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','\x27\x20to\x20create\x20the\x20folder\x20structure.','Errors:\x20\x20\x20','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','\x20\x20Site:\x20','isSpinning','404','tags','dryRun','✓\x20PASS:\x20','now','reeval','includes','✗\x20ERROR:\x20Project\x20not\x20found:\x20','forEach','711492wdXcJt','message','New\x20tests\x20to\x20execute:\x20'];a5_0x2454=function(){return _0x29ca2c;};return a5_0x2454();}(function(_0x48060d,_0xf8c294){const _0x5a2701=a5_0x1204,_0x2a1df2=_0x48060d();while(!![]){try{const _0xeebaa5=parseInt(_0x5a2701(0x1de))/0x1*(parseInt(_0x5a2701(0x1e2))/0x2)+parseInt(_0x5a2701(0x1c6))/0x3*(-parseInt(_0x5a2701(0x232))/0x4)+parseInt(_0x5a2701(0x1c0))/0x5+parseInt(_0x5a2701(0x229))/0x6*(-parseInt(_0x5a2701(0x233))/0x7)+parseInt(_0x5a2701(0x1c9))/0x8+-parseInt(_0x5a2701(0x1bb))/0x9+parseInt(_0x5a2701(0x1cf))/0xa;if(_0xeebaa5===_0xf8c294)break;else _0x2a1df2['push'](_0x2a1df2['shift']());}catch(_0x52bdac){_0x2a1df2['push'](_0x2a1df2['shift']());}}}(a5_0x2454,0x42139));import*as a5_0x37cbb3 from'node:fs';import*as a5_0x9d51ca from'node:path';import a5_0x4ebb82 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';function a5_0x1204(_0x2edc71,_0x11d234){_0x2edc71=_0x2edc71-0x1ac;const _0x2454c5=a5_0x2454();let _0x120403=_0x2454c5[_0x2edc71];return _0x120403;}import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x4cd0c8(0x1b1)]=a5_0x4cd0c8(0x212);[a5_0x4cd0c8(0x1ef)]='Run\x20tests\x20for\x20an\x20LLM\x20agent';async[a5_0x4cd0c8(0x201)](_0x55ca7a){const _0x4781df=a5_0x4cd0c8,{options:_0x3ac93e,args:_0x3cbee3,tdx:_0x4e5ab3}=_0x55ca7a,_0x2fa2c2=_0x3cbee3[0x0]||'.',_0x306ec2=_0x3ac93e[_0x4781df(0x222)],_0x16f36c=_0x3ac93e,_0x50a3ca=_0x16f36c[_0x4781df(0x1f8)]===![],_0x1f6331=_0x16f36c[_0x4781df(0x225)],_0x231a1b=_0x16f36c[_0x4781df(0x1b1)],_0x150021=_0x16f36c[_0x4781df(0x221)],_0x53b97e=_0x3ac93e[_0x4781df(0x1f9)],_0x5c063c=_0x16f36c[_0x4781df(0x238)];if(_0x1f6331&&_0x50a3ca)return console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x219)]('Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval')),0x1;let _0x102459=_0x4781df(0x23c);if(_0x16f36c[_0x4781df(0x1e1)])_0x102459=_0x4781df(0x1e1);else{if(_0x16f36c['jsonl'])_0x102459=_0x4781df(0x20c);else{if(_0x16f36c[_0x4781df(0x1be)])_0x102459=_0x4781df(0x1be);else{if(_0x16f36c[_0x4781df(0x23c)])_0x102459=_0x4781df(0x23c);}}}const _0x18796d=_0x16f36c[_0x4781df(0x1e6)];let _0x247eed=_0x2fa2c2;const _0x191ac6=a5_0x37cbb3[_0x4781df(0x1fa)](_0x2fa2c2),_0x388e82=_0x2fa2c2==='.';if(!_0x191ac6||_0x388e82){const _0x1883e9=resolveProjectFromContext(_0x2fa2c2,_0x18796d,{'requireFile':_0x4781df(0x20a)});if(_0x1883e9[_0x4781df(0x1f5)])_0x247eed=_0x1883e9['projectDir'],_0x1883e9['source']===_0x4781df(0x1fb)&&console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x206)]('Using\x20agent:\x20'+_0x247eed));else switch(_0x1883e9['reason']){case _0x4781df(0x241):console[_0x4781df(0x1ae)](a5_0x4ebb82['yellow'](_0x1883e9['message'])),console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)](_0x4781df(0x1d5)),console[_0x4781df(0x1ae)]('\x20\x20tdx\x20agent\x20test\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20from\x20path'),console[_0x4781df(0x1ae)](_0x4781df(0x20b)),console[_0x4781df(0x1ae)](),console['log'](_0x4781df(0x21a));return 0x1;case _0x4781df(0x202):console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x208)](_0x1883e9[_0x4781df(0x22a)])),console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)](_0x4781df(0x218)+_0x1883e9[_0x4781df(0x1e6)]+_0x4781df(0x21b));return 0x1;case'multiple_agents':{const _0x50cde9=a5_0x9d51ca[_0x4781df(0x1df)](_0x1883e9['projectDir']);console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x208)](_0x4781df(0x1eb)+_0x1883e9[_0x4781df(0x1e6)]+'\x22:'));for(const _0xfdac00 of _0x1883e9['agentDirs']){console[_0x4781df(0x1ae)](_0x4781df(0x211)+_0xfdac00);}return console['log'](),console['log']('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x50cde9+_0x4781df(0x1b7)),0x1;}case _0x4781df(0x1f6):console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x208)](_0x4781df(0x1f7)+_0x1883e9[_0x4781df(0x1e6)]+'\x22.')),console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x206)]('Project\x20path:\x20'+_0x1883e9['projectDir'])),console['log'](),console['log'](_0x4781df(0x1f4));return 0x1;}}const {definition:_0x186c02,agentInfo:_0xac490}=parseTestFile(_0x247eed);let _0x14febe=_0x186c02['tests'];if(_0x231a1b){const _0x2466cf=_0x231a1b[_0x4781df(0x239)](',')['map'](_0x3aab50=>_0x3aab50[_0x4781df(0x1c8)]());_0x14febe=_0x186c02['tests']['filter'](_0x520492=>_0x2466cf[_0x4781df(0x226)](_0x520492[_0x4781df(0x1b1)]));if(_0x14febe[_0x4781df(0x234)]===0x0)return console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x208)]('No\x20tests\x20found\x20matching:\x20'+_0x231a1b)),console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x206)]('Available\x20tests:\x20'+_0x186c02['tests'][_0x4781df(0x1b8)](_0x3183a9=>_0x3183a9[_0x4781df(0x1b1)])[_0x4781df(0x205)](',\x20'))),0x1;}if(_0x150021){const _0x4467ed=_0x150021[_0x4781df(0x239)](',')[_0x4781df(0x1b8)](_0x1e7591=>_0x1e7591[_0x4781df(0x1c8)]()[_0x4781df(0x235)]());_0x14febe=_0x14febe[_0x4781df(0x22d)](_0x2d21d8=>_0x2d21d8[_0x4781df(0x221)]?.[_0x4781df(0x243)](_0x1220c8=>_0x4467ed[_0x4781df(0x226)](_0x1220c8[_0x4781df(0x235)]())));if(_0x14febe[_0x4781df(0x234)]===0x0){console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x208)](_0x4781df(0x1e3)+_0x150021));const _0x330ad2=new Set();return _0x186c02[_0x4781df(0x1e0)][_0x4781df(0x228)](_0x17da2a=>_0x17da2a['tags']?.[_0x4781df(0x228)](_0x4a6eec=>_0x330ad2[_0x4781df(0x1bc)](_0x4a6eec))),_0x330ad2[_0x4781df(0x1dd)]>0x0?console['log'](a5_0x4ebb82[_0x4781df(0x206)](_0x4781df(0x1f0)+[..._0x330ad2][_0x4781df(0x205)](',\x20'))):console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x206)](_0x4781df(0x1bd))),0x1;}}if(_0x1f6331)return this['executeReeval'](_0x55ca7a,{'definition':{'tests':_0x14febe},'agentInfo':_0xac490,'outputFormat':_0x102459,'outputFile':_0x5c063c,'testNames':_0x231a1b});if(_0x306ec2){console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x1da)](_0x4781df(0x1f1))),console[_0x4781df(0x1ae)](_0x4781df(0x21e)+a5_0x4ebb82[_0x4781df(0x20f)](_0x53b97e)),console['log'](_0x4781df(0x22f)+a5_0x4ebb82[_0x4781df(0x20f)](_0xac490['projectName'])),console[_0x4781df(0x1ae)](_0x4781df(0x23d)+a5_0x4ebb82['white'](_0xac490[_0x4781df(0x1fc)])),console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)]('Tests\x20found:\x20'+a5_0x4ebb82[_0x4781df(0x20f)](_0x14febe[_0x4781df(0x234)]));for(let _0x478a25=0x0;_0x478a25<_0x14febe['length'];_0x478a25++){const _0x2f6d5f=_0x14febe[_0x478a25],_0x3be661=_0x2f6d5f[_0x4781df(0x203)]['length']===0x1?'round':'rounds',_0x13f9c4=_0x2f6d5f[_0x4781df(0x221)]?.[_0x4781df(0x234)]?'\x20['+_0x2f6d5f['tags']['join'](',\x20')+']':'';console[_0x4781df(0x1ae)]('\x20\x20'+(_0x478a25+0x1)+'.\x20'+a5_0x4ebb82[_0x4781df(0x20f)](_0x2f6d5f[_0x4781df(0x1b1)])+'\x20('+_0x2f6d5f[_0x4781df(0x203)][_0x4781df(0x234)]+'\x20'+_0x3be661+')'+a5_0x4ebb82[_0x4781df(0x206)](_0x13f9c4));}return 0x0;}let _0x125b6b,_0x2f208f;try{_0x125b6b=await _0x4e5ab3[_0x4781df(0x1e5)][_0x4781df(0x1b0)](_0xac490['projectName']);}catch(_0x4f446f){const _0x13d893=_0x4f446f instanceof Error?_0x4f446f[_0x4781df(0x22a)]:String(_0x4f446f);return _0x13d893[_0x4781df(0x226)](_0x4781df(0x220))||_0x13d893[_0x4781df(0x235)]()[_0x4781df(0x226)]('not\x20found')?console['log'](a5_0x4ebb82['red'](_0x4781df(0x227)+_0xac490[_0x4781df(0x1b6)])):console['log'](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x1ea)+_0xac490[_0x4781df(0x1b6)]+'\x22:\x20'+_0x13d893)),0x1;}try{_0x2f208f=await _0x4e5ab3['llm'][_0x4781df(0x1f2)](_0xac490[_0x4781df(0x1fc)],_0x125b6b);}catch(_0x28560c){const _0x4378e6=_0x28560c instanceof Error?_0x28560c[_0x4781df(0x22a)]:String(_0x28560c);return _0x4378e6['includes'](_0x4781df(0x220))||_0x4378e6[_0x4781df(0x235)]()['includes'](_0x4781df(0x1cc))?console['log'](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x213)+_0xac490[_0x4781df(0x1fc)])):console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x219)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22'+_0xac490[_0x4781df(0x1fc)]+_0x4781df(0x20e)+_0x4378e6)),0x1;}let _0x3100ed;if(!_0x50a3ca)try{_0x3100ed=await setupEvaluatorAgent(_0x4e5ab3['llm'],_0x3ac93e[_0x4781df(0x1d9)]);}catch(_0xf40bed){const _0x4a19a9=_0xf40bed instanceof Error?_0xf40bed[_0x4781df(0x22a)]:String(_0xf40bed);return console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x1cb)+_0x4a19a9)),0x1;}console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x1da)](_0x4781df(0x217))),console[_0x4781df(0x1ae)](_0x4781df(0x1d0)+a5_0x4ebb82[_0x4781df(0x20f)](_0x53b97e)),console[_0x4781df(0x1ae)](_0x4781df(0x215)+a5_0x4ebb82[_0x4781df(0x20f)](_0xac490[_0x4781df(0x1b6)]+'/'+_0xac490['agentName'])),console[_0x4781df(0x1ae)]();const _0x1784f8=[],_0x328f7d=[],_0x25ca7e=Date['now']();for(let _0x43e097=0x0;_0x43e097<_0x14febe['length'];_0x43e097++){const _0x4dd171=_0x14febe[_0x43e097];_0x14febe[_0x4781df(0x234)]>0x1?console[_0x4781df(0x1ae)](_0x4781df(0x1ce)+(_0x43e097+0x1)+'/'+_0x14febe[_0x4781df(0x234)]+':\x20'+a5_0x4ebb82[_0x4781df(0x20f)](_0x4dd171[_0x4781df(0x1b1)])):console[_0x4781df(0x1ae)](_0x4781df(0x20d)+a5_0x4ebb82[_0x4781df(0x20f)](_0x4dd171[_0x4781df(0x1b1)]));const _0xdfe13a=createCommandSpinner(_0x4781df(0x1fd)+_0x4dd171[_0x4781df(0x203)][_0x4781df(0x234)]+_0x4781df(0x22c));_0xdfe13a[_0x4781df(0x1ac)]();try{const {result:_0x14124f,conversation:_0x4610c7}=await runTest(_0x4e5ab3[_0x4781df(0x1e5)],_0x4dd171,{'agentId':_0x2f208f,'projectId':_0x125b6b,'site':_0x53b97e,'noEval':_0x50a3ca,'evaluatorId':_0x3100ed,'onRoundStart':(_0x2936bc,_0x3f0ebf)=>{const _0xb4b83c=_0x4781df;_0xdfe13a['text']=_0xb4b83c(0x1cd)+(_0x2936bc+0x1)+'/'+_0x3f0ebf+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x4d943e,_0x284091,_0x1db1c0)=>{const _0x34812b=_0x4781df,_0x2a1278=formatElapsed(_0x284091);_0x1db1c0?console[_0x34812b(0x1ae)]('\x20\x20Round\x20'+(_0x4d943e+0x1)+'/'+_0x4dd171[_0x34812b(0x203)][_0x34812b(0x234)]+'...\x20'+a5_0x4ebb82[_0x34812b(0x216)]('✓')+'\x20('+_0x2a1278+')'):console[_0x34812b(0x1ae)](_0x34812b(0x1dc)+(_0x4d943e+0x1)+'/'+_0x4dd171[_0x34812b(0x203)][_0x34812b(0x234)]+'...\x20'+a5_0x4ebb82[_0x34812b(0x219)]('✗'));},'onEvaluationStart':()=>{const _0x5c3c34=_0x4781df;_0xdfe13a['text']=_0x5c3c34(0x1e4);},'onEvaluationComplete':_0x54288e=>{const _0x2142b0=_0x4781df,_0x24eda6=formatElapsed(_0x54288e);console[_0x2142b0(0x1ae)](_0x2142b0(0x1c7)+a5_0x4ebb82['green']('✓')+'\x20('+_0x24eda6+')');}});_0xdfe13a[_0x4781df(0x1b3)](),_0x1784f8['push'](_0x14124f),_0x328f7d[_0x4781df(0x240)](_0x4610c7);if(_0x14124f['status']==='PASS')console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x216)](_0x4781df(0x223)+_0x14124f[_0x4781df(0x1af)]));else _0x14124f[_0x4781df(0x1c3)]===_0x4781df(0x1d4)?console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x1ba)+_0x14124f[_0x4781df(0x1af)])):console['log'](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x22e)+_0x14124f[_0x4781df(0x1af)]));_0x14124f[_0x4781df(0x1ca)]&&console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x206)](_0x4781df(0x1d8)+_0x14124f[_0x4781df(0x1ca)])),console[_0x4781df(0x1ae)]();}catch(_0x2a29cb){_0xdfe13a['stop']();const _0x4d3e83=_0x2a29cb instanceof Error?_0x2a29cb['message']:String(_0x2a29cb);console['log'](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x22e)+_0x4d3e83)),console[_0x4781df(0x1ae)](),_0x1784f8[_0x4781df(0x240)]({'name':_0x4dd171[_0x4781df(0x1b1)],'status':_0x4781df(0x1d1),'reason':_0x4d3e83,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}const _0x2e218b=Date['now']()-_0x25ca7e,_0x23dc76=_0x1784f8[_0x4781df(0x22d)](_0x551423=>_0x551423[_0x4781df(0x1c3)]==='PASS')[_0x4781df(0x234)],_0x3c2f36=_0x1784f8[_0x4781df(0x22d)](_0x17aa78=>_0x17aa78[_0x4781df(0x1c3)]===_0x4781df(0x1d4))['length'],_0x2ca58d=_0x1784f8[_0x4781df(0x22d)](_0x5e66b0=>_0x5e66b0[_0x4781df(0x1c3)]==='ERROR')['length'];console['log']('━'[_0x4781df(0x1c5)](0x3c)),console[_0x4781df(0x1ae)]('Test\x20Summary'),console[_0x4781df(0x1ae)]('━'[_0x4781df(0x1c5)](0x3c)),console[_0x4781df(0x1ae)](_0x4781df(0x1f3)+_0x1784f8[_0x4781df(0x234)]),console['log'](_0x4781df(0x1bf)+a5_0x4ebb82[_0x4781df(0x216)](_0x23dc76)),console[_0x4781df(0x1ae)]('Failed:\x20\x20\x20'+a5_0x4ebb82[_0x4781df(0x219)](_0x3c2f36));_0x2ca58d>0x0&&console[_0x4781df(0x1ae)](_0x4781df(0x21c)+a5_0x4ebb82[_0x4781df(0x219)](_0x2ca58d));console[_0x4781df(0x1ae)]('Duration:\x20'+formatElapsed(_0x2e218b)),console[_0x4781df(0x1ae)]('━'[_0x4781df(0x1c5)](0x3c));const _0x67083f=_0x1784f8[_0x4781df(0x22d)](_0x5a05a1=>_0x5a05a1[_0x4781df(0x1c3)]!==_0x4781df(0x23e));if(_0x67083f[_0x4781df(0x234)]>0x0){console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)](_0x4781df(0x1b5));for(const _0xc61cd of _0x67083f){const _0x122ec9=a5_0x4ebb82[_0x4781df(0x219)]('✗'),_0x53451f=_0xc61cd[_0x4781df(0x1af)][_0x4781df(0x234)]>0x32?_0xc61cd[_0x4781df(0x1af)][_0x4781df(0x1c4)](0x0,0x32)+_0x4781df(0x1ed):_0xc61cd['reason'];console[_0x4781df(0x1ae)]('\x20\x20'+_0x122ec9+'\x20'+_0xc61cd[_0x4781df(0x1b1)]+':\x20'+_0x53451f);}}const _0x38e036={'summary':{'total':_0x1784f8[_0x4781df(0x234)],'passed':_0x23dc76,'failed':_0x3c2f36,'errors':_0x2ca58d>0x0?_0x2ca58d:undefined,'duration_ms':_0x2e218b},'tests':_0x1784f8,'agent':{'project':_0xac490[_0x4781df(0x1b6)],'name':_0xac490[_0x4781df(0x1fc)],'site':_0x53b97e},'timestamp':new Date(_0x25ca7e)['toISOString']()};try{const _0x59c72a=buildCachedTestRun(_0x328f7d,{'site':_0x53b97e,'projectId':_0x125b6b,'projectName':_0xac490['projectName'],'agentId':_0x2f208f,'agentName':_0xac490[_0x4781df(0x1fc)],'testYmlPath':a5_0x9d51ca[_0x4781df(0x236)](_0xac490[_0x4781df(0x237)])});saveLastTestRun(_0x59c72a);}catch{}if(_0x102459!==_0x4781df(0x23c)||_0x5c063c){const _0x6ec40b=formatResults(_0x38e036,_0x102459);if(_0x5c063c)try{a5_0x37cbb3[_0x4781df(0x230)](_0x5c063c,_0x6ec40b,_0x4781df(0x242)),console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)](a5_0x4ebb82['dim'](_0x4781df(0x1d6)+_0x5c063c));}catch(_0x241722){return console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)](a5_0x4ebb82[_0x4781df(0x219)](_0x4781df(0x1b9)+_0x241722)),0x1;}else console[_0x4781df(0x1ae)](),console[_0x4781df(0x1ae)](_0x6ec40b);}return _0x67083f[_0x4781df(0x234)]>0x0?0x1:0x0;}async['executeReeval'](_0x4fe6a0,_0x12ba97){const _0x263145=a5_0x4cd0c8,{options:_0x262839,tdx:_0x27a1e4}=_0x4fe6a0,{definition:_0x5c3326,agentInfo:_0x3de47a,outputFormat:_0xb132f5,outputFile:_0x2dd444}=_0x12ba97,_0x4542f3=_0x262839[_0x263145(0x1f9)],_0x371626=loadLastTestRun();if(!_0x371626)return console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x219)](_0x263145(0x1ec))),console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x206)]('Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.')),0x1;if(_0x371626[_0x263145(0x23b)][_0x263145(0x1fc)]!==_0x3de47a[_0x263145(0x1fc)])return console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x219)]('Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22'+_0x371626['agent'][_0x263145(0x1fc)]+_0x263145(0x1db)+_0x3de47a[_0x263145(0x1fc)]+'\x22.')),console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x1d7))),0x1;const _0x35a7f1=new Set(_0x371626['conversations'][_0x263145(0x1b8)](_0x5aa962=>_0x5aa962[_0x263145(0x23a)])),_0x160997=_0x5c3326[_0x263145(0x1e0)][_0x263145(0x22d)](_0x1ccd8d=>!_0x35a7f1[_0x263145(0x1fe)](_0x1ccd8d[_0x263145(0x1b1)]));if(_0x160997['length']>0x0&&_0x371626[_0x263145(0x1f9)]!==_0x4542f3)return console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x219)](_0x263145(0x21d))),console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x1d2)+_0x371626['site']+_0x263145(0x210)+_0x4542f3+'\x22.')),console['log'](a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x200)+_0x371626[_0x263145(0x1f9)]+_0x263145(0x1e8))),0x1;const _0x3198ff=_0x5c3326['tests']['filter'](_0x56595e=>_0x35a7f1[_0x263145(0x1fe)](_0x56595e['name'])),_0x43ef15=_0x160997;let _0x54d747;try{_0x54d747=await setupEvaluatorAgent(_0x27a1e4['llm'],_0x262839['verbose']);}catch(_0xa79706){const _0x4cd727=_0xa79706 instanceof Error?_0xa79706[_0x263145(0x22a)]:String(_0xa79706);return console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x219)](_0x263145(0x1cb)+_0x4cd727)),0x1;}console['log'](a5_0x4ebb82[_0x263145(0x1da)](_0x263145(0x204))),console[_0x263145(0x1ae)](_0x263145(0x209)+a5_0x4ebb82[_0x263145(0x20f)](_0x371626[_0x263145(0x1e7)])),console[_0x263145(0x1ae)]('Agent:\x20'+a5_0x4ebb82[_0x263145(0x20f)](_0x371626['agent'][_0x263145(0x1b6)]+'/'+_0x371626[_0x263145(0x23b)]['agentName']));_0x43ef15[_0x263145(0x234)]>0x0&&console['log'](_0x263145(0x22b)+a5_0x4ebb82['yellow'](_0x43ef15[_0x263145(0x234)]));console[_0x263145(0x1ae)]();const _0x743743=[],_0x54d4d3=Date[_0x263145(0x224)](),_0x189138=createCommandSpinner(_0x263145(0x1b4));if(_0x3198ff[_0x263145(0x234)]>0x0)try{const _0x5104a9=await reevaluateFromCache(_0x27a1e4[_0x263145(0x1e5)],_0x371626,{'tests':_0x3198ff},{'evaluatorId':_0x54d747,'onTestStart':(_0x4e4c83,_0x1d7cf0,_0x260167)=>{const _0x5f378a=_0x263145;_0x189138[_0x5f378a(0x1d3)]=_0x5f378a(0x1c2)+(_0x1d7cf0+0x1)+'/'+_0x260167+':\x20'+_0x4e4c83+_0x5f378a(0x1ed);if(!_0x189138[_0x5f378a(0x21f)])_0x189138['start']();},'onTestComplete':(_0x2d171d,_0x14d552)=>{const _0x4547ef=_0x263145;_0x189138[_0x4547ef(0x1b3)]();if(_0x14d552[_0x4547ef(0x1c3)]===_0x4547ef(0x23e))console['log'](a5_0x4ebb82[_0x4547ef(0x216)](_0x4547ef(0x223)+_0x2d171d)+a5_0x4ebb82['dim'](_0x4547ef(0x1b2)));else _0x14d552['status']===_0x4547ef(0x1d4)?console[_0x4547ef(0x1ae)](a5_0x4ebb82[_0x4547ef(0x219)]('✗\x20FAIL:\x20'+_0x2d171d+_0x4547ef(0x1c1)+_0x14d552['reason'])+a5_0x4ebb82[_0x4547ef(0x206)](_0x4547ef(0x1b2))):console[_0x4547ef(0x1ae)](a5_0x4ebb82['red']('✗\x20ERROR:\x20'+_0x2d171d+'\x20-\x20'+_0x14d552['reason']));_0x14d552[_0x4547ef(0x1ca)]&&console[_0x4547ef(0x1ae)](a5_0x4ebb82[_0x4547ef(0x206)]('\x20\x20Conversation:\x20'+_0x14d552[_0x4547ef(0x1ca)])),_0x743743['push'](_0x14d552);},'onTestSkipped':(_0x28e0a3,_0x1b4fd2)=>{const _0x3a25bc=_0x263145;_0x189138['stop'](),console[_0x3a25bc(0x1ae)](a5_0x4ebb82[_0x3a25bc(0x208)]('⚠\x20SKIPPED:\x20'+_0x28e0a3+'\x20-\x20'+_0x1b4fd2));}});for(const _0x54378a of _0x5104a9){!_0x743743[_0x263145(0x23f)](_0x3595da=>_0x3595da['name']===_0x54378a[_0x263145(0x1b1)])&&_0x743743['push'](_0x54378a);}}catch(_0x3b1ebe){_0x189138[_0x263145(0x1b3)]();const _0x1ec0f6=_0x3b1ebe instanceof Error?_0x3b1ebe[_0x263145(0x22a)]:String(_0x3b1ebe);return console[_0x263145(0x1ae)](a5_0x4ebb82['red']('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0x1ec0f6)),0x1;}_0x189138[_0x263145(0x1b3)]();if(_0x43ef15['length']>0x0){console[_0x263145(0x1ae)](),console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x1da)](_0x263145(0x1ee)));const {projectId:_0x8217e7,agentId:_0x145b3c}=_0x371626['agent'];for(const _0x4848d0 of _0x43ef15){console['log'](_0x263145(0x1ff)+a5_0x4ebb82['white'](_0x4848d0[_0x263145(0x1b1)]));const _0x4842a3=createCommandSpinner(_0x263145(0x1fd)+_0x4848d0[_0x263145(0x203)][_0x263145(0x234)]+_0x263145(0x22c));_0x4842a3[_0x263145(0x1ac)]();try{const {result:_0x5152dd}=await runTest(_0x27a1e4[_0x263145(0x1e5)],_0x4848d0,{'agentId':_0x145b3c,'projectId':_0x8217e7,'site':_0x371626['site'],'noEval':![],'evaluatorId':_0x54d747,'onRoundStart':(_0x180d0d,_0x2f25cc)=>{const _0x184973=_0x263145;_0x4842a3[_0x184973(0x1d3)]=_0x184973(0x1cd)+(_0x180d0d+0x1)+'/'+_0x2f25cc+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x430801,_0x3dd3fb,_0x46193e)=>{const _0x520f5a=_0x263145,_0x20ba3d=formatElapsed(_0x3dd3fb);_0x46193e?console[_0x520f5a(0x1ae)](_0x520f5a(0x1dc)+(_0x430801+0x1)+'/'+_0x4848d0[_0x520f5a(0x203)][_0x520f5a(0x234)]+'...\x20'+a5_0x4ebb82['green']('✓')+'\x20('+_0x20ba3d+')'):console['log'](_0x520f5a(0x1dc)+(_0x430801+0x1)+'/'+_0x4848d0[_0x520f5a(0x203)][_0x520f5a(0x234)]+'...\x20'+a5_0x4ebb82['red']('✗'));},'onEvaluationStart':()=>{const _0x3c44eb=_0x263145;_0x4842a3[_0x3c44eb(0x1d3)]=_0x3c44eb(0x1e4);},'onEvaluationComplete':_0x389fd9=>{const _0x569588=_0x263145,_0x531f9c=formatElapsed(_0x389fd9);console[_0x569588(0x1ae)](_0x569588(0x1c7)+a5_0x4ebb82[_0x569588(0x216)]('✓')+'\x20('+_0x531f9c+')');}});_0x4842a3['stop'](),_0x743743['push'](_0x5152dd);if(_0x5152dd['status']===_0x263145(0x23e))console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x216)](_0x263145(0x223)+_0x5152dd[_0x263145(0x1af)])+a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x231)));else _0x5152dd[_0x263145(0x1c3)]===_0x263145(0x1d4)?console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x219)](_0x263145(0x1ba)+_0x5152dd[_0x263145(0x1af)])+a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x231))):console['log'](a5_0x4ebb82['red'](_0x263145(0x22e)+_0x5152dd[_0x263145(0x1af)]));_0x5152dd[_0x263145(0x1ca)]&&console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x1e9)+_0x5152dd[_0x263145(0x1ca)]));}catch(_0x55577e){_0x4842a3[_0x263145(0x1b3)]();const _0x2432b1=_0x55577e instanceof Error?_0x55577e[_0x263145(0x22a)]:String(_0x55577e);console['log'](a5_0x4ebb82[_0x263145(0x219)](_0x263145(0x22e)+_0x2432b1)),_0x743743[_0x263145(0x240)]({'name':_0x4848d0[_0x263145(0x1b1)],'status':_0x263145(0x1d1),'reason':_0x2432b1,'timestamp':new Date()[_0x263145(0x207)](),'duration_ms':0x0});}}}console['log']();const _0x559e87=Date[_0x263145(0x224)]()-_0x54d4d3,_0x12962a=_0x743743[_0x263145(0x22d)](_0x2ecbda=>_0x2ecbda[_0x263145(0x1c3)]===_0x263145(0x23e))[_0x263145(0x234)],_0xc9279e=_0x743743[_0x263145(0x22d)](_0x34a989=>_0x34a989['status']===_0x263145(0x1d4))[_0x263145(0x234)],_0x3498ef=_0x743743['filter'](_0x3e2615=>_0x3e2615[_0x263145(0x1c3)]==='ERROR')[_0x263145(0x234)];console[_0x263145(0x1ae)]('━'['repeat'](0x3c)),console['log'](_0x263145(0x214)),console['log']('━'[_0x263145(0x1c5)](0x3c)),console[_0x263145(0x1ae)]('Total:\x20\x20\x20\x20'+_0x743743[_0x263145(0x234)]),console[_0x263145(0x1ae)]('Passed:\x20\x20\x20'+a5_0x4ebb82['green'](_0x12962a)),console[_0x263145(0x1ae)]('Failed:\x20\x20\x20'+a5_0x4ebb82[_0x263145(0x219)](_0xc9279e));_0x3498ef>0x0&&console[_0x263145(0x1ae)](_0x263145(0x21c)+a5_0x4ebb82[_0x263145(0x219)](_0x3498ef));console[_0x263145(0x1ae)](_0x263145(0x1ad)+formatElapsed(_0x559e87)),console[_0x263145(0x1ae)]('━'[_0x263145(0x1c5)](0x3c));const _0x303ab2={'summary':{'total':_0x743743[_0x263145(0x234)],'passed':_0x12962a,'failed':_0xc9279e,'errors':_0x3498ef>0x0?_0x3498ef:undefined,'duration_ms':_0x559e87},'tests':_0x743743,'agent':{'project':_0x3de47a[_0x263145(0x1b6)],'name':_0x3de47a['agentName'],'site':_0x4542f3},'timestamp':new Date(_0x54d4d3)['toISOString']()};if(_0xb132f5!==_0x263145(0x23c)||_0x2dd444){const _0x3d4134=formatResults(_0x303ab2,_0xb132f5);if(_0x2dd444)try{a5_0x37cbb3[_0x263145(0x230)](_0x2dd444,_0x3d4134,'utf-8'),console[_0x263145(0x1ae)](),console[_0x263145(0x1ae)](a5_0x4ebb82[_0x263145(0x206)](_0x263145(0x1d6)+_0x2dd444));}catch(_0xfd7145){return console[_0x263145(0x1ae)](),console['log'](a5_0x4ebb82[_0x263145(0x219)](_0x263145(0x1b9)+_0xfd7145)),0x1;}else console[_0x263145(0x1ae)](),console['log'](_0x3d4134);}const _0x2fc3d8=_0x743743[_0x263145(0x22d)](_0x922fce=>_0x922fce[_0x263145(0x1c3)]!==_0x263145(0x23e));return _0x2fc3d8[_0x263145(0x234)]>0x0?0x1:0x0;}}
1
+ function a5_0x19cc(_0xf36dbc,_0x2e40b4){_0xf36dbc=_0xf36dbc-0x189;const _0x58823e=a5_0x5882();let _0x19cc20=_0x58823e[_0xf36dbc];return _0x19cc20;}const a5_0x1a2d62=a5_0x19cc;(function(_0x45f1d1,_0x2d9a3b){const _0xf35793=a5_0x19cc,_0x9eead7=_0x45f1d1();while(!![]){try{const _0x2e4109=-parseInt(_0xf35793(0x1ec))/0x1+-parseInt(_0xf35793(0x21f))/0x2*(parseInt(_0xf35793(0x21b))/0x3)+-parseInt(_0xf35793(0x1da))/0x4+-parseInt(_0xf35793(0x1c6))/0x5*(parseInt(_0xf35793(0x1dd))/0x6)+-parseInt(_0xf35793(0x1db))/0x7+parseInt(_0xf35793(0x207))/0x8+parseInt(_0xf35793(0x1e7))/0x9;if(_0x2e4109===_0x2d9a3b)break;else _0x9eead7['push'](_0x9eead7['shift']());}catch(_0x5826be){_0x9eead7['push'](_0x9eead7['shift']());}}}(a5_0x5882,0x33b5d));import*as a5_0x3e7783 from'node:fs';import*as a5_0x1113c4 from'node:path';import a5_0x403177 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';function a5_0x5882(){const _0x4e9064=['Test\x20Configuration:','Re-evaluating\x20','404','existsSync','length','Running:\x20','Running\x20agent\x20tests...','includes','New\x20tests\x20to\x20execute:\x20','Available\x20tests:\x20','tsv','Agent:\x20','Error\x20writing\x20output\x20file:\x20','eval','agent','no_tests','green','not\x20found','ERROR','\x20\x20Round\x20','...','forEach','writeFileSync','FAIL','map','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','join',':\x20Sending\x20user\x20input...','✗\x20ERROR:\x20','found','isSpinning','resolveAgentId','utf-8','Failed\x20Tests:','json','toLowerCase','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','jsonl','llm','text','rounds','output','tags','source','\x27\x20to\x20create\x20the\x20folder\x20structure.','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','Tests\x20found:\x20','Round\x20','yellow','Test\x20','testYmlPath','filter','Total:\x20\x20\x20\x20','Re-evaluating\x20cached\x20test\x20run...','push','5PDaSFJ','⚠\x20SKIPPED:\x20','No\x20tests\x20have\x20tags\x20defined.','\x22:\x20','cyan','site','✗\x20FAIL:\x20','projectDir','find','\x20\x20Evaluating...\x20','Run\x20\x27tdx\x20agent\x20pull\x20','name','no_local_folder','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','Output\x20written\x20to:\x20','execute','round','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','dryRun','executeReeval','1139928ELNzqE','2028936MLdWMH','\x20(cached)','797406NzdyXD','red','dim','Running\x20test:\x20','Cached\x20run\x20from:\x20','\x20-\x20','\x22,\x20but\x20current\x20site\x20is\x20\x22','PASS','resolve','Conversation\x20URL:\x20','13032711IdaAUO','status','Using\x20agent:\x20','\x20\x20Conversation:\x20','reason','325831xuEfbT','basename','trim','llmProject','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','log','stop','multiple_agents','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','Executing\x20new\x20tests...','toISOString','\x20\x20-\x20','add','projectName','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','tests','Passed:\x20\x20\x20','Site:\x20','Evaluating\x20response...','Round\x201/','No\x20tests\x20found\x20with\x20tags:\x20','now','\x20(new)','Either\x20switch\x20to\x20the\x20\x22','\x20\x20Project:\x20','context','\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','1083352bMKsVB','white','repeat','\x20\x20Agent:\x20','Cached\x20run\x20is\x20from\x20site\x20\x22','table','Errors:\x20\x20\x20','message','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','split','...\x20','size','resolveProjectId','conversation_url','Failed:\x20\x20\x20','start','verbose','agentName','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','no_context','1014393rOjcpv','some','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','agent:test','2LoqvgN','has','✓\x20PASS:\x20','\x20\x20Site:\x20','test.yml','agentDirs','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22'];a5_0x5882=function(){return _0x4e9064;};return a5_0x5882();}import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x1a2d62(0x1d1)]=a5_0x1a2d62(0x21e);['description']='Run\x20tests\x20for\x20an\x20LLM\x20agent';async[a5_0x1a2d62(0x1d5)](_0x3f40d4){const _0x2a1e06=a5_0x1a2d62,{options:_0x4411d9,args:_0x287755,tdx:_0x4607c0}=_0x3f40d4,_0x6caddf=_0x287755[0x0]||'.',_0x3a0242=_0x4411d9[_0x2a1e06(0x1d8)],_0x32bd54=_0x4411d9,_0x228bd6=_0x32bd54[_0x2a1e06(0x19b)]===![],_0x2b110b=_0x32bd54['reeval'],_0x475e47=_0x32bd54[_0x2a1e06(0x1d1)],_0x2be41b=_0x32bd54[_0x2a1e06(0x1b9)],_0x50146d=_0x4411d9['site'],_0x2f1a35=_0x32bd54[_0x2a1e06(0x1b8)];if(_0x2b110b&&_0x228bd6)return console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1de)](_0x2a1e06(0x1d3))),0x1;let _0x4bf923=_0x2a1e06(0x20c);if(_0x32bd54[_0x2a1e06(0x1b0)])_0x4bf923=_0x2a1e06(0x1b0);else{if(_0x32bd54['jsonl'])_0x4bf923=_0x2a1e06(0x1b4);else{if(_0x32bd54[_0x2a1e06(0x198)])_0x4bf923=_0x2a1e06(0x198);else{if(_0x32bd54[_0x2a1e06(0x20c)])_0x4bf923=_0x2a1e06(0x20c);}}}const _0x1695f2=_0x32bd54[_0x2a1e06(0x1ef)];let _0x2c5a71=_0x6caddf;const _0x176bcc=a5_0x3e7783[_0x2a1e06(0x191)](_0x6caddf),_0x2e9604=_0x6caddf==='.';if(!_0x176bcc||_0x2e9604){const _0x2c88f8=resolveProjectFromContext(_0x6caddf,_0x1695f2,{'requireFile':_0x2a1e06(0x18b)});if(_0x2c88f8[_0x2a1e06(0x1ab)])_0x2c5a71=_0x2c88f8[_0x2a1e06(0x1cd)],_0x2c88f8[_0x2a1e06(0x1ba)]===_0x2a1e06(0x205)&&console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1df)](_0x2a1e06(0x1e9)+_0x2c5a71));else switch(_0x2c88f8['reason']){case _0x2a1e06(0x21a):console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1bf)](_0x2c88f8[_0x2a1e06(0x20e)])),console[_0x2a1e06(0x1f1)](),console[_0x2a1e06(0x1f1)]('Usage:'),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x206)),console['log'](_0x2a1e06(0x219)),console[_0x2a1e06(0x1f1)](),console['log']('Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>');return 0x1;case _0x2a1e06(0x1d2):console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1bf)](_0x2c88f8[_0x2a1e06(0x20e)])),console['log'](),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1d0)+_0x2c88f8[_0x2a1e06(0x1ef)]+_0x2a1e06(0x1bb));return 0x1;case _0x2a1e06(0x1f3):{const _0xe1d32e=a5_0x1113c4[_0x2a1e06(0x1ed)](_0x2c88f8['projectDir']);console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1bf)](_0x2a1e06(0x18d)+_0x2c88f8[_0x2a1e06(0x1ef)]+'\x22:'));for(const _0x10d1e6 of _0x2c88f8[_0x2a1e06(0x18c)]){console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1f7)+_0x10d1e6);}return console[_0x2a1e06(0x1f1)](),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x20f)+_0xe1d32e+'/<agent-name>'),0x1;}case _0x2a1e06(0x19d):console['log'](a5_0x403177['yellow'](_0x2a1e06(0x21d)+_0x2c88f8[_0x2a1e06(0x1ef)]+'\x22.')),console['log'](a5_0x403177[_0x2a1e06(0x1df)]('Project\x20path:\x20'+_0x2c88f8[_0x2a1e06(0x1cd)])),console[_0x2a1e06(0x1f1)](),console['log'](_0x2a1e06(0x1bc));return 0x1;}}const {definition:_0x46a62b,agentInfo:_0x4dbb88}=parseTestFile(_0x2c5a71);let _0x5ad8af=_0x46a62b[_0x2a1e06(0x1fb)];if(_0x475e47){const _0x538964=_0x475e47[_0x2a1e06(0x210)](',')['map'](_0x4ac96d=>_0x4ac96d[_0x2a1e06(0x1ee)]());_0x5ad8af=_0x46a62b[_0x2a1e06(0x1fb)][_0x2a1e06(0x1c2)](_0x59e5af=>_0x538964[_0x2a1e06(0x195)](_0x59e5af[_0x2a1e06(0x1d1)]));if(_0x5ad8af[_0x2a1e06(0x192)]===0x0)return console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1bf)]('No\x20tests\x20found\x20matching:\x20'+_0x475e47)),console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1df)](_0x2a1e06(0x197)+_0x46a62b['tests'][_0x2a1e06(0x1a6)](_0x189116=>_0x189116['name'])[_0x2a1e06(0x1a8)](',\x20'))),0x1;}if(_0x2be41b){const _0x16ac36=_0x2be41b[_0x2a1e06(0x210)](',')[_0x2a1e06(0x1a6)](_0x331370=>_0x331370[_0x2a1e06(0x1ee)]()['toLowerCase']());_0x5ad8af=_0x5ad8af[_0x2a1e06(0x1c2)](_0x7f9bc0=>_0x7f9bc0[_0x2a1e06(0x1b9)]?.[_0x2a1e06(0x21c)](_0x23aed4=>_0x16ac36[_0x2a1e06(0x195)](_0x23aed4[_0x2a1e06(0x1b1)]())));if(_0x5ad8af[_0x2a1e06(0x192)]===0x0){console[_0x2a1e06(0x1f1)](a5_0x403177['yellow'](_0x2a1e06(0x200)+_0x2be41b));const _0x1b1600=new Set();return _0x46a62b['tests'][_0x2a1e06(0x1a3)](_0x2d7529=>_0x2d7529[_0x2a1e06(0x1b9)]?.[_0x2a1e06(0x1a3)](_0x4f25a2=>_0x1b1600[_0x2a1e06(0x1f8)](_0x4f25a2))),_0x1b1600[_0x2a1e06(0x212)]>0x0?console[_0x2a1e06(0x1f1)](a5_0x403177['dim']('Available\x20tags:\x20'+[..._0x1b1600]['join'](',\x20'))):console[_0x2a1e06(0x1f1)](a5_0x403177['dim'](_0x2a1e06(0x1c8))),0x1;}}if(_0x2b110b)return this[_0x2a1e06(0x1d9)](_0x3f40d4,{'definition':{'tests':_0x5ad8af},'agentInfo':_0x4dbb88,'outputFormat':_0x4bf923,'outputFile':_0x2f1a35,'testNames':_0x475e47});if(_0x3a0242){console['log'](a5_0x403177[_0x2a1e06(0x1ca)](_0x2a1e06(0x18e))),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x18a)+a5_0x403177[_0x2a1e06(0x208)](_0x50146d)),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x204)+a5_0x403177[_0x2a1e06(0x208)](_0x4dbb88[_0x2a1e06(0x1f9)])),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x20a)+a5_0x403177['white'](_0x4dbb88['agentName'])),console[_0x2a1e06(0x1f1)](),console['log'](_0x2a1e06(0x1bd)+a5_0x403177['white'](_0x5ad8af['length']));for(let _0x15b5c1=0x0;_0x15b5c1<_0x5ad8af[_0x2a1e06(0x192)];_0x15b5c1++){const _0x162432=_0x5ad8af[_0x15b5c1],_0x520057=_0x162432[_0x2a1e06(0x1b7)][_0x2a1e06(0x192)]===0x1?_0x2a1e06(0x1d6):_0x2a1e06(0x1b7),_0x2feb7d=_0x162432[_0x2a1e06(0x1b9)]?.[_0x2a1e06(0x192)]?'\x20['+_0x162432[_0x2a1e06(0x1b9)][_0x2a1e06(0x1a8)](',\x20')+']':'';console[_0x2a1e06(0x1f1)]('\x20\x20'+(_0x15b5c1+0x1)+'.\x20'+a5_0x403177['white'](_0x162432[_0x2a1e06(0x1d1)])+'\x20('+_0x162432[_0x2a1e06(0x1b7)]['length']+'\x20'+_0x520057+')'+a5_0x403177['dim'](_0x2feb7d));}return 0x0;}let _0x34d9ca,_0x5c0b35;try{_0x34d9ca=await _0x4607c0[_0x2a1e06(0x1b5)][_0x2a1e06(0x213)](_0x4dbb88[_0x2a1e06(0x1f9)]);}catch(_0x329c36){const _0x20ea26=_0x329c36 instanceof Error?_0x329c36[_0x2a1e06(0x20e)]:String(_0x329c36);return _0x20ea26[_0x2a1e06(0x195)](_0x2a1e06(0x190))||_0x20ea26[_0x2a1e06(0x1b1)]()['includes'](_0x2a1e06(0x19f))?console[_0x2a1e06(0x1f1)](a5_0x403177['red']('✗\x20ERROR:\x20Project\x20not\x20found:\x20'+_0x4dbb88[_0x2a1e06(0x1f9)])):console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1de)](_0x2a1e06(0x1f4)+_0x4dbb88['projectName']+_0x2a1e06(0x1c9)+_0x20ea26)),0x1;}try{_0x5c0b35=await _0x4607c0['llm'][_0x2a1e06(0x1ad)](_0x4dbb88[_0x2a1e06(0x218)],_0x34d9ca);}catch(_0x45ff77){const _0x267c14=_0x45ff77 instanceof Error?_0x45ff77[_0x2a1e06(0x20e)]:String(_0x45ff77);return _0x267c14['includes']('404')||_0x267c14[_0x2a1e06(0x1b1)]()['includes'](_0x2a1e06(0x19f))?console['log'](a5_0x403177[_0x2a1e06(0x1de)]('✗\x20ERROR:\x20Agent\x20not\x20found:\x20'+_0x4dbb88['agentName'])):console[_0x2a1e06(0x1f1)](a5_0x403177['red'](_0x2a1e06(0x1b3)+_0x4dbb88[_0x2a1e06(0x218)]+_0x2a1e06(0x1c9)+_0x267c14)),0x1;}let _0x352afa;if(!_0x228bd6)try{_0x352afa=await setupEvaluatorAgent(_0x4607c0[_0x2a1e06(0x1b5)],_0x4411d9[_0x2a1e06(0x217)]);}catch(_0x2088c8){const _0x40b741=_0x2088c8 instanceof Error?_0x2088c8[_0x2a1e06(0x20e)]:String(_0x2088c8);return console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1de)](_0x2a1e06(0x1fa)+_0x40b741)),0x1;}console['log'](a5_0x403177[_0x2a1e06(0x1ca)](_0x2a1e06(0x194))),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1fd)+a5_0x403177[_0x2a1e06(0x208)](_0x50146d)),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x199)+a5_0x403177[_0x2a1e06(0x208)](_0x4dbb88['projectName']+'/'+_0x4dbb88['agentName'])),console[_0x2a1e06(0x1f1)]();const _0x4f13e5=[],_0x491fff=[],_0x34f6f7=Date[_0x2a1e06(0x201)]();for(let _0xaf6dc9=0x0;_0xaf6dc9<_0x5ad8af[_0x2a1e06(0x192)];_0xaf6dc9++){const _0x5b3e58=_0x5ad8af[_0xaf6dc9];_0x5ad8af[_0x2a1e06(0x192)]>0x1?console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1c0)+(_0xaf6dc9+0x1)+'/'+_0x5ad8af[_0x2a1e06(0x192)]+':\x20'+a5_0x403177[_0x2a1e06(0x208)](_0x5b3e58[_0x2a1e06(0x1d1)])):console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1e0)+a5_0x403177[_0x2a1e06(0x208)](_0x5b3e58[_0x2a1e06(0x1d1)]));const _0x849800=createCommandSpinner(_0x2a1e06(0x1ff)+_0x5b3e58[_0x2a1e06(0x1b7)][_0x2a1e06(0x192)]+_0x2a1e06(0x1a9));_0x849800[_0x2a1e06(0x216)]();try{const {result:_0x3368da,conversation:_0x522d93}=await runTest(_0x4607c0['llm'],_0x5b3e58,{'agentId':_0x5c0b35,'projectId':_0x34d9ca,'site':_0x50146d,'noEval':_0x228bd6,'evaluatorId':_0x352afa,'onRoundStart':(_0x3131ee,_0x59f361)=>{const _0x28551a=_0x2a1e06;_0x849800[_0x28551a(0x1b6)]='Round\x20'+(_0x3131ee+0x1)+'/'+_0x59f361+_0x28551a(0x1a9);},'onRoundComplete':(_0x1495a5,_0x38c636,_0x760316)=>{const _0xcfa45=_0x2a1e06,_0x369395=formatElapsed(_0x38c636);_0x760316?console[_0xcfa45(0x1f1)](_0xcfa45(0x1a1)+(_0x1495a5+0x1)+'/'+_0x5b3e58['rounds']['length']+'...\x20'+a5_0x403177[_0xcfa45(0x19e)]('✓')+'\x20('+_0x369395+')'):console[_0xcfa45(0x1f1)]('\x20\x20Round\x20'+(_0x1495a5+0x1)+'/'+_0x5b3e58[_0xcfa45(0x1b7)][_0xcfa45(0x192)]+'...\x20'+a5_0x403177[_0xcfa45(0x1de)]('✗'));},'onEvaluationStart':()=>{const _0x474664=_0x2a1e06;_0x849800[_0x474664(0x1b6)]=_0x474664(0x1fe);},'onEvaluationComplete':_0x1c6c2e=>{const _0x3861f4=_0x2a1e06,_0x5bdc53=formatElapsed(_0x1c6c2e);console[_0x3861f4(0x1f1)](_0x3861f4(0x1cf)+a5_0x403177[_0x3861f4(0x19e)]('✓')+'\x20('+_0x5bdc53+')');}});_0x849800[_0x2a1e06(0x1f2)](),_0x4f13e5[_0x2a1e06(0x1c5)](_0x3368da),_0x491fff[_0x2a1e06(0x1c5)](_0x522d93);if(_0x3368da['status']===_0x2a1e06(0x1e4))console['log'](a5_0x403177[_0x2a1e06(0x19e)](_0x2a1e06(0x189)+_0x3368da[_0x2a1e06(0x1eb)]));else _0x3368da[_0x2a1e06(0x1e8)]===_0x2a1e06(0x1a5)?console[_0x2a1e06(0x1f1)](a5_0x403177['red'](_0x2a1e06(0x1cc)+_0x3368da['reason'])):console['log'](a5_0x403177['red']('✗\x20ERROR:\x20'+_0x3368da['reason']));_0x3368da[_0x2a1e06(0x214)]&&console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1df)](_0x2a1e06(0x1e6)+_0x3368da[_0x2a1e06(0x214)])),console[_0x2a1e06(0x1f1)]();}catch(_0x493b08){_0x849800[_0x2a1e06(0x1f2)]();const _0x4f820e=_0x493b08 instanceof Error?_0x493b08['message']:String(_0x493b08);console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1de)](_0x2a1e06(0x1aa)+_0x4f820e)),console[_0x2a1e06(0x1f1)](),_0x4f13e5[_0x2a1e06(0x1c5)]({'name':_0x5b3e58[_0x2a1e06(0x1d1)],'status':_0x2a1e06(0x1a0),'reason':_0x4f820e,'timestamp':new Date()[_0x2a1e06(0x1f6)](),'duration_ms':0x0});}}const _0x4e2c4e=Date[_0x2a1e06(0x201)]()-_0x34f6f7,_0x24d072=_0x4f13e5['filter'](_0x47b397=>_0x47b397[_0x2a1e06(0x1e8)]===_0x2a1e06(0x1e4))[_0x2a1e06(0x192)],_0x1cdd0d=_0x4f13e5[_0x2a1e06(0x1c2)](_0x1f9b77=>_0x1f9b77[_0x2a1e06(0x1e8)]===_0x2a1e06(0x1a5))['length'],_0x1aa6d4=_0x4f13e5['filter'](_0x9dee6c=>_0x9dee6c[_0x2a1e06(0x1e8)]===_0x2a1e06(0x1a0))[_0x2a1e06(0x192)];console['log']('━'[_0x2a1e06(0x209)](0x3c)),console['log']('Test\x20Summary'),console['log']('━'[_0x2a1e06(0x209)](0x3c)),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1c3)+_0x4f13e5[_0x2a1e06(0x192)]),console['log'](_0x2a1e06(0x1fc)+a5_0x403177[_0x2a1e06(0x19e)](_0x24d072)),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x215)+a5_0x403177[_0x2a1e06(0x1de)](_0x1cdd0d));_0x1aa6d4>0x0&&console['log']('Errors:\x20\x20\x20'+a5_0x403177[_0x2a1e06(0x1de)](_0x1aa6d4));console[_0x2a1e06(0x1f1)]('Duration:\x20'+formatElapsed(_0x4e2c4e)),console[_0x2a1e06(0x1f1)]('━'[_0x2a1e06(0x209)](0x3c));const _0xea2553=_0x4f13e5[_0x2a1e06(0x1c2)](_0x2e5e53=>_0x2e5e53[_0x2a1e06(0x1e8)]!==_0x2a1e06(0x1e4));if(_0xea2553[_0x2a1e06(0x192)]>0x0){console[_0x2a1e06(0x1f1)](),console[_0x2a1e06(0x1f1)](_0x2a1e06(0x1af));for(const _0x2c703d of _0xea2553){const _0x4ee9bc=a5_0x403177[_0x2a1e06(0x1de)]('✗'),_0x40521d=_0x2c703d[_0x2a1e06(0x1eb)][_0x2a1e06(0x192)]>0x32?_0x2c703d['reason']['substring'](0x0,0x32)+_0x2a1e06(0x1a2):_0x2c703d[_0x2a1e06(0x1eb)];console[_0x2a1e06(0x1f1)]('\x20\x20'+_0x4ee9bc+'\x20'+_0x2c703d[_0x2a1e06(0x1d1)]+':\x20'+_0x40521d);}}const _0x31d02f={'summary':{'total':_0x4f13e5[_0x2a1e06(0x192)],'passed':_0x24d072,'failed':_0x1cdd0d,'errors':_0x1aa6d4>0x0?_0x1aa6d4:undefined,'duration_ms':_0x4e2c4e},'tests':_0x4f13e5,'agent':{'project':_0x4dbb88[_0x2a1e06(0x1f9)],'name':_0x4dbb88[_0x2a1e06(0x218)],'site':_0x50146d},'timestamp':new Date(_0x34f6f7)[_0x2a1e06(0x1f6)]()};try{const _0xbdee7b=buildCachedTestRun(_0x491fff,{'site':_0x50146d,'projectId':_0x34d9ca,'projectName':_0x4dbb88[_0x2a1e06(0x1f9)],'agentId':_0x5c0b35,'agentName':_0x4dbb88[_0x2a1e06(0x218)],'testYmlPath':a5_0x1113c4[_0x2a1e06(0x1e5)](_0x4dbb88[_0x2a1e06(0x1c1)])});saveLastTestRun(_0xbdee7b);}catch{}if(_0x4bf923!==_0x2a1e06(0x20c)||_0x2f1a35){const _0x2fded9=formatResults(_0x31d02f,_0x4bf923);if(_0x2f1a35)try{a5_0x3e7783[_0x2a1e06(0x1a4)](_0x2f1a35,_0x2fded9,'utf-8'),console[_0x2a1e06(0x1f1)](),console[_0x2a1e06(0x1f1)](a5_0x403177['dim']('Output\x20written\x20to:\x20'+_0x2f1a35));}catch(_0x1691a4){return console['log'](),console[_0x2a1e06(0x1f1)](a5_0x403177[_0x2a1e06(0x1de)](_0x2a1e06(0x19a)+_0x1691a4)),0x1;}else console[_0x2a1e06(0x1f1)](),console[_0x2a1e06(0x1f1)](_0x2fded9);}return _0xea2553[_0x2a1e06(0x192)]>0x0?0x1:0x0;}async['executeReeval'](_0x345e13,_0x179b66){const _0x26c603=a5_0x1a2d62,{options:_0x499f2c,tdx:_0xa626c4}=_0x345e13,{definition:_0x27f209,agentInfo:_0x444e3b,outputFormat:_0x40e96c,outputFile:_0x469ef6}=_0x179b66,_0x524d24=_0x499f2c[_0x26c603(0x1cb)],_0x488ff1=loadLastTestRun();if(!_0x488ff1)return console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1de)]('Error:\x20No\x20previous\x20test\x20run\x20found.')),console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1df)](_0x26c603(0x1d7))),0x1;if(_0x488ff1[_0x26c603(0x19c)][_0x26c603(0x218)]!==_0x444e3b[_0x26c603(0x218)])return console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1de)]('Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22'+_0x488ff1['agent'][_0x26c603(0x218)]+_0x26c603(0x1a7)+_0x444e3b[_0x26c603(0x218)]+'\x22.')),console[_0x26c603(0x1f1)](a5_0x403177['dim']('Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.')),0x1;const _0x58cd6a=new Set(_0x488ff1['conversations']['map'](_0x5e53fe=>_0x5e53fe['testName'])),_0x4f8693=_0x27f209[_0x26c603(0x1fb)][_0x26c603(0x1c2)](_0x13d711=>!_0x58cd6a[_0x26c603(0x220)](_0x13d711[_0x26c603(0x1d1)]));if(_0x4f8693[_0x26c603(0x192)]>0x0&&_0x488ff1[_0x26c603(0x1cb)]!==_0x524d24)return console[_0x26c603(0x1f1)](a5_0x403177['red'](_0x26c603(0x1f0))),console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1df)](_0x26c603(0x20b)+_0x488ff1[_0x26c603(0x1cb)]+_0x26c603(0x1e3)+_0x524d24+'\x22.')),console[_0x26c603(0x1f1)](a5_0x403177['dim'](_0x26c603(0x203)+_0x488ff1[_0x26c603(0x1cb)]+_0x26c603(0x1b2))),0x1;const _0x3aa49b=_0x27f209[_0x26c603(0x1fb)][_0x26c603(0x1c2)](_0x560838=>_0x58cd6a['has'](_0x560838['name'])),_0x3cc9a3=_0x4f8693;let _0x5e1c22;try{_0x5e1c22=await setupEvaluatorAgent(_0xa626c4[_0x26c603(0x1b5)],_0x499f2c[_0x26c603(0x217)]);}catch(_0x2c79e7){const _0x32c123=_0x2c79e7 instanceof Error?_0x2c79e7[_0x26c603(0x20e)]:String(_0x2c79e7);return console[_0x26c603(0x1f1)](a5_0x403177['red'](_0x26c603(0x1fa)+_0x32c123)),0x1;}console[_0x26c603(0x1f1)](a5_0x403177['cyan'](_0x26c603(0x1c4))),console[_0x26c603(0x1f1)](_0x26c603(0x1e1)+a5_0x403177['white'](_0x488ff1['timestamp'])),console[_0x26c603(0x1f1)](_0x26c603(0x199)+a5_0x403177['white'](_0x488ff1[_0x26c603(0x19c)]['projectName']+'/'+_0x488ff1['agent']['agentName']));_0x3cc9a3[_0x26c603(0x192)]>0x0&&console[_0x26c603(0x1f1)](_0x26c603(0x196)+a5_0x403177[_0x26c603(0x1bf)](_0x3cc9a3[_0x26c603(0x192)]));console['log']();const _0x5afe6a=[],_0x52817e=Date[_0x26c603(0x201)](),_0x5f2eba=createCommandSpinner('Re-evaluating...');if(_0x3aa49b[_0x26c603(0x192)]>0x0)try{const _0x1b14fd=await reevaluateFromCache(_0xa626c4[_0x26c603(0x1b5)],_0x488ff1,{'tests':_0x3aa49b},{'evaluatorId':_0x5e1c22,'onTestStart':(_0x14ca90,_0xb0a3f0,_0x3dba2a)=>{const _0x389e39=_0x26c603;_0x5f2eba[_0x389e39(0x1b6)]=_0x389e39(0x18f)+(_0xb0a3f0+0x1)+'/'+_0x3dba2a+':\x20'+_0x14ca90+_0x389e39(0x1a2);if(!_0x5f2eba[_0x389e39(0x1ac)])_0x5f2eba[_0x389e39(0x216)]();},'onTestComplete':(_0x4f8a04,_0x901431)=>{const _0x5a8ffd=_0x26c603;_0x5f2eba['stop']();if(_0x901431[_0x5a8ffd(0x1e8)]===_0x5a8ffd(0x1e4))console[_0x5a8ffd(0x1f1)](a5_0x403177[_0x5a8ffd(0x19e)](_0x5a8ffd(0x189)+_0x4f8a04)+a5_0x403177[_0x5a8ffd(0x1df)](_0x5a8ffd(0x1dc)));else _0x901431[_0x5a8ffd(0x1e8)]===_0x5a8ffd(0x1a5)?console[_0x5a8ffd(0x1f1)](a5_0x403177[_0x5a8ffd(0x1de)](_0x5a8ffd(0x1cc)+_0x4f8a04+_0x5a8ffd(0x1e2)+_0x901431[_0x5a8ffd(0x1eb)])+a5_0x403177['dim']('\x20(cached)')):console[_0x5a8ffd(0x1f1)](a5_0x403177[_0x5a8ffd(0x1de)]('✗\x20ERROR:\x20'+_0x4f8a04+_0x5a8ffd(0x1e2)+_0x901431['reason']));_0x901431[_0x5a8ffd(0x214)]&&console[_0x5a8ffd(0x1f1)](a5_0x403177[_0x5a8ffd(0x1df)](_0x5a8ffd(0x1ea)+_0x901431[_0x5a8ffd(0x214)])),_0x5afe6a[_0x5a8ffd(0x1c5)](_0x901431);},'onTestSkipped':(_0x493d26,_0x2ae20b)=>{const _0x21f1c2=_0x26c603;_0x5f2eba[_0x21f1c2(0x1f2)](),console[_0x21f1c2(0x1f1)](a5_0x403177[_0x21f1c2(0x1bf)](_0x21f1c2(0x1c7)+_0x493d26+_0x21f1c2(0x1e2)+_0x2ae20b));}});for(const _0x72ab19 of _0x1b14fd){!_0x5afe6a[_0x26c603(0x1ce)](_0x881848=>_0x881848[_0x26c603(0x1d1)]===_0x72ab19[_0x26c603(0x1d1)])&&_0x5afe6a[_0x26c603(0x1c5)](_0x72ab19);}}catch(_0x10d397){_0x5f2eba[_0x26c603(0x1f2)]();const _0x445fee=_0x10d397 instanceof Error?_0x10d397[_0x26c603(0x20e)]:String(_0x10d397);return console[_0x26c603(0x1f1)](a5_0x403177['red']('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0x445fee)),0x1;}_0x5f2eba[_0x26c603(0x1f2)]();if(_0x3cc9a3['length']>0x0){console[_0x26c603(0x1f1)](),console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1ca)](_0x26c603(0x1f5)));const {projectId:_0x67183c,agentId:_0x55070b}=_0x488ff1[_0x26c603(0x19c)];for(const _0x5be3a3 of _0x3cc9a3){console[_0x26c603(0x1f1)](_0x26c603(0x193)+a5_0x403177[_0x26c603(0x208)](_0x5be3a3[_0x26c603(0x1d1)]));const _0x2335b6=createCommandSpinner(_0x26c603(0x1ff)+_0x5be3a3[_0x26c603(0x1b7)][_0x26c603(0x192)]+_0x26c603(0x1a9));_0x2335b6[_0x26c603(0x216)]();try{const {result:_0x5266e1}=await runTest(_0xa626c4[_0x26c603(0x1b5)],_0x5be3a3,{'agentId':_0x55070b,'projectId':_0x67183c,'site':_0x488ff1['site'],'noEval':![],'evaluatorId':_0x5e1c22,'onRoundStart':(_0x11be84,_0x3eca7d)=>{const _0x30c1e4=_0x26c603;_0x2335b6['text']=_0x30c1e4(0x1be)+(_0x11be84+0x1)+'/'+_0x3eca7d+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x56a08e,_0x2dcac5,_0x4b94d8)=>{const _0x504bd8=_0x26c603,_0x53c263=formatElapsed(_0x2dcac5);_0x4b94d8?console['log'](_0x504bd8(0x1a1)+(_0x56a08e+0x1)+'/'+_0x5be3a3[_0x504bd8(0x1b7)]['length']+_0x504bd8(0x211)+a5_0x403177['green']('✓')+'\x20('+_0x53c263+')'):console[_0x504bd8(0x1f1)](_0x504bd8(0x1a1)+(_0x56a08e+0x1)+'/'+_0x5be3a3['rounds'][_0x504bd8(0x192)]+_0x504bd8(0x211)+a5_0x403177[_0x504bd8(0x1de)]('✗'));},'onEvaluationStart':()=>{const _0x56e9da=_0x26c603;_0x2335b6['text']=_0x56e9da(0x1fe);},'onEvaluationComplete':_0x10d908=>{const _0x3594d2=_0x26c603,_0x2a8806=formatElapsed(_0x10d908);console[_0x3594d2(0x1f1)](_0x3594d2(0x1cf)+a5_0x403177[_0x3594d2(0x19e)]('✓')+'\x20('+_0x2a8806+')');}});_0x2335b6[_0x26c603(0x1f2)](),_0x5afe6a['push'](_0x5266e1);if(_0x5266e1[_0x26c603(0x1e8)]===_0x26c603(0x1e4))console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x19e)](_0x26c603(0x189)+_0x5266e1[_0x26c603(0x1eb)])+a5_0x403177[_0x26c603(0x1df)](_0x26c603(0x202)));else _0x5266e1[_0x26c603(0x1e8)]===_0x26c603(0x1a5)?console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1de)](_0x26c603(0x1cc)+_0x5266e1['reason'])+a5_0x403177['dim'](_0x26c603(0x202))):console['log'](a5_0x403177['red'](_0x26c603(0x1aa)+_0x5266e1[_0x26c603(0x1eb)]));_0x5266e1[_0x26c603(0x214)]&&console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1df)](_0x26c603(0x1ea)+_0x5266e1[_0x26c603(0x214)]));}catch(_0x24d992){_0x2335b6[_0x26c603(0x1f2)]();const _0xe72d7e=_0x24d992 instanceof Error?_0x24d992[_0x26c603(0x20e)]:String(_0x24d992);console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1de)](_0x26c603(0x1aa)+_0xe72d7e)),_0x5afe6a[_0x26c603(0x1c5)]({'name':_0x5be3a3['name'],'status':_0x26c603(0x1a0),'reason':_0xe72d7e,'timestamp':new Date()[_0x26c603(0x1f6)](),'duration_ms':0x0});}}}console[_0x26c603(0x1f1)]();const _0x38fabc=Date[_0x26c603(0x201)]()-_0x52817e,_0x33dbdf=_0x5afe6a[_0x26c603(0x1c2)](_0x2c063c=>_0x2c063c[_0x26c603(0x1e8)]==='PASS')[_0x26c603(0x192)],_0x3ffe58=_0x5afe6a[_0x26c603(0x1c2)](_0x19f654=>_0x19f654[_0x26c603(0x1e8)]===_0x26c603(0x1a5))[_0x26c603(0x192)],_0x1ec711=_0x5afe6a[_0x26c603(0x1c2)](_0x3fddbe=>_0x3fddbe[_0x26c603(0x1e8)]==='ERROR')[_0x26c603(0x192)];console['log']('━'[_0x26c603(0x209)](0x3c)),console[_0x26c603(0x1f1)]('Re-evaluation\x20Summary'),console[_0x26c603(0x1f1)]('━'[_0x26c603(0x209)](0x3c)),console[_0x26c603(0x1f1)](_0x26c603(0x1c3)+_0x5afe6a[_0x26c603(0x192)]),console[_0x26c603(0x1f1)](_0x26c603(0x1fc)+a5_0x403177[_0x26c603(0x19e)](_0x33dbdf)),console[_0x26c603(0x1f1)](_0x26c603(0x215)+a5_0x403177[_0x26c603(0x1de)](_0x3ffe58));_0x1ec711>0x0&&console[_0x26c603(0x1f1)](_0x26c603(0x20d)+a5_0x403177[_0x26c603(0x1de)](_0x1ec711));console[_0x26c603(0x1f1)]('Duration:\x20'+formatElapsed(_0x38fabc)),console[_0x26c603(0x1f1)]('━'[_0x26c603(0x209)](0x3c));const _0x4a89d8={'summary':{'total':_0x5afe6a['length'],'passed':_0x33dbdf,'failed':_0x3ffe58,'errors':_0x1ec711>0x0?_0x1ec711:undefined,'duration_ms':_0x38fabc},'tests':_0x5afe6a,'agent':{'project':_0x444e3b['projectName'],'name':_0x444e3b[_0x26c603(0x218)],'site':_0x524d24},'timestamp':new Date(_0x52817e)['toISOString']()};if(_0x40e96c!==_0x26c603(0x20c)||_0x469ef6){const _0x2db368=formatResults(_0x4a89d8,_0x40e96c);if(_0x469ef6)try{a5_0x3e7783[_0x26c603(0x1a4)](_0x469ef6,_0x2db368,_0x26c603(0x1ae)),console['log'](),console[_0x26c603(0x1f1)](a5_0x403177['dim'](_0x26c603(0x1d4)+_0x469ef6));}catch(_0x4bd709){return console[_0x26c603(0x1f1)](),console[_0x26c603(0x1f1)](a5_0x403177[_0x26c603(0x1de)](_0x26c603(0x19a)+_0x4bd709)),0x1;}else console[_0x26c603(0x1f1)](),console[_0x26c603(0x1f1)](_0x2db368);}const _0x1585fe=_0x5afe6a[_0x26c603(0x1c2)](_0x5b0597=>_0x5b0597['status']!==_0x26c603(0x1e4));return _0x1585fe['length']>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a6_0x55339a=a6_0x3566;(function(_0x25667e,_0x17a2c4){const _0xecdc18=a6_0x3566,_0x356379=_0x25667e();while(!![]){try{const _0xa4569c=-parseInt(_0xecdc18(0x150))/0x1*(parseInt(_0xecdc18(0x160))/0x2)+parseInt(_0xecdc18(0x12a))/0x3+parseInt(_0xecdc18(0x126))/0x4*(-parseInt(_0xecdc18(0x156))/0x5)+-parseInt(_0xecdc18(0x13a))/0x6*(-parseInt(_0xecdc18(0x12e))/0x7)+parseInt(_0xecdc18(0x12c))/0x8+-parseInt(_0xecdc18(0x142))/0x9*(parseInt(_0xecdc18(0x152))/0xa)+parseInt(_0xecdc18(0x11e))/0xb*(-parseInt(_0xecdc18(0x120))/0xc);if(_0xa4569c===_0x17a2c4)break;else _0x356379['push'](_0x356379['shift']());}catch(_0x2c67f5){_0x356379['push'](_0x356379['shift']());}}}(a6_0x3794,0xa8909));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';function a6_0x3566(_0x12bf7e,_0x41a34a){_0x12bf7e=_0x12bf7e-0x111;const _0x3794ba=a6_0x3794();let _0x3566b2=_0x3794ba[_0x12bf7e];return _0x3566b2;}import{writeFileSync}from'fs';function a6_0x3794(){const _0x10bd99=['verbose','indexOf','workflow','file','isArray','x-xsrf-token','join','length','stack','site','22KcoMkJ','output','4616676dEpZly','readBodyFromFile','data','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','keys','description','1013072JJBmTo','Invalid\x20HTTP\x20method:\x20','type','x-trino-user','2160843VRbjtf','name','9695824VxwaBq','.\x20Valid\x20methods:\x20','7tCpxdC','cookie','llm','entries','has','execute','Invalid\x20header\x20format:\x20\x22','<\x20HTTP/1.1\x20','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','noColor','Invalid\x20API\x20type:\x20','GET','6067956hnhKNq','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','cas','trim','toUpperCase','api','headers','\x22.\x20','1104993RFyGvU','includes','method','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','header','startsWith','Endpoint\x20must\x20start\x20with\x20/:\x20','body','trino','toLowerCase','x-auth-token','log','Error:\x20','llm-proxy','7TlkQtc','status','100ujDZpV','.\x20Valid\x20types:\x20','message','proxy-authorization','5zqHeah','set-cookie2','validate','color','error','\x0aStack\x20trace:\x0a','DELETE','substring','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','PATCH','760QFaqoU','request','cdp','PUT'];a6_0x3794=function(){return _0x10bd99;};return a6_0x3794();}import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a6_0x55339a(0x155),a6_0x55339a(0x12f),'set-cookie',a6_0x55339a(0x157),a6_0x55339a(0x119),a6_0x55339a(0x14c),a6_0x55339a(0x129)]);function isSensitiveHeader(_0x38d1dc){const _0x5f1e97=a6_0x55339a;return SENSITIVE_HEADERS[_0x5f1e97(0x132)](_0x38d1dc[_0x5f1e97(0x14b)]());}function parseHeader(_0x18fd5e){const _0x50e544=a6_0x55339a,_0x5eaf2e=_0x18fd5e[_0x50e544(0x115)](':');if(_0x5eaf2e===-0x1)throw new Error(_0x50e544(0x134)+_0x18fd5e+_0x50e544(0x141)+_0x50e544(0x136));const _0x372489=_0x18fd5e[_0x50e544(0x15d)](0x0,_0x5eaf2e)['trim'](),_0x4ef93e=_0x18fd5e['substring'](_0x5eaf2e+0x1)[_0x50e544(0x13d)]();if(!_0x372489)throw new Error(_0x50e544(0x123)+_0x18fd5e+'\x22');return[_0x372489,_0x4ef93e];}export class ApiCommand extends BaseCommand{[a6_0x55339a(0x12b)]=a6_0x55339a(0x13f);[a6_0x55339a(0x125)]=a6_0x55339a(0x13b);[a6_0x55339a(0x158)](_0x2414a9){const _0x4539c4=a6_0x55339a,{args:_0x4e9d4c,options:_0x45a528}=_0x2414a9,_0x5a2fc9=_0x45a528;if(_0x4e9d4c[_0x4539c4(0x11b)]===0x0)return _0x4539c4(0x145);const _0x457b84=_0x4e9d4c[0x0];if(!_0x457b84[_0x4539c4(0x147)]('/'))return _0x4539c4(0x148)+_0x457b84;const _0x429df3=_0x5a2fc9['data'],_0x5a819a=_0x5a2fc9[_0x4539c4(0x117)];if(_0x429df3&&_0x5a819a)return _0x4539c4(0x15e);const _0x54a2f8=_0x5a2fc9[_0x4539c4(0x144)]||_0x4539c4(0x139),_0xed9398=[_0x4539c4(0x139),'POST',_0x4539c4(0x113),_0x4539c4(0x15c),_0x4539c4(0x15f)];if(!_0xed9398[_0x4539c4(0x143)](_0x54a2f8[_0x4539c4(0x13e)]()))return _0x4539c4(0x127)+_0x54a2f8+_0x4539c4(0x12d)+_0xed9398[_0x4539c4(0x11a)](',\x20');const _0x3ef2ae=_0x5a2fc9[_0x4539c4(0x128)]||'td',_0x48ad5b=['td',_0x4539c4(0x112),_0x4539c4(0x116),_0x4539c4(0x14a),_0x4539c4(0x130),_0x4539c4(0x14f),_0x4539c4(0x13c)];if(!_0x48ad5b[_0x4539c4(0x143)](_0x3ef2ae))return _0x4539c4(0x138)+_0x3ef2ae+_0x4539c4(0x153)+_0x48ad5b[_0x4539c4(0x11a)](',\x20');return undefined;}async[a6_0x55339a(0x133)](_0x52ea84){const _0x3a0e1a=a6_0x55339a,{options:_0x7626d4,args:_0x3731ea,tdx:_0x3bff56}=_0x52ea84,_0x43db91=_0x7626d4,_0x3d038f=_0x3731ea[0x0],_0x1ffdc8=(_0x43db91[_0x3a0e1a(0x144)]||_0x3a0e1a(0x139))[_0x3a0e1a(0x13e)](),_0x32aae1=_0x43db91[_0x3a0e1a(0x122)],_0x4309de=_0x43db91['file'],_0x229efd=_0x43db91[_0x3a0e1a(0x146)],_0x571c55=_0x43db91[_0x3a0e1a(0x128)]||'td';try{const _0x2f2fd5={};if(_0x229efd){const _0x8f6499=Array[_0x3a0e1a(0x118)](_0x229efd)?_0x229efd:[_0x229efd];for(const _0x105967 of _0x8f6499){const [_0x1e4469,_0x546b6f]=parseHeader(_0x105967);_0x2f2fd5[_0x1e4469]=_0x546b6f;}}let _0x5e6323;if(_0x32aae1)_0x5e6323=_0x32aae1;else{if(_0x4309de)try{_0x5e6323=RawAPI[_0x3a0e1a(0x121)](_0x4309de);}catch(_0x356ee2){return console[_0x3a0e1a(0x15a)](_0x3a0e1a(0x14e)+(_0x356ee2 instanceof Error?_0x356ee2[_0x3a0e1a(0x154)]:String(_0x356ee2))),0x1;}}const _0x14c8c2={'method':_0x1ffdc8,'apiType':_0x571c55,'includeHeaders':_0x7626d4[_0x3a0e1a(0x114)]};_0x5e6323&&(_0x14c8c2[_0x3a0e1a(0x149)]=_0x5e6323);Object[_0x3a0e1a(0x124)](_0x2f2fd5)['length']>0x0&&(_0x14c8c2[_0x3a0e1a(0x140)]=_0x2f2fd5);if(_0x7626d4[_0x3a0e1a(0x114)]){const _0x45a6ca=resolveSite(_0x7626d4[_0x3a0e1a(0x11d)]),_0x421ce7=getEndpoint(_0x45a6ca,_0x571c55),_0x1a89d6=''+_0x421ce7+_0x3d038f;console[_0x3a0e1a(0x15a)]('>\x20'+_0x1ffdc8+'\x20'+_0x1a89d6);const _0x444dc3=getAuthHeaders(_0x45a6ca),_0x2f5af8={..._0x444dc3,..._0x2f2fd5};for(const [_0x33c247,_0x41a99d]of Object[_0x3a0e1a(0x131)](_0x2f5af8)){!isSensitiveHeader(_0x33c247)&&console[_0x3a0e1a(0x15a)]('>\x20'+_0x33c247+':\x20'+_0x41a99d);}_0x5e6323&&console['error']('>'),console[_0x3a0e1a(0x15a)]('');}const _0x2167bb=await _0x3bff56['api'][_0x3a0e1a(0x111)](_0x3d038f,_0x14c8c2);if(_0x7626d4[_0x3a0e1a(0x114)]&&_0x2167bb['headers']){console[_0x3a0e1a(0x15a)](_0x3a0e1a(0x135)+_0x2167bb[_0x3a0e1a(0x151)]);for(const [_0x843916,_0x37f641]of Object[_0x3a0e1a(0x131)](_0x2167bb[_0x3a0e1a(0x140)])){!isSensitiveHeader(_0x843916)&&console[_0x3a0e1a(0x15a)]('<\x20'+_0x843916+':\x20'+_0x37f641);}console[_0x3a0e1a(0x15a)]('');}const _0x4fe7c8=Boolean(_0x7626d4[_0x3a0e1a(0x11f)]),_0x32c4a7={'color':_0x7626d4[_0x3a0e1a(0x159)],'noColor':_0x7626d4[_0x3a0e1a(0x137)]||_0x4fe7c8&&!_0x7626d4['color']},_0x188c7e=colorizeJSON(_0x2167bb[_0x3a0e1a(0x122)],_0x32c4a7);return _0x7626d4[_0x3a0e1a(0x11f)]?(writeFileSync(_0x7626d4['output'],_0x188c7e),console[_0x3a0e1a(0x15a)]('Results\x20saved\x20to\x20'+_0x7626d4['output'])):console[_0x3a0e1a(0x14d)](_0x188c7e),0x0;}catch(_0x315b7c){return _0x315b7c instanceof Error?(console['error'](_0x3a0e1a(0x14e)+_0x315b7c[_0x3a0e1a(0x154)]),_0x7626d4[_0x3a0e1a(0x114)]&&_0x315b7c[_0x3a0e1a(0x11c)]&&console['error'](_0x3a0e1a(0x15b)+_0x315b7c[_0x3a0e1a(0x11c)])):console[_0x3a0e1a(0x15a)](_0x3a0e1a(0x14e)+String(_0x315b7c)),0x1;}}}
1
+ const a6_0x22b889=a6_0x1224;(function(_0x11641b,_0x369336){const _0x5c9ae8=a6_0x1224,_0x43872b=_0x11641b();while(!![]){try{const _0x3ccdf7=parseInt(_0x5c9ae8(0x21e))/0x1+-parseInt(_0x5c9ae8(0x1f7))/0x2+parseInt(_0x5c9ae8(0x1f8))/0x3+parseInt(_0x5c9ae8(0x1da))/0x4*(parseInt(_0x5c9ae8(0x1ed))/0x5)+parseInt(_0x5c9ae8(0x211))/0x6+parseInt(_0x5c9ae8(0x1e7))/0x7*(parseInt(_0x5c9ae8(0x1ff))/0x8)+-parseInt(_0x5c9ae8(0x1e9))/0x9;if(_0x3ccdf7===_0x369336)break;else _0x43872b['push'](_0x43872b['shift']());}catch(_0x3e18b5){_0x43872b['push'](_0x43872b['shift']());}}}(a6_0x5ea8,0xe2e3c));function a6_0x5ea8(){const _0x5368d3=['414496IXlOAo','cas','\x0aStack\x20trace:\x0a','name','file','readBodyFromFile','substring','toLowerCase','description','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','headers','trim','cookie','135023rnLMdm','color','22276035iJlVZb','toUpperCase','POST','api','20IYOoDo','DELETE','entries','GET','proxy-authorization','validate','site','message','body','noColor','3231768vaLKNr','2523660douGuA','log','request','Invalid\x20HTTP\x20method:\x20','x-auth-token','.\x20Valid\x20methods:\x20','status','720qiRUDS','PUT','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','error','PATCH','execute','startsWith','length','includes','stack','workflow','x-xsrf-token','Endpoint\x20must\x20start\x20with\x20/:\x20','set-cookie2','type','Results\x20saved\x20to\x20','x-trino-user','verbose','2421720ENHRKu','llm-proxy','join','set-cookie','has','Error:\x20','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','output','method','.\x20Valid\x20types:\x20','indexOf','data','llm','1624993wwHhCB'];a6_0x5ea8=function(){return _0x5368d3;};return a6_0x5ea8();}import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a6_0x22b889(0x1f1),a6_0x22b889(0x1e6),a6_0x22b889(0x214),a6_0x22b889(0x20c),a6_0x22b889(0x20a),a6_0x22b889(0x1fc),a6_0x22b889(0x20f)]);function isSensitiveHeader(_0x4f0854){const _0x4c0eee=a6_0x22b889;return SENSITIVE_HEADERS[_0x4c0eee(0x215)](_0x4f0854[_0x4c0eee(0x1e1)]());}function parseHeader(_0x17c040){const _0x4a60ed=a6_0x22b889,_0x4a2ed5=_0x17c040[_0x4a60ed(0x21b)](':');if(_0x4a2ed5===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x17c040+'\x22.\x20'+_0x4a60ed(0x1e3));const _0x1052af=_0x17c040[_0x4a60ed(0x1e0)](0x0,_0x4a2ed5)['trim'](),_0x802eca=_0x17c040[_0x4a60ed(0x1e0)](_0x4a2ed5+0x1)[_0x4a60ed(0x1e5)]();if(!_0x1052af)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x17c040+'\x22');return[_0x1052af,_0x802eca];}function a6_0x1224(_0x55948b,_0x488d9a){_0x55948b=_0x55948b-0x1da;const _0x5ea8a9=a6_0x5ea8();let _0x122494=_0x5ea8a9[_0x55948b];return _0x122494;}export class ApiCommand extends BaseCommand{[a6_0x22b889(0x1dd)]='api';[a6_0x22b889(0x1e2)]='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a6_0x22b889(0x1f2)](_0x581004){const _0x5a66f2=a6_0x22b889,{args:_0x35c862,options:_0x3eeb4d}=_0x581004,_0x5f1ca7=_0x3eeb4d;if(_0x35c862['length']===0x0)return _0x5a66f2(0x217);const _0x1bf3e6=_0x35c862[0x0];if(!_0x1bf3e6[_0x5a66f2(0x205)]('/'))return _0x5a66f2(0x20b)+_0x1bf3e6;const _0x5ac09f=_0x5f1ca7[_0x5a66f2(0x21c)],_0x5669a1=_0x5f1ca7[_0x5a66f2(0x1de)];if(_0x5ac09f&&_0x5669a1)return _0x5a66f2(0x201);const _0x11c73a=_0x5f1ca7[_0x5a66f2(0x219)]||_0x5a66f2(0x1f0),_0x1b1ef8=[_0x5a66f2(0x1f0),_0x5a66f2(0x1eb),_0x5a66f2(0x200),_0x5a66f2(0x1ee),_0x5a66f2(0x203)];if(!_0x1b1ef8[_0x5a66f2(0x207)](_0x11c73a[_0x5a66f2(0x1ea)]()))return _0x5a66f2(0x1fb)+_0x11c73a+_0x5a66f2(0x1fd)+_0x1b1ef8[_0x5a66f2(0x213)](',\x20');const _0x9c43c4=_0x5f1ca7[_0x5a66f2(0x20d)]||'td',_0x22f953=['td','cdp',_0x5a66f2(0x209),'trino',_0x5a66f2(0x21d),_0x5a66f2(0x212),_0x5a66f2(0x1db)];if(!_0x22f953[_0x5a66f2(0x207)](_0x9c43c4))return'Invalid\x20API\x20type:\x20'+_0x9c43c4+_0x5a66f2(0x21a)+_0x22f953[_0x5a66f2(0x213)](',\x20');return undefined;}async[a6_0x22b889(0x204)](_0x1f5f07){const _0x3c0733=a6_0x22b889,{options:_0x4586c5,args:_0x62140f,tdx:_0x58e4a3}=_0x1f5f07,_0x5bca39=_0x4586c5,_0x168c45=_0x62140f[0x0],_0x132765=(_0x5bca39['method']||_0x3c0733(0x1f0))[_0x3c0733(0x1ea)](),_0x5f2c27=_0x5bca39[_0x3c0733(0x21c)],_0x2f0e82=_0x5bca39['file'],_0xc0925b=_0x5bca39['header'],_0x4a3cd0=_0x5bca39[_0x3c0733(0x20d)]||'td';try{const _0x935e6d={};if(_0xc0925b){const _0x571eb3=Array['isArray'](_0xc0925b)?_0xc0925b:[_0xc0925b];for(const _0x8b41e0 of _0x571eb3){const [_0x1b58dd,_0x520b79]=parseHeader(_0x8b41e0);_0x935e6d[_0x1b58dd]=_0x520b79;}}let _0x1554b4;if(_0x5f2c27)_0x1554b4=_0x5f2c27;else{if(_0x2f0e82)try{_0x1554b4=RawAPI[_0x3c0733(0x1df)](_0x2f0e82);}catch(_0x2421cd){return console[_0x3c0733(0x202)]('Error:\x20'+(_0x2421cd instanceof Error?_0x2421cd['message']:String(_0x2421cd))),0x1;}}const _0x2a2aaa={'method':_0x132765,'apiType':_0x4a3cd0,'includeHeaders':_0x4586c5[_0x3c0733(0x210)]};_0x1554b4&&(_0x2a2aaa[_0x3c0733(0x1f5)]=_0x1554b4);Object['keys'](_0x935e6d)[_0x3c0733(0x206)]>0x0&&(_0x2a2aaa[_0x3c0733(0x1e4)]=_0x935e6d);if(_0x4586c5[_0x3c0733(0x210)]){const _0x290ebe=resolveSite(_0x4586c5[_0x3c0733(0x1f3)]),_0x27726a=getEndpoint(_0x290ebe,_0x4a3cd0),_0x59735d=''+_0x27726a+_0x168c45;console[_0x3c0733(0x202)]('>\x20'+_0x132765+'\x20'+_0x59735d);const _0x4c4a34=getAuthHeaders(_0x290ebe),_0x29f488={..._0x4c4a34,..._0x935e6d};for(const [_0x431a84,_0x4f2f17]of Object[_0x3c0733(0x1ef)](_0x29f488)){!isSensitiveHeader(_0x431a84)&&console[_0x3c0733(0x202)]('>\x20'+_0x431a84+':\x20'+_0x4f2f17);}_0x1554b4&&console['error']('>'),console[_0x3c0733(0x202)]('');}const _0x5ae224=await _0x58e4a3[_0x3c0733(0x1ec)][_0x3c0733(0x1fa)](_0x168c45,_0x2a2aaa);if(_0x4586c5[_0x3c0733(0x210)]&&_0x5ae224[_0x3c0733(0x1e4)]){console[_0x3c0733(0x202)]('<\x20HTTP/1.1\x20'+_0x5ae224[_0x3c0733(0x1fe)]);for(const [_0x407eb1,_0x53d1f5]of Object[_0x3c0733(0x1ef)](_0x5ae224[_0x3c0733(0x1e4)])){!isSensitiveHeader(_0x407eb1)&&console[_0x3c0733(0x202)]('<\x20'+_0x407eb1+':\x20'+_0x53d1f5);}console[_0x3c0733(0x202)]('');}const _0x12cf95=Boolean(_0x4586c5[_0x3c0733(0x218)]),_0x3feb14={'color':_0x4586c5[_0x3c0733(0x1e8)],'noColor':_0x4586c5[_0x3c0733(0x1f6)]||_0x12cf95&&!_0x4586c5[_0x3c0733(0x1e8)]},_0x17a22d=colorizeJSON(_0x5ae224['data'],_0x3feb14);return _0x4586c5[_0x3c0733(0x218)]?(writeFileSync(_0x4586c5[_0x3c0733(0x218)],_0x17a22d),console['error'](_0x3c0733(0x20e)+_0x4586c5[_0x3c0733(0x218)])):console[_0x3c0733(0x1f9)](_0x17a22d),0x0;}catch(_0x9be18f){return _0x9be18f instanceof Error?(console[_0x3c0733(0x202)](_0x3c0733(0x216)+_0x9be18f[_0x3c0733(0x1f4)]),_0x4586c5[_0x3c0733(0x210)]&&_0x9be18f[_0x3c0733(0x208)]&&console[_0x3c0733(0x202)](_0x3c0733(0x1dc)+_0x9be18f['stack'])):console[_0x3c0733(0x202)]('Error:\x20'+String(_0x9be18f)),0x1;}}}
@@ -1 +1 @@
1
- const a7_0x50383e=a7_0x232d;(function(_0x439b7a,_0x36f8a9){const _0x30d984=a7_0x232d,_0x238a4c=_0x439b7a();while(!![]){try{const _0x4db69c=-parseInt(_0x30d984(0xf4))/0x1+-parseInt(_0x30d984(0xab))/0x2+-parseInt(_0x30d984(0xc8))/0x3+-parseInt(_0x30d984(0x100))/0x4*(-parseInt(_0x30d984(0xc1))/0x5)+parseInt(_0x30d984(0xd4))/0x6*(-parseInt(_0x30d984(0xfc))/0x7)+parseInt(_0x30d984(0xe2))/0x8*(parseInt(_0x30d984(0xf0))/0x9)+-parseInt(_0x30d984(0xfe))/0xa;if(_0x4db69c===_0x36f8a9)break;else _0x238a4c['push'](_0x238a4c['shift']());}catch(_0x139f69){_0x238a4c['push'](_0x238a4c['shift']());}}}(a7_0x40a2,0x75357));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens,saveOAuthTokens}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{startOAuthFlow}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';function a7_0x40a2(){const _0x427811=['tdx\x20profile:\x20','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','getUserInfo','✓\x20Default\x20site\x20set\x20to\x20','\x20and\x20','8ibElWC','password','\x20\x20user_id:','trim','description','site','✓\x20Profile\x20\x27','Sign\x20in\x20with\x20browser\x20(recommended)','logLevel','\x27\x20registered','auth:clear','execute','N/A','apikey','8121285QBsExl','warn','\x20(site:\x20','\x20removed\x20from\x20keychain','248292MScKhB','Name:\x20','oauth','API\x20key','\x0aSetup\x20cancelled','yellow','accountName','auth:setup','49fiBYnF','us01','6568960kGBfsP','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','109108NPqcRx','\x20\x20tdx','Read\x20credential\x20from\x20','create','apiKey','Read\x20credential\x20from\x20keychain','access_token','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Validating\x20API\x20key...','method','Remove\x20API\x20key\x20from\x20system\x20keychain','User:\x20','ERROR','53998pYFMVu','message','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20\x20\x20\x201.\x20Run:\x20tdx\x20auth\x20setup\x20--account-name\x20<name>','/app/mp/ak','dim','Choose\x20how\x20to\x20sign\x20in:','email','System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20','filter','Validating\x20OAuth\x20tokens...','System\x20keychain\x20is\x20not\x20available','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','status','\x20(profile:\x20','OAuth\x20tokens','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','green','all','\x20\x20If\x20this\x20is\x20not\x20the\x20expected\x20account:','join','/users/initiate_sso\x20(account:\x20','125hhFQSN','error','Credential\x20type:\x20OAuth','Opens\x20your\x20browser\x20to\x20sign\x20in\x20with\x20SSO','jobs','Account\x20name\x20for\x20SSO\x20(press\x20Enter\x20to\x20skip):','bold','416886dUyAcm','first_name','\x20\x20\x20\x202.\x20Or\x20use\x20a\x20different\x20browser\x20profile\x20to\x20avoid\x20cached\x20sessions','profile','\x20--profile\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','No\x20credential\x20found','Enter\x20your\x20TD\x20API\x20key:','account_id','\x20for\x20profile:\x20','Setup\x20cancelled','cyan','28332fscSNL','select','You\x20can\x20find\x20your\x20API\x20key\x20at:','log','last_name','name','red','✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain','Setting\x20up\x20authentication\x20for\x20site:\x20'];a7_0x40a2=function(){return _0x427811;};return a7_0x40a2();}function a7_0x232d(_0x1d0259,_0x5efb63){_0x1d0259=_0x1d0259-0xaa;const _0x40a2f4=a7_0x40a2();let _0x232dbd=_0x40a2f4[_0x1d0259];return _0x232dbd;}import a7_0x3d30ba 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_0xe9106a from'chalk';export async function runOAuthLoginFlow(_0x491fae,_0xac2601,_0x616163,_0xe76dda){const _0x41e033=a7_0x232d,_0x3b0c85=await isKeychainAvailable();if(!_0x3b0c85)throw new Error(_0x41e033(0xb3)+'Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.');let _0x25fa88=_0xe76dda?.[_0x41e033(0xfa)];if(!_0x25fa88){const _0x3b9ef2=await a7_0x3d30ba({'type':'text','name':_0x41e033(0xfa),'message':_0x41e033(0xc6)});if(_0x3b9ef2[_0x41e033(0xfa)]===undefined)throw new Error(_0x41e033(0xd2));_0x25fa88=_0x3b9ef2[_0x41e033(0xfa)][_0x41e033(0xe5)]()||undefined;}const _0x1886f6=getConsoleUrl(_0x491fae);console[_0x41e033(0xd7)]('Opening\x20browser\x20for\x20authentication...');_0x25fa88?console[_0x41e033(0xd7)]('\x20\x20'+_0x1886f6+_0x41e033(0xc0)+_0x25fa88+')'):console['log']('\x20\x20'+_0x1886f6+'/oauth/authorize');console[_0x41e033(0xd7)]('Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...');const _0x1f741c=await startOAuthFlow(_0x491fae,{'accountName':_0x25fa88});console[_0x41e033(0xd7)](_0x41e033(0xb5));const _0x18e726=TDX['create']({'site':_0x491fae,'accessToken':_0x1f741c[_0x41e033(0x106)],'logLevel':_0x616163??LogLevel[_0x41e033(0xaa)]}),_0x326cd8=await _0x18e726[_0x41e033(0xc5)][_0x41e033(0xdf)]();console[_0x41e033(0xd7)](a7_0xe9106a[_0x41e033(0xbc)]('✓\x20Signed\x20in\x20successfully')),console[_0x41e033(0xd7)]('\x20\x20'+a7_0xe9106a[_0x41e033(0xd3)](_0x491fae+':'+_0x326cd8[_0x41e033(0xd0)])+_0x41e033(0xe4)+_0x326cd8['id']+'\x20\x20('+_0x326cd8[_0x41e033(0xb2)]+')');!_0x25fa88&&(console[_0x41e033(0xd7)](a7_0xe9106a[_0x41e033(0xb0)](_0x41e033(0xbe))),console['log'](a7_0xe9106a[_0x41e033(0xb0)](_0x41e033(0xae))),console[_0x41e033(0xd7)](a7_0xe9106a[_0x41e033(0xb0)](_0x41e033(0xca))));await saveOAuthTokens(_0x1f741c,_0xac2601),console[_0x41e033(0xd7)](_0x41e033(0xdb)+(_0xac2601?_0x41e033(0xb9)+_0xac2601+')':''));if(_0xac2601){const _0x4bf83c={'site':_0x491fae};saveProfileToUserConfig(_0xac2601,_0x4bf83c),console[_0x41e033(0xd7)]('✓\x20Profile\x20\x27'+_0xac2601+_0x41e033(0xeb));}else saveDefaultSiteToUserConfig(_0x491fae),console[_0x41e033(0xd7)](_0x41e033(0xe0)+_0x491fae);const _0x538bb3=_0xac2601?_0x41e033(0xcc)+_0xac2601:'';console[_0x41e033(0xd7)](),console[_0x41e033(0xd7)](_0x41e033(0xde)),console['log'](_0x41e033(0x101)+_0x538bb3+_0x41e033(0xcd)),console[_0x41e033(0xd7)](_0x41e033(0x101)+_0x538bb3+_0x41e033(0xad));}export async function promptAuthMethod(){const _0x360216=a7_0x232d,_0x57dece=await a7_0x3d30ba({'type':_0x360216(0xd5),'name':_0x360216(0x109),'message':_0x360216(0xb1),'choices':[{'title':_0x360216(0xe9),'description':_0x360216(0xc4),'value':_0x360216(0xf6)},{'title':'Use\x20an\x20API\x20key','description':'For\x20scripts\x20or\x20headless\x20servers','value':_0x360216(0xef)}]});return _0x57dece['method']||null;}export class AuthSetupCommand extends BaseCommand{[a7_0x50383e(0xd9)]=a7_0x50383e(0xfb);['description']='Setup\x20API\x20key\x20authentication\x20interactively';async[a7_0x50383e(0xed)](_0xe85988){const _0x2eee92=a7_0x50383e,{options:_0x5882dd}=_0xe85988,_0x5841d5=_0x5882dd[_0x2eee92(0xcb)];console[_0x2eee92(0xd7)](a7_0xe9106a[_0x2eee92(0xc7)]('tdx:\x20auth\x20setup'));const _0x2650e5=_0x5882dd['site']||_0x2eee92(0xfd),_0x338f05=await promptSiteSelection(_0x2650e5,_0x5841d5,_0x2eee92(0xd2));if(!_0x338f05)return 0x1;const _0x34e60f=resolveSite(_0x338f05),_0x4dd144=await promptAuthMethod();if(!_0x4dd144)return console['log'](_0x2eee92(0xf8)),0x1;if(_0x4dd144===_0x2eee92(0xf6)){const {accountName:_0xf3ddf1}=_0x5882dd;return await runOAuthLoginFlow(_0x34e60f,_0x5841d5,_0x5882dd[_0x2eee92(0xea)]??LogLevel[_0x2eee92(0xaa)],{'accountName':_0xf3ddf1}),0x0;}console[_0x2eee92(0xd7)](_0x2eee92(0xdc)+_0x34e60f),console[_0x2eee92(0xd7)](_0x2eee92(0xd6)),console['log']('\x20\x20'+getConsoleUrl(_0x34e60f,_0x2eee92(0xaf)));const _0x204d8b=await a7_0x3d30ba({'type':_0x2eee92(0xe3),'name':_0x2eee92(0x104),'message':_0x2eee92(0xcf),'validate':_0x3c350a=>{if(!_0x3c350a||!_0x3c350a['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x204d8b[_0x2eee92(0x104)])return console[_0x2eee92(0xd7)]('\x0aSetup\x20cancelled'),0x1;const _0x3a5701=_0x204d8b[_0x2eee92(0x104)];console[_0x2eee92(0xd7)](_0x2eee92(0x108));try{const _0x1b455f=TDX[_0x2eee92(0x103)]({'site':_0x34e60f,'apiKey':_0x3a5701[_0x2eee92(0xe5)](),'logLevel':_0x5882dd[_0x2eee92(0xea)]??LogLevel[_0x2eee92(0xaa)]}),_0x56185d=await _0x1b455f[_0x2eee92(0xc5)][_0x2eee92(0xdf)]();console['log'](_0x2eee92(0xb7)+_0x56185d[_0x2eee92(0xb2)]+')');const _0x54e3b6=await isKeychainAvailable();_0x54e3b6?(await saveAPIKeyAsync(_0x3a5701[_0x2eee92(0xe5)](),_0x34e60f,_0x5841d5),console[_0x2eee92(0xd7)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x5841d5?'\x20(profile:\x20'+_0x5841d5+')':''))):(console[_0x2eee92(0xf1)](a7_0xe9106a[_0x2eee92(0xf9)](_0x2eee92(0x107))),console[_0x2eee92(0xf1)](a7_0xe9106a[_0x2eee92(0xf9)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x5841d5){const _0x5e9f05={'site':_0x34e60f};saveProfileToUserConfig(_0x5841d5,_0x5e9f05),console[_0x2eee92(0xd7)](_0x2eee92(0xe8)+_0x5841d5+_0x2eee92(0xeb));}else saveDefaultSiteToUserConfig(_0x34e60f),console[_0x2eee92(0xd7)]('✓\x20Default\x20site\x20set\x20to\x20'+_0x34e60f);const _0x369cc3=_0x5841d5?_0x2eee92(0xcc)+_0x5841d5:'';return console[_0x2eee92(0xd7)](),console[_0x2eee92(0xd7)](_0x2eee92(0xde)),console['log'](_0x2eee92(0x101)+_0x369cc3+_0x2eee92(0xcd)),console[_0x2eee92(0xd7)]('\x20\x20tdx'+_0x369cc3+_0x2eee92(0xad)),0x0;}catch(_0x24ac20){if(_0x24ac20 instanceof HTTPClientError&&_0x24ac20[_0x2eee92(0xb8)]===0x191)return printAuthError(_0x24ac20),0x1;return console[_0x2eee92(0xc2)](a7_0xe9106a[_0x2eee92(0xda)]('✗\x20Validation\x20failed:\x20'+(_0x24ac20 instanceof Error?_0x24ac20[_0x2eee92(0xac)]:String(_0x24ac20)))),console[_0x2eee92(0xc2)](_0x2eee92(0xbb)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']='auth';[a7_0x50383e(0xe6)]=a7_0x50383e(0xff);async[a7_0x50383e(0xed)](_0xce839c){const _0x1cdcbd=a7_0x50383e,{options:_0x4efb98,tdx:_0x546cae}=_0xce839c,_0x5ee202=_0x4efb98[_0x1cdcbd(0xe7)],_0x3c1358=_0x4efb98[_0x1cdcbd(0xcb)],_0x37b9a6=_0x3c1358?_0x3c1358:_0x1cdcbd(0xee);console[_0x1cdcbd(0xd7)](_0x1cdcbd(0xdd)+_0x37b9a6+_0x1cdcbd(0xf2)+_0x5ee202+')');const _0x2f584b=await getOAuthTokens(_0x3c1358);if(_0x2f584b)console[_0x1cdcbd(0xd7)](_0x1cdcbd(0xc3)),console[_0x1cdcbd(0xd7)](_0x1cdcbd(0x105)+(_0x3c1358?_0x1cdcbd(0xb9)+_0x3c1358+')':''));else{const _0x13f34e=await resolveAPIKeyAsync(_0x5ee202,_0x3c1358);if(_0x13f34e){const {source:_0x1a3462,isDeprecated:_0x25e441}=_0x13f34e,_0x498b4e=_0x1cdcbd(0x102)+_0x1a3462;console[_0x1cdcbd(0xd7)](_0x25e441?a7_0xe9106a[_0x1cdcbd(0xf9)](_0x498b4e):_0x498b4e);}else console[_0x1cdcbd(0xd7)](a7_0xe9106a[_0x1cdcbd(0xf9)](_0x1cdcbd(0xce)));}try{const _0x445ea2=await _0x546cae[_0x1cdcbd(0xc5)][_0x1cdcbd(0xdf)]();return console[_0x1cdcbd(0xd7)](a7_0xe9106a[_0x1cdcbd(0xbc)]('✓\x20Authentication\x20successful\x0a')),console[_0x1cdcbd(0xd7)](_0x1cdcbd(0x10b)+_0x445ea2[_0x1cdcbd(0xb2)]),(_0x445ea2[_0x1cdcbd(0xc9)]||_0x445ea2[_0x1cdcbd(0xd8)])&&console[_0x1cdcbd(0xd7)](_0x1cdcbd(0xf5)+[_0x445ea2[_0x1cdcbd(0xc9)],_0x445ea2['last_name']][_0x1cdcbd(0xb4)](Boolean)['join']('\x20')),0x0;}catch(_0x49b0c8){return _0x49b0c8 instanceof HTTPClientError&&_0x49b0c8[_0x1cdcbd(0xb8)]===0x191?printAuthError(_0x49b0c8,!![],_0x3c1358):console[_0x1cdcbd(0xc2)](a7_0xe9106a[_0x1cdcbd(0xda)]('✗\x20Validation\x20failed:\x20'+(_0x49b0c8 instanceof Error?_0x49b0c8[_0x1cdcbd(0xac)]:String(_0x49b0c8)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x50383e(0xd9)]=a7_0x50383e(0xec);[a7_0x50383e(0xe6)]=a7_0x50383e(0x10a);async['execute'](_0x476226){const _0x10a5df=a7_0x50383e,{options:_0xcc0749}=_0x476226,_0x3018ad=_0xcc0749[_0x10a5df(0xcb)];console[_0x10a5df(0xd7)](a7_0xe9106a[_0x10a5df(0xc7)]('tdx:\x20auth\x20clear'));const _0x16b107=await isKeychainAvailable();if(!_0x16b107)return console['error'](a7_0xe9106a['red'](_0x10a5df(0xb6))),0x1;const [_0x117ad2,_0x21f5f8]=await Promise[_0x10a5df(0xbd)]([deleteKeychainAPIKey(_0x3018ad),deleteOAuthTokens(_0x3018ad)]);if(_0x117ad2||_0x21f5f8){clearCredentialCache();const _0xb5a39=[_0x117ad2&&_0x10a5df(0xf7),_0x21f5f8&&_0x10a5df(0xba)][_0x10a5df(0xb4)](Boolean)[_0x10a5df(0xbf)](_0x10a5df(0xe1));return console[_0x10a5df(0xd7)]('✓\x20'+_0xb5a39+_0x10a5df(0xf3)+(_0x3018ad?_0x10a5df(0xb9)+_0x3018ad+')':'')),0x0;}else return console[_0x10a5df(0xd7)]('No\x20credentials\x20found\x20in\x20keychain'+(_0x3018ad?_0x10a5df(0xd1)+_0x3018ad:'')),0x1;}}
1
+ const a7_0x8c8476=a7_0x49a3;function a7_0x57f4(){const _0x5deed2=['8YKVDzN','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','No\x20credentials\x20found\x20in\x20keychain','✓\x20Authentication\x20successful\x0a','\x20\x20\x20\x202.\x20Or\x20use\x20a\x20different\x20browser\x20profile\x20to\x20avoid\x20cached\x20sessions','apiKey','Use\x20an\x20API\x20key','Opening\x20browser\x20for\x20authentication...','profile','API\x20key\x20cannot\x20be\x20empty','For\x20scripts\x20or\x20headless\x20servers','System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20','email','site','\x0aSetup\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','method','\x20and\x20','2380362ppPyNo','red','green','accountName','\x20(profile:\x20','log','create','User:\x20','Setup\x20API\x20key\x20authentication\x20interactively','\x27\x20registered','error','name','Sign\x20in\x20with\x20browser\x20(recommended)','execute','bold','Validating\x20OAuth\x20tokens...','logLevel','✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain','auth:setup','trim','\x20removed\x20from\x20keychain','\x20\x20tdx','account_id','ERROR','/users/initiate_sso\x20(account:\x20','message','980700AoWQbv','N/A','auth','Setting\x20up\x20authentication\x20for\x20site:\x20','dim','\x20--profile\x20','Choose\x20how\x20to\x20sign\x20in:','133352cyYMnw','3205808vkNzaK','Setup\x20cancelled','warn','text','\x20\x20user_id:','✓\x20Profile\x20\x27','7dmeYve','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','join','API\x20key','/app/mp/ak','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','yellow','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','auth:clear','You\x20can\x20find\x20your\x20API\x20key\x20at:','status','187514iyljut','\x20\x20If\x20this\x20is\x20not\x20the\x20expected\x20account:','description','Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.','last_name','tdx:\x20auth\x20setup','jobs','Enter\x20your\x20TD\x20API\x20key:','Read\x20credential\x20from\x20','getUserInfo','password','us01','2827500IyJKxd','8543205zPTLSB','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Opens\x20your\x20browser\x20to\x20sign\x20in\x20with\x20SSO','✗\x20Validation\x20failed:\x20','oauth','✓\x20Signed\x20in\x20successfully','Remove\x20API\x20key\x20from\x20system\x20keychain','tdx:\x20auth\x20clear','\x20\x20(','✓\x20Default\x20site\x20set\x20to\x20','filter','Validating\x20API\x20key...'];a7_0x57f4=function(){return _0x5deed2;};return a7_0x57f4();}function a7_0x49a3(_0x3821e7,_0x295863){_0x3821e7=_0x3821e7-0x115;const _0x57f404=a7_0x57f4();let _0x49a348=_0x57f404[_0x3821e7];return _0x49a348;}(function(_0x3793d0,_0x443da5){const _0x133954=a7_0x49a3,_0x4c9851=_0x3793d0();while(!![]){try{const _0x2925be=parseInt(_0x133954(0x146))/0x1+-parseInt(_0x133954(0x134))/0x2+parseInt(_0x133954(0x12d))/0x3+-parseInt(_0x133954(0x135))/0x4+-parseInt(_0x133954(0x152))/0x5+-parseInt(_0x133954(0x171))/0x6*(-parseInt(_0x133954(0x13b))/0x7)+-parseInt(_0x133954(0x15f))/0x8*(-parseInt(_0x133954(0x153))/0x9);if(_0x2925be===_0x443da5)break;else _0x4c9851['push'](_0x4c9851['shift']());}catch(_0x57ee2d){_0x4c9851['push'](_0x4c9851['shift']());}}}(a7_0x57f4,0x68306));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens,saveOAuthTokens}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{startOAuthFlow}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x228a09 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_0x2fee3c from'chalk';export async function runOAuthLoginFlow(_0x1a585e,_0x53168a,_0x1a2e54,_0x3febf8){const _0x11ffc0=a7_0x49a3,_0x14bb60=await isKeychainAvailable();if(!_0x14bb60)throw new Error(_0x11ffc0(0x16a)+_0x11ffc0(0x149));let _0x258d96=_0x3febf8?.[_0x11ffc0(0x116)];if(!_0x258d96){const _0x36d2aa=await a7_0x228a09({'type':_0x11ffc0(0x138),'name':_0x11ffc0(0x116),'message':'Account\x20name\x20for\x20SSO\x20(press\x20Enter\x20to\x20skip):'});if(_0x36d2aa[_0x11ffc0(0x116)]===undefined)throw new Error(_0x11ffc0(0x136));_0x258d96=_0x36d2aa['accountName'][_0x11ffc0(0x126)]()||undefined;}const _0x2787b2=getConsoleUrl(_0x1a585e);console[_0x11ffc0(0x118)](_0x11ffc0(0x166));_0x258d96?console[_0x11ffc0(0x118)]('\x20\x20'+_0x2787b2+_0x11ffc0(0x12b)+_0x258d96+')'):console[_0x11ffc0(0x118)]('\x20\x20'+_0x2787b2+'/oauth/authorize');console[_0x11ffc0(0x118)](_0x11ffc0(0x140));const _0x5173fa=await startOAuthFlow(_0x1a585e,{'accountName':_0x258d96});console[_0x11ffc0(0x118)](_0x11ffc0(0x122));const _0xa8b919=TDX[_0x11ffc0(0x119)]({'site':_0x1a585e,'accessToken':_0x5173fa['access_token'],'logLevel':_0x1a2e54??LogLevel[_0x11ffc0(0x12a)]}),_0x286a0a=await _0xa8b919[_0x11ffc0(0x14c)]['getUserInfo']();console[_0x11ffc0(0x118)](a7_0x2fee3c['green'](_0x11ffc0(0x158))),console[_0x11ffc0(0x118)]('\x20\x20'+a7_0x2fee3c['cyan'](_0x1a585e+':'+_0x286a0a[_0x11ffc0(0x129)])+_0x11ffc0(0x139)+_0x286a0a['id']+_0x11ffc0(0x15b)+_0x286a0a[_0x11ffc0(0x16b)]+')');!_0x258d96&&(console[_0x11ffc0(0x118)](a7_0x2fee3c[_0x11ffc0(0x131)](_0x11ffc0(0x147))),console[_0x11ffc0(0x118)](a7_0x2fee3c['dim']('\x20\x20\x20\x201.\x20Run:\x20tdx\x20auth\x20setup\x20--account-name\x20<name>')),console[_0x11ffc0(0x118)](a7_0x2fee3c['dim'](_0x11ffc0(0x163))));await saveOAuthTokens(_0x5173fa,_0x53168a),console[_0x11ffc0(0x118)](_0x11ffc0(0x124)+(_0x53168a?_0x11ffc0(0x117)+_0x53168a+')':''));if(_0x53168a){const _0x17e8a7={'site':_0x1a585e};saveProfileToUserConfig(_0x53168a,_0x17e8a7),console[_0x11ffc0(0x118)](_0x11ffc0(0x13a)+_0x53168a+'\x27\x20registered');}else saveDefaultSiteToUserConfig(_0x1a585e),console[_0x11ffc0(0x118)](_0x11ffc0(0x15c)+_0x1a585e);const _0x26f10a=_0x53168a?_0x11ffc0(0x132)+_0x53168a:'';console[_0x11ffc0(0x118)](),console[_0x11ffc0(0x118)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x11ffc0(0x118)](_0x11ffc0(0x128)+_0x26f10a+_0x11ffc0(0x142)),console['log'](_0x11ffc0(0x128)+_0x26f10a+_0x11ffc0(0x154));}export async function promptAuthMethod(){const _0x3fccff=a7_0x49a3,_0x1725f4=await a7_0x228a09({'type':'select','name':_0x3fccff(0x16f),'message':_0x3fccff(0x133),'choices':[{'title':_0x3fccff(0x11f),'description':_0x3fccff(0x155),'value':'oauth'},{'title':_0x3fccff(0x165),'description':_0x3fccff(0x169),'value':'apikey'}]});return _0x1725f4['method']||null;}export class AuthSetupCommand extends BaseCommand{[a7_0x8c8476(0x11e)]=a7_0x8c8476(0x125);[a7_0x8c8476(0x148)]=a7_0x8c8476(0x11b);async[a7_0x8c8476(0x120)](_0x192c5a){const _0x2c3a39=a7_0x8c8476,{options:_0x472351}=_0x192c5a,_0x5ed415=_0x472351[_0x2c3a39(0x167)];console[_0x2c3a39(0x118)](a7_0x2fee3c[_0x2c3a39(0x121)](_0x2c3a39(0x14b)));const _0x5b1988=_0x472351['site']||_0x2c3a39(0x151),_0x42eec0=await promptSiteSelection(_0x5b1988,_0x5ed415,'Setup\x20cancelled');if(!_0x42eec0)return 0x1;const _0x5b2903=resolveSite(_0x42eec0),_0x4f7a49=await promptAuthMethod();if(!_0x4f7a49)return console[_0x2c3a39(0x118)](_0x2c3a39(0x16d)),0x1;if(_0x4f7a49===_0x2c3a39(0x157)){const {accountName:_0x21e5af}=_0x472351;return await runOAuthLoginFlow(_0x5b2903,_0x5ed415,_0x472351[_0x2c3a39(0x123)]??LogLevel[_0x2c3a39(0x12a)],{'accountName':_0x21e5af}),0x0;}console[_0x2c3a39(0x118)](_0x2c3a39(0x130)+_0x5b2903),console[_0x2c3a39(0x118)](_0x2c3a39(0x144)),console[_0x2c3a39(0x118)]('\x20\x20'+getConsoleUrl(_0x5b2903,_0x2c3a39(0x13f)));const _0x4e16a8=await a7_0x228a09({'type':_0x2c3a39(0x150),'name':_0x2c3a39(0x164),'message':_0x2c3a39(0x14d),'validate':_0x1039b2=>{const _0x48984f=_0x2c3a39;if(!_0x1039b2||!_0x1039b2[_0x48984f(0x126)]())return _0x48984f(0x168);return!![];}});if(!_0x4e16a8[_0x2c3a39(0x164)])return console['log'](_0x2c3a39(0x16d)),0x1;const _0x346d40=_0x4e16a8[_0x2c3a39(0x164)];console[_0x2c3a39(0x118)](_0x2c3a39(0x15e));try{const _0xa76e11=TDX[_0x2c3a39(0x119)]({'site':_0x5b2903,'apiKey':_0x346d40[_0x2c3a39(0x126)](),'logLevel':_0x472351[_0x2c3a39(0x123)]??LogLevel[_0x2c3a39(0x12a)]}),_0x479054=await _0xa76e11['jobs'][_0x2c3a39(0x14f)]();console[_0x2c3a39(0x118)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x479054['email']+')');const _0x5e032a=await isKeychainAvailable();_0x5e032a?(await saveAPIKeyAsync(_0x346d40[_0x2c3a39(0x126)](),_0x5b2903,_0x5ed415),console['log']('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x5ed415?_0x2c3a39(0x117)+_0x5ed415+')':''))):(console[_0x2c3a39(0x137)](a7_0x2fee3c[_0x2c3a39(0x141)](_0x2c3a39(0x16e))),console['warn'](a7_0x2fee3c[_0x2c3a39(0x141)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x5ed415){const _0x57b17e={'site':_0x5b2903};saveProfileToUserConfig(_0x5ed415,_0x57b17e),console[_0x2c3a39(0x118)](_0x2c3a39(0x13a)+_0x5ed415+_0x2c3a39(0x11c));}else saveDefaultSiteToUserConfig(_0x5b2903),console['log']('✓\x20Default\x20site\x20set\x20to\x20'+_0x5b2903);const _0x547065=_0x5ed415?_0x2c3a39(0x132)+_0x5ed415:'';return console['log'](),console[_0x2c3a39(0x118)](_0x2c3a39(0x160)),console['log'](_0x2c3a39(0x128)+_0x547065+_0x2c3a39(0x142)),console[_0x2c3a39(0x118)](_0x2c3a39(0x128)+_0x547065+_0x2c3a39(0x154)),0x0;}catch(_0x570a69){if(_0x570a69 instanceof HTTPClientError&&_0x570a69['status']===0x191)return printAuthError(_0x570a69),0x1;return console[_0x2c3a39(0x11d)](a7_0x2fee3c[_0x2c3a39(0x172)](_0x2c3a39(0x156)+(_0x570a69 instanceof Error?_0x570a69[_0x2c3a39(0x12c)]:String(_0x570a69)))),console[_0x2c3a39(0x11d)]('API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.'),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']=a7_0x8c8476(0x12f);[a7_0x8c8476(0x148)]=a7_0x8c8476(0x13c);async['execute'](_0x6fe09c){const _0x74dc53=a7_0x8c8476,{options:_0x2b8550,tdx:_0x3a601c}=_0x6fe09c,_0x186a29=_0x2b8550[_0x74dc53(0x16c)],_0x5bbd4f=_0x2b8550['profile'],_0xb175fc=_0x5bbd4f?_0x5bbd4f:_0x74dc53(0x12e);console[_0x74dc53(0x118)]('tdx\x20profile:\x20'+_0xb175fc+'\x20(site:\x20'+_0x186a29+')');const _0x4b8eb0=await getOAuthTokens(_0x5bbd4f);if(_0x4b8eb0)console[_0x74dc53(0x118)]('Credential\x20type:\x20OAuth'),console['log']('Read\x20credential\x20from\x20keychain'+(_0x5bbd4f?_0x74dc53(0x117)+_0x5bbd4f+')':''));else{const _0x14fb6e=await resolveAPIKeyAsync(_0x186a29,_0x5bbd4f);if(_0x14fb6e){const {source:_0x3fd801,isDeprecated:_0x32aaee}=_0x14fb6e,_0xb42a84=_0x74dc53(0x14e)+_0x3fd801;console[_0x74dc53(0x118)](_0x32aaee?a7_0x2fee3c[_0x74dc53(0x141)](_0xb42a84):_0xb42a84);}else console[_0x74dc53(0x118)](a7_0x2fee3c[_0x74dc53(0x141)]('No\x20credential\x20found'));}try{const _0xf661de=await _0x3a601c['jobs'][_0x74dc53(0x14f)]();return console[_0x74dc53(0x118)](a7_0x2fee3c[_0x74dc53(0x115)](_0x74dc53(0x162))),console['log'](_0x74dc53(0x11a)+_0xf661de[_0x74dc53(0x16b)]),(_0xf661de['first_name']||_0xf661de[_0x74dc53(0x14a)])&&console['log']('Name:\x20'+[_0xf661de['first_name'],_0xf661de[_0x74dc53(0x14a)]]['filter'](Boolean)['join']('\x20')),0x0;}catch(_0x256439){return _0x256439 instanceof HTTPClientError&&_0x256439[_0x74dc53(0x145)]===0x191?printAuthError(_0x256439,!![],_0x5bbd4f):console['error'](a7_0x2fee3c[_0x74dc53(0x172)](_0x74dc53(0x156)+(_0x256439 instanceof Error?_0x256439[_0x74dc53(0x12c)]:String(_0x256439)))),0x1;}}}export class AuthClearCommand extends BaseCommand{['name']=a7_0x8c8476(0x143);[a7_0x8c8476(0x148)]=a7_0x8c8476(0x159);async['execute'](_0x1a6539){const _0x5729b7=a7_0x8c8476,{options:_0x1df341}=_0x1a6539,_0x23be7e=_0x1df341['profile'];console[_0x5729b7(0x118)](a7_0x2fee3c['bold'](_0x5729b7(0x15a)));const _0x2579f9=await isKeychainAvailable();if(!_0x2579f9)return console[_0x5729b7(0x11d)](a7_0x2fee3c[_0x5729b7(0x172)]('System\x20keychain\x20is\x20not\x20available')),0x1;const [_0x384582,_0x530372]=await Promise['all']([deleteKeychainAPIKey(_0x23be7e),deleteOAuthTokens(_0x23be7e)]);if(_0x384582||_0x530372){clearCredentialCache();const _0x154448=[_0x384582&&_0x5729b7(0x13e),_0x530372&&'OAuth\x20tokens'][_0x5729b7(0x15d)](Boolean)[_0x5729b7(0x13d)](_0x5729b7(0x170));return console['log']('✓\x20'+_0x154448+_0x5729b7(0x127)+(_0x23be7e?'\x20(profile:\x20'+_0x23be7e+')':'')),0x0;}else return console['log'](_0x5729b7(0x161)+(_0x23be7e?'\x20for\x20profile:\x20'+_0x23be7e:'')),0x1;}}