@treasuredata/tdx 0.26.1 → 0.26.2

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 (167) 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/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/mcp-command.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/schedule-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/passthrough-server.js +1 -1
  66. package/dist/proxy/sse-usage-parser.js +1 -1
  67. package/dist/sdk/agent/agent-config.js +1 -1
  68. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/test/evaluator.js +1 -1
  71. package/dist/sdk/agent/test/executor.js +1 -1
  72. package/dist/sdk/agent/test/index.js +1 -1
  73. package/dist/sdk/agent/test/output.js +1 -1
  74. package/dist/sdk/agent/test/parser.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/client/cdp-api-client.js +1 -1
  77. package/dist/sdk/client/endpoints.js +1 -1
  78. package/dist/sdk/client/engage-api-client.js +1 -1
  79. package/dist/sdk/client/http-client.js +1 -1
  80. package/dist/sdk/client/llm-api-client.js +1 -1
  81. package/dist/sdk/client/rate-limiter.js +1 -1
  82. package/dist/sdk/client/td-api-client.js +1 -1
  83. package/dist/sdk/client/trino-api-client.js +1 -1
  84. package/dist/sdk/client/workflow-client.js +1 -1
  85. package/dist/sdk/connection-validator.js +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/engage.js +1 -1
  88. package/dist/sdk/errors.js +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/io/index.js +1 -1
  91. package/dist/sdk/io/node-filesystem.js +1 -1
  92. package/dist/sdk/job.js +1 -1
  93. package/dist/sdk/journey.js +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-factors.js +1 -1
  98. package/dist/sdk/personalization.js +1 -1
  99. package/dist/sdk/query/index.js +1 -1
  100. package/dist/sdk/query/sql-parser.js +1 -1
  101. package/dist/sdk/realtime.js +1 -1
  102. package/dist/sdk/schedule.js +1 -1
  103. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  104. package/dist/sdk/segment/fields-display.js +1 -1
  105. package/dist/sdk/segment/file-discovery.js +1 -1
  106. package/dist/sdk/segment/journey-utils.js +1 -1
  107. package/dist/sdk/segment/journey-validator.js +1 -1
  108. package/dist/sdk/segment/journey-yaml.js +1 -1
  109. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  110. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  111. package/dist/sdk/segment/pull-workflow.js +1 -1
  112. package/dist/sdk/segment/push-recovery.js +1 -1
  113. package/dist/sdk/segment/push-workflow.js +1 -1
  114. package/dist/sdk/segment/resolution-context.js +1 -1
  115. package/dist/sdk/segment/segment-path-parser.js +1 -1
  116. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  117. package/dist/sdk/segment/target-resolution.js +1 -1
  118. package/dist/sdk/segment/tdx-config.js +1 -1
  119. package/dist/sdk/segment/validate-files.js +1 -1
  120. package/dist/sdk/segment/yaml-validator.js +1 -1
  121. package/dist/sdk/segment.js +1 -1
  122. package/dist/sdk/types/index.js +1 -1
  123. package/dist/sdk/types/progress.js +1 -1
  124. package/dist/sdk/user.js +1 -1
  125. package/dist/sdk/util/format-detector.js +1 -1
  126. package/dist/sdk/util/formatters.js +1 -1
  127. package/dist/sdk/util/index.js +1 -1
  128. package/dist/sdk/util/tree-formatter.js +1 -1
  129. package/dist/sdk/workflow/archive-validation.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.js +1 -1
  148. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  149. package/dist/utils/logger/formatters/index.js +1 -1
  150. package/dist/utils/logger/handlers/console-handler.js +1 -1
  151. package/dist/utils/logger/handlers/file-handler.js +1 -1
  152. package/dist/utils/logger/handlers/index.js +1 -1
  153. package/dist/utils/logger/handlers/null-handler.js +1 -1
  154. package/dist/utils/logger/index.js +1 -1
  155. package/dist/utils/logger/logger.js +1 -1
  156. package/dist/utils/logger/types.js +1 -1
  157. package/dist/utils/option-validation.js +1 -1
  158. package/dist/utils/port.js +1 -1
  159. package/dist/utils/process.js +1 -1
  160. package/dist/utils/prompt.js +1 -1
  161. package/dist/utils/spinner.js +1 -1
  162. package/dist/utils/sse-parser.js +1 -1
  163. package/dist/utils/string-utils.js +1 -1
  164. package/dist/utils/table-ref-parser.js +1 -1
  165. package/dist/utils/tdx-logger.js +1 -1
  166. package/dist/utils/version-check.js +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- const a3_0x1f4a86=a3_0x1c25;(function(_0x34b73f,_0x1d8d8d){const _0x4379cc=a3_0x1c25,_0x40fc65=_0x34b73f();while(!![]){try{const _0x2591cc=parseInt(_0x4379cc(0x152))/0x1*(-parseInt(_0x4379cc(0x159))/0x2)+parseInt(_0x4379cc(0x14c))/0x3*(parseInt(_0x4379cc(0x151))/0x4)+-parseInt(_0x4379cc(0x14a))/0x5+-parseInt(_0x4379cc(0x14d))/0x6*(parseInt(_0x4379cc(0x162))/0x7)+-parseInt(_0x4379cc(0x15a))/0x8+-parseInt(_0x4379cc(0x161))/0x9+parseInt(_0x4379cc(0x143))/0xa;if(_0x2591cc===_0x1d8d8d)break;else _0x40fc65['push'](_0x40fc65['shift']());}catch(_0x32bfd8){_0x40fc65['push'](_0x40fc65['shift']());}}}(a3_0x39b6,0xb37b1));import{BaseCommand}from'./command.js';function a3_0x39b6(){const _0xca1336=['activations','Error:\x20','✔\x20Found\x20','6545421RmngVu','64547LytSDB','verbose','execute','segment','29889560OLZQCr','Resolving\x20child\x20segment\x20\x27','\x27...','Resolved\x20parent\x20ID:\x20','name','resolveSegmentId','listActivations','2418695JhgdTY','Child\x20name:\x20','171BzLyWd','30gFGwdQ','Site:\x20','data','length','6012IQbIlb','1087PpNURa','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','cause','resolveParentId','\x20activation','description','Error:\x20Segment\x20name\x20is\x20required','736qTKcix','5458760FRhUQR','error','Listing\x20activations\x20for\x20segment\x20\x27','message'];a3_0x39b6=function(){return _0xca1336;};return a3_0x39b6();}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a3_0x1c25(_0x4ba9db,_0x5a4db7){_0x4ba9db=_0x4ba9db-0x140;const _0x39b636=a3_0x39b6();let _0x1c2538=_0x39b636[_0x4ba9db];return _0x1c2538;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x1f4a86(0x147)]=a3_0x1f4a86(0x15e);[a3_0x1f4a86(0x157)]='List\x20activations\x20for\x20a\x20segment';async[a3_0x1f4a86(0x141)](_0x55f8c6){const _0x4282d7=a3_0x1f4a86,{options:_0x23f5ab,args:_0x1af432,tdx:_0x15bfd2}=_0x55f8c6;if(_0x1af432['length']===0x0)return console['error'](_0x4282d7(0x158)),console[_0x4282d7(0x15b)](_0x4282d7(0x153)),0x1;try{const {parentId:_0x157267,childId:_0x321890}=parseSegmentRef(_0x1af432[0x0]);if(!_0x321890)return console[_0x4282d7(0x15b)]('Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations'),console[_0x4282d7(0x15b)](_0x4282d7(0x153)),0x1;_0x23f5ab['verbose']&&(console['error'](_0x4282d7(0x14e)+_0x23f5ab['site']),console['error']('Parent\x20name:\x20'+_0x157267),console['error'](_0x4282d7(0x14b)+_0x321890));const _0x460053=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x157267+_0x4282d7(0x145),()=>_0x15bfd2[_0x4282d7(0x142)][_0x4282d7(0x155)](_0x157267),{'verbose':_0x23f5ab['verbose']}),_0x1b151a=_0x460053[_0x4282d7(0x14f)];_0x23f5ab[_0x4282d7(0x140)]&&console[_0x4282d7(0x15b)](_0x4282d7(0x146)+_0x1b151a);const _0x29acf3=await withSpinner(_0x4282d7(0x144)+_0x321890+_0x4282d7(0x145),()=>_0x15bfd2[_0x4282d7(0x142)][_0x4282d7(0x148)](_0x1b151a,_0x321890),{'verbose':_0x23f5ab[_0x4282d7(0x140)]}),_0x2670cf=_0x29acf3['data'];_0x23f5ab[_0x4282d7(0x140)]&&console[_0x4282d7(0x15b)]('Resolved\x20child\x20ID:\x20'+_0x2670cf);const _0x374387=await withSpinner(_0x4282d7(0x15c)+_0x321890+'\x27...',()=>_0x15bfd2[_0x4282d7(0x142)][_0x4282d7(0x149)](_0x1b151a,_0x2670cf),{'verbose':_0x23f5ab['verbose']}),_0xcb8468=_0x374387[_0x4282d7(0x14f)];return console[_0x4282d7(0x15b)](_0x4282d7(0x160)+_0xcb8468['length']+_0x4282d7(0x156)+(_0xcb8468[_0x4282d7(0x150)]!==0x1?'s':'')),await handleSDKOutput(_0xcb8468,_0x23f5ab),0x0;}catch(_0x27bf92){if(_0x27bf92 instanceof SDKError)return console[_0x4282d7(0x15b)](_0x4282d7(0x15f)+_0x27bf92[_0x4282d7(0x15d)]),_0x27bf92[_0x4282d7(0x154)]&&console[_0x4282d7(0x15b)]('\x20\x20Cause:\x20'+_0x27bf92[_0x4282d7(0x154)]),0x1;throw _0x27bf92;}}}
