@treasuredata/tdx 2026.3.8 → 2026.3.9

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 (208) 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.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profile-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/schedule-command.js +1 -1
  37. package/dist/commands/segment-command.js +1 -1
  38. package/dist/commands/segment-create-command.js +1 -1
  39. package/dist/commands/segment-fields-command.js +1 -1
  40. package/dist/commands/segment-pull-command.js +1 -1
  41. package/dist/commands/segment-push-command.js +1 -1
  42. package/dist/commands/segment-update-command.js +1 -1
  43. package/dist/commands/segment-use-command.js +1 -1
  44. package/dist/commands/segment-validate-command.js +1 -1
  45. package/dist/commands/segments.js +1 -1
  46. package/dist/commands/show.js +1 -1
  47. package/dist/commands/status-command.js +1 -1
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/unset-command.js +1 -1
  50. package/dist/commands/upgrade-command.js +1 -1
  51. package/dist/commands/use-command.js +1 -1
  52. package/dist/commands/user-command.js +1 -1
  53. package/dist/commands/workflow-command.js +1 -1
  54. package/dist/core/auth.js +1 -1
  55. package/dist/core/command-output.js +1 -1
  56. package/dist/core/config.js +1 -1
  57. package/dist/core/connection-cache.js +1 -1
  58. package/dist/core/constants.js +1 -1
  59. package/dist/core/credential-cache.js +1 -1
  60. package/dist/core/global-context.js +1 -1
  61. package/dist/core/keychain.js +1 -1
  62. package/dist/core/oauth-keychain.js +1 -1
  63. package/dist/core/oauth.d.ts +2 -2
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/profile.js.map +1 -1
  67. package/dist/core/project-config.js +1 -1
  68. package/dist/core/session.js +1 -1
  69. package/dist/core/user-cache.js +1 -1
  70. package/dist/core/version.js +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/mcp/server.js +1 -1
  73. package/dist/mcp/tools/index.js +1 -1
  74. package/dist/mcp/tools/tdx-run.js +1 -1
  75. package/dist/mcp/tools/tdx-search.js +1 -1
  76. package/dist/mcp/utils.js +1 -1
  77. package/dist/proxy/claude-usage-tracker.js +1 -1
  78. package/dist/proxy/passthrough-server.js +1 -1
  79. package/dist/proxy/sse-usage-parser.js +1 -1
  80. package/dist/sdk/agent/agent-config.js +1 -1
  81. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  82. package/dist/sdk/agent/agent-yaml.js +1 -1
  83. package/dist/sdk/agent/test/evaluator.js +1 -1
  84. package/dist/sdk/agent/test/executor.js +1 -1
  85. package/dist/sdk/agent/test/index.js +1 -1
  86. package/dist/sdk/agent/test/output.js +1 -1
  87. package/dist/sdk/agent/test/parser.js +1 -1
  88. package/dist/sdk/agent/tool-target-registry.js +1 -1
  89. package/dist/sdk/api.js +1 -1
  90. package/dist/sdk/client/cdp-api-client.js +1 -1
  91. package/dist/sdk/client/delivery-api-client.js +1 -1
  92. package/dist/sdk/client/endpoints.js +1 -1
  93. package/dist/sdk/client/endpoints.js.map +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/oauth-refresh.d.ts +1 -1
  98. package/dist/sdk/client/oauth-refresh.js +1 -1
  99. package/dist/sdk/client/rate-limiter.js +1 -1
  100. package/dist/sdk/client/td-api-client.js +1 -1
  101. package/dist/sdk/client/trino-api-client.js +1 -1
  102. package/dist/sdk/client/workflow-client.js +1 -1
  103. package/dist/sdk/connection-validator.js +1 -1
  104. package/dist/sdk/connection.js +1 -1
  105. package/dist/sdk/delivery.js +1 -1
  106. package/dist/sdk/engage/campaign-pull.js +1 -1
  107. package/dist/sdk/engage/campaign-push.js +1 -1
  108. package/dist/sdk/engage/campaign-validator.js +1 -1
  109. package/dist/sdk/engage/campaign-yaml.js +1 -1
  110. package/dist/sdk/engage/template-pull.js +1 -1
  111. package/dist/sdk/engage/template-push.js +1 -1
  112. package/dist/sdk/engage/template-validator.js +1 -1
  113. package/dist/sdk/engage/template-yaml.js +1 -1
  114. package/dist/sdk/engage/types/campaign-def.js +1 -1
  115. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  116. package/dist/sdk/engage/types/template-schema.js +1 -1
  117. package/dist/sdk/engage.js +1 -1
  118. package/dist/sdk/errors.js +1 -1
  119. package/dist/sdk/index.js +1 -1
  120. package/dist/sdk/io/index.js +1 -1
  121. package/dist/sdk/io/node-filesystem.js +1 -1
  122. package/dist/sdk/job.js +1 -1
  123. package/dist/sdk/journey.js +1 -1
  124. package/dist/sdk/llm/chat-cache.js +1 -1
  125. package/dist/sdk/llm/index.js +1 -1
  126. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  127. package/dist/sdk/llm/model-factors.js +1 -1
  128. package/dist/sdk/personalization.js +1 -1
  129. package/dist/sdk/query/index.js +1 -1
  130. package/dist/sdk/query/sql-parser.js +1 -1
  131. package/dist/sdk/realtime.js +1 -1
  132. package/dist/sdk/schedule.js +1 -1
  133. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  134. package/dist/sdk/segment/fields-display.js +1 -1
  135. package/dist/sdk/segment/file-discovery.js +1 -1
  136. package/dist/sdk/segment/journey-utils.d.ts.map +1 -1
  137. package/dist/sdk/segment/journey-utils.js +1 -1
  138. package/dist/sdk/segment/journey-utils.js.map +1 -1
  139. package/dist/sdk/segment/journey-validator.js +1 -1
  140. package/dist/sdk/segment/journey-yaml.js +1 -1
  141. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  142. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  143. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  144. package/dist/sdk/segment/pull-workflow.js +1 -1
  145. package/dist/sdk/segment/push-recovery.js +1 -1
  146. package/dist/sdk/segment/push-workflow.js +1 -1
  147. package/dist/sdk/segment/resolution-context.js +1 -1
  148. package/dist/sdk/segment/segment-path-parser.js +1 -1
  149. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  150. package/dist/sdk/segment/segment-validator.js +1 -1
  151. package/dist/sdk/segment/target-resolution.js +1 -1
  152. package/dist/sdk/segment/tdx-config.js +1 -1
  153. package/dist/sdk/segment/types/activation-schema.js +1 -1
  154. package/dist/sdk/segment/types/journey-def.js +1 -1
  155. package/dist/sdk/segment/types/journey-schema.js +1 -1
  156. package/dist/sdk/segment/types/segment-def.js +1 -1
  157. package/dist/sdk/segment/types/segment-schema.js +1 -1
  158. package/dist/sdk/segment/validate-files.js +1 -1
  159. package/dist/sdk/segment/yaml-validator.js +1 -1
  160. package/dist/sdk/segment.js +1 -1
  161. package/dist/sdk/types/index.js +1 -1
  162. package/dist/sdk/types/progress.js +1 -1
  163. package/dist/sdk/user.js +1 -1
  164. package/dist/sdk/util/format-detector.js +1 -1
  165. package/dist/sdk/util/formatters.js +1 -1
  166. package/dist/sdk/util/index.js +1 -1
  167. package/dist/sdk/util/paginate.js +1 -1
  168. package/dist/sdk/util/tree-formatter.js +1 -1
  169. package/dist/sdk/workflow/archive-validation.js +1 -1
  170. package/dist/sdk/workflow/clone-workflow.js +1 -1
  171. package/dist/sdk/workflow/index.js +1 -1
  172. package/dist/sdk/workflow/pull-workflow.js +1 -1
  173. package/dist/sdk/workflow/push-workflow.js +1 -1
  174. package/dist/sdk/workflow/tdx-config.js +1 -1
  175. package/dist/sdk/workflow/workflow-utils.js +1 -1
  176. package/dist/test-utils/command-runner.js +1 -1
  177. package/dist/test-utils/factories.js +1 -1
  178. package/dist/test-utils/fixtures.js +1 -1
  179. package/dist/test-utils/http-mock.js +1 -1
  180. package/dist/test-utils/index.js +1 -1
  181. package/dist/utils/async.js +1 -1
  182. package/dist/utils/colors.js +1 -1
  183. package/dist/utils/diff.js +1 -1
  184. package/dist/utils/file-permissions.js +1 -1
  185. package/dist/utils/file-reader.js +1 -1
  186. package/dist/utils/github-releases.js +1 -1
  187. package/dist/utils/global-cache.js +1 -1
  188. package/dist/utils/json-loader.js +1 -1
  189. package/dist/utils/local-cache.js +1 -1
  190. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  191. package/dist/utils/logger/formatters/index.js +1 -1
  192. package/dist/utils/logger/handlers/console-handler.js +1 -1
  193. package/dist/utils/logger/handlers/file-handler.js +1 -1
  194. package/dist/utils/logger/handlers/index.js +1 -1
  195. package/dist/utils/logger/handlers/null-handler.js +1 -1
  196. package/dist/utils/logger/index.js +1 -1
  197. package/dist/utils/logger/logger.js +1 -1
  198. package/dist/utils/logger/types.js +1 -1
  199. package/dist/utils/option-validation.js +1 -1
  200. package/dist/utils/process.js +1 -1
  201. package/dist/utils/prompt.js +1 -1
  202. package/dist/utils/spinner.js +1 -1
  203. package/dist/utils/sse-parser.js +1 -1
  204. package/dist/utils/string-utils.js +1 -1
  205. package/dist/utils/table-ref-parser.js +1 -1
  206. package/dist/utils/tdx-logger.js +1 -1
  207. package/dist/utils/version-check.js +1 -1
  208. package/package.json +1 -1
