@treasuredata/tdx 0.16.16 → 0.16.18

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 (169) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.d.ts.map +1 -1
  62. package/dist/mcp/tools/tdx-run.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js.map +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/anthropic-adapter.js +1 -1
  67. package/dist/proxy/claude-usage-tracker.js +1 -1
  68. package/dist/proxy/context-signature.js +1 -1
  69. package/dist/proxy/conversation-utils.js +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/server.js +1 -1
  72. package/dist/proxy/session-cache.js +1 -1
  73. package/dist/proxy/sse-usage-parser.js +1 -1
  74. package/dist/sdk/agent/agent-config.js +1 -1
  75. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/api.js +1 -1
  83. package/dist/sdk/client/cdp-api-client.js +1 -1
  84. package/dist/sdk/client/endpoints.js +1 -1
  85. package/dist/sdk/client/engage-api-client.js +1 -1
  86. package/dist/sdk/client/http-client.js +1 -1
  87. package/dist/sdk/client/llm-api-client.js +1 -1
  88. package/dist/sdk/client/rate-limiter.js +1 -1
  89. package/dist/sdk/client/td-api-client.js +1 -1
  90. package/dist/sdk/client/trino-api-client.js +1 -1
  91. package/dist/sdk/client/workflow-client.js +1 -1
  92. package/dist/sdk/connection-validator.js +1 -1
  93. package/dist/sdk/connection.js +1 -1
  94. package/dist/sdk/engage.js +1 -1
  95. package/dist/sdk/errors.js +1 -1
  96. package/dist/sdk/index.js +1 -1
  97. package/dist/sdk/io/index.js +1 -1
  98. package/dist/sdk/io/node-filesystem.js +1 -1
  99. package/dist/sdk/job.js +1 -1
  100. package/dist/sdk/journey.js +1 -1
  101. package/dist/sdk/llm/chat-cache.js +1 -1
  102. package/dist/sdk/llm/index.js +1 -1
  103. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  104. package/dist/sdk/llm/model-aliases.js +1 -1
  105. package/dist/sdk/llm/model-factors.js +1 -1
  106. package/dist/sdk/query/index.js +1 -1
  107. package/dist/sdk/query/sql-parser.js +1 -1
  108. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  109. package/dist/sdk/segment/fields-display.js +1 -1
  110. package/dist/sdk/segment/file-discovery.js +1 -1
  111. package/dist/sdk/segment/journey-utils.js +1 -1
  112. package/dist/sdk/segment/journey-yaml.js +1 -1
  113. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  114. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  115. package/dist/sdk/segment/pull-workflow.js +1 -1
  116. package/dist/sdk/segment/push-workflow.js +1 -1
  117. package/dist/sdk/segment/resolution-context.js +1 -1
  118. package/dist/sdk/segment/segment-path-parser.js +1 -1
  119. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  120. package/dist/sdk/segment/target-resolution.js +1 -1
  121. package/dist/sdk/segment/tdx-config.js +1 -1
  122. package/dist/sdk/segment/validate-files.js +1 -1
  123. package/dist/sdk/segment/yaml-validator.js +1 -1
  124. package/dist/sdk/segment.js +1 -1
  125. package/dist/sdk/types/index.js +1 -1
  126. package/dist/sdk/types/progress.js +1 -1
  127. package/dist/sdk/user.js +1 -1
  128. package/dist/sdk/util/format-detector.js +1 -1
  129. package/dist/sdk/util/formatters.js +1 -1
  130. package/dist/sdk/util/index.js +1 -1
  131. package/dist/sdk/util/tree-formatter.js +1 -1
  132. package/dist/sdk/workflow/clone-workflow.js +1 -1
  133. package/dist/sdk/workflow/index.js +1 -1
  134. package/dist/sdk/workflow/pull-workflow.js +1 -1
  135. package/dist/sdk/workflow/push-workflow.js +1 -1
  136. package/dist/sdk/workflow/tdx-config.js +1 -1
  137. package/dist/sdk/workflow/workflow-utils.js +1 -1
  138. package/dist/test-utils/command-runner.js +1 -1
  139. package/dist/test-utils/factories.js +1 -1
  140. package/dist/test-utils/fixtures.js +1 -1
  141. package/dist/test-utils/http-mock.js +1 -1
  142. package/dist/test-utils/index.js +1 -1
  143. package/dist/utils/async.js +1 -1
  144. package/dist/utils/colors.js +1 -1
  145. package/dist/utils/diff.js +1 -1
  146. package/dist/utils/file-permissions.js +1 -1
  147. package/dist/utils/global-cache.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/local-cache.js +1 -1
  150. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  151. package/dist/utils/logger/formatters/index.js +1 -1
  152. package/dist/utils/logger/handlers/console-handler.js +1 -1
  153. package/dist/utils/logger/handlers/file-handler.js +1 -1
  154. package/dist/utils/logger/handlers/index.js +1 -1
  155. package/dist/utils/logger/handlers/null-handler.js +1 -1
  156. package/dist/utils/logger/index.js +1 -1
  157. package/dist/utils/logger/logger.js +1 -1
  158. package/dist/utils/logger/types.js +1 -1
  159. package/dist/utils/option-validation.js +1 -1
  160. package/dist/utils/port.js +1 -1
  161. package/dist/utils/process.js +1 -1
  162. package/dist/utils/prompt.js +1 -1
  163. package/dist/utils/spinner.js +1 -1
  164. package/dist/utils/sse-parser.js +1 -1
  165. package/dist/utils/string-utils.js +1 -1
  166. package/dist/utils/table-ref-parser.js +1 -1
  167. package/dist/utils/tdx-logger.js +1 -1
  168. package/dist/utils/version-check.js +1 -1
  169. package/package.json +1 -1