1
+ const a3_0x298da5=a3_0x57c9;(function(_0xfcbcd2,_0x219dec){const _0x5cb858=a3_0x57c9,_0x57d99a=_0xfcbcd2();while(!![]){try{const _0x567163=-parseInt(_0x5cb858(0x162))/0x1+-parseInt(_0x5cb858(0x164))/0x2+parseInt(_0x5cb858(0x14d))/0x3+parseInt(_0x5cb858(0x151))/0x4+parseInt(_0x5cb858(0x152))/0x5*(parseInt(_0x5cb858(0x155))/0x6)+parseInt(_0x5cb858(0x146))/0x7+parseInt(_0x5cb858(0x160))/0x8;if(_0x567163===_0x219dec)break;else _0x57d99a['push'](_0x57d99a['shift']());}catch(_0x158820){_0x57d99a['push'](_0x57d99a['shift']());}}}(a3_0x2d10,0xe0f62));function a3_0x57c9(_0x4623a1,_0x5d3374){_0x4623a1=_0x4623a1-0x146;const _0x2d1031=a3_0x2d10();let _0x57c99f=_0x2d1031[_0x4623a1];return _0x57c99f;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a3_0x2d10(){const _0xfe9d2d=['error','Resolved\x20parent\x20ID:\x20','resolveSegmentId','data','message','name','Site:\x20','verbose','2367224wminRS','execute','1109761hZWOzq','Child\x20name:\x20','502130QsNEGj','description','listActivations','Error:\x20','\x20\x20Cause:\x20','6811182ZROuuO','site','Error:\x20Segment\x20name\x20is\x20required','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','resolveParentId','cause','Resolved\x20child\x20ID:\x20','759354XmMBYW','segment','length','\x27...','1832664KVKRGA','975EUCtCs','activations','Parent\x20name:\x20','9294HONzsD','✔\x20Found\x20','\x20activation'];a3_0x2d10=function(){return _0xfe9d2d;};return a3_0x2d10();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x298da5(0x15d)]=a3_0x298da5(0x153);[a3_0x298da5(0x165)]='List\x20activations\x20for\x20a\x20segment';async[a3_0x298da5(0x161)](_0x146bf8){const _0x71a47f=a3_0x298da5,{options:_0x1f30c4,args:_0x6c17a8,tdx:_0x1d767f}=_0x146bf8;if(_0x6c17a8[_0x71a47f(0x14f)]===0x0)return console[_0x71a47f(0x158)](_0x71a47f(0x148)),console[_0x71a47f(0x158)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x572925,childId:_0x1e2508}=parseSegmentRef(_0x6c17a8[0x0]);if(!_0x1e2508)return console['error']('Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations'),console[_0x71a47f(0x158)](_0x71a47f(0x149)),0x1;_0x1f30c4[_0x71a47f(0x15f)]&&(console[_0x71a47f(0x158)](_0x71a47f(0x15e)+_0x1f30c4[_0x71a47f(0x147)]),console['error'](_0x71a47f(0x154)+_0x572925),console[_0x71a47f(0x158)](_0x71a47f(0x163)+_0x1e2508));const _0x7191c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x572925+'\x27...',()=>_0x1d767f[_0x71a47f(0x14e)][_0x71a47f(0x14a)](_0x572925),{'verbose':_0x1f30c4['verbose']}),_0x23bead=_0x7191c[_0x71a47f(0x15b)];_0x1f30c4[_0x71a47f(0x15f)]&&console[_0x71a47f(0x158)](_0x71a47f(0x159)+_0x23bead);const _0x3562d1=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x1e2508+'\x27...',()=>_0x1d767f['segment'][_0x71a47f(0x15a)](_0x23bead,_0x1e2508),{'verbose':_0x1f30c4['verbose']}),_0x3dc078=_0x3562d1[_0x71a47f(0x15b)];_0x1f30c4[_0x71a47f(0x15f)]&&console[_0x71a47f(0x158)](_0x71a47f(0x14c)+_0x3dc078);const _0x2e1899=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0x1e2508+_0x71a47f(0x150),()=>_0x1d767f[_0x71a47f(0x14e)][_0x71a47f(0x166)](_0x23bead,_0x3dc078),{'verbose':_0x1f30c4['verbose']}),_0x41cb6e=_0x2e1899['data'];return console[_0x71a47f(0x158)](_0x71a47f(0x156)+_0x41cb6e[_0x71a47f(0x14f)]+_0x71a47f(0x157)+(_0x41cb6e[_0x71a47f(0x14f)]!==0x1?'s':'')),await handleSDKOutput(_0x41cb6e,_0x1f30c4),0x0;}catch(_0x47f38f){if(_0x47f38f instanceof SDKError)return console['error'](_0x71a47f(0x167)+_0x47f38f[_0x71a47f(0x15c)]),_0x47f38f[_0x71a47f(0x14b)]&&console[_0x71a47f(0x158)](_0x71a47f(0x168)+_0x47f38f['cause']),0x1;throw _0x47f38f;}}}
@@ -1 +1 @@
1
- const a4_0x57942b=a4_0x1193;(function(_0x6bb450,_0x929fef){const _0x5943f6=a4_0x1193,_0x71768b=_0x6bb450();while(!![]){try{const _0x4487e3=parseInt(_0x5943f6(0xf6))/0x1*(-parseInt(_0x5943f6(0x11e))/0x2)+-parseInt(_0x5943f6(0xff))/0x3*(-parseInt(_0x5943f6(0x142))/0x4)+parseInt(_0x5943f6(0x12f))/0x5*(parseInt(_0x5943f6(0x140))/0x6)+-parseInt(_0x5943f6(0x129))/0x7*(parseInt(_0x5943f6(0x10c))/0x8)+-parseInt(_0x5943f6(0xb7))/0x9*(parseInt(_0x5943f6(0xc8))/0xa)+-parseInt(_0x5943f6(0x9a))/0xb+-parseInt(_0x5943f6(0x121))/0xc*(-parseInt(_0x5943f6(0xb6))/0xd);if(_0x4487e3===_0x929fef)break;else _0x71768b['push'](_0x71768b['shift']());}catch(_0x2b84c8){_0x71768b['push'](_0x71768b['shift']());}}}(a4_0x11e7,0x224f4));import a4_0x1a470e from'chalk';function a4_0x11e7(){const _0x280d3c=['\x20\x20Prompts:\x20','total','error','knowledgeBases','agents','log','site','Using\x20context\x20project:\x20','updated','gray','context','✔\x20Context\x20set:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Cloning\x20\x22','New\x20project:\x20','counts','\x22\x20to\x20a\x20different\x20profile','newProjectId','\x20\x20Agent\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x20--profile\x20','Summary:','Analyzing\x20project\x20\x22','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','272287nwDxIb','\x22\x20to\x20new\x20project\x20\x22','\x0aWrite\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','source','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x0aPush\x20','Failed\x20to\x20push\x20agent:\x20','pullProject','21iVzWWP','repeat','\x22\x20to\x20\x22','push','isNew','\x27\x20to\x20create\x20the\x20folder\x20structure.','yellow','diff','\x20\x20Target:\x20','Source:\x20','Dry\x20run\x20-\x20no\x20changes\x20made','pushProject','session','2008uriNhu','\x20\x20Knowledge\x20Bases:\x20','\x20resources\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','\x0aProject\x20pushed\x20with\x20errors','agent:pull','Would\x20clone:','Writing\x20files...','Dry\x20run\x20-\x20no\x20files\x20written','\x20created','\x20\x20tdx\x20agent\x20clone\x20agents/','\x20total','textKnowledgeBases','no_local_folder','\x20\x20Agents:\x20','Status:\x20','\x0a✔\x20Pushed\x20','Cancelled','2KwRuHh','outputPath','\x20\x20Text\x20Knowledge\x20Base\x20\x22','9191844udzwHA','experimentalArtifacts','Pushing\x20agent\x20from\x20\x22','-\x20nothing\x20pushed','prompts','\x20\x20Integration\x20\x22','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','5579IFXNJE','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27','Using\x20current\x20project:\x20','projectId','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','10uvkcyl','New\x20project\x20name\x20is\x20required','-\x20no\x20files\x20written','Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','name','\x0aChanges\x20to\x20integration\x20\x27','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','utf-8','projectName','Agent\x20pulled\x20successfully','errors','message','Agent:\x20','experimentalKnowledgeBases','\x20successfully','cloneProject','\x0aError:','493530rpIWTJ','\x20updated','46108uMOvWT','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','Using\x20project\x20from\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','dryRun','\x20=\x20','MISSING_ARGUMENT','\x0aChanges:','Pushing\x20to\x20project...','created','Pulling\x20agent\x20\x22','\x20new','join','Chat:\x20','parse','action','Project\x20cloned\x20with\x20errors','tdx.json','\x0aPull\x20summary\x20for\x20\x27','1600170XlyysO','unchanged','llmProject','\x20\x20Source:\x20','\x20\x20Experimental\x20Artifacts:\x20','execute','force','sourceProjectName','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Would\x20push\x20agent:\x20','\x20\x20Integrations:\x20','profile','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','\x20resources?','agent.yml','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','new','newProjectName','yes','\x22...','\x20\x20Knowledge\x20Base\x20\x22','dirname','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','\x20unchanged','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','Using\x20local\x20project:\x20','cyan','13IroehU','3501AhCEaw','\x20--name\x20','llm','\x20\x20Experimental\x20Artifact\x20\x22','INVALID_ARGUMENT','llm_project','\x20|\x20','integrations','\x20\x20Experimental\x20Knowledge\x20Base\x20\x22','\x20\x20Prompt\x20\x22','agentId','\x20files\x20to\x20','Clone\x20\x22','\x20changed','\x22\x20from\x20project\x20\x22','\x20files?','description','6500jiaBWz','agent:clone','Errors:','Would\x20pull\x20agent:\x20','dim','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','reason','agentName','\x22:\x20','output','green','Analyzing\x20changes\x20to\x20push...','agent:push','<new-name>','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','\x20\x20tdx\x20agent\x20pull\x20','\x0aChanges\x20to\x20prompt\x20\x27','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','cwd','\x20\x20Text\x20Knowledge\x20Bases:\x20'];a4_0x11e7=function(){return _0x280d3c;};return a4_0x11e7();}import a4_0x5306a4 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{findAgentConfigPath,resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x1cef01){const _0x5db641=a4_0x1193,_0x575022=[];if(_0x1cef01['total']!==undefined)_0x575022[_0x5db641(0x102)](_0x1cef01[_0x5db641(0xde)]+_0x5db641(0x117));if(_0x1cef01['new']!==undefined&&_0x1cef01[_0x5db641(0xab)]>0x0)_0x575022[_0x5db641(0x102)](a4_0x1a470e[_0x5db641(0xd2)](_0x1cef01[_0x5db641(0xab)]+_0x5db641(0x14d)));if(_0x1cef01[_0x5db641(0x14b)]!==undefined&&_0x1cef01[_0x5db641(0x14b)]>0x0)_0x575022[_0x5db641(0x102)](a4_0x1a470e[_0x5db641(0xd2)](_0x1cef01[_0x5db641(0x14b)]+_0x5db641(0x115)));if(_0x1cef01['updated']!==undefined&&_0x1cef01['updated']>0x0)_0x575022[_0x5db641(0x102)](a4_0x1a470e[_0x5db641(0x105)](_0x1cef01[_0x5db641(0xe5)]+_0x5db641(0x141)));if(_0x1cef01[_0x5db641(0x9b)]!==undefined&&_0x1cef01[_0x5db641(0x9b)]>0x0)_0x575022['push'](a4_0x1a470e[_0x5db641(0xe6)](_0x1cef01[_0x5db641(0x9b)]+_0x5db641(0xb2)));if(_0x1cef01[_0x5db641(0x139)]!==undefined&&_0x1cef01[_0x5db641(0x139)]>0x0)_0x575022['push'](a4_0x1a470e['red'](_0x1cef01[_0x5db641(0x139)]+'\x20errors'));return _0x575022['join'](',\x20');}function displayDiffs(_0xfab9a1,_0x369c43,_0x8bf0dc,_0x13a694,_0xc3ffdc,_0xb08ba8,_0x5ea525){const _0x537403=a4_0x1193;for(const _0x1b74a1 of _0xfab9a1){if(_0x1b74a1[_0x537403(0x106)]){const _0x3ba20c=_0x1b74a1[_0x537403(0xcf)]||_0x1b74a1['name'];console[_0x537403(0xe2)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x3ba20c+'\x27:'),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)),console[_0x537403(0xe2)](_0x1b74a1[_0x537403(0x106)]),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c));}}for(const _0x1c79f of _0x369c43){_0x1c79f[_0x537403(0x106)]&&(console[_0x537403(0xe2)](_0x537403(0xcd)+_0x1c79f[_0x537403(0x133)]+'\x27:'),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)),console['log'](_0x1c79f[_0x537403(0x106)]),console[_0x537403(0xe2)]('─'['repeat'](0x3c)));}for(const _0x228df6 of _0x8bf0dc){_0x228df6['diff']&&(console['log'](_0x537403(0xf5)+_0x228df6[_0x537403(0x133)]+'\x27:'),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)),console[_0x537403(0xe2)](_0x228df6[_0x537403(0x106)]),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)));}for(const _0xfbfabc of _0x13a694){_0xfbfabc['diff']&&(console[_0x537403(0xe2)](_0x537403(0xd9)+_0xfbfabc[_0x537403(0x133)]+'\x27:'),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)),console[_0x537403(0xe2)](_0xfbfabc[_0x537403(0x106)]),console['log']('─'[_0x537403(0x100)](0x3c)));}for(const _0x1a356e of _0xc3ffdc){_0x1a356e[_0x537403(0x106)]&&(console['log'](_0x537403(0x134)+_0x1a356e['name']+'\x27:'),console[_0x537403(0xe2)]('─'['repeat'](0x3c)),console[_0x537403(0xe2)](_0x1a356e[_0x537403(0x106)]),console[_0x537403(0xe2)]('─'['repeat'](0x3c)));}for(const _0x308dab of _0xb08ba8){_0x308dab['diff']&&(console['log'](_0x537403(0x12b)+_0x308dab['name']+'\x27:'),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)),console[_0x537403(0xe2)](_0x308dab['diff']),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)));}for(const _0x1594b3 of _0x5ea525){_0x1594b3[_0x537403(0x106)]&&(console['log'](_0x537403(0x135)+_0x1594b3[_0x537403(0x133)]+'\x27:'),console['log']('─'['repeat'](0x3c)),console['log'](_0x1594b3['diff']),console[_0x537403(0xe2)]('─'[_0x537403(0x100)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x57942b(0x133)]=a4_0x57942b(0x111);['description']=a4_0x57942b(0xb3);async[a4_0x57942b(0x9f)](_0x12d6bb){const _0x5cc427=a4_0x57942b,{options:_0x290ca8,args:_0x4343e1,tdx:_0x1851fa}=_0x12d6bb,_0x4921eb=_0x4343e1[0x0],_0xe0183f=_0x4343e1[0x1],_0x2f5ebb=_0x290ca8[_0x5cc427(0xd1)],_0xbb966b=_0x290ca8[_0x5cc427(0x146)],_0x58c910=_0x290ca8[_0x5cc427(0xa0)],_0x16773e=_0x290ca8[_0x5cc427(0xad)],_0x3ec1a9=_0x290ca8[_0x5cc427(0x9c)];let _0x51c70f,_0x200360;const _0x3ec22c=findAgentConfigPath(process[_0x5cc427(0xdb)]());if(_0x4921eb){const _0x49b3b9=a4_0x5306a4[_0x5cc427(0x14e)](_0x4921eb,'tdx.json');if(existsSync(_0x49b3b9))try{const _0x4aa80c=JSON[_0x5cc427(0x95)](readFileSync(_0x49b3b9,_0x5cc427(0x136)));_0x51c70f=_0x4aa80c[_0x5cc427(0xbc)],_0x200360=_0x4921eb,console[_0x5cc427(0xe2)](a4_0x1a470e['dim'](_0x5cc427(0x144)+_0x49b3b9+':\x20'+_0x51c70f));}catch{_0x51c70f=_0x4921eb;}else _0x51c70f=_0x4921eb;}else{if(_0x3ec22c)try{const _0x35ebcc=JSON[_0x5cc427(0x95)](readFileSync(_0x3ec22c,_0x5cc427(0x136)));_0x51c70f=_0x35ebcc[_0x5cc427(0xbc)],_0x200360=a4_0x5306a4[_0x5cc427(0xb0)](_0x3ec22c),console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0xcc)]('Using\x20project:\x20'+_0x51c70f));}catch{_0x51c70f=_0x3ec1a9;}else _0x51c70f=_0x3ec1a9;}if(!_0x51c70f)return console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0x105)](_0x5cc427(0xaa))),console[_0x5cc427(0xe2)](_0x5cc427(0x132)),console[_0x5cc427(0xe2)](_0x5cc427(0x10f)),console[_0x5cc427(0xe2)](_0x5cc427(0x128)),console['log'](_0x5cc427(0xf1)),0x1;if(_0xe0183f){const {data:_0x1e3001}=await withSpinner(_0x5cc427(0x14c)+_0xe0183f+_0x5cc427(0xc5)+_0x51c70f+'\x22...',()=>_0x1851fa[_0x5cc427(0xb9)]['pullAgent'](_0x51c70f,_0xe0183f,_0x2f5ebb,{'dryRun':_0xbb966b,'force':_0x58c910}));if(_0xbb966b)return console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0x105)](_0x5cc427(0x114))),console[_0x5cc427(0xe2)](_0x5cc427(0xcb)+_0x1e3001[_0x5cc427(0xcf)]),console[_0x5cc427(0xe2)]('Output\x20path:\x20'+_0x1e3001[_0x5cc427(0x11f)]),_0x1e3001[_0x5cc427(0x106)]&&(console[_0x5cc427(0xe2)](_0x5cc427(0x149)),console[_0x5cc427(0xe2)]('─'[_0x5cc427(0x100)](0x3c)),console[_0x5cc427(0xe2)](_0x1e3001['diff']),console[_0x5cc427(0xe2)]('─'[_0x5cc427(0x100)](0x3c))),0x0;return console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0xd2)](_0x5cc427(0x138))),console['log'](_0x5cc427(0x13b)+_0x1e3001[_0x5cc427(0xcf)]),console['log']('Output:\x20'+_0x1e3001[_0x5cc427(0x11f)]),console[_0x5cc427(0xe2)](_0x5cc427(0x11b)+(_0x1e3001[_0x5cc427(0x103)]?a4_0x1a470e['green']('new'):_0x1e3001['hasChanges']?a4_0x1a470e[_0x5cc427(0x105)]('updated'):a4_0x1a470e[_0x5cc427(0xe6)](_0x5cc427(0x9b)))),0x0;}const _0x39e869=_0x200360||_0x2f5ebb,{data:_0x44155d}=await withSpinner(_0x5cc427(0xf4)+_0x51c70f+_0x5cc427(0xae),()=>_0x1851fa['llm'][_0x5cc427(0xfe)](_0x51c70f,_0x39e869,{'dryRun':!![]})),_0x5b7075=_0x44155d[_0x5cc427(0xed)][_0x5cc427(0xe1)][_0x5cc427(0xab)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0xe0)]['new']+_0x44155d['counts']['textKnowledgeBases'][_0x5cc427(0xab)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x125)][_0x5cc427(0xab)]+_0x44155d[_0x5cc427(0xed)]['integrations']['new']+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x13c)]['new']+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x122)][_0x5cc427(0xab)],_0x40fb8d=_0x44155d['counts'][_0x5cc427(0xe1)][_0x5cc427(0xe5)]+_0x44155d[_0x5cc427(0xed)]['knowledgeBases'][_0x5cc427(0xe5)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x118)]['updated']+_0x44155d['counts'][_0x5cc427(0x125)][_0x5cc427(0xe5)]+_0x44155d['counts'][_0x5cc427(0xbe)][_0x5cc427(0xe5)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x13c)][_0x5cc427(0xe5)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x122)][_0x5cc427(0xe5)],_0x45ad85=_0x44155d[_0x5cc427(0xed)][_0x5cc427(0xe1)][_0x5cc427(0x9b)]+_0x44155d['counts'][_0x5cc427(0xe0)]['unchanged']+_0x44155d[_0x5cc427(0xed)]['textKnowledgeBases'][_0x5cc427(0x9b)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x125)][_0x5cc427(0x9b)]+_0x44155d[_0x5cc427(0xed)][_0x5cc427(0xbe)][_0x5cc427(0x9b)]+_0x44155d[_0x5cc427(0xed)]['experimentalKnowledgeBases'][_0x5cc427(0x9b)]+_0x44155d[_0x5cc427(0xed)]['experimentalArtifacts']['unchanged'];console[_0x5cc427(0xe2)](_0x5cc427(0x99)+_0x44155d['projectName']+'\x27:'),console[_0x5cc427(0xe2)]('\x20\x20'+a4_0x1a470e[_0x5cc427(0xd2)]('+\x20'+_0x5b7075+_0x5cc427(0x14d))+_0x5cc427(0xbd)+a4_0x1a470e[_0x5cc427(0x105)]('~\x20'+_0x40fb8d+_0x5cc427(0xc4))+'\x20|\x20'+a4_0x1a470e[_0x5cc427(0xcc)]('=\x20'+_0x45ad85+_0x5cc427(0xb2))),console[_0x5cc427(0xe2)]('\x20\x20Agents:\x20'+formatCountSummary(_0x44155d['counts'][_0x5cc427(0xe1)])),console[_0x5cc427(0xe2)](_0x5cc427(0x10d)+formatCountSummary(_0x44155d[_0x5cc427(0xed)]['knowledgeBases'])),console[_0x5cc427(0xe2)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x44155d[_0x5cc427(0xed)]['textKnowledgeBases'])),console[_0x5cc427(0xe2)](_0x5cc427(0xdd)+formatCountSummary(_0x44155d['counts'][_0x5cc427(0x125)])),console[_0x5cc427(0xe2)](_0x5cc427(0xa4)+formatCountSummary(_0x44155d[_0x5cc427(0xed)]['integrations']));const _0x1d976c=_0x44155d['counts'][_0x5cc427(0x13c)][_0x5cc427(0xde)]>0x0||_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x122)][_0x5cc427(0xde)]>0x0;_0x1d976c&&(console[_0x5cc427(0xe2)](_0x5cc427(0xa6)+formatCountSummary(_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x13c)])),console['log'](_0x5cc427(0x9e)+formatCountSummary(_0x44155d[_0x5cc427(0xed)][_0x5cc427(0x122)])));console['log'](_0x5cc427(0x107)+a4_0x1a470e[_0x5cc427(0xb5)](_0x44155d['outputDir'])),displayDiffs(_0x44155d[_0x5cc427(0xe1)],_0x44155d[_0x5cc427(0xe0)],_0x44155d[_0x5cc427(0x118)],_0x44155d['prompts'],_0x44155d[_0x5cc427(0xbe)],_0x44155d[_0x5cc427(0x13c)],_0x44155d[_0x5cc427(0x122)]);if(_0xbb966b)return console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0x105)](_0x5cc427(0xa2))),0x0;if(_0x5b7075===0x0&&_0x40fb8d===0x0)return console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0xd2)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x44155d[_0x5cc427(0x137)]},_0x290ca8['session']),console['log'](a4_0x1a470e[_0x5cc427(0xd2)]('✔\x20Context\x20set:\x20'+a4_0x1a470e[_0x5cc427(0xcc)](_0x5cc427(0xbc))+_0x5cc427(0x147)+a4_0x1a470e[_0x5cc427(0xb5)](_0x44155d[_0x5cc427(0x137)]))),0x0;if(!_0x16773e&&!_0x58c910){if(!isInteractive())return console[_0x5cc427(0xdf)](a4_0x1a470e[_0x5cc427(0x127)](_0x5cc427(0x13f)),_0x5cc427(0x145)),console[_0x5cc427(0xdf)](a4_0x1a470e['dim'](_0x5cc427(0xf9))),0x1;const _0x4774a0=await confirmKey(_0x5cc427(0xf8)+(_0x5b7075+_0x40fb8d)+_0x5cc427(0xc6));if(!_0x4774a0)return console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0x105)](_0x5cc427(0x11d)),_0x5cc427(0x131)),0x1;}const {data:_0x4fe9b4}=await withSpinner(_0x5cc427(0x113),()=>_0x1851fa['llm'][_0x5cc427(0xfe)](_0x51c70f,_0x39e869,{'force':_0x58c910}));return console['log'](a4_0x1a470e['green']('\x0a✔\x20Pulled\x20'+(_0x5b7075+_0x40fb8d)+_0x5cc427(0xc2)+_0x4fe9b4['outputDir'])),saveSessionContext({'llm_project':_0x4fe9b4[_0x5cc427(0x137)]},_0x290ca8[_0x5cc427(0x10b)]),console[_0x5cc427(0xe2)](a4_0x1a470e[_0x5cc427(0xd2)](_0x5cc427(0xe8)+a4_0x1a470e[_0x5cc427(0xcc)](_0x5cc427(0xbc))+'\x20=\x20'+a4_0x1a470e[_0x5cc427(0xb5)](_0x4fe9b4[_0x5cc427(0x137)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x57942b(0xc9);['description']=a4_0x57942b(0x143);async[a4_0x57942b(0x9f)](_0x4c8fcc){const _0x3f01a2=a4_0x57942b,{options:_0x3cb567,args:_0x3c4d26,tdx:_0x4779fe}=_0x4c8fcc,_0x25e770=_0x3c4d26[0x0],_0x7ba022=_0x3cb567[_0x3f01a2(0x133)],_0xe17f90=_0x3cb567[_0x3f01a2(0x146)],_0x2c6d39=_0x3cb567[_0x3f01a2(0xad)],_0x294c83=_0x3cb567[_0x3f01a2(0xe3)],_0x420223=_0x3cb567[_0x3f01a2(0x9c)];let _0x1e4d40;const _0x58375a=findAgentConfigPath(process[_0x3f01a2(0xdb)]());if(_0x25e770){const _0x163b71=a4_0x5306a4['join'](_0x25e770,_0x3f01a2(0x98));existsSync(_0x163b71)?(_0x1e4d40=_0x25e770,console['log'](a4_0x1a470e[_0x3f01a2(0xcc)](_0x3f01a2(0xb4)+_0x25e770))):_0x1e4d40=_0x25e770;}else{if(_0x58375a)_0x1e4d40=a4_0x5306a4[_0x3f01a2(0xb0)](_0x58375a),console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0xcc)](_0x3f01a2(0x12c)+_0x1e4d40));else{if(_0x420223){const _0x54d2f6=sanitizeForFilesystem(_0x420223);let _0x1f0221=_0x54d2f6,_0x56cb1f=a4_0x5306a4['join'](process[_0x3f01a2(0xdb)](),_0x3f01a2(0xe1),_0x54d2f6,_0x3f01a2(0x98));if(!existsSync(_0x56cb1f)){const _0x2dd9cc=normalizeName(_0x420223),_0x4f65ae=a4_0x5306a4['join'](process[_0x3f01a2(0xdb)](),_0x3f01a2(0xe1),_0x2dd9cc,_0x3f01a2(0x98));existsSync(_0x4f65ae)&&(_0x1f0221=_0x2dd9cc,_0x56cb1f=_0x4f65ae);}if(existsSync(_0x56cb1f))_0x1e4d40=a4_0x5306a4['dirname'](_0x56cb1f),console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0xcc)](_0x3f01a2(0xb4)+_0x1e4d40));else{const _0x415e15=_0x3cb567[_0x3f01a2(0xa5)];if(_0x415e15)throw new SDKError(ErrorCode[_0x3f01a2(0xbb)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x420223+_0x3f01a2(0xee),undefined,{'helpText':_0x3f01a2(0x12e)+_0x3f01a2(0xd6)+(_0x3f01a2(0xd8)+_0x420223+'\x0a')+(_0x3f01a2(0x116)+_0x1f0221+_0x3f01a2(0xb8)+(_0x7ba022||_0x3f01a2(0xd5))+_0x3f01a2(0xf2)+_0x415e15)});_0x1e4d40=_0x420223,console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0xcc)](_0x3f01a2(0xe4)+_0x420223));}}}}if(!_0x1e4d40)return console['log'](a4_0x1a470e[_0x3f01a2(0x105)](_0x3f01a2(0xe9))),console[_0x3f01a2(0xe2)](_0x3f01a2(0xd7)),console['log'](_0x3f01a2(0x12a)),console[_0x3f01a2(0xe2)]('\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)'),console[_0x3f01a2(0xe2)](_0x3f01a2(0xea)),0x1;if(!_0x7ba022)throw new SDKError(ErrorCode[_0x3f01a2(0x148)],_0x3f01a2(0x130),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x2c6d39&&!_0xe17f90){if(!isInteractive())return console[_0x3f01a2(0xdf)](a4_0x1a470e['red'](_0x3f01a2(0x13f)),_0x3f01a2(0x145)),console[_0x3f01a2(0xdf)](a4_0x1a470e[_0x3f01a2(0xcc)](_0x3f01a2(0xf9))),0x1;const _0x4ff64b=await confirmKey(_0x3f01a2(0xc3)+_0x1e4d40+_0x3f01a2(0xf7)+_0x7ba022+'\x22?');if(!_0x4ff64b)return console['log'](a4_0x1a470e[_0x3f01a2(0x105)](_0x3f01a2(0x11d))),0x1;}const {data:_0x5b781c}=await withSpinner(_0x3f01a2(0xeb)+_0x1e4d40+_0x3f01a2(0x101)+_0x7ba022+_0x3f01a2(0xae),()=>_0x4779fe[_0x3f01a2(0xb9)][_0x3f01a2(0x13e)](_0x1e4d40,_0x7ba022,{'dryRun':_0xe17f90}));if(_0xe17f90){console['log'](a4_0x1a470e[_0x3f01a2(0x105)](_0x3f01a2(0x109))),console['log'](_0x3f01a2(0x108)+_0x5b781c[_0x3f01a2(0xa1)]),console[_0x3f01a2(0xe2)]('New\x20project:\x20'+_0x7ba022),console[_0x3f01a2(0xe2)](_0x3f01a2(0x112)),console[_0x3f01a2(0xe2)](_0x3f01a2(0x11a)+_0x5b781c['counts'][_0x3f01a2(0xe1)][_0x3f01a2(0x14b)]),console[_0x3f01a2(0xe2)](_0x3f01a2(0x10d)+_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0xe0)][_0x3f01a2(0x14b)]),console[_0x3f01a2(0xe2)]('\x20\x20Prompts:\x20'+_0x5b781c[_0x3f01a2(0xed)]['prompts']['created']);const _0x266b74=_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x13c)][_0x3f01a2(0x14b)]>0x0||_0x5b781c['counts'][_0x3f01a2(0x122)][_0x3f01a2(0x14b)]>0x0;return _0x266b74&&(console[_0x3f01a2(0xe2)](_0x3f01a2(0xa6)+_0x5b781c[_0x3f01a2(0xed)]['experimentalKnowledgeBases']['created']),console['log']('\x20\x20Experimental\x20Artifacts:\x20'+_0x5b781c[_0x3f01a2(0xed)]['experimentalArtifacts'][_0x3f01a2(0x14b)])),0x0;}const _0x23a0f0=_0x5b781c[_0x3f01a2(0xed)]['agents'][_0x3f01a2(0x139)]>0x0||_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0xe0)][_0x3f01a2(0x139)]>0x0||_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x125)]['errors']>0x0||_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x13c)][_0x3f01a2(0x139)]>0x0||_0x5b781c[_0x3f01a2(0xed)]['experimentalArtifacts'][_0x3f01a2(0x139)]>0x0;_0x23a0f0?console[_0x3f01a2(0xe2)](a4_0x1a470e['yellow'](_0x3f01a2(0x97))):console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0xd2)]('Project\x20cloned\x20successfully'));console[_0x3f01a2(0xe2)](_0x3f01a2(0x108)+_0x5b781c['sourceProjectName']),console[_0x3f01a2(0xe2)](_0x3f01a2(0xec)+_0x5b781c[_0x3f01a2(0xac)]),console[_0x3f01a2(0xe2)]('New\x20project\x20ID:\x20'+_0x5b781c[_0x3f01a2(0xef)]),console[_0x3f01a2(0xe2)](),console[_0x3f01a2(0xe2)](_0x3f01a2(0xf3)),console[_0x3f01a2(0xe2)]('\x20\x20Agents:\x20'+formatCountSummary(_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0xe1)])),console['log'](_0x3f01a2(0x10d)+formatCountSummary(_0x5b781c['counts']['knowledgeBases'])),console[_0x3f01a2(0xe2)](_0x3f01a2(0xdd)+formatCountSummary(_0x5b781c['counts'][_0x3f01a2(0x125)])),console[_0x3f01a2(0xe2)](_0x3f01a2(0xa4)+formatCountSummary(_0x5b781c[_0x3f01a2(0xed)]['integrations']));const _0x1b1715=_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x13c)][_0x3f01a2(0x14b)]>0x0||_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x13c)]['updated']>0x0||_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x13c)]['unchanged']>0x0||_0x5b781c[_0x3f01a2(0xed)]['experimentalArtifacts'][_0x3f01a2(0x14b)]>0x0||_0x5b781c[_0x3f01a2(0xed)]['experimentalArtifacts'][_0x3f01a2(0xe5)]>0x0||_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x122)][_0x3f01a2(0x9b)]>0x0;_0x1b1715&&(console[_0x3f01a2(0xe2)](_0x3f01a2(0xa6)+formatCountSummary(_0x5b781c['counts'][_0x3f01a2(0x13c)])),console[_0x3f01a2(0xe2)]('\x20\x20Experimental\x20Artifacts:\x20'+formatCountSummary(_0x5b781c[_0x3f01a2(0xed)][_0x3f01a2(0x122)])));if(_0x23a0f0){console['log'](),console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0x127)](_0x3f01a2(0xca)));for(const _0x3ee8ec of _0x5b781c[_0x3f01a2(0xe1)]){_0x3ee8ec[_0x3f01a2(0x96)]===_0x3f01a2(0xdf)&&console[_0x3f01a2(0xe2)](a4_0x1a470e['red'](_0x3f01a2(0xf0)+_0x3ee8ec['agentName']+_0x3f01a2(0xd0)+_0x3ee8ec[_0x3f01a2(0xdf)]));}for(const _0x4e7aba of _0x5b781c[_0x3f01a2(0xe0)]){_0x4e7aba['action']==='error'&&console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0x127)](_0x3f01a2(0xaf)+_0x4e7aba[_0x3f01a2(0x133)]+_0x3f01a2(0xd0)+_0x4e7aba[_0x3f01a2(0xdf)]));}for(const _0x4fcd6b of _0x5b781c[_0x3f01a2(0x125)]){_0x4fcd6b[_0x3f01a2(0x96)]===_0x3f01a2(0xdf)&&console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0x127)](_0x3f01a2(0xc0)+_0x4fcd6b[_0x3f01a2(0x133)]+'\x22:\x20'+_0x4fcd6b['error']));}for(const _0xcd8396 of _0x5b781c[_0x3f01a2(0xbe)]){_0xcd8396[_0x3f01a2(0x96)]===_0x3f01a2(0xdf)&&console[_0x3f01a2(0xe2)](a4_0x1a470e['red'](_0x3f01a2(0x126)+_0xcd8396[_0x3f01a2(0x133)]+_0x3f01a2(0xd0)+_0xcd8396[_0x3f01a2(0xdf)]));}for(const _0x576d2b of _0x5b781c[_0x3f01a2(0x13c)]){_0x576d2b[_0x3f01a2(0x96)]===_0x3f01a2(0xdf)&&console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0x127)](_0x3f01a2(0xbf)+_0x576d2b[_0x3f01a2(0x133)]+_0x3f01a2(0xd0)+_0x576d2b[_0x3f01a2(0xdf)]));}for(const _0x4ada3f of _0x5b781c[_0x3f01a2(0x122)]){_0x4ada3f[_0x3f01a2(0x96)]===_0x3f01a2(0xdf)&&console[_0x3f01a2(0xe2)](a4_0x1a470e[_0x3f01a2(0x127)](_0x3f01a2(0xba)+_0x4ada3f[_0x3f01a2(0x133)]+_0x3f01a2(0xd0)+_0x4ada3f['error']));}return 0x1;}console[_0x3f01a2(0xe2)]();const _0x941362=getLLMProjectUrl(_0x294c83,_0x5b781c[_0x3f01a2(0xef)]);return console[_0x3f01a2(0xe2)]('Project:\x20'+a4_0x1a470e[_0x3f01a2(0xb5)](_0x941362)),0x0;}}function a4_0x1193(_0x192d5c,_0x39fc60){_0x192d5c=_0x192d5c-0x94;const _0x11e76c=a4_0x11e7();let _0x119334=_0x11e76c[_0x192d5c];return _0x119334;}export class AgentPushCommand extends BaseCommand{['name']=a4_0x57942b(0xd4);[a4_0x57942b(0xc7)]=a4_0x57942b(0xb1);async[a4_0x57942b(0x9f)](_0x1e9107){const _0x303596=a4_0x57942b,{options:_0xad6971,args:_0x43f180,tdx:_0x1d0b36}=_0x1e9107;let _0x5c6055=_0x43f180[0x0]||process['cwd']();const _0x42b0c7=_0xad6971[_0x303596(0x146)],_0x1f1c5e=_0xad6971['force'],_0x1e751c=_0xad6971[_0x303596(0xad)],_0x17c229=_0xad6971[_0x303596(0xe3)],_0x5bcfff=a4_0x5306a4[_0x303596(0x14e)](_0x5c6055,_0x303596(0xa8)),_0xab87bf=existsSync(_0x5bcfff);if(_0xab87bf){const {data:_0x20dd49}=await withSpinner(_0x303596(0x123)+_0x5c6055+'\x22...',()=>_0x1d0b36[_0x303596(0xb9)]['pushAgent'](_0x5c6055,{'dryRun':_0x42b0c7,'force':_0x1f1c5e}));if(_0x42b0c7)return console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x105)](_0x303596(0x109))),console['log'](_0x303596(0xa3)+_0x20dd49['agentName']),0x0;if(_0x20dd49[_0x303596(0x96)]===_0x303596(0xdf))return console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)](_0x303596(0xfd)+_0x20dd49[_0x303596(0xdf)])),0x1;console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0xd2)]('Agent\x20'+_0x20dd49[_0x303596(0x96)]+_0x303596(0x13d))),console[_0x303596(0xe2)]('Agent:\x20'+_0x20dd49['agentName']);if(_0x20dd49['agentId']&&_0x20dd49['projectId']){const _0x14f959=getLLMAgentChatUrl(_0x17c229,_0x20dd49[_0x303596(0x12d)],_0x20dd49[_0x303596(0xc1)]);console['log'](_0x303596(0x94)+a4_0x1a470e[_0x303596(0xb5)](_0x14f959));}return 0x0;}const _0x2c2793=_0xad6971[_0x303596(0x9c)],_0x25759f=resolveProjectFromContext(_0x5c6055,_0x2c2793);if(_0x25759f['found'])_0x5c6055=_0x25759f['projectDir'],_0x25759f[_0x303596(0xfa)]===_0x303596(0xe7)&&console[_0x303596(0xe2)](a4_0x1a470e['dim']('Using\x20project:\x20'+_0x5c6055));else{let _0x5db77f=_0x303596(0xfb);_0x25759f[_0x303596(0xce)]===_0x303596(0x119)&&(_0x5db77f=_0x25759f[_0x303596(0x13a)]+'\x0aRun\x20\x27tdx\x20agent\x20pull\x20'+_0x25759f[_0x303596(0x9c)]+_0x303596(0x104));throw new SDKError(ErrorCode[_0x303596(0xbb)],_0x25759f[_0x303596(0xce)]==='no_context'?_0x25759f[_0x303596(0x13a)]:'No\x20tdx.json\x20found\x20in\x20'+_0x5c6055,undefined,{'helpText':_0x5db77f});}const {data:_0xf629cc}=await withSpinner(_0x303596(0xd3),()=>_0x1d0b36[_0x303596(0xb9)][_0x303596(0x10a)](_0x5c6055,{'dryRun':!![]})),_0x58a29d=_0xf629cc[_0x303596(0xed)]['agents'][_0x303596(0x139)]>0x0;if(_0x58a29d){console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)]('\x0aErrors\x20found:'));for(const _0x3e8adb of _0xf629cc[_0x303596(0xe1)]){_0x3e8adb[_0x303596(0x96)]===_0x303596(0xdf)&&console['log'](a4_0x1a470e[_0x303596(0x127)](_0x303596(0xf0)+_0x3e8adb[_0x303596(0xcf)]+_0x303596(0xd0)+_0x3e8adb[_0x303596(0xdf)]));}return 0x1;}const _0x27b50e=_0xf629cc[_0x303596(0xed)][_0x303596(0xe1)][_0x303596(0x14b)]+_0xf629cc[_0x303596(0xed)][_0x303596(0xe0)][_0x303596(0x14b)]+_0xf629cc['counts'][_0x303596(0x118)]['created']+_0xf629cc[_0x303596(0xed)][_0x303596(0x125)][_0x303596(0x14b)]+_0xf629cc['counts'][_0x303596(0xbe)][_0x303596(0x14b)]+_0xf629cc[_0x303596(0xed)][_0x303596(0x13c)][_0x303596(0x14b)]+_0xf629cc['counts'][_0x303596(0x122)][_0x303596(0x14b)],_0x352c34=_0xf629cc[_0x303596(0xed)]['agents']['updated']+_0xf629cc['counts'][_0x303596(0xe0)][_0x303596(0xe5)]+_0xf629cc[_0x303596(0xed)]['textKnowledgeBases'][_0x303596(0xe5)]+_0xf629cc[_0x303596(0xed)][_0x303596(0x125)][_0x303596(0xe5)]+_0xf629cc['counts'][_0x303596(0xbe)]['updated']+_0xf629cc[_0x303596(0xed)]['experimentalKnowledgeBases'][_0x303596(0xe5)]+_0xf629cc[_0x303596(0xed)][_0x303596(0x122)][_0x303596(0xe5)],_0x193b1d=_0xf629cc[_0x303596(0xed)]['agents'][_0x303596(0x9b)]+_0xf629cc['counts']['knowledgeBases'][_0x303596(0x9b)]+_0xf629cc[_0x303596(0xed)][_0x303596(0x118)][_0x303596(0x9b)]+_0xf629cc[_0x303596(0xed)][_0x303596(0x125)][_0x303596(0x9b)]+_0xf629cc['counts'][_0x303596(0xbe)][_0x303596(0x9b)]+_0xf629cc[_0x303596(0xed)][_0x303596(0x13c)]['unchanged']+_0xf629cc[_0x303596(0xed)]['experimentalArtifacts'][_0x303596(0x9b)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0xf629cc[_0x303596(0x137)]+'\x27:'),console['log']('\x20\x20'+a4_0x1a470e[_0x303596(0xd2)]('+\x20'+_0x27b50e+_0x303596(0x14d))+_0x303596(0xbd)+a4_0x1a470e[_0x303596(0x105)]('~\x20'+_0x352c34+'\x20changed')+_0x303596(0xbd)+a4_0x1a470e[_0x303596(0xcc)]('=\x20'+_0x193b1d+_0x303596(0xb2))),console['log'](_0x303596(0x11a)+formatCountSummary(_0xf629cc[_0x303596(0xed)]['agents'])),console[_0x303596(0xe2)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0xf629cc[_0x303596(0xed)][_0x303596(0xe0)])),console[_0x303596(0xe2)](_0x303596(0xdc)+formatCountSummary(_0xf629cc['counts'][_0x303596(0x118)])),console['log'](_0x303596(0xdd)+formatCountSummary(_0xf629cc[_0x303596(0xed)][_0x303596(0x125)])),console[_0x303596(0xe2)](_0x303596(0xa4)+formatCountSummary(_0xf629cc[_0x303596(0xed)][_0x303596(0xbe)]));const _0x44bec6=_0xf629cc[_0x303596(0xed)]['experimentalKnowledgeBases'][_0x303596(0x14b)]>0x0||_0xf629cc['counts']['experimentalKnowledgeBases']['updated']>0x0||_0xf629cc[_0x303596(0xed)]['experimentalKnowledgeBases'][_0x303596(0x9b)]>0x0||_0xf629cc['counts'][_0x303596(0x122)]['created']>0x0||_0xf629cc['counts'][_0x303596(0x122)][_0x303596(0xe5)]>0x0||_0xf629cc[_0x303596(0xed)][_0x303596(0x122)][_0x303596(0x9b)]>0x0;_0x44bec6&&(console[_0x303596(0xe2)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0xf629cc['counts'][_0x303596(0x13c)])),console['log'](_0x303596(0x9e)+formatCountSummary(_0xf629cc[_0x303596(0xed)][_0x303596(0x122)])));console[_0x303596(0xe2)](_0x303596(0x9d)+a4_0x1a470e[_0x303596(0xb5)](_0x5c6055)),displayDiffs(_0xf629cc[_0x303596(0xe1)],_0xf629cc[_0x303596(0xe0)],_0xf629cc[_0x303596(0x118)],_0xf629cc[_0x303596(0x125)],_0xf629cc['integrations'],_0xf629cc[_0x303596(0x13c)],_0xf629cc['experimentalArtifacts']);if(_0x42b0c7)return console['log'](a4_0x1a470e[_0x303596(0x105)](_0x303596(0xda))),0x0;if(_0x27b50e===0x0&&_0x352c34===0x0){console['log'](a4_0x1a470e[_0x303596(0xd2)](_0x303596(0xa9)));const _0x41211c=getLLMProjectUrl(_0x17c229,_0xf629cc[_0x303596(0x12d)]);return console['log']('Project:\x20'+a4_0x1a470e['cyan'](_0x41211c)),0x0;}if(!_0x1e751c&&!_0x1f1c5e){if(!isInteractive())return console[_0x303596(0xdf)](a4_0x1a470e[_0x303596(0x127)](_0x303596(0x13f)),_0x303596(0x145)),console[_0x303596(0xdf)](a4_0x1a470e['dim'](_0x303596(0xf9))),0x1;const _0x494d4f=await confirmKey(_0x303596(0xfc)+(_0x27b50e+_0x352c34)+_0x303596(0xa7));if(!_0x494d4f)return console['log'](a4_0x1a470e[_0x303596(0x105)](_0x303596(0x11d)),_0x303596(0x124)),0x1;}const {data:_0x4127c3}=await withSpinner(_0x303596(0x14a),()=>_0x1d0b36[_0x303596(0xb9)][_0x303596(0x10a)](_0x5c6055,{'force':_0x1f1c5e})),_0x112464=_0x4127c3[_0x303596(0xed)][_0x303596(0xe1)][_0x303596(0x139)]>0x0||_0x4127c3[_0x303596(0xed)][_0x303596(0xe0)][_0x303596(0x139)]>0x0||_0x4127c3[_0x303596(0xed)][_0x303596(0x118)][_0x303596(0x139)]>0x0||_0x4127c3[_0x303596(0xed)][_0x303596(0x125)]['errors']>0x0;if(_0x112464){console[_0x303596(0xe2)](a4_0x1a470e['yellow'](_0x303596(0x110))),console[_0x303596(0xe2)](),console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)](_0x303596(0xca)));for(const _0xe5d5d4 of _0x4127c3[_0x303596(0xe1)]){_0xe5d5d4[_0x303596(0x96)]===_0x303596(0xdf)&&console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)]('\x20\x20Agent\x20\x22'+_0xe5d5d4['agentName']+_0x303596(0xd0)+_0xe5d5d4[_0x303596(0xdf)]));}for(const _0x49baa7 of _0x4127c3[_0x303596(0xe0)]){_0x49baa7[_0x303596(0x96)]==='error'&&console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)](_0x303596(0xaf)+_0x49baa7[_0x303596(0x133)]+_0x303596(0xd0)+_0x49baa7[_0x303596(0xdf)]));}for(const _0x4bccd6 of _0x4127c3[_0x303596(0x118)]){_0x4bccd6[_0x303596(0x96)]===_0x303596(0xdf)&&console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)](_0x303596(0x120)+_0x4bccd6[_0x303596(0x133)]+'\x22:\x20'+_0x4bccd6[_0x303596(0xdf)]));}for(const _0x217941 of _0x4127c3['prompts']){_0x217941['action']===_0x303596(0xdf)&&console['log'](a4_0x1a470e[_0x303596(0x127)](_0x303596(0xc0)+_0x217941[_0x303596(0x133)]+'\x22:\x20'+_0x217941[_0x303596(0xdf)]));}for(const _0x4d86f5 of _0x4127c3[_0x303596(0xbe)]){_0x4d86f5['action']===_0x303596(0xdf)&&console[_0x303596(0xe2)](a4_0x1a470e[_0x303596(0x127)](_0x303596(0x126)+_0x4d86f5[_0x303596(0x133)]+_0x303596(0xd0)+_0x4d86f5[_0x303596(0xdf)]));}return 0x1;}console[_0x303596(0xe2)](a4_0x1a470e['green'](_0x303596(0x11c)+(_0x27b50e+_0x352c34)+_0x303596(0x10e)+_0x4127c3[_0x303596(0x137)]+'\x27'));const _0x48f7dd=getLLMProjectUrl(_0x17c229,_0x4127c3['projectId']);return console['log']('Project:\x20'+a4_0x1a470e['cyan'](_0x48f7dd)),0x0;}}
1
+ const a4_0x266ed6=a4_0x173b;(function(_0x4cb0ca,_0x47065d){const _0x180463=a4_0x173b,_0x1a49e9=_0x4cb0ca();while(!![]){try{const _0x26be3c=-parseInt(_0x180463(0xbb))/0x1*(-parseInt(_0x180463(0xd5))/0x2)+-parseInt(_0x180463(0x103))/0x3+-parseInt(_0x180463(0xdf))/0x4+-parseInt(_0x180463(0xed))/0x5*(parseInt(_0x180463(0x10b))/0x6)+-parseInt(_0x180463(0xc4))/0x7*(parseInt(_0x180463(0xe0))/0x8)+-parseInt(_0x180463(0xaf))/0x9*(-parseInt(_0x180463(0xe7))/0xa)+parseInt(_0x180463(0xdb))/0xb;if(_0x26be3c===_0x47065d)break;else _0x1a49e9['push'](_0x1a49e9['shift']());}catch(_0x163ed8){_0x1a49e9['push'](_0x1a49e9['shift']());}}}(a4_0xb399,0xf381c));import a4_0x51ad2e from'chalk';import a4_0x53d24e from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{findAgentConfigPath,resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';function a4_0xb399(){const _0x1b033d=['Status:\x20','Cloning\x20\x22','experimentalArtifacts','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','agent:push','join','execute','\x20\x20Agent\x20\x22','\x20\x20tdx\x20agent\x20pull\x20','parse','\x20files?','\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)','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','Failed\x20to\x20push\x20agent:\x20','projectName','agent:pull','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','\x0aError:','pushProject','23058rjtdbj','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','push','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','outputPath','Would\x20push\x20agent:\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','llm','\x20\x20Experimental\x20Knowledge\x20Base\x20\x22','Dry\x20run\x20-\x20no\x20files\x20written','Agent\x20pulled\x20successfully','Project\x20cloned\x20successfully','241027REQhaY','Cancelled','\x0a✔\x20Pulled\x20','knowledgeBases','yes','Using\x20context\x20project:\x20','\x20unchanged','\x20\x20Target:\x20','new','124145ovUqUc','\x20updated','site','cloneProject','\x20\x20Integration\x20\x22','prompts','yellow','\x20new','\x20successfully','dim','dryRun','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','total','found','\x20errors','diff','description','16JijLPi','agent.yml','agentName','\x20\x20Text\x20Knowledge\x20Bases:\x20','\x20\x20Agents:\x20','MISSING_ARGUMENT','23485286ZTiFTo','Analyzing\x20changes\x20to\x20push...','Analyzing\x20project\x20\x22','Pushing\x20to\x20project...','927384nNtcGQ','272xiDgtZ','✔\x20Context\x20set:\x20','pullAgent','Pushing\x20agent\x20from\x20\x22','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Errors:','\x0aErrors\x20found:','170yNgEdk','Source:\x20','hasChanges','Output\x20path:\x20','\x20\x20Experimental\x20Artifacts:\x20','tdx.json','46245qNONPR','\x22\x20to\x20\x22','\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27','Writing\x20files...','Chat:\x20','no_local_folder','cwd','Would\x20clone:','Would\x20pull\x20agent:\x20','\x0aProject\x20pushed\x20with\x20errors','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','-\x20no\x20files\x20written','\x20--name\x20','agentId','sourceProjectName','Project:\x20','force','unchanged','no_context','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','textKnowledgeBases','\x20\x20tdx\x20agent\x20clone\x20agents/','4132209hufUPb','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x0aChanges\x20to\x20integration\x20\x27','newProjectName','\x20|\x20','Using\x20local\x20project:\x20','action','\x0a✔\x20Pushed\x20','582bVYVSE','New\x20project\x20ID:\x20','\x20created','llmProject','Summary:','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','log','reason','projectId','cyan','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','updated','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','\x20\x20Knowledge\x20Base\x20\x22','outputDir','pullProject','green','integrations','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','\x20changed','error','\x20--profile\x20','\x20=\x20','Project\x20cloned\x20with\x20errors','\x0aChanges\x20to\x20agent\x20\x27','\x22...','\x20\x20Source:\x20','\x20\x20Knowledge\x20Bases:\x20','newProjectId','Agent\x20','message','Pulling\x20agent\x20\x22','agents','gray','errors','source','Cannot\x20clone\x20from\x20context\x20project\x20\x22','\x20\x20Prompts:\x20','\x0aPush\x20','session','repeat','red','New\x20project:\x20','No\x20tdx.json\x20found\x20in\x20','counts','New\x20project\x20name\x20is\x20required','\x0aPush\x20summary\x20for\x20\x27','experimentalKnowledgeBases','name','\x20\x20Integrations:\x20','\x22\x20to\x20a\x20different\x20profile','\x20\x20Experimental\x20Artifact\x20\x22','llm_project','\x22\x20to\x20new\x20project\x20\x22','created','\x0aPull\x20summary\x20for\x20\x27','\x22:\x20','dirname','utf-8','Using\x20current\x20project:\x20','Using\x20project\x20from\x20','context','Using\x20project:\x20','pushAgent','\x0aChanges\x20to\x20prompt\x20\x27','\x20\x20Prompt\x20\x22','\x0aWrite\x20','\x20\x20Experimental\x20Knowledge\x20Bases:\x20'];a4_0xb399=function(){return _0x1b033d;};return a4_0xb399();}function a4_0x173b(_0x5ecf81,_0x2c8e95){_0x5ecf81=_0x5ecf81-0x8c;const _0xb399d0=a4_0xb399();let _0x173ba1=_0xb399d0[_0x5ecf81];return _0x173ba1;}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x4f536b){const _0xc3672e=a4_0x173b,_0x4abf57=[];if(_0x4f536b[_0xc3672e(0xd0)]!==undefined)_0x4abf57['push'](_0x4f536b[_0xc3672e(0xd0)]+'\x20total');if(_0x4f536b[_0xc3672e(0xc3)]!==undefined&&_0x4f536b['new']>0x0)_0x4abf57[_0xc3672e(0xb1)](a4_0x51ad2e[_0xc3672e(0x11b)](_0x4f536b[_0xc3672e(0xc3)]+'\x20new'));if(_0x4f536b[_0xc3672e(0x8d)]!==undefined&&_0x4f536b[_0xc3672e(0x8d)]>0x0)_0x4abf57[_0xc3672e(0xb1)](a4_0x51ad2e[_0xc3672e(0x11b)](_0x4f536b['created']+_0xc3672e(0x10d)));if(_0x4f536b['updated']!==undefined&&_0x4f536b[_0xc3672e(0x116)]>0x0)_0x4abf57[_0xc3672e(0xb1)](a4_0x51ad2e[_0xc3672e(0xca)](_0x4f536b[_0xc3672e(0x116)]+_0xc3672e(0xc5)));if(_0x4f536b['unchanged']!==undefined&&_0x4f536b[_0xc3672e(0xfe)]>0x0)_0x4abf57[_0xc3672e(0xb1)](a4_0x51ad2e['gray'](_0x4f536b[_0xc3672e(0xfe)]+_0xc3672e(0xc1)));if(_0x4f536b[_0xc3672e(0x12d)]!==undefined&&_0x4f536b[_0xc3672e(0x12d)]>0x0)_0x4abf57[_0xc3672e(0xb1)](a4_0x51ad2e[_0xc3672e(0x134)](_0x4f536b[_0xc3672e(0x12d)]+_0xc3672e(0xd2)));return _0x4abf57[_0xc3672e(0xa0)](',\x20');}function displayDiffs(_0x1ded88,_0x3bab3a,_0x2be646,_0x141ee1,_0xa2fcf9,_0x2356c6,_0xbe6080){const _0x25121f=a4_0x173b;for(const _0x2ae0cb of _0x1ded88){if(_0x2ae0cb[_0x25121f(0xd3)]){const _0x4d1048=_0x2ae0cb[_0x25121f(0xd7)]||_0x2ae0cb[_0x25121f(0x13b)];console[_0x25121f(0x111)](_0x25121f(0x123)+_0x4d1048+'\x27:'),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)),console['log'](_0x2ae0cb[_0x25121f(0xd3)]),console[_0x25121f(0x111)]('─'['repeat'](0x3c));}}for(const _0x27702c of _0x3bab3a){_0x27702c[_0x25121f(0xd3)]&&(console[_0x25121f(0x111)](_0x25121f(0x104)+_0x27702c[_0x25121f(0x13b)]+'\x27:'),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)),console[_0x25121f(0x111)](_0x27702c[_0x25121f(0xd3)]),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)));}for(const _0xf8abd of _0x2be646){_0xf8abd[_0x25121f(0xd3)]&&(console['log'](_0x25121f(0xb0)+_0xf8abd['name']+'\x27:'),console['log']('─'['repeat'](0x3c)),console[_0x25121f(0x111)](_0xf8abd['diff']),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)));}for(const _0x5222a0 of _0x141ee1){_0x5222a0[_0x25121f(0xd3)]&&(console['log'](_0x25121f(0x97)+_0x5222a0[_0x25121f(0x13b)]+'\x27:'),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)),console[_0x25121f(0x111)](_0x5222a0['diff']),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)));}for(const _0xbf7362 of _0xa2fcf9){_0xbf7362[_0x25121f(0xd3)]&&(console[_0x25121f(0x111)](_0x25121f(0x105)+_0xbf7362[_0x25121f(0x13b)]+'\x27:'),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)),console['log'](_0xbf7362[_0x25121f(0xd3)]),console[_0x25121f(0x111)]('─'[_0x25121f(0x133)](0x3c)));}for(const _0x5a553e of _0x2356c6){_0x5a553e[_0x25121f(0xd3)]&&(console['log'](_0x25121f(0xef)+_0x5a553e[_0x25121f(0x13b)]+'\x27:'),console['log']('─'[_0x25121f(0x133)](0x3c)),console[_0x25121f(0x111)](_0x5a553e[_0x25121f(0xd3)]),console['log']('─'[_0x25121f(0x133)](0x3c)));}for(const _0xbd6801 of _0xbe6080){_0xbd6801[_0x25121f(0xd3)]&&(console['log'](_0x25121f(0x11d)+_0xbd6801['name']+'\x27:'),console['log']('─'[_0x25121f(0x133)](0x3c)),console['log'](_0xbd6801['diff']),console[_0x25121f(0x111)]('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x266ed6(0x13b)]=a4_0x266ed6(0xab);[a4_0x266ed6(0xd4)]=a4_0x266ed6(0xb5);async[a4_0x266ed6(0xa1)](_0x3e17c9){const _0x3320d7=a4_0x266ed6,{options:_0x567d27,args:_0x5eefe6,tdx:_0x1a0f2d}=_0x3e17c9,_0x160ea1=_0x5eefe6[0x0],_0x1bcf69=_0x5eefe6[0x1],_0xfc93ce=_0x567d27['output'],_0x22688b=_0x567d27[_0x3320d7(0xce)],_0x4506b4=_0x567d27[_0x3320d7(0xfd)],_0x2c8d14=_0x567d27['yes'],_0x2a8633=_0x567d27[_0x3320d7(0x10e)];let _0x1012e2,_0x22696e;const _0x373cbc=findAgentConfigPath(process[_0x3320d7(0xf3)]());if(_0x160ea1){const _0x533c69=a4_0x53d24e[_0x3320d7(0xa0)](_0x160ea1,'tdx.json');if(existsSync(_0x533c69))try{const _0x20bc70=JSON['parse'](readFileSync(_0x533c69,'utf-8'));_0x1012e2=_0x20bc70[_0x3320d7(0x13f)],_0x22696e=_0x160ea1,console['log'](a4_0x51ad2e['dim'](_0x3320d7(0x93)+_0x533c69+':\x20'+_0x1012e2));}catch{_0x1012e2=_0x160ea1;}else _0x1012e2=_0x160ea1;}else{if(_0x373cbc)try{const _0x26209b=JSON[_0x3320d7(0xa4)](readFileSync(_0x373cbc,_0x3320d7(0x91)));_0x1012e2=_0x26209b['llm_project'],_0x22696e=a4_0x53d24e[_0x3320d7(0x90)](_0x373cbc),console[_0x3320d7(0x111)](a4_0x51ad2e[_0x3320d7(0xcd)](_0x3320d7(0x95)+_0x1012e2));}catch{_0x1012e2=_0x2a8633;}else _0x1012e2=_0x2a8633;}if(!_0x1012e2)return console['log'](a4_0x51ad2e[_0x3320d7(0xca)]('llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3320d7(0x111)]('Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x3320d7(0x111)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project'),console[_0x3320d7(0x111)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory'),console[_0x3320d7(0x111)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent'),0x1;if(_0x1bcf69){const {data:_0x163548}=await withSpinner(_0x3320d7(0x12a)+_0x1bcf69+'\x22\x20from\x20project\x20\x22'+_0x1012e2+_0x3320d7(0x124),()=>_0x1a0f2d[_0x3320d7(0xb6)][_0x3320d7(0xe2)](_0x1012e2,_0x1bcf69,_0xfc93ce,{'dryRun':_0x22688b,'force':_0x4506b4}));if(_0x22688b)return console[_0x3320d7(0x111)](a4_0x51ad2e[_0x3320d7(0xca)](_0x3320d7(0xb8))),console[_0x3320d7(0x111)](_0x3320d7(0xf5)+_0x163548[_0x3320d7(0xd7)]),console[_0x3320d7(0x111)](_0x3320d7(0xea)+_0x163548[_0x3320d7(0xb3)]),_0x163548['diff']&&(console[_0x3320d7(0x111)]('\x0aChanges:'),console[_0x3320d7(0x111)]('─'[_0x3320d7(0x133)](0x3c)),console[_0x3320d7(0x111)](_0x163548[_0x3320d7(0xd3)]),console['log']('─'[_0x3320d7(0x133)](0x3c))),0x0;return console[_0x3320d7(0x111)](a4_0x51ad2e['green'](_0x3320d7(0xb9))),console['log']('Agent:\x20'+_0x163548[_0x3320d7(0xd7)]),console[_0x3320d7(0x111)]('Output:\x20'+_0x163548[_0x3320d7(0xb3)]),console[_0x3320d7(0x111)](_0x3320d7(0x9b)+(_0x163548['isNew']?a4_0x51ad2e[_0x3320d7(0x11b)]('new'):_0x163548[_0x3320d7(0xe9)]?a4_0x51ad2e[_0x3320d7(0xca)]('updated'):a4_0x51ad2e[_0x3320d7(0x12c)](_0x3320d7(0xfe)))),0x0;}const _0x1102d2=_0x22696e||_0xfc93ce,{data:_0x2d9792}=await withSpinner(_0x3320d7(0xdd)+_0x1012e2+_0x3320d7(0x124),()=>_0x1a0f2d[_0x3320d7(0xb6)][_0x3320d7(0x11a)](_0x1012e2,_0x1102d2,{'dryRun':!![]})),_0x500f85=_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x12b)][_0x3320d7(0xc3)]+_0x2d9792[_0x3320d7(0x137)]['knowledgeBases'][_0x3320d7(0xc3)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x101)][_0x3320d7(0xc3)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0xc9)][_0x3320d7(0xc3)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x11c)]['new']+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x13a)][_0x3320d7(0xc3)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x9d)][_0x3320d7(0xc3)],_0x37e9ff=_0x2d9792['counts'][_0x3320d7(0x12b)][_0x3320d7(0x116)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0xbe)][_0x3320d7(0x116)]+_0x2d9792['counts'][_0x3320d7(0x101)][_0x3320d7(0x116)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0xc9)][_0x3320d7(0x116)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x11c)][_0x3320d7(0x116)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x13a)][_0x3320d7(0x116)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x9d)]['updated'],_0x420409=_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x12b)]['unchanged']+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0xbe)]['unchanged']+_0x2d9792[_0x3320d7(0x137)]['textKnowledgeBases'][_0x3320d7(0xfe)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0xc9)][_0x3320d7(0xfe)]+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x11c)][_0x3320d7(0xfe)]+_0x2d9792['counts']['experimentalKnowledgeBases']['unchanged']+_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x9d)][_0x3320d7(0xfe)];console[_0x3320d7(0x111)](_0x3320d7(0x8e)+_0x2d9792[_0x3320d7(0xaa)]+'\x27:'),console[_0x3320d7(0x111)]('\x20\x20'+a4_0x51ad2e[_0x3320d7(0x11b)]('+\x20'+_0x500f85+_0x3320d7(0xcb))+_0x3320d7(0x107)+a4_0x51ad2e[_0x3320d7(0xca)]('~\x20'+_0x37e9ff+_0x3320d7(0x11e))+_0x3320d7(0x107)+a4_0x51ad2e['dim']('=\x20'+_0x420409+'\x20unchanged')),console['log'](_0x3320d7(0xd9)+formatCountSummary(_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x12b)])),console[_0x3320d7(0x111)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2d9792[_0x3320d7(0x137)]['knowledgeBases'])),console[_0x3320d7(0x111)](_0x3320d7(0xd8)+formatCountSummary(_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x101)])),console[_0x3320d7(0x111)](_0x3320d7(0x130)+formatCountSummary(_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0xc9)])),console[_0x3320d7(0x111)](_0x3320d7(0x13c)+formatCountSummary(_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x11c)]));const _0x5e260a=_0x2d9792[_0x3320d7(0x137)]['experimentalKnowledgeBases'][_0x3320d7(0xd0)]>0x0||_0x2d9792['counts'][_0x3320d7(0x9d)][_0x3320d7(0xd0)]>0x0;_0x5e260a&&(console[_0x3320d7(0x111)](_0x3320d7(0x9a)+formatCountSummary(_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x13a)])),console['log'](_0x3320d7(0xeb)+formatCountSummary(_0x2d9792[_0x3320d7(0x137)][_0x3320d7(0x9d)])));console['log'](_0x3320d7(0xc2)+a4_0x51ad2e[_0x3320d7(0x114)](_0x2d9792['outputDir'])),displayDiffs(_0x2d9792[_0x3320d7(0x12b)],_0x2d9792[_0x3320d7(0xbe)],_0x2d9792['textKnowledgeBases'],_0x2d9792[_0x3320d7(0xc9)],_0x2d9792['integrations'],_0x2d9792['experimentalKnowledgeBases'],_0x2d9792['experimentalArtifacts']);if(_0x22688b)return console[_0x3320d7(0x111)](a4_0x51ad2e[_0x3320d7(0xca)](_0x3320d7(0xa7))),0x0;if(_0x500f85===0x0&&_0x37e9ff===0x0)return console[_0x3320d7(0x111)](a4_0x51ad2e[_0x3320d7(0x11b)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x2d9792[_0x3320d7(0xaa)]},_0x567d27[_0x3320d7(0x132)]),console['log'](a4_0x51ad2e[_0x3320d7(0x11b)](_0x3320d7(0xe1)+a4_0x51ad2e[_0x3320d7(0xcd)](_0x3320d7(0x13f))+_0x3320d7(0x121)+a4_0x51ad2e[_0x3320d7(0x114)](_0x2d9792[_0x3320d7(0xaa)]))),0x0;if(!_0x2c8d14&&!_0x4506b4){if(!isInteractive())return console[_0x3320d7(0x11f)](a4_0x51ad2e[_0x3320d7(0x134)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x3320d7(0x11f)](a4_0x51ad2e[_0x3320d7(0xcd)](_0x3320d7(0x115))),0x1;const _0x574d92=await confirmKey(_0x3320d7(0x99)+(_0x500f85+_0x37e9ff)+_0x3320d7(0xa5));if(!_0x574d92)return console[_0x3320d7(0x111)](a4_0x51ad2e[_0x3320d7(0xca)](_0x3320d7(0xbc)),_0x3320d7(0xf8)),0x1;}const {data:_0x28f4f5}=await withSpinner(_0x3320d7(0xf0),()=>_0x1a0f2d[_0x3320d7(0xb6)]['pullProject'](_0x1012e2,_0x1102d2,{'force':_0x4506b4}));return console['log'](a4_0x51ad2e[_0x3320d7(0x11b)](_0x3320d7(0xbd)+(_0x500f85+_0x37e9ff)+'\x20files\x20to\x20'+_0x28f4f5[_0x3320d7(0x119)])),saveSessionContext({'llm_project':_0x28f4f5[_0x3320d7(0xaa)]},_0x567d27['session']),console[_0x3320d7(0x111)](a4_0x51ad2e['green'](_0x3320d7(0xe1)+a4_0x51ad2e[_0x3320d7(0xcd)](_0x3320d7(0x13f))+_0x3320d7(0x121)+a4_0x51ad2e[_0x3320d7(0x114)](_0x28f4f5[_0x3320d7(0xaa)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x266ed6(0x13b)]='agent:clone';['description']=a4_0x266ed6(0xcf);async[a4_0x266ed6(0xa1)](_0x32325e){const _0x167934=a4_0x266ed6,{options:_0xab88fb,args:_0x1405a6,tdx:_0x49bc1b}=_0x32325e,_0x15fadb=_0x1405a6[0x0],_0x43317f=_0xab88fb['name'],_0x106324=_0xab88fb[_0x167934(0xce)],_0x2fd414=_0xab88fb[_0x167934(0xbf)],_0x52d5fc=_0xab88fb[_0x167934(0xc6)],_0x47aa0b=_0xab88fb[_0x167934(0x10e)];let _0x99ff21;const _0x432863=findAgentConfigPath(process[_0x167934(0xf3)]());if(_0x15fadb){const _0x2be10d=a4_0x53d24e[_0x167934(0xa0)](_0x15fadb,_0x167934(0xec));existsSync(_0x2be10d)?(_0x99ff21=_0x15fadb,console[_0x167934(0x111)](a4_0x51ad2e[_0x167934(0xcd)](_0x167934(0x108)+_0x15fadb))):_0x99ff21=_0x15fadb;}else{if(_0x432863)_0x99ff21=a4_0x53d24e[_0x167934(0x90)](_0x432863),console[_0x167934(0x111)](a4_0x51ad2e['dim'](_0x167934(0x92)+_0x99ff21));else{if(_0x47aa0b){const _0x56a3db=sanitizeForFilesystem(_0x47aa0b);let _0x22021a=_0x56a3db,_0x13e4e8=a4_0x53d24e[_0x167934(0xa0)](process['cwd'](),_0x167934(0x12b),_0x56a3db,'tdx.json');if(!existsSync(_0x13e4e8)){const _0x148aa6=normalizeName(_0x47aa0b),_0x26a5b9=a4_0x53d24e[_0x167934(0xa0)](process[_0x167934(0xf3)](),_0x167934(0x12b),_0x148aa6,_0x167934(0xec));existsSync(_0x26a5b9)&&(_0x22021a=_0x148aa6,_0x13e4e8=_0x26a5b9);}if(existsSync(_0x13e4e8))_0x99ff21=a4_0x53d24e['dirname'](_0x13e4e8),console[_0x167934(0x111)](a4_0x51ad2e[_0x167934(0xcd)]('Using\x20local\x20project:\x20'+_0x99ff21));else{const _0x45a7a7=_0xab88fb['profile'];if(_0x45a7a7)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x167934(0x12f)+_0x47aa0b+_0x167934(0x13d),undefined,{'helpText':_0x167934(0x117)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x167934(0xa3)+_0x47aa0b+'\x0a')+(_0x167934(0x102)+_0x22021a+_0x167934(0xf9)+(_0x43317f||'<new-name>')+_0x167934(0x120)+_0x45a7a7)});_0x99ff21=_0x47aa0b,console[_0x167934(0x111)](a4_0x51ad2e['dim'](_0x167934(0xc0)+_0x47aa0b));}}}}if(!_0x99ff21)return console['log'](a4_0x51ad2e[_0x167934(0xca)](_0x167934(0xb2))),console[_0x167934(0x111)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x167934(0x111)](_0x167934(0xe4)),console['log'](_0x167934(0xa6)),console['log']('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x43317f)throw new SDKError(ErrorCode[_0x167934(0xda)],_0x167934(0x138),undefined,{'helpText':_0x167934(0xa8)});if(!_0x2fd414&&!_0x106324){if(!isInteractive())return console[_0x167934(0x11f)](a4_0x51ad2e[_0x167934(0x134)]('\x0aError:'),_0x167934(0x9e)),console[_0x167934(0x11f)](a4_0x51ad2e['dim'](_0x167934(0x115))),0x1;const _0x38144e=await confirmKey('Clone\x20\x22'+_0x99ff21+_0x167934(0x8c)+_0x43317f+'\x22?');if(!_0x38144e)return console[_0x167934(0x111)](a4_0x51ad2e[_0x167934(0xca)](_0x167934(0xbc))),0x1;}const {data:_0x2c3d17}=await withSpinner(_0x167934(0x9c)+_0x99ff21+_0x167934(0xee)+_0x43317f+_0x167934(0x124),()=>_0x49bc1b[_0x167934(0xb6)][_0x167934(0xc7)](_0x99ff21,_0x43317f,{'dryRun':_0x106324}));if(_0x106324){console[_0x167934(0x111)](a4_0x51ad2e['yellow']('Dry\x20run\x20-\x20no\x20changes\x20made')),console[_0x167934(0x111)](_0x167934(0xe8)+_0x2c3d17[_0x167934(0xfb)]),console[_0x167934(0x111)](_0x167934(0x135)+_0x43317f),console['log'](_0x167934(0xf4)),console['log'](_0x167934(0xd9)+_0x2c3d17[_0x167934(0x137)][_0x167934(0x12b)][_0x167934(0x8d)]),console[_0x167934(0x111)]('\x20\x20Knowledge\x20Bases:\x20'+_0x2c3d17[_0x167934(0x137)][_0x167934(0xbe)]['created']),console[_0x167934(0x111)](_0x167934(0x130)+_0x2c3d17[_0x167934(0x137)][_0x167934(0xc9)]['created']);const _0x42376b=_0x2c3d17[_0x167934(0x137)]['experimentalKnowledgeBases'][_0x167934(0x8d)]>0x0||_0x2c3d17[_0x167934(0x137)][_0x167934(0x9d)][_0x167934(0x8d)]>0x0;return _0x42376b&&(console['log']('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+_0x2c3d17[_0x167934(0x137)][_0x167934(0x13a)]['created']),console['log'](_0x167934(0xeb)+_0x2c3d17[_0x167934(0x137)]['experimentalArtifacts']['created'])),0x0;}const _0x58aff6=_0x2c3d17[_0x167934(0x137)]['agents'][_0x167934(0x12d)]>0x0||_0x2c3d17[_0x167934(0x137)][_0x167934(0xbe)][_0x167934(0x12d)]>0x0||_0x2c3d17['counts']['prompts'][_0x167934(0x12d)]>0x0||_0x2c3d17[_0x167934(0x137)][_0x167934(0x13a)][_0x167934(0x12d)]>0x0||_0x2c3d17['counts'][_0x167934(0x9d)][_0x167934(0x12d)]>0x0;_0x58aff6?console[_0x167934(0x111)](a4_0x51ad2e[_0x167934(0xca)](_0x167934(0x122))):console['log'](a4_0x51ad2e[_0x167934(0x11b)](_0x167934(0xba)));console[_0x167934(0x111)](_0x167934(0xe8)+_0x2c3d17[_0x167934(0xfb)]),console[_0x167934(0x111)]('New\x20project:\x20'+_0x2c3d17[_0x167934(0x106)]),console['log'](_0x167934(0x10c)+_0x2c3d17[_0x167934(0x127)]),console[_0x167934(0x111)](),console[_0x167934(0x111)](_0x167934(0x10f)),console[_0x167934(0x111)](_0x167934(0xd9)+formatCountSummary(_0x2c3d17[_0x167934(0x137)][_0x167934(0x12b)])),console[_0x167934(0x111)](_0x167934(0x126)+formatCountSummary(_0x2c3d17[_0x167934(0x137)][_0x167934(0xbe)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x2c3d17[_0x167934(0x137)][_0x167934(0xc9)])),console[_0x167934(0x111)](_0x167934(0x13c)+formatCountSummary(_0x2c3d17['counts'][_0x167934(0x11c)]));const _0x35b633=_0x2c3d17['counts'][_0x167934(0x13a)]['created']>0x0||_0x2c3d17[_0x167934(0x137)]['experimentalKnowledgeBases'][_0x167934(0x116)]>0x0||_0x2c3d17['counts']['experimentalKnowledgeBases'][_0x167934(0xfe)]>0x0||_0x2c3d17[_0x167934(0x137)][_0x167934(0x9d)][_0x167934(0x8d)]>0x0||_0x2c3d17[_0x167934(0x137)]['experimentalArtifacts'][_0x167934(0x116)]>0x0||_0x2c3d17[_0x167934(0x137)]['experimentalArtifacts'][_0x167934(0xfe)]>0x0;_0x35b633&&(console[_0x167934(0x111)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2c3d17[_0x167934(0x137)][_0x167934(0x13a)])),console['log'](_0x167934(0xeb)+formatCountSummary(_0x2c3d17['counts']['experimentalArtifacts'])));if(_0x58aff6){console[_0x167934(0x111)](),console[_0x167934(0x111)](a4_0x51ad2e['red'](_0x167934(0xe5)));for(const _0x51a3f6 of _0x2c3d17['agents']){_0x51a3f6[_0x167934(0x109)]===_0x167934(0x11f)&&console['log'](a4_0x51ad2e[_0x167934(0x134)](_0x167934(0xa2)+_0x51a3f6[_0x167934(0xd7)]+_0x167934(0x8f)+_0x51a3f6[_0x167934(0x11f)]));}for(const _0x150cd5 of _0x2c3d17[_0x167934(0xbe)]){_0x150cd5['action']==='error'&&console[_0x167934(0x111)](a4_0x51ad2e['red']('\x20\x20Knowledge\x20Base\x20\x22'+_0x150cd5['name']+_0x167934(0x8f)+_0x150cd5['error']));}for(const _0x54bc6f of _0x2c3d17[_0x167934(0xc9)]){_0x54bc6f['action']===_0x167934(0x11f)&&console[_0x167934(0x111)](a4_0x51ad2e[_0x167934(0x134)](_0x167934(0x98)+_0x54bc6f[_0x167934(0x13b)]+_0x167934(0x8f)+_0x54bc6f[_0x167934(0x11f)]));}for(const _0x422f62 of _0x2c3d17[_0x167934(0x11c)]){_0x422f62['action']===_0x167934(0x11f)&&console[_0x167934(0x111)](a4_0x51ad2e['red'](_0x167934(0xc8)+_0x422f62[_0x167934(0x13b)]+'\x22:\x20'+_0x422f62[_0x167934(0x11f)]));}for(const _0xf35ff4 of _0x2c3d17[_0x167934(0x13a)]){_0xf35ff4[_0x167934(0x109)]===_0x167934(0x11f)&&console['log'](a4_0x51ad2e['red'](_0x167934(0xb7)+_0xf35ff4['name']+_0x167934(0x8f)+_0xf35ff4['error']));}for(const _0x2ebca6 of _0x2c3d17[_0x167934(0x9d)]){_0x2ebca6[_0x167934(0x109)]===_0x167934(0x11f)&&console[_0x167934(0x111)](a4_0x51ad2e[_0x167934(0x134)](_0x167934(0x13e)+_0x2ebca6[_0x167934(0x13b)]+_0x167934(0x8f)+_0x2ebca6[_0x167934(0x11f)]));}return 0x1;}console[_0x167934(0x111)]();const _0x264671=getLLMProjectUrl(_0x52d5fc,_0x2c3d17['newProjectId']);return console[_0x167934(0x111)](_0x167934(0xfc)+a4_0x51ad2e[_0x167934(0x114)](_0x264671)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x266ed6(0x13b)]=a4_0x266ed6(0x9f);[a4_0x266ed6(0xd4)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x266ed6(0xa1)](_0x21ee5b){const _0x45d6f6=a4_0x266ed6,{options:_0x374b5a,args:_0x113ebc,tdx:_0x330062}=_0x21ee5b;let _0x47a256=_0x113ebc[0x0]||process['cwd']();const _0x5e24e0=_0x374b5a['dryRun'],_0x6c3886=_0x374b5a[_0x45d6f6(0xfd)],_0x569e1f=_0x374b5a[_0x45d6f6(0xbf)],_0x11815a=_0x374b5a[_0x45d6f6(0xc6)],_0x52db83=a4_0x53d24e[_0x45d6f6(0xa0)](_0x47a256,_0x45d6f6(0xd6)),_0x209cd4=existsSync(_0x52db83);if(_0x209cd4){const {data:_0x3a6bcc}=await withSpinner(_0x45d6f6(0xe3)+_0x47a256+_0x45d6f6(0x124),()=>_0x330062[_0x45d6f6(0xb6)][_0x45d6f6(0x96)](_0x47a256,{'dryRun':_0x5e24e0,'force':_0x6c3886}));if(_0x5e24e0)return console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0xca)]('Dry\x20run\x20-\x20no\x20changes\x20made')),console[_0x45d6f6(0x111)](_0x45d6f6(0xb4)+_0x3a6bcc[_0x45d6f6(0xd7)]),0x0;if(_0x3a6bcc[_0x45d6f6(0x109)]==='error')return console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0x134)](_0x45d6f6(0xa9)+_0x3a6bcc[_0x45d6f6(0x11f)])),0x1;console['log'](a4_0x51ad2e[_0x45d6f6(0x11b)](_0x45d6f6(0x128)+_0x3a6bcc[_0x45d6f6(0x109)]+_0x45d6f6(0xcc))),console['log']('Agent:\x20'+_0x3a6bcc[_0x45d6f6(0xd7)]);if(_0x3a6bcc[_0x45d6f6(0xfa)]&&_0x3a6bcc[_0x45d6f6(0x113)]){const _0x487a78=getLLMAgentChatUrl(_0x11815a,_0x3a6bcc['projectId'],_0x3a6bcc['agentId']);console[_0x45d6f6(0x111)](_0x45d6f6(0xf1)+a4_0x51ad2e[_0x45d6f6(0x114)](_0x487a78));}return 0x0;}const _0x515694=_0x374b5a[_0x45d6f6(0x10e)],_0x569f43=resolveProjectFromContext(_0x47a256,_0x515694);if(_0x569f43[_0x45d6f6(0xd1)])_0x47a256=_0x569f43['projectDir'],_0x569f43[_0x45d6f6(0x12e)]===_0x45d6f6(0x94)&&console['log'](a4_0x51ad2e[_0x45d6f6(0xcd)](_0x45d6f6(0x95)+_0x47a256));else{let _0x269832=_0x45d6f6(0x110);_0x569f43[_0x45d6f6(0x112)]===_0x45d6f6(0xf2)&&(_0x269832=_0x569f43[_0x45d6f6(0x129)]+_0x45d6f6(0x100)+_0x569f43[_0x45d6f6(0x10e)]+'\x27\x20to\x20create\x20the\x20folder\x20structure.');throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x569f43[_0x45d6f6(0x112)]===_0x45d6f6(0xff)?_0x569f43[_0x45d6f6(0x129)]:_0x45d6f6(0x136)+_0x47a256,undefined,{'helpText':_0x269832});}const {data:_0x4f9496}=await withSpinner(_0x45d6f6(0xdc),()=>_0x330062[_0x45d6f6(0xb6)][_0x45d6f6(0xae)](_0x47a256,{'dryRun':!![]})),_0x1a9645=_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x12b)][_0x45d6f6(0x12d)]>0x0;if(_0x1a9645){console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0x134)](_0x45d6f6(0xe6)));for(const _0x327125 of _0x4f9496[_0x45d6f6(0x12b)]){_0x327125[_0x45d6f6(0x109)]==='error'&&console['log'](a4_0x51ad2e['red']('\x20\x20Agent\x20\x22'+_0x327125[_0x45d6f6(0xd7)]+_0x45d6f6(0x8f)+_0x327125[_0x45d6f6(0x11f)]));}return 0x1;}const _0x540b2c=_0x4f9496['counts'][_0x45d6f6(0x12b)][_0x45d6f6(0x8d)]+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0xbe)]['created']+_0x4f9496['counts']['textKnowledgeBases'][_0x45d6f6(0x8d)]+_0x4f9496['counts'][_0x45d6f6(0xc9)]['created']+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x11c)][_0x45d6f6(0x8d)]+_0x4f9496[_0x45d6f6(0x137)]['experimentalKnowledgeBases']['created']+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x9d)]['created'],_0x376418=_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x12b)][_0x45d6f6(0x116)]+_0x4f9496['counts'][_0x45d6f6(0xbe)][_0x45d6f6(0x116)]+_0x4f9496[_0x45d6f6(0x137)]['textKnowledgeBases'][_0x45d6f6(0x116)]+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0xc9)]['updated']+_0x4f9496[_0x45d6f6(0x137)]['integrations']['updated']+_0x4f9496['counts'][_0x45d6f6(0x13a)][_0x45d6f6(0x116)]+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x9d)][_0x45d6f6(0x116)],_0x4dc5cb=_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x12b)][_0x45d6f6(0xfe)]+_0x4f9496[_0x45d6f6(0x137)]['knowledgeBases'][_0x45d6f6(0xfe)]+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x101)][_0x45d6f6(0xfe)]+_0x4f9496['counts'][_0x45d6f6(0xc9)]['unchanged']+_0x4f9496['counts'][_0x45d6f6(0x11c)][_0x45d6f6(0xfe)]+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x13a)][_0x45d6f6(0xfe)]+_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x9d)][_0x45d6f6(0xfe)];console[_0x45d6f6(0x111)](_0x45d6f6(0x139)+_0x4f9496[_0x45d6f6(0xaa)]+'\x27:'),console[_0x45d6f6(0x111)]('\x20\x20'+a4_0x51ad2e[_0x45d6f6(0x11b)]('+\x20'+_0x540b2c+_0x45d6f6(0xcb))+'\x20|\x20'+a4_0x51ad2e[_0x45d6f6(0xca)]('~\x20'+_0x376418+_0x45d6f6(0x11e))+'\x20|\x20'+a4_0x51ad2e[_0x45d6f6(0xcd)]('=\x20'+_0x4dc5cb+_0x45d6f6(0xc1))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x4f9496['counts'][_0x45d6f6(0x12b)])),console[_0x45d6f6(0x111)](_0x45d6f6(0x126)+formatCountSummary(_0x4f9496['counts'][_0x45d6f6(0xbe)])),console[_0x45d6f6(0x111)](_0x45d6f6(0xd8)+formatCountSummary(_0x4f9496[_0x45d6f6(0x137)]['textKnowledgeBases'])),console['log'](_0x45d6f6(0x130)+formatCountSummary(_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0xc9)])),console['log'](_0x45d6f6(0x13c)+formatCountSummary(_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x11c)]));const _0x5bbd62=_0x4f9496[_0x45d6f6(0x137)]['experimentalKnowledgeBases'][_0x45d6f6(0x8d)]>0x0||_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x13a)]['updated']>0x0||_0x4f9496['counts'][_0x45d6f6(0x13a)][_0x45d6f6(0xfe)]>0x0||_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x9d)][_0x45d6f6(0x8d)]>0x0||_0x4f9496[_0x45d6f6(0x137)][_0x45d6f6(0x9d)]['updated']>0x0||_0x4f9496['counts'][_0x45d6f6(0x9d)][_0x45d6f6(0xfe)]>0x0;_0x5bbd62&&(console[_0x45d6f6(0x111)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x4f9496[_0x45d6f6(0x137)]['experimentalKnowledgeBases'])),console['log'](_0x45d6f6(0xeb)+formatCountSummary(_0x4f9496['counts'][_0x45d6f6(0x9d)])));console[_0x45d6f6(0x111)](_0x45d6f6(0x125)+a4_0x51ad2e[_0x45d6f6(0x114)](_0x47a256)),displayDiffs(_0x4f9496[_0x45d6f6(0x12b)],_0x4f9496[_0x45d6f6(0xbe)],_0x4f9496['textKnowledgeBases'],_0x4f9496[_0x45d6f6(0xc9)],_0x4f9496[_0x45d6f6(0x11c)],_0x4f9496[_0x45d6f6(0x13a)],_0x4f9496[_0x45d6f6(0x9d)]);if(_0x5e24e0)return console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0xca)](_0x45d6f6(0xac))),0x0;if(_0x540b2c===0x0&&_0x376418===0x0){console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0x11b)](_0x45d6f6(0xf7)));const _0x1117d1=getLLMProjectUrl(_0x11815a,_0x4f9496[_0x45d6f6(0x113)]);return console[_0x45d6f6(0x111)](_0x45d6f6(0xfc)+a4_0x51ad2e['cyan'](_0x1117d1)),0x0;}if(!_0x569e1f&&!_0x6c3886){if(!isInteractive())return console[_0x45d6f6(0x11f)](a4_0x51ad2e['red'](_0x45d6f6(0xad)),_0x45d6f6(0x9e)),console[_0x45d6f6(0x11f)](a4_0x51ad2e[_0x45d6f6(0xcd)](_0x45d6f6(0x115))),0x1;const _0x5e9055=await confirmKey(_0x45d6f6(0x131)+(_0x540b2c+_0x376418)+'\x20resources?');if(!_0x5e9055)return console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0xca)](_0x45d6f6(0xbc)),'-\x20nothing\x20pushed'),0x1;}const {data:_0x19768e}=await withSpinner(_0x45d6f6(0xde),()=>_0x330062[_0x45d6f6(0xb6)][_0x45d6f6(0xae)](_0x47a256,{'force':_0x6c3886})),_0x2dd39c=_0x19768e[_0x45d6f6(0x137)][_0x45d6f6(0x12b)][_0x45d6f6(0x12d)]>0x0||_0x19768e['counts'][_0x45d6f6(0xbe)][_0x45d6f6(0x12d)]>0x0||_0x19768e['counts'][_0x45d6f6(0x101)][_0x45d6f6(0x12d)]>0x0||_0x19768e['counts'][_0x45d6f6(0xc9)][_0x45d6f6(0x12d)]>0x0;if(_0x2dd39c){console['log'](a4_0x51ad2e['yellow'](_0x45d6f6(0xf6))),console[_0x45d6f6(0x111)](),console[_0x45d6f6(0x111)](a4_0x51ad2e['red'](_0x45d6f6(0xe5)));for(const _0x42423e of _0x19768e[_0x45d6f6(0x12b)]){_0x42423e[_0x45d6f6(0x109)]==='error'&&console['log'](a4_0x51ad2e[_0x45d6f6(0x134)]('\x20\x20Agent\x20\x22'+_0x42423e[_0x45d6f6(0xd7)]+_0x45d6f6(0x8f)+_0x42423e[_0x45d6f6(0x11f)]));}for(const _0x23f493 of _0x19768e[_0x45d6f6(0xbe)]){_0x23f493[_0x45d6f6(0x109)]===_0x45d6f6(0x11f)&&console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0x134)](_0x45d6f6(0x118)+_0x23f493['name']+_0x45d6f6(0x8f)+_0x23f493[_0x45d6f6(0x11f)]));}for(const _0x1feb4d of _0x19768e[_0x45d6f6(0x101)]){_0x1feb4d['action']===_0x45d6f6(0x11f)&&console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0x134)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x1feb4d[_0x45d6f6(0x13b)]+_0x45d6f6(0x8f)+_0x1feb4d[_0x45d6f6(0x11f)]));}for(const _0x533e1a of _0x19768e['prompts']){_0x533e1a[_0x45d6f6(0x109)]===_0x45d6f6(0x11f)&&console[_0x45d6f6(0x111)](a4_0x51ad2e[_0x45d6f6(0x134)](_0x45d6f6(0x98)+_0x533e1a[_0x45d6f6(0x13b)]+_0x45d6f6(0x8f)+_0x533e1a[_0x45d6f6(0x11f)]));}for(const _0x38f7cc of _0x19768e[_0x45d6f6(0x11c)]){_0x38f7cc[_0x45d6f6(0x109)]==='error'&&console['log'](a4_0x51ad2e[_0x45d6f6(0x134)]('\x20\x20Integration\x20\x22'+_0x38f7cc['name']+_0x45d6f6(0x8f)+_0x38f7cc['error']));}return 0x1;}console['log'](a4_0x51ad2e['green'](_0x45d6f6(0x10a)+(_0x540b2c+_0x376418)+'\x20resources\x20to\x20\x27'+_0x19768e['projectName']+'\x27'));const _0x29e9e0=getLLMProjectUrl(_0x11815a,_0x19768e[_0x45d6f6(0x113)]);return console[_0x45d6f6(0x111)](_0x45d6f6(0xfc)+a4_0x51ad2e[_0x45d6f6(0x114)](_0x29e9e0)),0x0;}}
@@ -1 +1 @@
1
- const a5_0x41b9d6=a5_0x3325;(function(_0x22843a,_0x2b4d04){const _0x328c20=a5_0x3325,_0x2be005=_0x22843a();while(!![]){try{const _0x24f05e=parseInt(_0x328c20(0x1fe))/0x1*(parseInt(_0x328c20(0x217))/0x2)+-parseInt(_0x328c20(0x226))/0x3+parseInt(_0x328c20(0x25f))/0x4+parseInt(_0x328c20(0x1f7))/0x5*(parseInt(_0x328c20(0x1f4))/0x6)+-parseInt(_0x328c20(0x229))/0x7*(-parseInt(_0x328c20(0x1eb))/0x8)+-parseInt(_0x328c20(0x1da))/0x9+-parseInt(_0x328c20(0x234))/0xa*(parseInt(_0x328c20(0x1e7))/0xb);if(_0x24f05e===_0x2b4d04)break;else _0x2be005['push'](_0x2be005['shift']());}catch(_0x5c5420){_0x2be005['push'](_0x2be005['shift']());}}}(a5_0x1ff1,0xb8c57));import*as a5_0x371230 from'node:fs';import*as a5_0x4569b2 from'node:path';function a5_0x1ff1(){const _0x4b444f=['output','Test\x20Summary','timestamp','substring','Round\x201/','\x20\x20Agent:\x20','yellow','green','tags','reason','status','cyan','Round\x20','white','verbose','Agent:\x20','length','rounds','5517328oEXBwH','text','now','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','agent:test','Conversation\x20URL:\x20','push','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','trim','\x20(new)','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','find','No\x20tests\x20found\x20matching:\x20','\x20\x20Site:\x20','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','/<agent-name>','writeFileSync','Run\x20\x27tdx\x20agent\x20pull\x20','Test\x20Configuration:','\x20\x20Project:\x20','...\x20','Cached\x20run\x20is\x20from\x20site\x20\x22','executeReeval','llm','split','toISOString','690921RtAYIN','Passed:\x20\x20\x20','name','\x20\x20Conversation:\x20','repeat','some','log','New\x20tests\x20to\x20execute:\x20','Run\x20tests\x20for\x20an\x20LLM\x20agent','ERROR','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','utf-8','\x20\x20Evaluating...\x20','21918589buHRmI','filter','red','testName','56vYirLz','stop','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','Executing\x20new\x20tests...','PASS','No\x20tests\x20have\x20tags\x20defined.','Duration:\x20','Running\x20test:\x20','found','18KvUkJo','jsonl','has','349010rqdOyC','\x20\x20Round\x20','tests','\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','...','conversation_url','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','25eTrpvq','no_context','Usage:','execute','eval','basename','message','resolveProjectId','✗\x20FAIL:\x20','table','projectName','description','\x27\x20to\x20create\x20the\x20folder\x20structure.','Available\x20tests:\x20','site','⚠\x20SKIPPED:\x20','map','\x22,\x20but\x20current\x20site\x20is\x20\x22','agentDirs','not\x20found','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','isSpinning','existsSync','test.yml','Errors:\x20\x20\x20','59734IDHPaM','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','includes','start','context',':\x20Sending\x20user\x20input...','\x20-\x20','tsv','forEach','✗\x20ERROR:\x20','Total:\x20\x20\x20\x20','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','\x22:\x20','Re-evaluating\x20cached\x20test\x20run...','2591901MqhSCV','dryRun','reeval','1354745SjUcvF','testYmlPath','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','join','dim','FAIL','Re-evaluating\x20','Error:\x20No\x20previous\x20test\x20run\x20found.','\x20\x20-\x20','Test\x20','resolveAgentId','10eIiXZb','Error\x20writing\x20output\x20file:\x20','agentName','✓\x20PASS:\x20','json','size','agent','\x20(cached)','Output\x20written\x20to:\x20','Failed\x20Tests:','Either\x20switch\x20to\x20the\x20\x22','Running:\x20','llmProject','Failed:\x20\x20\x20','toLowerCase','No\x20tests\x20found\x20with\x20tags:\x20','multiple_agents','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','no_local_folder','round','Evaluating\x20response...','projectDir','Site:\x20','conversations','404'];a5_0x1ff1=function(){return _0x4b444f;};return a5_0x1ff1();}import a5_0x195e9e from'chalk';import{BaseCommand}from'./command.js';function a5_0x3325(_0x5619bd,_0x4b9188){_0x5619bd=_0x5619bd-0x1c8;const _0x1ff186=a5_0x1ff1();let _0x332575=_0x1ff186[_0x5619bd];return _0x332575;}import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{['name']=a5_0x41b9d6(0x263);[a5_0x41b9d6(0x209)]=a5_0x41b9d6(0x1e2);async[a5_0x41b9d6(0x201)](_0x4256c2){const _0x23cd43=a5_0x41b9d6,{options:_0x32a1da,args:_0x58984c,tdx:_0xf58706}=_0x4256c2,_0x45ff7b=_0x58984c[0x0]||'.',_0x3322e6=_0x32a1da[_0x23cd43(0x227)],_0xf76ca7=_0x32a1da,_0x541157=_0xf76ca7[_0x23cd43(0x202)]===![],_0x3cd00f=_0xf76ca7[_0x23cd43(0x228)],_0x4f1f24=_0xf76ca7[_0x23cd43(0x1dc)],_0x345733=_0xf76ca7[_0x23cd43(0x255)],_0x206fb8=_0x32a1da['site'],_0x1892a0=_0xf76ca7[_0x23cd43(0x24d)];if(_0x3cd00f&&_0x541157)return console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x1e9)](_0x23cd43(0x1ca))),0x1;let _0x5358cd=_0x23cd43(0x207);if(_0xf76ca7[_0x23cd43(0x238)])_0x5358cd=_0x23cd43(0x238);else{if(_0xf76ca7['jsonl'])_0x5358cd=_0x23cd43(0x1f5);else{if(_0xf76ca7[_0x23cd43(0x21e)])_0x5358cd=_0x23cd43(0x21e);else{if(_0xf76ca7[_0x23cd43(0x207)])_0x5358cd=_0x23cd43(0x207);}}}const _0x4535a1=_0xf76ca7[_0x23cd43(0x240)];let _0x2732b3=_0x45ff7b;const _0xe6e19=a5_0x371230[_0x23cd43(0x214)](_0x45ff7b),_0x325fab=_0x45ff7b==='.';if(!_0xe6e19||_0x325fab){const _0x2e7c08=resolveProjectFromContext(_0x45ff7b,_0x4535a1,{'requireFile':_0x23cd43(0x215)});if(_0x2e7c08[_0x23cd43(0x1f3)])_0x2732b3=_0x2e7c08[_0x23cd43(0x249)],_0x2e7c08['source']===_0x23cd43(0x21b)&&console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x22d)]('Using\x20agent:\x20'+_0x2732b3));else switch(_0x2e7c08['reason']){case _0x23cd43(0x1ff):console[_0x23cd43(0x1e0)](a5_0x195e9e['yellow'](_0x2e7c08['message'])),console[_0x23cd43(0x1e0)](),console[_0x23cd43(0x1e0)](_0x23cd43(0x200)),console[_0x23cd43(0x1e0)](_0x23cd43(0x1fa)),console[_0x23cd43(0x1e0)](_0x23cd43(0x222)),console[_0x23cd43(0x1e0)](),console[_0x23cd43(0x1e0)](_0x23cd43(0x1e4));return 0x1;case _0x23cd43(0x246):console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x253)](_0x2e7c08['message'])),console['log'](),console['log'](_0x23cd43(0x1d1)+_0x2e7c08[_0x23cd43(0x240)]+_0x23cd43(0x20a));return 0x1;case _0x23cd43(0x244):{const _0x223561=a5_0x4569b2[_0x23cd43(0x203)](_0x2e7c08[_0x23cd43(0x249)]);console['log'](a5_0x195e9e[_0x23cd43(0x253)](_0x23cd43(0x1ed)+_0x2e7c08[_0x23cd43(0x240)]+'\x22:'));for(const _0x223313 of _0x2e7c08[_0x23cd43(0x210)]){console['log'](_0x23cd43(0x231)+_0x223313);}return console[_0x23cd43(0x1e0)](),console[_0x23cd43(0x1e0)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x223561+_0x23cd43(0x1cf)),0x1;}case'no_tests':console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x253)](_0x23cd43(0x218)+_0x2e7c08[_0x23cd43(0x240)]+'\x22.')),console[_0x23cd43(0x1e0)](a5_0x195e9e['dim']('Project\x20path:\x20'+_0x2e7c08[_0x23cd43(0x249)])),console['log'](),console['log']('Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.');return 0x1;}}const {definition:_0x2dceb0,agentInfo:_0x30486f}=parseTestFile(_0x2732b3);let _0x4981a0=_0x2dceb0[_0x23cd43(0x1f9)];if(_0x4f1f24){const _0x712fde=_0x4f1f24[_0x23cd43(0x1d8)](',')[_0x23cd43(0x20e)](_0x57cdf8=>_0x57cdf8[_0x23cd43(0x1c8)]());_0x4981a0=_0x2dceb0[_0x23cd43(0x1f9)][_0x23cd43(0x1e8)](_0x39d0a9=>_0x712fde[_0x23cd43(0x219)](_0x39d0a9[_0x23cd43(0x1dc)]));if(_0x4981a0[_0x23cd43(0x25d)]===0x0)return console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x253)](_0x23cd43(0x1cc)+_0x4f1f24)),console[_0x23cd43(0x1e0)](a5_0x195e9e['dim'](_0x23cd43(0x20b)+_0x2dceb0[_0x23cd43(0x1f9)][_0x23cd43(0x20e)](_0x4e0e2a=>_0x4e0e2a[_0x23cd43(0x1dc)])[_0x23cd43(0x22c)](',\x20'))),0x1;}if(_0x345733){const _0x146427=_0x345733[_0x23cd43(0x1d8)](',')[_0x23cd43(0x20e)](_0x451ecc=>_0x451ecc[_0x23cd43(0x1c8)]()[_0x23cd43(0x242)]());_0x4981a0=_0x4981a0['filter'](_0x5019f3=>_0x5019f3[_0x23cd43(0x255)]?.[_0x23cd43(0x1df)](_0x3da208=>_0x146427[_0x23cd43(0x219)](_0x3da208['toLowerCase']())));if(_0x4981a0[_0x23cd43(0x25d)]===0x0){console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x253)](_0x23cd43(0x243)+_0x345733));const _0xb054c=new Set();return _0x2dceb0[_0x23cd43(0x1f9)][_0x23cd43(0x21f)](_0x138b7c=>_0x138b7c[_0x23cd43(0x255)]?.[_0x23cd43(0x21f)](_0x49ebdb=>_0xb054c['add'](_0x49ebdb))),_0xb054c[_0x23cd43(0x239)]>0x0?console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x22d)]('Available\x20tags:\x20'+[..._0xb054c][_0x23cd43(0x22c)](',\x20'))):console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x22d)](_0x23cd43(0x1f0))),0x1;}}if(_0x3cd00f)return this['executeReeval'](_0x4256c2,{'definition':{'tests':_0x4981a0},'agentInfo':_0x30486f,'outputFormat':_0x5358cd,'outputFile':_0x1892a0,'testNames':_0x4f1f24});if(_0x3322e6){console[_0x23cd43(0x1e0)](a5_0x195e9e['cyan'](_0x23cd43(0x1d2))),console[_0x23cd43(0x1e0)](_0x23cd43(0x1cd)+a5_0x195e9e[_0x23cd43(0x25a)](_0x206fb8)),console[_0x23cd43(0x1e0)](_0x23cd43(0x1d3)+a5_0x195e9e[_0x23cd43(0x25a)](_0x30486f[_0x23cd43(0x208)])),console[_0x23cd43(0x1e0)](_0x23cd43(0x252)+a5_0x195e9e['white'](_0x30486f[_0x23cd43(0x236)])),console[_0x23cd43(0x1e0)](),console[_0x23cd43(0x1e0)]('Tests\x20found:\x20'+a5_0x195e9e[_0x23cd43(0x25a)](_0x4981a0[_0x23cd43(0x25d)]));for(let _0x15f69f=0x0;_0x15f69f<_0x4981a0[_0x23cd43(0x25d)];_0x15f69f++){const _0x563de8=_0x4981a0[_0x15f69f],_0x5c2c07=_0x563de8[_0x23cd43(0x25e)][_0x23cd43(0x25d)]===0x1?_0x23cd43(0x247):_0x23cd43(0x25e),_0x199019=_0x563de8[_0x23cd43(0x255)]?.['length']?'\x20['+_0x563de8[_0x23cd43(0x255)]['join'](',\x20')+']':'';console[_0x23cd43(0x1e0)]('\x20\x20'+(_0x15f69f+0x1)+'.\x20'+a5_0x195e9e[_0x23cd43(0x25a)](_0x563de8[_0x23cd43(0x1dc)])+'\x20('+_0x563de8['rounds'][_0x23cd43(0x25d)]+'\x20'+_0x5c2c07+')'+a5_0x195e9e[_0x23cd43(0x22d)](_0x199019));}return 0x0;}let _0x4e5ada,_0x3ddc44;try{_0x4e5ada=await _0xf58706[_0x23cd43(0x1d7)][_0x23cd43(0x205)](_0x30486f[_0x23cd43(0x208)]);}catch(_0xe71fee){const _0x37510=_0xe71fee instanceof Error?_0xe71fee[_0x23cd43(0x204)]:String(_0xe71fee);return _0x37510['includes'](_0x23cd43(0x24c))||_0x37510['toLowerCase']()['includes'](_0x23cd43(0x211))?console['log'](a5_0x195e9e[_0x23cd43(0x1e9)]('✗\x20ERROR:\x20Project\x20not\x20found:\x20'+_0x30486f['projectName'])):console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x1e9)](_0x23cd43(0x22b)+_0x30486f[_0x23cd43(0x208)]+_0x23cd43(0x224)+_0x37510)),0x1;}try{_0x3ddc44=await _0xf58706[_0x23cd43(0x1d7)][_0x23cd43(0x233)](_0x30486f[_0x23cd43(0x236)],_0x4e5ada);}catch(_0x1628e2){const _0xe3a174=_0x1628e2 instanceof Error?_0x1628e2[_0x23cd43(0x204)]:String(_0x1628e2);return _0xe3a174['includes'](_0x23cd43(0x24c))||_0xe3a174[_0x23cd43(0x242)]()[_0x23cd43(0x219)](_0x23cd43(0x211))?console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x1e9)]('✗\x20ERROR:\x20Agent\x20not\x20found:\x20'+_0x30486f[_0x23cd43(0x236)])):console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x1e9)](_0x23cd43(0x1fd)+_0x30486f[_0x23cd43(0x236)]+_0x23cd43(0x224)+_0xe3a174)),0x1;}let _0xb3ce92;if(!_0x541157)try{_0xb3ce92=await setupEvaluatorAgent(_0xf58706[_0x23cd43(0x1d7)],_0x32a1da[_0x23cd43(0x25b)]);}catch(_0x55edd2){const _0x40a5f7=_0x55edd2 instanceof Error?_0x55edd2[_0x23cd43(0x204)]:String(_0x55edd2);return console['log'](a5_0x195e9e['red']('✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20'+_0x40a5f7)),0x1;}console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x258)]('Running\x20agent\x20tests...')),console[_0x23cd43(0x1e0)](_0x23cd43(0x24a)+a5_0x195e9e['white'](_0x206fb8)),console['log'](_0x23cd43(0x25c)+a5_0x195e9e[_0x23cd43(0x25a)](_0x30486f[_0x23cd43(0x208)]+'/'+_0x30486f[_0x23cd43(0x236)])),console['log']();const _0x254d04=[],_0x2e4f50=[],_0x400c7d=Date[_0x23cd43(0x261)]();for(let _0x23ab44=0x0;_0x23ab44<_0x4981a0[_0x23cd43(0x25d)];_0x23ab44++){const _0x2b4120=_0x4981a0[_0x23ab44];_0x4981a0['length']>0x1?console[_0x23cd43(0x1e0)](_0x23cd43(0x232)+(_0x23ab44+0x1)+'/'+_0x4981a0[_0x23cd43(0x25d)]+':\x20'+a5_0x195e9e['white'](_0x2b4120[_0x23cd43(0x1dc)])):console[_0x23cd43(0x1e0)](_0x23cd43(0x1f2)+a5_0x195e9e['white'](_0x2b4120[_0x23cd43(0x1dc)]));const _0x9df976=createCommandSpinner(_0x23cd43(0x251)+_0x2b4120[_0x23cd43(0x25e)][_0x23cd43(0x25d)]+_0x23cd43(0x21c));_0x9df976[_0x23cd43(0x21a)]();try{const {result:_0xb44819,conversation:_0x3ff1d6}=await runTest(_0xf58706[_0x23cd43(0x1d7)],_0x2b4120,{'agentId':_0x3ddc44,'projectId':_0x4e5ada,'site':_0x206fb8,'noEval':_0x541157,'evaluatorId':_0xb3ce92,'onRoundStart':(_0x5328e9,_0x940a61)=>{const _0x334868=_0x23cd43;_0x9df976[_0x334868(0x260)]=_0x334868(0x259)+(_0x5328e9+0x1)+'/'+_0x940a61+_0x334868(0x21c);},'onRoundComplete':(_0x280fc7,_0x460359,_0x2b20b5)=>{const _0x1e6a22=_0x23cd43,_0x2c1887=formatElapsed(_0x460359);_0x2b20b5?console['log'](_0x1e6a22(0x1f8)+(_0x280fc7+0x1)+'/'+_0x2b4120[_0x1e6a22(0x25e)][_0x1e6a22(0x25d)]+_0x1e6a22(0x1d4)+a5_0x195e9e[_0x1e6a22(0x254)]('✓')+'\x20('+_0x2c1887+')'):console[_0x1e6a22(0x1e0)](_0x1e6a22(0x1f8)+(_0x280fc7+0x1)+'/'+_0x2b4120[_0x1e6a22(0x25e)][_0x1e6a22(0x25d)]+'...\x20'+a5_0x195e9e[_0x1e6a22(0x1e9)]('✗'));},'onEvaluationStart':()=>{const _0x53c5ea=_0x23cd43;_0x9df976[_0x53c5ea(0x260)]=_0x53c5ea(0x248);},'onEvaluationComplete':_0x2da33f=>{const _0x48c32=formatElapsed(_0x2da33f);console['log']('\x20\x20Evaluating...\x20'+a5_0x195e9e['green']('✓')+'\x20('+_0x48c32+')');}});_0x9df976['stop'](),_0x254d04['push'](_0xb44819),_0x2e4f50['push'](_0x3ff1d6);if(_0xb44819['status']===_0x23cd43(0x1ef))console[_0x23cd43(0x1e0)](a5_0x195e9e['green']('✓\x20PASS:\x20'+_0xb44819['reason']));else _0xb44819['status']==='FAIL'?console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x1e9)]('✗\x20FAIL:\x20'+_0xb44819['reason'])):console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x1e9)](_0x23cd43(0x220)+_0xb44819[_0x23cd43(0x256)]));_0xb44819[_0x23cd43(0x1fc)]&&console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x22d)](_0x23cd43(0x264)+_0xb44819[_0x23cd43(0x1fc)])),console[_0x23cd43(0x1e0)]();}catch(_0x3e77aa){_0x9df976[_0x23cd43(0x1ec)]();const _0x5996b8=_0x3e77aa instanceof Error?_0x3e77aa[_0x23cd43(0x204)]:String(_0x3e77aa);console[_0x23cd43(0x1e0)](a5_0x195e9e['red'](_0x23cd43(0x220)+_0x5996b8)),console[_0x23cd43(0x1e0)](),_0x254d04[_0x23cd43(0x265)]({'name':_0x2b4120[_0x23cd43(0x1dc)],'status':_0x23cd43(0x1e3),'reason':_0x5996b8,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}const _0x5f35c3=Date[_0x23cd43(0x261)]()-_0x400c7d,_0x2f338a=_0x254d04[_0x23cd43(0x1e8)](_0x3aeb9d=>_0x3aeb9d[_0x23cd43(0x257)]==='PASS')[_0x23cd43(0x25d)],_0x42e315=_0x254d04['filter'](_0x4666da=>_0x4666da[_0x23cd43(0x257)]===_0x23cd43(0x22e))['length'],_0x29126e=_0x254d04[_0x23cd43(0x1e8)](_0x1abc26=>_0x1abc26[_0x23cd43(0x257)]==='ERROR')[_0x23cd43(0x25d)];console['log']('━'[_0x23cd43(0x1de)](0x3c)),console[_0x23cd43(0x1e0)](_0x23cd43(0x24e)),console['log']('━'[_0x23cd43(0x1de)](0x3c)),console['log'](_0x23cd43(0x221)+_0x254d04[_0x23cd43(0x25d)]),console[_0x23cd43(0x1e0)](_0x23cd43(0x1db)+a5_0x195e9e[_0x23cd43(0x254)](_0x2f338a)),console[_0x23cd43(0x1e0)](_0x23cd43(0x241)+a5_0x195e9e[_0x23cd43(0x1e9)](_0x42e315));_0x29126e>0x0&&console[_0x23cd43(0x1e0)](_0x23cd43(0x216)+a5_0x195e9e['red'](_0x29126e));console['log'](_0x23cd43(0x1f1)+formatElapsed(_0x5f35c3)),console[_0x23cd43(0x1e0)]('━'['repeat'](0x3c));const _0xfe3510=_0x254d04[_0x23cd43(0x1e8)](_0x508f3f=>_0x508f3f[_0x23cd43(0x257)]!==_0x23cd43(0x1ef));if(_0xfe3510[_0x23cd43(0x25d)]>0x0){console[_0x23cd43(0x1e0)](),console[_0x23cd43(0x1e0)](_0x23cd43(0x23d));for(const _0x3f4a17 of _0xfe3510){const _0x3efa5a=a5_0x195e9e[_0x23cd43(0x1e9)]('✗'),_0x3ded9d=_0x3f4a17['reason'][_0x23cd43(0x25d)]>0x32?_0x3f4a17[_0x23cd43(0x256)][_0x23cd43(0x250)](0x0,0x32)+'...':_0x3f4a17[_0x23cd43(0x256)];console[_0x23cd43(0x1e0)]('\x20\x20'+_0x3efa5a+'\x20'+_0x3f4a17['name']+':\x20'+_0x3ded9d);}}const _0x4e3ae1={'summary':{'total':_0x254d04[_0x23cd43(0x25d)],'passed':_0x2f338a,'failed':_0x42e315,'errors':_0x29126e>0x0?_0x29126e:undefined,'duration_ms':_0x5f35c3},'tests':_0x254d04,'agent':{'project':_0x30486f[_0x23cd43(0x208)],'name':_0x30486f['agentName'],'site':_0x206fb8},'timestamp':new Date(_0x400c7d)['toISOString']()};try{const _0x185732=buildCachedTestRun(_0x2e4f50,{'site':_0x206fb8,'projectId':_0x4e5ada,'projectName':_0x30486f[_0x23cd43(0x208)],'agentId':_0x3ddc44,'agentName':_0x30486f['agentName'],'testYmlPath':a5_0x4569b2['resolve'](_0x30486f[_0x23cd43(0x22a)])});saveLastTestRun(_0x185732);}catch{}if(_0x5358cd!==_0x23cd43(0x207)||_0x1892a0){const _0x42c639=formatResults(_0x4e3ae1,_0x5358cd);if(_0x1892a0)try{a5_0x371230[_0x23cd43(0x1d0)](_0x1892a0,_0x42c639,'utf-8'),console[_0x23cd43(0x1e0)](),console[_0x23cd43(0x1e0)](a5_0x195e9e[_0x23cd43(0x22d)]('Output\x20written\x20to:\x20'+_0x1892a0));}catch(_0x2d5200){return console[_0x23cd43(0x1e0)](),console['log'](a5_0x195e9e[_0x23cd43(0x1e9)]('Error\x20writing\x20output\x20file:\x20'+_0x2d5200)),0x1;}else console['log'](),console[_0x23cd43(0x1e0)](_0x42c639);}return _0xfe3510[_0x23cd43(0x25d)]>0x0?0x1:0x0;}async[a5_0x41b9d6(0x1d6)](_0x2d9b07,_0x4fd07b){const _0x22680a=a5_0x41b9d6,{options:_0x5e99e3,tdx:_0x5b93ec}=_0x2d9b07,{definition:_0x34773d,agentInfo:_0x42148f,outputFormat:_0x366699,outputFile:_0x4596e9}=_0x4fd07b,_0x3b94f6=_0x5e99e3[_0x22680a(0x20c)],_0x21e29a=loadLastTestRun();if(!_0x21e29a)return console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x1e9)](_0x22680a(0x230))),console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x245))),0x1;if(_0x21e29a[_0x22680a(0x23a)][_0x22680a(0x236)]!==_0x42148f[_0x22680a(0x236)])return console['log'](a5_0x195e9e[_0x22680a(0x1e9)]('Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22'+_0x21e29a[_0x22680a(0x23a)][_0x22680a(0x236)]+_0x22680a(0x223)+_0x42148f['agentName']+'\x22.')),console['log'](a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x1ce))),0x1;const _0x25a33f=new Set(_0x21e29a[_0x22680a(0x24b)]['map'](_0x1df8b0=>_0x1df8b0[_0x22680a(0x1ea)])),_0x203844=_0x34773d['tests'][_0x22680a(0x1e8)](_0x299cf1=>!_0x25a33f['has'](_0x299cf1[_0x22680a(0x1dc)]));if(_0x203844['length']>0x0&&_0x21e29a[_0x22680a(0x20c)]!==_0x3b94f6)return console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x1e9)](_0x22680a(0x266))),console['log'](a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x1d5)+_0x21e29a[_0x22680a(0x20c)]+_0x22680a(0x20f)+_0x3b94f6+'\x22.')),console[_0x22680a(0x1e0)](a5_0x195e9e['dim'](_0x22680a(0x23e)+_0x21e29a[_0x22680a(0x20c)]+_0x22680a(0x212))),0x1;const _0xc5820c=_0x34773d[_0x22680a(0x1f9)][_0x22680a(0x1e8)](_0x3a8331=>_0x25a33f[_0x22680a(0x1f6)](_0x3a8331[_0x22680a(0x1dc)])),_0x67f185=_0x203844;let _0x16a7cb;try{_0x16a7cb=await setupEvaluatorAgent(_0x5b93ec['llm'],_0x5e99e3[_0x22680a(0x25b)]);}catch(_0x4d6f8b){const _0x25c24f=_0x4d6f8b instanceof Error?_0x4d6f8b[_0x22680a(0x204)]:String(_0x4d6f8b);return console[_0x22680a(0x1e0)](a5_0x195e9e['red'](_0x22680a(0x262)+_0x25c24f)),0x1;}console['log'](a5_0x195e9e[_0x22680a(0x258)](_0x22680a(0x225))),console[_0x22680a(0x1e0)]('Cached\x20run\x20from:\x20'+a5_0x195e9e[_0x22680a(0x25a)](_0x21e29a[_0x22680a(0x24f)])),console[_0x22680a(0x1e0)](_0x22680a(0x25c)+a5_0x195e9e['white'](_0x21e29a[_0x22680a(0x23a)][_0x22680a(0x208)]+'/'+_0x21e29a['agent'][_0x22680a(0x236)]));_0x67f185[_0x22680a(0x25d)]>0x0&&console['log'](_0x22680a(0x1e1)+a5_0x195e9e[_0x22680a(0x253)](_0x67f185[_0x22680a(0x25d)]));console[_0x22680a(0x1e0)]();const _0x4ff134=[],_0x53351d=Date['now'](),_0x5156ae=createCommandSpinner('Re-evaluating...');if(_0xc5820c[_0x22680a(0x25d)]>0x0)try{const _0x3847f8=await reevaluateFromCache(_0x5b93ec['llm'],_0x21e29a,{'tests':_0xc5820c},{'evaluatorId':_0x16a7cb,'onTestStart':(_0x61b277,_0x59fd39,_0x5a0ecb)=>{const _0x384f2b=_0x22680a;_0x5156ae['text']=_0x384f2b(0x22f)+(_0x59fd39+0x1)+'/'+_0x5a0ecb+':\x20'+_0x61b277+_0x384f2b(0x1fb);if(!_0x5156ae[_0x384f2b(0x213)])_0x5156ae[_0x384f2b(0x21a)]();},'onTestComplete':(_0x402385,_0xb39eec)=>{const _0x507eb6=_0x22680a;_0x5156ae['stop']();if(_0xb39eec[_0x507eb6(0x257)]===_0x507eb6(0x1ef))console['log'](a5_0x195e9e[_0x507eb6(0x254)](_0x507eb6(0x237)+_0x402385)+a5_0x195e9e[_0x507eb6(0x22d)]('\x20(cached)'));else _0xb39eec['status']==='FAIL'?console[_0x507eb6(0x1e0)](a5_0x195e9e[_0x507eb6(0x1e9)](_0x507eb6(0x206)+_0x402385+'\x20-\x20'+_0xb39eec[_0x507eb6(0x256)])+a5_0x195e9e[_0x507eb6(0x22d)](_0x507eb6(0x23b))):console[_0x507eb6(0x1e0)](a5_0x195e9e[_0x507eb6(0x1e9)](_0x507eb6(0x220)+_0x402385+_0x507eb6(0x21d)+_0xb39eec[_0x507eb6(0x256)]));_0xb39eec[_0x507eb6(0x1fc)]&&console[_0x507eb6(0x1e0)](a5_0x195e9e[_0x507eb6(0x22d)](_0x507eb6(0x1dd)+_0xb39eec[_0x507eb6(0x1fc)])),_0x4ff134[_0x507eb6(0x265)](_0xb39eec);},'onTestSkipped':(_0x1edf2b,_0x428da2)=>{const _0x581055=_0x22680a;_0x5156ae[_0x581055(0x1ec)](),console['log'](a5_0x195e9e['yellow'](_0x581055(0x20d)+_0x1edf2b+_0x581055(0x21d)+_0x428da2));}});for(const _0x134411 of _0x3847f8){!_0x4ff134[_0x22680a(0x1cb)](_0x589564=>_0x589564[_0x22680a(0x1dc)]===_0x134411[_0x22680a(0x1dc)])&&_0x4ff134['push'](_0x134411);}}catch(_0x7ee6a3){_0x5156ae[_0x22680a(0x1ec)]();const _0x2b4fd0=_0x7ee6a3 instanceof Error?_0x7ee6a3[_0x22680a(0x204)]:String(_0x7ee6a3);return console[_0x22680a(0x1e0)](a5_0x195e9e['red']('✗\x20ERROR:\x20Re-evaluation\x20failed:\x20'+_0x2b4fd0)),0x1;}_0x5156ae[_0x22680a(0x1ec)]();if(_0x67f185[_0x22680a(0x25d)]>0x0){console[_0x22680a(0x1e0)](),console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x258)](_0x22680a(0x1ee)));const {projectId:_0x350a23,agentId:_0x4edbbe}=_0x21e29a[_0x22680a(0x23a)];for(const _0x5c91f2 of _0x67f185){console['log'](_0x22680a(0x23f)+a5_0x195e9e[_0x22680a(0x25a)](_0x5c91f2['name']));const _0x37cac8=createCommandSpinner(_0x22680a(0x251)+_0x5c91f2[_0x22680a(0x25e)][_0x22680a(0x25d)]+_0x22680a(0x21c));_0x37cac8[_0x22680a(0x21a)]();try{const {result:_0x331673}=await runTest(_0x5b93ec['llm'],_0x5c91f2,{'agentId':_0x4edbbe,'projectId':_0x350a23,'site':_0x21e29a[_0x22680a(0x20c)],'noEval':![],'evaluatorId':_0x16a7cb,'onRoundStart':(_0x274948,_0x570395)=>{const _0x5bb896=_0x22680a;_0x37cac8[_0x5bb896(0x260)]=_0x5bb896(0x259)+(_0x274948+0x1)+'/'+_0x570395+_0x5bb896(0x21c);},'onRoundComplete':(_0x44cdb0,_0x4fb1cb,_0x487abb)=>{const _0x5dab62=_0x22680a,_0x399a7b=formatElapsed(_0x4fb1cb);_0x487abb?console[_0x5dab62(0x1e0)]('\x20\x20Round\x20'+(_0x44cdb0+0x1)+'/'+_0x5c91f2[_0x5dab62(0x25e)][_0x5dab62(0x25d)]+'...\x20'+a5_0x195e9e[_0x5dab62(0x254)]('✓')+'\x20('+_0x399a7b+')'):console[_0x5dab62(0x1e0)](_0x5dab62(0x1f8)+(_0x44cdb0+0x1)+'/'+_0x5c91f2[_0x5dab62(0x25e)][_0x5dab62(0x25d)]+_0x5dab62(0x1d4)+a5_0x195e9e[_0x5dab62(0x1e9)]('✗'));},'onEvaluationStart':()=>{const _0x2a247c=_0x22680a;_0x37cac8[_0x2a247c(0x260)]=_0x2a247c(0x248);},'onEvaluationComplete':_0x48ef0b=>{const _0x189099=_0x22680a,_0x247b02=formatElapsed(_0x48ef0b);console[_0x189099(0x1e0)](_0x189099(0x1e6)+a5_0x195e9e[_0x189099(0x254)]('✓')+'\x20('+_0x247b02+')');}});_0x37cac8[_0x22680a(0x1ec)](),_0x4ff134[_0x22680a(0x265)](_0x331673);if(_0x331673[_0x22680a(0x257)]==='PASS')console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x254)](_0x22680a(0x237)+_0x331673[_0x22680a(0x256)])+a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x1c9)));else _0x331673[_0x22680a(0x257)]===_0x22680a(0x22e)?console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x1e9)](_0x22680a(0x206)+_0x331673['reason'])+a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x1c9))):console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x1e9)]('✗\x20ERROR:\x20'+_0x331673[_0x22680a(0x256)]));_0x331673[_0x22680a(0x1fc)]&&console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x1dd)+_0x331673['conversation_url']));}catch(_0x2b8bc4){_0x37cac8[_0x22680a(0x1ec)]();const _0x33a078=_0x2b8bc4 instanceof Error?_0x2b8bc4[_0x22680a(0x204)]:String(_0x2b8bc4);console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x1e9)](_0x22680a(0x220)+_0x33a078)),_0x4ff134[_0x22680a(0x265)]({'name':_0x5c91f2['name'],'status':_0x22680a(0x1e3),'reason':_0x33a078,'timestamp':new Date()[_0x22680a(0x1d9)](),'duration_ms':0x0});}}}console[_0x22680a(0x1e0)]();const _0x2a030b=Date[_0x22680a(0x261)]()-_0x53351d,_0x424eed=_0x4ff134[_0x22680a(0x1e8)](_0x511f4b=>_0x511f4b[_0x22680a(0x257)]===_0x22680a(0x1ef))[_0x22680a(0x25d)],_0x1f6f64=_0x4ff134[_0x22680a(0x1e8)](_0x25a4a8=>_0x25a4a8[_0x22680a(0x257)]===_0x22680a(0x22e))[_0x22680a(0x25d)],_0x198747=_0x4ff134['filter'](_0x22f167=>_0x22f167[_0x22680a(0x257)]==='ERROR')[_0x22680a(0x25d)];console['log']('━'[_0x22680a(0x1de)](0x3c)),console[_0x22680a(0x1e0)]('Re-evaluation\x20Summary'),console[_0x22680a(0x1e0)]('━'[_0x22680a(0x1de)](0x3c)),console['log'](_0x22680a(0x221)+_0x4ff134[_0x22680a(0x25d)]),console['log'](_0x22680a(0x1db)+a5_0x195e9e[_0x22680a(0x254)](_0x424eed)),console[_0x22680a(0x1e0)](_0x22680a(0x241)+a5_0x195e9e[_0x22680a(0x1e9)](_0x1f6f64));_0x198747>0x0&&console[_0x22680a(0x1e0)](_0x22680a(0x216)+a5_0x195e9e['red'](_0x198747));console[_0x22680a(0x1e0)](_0x22680a(0x1f1)+formatElapsed(_0x2a030b)),console['log']('━'[_0x22680a(0x1de)](0x3c));const _0x2a4514={'summary':{'total':_0x4ff134[_0x22680a(0x25d)],'passed':_0x424eed,'failed':_0x1f6f64,'errors':_0x198747>0x0?_0x198747:undefined,'duration_ms':_0x2a030b},'tests':_0x4ff134,'agent':{'project':_0x42148f[_0x22680a(0x208)],'name':_0x42148f['agentName'],'site':_0x3b94f6},'timestamp':new Date(_0x53351d)[_0x22680a(0x1d9)]()};if(_0x366699!==_0x22680a(0x207)||_0x4596e9){const _0x20025f=formatResults(_0x2a4514,_0x366699);if(_0x4596e9)try{a5_0x371230[_0x22680a(0x1d0)](_0x4596e9,_0x20025f,_0x22680a(0x1e5)),console[_0x22680a(0x1e0)](),console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x22d)](_0x22680a(0x23c)+_0x4596e9));}catch(_0x5128a6){return console[_0x22680a(0x1e0)](),console[_0x22680a(0x1e0)](a5_0x195e9e[_0x22680a(0x1e9)](_0x22680a(0x235)+_0x5128a6)),0x1;}else console['log'](),console['log'](_0x20025f);}const _0x51046f=_0x4ff134[_0x22680a(0x1e8)](_0x3e275b=>_0x3e275b[_0x22680a(0x257)]!==_0x22680a(0x1ef));return _0x51046f[_0x22680a(0x25d)]>0x0?0x1:0x0;}}
1
+ const a5_0x47d17d=a5_0x30ad;(function(_0x4e6c8a,_0x2c2aed){const _0x23c632=a5_0x30ad,_0x28d395=_0x4e6c8a();while(!![]){try{const _0x3f86df=-parseInt(_0x23c632(0x230))/0x1*(-parseInt(_0x23c632(0x222))/0x2)+parseInt(_0x23c632(0x1ef))/0x3+parseInt(_0x23c632(0x257))/0x4*(parseInt(_0x23c632(0x23a))/0x5)+-parseInt(_0x23c632(0x1d7))/0x6+-parseInt(_0x23c632(0x207))/0x7+-parseInt(_0x23c632(0x1dd))/0x8+parseInt(_0x23c632(0x266))/0x9;if(_0x3f86df===_0x2c2aed)break;else _0x28d395['push'](_0x28d395['shift']());}catch(_0x1d7544){_0x28d395['push'](_0x28d395['shift']());}}}(a5_0xfe96,0xb0b9c));import*as a5_0x3baeb1 from'node:fs';import*as a5_0x39557c from'node:path';import a5_0x32ce2e from'chalk';import{BaseCommand}from'./command.js';function a5_0xfe96(){const _0x4754df=['No\x20tests\x20have\x20tags\x20defined.','Evaluating\x20response...','404','multiple_agents','llmProject','Duration:\x20','6FCuVDo','projectDir','testName','has','name','tests','Available\x20tests:\x20','\x20\x20Round\x20','writeFileSync','Site:\x20','map','✓\x20PASS:\x20','repeat','testYmlPath','60077mGRYpP','llm','eval','resolveProjectId','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','Tests\x20found:\x20','log','reeval','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','Running:\x20','5691815avUkPq','execute','\x20(cached)','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Failed:\x20\x20\x20','forEach','status','dryRun','\x20\x20Project:\x20','\x20\x20-\x20','includes','test.yml','Re-evaluating...','✗\x20ERROR:\x20','executeReeval','push','\x22:\x20','green','\x20\x20Agent:\x20',':\x20Sending\x20user\x20input...','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','projectName','output','start','\x20-\x20','now','rounds','Error\x20writing\x20output\x20file:\x20','jsonl','4uSNJGd','white','/<agent-name>','agentDirs','agent','FAIL','Round\x20','Project\x20path:\x20','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','agentName','Run\x20\x27tdx\x20agent\x20pull\x20','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','context','ERROR','17099865cowFkb','Passed:\x20\x20\x20','reason','Either\x20switch\x20to\x20the\x20\x22','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','No\x20tests\x20found\x20with\x20tags:\x20','Conversation\x20URL:\x20','\x20(new)','message','Re-evaluating\x20','find','join','dim','5060706QpczmK','Available\x20tags:\x20','red','Output\x20written\x20to:\x20','\x20\x20Evaluating...\x20','✗\x20ERROR:\x20Project\x20not\x20found:\x20','9824312VOduJt','Re-evaluation\x20Summary','\x20\x20Site:\x20','Agent:\x20','text','Errors:\x20\x20\x20','✗\x20FAIL:\x20','Running\x20test:\x20','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','resolve','...','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','split','verbose','Test\x20Summary','Round\x201/','site','737400Ocfmyp','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','not\x20found','yellow','Running\x20agent\x20tests...','some','\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','conversation_url','found','json','toISOString','New\x20tests\x20to\x20execute:\x20','length','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','...\x20','no_context','cyan','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','size','stop','Failed\x20Tests:','Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.','no_local_folder','toLowerCase','4683147gqrfNj','\x20\x20Conversation:\x20','substring','tags','Error:\x20No\x20previous\x20test\x20run\x20found.','add','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','PASS','round','Cached\x20run\x20is\x20from\x20site\x20\x22','agent:test','filter','trim','resolveAgentId','description','Executing\x20new\x20tests...','tsv','Total:\x20\x20\x20\x20','table','source','Using\x20agent:\x20'];a5_0xfe96=function(){return _0x4754df;};return a5_0xfe96();}import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';function a5_0x30ad(_0x226f4e,_0x10b3e1){_0x226f4e=_0x226f4e-0x1d1;const _0xfe96d1=a5_0xfe96();let _0x30ad2e=_0xfe96d1[_0x226f4e];return _0x30ad2e;}import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{['name']=a5_0x47d17d(0x211);[a5_0x47d17d(0x215)]='Run\x20tests\x20for\x20an\x20LLM\x20agent';async[a5_0x47d17d(0x23b)](_0x1e3d50){const _0x498abf=a5_0x47d17d,{options:_0x93395b,args:_0x3e7ad5,tdx:_0x507d21}=_0x1e3d50,_0x36676c=_0x3e7ad5[0x0]||'.',_0x275aa7=_0x93395b[_0x498abf(0x241)],_0x50ff84=_0x93395b,_0x3371ae=_0x50ff84[_0x498abf(0x232)]===![],_0x2bd6ba=_0x50ff84[_0x498abf(0x237)],_0x4375d3=_0x50ff84[_0x498abf(0x226)],_0x55b139=_0x50ff84['tags'],_0xb25139=_0x93395b['site'],_0x2d91bb=_0x50ff84[_0x498abf(0x250)];if(_0x2bd6ba&&_0x3371ae)return console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d9)]('Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval')),0x1;let _0x3dfcc9=_0x498abf(0x219);if(_0x50ff84['json'])_0x3dfcc9=_0x498abf(0x1f8);else{if(_0x50ff84[_0x498abf(0x256)])_0x3dfcc9=_0x498abf(0x256);else{if(_0x50ff84[_0x498abf(0x217)])_0x3dfcc9=_0x498abf(0x217);else{if(_0x50ff84[_0x498abf(0x219)])_0x3dfcc9=_0x498abf(0x219);}}}const _0x5ed81d=_0x50ff84[_0x498abf(0x220)];let _0x40e361=_0x36676c;const _0x223745=a5_0x3baeb1['existsSync'](_0x36676c),_0x5e582=_0x36676c==='.';if(!_0x223745||_0x5e582){const _0x143d35=resolveProjectFromContext(_0x36676c,_0x5ed81d,{'requireFile':_0x498abf(0x245)});if(_0x143d35[_0x498abf(0x1f7)])_0x40e361=_0x143d35[_0x498abf(0x223)],_0x143d35[_0x498abf(0x21a)]===_0x498abf(0x264)&&console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d6)](_0x498abf(0x21b)+_0x40e361));else switch(_0x143d35[_0x498abf(0x268)]){case _0x498abf(0x1fe):console['log'](a5_0x32ce2e[_0x498abf(0x1f2)](_0x143d35['message'])),console[_0x498abf(0x236)](),console[_0x498abf(0x236)]('Usage:'),console['log'](_0x498abf(0x1f5)),console[_0x498abf(0x236)](_0x498abf(0x1e5)),console[_0x498abf(0x236)](),console[_0x498abf(0x236)](_0x498abf(0x23d));return 0x1;case _0x498abf(0x205):console[_0x498abf(0x236)](a5_0x32ce2e['yellow'](_0x143d35[_0x498abf(0x1d2)])),console[_0x498abf(0x236)](),console[_0x498abf(0x236)](_0x498abf(0x261)+_0x143d35[_0x498abf(0x220)]+'\x27\x20to\x20create\x20the\x20folder\x20structure.');return 0x1;case _0x498abf(0x21f):{const _0x4a5e1f=a5_0x39557c['basename'](_0x143d35[_0x498abf(0x223)]);console['log'](a5_0x32ce2e[_0x498abf(0x1f2)](_0x498abf(0x1e8)+_0x143d35[_0x498abf(0x220)]+'\x22:'));for(const _0x35ef62 of _0x143d35[_0x498abf(0x25a)]){console[_0x498abf(0x236)](_0x498abf(0x243)+_0x35ef62);}return console[_0x498abf(0x236)](),console[_0x498abf(0x236)](_0x498abf(0x20d)+_0x4a5e1f+_0x498abf(0x259)),0x1;}case'no_tests':console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1f2)](_0x498abf(0x24e)+_0x143d35['llmProject']+'\x22.')),console['log'](a5_0x32ce2e[_0x498abf(0x1d6)](_0x498abf(0x25e)+_0x143d35['projectDir'])),console[_0x498abf(0x236)](),console[_0x498abf(0x236)](_0x498abf(0x238));return 0x1;}}const {definition:_0x1960a7,agentInfo:_0x4d19e2}=parseTestFile(_0x40e361);let _0x53837e=_0x1960a7[_0x498abf(0x227)];if(_0x4375d3){const _0x32ae1e=_0x4375d3[_0x498abf(0x1ea)](',')[_0x498abf(0x22c)](_0x4e050a=>_0x4e050a[_0x498abf(0x213)]());_0x53837e=_0x1960a7[_0x498abf(0x227)][_0x498abf(0x212)](_0x163ddd=>_0x32ae1e[_0x498abf(0x244)](_0x163ddd['name']));if(_0x53837e['length']===0x0)return console[_0x498abf(0x236)](a5_0x32ce2e['yellow']('No\x20tests\x20found\x20matching:\x20'+_0x4375d3)),console['log'](a5_0x32ce2e[_0x498abf(0x1d6)](_0x498abf(0x228)+_0x1960a7[_0x498abf(0x227)][_0x498abf(0x22c)](_0x4b0199=>_0x4b0199['name'])['join'](',\x20'))),0x1;}if(_0x55b139){const _0x574622=_0x55b139['split'](',')[_0x498abf(0x22c)](_0x207fb9=>_0x207fb9[_0x498abf(0x213)]()[_0x498abf(0x206)]());_0x53837e=_0x53837e[_0x498abf(0x212)](_0x16a9de=>_0x16a9de[_0x498abf(0x20a)]?.[_0x498abf(0x1f4)](_0x5ea4c8=>_0x574622[_0x498abf(0x244)](_0x5ea4c8['toLowerCase']())));if(_0x53837e[_0x498abf(0x1fb)]===0x0){console[_0x498abf(0x236)](a5_0x32ce2e['yellow'](_0x498abf(0x26b)+_0x55b139));const _0x1e520c=new Set();return _0x1960a7['tests']['forEach'](_0x3ff392=>_0x3ff392[_0x498abf(0x20a)]?.[_0x498abf(0x23f)](_0x5165c7=>_0x1e520c[_0x498abf(0x20c)](_0x5165c7))),_0x1e520c[_0x498abf(0x201)]>0x0?console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d6)](_0x498abf(0x1d8)+[..._0x1e520c][_0x498abf(0x1d5)](',\x20'))):console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d6)](_0x498abf(0x21c))),0x1;}}if(_0x2bd6ba)return this[_0x498abf(0x248)](_0x1e3d50,{'definition':{'tests':_0x53837e},'agentInfo':_0x4d19e2,'outputFormat':_0x3dfcc9,'outputFile':_0x2d91bb,'testNames':_0x4375d3});if(_0x275aa7){console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1ff)]('Test\x20Configuration:')),console[_0x498abf(0x236)](_0x498abf(0x1df)+a5_0x32ce2e[_0x498abf(0x258)](_0xb25139)),console[_0x498abf(0x236)](_0x498abf(0x242)+a5_0x32ce2e[_0x498abf(0x258)](_0x4d19e2[_0x498abf(0x24f)])),console[_0x498abf(0x236)](_0x498abf(0x24c)+a5_0x32ce2e['white'](_0x4d19e2[_0x498abf(0x260)])),console[_0x498abf(0x236)](),console[_0x498abf(0x236)](_0x498abf(0x235)+a5_0x32ce2e[_0x498abf(0x258)](_0x53837e['length']));for(let _0x222d54=0x0;_0x222d54<_0x53837e[_0x498abf(0x1fb)];_0x222d54++){const _0x72d836=_0x53837e[_0x222d54],_0x4fa7f1=_0x72d836[_0x498abf(0x254)][_0x498abf(0x1fb)]===0x1?_0x498abf(0x20f):_0x498abf(0x254),_0x2763fa=_0x72d836[_0x498abf(0x20a)]?.[_0x498abf(0x1fb)]?'\x20['+_0x72d836['tags']['join'](',\x20')+']':'';console[_0x498abf(0x236)]('\x20\x20'+(_0x222d54+0x1)+'.\x20'+a5_0x32ce2e['white'](_0x72d836[_0x498abf(0x226)])+'\x20('+_0x72d836[_0x498abf(0x254)][_0x498abf(0x1fb)]+'\x20'+_0x4fa7f1+')'+a5_0x32ce2e['dim'](_0x2763fa));}return 0x0;}let _0x491b8d,_0xe9ce0a;try{_0x491b8d=await _0x507d21[_0x498abf(0x231)][_0x498abf(0x233)](_0x4d19e2[_0x498abf(0x24f)]);}catch(_0x439583){const _0x3bb6a5=_0x439583 instanceof Error?_0x439583[_0x498abf(0x1d2)]:String(_0x439583);return _0x3bb6a5[_0x498abf(0x244)](_0x498abf(0x21e))||_0x3bb6a5[_0x498abf(0x206)]()[_0x498abf(0x244)](_0x498abf(0x1f1))?console['log'](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x1dc)+_0x4d19e2[_0x498abf(0x24f)])):console['log'](a5_0x32ce2e['red'](_0x498abf(0x263)+_0x4d19e2[_0x498abf(0x24f)]+_0x498abf(0x24a)+_0x3bb6a5)),0x1;}try{_0xe9ce0a=await _0x507d21[_0x498abf(0x231)][_0x498abf(0x214)](_0x4d19e2[_0x498abf(0x260)],_0x491b8d);}catch(_0x2fb472){const _0x52a618=_0x2fb472 instanceof Error?_0x2fb472[_0x498abf(0x1d2)]:String(_0x2fb472);return _0x52a618[_0x498abf(0x244)](_0x498abf(0x21e))||_0x52a618['toLowerCase']()['includes'](_0x498abf(0x1f1))?console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x1fc)+_0x4d19e2[_0x498abf(0x260)])):console['log'](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x26a)+_0x4d19e2[_0x498abf(0x260)]+_0x498abf(0x24a)+_0x52a618)),0x1;}let _0x27cac9;if(!_0x3371ae)try{_0x27cac9=await setupEvaluatorAgent(_0x507d21[_0x498abf(0x231)],_0x93395b[_0x498abf(0x1eb)]);}catch(_0xf47f80){const _0x5adfc2=_0xf47f80 instanceof Error?_0xf47f80[_0x498abf(0x1d2)]:String(_0xf47f80);return console[_0x498abf(0x236)](a5_0x32ce2e['red'](_0x498abf(0x1f0)+_0x5adfc2)),0x1;}console[_0x498abf(0x236)](a5_0x32ce2e['cyan'](_0x498abf(0x1f3))),console[_0x498abf(0x236)](_0x498abf(0x22b)+a5_0x32ce2e[_0x498abf(0x258)](_0xb25139)),console['log'](_0x498abf(0x1e0)+a5_0x32ce2e[_0x498abf(0x258)](_0x4d19e2[_0x498abf(0x24f)]+'/'+_0x4d19e2[_0x498abf(0x260)])),console[_0x498abf(0x236)]();const _0x3a2f1f=[],_0x1c3974=[],_0x865854=Date[_0x498abf(0x253)]();for(let _0x46e4ad=0x0;_0x46e4ad<_0x53837e[_0x498abf(0x1fb)];_0x46e4ad++){const _0x2369a0=_0x53837e[_0x46e4ad];_0x53837e[_0x498abf(0x1fb)]>0x1?console[_0x498abf(0x236)]('Test\x20'+(_0x46e4ad+0x1)+'/'+_0x53837e[_0x498abf(0x1fb)]+':\x20'+a5_0x32ce2e['white'](_0x2369a0[_0x498abf(0x226)])):console[_0x498abf(0x236)](_0x498abf(0x1e4)+a5_0x32ce2e[_0x498abf(0x258)](_0x2369a0[_0x498abf(0x226)]));const _0x8a5a44=createCommandSpinner(_0x498abf(0x1ed)+_0x2369a0[_0x498abf(0x254)][_0x498abf(0x1fb)]+_0x498abf(0x24d));_0x8a5a44[_0x498abf(0x251)]();try{const {result:_0x2977dd,conversation:_0x199a9e}=await runTest(_0x507d21[_0x498abf(0x231)],_0x2369a0,{'agentId':_0xe9ce0a,'projectId':_0x491b8d,'site':_0xb25139,'noEval':_0x3371ae,'evaluatorId':_0x27cac9,'onRoundStart':(_0x14b73e,_0x2563c4)=>{const _0x4a72d7=_0x498abf;_0x8a5a44[_0x4a72d7(0x1e1)]=_0x4a72d7(0x25d)+(_0x14b73e+0x1)+'/'+_0x2563c4+_0x4a72d7(0x24d);},'onRoundComplete':(_0x29f382,_0x4cd42e,_0x5ceb0f)=>{const _0x23813f=_0x498abf,_0x49507b=formatElapsed(_0x4cd42e);_0x5ceb0f?console[_0x23813f(0x236)](_0x23813f(0x229)+(_0x29f382+0x1)+'/'+_0x2369a0[_0x23813f(0x254)][_0x23813f(0x1fb)]+'...\x20'+a5_0x32ce2e['green']('✓')+'\x20('+_0x49507b+')'):console[_0x23813f(0x236)](_0x23813f(0x229)+(_0x29f382+0x1)+'/'+_0x2369a0[_0x23813f(0x254)]['length']+'...\x20'+a5_0x32ce2e[_0x23813f(0x1d9)]('✗'));},'onEvaluationStart':()=>{const _0x2f9351=_0x498abf;_0x8a5a44['text']=_0x2f9351(0x21d);},'onEvaluationComplete':_0x19adc4=>{const _0x347221=_0x498abf,_0x261e04=formatElapsed(_0x19adc4);console[_0x347221(0x236)](_0x347221(0x1db)+a5_0x32ce2e[_0x347221(0x24b)]('✓')+'\x20('+_0x261e04+')');}});_0x8a5a44[_0x498abf(0x202)](),_0x3a2f1f[_0x498abf(0x249)](_0x2977dd),_0x1c3974[_0x498abf(0x249)](_0x199a9e);if(_0x2977dd[_0x498abf(0x240)]===_0x498abf(0x20e))console[_0x498abf(0x236)](a5_0x32ce2e['green']('✓\x20PASS:\x20'+_0x2977dd[_0x498abf(0x268)]));else _0x2977dd[_0x498abf(0x240)]===_0x498abf(0x25c)?console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x1e3)+_0x2977dd[_0x498abf(0x268)])):console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x247)+_0x2977dd['reason']));_0x2977dd[_0x498abf(0x1f6)]&&console[_0x498abf(0x236)](a5_0x32ce2e['dim'](_0x498abf(0x26c)+_0x2977dd[_0x498abf(0x1f6)])),console['log']();}catch(_0x19e6eb){_0x8a5a44[_0x498abf(0x202)]();const _0x958c74=_0x19e6eb instanceof Error?_0x19e6eb[_0x498abf(0x1d2)]:String(_0x19e6eb);console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x247)+_0x958c74)),console[_0x498abf(0x236)](),_0x3a2f1f['push']({'name':_0x2369a0['name'],'status':'ERROR','reason':_0x958c74,'timestamp':new Date()[_0x498abf(0x1f9)](),'duration_ms':0x0});}}const _0xcd3c7f=Date[_0x498abf(0x253)]()-_0x865854,_0x58a2c6=_0x3a2f1f['filter'](_0x119535=>_0x119535['status']==='PASS')[_0x498abf(0x1fb)],_0x45197a=_0x3a2f1f[_0x498abf(0x212)](_0x4d954d=>_0x4d954d[_0x498abf(0x240)]===_0x498abf(0x25c))['length'],_0x210d47=_0x3a2f1f[_0x498abf(0x212)](_0x51d9b6=>_0x51d9b6[_0x498abf(0x240)]===_0x498abf(0x265))['length'];console[_0x498abf(0x236)]('━'[_0x498abf(0x22e)](0x3c)),console[_0x498abf(0x236)](_0x498abf(0x1ec)),console['log']('━'['repeat'](0x3c)),console[_0x498abf(0x236)](_0x498abf(0x218)+_0x3a2f1f[_0x498abf(0x1fb)]),console['log'](_0x498abf(0x267)+a5_0x32ce2e[_0x498abf(0x24b)](_0x58a2c6)),console[_0x498abf(0x236)](_0x498abf(0x23e)+a5_0x32ce2e[_0x498abf(0x1d9)](_0x45197a));_0x210d47>0x0&&console[_0x498abf(0x236)](_0x498abf(0x1e2)+a5_0x32ce2e['red'](_0x210d47));console[_0x498abf(0x236)](_0x498abf(0x221)+formatElapsed(_0xcd3c7f)),console[_0x498abf(0x236)]('━'['repeat'](0x3c));const _0x404eff=_0x3a2f1f[_0x498abf(0x212)](_0x5965ed=>_0x5965ed[_0x498abf(0x240)]!==_0x498abf(0x20e));if(_0x404eff[_0x498abf(0x1fb)]>0x0){console[_0x498abf(0x236)](),console[_0x498abf(0x236)](_0x498abf(0x203));for(const _0x2738fa of _0x404eff){const _0x479659=a5_0x32ce2e[_0x498abf(0x1d9)]('✗'),_0x4456a7=_0x2738fa[_0x498abf(0x268)][_0x498abf(0x1fb)]>0x32?_0x2738fa[_0x498abf(0x268)][_0x498abf(0x209)](0x0,0x32)+_0x498abf(0x1e7):_0x2738fa[_0x498abf(0x268)];console['log']('\x20\x20'+_0x479659+'\x20'+_0x2738fa[_0x498abf(0x226)]+':\x20'+_0x4456a7);}}const _0xc6822b={'summary':{'total':_0x3a2f1f[_0x498abf(0x1fb)],'passed':_0x58a2c6,'failed':_0x45197a,'errors':_0x210d47>0x0?_0x210d47:undefined,'duration_ms':_0xcd3c7f},'tests':_0x3a2f1f,'agent':{'project':_0x4d19e2['projectName'],'name':_0x4d19e2[_0x498abf(0x260)],'site':_0xb25139},'timestamp':new Date(_0x865854)[_0x498abf(0x1f9)]()};try{const _0x2d0fe3=buildCachedTestRun(_0x1c3974,{'site':_0xb25139,'projectId':_0x491b8d,'projectName':_0x4d19e2[_0x498abf(0x24f)],'agentId':_0xe9ce0a,'agentName':_0x4d19e2['agentName'],'testYmlPath':a5_0x39557c[_0x498abf(0x1e6)](_0x4d19e2[_0x498abf(0x22f)])});saveLastTestRun(_0x2d0fe3);}catch{}if(_0x3dfcc9!==_0x498abf(0x219)||_0x2d91bb){const _0x48bdeb=formatResults(_0xc6822b,_0x3dfcc9);if(_0x2d91bb)try{a5_0x3baeb1['writeFileSync'](_0x2d91bb,_0x48bdeb,'utf-8'),console['log'](),console['log'](a5_0x32ce2e[_0x498abf(0x1d6)](_0x498abf(0x1da)+_0x2d91bb));}catch(_0x3bb1bc){return console[_0x498abf(0x236)](),console[_0x498abf(0x236)](a5_0x32ce2e[_0x498abf(0x1d9)](_0x498abf(0x255)+_0x3bb1bc)),0x1;}else console['log'](),console['log'](_0x48bdeb);}return _0x404eff[_0x498abf(0x1fb)]>0x0?0x1:0x0;}async[a5_0x47d17d(0x248)](_0x47e6df,_0x36b4ed){const _0x445cb6=a5_0x47d17d,{options:_0x5a2c2c,tdx:_0x3b71a0}=_0x47e6df,{definition:_0x1457fc,agentInfo:_0x2ed787,outputFormat:_0x1b34b4,outputFile:_0x48249d}=_0x36b4ed,_0x1594f4=_0x5a2c2c[_0x445cb6(0x1ee)],_0x14354f=loadLastTestRun();if(!_0x14354f)return console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d9)](_0x445cb6(0x20b))),console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d6)]('Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.')),0x1;if(_0x14354f[_0x445cb6(0x25b)][_0x445cb6(0x260)]!==_0x2ed787[_0x445cb6(0x260)])return console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d9)](_0x445cb6(0x262)+_0x14354f[_0x445cb6(0x25b)][_0x445cb6(0x260)]+_0x445cb6(0x234)+_0x2ed787['agentName']+'\x22.')),console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d6)](_0x445cb6(0x200))),0x1;const _0x1def45=new Set(_0x14354f['conversations']['map'](_0x3eb91e=>_0x3eb91e[_0x445cb6(0x224)])),_0x404116=_0x1457fc[_0x445cb6(0x227)][_0x445cb6(0x212)](_0x18e6c8=>!_0x1def45['has'](_0x18e6c8[_0x445cb6(0x226)]));if(_0x404116[_0x445cb6(0x1fb)]>0x0&&_0x14354f[_0x445cb6(0x1ee)]!==_0x1594f4)return console['log'](a5_0x32ce2e[_0x445cb6(0x1d9)](_0x445cb6(0x204))),console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d6)](_0x445cb6(0x210)+_0x14354f[_0x445cb6(0x1ee)]+'\x22,\x20but\x20current\x20site\x20is\x20\x22'+_0x1594f4+'\x22.')),console[_0x445cb6(0x236)](a5_0x32ce2e['dim'](_0x445cb6(0x269)+_0x14354f[_0x445cb6(0x1ee)]+_0x445cb6(0x1e9))),0x1;const _0x32b86e=_0x1457fc[_0x445cb6(0x227)]['filter'](_0x538fad=>_0x1def45[_0x445cb6(0x225)](_0x538fad[_0x445cb6(0x226)])),_0x309d3e=_0x404116;let _0x498dbb;try{_0x498dbb=await setupEvaluatorAgent(_0x3b71a0['llm'],_0x5a2c2c['verbose']);}catch(_0x23e879){const _0x53f45c=_0x23e879 instanceof Error?_0x23e879['message']:String(_0x23e879);return console[_0x445cb6(0x236)](a5_0x32ce2e['red'](_0x445cb6(0x1f0)+_0x53f45c)),0x1;}console['log'](a5_0x32ce2e[_0x445cb6(0x1ff)]('Re-evaluating\x20cached\x20test\x20run...')),console['log']('Cached\x20run\x20from:\x20'+a5_0x32ce2e[_0x445cb6(0x258)](_0x14354f['timestamp'])),console[_0x445cb6(0x236)](_0x445cb6(0x1e0)+a5_0x32ce2e[_0x445cb6(0x258)](_0x14354f['agent'][_0x445cb6(0x24f)]+'/'+_0x14354f['agent'][_0x445cb6(0x260)]));_0x309d3e['length']>0x0&&console['log'](_0x445cb6(0x1fa)+a5_0x32ce2e['yellow'](_0x309d3e[_0x445cb6(0x1fb)]));console[_0x445cb6(0x236)]();const _0x58e204=[],_0xd717d5=Date['now'](),_0x1822c1=createCommandSpinner(_0x445cb6(0x246));if(_0x32b86e[_0x445cb6(0x1fb)]>0x0)try{const _0x8e6c1a=await reevaluateFromCache(_0x3b71a0[_0x445cb6(0x231)],_0x14354f,{'tests':_0x32b86e},{'evaluatorId':_0x498dbb,'onTestStart':(_0x87a367,_0x2b0db6,_0x3b72ba)=>{const _0x4064cb=_0x445cb6;_0x1822c1['text']=_0x4064cb(0x1d3)+(_0x2b0db6+0x1)+'/'+_0x3b72ba+':\x20'+_0x87a367+'...';if(!_0x1822c1['isSpinning'])_0x1822c1[_0x4064cb(0x251)]();},'onTestComplete':(_0x2af094,_0x460253)=>{const _0x3093ee=_0x445cb6;_0x1822c1[_0x3093ee(0x202)]();if(_0x460253['status']===_0x3093ee(0x20e))console[_0x3093ee(0x236)](a5_0x32ce2e[_0x3093ee(0x24b)](_0x3093ee(0x22d)+_0x2af094)+a5_0x32ce2e[_0x3093ee(0x1d6)](_0x3093ee(0x23c)));else _0x460253['status']===_0x3093ee(0x25c)?console[_0x3093ee(0x236)](a5_0x32ce2e['red'](_0x3093ee(0x1e3)+_0x2af094+_0x3093ee(0x252)+_0x460253[_0x3093ee(0x268)])+a5_0x32ce2e['dim'](_0x3093ee(0x23c))):console['log'](a5_0x32ce2e[_0x3093ee(0x1d9)]('✗\x20ERROR:\x20'+_0x2af094+'\x20-\x20'+_0x460253[_0x3093ee(0x268)]));_0x460253[_0x3093ee(0x1f6)]&&console[_0x3093ee(0x236)](a5_0x32ce2e['dim'](_0x3093ee(0x208)+_0x460253[_0x3093ee(0x1f6)])),_0x58e204['push'](_0x460253);},'onTestSkipped':(_0x1be6fe,_0x17e5ea)=>{const _0xbb5252=_0x445cb6;_0x1822c1[_0xbb5252(0x202)](),console[_0xbb5252(0x236)](a5_0x32ce2e['yellow']('⚠\x20SKIPPED:\x20'+_0x1be6fe+'\x20-\x20'+_0x17e5ea));}});for(const _0x32ba2d of _0x8e6c1a){!_0x58e204[_0x445cb6(0x1d4)](_0x3bf75f=>_0x3bf75f[_0x445cb6(0x226)]===_0x32ba2d[_0x445cb6(0x226)])&&_0x58e204['push'](_0x32ba2d);}}catch(_0x268fc3){_0x1822c1[_0x445cb6(0x202)]();const _0xb6e2da=_0x268fc3 instanceof Error?_0x268fc3['message']:String(_0x268fc3);return console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d9)](_0x445cb6(0x25f)+_0xb6e2da)),0x1;}_0x1822c1[_0x445cb6(0x202)]();if(_0x309d3e['length']>0x0){console[_0x445cb6(0x236)](),console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1ff)](_0x445cb6(0x216)));const {projectId:_0x555f4f,agentId:_0x440240}=_0x14354f[_0x445cb6(0x25b)];for(const _0x2f96b3 of _0x309d3e){console[_0x445cb6(0x236)](_0x445cb6(0x239)+a5_0x32ce2e['white'](_0x2f96b3[_0x445cb6(0x226)]));const _0x37649e=createCommandSpinner(_0x445cb6(0x1ed)+_0x2f96b3[_0x445cb6(0x254)][_0x445cb6(0x1fb)]+_0x445cb6(0x24d));_0x37649e[_0x445cb6(0x251)]();try{const {result:_0xfa277d}=await runTest(_0x3b71a0[_0x445cb6(0x231)],_0x2f96b3,{'agentId':_0x440240,'projectId':_0x555f4f,'site':_0x14354f[_0x445cb6(0x1ee)],'noEval':![],'evaluatorId':_0x498dbb,'onRoundStart':(_0x232b42,_0x50b8a8)=>{const _0x3ab2e1=_0x445cb6;_0x37649e[_0x3ab2e1(0x1e1)]='Round\x20'+(_0x232b42+0x1)+'/'+_0x50b8a8+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x10707b,_0x105dc5,_0x2b27fa)=>{const _0x3dbefe=_0x445cb6,_0x303e93=formatElapsed(_0x105dc5);_0x2b27fa?console[_0x3dbefe(0x236)](_0x3dbefe(0x229)+(_0x10707b+0x1)+'/'+_0x2f96b3[_0x3dbefe(0x254)][_0x3dbefe(0x1fb)]+_0x3dbefe(0x1fd)+a5_0x32ce2e['green']('✓')+'\x20('+_0x303e93+')'):console[_0x3dbefe(0x236)](_0x3dbefe(0x229)+(_0x10707b+0x1)+'/'+_0x2f96b3[_0x3dbefe(0x254)]['length']+'...\x20'+a5_0x32ce2e[_0x3dbefe(0x1d9)]('✗'));},'onEvaluationStart':()=>{const _0x391e01=_0x445cb6;_0x37649e[_0x391e01(0x1e1)]='Evaluating\x20response...';},'onEvaluationComplete':_0x313feb=>{const _0x37b388=_0x445cb6,_0x5512fa=formatElapsed(_0x313feb);console['log'](_0x37b388(0x1db)+a5_0x32ce2e[_0x37b388(0x24b)]('✓')+'\x20('+_0x5512fa+')');}});_0x37649e['stop'](),_0x58e204[_0x445cb6(0x249)](_0xfa277d);if(_0xfa277d[_0x445cb6(0x240)]==='PASS')console['log'](a5_0x32ce2e[_0x445cb6(0x24b)](_0x445cb6(0x22d)+_0xfa277d[_0x445cb6(0x268)])+a5_0x32ce2e['dim'](_0x445cb6(0x1d1)));else _0xfa277d['status']===_0x445cb6(0x25c)?console['log'](a5_0x32ce2e[_0x445cb6(0x1d9)](_0x445cb6(0x1e3)+_0xfa277d[_0x445cb6(0x268)])+a5_0x32ce2e[_0x445cb6(0x1d6)](_0x445cb6(0x1d1))):console['log'](a5_0x32ce2e['red']('✗\x20ERROR:\x20'+_0xfa277d[_0x445cb6(0x268)]));_0xfa277d['conversation_url']&&console['log'](a5_0x32ce2e[_0x445cb6(0x1d6)](_0x445cb6(0x208)+_0xfa277d[_0x445cb6(0x1f6)]));}catch(_0x22dd76){_0x37649e['stop']();const _0x1262fd=_0x22dd76 instanceof Error?_0x22dd76[_0x445cb6(0x1d2)]:String(_0x22dd76);console['log'](a5_0x32ce2e['red'](_0x445cb6(0x247)+_0x1262fd)),_0x58e204[_0x445cb6(0x249)]({'name':_0x2f96b3['name'],'status':'ERROR','reason':_0x1262fd,'timestamp':new Date()[_0x445cb6(0x1f9)](),'duration_ms':0x0});}}}console[_0x445cb6(0x236)]();const _0x228ef8=Date[_0x445cb6(0x253)]()-_0xd717d5,_0xefb3fb=_0x58e204['filter'](_0x10ec5b=>_0x10ec5b['status']===_0x445cb6(0x20e))['length'],_0x540994=_0x58e204[_0x445cb6(0x212)](_0x232a62=>_0x232a62[_0x445cb6(0x240)]===_0x445cb6(0x25c))[_0x445cb6(0x1fb)],_0x2f01d0=_0x58e204['filter'](_0x226354=>_0x226354['status']===_0x445cb6(0x265))[_0x445cb6(0x1fb)];console['log']('━'[_0x445cb6(0x22e)](0x3c)),console[_0x445cb6(0x236)](_0x445cb6(0x1de)),console[_0x445cb6(0x236)]('━'['repeat'](0x3c)),console[_0x445cb6(0x236)](_0x445cb6(0x218)+_0x58e204[_0x445cb6(0x1fb)]),console[_0x445cb6(0x236)](_0x445cb6(0x267)+a5_0x32ce2e[_0x445cb6(0x24b)](_0xefb3fb)),console[_0x445cb6(0x236)](_0x445cb6(0x23e)+a5_0x32ce2e[_0x445cb6(0x1d9)](_0x540994));_0x2f01d0>0x0&&console[_0x445cb6(0x236)](_0x445cb6(0x1e2)+a5_0x32ce2e[_0x445cb6(0x1d9)](_0x2f01d0));console[_0x445cb6(0x236)](_0x445cb6(0x221)+formatElapsed(_0x228ef8)),console[_0x445cb6(0x236)]('━'[_0x445cb6(0x22e)](0x3c));const _0x4e1d0c={'summary':{'total':_0x58e204[_0x445cb6(0x1fb)],'passed':_0xefb3fb,'failed':_0x540994,'errors':_0x2f01d0>0x0?_0x2f01d0:undefined,'duration_ms':_0x228ef8},'tests':_0x58e204,'agent':{'project':_0x2ed787[_0x445cb6(0x24f)],'name':_0x2ed787[_0x445cb6(0x260)],'site':_0x1594f4},'timestamp':new Date(_0xd717d5)[_0x445cb6(0x1f9)]()};if(_0x1b34b4!==_0x445cb6(0x219)||_0x48249d){const _0x5c1855=formatResults(_0x4e1d0c,_0x1b34b4);if(_0x48249d)try{a5_0x3baeb1[_0x445cb6(0x22a)](_0x48249d,_0x5c1855,'utf-8'),console[_0x445cb6(0x236)](),console[_0x445cb6(0x236)](a5_0x32ce2e['dim'](_0x445cb6(0x1da)+_0x48249d));}catch(_0x4f87b6){return console[_0x445cb6(0x236)](),console[_0x445cb6(0x236)](a5_0x32ce2e[_0x445cb6(0x1d9)](_0x445cb6(0x255)+_0x4f87b6)),0x1;}else console[_0x445cb6(0x236)](),console[_0x445cb6(0x236)](_0x5c1855);}const _0x536dcb=_0x58e204[_0x445cb6(0x212)](_0x1a86d0=>_0x1a86d0[_0x445cb6(0x240)]!=='PASS');return _0x536dcb[_0x445cb6(0x1fb)]>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a6_0x52d9a6=a6_0x58ea;(function(_0x459710,_0x55d99b){const _0x56eee3=a6_0x58ea,_0x22d2d4=_0x459710();while(!![]){try{const _0x36e1f5=-parseInt(_0x56eee3(0x1d6))/0x1*(-parseInt(_0x56eee3(0x1f0))/0x2)+parseInt(_0x56eee3(0x1be))/0x3+parseInt(_0x56eee3(0x1bb))/0x4*(parseInt(_0x56eee3(0x1b0))/0x5)+-parseInt(_0x56eee3(0x1af))/0x6+-parseInt(_0x56eee3(0x1da))/0x7*(parseInt(_0x56eee3(0x1df))/0x8)+-parseInt(_0x56eee3(0x1c7))/0x9*(parseInt(_0x56eee3(0x1c0))/0xa)+-parseInt(_0x56eee3(0x1dc))/0xb*(-parseInt(_0x56eee3(0x1bf))/0xc);if(_0x36e1f5===_0x55d99b)break;else _0x22d2d4['push'](_0x22d2d4['shift']());}catch(_0x2f8c67){_0x22d2d4['push'](_0x22d2d4['shift']());}}}(a6_0x2542,0xea4b8));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_0x52d9a6(0x1d0),a6_0x52d9a6(0x1ce),a6_0x52d9a6(0x1ed),a6_0x52d9a6(0x1b5),a6_0x52d9a6(0x1d3),a6_0x52d9a6(0x1d4),a6_0x52d9a6(0x1eb),'x-trino-user']);function a6_0x58ea(_0x119ae8,_0x57a797){_0x119ae8=_0x119ae8-0x1ae;const _0x2542b2=a6_0x2542();let _0x58eaa7=_0x2542b2[_0x119ae8];return _0x58eaa7;}function a6_0x2542(){const _0x15d08c=['headers','set-cookie','request','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','DELETE','Invalid\x20API\x20type:\x20','trino','104nMJzMr','entries','PATCH','2190792jvExSd','84VGWYKp','18472060lvaJXm','data','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','output','trim','\x22.\x20','PUT','9KrKUYB','keys','error','verbose','.\x20Valid\x20types:\x20','POST','log','proxy-authorization','length','authorization','cdp','message','set-cookie2','x-xsrf-token','includes','406733TLDOQZ','stack','header','status','6642734QegSDF','GET','2602413nBNtLR','.\x20Valid\x20methods:\x20','toLowerCase','8JBmHHO','execute','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','Error:\x20','workflow','type','color','has','indexOf','site','join','description','x-auth-token','isArray','cookie','startsWith','\x0aStack\x20trace:\x0a','2ApWbZc','substring','method','validate','readBodyFromFile','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','Invalid\x20header\x20format:\x20\x22','17424NKykgF','185705uaqjbv','llm-proxy','toUpperCase','llm'];a6_0x2542=function(){return _0x15d08c;};return a6_0x2542();}function isSensitiveHeader(_0x5b9c14){const _0x82662f=a6_0x52d9a6;return SENSITIVE_HEADERS[_0x82662f(0x1e6)](_0x5b9c14[_0x82662f(0x1de)]());}function parseHeader(_0x39e931){const _0x59a18d=a6_0x52d9a6,_0x19079a=_0x39e931[_0x59a18d(0x1e7)](':');if(_0x19079a===-0x1)throw new Error(_0x59a18d(0x1ae)+_0x39e931+_0x59a18d(0x1c5)+_0x59a18d(0x1c2));const _0x3bd1c6=_0x39e931[_0x59a18d(0x1f1)](0x0,_0x19079a)[_0x59a18d(0x1c4)](),_0x297a94=_0x39e931['substring'](_0x19079a+0x1)['trim']();if(!_0x3bd1c6)throw new Error(_0x59a18d(0x1f5)+_0x39e931+'\x22');return[_0x3bd1c6,_0x297a94];}export class ApiCommand extends BaseCommand{['name']='api';[a6_0x52d9a6(0x1ea)]='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a6_0x52d9a6(0x1f3)](_0x394cad){const _0x387350=a6_0x52d9a6,{args:_0x77dd49,options:_0x543c1d}=_0x394cad,_0x33b879=_0x543c1d;if(_0x77dd49[_0x387350(0x1cf)]===0x0)return _0x387350(0x1b7);const _0x481a83=_0x77dd49[0x0];if(!_0x481a83[_0x387350(0x1ee)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x481a83;const _0x12708b=_0x33b879[_0x387350(0x1c1)],_0x32ed3f=_0x33b879['file'];if(_0x12708b&&_0x32ed3f)return _0x387350(0x1e1);const _0x4d426d=_0x33b879['method']||_0x387350(0x1db),_0x1e714f=[_0x387350(0x1db),_0x387350(0x1cc),_0x387350(0x1c6),_0x387350(0x1b8),_0x387350(0x1bd)];if(!_0x1e714f[_0x387350(0x1d5)](_0x4d426d[_0x387350(0x1b2)]()))return'Invalid\x20HTTP\x20method:\x20'+_0x4d426d+_0x387350(0x1dd)+_0x1e714f[_0x387350(0x1e9)](',\x20');const _0x3d9625=_0x33b879[_0x387350(0x1e4)]||'td',_0x378969=['td',_0x387350(0x1d1),_0x387350(0x1e3),_0x387350(0x1ba),_0x387350(0x1b3),_0x387350(0x1b1)];if(!_0x378969[_0x387350(0x1d5)](_0x3d9625))return _0x387350(0x1b9)+_0x3d9625+_0x387350(0x1cb)+_0x378969['join'](',\x20');return undefined;}async[a6_0x52d9a6(0x1e0)](_0x1c9e88){const _0x297062=a6_0x52d9a6,{options:_0xc5743,args:_0x2d4883,tdx:_0x1e3016}=_0x1c9e88,_0x2d37a0=_0xc5743,_0x58c291=_0x2d4883[0x0],_0x4b96ae=(_0x2d37a0[_0x297062(0x1f2)]||_0x297062(0x1db))[_0x297062(0x1b2)](),_0x141cad=_0x2d37a0[_0x297062(0x1c1)],_0x2743dc=_0x2d37a0['file'],_0x329617=_0x2d37a0[_0x297062(0x1d8)],_0x5551fd=_0x2d37a0[_0x297062(0x1e4)]||'td';try{const _0x42af4a={};if(_0x329617){const _0x31e861=Array[_0x297062(0x1ec)](_0x329617)?_0x329617:[_0x329617];for(const _0x230cc9 of _0x31e861){const [_0x38374e,_0x4292ab]=parseHeader(_0x230cc9);_0x42af4a[_0x38374e]=_0x4292ab;}}let _0x5f13fc;if(_0x141cad)_0x5f13fc=_0x141cad;else{if(_0x2743dc)try{_0x5f13fc=RawAPI[_0x297062(0x1f4)](_0x2743dc);}catch(_0x26a2b5){return console['error'](_0x297062(0x1e2)+(_0x26a2b5 instanceof Error?_0x26a2b5['message']:String(_0x26a2b5))),0x1;}}const _0x31d877={'method':_0x4b96ae,'apiType':_0x5551fd,'includeHeaders':_0xc5743[_0x297062(0x1ca)]};_0x5f13fc&&(_0x31d877['body']=_0x5f13fc);Object[_0x297062(0x1c8)](_0x42af4a)[_0x297062(0x1cf)]>0x0&&(_0x31d877['headers']=_0x42af4a);if(_0xc5743[_0x297062(0x1ca)]){const _0x3dfd87=resolveSite(_0xc5743[_0x297062(0x1e8)]),_0x5463b5=getEndpoint(_0x3dfd87,_0x5551fd),_0x45108b=''+_0x5463b5+_0x58c291;console[_0x297062(0x1c9)]('>\x20'+_0x4b96ae+'\x20'+_0x45108b);const _0x492acf=getAuthHeaders(_0x3dfd87),_0x5627da={..._0x492acf,..._0x42af4a};for(const [_0x156f64,_0x3cafaf]of Object[_0x297062(0x1bc)](_0x5627da)){!isSensitiveHeader(_0x156f64)&&console[_0x297062(0x1c9)]('>\x20'+_0x156f64+':\x20'+_0x3cafaf);}_0x5f13fc&&console[_0x297062(0x1c9)]('>'),console[_0x297062(0x1c9)]('');}const _0x5bcd71=await _0x1e3016['api'][_0x297062(0x1b6)](_0x58c291,_0x31d877);if(_0xc5743[_0x297062(0x1ca)]&&_0x5bcd71[_0x297062(0x1b4)]){console[_0x297062(0x1c9)]('<\x20HTTP/1.1\x20'+_0x5bcd71[_0x297062(0x1d9)]);for(const [_0x1d4620,_0x1ded29]of Object[_0x297062(0x1bc)](_0x5bcd71[_0x297062(0x1b4)])){!isSensitiveHeader(_0x1d4620)&&console['error']('<\x20'+_0x1d4620+':\x20'+_0x1ded29);}console[_0x297062(0x1c9)]('');}const _0x58f645=Boolean(_0xc5743['output']),_0x253c63={'color':_0xc5743[_0x297062(0x1e5)],'noColor':_0xc5743['noColor']||_0x58f645&&!_0xc5743['color']},_0x233836=colorizeJSON(_0x5bcd71[_0x297062(0x1c1)],_0x253c63);return _0xc5743[_0x297062(0x1c3)]?(writeFileSync(_0xc5743[_0x297062(0x1c3)],_0x233836),console[_0x297062(0x1c9)]('Results\x20saved\x20to\x20'+_0xc5743[_0x297062(0x1c3)])):console[_0x297062(0x1cd)](_0x233836),0x0;}catch(_0x3d0498){return _0x3d0498 instanceof Error?(console['error'](_0x297062(0x1e2)+_0x3d0498[_0x297062(0x1d2)]),_0xc5743[_0x297062(0x1ca)]&&_0x3d0498[_0x297062(0x1d7)]&&console[_0x297062(0x1c9)](_0x297062(0x1ef)+_0x3d0498['stack'])):console[_0x297062(0x1c9)](_0x297062(0x1e2)+String(_0x3d0498)),0x1;}}}
1
+ const a6_0x401f4a=a6_0x41e1;(function(_0x5bb0dc,_0x32de5c){const _0x7069c7=a6_0x41e1,_0x5aec1c=_0x5bb0dc();while(!![]){try{const _0x387c2e=-parseInt(_0x7069c7(0xaa))/0x1*(-parseInt(_0x7069c7(0xe4))/0x2)+parseInt(_0x7069c7(0xc0))/0x3+parseInt(_0x7069c7(0xda))/0x4*(parseInt(_0x7069c7(0xb2))/0x5)+-parseInt(_0x7069c7(0xba))/0x6*(-parseInt(_0x7069c7(0xe3))/0x7)+-parseInt(_0x7069c7(0xa9))/0x8+parseInt(_0x7069c7(0xd5))/0x9+parseInt(_0x7069c7(0xdc))/0xa*(-parseInt(_0x7069c7(0xa8))/0xb);if(_0x387c2e===_0x32de5c)break;else _0x5aec1c['push'](_0x5aec1c['shift']());}catch(_0x337bde){_0x5aec1c['push'](_0x5aec1c['shift']());}}}(a6_0x4fe6,0xb3b65));import{BaseCommand}from'./command.js';function a6_0x41e1(_0x1e74d2,_0x3f2ccc){_0x1e74d2=_0x1e74d2-0xa1;const _0x4fe67f=a6_0x4fe6();let _0x41e104=_0x4fe67f[_0x1e74d2];return _0x41e104;}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_0x401f4a(0xa7),a6_0x401f4a(0xcc),'cookie',a6_0x401f4a(0xe8),'set-cookie2','x-xsrf-token',a6_0x401f4a(0xb3),a6_0x401f4a(0xa1)]);function isSensitiveHeader(_0x2cbd66){const _0x1f14ce=a6_0x401f4a;return SENSITIVE_HEADERS[_0x1f14ce(0xd0)](_0x2cbd66[_0x1f14ce(0xcf)]());}function a6_0x4fe6(){const _0x389a16=['type','4884633zOJdOA','status','headers','body','Endpoint\x20must\x20start\x20with\x20/:\x20','18740CSyrYn','join','12065870DhjpTZ','api','.\x20Valid\x20types:\x20','length','site','workflow','file','1357412XvGVmD','44WhwzRx','POST','startsWith','cdp','set-cookie','noColor','x-trino-user','PUT','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','trino','data','color','authorization','11HktARU','10311736RqDqca','10787YZupsq','<\x20HTTP/1.1\x20','request','llm','GET','validate','isArray','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','180iqIxhD','x-auth-token','Invalid\x20HTTP\x20method:\x20','name','trim','\x0aStack\x20trace:\x0a','keys','includes','42EFqKDu','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','stack','header','.\x20Valid\x20methods:\x20','execute','2776596tBiaKc','log','output','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','readBodyFromFile','method','Error:\x20','error','substring','llm-proxy','indexOf','verbose','proxy-authorization','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','PATCH','toLowerCase','has','toUpperCase','entries','Results\x20saved\x20to\x20'];a6_0x4fe6=function(){return _0x389a16;};return a6_0x4fe6();}function parseHeader(_0x5481c0){const _0x26f114=a6_0x401f4a,_0x43b762=_0x5481c0[_0x26f114(0xca)](':');if(_0x43b762===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x5481c0+'\x22.\x20'+_0x26f114(0xbb));const _0x1f95ff=_0x5481c0[_0x26f114(0xc8)](0x0,_0x43b762)[_0x26f114(0xb6)](),_0x287bf1=_0x5481c0[_0x26f114(0xc8)](_0x43b762+0x1)['trim']();if(!_0x1f95ff)throw new Error(_0x26f114(0xc3)+_0x5481c0+'\x22');return[_0x1f95ff,_0x287bf1];}export class ApiCommand extends BaseCommand{[a6_0x401f4a(0xb5)]=a6_0x401f4a(0xdd);['description']=a6_0x401f4a(0xb1);[a6_0x401f4a(0xaf)](_0x25335d){const _0x111320=a6_0x401f4a,{args:_0x5919df,options:_0x135ba4}=_0x25335d,_0x4c1649=_0x135ba4;if(_0x5919df[_0x111320(0xdf)]===0x0)return _0x111320(0xcd);const _0x395323=_0x5919df[0x0];if(!_0x395323[_0x111320(0xe6)]('/'))return _0x111320(0xd9)+_0x395323;const _0xc7fb48=_0x4c1649[_0x111320(0xa5)],_0x4ae5e9=_0x4c1649[_0x111320(0xe2)];if(_0xc7fb48&&_0x4ae5e9)return _0x111320(0xa3);const _0x25a6ac=_0x4c1649[_0x111320(0xc5)]||_0x111320(0xae),_0x211322=[_0x111320(0xae),_0x111320(0xe5),_0x111320(0xa2),'DELETE',_0x111320(0xce)];if(!_0x211322[_0x111320(0xb9)](_0x25a6ac[_0x111320(0xd1)]()))return _0x111320(0xb4)+_0x25a6ac+_0x111320(0xbe)+_0x211322[_0x111320(0xdb)](',\x20');const _0x4b4394=_0x4c1649[_0x111320(0xd4)]||'td',_0x1c5edf=['td',_0x111320(0xe7),_0x111320(0xe1),_0x111320(0xa4),_0x111320(0xad),_0x111320(0xc9)];if(!_0x1c5edf['includes'](_0x4b4394))return'Invalid\x20API\x20type:\x20'+_0x4b4394+_0x111320(0xde)+_0x1c5edf[_0x111320(0xdb)](',\x20');return undefined;}async[a6_0x401f4a(0xbf)](_0x41ad13){const _0x28212a=a6_0x401f4a,{options:_0x559bb9,args:_0x10bbc4,tdx:_0x2274fc}=_0x41ad13,_0x10ced4=_0x559bb9,_0x2d9360=_0x10bbc4[0x0],_0x2ddb02=(_0x10ced4['method']||_0x28212a(0xae))[_0x28212a(0xd1)](),_0x277a23=_0x10ced4['data'],_0x5b9a6d=_0x10ced4[_0x28212a(0xe2)],_0x314734=_0x10ced4[_0x28212a(0xbd)],_0x2a11b2=_0x10ced4[_0x28212a(0xd4)]||'td';try{const _0x5650a1={};if(_0x314734){const _0x501c3a=Array[_0x28212a(0xb0)](_0x314734)?_0x314734:[_0x314734];for(const _0x105e8a of _0x501c3a){const [_0x5d5dd2,_0x4213a8]=parseHeader(_0x105e8a);_0x5650a1[_0x5d5dd2]=_0x4213a8;}}let _0x1ffb4d;if(_0x277a23)_0x1ffb4d=_0x277a23;else{if(_0x5b9a6d)try{_0x1ffb4d=RawAPI[_0x28212a(0xc4)](_0x5b9a6d);}catch(_0x246b49){return console[_0x28212a(0xc7)](_0x28212a(0xc6)+(_0x246b49 instanceof Error?_0x246b49['message']:String(_0x246b49))),0x1;}}const _0x542b1c={'method':_0x2ddb02,'apiType':_0x2a11b2,'includeHeaders':_0x559bb9[_0x28212a(0xcb)]};_0x1ffb4d&&(_0x542b1c[_0x28212a(0xd8)]=_0x1ffb4d);Object[_0x28212a(0xb8)](_0x5650a1)['length']>0x0&&(_0x542b1c[_0x28212a(0xd7)]=_0x5650a1);if(_0x559bb9[_0x28212a(0xcb)]){const _0x5b839d=resolveSite(_0x559bb9[_0x28212a(0xe0)]),_0x13cc99=getEndpoint(_0x5b839d,_0x2a11b2),_0x473be2=''+_0x13cc99+_0x2d9360;console[_0x28212a(0xc7)]('>\x20'+_0x2ddb02+'\x20'+_0x473be2);const _0x5bcdb8=getAuthHeaders(_0x5b839d),_0x3d750c={..._0x5bcdb8,..._0x5650a1};for(const [_0x48f0e0,_0x1cbba6]of Object[_0x28212a(0xd2)](_0x3d750c)){!isSensitiveHeader(_0x48f0e0)&&console[_0x28212a(0xc7)]('>\x20'+_0x48f0e0+':\x20'+_0x1cbba6);}_0x1ffb4d&&console[_0x28212a(0xc7)]('>'),console[_0x28212a(0xc7)]('');}const _0x58aced=await _0x2274fc['api'][_0x28212a(0xac)](_0x2d9360,_0x542b1c);if(_0x559bb9['verbose']&&_0x58aced['headers']){console[_0x28212a(0xc7)](_0x28212a(0xab)+_0x58aced[_0x28212a(0xd6)]);for(const [_0x2ea67d,_0x3a9df7]of Object['entries'](_0x58aced[_0x28212a(0xd7)])){!isSensitiveHeader(_0x2ea67d)&&console[_0x28212a(0xc7)]('<\x20'+_0x2ea67d+':\x20'+_0x3a9df7);}console[_0x28212a(0xc7)]('');}const _0x4b4870=Boolean(_0x559bb9[_0x28212a(0xc2)]),_0x50c1f9={'color':_0x559bb9[_0x28212a(0xa6)],'noColor':_0x559bb9[_0x28212a(0xe9)]||_0x4b4870&&!_0x559bb9[_0x28212a(0xa6)]},_0x4a08ac=colorizeJSON(_0x58aced[_0x28212a(0xa5)],_0x50c1f9);return _0x559bb9[_0x28212a(0xc2)]?(writeFileSync(_0x559bb9[_0x28212a(0xc2)],_0x4a08ac),console['error'](_0x28212a(0xd3)+_0x559bb9[_0x28212a(0xc2)])):console[_0x28212a(0xc1)](_0x4a08ac),0x0;}catch(_0x34ecd6){return _0x34ecd6 instanceof Error?(console[_0x28212a(0xc7)](_0x28212a(0xc6)+_0x34ecd6['message']),_0x559bb9[_0x28212a(0xcb)]&&_0x34ecd6[_0x28212a(0xbc)]&&console[_0x28212a(0xc7)](_0x28212a(0xb7)+_0x34ecd6[_0x28212a(0xbc)])):console['error'](_0x28212a(0xc6)+String(_0x34ecd6)),0x1;}}}
@@ -1 +1 @@
1
- const a7_0x4c49ae=a7_0x6f99;(function(_0x2c5e23,_0x1d96c4){const _0x2a5cad=a7_0x6f99,_0x2be48d=_0x2c5e23();while(!![]){try{const _0x4c9681=parseInt(_0x2a5cad(0x1c5))/0x1+-parseInt(_0x2a5cad(0x1aa))/0x2+parseInt(_0x2a5cad(0x1dc))/0x3*(parseInt(_0x2a5cad(0x1c3))/0x4)+parseInt(_0x2a5cad(0x1ad))/0x5*(-parseInt(_0x2a5cad(0x1ae))/0x6)+-parseInt(_0x2a5cad(0x1b4))/0x7*(-parseInt(_0x2a5cad(0x1c1))/0x8)+parseInt(_0x2a5cad(0x1e7))/0x9+parseInt(_0x2a5cad(0x1c7))/0xa*(parseInt(_0x2a5cad(0x1b6))/0xb);if(_0x4c9681===_0x1d96c4)break;else _0x2be48d['push'](_0x2be48d['shift']());}catch(_0x1b7462){_0x2be48d['push'](_0x2be48d['shift']());}}}(a7_0x4747,0x1fb7c));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';function a7_0x4747(){const _0x190f45=['customSite','Enter\x20site\x20name:','site','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Site\x20name\x20cannot\x20be\x20empty','API\x20key\x20cannot\x20be\x20empty','logLevel','Select\x20your\x20Treasure\x20Data\x20site:','36nhTlbv','\x20(profile:\x20','tdx:\x20auth\x20clear','Setting\x20up\x20authentication\x20for\x20site:\x20','Validating\x20API\x20key...','✓\x20Profile\x20\x27','tdx:\x20auth\x20setup','getUserInfo','yellow','tdx\x20profile:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','275508oxVtJK','log','Remove\x20API\x20key\x20from\x20system\x20keychain','bold','trim','✓\x20Default\x20site\x20set\x20to\x20','\x20for\x20profile:\x20','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20tdx','Enter\x20your\x20TD\x20API\x20key:','join','last_name','✓\x20Authentication\x20successful\x0a','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile','/app/mp/ak','warn','✓\x20API\x20key\x20removed\x20from\x20keychain','us01','No\x20API\x20key\x20found\x20in\x20keychain','90488UOpuJz','execute','\x20(site:\x20','10zYOZOF','728286ZcQyCC','description','text','filter','Name:\x20','status','283297xknMTO','name','22jhZAcz','message','User:\x20','select','auth','green','error','\x0aSetup\x20cancelled','apiKey','System\x20keychain\x20is\x20not\x20available','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','32hUaQmI','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','5188jKHFHU','create','100660wwcBlR','jobs','546010yBIcIG','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','red','email','\x27\x20registered','auth:clear','auth:setup','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','✗\x20Validation\x20failed:\x20','first_name','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','other'];a7_0x4747=function(){return _0x190f45;};return a7_0x4747();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a7_0x6f99(_0x570aa5,_0x3055bb){_0x570aa5=_0x570aa5-0x1a6;const _0x4747dd=a7_0x4747();let _0x6f992d=_0x4747dd[_0x570aa5];return _0x6f992d;}import{clearCredentialCache}from'../core/credential-cache.js';import{buildSiteChoices}from'../core/constants.js';import a7_0x55b52f 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_0x25298f from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x4c49ae(0x1b5)]=a7_0x4c49ae(0x1cd);[a7_0x4c49ae(0x1af)]='Setup\x20API\x20key\x20authentication\x20interactively';async[a7_0x4c49ae(0x1ab)](_0x23abd5){const _0x5b605b=a7_0x4c49ae,{options:_0x393d11}=_0x23abd5,_0x2ef630=_0x393d11[_0x5b605b(0x1f5)];console[_0x5b605b(0x1e8)](a7_0x25298f[_0x5b605b(0x1ea)](_0x5b605b(0x1e2)));const _0x45c068=_0x393d11[_0x5b605b(0x1d5)]||_0x5b605b(0x1a8),{choices:_0x3ee31b,initialIndex:_0xe8e8ed}=buildSiteChoices(_0x45c068),_0x5c087e=_0x2ef630?_0x5b605b(0x1c2)+_0x2ef630+'):':_0x5b605b(0x1db),_0x20d019=await a7_0x55b52f({'type':_0x5b605b(0x1b9),'name':_0x5b605b(0x1d5),'message':_0x5c087e,'choices':_0x3ee31b,'initial':_0xe8e8ed});if(!_0x20d019[_0x5b605b(0x1d5)])return console['log'](_0x5b605b(0x1bd)),0x1;let _0x1f6ba0;if(_0x20d019[_0x5b605b(0x1d5)]===_0x5b605b(0x1d2)){const _0x5dbc9e=await a7_0x55b52f({'type':_0x5b605b(0x1b0),'name':_0x5b605b(0x1d3),'message':_0x5b605b(0x1d4),'initial':'us01','validate':_0x5a021f=>{const _0x5e6fdc=_0x5b605b;if(!_0x5a021f||!_0x5a021f[_0x5e6fdc(0x1eb)]())return _0x5e6fdc(0x1d8);if(!/^[a-z0-9-]+$/['test'](_0x5a021f[_0x5e6fdc(0x1eb)]()))return _0x5e6fdc(0x1e6);return!![];}});if(!_0x5dbc9e[_0x5b605b(0x1d3)])return console[_0x5b605b(0x1e8)](_0x5b605b(0x1bd)),0x1;_0x1f6ba0=_0x5dbc9e[_0x5b605b(0x1d3)];}else _0x1f6ba0=_0x20d019[_0x5b605b(0x1d5)];const _0x1664bd=resolveSite(_0x1f6ba0);console[_0x5b605b(0x1e8)](_0x5b605b(0x1df)+_0x1664bd),console[_0x5b605b(0x1e8)](_0x5b605b(0x1f4)),console[_0x5b605b(0x1e8)]('\x20\x20'+getConsoleUrl(_0x1664bd,_0x5b605b(0x1f6)));const _0xb9ebc6=await a7_0x55b52f({'type':'password','name':'apiKey','message':_0x5b605b(0x1f0),'validate':_0x4a2c5a=>{const _0x4b770b=_0x5b605b;if(!_0x4a2c5a||!_0x4a2c5a[_0x4b770b(0x1eb)]())return _0x4b770b(0x1d9);return!![];}});if(!_0xb9ebc6[_0x5b605b(0x1be)])return console[_0x5b605b(0x1e8)](_0x5b605b(0x1bd)),0x1;const _0x57363e=_0xb9ebc6['apiKey'];console[_0x5b605b(0x1e8)](_0x5b605b(0x1e0));try{const _0x5b8ee0=TDX[_0x5b605b(0x1c4)]({'site':_0x1664bd,'apiKey':_0x57363e[_0x5b605b(0x1eb)](),'logLevel':_0x393d11[_0x5b605b(0x1da)]??LogLevel['ERROR']}),_0x448ac7=await _0x5b8ee0[_0x5b605b(0x1c6)][_0x5b605b(0x1e3)]();console[_0x5b605b(0x1e8)](_0x5b605b(0x1ee)+_0x448ac7[_0x5b605b(0x1ca)]+')');const _0x550e9d=await isKeychainAvailable();_0x550e9d?(await saveAPIKeyAsync(_0x57363e[_0x5b605b(0x1eb)](),_0x1664bd,_0x2ef630),console['log'](_0x5b605b(0x1d6)+(_0x2ef630?_0x5b605b(0x1dd)+_0x2ef630+')':''))):(console[_0x5b605b(0x1a6)](a7_0x25298f[_0x5b605b(0x1e4)](_0x5b605b(0x1d7))),console[_0x5b605b(0x1a6)](a7_0x25298f[_0x5b605b(0x1e4)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x2ef630){const _0x348a1f={'site':_0x1664bd};saveProfileToUserConfig(_0x2ef630,_0x348a1f),console[_0x5b605b(0x1e8)](_0x5b605b(0x1e1)+_0x2ef630+_0x5b605b(0x1cb));}else saveDefaultSiteToUserConfig(_0x1664bd),console[_0x5b605b(0x1e8)](_0x5b605b(0x1ec)+_0x1664bd);const _0x55cfae=_0x2ef630?'\x20--profile\x20'+_0x2ef630:'';return console[_0x5b605b(0x1e8)](),console[_0x5b605b(0x1e8)](_0x5b605b(0x1d1)),console[_0x5b605b(0x1e8)]('\x20\x20tdx'+_0x55cfae+_0x5b605b(0x1c8)),console[_0x5b605b(0x1e8)](_0x5b605b(0x1ef)+_0x55cfae+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x44e0fe){if(_0x44e0fe instanceof HTTPClientError&&_0x44e0fe['status']===0x191)return printAuthError(_0x44e0fe),0x1;return console[_0x5b605b(0x1bc)](a7_0x25298f[_0x5b605b(0x1c9)](_0x5b605b(0x1cf)+(_0x44e0fe instanceof Error?_0x44e0fe[_0x5b605b(0x1b7)]:String(_0x44e0fe)))),console[_0x5b605b(0x1bc)](_0x5b605b(0x1c0)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']=a7_0x4c49ae(0x1ba);[a7_0x4c49ae(0x1af)]=a7_0x4c49ae(0x1ce);async[a7_0x4c49ae(0x1ab)](_0x1e5810){const _0x2a554f=a7_0x4c49ae,{options:_0x16e030,tdx:_0x6c03ad}=_0x1e5810,_0x24056d=_0x16e030['site'],_0x118781=_0x16e030[_0x2a554f(0x1f5)],_0x3b5c48=_0x118781?_0x118781:'N/A';console[_0x2a554f(0x1e8)](_0x2a554f(0x1e5)+_0x3b5c48+_0x2a554f(0x1ac)+_0x24056d+')');const _0x311056=await resolveAPIKeyAsync(_0x24056d,_0x118781);if(_0x311056){const {source:_0x2b6838,isDeprecated:_0x5e2562}=_0x311056,_0x26304e='Read\x20credential\x20from\x20'+_0x2b6838;console[_0x2a554f(0x1e8)](_0x5e2562?a7_0x25298f['yellow'](_0x26304e):_0x26304e);}else console[_0x2a554f(0x1e8)](a7_0x25298f['yellow']('No\x20credential\x20found'));try{const _0x5511e5=await _0x6c03ad[_0x2a554f(0x1c6)][_0x2a554f(0x1e3)]();return console[_0x2a554f(0x1e8)](a7_0x25298f[_0x2a554f(0x1bb)](_0x2a554f(0x1f3))),console['log'](_0x2a554f(0x1b8)+_0x5511e5[_0x2a554f(0x1ca)]),(_0x5511e5[_0x2a554f(0x1d0)]||_0x5511e5['last_name'])&&console[_0x2a554f(0x1e8)](_0x2a554f(0x1b2)+[_0x5511e5[_0x2a554f(0x1d0)],_0x5511e5[_0x2a554f(0x1f2)]][_0x2a554f(0x1b1)](Boolean)[_0x2a554f(0x1f1)]('\x20')),0x0;}catch(_0x4f9bd3){return _0x4f9bd3 instanceof HTTPClientError&&_0x4f9bd3[_0x2a554f(0x1b3)]===0x191?printAuthError(_0x4f9bd3,!![],_0x118781):console['error'](a7_0x25298f[_0x2a554f(0x1c9)]('✗\x20Validation\x20failed:\x20'+(_0x4f9bd3 instanceof Error?_0x4f9bd3[_0x2a554f(0x1b7)]:String(_0x4f9bd3)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x4c49ae(0x1b5)]=a7_0x4c49ae(0x1cc);['description']=a7_0x4c49ae(0x1e9);async[a7_0x4c49ae(0x1ab)](_0x93873c){const _0x1e824=a7_0x4c49ae,{options:_0x35854e}=_0x93873c,_0x427996=_0x35854e['profile'];console[_0x1e824(0x1e8)](a7_0x25298f[_0x1e824(0x1ea)](_0x1e824(0x1de)));const _0xc4c998=await isKeychainAvailable();if(!_0xc4c998)return console[_0x1e824(0x1bc)](a7_0x25298f['red'](_0x1e824(0x1bf))),0x1;const _0x2e5ce0=await deleteKeychainAPIKey(_0x427996);return _0x2e5ce0?(clearCredentialCache(),console['log'](_0x1e824(0x1a7)+(_0x427996?_0x1e824(0x1dd)+_0x427996+')':'')),0x0):(console[_0x1e824(0x1e8)](_0x1e824(0x1a9)+(_0x427996?_0x1e824(0x1ed)+_0x427996:'')),0x1);}}
1
+ function a7_0x1bdc(){const _0x158cda=['\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','No\x20credential\x20found','error','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Remove\x20API\x20key\x20from\x20system\x20keychain','✓\x20Authentication\x20successful\x0a','4605237uXDXtg','red','apiKey','auth:clear','join','Site\x20name\x20cannot\x20be\x20empty','9740isOEWV','Setting\x20up\x20authentication\x20for\x20site:\x20','N/A','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','✓\x20Default\x20site\x20set\x20to\x20','other','API\x20key\x20cannot\x20be\x20empty','✗\x20Validation\x20failed:\x20','name','text','\x20\x20tdx','yellow','✓\x20API\x20key\x20removed\x20from\x20keychain','Enter\x20site\x20name:','filter','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','✓\x20Profile\x20\x27','warn','161ZONDir','2tApzVL','first_name','auth:setup','1503mTbhup','\x0aSetup\x20cancelled','password','\x20for\x20profile:\x20','trim','3585KnYLKN','1565118kpjdOC','log','message','bold','Setup\x20API\x20key\x20authentication\x20interactively','execute','User:\x20','customSite','last_name','10090omYtwF','\x20(profile:\x20','437624axZPVh','profile','jobs','description','select','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','ERROR','site','getUserInfo','status','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','us01','green','68385834ZgMnKJ','\x20(site:\x20','279447ujhfPX','\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx:\x20auth\x20setup','email','tdx:\x20auth\x20clear','Read\x20credential\x20from\x20','/app/mp/ak','You\x20can\x20find\x20your\x20API\x20key\x20at:'];a7_0x1bdc=function(){return _0x158cda;};return a7_0x1bdc();}const a7_0xeee2e2=a7_0x52ff;(function(_0x5624d2,_0x4fe843){const _0xc456ac=a7_0x52ff,_0x23c210=_0x5624d2();while(!![]){try{const _0x49eac3=-parseInt(_0xc456ac(0xf6))/0x1+-parseInt(_0xc456ac(0xd3))/0x2*(parseInt(_0xc456ac(0x106))/0x3)+parseInt(_0xc456ac(0x10c))/0x4*(-parseInt(_0xc456ac(0xdb))/0x5)+-parseInt(_0xc456ac(0xdc))/0x6+-parseInt(_0xc456ac(0xd2))/0x7*(parseInt(_0xc456ac(0xe7))/0x8)+parseInt(_0xc456ac(0xd6))/0x9*(-parseInt(_0xc456ac(0xe5))/0xa)+parseInt(_0xc456ac(0xf4))/0xb;if(_0x49eac3===_0x4fe843)break;else _0x23c210['push'](_0x23c210['shift']());}catch(_0x3d3d89){_0x23c210['push'](_0x23c210['shift']());}}}(a7_0x1bdc,0xec8f4));function a7_0x52ff(_0x3ead46,_0x244485){_0x3ead46=_0x3ead46-0xcb;const _0x1bdc69=a7_0x1bdc();let _0x52ff30=_0x1bdc69[_0x3ead46];return _0x52ff30;}import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import{buildSiteChoices}from'../core/constants.js';import a7_0x3602fb 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_0x5585e8 from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0xeee2e2(0x114)]=a7_0xeee2e2(0xd5);[a7_0xeee2e2(0xea)]=a7_0xeee2e2(0xe0);async[a7_0xeee2e2(0xe1)](_0x527124){const _0x192010=a7_0xeee2e2,{options:_0xe2536c}=_0x527124,_0x1fa9a=_0xe2536c['profile'];console[_0x192010(0xdd)](a7_0x5585e8[_0x192010(0xdf)](_0x192010(0xfa)));const _0x56883c=_0xe2536c[_0x192010(0xee)]||_0x192010(0xf2),{choices:_0x3d11e5,initialIndex:_0x439cae}=buildSiteChoices(_0x56883c),_0x455aad=_0x1fa9a?_0x192010(0x103)+_0x1fa9a+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x52c5db=await a7_0x3602fb({'type':_0x192010(0xeb),'name':_0x192010(0xee),'message':_0x455aad,'choices':_0x3d11e5,'initial':_0x439cae});if(!_0x52c5db[_0x192010(0xee)])return console['log'](_0x192010(0xd7)),0x1;let _0x45c1a6;if(_0x52c5db[_0x192010(0xee)]===_0x192010(0x111)){const _0x59d5bc=await a7_0x3602fb({'type':_0x192010(0x115),'name':_0x192010(0xe3),'message':_0x192010(0xcd),'initial':_0x192010(0xf2),'validate':_0x43b9ee=>{const _0x38d99d=_0x192010;if(!_0x43b9ee||!_0x43b9ee[_0x38d99d(0xda)]())return _0x38d99d(0x10b);if(!/^[a-z0-9-]+$/['test'](_0x43b9ee[_0x38d99d(0xda)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x59d5bc[_0x192010(0xe3)])return console[_0x192010(0xdd)](_0x192010(0xd7)),0x1;_0x45c1a6=_0x59d5bc[_0x192010(0xe3)];}else _0x45c1a6=_0x52c5db[_0x192010(0xee)];const _0x3af228=resolveSite(_0x45c1a6);console['log'](_0x192010(0x10d)+_0x3af228),console['log'](_0x192010(0xff)),console[_0x192010(0xdd)]('\x20\x20'+getConsoleUrl(_0x3af228,_0x192010(0xfe)));const _0x56de81=await a7_0x3602fb({'type':_0x192010(0xd8),'name':'apiKey','message':_0x192010(0xf8),'validate':_0x2af638=>{const _0x44a974=_0x192010;if(!_0x2af638||!_0x2af638[_0x44a974(0xda)]())return _0x44a974(0x112);return!![];}});if(!_0x56de81[_0x192010(0x108)])return console[_0x192010(0xdd)](_0x192010(0xd7)),0x1;const _0x1d76bb=_0x56de81['apiKey'];console[_0x192010(0xdd)]('Validating\x20API\x20key...');try{const _0x3779e2=TDX['create']({'site':_0x3af228,'apiKey':_0x1d76bb[_0x192010(0xda)](),'logLevel':_0xe2536c['logLevel']??LogLevel[_0x192010(0xed)]}),_0xe41608=await _0x3779e2[_0x192010(0xe9)][_0x192010(0xef)]();console['log'](_0x192010(0xec)+_0xe41608[_0x192010(0xfb)]+')');const _0x75216b=await isKeychainAvailable();_0x75216b?(await saveAPIKeyAsync(_0x1d76bb[_0x192010(0xda)](),_0x3af228,_0x1fa9a),console[_0x192010(0xdd)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x1fa9a?_0x192010(0xe6)+_0x1fa9a+')':''))):(console[_0x192010(0xd1)](a7_0x5585e8['yellow'](_0x192010(0xf9))),console[_0x192010(0xd1)](a7_0x5585e8[_0x192010(0xcb)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x1fa9a){const _0xbd29be={'site':_0x3af228};saveProfileToUserConfig(_0x1fa9a,_0xbd29be),console['log'](_0x192010(0xd0)+_0x1fa9a+'\x27\x20registered');}else saveDefaultSiteToUserConfig(_0x3af228),console[_0x192010(0xdd)](_0x192010(0x110)+_0x3af228);const _0x5af00d=_0x1fa9a?_0x192010(0xf7)+_0x1fa9a:'';return console[_0x192010(0xdd)](),console[_0x192010(0xdd)](_0x192010(0xf1)),console['log']('\x20\x20tdx'+_0x5af00d+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x192010(0xdd)](_0x192010(0x116)+_0x5af00d+_0x192010(0x100)),0x0;}catch(_0x13d53d){if(_0x13d53d instanceof HTTPClientError&&_0x13d53d[_0x192010(0xf0)]===0x191)return printAuthError(_0x13d53d),0x1;return console[_0x192010(0x102)](a7_0x5585e8[_0x192010(0x107)](_0x192010(0x113)+(_0x13d53d instanceof Error?_0x13d53d[_0x192010(0xde)]:String(_0x13d53d)))),console[_0x192010(0x102)](_0x192010(0x10f)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0xeee2e2(0x114)]='auth';['description']=a7_0xeee2e2(0xcf);async[a7_0xeee2e2(0xe1)](_0xe9c8db){const _0x1f614c=a7_0xeee2e2,{options:_0x116cc1,tdx:_0x51f148}=_0xe9c8db,_0x213f7d=_0x116cc1[_0x1f614c(0xee)],_0x31f85e=_0x116cc1[_0x1f614c(0xe8)],_0x33bb56=_0x31f85e?_0x31f85e:_0x1f614c(0x10e);console['log']('tdx\x20profile:\x20'+_0x33bb56+_0x1f614c(0xf5)+_0x213f7d+')');const _0x1fc3e7=await resolveAPIKeyAsync(_0x213f7d,_0x31f85e);if(_0x1fc3e7){const {source:_0x4bbea4,isDeprecated:_0x9843e2}=_0x1fc3e7,_0x12e544=_0x1f614c(0xfd)+_0x4bbea4;console['log'](_0x9843e2?a7_0x5585e8[_0x1f614c(0xcb)](_0x12e544):_0x12e544);}else console[_0x1f614c(0xdd)](a7_0x5585e8['yellow'](_0x1f614c(0x101)));try{const _0x159bf8=await _0x51f148['jobs'][_0x1f614c(0xef)]();return console[_0x1f614c(0xdd)](a7_0x5585e8[_0x1f614c(0xf3)](_0x1f614c(0x105))),console[_0x1f614c(0xdd)](_0x1f614c(0xe2)+_0x159bf8[_0x1f614c(0xfb)]),(_0x159bf8['first_name']||_0x159bf8['last_name'])&&console[_0x1f614c(0xdd)]('Name:\x20'+[_0x159bf8[_0x1f614c(0xd4)],_0x159bf8[_0x1f614c(0xe4)]][_0x1f614c(0xce)](Boolean)[_0x1f614c(0x10a)]('\x20')),0x0;}catch(_0x1391ec){return _0x1391ec instanceof HTTPClientError&&_0x1391ec[_0x1f614c(0xf0)]===0x191?printAuthError(_0x1391ec,!![],_0x31f85e):console[_0x1f614c(0x102)](a7_0x5585e8['red'](_0x1f614c(0x113)+(_0x1391ec instanceof Error?_0x1391ec[_0x1f614c(0xde)]:String(_0x1391ec)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0xeee2e2(0x114)]=a7_0xeee2e2(0x109);['description']=a7_0xeee2e2(0x104);async['execute'](_0x4311c6){const _0x116a9a=a7_0xeee2e2,{options:_0x5cec5d}=_0x4311c6,_0x3997e8=_0x5cec5d[_0x116a9a(0xe8)];console[_0x116a9a(0xdd)](a7_0x5585e8[_0x116a9a(0xdf)](_0x116a9a(0xfc)));const _0x2dba7d=await isKeychainAvailable();if(!_0x2dba7d)return console[_0x116a9a(0x102)](a7_0x5585e8[_0x116a9a(0x107)]('System\x20keychain\x20is\x20not\x20available')),0x1;const _0x18b781=await deleteKeychainAPIKey(_0x3997e8);return _0x18b781?(clearCredentialCache(),console[_0x116a9a(0xdd)](_0x116a9a(0xcc)+(_0x3997e8?_0x116a9a(0xe6)+_0x3997e8+')':'')),0x0):(console['log']('No\x20API\x20key\x20found\x20in\x20keychain'+(_0x3997e8?_0x116a9a(0xd9)+_0x3997e8:'')),0x1);}}
@@ -1 +1 @@
1
- const a8_0x4cdd0f=a8_0x2481;(function(_0x1f2313,_0xd3a14){const _0x20679e=a8_0x2481,_0x223317=_0x1f2313();while(!![]){try{const _0x1d57ef=parseInt(_0x20679e(0x1f8))/0x1+parseInt(_0x20679e(0x1f6))/0x2*(-parseInt(_0x20679e(0x1e5))/0x3)+parseInt(_0x20679e(0x1f3))/0x4*(parseInt(_0x20679e(0x1f9))/0x5)+-parseInt(_0x20679e(0x1ca))/0x6*(-parseInt(_0x20679e(0x1cd))/0x7)+-parseInt(_0x20679e(0x203))/0x8+parseInt(_0x20679e(0x1de))/0x9+-parseInt(_0x20679e(0x1bf))/0xa*(parseInt(_0x20679e(0x1e7))/0xb);if(_0x1d57ef===_0xd3a14)break;else _0x223317['push'](_0x223317['shift']());}catch(_0x2422cc){_0x223317['push'](_0x223317['shift']());}}}(a8_0x2d1c,0xb16da));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a8_0x2481(_0x1f21ea,_0x3a8576){_0x1f21ea=_0x1f21ea-0x1ba;const _0x2d1c12=a8_0x2d1c();let _0x24815a=_0x2d1c12[_0x1f21ea];return _0x24815a;}import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x142a9f,_0x277d89){const _0x25e554=a8_0x2481;if(_0x142a9f instanceof SDKError)console[_0x25e554(0x202)](_0x25e554(0x204)+_0x142a9f[_0x25e554(0x1c2)]),_0x277d89[_0x25e554(0x20c)]&&(_0x142a9f[_0x25e554(0x1f4)]&&console['error'](_0x25e554(0x1d3)+_0x142a9f[_0x25e554(0x1f4)]),_0x142a9f[_0x25e554(0x209)]&&(console['error'](_0x25e554(0x1c0)),console['error'](_0x142a9f[_0x25e554(0x209)])));else throw _0x142a9f;}function a8_0x2d1c(){const _0x13a269=['No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','verbose','404','join','targetKnowledgeBase','options','agentId','Resolving\x20project\x20\x27','18310bMwFsK','\x0aStack\x20trace:','content','message','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','llm','Using\x20cached\x20default\x20agent:\x20','write','resolveProjectId','--agent\x20flag','Chat\x20session:\x20','6uGJrdx','Continuing\x20chat:\x20','string','4675811hDdtbr','includes','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','data','chat','targetAgent','\x20\x20Cause:\x20','args','getOrCreateDefaultAgent','\x0aError:\x20','llmAgent','getDefaultAgent','tool','context','chatId','functionName','event','3685950SszxCc','name','CHAT_NOT_FOUND','claude-4.5-haiku','slice','log','new','3IxxPUU','tool_call','7326OjxBzZ','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','description','type','agent','\x27...','\x27\x20not\x20found','stringify','done','Getting\x20default\x20agent...','stdout','stream','3465668yQXnhj','cause','startChat','122622DORMzr','Error:\x20Chat\x20session\x20\x27','1350558CpWjms','5KLxcHE','handleChatEvent','metadata','projectId','targetFunction','execute','Resolving\x20agent\x20\x27','resolveAgentId','streamChatJsonl','error','10295960LSXRFU','Error:\x20','llmProject','Using\x20agent\x20from\x20','site','targetWebSearchTool','stack','validate'];a8_0x2d1c=function(){return _0x13a269;};return a8_0x2d1c();}async function resolveAgentId(_0x120cde,_0x3b80c5,_0x2e8a0f,_0x4f6dd4,_0x5cbcfa){const _0x3e7f66=a8_0x2481,_0x1f6442=_0x3b80c5||_0x2e8a0f;if(_0x1f6442){const {projectName:_0x2dbb23,agentName:_0x3ccf3a}=parseAgentRef(_0x1f6442),_0xc98c4=_0x3ccf3a||_0x1f6442,_0x2952cc=_0x3ccf3a?_0x2dbb23:_0x4f6dd4;if(!_0x2952cc)throw new Error(_0x3e7f66(0x20b));if(_0x5cbcfa){const _0x42b65d=_0x3b80c5?_0x3e7f66(0x1c8):'session\x20context';console['error'](_0x3e7f66(0x206)+_0x42b65d+':\x20'+_0x2952cc+'/'+_0xc98c4);}const _0x2998b0=await withSpinner(_0x3e7f66(0x1be)+_0x2952cc+_0x3e7f66(0x1ec),()=>_0x120cde[_0x3e7f66(0x1c4)][_0x3e7f66(0x1c7)](_0x2952cc),{'verbose':_0x5cbcfa}),_0x5a4fc4=await withSpinner(_0x3e7f66(0x1ff)+_0xc98c4+_0x3e7f66(0x1ec),()=>_0x120cde[_0x3e7f66(0x1c4)][_0x3e7f66(0x200)](_0xc98c4,_0x2998b0[_0x3e7f66(0x1d0)]),{'verbose':_0x5cbcfa});return _0x5a4fc4[_0x3e7f66(0x1d0)];}else{const _0x56c928=_0x120cde[_0x3e7f66(0x1c4)][_0x3e7f66(0x1d8)]();if(_0x56c928)return _0x5cbcfa&&console[_0x3e7f66(0x202)](_0x3e7f66(0x1c5)+_0x56c928['name']),_0x56c928['id'];const _0x40ce43=await withSpinner(_0x3e7f66(0x1f0),()=>_0x120cde[_0x3e7f66(0x1c4)][_0x3e7f66(0x1d5)](_0x3e7f66(0x1e1),0x0),{'verbose':_0x5cbcfa});return _0x40ce43[_0x3e7f66(0x1d0)]['id'];}}export class ChatCommand extends BaseCommand{[a8_0x4cdd0f(0x1df)]=a8_0x4cdd0f(0x1d1);['description']='Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)';[a8_0x4cdd0f(0x20a)](_0x3fa42b){const _0xb37316=a8_0x4cdd0f,_0x1119f9=_0x3fa42b[_0xb37316(0x1d4)][_0xb37316(0x1ba)]('\x20');if(!_0x1119f9)return _0xb37316(0x1c3);return undefined;}async['streamChat'](_0x5af36c,_0x23dc5f,_0x2599fb,_0x591d4f,_0x92eeb2){const _0x45d98b=a8_0x4cdd0f;for await(const _0x2681d6 of _0x5af36c[_0x45d98b(0x1c4)][_0x45d98b(0x1d1)](_0x23dc5f,{'agentId':_0x2599fb,'chatId':_0x591d4f})){if(_0x2681d6[_0x45d98b(0x1ea)]===_0x45d98b(0x1fb)){const _0x2b4015=_0x2681d6[_0x45d98b(0x1d0)][_0x45d98b(0x1db)];saveLastChatId(_0x2b4015),_0x92eeb2&&console[_0x45d98b(0x202)](_0x45d98b(0x1c9)+_0x2b4015);}else _0x2681d6[_0x45d98b(0x1ea)]===_0x45d98b(0x1dd)&&this[_0x45d98b(0x1fa)](_0x2681d6['data']);}}async[a8_0x4cdd0f(0x201)](_0xe837da,_0x18beba,_0x305031,_0xe0d7bf){const _0x542739=a8_0x4cdd0f,_0x502f42=_0xe837da[_0x542739(0x1da)][_0x542739(0x207)];let _0x3d9298=![];for await(const _0x2dcb08 of _0xe837da[_0x542739(0x1c4)][_0x542739(0x1d1)](_0x18beba,{'agentId':_0x305031,'chatId':_0xe0d7bf})){if(_0x2dcb08['type']===_0x542739(0x1fb)){const _0x1b6f89=_0x2dcb08[_0x542739(0x1d0)];saveLastChatId(_0x1b6f89[_0x542739(0x1db)]);const _0x5a27c4=_0x1b6f89[_0x542739(0x1fc)]&&_0x1b6f89[_0x542739(0x1bd)]?getLLMConversationUrl(_0x502f42,_0x1b6f89[_0x542739(0x1fc)],_0x1b6f89[_0x542739(0x1bd)],_0x1b6f89[_0x542739(0x1db)]):undefined;console['log'](JSON['stringify']({'type':'metadata','data':{'chatId':_0x1b6f89[_0x542739(0x1db)],'agentId':_0x1b6f89['agentId'],'consoleUrl':_0x5a27c4}})),_0x3d9298=!![];}else{if(_0x2dcb08[_0x542739(0x1ea)]===_0x542739(0x1dd)){!_0x3d9298&&_0xe0d7bf&&(console[_0x542739(0x1e3)](JSON[_0x542739(0x1ee)]({'type':_0x542739(0x1fb),'data':{'chatId':_0xe0d7bf}})),_0x3d9298=!![]);const _0x3322ba=_0x2dcb08[_0x542739(0x1d0)];if(_0x542739(0x1c1)in _0x3322ba)console['log'](JSON[_0x542739(0x1ee)]({'type':_0x542739(0x1c1),'data':{'content':_0x3322ba['content']}}));else{if(_0x542739(0x1e6)in _0x3322ba){const _0x528e32=_0x3322ba['tool_call'];console[_0x542739(0x1e3)](JSON[_0x542739(0x1ee)]({'type':'tool_call','data':{'id':_0x528e32['id'],'name':_0x528e32['functionName'],'target':_0x528e32[_0x542739(0x1bb)]?.[_0x542739(0x1df)]||_0x528e32[_0x542739(0x1d2)]?.[_0x542739(0x1df)]||_0x528e32[_0x542739(0x208)]?.[_0x542739(0x1df)]||_0x528e32[_0x542739(0x1fd)]}}));}else{if(_0x542739(0x1d9)in _0x3322ba)console[_0x542739(0x1e3)](JSON[_0x542739(0x1ee)]({'type':'tool_result','data':{'id':_0x3322ba[_0x542739(0x1d9)]['id'],'name':_0x3322ba[_0x542739(0x1d9)][_0x542739(0x1dc)],'result':typeof _0x3322ba['tool'][_0x542739(0x1c1)]===_0x542739(0x1cc)?_0x3322ba[_0x542739(0x1d9)]['content'][_0x542739(0x1e2)](0x0,0x1f4):''}}));else'error'in _0x3322ba&&console[_0x542739(0x1e3)](JSON[_0x542739(0x1ee)]({'type':_0x542739(0x202),'data':{'error':_0x3322ba['error']}}));}}}}}console['log'](JSON[_0x542739(0x1ee)]({'type':_0x542739(0x1ef)}));}async[a8_0x4cdd0f(0x1fe)](_0x3a56f0){const _0x54acc7=a8_0x4cdd0f,{options:_0x171f52,args:_0x595a42,tdx:_0x65270a}=_0x3a56f0,_0x1d3d07=_0x595a42[_0x54acc7(0x1ba)]('\x20'),_0x3ac7fa=_0x171f52,_0x4b37eb=_0x3ac7fa[_0x54acc7(0x1eb)],_0x9b9e91=_0x3ac7fa[_0x54acc7(0x1d7)],_0x127b00=_0x3ac7fa['llmProject'],_0x51074f=_0x3ac7fa[_0x54acc7(0x1e4)],_0x251a6e=_0x3ac7fa['chatId'],_0x30686f=_0x3ac7fa[_0x54acc7(0x1f2)];if(_0x51074f&&_0x251a6e)return console[_0x54acc7(0x202)](_0x54acc7(0x1e8)),0x1;try{let _0xc7d7eb,_0x182701;if(_0x251a6e)_0x182701=_0x251a6e;else!_0x51074f&&(_0x182701=loadLastChatId(),_0x182701&&_0x171f52['verbose']&&console[_0x54acc7(0x202)](_0x54acc7(0x1cb)+_0x182701));!_0x251a6e&&(_0x51074f||!_0x182701)&&(_0xc7d7eb=await resolveAgentId(_0x65270a,_0x4b37eb,_0x9b9e91,_0x127b00,_0x171f52['verbose']));const _0x5be76b=_0x30686f?(_0x4175d4,_0x4a67c4,_0x57789d)=>this[_0x54acc7(0x201)](_0x65270a,_0x4175d4,_0x4a67c4,_0x57789d):(_0x4c8dac,_0x2bf065,_0x3cd5e3)=>this['streamChat'](_0x65270a,_0x4c8dac,_0x2bf065,_0x3cd5e3,_0x171f52[_0x54acc7(0x20c)]);try{await _0x5be76b(_0x1d3d07,_0xc7d7eb,_0x182701);}catch(_0x41fc05){const _0x20588c=_0x41fc05 instanceof SDKError&&_0x41fc05['code']===ErrorCode[_0x54acc7(0x1e0)]||_0x41fc05 instanceof Error&&_0x41fc05[_0x54acc7(0x1c2)][_0x54acc7(0x1ce)](_0x54acc7(0x20d));if(_0x20588c&&_0x251a6e)return console[_0x54acc7(0x202)](_0x54acc7(0x1f7)+_0x251a6e+_0x54acc7(0x1ed)),0x1;if(_0x20588c)_0x171f52[_0x54acc7(0x20c)]&&console[_0x54acc7(0x202)]('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0xc7d7eb&&(_0xc7d7eb=await resolveAgentId(_0x65270a,_0x4b37eb,_0x9b9e91,_0x127b00,_0x171f52[_0x54acc7(0x20c)])),await _0x5be76b(_0x1d3d07,_0xc7d7eb,undefined);else throw _0x41fc05;}return!_0x30686f&&console[_0x54acc7(0x1e3)](),0x0;}catch(_0x20a5a4){return console[_0x54acc7(0x202)](),handleSDKError(_0x20a5a4,_0x171f52),0x1;}}['handleChatEvent'](_0xa765dd){const _0x5bb7d5=a8_0x4cdd0f;if(_0x5bb7d5(0x1c1)in _0xa765dd)process[_0x5bb7d5(0x1f1)][_0x5bb7d5(0x1c6)](_0xa765dd[_0x5bb7d5(0x1c1)]);else _0x5bb7d5(0x202)in _0xa765dd&&console[_0x5bb7d5(0x202)](_0x5bb7d5(0x1d6)+_0xa765dd['error']);}}export class ChatCreateCommand extends BaseCommand{['name']='chat-create';[a8_0x4cdd0f(0x1e9)]='Create\x20a\x20new\x20chat\x20session';[a8_0x4cdd0f(0x20a)](_0x378daf){const _0x370f09=a8_0x4cdd0f,_0x34b48b=_0x378daf[_0x370f09(0x1bc)],_0x2fcea0=_0x34b48b[_0x370f09(0x1eb)],_0x2fd3c7=_0x34b48b['llmAgent'];if(!_0x2fcea0&&!_0x2fd3c7)return _0x370f09(0x1cf);return undefined;}async[a8_0x4cdd0f(0x1fe)](_0x349ea6){const _0x504fcb=a8_0x4cdd0f,{options:_0x4ce530,tdx:_0x500b41}=_0x349ea6,_0xe2d6a4=_0x4ce530,_0xec3550=_0xe2d6a4[_0x504fcb(0x1eb)],_0x50d205=_0xe2d6a4[_0x504fcb(0x1d7)],_0x5946d3=_0xe2d6a4[_0x504fcb(0x205)];try{const _0x11b6ed=await resolveAgentId(_0x500b41,_0xec3550,_0x50d205,_0x5946d3,_0x4ce530[_0x504fcb(0x20c)]),_0x299ba8=await _0x500b41[_0x504fcb(0x1c4)][_0x504fcb(0x1f5)](_0x11b6ed);return saveLastChatId(_0x299ba8['id']),console['log'](JSON['stringify']({'chatId':_0x299ba8['id'],'agentId':_0x11b6ed})),0x0;}catch(_0xb9bd03){return handleSDKError(_0xb9bd03,_0x4ce530),0x1;}}}
1
+ const a8_0x2ba85d=a8_0x4f25;(function(_0x47e55a,_0x2a3f1c){const _0x4e06a8=a8_0x4f25,_0x5f4961=_0x47e55a();while(!![]){try{const _0x245ca0=-parseInt(_0x4e06a8(0x1bb))/0x1+-parseInt(_0x4e06a8(0x1c3))/0x2*(parseInt(_0x4e06a8(0x180))/0x3)+-parseInt(_0x4e06a8(0x191))/0x4*(-parseInt(_0x4e06a8(0x1bd))/0x5)+parseInt(_0x4e06a8(0x17b))/0x6*(-parseInt(_0x4e06a8(0x195))/0x7)+-parseInt(_0x4e06a8(0x1a2))/0x8*(parseInt(_0x4e06a8(0x17f))/0x9)+-parseInt(_0x4e06a8(0x1b7))/0xa*(parseInt(_0x4e06a8(0x181))/0xb)+parseInt(_0x4e06a8(0x1a8))/0xc;if(_0x245ca0===_0x2a3f1c)break;else _0x5f4961['push'](_0x5f4961['shift']());}catch(_0x40bb0b){_0x5f4961['push'](_0x5f4961['shift']());}}}(a8_0x3fa2,0xdafa1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';function a8_0x3fa2(){const _0x4c702d=['Error:\x20Chat\x20session\x20\x27','targetWebSearchTool','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','type','name','Continuing\x20chat:\x20','4417750kKSkCk','metadata','404','streamChatJsonl','837418XtJatl','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','305815OVtOhf','options','\x0aStack\x20trace:','claude-4.5-haiku','getDefaultAgent','session\x20context','688570jJSOQg','Resolving\x20agent\x20\x27','tool','content','\x27...','verbose','llmAgent','handleChatEvent','774yosTJA','context','string','error','4179096zNIHgU','3KxrxaL','22XmdSzW','projectId','agent','chatId','stream','llmProject','Resolving\x20project\x20\x27','Using\x20agent\x20from\x20','new','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','description','targetFunction','targetAgent','startChat','code','stdout','32tWGqHH','Create\x20a\x20new\x20chat\x20session','data','execute','55888PHEeMw','cause','streamChat','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','Chat\x20session:\x20','--agent\x20flag','tool_call','Getting\x20default\x20agent...','\x20\x20Cause:\x20','Using\x20cached\x20default\x20agent:\x20','functionName','stringify','\x27\x20not\x20found','8MAJgWW','args','message','llm','log','site','47605896ddKZhW','getOrCreateDefaultAgent','chat','stack','join','\x0aError:\x20','resolveProjectId','event','agentId'];a8_0x3fa2=function(){return _0x4c702d;};return a8_0x3fa2();}import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x10797e,_0x498d8c){const _0x574289=a8_0x4f25;if(_0x10797e instanceof SDKError)console['error']('Error:\x20'+_0x10797e[_0x574289(0x1a4)]),_0x498d8c[_0x574289(0x178)]&&(_0x10797e[_0x574289(0x196)]&&console['error'](_0x574289(0x19d)+_0x10797e['cause']),_0x10797e['stack']&&(console[_0x574289(0x17e)](_0x574289(0x1bf)),console['error'](_0x10797e[_0x574289(0x1ab)])));else throw _0x10797e;}function a8_0x4f25(_0x4ddb1c,_0x52d011){_0x4ddb1c=_0x4ddb1c-0x174;const _0x3fa248=a8_0x3fa2();let _0x4f25da=_0x3fa248[_0x4ddb1c];return _0x4f25da;}async function resolveAgentId(_0x57c604,_0x31c2c4,_0x551268,_0x43808e,_0x4960ff){const _0x542205=a8_0x4f25,_0x1704ae=_0x31c2c4||_0x551268;if(_0x1704ae){const {projectName:_0x4b9874,agentName:_0x242ac6}=parseAgentRef(_0x1704ae),_0x19b26d=_0x242ac6||_0x1704ae,_0x3d5988=_0x242ac6?_0x4b9874:_0x43808e;if(!_0x3d5988)throw new Error(_0x542205(0x1bc));if(_0x4960ff){const _0x43adee=_0x31c2c4?_0x542205(0x19a):_0x542205(0x1c2);console[_0x542205(0x17e)](_0x542205(0x188)+_0x43adee+':\x20'+_0x3d5988+'/'+_0x19b26d);}const _0x2d3463=await withSpinner(_0x542205(0x187)+_0x3d5988+'\x27...',()=>_0x57c604[_0x542205(0x1a5)][_0x542205(0x1ae)](_0x3d5988),{'verbose':_0x4960ff}),_0x498649=await withSpinner(_0x542205(0x174)+_0x19b26d+_0x542205(0x177),()=>_0x57c604[_0x542205(0x1a5)]['resolveAgentId'](_0x19b26d,_0x2d3463['data']),{'verbose':_0x4960ff});return _0x498649['data'];}else{const _0x41a818=_0x57c604[_0x542205(0x1a5)][_0x542205(0x1c1)]();if(_0x41a818)return _0x4960ff&&console['error'](_0x542205(0x19e)+_0x41a818[_0x542205(0x1b5)]),_0x41a818['id'];const _0x268285=await withSpinner(_0x542205(0x19c),()=>_0x57c604[_0x542205(0x1a5)][_0x542205(0x1a9)](_0x542205(0x1c0),0x0),{'verbose':_0x4960ff});return _0x268285[_0x542205(0x193)]['id'];}}export class ChatCommand extends BaseCommand{[a8_0x2ba85d(0x1b5)]='chat';['description']=a8_0x2ba85d(0x198);['validate'](_0x52066f){const _0x2a9ef4=a8_0x2ba85d,_0x575b41=_0x52066f[_0x2a9ef4(0x1a3)]['join']('\x20');if(!_0x575b41)return _0x2a9ef4(0x18a);return undefined;}async[a8_0x2ba85d(0x197)](_0x2c09bb,_0x392f33,_0x1ced2b,_0xb7237f,_0x4b2140){const _0x231ac7=a8_0x2ba85d;for await(const _0x399597 of _0x2c09bb[_0x231ac7(0x1a5)][_0x231ac7(0x1aa)](_0x392f33,{'agentId':_0x1ced2b,'chatId':_0xb7237f})){if(_0x399597['type']===_0x231ac7(0x1b8)){const _0x3b5f1d=_0x399597[_0x231ac7(0x193)][_0x231ac7(0x184)];saveLastChatId(_0x3b5f1d),_0x4b2140&&console[_0x231ac7(0x17e)](_0x231ac7(0x199)+_0x3b5f1d);}else _0x399597[_0x231ac7(0x1b4)]===_0x231ac7(0x1af)&&this[_0x231ac7(0x17a)](_0x399597[_0x231ac7(0x193)]);}}async['streamChatJsonl'](_0x55ca1d,_0x4e5cf7,_0xadd353,_0x1c80cd){const _0x1ec9f1=a8_0x2ba85d,_0xa94581=_0x55ca1d[_0x1ec9f1(0x17c)][_0x1ec9f1(0x1a7)];let _0x90a980=![];for await(const _0x3836fe of _0x55ca1d[_0x1ec9f1(0x1a5)][_0x1ec9f1(0x1aa)](_0x4e5cf7,{'agentId':_0xadd353,'chatId':_0x1c80cd})){if(_0x3836fe[_0x1ec9f1(0x1b4)]==='metadata'){const _0x1f685d=_0x3836fe[_0x1ec9f1(0x193)];saveLastChatId(_0x1f685d[_0x1ec9f1(0x184)]);const _0x54dda7=_0x1f685d['projectId']&&_0x1f685d[_0x1ec9f1(0x1b0)]?getLLMConversationUrl(_0xa94581,_0x1f685d[_0x1ec9f1(0x182)],_0x1f685d[_0x1ec9f1(0x1b0)],_0x1f685d[_0x1ec9f1(0x184)]):undefined;console['log'](JSON[_0x1ec9f1(0x1a0)]({'type':_0x1ec9f1(0x1b8),'data':{'chatId':_0x1f685d[_0x1ec9f1(0x184)],'agentId':_0x1f685d[_0x1ec9f1(0x1b0)],'consoleUrl':_0x54dda7}})),_0x90a980=!![];}else{if(_0x3836fe[_0x1ec9f1(0x1b4)]==='event'){!_0x90a980&&_0x1c80cd&&(console['log'](JSON[_0x1ec9f1(0x1a0)]({'type':_0x1ec9f1(0x1b8),'data':{'chatId':_0x1c80cd}})),_0x90a980=!![]);const _0x3ad241=_0x3836fe[_0x1ec9f1(0x193)];if(_0x1ec9f1(0x176)in _0x3ad241)console[_0x1ec9f1(0x1a6)](JSON[_0x1ec9f1(0x1a0)]({'type':'content','data':{'content':_0x3ad241[_0x1ec9f1(0x176)]}}));else{if(_0x1ec9f1(0x19b)in _0x3ad241){const _0x5b1aa5=_0x3ad241[_0x1ec9f1(0x19b)];console[_0x1ec9f1(0x1a6)](JSON['stringify']({'type':_0x1ec9f1(0x19b),'data':{'id':_0x5b1aa5['id'],'name':_0x5b1aa5[_0x1ec9f1(0x19f)],'target':_0x5b1aa5['targetKnowledgeBase']?.[_0x1ec9f1(0x1b5)]||_0x5b1aa5[_0x1ec9f1(0x18d)]?.['name']||_0x5b1aa5[_0x1ec9f1(0x1b2)]?.[_0x1ec9f1(0x1b5)]||_0x5b1aa5[_0x1ec9f1(0x18c)]}}));}else{if(_0x1ec9f1(0x175)in _0x3ad241)console[_0x1ec9f1(0x1a6)](JSON[_0x1ec9f1(0x1a0)]({'type':'tool_result','data':{'id':_0x3ad241[_0x1ec9f1(0x175)]['id'],'name':_0x3ad241['tool'][_0x1ec9f1(0x19f)],'result':typeof _0x3ad241[_0x1ec9f1(0x175)][_0x1ec9f1(0x176)]===_0x1ec9f1(0x17d)?_0x3ad241[_0x1ec9f1(0x175)][_0x1ec9f1(0x176)]['slice'](0x0,0x1f4):''}}));else _0x1ec9f1(0x17e)in _0x3ad241&&console[_0x1ec9f1(0x1a6)](JSON[_0x1ec9f1(0x1a0)]({'type':'error','data':{'error':_0x3ad241[_0x1ec9f1(0x17e)]}}));}}}}}console[_0x1ec9f1(0x1a6)](JSON[_0x1ec9f1(0x1a0)]({'type':'done'}));}async[a8_0x2ba85d(0x194)](_0x5021cb){const _0xbcd81=a8_0x2ba85d,{options:_0x339e0e,args:_0x41e09b,tdx:_0x4d53c6}=_0x5021cb,_0x24125d=_0x41e09b[_0xbcd81(0x1ac)]('\x20'),_0x40dc14=_0x339e0e,_0x53a447=_0x40dc14['agent'],_0x314ef8=_0x40dc14[_0xbcd81(0x179)],_0x397b5a=_0x40dc14[_0xbcd81(0x186)],_0x772747=_0x40dc14[_0xbcd81(0x189)],_0x2a7367=_0x40dc14['chatId'],_0xf2c724=_0x40dc14[_0xbcd81(0x185)];if(_0x772747&&_0x2a7367)return console[_0xbcd81(0x17e)](_0xbcd81(0x1b3)),0x1;try{let _0x515978,_0x543d71;if(_0x2a7367)_0x543d71=_0x2a7367;else!_0x772747&&(_0x543d71=loadLastChatId(),_0x543d71&&_0x339e0e[_0xbcd81(0x178)]&&console[_0xbcd81(0x17e)](_0xbcd81(0x1b6)+_0x543d71));!_0x2a7367&&(_0x772747||!_0x543d71)&&(_0x515978=await resolveAgentId(_0x4d53c6,_0x53a447,_0x314ef8,_0x397b5a,_0x339e0e[_0xbcd81(0x178)]));const _0x42a330=_0xf2c724?(_0x30c1a5,_0x57002f,_0x41e1a5)=>this[_0xbcd81(0x1ba)](_0x4d53c6,_0x30c1a5,_0x57002f,_0x41e1a5):(_0x88be6,_0x3d0f30,_0x272f00)=>this[_0xbcd81(0x197)](_0x4d53c6,_0x88be6,_0x3d0f30,_0x272f00,_0x339e0e[_0xbcd81(0x178)]);try{await _0x42a330(_0x24125d,_0x515978,_0x543d71);}catch(_0x21259b){const _0x3e633b=_0x21259b instanceof SDKError&&_0x21259b[_0xbcd81(0x18f)]===ErrorCode['CHAT_NOT_FOUND']||_0x21259b instanceof Error&&_0x21259b[_0xbcd81(0x1a4)]['includes'](_0xbcd81(0x1b9));if(_0x3e633b&&_0x2a7367)return console['error'](_0xbcd81(0x1b1)+_0x2a7367+_0xbcd81(0x1a1)),0x1;if(_0x3e633b)_0x339e0e[_0xbcd81(0x178)]&&console['error']('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x515978&&(_0x515978=await resolveAgentId(_0x4d53c6,_0x53a447,_0x314ef8,_0x397b5a,_0x339e0e[_0xbcd81(0x178)])),await _0x42a330(_0x24125d,_0x515978,undefined);else throw _0x21259b;}return!_0xf2c724&&console[_0xbcd81(0x1a6)](),0x0;}catch(_0xa19879){return console['error'](),handleSDKError(_0xa19879,_0x339e0e),0x1;}}['handleChatEvent'](_0x13c7ce){const _0x5e2ab4=a8_0x2ba85d;if(_0x5e2ab4(0x176)in _0x13c7ce)process[_0x5e2ab4(0x190)]['write'](_0x13c7ce[_0x5e2ab4(0x176)]);else _0x5e2ab4(0x17e)in _0x13c7ce&&console['error'](_0x5e2ab4(0x1ad)+_0x13c7ce[_0x5e2ab4(0x17e)]);}}export class ChatCreateCommand extends BaseCommand{[a8_0x2ba85d(0x1b5)]='chat-create';[a8_0x2ba85d(0x18b)]=a8_0x2ba85d(0x192);['validate'](_0x515bf2){const _0x585b40=a8_0x2ba85d,_0x24cd2e=_0x515bf2[_0x585b40(0x1be)],_0x32828e=_0x24cd2e[_0x585b40(0x183)],_0x308f79=_0x24cd2e[_0x585b40(0x179)];if(!_0x32828e&&!_0x308f79)return'Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22';return undefined;}async['execute'](_0x1cbfb8){const _0x558a6f=a8_0x2ba85d,{options:_0x7198bb,tdx:_0x2a5a0e}=_0x1cbfb8,_0x8d9fb6=_0x7198bb,_0x6b0a11=_0x8d9fb6[_0x558a6f(0x183)],_0x26a96a=_0x8d9fb6['llmAgent'],_0x3e4c03=_0x8d9fb6['llmProject'];try{const _0x2352ed=await resolveAgentId(_0x2a5a0e,_0x6b0a11,_0x26a96a,_0x3e4c03,_0x7198bb[_0x558a6f(0x178)]),_0x6dab1f=await _0x2a5a0e['llm'][_0x558a6f(0x18e)](_0x2352ed);return saveLastChatId(_0x6dab1f['id']),console[_0x558a6f(0x1a6)](JSON[_0x558a6f(0x1a0)]({'chatId':_0x6dab1f['id'],'agentId':_0x2352ed})),0x0;}catch(_0x4d20de){return handleSDKError(_0x4d20de,_0x7198bb),0x1;}}}