@treasuredata/tdx 0.16.5 → 0.16.7

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 (188) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.d.ts +1 -1
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli-categories.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/activations.js +1 -1
  10. package/dist/commands/agent-command.js +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/command.js.map +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/job-command.js +1 -1
  25. package/dist/commands/journey-command.js +1 -1
  26. package/dist/commands/journey-validate-command.js +1 -1
  27. package/dist/commands/llm-command.js +1 -1
  28. package/dist/commands/llm-proxy.js +1 -1
  29. package/dist/commands/mcp-command.js +1 -1
  30. package/dist/commands/parent-segment-command.js +1 -1
  31. package/dist/commands/profile-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segment-validate-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/status-command.d.ts +20 -0
  45. package/dist/commands/status-command.d.ts.map +1 -0
  46. package/dist/commands/status-command.js +1 -0
  47. package/dist/commands/status-command.js.map +1 -0
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/unset-command.js +1 -1
  50. package/dist/commands/use-command.js +1 -1
  51. package/dist/commands/user-command.js +1 -1
  52. package/dist/commands/workflow-command.js +1 -1
  53. package/dist/core/auth.js +1 -1
  54. package/dist/core/command-output.js +1 -1
  55. package/dist/core/config.js +1 -1
  56. package/dist/core/connection-cache.js +1 -1
  57. package/dist/core/constants.js +1 -1
  58. package/dist/core/credential-cache.js +1 -1
  59. package/dist/core/global-context.d.ts.map +1 -1
  60. package/dist/core/global-context.js +1 -1
  61. package/dist/core/global-context.js.map +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/profile.js +1 -1
  64. package/dist/core/project-config.js +1 -1
  65. package/dist/core/session.js +1 -1
  66. package/dist/core/user-cache.js +1 -1
  67. package/dist/core/version.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/mcp/server.js +1 -1
  70. package/dist/mcp/tools/index.js +1 -1
  71. package/dist/mcp/tools/tdx-run.js +1 -1
  72. package/dist/mcp/tools/tdx-search.js +1 -1
  73. package/dist/mcp/utils.js +1 -1
  74. package/dist/proxy/anthropic-adapter.js +1 -1
  75. package/dist/proxy/claude-usage-tracker.js +1 -1
  76. package/dist/proxy/context-signature.js +1 -1
  77. package/dist/proxy/conversation-utils.js +1 -1
  78. package/dist/proxy/passthrough-server.js +1 -1
  79. package/dist/proxy/server.js +1 -1
  80. package/dist/proxy/session-cache.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.d.ts +3 -1
  85. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  88. package/dist/sdk/agent/test/evaluator.js +1 -1
  89. package/dist/sdk/agent/test/executor.js +1 -1
  90. package/dist/sdk/agent/test/index.js +1 -1
  91. package/dist/sdk/agent/test/output.js +1 -1
  92. package/dist/sdk/agent/test/parser.js +1 -1
  93. package/dist/sdk/agent/types/agent-def.d.ts +3 -3
  94. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  95. package/dist/sdk/api.js +1 -1
  96. package/dist/sdk/claude-agent/claude-agent-client.d.ts +13 -0
  97. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  98. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  99. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  100. package/dist/sdk/claude-agent/environment.js +1 -1
  101. package/dist/sdk/claude-agent/index.js +1 -1
  102. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  103. package/dist/sdk/client/cdp-api-client.js +1 -1
  104. package/dist/sdk/client/endpoints.js +1 -1
  105. package/dist/sdk/client/engage-api-client.js +1 -1
  106. package/dist/sdk/client/http-client.js +1 -1
  107. package/dist/sdk/client/llm-api-client.d.ts +9 -1
  108. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  109. package/dist/sdk/client/llm-api-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js.map +1 -1
  111. package/dist/sdk/client/rate-limiter.js +1 -1
  112. package/dist/sdk/client/td-api-client.js +1 -1
  113. package/dist/sdk/client/trino-api-client.js +1 -1
  114. package/dist/sdk/client/workflow-client.js +1 -1
  115. package/dist/sdk/connection-validator.js +1 -1
  116. package/dist/sdk/connection.js +1 -1
  117. package/dist/sdk/engage.js +1 -1
  118. package/dist/sdk/errors.js +1 -1
  119. package/dist/sdk/index.js +1 -1
  120. package/dist/sdk/io/index.js +1 -1
  121. package/dist/sdk/io/node-filesystem.js +1 -1
  122. package/dist/sdk/job.js +1 -1
  123. package/dist/sdk/journey.js +1 -1
  124. package/dist/sdk/llm/chat-cache.js +1 -1
  125. package/dist/sdk/llm/index.d.ts.map +1 -1
  126. package/dist/sdk/llm/index.js +1 -1
  127. package/dist/sdk/llm/index.js.map +1 -1
  128. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  129. package/dist/sdk/llm/model-aliases.js +1 -1
  130. package/dist/sdk/llm/model-factors.js +1 -1
  131. package/dist/sdk/query/index.js +1 -1
  132. package/dist/sdk/query/sql-parser.js +1 -1
  133. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  134. package/dist/sdk/segment/fields-display.js +1 -1
  135. package/dist/sdk/segment/file-discovery.js +1 -1
  136. package/dist/sdk/segment/journey-utils.js +1 -1
  137. package/dist/sdk/segment/journey-yaml.js +1 -1
  138. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  139. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  140. package/dist/sdk/segment/pull-workflow.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/target-resolution.js +1 -1
  146. package/dist/sdk/segment/tdx-config.js +1 -1
  147. package/dist/sdk/segment/validate-files.js +1 -1
  148. package/dist/sdk/segment/yaml-validator.js +1 -1
  149. package/dist/sdk/segment.js +1 -1
  150. package/dist/sdk/types/index.d.ts +1 -1
  151. package/dist/sdk/types/index.d.ts.map +1 -1
  152. package/dist/sdk/types/index.js +1 -1
  153. package/dist/sdk/types/index.js.map +1 -1
  154. package/dist/sdk/types/llm.d.ts +36 -1
  155. package/dist/sdk/types/llm.d.ts.map +1 -1
  156. package/dist/sdk/types/progress.js +1 -1
  157. package/dist/sdk/user.js +1 -1
  158. package/dist/sdk/util/format-detector.js +1 -1
  159. package/dist/sdk/util/formatters.js +1 -1
  160. package/dist/sdk/util/index.js +1 -1
  161. package/dist/sdk/util/tree-formatter.js +1 -1
  162. package/dist/sdk/workflow/clone-workflow.js +1 -1
  163. package/dist/sdk/workflow/index.js +1 -1
  164. package/dist/sdk/workflow/pull-workflow.js +1 -1
  165. package/dist/sdk/workflow/push-workflow.js +1 -1
  166. package/dist/sdk/workflow/tdx-config.js +1 -1
  167. package/dist/sdk/workflow/workflow-utils.js +1 -1
  168. package/dist/utils/async.js +1 -1
  169. package/dist/utils/colors.js +1 -1
  170. package/dist/utils/diff.js +1 -1
  171. package/dist/utils/file-permissions.js +1 -1
  172. package/dist/utils/global-cache.js +1 -1
  173. package/dist/utils/json-loader.js +1 -1
  174. package/dist/utils/local-cache.js +1 -1
  175. package/dist/utils/option-validation.js +1 -1
  176. package/dist/utils/port.js +1 -1
  177. package/dist/utils/process.d.ts +10 -0
  178. package/dist/utils/process.d.ts.map +1 -1
  179. package/dist/utils/process.js +1 -1
  180. package/dist/utils/process.js.map +1 -1
  181. package/dist/utils/prompt.js +1 -1
  182. package/dist/utils/spinner.js +1 -1
  183. package/dist/utils/sse-parser.js +1 -1
  184. package/dist/utils/string-utils.js +1 -1
  185. package/dist/utils/table-ref-parser.js +1 -1
  186. package/dist/utils/tdx-logger.js +1 -1
  187. package/dist/utils/version-check.js +1 -1
  188. package/package.json +1 -1