@@ -1 +1 @@
1
- const a17_0x143013=a17_0x53e6;(function(_0x3dde36,_0x3f73ef){const _0x7b342=a17_0x53e6,_0x1953fd=_0x3dde36();while(!![]){try{const _0x473ba4=-parseInt(_0x7b342(0xb5))/0x1*(parseInt(_0x7b342(0x87))/0x2)+parseInt(_0x7b342(0x89))/0x3*(-parseInt(_0x7b342(0x85))/0x4)+parseInt(_0x7b342(0xbf))/0x5*(-parseInt(_0x7b342(0xa6))/0x6)+parseInt(_0x7b342(0x8e))/0x7*(parseInt(_0x7b342(0xc3))/0x8)+parseInt(_0x7b342(0xaa))/0x9*(parseInt(_0x7b342(0xad))/0xa)+-parseInt(_0x7b342(0xab))/0xb+parseInt(_0x7b342(0xa0))/0xc;if(_0x473ba4===_0x3f73ef)break;else _0x1953fd['push'](_0x1953fd['shift']());}catch(_0x552700){_0x1953fd['push'](_0x1953fd['shift']());}}}(a17_0x2215,0x23464));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a17_0x53e6(_0x205a55,_0x35afb4){_0x205a55=_0x205a55-0x81;const _0x2215e9=a17_0x2215();let _0x53e698=_0x2215e9[_0x205a55];return _0x53e698;}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{['name']=a17_0x143013(0xbe);['description']='List\x20jobs';async[a17_0x143013(0xac)](_0x4e13cf){const _0x22a1a7=a17_0x143013,{options:_0x5266aa,tdx:_0x471d80}=_0x4e13cf;try{const _0x361fb7=resolveLimit(_0x5266aa[_0x22a1a7(0xb4)],DEFAULT_DISPLAY_LIMIT),_0x36313e=_0x5266aa[_0x22a1a7(0x8b)];_0x5266aa[_0x22a1a7(0xc7)]&&(console[_0x22a1a7(0xc6)]('Limit:\x20'+_0x361fb7+'\x20jobs'),_0x36313e&&console[_0x22a1a7(0xc6)]('Status\x20filter:\x20'+_0x36313e));const _0x391798=await withSpinner(_0x22a1a7(0xa1),()=>_0x471d80[_0x22a1a7(0xbe)][_0x22a1a7(0xbc)]({'from':0x0,'to':_0x361fb7-0x1,'status':_0x36313e}),{'verbose':_0x5266aa[_0x22a1a7(0xc7)]}),_0x408f08=_0x391798[_0x22a1a7(0x8f)];console['error'](_0x22a1a7(0x92)+_0x408f08[_0x22a1a7(0xc2)]+'\x20job'+(_0x408f08[_0x22a1a7(0xc2)]!==0x1?'s':''));const _0x22f633=_0x408f08['map'](_0x23b115=>{const _0x5e2856=_0x22a1a7;let _0x1e37e8;if(_0x23b115[_0x5e2856(0x95)]&&_0x23b115['end_at']){const _0x2b3561=new Date(_0x23b115[_0x5e2856(0x95)])[_0x5e2856(0xa4)](),_0x30dbe3=new Date(_0x23b115[_0x5e2856(0x83)])[_0x5e2856(0xa4)]();_0x1e37e8=Math[_0x5e2856(0x8d)]((_0x30dbe3-_0x2b3561)/0x3e8);}return{'job_id':_0x23b115['job_id'],'type':_0x23b115[_0x5e2856(0xb3)],'status':_0x23b115[_0x5e2856(0x8b)],'user_name':_0x23b115[_0x5e2856(0xb9)],'duration_sec':_0x1e37e8,'created_at':_0x23b115[_0x5e2856(0x97)],'started_at':_0x23b115[_0x5e2856(0x95)],'end_at':_0x23b115[_0x5e2856(0x83)]};});return await handleSDKOutput(_0x22f633,_0x5266aa),0x0;}catch(_0x49a756){if(_0x49a756 instanceof SDKError)return console['error']('Error:\x20'+_0x49a756['message']),_0x49a756[_0x22a1a7(0x98)]&&console[_0x22a1a7(0xc6)]('\x20\x20Cause:\x20'+_0x49a756[_0x22a1a7(0x98)]),0x1;throw _0x49a756;}}}export class JobShowCommand extends BaseCommand{[a17_0x143013(0x96)]=a17_0x143013(0x9d);[a17_0x143013(0xbd)]=a17_0x143013(0xc1);async[a17_0x143013(0xac)](_0x49962f){const _0x24eff9=a17_0x143013,{options:_0x7999d5,args:_0x1cf9c7,tdx:_0x59fed0}=_0x49962f,_0x2b8e39=_0x1cf9c7[0x0];if(!_0x2b8e39)return console[_0x24eff9(0xc6)](_0x24eff9(0xa5)),console[_0x24eff9(0xc6)](_0x24eff9(0x8a)),0x1;try{const _0x29873c=await withSpinner(_0x24eff9(0x9f),()=>_0x59fed0['jobs'][_0x24eff9(0xa3)](_0x2b8e39),{'verbose':_0x7999d5['verbose']}),_0x2e23d5=_0x29873c['data'];let _0x2d8892;if(_0x2e23d5[_0x24eff9(0x95)]&&_0x2e23d5[_0x24eff9(0x83)]){const _0x57fded=new Date(_0x2e23d5[_0x24eff9(0x95)])[_0x24eff9(0xa4)](),_0x1cb0d4=new Date(_0x2e23d5[_0x24eff9(0x83)])[_0x24eff9(0xa4)]();_0x2d8892=Math[_0x24eff9(0x8d)]((_0x1cb0d4-_0x57fded)/0x3e8);}const _0x34fcb4={'job_id':_0x2e23d5['job_id'],'type':_0x2e23d5['type'],'status':_0x2e23d5[_0x24eff9(0x8b)],..._0x2e23d5['user_name']&&{'user_name':_0x2e23d5[_0x24eff9(0xb9)]},..._0x2d8892!==undefined&&{'duration_sec':_0x2d8892},..._0x2e23d5[_0x24eff9(0x97)]&&{'created_at':_0x2e23d5[_0x24eff9(0x97)]},..._0x2e23d5['start_at']&&{'started_at':_0x2e23d5[_0x24eff9(0x95)]},..._0x2e23d5['end_at']&&{'end_at':_0x2e23d5[_0x24eff9(0x83)]},..._0x2e23d5[_0x24eff9(0x90)]&&{'database':_0x2e23d5[_0x24eff9(0x90)]},..._0x2e23d5[_0x24eff9(0xb8)]!==undefined&&{'priority':_0x2e23d5[_0x24eff9(0xb8)]},..._0x2e23d5['url']&&{'url':_0x2e23d5[_0x24eff9(0xc0)]},..._0x2e23d5['query']&&{'query':_0x2e23d5['query']},..._0x2e23d5[_0x24eff9(0xb6)]&&{'debug':_0x2e23d5[_0x24eff9(0xb6)]}};return await handleSingleObjectOutput(_0x34fcb4,_0x7999d5),0x0;}catch(_0x14e019){if(_0x14e019 instanceof SDKError)return console['error']('Error:\x20'+_0x14e019[_0x24eff9(0xa9)]),_0x14e019['cause']&&console[_0x24eff9(0xc6)](_0x24eff9(0x81)+_0x14e019[_0x24eff9(0x98)]),0x1;throw _0x14e019;}}}export class JobKillCommand extends BaseCommand{[a17_0x143013(0x96)]='job:kill';[a17_0x143013(0xbd)]=a17_0x143013(0xaf);async[a17_0x143013(0xac)](_0x375c67){const _0x712d87=a17_0x143013,{options:_0x4d25ca,args:_0x30fba2,tdx:_0x55cc11}=_0x375c67,_0x825b8d=_0x30fba2[0x0];if(!_0x825b8d)return console['error'](_0x712d87(0xa5)),console['error'](_0x712d87(0xc9)),0x1;try{if(!_0x4d25ca[_0x712d87(0xae)]){const _0x5da38c=await confirm(_0x712d87(0x8c)+_0x825b8d+'?');if(!_0x5da38c)return console[_0x712d87(0xc6)]('Cancelled'),0x0;}return await withSpinner(_0x712d87(0xca),()=>_0x55cc11['jobs'][_0x712d87(0x88)](_0x825b8d),{'verbose':_0x4d25ca[_0x712d87(0xc7)]}),console[_0x712d87(0xc6)](_0x712d87(0xb0)+_0x825b8d),console[_0x712d87(0xc6)]('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x825b8d+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x5c4e4d){if(_0x5c4e4d instanceof SDKError)return console[_0x712d87(0xc6)](_0x712d87(0xc8)+_0x5c4e4d[_0x712d87(0xa9)]),_0x5c4e4d[_0x712d87(0x98)]&&console[_0x712d87(0xc6)]('\x20\x20Cause:\x20'+_0x5c4e4d[_0x712d87(0x98)]),0x1;throw _0x5c4e4d;}}}export class JobSubmitCommand extends BaseCommand{['name']=a17_0x143013(0x86);[a17_0x143013(0xbd)]=a17_0x143013(0xa2);async['execute'](_0x12abb5){const _0x11356b=a17_0x143013,{options:_0x42fa5e,args:_0x194a49,tdx:_0x4ddd6e}=_0x12abb5;try{const _0x34903b=_0x42fa5e[_0x11356b(0xa8)]||_0x11356b(0x91),_0x221387=_0x42fa5e['file'],_0x3ea7d6=_0x42fa5e['database']||'information_schema';if(_0x34903b!=='trino'&&_0x34903b!==_0x11356b(0xba))return console['error'](_0x11356b(0x94)),0x1;let _0x1b97b6;if(_0x221387){if(_0x194a49[0x0])return console[_0x11356b(0xc6)]('Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option'),0x1;const _0x1ef783=readSqlStatementsFromFile(_0x221387);if(_0x1ef783[_0x11356b(0xc2)]===0x0)return console[_0x11356b(0xc6)](_0x11356b(0x9e)),0x1;if(_0x1ef783[_0x11356b(0xc2)]>0x1)return console[_0x11356b(0xc6)](_0x11356b(0xa7)),0x1;_0x1b97b6=_0x1ef783[0x0];}else{if(!_0x194a49[0x0])return console['error'](_0x11356b(0x93)),console[_0x11356b(0xc6)](_0x11356b(0xc5)),0x1;_0x1b97b6=_0x194a49[0x0];}_0x42fa5e['verbose']&&(console['error'](_0x11356b(0xb7)+_0x34903b),console[_0x11356b(0xc6)](_0x11356b(0xc4)+_0x3ea7d6),console['error'](_0x11356b(0x9b)+_0x1b97b6[_0x11356b(0x99)](0x0,0x64)+(_0x1b97b6['length']>0x64?_0x11356b(0x9a):'')));const _0x34227a=await withSpinner('Submitting\x20job...',()=>_0x4ddd6e[_0x11356b(0xbe)][_0x11356b(0xbb)](_0x3ea7d6,_0x1b97b6,_0x34903b),{'verbose':_0x42fa5e['verbose']}),_0xcefd53=_0x34227a['data'];return console[_0x11356b(0xc6)]('✔\x20Job\x20submitted'),console[_0x11356b(0xc6)](_0x11356b(0x9c)+_0xcefd53[_0x11356b(0x84)]),await handleSDKOutput([_0xcefd53],_0x42fa5e),0x0;}catch(_0x277ddd){if(_0x277ddd instanceof SDKError)return console[_0x11356b(0xc6)](_0x11356b(0xc8)+_0x277ddd[_0x11356b(0xa9)]),_0x277ddd[_0x11356b(0x98)]&&console['error'](_0x11356b(0x81)+_0x277ddd['cause']),0x1;throw _0x277ddd;}}}export class JobResultCommand extends BaseCommand{[a17_0x143013(0x96)]='job:result';[a17_0x143013(0xbd)]=a17_0x143013(0x82);async[a17_0x143013(0xac)](_0x2ad0a1){const _0x3ffba2=a17_0x143013,{options:_0x2c1852,args:_0x49f57d,tdx:_0x4f64d6}=_0x2ad0a1,_0x1bbb04=_0x49f57d[0x0];if(!_0x1bbb04)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0x3ffba2(0xc6)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x26a159=await withSpinner(_0x3ffba2(0xb1),()=>_0x4f64d6[_0x3ffba2(0xbe)][_0x3ffba2(0xb2)](_0x1bbb04),{'verbose':_0x2c1852[_0x3ffba2(0xc7)]}),_0x467108=_0x26a159['data'];return console['error']('✔\x20Retrieved\x20'+_0x467108['length']+'\x20row'+(_0x467108['length']!==0x1?'s':'')),await handleSDKOutput(_0x467108,_0x2c1852),0x0;}catch(_0x2f575a){if(_0x2f575a instanceof SDKError)return console[_0x3ffba2(0xc6)](_0x3ffba2(0xc8)+_0x2f575a[_0x3ffba2(0xa9)]),_0x2f575a[_0x3ffba2(0x98)]&&console[_0x3ffba2(0xc6)](_0x3ffba2(0x81)+_0x2f575a['cause']),0x1;throw _0x2f575a;}}}function a17_0x2215(){const _0x4649e3=['Database:\x20','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','error','verbose','Error:\x20','Usage:\x20job\x20kill\x20<job-id>','Submitting\x20kill\x20request...','\x20\x20Cause:\x20','Get\x20job\x20results','end_at','job_id','10264JlNspA','job:submit','1668Tvkncz','kill','102HwureF','Usage:\x20job\x20show\x20<job-id>','status','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','round','119BJbVlt','data','database','trino','✔\x20Found\x20','Error:\x20Query\x20is\x20required','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','start_at','name','created_at','cause','substring','...','Query:\x20','\x20\x20Job\x20ID:\x20','job:show','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Getting\x20job\x20details...','7128504qHsmON','Listing\x20jobs...','Submit\x20a\x20job','show','getTime','Error:\x20Job\x20ID\x20is\x20required','6ptIOLq','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','jobType','message','9eADohG','1394723PRjuLd','execute','24160nQZzJU','yes','Kill\x20a\x20job','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Getting\x20job\x20results...','result','type','limit','157InEzaC','debug','Job\x20type:\x20','priority','user_name','hive','submit','list','description','jobs','1295830gEKvej','url','Show\x20job\x20details','length','71608hVhYhC'];a17_0x2215=function(){return _0x4649e3;};return a17_0x2215();}
1
+ function a17_0x2847(){const _0x4c259d=['Cancelled','show','1164010MwMLfr','3sbfffo','4017986EwwVnT','Error:\x20','30VJAOyj','\x20\x20Job\x20ID:\x20','Kill\x20a\x20job','Query:\x20','Submit\x20a\x20job','Usage:\x20job\x20show\x20<job-id>','database','information_schema','✔\x20Job\x20submitted','kill','priority','Submitting\x20job...','\x20job','6TaXiDs','name','error','start_at','658151SxClBW','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','data','Show\x20job\x20details','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Getting\x20job\x20results...','description','Error:\x20Job\x20ID\x20is\x20required','user_name','\x20jobs','query','job:result','round','submit','url','Listing\x20jobs...','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','created_at','status','✔\x20Found\x20','List\x20jobs','job:submit','Status\x20filter:\x20','trino','verbose','getTime','Database:\x20','end_at','90394prCSob','cause','6309160MNjYPM','job:show','execute','Usage:\x20job\x20kill\x20<job-id>','map','Get\x20job\x20results','debug','jobType','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Getting\x20job\x20details...','✔\x20Retrieved\x20','list','message','63ckljeV','\x20\x20Cause:\x20','246408tJmzcm','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','yes','12356476StFSPy','type','substring','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','job_id','Limit:\x20','Error:\x20Query\x20is\x20required','jobs','length'];a17_0x2847=function(){return _0x4c259d;};return a17_0x2847();}const a17_0xb221b2=a17_0x64ec;(function(_0x27d74e,_0x45a751){const _0x5e068e=a17_0x64ec,_0x4cfd91=_0x27d74e();while(!![]){try{const _0x334f2d=-parseInt(_0x5e068e(0x19d))/0x1+-parseInt(_0x5e068e(0x1b9))/0x2*(-parseInt(_0x5e068e(0x189))/0x3)+parseInt(_0x5e068e(0x1cb))/0x4*(-parseInt(_0x5e068e(0x18c))/0x5)+-parseInt(_0x5e068e(0x199))/0x6*(-parseInt(_0x5e068e(0x18a))/0x7)+-parseInt(_0x5e068e(0x1bb))/0x8+parseInt(_0x5e068e(0x1c9))/0x9*(parseInt(_0x5e068e(0x188))/0xa)+parseInt(_0x5e068e(0x1ce))/0xb;if(_0x334f2d===_0x45a751)break;else _0x4cfd91['push'](_0x4cfd91['shift']());}catch(_0x1a060f){_0x4cfd91['push'](_0x4cfd91['shift']());}}}(a17_0x2847,0xb4e2e));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{['name']=a17_0xb221b2(0x184);[a17_0xb221b2(0x1a3)]=a17_0xb221b2(0x1b1);async[a17_0xb221b2(0x1bd)](_0x12197f){const _0x1cdd30=a17_0xb221b2,{options:_0x4b2cc7,tdx:_0x4b69e1}=_0x12197f;try{const _0x4dc1da=resolveLimit(_0x4b2cc7['limit'],DEFAULT_DISPLAY_LIMIT),_0x4e34dc=_0x4b2cc7[_0x1cdd30(0x1af)];_0x4b2cc7[_0x1cdd30(0x1b5)]&&(console[_0x1cdd30(0x19b)](_0x1cdd30(0x182)+_0x4dc1da+_0x1cdd30(0x1a6)),_0x4e34dc&&console[_0x1cdd30(0x19b)](_0x1cdd30(0x1b3)+_0x4e34dc));const _0x3c7a4d=await withSpinner(_0x1cdd30(0x1ac),()=>_0x4b69e1[_0x1cdd30(0x184)][_0x1cdd30(0x1c7)]({'from':0x0,'to':_0x4dc1da-0x1,'status':_0x4e34dc}),{'verbose':_0x4b2cc7[_0x1cdd30(0x1b5)]}),_0x353b06=_0x3c7a4d[_0x1cdd30(0x19f)];console[_0x1cdd30(0x19b)](_0x1cdd30(0x1b0)+_0x353b06[_0x1cdd30(0x185)]+_0x1cdd30(0x198)+(_0x353b06[_0x1cdd30(0x185)]!==0x1?'s':''));const _0x4bbf23=_0x353b06[_0x1cdd30(0x1bf)](_0x3510a5=>{const _0x137ba4=_0x1cdd30;let _0xab7b15;if(_0x3510a5['start_at']&&_0x3510a5[_0x137ba4(0x1b8)]){const _0x450452=new Date(_0x3510a5[_0x137ba4(0x19c)])[_0x137ba4(0x1b6)](),_0xddbe40=new Date(_0x3510a5[_0x137ba4(0x1b8)])['getTime']();_0xab7b15=Math['round']((_0xddbe40-_0x450452)/0x3e8);}return{'job_id':_0x3510a5[_0x137ba4(0x181)],'type':_0x3510a5[_0x137ba4(0x1cf)],'status':_0x3510a5[_0x137ba4(0x1af)],'user_name':_0x3510a5[_0x137ba4(0x1a5)],'duration_sec':_0xab7b15,'created_at':_0x3510a5[_0x137ba4(0x1ae)],'started_at':_0x3510a5['start_at'],'end_at':_0x3510a5[_0x137ba4(0x1b8)]};});return await handleSDKOutput(_0x4bbf23,_0x4b2cc7),0x0;}catch(_0xd39848){if(_0xd39848 instanceof SDKError)return console[_0x1cdd30(0x19b)](_0x1cdd30(0x18b)+_0xd39848[_0x1cdd30(0x1c8)]),_0xd39848[_0x1cdd30(0x1ba)]&&console[_0x1cdd30(0x19b)](_0x1cdd30(0x1ca)+_0xd39848[_0x1cdd30(0x1ba)]),0x1;throw _0xd39848;}}}export class JobShowCommand extends BaseCommand{['name']=a17_0xb221b2(0x1bc);['description']=a17_0xb221b2(0x1a0);async['execute'](_0x2fa62b){const _0x5728ce=a17_0xb221b2,{options:_0x1def80,args:_0x21dfbb,tdx:_0x41af60}=_0x2fa62b,_0x527401=_0x21dfbb[0x0];if(!_0x527401)return console[_0x5728ce(0x19b)](_0x5728ce(0x1a4)),console[_0x5728ce(0x19b)](_0x5728ce(0x191)),0x1;try{const _0x275fec=await withSpinner(_0x5728ce(0x1c5),()=>_0x41af60[_0x5728ce(0x184)][_0x5728ce(0x187)](_0x527401),{'verbose':_0x1def80[_0x5728ce(0x1b5)]}),_0x4a063f=_0x275fec[_0x5728ce(0x19f)];let _0x257390;if(_0x4a063f[_0x5728ce(0x19c)]&&_0x4a063f['end_at']){const _0x3f91c4=new Date(_0x4a063f[_0x5728ce(0x19c)])[_0x5728ce(0x1b6)](),_0x1820e6=new Date(_0x4a063f[_0x5728ce(0x1b8)])[_0x5728ce(0x1b6)]();_0x257390=Math[_0x5728ce(0x1a9)]((_0x1820e6-_0x3f91c4)/0x3e8);}const _0x520657={'job_id':_0x4a063f[_0x5728ce(0x181)],'type':_0x4a063f[_0x5728ce(0x1cf)],'status':_0x4a063f[_0x5728ce(0x1af)],..._0x4a063f[_0x5728ce(0x1a5)]&&{'user_name':_0x4a063f[_0x5728ce(0x1a5)]},..._0x257390!==undefined&&{'duration_sec':_0x257390},..._0x4a063f[_0x5728ce(0x1ae)]&&{'created_at':_0x4a063f[_0x5728ce(0x1ae)]},..._0x4a063f[_0x5728ce(0x19c)]&&{'started_at':_0x4a063f[_0x5728ce(0x19c)]},..._0x4a063f[_0x5728ce(0x1b8)]&&{'end_at':_0x4a063f['end_at']},..._0x4a063f[_0x5728ce(0x192)]&&{'database':_0x4a063f[_0x5728ce(0x192)]},..._0x4a063f[_0x5728ce(0x196)]!==undefined&&{'priority':_0x4a063f[_0x5728ce(0x196)]},..._0x4a063f[_0x5728ce(0x1ab)]&&{'url':_0x4a063f[_0x5728ce(0x1ab)]},..._0x4a063f[_0x5728ce(0x1a7)]&&{'query':_0x4a063f[_0x5728ce(0x1a7)]},..._0x4a063f[_0x5728ce(0x1c1)]&&{'debug':_0x4a063f[_0x5728ce(0x1c1)]}};return await handleSingleObjectOutput(_0x520657,_0x1def80),0x0;}catch(_0x291e32){if(_0x291e32 instanceof SDKError)return console[_0x5728ce(0x19b)](_0x5728ce(0x18b)+_0x291e32['message']),_0x291e32[_0x5728ce(0x1ba)]&&console[_0x5728ce(0x19b)](_0x5728ce(0x1ca)+_0x291e32[_0x5728ce(0x1ba)]),0x1;throw _0x291e32;}}}export class JobKillCommand extends BaseCommand{[a17_0xb221b2(0x19a)]='job:kill';[a17_0xb221b2(0x1a3)]=a17_0xb221b2(0x18e);async[a17_0xb221b2(0x1bd)](_0x19b646){const _0x36590f=a17_0xb221b2,{options:_0x450d40,args:_0x48aac6,tdx:_0x5a7f6d}=_0x19b646,_0x142c8e=_0x48aac6[0x0];if(!_0x142c8e)return console[_0x36590f(0x19b)](_0x36590f(0x1a4)),console[_0x36590f(0x19b)](_0x36590f(0x1be)),0x1;try{if(!_0x450d40[_0x36590f(0x1cd)]){const _0x2827be=await confirm(_0x36590f(0x1c3)+_0x142c8e+'?');if(!_0x2827be)return console[_0x36590f(0x19b)](_0x36590f(0x186)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x5a7f6d[_0x36590f(0x184)][_0x36590f(0x195)](_0x142c8e),{'verbose':_0x450d40['verbose']}),console[_0x36590f(0x19b)](_0x36590f(0x1ad)+_0x142c8e),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x142c8e+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x4bde76){if(_0x4bde76 instanceof SDKError)return console[_0x36590f(0x19b)](_0x36590f(0x18b)+_0x4bde76[_0x36590f(0x1c8)]),_0x4bde76[_0x36590f(0x1ba)]&&console[_0x36590f(0x19b)](_0x36590f(0x1ca)+_0x4bde76[_0x36590f(0x1ba)]),0x1;throw _0x4bde76;}}}function a17_0x64ec(_0x4e5b88,_0x4b4013){_0x4e5b88=_0x4e5b88-0x17f;const _0x284745=a17_0x2847();let _0x64ec5b=_0x284745[_0x4e5b88];return _0x64ec5b;}export class JobSubmitCommand extends BaseCommand{[a17_0xb221b2(0x19a)]=a17_0xb221b2(0x1b2);[a17_0xb221b2(0x1a3)]=a17_0xb221b2(0x190);async[a17_0xb221b2(0x1bd)](_0xa50c20){const _0x2d336f=a17_0xb221b2,{options:_0x2ba339,args:_0x5c8ca7,tdx:_0x157883}=_0xa50c20;try{const _0x3949c5=_0x2ba339[_0x2d336f(0x1c2)]||_0x2d336f(0x1b4),_0xa57408=_0x2ba339['file'],_0x20a777=_0x2ba339[_0x2d336f(0x192)]||_0x2d336f(0x193);if(_0x3949c5!=='trino'&&_0x3949c5!=='hive')return console[_0x2d336f(0x19b)](_0x2d336f(0x1cc)),0x1;let _0x40bba2;if(_0xa57408){if(_0x5c8ca7[0x0])return console[_0x2d336f(0x19b)](_0x2d336f(0x19e)),0x1;const _0x2b5447=readSqlStatementsFromFile(_0xa57408);if(_0x2b5447[_0x2d336f(0x185)]===0x0)return console[_0x2d336f(0x19b)](_0x2d336f(0x1c4)),0x1;if(_0x2b5447['length']>0x1)return console[_0x2d336f(0x19b)](_0x2d336f(0x1a1)),0x1;_0x40bba2=_0x2b5447[0x0];}else{if(!_0x5c8ca7[0x0])return console[_0x2d336f(0x19b)](_0x2d336f(0x183)),console[_0x2d336f(0x19b)](_0x2d336f(0x180)),0x1;_0x40bba2=_0x5c8ca7[0x0];}_0x2ba339[_0x2d336f(0x1b5)]&&(console[_0x2d336f(0x19b)]('Job\x20type:\x20'+_0x3949c5),console[_0x2d336f(0x19b)](_0x2d336f(0x1b7)+_0x20a777),console[_0x2d336f(0x19b)](_0x2d336f(0x18f)+_0x40bba2[_0x2d336f(0x17f)](0x0,0x64)+(_0x40bba2[_0x2d336f(0x185)]>0x64?'...':'')));const _0x59387e=await withSpinner(_0x2d336f(0x197),()=>_0x157883[_0x2d336f(0x184)][_0x2d336f(0x1aa)](_0x20a777,_0x40bba2,_0x3949c5),{'verbose':_0x2ba339[_0x2d336f(0x1b5)]}),_0x4bf184=_0x59387e['data'];return console[_0x2d336f(0x19b)](_0x2d336f(0x194)),console['error'](_0x2d336f(0x18d)+_0x4bf184[_0x2d336f(0x181)]),await handleSDKOutput([_0x4bf184],_0x2ba339),0x0;}catch(_0x5cc570){if(_0x5cc570 instanceof SDKError)return console[_0x2d336f(0x19b)](_0x2d336f(0x18b)+_0x5cc570['message']),_0x5cc570['cause']&&console[_0x2d336f(0x19b)](_0x2d336f(0x1ca)+_0x5cc570[_0x2d336f(0x1ba)]),0x1;throw _0x5cc570;}}}export class JobResultCommand extends BaseCommand{['name']=a17_0xb221b2(0x1a8);[a17_0xb221b2(0x1a3)]=a17_0xb221b2(0x1c0);async['execute'](_0x2beb29){const _0x4749a7=a17_0xb221b2,{options:_0x546651,args:_0x104f30,tdx:_0x12c26e}=_0x2beb29,_0x430dc1=_0x104f30[0x0];if(!_0x430dc1)return console[_0x4749a7(0x19b)](_0x4749a7(0x1a4)),console[_0x4749a7(0x19b)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x1f64d5=await withSpinner(_0x4749a7(0x1a2),()=>_0x12c26e['jobs']['result'](_0x430dc1),{'verbose':_0x546651[_0x4749a7(0x1b5)]}),_0x231689=_0x1f64d5[_0x4749a7(0x19f)];return console[_0x4749a7(0x19b)](_0x4749a7(0x1c6)+_0x231689[_0x4749a7(0x185)]+'\x20row'+(_0x231689['length']!==0x1?'s':'')),await handleSDKOutput(_0x231689,_0x546651),0x0;}catch(_0x3bdda4){if(_0x3bdda4 instanceof SDKError)return console['error']('Error:\x20'+_0x3bdda4[_0x4749a7(0x1c8)]),_0x3bdda4[_0x4749a7(0x1ba)]&&console['error'](_0x4749a7(0x1ca)+_0x3bdda4['cause']),0x1;throw _0x3bdda4;}}}
@@ -1 +1 @@
1
- const a18_0x1f4869=a18_0x2cca;(function(_0x540a25,_0x289aab){const _0x983f22=a18_0x2cca,_0x174775=_0x540a25();while(!![]){try{const _0x4073d6=parseInt(_0x983f22(0x1fc))/0x1*(parseInt(_0x983f22(0x201))/0x2)+-parseInt(_0x983f22(0x208))/0x3+parseInt(_0x983f22(0x227))/0x4+parseInt(_0x983f22(0x1fb))/0x5+parseInt(_0x983f22(0x1e3))/0x6+parseInt(_0x983f22(0x1cd))/0x7*(parseInt(_0x983f22(0x262))/0x8)+-parseInt(_0x983f22(0x268))/0x9*(parseInt(_0x983f22(0x1e9))/0xa);if(_0x4073d6===_0x289aab)break;else _0x174775['push'](_0x174775['shift']());}catch(_0x3e6c4a){_0x174775['push'](_0x174775['shift']());}}}(a18_0x2094,0x58c89));import a18_0x4a83e5 from'chalk';import a18_0x4ada86 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';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(_0x49a986){const _0x440718=a18_0x2cca;switch(_0x49a986){case _0x440718(0x1f4):return a18_0x4a83e5[_0x440718(0x21b)](_0x440718(0x1ad));case'draft':return a18_0x4a83e5[_0x440718(0x1c5)](_0x440718(0x246));case _0x440718(0x232):return a18_0x4a83e5[_0x440718(0x1bc)]('(paused)');case _0x440718(0x231):return a18_0x4a83e5[_0x440718(0x1a6)](_0x440718(0x216));case _0x440718(0x20d):return a18_0x4a83e5['dim'](_0x440718(0x1cf));default:return'('+_0x49a986+')';}}function formatJourneyItem(_0x46f2af,_0x4ce0e2='',_0x17c8e8){const _0xdc6e31=a18_0x2cca,_0x1b014a=formatJourneyState(_0x46f2af[_0xdc6e31(0x1c9)]),_0x30782f=_0x17c8e8?hyperlink(_0x46f2af['journeyBundleName'],_0x17c8e8):_0x46f2af[_0xdc6e31(0x247)];return _0x4ce0e2+_0xdc6e31(0x215)+_0x30782f+'\x20'+_0x1b014a;}function escapeRegex(_0x16ba47){const _0x5e8f0d=a18_0x2cca;return _0x16ba47[_0x5e8f0d(0x223)](/[.*+?^${}()|[\]\\]/g,_0x5e8f0d(0x238));}function globToRegex(_0x1e2e53){const _0x30d0e9=a18_0x2cca,_0x1eaba4=_0x1e2e53[_0x30d0e9(0x1fe)]('*')[_0x30d0e9(0x256)](escapeRegex);return new RegExp(_0x1eaba4[_0x30d0e9(0x267)]('.*'),'i');}function buildRuleToNameMapping(_0x37acb9){const _0x3e701b=a18_0x2cca,_0x13e76d=new Map();if(_0x37acb9[_0x3e701b(0x235)])for(const [_0x42f2a1,_0x205590]of Object[_0x3e701b(0x217)](_0x37acb9[_0x3e701b(0x235)])){if(_0x205590[_0x3e701b(0x25c)]){const _0x4af28b=serializeRule(_0x205590[_0x3e701b(0x25c)]),_0x1e3747=_0x13e76d[_0x3e701b(0x239)](_0x4af28b);_0x1e3747?_0x1e3747[_0x3e701b(0x1e1)](_0x42f2a1):_0x13e76d['set'](_0x4af28b,[_0x42f2a1]);}}return _0x13e76d;}async function resolveJourneyTarget(_0x5bfc28,_0x374193,_0x426ab8){const _0x4bbd38=a18_0x2cca;if(isYamlFilePath(_0x5bfc28))try{const _0xbae919=await resolveYamlFilePath(_0x5bfc28);return _0x426ab8&&(console[_0x4bbd38(0x269)](_0x4bbd38(0x23d)+_0x5bfc28),console['error'](_0x4bbd38(0x24e)+_0xbae919[_0x4bbd38(0x209)]),console['error'](_0x4bbd38(0x1b2)+_0xbae919[_0x4bbd38(0x236)]),console['error'](_0x4bbd38(0x1b9)+(_0xbae919[_0x4bbd38(0x265)]||_0x4bbd38(0x266)))),{'journeyName':_0xbae919[_0x4bbd38(0x236)],'parentSegment':_0xbae919[_0x4bbd38(0x209)],'resolved':_0xbae919};}catch(_0x364a3f){throw new SDKError(ErrorCode[_0x4bbd38(0x22e)],_0x4bbd38(0x1ec)+_0x364a3f[_0x4bbd38(0x1ea)]);}if(!_0x374193)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x5bfc28,'parentSegment':_0x374193};}export class JourneyListCommand extends BaseCommand{['name']=a18_0x1f4869(0x25a);[a18_0x1f4869(0x1dd)]=a18_0x1f4869(0x205);async[a18_0x1f4869(0x1f3)](_0x121c30){const _0x2e2d44=a18_0x1f4869,{options:_0x16e91a,args:_0xcacb38,tdx:_0x1388b5}=_0x121c30,_0x23fec5=_0xcacb38[0x0],_0x299f7a=_0x16e91a[_0x2e2d44(0x209)];if(!_0x299f7a)return console[_0x2e2d44(0x269)](_0x2e2d44(0x243)),console[_0x2e2d44(0x269)](_0x2e2d44(0x1b0)),0x1;const _0x6beba2=await withSpinner(_0x2e2d44(0x25d),()=>_0x1388b5[_0x2e2d44(0x1cc)][_0x2e2d44(0x26f)](_0x299f7a),{'verbose':_0x16e91a['verbose']}),_0x1ed629=_0x6beba2[_0x2e2d44(0x20e)];_0x16e91a[_0x2e2d44(0x1ab)]&&(console[_0x2e2d44(0x269)](_0x2e2d44(0x21a)+_0x299f7a+_0x2e2d44(0x258)+_0x1ed629+')'),_0x23fec5&&console[_0x2e2d44(0x269)](_0x2e2d44(0x21f)+_0x23fec5));const _0x2664cf=await withSpinner(_0x2e2d44(0x1e7),()=>_0x1388b5[_0x2e2d44(0x1cc)][_0x2e2d44(0x1ef)](_0x1ed629),{'verbose':_0x16e91a[_0x2e2d44(0x1ab)]}),_0x1083a3=_0x2664cf[_0x2e2d44(0x20e)],_0x572d0d=_0x1083a3[_0x2e2d44(0x23c)],_0x4ccdce=await withSpinner('Listing\x20journeys...',()=>_0x1388b5['journey'][_0x2e2d44(0x1d0)](_0x1ed629,_0x572d0d),{'verbose':_0x16e91a['verbose']});let _0x2136d5=_0x4ccdce[_0x2e2d44(0x20e)]['journeys'];const _0x55d88a=_0x4ccdce[_0x2e2d44(0x20e)]['folders'],_0xc1846=new Map();for(const _0x447205 of _0x55d88a){_0xc1846[_0x2e2d44(0x214)](_0x447205['id'],_0x447205[_0x2e2d44(0x1f5)]);}if(_0x23fec5){const _0xda9215=globToRegex(_0x23fec5);_0x2136d5=_0x2136d5[_0x2e2d44(0x1ed)](_0x1bb892=>_0xda9215[_0x2e2d44(0x1c1)](_0x1bb892[_0x2e2d44(0x247)]));}console['error'](_0x2e2d44(0x261)+_0x2136d5['length']+'\x20journey'+(_0x2136d5['length']!==0x1?'s':''));const _0x443c68=_0x5555d5=>{const _0x35bc2b=_0x2e2d44;return getConsoleNextUrl(_0x16e91a[_0x35bc2b(0x23b)],_0x35bc2b(0x26b)+_0x1ed629+_0x35bc2b(0x24a)+_0x5555d5+_0x35bc2b(0x21c));};if(_0x16e91a[_0x2e2d44(0x1f1)]===_0x2e2d44(0x251))await handleSDKOutput(_0x2136d5,_0x16e91a);else{if(_0x16e91a[_0x2e2d44(0x1f1)]===_0x2e2d44(0x26c)){const _0x1e01aa=_0x2136d5[_0x2e2d44(0x256)](_0x4a78d4=>({..._0x4a78d4,'url':_0x443c68(_0x4a78d4['id'])}));await handleSDKOutput(_0x1e01aa,_0x16e91a);}else{console[_0x2e2d44(0x210)]('['+_0x299f7a+']');const _0xc395a5=new Map(),_0x1a2c0f=[];for(const _0x2f1c62 of _0x2136d5){if(!_0x2f1c62[_0x2e2d44(0x255)]||_0x2f1c62[_0x2e2d44(0x255)]===_0x572d0d)_0x1a2c0f[_0x2e2d44(0x1e1)](_0x2f1c62);else{const _0x32e783=_0xc395a5[_0x2e2d44(0x239)](_0x2f1c62[_0x2e2d44(0x255)])||[];_0x32e783[_0x2e2d44(0x1e1)](_0x2f1c62),_0xc395a5[_0x2e2d44(0x214)](_0x2f1c62[_0x2e2d44(0x255)],_0x32e783);}}const _0xab9169=(_0x304802,_0x2320e6)=>_0x304802[_0x2e2d44(0x247)][_0x2e2d44(0x1ff)](_0x2320e6[_0x2e2d44(0x247)],undefined,{'sensitivity':'base'});_0x1a2c0f[_0x2e2d44(0x1c4)](_0xab9169);for(const _0x40457e of _0x1a2c0f){console[_0x2e2d44(0x210)](formatJourneyItem(_0x40457e,'',_0x443c68(_0x40457e['id'])));}const _0x5b86ea=[..._0xc395a5[_0x2e2d44(0x217)]()][_0x2e2d44(0x1c4)]((_0x19d907,_0x2f6490)=>{const _0x1e792d=_0x2e2d44,_0x10168a=_0xc1846[_0x1e792d(0x239)](_0x19d907[0x0])||_0x19d907[0x0],_0x11ac15=_0xc1846['get'](_0x2f6490[0x0])||_0x2f6490[0x0];return _0x10168a[_0x1e792d(0x1ff)](_0x11ac15,undefined,{'sensitivity':'base'});});for(const [_0x8e05d6,_0x17cc2b]of _0x5b86ea){const _0x28ed64=_0xc1846[_0x2e2d44(0x239)](_0x8e05d6)||_0x8e05d6;console[_0x2e2d44(0x210)]('📁\x20'+_0x28ed64),_0x17cc2b[_0x2e2d44(0x1c4)](_0xab9169);for(const _0x51b7a2 of _0x17cc2b){console[_0x2e2d44(0x210)](formatJourneyItem(_0x51b7a2,'\x20\x20',_0x443c68(_0x51b7a2['id'])));}}}}return 0x0;}}function a18_0x2094(){const _0x3d8be0=['population','set','🗺️\x20','(completed)','entries','utf-8','getJourney','Parent\x20segment:\x20','green','/j/da','\x20\x20Statistics\x20not\x20available','hasChanges','Pattern:\x20','\x20\x20-\x20','session','length','replace','Listing\x20folders...','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','versionNumber','2836704bFfGAC','all','Journey\x20name:\x20','root\x20folder','journey:stats','type','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','INVALID_ARGUMENT','red','helpText','completed','paused','\x20changed\x20files','totalGoalAchieved','segments','segmentName','Pausing\x20journey...','\x5c$&','get','size','site','rootFolderId','Resolved\x20YAML\x20file:\x20','journey:push','Resolving\x20journey...','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Target\x20directory:\x20','journey:pull','Error:\x20Parent\x20segment\x20context\x20required','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','errorCode','(draft)','journeyBundleName','add','segmentPushCommand','/e/','has','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','\x20\x20Parent\x20segment:\x20','conversionRate','...','table','\x20(rule\x20match)','Error:\x20Journey\x20not\x20found:\x20','buildIdToNameMap','folderId','map','\x20new\x20files','\x20(ID:\x20','\x22\x20paused','journey:list','yes','rule','Resolving\x20parent\x20segment...','filePath','toLowerCase','getStatistics','✔\x20Found\x20','1864VjNHqn','relativePath','✔\x20Pulled\x20','folderPath','(root)','join','15172866TqcSIR','error','args','/app/ps/','json','cwd','repeat','resolveParentId','\x20files?','journey:view','\x20unchanged\x20files','journey','\x22\x20resumed','blue','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','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)','find','Input:\x20','verbose','Fetching\x20connections\x20for\x20name\x20resolution...','(running)','dryRun','\x20versions)','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Usage:\x20journey\x20pause\x20<name-or-path>','\x20\x20Name:\x20','stageName','user','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Warning:\x20Could\x20not\x20resolve\x20segment\x20','✔\x20Context\x20set:\x20','✔\x20Journey\x20\x22','\x20\x20Folder\x20path:\x20','file','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','yellow','goal','\x20\x20Target:\x20','Cancelled','Resuming\x20journey...','test','Folder\x20path:\x20','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','sort','dim','values','journeyBundleId','attributes','state','targetDir','totalEntered','segment','10717wRyfrX','options','(archived)','listJourneysWithFolders','diff','resolveSegment','includeStats','Fetching\x20users\x20for\x20email\x20resolution...','.yml','stage','content','resolveJourneyId','journeyId','Options:','journey:resume','resume','description','getSegment','then','\x27\x20not\x20found\x20in\x20','push','\x20->\x20','647232DMmrqQ','\x20journey\x20files\x20to\x20','Resume\x20a\x20paused\x20journey','goalRate','Fetching\x20parent\x20segment...','Target\x20file:\x20','10LUybTt','message','No\x20journeys\x20found','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','filter','connection','getParentFull','journeyName','format','\x20\x20Preserving\x20local\x20segment\x20name:\x20','execute','launched','name','\x0aPull\x20summary:','cyan','entered','exited','\x0aChanges\x20to\x20\x27','3058815wFaver','1eGQSmL','kind','split','localeCompare','isNew','622028TAjaNM','listJourneysFromParentSegment','Usage:\x20journey\x20resume\x20<name-or-path>','setPhase','List\x20journeys\x20in\x20current\x20context','journey:pause','stages','141051HeVDst','parentSegment','\x20=\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Getting\x20journey\x20details...','archived','data','Show\x20journey\x20statistics','log','Getting\x20journey\x20statistics...','parent_segment'];a18_0x2094=function(){return _0x3d8be0;};return a18_0x2094();}export class JourneyViewCommand extends BaseCommand{[a18_0x1f4869(0x1f5)]=a18_0x1f4869(0x271);['description']='Show\x20journey\x20details';async[a18_0x1f4869(0x1f3)](_0x40a334){const _0x55ce8f=a18_0x1f4869,{options:_0x288831,args:_0x5827a4,tdx:_0x4b7aca}=_0x40a334,_0x2034d3=_0x5827a4[0x0];if(!_0x2034d3)return console[_0x55ce8f(0x269)](_0x55ce8f(0x24c)),console['error']('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x55ce8f(0x269)](_0x55ce8f(0x1da)),console[_0x55ce8f(0x269)](_0x55ce8f(0x24d)),0x1;_0x288831[_0x55ce8f(0x1ab)]&&console['error'](_0x55ce8f(0x1aa)+_0x2034d3);const _0x419fdf=await resolveJourneyTarget(_0x2034d3,_0x288831['parentSegment'],_0x288831[_0x55ce8f(0x1ab)]),_0x5616e1=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x4b7aca[_0x55ce8f(0x1cc)][_0x55ce8f(0x26f)](_0x419fdf[_0x55ce8f(0x209)]),{'verbose':_0x288831[_0x55ce8f(0x1ab)]}),_0x1a9e14=_0x5616e1[_0x55ce8f(0x20e)],_0x29c779=await withSpinner(_0x55ce8f(0x23f),()=>_0x4b7aca[_0x55ce8f(0x273)][_0x55ce8f(0x1d8)](_0x1a9e14,_0x419fdf[_0x55ce8f(0x1f0)]),{'verbose':_0x288831['verbose']}),_0x224065=_0x29c779[_0x55ce8f(0x20e)];if(_0x288831['web']){const _0x26d232=getConsoleNextUrl(_0x288831[_0x55ce8f(0x23b)],_0x55ce8f(0x26b)+_0x1a9e14+_0x55ce8f(0x24a)+_0x224065+'/j/da/je');return console['error'](a18_0x4a83e5['green']('✔')+'\x20Opening\x20'+a18_0x4a83e5['cyan'](_0x26d232)),openBrowser(_0x26d232),0x0;}const _0x447a48=await withSpinner(_0x55ce8f(0x20c),()=>_0x4b7aca[_0x55ce8f(0x273)]['getJourney'](_0x224065),{'verbose':_0x288831[_0x55ce8f(0x1ab)]}),_0x19b4dc=_0x447a48[_0x55ce8f(0x20e)],_0x3b59fb=_0x288831[_0x55ce8f(0x1d3)];let _0x8fee90;if(_0x3b59fb)try{const _0x260178=await withSpinner(_0x55ce8f(0x211),()=>_0x4b7aca[_0x55ce8f(0x273)][_0x55ce8f(0x260)](_0x224065),{'verbose':_0x288831['verbose']});_0x8fee90=_0x260178[_0x55ce8f(0x20e)];}catch{_0x288831['verbose']&&console[_0x55ce8f(0x269)](_0x55ce8f(0x21d));}const _0x57dbc1=getConsoleNextUrl(_0x288831[_0x55ce8f(0x23b)],_0x55ce8f(0x26b)+_0x1a9e14+_0x55ce8f(0x24a)+_0x224065+'/j/da/je'),_0x280bac={'id':_0x19b4dc['id'],'name':_0x19b4dc[_0x55ce8f(0x1c8)][_0x55ce8f(0x1f5)],'description':_0x19b4dc[_0x55ce8f(0x1c8)][_0x55ce8f(0x1dd)],'state':_0x19b4dc['attributes'][_0x55ce8f(0x1c9)],'paused':_0x19b4dc[_0x55ce8f(0x1c8)][_0x55ce8f(0x232)],'reentry_mode':_0x19b4dc[_0x55ce8f(0x1c8)]['reentryMode'],'stages':_0x19b4dc[_0x55ce8f(0x1c8)]['journeyStages']?.['length']||0x0,..._0x19b4dc[_0x55ce8f(0x1c8)][_0x55ce8f(0x1bd)]&&{'goal':_0x19b4dc[_0x55ce8f(0x1c8)]['goal'][_0x55ce8f(0x1f5)]},..._0x8fee90&&{'statistics':{'total_entered':_0x8fee90['totalEntered'],'goal_achieved':_0x8fee90[_0x55ce8f(0x234)],'goal_rate':_0x8fee90[_0x55ce8f(0x1e6)],'stages':_0x8fee90[_0x55ce8f(0x207)]}},'url':_0x57dbc1};return await handleSingleObjectOutput(_0x280bac,_0x288831),0x0;}}function a18_0x2cca(_0x503672,_0xa18f0a){_0x503672=_0x503672-0x1a6;const _0x2094c0=a18_0x2094();let _0x2cca81=_0x2094c0[_0x503672];return _0x2cca81;}export class JourneyStatsCommand extends BaseCommand{['name']=a18_0x1f4869(0x22b);[a18_0x1f4869(0x1dd)]=a18_0x1f4869(0x20f);async[a18_0x1f4869(0x1f3)](_0x4b82f6){const _0xd9eecd=a18_0x1f4869,{options:_0x2c3f66,args:_0x414f74,tdx:_0x5535dd}=_0x4b82f6,_0x2bfb3c=_0x414f74[0x0];if(!_0x2bfb3c)return console['error'](_0xd9eecd(0x24c)),console[_0xd9eecd(0x269)]('Usage:\x20journey\x20stats\x20<name-or-path>'),0x1;_0x2c3f66[_0xd9eecd(0x1ab)]&&console['error']('Input:\x20'+_0x2bfb3c);const _0xd50891=await resolveJourneyTarget(_0x2bfb3c,_0x2c3f66[_0xd9eecd(0x209)],_0x2c3f66[_0xd9eecd(0x1ab)]),_0x5d64b9=await withSpinner(_0xd9eecd(0x25d),()=>_0x5535dd[_0xd9eecd(0x1cc)][_0xd9eecd(0x26f)](_0xd50891['parentSegment']),{'verbose':_0x2c3f66[_0xd9eecd(0x1ab)]}),_0x1245e1=_0x5d64b9[_0xd9eecd(0x20e)],_0x65a167=await withSpinner(_0xd9eecd(0x23f),()=>_0x5535dd[_0xd9eecd(0x273)][_0xd9eecd(0x1d8)](_0x1245e1,_0xd50891[_0xd9eecd(0x1f0)]),{'verbose':_0x2c3f66[_0xd9eecd(0x1ab)]}),_0x1f1708=_0x65a167[_0xd9eecd(0x20e)],_0x3211a7=await withSpinner(_0xd9eecd(0x211),()=>_0x5535dd['journey'][_0xd9eecd(0x260)](_0x1f1708),{'verbose':_0x2c3f66['verbose']}),_0x488ced=_0x3211a7['data'];if(!_0x488ced||_0x488ced[_0xd9eecd(0x1d9)]===null)return console[_0xd9eecd(0x269)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0xd50891[_0xd9eecd(0x1f0)]),console[_0xd9eecd(0x269)](_0xd9eecd(0x225)),0x0;const _0x340961={'journey_id':_0x488ced[_0xd9eecd(0x1d9)],'total_entered':_0x488ced[_0xd9eecd(0x1cb)],'goal_achieved':_0x488ced[_0xd9eecd(0x234)],'goal_rate':_0x488ced['goalRate'],'stages':_0x488ced[_0xd9eecd(0x207)]?.[_0xd9eecd(0x256)](_0x2c12ca=>({'name':_0x2c12ca[_0xd9eecd(0x1b3)],'population':_0x2c12ca[_0xd9eecd(0x213)],'entered':_0x2c12ca[_0xd9eecd(0x1f8)],'exited':_0x2c12ca['exited'],'conversion_rate':_0x2c12ca[_0xd9eecd(0x24f)]}))},_0x5212d6=_0x2c3f66[_0xd9eecd(0x1d6)];if(_0x5212d6&&_0x488ced[_0xd9eecd(0x207)]){const _0xe3c435=_0x488ced[_0xd9eecd(0x207)][_0xd9eecd(0x1a9)](_0x430a84=>_0x430a84[_0xd9eecd(0x1b3)][_0xd9eecd(0x25f)]()===_0x5212d6[_0xd9eecd(0x25f)]());if(_0xe3c435)return await handleSingleObjectOutput({'stage_name':_0xe3c435[_0xd9eecd(0x1b3)],'population':_0xe3c435[_0xd9eecd(0x213)],'entered':_0xe3c435[_0xd9eecd(0x1f8)],'exited':_0xe3c435[_0xd9eecd(0x1f9)],'conversion_rate':_0xe3c435[_0xd9eecd(0x24f)]},_0x2c3f66),0x0;console[_0xd9eecd(0x269)]('Warning:\x20Stage\x20\x22'+_0x5212d6+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x340961,_0x2c3f66),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a18_0x1f4869(0x206);[a18_0x1f4869(0x1dd)]='Pause\x20a\x20running\x20journey';async[a18_0x1f4869(0x1f3)](_0x273c6d){const _0xcbc32b=a18_0x1f4869,{options:_0x20d827,args:_0xb9588c,tdx:_0x2be0a2}=_0x273c6d,_0x1d34d9=_0xb9588c[0x0];if(!_0x1d34d9)return console[_0xcbc32b(0x269)](_0xcbc32b(0x24c)),console[_0xcbc32b(0x269)](_0xcbc32b(0x1b1)),0x1;_0x20d827[_0xcbc32b(0x1ab)]&&console[_0xcbc32b(0x269)]('Input:\x20'+_0x1d34d9);const _0x426d0c=await resolveJourneyTarget(_0x1d34d9,_0x20d827[_0xcbc32b(0x209)],_0x20d827[_0xcbc32b(0x1ab)]),_0x49d8bd=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2be0a2[_0xcbc32b(0x1cc)][_0xcbc32b(0x26f)](_0x426d0c[_0xcbc32b(0x209)]),{'verbose':_0x20d827['verbose']}),_0x596010=_0x49d8bd[_0xcbc32b(0x20e)],_0x34dc5a=await withSpinner(_0xcbc32b(0x23f),()=>_0x2be0a2[_0xcbc32b(0x273)][_0xcbc32b(0x1d8)](_0x596010,_0x426d0c[_0xcbc32b(0x1f0)]),{'verbose':_0x20d827[_0xcbc32b(0x1ab)]}),_0x4a4e2f=_0x34dc5a[_0xcbc32b(0x20e)];if(!_0x20d827[_0xcbc32b(0x25b)]){const _0x432621=await confirm(_0xcbc32b(0x1bb)+_0x426d0c[_0xcbc32b(0x1f0)]+'\x22?');if(!_0x432621)return console[_0xcbc32b(0x269)](_0xcbc32b(0x1bf)),0x0;}const _0x5a20a3=await withSpinner(_0xcbc32b(0x237),()=>_0x2be0a2['journey']['pause'](_0x4a4e2f),{'verbose':_0x20d827[_0xcbc32b(0x1ab)]}),_0x2bbc32=_0x5a20a3[_0xcbc32b(0x20e)];return console[_0xcbc32b(0x269)](_0xcbc32b(0x1b8)+_0x2bbc32[_0xcbc32b(0x1c8)][_0xcbc32b(0x1f5)]+_0xcbc32b(0x259)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x1f4869(0x1f5)]=a18_0x1f4869(0x1db);['description']=a18_0x1f4869(0x1e5);async[a18_0x1f4869(0x1f3)](_0x34186b){const _0x49ed2a=a18_0x1f4869,{options:_0x4bec7a,args:_0x27433d,tdx:_0x401766}=_0x34186b,_0x370858=_0x27433d[0x0];if(!_0x370858)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x49ed2a(0x269)](_0x49ed2a(0x203)),0x1;_0x4bec7a['verbose']&&console[_0x49ed2a(0x269)](_0x49ed2a(0x1aa)+_0x370858);const _0x48e95f=await resolveJourneyTarget(_0x370858,_0x4bec7a[_0x49ed2a(0x209)],_0x4bec7a[_0x49ed2a(0x1ab)]),_0x3b507c=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x401766[_0x49ed2a(0x1cc)]['resolveParentId'](_0x48e95f[_0x49ed2a(0x209)]),{'verbose':_0x4bec7a[_0x49ed2a(0x1ab)]}),_0x4d0481=_0x3b507c[_0x49ed2a(0x20e)],_0x4cd7a5=await withSpinner(_0x49ed2a(0x23f),()=>_0x401766[_0x49ed2a(0x273)]['resolveJourneyId'](_0x4d0481,_0x48e95f[_0x49ed2a(0x1f0)]),{'verbose':_0x4bec7a[_0x49ed2a(0x1ab)]}),_0x4f2c8d=_0x4cd7a5[_0x49ed2a(0x20e)];if(!_0x4bec7a['yes']){const _0x2e0429=await confirm(_0x49ed2a(0x1b5)+_0x48e95f['journeyName']+'\x22?');if(!_0x2e0429)return console[_0x49ed2a(0x269)](_0x49ed2a(0x1bf)),0x0;}const _0x3bfc01=await withSpinner(_0x49ed2a(0x1c0),()=>_0x401766[_0x49ed2a(0x273)][_0x49ed2a(0x1dc)](_0x4f2c8d),{'verbose':_0x4bec7a[_0x49ed2a(0x1ab)]}),_0x3bc76c=_0x3bfc01[_0x49ed2a(0x20e)];return console[_0x49ed2a(0x269)](_0x49ed2a(0x1b8)+_0x3bc76c[_0x49ed2a(0x1c8)][_0x49ed2a(0x1f5)]+_0x49ed2a(0x274)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x1f4869(0x1f5)]=a18_0x1f4869(0x242);[a18_0x1f4869(0x1dd)]='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0x45879b){const _0x5ab11b=a18_0x1f4869,{options:_0x317bf4,args:_0x335499,tdx:_0x25c47b}=_0x45879b,_0x4590cc=_0x317bf4,_0x5d1570=_0x335499[0x0],_0x4121bd=_0x5d1570&&isYamlFilePath(_0x5d1570),_0xf65e9a=await resolveTarget({'arg':_0x4121bd?_0x5d1570:undefined,'contextParent':_0x317bf4[_0x5ab11b(0x209)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0xf65e9a))return _0xf65e9a[_0x5ab11b(0x245)]==='no_parent'?(console['error'](a18_0x4a83e5['yellow'](_0x5ab11b(0x240))),console[_0x5ab11b(0x269)](_0x5ab11b(0x1a8)),console[_0x5ab11b(0x269)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x5ab11b(0x269)](_0x5ab11b(0x1a7)),console[_0x5ab11b(0x269)](_0x5ab11b(0x1c3))):(console[_0x5ab11b(0x269)](a18_0x4a83e5[_0x5ab11b(0x22f)]('Error:\x20'+_0xf65e9a['message']+'\x0a')),_0xf65e9a[_0x5ab11b(0x230)]&&console[_0x5ab11b(0x269)](a18_0x4a83e5[_0x5ab11b(0x1f7)](_0xf65e9a[_0x5ab11b(0x230)]))),0x1;let _0xf85722=_0x4121bd?undefined:_0x5d1570,_0x13aa4d,_0x30878a;_0xf65e9a[_0x5ab11b(0x22c)]===_0x5ab11b(0x1ba)&&(_0xf85722=_0xf65e9a['resourceName'],_0x13aa4d=_0xf65e9a[_0x5ab11b(0x25e)],_0x30878a=_0xf65e9a[_0x5ab11b(0x265)]);const _0x3f79d9=_0xf65e9a['parentName'],_0x2df6a3=_0xf65e9a[_0x5ab11b(0x1ca)];_0x4590cc['verbose']&&(console[_0x5ab11b(0x269)](_0x5ab11b(0x21a)+_0x3f79d9),console[_0x5ab11b(0x269)](_0x5ab11b(0x241)+_0x2df6a3),_0xf85722&&console['error'](_0x5ab11b(0x229)+_0xf85722),_0x13aa4d&&console['error'](_0x5ab11b(0x1e8)+_0x13aa4d),_0x30878a&&console[_0x5ab11b(0x269)](_0x5ab11b(0x1c2)+_0x30878a));const _0x3cce06=await withSpinner(_0x5ab11b(0x25d),()=>_0x25c47b[_0x5ab11b(0x1cc)][_0x5ab11b(0x26f)](_0x3f79d9),{'verbose':_0x317bf4[_0x5ab11b(0x1ab)]}),_0x14b2d3=_0x3cce06[_0x5ab11b(0x20e)],[_0x1daf8c,_0x22216e]=await Promise[_0x5ab11b(0x228)]([withSpinner('Listing\x20journeys...',()=>_0x25c47b[_0x5ab11b(0x273)][_0x5ab11b(0x202)](_0x14b2d3,undefined,{'includeAllVersions':!![]}),{'verbose':_0x317bf4[_0x5ab11b(0x1ab)]}),withSpinner(_0x5ab11b(0x224),()=>_0x25c47b[_0x5ab11b(0x1cc)]['listFolders'](_0x14b2d3),{'verbose':_0x317bf4['verbose']})]);let _0x2dbb1c=_0x1daf8c[_0x5ab11b(0x20e)];const _0x6e257d=_0x22216e[_0x5ab11b(0x20e)],_0x4a3db7=buildFolderIdToPathMap(_0x6e257d);if(_0xf85722){const _0x4f09d4=_0x2dbb1c['filter'](_0x5d1cd5=>_0x5d1cd5[_0x5ab11b(0x247)][_0x5ab11b(0x25f)]()===_0xf85722[_0x5ab11b(0x25f)]());if(_0x4f09d4[_0x5ab11b(0x222)]===0x0)return console[_0x5ab11b(0x269)](_0x5ab11b(0x253)+_0xf85722),console[_0x5ab11b(0x269)](_0x5ab11b(0x244)),0x1;_0x2dbb1c=_0x4f09d4;}if(_0x30878a!==undefined){const _0x9169be=_0x2dbb1c[_0x5ab11b(0x1ed)](_0x1bc109=>{const _0x577444=_0x5ab11b,_0x2ad0fa=_0x1bc109[_0x577444(0x255)]?_0x4a3db7[_0x577444(0x239)](_0x1bc109['folderId'])||'':'';return _0x2ad0fa===_0x30878a;});if(_0x9169be[_0x5ab11b(0x222)]===0x0&&_0x2dbb1c[_0x5ab11b(0x222)]>0x0){console[_0x5ab11b(0x269)]('Error:\x20Journey\x20\x27'+_0xf85722+_0x5ab11b(0x1e0)+(_0x30878a||_0x5ab11b(0x22a))),console[_0x5ab11b(0x269)]('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0xd092c1 of _0x2dbb1c){const _0x42ea2b=_0xd092c1['folderId']?_0x4a3db7[_0x5ab11b(0x239)](_0xd092c1[_0x5ab11b(0x255)])||'':'';console[_0x5ab11b(0x269)](_0x5ab11b(0x220)+(_0x42ea2b||_0x5ab11b(0x266))+'/'+_0xd092c1[_0x5ab11b(0x247)]);}return 0x1;}_0x2dbb1c=_0x9169be;}if(_0x2dbb1c[_0x5ab11b(0x222)]===0x0)return console[_0x5ab11b(0x269)](_0x5ab11b(0x1eb)),0x0;const _0x4089f7=new Map();for(const _0x5ec1d8 of _0x2dbb1c){const _0x9fec3a=_0x5ec1d8[_0x5ab11b(0x1c7)];!_0x4089f7[_0x5ab11b(0x24b)](_0x9fec3a)&&_0x4089f7[_0x5ab11b(0x214)](_0x9fec3a,[]),_0x4089f7[_0x5ab11b(0x239)](_0x9fec3a)['push'](_0x5ec1d8);}for(const _0x1200a9 of _0x4089f7[_0x5ab11b(0x1c6)]()){_0x1200a9[_0x5ab11b(0x1c4)]((_0x34587b,_0x5db18c)=>(_0x34587b[_0x5ab11b(0x226)]||0x0)-(_0x5db18c[_0x5ab11b(0x226)]||0x0));}const _0x315c3a=[],[_0x13eca7,_0x573407]=await Promise['all']([withSpinner(_0x5ab11b(0x1d4),()=>_0x25c47b[_0x5ab11b(0x1b4)]['buildIdToEmailMap'](),{'verbose':_0x317bf4[_0x5ab11b(0x1ab)]})[_0x5ab11b(0x1df)](_0xf68cca=>_0xf68cca[_0x5ab11b(0x20e)]),withSpinner(_0x5ab11b(0x1ac),()=>_0x25c47b[_0x5ab11b(0x1ee)][_0x5ab11b(0x254)](),{'verbose':_0x317bf4['verbose']})[_0x5ab11b(0x1df)](_0x13292d=>_0x13292d[_0x5ab11b(0x20e)])]);for(const _0x13805b of _0x4089f7[_0x5ab11b(0x1c6)]()){const _0xd809e1=_0x13805b[0x0][_0x5ab11b(0x247)],_0x2d72a7=_0x13805b[0x0][_0x5ab11b(0x255)],_0x1d0779=_0x2d72a7?_0x4a3db7[_0x5ab11b(0x239)](_0x2d72a7)||'':'',_0x1a0d32=_0x1d0779?a18_0x4ada86[_0x5ab11b(0x267)](_0x2df6a3,_0x1d0779):_0x2df6a3,_0x17f07a=_0x13aa4d||a18_0x4ada86[_0x5ab11b(0x267)](_0x1a0d32,sanitizeFileName(_0xd809e1)+'.yml');let _0x58c35a,_0xa167bc;if(existsSync(_0x17f07a))try{const _0x3ff183=readFileSync(_0x17f07a,'utf-8'),_0x36fc05=parseYamlString(_0x3ff183);_0xa167bc=_0x36fc05,_0x58c35a=buildRuleToNameMapping(_0x36fc05),_0x4590cc[_0x5ab11b(0x1ab)]&&_0x58c35a[_0x5ab11b(0x23a)]>0x0&&console['error']('Found\x20'+_0x58c35a[_0x5ab11b(0x23a)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0xd809e1);}catch(_0x56e672){_0x4590cc[_0x5ab11b(0x1ab)]&&console[_0x5ab11b(0x269)](_0x5ab11b(0x22d)+_0x56e672[_0x5ab11b(0x1ea)]);}const _0x47a156=[],_0x487d19=new Set(),_0x2c2186=new Map(),_0x5174cd=new Map(),_0x18cc31=new Set(),_0x14f677=new Map(),_0x3dea86=new Map(),_0x104f76=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0xd809e1+_0x5ab11b(0x250),async _0x31bd43=>{const _0x355e46=_0x5ab11b;for(const _0x58fa57 of _0x13805b){const _0x136c67=_0x13805b['length']>0x1?_0x58fa57[_0x355e46(0x247)]+'\x20v'+(_0x58fa57[_0x355e46(0x226)]||0x1):_0x58fa57[_0x355e46(0x247)];_0x31bd43[_0x355e46(0x204)]('Fetching\x20'+_0x136c67);const _0xd03c3e=await _0x25c47b[_0x355e46(0x273)]['getJourney'](_0x58fa57['id']),_0x2fd8a2=_0xd03c3e[_0x355e46(0x1c8)]?.['audienceId'],_0x515e36={'resolveSegment':async _0xd654b3=>{const _0x3c62c7=_0x355e46;if(!_0x2fd8a2)return{'name':_0xd654b3,'isJourneyLocal':![]};const _0x1dcc35=_0x2c2186[_0x3c62c7(0x239)](_0xd654b3);if(_0x1dcc35)return _0x1dcc35;try{const _0xdac378=await _0x25c47b[_0x3c62c7(0x1cc)][_0x3c62c7(0x1de)](_0x2fd8a2,_0xd654b3),_0x399563=_0xdac378[_0x3c62c7(0x1fd)]===SEGMENT_KIND_JOURNEY;let _0x52bfee,_0xc04319=_0xdac378[_0x3c62c7(0x1f5)];if(_0x399563&&_0xdac378[_0x3c62c7(0x25c)]){const _0x41d74c=await segmentResponseToDef(_0xdac378,{'resolveSegmentName':async _0x38d3ff=>{const _0x1060db=_0x3c62c7,_0x3f26f9=_0x2c2186[_0x1060db(0x239)](_0x38d3ff);if(_0x3f26f9)return _0x3f26f9[_0x1060db(0x1f5)];const _0x592ec7=await _0x515e36[_0x1060db(0x1d2)](_0x38d3ff);return _0x592ec7[_0x1060db(0x1f5)];}}),_0x4189b9=_0x41d74c[_0x3c62c7(0x25c)];_0x52bfee={'description':_0xdac378[_0x3c62c7(0x1dd)],'rule':_0x4189b9};const _0x265f99=serializeRule(_0x4189b9),_0x3d905a=_0x5174cd[_0x3c62c7(0x239)](_0x265f99);if(_0x3d905a)_0xc04319=_0x3d905a,_0x52bfee=undefined,_0x4590cc[_0x3c62c7(0x1ab)]&&console['error']('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0xdac378['name']+_0x3c62c7(0x1e2)+_0x3d905a);else{let _0x4665ff=![];if(_0x58c35a){const _0x4e8366=_0x58c35a[_0x3c62c7(0x239)](_0x265f99);if(_0x4e8366){const _0x4b2a0b=_0x4e8366[_0x3c62c7(0x1a9)](_0x20dcd3=>!_0x487d19[_0x3c62c7(0x24b)](_0x20dcd3));_0x4b2a0b&&(_0xc04319=_0x4b2a0b,_0x487d19[_0x3c62c7(0x248)](_0x4b2a0b),_0x5174cd[_0x3c62c7(0x214)](_0x265f99,_0x4b2a0b),_0x4665ff=!![],_0x4590cc[_0x3c62c7(0x1ab)]&&console[_0x3c62c7(0x269)](_0x3c62c7(0x1f2)+_0x4b2a0b+_0x3c62c7(0x252)));}}if(!_0x4665ff){const _0x301f0f=generateJourneyLocalName(_0xdac378[_0x3c62c7(0x1f5)]);_0x301f0f&&(_0xc04319=_0x301f0f);let _0x449dce=_0xc04319,_0x458435=0x2;while(_0x487d19[_0x3c62c7(0x24b)](_0x449dce)){_0x449dce=_0xc04319+'_'+_0x458435,_0x458435++;}_0x487d19[_0x3c62c7(0x248)](_0x449dce),_0x5174cd[_0x3c62c7(0x214)](_0x265f99,_0x449dce),_0xc04319=_0x449dce;}}}const _0x537252={'name':_0xc04319,'isJourneyLocal':_0x399563,'definition':_0x52bfee};return _0x2c2186[_0x3c62c7(0x214)](_0xd654b3,_0x537252),_0x537252;}catch(_0x4f95cb){return _0x317bf4[_0x3c62c7(0x1ab)]&&console[_0x3c62c7(0x269)](_0x3c62c7(0x1b6)+_0xd654b3+':\x20'+_0x4f95cb[_0x3c62c7(0x1ea)]),{'name':_0xd654b3,'isJourneyLocal':![]};}},'resolveActivation':async _0xb8fd6c=>{const _0x4925fe=_0x355e46,_0x41f060=_0x14f677[_0x4925fe(0x239)](_0xb8fd6c);if(_0x41f060)return _0x41f060;try{const _0xa47040=await _0x25c47b[_0x4925fe(0x273)]['getActivation'](_0x58fa57['id'],_0xb8fd6c),_0x2c0a95=journeyActivationStepToYaml(_0xa47040,_0x13eca7,_0x573407),_0x123919=JSON['stringify']({'name':_0x2c0a95[_0x4925fe(0x1f5)],'connection':_0x2c0a95[_0x4925fe(0x1ee)],'connector_config':_0x2c0a95['connector_config']}),_0xb7a8f3=_0x3dea86[_0x4925fe(0x239)](_0x123919);if(_0xb7a8f3){const _0x190f88={'name':_0xb7a8f3,'isJourneyLocal':!![],'definition':_0x2c0a95};return _0x14f677[_0x4925fe(0x214)](_0xb8fd6c,_0x190f88),_0x190f88;}const _0xfd68f5=_0xa47040[_0x4925fe(0x1c8)]['activationParams'][_0x4925fe(0x1f5)]||_0xb8fd6c,_0x1bb822=sanitizeYamlKey(_0xfd68f5)||'activation_'+_0xb8fd6c;let _0x18563d=_0x1bb822,_0x3b7344=0x2;while(_0x18cc31['has'](_0x18563d)){_0x18563d=_0x1bb822+'_'+_0x3b7344,_0x3b7344++;}_0x18cc31[_0x4925fe(0x248)](_0x18563d),_0x3dea86[_0x4925fe(0x214)](_0x123919,_0x18563d);const _0x227db3={'name':_0x18563d,'isJourneyLocal':!![],'definition':_0x2c0a95};return _0x14f677[_0x4925fe(0x214)](_0xb8fd6c,_0x227db3),_0x227db3;}catch(_0x2e7650){return _0x317bf4[_0x4925fe(0x1ab)]&&console[_0x4925fe(0x269)](_0x4925fe(0x20b)+_0xb8fd6c+':\x20'+_0x2e7650[_0x4925fe(0x1ea)]),{'name':_0xb8fd6c,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x4bb3bc,_0x3d5d41)=>{const _0x6604dd=_0x355e46;return resolveJumpTarget(_0x4bb3bc,_0x3d5d41,_0x104f76,_0xaa1006=>_0x25c47b[_0x6604dd(0x273)][_0x6604dd(0x219)](_0xaa1006));}},_0x336c61=await journeyResponseToDef(_0xd03c3e,_0x515e36);_0x47a156[_0x355e46(0x1e1)]({'item':_0x58fa57,'yaml':_0x336c61});}},{'verbose':_0x317bf4[_0x5ab11b(0x1ab)]});const _0x3f5869=buildMergedJourneyDef(_0x47a156,_0x58c35a),_0x3db589=normalizeJourneyDef(_0x3f5869,_0xa167bc),_0x442b8a=toYamlString(_0x3db589),_0x430d63=_0x13aa4d||a18_0x4ada86[_0x5ab11b(0x267)](_0x1a0d32,sanitizeFileName(_0xd809e1)+_0x5ab11b(0x1d5));!_0x13aa4d&&_0x1d0779&&!existsSync(_0x1a0d32)&&mkdirSync(_0x1a0d32,{'recursive':!![]});const _0x479603=a18_0x4ada86['relative'](process[_0x5ab11b(0x26d)](),_0x430d63);if(existsSync(_0x430d63)){const _0x3bc017=readFileSync(_0x430d63,_0x5ab11b(0x218)),_0x49bbdd=generateDiff(_0x3bc017,_0x442b8a),_0x4c63ad=hasChanges(_0x49bbdd);_0x315c3a[_0x5ab11b(0x1e1)]({'relativePath':_0x479603,'absolutePath':_0x430d63,'content':_0x442b8a,'isNew':![],'hasChanges':_0x4c63ad,'diff':_0x4c63ad?formatDiffWithColors(_0x49bbdd):undefined});}else _0x315c3a['push']({'relativePath':_0x479603,'absolutePath':_0x430d63,'content':_0x442b8a,'isNew':!![],'hasChanges':![]});}const _0x18552f=_0x315c3a[_0x5ab11b(0x1ed)](_0x5934fc=>_0x5934fc['isNew']),_0x187d3e=_0x315c3a[_0x5ab11b(0x1ed)](_0x2e9957=>!_0x2e9957['isNew']&&_0x2e9957['hasChanges']),_0x290864=_0x315c3a[_0x5ab11b(0x1ed)](_0xcde74d=>!_0xcde74d[_0x5ab11b(0x200)]&&!_0xcde74d[_0x5ab11b(0x21e)]),_0x545c90=_0x2dbb1c[_0x5ab11b(0x222)],_0x4937ae=_0x4089f7[_0x5ab11b(0x23a)],_0x3e1d72=_0x545c90>_0x4937ae?'\x20('+_0x545c90+_0x5ab11b(0x1af):'';console[_0x5ab11b(0x269)](_0x5ab11b(0x1f6)),console[_0x5ab11b(0x269)]('\x20\x20'+a18_0x4a83e5[_0x5ab11b(0x1f7)](_0x4937ae+'\x20journeys')+a18_0x4a83e5[_0x5ab11b(0x1c5)](_0x3e1d72)),console[_0x5ab11b(0x269)]('\x20\x20'+a18_0x4a83e5['green']('+\x20'+_0x18552f['length']+_0x5ab11b(0x257))),console['error']('\x20\x20'+a18_0x4a83e5[_0x5ab11b(0x1bc)]('~\x20'+_0x187d3e[_0x5ab11b(0x222)]+_0x5ab11b(0x233))),console[_0x5ab11b(0x269)]('\x20\x20'+a18_0x4a83e5[_0x5ab11b(0x1c5)]('=\x20'+_0x290864[_0x5ab11b(0x222)]+_0x5ab11b(0x272))),console['error'](_0x5ab11b(0x1be)+a18_0x4a83e5[_0x5ab11b(0x1f7)](_0x2df6a3)+'\x0a');if(_0x187d3e[_0x5ab11b(0x222)]>0x0)for(const _0x27e708 of _0x187d3e){console['error'](_0x5ab11b(0x1fa)+_0x27e708[_0x5ab11b(0x263)]+'\x27:'),console[_0x5ab11b(0x269)]('─'[_0x5ab11b(0x26e)](0x3c)),console[_0x5ab11b(0x269)](_0x27e708[_0x5ab11b(0x1d1)]),console[_0x5ab11b(0x269)]('─'[_0x5ab11b(0x26e)](0x3c));}if(_0x4590cc[_0x5ab11b(0x1ae)])return console[_0x5ab11b(0x269)](a18_0x4a83e5[_0x5ab11b(0x1bc)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x18552f[_0x5ab11b(0x222)]===0x0&&_0x187d3e[_0x5ab11b(0x222)]===0x0)return console['error'](a18_0x4a83e5[_0x5ab11b(0x21b)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x3f79d9},_0x4590cc[_0x5ab11b(0x221)]),console[_0x5ab11b(0x269)](a18_0x4a83e5[_0x5ab11b(0x21b)](_0x5ab11b(0x1b7)+a18_0x4a83e5['dim'](_0x5ab11b(0x212))+_0x5ab11b(0x20a)+a18_0x4a83e5[_0x5ab11b(0x1f7)](_0x3f79d9))),0x0;if(!_0x4590cc[_0x5ab11b(0x25b)]&&(_0x18552f[_0x5ab11b(0x222)]>0x0||_0x187d3e[_0x5ab11b(0x222)]>0x0)){const _0x15d158=await confirmKey('Write\x20'+(_0x18552f[_0x5ab11b(0x222)]+_0x187d3e[_0x5ab11b(0x222)])+_0x5ab11b(0x270));if(!_0x15d158)return console[_0x5ab11b(0x269)]('Aborted.'),0x1;}!existsSync(_0x2df6a3)&&mkdirSync(_0x2df6a3,{'recursive':!![]});for(const _0x4c0a93 of _0x315c3a){(_0x4c0a93[_0x5ab11b(0x200)]||_0x4c0a93[_0x5ab11b(0x21e)])&&writeFileSync(_0x4c0a93['absolutePath'],_0x4c0a93[_0x5ab11b(0x1d7)],_0x5ab11b(0x218));}return console[_0x5ab11b(0x269)](a18_0x4a83e5[_0x5ab11b(0x21b)](_0x5ab11b(0x264)+(_0x18552f[_0x5ab11b(0x222)]+_0x187d3e[_0x5ab11b(0x222)])+_0x5ab11b(0x1e4)+_0x2df6a3)),saveSessionContext({'parent_segment':_0x3f79d9},_0x4590cc[_0x5ab11b(0x221)]),console[_0x5ab11b(0x269)](a18_0x4a83e5[_0x5ab11b(0x21b)](_0x5ab11b(0x1b7)+a18_0x4a83e5[_0x5ab11b(0x1c5)](_0x5ab11b(0x212))+_0x5ab11b(0x20a)+a18_0x4a83e5[_0x5ab11b(0x1f7)](_0x3f79d9))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x1f4869(0x1f5)]=a18_0x1f4869(0x23e);[a18_0x1f4869(0x1dd)]='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data';['segmentPushCommand']=new SegmentPushCommand();async[a18_0x1f4869(0x1f3)](_0x324ea6){const _0x3cd820=a18_0x1f4869,_0xed92af=_0x324ea6[_0x3cd820(0x26a)][0x0];let _0x3834b8;if(_0xed92af){const _0x522217=await resolveTarget({'arg':_0xed92af,'contextParent':_0x324ea6[_0x3cd820(0x1ce)][_0x3cd820(0x209)],'cwd':process['cwd']()});isSuccessfulResolution(_0x522217)&&_0x522217[_0x3cd820(0x22c)]===_0x3cd820(0x1ba)&&(_0x3834b8=_0x522217['filePath']);}const _0x4c2160={..._0x324ea6,'options':{..._0x324ea6[_0x3cd820(0x1ce)],'journeysOnly':!![],..._0x3834b8&&{'singleFilePath':_0x3834b8}}};return this[_0x3cd820(0x249)]['execute'](_0x4c2160);}}
1
+ const a18_0x3c89ab=a18_0x170c;(function(_0x470070,_0xb6ba){const _0x1a1bf8=a18_0x170c,_0x216f34=_0x470070();while(!![]){try{const _0x3ffe82=parseInt(_0x1a1bf8(0x240))/0x1*(parseInt(_0x1a1bf8(0x217))/0x2)+-parseInt(_0x1a1bf8(0x1d4))/0x3+-parseInt(_0x1a1bf8(0x1db))/0x4+-parseInt(_0x1a1bf8(0x207))/0x5*(parseInt(_0x1a1bf8(0x1e2))/0x6)+parseInt(_0x1a1bf8(0x1eb))/0x7+-parseInt(_0x1a1bf8(0x25c))/0x8+-parseInt(_0x1a1bf8(0x1da))/0x9*(-parseInt(_0x1a1bf8(0x1c9))/0xa);if(_0x3ffe82===_0xb6ba)break;else _0x216f34['push'](_0x216f34['shift']());}catch(_0x4cbc9f){_0x216f34['push'](_0x216f34['shift']());}}}(a18_0x256e,0xd2613));import a18_0x1ae124 from'chalk';import a18_0x5118dc 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';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a18_0x256e(){const _0x271393=['Journey\x20name:\x20','isNew','cwd','.yml','getParentFull','Found\x20','journey:list','Pausing\x20journey...','web','stringify','\x20journey','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','...','\x20\x20Preserving\x20local\x20segment\x20name:\x20','2908568DJXcZD','dim','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)','parent_segment','(draft)','(running)','\x0aPull\x20summary:','replace','Options:','json','helpText','goal','reentryMode','Resume\x20a\x20paused\x20journey','all','Show\x20journey\x20statistics','\x20journey\x20files\x20to\x20','toLowerCase','repeat','log','Write\x20','relativePath','activation_','/app/ps/','journeyId','\x20\x20Statistics\x20not\x20available','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','📁\x20','\x20\x20Parent\x20segment:\x20','get','Error:\x20Journey\x20\x27','hasChanges','\x20\x20Target:\x20','archived','split','\x20->\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','description','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','execute','\x27\x20not\x20found\x20in\x20','/e/','\x0aChanges\x20to\x20\x27','red','Resolving\x20journey...','Getting\x20journey\x20statistics...','setPhase','folderPath','Input:\x20','\x22\x20paused','\x20changed\x20files','Pattern:\x20','utf-8','Fetching\x20','length','population','entries','Error:\x20','folderId','args','\x20versions)','getActivation','✔\x20Found\x20','name','\x20journeys','journeyBundleName','blue','draft','totalGoalAchieved','journeyBundleId','versionNumber','set','✔\x20Context\x20set:\x20','(archived)','getStatistics','buildIdToNameMap','50sbHyxw','green','connector_config','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Cancelled','journey:resume','Usage:\x20journey\x20pause\x20<name-or-path>','\x22\x20resumed','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Resuming\x20journey...','yellow','4418661mzTNZK','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Warning:\x20Could\x20not\x20resolve\x20activation\x20','resolveJourneyId','values','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','3921822sdzJJC','92qBueTN','data','✔\x20Pulled\x20','Listing\x20journeys...','join','verbose','journeyName','4275294uQmlzH','folders','yes','entered','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','attributes','segmentPushCommand','listFolders','\x20Opening\x20','5807333HLjKws','\x20(rule\x20match)','user','session','\x22\x20not\x20found','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','format','\x20=\x20','resolveParentId','Error:\x20Parent\x20segment\x20context\x20required','\x20\x20Consolidating\x20duplicate\x20segment:\x20','conversionRate','journey:push','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','parentName','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','options','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','resourceName','type','Warning:\x20Stage\x20\x22','push','journey','\x20\x20-\x20','Fetching\x20users\x20for\x20email\x20resolution...','kind','site','sort','5VMtxXi','errorCode','Listing\x20folders...','filter','Export\x20journey(s)\x20as\x20YAML\x20files','\x20\x20Folder\x20path:\x20','buildIdToEmailMap','stages','totalEntered','getJourney','has','Target\x20directory:\x20','Aborted.','connection','List\x20journeys\x20in\x20current\x20context','message','804672QWiPiz','paused','\x20new\x20files','then','getSegment','diff','size','Resolved\x20YAML\x20file:\x20','🗺️\x20','segmentName','journeyStages','/j/da','parentSegment','segments','launched','(completed)','Parent\x20segment:\x20','stage','Resolving\x20parent\x20segment...','goalRate','cyan','audienceId','rule','state','no_parent','resolveSegment','file','targetDir','/j/da/je','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','includeStats','\x20\x20Name:\x20','localeCompare','table','segment','dryRun','filePath','content','base','\x20files?','stageName','1FbmrHM','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','rootFolderId','error','✔\x20Journey\x20\x22','No\x20journeys\x20found','add','map','journey:view','Getting\x20journey\x20details...','Usage:\x20journey\x20resume\x20<name-or-path>','INVALID_ARGUMENT','(root)','journeys'];a18_0x256e=function(){return _0x271393;};return a18_0x256e();}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';function a18_0x170c(_0x12507a,_0x273e6e){_0x12507a=_0x12507a-0x187;const _0x256ed1=a18_0x256e();let _0x170cc1=_0x256ed1[_0x12507a];return _0x170cc1;}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(_0x5dbdee){const _0x5338dc=a18_0x170c;switch(_0x5dbdee){case _0x5338dc(0x225):return a18_0x1ae124[_0x5338dc(0x1ca)](_0x5338dc(0x261));case _0x5338dc(0x1c0):return a18_0x1ae124[_0x5338dc(0x25d)](_0x5338dc(0x260));case _0x5338dc(0x218):return a18_0x1ae124[_0x5338dc(0x1d3)]('(paused)');case'completed':return a18_0x1ae124[_0x5338dc(0x1bf)](_0x5338dc(0x226));case _0x5338dc(0x19e):return a18_0x1ae124[_0x5338dc(0x25d)](_0x5338dc(0x1c6));default:return'('+_0x5dbdee+')';}}function formatJourneyItem(_0x3977c7,_0x568b52='',_0x7a3bd5){const _0x58f4d2=a18_0x170c,_0x779178=formatJourneyState(_0x3977c7[_0x58f4d2(0x22e)]),_0x41b81c=_0x7a3bd5?hyperlink(_0x3977c7[_0x58f4d2(0x1be)],_0x7a3bd5):_0x3977c7[_0x58f4d2(0x1be)];return _0x568b52+_0x58f4d2(0x21f)+_0x41b81c+'\x20'+_0x779178;}function escapeRegex(_0x3a9a0f){const _0x6a357b=a18_0x170c;return _0x3a9a0f[_0x6a357b(0x263)](/[.*+?^${}()|[\]\\]/g,'\x5c$&');}function globToRegex(_0x140be7){const _0x47624c=a18_0x170c,_0x164684=_0x140be7[_0x47624c(0x19f)]('*')['map'](escapeRegex);return new RegExp(_0x164684[_0x47624c(0x1df)]('.*'),'i');}function buildRuleToNameMapping(_0x1b68d6){const _0x1619bc=a18_0x170c,_0x33ed55=new Map();if(_0x1b68d6[_0x1619bc(0x224)])for(const [_0x300bcb,_0x41faab]of Object[_0x1619bc(0x1b5)](_0x1b68d6['segments'])){if(_0x41faab[_0x1619bc(0x22d)]){const _0x470f5b=serializeRule(_0x41faab[_0x1619bc(0x22d)]),_0x3c6fbc=_0x33ed55['get'](_0x470f5b);_0x3c6fbc?_0x3c6fbc[_0x1619bc(0x200)](_0x300bcb):_0x33ed55[_0x1619bc(0x1c4)](_0x470f5b,[_0x300bcb]);}}return _0x33ed55;}async function resolveJourneyTarget(_0x49aeae,_0x53024e,_0x520f0c){const _0x45b2a9=a18_0x170c;if(isYamlFilePath(_0x49aeae))try{const _0x30306c=await resolveYamlFilePath(_0x49aeae);return _0x520f0c&&(console['error'](_0x45b2a9(0x21e)+_0x49aeae),console[_0x45b2a9(0x243)](_0x45b2a9(0x199)+_0x30306c[_0x45b2a9(0x223)]),console['error'](_0x45b2a9(0x236)+_0x30306c[_0x45b2a9(0x220)]),console[_0x45b2a9(0x243)](_0x45b2a9(0x20c)+(_0x30306c[_0x45b2a9(0x1ac)]||'(root)'))),{'journeyName':_0x30306c['segmentName'],'parentSegment':_0x30306c[_0x45b2a9(0x223)],'resolved':_0x30306c};}catch(_0x51ce80){throw new SDKError(ErrorCode[_0x45b2a9(0x24b)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x51ce80[_0x45b2a9(0x216)]);}if(!_0x53024e)throw new SDKError(ErrorCode[_0x45b2a9(0x24b)],_0x45b2a9(0x259));return{'journeyName':_0x49aeae,'parentSegment':_0x53024e};}export class JourneyListCommand extends BaseCommand{[a18_0x3c89ab(0x1bc)]=a18_0x3c89ab(0x254);[a18_0x3c89ab(0x1a2)]=a18_0x3c89ab(0x215);async[a18_0x3c89ab(0x1a4)](_0x573a74){const _0x8e2c15=a18_0x3c89ab,{options:_0x1d78bc,args:_0x4fe36f,tdx:_0x29a9af}=_0x573a74,_0x109b96=_0x4fe36f[0x0],_0x52b696=_0x1d78bc[_0x8e2c15(0x223)];if(!_0x52b696)return console[_0x8e2c15(0x243)](_0x8e2c15(0x1f4)),console[_0x8e2c15(0x243)](_0x8e2c15(0x234)),0x1;const _0x9cedd1=await withSpinner(_0x8e2c15(0x229),()=>_0x29a9af[_0x8e2c15(0x239)][_0x8e2c15(0x1f3)](_0x52b696),{'verbose':_0x1d78bc[_0x8e2c15(0x1e0)]}),_0x22f91d=_0x9cedd1[_0x8e2c15(0x1dc)];_0x1d78bc[_0x8e2c15(0x1e0)]&&(console['error'](_0x8e2c15(0x227)+_0x52b696+'\x20(ID:\x20'+_0x22f91d+')'),_0x109b96&&console[_0x8e2c15(0x243)](_0x8e2c15(0x1b0)+_0x109b96));const _0x402ecf=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x29a9af[_0x8e2c15(0x239)][_0x8e2c15(0x252)](_0x22f91d),{'verbose':_0x1d78bc[_0x8e2c15(0x1e0)]}),_0xfe7bf1=_0x402ecf[_0x8e2c15(0x1dc)],_0x47e9fd=_0xfe7bf1[_0x8e2c15(0x242)],_0x4e35ca=await withSpinner(_0x8e2c15(0x1de),()=>_0x29a9af['journey']['listJourneysWithFolders'](_0x22f91d,_0x47e9fd),{'verbose':_0x1d78bc['verbose']});let _0x3dc980=_0x4e35ca[_0x8e2c15(0x1dc)][_0x8e2c15(0x24d)];const _0x153d56=_0x4e35ca['data'][_0x8e2c15(0x1e3)],_0x301bc5=new Map();for(const _0x13d23e of _0x153d56){_0x301bc5[_0x8e2c15(0x1c4)](_0x13d23e['id'],_0x13d23e[_0x8e2c15(0x1bc)]);}if(_0x109b96){const _0x5aadd5=globToRegex(_0x109b96);_0x3dc980=_0x3dc980[_0x8e2c15(0x20a)](_0x3eccf4=>_0x5aadd5['test'](_0x3eccf4[_0x8e2c15(0x1be)]));}console[_0x8e2c15(0x243)](_0x8e2c15(0x1bb)+_0x3dc980['length']+_0x8e2c15(0x258)+(_0x3dc980[_0x8e2c15(0x1b3)]!==0x1?'s':''));const _0x1a188b=_0x385c76=>{const _0x18f797=_0x8e2c15;return getConsoleNextUrl(_0x1d78bc[_0x18f797(0x205)],_0x18f797(0x194)+_0x22f91d+'/e/'+_0x385c76+_0x18f797(0x222));};if(_0x1d78bc[_0x8e2c15(0x1f1)]===_0x8e2c15(0x238))await handleSDKOutput(_0x3dc980,_0x1d78bc);else{if(_0x1d78bc['format']===_0x8e2c15(0x265)){const _0x5abb18=_0x3dc980[_0x8e2c15(0x247)](_0x2ca2d2=>({..._0x2ca2d2,'url':_0x1a188b(_0x2ca2d2['id'])}));await handleSDKOutput(_0x5abb18,_0x1d78bc);}else{console[_0x8e2c15(0x190)]('['+_0x52b696+']');const _0x19984b=new Map(),_0x580012=[];for(const _0x255fe3 of _0x3dc980){if(!_0x255fe3[_0x8e2c15(0x1b7)]||_0x255fe3[_0x8e2c15(0x1b7)]===_0x47e9fd)_0x580012[_0x8e2c15(0x200)](_0x255fe3);else{const _0x2582a9=_0x19984b['get'](_0x255fe3[_0x8e2c15(0x1b7)])||[];_0x2582a9['push'](_0x255fe3),_0x19984b['set'](_0x255fe3[_0x8e2c15(0x1b7)],_0x2582a9);}}const _0x5dc958=(_0x14de0c,_0x352360)=>_0x14de0c[_0x8e2c15(0x1be)][_0x8e2c15(0x237)](_0x352360['journeyBundleName'],undefined,{'sensitivity':_0x8e2c15(0x23d)});_0x580012[_0x8e2c15(0x206)](_0x5dc958);for(const _0x50d1fd of _0x580012){console[_0x8e2c15(0x190)](formatJourneyItem(_0x50d1fd,'',_0x1a188b(_0x50d1fd['id'])));}const _0x30793c=[..._0x19984b[_0x8e2c15(0x1b5)]()]['sort']((_0x329a49,_0x22498c)=>{const _0x50a8ad=_0x8e2c15,_0x4978b8=_0x301bc5[_0x50a8ad(0x19a)](_0x329a49[0x0])||_0x329a49[0x0],_0x29b643=_0x301bc5[_0x50a8ad(0x19a)](_0x22498c[0x0])||_0x22498c[0x0];return _0x4978b8[_0x50a8ad(0x237)](_0x29b643,undefined,{'sensitivity':_0x50a8ad(0x23d)});});for(const [_0x2e9a88,_0x35d391]of _0x30793c){const _0x166d3a=_0x301bc5[_0x8e2c15(0x19a)](_0x2e9a88)||_0x2e9a88;console[_0x8e2c15(0x190)](_0x8e2c15(0x198)+_0x166d3a),_0x35d391['sort'](_0x5dc958);for(const _0x302be9 of _0x35d391){console['log'](formatJourneyItem(_0x302be9,'\x20\x20',_0x1a188b(_0x302be9['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x3c89ab(0x1bc)]=a18_0x3c89ab(0x248);[a18_0x3c89ab(0x1a2)]='Show\x20journey\x20details';async['execute'](_0x52ff16){const _0x46bc70=a18_0x3c89ab,{options:_0x537e09,args:_0x55fd6c,tdx:_0x4d37e5}=_0x52ff16,_0x8b841b=_0x55fd6c[0x0];if(!_0x8b841b)return console[_0x46bc70(0x243)](_0x46bc70(0x197)),console[_0x46bc70(0x243)](_0x46bc70(0x1e6)),console[_0x46bc70(0x243)](_0x46bc70(0x264)),console[_0x46bc70(0x243)](_0x46bc70(0x1fc)),0x1;_0x537e09[_0x46bc70(0x1e0)]&&console['error'](_0x46bc70(0x1ad)+_0x8b841b);const _0x437115=await resolveJourneyTarget(_0x8b841b,_0x537e09[_0x46bc70(0x223)],_0x537e09[_0x46bc70(0x1e0)]),_0x27a75f=await withSpinner(_0x46bc70(0x229),()=>_0x4d37e5[_0x46bc70(0x239)][_0x46bc70(0x1f3)](_0x437115['parentSegment']),{'verbose':_0x537e09[_0x46bc70(0x1e0)]}),_0x298cda=_0x27a75f[_0x46bc70(0x1dc)],_0x3a699d=await withSpinner(_0x46bc70(0x1a9),()=>_0x4d37e5[_0x46bc70(0x201)][_0x46bc70(0x1d7)](_0x298cda,_0x437115['journeyName']),{'verbose':_0x537e09[_0x46bc70(0x1e0)]}),_0x22f03a=_0x3a699d[_0x46bc70(0x1dc)];if(_0x537e09[_0x46bc70(0x256)]){const _0x18dc92=getConsoleNextUrl(_0x537e09['site'],_0x46bc70(0x194)+_0x298cda+_0x46bc70(0x1a6)+_0x22f03a+_0x46bc70(0x233));return console[_0x46bc70(0x243)](a18_0x1ae124['green']('✔')+_0x46bc70(0x1ea)+a18_0x1ae124[_0x46bc70(0x22b)](_0x18dc92)),openBrowser(_0x18dc92),0x0;}const _0x54ac1a=await withSpinner(_0x46bc70(0x249),()=>_0x4d37e5[_0x46bc70(0x201)][_0x46bc70(0x210)](_0x22f03a),{'verbose':_0x537e09[_0x46bc70(0x1e0)]}),_0x1d0251=_0x54ac1a[_0x46bc70(0x1dc)],_0x22d201=_0x537e09[_0x46bc70(0x235)];let _0x2705e9;if(_0x22d201)try{const _0x1f82a8=await withSpinner(_0x46bc70(0x1aa),()=>_0x4d37e5[_0x46bc70(0x201)][_0x46bc70(0x1c7)](_0x22f03a),{'verbose':_0x537e09[_0x46bc70(0x1e0)]});_0x2705e9=_0x1f82a8[_0x46bc70(0x1dc)];}catch{_0x537e09[_0x46bc70(0x1e0)]&&console['error'](_0x46bc70(0x196));}const _0x646fff=getConsoleNextUrl(_0x537e09[_0x46bc70(0x205)],_0x46bc70(0x194)+_0x298cda+_0x46bc70(0x1a6)+_0x22f03a+_0x46bc70(0x233)),_0x149b97={'id':_0x1d0251['id'],'name':_0x1d0251[_0x46bc70(0x1e7)]['name'],'description':_0x1d0251[_0x46bc70(0x1e7)][_0x46bc70(0x1a2)],'state':_0x1d0251[_0x46bc70(0x1e7)][_0x46bc70(0x22e)],'paused':_0x1d0251['attributes'][_0x46bc70(0x218)],'reentry_mode':_0x1d0251[_0x46bc70(0x1e7)][_0x46bc70(0x189)],'stages':_0x1d0251[_0x46bc70(0x1e7)][_0x46bc70(0x221)]?.[_0x46bc70(0x1b3)]||0x0,..._0x1d0251[_0x46bc70(0x1e7)][_0x46bc70(0x188)]&&{'goal':_0x1d0251[_0x46bc70(0x1e7)]['goal'][_0x46bc70(0x1bc)]},..._0x2705e9&&{'statistics':{'total_entered':_0x2705e9['totalEntered'],'goal_achieved':_0x2705e9[_0x46bc70(0x1c1)],'goal_rate':_0x2705e9[_0x46bc70(0x22a)],'stages':_0x2705e9[_0x46bc70(0x20e)]}},'url':_0x646fff};return await handleSingleObjectOutput(_0x149b97,_0x537e09),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x3c89ab(0x1bc)]='journey:stats';['description']=a18_0x3c89ab(0x18c);async[a18_0x3c89ab(0x1a4)](_0x7c474e){const _0x4fff81=a18_0x3c89ab,{options:_0x57358f,args:_0x2c22b9,tdx:_0x4cbe4d}=_0x7c474e,_0x5b6ea2=_0x2c22b9[0x0];if(!_0x5b6ea2)return console[_0x4fff81(0x243)](_0x4fff81(0x197)),console[_0x4fff81(0x243)]('Usage:\x20journey\x20stats\x20<name-or-path>'),0x1;_0x57358f[_0x4fff81(0x1e0)]&&console[_0x4fff81(0x243)](_0x4fff81(0x1ad)+_0x5b6ea2);const _0x1e704c=await resolveJourneyTarget(_0x5b6ea2,_0x57358f[_0x4fff81(0x223)],_0x57358f['verbose']),_0x169660=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x4cbe4d[_0x4fff81(0x239)][_0x4fff81(0x1f3)](_0x1e704c[_0x4fff81(0x223)]),{'verbose':_0x57358f['verbose']}),_0x588dec=_0x169660['data'],_0x39854a=await withSpinner(_0x4fff81(0x1a9),()=>_0x4cbe4d[_0x4fff81(0x201)][_0x4fff81(0x1d7)](_0x588dec,_0x1e704c[_0x4fff81(0x1e1)]),{'verbose':_0x57358f[_0x4fff81(0x1e0)]}),_0x47fe09=_0x39854a['data'],_0x1c3dce=await withSpinner(_0x4fff81(0x1aa),()=>_0x4cbe4d[_0x4fff81(0x201)][_0x4fff81(0x1c7)](_0x47fe09),{'verbose':_0x57358f[_0x4fff81(0x1e0)]}),_0x4404e1=_0x1c3dce[_0x4fff81(0x1dc)];if(!_0x4404e1||_0x4404e1['journeyId']===null)return console[_0x4fff81(0x243)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x1e704c[_0x4fff81(0x1e1)]),console['error'](_0x4fff81(0x1fa)),0x0;const _0x4d27b9={'journey_id':_0x4404e1[_0x4fff81(0x195)],'total_entered':_0x4404e1[_0x4fff81(0x20f)],'goal_achieved':_0x4404e1[_0x4fff81(0x1c1)],'goal_rate':_0x4404e1['goalRate'],'stages':_0x4404e1[_0x4fff81(0x20e)]?.[_0x4fff81(0x247)](_0xa38971=>({'name':_0xa38971[_0x4fff81(0x23f)],'population':_0xa38971[_0x4fff81(0x1b4)],'entered':_0xa38971[_0x4fff81(0x1e5)],'exited':_0xa38971['exited'],'conversion_rate':_0xa38971['conversionRate']}))},_0x2c3be3=_0x57358f[_0x4fff81(0x228)];if(_0x2c3be3&&_0x4404e1[_0x4fff81(0x20e)]){const _0x3497ea=_0x4404e1[_0x4fff81(0x20e)]['find'](_0x36e3dd=>_0x36e3dd[_0x4fff81(0x23f)][_0x4fff81(0x18e)]()===_0x2c3be3[_0x4fff81(0x18e)]());if(_0x3497ea)return await handleSingleObjectOutput({'stage_name':_0x3497ea[_0x4fff81(0x23f)],'population':_0x3497ea[_0x4fff81(0x1b4)],'entered':_0x3497ea[_0x4fff81(0x1e5)],'exited':_0x3497ea['exited'],'conversion_rate':_0x3497ea[_0x4fff81(0x1f6)]},_0x57358f),0x0;console[_0x4fff81(0x243)](_0x4fff81(0x1ff)+_0x2c3be3+_0x4fff81(0x1ef));}return await handleSingleObjectOutput(_0x4d27b9,_0x57358f),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x3c89ab(0x1bc)]='journey:pause';[a18_0x3c89ab(0x1a2)]='Pause\x20a\x20running\x20journey';async[a18_0x3c89ab(0x1a4)](_0x47458d){const _0x573306=a18_0x3c89ab,{options:_0x814b90,args:_0x2b1aa6,tdx:_0x553eb1}=_0x47458d,_0x1531af=_0x2b1aa6[0x0];if(!_0x1531af)return console['error'](_0x573306(0x197)),console[_0x573306(0x243)](_0x573306(0x1cf)),0x1;_0x814b90['verbose']&&console['error']('Input:\x20'+_0x1531af);const _0xc8c590=await resolveJourneyTarget(_0x1531af,_0x814b90[_0x573306(0x223)],_0x814b90[_0x573306(0x1e0)]),_0x1dd837=await withSpinner(_0x573306(0x229),()=>_0x553eb1[_0x573306(0x239)][_0x573306(0x1f3)](_0xc8c590['parentSegment']),{'verbose':_0x814b90[_0x573306(0x1e0)]}),_0x492859=_0x1dd837[_0x573306(0x1dc)],_0x11e293=await withSpinner('Resolving\x20journey...',()=>_0x553eb1[_0x573306(0x201)]['resolveJourneyId'](_0x492859,_0xc8c590[_0x573306(0x1e1)]),{'verbose':_0x814b90['verbose']}),_0x16d097=_0x11e293['data'];if(!_0x814b90[_0x573306(0x1e4)]){const _0x293a63=await confirm(_0x573306(0x1a1)+_0xc8c590[_0x573306(0x1e1)]+'\x22?');if(!_0x293a63)return console['error']('Cancelled'),0x0;}const _0xed0c0d=await withSpinner(_0x573306(0x255),()=>_0x553eb1[_0x573306(0x201)]['pause'](_0x16d097),{'verbose':_0x814b90[_0x573306(0x1e0)]}),_0x4f1c5e=_0xed0c0d['data'];return console[_0x573306(0x243)](_0x573306(0x244)+_0x4f1c5e[_0x573306(0x1e7)][_0x573306(0x1bc)]+_0x573306(0x1ae)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x3c89ab(0x1bc)]=a18_0x3c89ab(0x1ce);['description']=a18_0x3c89ab(0x18a);async[a18_0x3c89ab(0x1a4)](_0x28a92e){const _0x3ab74e=a18_0x3c89ab,{options:_0x3fa57c,args:_0x4a318f,tdx:_0x30537c}=_0x28a92e,_0x1d323c=_0x4a318f[0x0];if(!_0x1d323c)return console['error'](_0x3ab74e(0x197)),console['error'](_0x3ab74e(0x24a)),0x1;_0x3fa57c['verbose']&&console['error']('Input:\x20'+_0x1d323c);const _0x49aded=await resolveJourneyTarget(_0x1d323c,_0x3fa57c[_0x3ab74e(0x223)],_0x3fa57c[_0x3ab74e(0x1e0)]),_0x3f8989=await withSpinner(_0x3ab74e(0x229),()=>_0x30537c[_0x3ab74e(0x239)][_0x3ab74e(0x1f3)](_0x49aded[_0x3ab74e(0x223)]),{'verbose':_0x3fa57c['verbose']}),_0x4972dd=_0x3f8989[_0x3ab74e(0x1dc)],_0x3ff796=await withSpinner(_0x3ab74e(0x1a9),()=>_0x30537c[_0x3ab74e(0x201)]['resolveJourneyId'](_0x4972dd,_0x49aded[_0x3ab74e(0x1e1)]),{'verbose':_0x3fa57c[_0x3ab74e(0x1e0)]}),_0x3171c5=_0x3ff796['data'];if(!_0x3fa57c['yes']){const _0x23909b=await confirm(_0x3ab74e(0x1a3)+_0x49aded[_0x3ab74e(0x1e1)]+'\x22?');if(!_0x23909b)return console[_0x3ab74e(0x243)](_0x3ab74e(0x1cd)),0x0;}const _0x2519a7=await withSpinner(_0x3ab74e(0x1d2),()=>_0x30537c[_0x3ab74e(0x201)]['resume'](_0x3171c5),{'verbose':_0x3fa57c[_0x3ab74e(0x1e0)]}),_0x530f7b=_0x2519a7[_0x3ab74e(0x1dc)];return console['error']('✔\x20Journey\x20\x22'+_0x530f7b[_0x3ab74e(0x1e7)][_0x3ab74e(0x1bc)]+_0x3ab74e(0x1d0)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']='journey:pull';['description']=a18_0x3c89ab(0x20b);async['execute'](_0x27c4c0){const _0x8918c=a18_0x3c89ab,{options:_0x5ef758,args:_0x53ebe4,tdx:_0x519747}=_0x27c4c0,_0x48cf62=_0x5ef758,_0x3acb2e=_0x53ebe4[0x0],_0x390a2f=_0x3acb2e&&isYamlFilePath(_0x3acb2e),_0x36b7f9=await resolveTarget({'arg':_0x390a2f?_0x3acb2e:undefined,'contextParent':_0x5ef758[_0x8918c(0x223)],'cwd':process[_0x8918c(0x250)]()});if(!isSuccessfulResolution(_0x36b7f9))return _0x36b7f9[_0x8918c(0x208)]===_0x8918c(0x22f)?(console[_0x8918c(0x243)](a18_0x1ae124[_0x8918c(0x1d3)](_0x8918c(0x1f0))),console['error'](_0x8918c(0x25e)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x8918c(0x243)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x8918c(0x243)](_0x8918c(0x1d9))):(console['error'](a18_0x1ae124[_0x8918c(0x1a8)](_0x8918c(0x1b6)+_0x36b7f9[_0x8918c(0x216)]+'\x0a')),_0x36b7f9[_0x8918c(0x187)]&&console['error'](a18_0x1ae124[_0x8918c(0x22b)](_0x36b7f9[_0x8918c(0x187)]))),0x1;let _0x54b54a=_0x390a2f?undefined:_0x3acb2e,_0x5dd714,_0x3559eb;_0x36b7f9['type']===_0x8918c(0x231)&&(_0x54b54a=_0x36b7f9[_0x8918c(0x1fd)],_0x5dd714=_0x36b7f9[_0x8918c(0x23b)],_0x3559eb=_0x36b7f9[_0x8918c(0x1ac)]);const _0x782f21=_0x36b7f9[_0x8918c(0x1f9)],_0x13645f=_0x36b7f9[_0x8918c(0x232)];_0x48cf62['verbose']&&(console['error'](_0x8918c(0x227)+_0x782f21),console[_0x8918c(0x243)](_0x8918c(0x212)+_0x13645f),_0x54b54a&&console['error'](_0x8918c(0x24e)+_0x54b54a),_0x5dd714&&console[_0x8918c(0x243)]('Target\x20file:\x20'+_0x5dd714),_0x3559eb&&console[_0x8918c(0x243)]('Folder\x20path:\x20'+_0x3559eb));const _0x302ae0=await withSpinner(_0x8918c(0x229),()=>_0x519747[_0x8918c(0x239)]['resolveParentId'](_0x782f21),{'verbose':_0x5ef758['verbose']}),_0x59a66b=_0x302ae0['data'],[_0x5740d4,_0x5ed663]=await Promise[_0x8918c(0x18b)]([withSpinner(_0x8918c(0x1de),()=>_0x519747[_0x8918c(0x201)]['listJourneysFromParentSegment'](_0x59a66b,undefined,{'includeAllVersions':!![]}),{'verbose':_0x5ef758[_0x8918c(0x1e0)]}),withSpinner(_0x8918c(0x209),()=>_0x519747[_0x8918c(0x239)][_0x8918c(0x1e9)](_0x59a66b),{'verbose':_0x5ef758[_0x8918c(0x1e0)]})]);let _0x1217b1=_0x5740d4['data'];const _0x35e719=_0x5ed663[_0x8918c(0x1dc)],_0x22cbe2=buildFolderIdToPathMap(_0x35e719);if(_0x54b54a){const _0x54ee2e=_0x1217b1[_0x8918c(0x20a)](_0x13463b=>_0x13463b[_0x8918c(0x1be)][_0x8918c(0x18e)]()===_0x54b54a[_0x8918c(0x18e)]());if(_0x54ee2e[_0x8918c(0x1b3)]===0x0)return console[_0x8918c(0x243)]('Error:\x20Journey\x20not\x20found:\x20'+_0x54b54a),console['error'](_0x8918c(0x1d5)),0x1;_0x1217b1=_0x54ee2e;}if(_0x3559eb!==undefined){const _0x531883=_0x1217b1[_0x8918c(0x20a)](_0x205373=>{const _0x2d6fb0=_0x8918c,_0x546efd=_0x205373[_0x2d6fb0(0x1b7)]?_0x22cbe2[_0x2d6fb0(0x19a)](_0x205373[_0x2d6fb0(0x1b7)])||'':'';return _0x546efd===_0x3559eb;});if(_0x531883[_0x8918c(0x1b3)]===0x0&&_0x1217b1['length']>0x0){console[_0x8918c(0x243)](_0x8918c(0x19b)+_0x54b54a+_0x8918c(0x1a5)+(_0x3559eb||'root\x20folder')),console[_0x8918c(0x243)]('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0x43b763 of _0x1217b1){const _0x40d488=_0x43b763[_0x8918c(0x1b7)]?_0x22cbe2[_0x8918c(0x19a)](_0x43b763[_0x8918c(0x1b7)])||'':'';console['error'](_0x8918c(0x202)+(_0x40d488||_0x8918c(0x24c))+'/'+_0x43b763[_0x8918c(0x1be)]);}return 0x1;}_0x1217b1=_0x531883;}if(_0x1217b1[_0x8918c(0x1b3)]===0x0)return console[_0x8918c(0x243)](_0x8918c(0x245)),0x0;const _0x33dbe5=new Map();for(const _0x5028ef of _0x1217b1){const _0xa5041=_0x5028ef[_0x8918c(0x1c2)];!_0x33dbe5[_0x8918c(0x211)](_0xa5041)&&_0x33dbe5['set'](_0xa5041,[]),_0x33dbe5[_0x8918c(0x19a)](_0xa5041)[_0x8918c(0x200)](_0x5028ef);}for(const _0x2d387e of _0x33dbe5[_0x8918c(0x1d8)]()){_0x2d387e['sort']((_0x145bf8,_0x1a9bd3)=>(_0x145bf8[_0x8918c(0x1c3)]||0x0)-(_0x1a9bd3[_0x8918c(0x1c3)]||0x0));}const _0x4e0b28=[],[_0x4bc8b6,_0x462155]=await Promise['all']([withSpinner(_0x8918c(0x203),()=>_0x519747[_0x8918c(0x1ed)][_0x8918c(0x20d)](),{'verbose':_0x5ef758[_0x8918c(0x1e0)]})[_0x8918c(0x21a)](_0x30646c=>_0x30646c[_0x8918c(0x1dc)]),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x519747[_0x8918c(0x214)][_0x8918c(0x1c8)](),{'verbose':_0x5ef758[_0x8918c(0x1e0)]})['then'](_0x384e67=>_0x384e67[_0x8918c(0x1dc)])]);for(const _0x279f9a of _0x33dbe5[_0x8918c(0x1d8)]()){const _0x4cb31d=_0x279f9a[0x0][_0x8918c(0x1be)],_0x11920d=_0x279f9a[0x0][_0x8918c(0x1b7)],_0x55cf80=_0x11920d?_0x22cbe2[_0x8918c(0x19a)](_0x11920d)||'':'',_0x799807=_0x55cf80?a18_0x5118dc[_0x8918c(0x1df)](_0x13645f,_0x55cf80):_0x13645f,_0x2f7696=_0x5dd714||a18_0x5118dc[_0x8918c(0x1df)](_0x799807,sanitizeFileName(_0x4cb31d)+_0x8918c(0x251));let _0x30f113,_0x46533d;if(existsSync(_0x2f7696))try{const _0x22b3d1=readFileSync(_0x2f7696,_0x8918c(0x1b1)),_0x47b165=parseYamlString(_0x22b3d1);_0x46533d=_0x47b165,_0x30f113=buildRuleToNameMapping(_0x47b165),_0x48cf62['verbose']&&_0x30f113[_0x8918c(0x21d)]>0x0&&console[_0x8918c(0x243)](_0x8918c(0x253)+_0x30f113[_0x8918c(0x21d)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x4cb31d);}catch(_0x11dec3){_0x48cf62['verbose']&&console['error'](_0x8918c(0x1d1)+_0x11dec3[_0x8918c(0x216)]);}const _0x2110b9=[],_0x2086c2=new Set(),_0x2891b7=new Map(),_0x4dd8eb=new Map(),_0x15e5dd=new Set(),_0x18aa96=new Map(),_0x3f7e06=new Map(),_0x26ab22=createJumpTargetCache();await withProgressSpinner(_0x8918c(0x1b2)+_0x4cb31d+_0x8918c(0x25a),async _0x398b66=>{const _0x16438d=_0x8918c;for(const _0x50c025 of _0x279f9a){const _0xc7d3e9=_0x279f9a[_0x16438d(0x1b3)]>0x1?_0x50c025[_0x16438d(0x1be)]+'\x20v'+(_0x50c025[_0x16438d(0x1c3)]||0x1):_0x50c025[_0x16438d(0x1be)];_0x398b66[_0x16438d(0x1ab)]('Fetching\x20'+_0xc7d3e9);const _0x4e6767=await _0x519747[_0x16438d(0x201)]['getJourney'](_0x50c025['id']),_0x512513=_0x4e6767['attributes']?.[_0x16438d(0x22c)],_0x5665ce={'resolveSegment':async _0x2d0a52=>{const _0x4245c9=_0x16438d;if(!_0x512513)return{'name':_0x2d0a52,'isJourneyLocal':![]};const _0x48be87=_0x2891b7[_0x4245c9(0x19a)](_0x2d0a52);if(_0x48be87)return _0x48be87;try{const _0x263d8b=await _0x519747[_0x4245c9(0x239)][_0x4245c9(0x21b)](_0x512513,_0x2d0a52),_0x2611bf=_0x263d8b[_0x4245c9(0x204)]===SEGMENT_KIND_JOURNEY;let _0x50e52f,_0xf3c04d=_0x263d8b[_0x4245c9(0x1bc)];if(_0x2611bf&&_0x263d8b[_0x4245c9(0x22d)]){const _0xe66023=await segmentResponseToDef(_0x263d8b,{'resolveSegmentName':async _0xa3cdb8=>{const _0x389694=_0x4245c9,_0x39db2e=_0x2891b7[_0x389694(0x19a)](_0xa3cdb8);if(_0x39db2e)return _0x39db2e[_0x389694(0x1bc)];const _0x1c2688=await _0x5665ce[_0x389694(0x230)](_0xa3cdb8);return _0x1c2688[_0x389694(0x1bc)];}}),_0x43aac5=_0xe66023['rule'];_0x50e52f={'description':_0x263d8b['description'],'rule':_0x43aac5};const _0x17a968=serializeRule(_0x43aac5),_0x216b94=_0x4dd8eb[_0x4245c9(0x19a)](_0x17a968);if(_0x216b94)_0xf3c04d=_0x216b94,_0x50e52f=undefined,_0x48cf62[_0x4245c9(0x1e0)]&&console[_0x4245c9(0x243)](_0x4245c9(0x1f5)+_0x263d8b[_0x4245c9(0x1bc)]+_0x4245c9(0x1a0)+_0x216b94);else{let _0x5b1aae=![];if(_0x30f113){const _0x79d45f=_0x30f113[_0x4245c9(0x19a)](_0x17a968);if(_0x79d45f){const _0x2899bb=_0x79d45f['find'](_0x299b1b=>!_0x2086c2['has'](_0x299b1b));_0x2899bb&&(_0xf3c04d=_0x2899bb,_0x2086c2['add'](_0x2899bb),_0x4dd8eb['set'](_0x17a968,_0x2899bb),_0x5b1aae=!![],_0x48cf62[_0x4245c9(0x1e0)]&&console[_0x4245c9(0x243)](_0x4245c9(0x25b)+_0x2899bb+_0x4245c9(0x1ec)));}}if(!_0x5b1aae){const _0x4fc3ff=generateJourneyLocalName(_0x263d8b[_0x4245c9(0x1bc)]);_0x4fc3ff&&(_0xf3c04d=_0x4fc3ff);let _0x2eaa42=_0xf3c04d,_0x2fd2c9=0x2;while(_0x2086c2[_0x4245c9(0x211)](_0x2eaa42)){_0x2eaa42=_0xf3c04d+'_'+_0x2fd2c9,_0x2fd2c9++;}_0x2086c2[_0x4245c9(0x246)](_0x2eaa42),_0x4dd8eb[_0x4245c9(0x1c4)](_0x17a968,_0x2eaa42),_0xf3c04d=_0x2eaa42;}}}const _0xd6318c={'name':_0xf3c04d,'isJourneyLocal':_0x2611bf,'definition':_0x50e52f};return _0x2891b7[_0x4245c9(0x1c4)](_0x2d0a52,_0xd6318c),_0xd6318c;}catch(_0x263dc1){return _0x5ef758[_0x4245c9(0x1e0)]&&console[_0x4245c9(0x243)](_0x4245c9(0x1cc)+_0x2d0a52+':\x20'+_0x263dc1['message']),{'name':_0x2d0a52,'isJourneyLocal':![]};}},'resolveActivation':async _0x161224=>{const _0x42e5ec=_0x16438d,_0x129dd6=_0x18aa96['get'](_0x161224);if(_0x129dd6)return _0x129dd6;try{const _0x8d9d31=await _0x519747[_0x42e5ec(0x201)][_0x42e5ec(0x1ba)](_0x50c025['id'],_0x161224),_0x25387f=journeyActivationStepToYaml(_0x8d9d31,_0x4bc8b6,_0x462155),_0x120c55=JSON[_0x42e5ec(0x257)]({'name':_0x25387f[_0x42e5ec(0x1bc)],'connection':_0x25387f[_0x42e5ec(0x214)],'connector_config':_0x25387f[_0x42e5ec(0x1cb)]}),_0x4584fc=_0x3f7e06[_0x42e5ec(0x19a)](_0x120c55);if(_0x4584fc){const _0x3b447a={'name':_0x4584fc,'isJourneyLocal':!![],'definition':_0x25387f};return _0x18aa96[_0x42e5ec(0x1c4)](_0x161224,_0x3b447a),_0x3b447a;}const _0x10a045=_0x8d9d31[_0x42e5ec(0x1e7)]['activationParams']['name']||_0x161224,_0x5b56b7=sanitizeYamlKey(_0x10a045)||_0x42e5ec(0x193)+_0x161224;let _0x5ecc0f=_0x5b56b7,_0x2dc4bc=0x2;while(_0x15e5dd['has'](_0x5ecc0f)){_0x5ecc0f=_0x5b56b7+'_'+_0x2dc4bc,_0x2dc4bc++;}_0x15e5dd[_0x42e5ec(0x246)](_0x5ecc0f),_0x3f7e06[_0x42e5ec(0x1c4)](_0x120c55,_0x5ecc0f);const _0x4161f1={'name':_0x5ecc0f,'isJourneyLocal':!![],'definition':_0x25387f};return _0x18aa96[_0x42e5ec(0x1c4)](_0x161224,_0x4161f1),_0x4161f1;}catch(_0x772036){return _0x5ef758[_0x42e5ec(0x1e0)]&&console[_0x42e5ec(0x243)](_0x42e5ec(0x1d6)+_0x161224+':\x20'+_0x772036[_0x42e5ec(0x216)]),{'name':_0x161224,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x5b89e8,_0x16cf01)=>{const _0x327c22=_0x16438d;return resolveJumpTarget(_0x5b89e8,_0x16cf01,_0x26ab22,_0x4ff778=>_0x519747[_0x327c22(0x201)][_0x327c22(0x210)](_0x4ff778));}},_0x3854f7=await journeyResponseToDef(_0x4e6767,_0x5665ce);_0x2110b9[_0x16438d(0x200)]({'item':_0x50c025,'yaml':_0x3854f7});}},{'verbose':_0x5ef758[_0x8918c(0x1e0)]});const _0x4cbc66=buildMergedJourneyDef(_0x2110b9,_0x30f113),_0x2f7514=normalizeJourneyDef(_0x4cbc66,_0x46533d),_0x2a061b=toYamlString(_0x2f7514),_0x31651b=_0x5dd714||a18_0x5118dc['join'](_0x799807,sanitizeFileName(_0x4cb31d)+_0x8918c(0x251));!_0x5dd714&&_0x55cf80&&!existsSync(_0x799807)&&mkdirSync(_0x799807,{'recursive':!![]});const _0x2bf264=a18_0x5118dc['relative'](process[_0x8918c(0x250)](),_0x31651b);if(existsSync(_0x31651b)){const _0x4cb883=readFileSync(_0x31651b,_0x8918c(0x1b1)),_0x4ddf1b=generateDiff(_0x4cb883,_0x2a061b),_0x17ff25=hasChanges(_0x4ddf1b);_0x4e0b28['push']({'relativePath':_0x2bf264,'absolutePath':_0x31651b,'content':_0x2a061b,'isNew':![],'hasChanges':_0x17ff25,'diff':_0x17ff25?formatDiffWithColors(_0x4ddf1b):undefined});}else _0x4e0b28[_0x8918c(0x200)]({'relativePath':_0x2bf264,'absolutePath':_0x31651b,'content':_0x2a061b,'isNew':!![],'hasChanges':![]});}const _0x639288=_0x4e0b28[_0x8918c(0x20a)](_0x1b3362=>_0x1b3362[_0x8918c(0x24f)]),_0x44f2cb=_0x4e0b28[_0x8918c(0x20a)](_0x333780=>!_0x333780[_0x8918c(0x24f)]&&_0x333780['hasChanges']),_0x262119=_0x4e0b28[_0x8918c(0x20a)](_0x3c7ca2=>!_0x3c7ca2[_0x8918c(0x24f)]&&!_0x3c7ca2['hasChanges']),_0x322e90=_0x1217b1[_0x8918c(0x1b3)],_0x2b113a=_0x33dbe5[_0x8918c(0x21d)],_0x3ee17f=_0x322e90>_0x2b113a?'\x20('+_0x322e90+_0x8918c(0x1b9):'';console[_0x8918c(0x243)](_0x8918c(0x262)),console[_0x8918c(0x243)]('\x20\x20'+a18_0x1ae124[_0x8918c(0x22b)](_0x2b113a+_0x8918c(0x1bd))+a18_0x1ae124['dim'](_0x3ee17f)),console[_0x8918c(0x243)]('\x20\x20'+a18_0x1ae124[_0x8918c(0x1ca)]('+\x20'+_0x639288['length']+_0x8918c(0x219))),console[_0x8918c(0x243)]('\x20\x20'+a18_0x1ae124[_0x8918c(0x1d3)]('~\x20'+_0x44f2cb[_0x8918c(0x1b3)]+_0x8918c(0x1af))),console[_0x8918c(0x243)]('\x20\x20'+a18_0x1ae124[_0x8918c(0x25d)]('=\x20'+_0x262119['length']+'\x20unchanged\x20files')),console[_0x8918c(0x243)](_0x8918c(0x19d)+a18_0x1ae124[_0x8918c(0x22b)](_0x13645f)+'\x0a');if(_0x44f2cb[_0x8918c(0x1b3)]>0x0)for(const _0x9131c3 of _0x44f2cb){console[_0x8918c(0x243)](_0x8918c(0x1a7)+_0x9131c3[_0x8918c(0x192)]+'\x27:'),console['error']('─'[_0x8918c(0x18f)](0x3c)),console[_0x8918c(0x243)](_0x9131c3[_0x8918c(0x21c)]),console[_0x8918c(0x243)]('─'[_0x8918c(0x18f)](0x3c));}if(_0x48cf62[_0x8918c(0x23a)])return console[_0x8918c(0x243)](a18_0x1ae124[_0x8918c(0x1d3)](_0x8918c(0x1f8))),0x0;if(_0x639288['length']===0x0&&_0x44f2cb[_0x8918c(0x1b3)]===0x0)return console[_0x8918c(0x243)](a18_0x1ae124['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x782f21},_0x48cf62[_0x8918c(0x1ee)]),console[_0x8918c(0x243)](a18_0x1ae124[_0x8918c(0x1ca)](_0x8918c(0x1c5)+a18_0x1ae124[_0x8918c(0x25d)](_0x8918c(0x25f))+_0x8918c(0x1f2)+a18_0x1ae124[_0x8918c(0x22b)](_0x782f21))),0x0;if(!_0x48cf62[_0x8918c(0x1e4)]&&(_0x639288['length']>0x0||_0x44f2cb[_0x8918c(0x1b3)]>0x0)){const _0x21d7b5=await confirmKey(_0x8918c(0x191)+(_0x639288['length']+_0x44f2cb[_0x8918c(0x1b3)])+_0x8918c(0x23e));if(!_0x21d7b5)return console['error'](_0x8918c(0x213)),0x1;}!existsSync(_0x13645f)&&mkdirSync(_0x13645f,{'recursive':!![]});for(const _0x3a187a of _0x4e0b28){(_0x3a187a['isNew']||_0x3a187a[_0x8918c(0x19c)])&&writeFileSync(_0x3a187a['absolutePath'],_0x3a187a[_0x8918c(0x23c)],_0x8918c(0x1b1));}return console['error'](a18_0x1ae124[_0x8918c(0x1ca)](_0x8918c(0x1dd)+(_0x639288[_0x8918c(0x1b3)]+_0x44f2cb['length'])+_0x8918c(0x18d)+_0x13645f)),saveSessionContext({'parent_segment':_0x782f21},_0x48cf62[_0x8918c(0x1ee)]),console['error'](a18_0x1ae124[_0x8918c(0x1ca)](_0x8918c(0x1c5)+a18_0x1ae124['dim'](_0x8918c(0x25f))+_0x8918c(0x1f2)+a18_0x1ae124['cyan'](_0x782f21))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x3c89ab(0x1bc)]=a18_0x3c89ab(0x1f7);[a18_0x3c89ab(0x1a2)]=a18_0x3c89ab(0x241);[a18_0x3c89ab(0x1e8)]=new SegmentPushCommand();async[a18_0x3c89ab(0x1a4)](_0xfa65a2){const _0x4237f8=a18_0x3c89ab,_0xb6737d=_0xfa65a2[_0x4237f8(0x1b8)][0x0];let _0x592c56;if(_0xb6737d){const _0x3c7c04=await resolveTarget({'arg':_0xb6737d,'contextParent':_0xfa65a2[_0x4237f8(0x1fb)][_0x4237f8(0x223)],'cwd':process[_0x4237f8(0x250)]()});isSuccessfulResolution(_0x3c7c04)&&_0x3c7c04[_0x4237f8(0x1fe)]===_0x4237f8(0x231)&&(_0x592c56=_0x3c7c04[_0x4237f8(0x23b)]);}const _0x134ed0={..._0xfa65a2,'options':{..._0xfa65a2[_0x4237f8(0x1fb)],'journeysOnly':!![],..._0x592c56&&{'singleFilePath':_0x592c56}}};return this[_0x4237f8(0x1e8)]['execute'](_0x134ed0);}}
@@ -1 +1 @@
1
- const a19_0x12ffa0=a19_0x4f90;(function(_0x297450,_0x2962dd){const _0x29e169=a19_0x4f90,_0x86853e=_0x297450();while(!![]){try{const _0x4e3e25=-parseInt(_0x29e169(0x17f))/0x1+-parseInt(_0x29e169(0x17c))/0x2*(parseInt(_0x29e169(0x161))/0x3)+parseInt(_0x29e169(0x185))/0x4+-parseInt(_0x29e169(0x164))/0x5*(-parseInt(_0x29e169(0x15e))/0x6)+parseInt(_0x29e169(0x177))/0x7+-parseInt(_0x29e169(0x183))/0x8*(-parseInt(_0x29e169(0x17e))/0x9)+parseInt(_0x29e169(0x167))/0xa*(parseInt(_0x29e169(0x159))/0xb);if(_0x4e3e25===_0x2962dd)break;else _0x86853e['push'](_0x86853e['shift']());}catch(_0x41730e){_0x86853e['push'](_0x86853e['shift']());}}}(a19_0x44ed,0x542b9));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';function a19_0x4f90(_0x43fe3f,_0x1a26e8){_0x43fe3f=_0x43fe3f-0x158;const _0x44ed64=a19_0x44ed();let _0x4f90af=_0x44ed64[_0x43fe3f];return _0x4f90af;}import a19_0x22f302 from'chalk';function a19_0x44ed(){const _0x429ab0=['\x20valid','8464gbAJeS','Error:\x20','1336276ZviWfB','✔\x20All\x20','message','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','targetDir','file','skippedCount','length','Validate\x20journey\x20YAML\x20files','warnings','\x20journey(s)\x20with\x20errors,\x20','No\x20journey\x20YAML\x20files\x20found\x20in\x20','verbose','red','error','journey:validate','cwd','\x20journey(s)\x20valid','44iGmkIE','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','validCount','\x20segment\x20file(s)\x20skipped)','\x20(skipped:\x20','66JUmkOO','warningCount','errors','933ZrwAET','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','log','64475FmeteH','parentSegment','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','277470ZpVKyZ','cyan','reason','\x20warning(s)\x20found','yellow','valid','\x20segment\x20file(s)\x20skipped','no_parent','\x20error(s)','green','Validation\x20failed:\x20','invalidCount','dim','\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','.yaml','\x20warning(s)','3791354dFJwfS','helpText','errorCode','description','endsWith','1706uAOoRb','filter','1359CtnHXi','678238AlFKlq','execute','type'];a19_0x44ed=function(){return _0x429ab0;};return a19_0x44ed();}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{['name']=a19_0x12ffa0(0x194);[a19_0x12ffa0(0x17a)]=a19_0x12ffa0(0x18d);async[a19_0x12ffa0(0x180)](_0x4d3c8e){const _0x3cd16e=a19_0x12ffa0,{options:_0xeb4b82,args:_0x2138f2}=_0x4d3c8e,_0x38488e=_0xeb4b82,_0x10d522=await resolveTarget({'arg':_0x2138f2[0x0],'contextParent':_0xeb4b82[_0x3cd16e(0x165)],'cwd':process[_0x3cd16e(0x195)]()});if(!isSuccessfulResolution(_0x10d522))return _0x10d522[_0x3cd16e(0x179)]===_0x3cd16e(0x16e)?(console[_0x3cd16e(0x193)](a19_0x22f302['yellow'](_0x3cd16e(0x162))),console[_0x3cd16e(0x193)](_0x3cd16e(0x166)),console[_0x3cd16e(0x193)](_0x3cd16e(0x174)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0x3cd16e(0x193)](a19_0x22f302[_0x3cd16e(0x192)](_0x3cd16e(0x184)+_0x10d522[_0x3cd16e(0x187)]+'\x0a')),_0x10d522[_0x3cd16e(0x178)]&&console[_0x3cd16e(0x193)](a19_0x22f302[_0x3cd16e(0x168)](_0x10d522['helpText']))),0x1;const _0x579913=_0x10d522[_0x3cd16e(0x189)],_0x545b53=_0x10d522[_0x3cd16e(0x181)]===_0x3cd16e(0x18a)?_0x10d522['filePath']:undefined;if(!_0x545b53&&!existsSync(_0x579913))return console[_0x3cd16e(0x193)](a19_0x22f302[_0x3cd16e(0x192)]('Error:\x20Directory\x20not\x20found:\x20'+_0x579913+'\x0a')),0x1;let _0x3bc508;if(_0x545b53){if(!_0x545b53[_0x3cd16e(0x17b)]('.yml')&&!_0x545b53[_0x3cd16e(0x17b)](_0x3cd16e(0x175)))return console['error'](a19_0x22f302[_0x3cd16e(0x192)](_0x3cd16e(0x15a)+_0x545b53+'\x0a')),0x1;_0x3bc508=[_0x545b53];}else _0x3bc508=findYamlFiles(_0x579913);if(_0x3bc508[_0x3cd16e(0x18c)]===0x0)return console[_0x3cd16e(0x193)](a19_0x22f302[_0x3cd16e(0x192)](_0x3cd16e(0x188)+_0x579913+'\x0a')),0x1;const _0x3f49c8=validateYamlFiles(_0x3bc508,_0x579913,{'filterType':'journey'}),_0x5e8b81=calculateSummary(_0x3f49c8),_0x4d1482=_0x3f49c8[_0x3cd16e(0x17d)](isValidationResult);if(_0x4d1482[_0x3cd16e(0x18c)]===0x0)return console[_0x3cd16e(0x193)](a19_0x22f302['yellow'](_0x3cd16e(0x190)+_0x579913+'\x0a')),_0x5e8b81[_0x3cd16e(0x18b)]>0x0&&console[_0x3cd16e(0x193)](a19_0x22f302[_0x3cd16e(0x173)]('('+_0x5e8b81[_0x3cd16e(0x18b)]+_0x3cd16e(0x15c))),0x0;for(const _0x2f685f of _0x3f49c8){if(!isValidationResult(_0x2f685f)){_0x38488e['verbose']&&console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x173)]('-\x20'+_0x2f685f['relativePath']+_0x3cd16e(0x15d)+_0x2f685f[_0x3cd16e(0x169)]+')'));continue;}const {relativePath:_0x2287fc,source:_0xfb164f,result:_0x1ca601}=_0x2f685f;if(_0x1ca601['valid']&&_0x1ca601[_0x3cd16e(0x18e)]['length']===0x0)_0x38488e[_0x3cd16e(0x191)]&&console[_0x3cd16e(0x163)](a19_0x22f302['green']('✔\x20'+_0x2287fc));else _0x1ca601[_0x3cd16e(0x16c)]?(console[_0x3cd16e(0x163)](a19_0x22f302['yellow']('⚠\x20'+_0x2287fc+':\x20'+_0x1ca601[_0x3cd16e(0x18e)]['length']+_0x3cd16e(0x176))),console['log'](formatValidationResult(_0x1ca601,_0xfb164f,_0x2287fc))):(console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x192)]('✖\x20'+_0x2287fc+':\x20'+_0x1ca601[_0x3cd16e(0x160)][_0x3cd16e(0x18c)]+_0x3cd16e(0x16f))),console[_0x3cd16e(0x163)](formatValidationResult(_0x1ca601,_0xfb164f,_0x2287fc)));}return console[_0x3cd16e(0x163)](''),_0x5e8b81['hasErrors']?(console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x192)](_0x3cd16e(0x171)+_0x5e8b81[_0x3cd16e(0x172)]+_0x3cd16e(0x18f)+_0x5e8b81[_0x3cd16e(0x15b)]+_0x3cd16e(0x182))),_0x5e8b81[_0x3cd16e(0x15f)]>0x0&&console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x16b)](_0x5e8b81['warningCount']+_0x3cd16e(0x16a))),_0x5e8b81[_0x3cd16e(0x18b)]>0x0&&console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x173)](_0x5e8b81[_0x3cd16e(0x18b)]+_0x3cd16e(0x16d))),0x1):(console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x170)](_0x3cd16e(0x186)+_0x5e8b81[_0x3cd16e(0x15b)]+_0x3cd16e(0x158))),_0x5e8b81[_0x3cd16e(0x15f)]>0x0&&console['log'](a19_0x22f302[_0x3cd16e(0x16b)](_0x5e8b81[_0x3cd16e(0x15f)]+_0x3cd16e(0x16a))),_0x5e8b81['skippedCount']>0x0&&console[_0x3cd16e(0x163)](a19_0x22f302[_0x3cd16e(0x173)](_0x5e8b81[_0x3cd16e(0x18b)]+_0x3cd16e(0x16d))),0x0);}}
1
+ const a19_0x3b1649=a19_0x4846;(function(_0x11bcc9,_0x2d5af9){const _0x1c4d18=a19_0x4846,_0x5265f1=_0x11bcc9();while(!![]){try{const _0x3fc84c=parseInt(_0x1c4d18(0x13a))/0x1*(parseInt(_0x1c4d18(0x13d))/0x2)+parseInt(_0x1c4d18(0x12e))/0x3*(-parseInt(_0x1c4d18(0x124))/0x4)+parseInt(_0x1c4d18(0x126))/0x5+parseInt(_0x1c4d18(0x11c))/0x6+parseInt(_0x1c4d18(0x129))/0x7+-parseInt(_0x1c4d18(0x14b))/0x8+parseInt(_0x1c4d18(0x147))/0x9*(-parseInt(_0x1c4d18(0x13c))/0xa);if(_0x3fc84c===_0x2d5af9)break;else _0x5265f1['push'](_0x5265f1['shift']());}catch(_0x4dd6f2){_0x5265f1['push'](_0x5265f1['shift']());}}}(a19_0x1f79,0x76ccc));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_0x31236e from'chalk';function a19_0x1f79(){const _0x5737a8=['errorCode','helpText','name','no_parent','targetDir','endsWith','skippedCount','valid','3537UDRdpD','Validation\x20failed:\x20','errors','message','501304safJSy','.yml','length','cwd','relativePath','validCount','execute','log','369876ervIgJ','Error:\x20Directory\x20not\x20found:\x20','error','yellow','warningCount','verbose','No\x20journey\x20YAML\x20files\x20found\x20in\x20','\x20(skipped:\x20','160dyovfa','\x20warning(s)\x20found','2584790qRnxxO','filePath','journey','5770240QTAyHz','Validate\x20journey\x20YAML\x20files','filter','dim','\x20error(s)','55818OUUAaS','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Error:\x20','green','type','✔\x20All\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','red','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','warnings','description','\x20segment\x20file(s)\x20skipped)','536675lHhCCK','parentSegment','16440wvouKM','2cwCjzE','\x20segment\x20file(s)\x20skipped'];a19_0x1f79=function(){return _0x5737a8;};return a19_0x1f79();}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a19_0x4846(_0xd138b7,_0x2cb9d8){_0xd138b7=_0xd138b7-0x11b;const _0x1f7917=a19_0x1f79();let _0x484652=_0x1f7917[_0xd138b7];return _0x484652;}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x3b1649(0x141)]='journey:validate';[a19_0x3b1649(0x138)]=a19_0x3b1649(0x12a);async[a19_0x3b1649(0x151)](_0x175ebd){const _0x4e62b7=a19_0x3b1649,{options:_0x42ea1f,args:_0x563920}=_0x175ebd,_0x10fe8c=_0x42ea1f,_0x445da0=await resolveTarget({'arg':_0x563920[0x0],'contextParent':_0x42ea1f[_0x4e62b7(0x13b)],'cwd':process[_0x4e62b7(0x14e)]()});if(!isSuccessfulResolution(_0x445da0))return _0x445da0[_0x4e62b7(0x13f)]===_0x4e62b7(0x142)?(console[_0x4e62b7(0x11e)](a19_0x31236e['yellow'](_0x4e62b7(0x12f))),console[_0x4e62b7(0x11e)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console['error']('\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'),console['error'](_0x4e62b7(0x134))):(console['error'](a19_0x31236e[_0x4e62b7(0x135)](_0x4e62b7(0x130)+_0x445da0[_0x4e62b7(0x14a)]+'\x0a')),_0x445da0[_0x4e62b7(0x140)]&&console['error'](a19_0x31236e['cyan'](_0x445da0[_0x4e62b7(0x140)]))),0x1;const _0x35945b=_0x445da0[_0x4e62b7(0x143)],_0x8571f6=_0x445da0[_0x4e62b7(0x132)]==='file'?_0x445da0[_0x4e62b7(0x127)]:undefined;if(!_0x8571f6&&!existsSync(_0x35945b))return console[_0x4e62b7(0x11e)](a19_0x31236e['red'](_0x4e62b7(0x11d)+_0x35945b+'\x0a')),0x1;let _0x35d2fb;if(_0x8571f6){if(!_0x8571f6[_0x4e62b7(0x144)](_0x4e62b7(0x14c))&&!_0x8571f6[_0x4e62b7(0x144)]('.yaml'))return console[_0x4e62b7(0x11e)](a19_0x31236e[_0x4e62b7(0x135)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x8571f6+'\x0a')),0x1;_0x35d2fb=[_0x8571f6];}else _0x35d2fb=findYamlFiles(_0x35945b);if(_0x35d2fb['length']===0x0)return console['error'](a19_0x31236e[_0x4e62b7(0x135)](_0x4e62b7(0x136)+_0x35945b+'\x0a')),0x1;const _0x6448a7=validateYamlFiles(_0x35d2fb,_0x35945b,{'filterType':_0x4e62b7(0x128)}),_0x3967c9=calculateSummary(_0x6448a7),_0x4c801e=_0x6448a7[_0x4e62b7(0x12b)](isValidationResult);if(_0x4c801e[_0x4e62b7(0x14d)]===0x0)return console[_0x4e62b7(0x11e)](a19_0x31236e[_0x4e62b7(0x11f)](_0x4e62b7(0x122)+_0x35945b+'\x0a')),_0x3967c9[_0x4e62b7(0x145)]>0x0&&console[_0x4e62b7(0x11e)](a19_0x31236e[_0x4e62b7(0x12c)]('('+_0x3967c9['skippedCount']+_0x4e62b7(0x139))),0x0;for(const _0x11a272 of _0x6448a7){if(!isValidationResult(_0x11a272)){_0x10fe8c[_0x4e62b7(0x121)]&&console[_0x4e62b7(0x11b)](a19_0x31236e[_0x4e62b7(0x12c)]('-\x20'+_0x11a272[_0x4e62b7(0x14f)]+_0x4e62b7(0x123)+_0x11a272['reason']+')'));continue;}const {relativePath:_0x157610,source:_0xf34533,result:_0x290ecf}=_0x11a272;if(_0x290ecf[_0x4e62b7(0x146)]&&_0x290ecf['warnings'][_0x4e62b7(0x14d)]===0x0)_0x10fe8c[_0x4e62b7(0x121)]&&console[_0x4e62b7(0x11b)](a19_0x31236e[_0x4e62b7(0x131)]('✔\x20'+_0x157610));else _0x290ecf[_0x4e62b7(0x146)]?(console[_0x4e62b7(0x11b)](a19_0x31236e[_0x4e62b7(0x11f)]('⚠\x20'+_0x157610+':\x20'+_0x290ecf[_0x4e62b7(0x137)][_0x4e62b7(0x14d)]+'\x20warning(s)')),console[_0x4e62b7(0x11b)](formatValidationResult(_0x290ecf,_0xf34533,_0x157610))):(console[_0x4e62b7(0x11b)](a19_0x31236e['red']('✖\x20'+_0x157610+':\x20'+_0x290ecf[_0x4e62b7(0x149)][_0x4e62b7(0x14d)]+_0x4e62b7(0x12d))),console[_0x4e62b7(0x11b)](formatValidationResult(_0x290ecf,_0xf34533,_0x157610)));}return console[_0x4e62b7(0x11b)](''),_0x3967c9['hasErrors']?(console[_0x4e62b7(0x11b)](a19_0x31236e['red'](_0x4e62b7(0x148)+_0x3967c9['invalidCount']+'\x20journey(s)\x20with\x20errors,\x20'+_0x3967c9[_0x4e62b7(0x150)]+'\x20valid')),_0x3967c9[_0x4e62b7(0x120)]>0x0&&console[_0x4e62b7(0x11b)](a19_0x31236e['yellow'](_0x3967c9[_0x4e62b7(0x120)]+'\x20warning(s)\x20found')),_0x3967c9[_0x4e62b7(0x145)]>0x0&&console[_0x4e62b7(0x11b)](a19_0x31236e[_0x4e62b7(0x12c)](_0x3967c9[_0x4e62b7(0x145)]+_0x4e62b7(0x13e))),0x1):(console[_0x4e62b7(0x11b)](a19_0x31236e[_0x4e62b7(0x131)](_0x4e62b7(0x133)+_0x3967c9[_0x4e62b7(0x150)]+'\x20journey(s)\x20valid')),_0x3967c9[_0x4e62b7(0x120)]>0x0&&console[_0x4e62b7(0x11b)](a19_0x31236e[_0x4e62b7(0x11f)](_0x3967c9[_0x4e62b7(0x120)]+_0x4e62b7(0x125))),_0x3967c9['skippedCount']>0x0&&console['log'](a19_0x31236e[_0x4e62b7(0x12c)](_0x3967c9[_0x4e62b7(0x145)]+'\x20segment\x20file(s)\x20skipped')),0x0);}}
@@ -1 +1 @@
1
- const a20_0x59b182=a20_0x241c;(function(_0x564f62,_0x1a7a06){const _0x154d47=a20_0x241c,_0x1458e6=_0x564f62();while(!![]){try{const _0xb4f781=-parseInt(_0x154d47(0x1da))/0x1+parseInt(_0x154d47(0x1e6))/0x2+-parseInt(_0x154d47(0x229))/0x3*(-parseInt(_0x154d47(0x1e2))/0x4)+-parseInt(_0x154d47(0x24a))/0x5*(-parseInt(_0x154d47(0x20e))/0x6)+parseInt(_0x154d47(0x211))/0x7+parseInt(_0x154d47(0x246))/0x8*(-parseInt(_0x154d47(0x24b))/0x9)+parseInt(_0x154d47(0x280))/0xa;if(_0xb4f781===_0x1a7a06)break;else _0x1458e6['push'](_0x1458e6['shift']());}catch(_0x335c94){_0x1458e6['push'](_0x1458e6['shift']());}}}(a20_0x38ba,0x533a2));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_0x13d2d2 from'node:fs';function handleSDKError(_0x3dd316,_0x509a36){const _0xd713aa=a20_0x241c;if(_0x3dd316 instanceof SDKError)console[_0xd713aa(0x28a)](_0xd713aa(0x265)+_0x3dd316[_0xd713aa(0x28c)]),_0x509a36[_0xd713aa(0x235)]&&(_0x3dd316[_0xd713aa(0x26f)]&&console[_0xd713aa(0x28a)](_0xd713aa(0x251)+_0x3dd316[_0xd713aa(0x26f)]),_0x3dd316[_0xd713aa(0x1ec)]&&(console[_0xd713aa(0x28a)](_0xd713aa(0x22a)),console[_0xd713aa(0x28a)](_0x3dd316[_0xd713aa(0x1ec)])));else throw _0x3dd316;}function formatChatHistoryEntry(_0x314590,_0x5915e7){const _0x3f3024=a20_0x241c,_0x25a1dc=getChalk(_0x5915e7),_0x2e4911=_0x25a1dc[_0x3f3024(0x28b)](_0x314590['at']);if('input'in _0x314590){const _0x3938dd=_0x25a1dc[_0x3f3024(0x220)](_0x3f3024(0x21f));return _0x2e4911+'\x20'+_0x3938dd+':\x20'+_0x314590[_0x3f3024(0x263)];}if(_0x3f3024(0x1fa)in _0x314590){const _0xe97b8a=_0x25a1dc[_0x3f3024(0x267)](_0x3f3024(0x1d4));return _0x2e4911+'\x20'+_0xe97b8a+':\x20'+_0x314590[_0x3f3024(0x1fa)];}if('tool_call'in _0x314590){const _0xc7e074=_0x25a1dc[_0x3f3024(0x237)]('[tool_call]'),{functionName:_0x573d5e,functionArguments:_0x5e5541,targetFunction:_0x2c1946}=_0x314590['tool_call'];let _0x9a3b8=_0x2e4911+'\x20'+_0xc7e074+':\x20'+_0x25a1dc['bold'](_0x573d5e);if(_0x5e5541&&Object[_0x3f3024(0x24f)](_0x5e5541)[_0x3f3024(0x200)]>0x0){const _0x359fb4=Object[_0x3f3024(0x27e)](_0x5e5541)[_0x3f3024(0x1d5)](([_0x2e20e3,_0x4622a0])=>_0x2e20e3+'='+JSON[_0x3f3024(0x201)](_0x4622a0))[_0x3f3024(0x217)](',\x20');_0x9a3b8+='('+_0x359fb4+')';}_0x2c1946&&(_0x9a3b8+=_0x25a1dc[_0x3f3024(0x28b)]('\x20['+_0x2c1946+']'));let _0x10542f='';if(_0x314590[_0x3f3024(0x25f)][_0x3f3024(0x20c)])_0x10542f='\x20->\x20KB:'+_0x314590[_0x3f3024(0x25f)][_0x3f3024(0x20c)][_0x3f3024(0x230)];else{if(_0x314590[_0x3f3024(0x25f)][_0x3f3024(0x1ce)])_0x10542f=_0x3f3024(0x2a1)+_0x314590[_0x3f3024(0x25f)][_0x3f3024(0x1ce)][_0x3f3024(0x230)];else{if(_0x314590[_0x3f3024(0x25f)]['targetWebSearchTool'])_0x10542f='\x20->\x20WebSearch:'+_0x314590['tool_call'][_0x3f3024(0x205)][_0x3f3024(0x230)];else _0x314590[_0x3f3024(0x25f)]['targetImageGenerator']&&(_0x10542f='\x20->\x20ImageGen:'+_0x314590[_0x3f3024(0x25f)]['targetImageGenerator'][_0x3f3024(0x230)]);}}return _0x9a3b8+_0x10542f;}if(_0x3f3024(0x264)in _0x314590){const _0x39a6f5=_0x25a1dc[_0x3f3024(0x202)]('[tool]\x20\x20\x20'),{functionName:_0x2d0bac,functionArguments:_0xa23545,content:_0x1fc37a,newChat:_0x553800}=_0x314590[_0x3f3024(0x264)];let _0x26e587=_0x2e4911+'\x20'+_0x39a6f5+':\x20'+_0x25a1dc[_0x3f3024(0x27f)](_0x2d0bac);if(_0xa23545){const _0x136edc=typeof _0xa23545===_0x3f3024(0x23a)?_0xa23545:JSON['stringify'](_0xa23545);_0x26e587+='('+_0x136edc+')';}return _0x1fc37a&&(_0x26e587+='\x0a'+_0x25a1dc[_0x3f3024(0x28b)](_0x1fc37a)),_0x553800&&(_0x26e587+=_0x25a1dc['dim'](_0x3f3024(0x279)+_0x553800['id'])),_0x26e587;}if(_0x3f3024(0x25b)in _0x314590){const _0x770c8b=_0x25a1dc[_0x3f3024(0x25d)](_0x3f3024(0x29b));return _0x2e4911+'\x20'+_0x770c8b+':\x20'+_0x314590[_0x3f3024(0x25b)][_0x3f3024(0x230)]+'\x20('+_0x314590[_0x3f3024(0x25b)][_0x3f3024(0x1fa)][_0x3f3024(0x200)]+_0x3f3024(0x1e4);}if(_0x3f3024(0x212)in _0x314590){const _0x56c50b=_0x25a1dc[_0x3f3024(0x25d)](_0x3f3024(0x285)),{width:_0x5afcb9,height:_0x1d9a78,headerText:_0x12f314}=_0x314590[_0x3f3024(0x212)],_0x3167f6=_0x12f314?_0x3f3024(0x250)+_0x12f314:'';return _0x2e4911+'\x20'+_0x56c50b+':\x20'+_0x5afcb9+'x'+_0x1d9a78+_0x3167f6;}if('error'in _0x314590){const _0x2259b8=_0x25a1dc[_0x3f3024(0x1c5)](_0x3f3024(0x23e));return _0x2e4911+'\x20'+_0x2259b8+':\x20'+_0x314590[_0x3f3024(0x28a)];}return _0x2e4911+'\x20'+_0x25a1dc['dim'](_0x3f3024(0x1c8))+':\x20'+JSON[_0x3f3024(0x201)](_0x314590);}function a20_0x38ba(){const _0x5b3514=['format','Backup\x20cancelled.','yes','targetKnowledgeBase','knowledgeBases','30642OHOQhS','attributes','getTime','1960035RnSMsT','image','backupProject','\x20\x20Integrations:\x20','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','select','join','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Project\x20not\x20found:\x20','toLowerCase','agent','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','Validating\x20backup\x20from\x20\x27','Project\x20context\x20set\x20to:\x20','[input]\x20\x20','cyan','agentId','filter','llm:use','substring','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Setting\x20project\x20context\x20to\x20\x27','prompts','llm:history','939WXJoJv','\x0aStack\x20trace:','exportedFrom','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','\x20\x20Prompts:\x20','Delete\x20an\x20LLM\x20project','\x20\x20Agents:\x20','name','projects','Fetching\x20available\x20models...','\x20\x20\x20Examples:','outputDir','verbose','log','yellow','Unknown','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','string','Error:\x20Project\x20name\x20is\x20required','existsSync','LLM_PROJECT_NOT_FOUND','[error]\x20\x20','m\x20ago','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','split','find','Show\x20agent\x20details','llm:project:delete','No\x20chat\x20sessions\x20found.','16BYglDY','List\x20agents\x20in\x20current\x20project','limit','resolveProjectId','155UHgugc','2404089ELqHYC','\x27...','Deleting\x20agent...','Select\x20a\x20chat\x20session:','keys','\x20-\x20','\x20\x20Cause:\x20','List\x20all\x20LLM\x20projects','Resolving\x20project\x20\x27','includes','\x0aCancelled','llm','updateAgent','rmSync','🤖\x20','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','output','llm:project:backup','blue','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','tool_call','numeric','Project\x20backed\x20up\x20to:\x20','floor','input','tool','Error:\x20','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','green','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Creating\x20agent\x20\x27','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','tdx\x20llm\x20history','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','firstInputContent','slice','cause','Fetching\x20chat\x20history\x20for\x20\x27','just\x20now','(no\x20message)','Agent\x20created:\x20','temperature','Use\x20format:\x20project-name/agent-name','projectName','Delete\x20an\x20agent','setCurrentProject','\x20→\x20chat:\x20','getOrCreateDefaultProject','h\x20ago','createdAt','Fetching\x20chat\x20sessions...','entries','bold','3898880nhZsAI','\x20agent(s)','Resolving\x20agent\x20\x27','execute','chatId','[image]\x20\x20','localeCompare','getCurrentProject','deleteAgent','sourceSite','error','dim','message','llm:agent:show','No\x20agents\x20found','\x20\x20Knowledge\x20Bases:\x20','No\x20messages\x20found\x20in\x20chat\x20history.','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','toLocaleDateString','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','Error:\x20Backup\x20folder\x20path\x20is\x20required','last','⚒️\x20','Fetching\x20agent...','integrations','__load_more__','[output]\x20','llm:agent:create','push','Fetching\x20agents...','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','models','\x20->\x20Agent:','set','red','site','tdx\x20chats','[unknown]','llm:agent:update','chats','\x20project(s)','...','starterMessage','targetAgent','en-US','table','counts','agents','Creating\x20project\x20\x27','[content]','map','dryRun','jsonl','llm:project:create','Deleting\x20project\x20\x27','545005byVrrb','llm:projects','data','Project\x20restored:\x20','deleteProject','Project\x20created:\x20','description','all','5728UaSIzz','Project\x20deleted:\x20','\x20bytes)','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','287438MLxlpT','Update\x20an\x20existing\x20agent','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','default','Fetching\x20projects...','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','stack','llm:project:restore','Create\x20a\x20new\x20LLM\x20project','claude-4.5-haiku','Error:\x20Agent\x20name\x20is\x20required','Set\x20current\x20project\x20context','Output\x20directory\x20\x27','resolveAgentId','sort','createAgent','history','Getting\x20default\x20project...','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','content','INVALID_ARGUMENT','tsv','json','Create\x20a\x20new\x20agent\x20in\x20current\x20project','model','length','stringify','magenta','(no\x20agent)','Invalid\x20path\x20syntax:\x20','targetWebSearchTool','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','updatedAt'];a20_0x38ba=function(){return _0x5b3514;};return a20_0x38ba();}async function executeChatHistoryCommand(_0x25f1d0,_0x5cf8ae){const _0x595541=a20_0x241c,{options:_0x28289f,args:_0x1a7964,tdx:_0xf523b0}=_0x25f1d0,_0x3ea475=_0x1a7964[0x0],_0x547a43=_0x28289f,_0x34293a=_0x547a43[_0x595541(0x296)];try{if(_0x34293a&&_0x3ea475)return console['error'](_0x595541(0x1e8)),console[_0x595541(0x28a)]('Usage:\x20'+_0x5cf8ae+'\x20--last'),0x1;if(!_0x3ea475&&!_0x34293a&&_0x28289f[_0x595541(0x209)]!==undefined){const _0xd1e98a=resolveLimit(_0x28289f[_0x595541(0x248)],DEFAULT_LLM_LIMIT),_0x20b8a9=await withSpinner(_0x595541(0x27d),()=>_0xf523b0[_0x595541(0x256)][_0x595541(0x1ca)](_0xd1e98a),{'verbose':_0x28289f[_0x595541(0x235)]});return await handleSDKOutput(_0x20b8a9[_0x595541(0x1dc)],_0x28289f),0x0;}const _0x2f762a=await getChatIdOrSelect(_0xf523b0,_0x28289f,_0x34293a,_0x3ea475);if(!_0x2f762a)return 0x0;return await displayChatHistory(_0x2f762a,_0xf523b0,_0x28289f),0x0;}catch(_0x571082){return handleSDKError(_0x571082,_0x28289f),0x1;}}async function displayChatHistory(_0x3337bd,_0x597ce3,_0x5e8deb){const _0x4dacf4=a20_0x241c,_0x11a4c3=await withSpinner(_0x4dacf4(0x270)+_0x3337bd+_0x4dacf4(0x24c),()=>_0x597ce3[_0x4dacf4(0x256)][_0x4dacf4(0x1f6)](_0x3337bd),{'verbose':_0x5e8deb[_0x4dacf4(0x235)]}),_0x212207=_0x11a4c3[_0x4dacf4(0x1dc)][_0x4dacf4(0x1dc)]??[];if(_0x212207[_0x4dacf4(0x200)]===0x0){console['log'](_0x4dacf4(0x290));return;}if(_0x5e8deb[_0x4dacf4(0x209)]!==undefined)await handleSDKOutput(_0x212207,_0x5e8deb);else{const _0x471f66=_0x212207['map'](_0x5ed7ac=>formatChatHistoryEntry(_0x5ed7ac,_0x5e8deb)),_0x21d4ce=_0x471f66[_0x4dacf4(0x217)]('\x0a');await writeOutput(_0x21d4ce,_0x5e8deb[_0x4dacf4(0x25b)],'table');}}async function getChatIdOrSelect(_0x3ac7aa,_0xa7da6a,_0x176b76,_0x6fcb42){const _0x26bfe2=a20_0x241c;if(_0x6fcb42)return _0x6fcb42;if(_0x176b76){const _0x4ecd9e=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x3ac7aa[_0x26bfe2(0x256)][_0x26bfe2(0x1ca)](0x1),{'verbose':_0xa7da6a[_0x26bfe2(0x235)]});if(_0x4ecd9e['data'][_0x26bfe2(0x200)]===0x0)return console[_0x26bfe2(0x236)](_0x26bfe2(0x245)),undefined;return _0x4ecd9e['data'][0x0]['id'];}const _0x2fde2f=await selectChatInteractively(_0x3ac7aa,_0xa7da6a);if(!_0x2fde2f)return console[_0x26bfe2(0x236)](_0x26bfe2(0x255)),undefined;return _0x2fde2f;}async function getProjectIdOrDefault(_0x12fcb7){const _0x1b7522=await getProjectWithName(_0x12fcb7);return _0x1b7522['id'];}async function getProjectWithName(_0x398a8e){const _0x245eda=a20_0x241c,{tdx:_0x20d68c,options:_0x2ffb2b}=_0x398a8e,_0x3a1430=_0x2ffb2b['llmProject'];if(_0x3a1430){const _0x4c5bf9=await withSpinner(_0x245eda(0x253)+_0x3a1430+_0x245eda(0x24c),()=>_0x20d68c[_0x245eda(0x256)]['resolveProjectId'](_0x3a1430),{'verbose':_0x2ffb2b[_0x245eda(0x235)]});return{'id':_0x4c5bf9[_0x245eda(0x1dc)],'name':_0x3a1430};}const _0x1d4f1e=_0x20d68c[_0x245eda(0x256)][_0x245eda(0x287)]();if(_0x1d4f1e){const _0x3b516f=await _0x20d68c[_0x245eda(0x256)][_0x245eda(0x231)](),_0x3cf9fe=_0x3b516f[_0x245eda(0x242)](_0x452806=>_0x452806['id']===_0x1d4f1e);return{'id':_0x1d4f1e,'name':_0x3cf9fe?.[_0x245eda(0x20f)][_0x245eda(0x230)]||_0x245eda(0x238)};}const _0x333d39=await withSpinner(_0x245eda(0x1f7),()=>_0x20d68c[_0x245eda(0x256)][_0x245eda(0x27a)](),{'verbose':_0x2ffb2b['verbose']});return{'id':_0x333d39[_0x245eda(0x1dc)]['id'],'name':_0x333d39[_0x245eda(0x1dc)][_0x245eda(0x20f)][_0x245eda(0x230)]};}function toLLMProjectInfo(_0x432ab8){const _0x1dbbde=a20_0x241c;return{'name':_0x432ab8[_0x1dbbde(0x20f)][_0x1dbbde(0x230)],'description':_0x432ab8[_0x1dbbde(0x20f)][_0x1dbbde(0x1e0)],'createdAt':_0x432ab8[_0x1dbbde(0x20f)][_0x1dbbde(0x27c)],'updatedAt':_0x432ab8[_0x1dbbde(0x20f)]['updatedAt']};}function toAgentInfo(_0x3c4322){const _0x2a3427=a20_0x241c;return{'name':_0x3c4322[_0x2a3427(0x20f)][_0x2a3427(0x230)],'description':_0x3c4322[_0x2a3427(0x20f)]['description'],'prompt':truncatePrompt(_0x3c4322[_0x2a3427(0x20f)]['prompt']),'createdAt':_0x3c4322['attributes']['createdAt'],'updatedAt':_0x3c4322[_0x2a3427(0x20f)][_0x2a3427(0x208)]};}function a20_0x241c(_0x5b2a9d,_0x18a1e1){_0x5b2a9d=_0x5b2a9d-0x1c5;const _0x38ba58=a20_0x38ba();let _0x241cbc=_0x38ba58[_0x5b2a9d];return _0x241cbc;}function truncatePrompt(_0x395bf0){const _0x494d01=a20_0x241c;if(!_0x395bf0)return undefined;const _0x4cd9f0=0x64;if(_0x395bf0['length']<=_0x4cd9f0)return _0x395bf0;return _0x395bf0[_0x494d01(0x26e)](0x0,_0x4cd9f0)+_0x494d01(0x1cc);}export class LLMModelsCommand extends BaseCommand{['name']='llm:models';[a20_0x59b182(0x1e0)]='List\x20available\x20LLM\x20models';async['execute'](_0x3c3251){const _0x2551ad=a20_0x59b182,{options:_0x2b0d90,tdx:_0x322baf}=_0x3c3251;try{const _0x22c659=await withSpinner(_0x2551ad(0x232),()=>_0x322baf[_0x2551ad(0x256)][_0x2551ad(0x2a0)](),{'verbose':_0x2b0d90[_0x2551ad(0x235)]});return await handleSDKOutput(_0x22c659['data'],_0x2b0d90),0x0;}catch(_0x245ab3){return handleSDKError(_0x245ab3,_0x2b0d90),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x1db);[a20_0x59b182(0x1e0)]=a20_0x59b182(0x252);async['execute'](_0x474484){const _0x23ff05=a20_0x59b182,{options:_0x10caef,args:_0x3c7169,tdx:_0x99f995}=_0x474484,_0xa7a329=getChalk(_0x10caef),_0x527649=_0x10caef['site'];try{const _0x283107=_0x3c7169[0x0],_0x70738d=resolveLimit(_0x10caef[_0x23ff05(0x248)],DEFAULT_LLM_LIMIT),_0x570666=await withSpinner(_0x23ff05(0x1ea),()=>_0x99f995[_0x23ff05(0x256)][_0x23ff05(0x231)](_0x70738d),{'verbose':_0x10caef['verbose']});let _0x29d745=_0x570666[_0x23ff05(0x1dc)];_0x283107&&(_0x29d745=_0x570666[_0x23ff05(0x1dc)][_0x23ff05(0x222)](_0x135b36=>matchGlobPattern(_0x135b36['attributes'][_0x23ff05(0x230)],_0x283107)));const _0x450b66=_0x10caef['format']===_0x23ff05(0x1fd)||_0x10caef[_0x23ff05(0x209)]===_0x23ff05(0x1d7)||_0x10caef[_0x23ff05(0x209)]==='table'||_0x10caef[_0x23ff05(0x209)]===_0x23ff05(0x1fc);if(_0x450b66){const _0x1ded00=_0x29d745['map'](_0x4e50c4=>({...toLLMProjectInfo(_0x4e50c4),'url':getLLMProjectUrl(_0x527649,_0x4e50c4['id'])}));await handleSDKOutput(_0x1ded00,_0x10caef);}else{const _0x2b0345=[];if(_0x29d745[_0x23ff05(0x200)]===0x0)_0x2b0345[_0x23ff05(0x29d)](_0xa7a329[_0x23ff05(0x28b)]('No\x20projects\x20found'));else{const _0x425701=[..._0x29d745][_0x23ff05(0x1f4)]((_0x50b249,_0x3e1cf0)=>_0x50b249['attributes'][_0x23ff05(0x230)][_0x23ff05(0x286)](_0x3e1cf0[_0x23ff05(0x20f)][_0x23ff05(0x230)]));for(const _0x130b03 of _0x425701){const _0x1d68d7=getLLMProjectUrl(_0x527649,_0x130b03['id']),_0x5195d5=hyperlink(_0x130b03[_0x23ff05(0x20f)][_0x23ff05(0x230)],_0x1d68d7);_0x2b0345[_0x23ff05(0x29d)](_0x23ff05(0x297)+_0x5195d5);}_0x2b0345[_0x23ff05(0x29d)](_0xa7a329[_0x23ff05(0x28b)](_0x29d745['length']+_0x23ff05(0x1cb)));}await writeOutput(_0x2b0345[_0x23ff05(0x217)]('\x0a'),_0x10caef[_0x23ff05(0x25b)],_0x23ff05(0x1d0));}return 0x0;}catch(_0x387f43){return handleSDKError(_0x387f43,_0x10caef),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x59b182(0x230)]='llm:agents';[a20_0x59b182(0x1e0)]=a20_0x59b182(0x247);async[a20_0x59b182(0x283)](_0x37dc6b){const _0xa9af9d=a20_0x59b182,{options:_0x34037c,args:_0x2d664d,tdx:_0x30d0df}=_0x37dc6b,_0x4b76a0=getChalk(_0x34037c),_0x519038=_0x34037c[_0xa9af9d(0x1c6)];try{const _0x46f0de=_0x2d664d[0x0];let _0xf163a3=_0x46f0de,_0xdfa164,_0x3b9cec;if(_0x46f0de&&_0x46f0de['includes']('/')){const _0x20d059=_0x46f0de[_0xa9af9d(0x241)]('/');if(_0x20d059[_0xa9af9d(0x200)]===0x2){const [_0x2af07e,_0x556dbd]=_0x20d059,_0x4da61f=await _0x30d0df['llm'][_0xa9af9d(0x231)](),_0xc0d4e=_0x4da61f[_0xa9af9d(0x242)](_0x117402=>_0x117402[_0xa9af9d(0x20f)]['name'][_0xa9af9d(0x21a)]()===_0x2af07e[_0xa9af9d(0x21a)]());if(!_0xc0d4e)throw new SDKError(ErrorCode[_0xa9af9d(0x23d)],_0xa9af9d(0x219)+_0x2af07e,undefined,{'helpText':_0xa9af9d(0x218)});_0xdfa164=_0xc0d4e['id'],_0x3b9cec=_0xc0d4e[_0xa9af9d(0x20f)][_0xa9af9d(0x230)],_0xf163a3=_0x556dbd;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xa9af9d(0x204)+_0x46f0de,undefined,{'helpText':_0xa9af9d(0x275)});}else{const _0x255914=await getProjectWithName(_0x37dc6b);_0xdfa164=_0x255914['id'],_0x3b9cec=_0x255914[_0xa9af9d(0x230)];}const _0x313b1b=await withSpinner(_0xa9af9d(0x29e),()=>_0x30d0df[_0xa9af9d(0x256)][_0xa9af9d(0x1d2)](_0xdfa164),{'verbose':_0x34037c[_0xa9af9d(0x235)]});let _0x47a8ea=_0x313b1b[_0xa9af9d(0x1dc)];_0xf163a3&&(_0x47a8ea=_0x313b1b[_0xa9af9d(0x1dc)]['filter'](_0x5a9410=>matchGlobPattern(_0x5a9410[_0xa9af9d(0x20f)][_0xa9af9d(0x230)],_0xf163a3)));const _0x4f50bd=_0x34037c['format']===_0xa9af9d(0x1fd)||_0x34037c[_0xa9af9d(0x209)]==='jsonl'||_0x34037c[_0xa9af9d(0x209)]===_0xa9af9d(0x1d0)||_0x34037c['format']===_0xa9af9d(0x1fc);if(_0x4f50bd){const _0x228ab3=_0x47a8ea[_0xa9af9d(0x1d5)](_0x456d7e=>({...toAgentInfo(_0x456d7e),'chatUrl':getLLMAgentChatUrl(_0x519038,_0xdfa164,_0x456d7e['id'])}));await handleSDKOutput(_0x228ab3,_0x34037c);}else{const _0x5206b8=[];_0x5206b8[_0xa9af9d(0x29d)](_0x4b76a0['dim']('['+_0x3b9cec+']'));if(_0x47a8ea[_0xa9af9d(0x200)]===0x0)_0x5206b8[_0xa9af9d(0x29d)](_0x4b76a0['dim'](_0xa9af9d(0x28e)));else{const _0x35733f=[..._0x47a8ea][_0xa9af9d(0x1f4)]((_0x2d4070,_0xdef3d2)=>_0x2d4070['attributes'][_0xa9af9d(0x230)][_0xa9af9d(0x286)](_0xdef3d2[_0xa9af9d(0x20f)][_0xa9af9d(0x230)]));for(const _0x42497d of _0x35733f){const _0x324085=getLLMAgentChatUrl(_0x519038,_0xdfa164,_0x42497d['id']),_0x3d1485=hyperlink(_0x42497d[_0xa9af9d(0x20f)][_0xa9af9d(0x230)],_0x324085);_0x5206b8[_0xa9af9d(0x29d)](_0xa9af9d(0x259)+_0x3d1485);}_0x5206b8['push'](_0x4b76a0[_0xa9af9d(0x28b)](_0x47a8ea['length']+_0xa9af9d(0x281)));}await writeOutput(_0x5206b8['join']('\x0a'),_0x34037c[_0xa9af9d(0x25b)],_0xa9af9d(0x1d0));}return 0x0;}catch(_0x59e137){return handleSDKError(_0x59e137,_0x34037c),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a20_0x59b182(0x28d);[a20_0x59b182(0x1e0)]=a20_0x59b182(0x243);async[a20_0x59b182(0x283)](_0x249adf){const _0x147a09=a20_0x59b182,{options:_0x60f939,args:_0x24d2c0,tdx:_0x598b29}=_0x249adf;if(_0x24d2c0[_0x147a09(0x200)]===0x0)return console['error'](_0x147a09(0x1f0)),console[_0x147a09(0x28a)](_0x147a09(0x207)),0x1;const _0x35929f=_0x24d2c0[0x0];try{const _0x43842f=await getProjectIdOrDefault(_0x249adf),_0xc81e2c=await withSpinner(_0x147a09(0x282)+_0x35929f+_0x147a09(0x24c),()=>_0x598b29['llm'][_0x147a09(0x1f3)](_0x35929f,_0x43842f),{'verbose':_0x60f939['verbose']}),_0x2ca8a9=await withSpinner(_0x147a09(0x298),()=>_0x598b29['llm'][_0x147a09(0x21b)](_0xc81e2c['data']),{'verbose':_0x60f939[_0x147a09(0x235)]});return await handleSDKOutput([_0x2ca8a9[_0x147a09(0x1dc)]],_0x60f939),0x0;}catch(_0x5968ea){return handleSDKError(_0x5968ea,_0x60f939),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x29c);[a20_0x59b182(0x1e0)]=a20_0x59b182(0x1fe);async['execute'](_0x22edc3){const _0x3ba4ae=a20_0x59b182,{options:_0x516b4e,args:_0x411689,tdx:_0x1e9b09}=_0x22edc3;if(_0x411689[_0x3ba4ae(0x200)]===0x0)return console[_0x3ba4ae(0x28a)](_0x3ba4ae(0x1f0)),console[_0x3ba4ae(0x28a)](_0x3ba4ae(0x225)),console['error'](_0x3ba4ae(0x293)),0x1;const _0x18e200=_0x411689[0x0],_0x40a76c=_0x516b4e,_0x9ba508=_0x40a76c['systemPrompt'],_0x5d6681=_0x40a76c[_0x3ba4ae(0x1ff)]||_0x3ba4ae(0x1ef),_0x40e2e0=_0x40a76c[_0x3ba4ae(0x1cd)],_0xe823c2=_0x40a76c['maxToolIterations']?Number(_0x40a76c['maxToolIterations']):undefined,_0x3c65c2=_0x40a76c[_0x3ba4ae(0x274)]?Number(_0x40a76c[_0x3ba4ae(0x274)]):undefined;try{let _0x212886,_0x391727;if(_0x18e200[_0x3ba4ae(0x254)]('/')){const _0x10bbd6=_0x18e200[_0x3ba4ae(0x241)]('/');if(_0x10bbd6[_0x3ba4ae(0x200)]===0x2){const [_0x317897,_0x403c6f]=_0x10bbd6,_0x2010f4=await withSpinner(_0x3ba4ae(0x253)+_0x317897+'\x27...',()=>_0x1e9b09[_0x3ba4ae(0x256)][_0x3ba4ae(0x249)](_0x317897),{'verbose':_0x516b4e[_0x3ba4ae(0x235)]});_0x212886=_0x2010f4[_0x3ba4ae(0x1dc)],_0x391727=_0x403c6f;}else throw new SDKError(ErrorCode[_0x3ba4ae(0x1fb)],_0x3ba4ae(0x204)+_0x18e200,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x212886=await getProjectIdOrDefault(_0x22edc3),_0x391727=_0x18e200;const _0x53c8b9=await withSpinner(_0x3ba4ae(0x269)+_0x391727+_0x3ba4ae(0x24c),()=>_0x1e9b09[_0x3ba4ae(0x256)][_0x3ba4ae(0x1f5)]({'name':_0x391727,'projectId':_0x212886,'modelType':_0x5d6681,'systemPrompt':_0x9ba508,'starterMessage':_0x40e2e0,'maxToolIterations':_0xe823c2,'temperature':_0x3c65c2}),{'verbose':_0x516b4e[_0x3ba4ae(0x235)]});return console['log'](_0x3ba4ae(0x273)+_0x53c8b9['data']['id']),await handleSDKOutput([_0x53c8b9[_0x3ba4ae(0x1dc)]],_0x516b4e),0x0;}catch(_0x26f60f){return handleSDKError(_0x26f60f,_0x516b4e),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x1c9);['description']=a20_0x59b182(0x1e7);async[a20_0x59b182(0x283)](_0xbdf5e9){const _0x50efd8=a20_0x59b182,{options:_0x526e04,args:_0x227c8d,tdx:_0x1e9afe}=_0xbdf5e9;if(_0x227c8d[_0x50efd8(0x200)]===0x0)return console['error'](_0x50efd8(0x1f0)),console[_0x50efd8(0x28a)](_0x50efd8(0x240)),0x1;const _0x31fea3=_0x227c8d[0x0],_0x356815=_0x526e04,_0x5a463c=_0x356815[_0x50efd8(0x230)],_0x42dd08=_0x356815['prompt'],_0x5b8ea0=_0x356815['description'],_0x5706b1=_0x356815[_0x50efd8(0x1cd)];if(!_0x5a463c&&!_0x42dd08&&!_0x5b8ea0&&!_0x5706b1)return console[_0x50efd8(0x28a)](_0x50efd8(0x215)),console[_0x50efd8(0x28a)](_0x50efd8(0x1eb)),0x1;try{const _0x337304=await getProjectIdOrDefault(_0xbdf5e9),_0x4d5bd7=await withSpinner(_0x50efd8(0x282)+_0x31fea3+_0x50efd8(0x24c),()=>_0x1e9afe[_0x50efd8(0x256)][_0x50efd8(0x1f3)](_0x31fea3,_0x337304),{'verbose':_0x526e04['verbose']}),_0x1f232b=_0x4d5bd7[_0x50efd8(0x1dc)],_0x261d53=await withSpinner('Updating\x20agent...',()=>_0x1e9afe[_0x50efd8(0x256)][_0x50efd8(0x257)](_0x1f232b,{'name':_0x5a463c,'prompt':_0x42dd08,'description':_0x5b8ea0,'starterMessage':_0x5706b1}),{'verbose':_0x526e04[_0x50efd8(0x235)]});return console[_0x50efd8(0x236)]('Agent\x20updated:\x20'+_0x261d53[_0x50efd8(0x1dc)]['id']),await handleSDKOutput([_0x261d53[_0x50efd8(0x1dc)]],_0x526e04),0x0;}catch(_0xb4f6ac){return handleSDKError(_0xb4f6ac,_0x526e04),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']='llm:agent:delete';[a20_0x59b182(0x1e0)]=a20_0x59b182(0x277);async['execute'](_0x457a92){const _0x40d2d8=a20_0x59b182,{options:_0x30a717,args:_0x3fcfeb,tdx:_0x595fcc}=_0x457a92;if(_0x3fcfeb[_0x40d2d8(0x200)]===0x0)return console[_0x40d2d8(0x28a)](_0x40d2d8(0x1f0)),console['error'](_0x40d2d8(0x22c)),0x1;const _0x45fdcd=_0x3fcfeb[0x0];try{const _0xfc9037=await getProjectIdOrDefault(_0x457a92),_0x468fc0=await withSpinner(_0x40d2d8(0x282)+_0x45fdcd+_0x40d2d8(0x24c),()=>_0x595fcc['llm'][_0x40d2d8(0x1f3)](_0x45fdcd,_0xfc9037),{'verbose':_0x30a717[_0x40d2d8(0x235)]}),_0x77f499=_0x468fc0[_0x40d2d8(0x1dc)];return await withSpinner(_0x40d2d8(0x24d),()=>_0x595fcc[_0x40d2d8(0x256)][_0x40d2d8(0x288)](_0x77f499),{'verbose':_0x30a717[_0x40d2d8(0x235)]}),console['log']('Agent\x20deleted:\x20'+_0x77f499),0x0;}catch(_0x994a56){return handleSDKError(_0x994a56,_0x30a717),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x228);[a20_0x59b182(0x1e0)]=a20_0x59b182(0x268);async[a20_0x59b182(0x283)](_0x32acc3){const _0x4a28ec=a20_0x59b182;return executeChatHistoryCommand(_0x32acc3,_0x4a28ec(0x26b));}}export class LLMUseCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x223);['description']=a20_0x59b182(0x1f1);async['execute'](_0x556cae){const _0x4f8be5=a20_0x59b182,{options:_0x2e83d0,args:_0x45b1c6,tdx:_0x27f1e4}=_0x556cae;if(_0x45b1c6[_0x4f8be5(0x200)]===0x0)return console[_0x4f8be5(0x28a)](_0x4f8be5(0x23b)),console[_0x4f8be5(0x28a)](_0x4f8be5(0x206)),0x1;const _0x46474c=_0x45b1c6[0x0];try{return await withSpinner(_0x4f8be5(0x226)+_0x46474c+'\x27...',()=>_0x27f1e4[_0x4f8be5(0x256)][_0x4f8be5(0x278)](_0x46474c),{'verbose':_0x2e83d0['verbose']}),console[_0x4f8be5(0x236)](_0x4f8be5(0x21e)+_0x46474c),0x0;}catch(_0x50c2b3){return handleSDKError(_0x50c2b3,_0x2e83d0),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x1d8);['description']=a20_0x59b182(0x1ee);async[a20_0x59b182(0x283)](_0x29e9f8){const _0x1ff67c=a20_0x59b182,{options:_0x47efda,args:_0x302ceb,tdx:_0x2d62be}=_0x29e9f8;if(_0x302ceb[_0x1ff67c(0x200)]===0x0)return console[_0x1ff67c(0x28a)](_0x1ff67c(0x23b)),console['error']('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x5b38f4=_0x302ceb[0x0],_0x5620e4=_0x47efda,_0x5873b5=_0x5620e4['description'];try{const _0x2fb2a3=await withSpinner(_0x1ff67c(0x1d3)+_0x5b38f4+_0x1ff67c(0x24c),()=>_0x2d62be[_0x1ff67c(0x256)]['createProject']({'name':_0x5b38f4,'description':_0x5873b5}),{'verbose':_0x47efda[_0x1ff67c(0x235)]});console['log'](_0x1ff67c(0x1df)+_0x2fb2a3[_0x1ff67c(0x1dc)]['id']);const _0x4ba28f=toLLMProjectInfo(_0x2fb2a3[_0x1ff67c(0x1dc)]);return await handleSDKOutput([_0x4ba28f],_0x47efda),0x0;}catch(_0x4f91cb){return handleSDKError(_0x4f91cb,_0x47efda),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x244);[a20_0x59b182(0x1e0)]=a20_0x59b182(0x22e);async[a20_0x59b182(0x283)](_0x18ab2d){const _0x203071=a20_0x59b182,{options:_0x4d0c4a,args:_0x4f084d,tdx:_0x380db3}=_0x18ab2d;if(_0x4f084d[_0x203071(0x200)]===0x0)return console[_0x203071(0x28a)](_0x203071(0x23b)),console[_0x203071(0x28a)](_0x203071(0x25e)),0x1;const _0x2ef2af=_0x4f084d[0x0];try{return await withSpinner(_0x203071(0x1d9)+_0x2ef2af+_0x203071(0x24c),()=>_0x380db3[_0x203071(0x256)][_0x203071(0x1de)](_0x2ef2af),{'verbose':_0x4d0c4a[_0x203071(0x235)]}),console[_0x203071(0x236)](_0x203071(0x1e3)+_0x2ef2af),0x0;}catch(_0x345e55){return handleSDKError(_0x345e55,_0x4d0c4a),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a20_0x59b182(0x25c);['description']=a20_0x59b182(0x1f8);async[a20_0x59b182(0x283)](_0xa1b943){const _0x24ea33=a20_0x59b182,{options:_0x5d11ad,args:_0x3ac6d5,tdx:_0x27e741}=_0xa1b943,_0x398e27=getChalk(_0x5d11ad);console[_0x24ea33(0x236)](_0x398e27[_0x24ea33(0x237)](_0x24ea33(0x294))),console[_0x24ea33(0x236)](_0x398e27[_0x24ea33(0x237)]('\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.')),console['log'](_0x398e27[_0x24ea33(0x28b)](_0x24ea33(0x29f))),console['log']();if(_0x3ac6d5['length']===0x0)return console[_0x24ea33(0x28a)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x24ea33(0x28a)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x29f71d=_0x3ac6d5[0x0],_0xd4f049=_0x5d11ad,_0x5dd60f=_0xd4f049[_0x24ea33(0x25b)],_0x20d945=_0xd4f049[_0x24ea33(0x1d6)];try{const _0x2613d3=_0x5dd60f||_0x29f71d+'.llm';if(a20_0x13d2d2[_0x24ea33(0x23c)](_0x2613d3)&&!_0x20d945){if(!_0x5d11ad[_0x24ea33(0x20b)]){const _0x346731=await confirm(_0x24ea33(0x1f2)+_0x2613d3+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x346731)return console[_0x24ea33(0x236)](_0x24ea33(0x20a)),0x0;}a20_0x13d2d2[_0x24ea33(0x258)](_0x2613d3,{'recursive':!![]});}const _0x197317=await withSpinner(_0x20d945?'Analyzing\x20project\x20\x27'+_0x29f71d+_0x24ea33(0x24c):'Backing\x20up\x20project\x20\x27'+_0x29f71d+'\x27...',()=>_0x27e741[_0x24ea33(0x256)][_0x24ea33(0x213)](_0x29f71d,_0x5dd60f,{'dryRun':_0x20d945}),{'verbose':_0x5d11ad[_0x24ea33(0x235)]}),_0x711ec7=_0x197317['data'];return _0x20d945?console[_0x24ea33(0x236)]('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x711ec7['outputDir']):console[_0x24ea33(0x236)](_0x24ea33(0x261)+_0x711ec7[_0x24ea33(0x234)]),console[_0x24ea33(0x236)]('\x20\x20Agents:\x20'+_0x711ec7[_0x24ea33(0x1d1)]['agents']),console[_0x24ea33(0x236)](_0x24ea33(0x28f)+_0x711ec7[_0x24ea33(0x1d1)][_0x24ea33(0x20d)]),console[_0x24ea33(0x236)](_0x24ea33(0x22d)+_0x711ec7[_0x24ea33(0x1d1)][_0x24ea33(0x227)]),console['log'](_0x24ea33(0x214)+_0x711ec7[_0x24ea33(0x1d1)][_0x24ea33(0x299)]),(_0x5d11ad[_0x24ea33(0x209)]==='json'||_0x5d11ad[_0x24ea33(0x209)]==='jsonl')&&await handleSDKOutput([_0x711ec7],_0x5d11ad),0x0;}catch(_0x30c6b1){return handleSDKError(_0x30c6b1,_0x5d11ad),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x59b182(0x230)]=a20_0x59b182(0x1ed);[a20_0x59b182(0x1e0)]=a20_0x59b182(0x239);async[a20_0x59b182(0x283)](_0x4a3327){const _0x387436=a20_0x59b182,{options:_0x262e98,args:_0x28f4f9,tdx:_0x50a1b6}=_0x4a3327,_0x3e2c6b=getChalk(_0x262e98);console[_0x387436(0x236)](_0x3e2c6b[_0x387436(0x237)](_0x387436(0x1f9))),console[_0x387436(0x236)](_0x3e2c6b['yellow'](_0x387436(0x21c))),console[_0x387436(0x236)](_0x3e2c6b['dim'](_0x387436(0x233))),console['log'](_0x3e2c6b['dim']('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console[_0x387436(0x236)](_0x3e2c6b[_0x387436(0x28b)](_0x387436(0x26c))),console[_0x387436(0x236)]();if(_0x28f4f9[_0x387436(0x200)]===0x0)return console[_0x387436(0x28a)](_0x387436(0x295)),console[_0x387436(0x28a)](_0x387436(0x1e5)),0x1;const _0x502acc=_0x28f4f9[0x0],_0x4ab1ff=_0x262e98,_0x537632=_0x4ab1ff[_0x387436(0x230)],_0x23bd03=_0x4ab1ff[_0x387436(0x1d6)];try{if(!_0x23bd03){const _0x3f5173=_0x50a1b6[_0x387436(0x256)]['getBackupMetadata'](_0x502acc),_0x2409d8=_0x537632||_0x3f5173[_0x387436(0x22b)][_0x387436(0x276)],_0x28bcd1=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x50a1b6['llm'][_0x387436(0x231)](),{'verbose':_0x262e98[_0x387436(0x235)]}),_0x4fcfd6=_0x28bcd1[_0x387436(0x1dc)][_0x387436(0x242)](_0x418184=>_0x418184[_0x387436(0x20f)][_0x387436(0x230)]===_0x2409d8);if(_0x4fcfd6&&!_0x262e98[_0x387436(0x20b)]){const _0x4ed8c5=await confirm('A\x20project\x20named\x20\x27'+_0x2409d8+_0x387436(0x26a));if(!_0x4ed8c5)return console['log']('Restore\x20cancelled.'),0x0;}}const _0x38c218=await withSpinner(_0x23bd03?_0x387436(0x21d)+_0x502acc+_0x387436(0x24c):'Restoring\x20project\x20from\x20\x27'+_0x502acc+_0x387436(0x24c),()=>_0x50a1b6['llm']['restoreProject'](_0x502acc,{'name':_0x537632,'dryRun':_0x23bd03}),{'verbose':_0x262e98['verbose']}),_0xa26b57=_0x38c218[_0x387436(0x1dc)];return _0xa26b57[_0x387436(0x289)]&&console['log'](_0x387436(0x266)+_0xa26b57['sourceSite']+'\x27'),_0x23bd03?console['log'](_0x387436(0x291)+_0xa26b57[_0x387436(0x276)]):console[_0x387436(0x236)](_0x387436(0x1dd)+_0xa26b57[_0x387436(0x276)]+'\x20('+_0xa26b57['projectId']+')'),console['log'](_0x387436(0x22f)+_0xa26b57['counts']['agents']),console[_0x387436(0x236)](_0x387436(0x28f)+_0xa26b57['counts'][_0x387436(0x20d)]),console[_0x387436(0x236)](_0x387436(0x22d)+_0xa26b57[_0x387436(0x1d1)]['prompts']),console[_0x387436(0x236)]('\x20\x20Integrations:\x20'+_0xa26b57[_0x387436(0x1d1)][_0x387436(0x299)]),(_0x262e98[_0x387436(0x209)]==='json'||_0x262e98['format']===_0x387436(0x1d7))&&await handleSDKOutput([_0xa26b57],_0x262e98),0x0;}catch(_0x51a7cb){return handleSDKError(_0x51a7cb,_0x262e98),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x432a21,_0x146c82){const _0xe61cde=a20_0x59b182,_0x574cc0=_0x146c82['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x3493ce=0x0,_0x438191=[];const _0x34abb2=(await import(_0xe61cde(0x227)))[_0xe61cde(0x1e9)],_0x57e81a=getChalk(_0x146c82);while(!![]){const _0x21b2b4=await withSpinner(_0xe61cde(0x27d),()=>_0x432a21[_0xe61cde(0x256)][_0xe61cde(0x1ca)](_0x574cc0+_0x3493ce),{'verbose':_0x146c82[_0xe61cde(0x235)]});_0x438191=_0x21b2b4[_0xe61cde(0x1dc)];const _0x1f4ad1=_0x438191[_0xe61cde(0x26e)](_0x3493ce,_0x3493ce+_0x574cc0),_0x3e8afc=_0x438191[_0xe61cde(0x200)]>_0x3493ce+_0x574cc0,_0x806f0=[...new Set(_0x1f4ad1['map'](_0x4963de=>_0x4963de[_0xe61cde(0x20f)][_0xe61cde(0x221)])[_0xe61cde(0x222)](_0x151577=>_0x151577!==undefined))],_0x270f3a=new Map();await Promise[_0xe61cde(0x1e1)](_0x806f0[_0xe61cde(0x1d5)](async _0x4a4297=>{const _0x441e63=_0xe61cde;try{const _0x12558b=await _0x432a21[_0x441e63(0x256)][_0x441e63(0x21b)](_0x4a4297);_0x270f3a['set'](_0x4a4297,_0x12558b[_0x441e63(0x20f)][_0x441e63(0x230)]);}catch{_0x270f3a[_0x441e63(0x2a2)](_0x4a4297,_0x4a4297);}}));const _0x39e56c=_0x1f4ad1[_0xe61cde(0x1d5)](_0x35ed4d=>{const _0x2a667a=_0xe61cde,_0x3d0b68=_0x35ed4d[_0x2a667a(0x20f)][_0x2a667a(0x26d)]||_0x2a667a(0x272),_0x3bf117=_0x3d0b68[_0x2a667a(0x241)]('\x0a')[0x0],_0x3eb39b=_0x3bf117[_0x2a667a(0x200)]>0x50?_0x3bf117[_0x2a667a(0x224)](0x0,0x4d)+'...':_0x3bf117,_0x564299=_0x35ed4d['attributes'][_0x2a667a(0x221)]?_0x270f3a['get'](_0x35ed4d[_0x2a667a(0x20f)][_0x2a667a(0x221)])||_0x35ed4d['attributes'][_0x2a667a(0x221)]:_0x2a667a(0x203),_0x21339d=_0x35ed4d['attributes']['lastConversationAt']||_0x35ed4d[_0x2a667a(0x20f)]['updatedAt'],_0x65d1ea=new Date(_0x21339d),_0x5c8ef7=new Date(),_0x27339d=_0x5c8ef7[_0x2a667a(0x210)]()-_0x65d1ea[_0x2a667a(0x210)](),_0x49b1f0=Math[_0x2a667a(0x262)](_0x27339d/0xea60),_0x1ca6bf=Math[_0x2a667a(0x262)](_0x27339d/0x36ee80),_0x750ada=Math[_0x2a667a(0x262)](_0x27339d/0x5265c00);let _0x2618ba;if(_0x49b1f0<0x1)_0x2618ba=_0x2a667a(0x271);else{if(_0x49b1f0<0x3c)_0x2618ba=_0x49b1f0+_0x2a667a(0x23f);else{if(_0x1ca6bf<0x18)_0x2618ba=_0x1ca6bf+_0x2a667a(0x27b);else _0x750ada<0x7?_0x2618ba=_0x750ada+'d\x20ago':_0x2618ba=_0x65d1ea[_0x2a667a(0x292)](_0x2a667a(0x1cf),{'month':'short','day':_0x2a667a(0x260)});}}return{'title':_0x3eb39b+'\x20'+_0x57e81a[_0x2a667a(0x28b)]('['+_0x564299+']\x20'+_0x2618ba),'value':_0x35ed4d['id']};});_0x3e8afc&&_0x39e56c[_0xe61cde(0x29d)]({'title':_0x57e81a[_0xe61cde(0x220)]('Load\x20more...'),'value':'__load_more__'});const _0x4c3c36=await _0x34abb2({'type':_0xe61cde(0x216),'name':'chatId','message':_0xe61cde(0x24e),'choices':_0x39e56c,'hint':_0xe61cde(0x25a)});if(!_0x4c3c36[_0xe61cde(0x284)])return undefined;if(_0x4c3c36['chatId']===_0xe61cde(0x29a)){_0x3493ce+=_0x574cc0;continue;}return _0x4c3c36[_0xe61cde(0x284)];}}export class ChatsCommand extends BaseCommand{[a20_0x59b182(0x230)]='chats';[a20_0x59b182(0x1e0)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a20_0x59b182(0x283)](_0x38268f){const _0x3635af=a20_0x59b182;return executeChatHistoryCommand(_0x38268f,_0x3635af(0x1c7));}}
1
+ const a20_0x4c00e2=a20_0x3016;(function(_0x432674,_0x5bcd25){const _0x511281=a20_0x3016,_0x25340e=_0x432674();while(!![]){try{const _0x2a6949=parseInt(_0x511281(0x159))/0x1*(parseInt(_0x511281(0x12f))/0x2)+parseInt(_0x511281(0x17e))/0x3+parseInt(_0x511281(0x120))/0x4*(-parseInt(_0x511281(0x197))/0x5)+parseInt(_0x511281(0x1a4))/0x6*(parseInt(_0x511281(0x118))/0x7)+-parseInt(_0x511281(0x199))/0x8*(parseInt(_0x511281(0x14d))/0x9)+parseInt(_0x511281(0x11b))/0xa+-parseInt(_0x511281(0x161))/0xb*(parseInt(_0x511281(0x138))/0xc);if(_0x2a6949===_0x5bcd25)break;else _0x25340e['push'](_0x25340e['shift']());}catch(_0x2487e7){_0x25340e['push'](_0x25340e['shift']());}}}(a20_0x21fd,0x49884));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_0x4d300e from'node:fs';function handleSDKError(_0xd20c63,_0xadb17){const _0x55ea42=a20_0x3016;if(_0xd20c63 instanceof SDKError)console[_0x55ea42(0x12a)](_0x55ea42(0x117)+_0xd20c63['message']),_0xadb17[_0x55ea42(0x1c0)]&&(_0xd20c63[_0x55ea42(0xfe)]&&console[_0x55ea42(0x12a)](_0x55ea42(0x113)+_0xd20c63['cause']),_0xd20c63[_0x55ea42(0x115)]&&(console[_0x55ea42(0x12a)](_0x55ea42(0x19f)),console[_0x55ea42(0x12a)](_0xd20c63['stack'])));else throw _0xd20c63;}function formatChatHistoryEntry(_0x35c156,_0x2da596){const _0x5753b6=a20_0x3016,_0x225a03=getChalk(_0x2da596),_0x625fed=_0x225a03[_0x5753b6(0x168)](_0x35c156['at']);if(_0x5753b6(0x1a7)in _0x35c156){const _0x95acdc=_0x225a03[_0x5753b6(0x132)]('[input]\x20\x20');return _0x625fed+'\x20'+_0x95acdc+':\x20'+_0x35c156['input'];}if('content'in _0x35c156){const _0x5c5c82=_0x225a03[_0x5753b6(0x1b2)](_0x5753b6(0x169));return _0x625fed+'\x20'+_0x5c5c82+':\x20'+_0x35c156[_0x5753b6(0x1ba)];}if(_0x5753b6(0x1b7)in _0x35c156){const _0x37d088=_0x225a03[_0x5753b6(0x13b)](_0x5753b6(0x119)),{functionName:_0x4a205a,functionArguments:_0x170f48,targetFunction:_0x2afb90}=_0x35c156[_0x5753b6(0x1b7)];let _0x1bbd15=_0x625fed+'\x20'+_0x37d088+':\x20'+_0x225a03[_0x5753b6(0x101)](_0x4a205a);if(_0x170f48&&Object[_0x5753b6(0x108)](_0x170f48)[_0x5753b6(0x174)]>0x0){const _0x3e962=Object[_0x5753b6(0x18b)](_0x170f48)[_0x5753b6(0x162)](([_0x320c03,_0x427e65])=>_0x320c03+'='+JSON['stringify'](_0x427e65))[_0x5753b6(0x1b9)](',\x20');_0x1bbd15+='('+_0x3e962+')';}_0x2afb90&&(_0x1bbd15+=_0x225a03[_0x5753b6(0x168)]('\x20['+_0x2afb90+']'));let _0x10c4d7='';if(_0x35c156['tool_call'][_0x5753b6(0x1a5)])_0x10c4d7=_0x5753b6(0x147)+_0x35c156[_0x5753b6(0x1b7)]['targetKnowledgeBase'][_0x5753b6(0x15b)];else{if(_0x35c156[_0x5753b6(0x1b7)]['targetAgent'])_0x10c4d7=_0x5753b6(0x13d)+_0x35c156['tool_call'][_0x5753b6(0x13a)]['name'];else{if(_0x35c156[_0x5753b6(0x1b7)][_0x5753b6(0x14a)])_0x10c4d7='\x20->\x20WebSearch:'+_0x35c156[_0x5753b6(0x1b7)][_0x5753b6(0x14a)][_0x5753b6(0x15b)];else _0x35c156[_0x5753b6(0x1b7)]['targetImageGenerator']&&(_0x10c4d7=_0x5753b6(0x15e)+_0x35c156[_0x5753b6(0x1b7)][_0x5753b6(0x121)]['name']);}}return _0x1bbd15+_0x10c4d7;}if('tool'in _0x35c156){const _0x32c49d=_0x225a03[_0x5753b6(0x110)](_0x5753b6(0x194)),{functionName:_0x120a0d,functionArguments:_0x4609e6,content:_0x119840,newChat:_0x1d666c}=_0x35c156[_0x5753b6(0x10c)];let _0x1941db=_0x625fed+'\x20'+_0x32c49d+':\x20'+_0x225a03['bold'](_0x120a0d);if(_0x4609e6){const _0x55e0d0=typeof _0x4609e6===_0x5753b6(0x1c5)?_0x4609e6:JSON[_0x5753b6(0xed)](_0x4609e6);_0x1941db+='('+_0x55e0d0+')';}return _0x119840&&(_0x1941db+='\x0a'+_0x225a03[_0x5753b6(0x168)](_0x119840)),_0x1d666c&&(_0x1941db+=_0x225a03['dim'](_0x5753b6(0xf2)+_0x1d666c['id'])),_0x1941db;}if(_0x5753b6(0x1a9)in _0x35c156){const _0x2eb5d6=_0x225a03[_0x5753b6(0x1a0)](_0x5753b6(0x15f));return _0x625fed+'\x20'+_0x2eb5d6+':\x20'+_0x35c156[_0x5753b6(0x1a9)][_0x5753b6(0x15b)]+'\x20('+_0x35c156['output']['content'][_0x5753b6(0x174)]+_0x5753b6(0x16a);}if(_0x5753b6(0x1aa)in _0x35c156){const _0x53d7b5=_0x225a03[_0x5753b6(0x1a0)]('[image]\x20\x20'),{width:_0x34c3ca,height:_0x46b5bf,headerText:_0x286fa1}=_0x35c156[_0x5753b6(0x1aa)],_0x5812bc=_0x286fa1?_0x5753b6(0x151)+_0x286fa1:'';return _0x625fed+'\x20'+_0x53d7b5+':\x20'+_0x34c3ca+'x'+_0x46b5bf+_0x5812bc;}if(_0x5753b6(0x12a)in _0x35c156){const _0x5f2d51=_0x225a03[_0x5753b6(0x166)]('[error]\x20\x20');return _0x625fed+'\x20'+_0x5f2d51+':\x20'+_0x35c156[_0x5753b6(0x12a)];}return _0x625fed+'\x20'+_0x225a03[_0x5753b6(0x168)](_0x5753b6(0x1c2))+':\x20'+JSON[_0x5753b6(0xed)](_0x35c156);}async function executeChatHistoryCommand(_0x3af5d6,_0x42b385){const _0x5529d3=a20_0x3016,{options:_0x32b358,args:_0x290d34,tdx:_0x18991f}=_0x3af5d6,_0x1ebd21=_0x290d34[0x0],_0x58b8b3=_0x32b358,_0x1cabdf=_0x58b8b3['last'];try{if(_0x1cabdf&&_0x1ebd21)return console[_0x5529d3(0x12a)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console['error'](_0x5529d3(0x183)+_0x42b385+'\x20--last'),0x1;if(!_0x1ebd21&&!_0x1cabdf&&_0x32b358['format']!==undefined){const _0x57a2b4=resolveLimit(_0x32b358[_0x5529d3(0x125)],DEFAULT_LLM_LIMIT),_0x3a1d5d=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x18991f[_0x5529d3(0x175)]['chats'](_0x57a2b4),{'verbose':_0x32b358['verbose']});return await handleSDKOutput(_0x3a1d5d[_0x5529d3(0x123)],_0x32b358),0x0;}const _0x1e8230=await getChatIdOrSelect(_0x18991f,_0x32b358,_0x1cabdf,_0x1ebd21);if(!_0x1e8230)return 0x0;return await displayChatHistory(_0x1e8230,_0x18991f,_0x32b358),0x0;}catch(_0x22b2aa){return handleSDKError(_0x22b2aa,_0x32b358),0x1;}}async function displayChatHistory(_0x90ea98,_0x44c0db,_0x39e122){const _0x3a2b58=a20_0x3016,_0x1e4b6f=await withSpinner(_0x3a2b58(0x198)+_0x90ea98+_0x3a2b58(0x107),()=>_0x44c0db['llm'][_0x3a2b58(0x191)](_0x90ea98),{'verbose':_0x39e122[_0x3a2b58(0x1c0)]}),_0x4e18b7=_0x1e4b6f['data'][_0x3a2b58(0x123)]??[];if(_0x4e18b7[_0x3a2b58(0x174)]===0x0){console['log'](_0x3a2b58(0xf4));return;}if(_0x39e122[_0x3a2b58(0xff)]!==undefined)await handleSDKOutput(_0x4e18b7,_0x39e122);else{const _0x2a254b=_0x4e18b7[_0x3a2b58(0x162)](_0x58ac05=>formatChatHistoryEntry(_0x58ac05,_0x39e122)),_0x19d7c9=_0x2a254b[_0x3a2b58(0x1b9)]('\x0a');await writeOutput(_0x19d7c9,_0x39e122[_0x3a2b58(0x1a9)],_0x3a2b58(0x146));}}async function getChatIdOrSelect(_0x246175,_0x1c19ad,_0x4cf599,_0xc1d71){const _0x3ace4d=a20_0x3016;if(_0xc1d71)return _0xc1d71;if(_0x4cf599){const _0x2ee4a4=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x246175[_0x3ace4d(0x175)][_0x3ace4d(0x1c9)](0x1),{'verbose':_0x1c19ad[_0x3ace4d(0x1c0)]});if(_0x2ee4a4[_0x3ace4d(0x123)][_0x3ace4d(0x174)]===0x0)return console[_0x3ace4d(0x1bf)](_0x3ace4d(0x100)),undefined;return _0x2ee4a4['data'][0x0]['id'];}const _0x12a51e=await selectChatInteractively(_0x246175,_0x1c19ad);if(!_0x12a51e)return console[_0x3ace4d(0x1bf)](_0x3ace4d(0x126)),undefined;return _0x12a51e;}async function getProjectIdOrDefault(_0x6aa0f6){const _0x32dd9b=await getProjectWithName(_0x6aa0f6);return _0x32dd9b['id'];}async function getProjectWithName(_0x3438ee){const _0x5f1afa=a20_0x3016,{tdx:_0x10180e,options:_0x387323}=_0x3438ee,_0x4c4170=_0x387323[_0x5f1afa(0x15a)];if(_0x4c4170){const _0x276a47=await withSpinner(_0x5f1afa(0x17a)+_0x4c4170+_0x5f1afa(0x107),()=>_0x10180e['llm']['resolveProjectId'](_0x4c4170),{'verbose':_0x387323[_0x5f1afa(0x1c0)]});return{'id':_0x276a47[_0x5f1afa(0x123)],'name':_0x4c4170};}const _0x126c3e=_0x10180e['llm'][_0x5f1afa(0x153)]();if(_0x126c3e){const _0x4d8e99=await _0x10180e['llm'][_0x5f1afa(0x144)](),_0x26c556=_0x4d8e99[_0x5f1afa(0x185)](_0x21acac=>_0x21acac['id']===_0x126c3e);return{'id':_0x126c3e,'name':_0x26c556?.[_0x5f1afa(0xfb)][_0x5f1afa(0x15b)]||_0x5f1afa(0x1b6)};}const _0x30f51d=await withSpinner(_0x5f1afa(0x139),()=>_0x10180e['llm'][_0x5f1afa(0x15c)](),{'verbose':_0x387323[_0x5f1afa(0x1c0)]});return{'id':_0x30f51d[_0x5f1afa(0x123)]['id'],'name':_0x30f51d[_0x5f1afa(0x123)][_0x5f1afa(0xfb)][_0x5f1afa(0x15b)]};}function toLLMProjectInfo(_0x531625){const _0x20346c=a20_0x3016;return{'name':_0x531625[_0x20346c(0xfb)]['name'],'description':_0x531625[_0x20346c(0xfb)]['description'],'createdAt':_0x531625['attributes'][_0x20346c(0xf1)],'updatedAt':_0x531625[_0x20346c(0xfb)][_0x20346c(0x1a1)]};}function toAgentInfo(_0x5608f6){const _0x3e4729=a20_0x3016;return{'name':_0x5608f6[_0x3e4729(0xfb)][_0x3e4729(0x15b)],'description':_0x5608f6[_0x3e4729(0xfb)][_0x3e4729(0x196)],'prompt':truncatePrompt(_0x5608f6['attributes'][_0x3e4729(0x142)]),'createdAt':_0x5608f6[_0x3e4729(0xfb)]['createdAt'],'updatedAt':_0x5608f6[_0x3e4729(0xfb)][_0x3e4729(0x1a1)]};}function truncatePrompt(_0x254798){const _0x30b237=a20_0x3016;if(!_0x254798)return undefined;const _0x38991a=0x64;if(_0x254798[_0x30b237(0x174)]<=_0x38991a)return _0x254798;return _0x254798[_0x30b237(0x14b)](0x0,_0x38991a)+_0x30b237(0xfa);}export class LLMModelsCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x187);['description']=a20_0x4c00e2(0x137);async[a20_0x4c00e2(0x122)](_0x36f16f){const _0x2d91a2=a20_0x4c00e2,{options:_0x5f05bd,tdx:_0x2c2bd6}=_0x36f16f;try{const _0xb15a72=await withSpinner(_0x2d91a2(0x19a),()=>_0x2c2bd6[_0x2d91a2(0x175)][_0x2d91a2(0x18a)](),{'verbose':_0x5f05bd[_0x2d91a2(0x1c0)]});return await handleSDKOutput(_0xb15a72[_0x2d91a2(0x123)],_0x5f05bd),0x0;}catch(_0x9dadd5){return handleSDKError(_0x9dadd5,_0x5f05bd),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0xf7);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x12e);async['execute'](_0x2c3616){const _0x40ff56=a20_0x4c00e2,{options:_0x40d3ce,args:_0x14306a,tdx:_0xf9a5d5}=_0x2c3616,_0x5f2d65=getChalk(_0x40d3ce),_0x3fbccf=_0x40d3ce[_0x40ff56(0x158)];try{const _0x274f53=_0x14306a[0x0],_0x1d8277=resolveLimit(_0x40d3ce[_0x40ff56(0x125)],DEFAULT_LLM_LIMIT),_0x33ef5e=await withSpinner(_0x40ff56(0x10e),()=>_0xf9a5d5[_0x40ff56(0x175)]['projects'](_0x1d8277),{'verbose':_0x40d3ce['verbose']});let _0x33b0c2=_0x33ef5e['data'];_0x274f53&&(_0x33b0c2=_0x33ef5e['data'][_0x40ff56(0x104)](_0x221e05=>matchGlobPattern(_0x221e05[_0x40ff56(0xfb)][_0x40ff56(0x15b)],_0x274f53)));const _0x5540be=_0x40d3ce[_0x40ff56(0xff)]===_0x40ff56(0x1ac)||_0x40d3ce['format']===_0x40ff56(0x17b)||_0x40d3ce['format']===_0x40ff56(0x146)||_0x40d3ce[_0x40ff56(0xff)]===_0x40ff56(0x18d);if(_0x5540be){const _0x41fab0=_0x33b0c2[_0x40ff56(0x162)](_0x47d7b3=>({...toLLMProjectInfo(_0x47d7b3),'url':getLLMProjectUrl(_0x3fbccf,_0x47d7b3['id'])}));await handleSDKOutput(_0x41fab0,_0x40d3ce);}else{const _0x560c0b=[];if(_0x33b0c2[_0x40ff56(0x174)]===0x0)_0x560c0b[_0x40ff56(0xf8)](_0x5f2d65[_0x40ff56(0x168)]('No\x20projects\x20found'));else{const _0x3b1504=[..._0x33b0c2]['sort']((_0x39149a,_0xef71c5)=>_0x39149a[_0x40ff56(0xfb)][_0x40ff56(0x15b)][_0x40ff56(0x1bc)](_0xef71c5['attributes'][_0x40ff56(0x15b)]));for(const _0x1bf0ee of _0x3b1504){const _0x26ec9f=getLLMProjectUrl(_0x3fbccf,_0x1bf0ee['id']),_0x888a70=hyperlink(_0x1bf0ee[_0x40ff56(0xfb)][_0x40ff56(0x15b)],_0x26ec9f);_0x560c0b[_0x40ff56(0xf8)](_0x40ff56(0x114)+_0x888a70);}_0x560c0b['push'](_0x5f2d65[_0x40ff56(0x168)](_0x33b0c2['length']+_0x40ff56(0x1cb)));}await writeOutput(_0x560c0b['join']('\x0a'),_0x40d3ce['output'],_0x40ff56(0x146));}return 0x0;}catch(_0x24e333){return handleSDKError(_0x24e333,_0x40d3ce),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a20_0x4c00e2(0x1a2);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x18c);async[a20_0x4c00e2(0x122)](_0x735d9d){const _0x5b58a4=a20_0x4c00e2,{options:_0x1885f1,args:_0x13d653,tdx:_0x4b2fb0}=_0x735d9d,_0x166349=getChalk(_0x1885f1),_0x51e0aa=_0x1885f1[_0x5b58a4(0x158)];try{const _0x14d541=_0x13d653[0x0];let _0x5071fb=_0x14d541,_0x54d5a7,_0x409672;if(_0x14d541&&_0x14d541[_0x5b58a4(0x10a)]('/')){const _0x4b063d=_0x14d541[_0x5b58a4(0x19c)]('/');if(_0x4b063d[_0x5b58a4(0x174)]===0x2){const [_0x43edeb,_0x91443f]=_0x4b063d,_0x39521b=await _0x4b2fb0[_0x5b58a4(0x175)][_0x5b58a4(0x144)](),_0x1abf68=_0x39521b['find'](_0x250d37=>_0x250d37[_0x5b58a4(0xfb)][_0x5b58a4(0x15b)][_0x5b58a4(0x149)]()===_0x43edeb['toLowerCase']());if(!_0x1abf68)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x43edeb,undefined,{'helpText':_0x5b58a4(0x160)});_0x54d5a7=_0x1abf68['id'],_0x409672=_0x1abf68[_0x5b58a4(0xfb)][_0x5b58a4(0x15b)],_0x5071fb=_0x91443f;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0x14d541,undefined,{'helpText':_0x5b58a4(0xfc)});}else{const _0x42c5fa=await getProjectWithName(_0x735d9d);_0x54d5a7=_0x42c5fa['id'],_0x409672=_0x42c5fa['name'];}const _0x4a10b9=await withSpinner(_0x5b58a4(0x171),()=>_0x4b2fb0[_0x5b58a4(0x175)][_0x5b58a4(0x129)](_0x54d5a7),{'verbose':_0x1885f1['verbose']});let _0x5236f8=_0x4a10b9[_0x5b58a4(0x123)];_0x5071fb&&(_0x5236f8=_0x4a10b9[_0x5b58a4(0x123)][_0x5b58a4(0x104)](_0x507965=>matchGlobPattern(_0x507965[_0x5b58a4(0xfb)][_0x5b58a4(0x15b)],_0x5071fb)));const _0x151e3e=_0x1885f1[_0x5b58a4(0xff)]==='json'||_0x1885f1[_0x5b58a4(0xff)]===_0x5b58a4(0x17b)||_0x1885f1['format']===_0x5b58a4(0x146)||_0x1885f1[_0x5b58a4(0xff)]===_0x5b58a4(0x18d);if(_0x151e3e){const _0x46e658=_0x5236f8[_0x5b58a4(0x162)](_0x3a1991=>({...toAgentInfo(_0x3a1991),'chatUrl':getLLMAgentChatUrl(_0x51e0aa,_0x54d5a7,_0x3a1991['id'])}));await handleSDKOutput(_0x46e658,_0x1885f1);}else{const _0x22e2cb=[];_0x22e2cb['push'](_0x166349[_0x5b58a4(0x168)]('['+_0x409672+']'));if(_0x5236f8[_0x5b58a4(0x174)]===0x0)_0x22e2cb['push'](_0x166349[_0x5b58a4(0x168)](_0x5b58a4(0xf0)));else{const _0x329af7=[..._0x5236f8][_0x5b58a4(0x134)]((_0x1feb3b,_0x349927)=>_0x1feb3b[_0x5b58a4(0xfb)][_0x5b58a4(0x15b)][_0x5b58a4(0x1bc)](_0x349927[_0x5b58a4(0xfb)][_0x5b58a4(0x15b)]));for(const _0x1a8a7e of _0x329af7){const _0x5ec2a3=getLLMAgentChatUrl(_0x51e0aa,_0x54d5a7,_0x1a8a7e['id']),_0x52366a=hyperlink(_0x1a8a7e['attributes'][_0x5b58a4(0x15b)],_0x5ec2a3);_0x22e2cb[_0x5b58a4(0xf8)](_0x5b58a4(0x11e)+_0x52366a);}_0x22e2cb[_0x5b58a4(0xf8)](_0x166349[_0x5b58a4(0x168)](_0x5236f8[_0x5b58a4(0x174)]+_0x5b58a4(0xf3)));}await writeOutput(_0x22e2cb[_0x5b58a4(0x1b9)]('\x0a'),_0x1885f1[_0x5b58a4(0x1a9)],_0x5b58a4(0x146));}return 0x0;}catch(_0x41cc43){return handleSDKError(_0x41cc43,_0x1885f1),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x141);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x19b);async[a20_0x4c00e2(0x122)](_0x40d8f7){const _0x1556ee=a20_0x4c00e2,{options:_0x489601,args:_0x332de1,tdx:_0x5be348}=_0x40d8f7;if(_0x332de1[_0x1556ee(0x174)]===0x0)return console[_0x1556ee(0x12a)]('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x1556ee(0x11a)),0x1;const _0xd53141=_0x332de1[0x0];try{const _0x10a1ff=await getProjectIdOrDefault(_0x40d8f7),_0x48f6ac=await withSpinner(_0x1556ee(0xf5)+_0xd53141+'\x27...',()=>_0x5be348[_0x1556ee(0x175)][_0x1556ee(0x135)](_0xd53141,_0x10a1ff),{'verbose':_0x489601[_0x1556ee(0x1c0)]}),_0x15bd72=await withSpinner(_0x1556ee(0x1af),()=>_0x5be348[_0x1556ee(0x175)][_0x1556ee(0x173)](_0x48f6ac['data']),{'verbose':_0x489601[_0x1556ee(0x1c0)]});return await handleSDKOutput([_0x15bd72['data']],_0x489601),0x0;}catch(_0x337b77){return handleSDKError(_0x337b77,_0x489601),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x1a8);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x1bb);async['execute'](_0x1895db){const _0x463cb0=a20_0x4c00e2,{options:_0x4c4cfd,args:_0x410b24,tdx:_0x59206c}=_0x1895db;if(_0x410b24[_0x463cb0(0x174)]===0x0)return console[_0x463cb0(0x12a)](_0x463cb0(0x11c)),console[_0x463cb0(0x12a)](_0x463cb0(0x1c6)),console[_0x463cb0(0x12a)](_0x463cb0(0x157)),0x1;const _0x5a3e8b=_0x410b24[0x0],_0x851086=_0x4c4cfd,_0x1ae182=_0x851086[_0x463cb0(0x1ad)],_0x59f93b=_0x851086['model']||_0x463cb0(0x102),_0x530c54=_0x851086['starterMessage'],_0x5e640e=_0x851086[_0x463cb0(0x170)]?Number(_0x851086[_0x463cb0(0x170)]):undefined,_0x5e2637=_0x851086[_0x463cb0(0x12b)]?Number(_0x851086[_0x463cb0(0x12b)]):undefined;try{let _0x363d6c,_0x148308;if(_0x5a3e8b[_0x463cb0(0x10a)]('/')){const _0x2e8242=_0x5a3e8b['split']('/');if(_0x2e8242['length']===0x2){const [_0x4c5982,_0x36b252]=_0x2e8242,_0x2f140d=await withSpinner('Resolving\x20project\x20\x27'+_0x4c5982+_0x463cb0(0x107),()=>_0x59206c[_0x463cb0(0x175)][_0x463cb0(0x19e)](_0x4c5982),{'verbose':_0x4c4cfd['verbose']});_0x363d6c=_0x2f140d['data'],_0x148308=_0x36b252;}else throw new SDKError(ErrorCode[_0x463cb0(0x13f)],'Invalid\x20path\x20syntax:\x20'+_0x5a3e8b,undefined,{'helpText':_0x463cb0(0xfc)});}else _0x363d6c=await getProjectIdOrDefault(_0x1895db),_0x148308=_0x5a3e8b;const _0x3d3c52=await withSpinner(_0x463cb0(0x1c4)+_0x148308+_0x463cb0(0x107),()=>_0x59206c['llm'][_0x463cb0(0xec)]({'name':_0x148308,'projectId':_0x363d6c,'modelType':_0x59f93b,'systemPrompt':_0x1ae182,'starterMessage':_0x530c54,'maxToolIterations':_0x5e640e,'temperature':_0x5e2637}),{'verbose':_0x4c4cfd['verbose']});return console[_0x463cb0(0x1bf)](_0x463cb0(0x181)+_0x3d3c52[_0x463cb0(0x123)]['id']),await handleSDKOutput([_0x3d3c52[_0x463cb0(0x123)]],_0x4c4cfd),0x0;}catch(_0x16e42d){return handleSDKError(_0x16e42d,_0x4c4cfd),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x179);[a20_0x4c00e2(0x196)]='Update\x20an\x20existing\x20agent';async[a20_0x4c00e2(0x122)](_0x2e0e5a){const _0x2f78f1=a20_0x4c00e2,{options:_0x37a3a1,args:_0x246313,tdx:_0x279349}=_0x2e0e5a;if(_0x246313[_0x2f78f1(0x174)]===0x0)return console[_0x2f78f1(0x12a)](_0x2f78f1(0x11c)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x5d7910=_0x246313[0x0],_0x2a4ce0=_0x37a3a1,_0x2768f5=_0x2a4ce0[_0x2f78f1(0x15b)],_0x3cea58=_0x2a4ce0[_0x2f78f1(0x142)],_0x49b420=_0x2a4ce0[_0x2f78f1(0x196)],_0x881d2c=_0x2a4ce0['starterMessage'];if(!_0x2768f5&&!_0x3cea58&&!_0x49b420&&!_0x881d2c)return console[_0x2f78f1(0x12a)](_0x2f78f1(0x14e)),console[_0x2f78f1(0x12a)](_0x2f78f1(0x1b1)),0x1;try{const _0x92f36f=await getProjectIdOrDefault(_0x2e0e5a),_0x487023=await withSpinner(_0x2f78f1(0xf5)+_0x5d7910+'\x27...',()=>_0x279349[_0x2f78f1(0x175)][_0x2f78f1(0x135)](_0x5d7910,_0x92f36f),{'verbose':_0x37a3a1[_0x2f78f1(0x1c0)]}),_0x45519c=_0x487023[_0x2f78f1(0x123)],_0x2103cd=await withSpinner('Updating\x20agent...',()=>_0x279349[_0x2f78f1(0x175)][_0x2f78f1(0x190)](_0x45519c,{'name':_0x2768f5,'prompt':_0x3cea58,'description':_0x49b420,'starterMessage':_0x881d2c}),{'verbose':_0x37a3a1[_0x2f78f1(0x1c0)]});return console[_0x2f78f1(0x1bf)](_0x2f78f1(0x163)+_0x2103cd[_0x2f78f1(0x123)]['id']),await handleSDKOutput([_0x2103cd[_0x2f78f1(0x123)]],_0x37a3a1),0x0;}catch(_0x28024b){return handleSDKError(_0x28024b,_0x37a3a1),0x1;}}}function a20_0x21fd(){const _0x5ee9a7=['counts','table','\x20->\x20KB:','Project\x20backed\x20up\x20to:\x20','toLowerCase','targetWebSearchTool','slice','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','495wkxmbw','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','numeric','prompts','\x20-\x20','tdx\x20llm\x20history','getCurrentProject','getBackupMetadata','projectId','default','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','site','72194hkAYct','llmProject','name','getOrCreateDefaultProject','Restoring\x20project\x20from\x20\x27','\x20->\x20ImageGen:','[output]\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','21879vAOnce','map','Agent\x20updated:\x20','knowledgeBases','Delete\x20an\x20agent','red','integrations','dim','[content]','\x20bytes)','projectName','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Project\x20created:\x20','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','__load_more__','maxToolIterations','Fetching\x20agents...','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','agent','length','llm','all','createProject','firstInputContent','llm:agent:update','Resolving\x20project\x20\x27','jsonl','Deleting\x20project\x20\x27','Restore\x20cancelled.','820755cacNxp','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','outputDir','Agent\x20created:\x20','A\x20project\x20named\x20\x27','Usage:\x20','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','find','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','llm:models','llm:history','Checking\x20for\x20existing\x20projects...','models','entries','List\x20agents\x20in\x20current\x20project','tsv','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','select','updateAgent','history','set','Backup\x20cancelled.','[tool]\x20\x20\x20','\x20\x20Agents:\x20','description','2941880BanFqg','Fetching\x20chat\x20history\x20for\x20\x27','25328aybfaG','Fetching\x20available\x20models...','Show\x20agent\x20details','split','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','resolveProjectId','\x0aStack\x20trace:','blue','updatedAt','llm:agents','llm:agent:delete','2788584jEjUYY','targetKnowledgeBase','\x20\x20Integrations:\x20','input','llm:agent:create','output','image','toLocaleDateString','json','systemPrompt','deleteProject','Fetching\x20agent...','lastConversationAt','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','green','exportedFrom','\x20\x20\x20Examples:','dryRun','Unknown','tool_call','\x20\x20Prompts:\x20','join','content','Create\x20a\x20new\x20agent\x20in\x20current\x20project','localeCompare','existsSync','Load\x20more...','log','verbose','get','[unknown]','Creating\x20project\x20\x27','Creating\x20agent\x20\x27','string','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Error:\x20Project\x20name\x20is\x20required','\x20\x20Knowledge\x20Bases:\x20','chats','Create\x20a\x20new\x20LLM\x20project','\x20project(s)','createAgent','stringify','m\x20ago','floor','No\x20agents\x20found','createdAt','\x20→\x20chat:\x20','\x20agent(s)','No\x20messages\x20found\x20in\x20chat\x20history.','Resolving\x20agent\x20\x27','Project\x20restored:\x20','llm:projects','push','Project\x20deleted:\x20','...','attributes','Use\x20format:\x20project-name/agent-name','Set\x20current\x20project\x20context','cause','format','No\x20chat\x20sessions\x20found.','bold','claude-4.5-haiku','Project\x20context\x20set\x20to:\x20','filter','just\x20now','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','\x27...','keys','setCurrentProject','includes','agentId','tool','llm:project:restore','Fetching\x20projects...','getTime','magenta','substring','tdx\x20chats','\x20\x20Cause:\x20','⚒️\x20','stack','Output\x20directory\x20\x27','Error:\x20','7cFzYVZ','[tool_call]','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','5051640vjNSxs','Error:\x20Agent\x20name\x20is\x20required','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','🤖\x20','Setting\x20project\x20context\x20to\x20\x27','4ekequA','targetImageGenerator','execute','data','restoreProject','limit','\x0aCancelled','h\x20ago','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','agents','error','temperature','.llm','Fetching\x20chat\x20sessions...','List\x20all\x20LLM\x20projects','4gRXrSu','chatId','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','cyan','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','sort','resolveAgentId','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','List\x20available\x20LLM\x20models','1956TRaEMA','Getting\x20default\x20project...','targetAgent','yellow','\x27\x20already\x20exists.\x20Overwrite?','\x20->\x20Agent:','Deleting\x20agent...','INVALID_ARGUMENT','llm:use','llm:agent:show','prompt','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','projects'];a20_0x21fd=function(){return _0x5ee9a7;};return a20_0x21fd();}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x1a3);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x165);async[a20_0x4c00e2(0x122)](_0x3882aa){const _0x1a106b=a20_0x4c00e2,{options:_0x2d04f1,args:_0x15632b,tdx:_0x338de2}=_0x3882aa;if(_0x15632b[_0x1a106b(0x174)]===0x0)return console[_0x1a106b(0x12a)](_0x1a106b(0x11c)),console[_0x1a106b(0x12a)](_0x1a106b(0x106)),0x1;const _0x52c99d=_0x15632b[0x0];try{const _0x4fc293=await getProjectIdOrDefault(_0x3882aa),_0x1e2eb6=await withSpinner(_0x1a106b(0xf5)+_0x52c99d+_0x1a106b(0x107),()=>_0x338de2['llm'][_0x1a106b(0x135)](_0x52c99d,_0x4fc293),{'verbose':_0x2d04f1[_0x1a106b(0x1c0)]}),_0x19aee7=_0x1e2eb6[_0x1a106b(0x123)];return await withSpinner(_0x1a106b(0x13e),()=>_0x338de2['llm']['deleteAgent'](_0x19aee7),{'verbose':_0x2d04f1['verbose']}),console[_0x1a106b(0x1bf)]('Agent\x20deleted:\x20'+_0x19aee7),0x0;}catch(_0x32e269){return handleSDKError(_0x32e269,_0x2d04f1),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x188);[a20_0x4c00e2(0x196)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async[a20_0x4c00e2(0x122)](_0x573c66){const _0x4d2a48=a20_0x4c00e2;return executeChatHistoryCommand(_0x573c66,_0x4d2a48(0x152));}}export class LLMUseCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x140);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0xfd);async[a20_0x4c00e2(0x122)](_0x361551){const _0x2911ba=a20_0x4c00e2,{options:_0x20ae2b,args:_0x224bf4,tdx:_0xd216cb}=_0x361551;if(_0x224bf4['length']===0x0)return console['error'](_0x2911ba(0x1c7)),console['error'](_0x2911ba(0x16c)),0x1;const _0x25ce37=_0x224bf4[0x0];try{return await withSpinner(_0x2911ba(0x11f)+_0x25ce37+_0x2911ba(0x107),()=>_0xd216cb[_0x2911ba(0x175)][_0x2911ba(0x109)](_0x25ce37),{'verbose':_0x20ae2b[_0x2911ba(0x1c0)]}),console['log'](_0x2911ba(0x103)+_0x25ce37),0x0;}catch(_0x2a7682){return handleSDKError(_0x2a7682,_0x20ae2b),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]='llm:project:create';[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x1ca);async[a20_0x4c00e2(0x122)](_0x510789){const _0x2cf903=a20_0x4c00e2,{options:_0x13af49,args:_0x1d1da3,tdx:_0x444fc2}=_0x510789;if(_0x1d1da3[_0x2cf903(0x174)]===0x0)return console[_0x2cf903(0x12a)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x2cf903(0x12a)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x5bba20=_0x1d1da3[0x0],_0x13c1b5=_0x13af49,_0xa49dcf=_0x13c1b5[_0x2cf903(0x196)];try{const _0x570304=await withSpinner(_0x2cf903(0x1c3)+_0x5bba20+_0x2cf903(0x107),()=>_0x444fc2[_0x2cf903(0x175)][_0x2cf903(0x177)]({'name':_0x5bba20,'description':_0xa49dcf}),{'verbose':_0x13af49['verbose']});console[_0x2cf903(0x1bf)](_0x2cf903(0x16d)+_0x570304[_0x2cf903(0x123)]['id']);const _0xa216e6=toLLMProjectInfo(_0x570304[_0x2cf903(0x123)]);return await handleSDKOutput([_0xa216e6],_0x13af49),0x0;}catch(_0x28c9d4){return handleSDKError(_0x28c9d4,_0x13af49),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]='llm:project:delete';['description']='Delete\x20an\x20LLM\x20project';async[a20_0x4c00e2(0x122)](_0x4d9cde){const _0x5325db=a20_0x4c00e2,{options:_0x2e705b,args:_0x539448,tdx:_0x14a718}=_0x4d9cde;if(_0x539448[_0x5325db(0x174)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x5325db(0x12a)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x10b798=_0x539448[0x0];try{return await withSpinner(_0x5325db(0x17c)+_0x10b798+_0x5325db(0x107),()=>_0x14a718[_0x5325db(0x175)][_0x5325db(0x1ae)](_0x10b798),{'verbose':_0x2e705b[_0x5325db(0x1c0)]}),console[_0x5325db(0x1bf)](_0x5325db(0xf9)+_0x10b798),0x0;}catch(_0x44ab07){return handleSDKError(_0x44ab07,_0x2e705b),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]='llm:project:backup';['description']=a20_0x4c00e2(0x17f);async['execute'](_0x5065eb){const _0x10b68f=a20_0x4c00e2,{options:_0x15e44d,args:_0x3d375f,tdx:_0x3f621d}=_0x5065eb,_0x20d393=getChalk(_0x15e44d);console[_0x10b68f(0x1bf)](_0x20d393[_0x10b68f(0x13b)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console['log'](_0x20d393['yellow'](_0x10b68f(0x131))),console[_0x10b68f(0x1bf)](_0x20d393[_0x10b68f(0x168)](_0x10b68f(0x16e))),console[_0x10b68f(0x1bf)]();if(_0x3d375f[_0x10b68f(0x174)]===0x0)return console[_0x10b68f(0x12a)](_0x10b68f(0x1c7)),console[_0x10b68f(0x12a)](_0x10b68f(0x11d)),0x1;const _0x2e7a50=_0x3d375f[0x0],_0x5a3360=_0x15e44d,_0x7bbfd3=_0x5a3360['output'],_0x56c216=_0x5a3360[_0x10b68f(0x1b5)];try{const _0x530515=_0x7bbfd3||_0x2e7a50+_0x10b68f(0x12c);if(a20_0x4d300e[_0x10b68f(0x1bd)](_0x530515)&&!_0x56c216){if(!_0x15e44d['yes']){const _0x542013=await confirm(_0x10b68f(0x116)+_0x530515+_0x10b68f(0x13c));if(!_0x542013)return console[_0x10b68f(0x1bf)](_0x10b68f(0x193)),0x0;}a20_0x4d300e['rmSync'](_0x530515,{'recursive':!![]});}const _0x56f8e3=await withSpinner(_0x56c216?'Analyzing\x20project\x20\x27'+_0x2e7a50+'\x27...':'Backing\x20up\x20project\x20\x27'+_0x2e7a50+_0x10b68f(0x107),()=>_0x3f621d[_0x10b68f(0x175)]['backupProject'](_0x2e7a50,_0x7bbfd3,{'dryRun':_0x56c216}),{'verbose':_0x15e44d['verbose']}),_0x822f99=_0x56f8e3[_0x10b68f(0x123)];return _0x56c216?console['log'](_0x10b68f(0x133)+_0x822f99[_0x10b68f(0x180)]):console[_0x10b68f(0x1bf)](_0x10b68f(0x148)+_0x822f99['outputDir']),console['log'](_0x10b68f(0x195)+_0x822f99[_0x10b68f(0x145)][_0x10b68f(0x129)]),console[_0x10b68f(0x1bf)](_0x10b68f(0x1c8)+_0x822f99[_0x10b68f(0x145)][_0x10b68f(0x164)]),console[_0x10b68f(0x1bf)](_0x10b68f(0x1b8)+_0x822f99[_0x10b68f(0x145)][_0x10b68f(0x150)]),console['log'](_0x10b68f(0x1a6)+_0x822f99['counts'][_0x10b68f(0x167)]),(_0x15e44d[_0x10b68f(0xff)]==='json'||_0x15e44d[_0x10b68f(0xff)]===_0x10b68f(0x17b))&&await handleSDKOutput([_0x822f99],_0x15e44d),0x0;}catch(_0x26d9c6){return handleSDKError(_0x26d9c6,_0x15e44d),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x10d);['description']=a20_0x4c00e2(0x128);async[a20_0x4c00e2(0x122)](_0x13bbcc){const _0x3032e2=a20_0x4c00e2,{options:_0x2e5102,args:_0x467d75,tdx:_0x3694c6}=_0x13bbcc,_0x4f2603=getChalk(_0x2e5102);console[_0x3032e2(0x1bf)](_0x4f2603['yellow'](_0x3032e2(0x184))),console[_0x3032e2(0x1bf)](_0x4f2603['yellow'](_0x3032e2(0x19d))),console['log'](_0x4f2603[_0x3032e2(0x168)](_0x3032e2(0x1b4))),console[_0x3032e2(0x1bf)](_0x4f2603[_0x3032e2(0x168)]('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console['log'](_0x4f2603[_0x3032e2(0x168)](_0x3032e2(0x172))),console[_0x3032e2(0x1bf)]();if(_0x467d75[_0x3032e2(0x174)]===0x0)return console['error']('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console['error'](_0x3032e2(0x18e)),0x1;const _0x115396=_0x467d75[0x0],_0x5a3a1f=_0x2e5102,_0x4f5327=_0x5a3a1f[_0x3032e2(0x15b)],_0x9e8713=_0x5a3a1f[_0x3032e2(0x1b5)];try{if(!_0x9e8713){const _0xb79f2d=_0x3694c6[_0x3032e2(0x175)][_0x3032e2(0x154)](_0x115396),_0x357bb6=_0x4f5327||_0xb79f2d[_0x3032e2(0x1b3)][_0x3032e2(0x16b)],_0x1e2b5a=await withSpinner(_0x3032e2(0x189),()=>_0x3694c6['llm'][_0x3032e2(0x144)](),{'verbose':_0x2e5102[_0x3032e2(0x1c0)]}),_0x1a9047=_0x1e2b5a[_0x3032e2(0x123)][_0x3032e2(0x185)](_0x3dbb1d=>_0x3dbb1d[_0x3032e2(0xfb)][_0x3032e2(0x15b)]===_0x357bb6);if(_0x1a9047&&!_0x2e5102['yes']){const _0x23bcea=await confirm(_0x3032e2(0x182)+_0x357bb6+_0x3032e2(0x136));if(!_0x23bcea)return console[_0x3032e2(0x1bf)](_0x3032e2(0x17d)),0x0;}}const _0x5b2959=await withSpinner(_0x9e8713?'Validating\x20backup\x20from\x20\x27'+_0x115396+_0x3032e2(0x107):_0x3032e2(0x15d)+_0x115396+_0x3032e2(0x107),()=>_0x3694c6[_0x3032e2(0x175)][_0x3032e2(0x124)](_0x115396,{'name':_0x4f5327,'dryRun':_0x9e8713}),{'verbose':_0x2e5102['verbose']}),_0x2a0ac8=_0x5b2959[_0x3032e2(0x123)];return _0x2a0ac8['sourceSite']&&console[_0x3032e2(0x1bf)](_0x3032e2(0x14c)+_0x2a0ac8['sourceSite']+'\x27'),_0x9e8713?console[_0x3032e2(0x1bf)]('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x2a0ac8[_0x3032e2(0x16b)]):console['log'](_0x3032e2(0xf6)+_0x2a0ac8[_0x3032e2(0x16b)]+'\x20('+_0x2a0ac8[_0x3032e2(0x155)]+')'),console[_0x3032e2(0x1bf)](_0x3032e2(0x195)+_0x2a0ac8[_0x3032e2(0x145)][_0x3032e2(0x129)]),console[_0x3032e2(0x1bf)]('\x20\x20Knowledge\x20Bases:\x20'+_0x2a0ac8[_0x3032e2(0x145)]['knowledgeBases']),console[_0x3032e2(0x1bf)](_0x3032e2(0x1b8)+_0x2a0ac8[_0x3032e2(0x145)]['prompts']),console['log'](_0x3032e2(0x1a6)+_0x2a0ac8[_0x3032e2(0x145)][_0x3032e2(0x167)]),(_0x2e5102[_0x3032e2(0xff)]===_0x3032e2(0x1ac)||_0x2e5102[_0x3032e2(0xff)]===_0x3032e2(0x17b))&&await handleSDKOutput([_0x2a0ac8],_0x2e5102),0x0;}catch(_0x373699){return handleSDKError(_0x373699,_0x2e5102),0x1;}}}function a20_0x3016(_0x59abfc,_0xff2656){_0x59abfc=_0x59abfc-0xec;const _0x21fded=a20_0x21fd();let _0x301659=_0x21fded[_0x59abfc];return _0x301659;}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x3f05e4,_0x4b4d0d){const _0x963817=a20_0x4c00e2,_0x29f42d=_0x4b4d0d[_0x963817(0x125)]||CHAT_SELECTOR_PAGE_SIZE;let _0x39d2c1=0x0,_0x1bb02c=[];const _0x6ac859=(await import('prompts'))[_0x963817(0x156)],_0x168fc1=getChalk(_0x4b4d0d);while(!![]){const _0x152955=await withSpinner(_0x963817(0x12d),()=>_0x3f05e4[_0x963817(0x175)][_0x963817(0x1c9)](_0x29f42d+_0x39d2c1),{'verbose':_0x4b4d0d['verbose']});_0x1bb02c=_0x152955[_0x963817(0x123)];const _0xa3ab79=_0x1bb02c[_0x963817(0x14b)](_0x39d2c1,_0x39d2c1+_0x29f42d),_0x175f5b=_0x1bb02c['length']>_0x39d2c1+_0x29f42d,_0xd682b7=[...new Set(_0xa3ab79[_0x963817(0x162)](_0x4b8ae8=>_0x4b8ae8['attributes']['agentId'])[_0x963817(0x104)](_0x3a1600=>_0x3a1600!==undefined))],_0x3b2ae8=new Map();await Promise[_0x963817(0x176)](_0xd682b7[_0x963817(0x162)](async _0x4a0e93=>{const _0x1e4019=_0x963817;try{const _0x3b181d=await _0x3f05e4[_0x1e4019(0x175)][_0x1e4019(0x173)](_0x4a0e93);_0x3b2ae8[_0x1e4019(0x192)](_0x4a0e93,_0x3b181d[_0x1e4019(0xfb)][_0x1e4019(0x15b)]);}catch{_0x3b2ae8['set'](_0x4a0e93,_0x4a0e93);}}));const _0xd2e9d0=_0xa3ab79[_0x963817(0x162)](_0x118f10=>{const _0x118774=_0x963817,_0x575a0f=_0x118f10[_0x118774(0xfb)][_0x118774(0x178)]||'(no\x20message)',_0x11a989=_0x575a0f['split']('\x0a')[0x0],_0x45d8b7=_0x11a989['length']>0x50?_0x11a989[_0x118774(0x111)](0x0,0x4d)+_0x118774(0xfa):_0x11a989,_0x35c4a9=_0x118f10[_0x118774(0xfb)][_0x118774(0x10b)]?_0x3b2ae8[_0x118774(0x1c1)](_0x118f10[_0x118774(0xfb)][_0x118774(0x10b)])||_0x118f10['attributes']['agentId']:'(no\x20agent)',_0x27c5a7=_0x118f10[_0x118774(0xfb)][_0x118774(0x1b0)]||_0x118f10['attributes'][_0x118774(0x1a1)],_0x50f085=new Date(_0x27c5a7),_0x394e48=new Date(),_0x3678ff=_0x394e48[_0x118774(0x10f)]()-_0x50f085[_0x118774(0x10f)](),_0x41a4ae=Math[_0x118774(0xef)](_0x3678ff/0xea60),_0x4cedc0=Math['floor'](_0x3678ff/0x36ee80),_0x1960ce=Math[_0x118774(0xef)](_0x3678ff/0x5265c00);let _0xf9016b;if(_0x41a4ae<0x1)_0xf9016b=_0x118774(0x105);else{if(_0x41a4ae<0x3c)_0xf9016b=_0x41a4ae+_0x118774(0xee);else{if(_0x4cedc0<0x18)_0xf9016b=_0x4cedc0+_0x118774(0x127);else _0x1960ce<0x7?_0xf9016b=_0x1960ce+'d\x20ago':_0xf9016b=_0x50f085[_0x118774(0x1ab)]('en-US',{'month':'short','day':_0x118774(0x14f)});}}return{'title':_0x45d8b7+'\x20'+_0x168fc1[_0x118774(0x168)]('['+_0x35c4a9+']\x20'+_0xf9016b),'value':_0x118f10['id']};});_0x175f5b&&_0xd2e9d0['push']({'title':_0x168fc1[_0x963817(0x132)](_0x963817(0x1be)),'value':_0x963817(0x16f)});const _0xc8e50d=await _0x6ac859({'type':_0x963817(0x18f),'name':_0x963817(0x130),'message':'Select\x20a\x20chat\x20session:','choices':_0xd2e9d0,'hint':_0x963817(0x143)});if(!_0xc8e50d[_0x963817(0x130)])return undefined;if(_0xc8e50d['chatId']===_0x963817(0x16f)){_0x39d2c1+=_0x29f42d;continue;}return _0xc8e50d['chatId'];}}export class ChatsCommand extends BaseCommand{[a20_0x4c00e2(0x15b)]=a20_0x4c00e2(0x1c9);[a20_0x4c00e2(0x196)]=a20_0x4c00e2(0x186);async[a20_0x4c00e2(0x122)](_0x5aeb24){const _0x3949df=a20_0x4c00e2;return executeChatHistoryCommand(_0x5aeb24,_0x3949df(0x112));}}
@@ -1 +1 @@
1
- const a21_0x3d95b9=a21_0x136c;function a21_0x5a7c(){const _0x55c8ee=['close','110PjrsQo','created\x20on-demand\x20per\x20model','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','http://0.0.0.0:','logger','\x20\x20Agents:','27194013vDOenp','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','Resolving\x20project...','\x27\x20not\x20found','init','742vEMFen','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','\x20\x20Address:','llm:proxy','\x0a\x0aShutting\x20down\x20proxy\x20server...','✓\x20Proxy\x20server\x20stopped','description','Starting\x20proxy\x20server...','bold','yellow','white','6979930ooVVfe','68AvUToV','\x20\x20Project:','\x0aTesting\x20with\x20Agent\x20SDK:','site','server','execute','log','find','dim','projects','project','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','43080jlPinZ','Project\x20\x27','getOrCreateDefaultProject','343394lgKVNT','\x20\x20{','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','llm','\x20\x20Site:','attributes','port','8008herFYP','name','logLevel','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','stop','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','SIGINT','154135NflhAf','NOT_FOUND','cyan','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','9EniesP','llmProject','Server\x20Configuration:','1956522SPvHsj','\x20is\x20unavailable,\x20using\x20port\x20'];a21_0x5a7c=function(){return _0x55c8ee;};return a21_0x5a7c();}(function(_0x12d2ec,_0x52773f){const _0x53ab83=a21_0x136c,_0x1cd01c=_0x12d2ec();while(!![]){try{const _0x33f86d=parseInt(_0x53ab83(0x215))/0x1+parseInt(_0x53ab83(0x1ec))/0x2*(-parseInt(_0x53ab83(0x212))/0x3)+parseInt(_0x53ab83(0x205))/0x4*(-parseInt(_0x53ab83(0x1e2))/0x5)+-parseInt(_0x53ab83(0x1e9))/0x6+-parseInt(_0x53ab83(0x1f8))/0x7*(-parseInt(_0x53ab83(0x1da))/0x8)+-parseInt(_0x53ab83(0x1e6))/0x9*(parseInt(_0x53ab83(0x204))/0xa)+parseInt(_0x53ab83(0x1f3))/0xb;if(_0x33f86d===_0x52773f)break;else _0x1cd01c['push'](_0x1cd01c['shift']());}catch(_0x1acda7){_0x1cd01c['push'](_0x1cd01c['shift']());}}}(a21_0x5a7c,0x8e840));import a21_0x1ed71e 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_0x136c(_0x1fa57b,_0x1b1c0d){_0x1fa57b=_0x1fa57b-0x1d5;const _0x5a7c29=a21_0x5a7c();let _0x136c51=_0x5a7c29[_0x1fa57b];return _0x136c51;}import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x3a9a1e,_0x587020){const _0x3cfc59=a21_0x136c,{tdx:_0xef36b4,options:_0x253715}=_0x3a9a1e,_0x37df96=_0x587020||_0x253715[_0x3cfc59(0x1e7)];if(_0x37df96){const _0x1ba055=await _0xef36b4[_0x3cfc59(0x1d6)][_0x3cfc59(0x20e)](),_0x2ddee2=_0x1ba055[_0x3cfc59(0x20c)](_0x11a2df=>_0x11a2df['attributes'][_0x3cfc59(0x1db)]===_0x37df96);if(!_0x2ddee2)throw new SDKError(ErrorCode[_0x3cfc59(0x1e3)],_0x3cfc59(0x213)+_0x37df96+_0x3cfc59(0x1f6),undefined,{'helpText':_0x3cfc59(0x211)});return _0x2ddee2['id'];}const _0x45c55f=await _0xef36b4[_0x3cfc59(0x1d6)][_0x3cfc59(0x214)]();return _0x45c55f['id'];}export class LLMProxyCommand extends BaseCommand{[a21_0x3d95b9(0x1db)]=a21_0x3d95b9(0x1fc);[a21_0x3d95b9(0x1ff)]=a21_0x3d95b9(0x1fa);[a21_0x3d95b9(0x209)];[a21_0x3d95b9(0x1f1)];async[a21_0x3d95b9(0x20a)](_0x3d27b8){const _0xf2368f=a21_0x3d95b9,{tdx:_0x291d05,options:_0x550b57}=_0x3d27b8;try{const _0xd0108d=_0x550b57,_0x44c337=_0xd0108d[_0xf2368f(0x1d9)]||0xfa0,_0x4ca7ce=_0xd0108d[_0xf2368f(0x20f)],_0x3a2795=await findAvailablePort(_0x44c337);console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x20d)](_0xf2368f(0x1f5)));const _0x2df26e=await getProjectIdOrDefault(_0x3d27b8,_0x4ca7ce),_0xbe13a8=await _0x291d05[_0xf2368f(0x1d6)][_0xf2368f(0x20e)](),_0xd091eb=_0xbe13a8[_0xf2368f(0x20c)](_0xeb1555=>_0xeb1555['id']===_0x2df26e);this['logger']=new TDXLogger(_0x550b57[_0xf2368f(0x1dc)]),await this[_0xf2368f(0x1f1)][_0xf2368f(0x1f7)](),console[_0xf2368f(0x20b)](a21_0x1ed71e['dim'](_0xf2368f(0x200)));_0x3a2795!==_0x44c337&&console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x202)]('Port\x20'+_0x44c337+_0xf2368f(0x1ea)+_0x3a2795));this['server']=new ProxyServer({'port':_0x3a2795,'projectId':_0x2df26e,'tdx':_0x291d05,'logger':this['logger'],'site':_0x550b57[_0xf2368f(0x208)]}),await this['server']['start'](),console[_0xf2368f(0x20b)](a21_0x1ed71e['yellow'][_0xf2368f(0x201)](_0xf2368f(0x1e0))),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x202)](_0xf2368f(0x1df))),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x202)](_0xf2368f(0x1dd))),console['log'](a21_0x1ed71e['green'][_0xf2368f(0x201)]('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0xf2368f(0x20b)](a21_0x1ed71e['cyan'](_0xf2368f(0x1e8))),console[_0xf2368f(0x20b)](a21_0x1ed71e['dim'](_0xf2368f(0x1fb)),a21_0x1ed71e[_0xf2368f(0x203)](_0xf2368f(0x1f0)+_0x3a2795)),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x20d)](_0xf2368f(0x206)),a21_0x1ed71e[_0xf2368f(0x203)](_0xd091eb?.[_0xf2368f(0x1d8)][_0xf2368f(0x1db)]||_0x2df26e)),console['log'](a21_0x1ed71e['dim'](_0xf2368f(0x1f2)),a21_0x1ed71e[_0xf2368f(0x203)](_0xf2368f(0x1ed))),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x20d)](_0xf2368f(0x1d7)),a21_0x1ed71e[_0xf2368f(0x203)](_0x550b57['site'])),console[_0xf2368f(0x20b)](a21_0x1ed71e['cyan']('\x0aClaude\x20Code\x20Configuration:')),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x20d)](_0xf2368f(0x1d5))),console[_0xf2368f(0x20b)](a21_0x1ed71e['white'](_0xf2368f(0x216))),console[_0xf2368f(0x20b)](a21_0x1ed71e['white']('\x20\x20\x20\x20\x22env\x22:\x20{')),console['log'](a21_0x1ed71e['white'](_0xf2368f(0x1f9)+_0x3a2795+'\x22,')),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x203)](_0xf2368f(0x210))),console['log'](a21_0x1ed71e[_0xf2368f(0x203)](_0xf2368f(0x1ee))),console['log'](a21_0x1ed71e[_0xf2368f(0x203)]('\x20\x20\x20\x20}')),console[_0xf2368f(0x20b)](a21_0x1ed71e['white']('\x20\x20}')),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x1e4)](_0xf2368f(0x207))),console['log'](a21_0x1ed71e[_0xf2368f(0x20d)]('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console['log'](a21_0x1ed71e[_0xf2368f(0x20d)](_0xf2368f(0x1ef))),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x20d)](_0xf2368f(0x1e5))),console[_0xf2368f(0x20b)](a21_0x1ed71e[_0xf2368f(0x202)](_0xf2368f(0x1f4)));const _0x12f8a6=async()=>{const _0x5648db=_0xf2368f;console[_0x5648db(0x20b)](a21_0x1ed71e[_0x5648db(0x20d)](_0x5648db(0x1fd))),this['server']&&await this[_0x5648db(0x209)][_0x5648db(0x1de)](),this[_0x5648db(0x1f1)]&&await this[_0x5648db(0x1f1)][_0x5648db(0x1eb)](),console[_0x5648db(0x20b)](a21_0x1ed71e['green'](_0x5648db(0x1fe))),process['exit'](0x0);};return process['on'](_0xf2368f(0x1e1),_0x12f8a6),process['on']('SIGTERM',_0x12f8a6),await new Promise(()=>{}),0x0;}catch(_0x360ee7){this[_0xf2368f(0x209)]&&await this[_0xf2368f(0x209)][_0xf2368f(0x1de)]();this[_0xf2368f(0x1f1)]&&await this[_0xf2368f(0x1f1)][_0xf2368f(0x1eb)]();throw _0x360ee7;}}}
1
+ const a21_0x31cdc4=a21_0x4f71;(function(_0x310c30,_0xae65ce){const _0x8345b3=a21_0x4f71,_0x23f516=_0x310c30();while(!![]){try{const _0x463e93=parseInt(_0x8345b3(0xf3))/0x1*(-parseInt(_0x8345b3(0xdf))/0x2)+parseInt(_0x8345b3(0xd5))/0x3+parseInt(_0x8345b3(0x113))/0x4+parseInt(_0x8345b3(0xef))/0x5*(parseInt(_0x8345b3(0xee))/0x6)+-parseInt(_0x8345b3(0xe8))/0x7*(parseInt(_0x8345b3(0xec))/0x8)+parseInt(_0x8345b3(0xfe))/0x9+-parseInt(_0x8345b3(0xf2))/0xa*(parseInt(_0x8345b3(0x101))/0xb);if(_0x463e93===_0xae65ce)break;else _0x23f516['push'](_0x23f516['shift']());}catch(_0x1262bd){_0x23f516['push'](_0x23f516['shift']());}}}(a21_0x1b71,0x37c9d));import a21_0x5e625c from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a21_0x4f71(_0x19dc00,_0x176dd8){_0x19dc00=_0x19dc00-0xd5;const _0x1b711c=a21_0x1b71();let _0x4f71d0=_0x1b711c[_0x19dc00];return _0x4f71d0;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';function a21_0x1b71(){const _0x28496b=['init','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','285523nCLCIY','dim','\x20\x20\x20\x20\x22env\x22:\x20{','find','72kYGpzI','stop','6OdcbKw','2012215PEVITp','SIGINT','SIGTERM','183550ciDnyy','409tpldYA','project','\x0aClaude\x20Code\x20Configuration:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','cyan','Port\x20','bold','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','port','description','2435661VyZMcb','llm','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','220yQSRfn','projects','close','name','green','\x20\x20Agents:','yellow','server','Starting\x20proxy\x20server...','Project\x20\x27','log','execute','http://0.0.0.0:','exit','logger','Resolving\x20project...','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','Server\x20Configuration:','983012ApIbEs','NOT_FOUND','221226YNCLKQ','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','white','logLevel','created\x20on-demand\x20per\x20model','\x20\x20}','start','\x20is\x20unavailable,\x20using\x20port\x20','attributes','site','146FHTUQA','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20Site:','\x20\x20{','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'];a21_0x1b71=function(){return _0x28496b;};return a21_0x1b71();}async function getProjectIdOrDefault(_0x47d22c,_0x344928){const _0x57e4ef=a21_0x4f71,{tdx:_0x556418,options:_0x2f1ead}=_0x47d22c,_0x51c52e=_0x344928||_0x2f1ead['llmProject'];if(_0x51c52e){const _0x36e920=await _0x556418[_0x57e4ef(0xff)][_0x57e4ef(0x102)](),_0x32ec37=_0x36e920[_0x57e4ef(0xeb)](_0x44eab1=>_0x44eab1[_0x57e4ef(0xdd)][_0x57e4ef(0x104)]===_0x51c52e);if(!_0x32ec37)throw new SDKError(ErrorCode[_0x57e4ef(0x114)],_0x57e4ef(0x10a)+_0x51c52e+'\x27\x20not\x20found',undefined,{'helpText':_0x57e4ef(0xe1)});return _0x32ec37['id'];}const _0x270a0d=await _0x556418[_0x57e4ef(0xff)]['getOrCreateDefaultProject']();return _0x270a0d['id'];}export class LLMProxyCommand extends BaseCommand{['name']='llm:proxy';[a21_0x31cdc4(0xfd)]=a21_0x31cdc4(0x111);[a21_0x31cdc4(0x108)];[a21_0x31cdc4(0x10f)];async[a21_0x31cdc4(0x10c)](_0x4e477c){const _0xa65385=a21_0x31cdc4,{tdx:_0x15739a,options:_0x3a8973}=_0x4e477c;try{const _0x49a4c7=_0x3a8973,_0x94dc57=_0x49a4c7[_0xa65385(0xfc)]||0xfa0,_0x4295f0=_0x49a4c7[_0xa65385(0xf4)],_0x243163=await findAvailablePort(_0x94dc57);console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0x110)));const _0x49b89d=await getProjectIdOrDefault(_0x4e477c,_0x4295f0),_0x2d9f28=await _0x15739a[_0xa65385(0xff)][_0xa65385(0x102)](),_0x2cf88e=_0x2d9f28['find'](_0x13e626=>_0x13e626['id']===_0x49b89d);this[_0xa65385(0x10f)]=new TDXLogger(_0x3a8973[_0xa65385(0xd8)]),await this[_0xa65385(0x10f)][_0xa65385(0xe6)](),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0x109)));_0x243163!==_0x94dc57&&console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)](_0xa65385(0xf9)+_0x94dc57+_0xa65385(0xdc)+_0x243163));this[_0xa65385(0x108)]=new ProxyServer({'port':_0x243163,'projectId':_0x49b89d,'tdx':_0x15739a,'logger':this[_0xa65385(0x10f)],'site':_0x3a8973[_0xa65385(0xde)]}),await this[_0xa65385(0x108)][_0xa65385(0xdb)](),console[_0xa65385(0x10b)](a21_0x5e625c['yellow']['bold']('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)](_0xa65385(0xd6))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)]('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x105)][_0xa65385(0xfa)](_0xa65385(0xe7))),console['log'](a21_0x5e625c[_0xa65385(0xf8)](_0xa65385(0x112))),console['log'](a21_0x5e625c['dim']('\x20\x20Address:'),a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0x10d)+_0x243163)),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)]('\x20\x20Project:'),a21_0x5e625c[_0xa65385(0xd7)](_0x2cf88e?.[_0xa65385(0xdd)][_0xa65385(0x104)]||_0x49b89d)),console['log'](a21_0x5e625c['dim'](_0xa65385(0x106)),a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xd9))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0xe3)),a21_0x5e625c[_0xa65385(0xd7)](_0x3a8973['site'])),console['log'](a21_0x5e625c[_0xa65385(0xf8)](_0xa65385(0xf5))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0xf6))),console[_0xa65385(0x10b)](a21_0x5e625c['white'](_0xa65385(0xe4))),console[_0xa65385(0x10b)](a21_0x5e625c['white'](_0xa65385(0xea))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xd7)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x243163+'\x22,')),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xfb))),console['log'](a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xe0))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xd7)]('\x20\x20\x20\x20}')),console['log'](a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xda))),console['log'](a21_0x5e625c[_0xa65385(0xf8)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0x100))),console[_0xa65385(0x10b)](a21_0x5e625c['dim'](_0xa65385(0xe2))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0xf7))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)](_0xa65385(0xe5)));const _0x557da9=async()=>{const _0x55d94b=_0xa65385;console['log'](a21_0x5e625c[_0x55d94b(0xe9)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x55d94b(0x108)]&&await this[_0x55d94b(0x108)][_0x55d94b(0xed)](),this[_0x55d94b(0x10f)]&&await this['logger']['close'](),console['log'](a21_0x5e625c[_0x55d94b(0x105)]('✓\x20Proxy\x20server\x20stopped')),process[_0x55d94b(0x10e)](0x0);};return process['on'](_0xa65385(0xf0),_0x557da9),process['on'](_0xa65385(0xf1),_0x557da9),await new Promise(()=>{}),0x0;}catch(_0x1377a7){this[_0xa65385(0x108)]&&await this[_0xa65385(0x108)][_0xa65385(0xed)]();this[_0xa65385(0x10f)]&&await this[_0xa65385(0x10f)][_0xa65385(0x103)]();throw _0x1377a7;}}}