@treasuredata/tdx 0.8.5 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) 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 +1 -0
  18. package/dist/commands/claude-command.d.ts.map +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-command.js.map +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/connection-command.js +1 -1
  25. package/dist/commands/context-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/describe.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.js +1 -1
  61. package/dist/proxy/claude-usage-tracker.js +1 -1
  62. package/dist/proxy/context-signature.js +1 -1
  63. package/dist/proxy/conversation-utils.js +1 -1
  64. package/dist/proxy/server.js +1 -1
  65. package/dist/proxy/session-cache.js +1 -1
  66. package/dist/sdk/api.js +1 -1
  67. package/dist/sdk/connection.js +1 -1
  68. package/dist/sdk/engage.js +1 -1
  69. package/dist/sdk/errors.js +1 -1
  70. package/dist/sdk/index.js +1 -1
  71. package/dist/sdk/job.js +1 -1
  72. package/dist/sdk/journey.js +1 -1
  73. package/dist/sdk/llm.js +1 -1
  74. package/dist/sdk/query.js +1 -1
  75. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  76. package/dist/sdk/segment/journey-yaml.js +1 -1
  77. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  78. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  79. package/dist/sdk/segment.js +1 -1
  80. package/dist/sdk/user.js +1 -1
  81. package/dist/sdk/workflow.js +1 -1
  82. package/dist/types/endpoints.js +1 -1
  83. package/dist/types/index.js +1 -1
  84. package/dist/utils/agent-ref-parser.js +1 -1
  85. package/dist/utils/async.js +1 -1
  86. package/dist/utils/chat-cache.js +1 -1
  87. package/dist/utils/colors.js +1 -1
  88. package/dist/utils/command-output.js +1 -1
  89. package/dist/utils/constants.js +1 -1
  90. package/dist/utils/diff.js +1 -1
  91. package/dist/utils/fields-display.js +1 -1
  92. package/dist/utils/file-permissions.js +1 -1
  93. package/dist/utils/format-detector.js +1 -1
  94. package/dist/utils/formatters.js +1 -1
  95. package/dist/utils/json-loader.js +1 -1
  96. package/dist/utils/llm-backup-utils.js +1 -1
  97. package/dist/utils/model-aliases.js +1 -1
  98. package/dist/utils/model-factors.js +1 -1
  99. package/dist/utils/option-validation.js +1 -1
  100. package/dist/utils/port.js +1 -1
  101. package/dist/utils/process.d.ts.map +1 -1
  102. package/dist/utils/process.js +1 -1
  103. package/dist/utils/process.js.map +1 -1
  104. package/dist/utils/prompt.js +1 -1
  105. package/dist/utils/segment-path-parser.js +1 -1
  106. package/dist/utils/segment-ref-parser.js +1 -1
  107. package/dist/utils/spinner.js +1 -1
  108. package/dist/utils/sql-parser.js +1 -1
  109. package/dist/utils/sse-parser.js +1 -1
  110. package/dist/utils/string-utils.js +1 -1
  111. package/dist/utils/table-ref-parser.js +1 -1
  112. package/dist/utils/tdx-config.js +1 -1
  113. package/dist/utils/tdx-logger.js +1 -1
  114. package/dist/utils/tree-formatter.js +1 -1
  115. package/dist/utils/version-check.js +1 -1
  116. package/dist/utils/workflow-utils.js +1 -1
  117. package/package.json +1 -1
