@treasuredata/tdx 0.8.6 → 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 (114) 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.js +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/context-command.js +1 -1
  23. package/dist/commands/databases.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/job-command.js +1 -1
  27. package/dist/commands/journey-command.js +1 -1
  28. package/dist/commands/llm-command.js +1 -1
  29. package/dist/commands/llm-proxy.js +1 -1
  30. package/dist/commands/parent-segment-command.js +1 -1
  31. package/dist/commands/profiles-command.js +1 -1
  32. package/dist/commands/query-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segments.js +1 -1
  41. package/dist/commands/show.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/use-command.js +1 -1
  44. package/dist/commands/user-command.js +1 -1
  45. package/dist/commands/workflow-command.js +1 -1
  46. package/dist/core/auth.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/proxy/anthropic-adapter.js +1 -1
  58. package/dist/proxy/claude-usage-tracker.js +1 -1
  59. package/dist/proxy/context-signature.js +1 -1
  60. package/dist/proxy/conversation-utils.js +1 -1
  61. package/dist/proxy/server.js +1 -1
  62. package/dist/proxy/session-cache.js +1 -1
  63. package/dist/sdk/api.js +1 -1
  64. package/dist/sdk/connection.js +1 -1
  65. package/dist/sdk/engage.js +1 -1
  66. package/dist/sdk/errors.js +1 -1
  67. package/dist/sdk/index.js +1 -1
  68. package/dist/sdk/job.js +1 -1
  69. package/dist/sdk/journey.js +1 -1
  70. package/dist/sdk/llm.js +1 -1
  71. package/dist/sdk/query.js +1 -1
  72. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  73. package/dist/sdk/segment/journey-yaml.js +1 -1
  74. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  75. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  76. package/dist/sdk/segment.js +1 -1
  77. package/dist/sdk/user.js +1 -1
  78. package/dist/sdk/workflow.js +1 -1
  79. package/dist/types/endpoints.js +1 -1
  80. package/dist/types/index.js +1 -1
  81. package/dist/utils/agent-ref-parser.js +1 -1
  82. package/dist/utils/async.js +1 -1
  83. package/dist/utils/chat-cache.js +1 -1
  84. package/dist/utils/colors.js +1 -1
  85. package/dist/utils/command-output.js +1 -1
  86. package/dist/utils/constants.js +1 -1
  87. package/dist/utils/diff.js +1 -1
  88. package/dist/utils/fields-display.js +1 -1
  89. package/dist/utils/file-permissions.js +1 -1
  90. package/dist/utils/format-detector.js +1 -1
  91. package/dist/utils/formatters.js +1 -1
  92. package/dist/utils/json-loader.js +1 -1
  93. package/dist/utils/llm-backup-utils.js +1 -1
  94. package/dist/utils/model-aliases.js +1 -1
  95. package/dist/utils/model-factors.js +1 -1
  96. package/dist/utils/option-validation.js +1 -1
  97. package/dist/utils/port.js +1 -1
  98. package/dist/utils/process.d.ts.map +1 -1
  99. package/dist/utils/process.js +1 -1
  100. package/dist/utils/process.js.map +1 -1
  101. package/dist/utils/prompt.js +1 -1
  102. package/dist/utils/segment-path-parser.js +1 -1
  103. package/dist/utils/segment-ref-parser.js +1 -1
  104. package/dist/utils/spinner.js +1 -1
  105. package/dist/utils/sql-parser.js +1 -1
  106. package/dist/utils/sse-parser.js +1 -1
  107. package/dist/utils/string-utils.js +1 -1
  108. package/dist/utils/table-ref-parser.js +1 -1
  109. package/dist/utils/tdx-config.js +1 -1
  110. package/dist/utils/tdx-logger.js +1 -1
  111. package/dist/utils/tree-formatter.js +1 -1
  112. package/dist/utils/version-check.js +1 -1
  113. package/dist/utils/workflow-utils.js +1 -1
  114. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0xfe851f=a23_0x4a10;(function(_0x474033,_0x43a87c){const _0x38e345=a23_0x4a10,_0x348356=_0x474033();while(!![]){try{const _0x30ef87=parseInt(_0x38e345(0x1ff))/0x1+-parseInt(_0x38e345(0x1ea))/0x2+parseInt(_0x38e345(0x1f2))/0x3*(-parseInt(_0x38e345(0x1fc))/0x4)+parseInt(_0x38e345(0x1e5))/0x5*(parseInt(_0x38e345(0x1a9))/0x6)+parseInt(_0x38e345(0x20c))/0x7*(-parseInt(_0x38e345(0x1c2))/0x8)+parseInt(_0x38e345(0x183))/0x9+-parseInt(_0x38e345(0x1a7))/0xa*(-parseInt(_0x38e345(0x18f))/0xb);if(_0x30ef87===_0x43a87c)break;else _0x348356['push'](_0x348356['shift']());}catch(_0x4bcc94){_0x348356['push'](_0x348356['shift']());}}}(a23_0x30a6,0xbf831));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x1e05cf,_0x29b856,_0x3c01d8=![]){const _0x174e5d=a23_0x4a10;if(_0x1e05cf[_0x174e5d(0x184)])return await _0x29b856[_0x174e5d(0x208)][_0x174e5d(0x1c9)](_0x1e05cf[_0x174e5d(0x184)]);const _0x18959a=loadSessionContext(_0x1e05cf[_0x174e5d(0x175)]);if(_0x18959a?.[_0x174e5d(0x1f7)])return await _0x29b856[_0x174e5d(0x208)][_0x174e5d(0x1c9)](_0x18959a['engage_workspace']);if(_0x3c01d8)throw new SDKError(ErrorCode[_0x174e5d(0x193)],_0x174e5d(0x1f4),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x149fc7,_0x51ad0c){const _0x21d9f4=a23_0x4a10;if(!_0x149fc7[_0x21d9f4(0x1de)])return{};const _0x1631dd=_0x149fc7[_0x21d9f4(0x1de)],_0x2f4fa1=await _0x51ad0c[_0x21d9f4(0x1de)][_0x21d9f4(0x1cb)](_0x1631dd);return{'audienceId':_0x2f4fa1[_0x21d9f4(0x1d0)],'audienceName':_0x2f4fa1[_0x21d9f4(0x1ce)],..._0x2f4fa1['segmentId']&&{'segmentId':_0x2f4fa1[_0x21d9f4(0x1d6)],'segmentName':_0x2f4fa1[_0x21d9f4(0x1c8)]}};}function buildConnectorConfig(_0xf4d11){const _0x5db7d3=a23_0x4a10,_0x4c76d4=_0xf4d11[_0x5db7d3(0x1bd)],_0x38a279=_0xf4d11[_0x5db7d3(0x1d4)];if(!_0x4c76d4&&!_0x38a279)return undefined;return{..._0x4c76d4&&{'emailSenderId':_0x4c76d4},..._0x38a279&&{'jsonColumns':_0x38a279}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x198);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ae);async[a23_0xfe851f(0x181)](_0x3c1f92){const _0x4d0d7e=a23_0xfe851f,{options:_0x123beb,args:_0x41f9e6,tdx:_0x1c4042}=_0x3c1f92,_0x596af2=_0x41f9e6[0x0],_0x40812c=resolveLimit(_0x123beb[_0x4d0d7e(0x186)],DEFAULT_LLM_LIMIT),_0x13ec93=_0x123beb,_0x29eaf8=_0x13ec93[_0x4d0d7e(0x1b1)],_0x35febb=_0x13ec93[_0x4d0d7e(0x1a0)],_0x1f1de5=await resolveWorkspaceIdFromOptions(_0x13ec93,_0x1c4042),_0x463432=await withSpinner(_0x4d0d7e(0x187),()=>_0x1c4042[_0x4d0d7e(0x208)][_0x4d0d7e(0x1f9)]({'type':_0x29eaf8,'status':_0x35febb,'workspaceId':_0x1f1de5,'limit':_0x40812c}),{'verbose':_0x123beb[_0x4d0d7e(0x1e9)]});let _0x1c6e09=_0x463432[_0x4d0d7e(0x1bb)];return _0x596af2&&(_0x1c6e09=_0x463432[_0x4d0d7e(0x1bb)]['filter'](_0x64ebc2=>matchGlobPattern(_0x64ebc2[_0x4d0d7e(0x1e3)],_0x596af2))),await handleSDKOutput(_0x1c6e09,_0x123beb),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']='engage:campaign:show';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x189);async[a23_0xfe851f(0x181)](_0x1c7c50){const _0x30a382=a23_0xfe851f,{options:_0x48927c,args:_0x7cf4d4,tdx:_0x200a33}=_0x1c7c50;if(_0x7cf4d4[_0x30a382(0x1ad)]===0x0)return console[_0x30a382(0x17f)](_0x30a382(0x1a1)),console[_0x30a382(0x17f)](_0x30a382(0x202)),0x1;const _0x4406ba=_0x7cf4d4[0x0],_0x3dae08=_0x48927c,_0x10d6b9=await resolveWorkspaceIdFromOptions(_0x3dae08,_0x200a33),_0x5be8e1=_0x3dae08[_0x30a382(0x1d2)];if(_0x5be8e1){const _0x4c1394=await withSpinner(_0x30a382(0x17d)+_0x4406ba+_0x30a382(0x177),()=>_0x200a33[_0x30a382(0x208)][_0x30a382(0x17e)](_0x4406ba,_0x10d6b9),{'verbose':_0x48927c['verbose']});await handleSDKOutput([_0x4c1394],_0x48927c);}else{const _0x44ffde=await withSpinner(_0x30a382(0x17d)+_0x4406ba+_0x30a382(0x177),()=>_0x200a33['engage'][_0x30a382(0x207)](_0x4406ba,_0x10d6b9),{'verbose':_0x48927c[_0x30a382(0x1e9)]});await handleSDKOutput([_0x44ffde],_0x48927c);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x205);['description']=a23_0xfe851f(0x1b2);async['execute'](_0x5c26fe){const _0x17b13a=a23_0xfe851f,{options:_0x23fe74,tdx:_0x48d3e5}=_0x5c26fe,_0x5b0166=_0x23fe74,_0x995946=_0x5b0166[_0x17b13a(0x1e3)],_0x4c90e2=_0x5b0166[_0x17b13a(0x1b1)];if(!_0x995946)return console[_0x17b13a(0x17f)](_0x17b13a(0x1d9)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x4c90e2)return console[_0x17b13a(0x17f)]('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x17b13a(0x17f)](_0x17b13a(0x179)),0x1;const _0x3c3e80=await resolveWorkspaceIdFromOptions(_0x5b0166,_0x48d3e5,!![]),_0x1f3757=await resolveSegmentFromOptions(_0x5b0166,_0x48d3e5),_0x56b3a7=buildConnectorConfig(_0x5b0166),_0x22f3bb={'name':_0x995946,'campaignType':_0x4c90e2,'workspaceId':_0x3c3e80,'description':_0x5b0166[_0x17b13a(0x1e0)],..._0x1f3757,'connectorConfig':_0x56b3a7,'startAt':_0x5b0166[_0x17b13a(0x19a)],'timezone':_0x5b0166[_0x17b13a(0x197)]},_0x327015=await withSpinner(_0x17b13a(0x192)+_0x995946+_0x17b13a(0x177),()=>_0x48d3e5[_0x17b13a(0x208)][_0x17b13a(0x1b6)](_0x22f3bb));return await handleSDKOutput([_0x327015[_0x17b13a(0x1bb)]],_0x23fe74),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1db);['description']=a23_0xfe851f(0x1e2);async[a23_0xfe851f(0x181)](_0x4b8c0c){const _0x1d060c=a23_0xfe851f,{options:_0x501f36,args:_0x5cf2ab,tdx:_0x158e9d}=_0x4b8c0c;if(_0x5cf2ab[_0x1d060c(0x1ad)]===0x0)return console['error'](_0x1d060c(0x1a1)),console[_0x1d060c(0x17f)](_0x1d060c(0x1fd)),0x1;const _0x7bcee1=_0x5cf2ab[0x0],_0x257c24=_0x501f36,_0xff331f=await resolveWorkspaceIdFromOptions(_0x257c24,_0x158e9d),_0x844fbd=await resolveSegmentFromOptions(_0x257c24,_0x158e9d),_0x316c80=buildConnectorConfig(_0x257c24),_0x3bd4d0={'name':_0x257c24['name'],'description':_0x257c24[_0x1d060c(0x1e0)],..._0x844fbd,'connectorConfig':_0x316c80,'startAt':_0x257c24[_0x1d060c(0x19a)],'timezone':_0x257c24[_0x1d060c(0x197)]},_0x8c15da=Object['fromEntries'](Object[_0x1d060c(0x1c1)](_0x3bd4d0)[_0x1d060c(0x209)](([,_0x4747c3])=>_0x4747c3!==undefined));if(Object[_0x1d060c(0x188)](_0x8c15da)['length']===0x0)return console[_0x1d060c(0x17f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x1d060c(0x17f)](_0x1d060c(0x1be)),0x1;const _0x332169=await withSpinner(_0x1d060c(0x18d)+_0x7bcee1+_0x1d060c(0x177),()=>_0x158e9d[_0x1d060c(0x208)][_0x1d060c(0x1b4)](_0x7bcee1,_0x8c15da,_0xff331f),{'verbose':_0x501f36[_0x1d060c(0x1e9)]});return await handleSDKOutput([_0x332169['data']],_0x501f36),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1dc);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1b3);async[a23_0xfe851f(0x181)](_0x4c4de4){const _0x3e0d0d=a23_0xfe851f,{options:_0x3a4db3,args:_0xd83545,tdx:_0x372e07}=_0x4c4de4;if(_0xd83545['length']===0x0)return console[_0x3e0d0d(0x17f)](_0x3e0d0d(0x1a1)),console['error'](_0x3e0d0d(0x1f8)),0x1;const _0x161b32=_0xd83545[0x0],_0x4e5207=_0x3a4db3,_0x4c8105=await resolveWorkspaceIdFromOptions(_0x4e5207,_0x372e07);if(!_0x3a4db3[_0x3e0d0d(0x19f)]){const _0x38da00=await confirm(_0x3e0d0d(0x18e)+_0x161b32+_0x3e0d0d(0x200));if(!_0x38da00)return console[_0x3e0d0d(0x1a2)](_0x3e0d0d(0x17a)),0x0;}return await withSpinner(_0x3e0d0d(0x18b)+_0x161b32+_0x3e0d0d(0x177),()=>_0x372e07[_0x3e0d0d(0x208)][_0x3e0d0d(0x1d5)](_0x161b32,_0x4c8105),{'verbose':_0x3a4db3['verbose']}),console[_0x3e0d0d(0x1a2)]('Campaign\x20\x27'+_0x161b32+_0x3e0d0d(0x1fb)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1ee);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x195);async[a23_0xfe851f(0x181)](_0x324c87){const _0x43a8bc=a23_0xfe851f,{options:_0xec244e,args:_0x9a54b3,tdx:_0x4aeeb4}=_0x324c87;if(_0x9a54b3[_0x43a8bc(0x1ad)]===0x0)return console['error'](_0x43a8bc(0x1a1)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x5c138a=_0x9a54b3[0x0],_0x567911=_0xec244e,_0x592931=await resolveWorkspaceIdFromOptions(_0x567911,_0x4aeeb4);return await withSpinner(_0x43a8bc(0x1d3)+_0x5c138a+_0x43a8bc(0x177),()=>_0x4aeeb4[_0x43a8bc(0x208)][_0x43a8bc(0x17b)](_0x5c138a,_0x592931),{'verbose':_0xec244e[_0x43a8bc(0x1e9)]}),console['log'](_0x43a8bc(0x19b)+_0x5c138a+_0x43a8bc(0x1fa)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1e6);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1e8);async[a23_0xfe851f(0x181)](_0xd71379){const _0x3fe876=a23_0xfe851f,{options:_0x5e920d,args:_0x114e8a,tdx:_0x82199d}=_0xd71379;if(_0x114e8a[_0x3fe876(0x1ad)]===0x0)return console['error'](_0x3fe876(0x1a1)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x76bc9c=_0x114e8a[0x0],_0x39f24d=_0x5e920d,_0x369c66=await resolveWorkspaceIdFromOptions(_0x39f24d,_0x82199d);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x76bc9c+'\x27...',()=>_0x82199d['engage']['pauseCampaign'](_0x76bc9c,_0x369c66),{'verbose':_0x5e920d[_0x3fe876(0x1e9)]}),console[_0x3fe876(0x1a2)](_0x3fe876(0x19b)+_0x76bc9c+_0x3fe876(0x190)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x201);[a23_0xfe851f(0x1e0)]='Resume\x20a\x20paused\x20campaign';async['execute'](_0x1dc459){const _0x11b039=a23_0xfe851f,{options:_0x20aee9,args:_0x33a887,tdx:_0x149863}=_0x1dc459;if(_0x33a887[_0x11b039(0x1ad)]===0x0)return console[_0x11b039(0x17f)](_0x11b039(0x1a1)),console[_0x11b039(0x17f)](_0x11b039(0x1b7)),0x1;const _0x42df34=_0x33a887[0x0],_0x1bc725=_0x20aee9,_0x1e01d0=await resolveWorkspaceIdFromOptions(_0x1bc725,_0x149863);return await withSpinner(_0x11b039(0x206)+_0x42df34+_0x11b039(0x177),()=>_0x149863[_0x11b039(0x208)][_0x11b039(0x19e)](_0x42df34,_0x1e01d0),{'verbose':_0x20aee9[_0x11b039(0x1e9)]}),console['log'](_0x11b039(0x19b)+_0x42df34+_0x11b039(0x18a)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']='engage:campaign:duplicate';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1f0);async[a23_0xfe851f(0x181)](_0x1448cf){const _0x273d31=a23_0xfe851f,{options:_0x1f7a6e,args:_0x3e42f7,tdx:_0x427bc7}=_0x1448cf;if(_0x3e42f7[_0x273d31(0x1ad)]===0x0)return console[_0x273d31(0x17f)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x273d31(0x17f)](_0x273d31(0x1a6)),0x1;const _0x58d630=_0x3e42f7[0x0],_0x23e073=_0x1f7a6e,_0x2fcb12=await resolveWorkspaceIdFromOptions(_0x23e073,_0x427bc7),_0x2a405f=await withSpinner(_0x273d31(0x1fe)+_0x58d630+_0x273d31(0x177),()=>_0x427bc7[_0x273d31(0x208)][_0x273d31(0x182)](_0x58d630,_0x2fcb12),{'verbose':_0x1f7a6e[_0x273d31(0x1e9)]});return await handleSDKOutput([_0x2a405f[_0x273d31(0x1bb)]],_0x1f7a6e),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1f5);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x20a);async[a23_0xfe851f(0x181)](_0x464082){const _0x10e1f2=a23_0xfe851f,{options:_0x1a7469,args:_0x1ef6e0,tdx:_0x49de5c}=_0x464082,_0x6d5e7e=_0x1ef6e0[0x0],_0x14a001=resolveLimit(_0x1a7469[_0x10e1f2(0x186)],DEFAULT_LLM_LIMIT),_0x570422=_0x1a7469,_0x509d0d=await resolveWorkspaceIdFromOptions(_0x570422,_0x49de5c),_0x100a1b=await withSpinner(_0x10e1f2(0x1ca),()=>_0x49de5c[_0x10e1f2(0x208)]['listTemplates']({'workspaceId':_0x509d0d,'limit':_0x14a001}),{'verbose':_0x1a7469[_0x10e1f2(0x1e9)]});let _0x54479d=_0x100a1b[_0x10e1f2(0x1bb)];return _0x6d5e7e&&(_0x54479d=_0x100a1b[_0x10e1f2(0x1bb)][_0x10e1f2(0x209)](_0x242157=>matchGlobPattern(_0x242157['name'],_0x6d5e7e))),await handleSDKOutput(_0x54479d,_0x1a7469),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1f6);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ba);async[a23_0xfe851f(0x181)](_0x170f58){const _0x38de76=a23_0xfe851f,{options:_0x56bc3e,args:_0x166f48,tdx:_0x33b128}=_0x170f58;if(_0x166f48[_0x38de76(0x1ad)]===0x0)return console[_0x38de76(0x17f)](_0x38de76(0x1c7)),console['error'](_0x38de76(0x1b0)),0x1;const _0x37ae96=_0x166f48[0x0],_0x385d47=_0x56bc3e,_0x298f0a=await resolveWorkspaceIdFromOptions(_0x385d47,_0x33b128),_0x2306bf=_0x385d47[_0x38de76(0x1d2)];if(_0x2306bf){const _0x1b7791=await withSpinner('Fetching\x20template\x20\x27'+_0x37ae96+_0x38de76(0x177),()=>_0x33b128['engage'][_0x38de76(0x1df)](_0x37ae96,_0x298f0a),{'verbose':_0x56bc3e['verbose']});await handleSDKOutput([_0x1b7791],_0x56bc3e);}else{const _0x301dcd=await withSpinner('Fetching\x20template\x20\x27'+_0x37ae96+_0x38de76(0x177),()=>_0x33b128[_0x38de76(0x208)][_0x38de76(0x1ef)](_0x37ae96,_0x298f0a),{'verbose':_0x56bc3e[_0x38de76(0x1e9)]});await handleSDKOutput([_0x301dcd],_0x56bc3e);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1eb);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1cd);async['execute'](_0x2a9ee6){const _0x5c40d5=a23_0xfe851f,{options:_0x2a77dc,tdx:_0x2e8953}=_0x2a9ee6,_0x3c13b2=_0x2a77dc,_0x6b474d=_0x3c13b2[_0x5c40d5(0x1e3)],_0x342f30=_0x3c13b2[_0x5c40d5(0x1cc)],_0x4a0799=_0x3c13b2['html'];if(!_0x6b474d)return console[_0x5c40d5(0x17f)](_0x5c40d5(0x1d9)),console[_0x5c40d5(0x17f)](_0x5c40d5(0x1e4)),0x1;if(!_0x342f30)return console[_0x5c40d5(0x17f)](_0x5c40d5(0x1bc)),0x1;if(!_0x4a0799)return console[_0x5c40d5(0x17f)]('Error:\x20--html\x20is\x20required'),0x1;const _0x21c465=await resolveWorkspaceIdFromOptions(_0x3c13b2,_0x2e8953,!![]),_0x52ca8f={'name':_0x6b474d,'subjectTemplate':_0x342f30,'htmlTemplate':_0x4a0799,'workspaceId':_0x21c465,'plaintextTemplate':_0x3c13b2[_0x5c40d5(0x1c0)],'editorType':_0x3c13b2[_0x5c40d5(0x1c4)]},_0x3cee6f=await withSpinner(_0x5c40d5(0x1cf)+_0x6b474d+_0x5c40d5(0x177),()=>_0x2e8953[_0x5c40d5(0x208)][_0x5c40d5(0x199)](_0x52ca8f));return await handleSDKOutput([_0x3cee6f[_0x5c40d5(0x1bb)]],_0x2a77dc),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:template:update';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1d1);async[a23_0xfe851f(0x181)](_0x5dde6a){const _0x444025=a23_0xfe851f,{options:_0x2e9a13,args:_0x3c001e,tdx:_0x5d80be}=_0x5dde6a;if(_0x3c001e[_0x444025(0x1ad)]===0x0)return console[_0x444025(0x17f)](_0x444025(0x1c7)),console['error'](_0x444025(0x1dd)),0x1;const _0x4af31c=_0x3c001e[0x0],_0x48c5f0=_0x2e9a13,_0x4176fe=await resolveWorkspaceIdFromOptions(_0x48c5f0,_0x5d80be),_0x1f7ad0={'name':_0x48c5f0[_0x444025(0x1e3)],'subjectTemplate':_0x48c5f0[_0x444025(0x1cc)],'htmlTemplate':_0x48c5f0['html'],'plaintextTemplate':_0x48c5f0[_0x444025(0x1c0)]},_0x13b7b9=Object[_0x444025(0x1a5)](Object[_0x444025(0x1c1)](_0x1f7ad0)[_0x444025(0x209)](([,_0xf8ab72])=>_0xf8ab72!==undefined));if(Object['keys'](_0x13b7b9)[_0x444025(0x1ad)]===0x0)return console[_0x444025(0x17f)](_0x444025(0x19c)),console[_0x444025(0x17f)](_0x444025(0x1af)),0x1;const _0x52b9b9=await withSpinner('Updating\x20template\x20\x27'+_0x4af31c+_0x444025(0x177),()=>_0x5d80be[_0x444025(0x208)]['updateTemplate'](_0x4af31c,_0x13b7b9,_0x4176fe),{'verbose':_0x2e9a13[_0x444025(0x1e9)]});return await handleSDKOutput([_0x52b9b9[_0x444025(0x1bb)]],_0x2e9a13),0x0;}}function a23_0x4a10(_0x10aa82,_0x2e547c){_0x10aa82=_0x10aa82-0x175;const _0x30a6ea=a23_0x30a6();let _0x4a10e5=_0x30a6ea[_0x10aa82];return _0x4a10e5;}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:template:delete';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ab);async[a23_0xfe851f(0x181)](_0x5aa347){const _0x1fe0a2=a23_0xfe851f,{options:_0x52e542,args:_0x4e9818,tdx:_0x951570}=_0x5aa347;if(_0x4e9818[_0x1fe0a2(0x1ad)]===0x0)return console[_0x1fe0a2(0x17f)](_0x1fe0a2(0x1c7)),console[_0x1fe0a2(0x17f)](_0x1fe0a2(0x20b)),0x1;const _0x3f95e3=_0x4e9818[0x0],_0x4474b0=_0x52e542,_0x5de7d3=await resolveWorkspaceIdFromOptions(_0x4474b0,_0x951570);if(!_0x52e542[_0x1fe0a2(0x19f)]){const _0x4b2dd3=await confirm(_0x1fe0a2(0x1f3)+_0x3f95e3+_0x1fe0a2(0x200));if(!_0x4b2dd3)return console[_0x1fe0a2(0x1a2)](_0x1fe0a2(0x17a)),0x0;}return await withSpinner(_0x1fe0a2(0x203)+_0x3f95e3+_0x1fe0a2(0x177),()=>_0x951570[_0x1fe0a2(0x208)][_0x1fe0a2(0x1d7)](_0x3f95e3,_0x5de7d3),{'verbose':_0x52e542[_0x1fe0a2(0x1e9)]}),console['log'](_0x1fe0a2(0x1e1)+_0x3f95e3+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a23_0xfe851f(0x19d);[a23_0xfe851f(0x1e0)]='List\x20workspaces';async[a23_0xfe851f(0x181)](_0x20656a){const _0x1ac69c=a23_0xfe851f,{options:_0x345fe4,args:_0x581086,tdx:_0x59a8c0}=_0x20656a,_0x2a753d=_0x581086[0x0],_0x3077ad=resolveLimit(_0x345fe4[_0x1ac69c(0x186)],DEFAULT_LLM_LIMIT),_0x5775b1=await withSpinner('Fetching\x20workspaces...',()=>_0x59a8c0['engage'][_0x1ac69c(0x1ed)]({'limit':_0x3077ad}),{'verbose':_0x345fe4[_0x1ac69c(0x1e9)]});let _0x140236=_0x5775b1[_0x1ac69c(0x1bb)];return _0x2a753d&&(_0x140236=_0x5775b1[_0x1ac69c(0x1bb)][_0x1ac69c(0x209)](_0x42ece4=>matchGlobPattern(_0x42ece4[_0x1ac69c(0x1e3)],_0x2a753d))),await handleSDKOutput(_0x140236,_0x345fe4),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:workspace:show';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a8);async[a23_0xfe851f(0x181)](_0x183a4f){const _0x2d59d9=a23_0xfe851f,{options:_0x13afa0,args:_0x1ed951,tdx:_0x5c0950}=_0x183a4f;if(_0x1ed951['length']===0x0)return console[_0x2d59d9(0x17f)](_0x2d59d9(0x1c5)),console[_0x2d59d9(0x17f)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x14d6c=_0x1ed951[0x0],_0x5d89f6=_0x13afa0,_0xd0cbc0=_0x5d89f6['full'];if(_0xd0cbc0){const _0x5f1182=await withSpinner(_0x2d59d9(0x1f1)+_0x14d6c+'\x27...',()=>_0x5c0950[_0x2d59d9(0x208)]['getWorkspaceFull'](_0x14d6c),{'verbose':_0x13afa0['verbose']});await handleSDKOutput([_0x5f1182],_0x13afa0);}else{const _0x2ca07e=await withSpinner('Fetching\x20workspace\x20\x27'+_0x14d6c+'\x27...',()=>_0x5c0950[_0x2d59d9(0x208)][_0x2d59d9(0x185)](_0x14d6c),{'verbose':_0x13afa0['verbose']});await handleSDKOutput([_0x2ca07e],_0x13afa0);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1ac);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a4);async['execute'](_0x3c3136){const _0x13f8bb=a23_0xfe851f,{options:_0x39d5cf,tdx:_0x50d073}=_0x3c3136,_0x260195=_0x39d5cf,_0x2db5d0=_0x260195[_0x13f8bb(0x1e3)];if(!_0x2db5d0)return console[_0x13f8bb(0x17f)]('Error:\x20--name\x20is\x20required'),console[_0x13f8bb(0x17f)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x5341bb={'name':_0x2db5d0,'description':_0x260195[_0x13f8bb(0x1e0)]},_0x1ba220=await withSpinner(_0x13f8bb(0x1c6)+_0x2db5d0+_0x13f8bb(0x177),()=>_0x50d073[_0x13f8bb(0x208)][_0x13f8bb(0x1aa)](_0x5341bb));return await handleSDKOutput([_0x1ba220[_0x13f8bb(0x1bb)]],_0x39d5cf),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a23_0xfe851f(0x18c);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a3);async[a23_0xfe851f(0x181)](_0x5d6815){const _0x3cd220=a23_0xfe851f,{options:_0x4c4864,args:_0x29a4f4,tdx:_0x246783}=_0x5d6815;if(_0x29a4f4[_0x3cd220(0x1ad)]===0x0)return console[_0x3cd220(0x17f)](_0x3cd220(0x1c5)),console[_0x3cd220(0x17f)](_0x3cd220(0x1c3)),0x1;const _0x27346c=_0x29a4f4[0x0],_0x470a7a=_0x4c4864,_0x2d61b2={'name':_0x470a7a['name'],'description':_0x470a7a[_0x3cd220(0x1e0)]},_0x2b4fe2=Object[_0x3cd220(0x1a5)](Object[_0x3cd220(0x1c1)](_0x2d61b2)[_0x3cd220(0x209)](([,_0x223899])=>_0x223899!==undefined));if(Object[_0x3cd220(0x188)](_0x2b4fe2)[_0x3cd220(0x1ad)]===0x0)return console[_0x3cd220(0x17f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3cd220(0x17f)](_0x3cd220(0x178)),0x1;const _0x2ec8a3=await withSpinner(_0x3cd220(0x1b8)+_0x27346c+_0x3cd220(0x177),()=>_0x246783['engage'][_0x3cd220(0x196)](_0x27346c,_0x2b4fe2),{'verbose':_0x4c4864[_0x3cd220(0x1e9)]});return await handleSDKOutput([_0x2ec8a3[_0x3cd220(0x1bb)]],_0x4c4864),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']=a23_0xfe851f(0x204);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1e7);async['execute'](_0xa8a20c){const _0x86764c=a23_0xfe851f,{options:_0xfa08f4,args:_0x2f3095,tdx:_0x1744bc}=_0xa8a20c;if(_0x2f3095['length']===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x86764c(0x1b5)),0x1;const _0x214c03=_0x2f3095[0x0];if(!_0xfa08f4[_0x86764c(0x19f)]){const _0x10265e=await confirm(_0x86764c(0x191)+_0x214c03+_0x86764c(0x200));if(!_0x10265e)return console[_0x86764c(0x1a2)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x86764c(0x1da)+_0x214c03+_0x86764c(0x177),()=>_0x1744bc[_0x86764c(0x208)][_0x86764c(0x176)](_0x214c03),{'verbose':_0xfa08f4[_0x86764c(0x1e9)]}),console[_0x86764c(0x1a2)](_0x86764c(0x1b9)+_0x214c03+_0x86764c(0x1fb)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x194);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ec);async[a23_0xfe851f(0x181)](_0x3df204){const _0xc04702=a23_0xfe851f,{options:_0x3cb49b,args:_0x361d7c,tdx:_0x2fcdf6}=_0x3df204;if(_0x361d7c[_0xc04702(0x1ad)]===0x0)return console[_0xc04702(0x17f)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0xc04702(0x17f)](_0xc04702(0x1d8)),0x1;const _0x14a1e1=_0x361d7c[0x0];await withSpinner(_0xc04702(0x17c)+_0x14a1e1+_0xc04702(0x177),()=>_0x2fcdf6[_0xc04702(0x208)][_0xc04702(0x1c9)](_0x14a1e1));const _0x1547ba=_0x3cb49b['session']||undefined;return saveSessionContext({'engage_workspace':_0x14a1e1},_0x1547ba),console['log'](_0xc04702(0x1bf)+_0x14a1e1),console[_0xc04702(0x1a2)](_0xc04702(0x180)),0x0;}}function a23_0x30a6(){const _0x181fa2=['createTemplate','startAt','Campaign\x20\x27','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:workspaces','resumeCampaign','yes','status','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','log','Update\x20a\x20workspace','Create\x20a\x20workspace','fromEntries','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','20pAlxxa','Show\x20workspace\x20details','3138438yeSCVi','createWorkspace','Delete\x20an\x20email\x20template','engage:workspace:create','length','List\x20campaigns','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','type','Create\x20a\x20new\x20campaign','Delete\x20a\x20campaign','updateCampaign','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','createCampaign','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Updating\x20workspace\x20\x27','Workspace\x20\x27','Show\x20email\x20template\x20details','data','Error:\x20--subject\x20is\x20required','emailSenderId','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Engage\x20workspace\x20set\x20to:\x20','plaintext','entries','6438984EgZGcr','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','editorType','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Creating\x20workspace\x20\x27','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','segmentName','resolveWorkspaceId','Fetching\x20templates...','resolvePathToResource','subject','Create\x20an\x20email\x20template','parentName','Creating\x20template\x20\x27','parentId','Update\x20an\x20email\x20template','full','Launching\x20campaign\x20\x27','jsonColumns','deleteCampaign','segmentId','deleteTemplate','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Error:\x20--name\x20is\x20required','Deleting\x20workspace\x20\x27','engage:campaign:update','engage:campaign:delete','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','segment','getTemplateFull','description','Template\x20\x27','Update\x20a\x20campaign','name','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','5fjYkCa','engage:campaign:pause','Delete\x20a\x20workspace','Pause\x20a\x20campaign','verbose','2174194nebNrp','engage:template:create','Set\x20workspace\x20context\x20for\x20Engage\x20commands','listWorkspaces','engage:campaign:launch','getTemplate','Duplicate\x20a\x20campaign','Fetching\x20workspace\x20\x27','4305174jmzEZT','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Workspace\x20is\x20required\x20for\x20this\x20operation','engage:templates','engage:template:show','engage_workspace','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','listCampaigns','\x27\x20launched\x20successfully','\x27\x20deleted\x20successfully','4zRluBu','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Duplicating\x20campaign\x20\x27','222321sslZtv','\x27?\x20This\x20cannot\x20be\x20undone.','engage:campaign:resume','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Deleting\x20template\x20\x27','engage:workspace:delete','engage:campaign:create','Resuming\x20campaign\x20\x27','getCampaign','engage','filter','List\x20email\x20templates','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','7Eextem','session','deleteWorkspace','\x27...','Options:\x20--name,\x20--description','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Operation\x20cancelled','launchCampaign','Verifying\x20workspace\x20\x27','Fetching\x20campaign\x20\x27','getCampaignFull','error','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','execute','duplicateCampaign','11601873lRdqte','workspace','getWorkspace','limit','Fetching\x20campaigns...','keys','Show\x20campaign\x20details','\x27\x20resumed\x20successfully','Deleting\x20campaign\x20\x27','engage:workspace:update','Updating\x20campaign\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','11423335uuceHk','\x27\x20paused\x20successfully','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Creating\x20campaign\x20\x27','MISSING_ARGUMENT','engage:workspace:use','Launch\x20a\x20campaign','updateWorkspace','timezone','engage:campaigns'];a23_0x30a6=function(){return _0x181fa2;};return a23_0x30a6();}
1
+ const a23_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_0x118125=a24_0x29b0;(function(_0x23bd42,_0x715e86){const _0x25f636=a24_0x29b0,_0x105e89=_0x23bd42();while(!![]){try{const _0x339801=-parseInt(_0x25f636(0x1bc))/0x1*(-parseInt(_0x25f636(0x1cb))/0x2)+parseInt(_0x25f636(0x1c1))/0x3+-parseInt(_0x25f636(0x1de))/0x4+parseInt(_0x25f636(0x1a9))/0x5*(-parseInt(_0x25f636(0x1b8))/0x6)+-parseInt(_0x25f636(0x1a5))/0x7*(parseInt(_0x25f636(0x1dd))/0x8)+-parseInt(_0x25f636(0x1da))/0x9+parseInt(_0x25f636(0x1cc))/0xa;if(_0x339801===_0x715e86)break;else _0x105e89['push'](_0x105e89['shift']());}catch(_0x47a030){_0x105e89['push'](_0x105e89['shift']());}}}(a24_0x3d55,0xbec57));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a24_0x3d55(){const _0xcb41=['Submitting\x20kill\x20request...','round','verbose','debug','✔\x20Retrieved\x20','Usage:\x20job\x20show\x20<job-id>','50KDERWe','18781870dWylNm','job_id','trino','show','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','limit','Get\x20job\x20results','Database:\x20','Usage:\x20job\x20kill\x20<job-id>','\x20\x20Job\x20ID:\x20','description','file','name','database','8642889tKvBcA','Kill\x20a\x20job','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','1416GFyCuy','2134100tzufut','start_at','\x20jobs','type','information_schema','length','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','hive','...','submit','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Submitting\x20job...','user_name','job:kill','kill','list','cause','jobType','message','Error:\x20','List\x20jobs','created_at','10402XZYGwN','job:submit','\x20job','job:result','5OWnAWQ','query','error','priority','execute','jobs','url','Submit\x20a\x20job','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','\x20\x20Cause:\x20','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Job\x20type:\x20','Listing\x20jobs...','getTime','end_at','1319250TZzxar','✔\x20Job\x20submitted','\x20row','Limit:\x20','397UUOFZo','status','result','Error:\x20Query\x20is\x20required','Getting\x20job\x20details...','2610090vkGvHZ','Show\x20job\x20details','Error:\x20Job\x20ID\x20is\x20required','data'];a24_0x3d55=function(){return _0xcb41;};return a24_0x3d55();}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x118125(0x1d8)]='jobs';[a24_0x118125(0x1d6)]=a24_0x118125(0x1a3);async[a24_0x118125(0x1ad)](_0x2e01c3){const _0x361732=a24_0x118125,{options:_0x3c572c,tdx:_0x106659}=_0x2e01c3;try{const _0x4dc6dc=resolveLimit(_0x3c572c[_0x361732(0x1d1)],DEFAULT_DISPLAY_LIMIT),_0x5f01c7=_0x3c572c['status'];_0x3c572c[_0x361732(0x1c7)]&&(console['error'](_0x361732(0x1bb)+_0x4dc6dc+_0x361732(0x1e0)),_0x5f01c7&&console[_0x361732(0x1ab)]('Status\x20filter:\x20'+_0x5f01c7));const _0x1c5f77=await withSpinner(_0x361732(0x1b5),()=>_0x106659[_0x361732(0x1ae)][_0x361732(0x1ed)]({'from':0x0,'to':_0x4dc6dc-0x1,'status':_0x5f01c7}),{'verbose':_0x3c572c[_0x361732(0x1c7)]}),_0x2b723a=_0x1c5f77['data'];console[_0x361732(0x1ab)]('✔\x20Found\x20'+_0x2b723a[_0x361732(0x1e3)]+_0x361732(0x1a7)+(_0x2b723a[_0x361732(0x1e3)]!==0x1?'s':''));const _0x5f5c96=_0x2b723a['map'](_0x2dafaf=>{const _0x31c207=_0x361732;let _0x240e9c;if(_0x2dafaf[_0x31c207(0x1df)]&&_0x2dafaf[_0x31c207(0x1b7)]){const _0x4a6f77=new Date(_0x2dafaf[_0x31c207(0x1df)])[_0x31c207(0x1b6)](),_0x38e0e3=new Date(_0x2dafaf['end_at'])[_0x31c207(0x1b6)]();_0x240e9c=Math[_0x31c207(0x1c6)]((_0x38e0e3-_0x4a6f77)/0x3e8);}return{'job_id':_0x2dafaf[_0x31c207(0x1cd)],'type':_0x2dafaf[_0x31c207(0x1e1)],'status':_0x2dafaf['status'],'user_name':_0x2dafaf[_0x31c207(0x1ea)],'duration_sec':_0x240e9c,'created_at':_0x2dafaf[_0x31c207(0x1a4)],'started_at':_0x2dafaf[_0x31c207(0x1df)],'end_at':_0x2dafaf[_0x31c207(0x1b7)]};});return await handleSDKOutput(_0x5f5c96,_0x3c572c),0x0;}catch(_0x29fa93){if(_0x29fa93 instanceof SDKError)return console[_0x361732(0x1ab)](_0x361732(0x1a2)+_0x29fa93[_0x361732(0x1a1)]),_0x29fa93[_0x361732(0x1ee)]&&console['error'](_0x361732(0x1b2)+_0x29fa93['cause']),0x1;throw _0x29fa93;}}}export class JobShowCommand extends BaseCommand{[a24_0x118125(0x1d8)]='job:show';[a24_0x118125(0x1d6)]=a24_0x118125(0x1c2);async[a24_0x118125(0x1ad)](_0x5304f2){const _0x554497=a24_0x118125,{options:_0x1eaf3f,args:_0x2d332c,tdx:_0x1b794d}=_0x5304f2,_0x4e320b=_0x2d332c[0x0];if(!_0x4e320b)return console[_0x554497(0x1ab)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x554497(0x1ab)](_0x554497(0x1ca)),0x1;try{const _0x5f23ac=await withSpinner(_0x554497(0x1c0),()=>_0x1b794d[_0x554497(0x1ae)][_0x554497(0x1cf)](_0x4e320b),{'verbose':_0x1eaf3f[_0x554497(0x1c7)]}),_0x17c09c=_0x5f23ac[_0x554497(0x1c4)];let _0x4df7c4;if(_0x17c09c['start_at']&&_0x17c09c[_0x554497(0x1b7)]){const _0x2d8210=new Date(_0x17c09c[_0x554497(0x1df)])[_0x554497(0x1b6)](),_0x331630=new Date(_0x17c09c[_0x554497(0x1b7)])['getTime']();_0x4df7c4=Math[_0x554497(0x1c6)]((_0x331630-_0x2d8210)/0x3e8);}const _0x30cc47={'job_id':_0x17c09c[_0x554497(0x1cd)],'type':_0x17c09c[_0x554497(0x1e1)],'status':_0x17c09c[_0x554497(0x1bd)],..._0x17c09c[_0x554497(0x1ea)]&&{'user_name':_0x17c09c['user_name']},..._0x4df7c4!==undefined&&{'duration_sec':_0x4df7c4},..._0x17c09c[_0x554497(0x1a4)]&&{'created_at':_0x17c09c[_0x554497(0x1a4)]},..._0x17c09c[_0x554497(0x1df)]&&{'started_at':_0x17c09c[_0x554497(0x1df)]},..._0x17c09c[_0x554497(0x1b7)]&&{'end_at':_0x17c09c[_0x554497(0x1b7)]},..._0x17c09c['database']&&{'database':_0x17c09c[_0x554497(0x1d9)]},..._0x17c09c['priority']!==undefined&&{'priority':_0x17c09c[_0x554497(0x1ac)]},..._0x17c09c[_0x554497(0x1af)]&&{'url':_0x17c09c['url']},..._0x17c09c[_0x554497(0x1aa)]&&{'query':_0x17c09c['query']},..._0x17c09c[_0x554497(0x1c8)]&&{'debug':_0x17c09c[_0x554497(0x1c8)]}};return await handleSingleObjectOutput(_0x30cc47,_0x1eaf3f),0x0;}catch(_0x5e10e5){if(_0x5e10e5 instanceof SDKError)return console[_0x554497(0x1ab)](_0x554497(0x1a2)+_0x5e10e5[_0x554497(0x1a1)]),_0x5e10e5[_0x554497(0x1ee)]&&console['error'](_0x554497(0x1b2)+_0x5e10e5['cause']),0x1;throw _0x5e10e5;}}}function a24_0x29b0(_0x596ff3,_0x578877){_0x596ff3=_0x596ff3-0x1a1;const _0x3d5533=a24_0x3d55();let _0x29b02e=_0x3d5533[_0x596ff3];return _0x29b02e;}export class JobKillCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1eb);[a24_0x118125(0x1d6)]=a24_0x118125(0x1db);async[a24_0x118125(0x1ad)](_0x500f91){const _0x18d14f=a24_0x118125,{options:_0x16b28f,args:_0x431be5,tdx:_0x489248}=_0x500f91,_0x25137a=_0x431be5[0x0];if(!_0x25137a)return console[_0x18d14f(0x1ab)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x18d14f(0x1ab)](_0x18d14f(0x1d4)),0x1;try{if(!_0x16b28f['yes']){const _0x2e7ea6=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x25137a+'?');if(!_0x2e7ea6)return console[_0x18d14f(0x1ab)]('Cancelled'),0x0;}return await withSpinner(_0x18d14f(0x1c5),()=>_0x489248[_0x18d14f(0x1ae)][_0x18d14f(0x1ec)](_0x25137a),{'verbose':_0x16b28f['verbose']}),console['error'](_0x18d14f(0x1dc)+_0x25137a),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x25137a+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x4242cf){if(_0x4242cf instanceof SDKError)return console[_0x18d14f(0x1ab)]('Error:\x20'+_0x4242cf[_0x18d14f(0x1a1)]),_0x4242cf[_0x18d14f(0x1ee)]&&console[_0x18d14f(0x1ab)](_0x18d14f(0x1b2)+_0x4242cf[_0x18d14f(0x1ee)]),0x1;throw _0x4242cf;}}}export class JobSubmitCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1a6);[a24_0x118125(0x1d6)]=a24_0x118125(0x1b0);async[a24_0x118125(0x1ad)](_0x350bbb){const _0x2149d9=a24_0x118125,{options:_0x353db8,args:_0x498853,tdx:_0x25fd46}=_0x350bbb;try{const _0x2f32a2=_0x353db8[_0x2149d9(0x1ef)]||'trino',_0x31f515=_0x353db8[_0x2149d9(0x1d7)],_0x389648=_0x353db8[_0x2149d9(0x1d9)]||_0x2149d9(0x1e2);if(_0x2f32a2!==_0x2149d9(0x1ce)&&_0x2f32a2!==_0x2149d9(0x1e5))return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b1)),0x1;let _0x7d5b69;if(_0x31f515){if(_0x498853[0x0])return console[_0x2149d9(0x1ab)](_0x2149d9(0x1d0)),0x1;const _0x2449ba=readSqlStatementsFromFile(_0x31f515);if(_0x2449ba[_0x2149d9(0x1e3)]===0x0)return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b3)),0x1;if(_0x2449ba[_0x2149d9(0x1e3)]>0x1)return console['error'](_0x2149d9(0x1e8)),0x1;_0x7d5b69=_0x2449ba[0x0];}else{if(!_0x498853[0x0])return console[_0x2149d9(0x1ab)](_0x2149d9(0x1bf)),console[_0x2149d9(0x1ab)](_0x2149d9(0x1e4)),0x1;_0x7d5b69=_0x498853[0x0];}_0x353db8[_0x2149d9(0x1c7)]&&(console[_0x2149d9(0x1ab)](_0x2149d9(0x1b4)+_0x2f32a2),console['error'](_0x2149d9(0x1d3)+_0x389648),console[_0x2149d9(0x1ab)]('Query:\x20'+_0x7d5b69['substring'](0x0,0x64)+(_0x7d5b69[_0x2149d9(0x1e3)]>0x64?_0x2149d9(0x1e6):'')));const _0x7cff2b=await withSpinner(_0x2149d9(0x1e9),()=>_0x25fd46[_0x2149d9(0x1ae)][_0x2149d9(0x1e7)](_0x389648,_0x7d5b69,_0x2f32a2),{'verbose':_0x353db8[_0x2149d9(0x1c7)]}),_0x37153d=_0x7cff2b['data'];return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b9)),console[_0x2149d9(0x1ab)](_0x2149d9(0x1d5)+_0x37153d[_0x2149d9(0x1cd)]),await handleSDKOutput([_0x37153d],_0x353db8),0x0;}catch(_0x257da3){if(_0x257da3 instanceof SDKError)return console[_0x2149d9(0x1ab)](_0x2149d9(0x1a2)+_0x257da3[_0x2149d9(0x1a1)]),_0x257da3[_0x2149d9(0x1ee)]&&console[_0x2149d9(0x1ab)](_0x2149d9(0x1b2)+_0x257da3[_0x2149d9(0x1ee)]),0x1;throw _0x257da3;}}}export class JobResultCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1a8);[a24_0x118125(0x1d6)]=a24_0x118125(0x1d2);async[a24_0x118125(0x1ad)](_0x49fff4){const _0x397a0b=a24_0x118125,{options:_0x34e72e,args:_0x244bee,tdx:_0x116999}=_0x49fff4,_0x4c3ff8=_0x244bee[0x0];if(!_0x4c3ff8)return console[_0x397a0b(0x1ab)](_0x397a0b(0x1c3)),console['error']('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x16b1b6=await withSpinner('Getting\x20job\x20results...',()=>_0x116999[_0x397a0b(0x1ae)][_0x397a0b(0x1be)](_0x4c3ff8),{'verbose':_0x34e72e[_0x397a0b(0x1c7)]}),_0xa25138=_0x16b1b6[_0x397a0b(0x1c4)];return console[_0x397a0b(0x1ab)](_0x397a0b(0x1c9)+_0xa25138[_0x397a0b(0x1e3)]+_0x397a0b(0x1ba)+(_0xa25138[_0x397a0b(0x1e3)]!==0x1?'s':'')),await handleSDKOutput(_0xa25138,_0x34e72e),0x0;}catch(_0x4b6fa2){if(_0x4b6fa2 instanceof SDKError)return console[_0x397a0b(0x1ab)](_0x397a0b(0x1a2)+_0x4b6fa2[_0x397a0b(0x1a1)]),_0x4b6fa2['cause']&&console[_0x397a0b(0x1ab)]('\x20\x20Cause:\x20'+_0x4b6fa2[_0x397a0b(0x1ee)]),0x1;throw _0x4b6fa2;}}}
1
+ 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_0x2ab184=a25_0x5274;(function(_0x47ff44,_0x516ece){const _0x3f71fb=a25_0x5274,_0x58520d=_0x47ff44();while(!![]){try{const _0x44ac6f=-parseInt(_0x3f71fb(0x1a5))/0x1+-parseInt(_0x3f71fb(0x1dd))/0x2*(-parseInt(_0x3f71fb(0x1c6))/0x3)+-parseInt(_0x3f71fb(0x184))/0x4+-parseInt(_0x3f71fb(0x174))/0x5*(parseInt(_0x3f71fb(0x178))/0x6)+parseInt(_0x3f71fb(0x1ee))/0x7*(-parseInt(_0x3f71fb(0x17e))/0x8)+-parseInt(_0x3f71fb(0x1a2))/0x9*(parseInt(_0x3f71fb(0x18d))/0xa)+parseInt(_0x3f71fb(0x1e2))/0xb*(parseInt(_0x3f71fb(0x193))/0xc);if(_0x44ac6f===_0x516ece)break;else _0x58520d['push'](_0x58520d['shift']());}catch(_0x77fccc){_0x58520d['push'](_0x58520d['shift']());}}}(a25_0x2633,0x780a9));import a25_0x3cb7c7 from'chalk';import a25_0x534d5e from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';function a25_0x2633(){const _0x158c04=['...','Getting\x20journey\x20details...','Warning:\x20Stage\x20\x22','✔\x20Journey\x20\x22','yes','all','\x22\x20not\x20found','cyan','name','includeStats','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','journey','json','✔\x20Pulled\x20','isNew','40702ayLfrS','relative','Usage:\x20journey\x20resume\x20<name-or-path>','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','entered','11gkPrxs','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20(ID:\x20','Usage:\x20journey\x20view\x20<name-or-path>','INVALID_ARGUMENT','listFolders','log','state','yellow','join','✔\x20Found\x20','Usage:\x20journey\x20stats\x20<name-or-path>','1981OJaJnF','stageName','\x20\x20Name:\x20','stage','replace','kind','(root)','No\x20journeys\x20found','Input:\x20','map','\x5c$&','description','Parent\x20segment\x20context\x20not\x20set.\x0a','data','goal','dryRun','getStatistics','segment','launched','🗺️\x20','Getting\x20journey\x20statistics...','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Resolving\x20journey...','resolveParentId','journey:pause','journey:resume','Show\x20journey\x20statistics','97315HkvdBU','Fetching\x20','\x22\x20resumed','Listing\x20journeys...','150NbUmol','gray','exited','paused','journeyName','getJourney','26440fePwNW','segmentName','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','draft','toLowerCase','test','902820WFAfoo','journeyId','dim','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','folderId','parent_segment','journeyBundleName','journeys','199620BFyNqh','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','Resume\x20a\x20paused\x20journey','journey:list','journey:view','\x20\x20Statistics\x20not\x20available','36184764enjvAa','📁\x20','content','resolveJourneyId','totalGoalAchieved','totalEntered','\x20\x20Parent\x20segment:\x20','\x20unchanged\x20files','Export\x20journey(s)\x20as\x20YAML\x20files','Resolving\x20parent\x20segment...','\x20\x20Folder\x20path:\x20','parentSegment','\x20journey\x20files\x20to\x20','message','\x20\x20Target:\x20','333nbbuBK','getParentFull','attributes','279976hKskow','resume','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','stages','rootFolderId','format','set','rule','execute','Error:\x20Journey\x20not\x20found:\x20','Error:\x20Parent\x20segment\x20context\x20required','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','cwd','Pausing\x20journey...','archived','Show\x20journey\x20details','Warning:\x20Could\x20not\x20resolve\x20segment\x20','green','utf-8','\x22\x20paused','Cancelled','Aborted.','goalRate','get','conversionRate','verbose','folderPath','Resolved\x20YAML\x20file:\x20','\x20files?','population','\x20journeys','filter','listJourneysFromParentSegment','21EhhcMF','No\x20statistics\x20available\x20for\x20journey:\x20','push','error','repeat','length','hasChanges','Usage:\x20journey\x20pause\x20<name-or-path>'];a25_0x2633=function(){return _0x158c04;};return a25_0x2633();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';function a25_0x5274(_0x152d1f,_0x268a16){_0x152d1f=_0x152d1f-0x15a;const _0x26339e=a25_0x2633();let _0x52740a=_0x26339e[_0x152d1f];return _0x52740a;}import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x5553e5){const _0x51a553=a25_0x5274;switch(_0x5553e5){case _0x51a553(0x16b):return a25_0x3cb7c7['green'](_0x5553e5);case _0x51a553(0x181):return a25_0x3cb7c7[_0x51a553(0x179)](_0x5553e5);case _0x51a553(0x1b3):return a25_0x3cb7c7[_0x51a553(0x186)](_0x5553e5);default:return _0x5553e5;}}function formatJourneyItem(_0x5bc6c3,_0x4c846f=''){const _0xd530bc=a25_0x5274,_0x55171b=formatJourneyState(_0x5bc6c3[_0xd530bc(0x1e9)]),_0x15e948=_0x5bc6c3['paused']?a25_0x3cb7c7[_0xd530bc(0x1ea)]('\x20(paused)'):'';return _0x4c846f+_0xd530bc(0x16c)+_0x5bc6c3[_0xd530bc(0x18b)]+'\x20('+_0x55171b+')'+_0x15e948;}function escapeRegex(_0x3adf3a){const _0x5a031f=a25_0x5274;return _0x3adf3a[_0x5a031f(0x15d)](/[.*+?^${}()|[\]\\]/g,_0x5a031f(0x163));}function globToRegex(_0x4031ff){const _0xc94ba7=a25_0x5274,_0x283354=_0x4031ff['split']('*')[_0xc94ba7(0x162)](escapeRegex);return new RegExp(_0x283354[_0xc94ba7(0x1eb)]('.*'),'i');}function resolveJourneyTarget(_0x57fd8e,_0x4cf8d5,_0x4feafd){const _0x1ac0c2=a25_0x5274;if(isYamlFilePath(_0x57fd8e))try{const _0x3fd522=resolveYamlFilePath(_0x57fd8e);return _0x4feafd&&(console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x1c0)+_0x57fd8e),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x199)+_0x3fd522[_0x1ac0c2(0x19e)]),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x15b)+_0x3fd522[_0x1ac0c2(0x17f)]),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x19d)+(_0x3fd522[_0x1ac0c2(0x1bf)]||_0x1ac0c2(0x15f)))),{'journeyName':_0x3fd522[_0x1ac0c2(0x17f)],'parentSegment':_0x3fd522[_0x1ac0c2(0x19e)],'resolved':_0x3fd522};}catch(_0x48f40f){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ac0c2(0x1a7)+_0x48f40f[_0x1ac0c2(0x1a0)]);}if(!_0x4cf8d5)throw new SDKError(ErrorCode[_0x1ac0c2(0x1e6)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x57fd8e,'parentSegment':_0x4cf8d5};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x2ab184(0x190);[a25_0x2ab184(0x164)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x2e06c6){const _0x102a09=a25_0x2ab184,{options:_0x494b2b,args:_0x7d05b4,tdx:_0x5e31e6}=_0x2e06c6,_0x41553f=_0x7d05b4[0x0],_0x88028e=_0x494b2b[_0x102a09(0x19e)];if(!_0x88028e)return console[_0x102a09(0x1c9)](_0x102a09(0x1af)),console[_0x102a09(0x1c9)](_0x102a09(0x1b0)),0x1;const _0x21b1f3=await withSpinner(_0x102a09(0x19c),()=>_0x5e31e6[_0x102a09(0x16a)][_0x102a09(0x170)](_0x88028e),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),_0x83f51d=_0x21b1f3[_0x102a09(0x166)];_0x494b2b[_0x102a09(0x1be)]&&(console[_0x102a09(0x1c9)]('Parent\x20segment:\x20'+_0x88028e+_0x102a09(0x1e4)+_0x83f51d+')'),_0x41553f&&console[_0x102a09(0x1c9)]('Pattern:\x20'+_0x41553f));const [_0x52327a,_0x20199b,_0x5a1842]=await Promise[_0x102a09(0x1d3)]([withSpinner('Fetching\x20parent\x20segment...',()=>_0x5e31e6['segment'][_0x102a09(0x1a3)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),withSpinner('Fetching\x20folders...',()=>_0x5e31e6['segment'][_0x102a09(0x1e7)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),withSpinner(_0x102a09(0x177),()=>_0x5e31e6['journey'][_0x102a09(0x1c5)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]})]),_0x2760cb=_0x52327a[_0x102a09(0x166)],_0x3867f9=_0x20199b[_0x102a09(0x166)];let _0x467b83=_0x5a1842[_0x102a09(0x166)];const _0x269d82=_0x2760cb[_0x102a09(0x1a9)],_0x59237d=new Map();for(const _0x570e52 of _0x3867f9){_0x59237d[_0x102a09(0x1ab)](_0x570e52['id'],_0x570e52[_0x102a09(0x1d6)]);}if(_0x41553f){const _0x1c05b1=globToRegex(_0x41553f);_0x467b83=_0x467b83[_0x102a09(0x1c4)](_0x23ad5c=>_0x1c05b1[_0x102a09(0x183)](_0x23ad5c[_0x102a09(0x18b)]));}console[_0x102a09(0x1c9)](_0x102a09(0x1ec)+_0x467b83[_0x102a09(0x1cb)]+'\x20journey'+(_0x467b83['length']!==0x1?'s':''));if(_0x494b2b[_0x102a09(0x1aa)]==='table')await handleSDKOutput(_0x467b83,_0x494b2b);else{if(_0x494b2b['format']===_0x102a09(0x1da))await handleSDKOutput(_0x467b83,_0x494b2b);else{console[_0x102a09(0x1e8)]('['+_0x88028e+']');const _0x14a018=new Map(),_0x11e14a=[];for(const _0x24ef86 of _0x467b83){if(!_0x24ef86[_0x102a09(0x189)]||_0x24ef86[_0x102a09(0x189)]===_0x269d82)_0x11e14a[_0x102a09(0x1c8)](_0x24ef86);else{const _0x55658d=_0x14a018['get'](_0x24ef86['folderId'])||[];_0x55658d['push'](_0x24ef86),_0x14a018[_0x102a09(0x1ab)](_0x24ef86[_0x102a09(0x189)],_0x55658d);}}for(const _0x36c472 of _0x11e14a){console['log'](formatJourneyItem(_0x36c472));}for(const [_0x45e4ea,_0x1eacd0]of _0x14a018){const _0x460d52=_0x59237d[_0x102a09(0x1bc)](_0x45e4ea)||_0x45e4ea;console[_0x102a09(0x1e8)](_0x102a09(0x194)+_0x460d52);for(const _0x534d2e of _0x1eacd0){console['log'](formatJourneyItem(_0x534d2e,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x191);[a25_0x2ab184(0x164)]=a25_0x2ab184(0x1b4);async[a25_0x2ab184(0x1ad)](_0x472a64){const _0x4cc179=a25_0x2ab184,{options:_0x36514a,args:_0x4ec0da,tdx:_0x2b1b94}=_0x472a64,_0x3e44a2=_0x4ec0da[0x0];if(!_0x3e44a2)return console[_0x4cc179(0x1c9)](_0x4cc179(0x1d8)),console['error'](_0x4cc179(0x1e5)),0x1;_0x36514a['verbose']&&console[_0x4cc179(0x1c9)](_0x4cc179(0x161)+_0x3e44a2);const _0x208e80=resolveJourneyTarget(_0x3e44a2,_0x36514a[_0x4cc179(0x19e)],_0x36514a[_0x4cc179(0x1be)]),_0x3c7fab=await withSpinner(_0x4cc179(0x19c),()=>_0x2b1b94[_0x4cc179(0x16a)][_0x4cc179(0x170)](_0x208e80[_0x4cc179(0x19e)]),{'verbose':_0x36514a[_0x4cc179(0x1be)]}),_0x254fef=_0x3c7fab[_0x4cc179(0x166)],_0x4e6318=await withSpinner(_0x4cc179(0x16f),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x196)](_0x254fef,_0x208e80[_0x4cc179(0x17c)]),{'verbose':_0x36514a['verbose']}),_0x270a70=_0x4e6318[_0x4cc179(0x166)],_0x3540b1=await withSpinner(_0x4cc179(0x1cf),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x17d)](_0x270a70),{'verbose':_0x36514a[_0x4cc179(0x1be)]}),_0x2f588f=_0x3540b1[_0x4cc179(0x166)],_0x5d6d93=_0x36514a[_0x4cc179(0x1d7)];let _0x230be2;if(_0x5d6d93)try{const _0x2a4423=await withSpinner(_0x4cc179(0x16d),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x169)](_0x270a70),{'verbose':_0x36514a['verbose']});_0x230be2=_0x2a4423['data'];}catch{_0x36514a['verbose']&&console[_0x4cc179(0x1c9)](_0x4cc179(0x192));}const _0x256098={'id':_0x2f588f['id'],'name':_0x2f588f[_0x4cc179(0x1a4)]['name'],'description':_0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x164)],'state':_0x2f588f['attributes'][_0x4cc179(0x1e9)],'paused':_0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x17b)],'reentry_mode':_0x2f588f['attributes']['reentryMode'],'stages':_0x2f588f[_0x4cc179(0x1a4)]['journeyStages']?.['length']||0x0,..._0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x167)]&&{'goal':_0x2f588f[_0x4cc179(0x1a4)]['goal']['name']},..._0x230be2&&{'statistics':{'total_entered':_0x230be2['totalEntered'],'goal_achieved':_0x230be2[_0x4cc179(0x197)],'goal_rate':_0x230be2['goalRate'],'stages':_0x230be2[_0x4cc179(0x1a8)]}}};return await handleSingleObjectOutput(_0x256098,_0x36514a),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]='journey:stats';[a25_0x2ab184(0x164)]=a25_0x2ab184(0x173);async[a25_0x2ab184(0x1ad)](_0x3131ae){const _0x4dc009=a25_0x2ab184,{options:_0x4444e1,args:_0x442b3e,tdx:_0x2ffe1a}=_0x3131ae,_0x5643eb=_0x442b3e[0x0];if(!_0x5643eb)return console[_0x4dc009(0x1c9)](_0x4dc009(0x1d8)),console[_0x4dc009(0x1c9)](_0x4dc009(0x1ed)),0x1;_0x4444e1[_0x4dc009(0x1be)]&&console['error'](_0x4dc009(0x161)+_0x5643eb);const _0x2ceab8=resolveJourneyTarget(_0x5643eb,_0x4444e1['parentSegment'],_0x4444e1[_0x4dc009(0x1be)]),_0x9b1ed7=await withSpinner(_0x4dc009(0x19c),()=>_0x2ffe1a[_0x4dc009(0x16a)][_0x4dc009(0x170)](_0x2ceab8[_0x4dc009(0x19e)]),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x36f9e2=_0x9b1ed7[_0x4dc009(0x166)],_0x5561c5=await withSpinner(_0x4dc009(0x16f),()=>_0x2ffe1a['journey']['resolveJourneyId'](_0x36f9e2,_0x2ceab8[_0x4dc009(0x17c)]),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x1fda1f=_0x5561c5[_0x4dc009(0x166)],_0x3081fc=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x2ffe1a[_0x4dc009(0x1d9)]['getStatistics'](_0x1fda1f),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x7d7f5b=_0x3081fc[_0x4dc009(0x166)];if(!_0x7d7f5b||_0x7d7f5b[_0x4dc009(0x185)]===null)return console[_0x4dc009(0x1c9)](_0x4dc009(0x1c7)+_0x2ceab8[_0x4dc009(0x17c)]),console['error'](_0x4dc009(0x1e0)),0x0;const _0x2a74aa={'journey_id':_0x7d7f5b[_0x4dc009(0x185)],'total_entered':_0x7d7f5b[_0x4dc009(0x198)],'goal_achieved':_0x7d7f5b[_0x4dc009(0x197)],'goal_rate':_0x7d7f5b[_0x4dc009(0x1bb)],'stages':_0x7d7f5b['stages']?.[_0x4dc009(0x162)](_0x97f974=>({'name':_0x97f974[_0x4dc009(0x15a)],'population':_0x97f974[_0x4dc009(0x1c2)],'entered':_0x97f974[_0x4dc009(0x1e1)],'exited':_0x97f974['exited'],'conversion_rate':_0x97f974[_0x4dc009(0x1bd)]}))},_0x2b7bd9=_0x4444e1[_0x4dc009(0x15c)];if(_0x2b7bd9&&_0x7d7f5b[_0x4dc009(0x1a8)]){const _0x2e6d1c=_0x7d7f5b['stages']['find'](_0x22e199=>_0x22e199[_0x4dc009(0x15a)][_0x4dc009(0x182)]()===_0x2b7bd9[_0x4dc009(0x182)]());if(_0x2e6d1c)return await handleSingleObjectOutput({'stage_name':_0x2e6d1c[_0x4dc009(0x15a)],'population':_0x2e6d1c[_0x4dc009(0x1c2)],'entered':_0x2e6d1c['entered'],'exited':_0x2e6d1c[_0x4dc009(0x17a)],'conversion_rate':_0x2e6d1c[_0x4dc009(0x1bd)]},_0x4444e1),0x0;console[_0x4dc009(0x1c9)](_0x4dc009(0x1d0)+_0x2b7bd9+_0x4dc009(0x1d4));}return await handleSingleObjectOutput(_0x2a74aa,_0x4444e1),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x171);[a25_0x2ab184(0x164)]='Pause\x20a\x20running\x20journey';async['execute'](_0x37110c){const _0x16e5d1=a25_0x2ab184,{options:_0x501e20,args:_0x52c8b4,tdx:_0x3f5f5d}=_0x37110c,_0x16c8a5=_0x52c8b4[0x0];if(!_0x16c8a5)return console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1d8)),console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1cd)),0x1;_0x501e20[_0x16e5d1(0x1be)]&&console[_0x16e5d1(0x1c9)](_0x16e5d1(0x161)+_0x16c8a5);const _0xd0b865=resolveJourneyTarget(_0x16c8a5,_0x501e20['parentSegment'],_0x501e20[_0x16e5d1(0x1be)]),_0x10f231=await withSpinner(_0x16e5d1(0x19c),()=>_0x3f5f5d['segment'][_0x16e5d1(0x170)](_0xd0b865['parentSegment']),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x1b1630=_0x10f231[_0x16e5d1(0x166)],_0x46445b=await withSpinner(_0x16e5d1(0x16f),()=>_0x3f5f5d[_0x16e5d1(0x1d9)][_0x16e5d1(0x196)](_0x1b1630,_0xd0b865[_0x16e5d1(0x17c)]),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x1c674c=_0x46445b[_0x16e5d1(0x166)];if(!_0x501e20[_0x16e5d1(0x1d2)]){const _0x58e030=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0xd0b865['journeyName']+'\x22?');if(!_0x58e030)return console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1b9)),0x0;}const _0x10cfa0=await withSpinner(_0x16e5d1(0x1b2),()=>_0x3f5f5d['journey']['pause'](_0x1c674c),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x15fbd5=_0x10cfa0[_0x16e5d1(0x166)];return console['error'](_0x16e5d1(0x1d1)+_0x15fbd5['attributes'][_0x16e5d1(0x1d6)]+_0x16e5d1(0x1b8)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x172);[a25_0x2ab184(0x164)]=a25_0x2ab184(0x18f);async[a25_0x2ab184(0x1ad)](_0x394d89){const _0x2bc67d=a25_0x2ab184,{options:_0x7ba997,args:_0x464980,tdx:_0x529142}=_0x394d89,_0x31b4a2=_0x464980[0x0];if(!_0x31b4a2)return console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1d8)),console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1df)),0x1;_0x7ba997[_0x2bc67d(0x1be)]&&console[_0x2bc67d(0x1c9)](_0x2bc67d(0x161)+_0x31b4a2);const _0x1f1dca=resolveJourneyTarget(_0x31b4a2,_0x7ba997[_0x2bc67d(0x19e)],_0x7ba997['verbose']),_0x4ea90d=await withSpinner(_0x2bc67d(0x19c),()=>_0x529142[_0x2bc67d(0x16a)][_0x2bc67d(0x170)](_0x1f1dca[_0x2bc67d(0x19e)]),{'verbose':_0x7ba997['verbose']}),_0x1ef221=_0x4ea90d[_0x2bc67d(0x166)],_0x109811=await withSpinner('Resolving\x20journey...',()=>_0x529142[_0x2bc67d(0x1d9)]['resolveJourneyId'](_0x1ef221,_0x1f1dca['journeyName']),{'verbose':_0x7ba997[_0x2bc67d(0x1be)]}),_0x3c9182=_0x109811[_0x2bc67d(0x166)];if(!_0x7ba997['yes']){const _0x186c3f=await confirm(_0x2bc67d(0x188)+_0x1f1dca[_0x2bc67d(0x17c)]+'\x22?');if(!_0x186c3f)return console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1b9)),0x0;}const _0x14c3ca=await withSpinner('Resuming\x20journey...',()=>_0x529142['journey'][_0x2bc67d(0x1a6)](_0x3c9182),{'verbose':_0x7ba997[_0x2bc67d(0x1be)]}),_0x372802=_0x14c3ca[_0x2bc67d(0x166)];return console[_0x2bc67d(0x1c9)]('✔\x20Journey\x20\x22'+_0x372802['attributes'][_0x2bc67d(0x1d6)]+_0x2bc67d(0x176)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]='journey:pull';['description']=a25_0x2ab184(0x19b);async['execute'](_0x489d92){const _0x1ddc51=a25_0x2ab184,{options:_0xa56297,args:_0x28d363,tdx:_0x92fb29}=_0x489d92,_0x4e6b12=_0xa56297,_0x14e769=_0x28d363[0x0],_0x5ea764=findTdxConfigPath();let _0xb4f0b9,_0x73b31a;if(_0x5ea764){const _0x51a331=loadTdxConfig(_0x5ea764);_0xb4f0b9=_0x51a331[_0x1ddc51(0x18a)],_0x73b31a=a25_0x534d5e[_0x1ddc51(0x1eb)](a25_0x534d5e['dirname'](_0x5ea764),'journeys'),_0x4e6b12[_0x1ddc51(0x1be)]&&(console['error']('Found\x20existing\x20tdx.json\x20at:\x20'+_0x5ea764),console[_0x1ddc51(0x1c9)]('Using\x20parent\x20segment:\x20'+_0xb4f0b9));}else{_0xb4f0b9=_0xa56297['parentSegment'];if(!_0xb4f0b9)return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1ea)](_0x1ddc51(0x165))),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x18e)),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x180)),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x187)),0x1;_0x73b31a=a25_0x534d5e[_0x1ddc51(0x1eb)](getSegmentRootDir(sanitizeFileName(_0xb4f0b9)),_0x1ddc51(0x18c));}const _0x5277a3=await withSpinner(_0x1ddc51(0x19c),()=>_0x92fb29[_0x1ddc51(0x16a)][_0x1ddc51(0x170)](_0xb4f0b9),{'verbose':_0xa56297[_0x1ddc51(0x1be)]}),_0x3c2591=_0x5277a3[_0x1ddc51(0x166)],_0x4fd281=await withSpinner(_0x1ddc51(0x177),()=>_0x92fb29[_0x1ddc51(0x1d9)][_0x1ddc51(0x1c5)](_0x3c2591),{'verbose':_0xa56297[_0x1ddc51(0x1be)]});let _0x400628=_0x4fd281['data'];if(_0x14e769){const _0x42dcfc=_0x400628[_0x1ddc51(0x1c4)](_0x59f529=>_0x59f529[_0x1ddc51(0x18b)]['toLowerCase']()===_0x14e769[_0x1ddc51(0x182)]());if(_0x42dcfc[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1ae)+_0x14e769),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1e3)),0x1;_0x400628=_0x42dcfc;}if(_0x400628[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x160)),0x0;const _0x53d29b=[];for(const _0x11246a of _0x400628){const _0x3b87b7=await withSpinner(_0x1ddc51(0x175)+_0x11246a['journeyBundleName']+_0x1ddc51(0x1ce),()=>_0x92fb29['journey'][_0x1ddc51(0x17d)](_0x11246a['id']),{'verbose':_0xa56297['verbose']}),_0x336d89=_0x3b87b7[_0x1ddc51(0x166)],_0x51c0f0=_0x336d89[_0x1ddc51(0x1a4)]?.['audienceId'],_0xc7346f={'resolveSegment':async _0x49656e=>{const _0xcc6d1a=_0x1ddc51;if(!_0x51c0f0)return{'name':_0x49656e,'isJourneyLocal':![]};try{const _0x42f582=await _0x92fb29[_0xcc6d1a(0x16a)]['getSegment'](_0x51c0f0,_0x49656e),_0x3b9937=_0x42f582[_0xcc6d1a(0x15e)]===SEGMENT_KIND_JOURNEY;let _0x322d91;return _0x3b9937&&_0x42f582[_0xcc6d1a(0x1ac)]&&(_0x322d91={'description':_0x42f582[_0xcc6d1a(0x164)],'rule':apiRuleToYaml(_0x42f582[_0xcc6d1a(0x1ac)])}),{'name':_0x42f582['name'],'isJourneyLocal':_0x3b9937,'definition':_0x322d91};}catch(_0x1b873f){return _0xa56297['verbose']&&console[_0xcc6d1a(0x1c9)](_0xcc6d1a(0x1b5)+_0x49656e+':\x20'+_0x1b873f['message']),{'name':_0x49656e,'isJourneyLocal':![]};}}},_0xb20a1=await apiToYamlAsync(_0x336d89,_0xc7346f),_0x4661df=toYamlString(_0xb20a1),_0x106502=sanitizeFileName(_0x11246a[_0x1ddc51(0x18b)]),_0x5b0e69=a25_0x534d5e[_0x1ddc51(0x1eb)](_0x73b31a,_0x106502+'.yml'),_0x356ce3=a25_0x534d5e[_0x1ddc51(0x1de)](process[_0x1ddc51(0x1b1)](),_0x5b0e69);if(existsSync(_0x5b0e69)){const _0x5408f6=readFileSync(_0x5b0e69,_0x1ddc51(0x1b7)),_0x8f1a93=generateDiff(_0x5408f6,_0x4661df),_0x36c5de=hasChanges(_0x8f1a93);_0x53d29b[_0x1ddc51(0x1c8)]({'relativePath':_0x356ce3,'absolutePath':_0x5b0e69,'content':_0x4661df,'isNew':![],'hasChanges':_0x36c5de,'diff':_0x36c5de?formatDiffWithColors(_0x8f1a93):undefined});}else _0x53d29b[_0x1ddc51(0x1c8)]({'relativePath':_0x356ce3,'absolutePath':_0x5b0e69,'content':_0x4661df,'isNew':!![],'hasChanges':![]});}const _0x11a33d=_0x53d29b[_0x1ddc51(0x1c4)](_0x1ef6d5=>_0x1ef6d5[_0x1ddc51(0x1dc)]),_0xaa0b1=_0x53d29b['filter'](_0x5715ef=>!_0x5715ef[_0x1ddc51(0x1dc)]&&_0x5715ef[_0x1ddc51(0x1cc)]),_0x48390f=_0x53d29b[_0x1ddc51(0x1c4)](_0x48d430=>!_0x48d430[_0x1ddc51(0x1dc)]&&!_0x48d430[_0x1ddc51(0x1cc)]);console[_0x1ddc51(0x1c9)]('\x0aPull\x20summary:'),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1d5)](_0x400628['length']+_0x1ddc51(0x1c3))),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1b6)]('+\x20'+_0x11a33d[_0x1ddc51(0x1cb)]+'\x20new\x20files')),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1ea)]('~\x20'+_0xaa0b1[_0x1ddc51(0x1cb)]+'\x20changed\x20files')),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x186)]('=\x20'+_0x48390f['length']+_0x1ddc51(0x19a))),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1a1)+a25_0x3cb7c7[_0x1ddc51(0x1d5)](_0x73b31a)+'\x0a');if(_0xaa0b1['length']>0x0)for(const _0x51460b of _0xaa0b1){console[_0x1ddc51(0x1c9)]('\x0aChanges\x20to\x20\x27'+_0x51460b['relativePath']+'\x27:'),console[_0x1ddc51(0x1c9)]('─'[_0x1ddc51(0x1ca)](0x3c)),console[_0x1ddc51(0x1c9)](_0x51460b['diff']),console[_0x1ddc51(0x1c9)]('─'[_0x1ddc51(0x1ca)](0x3c));}if(_0x4e6b12[_0x1ddc51(0x168)])return console['error'](a25_0x3cb7c7[_0x1ddc51(0x1ea)](_0x1ddc51(0x16e))),0x0;if(_0x11a33d[_0x1ddc51(0x1cb)]===0x0&&_0xaa0b1[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1b6)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),0x0;if(!_0x4e6b12[_0x1ddc51(0x1d2)]&&(_0x11a33d[_0x1ddc51(0x1cb)]>0x0||_0xaa0b1[_0x1ddc51(0x1cb)]>0x0)){const _0x11f06b=await confirmKey('Write\x20'+(_0x11a33d['length']+_0xaa0b1[_0x1ddc51(0x1cb)])+_0x1ddc51(0x1c1));if(!_0x11f06b)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1ba)),0x1;}!existsSync(_0x73b31a)&&mkdirSync(_0x73b31a,{'recursive':!![]});for(const _0xc022db of _0x53d29b){(_0xc022db[_0x1ddc51(0x1dc)]||_0xc022db['hasChanges'])&&writeFileSync(_0xc022db['absolutePath'],_0xc022db[_0x1ddc51(0x195)],_0x1ddc51(0x1b7));}return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1b6)](_0x1ddc51(0x1db)+(_0x11a33d[_0x1ddc51(0x1cb)]+_0xaa0b1[_0x1ddc51(0x1cb)])+_0x1ddc51(0x19f)+_0x73b31a)),0x0;}}
1
+ const a25_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_0x5cc08c=a26_0x5881;(function(_0x49a606,_0x5167b9){const _0x1f8011=a26_0x5881,_0x221786=_0x49a606();while(!![]){try{const _0x37dab7=-parseInt(_0x1f8011(0x169))/0x1*(-parseInt(_0x1f8011(0x167))/0x2)+-parseInt(_0x1f8011(0x134))/0x3+-parseInt(_0x1f8011(0xde))/0x4+-parseInt(_0x1f8011(0xfe))/0x5+parseInt(_0x1f8011(0x143))/0x6*(-parseInt(_0x1f8011(0x141))/0x7)+-parseInt(_0x1f8011(0x15b))/0x8+parseInt(_0x1f8011(0x184))/0x9*(parseInt(_0x1f8011(0x106))/0xa);if(_0x37dab7===_0x5167b9)break;else _0x221786['push'](_0x221786['shift']());}catch(_0x3340ad){_0x221786['push'](_0x221786['shift']());}}}(a26_0x43f9,0xa328f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0x35856c from'node:fs';function handleSDKError(_0x2dadef,_0x269e53){const _0x2b69e9=a26_0x5881;if(_0x2dadef instanceof SDKError)console[_0x2b69e9(0x16c)]('Error:\x20'+_0x2dadef['message']),_0x269e53[_0x2b69e9(0x10d)]&&(_0x2dadef[_0x2b69e9(0x135)]&&console[_0x2b69e9(0x16c)](_0x2b69e9(0x191)+_0x2dadef[_0x2b69e9(0x135)]),_0x2dadef[_0x2b69e9(0xee)]&&(console['error'](_0x2b69e9(0x181)),console[_0x2b69e9(0x16c)](_0x2dadef[_0x2b69e9(0xee)])));else throw _0x2dadef;}function formatChatHistoryEntry(_0x232f83,_0x4f2ea5){const _0x312611=a26_0x5881,_0x1968ba=getChalk(_0x4f2ea5),_0x55f3b4=_0x1968ba[_0x312611(0x115)](_0x232f83['at']);if(_0x312611(0xd8)in _0x232f83){const _0xee436b=_0x1968ba[_0x312611(0x154)]('[input]\x20\x20');return _0x55f3b4+'\x20'+_0xee436b+':\x20'+_0x232f83['input'];}if(_0x312611(0x121)in _0x232f83){const _0x237609=_0x1968ba['green'](_0x312611(0x130));return _0x55f3b4+'\x20'+_0x237609+':\x20'+_0x232f83[_0x312611(0x121)];}if(_0x312611(0x12e)in _0x232f83){const _0xbd9cfd=_0x1968ba[_0x312611(0xe2)](_0x312611(0x17f)),{functionName:_0x20953f,functionArguments:_0x27ae28,targetFunction:_0x5169fc}=_0x232f83[_0x312611(0x12e)];let _0x394494=_0x55f3b4+'\x20'+_0xbd9cfd+':\x20'+_0x1968ba['bold'](_0x20953f);if(_0x27ae28&&Object['keys'](_0x27ae28)[_0x312611(0xe3)]>0x0){const _0x89ee88=Object['entries'](_0x27ae28)['map'](([_0x345cfa,_0x8408d4])=>_0x345cfa+'='+JSON[_0x312611(0x133)](_0x8408d4))[_0x312611(0x153)](',\x20');_0x394494+='('+_0x89ee88+')';}_0x5169fc&&(_0x394494+=_0x1968ba['dim']('\x20['+_0x5169fc+']'));let _0x2f267e='';if(_0x232f83['tool_call'][_0x312611(0x187)])_0x2f267e='\x20->\x20KB:'+_0x232f83[_0x312611(0x12e)]['targetKnowledgeBase'][_0x312611(0x155)];else{if(_0x232f83[_0x312611(0x12e)]['targetAgent'])_0x2f267e=_0x312611(0x16f)+_0x232f83[_0x312611(0x12e)][_0x312611(0x114)][_0x312611(0x155)];else{if(_0x232f83[_0x312611(0x12e)][_0x312611(0x16b)])_0x2f267e=_0x312611(0x14f)+_0x232f83[_0x312611(0x12e)][_0x312611(0x16b)]['name'];else _0x232f83['tool_call']['targetImageGenerator']&&(_0x2f267e='\x20->\x20ImageGen:'+_0x232f83[_0x312611(0x12e)][_0x312611(0x15c)][_0x312611(0x155)]);}}return _0x394494+_0x2f267e;}if(_0x312611(0x12c)in _0x232f83){const _0x130b82=_0x1968ba[_0x312611(0x111)](_0x312611(0x145)),{functionName:_0x29f359,functionArguments:_0x186af6,content:_0x58e127,newChat:_0x51cf00}=_0x232f83[_0x312611(0x12c)];let _0x1155e7=_0x55f3b4+'\x20'+_0x130b82+':\x20'+_0x1968ba[_0x312611(0x10a)](_0x29f359);if(_0x186af6){const _0x7b4c60=typeof _0x186af6==='string'?_0x186af6:JSON[_0x312611(0x133)](_0x186af6);_0x1155e7+='('+_0x7b4c60+')';}return _0x58e127&&(_0x1155e7+='\x0a'+_0x1968ba[_0x312611(0x115)](_0x58e127)),_0x51cf00&&(_0x1155e7+=_0x1968ba[_0x312611(0x115)]('\x20→\x20chat:\x20'+_0x51cf00['id'])),_0x1155e7;}if(_0x312611(0x13d)in _0x232f83){const _0x49cea2=_0x1968ba['blue'](_0x312611(0x18f));return _0x55f3b4+'\x20'+_0x49cea2+':\x20'+_0x232f83[_0x312611(0x13d)][_0x312611(0x155)]+'\x20('+_0x232f83['output']['content']['length']+_0x312611(0x11b);}if(_0x312611(0x12f)in _0x232f83){const _0x8d892c=_0x1968ba[_0x312611(0x109)](_0x312611(0x131)),{width:_0x4b549b,height:_0x182370,headerText:_0x6437e6}=_0x232f83[_0x312611(0x12f)],_0x591188=_0x6437e6?_0x312611(0xe6)+_0x6437e6:'';return _0x55f3b4+'\x20'+_0x8d892c+':\x20'+_0x4b549b+'x'+_0x182370+_0x591188;}if(_0x312611(0x16c)in _0x232f83){const _0x4d1897=_0x1968ba[_0x312611(0x124)]('[error]\x20\x20');return _0x55f3b4+'\x20'+_0x4d1897+':\x20'+_0x232f83[_0x312611(0x16c)];}return _0x55f3b4+'\x20'+_0x1968ba['dim'](_0x312611(0xff))+':\x20'+JSON['stringify'](_0x232f83);}async function executeChatHistoryCommand(_0x479315,_0x1daaf4){const _0x2b6580=a26_0x5881,{options:_0x512d57,args:_0x17aafb,tdx:_0xb36746}=_0x479315,_0x38d95b=_0x17aafb[0x0],_0x3c5916=_0x512d57,_0x174193=_0x3c5916[_0x2b6580(0x128)];try{if(_0x174193&&_0x38d95b)return console[_0x2b6580(0x16c)](_0x2b6580(0x189)),console[_0x2b6580(0x16c)](_0x2b6580(0x172)+_0x1daaf4+_0x2b6580(0x164)),0x1;if(!_0x38d95b&&!_0x174193&&_0x512d57['format']!==undefined){const _0x14b232=resolveLimit(_0x512d57[_0x2b6580(0x159)],DEFAULT_LLM_LIMIT),_0x43d1c5=await withSpinner(_0x2b6580(0x199),()=>_0xb36746[_0x2b6580(0x186)][_0x2b6580(0xf7)](_0x14b232),{'verbose':_0x512d57[_0x2b6580(0x10d)]});return await handleSDKOutput(_0x43d1c5[_0x2b6580(0x17b)],_0x512d57),0x0;}const _0x9db2b5=await getChatIdOrSelect(_0xb36746,_0x512d57,_0x174193,_0x38d95b);if(!_0x9db2b5)return 0x0;return await displayChatHistory(_0x9db2b5,_0xb36746,_0x512d57),0x0;}catch(_0x21474a){return handleSDKError(_0x21474a,_0x512d57),0x1;}}async function displayChatHistory(_0x43a523,_0x5b0a37,_0x407acd){const _0x5baa35=a26_0x5881,_0x2d0b76=await withSpinner(_0x5baa35(0x138)+_0x43a523+_0x5baa35(0xe9),()=>_0x5b0a37['llm'][_0x5baa35(0x168)](_0x43a523),{'verbose':_0x407acd['verbose']}),_0x36d24f=_0x2d0b76['data'][_0x5baa35(0x17b)]??[];if(_0x36d24f[_0x5baa35(0xe3)]===0x0){console[_0x5baa35(0x196)](_0x5baa35(0x190));return;}if(_0x407acd['format']!==undefined)await handleSDKOutput(_0x36d24f,_0x407acd);else{const _0x2cb583=_0x36d24f[_0x5baa35(0x16a)](_0x259331=>formatChatHistoryEntry(_0x259331,_0x407acd)),_0x425acc=_0x2cb583[_0x5baa35(0x153)]('\x0a');await writeOutput(_0x425acc,_0x407acd[_0x5baa35(0x13d)],_0x5baa35(0x13a));}}async function getChatIdOrSelect(_0x48a2be,_0x2a728a,_0x396e73,_0x10b5d8){const _0x14dc12=a26_0x5881;if(_0x10b5d8)return _0x10b5d8;if(_0x396e73){const _0x5bd87e=await withSpinner(_0x14dc12(0x10f),()=>_0x48a2be[_0x14dc12(0x186)][_0x14dc12(0xf7)](0x1),{'verbose':_0x2a728a['verbose']});if(_0x5bd87e['data'][_0x14dc12(0xe3)]===0x0)return console[_0x14dc12(0x196)](_0x14dc12(0xd6)),undefined;return _0x5bd87e[_0x14dc12(0x17b)][0x0]['id'];}const _0x46f81e=await selectChatInteractively(_0x48a2be,_0x2a728a);if(!_0x46f81e)return console[_0x14dc12(0x196)](_0x14dc12(0x12a)),undefined;return _0x46f81e;}async function getProjectIdOrDefault(_0x177226){const _0x14ab6d=a26_0x5881,{tdx:_0xd135c2,options:_0x1a3775}=_0x177226,_0x471404=_0x1a3775[_0x14ab6d(0xe4)];if(_0x471404){const _0x3b0eb2=await withSpinner(_0x14ab6d(0x101)+_0x471404+_0x14ab6d(0xe9),()=>_0xd135c2[_0x14ab6d(0x186)][_0x14ab6d(0x163)](_0x471404),{'verbose':_0x1a3775['verbose']});return _0x3b0eb2['data'];}let _0x20a46c=_0xd135c2['llm'][_0x14ab6d(0x198)]();if(_0x20a46c)return _0x20a46c;const _0x1448ae=await withSpinner('Getting\x20default\x20project...',()=>_0xd135c2[_0x14ab6d(0x186)]['getOrCreateDefaultProject'](),{'verbose':_0x1a3775[_0x14ab6d(0x10d)]});return _0x1448ae[_0x14ab6d(0x17b)]['id'];}function toLLMProjectInfo(_0x282e97){const _0x4558fe=a26_0x5881;return{'name':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x155)],'description':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x146)],'createdAt':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x176)],'updatedAt':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x19a)]};}function a26_0x43f9(){const _0x39cacf=['last','outputDir','\x0aCancelled','Fetching\x20agent...','tool','format','tool_call','image','[content]','[image]\x20\x20','.llm','stringify','1414248dmjczT','cause','\x20\x20Agents:\x20','Deleting\x20project\x20\x27','Fetching\x20chat\x20history\x20for\x20\x27','Delete\x20an\x20agent','table','yes','Error:\x20Agent\x20name\x20is\x20required','output','llm:project:backup','h\x20ago','find','14JtkeIg','agent','1903194AjEWsV','model','[tool]\x20\x20\x20','description','claude-4.5-haiku','A\x20project\x20named\x20\x27','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','llm:project:restore','d\x20ago','Use\x20format:\x20project-name/agent-name','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','getTime','\x20->\x20WebSearch:','getBackupMetadata','Output\x20directory\x20\x27','updateAgent','join','cyan','name','llm:history','Analyzing\x20project\x20\x27','execute','limit','Project\x20restored:\x20','1284144yMxvxq','targetImageGenerator','jsonl','floor','\x20\x20Knowledge\x20Bases:\x20','Creating\x20project\x20\x27','agentId','chatId','resolveProjectId','\x20--last','Project\x20backed\x20up\x20to:\x20','Validating\x20backup\x20from\x20\x27','148zodbkN','history','12622XMpLfs','map','targetWebSearchTool','error','llm:agent:create','includes','\x20->\x20Agent:','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','Usage:\x20','(no\x20message)','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','Error:\x20Project\x20name\x20is\x20required','createdAt','Agent\x20created:\x20','Project\x20created:\x20','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','push','data','Project\x20context\x20set\x20to:\x20','resolveAgentId','select','[tool_call]','Set\x20current\x20project\x20context','\x0aStack\x20trace:','Fetching\x20projects...','\x27\x20already\x20exists.\x20Overwrite?','9PVWXos','just\x20now','llm','targetKnowledgeBase','agents','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','all','projects','set','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','createAgent','[output]\x20','No\x20messages\x20found\x20in\x20chat\x20history.','\x20\x20Cause:\x20','Fetching\x20agents...','Agent\x20updated:\x20','llm:project:delete','Resolving\x20agent\x20\x27','log','llm:agent:update','getCurrentProject','Fetching\x20chat\x20sessions...','updatedAt','Setting\x20project\x20context\x20to\x20\x27','llm:agent:show','No\x20chat\x20sessions\x20found.','Backup\x20cancelled.','input','knowledgeBases','attributes','\x20\x20Prompts:\x20','Backing\x20up\x20project\x20\x27','default','5146064gPQqIK','exportedFrom','Load\x20more...','temperature','yellow','length','llmProject','INVALID_ARGUMENT','\x20-\x20','integrations','systemPrompt','\x27...','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Invalid\x20path\x20syntax:\x20','Update\x20an\x20existing\x20agent','get','stack','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','llm:agents','llm:models','dryRun','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Usage:\x20tdx\x20llm\x20use\x20<project-name>','deleteProject','llm:agent:delete','chats','numeric','projectId','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Checking\x20for\x20existing\x20projects...','prompts','maxToolIterations','153530sCtITB','[unknown]','llm:use','Resolving\x20project\x20\x27','projectName','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','__load_more__','deleteAgent','23178290pTPtBh','List\x20agents\x20in\x20current\x20project','filter','blue','bold','starterMessage','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','verbose','toLowerCase','Fetching\x20most\x20recent\x20chat...','List\x20available\x20LLM\x20models','magenta','\x20\x20Integrations:\x20','llm:projects','targetAgent','dim','sourceSite','json','setCurrentProject','createProject','existsSync','\x20bytes)','rmSync','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','toLocaleDateString','m\x20ago','split','content','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Agent\x20deleted:\x20','red','counts','(no\x20agent)','slice'];a26_0x43f9=function(){return _0x39cacf;};return a26_0x43f9();}function toAgentInfo(_0x750b3c){const _0x3792a9=a26_0x5881;return{'name':_0x750b3c[_0x3792a9(0xda)][_0x3792a9(0x155)],'description':_0x750b3c[_0x3792a9(0xda)]['description'],'prompt':truncatePrompt(_0x750b3c['attributes']['prompt']),'createdAt':_0x750b3c['attributes'][_0x3792a9(0x176)],'updatedAt':_0x750b3c[_0x3792a9(0xda)]['updatedAt']};}function truncatePrompt(_0x512c40){const _0x28d36e=a26_0x5881;if(!_0x512c40)return undefined;const _0x1922e8=0x64;if(_0x512c40[_0x28d36e(0xe3)]<=_0x1922e8)return _0x512c40;return _0x512c40[_0x28d36e(0x127)](0x0,_0x1922e8)+'...';}export class LLMModelsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf1);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x110);async[a26_0x5cc08c(0x158)](_0x194ee9){const _0x3e1f22=a26_0x5cc08c,{options:_0x2c94da,tdx:_0x53c9d2}=_0x194ee9;try{const _0x8fb14d=await withSpinner('Fetching\x20available\x20models...',()=>_0x53c9d2[_0x3e1f22(0x186)]['models'](),{'verbose':_0x2c94da[_0x3e1f22(0x10d)]});return await handleSDKOutput(_0x8fb14d[_0x3e1f22(0x17b)],_0x2c94da),0x0;}catch(_0x3f26ea){return handleSDKError(_0x3f26ea,_0x2c94da),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x113);['description']='List\x20all\x20LLM\x20projects';async[a26_0x5cc08c(0x158)](_0x20e617){const _0x2eac68=a26_0x5cc08c,{options:_0x337934,args:_0x561f54,tdx:_0x33522e}=_0x20e617;try{const _0x341fd4=_0x561f54[0x0],_0x173f91=resolveLimit(_0x337934[_0x2eac68(0x159)],DEFAULT_LLM_LIMIT),_0x148fa6=await withSpinner(_0x2eac68(0x182),()=>_0x33522e[_0x2eac68(0x186)][_0x2eac68(0x18b)](_0x173f91),{'verbose':_0x337934[_0x2eac68(0x10d)]});let _0x545872=_0x148fa6[_0x2eac68(0x17b)];_0x341fd4&&(_0x545872=_0x148fa6[_0x2eac68(0x17b)][_0x2eac68(0x108)](_0x973e2a=>matchGlobPattern(_0x973e2a[_0x2eac68(0xda)][_0x2eac68(0x155)],_0x341fd4)));const _0x42603d=_0x545872[_0x2eac68(0x16a)](toLLMProjectInfo);return await handleSDKOutput(_0x42603d,_0x337934),0x0;}catch(_0x4c2dd5){return handleSDKError(_0x4c2dd5,_0x337934),0x1;}}}function a26_0x5881(_0x2e8201,_0x34545d){_0x2e8201=_0x2e8201-0xd5;const _0x43f952=a26_0x43f9();let _0x5881f2=_0x43f952[_0x2e8201];return _0x5881f2;}export class LLMAgentsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf0);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x107);async['execute'](_0x33884e){const _0x193c5a=a26_0x5cc08c,{options:_0x4a13ac,args:_0x1ebb44,tdx:_0x2f3140}=_0x33884e;try{const _0x3a9563=_0x1ebb44[0x0];let _0x19ff6d,_0x59222a=_0x3a9563;if(_0x3a9563&&_0x3a9563[_0x193c5a(0x16e)]('/')){const _0x14fea7=_0x3a9563[_0x193c5a(0x120)]('/');if(_0x14fea7['length']===0x2){const [_0xc7a9a0,_0x253999]=_0x14fea7,_0x1c7553=await _0x2f3140['llm'][_0x193c5a(0x18b)](),_0x3e0b63=_0x1c7553[_0x193c5a(0x140)](_0x2a8df5=>_0x2a8df5[_0x193c5a(0xda)][_0x193c5a(0x155)][_0x193c5a(0x10e)]()===_0xc7a9a0[_0x193c5a(0x10e)]());if(!_0x3e0b63)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0xc7a9a0,undefined,{'helpText':_0x193c5a(0xf3)});_0x19ff6d=_0x3e0b63['id'],_0x59222a=_0x253999;}else throw new SDKError(ErrorCode[_0x193c5a(0xe5)],'Invalid\x20path\x20syntax:\x20'+_0x3a9563,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x19ff6d=await getProjectIdOrDefault(_0x33884e);const _0x5e56b6=await withSpinner(_0x193c5a(0x192),()=>_0x2f3140['llm'][_0x193c5a(0x188)](_0x19ff6d),{'verbose':_0x4a13ac[_0x193c5a(0x10d)]});let _0x1eadf7=_0x5e56b6['data'];_0x59222a&&(_0x1eadf7=_0x5e56b6[_0x193c5a(0x17b)][_0x193c5a(0x108)](_0x5dff47=>matchGlobPattern(_0x5dff47[_0x193c5a(0xda)][_0x193c5a(0x155)],_0x59222a)));const _0x337d09=_0x1eadf7['map'](toAgentInfo);return await handleSDKOutput(_0x337d09,_0x4a13ac),0x0;}catch(_0x421e26){return handleSDKError(_0x421e26,_0x4a13ac),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xd5);[a26_0x5cc08c(0x146)]='Show\x20agent\x20details';async['execute'](_0x5a0550){const _0x45ee93=a26_0x5cc08c,{options:_0x2b5bc9,args:_0x5998c6,tdx:_0x5d99ed}=_0x5a0550;if(_0x5998c6[_0x45ee93(0xe3)]===0x0)return console[_0x45ee93(0x16c)](_0x45ee93(0x13c)),console['error'](_0x45ee93(0x11d)),0x1;const _0x163a4c=_0x5998c6[0x0];try{const _0x2522a9=await getProjectIdOrDefault(_0x5a0550),_0x123855=await withSpinner('Resolving\x20agent\x20\x27'+_0x163a4c+_0x45ee93(0xe9),()=>_0x5d99ed[_0x45ee93(0x186)][_0x45ee93(0x17d)](_0x163a4c,_0x2522a9),{'verbose':_0x2b5bc9['verbose']}),_0x1e6267=await withSpinner(_0x45ee93(0x12b),()=>_0x5d99ed[_0x45ee93(0x186)][_0x45ee93(0x142)](_0x123855[_0x45ee93(0x17b)]),{'verbose':_0x2b5bc9[_0x45ee93(0x10d)]});return await handleSDKOutput([_0x1e6267[_0x45ee93(0x17b)]],_0x2b5bc9),0x0;}catch(_0x16b805){return handleSDKError(_0x16b805,_0x2b5bc9),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x16d);[a26_0x5cc08c(0x146)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a26_0x5cc08c(0x158)](_0x3ddb25){const _0x255338=a26_0x5cc08c,{options:_0x177db4,args:_0x3e3c08,tdx:_0x5b6a1b}=_0x3ddb25;if(_0x3e3c08[_0x255338(0xe3)]===0x0)return console[_0x255338(0x16c)](_0x255338(0x13c)),console[_0x255338(0x16c)](_0x255338(0xef)),console[_0x255338(0x16c)](_0x255338(0x14d)),0x1;const _0x18b97d=_0x3e3c08[0x0],_0x18b2b8=_0x177db4,_0x232357=_0x18b2b8[_0x255338(0xe8)],_0x2f592b=_0x18b2b8[_0x255338(0x144)]||_0x255338(0x147),_0x28f3c5=_0x18b2b8[_0x255338(0x10b)],_0x529c5d=_0x18b2b8[_0x255338(0xfd)]?Number(_0x18b2b8['maxToolIterations']):undefined,_0x64755d=_0x18b2b8[_0x255338(0xe1)]?Number(_0x18b2b8[_0x255338(0xe1)]):undefined;try{let _0x8b0123,_0xbde4e1;if(_0x18b97d['includes']('/')){const _0x22fa1a=_0x18b97d[_0x255338(0x120)]('/');if(_0x22fa1a[_0x255338(0xe3)]===0x2){const [_0x37d139,_0x5618e1]=_0x22fa1a,_0x3b8f7b=await withSpinner('Resolving\x20project\x20\x27'+_0x37d139+'\x27...',()=>_0x5b6a1b[_0x255338(0x186)][_0x255338(0x163)](_0x37d139),{'verbose':_0x177db4[_0x255338(0x10d)]});_0x8b0123=_0x3b8f7b[_0x255338(0x17b)],_0xbde4e1=_0x5618e1;}else throw new SDKError(ErrorCode[_0x255338(0xe5)],_0x255338(0xeb)+_0x18b97d,undefined,{'helpText':_0x255338(0x14c)});}else _0x8b0123=await getProjectIdOrDefault(_0x3ddb25),_0xbde4e1=_0x18b97d;const _0x5d0aa7=await withSpinner('Creating\x20agent\x20\x27'+_0xbde4e1+_0x255338(0xe9),()=>_0x5b6a1b[_0x255338(0x186)][_0x255338(0x18e)]({'name':_0xbde4e1,'projectId':_0x8b0123,'modelType':_0x2f592b,'systemPrompt':_0x232357,'starterMessage':_0x28f3c5,'maxToolIterations':_0x529c5d,'temperature':_0x64755d}),{'verbose':_0x177db4[_0x255338(0x10d)]});return console['log'](_0x255338(0x177)+_0x5d0aa7[_0x255338(0x17b)]['id']),await handleSDKOutput([_0x5d0aa7[_0x255338(0x17b)]],_0x177db4),0x0;}catch(_0x5c9029){return handleSDKError(_0x5c9029,_0x177db4),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x197);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0xec);async[a26_0x5cc08c(0x158)](_0x3b8ed2){const _0x590dd3=a26_0x5cc08c,{options:_0xa077ac,args:_0x4e5830,tdx:_0x29d124}=_0x3b8ed2;if(_0x4e5830[_0x590dd3(0xe3)]===0x0)return console[_0x590dd3(0x16c)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x590dd3(0x16c)](_0x590dd3(0x171)),0x1;const _0x2306bf=_0x4e5830[0x0],_0x1f0504=_0xa077ac,_0x46804b=_0x1f0504[_0x590dd3(0x155)],_0x2a02a=_0x1f0504['prompt'],_0x1f7373=_0x1f0504[_0x590dd3(0x146)],_0x54dc39=_0x1f0504[_0x590dd3(0x10b)];if(!_0x46804b&&!_0x2a02a&&!_0x1f7373&&!_0x54dc39)return console['error'](_0x590dd3(0x170)),console[_0x590dd3(0x16c)](_0x590dd3(0x122)),0x1;try{const _0x25e3cb=await getProjectIdOrDefault(_0x3b8ed2),_0x41ecd9=await withSpinner(_0x590dd3(0x195)+_0x2306bf+_0x590dd3(0xe9),()=>_0x29d124[_0x590dd3(0x186)]['resolveAgentId'](_0x2306bf,_0x25e3cb),{'verbose':_0xa077ac[_0x590dd3(0x10d)]}),_0x393b71=_0x41ecd9['data'],_0x4aa4ce=await withSpinner('Updating\x20agent...',()=>_0x29d124[_0x590dd3(0x186)][_0x590dd3(0x152)](_0x393b71,{'name':_0x46804b,'prompt':_0x2a02a,'description':_0x1f7373,'starterMessage':_0x54dc39}),{'verbose':_0xa077ac[_0x590dd3(0x10d)]});return console['log'](_0x590dd3(0x193)+_0x4aa4ce[_0x590dd3(0x17b)]['id']),await handleSDKOutput([_0x4aa4ce[_0x590dd3(0x17b)]],_0xa077ac),0x0;}catch(_0x30d2ac){return handleSDKError(_0x30d2ac,_0xa077ac),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a26_0x5cc08c(0xf6);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x139);async[a26_0x5cc08c(0x158)](_0x45e25f){const _0x484160=a26_0x5cc08c,{options:_0x22c4bd,args:_0x19dae0,tdx:_0x3dbf56}=_0x45e25f;if(_0x19dae0[_0x484160(0xe3)]===0x0)return console[_0x484160(0x16c)](_0x484160(0x13c)),console[_0x484160(0x16c)](_0x484160(0x174)),0x1;const _0x5d27a7=_0x19dae0[0x0];try{const _0x19cf28=await getProjectIdOrDefault(_0x45e25f),_0x338747=await withSpinner(_0x484160(0x195)+_0x5d27a7+'\x27...',()=>_0x3dbf56['llm'][_0x484160(0x17d)](_0x5d27a7,_0x19cf28),{'verbose':_0x22c4bd[_0x484160(0x10d)]}),_0x47ccd7=_0x338747[_0x484160(0x17b)];return await withSpinner('Deleting\x20agent...',()=>_0x3dbf56[_0x484160(0x186)][_0x484160(0x105)](_0x47ccd7),{'verbose':_0x22c4bd[_0x484160(0x10d)]}),console[_0x484160(0x196)](_0x484160(0x123)+_0x47ccd7),0x0;}catch(_0x1ef89e){return handleSDKError(_0x1ef89e,_0x22c4bd),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a26_0x5cc08c(0x156);['description']=a26_0x5cc08c(0xfa);async['execute'](_0x4ed13a){return executeChatHistoryCommand(_0x4ed13a,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x100);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x180);async['execute'](_0x4bbe37){const _0x1a43d9=a26_0x5cc08c,{options:_0x5c0367,args:_0x2ccc92,tdx:_0x4f38be}=_0x4bbe37;if(_0x2ccc92[_0x1a43d9(0xe3)]===0x0)return console[_0x1a43d9(0x16c)](_0x1a43d9(0x175)),console[_0x1a43d9(0x16c)](_0x1a43d9(0xf4)),0x1;const _0x39578c=_0x2ccc92[0x0];try{return await withSpinner(_0x1a43d9(0x19b)+_0x39578c+_0x1a43d9(0xe9),()=>_0x4f38be[_0x1a43d9(0x186)][_0x1a43d9(0x118)](_0x39578c),{'verbose':_0x5c0367[_0x1a43d9(0x10d)]}),console['log'](_0x1a43d9(0x17c)+_0x39578c),0x0;}catch(_0x36aaac){return handleSDKError(_0x36aaac,_0x5c0367),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]='llm:project:create';['description']='Create\x20a\x20new\x20LLM\x20project';async['execute'](_0x155a6d){const _0x14c14e=a26_0x5cc08c,{options:_0x48e5e6,args:_0x4a3b0d,tdx:_0x308e64}=_0x155a6d;if(_0x4a3b0d['length']===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x14c14e(0x16c)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x4b5105=_0x4a3b0d[0x0],_0x3c00ce=_0x48e5e6,_0x4c2ecf=_0x3c00ce[_0x14c14e(0x146)];try{const _0x2d8b3d=await withSpinner(_0x14c14e(0x160)+_0x4b5105+_0x14c14e(0xe9),()=>_0x308e64[_0x14c14e(0x186)][_0x14c14e(0x119)]({'name':_0x4b5105,'description':_0x4c2ecf}),{'verbose':_0x48e5e6[_0x14c14e(0x10d)]});console['log'](_0x14c14e(0x178)+_0x2d8b3d[_0x14c14e(0x17b)]['id']);const _0x1b64c5=toLLMProjectInfo(_0x2d8b3d['data']);return await handleSDKOutput([_0x1b64c5],_0x48e5e6),0x0;}catch(_0x1189c0){return handleSDKError(_0x1189c0,_0x48e5e6),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x194);['description']='Delete\x20an\x20LLM\x20project';async[a26_0x5cc08c(0x158)](_0x462a79){const _0xa7b0ae=a26_0x5cc08c,{options:_0x1da628,args:_0x3b6000,tdx:_0x20c4c5}=_0x462a79;if(_0x3b6000[_0xa7b0ae(0xe3)]===0x0)return console['error'](_0xa7b0ae(0x175)),console['error']('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x25bb5f=_0x3b6000[0x0];try{return await withSpinner(_0xa7b0ae(0x137)+_0x25bb5f+_0xa7b0ae(0xe9),()=>_0x20c4c5[_0xa7b0ae(0x186)][_0xa7b0ae(0xf5)](_0x25bb5f),{'verbose':_0x1da628[_0xa7b0ae(0x10d)]}),console[_0xa7b0ae(0x196)]('Project\x20deleted:\x20'+_0x25bb5f),0x0;}catch(_0x54dfc4){return handleSDKError(_0x54dfc4,_0x1da628),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a26_0x5cc08c(0x13e);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x149);async[a26_0x5cc08c(0x158)](_0x5b3ee7){const _0x3f13ac=a26_0x5cc08c,{options:_0xc6367b,args:_0x3a8596,tdx:_0x582bd5}=_0x5b3ee7;if(_0x3a8596[_0x3f13ac(0xe3)]===0x0)return console['error'](_0x3f13ac(0x175)),console[_0x3f13ac(0x16c)](_0x3f13ac(0x103)),0x1;const _0x7b796e=_0x3a8596[0x0],_0x31aa7e=_0xc6367b,_0x4f6442=_0x31aa7e['output'],_0x2419d0=_0x31aa7e['dryRun'];try{const _0x1072ae=_0x4f6442||_0x7b796e+_0x3f13ac(0x132);if(a26_0x35856c[_0x3f13ac(0x11a)](_0x1072ae)&&!_0x2419d0){if(!_0xc6367b[_0x3f13ac(0x13b)]){const _0x2f63b1=await confirm(_0x3f13ac(0x151)+_0x1072ae+_0x3f13ac(0x183));if(!_0x2f63b1)return console['log'](_0x3f13ac(0xd7)),0x0;}a26_0x35856c[_0x3f13ac(0x11c)](_0x1072ae,{'recursive':!![]});}const _0x13344c=await withSpinner(_0x2419d0?_0x3f13ac(0x157)+_0x7b796e+_0x3f13ac(0xe9):_0x3f13ac(0xdc)+_0x7b796e+_0x3f13ac(0xe9),()=>_0x582bd5[_0x3f13ac(0x186)]['backupProject'](_0x7b796e,_0x4f6442,{'dryRun':_0x2419d0}),{'verbose':_0xc6367b['verbose']}),_0x2b4d78=_0x13344c[_0x3f13ac(0x17b)];return _0x2419d0?console[_0x3f13ac(0x196)](_0x3f13ac(0x179)+_0x2b4d78['outputDir']):console[_0x3f13ac(0x196)](_0x3f13ac(0x165)+_0x2b4d78[_0x3f13ac(0x129)]),console[_0x3f13ac(0x196)](_0x3f13ac(0x136)+_0x2b4d78[_0x3f13ac(0x125)]['agents']),console[_0x3f13ac(0x196)](_0x3f13ac(0x15f)+_0x2b4d78[_0x3f13ac(0x125)][_0x3f13ac(0xd9)]),console['log'](_0x3f13ac(0xdb)+_0x2b4d78[_0x3f13ac(0x125)][_0x3f13ac(0xfc)]),console['log']('\x20\x20Integrations:\x20'+_0x2b4d78['counts'][_0x3f13ac(0xe7)]),(_0xc6367b['format']===_0x3f13ac(0x117)||_0xc6367b[_0x3f13ac(0x12d)]===_0x3f13ac(0x15d))&&await handleSDKOutput([_0x2b4d78],_0xc6367b),0x0;}catch(_0xc6bf94){return handleSDKError(_0xc6bf94,_0xc6367b),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x14a);[a26_0x5cc08c(0x146)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder';async[a26_0x5cc08c(0x158)](_0x6e5b46){const _0x49e3cf=a26_0x5cc08c,{options:_0x46ba90,args:_0x3c6c7c,tdx:_0x5aaa19}=_0x6e5b46;if(_0x3c6c7c['length']===0x0)return console[_0x49e3cf(0x16c)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x49e3cf(0x16c)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x2ab7a8=_0x3c6c7c[0x0],_0x8f2ace=_0x46ba90,_0x294845=_0x8f2ace[_0x49e3cf(0x155)],_0x312fbf=_0x8f2ace[_0x49e3cf(0xf2)];try{if(!_0x312fbf){const _0x4fe728=_0x5aaa19['llm'][_0x49e3cf(0x150)](_0x2ab7a8),_0x1a38e7=_0x294845||_0x4fe728[_0x49e3cf(0xdf)][_0x49e3cf(0x102)],_0x41698a=await withSpinner(_0x49e3cf(0xfb),()=>_0x5aaa19['llm']['projects'](),{'verbose':_0x46ba90[_0x49e3cf(0x10d)]}),_0x142b4f=_0x41698a[_0x49e3cf(0x17b)]['find'](_0x5f2ccd=>_0x5f2ccd[_0x49e3cf(0xda)][_0x49e3cf(0x155)]===_0x1a38e7);if(_0x142b4f&&!_0x46ba90[_0x49e3cf(0x13b)]){const _0x284f44=await confirm(_0x49e3cf(0x148)+_0x1a38e7+_0x49e3cf(0x10c));if(!_0x284f44)return console['log']('Restore\x20cancelled.'),0x0;}}const _0x11fb4d=await withSpinner(_0x312fbf?_0x49e3cf(0x166)+_0x2ab7a8+_0x49e3cf(0xe9):'Restoring\x20project\x20from\x20\x27'+_0x2ab7a8+_0x49e3cf(0xe9),()=>_0x5aaa19[_0x49e3cf(0x186)]['restoreProject'](_0x2ab7a8,{'name':_0x294845,'dryRun':_0x312fbf}),{'verbose':_0x46ba90[_0x49e3cf(0x10d)]}),_0x56ff68=_0x11fb4d['data'];return _0x56ff68['sourceSite']&&console[_0x49e3cf(0x196)](_0x49e3cf(0x18d)+_0x56ff68[_0x49e3cf(0x116)]+'\x27'),_0x312fbf?console[_0x49e3cf(0x196)]('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x56ff68[_0x49e3cf(0x102)]):console[_0x49e3cf(0x196)](_0x49e3cf(0x15a)+_0x56ff68[_0x49e3cf(0x102)]+'\x20('+_0x56ff68[_0x49e3cf(0xf9)]+')'),console[_0x49e3cf(0x196)](_0x49e3cf(0x136)+_0x56ff68['counts'][_0x49e3cf(0x188)]),console[_0x49e3cf(0x196)](_0x49e3cf(0x15f)+_0x56ff68[_0x49e3cf(0x125)][_0x49e3cf(0xd9)]),console[_0x49e3cf(0x196)]('\x20\x20Prompts:\x20'+_0x56ff68[_0x49e3cf(0x125)][_0x49e3cf(0xfc)]),console[_0x49e3cf(0x196)](_0x49e3cf(0x112)+_0x56ff68[_0x49e3cf(0x125)]['integrations']),(_0x46ba90[_0x49e3cf(0x12d)]===_0x49e3cf(0x117)||_0x46ba90[_0x49e3cf(0x12d)]===_0x49e3cf(0x15d))&&await handleSDKOutput([_0x56ff68],_0x46ba90),0x0;}catch(_0x534874){return handleSDKError(_0x534874,_0x46ba90),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x237c87,_0x3c220f){const _0x3f5e7b=a26_0x5cc08c,_0x2a56f5=_0x3c220f[_0x3f5e7b(0x159)]||CHAT_SELECTOR_PAGE_SIZE;let _0x399f1a=0x0,_0x558ac6=[];const _0x2a761c=(await import('prompts'))[_0x3f5e7b(0xdd)],_0x536c98=getChalk(_0x3c220f);while(!![]){const _0x2880f8=await withSpinner(_0x3f5e7b(0x199),()=>_0x237c87[_0x3f5e7b(0x186)][_0x3f5e7b(0xf7)](_0x2a56f5+_0x399f1a),{'verbose':_0x3c220f[_0x3f5e7b(0x10d)]});_0x558ac6=_0x2880f8['data'];const _0x38c00e=_0x558ac6[_0x3f5e7b(0x127)](_0x399f1a,_0x399f1a+_0x2a56f5),_0x559163=_0x558ac6[_0x3f5e7b(0xe3)]>_0x399f1a+_0x2a56f5,_0x355dbd=[...new Set(_0x38c00e[_0x3f5e7b(0x16a)](_0x19525b=>_0x19525b[_0x3f5e7b(0xda)][_0x3f5e7b(0x161)])[_0x3f5e7b(0x108)](_0x4fb62e=>_0x4fb62e!==undefined))],_0x38b285=new Map();await Promise[_0x3f5e7b(0x18a)](_0x355dbd[_0x3f5e7b(0x16a)](async _0x2570e4=>{const _0x210c9c=_0x3f5e7b;try{const _0x39ecc0=await _0x237c87[_0x210c9c(0x186)][_0x210c9c(0x142)](_0x2570e4);_0x38b285[_0x210c9c(0x18c)](_0x2570e4,_0x39ecc0[_0x210c9c(0xda)][_0x210c9c(0x155)]);}catch{_0x38b285['set'](_0x2570e4,_0x2570e4);}}));const _0x57866f=_0x38c00e[_0x3f5e7b(0x16a)](_0x55f8af=>{const _0x306261=_0x3f5e7b,_0x50e577=_0x55f8af[_0x306261(0xda)]['firstInputContent']||_0x306261(0x173),_0x2aaf0f=_0x50e577[_0x306261(0x120)]('\x0a')[0x0],_0x223587=_0x2aaf0f[_0x306261(0xe3)]>0x50?_0x2aaf0f['substring'](0x0,0x4d)+'...':_0x2aaf0f,_0x49c87d=_0x55f8af['attributes'][_0x306261(0x161)]?_0x38b285[_0x306261(0xed)](_0x55f8af[_0x306261(0xda)][_0x306261(0x161)])||_0x55f8af['attributes'][_0x306261(0x161)]:_0x306261(0x126),_0x17eace=_0x55f8af[_0x306261(0xda)]['lastConversationAt']||_0x55f8af[_0x306261(0xda)][_0x306261(0x19a)],_0x1628d5=new Date(_0x17eace),_0x473e56=new Date(),_0x36295a=_0x473e56[_0x306261(0x14e)]()-_0x1628d5[_0x306261(0x14e)](),_0x5e51=Math[_0x306261(0x15e)](_0x36295a/0xea60),_0x2ef555=Math[_0x306261(0x15e)](_0x36295a/0x36ee80),_0x2c81c2=Math['floor'](_0x36295a/0x5265c00);let _0x588b18;if(_0x5e51<0x1)_0x588b18=_0x306261(0x185);else{if(_0x5e51<0x3c)_0x588b18=_0x5e51+_0x306261(0x11f);else{if(_0x2ef555<0x18)_0x588b18=_0x2ef555+_0x306261(0x13f);else _0x2c81c2<0x7?_0x588b18=_0x2c81c2+_0x306261(0x14b):_0x588b18=_0x1628d5[_0x306261(0x11e)]('en-US',{'month':'short','day':_0x306261(0xf8)});}}return{'title':_0x223587+'\x20'+_0x536c98['dim']('['+_0x49c87d+']\x20'+_0x588b18),'value':_0x55f8af['id']};});_0x559163&&_0x57866f[_0x3f5e7b(0x17a)]({'title':_0x536c98[_0x3f5e7b(0x154)](_0x3f5e7b(0xe0)),'value':'__load_more__'});const _0x3215be=await _0x2a761c({'type':_0x3f5e7b(0x17e),'name':_0x3f5e7b(0x162),'message':'Select\x20a\x20chat\x20session:','choices':_0x57866f,'hint':_0x3f5e7b(0xea)});if(!_0x3215be[_0x3f5e7b(0x162)])return undefined;if(_0x3215be[_0x3f5e7b(0x162)]===_0x3f5e7b(0x104)){_0x399f1a+=_0x2a56f5;continue;}return _0x3215be[_0x3f5e7b(0x162)];}}export class ChatsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf7);[a26_0x5cc08c(0x146)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a26_0x5cc08c(0x158)](_0x375340){return executeChatHistoryCommand(_0x375340,'tdx\x20chats');}}
1
+ const a26_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));}}
@@ -1 +1 @@
1
- const a27_0x5c0b46=a27_0x232f;(function(_0x29881e,_0x5394d0){const _0x3d93b8=a27_0x232f,_0x2047f3=_0x29881e();while(!![]){try{const _0x1926f7=-parseInt(_0x3d93b8(0xcd))/0x1+parseInt(_0x3d93b8(0xd4))/0x2*(-parseInt(_0x3d93b8(0xd1))/0x3)+-parseInt(_0x3d93b8(0xda))/0x4*(-parseInt(_0x3d93b8(0xeb))/0x5)+-parseInt(_0x3d93b8(0xd9))/0x6*(parseInt(_0x3d93b8(0xd3))/0x7)+-parseInt(_0x3d93b8(0xf6))/0x8+-parseInt(_0x3d93b8(0xc8))/0x9*(-parseInt(_0x3d93b8(0xe7))/0xa)+parseInt(_0x3d93b8(0xd8))/0xb;if(_0x1926f7===_0x5394d0)break;else _0x2047f3['push'](_0x2047f3['shift']());}catch(_0x478341){_0x2047f3['push'](_0x2047f3['shift']());}}}(a27_0x5f88,0xc15af));import a27_0xa037c1 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x24dbfd,_0x19642c){const _0x5da01b=a27_0x232f,{tdx:_0x48e7b6,options:_0x344c36}=_0x24dbfd,_0x1de470=_0x19642c||_0x344c36[_0x5da01b(0xd7)];if(_0x1de470){const _0x288155=await _0x48e7b6[_0x5da01b(0xcb)][_0x5da01b(0xfb)](),_0xf91d0=_0x288155[_0x5da01b(0xf3)](_0x1f67f6=>_0x1f67f6[_0x5da01b(0xf0)][_0x5da01b(0xed)]===_0x1de470);if(!_0xf91d0)throw new SDKError(ErrorCode[_0x5da01b(0xca)],_0x5da01b(0xc4)+_0x1de470+_0x5da01b(0xff),undefined,{'helpText':_0x5da01b(0xf8)});return _0xf91d0['id'];}const _0x22da1c=await _0x48e7b6[_0x5da01b(0xcb)]['getOrCreateDefaultProject']();return _0x22da1c['id'];}function a27_0x5f88(){const _0x5d802b=['\x20\x20Address:','white','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','bold','close','http://0.0.0.0:','logLevel','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x20\x20Site:','server','102360RAYvca','green','log','exit','365VMedZI','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','name','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','dim','attributes','\x20\x20\x20\x20}','SIGTERM','find','yellow','\x20\x20}','6583824FpVjqS','description','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x0a\x0aShutting\x20down\x20proxy\x20server...','site','projects','\x20is\x20unavailable,\x20using\x20port\x20','logger','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x27\x20not\x20found','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','Port\x20','project','created\x20on-demand\x20per\x20model','Project\x20\x27','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','execute','port','1089KWKKch','Server\x20Configuration:','NOT_FOUND','llm','start','799945mTQjkv','SIGINT','stop','\x20\x20Agents:','57918dBocpH','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','355747jiMEjM','22mfwJbW','\x0aClaude\x20Code\x20Configuration:','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','llmProject','14360368cUhtOo','30nqEfSk','18484VDNgRk','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration'];a27_0x5f88=function(){return _0x5d802b;};return a27_0x5f88();}function a27_0x232f(_0x383d91,_0x336583){_0x383d91=_0x383d91-0xc4;const _0x5f889d=a27_0x5f88();let _0x232f40=_0x5f889d[_0x383d91];return _0x232f40;}export class LLMProxyCommand extends BaseCommand{[a27_0x5c0b46(0xed)]='llm:proxy';[a27_0x5c0b46(0xf7)]=a27_0x5c0b46(0xdc);[a27_0x5c0b46(0xe6)];['logger'];async[a27_0x5c0b46(0xc6)](_0x250bdc){const _0x2b4ebd=a27_0x5c0b46,{tdx:_0x31e625,options:_0x190e0a}=_0x250bdc;try{const _0x24f9ea=_0x190e0a,_0x2bd48d=_0x24f9ea[_0x2b4ebd(0xc7)]||0xfa0,_0x1845d4=_0x24f9ea[_0x2b4ebd(0x102)],_0x42b17e=await findAvailablePort(_0x2bd48d);console['log'](a27_0xa037c1[_0x2b4ebd(0xef)]('Resolving\x20project...'));const _0x2a5f9c=await getProjectIdOrDefault(_0x250bdc,_0x1845d4),_0xcb3d8c=await _0x31e625[_0x2b4ebd(0xcb)]['projects'](),_0x1f09d1=_0xcb3d8c[_0x2b4ebd(0xf3)](_0x4353b0=>_0x4353b0['id']===_0x2a5f9c);this['logger']=new TDXLogger(_0x190e0a[_0x2b4ebd(0xe3)]),await this[_0x2b4ebd(0xfd)]['init'](),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)]('Starting\x20proxy\x20server...'));_0x42b17e!==_0x2bd48d&&console[_0x2b4ebd(0xe9)](a27_0xa037c1['yellow'](_0x2b4ebd(0x101)+_0x2bd48d+_0x2b4ebd(0xfc)+_0x42b17e));this['server']=new ProxyServer({'port':_0x42b17e,'projectId':_0x2a5f9c,'tdx':_0x31e625,'logger':this['logger'],'site':_0x190e0a[_0x2b4ebd(0xfa)]}),await this[_0x2b4ebd(0xe6)][_0x2b4ebd(0xcc)](),console['log'](a27_0xa037c1['yellow'][_0x2b4ebd(0xe0)](_0x2b4ebd(0x100))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['yellow']('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console['log'](a27_0xa037c1['yellow'](_0x2b4ebd(0xc5))),console['log'](a27_0xa037c1[_0x2b4ebd(0xe8)]['bold'](_0x2b4ebd(0xd2))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['cyan'](_0x2b4ebd(0xc9))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['dim'](_0x2b4ebd(0xdd)),a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xe2)+_0x42b17e)),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)]('\x20\x20Project:'),a27_0xa037c1[_0x2b4ebd(0xde)](_0x1f09d1?.[_0x2b4ebd(0xf0)]['name']||_0x2a5f9c)),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xd0)),a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0x103))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xe5)),a27_0xa037c1[_0x2b4ebd(0xde)](_0x190e0a['site'])),console[_0x2b4ebd(0xe9)](a27_0xa037c1['cyan'](_0x2b4ebd(0xd5))),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xdb))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)]('\x20\x20{')),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console['log'](a27_0xa037c1[_0x2b4ebd(0xde)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x42b17e+'\x22,')),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xee))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xe4))),console['log'](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xf1))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xf5))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['cyan']('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xec))),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xdf))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xd6))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xf4)](_0x2b4ebd(0xfe)));const _0x5ab520=async()=>{const _0x4e8d22=_0x2b4ebd;console[_0x4e8d22(0xe9)](a27_0xa037c1[_0x4e8d22(0xef)](_0x4e8d22(0xf9))),this[_0x4e8d22(0xe6)]&&await this['server'][_0x4e8d22(0xcf)](),this['logger']&&await this[_0x4e8d22(0xfd)][_0x4e8d22(0xe1)](),console['log'](a27_0xa037c1[_0x4e8d22(0xe8)]('✓\x20Proxy\x20server\x20stopped')),process[_0x4e8d22(0xea)](0x0);};return process['on'](_0x2b4ebd(0xce),_0x5ab520),process['on'](_0x2b4ebd(0xf2),_0x5ab520),await new Promise(()=>{}),0x0;}catch(_0x3b3294){this['server']&&await this[_0x2b4ebd(0xe6)][_0x2b4ebd(0xcf)]();this['logger']&&await this[_0x2b4ebd(0xfd)][_0x2b4ebd(0xe1)]();throw _0x3b3294;}}}
1
+ const a27_0x9e025=a27_0x2b91;(function(_0x1a5bf1,_0x36c3a4){const _0xc932e2=a27_0x2b91,_0x28f923=_0x1a5bf1();while(!![]){try{const _0x57ecd4=parseInt(_0xc932e2(0x130))/0x1+parseInt(_0xc932e2(0x12c))/0x2*(-parseInt(_0xc932e2(0x12f))/0x3)+-parseInt(_0xc932e2(0x115))/0x4*(-parseInt(_0xc932e2(0xfb))/0x5)+-parseInt(_0xc932e2(0x119))/0x6+-parseInt(_0xc932e2(0x132))/0x7*(parseInt(_0xc932e2(0x126))/0x8)+-parseInt(_0xc932e2(0x124))/0x9*(parseInt(_0xc932e2(0x105))/0xa)+-parseInt(_0xc932e2(0x10f))/0xb*(-parseInt(_0xc932e2(0x10a))/0xc);if(_0x57ecd4===_0x36c3a4)break;else _0x28f923['push'](_0x28f923['shift']());}catch(_0x39f25d){_0x28f923['push'](_0x28f923['shift']());}}}(a27_0x6977,0xe992b));import a27_0xadf910 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x39b25b,_0x5dcbf0){const _0x4921d1=a27_0x2b91,{tdx:_0x1a48c8,options:_0x425f28}=_0x39b25b,_0x21e1e9=_0x5dcbf0||_0x425f28[_0x4921d1(0x107)];if(_0x21e1e9){const _0x520f0a=await _0x1a48c8[_0x4921d1(0x113)]['projects'](),_0x22633f=_0x520f0a[_0x4921d1(0x134)](_0x4ade76=>_0x4ade76[_0x4921d1(0x110)][_0x4921d1(0x114)]===_0x21e1e9);if(!_0x22633f)throw new SDKError(ErrorCode[_0x4921d1(0xfc)],_0x4921d1(0x121)+_0x21e1e9+_0x4921d1(0x10d),undefined,{'helpText':_0x4921d1(0x116)});return _0x22633f['id'];}const _0x5e0834=await _0x1a48c8[_0x4921d1(0x113)][_0x4921d1(0x109)]();return _0x5e0834['id'];}function a27_0x2b91(_0xa5beb,_0x1e45e6){_0xa5beb=_0xa5beb-0xfa;const _0x69772=a27_0x6977();let _0x2b91a7=_0x69772[_0xa5beb];return _0x2b91a7;}function a27_0x6977(){const _0x2f013e=['exit','\x20\x20Agents:','http://0.0.0.0:','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','Project\x20\x27','yellow','dim','9vlOrmf','\x20\x20\x20\x20\x22env\x22:\x20{','8KSEuvd','white','SIGTERM','description','Starting\x20proxy\x20server...','\x20\x20}','166598DBKUbV','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20Site:','12etDYiU','839070GqZCeu','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','8644069NgKdzF','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','find','init','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','15WquYkT','NOT_FOUND','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','SIGINT','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','execute','server','log','llm:proxy','port','2668060pWhbTF','green','llmProject','stop','getOrCreateDefaultProject','12UxWReR','close','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x27\x20not\x20found','cyan','26337905eaFNDY','attributes','created\x20on-demand\x20per\x20model','Resolving\x20project...','llm','name','899188oKGJvk','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','logger','bold','6697392SBbtzu','\x20\x20{','project','\x0aClaude\x20Code\x20Configuration:'];a27_0x6977=function(){return _0x2f013e;};return a27_0x6977();}export class LLMProxyCommand extends BaseCommand{['name']=a27_0x9e025(0x103);[a27_0x9e025(0x129)]=a27_0x9e025(0xfa);[a27_0x9e025(0x101)];[a27_0x9e025(0x117)];async[a27_0x9e025(0x100)](_0x1a8862){const _0x9dea30=a27_0x9e025,{tdx:_0x775307,options:_0x5a624d}=_0x1a8862;try{const _0x3f4982=_0x5a624d,_0x4de675=_0x3f4982[_0x9dea30(0x104)]||0xfa0,_0x299ac8=_0x3f4982[_0x9dea30(0x11b)],_0x53adad=await findAvailablePort(_0x4de675);console['log'](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x112)));const _0x51da61=await getProjectIdOrDefault(_0x1a8862,_0x299ac8),_0x3debe2=await _0x775307[_0x9dea30(0x113)]['projects'](),_0x27fad6=_0x3debe2[_0x9dea30(0x134)](_0x41acca=>_0x41acca['id']===_0x51da61);this['logger']=new TDXLogger(_0x5a624d['logLevel']),await this[_0x9dea30(0x117)][_0x9dea30(0x135)](),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x12a)));_0x53adad!==_0x4de675&&console[_0x9dea30(0x102)](a27_0xadf910['yellow']('Port\x20'+_0x4de675+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x53adad));this[_0x9dea30(0x101)]=new ProxyServer({'port':_0x53adad,'projectId':_0x51da61,'tdx':_0x775307,'logger':this[_0x9dea30(0x117)],'site':_0x5a624d['site']}),await this['server']['start'](),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x122)]['bold']('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0x9dea30(0x102)](a27_0xadf910['yellow'](_0x9dea30(0x133))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x122)](_0x9dea30(0x131))),console[_0x9dea30(0x102)](a27_0xadf910['green'][_0x9dea30(0x118)](_0x9dea30(0xfd))),console['log'](a27_0xadf910[_0x9dea30(0x10e)]('Server\x20Configuration:')),console[_0x9dea30(0x102)](a27_0xadf910['dim']('\x20\x20Address:'),a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x11f)+_0x53adad)),console[_0x9dea30(0x102)](a27_0xadf910['dim']('\x20\x20Project:'),a27_0xadf910['white'](_0x27fad6?.[_0x9dea30(0x110)]['name']||_0x51da61)),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x11e)),a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x111))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x12e)),a27_0xadf910[_0x9dea30(0x127)](_0x5a624d['site'])),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x10e)](_0x9dea30(0x11c))),console['log'](a27_0xadf910['dim']('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console['log'](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x11a))),console['log'](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x125))),console['log'](a27_0xadf910[_0x9dea30(0x127)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x53adad+'\x22,')),console[_0x9dea30(0x102)](a27_0xadf910['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console['log'](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0xff))),console['log'](a27_0xadf910[_0x9dea30(0x127)]('\x20\x20\x20\x20}')),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x12b))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x10e)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a27_0xadf910['dim']('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x12d))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x120))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x122)](_0x9dea30(0x10c)));const _0x212ee8=async()=>{const _0x2b89ae=_0x9dea30;console[_0x2b89ae(0x102)](a27_0xadf910[_0x2b89ae(0x123)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x2b89ae(0x101)]&&await this[_0x2b89ae(0x101)][_0x2b89ae(0x108)](),this[_0x2b89ae(0x117)]&&await this[_0x2b89ae(0x117)][_0x2b89ae(0x10b)](),console[_0x2b89ae(0x102)](a27_0xadf910[_0x2b89ae(0x106)]('✓\x20Proxy\x20server\x20stopped')),process[_0x2b89ae(0x11d)](0x0);};return process['on'](_0x9dea30(0xfe),_0x212ee8),process['on'](_0x9dea30(0x128),_0x212ee8),await new Promise(()=>{}),0x0;}catch(_0x2a0b7f){this[_0x9dea30(0x101)]&&await this[_0x9dea30(0x101)]['stop']();this[_0x9dea30(0x117)]&&await this[_0x9dea30(0x117)][_0x9dea30(0x10b)]();throw _0x2a0b7f;}}}