@@ -1 +1 @@
1
- const a3_0x22192d=a3_0x2b8b;(function(_0x357c9b,_0x29a738){const _0x38abb6=a3_0x2b8b,_0xffa8c1=_0x357c9b();while(!![]){try{const _0x433277=-parseInt(_0x38abb6(0x186))/0x1*(-parseInt(_0x38abb6(0x173))/0x2)+parseInt(_0x38abb6(0x172))/0x3+-parseInt(_0x38abb6(0x17b))/0x4*(parseInt(_0x38abb6(0x183))/0x5)+-parseInt(_0x38abb6(0x17a))/0x6*(-parseInt(_0x38abb6(0x188))/0x7)+parseInt(_0x38abb6(0x17c))/0x8+parseInt(_0x38abb6(0x17d))/0x9+-parseInt(_0x38abb6(0x170))/0xa;if(_0x433277===_0x29a738)break;else _0xffa8c1['push'](_0xffa8c1['shift']());}catch(_0xa4d333){_0xffa8c1['push'](_0xffa8c1['shift']());}}}(a3_0x1c3b,0xefee3));function a3_0x1c3b(){const _0x59e8f9=['Site:\x20','\x20activation','resolveParentId','5TOQmnA','Error:\x20Segment\x20name\x20is\x20required','verbose','192629kKKrVb','Child\x20name:\x20','12564251zGCOYo','execute','Resolved\x20child\x20ID:\x20','listActivations','resolveSegmentId','List\x20activations\x20for\x20a\x20segment','length','error','data','Error:\x20','50707880hGQwMX','name','5173089zRiudE','18gtHrRo','Resolving\x20parent\x20segment\x20\x27','site','\x20\x20Cause:\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','\x27...','message','6harUAe','5281924dIbHlx','4589456HpiDyp','13926825AWTjZM','segment','description'];a3_0x1c3b=function(){return _0x59e8f9;};return a3_0x1c3b();}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';function a3_0x2b8b(_0x159d53,_0x42f49e){_0x159d53=_0x159d53-0x16b;const _0x1c3bbd=a3_0x1c3b();let _0x2b8b1e=_0x1c3bbd[_0x159d53];return _0x2b8b1e;}export class ActivationsCommand extends BaseCommand{[a3_0x22192d(0x171)]='activations';[a3_0x22192d(0x17f)]=a3_0x22192d(0x16b);async[a3_0x22192d(0x189)](_0x3ec368){const _0x12d247=a3_0x22192d,{options:_0x2309c1,args:_0x1c80eb,tdx:_0x155e61}=_0x3ec368;if(_0x1c80eb[_0x12d247(0x16c)]===0x0)return console[_0x12d247(0x16d)](_0x12d247(0x184)),console[_0x12d247(0x16d)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x4be9c3,childId:_0x33079c}=parseSegmentRef(_0x1c80eb[0x0]);if(!_0x33079c)return console[_0x12d247(0x16d)](_0x12d247(0x177)),console['error']('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;_0x2309c1[_0x12d247(0x185)]&&(console['error'](_0x12d247(0x180)+_0x2309c1[_0x12d247(0x175)]),console[_0x12d247(0x16d)]('Parent\x20name:\x20'+_0x4be9c3),console[_0x12d247(0x16d)](_0x12d247(0x187)+_0x33079c));const _0x5c72f6=await withSpinner(_0x12d247(0x174)+_0x4be9c3+_0x12d247(0x178),()=>_0x155e61[_0x12d247(0x17e)][_0x12d247(0x182)](_0x4be9c3),{'verbose':_0x2309c1['verbose']}),_0x24b192=_0x5c72f6['data'];_0x2309c1[_0x12d247(0x185)]&&console[_0x12d247(0x16d)]('Resolved\x20parent\x20ID:\x20'+_0x24b192);const _0x205d4f=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x33079c+_0x12d247(0x178),()=>_0x155e61['segment'][_0x12d247(0x18c)](_0x24b192,_0x33079c),{'verbose':_0x2309c1['verbose']}),_0x1fd8ac=_0x205d4f[_0x12d247(0x16e)];_0x2309c1[_0x12d247(0x185)]&&console[_0x12d247(0x16d)](_0x12d247(0x18a)+_0x1fd8ac);const _0x2c8e4b=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0x33079c+_0x12d247(0x178),()=>_0x155e61[_0x12d247(0x17e)][_0x12d247(0x18b)](_0x24b192,_0x1fd8ac),{'verbose':_0x2309c1['verbose']}),_0x2adda0=_0x2c8e4b[_0x12d247(0x16e)];return console[_0x12d247(0x16d)]('✔\x20Found\x20'+_0x2adda0[_0x12d247(0x16c)]+_0x12d247(0x181)+(_0x2adda0[_0x12d247(0x16c)]!==0x1?'s':'')),await handleSDKOutput(_0x2adda0,_0x2309c1),0x0;}catch(_0x23c0d2){if(_0x23c0d2 instanceof SDKError)return console[_0x12d247(0x16d)](_0x12d247(0x16f)+_0x23c0d2[_0x12d247(0x179)]),_0x23c0d2['cause']&&console[_0x12d247(0x16d)](_0x12d247(0x176)+_0x23c0d2['cause']),0x1;throw _0x23c0d2;}}}
1
+ const a3_0x5b3826=a3_0x144c;(function(_0xc90f13,_0x351f59){const _0x35b79c=a3_0x144c,_0x7a6110=_0xc90f13();while(!![]){try{const _0x650c8e=-parseInt(_0x35b79c(0x18a))/0x1*(-parseInt(_0x35b79c(0x19d))/0x2)+parseInt(_0x35b79c(0x1a4))/0x3+parseInt(_0x35b79c(0x1a9))/0x4*(parseInt(_0x35b79c(0x1a6))/0x5)+parseInt(_0x35b79c(0x193))/0x6+parseInt(_0x35b79c(0x197))/0x7+parseInt(_0x35b79c(0x1a8))/0x8+-parseInt(_0x35b79c(0x19a))/0x9;if(_0x650c8e===_0x351f59)break;else _0x7a6110['push'](_0x7a6110['shift']());}catch(_0xa6b7c2){_0x7a6110['push'](_0x7a6110['shift']());}}}(a3_0x3ced,0xa3b31));function a3_0x3ced(){const _0x97479d=['activations','Resolving\x20parent\x20segment\x20\x27','cause','message','listActivations','description','error','3582486LtwIxu','Site:\x20','Resolved\x20parent\x20ID:\x20','site','8566796ZigKGy','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','\x27...','24547707NkjqmT','execute','Parent\x20name:\x20','2JqGacD','\x20\x20Cause:\x20','data','Resolved\x20child\x20ID:\x20','length','resolveParentId','segment','1216221VJefBQ','name','835XZxarp','List\x20activations\x20for\x20a\x20segment','1535840bdrciF','11356eiNRjk','\x20activation','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','Error:\x20Segment\x20name\x20is\x20required','505627lFaLDE','verbose'];a3_0x3ced=function(){return _0x97479d;};return a3_0x3ced();}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';function a3_0x144c(_0x1bf19e,_0x9950d){_0x1bf19e=_0x1bf19e-0x189;const _0x3cedc1=a3_0x3ced();let _0x144c5b=_0x3cedc1[_0x1bf19e];return _0x144c5b;}export class ActivationsCommand extends BaseCommand{[a3_0x5b3826(0x1a5)]=a3_0x5b3826(0x18c);[a3_0x5b3826(0x191)]=a3_0x5b3826(0x1a7);async[a3_0x5b3826(0x19b)](_0x4a2a35){const _0x6bf178=a3_0x5b3826,{options:_0x56948f,args:_0x174e9d,tdx:_0x48b5}=_0x4a2a35;if(_0x174e9d[_0x6bf178(0x1a1)]===0x0)return console[_0x6bf178(0x192)](_0x6bf178(0x189)),console['error'](_0x6bf178(0x1ab)),0x1;try{const {parentId:_0x40d963,childId:_0x124eab}=parseSegmentRef(_0x174e9d[0x0]);if(!_0x124eab)return console[_0x6bf178(0x192)](_0x6bf178(0x198)),console['error'](_0x6bf178(0x1ab)),0x1;_0x56948f[_0x6bf178(0x18b)]&&(console[_0x6bf178(0x192)](_0x6bf178(0x194)+_0x56948f[_0x6bf178(0x196)]),console[_0x6bf178(0x192)](_0x6bf178(0x19c)+_0x40d963),console['error']('Child\x20name:\x20'+_0x124eab));const _0x2b8e12=await withSpinner(_0x6bf178(0x18d)+_0x40d963+_0x6bf178(0x199),()=>_0x48b5[_0x6bf178(0x1a3)][_0x6bf178(0x1a2)](_0x40d963),{'verbose':_0x56948f[_0x6bf178(0x18b)]}),_0x296bc0=_0x2b8e12[_0x6bf178(0x19f)];_0x56948f[_0x6bf178(0x18b)]&&console[_0x6bf178(0x192)](_0x6bf178(0x195)+_0x296bc0);const _0x76ae4d=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x124eab+_0x6bf178(0x199),()=>_0x48b5[_0x6bf178(0x1a3)]['resolveSegmentId'](_0x296bc0,_0x124eab),{'verbose':_0x56948f[_0x6bf178(0x18b)]}),_0x7e8ae8=_0x76ae4d[_0x6bf178(0x19f)];_0x56948f[_0x6bf178(0x18b)]&&console['error'](_0x6bf178(0x1a0)+_0x7e8ae8);const _0x2ddd03=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0x124eab+_0x6bf178(0x199),()=>_0x48b5[_0x6bf178(0x1a3)][_0x6bf178(0x190)](_0x296bc0,_0x7e8ae8),{'verbose':_0x56948f[_0x6bf178(0x18b)]}),_0x2e1bc9=_0x2ddd03['data'];return console[_0x6bf178(0x192)]('✔\x20Found\x20'+_0x2e1bc9[_0x6bf178(0x1a1)]+_0x6bf178(0x1aa)+(_0x2e1bc9[_0x6bf178(0x1a1)]!==0x1?'s':'')),await handleSDKOutput(_0x2e1bc9,_0x56948f),0x0;}catch(_0x553dac){if(_0x553dac instanceof SDKError)return console[_0x6bf178(0x192)]('Error:\x20'+_0x553dac[_0x6bf178(0x18f)]),_0x553dac['cause']&&console[_0x6bf178(0x192)](_0x6bf178(0x19e)+_0x553dac[_0x6bf178(0x18e)]),0x1;throw _0x553dac;}}}
@@ -1 +1 @@
1
- const a4_0x49f1e9=a4_0x4ed4;(function(_0x5661f5,_0x2b93b5){const _0x163736=a4_0x4ed4,_0x5c6777=_0x5661f5();while(!![]){try{const _0x1107f5=parseInt(_0x163736(0x182))/0x1*(-parseInt(_0x163736(0x130))/0x2)+-parseInt(_0x163736(0x15d))/0x3*(parseInt(_0x163736(0x18f))/0x4)+-parseInt(_0x163736(0x158))/0x5*(-parseInt(_0x163736(0x1a5))/0x6)+parseInt(_0x163736(0x1b5))/0x7+parseInt(_0x163736(0x1af))/0x8*(-parseInt(_0x163736(0x16c))/0x9)+-parseInt(_0x163736(0x168))/0xa+parseInt(_0x163736(0x184))/0xb;if(_0x1107f5===_0x2b93b5)break;else _0x5c6777['push'](_0x5c6777['shift']());}catch(_0x454ddc){_0x5c6777['push'](_0x5c6777['shift']());}}}(a4_0x449a,0xc40eb));import a4_0x370cfc from'chalk';import a4_0xdab3b3 from'path';import{existsSync,readFileSync}from'fs';function a4_0x4ed4(_0x28b170,_0xbde919){_0x28b170=_0x28b170-0x127;const _0x449a1a=a4_0x449a();let _0x4ed4de=_0x449a1a[_0x28b170];return _0x4ed4de;}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(_0x3157ef){const _0x325405=a4_0x4ed4,_0x8c6674=[];if(_0x3157ef['total']!==undefined)_0x8c6674[_0x325405(0x1bf)](_0x3157ef[_0x325405(0x19a)]+_0x325405(0x17a));if(_0x3157ef[_0x325405(0x159)]!==undefined&&_0x3157ef[_0x325405(0x159)]>0x0)_0x8c6674[_0x325405(0x1bf)](a4_0x370cfc['green'](_0x3157ef['new']+_0x325405(0x180)));if(_0x3157ef[_0x325405(0x1bb)]!==undefined&&_0x3157ef[_0x325405(0x1bb)]>0x0)_0x8c6674[_0x325405(0x1bf)](a4_0x370cfc[_0x325405(0x134)](_0x3157ef[_0x325405(0x1bb)]+'\x20created'));if(_0x3157ef[_0x325405(0x1a9)]!==undefined&&_0x3157ef[_0x325405(0x1a9)]>0x0)_0x8c6674[_0x325405(0x1bf)](a4_0x370cfc[_0x325405(0x1ab)](_0x3157ef[_0x325405(0x1a9)]+_0x325405(0x12a)));if(_0x3157ef['unchanged']!==undefined&&_0x3157ef['unchanged']>0x0)_0x8c6674['push'](a4_0x370cfc[_0x325405(0x170)](_0x3157ef[_0x325405(0x17c)]+_0x325405(0x1d1)));if(_0x3157ef[_0x325405(0x1c1)]!==undefined&&_0x3157ef[_0x325405(0x1c1)]>0x0)_0x8c6674[_0x325405(0x1bf)](a4_0x370cfc[_0x325405(0x18b)](_0x3157ef[_0x325405(0x1c1)]+'\x20errors'));return _0x8c6674[_0x325405(0x174)](',\x20');}function displayDiffs(_0x5b9743,_0x3f9c6d,_0x437868,_0x1dd615,_0x1171fa,_0x39c1d8,_0x1ac032){const _0x305d52=a4_0x4ed4;for(const _0x1942c8 of _0x5b9743){if(_0x1942c8[_0x305d52(0x177)]){const _0xe31c17=_0x1942c8['agentName']||_0x1942c8[_0x305d52(0x19e)];console[_0x305d52(0x1ba)](_0x305d52(0x1b8)+_0xe31c17+'\x27:'),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)),console[_0x305d52(0x1ba)](_0x1942c8[_0x305d52(0x177)]),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c));}}for(const _0x15e76a of _0x3f9c6d){_0x15e76a[_0x305d52(0x177)]&&(console[_0x305d52(0x1ba)](_0x305d52(0x186)+_0x15e76a['name']+'\x27:'),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)),console[_0x305d52(0x1ba)](_0x15e76a[_0x305d52(0x177)]),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)));}for(const _0x287b9f of _0x437868){_0x287b9f['diff']&&(console[_0x305d52(0x1ba)](_0x305d52(0x1c9)+_0x287b9f['name']+'\x27:'),console[_0x305d52(0x1ba)]('─'['repeat'](0x3c)),console[_0x305d52(0x1ba)](_0x287b9f['diff']),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)));}for(const _0x432079 of _0x1dd615){_0x432079[_0x305d52(0x177)]&&(console[_0x305d52(0x1ba)](_0x305d52(0x12c)+_0x432079[_0x305d52(0x19e)]+'\x27:'),console['log']('─'[_0x305d52(0x13c)](0x3c)),console['log'](_0x432079['diff']),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)));}for(const _0x54cb64 of _0x1171fa){_0x54cb64[_0x305d52(0x177)]&&(console['log']('\x0aChanges\x20to\x20integration\x20\x27'+_0x54cb64[_0x305d52(0x19e)]+'\x27:'),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)),console[_0x305d52(0x1ba)](_0x54cb64[_0x305d52(0x177)]),console['log']('─'[_0x305d52(0x13c)](0x3c)));}for(const _0x42a638 of _0x39c1d8){_0x42a638[_0x305d52(0x177)]&&(console['log']('\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27'+_0x42a638['name']+'\x27:'),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)),console['log'](_0x42a638[_0x305d52(0x177)]),console[_0x305d52(0x1ba)]('─'[_0x305d52(0x13c)](0x3c)));}for(const _0x1849de of _0x1ac032){_0x1849de['diff']&&(console['log'](_0x305d52(0x19d)+_0x1849de[_0x305d52(0x19e)]+'\x27:'),console[_0x305d52(0x1ba)]('─'['repeat'](0x3c)),console['log'](_0x1849de[_0x305d52(0x177)]),console[_0x305d52(0x1ba)]('─'['repeat'](0x3c)));}}function a4_0x449a(){const _0x31569b=['projectDir','\x20new','pushAgent','1389499qGemhH','force','29699109UhWeAz','agentId','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20--name\x20','dryRun','action','agent:pull','red','\x22...','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','Agent\x20','8LvDXgR','cwd-config','\x20\x20Text\x20Knowledge\x20Bases:\x20','\x20\x20Prompts:\x20','counts','cwd','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20\x20Integration\x20\x22','Cancelled','Agent:\x20','pullProject','total','\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)','cloneProject','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','name','\x20files?','experimentalArtifacts','\x20|\x20','✔\x20Context\x20set:\x20','source','context','6mphGQc','\x20\x20Knowledge\x20Base\x20\x22','Agent\x20pulled\x20successfully','\x20\x20Integrations:\x20','updated','Dry\x20run\x20-\x20no\x20files\x20written','yellow','Errors:','integrations','dirname','184tJkifV','\x20\x20Experimental\x20Artifacts:\x20','isNew','knowledgeBases','Pushing\x20agent\x20from\x20\x22','\x20=\x20','4024748JwZfUI','\x0aErrors\x20found:','no_context','\x0aChanges\x20to\x20agent\x20\x27','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','log','created','dim','Output:\x20','Using\x20local\x20project:\x20','push','Using\x20project\x20from\x20','errors','\x0aError:','\x20\x20Experimental\x20Artifact\x20\x22','Failed\x20to\x20push\x20agent:\x20','Project\x20cloned\x20with\x20errors','experimentalKnowledgeBases','Source:\x20','\x0aPush\x20','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','\x20--profile\x20','Cloning\x20\x22','Would\x20pull\x20agent:\x20','profile','outputPath','\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','tdx.json','\x20unchanged','newProjectId','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)','Using\x20context\x20project:\x20','parse','Analyzing\x20changes\x20to\x20push...','\x20updated','textKnowledgeBases','\x0aChanges\x20to\x20prompt\x20\x27','INVALID_ARGUMENT','pushProject','\x20changed','2gDKULg','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','outputDir','llm','green','site','Using\x20current\x20project:\x20','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20Text\x20Knowledge\x20Base\x20\x22','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','reason','MISSING_ARGUMENT','repeat','message','\x20\x20Experimental\x20Knowledge\x20Base\x20\x22','hasChanges','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Dry\x20run\x20-\x20no\x20changes\x20made','Clone\x20\x22','yes','\x20\x20Agent\x20\x22','\x0aProject\x20pushed\x20with\x20errors','\x20\x20tdx\x20agent\x20clone\x20agents/','description','\x0aChanges:','Summary:','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Project:\x20','Cannot\x20clone\x20from\x20context\x20project\x20\x22','prompts','cyan','\x20\x20Agents:\x20','Using\x20project:\x20','llm_project','\x20\x20Prompt\x20\x22','agentName','Using\x20project\x20from\x20context:\x20','agent:push','\x20\x20Target:\x20','Chat:\x20','6797785ouabtQ','new','No\x20tdx.json\x20found\x20in\x20','\x0a✔\x20Pushed\x20','agents','776418fLmGVk','sourceProjectName','llmProject','\x0aPull\x20summary\x20for\x20\x27','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','\x20resources?','\x20\x20Knowledge\x20Bases:\x20','\x22\x20to\x20new\x20project\x20\x22','newProjectName','9756200FKQrKy','Status:\x20','session','\x22:\x20','371214TJPLHP','error','projectName','utf-8','gray','\x27\x20to\x20create\x20the\x20folder\x20structure.','execute','Pushing\x20to\x20project...','join','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','New\x20project:\x20','diff','\x20\x20tdx\x20agent\x20pull\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20total','\x20successfully','unchanged','projectId','output'];a4_0x449a=function(){return _0x31569b;};return a4_0x449a();}export class AgentPullCommand extends BaseCommand{['name']=a4_0x49f1e9(0x18a);[a4_0x49f1e9(0x147)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0x49f1e9(0x172)](_0x5b4d1a){const _0x487344=a4_0x49f1e9,{options:_0x4572b2,args:_0x332244,tdx:_0x1990bb}=_0x5b4d1a,_0x4076b3=_0x332244[0x0],_0x32df90=_0x332244[0x1],_0x46dee5=_0x4572b2[_0x487344(0x17e)],_0x671d2b=_0x4572b2[_0x487344(0x188)],_0x445cd2=_0x4572b2[_0x487344(0x183)],_0x47ed54=_0x4572b2[_0x487344(0x143)],_0x28e6c0=_0x4572b2['llmProject'],_0x1b9f1e=_0x4572b2['agent'];let _0x100d1d;if(_0x4076b3){const _0x2d10da=a4_0xdab3b3[_0x487344(0x174)](_0x4076b3,_0x487344(0x1d0));if(existsSync(_0x2d10da))try{const _0x2bf5d1=JSON[_0x487344(0x128)](readFileSync(_0x2d10da,'utf-8'));_0x2bf5d1[_0x487344(0x151)]&&(_0x100d1d={'llm_project':_0x2bf5d1[_0x487344(0x151)]});}catch{}}const _0x155cac=findAgentConfigPath(process['cwd']());let _0x27bff2;if(_0x155cac)try{const _0x450783=JSON[_0x487344(0x128)](readFileSync(_0x155cac,_0x487344(0x16f)));_0x450783[_0x487344(0x151)]&&(_0x27bff2={'llm_project':_0x450783[_0x487344(0x151)]});}catch{}const _0x2ed963=resolveAgentPullArgs({'arg':_0x4076b3,'agentNameArg':_0x32df90,'agentFlag':_0x1b9f1e,'contextProject':_0x28e6c0,'argDirConfig':_0x100d1d,'cwdConfigPath':_0x155cac||undefined,'cwdConfig':_0x27bff2}),{projectNameOrId:_0x226e7a,targetAgentName:_0x5ee102,existingOutputDir:_0x334d0e,source:_0x56268d}=_0x2ed963;if(_0x56268d==='arg-dir')console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x1bc)](_0x487344(0x1c0)+a4_0xdab3b3[_0x487344(0x174)](_0x4076b3,_0x487344(0x1d0))+':\x20'+_0x226e7a));else{if(_0x56268d===_0x487344(0x190))console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x1bc)](_0x487344(0x150)+_0x226e7a));else _0x56268d===_0x487344(0x1a4)&&console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x1bc)](_0x487344(0x154)+_0x226e7a));}if(!_0x226e7a)return _0x1b9f1e?(console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x1ab)]('The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a')),console[_0x487344(0x1ba)](_0x487344(0x162)),console[_0x487344(0x1ba)](_0x487344(0x18d))):(console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x1ab)](_0x487344(0x137))),console[_0x487344(0x1ba)](_0x487344(0x1d3)),console['log']('\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'),console['log'](_0x487344(0x1cf)),console[_0x487344(0x1ba)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20--agent\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20context\x20project'),console[_0x487344(0x1ba)]('\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(_0x5ee102){const {data:_0x480fba}=await withSpinner('Pulling\x20agent\x20\x22'+_0x5ee102+'\x22\x20from\x20project\x20\x22'+_0x226e7a+_0x487344(0x18c),()=>_0x1990bb[_0x487344(0x133)]['pullAgent'](_0x226e7a,_0x5ee102,_0x46dee5,{'dryRun':_0x671d2b,'force':_0x445cd2}));if(_0x671d2b)return console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x1ab)](_0x487344(0x1aa))),console[_0x487344(0x1ba)](_0x487344(0x1cc)+_0x480fba[_0x487344(0x153)]),console[_0x487344(0x1ba)]('Output\x20path:\x20'+_0x480fba[_0x487344(0x1ce)]),_0x480fba[_0x487344(0x177)]&&(console['log'](_0x487344(0x148)),console['log']('─'['repeat'](0x3c)),console[_0x487344(0x1ba)](_0x480fba['diff']),console[_0x487344(0x1ba)]('─'[_0x487344(0x13c)](0x3c))),0x0;return console[_0x487344(0x1ba)](a4_0x370cfc['green'](_0x487344(0x1a7))),console[_0x487344(0x1ba)]('Agent:\x20'+_0x480fba['agentName']),console[_0x487344(0x1ba)](_0x487344(0x1bd)+_0x480fba[_0x487344(0x1ce)]),console[_0x487344(0x1ba)](_0x487344(0x169)+(_0x480fba[_0x487344(0x1b1)]?a4_0x370cfc['green'](_0x487344(0x159)):_0x480fba[_0x487344(0x13f)]?a4_0x370cfc[_0x487344(0x1ab)]('updated'):a4_0x370cfc[_0x487344(0x170)](_0x487344(0x17c)))),0x0;}const _0x4eff79=_0x334d0e||_0x46dee5,{data:_0x312e4b}=await withSpinner('Analyzing\x20project\x20\x22'+_0x226e7a+_0x487344(0x18c),()=>_0x1990bb[_0x487344(0x133)]['pullProject'](_0x226e7a,_0x4eff79,{'dryRun':!![]})),_0x5900d2=_0x312e4b[_0x487344(0x193)][_0x487344(0x15c)][_0x487344(0x159)]+_0x312e4b['counts']['knowledgeBases'][_0x487344(0x159)]+_0x312e4b[_0x487344(0x193)]['textKnowledgeBases'][_0x487344(0x159)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x14d)][_0x487344(0x159)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x1ad)]['new']+_0x312e4b[_0x487344(0x193)][_0x487344(0x1c6)][_0x487344(0x159)]+_0x312e4b[_0x487344(0x193)]['experimentalArtifacts'][_0x487344(0x159)],_0x100650=_0x312e4b[_0x487344(0x193)][_0x487344(0x15c)][_0x487344(0x1a9)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x1b2)][_0x487344(0x1a9)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x12b)][_0x487344(0x1a9)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x14d)][_0x487344(0x1a9)]+_0x312e4b[_0x487344(0x193)]['integrations']['updated']+_0x312e4b[_0x487344(0x193)][_0x487344(0x1c6)][_0x487344(0x1a9)]+_0x312e4b['counts'][_0x487344(0x1a0)][_0x487344(0x1a9)],_0x2b502a=_0x312e4b[_0x487344(0x193)][_0x487344(0x15c)][_0x487344(0x17c)]+_0x312e4b[_0x487344(0x193)]['knowledgeBases'][_0x487344(0x17c)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x12b)]['unchanged']+_0x312e4b[_0x487344(0x193)]['prompts'][_0x487344(0x17c)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x1ad)][_0x487344(0x17c)]+_0x312e4b[_0x487344(0x193)]['experimentalKnowledgeBases'][_0x487344(0x17c)]+_0x312e4b[_0x487344(0x193)][_0x487344(0x1a0)][_0x487344(0x17c)];console[_0x487344(0x1ba)](_0x487344(0x160)+_0x312e4b[_0x487344(0x16e)]+'\x27:'),console[_0x487344(0x1ba)]('\x20\x20'+a4_0x370cfc[_0x487344(0x134)]('+\x20'+_0x5900d2+_0x487344(0x180))+_0x487344(0x1a1)+a4_0x370cfc[_0x487344(0x1ab)]('~\x20'+_0x100650+_0x487344(0x12f))+'\x20|\x20'+a4_0x370cfc['dim']('=\x20'+_0x2b502a+_0x487344(0x1d1))),console[_0x487344(0x1ba)]('\x20\x20Agents:\x20'+formatCountSummary(_0x312e4b[_0x487344(0x193)]['agents'])),console[_0x487344(0x1ba)](_0x487344(0x165)+formatCountSummary(_0x312e4b[_0x487344(0x193)]['knowledgeBases'])),console[_0x487344(0x1ba)](_0x487344(0x191)+formatCountSummary(_0x312e4b['counts'][_0x487344(0x12b)])),console[_0x487344(0x1ba)](_0x487344(0x192)+formatCountSummary(_0x312e4b[_0x487344(0x193)]['prompts'])),console[_0x487344(0x1ba)](_0x487344(0x1a8)+formatCountSummary(_0x312e4b['counts']['integrations']));const _0x4f8974=_0x312e4b[_0x487344(0x193)]['experimentalKnowledgeBases'][_0x487344(0x19a)]>0x0||_0x312e4b[_0x487344(0x193)][_0x487344(0x1a0)]['total']>0x0;_0x4f8974&&(console[_0x487344(0x1ba)](_0x487344(0x163)+formatCountSummary(_0x312e4b['counts'][_0x487344(0x1c6)])),console[_0x487344(0x1ba)]('\x20\x20Experimental\x20Artifacts:\x20'+formatCountSummary(_0x312e4b[_0x487344(0x193)]['experimentalArtifacts'])));console[_0x487344(0x1ba)](_0x487344(0x156)+a4_0x370cfc['cyan'](_0x312e4b[_0x487344(0x132)])),displayDiffs(_0x312e4b['agents'],_0x312e4b[_0x487344(0x1b2)],_0x312e4b[_0x487344(0x12b)],_0x312e4b[_0x487344(0x14d)],_0x312e4b[_0x487344(0x1ad)],_0x312e4b[_0x487344(0x1c6)],_0x312e4b['experimentalArtifacts']);if(_0x671d2b)return console['log'](a4_0x370cfc[_0x487344(0x1ab)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x5900d2===0x0&&_0x100650===0x0)return console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x134)](_0x487344(0x131))),saveSessionContext({'llm_project':_0x312e4b[_0x487344(0x16e)]},_0x4572b2[_0x487344(0x16a)]),console[_0x487344(0x1ba)](a4_0x370cfc['green'](_0x487344(0x1a2)+a4_0x370cfc[_0x487344(0x1bc)](_0x487344(0x151))+_0x487344(0x1b4)+a4_0x370cfc[_0x487344(0x14e)](_0x312e4b['projectName']))),0x0;if(!_0x47ed54&&!_0x445cd2){if(!isInteractive())return console[_0x487344(0x16d)](a4_0x370cfc['red']('\x0aError:'),_0x487344(0x175)),console[_0x487344(0x16d)](a4_0x370cfc[_0x487344(0x1bc)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x499dad=await confirmKey('\x0aWrite\x20'+(_0x5900d2+_0x100650)+_0x487344(0x19f));if(!_0x499dad)return console[_0x487344(0x1ba)](a4_0x370cfc['yellow'](_0x487344(0x197)),'-\x20no\x20files\x20written'),0x1;}const {data:_0xe9a508}=await withSpinner('Writing\x20files...',()=>_0x1990bb['llm'][_0x487344(0x199)](_0x226e7a,_0x4eff79,{'force':_0x445cd2}));return console[_0x487344(0x1ba)](a4_0x370cfc[_0x487344(0x134)]('\x0a✔\x20Pulled\x20'+(_0x5900d2+_0x100650)+'\x20files\x20to\x20'+_0xe9a508['outputDir'])),saveSessionContext({'llm_project':_0xe9a508['projectName']},_0x4572b2['session']),console['log'](a4_0x370cfc[_0x487344(0x134)]('✔\x20Context\x20set:\x20'+a4_0x370cfc[_0x487344(0x1bc)](_0x487344(0x151))+'\x20=\x20'+a4_0x370cfc['cyan'](_0xe9a508[_0x487344(0x16e)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']='agent:clone';[a4_0x49f1e9(0x147)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a4_0x49f1e9(0x172)](_0x420861){const _0x12c790=a4_0x49f1e9,{options:_0x3f0027,args:_0x2ca414,tdx:_0x21f8fd}=_0x420861,_0x5381da=_0x2ca414[0x0],_0x3245b5=_0x3f0027[_0x12c790(0x19e)],_0x7b3477=_0x3f0027[_0x12c790(0x188)],_0x5bd87e=_0x3f0027[_0x12c790(0x143)],_0x174417=_0x3f0027[_0x12c790(0x135)],_0x5481cf=_0x3f0027[_0x12c790(0x15f)];let _0x26f25b;const _0x26d628=findAgentConfigPath(process[_0x12c790(0x194)]());if(_0x5381da){const _0x3ee1d2=a4_0xdab3b3[_0x12c790(0x174)](_0x5381da,_0x12c790(0x1d0));existsSync(_0x3ee1d2)?(_0x26f25b=_0x5381da,console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x1bc)](_0x12c790(0x1be)+_0x5381da))):_0x26f25b=_0x5381da;}else{if(_0x26d628)_0x26f25b=a4_0xdab3b3[_0x12c790(0x1ae)](_0x26d628),console['log'](a4_0x370cfc[_0x12c790(0x1bc)](_0x12c790(0x136)+_0x26f25b));else{if(_0x5481cf){const _0xe03093=sanitizeForFilesystem(_0x5481cf);let _0x565079=_0xe03093,_0x2ba935=a4_0xdab3b3[_0x12c790(0x174)](process[_0x12c790(0x194)](),_0x12c790(0x15c),_0xe03093,_0x12c790(0x1d0));if(!existsSync(_0x2ba935)){const _0x4b1f2b=normalizeName(_0x5481cf),_0x5eed20=a4_0xdab3b3[_0x12c790(0x174)](process[_0x12c790(0x194)](),'agents',_0x4b1f2b,_0x12c790(0x1d0));existsSync(_0x5eed20)&&(_0x565079=_0x4b1f2b,_0x2ba935=_0x5eed20);}if(existsSync(_0x2ba935))_0x26f25b=a4_0xdab3b3[_0x12c790(0x1ae)](_0x2ba935),console['log'](a4_0x370cfc[_0x12c790(0x1bc)](_0x12c790(0x1be)+_0x26f25b));else{const _0x37308f=_0x3f0027[_0x12c790(0x1cd)];if(_0x37308f)throw new SDKError(ErrorCode[_0x12c790(0x12d)],_0x12c790(0x14c)+_0x5481cf+'\x22\x20to\x20a\x20different\x20profile',undefined,{'helpText':_0x12c790(0x161)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x12c790(0x178)+_0x5481cf+'\x0a')+(_0x12c790(0x146)+_0x565079+_0x12c790(0x187)+(_0x3245b5||'<new-name>')+_0x12c790(0x1ca)+_0x37308f)});_0x26f25b=_0x5481cf,console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x1bc)](_0x12c790(0x127)+_0x5481cf));}}}}if(!_0x26f25b)return console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x1ab)](_0x12c790(0x179))),console[_0x12c790(0x1ba)](_0x12c790(0x1b9)),console[_0x12c790(0x1ba)](_0x12c790(0x195)),console[_0x12c790(0x1ba)](_0x12c790(0x19b)),console[_0x12c790(0x1ba)](_0x12c790(0x14a)),0x1;if(!_0x3245b5)throw new SDKError(ErrorCode[_0x12c790(0x13b)],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x5bd87e&&!_0x7b3477){if(!isInteractive())return console[_0x12c790(0x16d)](a4_0x370cfc[_0x12c790(0x18b)]('\x0aError:'),_0x12c790(0x175)),console[_0x12c790(0x16d)](a4_0x370cfc[_0x12c790(0x1bc)](_0x12c790(0x140))),0x1;const _0x32f0fc=await confirmKey(_0x12c790(0x142)+_0x26f25b+_0x12c790(0x166)+_0x3245b5+'\x22?');if(!_0x32f0fc)return console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x1ab)](_0x12c790(0x197))),0x1;}const {data:_0x20aca6}=await withSpinner(_0x12c790(0x1cb)+_0x26f25b+'\x22\x20to\x20\x22'+_0x3245b5+'\x22...',()=>_0x21f8fd[_0x12c790(0x133)][_0x12c790(0x19c)](_0x26f25b,_0x3245b5,{'dryRun':_0x7b3477}));if(_0x7b3477){console['log'](a4_0x370cfc['yellow'](_0x12c790(0x141))),console[_0x12c790(0x1ba)](_0x12c790(0x1c7)+_0x20aca6[_0x12c790(0x15e)]),console[_0x12c790(0x1ba)](_0x12c790(0x176)+_0x3245b5),console[_0x12c790(0x1ba)]('Would\x20clone:'),console[_0x12c790(0x1ba)](_0x12c790(0x14f)+_0x20aca6[_0x12c790(0x193)][_0x12c790(0x15c)][_0x12c790(0x1bb)]),console['log'](_0x12c790(0x165)+_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1b2)][_0x12c790(0x1bb)]),console['log'](_0x12c790(0x192)+_0x20aca6[_0x12c790(0x193)][_0x12c790(0x14d)][_0x12c790(0x1bb)]);const _0x52b89a=_0x20aca6['counts'][_0x12c790(0x1c6)][_0x12c790(0x1bb)]>0x0||_0x20aca6[_0x12c790(0x193)]['experimentalArtifacts'][_0x12c790(0x1bb)]>0x0;return _0x52b89a&&(console[_0x12c790(0x1ba)](_0x12c790(0x163)+_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1c6)][_0x12c790(0x1bb)]),console[_0x12c790(0x1ba)](_0x12c790(0x1b0)+_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1a0)]['created'])),0x0;}const _0x1c1df8=_0x20aca6['counts']['agents'][_0x12c790(0x1c1)]>0x0||_0x20aca6['counts'][_0x12c790(0x1b2)][_0x12c790(0x1c1)]>0x0||_0x20aca6[_0x12c790(0x193)][_0x12c790(0x14d)][_0x12c790(0x1c1)]>0x0||_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1c6)][_0x12c790(0x1c1)]>0x0||_0x20aca6['counts'][_0x12c790(0x1a0)]['errors']>0x0;_0x1c1df8?console['log'](a4_0x370cfc[_0x12c790(0x1ab)](_0x12c790(0x1c5))):console['log'](a4_0x370cfc[_0x12c790(0x134)]('Project\x20cloned\x20successfully'));console[_0x12c790(0x1ba)](_0x12c790(0x1c7)+_0x20aca6['sourceProjectName']),console[_0x12c790(0x1ba)]('New\x20project:\x20'+_0x20aca6[_0x12c790(0x167)]),console[_0x12c790(0x1ba)]('New\x20project\x20ID:\x20'+_0x20aca6[_0x12c790(0x1d2)]),console['log'](),console['log'](_0x12c790(0x149)),console[_0x12c790(0x1ba)](_0x12c790(0x14f)+formatCountSummary(_0x20aca6['counts'][_0x12c790(0x15c)])),console['log'](_0x12c790(0x165)+formatCountSummary(_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1b2)])),console['log'](_0x12c790(0x192)+formatCountSummary(_0x20aca6[_0x12c790(0x193)]['prompts'])),console[_0x12c790(0x1ba)]('\x20\x20Integrations:\x20'+formatCountSummary(_0x20aca6['counts'][_0x12c790(0x1ad)]));const _0x5ac67e=_0x20aca6[_0x12c790(0x193)]['experimentalKnowledgeBases']['created']>0x0||_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1c6)][_0x12c790(0x1a9)]>0x0||_0x20aca6['counts'][_0x12c790(0x1c6)][_0x12c790(0x17c)]>0x0||_0x20aca6[_0x12c790(0x193)]['experimentalArtifacts'][_0x12c790(0x1bb)]>0x0||_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1a0)]['updated']>0x0||_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1a0)][_0x12c790(0x17c)]>0x0;_0x5ac67e&&(console[_0x12c790(0x1ba)](_0x12c790(0x163)+formatCountSummary(_0x20aca6['counts'][_0x12c790(0x1c6)])),console[_0x12c790(0x1ba)]('\x20\x20Experimental\x20Artifacts:\x20'+formatCountSummary(_0x20aca6[_0x12c790(0x193)][_0x12c790(0x1a0)])));if(_0x1c1df8){console['log'](),console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x18b)](_0x12c790(0x1ac)));for(const _0x3efad5 of _0x20aca6[_0x12c790(0x15c)]){_0x3efad5['action']===_0x12c790(0x16d)&&console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x18b)](_0x12c790(0x144)+_0x3efad5[_0x12c790(0x153)]+_0x12c790(0x16b)+_0x3efad5[_0x12c790(0x16d)]));}for(const _0x4ce51d of _0x20aca6['knowledgeBases']){_0x4ce51d[_0x12c790(0x189)]===_0x12c790(0x16d)&&console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x18b)](_0x12c790(0x1a6)+_0x4ce51d[_0x12c790(0x19e)]+'\x22:\x20'+_0x4ce51d['error']));}for(const _0x3533b0 of _0x20aca6[_0x12c790(0x14d)]){_0x3533b0[_0x12c790(0x189)]===_0x12c790(0x16d)&&console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x18b)](_0x12c790(0x152)+_0x3533b0[_0x12c790(0x19e)]+_0x12c790(0x16b)+_0x3533b0[_0x12c790(0x16d)]));}for(const _0x2ae860 of _0x20aca6[_0x12c790(0x1ad)]){_0x2ae860[_0x12c790(0x189)]===_0x12c790(0x16d)&&console[_0x12c790(0x1ba)](a4_0x370cfc['red'](_0x12c790(0x196)+_0x2ae860[_0x12c790(0x19e)]+_0x12c790(0x16b)+_0x2ae860[_0x12c790(0x16d)]));}for(const _0x16327c of _0x20aca6['experimentalKnowledgeBases']){_0x16327c[_0x12c790(0x189)]===_0x12c790(0x16d)&&console[_0x12c790(0x1ba)](a4_0x370cfc['red'](_0x12c790(0x13e)+_0x16327c['name']+_0x12c790(0x16b)+_0x16327c['error']));}for(const _0x38222c of _0x20aca6[_0x12c790(0x1a0)]){_0x38222c[_0x12c790(0x189)]==='error'&&console[_0x12c790(0x1ba)](a4_0x370cfc[_0x12c790(0x18b)](_0x12c790(0x1c3)+_0x38222c[_0x12c790(0x19e)]+'\x22:\x20'+_0x38222c['error']));}return 0x1;}console[_0x12c790(0x1ba)]();const _0x3c4b73=getLLMProjectUrl(_0x174417,_0x20aca6['newProjectId']);return console[_0x12c790(0x1ba)](_0x12c790(0x14b)+a4_0x370cfc[_0x12c790(0x14e)](_0x3c4b73)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x49f1e9(0x19e)]=a4_0x49f1e9(0x155);['description']='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x49f1e9(0x172)](_0xc74499){const _0x4cd28e=a4_0x49f1e9,{options:_0x4aa071,args:_0x9aedb9,tdx:_0x17848b}=_0xc74499;let _0x413684=_0x9aedb9[0x0]||process[_0x4cd28e(0x194)]();const _0x484c66=_0x4aa071[_0x4cd28e(0x188)],_0x4b9c1f=_0x4aa071[_0x4cd28e(0x183)],_0x5e5b98=_0x4aa071['yes'],_0x3d1269=_0x4aa071['site'],_0x229337=a4_0xdab3b3[_0x4cd28e(0x174)](_0x413684,'agent.yml'),_0xaba77e=existsSync(_0x229337);if(_0xaba77e){const {data:_0x4dedcb}=await withSpinner(_0x4cd28e(0x1b3)+_0x413684+_0x4cd28e(0x18c),()=>_0x17848b[_0x4cd28e(0x133)][_0x4cd28e(0x181)](_0x413684,{'dryRun':_0x484c66,'force':_0x4b9c1f}));if(_0x484c66)return console[_0x4cd28e(0x1ba)](a4_0x370cfc['yellow'](_0x4cd28e(0x141))),console[_0x4cd28e(0x1ba)]('Would\x20push\x20agent:\x20'+_0x4dedcb['agentName']),0x0;if(_0x4dedcb[_0x4cd28e(0x189)]===_0x4cd28e(0x16d))return console[_0x4cd28e(0x1ba)](a4_0x370cfc['red'](_0x4cd28e(0x1c4)+_0x4dedcb['error'])),0x1;console[_0x4cd28e(0x1ba)](a4_0x370cfc['green'](_0x4cd28e(0x18e)+_0x4dedcb[_0x4cd28e(0x189)]+_0x4cd28e(0x17b))),console[_0x4cd28e(0x1ba)](_0x4cd28e(0x198)+_0x4dedcb[_0x4cd28e(0x153)]);if(_0x4dedcb[_0x4cd28e(0x185)]&&_0x4dedcb['projectId']){const _0x74bab0=getLLMAgentChatUrl(_0x3d1269,_0x4dedcb['projectId'],_0x4dedcb[_0x4cd28e(0x185)]);console[_0x4cd28e(0x1ba)](_0x4cd28e(0x157)+a4_0x370cfc[_0x4cd28e(0x14e)](_0x74bab0));}return 0x0;}const _0x24cd75=_0x4aa071[_0x4cd28e(0x15f)],_0x42d0c3=resolveProjectFromContext(_0x413684,_0x24cd75);if(_0x42d0c3['found'])_0x413684=_0x42d0c3[_0x4cd28e(0x17f)],_0x42d0c3[_0x4cd28e(0x1a3)]===_0x4cd28e(0x1a4)&&console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x1bc)](_0x4cd28e(0x150)+_0x413684));else{let _0x3d8c4b='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0x42d0c3[_0x4cd28e(0x13a)]==='no_local_folder'&&(_0x3d8c4b=_0x42d0c3[_0x4cd28e(0x13d)]+_0x4cd28e(0x139)+_0x42d0c3['llmProject']+_0x4cd28e(0x171));throw new SDKError(ErrorCode[_0x4cd28e(0x12d)],_0x42d0c3[_0x4cd28e(0x13a)]===_0x4cd28e(0x1b7)?_0x42d0c3[_0x4cd28e(0x13d)]:_0x4cd28e(0x15a)+_0x413684,undefined,{'helpText':_0x3d8c4b});}const {data:_0x337800}=await withSpinner(_0x4cd28e(0x129),()=>_0x17848b[_0x4cd28e(0x133)][_0x4cd28e(0x12e)](_0x413684,{'dryRun':!![]})),_0x65d6c9=_0x337800['counts']['agents'][_0x4cd28e(0x1c1)]>0x0;if(_0x65d6c9){console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)](_0x4cd28e(0x1b6)));for(const _0x261d6f of _0x337800[_0x4cd28e(0x15c)]){_0x261d6f[_0x4cd28e(0x189)]===_0x4cd28e(0x16d)&&console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)](_0x4cd28e(0x144)+_0x261d6f[_0x4cd28e(0x153)]+_0x4cd28e(0x16b)+_0x261d6f[_0x4cd28e(0x16d)]));}return 0x1;}const _0x54eb13=_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x15c)]['created']+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1b2)][_0x4cd28e(0x1bb)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x12b)][_0x4cd28e(0x1bb)]+_0x337800['counts']['prompts'][_0x4cd28e(0x1bb)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1ad)]['created']+_0x337800[_0x4cd28e(0x193)]['experimentalKnowledgeBases']['created']+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1a0)][_0x4cd28e(0x1bb)],_0x4eb015=_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x15c)]['updated']+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1b2)][_0x4cd28e(0x1a9)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x12b)]['updated']+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x14d)][_0x4cd28e(0x1a9)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1ad)][_0x4cd28e(0x1a9)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1c6)][_0x4cd28e(0x1a9)]+_0x337800['counts']['experimentalArtifacts']['updated'],_0x173d70=_0x337800[_0x4cd28e(0x193)]['agents'][_0x4cd28e(0x17c)]+_0x337800['counts'][_0x4cd28e(0x1b2)][_0x4cd28e(0x17c)]+_0x337800['counts'][_0x4cd28e(0x12b)][_0x4cd28e(0x17c)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x14d)][_0x4cd28e(0x17c)]+_0x337800[_0x4cd28e(0x193)]['integrations'][_0x4cd28e(0x17c)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1c6)][_0x4cd28e(0x17c)]+_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1a0)][_0x4cd28e(0x17c)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x337800[_0x4cd28e(0x16e)]+'\x27:'),console['log']('\x20\x20'+a4_0x370cfc['green']('+\x20'+_0x54eb13+_0x4cd28e(0x180))+_0x4cd28e(0x1a1)+a4_0x370cfc[_0x4cd28e(0x1ab)]('~\x20'+_0x4eb015+'\x20changed')+_0x4cd28e(0x1a1)+a4_0x370cfc[_0x4cd28e(0x1bc)]('=\x20'+_0x173d70+_0x4cd28e(0x1d1))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x15c)])),console[_0x4cd28e(0x1ba)](_0x4cd28e(0x165)+formatCountSummary(_0x337800[_0x4cd28e(0x193)]['knowledgeBases'])),console[_0x4cd28e(0x1ba)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x12b)])),console[_0x4cd28e(0x1ba)](_0x4cd28e(0x192)+formatCountSummary(_0x337800['counts']['prompts'])),console[_0x4cd28e(0x1ba)](_0x4cd28e(0x1a8)+formatCountSummary(_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1ad)]));const _0x1c3e24=_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1c6)]['created']>0x0||_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1c6)]['updated']>0x0||_0x337800['counts'][_0x4cd28e(0x1c6)][_0x4cd28e(0x17c)]>0x0||_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1a0)]['created']>0x0||_0x337800['counts'][_0x4cd28e(0x1a0)][_0x4cd28e(0x1a9)]>0x0||_0x337800[_0x4cd28e(0x193)][_0x4cd28e(0x1a0)]['unchanged']>0x0;_0x1c3e24&&(console[_0x4cd28e(0x1ba)](_0x4cd28e(0x163)+formatCountSummary(_0x337800[_0x4cd28e(0x193)]['experimentalKnowledgeBases'])),console[_0x4cd28e(0x1ba)](_0x4cd28e(0x1b0)+formatCountSummary(_0x337800['counts'][_0x4cd28e(0x1a0)])));console['log']('\x20\x20Source:\x20'+a4_0x370cfc[_0x4cd28e(0x14e)](_0x413684)),displayDiffs(_0x337800[_0x4cd28e(0x15c)],_0x337800[_0x4cd28e(0x1b2)],_0x337800['textKnowledgeBases'],_0x337800[_0x4cd28e(0x14d)],_0x337800[_0x4cd28e(0x1ad)],_0x337800[_0x4cd28e(0x1c6)],_0x337800[_0x4cd28e(0x1a0)]);if(_0x484c66)return console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x1ab)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x54eb13===0x0&&_0x4eb015===0x0){console[_0x4cd28e(0x1ba)](a4_0x370cfc['green']('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x44424b=getLLMProjectUrl(_0x3d1269,_0x337800[_0x4cd28e(0x17d)]);return console[_0x4cd28e(0x1ba)](_0x4cd28e(0x14b)+a4_0x370cfc[_0x4cd28e(0x14e)](_0x44424b)),0x0;}if(!_0x5e5b98&&!_0x4b9c1f){if(!isInteractive())return console[_0x4cd28e(0x16d)](a4_0x370cfc[_0x4cd28e(0x18b)](_0x4cd28e(0x1c2)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x4cd28e(0x16d)](a4_0x370cfc[_0x4cd28e(0x1bc)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x3e1ed5=await confirmKey(_0x4cd28e(0x1c8)+(_0x54eb13+_0x4eb015)+_0x4cd28e(0x164));if(!_0x3e1ed5)return console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x1ab)](_0x4cd28e(0x197)),'-\x20nothing\x20pushed'),0x1;}const {data:_0x4b04f6}=await withSpinner(_0x4cd28e(0x173),()=>_0x17848b[_0x4cd28e(0x133)][_0x4cd28e(0x12e)](_0x413684,{'force':_0x4b9c1f})),_0x2d9967=_0x4b04f6[_0x4cd28e(0x193)][_0x4cd28e(0x15c)]['errors']>0x0||_0x4b04f6[_0x4cd28e(0x193)]['knowledgeBases'][_0x4cd28e(0x1c1)]>0x0||_0x4b04f6[_0x4cd28e(0x193)][_0x4cd28e(0x12b)]['errors']>0x0||_0x4b04f6['counts']['prompts'][_0x4cd28e(0x1c1)]>0x0;if(_0x2d9967){console['log'](a4_0x370cfc[_0x4cd28e(0x1ab)](_0x4cd28e(0x145))),console[_0x4cd28e(0x1ba)](),console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)](_0x4cd28e(0x1ac)));for(const _0xf121ac of _0x4b04f6[_0x4cd28e(0x15c)]){_0xf121ac[_0x4cd28e(0x189)]==='error'&&console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)]('\x20\x20Agent\x20\x22'+_0xf121ac[_0x4cd28e(0x153)]+'\x22:\x20'+_0xf121ac[_0x4cd28e(0x16d)]));}for(const _0x391b75 of _0x4b04f6[_0x4cd28e(0x1b2)]){_0x391b75[_0x4cd28e(0x189)]===_0x4cd28e(0x16d)&&console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)](_0x4cd28e(0x1a6)+_0x391b75['name']+_0x4cd28e(0x16b)+_0x391b75[_0x4cd28e(0x16d)]));}for(const _0x59a0e6 of _0x4b04f6[_0x4cd28e(0x12b)]){_0x59a0e6[_0x4cd28e(0x189)]==='error'&&console[_0x4cd28e(0x1ba)](a4_0x370cfc['red'](_0x4cd28e(0x138)+_0x59a0e6[_0x4cd28e(0x19e)]+_0x4cd28e(0x16b)+_0x59a0e6[_0x4cd28e(0x16d)]));}for(const _0x5632a6 of _0x4b04f6[_0x4cd28e(0x14d)]){_0x5632a6[_0x4cd28e(0x189)]===_0x4cd28e(0x16d)&&console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)](_0x4cd28e(0x152)+_0x5632a6['name']+_0x4cd28e(0x16b)+_0x5632a6[_0x4cd28e(0x16d)]));}for(const _0x2d8633 of _0x4b04f6[_0x4cd28e(0x1ad)]){_0x2d8633['action']==='error'&&console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x18b)]('\x20\x20Integration\x20\x22'+_0x2d8633[_0x4cd28e(0x19e)]+'\x22:\x20'+_0x2d8633[_0x4cd28e(0x16d)]));}return 0x1;}console[_0x4cd28e(0x1ba)](a4_0x370cfc[_0x4cd28e(0x134)](_0x4cd28e(0x15b)+(_0x54eb13+_0x4eb015)+'\x20resources\x20to\x20\x27'+_0x4b04f6[_0x4cd28e(0x16e)]+'\x27'));const _0x3ee9b9=getLLMProjectUrl(_0x3d1269,_0x4b04f6['projectId']);return console[_0x4cd28e(0x1ba)](_0x4cd28e(0x14b)+a4_0x370cfc[_0x4cd28e(0x14e)](_0x3ee9b9)),0x0;}}
1
+ const a4_0x40b9c1=a4_0x51a1;(function(_0x597529,_0x2b9a49){const _0x320714=a4_0x51a1,_0x4e5824=_0x597529();while(!![]){try{const _0x54ddee=parseInt(_0x320714(0x10e))/0x1*(parseInt(_0x320714(0x147))/0x2)+parseInt(_0x320714(0xb3))/0x3*(-parseInt(_0x320714(0x158))/0x4)+-parseInt(_0x320714(0x14e))/0x5*(-parseInt(_0x320714(0xb1))/0x6)+parseInt(_0x320714(0xa6))/0x7*(-parseInt(_0x320714(0xa9))/0x8)+-parseInt(_0x320714(0xdb))/0x9*(-parseInt(_0x320714(0x116))/0xa)+-parseInt(_0x320714(0x135))/0xb*(-parseInt(_0x320714(0x11d))/0xc)+-parseInt(_0x320714(0xf5))/0xd*(parseInt(_0x320714(0x152))/0xe);if(_0x54ddee===_0x2b9a49)break;else _0x4e5824['push'](_0x4e5824['shift']());}catch(_0x1c1ce6){_0x4e5824['push'](_0x4e5824['shift']());}}}(a4_0x5b32,0x6c579));import a4_0x3397c1 from'chalk';import a4_0x2d596d 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(_0x205ae6){const _0x29890f=a4_0x51a1,_0x54481d=[];if(_0x205ae6[_0x29890f(0x13c)]!==undefined)_0x54481d[_0x29890f(0xbc)](_0x205ae6[_0x29890f(0x13c)]+_0x29890f(0xb5));if(_0x205ae6[_0x29890f(0x157)]!==undefined&&_0x205ae6[_0x29890f(0x157)]>0x0)_0x54481d['push'](a4_0x3397c1[_0x29890f(0xb9)](_0x205ae6[_0x29890f(0x157)]+_0x29890f(0xf9)));if(_0x205ae6[_0x29890f(0x102)]!==undefined&&_0x205ae6[_0x29890f(0x102)]>0x0)_0x54481d[_0x29890f(0xbc)](a4_0x3397c1[_0x29890f(0xb9)](_0x205ae6[_0x29890f(0x102)]+_0x29890f(0xd6)));if(_0x205ae6[_0x29890f(0x112)]!==undefined&&_0x205ae6['updated']>0x0)_0x54481d[_0x29890f(0xbc)](a4_0x3397c1[_0x29890f(0x137)](_0x205ae6['updated']+_0x29890f(0x140)));if(_0x205ae6['unchanged']!==undefined&&_0x205ae6[_0x29890f(0x13d)]>0x0)_0x54481d['push'](a4_0x3397c1[_0x29890f(0x150)](_0x205ae6[_0x29890f(0x13d)]+_0x29890f(0x11c)));if(_0x205ae6[_0x29890f(0xb4)]!==undefined&&_0x205ae6[_0x29890f(0xb4)]>0x0)_0x54481d[_0x29890f(0xbc)](a4_0x3397c1['red'](_0x205ae6[_0x29890f(0xb4)]+'\x20errors'));return _0x54481d[_0x29890f(0xcd)](',\x20');}function a4_0x5b32(){const _0x142ad0=['description','-\x20no\x20files\x20written','llmProject','\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','isNew','session','agent:pull','join','cwd-config','red','profile','\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27','Using\x20current\x20project:\x20','reason','llm','execute','\x20created','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','Cloning\x20\x22','no_context','9LpbytD','\x20\x20Text\x20Knowledge\x20Bases:\x20','No\x20tdx.json\x20found\x20in\x20','\x0aWrite\x20','action','log','\x0aPush\x20summary\x20for\x20\x27','\x0a✔\x20Pulled\x20','\x22\x20to\x20new\x20project\x20\x22','\x0aChanges\x20to\x20prompt\x20\x27','force','prompts','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','\x20\x20Prompt\x20\x22','hasChanges','<new-name>','cyan','Using\x20project\x20from\x20','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','\x0aError:','\x22\x20to\x20\x22','Writing\x20files...','Output\x20path:\x20','parse','experimentalArtifacts','diff','143Kgwvaq','textKnowledgeBases','Source:\x20','\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','\x20new','dim','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','Pushing\x20to\x20project...','sourceProjectName','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','knowledgeBases','agent:push','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','created','utf-8','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)','\x22\x20to\x20a\x20different\x20profile','cwd','name','output','Agent:\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','newProjectId','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','\x22...','189194EqaDfc','Output:\x20','Dry\x20run\x20-\x20no\x20files\x20written','pushAgent','updated','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Would\x20clone:','llm_project','2025130yoXWNG','\x20\x20tdx\x20agent\x20pull\x20','\x0aPull\x20summary\x20for\x20\x27','agentId','outputPath','\x0aPush\x20','\x20unchanged','804qmeqKV','\x20\x20Integration\x20\x22','Project\x20cloned\x20successfully','Status:\x20','\x20--name\x20','\x20--profile\x20','pullProject','\x20\x20Experimental\x20Artifacts:\x20','\x20\x20Prompts:\x20','Would\x20pull\x20agent:\x20','\x20=\x20','\x0aErrors\x20found:','outputDir','✔\x20Context\x20set:\x20','New\x20project\x20ID:\x20','dirname','agentName','Using\x20project\x20from\x20context:\x20','Agent\x20pulled\x20successfully','Clone\x20\x22','\x20resources?','\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)','yes','Project\x20cloned\x20with\x20errors','50017SJykXT','\x20changed','yellow','experimentalKnowledgeBases','\x0a✔\x20Pushed\x20','error','\x20\x20Experimental\x20Artifact\x20\x22','total','unchanged','\x20successfully','found','\x20updated','\x20\x20Knowledge\x20Bases:\x20','context','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','newProjectName','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','arg-dir','8OLUDyT','agents','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20tdx\x20agent\x20clone\x20agents/','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','projectName','message','4835vwtciw','pushProject','gray','\x27\x20to\x20create\x20the\x20folder\x20structure.','632352rjtRoj','pullAgent','dryRun','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20\x20Source:\x20','new','2100516RLmnfq','Analyzing\x20changes\x20to\x20push...','Using\x20context\x20project:\x20','Would\x20push\x20agent:\x20','INVALID_ARGUMENT','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x0aChanges:','tdx.json','source','integrations','projectId','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','184079puwwvt','agent.yml','\x20|\x20','136EUMsrm','counts','agent','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','New\x20project:\x20','\x20\x20Agents:\x20','Errors:','Using\x20project:\x20','4026bMDAzh','\x20\x20Knowledge\x20Base\x20\x22','3ZYmoMx','errors','\x20total','Pushing\x20agent\x20from\x20\x22','cloneProject','site','green','Summary:','Project:\x20','push','Dry\x20run\x20-\x20no\x20changes\x20made','Cancelled','Failed\x20to\x20push\x20agent:\x20','\x20\x20Agent\x20\x22','repeat','agent:clone','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','\x22:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date'];a4_0x5b32=function(){return _0x142ad0;};return a4_0x5b32();}function displayDiffs(_0x51daf5,_0x5ba373,_0x3740a0,_0x43e946,_0x1b79ca,_0x22c353,_0x25c097){const _0x3292ac=a4_0x51a1;for(const _0x45e269 of _0x51daf5){if(_0x45e269['diff']){const _0x2bec3d=_0x45e269[_0x3292ac(0x12d)]||_0x45e269[_0x3292ac(0x107)];console[_0x3292ac(0xe0)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x2bec3d+'\x27:'),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)),console['log'](_0x45e269['diff']),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c));}}for(const _0x547ca7 of _0x5ba373){_0x547ca7[_0x3292ac(0xf4)]&&(console[_0x3292ac(0xe0)](_0x3292ac(0xd7)+_0x547ca7[_0x3292ac(0x107)]+'\x27:'),console['log']('─'[_0x3292ac(0xc1)](0x3c)),console[_0x3292ac(0xe0)](_0x547ca7[_0x3292ac(0xf4)]),console[_0x3292ac(0xe0)]('─'['repeat'](0x3c)));}for(const _0x11f5f8 of _0x3740a0){_0x11f5f8[_0x3292ac(0xf4)]&&(console[_0x3292ac(0xe0)](_0x3292ac(0xc3)+_0x11f5f8['name']+'\x27:'),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)),console[_0x3292ac(0xe0)](_0x11f5f8[_0x3292ac(0xf4)]),console[_0x3292ac(0xe0)]('─'['repeat'](0x3c)));}for(const _0x3383a6 of _0x43e946){_0x3383a6[_0x3292ac(0xf4)]&&(console[_0x3292ac(0xe0)](_0x3292ac(0xe4)+_0x3383a6[_0x3292ac(0x107)]+'\x27:'),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)),console['log'](_0x3383a6[_0x3292ac(0xf4)]),console['log']('─'[_0x3292ac(0xc1)](0x3c)));}for(const _0xd8008a of _0x1b79ca){_0xd8008a['diff']&&(console[_0x3292ac(0xe0)]('\x0aChanges\x20to\x20integration\x20\x27'+_0xd8008a[_0x3292ac(0x107)]+'\x27:'),console[_0x3292ac(0xe0)]('─'['repeat'](0x3c)),console['log'](_0xd8008a[_0x3292ac(0xf4)]),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)));}for(const _0x34b091 of _0x22c353){_0x34b091[_0x3292ac(0xf4)]&&(console[_0x3292ac(0xe0)](_0x3292ac(0xd1)+_0x34b091[_0x3292ac(0x107)]+'\x27:'),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)),console[_0x3292ac(0xe0)](_0x34b091[_0x3292ac(0xf4)]),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)));}for(const _0x297521 of _0x25c097){_0x297521[_0x3292ac(0xf4)]&&(console[_0x3292ac(0xe0)]('\x0aChanges\x20to\x20experimental\x20artifact\x20\x27'+_0x297521[_0x3292ac(0x107)]+'\x27:'),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)),console[_0x3292ac(0xe0)](_0x297521[_0x3292ac(0xf4)]),console[_0x3292ac(0xe0)]('─'[_0x3292ac(0xc1)](0x3c)));}}function a4_0x51a1(_0x32f2a9,_0x37e0f0){_0x32f2a9=_0x32f2a9-0xa4;const _0x5b3209=a4_0x5b32();let _0x51a12e=_0x5b3209[_0x32f2a9];return _0x51a12e;}export class AgentPullCommand extends BaseCommand{[a4_0x40b9c1(0x107)]=a4_0x40b9c1(0xcc);[a4_0x40b9c1(0xc6)]=a4_0x40b9c1(0x14b);async['execute'](_0x2cd33f){const _0x313275=a4_0x40b9c1,{options:_0x428604,args:_0x5ec7f3,tdx:_0x5e6eb5}=_0x2cd33f,_0x113e9b=_0x5ec7f3[0x0],_0x331915=_0x5ec7f3[0x1],_0x45b1bd=_0x428604[_0x313275(0x108)],_0x1d1d20=_0x428604['dryRun'],_0xf0fa09=_0x428604['force'],_0x4e22a7=_0x428604[_0x313275(0x133)],_0x4888f8=_0x428604[_0x313275(0xc8)],_0x298f93=_0x428604[_0x313275(0xab)];let _0x1c57a7;if(_0x113e9b){const _0x512a3b=a4_0x2d596d[_0x313275(0xcd)](_0x113e9b,_0x313275(0x15f));if(existsSync(_0x512a3b))try{const _0x313189=JSON[_0x313275(0xf2)](readFileSync(_0x512a3b,_0x313275(0x103)));_0x313189[_0x313275(0x115)]&&(_0x1c57a7={'llm_project':_0x313189[_0x313275(0x115)]});}catch{}}const _0x49a52b=findAgentConfigPath(process[_0x313275(0x106)]());let _0x4253aa;if(_0x49a52b)try{const _0x5085f2=JSON[_0x313275(0xf2)](readFileSync(_0x49a52b,_0x313275(0x103)));_0x5085f2[_0x313275(0x115)]&&(_0x4253aa={'llm_project':_0x5085f2['llm_project']});}catch{}const _0x3b7a2f=resolveAgentPullArgs({'arg':_0x113e9b,'agentNameArg':_0x331915,'agentFlag':_0x298f93,'contextProject':_0x4888f8,'argDirConfig':_0x1c57a7,'cwdConfigPath':_0x49a52b||undefined,'cwdConfig':_0x4253aa}),{projectNameOrId:_0xe30c68,targetAgentName:_0x29bd90,existingOutputDir:_0x2febe9,source:_0x5d5f65}=_0x3b7a2f;if(_0x5d5f65===_0x313275(0x146))console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0xfa)](_0x313275(0xec)+a4_0x2d596d['join'](_0x113e9b,'tdx.json')+':\x20'+_0xe30c68));else{if(_0x5d5f65===_0x313275(0xce))console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0xfa)](_0x313275(0xb0)+_0xe30c68));else _0x5d5f65===_0x313275(0x142)&&console['log'](a4_0x3397c1[_0x313275(0xfa)](_0x313275(0x12e)+_0xe30c68));}if(!_0xe30c68)return _0x298f93?(console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0x137)]('The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a')),console[_0x313275(0xe0)](_0x313275(0x10c)),console[_0x313275(0xe0)](_0x313275(0xac))):(console[_0x313275(0xe0)](a4_0x3397c1['yellow'](_0x313275(0x101))),console[_0x313275(0xe0)](_0x313275(0x104)),console[_0x313275(0xe0)](_0x313275(0xe7)),console[_0x313275(0xe0)](_0x313275(0xc9)),console[_0x313275(0xe0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20--agent\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20context\x20project'),console[_0x313275(0xe0)](_0x313275(0xf8))),0x1;if(_0x29bd90){const {data:_0x3e41c2}=await withSpinner('Pulling\x20agent\x20\x22'+_0x29bd90+'\x22\x20from\x20project\x20\x22'+_0xe30c68+_0x313275(0x10d),()=>_0x5e6eb5['llm'][_0x313275(0x153)](_0xe30c68,_0x29bd90,_0x45b1bd,{'dryRun':_0x1d1d20,'force':_0xf0fa09}));if(_0x1d1d20)return console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0x137)](_0x313275(0x110))),console[_0x313275(0xe0)](_0x313275(0x126)+_0x3e41c2[_0x313275(0x12d)]),console[_0x313275(0xe0)](_0x313275(0xf1)+_0x3e41c2[_0x313275(0x11a)]),_0x3e41c2[_0x313275(0xf4)]&&(console[_0x313275(0xe0)](_0x313275(0x15e)),console[_0x313275(0xe0)]('─'[_0x313275(0xc1)](0x3c)),console['log'](_0x3e41c2[_0x313275(0xf4)]),console[_0x313275(0xe0)]('─'[_0x313275(0xc1)](0x3c))),0x0;return console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0xb9)](_0x313275(0x12f))),console[_0x313275(0xe0)](_0x313275(0x109)+_0x3e41c2[_0x313275(0x12d)]),console[_0x313275(0xe0)](_0x313275(0x10f)+_0x3e41c2[_0x313275(0x11a)]),console[_0x313275(0xe0)](_0x313275(0x120)+(_0x3e41c2[_0x313275(0xca)]?a4_0x3397c1[_0x313275(0xb9)](_0x313275(0x157)):_0x3e41c2[_0x313275(0xe9)]?a4_0x3397c1['yellow'](_0x313275(0x112)):a4_0x3397c1['gray']('unchanged'))),0x0;}const _0x574a07=_0x2febe9||_0x45b1bd,{data:_0x4b55f4}=await withSpinner('Analyzing\x20project\x20\x22'+_0xe30c68+_0x313275(0x10d),()=>_0x5e6eb5[_0x313275(0xd4)][_0x313275(0x123)](_0xe30c68,_0x574a07,{'dryRun':!![]})),_0x5cb9a1=_0x4b55f4[_0x313275(0xaa)][_0x313275(0x148)][_0x313275(0x157)]+_0x4b55f4[_0x313275(0xaa)]['knowledgeBases']['new']+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xf6)][_0x313275(0x157)]+_0x4b55f4['counts']['prompts']['new']+_0x4b55f4['counts']['integrations']['new']+_0x4b55f4[_0x313275(0xaa)][_0x313275(0x138)][_0x313275(0x157)]+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xf3)][_0x313275(0x157)],_0x2196b7=_0x4b55f4[_0x313275(0xaa)][_0x313275(0x148)][_0x313275(0x112)]+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xff)]['updated']+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xf6)]['updated']+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xe6)][_0x313275(0x112)]+_0x4b55f4['counts'][_0x313275(0x161)][_0x313275(0x112)]+_0x4b55f4[_0x313275(0xaa)][_0x313275(0x138)][_0x313275(0x112)]+_0x4b55f4['counts'][_0x313275(0xf3)][_0x313275(0x112)],_0x15d389=_0x4b55f4[_0x313275(0xaa)][_0x313275(0x148)][_0x313275(0x13d)]+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xff)][_0x313275(0x13d)]+_0x4b55f4[_0x313275(0xaa)]['textKnowledgeBases']['unchanged']+_0x4b55f4[_0x313275(0xaa)][_0x313275(0xe6)]['unchanged']+_0x4b55f4[_0x313275(0xaa)][_0x313275(0x161)][_0x313275(0x13d)]+_0x4b55f4[_0x313275(0xaa)][_0x313275(0x138)][_0x313275(0x13d)]+_0x4b55f4[_0x313275(0xaa)]['experimentalArtifacts'][_0x313275(0x13d)];console[_0x313275(0xe0)](_0x313275(0x118)+_0x4b55f4[_0x313275(0x14c)]+'\x27:'),console[_0x313275(0xe0)]('\x20\x20'+a4_0x3397c1['green']('+\x20'+_0x5cb9a1+_0x313275(0xf9))+'\x20|\x20'+a4_0x3397c1[_0x313275(0x137)]('~\x20'+_0x2196b7+_0x313275(0x136))+'\x20|\x20'+a4_0x3397c1['dim']('=\x20'+_0x15d389+_0x313275(0x11c))),console[_0x313275(0xe0)](_0x313275(0xae)+formatCountSummary(_0x4b55f4[_0x313275(0xaa)]['agents'])),console['log'](_0x313275(0x141)+formatCountSummary(_0x4b55f4['counts'][_0x313275(0xff)])),console[_0x313275(0xe0)](_0x313275(0xdc)+formatCountSummary(_0x4b55f4[_0x313275(0xaa)][_0x313275(0xf6)])),console[_0x313275(0xe0)](_0x313275(0x125)+formatCountSummary(_0x4b55f4['counts'][_0x313275(0xe6)])),console['log']('\x20\x20Integrations:\x20'+formatCountSummary(_0x4b55f4[_0x313275(0xaa)]['integrations']));const _0x368704=_0x4b55f4[_0x313275(0xaa)]['experimentalKnowledgeBases']['total']>0x0||_0x4b55f4['counts']['experimentalArtifacts'][_0x313275(0x13c)]>0x0;_0x368704&&(console['log'](_0x313275(0x143)+formatCountSummary(_0x4b55f4[_0x313275(0xaa)]['experimentalKnowledgeBases'])),console[_0x313275(0xe0)](_0x313275(0x124)+formatCountSummary(_0x4b55f4['counts']['experimentalArtifacts'])));console['log']('\x20\x20Target:\x20'+a4_0x3397c1[_0x313275(0xeb)](_0x4b55f4['outputDir'])),displayDiffs(_0x4b55f4['agents'],_0x4b55f4[_0x313275(0xff)],_0x4b55f4['textKnowledgeBases'],_0x4b55f4['prompts'],_0x4b55f4[_0x313275(0x161)],_0x4b55f4[_0x313275(0x138)],_0x4b55f4[_0x313275(0xf3)]);if(_0x1d1d20)return console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0x137)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x5cb9a1===0x0&&_0x2196b7===0x0)return console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0xb9)](_0x313275(0xc5))),saveSessionContext({'llm_project':_0x4b55f4[_0x313275(0x14c)]},_0x428604['session']),console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0xb9)](_0x313275(0x12a)+a4_0x3397c1['dim'](_0x313275(0x115))+_0x313275(0x127)+a4_0x3397c1[_0x313275(0xeb)](_0x4b55f4[_0x313275(0x14c)]))),0x0;if(!_0x4e22a7&&!_0xf0fa09){if(!isInteractive())return console[_0x313275(0x13a)](a4_0x3397c1['red'](_0x313275(0xee)),_0x313275(0x113)),console[_0x313275(0x13a)](a4_0x3397c1['dim'](_0x313275(0x149))),0x1;const _0x2d3b3b=await confirmKey(_0x313275(0xde)+(_0x5cb9a1+_0x2196b7)+'\x20files?');if(!_0x2d3b3b)return console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0x137)]('Cancelled'),_0x313275(0xc7)),0x1;}const {data:_0x131d3e}=await withSpinner(_0x313275(0xf0),()=>_0x5e6eb5[_0x313275(0xd4)][_0x313275(0x123)](_0xe30c68,_0x574a07,{'force':_0xf0fa09}));return console[_0x313275(0xe0)](a4_0x3397c1['green'](_0x313275(0xe2)+(_0x5cb9a1+_0x2196b7)+'\x20files\x20to\x20'+_0x131d3e[_0x313275(0x129)])),saveSessionContext({'llm_project':_0x131d3e[_0x313275(0x14c)]},_0x428604[_0x313275(0xcb)]),console[_0x313275(0xe0)](a4_0x3397c1[_0x313275(0xb9)](_0x313275(0x12a)+a4_0x3397c1[_0x313275(0xfa)](_0x313275(0x115))+'\x20=\x20'+a4_0x3397c1[_0x313275(0xeb)](_0x131d3e[_0x313275(0x14c)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x40b9c1(0x107)]=a4_0x40b9c1(0xc2);[a4_0x40b9c1(0xc6)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a4_0x40b9c1(0xd5)](_0x4e7028){const _0x148871=a4_0x40b9c1,{options:_0x276328,args:_0x50f395,tdx:_0x32af8b}=_0x4e7028,_0xff8d65=_0x50f395[0x0],_0x3eecca=_0x276328[_0x148871(0x107)],_0x1028e3=_0x276328['dryRun'],_0x40cfed=_0x276328[_0x148871(0x133)],_0x377350=_0x276328['site'],_0x3b3d73=_0x276328[_0x148871(0xc8)];let _0x453d4d;const _0x91a4=findAgentConfigPath(process[_0x148871(0x106)]());if(_0xff8d65){const _0x1b8dc3=a4_0x2d596d['join'](_0xff8d65,_0x148871(0x15f));existsSync(_0x1b8dc3)?(_0x453d4d=_0xff8d65,console['log'](a4_0x3397c1['dim']('Using\x20local\x20project:\x20'+_0xff8d65))):_0x453d4d=_0xff8d65;}else{if(_0x91a4)_0x453d4d=a4_0x2d596d[_0x148871(0x12c)](_0x91a4),console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xfa)](_0x148871(0xd2)+_0x453d4d));else{if(_0x3b3d73){const _0x5918dc=sanitizeForFilesystem(_0x3b3d73);let _0x3fcf15=_0x5918dc,_0x27269f=a4_0x2d596d['join'](process[_0x148871(0x106)](),_0x148871(0x148),_0x5918dc,_0x148871(0x15f));if(!existsSync(_0x27269f)){const _0x3e0d61=normalizeName(_0x3b3d73),_0x480228=a4_0x2d596d[_0x148871(0xcd)](process[_0x148871(0x106)](),_0x148871(0x148),_0x3e0d61,_0x148871(0x15f));existsSync(_0x480228)&&(_0x3fcf15=_0x3e0d61,_0x27269f=_0x480228);}if(existsSync(_0x27269f))_0x453d4d=a4_0x2d596d[_0x148871(0x12c)](_0x27269f),console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xfa)]('Using\x20local\x20project:\x20'+_0x453d4d));else{const _0x418be9=_0x276328[_0x148871(0xd0)];if(_0x418be9)throw new SDKError(ErrorCode[_0x148871(0x15c)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x3b3d73+_0x148871(0x105),undefined,{'helpText':_0x148871(0xed)+_0x148871(0x10a)+(_0x148871(0x117)+_0x3b3d73+'\x0a')+(_0x148871(0x14a)+_0x3fcf15+_0x148871(0x121)+(_0x3eecca||_0x148871(0xea))+_0x148871(0x122)+_0x418be9)});_0x453d4d=_0x3b3d73,console[_0x148871(0xe0)](a4_0x3397c1['dim'](_0x148871(0x15a)+_0x3b3d73));}}}}if(!_0x453d4d)return console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0x137)](_0x148871(0xa5))),console[_0x148871(0xe0)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x148871(0xe0)](_0x148871(0x155)),console[_0x148871(0xe0)](_0x148871(0x132)),console[_0x148871(0xe0)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x3eecca)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':_0x148871(0xfe)});if(!_0x40cfed&&!_0x1028e3){if(!isInteractive())return console['error'](a4_0x3397c1[_0x148871(0xcf)](_0x148871(0xee)),_0x148871(0x113)),console['error'](a4_0x3397c1['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x27bf4b=await confirmKey(_0x148871(0x130)+_0x453d4d+_0x148871(0xe3)+_0x3eecca+'\x22?');if(!_0x27bf4b)return console['log'](a4_0x3397c1[_0x148871(0x137)](_0x148871(0xbe))),0x1;}const {data:_0x246c8f}=await withSpinner(_0x148871(0xd9)+_0x453d4d+_0x148871(0xef)+_0x3eecca+'\x22...',()=>_0x32af8b[_0x148871(0xd4)][_0x148871(0xb7)](_0x453d4d,_0x3eecca,{'dryRun':_0x1028e3}));if(_0x1028e3){console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0x137)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console['log']('Source:\x20'+_0x246c8f[_0x148871(0xfd)]),console['log'](_0x148871(0xad)+_0x3eecca),console['log'](_0x148871(0x114)),console[_0x148871(0xe0)](_0x148871(0xae)+_0x246c8f[_0x148871(0xaa)]['agents'][_0x148871(0x102)]),console['log'](_0x148871(0x141)+_0x246c8f[_0x148871(0xaa)][_0x148871(0xff)][_0x148871(0x102)]),console[_0x148871(0xe0)](_0x148871(0x125)+_0x246c8f[_0x148871(0xaa)][_0x148871(0xe6)]['created']);const _0x1368ef=_0x246c8f['counts'][_0x148871(0x138)]['created']>0x0||_0x246c8f['counts'][_0x148871(0xf3)][_0x148871(0x102)]>0x0;return _0x1368ef&&(console['log']('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+_0x246c8f['counts']['experimentalKnowledgeBases'][_0x148871(0x102)]),console['log']('\x20\x20Experimental\x20Artifacts:\x20'+_0x246c8f[_0x148871(0xaa)][_0x148871(0xf3)][_0x148871(0x102)])),0x0;}const _0x546fd4=_0x246c8f[_0x148871(0xaa)][_0x148871(0x148)][_0x148871(0xb4)]>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0xff)]['errors']>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0xe6)][_0x148871(0xb4)]>0x0||_0x246c8f[_0x148871(0xaa)]['experimentalKnowledgeBases'][_0x148871(0xb4)]>0x0||_0x246c8f[_0x148871(0xaa)]['experimentalArtifacts'][_0x148871(0xb4)]>0x0;_0x546fd4?console['log'](a4_0x3397c1[_0x148871(0x137)](_0x148871(0x134))):console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xb9)](_0x148871(0x11f)));console[_0x148871(0xe0)](_0x148871(0xf7)+_0x246c8f['sourceProjectName']),console[_0x148871(0xe0)](_0x148871(0xad)+_0x246c8f[_0x148871(0x144)]),console[_0x148871(0xe0)](_0x148871(0x12b)+_0x246c8f[_0x148871(0x10b)]),console[_0x148871(0xe0)](),console[_0x148871(0xe0)](_0x148871(0xba)),console[_0x148871(0xe0)](_0x148871(0xae)+formatCountSummary(_0x246c8f[_0x148871(0xaa)][_0x148871(0x148)])),console[_0x148871(0xe0)](_0x148871(0x141)+formatCountSummary(_0x246c8f[_0x148871(0xaa)][_0x148871(0xff)])),console[_0x148871(0xe0)](_0x148871(0x125)+formatCountSummary(_0x246c8f[_0x148871(0xaa)][_0x148871(0xe6)])),console[_0x148871(0xe0)]('\x20\x20Integrations:\x20'+formatCountSummary(_0x246c8f[_0x148871(0xaa)][_0x148871(0x161)]));const _0x434f79=_0x246c8f[_0x148871(0xaa)]['experimentalKnowledgeBases'][_0x148871(0x102)]>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0x138)][_0x148871(0x112)]>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0x138)][_0x148871(0x13d)]>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0xf3)][_0x148871(0x102)]>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0xf3)][_0x148871(0x112)]>0x0||_0x246c8f[_0x148871(0xaa)][_0x148871(0xf3)][_0x148871(0x13d)]>0x0;_0x434f79&&(console[_0x148871(0xe0)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x246c8f[_0x148871(0xaa)][_0x148871(0x138)])),console[_0x148871(0xe0)](_0x148871(0x124)+formatCountSummary(_0x246c8f[_0x148871(0xaa)]['experimentalArtifacts'])));if(_0x546fd4){console[_0x148871(0xe0)](),console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xcf)](_0x148871(0xaf)));for(const _0x10d02c of _0x246c8f[_0x148871(0x148)]){_0x10d02c['action']==='error'&&console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xcf)](_0x148871(0xc0)+_0x10d02c[_0x148871(0x12d)]+_0x148871(0xc4)+_0x10d02c[_0x148871(0x13a)]));}for(const _0x5e6567 of _0x246c8f[_0x148871(0xff)]){_0x5e6567[_0x148871(0xdf)]==='error'&&console['log'](a4_0x3397c1[_0x148871(0xcf)](_0x148871(0xb2)+_0x5e6567[_0x148871(0x107)]+_0x148871(0xc4)+_0x5e6567[_0x148871(0x13a)]));}for(const _0x4af607 of _0x246c8f['prompts']){_0x4af607[_0x148871(0xdf)]==='error'&&console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xcf)]('\x20\x20Prompt\x20\x22'+_0x4af607[_0x148871(0x107)]+'\x22:\x20'+_0x4af607[_0x148871(0x13a)]));}for(const _0x5e9dde of _0x246c8f[_0x148871(0x161)]){_0x5e9dde[_0x148871(0xdf)]===_0x148871(0x13a)&&console[_0x148871(0xe0)](a4_0x3397c1[_0x148871(0xcf)](_0x148871(0x11e)+_0x5e9dde[_0x148871(0x107)]+_0x148871(0xc4)+_0x5e9dde[_0x148871(0x13a)]));}for(const _0xe7879d of _0x246c8f[_0x148871(0x138)]){_0xe7879d[_0x148871(0xdf)]===_0x148871(0x13a)&&console[_0x148871(0xe0)](a4_0x3397c1['red']('\x20\x20Experimental\x20Knowledge\x20Base\x20\x22'+_0xe7879d['name']+'\x22:\x20'+_0xe7879d['error']));}for(const _0x49ad2e of _0x246c8f[_0x148871(0xf3)]){_0x49ad2e[_0x148871(0xdf)]==='error'&&console[_0x148871(0xe0)](a4_0x3397c1['red'](_0x148871(0x13b)+_0x49ad2e[_0x148871(0x107)]+_0x148871(0xc4)+_0x49ad2e[_0x148871(0x13a)]));}return 0x1;}console['log']();const _0x652d15=getLLMProjectUrl(_0x377350,_0x246c8f['newProjectId']);return console['log'](_0x148871(0xbb)+a4_0x3397c1[_0x148871(0xeb)](_0x652d15)),0x0;}}export class AgentPushCommand extends BaseCommand{['name']=a4_0x40b9c1(0x100);[a4_0x40b9c1(0xc6)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async['execute'](_0x5a7a9){const _0x587577=a4_0x40b9c1,{options:_0x22377f,args:_0x27ed13,tdx:_0x47c3d5}=_0x5a7a9;let _0x549d1e=_0x27ed13[0x0]||process[_0x587577(0x106)]();const _0x34d4fa=_0x22377f[_0x587577(0x154)],_0x468dc3=_0x22377f[_0x587577(0xe5)],_0x46a4de=_0x22377f[_0x587577(0x133)],_0x30f4ce=_0x22377f[_0x587577(0xb8)],_0x1e930d=a4_0x2d596d[_0x587577(0xcd)](_0x549d1e,_0x587577(0xa7)),_0x25642a=existsSync(_0x1e930d);if(_0x25642a){const {data:_0x5035a1}=await withSpinner(_0x587577(0xb6)+_0x549d1e+_0x587577(0x10d),()=>_0x47c3d5[_0x587577(0xd4)][_0x587577(0x111)](_0x549d1e,{'dryRun':_0x34d4fa,'force':_0x468dc3}));if(_0x34d4fa)return console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0x137)](_0x587577(0xbd))),console['log'](_0x587577(0x15b)+_0x5035a1[_0x587577(0x12d)]),0x0;if(_0x5035a1[_0x587577(0xdf)]==='error')return console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0xcf)](_0x587577(0xbf)+_0x5035a1[_0x587577(0x13a)])),0x1;console['log'](a4_0x3397c1[_0x587577(0xb9)]('Agent\x20'+_0x5035a1[_0x587577(0xdf)]+_0x587577(0x13e))),console['log'](_0x587577(0x109)+_0x5035a1[_0x587577(0x12d)]);if(_0x5035a1['agentId']&&_0x5035a1[_0x587577(0xa4)]){const _0x48190d=getLLMAgentChatUrl(_0x30f4ce,_0x5035a1['projectId'],_0x5035a1[_0x587577(0x119)]);console[_0x587577(0xe0)]('Chat:\x20'+a4_0x3397c1[_0x587577(0xeb)](_0x48190d));}return 0x0;}const _0x8187c1=_0x22377f['llmProject'],_0x126b81=resolveProjectFromContext(_0x549d1e,_0x8187c1);if(_0x126b81[_0x587577(0x13f)])_0x549d1e=_0x126b81['projectDir'],_0x126b81[_0x587577(0x160)]===_0x587577(0x142)&&console['log'](a4_0x3397c1[_0x587577(0xfa)](_0x587577(0xb0)+_0x549d1e));else{let _0xda14b0=_0x587577(0x145);_0x126b81[_0x587577(0xd3)]==='no_local_folder'&&(_0xda14b0=_0x126b81[_0x587577(0x14d)]+_0x587577(0xd8)+_0x126b81[_0x587577(0xc8)]+_0x587577(0x151));throw new SDKError(ErrorCode[_0x587577(0x15c)],_0x126b81['reason']===_0x587577(0xda)?_0x126b81[_0x587577(0x14d)]:_0x587577(0xdd)+_0x549d1e,undefined,{'helpText':_0xda14b0});}const {data:_0x4a4d86}=await withSpinner(_0x587577(0x159),()=>_0x47c3d5[_0x587577(0xd4)][_0x587577(0x14f)](_0x549d1e,{'dryRun':!![]})),_0xd20d07=_0x4a4d86['counts'][_0x587577(0x148)]['errors']>0x0;if(_0xd20d07){console['log'](a4_0x3397c1[_0x587577(0xcf)](_0x587577(0x128)));for(const _0x43be70 of _0x4a4d86['agents']){_0x43be70[_0x587577(0xdf)]===_0x587577(0x13a)&&console[_0x587577(0xe0)](a4_0x3397c1['red'](_0x587577(0xc0)+_0x43be70[_0x587577(0x12d)]+_0x587577(0xc4)+_0x43be70[_0x587577(0x13a)]));}return 0x1;}const _0x499033=_0x4a4d86['counts']['agents'][_0x587577(0x102)]+_0x4a4d86['counts'][_0x587577(0xff)]['created']+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf6)][_0x587577(0x102)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xe6)][_0x587577(0x102)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0x161)][_0x587577(0x102)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0x138)][_0x587577(0x102)]+_0x4a4d86[_0x587577(0xaa)]['experimentalArtifacts'][_0x587577(0x102)],_0x57f4c4=_0x4a4d86['counts'][_0x587577(0x148)][_0x587577(0x112)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xff)][_0x587577(0x112)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf6)][_0x587577(0x112)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xe6)][_0x587577(0x112)]+_0x4a4d86['counts'][_0x587577(0x161)][_0x587577(0x112)]+_0x4a4d86[_0x587577(0xaa)]['experimentalKnowledgeBases'][_0x587577(0x112)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf3)][_0x587577(0x112)],_0x249252=_0x4a4d86[_0x587577(0xaa)][_0x587577(0x148)][_0x587577(0x13d)]+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xff)]['unchanged']+_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf6)]['unchanged']+_0x4a4d86[_0x587577(0xaa)]['prompts'][_0x587577(0x13d)]+_0x4a4d86['counts']['integrations']['unchanged']+_0x4a4d86[_0x587577(0xaa)]['experimentalKnowledgeBases'][_0x587577(0x13d)]+_0x4a4d86[_0x587577(0xaa)]['experimentalArtifacts'][_0x587577(0x13d)];console[_0x587577(0xe0)](_0x587577(0xe1)+_0x4a4d86[_0x587577(0x14c)]+'\x27:'),console[_0x587577(0xe0)]('\x20\x20'+a4_0x3397c1[_0x587577(0xb9)]('+\x20'+_0x499033+_0x587577(0xf9))+'\x20|\x20'+a4_0x3397c1[_0x587577(0x137)]('~\x20'+_0x57f4c4+_0x587577(0x136))+_0x587577(0xa8)+a4_0x3397c1['dim']('=\x20'+_0x249252+_0x587577(0x11c))),console[_0x587577(0xe0)](_0x587577(0xae)+formatCountSummary(_0x4a4d86['counts'][_0x587577(0x148)])),console[_0x587577(0xe0)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x4a4d86[_0x587577(0xaa)][_0x587577(0xff)])),console['log'](_0x587577(0xdc)+formatCountSummary(_0x4a4d86['counts'][_0x587577(0xf6)])),console[_0x587577(0xe0)](_0x587577(0x125)+formatCountSummary(_0x4a4d86[_0x587577(0xaa)][_0x587577(0xe6)])),console[_0x587577(0xe0)]('\x20\x20Integrations:\x20'+formatCountSummary(_0x4a4d86[_0x587577(0xaa)]['integrations']));const _0x4620a4=_0x4a4d86['counts'][_0x587577(0x138)]['created']>0x0||_0x4a4d86[_0x587577(0xaa)][_0x587577(0x138)]['updated']>0x0||_0x4a4d86[_0x587577(0xaa)][_0x587577(0x138)][_0x587577(0x13d)]>0x0||_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf3)]['created']>0x0||_0x4a4d86[_0x587577(0xaa)]['experimentalArtifacts'][_0x587577(0x112)]>0x0||_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf3)][_0x587577(0x13d)]>0x0;_0x4620a4&&(console['log'](_0x587577(0x143)+formatCountSummary(_0x4a4d86[_0x587577(0xaa)][_0x587577(0x138)])),console['log'](_0x587577(0x124)+formatCountSummary(_0x4a4d86[_0x587577(0xaa)][_0x587577(0xf3)])));console[_0x587577(0xe0)](_0x587577(0x156)+a4_0x3397c1[_0x587577(0xeb)](_0x549d1e)),displayDiffs(_0x4a4d86['agents'],_0x4a4d86['knowledgeBases'],_0x4a4d86[_0x587577(0xf6)],_0x4a4d86['prompts'],_0x4a4d86[_0x587577(0x161)],_0x4a4d86[_0x587577(0x138)],_0x4a4d86[_0x587577(0xf3)]);if(_0x34d4fa)return console['log'](a4_0x3397c1[_0x587577(0x137)](_0x587577(0xfb))),0x0;if(_0x499033===0x0&&_0x57f4c4===0x0){console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0xb9)](_0x587577(0x15d)));const _0xe2a728=getLLMProjectUrl(_0x30f4ce,_0x4a4d86[_0x587577(0xa4)]);return console[_0x587577(0xe0)](_0x587577(0xbb)+a4_0x3397c1[_0x587577(0xeb)](_0xe2a728)),0x0;}if(!_0x46a4de&&!_0x468dc3){if(!isInteractive())return console[_0x587577(0x13a)](a4_0x3397c1[_0x587577(0xcf)](_0x587577(0xee)),_0x587577(0x113)),console[_0x587577(0x13a)](a4_0x3397c1[_0x587577(0xfa)](_0x587577(0x149))),0x1;const _0x342eb6=await confirmKey(_0x587577(0x11b)+(_0x499033+_0x57f4c4)+_0x587577(0x131));if(!_0x342eb6)return console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0x137)]('Cancelled'),'-\x20nothing\x20pushed'),0x1;}const {data:_0x17345f}=await withSpinner(_0x587577(0xfc),()=>_0x47c3d5[_0x587577(0xd4)][_0x587577(0x14f)](_0x549d1e,{'force':_0x468dc3})),_0x3d8242=_0x17345f[_0x587577(0xaa)][_0x587577(0x148)][_0x587577(0xb4)]>0x0||_0x17345f[_0x587577(0xaa)]['knowledgeBases'][_0x587577(0xb4)]>0x0||_0x17345f['counts']['textKnowledgeBases'][_0x587577(0xb4)]>0x0||_0x17345f[_0x587577(0xaa)][_0x587577(0xe6)]['errors']>0x0;if(_0x3d8242){console['log'](a4_0x3397c1[_0x587577(0x137)]('\x0aProject\x20pushed\x20with\x20errors')),console['log'](),console[_0x587577(0xe0)](a4_0x3397c1['red'](_0x587577(0xaf)));for(const _0x2fe4f1 of _0x17345f[_0x587577(0x148)]){_0x2fe4f1[_0x587577(0xdf)]===_0x587577(0x13a)&&console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0xcf)]('\x20\x20Agent\x20\x22'+_0x2fe4f1[_0x587577(0x12d)]+_0x587577(0xc4)+_0x2fe4f1[_0x587577(0x13a)]));}for(const _0x3d7dc8 of _0x17345f['knowledgeBases']){_0x3d7dc8['action']===_0x587577(0x13a)&&console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0xcf)](_0x587577(0xb2)+_0x3d7dc8[_0x587577(0x107)]+'\x22:\x20'+_0x3d7dc8['error']));}for(const _0x3fdcfb of _0x17345f[_0x587577(0xf6)]){_0x3fdcfb[_0x587577(0xdf)]==='error'&&console['log'](a4_0x3397c1[_0x587577(0xcf)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x3fdcfb[_0x587577(0x107)]+_0x587577(0xc4)+_0x3fdcfb[_0x587577(0x13a)]));}for(const _0x492798 of _0x17345f['prompts']){_0x492798[_0x587577(0xdf)]===_0x587577(0x13a)&&console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0xcf)](_0x587577(0xe8)+_0x492798[_0x587577(0x107)]+_0x587577(0xc4)+_0x492798[_0x587577(0x13a)]));}for(const _0x55903b of _0x17345f['integrations']){_0x55903b[_0x587577(0xdf)]===_0x587577(0x13a)&&console[_0x587577(0xe0)](a4_0x3397c1[_0x587577(0xcf)](_0x587577(0x11e)+_0x55903b[_0x587577(0x107)]+_0x587577(0xc4)+_0x55903b[_0x587577(0x13a)]));}return 0x1;}console[_0x587577(0xe0)](a4_0x3397c1['green'](_0x587577(0x139)+(_0x499033+_0x57f4c4)+'\x20resources\x20to\x20\x27'+_0x17345f[_0x587577(0x14c)]+'\x27'));const _0x122637=getLLMProjectUrl(_0x30f4ce,_0x17345f[_0x587577(0xa4)]);return console[_0x587577(0xe0)](_0x587577(0xbb)+a4_0x3397c1['cyan'](_0x122637)),0x0;}}
@@ -1 +1 @@
1
- function a5_0x2ec1(_0x590f35,_0x1867a1){_0x590f35=_0x590f35-0x1c8;const _0x2bf96d=a5_0x2bf9();let _0x2ec186=_0x2bf96d[_0x590f35];return _0x2ec186;}const a5_0x5166cf=a5_0x2ec1;(function(_0x323bf6,_0x2346c3){const _0xf6572f=a5_0x2ec1,_0x64b20d=_0x323bf6();while(!![]){try{const _0x546613=parseInt(_0xf6572f(0x22e))/0x1+parseInt(_0xf6572f(0x24c))/0x2*(parseInt(_0xf6572f(0x25e))/0x3)+-parseInt(_0xf6572f(0x206))/0x4+-parseInt(_0xf6572f(0x1f2))/0x5*(parseInt(_0xf6572f(0x237))/0x6)+parseInt(_0xf6572f(0x23d))/0x7+-parseInt(_0xf6572f(0x1e7))/0x8+-parseInt(_0xf6572f(0x20f))/0x9*(parseInt(_0xf6572f(0x259))/0xa);if(_0x546613===_0x2346c3)break;else _0x64b20d['push'](_0x64b20d['shift']());}catch(_0x36b3c3){_0x64b20d['push'](_0x64b20d['shift']());}}}(a5_0x2bf9,0x64b61));import*as a5_0x1ace68 from'node:fs';function a5_0x2bf9(){const _0x9c0a50=['dim','944672DzrPau','no_context','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','\x20(cached)','...\x20','projectDir','split','FAIL','\x20\x20Conversation:\x20','repeat','Errors:\x20\x20\x20','Total:\x20\x20\x20\x20','has','282580ppjURc','verbose','add','\x20\x20Site:\x20','now','3SdBVRu','No\x20tests\x20have\x20tags\x20defined.','description','rounds','red','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','Re-evaluating...','Re-evaluating\x20cached\x20test\x20run...','trim','writeFileSync','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','✗\x20FAIL:\x20','executeReeval','push','llmProject','projectName','execute','\x20\x20Evaluating...\x20','tests','⚠\x20SKIPPED:\x20','llm','stop','testName','✗\x20ERROR:\x20Project\x20not\x20found:\x20','jsonl','existsSync','eval','log','round','site','Usage:','toISOString','1541880ZwVwKW','forEach','no_tests','Re-evaluation\x20Summary','Test\x20Summary','✓\x20PASS:\x20','table','\x20-\x20','size','Round\x201/','Passed:\x20\x20\x20','317570szCfdx','source','Error\x20writing\x20output\x20file:\x20','reason','Either\x20switch\x20to\x20the\x20\x22','basename','Re-evaluating\x20','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','Run\x20tests\x20for\x20an\x20LLM\x20agent','Cached\x20run\x20is\x20from\x20site\x20\x22','\x20(new)','agent:test','filter','includes','cyan','\x20\x20Project:\x20','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','\x20\x20Round\x20','output','Running:\x20','29928OfUzKw','\x22:\x20','json','tsv','\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','ERROR','Tests\x20found:\x20','\x20\x20-\x20','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','153WaUEVh','\x27\x20to\x20create\x20the\x20folder\x20structure.','toLowerCase','Conversation\x20URL:\x20','find','Running\x20agent\x20tests...','✗\x20ERROR:\x20','Evaluating\x20response...','conversation_url','PASS','message','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','green','resolveProjectId','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','agentDirs','map','Error:\x20No\x20previous\x20test\x20run\x20found.','reeval','start','found','agentName','Duration:\x20','timestamp','...','\x22,\x20but\x20current\x20site\x20is\x20\x22','length','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','status','utf-8','757152GjrqFd','dryRun','white','Output\x20written\x20to:\x20','resolve','Failed:\x20\x20\x20','Running\x20test:\x20','test.yml','Agent:\x20','24CYFlxD','substring','yellow','Test\x20',':\x20Sending\x20user\x20input...','name','823788VmjIGt','404','No\x20tests\x20found\x20with\x20tags:\x20','conversations','Failed\x20Tests:','Run\x20\x27tdx\x20agent\x20pull\x20','Available\x20tests:\x20','tags','agent','text','join','Test\x20Configuration:','Available\x20tags:\x20','resolveAgentId'];a5_0x2bf9=function(){return _0x9c0a50;};return a5_0x2bf9();}import*as a5_0x503231 from'node:path';import a5_0x572ef7 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x5166cf(0x23c)]=a5_0x5166cf(0x1fd);[a5_0x5166cf(0x1c9)]=a5_0x5166cf(0x1fa);async[a5_0x5166cf(0x1d7)](_0x225a38){const _0x56d81e=a5_0x5166cf,{options:_0x1937be,args:_0xc50313,tdx:_0x30d74d}=_0x225a38,_0x2229b9=_0xc50313[0x0]||'.',_0x1e3668=_0x1937be[_0x56d81e(0x22f)],_0x53742f=_0x1937be,_0x45f30e=_0x53742f[_0x56d81e(0x1e1)]===![],_0x83b535=_0x53742f[_0x56d81e(0x221)],_0x3e2a9d=_0x53742f[_0x56d81e(0x23c)],_0x2a4dc1=_0x53742f['tags'],_0x37fa51=_0x1937be[_0x56d81e(0x1e4)],_0x359e31=_0x53742f[_0x56d81e(0x204)];if(_0x83b535&&_0x45f30e)return console['log'](a5_0x572ef7[_0x56d81e(0x1cb)](_0x56d81e(0x1cc))),0x1;let _0x157dfd=_0x56d81e(0x1ed);if(_0x53742f[_0x56d81e(0x208)])_0x157dfd='json';else{if(_0x53742f[_0x56d81e(0x1df)])_0x157dfd=_0x56d81e(0x1df);else{if(_0x53742f[_0x56d81e(0x209)])_0x157dfd=_0x56d81e(0x209);else{if(_0x53742f[_0x56d81e(0x1ed)])_0x157dfd=_0x56d81e(0x1ed);}}}const _0x2659dc=_0x53742f['llmProject'];let _0x5c0881=_0x2229b9;const _0x178545=a5_0x1ace68[_0x56d81e(0x1e0)](_0x2229b9),_0x23e853=_0x2229b9==='.';if(!_0x178545||_0x23e853){const _0x23c84b=resolveProjectFromContext(_0x2229b9,_0x2659dc,{'requireFile':_0x56d81e(0x235)});if(_0x23c84b[_0x56d81e(0x223)])_0x5c0881=_0x23c84b[_0x56d81e(0x251)],_0x23c84b[_0x56d81e(0x1f3)]==='context'&&console['log'](a5_0x572ef7['dim']('Using\x20agent:\x20'+_0x5c0881));else switch(_0x23c84b[_0x56d81e(0x1f5)]){case _0x56d81e(0x24d):console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x239)](_0x23c84b[_0x56d81e(0x219)])),console[_0x56d81e(0x1e2)](),console[_0x56d81e(0x1e2)](_0x56d81e(0x1e5)),console['log'](_0x56d81e(0x20a)),console[_0x56d81e(0x1e2)]('\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)'),console[_0x56d81e(0x1e2)](),console[_0x56d81e(0x1e2)]('Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>');return 0x1;case'no_local_folder':console['log'](a5_0x572ef7['yellow'](_0x23c84b[_0x56d81e(0x219)])),console['log'](),console[_0x56d81e(0x1e2)](_0x56d81e(0x242)+_0x23c84b['llmProject']+_0x56d81e(0x210));return 0x1;case'multiple_agents':{const _0x573d57=a5_0x503231[_0x56d81e(0x1f7)](_0x23c84b[_0x56d81e(0x251)]);console['log'](a5_0x572ef7['yellow'](_0x56d81e(0x1f9)+_0x23c84b[_0x56d81e(0x1d5)]+'\x22:'));for(const _0x1b1766 of _0x23c84b[_0x56d81e(0x21e)]){console[_0x56d81e(0x1e2)](_0x56d81e(0x20d)+_0x1b1766);}return console[_0x56d81e(0x1e2)](),console[_0x56d81e(0x1e2)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x573d57+'/<agent-name>'),0x1;}case _0x56d81e(0x1e9):console[_0x56d81e(0x1e2)](a5_0x572ef7['yellow']('No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22'+_0x23c84b[_0x56d81e(0x1d5)]+'\x22.')),console['log'](a5_0x572ef7[_0x56d81e(0x24b)]('Project\x20path:\x20'+_0x23c84b[_0x56d81e(0x251)])),console['log'](),console['log'](_0x56d81e(0x1d1));return 0x1;}}const {definition:_0x3bdb36,agentInfo:_0x317a57}=parseTestFile(_0x5c0881);let _0x4b68e2=_0x3bdb36[_0x56d81e(0x1d9)];if(_0x3e2a9d){const _0x2c7c5d=_0x3e2a9d[_0x56d81e(0x252)](',')['map'](_0x14f327=>_0x14f327[_0x56d81e(0x1cf)]());_0x4b68e2=_0x3bdb36[_0x56d81e(0x1d9)]['filter'](_0x5adfce=>_0x2c7c5d['includes'](_0x5adfce['name']));if(_0x4b68e2[_0x56d81e(0x229)]===0x0)return console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x239)]('No\x20tests\x20found\x20matching:\x20'+_0x3e2a9d)),console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x24b)](_0x56d81e(0x243)+_0x3bdb36[_0x56d81e(0x1d9)][_0x56d81e(0x21f)](_0xa3a273=>_0xa3a273['name'])[_0x56d81e(0x247)](',\x20'))),0x1;}if(_0x2a4dc1){const _0x56ae61=_0x2a4dc1[_0x56d81e(0x252)](',')[_0x56d81e(0x21f)](_0x432572=>_0x432572[_0x56d81e(0x1cf)]()[_0x56d81e(0x211)]());_0x4b68e2=_0x4b68e2[_0x56d81e(0x1fe)](_0x15882d=>_0x15882d['tags']?.['some'](_0x5b1c56=>_0x56ae61[_0x56d81e(0x1ff)](_0x5b1c56[_0x56d81e(0x211)]())));if(_0x4b68e2[_0x56d81e(0x229)]===0x0){console['log'](a5_0x572ef7['yellow'](_0x56d81e(0x23f)+_0x2a4dc1));const _0x3e29ac=new Set();return _0x3bdb36[_0x56d81e(0x1d9)]['forEach'](_0x4e8176=>_0x4e8176[_0x56d81e(0x244)]?.[_0x56d81e(0x1e8)](_0x2096ea=>_0x3e29ac[_0x56d81e(0x25b)](_0x2096ea))),_0x3e29ac[_0x56d81e(0x1ef)]>0x0?console['log'](a5_0x572ef7[_0x56d81e(0x24b)](_0x56d81e(0x249)+[..._0x3e29ac][_0x56d81e(0x247)](',\x20'))):console['log'](a5_0x572ef7[_0x56d81e(0x24b)](_0x56d81e(0x1c8))),0x1;}}if(_0x83b535)return this['executeReeval'](_0x225a38,{'definition':{'tests':_0x4b68e2},'agentInfo':_0x317a57,'outputFormat':_0x157dfd,'outputFile':_0x359e31,'testNames':_0x3e2a9d});if(_0x1e3668){console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x200)](_0x56d81e(0x248))),console[_0x56d81e(0x1e2)](_0x56d81e(0x25c)+a5_0x572ef7[_0x56d81e(0x230)](_0x37fa51)),console[_0x56d81e(0x1e2)](_0x56d81e(0x201)+a5_0x572ef7[_0x56d81e(0x230)](_0x317a57[_0x56d81e(0x1d6)])),console[_0x56d81e(0x1e2)]('\x20\x20Agent:\x20'+a5_0x572ef7[_0x56d81e(0x230)](_0x317a57[_0x56d81e(0x224)])),console['log'](),console[_0x56d81e(0x1e2)](_0x56d81e(0x20c)+a5_0x572ef7[_0x56d81e(0x230)](_0x4b68e2[_0x56d81e(0x229)]));for(let _0x525316=0x0;_0x525316<_0x4b68e2[_0x56d81e(0x229)];_0x525316++){const _0x15e133=_0x4b68e2[_0x525316],_0x477534=_0x15e133[_0x56d81e(0x1ca)]['length']===0x1?_0x56d81e(0x1e3):_0x56d81e(0x1ca),_0x1f9867=_0x15e133[_0x56d81e(0x244)]?.['length']?'\x20['+_0x15e133[_0x56d81e(0x244)][_0x56d81e(0x247)](',\x20')+']':'';console[_0x56d81e(0x1e2)]('\x20\x20'+(_0x525316+0x1)+'.\x20'+a5_0x572ef7[_0x56d81e(0x230)](_0x15e133[_0x56d81e(0x23c)])+'\x20('+_0x15e133[_0x56d81e(0x1ca)][_0x56d81e(0x229)]+'\x20'+_0x477534+')'+a5_0x572ef7['dim'](_0x1f9867));}return 0x0;}let _0x569fb4,_0x54c2c5;try{_0x569fb4=await _0x30d74d[_0x56d81e(0x1db)][_0x56d81e(0x21c)](_0x317a57['projectName']);}catch(_0x55c09e){const _0x267575=_0x55c09e instanceof Error?_0x55c09e[_0x56d81e(0x219)]:String(_0x55c09e);return _0x267575[_0x56d81e(0x1ff)](_0x56d81e(0x23e))||_0x267575[_0x56d81e(0x211)]()[_0x56d81e(0x1ff)]('not\x20found')?console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x1cb)](_0x56d81e(0x1de)+_0x317a57['projectName'])):console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x1cb)](_0x56d81e(0x21a)+_0x317a57[_0x56d81e(0x1d6)]+_0x56d81e(0x207)+_0x267575)),0x1;}try{_0x54c2c5=await _0x30d74d[_0x56d81e(0x1db)][_0x56d81e(0x24a)](_0x317a57[_0x56d81e(0x224)],_0x569fb4);}catch(_0x2be61e){const _0x2de758=_0x2be61e instanceof Error?_0x2be61e['message']:String(_0x2be61e);return _0x2de758[_0x56d81e(0x1ff)]('404')||_0x2de758[_0x56d81e(0x211)]()['includes']('not\x20found')?console['log'](a5_0x572ef7['red'](_0x56d81e(0x20e)+_0x317a57[_0x56d81e(0x224)])):console['log'](a5_0x572ef7[_0x56d81e(0x1cb)]('✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22'+_0x317a57['agentName']+_0x56d81e(0x207)+_0x2de758)),0x1;}let _0x599f5b;if(!_0x45f30e)try{_0x599f5b=await setupEvaluatorAgent(_0x30d74d[_0x56d81e(0x1db)],_0x1937be[_0x56d81e(0x25a)]);}catch(_0x50dab9){const _0x339bf5=_0x50dab9 instanceof Error?_0x50dab9[_0x56d81e(0x219)]:String(_0x50dab9);return console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x1cb)](_0x56d81e(0x22b)+_0x339bf5)),0x1;}console['log'](a5_0x572ef7[_0x56d81e(0x200)](_0x56d81e(0x214))),console[_0x56d81e(0x1e2)]('Site:\x20'+a5_0x572ef7[_0x56d81e(0x230)](_0x37fa51)),console['log']('Agent:\x20'+a5_0x572ef7[_0x56d81e(0x230)](_0x317a57['projectName']+'/'+_0x317a57[_0x56d81e(0x224)])),console[_0x56d81e(0x1e2)]();const _0x216035=[],_0x3d0c8e=[],_0x5dfa2f=Date[_0x56d81e(0x25d)]();for(let _0x1fb083=0x0;_0x1fb083<_0x4b68e2[_0x56d81e(0x229)];_0x1fb083++){const _0x563dbf=_0x4b68e2[_0x1fb083];_0x4b68e2[_0x56d81e(0x229)]>0x1?console[_0x56d81e(0x1e2)](_0x56d81e(0x23a)+(_0x1fb083+0x1)+'/'+_0x4b68e2['length']+':\x20'+a5_0x572ef7['white'](_0x563dbf[_0x56d81e(0x23c)])):console[_0x56d81e(0x1e2)](_0x56d81e(0x234)+a5_0x572ef7['white'](_0x563dbf[_0x56d81e(0x23c)]));const _0x2be5c0=createCommandSpinner(_0x56d81e(0x1f0)+_0x563dbf[_0x56d81e(0x1ca)][_0x56d81e(0x229)]+_0x56d81e(0x23b));_0x2be5c0['start']();try{const {result:_0x3dc2f2,conversation:_0x2b82d6}=await runTest(_0x30d74d[_0x56d81e(0x1db)],_0x563dbf,{'agentId':_0x54c2c5,'projectId':_0x569fb4,'site':_0x37fa51,'noEval':_0x45f30e,'evaluatorId':_0x599f5b,'onRoundStart':(_0xf708c,_0x30410c)=>{const _0x5ba669=_0x56d81e;_0x2be5c0[_0x5ba669(0x246)]='Round\x20'+(_0xf708c+0x1)+'/'+_0x30410c+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x1d9e31,_0xfb55b5,_0x1a5526)=>{const _0x36c412=_0x56d81e,_0x1499f6=formatElapsed(_0xfb55b5);_0x1a5526?console[_0x36c412(0x1e2)](_0x36c412(0x203)+(_0x1d9e31+0x1)+'/'+_0x563dbf[_0x36c412(0x1ca)][_0x36c412(0x229)]+_0x36c412(0x250)+a5_0x572ef7[_0x36c412(0x21b)]('✓')+'\x20('+_0x1499f6+')'):console[_0x36c412(0x1e2)](_0x36c412(0x203)+(_0x1d9e31+0x1)+'/'+_0x563dbf['rounds']['length']+_0x36c412(0x250)+a5_0x572ef7[_0x36c412(0x1cb)]('✗'));},'onEvaluationStart':()=>{const _0x5d02f9=_0x56d81e;_0x2be5c0[_0x5d02f9(0x246)]=_0x5d02f9(0x216);},'onEvaluationComplete':_0x4ee199=>{const _0xea1cec=_0x56d81e,_0x26d88b=formatElapsed(_0x4ee199);console[_0xea1cec(0x1e2)](_0xea1cec(0x1d8)+a5_0x572ef7[_0xea1cec(0x21b)]('✓')+'\x20('+_0x26d88b+')');}});_0x2be5c0[_0x56d81e(0x1dc)](),_0x216035[_0x56d81e(0x1d4)](_0x3dc2f2),_0x3d0c8e[_0x56d81e(0x1d4)](_0x2b82d6);if(_0x3dc2f2[_0x56d81e(0x22c)]===_0x56d81e(0x218))console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x21b)](_0x56d81e(0x1ec)+_0x3dc2f2[_0x56d81e(0x1f5)]));else _0x3dc2f2[_0x56d81e(0x22c)]===_0x56d81e(0x253)?console['log'](a5_0x572ef7[_0x56d81e(0x1cb)](_0x56d81e(0x1d2)+_0x3dc2f2['reason'])):console['log'](a5_0x572ef7['red'](_0x56d81e(0x215)+_0x3dc2f2['reason']));_0x3dc2f2['conversation_url']&&console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x24b)](_0x56d81e(0x212)+_0x3dc2f2[_0x56d81e(0x217)])),console[_0x56d81e(0x1e2)]();}catch(_0x24d4fa){_0x2be5c0[_0x56d81e(0x1dc)]();const _0x537faf=_0x24d4fa instanceof Error?_0x24d4fa[_0x56d81e(0x219)]:String(_0x24d4fa);console[_0x56d81e(0x1e2)](a5_0x572ef7['red'](_0x56d81e(0x215)+_0x537faf)),console[_0x56d81e(0x1e2)](),_0x216035['push']({'name':_0x563dbf[_0x56d81e(0x23c)],'status':_0x56d81e(0x20b),'reason':_0x537faf,'timestamp':new Date()[_0x56d81e(0x1e6)](),'duration_ms':0x0});}}const _0x30d87f=Date[_0x56d81e(0x25d)]()-_0x5dfa2f,_0x29d53b=_0x216035['filter'](_0x5865a7=>_0x5865a7[_0x56d81e(0x22c)]===_0x56d81e(0x218))['length'],_0x325719=_0x216035[_0x56d81e(0x1fe)](_0x12ca0a=>_0x12ca0a[_0x56d81e(0x22c)]==='FAIL')[_0x56d81e(0x229)],_0x12b714=_0x216035['filter'](_0x104fbc=>_0x104fbc[_0x56d81e(0x22c)]===_0x56d81e(0x20b))['length'];console[_0x56d81e(0x1e2)]('━'['repeat'](0x3c)),console[_0x56d81e(0x1e2)](_0x56d81e(0x1eb)),console[_0x56d81e(0x1e2)]('━'[_0x56d81e(0x255)](0x3c)),console[_0x56d81e(0x1e2)](_0x56d81e(0x257)+_0x216035[_0x56d81e(0x229)]),console['log'](_0x56d81e(0x1f1)+a5_0x572ef7[_0x56d81e(0x21b)](_0x29d53b)),console[_0x56d81e(0x1e2)](_0x56d81e(0x233)+a5_0x572ef7[_0x56d81e(0x1cb)](_0x325719));_0x12b714>0x0&&console[_0x56d81e(0x1e2)](_0x56d81e(0x256)+a5_0x572ef7[_0x56d81e(0x1cb)](_0x12b714));console[_0x56d81e(0x1e2)](_0x56d81e(0x225)+formatElapsed(_0x30d87f)),console[_0x56d81e(0x1e2)]('━'[_0x56d81e(0x255)](0x3c));const _0x11400d=_0x216035['filter'](_0x1cad3e=>_0x1cad3e['status']!=='PASS');if(_0x11400d[_0x56d81e(0x229)]>0x0){console[_0x56d81e(0x1e2)](),console[_0x56d81e(0x1e2)](_0x56d81e(0x241));for(const _0x29ae05 of _0x11400d){const _0x1107ad=a5_0x572ef7['red']('✗'),_0x1b8a97=_0x29ae05[_0x56d81e(0x1f5)][_0x56d81e(0x229)]>0x32?_0x29ae05['reason'][_0x56d81e(0x238)](0x0,0x32)+_0x56d81e(0x227):_0x29ae05['reason'];console['log']('\x20\x20'+_0x1107ad+'\x20'+_0x29ae05[_0x56d81e(0x23c)]+':\x20'+_0x1b8a97);}}const _0x1962f9={'summary':{'total':_0x216035['length'],'passed':_0x29d53b,'failed':_0x325719,'errors':_0x12b714>0x0?_0x12b714:undefined,'duration_ms':_0x30d87f},'tests':_0x216035,'agent':{'project':_0x317a57[_0x56d81e(0x1d6)],'name':_0x317a57[_0x56d81e(0x224)],'site':_0x37fa51},'timestamp':new Date(_0x5dfa2f)[_0x56d81e(0x1e6)]()};try{const _0xa95689=buildCachedTestRun(_0x3d0c8e,{'site':_0x37fa51,'projectId':_0x569fb4,'projectName':_0x317a57['projectName'],'agentId':_0x54c2c5,'agentName':_0x317a57[_0x56d81e(0x224)],'testYmlPath':a5_0x503231[_0x56d81e(0x232)](_0x317a57['testYmlPath'])});saveLastTestRun(_0xa95689);}catch{}if(_0x157dfd!==_0x56d81e(0x1ed)||_0x359e31){const _0x692f7e=formatResults(_0x1962f9,_0x157dfd);if(_0x359e31)try{a5_0x1ace68['writeFileSync'](_0x359e31,_0x692f7e,_0x56d81e(0x22d)),console[_0x56d81e(0x1e2)](),console['log'](a5_0x572ef7[_0x56d81e(0x24b)](_0x56d81e(0x231)+_0x359e31));}catch(_0x40dfe1){return console[_0x56d81e(0x1e2)](),console[_0x56d81e(0x1e2)](a5_0x572ef7[_0x56d81e(0x1cb)](_0x56d81e(0x1f4)+_0x40dfe1)),0x1;}else console[_0x56d81e(0x1e2)](),console[_0x56d81e(0x1e2)](_0x692f7e);}return _0x11400d[_0x56d81e(0x229)]>0x0?0x1:0x0;}async[a5_0x5166cf(0x1d3)](_0x1d191a,_0xa9ca30){const _0x2e8248=a5_0x5166cf,{options:_0x3b26d9,tdx:_0x1ab9f7}=_0x1d191a,{definition:_0x108d19,agentInfo:_0x1d7157,outputFormat:_0x2c7122,outputFile:_0x1d50c3}=_0xa9ca30,_0x2ca14b=_0x3b26d9[_0x2e8248(0x1e4)],_0x3f6370=loadLastTestRun();if(!_0x3f6370)return console['log'](a5_0x572ef7['red'](_0x2e8248(0x220))),console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x24b)]('Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.')),0x1;if(_0x3f6370[_0x2e8248(0x245)][_0x2e8248(0x224)]!==_0x1d7157[_0x2e8248(0x224)])return console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x22a)+_0x3f6370[_0x2e8248(0x245)][_0x2e8248(0x224)]+_0x2e8248(0x24e)+_0x1d7157['agentName']+'\x22.')),console['log'](a5_0x572ef7['dim']('Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.')),0x1;const _0x696bee=new Set(_0x3f6370[_0x2e8248(0x240)]['map'](_0x24d8b1=>_0x24d8b1[_0x2e8248(0x1dd)])),_0x219603=_0x108d19[_0x2e8248(0x1d9)][_0x2e8248(0x1fe)](_0x15b892=>!_0x696bee[_0x2e8248(0x258)](_0x15b892['name']));if(_0x219603[_0x2e8248(0x229)]>0x0&&_0x3f6370[_0x2e8248(0x1e4)]!==_0x2ca14b)return console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x21d))),console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x24b)](_0x2e8248(0x1fb)+_0x3f6370[_0x2e8248(0x1e4)]+_0x2e8248(0x228)+_0x2ca14b+'\x22.')),console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x24b)](_0x2e8248(0x1f6)+_0x3f6370[_0x2e8248(0x1e4)]+_0x2e8248(0x202))),0x1;const _0x56066b=_0x108d19['tests'][_0x2e8248(0x1fe)](_0x2065e7=>_0x696bee[_0x2e8248(0x258)](_0x2065e7['name'])),_0xe996b0=_0x219603;let _0x4b52df;try{_0x4b52df=await setupEvaluatorAgent(_0x1ab9f7[_0x2e8248(0x1db)],_0x3b26d9['verbose']);}catch(_0x7940a9){const _0x3ffa75=_0x7940a9 instanceof Error?_0x7940a9['message']:String(_0x7940a9);return console['log'](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x22b)+_0x3ffa75)),0x1;}console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x200)](_0x2e8248(0x1ce))),console[_0x2e8248(0x1e2)]('Cached\x20run\x20from:\x20'+a5_0x572ef7[_0x2e8248(0x230)](_0x3f6370[_0x2e8248(0x226)])),console[_0x2e8248(0x1e2)](_0x2e8248(0x236)+a5_0x572ef7[_0x2e8248(0x230)](_0x3f6370['agent']['projectName']+'/'+_0x3f6370['agent'][_0x2e8248(0x224)]));_0xe996b0[_0x2e8248(0x229)]>0x0&&console['log']('New\x20tests\x20to\x20execute:\x20'+a5_0x572ef7['yellow'](_0xe996b0[_0x2e8248(0x229)]));console[_0x2e8248(0x1e2)]();const _0x4e5d8c=[],_0x456659=Date[_0x2e8248(0x25d)](),_0x577013=createCommandSpinner(_0x2e8248(0x1cd));if(_0x56066b[_0x2e8248(0x229)]>0x0)try{const _0x339388=await reevaluateFromCache(_0x1ab9f7[_0x2e8248(0x1db)],_0x3f6370,{'tests':_0x56066b},{'evaluatorId':_0x4b52df,'onTestStart':(_0x57eb70,_0x2bd9a6,_0x439a26)=>{const _0x50c1d2=_0x2e8248;_0x577013[_0x50c1d2(0x246)]=_0x50c1d2(0x1f8)+(_0x2bd9a6+0x1)+'/'+_0x439a26+':\x20'+_0x57eb70+_0x50c1d2(0x227);if(!_0x577013['isSpinning'])_0x577013[_0x50c1d2(0x222)]();},'onTestComplete':(_0xf6ad0a,_0x30dfc6)=>{const _0x5c7426=_0x2e8248;_0x577013['stop']();if(_0x30dfc6[_0x5c7426(0x22c)]==='PASS')console[_0x5c7426(0x1e2)](a5_0x572ef7['green'](_0x5c7426(0x1ec)+_0xf6ad0a)+a5_0x572ef7[_0x5c7426(0x24b)](_0x5c7426(0x24f)));else _0x30dfc6['status']===_0x5c7426(0x253)?console[_0x5c7426(0x1e2)](a5_0x572ef7[_0x5c7426(0x1cb)](_0x5c7426(0x1d2)+_0xf6ad0a+'\x20-\x20'+_0x30dfc6[_0x5c7426(0x1f5)])+a5_0x572ef7[_0x5c7426(0x24b)](_0x5c7426(0x24f))):console[_0x5c7426(0x1e2)](a5_0x572ef7['red'](_0x5c7426(0x215)+_0xf6ad0a+_0x5c7426(0x1ee)+_0x30dfc6[_0x5c7426(0x1f5)]));_0x30dfc6['conversation_url']&&console[_0x5c7426(0x1e2)](a5_0x572ef7['dim']('\x20\x20Conversation:\x20'+_0x30dfc6[_0x5c7426(0x217)])),_0x4e5d8c[_0x5c7426(0x1d4)](_0x30dfc6);},'onTestSkipped':(_0x536bc6,_0x4dc83c)=>{const _0x1a712f=_0x2e8248;_0x577013[_0x1a712f(0x1dc)](),console[_0x1a712f(0x1e2)](a5_0x572ef7[_0x1a712f(0x239)](_0x1a712f(0x1da)+_0x536bc6+_0x1a712f(0x1ee)+_0x4dc83c));}});for(const _0x330866 of _0x339388){!_0x4e5d8c[_0x2e8248(0x213)](_0xa3e517=>_0xa3e517[_0x2e8248(0x23c)]===_0x330866[_0x2e8248(0x23c)])&&_0x4e5d8c[_0x2e8248(0x1d4)](_0x330866);}}catch(_0x21a553){_0x577013[_0x2e8248(0x1dc)]();const _0xf6cb41=_0x21a553 instanceof Error?_0x21a553[_0x2e8248(0x219)]:String(_0x21a553);return console[_0x2e8248(0x1e2)](a5_0x572ef7['red']('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0xf6cb41)),0x1;}_0x577013[_0x2e8248(0x1dc)]();if(_0xe996b0[_0x2e8248(0x229)]>0x0){console[_0x2e8248(0x1e2)](),console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x200)]('Executing\x20new\x20tests...'));const {projectId:_0x1323aa,agentId:_0x4c6604}=_0x3f6370[_0x2e8248(0x245)];for(const _0x2c7dd9 of _0xe996b0){console['log'](_0x2e8248(0x205)+a5_0x572ef7['white'](_0x2c7dd9[_0x2e8248(0x23c)]));const _0x54e52=createCommandSpinner(_0x2e8248(0x1f0)+_0x2c7dd9[_0x2e8248(0x1ca)][_0x2e8248(0x229)]+':\x20Sending\x20user\x20input...');_0x54e52[_0x2e8248(0x222)]();try{const {result:_0x1046cb}=await runTest(_0x1ab9f7[_0x2e8248(0x1db)],_0x2c7dd9,{'agentId':_0x4c6604,'projectId':_0x1323aa,'site':_0x3f6370[_0x2e8248(0x1e4)],'noEval':![],'evaluatorId':_0x4b52df,'onRoundStart':(_0x4d77b2,_0x1edee1)=>{const _0x8b9fb5=_0x2e8248;_0x54e52[_0x8b9fb5(0x246)]='Round\x20'+(_0x4d77b2+0x1)+'/'+_0x1edee1+_0x8b9fb5(0x23b);},'onRoundComplete':(_0x3d1eeb,_0x5197ed,_0x297956)=>{const _0x2d0280=_0x2e8248,_0x3eae14=formatElapsed(_0x5197ed);_0x297956?console['log']('\x20\x20Round\x20'+(_0x3d1eeb+0x1)+'/'+_0x2c7dd9[_0x2d0280(0x1ca)]['length']+'...\x20'+a5_0x572ef7[_0x2d0280(0x21b)]('✓')+'\x20('+_0x3eae14+')'):console[_0x2d0280(0x1e2)]('\x20\x20Round\x20'+(_0x3d1eeb+0x1)+'/'+_0x2c7dd9[_0x2d0280(0x1ca)][_0x2d0280(0x229)]+_0x2d0280(0x250)+a5_0x572ef7[_0x2d0280(0x1cb)]('✗'));},'onEvaluationStart':()=>{const _0x50ec27=_0x2e8248;_0x54e52[_0x50ec27(0x246)]=_0x50ec27(0x216);},'onEvaluationComplete':_0x808845=>{const _0x529564=_0x2e8248,_0x158f3b=formatElapsed(_0x808845);console[_0x529564(0x1e2)](_0x529564(0x1d8)+a5_0x572ef7[_0x529564(0x21b)]('✓')+'\x20('+_0x158f3b+')');}});_0x54e52[_0x2e8248(0x1dc)](),_0x4e5d8c[_0x2e8248(0x1d4)](_0x1046cb);if(_0x1046cb[_0x2e8248(0x22c)]===_0x2e8248(0x218))console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x21b)](_0x2e8248(0x1ec)+_0x1046cb[_0x2e8248(0x1f5)])+a5_0x572ef7['dim']('\x20(new)'));else _0x1046cb[_0x2e8248(0x22c)]==='FAIL'?console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x1d2)+_0x1046cb['reason'])+a5_0x572ef7[_0x2e8248(0x24b)](_0x2e8248(0x1fc))):console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x215)+_0x1046cb[_0x2e8248(0x1f5)]));_0x1046cb[_0x2e8248(0x217)]&&console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x24b)](_0x2e8248(0x254)+_0x1046cb[_0x2e8248(0x217)]));}catch(_0x5cbfc5){_0x54e52[_0x2e8248(0x1dc)]();const _0x5d3a80=_0x5cbfc5 instanceof Error?_0x5cbfc5[_0x2e8248(0x219)]:String(_0x5cbfc5);console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x215)+_0x5d3a80)),_0x4e5d8c[_0x2e8248(0x1d4)]({'name':_0x2c7dd9[_0x2e8248(0x23c)],'status':'ERROR','reason':_0x5d3a80,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}}console[_0x2e8248(0x1e2)]();const _0x4e4aaf=Date['now']()-_0x456659,_0x191209=_0x4e5d8c[_0x2e8248(0x1fe)](_0x290a13=>_0x290a13['status']===_0x2e8248(0x218))[_0x2e8248(0x229)],_0x4af17a=_0x4e5d8c[_0x2e8248(0x1fe)](_0x4e4522=>_0x4e4522['status']===_0x2e8248(0x253))[_0x2e8248(0x229)],_0x366744=_0x4e5d8c['filter'](_0x543414=>_0x543414[_0x2e8248(0x22c)]===_0x2e8248(0x20b))[_0x2e8248(0x229)];console['log']('━'[_0x2e8248(0x255)](0x3c)),console[_0x2e8248(0x1e2)](_0x2e8248(0x1ea)),console['log']('━'[_0x2e8248(0x255)](0x3c)),console[_0x2e8248(0x1e2)]('Total:\x20\x20\x20\x20'+_0x4e5d8c[_0x2e8248(0x229)]),console['log']('Passed:\x20\x20\x20'+a5_0x572ef7[_0x2e8248(0x21b)](_0x191209)),console['log']('Failed:\x20\x20\x20'+a5_0x572ef7['red'](_0x4af17a));_0x366744>0x0&&console[_0x2e8248(0x1e2)](_0x2e8248(0x256)+a5_0x572ef7[_0x2e8248(0x1cb)](_0x366744));console[_0x2e8248(0x1e2)](_0x2e8248(0x225)+formatElapsed(_0x4e4aaf)),console[_0x2e8248(0x1e2)]('━'[_0x2e8248(0x255)](0x3c));const _0x3dad6c={'summary':{'total':_0x4e5d8c['length'],'passed':_0x191209,'failed':_0x4af17a,'errors':_0x366744>0x0?_0x366744:undefined,'duration_ms':_0x4e4aaf},'tests':_0x4e5d8c,'agent':{'project':_0x1d7157[_0x2e8248(0x1d6)],'name':_0x1d7157[_0x2e8248(0x224)],'site':_0x2ca14b},'timestamp':new Date(_0x456659)[_0x2e8248(0x1e6)]()};if(_0x2c7122!==_0x2e8248(0x1ed)||_0x1d50c3){const _0xbcff1c=formatResults(_0x3dad6c,_0x2c7122);if(_0x1d50c3)try{a5_0x1ace68[_0x2e8248(0x1d0)](_0x1d50c3,_0xbcff1c,'utf-8'),console['log'](),console['log'](a5_0x572ef7[_0x2e8248(0x24b)](_0x2e8248(0x231)+_0x1d50c3));}catch(_0x1f462c){return console['log'](),console[_0x2e8248(0x1e2)](a5_0x572ef7[_0x2e8248(0x1cb)](_0x2e8248(0x1f4)+_0x1f462c)),0x1;}else console[_0x2e8248(0x1e2)](),console[_0x2e8248(0x1e2)](_0xbcff1c);}const _0x50a309=_0x4e5d8c[_0x2e8248(0x1fe)](_0x3161f4=>_0x3161f4[_0x2e8248(0x22c)]!==_0x2e8248(0x218));return _0x50a309[_0x2e8248(0x229)]>0x0?0x1:0x0;}}
1
+ function a5_0x202f(_0x212be9,_0x457099){_0x212be9=_0x212be9-0x12e;const _0x5d095b=a5_0x5d09();let _0x202fab=_0x5d095b[_0x212be9];return _0x202fab;}const a5_0xdd547f=a5_0x202f;(function(_0x4f8332,_0x4475fa){const _0x203bb3=a5_0x202f,_0x54dcc2=_0x4f8332();while(!![]){try{const _0xae107a=-parseInt(_0x203bb3(0x19f))/0x1*(-parseInt(_0x203bb3(0x180))/0x2)+-parseInt(_0x203bb3(0x1c4))/0x3+-parseInt(_0x203bb3(0x18f))/0x4+parseInt(_0x203bb3(0x16c))/0x5*(-parseInt(_0x203bb3(0x1a5))/0x6)+-parseInt(_0x203bb3(0x13e))/0x7*(-parseInt(_0x203bb3(0x130))/0x8)+-parseInt(_0x203bb3(0x1bb))/0x9+parseInt(_0x203bb3(0x1c3))/0xa*(parseInt(_0x203bb3(0x1b0))/0xb);if(_0xae107a===_0x4475fa)break;else _0x54dcc2['push'](_0x54dcc2['shift']());}catch(_0x329e73){_0x54dcc2['push'](_0x54dcc2['shift']());}}}(a5_0x5d09,0xde827));import*as a5_0x543ebe from'node:fs';import*as a5_0x12bfc0 from'node:path';import a5_0x52832e 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_0x5d09(){const _0x432149=['Running\x20test:\x20','now','green','Test\x20Summary','PASS','projectDir',':\x20Sending\x20user\x20input...','resolve','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','yellow','...\x20','basename','6239366VHpSPh','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','\x20\x20Site:\x20','✗\x20FAIL:\x20','ERROR','Conversation\x20URL:\x20','Usage:','multiple_agents','Total:\x20\x20\x20\x20','Running:\x20','verbose','add','Re-evaluating...','FAIL','reason','no_context','utf-8','Re-evaluating\x20','round','\x27\x20to\x20create\x20the\x20folder\x20structure.','llmProject','test.yml','dim','Run\x20tests\x20for\x20an\x20LLM\x20agent','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','no_tests','agent','✗\x20ERROR:\x20Project\x20not\x20found:\x20','\x20\x20-\x20','text','not\x20found','conversation_url','Cached\x20run\x20is\x20from\x20site\x20\x22','tsv','substring','\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','Test\x20Configuration:','\x20\x20Project:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','push','Tests\x20found:\x20','description','message','Failed:\x20\x20\x20','Either\x20switch\x20to\x20the\x20\x22','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','4041185ZwHGnA','toISOString','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','resolveAgentId','Errors:\x20\x20\x20','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','Duration:\x20','Failed\x20Tests:','agent:test','writeFileSync','red','forEach','Run\x20\x27tdx\x20agent\x20pull\x20','map','timestamp','reeval','no_local_folder','length','404','source','10DsYkpf','site','Running\x20agent\x20tests...','\x22,\x20but\x20current\x20site\x20is\x20\x22','Error:\x20No\x20previous\x20test\x20run\x20found.','✓\x20PASS:\x20','rounds','agentName','\x20\x20Conversation:\x20','Cached\x20run\x20from:\x20','status','\x20-\x20','start','trim','toLowerCase','3510956bkxTjC','resolveProjectId','\x20(new)','log','executeReeval','tests','...','join','split','some','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','white','New\x20tests\x20to\x20execute:\x20','repeat','json','131523WDJqXl','filter','Test\x20','Evaluating\x20response...','cyan','✗\x20ERROR:\x20','12fISrtP','\x22:\x20','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','table','testYmlPath','Using\x20agent:\x20','Site:\x20','Error\x20writing\x20output\x20file:\x20','stop','\x20\x20Evaluating...\x20','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','115445zTrwwT','Available\x20tests:\x20','find','/<agent-name>','name','tags','Agent:\x20','Round\x201/','found','llm','\x20\x20Round\x20','6698763sgVVJm','Available\x20tags:\x20','context','projectName','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','Passed:\x20\x20\x20','output','1930fJcfZS','947721QVOpRD','jsonl','includes','Output\x20written\x20to:\x20','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','agentDirs','16jQkKjX','Executing\x20new\x20tests...'];a5_0x5d09=function(){return _0x432149;};return a5_0x5d09();}import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0xdd547f(0x1b4)]=a5_0xdd547f(0x174);[a5_0xdd547f(0x167)]=a5_0xdd547f(0x155);async['execute'](_0x27c79c){const _0x36b9c5=a5_0xdd547f,{options:_0x5bbdff,args:_0x15dda7,tdx:_0x56782a}=_0x27c79c,_0x56aebf=_0x15dda7[0x0]||'.',_0x5828f8=_0x5bbdff['dryRun'],_0x1bc3f2=_0x5bbdff,_0x4dc2e7=_0x1bc3f2['eval']===![],_0x2a3b8b=_0x1bc3f2[_0x36b9c5(0x17b)],_0x56e277=_0x1bc3f2[_0x36b9c5(0x1b4)],_0x268662=_0x1bc3f2[_0x36b9c5(0x1b5)],_0x414c84=_0x5bbdff[_0x36b9c5(0x181)],_0x3a60ca=_0x1bc3f2[_0x36b9c5(0x1c2)];if(_0x2a3b8b&&_0x4dc2e7)return console[_0x36b9c5(0x192)](a5_0x52832e['red'](_0x36b9c5(0x16e))),0x1;let _0x797dd4=_0x36b9c5(0x1a8);if(_0x1bc3f2[_0x36b9c5(0x19e)])_0x797dd4=_0x36b9c5(0x19e);else{if(_0x1bc3f2[_0x36b9c5(0x1c5)])_0x797dd4='jsonl';else{if(_0x1bc3f2[_0x36b9c5(0x15f)])_0x797dd4=_0x36b9c5(0x15f);else{if(_0x1bc3f2[_0x36b9c5(0x1a8)])_0x797dd4=_0x36b9c5(0x1a8);}}}const _0x3169cb=_0x1bc3f2['llmProject'];let _0x55adcb=_0x56aebf;const _0x2a8105=a5_0x543ebe['existsSync'](_0x56aebf),_0x4b28cc=_0x56aebf==='.';if(!_0x2a8105||_0x4b28cc){const _0x4ed351=resolveProjectFromContext(_0x56aebf,_0x3169cb,{'requireFile':_0x36b9c5(0x153)});if(_0x4ed351[_0x36b9c5(0x1b8)])_0x55adcb=_0x4ed351[_0x36b9c5(0x137)],_0x4ed351[_0x36b9c5(0x17f)]===_0x36b9c5(0x1bd)&&console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x154)](_0x36b9c5(0x1aa)+_0x55adcb));else switch(_0x4ed351[_0x36b9c5(0x14c)]){case _0x36b9c5(0x14d):console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x13b)](_0x4ed351[_0x36b9c5(0x168)])),console[_0x36b9c5(0x192)](),console[_0x36b9c5(0x192)](_0x36b9c5(0x144)),console[_0x36b9c5(0x192)](_0x36b9c5(0x161)),console[_0x36b9c5(0x192)](_0x36b9c5(0x199)),console[_0x36b9c5(0x192)](),console[_0x36b9c5(0x192)](_0x36b9c5(0x19a));return 0x1;case _0x36b9c5(0x17c):console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x13b)](_0x4ed351[_0x36b9c5(0x168)])),console['log'](),console[_0x36b9c5(0x192)](_0x36b9c5(0x178)+_0x4ed351[_0x36b9c5(0x152)]+_0x36b9c5(0x151));return 0x1;case _0x36b9c5(0x145):{const _0x3cb9d9=a5_0x12bfc0[_0x36b9c5(0x13d)](_0x4ed351[_0x36b9c5(0x137)]);console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x13b)](_0x36b9c5(0x1a7)+_0x4ed351[_0x36b9c5(0x152)]+'\x22:'));for(const _0x252992 of _0x4ed351[_0x36b9c5(0x12f)]){console[_0x36b9c5(0x192)](_0x36b9c5(0x15a)+_0x252992);}return console[_0x36b9c5(0x192)](),console['log'](_0x36b9c5(0x1c0)+_0x3cb9d9+_0x36b9c5(0x1b3)),0x1;}case _0x36b9c5(0x157):console['log'](a5_0x52832e[_0x36b9c5(0x13b)]('No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22'+_0x4ed351['llmProject']+'\x22.')),console[_0x36b9c5(0x192)](a5_0x52832e['dim']('Project\x20path:\x20'+_0x4ed351['projectDir'])),console[_0x36b9c5(0x192)](),console['log']('Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.');return 0x1;}}const {definition:_0x3f462b,agentInfo:_0x466651}=parseTestFile(_0x55adcb);let _0x40d950=_0x3f462b[_0x36b9c5(0x194)];if(_0x56e277){const _0x1510f8=_0x56e277['split'](',')[_0x36b9c5(0x179)](_0x37cf9b=>_0x37cf9b[_0x36b9c5(0x18d)]());_0x40d950=_0x3f462b[_0x36b9c5(0x194)][_0x36b9c5(0x1a0)](_0x2809dc=>_0x1510f8[_0x36b9c5(0x1c6)](_0x2809dc[_0x36b9c5(0x1b4)]));if(_0x40d950[_0x36b9c5(0x17d)]===0x0)return console['log'](a5_0x52832e[_0x36b9c5(0x13b)]('No\x20tests\x20found\x20matching:\x20'+_0x56e277)),console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x154)](_0x36b9c5(0x1b1)+_0x3f462b[_0x36b9c5(0x194)]['map'](_0x3740fc=>_0x3740fc['name'])['join'](',\x20'))),0x1;}if(_0x268662){const _0x16ddcb=_0x268662[_0x36b9c5(0x197)](',')[_0x36b9c5(0x179)](_0x924c46=>_0x924c46[_0x36b9c5(0x18d)]()[_0x36b9c5(0x18e)]());_0x40d950=_0x40d950[_0x36b9c5(0x1a0)](_0x2f33c6=>_0x2f33c6[_0x36b9c5(0x1b5)]?.[_0x36b9c5(0x198)](_0x68d91f=>_0x16ddcb[_0x36b9c5(0x1c6)](_0x68d91f[_0x36b9c5(0x18e)]())));if(_0x40d950['length']===0x0){console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x13b)]('No\x20tests\x20found\x20with\x20tags:\x20'+_0x268662));const _0x27ddea=new Set();return _0x3f462b['tests'][_0x36b9c5(0x177)](_0x4a1ab8=>_0x4a1ab8[_0x36b9c5(0x1b5)]?.[_0x36b9c5(0x177)](_0x299981=>_0x27ddea[_0x36b9c5(0x149)](_0x299981))),_0x27ddea['size']>0x0?console['log'](a5_0x52832e[_0x36b9c5(0x154)](_0x36b9c5(0x1bc)+[..._0x27ddea][_0x36b9c5(0x196)](',\x20'))):console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x154)]('No\x20tests\x20have\x20tags\x20defined.')),0x1;}}if(_0x2a3b8b)return this[_0x36b9c5(0x193)](_0x27c79c,{'definition':{'tests':_0x40d950},'agentInfo':_0x466651,'outputFormat':_0x797dd4,'outputFile':_0x3a60ca,'testNames':_0x56e277});if(_0x5828f8){console['log'](a5_0x52832e['cyan'](_0x36b9c5(0x162))),console[_0x36b9c5(0x192)](_0x36b9c5(0x140)+a5_0x52832e[_0x36b9c5(0x19b)](_0x414c84)),console[_0x36b9c5(0x192)](_0x36b9c5(0x163)+a5_0x52832e[_0x36b9c5(0x19b)](_0x466651['projectName'])),console['log']('\x20\x20Agent:\x20'+a5_0x52832e[_0x36b9c5(0x19b)](_0x466651[_0x36b9c5(0x187)])),console[_0x36b9c5(0x192)](),console[_0x36b9c5(0x192)](_0x36b9c5(0x166)+a5_0x52832e['white'](_0x40d950[_0x36b9c5(0x17d)]));for(let _0xd694b5=0x0;_0xd694b5<_0x40d950[_0x36b9c5(0x17d)];_0xd694b5++){const _0x5e77f7=_0x40d950[_0xd694b5],_0x2db93e=_0x5e77f7['rounds']['length']===0x1?_0x36b9c5(0x150):_0x36b9c5(0x186),_0x2ff7d4=_0x5e77f7[_0x36b9c5(0x1b5)]?.[_0x36b9c5(0x17d)]?'\x20['+_0x5e77f7['tags'][_0x36b9c5(0x196)](',\x20')+']':'';console['log']('\x20\x20'+(_0xd694b5+0x1)+'.\x20'+a5_0x52832e['white'](_0x5e77f7[_0x36b9c5(0x1b4)])+'\x20('+_0x5e77f7[_0x36b9c5(0x186)][_0x36b9c5(0x17d)]+'\x20'+_0x2db93e+')'+a5_0x52832e[_0x36b9c5(0x154)](_0x2ff7d4));}return 0x0;}let _0x4f2cef,_0x4ec616;try{_0x4f2cef=await _0x56782a[_0x36b9c5(0x1b9)][_0x36b9c5(0x190)](_0x466651['projectName']);}catch(_0xaa3658){const _0x297385=_0xaa3658 instanceof Error?_0xaa3658['message']:String(_0xaa3658);return _0x297385['includes'](_0x36b9c5(0x17e))||_0x297385['toLowerCase']()['includes'](_0x36b9c5(0x15c))?console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x176)](_0x36b9c5(0x159)+_0x466651[_0x36b9c5(0x1be)])):console['log'](a5_0x52832e[_0x36b9c5(0x176)](_0x36b9c5(0x13a)+_0x466651['projectName']+_0x36b9c5(0x1a6)+_0x297385)),0x1;}try{_0x4ec616=await _0x56782a[_0x36b9c5(0x1b9)][_0x36b9c5(0x16f)](_0x466651[_0x36b9c5(0x187)],_0x4f2cef);}catch(_0x5f49ee){const _0x343e7c=_0x5f49ee instanceof Error?_0x5f49ee[_0x36b9c5(0x168)]:String(_0x5f49ee);return _0x343e7c[_0x36b9c5(0x1c6)](_0x36b9c5(0x17e))||_0x343e7c[_0x36b9c5(0x18e)]()[_0x36b9c5(0x1c6)](_0x36b9c5(0x15c))?console['log'](a5_0x52832e[_0x36b9c5(0x176)]('✗\x20ERROR:\x20Agent\x20not\x20found:\x20'+_0x466651['agentName'])):console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x176)](_0x36b9c5(0x164)+_0x466651['agentName']+'\x22:\x20'+_0x343e7c)),0x1;}let _0x2d66fe;if(!_0x4dc2e7)try{_0x2d66fe=await setupEvaluatorAgent(_0x56782a[_0x36b9c5(0x1b9)],_0x5bbdff[_0x36b9c5(0x148)]);}catch(_0x261a35){const _0x5864af=_0x261a35 instanceof Error?_0x261a35['message']:String(_0x261a35);return console['log'](a5_0x52832e['red'](_0x36b9c5(0x12e)+_0x5864af)),0x1;}console['log'](a5_0x52832e['cyan'](_0x36b9c5(0x182))),console[_0x36b9c5(0x192)](_0x36b9c5(0x1ab)+a5_0x52832e[_0x36b9c5(0x19b)](_0x414c84)),console[_0x36b9c5(0x192)](_0x36b9c5(0x1b6)+a5_0x52832e['white'](_0x466651['projectName']+'/'+_0x466651[_0x36b9c5(0x187)])),console[_0x36b9c5(0x192)]();const _0x4d0bd2=[],_0x125290=[],_0x1ba706=Date[_0x36b9c5(0x133)]();for(let _0x372488=0x0;_0x372488<_0x40d950[_0x36b9c5(0x17d)];_0x372488++){const _0xfdead2=_0x40d950[_0x372488];_0x40d950['length']>0x1?console[_0x36b9c5(0x192)](_0x36b9c5(0x1a1)+(_0x372488+0x1)+'/'+_0x40d950[_0x36b9c5(0x17d)]+':\x20'+a5_0x52832e[_0x36b9c5(0x19b)](_0xfdead2[_0x36b9c5(0x1b4)])):console[_0x36b9c5(0x192)](_0x36b9c5(0x132)+a5_0x52832e[_0x36b9c5(0x19b)](_0xfdead2[_0x36b9c5(0x1b4)]));const _0x564200=createCommandSpinner(_0x36b9c5(0x1b7)+_0xfdead2['rounds'][_0x36b9c5(0x17d)]+_0x36b9c5(0x138));_0x564200[_0x36b9c5(0x18c)]();try{const {result:_0x3803b7,conversation:_0x28b793}=await runTest(_0x56782a[_0x36b9c5(0x1b9)],_0xfdead2,{'agentId':_0x4ec616,'projectId':_0x4f2cef,'site':_0x414c84,'noEval':_0x4dc2e7,'evaluatorId':_0x2d66fe,'onRoundStart':(_0x92200a,_0x3ee8dd)=>{const _0x4a6e8b=_0x36b9c5;_0x564200[_0x4a6e8b(0x15b)]='Round\x20'+(_0x92200a+0x1)+'/'+_0x3ee8dd+_0x4a6e8b(0x138);},'onRoundComplete':(_0x5a1e8e,_0x243052,_0x514d8a)=>{const _0x390d61=_0x36b9c5,_0x372cc3=formatElapsed(_0x243052);_0x514d8a?console[_0x390d61(0x192)]('\x20\x20Round\x20'+(_0x5a1e8e+0x1)+'/'+_0xfdead2['rounds'][_0x390d61(0x17d)]+_0x390d61(0x13c)+a5_0x52832e[_0x390d61(0x134)]('✓')+'\x20('+_0x372cc3+')'):console['log'](_0x390d61(0x1ba)+(_0x5a1e8e+0x1)+'/'+_0xfdead2['rounds'][_0x390d61(0x17d)]+_0x390d61(0x13c)+a5_0x52832e[_0x390d61(0x176)]('✗'));},'onEvaluationStart':()=>{const _0x29a7db=_0x36b9c5;_0x564200[_0x29a7db(0x15b)]=_0x29a7db(0x1a2);},'onEvaluationComplete':_0x3a1b96=>{const _0x35ffc5=_0x36b9c5,_0x1b87c7=formatElapsed(_0x3a1b96);console[_0x35ffc5(0x192)](_0x35ffc5(0x1ae)+a5_0x52832e['green']('✓')+'\x20('+_0x1b87c7+')');}});_0x564200[_0x36b9c5(0x1ad)](),_0x4d0bd2[_0x36b9c5(0x165)](_0x3803b7),_0x125290[_0x36b9c5(0x165)](_0x28b793);if(_0x3803b7[_0x36b9c5(0x18a)]===_0x36b9c5(0x136))console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x134)](_0x36b9c5(0x185)+_0x3803b7[_0x36b9c5(0x14c)]));else _0x3803b7[_0x36b9c5(0x18a)]===_0x36b9c5(0x14b)?console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x176)]('✗\x20FAIL:\x20'+_0x3803b7[_0x36b9c5(0x14c)])):console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x176)]('✗\x20ERROR:\x20'+_0x3803b7[_0x36b9c5(0x14c)]));_0x3803b7[_0x36b9c5(0x15d)]&&console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x154)](_0x36b9c5(0x143)+_0x3803b7[_0x36b9c5(0x15d)])),console['log']();}catch(_0x1f29a7){_0x564200[_0x36b9c5(0x1ad)]();const _0x5aa9e8=_0x1f29a7 instanceof Error?_0x1f29a7[_0x36b9c5(0x168)]:String(_0x1f29a7);console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x176)]('✗\x20ERROR:\x20'+_0x5aa9e8)),console['log'](),_0x4d0bd2[_0x36b9c5(0x165)]({'name':_0xfdead2[_0x36b9c5(0x1b4)],'status':'ERROR','reason':_0x5aa9e8,'timestamp':new Date()[_0x36b9c5(0x16d)](),'duration_ms':0x0});}}const _0xf2176b=Date['now']()-_0x1ba706,_0x4f8dfc=_0x4d0bd2[_0x36b9c5(0x1a0)](_0x3573da=>_0x3573da[_0x36b9c5(0x18a)]===_0x36b9c5(0x136))['length'],_0x4b30d6=_0x4d0bd2[_0x36b9c5(0x1a0)](_0x2a8237=>_0x2a8237['status']==='FAIL')['length'],_0x1737ac=_0x4d0bd2[_0x36b9c5(0x1a0)](_0x682621=>_0x682621[_0x36b9c5(0x18a)]===_0x36b9c5(0x142))[_0x36b9c5(0x17d)];console['log']('━'['repeat'](0x3c)),console[_0x36b9c5(0x192)](_0x36b9c5(0x135)),console[_0x36b9c5(0x192)]('━'[_0x36b9c5(0x19d)](0x3c)),console[_0x36b9c5(0x192)](_0x36b9c5(0x146)+_0x4d0bd2[_0x36b9c5(0x17d)]),console[_0x36b9c5(0x192)]('Passed:\x20\x20\x20'+a5_0x52832e[_0x36b9c5(0x134)](_0x4f8dfc)),console[_0x36b9c5(0x192)]('Failed:\x20\x20\x20'+a5_0x52832e['red'](_0x4b30d6));_0x1737ac>0x0&&console['log'](_0x36b9c5(0x170)+a5_0x52832e['red'](_0x1737ac));console[_0x36b9c5(0x192)](_0x36b9c5(0x172)+formatElapsed(_0xf2176b)),console['log']('━'[_0x36b9c5(0x19d)](0x3c));const _0x3319cd=_0x4d0bd2[_0x36b9c5(0x1a0)](_0x195c2a=>_0x195c2a[_0x36b9c5(0x18a)]!==_0x36b9c5(0x136));if(_0x3319cd[_0x36b9c5(0x17d)]>0x0){console[_0x36b9c5(0x192)](),console[_0x36b9c5(0x192)](_0x36b9c5(0x173));for(const _0x506d4e of _0x3319cd){const _0x280584=a5_0x52832e[_0x36b9c5(0x176)]('✗'),_0x58321d=_0x506d4e['reason'][_0x36b9c5(0x17d)]>0x32?_0x506d4e[_0x36b9c5(0x14c)][_0x36b9c5(0x160)](0x0,0x32)+_0x36b9c5(0x195):_0x506d4e[_0x36b9c5(0x14c)];console['log']('\x20\x20'+_0x280584+'\x20'+_0x506d4e[_0x36b9c5(0x1b4)]+':\x20'+_0x58321d);}}const _0x1ed1fc={'summary':{'total':_0x4d0bd2[_0x36b9c5(0x17d)],'passed':_0x4f8dfc,'failed':_0x4b30d6,'errors':_0x1737ac>0x0?_0x1737ac:undefined,'duration_ms':_0xf2176b},'tests':_0x4d0bd2,'agent':{'project':_0x466651[_0x36b9c5(0x1be)],'name':_0x466651[_0x36b9c5(0x187)],'site':_0x414c84},'timestamp':new Date(_0x1ba706)[_0x36b9c5(0x16d)]()};try{const _0x5e3c3a=buildCachedTestRun(_0x125290,{'site':_0x414c84,'projectId':_0x4f2cef,'projectName':_0x466651[_0x36b9c5(0x1be)],'agentId':_0x4ec616,'agentName':_0x466651[_0x36b9c5(0x187)],'testYmlPath':a5_0x12bfc0[_0x36b9c5(0x139)](_0x466651[_0x36b9c5(0x1a9)])});saveLastTestRun(_0x5e3c3a);}catch{}if(_0x797dd4!=='table'||_0x3a60ca){const _0x443ab7=formatResults(_0x1ed1fc,_0x797dd4);if(_0x3a60ca)try{a5_0x543ebe[_0x36b9c5(0x175)](_0x3a60ca,_0x443ab7,_0x36b9c5(0x14e)),console[_0x36b9c5(0x192)](),console['log'](a5_0x52832e[_0x36b9c5(0x154)](_0x36b9c5(0x1c7)+_0x3a60ca));}catch(_0x45ac7b){return console[_0x36b9c5(0x192)](),console[_0x36b9c5(0x192)](a5_0x52832e[_0x36b9c5(0x176)](_0x36b9c5(0x1ac)+_0x45ac7b)),0x1;}else console['log'](),console[_0x36b9c5(0x192)](_0x443ab7);}return _0x3319cd[_0x36b9c5(0x17d)]>0x0?0x1:0x0;}async[a5_0xdd547f(0x193)](_0x1461b3,_0x20e82d){const _0x106724=a5_0xdd547f,{options:_0x504c46,tdx:_0x1356bf}=_0x1461b3,{definition:_0x4272ae,agentInfo:_0x25cd42,outputFormat:_0xf2be00,outputFile:_0x53e8fc}=_0x20e82d,_0x2cb16a=_0x504c46[_0x106724(0x181)],_0x58c18a=loadLastTestRun();if(!_0x58c18a)return console[_0x106724(0x192)](a5_0x52832e['red'](_0x106724(0x184))),console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x154)](_0x106724(0x156))),0x1;if(_0x58c18a[_0x106724(0x158)][_0x106724(0x187)]!==_0x25cd42[_0x106724(0x187)])return console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x176)](_0x106724(0x171)+_0x58c18a[_0x106724(0x158)][_0x106724(0x187)]+_0x106724(0x13f)+_0x25cd42[_0x106724(0x187)]+'\x22.')),console['log'](a5_0x52832e[_0x106724(0x154)](_0x106724(0x16b))),0x1;const _0x9666e9=new Set(_0x58c18a['conversations'][_0x106724(0x179)](_0x3d91d9=>_0x3d91d9['testName'])),_0x9ab314=_0x4272ae[_0x106724(0x194)][_0x106724(0x1a0)](_0x73910a=>!_0x9666e9['has'](_0x73910a[_0x106724(0x1b4)]));if(_0x9ab314['length']>0x0&&_0x58c18a[_0x106724(0x181)]!==_0x2cb16a)return console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x176)](_0x106724(0x1bf))),console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x154)](_0x106724(0x15e)+_0x58c18a[_0x106724(0x181)]+_0x106724(0x183)+_0x2cb16a+'\x22.')),console['log'](a5_0x52832e['dim'](_0x106724(0x16a)+_0x58c18a['site']+'\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.')),0x1;const _0x403195=_0x4272ae[_0x106724(0x194)][_0x106724(0x1a0)](_0x186c2c=>_0x9666e9['has'](_0x186c2c[_0x106724(0x1b4)])),_0x1b5ed4=_0x9ab314;let _0x5c3683;try{_0x5c3683=await setupEvaluatorAgent(_0x1356bf[_0x106724(0x1b9)],_0x504c46['verbose']);}catch(_0x88b693){const _0x58984b=_0x88b693 instanceof Error?_0x88b693[_0x106724(0x168)]:String(_0x88b693);return console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x176)](_0x106724(0x12e)+_0x58984b)),0x1;}console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x1a3)]('Re-evaluating\x20cached\x20test\x20run...')),console['log'](_0x106724(0x189)+a5_0x52832e[_0x106724(0x19b)](_0x58c18a[_0x106724(0x17a)])),console[_0x106724(0x192)](_0x106724(0x1b6)+a5_0x52832e[_0x106724(0x19b)](_0x58c18a[_0x106724(0x158)][_0x106724(0x1be)]+'/'+_0x58c18a['agent']['agentName']));_0x1b5ed4[_0x106724(0x17d)]>0x0&&console[_0x106724(0x192)](_0x106724(0x19c)+a5_0x52832e[_0x106724(0x13b)](_0x1b5ed4[_0x106724(0x17d)]));console['log']();const _0x5e134e=[],_0x2f4f21=Date[_0x106724(0x133)](),_0xcddfad=createCommandSpinner(_0x106724(0x14a));if(_0x403195[_0x106724(0x17d)]>0x0)try{const _0x2a9856=await reevaluateFromCache(_0x1356bf[_0x106724(0x1b9)],_0x58c18a,{'tests':_0x403195},{'evaluatorId':_0x5c3683,'onTestStart':(_0x51d177,_0x3ffed6,_0x3ab273)=>{const _0x458e5b=_0x106724;_0xcddfad[_0x458e5b(0x15b)]=_0x458e5b(0x14f)+(_0x3ffed6+0x1)+'/'+_0x3ab273+':\x20'+_0x51d177+_0x458e5b(0x195);if(!_0xcddfad['isSpinning'])_0xcddfad[_0x458e5b(0x18c)]();},'onTestComplete':(_0x2fae1c,_0x133ad3)=>{const _0x249780=_0x106724;_0xcddfad[_0x249780(0x1ad)]();if(_0x133ad3[_0x249780(0x18a)]===_0x249780(0x136))console[_0x249780(0x192)](a5_0x52832e[_0x249780(0x134)](_0x249780(0x185)+_0x2fae1c)+a5_0x52832e[_0x249780(0x154)]('\x20(cached)'));else _0x133ad3[_0x249780(0x18a)]===_0x249780(0x14b)?console[_0x249780(0x192)](a5_0x52832e[_0x249780(0x176)](_0x249780(0x141)+_0x2fae1c+'\x20-\x20'+_0x133ad3[_0x249780(0x14c)])+a5_0x52832e[_0x249780(0x154)]('\x20(cached)')):console[_0x249780(0x192)](a5_0x52832e[_0x249780(0x176)](_0x249780(0x1a4)+_0x2fae1c+_0x249780(0x18b)+_0x133ad3[_0x249780(0x14c)]));_0x133ad3[_0x249780(0x15d)]&&console[_0x249780(0x192)](a5_0x52832e[_0x249780(0x154)]('\x20\x20Conversation:\x20'+_0x133ad3[_0x249780(0x15d)])),_0x5e134e[_0x249780(0x165)](_0x133ad3);},'onTestSkipped':(_0x449a96,_0x255676)=>{const _0x415242=_0x106724;_0xcddfad[_0x415242(0x1ad)](),console[_0x415242(0x192)](a5_0x52832e['yellow']('⚠\x20SKIPPED:\x20'+_0x449a96+_0x415242(0x18b)+_0x255676));}});for(const _0x556e4c of _0x2a9856){!_0x5e134e[_0x106724(0x1b2)](_0x38d6dc=>_0x38d6dc['name']===_0x556e4c[_0x106724(0x1b4)])&&_0x5e134e[_0x106724(0x165)](_0x556e4c);}}catch(_0x45dce8){_0xcddfad[_0x106724(0x1ad)]();const _0x4d801e=_0x45dce8 instanceof Error?_0x45dce8[_0x106724(0x168)]:String(_0x45dce8);return console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x176)](_0x106724(0x1af)+_0x4d801e)),0x1;}_0xcddfad['stop']();if(_0x1b5ed4[_0x106724(0x17d)]>0x0){console[_0x106724(0x192)](),console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x1a3)](_0x106724(0x131)));const {projectId:_0xdda4fb,agentId:_0x1ec552}=_0x58c18a[_0x106724(0x158)];for(const _0x1ce2da of _0x1b5ed4){console['log'](_0x106724(0x147)+a5_0x52832e['white'](_0x1ce2da[_0x106724(0x1b4)]));const _0x2bf2d2=createCommandSpinner('Round\x201/'+_0x1ce2da['rounds']['length']+':\x20Sending\x20user\x20input...');_0x2bf2d2[_0x106724(0x18c)]();try{const {result:_0x16c705}=await runTest(_0x1356bf[_0x106724(0x1b9)],_0x1ce2da,{'agentId':_0x1ec552,'projectId':_0xdda4fb,'site':_0x58c18a[_0x106724(0x181)],'noEval':![],'evaluatorId':_0x5c3683,'onRoundStart':(_0x1d4bb6,_0x1c261e)=>{const _0x4f60aa=_0x106724;_0x2bf2d2[_0x4f60aa(0x15b)]='Round\x20'+(_0x1d4bb6+0x1)+'/'+_0x1c261e+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x2a0de1,_0x305af0,_0x42bebe)=>{const _0x5e3963=_0x106724,_0x1b6540=formatElapsed(_0x305af0);_0x42bebe?console['log'](_0x5e3963(0x1ba)+(_0x2a0de1+0x1)+'/'+_0x1ce2da['rounds'][_0x5e3963(0x17d)]+_0x5e3963(0x13c)+a5_0x52832e['green']('✓')+'\x20('+_0x1b6540+')'):console[_0x5e3963(0x192)](_0x5e3963(0x1ba)+(_0x2a0de1+0x1)+'/'+_0x1ce2da[_0x5e3963(0x186)]['length']+'...\x20'+a5_0x52832e[_0x5e3963(0x176)]('✗'));},'onEvaluationStart':()=>{const _0x299488=_0x106724;_0x2bf2d2[_0x299488(0x15b)]=_0x299488(0x1a2);},'onEvaluationComplete':_0x11c3d5=>{const _0x49342f=_0x106724,_0x1c26e9=formatElapsed(_0x11c3d5);console[_0x49342f(0x192)]('\x20\x20Evaluating...\x20'+a5_0x52832e[_0x49342f(0x134)]('✓')+'\x20('+_0x1c26e9+')');}});_0x2bf2d2[_0x106724(0x1ad)](),_0x5e134e[_0x106724(0x165)](_0x16c705);if(_0x16c705[_0x106724(0x18a)]===_0x106724(0x136))console['log'](a5_0x52832e[_0x106724(0x134)](_0x106724(0x185)+_0x16c705[_0x106724(0x14c)])+a5_0x52832e[_0x106724(0x154)](_0x106724(0x191)));else _0x16c705[_0x106724(0x18a)]===_0x106724(0x14b)?console['log'](a5_0x52832e[_0x106724(0x176)](_0x106724(0x141)+_0x16c705[_0x106724(0x14c)])+a5_0x52832e['dim']('\x20(new)')):console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x176)](_0x106724(0x1a4)+_0x16c705[_0x106724(0x14c)]));_0x16c705[_0x106724(0x15d)]&&console[_0x106724(0x192)](a5_0x52832e['dim'](_0x106724(0x188)+_0x16c705[_0x106724(0x15d)]));}catch(_0xcbbd8c){_0x2bf2d2['stop']();const _0x270431=_0xcbbd8c instanceof Error?_0xcbbd8c['message']:String(_0xcbbd8c);console[_0x106724(0x192)](a5_0x52832e['red'](_0x106724(0x1a4)+_0x270431)),_0x5e134e['push']({'name':_0x1ce2da[_0x106724(0x1b4)],'status':_0x106724(0x142),'reason':_0x270431,'timestamp':new Date()[_0x106724(0x16d)](),'duration_ms':0x0});}}}console['log']();const _0x5109f6=Date[_0x106724(0x133)]()-_0x2f4f21,_0x17b44d=_0x5e134e[_0x106724(0x1a0)](_0x1841e1=>_0x1841e1[_0x106724(0x18a)]==='PASS')[_0x106724(0x17d)],_0x4d1d2d=_0x5e134e[_0x106724(0x1a0)](_0x4ec784=>_0x4ec784[_0x106724(0x18a)]===_0x106724(0x14b))['length'],_0x21bf75=_0x5e134e['filter'](_0x117eba=>_0x117eba[_0x106724(0x18a)]===_0x106724(0x142))['length'];console[_0x106724(0x192)]('━'[_0x106724(0x19d)](0x3c)),console['log']('Re-evaluation\x20Summary'),console['log']('━'[_0x106724(0x19d)](0x3c)),console[_0x106724(0x192)](_0x106724(0x146)+_0x5e134e['length']),console[_0x106724(0x192)](_0x106724(0x1c1)+a5_0x52832e[_0x106724(0x134)](_0x17b44d)),console[_0x106724(0x192)](_0x106724(0x169)+a5_0x52832e[_0x106724(0x176)](_0x4d1d2d));_0x21bf75>0x0&&console[_0x106724(0x192)](_0x106724(0x170)+a5_0x52832e[_0x106724(0x176)](_0x21bf75));console[_0x106724(0x192)](_0x106724(0x172)+formatElapsed(_0x5109f6)),console[_0x106724(0x192)]('━'[_0x106724(0x19d)](0x3c));const _0x10d7f3={'summary':{'total':_0x5e134e[_0x106724(0x17d)],'passed':_0x17b44d,'failed':_0x4d1d2d,'errors':_0x21bf75>0x0?_0x21bf75:undefined,'duration_ms':_0x5109f6},'tests':_0x5e134e,'agent':{'project':_0x25cd42[_0x106724(0x1be)],'name':_0x25cd42[_0x106724(0x187)],'site':_0x2cb16a},'timestamp':new Date(_0x2f4f21)['toISOString']()};if(_0xf2be00!==_0x106724(0x1a8)||_0x53e8fc){const _0x4f9b81=formatResults(_0x10d7f3,_0xf2be00);if(_0x53e8fc)try{a5_0x543ebe['writeFileSync'](_0x53e8fc,_0x4f9b81,_0x106724(0x14e)),console[_0x106724(0x192)](),console[_0x106724(0x192)](a5_0x52832e[_0x106724(0x154)](_0x106724(0x1c7)+_0x53e8fc));}catch(_0x323d59){return console[_0x106724(0x192)](),console[_0x106724(0x192)](a5_0x52832e['red']('Error\x20writing\x20output\x20file:\x20'+_0x323d59)),0x1;}else console['log'](),console['log'](_0x4f9b81);}const _0x483268=_0x5e134e['filter'](_0xca958d=>_0xca958d['status']!==_0x106724(0x136));return _0x483268[_0x106724(0x17d)]>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a6_0xff9c24=a6_0x4144;function a6_0x4144(_0x4e6baf,_0x398b69){_0x4e6baf=_0x4e6baf-0x12a;const _0x5d3456=a6_0x5d34();let _0x414445=_0x5d3456[_0x4e6baf];return _0x414445;}(function(_0x2a2a18,_0x41aef8){const _0x118309=a6_0x4144,_0x13d3a9=_0x2a2a18();while(!![]){try{const _0x2cad58=-parseInt(_0x118309(0x16c))/0x1*(parseInt(_0x118309(0x155))/0x2)+parseInt(_0x118309(0x163))/0x3*(-parseInt(_0x118309(0x13c))/0x4)+-parseInt(_0x118309(0x14f))/0x5*(parseInt(_0x118309(0x168))/0x6)+parseInt(_0x118309(0x159))/0x7+parseInt(_0x118309(0x14d))/0x8+parseInt(_0x118309(0x15f))/0x9*(-parseInt(_0x118309(0x151))/0xa)+-parseInt(_0x118309(0x157))/0xb*(-parseInt(_0x118309(0x13b))/0xc);if(_0x2cad58===_0x41aef8)break;else _0x13d3a9['push'](_0x13d3a9['shift']());}catch(_0x58540d){_0x13d3a9['push'](_0x13d3a9['shift']());}}}(a6_0x5d34,0xaf1c5));import{BaseCommand}from'./command.js';function a6_0x5d34(){const _0x311824=['indexOf','883756QDlfUK','status','22BZOMai','trim','3222401GecgJS','isArray','method','toLowerCase','llm','error','9tqybwL','validate','Endpoint\x20must\x20start\x20with\x20/:\x20','\x22.\x20','8571lWRqxZ','name','output','site','data','48fZnsRl','Invalid\x20HTTP\x20method:\x20','color','file','1XIpsRF','proxy-authorization','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','x-trino-user','DELETE','llm-proxy','Error:\x20','Results\x20saved\x20to\x20','type','set-cookie2','message','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','.\x20Valid\x20methods:\x20','GET','noColor','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','set-cookie','description','entries','9179904TCdwzX','428eSaBlH','verbose','POST','cookie','api','substring','has','includes','x-auth-token','header','Invalid\x20header\x20format:\x20\x22','length','join','<\x20HTTP/1.1\x20','Invalid\x20API\x20type:\x20','.\x20Valid\x20types:\x20','body','7143696irCOeI','x-xsrf-token','174175WbXEdh','log','11397790dnorXv','toUpperCase','stack'];a6_0x5d34=function(){return _0x311824;};return a6_0x5d34();}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_0xff9c24(0x16d),a6_0xff9c24(0x13f),a6_0xff9c24(0x138),a6_0xff9c24(0x130),a6_0xff9c24(0x14e),a6_0xff9c24(0x144),a6_0xff9c24(0x12a)]);function isSensitiveHeader(_0x7b1282){const _0x9ef4d1=a6_0xff9c24;return SENSITIVE_HEADERS[_0x9ef4d1(0x142)](_0x7b1282[_0x9ef4d1(0x15c)]());}function parseHeader(_0x1510a4){const _0x476254=a6_0xff9c24,_0x1b48da=_0x1510a4[_0x476254(0x154)](':');if(_0x1b48da===-0x1)throw new Error(_0x476254(0x146)+_0x1510a4+_0x476254(0x162)+_0x476254(0x132));const _0x5071d6=_0x1510a4[_0x476254(0x141)](0x0,_0x1b48da)[_0x476254(0x158)](),_0x1e807a=_0x1510a4['substring'](_0x1b48da+0x1)[_0x476254(0x158)]();if(!_0x5071d6)throw new Error(_0x476254(0x137)+_0x1510a4+'\x22');return[_0x5071d6,_0x1e807a];}export class ApiCommand extends BaseCommand{[a6_0xff9c24(0x164)]='api';[a6_0xff9c24(0x139)]='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a6_0xff9c24(0x160)](_0x9e8937){const _0x285a53=a6_0xff9c24,{args:_0x2f050c,options:_0x3fc720}=_0x9e8937,_0xbeffd6=_0x3fc720;if(_0x2f050c[_0x285a53(0x147)]===0x0)return _0x285a53(0x16e);const _0x380dcd=_0x2f050c[0x0];if(!_0x380dcd['startsWith']('/'))return _0x285a53(0x161)+_0x380dcd;const _0x12b2c2=_0xbeffd6[_0x285a53(0x167)],_0x2bf4da=_0xbeffd6[_0x285a53(0x16b)];if(_0x12b2c2&&_0x2bf4da)return _0x285a53(0x133);const _0xa4a26a=_0xbeffd6[_0x285a53(0x15b)]||_0x285a53(0x135),_0x3dfeef=['GET',_0x285a53(0x13e),'PUT',_0x285a53(0x12b),'PATCH'];if(!_0x3dfeef[_0x285a53(0x143)](_0xa4a26a[_0x285a53(0x152)]()))return _0x285a53(0x169)+_0xa4a26a+_0x285a53(0x134)+_0x3dfeef[_0x285a53(0x148)](',\x20');const _0x466257=_0xbeffd6[_0x285a53(0x12f)]||'td',_0x1db654=['td','cdp','workflow','trino',_0x285a53(0x15d),_0x285a53(0x12c)];if(!_0x1db654['includes'](_0x466257))return _0x285a53(0x14a)+_0x466257+_0x285a53(0x14b)+_0x1db654[_0x285a53(0x148)](',\x20');return undefined;}async['execute'](_0x5f5030){const _0x3fe5d7=a6_0xff9c24,{options:_0x2b77f7,args:_0x24a049,tdx:_0x53f0b7}=_0x5f5030,_0x146b94=_0x2b77f7,_0x336283=_0x24a049[0x0],_0x33a798=(_0x146b94[_0x3fe5d7(0x15b)]||_0x3fe5d7(0x135))[_0x3fe5d7(0x152)](),_0x302109=_0x146b94[_0x3fe5d7(0x167)],_0x4acf8b=_0x146b94['file'],_0x4f02c0=_0x146b94[_0x3fe5d7(0x145)],_0x301be5=_0x146b94[_0x3fe5d7(0x12f)]||'td';try{const _0x25ae32={};if(_0x4f02c0){const _0x502de8=Array[_0x3fe5d7(0x15a)](_0x4f02c0)?_0x4f02c0:[_0x4f02c0];for(const _0x322b64 of _0x502de8){const [_0x2c58fe,_0x51d960]=parseHeader(_0x322b64);_0x25ae32[_0x2c58fe]=_0x51d960;}}let _0x19ca23;if(_0x302109)_0x19ca23=_0x302109;else{if(_0x4acf8b)try{_0x19ca23=RawAPI['readBodyFromFile'](_0x4acf8b);}catch(_0x3f03e7){return console[_0x3fe5d7(0x15e)](_0x3fe5d7(0x12d)+(_0x3f03e7 instanceof Error?_0x3f03e7[_0x3fe5d7(0x131)]:String(_0x3f03e7))),0x1;}}const _0x2fb146={'method':_0x33a798,'apiType':_0x301be5,'includeHeaders':_0x2b77f7[_0x3fe5d7(0x13d)]};_0x19ca23&&(_0x2fb146[_0x3fe5d7(0x14c)]=_0x19ca23);Object['keys'](_0x25ae32)[_0x3fe5d7(0x147)]>0x0&&(_0x2fb146['headers']=_0x25ae32);if(_0x2b77f7[_0x3fe5d7(0x13d)]){const _0x3786a8=resolveSite(_0x2b77f7[_0x3fe5d7(0x166)]),_0x1018e1=getEndpoint(_0x3786a8,_0x301be5),_0x4e363e=''+_0x1018e1+_0x336283;console[_0x3fe5d7(0x15e)]('>\x20'+_0x33a798+'\x20'+_0x4e363e);const _0x5a33a8=getAuthHeaders(_0x3786a8),_0x20c005={..._0x5a33a8,..._0x25ae32};for(const [_0x7c01ee,_0x2cf712]of Object[_0x3fe5d7(0x13a)](_0x20c005)){!isSensitiveHeader(_0x7c01ee)&&console[_0x3fe5d7(0x15e)]('>\x20'+_0x7c01ee+':\x20'+_0x2cf712);}_0x19ca23&&console[_0x3fe5d7(0x15e)]('>'),console[_0x3fe5d7(0x15e)]('');}const _0x3f9414=await _0x53f0b7[_0x3fe5d7(0x140)]['request'](_0x336283,_0x2fb146);if(_0x2b77f7[_0x3fe5d7(0x13d)]&&_0x3f9414['headers']){console[_0x3fe5d7(0x15e)](_0x3fe5d7(0x149)+_0x3f9414[_0x3fe5d7(0x156)]);for(const [_0x577305,_0xfd31eb]of Object[_0x3fe5d7(0x13a)](_0x3f9414['headers'])){!isSensitiveHeader(_0x577305)&&console[_0x3fe5d7(0x15e)]('<\x20'+_0x577305+':\x20'+_0xfd31eb);}console[_0x3fe5d7(0x15e)]('');}const _0x5bc3d2=Boolean(_0x2b77f7[_0x3fe5d7(0x165)]),_0x2a68ed={'color':_0x2b77f7[_0x3fe5d7(0x16a)],'noColor':_0x2b77f7[_0x3fe5d7(0x136)]||_0x5bc3d2&&!_0x2b77f7[_0x3fe5d7(0x16a)]},_0x2c47a0=colorizeJSON(_0x3f9414[_0x3fe5d7(0x167)],_0x2a68ed);return _0x2b77f7['output']?(writeFileSync(_0x2b77f7[_0x3fe5d7(0x165)],_0x2c47a0),console['error'](_0x3fe5d7(0x12e)+_0x2b77f7[_0x3fe5d7(0x165)])):console[_0x3fe5d7(0x150)](_0x2c47a0),0x0;}catch(_0x5d3b1a){return _0x5d3b1a instanceof Error?(console[_0x3fe5d7(0x15e)](_0x3fe5d7(0x12d)+_0x5d3b1a[_0x3fe5d7(0x131)]),_0x2b77f7[_0x3fe5d7(0x13d)]&&_0x5d3b1a[_0x3fe5d7(0x153)]&&console['error']('\x0aStack\x20trace:\x0a'+_0x5d3b1a[_0x3fe5d7(0x153)])):console[_0x3fe5d7(0x15e)]('Error:\x20'+String(_0x5d3b1a)),0x1;}}}
1
+ function a6_0x4553(_0x38f78e,_0x3ec555){_0x38f78e=_0x38f78e-0x174;const _0x2e6943=a6_0x2e69();let _0x455370=_0x2e6943[_0x38f78e];return _0x455370;}function a6_0x2e69(){const _0x55416d=['stack','\x0aStack\x20trace:\x0a','x-trino-user','427508cjHXiY','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','noColor','2044748HlTurD','set-cookie','workflow','header','body','includes','Error:\x20','x-auth-token','llm','site','error','message','startsWith','POST','isArray','color','status','type','api','authorization','cdp','headers','\x22.\x20','substring','64792QatFlG','Invalid\x20header\x20format:\x20\x22','trino','GET','x-xsrf-token','46801500OeRNyL','Results\x20saved\x20to\x20','output','137430mLPggy','verbose','set-cookie2','log','<\x20HTTP/1.1\x20','data','trim','PATCH','method','length','file','request','PUT','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','207HUOXfD','join','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','readBodyFromFile','validate','567eXVZZd','DELETE','entries','toLowerCase','4kfHqUv','1839006VoqbZI','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','8245870BfVLDI','toUpperCase','Invalid\x20HTTP\x20method:\x20','execute','llm-proxy'];a6_0x2e69=function(){return _0x55416d;};return a6_0x2e69();}const a6_0x2c8340=a6_0x4553;(function(_0x4b4525,_0x176d74){const _0x327c52=a6_0x4553,_0x49c195=_0x4b4525();while(!![]){try{const _0x19fd9a=-parseInt(_0x327c52(0x1a7))/0x1*(-parseInt(_0x327c52(0x1b2))/0x2)+parseInt(_0x327c52(0x1a8))/0x3+parseInt(_0x327c52(0x1b5))/0x4+parseInt(_0x327c52(0x1aa))/0x5+parseInt(_0x327c52(0x18f))/0x6*(parseInt(_0x327c52(0x1a3))/0x7)+parseInt(_0x327c52(0x187))/0x8*(parseInt(_0x327c52(0x19d))/0x9)+-parseInt(_0x327c52(0x18c))/0xa;if(_0x19fd9a===_0x176d74)break;else _0x49c195['push'](_0x49c195['shift']());}catch(_0x3ea7f9){_0x49c195['push'](_0x49c195['shift']());}}}(a6_0x2e69,0xf1a73));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([a6_0x2c8340(0x182),'proxy-authorization','cookie',a6_0x2c8340(0x1b6),a6_0x2c8340(0x191),a6_0x2c8340(0x18b),a6_0x2c8340(0x176),a6_0x2c8340(0x1b1)]);function isSensitiveHeader(_0x44cc7b){const _0x1de6c3=a6_0x2c8340;return SENSITIVE_HEADERS['has'](_0x44cc7b[_0x1de6c3(0x1a6)]());}function parseHeader(_0x5bf3d2){const _0x464d93=a6_0x2c8340,_0x284d80=_0x5bf3d2['indexOf'](':');if(_0x284d80===-0x1)throw new Error(_0x464d93(0x188)+_0x5bf3d2+_0x464d93(0x185)+_0x464d93(0x19c));const _0x1dfe77=_0x5bf3d2[_0x464d93(0x186)](0x0,_0x284d80)[_0x464d93(0x195)](),_0x50e591=_0x5bf3d2['substring'](_0x284d80+0x1)[_0x464d93(0x195)]();if(!_0x1dfe77)throw new Error(_0x464d93(0x1b3)+_0x5bf3d2+'\x22');return[_0x1dfe77,_0x50e591];}export class ApiCommand extends BaseCommand{['name']=a6_0x2c8340(0x181);['description']=a6_0x2c8340(0x1a0);[a6_0x2c8340(0x1a2)](_0x22184c){const _0x43547d=a6_0x2c8340,{args:_0x2d7600,options:_0xef7d1}=_0x22184c,_0x1dc783=_0xef7d1;if(_0x2d7600['length']===0x0)return _0x43547d(0x1a9);const _0x17a3d5=_0x2d7600[0x0];if(!_0x17a3d5[_0x43547d(0x17b)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x17a3d5;const _0x51d53c=_0x1dc783['data'],_0x12d98d=_0x1dc783[_0x43547d(0x199)];if(_0x51d53c&&_0x12d98d)return _0x43547d(0x19f);const _0x340984=_0x1dc783['method']||_0x43547d(0x18a),_0x193e6e=[_0x43547d(0x18a),_0x43547d(0x17c),_0x43547d(0x19b),_0x43547d(0x1a4),_0x43547d(0x196)];if(!_0x193e6e['includes'](_0x340984[_0x43547d(0x1ab)]()))return _0x43547d(0x1ac)+_0x340984+'.\x20Valid\x20methods:\x20'+_0x193e6e[_0x43547d(0x19e)](',\x20');const _0x53c83b=_0x1dc783['type']||'td',_0xf49542=['td',_0x43547d(0x183),_0x43547d(0x1b7),_0x43547d(0x189),_0x43547d(0x177),_0x43547d(0x1ae)];if(!_0xf49542[_0x43547d(0x174)](_0x53c83b))return'Invalid\x20API\x20type:\x20'+_0x53c83b+'.\x20Valid\x20types:\x20'+_0xf49542[_0x43547d(0x19e)](',\x20');return undefined;}async[a6_0x2c8340(0x1ad)](_0x368201){const _0x4b65b1=a6_0x2c8340,{options:_0x57d4ee,args:_0x30a769,tdx:_0x3433fb}=_0x368201,_0x2c137f=_0x57d4ee,_0x5109d5=_0x30a769[0x0],_0x45f938=(_0x2c137f[_0x4b65b1(0x197)]||'GET')[_0x4b65b1(0x1ab)](),_0x3e6422=_0x2c137f[_0x4b65b1(0x194)],_0x38a68b=_0x2c137f[_0x4b65b1(0x199)],_0x41bd5e=_0x2c137f[_0x4b65b1(0x1b8)],_0x50761f=_0x2c137f[_0x4b65b1(0x180)]||'td';try{const _0x48ceda={};if(_0x41bd5e){const _0x3a3127=Array[_0x4b65b1(0x17d)](_0x41bd5e)?_0x41bd5e:[_0x41bd5e];for(const _0x13c722 of _0x3a3127){const [_0x210bc1,_0x2f147d]=parseHeader(_0x13c722);_0x48ceda[_0x210bc1]=_0x2f147d;}}let _0x2a9224;if(_0x3e6422)_0x2a9224=_0x3e6422;else{if(_0x38a68b)try{_0x2a9224=RawAPI[_0x4b65b1(0x1a1)](_0x38a68b);}catch(_0x436eb7){return console[_0x4b65b1(0x179)](_0x4b65b1(0x175)+(_0x436eb7 instanceof Error?_0x436eb7[_0x4b65b1(0x17a)]:String(_0x436eb7))),0x1;}}const _0x3de8a8={'method':_0x45f938,'apiType':_0x50761f,'includeHeaders':_0x57d4ee['verbose']};_0x2a9224&&(_0x3de8a8[_0x4b65b1(0x1b9)]=_0x2a9224);Object['keys'](_0x48ceda)[_0x4b65b1(0x198)]>0x0&&(_0x3de8a8['headers']=_0x48ceda);if(_0x57d4ee[_0x4b65b1(0x190)]){const _0x45e688=resolveSite(_0x57d4ee[_0x4b65b1(0x178)]),_0x3fd4df=getEndpoint(_0x45e688,_0x50761f),_0x183579=''+_0x3fd4df+_0x5109d5;console[_0x4b65b1(0x179)]('>\x20'+_0x45f938+'\x20'+_0x183579);const _0x3f2e00=getAuthHeaders(_0x45e688),_0x2e5edc={..._0x3f2e00,..._0x48ceda};for(const [_0x39f142,_0x53a03f]of Object[_0x4b65b1(0x1a5)](_0x2e5edc)){!isSensitiveHeader(_0x39f142)&&console[_0x4b65b1(0x179)]('>\x20'+_0x39f142+':\x20'+_0x53a03f);}_0x2a9224&&console['error']('>'),console['error']('');}const _0x5c7461=await _0x3433fb['api'][_0x4b65b1(0x19a)](_0x5109d5,_0x3de8a8);if(_0x57d4ee[_0x4b65b1(0x190)]&&_0x5c7461['headers']){console[_0x4b65b1(0x179)](_0x4b65b1(0x193)+_0x5c7461[_0x4b65b1(0x17f)]);for(const [_0x2faa0d,_0x290d97]of Object[_0x4b65b1(0x1a5)](_0x5c7461[_0x4b65b1(0x184)])){!isSensitiveHeader(_0x2faa0d)&&console[_0x4b65b1(0x179)]('<\x20'+_0x2faa0d+':\x20'+_0x290d97);}console[_0x4b65b1(0x179)]('');}const _0x1256b7=Boolean(_0x57d4ee[_0x4b65b1(0x18e)]),_0x412a69={'color':_0x57d4ee[_0x4b65b1(0x17e)],'noColor':_0x57d4ee[_0x4b65b1(0x1b4)]||_0x1256b7&&!_0x57d4ee[_0x4b65b1(0x17e)]},_0x478e76=colorizeJSON(_0x5c7461['data'],_0x412a69);return _0x57d4ee[_0x4b65b1(0x18e)]?(writeFileSync(_0x57d4ee[_0x4b65b1(0x18e)],_0x478e76),console[_0x4b65b1(0x179)](_0x4b65b1(0x18d)+_0x57d4ee[_0x4b65b1(0x18e)])):console[_0x4b65b1(0x192)](_0x478e76),0x0;}catch(_0x415a35){return _0x415a35 instanceof Error?(console['error'](_0x4b65b1(0x175)+_0x415a35[_0x4b65b1(0x17a)]),_0x57d4ee[_0x4b65b1(0x190)]&&_0x415a35[_0x4b65b1(0x1af)]&&console[_0x4b65b1(0x179)](_0x4b65b1(0x1b0)+_0x415a35[_0x4b65b1(0x1af)])):console['error']('Error:\x20'+String(_0x415a35)),0x1;}}}
@@ -1 +1 @@
1
- const a7_0x4cc1d2=a7_0x3c4b;function a7_0x2a9a(){const _0x40746a=['✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','5643pJQgYP','You\x20can\x20find\x20your\x20API\x20key\x20at:','No\x20credentials\x20found\x20in\x20keychain','jobs','Choose\x20authentication\x20method:','trim','tdx:\x20auth\x20setup','User:\x20','5727246shBmGK','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20(site:\x20','profile','API\x20key','\x20(profile:\x20','API\x20Key','Setup\x20API\x20key\x20authentication\x20interactively','Validating\x20API\x20key...','✓\x20Authentication\x20successful\x0a','red','message','getUserInfo','\x20for\x20profile:\x20','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key:','filter','3968soZDYd','yellow','Setup\x20cancelled','API\x20key\x20cannot\x20be\x20empty','site','warn','create','No\x20credential\x20found','Setting\x20up\x20authentication\x20for\x20site:\x20','password','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','Read\x20credential\x20from\x20','auth:clear','Read\x20credential\x20from\x20keychain','268aAmUMW','Remove\x20API\x20key\x20from\x20system\x20keychain','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','9812400CkgfVM','\x20removed\x20from\x20keychain','error','✓\x20Profile\x20\x27','us01','execute','method','Name:\x20','oauth','tdx\x20profile:\x20','6794217ulNrar','✗\x20Validation\x20failed:\x20','8834VkESgq','apikey','Credential\x20type:\x20OAuth','bold','all','ERROR','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','last_name','tdx:\x20auth\x20clear','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','description','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','apiKey','status','auth','logLevel','\x27\x20registered','7674855pzSZCU','join','email','✓\x20Default\x20site\x20set\x20to\x20','\x0aSetup\x20cancelled','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','3489400pSupNQ','System\x20keychain\x20is\x20not\x20available','first_name','name'];a7_0x2a9a=function(){return _0x40746a;};return a7_0x2a9a();}(function(_0x4f1791,_0x40e6ab){const _0x10557e=a7_0x3c4b,_0x45cc1d=_0x4f1791();while(!![]){try{const _0x259113=parseInt(_0x10557e(0x1ab))/0x1*(parseInt(_0x10557e(0x19c))/0x2)+parseInt(_0x10557e(0x1c7))/0x3*(parseInt(_0x10557e(0x1e1))/0x4)+parseInt(_0x10557e(0x1bc))/0x5+-parseInt(_0x10557e(0x19f))/0x6+-parseInt(_0x10557e(0x1cf))/0x7+-parseInt(_0x10557e(0x1c2))/0x8+-parseInt(_0x10557e(0x1a9))/0x9;if(_0x259113===_0x40e6ab)break;else _0x45cc1d['push'](_0x45cc1d['shift']());}catch(_0x2661ed){_0x45cc1d['push'](_0x45cc1d['shift']());}}}(a7_0x2a9a,0xe57ed));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';function a7_0x3c4b(_0x46cd82,_0x3054aa){_0x46cd82=_0x46cd82-0x190;const _0x2a9a18=a7_0x2a9a();let _0x3c4b6d=_0x2a9a18[_0x46cd82];return _0x3c4b6d;}import{isOAuthSupported}from'../core/oauth.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x2d8506 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_0x5c29a9 from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x4cc1d2(0x1c5)]='auth:setup';[a7_0x4cc1d2(0x1b5)]=a7_0x4cc1d2(0x1d7);async[a7_0x4cc1d2(0x1a4)](_0x491cda){const _0x5a63f3=a7_0x4cc1d2,{options:_0x46b22a}=_0x491cda,_0x17d39f=_0x46b22a[_0x5a63f3(0x1d3)];console[_0x5a63f3(0x1d0)](a7_0x5c29a9[_0x5a63f3(0x1ae)](_0x5a63f3(0x1cd)));const _0x3642d4=_0x46b22a[_0x5a63f3(0x192)]||_0x5a63f3(0x1a3),_0x35ded0=await promptSiteSelection(_0x3642d4,_0x17d39f,_0x5a63f3(0x190));if(!_0x35ded0)return 0x1;const _0xa74909=resolveSite(_0x35ded0);if(isOAuthSupported(_0xa74909)){const _0x9971ac=await a7_0x2d8506({'type':'select','name':_0x5a63f3(0x1a5),'message':_0x5a63f3(0x1cb),'choices':[{'title':'OAuth\x20(browser\x20login)','value':_0x5a63f3(0x1a7)},{'title':_0x5a63f3(0x1d6),'value':_0x5a63f3(0x1ac)}]});if(!_0x9971ac[_0x5a63f3(0x1a5)])return console[_0x5a63f3(0x1d0)](_0x5a63f3(0x1c0)),0x1;if(_0x9971ac[_0x5a63f3(0x1a5)]===_0x5a63f3(0x1a7))return await runOAuthLoginFlow(_0xa74909,_0x17d39f,_0x46b22a[_0x5a63f3(0x1ba)]??LogLevel[_0x5a63f3(0x1b0)]),0x0;}console['log'](_0x5a63f3(0x196)+_0xa74909),console[_0x5a63f3(0x1d0)](_0x5a63f3(0x1c8)),console[_0x5a63f3(0x1d0)]('\x20\x20'+getConsoleUrl(_0xa74909,_0x5a63f3(0x1de)));const _0x2fe1b8=await a7_0x2d8506({'type':_0x5a63f3(0x197),'name':_0x5a63f3(0x1b7),'message':_0x5a63f3(0x1df),'validate':_0x71841b=>{const _0x57fa7e=_0x5a63f3;if(!_0x71841b||!_0x71841b[_0x57fa7e(0x1cc)]())return _0x57fa7e(0x191);return!![];}});if(!_0x2fe1b8[_0x5a63f3(0x1b7)])return console[_0x5a63f3(0x1d0)](_0x5a63f3(0x1c0)),0x1;const _0x462b67=_0x2fe1b8['apiKey'];console[_0x5a63f3(0x1d0)](_0x5a63f3(0x1d8));try{const _0x5cad58=TDX[_0x5a63f3(0x194)]({'site':_0xa74909,'apiKey':_0x462b67['trim'](),'logLevel':_0x46b22a[_0x5a63f3(0x1ba)]??LogLevel[_0x5a63f3(0x1b0)]}),_0x5c1863=await _0x5cad58[_0x5a63f3(0x1ca)][_0x5a63f3(0x1dc)]();console['log'](_0x5a63f3(0x1b1)+_0x5c1863[_0x5a63f3(0x1be)]+')');const _0x3af178=await isKeychainAvailable();_0x3af178?(await saveAPIKeyAsync(_0x462b67[_0x5a63f3(0x1cc)](),_0xa74909,_0x17d39f),console['log'](_0x5a63f3(0x1c6)+(_0x17d39f?_0x5a63f3(0x1d5)+_0x17d39f+')':''))):(console[_0x5a63f3(0x193)](a7_0x5c29a9[_0x5a63f3(0x1e2)](_0x5a63f3(0x19e))),console[_0x5a63f3(0x193)](a7_0x5c29a9[_0x5a63f3(0x1e2)](_0x5a63f3(0x1c1))));if(_0x17d39f){const _0x37ac95={'site':_0xa74909};saveProfileToUserConfig(_0x17d39f,_0x37ac95),console['log'](_0x5a63f3(0x1a2)+_0x17d39f+_0x5a63f3(0x1bb));}else saveDefaultSiteToUserConfig(_0xa74909),console[_0x5a63f3(0x1d0)](_0x5a63f3(0x1bf)+_0xa74909);const _0x221a00=_0x17d39f?'\x20--profile\x20'+_0x17d39f:'';return console[_0x5a63f3(0x1d0)](),console[_0x5a63f3(0x1d0)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x5a63f3(0x1d0)]('\x20\x20tdx'+_0x221a00+_0x5a63f3(0x1d1)),console['log']('\x20\x20tdx'+_0x221a00+_0x5a63f3(0x1b6)),0x0;}catch(_0x1f554){if(_0x1f554 instanceof HTTPClientError&&_0x1f554[_0x5a63f3(0x1b8)]===0x191)return printAuthError(_0x1f554),0x1;return console[_0x5a63f3(0x1a1)](a7_0x5c29a9[_0x5a63f3(0x1da)](_0x5a63f3(0x1aa)+(_0x1f554 instanceof Error?_0x1f554[_0x5a63f3(0x1db)]:String(_0x1f554)))),console['error'](_0x5a63f3(0x198)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']=a7_0x4cc1d2(0x1b9);[a7_0x4cc1d2(0x1b5)]=a7_0x4cc1d2(0x1b4);async[a7_0x4cc1d2(0x1a4)](_0x42ff11){const _0x424436=a7_0x4cc1d2,{options:_0x550b75,tdx:_0x3e572d}=_0x42ff11,_0x13527b=_0x550b75[_0x424436(0x192)],_0x1c67b0=_0x550b75[_0x424436(0x1d3)],_0x1173ec=_0x1c67b0?_0x1c67b0:'N/A';console[_0x424436(0x1d0)](_0x424436(0x1a8)+_0x1173ec+_0x424436(0x1d2)+_0x13527b+')');const _0x3e79c0=await getOAuthTokens(_0x1c67b0);if(_0x3e79c0)console[_0x424436(0x1d0)](_0x424436(0x1ad)),console[_0x424436(0x1d0)](_0x424436(0x19b)+(_0x1c67b0?_0x424436(0x1d5)+_0x1c67b0+')':''));else{const _0xe18ab9=await resolveAPIKeyAsync(_0x13527b,_0x1c67b0);if(_0xe18ab9){const {source:_0x1a34c4,isDeprecated:_0x43b45a}=_0xe18ab9,_0x40c929=_0x424436(0x199)+_0x1a34c4;console[_0x424436(0x1d0)](_0x43b45a?a7_0x5c29a9['yellow'](_0x40c929):_0x40c929);}else console[_0x424436(0x1d0)](a7_0x5c29a9[_0x424436(0x1e2)](_0x424436(0x195)));}try{const _0x11e73f=await _0x3e572d['jobs']['getUserInfo']();return console[_0x424436(0x1d0)](a7_0x5c29a9['green'](_0x424436(0x1d9))),console[_0x424436(0x1d0)](_0x424436(0x1ce)+_0x11e73f[_0x424436(0x1be)]),(_0x11e73f['first_name']||_0x11e73f[_0x424436(0x1b2)])&&console[_0x424436(0x1d0)](_0x424436(0x1a6)+[_0x11e73f[_0x424436(0x1c4)],_0x11e73f[_0x424436(0x1b2)]][_0x424436(0x1e0)](Boolean)[_0x424436(0x1bd)]('\x20')),0x0;}catch(_0x1d41d0){return _0x1d41d0 instanceof HTTPClientError&&_0x1d41d0['status']===0x191?printAuthError(_0x1d41d0,!![],_0x1c67b0):console[_0x424436(0x1a1)](a7_0x5c29a9[_0x424436(0x1da)](_0x424436(0x1aa)+(_0x1d41d0 instanceof Error?_0x1d41d0['message']:String(_0x1d41d0)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x4cc1d2(0x1c5)]=a7_0x4cc1d2(0x19a);[a7_0x4cc1d2(0x1b5)]=a7_0x4cc1d2(0x19d);async[a7_0x4cc1d2(0x1a4)](_0x1db271){const _0x524b75=a7_0x4cc1d2,{options:_0x1383f9}=_0x1db271,_0x46cc2e=_0x1383f9['profile'];console['log'](a7_0x5c29a9[_0x524b75(0x1ae)](_0x524b75(0x1b3)));const _0x3c9290=await isKeychainAvailable();if(!_0x3c9290)return console[_0x524b75(0x1a1)](a7_0x5c29a9[_0x524b75(0x1da)](_0x524b75(0x1c3))),0x1;const [_0x385afa,_0x42fecd]=await Promise[_0x524b75(0x1af)]([deleteKeychainAPIKey(_0x46cc2e),deleteOAuthTokens(_0x46cc2e)]);if(_0x385afa||_0x42fecd){clearCredentialCache();const _0x16b114=[_0x385afa&&_0x524b75(0x1d4),_0x42fecd&&'OAuth\x20tokens'][_0x524b75(0x1e0)](Boolean)['join']('\x20and\x20');return console['log']('✓\x20'+_0x16b114+_0x524b75(0x1a0)+(_0x46cc2e?_0x524b75(0x1d5)+_0x46cc2e+')':'')),0x0;}else return console['log'](_0x524b75(0x1c9)+(_0x46cc2e?_0x524b75(0x1dd)+_0x46cc2e:'')),0x1;}}
1
+ const a7_0x1e1706=a7_0x4da9;(function(_0x16ac86,_0x51b7d7){const _0x52b71d=a7_0x4da9,_0x1c5fb2=_0x16ac86();while(!![]){try{const _0x34042d=parseInt(_0x52b71d(0x17b))/0x1+-parseInt(_0x52b71d(0x16f))/0x2+parseInt(_0x52b71d(0x16e))/0x3+-parseInt(_0x52b71d(0x146))/0x4*(-parseInt(_0x52b71d(0x15d))/0x5)+parseInt(_0x52b71d(0x152))/0x6+-parseInt(_0x52b71d(0x186))/0x7+-parseInt(_0x52b71d(0x17f))/0x8;if(_0x34042d===_0x51b7d7)break;else _0x1c5fb2['push'](_0x1c5fb2['shift']());}catch(_0x4710be){_0x1c5fb2['push'](_0x1c5fb2['shift']());}}}(a7_0x1172,0x9091f));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a7_0x4da9(_0x139f60,_0x11310f){_0x139f60=_0x139f60-0x145;const _0x117249=a7_0x1172();let _0x4da93a=_0x117249[_0x139f60];return _0x4da93a;}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import{isOAuthSupported}from'../core/oauth.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x1adc16 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a7_0x1172(){const _0xb76170=['logLevel','name','all','warn','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','error','execute','N/A','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','OAuth\x20(browser\x20login)','description','3688tWYWiU','profile','us01','auth:clear','Read\x20credential\x20from\x20','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','green','Read\x20credential\x20from\x20keychain','jobs','/app/mp/ak','✗\x20Validation\x20failed:\x20','site','2925684ermtFx','red','create','password','\x20(profile:\x20','Name:\x20','\x20for\x20profile:\x20','bold','\x20removed\x20from\x20keychain','log','OAuth\x20tokens','950AuKSJf','method','tdx:\x20auth\x20clear','System\x20keychain\x20is\x20not\x20available','last_name','getUserInfo','email','API\x20key\x20cannot\x20be\x20empty','Choose\x20authentication\x20method:','\x0aSetup\x20cancelled','trim','API\x20Key','\x27\x20registered','Setting\x20up\x20authentication\x20for\x20site:\x20','join','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Setup\x20API\x20key\x20authentication\x20interactively','22836vhtzLi','548272ZLdMPB','first_name','message','\x20and\x20','\x20--profile\x20','Credential\x20type:\x20OAuth','yellow','User:\x20','tdx\x20profile:\x20','oauth','apiKey','✓\x20Authentication\x20successful\x0a','944445QCCJrd','No\x20credential\x20found','No\x20credentials\x20found\x20in\x20keychain','status','1122936DwdLra','ERROR','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','Enter\x20your\x20TD\x20API\x20key:','filter','API\x20key','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','4257323rnwEKJ','auth:setup','Remove\x20API\x20key\x20from\x20system\x20keychain','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx','\x20(site:\x20','✓\x20Default\x20site\x20set\x20to\x20'];a7_0x1172=function(){return _0xb76170;};return a7_0x1172();}import{LogLevel}from'../utils/tdx-logger.js';import a7_0x3592a6 from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x1e1706(0x18e)]=a7_0x1e1706(0x187);['description']=a7_0x1e1706(0x16d);async['execute'](_0x5b0178){const _0x891da7=a7_0x1e1706,{options:_0x46bc15}=_0x5b0178,_0x14f5ec=_0x46bc15['profile'];console[_0x891da7(0x15b)](a7_0x3592a6[_0x891da7(0x159)]('tdx:\x20auth\x20setup'));const _0x24e5ab=_0x46bc15['site']||_0x891da7(0x148),_0x50f0c7=await promptSiteSelection(_0x24e5ab,_0x14f5ec,'Setup\x20cancelled');if(!_0x50f0c7)return 0x1;const _0x52e8c0=resolveSite(_0x50f0c7);if(isOAuthSupported(_0x52e8c0)){const _0x19d6e0=await a7_0x1adc16({'type':'select','name':_0x891da7(0x15e),'message':_0x891da7(0x165),'choices':[{'title':_0x891da7(0x196),'value':_0x891da7(0x178)},{'title':_0x891da7(0x168),'value':'apikey'}]});if(!_0x19d6e0['method'])return console[_0x891da7(0x15b)](_0x891da7(0x166)),0x1;if(_0x19d6e0['method']==='oauth')return await runOAuthLoginFlow(_0x52e8c0,_0x14f5ec,_0x46bc15[_0x891da7(0x18d)]??LogLevel[_0x891da7(0x180)]),0x0;}console[_0x891da7(0x15b)](_0x891da7(0x16a)+_0x52e8c0),console[_0x891da7(0x15b)](_0x891da7(0x189)),console[_0x891da7(0x15b)]('\x20\x20'+getConsoleUrl(_0x52e8c0,_0x891da7(0x14f)));const _0x5ca8f8=await a7_0x1adc16({'type':_0x891da7(0x155),'name':_0x891da7(0x179),'message':_0x891da7(0x182),'validate':_0x536341=>{const _0x4575d4=_0x891da7;if(!_0x536341||!_0x536341['trim']())return _0x4575d4(0x164);return!![];}});if(!_0x5ca8f8[_0x891da7(0x179)])return console[_0x891da7(0x15b)](_0x891da7(0x166)),0x1;const _0xa63590=_0x5ca8f8[_0x891da7(0x179)];console['log']('Validating\x20API\x20key...');try{const _0xe141e9=TDX[_0x891da7(0x154)]({'site':_0x52e8c0,'apiKey':_0xa63590[_0x891da7(0x167)](),'logLevel':_0x46bc15[_0x891da7(0x18d)]??LogLevel[_0x891da7(0x180)]}),_0x3f1168=await _0xe141e9['jobs'][_0x891da7(0x162)]();console[_0x891da7(0x15b)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3f1168[_0x891da7(0x163)]+')');const _0x4ea088=await isKeychainAvailable();_0x4ea088?(await saveAPIKeyAsync(_0xa63590[_0x891da7(0x167)](),_0x52e8c0,_0x14f5ec),console[_0x891da7(0x15b)](_0x891da7(0x185)+(_0x14f5ec?_0x891da7(0x156)+_0x14f5ec+')':''))):(console[_0x891da7(0x190)](a7_0x3592a6[_0x891da7(0x175)](_0x891da7(0x16c))),console[_0x891da7(0x190)](a7_0x3592a6[_0x891da7(0x175)](_0x891da7(0x191))));if(_0x14f5ec){const _0xe0afae={'site':_0x52e8c0};saveProfileToUserConfig(_0x14f5ec,_0xe0afae),console[_0x891da7(0x15b)]('✓\x20Profile\x20\x27'+_0x14f5ec+_0x891da7(0x169));}else saveDefaultSiteToUserConfig(_0x52e8c0),console[_0x891da7(0x15b)](_0x891da7(0x18c)+_0x52e8c0);const _0x4c7f45=_0x14f5ec?_0x891da7(0x173)+_0x14f5ec:'';return console[_0x891da7(0x15b)](),console[_0x891da7(0x15b)](_0x891da7(0x14b)),console['log'](_0x891da7(0x18a)+_0x4c7f45+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x891da7(0x15b)](_0x891da7(0x18a)+_0x4c7f45+_0x891da7(0x195)),0x0;}catch(_0x5a4b20){if(_0x5a4b20 instanceof HTTPClientError&&_0x5a4b20[_0x891da7(0x17e)]===0x191)return printAuthError(_0x5a4b20),0x1;return console[_0x891da7(0x192)](a7_0x3592a6['red'](_0x891da7(0x150)+(_0x5a4b20 instanceof Error?_0x5a4b20[_0x891da7(0x171)]:String(_0x5a4b20)))),console['error']('API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.'),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x1e1706(0x18e)]='auth';[a7_0x1e1706(0x145)]=a7_0x1e1706(0x181);async[a7_0x1e1706(0x193)](_0x1f2aa8){const _0xf50f8c=a7_0x1e1706,{options:_0x35ac01,tdx:_0x346314}=_0x1f2aa8,_0x532a2a=_0x35ac01[_0xf50f8c(0x151)],_0x3ecba0=_0x35ac01['profile'],_0x583297=_0x3ecba0?_0x3ecba0:_0xf50f8c(0x194);console[_0xf50f8c(0x15b)](_0xf50f8c(0x177)+_0x583297+_0xf50f8c(0x18b)+_0x532a2a+')');const _0x1c8d2a=await getOAuthTokens(_0x3ecba0);if(_0x1c8d2a)console[_0xf50f8c(0x15b)](_0xf50f8c(0x174)),console['log'](_0xf50f8c(0x14d)+(_0x3ecba0?_0xf50f8c(0x156)+_0x3ecba0+')':''));else{const _0x434220=await resolveAPIKeyAsync(_0x532a2a,_0x3ecba0);if(_0x434220){const {source:_0x5b6bd6,isDeprecated:_0x29ac0a}=_0x434220,_0x393eb7=_0xf50f8c(0x14a)+_0x5b6bd6;console[_0xf50f8c(0x15b)](_0x29ac0a?a7_0x3592a6[_0xf50f8c(0x175)](_0x393eb7):_0x393eb7);}else console[_0xf50f8c(0x15b)](a7_0x3592a6[_0xf50f8c(0x175)](_0xf50f8c(0x17c)));}try{const _0x153339=await _0x346314[_0xf50f8c(0x14e)][_0xf50f8c(0x162)]();return console[_0xf50f8c(0x15b)](a7_0x3592a6[_0xf50f8c(0x14c)](_0xf50f8c(0x17a))),console['log'](_0xf50f8c(0x176)+_0x153339[_0xf50f8c(0x163)]),(_0x153339[_0xf50f8c(0x170)]||_0x153339['last_name'])&&console[_0xf50f8c(0x15b)](_0xf50f8c(0x157)+[_0x153339[_0xf50f8c(0x170)],_0x153339[_0xf50f8c(0x161)]][_0xf50f8c(0x183)](Boolean)[_0xf50f8c(0x16b)]('\x20')),0x0;}catch(_0x2083e){return _0x2083e instanceof HTTPClientError&&_0x2083e['status']===0x191?printAuthError(_0x2083e,!![],_0x3ecba0):console['error'](a7_0x3592a6[_0xf50f8c(0x153)](_0xf50f8c(0x150)+(_0x2083e instanceof Error?_0x2083e[_0xf50f8c(0x171)]:String(_0x2083e)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x1e1706(0x18e)]=a7_0x1e1706(0x149);['description']=a7_0x1e1706(0x188);async[a7_0x1e1706(0x193)](_0x180fd3){const _0x4b352f=a7_0x1e1706,{options:_0x3330b8}=_0x180fd3,_0x47ff69=_0x3330b8[_0x4b352f(0x147)];console[_0x4b352f(0x15b)](a7_0x3592a6['bold'](_0x4b352f(0x15f)));const _0x4ba704=await isKeychainAvailable();if(!_0x4ba704)return console[_0x4b352f(0x192)](a7_0x3592a6[_0x4b352f(0x153)](_0x4b352f(0x160))),0x1;const [_0x3e314b,_0x10a4c8]=await Promise[_0x4b352f(0x18f)]([deleteKeychainAPIKey(_0x47ff69),deleteOAuthTokens(_0x47ff69)]);if(_0x3e314b||_0x10a4c8){clearCredentialCache();const _0x24e8b3=[_0x3e314b&&_0x4b352f(0x184),_0x10a4c8&&_0x4b352f(0x15c)][_0x4b352f(0x183)](Boolean)['join'](_0x4b352f(0x172));return console[_0x4b352f(0x15b)]('✓\x20'+_0x24e8b3+_0x4b352f(0x15a)+(_0x47ff69?_0x4b352f(0x156)+_0x47ff69+')':'')),0x0;}else return console[_0x4b352f(0x15b)](_0x4b352f(0x17d)+(_0x47ff69?_0x4b352f(0x158)+_0x47ff69:'')),0x1;}}
@@ -1 +1 @@
1
- function a8_0x30a7(_0x58adce,_0x16c8c6){_0x58adce=_0x58adce-0xd9;const _0xe7f6d7=a8_0xe7f6();let _0x30a781=_0xe7f6d7[_0x58adce];return _0x30a781;}const a8_0x506186=a8_0x30a7;(function(_0x1891e1,_0x1c1071){const _0x4d34b6=a8_0x30a7,_0x2341ee=_0x1891e1();while(!![]){try{const _0x279e04=-parseInt(_0x4d34b6(0xec))/0x1*(parseInt(_0x4d34b6(0xf3))/0x2)+-parseInt(_0x4d34b6(0xed))/0x3+parseInt(_0x4d34b6(0xde))/0x4*(parseInt(_0x4d34b6(0x101))/0x5)+-parseInt(_0x4d34b6(0xe8))/0x6+-parseInt(_0x4d34b6(0xeb))/0x7+parseInt(_0x4d34b6(0xdc))/0x8+parseInt(_0x4d34b6(0xea))/0x9*(parseInt(_0x4d34b6(0xdf))/0xa);if(_0x279e04===_0x1c1071)break;else _0x2341ee['push'](_0x2341ee['shift']());}catch(_0x2700f5){_0x2341ee['push'](_0x2341ee['shift']());}}}(a8_0xe7f6,0xbdd66));import{BaseCommand}from'./command.js';import{resolveSite}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{isKeychainAvailable}from'../core/keychain.js';import{saveOAuthTokens}from'../core/oauth-keychain.js';function a8_0xe7f6(){const _0x272ab1=['site','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','4bazmRT','name','us01','getUserInfo','Login\x20via\x20OAuth\x20(opens\x20browser)','\x20\x20tdx','log','Authenticating\x20via\x20OAuth\x20for\x20site:\x20','Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.','✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain','profile','✓\x20Profile\x20\x27','email','/oauth/authorize','2155EzLKwt','tdx:\x20auth\x20login','Validating\x20OAuth\x20tokens...','\x20--profile\x20','create','9691864ZUEdYT','✓\x20Authentication\x20successful\x20(User:\x20','3428yYHUqu','40mdzStk','Opening\x20browser\x20for\x20authentication...','jobs','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','green','System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20','OAuth\x20login\x20is\x20not\x20yet\x20available\x20for\x20site:\x20','Login\x20cancelled','bold','7209246iMXOxO','ERROR','5663853WENoTa','1149834FQNDgQ','456257UHKjpu','3126681zTzGUk','description','OAuth\x20is\x20currently\x20supported\x20on\x20dev-us01\x20and\x20dev-eu01\x20only.\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'];a8_0xe7f6=function(){return _0x272ab1;};return a8_0xe7f6();}import{startOAuthFlow,isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a8_0x29b0de from'chalk';export async function runOAuthLoginFlow(_0x792864,_0x125b88,_0x6c439d){const _0x2b7928=a8_0x30a7;if(!isOAuthSupported(_0x792864))throw new Error(_0x2b7928(0xe5)+_0x792864+'.\x20'+_0x2b7928(0xef)+_0x2b7928(0xfb));const _0x11b5a9=await isKeychainAvailable();if(!_0x11b5a9)throw new Error(_0x2b7928(0xe4)+_0x2b7928(0xfb));const _0x2082c0=getConsoleUrl(_0x792864);console[_0x2b7928(0xf9)](_0x2b7928(0xe0)),console['log']('\x20\x20'+_0x2082c0+_0x2b7928(0x100)),console[_0x2b7928(0xf9)](_0x2b7928(0xf2));const _0xc990b2=await startOAuthFlow(_0x792864);console[_0x2b7928(0xf9)](_0x2b7928(0xd9));const _0x280596=TDX[_0x2b7928(0xdb)]({'site':_0x792864,'accessToken':_0xc990b2['access_token'],'logLevel':_0x6c439d??LogLevel[_0x2b7928(0xe9)]}),_0x4dfbd9=await _0x280596[_0x2b7928(0xe1)][_0x2b7928(0xf6)]();console['log'](a8_0x29b0de[_0x2b7928(0xe3)](_0x2b7928(0xdd)+_0x4dfbd9[_0x2b7928(0xff)]+')')),await saveOAuthTokens(_0xc990b2,_0x125b88),console[_0x2b7928(0xf9)](_0x2b7928(0xfc)+(_0x125b88?'\x20(profile:\x20'+_0x125b88+')':''));if(_0x125b88){const _0x584c25={'site':_0x792864};saveProfileToUserConfig(_0x125b88,_0x584c25),console[_0x2b7928(0xf9)](_0x2b7928(0xfe)+_0x125b88+'\x27\x20registered');}const _0x12122e=_0x125b88?_0x2b7928(0xda)+_0x125b88:'';console[_0x2b7928(0xf9)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console['log'](_0x2b7928(0xf8)+_0x12122e+_0x2b7928(0xf0)),console[_0x2b7928(0xf9)](_0x2b7928(0xf8)+_0x12122e+_0x2b7928(0xe2));}export class AuthLoginCommand extends BaseCommand{[a8_0x506186(0xf4)]='auth:login';[a8_0x506186(0xee)]=a8_0x506186(0xf7);async['execute'](_0xffa4e2){const _0x2db93b=a8_0x506186,{options:_0x10b3be}=_0xffa4e2,_0xbee949=_0x10b3be[_0x2db93b(0xfd)];console['log'](a8_0x29b0de[_0x2db93b(0xe7)](_0x2db93b(0x102)));const _0x24a1a4=_0x10b3be[_0x2db93b(0xf1)]||_0x2db93b(0xf5),_0x1b384f=await promptSiteSelection(_0x24a1a4,_0xbee949,_0x2db93b(0xe6));if(!_0x1b384f)return 0x1;const _0x351de0=resolveSite(_0x1b384f);return console[_0x2db93b(0xf9)](_0x2db93b(0xfa)+_0x351de0),await runOAuthLoginFlow(_0x351de0,_0xbee949,_0x10b3be['logLevel']??LogLevel['ERROR']),0x0;}}
1
+ const a8_0x58aeb6=a8_0x40e6;(function(_0x360e00,_0x3d2ac2){const _0xee5394=a8_0x40e6,_0x412df6=_0x360e00();while(!![]){try{const _0x35a289=parseInt(_0xee5394(0xcb))/0x1*(parseInt(_0xee5394(0xd9))/0x2)+-parseInt(_0xee5394(0xbe))/0x3*(-parseInt(_0xee5394(0xde))/0x4)+parseInt(_0xee5394(0xc0))/0x5*(parseInt(_0xee5394(0xc6))/0x6)+-parseInt(_0xee5394(0xc3))/0x7*(-parseInt(_0xee5394(0xd6))/0x8)+parseInt(_0xee5394(0xd7))/0x9*(-parseInt(_0xee5394(0xc4))/0xa)+parseInt(_0xee5394(0xda))/0xb+-parseInt(_0xee5394(0xdc))/0xc*(parseInt(_0xee5394(0xc7))/0xd);if(_0x35a289===_0x3d2ac2)break;else _0x412df6['push'](_0x412df6['shift']());}catch(_0xb06a88){_0x412df6['push'](_0x412df6['shift']());}}}(a8_0x4920,0x3738b));function a8_0x40e6(_0x1f2bbe,_0x24c82d){_0x1f2bbe=_0x1f2bbe-0xb7;const _0x492070=a8_0x4920();let _0x40e6ef=_0x492070[_0x1f2bbe];return _0x40e6ef;}function a8_0x4920(){const _0xba229e=['Opening\x20browser\x20for\x20authentication...','4197AvwDSu','Validating\x20OAuth\x20tokens...','18385rPbJzM','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','site','7MYeiLd','12790RMmfVU','log','690QzPdhO','208ThnzNs','auth:login','\x20(profile:\x20','\x20--profile\x20','2RzjNxR','System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20','execute','getUserInfo','Login\x20cancelled','Authenticating\x20via\x20OAuth\x20for\x20site:\x20','bold','access_token','create','Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.','OAuth\x20login\x20is\x20not\x20yet\x20available\x20for\x20site:\x20','1329256GIlEoT','2583hWVisb','\x20\x20tdx','122810HOzZEl','2807827etaqVx','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','333876EZpacT','jobs','204QojyDG','✓\x20Profile\x20\x27','ERROR','description','Login\x20via\x20OAuth\x20(opens\x20browser)','green','/oauth/authorize','logLevel','email','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'];a8_0x4920=function(){return _0xba229e;};return a8_0x4920();}import{BaseCommand}from'./command.js';import{resolveSite}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{isKeychainAvailable}from'../core/keychain.js';import{saveOAuthTokens}from'../core/oauth-keychain.js';import{startOAuthFlow,isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a8_0x43c354 from'chalk';export async function runOAuthLoginFlow(_0x4bcba7,_0x21b72d,_0x1d79fa){const _0x57c162=a8_0x40e6;if(!isOAuthSupported(_0x4bcba7))throw new Error(_0x57c162(0xd5)+_0x4bcba7+'.\x20'+'OAuth\x20is\x20currently\x20supported\x20on\x20dev-us01\x20and\x20dev-eu01\x20only.\x20'+_0x57c162(0xd4));const _0x45e352=await isKeychainAvailable();if(!_0x45e352)throw new Error(_0x57c162(0xcc)+_0x57c162(0xd4));const _0x2e254=getConsoleUrl(_0x4bcba7);console[_0x57c162(0xc5)](_0x57c162(0xbd)),console[_0x57c162(0xc5)]('\x20\x20'+_0x2e254+_0x57c162(0xb9)),console[_0x57c162(0xc5)](_0x57c162(0xdb));const _0x19f4f2=await startOAuthFlow(_0x4bcba7);console[_0x57c162(0xc5)](_0x57c162(0xbf));const _0xf62da9=TDX[_0x57c162(0xd3)]({'site':_0x4bcba7,'accessToken':_0x19f4f2[_0x57c162(0xd2)],'logLevel':_0x1d79fa??LogLevel[_0x57c162(0xe0)]}),_0x6f6910=await _0xf62da9[_0x57c162(0xdd)][_0x57c162(0xce)]();console[_0x57c162(0xc5)](a8_0x43c354[_0x57c162(0xb8)]('✓\x20Authentication\x20successful\x20(User:\x20'+_0x6f6910[_0x57c162(0xbb)]+')')),await saveOAuthTokens(_0x19f4f2,_0x21b72d),console['log']('✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain'+(_0x21b72d?_0x57c162(0xc9)+_0x21b72d+')':''));if(_0x21b72d){const _0x597330={'site':_0x4bcba7};saveProfileToUserConfig(_0x21b72d,_0x597330),console[_0x57c162(0xc5)](_0x57c162(0xdf)+_0x21b72d+'\x27\x20registered');}const _0x388375=_0x21b72d?_0x57c162(0xca)+_0x21b72d:'';console[_0x57c162(0xc5)](),console[_0x57c162(0xc5)](_0x57c162(0xc1)),console[_0x57c162(0xc5)](_0x57c162(0xd8)+_0x388375+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x57c162(0xc5)](_0x57c162(0xd8)+_0x388375+_0x57c162(0xbc));}export class AuthLoginCommand extends BaseCommand{['name']=a8_0x58aeb6(0xc8);[a8_0x58aeb6(0xe1)]=a8_0x58aeb6(0xb7);async[a8_0x58aeb6(0xcd)](_0x45a040){const _0x2ced3b=a8_0x58aeb6,{options:_0x45251f}=_0x45a040,_0x2a9811=_0x45251f['profile'];console[_0x2ced3b(0xc5)](a8_0x43c354[_0x2ced3b(0xd1)]('tdx:\x20auth\x20login'));const _0x30c120=_0x45251f[_0x2ced3b(0xc2)]||'us01',_0x295a4d=await promptSiteSelection(_0x30c120,_0x2a9811,_0x2ced3b(0xcf));if(!_0x295a4d)return 0x1;const _0x3dc6e9=resolveSite(_0x295a4d);return console['log'](_0x2ced3b(0xd0)+_0x3dc6e9),await runOAuthLoginFlow(_0x3dc6e9,_0x2a9811,_0x45251f[_0x2ced3b(0xba)]??LogLevel[_0x2ced3b(0xe0)]),0x0;}}