@treasuredata/tdx 0.7.3 → 0.7.4

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 (108) 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.d.ts +20 -1
  6. package/dist/client/cdp-api-client.d.ts.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/cdp-api-client.js.map +1 -1
  9. package/dist/client/engage-api-client.js +1 -1
  10. package/dist/client/http-client.js +1 -1
  11. package/dist/client/llm-api-client.js +1 -1
  12. package/dist/client/rate-limiter.js +1 -1
  13. package/dist/client/td-api-client.js +1 -1
  14. package/dist/client/trino-api-client.js +1 -1
  15. package/dist/client/workflow-client.js +1 -1
  16. package/dist/commands/activations.js +1 -1
  17. package/dist/commands/api-command.js +1 -1
  18. package/dist/commands/auth-command.js +1 -1
  19. package/dist/commands/chat-command.js +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/context-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-proxy.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pwd-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/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/credential-cache.js +1 -1
  48. package/dist/core/global-context.js +1 -1
  49. package/dist/core/keychain.js +1 -1
  50. package/dist/core/profile.js +1 -1
  51. package/dist/core/project-config.js +1 -1
  52. package/dist/core/session.js +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/proxy/anthropic-adapter.js +1 -1
  55. package/dist/proxy/claude-usage-tracker.js +1 -1
  56. package/dist/proxy/context-signature.js +1 -1
  57. package/dist/proxy/conversation-utils.js +1 -1
  58. package/dist/proxy/server.js +1 -1
  59. package/dist/proxy/session-cache.js +1 -1
  60. package/dist/sdk/api.js +1 -1
  61. package/dist/sdk/engage.js +1 -1
  62. package/dist/sdk/errors.js +1 -1
  63. package/dist/sdk/index.js +1 -1
  64. package/dist/sdk/job.js +1 -1
  65. package/dist/sdk/llm.js +1 -1
  66. package/dist/sdk/query.js +1 -1
  67. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  68. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  69. package/dist/sdk/segment.d.ts.map +1 -1
  70. package/dist/sdk/segment.js +1 -1
  71. package/dist/sdk/segment.js.map +1 -1
  72. package/dist/sdk/workflow.js +1 -1
  73. package/dist/types/cdp.d.ts +58 -0
  74. package/dist/types/cdp.d.ts.map +1 -1
  75. package/dist/types/endpoints.js +1 -1
  76. package/dist/types/index.d.ts +1 -1
  77. package/dist/types/index.d.ts.map +1 -1
  78. package/dist/types/index.js +1 -1
  79. package/dist/utils/agent-ref-parser.js +1 -1
  80. package/dist/utils/chat-cache.js +1 -1
  81. package/dist/utils/colors.js +1 -1
  82. package/dist/utils/command-output.js +1 -1
  83. package/dist/utils/constants.js +1 -1
  84. package/dist/utils/diff.js +1 -1
  85. package/dist/utils/fields-display.js +1 -1
  86. package/dist/utils/file-permissions.js +1 -1
  87. package/dist/utils/format-detector.js +1 -1
  88. package/dist/utils/formatters.js +1 -1
  89. package/dist/utils/json-loader.js +1 -1
  90. package/dist/utils/llm-backup-utils.js +1 -1
  91. package/dist/utils/model-aliases.js +1 -1
  92. package/dist/utils/model-factors.js +1 -1
  93. package/dist/utils/option-validation.js +1 -1
  94. package/dist/utils/port.js +1 -1
  95. package/dist/utils/process.js +1 -1
  96. package/dist/utils/prompt.js +1 -1
  97. package/dist/utils/segment-path-parser.js +1 -1
  98. package/dist/utils/segment-ref-parser.js +1 -1
  99. package/dist/utils/spinner.js +1 -1
  100. package/dist/utils/sql-parser.js +1 -1
  101. package/dist/utils/sse-parser.js +1 -1
  102. package/dist/utils/string-utils.js +1 -1
  103. package/dist/utils/table-ref-parser.js +1 -1
  104. package/dist/utils/tdx-logger.js +1 -1
  105. package/dist/utils/tree-formatter.js +1 -1
  106. package/dist/utils/version-check.js +1 -1
  107. package/dist/utils/workflow-utils.js +1 -1
  108. package/package.json +1 -1
