@treasuredata/tdx 0.24.0 → 0.25.1

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 (175) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.d.ts +14 -3
  13. package/dist/commands/chat-command.d.ts.map +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/chat-command.js.map +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/job-command.js +1 -1
  25. package/dist/commands/journey-command.js +1 -1
  26. package/dist/commands/journey-validate-command.js +1 -1
  27. package/dist/commands/llm-command.js +1 -1
  28. package/dist/commands/mcp-command.js +1 -1
  29. package/dist/commands/parent-segment-command.js +1 -1
  30. package/dist/commands/profile-command.js +1 -1
  31. package/dist/commands/profiles-command.js +1 -1
  32. package/dist/commands/query-command.js +1 -1
  33. package/dist/commands/schedule-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segment-validate-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/status-command.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/unset-command.js +1 -1
  47. package/dist/commands/use-command.js +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/command-output.js +1 -1
  52. package/dist/core/config.js +1 -1
  53. package/dist/core/connection-cache.js +1 -1
  54. package/dist/core/constants.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/core/version.js +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/mcp/server.js +1 -1
  65. package/dist/mcp/tools/index.js +1 -1
  66. package/dist/mcp/tools/tdx-run.js +1 -1
  67. package/dist/mcp/tools/tdx-search.js +1 -1
  68. package/dist/mcp/utils.js +1 -1
  69. package/dist/proxy/claude-usage-tracker.js +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/sse-usage-parser.js +1 -1
  72. package/dist/sdk/agent/agent-config.js +1 -1
  73. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  74. package/dist/sdk/agent/agent-yaml.js +1 -1
  75. package/dist/sdk/agent/test/evaluator.js +1 -1
  76. package/dist/sdk/agent/test/executor.js +1 -1
  77. package/dist/sdk/agent/test/index.js +1 -1
  78. package/dist/sdk/agent/test/output.js +1 -1
  79. package/dist/sdk/agent/test/parser.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/endpoints.js +1 -1
  83. package/dist/sdk/client/engage-api-client.js +1 -1
  84. package/dist/sdk/client/http-client.js +1 -1
  85. package/dist/sdk/client/llm-api-client.js +1 -1
  86. package/dist/sdk/client/rate-limiter.js +1 -1
  87. package/dist/sdk/client/td-api-client.js +1 -1
  88. package/dist/sdk/client/trino-api-client.js +1 -1
  89. package/dist/sdk/client/workflow-client.js +1 -1
  90. package/dist/sdk/connection-validator.js +1 -1
  91. package/dist/sdk/connection.js +1 -1
  92. package/dist/sdk/engage.js +1 -1
  93. package/dist/sdk/errors.js +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/io/index.js +1 -1
  96. package/dist/sdk/io/node-filesystem.js +1 -1
  97. package/dist/sdk/job.js +1 -1
  98. package/dist/sdk/journey.js +1 -1
  99. package/dist/sdk/llm/chat-cache.js +1 -1
  100. package/dist/sdk/llm/index.d.ts.map +1 -1
  101. package/dist/sdk/llm/index.js +1 -1
  102. package/dist/sdk/llm/index.js.map +1 -1
  103. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  104. package/dist/sdk/llm/model-factors.d.ts +4 -4
  105. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  106. package/dist/sdk/llm/model-factors.js +1 -1
  107. package/dist/sdk/llm/model-factors.js.map +1 -1
  108. package/dist/sdk/query/index.js +1 -1
  109. package/dist/sdk/query/sql-parser.js +1 -1
  110. package/dist/sdk/schedule.js +1 -1
  111. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  112. package/dist/sdk/segment/fields-display.js +1 -1
  113. package/dist/sdk/segment/file-discovery.js +1 -1
  114. package/dist/sdk/segment/journey-utils.js +1 -1
  115. package/dist/sdk/segment/journey-yaml.js +1 -1
  116. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  117. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/pull-workflow.js +1 -1
  119. package/dist/sdk/segment/push-workflow.js +1 -1
  120. package/dist/sdk/segment/resolution-context.js +1 -1
  121. package/dist/sdk/segment/segment-path-parser.js +1 -1
  122. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  123. package/dist/sdk/segment/target-resolution.js +1 -1
  124. package/dist/sdk/segment/tdx-config.js +1 -1
  125. package/dist/sdk/segment/validate-files.js +1 -1
  126. package/dist/sdk/segment/yaml-validator.js +1 -1
  127. package/dist/sdk/segment.js +1 -1
  128. package/dist/sdk/types/index.js +1 -1
  129. package/dist/sdk/types/llm.d.ts +1 -0
  130. package/dist/sdk/types/llm.d.ts.map +1 -1
  131. package/dist/sdk/types/progress.js +1 -1
  132. package/dist/sdk/user.js +1 -1
  133. package/dist/sdk/util/format-detector.js +1 -1
  134. package/dist/sdk/util/formatters.js +1 -1
  135. package/dist/sdk/util/index.js +1 -1
  136. package/dist/sdk/util/tree-formatter.js +1 -1
  137. package/dist/sdk/workflow/archive-validation.js +1 -1
  138. package/dist/sdk/workflow/clone-workflow.js +1 -1
  139. package/dist/sdk/workflow/index.js +1 -1
  140. package/dist/sdk/workflow/pull-workflow.js +1 -1
  141. package/dist/sdk/workflow/push-workflow.js +1 -1
  142. package/dist/sdk/workflow/tdx-config.js +1 -1
  143. package/dist/sdk/workflow/workflow-utils.js +1 -1
  144. package/dist/test-utils/command-runner.js +1 -1
  145. package/dist/test-utils/factories.js +1 -1
  146. package/dist/test-utils/fixtures.js +1 -1
  147. package/dist/test-utils/http-mock.js +1 -1
  148. package/dist/test-utils/index.js +1 -1
  149. package/dist/utils/async.js +1 -1
  150. package/dist/utils/colors.js +1 -1
  151. package/dist/utils/diff.js +1 -1
  152. package/dist/utils/file-permissions.js +1 -1
  153. package/dist/utils/global-cache.js +1 -1
  154. package/dist/utils/json-loader.js +1 -1
  155. package/dist/utils/local-cache.js +1 -1
  156. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  157. package/dist/utils/logger/formatters/index.js +1 -1
  158. package/dist/utils/logger/handlers/console-handler.js +1 -1
  159. package/dist/utils/logger/handlers/file-handler.js +1 -1
  160. package/dist/utils/logger/handlers/index.js +1 -1
  161. package/dist/utils/logger/handlers/null-handler.js +1 -1
  162. package/dist/utils/logger/index.js +1 -1
  163. package/dist/utils/logger/logger.js +1 -1
  164. package/dist/utils/logger/types.js +1 -1
  165. package/dist/utils/option-validation.js +1 -1
  166. package/dist/utils/port.js +1 -1
  167. package/dist/utils/process.js +1 -1
  168. package/dist/utils/prompt.js +1 -1
  169. package/dist/utils/spinner.js +1 -1
  170. package/dist/utils/sse-parser.js +1 -1
  171. package/dist/utils/string-utils.js +1 -1
  172. package/dist/utils/table-ref-parser.js +1 -1
  173. package/dist/utils/tdx-logger.js +1 -1
  174. package/dist/utils/version-check.js +1 -1
  175. package/package.json +1 -1
