@treasuredata/tdx 0.8.6 → 0.8.8

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 (116) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.d.ts.map +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-command.js.map +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/context-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/llm-proxy.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/segment-command.js +1 -1
  36. package/dist/commands/segment-create-command.js +1 -1
  37. package/dist/commands/segment-fields-command.js +1 -1
  38. package/dist/commands/segment-pull-command.js +1 -1
  39. package/dist/commands/segment-push-command.js +1 -1
  40. package/dist/commands/segment-update-command.js +1 -1
  41. package/dist/commands/segment-use-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/use-command.js +1 -1
  46. package/dist/commands/user-command.js +1 -1
  47. package/dist/commands/workflow-command.js +1 -1
  48. package/dist/core/auth.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/credential-cache.js +1 -1
  52. package/dist/core/global-context.js +1 -1
  53. package/dist/core/keychain.js +1 -1
  54. package/dist/core/profile.js +1 -1
  55. package/dist/core/project-config.js +1 -1
  56. package/dist/core/session.js +1 -1
  57. package/dist/core/user-cache.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/proxy/anthropic-adapter.js +1 -1
  60. package/dist/proxy/claude-usage-tracker.js +1 -1
  61. package/dist/proxy/context-signature.js +1 -1
  62. package/dist/proxy/conversation-utils.js +1 -1
  63. package/dist/proxy/server.js +1 -1
  64. package/dist/proxy/session-cache.js +1 -1
  65. package/dist/sdk/api.js +1 -1
  66. package/dist/sdk/connection.js +1 -1
  67. package/dist/sdk/engage.js +1 -1
  68. package/dist/sdk/errors.js +1 -1
  69. package/dist/sdk/index.js +1 -1
  70. package/dist/sdk/job.js +1 -1
  71. package/dist/sdk/journey.js +1 -1
  72. package/dist/sdk/llm.js +1 -1
  73. package/dist/sdk/query.js +1 -1
  74. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  75. package/dist/sdk/segment/journey-yaml.js +1 -1
  76. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  77. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  78. package/dist/sdk/segment.js +1 -1
  79. package/dist/sdk/user.js +1 -1
  80. package/dist/sdk/workflow.js +1 -1
  81. package/dist/types/endpoints.js +1 -1
  82. package/dist/types/index.js +1 -1
  83. package/dist/utils/agent-ref-parser.js +1 -1
  84. package/dist/utils/async.js +1 -1
  85. package/dist/utils/chat-cache.js +1 -1
  86. package/dist/utils/colors.js +1 -1
  87. package/dist/utils/command-output.js +1 -1
  88. package/dist/utils/constants.js +1 -1
  89. package/dist/utils/diff.js +1 -1
  90. package/dist/utils/fields-display.js +1 -1
  91. package/dist/utils/file-permissions.js +1 -1
  92. package/dist/utils/format-detector.js +1 -1
  93. package/dist/utils/formatters.js +1 -1
  94. package/dist/utils/json-loader.js +1 -1
  95. package/dist/utils/llm-backup-utils.js +1 -1
  96. package/dist/utils/model-aliases.js +1 -1
  97. package/dist/utils/model-factors.js +1 -1
  98. package/dist/utils/option-validation.js +1 -1
  99. package/dist/utils/port.js +1 -1
  100. package/dist/utils/process.d.ts.map +1 -1
  101. package/dist/utils/process.js +1 -1
  102. package/dist/utils/process.js.map +1 -1
  103. package/dist/utils/prompt.js +1 -1
  104. package/dist/utils/segment-path-parser.js +1 -1
  105. package/dist/utils/segment-ref-parser.js +1 -1
  106. package/dist/utils/spinner.js +1 -1
  107. package/dist/utils/sql-parser.js +1 -1
  108. package/dist/utils/sse-parser.js +1 -1
  109. package/dist/utils/string-utils.js +1 -1
  110. package/dist/utils/table-ref-parser.js +1 -1
  111. package/dist/utils/tdx-config.js +1 -1
  112. package/dist/utils/tdx-logger.js +1 -1
  113. package/dist/utils/tree-formatter.js +1 -1
  114. package/dist/utils/version-check.js +1 -1
  115. package/dist/utils/workflow-utils.js +1 -1
  116. package/package.json +1 -1