@@ -1 +1 @@
1
- const a17_0x16d09e=a17_0x584b;(function(_0xe42a7,_0x591b7d){const _0xe89836=a17_0x584b,_0x18c60b=_0xe42a7();while(!![]){try{const _0x4593aa=parseInt(_0xe89836(0x14f))/0x1+-parseInt(_0xe89836(0x161))/0x2+parseInt(_0xe89836(0x138))/0x3+-parseInt(_0xe89836(0x12f))/0x4*(parseInt(_0xe89836(0x14b))/0x5)+-parseInt(_0xe89836(0x167))/0x6*(parseInt(_0xe89836(0x139))/0x7)+parseInt(_0xe89836(0x15e))/0x8+-parseInt(_0xe89836(0x153))/0x9;if(_0x4593aa===_0x591b7d)break;else _0x18c60b['push'](_0x18c60b['shift']());}catch(_0x13d93d){_0x18c60b['push'](_0x18c60b['shift']());}}}(a17_0x3469,0x8f472));function a17_0x3469(){const _0xb17ea5=['10650goiBRv','result','query','Database:\x20','user_name','Job\x20type:\x20','name','Usage:\x20job\x20result\x20<job-id>','substring','type','job_id','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','map','trino','Listing\x20jobs...','round','url','list','4QNRpcJ','data','status','cause','\x27\x20to\x20verify\x20the\x20job\x20status','Getting\x20job\x20results...','created_at','Status\x20filter:\x20','verbose','2173245ktdYqR','4501aZXmlQ','✔\x20Job\x20submitted','Show\x20job\x20details','length','show','error','getTime','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','List\x20jobs','database','\x20jobs','description','\x20\x20Cause:\x20','start_at','Usage:\x20job\x20kill\x20<job-id>','kill','file','Kill\x20a\x20job','1029130qJIVEx','jobs','Error:\x20','jobType','1172907fcmlCw','Usage:\x20job\x20show\x20<job-id>','job:show','...','2707686BFzNmk','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Getting\x20job\x20details...','debug','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','message','Query:\x20','\x20job','Error:\x20Job\x20ID\x20is\x20required','end_at','Get\x20job\x20results','8259784ZtAyai','Submitting\x20job...','execute','1389848LLgnYN','Error:\x20Query\x20is\x20required','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','hive','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Submitting\x20kill\x20request...'];a17_0x3469=function(){return _0xb17ea5;};return a17_0x3469();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x16d09e(0x16d)]=a17_0x16d09e(0x14c);[a17_0x16d09e(0x144)]=a17_0x16d09e(0x141);async[a17_0x16d09e(0x160)](_0x5b5295){const _0x363720=a17_0x16d09e,{options:_0x388a70,tdx:_0x579a66}=_0x5b5295;try{const _0x4e751e=resolveLimit(_0x388a70['limit'],DEFAULT_DISPLAY_LIMIT),_0x1e8fa8=_0x388a70['status'];_0x388a70[_0x363720(0x137)]&&(console[_0x363720(0x13e)]('Limit:\x20'+_0x4e751e+_0x363720(0x143)),_0x1e8fa8&&console[_0x363720(0x13e)](_0x363720(0x136)+_0x1e8fa8));const _0x201aae=await withSpinner(_0x363720(0x12b),()=>_0x579a66[_0x363720(0x14c)][_0x363720(0x12e)]({'from':0x0,'to':_0x4e751e-0x1,'status':_0x1e8fa8}),{'verbose':_0x388a70[_0x363720(0x137)]}),_0x36d4a2=_0x201aae[_0x363720(0x130)];console[_0x363720(0x13e)]('✔\x20Found\x20'+_0x36d4a2[_0x363720(0x13c)]+_0x363720(0x15a)+(_0x36d4a2[_0x363720(0x13c)]!==0x1?'s':''));const _0x8c6ffe=_0x36d4a2[_0x363720(0x129)](_0x1f7e1b=>{const _0x544c85=_0x363720;let _0x89d4c6;if(_0x1f7e1b[_0x544c85(0x146)]&&_0x1f7e1b[_0x544c85(0x15c)]){const _0x391bf9=new Date(_0x1f7e1b[_0x544c85(0x146)])[_0x544c85(0x13f)](),_0x593a7e=new Date(_0x1f7e1b[_0x544c85(0x15c)])[_0x544c85(0x13f)]();_0x89d4c6=Math[_0x544c85(0x12c)]((_0x593a7e-_0x391bf9)/0x3e8);}return{'job_id':_0x1f7e1b[_0x544c85(0x127)],'type':_0x1f7e1b[_0x544c85(0x126)],'status':_0x1f7e1b[_0x544c85(0x131)],'user_name':_0x1f7e1b[_0x544c85(0x16b)],'duration_sec':_0x89d4c6,'created_at':_0x1f7e1b[_0x544c85(0x135)],'started_at':_0x1f7e1b[_0x544c85(0x146)],'end_at':_0x1f7e1b[_0x544c85(0x15c)]};});return await handleSDKOutput(_0x8c6ffe,_0x388a70),0x0;}catch(_0x49163c){if(_0x49163c instanceof SDKError)return console[_0x363720(0x13e)](_0x363720(0x14d)+_0x49163c[_0x363720(0x158)]),_0x49163c[_0x363720(0x132)]&&console[_0x363720(0x13e)](_0x363720(0x145)+_0x49163c[_0x363720(0x132)]),0x1;throw _0x49163c;}}}export class JobShowCommand extends BaseCommand{[a17_0x16d09e(0x16d)]=a17_0x16d09e(0x151);['description']=a17_0x16d09e(0x13b);async[a17_0x16d09e(0x160)](_0x2d7549){const _0x3e9215=a17_0x16d09e,{options:_0x4ece96,args:_0x424f15,tdx:_0x21205a}=_0x2d7549,_0xd70d2f=_0x424f15[0x0];if(!_0xd70d2f)return console[_0x3e9215(0x13e)](_0x3e9215(0x15b)),console[_0x3e9215(0x13e)](_0x3e9215(0x150)),0x1;try{const _0x1e4e88=await withSpinner(_0x3e9215(0x155),()=>_0x21205a[_0x3e9215(0x14c)][_0x3e9215(0x13d)](_0xd70d2f),{'verbose':_0x4ece96[_0x3e9215(0x137)]}),_0x4d4f1a=_0x1e4e88['data'];let _0x1062bb;if(_0x4d4f1a[_0x3e9215(0x146)]&&_0x4d4f1a[_0x3e9215(0x15c)]){const _0x5c5e81=new Date(_0x4d4f1a[_0x3e9215(0x146)])[_0x3e9215(0x13f)](),_0x3b0cd2=new Date(_0x4d4f1a[_0x3e9215(0x15c)])['getTime']();_0x1062bb=Math[_0x3e9215(0x12c)]((_0x3b0cd2-_0x5c5e81)/0x3e8);}const _0x4990fe={'job_id':_0x4d4f1a[_0x3e9215(0x127)],'type':_0x4d4f1a[_0x3e9215(0x126)],'status':_0x4d4f1a[_0x3e9215(0x131)],..._0x4d4f1a[_0x3e9215(0x16b)]&&{'user_name':_0x4d4f1a[_0x3e9215(0x16b)]},..._0x1062bb!==undefined&&{'duration_sec':_0x1062bb},..._0x4d4f1a[_0x3e9215(0x135)]&&{'created_at':_0x4d4f1a[_0x3e9215(0x135)]},..._0x4d4f1a[_0x3e9215(0x146)]&&{'started_at':_0x4d4f1a[_0x3e9215(0x146)]},..._0x4d4f1a[_0x3e9215(0x15c)]&&{'end_at':_0x4d4f1a[_0x3e9215(0x15c)]},..._0x4d4f1a[_0x3e9215(0x142)]&&{'database':_0x4d4f1a['database']},..._0x4d4f1a['priority']!==undefined&&{'priority':_0x4d4f1a['priority']},..._0x4d4f1a[_0x3e9215(0x12d)]&&{'url':_0x4d4f1a[_0x3e9215(0x12d)]},..._0x4d4f1a[_0x3e9215(0x169)]&&{'query':_0x4d4f1a[_0x3e9215(0x169)]},..._0x4d4f1a[_0x3e9215(0x156)]&&{'debug':_0x4d4f1a['debug']}};return await handleSingleObjectOutput(_0x4990fe,_0x4ece96),0x0;}catch(_0xe53853){if(_0xe53853 instanceof SDKError)return console['error'](_0x3e9215(0x14d)+_0xe53853['message']),_0xe53853[_0x3e9215(0x132)]&&console[_0x3e9215(0x13e)](_0x3e9215(0x145)+_0xe53853[_0x3e9215(0x132)]),0x1;throw _0xe53853;}}}export class JobKillCommand extends BaseCommand{[a17_0x16d09e(0x16d)]='job:kill';['description']=a17_0x16d09e(0x14a);async[a17_0x16d09e(0x160)](_0x224708){const _0x4c031d=a17_0x16d09e,{options:_0x59f35a,args:_0x3c4c36,tdx:_0x4b7637}=_0x224708,_0x97281a=_0x3c4c36[0x0];if(!_0x97281a)return console[_0x4c031d(0x13e)](_0x4c031d(0x15b)),console['error'](_0x4c031d(0x147)),0x1;try{if(!_0x59f35a['yes']){const _0x196e34=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x97281a+'?');if(!_0x196e34)return console[_0x4c031d(0x13e)]('Cancelled'),0x0;}return await withSpinner(_0x4c031d(0x166),()=>_0x4b7637[_0x4c031d(0x14c)][_0x4c031d(0x148)](_0x97281a),{'verbose':_0x59f35a[_0x4c031d(0x137)]}),console['error'](_0x4c031d(0x163)+_0x97281a),console[_0x4c031d(0x13e)](_0x4c031d(0x128)+_0x97281a+_0x4c031d(0x133)),0x0;}catch(_0x20f830){if(_0x20f830 instanceof SDKError)return console[_0x4c031d(0x13e)]('Error:\x20'+_0x20f830[_0x4c031d(0x158)]),_0x20f830[_0x4c031d(0x132)]&&console['error'](_0x4c031d(0x145)+_0x20f830['cause']),0x1;throw _0x20f830;}}}function a17_0x584b(_0x1f26b8,_0x19f9ea){_0x1f26b8=_0x1f26b8-0x124;const _0x34697c=a17_0x3469();let _0x584b21=_0x34697c[_0x1f26b8];return _0x584b21;}export class JobSubmitCommand extends BaseCommand{['name']='job:submit';[a17_0x16d09e(0x144)]='Submit\x20a\x20job';async[a17_0x16d09e(0x160)](_0x5ef919){const _0x4473bc=a17_0x16d09e,{options:_0x30416e,args:_0x24a2d3,tdx:_0x10150a}=_0x5ef919;try{const _0x152fbf=_0x30416e[_0x4473bc(0x14e)]||_0x4473bc(0x12a),_0x557573=_0x30416e[_0x4473bc(0x149)],_0x1b8964=_0x30416e['database']||'information_schema';if(_0x152fbf!==_0x4473bc(0x12a)&&_0x152fbf!==_0x4473bc(0x164))return console[_0x4473bc(0x13e)](_0x4473bc(0x140)),0x1;let _0x1ac813;if(_0x557573){if(_0x24a2d3[0x0])return console['error'](_0x4473bc(0x165)),0x1;const _0x2ca173=readSqlStatementsFromFile(_0x557573);if(_0x2ca173[_0x4473bc(0x13c)]===0x0)return console[_0x4473bc(0x13e)]('Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file'),0x1;if(_0x2ca173[_0x4473bc(0x13c)]>0x1)return console[_0x4473bc(0x13e)](_0x4473bc(0x154)),0x1;_0x1ac813=_0x2ca173[0x0];}else{if(!_0x24a2d3[0x0])return console[_0x4473bc(0x13e)](_0x4473bc(0x162)),console[_0x4473bc(0x13e)](_0x4473bc(0x157)),0x1;_0x1ac813=_0x24a2d3[0x0];}_0x30416e[_0x4473bc(0x137)]&&(console['error'](_0x4473bc(0x16c)+_0x152fbf),console[_0x4473bc(0x13e)](_0x4473bc(0x16a)+_0x1b8964),console[_0x4473bc(0x13e)](_0x4473bc(0x159)+_0x1ac813[_0x4473bc(0x125)](0x0,0x64)+(_0x1ac813[_0x4473bc(0x13c)]>0x64?_0x4473bc(0x152):'')));const _0x59326f=await withSpinner(_0x4473bc(0x15f),()=>_0x10150a[_0x4473bc(0x14c)]['submit'](_0x1b8964,_0x1ac813,_0x152fbf),{'verbose':_0x30416e[_0x4473bc(0x137)]}),_0x9c19d9=_0x59326f[_0x4473bc(0x130)];return console[_0x4473bc(0x13e)](_0x4473bc(0x13a)),console[_0x4473bc(0x13e)]('\x20\x20Job\x20ID:\x20'+_0x9c19d9[_0x4473bc(0x127)]),await handleSDKOutput([_0x9c19d9],_0x30416e),0x0;}catch(_0x29a166){if(_0x29a166 instanceof SDKError)return console[_0x4473bc(0x13e)](_0x4473bc(0x14d)+_0x29a166[_0x4473bc(0x158)]),_0x29a166[_0x4473bc(0x132)]&&console[_0x4473bc(0x13e)](_0x4473bc(0x145)+_0x29a166[_0x4473bc(0x132)]),0x1;throw _0x29a166;}}}export class JobResultCommand extends BaseCommand{['name']='job:result';['description']=a17_0x16d09e(0x15d);async['execute'](_0x2ab739){const _0x1f76cc=a17_0x16d09e,{options:_0x250eb9,args:_0x116e45,tdx:_0x9d3414}=_0x2ab739,_0x521689=_0x116e45[0x0];if(!_0x521689)return console[_0x1f76cc(0x13e)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x1f76cc(0x13e)](_0x1f76cc(0x124)),0x1;try{const _0x3fb7fe=await withSpinner(_0x1f76cc(0x134),()=>_0x9d3414['jobs'][_0x1f76cc(0x168)](_0x521689),{'verbose':_0x250eb9[_0x1f76cc(0x137)]}),_0x10a7f2=_0x3fb7fe[_0x1f76cc(0x130)];return console['error']('✔\x20Retrieved\x20'+_0x10a7f2['length']+'\x20row'+(_0x10a7f2['length']!==0x1?'s':'')),await handleSDKOutput(_0x10a7f2,_0x250eb9),0x0;}catch(_0x48b215){if(_0x48b215 instanceof SDKError)return console['error'](_0x1f76cc(0x14d)+_0x48b215[_0x1f76cc(0x158)]),_0x48b215[_0x1f76cc(0x132)]&&console[_0x1f76cc(0x13e)](_0x1f76cc(0x145)+_0x48b215[_0x1f76cc(0x132)]),0x1;throw _0x48b215;}}}
1
+ const a17_0x10bb2d=a17_0x5bdc;(function(_0x328d40,_0x2107dd){const _0x4297ba=a17_0x5bdc,_0x23a660=_0x328d40();while(!![]){try{const _0x38eb9e=parseInt(_0x4297ba(0x16e))/0x1*(-parseInt(_0x4297ba(0x160))/0x2)+parseInt(_0x4297ba(0x156))/0x3*(parseInt(_0x4297ba(0x178))/0x4)+parseInt(_0x4297ba(0x17f))/0x5*(parseInt(_0x4297ba(0x15c))/0x6)+parseInt(_0x4297ba(0x144))/0x7*(-parseInt(_0x4297ba(0x150))/0x8)+parseInt(_0x4297ba(0x161))/0x9*(parseInt(_0x4297ba(0x145))/0xa)+parseInt(_0x4297ba(0x165))/0xb+parseInt(_0x4297ba(0x141))/0xc;if(_0x38eb9e===_0x2107dd)break;else _0x23a660['push'](_0x23a660['shift']());}catch(_0x533d6a){_0x23a660['push'](_0x23a660['shift']());}}}(a17_0x34a7,0x55428));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a17_0x5bdc(_0x450aae,_0x44fb28){_0x450aae=_0x450aae-0x12d;const _0x34a76f=a17_0x34a7();let _0x5bdc6f=_0x34a76f[_0x450aae];return _0x5bdc6f;}import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{['name']=a17_0x10bb2d(0x17d);[a17_0x10bb2d(0x136)]=a17_0x10bb2d(0x157);async[a17_0x10bb2d(0x169)](_0x2b6e02){const _0x3a0c8e=a17_0x10bb2d,{options:_0x5507f3,tdx:_0x14f689}=_0x2b6e02;try{const _0x4c48c5=resolveLimit(_0x5507f3[_0x3a0c8e(0x14b)],DEFAULT_DISPLAY_LIMIT),_0x1aa818=_0x5507f3[_0x3a0c8e(0x159)];_0x5507f3[_0x3a0c8e(0x12d)]&&(console[_0x3a0c8e(0x13d)](_0x3a0c8e(0x170)+_0x4c48c5+'\x20jobs'),_0x1aa818&&console[_0x3a0c8e(0x13d)](_0x3a0c8e(0x167)+_0x1aa818));const _0x1462ee=await withSpinner(_0x3a0c8e(0x152),()=>_0x14f689['jobs'][_0x3a0c8e(0x151)]({'from':0x0,'to':_0x4c48c5-0x1,'status':_0x1aa818}),{'verbose':_0x5507f3[_0x3a0c8e(0x12d)]}),_0x53d571=_0x1462ee['data'];console['error'](_0x3a0c8e(0x174)+_0x53d571[_0x3a0c8e(0x15f)]+_0x3a0c8e(0x147)+(_0x53d571['length']!==0x1?'s':''));const _0xf0c94f=_0x53d571[_0x3a0c8e(0x14a)](_0x48b573=>{const _0x55ff4a=_0x3a0c8e;let _0x3d6128;if(_0x48b573[_0x55ff4a(0x148)]&&_0x48b573[_0x55ff4a(0x130)]){const _0x5462db=new Date(_0x48b573[_0x55ff4a(0x148)])[_0x55ff4a(0x14c)](),_0x943347=new Date(_0x48b573[_0x55ff4a(0x130)])[_0x55ff4a(0x14c)]();_0x3d6128=Math[_0x55ff4a(0x13b)]((_0x943347-_0x5462db)/0x3e8);}return{'job_id':_0x48b573[_0x55ff4a(0x175)],'type':_0x48b573[_0x55ff4a(0x171)],'status':_0x48b573[_0x55ff4a(0x159)],'user_name':_0x48b573[_0x55ff4a(0x173)],'duration_sec':_0x3d6128,'created_at':_0x48b573['created_at'],'started_at':_0x48b573['start_at'],'end_at':_0x48b573[_0x55ff4a(0x130)]};});return await handleSDKOutput(_0xf0c94f,_0x5507f3),0x0;}catch(_0x8a5eaf){if(_0x8a5eaf instanceof SDKError)return console['error'](_0x3a0c8e(0x181)+_0x8a5eaf[_0x3a0c8e(0x154)]),_0x8a5eaf[_0x3a0c8e(0x17a)]&&console['error']('\x20\x20Cause:\x20'+_0x8a5eaf['cause']),0x1;throw _0x8a5eaf;}}}export class JobShowCommand extends BaseCommand{['name']=a17_0x10bb2d(0x16c);[a17_0x10bb2d(0x136)]=a17_0x10bb2d(0x16a);async[a17_0x10bb2d(0x169)](_0x12a3b1){const _0x30055d=a17_0x10bb2d,{options:_0x142346,args:_0x11b57a,tdx:_0x1076ee}=_0x12a3b1,_0x34d1ac=_0x11b57a[0x0];if(!_0x34d1ac)return console['error'](_0x30055d(0x138)),console[_0x30055d(0x13d)](_0x30055d(0x176)),0x1;try{const _0x324213=await withSpinner(_0x30055d(0x143),()=>_0x1076ee[_0x30055d(0x17d)][_0x30055d(0x14e)](_0x34d1ac),{'verbose':_0x142346['verbose']}),_0x218026=_0x324213[_0x30055d(0x142)];let _0x23b94d;if(_0x218026['start_at']&&_0x218026[_0x30055d(0x130)]){const _0x5cba95=new Date(_0x218026[_0x30055d(0x148)])['getTime'](),_0x51a2c1=new Date(_0x218026[_0x30055d(0x130)])[_0x30055d(0x14c)]();_0x23b94d=Math['round']((_0x51a2c1-_0x5cba95)/0x3e8);}const _0xbb02f7={'job_id':_0x218026[_0x30055d(0x175)],'type':_0x218026['type'],'status':_0x218026[_0x30055d(0x159)],..._0x218026['user_name']&&{'user_name':_0x218026[_0x30055d(0x173)]},..._0x23b94d!==undefined&&{'duration_sec':_0x23b94d},..._0x218026[_0x30055d(0x137)]&&{'created_at':_0x218026['created_at']},..._0x218026[_0x30055d(0x148)]&&{'started_at':_0x218026[_0x30055d(0x148)]},..._0x218026[_0x30055d(0x130)]&&{'end_at':_0x218026[_0x30055d(0x130)]},..._0x218026[_0x30055d(0x13e)]&&{'database':_0x218026[_0x30055d(0x13e)]},..._0x218026[_0x30055d(0x15d)]!==undefined&&{'priority':_0x218026['priority']},..._0x218026[_0x30055d(0x162)]&&{'url':_0x218026[_0x30055d(0x162)]},..._0x218026[_0x30055d(0x179)]&&{'query':_0x218026['query']},..._0x218026[_0x30055d(0x149)]&&{'debug':_0x218026[_0x30055d(0x149)]}};return await handleSingleObjectOutput(_0xbb02f7,_0x142346),0x0;}catch(_0x1ee27c){if(_0x1ee27c instanceof SDKError)return console[_0x30055d(0x13d)](_0x30055d(0x181)+_0x1ee27c[_0x30055d(0x154)]),_0x1ee27c[_0x30055d(0x17a)]&&console[_0x30055d(0x13d)](_0x30055d(0x12f)+_0x1ee27c[_0x30055d(0x17a)]),0x1;throw _0x1ee27c;}}}function a17_0x34a7(){const _0x5896a4=['job:show','yes','1mQCAzC','Submitting\x20kill\x20request...','Limit:\x20','type','hive','user_name','✔\x20Found\x20','job_id','Usage:\x20job\x20show\x20<job-id>','information_schema','20980QriDuz','query','cause','submit','Job\x20type:\x20','jobs','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','830CwBQLn','Database:\x20','Error:\x20','verbose','substring','\x20\x20Cause:\x20','end_at','Cancelled','Query:\x20','jobType','...','job:result','description','created_at','Error:\x20Job\x20ID\x20is\x20required','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','Usage:\x20job\x20kill\x20<job-id>','round','Submitting\x20job...','error','database','✔\x20Job\x20submitted','kill','646164oYbqOI','data','Getting\x20job\x20details...','3729971HThTvG','30FjtGUG','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','\x20job','start_at','debug','map','limit','getTime','Getting\x20job\x20results...','show','trino','8UDeVZS','list','Listing\x20jobs...','Error:\x20Query\x20is\x20required','message','name','267snnFtd','List\x20jobs','Kill\x20a\x20job','status','✔\x20Retrieved\x20','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','5106kQmvCH','priority','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','length','499538UKpiQr','585891hSEXJK','url','file','\x20row','3020941sSISsw','Usage:\x20job\x20result\x20<job-id>','Status\x20filter:\x20','Get\x20job\x20results','execute','Show\x20job\x20details','job:kill'];a17_0x34a7=function(){return _0x5896a4;};return a17_0x34a7();}export class JobKillCommand extends BaseCommand{[a17_0x10bb2d(0x155)]=a17_0x10bb2d(0x16b);[a17_0x10bb2d(0x136)]=a17_0x10bb2d(0x158);async[a17_0x10bb2d(0x169)](_0x4ca3da){const _0xe9ce58=a17_0x10bb2d,{options:_0x23327d,args:_0x3bd40f,tdx:_0x1eee66}=_0x4ca3da,_0x20e9fd=_0x3bd40f[0x0];if(!_0x20e9fd)return console[_0xe9ce58(0x13d)](_0xe9ce58(0x138)),console['error'](_0xe9ce58(0x13a)),0x1;try{if(!_0x23327d[_0xe9ce58(0x16d)]){const _0x50f837=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x20e9fd+'?');if(!_0x50f837)return console[_0xe9ce58(0x13d)](_0xe9ce58(0x131)),0x0;}return await withSpinner(_0xe9ce58(0x16f),()=>_0x1eee66[_0xe9ce58(0x17d)][_0xe9ce58(0x140)](_0x20e9fd),{'verbose':_0x23327d['verbose']}),console['error'](_0xe9ce58(0x146)+_0x20e9fd),console[_0xe9ce58(0x13d)](_0xe9ce58(0x15b)+_0x20e9fd+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x55fc14){if(_0x55fc14 instanceof SDKError)return console[_0xe9ce58(0x13d)](_0xe9ce58(0x181)+_0x55fc14['message']),_0x55fc14[_0xe9ce58(0x17a)]&&console[_0xe9ce58(0x13d)]('\x20\x20Cause:\x20'+_0x55fc14[_0xe9ce58(0x17a)]),0x1;throw _0x55fc14;}}}export class JobSubmitCommand extends BaseCommand{[a17_0x10bb2d(0x155)]='job:submit';[a17_0x10bb2d(0x136)]='Submit\x20a\x20job';async[a17_0x10bb2d(0x169)](_0x51d275){const _0x7fa801=a17_0x10bb2d,{options:_0x18929e,args:_0x10c60b,tdx:_0x34cae0}=_0x51d275;try{const _0x527fec=_0x18929e[_0x7fa801(0x133)]||_0x7fa801(0x14f),_0x508690=_0x18929e[_0x7fa801(0x163)],_0x416875=_0x18929e[_0x7fa801(0x13e)]||_0x7fa801(0x177);if(_0x527fec!==_0x7fa801(0x14f)&&_0x527fec!==_0x7fa801(0x172))return console['error'](_0x7fa801(0x15e)),0x1;let _0x3957c1;if(_0x508690){if(_0x10c60b[0x0])return console[_0x7fa801(0x13d)]('Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option'),0x1;const _0x368d28=readSqlStatementsFromFile(_0x508690);if(_0x368d28[_0x7fa801(0x15f)]===0x0)return console[_0x7fa801(0x13d)](_0x7fa801(0x17e)),0x1;if(_0x368d28[_0x7fa801(0x15f)]>0x1)return console[_0x7fa801(0x13d)]('Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'),0x1;_0x3957c1=_0x368d28[0x0];}else{if(!_0x10c60b[0x0])return console['error'](_0x7fa801(0x153)),console['error'](_0x7fa801(0x139)),0x1;_0x3957c1=_0x10c60b[0x0];}_0x18929e[_0x7fa801(0x12d)]&&(console[_0x7fa801(0x13d)](_0x7fa801(0x17c)+_0x527fec),console[_0x7fa801(0x13d)](_0x7fa801(0x180)+_0x416875),console[_0x7fa801(0x13d)](_0x7fa801(0x132)+_0x3957c1[_0x7fa801(0x12e)](0x0,0x64)+(_0x3957c1['length']>0x64?_0x7fa801(0x134):'')));const _0x3281f1=await withSpinner(_0x7fa801(0x13c),()=>_0x34cae0['jobs'][_0x7fa801(0x17b)](_0x416875,_0x3957c1,_0x527fec),{'verbose':_0x18929e[_0x7fa801(0x12d)]}),_0x362f53=_0x3281f1[_0x7fa801(0x142)];return console[_0x7fa801(0x13d)](_0x7fa801(0x13f)),console[_0x7fa801(0x13d)]('\x20\x20Job\x20ID:\x20'+_0x362f53[_0x7fa801(0x175)]),await handleSDKOutput([_0x362f53],_0x18929e),0x0;}catch(_0x160737){if(_0x160737 instanceof SDKError)return console[_0x7fa801(0x13d)]('Error:\x20'+_0x160737['message']),_0x160737['cause']&&console['error']('\x20\x20Cause:\x20'+_0x160737['cause']),0x1;throw _0x160737;}}}export class JobResultCommand extends BaseCommand{[a17_0x10bb2d(0x155)]=a17_0x10bb2d(0x135);[a17_0x10bb2d(0x136)]=a17_0x10bb2d(0x168);async['execute'](_0x33238a){const _0x82f93e=a17_0x10bb2d,{options:_0x49cd91,args:_0x2c9128,tdx:_0x15e642}=_0x33238a,_0x10065c=_0x2c9128[0x0];if(!_0x10065c)return console['error'](_0x82f93e(0x138)),console[_0x82f93e(0x13d)](_0x82f93e(0x166)),0x1;try{const _0x5145df=await withSpinner(_0x82f93e(0x14d),()=>_0x15e642[_0x82f93e(0x17d)]['result'](_0x10065c),{'verbose':_0x49cd91['verbose']}),_0x2a1d74=_0x5145df['data'];return console['error'](_0x82f93e(0x15a)+_0x2a1d74[_0x82f93e(0x15f)]+_0x82f93e(0x164)+(_0x2a1d74[_0x82f93e(0x15f)]!==0x1?'s':'')),await handleSDKOutput(_0x2a1d74,_0x49cd91),0x0;}catch(_0xe9830d){if(_0xe9830d instanceof SDKError)return console['error'](_0x82f93e(0x181)+_0xe9830d[_0x82f93e(0x154)]),_0xe9830d[_0x82f93e(0x17a)]&&console[_0x82f93e(0x13d)](_0x82f93e(0x12f)+_0xe9830d[_0x82f93e(0x17a)]),0x1;throw _0xe9830d;}}}
@@ -1 +1 @@
1
- const a18_0x1cfbec=a18_0x156d;(function(_0x57a697,_0x2f8554){const _0x48c6ef=a18_0x156d,_0x4a357e=_0x57a697();while(!![]){try{const _0x41cb9b=-parseInt(_0x48c6ef(0x12a))/0x1+parseInt(_0x48c6ef(0x188))/0x2*(-parseInt(_0x48c6ef(0x160))/0x3)+-parseInt(_0x48c6ef(0x138))/0x4+parseInt(_0x48c6ef(0x120))/0x5+-parseInt(_0x48c6ef(0x1bb))/0x6*(-parseInt(_0x48c6ef(0x16b))/0x7)+parseInt(_0x48c6ef(0x169))/0x8*(-parseInt(_0x48c6ef(0x179))/0x9)+parseInt(_0x48c6ef(0x158))/0xa;if(_0x41cb9b===_0x2f8554)break;else _0x4a357e['push'](_0x4a357e['shift']());}catch(_0xa01b7){_0x4a357e['push'](_0x4a357e['shift']());}}}(a18_0x3e81,0xc4433));import a18_0x27c2c4 from'chalk';import a18_0x3bf54e from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';function a18_0x3e81(){const _0x425403=['Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','2FogKHf','\x20\x20Consolidating\x20duplicate\x20segment:\x20','journeyStages','get','Warning:\x20Could\x20not\x20resolve\x20segment\x20','message','Target\x20file:\x20','repeat','green','name','goal','journeys','dim','filePath','Folder\x20path:\x20','/e/','🗺️\x20','Error:\x20Parent\x20segment\x20context\x20required','getSegment','resolveSegment','\x20(ID:\x20','getStatistics','population','parent_segment','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','/j/da/je','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','helpText','activationParams','segment','segments','\x5c$&','filter','type','conversionRate','totalEntered','segmentName','includeStats','\x20\x20Target:\x20','\x20\x20Name:\x20','\x22\x20resumed','launched','Usage:\x20journey\x20pause\x20<name-or-path>','journey:resume','(completed)','journey:pull','Getting\x20journey\x20details...','base','description','Parent\x20segment:\x20','stageName','6251808sqBmCW','/app/ps/','Fetching\x20users\x20for\x20email\x20resolution...','📁\x20','✔\x20Context\x20set:\x20','goalRate','table','resolveJourneyId','journey:push','add','Show\x20journey\x20statistics','(paused)','cyan','journey:pause','Listing\x20folders...','all','journey:view','Fetching\x20connections\x20for\x20name\x20resolution...','session','\x20(rule\x20match)','Found\x20','✔\x20Journey\x20\x22','log','buildIdToEmailMap','setPhase','toLowerCase','yellow','versionNumber','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','(root)','rule','hasChanges','\x20\x20-\x20','attributes','stages','✔\x20All\x20files\x20are\x20up\x20to\x20date','red','replace','\x27\x20not\x20found\x20in\x20','parentName','Resolving\x20parent\x20segment...','relative','(draft)','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','\x20new\x20files','error','Write\x20','file','audienceId','content','map','join','Error:\x20','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','format','1569655YaUpgV','Resume\x20a\x20paused\x20journey','yes','\x20\x20Preserving\x20local\x20segment\x20name:\x20','\x20\x20Folder\x20path:\x20','size','Usage:\x20journey\x20resume\x20<name-or-path>','cwd','parentSegment','execute','1043612aMnbpy','Resuming\x20journey...','sort','set','entered','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','connection','\x22\x20not\x20found','completed','activation_','segmentPushCommand','journeyBundleName','...','137160YNpJrP','journeyBundleId','Resolving\x20journey...','Show\x20journey\x20details','has','No\x20journeys\x20found','exited','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Resolved\x20YAML\x20file:\x20','folders','connector_config','\x20journey','isNew','journeyName','\x20journeys','buildIdToNameMap','getActivation','rootFolderId','diff','folderId','relativePath','getParentFull','find','state','\x20Opening\x20','verbose','push','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','stringify','resourceName','No\x20statistics\x20available\x20for\x20journey:\x20','stage','21366430HEwbRN','\x0aPull\x20summary:','then','✔\x20Pulled\x20','Getting\x20journey\x20statistics...','Input:\x20','localeCompare','journey','2845671anmvlZ','data','utf-8','Aborted.','getJourney','dryRun','Fetching\x20','\x20versions)','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','16VjtQeL','\x20\x20Parent\x20segment:\x20','7cIOYKw','length','Target\x20directory:\x20','\x20=\x20','\x20unchanged\x20files','journeyId','draft','/j/da','no_parent','totalGoalAchieved','folderPath','values','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','INVALID_ARGUMENT','2979864xWOPUt','web','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','site','\x20journey\x20files\x20to\x20','Options:','\x22\x20paused','Pattern:\x20','\x20files?','Cancelled','resolveParentId','Warning:\x20Stage\x20\x22','Listing\x20journeys...'];a18_0x3e81=function(){return _0x425403;};return a18_0x3e81();}function a18_0x156d(_0x330f54,_0x10df22){_0x330f54=_0x330f54-0xfa;const _0x3e81a4=a18_0x3e81();let _0x156d55=_0x3e81a4[_0x330f54];return _0x156d55;}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x2ebf8b){const _0xcbdf1f=a18_0x156d;switch(_0x2ebf8b){case _0xcbdf1f(0x1b1):return a18_0x27c2c4[_0xcbdf1f(0x190)]('(running)');case _0xcbdf1f(0x171):return a18_0x27c2c4[_0xcbdf1f(0x194)](_0xcbdf1f(0x113));case'paused':return a18_0x27c2c4['yellow'](_0xcbdf1f(0x1c6));case _0xcbdf1f(0x133):return a18_0x27c2c4['blue'](_0xcbdf1f(0x1b4));case'archived':return a18_0x27c2c4[_0xcbdf1f(0x194)]('(archived)');default:return'('+_0x2ebf8b+')';}}function formatJourneyItem(_0x11af53,_0x9d5ff7='',_0x1be75b){const _0x2b2cc4=a18_0x156d,_0x12d500=formatJourneyState(_0x11af53[_0x2b2cc4(0x14f)]),_0x2f5e3c=_0x1be75b?hyperlink(_0x11af53[_0x2b2cc4(0x136)],_0x1be75b):_0x11af53[_0x2b2cc4(0x136)];return _0x9d5ff7+_0x2b2cc4(0x198)+_0x2f5e3c+'\x20'+_0x12d500;}function escapeRegex(_0x3b06fd){const _0x2f26c0=a18_0x156d;return _0x3b06fd[_0x2f26c0(0x10e)](/[.*+?^${}()|[\]\\]/g,_0x2f26c0(0x1a7));}function globToRegex(_0x217342){const _0xfe2f31=a18_0x156d,_0x1cf2b9=_0x217342['split']('*')[_0xfe2f31(0x11b)](escapeRegex);return new RegExp(_0x1cf2b9['join']('.*'),'i');}function buildRuleToNameMapping(_0x4460d9){const _0x298ce2=a18_0x156d,_0x465807=new Map();if(_0x4460d9['segments'])for(const [_0x3db413,_0x569c0e]of Object['entries'](_0x4460d9[_0x298ce2(0x1a6)])){if(_0x569c0e[_0x298ce2(0x107)]){const _0x40cdb5=serializeRule(_0x569c0e['rule']),_0x5e6bf8=_0x465807[_0x298ce2(0x18b)](_0x40cdb5);_0x5e6bf8?_0x5e6bf8['push'](_0x3db413):_0x465807['set'](_0x40cdb5,[_0x3db413]);}}return _0x465807;}async function resolveJourneyTarget(_0x300a79,_0x3fc64d,_0x242d65){const _0x16c3b3=a18_0x156d;if(isYamlFilePath(_0x300a79))try{const _0x319d83=await resolveYamlFilePath(_0x300a79);return _0x242d65&&(console['error'](_0x16c3b3(0x140)+_0x300a79),console[_0x16c3b3(0x116)](_0x16c3b3(0x16a)+_0x319d83[_0x16c3b3(0x128)]),console[_0x16c3b3(0x116)](_0x16c3b3(0x1af)+_0x319d83[_0x16c3b3(0x1ac)]),console['error'](_0x16c3b3(0x124)+(_0x319d83[_0x16c3b3(0x175)]||_0x16c3b3(0x106)))),{'journeyName':_0x319d83['segmentName'],'parentSegment':_0x319d83[_0x16c3b3(0x128)],'resolved':_0x319d83};}catch(_0x13ac4e){throw new SDKError(ErrorCode[_0x16c3b3(0x178)],_0x16c3b3(0x1a0)+_0x13ac4e[_0x16c3b3(0x18d)]);}if(!_0x3fc64d)throw new SDKError(ErrorCode[_0x16c3b3(0x178)],_0x16c3b3(0x1a2));return{'journeyName':_0x300a79,'parentSegment':_0x3fc64d};}export class JourneyListCommand extends BaseCommand{[a18_0x1cfbec(0x191)]='journey:list';['description']='List\x20journeys\x20in\x20current\x20context';async[a18_0x1cfbec(0x129)](_0x2913c5){const _0x4d4c8e=a18_0x1cfbec,{options:_0xe73969,args:_0x2cf603,tdx:_0x4993e8}=_0x2913c5,_0x3b41df=_0x2cf603[0x0],_0x475927=_0xe73969[_0x4d4c8e(0x128)];if(!_0x475927)return console['error'](_0x4d4c8e(0x199)),console[_0x4d4c8e(0x116)](_0x4d4c8e(0x13f)),0x1;const _0x550af0=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x4993e8[_0x4d4c8e(0x1a5)]['resolveParentId'](_0x475927),{'verbose':_0xe73969[_0x4d4c8e(0x151)]}),_0x2a02cc=_0x550af0[_0x4d4c8e(0x161)];_0xe73969['verbose']&&(console[_0x4d4c8e(0x116)](_0x4d4c8e(0x1b9)+_0x475927+_0x4d4c8e(0x19c)+_0x2a02cc+')'),_0x3b41df&&console[_0x4d4c8e(0x116)](_0x4d4c8e(0x180)+_0x3b41df));const _0x487245=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x4993e8['segment'][_0x4d4c8e(0x14d)](_0x2a02cc),{'verbose':_0xe73969[_0x4d4c8e(0x151)]}),_0x564e89=_0x487245[_0x4d4c8e(0x161)],_0x41ca93=_0x564e89[_0x4d4c8e(0x149)],_0x52f123=await withSpinner(_0x4d4c8e(0x185),()=>_0x4993e8[_0x4d4c8e(0x15f)]['listJourneysWithFolders'](_0x2a02cc,_0x41ca93),{'verbose':_0xe73969['verbose']});let _0x25ec5c=_0x52f123[_0x4d4c8e(0x161)][_0x4d4c8e(0x193)];const _0x52cf3d=_0x52f123[_0x4d4c8e(0x161)][_0x4d4c8e(0x141)],_0x24a9de=new Map();for(const _0x368513 of _0x52cf3d){_0x24a9de[_0x4d4c8e(0x12d)](_0x368513['id'],_0x368513[_0x4d4c8e(0x191)]);}if(_0x3b41df){const _0x26fec9=globToRegex(_0x3b41df);_0x25ec5c=_0x25ec5c[_0x4d4c8e(0x1a8)](_0x1d98a7=>_0x26fec9['test'](_0x1d98a7[_0x4d4c8e(0x136)]));}console[_0x4d4c8e(0x116)]('✔\x20Found\x20'+_0x25ec5c[_0x4d4c8e(0x16c)]+_0x4d4c8e(0x143)+(_0x25ec5c['length']!==0x1?'s':''));const _0x11a575=_0x42f026=>{const _0x2a2a2d=_0x4d4c8e;return getConsoleNextUrl(_0xe73969[_0x2a2a2d(0x17c)],_0x2a2a2d(0x1bc)+_0x2a02cc+_0x2a2a2d(0x197)+_0x42f026+_0x2a2a2d(0x172));};if(_0xe73969[_0x4d4c8e(0x11f)]===_0x4d4c8e(0x1c1))await handleSDKOutput(_0x25ec5c,_0xe73969);else{if(_0xe73969['format']==='json'){const _0x35ccb2=_0x25ec5c['map'](_0x193308=>({..._0x193308,'url':_0x11a575(_0x193308['id'])}));await handleSDKOutput(_0x35ccb2,_0xe73969);}else{console[_0x4d4c8e(0xff)]('['+_0x475927+']');const _0x2659d9=new Map(),_0x433677=[];for(const _0x4eedd0 of _0x25ec5c){if(!_0x4eedd0[_0x4d4c8e(0x14b)]||_0x4eedd0['folderId']===_0x41ca93)_0x433677[_0x4d4c8e(0x152)](_0x4eedd0);else{const _0xb633af=_0x2659d9[_0x4d4c8e(0x18b)](_0x4eedd0[_0x4d4c8e(0x14b)])||[];_0xb633af[_0x4d4c8e(0x152)](_0x4eedd0),_0x2659d9['set'](_0x4eedd0['folderId'],_0xb633af);}}const _0x54fbc1=(_0x5053d6,_0x2bbf96)=>_0x5053d6['journeyBundleName'][_0x4d4c8e(0x15e)](_0x2bbf96[_0x4d4c8e(0x136)],undefined,{'sensitivity':'base'});_0x433677[_0x4d4c8e(0x12c)](_0x54fbc1);for(const _0x53a3c1 of _0x433677){console[_0x4d4c8e(0xff)](formatJourneyItem(_0x53a3c1,'',_0x11a575(_0x53a3c1['id'])));}const _0x1aa26d=[..._0x2659d9['entries']()][_0x4d4c8e(0x12c)]((_0x82842c,_0x1093c1)=>{const _0x417256=_0x4d4c8e,_0x3270e2=_0x24a9de[_0x417256(0x18b)](_0x82842c[0x0])||_0x82842c[0x0],_0x374cf6=_0x24a9de[_0x417256(0x18b)](_0x1093c1[0x0])||_0x1093c1[0x0];return _0x3270e2[_0x417256(0x15e)](_0x374cf6,undefined,{'sensitivity':_0x417256(0x1b7)});});for(const [_0x4c1281,_0x165f05]of _0x1aa26d){const _0x215e17=_0x24a9de[_0x4d4c8e(0x18b)](_0x4c1281)||_0x4c1281;console[_0x4d4c8e(0xff)](_0x4d4c8e(0x1be)+_0x215e17),_0x165f05['sort'](_0x54fbc1);for(const _0x2edb6c of _0x165f05){console[_0x4d4c8e(0xff)](formatJourneyItem(_0x2edb6c,'\x20\x20',_0x11a575(_0x2edb6c['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1cb);[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x13b);async[a18_0x1cfbec(0x129)](_0x5d66cb){const _0x4118ca=a18_0x1cfbec,{options:_0x6f70f7,args:_0x198b7c,tdx:_0x2eb4ca}=_0x5d66cb,_0x25f372=_0x198b7c[0x0];if(!_0x25f372)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x4118ca(0x116)](_0x4118ca(0x11e)),console[_0x4118ca(0x116)](_0x4118ca(0x17e)),console[_0x4118ca(0x116)](_0x4118ca(0x153)),0x1;_0x6f70f7[_0x4118ca(0x151)]&&console[_0x4118ca(0x116)](_0x4118ca(0x15d)+_0x25f372);const _0x182c8f=await resolveJourneyTarget(_0x25f372,_0x6f70f7[_0x4118ca(0x128)],_0x6f70f7['verbose']),_0x378579=await withSpinner(_0x4118ca(0x111),()=>_0x2eb4ca[_0x4118ca(0x1a5)][_0x4118ca(0x183)](_0x182c8f[_0x4118ca(0x128)]),{'verbose':_0x6f70f7[_0x4118ca(0x151)]}),_0x237af1=_0x378579[_0x4118ca(0x161)],_0xcf191c=await withSpinner('Resolving\x20journey...',()=>_0x2eb4ca[_0x4118ca(0x15f)][_0x4118ca(0x1c2)](_0x237af1,_0x182c8f['journeyName']),{'verbose':_0x6f70f7[_0x4118ca(0x151)]}),_0x2eff47=_0xcf191c[_0x4118ca(0x161)];if(_0x6f70f7[_0x4118ca(0x17a)]){const _0x4b6712=getConsoleNextUrl(_0x6f70f7[_0x4118ca(0x17c)],'/app/ps/'+_0x237af1+_0x4118ca(0x197)+_0x2eff47+_0x4118ca(0x1a1));return console[_0x4118ca(0x116)](a18_0x27c2c4[_0x4118ca(0x190)]('✔')+_0x4118ca(0x150)+a18_0x27c2c4[_0x4118ca(0x1c7)](_0x4b6712)),openBrowser(_0x4b6712),0x0;}const _0x92af4a=await withSpinner(_0x4118ca(0x1b6),()=>_0x2eb4ca['journey'][_0x4118ca(0x164)](_0x2eff47),{'verbose':_0x6f70f7[_0x4118ca(0x151)]}),_0x1c0c83=_0x92af4a[_0x4118ca(0x161)],_0x579351=_0x6f70f7[_0x4118ca(0x1ad)];let _0x16534c;if(_0x579351)try{const _0x29f6bb=await withSpinner(_0x4118ca(0x15c),()=>_0x2eb4ca[_0x4118ca(0x15f)]['getStatistics'](_0x2eff47),{'verbose':_0x6f70f7[_0x4118ca(0x151)]});_0x16534c=_0x29f6bb[_0x4118ca(0x161)];}catch{_0x6f70f7[_0x4118ca(0x151)]&&console[_0x4118ca(0x116)]('\x20\x20Statistics\x20not\x20available');}const _0x587620=getConsoleNextUrl(_0x6f70f7[_0x4118ca(0x17c)],_0x4118ca(0x1bc)+_0x237af1+_0x4118ca(0x197)+_0x2eff47+_0x4118ca(0x1a1)),_0x192192={'id':_0x1c0c83['id'],'name':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x191)],'description':_0x1c0c83[_0x4118ca(0x10a)]['description'],'state':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x14f)],'paused':_0x1c0c83[_0x4118ca(0x10a)]['paused'],'reentry_mode':_0x1c0c83[_0x4118ca(0x10a)]['reentryMode'],'stages':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x18a)]?.[_0x4118ca(0x16c)]||0x0,..._0x1c0c83['attributes'][_0x4118ca(0x192)]&&{'goal':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x192)]['name']},..._0x16534c&&{'statistics':{'total_entered':_0x16534c[_0x4118ca(0x1ab)],'goal_achieved':_0x16534c[_0x4118ca(0x174)],'goal_rate':_0x16534c[_0x4118ca(0x1c0)],'stages':_0x16534c['stages']}},'url':_0x587620};return await handleSingleObjectOutput(_0x192192,_0x6f70f7),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x1cfbec(0x191)]='journey:stats';[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x1c5);async[a18_0x1cfbec(0x129)](_0x2184bf){const _0x43cdbd=a18_0x1cfbec,{options:_0x3ee2c7,args:_0x12b42a,tdx:_0x49c2cf}=_0x2184bf,_0x3fc784=_0x12b42a[0x0];if(!_0x3fc784)return console[_0x43cdbd(0x116)](_0x43cdbd(0x17b)),console[_0x43cdbd(0x116)]('Usage:\x20journey\x20stats\x20<name-or-path>'),0x1;_0x3ee2c7[_0x43cdbd(0x151)]&&console[_0x43cdbd(0x116)](_0x43cdbd(0x15d)+_0x3fc784);const _0x5aa72c=await resolveJourneyTarget(_0x3fc784,_0x3ee2c7['parentSegment'],_0x3ee2c7[_0x43cdbd(0x151)]),_0x55ed49=await withSpinner(_0x43cdbd(0x111),()=>_0x49c2cf[_0x43cdbd(0x1a5)]['resolveParentId'](_0x5aa72c['parentSegment']),{'verbose':_0x3ee2c7['verbose']}),_0x1b3e45=_0x55ed49[_0x43cdbd(0x161)],_0x1034a5=await withSpinner('Resolving\x20journey...',()=>_0x49c2cf[_0x43cdbd(0x15f)][_0x43cdbd(0x1c2)](_0x1b3e45,_0x5aa72c[_0x43cdbd(0x145)]),{'verbose':_0x3ee2c7[_0x43cdbd(0x151)]}),_0x33e3dd=_0x1034a5['data'],_0x5ae09d=await withSpinner(_0x43cdbd(0x15c),()=>_0x49c2cf[_0x43cdbd(0x15f)][_0x43cdbd(0x19d)](_0x33e3dd),{'verbose':_0x3ee2c7[_0x43cdbd(0x151)]}),_0x165d98=_0x5ae09d['data'];if(!_0x165d98||_0x165d98[_0x43cdbd(0x170)]===null)return console[_0x43cdbd(0x116)](_0x43cdbd(0x156)+_0x5aa72c[_0x43cdbd(0x145)]),console[_0x43cdbd(0x116)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x53d8dc={'journey_id':_0x165d98[_0x43cdbd(0x170)],'total_entered':_0x165d98[_0x43cdbd(0x1ab)],'goal_achieved':_0x165d98['totalGoalAchieved'],'goal_rate':_0x165d98[_0x43cdbd(0x1c0)],'stages':_0x165d98[_0x43cdbd(0x10b)]?.[_0x43cdbd(0x11b)](_0x54184c=>({'name':_0x54184c[_0x43cdbd(0x1ba)],'population':_0x54184c[_0x43cdbd(0x19e)],'entered':_0x54184c[_0x43cdbd(0x12e)],'exited':_0x54184c[_0x43cdbd(0x13e)],'conversion_rate':_0x54184c[_0x43cdbd(0x1aa)]}))},_0x31ad23=_0x3ee2c7[_0x43cdbd(0x157)];if(_0x31ad23&&_0x165d98[_0x43cdbd(0x10b)]){const _0x224662=_0x165d98[_0x43cdbd(0x10b)][_0x43cdbd(0x14e)](_0x1fe854=>_0x1fe854[_0x43cdbd(0x1ba)][_0x43cdbd(0x102)]()===_0x31ad23['toLowerCase']());if(_0x224662)return await handleSingleObjectOutput({'stage_name':_0x224662['stageName'],'population':_0x224662['population'],'entered':_0x224662['entered'],'exited':_0x224662[_0x43cdbd(0x13e)],'conversion_rate':_0x224662[_0x43cdbd(0x1aa)]},_0x3ee2c7),0x0;console[_0x43cdbd(0x116)](_0x43cdbd(0x184)+_0x31ad23+_0x43cdbd(0x132));}return await handleSingleObjectOutput(_0x53d8dc,_0x3ee2c7),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1c8);[a18_0x1cfbec(0x1b8)]='Pause\x20a\x20running\x20journey';async[a18_0x1cfbec(0x129)](_0x57f208){const _0x3ade21=a18_0x1cfbec,{options:_0x3d0054,args:_0x3ebd1a,tdx:_0x1b59bb}=_0x57f208,_0x2ff980=_0x3ebd1a[0x0];if(!_0x2ff980)return console['error'](_0x3ade21(0x17b)),console[_0x3ade21(0x116)](_0x3ade21(0x1b2)),0x1;_0x3d0054[_0x3ade21(0x151)]&&console[_0x3ade21(0x116)](_0x3ade21(0x15d)+_0x2ff980);const _0x15c16d=await resolveJourneyTarget(_0x2ff980,_0x3d0054[_0x3ade21(0x128)],_0x3d0054[_0x3ade21(0x151)]),_0x2272e1=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x1b59bb['segment'][_0x3ade21(0x183)](_0x15c16d[_0x3ade21(0x128)]),{'verbose':_0x3d0054[_0x3ade21(0x151)]}),_0x29bd9f=_0x2272e1[_0x3ade21(0x161)],_0x36bd92=await withSpinner(_0x3ade21(0x13a),()=>_0x1b59bb[_0x3ade21(0x15f)]['resolveJourneyId'](_0x29bd9f,_0x15c16d[_0x3ade21(0x145)]),{'verbose':_0x3d0054[_0x3ade21(0x151)]}),_0x38dfcf=_0x36bd92[_0x3ade21(0x161)];if(!_0x3d0054[_0x3ade21(0x122)]){const _0x287e67=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x15c16d[_0x3ade21(0x145)]+'\x22?');if(!_0x287e67)return console[_0x3ade21(0x116)](_0x3ade21(0x182)),0x0;}const _0x170653=await withSpinner('Pausing\x20journey...',()=>_0x1b59bb[_0x3ade21(0x15f)]['pause'](_0x38dfcf),{'verbose':_0x3d0054['verbose']}),_0x120ce3=_0x170653[_0x3ade21(0x161)];return console[_0x3ade21(0x116)](_0x3ade21(0xfe)+_0x120ce3[_0x3ade21(0x10a)][_0x3ade21(0x191)]+_0x3ade21(0x17f)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1b3);[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x121);async['execute'](_0x261851){const _0x591ec1=a18_0x1cfbec,{options:_0x18dac9,args:_0x274847,tdx:_0x1694c2}=_0x261851,_0x417bb6=_0x274847[0x0];if(!_0x417bb6)return console['error'](_0x591ec1(0x17b)),console[_0x591ec1(0x116)](_0x591ec1(0x126)),0x1;_0x18dac9['verbose']&&console['error'](_0x591ec1(0x15d)+_0x417bb6);const _0x491a7b=await resolveJourneyTarget(_0x417bb6,_0x18dac9[_0x591ec1(0x128)],_0x18dac9[_0x591ec1(0x151)]),_0x4c2071=await withSpinner(_0x591ec1(0x111),()=>_0x1694c2[_0x591ec1(0x1a5)][_0x591ec1(0x183)](_0x491a7b[_0x591ec1(0x128)]),{'verbose':_0x18dac9[_0x591ec1(0x151)]}),_0xdccdb4=_0x4c2071[_0x591ec1(0x161)],_0x159bf6=await withSpinner(_0x591ec1(0x13a),()=>_0x1694c2[_0x591ec1(0x15f)][_0x591ec1(0x1c2)](_0xdccdb4,_0x491a7b[_0x591ec1(0x145)]),{'verbose':_0x18dac9[_0x591ec1(0x151)]}),_0x4b84df=_0x159bf6[_0x591ec1(0x161)];if(!_0x18dac9['yes']){const _0x27848c=await confirm(_0x591ec1(0x168)+_0x491a7b[_0x591ec1(0x145)]+'\x22?');if(!_0x27848c)return console[_0x591ec1(0x116)](_0x591ec1(0x182)),0x0;}const _0x3cad25=await withSpinner(_0x591ec1(0x12b),()=>_0x1694c2[_0x591ec1(0x15f)]['resume'](_0x4b84df),{'verbose':_0x18dac9[_0x591ec1(0x151)]}),_0x25cc4d=_0x3cad25[_0x591ec1(0x161)];return console['error'](_0x591ec1(0xfe)+_0x25cc4d['attributes'][_0x591ec1(0x191)]+_0x591ec1(0x1b0)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1b5);[a18_0x1cfbec(0x1b8)]='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0x9bdae3){const _0x4e31cc=a18_0x1cfbec,{options:_0x348f0b,args:_0x691102,tdx:_0x554606}=_0x9bdae3,_0x232ec8=_0x348f0b,_0x1c38ee=_0x691102[0x0],_0x198475=_0x1c38ee&&isYamlFilePath(_0x1c38ee),_0x3d1953=await resolveTarget({'arg':_0x198475?_0x1c38ee:undefined,'contextParent':_0x348f0b['parentSegment'],'cwd':process[_0x4e31cc(0x127)]()});if(!isSuccessfulResolution(_0x3d1953))return _0x3d1953['errorCode']===_0x4e31cc(0x173)?(console[_0x4e31cc(0x116)](a18_0x27c2c4[_0x4e31cc(0x103)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x4e31cc(0x116)](_0x4e31cc(0x114)),console[_0x4e31cc(0x116)](_0x4e31cc(0x130)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x4e31cc(0x116)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console['error'](a18_0x27c2c4[_0x4e31cc(0x10d)](_0x4e31cc(0x11d)+_0x3d1953[_0x4e31cc(0x18d)]+'\x0a')),_0x3d1953[_0x4e31cc(0x1a3)]&&console[_0x4e31cc(0x116)](a18_0x27c2c4[_0x4e31cc(0x1c7)](_0x3d1953[_0x4e31cc(0x1a3)]))),0x1;let _0x2dcb13=_0x198475?undefined:_0x1c38ee,_0x5ec722,_0x5aa558;_0x3d1953[_0x4e31cc(0x1a9)]===_0x4e31cc(0x118)&&(_0x2dcb13=_0x3d1953[_0x4e31cc(0x155)],_0x5ec722=_0x3d1953[_0x4e31cc(0x195)],_0x5aa558=_0x3d1953[_0x4e31cc(0x175)]);const _0x1b7161=_0x3d1953[_0x4e31cc(0x110)],_0x43a17b=_0x3d1953['targetDir'];_0x232ec8[_0x4e31cc(0x151)]&&(console[_0x4e31cc(0x116)](_0x4e31cc(0x1b9)+_0x1b7161),console[_0x4e31cc(0x116)](_0x4e31cc(0x16d)+_0x43a17b),_0x2dcb13&&console['error']('Journey\x20name:\x20'+_0x2dcb13),_0x5ec722&&console[_0x4e31cc(0x116)](_0x4e31cc(0x18e)+_0x5ec722),_0x5aa558&&console[_0x4e31cc(0x116)](_0x4e31cc(0x196)+_0x5aa558));const _0x2c80aa=await withSpinner(_0x4e31cc(0x111),()=>_0x554606[_0x4e31cc(0x1a5)][_0x4e31cc(0x183)](_0x1b7161),{'verbose':_0x348f0b[_0x4e31cc(0x151)]}),_0x18ac43=_0x2c80aa[_0x4e31cc(0x161)],[_0x4c8091,_0x4542b5]=await Promise['all']([withSpinner(_0x4e31cc(0x185),()=>_0x554606[_0x4e31cc(0x15f)]['listJourneysFromParentSegment'](_0x18ac43,undefined,{'includeAllVersions':!![]}),{'verbose':_0x348f0b[_0x4e31cc(0x151)]}),withSpinner(_0x4e31cc(0x1c9),()=>_0x554606['segment']['listFolders'](_0x18ac43),{'verbose':_0x348f0b['verbose']})]);let _0x2a1ac9=_0x4c8091[_0x4e31cc(0x161)];const _0x116fd4=_0x4542b5['data'],_0x1506d6=buildFolderIdToPathMap(_0x116fd4);if(_0x2dcb13){const _0x3767b5=_0x2a1ac9[_0x4e31cc(0x1a8)](_0x256c85=>_0x256c85[_0x4e31cc(0x136)][_0x4e31cc(0x102)]()===_0x2dcb13[_0x4e31cc(0x102)]());if(_0x3767b5[_0x4e31cc(0x16c)]===0x0)return console[_0x4e31cc(0x116)]('Error:\x20Journey\x20not\x20found:\x20'+_0x2dcb13),console[_0x4e31cc(0x116)](_0x4e31cc(0x12f)),0x1;_0x2a1ac9=_0x3767b5;}if(_0x5aa558!==undefined){const _0x3a091e=_0x2a1ac9[_0x4e31cc(0x1a8)](_0x241376=>{const _0x5651ea=_0x4e31cc,_0x50baba=_0x241376[_0x5651ea(0x14b)]?_0x1506d6[_0x5651ea(0x18b)](_0x241376[_0x5651ea(0x14b)])||'':'';return _0x50baba===_0x5aa558;});if(_0x3a091e[_0x4e31cc(0x16c)]===0x0&&_0x2a1ac9[_0x4e31cc(0x16c)]>0x0){console[_0x4e31cc(0x116)]('Error:\x20Journey\x20\x27'+_0x2dcb13+_0x4e31cc(0x10f)+(_0x5aa558||'root\x20folder')),console['error'](_0x4e31cc(0x177));for(const _0x20a900 of _0x2a1ac9){const _0x580605=_0x20a900[_0x4e31cc(0x14b)]?_0x1506d6['get'](_0x20a900[_0x4e31cc(0x14b)])||'':'';console['error'](_0x4e31cc(0x109)+(_0x580605||'(root)')+'/'+_0x20a900['journeyBundleName']);}return 0x1;}_0x2a1ac9=_0x3a091e;}if(_0x2a1ac9['length']===0x0)return console[_0x4e31cc(0x116)](_0x4e31cc(0x13d)),0x0;const _0x121bd9=new Map();for(const _0x564400 of _0x2a1ac9){const _0x216c0d=_0x564400[_0x4e31cc(0x139)];!_0x121bd9[_0x4e31cc(0x13c)](_0x216c0d)&&_0x121bd9[_0x4e31cc(0x12d)](_0x216c0d,[]),_0x121bd9['get'](_0x216c0d)[_0x4e31cc(0x152)](_0x564400);}for(const _0x5777d6 of _0x121bd9[_0x4e31cc(0x176)]()){_0x5777d6['sort']((_0x10f5c9,_0x1a3f24)=>(_0x10f5c9[_0x4e31cc(0x104)]||0x0)-(_0x1a3f24[_0x4e31cc(0x104)]||0x0));}const _0x5f56ec=[],[_0x21c1e2,_0x484ec7]=await Promise[_0x4e31cc(0x1ca)]([withSpinner(_0x4e31cc(0x1bd),()=>_0x554606['user'][_0x4e31cc(0x100)](),{'verbose':_0x348f0b['verbose']})[_0x4e31cc(0x15a)](_0x4a09d5=>_0x4a09d5['data']),withSpinner(_0x4e31cc(0xfa),()=>_0x554606['connection'][_0x4e31cc(0x147)](),{'verbose':_0x348f0b[_0x4e31cc(0x151)]})[_0x4e31cc(0x15a)](_0x34977e=>_0x34977e[_0x4e31cc(0x161)])]);for(const _0x497d63 of _0x121bd9['values']()){const _0x354440=_0x497d63[0x0]['journeyBundleName'],_0x3bdfee=_0x497d63[0x0][_0x4e31cc(0x14b)],_0x5e1c8e=_0x3bdfee?_0x1506d6['get'](_0x3bdfee)||'':'',_0x4d2e76=_0x5e1c8e?a18_0x3bf54e['join'](_0x43a17b,_0x5e1c8e):_0x43a17b,_0x2d36d4=_0x5ec722||a18_0x3bf54e[_0x4e31cc(0x11c)](_0x4d2e76,sanitizeFileName(_0x354440)+'.yml');let _0x18c46a,_0x2ea9a2;if(existsSync(_0x2d36d4))try{const _0x337d55=readFileSync(_0x2d36d4,_0x4e31cc(0x162)),_0x26701c=parseYamlString(_0x337d55);_0x2ea9a2=_0x26701c,_0x18c46a=buildRuleToNameMapping(_0x26701c),_0x232ec8[_0x4e31cc(0x151)]&&_0x18c46a[_0x4e31cc(0x125)]>0x0&&console['error'](_0x4e31cc(0xfd)+_0x18c46a['size']+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x354440);}catch(_0x1ffc49){_0x232ec8['verbose']&&console[_0x4e31cc(0x116)](_0x4e31cc(0x186)+_0x1ffc49['message']);}const _0xfed585=[],_0x4bd5da=new Set(),_0x2965ec=new Map(),_0x1f0c96=new Map(),_0x4593d4=new Set(),_0xcb50dd=new Map(),_0x25e10c=new Map(),_0x979ef3=createJumpTargetCache();await withProgressSpinner(_0x4e31cc(0x166)+_0x354440+_0x4e31cc(0x137),async _0xf00f55=>{const _0x57287a=_0x4e31cc;for(const _0x2e1117 of _0x497d63){const _0x387a08=_0x497d63['length']>0x1?_0x2e1117['journeyBundleName']+'\x20v'+(_0x2e1117[_0x57287a(0x104)]||0x1):_0x2e1117[_0x57287a(0x136)];_0xf00f55[_0x57287a(0x101)]('Fetching\x20'+_0x387a08);const _0x36a618=await _0x554606[_0x57287a(0x15f)][_0x57287a(0x164)](_0x2e1117['id']),_0x4e4779=_0x36a618[_0x57287a(0x10a)]?.[_0x57287a(0x119)],_0x4dd827={'resolveSegment':async _0x4cdcf6=>{const _0x4d13f8=_0x57287a;if(!_0x4e4779)return{'name':_0x4cdcf6,'isJourneyLocal':![]};const _0x13dbd0=_0x2965ec['get'](_0x4cdcf6);if(_0x13dbd0)return _0x13dbd0;try{const _0x455da5=await _0x554606['segment'][_0x4d13f8(0x19a)](_0x4e4779,_0x4cdcf6),_0x1d1f6e=_0x455da5['kind']===SEGMENT_KIND_JOURNEY;let _0x143e5b,_0x346df1=_0x455da5[_0x4d13f8(0x191)];if(_0x1d1f6e&&_0x455da5[_0x4d13f8(0x107)]){const _0x3fd3e6=await segmentResponseToDef(_0x455da5,{'resolveSegmentName':async _0x429f6c=>{const _0x146424=_0x4d13f8,_0x2217d4=_0x2965ec[_0x146424(0x18b)](_0x429f6c);if(_0x2217d4)return _0x2217d4['name'];const _0x803d84=await _0x4dd827[_0x146424(0x19b)](_0x429f6c);return _0x803d84[_0x146424(0x191)];}}),_0x19b423=_0x3fd3e6['rule'];_0x143e5b={'description':_0x455da5[_0x4d13f8(0x1b8)],'rule':_0x19b423};const _0x5dcedf=serializeRule(_0x19b423),_0x16a0d0=_0x1f0c96[_0x4d13f8(0x18b)](_0x5dcedf);if(_0x16a0d0)_0x346df1=_0x16a0d0,_0x143e5b=undefined,_0x232ec8[_0x4d13f8(0x151)]&&console['error'](_0x4d13f8(0x189)+_0x455da5[_0x4d13f8(0x191)]+'\x20->\x20'+_0x16a0d0);else{let _0x5ca1d7=![];if(_0x18c46a){const _0x507b32=_0x18c46a[_0x4d13f8(0x18b)](_0x5dcedf);if(_0x507b32){const _0x1ba8fa=_0x507b32[_0x4d13f8(0x14e)](_0x5041c7=>!_0x4bd5da['has'](_0x5041c7));_0x1ba8fa&&(_0x346df1=_0x1ba8fa,_0x4bd5da['add'](_0x1ba8fa),_0x1f0c96[_0x4d13f8(0x12d)](_0x5dcedf,_0x1ba8fa),_0x5ca1d7=!![],_0x232ec8[_0x4d13f8(0x151)]&&console[_0x4d13f8(0x116)](_0x4d13f8(0x123)+_0x1ba8fa+_0x4d13f8(0xfc)));}}if(!_0x5ca1d7){const _0x213ed7=generateJourneyLocalName(_0x455da5[_0x4d13f8(0x191)]);_0x213ed7&&(_0x346df1=_0x213ed7);let _0x484221=_0x346df1,_0x195d9d=0x2;while(_0x4bd5da[_0x4d13f8(0x13c)](_0x484221)){_0x484221=_0x346df1+'_'+_0x195d9d,_0x195d9d++;}_0x4bd5da[_0x4d13f8(0x1c4)](_0x484221),_0x1f0c96['set'](_0x5dcedf,_0x484221),_0x346df1=_0x484221;}}}const _0x11b32b={'name':_0x346df1,'isJourneyLocal':_0x1d1f6e,'definition':_0x143e5b};return _0x2965ec[_0x4d13f8(0x12d)](_0x4cdcf6,_0x11b32b),_0x11b32b;}catch(_0x219836){return _0x348f0b[_0x4d13f8(0x151)]&&console[_0x4d13f8(0x116)](_0x4d13f8(0x18c)+_0x4cdcf6+':\x20'+_0x219836['message']),{'name':_0x4cdcf6,'isJourneyLocal':![]};}},'resolveActivation':async _0x463143=>{const _0xf7dccc=_0x57287a,_0x1a5a65=_0xcb50dd[_0xf7dccc(0x18b)](_0x463143);if(_0x1a5a65)return _0x1a5a65;try{const _0x42db14=await _0x554606[_0xf7dccc(0x15f)][_0xf7dccc(0x148)](_0x2e1117['id'],_0x463143),_0x256dc9=journeyActivationStepToYaml(_0x42db14,_0x21c1e2,_0x484ec7),_0x1446ad=JSON[_0xf7dccc(0x154)]({'name':_0x256dc9[_0xf7dccc(0x191)],'connection':_0x256dc9[_0xf7dccc(0x131)],'connector_config':_0x256dc9[_0xf7dccc(0x142)]}),_0x48d1cc=_0x25e10c[_0xf7dccc(0x18b)](_0x1446ad);if(_0x48d1cc){const _0x36a8cf={'name':_0x48d1cc,'isJourneyLocal':!![],'definition':_0x256dc9};return _0xcb50dd['set'](_0x463143,_0x36a8cf),_0x36a8cf;}const _0x48ff56=_0x42db14[_0xf7dccc(0x10a)][_0xf7dccc(0x1a4)][_0xf7dccc(0x191)]||_0x463143,_0x45ea67=sanitizeYamlKey(_0x48ff56)||_0xf7dccc(0x134)+_0x463143;let _0x5a067c=_0x45ea67,_0x3ee008=0x2;while(_0x4593d4['has'](_0x5a067c)){_0x5a067c=_0x45ea67+'_'+_0x3ee008,_0x3ee008++;}_0x4593d4['add'](_0x5a067c),_0x25e10c[_0xf7dccc(0x12d)](_0x1446ad,_0x5a067c);const _0x353f5b={'name':_0x5a067c,'isJourneyLocal':!![],'definition':_0x256dc9};return _0xcb50dd['set'](_0x463143,_0x353f5b),_0x353f5b;}catch(_0x15cf0a){return _0x348f0b[_0xf7dccc(0x151)]&&console[_0xf7dccc(0x116)](_0xf7dccc(0x187)+_0x463143+':\x20'+_0x15cf0a['message']),{'name':_0x463143,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x530756,_0x33973a)=>{const _0x5ea640=_0x57287a;return resolveJumpTarget(_0x530756,_0x33973a,_0x979ef3,_0xd0bce3=>_0x554606[_0x5ea640(0x15f)][_0x5ea640(0x164)](_0xd0bce3));}},_0x3ebdfd=await journeyResponseToDef(_0x36a618,_0x4dd827);_0xfed585[_0x57287a(0x152)]({'item':_0x2e1117,'yaml':_0x3ebdfd});}},{'verbose':_0x348f0b[_0x4e31cc(0x151)]});const _0x4ecf1d=buildMergedJourneyDef(_0xfed585,_0x18c46a),_0x24e510=normalizeJourneyDef(_0x4ecf1d,_0x2ea9a2),_0x1c06bf=toYamlString(_0x24e510),_0x5e3e92=_0x5ec722||a18_0x3bf54e[_0x4e31cc(0x11c)](_0x4d2e76,sanitizeFileName(_0x354440)+'.yml');!_0x5ec722&&_0x5e1c8e&&!existsSync(_0x4d2e76)&&mkdirSync(_0x4d2e76,{'recursive':!![]});const _0x1e0dbc=a18_0x3bf54e[_0x4e31cc(0x112)](process[_0x4e31cc(0x127)](),_0x5e3e92);if(existsSync(_0x5e3e92)){const _0x54cfdc=readFileSync(_0x5e3e92,_0x4e31cc(0x162)),_0x16ff4e=generateDiff(_0x54cfdc,_0x1c06bf),_0x250c23=hasChanges(_0x16ff4e);_0x5f56ec[_0x4e31cc(0x152)]({'relativePath':_0x1e0dbc,'absolutePath':_0x5e3e92,'content':_0x1c06bf,'isNew':![],'hasChanges':_0x250c23,'diff':_0x250c23?formatDiffWithColors(_0x16ff4e):undefined});}else _0x5f56ec['push']({'relativePath':_0x1e0dbc,'absolutePath':_0x5e3e92,'content':_0x1c06bf,'isNew':!![],'hasChanges':![]});}const _0xb5e510=_0x5f56ec[_0x4e31cc(0x1a8)](_0x8a502f=>_0x8a502f[_0x4e31cc(0x144)]),_0x496c51=_0x5f56ec[_0x4e31cc(0x1a8)](_0x1f7001=>!_0x1f7001[_0x4e31cc(0x144)]&&_0x1f7001[_0x4e31cc(0x108)]),_0x35eb33=_0x5f56ec[_0x4e31cc(0x1a8)](_0xf0f0c5=>!_0xf0f0c5[_0x4e31cc(0x144)]&&!_0xf0f0c5['hasChanges']),_0x2a295a=_0x2a1ac9[_0x4e31cc(0x16c)],_0x49be2e=_0x121bd9[_0x4e31cc(0x125)],_0x5e4e26=_0x2a295a>_0x49be2e?'\x20('+_0x2a295a+_0x4e31cc(0x167):'';console['error'](_0x4e31cc(0x159)),console['error']('\x20\x20'+a18_0x27c2c4['cyan'](_0x49be2e+_0x4e31cc(0x146))+a18_0x27c2c4[_0x4e31cc(0x194)](_0x5e4e26)),console[_0x4e31cc(0x116)]('\x20\x20'+a18_0x27c2c4[_0x4e31cc(0x190)]('+\x20'+_0xb5e510[_0x4e31cc(0x16c)]+_0x4e31cc(0x115))),console[_0x4e31cc(0x116)]('\x20\x20'+a18_0x27c2c4[_0x4e31cc(0x103)]('~\x20'+_0x496c51[_0x4e31cc(0x16c)]+'\x20changed\x20files')),console[_0x4e31cc(0x116)]('\x20\x20'+a18_0x27c2c4['dim']('=\x20'+_0x35eb33[_0x4e31cc(0x16c)]+_0x4e31cc(0x16f))),console[_0x4e31cc(0x116)](_0x4e31cc(0x1ae)+a18_0x27c2c4['cyan'](_0x43a17b)+'\x0a');if(_0x496c51[_0x4e31cc(0x16c)]>0x0)for(const _0x233a83 of _0x496c51){console[_0x4e31cc(0x116)]('\x0aChanges\x20to\x20\x27'+_0x233a83[_0x4e31cc(0x14c)]+'\x27:'),console[_0x4e31cc(0x116)]('─'[_0x4e31cc(0x18f)](0x3c)),console[_0x4e31cc(0x116)](_0x233a83[_0x4e31cc(0x14a)]),console['error']('─'[_0x4e31cc(0x18f)](0x3c));}if(_0x232ec8[_0x4e31cc(0x165)])return console[_0x4e31cc(0x116)](a18_0x27c2c4[_0x4e31cc(0x103)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0xb5e510[_0x4e31cc(0x16c)]===0x0&&_0x496c51[_0x4e31cc(0x16c)]===0x0)return console[_0x4e31cc(0x116)](a18_0x27c2c4['green'](_0x4e31cc(0x10c))),saveSessionContext({'parent_segment':_0x1b7161},_0x232ec8['session']),console['error'](a18_0x27c2c4[_0x4e31cc(0x190)](_0x4e31cc(0x1bf)+a18_0x27c2c4[_0x4e31cc(0x194)]('parent_segment')+_0x4e31cc(0x16e)+a18_0x27c2c4['cyan'](_0x1b7161))),0x0;if(!_0x232ec8[_0x4e31cc(0x122)]&&(_0xb5e510['length']>0x0||_0x496c51[_0x4e31cc(0x16c)]>0x0)){const _0x165773=await confirmKey(_0x4e31cc(0x117)+(_0xb5e510[_0x4e31cc(0x16c)]+_0x496c51[_0x4e31cc(0x16c)])+_0x4e31cc(0x181));if(!_0x165773)return console[_0x4e31cc(0x116)](_0x4e31cc(0x163)),0x1;}!existsSync(_0x43a17b)&&mkdirSync(_0x43a17b,{'recursive':!![]});for(const _0x273804 of _0x5f56ec){(_0x273804['isNew']||_0x273804[_0x4e31cc(0x108)])&&writeFileSync(_0x273804['absolutePath'],_0x273804[_0x4e31cc(0x11a)],_0x4e31cc(0x162));}return console[_0x4e31cc(0x116)](a18_0x27c2c4['green'](_0x4e31cc(0x15b)+(_0xb5e510['length']+_0x496c51['length'])+_0x4e31cc(0x17d)+_0x43a17b)),saveSessionContext({'parent_segment':_0x1b7161},_0x232ec8[_0x4e31cc(0xfb)]),console[_0x4e31cc(0x116)](a18_0x27c2c4['green']('✔\x20Context\x20set:\x20'+a18_0x27c2c4[_0x4e31cc(0x194)](_0x4e31cc(0x19f))+_0x4e31cc(0x16e)+a18_0x27c2c4[_0x4e31cc(0x1c7)](_0x1b7161))),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']=a18_0x1cfbec(0x1c3);[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x105);[a18_0x1cfbec(0x135)]=new SegmentPushCommand();async['execute'](_0x3b6f8f){const _0x127521=a18_0x1cfbec,_0x2b2a2c=_0x3b6f8f['args'][0x0];let _0x1050e5;if(_0x2b2a2c){const _0x56bb97=await resolveTarget({'arg':_0x2b2a2c,'contextParent':_0x3b6f8f['options']['parentSegment'],'cwd':process[_0x127521(0x127)]()});isSuccessfulResolution(_0x56bb97)&&_0x56bb97[_0x127521(0x1a9)]==='file'&&(_0x1050e5=_0x56bb97[_0x127521(0x195)]);}const _0x33f2ed={..._0x3b6f8f,'options':{..._0x3b6f8f['options'],'journeysOnly':!![],..._0x1050e5&&{'singleFilePath':_0x1050e5}}};return this[_0x127521(0x135)]['execute'](_0x33f2ed);}}
1
+ const a18_0x68f4c8=a18_0x3fb7;(function(_0x1e4fa7,_0x5a9cc7){const _0x5e2160=a18_0x3fb7,_0x178bc1=_0x1e4fa7();while(!![]){try{const _0x40898f=-parseInt(_0x5e2160(0x21e))/0x1*(-parseInt(_0x5e2160(0x216))/0x2)+parseInt(_0x5e2160(0x2a1))/0x3*(-parseInt(_0x5e2160(0x27a))/0x4)+-parseInt(_0x5e2160(0x21b))/0x5*(-parseInt(_0x5e2160(0x1cc))/0x6)+-parseInt(_0x5e2160(0x21a))/0x7*(-parseInt(_0x5e2160(0x1f5))/0x8)+parseInt(_0x5e2160(0x213))/0x9*(-parseInt(_0x5e2160(0x202))/0xa)+-parseInt(_0x5e2160(0x266))/0xb*(-parseInt(_0x5e2160(0x1f7))/0xc)+parseInt(_0x5e2160(0x241))/0xd*(-parseInt(_0x5e2160(0x27c))/0xe);if(_0x40898f===_0x5a9cc7)break;else _0x178bc1['push'](_0x178bc1['shift']());}catch(_0x1291fa){_0x178bc1['push'](_0x178bc1['shift']());}}}(a18_0x1561,0x6019e));import a18_0x41ef24 from'chalk';import a18_0x2de0b1 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';function a18_0x3fb7(_0x3cba52,_0x20e1e1){_0x3cba52=_0x3cba52-0x1c9;const _0x1561e4=a18_0x1561();let _0x3fb7af=_0x1561e4[_0x3cba52];return _0x3fb7af;}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x2de016){const _0x52ff54=a18_0x3fb7;switch(_0x2de016){case'launched':return a18_0x41ef24['green'](_0x52ff54(0x217));case _0x52ff54(0x26b):return a18_0x41ef24[_0x52ff54(0x1e8)](_0x52ff54(0x263));case'paused':return a18_0x41ef24[_0x52ff54(0x1f0)](_0x52ff54(0x27d));case _0x52ff54(0x221):return a18_0x41ef24[_0x52ff54(0x227)](_0x52ff54(0x201));case _0x52ff54(0x26f):return a18_0x41ef24[_0x52ff54(0x1e8)](_0x52ff54(0x254));default:return'('+_0x2de016+')';}}function formatJourneyItem(_0x358543,_0xd84633='',_0x4088a5){const _0x391ca6=a18_0x3fb7,_0x51928a=formatJourneyState(_0x358543[_0x391ca6(0x253)]),_0x53c90b=_0x4088a5?hyperlink(_0x358543['journeyBundleName'],_0x4088a5):_0x358543[_0x391ca6(0x28f)];return _0xd84633+'🗺️\x20'+_0x53c90b+'\x20'+_0x51928a;}function a18_0x1561(){const _0x4e7ce9=['.yml','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Show\x20journey\x20details','getParentFull','sort','journeyStages','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','Error:\x20','journey:pause','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','parentSegment','✔\x20All\x20files\x20are\x20up\x20to\x20date','web','journeyBundleName','size','\x20(rule\x20match)','Show\x20journey\x20statistics','Fetching\x20','Error:\x20Journey\x20\x27','verbose','population','audienceId','args','Folder\x20path:\x20','Getting\x20journey\x20statistics...','Options:','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','/e/','helpText','green','Fetching\x20parent\x20segment...','301761gdmkDr','targetDir','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','Warning:\x20Stage\x20\x22','\x20(ID:\x20','121692qCoQIb','\x20=\x20','Usage:\x20journey\x20resume\x20<name-or-path>','Resolving\x20journey...','parentName','Cancelled','folders','json','Pattern:\x20','cyan','red','Listing\x20folders...','\x22\x20resumed','filePath','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','then','test','getJourney','stages','cwd','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','utf-8','\x20files?','buildIdToNameMap','data','type','push','resolveSegment','dim','/app/ps/','all','journey:stats','description','pause','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','✔\x20Found\x20','yellow','length','activationParams','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20parent\x20segment...','4163608BVWfBA','attributes','2124YMxbzh','map','toLowerCase','📁\x20','No\x20journeys\x20found','absolutePath','Pause\x20a\x20running\x20journey','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','options','journeyBundleId','(completed)','40nVmTPO','stageName','\x20\x20-\x20','base','\x0aPull\x20summary:','journeyId','yes','Target\x20file:\x20','name','segments','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','listFolders','values','execute','goalRate','Resume\x20a\x20paused\x20journey','journey','832311uAZSGH','join','segment','2WhYDyE','(running)','✔\x20Journey\x20\x22','reentryMode','7CLDCpW','5mSVBte','✔\x20Context\x20set:\x20','diff','739693WmqaLM','segmentPushCommand','rule','completed','find','\x20\x20Target:\x20','listJourneysWithFolders','has','/j/da/je','blue','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','listJourneysFromParentSegment','connection','Fetching\x20connections\x20for\x20name\x20resolution...','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','add','split','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','exited','\x22\x20paused','\x20->\x20','Parent\x20segment:\x20','\x20\x20Name:\x20','repeat','hasChanges','Input:\x20','\x20\x20Preserving\x20local\x20segment\x20name:\x20','format','file','kind','getActivation','localeCompare','parent_segment','conversionRate','Listing\x20journeys...','2204527caGTeW','resolveJourneyId','Usage:\x20journey\x20stats\x20<name-or-path>','log','message','set','stage','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Getting\x20journey\x20details...','journey:resume','entered','Resolved\x20YAML\x20file:\x20','folderPath','\x20unchanged\x20files','Write\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','resume','No\x20statistics\x20available\x20for\x20journey:\x20','state','(archived)','buildIdToEmailMap','isNew','Warning:\x20Could\x20not\x20resolve\x20segment\x20','relative','content','connector_config','\x27\x20not\x20found\x20in\x20','totalGoalAchieved','site','resourceName','table','journeyName','get','Error:\x20Parent\x20segment\x20context\x20required','(draft)','error','totalEntered','3421txnHjj','journey:pull','includeStats','(root)','no_parent','draft','folderId','\x20Opening\x20','versionNumber','archived','\x5c$&','Usage:\x20journey\x20pause\x20<name-or-path>','resolveParentId','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','entries','session','INVALID_ARGUMENT','Aborted.','Error:\x20Journey\x20not\x20found:\x20','Fetching\x20users\x20for\x20email\x20resolution...','16dJAjbq','getStatistics','14nkLNrq','(paused)','...','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','dryRun','filter'];a18_0x1561=function(){return _0x4e7ce9;};return a18_0x1561();}function escapeRegex(_0x1456cc){const _0x1241b2=a18_0x3fb7;return _0x1456cc['replace'](/[.*+?^${}()|[\]\\]/g,_0x1241b2(0x270));}function globToRegex(_0x30eee8){const _0x5289d5=a18_0x3fb7,_0x27f12a=_0x30eee8[_0x5289d5(0x22e)]('*')[_0x5289d5(0x1f8)](escapeRegex);return new RegExp(_0x27f12a[_0x5289d5(0x214)]('.*'),'i');}function buildRuleToNameMapping(_0x19ebbf){const _0x408a84=a18_0x3fb7,_0xa235af=new Map();if(_0x19ebbf['segments'])for(const [_0x1259d6,_0x4dc7a1]of Object[_0x408a84(0x274)](_0x19ebbf[_0x408a84(0x20b)])){if(_0x4dc7a1[_0x408a84(0x220)]){const _0x4f2d27=serializeRule(_0x4dc7a1['rule']),_0x529ca2=_0xa235af[_0x408a84(0x261)](_0x4f2d27);_0x529ca2?_0x529ca2[_0x408a84(0x1e6)](_0x1259d6):_0xa235af['set'](_0x4f2d27,[_0x1259d6]);}}return _0xa235af;}async function resolveJourneyTarget(_0x177868,_0x1c59c0,_0x327f5b){const _0x100357=a18_0x3fb7;if(isYamlFilePath(_0x177868))try{const _0x44a9f9=await resolveYamlFilePath(_0x177868);return _0x327f5b&&(console[_0x100357(0x264)](_0x100357(0x24c)+_0x177868),console['error']('\x20\x20Parent\x20segment:\x20'+_0x44a9f9[_0x100357(0x28c)]),console[_0x100357(0x264)](_0x100357(0x234)+_0x44a9f9['segmentName']),console['error']('\x20\x20Folder\x20path:\x20'+(_0x44a9f9[_0x100357(0x24d)]||_0x100357(0x269)))),{'journeyName':_0x44a9f9['segmentName'],'parentSegment':_0x44a9f9[_0x100357(0x28c)],'resolved':_0x44a9f9};}catch(_0x6eb820){throw new SDKError(ErrorCode[_0x100357(0x276)],_0x100357(0x228)+_0x6eb820[_0x100357(0x245)]);}if(!_0x1c59c0)throw new SDKError(ErrorCode[_0x100357(0x276)],_0x100357(0x1f3));return{'journeyName':_0x177868,'parentSegment':_0x1c59c0};}export class JourneyListCommand extends BaseCommand{['name']='journey:list';[a18_0x68f4c8(0x1ec)]='List\x20journeys\x20in\x20current\x20context';async[a18_0x68f4c8(0x20f)](_0x4eb5a1){const _0x4bdc30=a18_0x68f4c8,{options:_0x47ad63,args:_0xa6e531,tdx:_0x24799e}=_0x4eb5a1,_0x19601d=_0xa6e531[0x0],_0x4aab56=_0x47ad63[_0x4bdc30(0x28c)];if(!_0x4aab56)return console[_0x4bdc30(0x264)](_0x4bdc30(0x262)),console['error']('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x57feaf=await withSpinner(_0x4bdc30(0x1f4),()=>_0x24799e[_0x4bdc30(0x215)][_0x4bdc30(0x272)](_0x4aab56),{'verbose':_0x47ad63['verbose']}),_0x1bcb95=_0x57feaf['data'];_0x47ad63[_0x4bdc30(0x295)]&&(console[_0x4bdc30(0x264)](_0x4bdc30(0x233)+_0x4aab56+_0x4bdc30(0x1cb)+_0x1bcb95+')'),_0x19601d&&console['error'](_0x4bdc30(0x1d4)+_0x19601d));const _0x4b6d11=await withSpinner(_0x4bdc30(0x2a0),()=>_0x24799e[_0x4bdc30(0x215)][_0x4bdc30(0x285)](_0x1bcb95),{'verbose':_0x47ad63[_0x4bdc30(0x295)]}),_0x509ce5=_0x4b6d11[_0x4bdc30(0x1e4)],_0x271cf8=_0x509ce5['rootFolderId'],_0x5796e2=await withSpinner(_0x4bdc30(0x240),()=>_0x24799e[_0x4bdc30(0x212)][_0x4bdc30(0x224)](_0x1bcb95,_0x271cf8),{'verbose':_0x47ad63[_0x4bdc30(0x295)]});let _0x45b64f=_0x5796e2['data']['journeys'];const _0x4939c9=_0x5796e2[_0x4bdc30(0x1e4)][_0x4bdc30(0x1d2)],_0x3dd29b=new Map();for(const _0x467125 of _0x4939c9){_0x3dd29b['set'](_0x467125['id'],_0x467125[_0x4bdc30(0x20a)]);}if(_0x19601d){const _0x27bb38=globToRegex(_0x19601d);_0x45b64f=_0x45b64f['filter'](_0x813925=>_0x27bb38[_0x4bdc30(0x1dc)](_0x813925[_0x4bdc30(0x28f)]));}console[_0x4bdc30(0x264)](_0x4bdc30(0x1ef)+_0x45b64f[_0x4bdc30(0x1f1)]+'\x20journey'+(_0x45b64f[_0x4bdc30(0x1f1)]!==0x1?'s':''));const _0x2561f3=_0x140ac8=>{const _0x31b776=_0x4bdc30;return getConsoleNextUrl(_0x47ad63[_0x31b776(0x25d)],'/app/ps/'+_0x1bcb95+_0x31b776(0x29d)+_0x140ac8+'/j/da');};if(_0x47ad63[_0x4bdc30(0x239)]===_0x4bdc30(0x25f))await handleSDKOutput(_0x45b64f,_0x47ad63);else{if(_0x47ad63[_0x4bdc30(0x239)]===_0x4bdc30(0x1d3)){const _0x5419a1=_0x45b64f[_0x4bdc30(0x1f8)](_0x5663ac=>({..._0x5663ac,'url':_0x2561f3(_0x5663ac['id'])}));await handleSDKOutput(_0x5419a1,_0x47ad63);}else{console[_0x4bdc30(0x244)]('['+_0x4aab56+']');const _0x21d946=new Map(),_0xf464d2=[];for(const _0x3043e2 of _0x45b64f){if(!_0x3043e2[_0x4bdc30(0x26c)]||_0x3043e2[_0x4bdc30(0x26c)]===_0x271cf8)_0xf464d2[_0x4bdc30(0x1e6)](_0x3043e2);else{const _0x23f752=_0x21d946[_0x4bdc30(0x261)](_0x3043e2[_0x4bdc30(0x26c)])||[];_0x23f752[_0x4bdc30(0x1e6)](_0x3043e2),_0x21d946[_0x4bdc30(0x246)](_0x3043e2['folderId'],_0x23f752);}}const _0x4351eb=(_0x1820df,_0x3118be)=>_0x1820df[_0x4bdc30(0x28f)][_0x4bdc30(0x23d)](_0x3118be[_0x4bdc30(0x28f)],undefined,{'sensitivity':'base'});_0xf464d2[_0x4bdc30(0x286)](_0x4351eb);for(const _0x54080a of _0xf464d2){console[_0x4bdc30(0x244)](formatJourneyItem(_0x54080a,'',_0x2561f3(_0x54080a['id'])));}const _0x23469a=[..._0x21d946[_0x4bdc30(0x274)]()][_0x4bdc30(0x286)]((_0x6fc0e6,_0x1ac53a)=>{const _0xd47a4f=_0x4bdc30,_0x25ed14=_0x3dd29b[_0xd47a4f(0x261)](_0x6fc0e6[0x0])||_0x6fc0e6[0x0],_0x4a69ce=_0x3dd29b['get'](_0x1ac53a[0x0])||_0x1ac53a[0x0];return _0x25ed14[_0xd47a4f(0x23d)](_0x4a69ce,undefined,{'sensitivity':_0xd47a4f(0x205)});});for(const [_0x596ae4,_0xe87cba]of _0x23469a){const _0x4350e8=_0x3dd29b[_0x4bdc30(0x261)](_0x596ae4)||_0x596ae4;console['log'](_0x4bdc30(0x1fa)+_0x4350e8),_0xe87cba['sort'](_0x4351eb);for(const _0x29d88e of _0xe87cba){console[_0x4bdc30(0x244)](formatJourneyItem(_0x29d88e,'\x20\x20',_0x2561f3(_0x29d88e['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']='journey:view';[a18_0x68f4c8(0x1ec)]=a18_0x68f4c8(0x284);async[a18_0x68f4c8(0x20f)](_0x48aee1){const _0x4cc3c7=a18_0x68f4c8,{options:_0x284575,args:_0x3b0716,tdx:_0x2c23ac}=_0x48aee1,_0x4a231d=_0x3b0716[0x0];if(!_0x4a231d)return console[_0x4cc3c7(0x264)](_0x4cc3c7(0x283)),console[_0x4cc3c7(0x264)](_0x4cc3c7(0x27f)),console[_0x4cc3c7(0x264)](_0x4cc3c7(0x29b)),console['error'](_0x4cc3c7(0x288)),0x1;_0x284575['verbose']&&console[_0x4cc3c7(0x264)]('Input:\x20'+_0x4a231d);const _0x1dc873=await resolveJourneyTarget(_0x4a231d,_0x284575[_0x4cc3c7(0x28c)],_0x284575['verbose']),_0x3324fa=await withSpinner(_0x4cc3c7(0x1f4),()=>_0x2c23ac['segment'][_0x4cc3c7(0x272)](_0x1dc873[_0x4cc3c7(0x28c)]),{'verbose':_0x284575['verbose']}),_0x58a786=_0x3324fa['data'],_0x5b773f=await withSpinner(_0x4cc3c7(0x1cf),()=>_0x2c23ac[_0x4cc3c7(0x212)][_0x4cc3c7(0x242)](_0x58a786,_0x1dc873[_0x4cc3c7(0x260)]),{'verbose':_0x284575[_0x4cc3c7(0x295)]}),_0x2b5959=_0x5b773f[_0x4cc3c7(0x1e4)];if(_0x284575[_0x4cc3c7(0x28e)]){const _0x5d3835=getConsoleNextUrl(_0x284575[_0x4cc3c7(0x25d)],_0x4cc3c7(0x1e9)+_0x58a786+_0x4cc3c7(0x29d)+_0x2b5959+_0x4cc3c7(0x226));return console['error'](a18_0x41ef24[_0x4cc3c7(0x29f)]('✔')+_0x4cc3c7(0x26d)+a18_0x41ef24[_0x4cc3c7(0x1d5)](_0x5d3835)),openBrowser(_0x5d3835),0x0;}const _0x4356e0=await withSpinner(_0x4cc3c7(0x249),()=>_0x2c23ac[_0x4cc3c7(0x212)][_0x4cc3c7(0x1dd)](_0x2b5959),{'verbose':_0x284575[_0x4cc3c7(0x295)]}),_0x477155=_0x4356e0[_0x4cc3c7(0x1e4)],_0x5e5ee1=_0x284575[_0x4cc3c7(0x268)];let _0x535ace;if(_0x5e5ee1)try{const _0x4cb87a=await withSpinner(_0x4cc3c7(0x29a),()=>_0x2c23ac[_0x4cc3c7(0x212)][_0x4cc3c7(0x27b)](_0x2b5959),{'verbose':_0x284575[_0x4cc3c7(0x295)]});_0x535ace=_0x4cb87a['data'];}catch{_0x284575[_0x4cc3c7(0x295)]&&console[_0x4cc3c7(0x264)]('\x20\x20Statistics\x20not\x20available');}const _0x275426=getConsoleNextUrl(_0x284575[_0x4cc3c7(0x25d)],_0x4cc3c7(0x1e9)+_0x58a786+_0x4cc3c7(0x29d)+_0x2b5959+_0x4cc3c7(0x226)),_0x444623={'id':_0x477155['id'],'name':_0x477155['attributes'][_0x4cc3c7(0x20a)],'description':_0x477155['attributes'][_0x4cc3c7(0x1ec)],'state':_0x477155['attributes'][_0x4cc3c7(0x253)],'paused':_0x477155[_0x4cc3c7(0x1f6)]['paused'],'reentry_mode':_0x477155[_0x4cc3c7(0x1f6)][_0x4cc3c7(0x219)],'stages':_0x477155[_0x4cc3c7(0x1f6)][_0x4cc3c7(0x287)]?.[_0x4cc3c7(0x1f1)]||0x0,..._0x477155[_0x4cc3c7(0x1f6)]['goal']&&{'goal':_0x477155[_0x4cc3c7(0x1f6)]['goal'][_0x4cc3c7(0x20a)]},..._0x535ace&&{'statistics':{'total_entered':_0x535ace[_0x4cc3c7(0x265)],'goal_achieved':_0x535ace[_0x4cc3c7(0x25c)],'goal_rate':_0x535ace[_0x4cc3c7(0x210)],'stages':_0x535ace[_0x4cc3c7(0x1de)]}},'url':_0x275426};return await handleSingleObjectOutput(_0x444623,_0x284575),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x68f4c8(0x20a)]=a18_0x68f4c8(0x1eb);['description']=a18_0x68f4c8(0x292);async[a18_0x68f4c8(0x20f)](_0x36e38d){const _0x1130f4=a18_0x68f4c8,{options:_0x52a672,args:_0x46f75f,tdx:_0x12402d}=_0x36e38d,_0x1cee03=_0x46f75f[0x0];if(!_0x1cee03)return console[_0x1130f4(0x264)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x1130f4(0x243)),0x1;_0x52a672[_0x1130f4(0x295)]&&console['error'](_0x1130f4(0x237)+_0x1cee03);const _0x38f76f=await resolveJourneyTarget(_0x1cee03,_0x52a672[_0x1130f4(0x28c)],_0x52a672[_0x1130f4(0x295)]),_0x1d1187=await withSpinner(_0x1130f4(0x1f4),()=>_0x12402d[_0x1130f4(0x215)][_0x1130f4(0x272)](_0x38f76f[_0x1130f4(0x28c)]),{'verbose':_0x52a672['verbose']}),_0x38ef1c=_0x1d1187[_0x1130f4(0x1e4)],_0x5303f8=await withSpinner(_0x1130f4(0x1cf),()=>_0x12402d[_0x1130f4(0x212)]['resolveJourneyId'](_0x38ef1c,_0x38f76f['journeyName']),{'verbose':_0x52a672[_0x1130f4(0x295)]}),_0x236d41=_0x5303f8[_0x1130f4(0x1e4)],_0x5541fe=await withSpinner(_0x1130f4(0x29a),()=>_0x12402d[_0x1130f4(0x212)][_0x1130f4(0x27b)](_0x236d41),{'verbose':_0x52a672[_0x1130f4(0x295)]}),_0x181ead=_0x5541fe[_0x1130f4(0x1e4)];if(!_0x181ead||_0x181ead[_0x1130f4(0x207)]===null)return console[_0x1130f4(0x264)](_0x1130f4(0x252)+_0x38f76f[_0x1130f4(0x260)]),console[_0x1130f4(0x264)](_0x1130f4(0x1fe)),0x0;const _0x581413={'journey_id':_0x181ead[_0x1130f4(0x207)],'total_entered':_0x181ead[_0x1130f4(0x265)],'goal_achieved':_0x181ead[_0x1130f4(0x25c)],'goal_rate':_0x181ead[_0x1130f4(0x210)],'stages':_0x181ead[_0x1130f4(0x1de)]?.[_0x1130f4(0x1f8)](_0x13093e=>({'name':_0x13093e[_0x1130f4(0x203)],'population':_0x13093e[_0x1130f4(0x296)],'entered':_0x13093e[_0x1130f4(0x24b)],'exited':_0x13093e[_0x1130f4(0x230)],'conversion_rate':_0x13093e['conversionRate']}))},_0x2502e8=_0x52a672[_0x1130f4(0x247)];if(_0x2502e8&&_0x181ead[_0x1130f4(0x1de)]){const _0x8879f1=_0x181ead[_0x1130f4(0x1de)][_0x1130f4(0x222)](_0x29f853=>_0x29f853[_0x1130f4(0x203)]['toLowerCase']()===_0x2502e8['toLowerCase']());if(_0x8879f1)return await handleSingleObjectOutput({'stage_name':_0x8879f1['stageName'],'population':_0x8879f1[_0x1130f4(0x296)],'entered':_0x8879f1[_0x1130f4(0x24b)],'exited':_0x8879f1['exited'],'conversion_rate':_0x8879f1[_0x1130f4(0x23f)]},_0x52a672),0x0;console[_0x1130f4(0x264)](_0x1130f4(0x1ca)+_0x2502e8+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x581413,_0x52a672),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a18_0x68f4c8(0x28a);[a18_0x68f4c8(0x1ec)]=a18_0x68f4c8(0x1fd);async[a18_0x68f4c8(0x20f)](_0x5001f2){const _0x4a2b26=a18_0x68f4c8,{options:_0x329435,args:_0x47a5c9,tdx:_0x45f5c1}=_0x5001f2,_0x53d9f0=_0x47a5c9[0x0];if(!_0x53d9f0)return console[_0x4a2b26(0x264)](_0x4a2b26(0x283)),console[_0x4a2b26(0x264)](_0x4a2b26(0x271)),0x1;_0x329435['verbose']&&console[_0x4a2b26(0x264)](_0x4a2b26(0x237)+_0x53d9f0);const _0x182ca9=await resolveJourneyTarget(_0x53d9f0,_0x329435[_0x4a2b26(0x28c)],_0x329435['verbose']),_0x349979=await withSpinner(_0x4a2b26(0x1f4),()=>_0x45f5c1[_0x4a2b26(0x215)][_0x4a2b26(0x272)](_0x182ca9[_0x4a2b26(0x28c)]),{'verbose':_0x329435[_0x4a2b26(0x295)]}),_0x1cd188=_0x349979[_0x4a2b26(0x1e4)],_0x3698cb=await withSpinner(_0x4a2b26(0x1cf),()=>_0x45f5c1[_0x4a2b26(0x212)][_0x4a2b26(0x242)](_0x1cd188,_0x182ca9[_0x4a2b26(0x260)]),{'verbose':_0x329435[_0x4a2b26(0x295)]}),_0x2f95af=_0x3698cb[_0x4a2b26(0x1e4)];if(!_0x329435[_0x4a2b26(0x208)]){const _0x3774a3=await confirm(_0x4a2b26(0x28b)+_0x182ca9[_0x4a2b26(0x260)]+'\x22?');if(!_0x3774a3)return console[_0x4a2b26(0x264)](_0x4a2b26(0x1d1)),0x0;}const _0x11dd5f=await withSpinner('Pausing\x20journey...',()=>_0x45f5c1[_0x4a2b26(0x212)][_0x4a2b26(0x1ed)](_0x2f95af),{'verbose':_0x329435[_0x4a2b26(0x295)]}),_0x4f33b2=_0x11dd5f[_0x4a2b26(0x1e4)];return console[_0x4a2b26(0x264)](_0x4a2b26(0x218)+_0x4f33b2[_0x4a2b26(0x1f6)][_0x4a2b26(0x20a)]+_0x4a2b26(0x231)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x68f4c8(0x20a)]=a18_0x68f4c8(0x24a);[a18_0x68f4c8(0x1ec)]=a18_0x68f4c8(0x211);async['execute'](_0x4d8b9a){const _0x3548b0=a18_0x68f4c8,{options:_0x374f33,args:_0x2eaed8,tdx:_0x33d23f}=_0x4d8b9a,_0x26fca7=_0x2eaed8[0x0];if(!_0x26fca7)return console[_0x3548b0(0x264)](_0x3548b0(0x283)),console[_0x3548b0(0x264)](_0x3548b0(0x1ce)),0x1;_0x374f33[_0x3548b0(0x295)]&&console[_0x3548b0(0x264)](_0x3548b0(0x237)+_0x26fca7);const _0x457dd3=await resolveJourneyTarget(_0x26fca7,_0x374f33['parentSegment'],_0x374f33['verbose']),_0x552b98=await withSpinner(_0x3548b0(0x1f4),()=>_0x33d23f[_0x3548b0(0x215)][_0x3548b0(0x272)](_0x457dd3[_0x3548b0(0x28c)]),{'verbose':_0x374f33[_0x3548b0(0x295)]}),_0x2e9832=_0x552b98[_0x3548b0(0x1e4)],_0x3afda9=await withSpinner('Resolving\x20journey...',()=>_0x33d23f['journey'][_0x3548b0(0x242)](_0x2e9832,_0x457dd3[_0x3548b0(0x260)]),{'verbose':_0x374f33[_0x3548b0(0x295)]}),_0x260406=_0x3afda9[_0x3548b0(0x1e4)];if(!_0x374f33['yes']){const _0x2cea09=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x457dd3[_0x3548b0(0x260)]+'\x22?');if(!_0x2cea09)return console['error'](_0x3548b0(0x1d1)),0x0;}const _0x1fc285=await withSpinner('Resuming\x20journey...',()=>_0x33d23f[_0x3548b0(0x212)][_0x3548b0(0x251)](_0x260406),{'verbose':_0x374f33[_0x3548b0(0x295)]}),_0x2d253b=_0x1fc285[_0x3548b0(0x1e4)];return console['error'](_0x3548b0(0x218)+_0x2d253b[_0x3548b0(0x1f6)][_0x3548b0(0x20a)]+_0x3548b0(0x1d8)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x68f4c8(0x20a)]=a18_0x68f4c8(0x267);[a18_0x68f4c8(0x1ec)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a18_0x68f4c8(0x20f)](_0x29e8ab){const _0x4efd90=a18_0x68f4c8,{options:_0x3c4e22,args:_0x4dca2b,tdx:_0x2a810}=_0x29e8ab,_0x78e663=_0x3c4e22,_0x447bb4=_0x4dca2b[0x0],_0x139a7e=_0x447bb4&&isYamlFilePath(_0x447bb4),_0x184bb2=await resolveTarget({'arg':_0x139a7e?_0x447bb4:undefined,'contextParent':_0x3c4e22[_0x4efd90(0x28c)],'cwd':process[_0x4efd90(0x1df)]()});if(!isSuccessfulResolution(_0x184bb2))return _0x184bb2['errorCode']===_0x4efd90(0x26a)?(console[_0x4efd90(0x264)](a18_0x41ef24[_0x4efd90(0x1f0)](_0x4efd90(0x1e0))),console[_0x4efd90(0x264)](_0x4efd90(0x1c9)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x4efd90(0x264)](_0x4efd90(0x22c)),console[_0x4efd90(0x264)](_0x4efd90(0x1da))):(console[_0x4efd90(0x264)](a18_0x41ef24[_0x4efd90(0x1d6)](_0x4efd90(0x289)+_0x184bb2[_0x4efd90(0x245)]+'\x0a')),_0x184bb2[_0x4efd90(0x29e)]&&console[_0x4efd90(0x264)](a18_0x41ef24['cyan'](_0x184bb2[_0x4efd90(0x29e)]))),0x1;let _0xbd7617=_0x139a7e?undefined:_0x447bb4,_0x2d9fbb,_0x2a9961;_0x184bb2[_0x4efd90(0x1e5)]===_0x4efd90(0x23a)&&(_0xbd7617=_0x184bb2[_0x4efd90(0x25e)],_0x2d9fbb=_0x184bb2[_0x4efd90(0x1d9)],_0x2a9961=_0x184bb2[_0x4efd90(0x24d)]);const _0x522d29=_0x184bb2[_0x4efd90(0x1d0)],_0x2a700f=_0x184bb2[_0x4efd90(0x2a2)];_0x78e663[_0x4efd90(0x295)]&&(console[_0x4efd90(0x264)](_0x4efd90(0x233)+_0x522d29),console[_0x4efd90(0x264)]('Target\x20directory:\x20'+_0x2a700f),_0xbd7617&&console['error']('Journey\x20name:\x20'+_0xbd7617),_0x2d9fbb&&console[_0x4efd90(0x264)](_0x4efd90(0x209)+_0x2d9fbb),_0x2a9961&&console[_0x4efd90(0x264)](_0x4efd90(0x299)+_0x2a9961));const _0x36df00=await withSpinner(_0x4efd90(0x1f4),()=>_0x2a810[_0x4efd90(0x215)][_0x4efd90(0x272)](_0x522d29),{'verbose':_0x3c4e22[_0x4efd90(0x295)]}),_0x1f5b75=_0x36df00[_0x4efd90(0x1e4)],[_0x50e0c2,_0x5a0da8]=await Promise[_0x4efd90(0x1ea)]([withSpinner(_0x4efd90(0x240),()=>_0x2a810['journey'][_0x4efd90(0x229)](_0x1f5b75,undefined,{'includeAllVersions':!![]}),{'verbose':_0x3c4e22[_0x4efd90(0x295)]}),withSpinner(_0x4efd90(0x1d7),()=>_0x2a810[_0x4efd90(0x215)][_0x4efd90(0x20d)](_0x1f5b75),{'verbose':_0x3c4e22[_0x4efd90(0x295)]})]);let _0x41b9c7=_0x50e0c2[_0x4efd90(0x1e4)];const _0x5c9c75=_0x5a0da8[_0x4efd90(0x1e4)],_0x1373fa=buildFolderIdToPathMap(_0x5c9c75);if(_0xbd7617){const _0xd4c8bc=_0x41b9c7['filter'](_0x1a86a0=>_0x1a86a0[_0x4efd90(0x28f)][_0x4efd90(0x1f9)]()===_0xbd7617[_0x4efd90(0x1f9)]());if(_0xd4c8bc['length']===0x0)return console['error'](_0x4efd90(0x278)+_0xbd7617),console['error'](_0x4efd90(0x273)),0x1;_0x41b9c7=_0xd4c8bc;}if(_0x2a9961!==undefined){const _0x51678b=_0x41b9c7[_0x4efd90(0x281)](_0x19962a=>{const _0x4e1163=_0x4efd90,_0x7206db=_0x19962a[_0x4e1163(0x26c)]?_0x1373fa['get'](_0x19962a[_0x4e1163(0x26c)])||'':'';return _0x7206db===_0x2a9961;});if(_0x51678b[_0x4efd90(0x1f1)]===0x0&&_0x41b9c7[_0x4efd90(0x1f1)]>0x0){console[_0x4efd90(0x264)](_0x4efd90(0x294)+_0xbd7617+_0x4efd90(0x25b)+(_0x2a9961||'root\x20folder')),console[_0x4efd90(0x264)](_0x4efd90(0x250));for(const _0x4f760a of _0x41b9c7){const _0x3b5681=_0x4f760a[_0x4efd90(0x26c)]?_0x1373fa[_0x4efd90(0x261)](_0x4f760a[_0x4efd90(0x26c)])||'':'';console[_0x4efd90(0x264)](_0x4efd90(0x204)+(_0x3b5681||_0x4efd90(0x269))+'/'+_0x4f760a['journeyBundleName']);}return 0x1;}_0x41b9c7=_0x51678b;}if(_0x41b9c7[_0x4efd90(0x1f1)]===0x0)return console[_0x4efd90(0x264)](_0x4efd90(0x1fb)),0x0;const _0x1dccc5=new Map();for(const _0xe07be0 of _0x41b9c7){const _0x4462b8=_0xe07be0[_0x4efd90(0x200)];!_0x1dccc5[_0x4efd90(0x225)](_0x4462b8)&&_0x1dccc5[_0x4efd90(0x246)](_0x4462b8,[]),_0x1dccc5['get'](_0x4462b8)[_0x4efd90(0x1e6)](_0xe07be0);}for(const _0x2932eb of _0x1dccc5[_0x4efd90(0x20e)]()){_0x2932eb[_0x4efd90(0x286)]((_0x4a1070,_0x35ae1f)=>(_0x4a1070[_0x4efd90(0x26e)]||0x0)-(_0x35ae1f[_0x4efd90(0x26e)]||0x0));}const _0x204254=[],[_0x40ba68,_0x31b22e]=await Promise[_0x4efd90(0x1ea)]([withSpinner(_0x4efd90(0x279),()=>_0x2a810['user'][_0x4efd90(0x255)](),{'verbose':_0x3c4e22['verbose']})[_0x4efd90(0x1db)](_0x1e16ce=>_0x1e16ce[_0x4efd90(0x1e4)]),withSpinner(_0x4efd90(0x22b),()=>_0x2a810[_0x4efd90(0x22a)][_0x4efd90(0x1e3)](),{'verbose':_0x3c4e22[_0x4efd90(0x295)]})[_0x4efd90(0x1db)](_0x33e522=>_0x33e522[_0x4efd90(0x1e4)])]);for(const _0x5027be of _0x1dccc5[_0x4efd90(0x20e)]()){const _0x57534d=_0x5027be[0x0][_0x4efd90(0x28f)],_0x3b7f9d=_0x5027be[0x0]['folderId'],_0x264b69=_0x3b7f9d?_0x1373fa[_0x4efd90(0x261)](_0x3b7f9d)||'':'',_0x4f7628=_0x264b69?a18_0x2de0b1[_0x4efd90(0x214)](_0x2a700f,_0x264b69):_0x2a700f,_0x134e9c=_0x2d9fbb||a18_0x2de0b1[_0x4efd90(0x214)](_0x4f7628,sanitizeFileName(_0x57534d)+'.yml');let _0xd46b6b,_0x1f6e39;if(existsSync(_0x134e9c))try{const _0x15bd71=readFileSync(_0x134e9c,_0x4efd90(0x1e1)),_0x3b3917=parseYamlString(_0x15bd71);_0x1f6e39=_0x3b3917,_0xd46b6b=buildRuleToNameMapping(_0x3b3917),_0x78e663['verbose']&&_0xd46b6b[_0x4efd90(0x290)]>0x0&&console['error']('Found\x20'+_0xd46b6b[_0x4efd90(0x290)]+_0x4efd90(0x20c)+_0x57534d);}catch(_0x2039c6){_0x78e663[_0x4efd90(0x295)]&&console['error'](_0x4efd90(0x1ee)+_0x2039c6[_0x4efd90(0x245)]);}const _0x396725=[],_0x35571b=new Set(),_0xde0267=new Map(),_0x2a4c8e=new Map(),_0x515570=new Set(),_0x428f91=new Map(),_0x4099b6=new Map(),_0x574f86=createJumpTargetCache();await withProgressSpinner(_0x4efd90(0x293)+_0x57534d+_0x4efd90(0x27e),async _0x422d96=>{const _0x480d77=_0x4efd90;for(const _0x11930b of _0x5027be){const _0x3c45a6=_0x5027be['length']>0x1?_0x11930b['journeyBundleName']+'\x20v'+(_0x11930b[_0x480d77(0x26e)]||0x1):_0x11930b[_0x480d77(0x28f)];_0x422d96['setPhase']('Fetching\x20'+_0x3c45a6);const _0x3977f5=await _0x2a810[_0x480d77(0x212)]['getJourney'](_0x11930b['id']),_0x150964=_0x3977f5[_0x480d77(0x1f6)]?.[_0x480d77(0x297)],_0xa92dc6={'resolveSegment':async _0x4297bf=>{const _0x104417=_0x480d77;if(!_0x150964)return{'name':_0x4297bf,'isJourneyLocal':![]};const _0x2e1c54=_0xde0267['get'](_0x4297bf);if(_0x2e1c54)return _0x2e1c54;try{const _0x2aa07d=await _0x2a810[_0x104417(0x215)]['getSegment'](_0x150964,_0x4297bf),_0x407274=_0x2aa07d[_0x104417(0x23b)]===SEGMENT_KIND_JOURNEY;let _0x434cf5,_0x2c2117=_0x2aa07d['name'];if(_0x407274&&_0x2aa07d[_0x104417(0x220)]){const _0xd03ec=await segmentResponseToDef(_0x2aa07d,{'resolveSegmentName':async _0x2eb134=>{const _0x52198e=_0x104417,_0x1d171a=_0xde0267[_0x52198e(0x261)](_0x2eb134);if(_0x1d171a)return _0x1d171a[_0x52198e(0x20a)];const _0x1b6206=await _0xa92dc6[_0x52198e(0x1e7)](_0x2eb134);return _0x1b6206[_0x52198e(0x20a)];}}),_0x414412=_0xd03ec[_0x104417(0x220)];_0x434cf5={'description':_0x2aa07d[_0x104417(0x1ec)],'rule':_0x414412};const _0x270124=serializeRule(_0x414412),_0x2d56c8=_0x2a4c8e[_0x104417(0x261)](_0x270124);if(_0x2d56c8)_0x2c2117=_0x2d56c8,_0x434cf5=undefined,_0x78e663[_0x104417(0x295)]&&console[_0x104417(0x264)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x2aa07d['name']+_0x104417(0x232)+_0x2d56c8);else{let _0xa70d07=![];if(_0xd46b6b){const _0x468896=_0xd46b6b[_0x104417(0x261)](_0x270124);if(_0x468896){const _0x386dbb=_0x468896['find'](_0x4d1023=>!_0x35571b[_0x104417(0x225)](_0x4d1023));_0x386dbb&&(_0x2c2117=_0x386dbb,_0x35571b[_0x104417(0x22d)](_0x386dbb),_0x2a4c8e['set'](_0x270124,_0x386dbb),_0xa70d07=!![],_0x78e663['verbose']&&console['error'](_0x104417(0x238)+_0x386dbb+_0x104417(0x291)));}}if(!_0xa70d07){const _0x2281d8=generateJourneyLocalName(_0x2aa07d[_0x104417(0x20a)]);_0x2281d8&&(_0x2c2117=_0x2281d8);let _0x3894d8=_0x2c2117,_0x5395f1=0x2;while(_0x35571b[_0x104417(0x225)](_0x3894d8)){_0x3894d8=_0x2c2117+'_'+_0x5395f1,_0x5395f1++;}_0x35571b[_0x104417(0x22d)](_0x3894d8),_0x2a4c8e['set'](_0x270124,_0x3894d8),_0x2c2117=_0x3894d8;}}}const _0x3caa2f={'name':_0x2c2117,'isJourneyLocal':_0x407274,'definition':_0x434cf5};return _0xde0267[_0x104417(0x246)](_0x4297bf,_0x3caa2f),_0x3caa2f;}catch(_0x4cd492){return _0x3c4e22[_0x104417(0x295)]&&console[_0x104417(0x264)](_0x104417(0x257)+_0x4297bf+':\x20'+_0x4cd492[_0x104417(0x245)]),{'name':_0x4297bf,'isJourneyLocal':![]};}},'resolveActivation':async _0x11bc8b=>{const _0x28100f=_0x480d77,_0x4100bc=_0x428f91[_0x28100f(0x261)](_0x11bc8b);if(_0x4100bc)return _0x4100bc;try{const _0x55a19c=await _0x2a810['journey'][_0x28100f(0x23c)](_0x11930b['id'],_0x11bc8b),_0x3d5301=journeyActivationStepToYaml(_0x55a19c,_0x40ba68,_0x31b22e),_0x5de701=JSON['stringify']({'name':_0x3d5301[_0x28100f(0x20a)],'connection':_0x3d5301['connection'],'connector_config':_0x3d5301[_0x28100f(0x25a)]}),_0x1e38ee=_0x4099b6[_0x28100f(0x261)](_0x5de701);if(_0x1e38ee){const _0x4aa77e={'name':_0x1e38ee,'isJourneyLocal':!![],'definition':_0x3d5301};return _0x428f91[_0x28100f(0x246)](_0x11bc8b,_0x4aa77e),_0x4aa77e;}const _0x430944=_0x55a19c[_0x28100f(0x1f6)][_0x28100f(0x1f2)]['name']||_0x11bc8b,_0x183239=sanitizeYamlKey(_0x430944)||'activation_'+_0x11bc8b;let _0x268f2d=_0x183239,_0x3be082=0x2;while(_0x515570['has'](_0x268f2d)){_0x268f2d=_0x183239+'_'+_0x3be082,_0x3be082++;}_0x515570['add'](_0x268f2d),_0x4099b6[_0x28100f(0x246)](_0x5de701,_0x268f2d);const _0x3f9d2c={'name':_0x268f2d,'isJourneyLocal':!![],'definition':_0x3d5301};return _0x428f91[_0x28100f(0x246)](_0x11bc8b,_0x3f9d2c),_0x3f9d2c;}catch(_0x3568ca){return _0x3c4e22[_0x28100f(0x295)]&&console['error'](_0x28100f(0x248)+_0x11bc8b+':\x20'+_0x3568ca[_0x28100f(0x245)]),{'name':_0x11bc8b,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x180a5c,_0x47bec8)=>{const _0x28bee6=_0x480d77;return resolveJumpTarget(_0x180a5c,_0x47bec8,_0x574f86,_0x4687ca=>_0x2a810[_0x28bee6(0x212)]['getJourney'](_0x4687ca));}},_0x12995d=await journeyResponseToDef(_0x3977f5,_0xa92dc6);_0x396725['push']({'item':_0x11930b,'yaml':_0x12995d});}},{'verbose':_0x3c4e22['verbose']});const _0x25b080=buildMergedJourneyDef(_0x396725,_0xd46b6b),_0x1a3227=normalizeJourneyDef(_0x25b080,_0x1f6e39),_0x48c239=toYamlString(_0x1a3227),_0x63e4b=_0x2d9fbb||a18_0x2de0b1[_0x4efd90(0x214)](_0x4f7628,sanitizeFileName(_0x57534d)+_0x4efd90(0x282));!_0x2d9fbb&&_0x264b69&&!existsSync(_0x4f7628)&&mkdirSync(_0x4f7628,{'recursive':!![]});const _0x21006f=a18_0x2de0b1[_0x4efd90(0x258)](process[_0x4efd90(0x1df)](),_0x63e4b);if(existsSync(_0x63e4b)){const _0xcf4e89=readFileSync(_0x63e4b,_0x4efd90(0x1e1)),_0x48849b=generateDiff(_0xcf4e89,_0x48c239),_0x776c74=hasChanges(_0x48849b);_0x204254[_0x4efd90(0x1e6)]({'relativePath':_0x21006f,'absolutePath':_0x63e4b,'content':_0x48c239,'isNew':![],'hasChanges':_0x776c74,'diff':_0x776c74?formatDiffWithColors(_0x48849b):undefined});}else _0x204254[_0x4efd90(0x1e6)]({'relativePath':_0x21006f,'absolutePath':_0x63e4b,'content':_0x48c239,'isNew':!![],'hasChanges':![]});}const _0x55f360=_0x204254[_0x4efd90(0x281)](_0x1b4829=>_0x1b4829[_0x4efd90(0x256)]),_0xdb8d96=_0x204254[_0x4efd90(0x281)](_0x578b7b=>!_0x578b7b[_0x4efd90(0x256)]&&_0x578b7b['hasChanges']),_0x4ecb74=_0x204254[_0x4efd90(0x281)](_0x15461c=>!_0x15461c[_0x4efd90(0x256)]&&!_0x15461c[_0x4efd90(0x236)]),_0x557ba9=_0x41b9c7['length'],_0x331d9f=_0x1dccc5[_0x4efd90(0x290)],_0xc0b0ab=_0x557ba9>_0x331d9f?'\x20('+_0x557ba9+'\x20versions)':'';console[_0x4efd90(0x264)](_0x4efd90(0x206)),console[_0x4efd90(0x264)]('\x20\x20'+a18_0x41ef24[_0x4efd90(0x1d5)](_0x331d9f+'\x20journeys')+a18_0x41ef24[_0x4efd90(0x1e8)](_0xc0b0ab)),console[_0x4efd90(0x264)]('\x20\x20'+a18_0x41ef24['green']('+\x20'+_0x55f360[_0x4efd90(0x1f1)]+'\x20new\x20files')),console[_0x4efd90(0x264)]('\x20\x20'+a18_0x41ef24[_0x4efd90(0x1f0)]('~\x20'+_0xdb8d96[_0x4efd90(0x1f1)]+'\x20changed\x20files')),console[_0x4efd90(0x264)]('\x20\x20'+a18_0x41ef24[_0x4efd90(0x1e8)]('=\x20'+_0x4ecb74[_0x4efd90(0x1f1)]+_0x4efd90(0x24e))),console[_0x4efd90(0x264)](_0x4efd90(0x223)+a18_0x41ef24[_0x4efd90(0x1d5)](_0x2a700f)+'\x0a');if(_0xdb8d96[_0x4efd90(0x1f1)]>0x0)for(const _0x2e4c52 of _0xdb8d96){console[_0x4efd90(0x264)]('\x0aChanges\x20to\x20\x27'+_0x2e4c52['relativePath']+'\x27:'),console[_0x4efd90(0x264)]('─'['repeat'](0x3c)),console[_0x4efd90(0x264)](_0x2e4c52[_0x4efd90(0x21d)]),console['error']('─'[_0x4efd90(0x235)](0x3c));}if(_0x78e663[_0x4efd90(0x280)])return console[_0x4efd90(0x264)](a18_0x41ef24[_0x4efd90(0x1f0)](_0x4efd90(0x22f))),0x0;if(_0x55f360[_0x4efd90(0x1f1)]===0x0&&_0xdb8d96['length']===0x0)return console[_0x4efd90(0x264)](a18_0x41ef24['green'](_0x4efd90(0x28d))),saveSessionContext({'parent_segment':_0x522d29},_0x78e663['session']),console[_0x4efd90(0x264)](a18_0x41ef24[_0x4efd90(0x29f)](_0x4efd90(0x21c)+a18_0x41ef24[_0x4efd90(0x1e8)](_0x4efd90(0x23e))+_0x4efd90(0x1cd)+a18_0x41ef24[_0x4efd90(0x1d5)](_0x522d29))),0x0;if(!_0x78e663[_0x4efd90(0x208)]&&(_0x55f360[_0x4efd90(0x1f1)]>0x0||_0xdb8d96[_0x4efd90(0x1f1)]>0x0)){const _0x3f31d6=await confirmKey(_0x4efd90(0x24f)+(_0x55f360[_0x4efd90(0x1f1)]+_0xdb8d96[_0x4efd90(0x1f1)])+_0x4efd90(0x1e2));if(!_0x3f31d6)return console[_0x4efd90(0x264)](_0x4efd90(0x277)),0x1;}!existsSync(_0x2a700f)&&mkdirSync(_0x2a700f,{'recursive':!![]});for(const _0xfc3ae1 of _0x204254){(_0xfc3ae1[_0x4efd90(0x256)]||_0xfc3ae1[_0x4efd90(0x236)])&&writeFileSync(_0xfc3ae1[_0x4efd90(0x1fc)],_0xfc3ae1[_0x4efd90(0x259)],_0x4efd90(0x1e1));}return console['error'](a18_0x41ef24[_0x4efd90(0x29f)]('✔\x20Pulled\x20'+(_0x55f360['length']+_0xdb8d96[_0x4efd90(0x1f1)])+'\x20journey\x20files\x20to\x20'+_0x2a700f)),saveSessionContext({'parent_segment':_0x522d29},_0x78e663[_0x4efd90(0x275)]),console['error'](a18_0x41ef24[_0x4efd90(0x29f)](_0x4efd90(0x21c)+a18_0x41ef24[_0x4efd90(0x1e8)](_0x4efd90(0x23e))+_0x4efd90(0x1cd)+a18_0x41ef24[_0x4efd90(0x1d5)](_0x522d29))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x68f4c8(0x20a)]='journey:push';['description']=a18_0x68f4c8(0x29c);[a18_0x68f4c8(0x21f)]=new SegmentPushCommand();async[a18_0x68f4c8(0x20f)](_0x587162){const _0x39b534=a18_0x68f4c8,_0x23b8ca=_0x587162[_0x39b534(0x298)][0x0];let _0x28f307;if(_0x23b8ca){const _0x2fae18=await resolveTarget({'arg':_0x23b8ca,'contextParent':_0x587162['options'][_0x39b534(0x28c)],'cwd':process['cwd']()});isSuccessfulResolution(_0x2fae18)&&_0x2fae18['type']===_0x39b534(0x23a)&&(_0x28f307=_0x2fae18[_0x39b534(0x1d9)]);}const _0x139d78={..._0x587162,'options':{..._0x587162[_0x39b534(0x1ff)],'journeysOnly':!![],..._0x28f307&&{'singleFilePath':_0x28f307}}};return this[_0x39b534(0x21f)][_0x39b534(0x20f)](_0x139d78);}}
@@ -1 +1 @@
1
- const a19_0x443210=a19_0x4eb4;(function(_0x332eb3,_0x527466){const _0x12b2e3=a19_0x4eb4,_0x1511f0=_0x332eb3();while(!![]){try{const _0x19180c=-parseInt(_0x12b2e3(0xa3))/0x1+parseInt(_0x12b2e3(0x9a))/0x2*(-parseInt(_0x12b2e3(0x80))/0x3)+-parseInt(_0x12b2e3(0x8b))/0x4*(-parseInt(_0x12b2e3(0x89))/0x5)+-parseInt(_0x12b2e3(0xa8))/0x6+-parseInt(_0x12b2e3(0x93))/0x7*(parseInt(_0x12b2e3(0x99))/0x8)+-parseInt(_0x12b2e3(0x84))/0x9+parseInt(_0x12b2e3(0x9e))/0xa;if(_0x19180c===_0x527466)break;else _0x1511f0['push'](_0x1511f0['shift']());}catch(_0x124e84){_0x1511f0['push'](_0x1511f0['shift']());}}}(a19_0x22a3,0xadd90));import{BaseCommand}from'./command.js';function a19_0x4eb4(_0x3f7eb1,_0x220f33){_0x3f7eb1=_0x3f7eb1-0x80;const _0x22a396=a19_0x22a3();let _0x4eb462=_0x22a396[_0x3f7eb1];return _0x4eb462;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a19_0x22a3(){const _0x3b2f9a=['\x20warning(s)','\x20error(s)','green','length','\x20journey(s)\x20with\x20errors,\x20','14nkXtBE','✔\x20All\x20','\x20valid','skippedCount','Validation\x20failed:\x20','parentSegment','2542056UdekYd','18WAdzBQ','Error:\x20','no_parent','helpText','19952890ckEptJ','.yml','\x20segment\x20file(s)\x20skipped','dim','\x20segment\x20file(s)\x20skipped)','538284GcdXNG','description','errorCode','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','warnings','903108sakILT','filePath','execute','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','name','warningCount','\x20journey(s)\x20valid','hasErrors','targetDir','errors','Error:\x20Directory\x20not\x20found:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','message','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','filter','375213BfhVCx','endsWith','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','file','1833633ZWflaw','error','validCount','red','log','5NJBDCb','yellow','5481932QjRrMO','journey:validate','\x20warning(s)\x20found'];a19_0x22a3=function(){return _0x3b2f9a;};return a19_0x22a3();}import{existsSync}from'fs';import a19_0x34f16b from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x443210(0xac)]=a19_0x443210(0x8c);[a19_0x443210(0xa4)]='Validate\x20journey\x20YAML\x20files';async[a19_0x443210(0xaa)](_0x38ac24){const _0x15e15a=a19_0x443210,{options:_0x5d5778,args:_0x3ef79b}=_0x38ac24,_0xcef47c=_0x5d5778,_0x13cf08=await resolveTarget({'arg':_0x3ef79b[0x0],'contextParent':_0x5d5778[_0x15e15a(0x98)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x13cf08))return _0x13cf08[_0x15e15a(0xa5)]===_0x15e15a(0x9c)?(console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x8a)](_0x15e15a(0xb3))),console[_0x15e15a(0x85)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console[_0x15e15a(0x85)](_0x15e15a(0xa6)),console['error'](_0x15e15a(0xab))):(console['error'](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0x9b)+_0x13cf08[_0x15e15a(0xb4)]+'\x0a')),_0x13cf08['helpText']&&console[_0x15e15a(0x85)](a19_0x34f16b['cyan'](_0x13cf08[_0x15e15a(0x9d)]))),0x1;const _0x54d857=_0x13cf08[_0x15e15a(0xb0)],_0x43a25b=_0x13cf08['type']===_0x15e15a(0x83)?_0x13cf08[_0x15e15a(0xa9)]:undefined;if(!_0x43a25b&&!existsSync(_0x54d857))return console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0xb2)+_0x54d857+'\x0a')),0x1;let _0x308308;if(_0x43a25b){if(!_0x43a25b[_0x15e15a(0x81)](_0x15e15a(0x9f))&&!_0x43a25b[_0x15e15a(0x81)]('.yaml'))return console['error'](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0x82)+_0x43a25b+'\x0a')),0x1;_0x308308=[_0x43a25b];}else _0x308308=findYamlFiles(_0x54d857);if(_0x308308['length']===0x0)return console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0xb5)+_0x54d857+'\x0a')),0x1;const _0x4e8c36=validateYamlFiles(_0x308308,_0x54d857,{'filterType':'journey'}),_0x1bb7cb=calculateSummary(_0x4e8c36),_0x29e825=_0x4e8c36[_0x15e15a(0xb6)](isValidationResult);if(_0x29e825['length']===0x0)return console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x8a)]('No\x20journey\x20YAML\x20files\x20found\x20in\x20'+_0x54d857+'\x0a')),_0x1bb7cb[_0x15e15a(0x96)]>0x0&&console[_0x15e15a(0x85)](a19_0x34f16b['dim']('('+_0x1bb7cb[_0x15e15a(0x96)]+_0x15e15a(0xa2))),0x0;for(const _0x2a8aec of _0x4e8c36){if(!isValidationResult(_0x2a8aec)){_0xcef47c['verbose']&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0xa1)]('-\x20'+_0x2a8aec['relativePath']+'\x20(skipped:\x20'+_0x2a8aec['reason']+')'));continue;}const {relativePath:_0x2c5718,source:_0x255b07,result:_0x2df3de}=_0x2a8aec;if(_0x2df3de['valid']&&_0x2df3de[_0x15e15a(0xa7)]['length']===0x0)_0xcef47c['verbose']&&console['log'](a19_0x34f16b[_0x15e15a(0x90)]('✔\x20'+_0x2c5718));else _0x2df3de['valid']?(console['log'](a19_0x34f16b['yellow']('⚠\x20'+_0x2c5718+':\x20'+_0x2df3de[_0x15e15a(0xa7)][_0x15e15a(0x91)]+_0x15e15a(0x8e))),console['log'](formatValidationResult(_0x2df3de,_0x255b07,_0x2c5718))):(console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x87)]('✖\x20'+_0x2c5718+':\x20'+_0x2df3de[_0x15e15a(0xb1)][_0x15e15a(0x91)]+_0x15e15a(0x8f))),console['log'](formatValidationResult(_0x2df3de,_0x255b07,_0x2c5718)));}return console['log'](''),_0x1bb7cb[_0x15e15a(0xaf)]?(console[_0x15e15a(0x88)](a19_0x34f16b['red'](_0x15e15a(0x97)+_0x1bb7cb['invalidCount']+_0x15e15a(0x92)+_0x1bb7cb[_0x15e15a(0x86)]+_0x15e15a(0x95))),_0x1bb7cb['warningCount']>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x8a)](_0x1bb7cb[_0x15e15a(0xad)]+_0x15e15a(0x8d))),_0x1bb7cb[_0x15e15a(0x96)]>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0xa1)](_0x1bb7cb[_0x15e15a(0x96)]+_0x15e15a(0xa0))),0x1):(console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x90)](_0x15e15a(0x94)+_0x1bb7cb[_0x15e15a(0x86)]+_0x15e15a(0xae))),_0x1bb7cb[_0x15e15a(0xad)]>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x8a)](_0x1bb7cb[_0x15e15a(0xad)]+_0x15e15a(0x8d))),_0x1bb7cb['skippedCount']>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0xa1)](_0x1bb7cb[_0x15e15a(0x96)]+_0x15e15a(0xa0))),0x0);}}
1
+ const a19_0x8baa6f=a19_0x4c31;function a19_0x4c31(_0x1c506a,_0x1aba85){_0x1c506a=_0x1c506a-0x1b1;const _0x2b092d=a19_0x2b09();let _0x4c3160=_0x2b092d[_0x1c506a];return _0x4c3160;}(function(_0x2e954d,_0x2aa4b1){const _0x1c944d=a19_0x4c31,_0x5ba6a3=_0x2e954d();while(!![]){try{const _0x3e87dd=parseInt(_0x1c944d(0x1d3))/0x1+parseInt(_0x1c944d(0x1d6))/0x2*(parseInt(_0x1c944d(0x1c1))/0x3)+-parseInt(_0x1c944d(0x1ee))/0x4*(parseInt(_0x1c944d(0x1e2))/0x5)+-parseInt(_0x1c944d(0x1b8))/0x6*(-parseInt(_0x1c944d(0x1bb))/0x7)+parseInt(_0x1c944d(0x1d5))/0x8*(parseInt(_0x1c944d(0x1b6))/0x9)+-parseInt(_0x1c944d(0x1b7))/0xa+parseInt(_0x1c944d(0x1d7))/0xb;if(_0x3e87dd===_0x2aa4b1)break;else _0x5ba6a3['push'](_0x5ba6a3['shift']());}catch(_0x4491a7){_0x5ba6a3['push'](_0x5ba6a3['shift']());}}}(a19_0x2b09,0x819f4));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x43e116 from'chalk';function a19_0x2b09(){const _0x30243c=['\x20segment\x20file(s)\x20skipped)','valid','1748035DZXaMC','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','reason','verbose','cyan','parentSegment','warningCount','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','.yml','file','cwd','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','12kfPMxw','journey','filter','Error:\x20Directory\x20not\x20found:\x20','red','hasErrors','error','225NhLyFG','8539490gwyVFE','894xMDqOu','message','Error:\x20','17381FSoiXm','invalidCount','description','\x20segment\x20file(s)\x20skipped','✔\x20All\x20','log','534KSgtZR','skippedCount','name','helpText','errors','\x20valid','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','journey:validate','targetDir','no_parent','Validate\x20journey\x20YAML\x20files','green','length','type','filePath','dim','\x20journey(s)\x20valid','endsWith','385537jEWQyg','Validation\x20failed:\x20','263064acvsQl','5650qdVLen','3886003GPESoU','errorCode','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20warning(s)\x20found','\x20(skipped:\x20','warnings','No\x20journey\x20YAML\x20files\x20found\x20in\x20','yellow'];a19_0x2b09=function(){return _0x30243c;};return a19_0x2b09();}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x8baa6f(0x1c3)]=a19_0x8baa6f(0x1c8);[a19_0x8baa6f(0x1bd)]=a19_0x8baa6f(0x1cb);async['execute'](_0x4e1b37){const _0x1ab849=a19_0x8baa6f,{options:_0x2286c3,args:_0x1cf5cd}=_0x4e1b37,_0x1f2676=_0x2286c3,_0x566861=await resolveTarget({'arg':_0x1cf5cd[0x0],'contextParent':_0x2286c3[_0x1ab849(0x1e7)],'cwd':process[_0x1ab849(0x1ec)]()});if(!isSuccessfulResolution(_0x566861))return _0x566861[_0x1ab849(0x1d8)]===_0x1ab849(0x1ca)?(console[_0x1ab849(0x1b5)](a19_0x43e116[_0x1ab849(0x1df)](_0x1ab849(0x1ed))),console['error'](_0x1ab849(0x1e3)),console[_0x1ab849(0x1b5)](_0x1ab849(0x1c7)),console[_0x1ab849(0x1b5)](_0x1ab849(0x1d9))):(console[_0x1ab849(0x1b5)](a19_0x43e116[_0x1ab849(0x1b3)](_0x1ab849(0x1ba)+_0x566861[_0x1ab849(0x1b9)]+'\x0a')),_0x566861[_0x1ab849(0x1c4)]&&console[_0x1ab849(0x1b5)](a19_0x43e116[_0x1ab849(0x1e6)](_0x566861[_0x1ab849(0x1c4)]))),0x1;const _0x599c12=_0x566861[_0x1ab849(0x1c9)],_0x45087b=_0x566861[_0x1ab849(0x1ce)]===_0x1ab849(0x1eb)?_0x566861[_0x1ab849(0x1cf)]:undefined;if(!_0x45087b&&!existsSync(_0x599c12))return console['error'](a19_0x43e116[_0x1ab849(0x1b3)](_0x1ab849(0x1b2)+_0x599c12+'\x0a')),0x1;let _0x31a52b;if(_0x45087b){if(!_0x45087b[_0x1ab849(0x1d2)](_0x1ab849(0x1ea))&&!_0x45087b[_0x1ab849(0x1d2)]('.yaml'))return console[_0x1ab849(0x1b5)](a19_0x43e116[_0x1ab849(0x1b3)](_0x1ab849(0x1da)+_0x45087b+'\x0a')),0x1;_0x31a52b=[_0x45087b];}else _0x31a52b=findYamlFiles(_0x599c12);if(_0x31a52b[_0x1ab849(0x1cd)]===0x0)return console[_0x1ab849(0x1b5)](a19_0x43e116[_0x1ab849(0x1b3)](_0x1ab849(0x1e9)+_0x599c12+'\x0a')),0x1;const _0x4baa85=validateYamlFiles(_0x31a52b,_0x599c12,{'filterType':_0x1ab849(0x1ef)}),_0x4a56f4=calculateSummary(_0x4baa85),_0x4c6e54=_0x4baa85[_0x1ab849(0x1b1)](isValidationResult);if(_0x4c6e54[_0x1ab849(0x1cd)]===0x0)return console['error'](a19_0x43e116[_0x1ab849(0x1df)](_0x1ab849(0x1de)+_0x599c12+'\x0a')),_0x4a56f4[_0x1ab849(0x1c2)]>0x0&&console['error'](a19_0x43e116[_0x1ab849(0x1d0)]('('+_0x4a56f4['skippedCount']+_0x1ab849(0x1e0))),0x0;for(const _0x488cb9 of _0x4baa85){if(!isValidationResult(_0x488cb9)){_0x1f2676[_0x1ab849(0x1e5)]&&console['log'](a19_0x43e116[_0x1ab849(0x1d0)]('-\x20'+_0x488cb9['relativePath']+_0x1ab849(0x1dc)+_0x488cb9[_0x1ab849(0x1e4)]+')'));continue;}const {relativePath:_0x1998a6,source:_0x2a27ff,result:_0x2a5d62}=_0x488cb9;if(_0x2a5d62[_0x1ab849(0x1e1)]&&_0x2a5d62[_0x1ab849(0x1dd)][_0x1ab849(0x1cd)]===0x0)_0x1f2676[_0x1ab849(0x1e5)]&&console[_0x1ab849(0x1c0)](a19_0x43e116['green']('✔\x20'+_0x1998a6));else _0x2a5d62[_0x1ab849(0x1e1)]?(console[_0x1ab849(0x1c0)](a19_0x43e116['yellow']('⚠\x20'+_0x1998a6+':\x20'+_0x2a5d62[_0x1ab849(0x1dd)][_0x1ab849(0x1cd)]+'\x20warning(s)')),console[_0x1ab849(0x1c0)](formatValidationResult(_0x2a5d62,_0x2a27ff,_0x1998a6))):(console[_0x1ab849(0x1c0)](a19_0x43e116[_0x1ab849(0x1b3)]('✖\x20'+_0x1998a6+':\x20'+_0x2a5d62[_0x1ab849(0x1c5)]['length']+'\x20error(s)')),console['log'](formatValidationResult(_0x2a5d62,_0x2a27ff,_0x1998a6)));}return console[_0x1ab849(0x1c0)](''),_0x4a56f4[_0x1ab849(0x1b4)]?(console[_0x1ab849(0x1c0)](a19_0x43e116[_0x1ab849(0x1b3)](_0x1ab849(0x1d4)+_0x4a56f4[_0x1ab849(0x1bc)]+'\x20journey(s)\x20with\x20errors,\x20'+_0x4a56f4['validCount']+_0x1ab849(0x1c6))),_0x4a56f4[_0x1ab849(0x1e8)]>0x0&&console[_0x1ab849(0x1c0)](a19_0x43e116[_0x1ab849(0x1df)](_0x4a56f4['warningCount']+_0x1ab849(0x1db))),_0x4a56f4['skippedCount']>0x0&&console[_0x1ab849(0x1c0)](a19_0x43e116[_0x1ab849(0x1d0)](_0x4a56f4[_0x1ab849(0x1c2)]+_0x1ab849(0x1be))),0x1):(console['log'](a19_0x43e116[_0x1ab849(0x1cc)](_0x1ab849(0x1bf)+_0x4a56f4['validCount']+_0x1ab849(0x1d1))),_0x4a56f4['warningCount']>0x0&&console[_0x1ab849(0x1c0)](a19_0x43e116[_0x1ab849(0x1df)](_0x4a56f4[_0x1ab849(0x1e8)]+_0x1ab849(0x1db))),_0x4a56f4[_0x1ab849(0x1c2)]>0x0&&console[_0x1ab849(0x1c0)](a19_0x43e116['dim'](_0x4a56f4['skippedCount']+'\x20segment\x20file(s)\x20skipped')),0x0);}}
@@ -1 +1 @@
1
- const a20_0x23a27f=a20_0x2bf7;function a20_0x2bf7(_0x197c2a,_0x23e59a){_0x197c2a=_0x197c2a-0x107;const _0x1ef8ba=a20_0x1ef8();let _0x2bf722=_0x1ef8ba[_0x197c2a];return _0x2bf722;}(function(_0x12963e,_0x5e0d9e){const _0x28c2d8=a20_0x2bf7,_0x2db270=_0x12963e();while(!![]){try{const _0x369502=parseInt(_0x28c2d8(0x130))/0x1+parseInt(_0x28c2d8(0x16b))/0x2+-parseInt(_0x28c2d8(0x1b3))/0x3*(-parseInt(_0x28c2d8(0x14a))/0x4)+-parseInt(_0x28c2d8(0x1b9))/0x5+-parseInt(_0x28c2d8(0x107))/0x6*(-parseInt(_0x28c2d8(0x108))/0x7)+-parseInt(_0x28c2d8(0x1cf))/0x8*(parseInt(_0x28c2d8(0x1d1))/0x9)+-parseInt(_0x28c2d8(0x141))/0xa*(parseInt(_0x28c2d8(0x116))/0xb);if(_0x369502===_0x5e0d9e)break;else _0x2db270['push'](_0x2db270['shift']());}catch(_0x2e6c00){_0x2db270['push'](_0x2db270['shift']());}}}(a20_0x1ef8,0x44fde));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a20_0x20fe6b from'node:fs';function handleSDKError(_0x20c864,_0x3b38c6){const _0x511fe1=a20_0x2bf7;if(_0x20c864 instanceof SDKError)console[_0x511fe1(0x157)](_0x511fe1(0x136)+_0x20c864[_0x511fe1(0x1bb)]),_0x3b38c6[_0x511fe1(0x168)]&&(_0x20c864[_0x511fe1(0x16f)]&&console[_0x511fe1(0x157)](_0x511fe1(0x10a)+_0x20c864[_0x511fe1(0x16f)]),_0x20c864[_0x511fe1(0x189)]&&(console[_0x511fe1(0x157)]('\x0aStack\x20trace:'),console[_0x511fe1(0x157)](_0x20c864[_0x511fe1(0x189)])));else throw _0x20c864;}function formatChatHistoryEntry(_0x45dbc0,_0x5ec3c9){const _0x33e968=a20_0x2bf7,_0x1b8e33=getChalk(_0x5ec3c9),_0x2edf8b=_0x1b8e33['dim'](_0x45dbc0['at']);if('input'in _0x45dbc0){const _0x3d9673=_0x1b8e33[_0x33e968(0x18f)](_0x33e968(0x17e));return _0x2edf8b+'\x20'+_0x3d9673+':\x20'+_0x45dbc0['input'];}if(_0x33e968(0x12c)in _0x45dbc0){const _0x4a0718=_0x1b8e33[_0x33e968(0x10f)](_0x33e968(0x14c));return _0x2edf8b+'\x20'+_0x4a0718+':\x20'+_0x45dbc0['content'];}if(_0x33e968(0x195)in _0x45dbc0){const _0x2952e9=_0x1b8e33[_0x33e968(0x1c6)](_0x33e968(0x142)),{functionName:_0x258f8c,functionArguments:_0x2569db,targetFunction:_0x4a09e2}=_0x45dbc0[_0x33e968(0x195)];let _0x56ff16=_0x2edf8b+'\x20'+_0x2952e9+':\x20'+_0x1b8e33[_0x33e968(0x1d6)](_0x258f8c);if(_0x2569db&&Object[_0x33e968(0x178)](_0x2569db)[_0x33e968(0x1d2)]>0x0){const _0x9ceda1=Object[_0x33e968(0x173)](_0x2569db)[_0x33e968(0x1b2)](([_0x427483,_0xbc27c1])=>_0x427483+'='+JSON[_0x33e968(0x1a3)](_0xbc27c1))[_0x33e968(0x15d)](',\x20');_0x56ff16+='('+_0x9ceda1+')';}_0x4a09e2&&(_0x56ff16+=_0x1b8e33[_0x33e968(0x169)]('\x20['+_0x4a09e2+']'));let _0x39ccc4='';if(_0x45dbc0[_0x33e968(0x195)][_0x33e968(0x147)])_0x39ccc4=_0x33e968(0x1bc)+_0x45dbc0[_0x33e968(0x195)][_0x33e968(0x147)][_0x33e968(0x1b7)];else{if(_0x45dbc0[_0x33e968(0x195)][_0x33e968(0x119)])_0x39ccc4=_0x33e968(0x1ae)+_0x45dbc0[_0x33e968(0x195)][_0x33e968(0x119)][_0x33e968(0x1b7)];else{if(_0x45dbc0[_0x33e968(0x195)][_0x33e968(0x1d5)])_0x39ccc4=_0x33e968(0x198)+_0x45dbc0[_0x33e968(0x195)]['targetWebSearchTool'][_0x33e968(0x1b7)];else _0x45dbc0[_0x33e968(0x195)][_0x33e968(0x174)]&&(_0x39ccc4=_0x33e968(0x111)+_0x45dbc0['tool_call'][_0x33e968(0x174)][_0x33e968(0x1b7)]);}}return _0x56ff16+_0x39ccc4;}if(_0x33e968(0x14f)in _0x45dbc0){const _0xa6907d=_0x1b8e33[_0x33e968(0x153)](_0x33e968(0x140)),{functionName:_0x5befab,functionArguments:_0x5a92d3,content:_0x4084d0,newChat:_0x1df9b1}=_0x45dbc0[_0x33e968(0x14f)];let _0x35b8e2=_0x2edf8b+'\x20'+_0xa6907d+':\x20'+_0x1b8e33['bold'](_0x5befab);if(_0x5a92d3){const _0x23c4b0=typeof _0x5a92d3===_0x33e968(0x1ad)?_0x5a92d3:JSON[_0x33e968(0x1a3)](_0x5a92d3);_0x35b8e2+='('+_0x23c4b0+')';}return _0x4084d0&&(_0x35b8e2+='\x0a'+_0x1b8e33[_0x33e968(0x169)](_0x4084d0)),_0x1df9b1&&(_0x35b8e2+=_0x1b8e33[_0x33e968(0x169)]('\x20→\x20chat:\x20'+_0x1df9b1['id'])),_0x35b8e2;}if(_0x33e968(0x11b)in _0x45dbc0){const _0x39c0c1=_0x1b8e33['blue'](_0x33e968(0x183));return _0x2edf8b+'\x20'+_0x39c0c1+':\x20'+_0x45dbc0[_0x33e968(0x11b)]['name']+'\x20('+_0x45dbc0[_0x33e968(0x11b)][_0x33e968(0x12c)][_0x33e968(0x1d2)]+_0x33e968(0x1a4);}if(_0x33e968(0x128)in _0x45dbc0){const _0x286128=_0x1b8e33['blue'](_0x33e968(0x176)),{width:_0x3b8f67,height:_0x484717,headerText:_0x6b2301}=_0x45dbc0[_0x33e968(0x128)],_0x28e509=_0x6b2301?_0x33e968(0x1a1)+_0x6b2301:'';return _0x2edf8b+'\x20'+_0x286128+':\x20'+_0x3b8f67+'x'+_0x484717+_0x28e509;}if(_0x33e968(0x157)in _0x45dbc0){const _0x1031d6=_0x1b8e33['red'](_0x33e968(0x155));return _0x2edf8b+'\x20'+_0x1031d6+':\x20'+_0x45dbc0[_0x33e968(0x157)];}return _0x2edf8b+'\x20'+_0x1b8e33[_0x33e968(0x169)](_0x33e968(0x19c))+':\x20'+JSON['stringify'](_0x45dbc0);}async function executeChatHistoryCommand(_0x571f0f,_0x4b2f35){const _0x5dad07=a20_0x2bf7,{options:_0x7ed15d,args:_0x3fc1ef,tdx:_0x30de54}=_0x571f0f,_0x474cb3=_0x3fc1ef[0x0],_0x2032a2=_0x7ed15d,_0x3494f6=_0x2032a2['last'];try{if(_0x3494f6&&_0x474cb3)return console[_0x5dad07(0x157)](_0x5dad07(0x144)),console['error'](_0x5dad07(0x148)+_0x4b2f35+'\x20--last'),0x1;if(!_0x474cb3&&!_0x3494f6&&_0x7ed15d['format']!==undefined){const _0x66011=resolveLimit(_0x7ed15d[_0x5dad07(0x12a)],DEFAULT_LLM_LIMIT),_0x13d63b=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x30de54[_0x5dad07(0x162)][_0x5dad07(0x19a)](_0x66011),{'verbose':_0x7ed15d[_0x5dad07(0x168)]});return await handleSDKOutput(_0x13d63b['data'],_0x7ed15d),0x0;}const _0x2dd32f=await getChatIdOrSelect(_0x30de54,_0x7ed15d,_0x3494f6,_0x474cb3);if(!_0x2dd32f)return 0x0;return await displayChatHistory(_0x2dd32f,_0x30de54,_0x7ed15d),0x0;}catch(_0x4a6cf5){return handleSDKError(_0x4a6cf5,_0x7ed15d),0x1;}}async function displayChatHistory(_0x1b19eb,_0x13afbb,_0x53d714){const _0x55fd9a=a20_0x2bf7,_0xa3a012=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x1b19eb+_0x55fd9a(0x1d3),()=>_0x13afbb[_0x55fd9a(0x162)][_0x55fd9a(0x150)](_0x1b19eb),{'verbose':_0x53d714[_0x55fd9a(0x168)]}),_0x5f37fe=_0xa3a012['data'][_0x55fd9a(0x1db)]??[];if(_0x5f37fe[_0x55fd9a(0x1d2)]===0x0){console['log'](_0x55fd9a(0x1a7));return;}if(_0x53d714[_0x55fd9a(0x1b1)]!==undefined)await handleSDKOutput(_0x5f37fe,_0x53d714);else{const _0x4bb9a9=_0x5f37fe[_0x55fd9a(0x1b2)](_0x1f7928=>formatChatHistoryEntry(_0x1f7928,_0x53d714)),_0xe96879=_0x4bb9a9[_0x55fd9a(0x15d)]('\x0a');await writeOutput(_0xe96879,_0x53d714[_0x55fd9a(0x11b)],_0x55fd9a(0x146));}}async function getChatIdOrSelect(_0x309e0b,_0x1d41c3,_0x3b43c1,_0x7da766){const _0x4ba39a=a20_0x2bf7;if(_0x7da766)return _0x7da766;if(_0x3b43c1){const _0x3f0cdb=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x309e0b[_0x4ba39a(0x162)][_0x4ba39a(0x19a)](0x1),{'verbose':_0x1d41c3[_0x4ba39a(0x168)]});if(_0x3f0cdb['data'][_0x4ba39a(0x1d2)]===0x0)return console[_0x4ba39a(0x114)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x3f0cdb[_0x4ba39a(0x1db)][0x0]['id'];}const _0x45861e=await selectChatInteractively(_0x309e0b,_0x1d41c3);if(!_0x45861e)return console['log'](_0x4ba39a(0x138)),undefined;return _0x45861e;}async function getProjectIdOrDefault(_0x441934){const _0x19c29a=await getProjectWithName(_0x441934);return _0x19c29a['id'];}async function getProjectWithName(_0x5a21e5){const _0x1e147e=a20_0x2bf7,{tdx:_0xc6121b,options:_0x2d0c23}=_0x5a21e5,_0x2007d9=_0x2d0c23['llmProject'];if(_0x2007d9){const _0x43e839=await withSpinner(_0x1e147e(0x110)+_0x2007d9+_0x1e147e(0x1d3),()=>_0xc6121b[_0x1e147e(0x162)][_0x1e147e(0x156)](_0x2007d9),{'verbose':_0x2d0c23[_0x1e147e(0x168)]});return{'id':_0x43e839[_0x1e147e(0x1db)],'name':_0x2007d9};}const _0x22b158=_0xc6121b[_0x1e147e(0x162)][_0x1e147e(0x1a6)]();if(_0x22b158){const _0x9f94a7=await _0xc6121b[_0x1e147e(0x162)][_0x1e147e(0x181)](),_0x4e3569=_0x9f94a7['find'](_0x14afa1=>_0x14afa1['id']===_0x22b158);return{'id':_0x22b158,'name':_0x4e3569?.[_0x1e147e(0x1bd)]['name']||_0x1e147e(0x194)};}const _0x24e083=await withSpinner(_0x1e147e(0x18d),()=>_0xc6121b[_0x1e147e(0x162)]['getOrCreateDefaultProject'](),{'verbose':_0x2d0c23[_0x1e147e(0x168)]});return{'id':_0x24e083[_0x1e147e(0x1db)]['id'],'name':_0x24e083[_0x1e147e(0x1db)][_0x1e147e(0x1bd)][_0x1e147e(0x1b7)]};}function toLLMProjectInfo(_0x5f0efb){const _0x468e7f=a20_0x2bf7;return{'name':_0x5f0efb['attributes']['name'],'description':_0x5f0efb[_0x468e7f(0x1bd)][_0x468e7f(0x127)],'createdAt':_0x5f0efb[_0x468e7f(0x1bd)]['createdAt'],'updatedAt':_0x5f0efb[_0x468e7f(0x1bd)][_0x468e7f(0x199)]};}function a20_0x1ef8(){const _0x1588fb=['targetKnowledgeBase','Usage:\x20','filter','616KsdEKM','Delete\x20an\x20agent','[content]','\x20\x20Prompts:\x20','model','tool','history','Updating\x20agent...','dryRun','magenta','List\x20available\x20LLM\x20models','[error]\x20\x20','resolveProjectId','error','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','List\x20all\x20LLM\x20projects','Fetching\x20agent...','split','updateAgent','join','Show\x20agent\x20details','includes','outputDir','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','llm','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','lastConversationAt','json','execute','getTime','verbose','dim','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','1076612uNLISh','Fetching\x20chat\x20sessions...','llm:agents','default','cause','Agent\x20created:\x20','just\x20now','llm:models','entries','targetImageGenerator','knowledgeBases','[image]\x20\x20','Error:\x20Backup\x20folder\x20path\x20is\x20required','keys','llm:project:delete','deleteProject','llm:use','\x20\x20Agents:\x20','jsonl','[input]\x20\x20','substring','Output\x20directory\x20\x27','projects','rmSync','[output]\x20','🤖\x20','systemPrompt','setCurrentProject','\x27\x20already\x20exists.\x20Overwrite?','Project\x20context\x20set\x20to:\x20','stack','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','(no\x20agent)','chatId','Getting\x20default\x20project...','Resolving\x20agent\x20\x27','cyan','llm:projects','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','tsv','Restore\x20cancelled.','Unknown','tool_call','localeCompare','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','\x20->\x20WebSearch:','updatedAt','chats','find','[unknown]','Set\x20current\x20project\x20context','starterMessage','agents','Restoring\x20project\x20from\x20\x27','\x20-\x20','No\x20projects\x20found','stringify','\x20bytes)','slice','getCurrentProject','No\x20messages\x20found\x20in\x20chat\x20history.','floor','projectName','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','Update\x20an\x20existing\x20agent','string','\x20->\x20Agent:','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','format','map','1014Iikjvz','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','createProject','name','llm:agent:update','2110220puetwu','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','message','\x20->\x20KB:','attributes','Backup\x20cancelled.','backupProject','agentId','Project\x20restored:\x20','site','\x20\x20\x20Examples:','toLocaleDateString','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','yellow','exportedFrom','maxToolIterations','Load\x20more...','llm:history','agent','llm:project:restore','Fetching\x20agents...','models','8OcEMsz','h\x20ago','409095bWJEuS','length','\x27...','short','targetWebSearchTool','bold','Validating\x20backup\x20from\x20\x27','existsSync','integrations','yes','data','deleteAgent','2776116VruOYR','7dOPovz','__load_more__','\x20\x20Cause:\x20','.llm','sort','Error:\x20Project\x20name\x20is\x20required','Backing\x20up\x20project\x20\x27','green','Resolving\x20project\x20\x27','\x20->\x20ImageGen:','Project\x20backed\x20up\x20to:\x20','push','log','prompts','33dCClmT','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','llm:agent:delete','targetAgent','Project\x20deleted:\x20','output','List\x20agents\x20in\x20current\x20project','Fetching\x20available\x20models...','Invalid\x20path\x20syntax:\x20','Error:\x20Agent\x20name\x20is\x20required','counts','Checking\x20for\x20existing\x20projects...','Fetching\x20projects...','llm:agent:show','resolveAgentId','\x20\x20Integrations:\x20','INVALID_ARGUMENT','description','image','tdx\x20chats','limit','claude-4.5-haiku','content','Creating\x20agent\x20\x27','Deleting\x20agent...','⚒️\x20','280305WyYDeq','...','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','prompt','sourceSite','temperature','Error:\x20','llm:project:backup','\x0aCancelled','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','(no\x20message)','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','Delete\x20an\x20LLM\x20project','all','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','d\x20ago','[tool]\x20\x20\x20','1944200dcKPks','[tool_call]','toLowerCase','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','\x20agent(s)','table'];a20_0x1ef8=function(){return _0x1588fb;};return a20_0x1ef8();}function toAgentInfo(_0x8e3db9){const _0x20cfc3=a20_0x2bf7;return{'name':_0x8e3db9[_0x20cfc3(0x1bd)][_0x20cfc3(0x1b7)],'description':_0x8e3db9[_0x20cfc3(0x1bd)][_0x20cfc3(0x127)],'prompt':truncatePrompt(_0x8e3db9[_0x20cfc3(0x1bd)][_0x20cfc3(0x133)]),'createdAt':_0x8e3db9['attributes']['createdAt'],'updatedAt':_0x8e3db9['attributes']['updatedAt']};}function truncatePrompt(_0x7c6966){const _0xce836=a20_0x2bf7;if(!_0x7c6966)return undefined;const _0x146224=0x64;if(_0x7c6966[_0xce836(0x1d2)]<=_0x146224)return _0x7c6966;return _0x7c6966[_0xce836(0x1a5)](0x0,_0x146224)+'...';}export class LLMModelsCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x172);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x154);async[a20_0x23a27f(0x166)](_0x29b034){const _0x269866=a20_0x23a27f,{options:_0x272fd2,tdx:_0x1aac29}=_0x29b034;try{const _0x3b55a7=await withSpinner(_0x269866(0x11d),()=>_0x1aac29[_0x269866(0x162)][_0x269866(0x1ce)](),{'verbose':_0x272fd2[_0x269866(0x168)]});return await handleSDKOutput(_0x3b55a7[_0x269866(0x1db)],_0x272fd2),0x0;}catch(_0x3a53fa){return handleSDKError(_0x3a53fa,_0x272fd2),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x190);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x159);async[a20_0x23a27f(0x166)](_0x2ad58c){const _0x43982b=a20_0x23a27f,{options:_0x473e65,args:_0x2f8221,tdx:_0x987cb5}=_0x2ad58c,_0x3d5bc6=getChalk(_0x473e65),_0x4c7ba9=_0x473e65['site'];try{const _0x559a3f=_0x2f8221[0x0],_0x3f97a9=resolveLimit(_0x473e65[_0x43982b(0x12a)],DEFAULT_LLM_LIMIT),_0x8dd9c0=await withSpinner(_0x43982b(0x122),()=>_0x987cb5['llm'][_0x43982b(0x181)](_0x3f97a9),{'verbose':_0x473e65[_0x43982b(0x168)]});let _0x5307e4=_0x8dd9c0[_0x43982b(0x1db)];_0x559a3f&&(_0x5307e4=_0x8dd9c0[_0x43982b(0x1db)][_0x43982b(0x149)](_0x25019d=>matchGlobPattern(_0x25019d[_0x43982b(0x1bd)][_0x43982b(0x1b7)],_0x559a3f)));const _0x19500b=_0x473e65['format']==='json'||_0x473e65[_0x43982b(0x1b1)]===_0x43982b(0x17d)||_0x473e65['format']===_0x43982b(0x146)||_0x473e65['format']===_0x43982b(0x192);if(_0x19500b){const _0x35b019=_0x5307e4[_0x43982b(0x1b2)](_0x3d6da0=>({...toLLMProjectInfo(_0x3d6da0),'url':getLLMProjectUrl(_0x4c7ba9,_0x3d6da0['id'])}));await handleSDKOutput(_0x35b019,_0x473e65);}else{const _0x59d4c8=[];if(_0x5307e4['length']===0x0)_0x59d4c8[_0x43982b(0x113)](_0x3d5bc6[_0x43982b(0x169)](_0x43982b(0x1a2)));else{const _0x20360d=[..._0x5307e4][_0x43982b(0x10c)]((_0x53b306,_0x38851f)=>_0x53b306[_0x43982b(0x1bd)]['name'][_0x43982b(0x196)](_0x38851f[_0x43982b(0x1bd)][_0x43982b(0x1b7)]));for(const _0x39e48c of _0x20360d){const _0xedcee7=getLLMProjectUrl(_0x4c7ba9,_0x39e48c['id']),_0x1add10=hyperlink(_0x39e48c[_0x43982b(0x1bd)][_0x43982b(0x1b7)],_0xedcee7);_0x59d4c8[_0x43982b(0x113)](_0x43982b(0x12f)+_0x1add10);}_0x59d4c8['push'](_0x3d5bc6[_0x43982b(0x169)](_0x5307e4[_0x43982b(0x1d2)]+'\x20project(s)'));}await writeOutput(_0x59d4c8[_0x43982b(0x15d)]('\x0a'),_0x473e65[_0x43982b(0x11b)],'table');}return 0x0;}catch(_0x1361ea){return handleSDKError(_0x1361ea,_0x473e65),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x16d);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x11c);async[a20_0x23a27f(0x166)](_0x6e6e39){const _0x196511=a20_0x23a27f,{options:_0x497450,args:_0x58a0cd,tdx:_0x273df3}=_0x6e6e39,_0x219321=getChalk(_0x497450),_0x2c28e7=_0x497450[_0x196511(0x1c2)];try{const _0x4959cd=_0x58a0cd[0x0];let _0x2ebabc=_0x4959cd,_0x184626,_0x16fc97;if(_0x4959cd&&_0x4959cd[_0x196511(0x15f)]('/')){const _0x3d54d4=_0x4959cd[_0x196511(0x15b)]('/');if(_0x3d54d4[_0x196511(0x1d2)]===0x2){const [_0x1b15c2,_0x337ec0]=_0x3d54d4,_0xa94f2e=await _0x273df3[_0x196511(0x162)][_0x196511(0x181)](),_0x40b426=_0xa94f2e[_0x196511(0x19b)](_0x472ea4=>_0x472ea4[_0x196511(0x1bd)][_0x196511(0x1b7)][_0x196511(0x143)]()===_0x1b15c2[_0x196511(0x143)]());if(!_0x40b426)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x1b15c2,undefined,{'helpText':_0x196511(0x117)});_0x184626=_0x40b426['id'],_0x16fc97=_0x40b426[_0x196511(0x1bd)][_0x196511(0x1b7)],_0x2ebabc=_0x337ec0;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0x4959cd,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else{const _0x2d2848=await getProjectWithName(_0x6e6e39);_0x184626=_0x2d2848['id'],_0x16fc97=_0x2d2848[_0x196511(0x1b7)];}const _0x203089=await withSpinner(_0x196511(0x1cd),()=>_0x273df3[_0x196511(0x162)][_0x196511(0x19f)](_0x184626),{'verbose':_0x497450[_0x196511(0x168)]});let _0x26edba=_0x203089[_0x196511(0x1db)];_0x2ebabc&&(_0x26edba=_0x203089[_0x196511(0x1db)][_0x196511(0x149)](_0x23c5a7=>matchGlobPattern(_0x23c5a7['attributes'][_0x196511(0x1b7)],_0x2ebabc)));const _0x5811d5=_0x497450['format']==='json'||_0x497450['format']===_0x196511(0x17d)||_0x497450[_0x196511(0x1b1)]==='table'||_0x497450['format']==='tsv';if(_0x5811d5){const _0x416ce5=_0x26edba[_0x196511(0x1b2)](_0x235daf=>({...toAgentInfo(_0x235daf),'chatUrl':getLLMAgentChatUrl(_0x2c28e7,_0x184626,_0x235daf['id'])}));await handleSDKOutput(_0x416ce5,_0x497450);}else{const _0x2030b9=[];_0x2030b9[_0x196511(0x113)](_0x219321[_0x196511(0x169)]('['+_0x16fc97+']'));if(_0x26edba[_0x196511(0x1d2)]===0x0)_0x2030b9[_0x196511(0x113)](_0x219321['dim']('No\x20agents\x20found'));else{const _0x498a3d=[..._0x26edba]['sort']((_0x28c906,_0x2e2110)=>_0x28c906[_0x196511(0x1bd)][_0x196511(0x1b7)]['localeCompare'](_0x2e2110[_0x196511(0x1bd)][_0x196511(0x1b7)]));for(const _0x78571c of _0x498a3d){const _0x32e906=getLLMAgentChatUrl(_0x2c28e7,_0x184626,_0x78571c['id']),_0x576c8f=hyperlink(_0x78571c[_0x196511(0x1bd)][_0x196511(0x1b7)],_0x32e906);_0x2030b9['push'](_0x196511(0x184)+_0x576c8f);}_0x2030b9[_0x196511(0x113)](_0x219321['dim'](_0x26edba[_0x196511(0x1d2)]+_0x196511(0x145)));}await writeOutput(_0x2030b9[_0x196511(0x15d)]('\x0a'),_0x497450[_0x196511(0x11b)],_0x196511(0x146));}return 0x0;}catch(_0x265825){return handleSDKError(_0x265825,_0x497450),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x123);['description']=a20_0x23a27f(0x15e);async[a20_0x23a27f(0x166)](_0x406a59){const _0x26b94c=a20_0x23a27f,{options:_0x425c82,args:_0x3322b8,tdx:_0x968f3b}=_0x406a59;if(_0x3322b8[_0x26b94c(0x1d2)]===0x0)return console[_0x26b94c(0x157)](_0x26b94c(0x11f)),console['error'](_0x26b94c(0x139)),0x1;const _0x236617=_0x3322b8[0x0];try{const _0x57f65b=await getProjectIdOrDefault(_0x406a59),_0xb02f98=await withSpinner(_0x26b94c(0x18e)+_0x236617+_0x26b94c(0x1d3),()=>_0x968f3b[_0x26b94c(0x162)]['resolveAgentId'](_0x236617,_0x57f65b),{'verbose':_0x425c82[_0x26b94c(0x168)]}),_0x160821=await withSpinner(_0x26b94c(0x15a),()=>_0x968f3b['llm'][_0x26b94c(0x1cb)](_0xb02f98['data']),{'verbose':_0x425c82[_0x26b94c(0x168)]});return await handleSDKOutput([_0x160821[_0x26b94c(0x1db)]],_0x425c82),0x0;}catch(_0x2d7f60){return handleSDKError(_0x2d7f60,_0x425c82),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]='llm:agent:create';['description']='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a20_0x23a27f(0x166)](_0x2b0027){const _0x2074f4=a20_0x23a27f,{options:_0x49f114,args:_0x22ed81,tdx:_0x3e8129}=_0x2b0027;if(_0x22ed81['length']===0x0)return console[_0x2074f4(0x157)](_0x2074f4(0x11f)),console[_0x2074f4(0x157)](_0x2074f4(0x13e)),console[_0x2074f4(0x157)](_0x2074f4(0x132)),0x1;const _0x20c368=_0x22ed81[0x0],_0xfd517a=_0x49f114,_0x18289d=_0xfd517a[_0x2074f4(0x185)],_0x5f257d=_0xfd517a[_0x2074f4(0x14e)]||_0x2074f4(0x12b),_0x21e7ab=_0xfd517a[_0x2074f4(0x19e)],_0x132a37=_0xfd517a['maxToolIterations']?Number(_0xfd517a[_0x2074f4(0x1c8)]):undefined,_0x4d5cf5=_0xfd517a[_0x2074f4(0x135)]?Number(_0xfd517a[_0x2074f4(0x135)]):undefined;try{let _0x5c9161,_0x402ae8;if(_0x20c368[_0x2074f4(0x15f)]('/')){const _0x38fe30=_0x20c368[_0x2074f4(0x15b)]('/');if(_0x38fe30[_0x2074f4(0x1d2)]===0x2){const [_0xb932fb,_0x5a8043]=_0x38fe30,_0x343a3d=await withSpinner(_0x2074f4(0x110)+_0xb932fb+_0x2074f4(0x1d3),()=>_0x3e8129[_0x2074f4(0x162)][_0x2074f4(0x156)](_0xb932fb),{'verbose':_0x49f114[_0x2074f4(0x168)]});_0x5c9161=_0x343a3d[_0x2074f4(0x1db)],_0x402ae8=_0x5a8043;}else throw new SDKError(ErrorCode[_0x2074f4(0x126)],_0x2074f4(0x11e)+_0x20c368,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x5c9161=await getProjectIdOrDefault(_0x2b0027),_0x402ae8=_0x20c368;const _0x2db9c2=await withSpinner(_0x2074f4(0x12d)+_0x402ae8+'\x27...',()=>_0x3e8129[_0x2074f4(0x162)]['createAgent']({'name':_0x402ae8,'projectId':_0x5c9161,'modelType':_0x5f257d,'systemPrompt':_0x18289d,'starterMessage':_0x21e7ab,'maxToolIterations':_0x132a37,'temperature':_0x4d5cf5}),{'verbose':_0x49f114[_0x2074f4(0x168)]});return console[_0x2074f4(0x114)](_0x2074f4(0x170)+_0x2db9c2[_0x2074f4(0x1db)]['id']),await handleSDKOutput([_0x2db9c2[_0x2074f4(0x1db)]],_0x49f114),0x0;}catch(_0x4e60a3){return handleSDKError(_0x4e60a3,_0x49f114),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x1b8);['description']=a20_0x23a27f(0x1ac);async[a20_0x23a27f(0x166)](_0x14d0b7){const _0x54b805=a20_0x23a27f,{options:_0x44b763,args:_0x209b10,tdx:_0x2be598}=_0x14d0b7;if(_0x209b10['length']===0x0)return console[_0x54b805(0x157)](_0x54b805(0x11f)),console[_0x54b805(0x157)]('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x3b56d3=_0x209b10[0x0],_0x760499=_0x44b763,_0x50ad85=_0x760499[_0x54b805(0x1b7)],_0x213bd1=_0x760499[_0x54b805(0x133)],_0x5a1b20=_0x760499[_0x54b805(0x127)],_0x282971=_0x760499[_0x54b805(0x19e)];if(!_0x50ad85&&!_0x213bd1&&!_0x5a1b20&&!_0x282971)return console[_0x54b805(0x157)]('Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required'),console[_0x54b805(0x157)](_0x54b805(0x163)),0x1;try{const _0x13b532=await getProjectIdOrDefault(_0x14d0b7),_0x4c9c38=await withSpinner(_0x54b805(0x18e)+_0x3b56d3+_0x54b805(0x1d3),()=>_0x2be598[_0x54b805(0x162)][_0x54b805(0x124)](_0x3b56d3,_0x13b532),{'verbose':_0x44b763[_0x54b805(0x168)]}),_0x52da93=_0x4c9c38[_0x54b805(0x1db)],_0x5c3496=await withSpinner(_0x54b805(0x151),()=>_0x2be598[_0x54b805(0x162)][_0x54b805(0x15c)](_0x52da93,{'name':_0x50ad85,'prompt':_0x213bd1,'description':_0x5a1b20,'starterMessage':_0x282971}),{'verbose':_0x44b763[_0x54b805(0x168)]});return console[_0x54b805(0x114)]('Agent\x20updated:\x20'+_0x5c3496[_0x54b805(0x1db)]['id']),await handleSDKOutput([_0x5c3496['data']],_0x44b763),0x0;}catch(_0x289cfd){return handleSDKError(_0x289cfd,_0x44b763),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x118);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x14b);async[a20_0x23a27f(0x166)](_0x880776){const _0x9381d5=a20_0x23a27f,{options:_0x342c52,args:_0x5cb734,tdx:_0x5210d7}=_0x880776;if(_0x5cb734[_0x9381d5(0x1d2)]===0x0)return console[_0x9381d5(0x157)](_0x9381d5(0x11f)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x174b1c=_0x5cb734[0x0];try{const _0x546eb4=await getProjectIdOrDefault(_0x880776),_0x1ce1dd=await withSpinner(_0x9381d5(0x18e)+_0x174b1c+_0x9381d5(0x1d3),()=>_0x5210d7[_0x9381d5(0x162)][_0x9381d5(0x124)](_0x174b1c,_0x546eb4),{'verbose':_0x342c52['verbose']}),_0x2e53f9=_0x1ce1dd['data'];return await withSpinner(_0x9381d5(0x12e),()=>_0x5210d7['llm'][_0x9381d5(0x1dc)](_0x2e53f9),{'verbose':_0x342c52[_0x9381d5(0x168)]}),console[_0x9381d5(0x114)]('Agent\x20deleted:\x20'+_0x2e53f9),0x0;}catch(_0x62fb4a){return handleSDKError(_0x62fb4a,_0x342c52),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a20_0x23a27f(0x1ca);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x1ba);async['execute'](_0x43041c){return executeChatHistoryCommand(_0x43041c,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x17b);['description']=a20_0x23a27f(0x19d);async[a20_0x23a27f(0x166)](_0x4990a2){const _0x495a91=a20_0x23a27f,{options:_0x15370f,args:_0x40861c,tdx:_0x2c030e}=_0x4990a2;if(_0x40861c[_0x495a91(0x1d2)]===0x0)return console[_0x495a91(0x157)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x495a91(0x157)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x37b6c9=_0x40861c[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x37b6c9+_0x495a91(0x1d3),()=>_0x2c030e[_0x495a91(0x162)][_0x495a91(0x186)](_0x37b6c9),{'verbose':_0x15370f['verbose']}),console['log'](_0x495a91(0x188)+_0x37b6c9),0x0;}catch(_0x4f0cf9){return handleSDKError(_0x4f0cf9,_0x15370f),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]='llm:project:create';[a20_0x23a27f(0x127)]='Create\x20a\x20new\x20LLM\x20project';async[a20_0x23a27f(0x166)](_0x405de9){const _0x3f65cf=a20_0x23a27f,{options:_0x3e0374,args:_0x37e95e,tdx:_0x37740d}=_0x405de9;if(_0x37e95e[_0x3f65cf(0x1d2)]===0x0)return console['error'](_0x3f65cf(0x10d)),console[_0x3f65cf(0x157)](_0x3f65cf(0x18a)),0x1;const _0x5241ba=_0x37e95e[0x0],_0x226f02=_0x3e0374,_0x1812dc=_0x226f02[_0x3f65cf(0x127)];try{const _0x20176e=await withSpinner('Creating\x20project\x20\x27'+_0x5241ba+_0x3f65cf(0x1d3),()=>_0x37740d[_0x3f65cf(0x162)][_0x3f65cf(0x1b6)]({'name':_0x5241ba,'description':_0x1812dc}),{'verbose':_0x3e0374['verbose']});console[_0x3f65cf(0x114)]('Project\x20created:\x20'+_0x20176e[_0x3f65cf(0x1db)]['id']);const _0x430c90=toLLMProjectInfo(_0x20176e[_0x3f65cf(0x1db)]);return await handleSDKOutput([_0x430c90],_0x3e0374),0x0;}catch(_0x1bda66){return handleSDKError(_0x1bda66,_0x3e0374),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{['name']=a20_0x23a27f(0x179);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x13c);async[a20_0x23a27f(0x166)](_0x20f6e6){const _0x24486a=a20_0x23a27f,{options:_0x4fbc66,args:_0x4f9436,tdx:_0x2ac19e}=_0x20f6e6;if(_0x4f9436[_0x24486a(0x1d2)]===0x0)return console[_0x24486a(0x157)](_0x24486a(0x10d)),console[_0x24486a(0x157)](_0x24486a(0x16a)),0x1;const _0x899110=_0x4f9436[0x0];try{return await withSpinner('Deleting\x20project\x20\x27'+_0x899110+'\x27...',()=>_0x2ac19e['llm'][_0x24486a(0x17a)](_0x899110),{'verbose':_0x4fbc66[_0x24486a(0x168)]}),console[_0x24486a(0x114)](_0x24486a(0x11a)+_0x899110),0x0;}catch(_0x1ab1d3){return handleSDKError(_0x1ab1d3,_0x4fbc66),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a20_0x23a27f(0x137);[a20_0x23a27f(0x127)]='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)';async[a20_0x23a27f(0x166)](_0x433aa0){const _0x4f3cb2=a20_0x23a27f,{options:_0x2a2aad,args:_0x1d7d6e,tdx:_0x4b82a4}=_0x433aa0,_0x2cc2bc=getChalk(_0x2a2aad);console[_0x4f3cb2(0x114)](_0x2cc2bc[_0x4f3cb2(0x1c6)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x4f3cb2(0x114)](_0x2cc2bc[_0x4f3cb2(0x1c6)](_0x4f3cb2(0x1af))),console[_0x4f3cb2(0x114)](_0x2cc2bc[_0x4f3cb2(0x169)](_0x4f3cb2(0x191))),console[_0x4f3cb2(0x114)]();if(_0x1d7d6e[_0x4f3cb2(0x1d2)]===0x0)return console[_0x4f3cb2(0x157)](_0x4f3cb2(0x10d)),console[_0x4f3cb2(0x157)](_0x4f3cb2(0x1b5)),0x1;const _0x34926b=_0x1d7d6e[0x0],_0x5d0c30=_0x2a2aad,_0x107dce=_0x5d0c30['output'],_0x1448a0=_0x5d0c30[_0x4f3cb2(0x152)];try{const _0x519de1=_0x107dce||_0x34926b+_0x4f3cb2(0x10b);if(a20_0x20fe6b[_0x4f3cb2(0x1d8)](_0x519de1)&&!_0x1448a0){if(!_0x2a2aad[_0x4f3cb2(0x1da)]){const _0x166304=await confirm(_0x4f3cb2(0x180)+_0x519de1+_0x4f3cb2(0x187));if(!_0x166304)return console[_0x4f3cb2(0x114)](_0x4f3cb2(0x1be)),0x0;}a20_0x20fe6b[_0x4f3cb2(0x182)](_0x519de1,{'recursive':!![]});}const _0x591f68=await withSpinner(_0x1448a0?'Analyzing\x20project\x20\x27'+_0x34926b+_0x4f3cb2(0x1d3):_0x4f3cb2(0x10e)+_0x34926b+_0x4f3cb2(0x1d3),()=>_0x4b82a4[_0x4f3cb2(0x162)][_0x4f3cb2(0x1bf)](_0x34926b,_0x107dce,{'dryRun':_0x1448a0}),{'verbose':_0x2a2aad['verbose']}),_0x4be551=_0x591f68[_0x4f3cb2(0x1db)];return _0x1448a0?console[_0x4f3cb2(0x114)](_0x4f3cb2(0x1b0)+_0x4be551['outputDir']):console['log'](_0x4f3cb2(0x112)+_0x4be551[_0x4f3cb2(0x160)]),console[_0x4f3cb2(0x114)](_0x4f3cb2(0x17c)+_0x4be551['counts']['agents']),console['log']('\x20\x20Knowledge\x20Bases:\x20'+_0x4be551['counts'][_0x4f3cb2(0x175)]),console[_0x4f3cb2(0x114)](_0x4f3cb2(0x14d)+_0x4be551[_0x4f3cb2(0x120)]['prompts']),console[_0x4f3cb2(0x114)](_0x4f3cb2(0x125)+_0x4be551[_0x4f3cb2(0x120)][_0x4f3cb2(0x1d9)]),(_0x2a2aad[_0x4f3cb2(0x1b1)]===_0x4f3cb2(0x165)||_0x2a2aad['format']===_0x4f3cb2(0x17d))&&await handleSDKOutput([_0x4be551],_0x2a2aad),0x0;}catch(_0x414a93){return handleSDKError(_0x414a93,_0x2a2aad),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x1cc);[a20_0x23a27f(0x127)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a20_0x23a27f(0x166)](_0x3297ad){const _0x443b7c=a20_0x23a27f,{options:_0x4aad18,args:_0x45dc87,tdx:_0x18b0bc}=_0x3297ad,_0x55599b=getChalk(_0x4aad18);console[_0x443b7c(0x114)](_0x55599b['yellow'](_0x443b7c(0x13b))),console[_0x443b7c(0x114)](_0x55599b[_0x443b7c(0x1c6)](_0x443b7c(0x158))),console['log'](_0x55599b[_0x443b7c(0x169)](_0x443b7c(0x1c3))),console[_0x443b7c(0x114)](_0x55599b[_0x443b7c(0x169)](_0x443b7c(0x1c5))),console[_0x443b7c(0x114)](_0x55599b['dim'](_0x443b7c(0x1ab))),console[_0x443b7c(0x114)]();if(_0x45dc87['length']===0x0)return console[_0x443b7c(0x157)](_0x443b7c(0x177)),console['error'](_0x443b7c(0x1aa)),0x1;const _0x5d5224=_0x45dc87[0x0],_0x2cf077=_0x4aad18,_0x4584a8=_0x2cf077[_0x443b7c(0x1b7)],_0x210986=_0x2cf077['dryRun'];try{if(!_0x210986){const _0x2ceb85=_0x18b0bc['llm']['getBackupMetadata'](_0x5d5224),_0x377d08=_0x4584a8||_0x2ceb85[_0x443b7c(0x1c7)][_0x443b7c(0x1a9)],_0x490f1d=await withSpinner(_0x443b7c(0x121),()=>_0x18b0bc[_0x443b7c(0x162)][_0x443b7c(0x181)](),{'verbose':_0x4aad18['verbose']}),_0x46d2d5=_0x490f1d[_0x443b7c(0x1db)][_0x443b7c(0x19b)](_0x24ab10=>_0x24ab10['attributes'][_0x443b7c(0x1b7)]===_0x377d08);if(_0x46d2d5&&!_0x4aad18[_0x443b7c(0x1da)]){const _0x5639e1=await confirm('A\x20project\x20named\x20\x27'+_0x377d08+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x5639e1)return console['log'](_0x443b7c(0x193)),0x0;}}const _0xfbdbcf=await withSpinner(_0x210986?_0x443b7c(0x1d7)+_0x5d5224+'\x27...':_0x443b7c(0x1a0)+_0x5d5224+'\x27...',()=>_0x18b0bc[_0x443b7c(0x162)]['restoreProject'](_0x5d5224,{'name':_0x4584a8,'dryRun':_0x210986}),{'verbose':_0x4aad18[_0x443b7c(0x168)]}),_0x193b8b=_0xfbdbcf[_0x443b7c(0x1db)];return _0x193b8b['sourceSite']&&console[_0x443b7c(0x114)](_0x443b7c(0x1b4)+_0x193b8b[_0x443b7c(0x134)]+'\x27'),_0x210986?console['log'](_0x443b7c(0x161)+_0x193b8b[_0x443b7c(0x1a9)]):console[_0x443b7c(0x114)](_0x443b7c(0x1c1)+_0x193b8b[_0x443b7c(0x1a9)]+'\x20('+_0x193b8b['projectId']+')'),console[_0x443b7c(0x114)](_0x443b7c(0x17c)+_0x193b8b[_0x443b7c(0x120)][_0x443b7c(0x19f)]),console[_0x443b7c(0x114)]('\x20\x20Knowledge\x20Bases:\x20'+_0x193b8b[_0x443b7c(0x120)][_0x443b7c(0x175)]),console['log'](_0x443b7c(0x14d)+_0x193b8b['counts'][_0x443b7c(0x115)]),console[_0x443b7c(0x114)](_0x443b7c(0x125)+_0x193b8b['counts']['integrations']),(_0x4aad18[_0x443b7c(0x1b1)]===_0x443b7c(0x165)||_0x4aad18[_0x443b7c(0x1b1)]===_0x443b7c(0x17d))&&await handleSDKOutput([_0x193b8b],_0x4aad18),0x0;}catch(_0x5e02fa){return handleSDKError(_0x5e02fa,_0x4aad18),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x46d6ca,_0x1735d1){const _0x318e9b=a20_0x23a27f,_0x259274=_0x1735d1['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x542b7a=0x0,_0x53814e=[];const _0xba464a=(await import(_0x318e9b(0x115)))[_0x318e9b(0x16e)],_0x59563c=getChalk(_0x1735d1);while(!![]){const _0x8f0269=await withSpinner(_0x318e9b(0x16c),()=>_0x46d6ca[_0x318e9b(0x162)][_0x318e9b(0x19a)](_0x259274+_0x542b7a),{'verbose':_0x1735d1['verbose']});_0x53814e=_0x8f0269['data'];const _0x182e20=_0x53814e[_0x318e9b(0x1a5)](_0x542b7a,_0x542b7a+_0x259274),_0x5d0e63=_0x53814e['length']>_0x542b7a+_0x259274,_0x1b5e78=[...new Set(_0x182e20[_0x318e9b(0x1b2)](_0x5485e9=>_0x5485e9[_0x318e9b(0x1bd)][_0x318e9b(0x1c0)])[_0x318e9b(0x149)](_0x1dfd75=>_0x1dfd75!==undefined))],_0x35eac3=new Map();await Promise[_0x318e9b(0x13d)](_0x1b5e78[_0x318e9b(0x1b2)](async _0xa18a6d=>{const _0xb9d7c6=_0x318e9b;try{const _0x2c4f9a=await _0x46d6ca[_0xb9d7c6(0x162)]['agent'](_0xa18a6d);_0x35eac3['set'](_0xa18a6d,_0x2c4f9a[_0xb9d7c6(0x1bd)]['name']);}catch{_0x35eac3['set'](_0xa18a6d,_0xa18a6d);}}));const _0x2beb7c=_0x182e20[_0x318e9b(0x1b2)](_0x42b2fe=>{const _0x4b9e4a=_0x318e9b,_0x476a20=_0x42b2fe[_0x4b9e4a(0x1bd)]['firstInputContent']||_0x4b9e4a(0x13a),_0x18b323=_0x476a20[_0x4b9e4a(0x15b)]('\x0a')[0x0],_0x379683=_0x18b323[_0x4b9e4a(0x1d2)]>0x50?_0x18b323[_0x4b9e4a(0x17f)](0x0,0x4d)+_0x4b9e4a(0x131):_0x18b323,_0x2edb34=_0x42b2fe[_0x4b9e4a(0x1bd)][_0x4b9e4a(0x1c0)]?_0x35eac3['get'](_0x42b2fe[_0x4b9e4a(0x1bd)][_0x4b9e4a(0x1c0)])||_0x42b2fe[_0x4b9e4a(0x1bd)]['agentId']:_0x4b9e4a(0x18b),_0x80a6e9=_0x42b2fe[_0x4b9e4a(0x1bd)][_0x4b9e4a(0x164)]||_0x42b2fe[_0x4b9e4a(0x1bd)][_0x4b9e4a(0x199)],_0x5b8c5a=new Date(_0x80a6e9),_0x4efad2=new Date(),_0x54fb44=_0x4efad2[_0x4b9e4a(0x167)]()-_0x5b8c5a[_0x4b9e4a(0x167)](),_0x48e9e5=Math['floor'](_0x54fb44/0xea60),_0x36136d=Math[_0x4b9e4a(0x1a8)](_0x54fb44/0x36ee80),_0x4226cb=Math[_0x4b9e4a(0x1a8)](_0x54fb44/0x5265c00);let _0x3bf27f;if(_0x48e9e5<0x1)_0x3bf27f=_0x4b9e4a(0x171);else{if(_0x48e9e5<0x3c)_0x3bf27f=_0x48e9e5+'m\x20ago';else{if(_0x36136d<0x18)_0x3bf27f=_0x36136d+_0x4b9e4a(0x1d0);else _0x4226cb<0x7?_0x3bf27f=_0x4226cb+_0x4b9e4a(0x13f):_0x3bf27f=_0x5b8c5a[_0x4b9e4a(0x1c4)]('en-US',{'month':_0x4b9e4a(0x1d4),'day':'numeric'});}}return{'title':_0x379683+'\x20'+_0x59563c['dim']('['+_0x2edb34+']\x20'+_0x3bf27f),'value':_0x42b2fe['id']};});_0x5d0e63&&_0x2beb7c[_0x318e9b(0x113)]({'title':_0x59563c['cyan'](_0x318e9b(0x1c9)),'value':_0x318e9b(0x109)});const _0x489410=await _0xba464a({'type':'select','name':_0x318e9b(0x18c),'message':'Select\x20a\x20chat\x20session:','choices':_0x2beb7c,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x489410[_0x318e9b(0x18c)])return undefined;if(_0x489410[_0x318e9b(0x18c)]===_0x318e9b(0x109)){_0x542b7a+=_0x259274;continue;}return _0x489410[_0x318e9b(0x18c)];}}export class ChatsCommand extends BaseCommand{[a20_0x23a27f(0x1b7)]=a20_0x23a27f(0x19a);[a20_0x23a27f(0x127)]=a20_0x23a27f(0x197);async[a20_0x23a27f(0x166)](_0x8051dc){const _0x87355=a20_0x23a27f;return executeChatHistoryCommand(_0x8051dc,_0x87355(0x129));}}
1
+ const a20_0x2a9f52=a20_0x5d68;function a20_0x4238(){const _0x579e78=['last','deleteAgent','Use\x20format:\x20project-name/agent-name','keys','533370AdRitW','llm:project:backup','llm:history','Checking\x20for\x20existing\x20projects...','resolveAgentId','log','get','Analyzing\x20project\x20\x27','[image]\x20\x20','createProject','\x20->\x20Agent:','d\x20ago','No\x20agents\x20found','numeric','getBackupMetadata','agentId','restoreProject','2092860cxAzzC','agent','systemPrompt','sourceSite','llm:agent:update','Fetching\x20most\x20recent\x20chat...','set','4MLZrgj','tsv','[input]\x20\x20','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Fetching\x20agent...','6WifPIW','Backup\x20cancelled.','Output\x20directory\x20\x27','projects','Project\x20not\x20found:\x20','targetKnowledgeBase','resolveProjectId','\x20\x20Integrations:\x20','sort','\x0aStack\x20trace:','llm:agent:delete','llm:agents','Fetching\x20available\x20models...','table','Restoring\x20project\x20from\x20\x27','join','Load\x20more...','stringify','format','77vBiFmV','List\x20all\x20LLM\x20projects','rmSync','getTime','Creating\x20agent\x20\x27','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','integrations','dryRun','\x20\x20\x20Examples:','starterMessage','toLowerCase','Getting\x20default\x20project...','verbose','No\x20chat\x20sessions\x20found.','\x0aCancelled','history','[unknown]','updateAgent','Error:\x20Agent\x20name\x20is\x20required','cyan','en-US','llm:projects','\x20\x20Agents:\x20','Creating\x20project\x20\x27','slice','llm:project:delete','.llm','Invalid\x20path\x20syntax:\x20','maxToolIterations','chats','yellow','INVALID_ARGUMENT','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Project\x20context\x20set\x20to:\x20','(no\x20message)','targetImageGenerator','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','localeCompare','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','all','\x20\x20Cause:\x20','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','Set\x20current\x20project\x20context','updatedAt','description','🤖\x20','[output]\x20','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','name','llm:project:create','tdx\x20llm\x20history','5356375WNkTyY','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','chatId','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','\x27...','Agent\x20deleted:\x20','targetAgent','Resolving\x20project\x20\x27','\x20--last','knowledgeBases','\x20bytes)','616806rzgcKr','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','No\x20messages\x20found\x20in\x20chat\x20history.','Error:\x20','jsonl','site','Project\x20created:\x20','Usage:\x20tdx\x20llm\x20use\x20<project-name>','counts','prompt','List\x20available\x20LLM\x20models','Delete\x20an\x20LLM\x20project','llm:models','floor','tool_call','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','\x20\x20Prompts:\x20','error','includes','Agent\x20updated:\x20','outputDir','split','data','cause','json','existsSync','execute','Project\x20restored:\x20','\x20→\x20chat:\x20','length','Error:\x20Project\x20name\x20is\x20required','prompts','deleteProject','string','blue','message','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','2029769NaJtbD','filter','Agent\x20created:\x20','dim','claude-4.5-haiku','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Project\x20backed\x20up\x20to:\x20','Fetching\x20chat\x20sessions...','Create\x20a\x20new\x20LLM\x20project','createdAt','projectId','llm','bold','attributes','stack','Fetching\x20chat\x20history\x20for\x20\x27','content','Deleting\x20project\x20\x27','llm:project:restore','map','image','llm:agent:show','Resolving\x20agent\x20\x27','\x20agent(s)','getCurrentProject','Usage:\x20','Backing\x20up\x20project\x20\x27','24OCpmNh','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','toLocaleDateString','Setting\x20project\x20context\x20to\x20\x27','output','agents','firstInputContent','List\x20agents\x20in\x20current\x20project','push','magenta','...','Select\x20a\x20chat\x20session:','\x20->\x20ImageGen:','find','Validating\x20backup\x20from\x20\x27','limit','short','temperature','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','A\x20project\x20named\x20\x27','green','1635255OEdmnS','\x20->\x20KB:','tool','\x20\x20Knowledge\x20Bases:\x20','5299168daCghr','m\x20ago','targetWebSearchTool','exportedFrom','projectName','getOrCreateDefaultProject','\x20->\x20WebSearch:','llmProject','__load_more__','red'];a20_0x4238=function(){return _0x579e78;};return a20_0x4238();}(function(_0x1a7a37,_0x5b3799){const _0x3eb40a=a20_0x5d68,_0x27d5d6=_0x1a7a37();while(!![]){try{const _0x175557=-parseInt(_0x3eb40a(0x132))/0x1*(parseInt(_0x3eb40a(0x14a))/0x2)+parseInt(_0x3eb40a(0x1a3))/0x3*(parseInt(_0x3eb40a(0x1e5))/0x4)+-parseInt(_0x3eb40a(0x198))/0x5+parseInt(_0x3eb40a(0x14f))/0x6*(-parseInt(_0x3eb40a(0x1ca))/0x7)+parseInt(_0x3eb40a(0x124))/0x8+-parseInt(_0x3eb40a(0x120))/0x9+parseInt(_0x3eb40a(0x143))/0xa*(parseInt(_0x3eb40a(0x162))/0xb);if(_0x175557===_0x5b3799)break;else _0x27d5d6['push'](_0x27d5d6['shift']());}catch(_0x2de819){_0x27d5d6['push'](_0x27d5d6['shift']());}}}(a20_0x4238,0xb76e5));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a20_0x5f3f39 from'node:fs';function handleSDKError(_0x444714,_0x559101){const _0x751a53=a20_0x5d68;if(_0x444714 instanceof SDKError)console[_0x751a53(0x1b5)](_0x751a53(0x1a6)+_0x444714[_0x751a53(0x1c7)]),_0x559101[_0x751a53(0x16e)]&&(_0x444714[_0x751a53(0x1bb)]&&console['error'](_0x751a53(0x18d)+_0x444714['cause']),_0x444714[_0x751a53(0x1d8)]&&(console[_0x751a53(0x1b5)](_0x751a53(0x158)),console['error'](_0x444714[_0x751a53(0x1d8)])));else throw _0x444714;}function formatChatHistoryEntry(_0x2ad489,_0x4bcc09){const _0x4752c7=a20_0x5d68,_0x22ac2e=getChalk(_0x4bcc09),_0x597eca=_0x22ac2e['dim'](_0x2ad489['at']);if('input'in _0x2ad489){const _0x2d5bbc=_0x22ac2e[_0x4752c7(0x175)](_0x4752c7(0x14c));return _0x597eca+'\x20'+_0x2d5bbc+':\x20'+_0x2ad489['input'];}if(_0x4752c7(0x1da)in _0x2ad489){const _0x88ae17=_0x22ac2e[_0x4752c7(0x11f)]('[content]');return _0x597eca+'\x20'+_0x88ae17+':\x20'+_0x2ad489[_0x4752c7(0x1da)];}if(_0x4752c7(0x1b1)in _0x2ad489){const _0x46c52b=_0x22ac2e[_0x4752c7(0x180)]('[tool_call]'),{functionName:_0x4306ea,functionArguments:_0x20887c,targetFunction:_0x39521f}=_0x2ad489['tool_call'];let _0x31f8c4=_0x597eca+'\x20'+_0x46c52b+':\x20'+_0x22ac2e[_0x4752c7(0x1d6)](_0x4306ea);if(_0x20887c&&Object[_0x4752c7(0x131)](_0x20887c)[_0x4752c7(0x1c1)]>0x0){const _0x2d3b8b=Object['entries'](_0x20887c)[_0x4752c7(0x1dd)](([_0x7040a1,_0xc0e304])=>_0x7040a1+'='+JSON[_0x4752c7(0x160)](_0xc0e304))[_0x4752c7(0x15e)](',\x20');_0x31f8c4+='('+_0x2d3b8b+')';}_0x39521f&&(_0x31f8c4+=_0x22ac2e['dim']('\x20['+_0x39521f+']'));let _0x3e41e1='';if(_0x2ad489[_0x4752c7(0x1b1)][_0x4752c7(0x154)])_0x3e41e1=_0x4752c7(0x121)+_0x2ad489[_0x4752c7(0x1b1)][_0x4752c7(0x154)][_0x4752c7(0x195)];else{if(_0x2ad489[_0x4752c7(0x1b1)][_0x4752c7(0x19e)])_0x3e41e1=_0x4752c7(0x13c)+_0x2ad489[_0x4752c7(0x1b1)][_0x4752c7(0x19e)][_0x4752c7(0x195)];else{if(_0x2ad489[_0x4752c7(0x1b1)]['targetWebSearchTool'])_0x3e41e1=_0x4752c7(0x12a)+_0x2ad489[_0x4752c7(0x1b1)][_0x4752c7(0x126)]['name'];else _0x2ad489[_0x4752c7(0x1b1)][_0x4752c7(0x187)]&&(_0x3e41e1=_0x4752c7(0x117)+_0x2ad489['tool_call']['targetImageGenerator']['name']);}}return _0x31f8c4+_0x3e41e1;}if(_0x4752c7(0x122)in _0x2ad489){const _0x33d0f0=_0x22ac2e[_0x4752c7(0x114)]('[tool]\x20\x20\x20'),{functionName:_0x2c0ff9,functionArguments:_0x4bf1c7,content:_0x5481bd,newChat:_0x5c1315}=_0x2ad489[_0x4752c7(0x122)];let _0x2708e4=_0x597eca+'\x20'+_0x33d0f0+':\x20'+_0x22ac2e[_0x4752c7(0x1d6)](_0x2c0ff9);if(_0x4bf1c7){const _0x15202d=typeof _0x4bf1c7===_0x4752c7(0x1c5)?_0x4bf1c7:JSON[_0x4752c7(0x160)](_0x4bf1c7);_0x2708e4+='('+_0x15202d+')';}return _0x5481bd&&(_0x2708e4+='\x0a'+_0x22ac2e[_0x4752c7(0x1cd)](_0x5481bd)),_0x5c1315&&(_0x2708e4+=_0x22ac2e['dim'](_0x4752c7(0x1c0)+_0x5c1315['id'])),_0x2708e4;}if(_0x4752c7(0x1e9)in _0x2ad489){const _0x513a1e=_0x22ac2e[_0x4752c7(0x1c6)](_0x4752c7(0x193));return _0x597eca+'\x20'+_0x513a1e+':\x20'+_0x2ad489[_0x4752c7(0x1e9)]['name']+'\x20('+_0x2ad489['output']['content'][_0x4752c7(0x1c1)]+_0x4752c7(0x1a2);}if(_0x4752c7(0x1de)in _0x2ad489){const _0x2553d5=_0x22ac2e[_0x4752c7(0x1c6)](_0x4752c7(0x13a)),{width:_0x31feca,height:_0x5e0824,headerText:_0x2928fe}=_0x2ad489[_0x4752c7(0x1de)],_0x8791c6=_0x2928fe?'\x20-\x20'+_0x2928fe:'';return _0x597eca+'\x20'+_0x2553d5+':\x20'+_0x31feca+'x'+_0x5e0824+_0x8791c6;}if(_0x4752c7(0x1b5)in _0x2ad489){const _0x571680=_0x22ac2e[_0x4752c7(0x12d)]('[error]\x20\x20');return _0x597eca+'\x20'+_0x571680+':\x20'+_0x2ad489['error'];}return _0x597eca+'\x20'+_0x22ac2e[_0x4752c7(0x1cd)](_0x4752c7(0x172))+':\x20'+JSON['stringify'](_0x2ad489);}async function executeChatHistoryCommand(_0x3c148b,_0x813324){const _0x3a6376=a20_0x5d68,{options:_0xc4b853,args:_0x12e127,tdx:_0x40e1d8}=_0x3c148b,_0x225754=_0x12e127[0x0],_0x256115=_0xc4b853,_0x47625b=_0x256115[_0x3a6376(0x12e)];try{if(_0x47625b&&_0x225754)return console[_0x3a6376(0x1b5)](_0x3a6376(0x11d)),console[_0x3a6376(0x1b5)](_0x3a6376(0x1e3)+_0x813324+_0x3a6376(0x1a0)),0x1;if(!_0x225754&&!_0x47625b&&_0xc4b853['format']!==undefined){const _0xef5f1f=resolveLimit(_0xc4b853[_0x3a6376(0x11a)],DEFAULT_LLM_LIMIT),_0xe60e85=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x40e1d8[_0x3a6376(0x1d5)][_0x3a6376(0x17f)](_0xef5f1f),{'verbose':_0xc4b853[_0x3a6376(0x16e)]});return await handleSDKOutput(_0xe60e85[_0x3a6376(0x1ba)],_0xc4b853),0x0;}const _0x22dd88=await getChatIdOrSelect(_0x40e1d8,_0xc4b853,_0x47625b,_0x225754);if(!_0x22dd88)return 0x0;return await displayChatHistory(_0x22dd88,_0x40e1d8,_0xc4b853),0x0;}catch(_0x21baef){return handleSDKError(_0x21baef,_0xc4b853),0x1;}}async function displayChatHistory(_0x1285c4,_0x642d83,_0x43245a){const _0x283390=a20_0x5d68,_0x28dec7=await withSpinner(_0x283390(0x1d9)+_0x1285c4+_0x283390(0x19c),()=>_0x642d83[_0x283390(0x1d5)][_0x283390(0x171)](_0x1285c4),{'verbose':_0x43245a[_0x283390(0x16e)]}),_0x5bd728=_0x28dec7[_0x283390(0x1ba)][_0x283390(0x1ba)]??[];if(_0x5bd728[_0x283390(0x1c1)]===0x0){console[_0x283390(0x137)](_0x283390(0x1a5));return;}if(_0x43245a[_0x283390(0x161)]!==undefined)await handleSDKOutput(_0x5bd728,_0x43245a);else{const _0x17e508=_0x5bd728['map'](_0x4bd0de=>formatChatHistoryEntry(_0x4bd0de,_0x43245a)),_0x3fea9a=_0x17e508[_0x283390(0x15e)]('\x0a');await writeOutput(_0x3fea9a,_0x43245a[_0x283390(0x1e9)],'table');}}async function getChatIdOrSelect(_0x4b5258,_0x42898d,_0x51b7b9,_0x339a62){const _0x2120df=a20_0x5d68;if(_0x339a62)return _0x339a62;if(_0x51b7b9){const _0x4b4a10=await withSpinner(_0x2120df(0x148),()=>_0x4b5258[_0x2120df(0x1d5)][_0x2120df(0x17f)](0x1),{'verbose':_0x42898d[_0x2120df(0x16e)]});if(_0x4b4a10[_0x2120df(0x1ba)][_0x2120df(0x1c1)]===0x0)return console['log'](_0x2120df(0x16f)),undefined;return _0x4b4a10[_0x2120df(0x1ba)][0x0]['id'];}const _0xbe93fe=await selectChatInteractively(_0x4b5258,_0x42898d);if(!_0xbe93fe)return console[_0x2120df(0x137)](_0x2120df(0x170)),undefined;return _0xbe93fe;}async function getProjectIdOrDefault(_0x3c96ef){const _0x52e7d0=await getProjectWithName(_0x3c96ef);return _0x52e7d0['id'];}async function getProjectWithName(_0x1ccaff){const _0x4a7de8=a20_0x5d68,{tdx:_0x3d9cd4,options:_0x4c6735}=_0x1ccaff,_0x1d5241=_0x4c6735[_0x4a7de8(0x12b)];if(_0x1d5241){const _0x3a8283=await withSpinner(_0x4a7de8(0x19f)+_0x1d5241+_0x4a7de8(0x19c),()=>_0x3d9cd4[_0x4a7de8(0x1d5)]['resolveProjectId'](_0x1d5241),{'verbose':_0x4c6735['verbose']});return{'id':_0x3a8283[_0x4a7de8(0x1ba)],'name':_0x1d5241};}const _0x3135f8=_0x3d9cd4[_0x4a7de8(0x1d5)][_0x4a7de8(0x1e2)]();if(_0x3135f8){const _0x26df0a=await _0x3d9cd4[_0x4a7de8(0x1d5)]['projects'](),_0x403740=_0x26df0a[_0x4a7de8(0x118)](_0x7c506f=>_0x7c506f['id']===_0x3135f8);return{'id':_0x3135f8,'name':_0x403740?.[_0x4a7de8(0x1d7)][_0x4a7de8(0x195)]||'Unknown'};}const _0x3d7c27=await withSpinner(_0x4a7de8(0x16d),()=>_0x3d9cd4['llm'][_0x4a7de8(0x129)](),{'verbose':_0x4c6735[_0x4a7de8(0x16e)]});return{'id':_0x3d7c27[_0x4a7de8(0x1ba)]['id'],'name':_0x3d7c27['data'][_0x4a7de8(0x1d7)][_0x4a7de8(0x195)]};}function toLLMProjectInfo(_0x51feee){const _0x4fd5f5=a20_0x5d68;return{'name':_0x51feee[_0x4fd5f5(0x1d7)]['name'],'description':_0x51feee[_0x4fd5f5(0x1d7)][_0x4fd5f5(0x191)],'createdAt':_0x51feee[_0x4fd5f5(0x1d7)][_0x4fd5f5(0x1d3)],'updatedAt':_0x51feee[_0x4fd5f5(0x1d7)][_0x4fd5f5(0x190)]};}function toAgentInfo(_0x1e72ba){const _0x4514db=a20_0x5d68;return{'name':_0x1e72ba[_0x4514db(0x1d7)]['name'],'description':_0x1e72ba[_0x4514db(0x1d7)][_0x4514db(0x191)],'prompt':truncatePrompt(_0x1e72ba[_0x4514db(0x1d7)][_0x4514db(0x1ac)]),'createdAt':_0x1e72ba[_0x4514db(0x1d7)]['createdAt'],'updatedAt':_0x1e72ba[_0x4514db(0x1d7)][_0x4514db(0x190)]};}function truncatePrompt(_0x1ac1db){const _0x5aa277=a20_0x5d68;if(!_0x1ac1db)return undefined;const _0x1002b9=0x64;if(_0x1ac1db[_0x5aa277(0x1c1)]<=_0x1002b9)return _0x1ac1db;return _0x1ac1db[_0x5aa277(0x17a)](0x0,_0x1002b9)+_0x5aa277(0x115);}export class LLMModelsCommand extends BaseCommand{['name']=a20_0x2a9f52(0x1af);[a20_0x2a9f52(0x191)]=a20_0x2a9f52(0x1ad);async[a20_0x2a9f52(0x1be)](_0x49b8f1){const _0x42a1f3=a20_0x2a9f52,{options:_0x4eb7f1,tdx:_0x1f9fd9}=_0x49b8f1;try{const _0x47f00c=await withSpinner(_0x42a1f3(0x15b),()=>_0x1f9fd9[_0x42a1f3(0x1d5)]['models'](),{'verbose':_0x4eb7f1[_0x42a1f3(0x16e)]});return await handleSDKOutput(_0x47f00c[_0x42a1f3(0x1ba)],_0x4eb7f1),0x0;}catch(_0x4e0498){return handleSDKError(_0x4e0498,_0x4eb7f1),0x1;}}}export class LLMProjectsCommand extends BaseCommand{['name']=a20_0x2a9f52(0x177);['description']=a20_0x2a9f52(0x163);async['execute'](_0x4c948f){const _0xf56462=a20_0x2a9f52,{options:_0x42ad2e,args:_0x323bee,tdx:_0x3f6ffa}=_0x4c948f,_0x9ba3a6=getChalk(_0x42ad2e),_0x516113=_0x42ad2e[_0xf56462(0x1a8)];try{const _0x5e88f5=_0x323bee[0x0],_0x26adfb=resolveLimit(_0x42ad2e[_0xf56462(0x11a)],DEFAULT_LLM_LIMIT),_0x5c9e33=await withSpinner('Fetching\x20projects...',()=>_0x3f6ffa[_0xf56462(0x1d5)]['projects'](_0x26adfb),{'verbose':_0x42ad2e[_0xf56462(0x16e)]});let _0x2f1cfd=_0x5c9e33[_0xf56462(0x1ba)];_0x5e88f5&&(_0x2f1cfd=_0x5c9e33[_0xf56462(0x1ba)]['filter'](_0x2bfbaa=>matchGlobPattern(_0x2bfbaa['attributes'][_0xf56462(0x195)],_0x5e88f5)));const _0x5d8285=_0x42ad2e[_0xf56462(0x161)]===_0xf56462(0x1bc)||_0x42ad2e['format']==='jsonl'||_0x42ad2e[_0xf56462(0x161)]==='table'||_0x42ad2e[_0xf56462(0x161)]==='tsv';if(_0x5d8285){const _0x46464b=_0x2f1cfd[_0xf56462(0x1dd)](_0x2ecf33=>({...toLLMProjectInfo(_0x2ecf33),'url':getLLMProjectUrl(_0x516113,_0x2ecf33['id'])}));await handleSDKOutput(_0x46464b,_0x42ad2e);}else{const _0x3c392d=[];if(_0x2f1cfd[_0xf56462(0x1c1)]===0x0)_0x3c392d['push'](_0x9ba3a6[_0xf56462(0x1cd)]('No\x20projects\x20found'));else{const _0x197c26=[..._0x2f1cfd][_0xf56462(0x157)]((_0x3cd38a,_0x5b8530)=>_0x3cd38a[_0xf56462(0x1d7)][_0xf56462(0x195)][_0xf56462(0x18a)](_0x5b8530[_0xf56462(0x1d7)][_0xf56462(0x195)]));for(const _0x33274b of _0x197c26){const _0x3cc764=getLLMProjectUrl(_0x516113,_0x33274b['id']),_0x8fa909=hyperlink(_0x33274b[_0xf56462(0x1d7)][_0xf56462(0x195)],_0x3cc764);_0x3c392d['push']('⚒️\x20'+_0x8fa909);}_0x3c392d[_0xf56462(0x113)](_0x9ba3a6[_0xf56462(0x1cd)](_0x2f1cfd[_0xf56462(0x1c1)]+'\x20project(s)'));}await writeOutput(_0x3c392d[_0xf56462(0x15e)]('\x0a'),_0x42ad2e[_0xf56462(0x1e9)],_0xf56462(0x15c));}return 0x0;}catch(_0x45fa71){return handleSDKError(_0x45fa71,_0x42ad2e),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a20_0x2a9f52(0x15a);['description']=a20_0x2a9f52(0x1ec);async[a20_0x2a9f52(0x1be)](_0x4549c9){const _0x322dab=a20_0x2a9f52,{options:_0x23f4d5,args:_0x403dbb,tdx:_0x313910}=_0x4549c9,_0x53f78d=getChalk(_0x23f4d5),_0x561550=_0x23f4d5[_0x322dab(0x1a8)];try{const _0x2563d4=_0x403dbb[0x0];let _0x4b08b7=_0x2563d4,_0x39892e,_0x5e877c;if(_0x2563d4&&_0x2563d4[_0x322dab(0x1b6)]('/')){const _0x4fea2a=_0x2563d4[_0x322dab(0x1b9)]('/');if(_0x4fea2a['length']===0x2){const [_0x4e6a8f,_0x5380c8]=_0x4fea2a,_0x5c5db5=await _0x313910['llm']['projects'](),_0x2f0419=_0x5c5db5[_0x322dab(0x118)](_0x38f9ed=>_0x38f9ed[_0x322dab(0x1d7)]['name'][_0x322dab(0x16c)]()===_0x4e6a8f[_0x322dab(0x16c)]());if(!_0x2f0419)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x322dab(0x153)+_0x4e6a8f,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x39892e=_0x2f0419['id'],_0x5e877c=_0x2f0419['attributes']['name'],_0x4b08b7=_0x5380c8;}else throw new SDKError(ErrorCode[_0x322dab(0x181)],_0x322dab(0x17d)+_0x2563d4,undefined,{'helpText':_0x322dab(0x130)});}else{const _0x2da6bb=await getProjectWithName(_0x4549c9);_0x39892e=_0x2da6bb['id'],_0x5e877c=_0x2da6bb['name'];}const _0x39b111=await withSpinner('Fetching\x20agents...',()=>_0x313910[_0x322dab(0x1d5)][_0x322dab(0x1ea)](_0x39892e),{'verbose':_0x23f4d5['verbose']});let _0x31cf7f=_0x39b111[_0x322dab(0x1ba)];_0x4b08b7&&(_0x31cf7f=_0x39b111[_0x322dab(0x1ba)][_0x322dab(0x1cb)](_0x10a504=>matchGlobPattern(_0x10a504['attributes']['name'],_0x4b08b7)));const _0x357b5e=_0x23f4d5[_0x322dab(0x161)]===_0x322dab(0x1bc)||_0x23f4d5[_0x322dab(0x161)]===_0x322dab(0x1a7)||_0x23f4d5[_0x322dab(0x161)]===_0x322dab(0x15c)||_0x23f4d5[_0x322dab(0x161)]===_0x322dab(0x14b);if(_0x357b5e){const _0x4c028d=_0x31cf7f[_0x322dab(0x1dd)](_0x57c2da=>({...toAgentInfo(_0x57c2da),'chatUrl':getLLMAgentChatUrl(_0x561550,_0x39892e,_0x57c2da['id'])}));await handleSDKOutput(_0x4c028d,_0x23f4d5);}else{const _0xc22cc8=[];_0xc22cc8[_0x322dab(0x113)](_0x53f78d['dim']('['+_0x5e877c+']'));if(_0x31cf7f['length']===0x0)_0xc22cc8['push'](_0x53f78d[_0x322dab(0x1cd)](_0x322dab(0x13e)));else{const _0x251bea=[..._0x31cf7f]['sort']((_0x34f602,_0x196050)=>_0x34f602[_0x322dab(0x1d7)][_0x322dab(0x195)][_0x322dab(0x18a)](_0x196050['attributes']['name']));for(const _0x4a38e3 of _0x251bea){const _0x3e5306=getLLMAgentChatUrl(_0x561550,_0x39892e,_0x4a38e3['id']),_0x17d1e1=hyperlink(_0x4a38e3['attributes']['name'],_0x3e5306);_0xc22cc8[_0x322dab(0x113)](_0x322dab(0x192)+_0x17d1e1);}_0xc22cc8['push'](_0x53f78d[_0x322dab(0x1cd)](_0x31cf7f[_0x322dab(0x1c1)]+_0x322dab(0x1e1)));}await writeOutput(_0xc22cc8[_0x322dab(0x15e)]('\x0a'),_0x23f4d5[_0x322dab(0x1e9)],_0x322dab(0x15c));}return 0x0;}catch(_0x3659af){return handleSDKError(_0x3659af,_0x23f4d5),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x2a9f52(0x195)]=a20_0x2a9f52(0x1df);[a20_0x2a9f52(0x191)]='Show\x20agent\x20details';async[a20_0x2a9f52(0x1be)](_0x2e9760){const _0x5b2dc6=a20_0x2a9f52,{options:_0x2f5c65,args:_0x2cf2ca,tdx:_0x51c2dc}=_0x2e9760;if(_0x2cf2ca[_0x5b2dc6(0x1c1)]===0x0)return console[_0x5b2dc6(0x1b5)](_0x5b2dc6(0x174)),console[_0x5b2dc6(0x1b5)](_0x5b2dc6(0x14d)),0x1;const _0x229f64=_0x2cf2ca[0x0];try{const _0x4a54f7=await getProjectIdOrDefault(_0x2e9760),_0x242dac=await withSpinner(_0x5b2dc6(0x1e0)+_0x229f64+_0x5b2dc6(0x19c),()=>_0x51c2dc[_0x5b2dc6(0x1d5)]['resolveAgentId'](_0x229f64,_0x4a54f7),{'verbose':_0x2f5c65[_0x5b2dc6(0x16e)]}),_0x47b4aa=await withSpinner(_0x5b2dc6(0x14e),()=>_0x51c2dc[_0x5b2dc6(0x1d5)][_0x5b2dc6(0x144)](_0x242dac['data']),{'verbose':_0x2f5c65[_0x5b2dc6(0x16e)]});return await handleSDKOutput([_0x47b4aa[_0x5b2dc6(0x1ba)]],_0x2f5c65),0x0;}catch(_0x5f5232){return handleSDKError(_0x5f5232,_0x2f5c65),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x2a9f52(0x195)]='llm:agent:create';[a20_0x2a9f52(0x191)]=a20_0x2a9f52(0x1cf);async[a20_0x2a9f52(0x1be)](_0x4c7509){const _0x3e0e0d=a20_0x2a9f52,{options:_0x57ee43,args:_0x257424,tdx:_0x55502d}=_0x4c7509;if(_0x257424[_0x3e0e0d(0x1c1)]===0x0)return console[_0x3e0e0d(0x1b5)](_0x3e0e0d(0x174)),console[_0x3e0e0d(0x1b5)](_0x3e0e0d(0x188)),console[_0x3e0e0d(0x1b5)](_0x3e0e0d(0x1a4)),0x1;const _0x2890c2=_0x257424[0x0],_0x402c7a=_0x57ee43,_0x462ac4=_0x402c7a[_0x3e0e0d(0x145)],_0x4a168c=_0x402c7a['model']||_0x3e0e0d(0x1ce),_0x54a796=_0x402c7a[_0x3e0e0d(0x16b)],_0x43a0f9=_0x402c7a[_0x3e0e0d(0x17e)]?Number(_0x402c7a['maxToolIterations']):undefined,_0x22a1e2=_0x402c7a[_0x3e0e0d(0x11c)]?Number(_0x402c7a[_0x3e0e0d(0x11c)]):undefined;try{let _0xe303d3,_0x27d970;if(_0x2890c2[_0x3e0e0d(0x1b6)]('/')){const _0x3ea692=_0x2890c2[_0x3e0e0d(0x1b9)]('/');if(_0x3ea692[_0x3e0e0d(0x1c1)]===0x2){const [_0x8023f0,_0x3eaed8]=_0x3ea692,_0x4c18e9=await withSpinner(_0x3e0e0d(0x19f)+_0x8023f0+_0x3e0e0d(0x19c),()=>_0x55502d[_0x3e0e0d(0x1d5)][_0x3e0e0d(0x155)](_0x8023f0),{'verbose':_0x57ee43[_0x3e0e0d(0x16e)]});_0xe303d3=_0x4c18e9[_0x3e0e0d(0x1ba)],_0x27d970=_0x3eaed8;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3e0e0d(0x17d)+_0x2890c2,undefined,{'helpText':_0x3e0e0d(0x130)});}else _0xe303d3=await getProjectIdOrDefault(_0x4c7509),_0x27d970=_0x2890c2;const _0x222b14=await withSpinner(_0x3e0e0d(0x166)+_0x27d970+_0x3e0e0d(0x19c),()=>_0x55502d[_0x3e0e0d(0x1d5)]['createAgent']({'name':_0x27d970,'projectId':_0xe303d3,'modelType':_0x4a168c,'systemPrompt':_0x462ac4,'starterMessage':_0x54a796,'maxToolIterations':_0x43a0f9,'temperature':_0x22a1e2}),{'verbose':_0x57ee43['verbose']});return console['log'](_0x3e0e0d(0x1cc)+_0x222b14['data']['id']),await handleSDKOutput([_0x222b14[_0x3e0e0d(0x1ba)]],_0x57ee43),0x0;}catch(_0x2b3c18){return handleSDKError(_0x2b3c18,_0x57ee43),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']=a20_0x2a9f52(0x147);[a20_0x2a9f52(0x191)]='Update\x20an\x20existing\x20agent';async[a20_0x2a9f52(0x1be)](_0x5d17d8){const _0x1467e3=a20_0x2a9f52,{options:_0x37a1aa,args:_0x4df9ea,tdx:_0x17ba32}=_0x5d17d8;if(_0x4df9ea[_0x1467e3(0x1c1)]===0x0)return console['error'](_0x1467e3(0x174)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x4c2b9e=_0x4df9ea[0x0],_0x463aaa=_0x37a1aa,_0x400bcd=_0x463aaa['name'],_0x3e2c82=_0x463aaa[_0x1467e3(0x1ac)],_0x416d67=_0x463aaa[_0x1467e3(0x191)],_0x4dbf75=_0x463aaa['starterMessage'];if(!_0x400bcd&&!_0x3e2c82&&!_0x416d67&&!_0x4dbf75)return console['error'](_0x1467e3(0x18b)),console[_0x1467e3(0x1b5)]('Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message'),0x1;try{const _0x442179=await getProjectIdOrDefault(_0x5d17d8),_0x427e1d=await withSpinner(_0x1467e3(0x1e0)+_0x4c2b9e+_0x1467e3(0x19c),()=>_0x17ba32[_0x1467e3(0x1d5)][_0x1467e3(0x136)](_0x4c2b9e,_0x442179),{'verbose':_0x37a1aa['verbose']}),_0x2b4c8f=_0x427e1d[_0x1467e3(0x1ba)],_0xc6df6b=await withSpinner('Updating\x20agent...',()=>_0x17ba32[_0x1467e3(0x1d5)][_0x1467e3(0x173)](_0x2b4c8f,{'name':_0x400bcd,'prompt':_0x3e2c82,'description':_0x416d67,'starterMessage':_0x4dbf75}),{'verbose':_0x37a1aa[_0x1467e3(0x16e)]});return console[_0x1467e3(0x137)](_0x1467e3(0x1b7)+_0xc6df6b[_0x1467e3(0x1ba)]['id']),await handleSDKOutput([_0xc6df6b[_0x1467e3(0x1ba)]],_0x37a1aa),0x0;}catch(_0x2cb057){return handleSDKError(_0x2cb057,_0x37a1aa),0x1;}}}function a20_0x5d68(_0x40e19e,_0x49ad06){_0x40e19e=_0x40e19e-0x113;const _0x423802=a20_0x4238();let _0x5d68bc=_0x423802[_0x40e19e];return _0x5d68bc;}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x2a9f52(0x195)]=a20_0x2a9f52(0x159);['description']='Delete\x20an\x20agent';async[a20_0x2a9f52(0x1be)](_0x46818d){const _0x290a56=a20_0x2a9f52,{options:_0x286001,args:_0xc7b177,tdx:_0x5db452}=_0x46818d;if(_0xc7b177['length']===0x0)return console[_0x290a56(0x1b5)](_0x290a56(0x174)),console[_0x290a56(0x1b5)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x39263c=_0xc7b177[0x0];try{const _0x5b5090=await getProjectIdOrDefault(_0x46818d),_0x5d3873=await withSpinner(_0x290a56(0x1e0)+_0x39263c+'\x27...',()=>_0x5db452[_0x290a56(0x1d5)]['resolveAgentId'](_0x39263c,_0x5b5090),{'verbose':_0x286001[_0x290a56(0x16e)]}),_0x2b6760=_0x5d3873[_0x290a56(0x1ba)];return await withSpinner('Deleting\x20agent...',()=>_0x5db452[_0x290a56(0x1d5)][_0x290a56(0x12f)](_0x2b6760),{'verbose':_0x286001[_0x290a56(0x16e)]}),console['log'](_0x290a56(0x19d)+_0x2b6760),0x0;}catch(_0x1081a0){return handleSDKError(_0x1081a0,_0x286001),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a20_0x2a9f52(0x134);[a20_0x2a9f52(0x191)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async['execute'](_0x21d6a1){const _0x4ef21e=a20_0x2a9f52;return executeChatHistoryCommand(_0x21d6a1,_0x4ef21e(0x197));}}export class LLMUseCommand extends BaseCommand{[a20_0x2a9f52(0x195)]='llm:use';[a20_0x2a9f52(0x191)]=a20_0x2a9f52(0x18f);async['execute'](_0x23e01a){const _0x46ab3c=a20_0x2a9f52,{options:_0x2cba53,args:_0x3a956d,tdx:_0x890c4c}=_0x23e01a;if(_0x3a956d['length']===0x0)return console['error'](_0x46ab3c(0x1c2)),console['error'](_0x46ab3c(0x1aa)),0x1;const _0xc43623=_0x3a956d[0x0];try{return await withSpinner(_0x46ab3c(0x1e8)+_0xc43623+_0x46ab3c(0x19c),()=>_0x890c4c[_0x46ab3c(0x1d5)]['setCurrentProject'](_0xc43623),{'verbose':_0x2cba53[_0x46ab3c(0x16e)]}),console[_0x46ab3c(0x137)](_0x46ab3c(0x185)+_0xc43623),0x0;}catch(_0x30368e){return handleSDKError(_0x30368e,_0x2cba53),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x2a9f52(0x195)]=a20_0x2a9f52(0x196);[a20_0x2a9f52(0x191)]=a20_0x2a9f52(0x1d2);async[a20_0x2a9f52(0x1be)](_0x1cefd2){const _0x4629b7=a20_0x2a9f52,{options:_0x2502f4,args:_0x159d84,tdx:_0x100345}=_0x1cefd2;if(_0x159d84[_0x4629b7(0x1c1)]===0x0)return console[_0x4629b7(0x1b5)](_0x4629b7(0x1c2)),console[_0x4629b7(0x1b5)](_0x4629b7(0x182)),0x1;const _0x3bc7ef=_0x159d84[0x0],_0x6ba0fd=_0x2502f4,_0x4b2c54=_0x6ba0fd[_0x4629b7(0x191)];try{const _0x5155c1=await withSpinner(_0x4629b7(0x179)+_0x3bc7ef+_0x4629b7(0x19c),()=>_0x100345[_0x4629b7(0x1d5)][_0x4629b7(0x13b)]({'name':_0x3bc7ef,'description':_0x4b2c54}),{'verbose':_0x2502f4[_0x4629b7(0x16e)]});console['log'](_0x4629b7(0x1a9)+_0x5155c1[_0x4629b7(0x1ba)]['id']);const _0x5d2428=toLLMProjectInfo(_0x5155c1[_0x4629b7(0x1ba)]);return await handleSDKOutput([_0x5d2428],_0x2502f4),0x0;}catch(_0x4e5936){return handleSDKError(_0x4e5936,_0x2502f4),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{['name']=a20_0x2a9f52(0x17b);['description']=a20_0x2a9f52(0x1ae);async['execute'](_0x151ea2){const _0x5c1eb8=a20_0x2a9f52,{options:_0x3c90e4,args:_0x4357ab,tdx:_0x5dcea9}=_0x151ea2;if(_0x4357ab[_0x5c1eb8(0x1c1)]===0x0)return console[_0x5c1eb8(0x1b5)](_0x5c1eb8(0x1c2)),console[_0x5c1eb8(0x1b5)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x496ca3=_0x4357ab[0x0];try{return await withSpinner(_0x5c1eb8(0x1db)+_0x496ca3+_0x5c1eb8(0x19c),()=>_0x5dcea9['llm'][_0x5c1eb8(0x1c4)](_0x496ca3),{'verbose':_0x3c90e4[_0x5c1eb8(0x16e)]}),console['log']('Project\x20deleted:\x20'+_0x496ca3),0x0;}catch(_0x23e2d5){return handleSDKError(_0x23e2d5,_0x3c90e4),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x2a9f52(0x195)]=a20_0x2a9f52(0x133);['description']='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)';async[a20_0x2a9f52(0x1be)](_0x2e4003){const _0x25894b=a20_0x2a9f52,{options:_0x3da2c1,args:_0x4f0222,tdx:_0x5b798e}=_0x2e4003,_0x3054a2=getChalk(_0x3da2c1);console[_0x25894b(0x137)](_0x3054a2['yellow'](_0x25894b(0x18e))),console[_0x25894b(0x137)](_0x3054a2['yellow'](_0x25894b(0x1c8))),console[_0x25894b(0x137)](_0x3054a2[_0x25894b(0x1cd)](_0x25894b(0x189))),console[_0x25894b(0x137)]();if(_0x4f0222[_0x25894b(0x1c1)]===0x0)return console[_0x25894b(0x1b5)](_0x25894b(0x1c2)),console[_0x25894b(0x1b5)](_0x25894b(0x1b2)),0x1;const _0xd503c8=_0x4f0222[0x0],_0x11aa1e=_0x3da2c1,_0x439e5f=_0x11aa1e[_0x25894b(0x1e9)],_0x30931a=_0x11aa1e['dryRun'];try{const _0x513c85=_0x439e5f||_0xd503c8+_0x25894b(0x17c);if(a20_0x5f3f39[_0x25894b(0x1bd)](_0x513c85)&&!_0x30931a){if(!_0x3da2c1['yes']){const _0x2b87e0=await confirm(_0x25894b(0x151)+_0x513c85+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x2b87e0)return console[_0x25894b(0x137)](_0x25894b(0x150)),0x0;}a20_0x5f3f39[_0x25894b(0x164)](_0x513c85,{'recursive':!![]});}const _0x659aa9=await withSpinner(_0x30931a?_0x25894b(0x139)+_0xd503c8+_0x25894b(0x19c):_0x25894b(0x1e4)+_0xd503c8+_0x25894b(0x19c),()=>_0x5b798e['llm']['backupProject'](_0xd503c8,_0x439e5f,{'dryRun':_0x30931a}),{'verbose':_0x3da2c1['verbose']}),_0x5a9f5f=_0x659aa9[_0x25894b(0x1ba)];return _0x30931a?console[_0x25894b(0x137)](_0x25894b(0x1b3)+_0x5a9f5f[_0x25894b(0x1b8)]):console[_0x25894b(0x137)](_0x25894b(0x1d0)+_0x5a9f5f[_0x25894b(0x1b8)]),console[_0x25894b(0x137)](_0x25894b(0x178)+_0x5a9f5f[_0x25894b(0x1ab)][_0x25894b(0x1ea)]),console[_0x25894b(0x137)](_0x25894b(0x123)+_0x5a9f5f[_0x25894b(0x1ab)][_0x25894b(0x1a1)]),console[_0x25894b(0x137)](_0x25894b(0x1b4)+_0x5a9f5f[_0x25894b(0x1ab)][_0x25894b(0x1c3)]),console[_0x25894b(0x137)](_0x25894b(0x156)+_0x5a9f5f[_0x25894b(0x1ab)][_0x25894b(0x168)]),(_0x3da2c1[_0x25894b(0x161)]===_0x25894b(0x1bc)||_0x3da2c1['format']===_0x25894b(0x1a7))&&await handleSDKOutput([_0x5a9f5f],_0x3da2c1),0x0;}catch(_0x55140c){return handleSDKError(_0x55140c,_0x3da2c1),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x2a9f52(0x195)]=a20_0x2a9f52(0x1dc);[a20_0x2a9f52(0x191)]=a20_0x2a9f52(0x183);async['execute'](_0x19f70f){const _0xc79fb6=a20_0x2a9f52,{options:_0xfd90e6,args:_0x4d0fae,tdx:_0x1a123f}=_0x19f70f,_0x24122f=getChalk(_0xfd90e6);console[_0xc79fb6(0x137)](_0x24122f[_0xc79fb6(0x180)](_0xc79fb6(0x1e6))),console['log'](_0x24122f[_0xc79fb6(0x180)](_0xc79fb6(0x167))),console[_0xc79fb6(0x137)](_0x24122f[_0xc79fb6(0x1cd)](_0xc79fb6(0x16a))),console[_0xc79fb6(0x137)](_0x24122f[_0xc79fb6(0x1cd)](_0xc79fb6(0x199))),console[_0xc79fb6(0x137)](_0x24122f[_0xc79fb6(0x1cd)]('\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22')),console['log']();if(_0x4d0fae[_0xc79fb6(0x1c1)]===0x0)return console['error']('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console['error'](_0xc79fb6(0x194)),0x1;const _0x1e9ebd=_0x4d0fae[0x0],_0x58b519=_0xfd90e6,_0x174e5d=_0x58b519[_0xc79fb6(0x195)],_0x3275bd=_0x58b519[_0xc79fb6(0x169)];try{if(!_0x3275bd){const _0x1b222c=_0x1a123f['llm'][_0xc79fb6(0x140)](_0x1e9ebd),_0x427cfd=_0x174e5d||_0x1b222c[_0xc79fb6(0x127)][_0xc79fb6(0x128)],_0x1eb415=await withSpinner(_0xc79fb6(0x135),()=>_0x1a123f['llm'][_0xc79fb6(0x152)](),{'verbose':_0xfd90e6[_0xc79fb6(0x16e)]}),_0x197466=_0x1eb415[_0xc79fb6(0x1ba)][_0xc79fb6(0x118)](_0x5e9b0c=>_0x5e9b0c[_0xc79fb6(0x1d7)][_0xc79fb6(0x195)]===_0x427cfd);if(_0x197466&&!_0xfd90e6['yes']){const _0x5c260b=await confirm(_0xc79fb6(0x11e)+_0x427cfd+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x5c260b)return console['log']('Restore\x20cancelled.'),0x0;}}const _0x535837=await withSpinner(_0x3275bd?_0xc79fb6(0x119)+_0x1e9ebd+_0xc79fb6(0x19c):_0xc79fb6(0x15d)+_0x1e9ebd+_0xc79fb6(0x19c),()=>_0x1a123f[_0xc79fb6(0x1d5)][_0xc79fb6(0x142)](_0x1e9ebd,{'name':_0x174e5d,'dryRun':_0x3275bd}),{'verbose':_0xfd90e6['verbose']}),_0x16636f=_0x535837[_0xc79fb6(0x1ba)];return _0x16636f[_0xc79fb6(0x146)]&&console[_0xc79fb6(0x137)]('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x16636f[_0xc79fb6(0x146)]+'\x27'),_0x3275bd?console[_0xc79fb6(0x137)](_0xc79fb6(0x184)+_0x16636f['projectName']):console['log'](_0xc79fb6(0x1bf)+_0x16636f[_0xc79fb6(0x128)]+'\x20('+_0x16636f[_0xc79fb6(0x1d4)]+')'),console[_0xc79fb6(0x137)](_0xc79fb6(0x178)+_0x16636f[_0xc79fb6(0x1ab)][_0xc79fb6(0x1ea)]),console[_0xc79fb6(0x137)](_0xc79fb6(0x123)+_0x16636f[_0xc79fb6(0x1ab)][_0xc79fb6(0x1a1)]),console[_0xc79fb6(0x137)](_0xc79fb6(0x1b4)+_0x16636f['counts']['prompts']),console[_0xc79fb6(0x137)](_0xc79fb6(0x156)+_0x16636f[_0xc79fb6(0x1ab)][_0xc79fb6(0x168)]),(_0xfd90e6[_0xc79fb6(0x161)]==='json'||_0xfd90e6[_0xc79fb6(0x161)]===_0xc79fb6(0x1a7))&&await handleSDKOutput([_0x16636f],_0xfd90e6),0x0;}catch(_0xcdc839){return handleSDKError(_0xcdc839,_0xfd90e6),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x17c0bf,_0xa4b6b){const _0x3a57f2=a20_0x2a9f52,_0x398126=_0xa4b6b[_0x3a57f2(0x11a)]||CHAT_SELECTOR_PAGE_SIZE;let _0x235f87=0x0,_0xc7a928=[];const _0x1edf44=(await import(_0x3a57f2(0x1c3)))['default'],_0x4d73ae=getChalk(_0xa4b6b);while(!![]){const _0x4ea84d=await withSpinner(_0x3a57f2(0x1d1),()=>_0x17c0bf[_0x3a57f2(0x1d5)][_0x3a57f2(0x17f)](_0x398126+_0x235f87),{'verbose':_0xa4b6b[_0x3a57f2(0x16e)]});_0xc7a928=_0x4ea84d['data'];const _0x43971e=_0xc7a928['slice'](_0x235f87,_0x235f87+_0x398126),_0x163804=_0xc7a928['length']>_0x235f87+_0x398126,_0x5c4fb3=[...new Set(_0x43971e[_0x3a57f2(0x1dd)](_0x564d45=>_0x564d45[_0x3a57f2(0x1d7)][_0x3a57f2(0x141)])[_0x3a57f2(0x1cb)](_0x59d96f=>_0x59d96f!==undefined))],_0x4ab520=new Map();await Promise[_0x3a57f2(0x18c)](_0x5c4fb3[_0x3a57f2(0x1dd)](async _0x40eacf=>{const _0x3aed44=_0x3a57f2;try{const _0x1bd6de=await _0x17c0bf[_0x3aed44(0x1d5)]['agent'](_0x40eacf);_0x4ab520[_0x3aed44(0x149)](_0x40eacf,_0x1bd6de[_0x3aed44(0x1d7)][_0x3aed44(0x195)]);}catch{_0x4ab520[_0x3aed44(0x149)](_0x40eacf,_0x40eacf);}}));const _0x2da815=_0x43971e[_0x3a57f2(0x1dd)](_0x41558c=>{const _0x79ae76=_0x3a57f2,_0x1562c8=_0x41558c[_0x79ae76(0x1d7)][_0x79ae76(0x1eb)]||_0x79ae76(0x186),_0x59832e=_0x1562c8[_0x79ae76(0x1b9)]('\x0a')[0x0],_0x16014a=_0x59832e[_0x79ae76(0x1c1)]>0x50?_0x59832e['substring'](0x0,0x4d)+_0x79ae76(0x115):_0x59832e,_0x32e44a=_0x41558c[_0x79ae76(0x1d7)][_0x79ae76(0x141)]?_0x4ab520[_0x79ae76(0x138)](_0x41558c['attributes']['agentId'])||_0x41558c['attributes']['agentId']:'(no\x20agent)',_0x36037a=_0x41558c['attributes']['lastConversationAt']||_0x41558c[_0x79ae76(0x1d7)][_0x79ae76(0x190)],_0xe832a3=new Date(_0x36037a),_0x126c99=new Date(),_0x142643=_0x126c99[_0x79ae76(0x165)]()-_0xe832a3['getTime'](),_0x11e17f=Math[_0x79ae76(0x1b0)](_0x142643/0xea60),_0xfec999=Math[_0x79ae76(0x1b0)](_0x142643/0x36ee80),_0x18f6b5=Math[_0x79ae76(0x1b0)](_0x142643/0x5265c00);let _0x207669;if(_0x11e17f<0x1)_0x207669='just\x20now';else{if(_0x11e17f<0x3c)_0x207669=_0x11e17f+_0x79ae76(0x125);else{if(_0xfec999<0x18)_0x207669=_0xfec999+'h\x20ago';else _0x18f6b5<0x7?_0x207669=_0x18f6b5+_0x79ae76(0x13d):_0x207669=_0xe832a3[_0x79ae76(0x1e7)](_0x79ae76(0x176),{'month':_0x79ae76(0x11b),'day':_0x79ae76(0x13f)});}}return{'title':_0x16014a+'\x20'+_0x4d73ae[_0x79ae76(0x1cd)]('['+_0x32e44a+']\x20'+_0x207669),'value':_0x41558c['id']};});_0x163804&&_0x2da815[_0x3a57f2(0x113)]({'title':_0x4d73ae['cyan'](_0x3a57f2(0x15f)),'value':'__load_more__'});const _0x3f7a7b=await _0x1edf44({'type':'select','name':'chatId','message':_0x3a57f2(0x116),'choices':_0x2da815,'hint':_0x3a57f2(0x1c9)});if(!_0x3f7a7b['chatId'])return undefined;if(_0x3f7a7b[_0x3a57f2(0x19a)]===_0x3a57f2(0x12c)){_0x235f87+=_0x398126;continue;}return _0x3f7a7b[_0x3a57f2(0x19a)];}}export class ChatsCommand extends BaseCommand{['name']=a20_0x2a9f52(0x17f);[a20_0x2a9f52(0x191)]=a20_0x2a9f52(0x19b);async[a20_0x2a9f52(0x1be)](_0x4822b6){return executeChatHistoryCommand(_0x4822b6,'tdx\x20chats');}}
@@ -1 +1 @@
1
- const a21_0x55e13d=a21_0x4d2f;(function(_0x42d684,_0x52e542){const _0x56dde5=a21_0x4d2f,_0x6488e8=_0x42d684();while(!![]){try{const _0xb769ea=-parseInt(_0x56dde5(0xcb))/0x1*(-parseInt(_0x56dde5(0xe5))/0x2)+-parseInt(_0x56dde5(0xd8))/0x3+-parseInt(_0x56dde5(0xfe))/0x4+parseInt(_0x56dde5(0xca))/0x5*(-parseInt(_0x56dde5(0xe4))/0x6)+-parseInt(_0x56dde5(0xfb))/0x7*(-parseInt(_0x56dde5(0xf5))/0x8)+parseInt(_0x56dde5(0xff))/0x9*(parseInt(_0x56dde5(0xce))/0xa)+parseInt(_0x56dde5(0xde))/0xb*(-parseInt(_0x56dde5(0xd0))/0xc);if(_0xb769ea===_0x52e542)break;else _0x6488e8['push'](_0x6488e8['shift']());}catch(_0x579063){_0x6488e8['push'](_0x6488e8['shift']());}}}(a21_0xcc7c,0x23427));import a21_0x49102e from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x437c79,_0x26f7d3){const _0x23252d=a21_0x4d2f,{tdx:_0x254096,options:_0x3319ce}=_0x437c79,_0xb38780=_0x26f7d3||_0x3319ce[_0x23252d(0xd2)];if(_0xb38780){const _0x181f05=await _0x254096[_0x23252d(0xef)][_0x23252d(0xd5)](),_0x5014fc=_0x181f05[_0x23252d(0xf0)](_0x587a16=>_0x587a16['attributes'][_0x23252d(0xc1)]===_0xb38780);if(!_0x5014fc)throw new SDKError(ErrorCode[_0x23252d(0xda)],'Project\x20\x27'+_0xb38780+'\x27\x20not\x20found',undefined,{'helpText':_0x23252d(0xfc)});return _0x5014fc['id'];}const _0x5f2f94=await _0x254096['llm'][_0x23252d(0xf1)]();return _0x5f2f94['id'];}function a21_0x4d2f(_0x1cc3a2,_0x17644e){_0x1cc3a2=_0x1cc3a2-0xbe;const _0xcc7c2a=a21_0xcc7c();let _0x4d2f82=_0xcc7c2a[_0x1cc3a2];return _0x4d2f82;}function a21_0xcc7c(){const _0x556733=['green','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','logger','SIGTERM','1687RAFIjk','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','618100XDGrQg','5553luRsJF','execute','\x0aTesting\x20with\x20Agent\x20SDK:','port','\x20\x20Address:','name','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','white','\x20\x20{','init','llm:proxy','\x0aClaude\x20Code\x20Configuration:','yellow','logLevel','56550rmgVcx','247316NNLjFO','\x20\x20Project:','stop','1880undAQg','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','1598412aZoosh','bold','llmProject','exit','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','projects','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','dim','535440BNYmON','cyan','NOT_FOUND','close','\x20\x20Agents:','http://0.0.0.0:','11vDLgDT','SIGINT','server','site','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','18OTiBio','2xooLnJ','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20\x20\x20\x22env\x22:\x20{','Starting\x20proxy\x20server...','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x20is\x20unavailable,\x20using\x20port\x20','\x20\x20}','Server\x20Configuration:','project','llm','find','getOrCreateDefaultProject','\x20\x20\x20\x20}','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','start','9336KSWgdw','log'];a21_0xcc7c=function(){return _0x556733;};return a21_0xcc7c();}export class LLMProxyCommand extends BaseCommand{['name']=a21_0x55e13d(0xc6);['description']='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a21_0x55e13d(0xe0)];[a21_0x55e13d(0xf9)];async[a21_0x55e13d(0x100)](_0x14087c){const _0x35812a=a21_0x55e13d,{tdx:_0x57c649,options:_0x4274c7}=_0x14087c;try{const _0x24ace4=_0x4274c7,_0x538cdc=_0x24ace4[_0x35812a(0xbf)]||0xfa0,_0x4e685f=_0x24ace4[_0x35812a(0xee)],_0x497e60=await findAvailablePort(_0x538cdc);console[_0x35812a(0xf6)](a21_0x49102e['dim']('Resolving\x20project...'));const _0x40765d=await getProjectIdOrDefault(_0x14087c,_0x4e685f),_0x1f38ba=await _0x57c649[_0x35812a(0xef)]['projects'](),_0x1f12a9=_0x1f38ba[_0x35812a(0xf0)](_0x495da7=>_0x495da7['id']===_0x40765d);this[_0x35812a(0xf9)]=new TDXLogger(_0x4274c7[_0x35812a(0xc9)]),await this['logger'][_0x35812a(0xc5)](),console[_0x35812a(0xf6)](a21_0x49102e['dim'](_0x35812a(0xe8)));_0x497e60!==_0x538cdc&&console['log'](a21_0x49102e[_0x35812a(0xc8)]('Port\x20'+_0x538cdc+_0x35812a(0xeb)+_0x497e60));this[_0x35812a(0xe0)]=new ProxyServer({'port':_0x497e60,'projectId':_0x40765d,'tdx':_0x57c649,'logger':this[_0x35812a(0xf9)],'site':_0x4274c7['site']}),await this[_0x35812a(0xe0)][_0x35812a(0xf4)](),console[_0x35812a(0xf6)](a21_0x49102e['yellow'][_0x35812a(0xd1)](_0x35812a(0xe6))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xc8)](_0x35812a(0xf8))),console['log'](a21_0x49102e[_0x35812a(0xc8)](_0x35812a(0xf3))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xf7)][_0x35812a(0xd1)](_0x35812a(0xe2))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xd9)](_0x35812a(0xed))),console[_0x35812a(0xf6)](a21_0x49102e['dim'](_0x35812a(0xc0)),a21_0x49102e[_0x35812a(0xc3)](_0x35812a(0xdd)+_0x497e60)),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xd7)](_0x35812a(0xcc)),a21_0x49102e[_0x35812a(0xc3)](_0x1f12a9?.['attributes'][_0x35812a(0xc1)]||_0x40765d)),console['log'](a21_0x49102e[_0x35812a(0xd7)](_0x35812a(0xdc)),a21_0x49102e['white']('created\x20on-demand\x20per\x20model')),console['log'](a21_0x49102e[_0x35812a(0xd7)]('\x20\x20Site:'),a21_0x49102e['white'](_0x4274c7[_0x35812a(0xe1)])),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xd9)](_0x35812a(0xc7))),console['log'](a21_0x49102e[_0x35812a(0xd7)]('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xc3)](_0x35812a(0xc4))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xc3)](_0x35812a(0xe7))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xc3)](_0x35812a(0xc2)+_0x497e60+'\x22,')),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xc3)](_0x35812a(0xea))),console['log'](a21_0x49102e[_0x35812a(0xc3)](_0x35812a(0xcf))),console[_0x35812a(0xf6)](a21_0x49102e['white'](_0x35812a(0xf2))),console[_0x35812a(0xf6)](a21_0x49102e['white'](_0x35812a(0xec))),console['log'](a21_0x49102e[_0x35812a(0xd9)](_0x35812a(0xbe))),console['log'](a21_0x49102e['dim'](_0x35812a(0xfd))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xd7)](_0x35812a(0xd4))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xd7)](_0x35812a(0xd6))),console[_0x35812a(0xf6)](a21_0x49102e[_0x35812a(0xc8)](_0x35812a(0xe3)));const _0x1769f2=async()=>{const _0x30e39e=_0x35812a;console[_0x30e39e(0xf6)](a21_0x49102e[_0x30e39e(0xd7)](_0x30e39e(0xe9))),this['server']&&await this[_0x30e39e(0xe0)][_0x30e39e(0xcd)](),this['logger']&&await this[_0x30e39e(0xf9)][_0x30e39e(0xdb)](),console[_0x30e39e(0xf6)](a21_0x49102e[_0x30e39e(0xf7)]('✓\x20Proxy\x20server\x20stopped')),process[_0x30e39e(0xd3)](0x0);};return process['on'](_0x35812a(0xdf),_0x1769f2),process['on'](_0x35812a(0xfa),_0x1769f2),await new Promise(()=>{}),0x0;}catch(_0x133842){this[_0x35812a(0xe0)]&&await this['server']['stop']();this[_0x35812a(0xf9)]&&await this[_0x35812a(0xf9)]['close']();throw _0x133842;}}}
1
+ const a21_0x2548f8=a21_0x2dd9;(function(_0x1c1942,_0x5472cf){const _0x44e328=a21_0x2dd9,_0x5b4d96=_0x1c1942();while(!![]){try{const _0x74a000=parseInt(_0x44e328(0x180))/0x1+-parseInt(_0x44e328(0x193))/0x2*(parseInt(_0x44e328(0x188))/0x3)+parseInt(_0x44e328(0x15b))/0x4*(parseInt(_0x44e328(0x17e))/0x5)+-parseInt(_0x44e328(0x192))/0x6*(-parseInt(_0x44e328(0x165))/0x7)+-parseInt(_0x44e328(0x18b))/0x8+-parseInt(_0x44e328(0x194))/0x9*(-parseInt(_0x44e328(0x17a))/0xa)+-parseInt(_0x44e328(0x15a))/0xb*(parseInt(_0x44e328(0x191))/0xc);if(_0x74a000===_0x5472cf)break;else _0x5b4d96['push'](_0x5b4d96['shift']());}catch(_0x53ea8e){_0x5b4d96['push'](_0x5b4d96['shift']());}}}(a21_0x5789,0x82c98));import a21_0x70a92d from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a21_0x5789(){const _0x35c532=['334520QSoEPO','Server\x20Configuration:','logLevel','\x20\x20Site:','1224975AMGsxL','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','935094YClcPF','http://0.0.0.0:','projects','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','SIGINT','\x20\x20Address:','logger','white','3fYuwGb','project','Starting\x20proxy\x20server...','4334664ZdHwnf','stop','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','green','server','\x20\x20Agents:','29712QJVUPd','936qIXMjd','1340644rbBDPM','162LtBOaD','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x20\x20\x20\x20}','\x20\x20}','llm','\x0aTesting\x20with\x20Agent\x20SDK:','yellow','bold','\x20\x20\x20\x20\x22env\x22:\x20{','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','6842qtpbnY','12yyjdRY','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','getOrCreateDefaultProject','\x27\x20not\x20found','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20is\x20unavailable,\x20using\x20port\x20','find','execute','45577elSMnU','attributes','log','\x20\x20{','\x0aClaude\x20Code\x20Configuration:','✓\x20Proxy\x20server\x20stopped','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','close','SIGTERM','init','llm:proxy','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','\x20\x20Project:','NOT_FOUND','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','llmProject','site','dim','Project\x20\x27','name','cyan'];a21_0x5789=function(){return _0x35c532;};return a21_0x5789();}import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x43268b,_0x2dd4dd){const _0x2b1654=a21_0x2dd9,{tdx:_0xc4fcc3,options:_0x2244f9}=_0x43268b,_0x1e5b51=_0x2dd4dd||_0x2244f9[_0x2b1654(0x174)];if(_0x1e5b51){const _0x21657c=await _0xc4fcc3[_0x2b1654(0x198)][_0x2b1654(0x182)](),_0x229e2e=_0x21657c[_0x2b1654(0x163)](_0x38c36d=>_0x38c36d[_0x2b1654(0x166)][_0x2b1654(0x178)]===_0x1e5b51);if(!_0x229e2e)throw new SDKError(ErrorCode[_0x2b1654(0x172)],_0x2b1654(0x177)+_0x1e5b51+_0x2b1654(0x160),undefined,{'helpText':_0x2b1654(0x15d)});return _0x229e2e['id'];}const _0x579214=await _0xc4fcc3[_0x2b1654(0x198)][_0x2b1654(0x15f)]();return _0x579214['id'];}function a21_0x2dd9(_0x563937,_0x4d0712){_0x563937=_0x563937-0x155;const _0x5789a4=a21_0x5789();let _0x2dd969=_0x5789a4[_0x563937];return _0x2dd969;}export class LLMProxyCommand extends BaseCommand{[a21_0x2548f8(0x178)]=a21_0x2548f8(0x16f);['description']=a21_0x2548f8(0x170);[a21_0x2548f8(0x18f)];[a21_0x2548f8(0x186)];async[a21_0x2548f8(0x164)](_0x3f2ec9){const _0x75ff8c=a21_0x2548f8,{tdx:_0x52ad3b,options:_0x1459f3}=_0x3f2ec9;try{const _0x14f623=_0x1459f3,_0x25745e=_0x14f623['port']||0xfa0,_0x4f4b89=_0x14f623[_0x75ff8c(0x189)],_0x612d5e=await findAvailablePort(_0x25745e);console[_0x75ff8c(0x167)](a21_0x70a92d['dim']('Resolving\x20project...'));const _0x8621b4=await getProjectIdOrDefault(_0x3f2ec9,_0x4f4b89),_0x11a98a=await _0x52ad3b['llm'][_0x75ff8c(0x182)](),_0xa65e7f=_0x11a98a[_0x75ff8c(0x163)](_0x4dc394=>_0x4dc394['id']===_0x8621b4);this[_0x75ff8c(0x186)]=new TDXLogger(_0x1459f3[_0x75ff8c(0x17c)]),await this[_0x75ff8c(0x186)][_0x75ff8c(0x16e)](),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x18a)));_0x612d5e!==_0x25745e&&console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x156)]('Port\x20'+_0x25745e+_0x75ff8c(0x162)+_0x612d5e));this['server']=new ProxyServer({'port':_0x612d5e,'projectId':_0x8621b4,'tdx':_0x52ad3b,'logger':this[_0x75ff8c(0x186)],'site':_0x1459f3[_0x75ff8c(0x175)]}),await this['server']['start'](),console[_0x75ff8c(0x167)](a21_0x70a92d['yellow'][_0x75ff8c(0x157)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console['log'](a21_0x70a92d['yellow'](_0x75ff8c(0x195))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x156)](_0x75ff8c(0x159))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x18e)][_0x75ff8c(0x157)](_0x75ff8c(0x15c))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x179)](_0x75ff8c(0x17b))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x185)),a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x181)+_0x612d5e)),console['log'](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x171)),a21_0x70a92d[_0x75ff8c(0x187)](_0xa65e7f?.[_0x75ff8c(0x166)]['name']||_0x8621b4)),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x190)),a21_0x70a92d['white']('created\x20on-demand\x20per\x20model')),console[_0x75ff8c(0x167)](a21_0x70a92d['dim'](_0x75ff8c(0x17d)),a21_0x70a92d[_0x75ff8c(0x187)](_0x1459f3['site'])),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x179)](_0x75ff8c(0x169))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x15e))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x168))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x158))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x187)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x612d5e+'\x22,')),console['log'](a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x173))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x18d))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x196))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x187)](_0x75ff8c(0x197))),console[_0x75ff8c(0x167)](a21_0x70a92d['cyan'](_0x75ff8c(0x155))),console['log'](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x183))),console[_0x75ff8c(0x167)](a21_0x70a92d[_0x75ff8c(0x176)](_0x75ff8c(0x17f))),console[_0x75ff8c(0x167)](a21_0x70a92d['dim']('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console['log'](a21_0x70a92d['yellow'](_0x75ff8c(0x16b)));const _0x39cfcc=async()=>{const _0x3c3980=_0x75ff8c;console['log'](a21_0x70a92d[_0x3c3980(0x176)](_0x3c3980(0x161))),this[_0x3c3980(0x18f)]&&await this['server'][_0x3c3980(0x18c)](),this[_0x3c3980(0x186)]&&await this[_0x3c3980(0x186)]['close'](),console[_0x3c3980(0x167)](a21_0x70a92d[_0x3c3980(0x18e)](_0x3c3980(0x16a))),process['exit'](0x0);};return process['on'](_0x75ff8c(0x184),_0x39cfcc),process['on'](_0x75ff8c(0x16d),_0x39cfcc),await new Promise(()=>{}),0x0;}catch(_0x536756){this[_0x75ff8c(0x18f)]&&await this[_0x75ff8c(0x18f)]['stop']();this[_0x75ff8c(0x186)]&&await this[_0x75ff8c(0x186)][_0x75ff8c(0x16c)]();throw _0x536756;}}}