@@ -1 +1 @@
1
- const a22_0x215c3a=a22_0x2f02;(function(_0x3ff88c,_0x2fea91){const _0x216246=a22_0x2f02,_0x18d528=_0x3ff88c();while(!![]){try{const _0x4ab54f=-parseInt(_0x216246(0x176))/0x1+-parseInt(_0x216246(0x158))/0x2+-parseInt(_0x216246(0x15c))/0x3+parseInt(_0x216246(0x11a))/0x4*(parseInt(_0x216246(0x137))/0x5)+parseInt(_0x216246(0x146))/0x6+-parseInt(_0x216246(0x186))/0x7+parseInt(_0x216246(0x15d))/0x8;if(_0x4ab54f===_0x2fea91)break;else _0x18d528['push'](_0x18d528['shift']());}catch(_0x1f74ab){_0x18d528['push'](_0x18d528['shift']());}}}(a22_0x3ff3,0xa23d2));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(_0x55a16d,_0x32153c,_0x4e48b7=![]){const _0xc13b73=a22_0x2f02;if(_0x55a16d[_0xc13b73(0x15e)])return await _0x32153c['engage'][_0xc13b73(0x12d)](_0x55a16d[_0xc13b73(0x15e)]);const _0x214dc5=loadSessionContext(_0x55a16d[_0xc13b73(0x17d)]);if(_0x214dc5?.[_0xc13b73(0x131)])return await _0x32153c[_0xc13b73(0x127)]['resolveWorkspaceId'](_0x214dc5[_0xc13b73(0x131)]);if(_0x4e48b7)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0xc13b73(0x189),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x43a588,_0x362896){const _0x1ca810=a22_0x2f02;if(!_0x43a588[_0x1ca810(0x144)])return{};const _0x453271=_0x43a588[_0x1ca810(0x144)],_0x2b2f7c=await _0x362896['segment']['resolvePathToResource'](_0x453271);return{'audienceId':_0x2b2f7c[_0x1ca810(0x14c)],'audienceName':_0x2b2f7c['parentName'],..._0x2b2f7c[_0x1ca810(0x174)]&&{'segmentId':_0x2b2f7c[_0x1ca810(0x174)],'segmentName':_0x2b2f7c['segmentName']}};}function buildConnectorConfig(_0x15b59b){const _0x2cfb46=a22_0x2f02,_0x18bb35=_0x15b59b['emailSenderId'],_0x2fc780=_0x15b59b[_0x2cfb46(0x18f)];if(!_0x18bb35&&!_0x2fc780)return undefined;return{..._0x18bb35&&{'emailSenderId':_0x18bb35},..._0x2fc780&&{'jsonColumns':_0x2fc780}};}export class EngageCampaignsCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:campaigns';[a22_0x215c3a(0x185)]='List\x20campaigns';async[a22_0x215c3a(0x16d)](_0x313871){const _0x53696d=a22_0x215c3a,{options:_0x2e28be,args:_0x497b36,tdx:_0x12431a}=_0x313871,_0x482557=_0x497b36[0x0],_0x15031c=resolveLimit(_0x2e28be[_0x53696d(0x10c)],DEFAULT_LLM_LIMIT),_0x1c29a7=_0x2e28be,_0x531a94=_0x1c29a7[_0x53696d(0x13c)],_0x52a80a=_0x1c29a7[_0x53696d(0x115)],_0x2f352e=await resolveWorkspaceIdFromOptions(_0x1c29a7,_0x12431a),_0x4cb7c8=await withSpinner('Fetching\x20campaigns...',()=>_0x12431a[_0x53696d(0x127)][_0x53696d(0x165)]({'type':_0x531a94,'status':_0x52a80a,'workspaceId':_0x2f352e,'limit':_0x15031c}),{'verbose':_0x2e28be[_0x53696d(0x125)]});let _0x573fb3=_0x4cb7c8[_0x53696d(0x149)];return _0x482557&&(_0x573fb3=_0x4cb7c8[_0x53696d(0x149)]['filter'](_0x3900a2=>matchGlobPattern(_0x3900a2[_0x53696d(0x192)],_0x482557))),await handleSDKOutput(_0x573fb3,_0x2e28be),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x191);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x17b);async[a22_0x215c3a(0x16d)](_0x557da3){const _0x3af699=a22_0x215c3a,{options:_0x488654,args:_0x23700d,tdx:_0x520edb}=_0x557da3;if(_0x23700d[_0x3af699(0x179)]===0x0)return console[_0x3af699(0x124)](_0x3af699(0x134)),console[_0x3af699(0x124)]('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0x2dba2e=_0x23700d[0x0],_0x5a996b=_0x488654,_0x488887=await resolveWorkspaceIdFromOptions(_0x5a996b,_0x520edb),_0x5cba67=_0x5a996b[_0x3af699(0x136)];if(_0x5cba67){const _0xe437a7=await withSpinner(_0x3af699(0x172)+_0x2dba2e+_0x3af699(0x178),()=>_0x520edb['engage']['getCampaignFull'](_0x2dba2e,_0x488887),{'verbose':_0x488654[_0x3af699(0x125)]});await handleSDKOutput([_0xe437a7],_0x488654);}else{const _0x4a1714=await withSpinner(_0x3af699(0x172)+_0x2dba2e+'\x27...',()=>_0x520edb[_0x3af699(0x127)]['getCampaign'](_0x2dba2e,_0x488887),{'verbose':_0x488654[_0x3af699(0x125)]});await handleSDKOutput([_0x4a1714],_0x488654);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x16b);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x121);async[a22_0x215c3a(0x16d)](_0x4e5319){const _0x314b27=a22_0x215c3a,{options:_0x4748b3,tdx:_0x5549dc}=_0x4e5319,_0xcb1d9b=_0x4748b3,_0x44333a=_0xcb1d9b[_0x314b27(0x192)],_0x5c718d=_0xcb1d9b['type'];if(!_0x44333a)return console['error'](_0x314b27(0x151)),console[_0x314b27(0x124)](_0x314b27(0x17c)),0x1;if(!_0x5c718d)return console[_0x314b27(0x124)](_0x314b27(0x118)),console[_0x314b27(0x124)](_0x314b27(0x17c)),0x1;const _0x520cd0=await resolveWorkspaceIdFromOptions(_0xcb1d9b,_0x5549dc,!![]),_0x6e5744=await resolveSegmentFromOptions(_0xcb1d9b,_0x5549dc),_0x24595a=buildConnectorConfig(_0xcb1d9b),_0x373d99={'name':_0x44333a,'campaignType':_0x5c718d,'workspaceId':_0x520cd0,'description':_0xcb1d9b['description'],..._0x6e5744,'connectorConfig':_0x24595a,'startAt':_0xcb1d9b[_0x314b27(0x145)],'timezone':_0xcb1d9b[_0x314b27(0x147)]},_0x8d2e77=await withSpinner(_0x314b27(0x181)+_0x44333a+_0x314b27(0x178),()=>_0x5549dc['engage']['createCampaign'](_0x373d99));return await handleSDKOutput([_0x8d2e77[_0x314b27(0x149)]],_0x4748b3),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x14d);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x155);async[a22_0x215c3a(0x16d)](_0x1fb75d){const _0x14da13=a22_0x215c3a,{options:_0x3821d5,args:_0x181912,tdx:_0x40b2a1}=_0x1fb75d;if(_0x181912[_0x14da13(0x179)]===0x0)return console[_0x14da13(0x124)](_0x14da13(0x134)),console['error'](_0x14da13(0x152)),0x1;const _0x34eeb9=_0x181912[0x0],_0x20827a=_0x3821d5,_0x3ddf48=await resolveWorkspaceIdFromOptions(_0x20827a,_0x40b2a1),_0x549b32=await resolveSegmentFromOptions(_0x20827a,_0x40b2a1),_0x15962e=buildConnectorConfig(_0x20827a),_0x21b52d={'name':_0x20827a['name'],'description':_0x20827a[_0x14da13(0x185)],..._0x549b32,'connectorConfig':_0x15962e,'startAt':_0x20827a[_0x14da13(0x145)],'timezone':_0x20827a[_0x14da13(0x147)]},_0x56e83b=Object[_0x14da13(0x140)](Object[_0x14da13(0x169)](_0x21b52d)['filter'](([,_0x171062])=>_0x171062!==undefined));if(Object[_0x14da13(0x170)](_0x56e83b)[_0x14da13(0x179)]===0x0)return console[_0x14da13(0x124)](_0x14da13(0x14b)),console[_0x14da13(0x124)](_0x14da13(0x173)),0x1;const _0x112a83=await withSpinner(_0x14da13(0x13a)+_0x34eeb9+_0x14da13(0x178),()=>_0x40b2a1[_0x14da13(0x127)][_0x14da13(0x16e)](_0x34eeb9,_0x56e83b,_0x3ddf48),{'verbose':_0x3821d5[_0x14da13(0x125)]});return await handleSDKOutput([_0x112a83[_0x14da13(0x149)]],_0x3821d5),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:campaign:delete';['description']=a22_0x215c3a(0x180);async[a22_0x215c3a(0x16d)](_0x3b4fc6){const _0x124450=a22_0x215c3a,{options:_0x47ab41,args:_0x41641e,tdx:_0x3f538a}=_0x3b4fc6;if(_0x41641e[_0x124450(0x179)]===0x0)return console[_0x124450(0x124)](_0x124450(0x134)),console[_0x124450(0x124)](_0x124450(0x11b)),0x1;const _0x1a707a=_0x41641e[0x0],_0x236d45=_0x47ab41,_0x107c1d=await resolveWorkspaceIdFromOptions(_0x236d45,_0x3f538a);if(!_0x47ab41['yes']){const _0x4fff03=await confirm(_0x124450(0x13f)+_0x1a707a+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x4fff03)return console[_0x124450(0x120)](_0x124450(0x11e)),0x0;}return await withSpinner('Deleting\x20campaign\x20\x27'+_0x1a707a+_0x124450(0x178),()=>_0x3f538a[_0x124450(0x127)][_0x124450(0x10e)](_0x1a707a,_0x107c1d),{'verbose':_0x47ab41['verbose']}),console['log'](_0x124450(0x141)+_0x1a707a+_0x124450(0x14e)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{['name']=a22_0x215c3a(0x16a);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x175);async['execute'](_0x26c2e9){const _0x37ad98=a22_0x215c3a,{options:_0x581cae,args:_0x52781c,tdx:_0x20bf7c}=_0x26c2e9;if(_0x52781c[_0x37ad98(0x179)]===0x0)return console[_0x37ad98(0x124)](_0x37ad98(0x134)),console['error'](_0x37ad98(0x13e)),0x1;const _0x20f268=_0x52781c[0x0],_0x14f563=_0x581cae,_0x5a4b44=await resolveWorkspaceIdFromOptions(_0x14f563,_0x20bf7c);return await withSpinner('Launching\x20campaign\x20\x27'+_0x20f268+_0x37ad98(0x178),()=>_0x20bf7c['engage'][_0x37ad98(0x177)](_0x20f268,_0x5a4b44),{'verbose':_0x581cae['verbose']}),console['log'](_0x37ad98(0x141)+_0x20f268+_0x37ad98(0x159)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{['name']='engage:campaign:pause';[a22_0x215c3a(0x185)]=a22_0x215c3a(0x17f);async[a22_0x215c3a(0x16d)](_0x4e1105){const _0x301376=a22_0x215c3a,{options:_0x45c8c1,args:_0x5d0f0e,tdx:_0xb3ee83}=_0x4e1105;if(_0x5d0f0e['length']===0x0)return console[_0x301376(0x124)](_0x301376(0x134)),console[_0x301376(0x124)](_0x301376(0x163)),0x1;const _0x145b31=_0x5d0f0e[0x0],_0x5cfbfa=_0x45c8c1,_0x427f60=await resolveWorkspaceIdFromOptions(_0x5cfbfa,_0xb3ee83);return await withSpinner(_0x301376(0x126)+_0x145b31+_0x301376(0x178),()=>_0xb3ee83[_0x301376(0x127)][_0x301376(0x132)](_0x145b31,_0x427f60),{'verbose':_0x45c8c1['verbose']}),console['log'](_0x301376(0x141)+_0x145b31+_0x301376(0x162)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a22_0x215c3a(0x12a);['description']=a22_0x215c3a(0x153);async[a22_0x215c3a(0x16d)](_0x178e66){const _0x1a2917=a22_0x215c3a,{options:_0x5e94ee,args:_0x1ae6e4,tdx:_0x5284af}=_0x178e66;if(_0x1ae6e4[_0x1a2917(0x179)]===0x0)return console[_0x1a2917(0x124)](_0x1a2917(0x134)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0x19dbe8=_0x1ae6e4[0x0],_0x59dc84=_0x5e94ee,_0x5d41c2=await resolveWorkspaceIdFromOptions(_0x59dc84,_0x5284af);return await withSpinner(_0x1a2917(0x148)+_0x19dbe8+_0x1a2917(0x178),()=>_0x5284af[_0x1a2917(0x127)][_0x1a2917(0x128)](_0x19dbe8,_0x5d41c2),{'verbose':_0x5e94ee['verbose']}),console[_0x1a2917(0x120)](_0x1a2917(0x141)+_0x19dbe8+_0x1a2917(0x18b)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a22_0x215c3a(0x161);['description']=a22_0x215c3a(0x11f);async[a22_0x215c3a(0x16d)](_0x309359){const _0x2aa65d=a22_0x215c3a,{options:_0x31cfb8,args:_0x5a746f,tdx:_0x5b3ac6}=_0x309359;if(_0x5a746f[_0x2aa65d(0x179)]===0x0)return console[_0x2aa65d(0x124)](_0x2aa65d(0x134)),console['error'](_0x2aa65d(0x12b)),0x1;const _0x40d382=_0x5a746f[0x0],_0x2e4c00=_0x31cfb8,_0x1d6c42=await resolveWorkspaceIdFromOptions(_0x2e4c00,_0x5b3ac6),_0x30751b=await withSpinner('Duplicating\x20campaign\x20\x27'+_0x40d382+_0x2aa65d(0x178),()=>_0x5b3ac6[_0x2aa65d(0x127)]['duplicateCampaign'](_0x40d382,_0x1d6c42),{'verbose':_0x31cfb8[_0x2aa65d(0x125)]});return await handleSDKOutput([_0x30751b[_0x2aa65d(0x149)]],_0x31cfb8),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a22_0x215c3a(0x16c);[a22_0x215c3a(0x185)]='List\x20email\x20templates';async[a22_0x215c3a(0x16d)](_0x278f5e){const _0x50b2a0=a22_0x215c3a,{options:_0x20bf36,args:_0x1a9059,tdx:_0x438ed2}=_0x278f5e,_0x1066f0=_0x1a9059[0x0],_0x536119=resolveLimit(_0x20bf36[_0x50b2a0(0x10c)],DEFAULT_LLM_LIMIT),_0x2ef5c6=_0x20bf36,_0x4b57ef=await resolveWorkspaceIdFromOptions(_0x2ef5c6,_0x438ed2),_0x255ed8=await withSpinner(_0x50b2a0(0x12f),()=>_0x438ed2[_0x50b2a0(0x127)][_0x50b2a0(0x122)]({'workspaceId':_0x4b57ef,'limit':_0x536119}),{'verbose':_0x20bf36[_0x50b2a0(0x125)]});let _0x2be116=_0x255ed8[_0x50b2a0(0x149)];return _0x1066f0&&(_0x2be116=_0x255ed8[_0x50b2a0(0x149)][_0x50b2a0(0x110)](_0x4da17a=>matchGlobPattern(_0x4da17a[_0x50b2a0(0x192)],_0x1066f0))),await handleSDKOutput(_0x2be116,_0x20bf36),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:template:show';['description']=a22_0x215c3a(0x14a);async[a22_0x215c3a(0x16d)](_0xe52804){const _0x55fa62=a22_0x215c3a,{options:_0x57d0d6,args:_0x29539f,tdx:_0x10fe32}=_0xe52804;if(_0x29539f[_0x55fa62(0x179)]===0x0)return console['error'](_0x55fa62(0x15b)),console[_0x55fa62(0x124)](_0x55fa62(0x12c)),0x1;const _0x4da95d=_0x29539f[0x0],_0x300afc=_0x57d0d6,_0x4da8cf=await resolveWorkspaceIdFromOptions(_0x300afc,_0x10fe32),_0x5ed68c=_0x300afc[_0x55fa62(0x136)];if(_0x5ed68c){const _0x3fed34=await withSpinner(_0x55fa62(0x142)+_0x4da95d+_0x55fa62(0x178),()=>_0x10fe32[_0x55fa62(0x127)][_0x55fa62(0x17e)](_0x4da95d,_0x4da8cf),{'verbose':_0x57d0d6[_0x55fa62(0x125)]});await handleSDKOutput([_0x3fed34],_0x57d0d6);}else{const _0x245d41=await withSpinner(_0x55fa62(0x142)+_0x4da95d+'\x27...',()=>_0x10fe32[_0x55fa62(0x127)][_0x55fa62(0x143)](_0x4da95d,_0x4da8cf),{'verbose':_0x57d0d6['verbose']});await handleSDKOutput([_0x245d41],_0x57d0d6);}return 0x0;}}function a22_0x3ff3(){const _0x17700e=['engage:workspaces','1557836bcRZgI','\x27\x20launched\x20successfully','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','2430447FAkvhn','4564640fwnjMj','workspace','updateTemplate','updateWorkspace','engage:campaign:duplicate','\x27\x20paused\x20successfully','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','listCampaigns','Updating\x20template\x20\x27','Engage\x20workspace\x20set\x20to:\x20','getWorkspace','entries','engage:campaign:launch','engage:campaign:create','engage:templates','execute','updateCampaign','Delete\x20an\x20email\x20template','keys','createTemplate','Fetching\x20campaign\x20\x27','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','segmentId','Launch\x20a\x20campaign','234009eBQYxV','launchCampaign','\x27...','length','engage:template:create','Show\x20campaign\x20details','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','session','getTemplateFull','Pause\x20a\x20campaign','Delete\x20a\x20campaign','Creating\x20campaign\x20\x27','engage:template:delete','html','Delete\x20a\x20workspace','description','2967349XvIAQu','Update\x20an\x20email\x20template','Create\x20a\x20workspace','Workspace\x20is\x20required\x20for\x20this\x20operation','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','\x27\x20resumed\x20successfully','Creating\x20template\x20\x27','Error:\x20--subject\x20is\x20required','Deleting\x20template\x20\x27','jsonColumns','listWorkspaces','engage:campaign:show','name','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Creating\x20workspace\x20\x27','limit','Updating\x20workspace\x20\x27','deleteCampaign','engage:workspace:show','filter','createWorkspace','Verifying\x20workspace\x20\x27','Show\x20workspace\x20details','deleteWorkspace','status','deleteTemplate','subject','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','4NDwTsu','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','engage:workspace:update','plaintext','Operation\x20cancelled','Duplicate\x20a\x20campaign','log','Create\x20a\x20new\x20campaign','listTemplates','Create\x20an\x20email\x20template','error','verbose','Pausing\x20campaign\x20\x27','engage','resumeCampaign','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','engage:campaign:resume','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','resolveWorkspaceId','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Fetching\x20templates...','Update\x20a\x20workspace','engage_workspace','pauseCampaign','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','yes','full','5815085BsiiOG','Error:\x20--html\x20is\x20required','Fetching\x20workspace\x20\x27','Updating\x20campaign\x20\x27','Options:\x20--name,\x20--description','type','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','fromEntries','Campaign\x20\x27','Fetching\x20template\x20\x27','getTemplate','segment','startAt','7067496esteJO','timezone','Resuming\x20campaign\x20\x27','data','Show\x20email\x20template\x20details','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','parentId','engage:campaign:update','\x27\x20deleted\x20successfully','Error:\x20Workspace\x20name\x20is\x20required','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Error:\x20--name\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Resume\x20a\x20paused\x20campaign','\x27?\x20This\x20cannot\x20be\x20undone.','Update\x20a\x20campaign','editorType'];a22_0x3ff3=function(){return _0x17700e;};return a22_0x3ff3();}export class EngageTemplateCreateCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x17a);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x123);async[a22_0x215c3a(0x16d)](_0x308bac){const _0x1b868c=a22_0x215c3a,{options:_0x2a4c65,tdx:_0x34ba3d}=_0x308bac,_0x82481c=_0x2a4c65,_0x4be32f=_0x82481c[_0x1b868c(0x192)],_0x18d801=_0x82481c['subject'],_0x2c3d4f=_0x82481c[_0x1b868c(0x183)];if(!_0x4be32f)return console[_0x1b868c(0x124)]('Error:\x20--name\x20is\x20required'),console[_0x1b868c(0x124)]('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x18d801)return console[_0x1b868c(0x124)](_0x1b868c(0x18d)),0x1;if(!_0x2c3d4f)return console[_0x1b868c(0x124)](_0x1b868c(0x138)),0x1;const _0x5e6843=await resolveWorkspaceIdFromOptions(_0x82481c,_0x34ba3d,!![]),_0x14d3d8={'name':_0x4be32f,'subjectTemplate':_0x18d801,'htmlTemplate':_0x2c3d4f,'workspaceId':_0x5e6843,'plaintextTemplate':_0x82481c[_0x1b868c(0x11d)],'editorType':_0x82481c[_0x1b868c(0x156)]},_0x10fe96=await withSpinner(_0x1b868c(0x18c)+_0x4be32f+_0x1b868c(0x178),()=>_0x34ba3d[_0x1b868c(0x127)][_0x1b868c(0x171)](_0x14d3d8));return await handleSDKOutput([_0x10fe96['data']],_0x2a4c65),0x0;}}function a22_0x2f02(_0x3937e3,_0x512423){const _0x3ff384=a22_0x3ff3();return a22_0x2f02=function(_0x2f0292,_0x5592d0){_0x2f0292=_0x2f0292-0x10c;let _0xa52642=_0x3ff384[_0x2f0292];return _0xa52642;},a22_0x2f02(_0x3937e3,_0x512423);}export class EngageTemplateUpdateCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:template:update';[a22_0x215c3a(0x185)]=a22_0x215c3a(0x187);async[a22_0x215c3a(0x16d)](_0x272d9c){const _0x13088b=a22_0x215c3a,{options:_0x1e654c,args:_0x180fd3,tdx:_0x51c869}=_0x272d9c;if(_0x180fd3[_0x13088b(0x179)]===0x0)return console[_0x13088b(0x124)](_0x13088b(0x15b)),console[_0x13088b(0x124)](_0x13088b(0x129)),0x1;const _0x52b9e1=_0x180fd3[0x0],_0x45001f=_0x1e654c,_0x3a040f=await resolveWorkspaceIdFromOptions(_0x45001f,_0x51c869),_0x37c070={'name':_0x45001f[_0x13088b(0x192)],'subjectTemplate':_0x45001f[_0x13088b(0x117)],'htmlTemplate':_0x45001f['html'],'plaintextTemplate':_0x45001f[_0x13088b(0x11d)]},_0x25e23c=Object[_0x13088b(0x140)](Object[_0x13088b(0x169)](_0x37c070)[_0x13088b(0x110)](([,_0x130e78])=>_0x130e78!==undefined));if(Object[_0x13088b(0x170)](_0x25e23c)[_0x13088b(0x179)]===0x0)return console['error'](_0x13088b(0x14b)),console[_0x13088b(0x124)](_0x13088b(0x150)),0x1;const _0x35c9ef=await withSpinner(_0x13088b(0x166)+_0x52b9e1+_0x13088b(0x178),()=>_0x51c869['engage'][_0x13088b(0x15f)](_0x52b9e1,_0x25e23c,_0x3a040f),{'verbose':_0x1e654c['verbose']});return await handleSDKOutput([_0x35c9ef[_0x13088b(0x149)]],_0x1e654c),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x182);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x16f);async[a22_0x215c3a(0x16d)](_0xf569eb){const _0x2dad2f=a22_0x215c3a,{options:_0xd0d50c,args:_0x594bf9,tdx:_0x41a03f}=_0xf569eb;if(_0x594bf9[_0x2dad2f(0x179)]===0x0)return console['error'](_0x2dad2f(0x15b)),console['error'](_0x2dad2f(0x133)),0x1;const _0x1a4053=_0x594bf9[0x0],_0xd46f64=_0xd0d50c,_0x2f453b=await resolveWorkspaceIdFromOptions(_0xd46f64,_0x41a03f);if(!_0xd0d50c['yes']){const _0x1f78b0=await confirm(_0x2dad2f(0x13d)+_0x1a4053+_0x2dad2f(0x154));if(!_0x1f78b0)return console[_0x2dad2f(0x120)](_0x2dad2f(0x11e)),0x0;}return await withSpinner(_0x2dad2f(0x18e)+_0x1a4053+_0x2dad2f(0x178),()=>_0x41a03f[_0x2dad2f(0x127)][_0x2dad2f(0x116)](_0x1a4053,_0x2f453b),{'verbose':_0xd0d50c['verbose']}),console[_0x2dad2f(0x120)]('Template\x20\x27'+_0x1a4053+_0x2dad2f(0x14e)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x157);[a22_0x215c3a(0x185)]='List\x20workspaces';async[a22_0x215c3a(0x16d)](_0x3df016){const _0x2498e1=a22_0x215c3a,{options:_0x443ab9,args:_0x26637d,tdx:_0x1247fd}=_0x3df016,_0xe89d10=_0x26637d[0x0],_0x1a2fce=resolveLimit(_0x443ab9[_0x2498e1(0x10c)],DEFAULT_LLM_LIMIT),_0x20c815=await withSpinner('Fetching\x20workspaces...',()=>_0x1247fd[_0x2498e1(0x127)][_0x2498e1(0x190)]({'limit':_0x1a2fce}),{'verbose':_0x443ab9['verbose']});let _0x373d37=_0x20c815[_0x2498e1(0x149)];return _0xe89d10&&(_0x373d37=_0x20c815[_0x2498e1(0x149)]['filter'](_0x4e8770=>matchGlobPattern(_0x4e8770['name'],_0xe89d10))),await handleSDKOutput(_0x373d37,_0x443ab9),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x10f);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x113);async[a22_0x215c3a(0x16d)](_0x54330f){const _0x3e5ed2=a22_0x215c3a,{options:_0x47726f,args:_0x36daa8,tdx:_0x472a5e}=_0x54330f;if(_0x36daa8[_0x3e5ed2(0x179)]===0x0)return console[_0x3e5ed2(0x124)](_0x3e5ed2(0x12e)),console[_0x3e5ed2(0x124)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0xb2c74d=_0x36daa8[0x0],_0x51fcef=_0x47726f,_0x123d00=_0x51fcef[_0x3e5ed2(0x136)];if(_0x123d00){const _0x507ad5=await withSpinner('Fetching\x20workspace\x20\x27'+_0xb2c74d+_0x3e5ed2(0x178),()=>_0x472a5e['engage']['getWorkspaceFull'](_0xb2c74d),{'verbose':_0x47726f['verbose']});await handleSDKOutput([_0x507ad5],_0x47726f);}else{const _0x14958b=await withSpinner(_0x3e5ed2(0x139)+_0xb2c74d+_0x3e5ed2(0x178),()=>_0x472a5e[_0x3e5ed2(0x127)][_0x3e5ed2(0x168)](_0xb2c74d),{'verbose':_0x47726f['verbose']});await handleSDKOutput([_0x14958b],_0x47726f);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:workspace:create';[a22_0x215c3a(0x185)]=a22_0x215c3a(0x188);async[a22_0x215c3a(0x16d)](_0x299161){const _0x564d7a=a22_0x215c3a,{options:_0x26d02c,tdx:_0x87f297}=_0x299161,_0xe84452=_0x26d02c,_0x2abf52=_0xe84452[_0x564d7a(0x192)];if(!_0x2abf52)return console[_0x564d7a(0x124)](_0x564d7a(0x151)),console['error'](_0x564d7a(0x119)),0x1;const _0x293084={'name':_0x2abf52,'description':_0xe84452[_0x564d7a(0x185)]},_0x12be5c=await withSpinner(_0x564d7a(0x194)+_0x2abf52+'\x27...',()=>_0x87f297[_0x564d7a(0x127)][_0x564d7a(0x111)](_0x293084));return await handleSDKOutput([_0x12be5c[_0x564d7a(0x149)]],_0x26d02c),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a22_0x215c3a(0x192)]=a22_0x215c3a(0x11c);[a22_0x215c3a(0x185)]=a22_0x215c3a(0x130);async[a22_0x215c3a(0x16d)](_0x4394e1){const _0x193300=a22_0x215c3a,{options:_0x117ae3,args:_0x37fd68,tdx:_0x32ea61}=_0x4394e1;if(_0x37fd68[_0x193300(0x179)]===0x0)return console['error'](_0x193300(0x12e)),console[_0x193300(0x124)](_0x193300(0x15a)),0x1;const _0x131a60=_0x37fd68[0x0],_0x55a8c2=_0x117ae3,_0x7566b4={'name':_0x55a8c2[_0x193300(0x192)],'description':_0x55a8c2[_0x193300(0x185)]},_0x448231=Object['fromEntries'](Object[_0x193300(0x169)](_0x7566b4)[_0x193300(0x110)](([,_0x1fcb2d])=>_0x1fcb2d!==undefined));if(Object[_0x193300(0x170)](_0x448231)[_0x193300(0x179)]===0x0)return console['error'](_0x193300(0x14b)),console[_0x193300(0x124)](_0x193300(0x13b)),0x1;const _0x14533b=await withSpinner(_0x193300(0x10d)+_0x131a60+_0x193300(0x178),()=>_0x32ea61[_0x193300(0x127)][_0x193300(0x160)](_0x131a60,_0x448231),{'verbose':_0x117ae3[_0x193300(0x125)]});return await handleSDKOutput([_0x14533b[_0x193300(0x149)]],_0x117ae3),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:workspace:delete';[a22_0x215c3a(0x185)]=a22_0x215c3a(0x184);async['execute'](_0x4ef0f1){const _0x4bbf5e=a22_0x215c3a,{options:_0x1af0b6,args:_0x15fb52,tdx:_0x2d2abc}=_0x4ef0f1;if(_0x15fb52[_0x4bbf5e(0x179)]===0x0)return console[_0x4bbf5e(0x124)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x4bbf5e(0x124)](_0x4bbf5e(0x18a)),0x1;const _0x2f5ded=_0x15fb52[0x0];if(!_0x1af0b6[_0x4bbf5e(0x135)]){const _0x4708db=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x2f5ded+_0x4bbf5e(0x154));if(!_0x4708db)return console[_0x4bbf5e(0x120)](_0x4bbf5e(0x11e)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x2f5ded+'\x27...',()=>_0x2d2abc[_0x4bbf5e(0x127)][_0x4bbf5e(0x114)](_0x2f5ded),{'verbose':_0x1af0b6[_0x4bbf5e(0x125)]}),console[_0x4bbf5e(0x120)]('Workspace\x20\x27'+_0x2f5ded+_0x4bbf5e(0x14e)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a22_0x215c3a(0x192)]='engage:workspace:use';[a22_0x215c3a(0x185)]='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a22_0x215c3a(0x16d)](_0x293fb8){const _0x3f5955=a22_0x215c3a,{options:_0x361ed3,args:_0x24fb64,tdx:_0x5298d3}=_0x293fb8;if(_0x24fb64[_0x3f5955(0x179)]===0x0)return console[_0x3f5955(0x124)](_0x3f5955(0x14f)),console[_0x3f5955(0x124)](_0x3f5955(0x164)),0x1;const _0x11768c=_0x24fb64[0x0];await withSpinner(_0x3f5955(0x112)+_0x11768c+'\x27...',()=>_0x5298d3[_0x3f5955(0x127)][_0x3f5955(0x12d)](_0x11768c));const _0xe4c7df=_0x361ed3[_0x3f5955(0x17d)]||undefined;return saveSessionContext({'engage_workspace':_0x11768c},_0xe4c7df),console[_0x3f5955(0x120)](_0x3f5955(0x167)+_0x11768c),console['log'](_0x3f5955(0x193)),0x0;}}
1
+ const a22_0x11894c=a22_0x2136;(function(_0x4d7611,_0x2f5503){const _0x412e8c=a22_0x2136,_0x4a73b4=_0x4d7611();while(!![]){try{const _0x2cf8eb=parseInt(_0x412e8c(0xb2))/0x1+-parseInt(_0x412e8c(0x12a))/0x2+parseInt(_0x412e8c(0xf5))/0x3+-parseInt(_0x412e8c(0xb1))/0x4*(-parseInt(_0x412e8c(0xdd))/0x5)+parseInt(_0x412e8c(0xb8))/0x6+-parseInt(_0x412e8c(0xeb))/0x7+parseInt(_0x412e8c(0x11b))/0x8*(-parseInt(_0x412e8c(0x103))/0x9);if(_0x2cf8eb===_0x2f5503)break;else _0x4a73b4['push'](_0x4a73b4['shift']());}catch(_0x23bd0c){_0x4a73b4['push'](_0x4a73b4['shift']());}}}(a22_0x3cfc,0xb44fa));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(_0x56cf76,_0x449b09,_0x17faac=![]){const _0x3b0e97=a22_0x2136;if(_0x56cf76[_0x3b0e97(0xd5)])return await _0x449b09['engage'][_0x3b0e97(0x132)](_0x56cf76[_0x3b0e97(0xd5)]);const _0x53ce54=loadSessionContext(_0x56cf76[_0x3b0e97(0x12c)]);if(_0x53ce54?.['engage_workspace'])return await _0x449b09['engage'][_0x3b0e97(0x132)](_0x53ce54['engage_workspace']);if(_0x17faac)throw new SDKError(ErrorCode[_0x3b0e97(0x101)],_0x3b0e97(0xc9),undefined,{'helpText':_0x3b0e97(0xee)});return undefined;}async function resolveSegmentFromOptions(_0x34f90d,_0x33de0e){const _0x370a14=a22_0x2136;if(!_0x34f90d[_0x370a14(0x118)])return{};const _0x490286=_0x34f90d[_0x370a14(0x118)],_0x4775c1=await _0x33de0e[_0x370a14(0x118)][_0x370a14(0xf0)](_0x490286);return{'audienceId':_0x4775c1[_0x370a14(0xe6)],'audienceName':_0x4775c1['parentName'],..._0x4775c1[_0x370a14(0xb3)]&&{'segmentId':_0x4775c1[_0x370a14(0xb3)],'segmentName':_0x4775c1[_0x370a14(0xbc)]}};}function buildConnectorConfig(_0x3af68d){const _0x424d87=a22_0x2136,_0x5f2a8e=_0x3af68d['emailSenderId'],_0x135bc5=_0x3af68d[_0x424d87(0xfa)];if(!_0x5f2a8e&&!_0x135bc5)return undefined;return{..._0x5f2a8e&&{'emailSenderId':_0x5f2a8e},..._0x135bc5&&{'jsonColumns':_0x135bc5}};}export class EngageCampaignsCommand extends BaseCommand{[a22_0x11894c(0xc8)]='engage:campaigns';[a22_0x11894c(0xd9)]=a22_0x11894c(0xdc);async[a22_0x11894c(0xfc)](_0x4560b7){const _0x3b7168=a22_0x11894c,{options:_0x4276f3,args:_0x4751b1,tdx:_0x26361f}=_0x4560b7,_0x1ef5c5=_0x4751b1[0x0],_0x502828=resolveLimit(_0x4276f3[_0x3b7168(0xfb)],DEFAULT_LLM_LIMIT),_0x3c95ab=_0x4276f3,_0x2e08b6=_0x3c95ab['type'],_0x39d8cf=_0x3c95ab[_0x3b7168(0x11f)],_0x36008e=await resolveWorkspaceIdFromOptions(_0x3c95ab,_0x26361f),_0x4816b4=await withSpinner(_0x3b7168(0x111),()=>_0x26361f[_0x3b7168(0x127)][_0x3b7168(0x139)]({'type':_0x2e08b6,'status':_0x39d8cf,'workspaceId':_0x36008e,'limit':_0x502828}),{'verbose':_0x4276f3[_0x3b7168(0x138)]});let _0x4b498f=_0x4816b4['data'];return _0x1ef5c5&&(_0x4b498f=_0x4816b4[_0x3b7168(0x12f)][_0x3b7168(0xd6)](_0x1b6bc8=>matchGlobPattern(_0x1b6bc8[_0x3b7168(0xc8)],_0x1ef5c5))),await handleSDKOutput(_0x4b498f,_0x4276f3),0x0;}}function a22_0x3cfc(){const _0x37f051=['Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Creating\x20campaign\x20\x27','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','full','Error:\x20--subject\x20is\x20required','Show\x20email\x20template\x20details','listTemplates','engage:workspace:delete','length','name','Workspace\x20is\x20required\x20for\x20this\x20operation','engage:campaign:resume','deleteTemplate','Error:\x20--name\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Create\x20a\x20new\x20campaign','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','keys','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Updating\x20template\x20\x27','Create\x20a\x20workspace','engage:templates','workspace','filter','engage:workspace:create','Template\x20\x27','description','engage:template:create','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','List\x20campaigns','850ELpMRX','getCampaignFull','Operation\x20cancelled','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Duplicating\x20campaign\x20\x27','entries','\x27\x20deleted\x20successfully','engage:campaign:delete','engage:template:delete','parentId','Verifying\x20workspace\x20\x27','createCampaign','Fetching\x20workspace\x20\x27','subject','5767293iLfXqY','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Delete\x20a\x20workspace','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','resumeCampaign','resolvePathToResource','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','startAt','plaintext','engage:campaign:update','1818858qHDBIY','timezone','engage:campaign:launch','Workspace\x20\x27','Fetching\x20workspaces...','jsonColumns','limit','execute','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','\x27\x20launched\x20successfully','engage:workspace:show','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','MISSING_ARGUMENT','Pause\x20a\x20campaign','1045467YBLyxL','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Fetching\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','updateWorkspace','Creating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','fromEntries','engage:campaign:create','Error:\x20--html\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','Fetching\x20template\x20\x27','Fetching\x20campaigns...','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','\x27?\x20This\x20cannot\x20be\x20undone.','engage:campaign:show','Update\x20a\x20workspace','Show\x20workspace\x20details','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','segment','type','html','88jPGrMm','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Launching\x20campaign\x20\x27','status','duplicateCampaign','engage:workspace:use','getTemplate','log','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','createTemplate','engage','Launch\x20a\x20campaign','List\x20workspaces','205876dltuSj','Update\x20an\x20email\x20template','session','Campaign\x20\x27','editorType','data','deleteWorkspace','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','resolveWorkspaceId','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Updating\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','\x27\x20resumed\x20successfully','engage:template:update','verbose','listCampaigns','Update\x20a\x20campaign','8564hceTKh','1300133iCAzkY','segmentId','updateCampaign','error','Resume\x20a\x20paused\x20campaign','engage:workspaces','4036770nNGFBK','deleteCampaign','\x27...','Options:\x20--name,\x20--description','segmentName','Pausing\x20campaign\x20\x27','yes'];a22_0x3cfc=function(){return _0x37f051;};return a22_0x3cfc();}export class EngageCampaignShowCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0x114);[a22_0x11894c(0xd9)]='Show\x20campaign\x20details';async[a22_0x11894c(0xfc)](_0x5c754f){const _0x2fd7b0=a22_0x11894c,{options:_0x10af0c,args:_0x126421,tdx:_0x1f5bd9}=_0x5c754f;if(_0x126421[_0x2fd7b0(0xc7)]===0x0)return console['error'](_0x2fd7b0(0x125)),console[_0x2fd7b0(0xb5)](_0x2fd7b0(0x10d)),0x1;const _0x1fb562=_0x126421[0x0],_0x38f6f2=_0x10af0c,_0xb820de=await resolveWorkspaceIdFromOptions(_0x38f6f2,_0x1f5bd9),_0x376fa7=_0x38f6f2[_0x2fd7b0(0xc2)];if(_0x376fa7){const _0x526480=await withSpinner(_0x2fd7b0(0x105)+_0x1fb562+_0x2fd7b0(0xba),()=>_0x1f5bd9['engage'][_0x2fd7b0(0xde)](_0x1fb562,_0xb820de),{'verbose':_0x10af0c[_0x2fd7b0(0x138)]});await handleSDKOutput([_0x526480],_0x10af0c);}else{const _0x5af180=await withSpinner('Fetching\x20campaign\x20\x27'+_0x1fb562+'\x27...',()=>_0x1f5bd9[_0x2fd7b0(0x127)]['getCampaign'](_0x1fb562,_0xb820de),{'verbose':_0x10af0c[_0x2fd7b0(0x138)]});await handleSDKOutput([_0x5af180],_0x10af0c);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a22_0x11894c(0x10b);['description']=a22_0x11894c(0xce);async[a22_0x11894c(0xfc)](_0x2604b7){const _0x210aca=a22_0x11894c,{options:_0x15916f,tdx:_0x1a1504}=_0x2604b7,_0x4e1031=_0x15916f,_0x4e7ad2=_0x4e1031[_0x210aca(0xc8)],_0x5217c8=_0x4e1031[_0x210aca(0x119)];if(!_0x4e7ad2)return console[_0x210aca(0xb5)](_0x210aca(0xcc)),console[_0x210aca(0xb5)](_0x210aca(0x11d)),0x1;if(!_0x5217c8)return console[_0x210aca(0xb5)](_0x210aca(0x10e)),console[_0x210aca(0xb5)](_0x210aca(0x11d)),0x1;const _0x1e250e=await resolveWorkspaceIdFromOptions(_0x4e1031,_0x1a1504,!![]),_0x304fda=await resolveSegmentFromOptions(_0x4e1031,_0x1a1504),_0x5c2ca5=buildConnectorConfig(_0x4e1031),_0x8c0241={'name':_0x4e7ad2,'campaignType':_0x5217c8,'workspaceId':_0x1e250e,'description':_0x4e1031['description'],..._0x304fda,'connectorConfig':_0x5c2ca5,'startAt':_0x4e1031[_0x210aca(0xf2)],'timezone':_0x4e1031[_0x210aca(0xf6)]},_0x3185a3=await withSpinner(_0x210aca(0xc0)+_0x4e7ad2+'\x27...',()=>_0x1a1504[_0x210aca(0x127)][_0x210aca(0xe8)](_0x8c0241));return await handleSDKOutput([_0x3185a3[_0x210aca(0x12f)]],_0x15916f),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xf4);[a22_0x11894c(0xd9)]=a22_0x11894c(0x13a);async['execute'](_0x28a909){const _0x3dbe09=a22_0x11894c,{options:_0x4ca164,args:_0x44c81a,tdx:_0x254a8a}=_0x28a909;if(_0x44c81a[_0x3dbe09(0xc7)]===0x0)return console[_0x3dbe09(0xb5)](_0x3dbe09(0x125)),console[_0x3dbe09(0xb5)](_0x3dbe09(0x109)),0x1;const _0x1364e3=_0x44c81a[0x0],_0x321ef8=_0x4ca164,_0x46bf73=await resolveWorkspaceIdFromOptions(_0x321ef8,_0x254a8a),_0x3404e6=await resolveSegmentFromOptions(_0x321ef8,_0x254a8a),_0x7d124f=buildConnectorConfig(_0x321ef8),_0xd6ab43={'name':_0x321ef8[_0x3dbe09(0xc8)],'description':_0x321ef8[_0x3dbe09(0xd9)],..._0x3404e6,'connectorConfig':_0x7d124f,'startAt':_0x321ef8[_0x3dbe09(0xf2)],'timezone':_0x321ef8['timezone']},_0x2e242e=Object['fromEntries'](Object[_0x3dbe09(0xe2)](_0xd6ab43)[_0x3dbe09(0xd6)](([,_0x200a4c])=>_0x200a4c!==undefined));if(Object[_0x3dbe09(0xd0)](_0x2e242e)[_0x3dbe09(0xc7)]===0x0)return console['error'](_0x3dbe09(0xec)),console['error'](_0x3dbe09(0xc1)),0x1;const _0x3c23d6=await withSpinner(_0x3dbe09(0x134)+_0x1364e3+_0x3dbe09(0xba),()=>_0x254a8a['engage'][_0x3dbe09(0xb4)](_0x1364e3,_0x2e242e,_0x46bf73),{'verbose':_0x4ca164[_0x3dbe09(0x138)]});return await handleSDKOutput([_0x3c23d6['data']],_0x4ca164),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a22_0x11894c(0xe4);[a22_0x11894c(0xd9)]='Delete\x20a\x20campaign';async[a22_0x11894c(0xfc)](_0x1464e3){const _0x829ea7=a22_0x11894c,{options:_0x609cc8,args:_0x1eecbf,tdx:_0x3938b9}=_0x1464e3;if(_0x1eecbf['length']===0x0)return console[_0x829ea7(0xb5)](_0x829ea7(0x125)),console[_0x829ea7(0xb5)](_0x829ea7(0x135)),0x1;const _0x5522be=_0x1eecbf[0x0],_0x193bb5=_0x609cc8,_0xb02d64=await resolveWorkspaceIdFromOptions(_0x193bb5,_0x3938b9);if(!_0x609cc8[_0x829ea7(0xbe)]){const _0x295b91=await confirm(_0x829ea7(0xd1)+_0x5522be+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x295b91)return console[_0x829ea7(0x123)]('Operation\x20cancelled'),0x0;}return await withSpinner('Deleting\x20campaign\x20\x27'+_0x5522be+_0x829ea7(0xba),()=>_0x3938b9[_0x829ea7(0x127)][_0x829ea7(0xb9)](_0x5522be,_0xb02d64),{'verbose':_0x609cc8[_0x829ea7(0x138)]}),console[_0x829ea7(0x123)]('Campaign\x20\x27'+_0x5522be+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xf7);[a22_0x11894c(0xd9)]=a22_0x11894c(0x128);async[a22_0x11894c(0xfc)](_0x20fa00){const _0x44a937=a22_0x11894c,{options:_0x5d079e,args:_0x1d62af,tdx:_0x4ddaf1}=_0x20fa00;if(_0x1d62af[_0x44a937(0xc7)]===0x0)return console['error'](_0x44a937(0x125)),console[_0x44a937(0xb5)](_0x44a937(0xbf)),0x1;const _0x6ce799=_0x1d62af[0x0],_0x46e58a=_0x5d079e,_0x1c0090=await resolveWorkspaceIdFromOptions(_0x46e58a,_0x4ddaf1);return await withSpinner(_0x44a937(0x11e)+_0x6ce799+_0x44a937(0xba),()=>_0x4ddaf1[_0x44a937(0x127)]['launchCampaign'](_0x6ce799,_0x1c0090),{'verbose':_0x5d079e['verbose']}),console[_0x44a937(0x123)](_0x44a937(0x12d)+_0x6ce799+_0x44a937(0xfe)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a22_0x11894c(0xc8)]='engage:campaign:pause';[a22_0x11894c(0xd9)]=a22_0x11894c(0x102);async[a22_0x11894c(0xfc)](_0x57e5ee){const _0x314aea=a22_0x11894c,{options:_0x80d231,args:_0x89a425,tdx:_0x3dd963}=_0x57e5ee;if(_0x89a425[_0x314aea(0xc7)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x314aea(0x10f)),0x1;const _0xe8824b=_0x89a425[0x0],_0x3dbf66=_0x80d231,_0x51ae9d=await resolveWorkspaceIdFromOptions(_0x3dbf66,_0x3dd963);return await withSpinner(_0x314aea(0xbd)+_0xe8824b+_0x314aea(0xba),()=>_0x3dd963['engage']['pauseCampaign'](_0xe8824b,_0x51ae9d),{'verbose':_0x80d231[_0x314aea(0x138)]}),console[_0x314aea(0x123)]('Campaign\x20\x27'+_0xe8824b+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a22_0x11894c(0xca);[a22_0x11894c(0xd9)]=a22_0x11894c(0xb6);async[a22_0x11894c(0xfc)](_0x30260f){const _0x40a756=a22_0x11894c,{options:_0x5a5b91,args:_0xb56e31,tdx:_0x25d65e}=_0x30260f;if(_0xb56e31[_0x40a756(0xc7)]===0x0)return console[_0x40a756(0xb5)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x40a756(0xfd)),0x1;const _0x5d390d=_0xb56e31[0x0],_0x5cf5bc=_0x5a5b91,_0x2dece4=await resolveWorkspaceIdFromOptions(_0x5cf5bc,_0x25d65e);return await withSpinner('Resuming\x20campaign\x20\x27'+_0x5d390d+_0x40a756(0xba),()=>_0x25d65e[_0x40a756(0x127)][_0x40a756(0xef)](_0x5d390d,_0x2dece4),{'verbose':_0x5a5b91[_0x40a756(0x138)]}),console[_0x40a756(0x123)](_0x40a756(0x12d)+_0x5d390d+_0x40a756(0x136)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a22_0x11894c(0xc8)]='engage:campaign:duplicate';[a22_0x11894c(0xd9)]='Duplicate\x20a\x20campaign';async['execute'](_0x2c0630){const _0x1e289c=a22_0x11894c,{options:_0x35669c,args:_0x1bb0d3,tdx:_0x158652}=_0x2c0630;if(_0x1bb0d3[_0x1e289c(0xc7)]===0x0)return console[_0x1e289c(0xb5)](_0x1e289c(0x125)),console['error'](_0x1e289c(0x11c)),0x1;const _0x4f239c=_0x1bb0d3[0x0],_0x323463=_0x35669c,_0x211a52=await resolveWorkspaceIdFromOptions(_0x323463,_0x158652),_0x17dd85=await withSpinner(_0x1e289c(0xe1)+_0x4f239c+_0x1e289c(0xba),()=>_0x158652[_0x1e289c(0x127)][_0x1e289c(0x120)](_0x4f239c,_0x211a52),{'verbose':_0x35669c[_0x1e289c(0x138)]});return await handleSDKOutput([_0x17dd85['data']],_0x35669c),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xd4);['description']='List\x20email\x20templates';async['execute'](_0x50654b){const _0x50d0ab=a22_0x11894c,{options:_0x541979,args:_0x5f0bae,tdx:_0x58fb56}=_0x50654b,_0x1ecfb9=_0x5f0bae[0x0],_0x2fb3ef=resolveLimit(_0x541979[_0x50d0ab(0xfb)],DEFAULT_LLM_LIMIT),_0x12938d=_0x541979,_0x59ea27=await resolveWorkspaceIdFromOptions(_0x12938d,_0x58fb56),_0x1e419d=await withSpinner('Fetching\x20templates...',()=>_0x58fb56[_0x50d0ab(0x127)][_0x50d0ab(0xc5)]({'workspaceId':_0x59ea27,'limit':_0x2fb3ef}),{'verbose':_0x541979[_0x50d0ab(0x138)]});let _0x2f2443=_0x1e419d[_0x50d0ab(0x12f)];return _0x1ecfb9&&(_0x2f2443=_0x1e419d[_0x50d0ab(0x12f)]['filter'](_0x33a5e6=>matchGlobPattern(_0x33a5e6[_0x50d0ab(0xc8)],_0x1ecfb9))),await handleSDKOutput(_0x2f2443,_0x541979),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a22_0x11894c(0xc8)]='engage:template:show';[a22_0x11894c(0xd9)]=a22_0x11894c(0xc4);async[a22_0x11894c(0xfc)](_0x1dba24){const _0x138cf1=a22_0x11894c,{options:_0x12c01a,args:_0x30d8b6,tdx:_0xb6dc54}=_0x1dba24;if(_0x30d8b6[_0x138cf1(0xc7)]===0x0)return console[_0x138cf1(0xb5)](_0x138cf1(0xcf)),console[_0x138cf1(0xb5)](_0x138cf1(0x131)),0x1;const _0x470e50=_0x30d8b6[0x0],_0x5e3b89=_0x12c01a,_0x4d57d8=await resolveWorkspaceIdFromOptions(_0x5e3b89,_0xb6dc54),_0x1b7be7=_0x5e3b89['full'];if(_0x1b7be7){const _0x4b2503=await withSpinner(_0x138cf1(0x110)+_0x470e50+_0x138cf1(0xba),()=>_0xb6dc54[_0x138cf1(0x127)]['getTemplateFull'](_0x470e50,_0x4d57d8),{'verbose':_0x12c01a[_0x138cf1(0x138)]});await handleSDKOutput([_0x4b2503],_0x12c01a);}else{const _0x249bf3=await withSpinner(_0x138cf1(0x110)+_0x470e50+_0x138cf1(0xba),()=>_0xb6dc54[_0x138cf1(0x127)][_0x138cf1(0x122)](_0x470e50,_0x4d57d8),{'verbose':_0x12c01a['verbose']});await handleSDKOutput([_0x249bf3],_0x12c01a);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xda);[a22_0x11894c(0xd9)]='Create\x20an\x20email\x20template';async[a22_0x11894c(0xfc)](_0x22388c){const _0x2ab477=a22_0x11894c,{options:_0x1b151e,tdx:_0x1234d9}=_0x22388c,_0xbd721c=_0x1b151e,_0x1f8742=_0xbd721c[_0x2ab477(0xc8)],_0x2bf515=_0xbd721c[_0x2ab477(0xea)],_0x576530=_0xbd721c[_0x2ab477(0x11a)];if(!_0x1f8742)return console[_0x2ab477(0xb5)](_0x2ab477(0xcc)),console['error'](_0x2ab477(0x104)),0x1;if(!_0x2bf515)return console[_0x2ab477(0xb5)](_0x2ab477(0xc3)),0x1;if(!_0x576530)return console[_0x2ab477(0xb5)](_0x2ab477(0x10c)),0x1;const _0x4fd46b=await resolveWorkspaceIdFromOptions(_0xbd721c,_0x1234d9,!![]),_0x1b1294={'name':_0x1f8742,'subjectTemplate':_0x2bf515,'htmlTemplate':_0x576530,'workspaceId':_0x4fd46b,'plaintextTemplate':_0xbd721c[_0x2ab477(0xf3)],'editorType':_0xbd721c[_0x2ab477(0x12e)]},_0x1d5e36=await withSpinner(_0x2ab477(0x108)+_0x1f8742+_0x2ab477(0xba),()=>_0x1234d9[_0x2ab477(0x127)][_0x2ab477(0x126)](_0x1b1294));return await handleSDKOutput([_0x1d5e36['data']],_0x1b151e),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0x137);['description']=a22_0x11894c(0x12b);async[a22_0x11894c(0xfc)](_0x125a41){const _0x3ebe92=a22_0x11894c,{options:_0x126d4e,args:_0x2a1d2a,tdx:_0x5cbe74}=_0x125a41;if(_0x2a1d2a[_0x3ebe92(0xc7)]===0x0)return console[_0x3ebe92(0xb5)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x3ebe92(0xb5)](_0x3ebe92(0x112)),0x1;const _0x168945=_0x2a1d2a[0x0],_0x21a7ec=_0x126d4e,_0x5497b8=await resolveWorkspaceIdFromOptions(_0x21a7ec,_0x5cbe74),_0x4e7498={'name':_0x21a7ec['name'],'subjectTemplate':_0x21a7ec[_0x3ebe92(0xea)],'htmlTemplate':_0x21a7ec[_0x3ebe92(0x11a)],'plaintextTemplate':_0x21a7ec[_0x3ebe92(0xf3)]},_0x1f8acb=Object[_0x3ebe92(0x10a)](Object[_0x3ebe92(0xe2)](_0x4e7498)[_0x3ebe92(0xd6)](([,_0x1bb9b5])=>_0x1bb9b5!==undefined));if(Object[_0x3ebe92(0xd0)](_0x1f8acb)[_0x3ebe92(0xc7)]===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3ebe92(0xb5)]('Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext'),0x1;const _0x3a6f93=await withSpinner(_0x3ebe92(0xd2)+_0x168945+_0x3ebe92(0xba),()=>_0x5cbe74['engage']['updateTemplate'](_0x168945,_0x1f8acb,_0x5497b8),{'verbose':_0x126d4e['verbose']});return await handleSDKOutput([_0x3a6f93[_0x3ebe92(0x12f)]],_0x126d4e),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xe5);[a22_0x11894c(0xd9)]='Delete\x20an\x20email\x20template';async[a22_0x11894c(0xfc)](_0xcdc79b){const _0x45ddc2=a22_0x11894c,{options:_0x3475c5,args:_0x481579,tdx:_0x5e6912}=_0xcdc79b;if(_0x481579['length']===0x0)return console[_0x45ddc2(0xb5)](_0x45ddc2(0xcf)),console['error'](_0x45ddc2(0xf1)),0x1;const _0x53f49a=_0x481579[0x0],_0x377807=_0x3475c5,_0x18e345=await resolveWorkspaceIdFromOptions(_0x377807,_0x5e6912);if(!_0x3475c5[_0x45ddc2(0xbe)]){const _0x4ba4f8=await confirm(_0x45ddc2(0x100)+_0x53f49a+_0x45ddc2(0x113));if(!_0x4ba4f8)return console[_0x45ddc2(0x123)](_0x45ddc2(0xdf)),0x0;}return await withSpinner('Deleting\x20template\x20\x27'+_0x53f49a+'\x27...',()=>_0x5e6912[_0x45ddc2(0x127)][_0x45ddc2(0xcb)](_0x53f49a,_0x18e345),{'verbose':_0x3475c5[_0x45ddc2(0x138)]}),console[_0x45ddc2(0x123)](_0x45ddc2(0xd8)+_0x53f49a+_0x45ddc2(0xe3)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a22_0x11894c(0xb7);['description']=a22_0x11894c(0x129);async['execute'](_0x218823){const _0x4a8ede=a22_0x11894c,{options:_0x48487d,args:_0x4b88bd,tdx:_0x2c40ef}=_0x218823,_0x3521a5=_0x4b88bd[0x0],_0xde9c9=resolveLimit(_0x48487d['limit'],DEFAULT_LLM_LIMIT),_0x4fcfa6=await withSpinner(_0x4a8ede(0xf9),()=>_0x2c40ef[_0x4a8ede(0x127)]['listWorkspaces']({'limit':_0xde9c9}),{'verbose':_0x48487d['verbose']});let _0x3609da=_0x4fcfa6[_0x4a8ede(0x12f)];return _0x3521a5&&(_0x3609da=_0x4fcfa6['data']['filter'](_0x4543d1=>matchGlobPattern(_0x4543d1[_0x4a8ede(0xc8)],_0x3521a5))),await handleSDKOutput(_0x3609da,_0x48487d),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xff);[a22_0x11894c(0xd9)]=a22_0x11894c(0x116);async['execute'](_0x3394ac){const _0x2e2e70=a22_0x11894c,{options:_0x3fccca,args:_0x239565,tdx:_0x15344c}=_0x3394ac;if(_0x239565[_0x2e2e70(0xc7)]===0x0)return console['error'](_0x2e2e70(0xdb)),console[_0x2e2e70(0xb5)](_0x2e2e70(0xcd)),0x1;const _0x2c2f6c=_0x239565[0x0],_0x156e62=_0x3fccca,_0x1c9f52=_0x156e62[_0x2e2e70(0xc2)];if(_0x1c9f52){const _0x47383d=await withSpinner(_0x2e2e70(0xe9)+_0x2c2f6c+'\x27...',()=>_0x15344c['engage']['getWorkspaceFull'](_0x2c2f6c),{'verbose':_0x3fccca['verbose']});await handleSDKOutput([_0x47383d],_0x3fccca);}else{const _0x306530=await withSpinner(_0x2e2e70(0xe9)+_0x2c2f6c+_0x2e2e70(0xba),()=>_0x15344c['engage']['getWorkspace'](_0x2c2f6c),{'verbose':_0x3fccca[_0x2e2e70(0x138)]});await handleSDKOutput([_0x306530],_0x3fccca);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a22_0x11894c(0xd7);[a22_0x11894c(0xd9)]=a22_0x11894c(0xd3);async['execute'](_0x436a40){const _0x4ad863=a22_0x11894c,{options:_0x53f69a,tdx:_0x5cca33}=_0x436a40,_0x16a229=_0x53f69a,_0x398ddc=_0x16a229['name'];if(!_0x398ddc)return console['error'](_0x4ad863(0xcc)),console[_0x4ad863(0xb5)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x3b9a9d={'name':_0x398ddc,'description':_0x16a229['description']},_0x34b8f0=await withSpinner('Creating\x20workspace\x20\x27'+_0x398ddc+'\x27...',()=>_0x5cca33['engage']['createWorkspace'](_0x3b9a9d));return await handleSDKOutput([_0x34b8f0['data']],_0x53f69a),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a22_0x11894c(0xc8)]='engage:workspace:update';[a22_0x11894c(0xd9)]=a22_0x11894c(0x115);async[a22_0x11894c(0xfc)](_0x1e86e0){const _0x764c5c=a22_0x11894c,{options:_0x5c5e4e,args:_0x4753d9,tdx:_0x4403ed}=_0x1e86e0;if(_0x4753d9[_0x764c5c(0xc7)]===0x0)return console[_0x764c5c(0xb5)](_0x764c5c(0xdb)),console[_0x764c5c(0xb5)]('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x4170ad=_0x4753d9[0x0],_0x14f2cf=_0x5c5e4e,_0x18b3c0={'name':_0x14f2cf[_0x764c5c(0xc8)],'description':_0x14f2cf[_0x764c5c(0xd9)]},_0x398c9d=Object[_0x764c5c(0x10a)](Object['entries'](_0x18b3c0)['filter'](([,_0xa27999])=>_0xa27999!==undefined));if(Object[_0x764c5c(0xd0)](_0x398c9d)[_0x764c5c(0xc7)]===0x0)return console[_0x764c5c(0xb5)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x764c5c(0xb5)](_0x764c5c(0xbb)),0x1;const _0x1134ea=await withSpinner('Updating\x20workspace\x20\x27'+_0x4170ad+_0x764c5c(0xba),()=>_0x4403ed[_0x764c5c(0x127)][_0x764c5c(0x107)](_0x4170ad,_0x398c9d),{'verbose':_0x5c5e4e[_0x764c5c(0x138)]});return await handleSDKOutput([_0x1134ea['data']],_0x5c5e4e),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0xc6);['description']=a22_0x11894c(0xed);async[a22_0x11894c(0xfc)](_0xdeeb70){const _0x4c1836=a22_0x11894c,{options:_0x2cbcc0,args:_0x1229e8,tdx:_0x443c63}=_0xdeeb70;if(_0x1229e8[_0x4c1836(0xc7)]===0x0)return console['error'](_0x4c1836(0xdb)),console[_0x4c1836(0xb5)](_0x4c1836(0x133)),0x1;const _0x128ea5=_0x1229e8[0x0];if(!_0x2cbcc0['yes']){const _0x127105=await confirm(_0x4c1836(0x117)+_0x128ea5+_0x4c1836(0x113));if(!_0x127105)return console['log'](_0x4c1836(0xdf)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x128ea5+_0x4c1836(0xba),()=>_0x443c63[_0x4c1836(0x127)][_0x4c1836(0x130)](_0x128ea5),{'verbose':_0x2cbcc0[_0x4c1836(0x138)]}),console[_0x4c1836(0x123)](_0x4c1836(0xf8)+_0x128ea5+_0x4c1836(0xe3)),0x0;}}function a22_0x2136(_0x2a3aac,_0x56221a){const _0x3cfc0e=a22_0x3cfc();return a22_0x2136=function(_0x21369c,_0x3945cd){_0x21369c=_0x21369c-0xb1;let _0x4e1c6d=_0x3cfc0e[_0x21369c];return _0x4e1c6d;},a22_0x2136(_0x2a3aac,_0x56221a);}export class EngageWorkspaceUseCommand extends BaseCommand{[a22_0x11894c(0xc8)]=a22_0x11894c(0x121);['description']=a22_0x11894c(0xe0);async['execute'](_0x5e6cc0){const _0xaf459=a22_0x11894c,{options:_0x2a0f64,args:_0x41c5f9,tdx:_0x2af008}=_0x5e6cc0;if(_0x41c5f9[_0xaf459(0xc7)]===0x0)return console[_0xaf459(0xb5)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0xaf459(0xb5)](_0xaf459(0x106)),0x1;const _0xf32fc=_0x41c5f9[0x0];await withSpinner(_0xaf459(0xe7)+_0xf32fc+_0xaf459(0xba),()=>_0x2af008[_0xaf459(0x127)][_0xaf459(0x132)](_0xf32fc));const _0x257071=_0x2a0f64[_0xaf459(0x12c)]||undefined;return saveSessionContext({'engage_workspace':_0xf32fc},_0x257071),console[_0xaf459(0x123)]('Engage\x20workspace\x20set\x20to:\x20'+_0xf32fc),console[_0xaf459(0x123)](_0xaf459(0x124)),0x0;}}
@@ -1 +1 @@
1
- const a23_0x56c7d9=a23_0x3129;(function(_0x3ff99b,_0x21f088){const _0x12f496=a23_0x3129,_0x12b81d=_0x3ff99b();while(!![]){try{const _0x142d7a=-parseInt(_0x12f496(0x13f))/0x1*(-parseInt(_0x12f496(0x11d))/0x2)+-parseInt(_0x12f496(0x12d))/0x3+-parseInt(_0x12f496(0x10d))/0x4+-parseInt(_0x12f496(0x128))/0x5*(-parseInt(_0x12f496(0x127))/0x6)+parseInt(_0x12f496(0x119))/0x7*(parseInt(_0x12f496(0x10e))/0x8)+parseInt(_0x12f496(0xf6))/0x9+parseInt(_0x12f496(0xf1))/0xa*(-parseInt(_0x12f496(0x137))/0xb);if(_0x142d7a===_0x21f088)break;else _0x12b81d['push'](_0x12b81d['shift']());}catch(_0x5e9390){_0x12b81d['push'](_0x12b81d['shift']());}}}(a23_0x3556,0xa32a8));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a23_0x3556(){const _0x4167d7=['map','status','length','11HghMfS','end_at','job:kill','cause','database','Getting\x20job\x20details...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','\x20job','1frYsQr','...','Getting\x20job\x20results...','job:result','file','9005940mIDWaV','debug','Submit\x20a\x20job','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','Listing\x20jobs...','1240866tlugZf','verbose','\x20row','priority','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Error:\x20Job\x20ID\x20is\x20required','Cancelled','user_name','type','Show\x20job\x20details','description','Usage:\x20job\x20kill\x20<job-id>','Status\x20filter:\x20','information_schema','\x20\x20Job\x20ID:\x20','Submitting\x20kill\x20request...','jobType','Usage:\x20job\x20result\x20<job-id>','Database:\x20','✔\x20Found\x20','created_at','\x27\x20to\x20verify\x20the\x20job\x20status','Kill\x20a\x20job','3333336vXOstJ','88shKBLx','trino','execute','\x20jobs','url','result','Query:\x20','Submitting\x20job...','getTime','query','job_id','498155GWCMVD','\x20\x20Cause:\x20','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','data','2602924wfURAJ','name','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','List\x20jobs','kill','submit','Limit:\x20','Error:\x20Query\x20is\x20required','list','limit','3957750wlLoIy','5HMkHgH','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','error','job:show','round','1438560pJrGlQ','start_at','✔\x20Job\x20submitted','Usage:\x20job\x20show\x20<job-id>','message','Error:\x20','jobs'];a23_0x3556=function(){return _0x4167d7;};return a23_0x3556();}import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';function a23_0x3129(_0x5d5513,_0x4e6129){const _0x35568b=a23_0x3556();return a23_0x3129=function(_0x3129b7,_0x46f0c5){_0x3129b7=_0x3129b7-0xed;let _0x2d3e33=_0x35568b[_0x3129b7];return _0x2d3e33;},a23_0x3129(_0x5d5513,_0x4e6129);}import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a23_0x56c7d9(0x11e)]=a23_0x56c7d9(0x133);[a23_0x56c7d9(0x100)]=a23_0x56c7d9(0x120);async[a23_0x56c7d9(0x110)](_0x53a25e){const _0x1e7ba8=a23_0x56c7d9,{options:_0x52cc17,tdx:_0x58fbf7}=_0x53a25e;try{const _0x199312=resolveLimit(_0x52cc17[_0x1e7ba8(0x126)],DEFAULT_DISPLAY_LIMIT),_0xa46db3=_0x52cc17[_0x1e7ba8(0x135)];_0x52cc17[_0x1e7ba8(0xf7)]&&(console['error'](_0x1e7ba8(0x123)+_0x199312+_0x1e7ba8(0x111)),_0xa46db3&&console[_0x1e7ba8(0x12a)](_0x1e7ba8(0x102)+_0xa46db3));const _0x3d09d5=await withSpinner(_0x1e7ba8(0xf5),()=>_0x58fbf7[_0x1e7ba8(0x133)][_0x1e7ba8(0x125)]({'from':0x0,'to':_0x199312-0x1,'status':_0xa46db3}),{'verbose':_0x52cc17[_0x1e7ba8(0xf7)]}),_0x5b45c7=_0x3d09d5[_0x1e7ba8(0x11c)];console[_0x1e7ba8(0x12a)](_0x1e7ba8(0x109)+_0x5b45c7[_0x1e7ba8(0x136)]+_0x1e7ba8(0x13e)+(_0x5b45c7[_0x1e7ba8(0x136)]!==0x1?'s':''));const _0x1bf774=_0x5b45c7[_0x1e7ba8(0x134)](_0x487470=>{const _0x3e13ed=_0x1e7ba8;let _0x514892;if(_0x487470['start_at']&&_0x487470[_0x3e13ed(0x138)]){const _0x4263d2=new Date(_0x487470[_0x3e13ed(0x12e)])[_0x3e13ed(0x116)](),_0x49be6d=new Date(_0x487470[_0x3e13ed(0x138)])[_0x3e13ed(0x116)]();_0x514892=Math[_0x3e13ed(0x12c)]((_0x49be6d-_0x4263d2)/0x3e8);}return{'job_id':_0x487470[_0x3e13ed(0x118)],'type':_0x487470[_0x3e13ed(0xfe)],'status':_0x487470[_0x3e13ed(0x135)],'user_name':_0x487470[_0x3e13ed(0xfd)],'duration_sec':_0x514892,'created_at':_0x487470['created_at'],'started_at':_0x487470['start_at'],'end_at':_0x487470[_0x3e13ed(0x138)]};});return await handleSDKOutput(_0x1bf774,_0x52cc17),0x0;}catch(_0x33b583){if(_0x33b583 instanceof SDKError)return console['error'](_0x1e7ba8(0x132)+_0x33b583[_0x1e7ba8(0x131)]),_0x33b583[_0x1e7ba8(0x13a)]&&console[_0x1e7ba8(0x12a)](_0x1e7ba8(0x11a)+_0x33b583[_0x1e7ba8(0x13a)]),0x1;throw _0x33b583;}}}export class JobShowCommand extends BaseCommand{['name']=a23_0x56c7d9(0x12b);[a23_0x56c7d9(0x100)]=a23_0x56c7d9(0xff);async[a23_0x56c7d9(0x110)](_0x13f463){const _0x4866d8=a23_0x56c7d9,{options:_0x3df1ad,args:_0x2f5c24,tdx:_0xc79318}=_0x13f463,_0x336aec=_0x2f5c24[0x0];if(!_0x336aec)return console['error'](_0x4866d8(0xfb)),console[_0x4866d8(0x12a)](_0x4866d8(0x130)),0x1;try{const _0x3dd51d=await withSpinner(_0x4866d8(0x13c),()=>_0xc79318[_0x4866d8(0x133)]['show'](_0x336aec),{'verbose':_0x3df1ad[_0x4866d8(0xf7)]}),_0x1968a9=_0x3dd51d[_0x4866d8(0x11c)];let _0x2a725c;if(_0x1968a9[_0x4866d8(0x12e)]&&_0x1968a9[_0x4866d8(0x138)]){const _0xa8e32b=new Date(_0x1968a9[_0x4866d8(0x12e)])['getTime'](),_0x135958=new Date(_0x1968a9[_0x4866d8(0x138)])[_0x4866d8(0x116)]();_0x2a725c=Math[_0x4866d8(0x12c)]((_0x135958-_0xa8e32b)/0x3e8);}const _0x4066db={'job_id':_0x1968a9[_0x4866d8(0x118)],'type':_0x1968a9['type'],'status':_0x1968a9[_0x4866d8(0x135)],..._0x1968a9[_0x4866d8(0xfd)]&&{'user_name':_0x1968a9['user_name']},..._0x2a725c!==undefined&&{'duration_sec':_0x2a725c},..._0x1968a9[_0x4866d8(0x10a)]&&{'created_at':_0x1968a9[_0x4866d8(0x10a)]},..._0x1968a9[_0x4866d8(0x12e)]&&{'started_at':_0x1968a9['start_at']},..._0x1968a9[_0x4866d8(0x138)]&&{'end_at':_0x1968a9['end_at']},..._0x1968a9[_0x4866d8(0x13b)]&&{'database':_0x1968a9[_0x4866d8(0x13b)]},..._0x1968a9[_0x4866d8(0xf9)]!==undefined&&{'priority':_0x1968a9[_0x4866d8(0xf9)]},..._0x1968a9['url']&&{'url':_0x1968a9[_0x4866d8(0x112)]},..._0x1968a9[_0x4866d8(0x117)]&&{'query':_0x1968a9[_0x4866d8(0x117)]},..._0x1968a9['debug']&&{'debug':_0x1968a9[_0x4866d8(0xf2)]}};return await handleSingleObjectOutput(_0x4066db,_0x3df1ad),0x0;}catch(_0x5e8c45){if(_0x5e8c45 instanceof SDKError)return console['error']('Error:\x20'+_0x5e8c45['message']),_0x5e8c45[_0x4866d8(0x13a)]&&console[_0x4866d8(0x12a)]('\x20\x20Cause:\x20'+_0x5e8c45[_0x4866d8(0x13a)]),0x1;throw _0x5e8c45;}}}export class JobKillCommand extends BaseCommand{[a23_0x56c7d9(0x11e)]=a23_0x56c7d9(0x139);[a23_0x56c7d9(0x100)]=a23_0x56c7d9(0x10c);async[a23_0x56c7d9(0x110)](_0x13cc46){const _0x290df0=a23_0x56c7d9,{options:_0x978c5f,args:_0x4434af,tdx:_0x2b5337}=_0x13cc46,_0x4189bf=_0x4434af[0x0];if(!_0x4189bf)return console['error'](_0x290df0(0xfb)),console[_0x290df0(0x12a)](_0x290df0(0x101)),0x1;try{if(!_0x978c5f['yes']){const _0x2e8e8a=await confirm(_0x290df0(0x13d)+_0x4189bf+'?');if(!_0x2e8e8a)return console[_0x290df0(0x12a)](_0x290df0(0xfc)),0x0;}return await withSpinner(_0x290df0(0x105),()=>_0x2b5337['jobs'][_0x290df0(0x121)](_0x4189bf),{'verbose':_0x978c5f['verbose']}),console[_0x290df0(0x12a)]('✔\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0x4189bf),console[_0x290df0(0x12a)](_0x290df0(0xfa)+_0x4189bf+_0x290df0(0x10b)),0x0;}catch(_0x581e9c){if(_0x581e9c instanceof SDKError)return console[_0x290df0(0x12a)](_0x290df0(0x132)+_0x581e9c['message']),_0x581e9c[_0x290df0(0x13a)]&&console[_0x290df0(0x12a)](_0x290df0(0x11a)+_0x581e9c[_0x290df0(0x13a)]),0x1;throw _0x581e9c;}}}export class JobSubmitCommand extends BaseCommand{[a23_0x56c7d9(0x11e)]='job:submit';[a23_0x56c7d9(0x100)]=a23_0x56c7d9(0xf3);async[a23_0x56c7d9(0x110)](_0x59ed03){const _0x46006d=a23_0x56c7d9,{options:_0x3d96d5,args:_0x3040ad,tdx:_0x58d344}=_0x59ed03;try{const _0x384975=_0x3d96d5[_0x46006d(0x106)]||_0x46006d(0x10f),_0x1b0a9e=_0x3d96d5[_0x46006d(0xf0)],_0x6cfd73=_0x3d96d5[_0x46006d(0x13b)]||_0x46006d(0x103);if(_0x384975!=='trino'&&_0x384975!=='hive')return console['error'](_0x46006d(0xf4)),0x1;let _0x1cf58e;if(_0x1b0a9e){if(_0x3040ad[0x0])return console[_0x46006d(0x12a)](_0x46006d(0x11b)),0x1;const _0x302c11=readSqlStatementsFromFile(_0x1b0a9e);if(_0x302c11[_0x46006d(0x136)]===0x0)return console[_0x46006d(0x12a)]('Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file'),0x1;if(_0x302c11[_0x46006d(0x136)]>0x1)return console['error'](_0x46006d(0x129)),0x1;_0x1cf58e=_0x302c11[0x0];}else{if(!_0x3040ad[0x0])return console['error'](_0x46006d(0x124)),console[_0x46006d(0x12a)](_0x46006d(0x11f)),0x1;_0x1cf58e=_0x3040ad[0x0];}_0x3d96d5[_0x46006d(0xf7)]&&(console[_0x46006d(0x12a)]('Job\x20type:\x20'+_0x384975),console['error'](_0x46006d(0x108)+_0x6cfd73),console[_0x46006d(0x12a)](_0x46006d(0x114)+_0x1cf58e['substring'](0x0,0x64)+(_0x1cf58e[_0x46006d(0x136)]>0x64?_0x46006d(0xed):'')));const _0x18a107=await withSpinner(_0x46006d(0x115),()=>_0x58d344['jobs'][_0x46006d(0x122)](_0x6cfd73,_0x1cf58e,_0x384975),{'verbose':_0x3d96d5['verbose']}),_0x3f373d=_0x18a107[_0x46006d(0x11c)];return console[_0x46006d(0x12a)](_0x46006d(0x12f)),console[_0x46006d(0x12a)](_0x46006d(0x104)+_0x3f373d[_0x46006d(0x118)]),await handleSDKOutput([_0x3f373d],_0x3d96d5),0x0;}catch(_0x55b59d){if(_0x55b59d instanceof SDKError)return console['error'](_0x46006d(0x132)+_0x55b59d[_0x46006d(0x131)]),_0x55b59d[_0x46006d(0x13a)]&&console[_0x46006d(0x12a)](_0x46006d(0x11a)+_0x55b59d[_0x46006d(0x13a)]),0x1;throw _0x55b59d;}}}export class JobResultCommand extends BaseCommand{[a23_0x56c7d9(0x11e)]=a23_0x56c7d9(0xef);['description']='Get\x20job\x20results';async[a23_0x56c7d9(0x110)](_0x220a22){const _0x45a507=a23_0x56c7d9,{options:_0x35a2ac,args:_0x4b71e9,tdx:_0x58cd6a}=_0x220a22,_0x5d6689=_0x4b71e9[0x0];if(!_0x5d6689)return console['error'](_0x45a507(0xfb)),console[_0x45a507(0x12a)](_0x45a507(0x107)),0x1;try{const _0x3ae592=await withSpinner(_0x45a507(0xee),()=>_0x58cd6a[_0x45a507(0x133)][_0x45a507(0x113)](_0x5d6689),{'verbose':_0x35a2ac['verbose']}),_0x10ed6e=_0x3ae592[_0x45a507(0x11c)];return console[_0x45a507(0x12a)]('✔\x20Retrieved\x20'+_0x10ed6e['length']+_0x45a507(0xf8)+(_0x10ed6e[_0x45a507(0x136)]!==0x1?'s':'')),await handleSDKOutput(_0x10ed6e,_0x35a2ac),0x0;}catch(_0x4bafb3){if(_0x4bafb3 instanceof SDKError)return console[_0x45a507(0x12a)]('Error:\x20'+_0x4bafb3[_0x45a507(0x131)]),_0x4bafb3[_0x45a507(0x13a)]&&console[_0x45a507(0x12a)](_0x45a507(0x11a)+_0x4bafb3['cause']),0x1;throw _0x4bafb3;}}}
1
+ const a23_0x1b09ee=a23_0x54a3;(function(_0x31b1fe,_0x9ffb2a){const _0x211db4=a23_0x54a3,_0x120913=_0x31b1fe();while(!![]){try{const _0x257be9=-parseInt(_0x211db4(0x1ef))/0x1+parseInt(_0x211db4(0x1e2))/0x2+-parseInt(_0x211db4(0x1b7))/0x3+parseInt(_0x211db4(0x1cf))/0x4+-parseInt(_0x211db4(0x1a9))/0x5+parseInt(_0x211db4(0x1d7))/0x6+parseInt(_0x211db4(0x1ae))/0x7;if(_0x257be9===_0x9ffb2a)break;else _0x120913['push'](_0x120913['shift']());}catch(_0x2a5ec6){_0x120913['push'](_0x120913['shift']());}}}(a23_0x230d,0x95d3e));import{BaseCommand}from'./command.js';function a23_0x54a3(_0x52b8d3,_0x40ae4c){const _0x230dfb=a23_0x230d();return a23_0x54a3=function(_0x54a37b,_0x438ac6){_0x54a37b=_0x54a37b-0x1a7;let _0x14cb44=_0x230dfb[_0x54a37b];return _0x14cb44;},a23_0x54a3(_0x52b8d3,_0x40ae4c);}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a23_0x230d(){const _0x3de7b5=['map','description','✔\x20Found\x20','error','status','Error:\x20','570050vhrmqZ','kill','verbose','Kill\x20a\x20job','cause','debug','Job\x20type:\x20','List\x20jobs','job:kill','show','result','query','length','821659QbxJtM','Get\x20job\x20results','type','Error:\x20Query\x20is\x20required','Submitting\x20kill\x20request...','4294625tUgZgd','job:show','start_at','hive','Show\x20job\x20details','8034264pMrahM','yes','message','end_at','Usage:\x20job\x20show\x20<job-id>','\x20row','data','\x20\x20Cause:\x20','url','1435251fyCzAO','execute','list','limit','created_at','jobs','Database:\x20','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','name','getTime','\x20\x20Job\x20ID:\x20','Limit:\x20','Query:\x20','\x20jobs','priority','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','job_id','Cancelled','database','submit','substring','✔\x20Retrieved\x20','2104760RhTOtJ','Listing\x20jobs...','\x20job','✔\x20Job\x20submitted','Submit\x20a\x20job','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Error:\x20Job\x20ID\x20is\x20required','4882368nuTFwU','user_name','file','Usage:\x20job\x20result\x20<job-id>','Getting\x20job\x20details...'];a23_0x230d=function(){return _0x3de7b5;};return a23_0x230d();}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{[a23_0x1b09ee(0x1c1)]=a23_0x1b09ee(0x1bc);[a23_0x1b09ee(0x1dd)]=a23_0x1b09ee(0x1e9);async[a23_0x1b09ee(0x1b8)](_0x148ad6){const _0x534a84=a23_0x1b09ee,{options:_0x380473,tdx:_0x21c6cb}=_0x148ad6;try{const _0x58bfb7=resolveLimit(_0x380473[_0x534a84(0x1ba)],DEFAULT_DISPLAY_LIMIT),_0x7a7115=_0x380473['status'];_0x380473[_0x534a84(0x1e4)]&&(console[_0x534a84(0x1df)](_0x534a84(0x1c4)+_0x58bfb7+_0x534a84(0x1c6)),_0x7a7115&&console['error']('Status\x20filter:\x20'+_0x7a7115));const _0x5f0307=await withSpinner(_0x534a84(0x1d0),()=>_0x21c6cb[_0x534a84(0x1bc)][_0x534a84(0x1b9)]({'from':0x0,'to':_0x58bfb7-0x1,'status':_0x7a7115}),{'verbose':_0x380473[_0x534a84(0x1e4)]}),_0x8f4d2e=_0x5f0307['data'];console['error'](_0x534a84(0x1de)+_0x8f4d2e[_0x534a84(0x1ee)]+_0x534a84(0x1d1)+(_0x8f4d2e[_0x534a84(0x1ee)]!==0x1?'s':''));const _0x48971d=_0x8f4d2e[_0x534a84(0x1dc)](_0x57637d=>{const _0x22df91=_0x534a84;let _0x2ef212;if(_0x57637d[_0x22df91(0x1ab)]&&_0x57637d[_0x22df91(0x1b1)]){const _0x4c8d2f=new Date(_0x57637d[_0x22df91(0x1ab)])[_0x22df91(0x1c2)](),_0x405c6d=new Date(_0x57637d[_0x22df91(0x1b1)])[_0x22df91(0x1c2)]();_0x2ef212=Math['round']((_0x405c6d-_0x4c8d2f)/0x3e8);}return{'job_id':_0x57637d['job_id'],'type':_0x57637d[_0x22df91(0x1f1)],'status':_0x57637d[_0x22df91(0x1e0)],'user_name':_0x57637d[_0x22df91(0x1d8)],'duration_sec':_0x2ef212,'created_at':_0x57637d['created_at'],'started_at':_0x57637d[_0x22df91(0x1ab)],'end_at':_0x57637d['end_at']};});return await handleSDKOutput(_0x48971d,_0x380473),0x0;}catch(_0x3f80d8){if(_0x3f80d8 instanceof SDKError)return console[_0x534a84(0x1df)]('Error:\x20'+_0x3f80d8[_0x534a84(0x1b0)]),_0x3f80d8[_0x534a84(0x1e6)]&&console[_0x534a84(0x1df)](_0x534a84(0x1b5)+_0x3f80d8[_0x534a84(0x1e6)]),0x1;throw _0x3f80d8;}}}export class JobShowCommand extends BaseCommand{[a23_0x1b09ee(0x1c1)]=a23_0x1b09ee(0x1aa);[a23_0x1b09ee(0x1dd)]=a23_0x1b09ee(0x1ad);async[a23_0x1b09ee(0x1b8)](_0x574555){const _0x232144=a23_0x1b09ee,{options:_0x37f7fd,args:_0x2ef9bf,tdx:_0x230e65}=_0x574555,_0x44abe3=_0x2ef9bf[0x0];if(!_0x44abe3)return console[_0x232144(0x1df)](_0x232144(0x1d6)),console[_0x232144(0x1df)](_0x232144(0x1b2)),0x1;try{const _0x183a01=await withSpinner(_0x232144(0x1db),()=>_0x230e65[_0x232144(0x1bc)][_0x232144(0x1eb)](_0x44abe3),{'verbose':_0x37f7fd[_0x232144(0x1e4)]}),_0x45ed88=_0x183a01[_0x232144(0x1b4)];let _0x130d3f;if(_0x45ed88[_0x232144(0x1ab)]&&_0x45ed88['end_at']){const _0x1997b8=new Date(_0x45ed88['start_at'])[_0x232144(0x1c2)](),_0x59c225=new Date(_0x45ed88[_0x232144(0x1b1)])[_0x232144(0x1c2)]();_0x130d3f=Math['round']((_0x59c225-_0x1997b8)/0x3e8);}const _0x254e9a={'job_id':_0x45ed88['job_id'],'type':_0x45ed88[_0x232144(0x1f1)],'status':_0x45ed88[_0x232144(0x1e0)],..._0x45ed88['user_name']&&{'user_name':_0x45ed88[_0x232144(0x1d8)]},..._0x130d3f!==undefined&&{'duration_sec':_0x130d3f},..._0x45ed88[_0x232144(0x1bb)]&&{'created_at':_0x45ed88[_0x232144(0x1bb)]},..._0x45ed88[_0x232144(0x1ab)]&&{'started_at':_0x45ed88['start_at']},..._0x45ed88[_0x232144(0x1b1)]&&{'end_at':_0x45ed88[_0x232144(0x1b1)]},..._0x45ed88[_0x232144(0x1cb)]&&{'database':_0x45ed88[_0x232144(0x1cb)]},..._0x45ed88[_0x232144(0x1c7)]!==undefined&&{'priority':_0x45ed88[_0x232144(0x1c7)]},..._0x45ed88[_0x232144(0x1b6)]&&{'url':_0x45ed88[_0x232144(0x1b6)]},..._0x45ed88['query']&&{'query':_0x45ed88[_0x232144(0x1ed)]},..._0x45ed88['debug']&&{'debug':_0x45ed88[_0x232144(0x1e7)]}};return await handleSingleObjectOutput(_0x254e9a,_0x37f7fd),0x0;}catch(_0x50b88b){if(_0x50b88b instanceof SDKError)return console[_0x232144(0x1df)]('Error:\x20'+_0x50b88b['message']),_0x50b88b[_0x232144(0x1e6)]&&console['error'](_0x232144(0x1b5)+_0x50b88b[_0x232144(0x1e6)]),0x1;throw _0x50b88b;}}}export class JobKillCommand extends BaseCommand{[a23_0x1b09ee(0x1c1)]=a23_0x1b09ee(0x1ea);[a23_0x1b09ee(0x1dd)]=a23_0x1b09ee(0x1e5);async[a23_0x1b09ee(0x1b8)](_0x4f61d3){const _0xad0df2=a23_0x1b09ee,{options:_0x506882,args:_0x2df274,tdx:_0x25ee86}=_0x4f61d3,_0x43c780=_0x2df274[0x0];if(!_0x43c780)return console[_0xad0df2(0x1df)](_0xad0df2(0x1d6)),console[_0xad0df2(0x1df)]('Usage:\x20job\x20kill\x20<job-id>'),0x1;try{if(!_0x506882[_0xad0df2(0x1af)]){const _0x414c83=await confirm(_0xad0df2(0x1c0)+_0x43c780+'?');if(!_0x414c83)return console[_0xad0df2(0x1df)](_0xad0df2(0x1ca)),0x0;}return await withSpinner(_0xad0df2(0x1a8),()=>_0x25ee86[_0xad0df2(0x1bc)][_0xad0df2(0x1e3)](_0x43c780),{'verbose':_0x506882['verbose']}),console['error'](_0xad0df2(0x1be)+_0x43c780),console[_0xad0df2(0x1df)](_0xad0df2(0x1d5)+_0x43c780+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x3b18f3){if(_0x3b18f3 instanceof SDKError)return console[_0xad0df2(0x1df)](_0xad0df2(0x1e1)+_0x3b18f3['message']),_0x3b18f3[_0xad0df2(0x1e6)]&&console[_0xad0df2(0x1df)]('\x20\x20Cause:\x20'+_0x3b18f3['cause']),0x1;throw _0x3b18f3;}}}export class JobSubmitCommand extends BaseCommand{[a23_0x1b09ee(0x1c1)]='job:submit';[a23_0x1b09ee(0x1dd)]=a23_0x1b09ee(0x1d3);async[a23_0x1b09ee(0x1b8)](_0x591cc8){const _0x212d91=a23_0x1b09ee,{options:_0x2a30de,args:_0x7de57e,tdx:_0x2788cf}=_0x591cc8;try{const _0x2addd8=_0x2a30de['jobType']||'trino',_0x83ac4d=_0x2a30de[_0x212d91(0x1d9)],_0x50d8a3=_0x2a30de[_0x212d91(0x1cb)]||'information_schema';if(_0x2addd8!=='trino'&&_0x2addd8!==_0x212d91(0x1ac))return console[_0x212d91(0x1df)](_0x212d91(0x1d4)),0x1;let _0x81a4bc;if(_0x83ac4d){if(_0x7de57e[0x0])return console[_0x212d91(0x1df)]('Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option'),0x1;const _0x1935ff=readSqlStatementsFromFile(_0x83ac4d);if(_0x1935ff[_0x212d91(0x1ee)]===0x0)return console[_0x212d91(0x1df)](_0x212d91(0x1c8)),0x1;if(_0x1935ff[_0x212d91(0x1ee)]>0x1)return console[_0x212d91(0x1df)]('Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'),0x1;_0x81a4bc=_0x1935ff[0x0];}else{if(!_0x7de57e[0x0])return console[_0x212d91(0x1df)](_0x212d91(0x1a7)),console[_0x212d91(0x1df)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x81a4bc=_0x7de57e[0x0];}_0x2a30de[_0x212d91(0x1e4)]&&(console[_0x212d91(0x1df)](_0x212d91(0x1e8)+_0x2addd8),console['error'](_0x212d91(0x1bd)+_0x50d8a3),console[_0x212d91(0x1df)](_0x212d91(0x1c5)+_0x81a4bc[_0x212d91(0x1cd)](0x0,0x64)+(_0x81a4bc['length']>0x64?_0x212d91(0x1bf):'')));const _0x6b7c6=await withSpinner('Submitting\x20job...',()=>_0x2788cf[_0x212d91(0x1bc)][_0x212d91(0x1cc)](_0x50d8a3,_0x81a4bc,_0x2addd8),{'verbose':_0x2a30de[_0x212d91(0x1e4)]}),_0x20d542=_0x6b7c6[_0x212d91(0x1b4)];return console[_0x212d91(0x1df)](_0x212d91(0x1d2)),console[_0x212d91(0x1df)](_0x212d91(0x1c3)+_0x20d542[_0x212d91(0x1c9)]),await handleSDKOutput([_0x20d542],_0x2a30de),0x0;}catch(_0x1f8d5e){if(_0x1f8d5e instanceof SDKError)return console[_0x212d91(0x1df)](_0x212d91(0x1e1)+_0x1f8d5e[_0x212d91(0x1b0)]),_0x1f8d5e[_0x212d91(0x1e6)]&&console[_0x212d91(0x1df)](_0x212d91(0x1b5)+_0x1f8d5e[_0x212d91(0x1e6)]),0x1;throw _0x1f8d5e;}}}export class JobResultCommand extends BaseCommand{[a23_0x1b09ee(0x1c1)]='job:result';[a23_0x1b09ee(0x1dd)]=a23_0x1b09ee(0x1f0);async['execute'](_0x276fdf){const _0x46bcbc=a23_0x1b09ee,{options:_0xde5150,args:_0x38f33f,tdx:_0x16f711}=_0x276fdf,_0x30188d=_0x38f33f[0x0];if(!_0x30188d)return console['error'](_0x46bcbc(0x1d6)),console[_0x46bcbc(0x1df)](_0x46bcbc(0x1da)),0x1;try{const _0x226e8b=await withSpinner('Getting\x20job\x20results...',()=>_0x16f711[_0x46bcbc(0x1bc)][_0x46bcbc(0x1ec)](_0x30188d),{'verbose':_0xde5150[_0x46bcbc(0x1e4)]}),_0x3e611e=_0x226e8b['data'];return console[_0x46bcbc(0x1df)](_0x46bcbc(0x1ce)+_0x3e611e['length']+_0x46bcbc(0x1b3)+(_0x3e611e[_0x46bcbc(0x1ee)]!==0x1?'s':'')),await handleSDKOutput(_0x3e611e,_0xde5150),0x0;}catch(_0x177549){if(_0x177549 instanceof SDKError)return console['error']('Error:\x20'+_0x177549['message']),_0x177549[_0x46bcbc(0x1e6)]&&console[_0x46bcbc(0x1df)](_0x46bcbc(0x1b5)+_0x177549[_0x46bcbc(0x1e6)]),0x1;throw _0x177549;}}}
@@ -1 +1 @@
1
- const a24_0x2d0c46=a24_0x3d6b;(function(_0x37d7e5,_0x3f9c9b){const _0x3788a2=a24_0x3d6b,_0xbddff2=_0x37d7e5();while(!![]){try{const _0x5a4d7e=parseInt(_0x3788a2(0xe4))/0x1+parseInt(_0x3788a2(0x158))/0x2*(-parseInt(_0x3788a2(0x163))/0x3)+parseInt(_0x3788a2(0xaa))/0x4*(parseInt(_0x3788a2(0xc5))/0x5)+parseInt(_0x3788a2(0x122))/0x6*(parseInt(_0x3788a2(0x140))/0x7)+-parseInt(_0x3788a2(0xca))/0x8*(parseInt(_0x3788a2(0x112))/0x9)+parseInt(_0x3788a2(0xd9))/0xa+-parseInt(_0x3788a2(0xb0))/0xb*(parseInt(_0x3788a2(0x132))/0xc);if(_0x5a4d7e===_0x3f9c9b)break;else _0xbddff2['push'](_0xbddff2['shift']());}catch(_0x27005b){_0xbddff2['push'](_0xbddff2['shift']());}}}(a24_0x2bae,0x9fdc5));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a24_0x3d6b(_0x23fa9e,_0x2f9e9a){const _0x2bae14=a24_0x2bae();return a24_0x3d6b=function(_0x3d6bd7,_0x306e7c){_0x3d6bd7=_0x3d6bd7-0xa2;let _0x1ba3e1=_0x2bae14[_0x3d6bd7];return _0x1ba3e1;},a24_0x3d6b(_0x23fa9e,_0x2f9e9a);}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 a24_0x3e054b from'node:fs';function handleSDKError(_0x146f75,_0x5967b9){const _0xe59d2e=a24_0x3d6b;if(_0x146f75 instanceof SDKError)console[_0xe59d2e(0x10b)](_0xe59d2e(0xdc)+_0x146f75[_0xe59d2e(0xae)]),_0x5967b9['verbose']&&(_0x146f75['cause']&&console['error'](_0xe59d2e(0xe0)+_0x146f75[_0xe59d2e(0x106)]),_0x146f75[_0xe59d2e(0x102)]&&(console[_0xe59d2e(0x10b)]('\x0aStack\x20trace:'),console[_0xe59d2e(0x10b)](_0x146f75[_0xe59d2e(0x102)])));else throw _0x146f75;}function formatChatHistoryEntry(_0x1f65f3,_0xb96dc3){const _0x184138=a24_0x3d6b,_0x395751=getChalk(_0xb96dc3),_0x34f84b=_0x395751[_0x184138(0x15a)](_0x1f65f3['at']);if('input'in _0x1f65f3){const _0x1ce9cf=_0x395751[_0x184138(0xe9)]('[input]\x20\x20');return _0x34f84b+'\x20'+_0x1ce9cf+':\x20'+_0x1f65f3[_0x184138(0x100)];}if('content'in _0x1f65f3){const _0x365e25=_0x395751[_0x184138(0x12f)](_0x184138(0x166));return _0x34f84b+'\x20'+_0x365e25+':\x20'+_0x1f65f3[_0x184138(0x136)];}if('tool_call'in _0x1f65f3){const _0x3a1af9=_0x395751[_0x184138(0xcb)](_0x184138(0xb6)),{functionName:_0x5f4f90,functionArguments:_0x417c76,targetFunction:_0x2b5f2a}=_0x1f65f3[_0x184138(0xc7)];let _0x256690=_0x34f84b+'\x20'+_0x3a1af9+':\x20'+_0x395751[_0x184138(0xb9)](_0x5f4f90);if(_0x417c76&&Object[_0x184138(0xea)](_0x417c76)[_0x184138(0x143)]>0x0){const _0x55c39a=Object[_0x184138(0xd1)](_0x417c76)[_0x184138(0x111)](([_0x5e5dfc,_0x2ecd94])=>_0x5e5dfc+'='+JSON['stringify'](_0x2ecd94))['join'](',\x20');_0x256690+='('+_0x55c39a+')';}_0x2b5f2a&&(_0x256690+=_0x395751['dim']('\x20['+_0x2b5f2a+']'));let _0x2288da='';if(_0x1f65f3[_0x184138(0xc7)][_0x184138(0x129)])_0x2288da='\x20->\x20KB:'+_0x1f65f3[_0x184138(0xc7)][_0x184138(0x129)][_0x184138(0x110)];else{if(_0x1f65f3[_0x184138(0xc7)]['targetAgent'])_0x2288da=_0x184138(0x14f)+_0x1f65f3['tool_call']['targetAgent']['name'];else{if(_0x1f65f3[_0x184138(0xc7)][_0x184138(0xc9)])_0x2288da='\x20->\x20WebSearch:'+_0x1f65f3[_0x184138(0xc7)][_0x184138(0xc9)][_0x184138(0x110)];else _0x1f65f3[_0x184138(0xc7)][_0x184138(0x116)]&&(_0x2288da=_0x184138(0xeb)+_0x1f65f3[_0x184138(0xc7)][_0x184138(0x116)][_0x184138(0x110)]);}}return _0x256690+_0x2288da;}if('tool'in _0x1f65f3){const _0x512579=_0x395751[_0x184138(0x15f)](_0x184138(0xb4)),{functionName:_0x28bbf8,functionArguments:_0x485088,content:_0xce2cb1,newChat:_0x27d766}=_0x1f65f3[_0x184138(0x133)];let _0x4f239a=_0x34f84b+'\x20'+_0x512579+':\x20'+_0x395751['bold'](_0x28bbf8);if(_0x485088){const _0x405fe3=typeof _0x485088===_0x184138(0xfe)?_0x485088:JSON[_0x184138(0xac)](_0x485088);_0x4f239a+='('+_0x405fe3+')';}return _0xce2cb1&&(_0x4f239a+='\x0a'+_0x395751[_0x184138(0x15a)](_0xce2cb1)),_0x27d766&&(_0x4f239a+=_0x395751['dim'](_0x184138(0xd2)+_0x27d766['id'])),_0x4f239a;}if('output'in _0x1f65f3){const _0xc01ebe=_0x395751[_0x184138(0x118)](_0x184138(0xc3));return _0x34f84b+'\x20'+_0xc01ebe+':\x20'+_0x1f65f3['output'][_0x184138(0x110)]+'\x20('+_0x1f65f3[_0x184138(0xd8)][_0x184138(0x136)][_0x184138(0x143)]+_0x184138(0x125);}if('image'in _0x1f65f3){const _0x1ebc17=_0x395751['blue'](_0x184138(0x130)),{width:_0x167fbc,height:_0x4f8a9d,headerText:_0x1c14f1}=_0x1f65f3[_0x184138(0x123)],_0x4cc641=_0x1c14f1?_0x184138(0xdd)+_0x1c14f1:'';return _0x34f84b+'\x20'+_0x1ebc17+':\x20'+_0x167fbc+'x'+_0x4f8a9d+_0x4cc641;}if(_0x184138(0x10b)in _0x1f65f3){const _0x3e70c7=_0x395751['red'](_0x184138(0xc4));return _0x34f84b+'\x20'+_0x3e70c7+':\x20'+_0x1f65f3['error'];}return _0x34f84b+'\x20'+_0x395751[_0x184138(0x15a)](_0x184138(0x137))+':\x20'+JSON[_0x184138(0xac)](_0x1f65f3);}async function executeChatHistoryCommand(_0x1b119d,_0x1f8f5f){const _0x3cc3fe=a24_0x3d6b,{options:_0x5192a9,args:_0x502dd6,tdx:_0x38548d}=_0x1b119d,_0xb6f0c2=_0x502dd6[0x0],_0x551f0b=_0x5192a9,_0x2f23b2=_0x551f0b[_0x3cc3fe(0x107)];try{if(_0x2f23b2&&_0xb6f0c2)return console[_0x3cc3fe(0x10b)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x3cc3fe(0x10b)]('Usage:\x20'+_0x1f8f5f+_0x3cc3fe(0x160)),0x1;if(!_0xb6f0c2&&!_0x2f23b2&&_0x5192a9[_0x3cc3fe(0xb3)]!==undefined){const _0x4074c0=resolveLimit(_0x5192a9[_0x3cc3fe(0xe7)],DEFAULT_LLM_LIMIT),_0xb142ff=await withSpinner(_0x3cc3fe(0x14e),()=>_0x38548d[_0x3cc3fe(0x119)][_0x3cc3fe(0xaf)](_0x4074c0),{'verbose':_0x5192a9[_0x3cc3fe(0x10a)]});return await handleSDKOutput(_0xb142ff[_0x3cc3fe(0x145)],_0x5192a9),0x0;}const _0x1143a6=await getChatIdOrSelect(_0x38548d,_0x5192a9,_0x2f23b2,_0xb6f0c2);if(!_0x1143a6)return 0x0;return await displayChatHistory(_0x1143a6,_0x38548d,_0x5192a9),0x0;}catch(_0x3445a7){return handleSDKError(_0x3445a7,_0x5192a9),0x1;}}async function displayChatHistory(_0x169e4a,_0x3a6818,_0x308af3){const _0x68ec10=a24_0x3d6b,_0x5e81ac=await withSpinner(_0x68ec10(0x13e)+_0x169e4a+_0x68ec10(0x151),()=>_0x3a6818[_0x68ec10(0x119)][_0x68ec10(0xba)](_0x169e4a),{'verbose':_0x308af3['verbose']}),_0x23ec72=_0x5e81ac[_0x68ec10(0x145)][_0x68ec10(0x145)]??[];if(_0x23ec72[_0x68ec10(0x143)]===0x0){console[_0x68ec10(0xa5)](_0x68ec10(0x15d));return;}if(_0x308af3[_0x68ec10(0xb3)]!==undefined)await handleSDKOutput(_0x23ec72,_0x308af3);else{const _0x241c04=_0x23ec72[_0x68ec10(0x111)](_0x1ca38a=>formatChatHistoryEntry(_0x1ca38a,_0x308af3)),_0x1b0edb=_0x241c04[_0x68ec10(0xa4)]('\x0a');await writeOutput(_0x1b0edb,_0x308af3[_0x68ec10(0xd8)],_0x68ec10(0xb1));}}async function getChatIdOrSelect(_0x28b266,_0x35b9f0,_0xda591d,_0x4dede1){const _0x4b8b6b=a24_0x3d6b;if(_0x4dede1)return _0x4dede1;if(_0xda591d){const _0x2f896c=await withSpinner(_0x4b8b6b(0xe2),()=>_0x28b266['llm']['chats'](0x1),{'verbose':_0x35b9f0['verbose']});if(_0x2f896c[_0x4b8b6b(0x145)][_0x4b8b6b(0x143)]===0x0)return console[_0x4b8b6b(0xa5)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x2f896c[_0x4b8b6b(0x145)][0x0]['id'];}const _0x24ceff=await selectChatInteractively(_0x28b266,_0x35b9f0);if(!_0x24ceff)return console[_0x4b8b6b(0xa5)](_0x4b8b6b(0x117)),undefined;return _0x24ceff;}async function getProjectIdOrDefault(_0x3a7528){const _0x428b94=a24_0x3d6b,{tdx:_0x594466,options:_0x33cdd4}=_0x3a7528,_0x11e59e=_0x33cdd4[_0x428b94(0xed)];if(_0x11e59e){const _0x50bcd2=await withSpinner(_0x428b94(0xbe)+_0x11e59e+_0x428b94(0x151),()=>_0x594466[_0x428b94(0x119)]['resolveProjectId'](_0x11e59e),{'verbose':_0x33cdd4[_0x428b94(0x10a)]});return _0x50bcd2['data'];}let _0x4006f9=_0x594466[_0x428b94(0x119)][_0x428b94(0x128)]();if(_0x4006f9)return _0x4006f9;const _0x5510fa=await withSpinner(_0x428b94(0x15c),()=>_0x594466[_0x428b94(0x119)][_0x428b94(0x147)](),{'verbose':_0x33cdd4[_0x428b94(0x10a)]});return _0x5510fa[_0x428b94(0x145)]['id'];}function toLLMProjectInfo(_0x5399b3){const _0x1219d3=a24_0x3d6b;return{'name':_0x5399b3[_0x1219d3(0x101)][_0x1219d3(0x110)],'description':_0x5399b3[_0x1219d3(0x101)][_0x1219d3(0xe3)],'createdAt':_0x5399b3[_0x1219d3(0x101)]['createdAt'],'updatedAt':_0x5399b3[_0x1219d3(0x101)][_0x1219d3(0x105)]};}function toAgentInfo(_0x2a55da){const _0x6f4dc0=a24_0x3d6b;return{'name':_0x2a55da[_0x6f4dc0(0x101)][_0x6f4dc0(0x110)],'description':_0x2a55da[_0x6f4dc0(0x101)][_0x6f4dc0(0xe3)],'prompt':truncatePrompt(_0x2a55da[_0x6f4dc0(0x101)][_0x6f4dc0(0xd0)]),'createdAt':_0x2a55da[_0x6f4dc0(0x101)][_0x6f4dc0(0xfd)],'updatedAt':_0x2a55da[_0x6f4dc0(0x101)][_0x6f4dc0(0x105)]};}function truncatePrompt(_0x29054a){const _0x4d29fe=a24_0x3d6b;if(!_0x29054a)return undefined;const _0xabb58d=0x64;if(_0x29054a[_0x4d29fe(0x143)]<=_0xabb58d)return _0x29054a;return _0x29054a[_0x4d29fe(0xa2)](0x0,_0xabb58d)+_0x4d29fe(0x131);}export class LLMModelsCommand extends BaseCommand{[a24_0x2d0c46(0x110)]='llm:models';['description']=a24_0x2d0c46(0xff);async[a24_0x2d0c46(0xcd)](_0x3b3ca0){const _0xcd251c=a24_0x2d0c46,{options:_0x5ecaf7,tdx:_0x3c3adc}=_0x3b3ca0;try{const _0x4f8f26=await withSpinner(_0xcd251c(0x14c),()=>_0x3c3adc['llm'][_0xcd251c(0x159)](),{'verbose':_0x5ecaf7['verbose']});return await handleSDKOutput(_0x4f8f26[_0xcd251c(0x145)],_0x5ecaf7),0x0;}catch(_0x49241e){return handleSDKError(_0x49241e,_0x5ecaf7),0x1;}}}function a24_0x2bae(){const _0x2bae48=['projectName','Delete\x20an\x20LLM\x20project','\x20\x20Integrations:\x20','knowledgeBases','push','.llm','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','filter','toLocaleDateString','llm:agent:show','agent','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','createdAt','string','List\x20available\x20LLM\x20models','input','attributes','stack','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','projects','updatedAt','cause','last','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','deleteProject','verbose','error','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','llm:agent:delete','Project\x20restored:\x20','prompts','name','map','9OSKByd','projectId','m\x20ago','INVALID_ARGUMENT','targetImageGenerator','\x0aCancelled','blue','llm','Error:\x20Agent\x20name\x20is\x20required','model','Set\x20current\x20project\x20context','Output\x20directory\x20\x27','Creating\x20agent\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Project\x20deleted:\x20','jsonl','100752uZroOq','image','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','\x20bytes)','Project\x20created:\x20','systemPrompt','getCurrentProject','targetKnowledgeBase','Create\x20a\x20new\x20LLM\x20project','createAgent','Checking\x20for\x20existing\x20projects...','\x20\x20Knowledge\x20Bases:\x20','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','green','[image]\x20\x20','...','6876eUdKJq','tool','llm:projects','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','content','[unknown]','substring','includes','find','just\x20now','split','createProject','Fetching\x20chat\x20history\x20for\x20\x27','Agent\x20deleted:\x20','413eURWlb','__load_more__','List\x20all\x20LLM\x20projects','length','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','data','h\x20ago','getOrCreateDefaultProject','Restore\x20cancelled.','integrations','exportedFrom','Analyzing\x20project\x20\x27','Fetching\x20available\x20models...','Fetching\x20agents...','Fetching\x20chat\x20sessions...','\x20->\x20Agent:','Select\x20a\x20chat\x20session:','\x27...','agents','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','temperature','Creating\x20project\x20\x27','claude-4.5-haiku','22NxwteJ','models','dim','(no\x20message)','Getting\x20default\x20project...','No\x20messages\x20found\x20in\x20chat\x20history.','\x20\x20Agents:\x20','magenta','\x20--last','getTime','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','219033azWKmt','sourceSite','Resolving\x20agent\x20\x27','[content]','floor','Error:\x20Project\x20name\x20is\x20required','Delete\x20an\x20agent','Restoring\x20project\x20from\x20\x27','chatId','llm:project:create','slice','llm:agents','join','log','default','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','Backing\x20up\x20project\x20\x27','all','8oTaNDG','Update\x20an\x20existing\x20agent','stringify','restoreProject','message','chats','12353BWxtNn','table','set','format','[tool]\x20\x20\x20','yes','[tool_call]','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','starterMessage','bold','history','setCurrentProject','Backup\x20cancelled.','llm:history','Resolving\x20project\x20\x27','Project\x20context\x20set\x20to:\x20','get','updateAgent','short','[output]\x20','[error]\x20\x20','2075230phwHnp','resolveAgentId','tool_call','agentId','targetWebSearchTool','2058704sgiukl','yellow','Invalid\x20path\x20syntax:\x20','execute','counts','rmSync','prompt','entries','\x20→\x20chat:\x20','llm:agent:create','LLM_PROJECT_NOT_FOUND','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','(no\x20agent)','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','output','1298760FfyIyn','Use\x20format:\x20project-name/agent-name','getBackupMetadata','Error:\x20','\x20-\x20','Validating\x20backup\x20from\x20\x27','llm:project:backup','\x20\x20Cause:\x20','toLowerCase','Fetching\x20most\x20recent\x20chat...','description','408031LrnybN','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','maxToolIterations','limit','List\x20agents\x20in\x20current\x20project','cyan','keys','\x20->\x20ImageGen:','\x27\x20already\x20exists.\x20Overwrite?','llmProject','firstInputContent','existsSync','lastConversationAt'];a24_0x2bae=function(){return _0x2bae48;};return a24_0x2bae();}export class LLMProjectsCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0x134);[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0x142);async[a24_0x2d0c46(0xcd)](_0x3f3457){const _0x217bfa=a24_0x2d0c46,{options:_0xfe21b3,args:_0x44b459,tdx:_0x155f39}=_0x3f3457;try{const _0x3df184=_0x44b459[0x0],_0x27486d=resolveLimit(_0xfe21b3[_0x217bfa(0xe7)],DEFAULT_LLM_LIMIT),_0x9da7ec=await withSpinner('Fetching\x20projects...',()=>_0x155f39[_0x217bfa(0x119)][_0x217bfa(0x104)](_0x27486d),{'verbose':_0xfe21b3[_0x217bfa(0x10a)]});let _0x4b2281=_0x9da7ec[_0x217bfa(0x145)];_0x3df184&&(_0x4b2281=_0x9da7ec['data'][_0x217bfa(0xf8)](_0x41e396=>matchGlobPattern(_0x41e396[_0x217bfa(0x101)][_0x217bfa(0x110)],_0x3df184)));const _0x244833=_0x4b2281['map'](toLLMProjectInfo);return await handleSDKOutput(_0x244833,_0xfe21b3),0x0;}catch(_0x296b05){return handleSDKError(_0x296b05,_0xfe21b3),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0xa3);[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0xe8);async['execute'](_0x2386c7){const _0x1eb455=a24_0x2d0c46,{options:_0x380841,args:_0xf31ed5,tdx:_0x23b82a}=_0x2386c7;try{const _0x149511=_0xf31ed5[0x0];let _0x2ae99a,_0x25e32f=_0x149511;if(_0x149511&&_0x149511[_0x1eb455(0x139)]('/')){const _0x2d5d1a=_0x149511[_0x1eb455(0x13c)]('/');if(_0x2d5d1a[_0x1eb455(0x143)]===0x2){const [_0x531876,_0x557430]=_0x2d5d1a,_0x214032=await _0x23b82a[_0x1eb455(0x119)]['projects'](),_0x5d0f7d=_0x214032['find'](_0x5f4ff6=>_0x5f4ff6[_0x1eb455(0x101)][_0x1eb455(0x110)]['toLowerCase']()===_0x531876[_0x1eb455(0xe1)]());if(!_0x5d0f7d)throw new SDKError(ErrorCode[_0x1eb455(0xd4)],'Project\x20not\x20found:\x20'+_0x531876,undefined,{'helpText':_0x1eb455(0xe5)});_0x2ae99a=_0x5d0f7d['id'],_0x25e32f=_0x557430;}else throw new SDKError(ErrorCode[_0x1eb455(0x115)],_0x1eb455(0xcc)+_0x149511,undefined,{'helpText':_0x1eb455(0xda)});}else _0x2ae99a=await getProjectIdOrDefault(_0x2386c7);const _0x371f5d=await withSpinner(_0x1eb455(0x14d),()=>_0x23b82a[_0x1eb455(0x119)][_0x1eb455(0x152)](_0x2ae99a),{'verbose':_0x380841[_0x1eb455(0x10a)]});let _0x1ced1d=_0x371f5d[_0x1eb455(0x145)];_0x25e32f&&(_0x1ced1d=_0x371f5d[_0x1eb455(0x145)][_0x1eb455(0xf8)](_0x1039ce=>matchGlobPattern(_0x1039ce[_0x1eb455(0x101)][_0x1eb455(0x110)],_0x25e32f)));const _0x544fc9=_0x1ced1d[_0x1eb455(0x111)](toAgentInfo);return await handleSDKOutput(_0x544fc9,_0x380841),0x0;}catch(_0x1eebbc){return handleSDKError(_0x1eebbc,_0x380841),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a24_0x2d0c46(0xfa);[a24_0x2d0c46(0xe3)]='Show\x20agent\x20details';async[a24_0x2d0c46(0xcd)](_0x35a4e5){const _0x1eb726=a24_0x2d0c46,{options:_0x13f7e0,args:_0x5d1772,tdx:_0x26624c}=_0x35a4e5;if(_0x5d1772['length']===0x0)return console[_0x1eb726(0x10b)](_0x1eb726(0x11a)),console['error'](_0x1eb726(0x162)),0x1;const _0x5789c6=_0x5d1772[0x0];try{const _0x483ffa=await getProjectIdOrDefault(_0x35a4e5),_0x271b49=await withSpinner('Resolving\x20agent\x20\x27'+_0x5789c6+_0x1eb726(0x151),()=>_0x26624c[_0x1eb726(0x119)]['resolveAgentId'](_0x5789c6,_0x483ffa),{'verbose':_0x13f7e0['verbose']}),_0x4ae14d=await withSpinner('Fetching\x20agent...',()=>_0x26624c[_0x1eb726(0x119)][_0x1eb726(0xfb)](_0x271b49[_0x1eb726(0x145)]),{'verbose':_0x13f7e0[_0x1eb726(0x10a)]});return await handleSDKOutput([_0x4ae14d[_0x1eb726(0x145)]],_0x13f7e0),0x0;}catch(_0x459749){return handleSDKError(_0x459749,_0x13f7e0),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0xd3);[a24_0x2d0c46(0xe3)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a24_0x2d0c46(0xcd)](_0x15efa2){const _0x219f5=a24_0x2d0c46,{options:_0x12da71,args:_0x670641,tdx:_0x51393d}=_0x15efa2;if(_0x670641[_0x219f5(0x143)]===0x0)return console[_0x219f5(0x10b)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x219f5(0x10b)](_0x219f5(0x11f)),console[_0x219f5(0x10b)](_0x219f5(0x108)),0x1;const _0x57ef85=_0x670641[0x0],_0x2dd6b5=_0x12da71,_0x219855=_0x2dd6b5[_0x219f5(0x127)],_0x4043e6=_0x2dd6b5[_0x219f5(0x11b)]||_0x219f5(0x157),_0x5969c6=_0x2dd6b5['starterMessage'],_0x42ed97=_0x2dd6b5[_0x219f5(0xe6)]?Number(_0x2dd6b5[_0x219f5(0xe6)]):undefined,_0x42f25c=_0x2dd6b5[_0x219f5(0x155)]?Number(_0x2dd6b5[_0x219f5(0x155)]):undefined;try{let _0x384c85,_0x106585;if(_0x57ef85['includes']('/')){const _0x24ce8f=_0x57ef85['split']('/');if(_0x24ce8f[_0x219f5(0x143)]===0x2){const [_0x4c1b78,_0xddd685]=_0x24ce8f,_0x3c999f=await withSpinner(_0x219f5(0xbe)+_0x4c1b78+_0x219f5(0x151),()=>_0x51393d['llm']['resolveProjectId'](_0x4c1b78),{'verbose':_0x12da71[_0x219f5(0x10a)]});_0x384c85=_0x3c999f[_0x219f5(0x145)],_0x106585=_0xddd685;}else throw new SDKError(ErrorCode[_0x219f5(0x115)],_0x219f5(0xcc)+_0x57ef85,undefined,{'helpText':_0x219f5(0xda)});}else _0x384c85=await getProjectIdOrDefault(_0x15efa2),_0x106585=_0x57ef85;const _0x32c9bc=await withSpinner(_0x219f5(0x11e)+_0x106585+_0x219f5(0x151),()=>_0x51393d[_0x219f5(0x119)][_0x219f5(0x12b)]({'name':_0x106585,'projectId':_0x384c85,'modelType':_0x4043e6,'systemPrompt':_0x219855,'starterMessage':_0x5969c6,'maxToolIterations':_0x42ed97,'temperature':_0x42f25c}),{'verbose':_0x12da71[_0x219f5(0x10a)]});return console[_0x219f5(0xa5)]('Agent\x20created:\x20'+_0x32c9bc['data']['id']),await handleSDKOutput([_0x32c9bc[_0x219f5(0x145)]],_0x12da71),0x0;}catch(_0x161735){return handleSDKError(_0x161735,_0x12da71),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']='llm:agent:update';[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0xab);async['execute'](_0xcf7fa3){const _0x279212=a24_0x2d0c46,{options:_0x19522a,args:_0x33b004,tdx:_0x4b1961}=_0xcf7fa3;if(_0x33b004['length']===0x0)return console['error'](_0x279212(0x11a)),console[_0x279212(0x10b)](_0x279212(0x144)),0x1;const _0x3aa714=_0x33b004[0x0],_0x1e0970=_0x19522a,_0x4fae76=_0x1e0970[_0x279212(0x110)],_0x449f6f=_0x1e0970[_0x279212(0xd0)],_0x1b4bd8=_0x1e0970[_0x279212(0xe3)],_0x3ccc90=_0x1e0970[_0x279212(0xb8)];if(!_0x4fae76&&!_0x449f6f&&!_0x1b4bd8&&!_0x3ccc90)return console[_0x279212(0x10b)](_0x279212(0xf7)),console[_0x279212(0x10b)](_0x279212(0x153)),0x1;try{const _0x5e301d=await getProjectIdOrDefault(_0xcf7fa3),_0x23ab83=await withSpinner(_0x279212(0x165)+_0x3aa714+_0x279212(0x151),()=>_0x4b1961[_0x279212(0x119)][_0x279212(0xc6)](_0x3aa714,_0x5e301d),{'verbose':_0x19522a['verbose']}),_0x3ae170=_0x23ab83[_0x279212(0x145)],_0x21f1a9=await withSpinner('Updating\x20agent...',()=>_0x4b1961[_0x279212(0x119)][_0x279212(0xc1)](_0x3ae170,{'name':_0x4fae76,'prompt':_0x449f6f,'description':_0x1b4bd8,'starterMessage':_0x3ccc90}),{'verbose':_0x19522a[_0x279212(0x10a)]});return console['log']('Agent\x20updated:\x20'+_0x21f1a9[_0x279212(0x145)]['id']),await handleSDKOutput([_0x21f1a9[_0x279212(0x145)]],_0x19522a),0x0;}catch(_0x1e58b0){return handleSDKError(_0x1e58b0,_0x19522a),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0x10d);['description']=a24_0x2d0c46(0x169);async['execute'](_0x421f55){const _0x26621c=a24_0x2d0c46,{options:_0x1b2a17,args:_0x553d54,tdx:_0x116a6a}=_0x421f55;if(_0x553d54[_0x26621c(0x143)]===0x0)return console[_0x26621c(0x10b)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x26621c(0x10b)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x305b8d=_0x553d54[0x0];try{const _0x3057d0=await getProjectIdOrDefault(_0x421f55),_0x2312bc=await withSpinner(_0x26621c(0x165)+_0x305b8d+'\x27...',()=>_0x116a6a[_0x26621c(0x119)]['resolveAgentId'](_0x305b8d,_0x3057d0),{'verbose':_0x1b2a17[_0x26621c(0x10a)]}),_0xa7ef3f=_0x2312bc[_0x26621c(0x145)];return await withSpinner('Deleting\x20agent...',()=>_0x116a6a[_0x26621c(0x119)]['deleteAgent'](_0xa7ef3f),{'verbose':_0x1b2a17[_0x26621c(0x10a)]}),console[_0x26621c(0xa5)](_0x26621c(0x13f)+_0xa7ef3f),0x0;}catch(_0x70ed1f){return handleSDKError(_0x70ed1f,_0x1b2a17),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0xbd);[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0x135);async[a24_0x2d0c46(0xcd)](_0x19ff30){return executeChatHistoryCommand(_0x19ff30,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{['name']='llm:use';[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0x11c);async['execute'](_0x319a13){const _0x216fde=a24_0x2d0c46,{options:_0x378aac,args:_0xa99de9,tdx:_0x4a057e}=_0x319a13;if(_0xa99de9[_0x216fde(0x143)]===0x0)return console['error'](_0x216fde(0x168)),console[_0x216fde(0x10b)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x1277a1=_0xa99de9[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x1277a1+_0x216fde(0x151),()=>_0x4a057e[_0x216fde(0x119)][_0x216fde(0xbb)](_0x1277a1),{'verbose':_0x378aac[_0x216fde(0x10a)]}),console[_0x216fde(0xa5)](_0x216fde(0xbf)+_0x1277a1),0x0;}catch(_0x3eefd8){return handleSDKError(_0x3eefd8,_0x378aac),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0x16c);['description']=a24_0x2d0c46(0x12a);async[a24_0x2d0c46(0xcd)](_0x1afb78){const _0x42a90b=a24_0x2d0c46,{options:_0x558a8c,args:_0x5b4c93,tdx:_0x2b1d95}=_0x1afb78;if(_0x5b4c93['length']===0x0)return console[_0x42a90b(0x10b)](_0x42a90b(0x168)),console[_0x42a90b(0x10b)](_0x42a90b(0x103)),0x1;const _0x396daa=_0x5b4c93[0x0],_0x29d4e4=_0x558a8c,_0x35df3d=_0x29d4e4['description'];try{const _0x41d4ea=await withSpinner(_0x42a90b(0x156)+_0x396daa+_0x42a90b(0x151),()=>_0x2b1d95[_0x42a90b(0x119)][_0x42a90b(0x13d)]({'name':_0x396daa,'description':_0x35df3d}),{'verbose':_0x558a8c[_0x42a90b(0x10a)]});console[_0x42a90b(0xa5)](_0x42a90b(0x126)+_0x41d4ea[_0x42a90b(0x145)]['id']);const _0x51c816=toLLMProjectInfo(_0x41d4ea[_0x42a90b(0x145)]);return await handleSDKOutput([_0x51c816],_0x558a8c),0x0;}catch(_0x22a968){return handleSDKError(_0x22a968,_0x558a8c),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a24_0x2d0c46(0x110)]='llm:project:delete';[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0xf2);async[a24_0x2d0c46(0xcd)](_0x37fd78){const _0x7690c4=a24_0x2d0c46,{options:_0xf96a22,args:_0x359867,tdx:_0xfe869a}=_0x37fd78;if(_0x359867[_0x7690c4(0x143)]===0x0)return console[_0x7690c4(0x10b)](_0x7690c4(0x168)),console['error'](_0x7690c4(0x12e)),0x1;const _0x4f9f6f=_0x359867[0x0];try{return await withSpinner('Deleting\x20project\x20\x27'+_0x4f9f6f+_0x7690c4(0x151),()=>_0xfe869a[_0x7690c4(0x119)][_0x7690c4(0x109)](_0x4f9f6f),{'verbose':_0xf96a22[_0x7690c4(0x10a)]}),console['log'](_0x7690c4(0x120)+_0x4f9f6f),0x0;}catch(_0x440f11){return handleSDKError(_0x440f11,_0xf96a22),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0xdf);[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0x154);async[a24_0x2d0c46(0xcd)](_0x2d1df8){const _0xfaee52=a24_0x2d0c46,{options:_0x1b7bec,args:_0x417559,tdx:_0x42ab19}=_0x2d1df8;if(_0x417559['length']===0x0)return console[_0xfaee52(0x10b)](_0xfaee52(0x168)),console[_0xfaee52(0x10b)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0xdc6cd8=_0x417559[0x0],_0x1de5e6=_0x1b7bec,_0x5aeb3f=_0x1de5e6[_0xfaee52(0xd8)],_0x10df68=_0x1de5e6['dryRun'];try{const _0x2f86c3=_0x5aeb3f||_0xdc6cd8+_0xfaee52(0xf6);if(a24_0x3e054b[_0xfaee52(0xef)](_0x2f86c3)&&!_0x10df68){if(!_0x1b7bec[_0xfaee52(0xb5)]){const _0x29c120=await confirm(_0xfaee52(0x11d)+_0x2f86c3+_0xfaee52(0xec));if(!_0x29c120)return console[_0xfaee52(0xa5)](_0xfaee52(0xbc)),0x0;}a24_0x3e054b[_0xfaee52(0xcf)](_0x2f86c3,{'recursive':!![]});}const _0x5b8de4=await withSpinner(_0x10df68?_0xfaee52(0x14b)+_0xdc6cd8+_0xfaee52(0x151):_0xfaee52(0xa8)+_0xdc6cd8+'\x27...',()=>_0x42ab19[_0xfaee52(0x119)]['backupProject'](_0xdc6cd8,_0x5aeb3f,{'dryRun':_0x10df68}),{'verbose':_0x1b7bec[_0xfaee52(0x10a)]}),_0xfb2f97=_0x5b8de4[_0xfaee52(0x145)];return _0x10df68?console[_0xfaee52(0xa5)](_0xfaee52(0xd7)+_0xfb2f97['outputDir']):console[_0xfaee52(0xa5)]('Project\x20backed\x20up\x20to:\x20'+_0xfb2f97['outputDir']),console['log']('\x20\x20Agents:\x20'+_0xfb2f97[_0xfaee52(0xce)][_0xfaee52(0x152)]),console['log'](_0xfaee52(0x12d)+_0xfb2f97[_0xfaee52(0xce)][_0xfaee52(0xf4)]),console[_0xfaee52(0xa5)]('\x20\x20Prompts:\x20'+_0xfb2f97[_0xfaee52(0xce)][_0xfaee52(0x10f)]),console[_0xfaee52(0xa5)](_0xfaee52(0xf3)+_0xfb2f97[_0xfaee52(0xce)]['integrations']),(_0x1b7bec['format']==='json'||_0x1b7bec['format']===_0xfaee52(0x121))&&await handleSDKOutput([_0xfb2f97],_0x1b7bec),0x0;}catch(_0x12babd){return handleSDKError(_0x12babd,_0x1b7bec),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']='llm:project:restore';['description']=a24_0x2d0c46(0xd5);async[a24_0x2d0c46(0xcd)](_0x339e59){const _0x3b2191=a24_0x2d0c46,{options:_0x326f99,args:_0x8d472d,tdx:_0x214389}=_0x339e59;if(_0x8d472d['length']===0x0)return console[_0x3b2191(0x10b)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x3b2191(0x10b)](_0x3b2191(0x124)),0x1;const _0x2e0155=_0x8d472d[0x0],_0x4e19ee=_0x326f99,_0x16648c=_0x4e19ee[_0x3b2191(0x110)],_0x9e69ce=_0x4e19ee['dryRun'];try{if(!_0x9e69ce){const _0x2fce71=_0x214389['llm'][_0x3b2191(0xdb)](_0x2e0155),_0x30f048=_0x16648c||_0x2fce71[_0x3b2191(0x14a)][_0x3b2191(0xf1)],_0x1f92af=await withSpinner(_0x3b2191(0x12c),()=>_0x214389[_0x3b2191(0x119)][_0x3b2191(0x104)](),{'verbose':_0x326f99['verbose']}),_0x44baef=_0x1f92af[_0x3b2191(0x145)][_0x3b2191(0x13a)](_0xc9c596=>_0xc9c596[_0x3b2191(0x101)]['name']===_0x30f048);if(_0x44baef&&!_0x326f99[_0x3b2191(0xb5)]){const _0x26a79f=await confirm('A\x20project\x20named\x20\x27'+_0x30f048+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x26a79f)return console['log'](_0x3b2191(0x148)),0x0;}}const _0x7c84f9=await withSpinner(_0x9e69ce?_0x3b2191(0xde)+_0x2e0155+_0x3b2191(0x151):_0x3b2191(0x16a)+_0x2e0155+_0x3b2191(0x151),()=>_0x214389[_0x3b2191(0x119)][_0x3b2191(0xad)](_0x2e0155,{'name':_0x16648c,'dryRun':_0x9e69ce}),{'verbose':_0x326f99['verbose']}),_0x67e4a0=_0x7c84f9[_0x3b2191(0x145)];return _0x67e4a0[_0x3b2191(0x164)]&&console['log'](_0x3b2191(0xfc)+_0x67e4a0[_0x3b2191(0x164)]+'\x27'),_0x9e69ce?console['log'](_0x3b2191(0x10c)+_0x67e4a0[_0x3b2191(0xf1)]):console[_0x3b2191(0xa5)](_0x3b2191(0x10e)+_0x67e4a0[_0x3b2191(0xf1)]+'\x20('+_0x67e4a0[_0x3b2191(0x113)]+')'),console[_0x3b2191(0xa5)](_0x3b2191(0x15e)+_0x67e4a0['counts'][_0x3b2191(0x152)]),console[_0x3b2191(0xa5)]('\x20\x20Knowledge\x20Bases:\x20'+_0x67e4a0['counts'][_0x3b2191(0xf4)]),console[_0x3b2191(0xa5)]('\x20\x20Prompts:\x20'+_0x67e4a0[_0x3b2191(0xce)]['prompts']),console['log'](_0x3b2191(0xf3)+_0x67e4a0['counts'][_0x3b2191(0x149)]),(_0x326f99[_0x3b2191(0xb3)]==='json'||_0x326f99[_0x3b2191(0xb3)]===_0x3b2191(0x121))&&await handleSDKOutput([_0x67e4a0],_0x326f99),0x0;}catch(_0x378c45){return handleSDKError(_0x378c45,_0x326f99),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x28a62d,_0x150742){const _0x3361b2=a24_0x2d0c46,_0x4813b0=_0x150742[_0x3361b2(0xe7)]||CHAT_SELECTOR_PAGE_SIZE;let _0x59e28f=0x0,_0x41f360=[];const _0x1b5704=(await import(_0x3361b2(0x10f)))[_0x3361b2(0xa6)],_0x823cc0=getChalk(_0x150742);while(!![]){const _0x2e098a=await withSpinner(_0x3361b2(0x14e),()=>_0x28a62d['llm'][_0x3361b2(0xaf)](_0x4813b0+_0x59e28f),{'verbose':_0x150742[_0x3361b2(0x10a)]});_0x41f360=_0x2e098a[_0x3361b2(0x145)];const _0x2b262c=_0x41f360['slice'](_0x59e28f,_0x59e28f+_0x4813b0),_0x41c041=_0x41f360[_0x3361b2(0x143)]>_0x59e28f+_0x4813b0,_0x3f4e8a=[...new Set(_0x2b262c['map'](_0x3e8c7=>_0x3e8c7[_0x3361b2(0x101)]['agentId'])[_0x3361b2(0xf8)](_0x23f58e=>_0x23f58e!==undefined))],_0x14d3c2=new Map();await Promise[_0x3361b2(0xa9)](_0x3f4e8a[_0x3361b2(0x111)](async _0x4f5acd=>{const _0x5a0dd6=_0x3361b2;try{const _0x5e2060=await _0x28a62d[_0x5a0dd6(0x119)][_0x5a0dd6(0xfb)](_0x4f5acd);_0x14d3c2[_0x5a0dd6(0xb2)](_0x4f5acd,_0x5e2060['attributes'][_0x5a0dd6(0x110)]);}catch{_0x14d3c2[_0x5a0dd6(0xb2)](_0x4f5acd,_0x4f5acd);}}));const _0x596f67=_0x2b262c[_0x3361b2(0x111)](_0x3c71ff=>{const _0xa6d607=_0x3361b2,_0x3cc63c=_0x3c71ff[_0xa6d607(0x101)][_0xa6d607(0xee)]||_0xa6d607(0x15b),_0x558e2f=_0x3cc63c[_0xa6d607(0x13c)]('\x0a')[0x0],_0x49b334=_0x558e2f[_0xa6d607(0x143)]>0x50?_0x558e2f[_0xa6d607(0x138)](0x0,0x4d)+'...':_0x558e2f,_0x35da22=_0x3c71ff[_0xa6d607(0x101)][_0xa6d607(0xc8)]?_0x14d3c2[_0xa6d607(0xc0)](_0x3c71ff['attributes']['agentId'])||_0x3c71ff[_0xa6d607(0x101)][_0xa6d607(0xc8)]:_0xa6d607(0xd6),_0x29360d=_0x3c71ff['attributes'][_0xa6d607(0xf0)]||_0x3c71ff[_0xa6d607(0x101)]['updatedAt'],_0x5a3187=new Date(_0x29360d),_0x7a06c2=new Date(),_0x43b4e1=_0x7a06c2[_0xa6d607(0x161)]()-_0x5a3187[_0xa6d607(0x161)](),_0x2184a8=Math['floor'](_0x43b4e1/0xea60),_0x2d2b17=Math['floor'](_0x43b4e1/0x36ee80),_0x44a44d=Math[_0xa6d607(0x167)](_0x43b4e1/0x5265c00);let _0x55176d;if(_0x2184a8<0x1)_0x55176d=_0xa6d607(0x13b);else{if(_0x2184a8<0x3c)_0x55176d=_0x2184a8+_0xa6d607(0x114);else{if(_0x2d2b17<0x18)_0x55176d=_0x2d2b17+_0xa6d607(0x146);else _0x44a44d<0x7?_0x55176d=_0x44a44d+'d\x20ago':_0x55176d=_0x5a3187[_0xa6d607(0xf9)]('en-US',{'month':_0xa6d607(0xc2),'day':'numeric'});}}return{'title':_0x49b334+'\x20'+_0x823cc0['dim']('['+_0x35da22+']\x20'+_0x55176d),'value':_0x3c71ff['id']};});_0x41c041&&_0x596f67[_0x3361b2(0xf5)]({'title':_0x823cc0[_0x3361b2(0xe9)]('Load\x20more...'),'value':'__load_more__'});const _0x560452=await _0x1b5704({'type':'select','name':_0x3361b2(0x16b),'message':_0x3361b2(0x150),'choices':_0x596f67,'hint':_0x3361b2(0xb7)});if(!_0x560452[_0x3361b2(0x16b)])return undefined;if(_0x560452[_0x3361b2(0x16b)]===_0x3361b2(0x141)){_0x59e28f+=_0x4813b0;continue;}return _0x560452[_0x3361b2(0x16b)];}}export class ChatsCommand extends BaseCommand{[a24_0x2d0c46(0x110)]=a24_0x2d0c46(0xaf);[a24_0x2d0c46(0xe3)]=a24_0x2d0c46(0xa7);async['execute'](_0x4036d3){return executeChatHistoryCommand(_0x4036d3,'tdx\x20chats');}}
1
+ const a24_0x1b217f=a24_0x4fc4;(function(_0x542413,_0x400d32){const _0x239a4a=a24_0x4fc4,_0xb4f427=_0x542413();while(!![]){try{const _0x46b4ad=parseInt(_0x239a4a(0x178))/0x1+parseInt(_0x239a4a(0x1bf))/0x2*(-parseInt(_0x239a4a(0x14e))/0x3)+parseInt(_0x239a4a(0x13b))/0x4*(parseInt(_0x239a4a(0x162))/0x5)+-parseInt(_0x239a4a(0x136))/0x6*(-parseInt(_0x239a4a(0x147))/0x7)+parseInt(_0x239a4a(0x1b6))/0x8*(-parseInt(_0x239a4a(0x181))/0x9)+-parseInt(_0x239a4a(0x1d1))/0xa+parseInt(_0x239a4a(0x1ac))/0xb*(parseInt(_0x239a4a(0x16e))/0xc);if(_0x46b4ad===_0x400d32)break;else _0xb4f427['push'](_0xb4f427['shift']());}catch(_0x285d24){_0xb4f427['push'](_0xb4f427['shift']());}}}(a24_0x3761,0x9e113));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a24_0x3761(){const _0x1a5e1c=['stack','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','\x20bytes)','all','\x20\x20Agents:\x20','\x20\x20Knowledge\x20Bases:\x20','\x20-\x20','format','m\x20ago','llm:project:delete','targetAgent','Agent\x20created:\x20','agent','[output]\x20','cause','agentId','verbose','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','cyan','[tool_call]','.llm','chatId','knowledgeBases','find','deleteProject','Creating\x20agent\x20\x27','Fetching\x20most\x20recent\x20chat...','[image]\x20\x20','short','llm:agent:create','red','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Output\x20directory\x20\x27','toLowerCase','jsonl','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','llm:agent:update','[input]\x20\x20','Backup\x20cancelled.','Project\x20not\x20found:\x20','tdx\x20llm\x20history','bold','outputDir','Update\x20an\x20existing\x20agent','Deleting\x20project\x20\x27','tool','Project\x20created:\x20','toLocaleDateString','Delete\x20an\x20agent','\x0aCancelled','1782606TVvmIm','Backing\x20up\x20project\x20\x27','stringify','description','join','4UXkaLu','split','blue','claude-4.5-haiku','magenta','Project\x20restored:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Load\x20more...','data','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','projects','7JfAgsr','tool_call','updateAgent','[unknown]','input','starterMessage','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','15ZhdKZQ','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','llm:agents','floor','Getting\x20default\x20project...','\x20\x20Prompts:\x20','length','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','targetKnowledgeBase','numeric','\x20\x20Integrations:\x20','Agent\x20deleted:\x20','INVALID_ARGUMENT','targetImageGenerator','slice','set','integrations','Error:\x20Agent\x20name\x20is\x20required','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','getTime','5006915oButXx','createdAt','dim','message','\x20→\x20chat:\x20','\x20->\x20KB:','Use\x20format:\x20project-name/agent-name','llm:models','Restoring\x20project\x20from\x20\x27','Restore\x20cancelled.','prompt','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','11078808HClcFd','List\x20all\x20LLM\x20projects','llm:projects','includes','get','tdx\x20chats','__load_more__','restoreProject','List\x20available\x20LLM\x20models','Fetching\x20agents...','598868tryEFK','Show\x20agent\x20details','Fetching\x20chat\x20sessions...','limit','systemPrompt','name','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','resolveAgentId','No\x20chat\x20sessions\x20found.','9gwiTgF','json','yellow','llm:project:restore','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','d\x20ago','projectName','just\x20now','Error:\x20','getOrCreateDefaultProject','[tool]\x20\x20\x20','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Error:\x20Project\x20name\x20is\x20required','image','attributes','resolveProjectId','Fetching\x20available\x20models...','content','history','Invalid\x20path\x20syntax:\x20','map','Fetching\x20projects...','createProject','deleteAgent','Resolving\x20agent\x20\x27','sourceSite','llm','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Select\x20a\x20chat\x20session:','\x20->\x20WebSearch:','\x20->\x20Agent:','Updating\x20agent...','error','List\x20agents\x20in\x20current\x20project','counts','Resolving\x20project\x20\x27','dryRun','Fetching\x20agent...','exportedFrom','existsSync','Project\x20context\x20set\x20to:\x20','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','11sEynQk','createAgent','projectId','yes','maxToolIterations','substring','filter','Usage:\x20','log','Validating\x20backup\x20from\x20\x27','7906504chbZBn','Create\x20a\x20new\x20LLM\x20project','...','prompts','updatedAt','targetWebSearchTool','\x20->\x20ImageGen:','Analyzing\x20project\x20\x27','llm:history','4444GjeFnN','[content]','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','temperature','Creating\x20project\x20\x27','rmSync','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','output','getBackupMetadata','chats','h\x20ago','(no\x20message)','getCurrentProject','[error]\x20\x20','\x27...','en-US','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','\x20--last','11737200abYUIq','Agent\x20updated:\x20','agents','execute'];a24_0x3761=function(){return _0x1a5e1c;};return a24_0x3761();}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 a24_0x1cf23b from'node:fs';function handleSDKError(_0x3c3f9c,_0x1e8b77){const _0x2e0950=a24_0x4fc4;if(_0x3c3f9c instanceof SDKError)console['error'](_0x2e0950(0x189)+_0x3c3f9c[_0x2e0950(0x165)]),_0x1e8b77[_0x2e0950(0x114)]&&(_0x3c3f9c[_0x2e0950(0x112)]&&console[_0x2e0950(0x1a2)]('\x20\x20Cause:\x20'+_0x3c3f9c[_0x2e0950(0x112)]),_0x3c3f9c[_0x2e0950(0x1d5)]&&(console[_0x2e0950(0x1a2)]('\x0aStack\x20trace:'),console[_0x2e0950(0x1a2)](_0x3c3f9c['stack'])));else throw _0x3c3f9c;}function formatChatHistoryEntry(_0x5f46a5,_0x3a4112){const _0x25415f=a24_0x4fc4,_0x55b61c=getChalk(_0x3a4112),_0x1778a8=_0x55b61c[_0x25415f(0x164)](_0x5f46a5['at']);if(_0x25415f(0x14b)in _0x5f46a5){const _0x2f48e0=_0x55b61c[_0x25415f(0x116)](_0x25415f(0x129));return _0x1778a8+'\x20'+_0x2f48e0+':\x20'+_0x5f46a5[_0x25415f(0x14b)];}if('content'in _0x5f46a5){const _0xe6e3bc=_0x55b61c['green'](_0x25415f(0x1c0));return _0x1778a8+'\x20'+_0xe6e3bc+':\x20'+_0x5f46a5['content'];}if(_0x25415f(0x148)in _0x5f46a5){const _0x4c0d28=_0x55b61c[_0x25415f(0x183)](_0x25415f(0x117)),{functionName:_0x48cbd5,functionArguments:_0x2cdac6,targetFunction:_0x5062ea}=_0x5f46a5[_0x25415f(0x148)];let _0x4c0218=_0x1778a8+'\x20'+_0x4c0d28+':\x20'+_0x55b61c[_0x25415f(0x12d)](_0x48cbd5);if(_0x2cdac6&&Object['keys'](_0x2cdac6)[_0x25415f(0x154)]>0x0){const _0x427110=Object['entries'](_0x2cdac6)[_0x25415f(0x196)](([_0x16f118,_0x11d8d9])=>_0x16f118+'='+JSON['stringify'](_0x11d8d9))[_0x25415f(0x13a)](',\x20');_0x4c0218+='('+_0x427110+')';}_0x5062ea&&(_0x4c0218+=_0x55b61c[_0x25415f(0x164)]('\x20['+_0x5062ea+']'));let _0x44ce1d='';if(_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x156)])_0x44ce1d=_0x25415f(0x167)+_0x5f46a5['tool_call'][_0x25415f(0x156)]['name'];else{if(_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x10e)])_0x44ce1d=_0x25415f(0x1a0)+_0x5f46a5[_0x25415f(0x148)]['targetAgent'][_0x25415f(0x17d)];else{if(_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x1bb)])_0x44ce1d=_0x25415f(0x19f)+_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x1bb)][_0x25415f(0x17d)];else _0x5f46a5[_0x25415f(0x148)][_0x25415f(0x15b)]&&(_0x44ce1d=_0x25415f(0x1bc)+_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x15b)]['name']);}}return _0x4c0218+_0x44ce1d;}if(_0x25415f(0x131)in _0x5f46a5){const _0x505e52=_0x55b61c[_0x25415f(0x13f)](_0x25415f(0x18b)),{functionName:_0x545ec4,functionArguments:_0x1b54d4,content:_0x4218c8,newChat:_0x177ca0}=_0x5f46a5['tool'];let _0x36ee2=_0x1778a8+'\x20'+_0x505e52+':\x20'+_0x55b61c[_0x25415f(0x12d)](_0x545ec4);if(_0x1b54d4){const _0x27825a=typeof _0x1b54d4==='string'?_0x1b54d4:JSON[_0x25415f(0x138)](_0x1b54d4);_0x36ee2+='('+_0x27825a+')';}return _0x4218c8&&(_0x36ee2+='\x0a'+_0x55b61c['dim'](_0x4218c8)),_0x177ca0&&(_0x36ee2+=_0x55b61c[_0x25415f(0x164)](_0x25415f(0x166)+_0x177ca0['id'])),_0x36ee2;}if(_0x25415f(0x1c6)in _0x5f46a5){const _0x4bdb8d=_0x55b61c[_0x25415f(0x13d)](_0x25415f(0x111));return _0x1778a8+'\x20'+_0x4bdb8d+':\x20'+_0x5f46a5[_0x25415f(0x1c6)][_0x25415f(0x17d)]+'\x20('+_0x5f46a5[_0x25415f(0x1c6)][_0x25415f(0x193)][_0x25415f(0x154)]+_0x25415f(0x1d7);}if(_0x25415f(0x18f)in _0x5f46a5){const _0x58fecc=_0x55b61c[_0x25415f(0x13d)](_0x25415f(0x11f)),{width:_0x16d09d,height:_0x1be4ac,headerText:_0x10cd89}=_0x5f46a5['image'],_0x4c2c4f=_0x10cd89?_0x25415f(0x1db)+_0x10cd89:'';return _0x1778a8+'\x20'+_0x58fecc+':\x20'+_0x16d09d+'x'+_0x1be4ac+_0x4c2c4f;}if(_0x25415f(0x1a2)in _0x5f46a5){const _0x59208f=_0x55b61c[_0x25415f(0x122)](_0x25415f(0x1cc));return _0x1778a8+'\x20'+_0x59208f+':\x20'+_0x5f46a5[_0x25415f(0x1a2)];}return _0x1778a8+'\x20'+_0x55b61c[_0x25415f(0x164)](_0x25415f(0x14a))+':\x20'+JSON['stringify'](_0x5f46a5);}async function executeChatHistoryCommand(_0x57a11d,_0x5bb847){const _0x548e0b=a24_0x4fc4,{options:_0x2c95be,args:_0x442adc,tdx:_0x1b0ccb}=_0x57a11d,_0xd91b7a=_0x442adc[0x0],_0x1a896c=_0x2c95be,_0x6c425c=_0x1a896c['last'];try{if(_0x6c425c&&_0xd91b7a)return console[_0x548e0b(0x1a2)](_0x548e0b(0x1d6)),console[_0x548e0b(0x1a2)](_0x548e0b(0x1b3)+_0x5bb847+_0x548e0b(0x1d0)),0x1;if(!_0xd91b7a&&!_0x6c425c&&_0x2c95be[_0x548e0b(0x1dc)]!==undefined){const _0x598f0a=resolveLimit(_0x2c95be[_0x548e0b(0x17b)],DEFAULT_LLM_LIMIT),_0x1937b8=await withSpinner(_0x548e0b(0x17a),()=>_0x1b0ccb[_0x548e0b(0x19c)]['chats'](_0x598f0a),{'verbose':_0x2c95be[_0x548e0b(0x114)]});return await handleSDKOutput(_0x1937b8[_0x548e0b(0x143)],_0x2c95be),0x0;}const _0x200ecd=await getChatIdOrSelect(_0x1b0ccb,_0x2c95be,_0x6c425c,_0xd91b7a);if(!_0x200ecd)return 0x0;return await displayChatHistory(_0x200ecd,_0x1b0ccb,_0x2c95be),0x0;}catch(_0x22032f){return handleSDKError(_0x22032f,_0x2c95be),0x1;}}async function displayChatHistory(_0x1f8627,_0x3d9584,_0x513812){const _0x14298d=a24_0x4fc4,_0x2f7551=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x1f8627+_0x14298d(0x1cd),()=>_0x3d9584['llm'][_0x14298d(0x194)](_0x1f8627),{'verbose':_0x513812[_0x14298d(0x114)]}),_0x43d498=_0x2f7551[_0x14298d(0x143)]['data']??[];if(_0x43d498[_0x14298d(0x154)]===0x0){console[_0x14298d(0x1b4)]('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x513812[_0x14298d(0x1dc)]!==undefined)await handleSDKOutput(_0x43d498,_0x513812);else{const _0x24a89e=_0x43d498[_0x14298d(0x196)](_0x2729d6=>formatChatHistoryEntry(_0x2729d6,_0x513812)),_0x423eb5=_0x24a89e[_0x14298d(0x13a)]('\x0a');await writeOutput(_0x423eb5,_0x513812[_0x14298d(0x1c6)],'table');}}async function getChatIdOrSelect(_0x4821f1,_0x3c3056,_0x31ba16,_0xc99b4a){const _0x1c3065=a24_0x4fc4;if(_0xc99b4a)return _0xc99b4a;if(_0x31ba16){const _0x3ae94b=await withSpinner(_0x1c3065(0x11e),()=>_0x4821f1[_0x1c3065(0x19c)][_0x1c3065(0x1c8)](0x1),{'verbose':_0x3c3056[_0x1c3065(0x114)]});if(_0x3ae94b[_0x1c3065(0x143)][_0x1c3065(0x154)]===0x0)return console[_0x1c3065(0x1b4)](_0x1c3065(0x180)),undefined;return _0x3ae94b[_0x1c3065(0x143)][0x0]['id'];}const _0x1a3a9d=await selectChatInteractively(_0x4821f1,_0x3c3056);if(!_0x1a3a9d)return console[_0x1c3065(0x1b4)](_0x1c3065(0x135)),undefined;return _0x1a3a9d;}async function getProjectIdOrDefault(_0x5c6661){const _0x32fe8a=a24_0x4fc4,{tdx:_0x16cee6,options:_0x5c07c5}=_0x5c6661,_0x788273=_0x5c07c5['llmProject'];if(_0x788273){const _0x38c81d=await withSpinner(_0x32fe8a(0x1a5)+_0x788273+_0x32fe8a(0x1cd),()=>_0x16cee6['llm'][_0x32fe8a(0x191)](_0x788273),{'verbose':_0x5c07c5['verbose']});return _0x38c81d[_0x32fe8a(0x143)];}let _0x431f0e=_0x16cee6['llm'][_0x32fe8a(0x1cb)]();if(_0x431f0e)return _0x431f0e;const _0x43a274=await withSpinner(_0x32fe8a(0x152),()=>_0x16cee6['llm'][_0x32fe8a(0x18a)](),{'verbose':_0x5c07c5[_0x32fe8a(0x114)]});return _0x43a274['data']['id'];}function toLLMProjectInfo(_0xbb63a1){const _0x290094=a24_0x4fc4;return{'name':_0xbb63a1[_0x290094(0x190)]['name'],'description':_0xbb63a1[_0x290094(0x190)][_0x290094(0x139)],'createdAt':_0xbb63a1[_0x290094(0x190)][_0x290094(0x163)],'updatedAt':_0xbb63a1['attributes'][_0x290094(0x1ba)]};}function toAgentInfo(_0x209a7a){const _0x4659ec=a24_0x4fc4;return{'name':_0x209a7a[_0x4659ec(0x190)]['name'],'description':_0x209a7a[_0x4659ec(0x190)][_0x4659ec(0x139)],'prompt':truncatePrompt(_0x209a7a[_0x4659ec(0x190)][_0x4659ec(0x16c)]),'createdAt':_0x209a7a[_0x4659ec(0x190)]['createdAt'],'updatedAt':_0x209a7a[_0x4659ec(0x190)][_0x4659ec(0x1ba)]};}function truncatePrompt(_0x507f18){const _0x3fe45e=a24_0x4fc4;if(!_0x507f18)return undefined;const _0x10164a=0x64;if(_0x507f18['length']<=_0x10164a)return _0x507f18;return _0x507f18[_0x3fe45e(0x15c)](0x0,_0x10164a)+_0x3fe45e(0x1b8);}export class LLMModelsCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x169);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x176);async[a24_0x1b217f(0x1d4)](_0x17bbe0){const _0x298d25=a24_0x1b217f,{options:_0x1a0442,tdx:_0x79713}=_0x17bbe0;try{const _0x14dda7=await withSpinner(_0x298d25(0x192),()=>_0x79713[_0x298d25(0x19c)]['models'](),{'verbose':_0x1a0442[_0x298d25(0x114)]});return await handleSDKOutput(_0x14dda7[_0x298d25(0x143)],_0x1a0442),0x0;}catch(_0x1c1142){return handleSDKError(_0x1c1142,_0x1a0442),0x1;}}}function a24_0x4fc4(_0xe396d,_0x5a7335){const _0x3761e4=a24_0x3761();return a24_0x4fc4=function(_0x4fc424,_0x1abdcf){_0x4fc424=_0x4fc424-0x10d;let _0x4056bf=_0x3761e4[_0x4fc424];return _0x4056bf;},a24_0x4fc4(_0xe396d,_0x5a7335);}export class LLMProjectsCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x170);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x16f);async['execute'](_0x17ebe1){const _0x51fd75=a24_0x1b217f,{options:_0x32b841,args:_0x23365d,tdx:_0xae3c1a}=_0x17ebe1;try{const _0x15f276=_0x23365d[0x0],_0x1bf0f3=resolveLimit(_0x32b841[_0x51fd75(0x17b)],DEFAULT_LLM_LIMIT),_0x140af4=await withSpinner(_0x51fd75(0x197),()=>_0xae3c1a[_0x51fd75(0x19c)][_0x51fd75(0x146)](_0x1bf0f3),{'verbose':_0x32b841[_0x51fd75(0x114)]});let _0x6cd745=_0x140af4[_0x51fd75(0x143)];_0x15f276&&(_0x6cd745=_0x140af4['data'][_0x51fd75(0x1b2)](_0x28aa73=>matchGlobPattern(_0x28aa73['attributes'][_0x51fd75(0x17d)],_0x15f276)));const _0x28e97e=_0x6cd745['map'](toLLMProjectInfo);return await handleSDKOutput(_0x28e97e,_0x32b841),0x0;}catch(_0x256ec9){return handleSDKError(_0x256ec9,_0x32b841),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a24_0x1b217f(0x150);['description']=a24_0x1b217f(0x1a3);async[a24_0x1b217f(0x1d4)](_0x46673d){const _0x37c370=a24_0x1b217f,{options:_0x3beae3,args:_0x50aaf0,tdx:_0x54f62e}=_0x46673d;try{const _0x2a9676=_0x50aaf0[0x0];let _0x5513f3,_0x388608=_0x2a9676;if(_0x2a9676&&_0x2a9676[_0x37c370(0x171)]('/')){const _0x29b298=_0x2a9676[_0x37c370(0x13c)]('/');if(_0x29b298[_0x37c370(0x154)]===0x2){const [_0x9ab593,_0x46e28e]=_0x29b298,_0xce5382=await _0x54f62e[_0x37c370(0x19c)][_0x37c370(0x146)](),_0x25eb0f=_0xce5382['find'](_0x276811=>_0x276811[_0x37c370(0x190)][_0x37c370(0x17d)][_0x37c370(0x125)]()===_0x9ab593[_0x37c370(0x125)]());if(!_0x25eb0f)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x37c370(0x12b)+_0x9ab593,undefined,{'helpText':_0x37c370(0x141)});_0x5513f3=_0x25eb0f['id'],_0x388608=_0x46e28e;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0x2a9676,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x5513f3=await getProjectIdOrDefault(_0x46673d);const _0x2b13b0=await withSpinner(_0x37c370(0x177),()=>_0x54f62e[_0x37c370(0x19c)]['agents'](_0x5513f3),{'verbose':_0x3beae3['verbose']});let _0x1ede30=_0x2b13b0[_0x37c370(0x143)];_0x388608&&(_0x1ede30=_0x2b13b0[_0x37c370(0x143)][_0x37c370(0x1b2)](_0x4ba450=>matchGlobPattern(_0x4ba450[_0x37c370(0x190)][_0x37c370(0x17d)],_0x388608)));const _0xb0d878=_0x1ede30['map'](toAgentInfo);return await handleSDKOutput(_0xb0d878,_0x3beae3),0x0;}catch(_0x15474c){return handleSDKError(_0x15474c,_0x3beae3),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:agent:show';['description']=a24_0x1b217f(0x179);async[a24_0x1b217f(0x1d4)](_0x492330){const _0x500b09=a24_0x1b217f,{options:_0x5c11d0,args:_0x1db428,tdx:_0x357c5c}=_0x492330;if(_0x1db428[_0x500b09(0x154)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x500b09(0x155)),0x1;const _0x6b5f=_0x1db428[0x0];try{const _0x1ac130=await getProjectIdOrDefault(_0x492330),_0x4adad7=await withSpinner(_0x500b09(0x19a)+_0x6b5f+_0x500b09(0x1cd),()=>_0x357c5c['llm'][_0x500b09(0x17f)](_0x6b5f,_0x1ac130),{'verbose':_0x5c11d0[_0x500b09(0x114)]}),_0x3e320f=await withSpinner(_0x500b09(0x1a7),()=>_0x357c5c[_0x500b09(0x19c)][_0x500b09(0x110)](_0x4adad7['data']),{'verbose':_0x5c11d0[_0x500b09(0x114)]});return await handleSDKOutput([_0x3e320f[_0x500b09(0x143)]],_0x5c11d0),0x0;}catch(_0x330964){return handleSDKError(_0x330964,_0x5c11d0),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x121);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x123);async[a24_0x1b217f(0x1d4)](_0x2d2fe0){const _0x555217=a24_0x1b217f,{options:_0x4497d7,args:_0x7c888,tdx:_0x34181f}=_0x2d2fe0;if(_0x7c888[_0x555217(0x154)]===0x0)return console['error'](_0x555217(0x15f)),console[_0x555217(0x1a2)](_0x555217(0x1ab)),console['error'](_0x555217(0x18d)),0x1;const _0x657158=_0x7c888[0x0],_0x54e39e=_0x4497d7,_0x3debbb=_0x54e39e[_0x555217(0x17c)],_0x4ae12c=_0x54e39e['model']||_0x555217(0x13e),_0x246efa=_0x54e39e[_0x555217(0x14c)],_0x324fd4=_0x54e39e['maxToolIterations']?Number(_0x54e39e[_0x555217(0x1b0)]):undefined,_0x14abd3=_0x54e39e[_0x555217(0x1c2)]?Number(_0x54e39e[_0x555217(0x1c2)]):undefined;try{let _0x21d902,_0x5a2258;if(_0x657158[_0x555217(0x171)]('/')){const _0xabf671=_0x657158[_0x555217(0x13c)]('/');if(_0xabf671[_0x555217(0x154)]===0x2){const [_0x552b6d,_0x21e2de]=_0xabf671,_0x3253ac=await withSpinner(_0x555217(0x1a5)+_0x552b6d+_0x555217(0x1cd),()=>_0x34181f[_0x555217(0x19c)][_0x555217(0x191)](_0x552b6d),{'verbose':_0x4497d7['verbose']});_0x21d902=_0x3253ac[_0x555217(0x143)],_0x5a2258=_0x21e2de;}else throw new SDKError(ErrorCode[_0x555217(0x15a)],_0x555217(0x195)+_0x657158,undefined,{'helpText':_0x555217(0x168)});}else _0x21d902=await getProjectIdOrDefault(_0x2d2fe0),_0x5a2258=_0x657158;const _0x45f7f1=await withSpinner(_0x555217(0x11d)+_0x5a2258+'\x27...',()=>_0x34181f['llm'][_0x555217(0x1ad)]({'name':_0x5a2258,'projectId':_0x21d902,'modelType':_0x4ae12c,'systemPrompt':_0x3debbb,'starterMessage':_0x246efa,'maxToolIterations':_0x324fd4,'temperature':_0x14abd3}),{'verbose':_0x4497d7[_0x555217(0x114)]});return console[_0x555217(0x1b4)](_0x555217(0x10f)+_0x45f7f1[_0x555217(0x143)]['id']),await handleSDKOutput([_0x45f7f1[_0x555217(0x143)]],_0x4497d7),0x0;}catch(_0x573eef){return handleSDKError(_0x573eef,_0x4497d7),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x128);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x12f);async[a24_0x1b217f(0x1d4)](_0x524bfe){const _0x14dcff=a24_0x1b217f,{options:_0x440bf0,args:_0x5f17a0,tdx:_0x393d9f}=_0x524bfe;if(_0x5f17a0[_0x14dcff(0x154)]===0x0)return console[_0x14dcff(0x1a2)](_0x14dcff(0x15f)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x388795=_0x5f17a0[0x0],_0x53ae99=_0x440bf0,_0x2d1c30=_0x53ae99[_0x14dcff(0x17d)],_0x26ad8b=_0x53ae99[_0x14dcff(0x16c)],_0x382822=_0x53ae99[_0x14dcff(0x139)],_0x324eaa=_0x53ae99[_0x14dcff(0x14c)];if(!_0x2d1c30&&!_0x26ad8b&&!_0x382822&&!_0x324eaa)return console[_0x14dcff(0x1a2)](_0x14dcff(0x1c1)),console[_0x14dcff(0x1a2)](_0x14dcff(0x16d)),0x1;try{const _0x5b9fa2=await getProjectIdOrDefault(_0x524bfe),_0x47a0e2=await withSpinner(_0x14dcff(0x19a)+_0x388795+'\x27...',()=>_0x393d9f[_0x14dcff(0x19c)]['resolveAgentId'](_0x388795,_0x5b9fa2),{'verbose':_0x440bf0[_0x14dcff(0x114)]}),_0x2295a2=_0x47a0e2[_0x14dcff(0x143)],_0x4998f3=await withSpinner(_0x14dcff(0x1a1),()=>_0x393d9f[_0x14dcff(0x19c)][_0x14dcff(0x149)](_0x2295a2,{'name':_0x2d1c30,'prompt':_0x26ad8b,'description':_0x382822,'starterMessage':_0x324eaa}),{'verbose':_0x440bf0[_0x14dcff(0x114)]});return console[_0x14dcff(0x1b4)](_0x14dcff(0x1d2)+_0x4998f3[_0x14dcff(0x143)]['id']),await handleSDKOutput([_0x4998f3[_0x14dcff(0x143)]],_0x440bf0),0x0;}catch(_0x408b47){return handleSDKError(_0x408b47,_0x440bf0),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:agent:delete';[a24_0x1b217f(0x139)]=a24_0x1b217f(0x134);async[a24_0x1b217f(0x1d4)](_0x156b08){const _0x6b9ea3=a24_0x1b217f,{options:_0x189044,args:_0x6ce1e6,tdx:_0x36a168}=_0x156b08;if(_0x6ce1e6['length']===0x0)return console[_0x6b9ea3(0x1a2)](_0x6b9ea3(0x15f)),console[_0x6b9ea3(0x1a2)](_0x6b9ea3(0x14d)),0x1;const _0xf9aebd=_0x6ce1e6[0x0];try{const _0x49cb76=await getProjectIdOrDefault(_0x156b08),_0xcf52e=await withSpinner('Resolving\x20agent\x20\x27'+_0xf9aebd+_0x6b9ea3(0x1cd),()=>_0x36a168[_0x6b9ea3(0x19c)][_0x6b9ea3(0x17f)](_0xf9aebd,_0x49cb76),{'verbose':_0x189044[_0x6b9ea3(0x114)]}),_0x475159=_0xcf52e['data'];return await withSpinner('Deleting\x20agent...',()=>_0x36a168['llm'][_0x6b9ea3(0x199)](_0x475159),{'verbose':_0x189044[_0x6b9ea3(0x114)]}),console['log'](_0x6b9ea3(0x159)+_0x475159),0x0;}catch(_0x2796b9){return handleSDKError(_0x2796b9,_0x189044),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a24_0x1b217f(0x1be);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x1c5);async[a24_0x1b217f(0x1d4)](_0x493a79){const _0x436965=a24_0x1b217f;return executeChatHistoryCommand(_0x493a79,_0x436965(0x12c));}}export class LLMUseCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:use';[a24_0x1b217f(0x139)]='Set\x20current\x20project\x20context';async[a24_0x1b217f(0x1d4)](_0x1b8a5c){const _0xc23493=a24_0x1b217f,{options:_0x5ba032,args:_0x1f0350,tdx:_0xea41cc}=_0x1b8a5c;if(_0x1f0350[_0xc23493(0x154)]===0x0)return console['error'](_0xc23493(0x18e)),console[_0xc23493(0x1a2)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x86877b=_0x1f0350[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x86877b+_0xc23493(0x1cd),()=>_0xea41cc[_0xc23493(0x19c)]['setCurrentProject'](_0x86877b),{'verbose':_0x5ba032['verbose']}),console['log'](_0xc23493(0x1aa)+_0x86877b),0x0;}catch(_0x345fde){return handleSDKError(_0x345fde,_0x5ba032),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:project:create';[a24_0x1b217f(0x139)]=a24_0x1b217f(0x1b7);async[a24_0x1b217f(0x1d4)](_0x178df4){const _0x12cd3a=a24_0x1b217f,{options:_0x4c40fc,args:_0x3e31fc,tdx:_0x3c2757}=_0x178df4;if(_0x3e31fc[_0x12cd3a(0x154)]===0x0)return console[_0x12cd3a(0x1a2)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x12cd3a(0x1a2)](_0x12cd3a(0x144)),0x1;const _0x3e7365=_0x3e31fc[0x0],_0x1c526b=_0x4c40fc,_0x256a92=_0x1c526b[_0x12cd3a(0x139)];try{const _0x5221f0=await withSpinner(_0x12cd3a(0x1c3)+_0x3e7365+_0x12cd3a(0x1cd),()=>_0x3c2757[_0x12cd3a(0x19c)][_0x12cd3a(0x198)]({'name':_0x3e7365,'description':_0x256a92}),{'verbose':_0x4c40fc[_0x12cd3a(0x114)]});console[_0x12cd3a(0x1b4)](_0x12cd3a(0x132)+_0x5221f0[_0x12cd3a(0x143)]['id']);const _0x358428=toLLMProjectInfo(_0x5221f0[_0x12cd3a(0x143)]);return await handleSDKOutput([_0x358428],_0x4c40fc),0x0;}catch(_0x52d980){return handleSDKError(_0x52d980,_0x4c40fc),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x10d);[a24_0x1b217f(0x139)]='Delete\x20an\x20LLM\x20project';async[a24_0x1b217f(0x1d4)](_0x18c92d){const _0x383a0e=a24_0x1b217f,{options:_0x55ad12,args:_0x427c70,tdx:_0x15512b}=_0x18c92d;if(_0x427c70[_0x383a0e(0x154)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x383a0e(0x1a2)](_0x383a0e(0x1cf)),0x1;const _0x24fed7=_0x427c70[0x0];try{return await withSpinner(_0x383a0e(0x130)+_0x24fed7+'\x27...',()=>_0x15512b[_0x383a0e(0x19c)][_0x383a0e(0x11c)](_0x24fed7),{'verbose':_0x55ad12[_0x383a0e(0x114)]}),console[_0x383a0e(0x1b4)]('Project\x20deleted:\x20'+_0x24fed7),0x0;}catch(_0x2a3680){return handleSDKError(_0x2a3680,_0x55ad12),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:project:backup';[a24_0x1b217f(0x139)]=a24_0x1b217f(0x160);async['execute'](_0x330bf9){const _0x2d690e=a24_0x1b217f,{options:_0x5b5496,args:_0x32f1ec,tdx:_0x2543a0}=_0x330bf9;if(_0x32f1ec[_0x2d690e(0x154)]===0x0)return console['error'](_0x2d690e(0x18e)),console['error'](_0x2d690e(0x14f)),0x1;const _0x34d69d=_0x32f1ec[0x0],_0x3806c9=_0x5b5496,_0x11b5e0=_0x3806c9[_0x2d690e(0x1c6)],_0x49b956=_0x3806c9['dryRun'];try{const _0x2b0691=_0x11b5e0||_0x34d69d+_0x2d690e(0x118);if(a24_0x1cf23b[_0x2d690e(0x1a9)](_0x2b0691)&&!_0x49b956){if(!_0x5b5496[_0x2d690e(0x1af)]){const _0x2d047a=await confirm(_0x2d690e(0x124)+_0x2b0691+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x2d047a)return console[_0x2d690e(0x1b4)](_0x2d690e(0x12a)),0x0;}a24_0x1cf23b[_0x2d690e(0x1c4)](_0x2b0691,{'recursive':!![]});}const _0x22446d=await withSpinner(_0x49b956?_0x2d690e(0x1bd)+_0x34d69d+_0x2d690e(0x1cd):_0x2d690e(0x137)+_0x34d69d+'\x27...',()=>_0x2543a0['llm']['backupProject'](_0x34d69d,_0x11b5e0,{'dryRun':_0x49b956}),{'verbose':_0x5b5496['verbose']}),_0x5e40ed=_0x22446d[_0x2d690e(0x143)];return _0x49b956?console['log'](_0x2d690e(0x145)+_0x5e40ed['outputDir']):console[_0x2d690e(0x1b4)]('Project\x20backed\x20up\x20to:\x20'+_0x5e40ed[_0x2d690e(0x12e)]),console[_0x2d690e(0x1b4)](_0x2d690e(0x1d9)+_0x5e40ed['counts'][_0x2d690e(0x1d3)]),console[_0x2d690e(0x1b4)]('\x20\x20Knowledge\x20Bases:\x20'+_0x5e40ed[_0x2d690e(0x1a4)][_0x2d690e(0x11a)]),console[_0x2d690e(0x1b4)]('\x20\x20Prompts:\x20'+_0x5e40ed[_0x2d690e(0x1a4)][_0x2d690e(0x1b9)]),console['log'](_0x2d690e(0x158)+_0x5e40ed['counts'][_0x2d690e(0x15e)]),(_0x5b5496[_0x2d690e(0x1dc)]==='json'||_0x5b5496[_0x2d690e(0x1dc)]===_0x2d690e(0x126))&&await handleSDKOutput([_0x5e40ed],_0x5b5496),0x0;}catch(_0x421172){return handleSDKError(_0x421172,_0x5b5496),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x184);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x127);async[a24_0x1b217f(0x1d4)](_0x23e057){const _0x1fbd4d=a24_0x1b217f,{options:_0x1d9cd5,args:_0x3831d4,tdx:_0x3cac6d}=_0x23e057;if(_0x3831d4[_0x1fbd4d(0x154)]===0x0)return console[_0x1fbd4d(0x1a2)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x1fbd4d(0x1a2)](_0x1fbd4d(0x185)),0x1;const _0x1aa623=_0x3831d4[0x0],_0x1df271=_0x1d9cd5,_0x1d1b28=_0x1df271[_0x1fbd4d(0x17d)],_0x344d7f=_0x1df271[_0x1fbd4d(0x1a6)];try{if(!_0x344d7f){const _0x54ae11=_0x3cac6d[_0x1fbd4d(0x19c)][_0x1fbd4d(0x1c7)](_0x1aa623),_0x441f1d=_0x1d1b28||_0x54ae11[_0x1fbd4d(0x1a8)][_0x1fbd4d(0x187)],_0x410649=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x3cac6d[_0x1fbd4d(0x19c)][_0x1fbd4d(0x146)](),{'verbose':_0x1d9cd5[_0x1fbd4d(0x114)]}),_0x2389ba=_0x410649[_0x1fbd4d(0x143)][_0x1fbd4d(0x11b)](_0x240d30=>_0x240d30['attributes'][_0x1fbd4d(0x17d)]===_0x441f1d);if(_0x2389ba&&!_0x1d9cd5[_0x1fbd4d(0x1af)]){const _0x10c53c=await confirm('A\x20project\x20named\x20\x27'+_0x441f1d+_0x1fbd4d(0x19d));if(!_0x10c53c)return console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x16b)),0x0;}}const _0x31c951=await withSpinner(_0x344d7f?_0x1fbd4d(0x1b5)+_0x1aa623+_0x1fbd4d(0x1cd):_0x1fbd4d(0x16a)+_0x1aa623+_0x1fbd4d(0x1cd),()=>_0x3cac6d[_0x1fbd4d(0x19c)][_0x1fbd4d(0x175)](_0x1aa623,{'name':_0x1d1b28,'dryRun':_0x344d7f}),{'verbose':_0x1d9cd5[_0x1fbd4d(0x114)]}),_0x457058=_0x31c951['data'];return _0x457058[_0x1fbd4d(0x19b)]&&console['log'](_0x1fbd4d(0x17e)+_0x457058[_0x1fbd4d(0x19b)]+'\x27'),_0x344d7f?console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x18c)+_0x457058['projectName']):console['log'](_0x1fbd4d(0x140)+_0x457058[_0x1fbd4d(0x187)]+'\x20('+_0x457058[_0x1fbd4d(0x1ae)]+')'),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x1d9)+_0x457058[_0x1fbd4d(0x1a4)][_0x1fbd4d(0x1d3)]),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x1da)+_0x457058[_0x1fbd4d(0x1a4)][_0x1fbd4d(0x11a)]),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x153)+_0x457058[_0x1fbd4d(0x1a4)][_0x1fbd4d(0x1b9)]),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x158)+_0x457058[_0x1fbd4d(0x1a4)]['integrations']),(_0x1d9cd5[_0x1fbd4d(0x1dc)]===_0x1fbd4d(0x182)||_0x1d9cd5[_0x1fbd4d(0x1dc)]==='jsonl')&&await handleSDKOutput([_0x457058],_0x1d9cd5),0x0;}catch(_0x54839e){return handleSDKError(_0x54839e,_0x1d9cd5),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x3bf3a9,_0xdfcb3){const _0x25d6f8=a24_0x1b217f,_0x385e2a=_0xdfcb3[_0x25d6f8(0x17b)]||CHAT_SELECTOR_PAGE_SIZE;let _0x1ce115=0x0,_0x2542e8=[];const _0x591125=(await import('prompts'))['default'],_0x438c9d=getChalk(_0xdfcb3);while(!![]){const _0x3e4682=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x3bf3a9[_0x25d6f8(0x19c)][_0x25d6f8(0x1c8)](_0x385e2a+_0x1ce115),{'verbose':_0xdfcb3['verbose']});_0x2542e8=_0x3e4682[_0x25d6f8(0x143)];const _0x35b408=_0x2542e8[_0x25d6f8(0x15c)](_0x1ce115,_0x1ce115+_0x385e2a),_0x5271c7=_0x2542e8[_0x25d6f8(0x154)]>_0x1ce115+_0x385e2a,_0x275b9d=[...new Set(_0x35b408['map'](_0x1dff23=>_0x1dff23['attributes'][_0x25d6f8(0x113)])[_0x25d6f8(0x1b2)](_0x361e95=>_0x361e95!==undefined))],_0xf81af4=new Map();await Promise[_0x25d6f8(0x1d8)](_0x275b9d['map'](async _0x27f129=>{const _0xe7bec0=_0x25d6f8;try{const _0x576ad7=await _0x3bf3a9[_0xe7bec0(0x19c)]['agent'](_0x27f129);_0xf81af4['set'](_0x27f129,_0x576ad7[_0xe7bec0(0x190)][_0xe7bec0(0x17d)]);}catch{_0xf81af4[_0xe7bec0(0x15d)](_0x27f129,_0x27f129);}}));const _0x37c8f2=_0x35b408['map'](_0xd413d6=>{const _0x5c5636=_0x25d6f8,_0x28716d=_0xd413d6['attributes']['firstInputContent']||_0x5c5636(0x1ca),_0x2519d9=_0x28716d[_0x5c5636(0x13c)]('\x0a')[0x0],_0x1a6fd7=_0x2519d9[_0x5c5636(0x154)]>0x50?_0x2519d9[_0x5c5636(0x1b1)](0x0,0x4d)+_0x5c5636(0x1b8):_0x2519d9,_0x12bc2b=_0xd413d6[_0x5c5636(0x190)][_0x5c5636(0x113)]?_0xf81af4[_0x5c5636(0x172)](_0xd413d6['attributes'][_0x5c5636(0x113)])||_0xd413d6[_0x5c5636(0x190)]['agentId']:'(no\x20agent)',_0x4abbdf=_0xd413d6[_0x5c5636(0x190)]['lastConversationAt']||_0xd413d6[_0x5c5636(0x190)][_0x5c5636(0x1ba)],_0x2e05ac=new Date(_0x4abbdf),_0x2cef03=new Date(),_0x2152d8=_0x2cef03[_0x5c5636(0x161)]()-_0x2e05ac[_0x5c5636(0x161)](),_0x20c114=Math[_0x5c5636(0x151)](_0x2152d8/0xea60),_0x13ba45=Math['floor'](_0x2152d8/0x36ee80),_0x506309=Math['floor'](_0x2152d8/0x5265c00);let _0x443674;if(_0x20c114<0x1)_0x443674=_0x5c5636(0x188);else{if(_0x20c114<0x3c)_0x443674=_0x20c114+_0x5c5636(0x1dd);else{if(_0x13ba45<0x18)_0x443674=_0x13ba45+_0x5c5636(0x1c9);else _0x506309<0x7?_0x443674=_0x506309+_0x5c5636(0x186):_0x443674=_0x2e05ac[_0x5c5636(0x133)](_0x5c5636(0x1ce),{'month':_0x5c5636(0x120),'day':_0x5c5636(0x157)});}}return{'title':_0x1a6fd7+'\x20'+_0x438c9d['dim']('['+_0x12bc2b+']\x20'+_0x443674),'value':_0xd413d6['id']};});_0x5271c7&&_0x37c8f2['push']({'title':_0x438c9d[_0x25d6f8(0x116)](_0x25d6f8(0x142)),'value':'__load_more__'});const _0x335593=await _0x591125({'type':'select','name':_0x25d6f8(0x119),'message':_0x25d6f8(0x19e),'choices':_0x37c8f2,'hint':_0x25d6f8(0x115)});if(!_0x335593['chatId'])return undefined;if(_0x335593[_0x25d6f8(0x119)]===_0x25d6f8(0x174)){_0x1ce115+=_0x385e2a;continue;}return _0x335593[_0x25d6f8(0x119)];}}export class ChatsCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x1c8);[a24_0x1b217f(0x139)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a24_0x1b217f(0x1d4)](_0x2d669c){const _0x30abdd=a24_0x1b217f;return executeChatHistoryCommand(_0x2d669c,_0x30abdd(0x173));}}
@@ -1 +1 @@
1
- const a25_0x4972da=a25_0x587d;(function(_0x17b423,_0x5446fe){const _0x394c23=a25_0x587d,_0x25b340=_0x17b423();while(!![]){try{const _0xad79e5=parseInt(_0x394c23(0xf6))/0x1+-parseInt(_0x394c23(0xeb))/0x2+-parseInt(_0x394c23(0xe3))/0x3+parseInt(_0x394c23(0xd7))/0x4*(parseInt(_0x394c23(0xd6))/0x5)+parseInt(_0x394c23(0xef))/0x6*(parseInt(_0x394c23(0xff))/0x7)+-parseInt(_0x394c23(0x103))/0x8*(-parseInt(_0x394c23(0xe2))/0x9)+-parseInt(_0x394c23(0xd5))/0xa*(-parseInt(_0x394c23(0xfe))/0xb);if(_0xad79e5===_0x5446fe)break;else _0x25b340['push'](_0x25b340['shift']());}catch(_0x3ce12b){_0x25b340['push'](_0x25b340['shift']());}}}(a25_0x883f,0x1c03a));import a25_0x4fd856 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a25_0x587d(_0x44273b,_0x3ac9ba){const _0x883f7a=a25_0x883f();return a25_0x587d=function(_0x587db4,_0x3879e2){_0x587db4=_0x587db4-0xc5;let _0x53f6b9=_0x883f7a[_0x587db4];return _0x53f6b9;},a25_0x587d(_0x44273b,_0x3ac9ba);}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x515e45,_0xa8c506){const _0x436262=a25_0x587d,{tdx:_0x2b68d1,options:_0x29bc3f}=_0x515e45,_0x56a036=_0xa8c506||_0x29bc3f[_0x436262(0xc8)];if(_0x56a036){const _0x4cfcd2=await _0x2b68d1['llm'][_0x436262(0xe8)](),_0x1dda9b=_0x4cfcd2[_0x436262(0x102)](_0x3863ab=>_0x3863ab[_0x436262(0xe6)][_0x436262(0xcb)]===_0x56a036);if(!_0x1dda9b)throw new SDKError(ErrorCode[_0x436262(0xde)],_0x436262(0xe0)+_0x56a036+_0x436262(0xf5),undefined,{'helpText':_0x436262(0xf0)});return _0x1dda9b['id'];}const _0x4e7038=await _0x2b68d1[_0x436262(0xd8)][_0x436262(0xd3)]();return _0x4e7038['id'];}export class LLMProxyCommand extends BaseCommand{[a25_0x4972da(0xcb)]=a25_0x4972da(0xd0);[a25_0x4972da(0xed)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a25_0x4972da(0xd9)];[a25_0x4972da(0xd1)];async['execute'](_0x392a4c){const _0x167118=a25_0x4972da,{tdx:_0x200c71,options:_0xbbf82}=_0x392a4c;try{const _0x4ed3ca=_0xbbf82,_0x25e017=_0x4ed3ca[_0x167118(0xdb)]||0xfa0,_0x489853=_0x4ed3ca[_0x167118(0xda)],_0x478095=await findAvailablePort(_0x25e017);console['log'](a25_0x4fd856[_0x167118(0xdf)]('Resolving\x20project...'));const _0x55db50=await getProjectIdOrDefault(_0x392a4c,_0x489853),_0x4a8c7a=await _0x200c71[_0x167118(0xd8)][_0x167118(0xe8)](),_0xb3e828=_0x4a8c7a[_0x167118(0x102)](_0x3b8c79=>_0x3b8c79['id']===_0x55db50);this[_0x167118(0xd1)]=new TDXLogger(_0xbbf82[_0x167118(0xf7)]),await this[_0x167118(0xd1)]['init'](),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xdf)](_0x167118(0xfd)));_0x478095!==_0x25e017&&console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc9)](_0x167118(0xcf)+_0x25e017+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x478095));this[_0x167118(0xd9)]=new ProxyServer({'port':_0x478095,'projectId':_0x55db50,'tdx':_0x200c71,'logger':this[_0x167118(0xd1)],'site':_0xbbf82[_0x167118(0x100)]}),await this[_0x167118(0xd9)][_0x167118(0xe7)](),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc9)][_0x167118(0xfa)](_0x167118(0xc6))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc9)]('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc9)](_0x167118(0xf8))),console['log'](a25_0x4fd856[_0x167118(0xe4)]['bold'](_0x167118(0xdd))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xe5)](_0x167118(0xec))),console[_0x167118(0xce)](a25_0x4fd856['dim'](_0x167118(0xf1)),a25_0x4fd856[_0x167118(0xc5)]('http://0.0.0.0:'+_0x478095)),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xdf)]('\x20\x20Project:'),a25_0x4fd856[_0x167118(0xc5)](_0xb3e828?.[_0x167118(0xe6)][_0x167118(0xcb)]||_0x55db50)),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xdf)](_0x167118(0xcd)),a25_0x4fd856[_0x167118(0xc5)](_0x167118(0xee))),console[_0x167118(0xce)](a25_0x4fd856['dim'](_0x167118(0xf9)),a25_0x4fd856[_0x167118(0xc5)](_0xbbf82[_0x167118(0x100)])),console['log'](a25_0x4fd856[_0x167118(0xe5)]('\x0aClaude\x20Code\x20Configuration:')),console[_0x167118(0xce)](a25_0x4fd856['dim'](_0x167118(0xcc))),console['log'](a25_0x4fd856[_0x167118(0xc5)](_0x167118(0xc7))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc5)](_0x167118(0xfb))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc5)](_0x167118(0x104)+_0x478095+'\x22,')),console['log'](a25_0x4fd856[_0x167118(0xc5)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22')),console['log'](a25_0x4fd856[_0x167118(0xc5)](_0x167118(0xfc))),console[_0x167118(0xce)](a25_0x4fd856['white']('\x20\x20}')),console['log'](a25_0x4fd856[_0x167118(0xe5)](_0x167118(0xf3))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xdf)](_0x167118(0xea))),console['log'](a25_0x4fd856['dim'](_0x167118(0xe9))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xdf)](_0x167118(0x101))),console[_0x167118(0xce)](a25_0x4fd856[_0x167118(0xc9)](_0x167118(0xf2)));const _0x428b0a=async()=>{const _0x124924=_0x167118;console['log'](a25_0x4fd856[_0x124924(0xdf)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this['server']&&await this[_0x124924(0xd9)][_0x124924(0xd2)](),this[_0x124924(0xd1)]&&await this['logger'][_0x124924(0xd4)](),console['log'](a25_0x4fd856['green'](_0x124924(0xdc))),process[_0x124924(0xf4)](0x0);};return process['on'](_0x167118(0xe1),_0x428b0a),process['on'](_0x167118(0xca),_0x428b0a),await new Promise(()=>{}),0x0;}catch(_0x3251e9){this[_0x167118(0xd9)]&&await this[_0x167118(0xd9)]['stop']();this[_0x167118(0xd1)]&&await this['logger'][_0x167118(0xd4)]();throw _0x3251e9;}}}function a25_0x883f(){const _0x32beea=['white','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20{','llmProject','yellow','SIGTERM','name','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20Agents:','log','Port\x20','llm:proxy','logger','stop','getOrCreateDefaultProject','close','10tsJSSd','50HJZpsw','29764DIySFh','llm','server','project','port','✓\x20Proxy\x20server\x20stopped','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','NOT_FOUND','dim','Project\x20\x27','SIGINT','729369DsNYhI','100140ZtUiYI','green','cyan','attributes','start','projects','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','321680VucQQn','Server\x20Configuration:','description','created\x20on-demand\x20per\x20model','30aruxEZ','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20Address:','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x0aTesting\x20with\x20Agent\x20SDK:','exit','\x27\x20not\x20found','77558cxXFDj','logLevel','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x20\x20Site:','bold','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20\x20\x20}','Starting\x20proxy\x20server...','61237UHuUdw','98546CZucEB','site','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','find','8gkorni','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'];a25_0x883f=function(){return _0x32beea;};return a25_0x883f();}
1
+ const a25_0x14ac7=a25_0x5e1a;function a25_0x5e1a(_0x3dde25,_0x4db083){const _0x345e3c=a25_0x345e();return a25_0x5e1a=function(_0x5e1a8e,_0x5b5e43){_0x5e1a8e=_0x5e1a8e-0xf9;let _0x41f22c=_0x345e3c[_0x5e1a8e];return _0x41f22c;},a25_0x5e1a(_0x3dde25,_0x4db083);}(function(_0x2d4aa8,_0x12569a){const _0x46bfb0=a25_0x5e1a,_0x39c431=_0x2d4aa8();while(!![]){try{const _0x56747b=-parseInt(_0x46bfb0(0x118))/0x1+parseInt(_0x46bfb0(0x12c))/0x2*(parseInt(_0x46bfb0(0x124))/0x3)+parseInt(_0x46bfb0(0xff))/0x4+parseInt(_0x46bfb0(0x12f))/0x5*(parseInt(_0x46bfb0(0x11b))/0x6)+parseInt(_0x46bfb0(0x12b))/0x7*(parseInt(_0x46bfb0(0x100))/0x8)+parseInt(_0x46bfb0(0x133))/0x9*(-parseInt(_0x46bfb0(0x109))/0xa)+-parseInt(_0x46bfb0(0x115))/0xb;if(_0x56747b===_0x12569a)break;else _0x39c431['push'](_0x39c431['shift']());}catch(_0x3c5c56){_0x39c431['push'](_0x39c431['shift']());}}}(a25_0x345e,0xd3673));import a25_0x2f3ad9 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';function a25_0x345e(){const _0x1d5c9a=['[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','attributes','logger','NOT_FOUND','init','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','server','14243427vqNBzj','\x0aTesting\x20with\x20Agent\x20SDK:','execute','161977zeoaSP','\x20\x20Project:','Starting\x20proxy\x20server...','7038114sRZGgm','bold','llm:proxy','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','name','getOrCreateDefaultProject','\x20\x20\x20\x20\x22env\x22:\x20{','yellow','756261zEObun','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22','✓\x20Proxy\x20server\x20stopped','\x0a\x0aShutting\x20down\x20proxy\x20server...','llmProject','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','site','682717igFpCr','4QxWFOH','\x20\x20Agents:','dim','5nWYwpx','close','\x20\x20Address:','cyan','1953jqzxVU','\x20\x20{','Server\x20Configuration:','SIGINT','log','stop','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x0aClaude\x20Code\x20Configuration:','\x27\x20not\x20found','green','llm','2969908hhPsfX','112igKKYD','white','logLevel','http://0.0.0.0:','port','\x20is\x20unavailable,\x20using\x20port\x20','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20}','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','67390oEHKzU','description','SIGTERM','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','find'];a25_0x345e=function(){return _0x1d5c9a;};return a25_0x345e();}async function getProjectIdOrDefault(_0x1426bb,_0x5ecb5f){const _0x2cac4c=a25_0x5e1a,{tdx:_0x3aeaba,options:_0xdd971}=_0x1426bb,_0x665db2=_0x5ecb5f||_0xdd971[_0x2cac4c(0x128)];if(_0x665db2){const _0x90014d=await _0x3aeaba[_0x2cac4c(0xfe)]['projects'](),_0xa8f860=_0x90014d[_0x2cac4c(0x10d)](_0x31031e=>_0x31031e[_0x2cac4c(0x10f)][_0x2cac4c(0x120)]===_0x665db2);if(!_0xa8f860)throw new SDKError(ErrorCode[_0x2cac4c(0x111)],'Project\x20\x27'+_0x665db2+_0x2cac4c(0xfc),undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0xa8f860['id'];}const _0x58b9c3=await _0x3aeaba[_0x2cac4c(0xfe)][_0x2cac4c(0x121)]();return _0x58b9c3['id'];}export class LLMProxyCommand extends BaseCommand{[a25_0x14ac7(0x120)]=a25_0x14ac7(0x11d);[a25_0x14ac7(0x10a)]=a25_0x14ac7(0x10e);[a25_0x14ac7(0x114)];['logger'];async[a25_0x14ac7(0x117)](_0x57fe53){const _0x1fceba=a25_0x14ac7,{tdx:_0x2e5815,options:_0x3ebafd}=_0x57fe53;try{const _0x2b9e6e=_0x3ebafd,_0x34c598=_0x2b9e6e[_0x1fceba(0x104)]||0xfa0,_0x18ddd1=_0x2b9e6e['project'],_0x2b00cd=await findAvailablePort(_0x34c598);console['log'](a25_0x2f3ad9[_0x1fceba(0x12e)]('Resolving\x20project...'));const _0x5944a0=await getProjectIdOrDefault(_0x57fe53,_0x18ddd1),_0x84dec3=await _0x2e5815['llm']['projects'](),_0x22dd53=_0x84dec3[_0x1fceba(0x10d)](_0xd5fe72=>_0xd5fe72['id']===_0x5944a0);this[_0x1fceba(0x110)]=new TDXLogger(_0x3ebafd[_0x1fceba(0x102)]),await this[_0x1fceba(0x110)][_0x1fceba(0x112)](),console['log'](a25_0x2f3ad9['dim'](_0x1fceba(0x11a)));_0x2b00cd!==_0x34c598&&console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)]('Port\x20'+_0x34c598+_0x1fceba(0x105)+_0x2b00cd));this[_0x1fceba(0x114)]=new ProxyServer({'port':_0x2b00cd,'projectId':_0x5944a0,'tdx':_0x2e5815,'logger':this[_0x1fceba(0x110)],'site':_0x3ebafd[_0x1fceba(0x12a)]}),await this[_0x1fceba(0x114)]['start'](),console['log'](a25_0x2f3ad9[_0x1fceba(0x123)][_0x1fceba(0x11c)](_0x1fceba(0x106))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)](_0x1fceba(0x113))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)](_0x1fceba(0xfa))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0xfd)][_0x1fceba(0x11c)](_0x1fceba(0x129))),console['log'](a25_0x2f3ad9[_0x1fceba(0x132)](_0x1fceba(0x135))),console['log'](a25_0x2f3ad9['dim'](_0x1fceba(0x131)),a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x103)+_0x2b00cd)),console['log'](a25_0x2f3ad9['dim'](_0x1fceba(0x119)),a25_0x2f3ad9['white'](_0x22dd53?.[_0x1fceba(0x10f)][_0x1fceba(0x120)]||_0x5944a0)),console[_0x1fceba(0x137)](a25_0x2f3ad9['dim'](_0x1fceba(0x12d)),a25_0x2f3ad9[_0x1fceba(0x101)]('created\x20on-demand\x20per\x20model')),console['log'](a25_0x2f3ad9[_0x1fceba(0x12e)]('\x20\x20Site:'),a25_0x2f3ad9[_0x1fceba(0x101)](_0x3ebafd[_0x1fceba(0x12a)])),console['log'](a25_0x2f3ad9[_0x1fceba(0x132)](_0x1fceba(0xfb))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x12e)](_0x1fceba(0x108))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x134))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x122))),console[_0x1fceba(0x137)](a25_0x2f3ad9['white'](_0x1fceba(0x11f)+_0x2b00cd+'\x22,')),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x125))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)]('\x20\x20\x20\x20}')),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x107))),console[_0x1fceba(0x137)](a25_0x2f3ad9['cyan'](_0x1fceba(0x116))),console[_0x1fceba(0x137)](a25_0x2f3ad9['dim'](_0x1fceba(0x10c))),console[_0x1fceba(0x137)](a25_0x2f3ad9['dim']('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console['log'](a25_0x2f3ad9[_0x1fceba(0x12e)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)](_0x1fceba(0x11e)));const _0x16ac63=async()=>{const _0x30dbba=_0x1fceba;console[_0x30dbba(0x137)](a25_0x2f3ad9[_0x30dbba(0x12e)](_0x30dbba(0x127))),this[_0x30dbba(0x114)]&&await this['server'][_0x30dbba(0xf9)](),this['logger']&&await this[_0x30dbba(0x110)][_0x30dbba(0x130)](),console[_0x30dbba(0x137)](a25_0x2f3ad9['green'](_0x30dbba(0x126))),process['exit'](0x0);};return process['on'](_0x1fceba(0x136),_0x16ac63),process['on'](_0x1fceba(0x10b),_0x16ac63),await new Promise(()=>{}),0x0;}catch(_0x153a36){this[_0x1fceba(0x114)]&&await this['server'][_0x1fceba(0xf9)]();this['logger']&&await this[_0x1fceba(0x110)][_0x1fceba(0x130)]();throw _0x153a36;}}}