@@ -1 +1 @@
1
- const a21_0x12887d=a21_0x4e34;function a21_0x2de5(){const _0x3523db=['error','name','1095983AeyDbd','site','List\x20all\x20databases','6FEeGHy','databases','cause','20230SYWfDm','\x20database','limit','Listing\x20databases...','data','192632GMvZcx','89366fzZhwY','description','execute','1184725QPEAAo','1962XWuvqo','18ZKSjyB','length','message','70473QaTFDX','2248864eUfaVB','query','Pattern:\x20','verbose'];a21_0x2de5=function(){return _0x3523db;};return a21_0x2de5();}(function(_0x210dfb,_0x1fb028){const _0x2d6b5f=a21_0x4e34,_0x3320ae=_0x210dfb();while(!![]){try{const _0x21f34b=parseInt(_0x2d6b5f(0x1cf))/0x1+parseInt(_0x2d6b5f(0x1e2))/0x2*(parseInt(_0x2d6b5f(0x1cc))/0x3)+parseInt(_0x2d6b5f(0x1e1))/0x4+parseInt(_0x2d6b5f(0x1ca))/0x5*(-parseInt(_0x2d6b5f(0x1d9))/0x6)+parseInt(_0x2d6b5f(0x1d6))/0x7+parseInt(_0x2d6b5f(0x1d0))/0x8+-parseInt(_0x2d6b5f(0x1cb))/0x9*(parseInt(_0x2d6b5f(0x1dc))/0xa);if(_0x21f34b===_0x1fb028)break;else _0x3320ae['push'](_0x3320ae['shift']());}catch(_0x3193d7){_0x3320ae['push'](_0x3320ae['shift']());}}}(a21_0x2de5,0x23c0f));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';function a21_0x4e34(_0x15d61b,_0x5beabb){_0x15d61b=_0x15d61b-0x1ca;const _0x2de50d=a21_0x2de5();let _0x4e34eb=_0x2de50d[_0x15d61b];return _0x4e34eb;}export class DatabasesCommand extends BaseCommand{[a21_0x12887d(0x1d5)]=a21_0x12887d(0x1da);[a21_0x12887d(0x1e3)]=a21_0x12887d(0x1d8);async[a21_0x12887d(0x1e4)](_0x1253dd){const _0x3f59e3=a21_0x12887d,{options:_0x25b4d4,args:_0x14f430,tdx:_0x124791}=_0x1253dd,_0x4b2aac=_0x14f430[0x0];try{_0x25b4d4[_0x3f59e3(0x1d3)]&&(console[_0x3f59e3(0x1d4)]('Site:\x20'+_0x25b4d4[_0x3f59e3(0x1d7)]),_0x4b2aac&&console[_0x3f59e3(0x1d4)](_0x3f59e3(0x1d2)+_0x4b2aac));const _0x292aef=resolveLimit(_0x25b4d4[_0x3f59e3(0x1de)],DEFAULT_LISTING_LIMIT),_0x30eef6=await withSpinner(_0x3f59e3(0x1df),()=>_0x124791[_0x3f59e3(0x1d1)]['listDatabases'](_0x4b2aac,_0x292aef),{'verbose':_0x25b4d4[_0x3f59e3(0x1d3)]}),_0x388925=_0x30eef6[_0x3f59e3(0x1e0)];return console[_0x3f59e3(0x1d4)]('✔\x20Found\x20'+_0x388925['length']+_0x3f59e3(0x1dd)+(_0x388925[_0x3f59e3(0x1cd)]!==0x1?'s':'')),await handleSDKOutput(_0x388925,{..._0x25b4d4,'limit':_0x292aef}),0x0;}catch(_0x3c7c6f){if(_0x3c7c6f instanceof SDKError)return console[_0x3f59e3(0x1d4)]('Error:\x20'+_0x3c7c6f[_0x3f59e3(0x1ce)]),_0x3c7c6f['cause']&&console[_0x3f59e3(0x1d4)]('\x20\x20Cause:\x20'+_0x3c7c6f[_0x3f59e3(0x1db)]),0x1;throw _0x3c7c6f;}}}
1
+ const a21_0x412482=a21_0x573f;(function(_0xc9b464,_0x16dcf4){const _0x10205b=a21_0x573f,_0x510a36=_0xc9b464();while(!![]){try{const _0x5d3056=parseInt(_0x10205b(0x184))/0x1*(parseInt(_0x10205b(0x16f))/0x2)+-parseInt(_0x10205b(0x17c))/0x3+-parseInt(_0x10205b(0x173))/0x4*(parseInt(_0x10205b(0x17f))/0x5)+parseInt(_0x10205b(0x17a))/0x6+-parseInt(_0x10205b(0x170))/0x7+-parseInt(_0x10205b(0x171))/0x8+parseInt(_0x10205b(0x176))/0x9;if(_0x5d3056===_0x16dcf4)break;else _0x510a36['push'](_0x510a36['shift']());}catch(_0x19fb88){_0x510a36['push'](_0x510a36['shift']());}}}(a21_0x398a,0xadaf0));function a21_0x573f(_0x2974cb,_0x368053){_0x2974cb=_0x2974cb-0x16b;const _0x398a57=a21_0x398a();let _0x573ff6=_0x398a57[_0x2974cb];return _0x573ff6;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a21_0x398a(){const _0x7f50d5=['listDatabases','length','error','7741086kEDSUi','description','3179076ONgPAe','Error:\x20','verbose','1113790tDFXSw','cause','Site:\x20','name','data','1531sZefOK','execute','site','\x20\x20Cause:\x20','✔\x20Found\x20','398PfIImO','8484623EBxAIA','6166544IkUqNM','query','8pSciGM','Pattern:\x20','List\x20all\x20databases','23442057airOqP'];a21_0x398a=function(){return _0x7f50d5;};return a21_0x398a();}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{[a21_0x412482(0x182)]='databases';[a21_0x412482(0x17b)]=a21_0x412482(0x175);async[a21_0x412482(0x16b)](_0x400bf0){const _0x44d563=a21_0x412482,{options:_0x73d297,args:_0x2bfa55,tdx:_0x3b184f}=_0x400bf0,_0x201d9c=_0x2bfa55[0x0];try{_0x73d297[_0x44d563(0x17e)]&&(console[_0x44d563(0x179)](_0x44d563(0x181)+_0x73d297[_0x44d563(0x16c)]),_0x201d9c&&console[_0x44d563(0x179)](_0x44d563(0x174)+_0x201d9c));const _0x2c9f4=resolveLimit(_0x73d297['limit'],DEFAULT_LISTING_LIMIT),_0x1d936c=await withSpinner('Listing\x20databases...',()=>_0x3b184f[_0x44d563(0x172)][_0x44d563(0x177)](_0x201d9c,_0x2c9f4),{'verbose':_0x73d297[_0x44d563(0x17e)]}),_0x1983cb=_0x1d936c[_0x44d563(0x183)];return console[_0x44d563(0x179)](_0x44d563(0x16e)+_0x1983cb[_0x44d563(0x178)]+'\x20database'+(_0x1983cb['length']!==0x1?'s':'')),await handleSDKOutput(_0x1983cb,{..._0x73d297,'limit':_0x2c9f4}),0x0;}catch(_0x96feed){if(_0x96feed instanceof SDKError)return console[_0x44d563(0x179)](_0x44d563(0x17d)+_0x96feed['message']),_0x96feed[_0x44d563(0x180)]&&console['error'](_0x44d563(0x16d)+_0x96feed['cause']),0x1;throw _0x96feed;}}}
@@ -1 +1 @@
1
- const a22_0x325a81=a22_0x45dd;(function(_0xa38cd5,_0x3feff2){const _0x7f4e13=a22_0x45dd,_0x109a1a=_0xa38cd5();while(!![]){try{const _0x350b11=parseInt(_0x7f4e13(0xe0))/0x1*(-parseInt(_0x7f4e13(0xe2))/0x2)+parseInt(_0x7f4e13(0xe1))/0x3+-parseInt(_0x7f4e13(0xf7))/0x4*(parseInt(_0x7f4e13(0xf2))/0x5)+-parseInt(_0x7f4e13(0xdc))/0x6*(-parseInt(_0x7f4e13(0xdb))/0x7)+parseInt(_0x7f4e13(0xf4))/0x8*(parseInt(_0x7f4e13(0xf8))/0x9)+-parseInt(_0x7f4e13(0xf5))/0xa+-parseInt(_0x7f4e13(0xee))/0xb*(-parseInt(_0x7f4e13(0xff))/0xc);if(_0x350b11===_0x3feff2)break;else _0x109a1a['push'](_0x109a1a['shift']());}catch(_0x12f9e2){_0x109a1a['push'](_0x109a1a['shift']());}}}(a22_0x5211,0x1f612));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a22_0x45dd(_0x279e1a,_0x432070){_0x279e1a=_0x279e1a-0xdb;const _0x52114b=a22_0x5211();let _0x45dd47=_0x52114b[_0x279e1a];return _0x45dd47;}function a22_0x5211(){const _0x467311=['Error:\x20','error','cause','\x20in\x20','Table:\x20','12wMlfbH','describeTable','\x20\x20Cause:\x20','\x27\x20does\x20not\x20exist','verbose','388269gKfPxK','6MhsTZp','describe','message','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','6ztfwtE','263103dEeAbM','46462CTSxNz','✔\x20Found\x20','✖\x20Table\x20not\x20found','args','validate','execute','length','\x20column','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','database','table','Site:\x20','778547LDCnta','Describe\x20table\x20schema','site','...','60355DvDWGG','data','8PQMwtJ','991080uGTWLB','query','32rHbgRn','2246823slogaF','name'];a22_0x5211=function(){return _0x467311;};return a22_0x5211();}import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a22_0x325a81(0xf9)]=a22_0x325a81(0xdd);['description']=a22_0x325a81(0xef);async[a22_0x325a81(0xe7)](_0x485fcf){const _0x387949=a22_0x325a81;return this[_0x387949(0x100)](_0x485fcf);}async[a22_0x325a81(0x100)](_0x33018b){const _0x445c27=a22_0x325a81,{options:_0x4fc3f8,args:_0x3236e2,tdx:_0x44deff}=_0x33018b;let _0x4b551c;try{_0x4b551c=parseTableReference(_0x3236e2[0x0]);const _0x35f3d6=_0x4fc3f8[_0x445c27(0xeb)];!_0x4b551c['database']&&_0x35f3d6&&(_0x4b551c[_0x445c27(0xeb)]=_0x35f3d6);const _0x1055b2=validateTableDescribeReference(_0x4b551c);if(_0x1055b2)return console['error']('Error:\x20'+_0x1055b2),0x1;}catch(_0x3e9550){return console[_0x445c27(0xfb)](_0x445c27(0xfa)+_0x3e9550[_0x445c27(0xde)]),0x1;}const _0x297a87=_0x4b551c[_0x445c27(0xeb)],_0x1c34bb=_0x4b551c[_0x445c27(0xec)];try{_0x4fc3f8[_0x445c27(0x103)]&&(console['error'](_0x445c27(0xed)+_0x4fc3f8[_0x445c27(0xf0)]),console['error']('Database:\x20'+_0x297a87),console[_0x445c27(0xfb)](_0x445c27(0xfe)+_0x1c34bb));const _0x41bb78=await withSpinner('Describing\x20table\x20'+_0x297a87+'.'+_0x1c34bb+_0x445c27(0xf1),()=>_0x44deff[_0x445c27(0xf6)][_0x445c27(0x100)](_0x297a87,_0x1c34bb),{'verbose':_0x4fc3f8['verbose']}),_0x392d63=_0x41bb78[_0x445c27(0xf3)];if(_0x392d63[_0x445c27(0xe8)]===0x0)return console['error'](_0x445c27(0xe4)),console[_0x445c27(0xfb)]('Table\x20\x27'+_0x297a87+'.'+_0x1c34bb+_0x445c27(0x102)),0x1;return console['error'](_0x445c27(0xe3)+_0x392d63[_0x445c27(0xe8)]+_0x445c27(0xe9)+(_0x392d63[_0x445c27(0xe8)]!==0x1?'s':'')+_0x445c27(0xfd)+_0x297a87+'.'+_0x1c34bb),await handleSDKOutput(_0x392d63,_0x4fc3f8),0x0;}catch(_0xa6d56a){if(_0xa6d56a instanceof SDKError)return console[_0x445c27(0xfb)]('Error:\x20'+_0xa6d56a[_0x445c27(0xde)]),_0xa6d56a[_0x445c27(0xfc)]&&console[_0x445c27(0xfb)](_0x445c27(0x101)+_0xa6d56a[_0x445c27(0xfc)]),0x1;throw _0xa6d56a;}}[a22_0x325a81(0xe6)](_0x4393ee){const _0x5d5f2b=a22_0x325a81;if(_0x4393ee[_0x5d5f2b(0xe5)][_0x5d5f2b(0xe8)]===0x0)return _0x5d5f2b(0xea);if(_0x4393ee[_0x5d5f2b(0xe5)][_0x5d5f2b(0xe8)]>0x1)return _0x5d5f2b(0xdf);return undefined;}}
1
+ const a22_0x188e85=a22_0x1b69;(function(_0x50e97b,_0x27c439){const _0x4be144=a22_0x1b69,_0x150065=_0x50e97b();while(!![]){try{const _0x3da205=-parseInt(_0x4be144(0x1f2))/0x1*(-parseInt(_0x4be144(0x1f4))/0x2)+parseInt(_0x4be144(0x1f0))/0x3+parseInt(_0x4be144(0x1e8))/0x4+-parseInt(_0x4be144(0x1e5))/0x5+parseInt(_0x4be144(0x1e1))/0x6*(-parseInt(_0x4be144(0x1f7))/0x7)+-parseInt(_0x4be144(0x1e4))/0x8+parseInt(_0x4be144(0x1ee))/0x9;if(_0x3da205===_0x27c439)break;else _0x150065['push'](_0x150065['shift']());}catch(_0x1c6901){_0x150065['push'](_0x150065['shift']());}}}(a22_0x513b,0x4126e));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a22_0x1b69(_0x3216c4,_0x349573){_0x3216c4=_0x3216c4-0x1d8;const _0x513b1a=a22_0x513b();let _0x1b6912=_0x513b1a[_0x3216c4];return _0x1b6912;}import{handleSDKOutput}from'../utils/command-output.js';function a22_0x513b(){const _0x5b3d22=['length','1843OXdWUg','Database:\x20','2YAEcym','error','✖\x20Table\x20not\x20found','43708YvsAtQ','\x20column','cause','\x20in\x20','\x20\x20Cause:\x20','describeTable','verbose','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','Error:\x20','Describe\x20table\x20schema','...','Table:\x20','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','174zNjzsq','description','table','3085112VVJLZb','50940BqUTjI','query','describe','1864724ETNUOs','execute','database','validate','Describing\x20table\x20','args','2053845vpuoAB','message','442608Erywmy'];a22_0x513b=function(){return _0x5b3d22;};return a22_0x513b();}import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{['name']=a22_0x188e85(0x1e7);[a22_0x188e85(0x1e2)]=a22_0x188e85(0x1dd);async[a22_0x188e85(0x1e9)](_0x6913b7){const _0x1215a9=a22_0x188e85;return this[_0x1215a9(0x1d8)](_0x6913b7);}async[a22_0x188e85(0x1d8)](_0x4fd70e){const _0x4d16a4=a22_0x188e85,{options:_0x1c9913,args:_0x39f834,tdx:_0x567b0d}=_0x4fd70e;let _0x5d6292;try{_0x5d6292=parseTableReference(_0x39f834[0x0]);const _0x595362=_0x1c9913[_0x4d16a4(0x1ea)];!_0x5d6292[_0x4d16a4(0x1ea)]&&_0x595362&&(_0x5d6292[_0x4d16a4(0x1ea)]=_0x595362);const _0x53375e=validateTableDescribeReference(_0x5d6292);if(_0x53375e)return console[_0x4d16a4(0x1f5)]('Error:\x20'+_0x53375e),0x1;}catch(_0x37035e){return console[_0x4d16a4(0x1f5)]('Error:\x20'+_0x37035e[_0x4d16a4(0x1ef)]),0x1;}const _0x4363d5=_0x5d6292['database'],_0x1410d0=_0x5d6292[_0x4d16a4(0x1e3)];try{_0x1c9913[_0x4d16a4(0x1d9)]&&(console[_0x4d16a4(0x1f5)]('Site:\x20'+_0x1c9913['site']),console[_0x4d16a4(0x1f5)](_0x4d16a4(0x1f3)+_0x4363d5),console[_0x4d16a4(0x1f5)](_0x4d16a4(0x1df)+_0x1410d0));const _0x1811ed=await withSpinner(_0x4d16a4(0x1ec)+_0x4363d5+'.'+_0x1410d0+_0x4d16a4(0x1de),()=>_0x567b0d[_0x4d16a4(0x1e6)][_0x4d16a4(0x1d8)](_0x4363d5,_0x1410d0),{'verbose':_0x1c9913[_0x4d16a4(0x1d9)]}),_0x1bb124=_0x1811ed['data'];if(_0x1bb124[_0x4d16a4(0x1f1)]===0x0)return console[_0x4d16a4(0x1f5)](_0x4d16a4(0x1f6)),console[_0x4d16a4(0x1f5)]('Table\x20\x27'+_0x4363d5+'.'+_0x1410d0+_0x4d16a4(0x1db)),0x1;return console[_0x4d16a4(0x1f5)]('✔\x20Found\x20'+_0x1bb124[_0x4d16a4(0x1f1)]+_0x4d16a4(0x1f8)+(_0x1bb124[_0x4d16a4(0x1f1)]!==0x1?'s':'')+_0x4d16a4(0x1fa)+_0x4363d5+'.'+_0x1410d0),await handleSDKOutput(_0x1bb124,_0x1c9913),0x0;}catch(_0x44e39a){if(_0x44e39a instanceof SDKError)return console[_0x4d16a4(0x1f5)](_0x4d16a4(0x1dc)+_0x44e39a[_0x4d16a4(0x1ef)]),_0x44e39a[_0x4d16a4(0x1f9)]&&console[_0x4d16a4(0x1f5)](_0x4d16a4(0x1fb)+_0x44e39a[_0x4d16a4(0x1f9)]),0x1;throw _0x44e39a;}}[a22_0x188e85(0x1eb)](_0x338761){const _0x4c6a7d=a22_0x188e85;if(_0x338761[_0x4c6a7d(0x1ed)][_0x4c6a7d(0x1f1)]===0x0)return _0x4c6a7d(0x1da);if(_0x338761['args'][_0x4c6a7d(0x1f1)]>0x1)return _0x4c6a7d(0x1e0);return undefined;}}
@@ -1 +1 @@
1
- const a23_0x5b6bf3=a23_0x472a;(function(_0x4d88a5,_0x7f21df){const _0x258c68=a23_0x472a,_0x24a12d=_0x4d88a5();while(!![]){try{const _0x29c0da=-parseInt(_0x258c68(0x159))/0x1+-parseInt(_0x258c68(0x1a7))/0x2*(parseInt(_0x258c68(0x1e1))/0x3)+-parseInt(_0x258c68(0x194))/0x4*(parseInt(_0x258c68(0x1b1))/0x5)+parseInt(_0x258c68(0x1c1))/0x6+-parseInt(_0x258c68(0x190))/0x7*(parseInt(_0x258c68(0x1df))/0x8)+-parseInt(_0x258c68(0x1e0))/0x9*(parseInt(_0x258c68(0x173))/0xa)+parseInt(_0x258c68(0x19d))/0xb;if(_0x29c0da===_0x7f21df)break;else _0x24a12d['push'](_0x24a12d['shift']());}catch(_0xd96e77){_0x24a12d['push'](_0x24a12d['shift']());}}}(a23_0x558b,0xee34c));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(_0x4a0e2d,_0x300047,_0x414173=![]){const _0xa51595=a23_0x472a;if(_0x4a0e2d[_0xa51595(0x16d)])return await _0x300047[_0xa51595(0x170)][_0xa51595(0x1c4)](_0x4a0e2d[_0xa51595(0x16d)]);const _0x5585a7=loadSessionContext(_0x4a0e2d['session']);if(_0x5585a7?.[_0xa51595(0x183)])return await _0x300047['engage'][_0xa51595(0x1c4)](_0x5585a7['engage_workspace']);if(_0x414173)throw new SDKError(ErrorCode[_0xa51595(0x18d)],'Workspace\x20is\x20required\x20for\x20this\x20operation',undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x31a619,_0xa77f2b){const _0x36c32c=a23_0x472a;if(!_0x31a619[_0x36c32c(0x17c)])return{};const _0x42b431=_0x31a619[_0x36c32c(0x17c)],_0x312835=await _0xa77f2b[_0x36c32c(0x17c)][_0x36c32c(0x1ad)](_0x42b431);return{'audienceId':_0x312835[_0x36c32c(0x1ba)],'audienceName':_0x312835[_0x36c32c(0x160)],..._0x312835[_0x36c32c(0x177)]&&{'segmentId':_0x312835[_0x36c32c(0x177)],'segmentName':_0x312835[_0x36c32c(0x1aa)]}};}function buildConnectorConfig(_0x1a2497){const _0x120e0a=a23_0x472a,_0x568242=_0x1a2497[_0x120e0a(0x15a)],_0x158c3=_0x1a2497[_0x120e0a(0x1cf)];if(!_0x568242&&!_0x158c3)return undefined;return{..._0x568242&&{'emailSenderId':_0x568242},..._0x158c3&&{'jsonColumns':_0x158c3}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1cb);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1c7);async[a23_0x5b6bf3(0x1ae)](_0x2bd45d){const _0x1a4cc4=a23_0x5b6bf3,{options:_0x4ef0fd,args:_0x194ec4,tdx:_0x51c974}=_0x2bd45d,_0x5a3f6d=_0x194ec4[0x0],_0x5d6395=resolveLimit(_0x4ef0fd[_0x1a4cc4(0x1d3)],DEFAULT_LLM_LIMIT),_0x31d3a9=_0x4ef0fd,_0x6a9653=_0x31d3a9[_0x1a4cc4(0x1c9)],_0x33e26c=_0x31d3a9[_0x1a4cc4(0x1c8)],_0x5908c3=await resolveWorkspaceIdFromOptions(_0x31d3a9,_0x51c974),_0x47d707=await withSpinner(_0x1a4cc4(0x157),()=>_0x51c974['engage'][_0x1a4cc4(0x1be)]({'type':_0x6a9653,'status':_0x33e26c,'workspaceId':_0x5908c3,'limit':_0x5d6395}),{'verbose':_0x4ef0fd['verbose']});let _0x4efd03=_0x47d707[_0x1a4cc4(0x1de)];return _0x5a3f6d&&(_0x4efd03=_0x47d707[_0x1a4cc4(0x1de)][_0x1a4cc4(0x17e)](_0xeedb6f=>matchGlobPattern(_0xeedb6f['name'],_0x5a3f6d))),await handleSDKOutput(_0x4efd03,_0x4ef0fd),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x179);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x17f);async[a23_0x5b6bf3(0x1ae)](_0x1e1f2d){const _0x587cf9=a23_0x5b6bf3,{options:_0x4769cf,args:_0x306d95,tdx:_0x924180}=_0x1e1f2d;if(_0x306d95[_0x587cf9(0x1b9)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x587cf9(0x1da)),0x1;const _0x2c7ead=_0x306d95[0x0],_0x1887ea=_0x4769cf,_0x3953f0=await resolveWorkspaceIdFromOptions(_0x1887ea,_0x924180),_0x37e2bd=_0x1887ea[_0x587cf9(0x1c3)];if(_0x37e2bd){const _0x3499cd=await withSpinner(_0x587cf9(0x1b8)+_0x2c7ead+_0x587cf9(0x1ce),()=>_0x924180['engage'][_0x587cf9(0x1af)](_0x2c7ead,_0x3953f0),{'verbose':_0x4769cf[_0x587cf9(0x198)]});await handleSDKOutput([_0x3499cd],_0x4769cf);}else{const _0x2b62a0=await withSpinner(_0x587cf9(0x1b8)+_0x2c7ead+'\x27...',()=>_0x924180[_0x587cf9(0x170)][_0x587cf9(0x1bd)](_0x2c7ead,_0x3953f0),{'verbose':_0x4769cf[_0x587cf9(0x198)]});await handleSDKOutput([_0x2b62a0],_0x4769cf);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:campaign:create';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1b7);async[a23_0x5b6bf3(0x1ae)](_0x59ef38){const _0x1748d5=a23_0x5b6bf3,{options:_0x4bae5b,tdx:_0x378874}=_0x59ef38,_0x4e432b=_0x4bae5b,_0x4d41ea=_0x4e432b[_0x1748d5(0x1e4)],_0x47a644=_0x4e432b[_0x1748d5(0x1c9)];if(!_0x4d41ea)return console['error'](_0x1748d5(0x182)),console[_0x1748d5(0x15d)](_0x1748d5(0x166)),0x1;if(!_0x47a644)return console[_0x1748d5(0x15d)](_0x1748d5(0x1b6)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;const _0x1214bb=await resolveWorkspaceIdFromOptions(_0x4e432b,_0x378874,!![]),_0x1e4134=await resolveSegmentFromOptions(_0x4e432b,_0x378874),_0x3d2a96=buildConnectorConfig(_0x4e432b),_0x5d6430={'name':_0x4d41ea,'campaignType':_0x47a644,'workspaceId':_0x1214bb,'description':_0x4e432b['description'],..._0x1e4134,'connectorConfig':_0x3d2a96,'startAt':_0x4e432b[_0x1748d5(0x165)],'timezone':_0x4e432b[_0x1748d5(0x176)]},_0x322edd=await withSpinner(_0x1748d5(0x164)+_0x4d41ea+'\x27...',()=>_0x378874[_0x1748d5(0x170)][_0x1748d5(0x167)](_0x5d6430));return await handleSDKOutput([_0x322edd[_0x1748d5(0x1de)]],_0x4bae5b),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1b0);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x163);async[a23_0x5b6bf3(0x1ae)](_0xe266c7){const _0xc92958=a23_0x5b6bf3,{options:_0x2b15f8,args:_0x82968e,tdx:_0x29ca9a}=_0xe266c7;if(_0x82968e['length']===0x0)return console['error'](_0xc92958(0x1d5)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x28158a=_0x82968e[0x0],_0x2e9d4e=_0x2b15f8,_0x405039=await resolveWorkspaceIdFromOptions(_0x2e9d4e,_0x29ca9a),_0x5cfa6c=await resolveSegmentFromOptions(_0x2e9d4e,_0x29ca9a),_0x428db8=buildConnectorConfig(_0x2e9d4e),_0x5d8198={'name':_0x2e9d4e[_0xc92958(0x1e4)],'description':_0x2e9d4e[_0xc92958(0x1db)],..._0x5cfa6c,'connectorConfig':_0x428db8,'startAt':_0x2e9d4e['startAt'],'timezone':_0x2e9d4e[_0xc92958(0x176)]},_0x18c224=Object['fromEntries'](Object['entries'](_0x5d8198)['filter'](([,_0x36e96a])=>_0x36e96a!==undefined));if(Object[_0xc92958(0x161)](_0x18c224)[_0xc92958(0x1b9)]===0x0)return console[_0xc92958(0x15d)](_0xc92958(0x169)),console[_0xc92958(0x15d)](_0xc92958(0x1e3)),0x1;const _0x2baede=await withSpinner(_0xc92958(0x17b)+_0x28158a+_0xc92958(0x1ce),()=>_0x29ca9a['engage'][_0xc92958(0x195)](_0x28158a,_0x18c224,_0x405039),{'verbose':_0x2b15f8['verbose']});return await handleSDKOutput([_0x2baede[_0xc92958(0x1de)]],_0x2b15f8),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a23_0x5b6bf3(0x17d);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x197);async[a23_0x5b6bf3(0x1ae)](_0x48b78f){const _0x263661=a23_0x5b6bf3,{options:_0x23b049,args:_0x244b0b,tdx:_0x5df414}=_0x48b78f;if(_0x244b0b[_0x263661(0x1b9)]===0x0)return console[_0x263661(0x15d)](_0x263661(0x1d5)),console[_0x263661(0x15d)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x3cb68c=_0x244b0b[0x0],_0x25df96=_0x23b049,_0x3a8b6d=await resolveWorkspaceIdFromOptions(_0x25df96,_0x5df414);if(!_0x23b049[_0x263661(0x1a5)]){const _0x589a57=await confirm(_0x263661(0x185)+_0x3cb68c+_0x263661(0x1dc));if(!_0x589a57)return console[_0x263661(0x1a1)](_0x263661(0x1a4)),0x0;}return await withSpinner('Deleting\x20campaign\x20\x27'+_0x3cb68c+_0x263661(0x1ce),()=>_0x5df414[_0x263661(0x170)][_0x263661(0x16a)](_0x3cb68c,_0x3a8b6d),{'verbose':_0x23b049[_0x263661(0x198)]}),console[_0x263661(0x1a1)](_0x263661(0x1a3)+_0x3cb68c+_0x263661(0x18a)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1ab);[a23_0x5b6bf3(0x1db)]='Launch\x20a\x20campaign';async[a23_0x5b6bf3(0x1ae)](_0xe6b0c8){const _0x198414=a23_0x5b6bf3,{options:_0x4a402,args:_0x2304e3,tdx:_0x2930e5}=_0xe6b0c8;if(_0x2304e3[_0x198414(0x1b9)]===0x0)return console['error'](_0x198414(0x1d5)),console[_0x198414(0x15d)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x4bf734=_0x2304e3[0x0],_0x409b1a=_0x4a402,_0x2e5667=await resolveWorkspaceIdFromOptions(_0x409b1a,_0x2930e5);return await withSpinner('Launching\x20campaign\x20\x27'+_0x4bf734+'\x27...',()=>_0x2930e5[_0x198414(0x170)]['launchCampaign'](_0x4bf734,_0x2e5667),{'verbose':_0x4a402[_0x198414(0x198)]}),console['log'](_0x198414(0x1a3)+_0x4bf734+_0x198414(0x1bc)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:campaign:pause';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1d4);async[a23_0x5b6bf3(0x1ae)](_0x42d9ee){const _0x17e3a8=a23_0x5b6bf3,{options:_0x8af5c1,args:_0xab351b,tdx:_0xf4058e}=_0x42d9ee;if(_0xab351b[_0x17e3a8(0x1b9)]===0x0)return console[_0x17e3a8(0x15d)](_0x17e3a8(0x1d5)),console[_0x17e3a8(0x15d)](_0x17e3a8(0x1c6)),0x1;const _0x302a53=_0xab351b[0x0],_0x18b70c=_0x8af5c1,_0xf76eda=await resolveWorkspaceIdFromOptions(_0x18b70c,_0xf4058e);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x302a53+_0x17e3a8(0x1ce),()=>_0xf4058e[_0x17e3a8(0x170)][_0x17e3a8(0x1ac)](_0x302a53,_0xf76eda),{'verbose':_0x8af5c1[_0x17e3a8(0x198)]}),console['log'](_0x17e3a8(0x1a3)+_0x302a53+_0x17e3a8(0x16c)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:campaign:resume';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x18c);async[a23_0x5b6bf3(0x1ae)](_0x4387bb){const _0x407d06=a23_0x5b6bf3,{options:_0x45a603,args:_0x2b8d2d,tdx:_0x12648a}=_0x4387bb;if(_0x2b8d2d[_0x407d06(0x1b9)]===0x0)return console['error'](_0x407d06(0x1d5)),console[_0x407d06(0x15d)](_0x407d06(0x158)),0x1;const _0x12ef9b=_0x2b8d2d[0x0],_0x5dfc46=_0x45a603,_0x1733a5=await resolveWorkspaceIdFromOptions(_0x5dfc46,_0x12648a);return await withSpinner('Resuming\x20campaign\x20\x27'+_0x12ef9b+_0x407d06(0x1ce),()=>_0x12648a[_0x407d06(0x170)]['resumeCampaign'](_0x12ef9b,_0x1733a5),{'verbose':_0x45a603['verbose']}),console[_0x407d06(0x1a1)](_0x407d06(0x1a3)+_0x12ef9b+_0x407d06(0x193)),0x0;}}function a23_0x558b(){const _0x993c24=['status','type','Deleting\x20template\x20\x27','engage:campaigns','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Show\x20email\x20template\x20details','\x27...','jsonColumns','updateTemplate','Verifying\x20workspace\x20\x27','Create\x20a\x20workspace','limit','Pause\x20a\x20campaign','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Workspace\x20\x27','Fetching\x20workspace\x20\x27','getWorkspaceFull','deleteTemplate','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','description','\x27?\x20This\x20cannot\x20be\x20undone.','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','data','669192SDQUsn','120915QGnFVQ','1755564dcEzCX','engage:template:update','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','name','engage:template:create','fromEntries','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Fetching\x20campaigns...','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','404957llHCkF','emailSenderId','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','error','subject','Fetching\x20workspaces...','parentName','keys','engage:template:show','Update\x20a\x20campaign','Creating\x20campaign\x20\x27','startAt','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','createCampaign','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','deleteCampaign','Duplicating\x20campaign\x20\x27','\x27\x20paused\x20successfully','workspace','editorType','updateWorkspace','engage','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','1400idubmA','session','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','timezone','segmentId','listWorkspaces','engage:campaign:show','Fetching\x20templates...','Updating\x20campaign\x20\x27','segment','engage:campaign:delete','filter','Show\x20campaign\x20details','deleteWorkspace','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Error:\x20--name\x20is\x20required','engage_workspace','Template\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Error:\x20--html\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','engage:template:delete','Error:\x20--subject\x20is\x20required','\x27\x20deleted\x20successfully','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Resume\x20a\x20paused\x20campaign','MISSING_ARGUMENT','plaintext','engage:workspace:use','7WKWWYn','createTemplate','Creating\x20template\x20\x27','\x27\x20resumed\x20successfully','73516tmpvaW','updateCampaign','getTemplate','Delete\x20a\x20campaign','verbose','html','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','getWorkspace','48014164XYWmkh','Creating\x20workspace\x20\x27','Show\x20workspace\x20details','engage:campaign:duplicate','log','Fetching\x20template\x20\x27','Campaign\x20\x27','Operation\x20cancelled','yes','Update\x20a\x20workspace','2omlhKG','Deleting\x20workspace\x20\x27','entries','segmentName','engage:campaign:launch','pauseCampaign','resolvePathToResource','execute','getCampaignFull','engage:campaign:update','365cHWnyq','listTemplates','Delete\x20an\x20email\x20template','engage:templates','List\x20workspaces','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Create\x20a\x20new\x20campaign','Fetching\x20campaign\x20\x27','length','parentId','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','\x27\x20launched\x20successfully','getCampaign','listCampaigns','engage:workspaces','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','5442774WMDlPM','Error:\x20Workspace\x20name\x20is\x20required','full','resolveWorkspaceId','Updating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','List\x20campaigns'];a23_0x558b=function(){return _0x993c24;};return a23_0x558b();}export class EngageCampaignDuplicateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1a0);[a23_0x5b6bf3(0x1db)]='Duplicate\x20a\x20campaign';async[a23_0x5b6bf3(0x1ae)](_0x5cfd0e){const _0x3e1238=a23_0x5b6bf3,{options:_0x5e9b87,args:_0x1f0c93,tdx:_0x596b11}=_0x5cfd0e;if(_0x1f0c93[_0x3e1238(0x1b9)]===0x0)return console['error'](_0x3e1238(0x1d5)),console[_0x3e1238(0x15d)](_0x3e1238(0x171)),0x1;const _0x772a91=_0x1f0c93[0x0],_0x41574=_0x5e9b87,_0x190423=await resolveWorkspaceIdFromOptions(_0x41574,_0x596b11),_0x20c3d0=await withSpinner(_0x3e1238(0x16b)+_0x772a91+_0x3e1238(0x1ce),()=>_0x596b11[_0x3e1238(0x170)]['duplicateCampaign'](_0x772a91,_0x190423),{'verbose':_0x5e9b87['verbose']});return await handleSDKOutput([_0x20c3d0[_0x3e1238(0x1de)]],_0x5e9b87),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1b4);[a23_0x5b6bf3(0x1db)]='List\x20email\x20templates';async[a23_0x5b6bf3(0x1ae)](_0x442375){const _0x48d2c5=a23_0x5b6bf3,{options:_0x1522eb,args:_0x1bd210,tdx:_0x4f7cfb}=_0x442375,_0xc8e05f=_0x1bd210[0x0],_0x44ae15=resolveLimit(_0x1522eb[_0x48d2c5(0x1d3)],DEFAULT_LLM_LIMIT),_0x448a75=_0x1522eb,_0x301ebd=await resolveWorkspaceIdFromOptions(_0x448a75,_0x4f7cfb),_0x4488ff=await withSpinner(_0x48d2c5(0x17a),()=>_0x4f7cfb[_0x48d2c5(0x170)][_0x48d2c5(0x1b2)]({'workspaceId':_0x301ebd,'limit':_0x44ae15}),{'verbose':_0x1522eb['verbose']});let _0x34726c=_0x4488ff[_0x48d2c5(0x1de)];return _0xc8e05f&&(_0x34726c=_0x4488ff[_0x48d2c5(0x1de)][_0x48d2c5(0x17e)](_0x95cc1e=>matchGlobPattern(_0x95cc1e['name'],_0xc8e05f))),await handleSDKOutput(_0x34726c,_0x1522eb),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x162);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1cd);async[a23_0x5b6bf3(0x1ae)](_0x5e9111){const _0x235bde=a23_0x5b6bf3,{options:_0x17bdc9,args:_0x264fec,tdx:_0xa302ec}=_0x5e9111;if(_0x264fec[_0x235bde(0x1b9)]===0x0)return console[_0x235bde(0x15d)](_0x235bde(0x175)),console[_0x235bde(0x15d)](_0x235bde(0x1cc)),0x1;const _0x39185f=_0x264fec[0x0],_0x235ff8=_0x17bdc9,_0x475e12=await resolveWorkspaceIdFromOptions(_0x235ff8,_0xa302ec),_0x2aee81=_0x235ff8[_0x235bde(0x1c3)];if(_0x2aee81){const _0xb569ec=await withSpinner('Fetching\x20template\x20\x27'+_0x39185f+'\x27...',()=>_0xa302ec['engage']['getTemplateFull'](_0x39185f,_0x475e12),{'verbose':_0x17bdc9[_0x235bde(0x198)]});await handleSDKOutput([_0xb569ec],_0x17bdc9);}else{const _0x57aee7=await withSpinner(_0x235bde(0x1a2)+_0x39185f+_0x235bde(0x1ce),()=>_0xa302ec['engage'][_0x235bde(0x196)](_0x39185f,_0x475e12),{'verbose':_0x17bdc9[_0x235bde(0x198)]});await handleSDKOutput([_0x57aee7],_0x17bdc9);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1e5);['description']='Create\x20an\x20email\x20template';async[a23_0x5b6bf3(0x1ae)](_0x5af95f){const _0xa06598=a23_0x5b6bf3,{options:_0x19da71,tdx:_0x9f440e}=_0x5af95f,_0x3dfd65=_0x19da71,_0x45fad5=_0x3dfd65[_0xa06598(0x1e4)],_0x31336f=_0x3dfd65[_0xa06598(0x15e)],_0x4a1f98=_0x3dfd65[_0xa06598(0x199)];if(!_0x45fad5)return console['error'](_0xa06598(0x182)),console['error']('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x31336f)return console[_0xa06598(0x15d)](_0xa06598(0x189)),0x1;if(!_0x4a1f98)return console[_0xa06598(0x15d)](_0xa06598(0x186)),0x1;const _0x5d5aef=await resolveWorkspaceIdFromOptions(_0x3dfd65,_0x9f440e,!![]),_0x1f18e0={'name':_0x45fad5,'subjectTemplate':_0x31336f,'htmlTemplate':_0x4a1f98,'workspaceId':_0x5d5aef,'plaintextTemplate':_0x3dfd65[_0xa06598(0x18e)],'editorType':_0x3dfd65[_0xa06598(0x16e)]},_0x1fa20b=await withSpinner(_0xa06598(0x192)+_0x45fad5+'\x27...',()=>_0x9f440e[_0xa06598(0x170)][_0xa06598(0x191)](_0x1f18e0));return await handleSDKOutput([_0x1fa20b[_0xa06598(0x1de)]],_0x19da71),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1e2);['description']='Update\x20an\x20email\x20template';async[a23_0x5b6bf3(0x1ae)](_0x320eeb){const _0xf521e6=a23_0x5b6bf3,{options:_0x2ddf04,args:_0x50d51b,tdx:_0x49490a}=_0x320eeb;if(_0x50d51b['length']===0x0)return console[_0xf521e6(0x15d)](_0xf521e6(0x175)),console['error'](_0xf521e6(0x1bb)),0x1;const _0x1e5761=_0x50d51b[0x0],_0x2d2945=_0x2ddf04,_0x4717b5=await resolveWorkspaceIdFromOptions(_0x2d2945,_0x49490a),_0x2dec91={'name':_0x2d2945['name'],'subjectTemplate':_0x2d2945[_0xf521e6(0x15e)],'htmlTemplate':_0x2d2945[_0xf521e6(0x199)],'plaintextTemplate':_0x2d2945[_0xf521e6(0x18e)]},_0x466155=Object[_0xf521e6(0x1e6)](Object['entries'](_0x2dec91)[_0xf521e6(0x17e)](([,_0x577584])=>_0x577584!==undefined));if(Object[_0xf521e6(0x161)](_0x466155)[_0xf521e6(0x1b9)]===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0xf521e6(0x15d)](_0xf521e6(0x1c0)),0x1;const _0x5e6436=await withSpinner(_0xf521e6(0x1c5)+_0x1e5761+'\x27...',()=>_0x49490a[_0xf521e6(0x170)][_0xf521e6(0x1d0)](_0x1e5761,_0x466155,_0x4717b5),{'verbose':_0x2ddf04['verbose']});return await handleSDKOutput([_0x5e6436[_0xf521e6(0x1de)]],_0x2ddf04),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x188);['description']=a23_0x5b6bf3(0x1b3);async['execute'](_0x22f60e){const _0x9e5ffb=a23_0x5b6bf3,{options:_0x99789c,args:_0x5ae4f7,tdx:_0x351f91}=_0x22f60e;if(_0x5ae4f7['length']===0x0)return console[_0x9e5ffb(0x15d)](_0x9e5ffb(0x175)),console[_0x9e5ffb(0x15d)](_0x9e5ffb(0x187)),0x1;const _0x356483=_0x5ae4f7[0x0],_0x2a87dd=_0x99789c,_0x1e87fb=await resolveWorkspaceIdFromOptions(_0x2a87dd,_0x351f91);if(!_0x99789c['yes']){const _0x1596bf=await confirm(_0x9e5ffb(0x19a)+_0x356483+_0x9e5ffb(0x1dc));if(!_0x1596bf)return console[_0x9e5ffb(0x1a1)](_0x9e5ffb(0x1a4)),0x0;}return await withSpinner(_0x9e5ffb(0x1ca)+_0x356483+_0x9e5ffb(0x1ce),()=>_0x351f91['engage'][_0x9e5ffb(0x1d9)](_0x356483,_0x1e87fb),{'verbose':_0x99789c[_0x9e5ffb(0x198)]}),console[_0x9e5ffb(0x1a1)](_0x9e5ffb(0x184)+_0x356483+_0x9e5ffb(0x18a)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1bf);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1b5);async['execute'](_0x285f3d){const _0x4f0ef5=a23_0x5b6bf3,{options:_0x1221c0,args:_0x51ffc9,tdx:_0x1d3255}=_0x285f3d,_0x15b006=_0x51ffc9[0x0],_0x2e363a=resolveLimit(_0x1221c0[_0x4f0ef5(0x1d3)],DEFAULT_LLM_LIMIT),_0x45cefc=await withSpinner(_0x4f0ef5(0x15f),()=>_0x1d3255[_0x4f0ef5(0x170)][_0x4f0ef5(0x178)]({'limit':_0x2e363a}),{'verbose':_0x1221c0['verbose']});let _0x385f14=_0x45cefc[_0x4f0ef5(0x1de)];return _0x15b006&&(_0x385f14=_0x45cefc['data'][_0x4f0ef5(0x17e)](_0x97ca89=>matchGlobPattern(_0x97ca89[_0x4f0ef5(0x1e4)],_0x15b006))),await handleSDKOutput(_0x385f14,_0x1221c0),0x0;}}function a23_0x472a(_0x25c90d,_0x1500eb){_0x25c90d=_0x25c90d-0x156;const _0x558bfb=a23_0x558b();let _0x472a4a=_0x558bfb[_0x25c90d];return _0x472a4a;}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:workspace:show';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x19f);async[a23_0x5b6bf3(0x1ae)](_0x149710){const _0x49ce8e=a23_0x5b6bf3,{options:_0x40e4ec,args:_0xa64315,tdx:_0x439ed3}=_0x149710;if(_0xa64315[_0x49ce8e(0x1b9)]===0x0)return console[_0x49ce8e(0x15d)](_0x49ce8e(0x15b)),console[_0x49ce8e(0x15d)](_0x49ce8e(0x18b)),0x1;const _0x369ca5=_0xa64315[0x0],_0x2681a8=_0x40e4ec,_0x219201=_0x2681a8[_0x49ce8e(0x1c3)];if(_0x219201){const _0x3eef80=await withSpinner(_0x49ce8e(0x1d7)+_0x369ca5+_0x49ce8e(0x1ce),()=>_0x439ed3[_0x49ce8e(0x170)][_0x49ce8e(0x1d8)](_0x369ca5),{'verbose':_0x40e4ec[_0x49ce8e(0x198)]});await handleSDKOutput([_0x3eef80],_0x40e4ec);}else{const _0x2aaf03=await withSpinner(_0x49ce8e(0x1d7)+_0x369ca5+'\x27...',()=>_0x439ed3[_0x49ce8e(0x170)][_0x49ce8e(0x19c)](_0x369ca5),{'verbose':_0x40e4ec['verbose']});await handleSDKOutput([_0x2aaf03],_0x40e4ec);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:workspace:create';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1d2);async[a23_0x5b6bf3(0x1ae)](_0x2f4118){const _0x329f4c=a23_0x5b6bf3,{options:_0x458a4b,tdx:_0x229410}=_0x2f4118,_0x5a7f4e=_0x458a4b,_0x2f6959=_0x5a7f4e[_0x329f4c(0x1e4)];if(!_0x2f6959)return console['error'](_0x329f4c(0x182)),console['error'](_0x329f4c(0x172)),0x1;const _0x51ed60={'name':_0x2f6959,'description':_0x5a7f4e[_0x329f4c(0x1db)]},_0x894b70=await withSpinner(_0x329f4c(0x19e)+_0x2f6959+'\x27...',()=>_0x229410[_0x329f4c(0x170)]['createWorkspace'](_0x51ed60));return await handleSDKOutput([_0x894b70['data']],_0x458a4b),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:workspace:update';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1a6);async['execute'](_0x538051){const _0x3cf12f=a23_0x5b6bf3,{options:_0x50b9fd,args:_0x5d6482,tdx:_0x67d3e6}=_0x538051;if(_0x5d6482[_0x3cf12f(0x1b9)]===0x0)return console[_0x3cf12f(0x15d)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x3cf12f(0x15c)),0x1;const _0x17a610=_0x5d6482[0x0],_0x4335df=_0x50b9fd,_0x544d34={'name':_0x4335df['name'],'description':_0x4335df[_0x3cf12f(0x1db)]},_0x1629f6=Object[_0x3cf12f(0x1e6)](Object[_0x3cf12f(0x1a9)](_0x544d34)[_0x3cf12f(0x17e)](([,_0x478842])=>_0x478842!==undefined));if(Object[_0x3cf12f(0x161)](_0x1629f6)[_0x3cf12f(0x1b9)]===0x0)return console[_0x3cf12f(0x15d)](_0x3cf12f(0x169)),console['error']('Options:\x20--name,\x20--description'),0x1;const _0x4e1539=await withSpinner('Updating\x20workspace\x20\x27'+_0x17a610+_0x3cf12f(0x1ce),()=>_0x67d3e6[_0x3cf12f(0x170)][_0x3cf12f(0x16f)](_0x17a610,_0x1629f6),{'verbose':_0x50b9fd[_0x3cf12f(0x198)]});return await handleSDKOutput([_0x4e1539['data']],_0x50b9fd),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']='engage:workspace:delete';[a23_0x5b6bf3(0x1db)]='Delete\x20a\x20workspace';async[a23_0x5b6bf3(0x1ae)](_0x2b2baa){const _0x544a48=a23_0x5b6bf3,{options:_0x5e33ac,args:_0x2e44fa,tdx:_0x2c4aa2}=_0x2b2baa;if(_0x2e44fa[_0x544a48(0x1b9)]===0x0)return console[_0x544a48(0x15d)](_0x544a48(0x15b)),console[_0x544a48(0x15d)](_0x544a48(0x181)),0x1;const _0x188994=_0x2e44fa[0x0];if(!_0x5e33ac[_0x544a48(0x1a5)]){const _0x591104=await confirm(_0x544a48(0x1dd)+_0x188994+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x591104)return console[_0x544a48(0x1a1)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x544a48(0x1a8)+_0x188994+_0x544a48(0x1ce),()=>_0x2c4aa2[_0x544a48(0x170)][_0x544a48(0x180)](_0x188994),{'verbose':_0x5e33ac['verbose']}),console['log'](_0x544a48(0x1d6)+_0x188994+_0x544a48(0x18a)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x18f);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x168);async[a23_0x5b6bf3(0x1ae)](_0x16f652){const _0x1b97f=a23_0x5b6bf3,{options:_0x24e25a,args:_0x35c768,tdx:_0x4f1084}=_0x16f652;if(_0x35c768[_0x1b97f(0x1b9)]===0x0)return console[_0x1b97f(0x15d)](_0x1b97f(0x1c2)),console[_0x1b97f(0x15d)](_0x1b97f(0x156)),0x1;const _0x548972=_0x35c768[0x0];await withSpinner(_0x1b97f(0x1d1)+_0x548972+_0x1b97f(0x1ce),()=>_0x4f1084['engage'][_0x1b97f(0x1c4)](_0x548972));const _0x45ad0b=_0x24e25a[_0x1b97f(0x174)]||undefined;return saveSessionContext({'engage_workspace':_0x548972},_0x45ad0b),console[_0x1b97f(0x1a1)]('Engage\x20workspace\x20set\x20to:\x20'+_0x548972),console[_0x1b97f(0x1a1)](_0x1b97f(0x19b)),0x0;}}
1
+ const a23_0x4b9761=a23_0x216e;(function(_0x3e1061,_0x1f1e8f){const _0x13753b=a23_0x216e,_0x3f5fda=_0x3e1061();while(!![]){try{const _0x41ece5=parseInt(_0x13753b(0xa7))/0x1*(-parseInt(_0x13753b(0xa2))/0x2)+parseInt(_0x13753b(0xb3))/0x3*(-parseInt(_0x13753b(0xbb))/0x4)+-parseInt(_0x13753b(0xc8))/0x5+parseInt(_0x13753b(0xb1))/0x6*(-parseInt(_0x13753b(0x8a))/0x7)+-parseInt(_0x13753b(0xc4))/0x8*(-parseInt(_0x13753b(0x92))/0x9)+-parseInt(_0x13753b(0xb9))/0xa*(-parseInt(_0x13753b(0xf0))/0xb)+parseInt(_0x13753b(0x7b))/0xc;if(_0x41ece5===_0x1f1e8f)break;else _0x3f5fda['push'](_0x3f5fda['shift']());}catch(_0x377541){_0x3f5fda['push'](_0x3f5fda['shift']());}}}(a23_0x1b34,0x82e34));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(_0x4523a2,_0x190e78,_0x216155=![]){const _0x480232=a23_0x216e;if(_0x4523a2[_0x480232(0xcf)])return await _0x190e78[_0x480232(0x75)]['resolveWorkspaceId'](_0x4523a2[_0x480232(0xcf)]);const _0x3d009c=loadSessionContext(_0x4523a2[_0x480232(0x84)]);if(_0x3d009c?.[_0x480232(0x7d)])return await _0x190e78['engage']['resolveWorkspaceId'](_0x3d009c[_0x480232(0x7d)]);if(_0x216155)throw new SDKError(ErrorCode[_0x480232(0x93)],_0x480232(0x7e),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x184080,_0xa772fd){const _0x5a15ce=a23_0x216e;if(!_0x184080[_0x5a15ce(0xce)])return{};const _0x3a10cd=_0x184080[_0x5a15ce(0xce)],_0x484c4a=await _0xa772fd[_0x5a15ce(0xce)][_0x5a15ce(0xab)](_0x3a10cd);return{'audienceId':_0x484c4a[_0x5a15ce(0xac)],'audienceName':_0x484c4a['parentName'],..._0x484c4a[_0x5a15ce(0xbd)]&&{'segmentId':_0x484c4a[_0x5a15ce(0xbd)],'segmentName':_0x484c4a['segmentName']}};}function buildConnectorConfig(_0x2e0f9f){const _0x2b089d=a23_0x216e,_0x188d09=_0x2e0f9f[_0x2b089d(0x7f)],_0x25959a=_0x2e0f9f[_0x2b089d(0xe0)];if(!_0x188d09&&!_0x25959a)return undefined;return{..._0x188d09&&{'emailSenderId':_0x188d09},..._0x25959a&&{'jsonColumns':_0x25959a}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaigns';[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xb5);async['execute'](_0x1850e3){const _0x5def16=a23_0x4b9761,{options:_0x2547e6,args:_0x57a5f8,tdx:_0x51a84f}=_0x1850e3,_0x34d4c5=_0x57a5f8[0x0],_0x1e3558=resolveLimit(_0x2547e6['limit'],DEFAULT_LLM_LIMIT),_0x101c9c=_0x2547e6,_0x31dae4=_0x101c9c[_0x5def16(0xde)],_0x218431=_0x101c9c['status'],_0x2414a4=await resolveWorkspaceIdFromOptions(_0x101c9c,_0x51a84f),_0x22264e=await withSpinner(_0x5def16(0xa6),()=>_0x51a84f[_0x5def16(0x75)][_0x5def16(0xa1)]({'type':_0x31dae4,'status':_0x218431,'workspaceId':_0x2414a4,'limit':_0x1e3558}),{'verbose':_0x2547e6[_0x5def16(0xb4)]});let _0x5b7a13=_0x22264e[_0x5def16(0x94)];return _0x34d4c5&&(_0x5b7a13=_0x22264e[_0x5def16(0x94)][_0x5def16(0xaa)](_0x392318=>matchGlobPattern(_0x392318['name'],_0x34d4c5))),await handleSDKOutput(_0x5b7a13,_0x2547e6),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']=a23_0x4b9761(0xcb);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xd5);async[a23_0x4b9761(0xd3)](_0x38f3e1){const _0x5a684e=a23_0x4b9761,{options:_0x22d1d1,args:_0x2691d6,tdx:_0x31bc14}=_0x38f3e1;if(_0x2691d6[_0x5a684e(0xe9)]===0x0)return console[_0x5a684e(0xef)](_0x5a684e(0x77)),console[_0x5a684e(0xef)](_0x5a684e(0xc5)),0x1;const _0x3f4fde=_0x2691d6[0x0],_0x20daf6=_0x22d1d1,_0x57c38c=await resolveWorkspaceIdFromOptions(_0x20daf6,_0x31bc14),_0x8ade2c=_0x20daf6['full'];if(_0x8ade2c){const _0x329827=await withSpinner(_0x5a684e(0x71)+_0x3f4fde+_0x5a684e(0x8e),()=>_0x31bc14['engage'][_0x5a684e(0x82)](_0x3f4fde,_0x57c38c),{'verbose':_0x22d1d1[_0x5a684e(0xb4)]});await handleSDKOutput([_0x329827],_0x22d1d1);}else{const _0x319bab=await withSpinner(_0x5a684e(0x71)+_0x3f4fde+_0x5a684e(0x8e),()=>_0x31bc14['engage'][_0x5a684e(0x8b)](_0x3f4fde,_0x57c38c),{'verbose':_0x22d1d1[_0x5a684e(0xb4)]});await handleSDKOutput([_0x319bab],_0x22d1d1);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:create';['description']='Create\x20a\x20new\x20campaign';async['execute'](_0x2ee593){const _0x3fcacd=a23_0x4b9761,{options:_0x50fe9e,tdx:_0x4287df}=_0x2ee593,_0x22a6bc=_0x50fe9e,_0x58cec1=_0x22a6bc[_0x3fcacd(0xdc)],_0x16cf7b=_0x22a6bc[_0x3fcacd(0xde)];if(!_0x58cec1)return console[_0x3fcacd(0xef)](_0x3fcacd(0x89)),console['error'](_0x3fcacd(0xae)),0x1;if(!_0x16cf7b)return console[_0x3fcacd(0xef)](_0x3fcacd(0xd0)),console['error'](_0x3fcacd(0xae)),0x1;const _0x48bc7f=await resolveWorkspaceIdFromOptions(_0x22a6bc,_0x4287df,!![]),_0x16ef7b=await resolveSegmentFromOptions(_0x22a6bc,_0x4287df),_0x2a9807=buildConnectorConfig(_0x22a6bc),_0x2c531e={'name':_0x58cec1,'campaignType':_0x16cf7b,'workspaceId':_0x48bc7f,'description':_0x22a6bc[_0x3fcacd(0xdf)],..._0x16ef7b,'connectorConfig':_0x2a9807,'startAt':_0x22a6bc[_0x3fcacd(0x8c)],'timezone':_0x22a6bc[_0x3fcacd(0xe6)]},_0x30d801=await withSpinner('Creating\x20campaign\x20\x27'+_0x58cec1+_0x3fcacd(0x8e),()=>_0x4287df[_0x3fcacd(0x75)][_0x3fcacd(0xd6)](_0x2c531e));return await handleSDKOutput([_0x30d801[_0x3fcacd(0x94)]],_0x50fe9e),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:update';[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xeb);async[a23_0x4b9761(0xd3)](_0xc2d18e){const _0x491f59=a23_0x4b9761,{options:_0xadb56e,args:_0x252eae,tdx:_0x4457ca}=_0xc2d18e;if(_0x252eae[_0x491f59(0xe9)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x491f59(0xef)](_0x491f59(0xf2)),0x1;const _0x356b7b=_0x252eae[0x0],_0x3b9554=_0xadb56e,_0x31cd45=await resolveWorkspaceIdFromOptions(_0x3b9554,_0x4457ca),_0x4a2ae4=await resolveSegmentFromOptions(_0x3b9554,_0x4457ca),_0x5061ba=buildConnectorConfig(_0x3b9554),_0x2404a1={'name':_0x3b9554['name'],'description':_0x3b9554[_0x491f59(0xdf)],..._0x4a2ae4,'connectorConfig':_0x5061ba,'startAt':_0x3b9554[_0x491f59(0x8c)],'timezone':_0x3b9554[_0x491f59(0xe6)]},_0x1e3103=Object[_0x491f59(0xbc)](Object[_0x491f59(0xa0)](_0x2404a1)[_0x491f59(0xaa)](([,_0xa412f8])=>_0xa412f8!==undefined));if(Object['keys'](_0x1e3103)[_0x491f59(0xe9)]===0x0)return console['error'](_0x491f59(0x6d)),console['error']('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x450e5b=await withSpinner('Updating\x20campaign\x20\x27'+_0x356b7b+'\x27...',()=>_0x4457ca['engage'][_0x491f59(0xbf)](_0x356b7b,_0x1e3103,_0x31cd45),{'verbose':_0xadb56e[_0x491f59(0xb4)]});return await handleSDKOutput([_0x450e5b[_0x491f59(0x94)]],_0xadb56e),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:delete';['description']='Delete\x20a\x20campaign';async[a23_0x4b9761(0xd3)](_0x131c31){const _0x4ef8dd=a23_0x4b9761,{options:_0x30c061,args:_0x1a83a9,tdx:_0x578381}=_0x131c31;if(_0x1a83a9['length']===0x0)return console[_0x4ef8dd(0xef)](_0x4ef8dd(0x77)),console[_0x4ef8dd(0xef)](_0x4ef8dd(0xdd)),0x1;const _0x44f845=_0x1a83a9[0x0],_0x3cbde5=_0x30c061,_0x2e6237=await resolveWorkspaceIdFromOptions(_0x3cbde5,_0x578381);if(!_0x30c061[_0x4ef8dd(0x90)]){const _0x22d634=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27'+_0x44f845+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x22d634)return console[_0x4ef8dd(0xe1)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x4ef8dd(0xda)+_0x44f845+_0x4ef8dd(0x8e),()=>_0x578381[_0x4ef8dd(0x75)][_0x4ef8dd(0xc9)](_0x44f845,_0x2e6237),{'verbose':_0x30c061[_0x4ef8dd(0xb4)]}),console[_0x4ef8dd(0xe1)](_0x4ef8dd(0xb7)+_0x44f845+_0x4ef8dd(0x9d)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x83);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xf3);async[a23_0x4b9761(0xd3)](_0x59c68f){const _0x24e11b=a23_0x4b9761,{options:_0x5a8353,args:_0x2a1ef0,tdx:_0x162b76}=_0x59c68f;if(_0x2a1ef0['length']===0x0)return console[_0x24e11b(0xef)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x24e11b(0xef)](_0x24e11b(0xf4)),0x1;const _0x394c19=_0x2a1ef0[0x0],_0x4b24ad=_0x5a8353,_0x3d458f=await resolveWorkspaceIdFromOptions(_0x4b24ad,_0x162b76);return await withSpinner(_0x24e11b(0xa8)+_0x394c19+'\x27...',()=>_0x162b76[_0x24e11b(0x75)]['launchCampaign'](_0x394c19,_0x3d458f),{'verbose':_0x5a8353['verbose']}),console[_0x24e11b(0xe1)](_0x24e11b(0xb7)+_0x394c19+_0x24e11b(0xe8)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x9e);['description']=a23_0x4b9761(0xc2);async[a23_0x4b9761(0xd3)](_0x56d769){const _0x10a6f6=a23_0x4b9761,{options:_0x1fb272,args:_0x41f1e7,tdx:_0x5aaf60}=_0x56d769;if(_0x41f1e7['length']===0x0)return console['error'](_0x10a6f6(0x77)),console[_0x10a6f6(0xef)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x38830d=_0x41f1e7[0x0],_0x308d9c=_0x1fb272,_0x41e5e4=await resolveWorkspaceIdFromOptions(_0x308d9c,_0x5aaf60);return await withSpinner(_0x10a6f6(0xe7)+_0x38830d+_0x10a6f6(0x8e),()=>_0x5aaf60[_0x10a6f6(0x75)][_0x10a6f6(0x8d)](_0x38830d,_0x41e5e4),{'verbose':_0x1fb272[_0x10a6f6(0xb4)]}),console[_0x10a6f6(0xe1)](_0x10a6f6(0xb7)+_0x38830d+_0x10a6f6(0x91)),0x0;}}function a23_0x1b34(){const _0x16e206=['Deleting\x20campaign\x20\x27','subject','name','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','type','description','jsonColumns','log','plaintext','updateWorkspace','engage:template:delete','engage:template:show','timezone','Pausing\x20campaign\x20\x27','\x27\x20launched\x20successfully','length','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Update\x20a\x20campaign','Fetching\x20template\x20\x27','createTemplate','html','error','22DpMbJg','engage:template:update','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Launch\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','updateTemplate','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Fetching\x20workspace\x20\x27','Delete\x20an\x20email\x20template','Error:\x20--subject\x20is\x20required','Fetching\x20campaign\x20\x27','listWorkspaces','editorType','Deleting\x20template\x20\x27','engage','Delete\x20a\x20workspace','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Workspace\x20\x27','engage:campaign:duplicate','engage:workspace:delete','23055936xAYpVS','getTemplateFull','engage_workspace','Workspace\x20is\x20required\x20for\x20this\x20operation','emailSenderId','\x27\x20resumed\x20successfully','Show\x20workspace\x20details','getCampaignFull','engage:campaign:launch','session','engage:workspace:show','Operation\x20cancelled','List\x20workspaces','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Error:\x20--name\x20is\x20required','97160xGYVwA','getCampaign','startAt','pauseCampaign','\x27...','getWorkspace','yes','\x27\x20paused\x20successfully','8057871VRAxeD','MISSING_ARGUMENT','data','engage:template:create','Template\x20\x27','limit','Updating\x20workspace\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','resolveWorkspaceId','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','\x27\x20deleted\x20successfully','engage:campaign:pause','Resuming\x20campaign\x20\x27','entries','listCampaigns','2438NrgbOv','engage:workspaces','Duplicate\x20a\x20campaign','Update\x20an\x20email\x20template','Fetching\x20campaigns...','827BnEoCb','Launching\x20campaign\x20\x27','deleteWorkspace','filter','resolvePathToResource','parentId','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Set\x20workspace\x20context\x20for\x20Engage\x20commands','getTemplate','78DmUgam','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','2454RPRHDu','verbose','List\x20campaigns','Create\x20an\x20email\x20template','Campaign\x20\x27','resumeCampaign','354280TqWsOF','Fetching\x20templates...','4868kFJxQT','fromEntries','segmentId','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','updateCampaign','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','keys','Pause\x20a\x20campaign','engage:templates','8RgTBPl','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Error:\x20--html\x20is\x20required','Duplicating\x20campaign\x20\x27','836640auMEiP','deleteCampaign','\x27?\x20This\x20cannot\x20be\x20undone.','engage:campaign:show','Options:\x20--name,\x20--description','engage:workspace:update','segment','workspace','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Fetching\x20workspaces...','execute','engage:workspace:create','Show\x20campaign\x20details','createCampaign','createWorkspace','Updating\x20template\x20\x27','Show\x20email\x20template\x20details'];a23_0x1b34=function(){return _0x16e206;};return a23_0x1b34();}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:resume';['description']='Resume\x20a\x20paused\x20campaign';async[a23_0x4b9761(0xd3)](_0x40f7a8){const _0x3c5535=a23_0x4b9761,{options:_0x419b99,args:_0x5c9fae,tdx:_0x4a2a15}=_0x40f7a8;if(_0x5c9fae[_0x3c5535(0xe9)]===0x0)return console['error'](_0x3c5535(0x77)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0xe72e8a=_0x5c9fae[0x0],_0x328d2c=_0x419b99,_0x8319fa=await resolveWorkspaceIdFromOptions(_0x328d2c,_0x4a2a15);return await withSpinner(_0x3c5535(0x9f)+_0xe72e8a+_0x3c5535(0x8e),()=>_0x4a2a15[_0x3c5535(0x75)][_0x3c5535(0xb8)](_0xe72e8a,_0x8319fa),{'verbose':_0x419b99[_0x3c5535(0xb4)]}),console['log'](_0x3c5535(0xb7)+_0xe72e8a+_0x3c5535(0x80)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a23_0x4b9761(0x79);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xa4);async['execute'](_0x20c286){const _0x2b1af2=a23_0x4b9761,{options:_0x4ec933,args:_0x38e22a,tdx:_0x3e6079}=_0x20c286;if(_0x38e22a['length']===0x0)return console[_0x2b1af2(0xef)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x2b1af2(0xef)](_0x2b1af2(0xad)),0x1;const _0x492322=_0x38e22a[0x0],_0x130df5=_0x4ec933,_0x23b22a=await resolveWorkspaceIdFromOptions(_0x130df5,_0x3e6079),_0x512200=await withSpinner(_0x2b1af2(0xc7)+_0x492322+'\x27...',()=>_0x3e6079[_0x2b1af2(0x75)]['duplicateCampaign'](_0x492322,_0x23b22a),{'verbose':_0x4ec933['verbose']});return await handleSDKOutput([_0x512200['data']],_0x4ec933),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xc3);[a23_0x4b9761(0xdf)]='List\x20email\x20templates';async[a23_0x4b9761(0xd3)](_0x7c0545){const _0x299748=a23_0x4b9761,{options:_0x31f353,args:_0xa4f339,tdx:_0x2720da}=_0x7c0545,_0x3ea0f9=_0xa4f339[0x0],_0x68796a=resolveLimit(_0x31f353['limit'],DEFAULT_LLM_LIMIT),_0x5f234c=_0x31f353,_0x149595=await resolveWorkspaceIdFromOptions(_0x5f234c,_0x2720da),_0x1f7bf0=await withSpinner(_0x299748(0xba),()=>_0x2720da[_0x299748(0x75)]['listTemplates']({'workspaceId':_0x149595,'limit':_0x68796a}),{'verbose':_0x31f353[_0x299748(0xb4)]});let _0x41ba16=_0x1f7bf0[_0x299748(0x94)];return _0x3ea0f9&&(_0x41ba16=_0x1f7bf0[_0x299748(0x94)][_0x299748(0xaa)](_0x4235f=>matchGlobPattern(_0x4235f[_0x299748(0xdc)],_0x3ea0f9))),await handleSDKOutput(_0x41ba16,_0x31f353),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xe5);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xd9);async[a23_0x4b9761(0xd3)](_0x1bd3da){const _0xdc3dd9=a23_0x4b9761,{options:_0x1ab1ee,args:_0x3f3606,tdx:_0x48b573}=_0x1bd3da;if(_0x3f3606['length']===0x0)return console[_0xdc3dd9(0xef)](_0xdc3dd9(0xb2)),console[_0xdc3dd9(0xef)]('Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>'),0x1;const _0x1c6774=_0x3f3606[0x0],_0x5eabf7=_0x1ab1ee,_0x28aace=await resolveWorkspaceIdFromOptions(_0x5eabf7,_0x48b573),_0x2b5e3c=_0x5eabf7['full'];if(_0x2b5e3c){const _0x18f760=await withSpinner(_0xdc3dd9(0xec)+_0x1c6774+_0xdc3dd9(0x8e),()=>_0x48b573['engage'][_0xdc3dd9(0x7c)](_0x1c6774,_0x28aace),{'verbose':_0x1ab1ee[_0xdc3dd9(0xb4)]});await handleSDKOutput([_0x18f760],_0x1ab1ee);}else{const _0x4e958c=await withSpinner(_0xdc3dd9(0xec)+_0x1c6774+_0xdc3dd9(0x8e),()=>_0x48b573['engage'][_0xdc3dd9(0xb0)](_0x1c6774,_0x28aace),{'verbose':_0x1ab1ee[_0xdc3dd9(0xb4)]});await handleSDKOutput([_0x4e958c],_0x1ab1ee);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x95);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xb6);async['execute'](_0x429c76){const _0x5a9c42=a23_0x4b9761,{options:_0x184af8,tdx:_0x2a59a2}=_0x429c76,_0x4ca37f=_0x184af8,_0x3e68b4=_0x4ca37f[_0x5a9c42(0xdc)],_0x3e89a2=_0x4ca37f[_0x5a9c42(0xdb)],_0x46116d=_0x4ca37f[_0x5a9c42(0xee)];if(!_0x3e68b4)return console[_0x5a9c42(0xef)](_0x5a9c42(0x89)),console[_0x5a9c42(0xef)]('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x3e89a2)return console['error'](_0x5a9c42(0x70)),0x1;if(!_0x46116d)return console[_0x5a9c42(0xef)](_0x5a9c42(0xc6)),0x1;const _0x4ccaa0=await resolveWorkspaceIdFromOptions(_0x4ca37f,_0x2a59a2,!![]),_0x14f26c={'name':_0x3e68b4,'subjectTemplate':_0x3e89a2,'htmlTemplate':_0x46116d,'workspaceId':_0x4ccaa0,'plaintextTemplate':_0x4ca37f[_0x5a9c42(0xe2)],'editorType':_0x4ca37f[_0x5a9c42(0x73)]},_0x2465cf=await withSpinner('Creating\x20template\x20\x27'+_0x3e68b4+_0x5a9c42(0x8e),()=>_0x2a59a2[_0x5a9c42(0x75)][_0x5a9c42(0xed)](_0x14f26c));return await handleSDKOutput([_0x2465cf[_0x5a9c42(0x94)]],_0x184af8),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a23_0x4b9761(0xf1);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xa5);async[a23_0x4b9761(0xd3)](_0x445b7a){const _0x173b17=a23_0x4b9761,{options:_0x2103ba,args:_0x308c59,tdx:_0x14a297}=_0x445b7a;if(_0x308c59[_0x173b17(0xe9)]===0x0)return console[_0x173b17(0xef)](_0x173b17(0xb2)),console[_0x173b17(0xef)](_0x173b17(0x88)),0x1;const _0x4a0a3b=_0x308c59[0x0],_0xbd8b01=_0x2103ba,_0x141d23=await resolveWorkspaceIdFromOptions(_0xbd8b01,_0x14a297),_0x320726={'name':_0xbd8b01[_0x173b17(0xdc)],'subjectTemplate':_0xbd8b01[_0x173b17(0xdb)],'htmlTemplate':_0xbd8b01[_0x173b17(0xee)],'plaintextTemplate':_0xbd8b01[_0x173b17(0xe2)]},_0x30f66c=Object[_0x173b17(0xbc)](Object[_0x173b17(0xa0)](_0x320726)[_0x173b17(0xaa)](([,_0x1e41bc])=>_0x1e41bc!==undefined));if(Object[_0x173b17(0xc1)](_0x30f66c)[_0x173b17(0xe9)]===0x0)return console[_0x173b17(0xef)](_0x173b17(0x6d)),console[_0x173b17(0xef)](_0x173b17(0xea)),0x1;const _0x3d87d8=await withSpinner(_0x173b17(0xd8)+_0x4a0a3b+_0x173b17(0x8e),()=>_0x14a297['engage'][_0x173b17(0xf5)](_0x4a0a3b,_0x30f66c,_0x141d23),{'verbose':_0x2103ba[_0x173b17(0xb4)]});return await handleSDKOutput([_0x3d87d8[_0x173b17(0x94)]],_0x2103ba),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xe4);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0x6f);async[a23_0x4b9761(0xd3)](_0x29859b){const _0x286547=a23_0x4b9761,{options:_0x5c4f18,args:_0x2acac9,tdx:_0x543720}=_0x29859b;if(_0x2acac9['length']===0x0)return console[_0x286547(0xef)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x286547(0xef)](_0x286547(0x9c)),0x1;const _0x25192c=_0x2acac9[0x0],_0x4762bb=_0x5c4f18,_0x374a8f=await resolveWorkspaceIdFromOptions(_0x4762bb,_0x543720);if(!_0x5c4f18['yes']){const _0x5ecd59=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x25192c+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x5ecd59)return console[_0x286547(0xe1)](_0x286547(0x86)),0x0;}return await withSpinner(_0x286547(0x74)+_0x25192c+_0x286547(0x8e),()=>_0x543720[_0x286547(0x75)]['deleteTemplate'](_0x25192c,_0x374a8f),{'verbose':_0x5c4f18[_0x286547(0xb4)]}),console['log'](_0x286547(0x96)+_0x25192c+_0x286547(0x9d)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xa3);['description']=a23_0x4b9761(0x87);async['execute'](_0xc6662a){const _0x592eb2=a23_0x4b9761,{options:_0x3755d0,args:_0x81f16f,tdx:_0x138a5d}=_0xc6662a,_0x3e0da4=_0x81f16f[0x0],_0x25486d=resolveLimit(_0x3755d0[_0x592eb2(0x97)],DEFAULT_LLM_LIMIT),_0x4c9469=await withSpinner(_0x592eb2(0xd2),()=>_0x138a5d[_0x592eb2(0x75)][_0x592eb2(0x72)]({'limit':_0x25486d}),{'verbose':_0x3755d0[_0x592eb2(0xb4)]});let _0x44f936=_0x4c9469[_0x592eb2(0x94)];return _0x3e0da4&&(_0x44f936=_0x4c9469['data'][_0x592eb2(0xaa)](_0x46469e=>matchGlobPattern(_0x46469e[_0x592eb2(0xdc)],_0x3e0da4))),await handleSDKOutput(_0x44f936,_0x3755d0),0x0;}}function a23_0x216e(_0x2bafbe,_0x121bc9){_0x2bafbe=_0x2bafbe-0x6d;const _0x1b34c6=a23_0x1b34();let _0x216e68=_0x1b34c6[_0x2bafbe];return _0x216e68;}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x85);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0x81);async['execute'](_0x3e32b7){const _0x3a936b=a23_0x4b9761,{options:_0x7b0d93,args:_0x5c250d,tdx:_0x54a07a}=_0x3e32b7;if(_0x5c250d['length']===0x0)return console[_0x3a936b(0xef)](_0x3a936b(0xd1)),console[_0x3a936b(0xef)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x522059=_0x5c250d[0x0],_0x25941b=_0x7b0d93,_0xe8cfef=_0x25941b['full'];if(_0xe8cfef){const _0x2c80c0=await withSpinner(_0x3a936b(0x6e)+_0x522059+'\x27...',()=>_0x54a07a[_0x3a936b(0x75)]['getWorkspaceFull'](_0x522059),{'verbose':_0x7b0d93['verbose']});await handleSDKOutput([_0x2c80c0],_0x7b0d93);}else{const _0xcb0a59=await withSpinner(_0x3a936b(0x6e)+_0x522059+_0x3a936b(0x8e),()=>_0x54a07a['engage'][_0x3a936b(0x8f)](_0x522059),{'verbose':_0x7b0d93[_0x3a936b(0xb4)]});await handleSDKOutput([_0xcb0a59],_0x7b0d93);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a23_0x4b9761(0xd4);[a23_0x4b9761(0xdf)]='Create\x20a\x20workspace';async[a23_0x4b9761(0xd3)](_0x2f38ba){const _0x3e4007=a23_0x4b9761,{options:_0x301e5c,tdx:_0x16d2bc}=_0x2f38ba,_0x28abe7=_0x301e5c,_0x5e0929=_0x28abe7[_0x3e4007(0xdc)];if(!_0x5e0929)return console[_0x3e4007(0xef)](_0x3e4007(0x89)),console[_0x3e4007(0xef)](_0x3e4007(0xbe)),0x1;const _0xb71e00={'name':_0x5e0929,'description':_0x28abe7[_0x3e4007(0xdf)]},_0x316cdc=await withSpinner('Creating\x20workspace\x20\x27'+_0x5e0929+'\x27...',()=>_0x16d2bc[_0x3e4007(0x75)][_0x3e4007(0xd7)](_0xb71e00));return await handleSDKOutput([_0x316cdc[_0x3e4007(0x94)]],_0x301e5c),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xcd);['description']='Update\x20a\x20workspace';async[a23_0x4b9761(0xd3)](_0x2763a3){const _0x5602fb=a23_0x4b9761,{options:_0x51ccf8,args:_0x26f31c,tdx:_0x4bee55}=_0x2763a3;if(_0x26f31c['length']===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x57df61=_0x26f31c[0x0],_0x84ccb7=_0x51ccf8,_0x48dbfc={'name':_0x84ccb7[_0x5602fb(0xdc)],'description':_0x84ccb7[_0x5602fb(0xdf)]},_0x183b39=Object['fromEntries'](Object['entries'](_0x48dbfc)[_0x5602fb(0xaa)](([,_0xf0eb27])=>_0xf0eb27!==undefined));if(Object[_0x5602fb(0xc1)](_0x183b39)['length']===0x0)return console[_0x5602fb(0xef)](_0x5602fb(0x6d)),console[_0x5602fb(0xef)](_0x5602fb(0xcc)),0x1;const _0x82f4f2=await withSpinner(_0x5602fb(0x98)+_0x57df61+_0x5602fb(0x8e),()=>_0x4bee55[_0x5602fb(0x75)][_0x5602fb(0xe3)](_0x57df61,_0x183b39),{'verbose':_0x51ccf8['verbose']});return await handleSDKOutput([_0x82f4f2[_0x5602fb(0x94)]],_0x51ccf8),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x7a);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0x76);async[a23_0x4b9761(0xd3)](_0x465692){const _0x386316=a23_0x4b9761,{options:_0x4287d6,args:_0x5f46da,tdx:_0x2f8db5}=_0x465692;if(_0x5f46da['length']===0x0)return console[_0x386316(0xef)](_0x386316(0xd1)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>'),0x1;const _0x20c897=_0x5f46da[0x0];if(!_0x4287d6[_0x386316(0x90)]){const _0x38ee97=await confirm(_0x386316(0x9a)+_0x20c897+_0x386316(0xca));if(!_0x38ee97)return console[_0x386316(0xe1)]('Operation\x20cancelled'),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x20c897+_0x386316(0x8e),()=>_0x2f8db5[_0x386316(0x75)][_0x386316(0xa9)](_0x20c897),{'verbose':_0x4287d6['verbose']}),console[_0x386316(0xe1)](_0x386316(0x78)+_0x20c897+_0x386316(0x9d)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:workspace:use';['description']=a23_0x4b9761(0xaf);async[a23_0x4b9761(0xd3)](_0x3da6d5){const _0xd9254a=a23_0x4b9761,{options:_0x3d3e58,args:_0x1a47ce,tdx:_0x555660}=_0x3da6d5;if(_0x1a47ce[_0xd9254a(0xe9)]===0x0)return console[_0xd9254a(0xef)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0xd9254a(0xef)](_0xd9254a(0xc0)),0x1;const _0x3e6d6a=_0x1a47ce[0x0];await withSpinner('Verifying\x20workspace\x20\x27'+_0x3e6d6a+_0xd9254a(0x8e),()=>_0x555660[_0xd9254a(0x75)][_0xd9254a(0x9b)](_0x3e6d6a));const _0x27f985=_0x3d3e58[_0xd9254a(0x84)]||undefined;return saveSessionContext({'engage_workspace':_0x3e6d6a},_0x27f985),console[_0xd9254a(0xe1)]('Engage\x20workspace\x20set\x20to:\x20'+_0x3e6d6a),console[_0xd9254a(0xe1)](_0xd9254a(0x99)),0x0;}}
@@ -1 +1 @@
1
- const a24_0x2acb52=a24_0x1782;(function(_0x250183,_0x3b2a47){const _0x5cc38e=a24_0x1782,_0x43ed52=_0x250183();while(!![]){try{const _0x1a49e3=parseInt(_0x5cc38e(0xba))/0x1*(parseInt(_0x5cc38e(0x94))/0x2)+parseInt(_0x5cc38e(0x85))/0x3*(-parseInt(_0x5cc38e(0x84))/0x4)+-parseInt(_0x5cc38e(0x91))/0x5*(-parseInt(_0x5cc38e(0xc1))/0x6)+-parseInt(_0x5cc38e(0x88))/0x7+-parseInt(_0x5cc38e(0xa7))/0x8+-parseInt(_0x5cc38e(0x96))/0x9+-parseInt(_0x5cc38e(0x9d))/0xa*(-parseInt(_0x5cc38e(0xb1))/0xb);if(_0x1a49e3===_0x3b2a47)break;else _0x43ed52['push'](_0x43ed52['shift']());}catch(_0x168c7b){_0x43ed52['push'](_0x43ed52['shift']());}}}(a24_0x37f2,0xd3992));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a24_0x1782(_0x5c1625,_0xf36b0c){_0x5c1625=_0x5c1625-0x82;const _0x37f254=a24_0x37f2();let _0x178251=_0x37f254[_0x5c1625];return _0x178251;}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_0x2acb52(0xcb)]=a24_0x2acb52(0xac);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xb7);async[a24_0x2acb52(0xb5)](_0x47d46b){const _0xb96b89=a24_0x2acb52,{options:_0x2f8257,tdx:_0x4ca3e1}=_0x47d46b;try{const _0x4a8341=resolveLimit(_0x2f8257['limit'],DEFAULT_DISPLAY_LIMIT),_0x132b0c=_0x2f8257[_0xb96b89(0xa2)];_0x2f8257[_0xb96b89(0x9b)]&&(console['error'](_0xb96b89(0x8b)+_0x4a8341+_0xb96b89(0xb2)),_0x132b0c&&console[_0xb96b89(0xc3)](_0xb96b89(0xd4)+_0x132b0c));const _0x3d62bf=await withSpinner(_0xb96b89(0xa8),()=>_0x4ca3e1[_0xb96b89(0xac)][_0xb96b89(0xc8)]({'from':0x0,'to':_0x4a8341-0x1,'status':_0x132b0c}),{'verbose':_0x2f8257[_0xb96b89(0x9b)]}),_0xbfc4b5=_0x3d62bf[_0xb96b89(0xc4)];console[_0xb96b89(0xc3)](_0xb96b89(0xce)+_0xbfc4b5[_0xb96b89(0xd0)]+'\x20job'+(_0xbfc4b5[_0xb96b89(0xd0)]!==0x1?'s':''));const _0x567225=_0xbfc4b5[_0xb96b89(0x9e)](_0x5b6e9c=>{const _0x53c842=_0xb96b89;let _0x31dc0a;if(_0x5b6e9c[_0x53c842(0x9c)]&&_0x5b6e9c[_0x53c842(0x8e)]){const _0x49e19b=new Date(_0x5b6e9c[_0x53c842(0x9c)])[_0x53c842(0xcf)](),_0x191c97=new Date(_0x5b6e9c[_0x53c842(0x8e)])[_0x53c842(0xcf)]();_0x31dc0a=Math[_0x53c842(0x92)]((_0x191c97-_0x49e19b)/0x3e8);}return{'job_id':_0x5b6e9c[_0x53c842(0xae)],'type':_0x5b6e9c[_0x53c842(0x90)],'status':_0x5b6e9c[_0x53c842(0xa2)],'user_name':_0x5b6e9c['user_name'],'duration_sec':_0x31dc0a,'created_at':_0x5b6e9c['created_at'],'started_at':_0x5b6e9c['start_at'],'end_at':_0x5b6e9c[_0x53c842(0x8e)]};});return await handleSDKOutput(_0x567225,_0x2f8257),0x0;}catch(_0x1a55a3){if(_0x1a55a3 instanceof SDKError)return console[_0xb96b89(0xc3)]('Error:\x20'+_0x1a55a3[_0xb96b89(0xb9)]),_0x1a55a3[_0xb96b89(0xa4)]&&console[_0xb96b89(0xc3)](_0xb96b89(0xc0)+_0x1a55a3[_0xb96b89(0xa4)]),0x1;throw _0x1a55a3;}}}export class JobShowCommand extends BaseCommand{['name']=a24_0x2acb52(0xd1);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xb4);async[a24_0x2acb52(0xb5)](_0x5d8537){const _0x5d4d9=a24_0x2acb52,{options:_0x268052,args:_0x107bab,tdx:_0x50b8cb}=_0x5d8537,_0xf53655=_0x107bab[0x0];if(!_0xf53655)return console[_0x5d4d9(0xc3)](_0x5d4d9(0xbc)),console[_0x5d4d9(0xc3)](_0x5d4d9(0xcd)),0x1;try{const _0x26f05f=await withSpinner(_0x5d4d9(0xaf),()=>_0x50b8cb[_0x5d4d9(0xac)]['show'](_0xf53655),{'verbose':_0x268052[_0x5d4d9(0x9b)]}),_0x1738c9=_0x26f05f[_0x5d4d9(0xc4)];let _0x512ade;if(_0x1738c9['start_at']&&_0x1738c9[_0x5d4d9(0x8e)]){const _0x17b8df=new Date(_0x1738c9[_0x5d4d9(0x9c)])[_0x5d4d9(0xcf)](),_0x4b9a8f=new Date(_0x1738c9['end_at'])[_0x5d4d9(0xcf)]();_0x512ade=Math[_0x5d4d9(0x92)]((_0x4b9a8f-_0x17b8df)/0x3e8);}const _0x343b8e={'job_id':_0x1738c9[_0x5d4d9(0xae)],'type':_0x1738c9[_0x5d4d9(0x90)],'status':_0x1738c9['status'],..._0x1738c9[_0x5d4d9(0xbb)]&&{'user_name':_0x1738c9[_0x5d4d9(0xbb)]},..._0x512ade!==undefined&&{'duration_sec':_0x512ade},..._0x1738c9[_0x5d4d9(0x97)]&&{'created_at':_0x1738c9[_0x5d4d9(0x97)]},..._0x1738c9[_0x5d4d9(0x9c)]&&{'started_at':_0x1738c9[_0x5d4d9(0x9c)]},..._0x1738c9[_0x5d4d9(0x8e)]&&{'end_at':_0x1738c9['end_at']},..._0x1738c9['database']&&{'database':_0x1738c9[_0x5d4d9(0x8a)]},..._0x1738c9['priority']!==undefined&&{'priority':_0x1738c9[_0x5d4d9(0x86)]},..._0x1738c9[_0x5d4d9(0xb8)]&&{'url':_0x1738c9['url']},..._0x1738c9['query']&&{'query':_0x1738c9[_0x5d4d9(0xab)]},..._0x1738c9[_0x5d4d9(0x83)]&&{'debug':_0x1738c9['debug']}};return await handleSingleObjectOutput(_0x343b8e,_0x268052),0x0;}catch(_0x110355){if(_0x110355 instanceof SDKError)return console[_0x5d4d9(0xc3)](_0x5d4d9(0xa5)+_0x110355[_0x5d4d9(0xb9)]),_0x110355[_0x5d4d9(0xa4)]&&console['error'](_0x5d4d9(0xc0)+_0x110355[_0x5d4d9(0xa4)]),0x1;throw _0x110355;}}}export class JobKillCommand extends BaseCommand{['name']=a24_0x2acb52(0xb6);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xbe);async[a24_0x2acb52(0xb5)](_0x55ceea){const _0x24ff95=a24_0x2acb52,{options:_0x2bc5b4,args:_0x380dd2,tdx:_0x241b40}=_0x55ceea,_0x4871fd=_0x380dd2[0x0];if(!_0x4871fd)return console[_0x24ff95(0xc3)](_0x24ff95(0xbc)),console['error'](_0x24ff95(0x93)),0x1;try{if(!_0x2bc5b4[_0x24ff95(0xd3)]){const _0x2f985a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x4871fd+'?');if(!_0x2f985a)return console[_0x24ff95(0xc3)](_0x24ff95(0xcc)),0x0;}return await withSpinner(_0x24ff95(0x95),()=>_0x241b40[_0x24ff95(0xac)][_0x24ff95(0x9a)](_0x4871fd),{'verbose':_0x2bc5b4[_0x24ff95(0x9b)]}),console[_0x24ff95(0xc3)](_0x24ff95(0xa1)+_0x4871fd),console[_0x24ff95(0xc3)]('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x4871fd+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x2d6087){if(_0x2d6087 instanceof SDKError)return console[_0x24ff95(0xc3)](_0x24ff95(0xa5)+_0x2d6087[_0x24ff95(0xb9)]),_0x2d6087['cause']&&console[_0x24ff95(0xc3)](_0x24ff95(0xc0)+_0x2d6087[_0x24ff95(0xa4)]),0x1;throw _0x2d6087;}}}function a24_0x37f2(){const _0x5d9020=['Getting\x20job\x20details...','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','10329litLXz','\x20jobs','Get\x20job\x20results','Show\x20job\x20details','execute','job:kill','List\x20jobs','url','message','2OeBdoi','user_name','Error:\x20Job\x20ID\x20is\x20required','jobType','Kill\x20a\x20job','Getting\x20job\x20results...','\x20\x20Cause:\x20','6wLPLDT','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','error','data','Submit\x20a\x20job','description','Job\x20type:\x20','list','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','trino','name','Cancelled','Usage:\x20job\x20show\x20<job-id>','✔\x20Found\x20','getTime','length','job:show','information_schema','yes','Status\x20filter:\x20','file','debug','6264jdQqjp','1518AFVlfM','priority','Query:\x20','11446057EUmueC','\x20row','database','Limit:\x20','✔\x20Job\x20submitted','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','end_at','job:submit','type','1165855eiMseT','round','Usage:\x20job\x20kill\x20<job-id>','561518wJzvgh','Submitting\x20kill\x20request...','13746609IgMvoP','created_at','hive','✔\x20Retrieved\x20','kill','verbose','start_at','50090znXGJS','map','result','...','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','status','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','cause','Error:\x20','Error:\x20Query\x20is\x20required','5411888QWRlGc','Listing\x20jobs...','job:result','\x20\x20Job\x20ID:\x20','query','jobs','Submitting\x20job...','job_id'];a24_0x37f2=function(){return _0x5d9020;};return a24_0x37f2();}export class JobSubmitCommand extends BaseCommand{[a24_0x2acb52(0xcb)]=a24_0x2acb52(0x8f);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xc5);async[a24_0x2acb52(0xb5)](_0x422557){const _0x456450=a24_0x2acb52,{options:_0x15c779,args:_0x3cd1d0,tdx:_0x477b7c}=_0x422557;try{const _0x5ce7c8=_0x15c779[_0x456450(0xbd)]||'trino',_0x5d9280=_0x15c779[_0x456450(0x82)],_0x3a71f5=_0x15c779[_0x456450(0x8a)]||_0x456450(0xd2);if(_0x5ce7c8!==_0x456450(0xca)&&_0x5ce7c8!==_0x456450(0x98))return console[_0x456450(0xc3)](_0x456450(0xb0)),0x1;let _0x180af3;if(_0x5d9280){if(_0x3cd1d0[0x0])return console['error'](_0x456450(0xc9)),0x1;const _0x550766=readSqlStatementsFromFile(_0x5d9280);if(_0x550766[_0x456450(0xd0)]===0x0)return console[_0x456450(0xc3)](_0x456450(0xa3)),0x1;if(_0x550766[_0x456450(0xd0)]>0x1)return console[_0x456450(0xc3)](_0x456450(0x8d)),0x1;_0x180af3=_0x550766[0x0];}else{if(!_0x3cd1d0[0x0])return console[_0x456450(0xc3)](_0x456450(0xa6)),console['error'](_0x456450(0xc2)),0x1;_0x180af3=_0x3cd1d0[0x0];}_0x15c779[_0x456450(0x9b)]&&(console[_0x456450(0xc3)](_0x456450(0xc7)+_0x5ce7c8),console['error']('Database:\x20'+_0x3a71f5),console[_0x456450(0xc3)](_0x456450(0x87)+_0x180af3['substring'](0x0,0x64)+(_0x180af3[_0x456450(0xd0)]>0x64?_0x456450(0xa0):'')));const _0x242059=await withSpinner(_0x456450(0xad),()=>_0x477b7c[_0x456450(0xac)]['submit'](_0x3a71f5,_0x180af3,_0x5ce7c8),{'verbose':_0x15c779['verbose']}),_0x30ad60=_0x242059['data'];return console['error'](_0x456450(0x8c)),console[_0x456450(0xc3)](_0x456450(0xaa)+_0x30ad60['job_id']),await handleSDKOutput([_0x30ad60],_0x15c779),0x0;}catch(_0x5cc021){if(_0x5cc021 instanceof SDKError)return console[_0x456450(0xc3)](_0x456450(0xa5)+_0x5cc021['message']),_0x5cc021[_0x456450(0xa4)]&&console[_0x456450(0xc3)](_0x456450(0xc0)+_0x5cc021[_0x456450(0xa4)]),0x1;throw _0x5cc021;}}}export class JobResultCommand extends BaseCommand{[a24_0x2acb52(0xcb)]=a24_0x2acb52(0xa9);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xb3);async[a24_0x2acb52(0xb5)](_0x2af9b0){const _0x45fb7b=a24_0x2acb52,{options:_0x5ed403,args:_0x45a6ca,tdx:_0x2b8cda}=_0x2af9b0,_0x581a25=_0x45a6ca[0x0];if(!_0x581a25)return console[_0x45fb7b(0xc3)](_0x45fb7b(0xbc)),console[_0x45fb7b(0xc3)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x2e5e27=await withSpinner(_0x45fb7b(0xbf),()=>_0x2b8cda['jobs'][_0x45fb7b(0x9f)](_0x581a25),{'verbose':_0x5ed403[_0x45fb7b(0x9b)]}),_0x55e703=_0x2e5e27[_0x45fb7b(0xc4)];return console[_0x45fb7b(0xc3)](_0x45fb7b(0x99)+_0x55e703[_0x45fb7b(0xd0)]+_0x45fb7b(0x89)+(_0x55e703[_0x45fb7b(0xd0)]!==0x1?'s':'')),await handleSDKOutput(_0x55e703,_0x5ed403),0x0;}catch(_0x7557c3){if(_0x7557c3 instanceof SDKError)return console[_0x45fb7b(0xc3)](_0x45fb7b(0xa5)+_0x7557c3['message']),_0x7557c3[_0x45fb7b(0xa4)]&&console['error']('\x20\x20Cause:\x20'+_0x7557c3[_0x45fb7b(0xa4)]),0x1;throw _0x7557c3;}}}
1
+ function a24_0x4527(_0x4df4fc,_0x6ff18){_0x4df4fc=_0x4df4fc-0x6e;const _0x2e7173=a24_0x2e71();let _0x4527d7=_0x2e7173[_0x4df4fc];return _0x4527d7;}const a24_0x10b94f=a24_0x4527;(function(_0x3c51b0,_0x3d58e9){const _0x381417=a24_0x4527,_0x423a7a=_0x3c51b0();while(!![]){try{const _0x30cf23=-parseInt(_0x381417(0xa5))/0x1+parseInt(_0x381417(0x74))/0x2*(-parseInt(_0x381417(0x8c))/0x3)+-parseInt(_0x381417(0x7e))/0x4*(-parseInt(_0x381417(0xb6))/0x5)+-parseInt(_0x381417(0x6f))/0x6*(-parseInt(_0x381417(0x71))/0x7)+-parseInt(_0x381417(0xb5))/0x8+-parseInt(_0x381417(0x7b))/0x9+-parseInt(_0x381417(0x9d))/0xa*(-parseInt(_0x381417(0x9f))/0xb);if(_0x30cf23===_0x3d58e9)break;else _0x423a7a['push'](_0x423a7a['shift']());}catch(_0x3cfa2b){_0x423a7a['push'](_0x423a7a['shift']());}}}(a24_0x2e71,0xb0e8c));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';function a24_0x2e71(){const _0x774da4=['Getting\x20job\x20results...','round','\x20job','query','\x20\x20Job\x20ID:\x20','cause','information_schema','type','Show\x20job\x20details','job:show','1134021gluOaj','Query:\x20','yes','debug','Database:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','job_id','\x20jobs','created_at','getTime','Error:\x20Job\x20ID\x20is\x20required','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','name','...','jobs','result','Error:\x20Query\x20is\x20required','1480YQRRiR','\x20\x20Cause:\x20','132847ZHNaal','data','List\x20jobs','Usage:\x20job\x20show\x20<job-id>','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Cancelled','599369TaLVRL','job:kill','Submit\x20a\x20job','url','Listing\x20jobs...','jobType','hive','error','trino','substring','length','\x27\x20to\x20verify\x20the\x20job\x20status','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Usage:\x20job\x20kill\x20<job-id>','database','show','1208272UUkktD','305HCONIL','file','status','job:submit','Error:\x20','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','user_name','Kill\x20a\x20job','execute','3378viHGHb','priority','1421nfnFjI','job:result','message','2RIvrai','verbose','✔\x20Job\x20submitted','✔\x20Retrieved\x20','start_at','end_at','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','3555666gQDqSl','description','Getting\x20job\x20details...','22716nHjUXX','kill','Status\x20filter:\x20','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'];a24_0x2e71=function(){return _0x774da4;};return a24_0x2e71();}import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x10b94f(0x98)]='jobs';[a24_0x10b94f(0x7c)]=a24_0x10b94f(0xa1);async[a24_0x10b94f(0x6e)](_0x566b3e){const _0x3b293b=a24_0x10b94f,{options:_0x251657,tdx:_0x598905}=_0x566b3e;try{const _0x7c853c=resolveLimit(_0x251657['limit'],DEFAULT_DISPLAY_LIMIT),_0x47a7f7=_0x251657[_0x3b293b(0xb8)];_0x251657[_0x3b293b(0x75)]&&(console[_0x3b293b(0xac)]('Limit:\x20'+_0x7c853c+_0x3b293b(0x93)),_0x47a7f7&&console[_0x3b293b(0xac)](_0x3b293b(0x80)+_0x47a7f7));const _0x58ec2e=await withSpinner(_0x3b293b(0xa9),()=>_0x598905[_0x3b293b(0x9a)]['list']({'from':0x0,'to':_0x7c853c-0x1,'status':_0x47a7f7}),{'verbose':_0x251657[_0x3b293b(0x75)]}),_0x5dbfe9=_0x58ec2e[_0x3b293b(0xa0)];console['error']('✔\x20Found\x20'+_0x5dbfe9[_0x3b293b(0xaf)]+_0x3b293b(0x84)+(_0x5dbfe9[_0x3b293b(0xaf)]!==0x1?'s':''));const _0x2e6b81=_0x5dbfe9['map'](_0x2a95da=>{const _0x4ebe92=_0x3b293b;let _0x52477f;if(_0x2a95da[_0x4ebe92(0x78)]&&_0x2a95da[_0x4ebe92(0x79)]){const _0x4d5224=new Date(_0x2a95da['start_at'])[_0x4ebe92(0x95)](),_0x343db2=new Date(_0x2a95da[_0x4ebe92(0x79)])['getTime']();_0x52477f=Math[_0x4ebe92(0x83)]((_0x343db2-_0x4d5224)/0x3e8);}return{'job_id':_0x2a95da[_0x4ebe92(0x92)],'type':_0x2a95da[_0x4ebe92(0x89)],'status':_0x2a95da[_0x4ebe92(0xb8)],'user_name':_0x2a95da[_0x4ebe92(0xbc)],'duration_sec':_0x52477f,'created_at':_0x2a95da['created_at'],'started_at':_0x2a95da[_0x4ebe92(0x78)],'end_at':_0x2a95da[_0x4ebe92(0x79)]};});return await handleSDKOutput(_0x2e6b81,_0x251657),0x0;}catch(_0x2667b7){if(_0x2667b7 instanceof SDKError)return console[_0x3b293b(0xac)]('Error:\x20'+_0x2667b7[_0x3b293b(0x73)]),_0x2667b7[_0x3b293b(0x87)]&&console[_0x3b293b(0xac)](_0x3b293b(0x9e)+_0x2667b7[_0x3b293b(0x87)]),0x1;throw _0x2667b7;}}}export class JobShowCommand extends BaseCommand{[a24_0x10b94f(0x98)]=a24_0x10b94f(0x8b);['description']=a24_0x10b94f(0x8a);async[a24_0x10b94f(0x6e)](_0x1ec3d8){const _0x4693f2=a24_0x10b94f,{options:_0x41df76,args:_0x30ddd6,tdx:_0x4300a7}=_0x1ec3d8,_0x6c9bca=_0x30ddd6[0x0];if(!_0x6c9bca)return console['error'](_0x4693f2(0x96)),console['error'](_0x4693f2(0xa2)),0x1;try{const _0x3ba9e3=await withSpinner(_0x4693f2(0x7d),()=>_0x4300a7[_0x4693f2(0x9a)][_0x4693f2(0xb4)](_0x6c9bca),{'verbose':_0x41df76[_0x4693f2(0x75)]}),_0x3be2e1=_0x3ba9e3[_0x4693f2(0xa0)];let _0xf8bbab;if(_0x3be2e1['start_at']&&_0x3be2e1[_0x4693f2(0x79)]){const _0x50b007=new Date(_0x3be2e1[_0x4693f2(0x78)])[_0x4693f2(0x95)](),_0x18b653=new Date(_0x3be2e1[_0x4693f2(0x79)])[_0x4693f2(0x95)]();_0xf8bbab=Math[_0x4693f2(0x83)]((_0x18b653-_0x50b007)/0x3e8);}const _0x49238e={'job_id':_0x3be2e1[_0x4693f2(0x92)],'type':_0x3be2e1['type'],'status':_0x3be2e1['status'],..._0x3be2e1[_0x4693f2(0xbc)]&&{'user_name':_0x3be2e1[_0x4693f2(0xbc)]},..._0xf8bbab!==undefined&&{'duration_sec':_0xf8bbab},..._0x3be2e1[_0x4693f2(0x94)]&&{'created_at':_0x3be2e1['created_at']},..._0x3be2e1['start_at']&&{'started_at':_0x3be2e1[_0x4693f2(0x78)]},..._0x3be2e1[_0x4693f2(0x79)]&&{'end_at':_0x3be2e1['end_at']},..._0x3be2e1[_0x4693f2(0xb3)]&&{'database':_0x3be2e1[_0x4693f2(0xb3)]},..._0x3be2e1['priority']!==undefined&&{'priority':_0x3be2e1[_0x4693f2(0x70)]},..._0x3be2e1['url']&&{'url':_0x3be2e1[_0x4693f2(0xa8)]},..._0x3be2e1[_0x4693f2(0x85)]&&{'query':_0x3be2e1[_0x4693f2(0x85)]},..._0x3be2e1[_0x4693f2(0x8f)]&&{'debug':_0x3be2e1[_0x4693f2(0x8f)]}};return await handleSingleObjectOutput(_0x49238e,_0x41df76),0x0;}catch(_0x54956d){if(_0x54956d instanceof SDKError)return console[_0x4693f2(0xac)](_0x4693f2(0xba)+_0x54956d[_0x4693f2(0x73)]),_0x54956d['cause']&&console[_0x4693f2(0xac)](_0x4693f2(0x9e)+_0x54956d[_0x4693f2(0x87)]),0x1;throw _0x54956d;}}}export class JobKillCommand extends BaseCommand{['name']=a24_0x10b94f(0xa6);['description']=a24_0x10b94f(0xbd);async['execute'](_0x37227d){const _0x52aa35=a24_0x10b94f,{options:_0x21ac37,args:_0x579407,tdx:_0x157ea1}=_0x37227d,_0x589815=_0x579407[0x0];if(!_0x589815)return console[_0x52aa35(0xac)](_0x52aa35(0x96)),console[_0x52aa35(0xac)](_0x52aa35(0xb2)),0x1;try{if(!_0x21ac37[_0x52aa35(0x8e)]){const _0x5b29c8=await confirm(_0x52aa35(0x91)+_0x589815+'?');if(!_0x5b29c8)return console['error'](_0x52aa35(0xa4)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x157ea1[_0x52aa35(0x9a)][_0x52aa35(0x7f)](_0x589815),{'verbose':_0x21ac37[_0x52aa35(0x75)]}),console[_0x52aa35(0xac)](_0x52aa35(0x97)+_0x589815),console[_0x52aa35(0xac)](_0x52aa35(0xbb)+_0x589815+_0x52aa35(0xb0)),0x0;}catch(_0x3bc4b7){if(_0x3bc4b7 instanceof SDKError)return console[_0x52aa35(0xac)]('Error:\x20'+_0x3bc4b7[_0x52aa35(0x73)]),_0x3bc4b7[_0x52aa35(0x87)]&&console[_0x52aa35(0xac)](_0x52aa35(0x9e)+_0x3bc4b7[_0x52aa35(0x87)]),0x1;throw _0x3bc4b7;}}}export class JobSubmitCommand extends BaseCommand{[a24_0x10b94f(0x98)]=a24_0x10b94f(0xb9);['description']=a24_0x10b94f(0xa7);async['execute'](_0xc41ce5){const _0x43ca0d=a24_0x10b94f,{options:_0x5d04f8,args:_0x78b68c,tdx:_0x4d288e}=_0xc41ce5;try{const _0x2bd7fc=_0x5d04f8[_0x43ca0d(0xaa)]||'trino',_0x2b0717=_0x5d04f8[_0x43ca0d(0xb7)],_0x17df24=_0x5d04f8['database']||_0x43ca0d(0x88);if(_0x2bd7fc!==_0x43ca0d(0xad)&&_0x2bd7fc!==_0x43ca0d(0xab))return console[_0x43ca0d(0xac)](_0x43ca0d(0x7a)),0x1;let _0x43be03;if(_0x2b0717){if(_0x78b68c[0x0])return console[_0x43ca0d(0xac)](_0x43ca0d(0xa3)),0x1;const _0x13e6d7=readSqlStatementsFromFile(_0x2b0717);if(_0x13e6d7[_0x43ca0d(0xaf)]===0x0)return console[_0x43ca0d(0xac)](_0x43ca0d(0xb1)),0x1;if(_0x13e6d7[_0x43ca0d(0xaf)]>0x1)return console[_0x43ca0d(0xac)](_0x43ca0d(0x81)),0x1;_0x43be03=_0x13e6d7[0x0];}else{if(!_0x78b68c[0x0])return console[_0x43ca0d(0xac)](_0x43ca0d(0x9c)),console[_0x43ca0d(0xac)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x43be03=_0x78b68c[0x0];}_0x5d04f8[_0x43ca0d(0x75)]&&(console[_0x43ca0d(0xac)]('Job\x20type:\x20'+_0x2bd7fc),console['error'](_0x43ca0d(0x90)+_0x17df24),console[_0x43ca0d(0xac)](_0x43ca0d(0x8d)+_0x43be03[_0x43ca0d(0xae)](0x0,0x64)+(_0x43be03[_0x43ca0d(0xaf)]>0x64?_0x43ca0d(0x99):'')));const _0x2d505c=await withSpinner('Submitting\x20job...',()=>_0x4d288e[_0x43ca0d(0x9a)]['submit'](_0x17df24,_0x43be03,_0x2bd7fc),{'verbose':_0x5d04f8[_0x43ca0d(0x75)]}),_0x3e8fd0=_0x2d505c[_0x43ca0d(0xa0)];return console[_0x43ca0d(0xac)](_0x43ca0d(0x76)),console['error'](_0x43ca0d(0x86)+_0x3e8fd0[_0x43ca0d(0x92)]),await handleSDKOutput([_0x3e8fd0],_0x5d04f8),0x0;}catch(_0x41b621){if(_0x41b621 instanceof SDKError)return console[_0x43ca0d(0xac)]('Error:\x20'+_0x41b621[_0x43ca0d(0x73)]),_0x41b621['cause']&&console['error'](_0x43ca0d(0x9e)+_0x41b621[_0x43ca0d(0x87)]),0x1;throw _0x41b621;}}}export class JobResultCommand extends BaseCommand{[a24_0x10b94f(0x98)]=a24_0x10b94f(0x72);['description']='Get\x20job\x20results';async['execute'](_0x359ed8){const _0x18f29a=a24_0x10b94f,{options:_0x37e964,args:_0x3d3252,tdx:_0x1a2cde}=_0x359ed8,_0x1f6ca6=_0x3d3252[0x0];if(!_0x1f6ca6)return console['error'](_0x18f29a(0x96)),console[_0x18f29a(0xac)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0xf849ca=await withSpinner(_0x18f29a(0x82),()=>_0x1a2cde[_0x18f29a(0x9a)][_0x18f29a(0x9b)](_0x1f6ca6),{'verbose':_0x37e964[_0x18f29a(0x75)]}),_0x25262e=_0xf849ca['data'];return console[_0x18f29a(0xac)](_0x18f29a(0x77)+_0x25262e[_0x18f29a(0xaf)]+'\x20row'+(_0x25262e['length']!==0x1?'s':'')),await handleSDKOutput(_0x25262e,_0x37e964),0x0;}catch(_0x5d0ee0){if(_0x5d0ee0 instanceof SDKError)return console[_0x18f29a(0xac)](_0x18f29a(0xba)+_0x5d0ee0[_0x18f29a(0x73)]),_0x5d0ee0[_0x18f29a(0x87)]&&console[_0x18f29a(0xac)](_0x18f29a(0x9e)+_0x5d0ee0[_0x18f29a(0x87)]),0x1;throw _0x5d0ee0;}}}
@@ -1 +1 @@
1
- const a25_0x443b0d=a25_0x1ad5;(function(_0x20186b,_0x1cb070){const _0x2e404f=a25_0x1ad5,_0x17f1a0=_0x20186b();while(!![]){try{const _0x1c6a7e=parseInt(_0x2e404f(0x1d8))/0x1+-parseInt(_0x2e404f(0x195))/0x2+-parseInt(_0x2e404f(0x1f8))/0x3*(parseInt(_0x2e404f(0x204))/0x4)+parseInt(_0x2e404f(0x1e9))/0x5+-parseInt(_0x2e404f(0x1f2))/0x6+-parseInt(_0x2e404f(0x1b6))/0x7+parseInt(_0x2e404f(0x1be))/0x8*(parseInt(_0x2e404f(0x191))/0x9);if(_0x1c6a7e===_0x1cb070)break;else _0x17f1a0['push'](_0x17f1a0['shift']());}catch(_0x3e62fe){_0x17f1a0['push'](_0x17f1a0['shift']());}}}(a25_0x3fc9,0x25927));import a25_0x13c49d from'chalk';function a25_0x3fc9(){const _0x29a5ba=['Pausing\x20journey...','Cancelled','rule','journey:stats','error','message','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Input:\x20','388bpUzpe','launched','format','population','goal','journey:pull','\x20\x20Folder\x20path:\x20','totalGoalAchieved','getSegment','segment','Resolving\x20parent\x20segment...','Parent\x20segment:\x20','hasChanges','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Getting\x20journey\x20details...','yellow','data','Resume\x20a\x20paused\x20journey','includeStats','goalRate','paused','content','resolveJourneyId','cyan','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)','journey','\x20(paused)','Resolved\x20YAML\x20file:\x20','\x0aPull\x20summary:','📁\x20','Fetching\x20parent\x20segment...','\x20journeys','3474sNQMQd','execute','journeyName','parentSegment','317470xVgwjW','diff','totalEntered','✔\x20Pulled\x20','state','description','\x20journey','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','journeyStages','.yml','map','\x20\x20Target:\x20','log','draft','Using\x20parent\x20segment:\x20','repeat','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','name','No\x20journeys\x20found','resolveParentId','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','\x20\x20Statistics\x20not\x20available','push','archived','journey:pause','join','table','Found\x20existing\x20tdx.json\x20at:\x20','No\x20statistics\x20available\x20for\x20journey:\x20','\x20(ID:\x20','gray','folderId','stages','1231853spADIM','conversionRate','entered','\x5c$&','Pause\x20a\x20running\x20journey','Aborted.','(root)','filter','8248LBNYdd','journey:view','stageName','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','segmentName','listFolders','getStatistics','Export\x20journey(s)\x20as\x20YAML\x20files','absolutePath','verbose','split','Pattern:\x20','Getting\x20journey\x20statistics...','toLowerCase','length','Usage:\x20journey\x20resume\x20<name-or-path>','journeyBundleName','utf-8','\x20new\x20files','json','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','resume','Resuming\x20journey...','Listing\x20journeys...','\x22\x20paused','101815SwKrzK','reentryMode','listJourneysFromParentSegment','journeys','Resolving\x20journey...','green','getParentFull','🗺️\x20','exited','\x20\x20Parent\x20segment:\x20','get','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','pause','dirname','Write\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Usage:\x20journey\x20stats\x20<name-or-path>','1262550pyTiGN','Usage:\x20journey\x20view\x20<name-or-path>','getJourney','set','attributes','✔\x20Journey\x20\x22','yes','Parent\x20segment\x20context\x20not\x20set.\x0a','journeyId','43866cIfDKW','relative','isNew','replace','relativePath','folderPath','7929soibLf','INVALID_ARGUMENT','parent_segment','...'];a25_0x3fc9=function(){return _0x29a5ba;};return a25_0x3fc9();}import a25_0x8e576b 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';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';function a25_0x1ad5(_0x483d2f,_0x46232c){_0x483d2f=_0x483d2f-0x18e;const _0x3fc9ee=a25_0x3fc9();let _0x1ad5dc=_0x3fc9ee[_0x483d2f];return _0x1ad5dc;}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(_0x15dc27){const _0x134be9=a25_0x1ad5;switch(_0x15dc27){case _0x134be9(0x205):return a25_0x13c49d[_0x134be9(0x1dd)](_0x15dc27);case _0x134be9(0x1a2):return a25_0x13c49d[_0x134be9(0x1b3)](_0x15dc27);case _0x134be9(0x1ac):return a25_0x13c49d['dim'](_0x15dc27);default:return _0x15dc27;}}function formatJourneyItem(_0x9e16dc,_0x50a41b=''){const _0x2d6ec4=a25_0x1ad5,_0x3013ea=formatJourneyState(_0x9e16dc['state']),_0x5312d2=_0x9e16dc[_0x2d6ec4(0x218)]?a25_0x13c49d[_0x2d6ec4(0x213)](_0x2d6ec4(0x21e)):'';return _0x50a41b+_0x2d6ec4(0x1df)+_0x9e16dc[_0x2d6ec4(0x1ce)]+'\x20('+_0x3013ea+')'+_0x5312d2;}function escapeRegex(_0x4e6e5f){const _0x43a084=a25_0x1ad5;return _0x4e6e5f[_0x43a084(0x1f5)](/[.*+?^${}()|[\]\\]/g,_0x43a084(0x1b9));}function globToRegex(_0xe13667){const _0x419d07=a25_0x1ad5,_0x52ab48=_0xe13667[_0x419d07(0x1c8)]('*')[_0x419d07(0x19f)](escapeRegex);return new RegExp(_0x52ab48[_0x419d07(0x1ae)]('.*'),'i');}function resolveJourneyTarget(_0x4fc425,_0x18a093,_0x2ae99d){const _0x8c07b8=a25_0x1ad5;if(isYamlFilePath(_0x4fc425))try{const _0x4bd523=resolveYamlFilePath(_0x4fc425);return _0x2ae99d&&(console[_0x8c07b8(0x200)](_0x8c07b8(0x21f)+_0x4fc425),console[_0x8c07b8(0x200)](_0x8c07b8(0x1e1)+_0x4bd523['parentSegment']),console['error']('\x20\x20Name:\x20'+_0x4bd523[_0x8c07b8(0x1c2)]),console[_0x8c07b8(0x200)](_0x8c07b8(0x20a)+(_0x4bd523[_0x8c07b8(0x1f7)]||_0x8c07b8(0x1bc)))),{'journeyName':_0x4bd523[_0x8c07b8(0x1c2)],'parentSegment':_0x4bd523[_0x8c07b8(0x194)],'resolved':_0x4bd523};}catch(_0xa9ded5){throw new SDKError(ErrorCode[_0x8c07b8(0x1f9)],_0x8c07b8(0x1d3)+_0xa9ded5[_0x8c07b8(0x201)]);}if(!_0x18a093)throw new SDKError(ErrorCode[_0x8c07b8(0x1f9)],_0x8c07b8(0x1e3));return{'journeyName':_0x4fc425,'parentSegment':_0x18a093};}export class JourneyListCommand extends BaseCommand{[a25_0x443b0d(0x1a6)]='journey:list';[a25_0x443b0d(0x19a)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x338a36){const _0x104fda=a25_0x443b0d,{options:_0x5b8e91,args:_0x524021,tdx:_0x3dfdda}=_0x338a36,_0xfbee63=_0x524021[0x0],_0x2e53ef=_0x5b8e91[_0x104fda(0x194)];if(!_0x2e53ef)return console[_0x104fda(0x200)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x104fda(0x200)](_0x104fda(0x1a9)),0x1;const _0x14a687=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x3dfdda[_0x104fda(0x20d)]['resolveParentId'](_0x2e53ef),{'verbose':_0x5b8e91['verbose']}),_0x86773e=_0x14a687[_0x104fda(0x214)];_0x5b8e91['verbose']&&(console[_0x104fda(0x200)](_0x104fda(0x20f)+_0x2e53ef+_0x104fda(0x1b2)+_0x86773e+')'),_0xfbee63&&console[_0x104fda(0x200)](_0x104fda(0x1c9)+_0xfbee63));const [_0x441b91,_0x171651,_0x402d97]=await Promise['all']([withSpinner(_0x104fda(0x18f),()=>_0x3dfdda[_0x104fda(0x20d)][_0x104fda(0x1de)](_0x86773e),{'verbose':_0x5b8e91[_0x104fda(0x1c7)]}),withSpinner('Fetching\x20folders...',()=>_0x3dfdda[_0x104fda(0x20d)][_0x104fda(0x1c3)](_0x86773e),{'verbose':_0x5b8e91[_0x104fda(0x1c7)]}),withSpinner(_0x104fda(0x1d6),()=>_0x3dfdda[_0x104fda(0x21d)][_0x104fda(0x1da)](_0x86773e),{'verbose':_0x5b8e91[_0x104fda(0x1c7)]})]),_0x538ba1=_0x441b91[_0x104fda(0x214)],_0x227709=_0x171651[_0x104fda(0x214)];let _0x20e6d2=_0x402d97['data'];const _0xb6a302=_0x538ba1['rootFolderId'],_0x106bad=new Map();for(const _0x3a6860 of _0x227709){_0x106bad[_0x104fda(0x1ec)](_0x3a6860['id'],_0x3a6860[_0x104fda(0x1a6)]);}if(_0xfbee63){const _0x564f10=globToRegex(_0xfbee63);_0x20e6d2=_0x20e6d2[_0x104fda(0x1bd)](_0x238fec=>_0x564f10['test'](_0x238fec[_0x104fda(0x1ce)]));}console[_0x104fda(0x200)]('✔\x20Found\x20'+_0x20e6d2[_0x104fda(0x1cc)]+_0x104fda(0x19b)+(_0x20e6d2[_0x104fda(0x1cc)]!==0x1?'s':''));if(_0x5b8e91[_0x104fda(0x206)]===_0x104fda(0x1af))await handleSDKOutput(_0x20e6d2,_0x5b8e91);else{if(_0x5b8e91[_0x104fda(0x206)]===_0x104fda(0x1d1))await handleSDKOutput(_0x20e6d2,_0x5b8e91);else{console[_0x104fda(0x1a1)]('['+_0x2e53ef+']');const _0x2104e5=new Map(),_0x2fcb58=[];for(const _0x1dc229 of _0x20e6d2){if(!_0x1dc229['folderId']||_0x1dc229[_0x104fda(0x1b4)]===_0xb6a302)_0x2fcb58['push'](_0x1dc229);else{const _0x30890f=_0x2104e5[_0x104fda(0x1e2)](_0x1dc229['folderId'])||[];_0x30890f[_0x104fda(0x1ab)](_0x1dc229),_0x2104e5[_0x104fda(0x1ec)](_0x1dc229['folderId'],_0x30890f);}}for(const _0x38d04c of _0x2fcb58){console[_0x104fda(0x1a1)](formatJourneyItem(_0x38d04c));}for(const [_0x5743f8,_0x43c4bd]of _0x2104e5){const _0x554240=_0x106bad['get'](_0x5743f8)||_0x5743f8;console['log'](_0x104fda(0x18e)+_0x554240);for(const _0x5170b1 of _0x43c4bd){console['log'](formatJourneyItem(_0x5170b1,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x443b0d(0x1a6)]=a25_0x443b0d(0x1bf);['description']='Show\x20journey\x20details';async[a25_0x443b0d(0x192)](_0x1f1e4e){const _0x5d8495=a25_0x443b0d,{options:_0x153604,args:_0x3e2776,tdx:_0x4cf8c8}=_0x1f1e4e,_0x2dda44=_0x3e2776[0x0];if(!_0x2dda44)return console[_0x5d8495(0x200)](_0x5d8495(0x1e7)),console[_0x5d8495(0x200)](_0x5d8495(0x1ea)),0x1;_0x153604[_0x5d8495(0x1c7)]&&console['error'](_0x5d8495(0x203)+_0x2dda44);const _0x3919e4=resolveJourneyTarget(_0x2dda44,_0x153604['parentSegment'],_0x153604[_0x5d8495(0x1c7)]),_0x72f62a=await withSpinner(_0x5d8495(0x20e),()=>_0x4cf8c8[_0x5d8495(0x20d)][_0x5d8495(0x1a8)](_0x3919e4[_0x5d8495(0x194)]),{'verbose':_0x153604['verbose']}),_0x34b030=_0x72f62a['data'],_0x27ec84=await withSpinner(_0x5d8495(0x1dc),()=>_0x4cf8c8[_0x5d8495(0x21d)][_0x5d8495(0x21a)](_0x34b030,_0x3919e4[_0x5d8495(0x193)]),{'verbose':_0x153604[_0x5d8495(0x1c7)]}),_0x1be90e=_0x27ec84[_0x5d8495(0x214)],_0x5536f0=await withSpinner(_0x5d8495(0x212),()=>_0x4cf8c8['journey'][_0x5d8495(0x1eb)](_0x1be90e),{'verbose':_0x153604[_0x5d8495(0x1c7)]}),_0x52714e=_0x5536f0[_0x5d8495(0x214)],_0x40a6a1=_0x153604[_0x5d8495(0x216)];let _0x2f5f5d;if(_0x40a6a1)try{const _0x54649c=await withSpinner(_0x5d8495(0x1ca),()=>_0x4cf8c8[_0x5d8495(0x21d)][_0x5d8495(0x1c4)](_0x1be90e),{'verbose':_0x153604[_0x5d8495(0x1c7)]});_0x2f5f5d=_0x54649c['data'];}catch{_0x153604[_0x5d8495(0x1c7)]&&console['error'](_0x5d8495(0x1aa));}const _0x5dfdb3={'id':_0x52714e['id'],'name':_0x52714e[_0x5d8495(0x1ed)]['name'],'description':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x19a)],'state':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x199)],'paused':_0x52714e[_0x5d8495(0x1ed)]['paused'],'reentry_mode':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x1d9)],'stages':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x19d)]?.[_0x5d8495(0x1cc)]||0x0,..._0x52714e[_0x5d8495(0x1ed)]['goal']&&{'goal':_0x52714e['attributes'][_0x5d8495(0x208)]['name']},..._0x2f5f5d&&{'statistics':{'total_entered':_0x2f5f5d[_0x5d8495(0x197)],'goal_achieved':_0x2f5f5d['totalGoalAchieved'],'goal_rate':_0x2f5f5d[_0x5d8495(0x217)],'stages':_0x2f5f5d['stages']}}};return await handleSingleObjectOutput(_0x5dfdb3,_0x153604),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x443b0d(0x1a6)]=a25_0x443b0d(0x1ff);['description']='Show\x20journey\x20statistics';async[a25_0x443b0d(0x192)](_0x50cd1c){const _0x4bce68=a25_0x443b0d,{options:_0xceb60c,args:_0x417958,tdx:_0xee28dd}=_0x50cd1c,_0x5793de=_0x417958[0x0];if(!_0x5793de)return console['error'](_0x4bce68(0x1e7)),console[_0x4bce68(0x200)](_0x4bce68(0x1e8)),0x1;_0xceb60c[_0x4bce68(0x1c7)]&&console[_0x4bce68(0x200)]('Input:\x20'+_0x5793de);const _0x3f8578=resolveJourneyTarget(_0x5793de,_0xceb60c[_0x4bce68(0x194)],_0xceb60c['verbose']),_0x2270bc=await withSpinner(_0x4bce68(0x20e),()=>_0xee28dd[_0x4bce68(0x20d)][_0x4bce68(0x1a8)](_0x3f8578[_0x4bce68(0x194)]),{'verbose':_0xceb60c['verbose']}),_0x46c9f5=_0x2270bc[_0x4bce68(0x214)],_0x3a4aee=await withSpinner(_0x4bce68(0x1dc),()=>_0xee28dd['journey'][_0x4bce68(0x21a)](_0x46c9f5,_0x3f8578[_0x4bce68(0x193)]),{'verbose':_0xceb60c[_0x4bce68(0x1c7)]}),_0x1433c2=_0x3a4aee['data'],_0x3ae839=await withSpinner(_0x4bce68(0x1ca),()=>_0xee28dd[_0x4bce68(0x21d)][_0x4bce68(0x1c4)](_0x1433c2),{'verbose':_0xceb60c[_0x4bce68(0x1c7)]}),_0x3267b8=_0x3ae839[_0x4bce68(0x214)];if(!_0x3267b8||_0x3267b8[_0x4bce68(0x1f1)]===null)return console['error'](_0x4bce68(0x1b1)+_0x3f8578[_0x4bce68(0x193)]),console[_0x4bce68(0x200)](_0x4bce68(0x1d2)),0x0;const _0x13f905={'journey_id':_0x3267b8[_0x4bce68(0x1f1)],'total_entered':_0x3267b8[_0x4bce68(0x197)],'goal_achieved':_0x3267b8[_0x4bce68(0x20b)],'goal_rate':_0x3267b8[_0x4bce68(0x217)],'stages':_0x3267b8[_0x4bce68(0x1b5)]?.['map'](_0xbee399=>({'name':_0xbee399['stageName'],'population':_0xbee399[_0x4bce68(0x207)],'entered':_0xbee399['entered'],'exited':_0xbee399[_0x4bce68(0x1e0)],'conversion_rate':_0xbee399['conversionRate']}))},_0x3fc983=_0xceb60c['stage'];if(_0x3fc983&&_0x3267b8[_0x4bce68(0x1b5)]){const _0x541d7b=_0x3267b8[_0x4bce68(0x1b5)]['find'](_0x161b66=>_0x161b66[_0x4bce68(0x1c0)][_0x4bce68(0x1cb)]()===_0x3fc983[_0x4bce68(0x1cb)]());if(_0x541d7b)return await handleSingleObjectOutput({'stage_name':_0x541d7b[_0x4bce68(0x1c0)],'population':_0x541d7b[_0x4bce68(0x207)],'entered':_0x541d7b[_0x4bce68(0x1b8)],'exited':_0x541d7b[_0x4bce68(0x1e0)],'conversion_rate':_0x541d7b[_0x4bce68(0x1b7)]},_0xceb60c),0x0;console[_0x4bce68(0x200)]('Warning:\x20Stage\x20\x22'+_0x3fc983+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x13f905,_0xceb60c),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a25_0x443b0d(0x1ad);[a25_0x443b0d(0x19a)]=a25_0x443b0d(0x1ba);async[a25_0x443b0d(0x192)](_0x479b3d){const _0x33dabc=a25_0x443b0d,{options:_0x4b079f,args:_0x299437,tdx:_0x1126d7}=_0x479b3d,_0x3fe3d9=_0x299437[0x0];if(!_0x3fe3d9)return console[_0x33dabc(0x200)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x33dabc(0x200)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x4b079f[_0x33dabc(0x1c7)]&&console[_0x33dabc(0x200)](_0x33dabc(0x203)+_0x3fe3d9);const _0x34fea6=resolveJourneyTarget(_0x3fe3d9,_0x4b079f[_0x33dabc(0x194)],_0x4b079f[_0x33dabc(0x1c7)]),_0x4fb0a0=await withSpinner(_0x33dabc(0x20e),()=>_0x1126d7[_0x33dabc(0x20d)][_0x33dabc(0x1a8)](_0x34fea6['parentSegment']),{'verbose':_0x4b079f['verbose']}),_0x5b81f1=_0x4fb0a0[_0x33dabc(0x214)],_0x4459e2=await withSpinner('Resolving\x20journey...',()=>_0x1126d7[_0x33dabc(0x21d)][_0x33dabc(0x21a)](_0x5b81f1,_0x34fea6[_0x33dabc(0x193)]),{'verbose':_0x4b079f[_0x33dabc(0x1c7)]}),_0x1483d5=_0x4459e2['data'];if(!_0x4b079f[_0x33dabc(0x1ef)]){const _0x567d8f=await confirm(_0x33dabc(0x1a5)+_0x34fea6['journeyName']+'\x22?');if(!_0x567d8f)return console[_0x33dabc(0x200)](_0x33dabc(0x1fd)),0x0;}const _0x4063a4=await withSpinner(_0x33dabc(0x1fc),()=>_0x1126d7[_0x33dabc(0x21d)][_0x33dabc(0x1e4)](_0x1483d5),{'verbose':_0x4b079f[_0x33dabc(0x1c7)]}),_0xe6ea2d=_0x4063a4['data'];return console[_0x33dabc(0x200)](_0x33dabc(0x1ee)+_0xe6ea2d['attributes']['name']+_0x33dabc(0x1d7)),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']='journey:resume';[a25_0x443b0d(0x19a)]=a25_0x443b0d(0x215);async['execute'](_0x190310){const _0x141a75=a25_0x443b0d,{options:_0x292357,args:_0x46001e,tdx:_0x2cc1b2}=_0x190310,_0x30a1fc=_0x46001e[0x0];if(!_0x30a1fc)return console[_0x141a75(0x200)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x141a75(0x200)](_0x141a75(0x1cd)),0x1;_0x292357[_0x141a75(0x1c7)]&&console[_0x141a75(0x200)](_0x141a75(0x203)+_0x30a1fc);const _0x1dd3f3=resolveJourneyTarget(_0x30a1fc,_0x292357[_0x141a75(0x194)],_0x292357[_0x141a75(0x1c7)]),_0x5015c3=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2cc1b2[_0x141a75(0x20d)]['resolveParentId'](_0x1dd3f3['parentSegment']),{'verbose':_0x292357[_0x141a75(0x1c7)]}),_0x5b83d8=_0x5015c3[_0x141a75(0x214)],_0x475923=await withSpinner('Resolving\x20journey...',()=>_0x2cc1b2[_0x141a75(0x21d)][_0x141a75(0x21a)](_0x5b83d8,_0x1dd3f3[_0x141a75(0x193)]),{'verbose':_0x292357[_0x141a75(0x1c7)]}),_0x2c89bb=_0x475923[_0x141a75(0x214)];if(!_0x292357[_0x141a75(0x1ef)]){const _0x47c2b7=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x1dd3f3[_0x141a75(0x193)]+'\x22?');if(!_0x47c2b7)return console[_0x141a75(0x200)](_0x141a75(0x1fd)),0x0;}const _0x14c995=await withSpinner(_0x141a75(0x1d5),()=>_0x2cc1b2['journey'][_0x141a75(0x1d4)](_0x2c89bb),{'verbose':_0x292357[_0x141a75(0x1c7)]}),_0x4f4d77=_0x14c995[_0x141a75(0x214)];return console['error'](_0x141a75(0x1ee)+_0x4f4d77[_0x141a75(0x1ed)][_0x141a75(0x1a6)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a25_0x443b0d(0x209);[a25_0x443b0d(0x19a)]=a25_0x443b0d(0x1c5);async[a25_0x443b0d(0x192)](_0x1fd1a7){const _0x325c72=a25_0x443b0d,{options:_0x5b77f7,args:_0x529904,tdx:_0x3b8f7c}=_0x1fd1a7,_0xb06612=_0x5b77f7,_0x4e46db=_0x529904[0x0],_0x29cc73=findTdxConfigPath();let _0x10bf95,_0x108278;if(_0x29cc73){const _0x25fb7c=loadTdxConfig(_0x29cc73);_0x10bf95=_0x25fb7c[_0x325c72(0x1fa)],_0x108278=a25_0x8e576b[_0x325c72(0x1ae)](a25_0x8e576b[_0x325c72(0x1e5)](_0x29cc73),_0x325c72(0x1db)),_0xb06612[_0x325c72(0x1c7)]&&(console[_0x325c72(0x200)](_0x325c72(0x1b0)+_0x29cc73),console[_0x325c72(0x200)](_0x325c72(0x1a3)+_0x10bf95));}else{_0x10bf95=_0x5b77f7[_0x325c72(0x194)];if(!_0x10bf95)return console[_0x325c72(0x200)](a25_0x13c49d[_0x325c72(0x213)](_0x325c72(0x1f0))),console['error'](_0x325c72(0x21c)),console[_0x325c72(0x200)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x325c72(0x200)](_0x325c72(0x202)),0x1;_0x108278=a25_0x8e576b['join'](getSegmentRootDir(sanitizeFileName(_0x10bf95)),_0x325c72(0x1db));}const _0x133385=await withSpinner(_0x325c72(0x20e),()=>_0x3b8f7c[_0x325c72(0x20d)][_0x325c72(0x1a8)](_0x10bf95),{'verbose':_0x5b77f7[_0x325c72(0x1c7)]}),_0xe194aa=_0x133385[_0x325c72(0x214)],_0x254542=await withSpinner(_0x325c72(0x1d6),()=>_0x3b8f7c[_0x325c72(0x21d)][_0x325c72(0x1da)](_0xe194aa),{'verbose':_0x5b77f7[_0x325c72(0x1c7)]});let _0x2c5246=_0x254542['data'];if(_0x4e46db){const _0x122940=_0x2c5246[_0x325c72(0x1bd)](_0x415462=>_0x415462[_0x325c72(0x1ce)][_0x325c72(0x1cb)]()===_0x4e46db[_0x325c72(0x1cb)]());if(_0x122940[_0x325c72(0x1cc)]===0x0)return console[_0x325c72(0x200)]('Error:\x20Journey\x20not\x20found:\x20'+_0x4e46db),console[_0x325c72(0x200)](_0x325c72(0x1c1)),0x1;_0x2c5246=_0x122940;}if(_0x2c5246[_0x325c72(0x1cc)]===0x0)return console[_0x325c72(0x200)](_0x325c72(0x1a7)),0x0;const _0x5cf770=[];for(const _0xc3168 of _0x2c5246){const _0x14db4f=await withSpinner('Fetching\x20'+_0xc3168['journeyBundleName']+_0x325c72(0x1fb),()=>_0x3b8f7c[_0x325c72(0x21d)]['getJourney'](_0xc3168['id']),{'verbose':_0x5b77f7[_0x325c72(0x1c7)]}),_0x582732=_0x14db4f['data'],_0x208815=_0x582732[_0x325c72(0x1ed)]?.['audienceId'],_0xf44e13={'resolveSegment':async _0x1583aa=>{const _0x26f9b2=_0x325c72;if(!_0x208815)return{'name':_0x1583aa,'isJourneyLocal':![]};try{const _0x4c5aaf=await _0x3b8f7c['segment'][_0x26f9b2(0x20c)](_0x208815,_0x1583aa),_0x5be2d6=_0x4c5aaf['kind']===SEGMENT_KIND_JOURNEY;let _0x18df39;return _0x5be2d6&&_0x4c5aaf['rule']&&(_0x18df39={'description':_0x4c5aaf['description'],'rule':apiRuleToYaml(_0x4c5aaf[_0x26f9b2(0x1fe)])}),{'name':_0x4c5aaf['name'],'isJourneyLocal':_0x5be2d6,'definition':_0x18df39};}catch(_0x590858){return _0x5b77f7[_0x26f9b2(0x1c7)]&&console[_0x26f9b2(0x200)](_0x26f9b2(0x211)+_0x1583aa+':\x20'+_0x590858[_0x26f9b2(0x201)]),{'name':_0x1583aa,'isJourneyLocal':![]};}}},_0x50bac7=await apiToYamlAsync(_0x582732,_0xf44e13),_0x15f157=toYamlString(_0x50bac7),_0x539c84=sanitizeFileName(_0xc3168[_0x325c72(0x1ce)]),_0x4b280a=a25_0x8e576b[_0x325c72(0x1ae)](_0x108278,_0x539c84+_0x325c72(0x19e)),_0x51b70e=a25_0x8e576b[_0x325c72(0x1f3)](process['cwd'](),_0x4b280a);if(existsSync(_0x4b280a)){const _0xc79a1f=readFileSync(_0x4b280a,_0x325c72(0x1cf)),_0x454d41=generateDiff(_0xc79a1f,_0x15f157),_0x4dbb34=hasChanges(_0x454d41);_0x5cf770['push']({'relativePath':_0x51b70e,'absolutePath':_0x4b280a,'content':_0x15f157,'isNew':![],'hasChanges':_0x4dbb34,'diff':_0x4dbb34?formatDiffWithColors(_0x454d41):undefined});}else _0x5cf770[_0x325c72(0x1ab)]({'relativePath':_0x51b70e,'absolutePath':_0x4b280a,'content':_0x15f157,'isNew':!![],'hasChanges':![]});}const _0xa7dad6=_0x5cf770[_0x325c72(0x1bd)](_0x2fef8d=>_0x2fef8d[_0x325c72(0x1f4)]),_0x5883bb=_0x5cf770[_0x325c72(0x1bd)](_0x4db112=>!_0x4db112[_0x325c72(0x1f4)]&&_0x4db112[_0x325c72(0x210)]),_0x59abd8=_0x5cf770[_0x325c72(0x1bd)](_0x52e407=>!_0x52e407[_0x325c72(0x1f4)]&&!_0x52e407['hasChanges']);console['error'](_0x325c72(0x220)),console[_0x325c72(0x200)]('\x20\x20'+a25_0x13c49d[_0x325c72(0x21b)](_0x2c5246[_0x325c72(0x1cc)]+_0x325c72(0x190))),console['error']('\x20\x20'+a25_0x13c49d[_0x325c72(0x1dd)]('+\x20'+_0xa7dad6['length']+_0x325c72(0x1d0))),console[_0x325c72(0x200)]('\x20\x20'+a25_0x13c49d[_0x325c72(0x213)]('~\x20'+_0x5883bb[_0x325c72(0x1cc)]+'\x20changed\x20files')),console[_0x325c72(0x200)]('\x20\x20'+a25_0x13c49d['dim']('=\x20'+_0x59abd8[_0x325c72(0x1cc)]+'\x20unchanged\x20files')),console[_0x325c72(0x200)](_0x325c72(0x1a0)+a25_0x13c49d[_0x325c72(0x21b)](_0x108278)+'\x0a');if(_0x5883bb['length']>0x0)for(const _0x32afc5 of _0x5883bb){console[_0x325c72(0x200)]('\x0aChanges\x20to\x20\x27'+_0x32afc5[_0x325c72(0x1f6)]+'\x27:'),console['error']('─'[_0x325c72(0x1a4)](0x3c)),console['error'](_0x32afc5[_0x325c72(0x196)]),console['error']('─'[_0x325c72(0x1a4)](0x3c));}if(_0xb06612['dryRun'])return console[_0x325c72(0x200)](a25_0x13c49d['yellow'](_0x325c72(0x19c))),0x0;if(_0xa7dad6[_0x325c72(0x1cc)]===0x0&&_0x5883bb['length']===0x0)return console[_0x325c72(0x200)](a25_0x13c49d['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),0x0;if(!_0xb06612[_0x325c72(0x1ef)]&&(_0xa7dad6[_0x325c72(0x1cc)]>0x0||_0x5883bb[_0x325c72(0x1cc)]>0x0)){const _0x4e782a=await confirmKey(_0x325c72(0x1e6)+(_0xa7dad6[_0x325c72(0x1cc)]+_0x5883bb['length'])+'\x20files?');if(!_0x4e782a)return console[_0x325c72(0x200)](_0x325c72(0x1bb)),0x1;}!existsSync(_0x108278)&&mkdirSync(_0x108278,{'recursive':!![]});for(const _0x5882bc of _0x5cf770){(_0x5882bc[_0x325c72(0x1f4)]||_0x5882bc[_0x325c72(0x210)])&&writeFileSync(_0x5882bc[_0x325c72(0x1c6)],_0x5882bc[_0x325c72(0x219)],_0x325c72(0x1cf));}return console[_0x325c72(0x200)](a25_0x13c49d[_0x325c72(0x1dd)](_0x325c72(0x198)+(_0xa7dad6[_0x325c72(0x1cc)]+_0x5883bb[_0x325c72(0x1cc)])+'\x20journey\x20files\x20to\x20'+_0x108278)),0x0;}}
1
+ const a25_0x29815f=a25_0x5e0b;(function(_0x7c520a,_0x230db0){const _0x32abd5=a25_0x5e0b,_0x39be2e=_0x7c520a();while(!![]){try{const _0x409e49=-parseInt(_0x32abd5(0x71))/0x1+-parseInt(_0x32abd5(0xc3))/0x2*(parseInt(_0x32abd5(0xd8))/0x3)+-parseInt(_0x32abd5(0x7a))/0x4*(parseInt(_0x32abd5(0xc7))/0x5)+-parseInt(_0x32abd5(0xda))/0x6+-parseInt(_0x32abd5(0xf2))/0x7*(-parseInt(_0x32abd5(0xe3))/0x8)+-parseInt(_0x32abd5(0xdb))/0x9+parseInt(_0x32abd5(0x9f))/0xa*(parseInt(_0x32abd5(0x8a))/0xb);if(_0x409e49===_0x230db0)break;else _0x39be2e['push'](_0x39be2e['shift']());}catch(_0x52fbd2){_0x39be2e['push'](_0x39be2e['shift']());}}}(a25_0x513f,0x40f3d));import a25_0x3e565e from'chalk';import a25_0x720d5a 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_0x5e0b(_0x31301e,_0xd2dc92){_0x31301e=_0x31301e-0x6e;const _0x513f28=a25_0x513f();let _0x5e0b53=_0x513f28[_0x31301e];return _0x5e0b53;}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(_0x400df4){const _0x1d6f5a=a25_0x5e0b;switch(_0x400df4){case _0x1d6f5a(0xfb):return a25_0x3e565e[_0x1d6f5a(0xcb)](_0x400df4);case _0x1d6f5a(0x92):return a25_0x3e565e[_0x1d6f5a(0xa8)](_0x400df4);case'archived':return a25_0x3e565e[_0x1d6f5a(0x9c)](_0x400df4);default:return _0x400df4;}}function formatJourneyItem(_0x65df57,_0x545828=''){const _0x2608b8=a25_0x5e0b,_0x39b35f=formatJourneyState(_0x65df57[_0x2608b8(0xcd)]),_0x1ffed9=_0x65df57['paused']?a25_0x3e565e[_0x2608b8(0xf4)](_0x2608b8(0xc2)):'';return _0x545828+'🗺️\x20'+_0x65df57[_0x2608b8(0x8e)]+'\x20('+_0x39b35f+')'+_0x1ffed9;}function escapeRegex(_0x2a87d5){const _0x495909=a25_0x5e0b;return _0x2a87d5[_0x495909(0x85)](/[.*+?^${}()|[\]\\]/g,_0x495909(0x7c));}function globToRegex(_0x2967ba){const _0x42c2ea=a25_0x5e0b,_0x5a1456=_0x2967ba[_0x42c2ea(0xf6)]('*')[_0x42c2ea(0xf9)](escapeRegex);return new RegExp(_0x5a1456[_0x42c2ea(0x83)]('.*'),'i');}function resolveJourneyTarget(_0x7e189a,_0x25428b,_0xc95f95){const _0x110dd9=a25_0x5e0b;if(isYamlFilePath(_0x7e189a))try{const _0x131d6f=resolveYamlFilePath(_0x7e189a);return _0xc95f95&&(console[_0x110dd9(0xab)](_0x110dd9(0xb7)+_0x7e189a),console[_0x110dd9(0xab)](_0x110dd9(0x100)+_0x131d6f[_0x110dd9(0xc9)]),console[_0x110dd9(0xab)](_0x110dd9(0x7b)+_0x131d6f[_0x110dd9(0xc6)]),console['error'](_0x110dd9(0xe6)+(_0x131d6f['folderPath']||_0x110dd9(0xee)))),{'journeyName':_0x131d6f[_0x110dd9(0xc6)],'parentSegment':_0x131d6f['parentSegment'],'resolved':_0x131d6f};}catch(_0x10a1ce){throw new SDKError(ErrorCode[_0x110dd9(0xb3)],_0x110dd9(0xa3)+_0x10a1ce[_0x110dd9(0xc8)]);}if(!_0x25428b)throw new SDKError(ErrorCode[_0x110dd9(0xb3)],_0x110dd9(0xc5));return{'journeyName':_0x7e189a,'parentSegment':_0x25428b};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x29815f(0xff);[a25_0x29815f(0x76)]=a25_0x29815f(0xec);async[a25_0x29815f(0xd4)](_0x545d5a){const _0x4728cf=a25_0x29815f,{options:_0x34a621,args:_0x4aa698,tdx:_0xf703ec}=_0x545d5a,_0x12b0c6=_0x4aa698[0x0],_0x473333=_0x34a621['parentSegment'];if(!_0x473333)return console[_0x4728cf(0xab)](_0x4728cf(0x103)),console['error']('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x2e82af=await withSpinner(_0x4728cf(0x7f),()=>_0xf703ec[_0x4728cf(0x72)][_0x4728cf(0x8b)](_0x473333),{'verbose':_0x34a621['verbose']}),_0x15ca74=_0x2e82af[_0x4728cf(0xe7)];_0x34a621['verbose']&&(console[_0x4728cf(0xab)](_0x4728cf(0x8c)+_0x473333+_0x4728cf(0xb6)+_0x15ca74+')'),_0x12b0c6&&console[_0x4728cf(0xab)]('Pattern:\x20'+_0x12b0c6));const [_0x1bcb48,_0x597764,_0x96cff0]=await Promise['all']([withSpinner('Fetching\x20parent\x20segment...',()=>_0xf703ec[_0x4728cf(0x72)]['getParentFull'](_0x15ca74),{'verbose':_0x34a621['verbose']}),withSpinner(_0x4728cf(0xd9),()=>_0xf703ec['segment']['listFolders'](_0x15ca74),{'verbose':_0x34a621[_0x4728cf(0x95)]}),withSpinner(_0x4728cf(0xfa),()=>_0xf703ec[_0x4728cf(0x73)][_0x4728cf(0xd7)](_0x15ca74),{'verbose':_0x34a621[_0x4728cf(0x95)]})]),_0x3aa19e=_0x1bcb48[_0x4728cf(0xe7)],_0x473643=_0x597764['data'];let _0x22f777=_0x96cff0['data'];const _0x4bb5e1=_0x3aa19e[_0x4728cf(0x89)],_0x2a6e04=new Map();for(const _0x49d0e3 of _0x473643){_0x2a6e04[_0x4728cf(0xac)](_0x49d0e3['id'],_0x49d0e3[_0x4728cf(0xba)]);}if(_0x12b0c6){const _0x2b77e6=globToRegex(_0x12b0c6);_0x22f777=_0x22f777['filter'](_0x3c24b5=>_0x2b77e6['test'](_0x3c24b5[_0x4728cf(0x8e)]));}console['error']('✔\x20Found\x20'+_0x22f777['length']+'\x20journey'+(_0x22f777[_0x4728cf(0xbb)]!==0x1?'s':''));if(_0x34a621['format']===_0x4728cf(0xe9))await handleSDKOutput(_0x22f777,_0x34a621);else{if(_0x34a621['format']===_0x4728cf(0x84))await handleSDKOutput(_0x22f777,_0x34a621);else{console[_0x4728cf(0x88)]('['+_0x473333+']');const _0x1f550c=new Map(),_0x4f3fd8=[];for(const _0x4dcb88 of _0x22f777){if(!_0x4dcb88['folderId']||_0x4dcb88['folderId']===_0x4bb5e1)_0x4f3fd8['push'](_0x4dcb88);else{const _0xd7ccf6=_0x1f550c[_0x4728cf(0xce)](_0x4dcb88[_0x4728cf(0xfe)])||[];_0xd7ccf6['push'](_0x4dcb88),_0x1f550c[_0x4728cf(0xac)](_0x4dcb88[_0x4728cf(0xfe)],_0xd7ccf6);}}for(const _0x484eff of _0x4f3fd8){console[_0x4728cf(0x88)](formatJourneyItem(_0x484eff));}for(const [_0x471bfb,_0x218851]of _0x1f550c){const _0x1ba974=_0x2a6e04[_0x4728cf(0xce)](_0x471bfb)||_0x471bfb;console[_0x4728cf(0x88)](_0x4728cf(0xc4)+_0x1ba974);for(const _0x1e8385 of _0x218851){console['log'](formatJourneyItem(_0x1e8385,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x29815f(0xba)]='journey:view';[a25_0x29815f(0x76)]=a25_0x29815f(0xbf);async['execute'](_0x206488){const _0x2517d6=a25_0x29815f,{options:_0x29ee3b,args:_0x21b823,tdx:_0x8db2e0}=_0x206488,_0x2953ad=_0x21b823[0x0];if(!_0x2953ad)return console[_0x2517d6(0xab)](_0x2517d6(0x97)),console[_0x2517d6(0xab)](_0x2517d6(0xa7)),0x1;_0x29ee3b[_0x2517d6(0x95)]&&console[_0x2517d6(0xab)](_0x2517d6(0x6e)+_0x2953ad);const _0x2790ee=resolveJourneyTarget(_0x2953ad,_0x29ee3b[_0x2517d6(0xc9)],_0x29ee3b[_0x2517d6(0x95)]),_0x293fca=await withSpinner(_0x2517d6(0x7f),()=>_0x8db2e0[_0x2517d6(0x72)][_0x2517d6(0x8b)](_0x2790ee[_0x2517d6(0xc9)]),{'verbose':_0x29ee3b[_0x2517d6(0x95)]}),_0x20e1e7=_0x293fca['data'],_0x409907=await withSpinner(_0x2517d6(0xfc),()=>_0x8db2e0[_0x2517d6(0x73)][_0x2517d6(0xaf)](_0x20e1e7,_0x2790ee[_0x2517d6(0x82)]),{'verbose':_0x29ee3b[_0x2517d6(0x95)]}),_0x1b083f=_0x409907[_0x2517d6(0xe7)],_0x35b506=await withSpinner(_0x2517d6(0xa6),()=>_0x8db2e0[_0x2517d6(0x73)]['getJourney'](_0x1b083f),{'verbose':_0x29ee3b[_0x2517d6(0x95)]}),_0x307dd3=_0x35b506[_0x2517d6(0xe7)],_0x5a5979=_0x29ee3b['includeStats'];let _0x4d0654;if(_0x5a5979)try{const _0x2cab2a=await withSpinner(_0x2517d6(0x93),()=>_0x8db2e0['journey'][_0x2517d6(0xb2)](_0x1b083f),{'verbose':_0x29ee3b[_0x2517d6(0x95)]});_0x4d0654=_0x2cab2a['data'];}catch{_0x29ee3b[_0x2517d6(0x95)]&&console[_0x2517d6(0xab)](_0x2517d6(0xd0));}const _0xb94414={'id':_0x307dd3['id'],'name':_0x307dd3[_0x2517d6(0x81)]['name'],'description':_0x307dd3[_0x2517d6(0x81)][_0x2517d6(0x76)],'state':_0x307dd3[_0x2517d6(0x81)][_0x2517d6(0xcd)],'paused':_0x307dd3[_0x2517d6(0x81)]['paused'],'reentry_mode':_0x307dd3[_0x2517d6(0x81)]['reentryMode'],'stages':_0x307dd3[_0x2517d6(0x81)][_0x2517d6(0xa9)]?.[_0x2517d6(0xbb)]||0x0,..._0x307dd3[_0x2517d6(0x81)]['goal']&&{'goal':_0x307dd3['attributes'][_0x2517d6(0x9d)]['name']},..._0x4d0654&&{'statistics':{'total_entered':_0x4d0654[_0x2517d6(0x87)],'goal_achieved':_0x4d0654[_0x2517d6(0x8d)],'goal_rate':_0x4d0654['goalRate'],'stages':_0x4d0654[_0x2517d6(0xed)]}}};return await handleSingleObjectOutput(_0xb94414,_0x29ee3b),0x0;}}export class JourneyStatsCommand extends BaseCommand{['name']='journey:stats';['description']=a25_0x29815f(0x8f);async[a25_0x29815f(0xd4)](_0x46e484){const _0x115020=a25_0x29815f,{options:_0x2de9df,args:_0xe2842e,tdx:_0x32dce2}=_0x46e484,_0xdfc9c5=_0xe2842e[0x0];if(!_0xdfc9c5)return console[_0x115020(0xab)](_0x115020(0x97)),console[_0x115020(0xab)](_0x115020(0xb4)),0x1;_0x2de9df['verbose']&&console[_0x115020(0xab)]('Input:\x20'+_0xdfc9c5);const _0x15be20=resolveJourneyTarget(_0xdfc9c5,_0x2de9df['parentSegment'],_0x2de9df['verbose']),_0x246ae0=await withSpinner(_0x115020(0x7f),()=>_0x32dce2[_0x115020(0x72)]['resolveParentId'](_0x15be20[_0x115020(0xc9)]),{'verbose':_0x2de9df[_0x115020(0x95)]}),_0x52694e=_0x246ae0[_0x115020(0xe7)],_0x4102d1=await withSpinner(_0x115020(0xfc),()=>_0x32dce2[_0x115020(0x73)]['resolveJourneyId'](_0x52694e,_0x15be20[_0x115020(0x82)]),{'verbose':_0x2de9df[_0x115020(0x95)]}),_0x5e9fa4=_0x4102d1[_0x115020(0xe7)],_0x4bc8e1=await withSpinner(_0x115020(0x93),()=>_0x32dce2[_0x115020(0x73)][_0x115020(0xb2)](_0x5e9fa4),{'verbose':_0x2de9df['verbose']}),_0x49a2b2=_0x4bc8e1['data'];if(!_0x49a2b2||_0x49a2b2[_0x115020(0x98)]===null)return console['error'](_0x115020(0xe5)+_0x15be20[_0x115020(0x82)]),console['error']('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x7a6652={'journey_id':_0x49a2b2[_0x115020(0x98)],'total_entered':_0x49a2b2[_0x115020(0x87)],'goal_achieved':_0x49a2b2[_0x115020(0x8d)],'goal_rate':_0x49a2b2[_0x115020(0xdc)],'stages':_0x49a2b2[_0x115020(0xed)]?.['map'](_0x5340ba=>({'name':_0x5340ba[_0x115020(0x102)],'population':_0x5340ba[_0x115020(0xe2)],'entered':_0x5340ba[_0x115020(0x99)],'exited':_0x5340ba[_0x115020(0xb1)],'conversion_rate':_0x5340ba[_0x115020(0x7d)]}))},_0x56acd0=_0x2de9df[_0x115020(0xcc)];if(_0x56acd0&&_0x49a2b2[_0x115020(0xed)]){const _0x47f707=_0x49a2b2[_0x115020(0xed)][_0x115020(0x80)](_0x455279=>_0x455279['stageName'][_0x115020(0xbc)]()===_0x56acd0[_0x115020(0xbc)]());if(_0x47f707)return await handleSingleObjectOutput({'stage_name':_0x47f707[_0x115020(0x102)],'population':_0x47f707[_0x115020(0xe2)],'entered':_0x47f707[_0x115020(0x99)],'exited':_0x47f707[_0x115020(0xb1)],'conversion_rate':_0x47f707[_0x115020(0x7d)]},_0x2de9df),0x0;console['error'](_0x115020(0xd2)+_0x56acd0+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x7a6652,_0x2de9df),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x29815f(0xba)]=a25_0x29815f(0xbd);[a25_0x29815f(0x76)]=a25_0x29815f(0xdf);async[a25_0x29815f(0xd4)](_0x22bec4){const _0x3ebfef=a25_0x29815f,{options:_0x326ff6,args:_0xbb1971,tdx:_0x5baf6f}=_0x22bec4,_0x2d9496=_0xbb1971[0x0];if(!_0x2d9496)return console[_0x3ebfef(0xab)](_0x3ebfef(0x97)),console[_0x3ebfef(0xab)](_0x3ebfef(0xe0)),0x1;_0x326ff6[_0x3ebfef(0x95)]&&console[_0x3ebfef(0xab)](_0x3ebfef(0x6e)+_0x2d9496);const _0x3a7ed8=resolveJourneyTarget(_0x2d9496,_0x326ff6[_0x3ebfef(0xc9)],_0x326ff6[_0x3ebfef(0x95)]),_0xb20f35=await withSpinner(_0x3ebfef(0x7f),()=>_0x5baf6f['segment'][_0x3ebfef(0x8b)](_0x3a7ed8[_0x3ebfef(0xc9)]),{'verbose':_0x326ff6['verbose']}),_0x41c0d3=_0xb20f35[_0x3ebfef(0xe7)],_0x1b2ad7=await withSpinner('Resolving\x20journey...',()=>_0x5baf6f[_0x3ebfef(0x73)][_0x3ebfef(0xaf)](_0x41c0d3,_0x3a7ed8['journeyName']),{'verbose':_0x326ff6[_0x3ebfef(0x95)]}),_0x3e143f=_0x1b2ad7[_0x3ebfef(0xe7)];if(!_0x326ff6[_0x3ebfef(0xcf)]){const _0x399f59=await confirm(_0x3ebfef(0x9a)+_0x3a7ed8[_0x3ebfef(0x82)]+'\x22?');if(!_0x399f59)return console[_0x3ebfef(0xab)](_0x3ebfef(0x78)),0x0;}const _0x4403aa=await withSpinner(_0x3ebfef(0x75),()=>_0x5baf6f['journey'][_0x3ebfef(0xf1)](_0x3e143f),{'verbose':_0x326ff6[_0x3ebfef(0x95)]}),_0x4e0718=_0x4403aa['data'];return console['error'](_0x3ebfef(0xf8)+_0x4e0718[_0x3ebfef(0x81)][_0x3ebfef(0xba)]+_0x3ebfef(0xd5)),0x0;}}function a25_0x513f(){const _0x104418=['set','\x22\x20resumed','\x20unchanged\x20files','resolveJourneyId','\x20\x20Target:\x20','exited','getStatistics','INVALID_ARGUMENT','Usage:\x20journey\x20stats\x20<name-or-path>','Found\x20existing\x20tdx.json\x20at:\x20','\x20(ID:\x20','Resolved\x20YAML\x20file:\x20','cyan','journey:resume','name','length','toLowerCase','journey:pause','✔\x20Pulled\x20','Show\x20journey\x20details','\x20journey\x20files\x20to\x20','audienceId','\x20(paused)','359702bkbvLg','📁\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','segmentName','83795DfFBPD','message','parentSegment','isNew','green','stage','state','get','yes','\x20\x20Statistics\x20not\x20available','filter','Warning:\x20Stage\x20\x22','utf-8','execute','\x22\x20paused','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','listJourneysFromParentSegment','3bMYstm','Fetching\x20folders...','468192QBAZRK','3169872qOgoio','goalRate','Parent\x20segment\x20context\x20not\x20set.\x0a','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Pause\x20a\x20running\x20journey','Usage:\x20journey\x20pause\x20<name-or-path>','Usage:\x20journey\x20resume\x20<name-or-path>','population','1903016dcGxLr','Resuming\x20journey...','No\x20statistics\x20available\x20for\x20journey:\x20','\x20\x20Folder\x20path:\x20','data','relativePath','table','\x20changed\x20files','push','List\x20journeys\x20in\x20current\x20context','stages','(root)','✔\x20All\x20files\x20are\x20up\x20to\x20date','dryRun','pause','7WwhbTd','Aborted.','yellow','Fetching\x20','split','getJourney','✔\x20Journey\x20\x22','map','Listing\x20journeys...','launched','Resolving\x20journey...','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)','folderId','journey:list','\x20\x20Parent\x20segment:\x20','hasChanges','stageName','Error:\x20Parent\x20segment\x20context\x20required','Input:\x20','dirname','\x20journeys','479867vvCDUg','segment','journey','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Pausing\x20journey...','description','\x0aPull\x20summary:','Cancelled','resume','116NdOXYk','\x20\x20Name:\x20','\x5c$&','conversionRate','rule','Resolving\x20parent\x20segment...','find','attributes','journeyName','join','json','replace','relative','totalEntered','log','rootFolderId','1037971QVkWnM','resolveParentId','Parent\x20segment:\x20','totalGoalAchieved','journeyBundleName','Show\x20journey\x20statistics','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','diff','draft','Getting\x20journey\x20statistics...','repeat','verbose','No\x20journeys\x20found','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','journeyId','entered','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','cwd','dim','goal','Resume\x20a\x20paused\x20journey','170MdKhER','kind','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Error:\x20Journey\x20not\x20found:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Write\x20','\x20new\x20files','Getting\x20journey\x20details...','Usage:\x20journey\x20view\x20<name-or-path>','gray','journeyStages','content','error'];a25_0x513f=function(){return _0x104418;};return a25_0x513f();}export class JourneyResumeCommand extends BaseCommand{['name']=a25_0x29815f(0xb9);[a25_0x29815f(0x76)]=a25_0x29815f(0x9e);async['execute'](_0x28278d){const _0x170fa8=a25_0x29815f,{options:_0x108338,args:_0xda7ebd,tdx:_0x4a5540}=_0x28278d,_0x1578ef=_0xda7ebd[0x0];if(!_0x1578ef)return console[_0x170fa8(0xab)](_0x170fa8(0x97)),console['error'](_0x170fa8(0xe1)),0x1;_0x108338[_0x170fa8(0x95)]&&console[_0x170fa8(0xab)]('Input:\x20'+_0x1578ef);const _0x256d09=resolveJourneyTarget(_0x1578ef,_0x108338[_0x170fa8(0xc9)],_0x108338[_0x170fa8(0x95)]),_0x5e87b9=await withSpinner(_0x170fa8(0x7f),()=>_0x4a5540[_0x170fa8(0x72)][_0x170fa8(0x8b)](_0x256d09['parentSegment']),{'verbose':_0x108338['verbose']}),_0x2ff8d2=_0x5e87b9['data'],_0x115fd1=await withSpinner(_0x170fa8(0xfc),()=>_0x4a5540[_0x170fa8(0x73)][_0x170fa8(0xaf)](_0x2ff8d2,_0x256d09[_0x170fa8(0x82)]),{'verbose':_0x108338[_0x170fa8(0x95)]}),_0x21671a=_0x115fd1[_0x170fa8(0xe7)];if(!_0x108338['yes']){const _0x56592b=await confirm(_0x170fa8(0x90)+_0x256d09[_0x170fa8(0x82)]+'\x22?');if(!_0x56592b)return console[_0x170fa8(0xab)](_0x170fa8(0x78)),0x0;}const _0x2d148e=await withSpinner(_0x170fa8(0xe4),()=>_0x4a5540[_0x170fa8(0x73)][_0x170fa8(0x79)](_0x21671a),{'verbose':_0x108338['verbose']}),_0x4d4b6b=_0x2d148e['data'];return console[_0x170fa8(0xab)]('✔\x20Journey\x20\x22'+_0x4d4b6b[_0x170fa8(0x81)]['name']+_0x170fa8(0xad)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']='journey:pull';[a25_0x29815f(0x76)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a25_0x29815f(0xd4)](_0x564f36){const _0x147d50=a25_0x29815f,{options:_0x578e90,args:_0x2e25ce,tdx:_0x47a6b0}=_0x564f36,_0xf9d98c=_0x578e90,_0x59741e=_0x2e25ce[0x0],_0xe908a0=findTdxConfigPath();let _0x3af4d8,_0x3241bc;if(_0xe908a0){const _0x127dfb=loadTdxConfig(_0xe908a0);_0x3af4d8=_0x127dfb['parent_segment'],_0x3241bc=a25_0x720d5a[_0x147d50(0x83)](a25_0x720d5a[_0x147d50(0x6f)](_0xe908a0),'journeys'),_0xf9d98c[_0x147d50(0x95)]&&(console['error'](_0x147d50(0xb5)+_0xe908a0),console[_0x147d50(0xab)]('Using\x20parent\x20segment:\x20'+_0x3af4d8));}else{_0x3af4d8=_0x578e90[_0x147d50(0xc9)];if(!_0x3af4d8)return console['error'](a25_0x3e565e[_0x147d50(0xf4)](_0x147d50(0xdd))),console['error'](_0x147d50(0xfd)),console[_0x147d50(0xab)](_0x147d50(0xd6)),console[_0x147d50(0xab)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure'),0x1;_0x3241bc=a25_0x720d5a[_0x147d50(0x83)](getSegmentRootDir(sanitizeFileName(_0x3af4d8)),'journeys');}const _0x3819f0=await withSpinner(_0x147d50(0x7f),()=>_0x47a6b0[_0x147d50(0x72)]['resolveParentId'](_0x3af4d8),{'verbose':_0x578e90[_0x147d50(0x95)]}),_0x5a7b0e=_0x3819f0[_0x147d50(0xe7)],_0x16d7b9=await withSpinner(_0x147d50(0xfa),()=>_0x47a6b0[_0x147d50(0x73)][_0x147d50(0xd7)](_0x5a7b0e),{'verbose':_0x578e90[_0x147d50(0x95)]});let _0xd5f211=_0x16d7b9[_0x147d50(0xe7)];if(_0x59741e){const _0x551e52=_0xd5f211[_0x147d50(0xd1)](_0x4f9617=>_0x4f9617[_0x147d50(0x8e)]['toLowerCase']()===_0x59741e['toLowerCase']());if(_0x551e52[_0x147d50(0xbb)]===0x0)return console[_0x147d50(0xab)](_0x147d50(0xa2)+_0x59741e),console[_0x147d50(0xab)](_0x147d50(0x74)),0x1;_0xd5f211=_0x551e52;}if(_0xd5f211['length']===0x0)return console[_0x147d50(0xab)](_0x147d50(0x96)),0x0;const _0x6de1fe=[];for(const _0xd2186f of _0xd5f211){const _0x17cd12=await withSpinner(_0x147d50(0xf5)+_0xd2186f[_0x147d50(0x8e)]+'...',()=>_0x47a6b0['journey'][_0x147d50(0xf7)](_0xd2186f['id']),{'verbose':_0x578e90[_0x147d50(0x95)]}),_0x31c7f0=_0x17cd12[_0x147d50(0xe7)],_0x33dae4=_0x31c7f0[_0x147d50(0x81)]?.[_0x147d50(0xc1)],_0xc107f8={'resolveSegment':async _0x191c31=>{const _0x107308=_0x147d50;if(!_0x33dae4)return{'name':_0x191c31,'isJourneyLocal':![]};try{const _0x40d7b1=await _0x47a6b0['segment']['getSegment'](_0x33dae4,_0x191c31),_0x121ed2=_0x40d7b1[_0x107308(0xa0)]===SEGMENT_KIND_JOURNEY;let _0x1889a8;return _0x121ed2&&_0x40d7b1[_0x107308(0x7e)]&&(_0x1889a8={'description':_0x40d7b1[_0x107308(0x76)],'rule':apiRuleToYaml(_0x40d7b1[_0x107308(0x7e)])}),{'name':_0x40d7b1[_0x107308(0xba)],'isJourneyLocal':_0x121ed2,'definition':_0x1889a8};}catch(_0x5af7d3){return _0x578e90['verbose']&&console[_0x107308(0xab)](_0x107308(0xa1)+_0x191c31+':\x20'+_0x5af7d3[_0x107308(0xc8)]),{'name':_0x191c31,'isJourneyLocal':![]};}}},_0x3fda34=await apiToYamlAsync(_0x31c7f0,_0xc107f8),_0x11cd7e=toYamlString(_0x3fda34),_0x1e08b7=sanitizeFileName(_0xd2186f[_0x147d50(0x8e)]),_0x18eb0b=a25_0x720d5a[_0x147d50(0x83)](_0x3241bc,_0x1e08b7+'.yml'),_0x569ba2=a25_0x720d5a[_0x147d50(0x86)](process[_0x147d50(0x9b)](),_0x18eb0b);if(existsSync(_0x18eb0b)){const _0x24f95f=readFileSync(_0x18eb0b,_0x147d50(0xd3)),_0x119c51=generateDiff(_0x24f95f,_0x11cd7e),_0x1d4b71=hasChanges(_0x119c51);_0x6de1fe[_0x147d50(0xeb)]({'relativePath':_0x569ba2,'absolutePath':_0x18eb0b,'content':_0x11cd7e,'isNew':![],'hasChanges':_0x1d4b71,'diff':_0x1d4b71?formatDiffWithColors(_0x119c51):undefined});}else _0x6de1fe[_0x147d50(0xeb)]({'relativePath':_0x569ba2,'absolutePath':_0x18eb0b,'content':_0x11cd7e,'isNew':!![],'hasChanges':![]});}const _0x441ac9=_0x6de1fe[_0x147d50(0xd1)](_0x46eb6d=>_0x46eb6d['isNew']),_0x27870e=_0x6de1fe[_0x147d50(0xd1)](_0x274ad0=>!_0x274ad0[_0x147d50(0xca)]&&_0x274ad0['hasChanges']),_0x58a42e=_0x6de1fe['filter'](_0x44ef17=>!_0x44ef17['isNew']&&!_0x44ef17['hasChanges']);console['error'](_0x147d50(0x77)),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e[_0x147d50(0xb8)](_0xd5f211['length']+_0x147d50(0x70))),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e['green']('+\x20'+_0x441ac9[_0x147d50(0xbb)]+_0x147d50(0xa5))),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e['yellow']('~\x20'+_0x27870e[_0x147d50(0xbb)]+_0x147d50(0xea))),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e[_0x147d50(0x9c)]('=\x20'+_0x58a42e[_0x147d50(0xbb)]+_0x147d50(0xae))),console['error'](_0x147d50(0xb0)+a25_0x3e565e['cyan'](_0x3241bc)+'\x0a');if(_0x27870e[_0x147d50(0xbb)]>0x0)for(const _0x6056ef of _0x27870e){console[_0x147d50(0xab)]('\x0aChanges\x20to\x20\x27'+_0x6056ef[_0x147d50(0xe8)]+'\x27:'),console['error']('─'[_0x147d50(0x94)](0x3c)),console['error'](_0x6056ef[_0x147d50(0x91)]),console['error']('─'[_0x147d50(0x94)](0x3c));}if(_0xf9d98c[_0x147d50(0xf0)])return console['error'](a25_0x3e565e[_0x147d50(0xf4)](_0x147d50(0xde))),0x0;if(_0x441ac9[_0x147d50(0xbb)]===0x0&&_0x27870e[_0x147d50(0xbb)]===0x0)return console['error'](a25_0x3e565e['green'](_0x147d50(0xef))),0x0;if(!_0xf9d98c['yes']&&(_0x441ac9['length']>0x0||_0x27870e[_0x147d50(0xbb)]>0x0)){const _0x4f895f=await confirmKey(_0x147d50(0xa4)+(_0x441ac9['length']+_0x27870e[_0x147d50(0xbb)])+'\x20files?');if(!_0x4f895f)return console['error'](_0x147d50(0xf3)),0x1;}!existsSync(_0x3241bc)&&mkdirSync(_0x3241bc,{'recursive':!![]});for(const _0x1ee5b7 of _0x6de1fe){(_0x1ee5b7[_0x147d50(0xca)]||_0x1ee5b7[_0x147d50(0x101)])&&writeFileSync(_0x1ee5b7['absolutePath'],_0x1ee5b7[_0x147d50(0xaa)],_0x147d50(0xd3));}return console[_0x147d50(0xab)](a25_0x3e565e[_0x147d50(0xcb)](_0x147d50(0xbe)+(_0x441ac9[_0x147d50(0xbb)]+_0x27870e[_0x147d50(0xbb)])+_0x147d50(0xc0)+_0x3241bc)),0x0;}}
@@ -1 +1 @@
1
- const a26_0x9b0f89=a26_0x2097;(function(_0x274965,_0x244c03){const _0x5c8bc4=a26_0x2097,_0x5ed137=_0x274965();while(!![]){try{const _0x5a96ea=parseInt(_0x5c8bc4(0x1a4))/0x1*(-parseInt(_0x5c8bc4(0x22b))/0x2)+-parseInt(_0x5c8bc4(0x228))/0x3*(parseInt(_0x5c8bc4(0x246))/0x4)+parseInt(_0x5c8bc4(0x1e1))/0x5+-parseInt(_0x5c8bc4(0x1a6))/0x6+parseInt(_0x5c8bc4(0x1c0))/0x7*(-parseInt(_0x5c8bc4(0x1da))/0x8)+parseInt(_0x5c8bc4(0x1ab))/0x9*(-parseInt(_0x5c8bc4(0x1cf))/0xa)+parseInt(_0x5c8bc4(0x1fd))/0xb*(parseInt(_0x5c8bc4(0x234))/0xc);if(_0x5a96ea===_0x244c03)break;else _0x5ed137['push'](_0x5ed137['shift']());}catch(_0x3514a7){_0x5ed137['push'](_0x5ed137['shift']());}}}(a26_0x108b,0x97db6));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';function a26_0x108b(){const _0x1082dd=['attributes','Resolving\x20project\x20\x27','stack','[input]\x20\x20','input','getCurrentProject','[output]\x20','resolveProjectId','Fetching\x20chat\x20sessions...','Fetching\x20available\x20models...','integrations','Project\x20backed\x20up\x20to:\x20','projectId','floor','llm:agent:delete','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Fetching\x20agents...','Invalid\x20path\x20syntax:\x20','rmSync','Create\x20a\x20new\x20LLM\x20project','targetImageGenerator','llm','Updating\x20agent...','Project\x20created:\x20','No\x20messages\x20found\x20in\x20chat\x20history.','[image]\x20\x20','853558AiMbdF','Load\x20more...','655506mwfuBL','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','createdAt','join','tool_call','9INrCxd','(no\x20message)','tdx\x20llm\x20history','llm:agents','includes','magenta','sourceSite','setCurrentProject','json','llmProject','targetAgent','Error:\x20Backup\x20folder\x20path\x20is\x20required','\x20->\x20KB:','log','deleteAgent','all','targetWebSearchTool','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','lastConversationAt','\x20→\x20chat:\x20','get','96236NhHDmY','llm:agent:update','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','deleteProject','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','llm:models','model','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Validating\x20backup\x20from\x20\x27','...','[tool_call]','INVALID_ARGUMENT','List\x20agents\x20in\x20current\x20project','error','10997280dHIoEp','Analyzing\x20project\x20\x27','data','agent','map','set','agentId','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','createProject','prompt','Checking\x20for\x20existing\x20projects...','136pqDUHK','agents','Creating\x20agent\x20\x27','keys','maxToolIterations','stringify','\x20\x20Knowledge\x20Bases:\x20','6159300SHxymK','[error]\x20\x20','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Usage:\x20tdx\x20llm\x20use\x20<project-name>','getBackupMetadata','yes','List\x20available\x20LLM\x20models','history','bold','Resolving\x20agent\x20\x27','prompts','\x20--last','h\x20ago','Project\x20not\x20found:\x20','blue','Error:\x20Project\x20name\x20is\x20required','jsonl','restoreProject','\x20->\x20WebSearch:','Delete\x20an\x20LLM\x20project','just\x20now','Backup\x20cancelled.','output','Agent\x20deleted:\x20','Deleting\x20project\x20\x27','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','\x20\x20Cause:\x20','11JRQBZB','chats','llm:use','Error:\x20Agent\x20name\x20is\x20required','Use\x20format:\x20project-name/agent-name','split','filter','length','tool','tdx\x20chats','name','Deleting\x20agent...','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','\x20\x20Agents:\x20','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','chatId','execute','dryRun','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','projectName','Backing\x20up\x20project\x20\x27','substring','Getting\x20default\x20project...','exportedFrom','targetKnowledgeBase','cyan','image','llm:project:restore','Set\x20current\x20project\x20context','Fetching\x20agent...','push','(no\x20agent)','dim','projects','default','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','verbose','format','table','\x20\x20Integrations:\x20','select','List\x20all\x20LLM\x20projects','numeric','42hwSAWx','last','starterMessage','2tkqpMl','getOrCreateDefaultProject','systemPrompt','llm:history','\x27...','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','\x20->\x20Agent:','Fetching\x20chat\x20history\x20for\x20\x27','26466732uaVPqD','\x20-\x20','claude-4.5-haiku','Fetching\x20most\x20recent\x20chat...','Delete\x20an\x20agent','counts','string','getTime','Restore\x20cancelled.','existsSync','toLocaleDateString','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','__load_more__','[tool]\x20\x20\x20','content','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','updatedAt','d\x20ago','148332pNGNGC','toLowerCase','entries','find','createAgent','\x20\x20Prompts:\x20','cause','[unknown]','Show\x20agent\x20details','knowledgeBases','red','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','models','Creating\x20project\x20\x27','Agent\x20created:\x20','slice','description','limit','\x0aCancelled','Setting\x20project\x20context\x20to\x20\x27','\x27\x20already\x20exists.\x20Overwrite?','llm:agent:create','LLM_PROJECT_NOT_FOUND','Output\x20directory\x20\x27','Create\x20a\x20new\x20agent\x20in\x20current\x20project','message'];a26_0x108b=function(){return _0x1082dd;};return a26_0x108b();}import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0x39a6c7 from'node:fs';function handleSDKError(_0x498c3f,_0x275b4b){const _0x1907c8=a26_0x2097;if(_0x498c3f instanceof SDKError)console['error']('Error:\x20'+_0x498c3f[_0x1907c8(0x25f)]),_0x275b4b[_0x1907c8(0x221)]&&(_0x498c3f[_0x1907c8(0x24c)]&&console[_0x1907c8(0x1ce)](_0x1907c8(0x1fc)+_0x498c3f[_0x1907c8(0x24c)]),_0x498c3f[_0x1907c8(0x262)]&&(console[_0x1907c8(0x1ce)]('\x0aStack\x20trace:'),console[_0x1907c8(0x1ce)](_0x498c3f[_0x1907c8(0x262)])));else throw _0x498c3f;}function formatChatHistoryEntry(_0x427c29,_0x176349){const _0x32b1ff=a26_0x2097,_0x4e7d50=getChalk(_0x176349),_0x4131a4=_0x4e7d50['dim'](_0x427c29['at']);if(_0x32b1ff(0x264)in _0x427c29){const _0x3cc125=_0x4e7d50['cyan'](_0x32b1ff(0x263));return _0x4131a4+'\x20'+_0x3cc125+':\x20'+_0x427c29[_0x32b1ff(0x264)];}if(_0x32b1ff(0x242)in _0x427c29){const _0x562d65=_0x4e7d50['green']('[content]');return _0x4131a4+'\x20'+_0x562d65+':\x20'+_0x427c29[_0x32b1ff(0x242)];}if(_0x32b1ff(0x1aa)in _0x427c29){const _0x9c44e3=_0x4e7d50['yellow'](_0x32b1ff(0x1cb)),{functionName:_0x37e699,functionArguments:_0x3da80a,targetFunction:_0x2ba966}=_0x427c29[_0x32b1ff(0x1aa)];let _0x45b9ca=_0x4131a4+'\x20'+_0x9c44e3+':\x20'+_0x4e7d50[_0x32b1ff(0x1e9)](_0x37e699);if(_0x3da80a&&Object[_0x32b1ff(0x1dd)](_0x3da80a)[_0x32b1ff(0x204)]>0x0){const _0x332d54=Object[_0x32b1ff(0x248)](_0x3da80a)[_0x32b1ff(0x1d3)](([_0x40b45e,_0x3ea9ab])=>_0x40b45e+'='+JSON[_0x32b1ff(0x1df)](_0x3ea9ab))[_0x32b1ff(0x1a9)](',\x20');_0x45b9ca+='('+_0x332d54+')';}_0x2ba966&&(_0x45b9ca+=_0x4e7d50[_0x32b1ff(0x21d)]('\x20['+_0x2ba966+']'));let _0x3b23db='';if(_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x215)])_0x3b23db=_0x32b1ff(0x1b7)+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x215)]['name'];else{if(_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1b5)])_0x3b23db=_0x32b1ff(0x232)+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1b5)][_0x32b1ff(0x207)];else{if(_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1bb)])_0x3b23db=_0x32b1ff(0x1f3)+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1bb)][_0x32b1ff(0x207)];else _0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x19e)]&&(_0x3b23db='\x20->\x20ImageGen:'+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x19e)][_0x32b1ff(0x207)]);}}return _0x45b9ca+_0x3b23db;}if(_0x32b1ff(0x205)in _0x427c29){const _0x193002=_0x4e7d50[_0x32b1ff(0x1b0)](_0x32b1ff(0x241)),{functionName:_0x37b0fd,functionArguments:_0x5f4a64,content:_0x37e270,newChat:_0x131be9}=_0x427c29['tool'];let _0x2a5fc4=_0x4131a4+'\x20'+_0x193002+':\x20'+_0x4e7d50[_0x32b1ff(0x1e9)](_0x37b0fd);if(_0x5f4a64){const _0x498b20=typeof _0x5f4a64===_0x32b1ff(0x23a)?_0x5f4a64:JSON[_0x32b1ff(0x1df)](_0x5f4a64);_0x2a5fc4+='('+_0x498b20+')';}return _0x37e270&&(_0x2a5fc4+='\x0a'+_0x4e7d50[_0x32b1ff(0x21d)](_0x37e270)),_0x131be9&&(_0x2a5fc4+=_0x4e7d50['dim'](_0x32b1ff(0x1be)+_0x131be9['id'])),_0x2a5fc4;}if(_0x32b1ff(0x1f7)in _0x427c29){const _0x255968=_0x4e7d50[_0x32b1ff(0x1ef)](_0x32b1ff(0x266));return _0x4131a4+'\x20'+_0x255968+':\x20'+_0x427c29[_0x32b1ff(0x1f7)][_0x32b1ff(0x207)]+'\x20('+_0x427c29[_0x32b1ff(0x1f7)][_0x32b1ff(0x242)][_0x32b1ff(0x204)]+'\x20bytes)';}if(_0x32b1ff(0x217)in _0x427c29){const _0x45d1d6=_0x4e7d50[_0x32b1ff(0x1ef)](_0x32b1ff(0x1a3)),{width:_0x2f586f,height:_0x592af2,headerText:_0x37fbc3}=_0x427c29[_0x32b1ff(0x217)],_0x5ce4a0=_0x37fbc3?_0x32b1ff(0x235)+_0x37fbc3:'';return _0x4131a4+'\x20'+_0x45d1d6+':\x20'+_0x2f586f+'x'+_0x592af2+_0x5ce4a0;}if('error'in _0x427c29){const _0x591d22=_0x4e7d50[_0x32b1ff(0x250)](_0x32b1ff(0x1e2));return _0x4131a4+'\x20'+_0x591d22+':\x20'+_0x427c29[_0x32b1ff(0x1ce)];}return _0x4131a4+'\x20'+_0x4e7d50['dim'](_0x32b1ff(0x24d))+':\x20'+JSON[_0x32b1ff(0x1df)](_0x427c29);}async function executeChatHistoryCommand(_0x1d5ca9,_0x14d4f0){const _0x9b6853=a26_0x2097,{options:_0xcac2e4,args:_0x1e6e02,tdx:_0x4710a9}=_0x1d5ca9,_0x2780da=_0x1e6e02[0x0],_0x436541=_0xcac2e4,_0x37703e=_0x436541[_0x9b6853(0x229)];try{if(_0x37703e&&_0x2780da)return console['error'](_0x9b6853(0x1c2)),console['error']('Usage:\x20'+_0x14d4f0+_0x9b6853(0x1ec)),0x1;if(!_0x2780da&&!_0x37703e&&_0xcac2e4[_0x9b6853(0x222)]!==undefined){const _0x59ebd9=resolveLimit(_0xcac2e4[_0x9b6853(0x257)],DEFAULT_LLM_LIMIT),_0x4a87ba=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x4710a9[_0x9b6853(0x19f)][_0x9b6853(0x1fe)](_0x59ebd9),{'verbose':_0xcac2e4[_0x9b6853(0x221)]});return await handleSDKOutput(_0x4a87ba[_0x9b6853(0x1d1)],_0xcac2e4),0x0;}const _0x244128=await getChatIdOrSelect(_0x4710a9,_0xcac2e4,_0x37703e,_0x2780da);if(!_0x244128)return 0x0;return await displayChatHistory(_0x244128,_0x4710a9,_0xcac2e4),0x0;}catch(_0x11c85a){return handleSDKError(_0x11c85a,_0xcac2e4),0x1;}}async function displayChatHistory(_0x28599f,_0x2c43ab,_0x47a381){const _0x518968=a26_0x2097,_0xb8ef41=await withSpinner(_0x518968(0x233)+_0x28599f+_0x518968(0x22f),()=>_0x2c43ab[_0x518968(0x19f)][_0x518968(0x1e8)](_0x28599f),{'verbose':_0x47a381['verbose']}),_0x55b4f7=_0xb8ef41['data'][_0x518968(0x1d1)]??[];if(_0x55b4f7['length']===0x0){console['log'](_0x518968(0x1a2));return;}if(_0x47a381[_0x518968(0x222)]!==undefined)await handleSDKOutput(_0x55b4f7,_0x47a381);else{const _0x57c798=_0x55b4f7[_0x518968(0x1d3)](_0x565ff5=>formatChatHistoryEntry(_0x565ff5,_0x47a381)),_0x599d2c=_0x57c798[_0x518968(0x1a9)]('\x0a');await writeOutput(_0x599d2c,_0x47a381[_0x518968(0x1f7)],_0x518968(0x223));}}async function getChatIdOrSelect(_0x2bb937,_0x314834,_0x3555b2,_0x3ee70b){const _0x42b967=a26_0x2097;if(_0x3ee70b)return _0x3ee70b;if(_0x3555b2){const _0x336d85=await withSpinner(_0x42b967(0x237),()=>_0x2bb937[_0x42b967(0x19f)]['chats'](0x1),{'verbose':_0x314834[_0x42b967(0x221)]});if(_0x336d85[_0x42b967(0x1d1)][_0x42b967(0x204)]===0x0)return console[_0x42b967(0x1b8)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x336d85[_0x42b967(0x1d1)][0x0]['id'];}const _0xa86154=await selectChatInteractively(_0x2bb937,_0x314834);if(!_0xa86154)return console[_0x42b967(0x1b8)](_0x42b967(0x258)),undefined;return _0xa86154;}async function getProjectIdOrDefault(_0x4c9c37){const _0x3f8f59=a26_0x2097,{tdx:_0x528057,options:_0x1ea581}=_0x4c9c37,_0x5a27ce=_0x1ea581[_0x3f8f59(0x1b4)];if(_0x5a27ce){const _0x4715c9=await withSpinner(_0x3f8f59(0x261)+_0x5a27ce+'\x27...',()=>_0x528057['llm'][_0x3f8f59(0x267)](_0x5a27ce),{'verbose':_0x1ea581[_0x3f8f59(0x221)]});return _0x4715c9[_0x3f8f59(0x1d1)];}let _0x56a650=_0x528057[_0x3f8f59(0x19f)][_0x3f8f59(0x265)]();if(_0x56a650)return _0x56a650;const _0x4f9a5e=await withSpinner(_0x3f8f59(0x213),()=>_0x528057[_0x3f8f59(0x19f)][_0x3f8f59(0x22c)](),{'verbose':_0x1ea581[_0x3f8f59(0x221)]});return _0x4f9a5e[_0x3f8f59(0x1d1)]['id'];}function toLLMProjectInfo(_0x4539d3){const _0xfdad0f=a26_0x2097;return{'name':_0x4539d3[_0xfdad0f(0x260)]['name'],'description':_0x4539d3['attributes']['description'],'createdAt':_0x4539d3[_0xfdad0f(0x260)][_0xfdad0f(0x1a8)],'updatedAt':_0x4539d3[_0xfdad0f(0x260)][_0xfdad0f(0x244)]};}function a26_0x2097(_0x504375,_0x583617){_0x504375=_0x504375-0x198;const _0x108b34=a26_0x108b();let _0x20978b=_0x108b34[_0x504375];return _0x20978b;}function toAgentInfo(_0x3bc51c){const _0x26a331=a26_0x2097;return{'name':_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x207)],'description':_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x256)],'prompt':truncatePrompt(_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x1d8)]),'createdAt':_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x1a8)],'updatedAt':_0x3bc51c[_0x26a331(0x260)]['updatedAt']};}function truncatePrompt(_0x22a045){const _0x5a40bb=a26_0x2097;if(!_0x22a045)return undefined;const _0x46c056=0x64;if(_0x22a045['length']<=_0x46c056)return _0x22a045;return _0x22a045[_0x5a40bb(0x255)](0x0,_0x46c056)+_0x5a40bb(0x1ca);}export class LLMModelsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1c5);['description']=a26_0x9b0f89(0x1e7);async[a26_0x9b0f89(0x20d)](_0x55aac4){const _0x5be829=a26_0x9b0f89,{options:_0x28d638,tdx:_0x192fde}=_0x55aac4;try{const _0x45d553=await withSpinner(_0x5be829(0x269),()=>_0x192fde[_0x5be829(0x19f)][_0x5be829(0x252)](),{'verbose':_0x28d638[_0x5be829(0x221)]});return await handleSDKOutput(_0x45d553[_0x5be829(0x1d1)],_0x28d638),0x0;}catch(_0x877a6b){return handleSDKError(_0x877a6b,_0x28d638),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:projects';[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x226);async[a26_0x9b0f89(0x20d)](_0x25b60e){const _0xa78238=a26_0x9b0f89,{options:_0x3679e2,args:_0x1e250a,tdx:_0x20c840}=_0x25b60e;try{const _0x1c8b35=_0x1e250a[0x0],_0x520b4c=resolveLimit(_0x3679e2[_0xa78238(0x257)],DEFAULT_LLM_LIMIT),_0x52cb71=await withSpinner('Fetching\x20projects...',()=>_0x20c840[_0xa78238(0x19f)]['projects'](_0x520b4c),{'verbose':_0x3679e2[_0xa78238(0x221)]});let _0x28b46a=_0x52cb71['data'];_0x1c8b35&&(_0x28b46a=_0x52cb71[_0xa78238(0x1d1)][_0xa78238(0x203)](_0x3633e1=>matchGlobPattern(_0x3633e1[_0xa78238(0x260)][_0xa78238(0x207)],_0x1c8b35)));const _0x18dc93=_0x28b46a[_0xa78238(0x1d3)](toLLMProjectInfo);return await handleSDKOutput(_0x18dc93,_0x3679e2),0x0;}catch(_0x2b37ac){return handleSDKError(_0x2b37ac,_0x3679e2),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1ae);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x1cd);async[a26_0x9b0f89(0x20d)](_0x9097db){const _0x214b63=a26_0x9b0f89,{options:_0x1f9b99,args:_0x3b6b57,tdx:_0x1a0756}=_0x9097db;try{const _0x2fc2bf=_0x3b6b57[0x0];let _0x2cec4b,_0x4578f9=_0x2fc2bf;if(_0x2fc2bf&&_0x2fc2bf[_0x214b63(0x1af)]('/')){const _0x5cbe46=_0x2fc2bf[_0x214b63(0x202)]('/');if(_0x5cbe46[_0x214b63(0x204)]===0x2){const [_0x59bc1f,_0x52c02a]=_0x5cbe46,_0x302fe8=await _0x1a0756[_0x214b63(0x19f)][_0x214b63(0x21e)](),_0x14ff2a=_0x302fe8['find'](_0x54c99a=>_0x54c99a['attributes'][_0x214b63(0x207)][_0x214b63(0x247)]()===_0x59bc1f[_0x214b63(0x247)]());if(!_0x14ff2a)throw new SDKError(ErrorCode[_0x214b63(0x25c)],_0x214b63(0x1ee)+_0x59bc1f,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x2cec4b=_0x14ff2a['id'],_0x4578f9=_0x52c02a;}else throw new SDKError(ErrorCode[_0x214b63(0x1cc)],_0x214b63(0x19b)+_0x2fc2bf,undefined,{'helpText':_0x214b63(0x201)});}else _0x2cec4b=await getProjectIdOrDefault(_0x9097db);const _0x1d725a=await withSpinner(_0x214b63(0x19a),()=>_0x1a0756[_0x214b63(0x19f)]['agents'](_0x2cec4b),{'verbose':_0x1f9b99[_0x214b63(0x221)]});let _0x108fbb=_0x1d725a[_0x214b63(0x1d1)];_0x4578f9&&(_0x108fbb=_0x1d725a['data'][_0x214b63(0x203)](_0x541ef8=>matchGlobPattern(_0x541ef8[_0x214b63(0x260)][_0x214b63(0x207)],_0x4578f9)));const _0x332001=_0x108fbb[_0x214b63(0x1d3)](toAgentInfo);return await handleSDKOutput(_0x332001,_0x1f9b99),0x0;}catch(_0x58b30e){return handleSDKError(_0x58b30e,_0x1f9b99),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:agent:show';[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x24e);async[a26_0x9b0f89(0x20d)](_0x1b88c5){const _0x52c4f8=a26_0x9b0f89,{options:_0x2c1b0a,args:_0x58d59d,tdx:_0x4a3f66}=_0x1b88c5;if(_0x58d59d[_0x52c4f8(0x204)]===0x0)return console[_0x52c4f8(0x1ce)]('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x52c4f8(0x20f)),0x1;const _0x5a5aa6=_0x58d59d[0x0];try{const _0x7e3363=await getProjectIdOrDefault(_0x1b88c5),_0x3fd6d7=await withSpinner('Resolving\x20agent\x20\x27'+_0x5a5aa6+_0x52c4f8(0x22f),()=>_0x4a3f66[_0x52c4f8(0x19f)]['resolveAgentId'](_0x5a5aa6,_0x7e3363),{'verbose':_0x2c1b0a[_0x52c4f8(0x221)]}),_0x137d3d=await withSpinner(_0x52c4f8(0x21a),()=>_0x4a3f66[_0x52c4f8(0x19f)][_0x52c4f8(0x1d2)](_0x3fd6d7[_0x52c4f8(0x1d1)]),{'verbose':_0x2c1b0a[_0x52c4f8(0x221)]});return await handleSDKOutput([_0x137d3d[_0x52c4f8(0x1d1)]],_0x2c1b0a),0x0;}catch(_0x393989){return handleSDKError(_0x393989,_0x2c1b0a),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x25b);['description']=a26_0x9b0f89(0x25e);async['execute'](_0x564e2b){const _0x18365e=a26_0x9b0f89,{options:_0x52ace0,args:_0x1e4da3,tdx:_0x398db7}=_0x564e2b;if(_0x1e4da3[_0x18365e(0x204)]===0x0)return console[_0x18365e(0x1ce)](_0x18365e(0x200)),console[_0x18365e(0x1ce)](_0x18365e(0x1e3)),console[_0x18365e(0x1ce)](_0x18365e(0x209)),0x1;const _0xcbc307=_0x1e4da3[0x0],_0x2b2283=_0x52ace0,_0x2381ba=_0x2b2283[_0x18365e(0x22d)],_0x36181c=_0x2b2283[_0x18365e(0x1c6)]||_0x18365e(0x236),_0x34a17b=_0x2b2283[_0x18365e(0x22a)],_0x57bb91=_0x2b2283[_0x18365e(0x1de)]?Number(_0x2b2283['maxToolIterations']):undefined,_0x34534c=_0x2b2283['temperature']?Number(_0x2b2283['temperature']):undefined;try{let _0x3d801a,_0x59b191;if(_0xcbc307['includes']('/')){const _0x1fd0cf=_0xcbc307[_0x18365e(0x202)]('/');if(_0x1fd0cf[_0x18365e(0x204)]===0x2){const [_0x2e3484,_0x528f3c]=_0x1fd0cf,_0x3e625b=await withSpinner('Resolving\x20project\x20\x27'+_0x2e3484+_0x18365e(0x22f),()=>_0x398db7['llm'][_0x18365e(0x267)](_0x2e3484),{'verbose':_0x52ace0[_0x18365e(0x221)]});_0x3d801a=_0x3e625b[_0x18365e(0x1d1)],_0x59b191=_0x528f3c;}else throw new SDKError(ErrorCode[_0x18365e(0x1cc)],_0x18365e(0x19b)+_0xcbc307,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x3d801a=await getProjectIdOrDefault(_0x564e2b),_0x59b191=_0xcbc307;const _0x3678b2=await withSpinner(_0x18365e(0x1dc)+_0x59b191+'\x27...',()=>_0x398db7[_0x18365e(0x19f)][_0x18365e(0x24a)]({'name':_0x59b191,'projectId':_0x3d801a,'modelType':_0x36181c,'systemPrompt':_0x2381ba,'starterMessage':_0x34a17b,'maxToolIterations':_0x57bb91,'temperature':_0x34534c}),{'verbose':_0x52ace0['verbose']});return console[_0x18365e(0x1b8)](_0x18365e(0x254)+_0x3678b2['data']['id']),await handleSDKOutput([_0x3678b2[_0x18365e(0x1d1)]],_0x52ace0),0x0;}catch(_0x2680b9){return handleSDKError(_0x2680b9,_0x52ace0),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1c1);[a26_0x9b0f89(0x256)]='Update\x20an\x20existing\x20agent';async[a26_0x9b0f89(0x20d)](_0x5eabd8){const _0x567f5e=a26_0x9b0f89,{options:_0x22bd64,args:_0x177625,tdx:_0x2baae6}=_0x5eabd8;if(_0x177625[_0x567f5e(0x204)]===0x0)return console[_0x567f5e(0x1ce)](_0x567f5e(0x200)),console[_0x567f5e(0x1ce)](_0x567f5e(0x1fb)),0x1;const _0x5cbde2=_0x177625[0x0],_0x5cb428=_0x22bd64,_0x2f1512=_0x5cb428[_0x567f5e(0x207)],_0x3ad1d2=_0x5cb428[_0x567f5e(0x1d8)],_0x25f179=_0x5cb428[_0x567f5e(0x256)],_0x5f4a44=_0x5cb428[_0x567f5e(0x22a)];if(!_0x2f1512&&!_0x3ad1d2&&!_0x25f179&&!_0x5f4a44)return console[_0x567f5e(0x1ce)](_0x567f5e(0x1c4)),console['error'](_0x567f5e(0x230)),0x1;try{const _0x14ae73=await getProjectIdOrDefault(_0x5eabd8),_0x4366de=await withSpinner(_0x567f5e(0x1ea)+_0x5cbde2+_0x567f5e(0x22f),()=>_0x2baae6[_0x567f5e(0x19f)]['resolveAgentId'](_0x5cbde2,_0x14ae73),{'verbose':_0x22bd64['verbose']}),_0x69b93d=_0x4366de['data'],_0x5bd0a4=await withSpinner(_0x567f5e(0x1a0),()=>_0x2baae6['llm']['updateAgent'](_0x69b93d,{'name':_0x2f1512,'prompt':_0x3ad1d2,'description':_0x25f179,'starterMessage':_0x5f4a44}),{'verbose':_0x22bd64[_0x567f5e(0x221)]});return console['log']('Agent\x20updated:\x20'+_0x5bd0a4[_0x567f5e(0x1d1)]['id']),await handleSDKOutput([_0x5bd0a4[_0x567f5e(0x1d1)]],_0x22bd64),0x0;}catch(_0x815491){return handleSDKError(_0x815491,_0x22bd64),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x198);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x238);async['execute'](_0x247701){const _0x535245=a26_0x9b0f89,{options:_0x3595fa,args:_0x4c5164,tdx:_0x487241}=_0x247701;if(_0x4c5164[_0x535245(0x204)]===0x0)return console[_0x535245(0x1ce)](_0x535245(0x200)),console[_0x535245(0x1ce)](_0x535245(0x251)),0x1;const _0x1cb932=_0x4c5164[0x0];try{const _0x5a0100=await getProjectIdOrDefault(_0x247701),_0x505b9b=await withSpinner(_0x535245(0x1ea)+_0x1cb932+_0x535245(0x22f),()=>_0x487241['llm']['resolveAgentId'](_0x1cb932,_0x5a0100),{'verbose':_0x3595fa[_0x535245(0x221)]}),_0x314e24=_0x505b9b[_0x535245(0x1d1)];return await withSpinner(_0x535245(0x208),()=>_0x487241[_0x535245(0x19f)][_0x535245(0x1b9)](_0x314e24),{'verbose':_0x3595fa[_0x535245(0x221)]}),console['log'](_0x535245(0x1f8)+_0x314e24),0x0;}catch(_0x4ce96d){return handleSDKError(_0x4ce96d,_0x3595fa),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x22e);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x20b);async[a26_0x9b0f89(0x20d)](_0x142077){const _0x524ba9=a26_0x9b0f89;return executeChatHistoryCommand(_0x142077,_0x524ba9(0x1ad));}}export class LLMUseCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1ff);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x219);async[a26_0x9b0f89(0x20d)](_0x545c9d){const _0x227a49=a26_0x9b0f89,{options:_0x288027,args:_0x710ccb,tdx:_0x56b586}=_0x545c9d;if(_0x710ccb['length']===0x0)return console['error'](_0x227a49(0x1f0)),console[_0x227a49(0x1ce)](_0x227a49(0x1e4)),0x1;const _0x5ea3b2=_0x710ccb[0x0];try{return await withSpinner(_0x227a49(0x259)+_0x5ea3b2+'\x27...',()=>_0x56b586[_0x227a49(0x19f)][_0x227a49(0x1b2)](_0x5ea3b2),{'verbose':_0x288027[_0x227a49(0x221)]}),console[_0x227a49(0x1b8)]('Project\x20context\x20set\x20to:\x20'+_0x5ea3b2),0x0;}catch(_0x572b35){return handleSDKError(_0x572b35,_0x288027),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:project:create';['description']=a26_0x9b0f89(0x19d);async[a26_0x9b0f89(0x20d)](_0x3c6fe9){const _0x2c4aaa=a26_0x9b0f89,{options:_0x46f698,args:_0x4491dd,tdx:_0x390b5e}=_0x3c6fe9;if(_0x4491dd[_0x2c4aaa(0x204)]===0x0)return console[_0x2c4aaa(0x1ce)](_0x2c4aaa(0x1f0)),console[_0x2c4aaa(0x1ce)](_0x2c4aaa(0x1bc)),0x1;const _0x549bf9=_0x4491dd[0x0],_0x5d95c4=_0x46f698,_0x2638ae=_0x5d95c4[_0x2c4aaa(0x256)];try{const _0x2e319c=await withSpinner(_0x2c4aaa(0x253)+_0x549bf9+'\x27...',()=>_0x390b5e[_0x2c4aaa(0x19f)][_0x2c4aaa(0x1d7)]({'name':_0x549bf9,'description':_0x2638ae}),{'verbose':_0x46f698[_0x2c4aaa(0x221)]});console['log'](_0x2c4aaa(0x1a1)+_0x2e319c[_0x2c4aaa(0x1d1)]['id']);const _0x4be3c8=toLLMProjectInfo(_0x2e319c[_0x2c4aaa(0x1d1)]);return await handleSDKOutput([_0x4be3c8],_0x46f698),0x0;}catch(_0x40cb11){return handleSDKError(_0x40cb11,_0x46f698),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:project:delete';['description']=a26_0x9b0f89(0x1f4);async[a26_0x9b0f89(0x20d)](_0x5b3596){const _0x10d6ca=a26_0x9b0f89,{options:_0x3253e6,args:_0x536397,tdx:_0x21276b}=_0x5b3596;if(_0x536397[_0x10d6ca(0x204)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x10d6ca(0x1ce)](_0x10d6ca(0x1d6)),0x1;const _0x45037d=_0x536397[0x0];try{return await withSpinner(_0x10d6ca(0x1f9)+_0x45037d+_0x10d6ca(0x22f),()=>_0x21276b['llm'][_0x10d6ca(0x1c3)](_0x45037d),{'verbose':_0x3253e6[_0x10d6ca(0x221)]}),console['log']('Project\x20deleted:\x20'+_0x45037d),0x0;}catch(_0x3965e5){return handleSDKError(_0x3965e5,_0x3253e6),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:project:backup';[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x231);async[a26_0x9b0f89(0x20d)](_0x1bcd81){const _0x586de0=a26_0x9b0f89,{options:_0x276050,args:_0x255737,tdx:_0x2beb1f}=_0x1bcd81;if(_0x255737[_0x586de0(0x204)]===0x0)return console[_0x586de0(0x1ce)](_0x586de0(0x1f0)),console[_0x586de0(0x1ce)](_0x586de0(0x1c7)),0x1;const _0xa93412=_0x255737[0x0],_0x10d930=_0x276050,_0x468df0=_0x10d930[_0x586de0(0x1f7)],_0x4f860d=_0x10d930[_0x586de0(0x20e)];try{const _0x47b7e8=_0x468df0||_0xa93412+'.llm';if(a26_0x39a6c7[_0x586de0(0x23d)](_0x47b7e8)&&!_0x4f860d){if(!_0x276050[_0x586de0(0x1e6)]){const _0x1a993a=await confirm(_0x586de0(0x25d)+_0x47b7e8+_0x586de0(0x25a));if(!_0x1a993a)return console[_0x586de0(0x1b8)](_0x586de0(0x1f6)),0x0;}a26_0x39a6c7[_0x586de0(0x19c)](_0x47b7e8,{'recursive':!![]});}const _0x478fd9=await withSpinner(_0x4f860d?_0x586de0(0x1d0)+_0xa93412+_0x586de0(0x22f):_0x586de0(0x211)+_0xa93412+_0x586de0(0x22f),()=>_0x2beb1f[_0x586de0(0x19f)]['backupProject'](_0xa93412,_0x468df0,{'dryRun':_0x4f860d}),{'verbose':_0x276050[_0x586de0(0x221)]}),_0x4fda17=_0x478fd9[_0x586de0(0x1d1)];return _0x4f860d?console['log']('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x4fda17['outputDir']):console[_0x586de0(0x1b8)](_0x586de0(0x26b)+_0x4fda17['outputDir']),console[_0x586de0(0x1b8)](_0x586de0(0x20a)+_0x4fda17['counts'][_0x586de0(0x1db)]),console[_0x586de0(0x1b8)](_0x586de0(0x1e0)+_0x4fda17[_0x586de0(0x239)][_0x586de0(0x24f)]),console[_0x586de0(0x1b8)](_0x586de0(0x24b)+_0x4fda17[_0x586de0(0x239)][_0x586de0(0x1eb)]),console['log'](_0x586de0(0x224)+_0x4fda17[_0x586de0(0x239)][_0x586de0(0x26a)]),(_0x276050[_0x586de0(0x222)]===_0x586de0(0x1b3)||_0x276050[_0x586de0(0x222)]===_0x586de0(0x1f1))&&await handleSDKOutput([_0x4fda17],_0x276050),0x0;}catch(_0x31627a){return handleSDKError(_0x31627a,_0x276050),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x218);['description']=a26_0x9b0f89(0x1a7);async[a26_0x9b0f89(0x20d)](_0x3f69c5){const _0xe12a5f=a26_0x9b0f89,{options:_0x2484fd,args:_0x17e845,tdx:_0xb3e2ae}=_0x3f69c5;if(_0x17e845[_0xe12a5f(0x204)]===0x0)return console[_0xe12a5f(0x1ce)](_0xe12a5f(0x1b6)),console['error'](_0xe12a5f(0x199)),0x1;const _0x56bb88=_0x17e845[0x0],_0x429ea6=_0x2484fd,_0x339b3c=_0x429ea6['name'],_0x2efca8=_0x429ea6[_0xe12a5f(0x20e)];try{if(!_0x2efca8){const _0xe1b1ec=_0xb3e2ae[_0xe12a5f(0x19f)][_0xe12a5f(0x1e5)](_0x56bb88),_0x26c972=_0x339b3c||_0xe1b1ec[_0xe12a5f(0x214)]['projectName'],_0x2ef925=await withSpinner(_0xe12a5f(0x1d9),()=>_0xb3e2ae[_0xe12a5f(0x19f)][_0xe12a5f(0x21e)](),{'verbose':_0x2484fd[_0xe12a5f(0x221)]}),_0x29b798=_0x2ef925['data'][_0xe12a5f(0x249)](_0x5a323a=>_0x5a323a[_0xe12a5f(0x260)]['name']===_0x26c972);if(_0x29b798&&!_0x2484fd[_0xe12a5f(0x1e6)]){const _0x553ef5=await confirm('A\x20project\x20named\x20\x27'+_0x26c972+_0xe12a5f(0x1c8));if(!_0x553ef5)return console['log'](_0xe12a5f(0x23c)),0x0;}}const _0x493282=await withSpinner(_0x2efca8?_0xe12a5f(0x1c9)+_0x56bb88+_0xe12a5f(0x22f):'Restoring\x20project\x20from\x20\x27'+_0x56bb88+_0xe12a5f(0x22f),()=>_0xb3e2ae[_0xe12a5f(0x19f)][_0xe12a5f(0x1f2)](_0x56bb88,{'name':_0x339b3c,'dryRun':_0x2efca8}),{'verbose':_0x2484fd['verbose']}),_0x1da2f9=_0x493282[_0xe12a5f(0x1d1)];return _0x1da2f9[_0xe12a5f(0x1b1)]&&console[_0xe12a5f(0x1b8)](_0xe12a5f(0x23f)+_0x1da2f9['sourceSite']+'\x27'),_0x2efca8?console[_0xe12a5f(0x1b8)](_0xe12a5f(0x220)+_0x1da2f9[_0xe12a5f(0x210)]):console[_0xe12a5f(0x1b8)]('Project\x20restored:\x20'+_0x1da2f9[_0xe12a5f(0x210)]+'\x20('+_0x1da2f9[_0xe12a5f(0x26c)]+')'),console[_0xe12a5f(0x1b8)](_0xe12a5f(0x20a)+_0x1da2f9[_0xe12a5f(0x239)]['agents']),console[_0xe12a5f(0x1b8)](_0xe12a5f(0x1e0)+_0x1da2f9['counts'][_0xe12a5f(0x24f)]),console[_0xe12a5f(0x1b8)]('\x20\x20Prompts:\x20'+_0x1da2f9[_0xe12a5f(0x239)]['prompts']),console[_0xe12a5f(0x1b8)]('\x20\x20Integrations:\x20'+_0x1da2f9[_0xe12a5f(0x239)][_0xe12a5f(0x26a)]),(_0x2484fd[_0xe12a5f(0x222)]==='json'||_0x2484fd[_0xe12a5f(0x222)]===_0xe12a5f(0x1f1))&&await handleSDKOutput([_0x1da2f9],_0x2484fd),0x0;}catch(_0x18709e){return handleSDKError(_0x18709e,_0x2484fd),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x1826bf,_0x46b34a){const _0x35d73c=a26_0x9b0f89,_0x54f37b=_0x46b34a[_0x35d73c(0x257)]||CHAT_SELECTOR_PAGE_SIZE;let _0x41a715=0x0,_0x2711c3=[];const _0x1e6404=(await import(_0x35d73c(0x1eb)))[_0x35d73c(0x21f)],_0x4218f3=getChalk(_0x46b34a);while(!![]){const _0x39195e=await withSpinner(_0x35d73c(0x268),()=>_0x1826bf[_0x35d73c(0x19f)][_0x35d73c(0x1fe)](_0x54f37b+_0x41a715),{'verbose':_0x46b34a[_0x35d73c(0x221)]});_0x2711c3=_0x39195e[_0x35d73c(0x1d1)];const _0x2ad916=_0x2711c3[_0x35d73c(0x255)](_0x41a715,_0x41a715+_0x54f37b),_0x3f83ea=_0x2711c3[_0x35d73c(0x204)]>_0x41a715+_0x54f37b,_0x33fd53=[...new Set(_0x2ad916[_0x35d73c(0x1d3)](_0x5ee36c=>_0x5ee36c[_0x35d73c(0x260)][_0x35d73c(0x1d5)])[_0x35d73c(0x203)](_0x151b58=>_0x151b58!==undefined))],_0x8c3e82=new Map();await Promise[_0x35d73c(0x1ba)](_0x33fd53[_0x35d73c(0x1d3)](async _0x3e6d28=>{const _0x917151=_0x35d73c;try{const _0x47f99f=await _0x1826bf['llm']['agent'](_0x3e6d28);_0x8c3e82[_0x917151(0x1d4)](_0x3e6d28,_0x47f99f[_0x917151(0x260)][_0x917151(0x207)]);}catch{_0x8c3e82['set'](_0x3e6d28,_0x3e6d28);}}));const _0x1f9183=_0x2ad916[_0x35d73c(0x1d3)](_0x3a0a8a=>{const _0x3a6d5a=_0x35d73c,_0x4518fa=_0x3a0a8a[_0x3a6d5a(0x260)]['firstInputContent']||_0x3a6d5a(0x1ac),_0x373476=_0x4518fa['split']('\x0a')[0x0],_0x4fbe52=_0x373476[_0x3a6d5a(0x204)]>0x50?_0x373476[_0x3a6d5a(0x212)](0x0,0x4d)+_0x3a6d5a(0x1ca):_0x373476,_0x1b4472=_0x3a0a8a['attributes'][_0x3a6d5a(0x1d5)]?_0x8c3e82[_0x3a6d5a(0x1bf)](_0x3a0a8a[_0x3a6d5a(0x260)]['agentId'])||_0x3a0a8a[_0x3a6d5a(0x260)][_0x3a6d5a(0x1d5)]:_0x3a6d5a(0x21c),_0x2cd2dc=_0x3a0a8a['attributes'][_0x3a6d5a(0x1bd)]||_0x3a0a8a[_0x3a6d5a(0x260)][_0x3a6d5a(0x244)],_0x21e7ac=new Date(_0x2cd2dc),_0x5ca2a4=new Date(),_0x2ba23d=_0x5ca2a4[_0x3a6d5a(0x23b)]()-_0x21e7ac['getTime'](),_0x56d73a=Math[_0x3a6d5a(0x26d)](_0x2ba23d/0xea60),_0x436263=Math['floor'](_0x2ba23d/0x36ee80),_0x1071b9=Math[_0x3a6d5a(0x26d)](_0x2ba23d/0x5265c00);let _0x16aa7c;if(_0x56d73a<0x1)_0x16aa7c=_0x3a6d5a(0x1f5);else{if(_0x56d73a<0x3c)_0x16aa7c=_0x56d73a+'m\x20ago';else{if(_0x436263<0x18)_0x16aa7c=_0x436263+_0x3a6d5a(0x1ed);else _0x1071b9<0x7?_0x16aa7c=_0x1071b9+_0x3a6d5a(0x245):_0x16aa7c=_0x21e7ac[_0x3a6d5a(0x23e)]('en-US',{'month':'short','day':_0x3a6d5a(0x227)});}}return{'title':_0x4fbe52+'\x20'+_0x4218f3[_0x3a6d5a(0x21d)]('['+_0x1b4472+']\x20'+_0x16aa7c),'value':_0x3a0a8a['id']};});_0x3f83ea&&_0x1f9183[_0x35d73c(0x21b)]({'title':_0x4218f3[_0x35d73c(0x216)](_0x35d73c(0x1a5)),'value':_0x35d73c(0x240)});const _0x2776af=await _0x1e6404({'type':_0x35d73c(0x225),'name':'chatId','message':'Select\x20a\x20chat\x20session:','choices':_0x1f9183,'hint':_0x35d73c(0x1fa)});if(!_0x2776af[_0x35d73c(0x20c)])return undefined;if(_0x2776af[_0x35d73c(0x20c)]===_0x35d73c(0x240)){_0x41a715+=_0x54f37b;continue;}return _0x2776af[_0x35d73c(0x20c)];}}export class ChatsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1fe);['description']=a26_0x9b0f89(0x243);async[a26_0x9b0f89(0x20d)](_0x1e00ba){const _0x2d5920=a26_0x9b0f89;return executeChatHistoryCommand(_0x1e00ba,_0x2d5920(0x206));}}
1
+ const a26_0xe05403=a26_0x102a;(function(_0x5f2a9a,_0x595f5e){const _0xfeaffe=a26_0x102a,_0x4a962a=_0x5f2a9a();while(!![]){try{const _0x520c06=-parseInt(_0xfeaffe(0xe9))/0x1*(-parseInt(_0xfeaffe(0xca))/0x2)+parseInt(_0xfeaffe(0x140))/0x3+-parseInt(_0xfeaffe(0xe1))/0x4*(parseInt(_0xfeaffe(0x156))/0x5)+parseInt(_0xfeaffe(0x13a))/0x6+parseInt(_0xfeaffe(0xda))/0x7*(-parseInt(_0xfeaffe(0xf1))/0x8)+-parseInt(_0xfeaffe(0x118))/0x9*(-parseInt(_0xfeaffe(0x10f))/0xa)+-parseInt(_0xfeaffe(0x111))/0xb;if(_0x520c06===_0x595f5e)break;else _0x4a962a['push'](_0x4a962a['shift']());}catch(_0x291f54){_0x4a962a['push'](_0x4a962a['shift']());}}}(a26_0x42b5,0xbd64d));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_0x488d53 from'node:fs';function a26_0x42b5(){const _0x9f705d=['log','createAgent','agents','67078wVfrnD','agent','table','description','Fetching\x20agents...','(no\x20message)','getCurrentProject','Error:\x20','3839056ZGSTZf','Backing\x20up\x20project\x20\x27','join','List\x20available\x20LLM\x20models','cause','claude-4.5-haiku','includes','Use\x20format:\x20project-name/agent-name','Fetching\x20available\x20models...','llm:agent:update','Backup\x20cancelled.','\x20\x20Prompts:\x20','Invalid\x20path\x20syntax:\x20','all','\x20\x20Knowledge\x20Bases:\x20','Checking\x20for\x20existing\x20projects...','Deleting\x20agent...','llm:agent:show','Error:\x20Project\x20name\x20is\x20required','length','json','Fetching\x20chat\x20sessions...','llm:agent:create','Creating\x20agent\x20\x27','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','Updating\x20agent...','Deleting\x20project\x20\x27','[image]\x20\x20','targetImageGenerator','Agent\x20updated:\x20','9730wjNHlX','Resolving\x20project\x20\x27','17427047HOurBP','rmSync','Analyzing\x20project\x20\x27','stack','dryRun','filter','Update\x20an\x20existing\x20agent','3573WMWDxN','dim','m\x20ago','entries','chatId','find','numeric','\x20--last','slice','setCurrentProject','targetKnowledgeBase','toLocaleDateString','No\x20messages\x20found\x20in\x20chat\x20history.','getOrCreateDefaultProject','backupProject','models','name','Project\x20deleted:\x20','Error:\x20Agent\x20name\x20is\x20required','Create\x20a\x20new\x20agent\x20in\x20current\x20project','\x20\x20Cause:\x20','magenta','Show\x20agent\x20details','\x27\x20already\x20exists.\x20Overwrite?','model','last','outputDir','\x20->\x20KB:','[content]','Project\x20backed\x20up\x20to:\x20','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','set','knowledgeBases','createdAt','6724446ZrlbtP','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','execute','Delete\x20an\x20agent','resolveAgentId','input','3499800iLudIh','content','substring','INVALID_ARGUMENT','image','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','[output]\x20','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','llm:use','keys','...','attributes','getTime','Resolving\x20agent\x20\x27','getBackupMetadata','green','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','systemPrompt','temperature','cyan','projectName','sourceSite','30bJQJEI','llm:models','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','message','llm:history','llmProject','Agent\x20deleted:\x20','[error]\x20\x20','verbose','llm:project:create','targetAgent','resolveProjectId','Fetching\x20chat\x20history\x20for\x20\x27','updateAgent','Fetching\x20most\x20recent\x20chat...','red','Setting\x20project\x20context\x20to\x20\x27','Select\x20a\x20chat\x20session:','[tool_call]','Set\x20current\x20project\x20context','d\x20ago','error','map','h\x20ago','maxToolIterations','prompt','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','blue','\x20→\x20chat:\x20','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Project\x20not\x20found:\x20','chats','floor','projects','\x20\x20Integrations:\x20','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','[unknown]','List\x20agents\x20in\x20current\x20project','get','Agent\x20created:\x20','select','history','llm:project:delete','starterMessage','deleteProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','jsonl','Validating\x20backup\x20from\x20\x27','format','prompts','output','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','integrations','Usage:\x20','Output\x20directory\x20\x27','llm','short','llm:agents','Error:\x20Backup\x20folder\x20path\x20is\x20required','Load\x20more...','Getting\x20default\x20project...','Restore\x20cancelled.','tdx\x20llm\x20history','stringify','counts','Project\x20context\x20set\x20to:\x20','30zMtpdD','limit','yes','llm:agent:delete','tool_call','toLowerCase','bold','[tool]\x20\x20\x20','LLM_PROJECT_NOT_FOUND','createProject','\x0aStack\x20trace:','targetWebSearchTool','agentId','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','string','Create\x20a\x20new\x20LLM\x20project','14KaSoer','updatedAt','.llm','\x27...','A\x20project\x20named\x20\x27','data','\x20\x20Agents:\x20','239996khEDrY','__load_more__','tdx\x20chats','split','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'];a26_0x42b5=function(){return _0x9f705d;};return a26_0x42b5();}function handleSDKError(_0x553ee3,_0x15da3b){const _0x41147c=a26_0x102a;if(_0x553ee3 instanceof SDKError)console[_0x41147c(0x16d)](_0x41147c(0xf0)+_0x553ee3[_0x41147c(0x15b)]),_0x15da3b[_0x41147c(0x160)]&&(_0x553ee3[_0x41147c(0xf5)]&&console[_0x41147c(0x16d)](_0x41147c(0x12c)+_0x553ee3[_0x41147c(0xf5)]),_0x553ee3[_0x41147c(0x114)]&&(console[_0x41147c(0x16d)](_0x41147c(0xd4)),console['error'](_0x553ee3[_0x41147c(0x114)])));else throw _0x553ee3;}function formatChatHistoryEntry(_0xbc5a44,_0x22c91e){const _0x583322=a26_0x102a,_0x5cf32a=getChalk(_0x22c91e),_0x3983ff=_0x5cf32a['dim'](_0xbc5a44['at']);if(_0x583322(0x13f)in _0xbc5a44){const _0x32b739=_0x5cf32a[_0x583322(0x153)]('[input]\x20\x20');return _0x3983ff+'\x20'+_0x32b739+':\x20'+_0xbc5a44[_0x583322(0x13f)];}if(_0x583322(0x141)in _0xbc5a44){const _0x10ea1c=_0x5cf32a[_0x583322(0x14f)](_0x583322(0x134));return _0x3983ff+'\x20'+_0x10ea1c+':\x20'+_0xbc5a44[_0x583322(0x141)];}if(_0x583322(0xce)in _0xbc5a44){const _0x36d316=_0x5cf32a['yellow'](_0x583322(0x16a)),{functionName:_0x618ce2,functionArguments:_0x2e3902,targetFunction:_0x79143b}=_0xbc5a44['tool_call'];let _0x508973=_0x3983ff+'\x20'+_0x36d316+':\x20'+_0x5cf32a['bold'](_0x618ce2);if(_0x2e3902&&Object[_0x583322(0x149)](_0x2e3902)[_0x583322(0x104)]>0x0){const _0x1a0b3a=Object[_0x583322(0x11b)](_0x2e3902)['map'](([_0x4134d4,_0x589a26])=>_0x4134d4+'='+JSON['stringify'](_0x589a26))[_0x583322(0xf3)](',\x20');_0x508973+='('+_0x1a0b3a+')';}_0x79143b&&(_0x508973+=_0x5cf32a[_0x583322(0x119)]('\x20['+_0x79143b+']'));let _0x289847='';if(_0xbc5a44[_0x583322(0xce)][_0x583322(0x122)])_0x289847=_0x583322(0x133)+_0xbc5a44['tool_call'][_0x583322(0x122)][_0x583322(0x128)];else{if(_0xbc5a44[_0x583322(0xce)][_0x583322(0x162)])_0x289847='\x20->\x20Agent:'+_0xbc5a44[_0x583322(0xce)]['targetAgent'][_0x583322(0x128)];else{if(_0xbc5a44[_0x583322(0xce)][_0x583322(0xd5)])_0x289847='\x20->\x20WebSearch:'+_0xbc5a44[_0x583322(0xce)]['targetWebSearchTool'][_0x583322(0x128)];else _0xbc5a44[_0x583322(0xce)]['targetImageGenerator']&&(_0x289847='\x20->\x20ImageGen:'+_0xbc5a44[_0x583322(0xce)][_0x583322(0x10d)]['name']);}}return _0x508973+_0x289847;}if('tool'in _0xbc5a44){const _0x2a9572=_0x5cf32a[_0x583322(0x12d)](_0x583322(0xd1)),{functionName:_0x4b3fde,functionArguments:_0x17a371,content:_0x4b12e0,newChat:_0x259d5c}=_0xbc5a44['tool'];let _0x46c4aa=_0x3983ff+'\x20'+_0x2a9572+':\x20'+_0x5cf32a[_0x583322(0xd0)](_0x4b3fde);if(_0x17a371){const _0x54fa8d=typeof _0x17a371===_0x583322(0xd8)?_0x17a371:JSON[_0x583322(0xc7)](_0x17a371);_0x46c4aa+='('+_0x54fa8d+')';}return _0x4b12e0&&(_0x46c4aa+='\x0a'+_0x5cf32a[_0x583322(0x119)](_0x4b12e0)),_0x259d5c&&(_0x46c4aa+=_0x5cf32a[_0x583322(0x119)](_0x583322(0x175)+_0x259d5c['id'])),_0x46c4aa;}if(_0x583322(0xba)in _0xbc5a44){const _0x5e67c5=_0x5cf32a[_0x583322(0x174)](_0x583322(0x146));return _0x3983ff+'\x20'+_0x5e67c5+':\x20'+_0xbc5a44['output'][_0x583322(0x128)]+'\x20('+_0xbc5a44[_0x583322(0xba)][_0x583322(0x141)][_0x583322(0x104)]+'\x20bytes)';}if('image'in _0xbc5a44){const _0x17d595=_0x5cf32a['blue'](_0x583322(0x10c)),{width:_0x2e0e1f,height:_0x5224e3,headerText:_0x3e05db}=_0xbc5a44[_0x583322(0x144)],_0xf83550=_0x3e05db?'\x20-\x20'+_0x3e05db:'';return _0x3983ff+'\x20'+_0x17d595+':\x20'+_0x2e0e1f+'x'+_0x5224e3+_0xf83550;}if(_0x583322(0x16d)in _0xbc5a44){const _0x2425c5=_0x5cf32a[_0x583322(0x167)](_0x583322(0x15f));return _0x3983ff+'\x20'+_0x2425c5+':\x20'+_0xbc5a44['error'];}return _0x3983ff+'\x20'+_0x5cf32a['dim'](_0x583322(0x17d))+':\x20'+JSON['stringify'](_0xbc5a44);}async function executeChatHistoryCommand(_0x55143c,_0x4baf52){const _0x11306f=a26_0x102a,{options:_0x337447,args:_0x399ab3,tdx:_0x5d4be1}=_0x55143c,_0x25042f=_0x399ab3[0x0],_0xa3db90=_0x337447,_0x154bd7=_0xa3db90[_0x11306f(0x131)];try{if(_0x154bd7&&_0x25042f)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x11306f(0x16d)](_0x11306f(0xbd)+_0x4baf52+_0x11306f(0x11f)),0x1;if(!_0x25042f&&!_0x154bd7&&_0x337447[_0x11306f(0xb8)]!==undefined){const _0x1fe035=resolveLimit(_0x337447[_0x11306f(0xcb)],DEFAULT_LLM_LIMIT),_0x218576=await withSpinner(_0x11306f(0x106),()=>_0x5d4be1[_0x11306f(0xbf)][_0x11306f(0x178)](_0x1fe035),{'verbose':_0x337447[_0x11306f(0x160)]});return await handleSDKOutput(_0x218576['data'],_0x337447),0x0;}const _0x489b8a=await getChatIdOrSelect(_0x5d4be1,_0x337447,_0x154bd7,_0x25042f);if(!_0x489b8a)return 0x0;return await displayChatHistory(_0x489b8a,_0x5d4be1,_0x337447),0x0;}catch(_0x486873){return handleSDKError(_0x486873,_0x337447),0x1;}}async function displayChatHistory(_0x5b1b04,_0x40e77e,_0x1c5b22){const _0x6ceab0=a26_0x102a,_0x54c617=await withSpinner(_0x6ceab0(0x164)+_0x5b1b04+'\x27...',()=>_0x40e77e[_0x6ceab0(0xbf)][_0x6ceab0(0xb1)](_0x5b1b04),{'verbose':_0x1c5b22[_0x6ceab0(0x160)]}),_0x4d644d=_0x54c617['data'][_0x6ceab0(0xdf)]??[];if(_0x4d644d['length']===0x0){console['log'](_0x6ceab0(0x124));return;}if(_0x1c5b22[_0x6ceab0(0xb8)]!==undefined)await handleSDKOutput(_0x4d644d,_0x1c5b22);else{const _0xa5ab10=_0x4d644d['map'](_0x356ab3=>formatChatHistoryEntry(_0x356ab3,_0x1c5b22)),_0x2c16b9=_0xa5ab10[_0x6ceab0(0xf3)]('\x0a');await writeOutput(_0x2c16b9,_0x1c5b22[_0x6ceab0(0xba)],_0x6ceab0(0xeb));}}async function getChatIdOrSelect(_0x30ae27,_0x22fa0d,_0xa96d65,_0xcd4b70){const _0x15458a=a26_0x102a;if(_0xcd4b70)return _0xcd4b70;if(_0xa96d65){const _0x1fd10c=await withSpinner(_0x15458a(0x166),()=>_0x30ae27[_0x15458a(0xbf)][_0x15458a(0x178)](0x1),{'verbose':_0x22fa0d[_0x15458a(0x160)]});if(_0x1fd10c[_0x15458a(0xdf)][_0x15458a(0x104)]===0x0)return console[_0x15458a(0xe6)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x1fd10c['data'][0x0]['id'];}const _0x26acb1=await selectChatInteractively(_0x30ae27,_0x22fa0d);if(!_0x26acb1)return console[_0x15458a(0xe6)]('\x0aCancelled'),undefined;return _0x26acb1;}async function getProjectIdOrDefault(_0x5bba1e){const _0x498779=a26_0x102a,{tdx:_0x38af8e,options:_0x3b3886}=_0x5bba1e,_0x13dc56=_0x3b3886[_0x498779(0x15d)];if(_0x13dc56){const _0x119f79=await withSpinner(_0x498779(0x110)+_0x13dc56+_0x498779(0xdd),()=>_0x38af8e[_0x498779(0xbf)]['resolveProjectId'](_0x13dc56),{'verbose':_0x3b3886['verbose']});return _0x119f79[_0x498779(0xdf)];}let _0x34e011=_0x38af8e['llm'][_0x498779(0xef)]();if(_0x34e011)return _0x34e011;const _0x506276=await withSpinner(_0x498779(0xc4),()=>_0x38af8e[_0x498779(0xbf)][_0x498779(0x125)](),{'verbose':_0x3b3886[_0x498779(0x160)]});return _0x506276[_0x498779(0xdf)]['id'];}function toLLMProjectInfo(_0x518fbf){const _0x3e13e8=a26_0x102a;return{'name':_0x518fbf[_0x3e13e8(0x14b)][_0x3e13e8(0x128)],'description':_0x518fbf[_0x3e13e8(0x14b)][_0x3e13e8(0xec)],'createdAt':_0x518fbf['attributes'][_0x3e13e8(0x139)],'updatedAt':_0x518fbf[_0x3e13e8(0x14b)]['updatedAt']};}function toAgentInfo(_0x19b4fa){const _0x7955a4=a26_0x102a;return{'name':_0x19b4fa[_0x7955a4(0x14b)]['name'],'description':_0x19b4fa['attributes'][_0x7955a4(0xec)],'prompt':truncatePrompt(_0x19b4fa['attributes']['prompt']),'createdAt':_0x19b4fa[_0x7955a4(0x14b)]['createdAt'],'updatedAt':_0x19b4fa[_0x7955a4(0x14b)][_0x7955a4(0xdb)]};}function truncatePrompt(_0x27f06d){const _0x11f8d1=a26_0x102a;if(!_0x27f06d)return undefined;const _0x506f07=0x64;if(_0x27f06d[_0x11f8d1(0x104)]<=_0x506f07)return _0x27f06d;return _0x27f06d['slice'](0x0,_0x506f07)+_0x11f8d1(0x14a);}export class LLMModelsCommand extends BaseCommand{['name']=a26_0xe05403(0x157);[a26_0xe05403(0xec)]=a26_0xe05403(0xf4);async['execute'](_0x575af5){const _0x62ccb=a26_0xe05403,{options:_0x49d99a,tdx:_0x4a622c}=_0x575af5;try{const _0xa9cb0c=await withSpinner(_0x62ccb(0xf9),()=>_0x4a622c[_0x62ccb(0xbf)][_0x62ccb(0x127)](),{'verbose':_0x49d99a['verbose']});return await handleSDKOutput(_0xa9cb0c[_0x62ccb(0xdf)],_0x49d99a),0x0;}catch(_0x536870){return handleSDKError(_0x536870,_0x49d99a),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0xe05403(0x128)]='llm:projects';[a26_0xe05403(0xec)]='List\x20all\x20LLM\x20projects';async[a26_0xe05403(0x13c)](_0x38d323){const _0x252db3=a26_0xe05403,{options:_0x66860b,args:_0x11b393,tdx:_0x511b02}=_0x38d323;try{const _0x2d198e=_0x11b393[0x0],_0x5dd498=resolveLimit(_0x66860b['limit'],DEFAULT_LLM_LIMIT),_0xd6c670=await withSpinner('Fetching\x20projects...',()=>_0x511b02[_0x252db3(0xbf)][_0x252db3(0x17a)](_0x5dd498),{'verbose':_0x66860b['verbose']});let _0x2877bd=_0xd6c670[_0x252db3(0xdf)];_0x2d198e&&(_0x2877bd=_0xd6c670[_0x252db3(0xdf)][_0x252db3(0x116)](_0x1576b3=>matchGlobPattern(_0x1576b3[_0x252db3(0x14b)][_0x252db3(0x128)],_0x2d198e)));const _0x176f5a=_0x2877bd[_0x252db3(0x16e)](toLLMProjectInfo);return await handleSDKOutput(_0x176f5a,_0x66860b),0x0;}catch(_0x3953f2){return handleSDKError(_0x3953f2,_0x66860b),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0xc1);[a26_0xe05403(0xec)]=a26_0xe05403(0xad);async[a26_0xe05403(0x13c)](_0x5b0862){const _0x409000=a26_0xe05403,{options:_0x110ee7,args:_0x26f99b,tdx:_0x67f667}=_0x5b0862;try{const _0x10a8a5=_0x26f99b[0x0];let _0x587747,_0x3dcc49=_0x10a8a5;if(_0x10a8a5&&_0x10a8a5['includes']('/')){const _0xfcab19=_0x10a8a5['split']('/');if(_0xfcab19[_0x409000(0x104)]===0x2){const [_0x19c938,_0x1b322e]=_0xfcab19,_0x3eb0ea=await _0x67f667[_0x409000(0xbf)][_0x409000(0x17a)](),_0x2e18f9=_0x3eb0ea['find'](_0x10ded2=>_0x10ded2[_0x409000(0x14b)][_0x409000(0x128)][_0x409000(0xcf)]()===_0x19c938[_0x409000(0xcf)]());if(!_0x2e18f9)throw new SDKError(ErrorCode[_0x409000(0xd2)],_0x409000(0x177)+_0x19c938,undefined,{'helpText':_0x409000(0xb5)});_0x587747=_0x2e18f9['id'],_0x3dcc49=_0x1b322e;}else throw new SDKError(ErrorCode[_0x409000(0x143)],_0x409000(0xfd)+_0x10a8a5,undefined,{'helpText':_0x409000(0xf8)});}else _0x587747=await getProjectIdOrDefault(_0x5b0862);const _0xe05d86=await withSpinner(_0x409000(0xed),()=>_0x67f667[_0x409000(0xbf)]['agents'](_0x587747),{'verbose':_0x110ee7[_0x409000(0x160)]});let _0x2905ed=_0xe05d86['data'];_0x3dcc49&&(_0x2905ed=_0xe05d86[_0x409000(0xdf)][_0x409000(0x116)](_0x2282e7=>matchGlobPattern(_0x2282e7[_0x409000(0x14b)][_0x409000(0x128)],_0x3dcc49)));const _0x2db707=_0x2905ed[_0x409000(0x16e)](toAgentInfo);return await handleSDKOutput(_0x2db707,_0x110ee7),0x0;}catch(_0x2fe913){return handleSDKError(_0x2fe913,_0x110ee7),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x102);['description']=a26_0xe05403(0x12e);async['execute'](_0xc265e9){const _0x31e2ff=a26_0xe05403,{options:_0x4eaa89,args:_0x57a5eb,tdx:_0x595e57}=_0xc265e9;if(_0x57a5eb[_0x31e2ff(0x104)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x31e2ff(0xe5)),0x1;const _0x836fa0=_0x57a5eb[0x0];try{const _0x1a9fd6=await getProjectIdOrDefault(_0xc265e9),_0x4f35ba=await withSpinner(_0x31e2ff(0x14d)+_0x836fa0+'\x27...',()=>_0x595e57['llm'][_0x31e2ff(0x13e)](_0x836fa0,_0x1a9fd6),{'verbose':_0x4eaa89['verbose']}),_0x3ffdf9=await withSpinner('Fetching\x20agent...',()=>_0x595e57[_0x31e2ff(0xbf)][_0x31e2ff(0xea)](_0x4f35ba['data']),{'verbose':_0x4eaa89[_0x31e2ff(0x160)]});return await handleSDKOutput([_0x3ffdf9[_0x31e2ff(0xdf)]],_0x4eaa89),0x0;}catch(_0x33939e){return handleSDKError(_0x33939e,_0x4eaa89),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x107);[a26_0xe05403(0xec)]=a26_0xe05403(0x12b);async[a26_0xe05403(0x13c)](_0x2a1889){const _0x1a653c=a26_0xe05403,{options:_0x4801fd,args:_0x252a91,tdx:_0x413352}=_0x2a1889;if(_0x252a91[_0x1a653c(0x104)]===0x0)return console[_0x1a653c(0x16d)](_0x1a653c(0x12a)),console[_0x1a653c(0x16d)](_0x1a653c(0x173)),console[_0x1a653c(0x16d)](_0x1a653c(0x15a)),0x1;const _0x7091eb=_0x252a91[0x0],_0x5c9441=_0x4801fd,_0x542de7=_0x5c9441[_0x1a653c(0x151)],_0x478f6a=_0x5c9441[_0x1a653c(0x130)]||_0x1a653c(0xf6),_0x2571b1=_0x5c9441[_0x1a653c(0xb3)],_0x400942=_0x5c9441[_0x1a653c(0x170)]?Number(_0x5c9441[_0x1a653c(0x170)]):undefined,_0x596a5a=_0x5c9441[_0x1a653c(0x152)]?Number(_0x5c9441[_0x1a653c(0x152)]):undefined;try{let _0x425ff2,_0x1a6e5f;if(_0x7091eb[_0x1a653c(0xf7)]('/')){const _0x1eda61=_0x7091eb[_0x1a653c(0xe4)]('/');if(_0x1eda61['length']===0x2){const [_0x2eb66c,_0x19e569]=_0x1eda61,_0x1d1e46=await withSpinner('Resolving\x20project\x20\x27'+_0x2eb66c+_0x1a653c(0xdd),()=>_0x413352[_0x1a653c(0xbf)][_0x1a653c(0x163)](_0x2eb66c),{'verbose':_0x4801fd[_0x1a653c(0x160)]});_0x425ff2=_0x1d1e46[_0x1a653c(0xdf)],_0x1a6e5f=_0x19e569;}else throw new SDKError(ErrorCode[_0x1a653c(0x143)],'Invalid\x20path\x20syntax:\x20'+_0x7091eb,undefined,{'helpText':_0x1a653c(0xf8)});}else _0x425ff2=await getProjectIdOrDefault(_0x2a1889),_0x1a6e5f=_0x7091eb;const _0x364513=await withSpinner(_0x1a653c(0x108)+_0x1a6e5f+_0x1a653c(0xdd),()=>_0x413352[_0x1a653c(0xbf)][_0x1a653c(0xe7)]({'name':_0x1a6e5f,'projectId':_0x425ff2,'modelType':_0x478f6a,'systemPrompt':_0x542de7,'starterMessage':_0x2571b1,'maxToolIterations':_0x400942,'temperature':_0x596a5a}),{'verbose':_0x4801fd['verbose']});return console[_0x1a653c(0xe6)](_0x1a653c(0xaf)+_0x364513['data']['id']),await handleSDKOutput([_0x364513[_0x1a653c(0xdf)]],_0x4801fd),0x0;}catch(_0x31d6a5){return handleSDKError(_0x31d6a5,_0x4801fd),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0xfa);['description']=a26_0xe05403(0x117);async[a26_0xe05403(0x13c)](_0x5339f5){const _0x3bf4f8=a26_0xe05403,{options:_0x27c290,args:_0xf510b6,tdx:_0x579d89}=_0x5339f5;if(_0xf510b6[_0x3bf4f8(0x104)]===0x0)return console[_0x3bf4f8(0x16d)](_0x3bf4f8(0x12a)),console[_0x3bf4f8(0x16d)]('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x5a4ef4=_0xf510b6[0x0],_0x1d6ab5=_0x27c290,_0x4489fd=_0x1d6ab5[_0x3bf4f8(0x128)],_0x44f242=_0x1d6ab5[_0x3bf4f8(0x171)],_0x559371=_0x1d6ab5[_0x3bf4f8(0xec)],_0x119191=_0x1d6ab5[_0x3bf4f8(0xb3)];if(!_0x4489fd&&!_0x44f242&&!_0x559371&&!_0x119191)return console['error'](_0x3bf4f8(0x150)),console[_0x3bf4f8(0x16d)](_0x3bf4f8(0x159)),0x1;try{const _0x57dc93=await getProjectIdOrDefault(_0x5339f5),_0x23abf3=await withSpinner(_0x3bf4f8(0x14d)+_0x5a4ef4+_0x3bf4f8(0xdd),()=>_0x579d89['llm'][_0x3bf4f8(0x13e)](_0x5a4ef4,_0x57dc93),{'verbose':_0x27c290['verbose']}),_0x1f6914=_0x23abf3[_0x3bf4f8(0xdf)],_0x260eab=await withSpinner(_0x3bf4f8(0x10a),()=>_0x579d89[_0x3bf4f8(0xbf)][_0x3bf4f8(0x165)](_0x1f6914,{'name':_0x4489fd,'prompt':_0x44f242,'description':_0x559371,'starterMessage':_0x119191}),{'verbose':_0x27c290['verbose']});return console[_0x3bf4f8(0xe6)](_0x3bf4f8(0x10e)+_0x260eab[_0x3bf4f8(0xdf)]['id']),await handleSDKOutput([_0x260eab[_0x3bf4f8(0xdf)]],_0x27c290),0x0;}catch(_0x53c568){return handleSDKError(_0x53c568,_0x27c290),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a26_0xe05403(0xcd);[a26_0xe05403(0xec)]=a26_0xe05403(0x13d);async[a26_0xe05403(0x13c)](_0x326f31){const _0x5efe16=a26_0xe05403,{options:_0x5ad07f,args:_0x2371bc,tdx:_0x53ca7d}=_0x326f31;if(_0x2371bc[_0x5efe16(0x104)]===0x0)return console[_0x5efe16(0x16d)](_0x5efe16(0x12a)),console[_0x5efe16(0x16d)](_0x5efe16(0xbb)),0x1;const _0x432b05=_0x2371bc[0x0];try{const _0x117b3b=await getProjectIdOrDefault(_0x326f31),_0x165641=await withSpinner(_0x5efe16(0x14d)+_0x432b05+_0x5efe16(0xdd),()=>_0x53ca7d[_0x5efe16(0xbf)][_0x5efe16(0x13e)](_0x432b05,_0x117b3b),{'verbose':_0x5ad07f[_0x5efe16(0x160)]}),_0x4734bb=_0x165641[_0x5efe16(0xdf)];return await withSpinner(_0x5efe16(0x101),()=>_0x53ca7d['llm']['deleteAgent'](_0x4734bb),{'verbose':_0x5ad07f['verbose']}),console['log'](_0x5efe16(0x15e)+_0x4734bb),0x0;}catch(_0x1acde7){return handleSDKError(_0x1acde7,_0x5ad07f),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x15c);['description']=a26_0xe05403(0xd7);async['execute'](_0x4bb7a3){const _0x37cbfa=a26_0xe05403;return executeChatHistoryCommand(_0x4bb7a3,_0x37cbfa(0xc6));}}export class LLMUseCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x148);[a26_0xe05403(0xec)]=a26_0xe05403(0x16b);async[a26_0xe05403(0x13c)](_0x3a83b2){const _0x5e9f0f=a26_0xe05403,{options:_0x4a0d70,args:_0x2f0c10,tdx:_0x58c2b7}=_0x3a83b2;if(_0x2f0c10['length']===0x0)return console['error'](_0x5e9f0f(0x103)),console[_0x5e9f0f(0x16d)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x315935=_0x2f0c10[0x0];try{return await withSpinner(_0x5e9f0f(0x168)+_0x315935+_0x5e9f0f(0xdd),()=>_0x58c2b7[_0x5e9f0f(0xbf)][_0x5e9f0f(0x121)](_0x315935),{'verbose':_0x4a0d70[_0x5e9f0f(0x160)]}),console[_0x5e9f0f(0xe6)](_0x5e9f0f(0xc9)+_0x315935),0x0;}catch(_0x53830e){return handleSDKError(_0x53830e,_0x4a0d70),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x161);['description']=a26_0xe05403(0xd9);async[a26_0xe05403(0x13c)](_0x3677b2){const _0x4b83f3=a26_0xe05403,{options:_0x5ad8ad,args:_0x22b5ee,tdx:_0xe70738}=_0x3677b2;if(_0x22b5ee['length']===0x0)return console[_0x4b83f3(0x16d)](_0x4b83f3(0x103)),console[_0x4b83f3(0x16d)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0xa64978=_0x22b5ee[0x0],_0x1ef239=_0x5ad8ad,_0x1c4f6a=_0x1ef239['description'];try{const _0x4d2b77=await withSpinner('Creating\x20project\x20\x27'+_0xa64978+_0x4b83f3(0xdd),()=>_0xe70738[_0x4b83f3(0xbf)][_0x4b83f3(0xd3)]({'name':_0xa64978,'description':_0x1c4f6a}),{'verbose':_0x5ad8ad['verbose']});console[_0x4b83f3(0xe6)]('Project\x20created:\x20'+_0x4d2b77['data']['id']);const _0x4859e0=toLLMProjectInfo(_0x4d2b77[_0x4b83f3(0xdf)]);return await handleSDKOutput([_0x4859e0],_0x5ad8ad),0x0;}catch(_0xe466bf){return handleSDKError(_0xe466bf,_0x5ad8ad),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0xb2);[a26_0xe05403(0xec)]='Delete\x20an\x20LLM\x20project';async[a26_0xe05403(0x13c)](_0x34711b){const _0x41bcf3=a26_0xe05403,{options:_0x43c9d4,args:_0x5c2b21,tdx:_0x254971}=_0x34711b;if(_0x5c2b21[_0x41bcf3(0x104)]===0x0)return console[_0x41bcf3(0x16d)](_0x41bcf3(0x103)),console[_0x41bcf3(0x16d)](_0x41bcf3(0x109)),0x1;const _0x2f4f64=_0x5c2b21[0x0];try{return await withSpinner(_0x41bcf3(0x10b)+_0x2f4f64+'\x27...',()=>_0x254971[_0x41bcf3(0xbf)][_0x41bcf3(0xb4)](_0x2f4f64),{'verbose':_0x43c9d4[_0x41bcf3(0x160)]}),console[_0x41bcf3(0xe6)](_0x41bcf3(0x129)+_0x2f4f64),0x0;}catch(_0x518a78){return handleSDKError(_0x518a78,_0x43c9d4),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']='llm:project:backup';[a26_0xe05403(0xec)]=a26_0xe05403(0x13b);async['execute'](_0x2a16a5){const _0x417560=a26_0xe05403,{options:_0x8a1315,args:_0x1ef9bb,tdx:_0x2b976c}=_0x2a16a5;if(_0x1ef9bb[_0x417560(0x104)]===0x0)return console[_0x417560(0x16d)](_0x417560(0x103)),console[_0x417560(0x16d)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0xf48d8d=_0x1ef9bb[0x0],_0x5555af=_0x8a1315,_0x481a79=_0x5555af[_0x417560(0xba)],_0x4a1ad7=_0x5555af[_0x417560(0x115)];try{const _0xd33c27=_0x481a79||_0xf48d8d+_0x417560(0xdc);if(a26_0x488d53['existsSync'](_0xd33c27)&&!_0x4a1ad7){if(!_0x8a1315[_0x417560(0xcc)]){const _0x345562=await confirm(_0x417560(0xbe)+_0xd33c27+_0x417560(0x12f));if(!_0x345562)return console[_0x417560(0xe6)](_0x417560(0xfb)),0x0;}a26_0x488d53[_0x417560(0x112)](_0xd33c27,{'recursive':!![]});}const _0xbf60d6=await withSpinner(_0x4a1ad7?_0x417560(0x113)+_0xf48d8d+_0x417560(0xdd):_0x417560(0xf2)+_0xf48d8d+_0x417560(0xdd),()=>_0x2b976c[_0x417560(0xbf)][_0x417560(0x126)](_0xf48d8d,_0x481a79,{'dryRun':_0x4a1ad7}),{'verbose':_0x8a1315['verbose']}),_0x13422a=_0xbf60d6[_0x417560(0xdf)];return _0x4a1ad7?console[_0x417560(0xe6)](_0x417560(0x145)+_0x13422a['outputDir']):console[_0x417560(0xe6)](_0x417560(0x135)+_0x13422a[_0x417560(0x132)]),console[_0x417560(0xe6)]('\x20\x20Agents:\x20'+_0x13422a['counts'][_0x417560(0xe8)]),console['log'](_0x417560(0xff)+_0x13422a['counts'][_0x417560(0x138)]),console[_0x417560(0xe6)]('\x20\x20Prompts:\x20'+_0x13422a[_0x417560(0xc8)][_0x417560(0xb9)]),console['log'](_0x417560(0x17b)+_0x13422a[_0x417560(0xc8)][_0x417560(0xbc)]),(_0x8a1315[_0x417560(0xb8)]===_0x417560(0x105)||_0x8a1315[_0x417560(0xb8)]===_0x417560(0xb6))&&await handleSDKOutput([_0x13422a],_0x8a1315),0x0;}catch(_0x1c60fd){return handleSDKError(_0x1c60fd,_0x8a1315),0x1;}}}function a26_0x102a(_0x3f80f9,_0x15dff4){_0x3f80f9=_0x3f80f9-0xad;const _0x42b567=a26_0x42b5();let _0x102a4e=_0x42b567[_0x3f80f9];return _0x102a4e;}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0xe05403(0x128)]='llm:project:restore';['description']=a26_0xe05403(0x158);async[a26_0xe05403(0x13c)](_0x462261){const _0x2c8ff7=a26_0xe05403,{options:_0x448006,args:_0x145d45,tdx:_0x5dfbdb}=_0x462261;if(_0x145d45[_0x2c8ff7(0x104)]===0x0)return console[_0x2c8ff7(0x16d)](_0x2c8ff7(0xc2)),console[_0x2c8ff7(0x16d)](_0x2c8ff7(0x17c)),0x1;const _0x179a23=_0x145d45[0x0],_0x3568ea=_0x448006,_0x3d8cc0=_0x3568ea[_0x2c8ff7(0x128)],_0x211c21=_0x3568ea['dryRun'];try{if(!_0x211c21){const _0x1772bd=_0x5dfbdb[_0x2c8ff7(0xbf)][_0x2c8ff7(0x14e)](_0x179a23),_0x44020e=_0x3d8cc0||_0x1772bd['exportedFrom'][_0x2c8ff7(0x154)],_0x2752c9=await withSpinner(_0x2c8ff7(0x100),()=>_0x5dfbdb[_0x2c8ff7(0xbf)][_0x2c8ff7(0x17a)](),{'verbose':_0x448006[_0x2c8ff7(0x160)]}),_0x472e5b=_0x2752c9[_0x2c8ff7(0xdf)][_0x2c8ff7(0x11d)](_0x5e83bf=>_0x5e83bf['attributes'][_0x2c8ff7(0x128)]===_0x44020e);if(_0x472e5b&&!_0x448006['yes']){const _0x29d557=await confirm(_0x2c8ff7(0xde)+_0x44020e+_0x2c8ff7(0x147));if(!_0x29d557)return console['log'](_0x2c8ff7(0xc5)),0x0;}}const _0x1cfab9=await withSpinner(_0x211c21?_0x2c8ff7(0xb7)+_0x179a23+'\x27...':'Restoring\x20project\x20from\x20\x27'+_0x179a23+_0x2c8ff7(0xdd),()=>_0x5dfbdb[_0x2c8ff7(0xbf)]['restoreProject'](_0x179a23,{'name':_0x3d8cc0,'dryRun':_0x211c21}),{'verbose':_0x448006[_0x2c8ff7(0x160)]}),_0x58aeda=_0x1cfab9[_0x2c8ff7(0xdf)];return _0x58aeda[_0x2c8ff7(0x155)]&&console['log'](_0x2c8ff7(0x176)+_0x58aeda[_0x2c8ff7(0x155)]+'\x27'),_0x211c21?console[_0x2c8ff7(0xe6)](_0x2c8ff7(0x172)+_0x58aeda[_0x2c8ff7(0x154)]):console[_0x2c8ff7(0xe6)]('Project\x20restored:\x20'+_0x58aeda[_0x2c8ff7(0x154)]+'\x20('+_0x58aeda['projectId']+')'),console[_0x2c8ff7(0xe6)](_0x2c8ff7(0xe0)+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0xe8)]),console[_0x2c8ff7(0xe6)]('\x20\x20Knowledge\x20Bases:\x20'+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0x138)]),console[_0x2c8ff7(0xe6)](_0x2c8ff7(0xfc)+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0xb9)]),console[_0x2c8ff7(0xe6)](_0x2c8ff7(0x17b)+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0xbc)]),(_0x448006[_0x2c8ff7(0xb8)]===_0x2c8ff7(0x105)||_0x448006['format']===_0x2c8ff7(0xb6))&&await handleSDKOutput([_0x58aeda],_0x448006),0x0;}catch(_0x374cf5){return handleSDKError(_0x374cf5,_0x448006),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x4aa309,_0xda1fb8){const _0x11724f=a26_0xe05403,_0x590d98=_0xda1fb8[_0x11724f(0xcb)]||CHAT_SELECTOR_PAGE_SIZE;let _0x4d2f73=0x0,_0x4cf4f0=[];const _0x26c4e1=(await import(_0x11724f(0xb9)))['default'],_0x12149f=getChalk(_0xda1fb8);while(!![]){const _0x1e2a89=await withSpinner(_0x11724f(0x106),()=>_0x4aa309[_0x11724f(0xbf)][_0x11724f(0x178)](_0x590d98+_0x4d2f73),{'verbose':_0xda1fb8[_0x11724f(0x160)]});_0x4cf4f0=_0x1e2a89['data'];const _0x3dfb78=_0x4cf4f0[_0x11724f(0x120)](_0x4d2f73,_0x4d2f73+_0x590d98),_0x503539=_0x4cf4f0[_0x11724f(0x104)]>_0x4d2f73+_0x590d98,_0x14ea41=[...new Set(_0x3dfb78[_0x11724f(0x16e)](_0x1371ac=>_0x1371ac['attributes'][_0x11724f(0xd6)])[_0x11724f(0x116)](_0x13db22=>_0x13db22!==undefined))],_0x31a21c=new Map();await Promise[_0x11724f(0xfe)](_0x14ea41['map'](async _0x5e1dec=>{const _0x654de1=_0x11724f;try{const _0x160736=await _0x4aa309[_0x654de1(0xbf)][_0x654de1(0xea)](_0x5e1dec);_0x31a21c['set'](_0x5e1dec,_0x160736['attributes']['name']);}catch{_0x31a21c[_0x654de1(0x137)](_0x5e1dec,_0x5e1dec);}}));const _0x30ae08=_0x3dfb78[_0x11724f(0x16e)](_0x287e63=>{const _0x332694=_0x11724f,_0xded0f3=_0x287e63[_0x332694(0x14b)]['firstInputContent']||_0x332694(0xee),_0x19c5a3=_0xded0f3[_0x332694(0xe4)]('\x0a')[0x0],_0x3a54fb=_0x19c5a3[_0x332694(0x104)]>0x50?_0x19c5a3[_0x332694(0x142)](0x0,0x4d)+_0x332694(0x14a):_0x19c5a3,_0x5ae2b5=_0x287e63[_0x332694(0x14b)][_0x332694(0xd6)]?_0x31a21c[_0x332694(0xae)](_0x287e63['attributes']['agentId'])||_0x287e63[_0x332694(0x14b)][_0x332694(0xd6)]:'(no\x20agent)',_0xab6992=_0x287e63[_0x332694(0x14b)]['lastConversationAt']||_0x287e63[_0x332694(0x14b)]['updatedAt'],_0x39637d=new Date(_0xab6992),_0x125610=new Date(),_0x198a19=_0x125610[_0x332694(0x14c)]()-_0x39637d[_0x332694(0x14c)](),_0x10adc6=Math[_0x332694(0x179)](_0x198a19/0xea60),_0xe9b5ed=Math['floor'](_0x198a19/0x36ee80),_0x331fa4=Math[_0x332694(0x179)](_0x198a19/0x5265c00);let _0x10e789;if(_0x10adc6<0x1)_0x10e789='just\x20now';else{if(_0x10adc6<0x3c)_0x10e789=_0x10adc6+_0x332694(0x11a);else{if(_0xe9b5ed<0x18)_0x10e789=_0xe9b5ed+_0x332694(0x16f);else _0x331fa4<0x7?_0x10e789=_0x331fa4+_0x332694(0x16c):_0x10e789=_0x39637d[_0x332694(0x123)]('en-US',{'month':_0x332694(0xc0),'day':_0x332694(0x11e)});}}return{'title':_0x3a54fb+'\x20'+_0x12149f[_0x332694(0x119)]('['+_0x5ae2b5+']\x20'+_0x10e789),'value':_0x287e63['id']};});_0x503539&&_0x30ae08['push']({'title':_0x12149f[_0x11724f(0x153)](_0x11724f(0xc3)),'value':_0x11724f(0xe2)});const _0x38428b=await _0x26c4e1({'type':_0x11724f(0xb0),'name':'chatId','message':_0x11724f(0x169),'choices':_0x30ae08,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x38428b[_0x11724f(0x11c)])return undefined;if(_0x38428b[_0x11724f(0x11c)]===_0x11724f(0xe2)){_0x4d2f73+=_0x590d98;continue;}return _0x38428b[_0x11724f(0x11c)];}}export class ChatsCommand extends BaseCommand{[a26_0xe05403(0x128)]='chats';[a26_0xe05403(0xec)]=a26_0xe05403(0x136);async['execute'](_0x37bbf7){const _0xed5ec=a26_0xe05403;return executeChatHistoryCommand(_0x37bbf7,_0xed5ec(0xe3));}}