@@ -1 +1 @@
1
- const a17_0x23e483=a17_0x5379;(function(_0xb66314,_0x1473cf){const _0x53410a=a17_0x5379,_0x551eb8=_0xb66314();while(!![]){try{const _0x20d1ce=parseInt(_0x53410a(0x15a))/0x1*(-parseInt(_0x53410a(0x13b))/0x2)+parseInt(_0x53410a(0x144))/0x3+-parseInt(_0x53410a(0x132))/0x4+-parseInt(_0x53410a(0x133))/0x5+parseInt(_0x53410a(0x155))/0x6*(parseInt(_0x53410a(0x152))/0x7)+-parseInt(_0x53410a(0x12d))/0x8+parseInt(_0x53410a(0x165))/0x9;if(_0x20d1ce===_0x1473cf)break;else _0x551eb8['push'](_0x551eb8['shift']());}catch(_0x550f4e){_0x551eb8['push'](_0x551eb8['shift']());}}}(a17_0x47f8,0x98be6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}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_0x23e483(0x150);['description']=a17_0x23e483(0x170);async[a17_0x23e483(0x166)](_0x1ac967){const _0x1b01dc=a17_0x23e483,{options:_0x304010,tdx:_0x13adda}=_0x1ac967,_0x51116b=resolveLimit(_0x304010['limit'],DEFAULT_DISPLAY_LIMIT),_0x3f3405=_0x304010[_0x1b01dc(0x131)];_0x304010['verbose']&&(console[_0x1b01dc(0x161)](_0x1b01dc(0x124)+_0x51116b+_0x1b01dc(0x134)),_0x3f3405&&console[_0x1b01dc(0x161)](_0x1b01dc(0x15d)+_0x3f3405));const _0x54b3ad=await withSpinner(_0x1b01dc(0x15e),()=>_0x13adda[_0x1b01dc(0x150)][_0x1b01dc(0x13c)]({'from':0x0,'to':_0x51116b-0x1,'status':_0x3f3405}),{'verbose':_0x304010[_0x1b01dc(0x127)]}),_0x116c03=_0x54b3ad[_0x1b01dc(0x14f)];console['error'](_0x1b01dc(0x14b)+_0x116c03[_0x1b01dc(0x130)]+_0x1b01dc(0x146)+(_0x116c03[_0x1b01dc(0x130)]!==0x1?'s':''));const _0x4e1bde=_0x116c03[_0x1b01dc(0x159)](_0x217334=>{const _0x1eb2af=_0x1b01dc;let _0x1f396b;if(_0x217334['start_at']&&_0x217334[_0x1eb2af(0x16b)]){const _0x5c4f2c=new Date(_0x217334[_0x1eb2af(0x135)])[_0x1eb2af(0x16d)](),_0x3c631b=new Date(_0x217334[_0x1eb2af(0x16b)])[_0x1eb2af(0x16d)]();_0x1f396b=Math[_0x1eb2af(0x157)]((_0x3c631b-_0x5c4f2c)/0x3e8);}return{'job_id':_0x217334['job_id'],'type':_0x217334[_0x1eb2af(0x137)],'status':_0x217334[_0x1eb2af(0x131)],'user_name':_0x217334['user_name'],'duration_sec':_0x1f396b,'created_at':_0x217334[_0x1eb2af(0x15b)],'started_at':_0x217334[_0x1eb2af(0x135)],'end_at':_0x217334['end_at']};});return await handleSDKOutput(_0x4e1bde,_0x304010),0x0;}}function a17_0x47f8(){const _0x58eb4e=['description','job:submit','information_schema','\x20\x20Job\x20ID:\x20','✔\x20Found\x20','Show\x20job\x20details','user_name','\x20row','data','jobs','job:result','21BWNTMx','\x27\x20to\x20verify\x20the\x20job\x20status','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','1333524TxGNPX','Query:\x20','round','database','map','3cGGMUl','created_at','job:kill','Status\x20filter:\x20','Listing\x20jobs...','Submit\x20a\x20job','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','error','kill','name','debug','15566094kHSEHY','execute','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','No\x20SQL\x20statements\x20found\x20in\x20file','✔\x20Retrieved\x20','hive','end_at','query','getTime','substring','url','List\x20jobs','✔\x20Job\x20submitted','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','Limit:\x20','trino','job:show','verbose','Submitting\x20kill\x20request...','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','...','INVALID_ARGUMENT','file','1001128fSgizn','yes','priority','length','status','865428cPTZel','5283130MzDLYj','\x20jobs','start_at','Get\x20job\x20results','type','jobType','job_id','Getting\x20job\x20details...','667770PqOlAI','list','Job\x20type:\x20','Database:\x20','result','args','Kill\x20a\x20job','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','1887267cCQdvI','validate','\x20job'];a17_0x47f8=function(){return _0x58eb4e;};return a17_0x47f8();}export class JobShowCommand extends BaseCommand{[a17_0x23e483(0x163)]=a17_0x23e483(0x126);[a17_0x23e483(0x147)]=a17_0x23e483(0x14c);[a17_0x23e483(0x145)](_0x3a0090){const _0x1e7393=a17_0x23e483,_0x2c36fa=_0x3a0090[_0x1e7393(0x140)][0x0];if(!_0x2c36fa)return _0x1e7393(0x123);return undefined;}async[a17_0x23e483(0x166)](_0x195d56){const _0x2f4337=a17_0x23e483,{options:_0x72fc3c,args:_0x536502,tdx:_0x3491c2}=_0x195d56,_0x5c091f=_0x536502[0x0],_0x53f3f1=await withSpinner(_0x2f4337(0x13a),()=>_0x3491c2[_0x2f4337(0x150)]['show'](_0x5c091f),{'verbose':_0x72fc3c[_0x2f4337(0x127)]}),_0x45cd89=_0x53f3f1['data'];let _0x3efb15;if(_0x45cd89[_0x2f4337(0x135)]&&_0x45cd89['end_at']){const _0x41106c=new Date(_0x45cd89[_0x2f4337(0x135)])[_0x2f4337(0x16d)](),_0x595b6c=new Date(_0x45cd89[_0x2f4337(0x16b)])[_0x2f4337(0x16d)]();_0x3efb15=Math[_0x2f4337(0x157)]((_0x595b6c-_0x41106c)/0x3e8);}const _0x53694b={'job_id':_0x45cd89[_0x2f4337(0x139)],'type':_0x45cd89[_0x2f4337(0x137)],'status':_0x45cd89['status'],..._0x45cd89[_0x2f4337(0x14d)]&&{'user_name':_0x45cd89[_0x2f4337(0x14d)]},..._0x3efb15!==undefined&&{'duration_sec':_0x3efb15},..._0x45cd89[_0x2f4337(0x15b)]&&{'created_at':_0x45cd89[_0x2f4337(0x15b)]},..._0x45cd89[_0x2f4337(0x135)]&&{'started_at':_0x45cd89[_0x2f4337(0x135)]},..._0x45cd89[_0x2f4337(0x16b)]&&{'end_at':_0x45cd89[_0x2f4337(0x16b)]},..._0x45cd89[_0x2f4337(0x158)]&&{'database':_0x45cd89[_0x2f4337(0x158)]},..._0x45cd89[_0x2f4337(0x12f)]!==undefined&&{'priority':_0x45cd89[_0x2f4337(0x12f)]},..._0x45cd89[_0x2f4337(0x16f)]&&{'url':_0x45cd89['url']},..._0x45cd89[_0x2f4337(0x16c)]&&{'query':_0x45cd89[_0x2f4337(0x16c)]},..._0x45cd89[_0x2f4337(0x164)]&&{'debug':_0x45cd89['debug']}};return await handleSingleObjectOutput(_0x53694b,_0x72fc3c),0x0;}}export class JobKillCommand extends BaseCommand{['name']=a17_0x23e483(0x15c);[a17_0x23e483(0x147)]=a17_0x23e483(0x141);[a17_0x23e483(0x145)](_0x4594e5){const _0x30fec5=a17_0x23e483,_0x1d927e=_0x4594e5[_0x30fec5(0x140)][0x0];if(!_0x1d927e)return _0x30fec5(0x154);return undefined;}async['execute'](_0x15ddb2){const _0x26d59f=a17_0x23e483,{options:_0x940a51,args:_0x2c337a,tdx:_0x1988dd}=_0x15ddb2,_0x41d650=_0x2c337a[0x0];if(!_0x940a51[_0x26d59f(0x12e)]){const _0x156e6d=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x41d650+'?');if(!_0x156e6d)return console[_0x26d59f(0x161)]('Cancelled'),0x0;}return await withSpinner(_0x26d59f(0x128),()=>_0x1988dd[_0x26d59f(0x150)][_0x26d59f(0x162)](_0x41d650),{'verbose':_0x940a51['verbose']}),console[_0x26d59f(0x161)]('✔\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0x41d650),console[_0x26d59f(0x161)](_0x26d59f(0x160)+_0x41d650+_0x26d59f(0x153)),0x0;}}function a17_0x5379(_0x10ad13,_0x3025d0){_0x10ad13=_0x10ad13-0x122;const _0x47f8c5=a17_0x47f8();let _0x5379e4=_0x47f8c5[_0x10ad13];return _0x5379e4;}export class JobSubmitCommand extends BaseCommand{[a17_0x23e483(0x163)]=a17_0x23e483(0x148);[a17_0x23e483(0x147)]=a17_0x23e483(0x15f);async[a17_0x23e483(0x166)](_0x2f6e02){const _0x2c3ca9=a17_0x23e483,{options:_0x297195,args:_0x581431,tdx:_0x299fa4}=_0x2f6e02,_0x20dbb4=_0x297195[_0x2c3ca9(0x138)]||_0x2c3ca9(0x125),_0xea161b=_0x297195[_0x2c3ca9(0x12c)],_0x7f09a4=_0x297195[_0x2c3ca9(0x158)]||_0x2c3ca9(0x149);if(_0x20dbb4!==_0x2c3ca9(0x125)&&_0x20dbb4!==_0x2c3ca9(0x16a))throw new SDKError(ErrorCode[_0x2c3ca9(0x12b)],_0x2c3ca9(0x129));let _0x3d8407;if(_0xea161b){if(_0x581431[0x0])throw new SDKError(ErrorCode[_0x2c3ca9(0x12b)],_0x2c3ca9(0x143));const _0x5a994e=readSqlStatementsFromFile(_0xea161b);if(_0x5a994e[_0x2c3ca9(0x130)]===0x0)throw new SDKError(ErrorCode[_0x2c3ca9(0x12b)],_0x2c3ca9(0x168));if(_0x5a994e['length']>0x1)throw new SDKError(ErrorCode[_0x2c3ca9(0x12b)],_0x2c3ca9(0x167));_0x3d8407=_0x5a994e[0x0];}else{if(!_0x581431[0x0])throw new SDKError(ErrorCode[_0x2c3ca9(0x12b)],_0x2c3ca9(0x142));_0x3d8407=_0x581431[0x0];}_0x297195[_0x2c3ca9(0x127)]&&(console['error'](_0x2c3ca9(0x13d)+_0x20dbb4),console[_0x2c3ca9(0x161)](_0x2c3ca9(0x13e)+_0x7f09a4),console[_0x2c3ca9(0x161)](_0x2c3ca9(0x156)+_0x3d8407[_0x2c3ca9(0x16e)](0x0,0x64)+(_0x3d8407[_0x2c3ca9(0x130)]>0x64?_0x2c3ca9(0x12a):'')));const _0x32a09a=await withSpinner('Submitting\x20job...',()=>_0x299fa4[_0x2c3ca9(0x150)]['submit'](_0x7f09a4,_0x3d8407,_0x20dbb4),{'verbose':_0x297195[_0x2c3ca9(0x127)]}),_0x406d38=_0x32a09a[_0x2c3ca9(0x14f)];return console['error'](_0x2c3ca9(0x122)),console[_0x2c3ca9(0x161)](_0x2c3ca9(0x14a)+_0x406d38[_0x2c3ca9(0x139)]),await handleSDKOutput([_0x406d38],_0x297195),0x0;}}export class JobResultCommand extends BaseCommand{[a17_0x23e483(0x163)]=a17_0x23e483(0x151);[a17_0x23e483(0x147)]=a17_0x23e483(0x136);[a17_0x23e483(0x145)](_0x16b722){const _0x2e641c=_0x16b722['args'][0x0];if(!_0x2e641c)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>';return undefined;}async['execute'](_0x3c0cf1){const _0x9d750c=a17_0x23e483,{options:_0x32b90a,args:_0x325f0f,tdx:_0x920802}=_0x3c0cf1,_0x4c36c3=_0x325f0f[0x0],_0xf9eb83=await withSpinner('Getting\x20job\x20results...',()=>_0x920802[_0x9d750c(0x150)][_0x9d750c(0x13f)](_0x4c36c3),{'verbose':_0x32b90a['verbose']}),_0x18b5a0=_0xf9eb83[_0x9d750c(0x14f)];return console[_0x9d750c(0x161)](_0x9d750c(0x169)+_0x18b5a0[_0x9d750c(0x130)]+_0x9d750c(0x14e)+(_0x18b5a0['length']!==0x1?'s':'')),await handleSDKOutput(_0x18b5a0,_0x32b90a),0x0;}}
1
+ const a17_0x4fa1e0=a17_0x4b05;(function(_0x558e27,_0x22fe74){const _0x5539ad=a17_0x4b05,_0x8a706a=_0x558e27();while(!![]){try{const _0x52b8fe=-parseInt(_0x5539ad(0x7a))/0x1*(-parseInt(_0x5539ad(0xae))/0x2)+-parseInt(_0x5539ad(0x95))/0x3+-parseInt(_0x5539ad(0xb0))/0x4*(parseInt(_0x5539ad(0x7d))/0x5)+-parseInt(_0x5539ad(0x75))/0x6*(-parseInt(_0x5539ad(0xaa))/0x7)+-parseInt(_0x5539ad(0xa7))/0x8*(parseInt(_0x5539ad(0x80))/0x9)+parseInt(_0x5539ad(0x96))/0xa*(parseInt(_0x5539ad(0x88))/0xb)+parseInt(_0x5539ad(0xa8))/0xc*(parseInt(_0x5539ad(0xba))/0xd);if(_0x52b8fe===_0x22fe74)break;else _0x8a706a['push'](_0x8a706a['shift']());}catch(_0x34a901){_0x8a706a['push'](_0x8a706a['shift']());}}}(a17_0x5d58,0x22925));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x4fa1e0(0x78)]=a17_0x4fa1e0(0x76);[a17_0x4fa1e0(0x90)]=a17_0x4fa1e0(0xab);async[a17_0x4fa1e0(0xa1)](_0x3b9ba4){const _0x3419a6=a17_0x4fa1e0,{options:_0x18f0f9,tdx:_0x4f5ba1}=_0x3b9ba4,_0x53930d=resolveLimit(_0x18f0f9['limit'],DEFAULT_DISPLAY_LIMIT),_0x4e04a9=_0x18f0f9[_0x3419a6(0xb3)];_0x18f0f9[_0x3419a6(0x6f)]&&(console[_0x3419a6(0x91)](_0x3419a6(0x7b)+_0x53930d+_0x3419a6(0x89)),_0x4e04a9&&console['error'](_0x3419a6(0x97)+_0x4e04a9));const _0x19697e=await withSpinner('Listing\x20jobs...',()=>_0x4f5ba1[_0x3419a6(0x76)][_0x3419a6(0x71)]({'from':0x0,'to':_0x53930d-0x1,'status':_0x4e04a9}),{'verbose':_0x18f0f9['verbose']}),_0x491e8d=_0x19697e[_0x3419a6(0x9d)];console[_0x3419a6(0x91)](_0x3419a6(0xa2)+_0x491e8d[_0x3419a6(0x8e)]+_0x3419a6(0x87)+(_0x491e8d[_0x3419a6(0x8e)]!==0x1?'s':''));const _0x1825e1=_0x491e8d[_0x3419a6(0x92)](_0x4fa7ca=>{const _0x12478e=_0x3419a6;let _0x3cedcc;if(_0x4fa7ca[_0x12478e(0xa4)]&&_0x4fa7ca['end_at']){const _0x558cfa=new Date(_0x4fa7ca[_0x12478e(0xa4)])[_0x12478e(0x79)](),_0x4906f2=new Date(_0x4fa7ca[_0x12478e(0x7e)])[_0x12478e(0x79)]();_0x3cedcc=Math[_0x12478e(0x7c)]((_0x4906f2-_0x558cfa)/0x3e8);}return{'job_id':_0x4fa7ca[_0x12478e(0x6e)],'type':_0x4fa7ca[_0x12478e(0xb4)],'status':_0x4fa7ca[_0x12478e(0xb3)],'user_name':_0x4fa7ca[_0x12478e(0xac)],'duration_sec':_0x3cedcc,'created_at':_0x4fa7ca['created_at'],'started_at':_0x4fa7ca[_0x12478e(0xa4)],'end_at':_0x4fa7ca[_0x12478e(0x7e)]};});return await handleSDKOutput(_0x1825e1,_0x18f0f9),0x0;}}export class JobShowCommand extends BaseCommand{[a17_0x4fa1e0(0x78)]=a17_0x4fa1e0(0x94);[a17_0x4fa1e0(0x90)]=a17_0x4fa1e0(0x8c);[a17_0x4fa1e0(0xb5)](_0x4296e){const _0x4d8313=a17_0x4fa1e0,_0x2da37b=_0x4296e['args'][0x0];if(!_0x2da37b)return _0x4d8313(0x74);return undefined;}async[a17_0x4fa1e0(0xa1)](_0x25d2c2){const _0x5a7f09=a17_0x4fa1e0,{options:_0x3d5a19,args:_0x5f00d2,tdx:_0x17d5f7}=_0x25d2c2,_0x7e52b3=_0x5f00d2[0x0],_0x18fcb2=await withSpinner(_0x5a7f09(0x8f),()=>_0x17d5f7[_0x5a7f09(0x76)]['show'](_0x7e52b3),{'verbose':_0x3d5a19['verbose']}),_0x4a4084=_0x18fcb2[_0x5a7f09(0x9d)];let _0x2bed97;if(_0x4a4084[_0x5a7f09(0xa4)]&&_0x4a4084['end_at']){const _0x174a19=new Date(_0x4a4084[_0x5a7f09(0xa4)])[_0x5a7f09(0x79)](),_0x44146a=new Date(_0x4a4084[_0x5a7f09(0x7e)])[_0x5a7f09(0x79)]();_0x2bed97=Math[_0x5a7f09(0x7c)]((_0x44146a-_0x174a19)/0x3e8);}const _0x501503={'job_id':_0x4a4084['job_id'],'type':_0x4a4084[_0x5a7f09(0xb4)],'status':_0x4a4084[_0x5a7f09(0xb3)],..._0x4a4084[_0x5a7f09(0xac)]&&{'user_name':_0x4a4084[_0x5a7f09(0xac)]},..._0x2bed97!==undefined&&{'duration_sec':_0x2bed97},..._0x4a4084[_0x5a7f09(0xa5)]&&{'created_at':_0x4a4084[_0x5a7f09(0xa5)]},..._0x4a4084['start_at']&&{'started_at':_0x4a4084['start_at']},..._0x4a4084[_0x5a7f09(0x7e)]&&{'end_at':_0x4a4084[_0x5a7f09(0x7e)]},..._0x4a4084[_0x5a7f09(0x83)]&&{'database':_0x4a4084[_0x5a7f09(0x83)]},..._0x4a4084[_0x5a7f09(0x9c)]!==undefined&&{'priority':_0x4a4084[_0x5a7f09(0x9c)]},..._0x4a4084[_0x5a7f09(0xbb)]&&{'url':_0x4a4084[_0x5a7f09(0xbb)]},..._0x4a4084[_0x5a7f09(0xa0)]&&{'query':_0x4a4084[_0x5a7f09(0xa0)]},..._0x4a4084[_0x5a7f09(0x8d)]&&{'debug':_0x4a4084[_0x5a7f09(0x8d)]}};return await handleSingleObjectOutput(_0x501503,_0x3d5a19),0x0;}}export class JobKillCommand extends BaseCommand{[a17_0x4fa1e0(0x78)]=a17_0x4fa1e0(0x7f);['description']=a17_0x4fa1e0(0x6c);[a17_0x4fa1e0(0xb5)](_0x45b0e5){const _0x31563e=a17_0x4fa1e0,_0x3f5b57=_0x45b0e5[_0x31563e(0x9b)][0x0];if(!_0x3f5b57)return _0x31563e(0xb7);return undefined;}async['execute'](_0x21029b){const _0x2a1c68=a17_0x4fa1e0,{options:_0x5ac81c,args:_0x39c168,tdx:_0x46dfba}=_0x21029b,_0x4b6a12=_0x39c168[0x0];if(!_0x5ac81c[_0x2a1c68(0x8a)]){const _0x11c6ea=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x4b6a12+'?');if(!_0x11c6ea)return console[_0x2a1c68(0x91)](_0x2a1c68(0xb8)),0x0;}return await withSpinner(_0x2a1c68(0x8b),()=>_0x46dfba[_0x2a1c68(0x76)][_0x2a1c68(0x98)](_0x4b6a12),{'verbose':_0x5ac81c[_0x2a1c68(0x6f)]}),console[_0x2a1c68(0x91)](_0x2a1c68(0x82)+_0x4b6a12),console['error'](_0x2a1c68(0xb2)+_0x4b6a12+_0x2a1c68(0x77)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a17_0x4fa1e0(0x78)]=a17_0x4fa1e0(0x70);[a17_0x4fa1e0(0x90)]='Submit\x20a\x20job';async['execute'](_0x29a69c){const _0x1fd1f4=a17_0x4fa1e0,{options:_0x58c437,args:_0x2cec87,tdx:_0x4e8874}=_0x29a69c,_0x5d1ada=_0x58c437['jobType']||_0x1fd1f4(0xad),_0x195e72=_0x58c437[_0x1fd1f4(0xaf)],_0x85d1a2=_0x58c437[_0x1fd1f4(0x83)]||'information_schema';if(_0x5d1ada!==_0x1fd1f4(0xad)&&_0x5d1ada!==_0x1fd1f4(0x99))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22');let _0x530d18;if(_0x195e72){if(_0x2cec87[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1fd1f4(0x9a));const _0x193309=readSqlStatementsFromFile(_0x195e72);if(_0x193309[_0x1fd1f4(0x8e)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1fd1f4(0x9f));if(_0x193309['length']>0x1)throw new SDKError(ErrorCode[_0x1fd1f4(0xa9)],_0x1fd1f4(0x85));_0x530d18=_0x193309[0x0];}else{if(!_0x2cec87[0x0])throw new SDKError(ErrorCode[_0x1fd1f4(0xa9)],_0x1fd1f4(0xb6));_0x530d18=_0x2cec87[0x0];}_0x58c437['verbose']&&(console[_0x1fd1f4(0x91)](_0x1fd1f4(0xa3)+_0x5d1ada),console[_0x1fd1f4(0x91)](_0x1fd1f4(0xa6)+_0x85d1a2),console[_0x1fd1f4(0x91)](_0x1fd1f4(0x86)+_0x530d18[_0x1fd1f4(0x93)](0x0,0x64)+(_0x530d18[_0x1fd1f4(0x8e)]>0x64?_0x1fd1f4(0x81):'')));const _0x3b04fc=await withSpinner('Submitting\x20job...',()=>_0x4e8874[_0x1fd1f4(0x76)][_0x1fd1f4(0x73)](_0x85d1a2,_0x530d18,_0x5d1ada),{'verbose':_0x58c437[_0x1fd1f4(0x6f)]}),_0x8350d=_0x3b04fc[_0x1fd1f4(0x9d)];return console[_0x1fd1f4(0x91)](_0x1fd1f4(0x6b)),console['error'](_0x1fd1f4(0x84)+_0x8350d[_0x1fd1f4(0x6e)]),await handleSDKOutput([_0x8350d],_0x58c437),0x0;}}function a17_0x4b05(_0x7bd729,_0x3dd119){_0x7bd729=_0x7bd729-0x6b;const _0x5d587a=a17_0x5d58();let _0x4b0569=_0x5d587a[_0x7bd729];return _0x4b0569;}function a17_0x5d58(){const _0x2701dd=['5jswmMT','end_at','job:kill','9RWTABb','...','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','database','\x20\x20Job\x20ID:\x20','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Query:\x20','\x20job','22737bVXfmc','\x20jobs','yes','Submitting\x20kill\x20request...','Show\x20job\x20details','debug','length','Getting\x20job\x20details...','description','error','map','substring','job:show','621414FVMsfy','520XUbaZY','Status\x20filter:\x20','kill','hive','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','args','priority','data','Getting\x20job\x20results...','No\x20SQL\x20statements\x20found\x20in\x20file','query','execute','✔\x20Found\x20','Job\x20type:\x20','start_at','created_at','Database:\x20','1666232nCAHgD','12tDXLVy','INVALID_ARGUMENT','161YMGaSO','List\x20jobs','user_name','trino','50678onhsFs','file','983636jNcNDy','result','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','status','type','validate','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','Cancelled','Get\x20job\x20results','5748977JTPThd','url','✔\x20Job\x20submitted','Kill\x20a\x20job','✔\x20Retrieved\x20','job_id','verbose','job:submit','list','\x20row','submit','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','33006zgPQFp','jobs','\x27\x20to\x20verify\x20the\x20job\x20status','name','getTime','5QrlLrF','Limit:\x20','round'];a17_0x5d58=function(){return _0x2701dd;};return a17_0x5d58();}export class JobResultCommand extends BaseCommand{['name']='job:result';[a17_0x4fa1e0(0x90)]=a17_0x4fa1e0(0xb9);[a17_0x4fa1e0(0xb5)](_0x1e7c68){const _0x37b1e6=a17_0x4fa1e0,_0x99f18c=_0x1e7c68[_0x37b1e6(0x9b)][0x0];if(!_0x99f18c)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>';return undefined;}async[a17_0x4fa1e0(0xa1)](_0x2bb7a3){const _0x35323a=a17_0x4fa1e0,{options:_0x1b418a,args:_0x2f9bd2,tdx:_0x1946b0}=_0x2bb7a3,_0x5b56d1=_0x2f9bd2[0x0],_0xca4151=await withSpinner(_0x35323a(0x9e),()=>_0x1946b0[_0x35323a(0x76)][_0x35323a(0xb1)](_0x5b56d1),{'verbose':_0x1b418a[_0x35323a(0x6f)]}),_0x379bb9=_0xca4151['data'];return console[_0x35323a(0x91)](_0x35323a(0x6d)+_0x379bb9[_0x35323a(0x8e)]+_0x35323a(0x72)+(_0x379bb9[_0x35323a(0x8e)]!==0x1?'s':'')),await handleSDKOutput(_0x379bb9,_0x1b418a),0x0;}}
@@ -1 +1 @@
1
- const a18_0x164af0=a18_0x55d6;(function(_0x1c342c,_0xae690c){const _0x3363bb=a18_0x55d6,_0x3cec5d=_0x1c342c();while(!![]){try{const _0x564045=parseInt(_0x3363bb(0x1b4))/0x1+-parseInt(_0x3363bb(0x20a))/0x2+parseInt(_0x3363bb(0x1b5))/0x3+-parseInt(_0x3363bb(0x208))/0x4*(parseInt(_0x3363bb(0x234))/0x5)+parseInt(_0x3363bb(0x24c))/0x6*(-parseInt(_0x3363bb(0x26a))/0x7)+parseInt(_0x3363bb(0x1c7))/0x8+parseInt(_0x3363bb(0x271))/0x9*(parseInt(_0x3363bb(0x240))/0xa);if(_0x564045===_0xae690c)break;else _0x3cec5d['push'](_0x3cec5d['shift']());}catch(_0x350cf5){_0x3cec5d['push'](_0x3cec5d['shift']());}}}(a18_0x2a35,0xb5f09));import a18_0x280cd0 from'chalk';import a18_0xd2051b 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,isInteractive}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';function a18_0x2a35(){const _0x430c60=['📁\x20','session','(running)','Resolving\x20journey...','exited','journey:resume','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','format','journeyBundleName','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','get','buildIdToEmailMap','execute','/j/da','attributes','length','args','\x20journey','buildIdToNameMap','name','conversionRate','List\x20journeys\x20in\x20current\x20context','paused','cyan','(root)','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','relativePath','activation_','root\x20folder','then','content','907835yLCWGM','Folder\x20path:\x20','no_parent','segments','listJourneysWithFolders','✔\x20Journey\x20\x22','log','set','type','Cancelled','✔\x20Pulled\x20','resourceName','80XInpMK','sort','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','file','folderPath','size','journey:view','activationParams','Resume\x20a\x20paused\x20journey','pause','goalRate','getParentFull','126rvhgkl','\x20\x20Target:\x20','/app/ps/','goal','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Resolved\x20YAML\x20file:\x20','rootFolderId','yes','stages','Show\x20journey\x20details','Usage:\x20journey\x20pause\x20<name-or-path>','Input:\x20','totalEntered','\x5c$&','folderId','parentSegment','.yml','cwd','Parent\x20segment:\x20','rule','state','Target\x20directory:\x20','dim','\x0aChanges\x20to\x20\x27','targetDir','split','✔\x20Found\x20','\x20journeys','Fetching\x20','green','188636SAGvck','audienceId','test','\x20unchanged\x20files','\x22\x20not\x20found','blue','journey:push','803754RzsVMD','/e/','red','description','filter','Error:\x20Parent\x20segment\x20context\x20required','(completed)','(draft)','hasChanges','journey','archived','helpText','values','journey:stats','map','Warning:\x20Could\x20not\x20resolve\x20activation\x20','user','Resolving\x20parent\x20segment...','1172895ngKEda','1402677drRNST','\x20journey\x20files\x20to\x20','\x27\x20not\x20found\x20in\x20','localeCompare','options','/j/da/je','utf-8','Error:\x20Journey\x20\x27','connection','Pattern:\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','No\x20journeys\x20found','\x20(rule\x20match)','listFolders','Found\x20','\x20files?','No\x20statistics\x20available\x20for\x20journey:\x20','has','3974128uoJbAZ','Export\x20journey(s)\x20as\x20YAML\x20files','journeyBundleId','segmentName','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)','\x20=\x20','\x20\x20Name:\x20','filePath','✔\x20Context\x20set:\x20','\x22\x20resumed','join','\x20\x20Preserving\x20local\x20segment\x20name:\x20','message','INVALID_ARGUMENT','folders','\x22\x20paused','listJourneysFromParentSegment','json','\x20new\x20files','(archived)','journeys','journeyName','isNew','Usage:\x20journey\x20resume\x20<name-or-path>','🗺️\x20','resolveParentId','entered','launched','\x20\x20Parent\x20segment:\x20','base','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Fetching\x20users\x20for\x20email\x20resolution...','resolveJourneyId','stageName','resume','entries','population','data','getJourney','site','draft','push','Listing\x20journeys...','Write\x20','all','\x20changed\x20files','segmentPushCommand','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','web','verbose','segment','\x20\x20Statistics\x20not\x20available','errorCode','Usage:\x20journey\x20stats\x20<name-or-path>','versionNumber','journeyStages','totalGoalAchieved','(paused)','Warning:\x20Stage\x20\x22','includeStats','stage','✔\x20All\x20files\x20are\x20up\x20to\x20date','yellow','getActivation','error','20KoQWWu','toLowerCase','1265400CahAiD','Getting\x20journey\x20statistics...','\x0aError:','...','journeyId','setPhase','Pause\x20a\x20running\x20journey','parent_segment','reentryMode','add','getStatistics'];a18_0x2a35=function(){return _0x430c60;};return a18_0x2a35();}import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x4801f6){const _0x34015b=a18_0x55d6;switch(_0x4801f6){case _0x34015b(0x1e2):return a18_0x280cd0[_0x34015b(0x269)](_0x34015b(0x217));case _0x34015b(0x1ef):return a18_0x280cd0[_0x34015b(0x262)](_0x34015b(0x278));case _0x34015b(0x22b):return a18_0x280cd0['yellow'](_0x34015b(0x200));case'completed':return a18_0x280cd0[_0x34015b(0x26f)](_0x34015b(0x277));case _0x34015b(0x27b):return a18_0x280cd0[_0x34015b(0x262)](_0x34015b(0x1da));default:return'('+_0x4801f6+')';}}function formatJourneyItem(_0x210b2c,_0x27dffd='',_0x51fb1a){const _0x233a9a=a18_0x55d6,_0x57c1f3=formatJourneyState(_0x210b2c[_0x233a9a(0x260)]),_0x2b3739=_0x51fb1a?hyperlink(_0x210b2c[_0x233a9a(0x21d)],_0x51fb1a):_0x210b2c['journeyBundleName'];return _0x27dffd+_0x233a9a(0x1df)+_0x2b3739+'\x20'+_0x57c1f3;}function escapeRegex(_0x540d2c){const _0x5d8589=a18_0x55d6;return _0x540d2c['replace'](/[.*+?^${}()|[\]\\]/g,_0x5d8589(0x259));}function globToRegex(_0x1bcfdd){const _0xd0f34e=a18_0x55d6,_0x2628bd=_0x1bcfdd[_0xd0f34e(0x265)]('*')[_0xd0f34e(0x1b0)](escapeRegex);return new RegExp(_0x2628bd[_0xd0f34e(0x1d1)]('.*'),'i');}function buildRuleToNameMapping(_0x1b1436){const _0x7bb8fc=a18_0x55d6,_0x376eff=new Map();if(_0x1b1436[_0x7bb8fc(0x237)])for(const [_0x1766cb,_0x12cd7d]of Object[_0x7bb8fc(0x1ea)](_0x1b1436['segments'])){if(_0x12cd7d[_0x7bb8fc(0x25f)]){const _0x40c80d=serializeRule(_0x12cd7d[_0x7bb8fc(0x25f)]),_0xd93edd=_0x376eff[_0x7bb8fc(0x21f)](_0x40c80d);_0xd93edd?_0xd93edd['push'](_0x1766cb):_0x376eff[_0x7bb8fc(0x23b)](_0x40c80d,[_0x1766cb]);}}return _0x376eff;}async function resolveJourneyTarget(_0xd3fbec,_0x246ed1,_0x4fe28d){const _0x3a24f8=a18_0x55d6;if(isYamlFilePath(_0xd3fbec))try{const _0x1bf68e=await resolveYamlFilePath(_0xd3fbec);return _0x4fe28d&&(console['error'](_0x3a24f8(0x251)+_0xd3fbec),console[_0x3a24f8(0x207)](_0x3a24f8(0x1e3)+_0x1bf68e[_0x3a24f8(0x25b)]),console['error'](_0x3a24f8(0x1cd)+_0x1bf68e[_0x3a24f8(0x1ca)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x1bf68e[_0x3a24f8(0x244)]||_0x3a24f8(0x22d)))),{'journeyName':_0x1bf68e[_0x3a24f8(0x1ca)],'parentSegment':_0x1bf68e[_0x3a24f8(0x25b)],'resolved':_0x1bf68e};}catch(_0x4d1efd){throw new SDKError(ErrorCode[_0x3a24f8(0x1d4)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4d1efd[_0x3a24f8(0x1d3)]);}if(!_0x246ed1)throw new SDKError(ErrorCode[_0x3a24f8(0x1d4)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0xd3fbec,'parentSegment':_0x246ed1};}export class JourneyListCommand extends BaseCommand{['name']='journey:list';[a18_0x164af0(0x274)]=a18_0x164af0(0x22a);async['execute'](_0x3c82e2){const _0x2847ce=a18_0x164af0,{options:_0x1a627e,args:_0x2f9f47,tdx:_0x4219e7}=_0x3c82e2,_0x1a8ee7=_0x2f9f47[0x0],_0x3dfda5=_0x1a627e[_0x2847ce(0x25b)];if(!_0x3dfda5)return console['error'](_0x2847ce(0x276)),console['error']('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x53c887=await withSpinner(_0x2847ce(0x1b3),()=>_0x4219e7[_0x2847ce(0x1f9)][_0x2847ce(0x1e0)](_0x3dfda5),{'verbose':_0x1a627e['verbose']}),_0x4e42a7=_0x53c887[_0x2847ce(0x1ec)];_0x1a627e['verbose']&&(console[_0x2847ce(0x207)](_0x2847ce(0x25e)+_0x3dfda5+'\x20(ID:\x20'+_0x4e42a7+')'),_0x1a8ee7&&console[_0x2847ce(0x207)](_0x2847ce(0x1be)+_0x1a8ee7));const _0x3d9d30=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x4219e7[_0x2847ce(0x1f9)][_0x2847ce(0x24b)](_0x4e42a7),{'verbose':_0x1a627e['verbose']}),_0x3ca130=_0x3d9d30['data'],_0x5e7029=_0x3ca130[_0x2847ce(0x252)],_0x3f0a5d=await withSpinner(_0x2847ce(0x1f1),()=>_0x4219e7['journey'][_0x2847ce(0x238)](_0x4e42a7,_0x5e7029),{'verbose':_0x1a627e['verbose']});let _0x75ab64=_0x3f0a5d[_0x2847ce(0x1ec)][_0x2847ce(0x1db)];const _0x55f7da=_0x3f0a5d['data'][_0x2847ce(0x1d5)],_0x4571dd=new Map();for(const _0x18e473 of _0x55f7da){_0x4571dd[_0x2847ce(0x23b)](_0x18e473['id'],_0x18e473['name']);}if(_0x1a8ee7){const _0x1a405f=globToRegex(_0x1a8ee7);_0x75ab64=_0x75ab64['filter'](_0x4d3665=>_0x1a405f[_0x2847ce(0x26c)](_0x4d3665['journeyBundleName']));}console[_0x2847ce(0x207)](_0x2847ce(0x266)+_0x75ab64['length']+_0x2847ce(0x226)+(_0x75ab64[_0x2847ce(0x224)]!==0x1?'s':''));const _0x9410b9=_0x27230c=>{const _0xc9a8bc=_0x2847ce;return getConsoleNextUrl(_0x1a627e[_0xc9a8bc(0x1ee)],_0xc9a8bc(0x24e)+_0x4e42a7+_0xc9a8bc(0x272)+_0x27230c+_0xc9a8bc(0x222));};if(_0x1a627e['format']==='table')await handleSDKOutput(_0x75ab64,_0x1a627e);else{if(_0x1a627e[_0x2847ce(0x21c)]===_0x2847ce(0x1d8)){const _0x5dfb51=_0x75ab64['map'](_0x3ecf0f=>({..._0x3ecf0f,'url':_0x9410b9(_0x3ecf0f['id'])}));await handleSDKOutput(_0x5dfb51,_0x1a627e);}else{console[_0x2847ce(0x23a)]('['+_0x3dfda5+']');const _0x4c8466=new Map(),_0x38bf80=[];for(const _0x82912 of _0x75ab64){if(!_0x82912[_0x2847ce(0x25a)]||_0x82912[_0x2847ce(0x25a)]===_0x5e7029)_0x38bf80['push'](_0x82912);else{const _0x14270f=_0x4c8466[_0x2847ce(0x21f)](_0x82912[_0x2847ce(0x25a)])||[];_0x14270f['push'](_0x82912),_0x4c8466['set'](_0x82912[_0x2847ce(0x25a)],_0x14270f);}}const _0x16bb17=(_0x2720d9,_0x3f2464)=>_0x2720d9[_0x2847ce(0x21d)][_0x2847ce(0x1b8)](_0x3f2464[_0x2847ce(0x21d)],undefined,{'sensitivity':_0x2847ce(0x1e4)});_0x38bf80[_0x2847ce(0x241)](_0x16bb17);for(const _0x279211 of _0x38bf80){console[_0x2847ce(0x23a)](formatJourneyItem(_0x279211,'',_0x9410b9(_0x279211['id'])));}const _0x4addd0=[..._0x4c8466['entries']()][_0x2847ce(0x241)]((_0x3050d5,_0x2d9e04)=>{const _0x2bada6=_0x2847ce,_0x5d22bd=_0x4571dd[_0x2bada6(0x21f)](_0x3050d5[0x0])||_0x3050d5[0x0],_0x163183=_0x4571dd['get'](_0x2d9e04[0x0])||_0x2d9e04[0x0];return _0x5d22bd['localeCompare'](_0x163183,undefined,{'sensitivity':_0x2bada6(0x1e4)});});for(const [_0xb961ea,_0xed0df5]of _0x4addd0){const _0x1c5ae5=_0x4571dd[_0x2847ce(0x21f)](_0xb961ea)||_0xb961ea;console['log'](_0x2847ce(0x215)+_0x1c5ae5),_0xed0df5[_0x2847ce(0x241)](_0x16bb17);for(const _0x3ce8d5 of _0xed0df5){console['log'](formatJourneyItem(_0x3ce8d5,'\x20\x20',_0x9410b9(_0x3ce8d5['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']=a18_0x164af0(0x246);['description']=a18_0x164af0(0x255);async[a18_0x164af0(0x221)](_0x34ac67){const _0x17bd98=a18_0x164af0,{options:_0x6c586f,args:_0x425366,tdx:_0x2e0b3d}=_0x34ac67,_0x4c7002=_0x425366[0x0];if(!_0x4c7002)return console[_0x17bd98(0x207)](_0x17bd98(0x1f6)),console[_0x17bd98(0x207)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x17bd98(0x207)]('Options:'),console[_0x17bd98(0x207)](_0x17bd98(0x21b)),0x1;_0x6c586f[_0x17bd98(0x1f8)]&&console[_0x17bd98(0x207)](_0x17bd98(0x257)+_0x4c7002);const _0x2695cd=await resolveJourneyTarget(_0x4c7002,_0x6c586f[_0x17bd98(0x25b)],_0x6c586f[_0x17bd98(0x1f8)]),_0x44702d=await withSpinner(_0x17bd98(0x1b3),()=>_0x2e0b3d[_0x17bd98(0x1f9)][_0x17bd98(0x1e0)](_0x2695cd[_0x17bd98(0x25b)]),{'verbose':_0x6c586f['verbose']}),_0x1cf005=_0x44702d['data'],_0x18aa22=await withSpinner(_0x17bd98(0x218),()=>_0x2e0b3d['journey'][_0x17bd98(0x1e7)](_0x1cf005,_0x2695cd[_0x17bd98(0x1dc)]),{'verbose':_0x6c586f[_0x17bd98(0x1f8)]}),_0x484d54=_0x18aa22[_0x17bd98(0x1ec)];if(_0x6c586f[_0x17bd98(0x1f7)]){const _0x5ea879=getConsoleNextUrl(_0x6c586f[_0x17bd98(0x1ee)],_0x17bd98(0x24e)+_0x1cf005+_0x17bd98(0x272)+_0x484d54+_0x17bd98(0x1ba));return console[_0x17bd98(0x207)](a18_0x280cd0[_0x17bd98(0x269)]('✔')+'\x20Opening\x20'+a18_0x280cd0[_0x17bd98(0x22c)](_0x5ea879)),openBrowser(_0x5ea879),0x0;}const _0x371aa4=await withSpinner('Getting\x20journey\x20details...',()=>_0x2e0b3d['journey'][_0x17bd98(0x1ed)](_0x484d54),{'verbose':_0x6c586f[_0x17bd98(0x1f8)]}),_0x2778ba=_0x371aa4[_0x17bd98(0x1ec)],_0x139ee8=_0x6c586f[_0x17bd98(0x202)];let _0x278658;if(_0x139ee8)try{const _0x17d31d=await withSpinner(_0x17bd98(0x20b),()=>_0x2e0b3d[_0x17bd98(0x27a)]['getStatistics'](_0x484d54),{'verbose':_0x6c586f[_0x17bd98(0x1f8)]});_0x278658=_0x17d31d[_0x17bd98(0x1ec)];}catch{_0x6c586f[_0x17bd98(0x1f8)]&&console[_0x17bd98(0x207)](_0x17bd98(0x1fa));}const _0x49c5b6=getConsoleNextUrl(_0x6c586f['site'],_0x17bd98(0x24e)+_0x1cf005+_0x17bd98(0x272)+_0x484d54+'/j/da/je'),_0x2aff10={'id':_0x2778ba['id'],'name':_0x2778ba[_0x17bd98(0x223)][_0x17bd98(0x228)],'description':_0x2778ba[_0x17bd98(0x223)][_0x17bd98(0x274)],'state':_0x2778ba[_0x17bd98(0x223)][_0x17bd98(0x260)],'paused':_0x2778ba[_0x17bd98(0x223)]['paused'],'reentry_mode':_0x2778ba[_0x17bd98(0x223)][_0x17bd98(0x212)],'stages':_0x2778ba[_0x17bd98(0x223)][_0x17bd98(0x1fe)]?.[_0x17bd98(0x224)]||0x0,..._0x2778ba[_0x17bd98(0x223)][_0x17bd98(0x24f)]&&{'goal':_0x2778ba['attributes'][_0x17bd98(0x24f)][_0x17bd98(0x228)]},..._0x278658&&{'statistics':{'total_entered':_0x278658[_0x17bd98(0x258)],'goal_achieved':_0x278658[_0x17bd98(0x1ff)],'goal_rate':_0x278658[_0x17bd98(0x24a)],'stages':_0x278658['stages']}},'url':_0x49c5b6};return await handleSingleObjectOutput(_0x2aff10,_0x6c586f),0x0;}}export class JourneyStatsCommand extends BaseCommand{['name']=a18_0x164af0(0x1af);[a18_0x164af0(0x274)]='Show\x20journey\x20statistics';async[a18_0x164af0(0x221)](_0xbc7136){const _0x4ffb75=a18_0x164af0,{options:_0x5635a5,args:_0x37f676,tdx:_0x1528b4}=_0xbc7136,_0x37d4b8=_0x37f676[0x0];if(!_0x37d4b8)return console[_0x4ffb75(0x207)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x4ffb75(0x207)](_0x4ffb75(0x1fc)),0x1;_0x5635a5[_0x4ffb75(0x1f8)]&&console[_0x4ffb75(0x207)](_0x4ffb75(0x257)+_0x37d4b8);const _0x2ea169=await resolveJourneyTarget(_0x37d4b8,_0x5635a5['parentSegment'],_0x5635a5[_0x4ffb75(0x1f8)]),_0x278bce=await withSpinner(_0x4ffb75(0x1b3),()=>_0x1528b4[_0x4ffb75(0x1f9)][_0x4ffb75(0x1e0)](_0x2ea169[_0x4ffb75(0x25b)]),{'verbose':_0x5635a5['verbose']}),_0x36b3aa=_0x278bce[_0x4ffb75(0x1ec)],_0x42463d=await withSpinner('Resolving\x20journey...',()=>_0x1528b4['journey'][_0x4ffb75(0x1e7)](_0x36b3aa,_0x2ea169[_0x4ffb75(0x1dc)]),{'verbose':_0x5635a5[_0x4ffb75(0x1f8)]}),_0x54c55d=_0x42463d['data'],_0x564145=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x1528b4[_0x4ffb75(0x27a)][_0x4ffb75(0x214)](_0x54c55d),{'verbose':_0x5635a5[_0x4ffb75(0x1f8)]}),_0x59729e=_0x564145[_0x4ffb75(0x1ec)];if(!_0x59729e||_0x59729e[_0x4ffb75(0x20e)]===null)return console[_0x4ffb75(0x207)](_0x4ffb75(0x1c5)+_0x2ea169['journeyName']),console[_0x4ffb75(0x207)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x57eba0={'journey_id':_0x59729e[_0x4ffb75(0x20e)],'total_entered':_0x59729e[_0x4ffb75(0x258)],'goal_achieved':_0x59729e[_0x4ffb75(0x1ff)],'goal_rate':_0x59729e[_0x4ffb75(0x24a)],'stages':_0x59729e[_0x4ffb75(0x254)]?.[_0x4ffb75(0x1b0)](_0x5de273=>({'name':_0x5de273['stageName'],'population':_0x5de273[_0x4ffb75(0x1eb)],'entered':_0x5de273[_0x4ffb75(0x1e1)],'exited':_0x5de273[_0x4ffb75(0x219)],'conversion_rate':_0x5de273[_0x4ffb75(0x229)]}))},_0x243da8=_0x5635a5[_0x4ffb75(0x203)];if(_0x243da8&&_0x59729e[_0x4ffb75(0x254)]){const _0x35e8ea=_0x59729e['stages']['find'](_0x556ae1=>_0x556ae1[_0x4ffb75(0x1e8)][_0x4ffb75(0x209)]()===_0x243da8['toLowerCase']());if(_0x35e8ea)return await handleSingleObjectOutput({'stage_name':_0x35e8ea[_0x4ffb75(0x1e8)],'population':_0x35e8ea[_0x4ffb75(0x1eb)],'entered':_0x35e8ea[_0x4ffb75(0x1e1)],'exited':_0x35e8ea[_0x4ffb75(0x219)],'conversion_rate':_0x35e8ea[_0x4ffb75(0x229)]},_0x5635a5),0x0;console[_0x4ffb75(0x207)](_0x4ffb75(0x201)+_0x243da8+_0x4ffb75(0x26e));}return await handleSingleObjectOutput(_0x57eba0,_0x5635a5),0x0;}}function a18_0x55d6(_0x444836,_0x19fb2c){_0x444836=_0x444836-0x1ae;const _0x2a351f=a18_0x2a35();let _0x55d61b=_0x2a351f[_0x444836];return _0x55d61b;}export class JourneyPauseCommand extends BaseCommand{[a18_0x164af0(0x228)]='journey:pause';[a18_0x164af0(0x274)]=a18_0x164af0(0x210);async['execute'](_0x3fe095){const _0x2ff551=a18_0x164af0,{options:_0x5de221,args:_0x956c0d,tdx:_0x16b9f9}=_0x3fe095,_0x3a5f2a=_0x956c0d[0x0];if(!_0x3a5f2a)return console[_0x2ff551(0x207)](_0x2ff551(0x1f6)),console['error'](_0x2ff551(0x256)),0x1;_0x5de221[_0x2ff551(0x1f8)]&&console[_0x2ff551(0x207)](_0x2ff551(0x257)+_0x3a5f2a);const _0x532a99=await resolveJourneyTarget(_0x3a5f2a,_0x5de221[_0x2ff551(0x25b)],_0x5de221[_0x2ff551(0x1f8)]),_0x19f76a=await withSpinner(_0x2ff551(0x1b3),()=>_0x16b9f9[_0x2ff551(0x1f9)]['resolveParentId'](_0x532a99[_0x2ff551(0x25b)]),{'verbose':_0x5de221[_0x2ff551(0x1f8)]}),_0x3483b2=_0x19f76a[_0x2ff551(0x1ec)],_0x44f85d=await withSpinner(_0x2ff551(0x218),()=>_0x16b9f9['journey'][_0x2ff551(0x1e7)](_0x3483b2,_0x532a99[_0x2ff551(0x1dc)]),{'verbose':_0x5de221[_0x2ff551(0x1f8)]}),_0x167013=_0x44f85d[_0x2ff551(0x1ec)];if(!_0x5de221[_0x2ff551(0x253)]){const _0x4ec859=await confirm(_0x2ff551(0x1e5)+_0x532a99['journeyName']+'\x22?');if(!_0x4ec859)return console[_0x2ff551(0x207)](_0x2ff551(0x23d)),0x0;}const _0x48e012=await withSpinner('Pausing\x20journey...',()=>_0x16b9f9['journey'][_0x2ff551(0x249)](_0x167013),{'verbose':_0x5de221['verbose']}),_0x1fd541=_0x48e012['data'];return console['error'](_0x2ff551(0x239)+_0x1fd541[_0x2ff551(0x223)][_0x2ff551(0x228)]+_0x2ff551(0x1d6)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x164af0(0x228)]=a18_0x164af0(0x21a);['description']=a18_0x164af0(0x248);async[a18_0x164af0(0x221)](_0x2a17c3){const _0x17ab40=a18_0x164af0,{options:_0x92b5e7,args:_0x20c588,tdx:_0x43a5c5}=_0x2a17c3,_0x57beec=_0x20c588[0x0];if(!_0x57beec)return console['error'](_0x17ab40(0x1f6)),console[_0x17ab40(0x207)](_0x17ab40(0x1de)),0x1;_0x92b5e7[_0x17ab40(0x1f8)]&&console['error']('Input:\x20'+_0x57beec);const _0x10b787=await resolveJourneyTarget(_0x57beec,_0x92b5e7[_0x17ab40(0x25b)],_0x92b5e7[_0x17ab40(0x1f8)]),_0x5b8e34=await withSpinner(_0x17ab40(0x1b3),()=>_0x43a5c5[_0x17ab40(0x1f9)][_0x17ab40(0x1e0)](_0x10b787[_0x17ab40(0x25b)]),{'verbose':_0x92b5e7[_0x17ab40(0x1f8)]}),_0x559ab1=_0x5b8e34[_0x17ab40(0x1ec)],_0x2c6d41=await withSpinner(_0x17ab40(0x218),()=>_0x43a5c5['journey'][_0x17ab40(0x1e7)](_0x559ab1,_0x10b787[_0x17ab40(0x1dc)]),{'verbose':_0x92b5e7[_0x17ab40(0x1f8)]}),_0x37d9f2=_0x2c6d41['data'];if(!_0x92b5e7[_0x17ab40(0x253)]){const _0x35498d=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x10b787[_0x17ab40(0x1dc)]+'\x22?');if(!_0x35498d)return console[_0x17ab40(0x207)]('Cancelled'),0x0;}const _0x26011b=await withSpinner('Resuming\x20journey...',()=>_0x43a5c5[_0x17ab40(0x27a)][_0x17ab40(0x1e9)](_0x37d9f2),{'verbose':_0x92b5e7[_0x17ab40(0x1f8)]}),_0x516072=_0x26011b[_0x17ab40(0x1ec)];return console[_0x17ab40(0x207)](_0x17ab40(0x239)+_0x516072[_0x17ab40(0x223)][_0x17ab40(0x228)]+_0x17ab40(0x1d0)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']='journey:pull';[a18_0x164af0(0x274)]=a18_0x164af0(0x1c8);async[a18_0x164af0(0x221)](_0x3295e8){const _0x1ed532=a18_0x164af0,{options:_0x44d492,args:_0x5091e1,tdx:_0xdba7df}=_0x3295e8,_0x2b7ee2=_0x44d492,_0x26e386=_0x5091e1[0x0],_0x52e98e=_0x26e386&&isYamlFilePath(_0x26e386),_0x15372e=await resolveTarget({'arg':_0x52e98e?_0x26e386:undefined,'contextParent':_0x44d492[_0x1ed532(0x25b)],'cwd':process[_0x1ed532(0x25d)]()});if(!isSuccessfulResolution(_0x15372e))return _0x15372e[_0x1ed532(0x1fb)]===_0x1ed532(0x236)?(console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x205)](_0x1ed532(0x21e))),console[_0x1ed532(0x207)](_0x1ed532(0x1cb)),console[_0x1ed532(0x207)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x1ed532(0x207)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console['error']('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x273)]('Error:\x20'+_0x15372e[_0x1ed532(0x1d3)]+'\x0a')),_0x15372e[_0x1ed532(0x27c)]&&console['error'](a18_0x280cd0[_0x1ed532(0x22c)](_0x15372e['helpText']))),0x1;let _0x452eb5=_0x52e98e?undefined:_0x26e386,_0x36768d,_0xbd0be2;_0x15372e[_0x1ed532(0x23c)]===_0x1ed532(0x243)&&(_0x452eb5=_0x15372e[_0x1ed532(0x23f)],_0x36768d=_0x15372e[_0x1ed532(0x1ce)],_0xbd0be2=_0x15372e[_0x1ed532(0x244)]);const _0x303c24=_0x15372e['parentName'],_0x1553d2=_0x15372e[_0x1ed532(0x264)];_0x2b7ee2[_0x1ed532(0x1f8)]&&(console[_0x1ed532(0x207)](_0x1ed532(0x25e)+_0x303c24),console['error'](_0x1ed532(0x261)+_0x1553d2),_0x452eb5&&console[_0x1ed532(0x207)]('Journey\x20name:\x20'+_0x452eb5),_0x36768d&&console[_0x1ed532(0x207)]('Target\x20file:\x20'+_0x36768d),_0xbd0be2&&console[_0x1ed532(0x207)](_0x1ed532(0x235)+_0xbd0be2));const _0x5d50a5=await withSpinner(_0x1ed532(0x1b3),()=>_0xdba7df[_0x1ed532(0x1f9)][_0x1ed532(0x1e0)](_0x303c24),{'verbose':_0x44d492[_0x1ed532(0x1f8)]}),_0x2f123c=_0x5d50a5['data'],[_0x4bdb24,_0x51b8c3]=await Promise[_0x1ed532(0x1f3)]([withSpinner('Listing\x20journeys...',()=>_0xdba7df[_0x1ed532(0x27a)][_0x1ed532(0x1d7)](_0x2f123c,undefined,{'includeAllVersions':!![]}),{'verbose':_0x44d492[_0x1ed532(0x1f8)]}),withSpinner('Listing\x20folders...',()=>_0xdba7df['segment'][_0x1ed532(0x1c2)](_0x2f123c),{'verbose':_0x44d492[_0x1ed532(0x1f8)]})]);let _0x4ae721=_0x4bdb24[_0x1ed532(0x1ec)];const _0x251d94=_0x51b8c3[_0x1ed532(0x1ec)],_0x210239=buildFolderIdToPathMap(_0x251d94);if(_0x452eb5){const _0xcf69c2=_0x4ae721[_0x1ed532(0x275)](_0x4ac547=>_0x4ac547[_0x1ed532(0x21d)][_0x1ed532(0x209)]()===_0x452eb5['toLowerCase']());if(_0xcf69c2[_0x1ed532(0x224)]===0x0)return console[_0x1ed532(0x207)]('Error:\x20Journey\x20not\x20found:\x20'+_0x452eb5),console[_0x1ed532(0x207)]('Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys'),0x1;_0x4ae721=_0xcf69c2;}if(_0xbd0be2!==undefined){const _0x3ec894=_0x4ae721[_0x1ed532(0x275)](_0x3f36ee=>{const _0x464c04=_0x1ed532,_0x22df62=_0x3f36ee[_0x464c04(0x25a)]?_0x210239[_0x464c04(0x21f)](_0x3f36ee[_0x464c04(0x25a)])||'':'';return _0x22df62===_0xbd0be2;});if(_0x3ec894[_0x1ed532(0x224)]===0x0&&_0x4ae721[_0x1ed532(0x224)]>0x0){console[_0x1ed532(0x207)](_0x1ed532(0x1bc)+_0x452eb5+_0x1ed532(0x1b7)+(_0xbd0be2||_0x1ed532(0x231))),console[_0x1ed532(0x207)](_0x1ed532(0x1bf));for(const _0x1dcdb5 of _0x4ae721){const _0xa5bd05=_0x1dcdb5['folderId']?_0x210239[_0x1ed532(0x21f)](_0x1dcdb5[_0x1ed532(0x25a)])||'':'';console[_0x1ed532(0x207)]('\x20\x20-\x20'+(_0xa5bd05||_0x1ed532(0x22d))+'/'+_0x1dcdb5[_0x1ed532(0x21d)]);}return 0x1;}_0x4ae721=_0x3ec894;}if(_0x4ae721['length']===0x0)return console[_0x1ed532(0x207)](_0x1ed532(0x1c0)),0x0;const _0x127e82=new Map();for(const _0xf3226d of _0x4ae721){const _0x26bc03=_0xf3226d[_0x1ed532(0x1c9)];!_0x127e82['has'](_0x26bc03)&&_0x127e82['set'](_0x26bc03,[]),_0x127e82['get'](_0x26bc03)['push'](_0xf3226d);}for(const _0x8848f7 of _0x127e82[_0x1ed532(0x1ae)]()){_0x8848f7[_0x1ed532(0x241)]((_0x1666d0,_0x5c04bb)=>(_0x1666d0['versionNumber']||0x0)-(_0x5c04bb['versionNumber']||0x0));}const _0xf2c590=[],[_0x120e83,_0x2e0e01]=await Promise[_0x1ed532(0x1f3)]([withSpinner(_0x1ed532(0x1e6),()=>_0xdba7df[_0x1ed532(0x1b2)][_0x1ed532(0x220)](),{'verbose':_0x44d492[_0x1ed532(0x1f8)]})['then'](_0x1869cc=>_0x1869cc[_0x1ed532(0x1ec)]),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0xdba7df[_0x1ed532(0x1bd)][_0x1ed532(0x227)](),{'verbose':_0x44d492[_0x1ed532(0x1f8)]})[_0x1ed532(0x232)](_0xfb9abc=>_0xfb9abc[_0x1ed532(0x1ec)])]);for(const _0xf49d7c of _0x127e82[_0x1ed532(0x1ae)]()){const _0x210baf=_0xf49d7c[0x0][_0x1ed532(0x21d)],_0x4175b4=_0xf49d7c[0x0]['folderId'],_0x3ef515=_0x4175b4?_0x210239[_0x1ed532(0x21f)](_0x4175b4)||'':'',_0xc285ef=_0x3ef515?a18_0xd2051b[_0x1ed532(0x1d1)](_0x1553d2,_0x3ef515):_0x1553d2,_0x410968=_0x36768d||a18_0xd2051b['join'](_0xc285ef,sanitizeFileName(_0x210baf)+_0x1ed532(0x25c));let _0x4dc0e7,_0x60aaf;if(existsSync(_0x410968))try{const _0x516fae=readFileSync(_0x410968,_0x1ed532(0x1bb)),_0x131e62=parseYamlString(_0x516fae);_0x60aaf=_0x131e62,_0x4dc0e7=buildRuleToNameMapping(_0x131e62),_0x2b7ee2['verbose']&&_0x4dc0e7[_0x1ed532(0x245)]>0x0&&console[_0x1ed532(0x207)](_0x1ed532(0x1c3)+_0x4dc0e7[_0x1ed532(0x245)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x210baf);}catch(_0x41a3bb){_0x2b7ee2[_0x1ed532(0x1f8)]&&console['error'](_0x1ed532(0x22e)+_0x41a3bb[_0x1ed532(0x1d3)]);}const _0x299bfd=[],_0x54abd9=new Set(),_0x4ad694=new Map(),_0x3ef291=new Map(),_0x4eb9a7=new Set(),_0x9f54d=new Map(),_0x2f9a1c=new Map(),_0x4e53c2=createJumpTargetCache();await withProgressSpinner(_0x1ed532(0x268)+_0x210baf+_0x1ed532(0x20d),async _0x2b29a5=>{const _0x4273c6=_0x1ed532;for(const _0x5ca1d1 of _0xf49d7c){const _0x17c782=_0xf49d7c[_0x4273c6(0x224)]>0x1?_0x5ca1d1['journeyBundleName']+'\x20v'+(_0x5ca1d1[_0x4273c6(0x1fd)]||0x1):_0x5ca1d1[_0x4273c6(0x21d)];_0x2b29a5[_0x4273c6(0x20f)](_0x4273c6(0x268)+_0x17c782);const _0x5c1055=await _0xdba7df[_0x4273c6(0x27a)]['getJourney'](_0x5ca1d1['id']),_0x3175d3=_0x5c1055[_0x4273c6(0x223)]?.[_0x4273c6(0x26b)],_0xe9c96a={'resolveSegment':async _0x3c10c6=>{const _0x33df46=_0x4273c6;if(!_0x3175d3)return{'name':_0x3c10c6,'isJourneyLocal':![]};const _0x2457bc=_0x4ad694['get'](_0x3c10c6);if(_0x2457bc)return _0x2457bc;try{const _0x48d9cc=await _0xdba7df['segment']['getSegment'](_0x3175d3,_0x3c10c6),_0x378833=_0x48d9cc['kind']===SEGMENT_KIND_JOURNEY;let _0x26838a,_0x457b53=_0x48d9cc['name'];if(_0x378833&&_0x48d9cc[_0x33df46(0x25f)]){const _0x526b8f=await segmentResponseToDef(_0x48d9cc,{'resolveSegmentName':async _0x1b8b87=>{const _0x466ba6=_0x33df46,_0x3a5290=_0x4ad694[_0x466ba6(0x21f)](_0x1b8b87);if(_0x3a5290)return _0x3a5290['name'];const _0x5d0f1d=await _0xe9c96a['resolveSegment'](_0x1b8b87);return _0x5d0f1d[_0x466ba6(0x228)];}}),_0x5316b0=_0x526b8f[_0x33df46(0x25f)];_0x26838a={'description':_0x48d9cc[_0x33df46(0x274)],'rule':_0x5316b0};const _0x11dbb4=serializeRule(_0x5316b0),_0x69c2ee=_0x3ef291[_0x33df46(0x21f)](_0x11dbb4);if(_0x69c2ee)_0x457b53=_0x69c2ee,_0x26838a=undefined,_0x2b7ee2[_0x33df46(0x1f8)]&&console[_0x33df46(0x207)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x48d9cc[_0x33df46(0x228)]+'\x20->\x20'+_0x69c2ee);else{let _0x4d282e=![];if(_0x4dc0e7){const _0x4c562a=_0x4dc0e7[_0x33df46(0x21f)](_0x11dbb4);if(_0x4c562a){const _0x9393ec=_0x4c562a['find'](_0x1f6432=>!_0x54abd9[_0x33df46(0x1c6)](_0x1f6432));_0x9393ec&&(_0x457b53=_0x9393ec,_0x54abd9[_0x33df46(0x213)](_0x9393ec),_0x3ef291[_0x33df46(0x23b)](_0x11dbb4,_0x9393ec),_0x4d282e=!![],_0x2b7ee2[_0x33df46(0x1f8)]&&console['error'](_0x33df46(0x1d2)+_0x9393ec+_0x33df46(0x1c1)));}}if(!_0x4d282e){const _0x4372dc=generateJourneyLocalName(_0x48d9cc['name']);_0x4372dc&&(_0x457b53=_0x4372dc);let _0x2e86f3=_0x457b53,_0x1d02ef=0x2;while(_0x54abd9[_0x33df46(0x1c6)](_0x2e86f3)){_0x2e86f3=_0x457b53+'_'+_0x1d02ef,_0x1d02ef++;}_0x54abd9[_0x33df46(0x213)](_0x2e86f3),_0x3ef291[_0x33df46(0x23b)](_0x11dbb4,_0x2e86f3),_0x457b53=_0x2e86f3;}}}const _0x4f9479={'name':_0x457b53,'isJourneyLocal':_0x378833,'definition':_0x26838a};return _0x4ad694['set'](_0x3c10c6,_0x4f9479),_0x4f9479;}catch(_0x32e113){return _0x44d492[_0x33df46(0x1f8)]&&console[_0x33df46(0x207)](_0x33df46(0x250)+_0x3c10c6+':\x20'+_0x32e113[_0x33df46(0x1d3)]),{'name':_0x3c10c6,'isJourneyLocal':![]};}},'resolveActivation':async _0x22a8b1=>{const _0x143743=_0x4273c6,_0x872305=_0x9f54d[_0x143743(0x21f)](_0x22a8b1);if(_0x872305)return _0x872305;try{const _0x53948a=await _0xdba7df[_0x143743(0x27a)][_0x143743(0x206)](_0x5ca1d1['id'],_0x22a8b1),_0x353ef7=journeyActivationStepToYaml(_0x53948a,_0x120e83,_0x2e0e01),_0x2dfecb=JSON['stringify']({'name':_0x353ef7[_0x143743(0x228)],'connection':_0x353ef7['connection'],'connector_config':_0x353ef7['connector_config']}),_0x212106=_0x2f9a1c[_0x143743(0x21f)](_0x2dfecb);if(_0x212106){const _0x49b15b={'name':_0x212106,'isJourneyLocal':!![],'definition':_0x353ef7};return _0x9f54d[_0x143743(0x23b)](_0x22a8b1,_0x49b15b),_0x49b15b;}const _0x61cf6c=_0x53948a[_0x143743(0x223)][_0x143743(0x247)]['name']||_0x22a8b1,_0x220fd2=sanitizeYamlKey(_0x61cf6c)||_0x143743(0x230)+_0x22a8b1;let _0x4d175b=_0x220fd2,_0x55d840=0x2;while(_0x4eb9a7[_0x143743(0x1c6)](_0x4d175b)){_0x4d175b=_0x220fd2+'_'+_0x55d840,_0x55d840++;}_0x4eb9a7[_0x143743(0x213)](_0x4d175b),_0x2f9a1c['set'](_0x2dfecb,_0x4d175b);const _0x46d160={'name':_0x4d175b,'isJourneyLocal':!![],'definition':_0x353ef7};return _0x9f54d['set'](_0x22a8b1,_0x46d160),_0x46d160;}catch(_0x59262e){return _0x44d492[_0x143743(0x1f8)]&&console[_0x143743(0x207)](_0x143743(0x1b1)+_0x22a8b1+':\x20'+_0x59262e[_0x143743(0x1d3)]),{'name':_0x22a8b1,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x2ff123,_0x5b7473)=>{const _0x1c4345=_0x4273c6;return resolveJumpTarget(_0x2ff123,_0x5b7473,_0x4e53c2,_0x239438=>_0xdba7df[_0x1c4345(0x27a)]['getJourney'](_0x239438));}},_0x373dfa=await journeyResponseToDef(_0x5c1055,_0xe9c96a);_0x299bfd[_0x4273c6(0x1f0)]({'item':_0x5ca1d1,'yaml':_0x373dfa});}},{'verbose':_0x44d492[_0x1ed532(0x1f8)]});const _0x204f3e=buildMergedJourneyDef(_0x299bfd,_0x4dc0e7),_0x4c7d75=normalizeJourneyDef(_0x204f3e,_0x60aaf),_0x35c6a4=toYamlString(_0x4c7d75),_0x5d2ba7=_0x36768d||a18_0xd2051b[_0x1ed532(0x1d1)](_0xc285ef,sanitizeFileName(_0x210baf)+_0x1ed532(0x25c));!_0x36768d&&_0x3ef515&&!existsSync(_0xc285ef)&&mkdirSync(_0xc285ef,{'recursive':!![]});const _0x3b3d83=a18_0xd2051b['relative'](process['cwd'](),_0x5d2ba7);if(existsSync(_0x5d2ba7)){const _0xc591e4=readFileSync(_0x5d2ba7,_0x1ed532(0x1bb)),_0x3c6247=generateDiff(_0xc591e4,_0x35c6a4),_0x4de69a=hasChanges(_0x3c6247);_0xf2c590['push']({'relativePath':_0x3b3d83,'absolutePath':_0x5d2ba7,'content':_0x35c6a4,'isNew':![],'hasChanges':_0x4de69a,'diff':_0x4de69a?formatDiffWithColors(_0x3c6247):undefined});}else _0xf2c590[_0x1ed532(0x1f0)]({'relativePath':_0x3b3d83,'absolutePath':_0x5d2ba7,'content':_0x35c6a4,'isNew':!![],'hasChanges':![]});}const _0x27bbb3=_0xf2c590[_0x1ed532(0x275)](_0x4c6351=>_0x4c6351[_0x1ed532(0x1dd)]),_0x1b4dd3=_0xf2c590[_0x1ed532(0x275)](_0x18b265=>!_0x18b265[_0x1ed532(0x1dd)]&&_0x18b265[_0x1ed532(0x279)]),_0x4356eb=_0xf2c590[_0x1ed532(0x275)](_0x583557=>!_0x583557[_0x1ed532(0x1dd)]&&!_0x583557['hasChanges']),_0x57055c=_0x4ae721['length'],_0xbb11df=_0x127e82[_0x1ed532(0x245)],_0x4ff9b8=_0x57055c>_0xbb11df?'\x20('+_0x57055c+'\x20versions)':'';console[_0x1ed532(0x207)]('\x0aPull\x20summary:'),console[_0x1ed532(0x207)]('\x20\x20'+a18_0x280cd0['cyan'](_0xbb11df+_0x1ed532(0x267))+a18_0x280cd0[_0x1ed532(0x262)](_0x4ff9b8)),console[_0x1ed532(0x207)]('\x20\x20'+a18_0x280cd0[_0x1ed532(0x269)]('+\x20'+_0x27bbb3[_0x1ed532(0x224)]+_0x1ed532(0x1d9))),console[_0x1ed532(0x207)]('\x20\x20'+a18_0x280cd0['yellow']('~\x20'+_0x1b4dd3[_0x1ed532(0x224)]+_0x1ed532(0x1f4))),console[_0x1ed532(0x207)]('\x20\x20'+a18_0x280cd0[_0x1ed532(0x262)]('=\x20'+_0x4356eb['length']+_0x1ed532(0x26d))),console['error'](_0x1ed532(0x24d)+a18_0x280cd0[_0x1ed532(0x22c)](_0x1553d2)+'\x0a');if(_0x1b4dd3['length']>0x0)for(const _0x30147e of _0x1b4dd3){console[_0x1ed532(0x207)](_0x1ed532(0x263)+_0x30147e[_0x1ed532(0x22f)]+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x1ed532(0x207)](_0x30147e['diff']),console['error']('─'['repeat'](0x3c));}if(_0x2b7ee2['dryRun'])return console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x205)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x27bbb3[_0x1ed532(0x224)]===0x0&&_0x1b4dd3[_0x1ed532(0x224)]===0x0)return console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x269)](_0x1ed532(0x204))),saveSessionContext({'parent_segment':_0x303c24},_0x2b7ee2[_0x1ed532(0x216)]),console[_0x1ed532(0x207)](a18_0x280cd0['green'](_0x1ed532(0x1cf)+a18_0x280cd0[_0x1ed532(0x262)]('parent_segment')+'\x20=\x20'+a18_0x280cd0[_0x1ed532(0x22c)](_0x303c24))),0x0;if(!_0x2b7ee2[_0x1ed532(0x253)]&&(_0x27bbb3[_0x1ed532(0x224)]>0x0||_0x1b4dd3[_0x1ed532(0x224)]>0x0)){if(!isInteractive())return console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x273)](_0x1ed532(0x20c)),_0x1ed532(0x242)),console['error'](a18_0x280cd0[_0x1ed532(0x262)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x3f955c=await confirmKey(_0x1ed532(0x1f2)+(_0x27bbb3[_0x1ed532(0x224)]+_0x1b4dd3[_0x1ed532(0x224)])+_0x1ed532(0x1c4));if(!_0x3f955c)return console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x205)]('Aborted.'),'-\x20no\x20files\x20written'),0x1;}!existsSync(_0x1553d2)&&mkdirSync(_0x1553d2,{'recursive':!![]});for(const _0x3417ef of _0xf2c590){(_0x3417ef[_0x1ed532(0x1dd)]||_0x3417ef[_0x1ed532(0x279)])&&writeFileSync(_0x3417ef['absolutePath'],_0x3417ef[_0x1ed532(0x233)],_0x1ed532(0x1bb));}return console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x269)](_0x1ed532(0x23e)+(_0x27bbb3[_0x1ed532(0x224)]+_0x1b4dd3['length'])+_0x1ed532(0x1b6)+_0x1553d2)),saveSessionContext({'parent_segment':_0x303c24},_0x2b7ee2[_0x1ed532(0x216)]),console[_0x1ed532(0x207)](a18_0x280cd0[_0x1ed532(0x269)]('✔\x20Context\x20set:\x20'+a18_0x280cd0[_0x1ed532(0x262)](_0x1ed532(0x211))+_0x1ed532(0x1cc)+a18_0x280cd0[_0x1ed532(0x22c)](_0x303c24))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x164af0(0x228)]=a18_0x164af0(0x270);['description']='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data';[a18_0x164af0(0x1f5)]=new SegmentPushCommand();async[a18_0x164af0(0x221)](_0x106ff9){const _0x1bccd4=a18_0x164af0,_0x163f55=_0x106ff9[_0x1bccd4(0x225)][0x0];let _0x24bbec;if(_0x163f55){const _0x559d7d=await resolveTarget({'arg':_0x163f55,'contextParent':_0x106ff9[_0x1bccd4(0x1b9)][_0x1bccd4(0x25b)],'cwd':process[_0x1bccd4(0x25d)]()});isSuccessfulResolution(_0x559d7d)&&_0x559d7d[_0x1bccd4(0x23c)]===_0x1bccd4(0x243)&&(_0x24bbec=_0x559d7d['filePath']);}const _0x2344b4={..._0x106ff9,'options':{..._0x106ff9[_0x1bccd4(0x1b9)],'journeysOnly':!![],..._0x24bbec&&{'singleFilePath':_0x24bbec}}};return this[_0x1bccd4(0x1f5)][_0x1bccd4(0x221)](_0x2344b4);}}
1
+ const a18_0x1ef748=a18_0x5933;(function(_0x561de4,_0x41ea49){const _0x16220b=a18_0x5933,_0x2e5cb2=_0x561de4();while(!![]){try{const _0x22d5e8=-parseInt(_0x16220b(0x1f1))/0x1+parseInt(_0x16220b(0x16d))/0x2+parseInt(_0x16220b(0x1b8))/0x3+parseInt(_0x16220b(0x170))/0x4+-parseInt(_0x16220b(0x1eb))/0x5*(-parseInt(_0x16220b(0x172))/0x6)+parseInt(_0x16220b(0x178))/0x7+-parseInt(_0x16220b(0x1a1))/0x8;if(_0x22d5e8===_0x41ea49)break;else _0x2e5cb2['push'](_0x2e5cb2['shift']());}catch(_0x1bfe57){_0x2e5cb2['push'](_0x2e5cb2['shift']());}}}(a18_0xea74,0x7966c));import a18_0x2bf388 from'chalk';import a18_0x4599c5 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a18_0xea74(){const _0x317163=['✔\x20Journey\x20\x22','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Getting\x20journey\x20statistics...','Usage:\x20journey\x20resume\x20<name-or-path>','(root)','json','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Listing\x20journeys...','Pause\x20a\x20running\x20journey','resume','session','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','folders','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','totalEntered','all','test','stage','\x22\x20paused','length','Fetching\x20','Parent\x20segment:\x20','Fetching\x20parent\x20segment...','file','diff','name','\x20Opening\x20','Input:\x20','Usage:\x20journey\x20stats\x20<name-or-path>','Resolving\x20parent\x20segment...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','parent_segment','19929208bEwNfq','options','map','Cancelled','resolveJourneyId','stringify','connector_config','includeStats','then','\x20journey\x20files\x20to\x20','hasChanges','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','yellow','getStatistics','/j/da/je','data','getJourney','get','draft','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','conversionRate','\x20(ID:\x20','2965677Bxbrtz','Error:\x20','(completed)','Resuming\x20journey...','✔\x20Context\x20set:\x20','journeyBundleId','\x0aError:','population','attributes','totalGoalAchieved','utf-8','user','execute','join','\x20new\x20files','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','reentryMode','listJourneysFromParentSegment','✔\x20All\x20files\x20are\x20up\x20to\x20date','getActivation','cyan','.yml','/app/ps/','\x20->\x20','rootFolderId','isNew','message','\x5c$&','journeyName','type','archived','cwd','parentSegment','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','parentName','no_parent','relativePath','\x20\x20-\x20','audienceId','entered','\x20unchanged\x20files','\x20changed\x20files','...','Folder\x20path:\x20','getSegment','Warning:\x20Stage\x20\x22','resolveParentId','Resolving\x20journey...','✔\x20Found\x20','resourceName','pause','145SmxjfR','Getting\x20journey\x20details...','\x0aChanges\x20to\x20\x27','filter','localeCompare','table','30653iBkBDj','getParentFull','Listing\x20folders...','\x22\x20not\x20found','journey:list','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','push','values','journey:view','Target\x20file:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','paused','description','Options:','sort','setPhase','\x20journey','versionNumber','find','journeys','repeat','Error:\x20Parent\x20segment\x20context\x20required','site','\x20\x20Target:\x20','error','listFolders','replace','(draft)','dim','goal','dryRun','yes','exited','🗺️\x20','has','toLowerCase','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)','Found\x20','Error:\x20Journey\x20not\x20found:\x20','entries','helpText','stages','folderId','activationParams','(running)','folderPath','-\x20no\x20files\x20written','Fetching\x20connections\x20for\x20name\x20resolution...','segmentName','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','split','\x20versions)','INVALID_ARGUMENT','buildIdToEmailMap','journey','green','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20\x20Name:\x20','set','journeyId','journeyBundleName','size','segmentPushCommand','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','log','stageName','journey:resume','listJourneysWithFolders','\x20=\x20','add','red','filePath','1738550OMBgUw','/e/','segments','322960kwMwfm','state','85938Mxriht','content','activation_','journey:push','Pausing\x20journey...','base','4655861RpjnAA','segment','launched','(paused)','kind','No\x20journeys\x20found','verbose','Export\x20journey(s)\x20as\x20YAML\x20files','rule'];a18_0xea74=function(){return _0x317163;};return a18_0xea74();}import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}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(_0x2315d4){const _0x4648c7=a18_0x5933;switch(_0x2315d4){case _0x4648c7(0x17a):return a18_0x2bf388['green'](_0x4648c7(0x150));case _0x4648c7(0x1b3):return a18_0x2bf388[_0x4648c7(0x140)](_0x4648c7(0x13f));case _0x4648c7(0x1fc):return a18_0x2bf388['yellow'](_0x4648c7(0x17b));case'completed':return a18_0x2bf388['blue'](_0x4648c7(0x1ba));case _0x4648c7(0x1d6):return a18_0x2bf388[_0x4648c7(0x140)]('(archived)');default:return'('+_0x2315d4+')';}}function formatJourneyItem(_0x5079dc,_0x247493='',_0x585ab0){const _0x569e65=a18_0x5933,_0x8ea5=formatJourneyState(_0x5079dc[_0x569e65(0x171)]),_0x14ff1a=_0x585ab0?hyperlink(_0x5079dc[_0x569e65(0x160)],_0x585ab0):_0x5079dc[_0x569e65(0x160)];return _0x247493+_0x569e65(0x145)+_0x14ff1a+'\x20'+_0x8ea5;}function escapeRegex(_0x1a432f){const _0x4716eb=a18_0x5933;return _0x1a432f[_0x4716eb(0x13e)](/[.*+?^${}()|[\]\\]/g,_0x4716eb(0x1d3));}function a18_0x5933(_0x3b7f86,_0x2ba05e){_0x3b7f86=_0x3b7f86-0x137;const _0xea74ad=a18_0xea74();let _0x593331=_0xea74ad[_0x3b7f86];return _0x593331;}function globToRegex(_0x43daf1){const _0x1e4128=a18_0x5933,_0x42283e=_0x43daf1[_0x1e4128(0x156)]('*')[_0x1e4128(0x1a3)](escapeRegex);return new RegExp(_0x42283e[_0x1e4128(0x1c5)]('.*'),'i');}function buildRuleToNameMapping(_0x47c9a0){const _0x388051=a18_0x5933,_0x54e219=new Map();if(_0x47c9a0[_0x388051(0x16f)])for(const [_0x52c563,_0x13b9b2]of Object['entries'](_0x47c9a0[_0x388051(0x16f)])){if(_0x13b9b2[_0x388051(0x180)]){const _0x2bd39e=serializeRule(_0x13b9b2[_0x388051(0x180)]),_0x2d29e5=_0x54e219[_0x388051(0x1b2)](_0x2bd39e);_0x2d29e5?_0x2d29e5[_0x388051(0x1f7)](_0x52c563):_0x54e219[_0x388051(0x15e)](_0x2bd39e,[_0x52c563]);}}return _0x54e219;}async function resolveJourneyTarget(_0x1bf639,_0x25a17c,_0x297fec){const _0x2841d3=a18_0x5933;if(isYamlFilePath(_0x1bf639))try{const _0x2a5bd5=await resolveYamlFilePath(_0x1bf639);return _0x297fec&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x1bf639),console[_0x2841d3(0x13c)]('\x20\x20Parent\x20segment:\x20'+_0x2a5bd5[_0x2841d3(0x1d8)]),console['error'](_0x2841d3(0x15d)+_0x2a5bd5[_0x2841d3(0x154)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x2a5bd5[_0x2841d3(0x151)]||_0x2841d3(0x185)))),{'journeyName':_0x2a5bd5[_0x2841d3(0x154)],'parentSegment':_0x2a5bd5[_0x2841d3(0x1d8)],'resolved':_0x2a5bd5};}catch(_0x6cf881){throw new SDKError(ErrorCode[_0x2841d3(0x158)],_0x2841d3(0x18c)+_0x6cf881[_0x2841d3(0x1d2)]);}if(!_0x25a17c)throw new SDKError(ErrorCode[_0x2841d3(0x158)],_0x2841d3(0x1c7));return{'journeyName':_0x1bf639,'parentSegment':_0x25a17c};}export class JourneyListCommand extends BaseCommand{['name']=a18_0x1ef748(0x1f5);[a18_0x1ef748(0x1fd)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x2523ed){const _0x28a8b4=a18_0x1ef748,{options:_0x3f22c1,args:_0x5be06e,tdx:_0x422f08}=_0x2523ed,_0x3888c8=_0x5be06e[0x0],_0x1e1f9f=_0x3f22c1[_0x28a8b4(0x1d8)];if(!_0x1e1f9f)return console[_0x28a8b4(0x13c)](_0x28a8b4(0x139)),console[_0x28a8b4(0x13c)](_0x28a8b4(0x1d9)),0x1;const _0xf59f92=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x422f08['segment'][_0x28a8b4(0x1e6)](_0x1e1f9f),{'verbose':_0x3f22c1['verbose']}),_0x339d87=_0xf59f92['data'];_0x3f22c1[_0x28a8b4(0x17e)]&&(console[_0x28a8b4(0x13c)]('Parent\x20segment:\x20'+_0x1e1f9f+_0x28a8b4(0x1b7)+_0x339d87+')'),_0x3888c8&&console[_0x28a8b4(0x13c)]('Pattern:\x20'+_0x3888c8));const _0x3283ab=await withSpinner(_0x28a8b4(0x197),()=>_0x422f08[_0x28a8b4(0x179)][_0x28a8b4(0x1f2)](_0x339d87),{'verbose':_0x3f22c1[_0x28a8b4(0x17e)]}),_0x2a7d65=_0x3283ab[_0x28a8b4(0x1b0)],_0x7d1e54=_0x2a7d65[_0x28a8b4(0x1d0)],_0x5782d8=await withSpinner(_0x28a8b4(0x188),()=>_0x422f08[_0x28a8b4(0x15a)][_0x28a8b4(0x168)](_0x339d87,_0x7d1e54),{'verbose':_0x3f22c1[_0x28a8b4(0x17e)]});let _0x5994b2=_0x5782d8[_0x28a8b4(0x1b0)][_0x28a8b4(0x137)];const _0x1252db=_0x5782d8[_0x28a8b4(0x1b0)][_0x28a8b4(0x18d)],_0x1be3d3=new Map();for(const _0x7782fa of _0x1252db){_0x1be3d3['set'](_0x7782fa['id'],_0x7782fa[_0x28a8b4(0x19a)]);}if(_0x3888c8){const _0x28facd=globToRegex(_0x3888c8);_0x5994b2=_0x5994b2[_0x28a8b4(0x1ee)](_0x5ac78a=>_0x28facd[_0x28a8b4(0x191)](_0x5ac78a[_0x28a8b4(0x160)]));}console[_0x28a8b4(0x13c)](_0x28a8b4(0x1e8)+_0x5994b2[_0x28a8b4(0x194)]+_0x28a8b4(0x201)+(_0x5994b2['length']!==0x1?'s':''));const _0x533e62=_0x4385e4=>{const _0x1dfe42=_0x28a8b4;return getConsoleNextUrl(_0x3f22c1['site'],_0x1dfe42(0x1ce)+_0x339d87+_0x1dfe42(0x16e)+_0x4385e4+'/j/da');};if(_0x3f22c1['format']===_0x28a8b4(0x1f0))await handleSDKOutput(_0x5994b2,_0x3f22c1);else{if(_0x3f22c1['format']===_0x28a8b4(0x186)){const _0x2570d3=_0x5994b2[_0x28a8b4(0x1a3)](_0x43b956=>({..._0x43b956,'url':_0x533e62(_0x43b956['id'])}));await handleSDKOutput(_0x2570d3,_0x3f22c1);}else{console[_0x28a8b4(0x165)]('['+_0x1e1f9f+']');const _0x15fbfc=new Map(),_0x1140ca=[];for(const _0x29b6f7 of _0x5994b2){if(!_0x29b6f7['folderId']||_0x29b6f7[_0x28a8b4(0x14e)]===_0x7d1e54)_0x1140ca[_0x28a8b4(0x1f7)](_0x29b6f7);else{const _0x41c8b2=_0x15fbfc[_0x28a8b4(0x1b2)](_0x29b6f7['folderId'])||[];_0x41c8b2[_0x28a8b4(0x1f7)](_0x29b6f7),_0x15fbfc[_0x28a8b4(0x15e)](_0x29b6f7[_0x28a8b4(0x14e)],_0x41c8b2);}}const _0x23975b=(_0x52a442,_0x394051)=>_0x52a442[_0x28a8b4(0x160)]['localeCompare'](_0x394051[_0x28a8b4(0x160)],undefined,{'sensitivity':_0x28a8b4(0x177)});_0x1140ca[_0x28a8b4(0x1ff)](_0x23975b);for(const _0x2c89ab of _0x1140ca){console[_0x28a8b4(0x165)](formatJourneyItem(_0x2c89ab,'',_0x533e62(_0x2c89ab['id'])));}const _0x2973df=[..._0x15fbfc[_0x28a8b4(0x14b)]()][_0x28a8b4(0x1ff)]((_0x363e99,_0x367112)=>{const _0x1a1c68=_0x28a8b4,_0x31bc21=_0x1be3d3[_0x1a1c68(0x1b2)](_0x363e99[0x0])||_0x363e99[0x0],_0x14f226=_0x1be3d3[_0x1a1c68(0x1b2)](_0x367112[0x0])||_0x367112[0x0];return _0x31bc21[_0x1a1c68(0x1ef)](_0x14f226,undefined,{'sensitivity':'base'});});for(const [_0xb3fe1f,_0x18df1b]of _0x2973df){const _0x21cc0d=_0x1be3d3[_0x28a8b4(0x1b2)](_0xb3fe1f)||_0xb3fe1f;console[_0x28a8b4(0x165)]('📁\x20'+_0x21cc0d),_0x18df1b['sort'](_0x23975b);for(const _0x33deda of _0x18df1b){console[_0x28a8b4(0x165)](formatJourneyItem(_0x33deda,'\x20\x20',_0x533e62(_0x33deda['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x1ef748(0x19a)]=a18_0x1ef748(0x1f9);[a18_0x1ef748(0x1fd)]='Show\x20journey\x20details';async[a18_0x1ef748(0x1c4)](_0x46e486){const _0xde0cc3=a18_0x1ef748,{options:_0x2a3b8b,args:_0x575ac3,tdx:_0x7fb617}=_0x46e486,_0x387963=_0x575ac3[0x0];if(!_0x387963)return console['error'](_0xde0cc3(0x182)),console['error'](_0xde0cc3(0x164)),console[_0xde0cc3(0x13c)](_0xde0cc3(0x1fe)),console[_0xde0cc3(0x13c)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x2a3b8b['verbose']&&console['error'](_0xde0cc3(0x19c)+_0x387963);const _0x3b2a67=await resolveJourneyTarget(_0x387963,_0x2a3b8b['parentSegment'],_0x2a3b8b[_0xde0cc3(0x17e)]),_0x701330=await withSpinner(_0xde0cc3(0x19e),()=>_0x7fb617[_0xde0cc3(0x179)][_0xde0cc3(0x1e6)](_0x3b2a67[_0xde0cc3(0x1d8)]),{'verbose':_0x2a3b8b[_0xde0cc3(0x17e)]}),_0x5d3246=_0x701330[_0xde0cc3(0x1b0)],_0x5bef95=await withSpinner(_0xde0cc3(0x1e7),()=>_0x7fb617['journey'][_0xde0cc3(0x1a5)](_0x5d3246,_0x3b2a67[_0xde0cc3(0x1d4)]),{'verbose':_0x2a3b8b['verbose']}),_0x1bdf38=_0x5bef95[_0xde0cc3(0x1b0)];if(_0x2a3b8b['web']){const _0x7e2acf=getConsoleNextUrl(_0x2a3b8b['site'],'/app/ps/'+_0x5d3246+_0xde0cc3(0x16e)+_0x1bdf38+'/j/da/je');return console[_0xde0cc3(0x13c)](a18_0x2bf388[_0xde0cc3(0x15b)]('✔')+_0xde0cc3(0x19b)+a18_0x2bf388[_0xde0cc3(0x1cc)](_0x7e2acf)),openBrowser(_0x7e2acf),0x0;}const _0x52a645=await withSpinner(_0xde0cc3(0x1ec),()=>_0x7fb617[_0xde0cc3(0x15a)][_0xde0cc3(0x1b1)](_0x1bdf38),{'verbose':_0x2a3b8b[_0xde0cc3(0x17e)]}),_0x31a6b9=_0x52a645['data'],_0x358cd2=_0x2a3b8b[_0xde0cc3(0x1a8)];let _0xa8fdf2;if(_0x358cd2)try{const _0x3aacb0=await withSpinner(_0xde0cc3(0x183),()=>_0x7fb617['journey'][_0xde0cc3(0x1ae)](_0x1bdf38),{'verbose':_0x2a3b8b[_0xde0cc3(0x17e)]});_0xa8fdf2=_0x3aacb0[_0xde0cc3(0x1b0)];}catch{_0x2a3b8b[_0xde0cc3(0x17e)]&&console[_0xde0cc3(0x13c)]('\x20\x20Statistics\x20not\x20available');}const _0x147955=getConsoleNextUrl(_0x2a3b8b[_0xde0cc3(0x13a)],_0xde0cc3(0x1ce)+_0x5d3246+_0xde0cc3(0x16e)+_0x1bdf38+_0xde0cc3(0x1af)),_0x2d7adb={'id':_0x31a6b9['id'],'name':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x19a)],'description':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x1fd)],'state':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x171)],'paused':_0x31a6b9[_0xde0cc3(0x1c0)]['paused'],'reentry_mode':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x1c8)],'stages':_0x31a6b9[_0xde0cc3(0x1c0)]['journeyStages']?.[_0xde0cc3(0x194)]||0x0,..._0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x141)]&&{'goal':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x141)][_0xde0cc3(0x19a)]},..._0xa8fdf2&&{'statistics':{'total_entered':_0xa8fdf2[_0xde0cc3(0x18f)],'goal_achieved':_0xa8fdf2[_0xde0cc3(0x1c1)],'goal_rate':_0xa8fdf2['goalRate'],'stages':_0xa8fdf2[_0xde0cc3(0x14d)]}},'url':_0x147955};return await handleSingleObjectOutput(_0x2d7adb,_0x2a3b8b),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x1ef748(0x19a)]='journey:stats';[a18_0x1ef748(0x1fd)]='Show\x20journey\x20statistics';async[a18_0x1ef748(0x1c4)](_0x2b192b){const _0x12fba5=a18_0x1ef748,{options:_0x101306,args:_0x129312,tdx:_0x37db7a}=_0x2b192b,_0x400d2d=_0x129312[0x0];if(!_0x400d2d)return console['error'](_0x12fba5(0x182)),console['error'](_0x12fba5(0x19d)),0x1;_0x101306[_0x12fba5(0x17e)]&&console[_0x12fba5(0x13c)](_0x12fba5(0x19c)+_0x400d2d);const _0x5620b7=await resolveJourneyTarget(_0x400d2d,_0x101306[_0x12fba5(0x1d8)],_0x101306[_0x12fba5(0x17e)]),_0x4ab8e3=await withSpinner(_0x12fba5(0x19e),()=>_0x37db7a[_0x12fba5(0x179)][_0x12fba5(0x1e6)](_0x5620b7['parentSegment']),{'verbose':_0x101306['verbose']}),_0xc96807=_0x4ab8e3[_0x12fba5(0x1b0)],_0x1dc396=await withSpinner('Resolving\x20journey...',()=>_0x37db7a[_0x12fba5(0x15a)][_0x12fba5(0x1a5)](_0xc96807,_0x5620b7[_0x12fba5(0x1d4)]),{'verbose':_0x101306[_0x12fba5(0x17e)]}),_0x375c82=_0x1dc396[_0x12fba5(0x1b0)],_0x3e785e=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x37db7a['journey'][_0x12fba5(0x1ae)](_0x375c82),{'verbose':_0x101306['verbose']}),_0x3b3bb7=_0x3e785e['data'];if(!_0x3b3bb7||_0x3b3bb7[_0x12fba5(0x15f)]===null)return console[_0x12fba5(0x13c)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x5620b7[_0x12fba5(0x1d4)]),console[_0x12fba5(0x13c)](_0x12fba5(0x1f6)),0x0;const _0x4a4bb={'journey_id':_0x3b3bb7['journeyId'],'total_entered':_0x3b3bb7[_0x12fba5(0x18f)],'goal_achieved':_0x3b3bb7[_0x12fba5(0x1c1)],'goal_rate':_0x3b3bb7['goalRate'],'stages':_0x3b3bb7[_0x12fba5(0x14d)]?.[_0x12fba5(0x1a3)](_0x5650f2=>({'name':_0x5650f2['stageName'],'population':_0x5650f2[_0x12fba5(0x1bf)],'entered':_0x5650f2[_0x12fba5(0x1df)],'exited':_0x5650f2[_0x12fba5(0x144)],'conversion_rate':_0x5650f2['conversionRate']}))},_0x544b70=_0x101306[_0x12fba5(0x192)];if(_0x544b70&&_0x3b3bb7['stages']){const _0x524e12=_0x3b3bb7[_0x12fba5(0x14d)][_0x12fba5(0x203)](_0x28e4ee=>_0x28e4ee['stageName']['toLowerCase']()===_0x544b70[_0x12fba5(0x147)]());if(_0x524e12)return await handleSingleObjectOutput({'stage_name':_0x524e12[_0x12fba5(0x166)],'population':_0x524e12[_0x12fba5(0x1bf)],'entered':_0x524e12['entered'],'exited':_0x524e12[_0x12fba5(0x144)],'conversion_rate':_0x524e12[_0x12fba5(0x1b6)]},_0x101306),0x0;console[_0x12fba5(0x13c)](_0x12fba5(0x1e5)+_0x544b70+_0x12fba5(0x1f4));}return await handleSingleObjectOutput(_0x4a4bb,_0x101306),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']='journey:pause';[a18_0x1ef748(0x1fd)]=a18_0x1ef748(0x189);async['execute'](_0x3c4a38){const _0x421983=a18_0x1ef748,{options:_0xca8c,args:_0x199f00,tdx:_0x32aab7}=_0x3c4a38,_0x103aef=_0x199f00[0x0];if(!_0x103aef)return console['error'](_0x421983(0x182)),console[_0x421983(0x13c)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0xca8c[_0x421983(0x17e)]&&console['error'](_0x421983(0x19c)+_0x103aef);const _0x582ccf=await resolveJourneyTarget(_0x103aef,_0xca8c['parentSegment'],_0xca8c[_0x421983(0x17e)]),_0x2af3e5=await withSpinner(_0x421983(0x19e),()=>_0x32aab7[_0x421983(0x179)][_0x421983(0x1e6)](_0x582ccf[_0x421983(0x1d8)]),{'verbose':_0xca8c[_0x421983(0x17e)]}),_0x59f35f=_0x2af3e5[_0x421983(0x1b0)],_0x18be74=await withSpinner(_0x421983(0x1e7),()=>_0x32aab7[_0x421983(0x15a)][_0x421983(0x1a5)](_0x59f35f,_0x582ccf[_0x421983(0x1d4)]),{'verbose':_0xca8c[_0x421983(0x17e)]}),_0x1205d0=_0x18be74[_0x421983(0x1b0)];if(!_0xca8c[_0x421983(0x143)]){const _0x3e8b5f=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x582ccf['journeyName']+'\x22?');if(!_0x3e8b5f)return console[_0x421983(0x13c)](_0x421983(0x1a4)),0x0;}const _0x185512=await withSpinner(_0x421983(0x176),()=>_0x32aab7['journey'][_0x421983(0x1ea)](_0x1205d0),{'verbose':_0xca8c[_0x421983(0x17e)]}),_0x151975=_0x185512[_0x421983(0x1b0)];return console[_0x421983(0x13c)](_0x421983(0x181)+_0x151975[_0x421983(0x1c0)]['name']+_0x421983(0x193)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x1ef748(0x19a)]=a18_0x1ef748(0x167);['description']='Resume\x20a\x20paused\x20journey';async[a18_0x1ef748(0x1c4)](_0x49e2ab){const _0x4e6666=a18_0x1ef748,{options:_0x3223db,args:_0x26a7ea,tdx:_0x7b29bd}=_0x49e2ab,_0x384022=_0x26a7ea[0x0];if(!_0x384022)return console[_0x4e6666(0x13c)](_0x4e6666(0x182)),console['error'](_0x4e6666(0x184)),0x1;_0x3223db[_0x4e6666(0x17e)]&&console['error'](_0x4e6666(0x19c)+_0x384022);const _0x326072=await resolveJourneyTarget(_0x384022,_0x3223db[_0x4e6666(0x1d8)],_0x3223db[_0x4e6666(0x17e)]),_0x3005ea=await withSpinner(_0x4e6666(0x19e),()=>_0x7b29bd['segment'][_0x4e6666(0x1e6)](_0x326072[_0x4e6666(0x1d8)]),{'verbose':_0x3223db[_0x4e6666(0x17e)]}),_0x1e2e5f=_0x3005ea[_0x4e6666(0x1b0)],_0x11caa7=await withSpinner(_0x4e6666(0x1e7),()=>_0x7b29bd[_0x4e6666(0x15a)]['resolveJourneyId'](_0x1e2e5f,_0x326072[_0x4e6666(0x1d4)]),{'verbose':_0x3223db[_0x4e6666(0x17e)]}),_0x1c45bd=_0x11caa7[_0x4e6666(0x1b0)];if(!_0x3223db[_0x4e6666(0x143)]){const _0x415e48=await confirm(_0x4e6666(0x163)+_0x326072[_0x4e6666(0x1d4)]+'\x22?');if(!_0x415e48)return console['error'](_0x4e6666(0x1a4)),0x0;}const _0x40859a=await withSpinner(_0x4e6666(0x1bb),()=>_0x7b29bd[_0x4e6666(0x15a)][_0x4e6666(0x18a)](_0x1c45bd),{'verbose':_0x3223db[_0x4e6666(0x17e)]}),_0x10cd05=_0x40859a[_0x4e6666(0x1b0)];return console['error'](_0x4e6666(0x181)+_0x10cd05[_0x4e6666(0x1c0)]['name']+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x1ef748(0x19a)]='journey:pull';[a18_0x1ef748(0x1fd)]=a18_0x1ef748(0x17f);async[a18_0x1ef748(0x1c4)](_0x116899){const _0x34e112=a18_0x1ef748,{options:_0x27da0e,args:_0x59a5f7,tdx:_0x5a5c03}=_0x116899,_0x243f3d=_0x27da0e,_0x52265c=_0x59a5f7[0x0],_0x371e4c=_0x52265c&&isYamlFilePath(_0x52265c),_0x40ee01=await resolveTarget({'arg':_0x371e4c?_0x52265c:undefined,'contextParent':_0x27da0e['parentSegment'],'cwd':process[_0x34e112(0x1d7)]()});if(!isSuccessfulResolution(_0x40ee01))return _0x40ee01['errorCode']===_0x34e112(0x1db)?(console['error'](a18_0x2bf388[_0x34e112(0x1ad)](_0x34e112(0x15c))),console[_0x34e112(0x13c)](_0x34e112(0x148)),console[_0x34e112(0x13c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x34e112(0x13c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console['error'](_0x34e112(0x187))):(console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x16b)](_0x34e112(0x1b9)+_0x40ee01[_0x34e112(0x1d2)]+'\x0a')),_0x40ee01[_0x34e112(0x14c)]&&console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x1cc)](_0x40ee01[_0x34e112(0x14c)]))),0x1;let _0x2620eb=_0x371e4c?undefined:_0x52265c,_0x7800f1,_0xdda03d;_0x40ee01[_0x34e112(0x1d5)]===_0x34e112(0x198)&&(_0x2620eb=_0x40ee01[_0x34e112(0x1e9)],_0x7800f1=_0x40ee01[_0x34e112(0x16c)],_0xdda03d=_0x40ee01[_0x34e112(0x151)]);const _0x2017fa=_0x40ee01[_0x34e112(0x1da)],_0x4209b7=_0x40ee01['targetDir'];_0x243f3d[_0x34e112(0x17e)]&&(console[_0x34e112(0x13c)](_0x34e112(0x196)+_0x2017fa),console['error']('Target\x20directory:\x20'+_0x4209b7),_0x2620eb&&console['error']('Journey\x20name:\x20'+_0x2620eb),_0x7800f1&&console['error'](_0x34e112(0x1fa)+_0x7800f1),_0xdda03d&&console['error'](_0x34e112(0x1e3)+_0xdda03d));const _0x4c7368=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x5a5c03[_0x34e112(0x179)][_0x34e112(0x1e6)](_0x2017fa),{'verbose':_0x27da0e['verbose']}),_0x2b0168=_0x4c7368[_0x34e112(0x1b0)],[_0x3ff3ec,_0x4f5cb4]=await Promise[_0x34e112(0x190)]([withSpinner(_0x34e112(0x188),()=>_0x5a5c03[_0x34e112(0x15a)][_0x34e112(0x1c9)](_0x2b0168,undefined,{'includeAllVersions':!![]}),{'verbose':_0x27da0e[_0x34e112(0x17e)]}),withSpinner(_0x34e112(0x1f3),()=>_0x5a5c03['segment'][_0x34e112(0x13d)](_0x2b0168),{'verbose':_0x27da0e[_0x34e112(0x17e)]})]);let _0xf6b1b1=_0x3ff3ec[_0x34e112(0x1b0)];const _0x514915=_0x4f5cb4[_0x34e112(0x1b0)],_0x4a00b5=buildFolderIdToPathMap(_0x514915);if(_0x2620eb){const _0x24a657=_0xf6b1b1[_0x34e112(0x1ee)](_0x4b54ca=>_0x4b54ca[_0x34e112(0x160)][_0x34e112(0x147)]()===_0x2620eb['toLowerCase']());if(_0x24a657[_0x34e112(0x194)]===0x0)return console[_0x34e112(0x13c)](_0x34e112(0x14a)+_0x2620eb),console[_0x34e112(0x13c)](_0x34e112(0x155)),0x1;_0xf6b1b1=_0x24a657;}if(_0xdda03d!==undefined){const _0x16d3b1=_0xf6b1b1[_0x34e112(0x1ee)](_0x6c4ee2=>{const _0x32bd5f=_0x34e112,_0x350415=_0x6c4ee2[_0x32bd5f(0x14e)]?_0x4a00b5[_0x32bd5f(0x1b2)](_0x6c4ee2[_0x32bd5f(0x14e)])||'':'';return _0x350415===_0xdda03d;});if(_0x16d3b1[_0x34e112(0x194)]===0x0&&_0xf6b1b1[_0x34e112(0x194)]>0x0){console[_0x34e112(0x13c)]('Error:\x20Journey\x20\x27'+_0x2620eb+'\x27\x20not\x20found\x20in\x20'+(_0xdda03d||'root\x20folder')),console[_0x34e112(0x13c)](_0x34e112(0x1b5));for(const _0x219202 of _0xf6b1b1){const _0x143d87=_0x219202[_0x34e112(0x14e)]?_0x4a00b5['get'](_0x219202['folderId'])||'':'';console[_0x34e112(0x13c)](_0x34e112(0x1dd)+(_0x143d87||_0x34e112(0x185))+'/'+_0x219202['journeyBundleName']);}return 0x1;}_0xf6b1b1=_0x16d3b1;}if(_0xf6b1b1[_0x34e112(0x194)]===0x0)return console[_0x34e112(0x13c)](_0x34e112(0x17d)),0x0;const _0x343298=new Map();for(const _0xc9f5c6 of _0xf6b1b1){const _0x17012f=_0xc9f5c6[_0x34e112(0x1bd)];!_0x343298[_0x34e112(0x146)](_0x17012f)&&_0x343298[_0x34e112(0x15e)](_0x17012f,[]),_0x343298[_0x34e112(0x1b2)](_0x17012f)[_0x34e112(0x1f7)](_0xc9f5c6);}for(const _0x1acc78 of _0x343298[_0x34e112(0x1f8)]()){_0x1acc78[_0x34e112(0x1ff)]((_0x397aab,_0x80bb77)=>(_0x397aab['versionNumber']||0x0)-(_0x80bb77[_0x34e112(0x202)]||0x0));}const _0x559ca6=[],[_0x494ad3,_0x381f1e]=await Promise[_0x34e112(0x190)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x5a5c03[_0x34e112(0x1c3)][_0x34e112(0x159)](),{'verbose':_0x27da0e['verbose']})[_0x34e112(0x1a9)](_0x1348fa=>_0x1348fa[_0x34e112(0x1b0)]),withSpinner(_0x34e112(0x153),()=>_0x5a5c03['connection']['buildIdToNameMap'](),{'verbose':_0x27da0e[_0x34e112(0x17e)]})[_0x34e112(0x1a9)](_0xa3a08b=>_0xa3a08b['data'])]);for(const _0x455739 of _0x343298[_0x34e112(0x1f8)]()){const _0x4d781a=_0x455739[0x0][_0x34e112(0x160)],_0x1355bc=_0x455739[0x0][_0x34e112(0x14e)],_0x4e490e=_0x1355bc?_0x4a00b5[_0x34e112(0x1b2)](_0x1355bc)||'':'',_0x325713=_0x4e490e?a18_0x4599c5[_0x34e112(0x1c5)](_0x4209b7,_0x4e490e):_0x4209b7,_0x2b00a3=_0x7800f1||a18_0x4599c5[_0x34e112(0x1c5)](_0x325713,sanitizeFileName(_0x4d781a)+_0x34e112(0x1cd));let _0x34e8e3,_0x26e8c6;if(existsSync(_0x2b00a3))try{const _0x2bd9e8=readFileSync(_0x2b00a3,_0x34e112(0x1c2)),_0x181e77=parseYamlString(_0x2bd9e8);_0x26e8c6=_0x181e77,_0x34e8e3=buildRuleToNameMapping(_0x181e77),_0x243f3d[_0x34e112(0x17e)]&&_0x34e8e3['size']>0x0&&console['error'](_0x34e112(0x149)+_0x34e8e3[_0x34e112(0x161)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x4d781a);}catch(_0x5833d0){_0x243f3d[_0x34e112(0x17e)]&&console[_0x34e112(0x13c)](_0x34e112(0x1b4)+_0x5833d0[_0x34e112(0x1d2)]);}const _0x4fd528=[],_0x4ac925=new Set(),_0x141fbe=new Map(),_0x517bf0=new Map(),_0x35924f=new Set(),_0x37d2da=new Map(),_0x2918de=new Map(),_0x57e338=createJumpTargetCache();await withProgressSpinner(_0x34e112(0x195)+_0x4d781a+_0x34e112(0x1e2),async _0x5956ba=>{const _0x355513=_0x34e112;for(const _0x6624b2 of _0x455739){const _0x3b9160=_0x455739[_0x355513(0x194)]>0x1?_0x6624b2[_0x355513(0x160)]+'\x20v'+(_0x6624b2['versionNumber']||0x1):_0x6624b2[_0x355513(0x160)];_0x5956ba[_0x355513(0x200)](_0x355513(0x195)+_0x3b9160);const _0x2e0770=await _0x5a5c03[_0x355513(0x15a)]['getJourney'](_0x6624b2['id']),_0x3dda27=_0x2e0770[_0x355513(0x1c0)]?.[_0x355513(0x1de)],_0x298075={'resolveSegment':async _0x1f9f67=>{const _0x2337f6=_0x355513;if(!_0x3dda27)return{'name':_0x1f9f67,'isJourneyLocal':![]};const _0x44464f=_0x141fbe[_0x2337f6(0x1b2)](_0x1f9f67);if(_0x44464f)return _0x44464f;try{const _0x5b8d71=await _0x5a5c03[_0x2337f6(0x179)][_0x2337f6(0x1e4)](_0x3dda27,_0x1f9f67),_0x10c934=_0x5b8d71[_0x2337f6(0x17c)]===SEGMENT_KIND_JOURNEY;let _0x393bdf,_0x2f65d8=_0x5b8d71[_0x2337f6(0x19a)];if(_0x10c934&&_0x5b8d71[_0x2337f6(0x180)]){const _0x516d40=await segmentResponseToDef(_0x5b8d71,{'resolveSegmentName':async _0x5267e0=>{const _0x21bad2=_0x2337f6,_0x1e568=_0x141fbe[_0x21bad2(0x1b2)](_0x5267e0);if(_0x1e568)return _0x1e568[_0x21bad2(0x19a)];const _0x2e2458=await _0x298075['resolveSegment'](_0x5267e0);return _0x2e2458[_0x21bad2(0x19a)];}}),_0x59d081=_0x516d40['rule'];_0x393bdf={'description':_0x5b8d71['description'],'rule':_0x59d081};const _0x59ca15=serializeRule(_0x59d081),_0x4e1a5b=_0x517bf0[_0x2337f6(0x1b2)](_0x59ca15);if(_0x4e1a5b)_0x2f65d8=_0x4e1a5b,_0x393bdf=undefined,_0x243f3d[_0x2337f6(0x17e)]&&console[_0x2337f6(0x13c)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x5b8d71['name']+_0x2337f6(0x1cf)+_0x4e1a5b);else{let _0x5efb63=![];if(_0x34e8e3){const _0x1e3ef6=_0x34e8e3[_0x2337f6(0x1b2)](_0x59ca15);if(_0x1e3ef6){const _0x1f7cea=_0x1e3ef6[_0x2337f6(0x203)](_0x2083f9=>!_0x4ac925[_0x2337f6(0x146)](_0x2083f9));_0x1f7cea&&(_0x2f65d8=_0x1f7cea,_0x4ac925['add'](_0x1f7cea),_0x517bf0[_0x2337f6(0x15e)](_0x59ca15,_0x1f7cea),_0x5efb63=!![],_0x243f3d['verbose']&&console['error']('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x1f7cea+'\x20(rule\x20match)'));}}if(!_0x5efb63){const _0x5ccbdb=generateJourneyLocalName(_0x5b8d71['name']);_0x5ccbdb&&(_0x2f65d8=_0x5ccbdb);let _0xf17c20=_0x2f65d8,_0x3fab13=0x2;while(_0x4ac925[_0x2337f6(0x146)](_0xf17c20)){_0xf17c20=_0x2f65d8+'_'+_0x3fab13,_0x3fab13++;}_0x4ac925[_0x2337f6(0x16a)](_0xf17c20),_0x517bf0['set'](_0x59ca15,_0xf17c20),_0x2f65d8=_0xf17c20;}}}const _0x46f45e={'name':_0x2f65d8,'isJourneyLocal':_0x10c934,'definition':_0x393bdf};return _0x141fbe[_0x2337f6(0x15e)](_0x1f9f67,_0x46f45e),_0x46f45e;}catch(_0x17a013){return _0x27da0e[_0x2337f6(0x17e)]&&console[_0x2337f6(0x13c)](_0x2337f6(0x19f)+_0x1f9f67+':\x20'+_0x17a013[_0x2337f6(0x1d2)]),{'name':_0x1f9f67,'isJourneyLocal':![]};}},'resolveActivation':async _0x18db18=>{const _0x396abc=_0x355513,_0x55c31a=_0x37d2da[_0x396abc(0x1b2)](_0x18db18);if(_0x55c31a)return _0x55c31a;try{const _0x3a2473=await _0x5a5c03[_0x396abc(0x15a)][_0x396abc(0x1cb)](_0x6624b2['id'],_0x18db18),_0x5ecb6d=journeyActivationStepToYaml(_0x3a2473,_0x494ad3,_0x381f1e),_0x1fe4e6=JSON[_0x396abc(0x1a6)]({'name':_0x5ecb6d[_0x396abc(0x19a)],'connection':_0x5ecb6d['connection'],'connector_config':_0x5ecb6d[_0x396abc(0x1a7)]}),_0x95d2de=_0x2918de[_0x396abc(0x1b2)](_0x1fe4e6);if(_0x95d2de){const _0x501eaf={'name':_0x95d2de,'isJourneyLocal':!![],'definition':_0x5ecb6d};return _0x37d2da[_0x396abc(0x15e)](_0x18db18,_0x501eaf),_0x501eaf;}const _0x4cdcd4=_0x3a2473[_0x396abc(0x1c0)][_0x396abc(0x14f)][_0x396abc(0x19a)]||_0x18db18,_0x5c90a7=sanitizeYamlKey(_0x4cdcd4)||_0x396abc(0x174)+_0x18db18;let _0x2bb255=_0x5c90a7,_0x2357a1=0x2;while(_0x35924f['has'](_0x2bb255)){_0x2bb255=_0x5c90a7+'_'+_0x2357a1,_0x2357a1++;}_0x35924f[_0x396abc(0x16a)](_0x2bb255),_0x2918de[_0x396abc(0x15e)](_0x1fe4e6,_0x2bb255);const _0x2d77fb={'name':_0x2bb255,'isJourneyLocal':!![],'definition':_0x5ecb6d};return _0x37d2da[_0x396abc(0x15e)](_0x18db18,_0x2d77fb),_0x2d77fb;}catch(_0x5df163){return _0x27da0e[_0x396abc(0x17e)]&&console[_0x396abc(0x13c)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x18db18+':\x20'+_0x5df163[_0x396abc(0x1d2)]),{'name':_0x18db18,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x195611,_0x2cc82a)=>{const _0x2e64c6=_0x355513;return resolveJumpTarget(_0x195611,_0x2cc82a,_0x57e338,_0x1eb2bc=>_0x5a5c03[_0x2e64c6(0x15a)][_0x2e64c6(0x1b1)](_0x1eb2bc));}},_0x4c8a22=await journeyResponseToDef(_0x2e0770,_0x298075);_0x4fd528[_0x355513(0x1f7)]({'item':_0x6624b2,'yaml':_0x4c8a22});}},{'verbose':_0x27da0e[_0x34e112(0x17e)]});const _0x2c901c=buildMergedJourneyDef(_0x4fd528,_0x34e8e3),_0x40c375=normalizeJourneyDef(_0x2c901c,_0x26e8c6),_0x30d8d2=toYamlString(_0x40c375),_0x3977d5=_0x7800f1||a18_0x4599c5['join'](_0x325713,sanitizeFileName(_0x4d781a)+_0x34e112(0x1cd));!_0x7800f1&&_0x4e490e&&!existsSync(_0x325713)&&mkdirSync(_0x325713,{'recursive':!![]});const _0x203cd6=a18_0x4599c5['relative'](process[_0x34e112(0x1d7)](),_0x3977d5);if(existsSync(_0x3977d5)){const _0x2e2213=readFileSync(_0x3977d5,_0x34e112(0x1c2)),_0xc59ff1=generateDiff(_0x2e2213,_0x30d8d2),_0x588dfc=hasChanges(_0xc59ff1);_0x559ca6[_0x34e112(0x1f7)]({'relativePath':_0x203cd6,'absolutePath':_0x3977d5,'content':_0x30d8d2,'isNew':![],'hasChanges':_0x588dfc,'diff':_0x588dfc?formatDiffWithColors(_0xc59ff1):undefined});}else _0x559ca6[_0x34e112(0x1f7)]({'relativePath':_0x203cd6,'absolutePath':_0x3977d5,'content':_0x30d8d2,'isNew':!![],'hasChanges':![]});}const _0x3b439e=_0x559ca6[_0x34e112(0x1ee)](_0x54efc0=>_0x54efc0[_0x34e112(0x1d1)]),_0x50ac5a=_0x559ca6[_0x34e112(0x1ee)](_0x3d3a7d=>!_0x3d3a7d[_0x34e112(0x1d1)]&&_0x3d3a7d[_0x34e112(0x1ab)]),_0x3ae2fc=_0x559ca6[_0x34e112(0x1ee)](_0x33ec3f=>!_0x33ec3f['isNew']&&!_0x33ec3f[_0x34e112(0x1ab)]),_0x668e64=_0xf6b1b1[_0x34e112(0x194)],_0x31ff91=_0x343298[_0x34e112(0x161)],_0x267ff3=_0x668e64>_0x31ff91?'\x20('+_0x668e64+_0x34e112(0x157):'';console[_0x34e112(0x13c)]('\x0aPull\x20summary:'),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388[_0x34e112(0x1cc)](_0x31ff91+'\x20journeys')+a18_0x2bf388[_0x34e112(0x140)](_0x267ff3)),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388['green']('+\x20'+_0x3b439e['length']+_0x34e112(0x1c6))),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388[_0x34e112(0x1ad)]('~\x20'+_0x50ac5a['length']+_0x34e112(0x1e1))),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388[_0x34e112(0x140)]('=\x20'+_0x3ae2fc[_0x34e112(0x194)]+_0x34e112(0x1e0))),console[_0x34e112(0x13c)](_0x34e112(0x13b)+a18_0x2bf388[_0x34e112(0x1cc)](_0x4209b7)+'\x0a');if(_0x50ac5a['length']>0x0)for(const _0x363286 of _0x50ac5a){console[_0x34e112(0x13c)](_0x34e112(0x1ed)+_0x363286[_0x34e112(0x1dc)]+'\x27:'),console[_0x34e112(0x13c)]('─'[_0x34e112(0x138)](0x3c)),console[_0x34e112(0x13c)](_0x363286[_0x34e112(0x199)]),console['error']('─'[_0x34e112(0x138)](0x3c));}if(_0x243f3d[_0x34e112(0x142)])return console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x1ad)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x3b439e[_0x34e112(0x194)]===0x0&&_0x50ac5a[_0x34e112(0x194)]===0x0)return console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x15b)](_0x34e112(0x1ca))),saveSessionContext({'parent_segment':_0x2017fa},_0x243f3d[_0x34e112(0x18b)]),console['error'](a18_0x2bf388[_0x34e112(0x15b)](_0x34e112(0x1bc)+a18_0x2bf388[_0x34e112(0x140)]('parent_segment')+_0x34e112(0x169)+a18_0x2bf388[_0x34e112(0x1cc)](_0x2017fa))),0x0;if(!_0x243f3d['yes']&&(_0x3b439e['length']>0x0||_0x50ac5a[_0x34e112(0x194)]>0x0)){if(!isInteractive())return console[_0x34e112(0x13c)](a18_0x2bf388['red'](_0x34e112(0x1be)),_0x34e112(0x1fb)),console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x140)](_0x34e112(0x18e))),0x1;const _0x2bed01=await confirmKey('Write\x20'+(_0x3b439e['length']+_0x50ac5a[_0x34e112(0x194)])+'\x20files?');if(!_0x2bed01)return console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x1ad)]('Aborted.'),_0x34e112(0x152)),0x1;}!existsSync(_0x4209b7)&&mkdirSync(_0x4209b7,{'recursive':!![]});for(const _0x170bc7 of _0x559ca6){(_0x170bc7[_0x34e112(0x1d1)]||_0x170bc7[_0x34e112(0x1ab)])&&writeFileSync(_0x170bc7['absolutePath'],_0x170bc7[_0x34e112(0x173)],_0x34e112(0x1c2));}return console[_0x34e112(0x13c)](a18_0x2bf388['green']('✔\x20Pulled\x20'+(_0x3b439e[_0x34e112(0x194)]+_0x50ac5a[_0x34e112(0x194)])+_0x34e112(0x1aa)+_0x4209b7)),saveSessionContext({'parent_segment':_0x2017fa},_0x243f3d[_0x34e112(0x18b)]),console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x15b)](_0x34e112(0x1bc)+a18_0x2bf388[_0x34e112(0x140)](_0x34e112(0x1a0))+_0x34e112(0x169)+a18_0x2bf388[_0x34e112(0x1cc)](_0x2017fa))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x1ef748(0x19a)]=a18_0x1ef748(0x175);[a18_0x1ef748(0x1fd)]=a18_0x1ef748(0x1ac);[a18_0x1ef748(0x162)]=new SegmentPushCommand();async['execute'](_0x15f8fe){const _0x25773e=a18_0x1ef748,_0x3fd334=_0x15f8fe['args'][0x0];let _0x1e2de0;if(_0x3fd334){const _0x6d5d20=await resolveTarget({'arg':_0x3fd334,'contextParent':_0x15f8fe[_0x25773e(0x1a2)][_0x25773e(0x1d8)],'cwd':process[_0x25773e(0x1d7)]()});isSuccessfulResolution(_0x6d5d20)&&_0x6d5d20[_0x25773e(0x1d5)]===_0x25773e(0x198)&&(_0x1e2de0=_0x6d5d20[_0x25773e(0x16c)]);}const _0xb72102={..._0x15f8fe,'options':{..._0x15f8fe['options'],'journeysOnly':!![],..._0x1e2de0&&{'singleFilePath':_0x1e2de0}}};return this[_0x25773e(0x162)][_0x25773e(0x1c4)](_0xb72102);}}
@@ -1 +1 @@
1
- const a19_0x27fcad=a19_0x1f88;(function(_0x27759c,_0x4499be){const _0xda14c2=a19_0x1f88,_0x53d8cd=_0x27759c();while(!![]){try{const _0x17f15f=-parseInt(_0xda14c2(0x1c2))/0x1+-parseInt(_0xda14c2(0x1b0))/0x2+parseInt(_0xda14c2(0x18a))/0x3*(-parseInt(_0xda14c2(0x19a))/0x4)+parseInt(_0xda14c2(0x1aa))/0x5*(-parseInt(_0xda14c2(0x1a4))/0x6)+-parseInt(_0xda14c2(0x1b3))/0x7+-parseInt(_0xda14c2(0x18b))/0x8*(parseInt(_0xda14c2(0x1a7))/0x9)+-parseInt(_0xda14c2(0x1c3))/0xa*(-parseInt(_0xda14c2(0x1a8))/0xb);if(_0x17f15f===_0x4499be)break;else _0x53d8cd['push'](_0x53d8cd['shift']());}catch(_0x215b81){_0x53d8cd['push'](_0x53d8cd['shift']());}}}(a19_0xb2a8,0xcdc2c));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_0x1f5dd5 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';function a19_0x1f88(_0x192570,_0x1e452a){_0x192570=_0x192570-0x188;const _0xb2a83=a19_0xb2a8();let _0x1f884e=_0xb2a83[_0x192570];return _0x1f884e;}function a19_0xb2a8(){const _0x4fd3e5=['943378pohWYV','13135750BPoRBK','hasErrors','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','1667577JSIced','48ZzhnDO','\x20journey(s)\x20with\x20errors,\x20','log','yellow','skippedCount','filter','warningCount','verbose','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','parentSegment','validCount','message','errorCode','warnings','\x20error(s)','4kzoeJz','error','description','length','invalidCount','helpText','reason','✔\x20All\x20','cyan','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','102EVGpAI','green','No\x20journey\x20YAML\x20files\x20found\x20in\x20','1712790GeJRro','55dGrhLh','\x20warning(s)\x20found','71855WMplVd','no_parent','\x20valid','name','endsWith','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','3111230ELyOnd','\x20(skipped:\x20','execute','8988420SGswGB','journey:validate','.yml','filePath','Validation\x20failed:\x20','journey','\x20segment\x20file(s)\x20skipped)','red','valid','type','dim','file','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20segment\x20file(s)\x20skipped','Validate\x20journey\x20YAML\x20files'];a19_0xb2a8=function(){return _0x4fd3e5;};return a19_0xb2a8();}export class JourneyValidateCommand extends BaseCommand{[a19_0x27fcad(0x1ad)]=a19_0x27fcad(0x1b4);[a19_0x27fcad(0x19c)]=a19_0x27fcad(0x1c1);async[a19_0x27fcad(0x1b2)](_0x5b724b){const _0x34a2eb=a19_0x27fcad,{options:_0x3ef82c,args:_0x4fa2a1}=_0x5b724b,_0x19d25f=_0x3ef82c,_0x396b41=await resolveTarget({'arg':_0x4fa2a1[0x0],'contextParent':_0x3ef82c[_0x34a2eb(0x194)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x396b41))return _0x396b41[_0x34a2eb(0x197)]===_0x34a2eb(0x1ab)?(console['error'](a19_0x1f5dd5[_0x34a2eb(0x18e)](_0x34a2eb(0x1a3))),console[_0x34a2eb(0x19b)](_0x34a2eb(0x189)),console[_0x34a2eb(0x19b)]('\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[_0x34a2eb(0x19b)](_0x34a2eb(0x1af))):(console[_0x34a2eb(0x19b)](a19_0x1f5dd5[_0x34a2eb(0x1ba)]('Error:\x20'+_0x396b41[_0x34a2eb(0x196)]+'\x0a')),_0x396b41[_0x34a2eb(0x19f)]&&console[_0x34a2eb(0x19b)](a19_0x1f5dd5[_0x34a2eb(0x1a2)](_0x396b41['helpText']))),0x1;const _0x2b172c=_0x396b41['targetDir'],_0x26c20e=_0x396b41[_0x34a2eb(0x1bc)]===_0x34a2eb(0x1be)?_0x396b41[_0x34a2eb(0x1b6)]:undefined;if(!_0x26c20e&&!existsSync(_0x2b172c))return console['error'](a19_0x1f5dd5['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x2b172c+'\x0a')),0x1;let _0x11bf83;if(_0x26c20e){if(!_0x26c20e[_0x34a2eb(0x1ae)](_0x34a2eb(0x1b5))&&!_0x26c20e[_0x34a2eb(0x1ae)]('.yaml'))return console[_0x34a2eb(0x19b)](a19_0x1f5dd5[_0x34a2eb(0x1ba)](_0x34a2eb(0x193)+_0x26c20e+'\x0a')),0x1;_0x11bf83=[_0x26c20e];}else _0x11bf83=findYamlFiles(_0x2b172c);if(_0x11bf83[_0x34a2eb(0x19d)]===0x0)return console[_0x34a2eb(0x19b)](a19_0x1f5dd5[_0x34a2eb(0x1ba)](_0x34a2eb(0x1bf)+_0x2b172c+'\x0a')),0x1;const _0x4aa75e=validateYamlFiles(_0x11bf83,_0x2b172c,{'filterType':_0x34a2eb(0x1b8)}),_0x2040f0=calculateSummary(_0x4aa75e),_0x1bbbbb=_0x4aa75e[_0x34a2eb(0x190)](isValidationResult);if(_0x1bbbbb[_0x34a2eb(0x19d)]===0x0)return console[_0x34a2eb(0x19b)](a19_0x1f5dd5[_0x34a2eb(0x18e)](_0x34a2eb(0x1a6)+_0x2b172c+'\x0a')),_0x2040f0[_0x34a2eb(0x18f)]>0x0&&console[_0x34a2eb(0x19b)](a19_0x1f5dd5[_0x34a2eb(0x1bd)]('('+_0x2040f0[_0x34a2eb(0x18f)]+_0x34a2eb(0x1b9))),0x0;for(const _0x573db9 of _0x4aa75e){if(!isValidationResult(_0x573db9)){_0x19d25f[_0x34a2eb(0x192)]&&console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x1bd)]('-\x20'+_0x573db9['relativePath']+_0x34a2eb(0x1b1)+_0x573db9[_0x34a2eb(0x1a0)]+')'));continue;}const {relativePath:_0x290e06,source:_0x147d1d,result:_0x3cd75e}=_0x573db9;if(_0x3cd75e[_0x34a2eb(0x1bb)]&&_0x3cd75e[_0x34a2eb(0x198)][_0x34a2eb(0x19d)]===0x0)_0x19d25f['verbose']&&console['log'](a19_0x1f5dd5[_0x34a2eb(0x1a5)]('✔\x20'+_0x290e06));else _0x3cd75e[_0x34a2eb(0x1bb)]?(console[_0x34a2eb(0x18d)](a19_0x1f5dd5['yellow']('⚠\x20'+_0x290e06+':\x20'+_0x3cd75e[_0x34a2eb(0x198)]['length']+'\x20warning(s)')),console['log'](formatValidationResult(_0x3cd75e,_0x147d1d,_0x290e06))):(console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x1ba)]('✖\x20'+_0x290e06+':\x20'+_0x3cd75e['errors']['length']+_0x34a2eb(0x199))),console[_0x34a2eb(0x18d)](formatValidationResult(_0x3cd75e,_0x147d1d,_0x290e06)));}return console['log'](''),_0x2040f0[_0x34a2eb(0x188)]?(console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x1ba)](_0x34a2eb(0x1b7)+_0x2040f0[_0x34a2eb(0x19e)]+_0x34a2eb(0x18c)+_0x2040f0[_0x34a2eb(0x195)]+_0x34a2eb(0x1ac))),_0x2040f0[_0x34a2eb(0x191)]>0x0&&console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x18e)](_0x2040f0[_0x34a2eb(0x191)]+_0x34a2eb(0x1a9))),_0x2040f0[_0x34a2eb(0x18f)]>0x0&&console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x1bd)](_0x2040f0[_0x34a2eb(0x18f)]+'\x20segment\x20file(s)\x20skipped')),0x1):(console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x1a5)](_0x34a2eb(0x1a1)+_0x2040f0[_0x34a2eb(0x195)]+'\x20journey(s)\x20valid')),_0x2040f0['warningCount']>0x0&&console['log'](a19_0x1f5dd5[_0x34a2eb(0x18e)](_0x2040f0['warningCount']+_0x34a2eb(0x1a9))),_0x2040f0[_0x34a2eb(0x18f)]>0x0&&console[_0x34a2eb(0x18d)](a19_0x1f5dd5[_0x34a2eb(0x1bd)](_0x2040f0['skippedCount']+_0x34a2eb(0x1c0))),0x0);}}
1
+ const a19_0x30b723=a19_0x4648;(function(_0x26eb73,_0x554f51){const _0x29befb=a19_0x4648,_0x231b1d=_0x26eb73();while(!![]){try{const _0x353995=-parseInt(_0x29befb(0x135))/0x1+-parseInt(_0x29befb(0x15a))/0x2*(-parseInt(_0x29befb(0x15f))/0x3)+-parseInt(_0x29befb(0x151))/0x4+parseInt(_0x29befb(0x148))/0x5+parseInt(_0x29befb(0x137))/0x6*(parseInt(_0x29befb(0x13f))/0x7)+parseInt(_0x29befb(0x157))/0x8*(parseInt(_0x29befb(0x15b))/0x9)+-parseInt(_0x29befb(0x14e))/0xa*(parseInt(_0x29befb(0x163))/0xb);if(_0x353995===_0x554f51)break;else _0x231b1d['push'](_0x231b1d['shift']());}catch(_0x4e5f98){_0x231b1d['push'](_0x231b1d['shift']());}}}(a19_0x285e,0x88cfb));import{BaseCommand}from'./command.js';function a19_0x4648(_0x376181,_0x15d442){_0x376181=_0x376181-0x134;const _0x285ed3=a19_0x285e();let _0x4648ab=_0x285ed3[_0x376181];return _0x4648ab;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0xef74ad from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x30b723(0x166)]='journey:validate';[a19_0x30b723(0x13e)]=a19_0x30b723(0x159);async['execute'](_0x4d54e2){const _0x4e00a0=a19_0x30b723,{options:_0x31c3fc,args:_0x598d0e}=_0x4d54e2,_0xfe489c=_0x31c3fc,_0x101db7=await resolveTarget({'arg':_0x598d0e[0x0],'contextParent':_0x31c3fc[_0x4e00a0(0x156)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x101db7))return _0x101db7[_0x4e00a0(0x142)]==='no_parent'?(console[_0x4e00a0(0x150)](a19_0xef74ad[_0x4e00a0(0x161)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x4e00a0(0x150)](_0x4e00a0(0x13a)),console[_0x4e00a0(0x150)](_0x4e00a0(0x141)),console[_0x4e00a0(0x150)](_0x4e00a0(0x13b))):(console[_0x4e00a0(0x150)](a19_0xef74ad['red']('Error:\x20'+_0x101db7['message']+'\x0a')),_0x101db7[_0x4e00a0(0x145)]&&console['error'](a19_0xef74ad[_0x4e00a0(0x14c)](_0x101db7['helpText']))),0x1;const _0x2dacd9=_0x101db7['targetDir'],_0x4b80d5=_0x101db7['type']===_0x4e00a0(0x162)?_0x101db7['filePath']:undefined;if(!_0x4b80d5&&!existsSync(_0x2dacd9))return console[_0x4e00a0(0x150)](a19_0xef74ad['red'](_0x4e00a0(0x136)+_0x2dacd9+'\x0a')),0x1;let _0x402866;if(_0x4b80d5){if(!_0x4b80d5[_0x4e00a0(0x144)]('.yml')&&!_0x4b80d5[_0x4e00a0(0x144)]('.yaml'))return console[_0x4e00a0(0x150)](a19_0xef74ad[_0x4e00a0(0x158)](_0x4e00a0(0x152)+_0x4b80d5+'\x0a')),0x1;_0x402866=[_0x4b80d5];}else _0x402866=findYamlFiles(_0x2dacd9);if(_0x402866['length']===0x0)return console['error'](a19_0xef74ad[_0x4e00a0(0x158)](_0x4e00a0(0x167)+_0x2dacd9+'\x0a')),0x1;const _0x77738=validateYamlFiles(_0x402866,_0x2dacd9,{'filterType':_0x4e00a0(0x155)}),_0x808214=calculateSummary(_0x77738),_0x581f22=_0x77738[_0x4e00a0(0x168)](isValidationResult);if(_0x581f22[_0x4e00a0(0x14b)]===0x0)return console[_0x4e00a0(0x150)](a19_0xef74ad[_0x4e00a0(0x161)](_0x4e00a0(0x13d)+_0x2dacd9+'\x0a')),_0x808214[_0x4e00a0(0x146)]>0x0&&console[_0x4e00a0(0x150)](a19_0xef74ad[_0x4e00a0(0x153)]('('+_0x808214[_0x4e00a0(0x146)]+_0x4e00a0(0x149))),0x0;for(const _0x186d73 of _0x77738){if(!isValidationResult(_0x186d73)){_0xfe489c[_0x4e00a0(0x143)]&&console[_0x4e00a0(0x139)](a19_0xef74ad['dim']('-\x20'+_0x186d73['relativePath']+'\x20(skipped:\x20'+_0x186d73[_0x4e00a0(0x14a)]+')'));continue;}const {relativePath:_0x53b1ca,source:_0xad06e8,result:_0x8e5f99}=_0x186d73;if(_0x8e5f99['valid']&&_0x8e5f99[_0x4e00a0(0x13c)]['length']===0x0)_0xfe489c[_0x4e00a0(0x143)]&&console[_0x4e00a0(0x139)](a19_0xef74ad[_0x4e00a0(0x160)]('✔\x20'+_0x53b1ca));else _0x8e5f99['valid']?(console[_0x4e00a0(0x139)](a19_0xef74ad[_0x4e00a0(0x161)]('⚠\x20'+_0x53b1ca+':\x20'+_0x8e5f99[_0x4e00a0(0x13c)]['length']+_0x4e00a0(0x147))),console[_0x4e00a0(0x139)](formatValidationResult(_0x8e5f99,_0xad06e8,_0x53b1ca))):(console['log'](a19_0xef74ad['red']('✖\x20'+_0x53b1ca+':\x20'+_0x8e5f99[_0x4e00a0(0x15c)][_0x4e00a0(0x14b)]+_0x4e00a0(0x154))),console[_0x4e00a0(0x139)](formatValidationResult(_0x8e5f99,_0xad06e8,_0x53b1ca)));}return console[_0x4e00a0(0x139)](''),_0x808214[_0x4e00a0(0x14d)]?(console['log'](a19_0xef74ad[_0x4e00a0(0x158)](_0x4e00a0(0x164)+_0x808214[_0x4e00a0(0x14f)]+_0x4e00a0(0x140)+_0x808214['validCount']+_0x4e00a0(0x15d))),_0x808214['warningCount']>0x0&&console[_0x4e00a0(0x139)](a19_0xef74ad[_0x4e00a0(0x161)](_0x808214[_0x4e00a0(0x138)]+_0x4e00a0(0x15e))),_0x808214[_0x4e00a0(0x146)]>0x0&&console['log'](a19_0xef74ad[_0x4e00a0(0x153)](_0x808214['skippedCount']+_0x4e00a0(0x134))),0x1):(console[_0x4e00a0(0x139)](a19_0xef74ad[_0x4e00a0(0x160)](_0x4e00a0(0x165)+_0x808214['validCount']+'\x20journey(s)\x20valid')),_0x808214[_0x4e00a0(0x138)]>0x0&&console[_0x4e00a0(0x139)](a19_0xef74ad[_0x4e00a0(0x161)](_0x808214[_0x4e00a0(0x138)]+_0x4e00a0(0x15e))),_0x808214[_0x4e00a0(0x146)]>0x0&&console[_0x4e00a0(0x139)](a19_0xef74ad[_0x4e00a0(0x153)](_0x808214[_0x4e00a0(0x146)]+'\x20segment\x20file(s)\x20skipped')),0x0);}}function a19_0x285e(){const _0x364dd3=['reason','length','cyan','hasErrors','1220JAaOCy','invalidCount','error','610464lvylvu','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','dim','\x20error(s)','journey','parentSegment','8jUgtpA','red','Validate\x20journey\x20YAML\x20files','1061098uCGQSo','4966857ElBCzX','errors','\x20valid','\x20warning(s)\x20found','6moZvRe','green','yellow','file','121297lFebeB','Validation\x20failed:\x20','✔\x20All\x20','name','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','filter','\x20segment\x20file(s)\x20skipped','349990QhcIcf','Error:\x20Directory\x20not\x20found:\x20','3616638KnXEBZ','warningCount','log','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','warnings','No\x20journey\x20YAML\x20files\x20found\x20in\x20','description','7zjLAEJ','\x20journey(s)\x20with\x20errors,\x20','\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','errorCode','verbose','endsWith','helpText','skippedCount','\x20warning(s)','962675btGylG','\x20segment\x20file(s)\x20skipped)'];a19_0x285e=function(){return _0x364dd3;};return a19_0x285e();}
@@ -1 +1 @@
1
- const a20_0x61ba81=a20_0x1ead;(function(_0x1d445d,_0x35f34d){const _0x293bc4=a20_0x1ead,_0x432f5d=_0x1d445d();while(!![]){try{const _0x3e2689=-parseInt(_0x293bc4(0x167))/0x1+-parseInt(_0x293bc4(0x10a))/0x2+-parseInt(_0x293bc4(0x120))/0x3+parseInt(_0x293bc4(0x18f))/0x4+-parseInt(_0x293bc4(0x107))/0x5*(parseInt(_0x293bc4(0x12f))/0x6)+parseInt(_0x293bc4(0x160))/0x7+-parseInt(_0x293bc4(0x1cd))/0x8*(parseInt(_0x293bc4(0x191))/0x9);if(_0x3e2689===_0x35f34d)break;else _0x432f5d['push'](_0x432f5d['shift']());}catch(_0x468c73){_0x432f5d['push'](_0x432f5d['shift']());}}}(a20_0x16e6,0x5d4cb));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_0x3a09ae from'node:fs';function handleSDKError(_0x2bf12b,_0x4b2471){const _0xfb9ba2=a20_0x1ead;if(_0x2bf12b instanceof SDKError)console[_0xfb9ba2(0x126)]('Error:\x20'+_0x2bf12b['message']),_0x4b2471['verbose']&&(_0x2bf12b['cause']&&console[_0xfb9ba2(0x126)](_0xfb9ba2(0x123)+_0x2bf12b['cause']),_0x2bf12b[_0xfb9ba2(0x19b)]&&(console[_0xfb9ba2(0x126)](_0xfb9ba2(0x122)),console[_0xfb9ba2(0x126)](_0x2bf12b[_0xfb9ba2(0x19b)])));else throw _0x2bf12b;}function formatChatHistoryEntry(_0x5be273,_0x3338c8){const _0x4162ff=a20_0x1ead,_0x497a35=getChalk(_0x3338c8),_0x13c007=_0x497a35['dim'](_0x5be273['at']);if(_0x4162ff(0x1c7)in _0x5be273){const _0xca45=_0x497a35[_0x4162ff(0x18e)](_0x4162ff(0x15e));return _0x13c007+'\x20'+_0xca45+':\x20'+_0x5be273[_0x4162ff(0x1c7)];}if(_0x4162ff(0x194)in _0x5be273){const _0xfc86b2=_0x497a35[_0x4162ff(0x15d)](_0x4162ff(0x129));return _0x13c007+'\x20'+_0xfc86b2+':\x20'+_0x5be273['content'];}if(_0x4162ff(0x148)in _0x5be273){const _0x26ba56=_0x497a35[_0x4162ff(0x110)](_0x4162ff(0x143)),{functionName:_0x3326f4,functionArguments:_0x3ff33f,targetFunction:_0x93fcff}=_0x5be273[_0x4162ff(0x148)];let _0x25b7de=_0x13c007+'\x20'+_0x26ba56+':\x20'+_0x497a35['bold'](_0x3326f4);if(_0x3ff33f&&Object[_0x4162ff(0x1bc)](_0x3ff33f)[_0x4162ff(0x19c)]>0x0){const _0x87d05c=Object['entries'](_0x3ff33f)[_0x4162ff(0x1a4)](([_0x93f282,_0x5ae153])=>_0x93f282+'='+JSON[_0x4162ff(0x19f)](_0x5ae153))['join'](',\x20');_0x25b7de+='('+_0x87d05c+')';}_0x93fcff&&(_0x25b7de+=_0x497a35[_0x4162ff(0x17c)]('\x20['+_0x93fcff+']'));let _0x3fd8ee='';if(_0x5be273[_0x4162ff(0x148)][_0x4162ff(0x165)])_0x3fd8ee='\x20->\x20KB:'+_0x5be273[_0x4162ff(0x148)]['targetKnowledgeBase'][_0x4162ff(0x1c9)];else{if(_0x5be273['tool_call'][_0x4162ff(0x1d8)])_0x3fd8ee=_0x4162ff(0x11c)+_0x5be273['tool_call'][_0x4162ff(0x1d8)]['name'];else{if(_0x5be273['tool_call'][_0x4162ff(0x1af)])_0x3fd8ee=_0x4162ff(0x175)+_0x5be273[_0x4162ff(0x148)]['targetWebSearchTool'][_0x4162ff(0x1c9)];else _0x5be273[_0x4162ff(0x148)]['targetImageGenerator']&&(_0x3fd8ee=_0x4162ff(0x10f)+_0x5be273[_0x4162ff(0x148)][_0x4162ff(0x179)][_0x4162ff(0x1c9)]);}}return _0x25b7de+_0x3fd8ee;}if('tool'in _0x5be273){const _0x811d05=_0x497a35[_0x4162ff(0x104)](_0x4162ff(0x18a)),{functionName:_0x3cd2fd,functionArguments:_0x5ee865,content:_0xc299d3,newChat:_0x5bbe8d}=_0x5be273[_0x4162ff(0x10d)];let _0x27d1df=_0x13c007+'\x20'+_0x811d05+':\x20'+_0x497a35[_0x4162ff(0x1cb)](_0x3cd2fd);if(_0x5ee865){const _0x160ba0=typeof _0x5ee865===_0x4162ff(0x19a)?_0x5ee865:JSON['stringify'](_0x5ee865);_0x27d1df+='('+_0x160ba0+')';}return _0xc299d3&&(_0x27d1df+='\x0a'+_0x497a35[_0x4162ff(0x17c)](_0xc299d3)),_0x5bbe8d&&(_0x27d1df+=_0x497a35[_0x4162ff(0x17c)](_0x4162ff(0x185)+_0x5bbe8d['id'])),_0x27d1df;}if('output'in _0x5be273){const _0xfde4e=_0x497a35['blue']('[output]\x20');return _0x13c007+'\x20'+_0xfde4e+':\x20'+_0x5be273[_0x4162ff(0x186)]['name']+'\x20('+_0x5be273[_0x4162ff(0x186)]['content'][_0x4162ff(0x19c)]+_0x4162ff(0x190);}if(_0x4162ff(0x147)in _0x5be273){const _0xdb579b=_0x497a35[_0x4162ff(0x14d)](_0x4162ff(0x142)),{width:_0x34fc4f,height:_0x1c8cfc,headerText:_0x29f79f}=_0x5be273[_0x4162ff(0x147)],_0x2f330f=_0x29f79f?'\x20-\x20'+_0x29f79f:'';return _0x13c007+'\x20'+_0xdb579b+':\x20'+_0x34fc4f+'x'+_0x1c8cfc+_0x2f330f;}if(_0x4162ff(0x126)in _0x5be273){const _0x22585c=_0x497a35[_0x4162ff(0x1c2)](_0x4162ff(0x145));return _0x13c007+'\x20'+_0x22585c+':\x20'+_0x5be273[_0x4162ff(0x126)];}return _0x13c007+'\x20'+_0x497a35[_0x4162ff(0x17c)](_0x4162ff(0x1c6))+':\x20'+JSON[_0x4162ff(0x19f)](_0x5be273);}async function executeChatHistoryCommand(_0x7b9bc0,_0x5168e8){const _0x300ef6=a20_0x1ead,{options:_0xd96c1c,args:_0x1bf0d1,tdx:_0x481d22}=_0x7b9bc0,_0x394e23=_0x1bf0d1[0x0],_0x4e7c61=_0xd96c1c,_0x462e3e=_0x4e7c61[_0x300ef6(0x19d)];try{if(_0x462e3e&&_0x394e23)return console[_0x300ef6(0x126)](_0x300ef6(0x1a2)),console['error'](_0x300ef6(0x132)+_0x5168e8+_0x300ef6(0x16f)),0x1;if(!_0x394e23&&!_0x462e3e&&_0xd96c1c[_0x300ef6(0x1b2)]!==undefined){const _0x173e09=resolveLimit(_0xd96c1c[_0x300ef6(0x1a3)],DEFAULT_LLM_LIMIT),_0x2f4894=await withSpinner(_0x300ef6(0x1a6),()=>_0x481d22[_0x300ef6(0x15f)][_0x300ef6(0x16d)](_0x173e09),{'verbose':_0xd96c1c[_0x300ef6(0x178)]});return await handleSDKOutput(_0x2f4894['data'],_0xd96c1c),0x0;}const _0xde3817=await getChatIdOrSelect(_0x481d22,_0xd96c1c,_0x462e3e,_0x394e23);if(!_0xde3817)return 0x0;return await displayChatHistory(_0xde3817,_0x481d22,_0xd96c1c),0x0;}catch(_0x472aae){return handleSDKError(_0x472aae,_0xd96c1c),0x1;}}async function displayChatHistory(_0xc48845,_0x10c025,_0x510dbb){const _0x23eec5=a20_0x1ead,_0x5ed2a0=await withSpinner(_0x23eec5(0x116)+_0xc48845+_0x23eec5(0x144),()=>_0x10c025['llm'][_0x23eec5(0x12a)](_0xc48845),{'verbose':_0x510dbb['verbose']}),_0x4e00cf=_0x5ed2a0[_0x23eec5(0x1ab)][_0x23eec5(0x1ab)]??[];if(_0x4e00cf['length']===0x0){console[_0x23eec5(0x173)]('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x510dbb[_0x23eec5(0x1b2)]!==undefined)await handleSDKOutput(_0x4e00cf,_0x510dbb);else{const _0x33d6a0=_0x4e00cf[_0x23eec5(0x1a4)](_0x19cde0=>formatChatHistoryEntry(_0x19cde0,_0x510dbb)),_0x2b42b5=_0x33d6a0[_0x23eec5(0x1ae)]('\x0a');await writeOutput(_0x2b42b5,_0x510dbb['output'],_0x23eec5(0x187));}}async function getChatIdOrSelect(_0x271ffb,_0x6e48e8,_0x2e36ab,_0x227d62){const _0x206be9=a20_0x1ead;if(_0x227d62)return _0x227d62;if(_0x2e36ab){const _0x318f8a=await withSpinner(_0x206be9(0x13f),()=>_0x271ffb[_0x206be9(0x15f)][_0x206be9(0x16d)](0x1),{'verbose':_0x6e48e8[_0x206be9(0x178)]});if(_0x318f8a[_0x206be9(0x1ab)]['length']===0x0)return console[_0x206be9(0x173)](_0x206be9(0x127)),undefined;return _0x318f8a[_0x206be9(0x1ab)][0x0]['id'];}const _0x1a36ef=await selectChatInteractively(_0x271ffb,_0x6e48e8);if(!_0x1a36ef)return console['log']('\x0aCancelled'),undefined;return _0x1a36ef;}async function getProjectIdOrDefault(_0x5ef9d2){const _0x476907=await getProjectWithName(_0x5ef9d2);return _0x476907['id'];}function a20_0x16e6(){const _0x3c7aa0=['\x20\x20\x20Examples:','Fetching\x20chat\x20sessions...','counts','getTime','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','llmProject','data','Creating\x20project\x20\x27','\x20\x20Agents:\x20','join','targetWebSearchTool','Agent\x20updated:\x20','sort','format','Agent\x20created:\x20','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','yes','createdAt','projects','getOrCreateDefaultProject','outputDir','Checking\x20for\x20existing\x20projects...','Project\x20deleted:\x20','keys','Usage:\x20tdx\x20llm\x20use\x20<project-name>','toLowerCase','llm:agent:delete','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','sourceSite','red','floor','lastConversationAt','backupProject','[unknown]','input','No\x20agents\x20found','name','dryRun','bold','.llm','8NTjThv','Resolving\x20project\x20\x27','set','Create\x20a\x20new\x20LLM\x20project','json','agent','Error:\x20Project\x20name\x20is\x20required','llm:project:create','A\x20project\x20named\x20\x27','(no\x20message)','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','targetAgent','Delete\x20an\x20agent','filter','claude-4.5-haiku','magenta','updateAgent','llm:project:backup','10185pVhXER','createAgent','llm:agent:create','402928bYXpXS','split','Backing\x20up\x20project\x20\x27','tool','llm:models','\x20->\x20ImageGen:','yellow','llm:agents','\x20\x20Integrations:\x20','Project\x20restored:\x20','setCurrentProject','Error:\x20Agent\x20name\x20is\x20required','Fetching\x20chat\x20history\x20for\x20\x27','knowledgeBases','numeric','llm:agent:update','find','Analyzing\x20project\x20\x27','\x20->\x20Agent:','temperature','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','includes','317712puIQrT','projectId','\x0aStack\x20trace:','\x20\x20Cause:\x20','INVALID_ARGUMENT','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','error','No\x20chat\x20sessions\x20found.','execute','[content]','history','Usage:\x20TDX_EXPERIMENTAL=true\x20tdx\x20llm\x20log\x20<chat-id>','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','getBackupMetadata','slice','432jpVmLL','deleteProject','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Usage:\x20','description','m\x20ago','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','No\x20projects\x20found','integrations','prompts','List\x20all\x20LLM\x20projects','Resolving\x20agent\x20\x27','Use\x20format:\x20project-name/agent-name','Restore\x20cancelled.','\x27\x20already\x20exists.\x20Overwrite?','Fetching\x20most\x20recent\x20chat...','...','chatId','[image]\x20\x20','[tool_call]','\x27...','[error]\x20\x20','Error:\x20Backup\x20folder\x20path\x20is\x20required','image','tool_call','Updating\x20agent...','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','starterMessage','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','blue','Fetching\x20projects...','restoreProject','select','agents','Fetching\x20agents...','site','updatedAt','Load\x20more...','get','models','jsonl','Creating\x20agent\x20\x27','resolveAgentId','Getting\x20default\x20project...','🤖\x20','green','[input]\x20\x20','llm','4718840NXfrTo','Invalid\x20path\x20syntax:\x20','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Deleting\x20agent...','createProject','targetKnowledgeBase','llm:use','313250cCYhoG','maxToolIterations','agentId','getCurrentProject','Unknown','h\x20ago','chats','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','\x20--last','resolveProjectId','Select\x20a\x20chat\x20session:','(no\x20agent)','log','localeCompare','\x20->\x20WebSearch:','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','prompt','verbose','targetImageGenerator','projectName','Delete\x20an\x20LLM\x20project','dim','llm:agent:show','\x20agent(s)','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','tsv','exportedFrom','__load_more__','firstInputContent','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','\x20→\x20chat:\x20','output','table','Show\x20agent\x20details','List\x20available\x20LLM\x20models','[tool]\x20\x20\x20','Show\x20chat\x20log','model','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','cyan','1901576splvHB','\x20bytes)','693dZMRuw','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Update\x20an\x20existing\x20agent','content','Project\x20backed\x20up\x20to:\x20','just\x20now','Validating\x20backup\x20from\x20\x27','attributes','Project\x20not\x20found:\x20','string','stack','length','last','Error:\x20chat-id\x20is\x20required','stringify','\x20\x20Knowledge\x20Bases:\x20','push','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','limit','map'];a20_0x16e6=function(){return _0x3c7aa0;};return a20_0x16e6();}async function getProjectWithName(_0x23ef83){const _0x5889b8=a20_0x1ead,{tdx:_0x31b59c,options:_0x358b7e}=_0x23ef83,_0x14056c=_0x358b7e[_0x5889b8(0x1aa)];if(_0x14056c){const _0x5bf774=await withSpinner(_0x5889b8(0x1ce)+_0x14056c+'\x27...',()=>_0x31b59c[_0x5889b8(0x15f)][_0x5889b8(0x170)](_0x14056c),{'verbose':_0x358b7e[_0x5889b8(0x178)]});return{'id':_0x5bf774[_0x5889b8(0x1ab)],'name':_0x14056c};}const _0x3f5fe5=_0x31b59c['llm'][_0x5889b8(0x16a)]();if(_0x3f5fe5){const _0x351eda=await _0x31b59c[_0x5889b8(0x15f)][_0x5889b8(0x1b7)](),_0x18d22d=_0x351eda[_0x5889b8(0x11a)](_0x4d6dc8=>_0x4d6dc8['id']===_0x3f5fe5);return{'id':_0x3f5fe5,'name':_0x18d22d?.['attributes'][_0x5889b8(0x1c9)]||_0x5889b8(0x16b)};}const _0x2683e2=await withSpinner(_0x5889b8(0x15b),()=>_0x31b59c[_0x5889b8(0x15f)][_0x5889b8(0x1b8)](),{'verbose':_0x358b7e[_0x5889b8(0x178)]});return{'id':_0x2683e2['data']['id'],'name':_0x2683e2[_0x5889b8(0x1ab)][_0x5889b8(0x198)][_0x5889b8(0x1c9)]};}function toLLMProjectInfo(_0x22823a){const _0x1edd39=a20_0x1ead;return{'name':_0x22823a[_0x1edd39(0x198)][_0x1edd39(0x1c9)],'description':_0x22823a['attributes'][_0x1edd39(0x133)],'createdAt':_0x22823a[_0x1edd39(0x198)][_0x1edd39(0x1b6)],'updatedAt':_0x22823a['attributes'][_0x1edd39(0x154)]};}function toAgentInfo(_0x2f4964){const _0x20140d=a20_0x1ead;return{'name':_0x2f4964[_0x20140d(0x198)][_0x20140d(0x1c9)],'description':_0x2f4964['attributes']['description'],'prompt':truncatePrompt(_0x2f4964['attributes']['prompt']),'createdAt':_0x2f4964[_0x20140d(0x198)][_0x20140d(0x1b6)],'updatedAt':_0x2f4964[_0x20140d(0x198)][_0x20140d(0x154)]};}function truncatePrompt(_0x352b21){const _0x180e4b=a20_0x1ead;if(!_0x352b21)return undefined;const _0x3d424b=0x64;if(_0x352b21['length']<=_0x3d424b)return _0x352b21;return _0x352b21['slice'](0x0,_0x3d424b)+_0x180e4b(0x140);}export class LLMModelsCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x10e);['description']=a20_0x61ba81(0x189);async[a20_0x61ba81(0x128)](_0x163191){const _0x1f8357=a20_0x61ba81,{options:_0x5ae8d2,tdx:_0x162ef4}=_0x163191;try{const _0x587b1b=await withSpinner('Fetching\x20available\x20models...',()=>_0x162ef4['llm'][_0x1f8357(0x157)](),{'verbose':_0x5ae8d2[_0x1f8357(0x178)]});return await handleSDKOutput(_0x587b1b[_0x1f8357(0x1ab)],_0x5ae8d2),0x0;}catch(_0x4dd2b3){return handleSDKError(_0x4dd2b3,_0x5ae8d2),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]='llm:projects';[a20_0x61ba81(0x133)]=a20_0x61ba81(0x13a);async['execute'](_0x4da48e){const _0x1a7490=a20_0x61ba81,{options:_0x1f2215,args:_0x4ff900,tdx:_0x21ad1d}=_0x4da48e,_0x1ec6f8=getChalk(_0x1f2215),_0x4b8253=_0x1f2215[_0x1a7490(0x153)];try{const _0x485273=_0x4ff900[0x0],_0x51f94d=resolveLimit(_0x1f2215['limit'],DEFAULT_LLM_LIMIT),_0x21b428=await withSpinner(_0x1a7490(0x14e),()=>_0x21ad1d['llm'][_0x1a7490(0x1b7)](_0x51f94d),{'verbose':_0x1f2215[_0x1a7490(0x178)]});let _0x535128=_0x21b428[_0x1a7490(0x1ab)];_0x485273&&(_0x535128=_0x21b428[_0x1a7490(0x1ab)][_0x1a7490(0x102)](_0x4e33e4=>matchGlobPattern(_0x4e33e4[_0x1a7490(0x198)][_0x1a7490(0x1c9)],_0x485273)));const _0x5e8760=_0x1f2215['format']===_0x1a7490(0x1d1)||_0x1f2215[_0x1a7490(0x1b2)]===_0x1a7490(0x158)||_0x1f2215[_0x1a7490(0x1b2)]===_0x1a7490(0x187)||_0x1f2215[_0x1a7490(0x1b2)]===_0x1a7490(0x180);if(_0x5e8760){const _0x15c9fc=_0x535128[_0x1a7490(0x1a4)](_0x5d1584=>({...toLLMProjectInfo(_0x5d1584),'url':getLLMProjectUrl(_0x4b8253,_0x5d1584['id'])}));await handleSDKOutput(_0x15c9fc,_0x1f2215);}else{const _0x34e9d6=[];if(_0x535128['length']===0x0)_0x34e9d6[_0x1a7490(0x1a1)](_0x1ec6f8[_0x1a7490(0x17c)](_0x1a7490(0x137)));else{const _0xe1e177=[..._0x535128][_0x1a7490(0x1b1)]((_0x5997aa,_0x27983f)=>_0x5997aa[_0x1a7490(0x198)][_0x1a7490(0x1c9)][_0x1a7490(0x174)](_0x27983f[_0x1a7490(0x198)][_0x1a7490(0x1c9)]));for(const _0x2a6fb5 of _0xe1e177){const _0x497a48=getLLMProjectUrl(_0x4b8253,_0x2a6fb5['id']),_0x5607b7=hyperlink(_0x2a6fb5['attributes'][_0x1a7490(0x1c9)],_0x497a48);_0x34e9d6[_0x1a7490(0x1a1)]('⚒️\x20'+_0x5607b7);}_0x34e9d6['push'](_0x1ec6f8[_0x1a7490(0x17c)](_0x535128[_0x1a7490(0x19c)]+'\x20project(s)'));}await writeOutput(_0x34e9d6[_0x1a7490(0x1ae)]('\x0a'),_0x1f2215[_0x1a7490(0x186)],_0x1a7490(0x187));}return 0x0;}catch(_0x200de4){return handleSDKError(_0x200de4,_0x1f2215),0x1;}}}function a20_0x1ead(_0x41114b,_0x89b9c9){_0x41114b=_0x41114b-0x101;const _0x16e6db=a20_0x16e6();let _0x1ead9c=_0x16e6db[_0x41114b];return _0x1ead9c;}export class LLMAgentsCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x111);[a20_0x61ba81(0x133)]='List\x20agents\x20in\x20current\x20project';async[a20_0x61ba81(0x128)](_0x3bb1a2){const _0x88bef2=a20_0x61ba81,{options:_0x3770c4,args:_0x3e95c6,tdx:_0x32d28e}=_0x3bb1a2,_0x390955=getChalk(_0x3770c4),_0x3f8170=_0x3770c4[_0x88bef2(0x153)];try{const _0x39c01c=_0x3e95c6[0x0];let _0x587cee=_0x39c01c,_0xb65298,_0x217d07;if(_0x39c01c&&_0x39c01c[_0x88bef2(0x11f)]('/')){const _0x395540=_0x39c01c['split']('/');if(_0x395540[_0x88bef2(0x19c)]===0x2){const [_0x21e3c9,_0x35b856]=_0x395540,_0xf72337=await _0x32d28e[_0x88bef2(0x15f)][_0x88bef2(0x1b7)](),_0x21cc12=_0xf72337[_0x88bef2(0x11a)](_0x4e98b9=>_0x4e98b9[_0x88bef2(0x198)][_0x88bef2(0x1c9)][_0x88bef2(0x1be)]()===_0x21e3c9[_0x88bef2(0x1be)]());if(!_0x21cc12)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x88bef2(0x199)+_0x21e3c9,undefined,{'helpText':_0x88bef2(0x1c0)});_0xb65298=_0x21cc12['id'],_0x217d07=_0x21cc12[_0x88bef2(0x198)][_0x88bef2(0x1c9)],_0x587cee=_0x35b856;}else throw new SDKError(ErrorCode[_0x88bef2(0x124)],_0x88bef2(0x161)+_0x39c01c,undefined,{'helpText':_0x88bef2(0x13c)});}else{const _0x2485ab=await getProjectWithName(_0x3bb1a2);_0xb65298=_0x2485ab['id'],_0x217d07=_0x2485ab['name'];}const _0x17a929=await withSpinner(_0x88bef2(0x152),()=>_0x32d28e['llm'][_0x88bef2(0x151)](_0xb65298),{'verbose':_0x3770c4['verbose']});let _0x29225e=_0x17a929[_0x88bef2(0x1ab)];_0x587cee&&(_0x29225e=_0x17a929[_0x88bef2(0x1ab)][_0x88bef2(0x102)](_0x24fc7d=>matchGlobPattern(_0x24fc7d[_0x88bef2(0x198)][_0x88bef2(0x1c9)],_0x587cee)));const _0x221cd3=_0x3770c4[_0x88bef2(0x1b2)]===_0x88bef2(0x1d1)||_0x3770c4[_0x88bef2(0x1b2)]===_0x88bef2(0x158)||_0x3770c4['format']===_0x88bef2(0x187)||_0x3770c4[_0x88bef2(0x1b2)]===_0x88bef2(0x180);if(_0x221cd3){const _0xcf33c7=_0x29225e[_0x88bef2(0x1a4)](_0x4722bf=>({...toAgentInfo(_0x4722bf),'chatUrl':getLLMAgentChatUrl(_0x3f8170,_0xb65298,_0x4722bf['id'])}));await handleSDKOutput(_0xcf33c7,_0x3770c4);}else{const _0x28aeb5=[];_0x28aeb5['push'](_0x390955[_0x88bef2(0x17c)]('['+_0x217d07+']'));if(_0x29225e[_0x88bef2(0x19c)]===0x0)_0x28aeb5[_0x88bef2(0x1a1)](_0x390955[_0x88bef2(0x17c)](_0x88bef2(0x1c8)));else{const _0x11784b=[..._0x29225e]['sort']((_0x4d4d2a,_0x32853c)=>_0x4d4d2a[_0x88bef2(0x198)]['name'][_0x88bef2(0x174)](_0x32853c[_0x88bef2(0x198)][_0x88bef2(0x1c9)]));for(const _0x3baedc of _0x11784b){const _0x4c4ad2=getLLMAgentChatUrl(_0x3f8170,_0xb65298,_0x3baedc['id']),_0xf0d855=hyperlink(_0x3baedc[_0x88bef2(0x198)][_0x88bef2(0x1c9)],_0x4c4ad2);_0x28aeb5[_0x88bef2(0x1a1)](_0x88bef2(0x15c)+_0xf0d855);}_0x28aeb5[_0x88bef2(0x1a1)](_0x390955[_0x88bef2(0x17c)](_0x29225e[_0x88bef2(0x19c)]+_0x88bef2(0x17e)));}await writeOutput(_0x28aeb5[_0x88bef2(0x1ae)]('\x0a'),_0x3770c4[_0x88bef2(0x186)],_0x88bef2(0x187));}return 0x0;}catch(_0x50f45a){return handleSDKError(_0x50f45a,_0x3770c4),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x17d);['description']=a20_0x61ba81(0x188);async[a20_0x61ba81(0x128)](_0x4a2dab){const _0x3be45c=a20_0x61ba81,{options:_0x570e18,args:_0x11ea07,tdx:_0x23692c}=_0x4a2dab;if(_0x11ea07[_0x3be45c(0x19c)]===0x0)return console[_0x3be45c(0x126)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x3be45c(0x126)](_0x3be45c(0x1a9)),0x1;const _0x5d4be8=_0x11ea07[0x0];try{const _0x7e2f5c=await getProjectIdOrDefault(_0x4a2dab),_0x34f853=await withSpinner('Resolving\x20agent\x20\x27'+_0x5d4be8+_0x3be45c(0x144),()=>_0x23692c[_0x3be45c(0x15f)]['resolveAgentId'](_0x5d4be8,_0x7e2f5c),{'verbose':_0x570e18[_0x3be45c(0x178)]}),_0x2c5e67=await withSpinner('Fetching\x20agent...',()=>_0x23692c[_0x3be45c(0x15f)][_0x3be45c(0x1d2)](_0x34f853['data']),{'verbose':_0x570e18['verbose']});return await handleSDKOutput([_0x2c5e67[_0x3be45c(0x1ab)]],_0x570e18),0x0;}catch(_0xfeee4c){return handleSDKError(_0xfeee4c,_0x570e18),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x109);[a20_0x61ba81(0x133)]=a20_0x61ba81(0x162);async[a20_0x61ba81(0x128)](_0x19aea6){const _0x4e88ee=a20_0x61ba81,{options:_0x204bed,args:_0x8d45e,tdx:_0x5e9d5f}=_0x19aea6;if(_0x8d45e[_0x4e88ee(0x19c)]===0x0)return console[_0x4e88ee(0x126)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x4e88ee(0x126)]('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console[_0x4e88ee(0x126)](_0x4e88ee(0x18d)),0x1;const _0x2647b8=_0x8d45e[0x0],_0x272e0e=_0x204bed,_0x636273=_0x272e0e['systemPrompt'],_0x474482=_0x272e0e[_0x4e88ee(0x18c)]||_0x4e88ee(0x103),_0x26fc0d=_0x272e0e[_0x4e88ee(0x14b)],_0x11cd00=_0x272e0e[_0x4e88ee(0x168)]?Number(_0x272e0e[_0x4e88ee(0x168)]):undefined,_0x4f3eda=_0x272e0e[_0x4e88ee(0x11d)]?Number(_0x272e0e[_0x4e88ee(0x11d)]):undefined;try{let _0x1e66e5,_0x3a3c84;if(_0x2647b8[_0x4e88ee(0x11f)]('/')){const _0x280549=_0x2647b8[_0x4e88ee(0x10b)]('/');if(_0x280549[_0x4e88ee(0x19c)]===0x2){const [_0x538920,_0x34cf7f]=_0x280549,_0x1c8a41=await withSpinner('Resolving\x20project\x20\x27'+_0x538920+'\x27...',()=>_0x5e9d5f[_0x4e88ee(0x15f)][_0x4e88ee(0x170)](_0x538920),{'verbose':_0x204bed['verbose']});_0x1e66e5=_0x1c8a41[_0x4e88ee(0x1ab)],_0x3a3c84=_0x34cf7f;}else throw new SDKError(ErrorCode[_0x4e88ee(0x124)],'Invalid\x20path\x20syntax:\x20'+_0x2647b8,undefined,{'helpText':_0x4e88ee(0x13c)});}else _0x1e66e5=await getProjectIdOrDefault(_0x19aea6),_0x3a3c84=_0x2647b8;const _0x4a9a45=await withSpinner(_0x4e88ee(0x159)+_0x3a3c84+_0x4e88ee(0x144),()=>_0x5e9d5f[_0x4e88ee(0x15f)][_0x4e88ee(0x108)]({'name':_0x3a3c84,'projectId':_0x1e66e5,'modelType':_0x474482,'systemPrompt':_0x636273,'starterMessage':_0x26fc0d,'maxToolIterations':_0x11cd00,'temperature':_0x4f3eda}),{'verbose':_0x204bed[_0x4e88ee(0x178)]});return console[_0x4e88ee(0x173)](_0x4e88ee(0x1b3)+_0x4a9a45[_0x4e88ee(0x1ab)]['id']),await handleSDKOutput([_0x4a9a45[_0x4e88ee(0x1ab)]],_0x204bed),0x0;}catch(_0x281e43){return handleSDKError(_0x281e43,_0x204bed),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']=a20_0x61ba81(0x119);[a20_0x61ba81(0x133)]=a20_0x61ba81(0x193);async[a20_0x61ba81(0x128)](_0x3e06c9){const _0x20c6c6=a20_0x61ba81,{options:_0x344dab,args:_0x466218,tdx:_0x31fcf1}=_0x3e06c9;if(_0x466218['length']===0x0)return console[_0x20c6c6(0x126)](_0x20c6c6(0x115)),console[_0x20c6c6(0x126)](_0x20c6c6(0x125)),0x1;const _0x36119a=_0x466218[0x0],_0x24c7a8=_0x344dab,_0x3b2bac=_0x24c7a8[_0x20c6c6(0x1c9)],_0x3ea062=_0x24c7a8[_0x20c6c6(0x177)],_0x513d43=_0x24c7a8[_0x20c6c6(0x133)],_0x37645f=_0x24c7a8[_0x20c6c6(0x14b)];if(!_0x3b2bac&&!_0x3ea062&&!_0x513d43&&!_0x37645f)return console[_0x20c6c6(0x126)](_0x20c6c6(0x192)),console[_0x20c6c6(0x126)]('Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message'),0x1;try{const _0x3da97d=await getProjectIdOrDefault(_0x3e06c9),_0x4c2f2f=await withSpinner(_0x20c6c6(0x13b)+_0x36119a+_0x20c6c6(0x144),()=>_0x31fcf1[_0x20c6c6(0x15f)]['resolveAgentId'](_0x36119a,_0x3da97d),{'verbose':_0x344dab[_0x20c6c6(0x178)]}),_0x540ae8=_0x4c2f2f[_0x20c6c6(0x1ab)],_0x4d8128=await withSpinner(_0x20c6c6(0x149),()=>_0x31fcf1[_0x20c6c6(0x15f)][_0x20c6c6(0x105)](_0x540ae8,{'name':_0x3b2bac,'prompt':_0x3ea062,'description':_0x513d43,'starterMessage':_0x37645f}),{'verbose':_0x344dab[_0x20c6c6(0x178)]});return console[_0x20c6c6(0x173)](_0x20c6c6(0x1b0)+_0x4d8128[_0x20c6c6(0x1ab)]['id']),await handleSDKOutput([_0x4d8128['data']],_0x344dab),0x0;}catch(_0x50033f){return handleSDKError(_0x50033f,_0x344dab),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x1bf);[a20_0x61ba81(0x133)]=a20_0x61ba81(0x101);async[a20_0x61ba81(0x128)](_0xca55d6){const _0xaf8e89=a20_0x61ba81,{options:_0x377d93,args:_0x1254c6,tdx:_0x4f3821}=_0xca55d6;if(_0x1254c6[_0xaf8e89(0x19c)]===0x0)return console[_0xaf8e89(0x126)](_0xaf8e89(0x115)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x3eab63=_0x1254c6[0x0];try{const _0x389ac6=await getProjectIdOrDefault(_0xca55d6),_0x4665a0=await withSpinner(_0xaf8e89(0x13b)+_0x3eab63+_0xaf8e89(0x144),()=>_0x4f3821[_0xaf8e89(0x15f)][_0xaf8e89(0x15a)](_0x3eab63,_0x389ac6),{'verbose':_0x377d93[_0xaf8e89(0x178)]}),_0x4bc5db=_0x4665a0[_0xaf8e89(0x1ab)];return await withSpinner(_0xaf8e89(0x163),()=>_0x4f3821[_0xaf8e89(0x15f)]['deleteAgent'](_0x4bc5db),{'verbose':_0x377d93['verbose']}),console[_0xaf8e89(0x173)]('Agent\x20deleted:\x20'+_0x4bc5db),0x0;}catch(_0x5f2b1c){return handleSDKError(_0x5f2b1c,_0x377d93),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]='llm:history';[a20_0x61ba81(0x133)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async['execute'](_0xed0042){return executeChatHistoryCommand(_0xed0042,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x166);['description']='Set\x20current\x20project\x20context';async['execute'](_0x27e7b0){const _0x4e86d0=a20_0x61ba81,{options:_0x1c2e8e,args:_0x27a6ae,tdx:_0x3e319d}=_0x27e7b0;if(_0x27a6ae[_0x4e86d0(0x19c)]===0x0)return console[_0x4e86d0(0x126)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x4e86d0(0x126)](_0x4e86d0(0x1bd)),0x1;const _0x4852a8=_0x27a6ae[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x4852a8+_0x4e86d0(0x144),()=>_0x3e319d[_0x4e86d0(0x15f)][_0x4e86d0(0x114)](_0x4852a8),{'verbose':_0x1c2e8e['verbose']}),console[_0x4e86d0(0x173)]('Project\x20context\x20set\x20to:\x20'+_0x4852a8),0x0;}catch(_0x19f82b){return handleSDKError(_0x19f82b,_0x1c2e8e),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x1d4);[a20_0x61ba81(0x133)]=a20_0x61ba81(0x1d0);async[a20_0x61ba81(0x128)](_0x13e488){const _0xeec499=a20_0x61ba81,{options:_0x3c78c8,args:_0x5b3210,tdx:_0x4e9923}=_0x13e488;if(_0x5b3210[_0xeec499(0x19c)]===0x0)return console[_0xeec499(0x126)]('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0xeec499(0x14a)),0x1;const _0x5ed3ad=_0x5b3210[0x0],_0x57fd18=_0x3c78c8,_0x3329e3=_0x57fd18[_0xeec499(0x133)];try{const _0x2eca66=await withSpinner(_0xeec499(0x1ac)+_0x5ed3ad+_0xeec499(0x144),()=>_0x4e9923['llm'][_0xeec499(0x164)]({'name':_0x5ed3ad,'description':_0x3329e3}),{'verbose':_0x3c78c8[_0xeec499(0x178)]});console[_0xeec499(0x173)]('Project\x20created:\x20'+_0x2eca66['data']['id']);const _0x46eb99=toLLMProjectInfo(_0x2eca66['data']);return await handleSDKOutput([_0x46eb99],_0x3c78c8),0x0;}catch(_0xcec167){return handleSDKError(_0xcec167,_0x3c78c8),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]='llm:project:delete';[a20_0x61ba81(0x133)]=a20_0x61ba81(0x17b);async[a20_0x61ba81(0x128)](_0x2b320a){const _0x38b8de=a20_0x61ba81,{options:_0x447f6c,args:_0x2c0bfd,tdx:_0x26ff9f}=_0x2b320a;if(_0x2c0bfd['length']===0x0)return console[_0x38b8de(0x126)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x38b8de(0x126)](_0x38b8de(0x184)),0x1;const _0x13fd0f=_0x2c0bfd[0x0];try{return await withSpinner('Deleting\x20project\x20\x27'+_0x13fd0f+'\x27...',()=>_0x26ff9f[_0x38b8de(0x15f)][_0x38b8de(0x130)](_0x13fd0f),{'verbose':_0x447f6c['verbose']}),console[_0x38b8de(0x173)](_0x38b8de(0x1bb)+_0x13fd0f),0x0;}catch(_0x3491f2){return handleSDKError(_0x3491f2,_0x447f6c),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x106);[a20_0x61ba81(0x133)]=a20_0x61ba81(0x136);async[a20_0x61ba81(0x128)](_0x22912d){const _0x488ff6=a20_0x61ba81,{options:_0x3acab6,args:_0x540074,tdx:_0x27c182}=_0x22912d,_0xd78c4f=getChalk(_0x3acab6);console[_0x488ff6(0x173)](_0xd78c4f[_0x488ff6(0x110)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x488ff6(0x173)](_0xd78c4f[_0x488ff6(0x110)](_0x488ff6(0x12c))),console[_0x488ff6(0x173)](_0xd78c4f[_0x488ff6(0x17c)]('\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents')),console[_0x488ff6(0x173)]();if(_0x540074[_0x488ff6(0x19c)]===0x0)return console[_0x488ff6(0x126)](_0x488ff6(0x1d3)),console['error'](_0x488ff6(0x14c)),0x1;const _0xe0b5cd=_0x540074[0x0],_0x4b22d1=_0x3acab6,_0x445b25=_0x4b22d1['output'],_0xcc8db6=_0x4b22d1[_0x488ff6(0x1ca)];try{const _0x42b22e=_0x445b25||_0xe0b5cd+_0x488ff6(0x1cc);if(a20_0x3a09ae['existsSync'](_0x42b22e)&&!_0xcc8db6){if(!_0x3acab6[_0x488ff6(0x1b5)]){const _0x50df43=await confirm('Output\x20directory\x20\x27'+_0x42b22e+_0x488ff6(0x13e));if(!_0x50df43)return console[_0x488ff6(0x173)]('Backup\x20cancelled.'),0x0;}a20_0x3a09ae['rmSync'](_0x42b22e,{'recursive':!![]});}const _0x23e80=await withSpinner(_0xcc8db6?_0x488ff6(0x11b)+_0xe0b5cd+'\x27...':_0x488ff6(0x10c)+_0xe0b5cd+_0x488ff6(0x144),()=>_0x27c182['llm'][_0x488ff6(0x1c5)](_0xe0b5cd,_0x445b25,{'dryRun':_0xcc8db6}),{'verbose':_0x3acab6[_0x488ff6(0x178)]}),_0x119320=_0x23e80[_0x488ff6(0x1ab)];return _0xcc8db6?console[_0x488ff6(0x173)]('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x119320[_0x488ff6(0x1b9)]):console[_0x488ff6(0x173)](_0x488ff6(0x195)+_0x119320[_0x488ff6(0x1b9)]),console[_0x488ff6(0x173)](_0x488ff6(0x1ad)+_0x119320['counts'][_0x488ff6(0x151)]),console[_0x488ff6(0x173)](_0x488ff6(0x1a0)+_0x119320['counts'][_0x488ff6(0x117)]),console[_0x488ff6(0x173)]('\x20\x20Prompts:\x20'+_0x119320[_0x488ff6(0x1a7)][_0x488ff6(0x139)]),console[_0x488ff6(0x173)]('\x20\x20Integrations:\x20'+_0x119320[_0x488ff6(0x1a7)][_0x488ff6(0x138)]),(_0x3acab6[_0x488ff6(0x1b2)]===_0x488ff6(0x1d1)||_0x3acab6[_0x488ff6(0x1b2)]===_0x488ff6(0x158))&&await handleSDKOutput([_0x119320],_0x3acab6),0x0;}catch(_0x586654){return handleSDKError(_0x586654,_0x3acab6),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]='llm:project:restore';[a20_0x61ba81(0x133)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a20_0x61ba81(0x128)](_0x41121c){const _0x516c7a=a20_0x61ba81,{options:_0x54acfd,args:_0x4a896c,tdx:_0x3ce3df}=_0x41121c,_0x32160d=getChalk(_0x54acfd);console[_0x516c7a(0x173)](_0x32160d[_0x516c7a(0x110)](_0x516c7a(0x11e))),console[_0x516c7a(0x173)](_0x32160d[_0x516c7a(0x110)](_0x516c7a(0x1b4))),console[_0x516c7a(0x173)](_0x32160d[_0x516c7a(0x17c)](_0x516c7a(0x1a5))),console[_0x516c7a(0x173)](_0x32160d[_0x516c7a(0x17c)](_0x516c7a(0x17f))),console[_0x516c7a(0x173)](_0x32160d['dim'](_0x516c7a(0x176))),console[_0x516c7a(0x173)]();if(_0x4a896c['length']===0x0)return console[_0x516c7a(0x126)](_0x516c7a(0x146)),console[_0x516c7a(0x126)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x4e1c40=_0x4a896c[0x0],_0x53f4ce=_0x54acfd,_0xb5326d=_0x53f4ce[_0x516c7a(0x1c9)],_0x51d840=_0x53f4ce[_0x516c7a(0x1ca)];try{if(!_0x51d840){const _0x51bd6c=_0x3ce3df['llm'][_0x516c7a(0x12d)](_0x4e1c40),_0x54b825=_0xb5326d||_0x51bd6c[_0x516c7a(0x181)][_0x516c7a(0x17a)],_0xe9e6a2=await withSpinner(_0x516c7a(0x1ba),()=>_0x3ce3df[_0x516c7a(0x15f)][_0x516c7a(0x1b7)](),{'verbose':_0x54acfd['verbose']}),_0x3ee73a=_0xe9e6a2[_0x516c7a(0x1ab)][_0x516c7a(0x11a)](_0x16f4a1=>_0x16f4a1[_0x516c7a(0x198)][_0x516c7a(0x1c9)]===_0x54b825);if(_0x3ee73a&&!_0x54acfd[_0x516c7a(0x1b5)]){const _0x3453ec=await confirm(_0x516c7a(0x1d5)+_0x54b825+_0x516c7a(0x16e));if(!_0x3453ec)return console[_0x516c7a(0x173)](_0x516c7a(0x13d)),0x0;}}const _0x22ae2f=await withSpinner(_0x51d840?_0x516c7a(0x197)+_0x4e1c40+_0x516c7a(0x144):'Restoring\x20project\x20from\x20\x27'+_0x4e1c40+_0x516c7a(0x144),()=>_0x3ce3df[_0x516c7a(0x15f)][_0x516c7a(0x14f)](_0x4e1c40,{'name':_0xb5326d,'dryRun':_0x51d840}),{'verbose':_0x54acfd[_0x516c7a(0x178)]}),_0x3e0c6d=_0x22ae2f[_0x516c7a(0x1ab)];return _0x3e0c6d[_0x516c7a(0x1c1)]&&console[_0x516c7a(0x173)](_0x516c7a(0x135)+_0x3e0c6d[_0x516c7a(0x1c1)]+'\x27'),_0x51d840?console['log']('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x3e0c6d[_0x516c7a(0x17a)]):console['log'](_0x516c7a(0x113)+_0x3e0c6d[_0x516c7a(0x17a)]+'\x20('+_0x3e0c6d[_0x516c7a(0x121)]+')'),console[_0x516c7a(0x173)]('\x20\x20Agents:\x20'+_0x3e0c6d[_0x516c7a(0x1a7)][_0x516c7a(0x151)]),console[_0x516c7a(0x173)](_0x516c7a(0x1a0)+_0x3e0c6d[_0x516c7a(0x1a7)][_0x516c7a(0x117)]),console['log']('\x20\x20Prompts:\x20'+_0x3e0c6d[_0x516c7a(0x1a7)][_0x516c7a(0x139)]),console[_0x516c7a(0x173)](_0x516c7a(0x112)+_0x3e0c6d[_0x516c7a(0x1a7)][_0x516c7a(0x138)]),(_0x54acfd[_0x516c7a(0x1b2)]===_0x516c7a(0x1d1)||_0x54acfd[_0x516c7a(0x1b2)]==='jsonl')&&await handleSDKOutput([_0x3e0c6d],_0x54acfd),0x0;}catch(_0xf458d8){return handleSDKError(_0xf458d8,_0x54acfd),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x13f705,_0xfa19f4){const _0x220110=a20_0x61ba81,_0xcb7c2f=_0xfa19f4[_0x220110(0x1a3)]||CHAT_SELECTOR_PAGE_SIZE;let _0x5c81bf=0x0,_0x10d39c=[];const _0x2b0291=(await import(_0x220110(0x139)))['default'],_0x4b154e=getChalk(_0xfa19f4);while(!![]){const _0x5105e9=await withSpinner(_0x220110(0x1a6),()=>_0x13f705['llm'][_0x220110(0x16d)](_0xcb7c2f+_0x5c81bf),{'verbose':_0xfa19f4['verbose']});_0x10d39c=_0x5105e9[_0x220110(0x1ab)];const _0xf43b79=_0x10d39c[_0x220110(0x12e)](_0x5c81bf,_0x5c81bf+_0xcb7c2f),_0x2f54e2=_0x10d39c[_0x220110(0x19c)]>_0x5c81bf+_0xcb7c2f,_0x237b83=[...new Set(_0xf43b79[_0x220110(0x1a4)](_0x229563=>_0x229563[_0x220110(0x198)][_0x220110(0x169)])['filter'](_0x32e9c3=>_0x32e9c3!==undefined))],_0x50b35c=new Map();await Promise['all'](_0x237b83[_0x220110(0x1a4)](async _0x4d79e1=>{const _0x2a1dc9=_0x220110;try{const _0x5f1e8e=await _0x13f705[_0x2a1dc9(0x15f)]['agent'](_0x4d79e1);_0x50b35c[_0x2a1dc9(0x1cf)](_0x4d79e1,_0x5f1e8e[_0x2a1dc9(0x198)][_0x2a1dc9(0x1c9)]);}catch{_0x50b35c[_0x2a1dc9(0x1cf)](_0x4d79e1,_0x4d79e1);}}));const _0x2a93d7=_0xf43b79['map'](_0x58645b=>{const _0x463433=_0x220110,_0x393b9e=_0x58645b[_0x463433(0x198)][_0x463433(0x183)]||_0x463433(0x1d6),_0x26e6cc=_0x393b9e[_0x463433(0x10b)]('\x0a')[0x0],_0x2b6992=_0x26e6cc[_0x463433(0x19c)]>0x50?_0x26e6cc['substring'](0x0,0x4d)+'...':_0x26e6cc,_0xc174fe=_0x58645b[_0x463433(0x198)][_0x463433(0x169)]?_0x50b35c[_0x463433(0x156)](_0x58645b['attributes']['agentId'])||_0x58645b[_0x463433(0x198)]['agentId']:_0x463433(0x172),_0x316906=_0x58645b[_0x463433(0x198)][_0x463433(0x1c4)]||_0x58645b[_0x463433(0x198)][_0x463433(0x154)],_0x1a2733=new Date(_0x316906),_0x4c3af7=new Date(),_0x3f79a8=_0x4c3af7[_0x463433(0x1a8)]()-_0x1a2733[_0x463433(0x1a8)](),_0x9ad108=Math[_0x463433(0x1c3)](_0x3f79a8/0xea60),_0x1c88b5=Math[_0x463433(0x1c3)](_0x3f79a8/0x36ee80),_0x12658c=Math[_0x463433(0x1c3)](_0x3f79a8/0x5265c00);let _0x8caff0;if(_0x9ad108<0x1)_0x8caff0=_0x463433(0x196);else{if(_0x9ad108<0x3c)_0x8caff0=_0x9ad108+_0x463433(0x134);else{if(_0x1c88b5<0x18)_0x8caff0=_0x1c88b5+_0x463433(0x16c);else _0x12658c<0x7?_0x8caff0=_0x12658c+'d\x20ago':_0x8caff0=_0x1a2733['toLocaleDateString']('en-US',{'month':'short','day':_0x463433(0x118)});}}return{'title':_0x2b6992+'\x20'+_0x4b154e[_0x463433(0x17c)]('['+_0xc174fe+']\x20'+_0x8caff0),'value':_0x58645b['id']};});_0x2f54e2&&_0x2a93d7['push']({'title':_0x4b154e['cyan'](_0x220110(0x155)),'value':_0x220110(0x182)});const _0x36e4a6=await _0x2b0291({'type':_0x220110(0x150),'name':_0x220110(0x141),'message':_0x220110(0x171),'choices':_0x2a93d7,'hint':_0x220110(0x131)});if(!_0x36e4a6[_0x220110(0x141)])return undefined;if(_0x36e4a6[_0x220110(0x141)]===_0x220110(0x182)){_0x5c81bf+=_0xcb7c2f;continue;}return _0x36e4a6[_0x220110(0x141)];}}export class ChatsCommand extends BaseCommand{[a20_0x61ba81(0x1c9)]=a20_0x61ba81(0x16d);[a20_0x61ba81(0x133)]=a20_0x61ba81(0x1d7);async[a20_0x61ba81(0x128)](_0x638f0b){return executeChatHistoryCommand(_0x638f0b,'tdx\x20chats');}}export class LLMLogCommand extends BaseCommand{['name']='llm:log';[a20_0x61ba81(0x133)]=a20_0x61ba81(0x18b);async[a20_0x61ba81(0x128)](_0x1ae3d4){const _0x11a212=a20_0x61ba81,{options:_0x1996e1,args:_0x357a43,tdx:_0x497b83}=_0x1ae3d4,_0x5373fc=_0x357a43[0x0];if(!_0x5373fc)return console[_0x11a212(0x126)](_0x11a212(0x19e)),console[_0x11a212(0x126)](_0x11a212(0x12b)),0x1;const _0x4ac11b=await withSpinner('Fetching\x20chat\x20log\x20for\x20\x27'+_0x5373fc+_0x11a212(0x144),()=>_0x497b83[_0x11a212(0x15f)]['getChatLog'](_0x5373fc),{'verbose':_0x1996e1[_0x11a212(0x178)]});return await handleSDKOutput(_0x4ac11b[_0x11a212(0x1ab)][_0x11a212(0x1ab)],_0x1996e1),0x0;}}
1
+ const a20_0x72a90=a20_0x46b8;(function(_0x230b74,_0x71ddd5){const _0x1555a3=a20_0x46b8,_0x37c84d=_0x230b74();while(!![]){try{const _0x399686=-parseInt(_0x1555a3(0x20f))/0x1*(parseInt(_0x1555a3(0x18b))/0x2)+parseInt(_0x1555a3(0x1c5))/0x3+parseInt(_0x1555a3(0x172))/0x4*(parseInt(_0x1555a3(0x1b1))/0x5)+parseInt(_0x1555a3(0x236))/0x6+parseInt(_0x1555a3(0x1e0))/0x7+parseInt(_0x1555a3(0x20b))/0x8+parseInt(_0x1555a3(0x1fa))/0x9*(-parseInt(_0x1555a3(0x1e4))/0xa);if(_0x399686===_0x71ddd5)break;else _0x37c84d['push'](_0x37c84d['shift']());}catch(_0x76e140){_0x37c84d['push'](_0x37c84d['shift']());}}}(a20_0x41f2,0x68e7d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a20_0x46b8(_0x1cfc38,_0x3f33bd){_0x1cfc38=_0x1cfc38-0x168;const _0x41f277=a20_0x41f2();let _0x46b878=_0x41f277[_0x1cfc38];return _0x46b878;}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_0x533684 from'node:fs';function handleSDKError(_0x1083af,_0x18d2cd){const _0x556e38=a20_0x46b8;if(_0x1083af instanceof SDKError)console['error'](_0x556e38(0x168)+_0x1083af[_0x556e38(0x17b)]),_0x18d2cd[_0x556e38(0x221)]&&(_0x1083af[_0x556e38(0x175)]&&console[_0x556e38(0x1ef)](_0x556e38(0x1d3)+_0x1083af[_0x556e38(0x175)]),_0x1083af['stack']&&(console[_0x556e38(0x1ef)](_0x556e38(0x18c)),console[_0x556e38(0x1ef)](_0x1083af[_0x556e38(0x1e9)])));else throw _0x1083af;}function formatChatHistoryEntry(_0x4c6cd3,_0x6f33b4){const _0x342e7b=a20_0x46b8,_0x3ba579=getChalk(_0x6f33b4),_0x1ce1a3=_0x3ba579['dim'](_0x4c6cd3['at']);if(_0x342e7b(0x1cd)in _0x4c6cd3){const _0xf5418c=_0x3ba579[_0x342e7b(0x1c4)](_0x342e7b(0x1f7));return _0x1ce1a3+'\x20'+_0xf5418c+':\x20'+_0x4c6cd3['input'];}if(_0x342e7b(0x209)in _0x4c6cd3){const _0xcd0c8=_0x3ba579[_0x342e7b(0x1d2)]('[content]');return _0x1ce1a3+'\x20'+_0xcd0c8+':\x20'+_0x4c6cd3[_0x342e7b(0x209)];}if(_0x342e7b(0x176)in _0x4c6cd3){const _0x5b2b5a=_0x3ba579[_0x342e7b(0x184)](_0x342e7b(0x204)),{functionName:_0x5ee7b5,functionArguments:_0x523416,targetFunction:_0x44c2d8}=_0x4c6cd3['tool_call'];let _0x20f226=_0x1ce1a3+'\x20'+_0x5b2b5a+':\x20'+_0x3ba579[_0x342e7b(0x1bd)](_0x5ee7b5);if(_0x523416&&Object[_0x342e7b(0x1ed)](_0x523416)[_0x342e7b(0x186)]>0x0){const _0x20eed5=Object['entries'](_0x523416)[_0x342e7b(0x1db)](([_0x123f23,_0x48a67e])=>_0x123f23+'='+JSON[_0x342e7b(0x239)](_0x48a67e))[_0x342e7b(0x241)](',\x20');_0x20f226+='('+_0x20eed5+')';}_0x44c2d8&&(_0x20f226+=_0x3ba579[_0x342e7b(0x180)]('\x20['+_0x44c2d8+']'));let _0x5762bd='';if(_0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x1b6)])_0x5762bd='\x20->\x20KB:'+_0x4c6cd3[_0x342e7b(0x176)]['targetKnowledgeBase'][_0x342e7b(0x223)];else{if(_0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x19f)])_0x5762bd='\x20->\x20Agent:'+_0x4c6cd3['tool_call'][_0x342e7b(0x19f)][_0x342e7b(0x223)];else{if(_0x4c6cd3[_0x342e7b(0x176)]['targetWebSearchTool'])_0x5762bd=_0x342e7b(0x233)+_0x4c6cd3[_0x342e7b(0x176)]['targetWebSearchTool'][_0x342e7b(0x223)];else _0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x16c)]&&(_0x5762bd=_0x342e7b(0x1fe)+_0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x16c)][_0x342e7b(0x223)]);}}return _0x20f226+_0x5762bd;}if(_0x342e7b(0x1dc)in _0x4c6cd3){const _0x3da67e=_0x3ba579[_0x342e7b(0x234)]('[tool]\x20\x20\x20'),{functionName:_0x447688,functionArguments:_0x19c42c,content:_0x324282,newChat:_0x550157}=_0x4c6cd3[_0x342e7b(0x1dc)];let _0x49cc10=_0x1ce1a3+'\x20'+_0x3da67e+':\x20'+_0x3ba579[_0x342e7b(0x1bd)](_0x447688);if(_0x19c42c){const _0x38b941=typeof _0x19c42c===_0x342e7b(0x1f8)?_0x19c42c:JSON[_0x342e7b(0x239)](_0x19c42c);_0x49cc10+='('+_0x38b941+')';}return _0x324282&&(_0x49cc10+='\x0a'+_0x3ba579[_0x342e7b(0x180)](_0x324282)),_0x550157&&(_0x49cc10+=_0x3ba579['dim'](_0x342e7b(0x1ac)+_0x550157['id'])),_0x49cc10;}if(_0x342e7b(0x201)in _0x4c6cd3){const _0x4eba79=_0x3ba579[_0x342e7b(0x1f4)]('[output]\x20');return _0x1ce1a3+'\x20'+_0x4eba79+':\x20'+_0x4c6cd3[_0x342e7b(0x201)][_0x342e7b(0x223)]+'\x20('+_0x4c6cd3[_0x342e7b(0x201)][_0x342e7b(0x209)]['length']+_0x342e7b(0x22d);}if(_0x342e7b(0x231)in _0x4c6cd3){const _0x176055=_0x3ba579['blue']('[image]\x20\x20'),{width:_0x586a1c,height:_0x4f8e6a,headerText:_0x2410b5}=_0x4c6cd3[_0x342e7b(0x231)],_0x951163=_0x2410b5?_0x342e7b(0x1c9)+_0x2410b5:'';return _0x1ce1a3+'\x20'+_0x176055+':\x20'+_0x586a1c+'x'+_0x4f8e6a+_0x951163;}if('error'in _0x4c6cd3){const _0x4c966b=_0x3ba579[_0x342e7b(0x18d)](_0x342e7b(0x197));return _0x1ce1a3+'\x20'+_0x4c966b+':\x20'+_0x4c6cd3[_0x342e7b(0x1ef)];}return _0x1ce1a3+'\x20'+_0x3ba579[_0x342e7b(0x180)](_0x342e7b(0x17c))+':\x20'+JSON[_0x342e7b(0x239)](_0x4c6cd3);}async function executeChatHistoryCommand(_0xead02d,_0x7bb765){const _0x4f1d5a=a20_0x46b8,{options:_0x67b19c,args:_0xbaf815,tdx:_0x340832}=_0xead02d,_0x171855=_0xbaf815[0x0],_0x5c9268=_0x67b19c,_0x62faae=_0x5c9268[_0x4f1d5a(0x211)];try{if(_0x62faae&&_0x171855)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x4f1d5a(0x1ef)](_0x4f1d5a(0x225)+_0x7bb765+_0x4f1d5a(0x192)),0x1;if(!_0x171855&&!_0x62faae&&_0x67b19c[_0x4f1d5a(0x1ec)]!==undefined){const _0x43a187=resolveLimit(_0x67b19c[_0x4f1d5a(0x22c)],DEFAULT_LLM_LIMIT),_0x8385f9=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x340832[_0x4f1d5a(0x1c8)]['chats'](_0x43a187),{'verbose':_0x67b19c[_0x4f1d5a(0x221)]});return await handleSDKOutput(_0x8385f9[_0x4f1d5a(0x195)],_0x67b19c),0x0;}const _0x1aa4c0=await getChatIdOrSelect(_0x340832,_0x67b19c,_0x62faae,_0x171855);if(!_0x1aa4c0)return 0x0;return await displayChatHistory(_0x1aa4c0,_0x340832,_0x67b19c),0x0;}catch(_0x391fba){return handleSDKError(_0x391fba,_0x67b19c),0x1;}}async function displayChatHistory(_0x3751bd,_0xad89eb,_0x1a7c5e){const _0x3409f4=a20_0x46b8,_0x4fcb17=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x3751bd+'\x27...',()=>_0xad89eb[_0x3409f4(0x1c8)][_0x3409f4(0x17f)](_0x3751bd),{'verbose':_0x1a7c5e[_0x3409f4(0x221)]}),_0x3dbd93=_0x4fcb17[_0x3409f4(0x195)][_0x3409f4(0x195)]??[];if(_0x3dbd93['length']===0x0){console[_0x3409f4(0x1e2)](_0x3409f4(0x210));return;}if(_0x1a7c5e[_0x3409f4(0x1ec)]!==undefined)await handleSDKOutput(_0x3dbd93,_0x1a7c5e);else{const _0x3c71b6=_0x3dbd93[_0x3409f4(0x1db)](_0xf48952=>formatChatHistoryEntry(_0xf48952,_0x1a7c5e)),_0x2bdeb0=_0x3c71b6[_0x3409f4(0x241)]('\x0a');await writeOutput(_0x2bdeb0,_0x1a7c5e[_0x3409f4(0x201)],_0x3409f4(0x17a));}}async function getChatIdOrSelect(_0x2ecae5,_0x583d59,_0x128539,_0x5e2244){const _0x21c0c3=a20_0x46b8;if(_0x5e2244)return _0x5e2244;if(_0x128539){const _0x4ff665=await withSpinner(_0x21c0c3(0x200),()=>_0x2ecae5[_0x21c0c3(0x1c8)][_0x21c0c3(0x1fd)](0x1),{'verbose':_0x583d59[_0x21c0c3(0x221)]});if(_0x4ff665[_0x21c0c3(0x195)][_0x21c0c3(0x186)]===0x0)return console[_0x21c0c3(0x1e2)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x4ff665[_0x21c0c3(0x195)][0x0]['id'];}const _0x13baf8=await selectChatInteractively(_0x2ecae5,_0x583d59);if(!_0x13baf8)return console[_0x21c0c3(0x1e2)](_0x21c0c3(0x1c2)),undefined;return _0x13baf8;}async function getProjectIdOrDefault(_0x3565e2){const _0x1b02c4=await getProjectWithName(_0x3565e2);return _0x1b02c4['id'];}async function getProjectWithName(_0x251d47){const _0x2734ff=a20_0x46b8,{tdx:_0x1d59cd,options:_0x376201}=_0x251d47,_0x1340d4=_0x376201[_0x2734ff(0x1d1)];if(_0x1340d4){const _0x30b288=await withSpinner('Resolving\x20project\x20\x27'+_0x1340d4+_0x2734ff(0x1e6),()=>_0x1d59cd[_0x2734ff(0x1c8)]['resolveProjectId'](_0x1340d4),{'verbose':_0x376201['verbose']});return{'id':_0x30b288['data'],'name':_0x1340d4};}const _0x437085=_0x1d59cd[_0x2734ff(0x1c8)][_0x2734ff(0x1d4)]();if(_0x437085){const _0x5583e4=await _0x1d59cd['llm'][_0x2734ff(0x18e)](),_0x1baabb=_0x5583e4[_0x2734ff(0x207)](_0xf3df40=>_0xf3df40['id']===_0x437085);return{'id':_0x437085,'name':_0x1baabb?.[_0x2734ff(0x1c7)][_0x2734ff(0x223)]||_0x2734ff(0x1d0)};}const _0x1bd9cc=await withSpinner(_0x2734ff(0x178),()=>_0x1d59cd[_0x2734ff(0x1c8)][_0x2734ff(0x1e3)](),{'verbose':_0x376201['verbose']});return{'id':_0x1bd9cc['data']['id'],'name':_0x1bd9cc[_0x2734ff(0x195)][_0x2734ff(0x1c7)][_0x2734ff(0x223)]};}function toLLMProjectInfo(_0x3c5651){const _0x4bd004=a20_0x46b8;return{'name':_0x3c5651[_0x4bd004(0x1c7)]['name'],'description':_0x3c5651[_0x4bd004(0x1c7)][_0x4bd004(0x177)],'createdAt':_0x3c5651['attributes'][_0x4bd004(0x1b5)],'updatedAt':_0x3c5651[_0x4bd004(0x1c7)][_0x4bd004(0x1bb)]};}function toAgentInfo(_0x37bb2f){const _0xc03f7e=a20_0x46b8;return{'name':_0x37bb2f[_0xc03f7e(0x1c7)]['name'],'description':_0x37bb2f[_0xc03f7e(0x1c7)]['description'],'prompt':truncatePrompt(_0x37bb2f[_0xc03f7e(0x1c7)][_0xc03f7e(0x232)]),'createdAt':_0x37bb2f[_0xc03f7e(0x1c7)][_0xc03f7e(0x1b5)],'updatedAt':_0x37bb2f[_0xc03f7e(0x1c7)]['updatedAt']};}function truncatePrompt(_0x2bed6b){const _0x365f4d=a20_0x46b8;if(!_0x2bed6b)return undefined;const _0x426f75=0x64;if(_0x2bed6b[_0x365f4d(0x186)]<=_0x426f75)return _0x2bed6b;return _0x2bed6b['slice'](0x0,_0x426f75)+_0x365f4d(0x1e1);}export class LLMModelsCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x238);[a20_0x72a90(0x177)]=a20_0x72a90(0x1a7);async[a20_0x72a90(0x21b)](_0x4904b0){const _0x201960=a20_0x72a90,{options:_0x17f583,tdx:_0x49e194}=_0x4904b0;try{const _0x24129f=await withSpinner(_0x201960(0x17d),()=>_0x49e194['llm'][_0x201960(0x235)](),{'verbose':_0x17f583[_0x201960(0x221)]});return await handleSDKOutput(_0x24129f[_0x201960(0x195)],_0x17f583),0x0;}catch(_0x1b4e93){return handleSDKError(_0x1b4e93,_0x17f583),0x1;}}}function a20_0x41f2(){const _0x42033a=['\x20\x20Knowledge\x20Bases:\x20','setCurrentProject','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','\x20--last','counts','yes','data','Creating\x20project\x20\x27','[error]\x20\x20','agent','exportedFrom','Resolving\x20agent\x20\x27','temperature','Set\x20current\x20project\x20context','outputDir','model','targetAgent','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','\x20\x20\x20Examples:','Project\x20restored:\x20','Setting\x20project\x20context\x20to\x20\x27','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','chatId','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','List\x20available\x20LLM\x20models','numeric','A\x20project\x20named\x20\x27','projectName','Checking\x20for\x20existing\x20projects...','\x20→\x20chat:\x20','\x20\x20Prompts:\x20','m\x20ago','Delete\x20an\x20LLM\x20project','Create\x20a\x20new\x20LLM\x20project','2045vFyGkK','sort','⚒️\x20','\x20\x20Integrations:\x20','createdAt','targetKnowledgeBase','Fetching\x20projects...','Usage:\x20tdx\x20llm\x20use\x20<project-name>','INVALID_ARGUMENT','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','updatedAt','Deleting\x20project\x20\x27','bold','agents','push','getBackupMetadata','llm:project:backup','\x0aCancelled','sourceSite','cyan','1961892IHUMjX','site','attributes','llm','\x20-\x20','List\x20agents\x20in\x20current\x20project','Fetching\x20agents...','integrations','input','\x27\x20already\x20exists.\x20Overwrite?','__load_more__','Unknown','llmProject','green','\x20\x20Cause:\x20','getCurrentProject','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','localeCompare','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Show\x20chat\x20log','Validating\x20backup\x20from\x20\x27','Load\x20more...','map','tool','llm:agent:create','Output\x20directory\x20\x27','rmSync','2498328OODDLo','...','log','getOrCreateDefaultProject','4010gKjENH','Update\x20an\x20existing\x20agent','\x27...','Agent\x20updated:\x20','Project\x20not\x20found:\x20','stack','floor','get','format','keys','just\x20now','error','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','lastConversationAt','blue','llm:agents','Usage:\x20TDX_EXPERIMENTAL=true\x20tdx\x20llm\x20log\x20<chat-id>','[input]\x20\x20','string','dryRun','29844odENtv','\x20\x20Agents:\x20','toLowerCase','chats','\x20->\x20ImageGen:','Error:\x20Backup\x20folder\x20path\x20is\x20required','Fetching\x20most\x20recent\x20chat...','output','Backup\x20cancelled.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','[tool_call]','llm:history','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','find','Restore\x20cancelled.','content','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','899088zMakxA','knowledgeBases','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','maxToolIterations','23ceNJjA','No\x20messages\x20found\x20in\x20chat\x20history.','last','tsv','systemPrompt','(no\x20agent)','existsSync','Show\x20agent\x20details','llm:project:create','split','substring','filter','execute','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','No\x20projects\x20found','tdx\x20llm\x20history','Project\x20deleted:\x20','Resolving\x20project\x20\x27','verbose','Error:\x20Project\x20name\x20is\x20required','name','llm:project:delete','Usage:\x20','backupProject','starterMessage','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','Create\x20a\x20new\x20agent\x20in\x20current\x20project','\x20project(s)','Agent\x20deleted:\x20','limit','\x20bytes)','json','Project\x20context\x20set\x20to:\x20','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','image','prompt','\x20->\x20WebSearch:','magenta','models','4634556dEoaZv','agentId','llm:models','stringify','Agent\x20created:\x20','Deleting\x20agent...','Updating\x20agent...','Error:\x20chat-id\x20is\x20required','getChatLog','jsonl','resolveAgentId','join','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Error:\x20','Use\x20format:\x20project-name/agent-name','resolveProjectId','Error:\x20Agent\x20name\x20is\x20required','targetImageGenerator','getTime','set','en-US','Invalid\x20path\x20syntax:\x20','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','1432euwNbu','includes','updateAgent','cause','tool_call','description','Getting\x20default\x20project...','deleteProject','table','message','[unknown]','Fetching\x20available\x20models...','Fetching\x20chat\x20sessions...','history','dim','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','.llm','llm:log','yellow','d\x20ago','length','createAgent','prompts','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','🤖\x20','24582DwUXBg','\x0aStack\x20trace:','red','projects'];a20_0x41f2=function(){return _0x42033a;};return a20_0x41f2();}export class LLMProjectsCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:projects';[a20_0x72a90(0x177)]='List\x20all\x20LLM\x20projects';async['execute'](_0x4c2811){const _0x3e613b=a20_0x72a90,{options:_0x2dacf6,args:_0x50f3a7,tdx:_0x53c7f9}=_0x4c2811,_0x33c95=getChalk(_0x2dacf6),_0x1e0a4c=_0x2dacf6['site'];try{const _0x5e8751=_0x50f3a7[0x0],_0x17c72f=resolveLimit(_0x2dacf6[_0x3e613b(0x22c)],DEFAULT_LLM_LIMIT),_0x3dd9b7=await withSpinner(_0x3e613b(0x1b7),()=>_0x53c7f9[_0x3e613b(0x1c8)][_0x3e613b(0x18e)](_0x17c72f),{'verbose':_0x2dacf6[_0x3e613b(0x221)]});let _0x39d01f=_0x3dd9b7['data'];_0x5e8751&&(_0x39d01f=_0x3dd9b7['data'][_0x3e613b(0x21a)](_0x49d3a8=>matchGlobPattern(_0x49d3a8[_0x3e613b(0x1c7)][_0x3e613b(0x223)],_0x5e8751)));const _0x7cfc=_0x2dacf6[_0x3e613b(0x1ec)]===_0x3e613b(0x22e)||_0x2dacf6['format']===_0x3e613b(0x23f)||_0x2dacf6[_0x3e613b(0x1ec)]==='table'||_0x2dacf6[_0x3e613b(0x1ec)]===_0x3e613b(0x212);if(_0x7cfc){const _0x55af84=_0x39d01f[_0x3e613b(0x1db)](_0x3b9614=>({...toLLMProjectInfo(_0x3b9614),'url':getLLMProjectUrl(_0x1e0a4c,_0x3b9614['id'])}));await handleSDKOutput(_0x55af84,_0x2dacf6);}else{const _0x57112e=[];if(_0x39d01f[_0x3e613b(0x186)]===0x0)_0x57112e[_0x3e613b(0x1bf)](_0x33c95['dim'](_0x3e613b(0x21d)));else{const _0x2f8d3a=[..._0x39d01f][_0x3e613b(0x1b2)]((_0x3f30cc,_0x2dfe23)=>_0x3f30cc[_0x3e613b(0x1c7)][_0x3e613b(0x223)][_0x3e613b(0x1d6)](_0x2dfe23[_0x3e613b(0x1c7)]['name']));for(const _0x4e142c of _0x2f8d3a){const _0x20bd8f=getLLMProjectUrl(_0x1e0a4c,_0x4e142c['id']),_0x3084fb=hyperlink(_0x4e142c['attributes']['name'],_0x20bd8f);_0x57112e['push'](_0x3e613b(0x1b3)+_0x3084fb);}_0x57112e[_0x3e613b(0x1bf)](_0x33c95[_0x3e613b(0x180)](_0x39d01f['length']+_0x3e613b(0x22a)));}await writeOutput(_0x57112e['join']('\x0a'),_0x2dacf6[_0x3e613b(0x201)],_0x3e613b(0x17a));}return 0x0;}catch(_0x26863c){return handleSDKError(_0x26863c,_0x2dacf6),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1f5);[a20_0x72a90(0x177)]=a20_0x72a90(0x1ca);async[a20_0x72a90(0x21b)](_0x3978e2){const _0xeea4d9=a20_0x72a90,{options:_0x3f2d63,args:_0x4f639c,tdx:_0x4bc8ab}=_0x3978e2,_0x5b4ad9=getChalk(_0x3f2d63),_0x269c5f=_0x3f2d63[_0xeea4d9(0x1c6)];try{const _0x51edeb=_0x4f639c[0x0];let _0x3a2386=_0x51edeb,_0x115f96,_0x4b1f0d;if(_0x51edeb&&_0x51edeb[_0xeea4d9(0x173)]('/')){const _0xf99a39=_0x51edeb[_0xeea4d9(0x218)]('/');if(_0xf99a39[_0xeea4d9(0x186)]===0x2){const [_0x1f20b4,_0x53a05e]=_0xf99a39,_0x589bd6=await _0x4bc8ab[_0xeea4d9(0x1c8)]['projects'](),_0x3725bf=_0x589bd6[_0xeea4d9(0x207)](_0x2ba695=>_0x2ba695['attributes']['name']['toLowerCase']()===_0x1f20b4[_0xeea4d9(0x1fc)]());if(!_0x3725bf)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0xeea4d9(0x1e8)+_0x1f20b4,undefined,{'helpText':_0xeea4d9(0x203)});_0x115f96=_0x3725bf['id'],_0x4b1f0d=_0x3725bf[_0xeea4d9(0x1c7)][_0xeea4d9(0x223)],_0x3a2386=_0x53a05e;}else throw new SDKError(ErrorCode[_0xeea4d9(0x1b9)],_0xeea4d9(0x170)+_0x51edeb,undefined,{'helpText':_0xeea4d9(0x169)});}else{const _0x2843bc=await getProjectWithName(_0x3978e2);_0x115f96=_0x2843bc['id'],_0x4b1f0d=_0x2843bc[_0xeea4d9(0x223)];}const _0x37282c=await withSpinner(_0xeea4d9(0x1cb),()=>_0x4bc8ab[_0xeea4d9(0x1c8)][_0xeea4d9(0x1be)](_0x115f96),{'verbose':_0x3f2d63[_0xeea4d9(0x221)]});let _0x2cdf09=_0x37282c[_0xeea4d9(0x195)];_0x3a2386&&(_0x2cdf09=_0x37282c[_0xeea4d9(0x195)][_0xeea4d9(0x21a)](_0x12463a=>matchGlobPattern(_0x12463a[_0xeea4d9(0x1c7)][_0xeea4d9(0x223)],_0x3a2386)));const _0x5ef83e=_0x3f2d63[_0xeea4d9(0x1ec)]===_0xeea4d9(0x22e)||_0x3f2d63[_0xeea4d9(0x1ec)]==='jsonl'||_0x3f2d63[_0xeea4d9(0x1ec)]==='table'||_0x3f2d63[_0xeea4d9(0x1ec)]===_0xeea4d9(0x212);if(_0x5ef83e){const _0x10e89e=_0x2cdf09[_0xeea4d9(0x1db)](_0x14d4d4=>({...toAgentInfo(_0x14d4d4),'chatUrl':getLLMAgentChatUrl(_0x269c5f,_0x115f96,_0x14d4d4['id'])}));await handleSDKOutput(_0x10e89e,_0x3f2d63);}else{const _0x3e4144=[];_0x3e4144['push'](_0x5b4ad9[_0xeea4d9(0x180)]('['+_0x4b1f0d+']'));if(_0x2cdf09['length']===0x0)_0x3e4144['push'](_0x5b4ad9[_0xeea4d9(0x180)]('No\x20agents\x20found'));else{const _0x153ac2=[..._0x2cdf09][_0xeea4d9(0x1b2)]((_0x1e2255,_0x2fc647)=>_0x1e2255['attributes'][_0xeea4d9(0x223)][_0xeea4d9(0x1d6)](_0x2fc647[_0xeea4d9(0x1c7)][_0xeea4d9(0x223)]));for(const _0x1fa2b7 of _0x153ac2){const _0x50dfb1=getLLMAgentChatUrl(_0x269c5f,_0x115f96,_0x1fa2b7['id']),_0xd910=hyperlink(_0x1fa2b7['attributes'][_0xeea4d9(0x223)],_0x50dfb1);_0x3e4144['push'](_0xeea4d9(0x18a)+_0xd910);}_0x3e4144['push'](_0x5b4ad9[_0xeea4d9(0x180)](_0x2cdf09[_0xeea4d9(0x186)]+'\x20agent(s)'));}await writeOutput(_0x3e4144[_0xeea4d9(0x241)]('\x0a'),_0x3f2d63[_0xeea4d9(0x201)],_0xeea4d9(0x17a));}return 0x0;}catch(_0x45e399){return handleSDKError(_0x45e399,_0x3f2d63),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']='llm:agent:show';[a20_0x72a90(0x177)]=a20_0x72a90(0x216);async['execute'](_0x3a4512){const _0x1118e7=a20_0x72a90,{options:_0x2bcde6,args:_0x5a56cf,tdx:_0x4a0029}=_0x3a4512;if(_0x5a56cf[_0x1118e7(0x186)]===0x0)return console[_0x1118e7(0x1ef)](_0x1118e7(0x16b)),console[_0x1118e7(0x1ef)](_0x1118e7(0x21c)),0x1;const _0x4fd34d=_0x5a56cf[0x0];try{const _0x4f511f=await getProjectIdOrDefault(_0x3a4512),_0x4515ad=await withSpinner('Resolving\x20agent\x20\x27'+_0x4fd34d+_0x1118e7(0x1e6),()=>_0x4a0029['llm'][_0x1118e7(0x240)](_0x4fd34d,_0x4f511f),{'verbose':_0x2bcde6['verbose']}),_0x11dcd4=await withSpinner('Fetching\x20agent...',()=>_0x4a0029[_0x1118e7(0x1c8)][_0x1118e7(0x198)](_0x4515ad['data']),{'verbose':_0x2bcde6[_0x1118e7(0x221)]});return await handleSDKOutput([_0x11dcd4[_0x1118e7(0x195)]],_0x2bcde6),0x0;}catch(_0x4ef04e){return handleSDKError(_0x4ef04e,_0x2bcde6),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1dd);[a20_0x72a90(0x177)]=a20_0x72a90(0x229);async[a20_0x72a90(0x21b)](_0x489d16){const _0x32b9f1=a20_0x72a90,{options:_0xdffdc7,args:_0x387a38,tdx:_0x32ca7c}=_0x489d16;if(_0x387a38[_0x32b9f1(0x186)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console[_0x32b9f1(0x1ef)](_0x32b9f1(0x1f1)),console[_0x32b9f1(0x1ef)](_0x32b9f1(0x242)),0x1;const _0x43f935=_0x387a38[0x0],_0x2260a2=_0xdffdc7,_0x4fdeb0=_0x2260a2[_0x32b9f1(0x213)],_0x3e8b5f=_0x2260a2[_0x32b9f1(0x19e)]||'claude-4.5-haiku',_0x41f31a=_0x2260a2[_0x32b9f1(0x227)],_0xe59c03=_0x2260a2[_0x32b9f1(0x20e)]?Number(_0x2260a2[_0x32b9f1(0x20e)]):undefined,_0x4456d9=_0x2260a2[_0x32b9f1(0x19b)]?Number(_0x2260a2['temperature']):undefined;try{let _0x143a24,_0x1b5892;if(_0x43f935[_0x32b9f1(0x173)]('/')){const _0x256211=_0x43f935['split']('/');if(_0x256211[_0x32b9f1(0x186)]===0x2){const [_0x51a4fa,_0x4e947b]=_0x256211,_0x448b21=await withSpinner(_0x32b9f1(0x220)+_0x51a4fa+_0x32b9f1(0x1e6),()=>_0x32ca7c[_0x32b9f1(0x1c8)][_0x32b9f1(0x16a)](_0x51a4fa),{'verbose':_0xdffdc7[_0x32b9f1(0x221)]});_0x143a24=_0x448b21[_0x32b9f1(0x195)],_0x1b5892=_0x4e947b;}else throw new SDKError(ErrorCode[_0x32b9f1(0x1b9)],_0x32b9f1(0x170)+_0x43f935,undefined,{'helpText':_0x32b9f1(0x169)});}else _0x143a24=await getProjectIdOrDefault(_0x489d16),_0x1b5892=_0x43f935;const _0x5ebc62=await withSpinner('Creating\x20agent\x20\x27'+_0x1b5892+'\x27...',()=>_0x32ca7c[_0x32b9f1(0x1c8)][_0x32b9f1(0x187)]({'name':_0x1b5892,'projectId':_0x143a24,'modelType':_0x3e8b5f,'systemPrompt':_0x4fdeb0,'starterMessage':_0x41f31a,'maxToolIterations':_0xe59c03,'temperature':_0x4456d9}),{'verbose':_0xdffdc7['verbose']});return console['log'](_0x32b9f1(0x23a)+_0x5ebc62[_0x32b9f1(0x195)]['id']),await handleSDKOutput([_0x5ebc62[_0x32b9f1(0x195)]],_0xdffdc7),0x0;}catch(_0x46fd5c){return handleSDKError(_0x46fd5c,_0xdffdc7),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:agent:update';[a20_0x72a90(0x177)]=a20_0x72a90(0x1e5);async['execute'](_0xd098c7){const _0x48e6df=a20_0x72a90,{options:_0x94de06,args:_0xbc9e62,tdx:_0x39b337}=_0xd098c7;if(_0xbc9e62[_0x48e6df(0x186)]===0x0)return console[_0x48e6df(0x1ef)](_0x48e6df(0x16b)),console[_0x48e6df(0x1ef)](_0x48e6df(0x1a6)),0x1;const _0x407702=_0xbc9e62[0x0],_0x3c8080=_0x94de06,_0x40c489=_0x3c8080[_0x48e6df(0x223)],_0x49b9df=_0x3c8080['prompt'],_0x421d86=_0x3c8080['description'],_0x2b19d0=_0x3c8080[_0x48e6df(0x227)];if(!_0x40c489&&!_0x49b9df&&!_0x421d86&&!_0x2b19d0)return console[_0x48e6df(0x1ef)](_0x48e6df(0x1d7)),console[_0x48e6df(0x1ef)](_0x48e6df(0x1a4)),0x1;try{const _0x382a58=await getProjectIdOrDefault(_0xd098c7),_0x3cdeb1=await withSpinner('Resolving\x20agent\x20\x27'+_0x407702+_0x48e6df(0x1e6),()=>_0x39b337[_0x48e6df(0x1c8)][_0x48e6df(0x240)](_0x407702,_0x382a58),{'verbose':_0x94de06[_0x48e6df(0x221)]}),_0x3656a9=_0x3cdeb1[_0x48e6df(0x195)],_0x1634e2=await withSpinner(_0x48e6df(0x23c),()=>_0x39b337['llm'][_0x48e6df(0x174)](_0x3656a9,{'name':_0x40c489,'prompt':_0x49b9df,'description':_0x421d86,'starterMessage':_0x2b19d0}),{'verbose':_0x94de06[_0x48e6df(0x221)]});return console[_0x48e6df(0x1e2)](_0x48e6df(0x1e7)+_0x1634e2[_0x48e6df(0x195)]['id']),await handleSDKOutput([_0x1634e2[_0x48e6df(0x195)]],_0x94de06),0x0;}catch(_0x1aa6dc){return handleSDKError(_0x1aa6dc,_0x94de06),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:agent:delete';['description']='Delete\x20an\x20agent';async[a20_0x72a90(0x21b)](_0x474838){const _0xfa424e=a20_0x72a90,{options:_0x473a8b,args:_0x2150cc,tdx:_0x56669f}=_0x474838;if(_0x2150cc['length']===0x0)return console[_0xfa424e(0x1ef)](_0xfa424e(0x16b)),console[_0xfa424e(0x1ef)](_0xfa424e(0x1d5)),0x1;const _0x554894=_0x2150cc[0x0];try{const _0x3243b3=await getProjectIdOrDefault(_0x474838),_0x10b0fc=await withSpinner(_0xfa424e(0x19a)+_0x554894+'\x27...',()=>_0x56669f['llm'][_0xfa424e(0x240)](_0x554894,_0x3243b3),{'verbose':_0x473a8b[_0xfa424e(0x221)]}),_0x26729b=_0x10b0fc[_0xfa424e(0x195)];return await withSpinner(_0xfa424e(0x23b),()=>_0x56669f['llm']['deleteAgent'](_0x26729b),{'verbose':_0x473a8b[_0xfa424e(0x221)]}),console[_0xfa424e(0x1e2)](_0xfa424e(0x22b)+_0x26729b),0x0;}catch(_0x655dd4){return handleSDKError(_0x655dd4,_0x473a8b),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a20_0x72a90(0x205);[a20_0x72a90(0x177)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async[a20_0x72a90(0x21b)](_0x5e6044){const _0x270da0=a20_0x72a90;return executeChatHistoryCommand(_0x5e6044,_0x270da0(0x21e));}}export class LLMUseCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:use';['description']=a20_0x72a90(0x19c);async['execute'](_0x4831f4){const _0x5a58ef=a20_0x72a90,{options:_0x1603e0,args:_0x1c72d6,tdx:_0x52c6fd}=_0x4831f4;if(_0x1c72d6[_0x5a58ef(0x186)]===0x0)return console[_0x5a58ef(0x1ef)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x5a58ef(0x1ef)](_0x5a58ef(0x1b8)),0x1;const _0x5d438b=_0x1c72d6[0x0];try{return await withSpinner(_0x5a58ef(0x1a3)+_0x5d438b+_0x5a58ef(0x1e6),()=>_0x52c6fd[_0x5a58ef(0x1c8)][_0x5a58ef(0x190)](_0x5d438b),{'verbose':_0x1603e0[_0x5a58ef(0x221)]}),console[_0x5a58ef(0x1e2)](_0x5a58ef(0x22f)+_0x5d438b),0x0;}catch(_0x38ea1b){return handleSDKError(_0x38ea1b,_0x1603e0),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x217);[a20_0x72a90(0x177)]=a20_0x72a90(0x1b0);async[a20_0x72a90(0x21b)](_0x16b1d3){const _0x23e8a7=a20_0x72a90,{options:_0x3ba998,args:_0x237cf5,tdx:_0x22e922}=_0x16b1d3;if(_0x237cf5[_0x23e8a7(0x186)]===0x0)return console['error'](_0x23e8a7(0x222)),console[_0x23e8a7(0x1ef)](_0x23e8a7(0x1f0)),0x1;const _0x46de19=_0x237cf5[0x0],_0x5e1580=_0x3ba998,_0x57df8a=_0x5e1580[_0x23e8a7(0x177)];try{const _0x2d716e=await withSpinner(_0x23e8a7(0x196)+_0x46de19+_0x23e8a7(0x1e6),()=>_0x22e922[_0x23e8a7(0x1c8)]['createProject']({'name':_0x46de19,'description':_0x57df8a}),{'verbose':_0x3ba998[_0x23e8a7(0x221)]});console[_0x23e8a7(0x1e2)]('Project\x20created:\x20'+_0x2d716e[_0x23e8a7(0x195)]['id']);const _0x744990=toLLMProjectInfo(_0x2d716e['data']);return await handleSDKOutput([_0x744990],_0x3ba998),0x0;}catch(_0x4d38f8){return handleSDKError(_0x4d38f8,_0x3ba998),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x224);[a20_0x72a90(0x177)]=a20_0x72a90(0x1af);async[a20_0x72a90(0x21b)](_0x247b9a){const _0x3db83a=a20_0x72a90,{options:_0x506a1d,args:_0x597657,tdx:_0x1f59ac}=_0x247b9a;if(_0x597657[_0x3db83a(0x186)]===0x0)return console[_0x3db83a(0x1ef)](_0x3db83a(0x222)),console[_0x3db83a(0x1ef)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x4a774a=_0x597657[0x0];try{return await withSpinner(_0x3db83a(0x1bc)+_0x4a774a+_0x3db83a(0x1e6),()=>_0x1f59ac['llm'][_0x3db83a(0x179)](_0x4a774a),{'verbose':_0x506a1d[_0x3db83a(0x221)]}),console[_0x3db83a(0x1e2)](_0x3db83a(0x21f)+_0x4a774a),0x0;}catch(_0x3c0000){return handleSDKError(_0x3c0000,_0x506a1d),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1c1);[a20_0x72a90(0x177)]=a20_0x72a90(0x189);async[a20_0x72a90(0x21b)](_0x365243){const _0x4e5c31=a20_0x72a90,{options:_0x377787,args:_0x3c705c,tdx:_0x1c8d19}=_0x365243,_0x41bb57=getChalk(_0x377787);console[_0x4e5c31(0x1e2)](_0x41bb57[_0x4e5c31(0x184)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x4e5c31(0x1e2)](_0x41bb57['yellow'](_0x4e5c31(0x191))),console[_0x4e5c31(0x1e2)](_0x41bb57[_0x4e5c31(0x180)](_0x4e5c31(0x228))),console[_0x4e5c31(0x1e2)]();if(_0x3c705c[_0x4e5c31(0x186)]===0x0)return console['error'](_0x4e5c31(0x222)),console[_0x4e5c31(0x1ef)](_0x4e5c31(0x20d)),0x1;const _0x36023e=_0x3c705c[0x0],_0x1c8e50=_0x377787,_0x15f1bc=_0x1c8e50[_0x4e5c31(0x201)],_0x1ce334=_0x1c8e50[_0x4e5c31(0x1f9)];try{const _0x208f79=_0x15f1bc||_0x36023e+_0x4e5c31(0x182);if(a20_0x533684[_0x4e5c31(0x215)](_0x208f79)&&!_0x1ce334){if(!_0x377787[_0x4e5c31(0x194)]){const _0x1f5e01=await confirm(_0x4e5c31(0x1de)+_0x208f79+_0x4e5c31(0x1ce));if(!_0x1f5e01)return console['log'](_0x4e5c31(0x202)),0x0;}a20_0x533684[_0x4e5c31(0x1df)](_0x208f79,{'recursive':!![]});}const _0x5df4ef=await withSpinner(_0x1ce334?'Analyzing\x20project\x20\x27'+_0x36023e+_0x4e5c31(0x1e6):'Backing\x20up\x20project\x20\x27'+_0x36023e+_0x4e5c31(0x1e6),()=>_0x1c8d19[_0x4e5c31(0x1c8)][_0x4e5c31(0x226)](_0x36023e,_0x15f1bc,{'dryRun':_0x1ce334}),{'verbose':_0x377787[_0x4e5c31(0x221)]}),_0x2d9e87=_0x5df4ef['data'];return _0x1ce334?console[_0x4e5c31(0x1e2)](_0x4e5c31(0x1ba)+_0x2d9e87['outputDir']):console[_0x4e5c31(0x1e2)]('Project\x20backed\x20up\x20to:\x20'+_0x2d9e87[_0x4e5c31(0x19d)]),console[_0x4e5c31(0x1e2)](_0x4e5c31(0x1fb)+_0x2d9e87[_0x4e5c31(0x193)][_0x4e5c31(0x1be)]),console['log'](_0x4e5c31(0x18f)+_0x2d9e87[_0x4e5c31(0x193)][_0x4e5c31(0x20c)]),console['log'](_0x4e5c31(0x1ad)+_0x2d9e87[_0x4e5c31(0x193)]['prompts']),console[_0x4e5c31(0x1e2)](_0x4e5c31(0x1b4)+_0x2d9e87[_0x4e5c31(0x193)]['integrations']),(_0x377787[_0x4e5c31(0x1ec)]==='json'||_0x377787[_0x4e5c31(0x1ec)]===_0x4e5c31(0x23f))&&await handleSDKOutput([_0x2d9e87],_0x377787),0x0;}catch(_0x584c84){return handleSDKError(_0x584c84,_0x377787),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:project:restore';['description']=a20_0x72a90(0x171);async[a20_0x72a90(0x21b)](_0x3db02c){const _0x25e9f4=a20_0x72a90,{options:_0x448fd8,args:_0x337054,tdx:_0x5a1984}=_0x3db02c,_0x337b05=getChalk(_0x448fd8);console[_0x25e9f4(0x1e2)](_0x337b05[_0x25e9f4(0x184)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console[_0x25e9f4(0x1e2)](_0x337b05[_0x25e9f4(0x184)]('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console['log'](_0x337b05[_0x25e9f4(0x180)](_0x25e9f4(0x1a1))),console['log'](_0x337b05[_0x25e9f4(0x180)](_0x25e9f4(0x1a0))),console[_0x25e9f4(0x1e2)](_0x337b05[_0x25e9f4(0x180)](_0x25e9f4(0x20a))),console[_0x25e9f4(0x1e2)]();if(_0x337054[_0x25e9f4(0x186)]===0x0)return console[_0x25e9f4(0x1ef)](_0x25e9f4(0x1ff)),console[_0x25e9f4(0x1ef)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x55f625=_0x337054[0x0],_0x2cc0bf=_0x448fd8,_0x26cb75=_0x2cc0bf['name'],_0x78635c=_0x2cc0bf['dryRun'];try{if(!_0x78635c){const _0x2e1266=_0x5a1984[_0x25e9f4(0x1c8)][_0x25e9f4(0x1c0)](_0x55f625),_0x565a23=_0x26cb75||_0x2e1266[_0x25e9f4(0x199)]['projectName'],_0x100548=await withSpinner(_0x25e9f4(0x1ab),()=>_0x5a1984[_0x25e9f4(0x1c8)]['projects'](),{'verbose':_0x448fd8['verbose']}),_0x43ee5c=_0x100548[_0x25e9f4(0x195)]['find'](_0x3c6778=>_0x3c6778['attributes'][_0x25e9f4(0x223)]===_0x565a23);if(_0x43ee5c&&!_0x448fd8['yes']){const _0x112baa=await confirm(_0x25e9f4(0x1a9)+_0x565a23+_0x25e9f4(0x181));if(!_0x112baa)return console[_0x25e9f4(0x1e2)](_0x25e9f4(0x208)),0x0;}}const _0x109ea9=await withSpinner(_0x78635c?_0x25e9f4(0x1d9)+_0x55f625+_0x25e9f4(0x1e6):'Restoring\x20project\x20from\x20\x27'+_0x55f625+_0x25e9f4(0x1e6),()=>_0x5a1984[_0x25e9f4(0x1c8)]['restoreProject'](_0x55f625,{'name':_0x26cb75,'dryRun':_0x78635c}),{'verbose':_0x448fd8[_0x25e9f4(0x221)]}),_0x542784=_0x109ea9[_0x25e9f4(0x195)];return _0x542784[_0x25e9f4(0x1c3)]&&console[_0x25e9f4(0x1e2)](_0x25e9f4(0x1f2)+_0x542784[_0x25e9f4(0x1c3)]+'\x27'),_0x78635c?console[_0x25e9f4(0x1e2)](_0x25e9f4(0x230)+_0x542784[_0x25e9f4(0x1aa)]):console[_0x25e9f4(0x1e2)](_0x25e9f4(0x1a2)+_0x542784[_0x25e9f4(0x1aa)]+'\x20('+_0x542784['projectId']+')'),console[_0x25e9f4(0x1e2)]('\x20\x20Agents:\x20'+_0x542784[_0x25e9f4(0x193)]['agents']),console['log'](_0x25e9f4(0x18f)+_0x542784['counts'][_0x25e9f4(0x20c)]),console[_0x25e9f4(0x1e2)]('\x20\x20Prompts:\x20'+_0x542784[_0x25e9f4(0x193)][_0x25e9f4(0x188)]),console[_0x25e9f4(0x1e2)](_0x25e9f4(0x1b4)+_0x542784['counts'][_0x25e9f4(0x1cc)]),(_0x448fd8['format']===_0x25e9f4(0x22e)||_0x448fd8['format']===_0x25e9f4(0x23f))&&await handleSDKOutput([_0x542784],_0x448fd8),0x0;}catch(_0x55f0be){return handleSDKError(_0x55f0be,_0x448fd8),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x154731,_0x4b314c){const _0x420b1b=a20_0x72a90,_0x3f9c11=_0x4b314c[_0x420b1b(0x22c)]||CHAT_SELECTOR_PAGE_SIZE;let _0x1b31fc=0x0,_0x4a99d1=[];const _0xa36137=(await import(_0x420b1b(0x188)))['default'],_0x406882=getChalk(_0x4b314c);while(!![]){const _0x5a98c9=await withSpinner(_0x420b1b(0x17e),()=>_0x154731[_0x420b1b(0x1c8)][_0x420b1b(0x1fd)](_0x3f9c11+_0x1b31fc),{'verbose':_0x4b314c['verbose']});_0x4a99d1=_0x5a98c9[_0x420b1b(0x195)];const _0x562168=_0x4a99d1['slice'](_0x1b31fc,_0x1b31fc+_0x3f9c11),_0x3921c5=_0x4a99d1['length']>_0x1b31fc+_0x3f9c11,_0x37693b=[...new Set(_0x562168[_0x420b1b(0x1db)](_0x5d8e3f=>_0x5d8e3f[_0x420b1b(0x1c7)][_0x420b1b(0x237)])[_0x420b1b(0x21a)](_0x2e45f8=>_0x2e45f8!==undefined))],_0x409b4f=new Map();await Promise['all'](_0x37693b[_0x420b1b(0x1db)](async _0x102a7e=>{const _0x433a19=_0x420b1b;try{const _0x301856=await _0x154731['llm'][_0x433a19(0x198)](_0x102a7e);_0x409b4f[_0x433a19(0x16e)](_0x102a7e,_0x301856[_0x433a19(0x1c7)][_0x433a19(0x223)]);}catch{_0x409b4f[_0x433a19(0x16e)](_0x102a7e,_0x102a7e);}}));const _0x5bedc7=_0x562168['map'](_0x304699=>{const _0x1a8444=_0x420b1b,_0x5c83f1=_0x304699[_0x1a8444(0x1c7)]['firstInputContent']||'(no\x20message)',_0x2f3599=_0x5c83f1['split']('\x0a')[0x0],_0x3224b7=_0x2f3599['length']>0x50?_0x2f3599[_0x1a8444(0x219)](0x0,0x4d)+'...':_0x2f3599,_0x2667c6=_0x304699[_0x1a8444(0x1c7)][_0x1a8444(0x237)]?_0x409b4f[_0x1a8444(0x1eb)](_0x304699['attributes'][_0x1a8444(0x237)])||_0x304699[_0x1a8444(0x1c7)][_0x1a8444(0x237)]:_0x1a8444(0x214),_0x515b3b=_0x304699[_0x1a8444(0x1c7)][_0x1a8444(0x1f3)]||_0x304699['attributes'][_0x1a8444(0x1bb)],_0x2a3131=new Date(_0x515b3b),_0x46f488=new Date(),_0x43b4a7=_0x46f488[_0x1a8444(0x16d)]()-_0x2a3131['getTime'](),_0x1867e4=Math[_0x1a8444(0x1ea)](_0x43b4a7/0xea60),_0x2c4954=Math[_0x1a8444(0x1ea)](_0x43b4a7/0x36ee80),_0x4bc496=Math[_0x1a8444(0x1ea)](_0x43b4a7/0x5265c00);let _0x5627bd;if(_0x1867e4<0x1)_0x5627bd=_0x1a8444(0x1ee);else{if(_0x1867e4<0x3c)_0x5627bd=_0x1867e4+_0x1a8444(0x1ae);else{if(_0x2c4954<0x18)_0x5627bd=_0x2c4954+'h\x20ago';else _0x4bc496<0x7?_0x5627bd=_0x4bc496+_0x1a8444(0x185):_0x5627bd=_0x2a3131['toLocaleDateString'](_0x1a8444(0x16f),{'month':'short','day':_0x1a8444(0x1a8)});}}return{'title':_0x3224b7+'\x20'+_0x406882[_0x1a8444(0x180)]('['+_0x2667c6+']\x20'+_0x5627bd),'value':_0x304699['id']};});_0x3921c5&&_0x5bedc7[_0x420b1b(0x1bf)]({'title':_0x406882['cyan'](_0x420b1b(0x1da)),'value':_0x420b1b(0x1cf)});const _0x29ae12=await _0xa36137({'type':'select','name':_0x420b1b(0x1a5),'message':'Select\x20a\x20chat\x20session:','choices':_0x5bedc7,'hint':_0x420b1b(0x206)});if(!_0x29ae12[_0x420b1b(0x1a5)])return undefined;if(_0x29ae12[_0x420b1b(0x1a5)]===_0x420b1b(0x1cf)){_0x1b31fc+=_0x3f9c11;continue;}return _0x29ae12['chatId'];}}export class ChatsCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1fd);[a20_0x72a90(0x177)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a20_0x72a90(0x21b)](_0x361b8e){return executeChatHistoryCommand(_0x361b8e,'tdx\x20chats');}}export class LLMLogCommand extends BaseCommand{['name']=a20_0x72a90(0x183);[a20_0x72a90(0x177)]=a20_0x72a90(0x1d8);async['execute'](_0x6fd491){const _0xc9c475=a20_0x72a90,{options:_0x5d1742,args:_0x4b9322,tdx:_0x35bd79}=_0x6fd491,_0x16eed1=_0x4b9322[0x0];if(!_0x16eed1)return console[_0xc9c475(0x1ef)](_0xc9c475(0x23d)),console[_0xc9c475(0x1ef)](_0xc9c475(0x1f6)),0x1;const _0x288727=await withSpinner('Fetching\x20chat\x20log\x20for\x20\x27'+_0x16eed1+_0xc9c475(0x1e6),()=>_0x35bd79['llm'][_0xc9c475(0x23e)](_0x16eed1),{'verbose':_0x5d1742[_0xc9c475(0x221)]});return await handleSDKOutput(_0x288727[_0xc9c475(0x195)][_0xc9c475(0x195)],_0x5d1742),0x0;}}
@@ -1 +1 @@
1
- const a21_0x5adcf1=a21_0x4dca;(function(_0x2715dd,_0x41b25a){const _0x3b62c4=a21_0x4dca,_0x32e7e5=_0x2715dd();while(!![]){try{const _0x4539d7=parseInt(_0x3b62c4(0x1bc))/0x1+parseInt(_0x3b62c4(0x1c3))/0x2+-parseInt(_0x3b62c4(0x1bd))/0x3*(parseInt(_0x3b62c4(0x1b7))/0x4)+parseInt(_0x3b62c4(0x1b9))/0x5*(-parseInt(_0x3b62c4(0x1c7))/0x6)+parseInt(_0x3b62c4(0x1be))/0x7*(parseInt(_0x3b62c4(0x1c0))/0x8)+-parseInt(_0x3b62c4(0x1b4))/0x9+parseInt(_0x3b62c4(0x1b8))/0xa*(parseInt(_0x3b62c4(0x1b6))/0xb);if(_0x4539d7===_0x41b25a)break;else _0x32e7e5['push'](_0x32e7e5['shift']());}catch(_0x22f2cc){_0x32e7e5['push'](_0x32e7e5['shift']());}}}(a21_0x4074,0xc174d));import{BaseCommand}from'./command.js';function a21_0x4dca(_0x625ef1,_0x57139c){_0x625ef1=_0x625ef1-0x1b3;const _0x407469=a21_0x4074();let _0x4dca66=_0x407469[_0x625ef1];return _0x4dca66;}export class MCPCommand extends BaseCommand{[a21_0x5adcf1(0x1c4)]=a21_0x5adcf1(0x1ba);['description']=a21_0x5adcf1(0x1c5);async['execute'](_0x44d7e5){const _0xe261d5=a21_0x5adcf1,{tdx:_0x48a7cd}=_0x44d7e5,_0x8bfd2={};if(process.env.TDX_PROFILE)_0x8bfd2[_0xe261d5(0x1c2)]=process.env.TDX_PROFILE;else{if(process.env.TDX_API_KEY)_0x8bfd2[_0xe261d5(0x1b3)]=process.env.TDX_API_KEY,process.env.TDX_SITE&&(_0x8bfd2[_0xe261d5(0x1b5)]=process.env.TDX_SITE);else _0x48a7cd[_0xe261d5(0x1bb)]['apiKey']&&(_0x8bfd2['TDX_API_KEY']=_0x48a7cd[_0xe261d5(0x1bb)]['apiKey'],_0x8bfd2[_0xe261d5(0x1b5)]=_0x48a7cd['context']['site']);}_0x48a7cd[_0xe261d5(0x1bb)][_0xe261d5(0x1c6)]&&(_0x8bfd2['TDX_PROFILE']=_0x48a7cd[_0xe261d5(0x1bb)][_0xe261d5(0x1c6)]);try{const {startMCPServer:_0x436ae1}=await import('../mcp/server.js');return await _0x436ae1({'env':_0x8bfd2}),0x0;}catch(_0x432446){const _0x3e1345=_0x432446 instanceof Error?_0x432446['message']:String(_0x432446);return console[_0xe261d5(0x1c1)](_0xe261d5(0x1bf)+_0x3e1345),0x1;}}}function a21_0x4074(){const _0x346926=['3RcxnRC','7nERspN','MCP\x20server\x20error:\x20','2134368jJzeBB','error','TDX_PROFILE','1237686BLcquo','name','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','profile','478164JMGzyh','TDX_API_KEY','6384321bjtDog','TDX_SITE','33dhyyiP','5886760UTuwiS','7122270sIMqHQ','85NUpZyZ','mcp','context','1305934tJFrPM'];a21_0x4074=function(){return _0x346926;};return a21_0x4074();}
1
+ function a21_0x205b(_0x1e352e,_0x140530){_0x1e352e=_0x1e352e-0xfc;const _0x2baefe=a21_0x2bae();let _0x205b98=_0x2baefe[_0x1e352e];return _0x205b98;}const a21_0x2150b4=a21_0x205b;(function(_0x5289f4,_0x318d66){const _0x2118d5=a21_0x205b,_0x4b3774=_0x5289f4();while(!![]){try{const _0x148ae7=-parseInt(_0x2118d5(0x107))/0x1+-parseInt(_0x2118d5(0x101))/0x2+parseInt(_0x2118d5(0x10d))/0x3+-parseInt(_0x2118d5(0xfd))/0x4*(-parseInt(_0x2118d5(0x111))/0x5)+parseInt(_0x2118d5(0x108))/0x6*(parseInt(_0x2118d5(0xfe))/0x7)+-parseInt(_0x2118d5(0x102))/0x8*(-parseInt(_0x2118d5(0xfc))/0x9)+-parseInt(_0x2118d5(0x105))/0xa*(parseInt(_0x2118d5(0x10a))/0xb);if(_0x148ae7===_0x318d66)break;else _0x4b3774['push'](_0x4b3774['shift']());}catch(_0x2268a6){_0x4b3774['push'](_0x4b3774['shift']());}}}(a21_0x2bae,0xb48b9));function a21_0x2bae(){const _0x2b7ddc=['error','10ORCMdX','name','1377209ApTDAF','237174XuZfQI','../mcp/server.js','11556886RFKIGU','TDX_SITE','TDX_PROFILE','3238986MeRcWz','execute','apiKey','mcp','2360JcEgUW','site','profile','27fwWOzk','4868yjgZQq','189eZBSFT','MCP\x20server\x20error:\x20','TDX_API_KEY','1773854tzKUGB','3554416FLUNAd','context'];a21_0x2bae=function(){return _0x2b7ddc;};return a21_0x2bae();}import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{[a21_0x2150b4(0x106)]=a21_0x2150b4(0x110);['description']='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async[a21_0x2150b4(0x10e)](_0x37625a){const _0x3d1d5e=a21_0x2150b4,{tdx:_0x3d0b55}=_0x37625a,_0x2a95e6={};if(process.env.TDX_PROFILE)_0x2a95e6[_0x3d1d5e(0x10c)]=process.env.TDX_PROFILE;else{if(process.env.TDX_API_KEY)_0x2a95e6[_0x3d1d5e(0x100)]=process.env.TDX_API_KEY,process.env.TDX_SITE&&(_0x2a95e6['TDX_SITE']=process.env.TDX_SITE);else _0x3d0b55[_0x3d1d5e(0x103)][_0x3d1d5e(0x10f)]&&(_0x2a95e6[_0x3d1d5e(0x100)]=_0x3d0b55[_0x3d1d5e(0x103)][_0x3d1d5e(0x10f)],_0x2a95e6[_0x3d1d5e(0x10b)]=_0x3d0b55['context'][_0x3d1d5e(0x112)]);}_0x3d0b55[_0x3d1d5e(0x103)][_0x3d1d5e(0x113)]&&(_0x2a95e6[_0x3d1d5e(0x10c)]=_0x3d0b55['context'][_0x3d1d5e(0x113)]);try{const {startMCPServer:_0x69a351}=await import(_0x3d1d5e(0x109));return await _0x69a351({'env':_0x2a95e6}),0x0;}catch(_0x8a3d67){const _0x1708c9=_0x8a3d67 instanceof Error?_0x8a3d67['message']:String(_0x8a3d67);return console[_0x3d1d5e(0x104)](_0x3d1d5e(0xff)+_0x1708c9),0x1;}}}