@@ -1 +1 @@
1
- const a21_0x35779a=a21_0x3e5c;(function(_0xf192ae,_0x36a33f){const _0x23acb1=a21_0x3e5c,_0x50b9b0=_0xf192ae();while(!![]){try{const _0x578326=parseInt(_0x23acb1(0x1a2))/0x1+parseInt(_0x23acb1(0x1af))/0x2*(-parseInt(_0x23acb1(0x1a9))/0x3)+-parseInt(_0x23acb1(0x1a0))/0x4*(parseInt(_0x23acb1(0x1a8))/0x5)+-parseInt(_0x23acb1(0x19b))/0x6+-parseInt(_0x23acb1(0x1b1))/0x7*(-parseInt(_0x23acb1(0x19d))/0x8)+parseInt(_0x23acb1(0x1a1))/0x9+parseInt(_0x23acb1(0x19a))/0xa;if(_0x578326===_0x36a33f)break;else _0x50b9b0['push'](_0x50b9b0['shift']());}catch(_0x36b89d){_0x50b9b0['push'](_0x50b9b0['shift']());}}}(a21_0x3fc8,0x36341));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a21_0x3fc8(){const _0x5e68b2=['961429mZvBKT','description','site','1258790YGODjr','430260tlXtDc','Pattern:\x20','8ThMAaB','databases','data','4CXrEBp','1054035zlKdiG','295295JxIxLZ','error','cause','message','length','execute','923060gmsdtr','591891hqMgJQ','Error:\x20','✔\x20Found\x20','\x20\x20Cause:\x20','verbose','List\x20all\x20databases','2birEPk','Site:\x20'];a21_0x3fc8=function(){return _0x5e68b2;};return a21_0x3fc8();}import{withSpinner}from'../utils/spinner.js';function a21_0x3e5c(_0x2819dc,_0x5a5012){_0x2819dc=_0x2819dc-0x19a;const _0x3fc89e=a21_0x3fc8();let _0x3e5c94=_0x3fc89e[_0x2819dc];return _0x3e5c94;}import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';export class DatabasesCommand extends BaseCommand{['name']=a21_0x35779a(0x19e);[a21_0x35779a(0x1b2)]=a21_0x35779a(0x1ae);async[a21_0x35779a(0x1a7)](_0x432611){const _0x5a93f9=a21_0x35779a,{options:_0x5b56bb,args:_0x44cc57,tdx:_0x39b71b}=_0x432611,_0x57946d=_0x44cc57[0x0];try{_0x5b56bb[_0x5a93f9(0x1ad)]&&(console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1b0)+_0x5b56bb[_0x5a93f9(0x1b3)]),_0x57946d&&console[_0x5a93f9(0x1a3)](_0x5a93f9(0x19c)+_0x57946d));const _0x25541b=resolveLimit(_0x5b56bb['limit'],DEFAULT_LISTING_LIMIT),_0x293c0a=await withSpinner('Listing\x20databases...',()=>_0x39b71b['query']['listDatabases'](_0x57946d,_0x25541b),{'verbose':_0x5b56bb[_0x5a93f9(0x1ad)]}),_0x3ca71c=_0x293c0a[_0x5a93f9(0x19f)];return console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1ab)+_0x3ca71c[_0x5a93f9(0x1a6)]+'\x20database'+(_0x3ca71c[_0x5a93f9(0x1a6)]!==0x1?'s':'')),await handleSDKOutput(_0x3ca71c,{..._0x5b56bb,'limit':_0x25541b}),0x0;}catch(_0x45e0b3){if(_0x45e0b3 instanceof SDKError)return console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1aa)+_0x45e0b3[_0x5a93f9(0x1a5)]),_0x45e0b3[_0x5a93f9(0x1a4)]&&console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1ac)+_0x45e0b3[_0x5a93f9(0x1a4)]),0x1;throw _0x45e0b3;}}}
1
+ const a21_0x364ba2=a21_0x558e;(function(_0x36477f,_0x5642c5){const _0x2d3f1a=a21_0x558e,_0xc8e657=_0x36477f();while(!![]){try{const _0x2184b8=parseInt(_0x2d3f1a(0x1c3))/0x1*(parseInt(_0x2d3f1a(0x1cc))/0x2)+parseInt(_0x2d3f1a(0x1bf))/0x3*(parseInt(_0x2d3f1a(0x1c0))/0x4)+parseInt(_0x2d3f1a(0x1c1))/0x5+-parseInt(_0x2d3f1a(0x1c8))/0x6+parseInt(_0x2d3f1a(0x1cd))/0x7+-parseInt(_0x2d3f1a(0x1c9))/0x8*(-parseInt(_0x2d3f1a(0x1d0))/0x9)+-parseInt(_0x2d3f1a(0x1d3))/0xa;if(_0x2184b8===_0x5642c5)break;else _0xc8e657['push'](_0xc8e657['shift']());}catch(_0x37e2d1){_0xc8e657['push'](_0xc8e657['shift']());}}}(a21_0x5469,0xd3d47));function a21_0x5469(){const _0x2161b8=['databases','limit','37599390zbxMnn','\x20database','data','Site:\x20','Error:\x20','Listing\x20databases...','execute','9rpoEXR','2151260OPnIDd','8180795eiAMlr','cause','8JmyRwa','✔\x20Found\x20','description','List\x20all\x20databases','verbose','2621442dSmyOy','56eGNtAR','Pattern:\x20','query','187678IsGRUj','77784jkJADd','length','error','1353951qRiLJO'];a21_0x5469=function(){return _0x2161b8;};return a21_0x5469();}function a21_0x558e(_0x20cd05,_0x41e4bc){_0x20cd05=_0x20cd05-0x1bf;const _0x54693f=a21_0x5469();let _0x558ecb=_0x54693f[_0x20cd05];return _0x558ecb;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';export class DatabasesCommand extends BaseCommand{['name']=a21_0x364ba2(0x1d1);[a21_0x364ba2(0x1c5)]=a21_0x364ba2(0x1c6);async[a21_0x364ba2(0x1d9)](_0x1d6b2d){const _0x3ad6db=a21_0x364ba2,{options:_0x2378ec,args:_0x2d2bd2,tdx:_0x3084b3}=_0x1d6b2d,_0x58d5b9=_0x2d2bd2[0x0];try{_0x2378ec['verbose']&&(console[_0x3ad6db(0x1cf)](_0x3ad6db(0x1d6)+_0x2378ec['site']),_0x58d5b9&&console['error'](_0x3ad6db(0x1ca)+_0x58d5b9));const _0x45d05d=resolveLimit(_0x2378ec[_0x3ad6db(0x1d2)],DEFAULT_LISTING_LIMIT),_0x3632a4=await withSpinner(_0x3ad6db(0x1d8),()=>_0x3084b3[_0x3ad6db(0x1cb)]['listDatabases'](_0x58d5b9,_0x45d05d),{'verbose':_0x2378ec[_0x3ad6db(0x1c7)]}),_0x36702a=_0x3632a4[_0x3ad6db(0x1d5)];return console['error'](_0x3ad6db(0x1c4)+_0x36702a[_0x3ad6db(0x1ce)]+_0x3ad6db(0x1d4)+(_0x36702a[_0x3ad6db(0x1ce)]!==0x1?'s':'')),await handleSDKOutput(_0x36702a,{..._0x2378ec,'limit':_0x45d05d}),0x0;}catch(_0x541bca){if(_0x541bca instanceof SDKError)return console[_0x3ad6db(0x1cf)](_0x3ad6db(0x1d7)+_0x541bca['message']),_0x541bca[_0x3ad6db(0x1c2)]&&console[_0x3ad6db(0x1cf)]('\x20\x20Cause:\x20'+_0x541bca[_0x3ad6db(0x1c2)]),0x1;throw _0x541bca;}}}
@@ -1 +1 @@
1
- const a22_0x9f6c42=a22_0x2e77;(function(_0xf714e9,_0x232484){const _0x21d297=a22_0x2e77,_0x233a27=_0xf714e9();while(!![]){try{const _0x42fa55=-parseInt(_0x21d297(0x143))/0x1*(parseInt(_0x21d297(0x150))/0x2)+parseInt(_0x21d297(0x141))/0x3+-parseInt(_0x21d297(0x142))/0x4+-parseInt(_0x21d297(0x133))/0x5+-parseInt(_0x21d297(0x13b))/0x6*(-parseInt(_0x21d297(0x153))/0x7)+parseInt(_0x21d297(0x138))/0x8+-parseInt(_0x21d297(0x13a))/0x9*(parseInt(_0x21d297(0x14a))/0xa);if(_0x42fa55===_0x232484)break;else _0x233a27['push'](_0x233a27['shift']());}catch(_0x4ce8b1){_0x233a27['push'](_0x233a27['shift']());}}}(a22_0x4b6d,0x4ad2b));import{BaseCommand}from'./command.js';function a22_0x2e77(_0x5b10df,_0x1c8c2c){_0x5b10df=_0x5b10df-0x133;const _0x4b6d0b=a22_0x4b6d();let _0x2e7780=_0x4b6d0b[_0x5b10df];return _0x2e7780;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';function a22_0x4b6d(){const _0x492db7=['Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','\x27\x20does\x20not\x20exist','816789SqOoRV','375880opOMAN','152seJXfK','Table:\x20','data','site','length','describeTable','\x20\x20Cause:\x20','20RoyquG','Error:\x20','✖\x20Table\x20not\x20found','error','\x20in\x20','Describe\x20table\x20schema','2512MbLeCv','Table\x20\x27','database','2965928yurKwC','verbose','cause','378935rFinTP','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','message','...','execute','4744248oUdWtd','Database:\x20','2798343Dgplbm','6kejbXH','table','args','name'];a22_0x4b6d=function(){return _0x492db7;};return a22_0x4b6d();}import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a22_0x9f6c42(0x13e)]='describe';['description']=a22_0x9f6c42(0x14f);async[a22_0x9f6c42(0x137)](_0x3c9542){return this['describeTable'](_0x3c9542);}async[a22_0x9f6c42(0x148)](_0x19927e){const _0x441de7=a22_0x9f6c42,{options:_0x43368b,args:_0x39edff,tdx:_0x3cfe42}=_0x19927e;let _0x126a32;try{_0x126a32=parseTableReference(_0x39edff[0x0]);const _0x1f670a=_0x43368b[_0x441de7(0x152)];!_0x126a32[_0x441de7(0x152)]&&_0x1f670a&&(_0x126a32[_0x441de7(0x152)]=_0x1f670a);const _0x3e6db1=validateTableDescribeReference(_0x126a32);if(_0x3e6db1)return console[_0x441de7(0x14d)](_0x441de7(0x14b)+_0x3e6db1),0x1;}catch(_0x4c78f9){return console[_0x441de7(0x14d)](_0x441de7(0x14b)+_0x4c78f9['message']),0x1;}const _0x27ba7e=_0x126a32[_0x441de7(0x152)],_0x205021=_0x126a32[_0x441de7(0x13c)];try{_0x43368b['verbose']&&(console[_0x441de7(0x14d)]('Site:\x20'+_0x43368b[_0x441de7(0x146)]),console[_0x441de7(0x14d)](_0x441de7(0x139)+_0x27ba7e),console[_0x441de7(0x14d)](_0x441de7(0x144)+_0x205021));const _0x3062a6=await withSpinner('Describing\x20table\x20'+_0x27ba7e+'.'+_0x205021+_0x441de7(0x136),()=>_0x3cfe42['query']['describeTable'](_0x27ba7e,_0x205021),{'verbose':_0x43368b[_0x441de7(0x154)]}),_0x556d1b=_0x3062a6[_0x441de7(0x145)];if(_0x556d1b[_0x441de7(0x147)]===0x0)return console[_0x441de7(0x14d)](_0x441de7(0x14c)),console[_0x441de7(0x14d)](_0x441de7(0x151)+_0x27ba7e+'.'+_0x205021+_0x441de7(0x140)),0x1;return console['error']('✔\x20Found\x20'+_0x556d1b[_0x441de7(0x147)]+'\x20column'+(_0x556d1b[_0x441de7(0x147)]!==0x1?'s':'')+_0x441de7(0x14e)+_0x27ba7e+'.'+_0x205021),await handleSDKOutput(_0x556d1b,_0x43368b),0x0;}catch(_0x46f0b6){if(_0x46f0b6 instanceof SDKError)return console[_0x441de7(0x14d)](_0x441de7(0x14b)+_0x46f0b6[_0x441de7(0x135)]),_0x46f0b6[_0x441de7(0x155)]&&console[_0x441de7(0x14d)](_0x441de7(0x149)+_0x46f0b6[_0x441de7(0x155)]),0x1;throw _0x46f0b6;}}['validate'](_0x3171e9){const _0x23c5dc=a22_0x9f6c42;if(_0x3171e9[_0x23c5dc(0x13d)]['length']===0x0)return _0x23c5dc(0x13f);if(_0x3171e9[_0x23c5dc(0x13d)][_0x23c5dc(0x147)]>0x1)return _0x23c5dc(0x134);return undefined;}}
1
+ const a22_0x5169ec=a22_0x4297;(function(_0x302b35,_0x35fed5){const _0xe039ae=a22_0x4297,_0x36e995=_0x302b35();while(!![]){try{const _0x4cf638=-parseInt(_0xe039ae(0x9e))/0x1+-parseInt(_0xe039ae(0xad))/0x2*(parseInt(_0xe039ae(0x99))/0x3)+parseInt(_0xe039ae(0xb6))/0x4*(-parseInt(_0xe039ae(0xae))/0x5)+-parseInt(_0xe039ae(0x8f))/0x6*(parseInt(_0xe039ae(0x9f))/0x7)+-parseInt(_0xe039ae(0x94))/0x8+-parseInt(_0xe039ae(0x8e))/0x9*(parseInt(_0xe039ae(0xb1))/0xa)+parseInt(_0xe039ae(0xa9))/0xb*(parseInt(_0xe039ae(0xb7))/0xc);if(_0x4cf638===_0x35fed5)break;else _0x36e995['push'](_0x36e995['shift']());}catch(_0x588de4){_0x36e995['push'](_0x36e995['shift']());}}}(a22_0x329d,0xb6cfa));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';function a22_0x4297(_0x393d80,_0x1f6b96){_0x393d80=_0x393d80-0x8e;const _0x329dd8=a22_0x329d();let _0x4297ab=_0x329dd8[_0x393d80];return _0x4297ab;}function a22_0x329d(){const _0xcc2175=['8800897yeiHcH','Site:\x20','\x20column','description','✔\x20Found\x20','execute','name','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','\x27\x20does\x20not\x20exist','verbose','187oizWpB','describe','length','Database:\x20','1096RkhFwM','45IGMyKl','query','site','102710JejBGU','Table:\x20','validate','error','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','214700MHTLiQ','3687888RgpMtr','1152GHKoDl','6UGvCnn','...','cause','args','Describing\x20table\x20','7431304fRBMXh','database','Error:\x20','\x20\x20Cause:\x20','message','720RkbhxY','Table\x20\x27','describeTable','✖\x20Table\x20not\x20found','table','360247IRmpDj'];a22_0x329d=function(){return _0xcc2175;};return a22_0x329d();}export class DescribeCommand extends BaseCommand{[a22_0x5169ec(0xa5)]=a22_0x5169ec(0xaa);[a22_0x5169ec(0xa2)]='Describe\x20table\x20schema';async[a22_0x5169ec(0xa4)](_0x204be9){const _0x5c3c9a=a22_0x5169ec;return this[_0x5c3c9a(0x9b)](_0x204be9);}async[a22_0x5169ec(0x9b)](_0x4657b6){const _0x246d76=a22_0x5169ec,{options:_0x32cc16,args:_0x1065c6,tdx:_0x4d18d7}=_0x4657b6;let _0x30ac38;try{_0x30ac38=parseTableReference(_0x1065c6[0x0]);const _0x6c2a47=_0x32cc16[_0x246d76(0x95)];!_0x30ac38['database']&&_0x6c2a47&&(_0x30ac38['database']=_0x6c2a47);const _0x194a87=validateTableDescribeReference(_0x30ac38);if(_0x194a87)return console[_0x246d76(0xb4)](_0x246d76(0x96)+_0x194a87),0x1;}catch(_0x250042){return console['error'](_0x246d76(0x96)+_0x250042[_0x246d76(0x98)]),0x1;}const _0x9153e1=_0x30ac38[_0x246d76(0x95)],_0x2a27d8=_0x30ac38[_0x246d76(0x9d)];try{_0x32cc16[_0x246d76(0xa8)]&&(console[_0x246d76(0xb4)](_0x246d76(0xa0)+_0x32cc16[_0x246d76(0xb0)]),console[_0x246d76(0xb4)](_0x246d76(0xac)+_0x9153e1),console[_0x246d76(0xb4)](_0x246d76(0xb2)+_0x2a27d8));const _0xe57f3c=await withSpinner(_0x246d76(0x93)+_0x9153e1+'.'+_0x2a27d8+_0x246d76(0x90),()=>_0x4d18d7[_0x246d76(0xaf)][_0x246d76(0x9b)](_0x9153e1,_0x2a27d8),{'verbose':_0x32cc16[_0x246d76(0xa8)]}),_0x1653e7=_0xe57f3c['data'];if(_0x1653e7[_0x246d76(0xab)]===0x0)return console['error'](_0x246d76(0x9c)),console['error'](_0x246d76(0x9a)+_0x9153e1+'.'+_0x2a27d8+_0x246d76(0xa7)),0x1;return console[_0x246d76(0xb4)](_0x246d76(0xa3)+_0x1653e7[_0x246d76(0xab)]+_0x246d76(0xa1)+(_0x1653e7[_0x246d76(0xab)]!==0x1?'s':'')+'\x20in\x20'+_0x9153e1+'.'+_0x2a27d8),await handleSDKOutput(_0x1653e7,_0x32cc16),0x0;}catch(_0x16a49f){if(_0x16a49f instanceof SDKError)return console[_0x246d76(0xb4)](_0x246d76(0x96)+_0x16a49f[_0x246d76(0x98)]),_0x16a49f[_0x246d76(0x91)]&&console[_0x246d76(0xb4)](_0x246d76(0x97)+_0x16a49f[_0x246d76(0x91)]),0x1;throw _0x16a49f;}}[a22_0x5169ec(0xb3)](_0x12a298){const _0x349aa0=a22_0x5169ec;if(_0x12a298['args'][_0x349aa0(0xab)]===0x0)return _0x349aa0(0xa6);if(_0x12a298[_0x349aa0(0x92)][_0x349aa0(0xab)]>0x1)return _0x349aa0(0xb5);return undefined;}}
@@ -1 +1 @@
1
- const a23_0xfe851f=a23_0x4a10;(function(_0x474033,_0x43a87c){const _0x38e345=a23_0x4a10,_0x348356=_0x474033();while(!![]){try{const _0x30ef87=parseInt(_0x38e345(0x1ff))/0x1+-parseInt(_0x38e345(0x1ea))/0x2+parseInt(_0x38e345(0x1f2))/0x3*(-parseInt(_0x38e345(0x1fc))/0x4)+parseInt(_0x38e345(0x1e5))/0x5*(parseInt(_0x38e345(0x1a9))/0x6)+parseInt(_0x38e345(0x20c))/0x7*(-parseInt(_0x38e345(0x1c2))/0x8)+parseInt(_0x38e345(0x183))/0x9+-parseInt(_0x38e345(0x1a7))/0xa*(-parseInt(_0x38e345(0x18f))/0xb);if(_0x30ef87===_0x43a87c)break;else _0x348356['push'](_0x348356['shift']());}catch(_0x4bcc94){_0x348356['push'](_0x348356['shift']());}}}(a23_0x30a6,0xbf831));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x1e05cf,_0x29b856,_0x3c01d8=![]){const _0x174e5d=a23_0x4a10;if(_0x1e05cf[_0x174e5d(0x184)])return await _0x29b856[_0x174e5d(0x208)][_0x174e5d(0x1c9)](_0x1e05cf[_0x174e5d(0x184)]);const _0x18959a=loadSessionContext(_0x1e05cf[_0x174e5d(0x175)]);if(_0x18959a?.[_0x174e5d(0x1f7)])return await _0x29b856[_0x174e5d(0x208)][_0x174e5d(0x1c9)](_0x18959a['engage_workspace']);if(_0x3c01d8)throw new SDKError(ErrorCode[_0x174e5d(0x193)],_0x174e5d(0x1f4),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x149fc7,_0x51ad0c){const _0x21d9f4=a23_0x4a10;if(!_0x149fc7[_0x21d9f4(0x1de)])return{};const _0x1631dd=_0x149fc7[_0x21d9f4(0x1de)],_0x2f4fa1=await _0x51ad0c[_0x21d9f4(0x1de)][_0x21d9f4(0x1cb)](_0x1631dd);return{'audienceId':_0x2f4fa1[_0x21d9f4(0x1d0)],'audienceName':_0x2f4fa1[_0x21d9f4(0x1ce)],..._0x2f4fa1['segmentId']&&{'segmentId':_0x2f4fa1[_0x21d9f4(0x1d6)],'segmentName':_0x2f4fa1[_0x21d9f4(0x1c8)]}};}function buildConnectorConfig(_0xf4d11){const _0x5db7d3=a23_0x4a10,_0x4c76d4=_0xf4d11[_0x5db7d3(0x1bd)],_0x38a279=_0xf4d11[_0x5db7d3(0x1d4)];if(!_0x4c76d4&&!_0x38a279)return undefined;return{..._0x4c76d4&&{'emailSenderId':_0x4c76d4},..._0x38a279&&{'jsonColumns':_0x38a279}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x198);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ae);async[a23_0xfe851f(0x181)](_0x3c1f92){const _0x4d0d7e=a23_0xfe851f,{options:_0x123beb,args:_0x41f9e6,tdx:_0x1c4042}=_0x3c1f92,_0x596af2=_0x41f9e6[0x0],_0x40812c=resolveLimit(_0x123beb[_0x4d0d7e(0x186)],DEFAULT_LLM_LIMIT),_0x13ec93=_0x123beb,_0x29eaf8=_0x13ec93[_0x4d0d7e(0x1b1)],_0x35febb=_0x13ec93[_0x4d0d7e(0x1a0)],_0x1f1de5=await resolveWorkspaceIdFromOptions(_0x13ec93,_0x1c4042),_0x463432=await withSpinner(_0x4d0d7e(0x187),()=>_0x1c4042[_0x4d0d7e(0x208)][_0x4d0d7e(0x1f9)]({'type':_0x29eaf8,'status':_0x35febb,'workspaceId':_0x1f1de5,'limit':_0x40812c}),{'verbose':_0x123beb[_0x4d0d7e(0x1e9)]});let _0x1c6e09=_0x463432[_0x4d0d7e(0x1bb)];return _0x596af2&&(_0x1c6e09=_0x463432[_0x4d0d7e(0x1bb)]['filter'](_0x64ebc2=>matchGlobPattern(_0x64ebc2[_0x4d0d7e(0x1e3)],_0x596af2))),await handleSDKOutput(_0x1c6e09,_0x123beb),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']='engage:campaign:show';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x189);async[a23_0xfe851f(0x181)](_0x1c7c50){const _0x30a382=a23_0xfe851f,{options:_0x48927c,args:_0x7cf4d4,tdx:_0x200a33}=_0x1c7c50;if(_0x7cf4d4[_0x30a382(0x1ad)]===0x0)return console[_0x30a382(0x17f)](_0x30a382(0x1a1)),console[_0x30a382(0x17f)](_0x30a382(0x202)),0x1;const _0x4406ba=_0x7cf4d4[0x0],_0x3dae08=_0x48927c,_0x10d6b9=await resolveWorkspaceIdFromOptions(_0x3dae08,_0x200a33),_0x5be8e1=_0x3dae08[_0x30a382(0x1d2)];if(_0x5be8e1){const _0x4c1394=await withSpinner(_0x30a382(0x17d)+_0x4406ba+_0x30a382(0x177),()=>_0x200a33[_0x30a382(0x208)][_0x30a382(0x17e)](_0x4406ba,_0x10d6b9),{'verbose':_0x48927c['verbose']});await handleSDKOutput([_0x4c1394],_0x48927c);}else{const _0x44ffde=await withSpinner(_0x30a382(0x17d)+_0x4406ba+_0x30a382(0x177),()=>_0x200a33['engage'][_0x30a382(0x207)](_0x4406ba,_0x10d6b9),{'verbose':_0x48927c[_0x30a382(0x1e9)]});await handleSDKOutput([_0x44ffde],_0x48927c);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x205);['description']=a23_0xfe851f(0x1b2);async['execute'](_0x5c26fe){const _0x17b13a=a23_0xfe851f,{options:_0x23fe74,tdx:_0x48d3e5}=_0x5c26fe,_0x5b0166=_0x23fe74,_0x995946=_0x5b0166[_0x17b13a(0x1e3)],_0x4c90e2=_0x5b0166[_0x17b13a(0x1b1)];if(!_0x995946)return console[_0x17b13a(0x17f)](_0x17b13a(0x1d9)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x4c90e2)return console[_0x17b13a(0x17f)]('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x17b13a(0x17f)](_0x17b13a(0x179)),0x1;const _0x3c3e80=await resolveWorkspaceIdFromOptions(_0x5b0166,_0x48d3e5,!![]),_0x1f3757=await resolveSegmentFromOptions(_0x5b0166,_0x48d3e5),_0x56b3a7=buildConnectorConfig(_0x5b0166),_0x22f3bb={'name':_0x995946,'campaignType':_0x4c90e2,'workspaceId':_0x3c3e80,'description':_0x5b0166[_0x17b13a(0x1e0)],..._0x1f3757,'connectorConfig':_0x56b3a7,'startAt':_0x5b0166[_0x17b13a(0x19a)],'timezone':_0x5b0166[_0x17b13a(0x197)]},_0x327015=await withSpinner(_0x17b13a(0x192)+_0x995946+_0x17b13a(0x177),()=>_0x48d3e5[_0x17b13a(0x208)][_0x17b13a(0x1b6)](_0x22f3bb));return await handleSDKOutput([_0x327015[_0x17b13a(0x1bb)]],_0x23fe74),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1db);['description']=a23_0xfe851f(0x1e2);async[a23_0xfe851f(0x181)](_0x4b8c0c){const _0x1d060c=a23_0xfe851f,{options:_0x501f36,args:_0x5cf2ab,tdx:_0x158e9d}=_0x4b8c0c;if(_0x5cf2ab[_0x1d060c(0x1ad)]===0x0)return console['error'](_0x1d060c(0x1a1)),console[_0x1d060c(0x17f)](_0x1d060c(0x1fd)),0x1;const _0x7bcee1=_0x5cf2ab[0x0],_0x257c24=_0x501f36,_0xff331f=await resolveWorkspaceIdFromOptions(_0x257c24,_0x158e9d),_0x844fbd=await resolveSegmentFromOptions(_0x257c24,_0x158e9d),_0x316c80=buildConnectorConfig(_0x257c24),_0x3bd4d0={'name':_0x257c24['name'],'description':_0x257c24[_0x1d060c(0x1e0)],..._0x844fbd,'connectorConfig':_0x316c80,'startAt':_0x257c24[_0x1d060c(0x19a)],'timezone':_0x257c24[_0x1d060c(0x197)]},_0x8c15da=Object['fromEntries'](Object[_0x1d060c(0x1c1)](_0x3bd4d0)[_0x1d060c(0x209)](([,_0x4747c3])=>_0x4747c3!==undefined));if(Object[_0x1d060c(0x188)](_0x8c15da)['length']===0x0)return console[_0x1d060c(0x17f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x1d060c(0x17f)](_0x1d060c(0x1be)),0x1;const _0x332169=await withSpinner(_0x1d060c(0x18d)+_0x7bcee1+_0x1d060c(0x177),()=>_0x158e9d[_0x1d060c(0x208)][_0x1d060c(0x1b4)](_0x7bcee1,_0x8c15da,_0xff331f),{'verbose':_0x501f36[_0x1d060c(0x1e9)]});return await handleSDKOutput([_0x332169['data']],_0x501f36),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1dc);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1b3);async[a23_0xfe851f(0x181)](_0x4c4de4){const _0x3e0d0d=a23_0xfe851f,{options:_0x3a4db3,args:_0xd83545,tdx:_0x372e07}=_0x4c4de4;if(_0xd83545['length']===0x0)return console[_0x3e0d0d(0x17f)](_0x3e0d0d(0x1a1)),console['error'](_0x3e0d0d(0x1f8)),0x1;const _0x161b32=_0xd83545[0x0],_0x4e5207=_0x3a4db3,_0x4c8105=await resolveWorkspaceIdFromOptions(_0x4e5207,_0x372e07);if(!_0x3a4db3[_0x3e0d0d(0x19f)]){const _0x38da00=await confirm(_0x3e0d0d(0x18e)+_0x161b32+_0x3e0d0d(0x200));if(!_0x38da00)return console[_0x3e0d0d(0x1a2)](_0x3e0d0d(0x17a)),0x0;}return await withSpinner(_0x3e0d0d(0x18b)+_0x161b32+_0x3e0d0d(0x177),()=>_0x372e07[_0x3e0d0d(0x208)][_0x3e0d0d(0x1d5)](_0x161b32,_0x4c8105),{'verbose':_0x3a4db3['verbose']}),console[_0x3e0d0d(0x1a2)]('Campaign\x20\x27'+_0x161b32+_0x3e0d0d(0x1fb)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1ee);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x195);async[a23_0xfe851f(0x181)](_0x324c87){const _0x43a8bc=a23_0xfe851f,{options:_0xec244e,args:_0x9a54b3,tdx:_0x4aeeb4}=_0x324c87;if(_0x9a54b3[_0x43a8bc(0x1ad)]===0x0)return console['error'](_0x43a8bc(0x1a1)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x5c138a=_0x9a54b3[0x0],_0x567911=_0xec244e,_0x592931=await resolveWorkspaceIdFromOptions(_0x567911,_0x4aeeb4);return await withSpinner(_0x43a8bc(0x1d3)+_0x5c138a+_0x43a8bc(0x177),()=>_0x4aeeb4[_0x43a8bc(0x208)][_0x43a8bc(0x17b)](_0x5c138a,_0x592931),{'verbose':_0xec244e[_0x43a8bc(0x1e9)]}),console['log'](_0x43a8bc(0x19b)+_0x5c138a+_0x43a8bc(0x1fa)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1e6);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1e8);async[a23_0xfe851f(0x181)](_0xd71379){const _0x3fe876=a23_0xfe851f,{options:_0x5e920d,args:_0x114e8a,tdx:_0x82199d}=_0xd71379;if(_0x114e8a[_0x3fe876(0x1ad)]===0x0)return console['error'](_0x3fe876(0x1a1)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x76bc9c=_0x114e8a[0x0],_0x39f24d=_0x5e920d,_0x369c66=await resolveWorkspaceIdFromOptions(_0x39f24d,_0x82199d);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x76bc9c+'\x27...',()=>_0x82199d['engage']['pauseCampaign'](_0x76bc9c,_0x369c66),{'verbose':_0x5e920d[_0x3fe876(0x1e9)]}),console[_0x3fe876(0x1a2)](_0x3fe876(0x19b)+_0x76bc9c+_0x3fe876(0x190)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x201);[a23_0xfe851f(0x1e0)]='Resume\x20a\x20paused\x20campaign';async['execute'](_0x1dc459){const _0x11b039=a23_0xfe851f,{options:_0x20aee9,args:_0x33a887,tdx:_0x149863}=_0x1dc459;if(_0x33a887[_0x11b039(0x1ad)]===0x0)return console[_0x11b039(0x17f)](_0x11b039(0x1a1)),console[_0x11b039(0x17f)](_0x11b039(0x1b7)),0x1;const _0x42df34=_0x33a887[0x0],_0x1bc725=_0x20aee9,_0x1e01d0=await resolveWorkspaceIdFromOptions(_0x1bc725,_0x149863);return await withSpinner(_0x11b039(0x206)+_0x42df34+_0x11b039(0x177),()=>_0x149863[_0x11b039(0x208)][_0x11b039(0x19e)](_0x42df34,_0x1e01d0),{'verbose':_0x20aee9[_0x11b039(0x1e9)]}),console['log'](_0x11b039(0x19b)+_0x42df34+_0x11b039(0x18a)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']='engage:campaign:duplicate';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1f0);async[a23_0xfe851f(0x181)](_0x1448cf){const _0x273d31=a23_0xfe851f,{options:_0x1f7a6e,args:_0x3e42f7,tdx:_0x427bc7}=_0x1448cf;if(_0x3e42f7[_0x273d31(0x1ad)]===0x0)return console[_0x273d31(0x17f)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x273d31(0x17f)](_0x273d31(0x1a6)),0x1;const _0x58d630=_0x3e42f7[0x0],_0x23e073=_0x1f7a6e,_0x2fcb12=await resolveWorkspaceIdFromOptions(_0x23e073,_0x427bc7),_0x2a405f=await withSpinner(_0x273d31(0x1fe)+_0x58d630+_0x273d31(0x177),()=>_0x427bc7[_0x273d31(0x208)][_0x273d31(0x182)](_0x58d630,_0x2fcb12),{'verbose':_0x1f7a6e[_0x273d31(0x1e9)]});return await handleSDKOutput([_0x2a405f[_0x273d31(0x1bb)]],_0x1f7a6e),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1f5);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x20a);async[a23_0xfe851f(0x181)](_0x464082){const _0x10e1f2=a23_0xfe851f,{options:_0x1a7469,args:_0x1ef6e0,tdx:_0x49de5c}=_0x464082,_0x6d5e7e=_0x1ef6e0[0x0],_0x14a001=resolveLimit(_0x1a7469[_0x10e1f2(0x186)],DEFAULT_LLM_LIMIT),_0x570422=_0x1a7469,_0x509d0d=await resolveWorkspaceIdFromOptions(_0x570422,_0x49de5c),_0x100a1b=await withSpinner(_0x10e1f2(0x1ca),()=>_0x49de5c[_0x10e1f2(0x208)]['listTemplates']({'workspaceId':_0x509d0d,'limit':_0x14a001}),{'verbose':_0x1a7469[_0x10e1f2(0x1e9)]});let _0x54479d=_0x100a1b[_0x10e1f2(0x1bb)];return _0x6d5e7e&&(_0x54479d=_0x100a1b[_0x10e1f2(0x1bb)][_0x10e1f2(0x209)](_0x242157=>matchGlobPattern(_0x242157['name'],_0x6d5e7e))),await handleSDKOutput(_0x54479d,_0x1a7469),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1f6);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ba);async[a23_0xfe851f(0x181)](_0x170f58){const _0x38de76=a23_0xfe851f,{options:_0x56bc3e,args:_0x166f48,tdx:_0x33b128}=_0x170f58;if(_0x166f48[_0x38de76(0x1ad)]===0x0)return console[_0x38de76(0x17f)](_0x38de76(0x1c7)),console['error'](_0x38de76(0x1b0)),0x1;const _0x37ae96=_0x166f48[0x0],_0x385d47=_0x56bc3e,_0x298f0a=await resolveWorkspaceIdFromOptions(_0x385d47,_0x33b128),_0x2306bf=_0x385d47[_0x38de76(0x1d2)];if(_0x2306bf){const _0x1b7791=await withSpinner('Fetching\x20template\x20\x27'+_0x37ae96+_0x38de76(0x177),()=>_0x33b128['engage'][_0x38de76(0x1df)](_0x37ae96,_0x298f0a),{'verbose':_0x56bc3e['verbose']});await handleSDKOutput([_0x1b7791],_0x56bc3e);}else{const _0x301dcd=await withSpinner('Fetching\x20template\x20\x27'+_0x37ae96+_0x38de76(0x177),()=>_0x33b128[_0x38de76(0x208)][_0x38de76(0x1ef)](_0x37ae96,_0x298f0a),{'verbose':_0x56bc3e[_0x38de76(0x1e9)]});await handleSDKOutput([_0x301dcd],_0x56bc3e);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1eb);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1cd);async['execute'](_0x2a9ee6){const _0x5c40d5=a23_0xfe851f,{options:_0x2a77dc,tdx:_0x2e8953}=_0x2a9ee6,_0x3c13b2=_0x2a77dc,_0x6b474d=_0x3c13b2[_0x5c40d5(0x1e3)],_0x342f30=_0x3c13b2[_0x5c40d5(0x1cc)],_0x4a0799=_0x3c13b2['html'];if(!_0x6b474d)return console[_0x5c40d5(0x17f)](_0x5c40d5(0x1d9)),console[_0x5c40d5(0x17f)](_0x5c40d5(0x1e4)),0x1;if(!_0x342f30)return console[_0x5c40d5(0x17f)](_0x5c40d5(0x1bc)),0x1;if(!_0x4a0799)return console[_0x5c40d5(0x17f)]('Error:\x20--html\x20is\x20required'),0x1;const _0x21c465=await resolveWorkspaceIdFromOptions(_0x3c13b2,_0x2e8953,!![]),_0x52ca8f={'name':_0x6b474d,'subjectTemplate':_0x342f30,'htmlTemplate':_0x4a0799,'workspaceId':_0x21c465,'plaintextTemplate':_0x3c13b2[_0x5c40d5(0x1c0)],'editorType':_0x3c13b2[_0x5c40d5(0x1c4)]},_0x3cee6f=await withSpinner(_0x5c40d5(0x1cf)+_0x6b474d+_0x5c40d5(0x177),()=>_0x2e8953[_0x5c40d5(0x208)][_0x5c40d5(0x199)](_0x52ca8f));return await handleSDKOutput([_0x3cee6f[_0x5c40d5(0x1bb)]],_0x2a77dc),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:template:update';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1d1);async[a23_0xfe851f(0x181)](_0x5dde6a){const _0x444025=a23_0xfe851f,{options:_0x2e9a13,args:_0x3c001e,tdx:_0x5d80be}=_0x5dde6a;if(_0x3c001e[_0x444025(0x1ad)]===0x0)return console[_0x444025(0x17f)](_0x444025(0x1c7)),console['error'](_0x444025(0x1dd)),0x1;const _0x4af31c=_0x3c001e[0x0],_0x48c5f0=_0x2e9a13,_0x4176fe=await resolveWorkspaceIdFromOptions(_0x48c5f0,_0x5d80be),_0x1f7ad0={'name':_0x48c5f0[_0x444025(0x1e3)],'subjectTemplate':_0x48c5f0[_0x444025(0x1cc)],'htmlTemplate':_0x48c5f0['html'],'plaintextTemplate':_0x48c5f0[_0x444025(0x1c0)]},_0x13b7b9=Object[_0x444025(0x1a5)](Object[_0x444025(0x1c1)](_0x1f7ad0)[_0x444025(0x209)](([,_0xf8ab72])=>_0xf8ab72!==undefined));if(Object['keys'](_0x13b7b9)[_0x444025(0x1ad)]===0x0)return console[_0x444025(0x17f)](_0x444025(0x19c)),console[_0x444025(0x17f)](_0x444025(0x1af)),0x1;const _0x52b9b9=await withSpinner('Updating\x20template\x20\x27'+_0x4af31c+_0x444025(0x177),()=>_0x5d80be[_0x444025(0x208)]['updateTemplate'](_0x4af31c,_0x13b7b9,_0x4176fe),{'verbose':_0x2e9a13[_0x444025(0x1e9)]});return await handleSDKOutput([_0x52b9b9[_0x444025(0x1bb)]],_0x2e9a13),0x0;}}function a23_0x4a10(_0x10aa82,_0x2e547c){_0x10aa82=_0x10aa82-0x175;const _0x30a6ea=a23_0x30a6();let _0x4a10e5=_0x30a6ea[_0x10aa82];return _0x4a10e5;}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:template:delete';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ab);async[a23_0xfe851f(0x181)](_0x5aa347){const _0x1fe0a2=a23_0xfe851f,{options:_0x52e542,args:_0x4e9818,tdx:_0x951570}=_0x5aa347;if(_0x4e9818[_0x1fe0a2(0x1ad)]===0x0)return console[_0x1fe0a2(0x17f)](_0x1fe0a2(0x1c7)),console[_0x1fe0a2(0x17f)](_0x1fe0a2(0x20b)),0x1;const _0x3f95e3=_0x4e9818[0x0],_0x4474b0=_0x52e542,_0x5de7d3=await resolveWorkspaceIdFromOptions(_0x4474b0,_0x951570);if(!_0x52e542[_0x1fe0a2(0x19f)]){const _0x4b2dd3=await confirm(_0x1fe0a2(0x1f3)+_0x3f95e3+_0x1fe0a2(0x200));if(!_0x4b2dd3)return console[_0x1fe0a2(0x1a2)](_0x1fe0a2(0x17a)),0x0;}return await withSpinner(_0x1fe0a2(0x203)+_0x3f95e3+_0x1fe0a2(0x177),()=>_0x951570[_0x1fe0a2(0x208)][_0x1fe0a2(0x1d7)](_0x3f95e3,_0x5de7d3),{'verbose':_0x52e542[_0x1fe0a2(0x1e9)]}),console['log'](_0x1fe0a2(0x1e1)+_0x3f95e3+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a23_0xfe851f(0x19d);[a23_0xfe851f(0x1e0)]='List\x20workspaces';async[a23_0xfe851f(0x181)](_0x20656a){const _0x1ac69c=a23_0xfe851f,{options:_0x345fe4,args:_0x581086,tdx:_0x59a8c0}=_0x20656a,_0x2a753d=_0x581086[0x0],_0x3077ad=resolveLimit(_0x345fe4[_0x1ac69c(0x186)],DEFAULT_LLM_LIMIT),_0x5775b1=await withSpinner('Fetching\x20workspaces...',()=>_0x59a8c0['engage'][_0x1ac69c(0x1ed)]({'limit':_0x3077ad}),{'verbose':_0x345fe4[_0x1ac69c(0x1e9)]});let _0x140236=_0x5775b1[_0x1ac69c(0x1bb)];return _0x2a753d&&(_0x140236=_0x5775b1[_0x1ac69c(0x1bb)][_0x1ac69c(0x209)](_0x42ece4=>matchGlobPattern(_0x42ece4[_0x1ac69c(0x1e3)],_0x2a753d))),await handleSDKOutput(_0x140236,_0x345fe4),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:workspace:show';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a8);async[a23_0xfe851f(0x181)](_0x183a4f){const _0x2d59d9=a23_0xfe851f,{options:_0x13afa0,args:_0x1ed951,tdx:_0x5c0950}=_0x183a4f;if(_0x1ed951['length']===0x0)return console[_0x2d59d9(0x17f)](_0x2d59d9(0x1c5)),console[_0x2d59d9(0x17f)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x14d6c=_0x1ed951[0x0],_0x5d89f6=_0x13afa0,_0xd0cbc0=_0x5d89f6['full'];if(_0xd0cbc0){const _0x5f1182=await withSpinner(_0x2d59d9(0x1f1)+_0x14d6c+'\x27...',()=>_0x5c0950[_0x2d59d9(0x208)]['getWorkspaceFull'](_0x14d6c),{'verbose':_0x13afa0['verbose']});await handleSDKOutput([_0x5f1182],_0x13afa0);}else{const _0x2ca07e=await withSpinner('Fetching\x20workspace\x20\x27'+_0x14d6c+'\x27...',()=>_0x5c0950[_0x2d59d9(0x208)][_0x2d59d9(0x185)](_0x14d6c),{'verbose':_0x13afa0['verbose']});await handleSDKOutput([_0x2ca07e],_0x13afa0);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1ac);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a4);async['execute'](_0x3c3136){const _0x13f8bb=a23_0xfe851f,{options:_0x39d5cf,tdx:_0x50d073}=_0x3c3136,_0x260195=_0x39d5cf,_0x2db5d0=_0x260195[_0x13f8bb(0x1e3)];if(!_0x2db5d0)return console[_0x13f8bb(0x17f)]('Error:\x20--name\x20is\x20required'),console[_0x13f8bb(0x17f)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x5341bb={'name':_0x2db5d0,'description':_0x260195[_0x13f8bb(0x1e0)]},_0x1ba220=await withSpinner(_0x13f8bb(0x1c6)+_0x2db5d0+_0x13f8bb(0x177),()=>_0x50d073[_0x13f8bb(0x208)][_0x13f8bb(0x1aa)](_0x5341bb));return await handleSDKOutput([_0x1ba220[_0x13f8bb(0x1bb)]],_0x39d5cf),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a23_0xfe851f(0x18c);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a3);async[a23_0xfe851f(0x181)](_0x5d6815){const _0x3cd220=a23_0xfe851f,{options:_0x4c4864,args:_0x29a4f4,tdx:_0x246783}=_0x5d6815;if(_0x29a4f4[_0x3cd220(0x1ad)]===0x0)return console[_0x3cd220(0x17f)](_0x3cd220(0x1c5)),console[_0x3cd220(0x17f)](_0x3cd220(0x1c3)),0x1;const _0x27346c=_0x29a4f4[0x0],_0x470a7a=_0x4c4864,_0x2d61b2={'name':_0x470a7a['name'],'description':_0x470a7a[_0x3cd220(0x1e0)]},_0x2b4fe2=Object[_0x3cd220(0x1a5)](Object[_0x3cd220(0x1c1)](_0x2d61b2)[_0x3cd220(0x209)](([,_0x223899])=>_0x223899!==undefined));if(Object[_0x3cd220(0x188)](_0x2b4fe2)[_0x3cd220(0x1ad)]===0x0)return console[_0x3cd220(0x17f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3cd220(0x17f)](_0x3cd220(0x178)),0x1;const _0x2ec8a3=await withSpinner(_0x3cd220(0x1b8)+_0x27346c+_0x3cd220(0x177),()=>_0x246783['engage'][_0x3cd220(0x196)](_0x27346c,_0x2b4fe2),{'verbose':_0x4c4864[_0x3cd220(0x1e9)]});return await handleSDKOutput([_0x2ec8a3[_0x3cd220(0x1bb)]],_0x4c4864),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']=a23_0xfe851f(0x204);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1e7);async['execute'](_0xa8a20c){const _0x86764c=a23_0xfe851f,{options:_0xfa08f4,args:_0x2f3095,tdx:_0x1744bc}=_0xa8a20c;if(_0x2f3095['length']===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x86764c(0x1b5)),0x1;const _0x214c03=_0x2f3095[0x0];if(!_0xfa08f4[_0x86764c(0x19f)]){const _0x10265e=await confirm(_0x86764c(0x191)+_0x214c03+_0x86764c(0x200));if(!_0x10265e)return console[_0x86764c(0x1a2)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x86764c(0x1da)+_0x214c03+_0x86764c(0x177),()=>_0x1744bc[_0x86764c(0x208)][_0x86764c(0x176)](_0x214c03),{'verbose':_0xfa08f4[_0x86764c(0x1e9)]}),console[_0x86764c(0x1a2)](_0x86764c(0x1b9)+_0x214c03+_0x86764c(0x1fb)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x194);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ec);async[a23_0xfe851f(0x181)](_0x3df204){const _0xc04702=a23_0xfe851f,{options:_0x3cb49b,args:_0x361d7c,tdx:_0x2fcdf6}=_0x3df204;if(_0x361d7c[_0xc04702(0x1ad)]===0x0)return console[_0xc04702(0x17f)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0xc04702(0x17f)](_0xc04702(0x1d8)),0x1;const _0x14a1e1=_0x361d7c[0x0];await withSpinner(_0xc04702(0x17c)+_0x14a1e1+_0xc04702(0x177),()=>_0x2fcdf6[_0xc04702(0x208)][_0xc04702(0x1c9)](_0x14a1e1));const _0x1547ba=_0x3cb49b['session']||undefined;return saveSessionContext({'engage_workspace':_0x14a1e1},_0x1547ba),console['log'](_0xc04702(0x1bf)+_0x14a1e1),console[_0xc04702(0x1a2)](_0xc04702(0x180)),0x0;}}function a23_0x30a6(){const _0x181fa2=['createTemplate','startAt','Campaign\x20\x27','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:workspaces','resumeCampaign','yes','status','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','log','Update\x20a\x20workspace','Create\x20a\x20workspace','fromEntries','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','20pAlxxa','Show\x20workspace\x20details','3138438yeSCVi','createWorkspace','Delete\x20an\x20email\x20template','engage:workspace:create','length','List\x20campaigns','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','type','Create\x20a\x20new\x20campaign','Delete\x20a\x20campaign','updateCampaign','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','createCampaign','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Updating\x20workspace\x20\x27','Workspace\x20\x27','Show\x20email\x20template\x20details','data','Error:\x20--subject\x20is\x20required','emailSenderId','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Engage\x20workspace\x20set\x20to:\x20','plaintext','entries','6438984EgZGcr','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','editorType','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Creating\x20workspace\x20\x27','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','segmentName','resolveWorkspaceId','Fetching\x20templates...','resolvePathToResource','subject','Create\x20an\x20email\x20template','parentName','Creating\x20template\x20\x27','parentId','Update\x20an\x20email\x20template','full','Launching\x20campaign\x20\x27','jsonColumns','deleteCampaign','segmentId','deleteTemplate','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Error:\x20--name\x20is\x20required','Deleting\x20workspace\x20\x27','engage:campaign:update','engage:campaign:delete','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','segment','getTemplateFull','description','Template\x20\x27','Update\x20a\x20campaign','name','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','5fjYkCa','engage:campaign:pause','Delete\x20a\x20workspace','Pause\x20a\x20campaign','verbose','2174194nebNrp','engage:template:create','Set\x20workspace\x20context\x20for\x20Engage\x20commands','listWorkspaces','engage:campaign:launch','getTemplate','Duplicate\x20a\x20campaign','Fetching\x20workspace\x20\x27','4305174jmzEZT','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Workspace\x20is\x20required\x20for\x20this\x20operation','engage:templates','engage:template:show','engage_workspace','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','listCampaigns','\x27\x20launched\x20successfully','\x27\x20deleted\x20successfully','4zRluBu','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Duplicating\x20campaign\x20\x27','222321sslZtv','\x27?\x20This\x20cannot\x20be\x20undone.','engage:campaign:resume','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Deleting\x20template\x20\x27','engage:workspace:delete','engage:campaign:create','Resuming\x20campaign\x20\x27','getCampaign','engage','filter','List\x20email\x20templates','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','7Eextem','session','deleteWorkspace','\x27...','Options:\x20--name,\x20--description','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Operation\x20cancelled','launchCampaign','Verifying\x20workspace\x20\x27','Fetching\x20campaign\x20\x27','getCampaignFull','error','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','execute','duplicateCampaign','11601873lRdqte','workspace','getWorkspace','limit','Fetching\x20campaigns...','keys','Show\x20campaign\x20details','\x27\x20resumed\x20successfully','Deleting\x20campaign\x20\x27','engage:workspace:update','Updating\x20campaign\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','11423335uuceHk','\x27\x20paused\x20successfully','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Creating\x20campaign\x20\x27','MISSING_ARGUMENT','engage:workspace:use','Launch\x20a\x20campaign','updateWorkspace','timezone','engage:campaigns'];a23_0x30a6=function(){return _0x181fa2;};return a23_0x30a6();}
1
+ const a23_0x4c52ea=a23_0x56ed;(function(_0x2037e9,_0x2f4ded){const _0x11ef1a=a23_0x56ed,_0x1b9d8e=_0x2037e9();while(!![]){try{const _0x593edc=parseInt(_0x11ef1a(0x132))/0x1*(-parseInt(_0x11ef1a(0x14d))/0x2)+parseInt(_0x11ef1a(0xf0))/0x3*(-parseInt(_0x11ef1a(0x11a))/0x4)+-parseInt(_0x11ef1a(0x131))/0x5+parseInt(_0x11ef1a(0xd0))/0x6*(-parseInt(_0x11ef1a(0xd4))/0x7)+-parseInt(_0x11ef1a(0xd8))/0x8+parseInt(_0x11ef1a(0x11b))/0x9+parseInt(_0x11ef1a(0x141))/0xa*(parseInt(_0x11ef1a(0x11e))/0xb);if(_0x593edc===_0x2f4ded)break;else _0x1b9d8e['push'](_0x1b9d8e['shift']());}catch(_0x1e7638){_0x1b9d8e['push'](_0x1b9d8e['shift']());}}}(a23_0xacaa,0x83484));function a23_0xacaa(){const _0x520b06=['List\x20campaigns','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','engage:template:update','28aODwkW','Error:\x20--html\x20is\x20required','listWorkspaces','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','6283792vqvVIt','Delete\x20a\x20workspace','filter','html','resolveWorkspaceId','Options:\x20--name,\x20--description','log','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Update\x20a\x20campaign','\x27...','error','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','getWorkspaceFull','Creating\x20template\x20\x27','deleteWorkspace','getCampaignFull','Create\x20a\x20new\x20campaign','Error:\x20--name\x20is\x20required','segmentId','getCampaign','engage:templates','Update\x20an\x20email\x20template','engage:workspace:use','Delete\x20an\x20email\x20template','8907gidGvD','entries','startAt','Creating\x20workspace\x20\x27','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','engage:workspace:show','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','execute','List\x20workspaces','Error:\x20Workspace\x20name\x20is\x20required','segment','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','MISSING_ARGUMENT','Launching\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Error:\x20--subject\x20is\x20required','Fetching\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Fetching\x20campaigns...','engage:workspace:delete','length','Pause\x20a\x20campaign','engage:template:show','updateWorkspace','subject','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Verifying\x20workspace\x20\x27','name','engage_workspace','\x27\x20launched\x20successfully','Fetching\x20template\x20\x27','Show\x20email\x20template\x20details','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Delete\x20a\x20campaign','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Deleting\x20campaign\x20\x27','verbose','duplicateCampaign','engage:campaign:delete','resolvePathToResource','engage:template:create','Pausing\x20campaign\x20\x27','996VUCCmy','1101600duQdXt','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','createWorkspace','88nngRgg','description','\x27\x20resumed\x20successfully','Fetching\x20campaign\x20\x27','listTemplates','data','full','createTemplate','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Duplicating\x20campaign\x20\x27','editorType','engage:campaign:pause','createCampaign','\x27?\x20This\x20cannot\x20be\x20undone.','engage:template:delete','engage:campaign:create','session','Show\x20workspace\x20details','segmentName','3865540eYgpNQ','1hsOVBy','Duplicate\x20a\x20campaign','plaintext','Resume\x20a\x20paused\x20campaign','Launch\x20a\x20campaign','\x27\x20deleted\x20successfully','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Create\x20an\x20email\x20template','jsonColumns','engage:workspace:update','getWorkspace','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Show\x20campaign\x20details','engage:workspaces','4767260lfaxrv','Campaign\x20\x27','engage','limit','parentName','Set\x20workspace\x20context\x20for\x20Engage\x20commands','fromEntries','timezone','engage:campaigns','getTemplate','keys','Operation\x20cancelled','472634UVwPKz','engage:campaign:resume','listCampaigns','engage:workspace:create','Creating\x20campaign\x20\x27','Deleting\x20workspace\x20\x27','Deleting\x20template\x20\x27','deleteTemplate','Fetching\x20workspaces...','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','engage:campaign:duplicate','workspace','updateTemplate','engage:campaign:update','Updating\x20campaign\x20\x27','emailSenderId','yes','Resuming\x20campaign\x20\x27','1296444sKbSqW'];a23_0xacaa=function(){return _0x520b06;};return a23_0xacaa();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x4c7cfb,_0x121561,_0x138346=![]){const _0x12584f=a23_0x56ed;if(_0x4c7cfb['workspace'])return await _0x121561['engage'][_0x12584f(0xdc)](_0x4c7cfb[_0x12584f(0x158)]);const _0x200855=loadSessionContext(_0x4c7cfb[_0x12584f(0x12e)]);if(_0x200855?.[_0x12584f(0x10c)])return await _0x121561[_0x12584f(0x143)]['resolveWorkspaceId'](_0x200855[_0x12584f(0x10c)]);if(_0x138346)throw new SDKError(ErrorCode[_0x12584f(0xfc)],'Workspace\x20is\x20required\x20for\x20this\x20operation',undefined,{'helpText':_0x12584f(0xd2)});return undefined;}async function resolveSegmentFromOptions(_0x52623b,_0x507396){const _0x3610c0=a23_0x56ed;if(!_0x52623b[_0x3610c0(0xfa)])return{};const _0x4b54c3=_0x52623b[_0x3610c0(0xfa)],_0x1e5f41=await _0x507396[_0x3610c0(0xfa)][_0x3610c0(0x117)](_0x4b54c3);return{'audienceId':_0x1e5f41['parentId'],'audienceName':_0x1e5f41[_0x3610c0(0x145)],..._0x1e5f41[_0x3610c0(0xea)]&&{'segmentId':_0x1e5f41[_0x3610c0(0xea)],'segmentName':_0x1e5f41[_0x3610c0(0x130)]}};}function buildConnectorConfig(_0x4f5bdd){const _0x1b5323=a23_0x56ed,_0x59fc63=_0x4f5bdd[_0x1b5323(0x15c)],_0x2f2508=_0x4f5bdd[_0x1b5323(0x13b)];if(!_0x59fc63&&!_0x2f2508)return undefined;return{..._0x59fc63&&{'emailSenderId':_0x59fc63},..._0x2f2508&&{'jsonColumns':_0x2f2508}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x149);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xd1);async['execute'](_0x28720c){const _0x38437e=a23_0x4c52ea,{options:_0x33f8b1,args:_0x4a6623,tdx:_0x15a6af}=_0x28720c,_0x2fae05=_0x4a6623[0x0],_0x7e0d47=resolveLimit(_0x33f8b1[_0x38437e(0x144)],DEFAULT_LLM_LIMIT),_0x418d1d=_0x33f8b1,_0xa60226=_0x418d1d['type'],_0x100967=_0x418d1d['status'],_0x32e6b7=await resolveWorkspaceIdFromOptions(_0x418d1d,_0x15a6af),_0x37411c=await withSpinner(_0x38437e(0x102),()=>_0x15a6af[_0x38437e(0x143)][_0x38437e(0x14f)]({'type':_0xa60226,'status':_0x100967,'workspaceId':_0x32e6b7,'limit':_0x7e0d47}),{'verbose':_0x33f8b1[_0x38437e(0x114)]});let _0x554c15=_0x37411c['data'];return _0x2fae05&&(_0x554c15=_0x37411c['data'][_0x38437e(0xda)](_0x259eb2=>matchGlobPattern(_0x259eb2[_0x38437e(0x10b)],_0x2fae05))),await handleSDKOutput(_0x554c15,_0x33f8b1),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]='engage:campaign:show';[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x13f);async[a23_0x4c52ea(0xf7)](_0x25258a){const _0x25943a=a23_0x4c52ea,{options:_0x51ca6a,args:_0x448b2a,tdx:_0x573712}=_0x25258a;if(_0x448b2a['length']===0x0)return console[_0x25943a(0xe2)](_0x25943a(0xe3)),console[_0x25943a(0xe2)](_0x25943a(0x11c)),0x1;const _0x36d51e=_0x448b2a[0x0],_0x2c4c14=_0x51ca6a,_0x22822e=await resolveWorkspaceIdFromOptions(_0x2c4c14,_0x573712),_0x4ddb1d=_0x2c4c14[_0x25943a(0x124)];if(_0x4ddb1d){const _0x1f72ca=await withSpinner(_0x25943a(0x121)+_0x36d51e+_0x25943a(0xe1),()=>_0x573712['engage'][_0x25943a(0xe7)](_0x36d51e,_0x22822e),{'verbose':_0x51ca6a[_0x25943a(0x114)]});await handleSDKOutput([_0x1f72ca],_0x51ca6a);}else{const _0x418bc6=await withSpinner(_0x25943a(0x121)+_0x36d51e+'\x27...',()=>_0x573712[_0x25943a(0x143)][_0x25943a(0xeb)](_0x36d51e,_0x22822e),{'verbose':_0x51ca6a['verbose']});await handleSDKOutput([_0x418bc6],_0x51ca6a);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x12d);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xe8);async[a23_0x4c52ea(0xf7)](_0x213488){const _0x3be873=a23_0x4c52ea,{options:_0x508fc6,tdx:_0x219943}=_0x213488,_0x1c7688=_0x508fc6,_0x2b920b=_0x1c7688[_0x3be873(0x10b)],_0x353b4b=_0x1c7688['type'];if(!_0x2b920b)return console[_0x3be873(0xe2)](_0x3be873(0xe9)),console[_0x3be873(0xe2)](_0x3be873(0xfb)),0x1;if(!_0x353b4b)return console['error']('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x3be873(0xe2)](_0x3be873(0xfb)),0x1;const _0x3440fa=await resolveWorkspaceIdFromOptions(_0x1c7688,_0x219943,!![]),_0x21e818=await resolveSegmentFromOptions(_0x1c7688,_0x219943),_0x4ac91c=buildConnectorConfig(_0x1c7688),_0x54d532={'name':_0x2b920b,'campaignType':_0x353b4b,'workspaceId':_0x3440fa,'description':_0x1c7688[_0x3be873(0x11f)],..._0x21e818,'connectorConfig':_0x4ac91c,'startAt':_0x1c7688[_0x3be873(0xf2)],'timezone':_0x1c7688[_0x3be873(0x148)]},_0x2998dd=await withSpinner(_0x3be873(0x151)+_0x2b920b+_0x3be873(0xe1),()=>_0x219943[_0x3be873(0x143)][_0x3be873(0x12a)](_0x54d532));return await handleSDKOutput([_0x2998dd[_0x3be873(0x123)]],_0x508fc6),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x15a);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xe0);async[a23_0x4c52ea(0xf7)](_0xa18f02){const _0x246f09=a23_0x4c52ea,{options:_0x1554c3,args:_0x153964,tdx:_0xb9fcf3}=_0xa18f02;if(_0x153964[_0x246f09(0x104)]===0x0)return console['error'](_0x246f09(0xe3)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x292986=_0x153964[0x0],_0x577afe=_0x1554c3,_0x1a1446=await resolveWorkspaceIdFromOptions(_0x577afe,_0xb9fcf3),_0xe13eb0=await resolveSegmentFromOptions(_0x577afe,_0xb9fcf3),_0x316576=buildConnectorConfig(_0x577afe),_0x139e17={'name':_0x577afe['name'],'description':_0x577afe[_0x246f09(0x11f)],..._0xe13eb0,'connectorConfig':_0x316576,'startAt':_0x577afe[_0x246f09(0xf2)],'timezone':_0x577afe[_0x246f09(0x148)]},_0x1ee5f7=Object[_0x246f09(0x147)](Object[_0x246f09(0xf1)](_0x139e17)[_0x246f09(0xda)](([,_0x26ee1d])=>_0x26ee1d!==undefined));if(Object[_0x246f09(0x14b)](_0x1ee5f7)[_0x246f09(0x104)]===0x0)return console[_0x246f09(0xe2)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error'](_0x246f09(0xf4)),0x1;const _0x37162e=await withSpinner(_0x246f09(0x15b)+_0x292986+_0x246f09(0xe1),()=>_0xb9fcf3[_0x246f09(0x143)]['updateCampaign'](_0x292986,_0x1ee5f7,_0x1a1446),{'verbose':_0x1554c3['verbose']});return await handleSDKOutput([_0x37162e[_0x246f09(0x123)]],_0x1554c3),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x116);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x111);async['execute'](_0x489546){const _0x1de1cd=a23_0x4c52ea,{options:_0x236f0b,args:_0x10c621,tdx:_0x3a9c51}=_0x489546;if(_0x10c621[_0x1de1cd(0x104)]===0x0)return console[_0x1de1cd(0xe2)](_0x1de1cd(0xe3)),console[_0x1de1cd(0xe2)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0xe9dc5f=_0x10c621[0x0],_0x3116c1=_0x236f0b,_0x17ee9d=await resolveWorkspaceIdFromOptions(_0x3116c1,_0x3a9c51);if(!_0x236f0b[_0x1de1cd(0xce)]){const _0x310c06=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27'+_0xe9dc5f+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x310c06)return console['log']('Operation\x20cancelled'),0x0;}return await withSpinner(_0x1de1cd(0x113)+_0xe9dc5f+_0x1de1cd(0xe1),()=>_0x3a9c51[_0x1de1cd(0x143)]['deleteCampaign'](_0xe9dc5f,_0x17ee9d),{'verbose':_0x236f0b['verbose']}),console[_0x1de1cd(0xde)](_0x1de1cd(0x142)+_0xe9dc5f+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]='engage:campaign:launch';['description']=a23_0x4c52ea(0x136);async[a23_0x4c52ea(0xf7)](_0x3d685a){const _0x45638d=a23_0x4c52ea,{options:_0x31cc34,args:_0xd9f4ee,tdx:_0x115fa5}=_0x3d685a;if(_0xd9f4ee['length']===0x0)return console[_0x45638d(0xe2)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x45638d(0xe2)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x544bb1=_0xd9f4ee[0x0],_0x5a2b75=_0x31cc34,_0x32de0c=await resolveWorkspaceIdFromOptions(_0x5a2b75,_0x115fa5);return await withSpinner(_0x45638d(0xfd)+_0x544bb1+_0x45638d(0xe1),()=>_0x115fa5[_0x45638d(0x143)]['launchCampaign'](_0x544bb1,_0x32de0c),{'verbose':_0x31cc34[_0x45638d(0x114)]}),console['log'](_0x45638d(0x142)+_0x544bb1+_0x45638d(0x10d)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x129);['description']=a23_0x4c52ea(0x105);async[a23_0x4c52ea(0xf7)](_0x16266f){const _0x2b580f=a23_0x4c52ea,{options:_0x1cdf4f,args:_0x37ac91,tdx:_0x1f0204}=_0x16266f;if(_0x37ac91[_0x2b580f(0x104)]===0x0)return console[_0x2b580f(0xe2)](_0x2b580f(0xe3)),console[_0x2b580f(0xe2)](_0x2b580f(0xd7)),0x1;const _0x35c295=_0x37ac91[0x0],_0x4f90f9=_0x1cdf4f,_0xb73f89=await resolveWorkspaceIdFromOptions(_0x4f90f9,_0x1f0204);return await withSpinner(_0x2b580f(0x119)+_0x35c295+_0x2b580f(0xe1),()=>_0x1f0204['engage']['pauseCampaign'](_0x35c295,_0xb73f89),{'verbose':_0x1cdf4f['verbose']}),console[_0x2b580f(0xde)](_0x2b580f(0x142)+_0x35c295+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x14e);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x135);async['execute'](_0x335959){const _0x4b35b2=a23_0x4c52ea,{options:_0x19aed4,args:_0x5f4f44,tdx:_0x172b1c}=_0x335959;if(_0x5f4f44[_0x4b35b2(0x104)]===0x0)return console[_0x4b35b2(0xe2)](_0x4b35b2(0xe3)),console[_0x4b35b2(0xe2)](_0x4b35b2(0x101)),0x1;const _0x153755=_0x5f4f44[0x0],_0xefd4be=_0x19aed4,_0x4805ae=await resolveWorkspaceIdFromOptions(_0xefd4be,_0x172b1c);return await withSpinner(_0x4b35b2(0xcf)+_0x153755+_0x4b35b2(0xe1),()=>_0x172b1c[_0x4b35b2(0x143)]['resumeCampaign'](_0x153755,_0x4805ae),{'verbose':_0x19aed4[_0x4b35b2(0x114)]}),console['log'](_0x4b35b2(0x142)+_0x153755+_0x4b35b2(0x120)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x157);['description']=a23_0x4c52ea(0x133);async[a23_0x4c52ea(0xf7)](_0x406ac8){const _0x23765c=a23_0x4c52ea,{options:_0x363ae8,args:_0x2b466f,tdx:_0x54edda}=_0x406ac8;if(_0x2b466f[_0x23765c(0x104)]===0x0)return console['error'](_0x23765c(0xe3)),console[_0x23765c(0xe2)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x2fc344=_0x2b466f[0x0],_0x589561=_0x363ae8,_0x9c1fef=await resolveWorkspaceIdFromOptions(_0x589561,_0x54edda),_0x26edc2=await withSpinner(_0x23765c(0x127)+_0x2fc344+_0x23765c(0xe1),()=>_0x54edda[_0x23765c(0x143)][_0x23765c(0x115)](_0x2fc344,_0x9c1fef),{'verbose':_0x363ae8['verbose']});return await handleSDKOutput([_0x26edc2[_0x23765c(0x123)]],_0x363ae8),0x0;}}function a23_0x56ed(_0x26815e,_0xc727cd){_0x26815e=_0x26815e-0xce;const _0xacaa83=a23_0xacaa();let _0x56ed53=_0xacaa83[_0x26815e];return _0x56ed53;}export class EngageTemplatesCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xec);[a23_0x4c52ea(0x11f)]='List\x20email\x20templates';async[a23_0x4c52ea(0xf7)](_0x39548b){const _0x33b038=a23_0x4c52ea,{options:_0x2fe3ed,args:_0x1514de,tdx:_0x321bca}=_0x39548b,_0x5b2565=_0x1514de[0x0],_0xe54500=resolveLimit(_0x2fe3ed['limit'],DEFAULT_LLM_LIMIT),_0x4f1933=_0x2fe3ed,_0x3703f3=await resolveWorkspaceIdFromOptions(_0x4f1933,_0x321bca),_0x39d143=await withSpinner('Fetching\x20templates...',()=>_0x321bca['engage'][_0x33b038(0x122)]({'workspaceId':_0x3703f3,'limit':_0xe54500}),{'verbose':_0x2fe3ed[_0x33b038(0x114)]});let _0xb10ad0=_0x39d143[_0x33b038(0x123)];return _0x5b2565&&(_0xb10ad0=_0x39d143[_0x33b038(0x123)]['filter'](_0x195bcc=>matchGlobPattern(_0x195bcc[_0x33b038(0x10b)],_0x5b2565))),await handleSDKOutput(_0xb10ad0,_0x2fe3ed),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x106);['description']=a23_0x4c52ea(0x10f);async[a23_0x4c52ea(0xf7)](_0x524268){const _0x47b1b1=a23_0x4c52ea,{options:_0x598c44,args:_0x5e8b4f,tdx:_0x44171b}=_0x524268;if(_0x5e8b4f[_0x47b1b1(0x104)]===0x0)return console[_0x47b1b1(0xe2)](_0x47b1b1(0xf6)),console['error'](_0x47b1b1(0x110)),0x1;const _0x22d579=_0x5e8b4f[0x0],_0x420be8=_0x598c44,_0xf51d02=await resolveWorkspaceIdFromOptions(_0x420be8,_0x44171b),_0xe156c0=_0x420be8[_0x47b1b1(0x124)];if(_0xe156c0){const _0x58ff2f=await withSpinner(_0x47b1b1(0x10e)+_0x22d579+'\x27...',()=>_0x44171b['engage']['getTemplateFull'](_0x22d579,_0xf51d02),{'verbose':_0x598c44[_0x47b1b1(0x114)]});await handleSDKOutput([_0x58ff2f],_0x598c44);}else{const _0x1cdb77=await withSpinner(_0x47b1b1(0x10e)+_0x22d579+'\x27...',()=>_0x44171b['engage'][_0x47b1b1(0x14a)](_0x22d579,_0xf51d02),{'verbose':_0x598c44[_0x47b1b1(0x114)]});await handleSDKOutput([_0x1cdb77],_0x598c44);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x118);['description']=a23_0x4c52ea(0x13a);async[a23_0x4c52ea(0xf7)](_0x497708){const _0x1abf72=a23_0x4c52ea,{options:_0x4949a9,tdx:_0x5b9f6a}=_0x497708,_0x209832=_0x4949a9,_0x1d692d=_0x209832[_0x1abf72(0x10b)],_0x24f91f=_0x209832[_0x1abf72(0x108)],_0x2cf5ab=_0x209832[_0x1abf72(0xdb)];if(!_0x1d692d)return console[_0x1abf72(0xe2)](_0x1abf72(0xe9)),console['error']('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x24f91f)return console[_0x1abf72(0xe2)](_0x1abf72(0xff)),0x1;if(!_0x2cf5ab)return console[_0x1abf72(0xe2)](_0x1abf72(0xd5)),0x1;const _0x564241=await resolveWorkspaceIdFromOptions(_0x209832,_0x5b9f6a,!![]),_0x2f629f={'name':_0x1d692d,'subjectTemplate':_0x24f91f,'htmlTemplate':_0x2cf5ab,'workspaceId':_0x564241,'plaintextTemplate':_0x209832[_0x1abf72(0x134)],'editorType':_0x209832[_0x1abf72(0x128)]},_0x4e655a=await withSpinner(_0x1abf72(0xe5)+_0x1d692d+_0x1abf72(0xe1),()=>_0x5b9f6a[_0x1abf72(0x143)][_0x1abf72(0x125)](_0x2f629f));return await handleSDKOutput([_0x4e655a['data']],_0x4949a9),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xd3);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xed);async[a23_0x4c52ea(0xf7)](_0x252bb1){const _0x3b934a=a23_0x4c52ea,{options:_0x182c10,args:_0x57ff5d,tdx:_0x209ac1}=_0x252bb1;if(_0x57ff5d['length']===0x0)return console['error'](_0x3b934a(0xf6)),console[_0x3b934a(0xe2)]('Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x767d21=_0x57ff5d[0x0],_0x108407=_0x182c10,_0x223e53=await resolveWorkspaceIdFromOptions(_0x108407,_0x209ac1),_0x319071={'name':_0x108407[_0x3b934a(0x10b)],'subjectTemplate':_0x108407[_0x3b934a(0x108)],'htmlTemplate':_0x108407[_0x3b934a(0xdb)],'plaintextTemplate':_0x108407[_0x3b934a(0x134)]},_0xe3f569=Object['fromEntries'](Object[_0x3b934a(0xf1)](_0x319071)[_0x3b934a(0xda)](([,_0x1a3d80])=>_0x1a3d80!==undefined));if(Object['keys'](_0xe3f569)[_0x3b934a(0x104)]===0x0)return console['error'](_0x3b934a(0x112)),console[_0x3b934a(0xe2)](_0x3b934a(0x13e)),0x1;const _0x5c475a=await withSpinner('Updating\x20template\x20\x27'+_0x767d21+_0x3b934a(0xe1),()=>_0x209ac1['engage'][_0x3b934a(0x159)](_0x767d21,_0xe3f569,_0x223e53),{'verbose':_0x182c10['verbose']});return await handleSDKOutput([_0x5c475a[_0x3b934a(0x123)]],_0x182c10),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x12c);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xef);async[a23_0x4c52ea(0xf7)](_0x1ab2b9){const _0x1cfe57=a23_0x4c52ea,{options:_0x520433,args:_0xbd855e,tdx:_0x48f7a5}=_0x1ab2b9;if(_0xbd855e[_0x1cfe57(0x104)]===0x0)return console[_0x1cfe57(0xe2)](_0x1cfe57(0xf6)),console['error']('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x53ce28=_0xbd855e[0x0],_0x2b4c48=_0x520433,_0x4f8b5a=await resolveWorkspaceIdFromOptions(_0x2b4c48,_0x48f7a5);if(!_0x520433[_0x1cfe57(0xce)]){const _0x2409e9=await confirm(_0x1cfe57(0x138)+_0x53ce28+_0x1cfe57(0x12b));if(!_0x2409e9)return console[_0x1cfe57(0xde)](_0x1cfe57(0x14c)),0x0;}return await withSpinner(_0x1cfe57(0x153)+_0x53ce28+'\x27...',()=>_0x48f7a5[_0x1cfe57(0x143)][_0x1cfe57(0x154)](_0x53ce28,_0x4f8b5a),{'verbose':_0x520433[_0x1cfe57(0x114)]}),console[_0x1cfe57(0xde)]('Template\x20\x27'+_0x53ce28+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x140);['description']=a23_0x4c52ea(0xf8);async[a23_0x4c52ea(0xf7)](_0xe90340){const _0x22b979=a23_0x4c52ea,{options:_0x5b6c5a,args:_0x4decde,tdx:_0x51f190}=_0xe90340,_0x15171f=_0x4decde[0x0],_0x256d3d=resolveLimit(_0x5b6c5a['limit'],DEFAULT_LLM_LIMIT),_0x327d31=await withSpinner(_0x22b979(0x155),()=>_0x51f190[_0x22b979(0x143)][_0x22b979(0xd6)]({'limit':_0x256d3d}),{'verbose':_0x5b6c5a[_0x22b979(0x114)]});let _0x4b075d=_0x327d31[_0x22b979(0x123)];return _0x15171f&&(_0x4b075d=_0x327d31[_0x22b979(0x123)]['filter'](_0x17a506=>matchGlobPattern(_0x17a506['name'],_0x15171f))),await handleSDKOutput(_0x4b075d,_0x5b6c5a),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xf5);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x12f);async['execute'](_0x4bcb41){const _0x4a5e22=a23_0x4c52ea,{options:_0x4487de,args:_0x2aed8b,tdx:_0x421d4e}=_0x4bcb41;if(_0x2aed8b[_0x4a5e22(0x104)]===0x0)return console[_0x4a5e22(0xe2)](_0x4a5e22(0x126)),console[_0x4a5e22(0xe2)](_0x4a5e22(0x156)),0x1;const _0x1c6310=_0x2aed8b[0x0],_0x506972=_0x4487de,_0x330fda=_0x506972[_0x4a5e22(0x124)];if(_0x330fda){const _0x1aad4b=await withSpinner(_0x4a5e22(0x100)+_0x1c6310+_0x4a5e22(0xe1),()=>_0x421d4e[_0x4a5e22(0x143)][_0x4a5e22(0xe4)](_0x1c6310),{'verbose':_0x4487de['verbose']});await handleSDKOutput([_0x1aad4b],_0x4487de);}else{const _0xce2540=await withSpinner('Fetching\x20workspace\x20\x27'+_0x1c6310+_0x4a5e22(0xe1),()=>_0x421d4e[_0x4a5e22(0x143)][_0x4a5e22(0x13d)](_0x1c6310),{'verbose':_0x4487de[_0x4a5e22(0x114)]});await handleSDKOutput([_0xce2540],_0x4487de);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a23_0x4c52ea(0x150);['description']='Create\x20a\x20workspace';async[a23_0x4c52ea(0xf7)](_0x4499cd){const _0x471dab=a23_0x4c52ea,{options:_0x15bbea,tdx:_0x1d07d7}=_0x4499cd,_0x5c43e4=_0x15bbea,_0x4a0fba=_0x5c43e4[_0x471dab(0x10b)];if(!_0x4a0fba)return console[_0x471dab(0xe2)]('Error:\x20--name\x20is\x20required'),console[_0x471dab(0xe2)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x16c913={'name':_0x4a0fba,'description':_0x5c43e4[_0x471dab(0x11f)]},_0x3578ee=await withSpinner(_0x471dab(0xf3)+_0x4a0fba+_0x471dab(0xe1),()=>_0x1d07d7[_0x471dab(0x143)][_0x471dab(0x11d)](_0x16c913));return await handleSDKOutput([_0x3578ee[_0x471dab(0x123)]],_0x15bbea),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x13c);[a23_0x4c52ea(0x11f)]='Update\x20a\x20workspace';async['execute'](_0x26fdb8){const _0x577e0d=a23_0x4c52ea,{options:_0x596285,args:_0x2cc556,tdx:_0x4306f6}=_0x26fdb8;if(_0x2cc556['length']===0x0)return console['error'](_0x577e0d(0x126)),console[_0x577e0d(0xe2)](_0x577e0d(0x139)),0x1;const _0x8afc50=_0x2cc556[0x0],_0x4c9487=_0x596285,_0x1a40f9={'name':_0x4c9487[_0x577e0d(0x10b)],'description':_0x4c9487[_0x577e0d(0x11f)]},_0x20af8d=Object[_0x577e0d(0x147)](Object['entries'](_0x1a40f9)[_0x577e0d(0xda)](([,_0x236702])=>_0x236702!==undefined));if(Object[_0x577e0d(0x14b)](_0x20af8d)['length']===0x0)return console[_0x577e0d(0xe2)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x577e0d(0xe2)](_0x577e0d(0xdd)),0x1;const _0x1fa531=await withSpinner('Updating\x20workspace\x20\x27'+_0x8afc50+'\x27...',()=>_0x4306f6['engage'][_0x577e0d(0x107)](_0x8afc50,_0x20af8d),{'verbose':_0x596285[_0x577e0d(0x114)]});return await handleSDKOutput([_0x1fa531[_0x577e0d(0x123)]],_0x596285),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x103);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xd9);async[a23_0x4c52ea(0xf7)](_0x20c894){const _0x2ded36=a23_0x4c52ea,{options:_0x457db5,args:_0x1c234a,tdx:_0x4597cd}=_0x20c894;if(_0x1c234a[_0x2ded36(0x104)]===0x0)return console[_0x2ded36(0xe2)](_0x2ded36(0x126)),console['error'](_0x2ded36(0xdf)),0x1;const _0x324395=_0x1c234a[0x0];if(!_0x457db5[_0x2ded36(0xce)]){const _0x302c93=await confirm(_0x2ded36(0x109)+_0x324395+_0x2ded36(0x12b));if(!_0x302c93)return console[_0x2ded36(0xde)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x2ded36(0x152)+_0x324395+'\x27...',()=>_0x4597cd[_0x2ded36(0x143)][_0x2ded36(0xe6)](_0x324395),{'verbose':_0x457db5[_0x2ded36(0x114)]}),console[_0x2ded36(0xde)]('Workspace\x20\x27'+_0x324395+_0x2ded36(0x137)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xee);['description']=a23_0x4c52ea(0x146);async[a23_0x4c52ea(0xf7)](_0x29bbcb){const _0x498894=a23_0x4c52ea,{options:_0x237d21,args:_0x259f83,tdx:_0x1724da}=_0x29bbcb;if(_0x259f83[_0x498894(0x104)]===0x0)return console['error'](_0x498894(0xf9)),console[_0x498894(0xe2)](_0x498894(0xfe)),0x1;const _0x487405=_0x259f83[0x0];await withSpinner(_0x498894(0x10a)+_0x487405+_0x498894(0xe1),()=>_0x1724da[_0x498894(0x143)][_0x498894(0xdc)](_0x487405));const _0x1596f5=_0x237d21[_0x498894(0x12e)]||undefined;return saveSessionContext({'engage_workspace':_0x487405},_0x1596f5),console[_0x498894(0xde)]('Engage\x20workspace\x20set\x20to:\x20'+_0x487405),console[_0x498894(0xde)]('\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
@@ -1 +1 @@
1
- const a24_0x118125=a24_0x29b0;(function(_0x23bd42,_0x715e86){const _0x25f636=a24_0x29b0,_0x105e89=_0x23bd42();while(!![]){try{const _0x339801=-parseInt(_0x25f636(0x1bc))/0x1*(-parseInt(_0x25f636(0x1cb))/0x2)+parseInt(_0x25f636(0x1c1))/0x3+-parseInt(_0x25f636(0x1de))/0x4+parseInt(_0x25f636(0x1a9))/0x5*(-parseInt(_0x25f636(0x1b8))/0x6)+-parseInt(_0x25f636(0x1a5))/0x7*(parseInt(_0x25f636(0x1dd))/0x8)+-parseInt(_0x25f636(0x1da))/0x9+parseInt(_0x25f636(0x1cc))/0xa;if(_0x339801===_0x715e86)break;else _0x105e89['push'](_0x105e89['shift']());}catch(_0x47a030){_0x105e89['push'](_0x105e89['shift']());}}}(a24_0x3d55,0xbec57));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a24_0x3d55(){const _0xcb41=['Submitting\x20kill\x20request...','round','verbose','debug','✔\x20Retrieved\x20','Usage:\x20job\x20show\x20<job-id>','50KDERWe','18781870dWylNm','job_id','trino','show','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','limit','Get\x20job\x20results','Database:\x20','Usage:\x20job\x20kill\x20<job-id>','\x20\x20Job\x20ID:\x20','description','file','name','database','8642889tKvBcA','Kill\x20a\x20job','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','1416GFyCuy','2134100tzufut','start_at','\x20jobs','type','information_schema','length','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','hive','...','submit','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Submitting\x20job...','user_name','job:kill','kill','list','cause','jobType','message','Error:\x20','List\x20jobs','created_at','10402XZYGwN','job:submit','\x20job','job:result','5OWnAWQ','query','error','priority','execute','jobs','url','Submit\x20a\x20job','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','\x20\x20Cause:\x20','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Job\x20type:\x20','Listing\x20jobs...','getTime','end_at','1319250TZzxar','✔\x20Job\x20submitted','\x20row','Limit:\x20','397UUOFZo','status','result','Error:\x20Query\x20is\x20required','Getting\x20job\x20details...','2610090vkGvHZ','Show\x20job\x20details','Error:\x20Job\x20ID\x20is\x20required','data'];a24_0x3d55=function(){return _0xcb41;};return a24_0x3d55();}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x118125(0x1d8)]='jobs';[a24_0x118125(0x1d6)]=a24_0x118125(0x1a3);async[a24_0x118125(0x1ad)](_0x2e01c3){const _0x361732=a24_0x118125,{options:_0x3c572c,tdx:_0x106659}=_0x2e01c3;try{const _0x4dc6dc=resolveLimit(_0x3c572c[_0x361732(0x1d1)],DEFAULT_DISPLAY_LIMIT),_0x5f01c7=_0x3c572c['status'];_0x3c572c[_0x361732(0x1c7)]&&(console['error'](_0x361732(0x1bb)+_0x4dc6dc+_0x361732(0x1e0)),_0x5f01c7&&console[_0x361732(0x1ab)]('Status\x20filter:\x20'+_0x5f01c7));const _0x1c5f77=await withSpinner(_0x361732(0x1b5),()=>_0x106659[_0x361732(0x1ae)][_0x361732(0x1ed)]({'from':0x0,'to':_0x4dc6dc-0x1,'status':_0x5f01c7}),{'verbose':_0x3c572c[_0x361732(0x1c7)]}),_0x2b723a=_0x1c5f77['data'];console[_0x361732(0x1ab)]('✔\x20Found\x20'+_0x2b723a[_0x361732(0x1e3)]+_0x361732(0x1a7)+(_0x2b723a[_0x361732(0x1e3)]!==0x1?'s':''));const _0x5f5c96=_0x2b723a['map'](_0x2dafaf=>{const _0x31c207=_0x361732;let _0x240e9c;if(_0x2dafaf[_0x31c207(0x1df)]&&_0x2dafaf[_0x31c207(0x1b7)]){const _0x4a6f77=new Date(_0x2dafaf[_0x31c207(0x1df)])[_0x31c207(0x1b6)](),_0x38e0e3=new Date(_0x2dafaf['end_at'])[_0x31c207(0x1b6)]();_0x240e9c=Math[_0x31c207(0x1c6)]((_0x38e0e3-_0x4a6f77)/0x3e8);}return{'job_id':_0x2dafaf[_0x31c207(0x1cd)],'type':_0x2dafaf[_0x31c207(0x1e1)],'status':_0x2dafaf['status'],'user_name':_0x2dafaf[_0x31c207(0x1ea)],'duration_sec':_0x240e9c,'created_at':_0x2dafaf[_0x31c207(0x1a4)],'started_at':_0x2dafaf[_0x31c207(0x1df)],'end_at':_0x2dafaf[_0x31c207(0x1b7)]};});return await handleSDKOutput(_0x5f5c96,_0x3c572c),0x0;}catch(_0x29fa93){if(_0x29fa93 instanceof SDKError)return console[_0x361732(0x1ab)](_0x361732(0x1a2)+_0x29fa93[_0x361732(0x1a1)]),_0x29fa93[_0x361732(0x1ee)]&&console['error'](_0x361732(0x1b2)+_0x29fa93['cause']),0x1;throw _0x29fa93;}}}export class JobShowCommand extends BaseCommand{[a24_0x118125(0x1d8)]='job:show';[a24_0x118125(0x1d6)]=a24_0x118125(0x1c2);async[a24_0x118125(0x1ad)](_0x5304f2){const _0x554497=a24_0x118125,{options:_0x1eaf3f,args:_0x2d332c,tdx:_0x1b794d}=_0x5304f2,_0x4e320b=_0x2d332c[0x0];if(!_0x4e320b)return console[_0x554497(0x1ab)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x554497(0x1ab)](_0x554497(0x1ca)),0x1;try{const _0x5f23ac=await withSpinner(_0x554497(0x1c0),()=>_0x1b794d[_0x554497(0x1ae)][_0x554497(0x1cf)](_0x4e320b),{'verbose':_0x1eaf3f[_0x554497(0x1c7)]}),_0x17c09c=_0x5f23ac[_0x554497(0x1c4)];let _0x4df7c4;if(_0x17c09c['start_at']&&_0x17c09c[_0x554497(0x1b7)]){const _0x2d8210=new Date(_0x17c09c[_0x554497(0x1df)])[_0x554497(0x1b6)](),_0x331630=new Date(_0x17c09c[_0x554497(0x1b7)])['getTime']();_0x4df7c4=Math[_0x554497(0x1c6)]((_0x331630-_0x2d8210)/0x3e8);}const _0x30cc47={'job_id':_0x17c09c[_0x554497(0x1cd)],'type':_0x17c09c[_0x554497(0x1e1)],'status':_0x17c09c[_0x554497(0x1bd)],..._0x17c09c[_0x554497(0x1ea)]&&{'user_name':_0x17c09c['user_name']},..._0x4df7c4!==undefined&&{'duration_sec':_0x4df7c4},..._0x17c09c[_0x554497(0x1a4)]&&{'created_at':_0x17c09c[_0x554497(0x1a4)]},..._0x17c09c[_0x554497(0x1df)]&&{'started_at':_0x17c09c[_0x554497(0x1df)]},..._0x17c09c[_0x554497(0x1b7)]&&{'end_at':_0x17c09c[_0x554497(0x1b7)]},..._0x17c09c['database']&&{'database':_0x17c09c[_0x554497(0x1d9)]},..._0x17c09c['priority']!==undefined&&{'priority':_0x17c09c[_0x554497(0x1ac)]},..._0x17c09c[_0x554497(0x1af)]&&{'url':_0x17c09c['url']},..._0x17c09c[_0x554497(0x1aa)]&&{'query':_0x17c09c['query']},..._0x17c09c[_0x554497(0x1c8)]&&{'debug':_0x17c09c[_0x554497(0x1c8)]}};return await handleSingleObjectOutput(_0x30cc47,_0x1eaf3f),0x0;}catch(_0x5e10e5){if(_0x5e10e5 instanceof SDKError)return console[_0x554497(0x1ab)](_0x554497(0x1a2)+_0x5e10e5[_0x554497(0x1a1)]),_0x5e10e5[_0x554497(0x1ee)]&&console['error'](_0x554497(0x1b2)+_0x5e10e5['cause']),0x1;throw _0x5e10e5;}}}function a24_0x29b0(_0x596ff3,_0x578877){_0x596ff3=_0x596ff3-0x1a1;const _0x3d5533=a24_0x3d55();let _0x29b02e=_0x3d5533[_0x596ff3];return _0x29b02e;}export class JobKillCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1eb);[a24_0x118125(0x1d6)]=a24_0x118125(0x1db);async[a24_0x118125(0x1ad)](_0x500f91){const _0x18d14f=a24_0x118125,{options:_0x16b28f,args:_0x431be5,tdx:_0x489248}=_0x500f91,_0x25137a=_0x431be5[0x0];if(!_0x25137a)return console[_0x18d14f(0x1ab)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x18d14f(0x1ab)](_0x18d14f(0x1d4)),0x1;try{if(!_0x16b28f['yes']){const _0x2e7ea6=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x25137a+'?');if(!_0x2e7ea6)return console[_0x18d14f(0x1ab)]('Cancelled'),0x0;}return await withSpinner(_0x18d14f(0x1c5),()=>_0x489248[_0x18d14f(0x1ae)][_0x18d14f(0x1ec)](_0x25137a),{'verbose':_0x16b28f['verbose']}),console['error'](_0x18d14f(0x1dc)+_0x25137a),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x25137a+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x4242cf){if(_0x4242cf instanceof SDKError)return console[_0x18d14f(0x1ab)]('Error:\x20'+_0x4242cf[_0x18d14f(0x1a1)]),_0x4242cf[_0x18d14f(0x1ee)]&&console[_0x18d14f(0x1ab)](_0x18d14f(0x1b2)+_0x4242cf[_0x18d14f(0x1ee)]),0x1;throw _0x4242cf;}}}export class JobSubmitCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1a6);[a24_0x118125(0x1d6)]=a24_0x118125(0x1b0);async[a24_0x118125(0x1ad)](_0x350bbb){const _0x2149d9=a24_0x118125,{options:_0x353db8,args:_0x498853,tdx:_0x25fd46}=_0x350bbb;try{const _0x2f32a2=_0x353db8[_0x2149d9(0x1ef)]||'trino',_0x31f515=_0x353db8[_0x2149d9(0x1d7)],_0x389648=_0x353db8[_0x2149d9(0x1d9)]||_0x2149d9(0x1e2);if(_0x2f32a2!==_0x2149d9(0x1ce)&&_0x2f32a2!==_0x2149d9(0x1e5))return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b1)),0x1;let _0x7d5b69;if(_0x31f515){if(_0x498853[0x0])return console[_0x2149d9(0x1ab)](_0x2149d9(0x1d0)),0x1;const _0x2449ba=readSqlStatementsFromFile(_0x31f515);if(_0x2449ba[_0x2149d9(0x1e3)]===0x0)return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b3)),0x1;if(_0x2449ba[_0x2149d9(0x1e3)]>0x1)return console['error'](_0x2149d9(0x1e8)),0x1;_0x7d5b69=_0x2449ba[0x0];}else{if(!_0x498853[0x0])return console[_0x2149d9(0x1ab)](_0x2149d9(0x1bf)),console[_0x2149d9(0x1ab)](_0x2149d9(0x1e4)),0x1;_0x7d5b69=_0x498853[0x0];}_0x353db8[_0x2149d9(0x1c7)]&&(console[_0x2149d9(0x1ab)](_0x2149d9(0x1b4)+_0x2f32a2),console['error'](_0x2149d9(0x1d3)+_0x389648),console[_0x2149d9(0x1ab)]('Query:\x20'+_0x7d5b69['substring'](0x0,0x64)+(_0x7d5b69[_0x2149d9(0x1e3)]>0x64?_0x2149d9(0x1e6):'')));const _0x7cff2b=await withSpinner(_0x2149d9(0x1e9),()=>_0x25fd46[_0x2149d9(0x1ae)][_0x2149d9(0x1e7)](_0x389648,_0x7d5b69,_0x2f32a2),{'verbose':_0x353db8[_0x2149d9(0x1c7)]}),_0x37153d=_0x7cff2b['data'];return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b9)),console[_0x2149d9(0x1ab)](_0x2149d9(0x1d5)+_0x37153d[_0x2149d9(0x1cd)]),await handleSDKOutput([_0x37153d],_0x353db8),0x0;}catch(_0x257da3){if(_0x257da3 instanceof SDKError)return console[_0x2149d9(0x1ab)](_0x2149d9(0x1a2)+_0x257da3[_0x2149d9(0x1a1)]),_0x257da3[_0x2149d9(0x1ee)]&&console[_0x2149d9(0x1ab)](_0x2149d9(0x1b2)+_0x257da3[_0x2149d9(0x1ee)]),0x1;throw _0x257da3;}}}export class JobResultCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1a8);[a24_0x118125(0x1d6)]=a24_0x118125(0x1d2);async[a24_0x118125(0x1ad)](_0x49fff4){const _0x397a0b=a24_0x118125,{options:_0x34e72e,args:_0x244bee,tdx:_0x116999}=_0x49fff4,_0x4c3ff8=_0x244bee[0x0];if(!_0x4c3ff8)return console[_0x397a0b(0x1ab)](_0x397a0b(0x1c3)),console['error']('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x16b1b6=await withSpinner('Getting\x20job\x20results...',()=>_0x116999[_0x397a0b(0x1ae)][_0x397a0b(0x1be)](_0x4c3ff8),{'verbose':_0x34e72e[_0x397a0b(0x1c7)]}),_0xa25138=_0x16b1b6[_0x397a0b(0x1c4)];return console[_0x397a0b(0x1ab)](_0x397a0b(0x1c9)+_0xa25138[_0x397a0b(0x1e3)]+_0x397a0b(0x1ba)+(_0xa25138[_0x397a0b(0x1e3)]!==0x1?'s':'')),await handleSDKOutput(_0xa25138,_0x34e72e),0x0;}catch(_0x4b6fa2){if(_0x4b6fa2 instanceof SDKError)return console[_0x397a0b(0x1ab)](_0x397a0b(0x1a2)+_0x4b6fa2[_0x397a0b(0x1a1)]),_0x4b6fa2['cause']&&console[_0x397a0b(0x1ab)]('\x20\x20Cause:\x20'+_0x4b6fa2[_0x397a0b(0x1ee)]),0x1;throw _0x4b6fa2;}}}
1
+ const a24_0x4a821b=a24_0x4f4f;(function(_0x4604c7,_0x3bb804){const _0x5d5df5=a24_0x4f4f,_0x2bc1ad=_0x4604c7();while(!![]){try{const _0x9fa087=-parseInt(_0x5d5df5(0x1d0))/0x1+-parseInt(_0x5d5df5(0x1fc))/0x2+-parseInt(_0x5d5df5(0x200))/0x3+-parseInt(_0x5d5df5(0x1c3))/0x4*(parseInt(_0x5d5df5(0x1f1))/0x5)+-parseInt(_0x5d5df5(0x208))/0x6+parseInt(_0x5d5df5(0x1cf))/0x7*(-parseInt(_0x5d5df5(0x1c6))/0x8)+parseInt(_0x5d5df5(0x1e9))/0x9;if(_0x9fa087===_0x3bb804)break;else _0x2bc1ad['push'](_0x2bc1ad['shift']());}catch(_0xbf4732){_0x2bc1ad['push'](_0x2bc1ad['shift']());}}}(a24_0x3932,0xecaa2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]='jobs';['description']=a24_0x4a821b(0x209);async['execute'](_0x5a2bb8){const _0x461fa7=a24_0x4a821b,{options:_0x30d8a9,tdx:_0x47febc}=_0x5a2bb8;try{const _0x159e5a=resolveLimit(_0x30d8a9[_0x461fa7(0x1d2)],DEFAULT_DISPLAY_LIMIT),_0xb76334=_0x30d8a9['status'];_0x30d8a9[_0x461fa7(0x203)]&&(console[_0x461fa7(0x1e6)]('Limit:\x20'+_0x159e5a+_0x461fa7(0x1ca)),_0xb76334&&console[_0x461fa7(0x1e6)](_0x461fa7(0x1dd)+_0xb76334));const _0x54ef3f=await withSpinner(_0x461fa7(0x1f8),()=>_0x47febc[_0x461fa7(0x1fb)][_0x461fa7(0x206)]({'from':0x0,'to':_0x159e5a-0x1,'status':_0xb76334}),{'verbose':_0x30d8a9[_0x461fa7(0x203)]}),_0xbb77f6=_0x54ef3f[_0x461fa7(0x1d6)];console[_0x461fa7(0x1e6)]('✔\x20Found\x20'+_0xbb77f6[_0x461fa7(0x1e2)]+_0x461fa7(0x1f0)+(_0xbb77f6[_0x461fa7(0x1e2)]!==0x1?'s':''));const _0x5e7114=_0xbb77f6['map'](_0x5e2299=>{const _0x485c63=_0x461fa7;let _0x5bb7db;if(_0x5e2299['start_at']&&_0x5e2299[_0x485c63(0x201)]){const _0x22fcd6=new Date(_0x5e2299[_0x485c63(0x204)])[_0x485c63(0x1ed)](),_0x508ec5=new Date(_0x5e2299[_0x485c63(0x201)])[_0x485c63(0x1ed)]();_0x5bb7db=Math[_0x485c63(0x1f3)]((_0x508ec5-_0x22fcd6)/0x3e8);}return{'job_id':_0x5e2299['job_id'],'type':_0x5e2299[_0x485c63(0x1e3)],'status':_0x5e2299[_0x485c63(0x207)],'user_name':_0x5e2299['user_name'],'duration_sec':_0x5bb7db,'created_at':_0x5e2299[_0x485c63(0x1fe)],'started_at':_0x5e2299['start_at'],'end_at':_0x5e2299[_0x485c63(0x201)]};});return await handleSDKOutput(_0x5e7114,_0x30d8a9),0x0;}catch(_0x32bca7){if(_0x32bca7 instanceof SDKError)return console[_0x461fa7(0x1e6)](_0x461fa7(0x1e1)+_0x32bca7[_0x461fa7(0x1ea)]),_0x32bca7[_0x461fa7(0x1d1)]&&console['error'](_0x461fa7(0x1e4)+_0x32bca7[_0x461fa7(0x1d1)]),0x1;throw _0x32bca7;}}}function a24_0x4f4f(_0x33b1fc,_0x61380c){_0x33b1fc=_0x33b1fc-0x1bf;const _0x393266=a24_0x3932();let _0x4f4f5f=_0x393266[_0x33b1fc];return _0x4f4f5f;}export class JobShowCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1e8);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1cd);async[a24_0x4a821b(0x1bf)](_0x5bdd52){const _0x4aada3=a24_0x4a821b,{options:_0x37c61b,args:_0x11d76c,tdx:_0x3fea05}=_0x5bdd52,_0xf581ad=_0x11d76c[0x0];if(!_0xf581ad)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0x4aada3(0x1e6)](_0x4aada3(0x20b)),0x1;try{const _0x44a2c0=await withSpinner('Getting\x20job\x20details...',()=>_0x3fea05[_0x4aada3(0x1fb)]['show'](_0xf581ad),{'verbose':_0x37c61b['verbose']}),_0x49a3ed=_0x44a2c0['data'];let _0x2265e7;if(_0x49a3ed[_0x4aada3(0x204)]&&_0x49a3ed[_0x4aada3(0x201)]){const _0x3c35bd=new Date(_0x49a3ed[_0x4aada3(0x204)])[_0x4aada3(0x1ed)](),_0x37c771=new Date(_0x49a3ed[_0x4aada3(0x201)])[_0x4aada3(0x1ed)]();_0x2265e7=Math[_0x4aada3(0x1f3)]((_0x37c771-_0x3c35bd)/0x3e8);}const _0x3f2911={'job_id':_0x49a3ed[_0x4aada3(0x1dc)],'type':_0x49a3ed['type'],'status':_0x49a3ed[_0x4aada3(0x207)],..._0x49a3ed[_0x4aada3(0x1ce)]&&{'user_name':_0x49a3ed[_0x4aada3(0x1ce)]},..._0x2265e7!==undefined&&{'duration_sec':_0x2265e7},..._0x49a3ed[_0x4aada3(0x1fe)]&&{'created_at':_0x49a3ed[_0x4aada3(0x1fe)]},..._0x49a3ed[_0x4aada3(0x204)]&&{'started_at':_0x49a3ed[_0x4aada3(0x204)]},..._0x49a3ed[_0x4aada3(0x201)]&&{'end_at':_0x49a3ed[_0x4aada3(0x201)]},..._0x49a3ed[_0x4aada3(0x20d)]&&{'database':_0x49a3ed['database']},..._0x49a3ed[_0x4aada3(0x1ef)]!==undefined&&{'priority':_0x49a3ed[_0x4aada3(0x1ef)]},..._0x49a3ed['url']&&{'url':_0x49a3ed['url']},..._0x49a3ed[_0x4aada3(0x1f7)]&&{'query':_0x49a3ed[_0x4aada3(0x1f7)]},..._0x49a3ed['debug']&&{'debug':_0x49a3ed[_0x4aada3(0x1c1)]}};return await handleSingleObjectOutput(_0x3f2911,_0x37c61b),0x0;}catch(_0x148e57){if(_0x148e57 instanceof SDKError)return console[_0x4aada3(0x1e6)](_0x4aada3(0x1e1)+_0x148e57['message']),_0x148e57[_0x4aada3(0x1d1)]&&console[_0x4aada3(0x1e6)](_0x4aada3(0x1e4)+_0x148e57[_0x4aada3(0x1d1)]),0x1;throw _0x148e57;}}}export class JobKillCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1cb);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1c9);async[a24_0x4a821b(0x1bf)](_0x31b785){const _0x564724=a24_0x4a821b,{options:_0x133e0a,args:_0x1706ad,tdx:_0x332a99}=_0x31b785,_0x4292b7=_0x1706ad[0x0];if(!_0x4292b7)return console[_0x564724(0x1e6)](_0x564724(0x1de)),console[_0x564724(0x1e6)]('Usage:\x20job\x20kill\x20<job-id>'),0x1;try{if(!_0x133e0a['yes']){const _0x33206f=await confirm(_0x564724(0x1fa)+_0x4292b7+'?');if(!_0x33206f)return console['error'](_0x564724(0x1d7)),0x0;}return await withSpinner(_0x564724(0x1d9),()=>_0x332a99[_0x564724(0x1fb)][_0x564724(0x1f6)](_0x4292b7),{'verbose':_0x133e0a[_0x564724(0x203)]}),console[_0x564724(0x1e6)]('✔\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0x4292b7),console[_0x564724(0x1e6)](_0x564724(0x1e0)+_0x4292b7+_0x564724(0x1db)),0x0;}catch(_0x4eca4c){if(_0x4eca4c instanceof SDKError)return console[_0x564724(0x1e6)]('Error:\x20'+_0x4eca4c[_0x564724(0x1ea)]),_0x4eca4c[_0x564724(0x1d1)]&&console[_0x564724(0x1e6)](_0x564724(0x1e4)+_0x4eca4c[_0x564724(0x1d1)]),0x1;throw _0x4eca4c;}}}function a24_0x3932(){const _0x528722=['Error:\x20Job\x20ID\x20is\x20required','Submit\x20a\x20job','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Error:\x20','length','type','\x20\x20Cause:\x20','\x20row','error','✔\x20Job\x20submitted','job:show','76523238apSvAg','message','description','Submitting\x20job...','getTime','hive','priority','\x20job','55RuemZr','information_schema','round','jobType','Query:\x20','kill','query','Listing\x20jobs...','Getting\x20job\x20results...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','jobs','1969994YgAxpu','result','created_at','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','1698258GPTctk','end_at','trino','verbose','start_at','Database:\x20','list','status','5626314EQAziC','List\x20jobs','Job\x20type:\x20','Usage:\x20job\x20show\x20<job-id>','Error:\x20Query\x20is\x20required','database','execute','Usage:\x20job\x20result\x20<job-id>','debug','Get\x20job\x20results','685532BRXeDO','job:submit','submit','13093368oQcJaO','✔\x20Retrieved\x20','job:result','Kill\x20a\x20job','\x20jobs','job:kill','\x20\x20Job\x20ID:\x20','Show\x20job\x20details','user_name','7AHHeuR','1522518jkTgqT','cause','limit','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','file','substring','data','Cancelled','name','Submitting\x20kill\x20request...','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','\x27\x20to\x20verify\x20the\x20job\x20status','job_id','Status\x20filter:\x20'];a24_0x3932=function(){return _0x528722;};return a24_0x3932();}export class JobSubmitCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1c4);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1df);async[a24_0x4a821b(0x1bf)](_0x1b5a62){const _0x48c260=a24_0x4a821b,{options:_0x39988a,args:_0x14dc8d,tdx:_0x950484}=_0x1b5a62;try{const _0x4625f7=_0x39988a[_0x48c260(0x1f4)]||_0x48c260(0x202),_0x50b90b=_0x39988a[_0x48c260(0x1d4)],_0x2b724c=_0x39988a[_0x48c260(0x20d)]||_0x48c260(0x1f2);if(_0x4625f7!==_0x48c260(0x202)&&_0x4625f7!==_0x48c260(0x1ee))return console[_0x48c260(0x1e6)]('Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22'),0x1;let _0x5e1d7f;if(_0x50b90b){if(_0x14dc8d[0x0])return console['error'](_0x48c260(0x1d3)),0x1;const _0x5ddf19=readSqlStatementsFromFile(_0x50b90b);if(_0x5ddf19[_0x48c260(0x1e2)]===0x0)return console[_0x48c260(0x1e6)](_0x48c260(0x1ff)),0x1;if(_0x5ddf19[_0x48c260(0x1e2)]>0x1)return console[_0x48c260(0x1e6)](_0x48c260(0x1da)),0x1;_0x5e1d7f=_0x5ddf19[0x0];}else{if(!_0x14dc8d[0x0])return console[_0x48c260(0x1e6)](_0x48c260(0x20c)),console[_0x48c260(0x1e6)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x5e1d7f=_0x14dc8d[0x0];}_0x39988a['verbose']&&(console[_0x48c260(0x1e6)](_0x48c260(0x20a)+_0x4625f7),console[_0x48c260(0x1e6)](_0x48c260(0x205)+_0x2b724c),console[_0x48c260(0x1e6)](_0x48c260(0x1f5)+_0x5e1d7f[_0x48c260(0x1d5)](0x0,0x64)+(_0x5e1d7f[_0x48c260(0x1e2)]>0x64?'...':'')));const _0x2ed5dc=await withSpinner(_0x48c260(0x1ec),()=>_0x950484[_0x48c260(0x1fb)][_0x48c260(0x1c5)](_0x2b724c,_0x5e1d7f,_0x4625f7),{'verbose':_0x39988a[_0x48c260(0x203)]}),_0x18fc56=_0x2ed5dc[_0x48c260(0x1d6)];return console['error'](_0x48c260(0x1e7)),console[_0x48c260(0x1e6)](_0x48c260(0x1cc)+_0x18fc56['job_id']),await handleSDKOutput([_0x18fc56],_0x39988a),0x0;}catch(_0x3d3c68){if(_0x3d3c68 instanceof SDKError)return console['error']('Error:\x20'+_0x3d3c68['message']),_0x3d3c68[_0x48c260(0x1d1)]&&console[_0x48c260(0x1e6)](_0x48c260(0x1e4)+_0x3d3c68[_0x48c260(0x1d1)]),0x1;throw _0x3d3c68;}}}export class JobResultCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1c8);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1c2);async[a24_0x4a821b(0x1bf)](_0x546ac3){const _0x2104a3=a24_0x4a821b,{options:_0x2d3a66,args:_0x48cc0d,tdx:_0x5af2f0}=_0x546ac3,_0x4d4112=_0x48cc0d[0x0];if(!_0x4d4112)return console[_0x2104a3(0x1e6)](_0x2104a3(0x1de)),console['error'](_0x2104a3(0x1c0)),0x1;try{const _0x274e68=await withSpinner(_0x2104a3(0x1f9),()=>_0x5af2f0[_0x2104a3(0x1fb)][_0x2104a3(0x1fd)](_0x4d4112),{'verbose':_0x2d3a66[_0x2104a3(0x203)]}),_0x13ca56=_0x274e68[_0x2104a3(0x1d6)];return console[_0x2104a3(0x1e6)](_0x2104a3(0x1c7)+_0x13ca56[_0x2104a3(0x1e2)]+_0x2104a3(0x1e5)+(_0x13ca56[_0x2104a3(0x1e2)]!==0x1?'s':'')),await handleSDKOutput(_0x13ca56,_0x2d3a66),0x0;}catch(_0x5a520d){if(_0x5a520d instanceof SDKError)return console['error'](_0x2104a3(0x1e1)+_0x5a520d[_0x2104a3(0x1ea)]),_0x5a520d[_0x2104a3(0x1d1)]&&console['error'](_0x2104a3(0x1e4)+_0x5a520d['cause']),0x1;throw _0x5a520d;}}}
@@ -1 +1 @@
1
- const a25_0x2ab184=a25_0x5274;(function(_0x47ff44,_0x516ece){const _0x3f71fb=a25_0x5274,_0x58520d=_0x47ff44();while(!![]){try{const _0x44ac6f=-parseInt(_0x3f71fb(0x1a5))/0x1+-parseInt(_0x3f71fb(0x1dd))/0x2*(-parseInt(_0x3f71fb(0x1c6))/0x3)+-parseInt(_0x3f71fb(0x184))/0x4+-parseInt(_0x3f71fb(0x174))/0x5*(parseInt(_0x3f71fb(0x178))/0x6)+parseInt(_0x3f71fb(0x1ee))/0x7*(-parseInt(_0x3f71fb(0x17e))/0x8)+-parseInt(_0x3f71fb(0x1a2))/0x9*(parseInt(_0x3f71fb(0x18d))/0xa)+parseInt(_0x3f71fb(0x1e2))/0xb*(parseInt(_0x3f71fb(0x193))/0xc);if(_0x44ac6f===_0x516ece)break;else _0x58520d['push'](_0x58520d['shift']());}catch(_0x77fccc){_0x58520d['push'](_0x58520d['shift']());}}}(a25_0x2633,0x780a9));import a25_0x3cb7c7 from'chalk';import a25_0x534d5e 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'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';function a25_0x2633(){const _0x158c04=['...','Getting\x20journey\x20details...','Warning:\x20Stage\x20\x22','✔\x20Journey\x20\x22','yes','all','\x22\x20not\x20found','cyan','name','includeStats','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','journey','json','✔\x20Pulled\x20','isNew','40702ayLfrS','relative','Usage:\x20journey\x20resume\x20<name-or-path>','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','entered','11gkPrxs','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20(ID:\x20','Usage:\x20journey\x20view\x20<name-or-path>','INVALID_ARGUMENT','listFolders','log','state','yellow','join','✔\x20Found\x20','Usage:\x20journey\x20stats\x20<name-or-path>','1981OJaJnF','stageName','\x20\x20Name:\x20','stage','replace','kind','(root)','No\x20journeys\x20found','Input:\x20','map','\x5c$&','description','Parent\x20segment\x20context\x20not\x20set.\x0a','data','goal','dryRun','getStatistics','segment','launched','🗺️\x20','Getting\x20journey\x20statistics...','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Resolving\x20journey...','resolveParentId','journey:pause','journey:resume','Show\x20journey\x20statistics','97315HkvdBU','Fetching\x20','\x22\x20resumed','Listing\x20journeys...','150NbUmol','gray','exited','paused','journeyName','getJourney','26440fePwNW','segmentName','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','draft','toLowerCase','test','902820WFAfoo','journeyId','dim','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','folderId','parent_segment','journeyBundleName','journeys','199620BFyNqh','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)','Resume\x20a\x20paused\x20journey','journey:list','journey:view','\x20\x20Statistics\x20not\x20available','36184764enjvAa','📁\x20','content','resolveJourneyId','totalGoalAchieved','totalEntered','\x20\x20Parent\x20segment:\x20','\x20unchanged\x20files','Export\x20journey(s)\x20as\x20YAML\x20files','Resolving\x20parent\x20segment...','\x20\x20Folder\x20path:\x20','parentSegment','\x20journey\x20files\x20to\x20','message','\x20\x20Target:\x20','333nbbuBK','getParentFull','attributes','279976hKskow','resume','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','stages','rootFolderId','format','set','rule','execute','Error:\x20Journey\x20not\x20found:\x20','Error:\x20Parent\x20segment\x20context\x20required','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','cwd','Pausing\x20journey...','archived','Show\x20journey\x20details','Warning:\x20Could\x20not\x20resolve\x20segment\x20','green','utf-8','\x22\x20paused','Cancelled','Aborted.','goalRate','get','conversionRate','verbose','folderPath','Resolved\x20YAML\x20file:\x20','\x20files?','population','\x20journeys','filter','listJourneysFromParentSegment','21EhhcMF','No\x20statistics\x20available\x20for\x20journey:\x20','push','error','repeat','length','hasChanges','Usage:\x20journey\x20pause\x20<name-or-path>'];a25_0x2633=function(){return _0x158c04;};return a25_0x2633();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';function a25_0x5274(_0x152d1f,_0x268a16){_0x152d1f=_0x152d1f-0x15a;const _0x26339e=a25_0x2633();let _0x52740a=_0x26339e[_0x152d1f];return _0x52740a;}import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x5553e5){const _0x51a553=a25_0x5274;switch(_0x5553e5){case _0x51a553(0x16b):return a25_0x3cb7c7['green'](_0x5553e5);case _0x51a553(0x181):return a25_0x3cb7c7[_0x51a553(0x179)](_0x5553e5);case _0x51a553(0x1b3):return a25_0x3cb7c7[_0x51a553(0x186)](_0x5553e5);default:return _0x5553e5;}}function formatJourneyItem(_0x5bc6c3,_0x4c846f=''){const _0xd530bc=a25_0x5274,_0x55171b=formatJourneyState(_0x5bc6c3[_0xd530bc(0x1e9)]),_0x15e948=_0x5bc6c3['paused']?a25_0x3cb7c7[_0xd530bc(0x1ea)]('\x20(paused)'):'';return _0x4c846f+_0xd530bc(0x16c)+_0x5bc6c3[_0xd530bc(0x18b)]+'\x20('+_0x55171b+')'+_0x15e948;}function escapeRegex(_0x3adf3a){const _0x5a031f=a25_0x5274;return _0x3adf3a[_0x5a031f(0x15d)](/[.*+?^${}()|[\]\\]/g,_0x5a031f(0x163));}function globToRegex(_0x4031ff){const _0xc94ba7=a25_0x5274,_0x283354=_0x4031ff['split']('*')[_0xc94ba7(0x162)](escapeRegex);return new RegExp(_0x283354[_0xc94ba7(0x1eb)]('.*'),'i');}function resolveJourneyTarget(_0x57fd8e,_0x4cf8d5,_0x4feafd){const _0x1ac0c2=a25_0x5274;if(isYamlFilePath(_0x57fd8e))try{const _0x3fd522=resolveYamlFilePath(_0x57fd8e);return _0x4feafd&&(console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x1c0)+_0x57fd8e),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x199)+_0x3fd522[_0x1ac0c2(0x19e)]),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x15b)+_0x3fd522[_0x1ac0c2(0x17f)]),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x19d)+(_0x3fd522[_0x1ac0c2(0x1bf)]||_0x1ac0c2(0x15f)))),{'journeyName':_0x3fd522[_0x1ac0c2(0x17f)],'parentSegment':_0x3fd522[_0x1ac0c2(0x19e)],'resolved':_0x3fd522};}catch(_0x48f40f){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ac0c2(0x1a7)+_0x48f40f[_0x1ac0c2(0x1a0)]);}if(!_0x4cf8d5)throw new SDKError(ErrorCode[_0x1ac0c2(0x1e6)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x57fd8e,'parentSegment':_0x4cf8d5};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x2ab184(0x190);[a25_0x2ab184(0x164)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x2e06c6){const _0x102a09=a25_0x2ab184,{options:_0x494b2b,args:_0x7d05b4,tdx:_0x5e31e6}=_0x2e06c6,_0x41553f=_0x7d05b4[0x0],_0x88028e=_0x494b2b[_0x102a09(0x19e)];if(!_0x88028e)return console[_0x102a09(0x1c9)](_0x102a09(0x1af)),console[_0x102a09(0x1c9)](_0x102a09(0x1b0)),0x1;const _0x21b1f3=await withSpinner(_0x102a09(0x19c),()=>_0x5e31e6[_0x102a09(0x16a)][_0x102a09(0x170)](_0x88028e),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),_0x83f51d=_0x21b1f3[_0x102a09(0x166)];_0x494b2b[_0x102a09(0x1be)]&&(console[_0x102a09(0x1c9)]('Parent\x20segment:\x20'+_0x88028e+_0x102a09(0x1e4)+_0x83f51d+')'),_0x41553f&&console[_0x102a09(0x1c9)]('Pattern:\x20'+_0x41553f));const [_0x52327a,_0x20199b,_0x5a1842]=await Promise[_0x102a09(0x1d3)]([withSpinner('Fetching\x20parent\x20segment...',()=>_0x5e31e6['segment'][_0x102a09(0x1a3)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),withSpinner('Fetching\x20folders...',()=>_0x5e31e6['segment'][_0x102a09(0x1e7)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),withSpinner(_0x102a09(0x177),()=>_0x5e31e6['journey'][_0x102a09(0x1c5)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]})]),_0x2760cb=_0x52327a[_0x102a09(0x166)],_0x3867f9=_0x20199b[_0x102a09(0x166)];let _0x467b83=_0x5a1842[_0x102a09(0x166)];const _0x269d82=_0x2760cb[_0x102a09(0x1a9)],_0x59237d=new Map();for(const _0x570e52 of _0x3867f9){_0x59237d[_0x102a09(0x1ab)](_0x570e52['id'],_0x570e52[_0x102a09(0x1d6)]);}if(_0x41553f){const _0x1c05b1=globToRegex(_0x41553f);_0x467b83=_0x467b83[_0x102a09(0x1c4)](_0x23ad5c=>_0x1c05b1[_0x102a09(0x183)](_0x23ad5c[_0x102a09(0x18b)]));}console[_0x102a09(0x1c9)](_0x102a09(0x1ec)+_0x467b83[_0x102a09(0x1cb)]+'\x20journey'+(_0x467b83['length']!==0x1?'s':''));if(_0x494b2b[_0x102a09(0x1aa)]==='table')await handleSDKOutput(_0x467b83,_0x494b2b);else{if(_0x494b2b['format']===_0x102a09(0x1da))await handleSDKOutput(_0x467b83,_0x494b2b);else{console[_0x102a09(0x1e8)]('['+_0x88028e+']');const _0x14a018=new Map(),_0x11e14a=[];for(const _0x24ef86 of _0x467b83){if(!_0x24ef86[_0x102a09(0x189)]||_0x24ef86[_0x102a09(0x189)]===_0x269d82)_0x11e14a[_0x102a09(0x1c8)](_0x24ef86);else{const _0x55658d=_0x14a018['get'](_0x24ef86['folderId'])||[];_0x55658d['push'](_0x24ef86),_0x14a018[_0x102a09(0x1ab)](_0x24ef86[_0x102a09(0x189)],_0x55658d);}}for(const _0x36c472 of _0x11e14a){console['log'](formatJourneyItem(_0x36c472));}for(const [_0x45e4ea,_0x1eacd0]of _0x14a018){const _0x460d52=_0x59237d[_0x102a09(0x1bc)](_0x45e4ea)||_0x45e4ea;console[_0x102a09(0x1e8)](_0x102a09(0x194)+_0x460d52);for(const _0x534d2e of _0x1eacd0){console['log'](formatJourneyItem(_0x534d2e,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x191);[a25_0x2ab184(0x164)]=a25_0x2ab184(0x1b4);async[a25_0x2ab184(0x1ad)](_0x472a64){const _0x4cc179=a25_0x2ab184,{options:_0x36514a,args:_0x4ec0da,tdx:_0x2b1b94}=_0x472a64,_0x3e44a2=_0x4ec0da[0x0];if(!_0x3e44a2)return console[_0x4cc179(0x1c9)](_0x4cc179(0x1d8)),console['error'](_0x4cc179(0x1e5)),0x1;_0x36514a['verbose']&&console[_0x4cc179(0x1c9)](_0x4cc179(0x161)+_0x3e44a2);const _0x208e80=resolveJourneyTarget(_0x3e44a2,_0x36514a[_0x4cc179(0x19e)],_0x36514a[_0x4cc179(0x1be)]),_0x3c7fab=await withSpinner(_0x4cc179(0x19c),()=>_0x2b1b94[_0x4cc179(0x16a)][_0x4cc179(0x170)](_0x208e80[_0x4cc179(0x19e)]),{'verbose':_0x36514a[_0x4cc179(0x1be)]}),_0x254fef=_0x3c7fab[_0x4cc179(0x166)],_0x4e6318=await withSpinner(_0x4cc179(0x16f),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x196)](_0x254fef,_0x208e80[_0x4cc179(0x17c)]),{'verbose':_0x36514a['verbose']}),_0x270a70=_0x4e6318[_0x4cc179(0x166)],_0x3540b1=await withSpinner(_0x4cc179(0x1cf),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x17d)](_0x270a70),{'verbose':_0x36514a[_0x4cc179(0x1be)]}),_0x2f588f=_0x3540b1[_0x4cc179(0x166)],_0x5d6d93=_0x36514a[_0x4cc179(0x1d7)];let _0x230be2;if(_0x5d6d93)try{const _0x2a4423=await withSpinner(_0x4cc179(0x16d),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x169)](_0x270a70),{'verbose':_0x36514a['verbose']});_0x230be2=_0x2a4423['data'];}catch{_0x36514a['verbose']&&console[_0x4cc179(0x1c9)](_0x4cc179(0x192));}const _0x256098={'id':_0x2f588f['id'],'name':_0x2f588f[_0x4cc179(0x1a4)]['name'],'description':_0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x164)],'state':_0x2f588f['attributes'][_0x4cc179(0x1e9)],'paused':_0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x17b)],'reentry_mode':_0x2f588f['attributes']['reentryMode'],'stages':_0x2f588f[_0x4cc179(0x1a4)]['journeyStages']?.['length']||0x0,..._0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x167)]&&{'goal':_0x2f588f[_0x4cc179(0x1a4)]['goal']['name']},..._0x230be2&&{'statistics':{'total_entered':_0x230be2['totalEntered'],'goal_achieved':_0x230be2[_0x4cc179(0x197)],'goal_rate':_0x230be2['goalRate'],'stages':_0x230be2[_0x4cc179(0x1a8)]}}};return await handleSingleObjectOutput(_0x256098,_0x36514a),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]='journey:stats';[a25_0x2ab184(0x164)]=a25_0x2ab184(0x173);async[a25_0x2ab184(0x1ad)](_0x3131ae){const _0x4dc009=a25_0x2ab184,{options:_0x4444e1,args:_0x442b3e,tdx:_0x2ffe1a}=_0x3131ae,_0x5643eb=_0x442b3e[0x0];if(!_0x5643eb)return console[_0x4dc009(0x1c9)](_0x4dc009(0x1d8)),console[_0x4dc009(0x1c9)](_0x4dc009(0x1ed)),0x1;_0x4444e1[_0x4dc009(0x1be)]&&console['error'](_0x4dc009(0x161)+_0x5643eb);const _0x2ceab8=resolveJourneyTarget(_0x5643eb,_0x4444e1['parentSegment'],_0x4444e1[_0x4dc009(0x1be)]),_0x9b1ed7=await withSpinner(_0x4dc009(0x19c),()=>_0x2ffe1a[_0x4dc009(0x16a)][_0x4dc009(0x170)](_0x2ceab8[_0x4dc009(0x19e)]),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x36f9e2=_0x9b1ed7[_0x4dc009(0x166)],_0x5561c5=await withSpinner(_0x4dc009(0x16f),()=>_0x2ffe1a['journey']['resolveJourneyId'](_0x36f9e2,_0x2ceab8[_0x4dc009(0x17c)]),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x1fda1f=_0x5561c5[_0x4dc009(0x166)],_0x3081fc=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x2ffe1a[_0x4dc009(0x1d9)]['getStatistics'](_0x1fda1f),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x7d7f5b=_0x3081fc[_0x4dc009(0x166)];if(!_0x7d7f5b||_0x7d7f5b[_0x4dc009(0x185)]===null)return console[_0x4dc009(0x1c9)](_0x4dc009(0x1c7)+_0x2ceab8[_0x4dc009(0x17c)]),console['error'](_0x4dc009(0x1e0)),0x0;const _0x2a74aa={'journey_id':_0x7d7f5b[_0x4dc009(0x185)],'total_entered':_0x7d7f5b[_0x4dc009(0x198)],'goal_achieved':_0x7d7f5b[_0x4dc009(0x197)],'goal_rate':_0x7d7f5b[_0x4dc009(0x1bb)],'stages':_0x7d7f5b['stages']?.[_0x4dc009(0x162)](_0x97f974=>({'name':_0x97f974[_0x4dc009(0x15a)],'population':_0x97f974[_0x4dc009(0x1c2)],'entered':_0x97f974[_0x4dc009(0x1e1)],'exited':_0x97f974['exited'],'conversion_rate':_0x97f974[_0x4dc009(0x1bd)]}))},_0x2b7bd9=_0x4444e1[_0x4dc009(0x15c)];if(_0x2b7bd9&&_0x7d7f5b[_0x4dc009(0x1a8)]){const _0x2e6d1c=_0x7d7f5b['stages']['find'](_0x22e199=>_0x22e199[_0x4dc009(0x15a)][_0x4dc009(0x182)]()===_0x2b7bd9[_0x4dc009(0x182)]());if(_0x2e6d1c)return await handleSingleObjectOutput({'stage_name':_0x2e6d1c[_0x4dc009(0x15a)],'population':_0x2e6d1c[_0x4dc009(0x1c2)],'entered':_0x2e6d1c['entered'],'exited':_0x2e6d1c[_0x4dc009(0x17a)],'conversion_rate':_0x2e6d1c[_0x4dc009(0x1bd)]},_0x4444e1),0x0;console[_0x4dc009(0x1c9)](_0x4dc009(0x1d0)+_0x2b7bd9+_0x4dc009(0x1d4));}return await handleSingleObjectOutput(_0x2a74aa,_0x4444e1),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x171);[a25_0x2ab184(0x164)]='Pause\x20a\x20running\x20journey';async['execute'](_0x37110c){const _0x16e5d1=a25_0x2ab184,{options:_0x501e20,args:_0x52c8b4,tdx:_0x3f5f5d}=_0x37110c,_0x16c8a5=_0x52c8b4[0x0];if(!_0x16c8a5)return console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1d8)),console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1cd)),0x1;_0x501e20[_0x16e5d1(0x1be)]&&console[_0x16e5d1(0x1c9)](_0x16e5d1(0x161)+_0x16c8a5);const _0xd0b865=resolveJourneyTarget(_0x16c8a5,_0x501e20['parentSegment'],_0x501e20[_0x16e5d1(0x1be)]),_0x10f231=await withSpinner(_0x16e5d1(0x19c),()=>_0x3f5f5d['segment'][_0x16e5d1(0x170)](_0xd0b865['parentSegment']),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x1b1630=_0x10f231[_0x16e5d1(0x166)],_0x46445b=await withSpinner(_0x16e5d1(0x16f),()=>_0x3f5f5d[_0x16e5d1(0x1d9)][_0x16e5d1(0x196)](_0x1b1630,_0xd0b865[_0x16e5d1(0x17c)]),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x1c674c=_0x46445b[_0x16e5d1(0x166)];if(!_0x501e20[_0x16e5d1(0x1d2)]){const _0x58e030=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0xd0b865['journeyName']+'\x22?');if(!_0x58e030)return console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1b9)),0x0;}const _0x10cfa0=await withSpinner(_0x16e5d1(0x1b2),()=>_0x3f5f5d['journey']['pause'](_0x1c674c),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x15fbd5=_0x10cfa0[_0x16e5d1(0x166)];return console['error'](_0x16e5d1(0x1d1)+_0x15fbd5['attributes'][_0x16e5d1(0x1d6)]+_0x16e5d1(0x1b8)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x172);[a25_0x2ab184(0x164)]=a25_0x2ab184(0x18f);async[a25_0x2ab184(0x1ad)](_0x394d89){const _0x2bc67d=a25_0x2ab184,{options:_0x7ba997,args:_0x464980,tdx:_0x529142}=_0x394d89,_0x31b4a2=_0x464980[0x0];if(!_0x31b4a2)return console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1d8)),console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1df)),0x1;_0x7ba997[_0x2bc67d(0x1be)]&&console[_0x2bc67d(0x1c9)](_0x2bc67d(0x161)+_0x31b4a2);const _0x1f1dca=resolveJourneyTarget(_0x31b4a2,_0x7ba997[_0x2bc67d(0x19e)],_0x7ba997['verbose']),_0x4ea90d=await withSpinner(_0x2bc67d(0x19c),()=>_0x529142[_0x2bc67d(0x16a)][_0x2bc67d(0x170)](_0x1f1dca[_0x2bc67d(0x19e)]),{'verbose':_0x7ba997['verbose']}),_0x1ef221=_0x4ea90d[_0x2bc67d(0x166)],_0x109811=await withSpinner('Resolving\x20journey...',()=>_0x529142[_0x2bc67d(0x1d9)]['resolveJourneyId'](_0x1ef221,_0x1f1dca['journeyName']),{'verbose':_0x7ba997[_0x2bc67d(0x1be)]}),_0x3c9182=_0x109811[_0x2bc67d(0x166)];if(!_0x7ba997['yes']){const _0x186c3f=await confirm(_0x2bc67d(0x188)+_0x1f1dca[_0x2bc67d(0x17c)]+'\x22?');if(!_0x186c3f)return console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1b9)),0x0;}const _0x14c3ca=await withSpinner('Resuming\x20journey...',()=>_0x529142['journey'][_0x2bc67d(0x1a6)](_0x3c9182),{'verbose':_0x7ba997[_0x2bc67d(0x1be)]}),_0x372802=_0x14c3ca[_0x2bc67d(0x166)];return console[_0x2bc67d(0x1c9)]('✔\x20Journey\x20\x22'+_0x372802['attributes'][_0x2bc67d(0x1d6)]+_0x2bc67d(0x176)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]='journey:pull';['description']=a25_0x2ab184(0x19b);async['execute'](_0x489d92){const _0x1ddc51=a25_0x2ab184,{options:_0xa56297,args:_0x28d363,tdx:_0x92fb29}=_0x489d92,_0x4e6b12=_0xa56297,_0x14e769=_0x28d363[0x0],_0x5ea764=findTdxConfigPath();let _0xb4f0b9,_0x73b31a;if(_0x5ea764){const _0x51a331=loadTdxConfig(_0x5ea764);_0xb4f0b9=_0x51a331[_0x1ddc51(0x18a)],_0x73b31a=a25_0x534d5e[_0x1ddc51(0x1eb)](a25_0x534d5e['dirname'](_0x5ea764),'journeys'),_0x4e6b12[_0x1ddc51(0x1be)]&&(console['error']('Found\x20existing\x20tdx.json\x20at:\x20'+_0x5ea764),console[_0x1ddc51(0x1c9)]('Using\x20parent\x20segment:\x20'+_0xb4f0b9));}else{_0xb4f0b9=_0xa56297['parentSegment'];if(!_0xb4f0b9)return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1ea)](_0x1ddc51(0x165))),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x18e)),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x180)),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x187)),0x1;_0x73b31a=a25_0x534d5e[_0x1ddc51(0x1eb)](getSegmentRootDir(sanitizeFileName(_0xb4f0b9)),_0x1ddc51(0x18c));}const _0x5277a3=await withSpinner(_0x1ddc51(0x19c),()=>_0x92fb29[_0x1ddc51(0x16a)][_0x1ddc51(0x170)](_0xb4f0b9),{'verbose':_0xa56297[_0x1ddc51(0x1be)]}),_0x3c2591=_0x5277a3[_0x1ddc51(0x166)],_0x4fd281=await withSpinner(_0x1ddc51(0x177),()=>_0x92fb29[_0x1ddc51(0x1d9)][_0x1ddc51(0x1c5)](_0x3c2591),{'verbose':_0xa56297[_0x1ddc51(0x1be)]});let _0x400628=_0x4fd281['data'];if(_0x14e769){const _0x42dcfc=_0x400628[_0x1ddc51(0x1c4)](_0x59f529=>_0x59f529[_0x1ddc51(0x18b)]['toLowerCase']()===_0x14e769[_0x1ddc51(0x182)]());if(_0x42dcfc[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1ae)+_0x14e769),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1e3)),0x1;_0x400628=_0x42dcfc;}if(_0x400628[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x160)),0x0;const _0x53d29b=[];for(const _0x11246a of _0x400628){const _0x3b87b7=await withSpinner(_0x1ddc51(0x175)+_0x11246a['journeyBundleName']+_0x1ddc51(0x1ce),()=>_0x92fb29['journey'][_0x1ddc51(0x17d)](_0x11246a['id']),{'verbose':_0xa56297['verbose']}),_0x336d89=_0x3b87b7[_0x1ddc51(0x166)],_0x51c0f0=_0x336d89[_0x1ddc51(0x1a4)]?.['audienceId'],_0xc7346f={'resolveSegment':async _0x49656e=>{const _0xcc6d1a=_0x1ddc51;if(!_0x51c0f0)return{'name':_0x49656e,'isJourneyLocal':![]};try{const _0x42f582=await _0x92fb29[_0xcc6d1a(0x16a)]['getSegment'](_0x51c0f0,_0x49656e),_0x3b9937=_0x42f582[_0xcc6d1a(0x15e)]===SEGMENT_KIND_JOURNEY;let _0x322d91;return _0x3b9937&&_0x42f582[_0xcc6d1a(0x1ac)]&&(_0x322d91={'description':_0x42f582[_0xcc6d1a(0x164)],'rule':apiRuleToYaml(_0x42f582[_0xcc6d1a(0x1ac)])}),{'name':_0x42f582['name'],'isJourneyLocal':_0x3b9937,'definition':_0x322d91};}catch(_0x1b873f){return _0xa56297['verbose']&&console[_0xcc6d1a(0x1c9)](_0xcc6d1a(0x1b5)+_0x49656e+':\x20'+_0x1b873f['message']),{'name':_0x49656e,'isJourneyLocal':![]};}}},_0xb20a1=await apiToYamlAsync(_0x336d89,_0xc7346f),_0x4661df=toYamlString(_0xb20a1),_0x106502=sanitizeFileName(_0x11246a[_0x1ddc51(0x18b)]),_0x5b0e69=a25_0x534d5e[_0x1ddc51(0x1eb)](_0x73b31a,_0x106502+'.yml'),_0x356ce3=a25_0x534d5e[_0x1ddc51(0x1de)](process[_0x1ddc51(0x1b1)](),_0x5b0e69);if(existsSync(_0x5b0e69)){const _0x5408f6=readFileSync(_0x5b0e69,_0x1ddc51(0x1b7)),_0x8f1a93=generateDiff(_0x5408f6,_0x4661df),_0x36c5de=hasChanges(_0x8f1a93);_0x53d29b[_0x1ddc51(0x1c8)]({'relativePath':_0x356ce3,'absolutePath':_0x5b0e69,'content':_0x4661df,'isNew':![],'hasChanges':_0x36c5de,'diff':_0x36c5de?formatDiffWithColors(_0x8f1a93):undefined});}else _0x53d29b[_0x1ddc51(0x1c8)]({'relativePath':_0x356ce3,'absolutePath':_0x5b0e69,'content':_0x4661df,'isNew':!![],'hasChanges':![]});}const _0x11a33d=_0x53d29b[_0x1ddc51(0x1c4)](_0x1ef6d5=>_0x1ef6d5[_0x1ddc51(0x1dc)]),_0xaa0b1=_0x53d29b['filter'](_0x5715ef=>!_0x5715ef[_0x1ddc51(0x1dc)]&&_0x5715ef[_0x1ddc51(0x1cc)]),_0x48390f=_0x53d29b[_0x1ddc51(0x1c4)](_0x48d430=>!_0x48d430[_0x1ddc51(0x1dc)]&&!_0x48d430[_0x1ddc51(0x1cc)]);console[_0x1ddc51(0x1c9)]('\x0aPull\x20summary:'),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1d5)](_0x400628['length']+_0x1ddc51(0x1c3))),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1b6)]('+\x20'+_0x11a33d[_0x1ddc51(0x1cb)]+'\x20new\x20files')),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1ea)]('~\x20'+_0xaa0b1[_0x1ddc51(0x1cb)]+'\x20changed\x20files')),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x186)]('=\x20'+_0x48390f['length']+_0x1ddc51(0x19a))),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1a1)+a25_0x3cb7c7[_0x1ddc51(0x1d5)](_0x73b31a)+'\x0a');if(_0xaa0b1['length']>0x0)for(const _0x51460b of _0xaa0b1){console[_0x1ddc51(0x1c9)]('\x0aChanges\x20to\x20\x27'+_0x51460b['relativePath']+'\x27:'),console[_0x1ddc51(0x1c9)]('─'[_0x1ddc51(0x1ca)](0x3c)),console[_0x1ddc51(0x1c9)](_0x51460b['diff']),console[_0x1ddc51(0x1c9)]('─'[_0x1ddc51(0x1ca)](0x3c));}if(_0x4e6b12[_0x1ddc51(0x168)])return console['error'](a25_0x3cb7c7[_0x1ddc51(0x1ea)](_0x1ddc51(0x16e))),0x0;if(_0x11a33d[_0x1ddc51(0x1cb)]===0x0&&_0xaa0b1[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1b6)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),0x0;if(!_0x4e6b12[_0x1ddc51(0x1d2)]&&(_0x11a33d[_0x1ddc51(0x1cb)]>0x0||_0xaa0b1[_0x1ddc51(0x1cb)]>0x0)){const _0x11f06b=await confirmKey('Write\x20'+(_0x11a33d['length']+_0xaa0b1[_0x1ddc51(0x1cb)])+_0x1ddc51(0x1c1));if(!_0x11f06b)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1ba)),0x1;}!existsSync(_0x73b31a)&&mkdirSync(_0x73b31a,{'recursive':!![]});for(const _0xc022db of _0x53d29b){(_0xc022db[_0x1ddc51(0x1dc)]||_0xc022db['hasChanges'])&&writeFileSync(_0xc022db['absolutePath'],_0xc022db[_0x1ddc51(0x195)],_0x1ddc51(0x1b7));}return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1b6)](_0x1ddc51(0x1db)+(_0x11a33d[_0x1ddc51(0x1cb)]+_0xaa0b1[_0x1ddc51(0x1cb)])+_0x1ddc51(0x19f)+_0x73b31a)),0x0;}}
1
+ const a25_0x1e7db8=a25_0x34da;(function(_0x6a3012,_0x2eaf87){const _0xdd187=a25_0x34da,_0x5d1d1c=_0x6a3012();while(!![]){try{const _0x3a292e=parseInt(_0xdd187(0xcd))/0x1*(-parseInt(_0xdd187(0xec))/0x2)+-parseInt(_0xdd187(0x139))/0x3+-parseInt(_0xdd187(0x126))/0x4*(-parseInt(_0xdd187(0xbc))/0x5)+parseInt(_0xdd187(0xc8))/0x6*(parseInt(_0xdd187(0x132))/0x7)+parseInt(_0xdd187(0x13d))/0x8*(parseInt(_0xdd187(0x129))/0x9)+parseInt(_0xdd187(0xcf))/0xa*(-parseInt(_0xdd187(0x105))/0xb)+parseInt(_0xdd187(0x12e))/0xc*(-parseInt(_0xdd187(0xef))/0xd);if(_0x3a292e===_0x2eaf87)break;else _0x5d1d1c['push'](_0x5d1d1c['shift']());}catch(_0x2d909c){_0x5d1d1c['push'](_0x5d1d1c['shift']());}}}(a25_0x1cb3,0x33715));import a25_0x2a9a22 from'chalk';import a25_0x4ac36d 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'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a25_0x1cb3(){const _0x27e827=['getJourney','🗺️\x20','replace','map','\x20(paused)','📁\x20','\x20unchanged\x20files','Input:\x20','Resume\x20a\x20paused\x20journey','parent_segment','Write\x20','Resuming\x20journey...','all','\x20changed\x20files','187847mkKeiY','journey:pull','\x22\x20not\x20found','Listing\x20journeys...','rule','cyan','stages','json','stage','set','filter','totalGoalAchieved','push','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Usage:\x20journey\x20pause\x20<name-or-path>','entered','Usage:\x20journey\x20resume\x20<name-or-path>','\x20files?','execute','Cancelled','No\x20statistics\x20available\x20for\x20journey:\x20','Found\x20existing\x20tdx.json\x20at:\x20','\x22\x20resumed','segment','reentryMode','Fetching\x20parent\x20segment...','hasChanges','yes','rootFolderId','segmentName','Pausing\x20journey...','draft','state','4052RuFIjN','journey:pause','\x20\x20Folder\x20path:\x20','198657gtrEHl','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','parentSegment','name','journey:view','103932PwiXbD','\x20journey\x20files\x20to\x20','goal','error','1162147mLhqGA','...','\x0aChanges\x20to\x20\x27','repeat','dryRun','✔\x20Found\x20','get','45159mhuqzu','message','kind','Parent\x20segment:\x20','64eJXrxR','✔\x20Pulled\x20','goalRate','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)','conversionRate','archived','listJourneysFromParentSegment','journey:stats','\x0aPull\x20summary:','diff','Using\x20parent\x20segment:\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Usage:\x20journey\x20view\x20<name-or-path>','.yml','✔\x20All\x20files\x20are\x20up\x20to\x20date','table','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','totalEntered','green','journeyName','Aborted.','yellow','gray','1865gOvRuS','folderId','population','journeys','log','resume','split','format','includeStats','isNew','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','6pcKNAR','Getting\x20journey\x20statistics...','data','Export\x20journey(s)\x20as\x20YAML\x20files','✔\x20Journey\x20\x22','175705SfpkCk','List\x20journeys\x20in\x20current\x20context','60oZkLSU','journey:list','resolveParentId','Usage:\x20journey\x20stats\x20<name-or-path>','relative','(root)','length','getStatistics','audienceId','Resolving\x20parent\x20segment...','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','listFolders','absolutePath','journey','journeyBundleName','toLowerCase','resolveJourneyId','Resolved\x20YAML\x20file:\x20','description','utf-8','dim','attributes','join','INVALID_ARGUMENT','paused','relativePath','stageName','\x20journey','Resolving\x20journey...','2lPFTJu','verbose','dirname','325PapsrL','\x20\x20Target:\x20','Show\x20journey\x20details','Warning:\x20Stage\x20\x22','\x5c$&','journeyId','folderPath','\x20journeys'];a25_0x1cb3=function(){return _0x27e827;};return a25_0x1cb3();}import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x209c0f){const _0x1ecb51=a25_0x34da;switch(_0x209c0f){case'launched':return a25_0x2a9a22['green'](_0x209c0f);case _0x1ecb51(0x124):return a25_0x2a9a22[_0x1ecb51(0xbb)](_0x209c0f);case _0x1ecb51(0x142):return a25_0x2a9a22[_0x1ecb51(0xe3)](_0x209c0f);default:return _0x209c0f;}}function formatJourneyItem(_0x567cae,_0x5906b7=''){const _0x4ada8e=a25_0x34da,_0x23cacc=formatJourneyState(_0x567cae[_0x4ada8e(0x125)]),_0x3f5eae=_0x567cae[_0x4ada8e(0xe7)]?a25_0x2a9a22[_0x4ada8e(0xba)](_0x4ada8e(0xfb)):'';return _0x5906b7+_0x4ada8e(0xf8)+_0x567cae['journeyBundleName']+'\x20('+_0x23cacc+')'+_0x3f5eae;}function escapeRegex(_0x34ed73){const _0x14ebc6=a25_0x34da;return _0x34ed73[_0x14ebc6(0xf9)](/[.*+?^${}()|[\]\\]/g,_0x14ebc6(0xf3));}function globToRegex(_0x3f923e){const _0x4e8c38=a25_0x34da,_0x2d0d53=_0x3f923e[_0x4e8c38(0xc2)]('*')[_0x4e8c38(0xfa)](escapeRegex);return new RegExp(_0x2d0d53[_0x4e8c38(0xe5)]('.*'),'i');}function a25_0x34da(_0x4309ed,_0x99acb8){_0x4309ed=_0x4309ed-0xb4;const _0x1cb34d=a25_0x1cb3();let _0x34da63=_0x1cb34d[_0x4309ed];return _0x34da63;}function resolveJourneyTarget(_0x25720c,_0x2bd230,_0xf091d4){const _0x37770a=a25_0x34da;if(isYamlFilePath(_0x25720c))try{const _0xd89cc0=resolveYamlFilePath(_0x25720c);return _0xf091d4&&(console['error'](_0x37770a(0xe0)+_0x25720c),console['error']('\x20\x20Parent\x20segment:\x20'+_0xd89cc0[_0x37770a(0x12b)]),console['error']('\x20\x20Name:\x20'+_0xd89cc0['segmentName']),console[_0x37770a(0x131)](_0x37770a(0x128)+(_0xd89cc0[_0x37770a(0xf5)]||_0x37770a(0xd4)))),{'journeyName':_0xd89cc0[_0x37770a(0x122)],'parentSegment':_0xd89cc0[_0x37770a(0x12b)],'resolved':_0xd89cc0};}catch(_0x299ccd){throw new SDKError(ErrorCode[_0x37770a(0xe6)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x299ccd[_0x37770a(0x13a)]);}if(!_0x2bd230)throw new SDKError(ErrorCode[_0x37770a(0xe6)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x25720c,'parentSegment':_0x2bd230};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x1e7db8(0xd0);['description']=a25_0x1e7db8(0xce);async[a25_0x1e7db8(0x117)](_0x3c80bb){const _0x1bad39=a25_0x1e7db8,{options:_0xa347d7,args:_0x244faf,tdx:_0x477824}=_0x3c80bb,_0x5e3cca=_0x244faf[0x0],_0x5b6b4a=_0xa347d7[_0x1bad39(0x12b)];if(!_0x5b6b4a)return console['error']('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x1bad39(0x131)](_0x1bad39(0xc6)),0x1;const _0x51f741=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x477824[_0x1bad39(0x11c)][_0x1bad39(0xd1)](_0x5b6b4a),{'verbose':_0xa347d7[_0x1bad39(0xed)]}),_0x44aae2=_0x51f741[_0x1bad39(0xca)];_0xa347d7[_0x1bad39(0xed)]&&(console[_0x1bad39(0x131)](_0x1bad39(0x13c)+_0x5b6b4a+'\x20(ID:\x20'+_0x44aae2+')'),_0x5e3cca&&console[_0x1bad39(0x131)]('Pattern:\x20'+_0x5e3cca));const [_0x3ee651,_0x3be8b1,_0xb84a41]=await Promise[_0x1bad39(0x103)]([withSpinner(_0x1bad39(0x11e),()=>_0x477824['segment']['getParentFull'](_0x44aae2),{'verbose':_0xa347d7[_0x1bad39(0xed)]}),withSpinner('Fetching\x20folders...',()=>_0x477824[_0x1bad39(0x11c)][_0x1bad39(0xda)](_0x44aae2),{'verbose':_0xa347d7[_0x1bad39(0xed)]}),withSpinner('Listing\x20journeys...',()=>_0x477824[_0x1bad39(0xdc)]['listJourneysFromParentSegment'](_0x44aae2),{'verbose':_0xa347d7[_0x1bad39(0xed)]})]),_0x3ab69b=_0x3ee651[_0x1bad39(0xca)],_0x3dcbc9=_0x3be8b1[_0x1bad39(0xca)];let _0x6f60a0=_0xb84a41['data'];const _0x25d1ac=_0x3ab69b[_0x1bad39(0x121)],_0x2a2540=new Map();for(const _0x1afe41 of _0x3dcbc9){_0x2a2540[_0x1bad39(0x10e)](_0x1afe41['id'],_0x1afe41[_0x1bad39(0x12c)]);}if(_0x5e3cca){const _0x28520c=globToRegex(_0x5e3cca);_0x6f60a0=_0x6f60a0['filter'](_0x59f6ab=>_0x28520c['test'](_0x59f6ab[_0x1bad39(0xdd)]));}console[_0x1bad39(0x131)](_0x1bad39(0x137)+_0x6f60a0[_0x1bad39(0xd5)]+_0x1bad39(0xea)+(_0x6f60a0[_0x1bad39(0xd5)]!==0x1?'s':''));if(_0xa347d7['format']===_0x1bad39(0xb4))await handleSDKOutput(_0x6f60a0,_0xa347d7);else{if(_0xa347d7[_0x1bad39(0xc3)]===_0x1bad39(0x10c))await handleSDKOutput(_0x6f60a0,_0xa347d7);else{console[_0x1bad39(0xc0)]('['+_0x5b6b4a+']');const _0x18040e=new Map(),_0x5887a1=[];for(const _0x54da4d of _0x6f60a0){if(!_0x54da4d[_0x1bad39(0xbd)]||_0x54da4d[_0x1bad39(0xbd)]===_0x25d1ac)_0x5887a1[_0x1bad39(0x111)](_0x54da4d);else{const _0x4ba4c4=_0x18040e[_0x1bad39(0x138)](_0x54da4d[_0x1bad39(0xbd)])||[];_0x4ba4c4[_0x1bad39(0x111)](_0x54da4d),_0x18040e['set'](_0x54da4d[_0x1bad39(0xbd)],_0x4ba4c4);}}for(const _0x353cd3 of _0x5887a1){console['log'](formatJourneyItem(_0x353cd3));}for(const [_0x3492b8,_0x5b2327]of _0x18040e){const _0xcec678=_0x2a2540[_0x1bad39(0x138)](_0x3492b8)||_0x3492b8;console['log'](_0x1bad39(0xfc)+_0xcec678);for(const _0x39fd4f of _0x5b2327){console[_0x1bad39(0xc0)](formatJourneyItem(_0x39fd4f,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x12d);[a25_0x1e7db8(0xe1)]=a25_0x1e7db8(0xf1);async['execute'](_0x1dabea){const _0x29349e=a25_0x1e7db8,{options:_0x10da56,args:_0x1b9e56,tdx:_0x2a6a2d}=_0x1dabea,_0x5f2bb9=_0x1b9e56[0x0];if(!_0x5f2bb9)return console[_0x29349e(0x131)](_0x29349e(0xb5)),console['error'](_0x29349e(0x14a)),0x1;_0x10da56[_0x29349e(0xed)]&&console[_0x29349e(0x131)](_0x29349e(0xfe)+_0x5f2bb9);const _0x121cbf=resolveJourneyTarget(_0x5f2bb9,_0x10da56[_0x29349e(0x12b)],_0x10da56[_0x29349e(0xed)]),_0x110769=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2a6a2d[_0x29349e(0x11c)][_0x29349e(0xd1)](_0x121cbf[_0x29349e(0x12b)]),{'verbose':_0x10da56[_0x29349e(0xed)]}),_0x5168b0=_0x110769[_0x29349e(0xca)],_0x4dcf2c=await withSpinner(_0x29349e(0xeb),()=>_0x2a6a2d['journey'][_0x29349e(0xdf)](_0x5168b0,_0x121cbf[_0x29349e(0xb8)]),{'verbose':_0x10da56[_0x29349e(0xed)]}),_0x12188a=_0x4dcf2c[_0x29349e(0xca)],_0x49272b=await withSpinner('Getting\x20journey\x20details...',()=>_0x2a6a2d[_0x29349e(0xdc)]['getJourney'](_0x12188a),{'verbose':_0x10da56['verbose']}),_0x311e08=_0x49272b[_0x29349e(0xca)],_0x150141=_0x10da56[_0x29349e(0xc4)];let _0x12e874;if(_0x150141)try{const _0x3cbb0f=await withSpinner(_0x29349e(0xc9),()=>_0x2a6a2d[_0x29349e(0xdc)][_0x29349e(0xd6)](_0x12188a),{'verbose':_0x10da56['verbose']});_0x12e874=_0x3cbb0f[_0x29349e(0xca)];}catch{_0x10da56['verbose']&&console['error']('\x20\x20Statistics\x20not\x20available');}const _0x48b4ae={'id':_0x311e08['id'],'name':_0x311e08['attributes']['name'],'description':_0x311e08['attributes'][_0x29349e(0xe1)],'state':_0x311e08['attributes'][_0x29349e(0x125)],'paused':_0x311e08[_0x29349e(0xe4)][_0x29349e(0xe7)],'reentry_mode':_0x311e08[_0x29349e(0xe4)][_0x29349e(0x11d)],'stages':_0x311e08[_0x29349e(0xe4)]['journeyStages']?.[_0x29349e(0xd5)]||0x0,..._0x311e08['attributes'][_0x29349e(0x130)]&&{'goal':_0x311e08[_0x29349e(0xe4)][_0x29349e(0x130)][_0x29349e(0x12c)]},..._0x12e874&&{'statistics':{'total_entered':_0x12e874[_0x29349e(0xb6)],'goal_achieved':_0x12e874[_0x29349e(0x110)],'goal_rate':_0x12e874[_0x29349e(0x13f)],'stages':_0x12e874[_0x29349e(0x10b)]}}};return await handleSingleObjectOutput(_0x48b4ae,_0x10da56),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x144);[a25_0x1e7db8(0xe1)]='Show\x20journey\x20statistics';async[a25_0x1e7db8(0x117)](_0xf85263){const _0x1f0d03=a25_0x1e7db8,{options:_0x1a5a29,args:_0x2eb0d1,tdx:_0x2fd0df}=_0xf85263,_0x43fe8e=_0x2eb0d1[0x0];if(!_0x43fe8e)return console[_0x1f0d03(0x131)](_0x1f0d03(0xb5)),console[_0x1f0d03(0x131)](_0x1f0d03(0xd2)),0x1;_0x1a5a29[_0x1f0d03(0xed)]&&console['error'](_0x1f0d03(0xfe)+_0x43fe8e);const _0x118df6=resolveJourneyTarget(_0x43fe8e,_0x1a5a29[_0x1f0d03(0x12b)],_0x1a5a29[_0x1f0d03(0xed)]),_0x3d3543=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2fd0df[_0x1f0d03(0x11c)][_0x1f0d03(0xd1)](_0x118df6[_0x1f0d03(0x12b)]),{'verbose':_0x1a5a29[_0x1f0d03(0xed)]}),_0x271e36=_0x3d3543[_0x1f0d03(0xca)],_0x8ab469=await withSpinner(_0x1f0d03(0xeb),()=>_0x2fd0df[_0x1f0d03(0xdc)][_0x1f0d03(0xdf)](_0x271e36,_0x118df6[_0x1f0d03(0xb8)]),{'verbose':_0x1a5a29['verbose']}),_0x27b297=_0x8ab469[_0x1f0d03(0xca)],_0x230d17=await withSpinner(_0x1f0d03(0xc9),()=>_0x2fd0df[_0x1f0d03(0xdc)][_0x1f0d03(0xd6)](_0x27b297),{'verbose':_0x1a5a29[_0x1f0d03(0xed)]}),_0x2801bc=_0x230d17[_0x1f0d03(0xca)];if(!_0x2801bc||_0x2801bc[_0x1f0d03(0xf4)]===null)return console['error'](_0x1f0d03(0x119)+_0x118df6[_0x1f0d03(0xb8)]),console[_0x1f0d03(0x131)](_0x1f0d03(0xd9)),0x0;const _0x589123={'journey_id':_0x2801bc[_0x1f0d03(0xf4)],'total_entered':_0x2801bc[_0x1f0d03(0xb6)],'goal_achieved':_0x2801bc[_0x1f0d03(0x110)],'goal_rate':_0x2801bc[_0x1f0d03(0x13f)],'stages':_0x2801bc[_0x1f0d03(0x10b)]?.['map'](_0x364abc=>({'name':_0x364abc[_0x1f0d03(0xe9)],'population':_0x364abc[_0x1f0d03(0xbe)],'entered':_0x364abc['entered'],'exited':_0x364abc['exited'],'conversion_rate':_0x364abc[_0x1f0d03(0x141)]}))},_0x3eada2=_0x1a5a29[_0x1f0d03(0x10d)];if(_0x3eada2&&_0x2801bc[_0x1f0d03(0x10b)]){const _0x2abe53=_0x2801bc[_0x1f0d03(0x10b)]['find'](_0x112f11=>_0x112f11[_0x1f0d03(0xe9)]['toLowerCase']()===_0x3eada2['toLowerCase']());if(_0x2abe53)return await handleSingleObjectOutput({'stage_name':_0x2abe53[_0x1f0d03(0xe9)],'population':_0x2abe53[_0x1f0d03(0xbe)],'entered':_0x2abe53[_0x1f0d03(0x114)],'exited':_0x2abe53['exited'],'conversion_rate':_0x2abe53[_0x1f0d03(0x141)]},_0x1a5a29),0x0;console[_0x1f0d03(0x131)](_0x1f0d03(0xf2)+_0x3eada2+_0x1f0d03(0x107));}return await handleSingleObjectOutput(_0x589123,_0x1a5a29),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x127);[a25_0x1e7db8(0xe1)]='Pause\x20a\x20running\x20journey';async[a25_0x1e7db8(0x117)](_0x5cc330){const _0x2d71a6=a25_0x1e7db8,{options:_0x247ebb,args:_0x5ed18b,tdx:_0x367c6d}=_0x5cc330,_0x25c390=_0x5ed18b[0x0];if(!_0x25c390)return console[_0x2d71a6(0x131)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x2d71a6(0x113)),0x1;_0x247ebb[_0x2d71a6(0xed)]&&console[_0x2d71a6(0x131)]('Input:\x20'+_0x25c390);const _0x354319=resolveJourneyTarget(_0x25c390,_0x247ebb[_0x2d71a6(0x12b)],_0x247ebb['verbose']),_0x18e1e7=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x367c6d[_0x2d71a6(0x11c)][_0x2d71a6(0xd1)](_0x354319[_0x2d71a6(0x12b)]),{'verbose':_0x247ebb['verbose']}),_0x4e0ffe=_0x18e1e7[_0x2d71a6(0xca)],_0x110ee6=await withSpinner('Resolving\x20journey...',()=>_0x367c6d[_0x2d71a6(0xdc)]['resolveJourneyId'](_0x4e0ffe,_0x354319['journeyName']),{'verbose':_0x247ebb[_0x2d71a6(0xed)]}),_0x846bdf=_0x110ee6[_0x2d71a6(0xca)];if(!_0x247ebb['yes']){const _0x27b413=await confirm(_0x2d71a6(0x12a)+_0x354319[_0x2d71a6(0xb8)]+'\x22?');if(!_0x27b413)return console['error']('Cancelled'),0x0;}const _0x5774b6=await withSpinner(_0x2d71a6(0x123),()=>_0x367c6d[_0x2d71a6(0xdc)]['pause'](_0x846bdf),{'verbose':_0x247ebb['verbose']}),_0x50632b=_0x5774b6[_0x2d71a6(0xca)];return console[_0x2d71a6(0x131)](_0x2d71a6(0xcc)+_0x50632b[_0x2d71a6(0xe4)][_0x2d71a6(0x12c)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]='journey:resume';[a25_0x1e7db8(0xe1)]=a25_0x1e7db8(0xff);async[a25_0x1e7db8(0x117)](_0x1c6e39){const _0x3367bb=a25_0x1e7db8,{options:_0x3d2002,args:_0x45a03a,tdx:_0x5d978e}=_0x1c6e39,_0x19c4d2=_0x45a03a[0x0];if(!_0x19c4d2)return console[_0x3367bb(0x131)](_0x3367bb(0xb5)),console['error'](_0x3367bb(0x115)),0x1;_0x3d2002['verbose']&&console[_0x3367bb(0x131)](_0x3367bb(0xfe)+_0x19c4d2);const _0x1d002a=resolveJourneyTarget(_0x19c4d2,_0x3d2002['parentSegment'],_0x3d2002[_0x3367bb(0xed)]),_0x5b6d7d=await withSpinner(_0x3367bb(0xd8),()=>_0x5d978e[_0x3367bb(0x11c)][_0x3367bb(0xd1)](_0x1d002a[_0x3367bb(0x12b)]),{'verbose':_0x3d2002['verbose']}),_0x584ed3=_0x5b6d7d['data'],_0xfe3ab8=await withSpinner(_0x3367bb(0xeb),()=>_0x5d978e[_0x3367bb(0xdc)][_0x3367bb(0xdf)](_0x584ed3,_0x1d002a['journeyName']),{'verbose':_0x3d2002['verbose']}),_0x426756=_0xfe3ab8[_0x3367bb(0xca)];if(!_0x3d2002[_0x3367bb(0x120)]){const _0x4f610a=await confirm(_0x3367bb(0xc7)+_0x1d002a['journeyName']+'\x22?');if(!_0x4f610a)return console[_0x3367bb(0x131)](_0x3367bb(0x118)),0x0;}const _0x29ee47=await withSpinner(_0x3367bb(0x102),()=>_0x5d978e[_0x3367bb(0xdc)][_0x3367bb(0xc1)](_0x426756),{'verbose':_0x3d2002[_0x3367bb(0xed)]}),_0x41f39a=_0x29ee47[_0x3367bb(0xca)];return console[_0x3367bb(0x131)](_0x3367bb(0xcc)+_0x41f39a[_0x3367bb(0xe4)][_0x3367bb(0x12c)]+_0x3367bb(0x11b)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x106);['description']=a25_0x1e7db8(0xcb);async['execute'](_0x761a51){const _0x27a0c9=a25_0x1e7db8,{options:_0x362f34,args:_0x5df538,tdx:_0x17c266}=_0x761a51,_0x44ff68=_0x362f34,_0x2c8d3a=_0x5df538[0x0],_0x47ac87=findTdxConfigPath();let _0x58c815,_0x2b0552;if(_0x47ac87){const _0x318485=loadTdxConfig(_0x47ac87);_0x58c815=_0x318485[_0x27a0c9(0x100)],_0x2b0552=a25_0x4ac36d[_0x27a0c9(0xe5)](a25_0x4ac36d[_0x27a0c9(0xee)](_0x47ac87),'journeys'),_0x44ff68[_0x27a0c9(0xed)]&&(console['error'](_0x27a0c9(0x11a)+_0x47ac87),console[_0x27a0c9(0x131)](_0x27a0c9(0x147)+_0x58c815));}else{_0x58c815=_0x362f34['parentSegment'];if(!_0x58c815)return console[_0x27a0c9(0x131)](a25_0x2a9a22[_0x27a0c9(0xba)]('Parent\x20segment\x20context\x20not\x20set.\x0a')),console[_0x27a0c9(0x131)](_0x27a0c9(0x140)),console[_0x27a0c9(0x131)](_0x27a0c9(0x112)),console[_0x27a0c9(0x131)](_0x27a0c9(0x149)),0x1;_0x2b0552=a25_0x4ac36d['join'](getSegmentRootDir(sanitizeFileName(_0x58c815)),_0x27a0c9(0xbf));}const _0x4438c9=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x17c266[_0x27a0c9(0x11c)][_0x27a0c9(0xd1)](_0x58c815),{'verbose':_0x362f34['verbose']}),_0x596a6b=_0x4438c9[_0x27a0c9(0xca)],_0x426a76=await withSpinner(_0x27a0c9(0x108),()=>_0x17c266['journey'][_0x27a0c9(0x143)](_0x596a6b),{'verbose':_0x362f34[_0x27a0c9(0xed)]});let _0x437f92=_0x426a76[_0x27a0c9(0xca)];if(_0x2c8d3a){const _0x150096=_0x437f92['filter'](_0x4dcdbb=>_0x4dcdbb[_0x27a0c9(0xdd)][_0x27a0c9(0xde)]()===_0x2c8d3a[_0x27a0c9(0xde)]());if(_0x150096['length']===0x0)return console[_0x27a0c9(0x131)]('Error:\x20Journey\x20not\x20found:\x20'+_0x2c8d3a),console[_0x27a0c9(0x131)]('Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys'),0x1;_0x437f92=_0x150096;}if(_0x437f92[_0x27a0c9(0xd5)]===0x0)return console[_0x27a0c9(0x131)]('No\x20journeys\x20found'),0x0;const _0x48c8fb=[];for(const _0x17e7e8 of _0x437f92){const _0x36f585=await withSpinner('Fetching\x20'+_0x17e7e8[_0x27a0c9(0xdd)]+_0x27a0c9(0x133),()=>_0x17c266[_0x27a0c9(0xdc)][_0x27a0c9(0xf7)](_0x17e7e8['id']),{'verbose':_0x362f34[_0x27a0c9(0xed)]}),_0x336975=_0x36f585['data'],_0x5b38de=_0x336975['attributes']?.[_0x27a0c9(0xd7)],_0x3be345={'resolveSegment':async _0x4bc563=>{const _0x467ae3=_0x27a0c9;if(!_0x5b38de)return{'name':_0x4bc563,'isJourneyLocal':![]};try{const _0xd54de1=await _0x17c266[_0x467ae3(0x11c)]['getSegment'](_0x5b38de,_0x4bc563),_0x230308=_0xd54de1[_0x467ae3(0x13b)]===SEGMENT_KIND_JOURNEY;let _0x12cc54;return _0x230308&&_0xd54de1[_0x467ae3(0x109)]&&(_0x12cc54={'description':_0xd54de1[_0x467ae3(0xe1)],'rule':apiRuleToYaml(_0xd54de1[_0x467ae3(0x109)])}),{'name':_0xd54de1[_0x467ae3(0x12c)],'isJourneyLocal':_0x230308,'definition':_0x12cc54};}catch(_0x3636a5){return _0x362f34[_0x467ae3(0xed)]&&console[_0x467ae3(0x131)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x4bc563+':\x20'+_0x3636a5[_0x467ae3(0x13a)]),{'name':_0x4bc563,'isJourneyLocal':![]};}}},_0x2b6078=await apiToYamlAsync(_0x336975,_0x3be345),_0x3dc59e=toYamlString(_0x2b6078),_0x41f86a=sanitizeFileName(_0x17e7e8[_0x27a0c9(0xdd)]),_0x541dd7=a25_0x4ac36d[_0x27a0c9(0xe5)](_0x2b0552,_0x41f86a+_0x27a0c9(0x14b)),_0x149597=a25_0x4ac36d[_0x27a0c9(0xd3)](process['cwd'](),_0x541dd7);if(existsSync(_0x541dd7)){const _0x3a22c1=readFileSync(_0x541dd7,_0x27a0c9(0xe2)),_0xd60928=generateDiff(_0x3a22c1,_0x3dc59e),_0x12f8ad=hasChanges(_0xd60928);_0x48c8fb[_0x27a0c9(0x111)]({'relativePath':_0x149597,'absolutePath':_0x541dd7,'content':_0x3dc59e,'isNew':![],'hasChanges':_0x12f8ad,'diff':_0x12f8ad?formatDiffWithColors(_0xd60928):undefined});}else _0x48c8fb[_0x27a0c9(0x111)]({'relativePath':_0x149597,'absolutePath':_0x541dd7,'content':_0x3dc59e,'isNew':!![],'hasChanges':![]});}const _0x6a36c4=_0x48c8fb[_0x27a0c9(0x10f)](_0x3105ed=>_0x3105ed['isNew']),_0x4a2090=_0x48c8fb[_0x27a0c9(0x10f)](_0x10229b=>!_0x10229b['isNew']&&_0x10229b[_0x27a0c9(0x11f)]),_0x4605ad=_0x48c8fb[_0x27a0c9(0x10f)](_0x453d2d=>!_0x453d2d[_0x27a0c9(0xc5)]&&!_0x453d2d['hasChanges']);console[_0x27a0c9(0x131)](_0x27a0c9(0x145)),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0x10a)](_0x437f92[_0x27a0c9(0xd5)]+_0x27a0c9(0xf6))),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0xb7)]('+\x20'+_0x6a36c4[_0x27a0c9(0xd5)]+'\x20new\x20files')),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0xba)]('~\x20'+_0x4a2090[_0x27a0c9(0xd5)]+_0x27a0c9(0x104))),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0xe3)]('=\x20'+_0x4605ad[_0x27a0c9(0xd5)]+_0x27a0c9(0xfd))),console['error'](_0x27a0c9(0xf0)+a25_0x2a9a22[_0x27a0c9(0x10a)](_0x2b0552)+'\x0a');if(_0x4a2090[_0x27a0c9(0xd5)]>0x0)for(const _0x226778 of _0x4a2090){console[_0x27a0c9(0x131)](_0x27a0c9(0x134)+_0x226778[_0x27a0c9(0xe8)]+'\x27:'),console[_0x27a0c9(0x131)]('─'[_0x27a0c9(0x135)](0x3c)),console[_0x27a0c9(0x131)](_0x226778[_0x27a0c9(0x146)]),console[_0x27a0c9(0x131)]('─'[_0x27a0c9(0x135)](0x3c));}if(_0x44ff68[_0x27a0c9(0x136)])return console[_0x27a0c9(0x131)](a25_0x2a9a22[_0x27a0c9(0xba)](_0x27a0c9(0x148))),0x0;if(_0x6a36c4[_0x27a0c9(0xd5)]===0x0&&_0x4a2090[_0x27a0c9(0xd5)]===0x0)return console['error'](a25_0x2a9a22[_0x27a0c9(0xb7)](_0x27a0c9(0x14c))),0x0;if(!_0x44ff68[_0x27a0c9(0x120)]&&(_0x6a36c4[_0x27a0c9(0xd5)]>0x0||_0x4a2090['length']>0x0)){const _0xc3bba8=await confirmKey(_0x27a0c9(0x101)+(_0x6a36c4[_0x27a0c9(0xd5)]+_0x4a2090[_0x27a0c9(0xd5)])+_0x27a0c9(0x116));if(!_0xc3bba8)return console['error'](_0x27a0c9(0xb9)),0x1;}!existsSync(_0x2b0552)&&mkdirSync(_0x2b0552,{'recursive':!![]});for(const _0x2b57f1 of _0x48c8fb){(_0x2b57f1[_0x27a0c9(0xc5)]||_0x2b57f1['hasChanges'])&&writeFileSync(_0x2b57f1[_0x27a0c9(0xdb)],_0x2b57f1['content'],'utf-8');}return console[_0x27a0c9(0x131)](a25_0x2a9a22[_0x27a0c9(0xb7)](_0x27a0c9(0x13e)+(_0x6a36c4[_0x27a0c9(0xd5)]+_0x4a2090[_0x27a0c9(0xd5)])+_0x27a0c9(0x12f)+_0x2b0552)),0x0;}}
@@ -1 +1 @@
1
- const a26_0x5cc08c=a26_0x5881;(function(_0x49a606,_0x5167b9){const _0x1f8011=a26_0x5881,_0x221786=_0x49a606();while(!![]){try{const _0x37dab7=-parseInt(_0x1f8011(0x169))/0x1*(-parseInt(_0x1f8011(0x167))/0x2)+-parseInt(_0x1f8011(0x134))/0x3+-parseInt(_0x1f8011(0xde))/0x4+-parseInt(_0x1f8011(0xfe))/0x5+parseInt(_0x1f8011(0x143))/0x6*(-parseInt(_0x1f8011(0x141))/0x7)+-parseInt(_0x1f8011(0x15b))/0x8+parseInt(_0x1f8011(0x184))/0x9*(parseInt(_0x1f8011(0x106))/0xa);if(_0x37dab7===_0x5167b9)break;else _0x221786['push'](_0x221786['shift']());}catch(_0x3340ad){_0x221786['push'](_0x221786['shift']());}}}(a26_0x43f9,0xa328f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/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'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0x35856c from'node:fs';function handleSDKError(_0x2dadef,_0x269e53){const _0x2b69e9=a26_0x5881;if(_0x2dadef instanceof SDKError)console[_0x2b69e9(0x16c)]('Error:\x20'+_0x2dadef['message']),_0x269e53[_0x2b69e9(0x10d)]&&(_0x2dadef[_0x2b69e9(0x135)]&&console[_0x2b69e9(0x16c)](_0x2b69e9(0x191)+_0x2dadef[_0x2b69e9(0x135)]),_0x2dadef[_0x2b69e9(0xee)]&&(console['error'](_0x2b69e9(0x181)),console[_0x2b69e9(0x16c)](_0x2dadef[_0x2b69e9(0xee)])));else throw _0x2dadef;}function formatChatHistoryEntry(_0x232f83,_0x4f2ea5){const _0x312611=a26_0x5881,_0x1968ba=getChalk(_0x4f2ea5),_0x55f3b4=_0x1968ba[_0x312611(0x115)](_0x232f83['at']);if(_0x312611(0xd8)in _0x232f83){const _0xee436b=_0x1968ba[_0x312611(0x154)]('[input]\x20\x20');return _0x55f3b4+'\x20'+_0xee436b+':\x20'+_0x232f83['input'];}if(_0x312611(0x121)in _0x232f83){const _0x237609=_0x1968ba['green'](_0x312611(0x130));return _0x55f3b4+'\x20'+_0x237609+':\x20'+_0x232f83[_0x312611(0x121)];}if(_0x312611(0x12e)in _0x232f83){const _0xbd9cfd=_0x1968ba[_0x312611(0xe2)](_0x312611(0x17f)),{functionName:_0x20953f,functionArguments:_0x27ae28,targetFunction:_0x5169fc}=_0x232f83[_0x312611(0x12e)];let _0x394494=_0x55f3b4+'\x20'+_0xbd9cfd+':\x20'+_0x1968ba['bold'](_0x20953f);if(_0x27ae28&&Object['keys'](_0x27ae28)[_0x312611(0xe3)]>0x0){const _0x89ee88=Object['entries'](_0x27ae28)['map'](([_0x345cfa,_0x8408d4])=>_0x345cfa+'='+JSON[_0x312611(0x133)](_0x8408d4))[_0x312611(0x153)](',\x20');_0x394494+='('+_0x89ee88+')';}_0x5169fc&&(_0x394494+=_0x1968ba['dim']('\x20['+_0x5169fc+']'));let _0x2f267e='';if(_0x232f83['tool_call'][_0x312611(0x187)])_0x2f267e='\x20->\x20KB:'+_0x232f83[_0x312611(0x12e)]['targetKnowledgeBase'][_0x312611(0x155)];else{if(_0x232f83[_0x312611(0x12e)]['targetAgent'])_0x2f267e=_0x312611(0x16f)+_0x232f83[_0x312611(0x12e)][_0x312611(0x114)][_0x312611(0x155)];else{if(_0x232f83[_0x312611(0x12e)][_0x312611(0x16b)])_0x2f267e=_0x312611(0x14f)+_0x232f83[_0x312611(0x12e)][_0x312611(0x16b)]['name'];else _0x232f83['tool_call']['targetImageGenerator']&&(_0x2f267e='\x20->\x20ImageGen:'+_0x232f83[_0x312611(0x12e)][_0x312611(0x15c)][_0x312611(0x155)]);}}return _0x394494+_0x2f267e;}if(_0x312611(0x12c)in _0x232f83){const _0x130b82=_0x1968ba[_0x312611(0x111)](_0x312611(0x145)),{functionName:_0x29f359,functionArguments:_0x186af6,content:_0x58e127,newChat:_0x51cf00}=_0x232f83[_0x312611(0x12c)];let _0x1155e7=_0x55f3b4+'\x20'+_0x130b82+':\x20'+_0x1968ba[_0x312611(0x10a)](_0x29f359);if(_0x186af6){const _0x7b4c60=typeof _0x186af6==='string'?_0x186af6:JSON[_0x312611(0x133)](_0x186af6);_0x1155e7+='('+_0x7b4c60+')';}return _0x58e127&&(_0x1155e7+='\x0a'+_0x1968ba[_0x312611(0x115)](_0x58e127)),_0x51cf00&&(_0x1155e7+=_0x1968ba[_0x312611(0x115)]('\x20→\x20chat:\x20'+_0x51cf00['id'])),_0x1155e7;}if(_0x312611(0x13d)in _0x232f83){const _0x49cea2=_0x1968ba['blue'](_0x312611(0x18f));return _0x55f3b4+'\x20'+_0x49cea2+':\x20'+_0x232f83[_0x312611(0x13d)][_0x312611(0x155)]+'\x20('+_0x232f83['output']['content']['length']+_0x312611(0x11b);}if(_0x312611(0x12f)in _0x232f83){const _0x8d892c=_0x1968ba[_0x312611(0x109)](_0x312611(0x131)),{width:_0x4b549b,height:_0x182370,headerText:_0x6437e6}=_0x232f83[_0x312611(0x12f)],_0x591188=_0x6437e6?_0x312611(0xe6)+_0x6437e6:'';return _0x55f3b4+'\x20'+_0x8d892c+':\x20'+_0x4b549b+'x'+_0x182370+_0x591188;}if(_0x312611(0x16c)in _0x232f83){const _0x4d1897=_0x1968ba[_0x312611(0x124)]('[error]\x20\x20');return _0x55f3b4+'\x20'+_0x4d1897+':\x20'+_0x232f83[_0x312611(0x16c)];}return _0x55f3b4+'\x20'+_0x1968ba['dim'](_0x312611(0xff))+':\x20'+JSON['stringify'](_0x232f83);}async function executeChatHistoryCommand(_0x479315,_0x1daaf4){const _0x2b6580=a26_0x5881,{options:_0x512d57,args:_0x17aafb,tdx:_0xb36746}=_0x479315,_0x38d95b=_0x17aafb[0x0],_0x3c5916=_0x512d57,_0x174193=_0x3c5916[_0x2b6580(0x128)];try{if(_0x174193&&_0x38d95b)return console[_0x2b6580(0x16c)](_0x2b6580(0x189)),console[_0x2b6580(0x16c)](_0x2b6580(0x172)+_0x1daaf4+_0x2b6580(0x164)),0x1;if(!_0x38d95b&&!_0x174193&&_0x512d57['format']!==undefined){const _0x14b232=resolveLimit(_0x512d57[_0x2b6580(0x159)],DEFAULT_LLM_LIMIT),_0x43d1c5=await withSpinner(_0x2b6580(0x199),()=>_0xb36746[_0x2b6580(0x186)][_0x2b6580(0xf7)](_0x14b232),{'verbose':_0x512d57[_0x2b6580(0x10d)]});return await handleSDKOutput(_0x43d1c5[_0x2b6580(0x17b)],_0x512d57),0x0;}const _0x9db2b5=await getChatIdOrSelect(_0xb36746,_0x512d57,_0x174193,_0x38d95b);if(!_0x9db2b5)return 0x0;return await displayChatHistory(_0x9db2b5,_0xb36746,_0x512d57),0x0;}catch(_0x21474a){return handleSDKError(_0x21474a,_0x512d57),0x1;}}async function displayChatHistory(_0x43a523,_0x5b0a37,_0x407acd){const _0x5baa35=a26_0x5881,_0x2d0b76=await withSpinner(_0x5baa35(0x138)+_0x43a523+_0x5baa35(0xe9),()=>_0x5b0a37['llm'][_0x5baa35(0x168)](_0x43a523),{'verbose':_0x407acd['verbose']}),_0x36d24f=_0x2d0b76['data'][_0x5baa35(0x17b)]??[];if(_0x36d24f[_0x5baa35(0xe3)]===0x0){console[_0x5baa35(0x196)](_0x5baa35(0x190));return;}if(_0x407acd['format']!==undefined)await handleSDKOutput(_0x36d24f,_0x407acd);else{const _0x2cb583=_0x36d24f[_0x5baa35(0x16a)](_0x259331=>formatChatHistoryEntry(_0x259331,_0x407acd)),_0x425acc=_0x2cb583[_0x5baa35(0x153)]('\x0a');await writeOutput(_0x425acc,_0x407acd[_0x5baa35(0x13d)],_0x5baa35(0x13a));}}async function getChatIdOrSelect(_0x48a2be,_0x2a728a,_0x396e73,_0x10b5d8){const _0x14dc12=a26_0x5881;if(_0x10b5d8)return _0x10b5d8;if(_0x396e73){const _0x5bd87e=await withSpinner(_0x14dc12(0x10f),()=>_0x48a2be[_0x14dc12(0x186)][_0x14dc12(0xf7)](0x1),{'verbose':_0x2a728a['verbose']});if(_0x5bd87e['data'][_0x14dc12(0xe3)]===0x0)return console[_0x14dc12(0x196)](_0x14dc12(0xd6)),undefined;return _0x5bd87e[_0x14dc12(0x17b)][0x0]['id'];}const _0x46f81e=await selectChatInteractively(_0x48a2be,_0x2a728a);if(!_0x46f81e)return console[_0x14dc12(0x196)](_0x14dc12(0x12a)),undefined;return _0x46f81e;}async function getProjectIdOrDefault(_0x177226){const _0x14ab6d=a26_0x5881,{tdx:_0xd135c2,options:_0x1a3775}=_0x177226,_0x471404=_0x1a3775[_0x14ab6d(0xe4)];if(_0x471404){const _0x3b0eb2=await withSpinner(_0x14ab6d(0x101)+_0x471404+_0x14ab6d(0xe9),()=>_0xd135c2[_0x14ab6d(0x186)][_0x14ab6d(0x163)](_0x471404),{'verbose':_0x1a3775['verbose']});return _0x3b0eb2['data'];}let _0x20a46c=_0xd135c2['llm'][_0x14ab6d(0x198)]();if(_0x20a46c)return _0x20a46c;const _0x1448ae=await withSpinner('Getting\x20default\x20project...',()=>_0xd135c2[_0x14ab6d(0x186)]['getOrCreateDefaultProject'](),{'verbose':_0x1a3775[_0x14ab6d(0x10d)]});return _0x1448ae[_0x14ab6d(0x17b)]['id'];}function toLLMProjectInfo(_0x282e97){const _0x4558fe=a26_0x5881;return{'name':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x155)],'description':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x146)],'createdAt':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x176)],'updatedAt':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x19a)]};}function a26_0x43f9(){const _0x39cacf=['last','outputDir','\x0aCancelled','Fetching\x20agent...','tool','format','tool_call','image','[content]','[image]\x20\x20','.llm','stringify','1414248dmjczT','cause','\x20\x20Agents:\x20','Deleting\x20project\x20\x27','Fetching\x20chat\x20history\x20for\x20\x27','Delete\x20an\x20agent','table','yes','Error:\x20Agent\x20name\x20is\x20required','output','llm:project:backup','h\x20ago','find','14JtkeIg','agent','1903194AjEWsV','model','[tool]\x20\x20\x20','description','claude-4.5-haiku','A\x20project\x20named\x20\x27','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','llm:project:restore','d\x20ago','Use\x20format:\x20project-name/agent-name','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','getTime','\x20->\x20WebSearch:','getBackupMetadata','Output\x20directory\x20\x27','updateAgent','join','cyan','name','llm:history','Analyzing\x20project\x20\x27','execute','limit','Project\x20restored:\x20','1284144yMxvxq','targetImageGenerator','jsonl','floor','\x20\x20Knowledge\x20Bases:\x20','Creating\x20project\x20\x27','agentId','chatId','resolveProjectId','\x20--last','Project\x20backed\x20up\x20to:\x20','Validating\x20backup\x20from\x20\x27','148zodbkN','history','12622XMpLfs','map','targetWebSearchTool','error','llm:agent:create','includes','\x20->\x20Agent:','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','Usage:\x20','(no\x20message)','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','Error:\x20Project\x20name\x20is\x20required','createdAt','Agent\x20created:\x20','Project\x20created:\x20','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','push','data','Project\x20context\x20set\x20to:\x20','resolveAgentId','select','[tool_call]','Set\x20current\x20project\x20context','\x0aStack\x20trace:','Fetching\x20projects...','\x27\x20already\x20exists.\x20Overwrite?','9PVWXos','just\x20now','llm','targetKnowledgeBase','agents','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','all','projects','set','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','createAgent','[output]\x20','No\x20messages\x20found\x20in\x20chat\x20history.','\x20\x20Cause:\x20','Fetching\x20agents...','Agent\x20updated:\x20','llm:project:delete','Resolving\x20agent\x20\x27','log','llm:agent:update','getCurrentProject','Fetching\x20chat\x20sessions...','updatedAt','Setting\x20project\x20context\x20to\x20\x27','llm:agent:show','No\x20chat\x20sessions\x20found.','Backup\x20cancelled.','input','knowledgeBases','attributes','\x20\x20Prompts:\x20','Backing\x20up\x20project\x20\x27','default','5146064gPQqIK','exportedFrom','Load\x20more...','temperature','yellow','length','llmProject','INVALID_ARGUMENT','\x20-\x20','integrations','systemPrompt','\x27...','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Invalid\x20path\x20syntax:\x20','Update\x20an\x20existing\x20agent','get','stack','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','llm:agents','llm:models','dryRun','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Usage:\x20tdx\x20llm\x20use\x20<project-name>','deleteProject','llm:agent:delete','chats','numeric','projectId','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Checking\x20for\x20existing\x20projects...','prompts','maxToolIterations','153530sCtITB','[unknown]','llm:use','Resolving\x20project\x20\x27','projectName','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','__load_more__','deleteAgent','23178290pTPtBh','List\x20agents\x20in\x20current\x20project','filter','blue','bold','starterMessage','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','verbose','toLowerCase','Fetching\x20most\x20recent\x20chat...','List\x20available\x20LLM\x20models','magenta','\x20\x20Integrations:\x20','llm:projects','targetAgent','dim','sourceSite','json','setCurrentProject','createProject','existsSync','\x20bytes)','rmSync','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','toLocaleDateString','m\x20ago','split','content','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Agent\x20deleted:\x20','red','counts','(no\x20agent)','slice'];a26_0x43f9=function(){return _0x39cacf;};return a26_0x43f9();}function toAgentInfo(_0x750b3c){const _0x3792a9=a26_0x5881;return{'name':_0x750b3c[_0x3792a9(0xda)][_0x3792a9(0x155)],'description':_0x750b3c[_0x3792a9(0xda)]['description'],'prompt':truncatePrompt(_0x750b3c['attributes']['prompt']),'createdAt':_0x750b3c['attributes'][_0x3792a9(0x176)],'updatedAt':_0x750b3c[_0x3792a9(0xda)]['updatedAt']};}function truncatePrompt(_0x512c40){const _0x28d36e=a26_0x5881;if(!_0x512c40)return undefined;const _0x1922e8=0x64;if(_0x512c40[_0x28d36e(0xe3)]<=_0x1922e8)return _0x512c40;return _0x512c40[_0x28d36e(0x127)](0x0,_0x1922e8)+'...';}export class LLMModelsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf1);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x110);async[a26_0x5cc08c(0x158)](_0x194ee9){const _0x3e1f22=a26_0x5cc08c,{options:_0x2c94da,tdx:_0x53c9d2}=_0x194ee9;try{const _0x8fb14d=await withSpinner('Fetching\x20available\x20models...',()=>_0x53c9d2[_0x3e1f22(0x186)]['models'](),{'verbose':_0x2c94da[_0x3e1f22(0x10d)]});return await handleSDKOutput(_0x8fb14d[_0x3e1f22(0x17b)],_0x2c94da),0x0;}catch(_0x3f26ea){return handleSDKError(_0x3f26ea,_0x2c94da),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x113);['description']='List\x20all\x20LLM\x20projects';async[a26_0x5cc08c(0x158)](_0x20e617){const _0x2eac68=a26_0x5cc08c,{options:_0x337934,args:_0x561f54,tdx:_0x33522e}=_0x20e617;try{const _0x341fd4=_0x561f54[0x0],_0x173f91=resolveLimit(_0x337934[_0x2eac68(0x159)],DEFAULT_LLM_LIMIT),_0x148fa6=await withSpinner(_0x2eac68(0x182),()=>_0x33522e[_0x2eac68(0x186)][_0x2eac68(0x18b)](_0x173f91),{'verbose':_0x337934[_0x2eac68(0x10d)]});let _0x545872=_0x148fa6[_0x2eac68(0x17b)];_0x341fd4&&(_0x545872=_0x148fa6[_0x2eac68(0x17b)][_0x2eac68(0x108)](_0x973e2a=>matchGlobPattern(_0x973e2a[_0x2eac68(0xda)][_0x2eac68(0x155)],_0x341fd4)));const _0x42603d=_0x545872[_0x2eac68(0x16a)](toLLMProjectInfo);return await handleSDKOutput(_0x42603d,_0x337934),0x0;}catch(_0x4c2dd5){return handleSDKError(_0x4c2dd5,_0x337934),0x1;}}}function a26_0x5881(_0x2e8201,_0x34545d){_0x2e8201=_0x2e8201-0xd5;const _0x43f952=a26_0x43f9();let _0x5881f2=_0x43f952[_0x2e8201];return _0x5881f2;}export class LLMAgentsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf0);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x107);async['execute'](_0x33884e){const _0x193c5a=a26_0x5cc08c,{options:_0x4a13ac,args:_0x1ebb44,tdx:_0x2f3140}=_0x33884e;try{const _0x3a9563=_0x1ebb44[0x0];let _0x19ff6d,_0x59222a=_0x3a9563;if(_0x3a9563&&_0x3a9563[_0x193c5a(0x16e)]('/')){const _0x14fea7=_0x3a9563[_0x193c5a(0x120)]('/');if(_0x14fea7['length']===0x2){const [_0xc7a9a0,_0x253999]=_0x14fea7,_0x1c7553=await _0x2f3140['llm'][_0x193c5a(0x18b)](),_0x3e0b63=_0x1c7553[_0x193c5a(0x140)](_0x2a8df5=>_0x2a8df5[_0x193c5a(0xda)][_0x193c5a(0x155)][_0x193c5a(0x10e)]()===_0xc7a9a0[_0x193c5a(0x10e)]());if(!_0x3e0b63)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0xc7a9a0,undefined,{'helpText':_0x193c5a(0xf3)});_0x19ff6d=_0x3e0b63['id'],_0x59222a=_0x253999;}else throw new SDKError(ErrorCode[_0x193c5a(0xe5)],'Invalid\x20path\x20syntax:\x20'+_0x3a9563,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x19ff6d=await getProjectIdOrDefault(_0x33884e);const _0x5e56b6=await withSpinner(_0x193c5a(0x192),()=>_0x2f3140['llm'][_0x193c5a(0x188)](_0x19ff6d),{'verbose':_0x4a13ac[_0x193c5a(0x10d)]});let _0x1eadf7=_0x5e56b6['data'];_0x59222a&&(_0x1eadf7=_0x5e56b6[_0x193c5a(0x17b)][_0x193c5a(0x108)](_0x5dff47=>matchGlobPattern(_0x5dff47[_0x193c5a(0xda)][_0x193c5a(0x155)],_0x59222a)));const _0x337d09=_0x1eadf7['map'](toAgentInfo);return await handleSDKOutput(_0x337d09,_0x4a13ac),0x0;}catch(_0x421e26){return handleSDKError(_0x421e26,_0x4a13ac),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xd5);[a26_0x5cc08c(0x146)]='Show\x20agent\x20details';async['execute'](_0x5a0550){const _0x45ee93=a26_0x5cc08c,{options:_0x2b5bc9,args:_0x5998c6,tdx:_0x5d99ed}=_0x5a0550;if(_0x5998c6[_0x45ee93(0xe3)]===0x0)return console[_0x45ee93(0x16c)](_0x45ee93(0x13c)),console['error'](_0x45ee93(0x11d)),0x1;const _0x163a4c=_0x5998c6[0x0];try{const _0x2522a9=await getProjectIdOrDefault(_0x5a0550),_0x123855=await withSpinner('Resolving\x20agent\x20\x27'+_0x163a4c+_0x45ee93(0xe9),()=>_0x5d99ed[_0x45ee93(0x186)][_0x45ee93(0x17d)](_0x163a4c,_0x2522a9),{'verbose':_0x2b5bc9['verbose']}),_0x1e6267=await withSpinner(_0x45ee93(0x12b),()=>_0x5d99ed[_0x45ee93(0x186)][_0x45ee93(0x142)](_0x123855[_0x45ee93(0x17b)]),{'verbose':_0x2b5bc9[_0x45ee93(0x10d)]});return await handleSDKOutput([_0x1e6267[_0x45ee93(0x17b)]],_0x2b5bc9),0x0;}catch(_0x16b805){return handleSDKError(_0x16b805,_0x2b5bc9),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x16d);[a26_0x5cc08c(0x146)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a26_0x5cc08c(0x158)](_0x3ddb25){const _0x255338=a26_0x5cc08c,{options:_0x177db4,args:_0x3e3c08,tdx:_0x5b6a1b}=_0x3ddb25;if(_0x3e3c08[_0x255338(0xe3)]===0x0)return console[_0x255338(0x16c)](_0x255338(0x13c)),console[_0x255338(0x16c)](_0x255338(0xef)),console[_0x255338(0x16c)](_0x255338(0x14d)),0x1;const _0x18b97d=_0x3e3c08[0x0],_0x18b2b8=_0x177db4,_0x232357=_0x18b2b8[_0x255338(0xe8)],_0x2f592b=_0x18b2b8[_0x255338(0x144)]||_0x255338(0x147),_0x28f3c5=_0x18b2b8[_0x255338(0x10b)],_0x529c5d=_0x18b2b8[_0x255338(0xfd)]?Number(_0x18b2b8['maxToolIterations']):undefined,_0x64755d=_0x18b2b8[_0x255338(0xe1)]?Number(_0x18b2b8[_0x255338(0xe1)]):undefined;try{let _0x8b0123,_0xbde4e1;if(_0x18b97d['includes']('/')){const _0x22fa1a=_0x18b97d[_0x255338(0x120)]('/');if(_0x22fa1a[_0x255338(0xe3)]===0x2){const [_0x37d139,_0x5618e1]=_0x22fa1a,_0x3b8f7b=await withSpinner('Resolving\x20project\x20\x27'+_0x37d139+'\x27...',()=>_0x5b6a1b[_0x255338(0x186)][_0x255338(0x163)](_0x37d139),{'verbose':_0x177db4[_0x255338(0x10d)]});_0x8b0123=_0x3b8f7b[_0x255338(0x17b)],_0xbde4e1=_0x5618e1;}else throw new SDKError(ErrorCode[_0x255338(0xe5)],_0x255338(0xeb)+_0x18b97d,undefined,{'helpText':_0x255338(0x14c)});}else _0x8b0123=await getProjectIdOrDefault(_0x3ddb25),_0xbde4e1=_0x18b97d;const _0x5d0aa7=await withSpinner('Creating\x20agent\x20\x27'+_0xbde4e1+_0x255338(0xe9),()=>_0x5b6a1b[_0x255338(0x186)][_0x255338(0x18e)]({'name':_0xbde4e1,'projectId':_0x8b0123,'modelType':_0x2f592b,'systemPrompt':_0x232357,'starterMessage':_0x28f3c5,'maxToolIterations':_0x529c5d,'temperature':_0x64755d}),{'verbose':_0x177db4[_0x255338(0x10d)]});return console['log'](_0x255338(0x177)+_0x5d0aa7[_0x255338(0x17b)]['id']),await handleSDKOutput([_0x5d0aa7[_0x255338(0x17b)]],_0x177db4),0x0;}catch(_0x5c9029){return handleSDKError(_0x5c9029,_0x177db4),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x197);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0xec);async[a26_0x5cc08c(0x158)](_0x3b8ed2){const _0x590dd3=a26_0x5cc08c,{options:_0xa077ac,args:_0x4e5830,tdx:_0x29d124}=_0x3b8ed2;if(_0x4e5830[_0x590dd3(0xe3)]===0x0)return console[_0x590dd3(0x16c)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x590dd3(0x16c)](_0x590dd3(0x171)),0x1;const _0x2306bf=_0x4e5830[0x0],_0x1f0504=_0xa077ac,_0x46804b=_0x1f0504[_0x590dd3(0x155)],_0x2a02a=_0x1f0504['prompt'],_0x1f7373=_0x1f0504[_0x590dd3(0x146)],_0x54dc39=_0x1f0504[_0x590dd3(0x10b)];if(!_0x46804b&&!_0x2a02a&&!_0x1f7373&&!_0x54dc39)return console['error'](_0x590dd3(0x170)),console[_0x590dd3(0x16c)](_0x590dd3(0x122)),0x1;try{const _0x25e3cb=await getProjectIdOrDefault(_0x3b8ed2),_0x41ecd9=await withSpinner(_0x590dd3(0x195)+_0x2306bf+_0x590dd3(0xe9),()=>_0x29d124[_0x590dd3(0x186)]['resolveAgentId'](_0x2306bf,_0x25e3cb),{'verbose':_0xa077ac[_0x590dd3(0x10d)]}),_0x393b71=_0x41ecd9['data'],_0x4aa4ce=await withSpinner('Updating\x20agent...',()=>_0x29d124[_0x590dd3(0x186)][_0x590dd3(0x152)](_0x393b71,{'name':_0x46804b,'prompt':_0x2a02a,'description':_0x1f7373,'starterMessage':_0x54dc39}),{'verbose':_0xa077ac[_0x590dd3(0x10d)]});return console['log'](_0x590dd3(0x193)+_0x4aa4ce[_0x590dd3(0x17b)]['id']),await handleSDKOutput([_0x4aa4ce[_0x590dd3(0x17b)]],_0xa077ac),0x0;}catch(_0x30d2ac){return handleSDKError(_0x30d2ac,_0xa077ac),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a26_0x5cc08c(0xf6);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x139);async[a26_0x5cc08c(0x158)](_0x45e25f){const _0x484160=a26_0x5cc08c,{options:_0x22c4bd,args:_0x19dae0,tdx:_0x3dbf56}=_0x45e25f;if(_0x19dae0[_0x484160(0xe3)]===0x0)return console[_0x484160(0x16c)](_0x484160(0x13c)),console[_0x484160(0x16c)](_0x484160(0x174)),0x1;const _0x5d27a7=_0x19dae0[0x0];try{const _0x19cf28=await getProjectIdOrDefault(_0x45e25f),_0x338747=await withSpinner(_0x484160(0x195)+_0x5d27a7+'\x27...',()=>_0x3dbf56['llm'][_0x484160(0x17d)](_0x5d27a7,_0x19cf28),{'verbose':_0x22c4bd[_0x484160(0x10d)]}),_0x47ccd7=_0x338747[_0x484160(0x17b)];return await withSpinner('Deleting\x20agent...',()=>_0x3dbf56[_0x484160(0x186)][_0x484160(0x105)](_0x47ccd7),{'verbose':_0x22c4bd[_0x484160(0x10d)]}),console[_0x484160(0x196)](_0x484160(0x123)+_0x47ccd7),0x0;}catch(_0x1ef89e){return handleSDKError(_0x1ef89e,_0x22c4bd),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a26_0x5cc08c(0x156);['description']=a26_0x5cc08c(0xfa);async['execute'](_0x4ed13a){return executeChatHistoryCommand(_0x4ed13a,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x100);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x180);async['execute'](_0x4bbe37){const _0x1a43d9=a26_0x5cc08c,{options:_0x5c0367,args:_0x2ccc92,tdx:_0x4f38be}=_0x4bbe37;if(_0x2ccc92[_0x1a43d9(0xe3)]===0x0)return console[_0x1a43d9(0x16c)](_0x1a43d9(0x175)),console[_0x1a43d9(0x16c)](_0x1a43d9(0xf4)),0x1;const _0x39578c=_0x2ccc92[0x0];try{return await withSpinner(_0x1a43d9(0x19b)+_0x39578c+_0x1a43d9(0xe9),()=>_0x4f38be[_0x1a43d9(0x186)][_0x1a43d9(0x118)](_0x39578c),{'verbose':_0x5c0367[_0x1a43d9(0x10d)]}),console['log'](_0x1a43d9(0x17c)+_0x39578c),0x0;}catch(_0x36aaac){return handleSDKError(_0x36aaac,_0x5c0367),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]='llm:project:create';['description']='Create\x20a\x20new\x20LLM\x20project';async['execute'](_0x155a6d){const _0x14c14e=a26_0x5cc08c,{options:_0x48e5e6,args:_0x4a3b0d,tdx:_0x308e64}=_0x155a6d;if(_0x4a3b0d['length']===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x14c14e(0x16c)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x4b5105=_0x4a3b0d[0x0],_0x3c00ce=_0x48e5e6,_0x4c2ecf=_0x3c00ce[_0x14c14e(0x146)];try{const _0x2d8b3d=await withSpinner(_0x14c14e(0x160)+_0x4b5105+_0x14c14e(0xe9),()=>_0x308e64[_0x14c14e(0x186)][_0x14c14e(0x119)]({'name':_0x4b5105,'description':_0x4c2ecf}),{'verbose':_0x48e5e6[_0x14c14e(0x10d)]});console['log'](_0x14c14e(0x178)+_0x2d8b3d[_0x14c14e(0x17b)]['id']);const _0x1b64c5=toLLMProjectInfo(_0x2d8b3d['data']);return await handleSDKOutput([_0x1b64c5],_0x48e5e6),0x0;}catch(_0x1189c0){return handleSDKError(_0x1189c0,_0x48e5e6),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x194);['description']='Delete\x20an\x20LLM\x20project';async[a26_0x5cc08c(0x158)](_0x462a79){const _0xa7b0ae=a26_0x5cc08c,{options:_0x1da628,args:_0x3b6000,tdx:_0x20c4c5}=_0x462a79;if(_0x3b6000[_0xa7b0ae(0xe3)]===0x0)return console['error'](_0xa7b0ae(0x175)),console['error']('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x25bb5f=_0x3b6000[0x0];try{return await withSpinner(_0xa7b0ae(0x137)+_0x25bb5f+_0xa7b0ae(0xe9),()=>_0x20c4c5[_0xa7b0ae(0x186)][_0xa7b0ae(0xf5)](_0x25bb5f),{'verbose':_0x1da628[_0xa7b0ae(0x10d)]}),console[_0xa7b0ae(0x196)]('Project\x20deleted:\x20'+_0x25bb5f),0x0;}catch(_0x54dfc4){return handleSDKError(_0x54dfc4,_0x1da628),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a26_0x5cc08c(0x13e);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x149);async[a26_0x5cc08c(0x158)](_0x5b3ee7){const _0x3f13ac=a26_0x5cc08c,{options:_0xc6367b,args:_0x3a8596,tdx:_0x582bd5}=_0x5b3ee7;if(_0x3a8596[_0x3f13ac(0xe3)]===0x0)return console['error'](_0x3f13ac(0x175)),console[_0x3f13ac(0x16c)](_0x3f13ac(0x103)),0x1;const _0x7b796e=_0x3a8596[0x0],_0x31aa7e=_0xc6367b,_0x4f6442=_0x31aa7e['output'],_0x2419d0=_0x31aa7e['dryRun'];try{const _0x1072ae=_0x4f6442||_0x7b796e+_0x3f13ac(0x132);if(a26_0x35856c[_0x3f13ac(0x11a)](_0x1072ae)&&!_0x2419d0){if(!_0xc6367b[_0x3f13ac(0x13b)]){const _0x2f63b1=await confirm(_0x3f13ac(0x151)+_0x1072ae+_0x3f13ac(0x183));if(!_0x2f63b1)return console['log'](_0x3f13ac(0xd7)),0x0;}a26_0x35856c[_0x3f13ac(0x11c)](_0x1072ae,{'recursive':!![]});}const _0x13344c=await withSpinner(_0x2419d0?_0x3f13ac(0x157)+_0x7b796e+_0x3f13ac(0xe9):_0x3f13ac(0xdc)+_0x7b796e+_0x3f13ac(0xe9),()=>_0x582bd5[_0x3f13ac(0x186)]['backupProject'](_0x7b796e,_0x4f6442,{'dryRun':_0x2419d0}),{'verbose':_0xc6367b['verbose']}),_0x2b4d78=_0x13344c[_0x3f13ac(0x17b)];return _0x2419d0?console[_0x3f13ac(0x196)](_0x3f13ac(0x179)+_0x2b4d78['outputDir']):console[_0x3f13ac(0x196)](_0x3f13ac(0x165)+_0x2b4d78[_0x3f13ac(0x129)]),console[_0x3f13ac(0x196)](_0x3f13ac(0x136)+_0x2b4d78[_0x3f13ac(0x125)]['agents']),console[_0x3f13ac(0x196)](_0x3f13ac(0x15f)+_0x2b4d78[_0x3f13ac(0x125)][_0x3f13ac(0xd9)]),console['log'](_0x3f13ac(0xdb)+_0x2b4d78[_0x3f13ac(0x125)][_0x3f13ac(0xfc)]),console['log']('\x20\x20Integrations:\x20'+_0x2b4d78['counts'][_0x3f13ac(0xe7)]),(_0xc6367b['format']===_0x3f13ac(0x117)||_0xc6367b[_0x3f13ac(0x12d)]===_0x3f13ac(0x15d))&&await handleSDKOutput([_0x2b4d78],_0xc6367b),0x0;}catch(_0xc6bf94){return handleSDKError(_0xc6bf94,_0xc6367b),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x14a);[a26_0x5cc08c(0x146)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder';async[a26_0x5cc08c(0x158)](_0x6e5b46){const _0x49e3cf=a26_0x5cc08c,{options:_0x46ba90,args:_0x3c6c7c,tdx:_0x5aaa19}=_0x6e5b46;if(_0x3c6c7c['length']===0x0)return console[_0x49e3cf(0x16c)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x49e3cf(0x16c)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x2ab7a8=_0x3c6c7c[0x0],_0x8f2ace=_0x46ba90,_0x294845=_0x8f2ace[_0x49e3cf(0x155)],_0x312fbf=_0x8f2ace[_0x49e3cf(0xf2)];try{if(!_0x312fbf){const _0x4fe728=_0x5aaa19['llm'][_0x49e3cf(0x150)](_0x2ab7a8),_0x1a38e7=_0x294845||_0x4fe728[_0x49e3cf(0xdf)][_0x49e3cf(0x102)],_0x41698a=await withSpinner(_0x49e3cf(0xfb),()=>_0x5aaa19['llm']['projects'](),{'verbose':_0x46ba90[_0x49e3cf(0x10d)]}),_0x142b4f=_0x41698a[_0x49e3cf(0x17b)]['find'](_0x5f2ccd=>_0x5f2ccd[_0x49e3cf(0xda)][_0x49e3cf(0x155)]===_0x1a38e7);if(_0x142b4f&&!_0x46ba90[_0x49e3cf(0x13b)]){const _0x284f44=await confirm(_0x49e3cf(0x148)+_0x1a38e7+_0x49e3cf(0x10c));if(!_0x284f44)return console['log']('Restore\x20cancelled.'),0x0;}}const _0x11fb4d=await withSpinner(_0x312fbf?_0x49e3cf(0x166)+_0x2ab7a8+_0x49e3cf(0xe9):'Restoring\x20project\x20from\x20\x27'+_0x2ab7a8+_0x49e3cf(0xe9),()=>_0x5aaa19[_0x49e3cf(0x186)]['restoreProject'](_0x2ab7a8,{'name':_0x294845,'dryRun':_0x312fbf}),{'verbose':_0x46ba90[_0x49e3cf(0x10d)]}),_0x56ff68=_0x11fb4d['data'];return _0x56ff68['sourceSite']&&console[_0x49e3cf(0x196)](_0x49e3cf(0x18d)+_0x56ff68[_0x49e3cf(0x116)]+'\x27'),_0x312fbf?console[_0x49e3cf(0x196)]('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x56ff68[_0x49e3cf(0x102)]):console[_0x49e3cf(0x196)](_0x49e3cf(0x15a)+_0x56ff68[_0x49e3cf(0x102)]+'\x20('+_0x56ff68[_0x49e3cf(0xf9)]+')'),console[_0x49e3cf(0x196)](_0x49e3cf(0x136)+_0x56ff68['counts'][_0x49e3cf(0x188)]),console[_0x49e3cf(0x196)](_0x49e3cf(0x15f)+_0x56ff68[_0x49e3cf(0x125)][_0x49e3cf(0xd9)]),console[_0x49e3cf(0x196)]('\x20\x20Prompts:\x20'+_0x56ff68[_0x49e3cf(0x125)][_0x49e3cf(0xfc)]),console[_0x49e3cf(0x196)](_0x49e3cf(0x112)+_0x56ff68[_0x49e3cf(0x125)]['integrations']),(_0x46ba90[_0x49e3cf(0x12d)]===_0x49e3cf(0x117)||_0x46ba90[_0x49e3cf(0x12d)]===_0x49e3cf(0x15d))&&await handleSDKOutput([_0x56ff68],_0x46ba90),0x0;}catch(_0x534874){return handleSDKError(_0x534874,_0x46ba90),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x237c87,_0x3c220f){const _0x3f5e7b=a26_0x5cc08c,_0x2a56f5=_0x3c220f[_0x3f5e7b(0x159)]||CHAT_SELECTOR_PAGE_SIZE;let _0x399f1a=0x0,_0x558ac6=[];const _0x2a761c=(await import('prompts'))[_0x3f5e7b(0xdd)],_0x536c98=getChalk(_0x3c220f);while(!![]){const _0x2880f8=await withSpinner(_0x3f5e7b(0x199),()=>_0x237c87[_0x3f5e7b(0x186)][_0x3f5e7b(0xf7)](_0x2a56f5+_0x399f1a),{'verbose':_0x3c220f[_0x3f5e7b(0x10d)]});_0x558ac6=_0x2880f8['data'];const _0x38c00e=_0x558ac6[_0x3f5e7b(0x127)](_0x399f1a,_0x399f1a+_0x2a56f5),_0x559163=_0x558ac6[_0x3f5e7b(0xe3)]>_0x399f1a+_0x2a56f5,_0x355dbd=[...new Set(_0x38c00e[_0x3f5e7b(0x16a)](_0x19525b=>_0x19525b[_0x3f5e7b(0xda)][_0x3f5e7b(0x161)])[_0x3f5e7b(0x108)](_0x4fb62e=>_0x4fb62e!==undefined))],_0x38b285=new Map();await Promise[_0x3f5e7b(0x18a)](_0x355dbd[_0x3f5e7b(0x16a)](async _0x2570e4=>{const _0x210c9c=_0x3f5e7b;try{const _0x39ecc0=await _0x237c87[_0x210c9c(0x186)][_0x210c9c(0x142)](_0x2570e4);_0x38b285[_0x210c9c(0x18c)](_0x2570e4,_0x39ecc0[_0x210c9c(0xda)][_0x210c9c(0x155)]);}catch{_0x38b285['set'](_0x2570e4,_0x2570e4);}}));const _0x57866f=_0x38c00e[_0x3f5e7b(0x16a)](_0x55f8af=>{const _0x306261=_0x3f5e7b,_0x50e577=_0x55f8af[_0x306261(0xda)]['firstInputContent']||_0x306261(0x173),_0x2aaf0f=_0x50e577[_0x306261(0x120)]('\x0a')[0x0],_0x223587=_0x2aaf0f[_0x306261(0xe3)]>0x50?_0x2aaf0f['substring'](0x0,0x4d)+'...':_0x2aaf0f,_0x49c87d=_0x55f8af['attributes'][_0x306261(0x161)]?_0x38b285[_0x306261(0xed)](_0x55f8af[_0x306261(0xda)][_0x306261(0x161)])||_0x55f8af['attributes'][_0x306261(0x161)]:_0x306261(0x126),_0x17eace=_0x55f8af[_0x306261(0xda)]['lastConversationAt']||_0x55f8af[_0x306261(0xda)][_0x306261(0x19a)],_0x1628d5=new Date(_0x17eace),_0x473e56=new Date(),_0x36295a=_0x473e56[_0x306261(0x14e)]()-_0x1628d5[_0x306261(0x14e)](),_0x5e51=Math[_0x306261(0x15e)](_0x36295a/0xea60),_0x2ef555=Math[_0x306261(0x15e)](_0x36295a/0x36ee80),_0x2c81c2=Math['floor'](_0x36295a/0x5265c00);let _0x588b18;if(_0x5e51<0x1)_0x588b18=_0x306261(0x185);else{if(_0x5e51<0x3c)_0x588b18=_0x5e51+_0x306261(0x11f);else{if(_0x2ef555<0x18)_0x588b18=_0x2ef555+_0x306261(0x13f);else _0x2c81c2<0x7?_0x588b18=_0x2c81c2+_0x306261(0x14b):_0x588b18=_0x1628d5[_0x306261(0x11e)]('en-US',{'month':'short','day':_0x306261(0xf8)});}}return{'title':_0x223587+'\x20'+_0x536c98['dim']('['+_0x49c87d+']\x20'+_0x588b18),'value':_0x55f8af['id']};});_0x559163&&_0x57866f[_0x3f5e7b(0x17a)]({'title':_0x536c98[_0x3f5e7b(0x154)](_0x3f5e7b(0xe0)),'value':'__load_more__'});const _0x3215be=await _0x2a761c({'type':_0x3f5e7b(0x17e),'name':_0x3f5e7b(0x162),'message':'Select\x20a\x20chat\x20session:','choices':_0x57866f,'hint':_0x3f5e7b(0xea)});if(!_0x3215be[_0x3f5e7b(0x162)])return undefined;if(_0x3215be[_0x3f5e7b(0x162)]===_0x3f5e7b(0x104)){_0x399f1a+=_0x2a56f5;continue;}return _0x3215be[_0x3f5e7b(0x162)];}}export class ChatsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf7);[a26_0x5cc08c(0x146)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a26_0x5cc08c(0x158)](_0x375340){return executeChatHistoryCommand(_0x375340,'tdx\x20chats');}}
1
+ const a26_0x312a95=a26_0x229e;(function(_0x1a063b,_0x506ab1){const _0x25766a=a26_0x229e,_0x2bb6e9=_0x1a063b();while(!![]){try{const _0x3cf05b=parseInt(_0x25766a(0x219))/0x1*(-parseInt(_0x25766a(0x194))/0x2)+parseInt(_0x25766a(0x23f))/0x3*(-parseInt(_0x25766a(0x250))/0x4)+-parseInt(_0x25766a(0x1bc))/0x5+-parseInt(_0x25766a(0x222))/0x6+parseInt(_0x25766a(0x1ef))/0x7+-parseInt(_0x25766a(0x19a))/0x8*(parseInt(_0x25766a(0x1d3))/0x9)+parseInt(_0x25766a(0x217))/0xa*(parseInt(_0x25766a(0x253))/0xb);if(_0x3cf05b===_0x506ab1)break;else _0x2bb6e9['push'](_0x2bb6e9['shift']());}catch(_0x53d827){_0x2bb6e9['push'](_0x2bb6e9['shift']());}}}(a26_0x1dac,0x626f1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/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'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0xcd1495 from'node:fs';function handleSDKError(_0x2a1b10,_0x213a56){const _0x27b7c4=a26_0x229e;if(_0x2a1b10 instanceof SDKError)console['error'](_0x27b7c4(0x19c)+_0x2a1b10[_0x27b7c4(0x1ab)]),_0x213a56[_0x27b7c4(0x1d0)]&&(_0x2a1b10[_0x27b7c4(0x1c0)]&&console[_0x27b7c4(0x190)](_0x27b7c4(0x1a4)+_0x2a1b10['cause']),_0x2a1b10['stack']&&(console['error'](_0x27b7c4(0x22f)),console[_0x27b7c4(0x190)](_0x2a1b10[_0x27b7c4(0x246)])));else throw _0x2a1b10;}function formatChatHistoryEntry(_0x54270a,_0x4a6a20){const _0x59235f=a26_0x229e,_0x192ca9=getChalk(_0x4a6a20),_0x8274ae=_0x192ca9['dim'](_0x54270a['at']);if(_0x59235f(0x23d)in _0x54270a){const _0x2318f0=_0x192ca9[_0x59235f(0x247)]('[input]\x20\x20');return _0x8274ae+'\x20'+_0x2318f0+':\x20'+_0x54270a[_0x59235f(0x23d)];}if(_0x59235f(0x220)in _0x54270a){const _0x3e68c8=_0x192ca9[_0x59235f(0x1cc)]('[content]');return _0x8274ae+'\x20'+_0x3e68c8+':\x20'+_0x54270a['content'];}if('tool_call'in _0x54270a){const _0x25f91d=_0x192ca9[_0x59235f(0x1fe)]('[tool_call]'),{functionName:_0x314b4e,functionArguments:_0x382e85,targetFunction:_0x158a62}=_0x54270a['tool_call'];let _0x4e33a3=_0x8274ae+'\x20'+_0x25f91d+':\x20'+_0x192ca9[_0x59235f(0x245)](_0x314b4e);if(_0x382e85&&Object[_0x59235f(0x1a5)](_0x382e85)[_0x59235f(0x1f6)]>0x0){const _0x3f981f=Object[_0x59235f(0x224)](_0x382e85)['map'](([_0x386671,_0x3a9f4c])=>_0x386671+'='+JSON['stringify'](_0x3a9f4c))[_0x59235f(0x1bf)](',\x20');_0x4e33a3+='('+_0x3f981f+')';}_0x158a62&&(_0x4e33a3+=_0x192ca9[_0x59235f(0x1cd)]('\x20['+_0x158a62+']'));let _0x20be2a='';if(_0x54270a['tool_call'][_0x59235f(0x198)])_0x20be2a=_0x59235f(0x25d)+_0x54270a[_0x59235f(0x1fd)]['targetKnowledgeBase'][_0x59235f(0x1ee)];else{if(_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x227)])_0x20be2a=_0x59235f(0x21e)+_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x227)]['name'];else{if(_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x1a1)])_0x20be2a=_0x59235f(0x213)+_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x1a1)][_0x59235f(0x1ee)];else _0x54270a[_0x59235f(0x1fd)][_0x59235f(0x21a)]&&(_0x20be2a=_0x59235f(0x1ed)+_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x21a)][_0x59235f(0x1ee)]);}}return _0x4e33a3+_0x20be2a;}if(_0x59235f(0x1dc)in _0x54270a){const _0x1fb689=_0x192ca9['magenta'](_0x59235f(0x1a8)),{functionName:_0x254449,functionArguments:_0x41190a,content:_0x17923a,newChat:_0x563046}=_0x54270a['tool'];let _0x6042c2=_0x8274ae+'\x20'+_0x1fb689+':\x20'+_0x192ca9[_0x59235f(0x245)](_0x254449);if(_0x41190a){const _0x379b0f=typeof _0x41190a===_0x59235f(0x235)?_0x41190a:JSON['stringify'](_0x41190a);_0x6042c2+='('+_0x379b0f+')';}return _0x17923a&&(_0x6042c2+='\x0a'+_0x192ca9[_0x59235f(0x1cd)](_0x17923a)),_0x563046&&(_0x6042c2+=_0x192ca9[_0x59235f(0x1cd)](_0x59235f(0x237)+_0x563046['id'])),_0x6042c2;}if(_0x59235f(0x1c2)in _0x54270a){const _0x508bf7=_0x192ca9['blue'](_0x59235f(0x1ca));return _0x8274ae+'\x20'+_0x508bf7+':\x20'+_0x54270a[_0x59235f(0x1c2)][_0x59235f(0x1ee)]+'\x20('+_0x54270a['output'][_0x59235f(0x220)]['length']+_0x59235f(0x244);}if(_0x59235f(0x1a6)in _0x54270a){const _0x2caadf=_0x192ca9[_0x59235f(0x21c)](_0x59235f(0x202)),{width:_0x4d9558,height:_0x4c9db7,headerText:_0x2103a9}=_0x54270a[_0x59235f(0x1a6)],_0x40aae3=_0x2103a9?_0x59235f(0x229)+_0x2103a9:'';return _0x8274ae+'\x20'+_0x2caadf+':\x20'+_0x4d9558+'x'+_0x4c9db7+_0x40aae3;}if(_0x59235f(0x190)in _0x54270a){const _0xca328b=_0x192ca9['red'](_0x59235f(0x255));return _0x8274ae+'\x20'+_0xca328b+':\x20'+_0x54270a[_0x59235f(0x190)];}return _0x8274ae+'\x20'+_0x192ca9['dim'](_0x59235f(0x1c6))+':\x20'+JSON['stringify'](_0x54270a);}async function executeChatHistoryCommand(_0x494fab,_0x44944c){const _0x34e5e3=a26_0x229e,{options:_0x5c6c05,args:_0x28ae0c,tdx:_0x33c26c}=_0x494fab,_0x17b97f=_0x28ae0c[0x0],_0x5c973d=_0x5c6c05,_0x3ef0bc=_0x5c973d[_0x34e5e3(0x242)];try{if(_0x3ef0bc&&_0x17b97f)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x34e5e3(0x190)](_0x34e5e3(0x192)+_0x44944c+_0x34e5e3(0x22b)),0x1;if(!_0x17b97f&&!_0x3ef0bc&&_0x5c6c05[_0x34e5e3(0x1f2)]!==undefined){const _0x2fa31a=resolveLimit(_0x5c6c05[_0x34e5e3(0x191)],DEFAULT_LLM_LIMIT),_0x27c3ef=await withSpinner(_0x34e5e3(0x1be),()=>_0x33c26c[_0x34e5e3(0x1b3)][_0x34e5e3(0x1cf)](_0x2fa31a),{'verbose':_0x5c6c05[_0x34e5e3(0x1d0)]});return await handleSDKOutput(_0x27c3ef[_0x34e5e3(0x203)],_0x5c6c05),0x0;}const _0x3bb055=await getChatIdOrSelect(_0x33c26c,_0x5c6c05,_0x3ef0bc,_0x17b97f);if(!_0x3bb055)return 0x0;return await displayChatHistory(_0x3bb055,_0x33c26c,_0x5c6c05),0x0;}catch(_0x34e8cf){return handleSDKError(_0x34e8cf,_0x5c6c05),0x1;}}async function displayChatHistory(_0x145aad,_0x50915e,_0x45c788){const _0x3b2932=a26_0x229e,_0x13b6b8=await withSpinner(_0x3b2932(0x1bd)+_0x145aad+_0x3b2932(0x251),()=>_0x50915e[_0x3b2932(0x1b3)][_0x3b2932(0x230)](_0x145aad),{'verbose':_0x45c788['verbose']}),_0x3ba974=_0x13b6b8[_0x3b2932(0x203)][_0x3b2932(0x203)]??[];if(_0x3ba974['length']===0x0){console['log'](_0x3b2932(0x1c5));return;}if(_0x45c788['format']!==undefined)await handleSDKOutput(_0x3ba974,_0x45c788);else{const _0x1a2a9e=_0x3ba974[_0x3b2932(0x207)](_0xffd6ca=>formatChatHistoryEntry(_0xffd6ca,_0x45c788)),_0x404ad4=_0x1a2a9e[_0x3b2932(0x1bf)]('\x0a');await writeOutput(_0x404ad4,_0x45c788[_0x3b2932(0x1c2)],_0x3b2932(0x1b1));}}async function getChatIdOrSelect(_0x2a62b0,_0x467d08,_0x40688c,_0x51f242){const _0x2d80fa=a26_0x229e;if(_0x51f242)return _0x51f242;if(_0x40688c){const _0x37db1a=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x2a62b0['llm']['chats'](0x1),{'verbose':_0x467d08[_0x2d80fa(0x1d0)]});if(_0x37db1a['data'][_0x2d80fa(0x1f6)]===0x0)return console[_0x2d80fa(0x216)](_0x2d80fa(0x25a)),undefined;return _0x37db1a[_0x2d80fa(0x203)][0x0]['id'];}const _0x552313=await selectChatInteractively(_0x2a62b0,_0x467d08);if(!_0x552313)return console[_0x2d80fa(0x216)](_0x2d80fa(0x1d4)),undefined;return _0x552313;}async function getProjectIdOrDefault(_0x34393a){const _0x4e5a48=a26_0x229e,{tdx:_0x2d646b,options:_0x1835fb}=_0x34393a,_0x5f43d2=_0x1835fb['llmProject'];if(_0x5f43d2){const _0x184286=await withSpinner('Resolving\x20project\x20\x27'+_0x5f43d2+_0x4e5a48(0x251),()=>_0x2d646b[_0x4e5a48(0x1b3)][_0x4e5a48(0x193)](_0x5f43d2),{'verbose':_0x1835fb['verbose']});return _0x184286[_0x4e5a48(0x203)];}let _0x282781=_0x2d646b[_0x4e5a48(0x1b3)][_0x4e5a48(0x209)]();if(_0x282781)return _0x282781;const _0x44c00b=await withSpinner(_0x4e5a48(0x25c),()=>_0x2d646b['llm'][_0x4e5a48(0x1c7)](),{'verbose':_0x1835fb['verbose']});return _0x44c00b[_0x4e5a48(0x203)]['id'];}function toLLMProjectInfo(_0xd3b6f3){const _0x502570=a26_0x229e;return{'name':_0xd3b6f3[_0x502570(0x1ec)][_0x502570(0x1ee)],'description':_0xd3b6f3[_0x502570(0x1ec)]['description'],'createdAt':_0xd3b6f3[_0x502570(0x1ec)][_0x502570(0x1b4)],'updatedAt':_0xd3b6f3['attributes'][_0x502570(0x24a)]};}function toAgentInfo(_0x134a55){const _0x4af6fc=a26_0x229e;return{'name':_0x134a55[_0x4af6fc(0x1ec)]['name'],'description':_0x134a55[_0x4af6fc(0x1ec)][_0x4af6fc(0x19e)],'prompt':truncatePrompt(_0x134a55[_0x4af6fc(0x1ec)][_0x4af6fc(0x233)]),'createdAt':_0x134a55['attributes'][_0x4af6fc(0x1b4)],'updatedAt':_0x134a55[_0x4af6fc(0x1ec)][_0x4af6fc(0x24a)]};}function truncatePrompt(_0x4e81cd){const _0x54a65f=a26_0x229e;if(!_0x4e81cd)return undefined;const _0x4405c9=0x64;if(_0x4e81cd[_0x54a65f(0x1f6)]<=_0x4405c9)return _0x4e81cd;return _0x4e81cd['slice'](0x0,_0x4405c9)+_0x54a65f(0x1e5);}export class LLMModelsCommand extends BaseCommand{[a26_0x312a95(0x1ee)]='llm:models';[a26_0x312a95(0x19e)]=a26_0x312a95(0x239);async['execute'](_0x55f829){const _0x19ce2d=a26_0x312a95,{options:_0x307dfe,tdx:_0x1a93b6}=_0x55f829;try{const _0x42058f=await withSpinner(_0x19ce2d(0x22a),()=>_0x1a93b6[_0x19ce2d(0x1b3)][_0x19ce2d(0x1da)](),{'verbose':_0x307dfe['verbose']});return await handleSDKOutput(_0x42058f[_0x19ce2d(0x203)],_0x307dfe),0x0;}catch(_0x312fbf){return handleSDKError(_0x312fbf,_0x307dfe),0x1;}}}export class LLMProjectsCommand extends BaseCommand{['name']=a26_0x312a95(0x1f3);[a26_0x312a95(0x19e)]='List\x20all\x20LLM\x20projects';async[a26_0x312a95(0x1e2)](_0x3d8fd4){const _0x107ce2=a26_0x312a95,{options:_0x498960,args:_0x127d71,tdx:_0x682f1f}=_0x3d8fd4;try{const _0x196356=_0x127d71[0x0],_0x3d2aa1=resolveLimit(_0x498960['limit'],DEFAULT_LLM_LIMIT),_0x418cff=await withSpinner(_0x107ce2(0x1b0),()=>_0x682f1f[_0x107ce2(0x1b3)][_0x107ce2(0x214)](_0x3d2aa1),{'verbose':_0x498960[_0x107ce2(0x1d0)]});let _0x395d5a=_0x418cff[_0x107ce2(0x203)];_0x196356&&(_0x395d5a=_0x418cff[_0x107ce2(0x203)][_0x107ce2(0x24f)](_0x323e82=>matchGlobPattern(_0x323e82['attributes'][_0x107ce2(0x1ee)],_0x196356)));const _0x39c1db=_0x395d5a[_0x107ce2(0x207)](toLLMProjectInfo);return await handleSDKOutput(_0x39c1db,_0x498960),0x0;}catch(_0xee9788){return handleSDKError(_0xee9788,_0x498960),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']='llm:agents';['description']=a26_0x312a95(0x1d9);async[a26_0x312a95(0x1e2)](_0xb4ba09){const _0x4623b6=a26_0x312a95,{options:_0x87b4d4,args:_0x4a3ea0,tdx:_0x132243}=_0xb4ba09;try{const _0x11b012=_0x4a3ea0[0x0];let _0xcb39f3,_0x37cec8=_0x11b012;if(_0x11b012&&_0x11b012[_0x4623b6(0x256)]('/')){const _0x48743f=_0x11b012[_0x4623b6(0x24e)]('/');if(_0x48743f[_0x4623b6(0x1f6)]===0x2){const [_0x1f9826,_0x43ebaa]=_0x48743f,_0x3cd2c0=await _0x132243['llm'][_0x4623b6(0x214)](),_0x13513d=_0x3cd2c0[_0x4623b6(0x21f)](_0x2b3872=>_0x2b3872[_0x4623b6(0x1ec)][_0x4623b6(0x1ee)][_0x4623b6(0x21d)]()===_0x1f9826['toLowerCase']());if(!_0x13513d)throw new SDKError(ErrorCode[_0x4623b6(0x231)],_0x4623b6(0x23c)+_0x1f9826,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0xcb39f3=_0x13513d['id'],_0x37cec8=_0x43ebaa;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4623b6(0x212)+_0x11b012,undefined,{'helpText':_0x4623b6(0x25b)});}else _0xcb39f3=await getProjectIdOrDefault(_0xb4ba09);const _0x572ec4=await withSpinner(_0x4623b6(0x1f0),()=>_0x132243[_0x4623b6(0x1b3)][_0x4623b6(0x20c)](_0xcb39f3),{'verbose':_0x87b4d4[_0x4623b6(0x1d0)]});let _0x16805d=_0x572ec4[_0x4623b6(0x203)];_0x37cec8&&(_0x16805d=_0x572ec4['data'][_0x4623b6(0x24f)](_0x4c8253=>matchGlobPattern(_0x4c8253[_0x4623b6(0x1ec)][_0x4623b6(0x1ee)],_0x37cec8)));const _0x5079aa=_0x16805d[_0x4623b6(0x207)](toAgentInfo);return await handleSDKOutput(_0x5079aa,_0x87b4d4),0x0;}catch(_0x2be878){return handleSDKError(_0x2be878,_0x87b4d4),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1dd);['description']='Show\x20agent\x20details';async['execute'](_0x1aa905){const _0x326ae9=a26_0x312a95,{options:_0x4f1ece,args:_0x5dc3d2,tdx:_0x32d947}=_0x1aa905;if(_0x5dc3d2['length']===0x0)return console[_0x326ae9(0x190)](_0x326ae9(0x197)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x1d30c7=_0x5dc3d2[0x0];try{const _0x397507=await getProjectIdOrDefault(_0x1aa905),_0x138885=await withSpinner(_0x326ae9(0x1df)+_0x1d30c7+_0x326ae9(0x251),()=>_0x32d947[_0x326ae9(0x1b3)][_0x326ae9(0x23e)](_0x1d30c7,_0x397507),{'verbose':_0x4f1ece[_0x326ae9(0x1d0)]}),_0x52c098=await withSpinner(_0x326ae9(0x1d8),()=>_0x32d947[_0x326ae9(0x1b3)][_0x326ae9(0x215)](_0x138885[_0x326ae9(0x203)]),{'verbose':_0x4f1ece[_0x326ae9(0x1d0)]});return await handleSDKOutput([_0x52c098[_0x326ae9(0x203)]],_0x4f1ece),0x0;}catch(_0x538963){return handleSDKError(_0x538963,_0x4f1ece),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x25e);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1ba);async[a26_0x312a95(0x1e2)](_0x21cedf){const _0x208edf=a26_0x312a95,{options:_0x1d0da6,args:_0x4544ae,tdx:_0x54fa74}=_0x21cedf;if(_0x4544ae[_0x208edf(0x1f6)]===0x0)return console[_0x208edf(0x190)](_0x208edf(0x197)),console[_0x208edf(0x190)](_0x208edf(0x20e)),console[_0x208edf(0x190)](_0x208edf(0x22e)),0x1;const _0x1ab656=_0x4544ae[0x0],_0x44bfbc=_0x1d0da6,_0x5d94f3=_0x44bfbc[_0x208edf(0x1e1)],_0xfcb4a2=_0x44bfbc[_0x208edf(0x1a9)]||_0x208edf(0x1b8),_0xdcf71b=_0x44bfbc[_0x208edf(0x1e9)],_0x5de387=_0x44bfbc['maxToolIterations']?Number(_0x44bfbc[_0x208edf(0x1c4)]):undefined,_0xeba110=_0x44bfbc[_0x208edf(0x199)]?Number(_0x44bfbc['temperature']):undefined;try{let _0x531fa9,_0x42dc63;if(_0x1ab656[_0x208edf(0x256)]('/')){const _0x14df5b=_0x1ab656[_0x208edf(0x24e)]('/');if(_0x14df5b[_0x208edf(0x1f6)]===0x2){const [_0x2a21cd,_0x4aeb57]=_0x14df5b,_0x406825=await withSpinner(_0x208edf(0x226)+_0x2a21cd+_0x208edf(0x251),()=>_0x54fa74[_0x208edf(0x1b3)][_0x208edf(0x193)](_0x2a21cd),{'verbose':_0x1d0da6['verbose']});_0x531fa9=_0x406825['data'],_0x42dc63=_0x4aeb57;}else throw new SDKError(ErrorCode[_0x208edf(0x195)],'Invalid\x20path\x20syntax:\x20'+_0x1ab656,undefined,{'helpText':_0x208edf(0x25b)});}else _0x531fa9=await getProjectIdOrDefault(_0x21cedf),_0x42dc63=_0x1ab656;const _0x1f7fe1=await withSpinner(_0x208edf(0x1e6)+_0x42dc63+_0x208edf(0x251),()=>_0x54fa74['llm'][_0x208edf(0x1d1)]({'name':_0x42dc63,'projectId':_0x531fa9,'modelType':_0xfcb4a2,'systemPrompt':_0x5d94f3,'starterMessage':_0xdcf71b,'maxToolIterations':_0x5de387,'temperature':_0xeba110}),{'verbose':_0x1d0da6['verbose']});return console[_0x208edf(0x216)](_0x208edf(0x225)+_0x1f7fe1['data']['id']),await handleSDKOutput([_0x1f7fe1['data']],_0x1d0da6),0x0;}catch(_0x27fb07){return handleSDKError(_0x27fb07,_0x1d0da6),0x1;}}}function a26_0x1dac(){const _0x545678=['getOrCreateDefaultProject','Delete\x20an\x20LLM\x20project','llm:project:create','[output]\x20','tdx\x20llm\x20history','green','dim','prompts','chats','verbose','createAgent','jsonl','989397ZcBWrL','\x0aCancelled','llm:history','firstInputContent','Creating\x20project\x20\x27','Fetching\x20agent...','List\x20agents\x20in\x20current\x20project','models','llm:use','tool','llm:agent:show','counts','Resolving\x20agent\x20\x27','\x20\x20Agents:\x20','systemPrompt','execute','\x20\x20Knowledge\x20Bases:\x20','Set\x20current\x20project\x20context','...','Creating\x20agent\x20\x27','Deleting\x20agent...','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','starterMessage','Update\x20an\x20existing\x20agent','setCurrentProject','attributes','\x20->\x20ImageGen:','name','1910720sWlDgh','Fetching\x20agents...','d\x20ago','format','llm:projects','getTime','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','length','agentId','restoreProject','select','Usage:\x20tdx\x20llm\x20use\x20<project-name>','lastConversationAt','Error:\x20Project\x20name\x20is\x20required','tool_call','yellow','Setting\x20project\x20context\x20to\x20\x27','Agent\x20deleted:\x20','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','[image]\x20\x20','data','existsSync','llm:agent:update','Project\x20backed\x20up\x20to:\x20','map','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','getCurrentProject','Create\x20a\x20new\x20LLM\x20project','get','agents','chatId','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Restore\x20cancelled.','deleteAgent','llm:project:backup','Invalid\x20path\x20syntax:\x20','\x20->\x20WebSearch:','projects','agent','log','660shMKRP','floor','8vxVVaJ','targetImageGenerator','all','blue','toLowerCase','\x20->\x20Agent:','find','content','outputDir','1420488ouJaQE','projectName','entries','Agent\x20created:\x20','Resolving\x20project\x20\x27','targetAgent','numeric','\x20-\x20','Fetching\x20available\x20models...','\x20--last','dryRun','Select\x20a\x20chat\x20session:','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','\x0aStack\x20trace:','history','LLM_PROJECT_NOT_FOUND','knowledgeBases','prompt','h\x20ago','string','Load\x20more...','\x20→\x20chat:\x20','backupProject','List\x20available\x20LLM\x20models','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Restoring\x20project\x20from\x20\x27','Project\x20not\x20found:\x20','input','resolveAgentId','1164JhcjST','Deleting\x20project\x20\x27','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','last','yes','\x20bytes)','bold','stack','cyan','llm:project:delete','(no\x20message)','updatedAt','llm:agent:delete','short','integrations','split','filter','1084NoySfQ','\x27...','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','172117ftqFQi','\x20\x20Prompts:\x20','[error]\x20\x20','includes','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','Project\x20context\x20set\x20to:\x20','(no\x20agent)','No\x20chat\x20sessions\x20found.','Use\x20format:\x20project-name/agent-name','Getting\x20default\x20project...','\x20->\x20KB:','llm:agent:create','substring','error','limit','Usage:\x20','resolveProjectId','103478lRrJyf','INVALID_ARGUMENT','default','Error:\x20Agent\x20name\x20is\x20required','targetKnowledgeBase','temperature','8WxFEYk','sourceSite','Error:\x20','createProject','description','\x20\x20Integrations:\x20','__load_more__','targetWebSearchTool','Analyzing\x20project\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','\x20\x20Cause:\x20','keys','image','rmSync','[tool]\x20\x20\x20','model','set','message','getBackupMetadata','deleteProject','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','.llm','Fetching\x20projects...','table','llm:project:restore','llm','createdAt','json','toLocaleDateString','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','claude-4.5-haiku','push','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','183680IvpqOJ','Fetching\x20chat\x20history\x20for\x20\x27','Fetching\x20chat\x20sessions...','join','cause','Output\x20directory\x20\x27','output','exportedFrom','maxToolIterations','No\x20messages\x20found\x20in\x20chat\x20history.','[unknown]'];a26_0x1dac=function(){return _0x545678;};return a26_0x1dac();}function a26_0x229e(_0x215add,_0x5b9009){_0x215add=_0x215add-0x190;const _0x1dac96=a26_0x1dac();let _0x229ef1=_0x1dac96[_0x215add];return _0x229ef1;}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x205);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1ea);async[a26_0x312a95(0x1e2)](_0x1b36db){const _0x34e174=a26_0x312a95,{options:_0x27a84a,args:_0x210a54,tdx:_0x42f5b1}=_0x1b36db;if(_0x210a54[_0x34e174(0x1f6)]===0x0)return console[_0x34e174(0x190)](_0x34e174(0x197)),console[_0x34e174(0x190)](_0x34e174(0x1bb)),0x1;const _0x50d8fd=_0x210a54[0x0],_0x3c709d=_0x27a84a,_0x55e3e7=_0x3c709d[_0x34e174(0x1ee)],_0x36f1df=_0x3c709d[_0x34e174(0x233)],_0x548185=_0x3c709d['description'],_0x10fbed=_0x3c709d[_0x34e174(0x1e9)];if(!_0x55e3e7&&!_0x36f1df&&!_0x548185&&!_0x10fbed)return console[_0x34e174(0x190)](_0x34e174(0x252)),console[_0x34e174(0x190)](_0x34e174(0x1b7)),0x1;try{const _0xd71e93=await getProjectIdOrDefault(_0x1b36db),_0x10d442=await withSpinner('Resolving\x20agent\x20\x27'+_0x50d8fd+_0x34e174(0x251),()=>_0x42f5b1[_0x34e174(0x1b3)]['resolveAgentId'](_0x50d8fd,_0xd71e93),{'verbose':_0x27a84a[_0x34e174(0x1d0)]}),_0x392d09=_0x10d442[_0x34e174(0x203)],_0x2a0539=await withSpinner('Updating\x20agent...',()=>_0x42f5b1[_0x34e174(0x1b3)]['updateAgent'](_0x392d09,{'name':_0x55e3e7,'prompt':_0x36f1df,'description':_0x548185,'starterMessage':_0x10fbed}),{'verbose':_0x27a84a[_0x34e174(0x1d0)]});return console['log']('Agent\x20updated:\x20'+_0x2a0539['data']['id']),await handleSDKOutput([_0x2a0539['data']],_0x27a84a),0x0;}catch(_0x31febd){return handleSDKError(_0x31febd,_0x27a84a),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x24b);[a26_0x312a95(0x19e)]='Delete\x20an\x20agent';async[a26_0x312a95(0x1e2)](_0x5778e1){const _0xc8d179=a26_0x312a95,{options:_0x4d1eb0,args:_0x59fd52,tdx:_0x193fe4}=_0x5778e1;if(_0x59fd52[_0xc8d179(0x1f6)]===0x0)return console[_0xc8d179(0x190)](_0xc8d179(0x197)),console[_0xc8d179(0x190)](_0xc8d179(0x1a3)),0x1;const _0x538c93=_0x59fd52[0x0];try{const _0x155ba1=await getProjectIdOrDefault(_0x5778e1),_0x451289=await withSpinner(_0xc8d179(0x1df)+_0x538c93+'\x27...',()=>_0x193fe4[_0xc8d179(0x1b3)][_0xc8d179(0x23e)](_0x538c93,_0x155ba1),{'verbose':_0x4d1eb0[_0xc8d179(0x1d0)]}),_0x3426df=_0x451289[_0xc8d179(0x203)];return await withSpinner(_0xc8d179(0x1e7),()=>_0x193fe4[_0xc8d179(0x1b3)][_0xc8d179(0x210)](_0x3426df),{'verbose':_0x4d1eb0['verbose']}),console[_0xc8d179(0x216)](_0xc8d179(0x200)+_0x3426df),0x0;}catch(_0x254bfe){return handleSDKError(_0x254bfe,_0x4d1eb0),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1d5);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1ae);async['execute'](_0x437d5f){const _0xdad2f5=a26_0x312a95;return executeChatHistoryCommand(_0x437d5f,_0xdad2f5(0x1cb));}}export class LLMUseCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1db);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1e4);async['execute'](_0x3ab0df){const _0x25349f=a26_0x312a95,{options:_0x23af16,args:_0x12b6cd,tdx:_0x344315}=_0x3ab0df;if(_0x12b6cd[_0x25349f(0x1f6)]===0x0)return console['error'](_0x25349f(0x1fc)),console[_0x25349f(0x190)](_0x25349f(0x1fa)),0x1;const _0x404b9b=_0x12b6cd[0x0];try{return await withSpinner(_0x25349f(0x1ff)+_0x404b9b+_0x25349f(0x251),()=>_0x344315[_0x25349f(0x1b3)][_0x25349f(0x1eb)](_0x404b9b),{'verbose':_0x23af16[_0x25349f(0x1d0)]}),console['log'](_0x25349f(0x258)+_0x404b9b),0x0;}catch(_0x54fe6f){return handleSDKError(_0x54fe6f,_0x23af16),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1c9);[a26_0x312a95(0x19e)]=a26_0x312a95(0x20a);async['execute'](_0x57cbef){const _0x1b9f4a=a26_0x312a95,{options:_0x53fb38,args:_0x42bbf1,tdx:_0x41eaad}=_0x57cbef;if(_0x42bbf1['length']===0x0)return console[_0x1b9f4a(0x190)]('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x1b9f4a(0x241)),0x1;const _0x31eec5=_0x42bbf1[0x0],_0x17ef11=_0x53fb38,_0x39d5fd=_0x17ef11[_0x1b9f4a(0x19e)];try{const _0x471fad=await withSpinner(_0x1b9f4a(0x1d7)+_0x31eec5+_0x1b9f4a(0x251),()=>_0x41eaad[_0x1b9f4a(0x1b3)][_0x1b9f4a(0x19d)]({'name':_0x31eec5,'description':_0x39d5fd}),{'verbose':_0x53fb38[_0x1b9f4a(0x1d0)]});console[_0x1b9f4a(0x216)]('Project\x20created:\x20'+_0x471fad[_0x1b9f4a(0x203)]['id']);const _0x1b74ad=toLLMProjectInfo(_0x471fad[_0x1b9f4a(0x203)]);return await handleSDKOutput([_0x1b74ad],_0x53fb38),0x0;}catch(_0x327f32){return handleSDKError(_0x327f32,_0x53fb38),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{['name']=a26_0x312a95(0x248);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1c8);async['execute'](_0x520d09){const _0x54be90=a26_0x312a95,{options:_0x2b1c05,args:_0x11f8e9,tdx:_0x5d44d3}=_0x520d09;if(_0x11f8e9[_0x54be90(0x1f6)]===0x0)return console[_0x54be90(0x190)](_0x54be90(0x1fc)),console[_0x54be90(0x190)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x34b5da=_0x11f8e9[0x0];try{return await withSpinner(_0x54be90(0x240)+_0x34b5da+'\x27...',()=>_0x5d44d3[_0x54be90(0x1b3)][_0x54be90(0x1ad)](_0x34b5da),{'verbose':_0x2b1c05['verbose']}),console['log']('Project\x20deleted:\x20'+_0x34b5da),0x0;}catch(_0x1b579b){return handleSDKError(_0x1b579b,_0x2b1c05),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a26_0x312a95(0x211);[a26_0x312a95(0x19e)]='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder';async[a26_0x312a95(0x1e2)](_0x4bd974){const _0xd3f3f6=a26_0x312a95,{options:_0x5de120,args:_0x8c6812,tdx:_0x4241ae}=_0x4bd974;if(_0x8c6812[_0xd3f3f6(0x1f6)]===0x0)return console[_0xd3f3f6(0x190)](_0xd3f3f6(0x1fc)),console[_0xd3f3f6(0x190)](_0xd3f3f6(0x257)),0x1;const _0x3423cd=_0x8c6812[0x0],_0x1649ea=_0x5de120,_0x3466d0=_0x1649ea[_0xd3f3f6(0x1c2)],_0x1763f3=_0x1649ea[_0xd3f3f6(0x22c)];try{const _0x528c84=_0x3466d0||_0x3423cd+_0xd3f3f6(0x1af);if(a26_0xcd1495[_0xd3f3f6(0x204)](_0x528c84)&&!_0x1763f3){if(!_0x5de120[_0xd3f3f6(0x243)]){const _0xdffb30=await confirm(_0xd3f3f6(0x1c1)+_0x528c84+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0xdffb30)return console[_0xd3f3f6(0x216)]('Backup\x20cancelled.'),0x0;}a26_0xcd1495[_0xd3f3f6(0x1a7)](_0x528c84,{'recursive':!![]});}const _0x405e40=await withSpinner(_0x1763f3?_0xd3f3f6(0x1a2)+_0x3423cd+'\x27...':'Backing\x20up\x20project\x20\x27'+_0x3423cd+_0xd3f3f6(0x251),()=>_0x4241ae[_0xd3f3f6(0x1b3)][_0xd3f3f6(0x238)](_0x3423cd,_0x3466d0,{'dryRun':_0x1763f3}),{'verbose':_0x5de120['verbose']}),_0x7c5361=_0x405e40[_0xd3f3f6(0x203)];return _0x1763f3?console[_0xd3f3f6(0x216)](_0xd3f3f6(0x208)+_0x7c5361[_0xd3f3f6(0x221)]):console[_0xd3f3f6(0x216)](_0xd3f3f6(0x206)+_0x7c5361[_0xd3f3f6(0x221)]),console['log'](_0xd3f3f6(0x1e0)+_0x7c5361['counts'][_0xd3f3f6(0x20c)]),console[_0xd3f3f6(0x216)](_0xd3f3f6(0x1e3)+_0x7c5361[_0xd3f3f6(0x1de)]['knowledgeBases']),console[_0xd3f3f6(0x216)](_0xd3f3f6(0x254)+_0x7c5361[_0xd3f3f6(0x1de)][_0xd3f3f6(0x1ce)]),console[_0xd3f3f6(0x216)]('\x20\x20Integrations:\x20'+_0x7c5361[_0xd3f3f6(0x1de)][_0xd3f3f6(0x24d)]),(_0x5de120[_0xd3f3f6(0x1f2)]===_0xd3f3f6(0x1b5)||_0x5de120['format']===_0xd3f3f6(0x1d2))&&await handleSDKOutput([_0x7c5361],_0x5de120),0x0;}catch(_0x355c7b){return handleSDKError(_0x355c7b,_0x5de120),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1b2);[a26_0x312a95(0x19e)]=a26_0x312a95(0x201);async[a26_0x312a95(0x1e2)](_0x1df9ff){const _0xf7e623=a26_0x312a95,{options:_0x7df5ee,args:_0x49e650,tdx:_0x443637}=_0x1df9ff;if(_0x49e650['length']===0x0)return console[_0xf7e623(0x190)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0xf7e623(0x190)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x62c0=_0x49e650[0x0],_0x53ff06=_0x7df5ee,_0x48a201=_0x53ff06[_0xf7e623(0x1ee)],_0x4f75e9=_0x53ff06['dryRun'];try{if(!_0x4f75e9){const _0x159baf=_0x443637[_0xf7e623(0x1b3)][_0xf7e623(0x1ac)](_0x62c0),_0x31c772=_0x48a201||_0x159baf[_0xf7e623(0x1c3)]['projectName'],_0x299875=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x443637['llm'][_0xf7e623(0x214)](),{'verbose':_0x7df5ee[_0xf7e623(0x1d0)]}),_0x14dc84=_0x299875[_0xf7e623(0x203)][_0xf7e623(0x21f)](_0x413877=>_0x413877['attributes'][_0xf7e623(0x1ee)]===_0x31c772);if(_0x14dc84&&!_0x7df5ee[_0xf7e623(0x243)]){const _0x2672eb=await confirm('A\x20project\x20named\x20\x27'+_0x31c772+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x2672eb)return console[_0xf7e623(0x216)](_0xf7e623(0x20f)),0x0;}}const _0xbeaa27=await withSpinner(_0x4f75e9?'Validating\x20backup\x20from\x20\x27'+_0x62c0+_0xf7e623(0x251):_0xf7e623(0x23b)+_0x62c0+_0xf7e623(0x251),()=>_0x443637['llm'][_0xf7e623(0x1f8)](_0x62c0,{'name':_0x48a201,'dryRun':_0x4f75e9}),{'verbose':_0x7df5ee[_0xf7e623(0x1d0)]}),_0x287e1a=_0xbeaa27['data'];return _0x287e1a[_0xf7e623(0x19b)]&&console['log']('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x287e1a[_0xf7e623(0x19b)]+'\x27'),_0x4f75e9?console[_0xf7e623(0x216)](_0xf7e623(0x23a)+_0x287e1a[_0xf7e623(0x223)]):console[_0xf7e623(0x216)]('Project\x20restored:\x20'+_0x287e1a[_0xf7e623(0x223)]+'\x20('+_0x287e1a['projectId']+')'),console['log'](_0xf7e623(0x1e0)+_0x287e1a[_0xf7e623(0x1de)][_0xf7e623(0x20c)]),console[_0xf7e623(0x216)](_0xf7e623(0x1e3)+_0x287e1a['counts'][_0xf7e623(0x232)]),console[_0xf7e623(0x216)](_0xf7e623(0x254)+_0x287e1a[_0xf7e623(0x1de)]['prompts']),console[_0xf7e623(0x216)](_0xf7e623(0x19f)+_0x287e1a['counts'][_0xf7e623(0x24d)]),(_0x7df5ee[_0xf7e623(0x1f2)]===_0xf7e623(0x1b5)||_0x7df5ee[_0xf7e623(0x1f2)]===_0xf7e623(0x1d2))&&await handleSDKOutput([_0x287e1a],_0x7df5ee),0x0;}catch(_0xaa4e3a){return handleSDKError(_0xaa4e3a,_0x7df5ee),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x38b47a,_0x43fea6){const _0x5f2e07=a26_0x312a95,_0x10634a=_0x43fea6[_0x5f2e07(0x191)]||CHAT_SELECTOR_PAGE_SIZE;let _0x237f07=0x0,_0xaca990=[];const _0x39f699=(await import(_0x5f2e07(0x1ce)))[_0x5f2e07(0x196)],_0x41f1c2=getChalk(_0x43fea6);while(!![]){const _0x5b2236=await withSpinner(_0x5f2e07(0x1be),()=>_0x38b47a['llm'][_0x5f2e07(0x1cf)](_0x10634a+_0x237f07),{'verbose':_0x43fea6[_0x5f2e07(0x1d0)]});_0xaca990=_0x5b2236[_0x5f2e07(0x203)];const _0x821f6=_0xaca990['slice'](_0x237f07,_0x237f07+_0x10634a),_0xbcf536=_0xaca990[_0x5f2e07(0x1f6)]>_0x237f07+_0x10634a,_0x3fa27b=[...new Set(_0x821f6[_0x5f2e07(0x207)](_0x29632e=>_0x29632e[_0x5f2e07(0x1ec)][_0x5f2e07(0x1f7)])[_0x5f2e07(0x24f)](_0x56f7b6=>_0x56f7b6!==undefined))],_0x4ae1a9=new Map();await Promise[_0x5f2e07(0x21b)](_0x3fa27b['map'](async _0x52e1d1=>{const _0x15e64a=_0x5f2e07;try{const _0x32d538=await _0x38b47a['llm']['agent'](_0x52e1d1);_0x4ae1a9[_0x15e64a(0x1aa)](_0x52e1d1,_0x32d538[_0x15e64a(0x1ec)][_0x15e64a(0x1ee)]);}catch{_0x4ae1a9[_0x15e64a(0x1aa)](_0x52e1d1,_0x52e1d1);}}));const _0x1f62fe=_0x821f6[_0x5f2e07(0x207)](_0x48852f=>{const _0x4a0b44=_0x5f2e07,_0xeea4cc=_0x48852f[_0x4a0b44(0x1ec)][_0x4a0b44(0x1d6)]||_0x4a0b44(0x249),_0x493772=_0xeea4cc[_0x4a0b44(0x24e)]('\x0a')[0x0],_0x1705c7=_0x493772['length']>0x50?_0x493772[_0x4a0b44(0x25f)](0x0,0x4d)+_0x4a0b44(0x1e5):_0x493772,_0x580d41=_0x48852f[_0x4a0b44(0x1ec)]['agentId']?_0x4ae1a9[_0x4a0b44(0x20b)](_0x48852f[_0x4a0b44(0x1ec)]['agentId'])||_0x48852f[_0x4a0b44(0x1ec)][_0x4a0b44(0x1f7)]:_0x4a0b44(0x259),_0x1a8ec9=_0x48852f[_0x4a0b44(0x1ec)][_0x4a0b44(0x1fb)]||_0x48852f['attributes']['updatedAt'],_0x2029e8=new Date(_0x1a8ec9),_0x1d1005=new Date(),_0x28c303=_0x1d1005[_0x4a0b44(0x1f4)]()-_0x2029e8['getTime'](),_0xf95467=Math['floor'](_0x28c303/0xea60),_0x17ce9d=Math[_0x4a0b44(0x218)](_0x28c303/0x36ee80),_0x375628=Math[_0x4a0b44(0x218)](_0x28c303/0x5265c00);let _0x4beec8;if(_0xf95467<0x1)_0x4beec8='just\x20now';else{if(_0xf95467<0x3c)_0x4beec8=_0xf95467+'m\x20ago';else{if(_0x17ce9d<0x18)_0x4beec8=_0x17ce9d+_0x4a0b44(0x234);else _0x375628<0x7?_0x4beec8=_0x375628+_0x4a0b44(0x1f1):_0x4beec8=_0x2029e8[_0x4a0b44(0x1b6)]('en-US',{'month':_0x4a0b44(0x24c),'day':_0x4a0b44(0x228)});}}return{'title':_0x1705c7+'\x20'+_0x41f1c2[_0x4a0b44(0x1cd)]('['+_0x580d41+']\x20'+_0x4beec8),'value':_0x48852f['id']};});_0xbcf536&&_0x1f62fe[_0x5f2e07(0x1b9)]({'title':_0x41f1c2[_0x5f2e07(0x247)](_0x5f2e07(0x236)),'value':_0x5f2e07(0x1a0)});const _0x3253af=await _0x39f699({'type':_0x5f2e07(0x1f9),'name':_0x5f2e07(0x20d),'message':_0x5f2e07(0x22d),'choices':_0x1f62fe,'hint':_0x5f2e07(0x1f5)});if(!_0x3253af[_0x5f2e07(0x20d)])return undefined;if(_0x3253af[_0x5f2e07(0x20d)]==='__load_more__'){_0x237f07+=_0x10634a;continue;}return _0x3253af[_0x5f2e07(0x20d)];}}export class ChatsCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1cf);['description']=a26_0x312a95(0x1e8);async[a26_0x312a95(0x1e2)](_0x11672b){return executeChatHistoryCommand(_0x11672b,'tdx\x20chats');}}