@treasuredata/tdx 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a21_0x364ba2=a21_0x558e;(function(_0x36477f,_0x5642c5){const _0x2d3f1a=a21_0x558e,_0xc8e657=_0x36477f();while(!![]){try{const _0x2184b8=parseInt(_0x2d3f1a(0x1c3))/0x1*(parseInt(_0x2d3f1a(0x1cc))/0x2)+parseInt(_0x2d3f1a(0x1bf))/0x3*(parseInt(_0x2d3f1a(0x1c0))/0x4)+parseInt(_0x2d3f1a(0x1c1))/0x5+-parseInt(_0x2d3f1a(0x1c8))/0x6+parseInt(_0x2d3f1a(0x1cd))/0x7+-parseInt(_0x2d3f1a(0x1c9))/0x8*(-parseInt(_0x2d3f1a(0x1d0))/0x9)+-parseInt(_0x2d3f1a(0x1d3))/0xa;if(_0x2184b8===_0x5642c5)break;else _0xc8e657['push'](_0xc8e657['shift']());}catch(_0x37e2d1){_0xc8e657['push'](_0xc8e657['shift']());}}}(a21_0x5469,0xd3d47));function a21_0x5469(){const _0x2161b8=['databases','limit','37599390zbxMnn','\x20database','data','Site:\x20','Error:\x20','Listing\x20databases...','execute','9rpoEXR','2151260OPnIDd','8180795eiAMlr','cause','8JmyRwa','✔\x20Found\x20','description','List\x20all\x20databases','verbose','2621442dSmyOy','56eGNtAR','Pattern:\x20','query','187678IsGRUj','77784jkJADd','length','error','1353951qRiLJO'];a21_0x5469=function(){return _0x2161b8;};return a21_0x5469();}function a21_0x558e(_0x20cd05,_0x41e4bc){_0x20cd05=_0x20cd05-0x1bf;const _0x54693f=a21_0x5469();let _0x558ecb=_0x54693f[_0x20cd05];return _0x558ecb;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';export class DatabasesCommand extends BaseCommand{['name']=a21_0x364ba2(0x1d1);[a21_0x364ba2(0x1c5)]=a21_0x364ba2(0x1c6);async[a21_0x364ba2(0x1d9)](_0x1d6b2d){const _0x3ad6db=a21_0x364ba2,{options:_0x2378ec,args:_0x2d2bd2,tdx:_0x3084b3}=_0x1d6b2d,_0x58d5b9=_0x2d2bd2[0x0];try{_0x2378ec['verbose']&&(console[_0x3ad6db(0x1cf)](_0x3ad6db(0x1d6)+_0x2378ec['site']),_0x58d5b9&&console['error'](_0x3ad6db(0x1ca)+_0x58d5b9));const _0x45d05d=resolveLimit(_0x2378ec[_0x3ad6db(0x1d2)],DEFAULT_LISTING_LIMIT),_0x3632a4=await withSpinner(_0x3ad6db(0x1d8),()=>_0x3084b3[_0x3ad6db(0x1cb)]['listDatabases'](_0x58d5b9,_0x45d05d),{'verbose':_0x2378ec[_0x3ad6db(0x1c7)]}),_0x36702a=_0x3632a4[_0x3ad6db(0x1d5)];return console['error'](_0x3ad6db(0x1c4)+_0x36702a[_0x3ad6db(0x1ce)]+_0x3ad6db(0x1d4)+(_0x36702a[_0x3ad6db(0x1ce)]!==0x1?'s':'')),await handleSDKOutput(_0x36702a,{..._0x2378ec,'limit':_0x45d05d}),0x0;}catch(_0x541bca){if(_0x541bca instanceof SDKError)return console[_0x3ad6db(0x1cf)](_0x3ad6db(0x1d7)+_0x541bca['message']),_0x541bca[_0x3ad6db(0x1c2)]&&console[_0x3ad6db(0x1cf)]('\x20\x20Cause:\x20'+_0x541bca[_0x3ad6db(0x1c2)]),0x1;throw _0x541bca;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a22_0x5169ec=a22_0x4297;(function(_0x302b35,_0x35fed5){const _0xe039ae=a22_0x4297,_0x36e995=_0x302b35();while(!![]){try{const _0x4cf638=-parseInt(_0xe039ae(0x9e))/0x1+-parseInt(_0xe039ae(0xad))/0x2*(parseInt(_0xe039ae(0x99))/0x3)+parseInt(_0xe039ae(0xb6))/0x4*(-parseInt(_0xe039ae(0xae))/0x5)+-parseInt(_0xe039ae(0x8f))/0x6*(parseInt(_0xe039ae(0x9f))/0x7)+-parseInt(_0xe039ae(0x94))/0x8+-parseInt(_0xe039ae(0x8e))/0x9*(parseInt(_0xe039ae(0xb1))/0xa)+parseInt(_0xe039ae(0xa9))/0xb*(parseInt(_0xe039ae(0xb7))/0xc);if(_0x4cf638===_0x35fed5)break;else _0x36e995['push'](_0x36e995['shift']());}catch(_0x588de4){_0x36e995['push'](_0x36e995['shift']());}}}(a22_0x329d,0xb6cfa));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';function a22_0x4297(_0x393d80,_0x1f6b96){_0x393d80=_0x393d80-0x8e;const _0x329dd8=a22_0x329d();let _0x4297ab=_0x329dd8[_0x393d80];return _0x4297ab;}function a22_0x329d(){const _0xcc2175=['8800897yeiHcH','Site:\x20','\x20column','description','✔\x20Found\x20','execute','name','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','\x27\x20does\x20not\x20exist','verbose','187oizWpB','describe','length','Database:\x20','1096RkhFwM','45IGMyKl','query','site','102710JejBGU','Table:\x20','validate','error','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','214700MHTLiQ','3687888RgpMtr','1152GHKoDl','6UGvCnn','...','cause','args','Describing\x20table\x20','7431304fRBMXh','database','Error:\x20','\x20\x20Cause:\x20','message','720RkbhxY','Table\x20\x27','describeTable','✖\x20Table\x20not\x20found','table','360247IRmpDj'];a22_0x329d=function(){return _0xcc2175;};return a22_0x329d();}export class DescribeCommand extends BaseCommand{[a22_0x5169ec(0xa5)]=a22_0x5169ec(0xaa);[a22_0x5169ec(0xa2)]='Describe\x20table\x20schema';async[a22_0x5169ec(0xa4)](_0x204be9){const _0x5c3c9a=a22_0x5169ec;return this[_0x5c3c9a(0x9b)](_0x204be9);}async[a22_0x5169ec(0x9b)](_0x4657b6){const _0x246d76=a22_0x5169ec,{options:_0x32cc16,args:_0x1065c6,tdx:_0x4d18d7}=_0x4657b6;let _0x30ac38;try{_0x30ac38=parseTableReference(_0x1065c6[0x0]);const _0x6c2a47=_0x32cc16[_0x246d76(0x95)];!_0x30ac38['database']&&_0x6c2a47&&(_0x30ac38['database']=_0x6c2a47);const _0x194a87=validateTableDescribeReference(_0x30ac38);if(_0x194a87)return console[_0x246d76(0xb4)](_0x246d76(0x96)+_0x194a87),0x1;}catch(_0x250042){return console['error'](_0x246d76(0x96)+_0x250042[_0x246d76(0x98)]),0x1;}const _0x9153e1=_0x30ac38[_0x246d76(0x95)],_0x2a27d8=_0x30ac38[_0x246d76(0x9d)];try{_0x32cc16[_0x246d76(0xa8)]&&(console[_0x246d76(0xb4)](_0x246d76(0xa0)+_0x32cc16[_0x246d76(0xb0)]),console[_0x246d76(0xb4)](_0x246d76(0xac)+_0x9153e1),console[_0x246d76(0xb4)](_0x246d76(0xb2)+_0x2a27d8));const _0xe57f3c=await withSpinner(_0x246d76(0x93)+_0x9153e1+'.'+_0x2a27d8+_0x246d76(0x90),()=>_0x4d18d7[_0x246d76(0xaf)][_0x246d76(0x9b)](_0x9153e1,_0x2a27d8),{'verbose':_0x32cc16[_0x246d76(0xa8)]}),_0x1653e7=_0xe57f3c['data'];if(_0x1653e7[_0x246d76(0xab)]===0x0)return console['error'](_0x246d76(0x9c)),console['error'](_0x246d76(0x9a)+_0x9153e1+'.'+_0x2a27d8+_0x246d76(0xa7)),0x1;return console[_0x246d76(0xb4)](_0x246d76(0xa3)+_0x1653e7[_0x246d76(0xab)]+_0x246d76(0xa1)+(_0x1653e7[_0x246d76(0xab)]!==0x1?'s':'')+'\x20in\x20'+_0x9153e1+'.'+_0x2a27d8),await handleSDKOutput(_0x1653e7,_0x32cc16),0x0;}catch(_0x16a49f){if(_0x16a49f instanceof SDKError)return console[_0x246d76(0xb4)](_0x246d76(0x96)+_0x16a49f[_0x246d76(0x98)]),_0x16a49f[_0x246d76(0x91)]&&console[_0x246d76(0xb4)](_0x246d76(0x97)+_0x16a49f[_0x246d76(0x91)]),0x1;throw _0x16a49f;}}[a22_0x5169ec(0xb3)](_0x12a298){const _0x349aa0=a22_0x5169ec;if(_0x12a298['args'][_0x349aa0(0xab)]===0x0)return _0x349aa0(0xa6);if(_0x12a298[_0x349aa0(0x92)][_0x349aa0(0xab)]>0x1)return _0x349aa0(0xb5);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x4b9761=a23_0x216e;(function(_0x3e1061,_0x1f1e8f){const _0x13753b=a23_0x216e,_0x3f5fda=_0x3e1061();while(!![]){try{const _0x41ece5=parseInt(_0x13753b(0xa7))/0x1*(-parseInt(_0x13753b(0xa2))/0x2)+parseInt(_0x13753b(0xb3))/0x3*(-parseInt(_0x13753b(0xbb))/0x4)+-parseInt(_0x13753b(0xc8))/0x5+parseInt(_0x13753b(0xb1))/0x6*(-parseInt(_0x13753b(0x8a))/0x7)+-parseInt(_0x13753b(0xc4))/0x8*(-parseInt(_0x13753b(0x92))/0x9)+-parseInt(_0x13753b(0xb9))/0xa*(-parseInt(_0x13753b(0xf0))/0xb)+parseInt(_0x13753b(0x7b))/0xc;if(_0x41ece5===_0x1f1e8f)break;else _0x3f5fda['push'](_0x3f5fda['shift']());}catch(_0x377541){_0x3f5fda['push'](_0x3f5fda['shift']());}}}(a23_0x1b34,0x82e34));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x4523a2,_0x190e78,_0x216155=![]){const _0x480232=a23_0x216e;if(_0x4523a2[_0x480232(0xcf)])return await _0x190e78[_0x480232(0x75)]['resolveWorkspaceId'](_0x4523a2[_0x480232(0xcf)]);const _0x3d009c=loadSessionContext(_0x4523a2[_0x480232(0x84)]);if(_0x3d009c?.[_0x480232(0x7d)])return await _0x190e78['engage']['resolveWorkspaceId'](_0x3d009c[_0x480232(0x7d)]);if(_0x216155)throw new SDKError(ErrorCode[_0x480232(0x93)],_0x480232(0x7e),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x184080,_0xa772fd){const _0x5a15ce=a23_0x216e;if(!_0x184080[_0x5a15ce(0xce)])return{};const _0x3a10cd=_0x184080[_0x5a15ce(0xce)],_0x484c4a=await _0xa772fd[_0x5a15ce(0xce)][_0x5a15ce(0xab)](_0x3a10cd);return{'audienceId':_0x484c4a[_0x5a15ce(0xac)],'audienceName':_0x484c4a['parentName'],..._0x484c4a[_0x5a15ce(0xbd)]&&{'segmentId':_0x484c4a[_0x5a15ce(0xbd)],'segmentName':_0x484c4a['segmentName']}};}function buildConnectorConfig(_0x2e0f9f){const _0x2b089d=a23_0x216e,_0x188d09=_0x2e0f9f[_0x2b089d(0x7f)],_0x25959a=_0x2e0f9f[_0x2b089d(0xe0)];if(!_0x188d09&&!_0x25959a)return undefined;return{..._0x188d09&&{'emailSenderId':_0x188d09},..._0x25959a&&{'jsonColumns':_0x25959a}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaigns';[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xb5);async['execute'](_0x1850e3){const _0x5def16=a23_0x4b9761,{options:_0x2547e6,args:_0x57a5f8,tdx:_0x51a84f}=_0x1850e3,_0x34d4c5=_0x57a5f8[0x0],_0x1e3558=resolveLimit(_0x2547e6['limit'],DEFAULT_LLM_LIMIT),_0x101c9c=_0x2547e6,_0x31dae4=_0x101c9c[_0x5def16(0xde)],_0x218431=_0x101c9c['status'],_0x2414a4=await resolveWorkspaceIdFromOptions(_0x101c9c,_0x51a84f),_0x22264e=await withSpinner(_0x5def16(0xa6),()=>_0x51a84f[_0x5def16(0x75)][_0x5def16(0xa1)]({'type':_0x31dae4,'status':_0x218431,'workspaceId':_0x2414a4,'limit':_0x1e3558}),{'verbose':_0x2547e6[_0x5def16(0xb4)]});let _0x5b7a13=_0x22264e[_0x5def16(0x94)];return _0x34d4c5&&(_0x5b7a13=_0x22264e[_0x5def16(0x94)][_0x5def16(0xaa)](_0x392318=>matchGlobPattern(_0x392318['name'],_0x34d4c5))),await handleSDKOutput(_0x5b7a13,_0x2547e6),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']=a23_0x4b9761(0xcb);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xd5);async[a23_0x4b9761(0xd3)](_0x38f3e1){const _0x5a684e=a23_0x4b9761,{options:_0x22d1d1,args:_0x2691d6,tdx:_0x31bc14}=_0x38f3e1;if(_0x2691d6[_0x5a684e(0xe9)]===0x0)return console[_0x5a684e(0xef)](_0x5a684e(0x77)),console[_0x5a684e(0xef)](_0x5a684e(0xc5)),0x1;const _0x3f4fde=_0x2691d6[0x0],_0x20daf6=_0x22d1d1,_0x57c38c=await resolveWorkspaceIdFromOptions(_0x20daf6,_0x31bc14),_0x8ade2c=_0x20daf6['full'];if(_0x8ade2c){const _0x329827=await withSpinner(_0x5a684e(0x71)+_0x3f4fde+_0x5a684e(0x8e),()=>_0x31bc14['engage'][_0x5a684e(0x82)](_0x3f4fde,_0x57c38c),{'verbose':_0x22d1d1[_0x5a684e(0xb4)]});await handleSDKOutput([_0x329827],_0x22d1d1);}else{const _0x319bab=await withSpinner(_0x5a684e(0x71)+_0x3f4fde+_0x5a684e(0x8e),()=>_0x31bc14['engage'][_0x5a684e(0x8b)](_0x3f4fde,_0x57c38c),{'verbose':_0x22d1d1[_0x5a684e(0xb4)]});await handleSDKOutput([_0x319bab],_0x22d1d1);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:create';['description']='Create\x20a\x20new\x20campaign';async['execute'](_0x2ee593){const _0x3fcacd=a23_0x4b9761,{options:_0x50fe9e,tdx:_0x4287df}=_0x2ee593,_0x22a6bc=_0x50fe9e,_0x58cec1=_0x22a6bc[_0x3fcacd(0xdc)],_0x16cf7b=_0x22a6bc[_0x3fcacd(0xde)];if(!_0x58cec1)return console[_0x3fcacd(0xef)](_0x3fcacd(0x89)),console['error'](_0x3fcacd(0xae)),0x1;if(!_0x16cf7b)return console[_0x3fcacd(0xef)](_0x3fcacd(0xd0)),console['error'](_0x3fcacd(0xae)),0x1;const _0x48bc7f=await resolveWorkspaceIdFromOptions(_0x22a6bc,_0x4287df,!![]),_0x16ef7b=await resolveSegmentFromOptions(_0x22a6bc,_0x4287df),_0x2a9807=buildConnectorConfig(_0x22a6bc),_0x2c531e={'name':_0x58cec1,'campaignType':_0x16cf7b,'workspaceId':_0x48bc7f,'description':_0x22a6bc[_0x3fcacd(0xdf)],..._0x16ef7b,'connectorConfig':_0x2a9807,'startAt':_0x22a6bc[_0x3fcacd(0x8c)],'timezone':_0x22a6bc[_0x3fcacd(0xe6)]},_0x30d801=await withSpinner('Creating\x20campaign\x20\x27'+_0x58cec1+_0x3fcacd(0x8e),()=>_0x4287df[_0x3fcacd(0x75)][_0x3fcacd(0xd6)](_0x2c531e));return await handleSDKOutput([_0x30d801[_0x3fcacd(0x94)]],_0x50fe9e),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:update';[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xeb);async[a23_0x4b9761(0xd3)](_0xc2d18e){const _0x491f59=a23_0x4b9761,{options:_0xadb56e,args:_0x252eae,tdx:_0x4457ca}=_0xc2d18e;if(_0x252eae[_0x491f59(0xe9)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x491f59(0xef)](_0x491f59(0xf2)),0x1;const _0x356b7b=_0x252eae[0x0],_0x3b9554=_0xadb56e,_0x31cd45=await resolveWorkspaceIdFromOptions(_0x3b9554,_0x4457ca),_0x4a2ae4=await resolveSegmentFromOptions(_0x3b9554,_0x4457ca),_0x5061ba=buildConnectorConfig(_0x3b9554),_0x2404a1={'name':_0x3b9554['name'],'description':_0x3b9554[_0x491f59(0xdf)],..._0x4a2ae4,'connectorConfig':_0x5061ba,'startAt':_0x3b9554[_0x491f59(0x8c)],'timezone':_0x3b9554[_0x491f59(0xe6)]},_0x1e3103=Object[_0x491f59(0xbc)](Object[_0x491f59(0xa0)](_0x2404a1)[_0x491f59(0xaa)](([,_0xa412f8])=>_0xa412f8!==undefined));if(Object['keys'](_0x1e3103)[_0x491f59(0xe9)]===0x0)return console['error'](_0x491f59(0x6d)),console['error']('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x450e5b=await withSpinner('Updating\x20campaign\x20\x27'+_0x356b7b+'\x27...',()=>_0x4457ca['engage'][_0x491f59(0xbf)](_0x356b7b,_0x1e3103,_0x31cd45),{'verbose':_0xadb56e[_0x491f59(0xb4)]});return await handleSDKOutput([_0x450e5b[_0x491f59(0x94)]],_0xadb56e),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:delete';['description']='Delete\x20a\x20campaign';async[a23_0x4b9761(0xd3)](_0x131c31){const _0x4ef8dd=a23_0x4b9761,{options:_0x30c061,args:_0x1a83a9,tdx:_0x578381}=_0x131c31;if(_0x1a83a9['length']===0x0)return console[_0x4ef8dd(0xef)](_0x4ef8dd(0x77)),console[_0x4ef8dd(0xef)](_0x4ef8dd(0xdd)),0x1;const _0x44f845=_0x1a83a9[0x0],_0x3cbde5=_0x30c061,_0x2e6237=await resolveWorkspaceIdFromOptions(_0x3cbde5,_0x578381);if(!_0x30c061[_0x4ef8dd(0x90)]){const _0x22d634=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27'+_0x44f845+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x22d634)return console[_0x4ef8dd(0xe1)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x4ef8dd(0xda)+_0x44f845+_0x4ef8dd(0x8e),()=>_0x578381[_0x4ef8dd(0x75)][_0x4ef8dd(0xc9)](_0x44f845,_0x2e6237),{'verbose':_0x30c061[_0x4ef8dd(0xb4)]}),console[_0x4ef8dd(0xe1)](_0x4ef8dd(0xb7)+_0x44f845+_0x4ef8dd(0x9d)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x83);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xf3);async[a23_0x4b9761(0xd3)](_0x59c68f){const _0x24e11b=a23_0x4b9761,{options:_0x5a8353,args:_0x2a1ef0,tdx:_0x162b76}=_0x59c68f;if(_0x2a1ef0['length']===0x0)return console[_0x24e11b(0xef)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x24e11b(0xef)](_0x24e11b(0xf4)),0x1;const _0x394c19=_0x2a1ef0[0x0],_0x4b24ad=_0x5a8353,_0x3d458f=await resolveWorkspaceIdFromOptions(_0x4b24ad,_0x162b76);return await withSpinner(_0x24e11b(0xa8)+_0x394c19+'\x27...',()=>_0x162b76[_0x24e11b(0x75)]['launchCampaign'](_0x394c19,_0x3d458f),{'verbose':_0x5a8353['verbose']}),console[_0x24e11b(0xe1)](_0x24e11b(0xb7)+_0x394c19+_0x24e11b(0xe8)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x9e);['description']=a23_0x4b9761(0xc2);async[a23_0x4b9761(0xd3)](_0x56d769){const _0x10a6f6=a23_0x4b9761,{options:_0x1fb272,args:_0x41f1e7,tdx:_0x5aaf60}=_0x56d769;if(_0x41f1e7['length']===0x0)return console['error'](_0x10a6f6(0x77)),console[_0x10a6f6(0xef)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x38830d=_0x41f1e7[0x0],_0x308d9c=_0x1fb272,_0x41e5e4=await resolveWorkspaceIdFromOptions(_0x308d9c,_0x5aaf60);return await withSpinner(_0x10a6f6(0xe7)+_0x38830d+_0x10a6f6(0x8e),()=>_0x5aaf60[_0x10a6f6(0x75)][_0x10a6f6(0x8d)](_0x38830d,_0x41e5e4),{'verbose':_0x1fb272[_0x10a6f6(0xb4)]}),console[_0x10a6f6(0xe1)](_0x10a6f6(0xb7)+_0x38830d+_0x10a6f6(0x91)),0x0;}}function a23_0x1b34(){const _0x16e206=['Deleting\x20campaign\x20\x27','subject','name','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','type','description','jsonColumns','log','plaintext','updateWorkspace','engage:template:delete','engage:template:show','timezone','Pausing\x20campaign\x20\x27','\x27\x20launched\x20successfully','length','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Update\x20a\x20campaign','Fetching\x20template\x20\x27','createTemplate','html','error','22DpMbJg','engage:template:update','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Launch\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','updateTemplate','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Fetching\x20workspace\x20\x27','Delete\x20an\x20email\x20template','Error:\x20--subject\x20is\x20required','Fetching\x20campaign\x20\x27','listWorkspaces','editorType','Deleting\x20template\x20\x27','engage','Delete\x20a\x20workspace','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Workspace\x20\x27','engage:campaign:duplicate','engage:workspace:delete','23055936xAYpVS','getTemplateFull','engage_workspace','Workspace\x20is\x20required\x20for\x20this\x20operation','emailSenderId','\x27\x20resumed\x20successfully','Show\x20workspace\x20details','getCampaignFull','engage:campaign:launch','session','engage:workspace:show','Operation\x20cancelled','List\x20workspaces','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Error:\x20--name\x20is\x20required','97160xGYVwA','getCampaign','startAt','pauseCampaign','\x27...','getWorkspace','yes','\x27\x20paused\x20successfully','8057871VRAxeD','MISSING_ARGUMENT','data','engage:template:create','Template\x20\x27','limit','Updating\x20workspace\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','resolveWorkspaceId','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','\x27\x20deleted\x20successfully','engage:campaign:pause','Resuming\x20campaign\x20\x27','entries','listCampaigns','2438NrgbOv','engage:workspaces','Duplicate\x20a\x20campaign','Update\x20an\x20email\x20template','Fetching\x20campaigns...','827BnEoCb','Launching\x20campaign\x20\x27','deleteWorkspace','filter','resolvePathToResource','parentId','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Set\x20workspace\x20context\x20for\x20Engage\x20commands','getTemplate','78DmUgam','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','2454RPRHDu','verbose','List\x20campaigns','Create\x20an\x20email\x20template','Campaign\x20\x27','resumeCampaign','354280TqWsOF','Fetching\x20templates...','4868kFJxQT','fromEntries','segmentId','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','updateCampaign','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','keys','Pause\x20a\x20campaign','engage:templates','8RgTBPl','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Error:\x20--html\x20is\x20required','Duplicating\x20campaign\x20\x27','836640auMEiP','deleteCampaign','\x27?\x20This\x20cannot\x20be\x20undone.','engage:campaign:show','Options:\x20--name,\x20--description','engage:workspace:update','segment','workspace','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Fetching\x20workspaces...','execute','engage:workspace:create','Show\x20campaign\x20details','createCampaign','createWorkspace','Updating\x20template\x20\x27','Show\x20email\x20template\x20details'];a23_0x1b34=function(){return _0x16e206;};return a23_0x1b34();}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:campaign:resume';['description']='Resume\x20a\x20paused\x20campaign';async[a23_0x4b9761(0xd3)](_0x40f7a8){const _0x3c5535=a23_0x4b9761,{options:_0x419b99,args:_0x5c9fae,tdx:_0x4a2a15}=_0x40f7a8;if(_0x5c9fae[_0x3c5535(0xe9)]===0x0)return console['error'](_0x3c5535(0x77)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0xe72e8a=_0x5c9fae[0x0],_0x328d2c=_0x419b99,_0x8319fa=await resolveWorkspaceIdFromOptions(_0x328d2c,_0x4a2a15);return await withSpinner(_0x3c5535(0x9f)+_0xe72e8a+_0x3c5535(0x8e),()=>_0x4a2a15[_0x3c5535(0x75)][_0x3c5535(0xb8)](_0xe72e8a,_0x8319fa),{'verbose':_0x419b99[_0x3c5535(0xb4)]}),console['log'](_0x3c5535(0xb7)+_0xe72e8a+_0x3c5535(0x80)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a23_0x4b9761(0x79);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xa4);async['execute'](_0x20c286){const _0x2b1af2=a23_0x4b9761,{options:_0x4ec933,args:_0x38e22a,tdx:_0x3e6079}=_0x20c286;if(_0x38e22a['length']===0x0)return console[_0x2b1af2(0xef)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x2b1af2(0xef)](_0x2b1af2(0xad)),0x1;const _0x492322=_0x38e22a[0x0],_0x130df5=_0x4ec933,_0x23b22a=await resolveWorkspaceIdFromOptions(_0x130df5,_0x3e6079),_0x512200=await withSpinner(_0x2b1af2(0xc7)+_0x492322+'\x27...',()=>_0x3e6079[_0x2b1af2(0x75)]['duplicateCampaign'](_0x492322,_0x23b22a),{'verbose':_0x4ec933['verbose']});return await handleSDKOutput([_0x512200['data']],_0x4ec933),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xc3);[a23_0x4b9761(0xdf)]='List\x20email\x20templates';async[a23_0x4b9761(0xd3)](_0x7c0545){const _0x299748=a23_0x4b9761,{options:_0x31f353,args:_0xa4f339,tdx:_0x2720da}=_0x7c0545,_0x3ea0f9=_0xa4f339[0x0],_0x68796a=resolveLimit(_0x31f353['limit'],DEFAULT_LLM_LIMIT),_0x5f234c=_0x31f353,_0x149595=await resolveWorkspaceIdFromOptions(_0x5f234c,_0x2720da),_0x1f7bf0=await withSpinner(_0x299748(0xba),()=>_0x2720da[_0x299748(0x75)]['listTemplates']({'workspaceId':_0x149595,'limit':_0x68796a}),{'verbose':_0x31f353[_0x299748(0xb4)]});let _0x41ba16=_0x1f7bf0[_0x299748(0x94)];return _0x3ea0f9&&(_0x41ba16=_0x1f7bf0[_0x299748(0x94)][_0x299748(0xaa)](_0x4235f=>matchGlobPattern(_0x4235f[_0x299748(0xdc)],_0x3ea0f9))),await handleSDKOutput(_0x41ba16,_0x31f353),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xe5);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xd9);async[a23_0x4b9761(0xd3)](_0x1bd3da){const _0xdc3dd9=a23_0x4b9761,{options:_0x1ab1ee,args:_0x3f3606,tdx:_0x48b573}=_0x1bd3da;if(_0x3f3606['length']===0x0)return console[_0xdc3dd9(0xef)](_0xdc3dd9(0xb2)),console[_0xdc3dd9(0xef)]('Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>'),0x1;const _0x1c6774=_0x3f3606[0x0],_0x5eabf7=_0x1ab1ee,_0x28aace=await resolveWorkspaceIdFromOptions(_0x5eabf7,_0x48b573),_0x2b5e3c=_0x5eabf7['full'];if(_0x2b5e3c){const _0x18f760=await withSpinner(_0xdc3dd9(0xec)+_0x1c6774+_0xdc3dd9(0x8e),()=>_0x48b573['engage'][_0xdc3dd9(0x7c)](_0x1c6774,_0x28aace),{'verbose':_0x1ab1ee[_0xdc3dd9(0xb4)]});await handleSDKOutput([_0x18f760],_0x1ab1ee);}else{const _0x4e958c=await withSpinner(_0xdc3dd9(0xec)+_0x1c6774+_0xdc3dd9(0x8e),()=>_0x48b573['engage'][_0xdc3dd9(0xb0)](_0x1c6774,_0x28aace),{'verbose':_0x1ab1ee[_0xdc3dd9(0xb4)]});await handleSDKOutput([_0x4e958c],_0x1ab1ee);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x95);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xb6);async['execute'](_0x429c76){const _0x5a9c42=a23_0x4b9761,{options:_0x184af8,tdx:_0x2a59a2}=_0x429c76,_0x4ca37f=_0x184af8,_0x3e68b4=_0x4ca37f[_0x5a9c42(0xdc)],_0x3e89a2=_0x4ca37f[_0x5a9c42(0xdb)],_0x46116d=_0x4ca37f[_0x5a9c42(0xee)];if(!_0x3e68b4)return console[_0x5a9c42(0xef)](_0x5a9c42(0x89)),console[_0x5a9c42(0xef)]('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x3e89a2)return console['error'](_0x5a9c42(0x70)),0x1;if(!_0x46116d)return console[_0x5a9c42(0xef)](_0x5a9c42(0xc6)),0x1;const _0x4ccaa0=await resolveWorkspaceIdFromOptions(_0x4ca37f,_0x2a59a2,!![]),_0x14f26c={'name':_0x3e68b4,'subjectTemplate':_0x3e89a2,'htmlTemplate':_0x46116d,'workspaceId':_0x4ccaa0,'plaintextTemplate':_0x4ca37f[_0x5a9c42(0xe2)],'editorType':_0x4ca37f[_0x5a9c42(0x73)]},_0x2465cf=await withSpinner('Creating\x20template\x20\x27'+_0x3e68b4+_0x5a9c42(0x8e),()=>_0x2a59a2[_0x5a9c42(0x75)][_0x5a9c42(0xed)](_0x14f26c));return await handleSDKOutput([_0x2465cf[_0x5a9c42(0x94)]],_0x184af8),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a23_0x4b9761(0xf1);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0xa5);async[a23_0x4b9761(0xd3)](_0x445b7a){const _0x173b17=a23_0x4b9761,{options:_0x2103ba,args:_0x308c59,tdx:_0x14a297}=_0x445b7a;if(_0x308c59[_0x173b17(0xe9)]===0x0)return console[_0x173b17(0xef)](_0x173b17(0xb2)),console[_0x173b17(0xef)](_0x173b17(0x88)),0x1;const _0x4a0a3b=_0x308c59[0x0],_0xbd8b01=_0x2103ba,_0x141d23=await resolveWorkspaceIdFromOptions(_0xbd8b01,_0x14a297),_0x320726={'name':_0xbd8b01[_0x173b17(0xdc)],'subjectTemplate':_0xbd8b01[_0x173b17(0xdb)],'htmlTemplate':_0xbd8b01[_0x173b17(0xee)],'plaintextTemplate':_0xbd8b01[_0x173b17(0xe2)]},_0x30f66c=Object[_0x173b17(0xbc)](Object[_0x173b17(0xa0)](_0x320726)[_0x173b17(0xaa)](([,_0x1e41bc])=>_0x1e41bc!==undefined));if(Object[_0x173b17(0xc1)](_0x30f66c)[_0x173b17(0xe9)]===0x0)return console[_0x173b17(0xef)](_0x173b17(0x6d)),console[_0x173b17(0xef)](_0x173b17(0xea)),0x1;const _0x3d87d8=await withSpinner(_0x173b17(0xd8)+_0x4a0a3b+_0x173b17(0x8e),()=>_0x14a297['engage'][_0x173b17(0xf5)](_0x4a0a3b,_0x30f66c,_0x141d23),{'verbose':_0x2103ba[_0x173b17(0xb4)]});return await handleSDKOutput([_0x3d87d8[_0x173b17(0x94)]],_0x2103ba),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xe4);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0x6f);async[a23_0x4b9761(0xd3)](_0x29859b){const _0x286547=a23_0x4b9761,{options:_0x5c4f18,args:_0x2acac9,tdx:_0x543720}=_0x29859b;if(_0x2acac9['length']===0x0)return console[_0x286547(0xef)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x286547(0xef)](_0x286547(0x9c)),0x1;const _0x25192c=_0x2acac9[0x0],_0x4762bb=_0x5c4f18,_0x374a8f=await resolveWorkspaceIdFromOptions(_0x4762bb,_0x543720);if(!_0x5c4f18['yes']){const _0x5ecd59=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x25192c+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x5ecd59)return console[_0x286547(0xe1)](_0x286547(0x86)),0x0;}return await withSpinner(_0x286547(0x74)+_0x25192c+_0x286547(0x8e),()=>_0x543720[_0x286547(0x75)]['deleteTemplate'](_0x25192c,_0x374a8f),{'verbose':_0x5c4f18[_0x286547(0xb4)]}),console['log'](_0x286547(0x96)+_0x25192c+_0x286547(0x9d)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xa3);['description']=a23_0x4b9761(0x87);async['execute'](_0xc6662a){const _0x592eb2=a23_0x4b9761,{options:_0x3755d0,args:_0x81f16f,tdx:_0x138a5d}=_0xc6662a,_0x3e0da4=_0x81f16f[0x0],_0x25486d=resolveLimit(_0x3755d0[_0x592eb2(0x97)],DEFAULT_LLM_LIMIT),_0x4c9469=await withSpinner(_0x592eb2(0xd2),()=>_0x138a5d[_0x592eb2(0x75)][_0x592eb2(0x72)]({'limit':_0x25486d}),{'verbose':_0x3755d0[_0x592eb2(0xb4)]});let _0x44f936=_0x4c9469[_0x592eb2(0x94)];return _0x3e0da4&&(_0x44f936=_0x4c9469['data'][_0x592eb2(0xaa)](_0x46469e=>matchGlobPattern(_0x46469e[_0x592eb2(0xdc)],_0x3e0da4))),await handleSDKOutput(_0x44f936,_0x3755d0),0x0;}}function a23_0x216e(_0x2bafbe,_0x121bc9){_0x2bafbe=_0x2bafbe-0x6d;const _0x1b34c6=a23_0x1b34();let _0x216e68=_0x1b34c6[_0x2bafbe];return _0x216e68;}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x85);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0x81);async['execute'](_0x3e32b7){const _0x3a936b=a23_0x4b9761,{options:_0x7b0d93,args:_0x5c250d,tdx:_0x54a07a}=_0x3e32b7;if(_0x5c250d['length']===0x0)return console[_0x3a936b(0xef)](_0x3a936b(0xd1)),console[_0x3a936b(0xef)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x522059=_0x5c250d[0x0],_0x25941b=_0x7b0d93,_0xe8cfef=_0x25941b['full'];if(_0xe8cfef){const _0x2c80c0=await withSpinner(_0x3a936b(0x6e)+_0x522059+'\x27...',()=>_0x54a07a[_0x3a936b(0x75)]['getWorkspaceFull'](_0x522059),{'verbose':_0x7b0d93['verbose']});await handleSDKOutput([_0x2c80c0],_0x7b0d93);}else{const _0xcb0a59=await withSpinner(_0x3a936b(0x6e)+_0x522059+_0x3a936b(0x8e),()=>_0x54a07a['engage'][_0x3a936b(0x8f)](_0x522059),{'verbose':_0x7b0d93[_0x3a936b(0xb4)]});await handleSDKOutput([_0xcb0a59],_0x7b0d93);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a23_0x4b9761(0xd4);[a23_0x4b9761(0xdf)]='Create\x20a\x20workspace';async[a23_0x4b9761(0xd3)](_0x2f38ba){const _0x3e4007=a23_0x4b9761,{options:_0x301e5c,tdx:_0x16d2bc}=_0x2f38ba,_0x28abe7=_0x301e5c,_0x5e0929=_0x28abe7[_0x3e4007(0xdc)];if(!_0x5e0929)return console[_0x3e4007(0xef)](_0x3e4007(0x89)),console[_0x3e4007(0xef)](_0x3e4007(0xbe)),0x1;const _0xb71e00={'name':_0x5e0929,'description':_0x28abe7[_0x3e4007(0xdf)]},_0x316cdc=await withSpinner('Creating\x20workspace\x20\x27'+_0x5e0929+'\x27...',()=>_0x16d2bc[_0x3e4007(0x75)][_0x3e4007(0xd7)](_0xb71e00));return await handleSDKOutput([_0x316cdc[_0x3e4007(0x94)]],_0x301e5c),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0xcd);['description']='Update\x20a\x20workspace';async[a23_0x4b9761(0xd3)](_0x2763a3){const _0x5602fb=a23_0x4b9761,{options:_0x51ccf8,args:_0x26f31c,tdx:_0x4bee55}=_0x2763a3;if(_0x26f31c['length']===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x57df61=_0x26f31c[0x0],_0x84ccb7=_0x51ccf8,_0x48dbfc={'name':_0x84ccb7[_0x5602fb(0xdc)],'description':_0x84ccb7[_0x5602fb(0xdf)]},_0x183b39=Object['fromEntries'](Object['entries'](_0x48dbfc)[_0x5602fb(0xaa)](([,_0xf0eb27])=>_0xf0eb27!==undefined));if(Object[_0x5602fb(0xc1)](_0x183b39)['length']===0x0)return console[_0x5602fb(0xef)](_0x5602fb(0x6d)),console[_0x5602fb(0xef)](_0x5602fb(0xcc)),0x1;const _0x82f4f2=await withSpinner(_0x5602fb(0x98)+_0x57df61+_0x5602fb(0x8e),()=>_0x4bee55[_0x5602fb(0x75)][_0x5602fb(0xe3)](_0x57df61,_0x183b39),{'verbose':_0x51ccf8['verbose']});return await handleSDKOutput([_0x82f4f2[_0x5602fb(0x94)]],_0x51ccf8),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a23_0x4b9761(0xdc)]=a23_0x4b9761(0x7a);[a23_0x4b9761(0xdf)]=a23_0x4b9761(0x76);async[a23_0x4b9761(0xd3)](_0x465692){const _0x386316=a23_0x4b9761,{options:_0x4287d6,args:_0x5f46da,tdx:_0x2f8db5}=_0x465692;if(_0x5f46da['length']===0x0)return console[_0x386316(0xef)](_0x386316(0xd1)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>'),0x1;const _0x20c897=_0x5f46da[0x0];if(!_0x4287d6[_0x386316(0x90)]){const _0x38ee97=await confirm(_0x386316(0x9a)+_0x20c897+_0x386316(0xca));if(!_0x38ee97)return console[_0x386316(0xe1)]('Operation\x20cancelled'),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x20c897+_0x386316(0x8e),()=>_0x2f8db5[_0x386316(0x75)][_0x386316(0xa9)](_0x20c897),{'verbose':_0x4287d6['verbose']}),console[_0x386316(0xe1)](_0x386316(0x78)+_0x20c897+_0x386316(0x9d)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0x4b9761(0xdc)]='engage:workspace:use';['description']=a23_0x4b9761(0xaf);async[a23_0x4b9761(0xd3)](_0x3da6d5){const _0xd9254a=a23_0x4b9761,{options:_0x3d3e58,args:_0x1a47ce,tdx:_0x555660}=_0x3da6d5;if(_0x1a47ce[_0xd9254a(0xe9)]===0x0)return console[_0xd9254a(0xef)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0xd9254a(0xef)](_0xd9254a(0xc0)),0x1;const _0x3e6d6a=_0x1a47ce[0x0];await withSpinner('Verifying\x20workspace\x20\x27'+_0x3e6d6a+_0xd9254a(0x8e),()=>_0x555660[_0xd9254a(0x75)][_0xd9254a(0x9b)](_0x3e6d6a));const _0x27f985=_0x3d3e58[_0xd9254a(0x84)]||undefined;return saveSessionContext({'engage_workspace':_0x3e6d6a},_0x27f985),console[_0xd9254a(0xe1)]('Engage\x20workspace\x20set\x20to:\x20'+_0x3e6d6a),console[_0xd9254a(0xe1)](_0xd9254a(0x99)),0x0;}}
|
|
1
|
+
const a23_0x4c52ea=a23_0x56ed;(function(_0x2037e9,_0x2f4ded){const _0x11ef1a=a23_0x56ed,_0x1b9d8e=_0x2037e9();while(!![]){try{const _0x593edc=parseInt(_0x11ef1a(0x132))/0x1*(-parseInt(_0x11ef1a(0x14d))/0x2)+parseInt(_0x11ef1a(0xf0))/0x3*(-parseInt(_0x11ef1a(0x11a))/0x4)+-parseInt(_0x11ef1a(0x131))/0x5+parseInt(_0x11ef1a(0xd0))/0x6*(-parseInt(_0x11ef1a(0xd4))/0x7)+-parseInt(_0x11ef1a(0xd8))/0x8+parseInt(_0x11ef1a(0x11b))/0x9+parseInt(_0x11ef1a(0x141))/0xa*(parseInt(_0x11ef1a(0x11e))/0xb);if(_0x593edc===_0x2f4ded)break;else _0x1b9d8e['push'](_0x1b9d8e['shift']());}catch(_0x1e7638){_0x1b9d8e['push'](_0x1b9d8e['shift']());}}}(a23_0xacaa,0x83484));function a23_0xacaa(){const _0x520b06=['List\x20campaigns','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','engage:template:update','28aODwkW','Error:\x20--html\x20is\x20required','listWorkspaces','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','6283792vqvVIt','Delete\x20a\x20workspace','filter','html','resolveWorkspaceId','Options:\x20--name,\x20--description','log','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Update\x20a\x20campaign','\x27...','error','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','getWorkspaceFull','Creating\x20template\x20\x27','deleteWorkspace','getCampaignFull','Create\x20a\x20new\x20campaign','Error:\x20--name\x20is\x20required','segmentId','getCampaign','engage:templates','Update\x20an\x20email\x20template','engage:workspace:use','Delete\x20an\x20email\x20template','8907gidGvD','entries','startAt','Creating\x20workspace\x20\x27','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','engage:workspace:show','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','execute','List\x20workspaces','Error:\x20Workspace\x20name\x20is\x20required','segment','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','MISSING_ARGUMENT','Launching\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Error:\x20--subject\x20is\x20required','Fetching\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Fetching\x20campaigns...','engage:workspace:delete','length','Pause\x20a\x20campaign','engage:template:show','updateWorkspace','subject','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Verifying\x20workspace\x20\x27','name','engage_workspace','\x27\x20launched\x20successfully','Fetching\x20template\x20\x27','Show\x20email\x20template\x20details','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Delete\x20a\x20campaign','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Deleting\x20campaign\x20\x27','verbose','duplicateCampaign','engage:campaign:delete','resolvePathToResource','engage:template:create','Pausing\x20campaign\x20\x27','996VUCCmy','1101600duQdXt','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','createWorkspace','88nngRgg','description','\x27\x20resumed\x20successfully','Fetching\x20campaign\x20\x27','listTemplates','data','full','createTemplate','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Duplicating\x20campaign\x20\x27','editorType','engage:campaign:pause','createCampaign','\x27?\x20This\x20cannot\x20be\x20undone.','engage:template:delete','engage:campaign:create','session','Show\x20workspace\x20details','segmentName','3865540eYgpNQ','1hsOVBy','Duplicate\x20a\x20campaign','plaintext','Resume\x20a\x20paused\x20campaign','Launch\x20a\x20campaign','\x27\x20deleted\x20successfully','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Create\x20an\x20email\x20template','jsonColumns','engage:workspace:update','getWorkspace','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Show\x20campaign\x20details','engage:workspaces','4767260lfaxrv','Campaign\x20\x27','engage','limit','parentName','Set\x20workspace\x20context\x20for\x20Engage\x20commands','fromEntries','timezone','engage:campaigns','getTemplate','keys','Operation\x20cancelled','472634UVwPKz','engage:campaign:resume','listCampaigns','engage:workspace:create','Creating\x20campaign\x20\x27','Deleting\x20workspace\x20\x27','Deleting\x20template\x20\x27','deleteTemplate','Fetching\x20workspaces...','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','engage:campaign:duplicate','workspace','updateTemplate','engage:campaign:update','Updating\x20campaign\x20\x27','emailSenderId','yes','Resuming\x20campaign\x20\x27','1296444sKbSqW'];a23_0xacaa=function(){return _0x520b06;};return a23_0xacaa();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x4c7cfb,_0x121561,_0x138346=![]){const _0x12584f=a23_0x56ed;if(_0x4c7cfb['workspace'])return await _0x121561['engage'][_0x12584f(0xdc)](_0x4c7cfb[_0x12584f(0x158)]);const _0x200855=loadSessionContext(_0x4c7cfb[_0x12584f(0x12e)]);if(_0x200855?.[_0x12584f(0x10c)])return await _0x121561[_0x12584f(0x143)]['resolveWorkspaceId'](_0x200855[_0x12584f(0x10c)]);if(_0x138346)throw new SDKError(ErrorCode[_0x12584f(0xfc)],'Workspace\x20is\x20required\x20for\x20this\x20operation',undefined,{'helpText':_0x12584f(0xd2)});return undefined;}async function resolveSegmentFromOptions(_0x52623b,_0x507396){const _0x3610c0=a23_0x56ed;if(!_0x52623b[_0x3610c0(0xfa)])return{};const _0x4b54c3=_0x52623b[_0x3610c0(0xfa)],_0x1e5f41=await _0x507396[_0x3610c0(0xfa)][_0x3610c0(0x117)](_0x4b54c3);return{'audienceId':_0x1e5f41['parentId'],'audienceName':_0x1e5f41[_0x3610c0(0x145)],..._0x1e5f41[_0x3610c0(0xea)]&&{'segmentId':_0x1e5f41[_0x3610c0(0xea)],'segmentName':_0x1e5f41[_0x3610c0(0x130)]}};}function buildConnectorConfig(_0x4f5bdd){const _0x1b5323=a23_0x56ed,_0x59fc63=_0x4f5bdd[_0x1b5323(0x15c)],_0x2f2508=_0x4f5bdd[_0x1b5323(0x13b)];if(!_0x59fc63&&!_0x2f2508)return undefined;return{..._0x59fc63&&{'emailSenderId':_0x59fc63},..._0x2f2508&&{'jsonColumns':_0x2f2508}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x149);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xd1);async['execute'](_0x28720c){const _0x38437e=a23_0x4c52ea,{options:_0x33f8b1,args:_0x4a6623,tdx:_0x15a6af}=_0x28720c,_0x2fae05=_0x4a6623[0x0],_0x7e0d47=resolveLimit(_0x33f8b1[_0x38437e(0x144)],DEFAULT_LLM_LIMIT),_0x418d1d=_0x33f8b1,_0xa60226=_0x418d1d['type'],_0x100967=_0x418d1d['status'],_0x32e6b7=await resolveWorkspaceIdFromOptions(_0x418d1d,_0x15a6af),_0x37411c=await withSpinner(_0x38437e(0x102),()=>_0x15a6af[_0x38437e(0x143)][_0x38437e(0x14f)]({'type':_0xa60226,'status':_0x100967,'workspaceId':_0x32e6b7,'limit':_0x7e0d47}),{'verbose':_0x33f8b1[_0x38437e(0x114)]});let _0x554c15=_0x37411c['data'];return _0x2fae05&&(_0x554c15=_0x37411c['data'][_0x38437e(0xda)](_0x259eb2=>matchGlobPattern(_0x259eb2[_0x38437e(0x10b)],_0x2fae05))),await handleSDKOutput(_0x554c15,_0x33f8b1),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]='engage:campaign:show';[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x13f);async[a23_0x4c52ea(0xf7)](_0x25258a){const _0x25943a=a23_0x4c52ea,{options:_0x51ca6a,args:_0x448b2a,tdx:_0x573712}=_0x25258a;if(_0x448b2a['length']===0x0)return console[_0x25943a(0xe2)](_0x25943a(0xe3)),console[_0x25943a(0xe2)](_0x25943a(0x11c)),0x1;const _0x36d51e=_0x448b2a[0x0],_0x2c4c14=_0x51ca6a,_0x22822e=await resolveWorkspaceIdFromOptions(_0x2c4c14,_0x573712),_0x4ddb1d=_0x2c4c14[_0x25943a(0x124)];if(_0x4ddb1d){const _0x1f72ca=await withSpinner(_0x25943a(0x121)+_0x36d51e+_0x25943a(0xe1),()=>_0x573712['engage'][_0x25943a(0xe7)](_0x36d51e,_0x22822e),{'verbose':_0x51ca6a[_0x25943a(0x114)]});await handleSDKOutput([_0x1f72ca],_0x51ca6a);}else{const _0x418bc6=await withSpinner(_0x25943a(0x121)+_0x36d51e+'\x27...',()=>_0x573712[_0x25943a(0x143)][_0x25943a(0xeb)](_0x36d51e,_0x22822e),{'verbose':_0x51ca6a['verbose']});await handleSDKOutput([_0x418bc6],_0x51ca6a);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x12d);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xe8);async[a23_0x4c52ea(0xf7)](_0x213488){const _0x3be873=a23_0x4c52ea,{options:_0x508fc6,tdx:_0x219943}=_0x213488,_0x1c7688=_0x508fc6,_0x2b920b=_0x1c7688[_0x3be873(0x10b)],_0x353b4b=_0x1c7688['type'];if(!_0x2b920b)return console[_0x3be873(0xe2)](_0x3be873(0xe9)),console[_0x3be873(0xe2)](_0x3be873(0xfb)),0x1;if(!_0x353b4b)return console['error']('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x3be873(0xe2)](_0x3be873(0xfb)),0x1;const _0x3440fa=await resolveWorkspaceIdFromOptions(_0x1c7688,_0x219943,!![]),_0x21e818=await resolveSegmentFromOptions(_0x1c7688,_0x219943),_0x4ac91c=buildConnectorConfig(_0x1c7688),_0x54d532={'name':_0x2b920b,'campaignType':_0x353b4b,'workspaceId':_0x3440fa,'description':_0x1c7688[_0x3be873(0x11f)],..._0x21e818,'connectorConfig':_0x4ac91c,'startAt':_0x1c7688[_0x3be873(0xf2)],'timezone':_0x1c7688[_0x3be873(0x148)]},_0x2998dd=await withSpinner(_0x3be873(0x151)+_0x2b920b+_0x3be873(0xe1),()=>_0x219943[_0x3be873(0x143)][_0x3be873(0x12a)](_0x54d532));return await handleSDKOutput([_0x2998dd[_0x3be873(0x123)]],_0x508fc6),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x15a);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xe0);async[a23_0x4c52ea(0xf7)](_0xa18f02){const _0x246f09=a23_0x4c52ea,{options:_0x1554c3,args:_0x153964,tdx:_0xb9fcf3}=_0xa18f02;if(_0x153964[_0x246f09(0x104)]===0x0)return console['error'](_0x246f09(0xe3)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x292986=_0x153964[0x0],_0x577afe=_0x1554c3,_0x1a1446=await resolveWorkspaceIdFromOptions(_0x577afe,_0xb9fcf3),_0xe13eb0=await resolveSegmentFromOptions(_0x577afe,_0xb9fcf3),_0x316576=buildConnectorConfig(_0x577afe),_0x139e17={'name':_0x577afe['name'],'description':_0x577afe[_0x246f09(0x11f)],..._0xe13eb0,'connectorConfig':_0x316576,'startAt':_0x577afe[_0x246f09(0xf2)],'timezone':_0x577afe[_0x246f09(0x148)]},_0x1ee5f7=Object[_0x246f09(0x147)](Object[_0x246f09(0xf1)](_0x139e17)[_0x246f09(0xda)](([,_0x26ee1d])=>_0x26ee1d!==undefined));if(Object[_0x246f09(0x14b)](_0x1ee5f7)[_0x246f09(0x104)]===0x0)return console[_0x246f09(0xe2)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error'](_0x246f09(0xf4)),0x1;const _0x37162e=await withSpinner(_0x246f09(0x15b)+_0x292986+_0x246f09(0xe1),()=>_0xb9fcf3[_0x246f09(0x143)]['updateCampaign'](_0x292986,_0x1ee5f7,_0x1a1446),{'verbose':_0x1554c3['verbose']});return await handleSDKOutput([_0x37162e[_0x246f09(0x123)]],_0x1554c3),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x116);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x111);async['execute'](_0x489546){const _0x1de1cd=a23_0x4c52ea,{options:_0x236f0b,args:_0x10c621,tdx:_0x3a9c51}=_0x489546;if(_0x10c621[_0x1de1cd(0x104)]===0x0)return console[_0x1de1cd(0xe2)](_0x1de1cd(0xe3)),console[_0x1de1cd(0xe2)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0xe9dc5f=_0x10c621[0x0],_0x3116c1=_0x236f0b,_0x17ee9d=await resolveWorkspaceIdFromOptions(_0x3116c1,_0x3a9c51);if(!_0x236f0b[_0x1de1cd(0xce)]){const _0x310c06=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27'+_0xe9dc5f+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x310c06)return console['log']('Operation\x20cancelled'),0x0;}return await withSpinner(_0x1de1cd(0x113)+_0xe9dc5f+_0x1de1cd(0xe1),()=>_0x3a9c51[_0x1de1cd(0x143)]['deleteCampaign'](_0xe9dc5f,_0x17ee9d),{'verbose':_0x236f0b['verbose']}),console[_0x1de1cd(0xde)](_0x1de1cd(0x142)+_0xe9dc5f+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]='engage:campaign:launch';['description']=a23_0x4c52ea(0x136);async[a23_0x4c52ea(0xf7)](_0x3d685a){const _0x45638d=a23_0x4c52ea,{options:_0x31cc34,args:_0xd9f4ee,tdx:_0x115fa5}=_0x3d685a;if(_0xd9f4ee['length']===0x0)return console[_0x45638d(0xe2)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x45638d(0xe2)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x544bb1=_0xd9f4ee[0x0],_0x5a2b75=_0x31cc34,_0x32de0c=await resolveWorkspaceIdFromOptions(_0x5a2b75,_0x115fa5);return await withSpinner(_0x45638d(0xfd)+_0x544bb1+_0x45638d(0xe1),()=>_0x115fa5[_0x45638d(0x143)]['launchCampaign'](_0x544bb1,_0x32de0c),{'verbose':_0x31cc34[_0x45638d(0x114)]}),console['log'](_0x45638d(0x142)+_0x544bb1+_0x45638d(0x10d)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x129);['description']=a23_0x4c52ea(0x105);async[a23_0x4c52ea(0xf7)](_0x16266f){const _0x2b580f=a23_0x4c52ea,{options:_0x1cdf4f,args:_0x37ac91,tdx:_0x1f0204}=_0x16266f;if(_0x37ac91[_0x2b580f(0x104)]===0x0)return console[_0x2b580f(0xe2)](_0x2b580f(0xe3)),console[_0x2b580f(0xe2)](_0x2b580f(0xd7)),0x1;const _0x35c295=_0x37ac91[0x0],_0x4f90f9=_0x1cdf4f,_0xb73f89=await resolveWorkspaceIdFromOptions(_0x4f90f9,_0x1f0204);return await withSpinner(_0x2b580f(0x119)+_0x35c295+_0x2b580f(0xe1),()=>_0x1f0204['engage']['pauseCampaign'](_0x35c295,_0xb73f89),{'verbose':_0x1cdf4f['verbose']}),console[_0x2b580f(0xde)](_0x2b580f(0x142)+_0x35c295+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x14e);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x135);async['execute'](_0x335959){const _0x4b35b2=a23_0x4c52ea,{options:_0x19aed4,args:_0x5f4f44,tdx:_0x172b1c}=_0x335959;if(_0x5f4f44[_0x4b35b2(0x104)]===0x0)return console[_0x4b35b2(0xe2)](_0x4b35b2(0xe3)),console[_0x4b35b2(0xe2)](_0x4b35b2(0x101)),0x1;const _0x153755=_0x5f4f44[0x0],_0xefd4be=_0x19aed4,_0x4805ae=await resolveWorkspaceIdFromOptions(_0xefd4be,_0x172b1c);return await withSpinner(_0x4b35b2(0xcf)+_0x153755+_0x4b35b2(0xe1),()=>_0x172b1c[_0x4b35b2(0x143)]['resumeCampaign'](_0x153755,_0x4805ae),{'verbose':_0x19aed4[_0x4b35b2(0x114)]}),console['log'](_0x4b35b2(0x142)+_0x153755+_0x4b35b2(0x120)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x157);['description']=a23_0x4c52ea(0x133);async[a23_0x4c52ea(0xf7)](_0x406ac8){const _0x23765c=a23_0x4c52ea,{options:_0x363ae8,args:_0x2b466f,tdx:_0x54edda}=_0x406ac8;if(_0x2b466f[_0x23765c(0x104)]===0x0)return console['error'](_0x23765c(0xe3)),console[_0x23765c(0xe2)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x2fc344=_0x2b466f[0x0],_0x589561=_0x363ae8,_0x9c1fef=await resolveWorkspaceIdFromOptions(_0x589561,_0x54edda),_0x26edc2=await withSpinner(_0x23765c(0x127)+_0x2fc344+_0x23765c(0xe1),()=>_0x54edda[_0x23765c(0x143)][_0x23765c(0x115)](_0x2fc344,_0x9c1fef),{'verbose':_0x363ae8['verbose']});return await handleSDKOutput([_0x26edc2[_0x23765c(0x123)]],_0x363ae8),0x0;}}function a23_0x56ed(_0x26815e,_0xc727cd){_0x26815e=_0x26815e-0xce;const _0xacaa83=a23_0xacaa();let _0x56ed53=_0xacaa83[_0x26815e];return _0x56ed53;}export class EngageTemplatesCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xec);[a23_0x4c52ea(0x11f)]='List\x20email\x20templates';async[a23_0x4c52ea(0xf7)](_0x39548b){const _0x33b038=a23_0x4c52ea,{options:_0x2fe3ed,args:_0x1514de,tdx:_0x321bca}=_0x39548b,_0x5b2565=_0x1514de[0x0],_0xe54500=resolveLimit(_0x2fe3ed['limit'],DEFAULT_LLM_LIMIT),_0x4f1933=_0x2fe3ed,_0x3703f3=await resolveWorkspaceIdFromOptions(_0x4f1933,_0x321bca),_0x39d143=await withSpinner('Fetching\x20templates...',()=>_0x321bca['engage'][_0x33b038(0x122)]({'workspaceId':_0x3703f3,'limit':_0xe54500}),{'verbose':_0x2fe3ed[_0x33b038(0x114)]});let _0xb10ad0=_0x39d143[_0x33b038(0x123)];return _0x5b2565&&(_0xb10ad0=_0x39d143[_0x33b038(0x123)]['filter'](_0x195bcc=>matchGlobPattern(_0x195bcc[_0x33b038(0x10b)],_0x5b2565))),await handleSDKOutput(_0xb10ad0,_0x2fe3ed),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x106);['description']=a23_0x4c52ea(0x10f);async[a23_0x4c52ea(0xf7)](_0x524268){const _0x47b1b1=a23_0x4c52ea,{options:_0x598c44,args:_0x5e8b4f,tdx:_0x44171b}=_0x524268;if(_0x5e8b4f[_0x47b1b1(0x104)]===0x0)return console[_0x47b1b1(0xe2)](_0x47b1b1(0xf6)),console['error'](_0x47b1b1(0x110)),0x1;const _0x22d579=_0x5e8b4f[0x0],_0x420be8=_0x598c44,_0xf51d02=await resolveWorkspaceIdFromOptions(_0x420be8,_0x44171b),_0xe156c0=_0x420be8[_0x47b1b1(0x124)];if(_0xe156c0){const _0x58ff2f=await withSpinner(_0x47b1b1(0x10e)+_0x22d579+'\x27...',()=>_0x44171b['engage']['getTemplateFull'](_0x22d579,_0xf51d02),{'verbose':_0x598c44[_0x47b1b1(0x114)]});await handleSDKOutput([_0x58ff2f],_0x598c44);}else{const _0x1cdb77=await withSpinner(_0x47b1b1(0x10e)+_0x22d579+'\x27...',()=>_0x44171b['engage'][_0x47b1b1(0x14a)](_0x22d579,_0xf51d02),{'verbose':_0x598c44[_0x47b1b1(0x114)]});await handleSDKOutput([_0x1cdb77],_0x598c44);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x118);['description']=a23_0x4c52ea(0x13a);async[a23_0x4c52ea(0xf7)](_0x497708){const _0x1abf72=a23_0x4c52ea,{options:_0x4949a9,tdx:_0x5b9f6a}=_0x497708,_0x209832=_0x4949a9,_0x1d692d=_0x209832[_0x1abf72(0x10b)],_0x24f91f=_0x209832[_0x1abf72(0x108)],_0x2cf5ab=_0x209832[_0x1abf72(0xdb)];if(!_0x1d692d)return console[_0x1abf72(0xe2)](_0x1abf72(0xe9)),console['error']('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x24f91f)return console[_0x1abf72(0xe2)](_0x1abf72(0xff)),0x1;if(!_0x2cf5ab)return console[_0x1abf72(0xe2)](_0x1abf72(0xd5)),0x1;const _0x564241=await resolveWorkspaceIdFromOptions(_0x209832,_0x5b9f6a,!![]),_0x2f629f={'name':_0x1d692d,'subjectTemplate':_0x24f91f,'htmlTemplate':_0x2cf5ab,'workspaceId':_0x564241,'plaintextTemplate':_0x209832[_0x1abf72(0x134)],'editorType':_0x209832[_0x1abf72(0x128)]},_0x4e655a=await withSpinner(_0x1abf72(0xe5)+_0x1d692d+_0x1abf72(0xe1),()=>_0x5b9f6a[_0x1abf72(0x143)][_0x1abf72(0x125)](_0x2f629f));return await handleSDKOutput([_0x4e655a['data']],_0x4949a9),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xd3);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xed);async[a23_0x4c52ea(0xf7)](_0x252bb1){const _0x3b934a=a23_0x4c52ea,{options:_0x182c10,args:_0x57ff5d,tdx:_0x209ac1}=_0x252bb1;if(_0x57ff5d['length']===0x0)return console['error'](_0x3b934a(0xf6)),console[_0x3b934a(0xe2)]('Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x767d21=_0x57ff5d[0x0],_0x108407=_0x182c10,_0x223e53=await resolveWorkspaceIdFromOptions(_0x108407,_0x209ac1),_0x319071={'name':_0x108407[_0x3b934a(0x10b)],'subjectTemplate':_0x108407[_0x3b934a(0x108)],'htmlTemplate':_0x108407[_0x3b934a(0xdb)],'plaintextTemplate':_0x108407[_0x3b934a(0x134)]},_0xe3f569=Object['fromEntries'](Object[_0x3b934a(0xf1)](_0x319071)[_0x3b934a(0xda)](([,_0x1a3d80])=>_0x1a3d80!==undefined));if(Object['keys'](_0xe3f569)[_0x3b934a(0x104)]===0x0)return console['error'](_0x3b934a(0x112)),console[_0x3b934a(0xe2)](_0x3b934a(0x13e)),0x1;const _0x5c475a=await withSpinner('Updating\x20template\x20\x27'+_0x767d21+_0x3b934a(0xe1),()=>_0x209ac1['engage'][_0x3b934a(0x159)](_0x767d21,_0xe3f569,_0x223e53),{'verbose':_0x182c10['verbose']});return await handleSDKOutput([_0x5c475a[_0x3b934a(0x123)]],_0x182c10),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x12c);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xef);async[a23_0x4c52ea(0xf7)](_0x1ab2b9){const _0x1cfe57=a23_0x4c52ea,{options:_0x520433,args:_0xbd855e,tdx:_0x48f7a5}=_0x1ab2b9;if(_0xbd855e[_0x1cfe57(0x104)]===0x0)return console[_0x1cfe57(0xe2)](_0x1cfe57(0xf6)),console['error']('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x53ce28=_0xbd855e[0x0],_0x2b4c48=_0x520433,_0x4f8b5a=await resolveWorkspaceIdFromOptions(_0x2b4c48,_0x48f7a5);if(!_0x520433[_0x1cfe57(0xce)]){const _0x2409e9=await confirm(_0x1cfe57(0x138)+_0x53ce28+_0x1cfe57(0x12b));if(!_0x2409e9)return console[_0x1cfe57(0xde)](_0x1cfe57(0x14c)),0x0;}return await withSpinner(_0x1cfe57(0x153)+_0x53ce28+'\x27...',()=>_0x48f7a5[_0x1cfe57(0x143)][_0x1cfe57(0x154)](_0x53ce28,_0x4f8b5a),{'verbose':_0x520433[_0x1cfe57(0x114)]}),console[_0x1cfe57(0xde)]('Template\x20\x27'+_0x53ce28+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x140);['description']=a23_0x4c52ea(0xf8);async[a23_0x4c52ea(0xf7)](_0xe90340){const _0x22b979=a23_0x4c52ea,{options:_0x5b6c5a,args:_0x4decde,tdx:_0x51f190}=_0xe90340,_0x15171f=_0x4decde[0x0],_0x256d3d=resolveLimit(_0x5b6c5a['limit'],DEFAULT_LLM_LIMIT),_0x327d31=await withSpinner(_0x22b979(0x155),()=>_0x51f190[_0x22b979(0x143)][_0x22b979(0xd6)]({'limit':_0x256d3d}),{'verbose':_0x5b6c5a[_0x22b979(0x114)]});let _0x4b075d=_0x327d31[_0x22b979(0x123)];return _0x15171f&&(_0x4b075d=_0x327d31[_0x22b979(0x123)]['filter'](_0x17a506=>matchGlobPattern(_0x17a506['name'],_0x15171f))),await handleSDKOutput(_0x4b075d,_0x5b6c5a),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xf5);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0x12f);async['execute'](_0x4bcb41){const _0x4a5e22=a23_0x4c52ea,{options:_0x4487de,args:_0x2aed8b,tdx:_0x421d4e}=_0x4bcb41;if(_0x2aed8b[_0x4a5e22(0x104)]===0x0)return console[_0x4a5e22(0xe2)](_0x4a5e22(0x126)),console[_0x4a5e22(0xe2)](_0x4a5e22(0x156)),0x1;const _0x1c6310=_0x2aed8b[0x0],_0x506972=_0x4487de,_0x330fda=_0x506972[_0x4a5e22(0x124)];if(_0x330fda){const _0x1aad4b=await withSpinner(_0x4a5e22(0x100)+_0x1c6310+_0x4a5e22(0xe1),()=>_0x421d4e[_0x4a5e22(0x143)][_0x4a5e22(0xe4)](_0x1c6310),{'verbose':_0x4487de['verbose']});await handleSDKOutput([_0x1aad4b],_0x4487de);}else{const _0xce2540=await withSpinner('Fetching\x20workspace\x20\x27'+_0x1c6310+_0x4a5e22(0xe1),()=>_0x421d4e[_0x4a5e22(0x143)][_0x4a5e22(0x13d)](_0x1c6310),{'verbose':_0x4487de[_0x4a5e22(0x114)]});await handleSDKOutput([_0xce2540],_0x4487de);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a23_0x4c52ea(0x150);['description']='Create\x20a\x20workspace';async[a23_0x4c52ea(0xf7)](_0x4499cd){const _0x471dab=a23_0x4c52ea,{options:_0x15bbea,tdx:_0x1d07d7}=_0x4499cd,_0x5c43e4=_0x15bbea,_0x4a0fba=_0x5c43e4[_0x471dab(0x10b)];if(!_0x4a0fba)return console[_0x471dab(0xe2)]('Error:\x20--name\x20is\x20required'),console[_0x471dab(0xe2)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x16c913={'name':_0x4a0fba,'description':_0x5c43e4[_0x471dab(0x11f)]},_0x3578ee=await withSpinner(_0x471dab(0xf3)+_0x4a0fba+_0x471dab(0xe1),()=>_0x1d07d7[_0x471dab(0x143)][_0x471dab(0x11d)](_0x16c913));return await handleSDKOutput([_0x3578ee[_0x471dab(0x123)]],_0x15bbea),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x13c);[a23_0x4c52ea(0x11f)]='Update\x20a\x20workspace';async['execute'](_0x26fdb8){const _0x577e0d=a23_0x4c52ea,{options:_0x596285,args:_0x2cc556,tdx:_0x4306f6}=_0x26fdb8;if(_0x2cc556['length']===0x0)return console['error'](_0x577e0d(0x126)),console[_0x577e0d(0xe2)](_0x577e0d(0x139)),0x1;const _0x8afc50=_0x2cc556[0x0],_0x4c9487=_0x596285,_0x1a40f9={'name':_0x4c9487[_0x577e0d(0x10b)],'description':_0x4c9487[_0x577e0d(0x11f)]},_0x20af8d=Object[_0x577e0d(0x147)](Object['entries'](_0x1a40f9)[_0x577e0d(0xda)](([,_0x236702])=>_0x236702!==undefined));if(Object[_0x577e0d(0x14b)](_0x20af8d)['length']===0x0)return console[_0x577e0d(0xe2)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x577e0d(0xe2)](_0x577e0d(0xdd)),0x1;const _0x1fa531=await withSpinner('Updating\x20workspace\x20\x27'+_0x8afc50+'\x27...',()=>_0x4306f6['engage'][_0x577e0d(0x107)](_0x8afc50,_0x20af8d),{'verbose':_0x596285[_0x577e0d(0x114)]});return await handleSDKOutput([_0x1fa531[_0x577e0d(0x123)]],_0x596285),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0x103);[a23_0x4c52ea(0x11f)]=a23_0x4c52ea(0xd9);async[a23_0x4c52ea(0xf7)](_0x20c894){const _0x2ded36=a23_0x4c52ea,{options:_0x457db5,args:_0x1c234a,tdx:_0x4597cd}=_0x20c894;if(_0x1c234a[_0x2ded36(0x104)]===0x0)return console[_0x2ded36(0xe2)](_0x2ded36(0x126)),console['error'](_0x2ded36(0xdf)),0x1;const _0x324395=_0x1c234a[0x0];if(!_0x457db5[_0x2ded36(0xce)]){const _0x302c93=await confirm(_0x2ded36(0x109)+_0x324395+_0x2ded36(0x12b));if(!_0x302c93)return console[_0x2ded36(0xde)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x2ded36(0x152)+_0x324395+'\x27...',()=>_0x4597cd[_0x2ded36(0x143)][_0x2ded36(0xe6)](_0x324395),{'verbose':_0x457db5[_0x2ded36(0x114)]}),console[_0x2ded36(0xde)]('Workspace\x20\x27'+_0x324395+_0x2ded36(0x137)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0x4c52ea(0x10b)]=a23_0x4c52ea(0xee);['description']=a23_0x4c52ea(0x146);async[a23_0x4c52ea(0xf7)](_0x29bbcb){const _0x498894=a23_0x4c52ea,{options:_0x237d21,args:_0x259f83,tdx:_0x1724da}=_0x29bbcb;if(_0x259f83[_0x498894(0x104)]===0x0)return console['error'](_0x498894(0xf9)),console[_0x498894(0xe2)](_0x498894(0xfe)),0x1;const _0x487405=_0x259f83[0x0];await withSpinner(_0x498894(0x10a)+_0x487405+_0x498894(0xe1),()=>_0x1724da[_0x498894(0x143)][_0x498894(0xdc)](_0x487405));const _0x1596f5=_0x237d21[_0x498894(0x12e)]||undefined;return saveSessionContext({'engage_workspace':_0x487405},_0x1596f5),console[_0x498894(0xde)]('Engage\x20workspace\x20set\x20to:\x20'+_0x487405),console[_0x498894(0xde)]('\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a24_0x4527(_0x4df4fc,_0x6ff18){_0x4df4fc=_0x4df4fc-0x6e;const _0x2e7173=a24_0x2e71();let _0x4527d7=_0x2e7173[_0x4df4fc];return _0x4527d7;}const a24_0x10b94f=a24_0x4527;(function(_0x3c51b0,_0x3d58e9){const _0x381417=a24_0x4527,_0x423a7a=_0x3c51b0();while(!![]){try{const _0x30cf23=-parseInt(_0x381417(0xa5))/0x1+parseInt(_0x381417(0x74))/0x2*(-parseInt(_0x381417(0x8c))/0x3)+-parseInt(_0x381417(0x7e))/0x4*(-parseInt(_0x381417(0xb6))/0x5)+-parseInt(_0x381417(0x6f))/0x6*(-parseInt(_0x381417(0x71))/0x7)+-parseInt(_0x381417(0xb5))/0x8+-parseInt(_0x381417(0x7b))/0x9+-parseInt(_0x381417(0x9d))/0xa*(-parseInt(_0x381417(0x9f))/0xb);if(_0x30cf23===_0x3d58e9)break;else _0x423a7a['push'](_0x423a7a['shift']());}catch(_0x3cfa2b){_0x423a7a['push'](_0x423a7a['shift']());}}}(a24_0x2e71,0xb0e8c));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';function a24_0x2e71(){const _0x774da4=['Getting\x20job\x20results...','round','\x20job','query','\x20\x20Job\x20ID:\x20','cause','information_schema','type','Show\x20job\x20details','job:show','1134021gluOaj','Query:\x20','yes','debug','Database:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','job_id','\x20jobs','created_at','getTime','Error:\x20Job\x20ID\x20is\x20required','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','name','...','jobs','result','Error:\x20Query\x20is\x20required','1480YQRRiR','\x20\x20Cause:\x20','132847ZHNaal','data','List\x20jobs','Usage:\x20job\x20show\x20<job-id>','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Cancelled','599369TaLVRL','job:kill','Submit\x20a\x20job','url','Listing\x20jobs...','jobType','hive','error','trino','substring','length','\x27\x20to\x20verify\x20the\x20job\x20status','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Usage:\x20job\x20kill\x20<job-id>','database','show','1208272UUkktD','305HCONIL','file','status','job:submit','Error:\x20','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','user_name','Kill\x20a\x20job','execute','3378viHGHb','priority','1421nfnFjI','job:result','message','2RIvrai','verbose','✔\x20Job\x20submitted','✔\x20Retrieved\x20','start_at','end_at','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','3555666gQDqSl','description','Getting\x20job\x20details...','22716nHjUXX','kill','Status\x20filter:\x20','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'];a24_0x2e71=function(){return _0x774da4;};return a24_0x2e71();}import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x10b94f(0x98)]='jobs';[a24_0x10b94f(0x7c)]=a24_0x10b94f(0xa1);async[a24_0x10b94f(0x6e)](_0x566b3e){const _0x3b293b=a24_0x10b94f,{options:_0x251657,tdx:_0x598905}=_0x566b3e;try{const _0x7c853c=resolveLimit(_0x251657['limit'],DEFAULT_DISPLAY_LIMIT),_0x47a7f7=_0x251657[_0x3b293b(0xb8)];_0x251657[_0x3b293b(0x75)]&&(console[_0x3b293b(0xac)]('Limit:\x20'+_0x7c853c+_0x3b293b(0x93)),_0x47a7f7&&console[_0x3b293b(0xac)](_0x3b293b(0x80)+_0x47a7f7));const _0x58ec2e=await withSpinner(_0x3b293b(0xa9),()=>_0x598905[_0x3b293b(0x9a)]['list']({'from':0x0,'to':_0x7c853c-0x1,'status':_0x47a7f7}),{'verbose':_0x251657[_0x3b293b(0x75)]}),_0x5dbfe9=_0x58ec2e[_0x3b293b(0xa0)];console['error']('✔\x20Found\x20'+_0x5dbfe9[_0x3b293b(0xaf)]+_0x3b293b(0x84)+(_0x5dbfe9[_0x3b293b(0xaf)]!==0x1?'s':''));const _0x2e6b81=_0x5dbfe9['map'](_0x2a95da=>{const _0x4ebe92=_0x3b293b;let _0x52477f;if(_0x2a95da[_0x4ebe92(0x78)]&&_0x2a95da[_0x4ebe92(0x79)]){const _0x4d5224=new Date(_0x2a95da['start_at'])[_0x4ebe92(0x95)](),_0x343db2=new Date(_0x2a95da[_0x4ebe92(0x79)])['getTime']();_0x52477f=Math[_0x4ebe92(0x83)]((_0x343db2-_0x4d5224)/0x3e8);}return{'job_id':_0x2a95da[_0x4ebe92(0x92)],'type':_0x2a95da[_0x4ebe92(0x89)],'status':_0x2a95da[_0x4ebe92(0xb8)],'user_name':_0x2a95da[_0x4ebe92(0xbc)],'duration_sec':_0x52477f,'created_at':_0x2a95da['created_at'],'started_at':_0x2a95da[_0x4ebe92(0x78)],'end_at':_0x2a95da[_0x4ebe92(0x79)]};});return await handleSDKOutput(_0x2e6b81,_0x251657),0x0;}catch(_0x2667b7){if(_0x2667b7 instanceof SDKError)return console[_0x3b293b(0xac)]('Error:\x20'+_0x2667b7[_0x3b293b(0x73)]),_0x2667b7[_0x3b293b(0x87)]&&console[_0x3b293b(0xac)](_0x3b293b(0x9e)+_0x2667b7[_0x3b293b(0x87)]),0x1;throw _0x2667b7;}}}export class JobShowCommand extends BaseCommand{[a24_0x10b94f(0x98)]=a24_0x10b94f(0x8b);['description']=a24_0x10b94f(0x8a);async[a24_0x10b94f(0x6e)](_0x1ec3d8){const _0x4693f2=a24_0x10b94f,{options:_0x41df76,args:_0x30ddd6,tdx:_0x4300a7}=_0x1ec3d8,_0x6c9bca=_0x30ddd6[0x0];if(!_0x6c9bca)return console['error'](_0x4693f2(0x96)),console['error'](_0x4693f2(0xa2)),0x1;try{const _0x3ba9e3=await withSpinner(_0x4693f2(0x7d),()=>_0x4300a7[_0x4693f2(0x9a)][_0x4693f2(0xb4)](_0x6c9bca),{'verbose':_0x41df76[_0x4693f2(0x75)]}),_0x3be2e1=_0x3ba9e3[_0x4693f2(0xa0)];let _0xf8bbab;if(_0x3be2e1['start_at']&&_0x3be2e1[_0x4693f2(0x79)]){const _0x50b007=new Date(_0x3be2e1[_0x4693f2(0x78)])[_0x4693f2(0x95)](),_0x18b653=new Date(_0x3be2e1[_0x4693f2(0x79)])[_0x4693f2(0x95)]();_0xf8bbab=Math[_0x4693f2(0x83)]((_0x18b653-_0x50b007)/0x3e8);}const _0x49238e={'job_id':_0x3be2e1[_0x4693f2(0x92)],'type':_0x3be2e1['type'],'status':_0x3be2e1['status'],..._0x3be2e1[_0x4693f2(0xbc)]&&{'user_name':_0x3be2e1[_0x4693f2(0xbc)]},..._0xf8bbab!==undefined&&{'duration_sec':_0xf8bbab},..._0x3be2e1[_0x4693f2(0x94)]&&{'created_at':_0x3be2e1['created_at']},..._0x3be2e1['start_at']&&{'started_at':_0x3be2e1[_0x4693f2(0x78)]},..._0x3be2e1[_0x4693f2(0x79)]&&{'end_at':_0x3be2e1['end_at']},..._0x3be2e1[_0x4693f2(0xb3)]&&{'database':_0x3be2e1[_0x4693f2(0xb3)]},..._0x3be2e1['priority']!==undefined&&{'priority':_0x3be2e1[_0x4693f2(0x70)]},..._0x3be2e1['url']&&{'url':_0x3be2e1[_0x4693f2(0xa8)]},..._0x3be2e1[_0x4693f2(0x85)]&&{'query':_0x3be2e1[_0x4693f2(0x85)]},..._0x3be2e1[_0x4693f2(0x8f)]&&{'debug':_0x3be2e1[_0x4693f2(0x8f)]}};return await handleSingleObjectOutput(_0x49238e,_0x41df76),0x0;}catch(_0x54956d){if(_0x54956d instanceof SDKError)return console[_0x4693f2(0xac)](_0x4693f2(0xba)+_0x54956d[_0x4693f2(0x73)]),_0x54956d['cause']&&console[_0x4693f2(0xac)](_0x4693f2(0x9e)+_0x54956d[_0x4693f2(0x87)]),0x1;throw _0x54956d;}}}export class JobKillCommand extends BaseCommand{['name']=a24_0x10b94f(0xa6);['description']=a24_0x10b94f(0xbd);async['execute'](_0x37227d){const _0x52aa35=a24_0x10b94f,{options:_0x21ac37,args:_0x579407,tdx:_0x157ea1}=_0x37227d,_0x589815=_0x579407[0x0];if(!_0x589815)return console[_0x52aa35(0xac)](_0x52aa35(0x96)),console[_0x52aa35(0xac)](_0x52aa35(0xb2)),0x1;try{if(!_0x21ac37[_0x52aa35(0x8e)]){const _0x5b29c8=await confirm(_0x52aa35(0x91)+_0x589815+'?');if(!_0x5b29c8)return console['error'](_0x52aa35(0xa4)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x157ea1[_0x52aa35(0x9a)][_0x52aa35(0x7f)](_0x589815),{'verbose':_0x21ac37[_0x52aa35(0x75)]}),console[_0x52aa35(0xac)](_0x52aa35(0x97)+_0x589815),console[_0x52aa35(0xac)](_0x52aa35(0xbb)+_0x589815+_0x52aa35(0xb0)),0x0;}catch(_0x3bc4b7){if(_0x3bc4b7 instanceof SDKError)return console[_0x52aa35(0xac)]('Error:\x20'+_0x3bc4b7[_0x52aa35(0x73)]),_0x3bc4b7[_0x52aa35(0x87)]&&console[_0x52aa35(0xac)](_0x52aa35(0x9e)+_0x3bc4b7[_0x52aa35(0x87)]),0x1;throw _0x3bc4b7;}}}export class JobSubmitCommand extends BaseCommand{[a24_0x10b94f(0x98)]=a24_0x10b94f(0xb9);['description']=a24_0x10b94f(0xa7);async['execute'](_0xc41ce5){const _0x43ca0d=a24_0x10b94f,{options:_0x5d04f8,args:_0x78b68c,tdx:_0x4d288e}=_0xc41ce5;try{const _0x2bd7fc=_0x5d04f8[_0x43ca0d(0xaa)]||'trino',_0x2b0717=_0x5d04f8[_0x43ca0d(0xb7)],_0x17df24=_0x5d04f8['database']||_0x43ca0d(0x88);if(_0x2bd7fc!==_0x43ca0d(0xad)&&_0x2bd7fc!==_0x43ca0d(0xab))return console[_0x43ca0d(0xac)](_0x43ca0d(0x7a)),0x1;let _0x43be03;if(_0x2b0717){if(_0x78b68c[0x0])return console[_0x43ca0d(0xac)](_0x43ca0d(0xa3)),0x1;const _0x13e6d7=readSqlStatementsFromFile(_0x2b0717);if(_0x13e6d7[_0x43ca0d(0xaf)]===0x0)return console[_0x43ca0d(0xac)](_0x43ca0d(0xb1)),0x1;if(_0x13e6d7[_0x43ca0d(0xaf)]>0x1)return console[_0x43ca0d(0xac)](_0x43ca0d(0x81)),0x1;_0x43be03=_0x13e6d7[0x0];}else{if(!_0x78b68c[0x0])return console[_0x43ca0d(0xac)](_0x43ca0d(0x9c)),console[_0x43ca0d(0xac)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x43be03=_0x78b68c[0x0];}_0x5d04f8[_0x43ca0d(0x75)]&&(console[_0x43ca0d(0xac)]('Job\x20type:\x20'+_0x2bd7fc),console['error'](_0x43ca0d(0x90)+_0x17df24),console[_0x43ca0d(0xac)](_0x43ca0d(0x8d)+_0x43be03[_0x43ca0d(0xae)](0x0,0x64)+(_0x43be03[_0x43ca0d(0xaf)]>0x64?_0x43ca0d(0x99):'')));const _0x2d505c=await withSpinner('Submitting\x20job...',()=>_0x4d288e[_0x43ca0d(0x9a)]['submit'](_0x17df24,_0x43be03,_0x2bd7fc),{'verbose':_0x5d04f8[_0x43ca0d(0x75)]}),_0x3e8fd0=_0x2d505c[_0x43ca0d(0xa0)];return console[_0x43ca0d(0xac)](_0x43ca0d(0x76)),console['error'](_0x43ca0d(0x86)+_0x3e8fd0[_0x43ca0d(0x92)]),await handleSDKOutput([_0x3e8fd0],_0x5d04f8),0x0;}catch(_0x41b621){if(_0x41b621 instanceof SDKError)return console[_0x43ca0d(0xac)]('Error:\x20'+_0x41b621[_0x43ca0d(0x73)]),_0x41b621['cause']&&console['error'](_0x43ca0d(0x9e)+_0x41b621[_0x43ca0d(0x87)]),0x1;throw _0x41b621;}}}export class JobResultCommand extends BaseCommand{[a24_0x10b94f(0x98)]=a24_0x10b94f(0x72);['description']='Get\x20job\x20results';async['execute'](_0x359ed8){const _0x18f29a=a24_0x10b94f,{options:_0x37e964,args:_0x3d3252,tdx:_0x1a2cde}=_0x359ed8,_0x1f6ca6=_0x3d3252[0x0];if(!_0x1f6ca6)return console['error'](_0x18f29a(0x96)),console[_0x18f29a(0xac)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0xf849ca=await withSpinner(_0x18f29a(0x82),()=>_0x1a2cde[_0x18f29a(0x9a)][_0x18f29a(0x9b)](_0x1f6ca6),{'verbose':_0x37e964[_0x18f29a(0x75)]}),_0x25262e=_0xf849ca['data'];return console[_0x18f29a(0xac)](_0x18f29a(0x77)+_0x25262e[_0x18f29a(0xaf)]+'\x20row'+(_0x25262e['length']!==0x1?'s':'')),await handleSDKOutput(_0x25262e,_0x37e964),0x0;}catch(_0x5d0ee0){if(_0x5d0ee0 instanceof SDKError)return console[_0x18f29a(0xac)](_0x18f29a(0xba)+_0x5d0ee0[_0x18f29a(0x73)]),_0x5d0ee0[_0x18f29a(0x87)]&&console[_0x18f29a(0xac)](_0x18f29a(0x9e)+_0x5d0ee0[_0x18f29a(0x87)]),0x1;throw _0x5d0ee0;}}}
|
|
1
|
+
const a24_0x4a821b=a24_0x4f4f;(function(_0x4604c7,_0x3bb804){const _0x5d5df5=a24_0x4f4f,_0x2bc1ad=_0x4604c7();while(!![]){try{const _0x9fa087=-parseInt(_0x5d5df5(0x1d0))/0x1+-parseInt(_0x5d5df5(0x1fc))/0x2+-parseInt(_0x5d5df5(0x200))/0x3+-parseInt(_0x5d5df5(0x1c3))/0x4*(parseInt(_0x5d5df5(0x1f1))/0x5)+-parseInt(_0x5d5df5(0x208))/0x6+parseInt(_0x5d5df5(0x1cf))/0x7*(-parseInt(_0x5d5df5(0x1c6))/0x8)+parseInt(_0x5d5df5(0x1e9))/0x9;if(_0x9fa087===_0x3bb804)break;else _0x2bc1ad['push'](_0x2bc1ad['shift']());}catch(_0xbf4732){_0x2bc1ad['push'](_0x2bc1ad['shift']());}}}(a24_0x3932,0xecaa2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]='jobs';['description']=a24_0x4a821b(0x209);async['execute'](_0x5a2bb8){const _0x461fa7=a24_0x4a821b,{options:_0x30d8a9,tdx:_0x47febc}=_0x5a2bb8;try{const _0x159e5a=resolveLimit(_0x30d8a9[_0x461fa7(0x1d2)],DEFAULT_DISPLAY_LIMIT),_0xb76334=_0x30d8a9['status'];_0x30d8a9[_0x461fa7(0x203)]&&(console[_0x461fa7(0x1e6)]('Limit:\x20'+_0x159e5a+_0x461fa7(0x1ca)),_0xb76334&&console[_0x461fa7(0x1e6)](_0x461fa7(0x1dd)+_0xb76334));const _0x54ef3f=await withSpinner(_0x461fa7(0x1f8),()=>_0x47febc[_0x461fa7(0x1fb)][_0x461fa7(0x206)]({'from':0x0,'to':_0x159e5a-0x1,'status':_0xb76334}),{'verbose':_0x30d8a9[_0x461fa7(0x203)]}),_0xbb77f6=_0x54ef3f[_0x461fa7(0x1d6)];console[_0x461fa7(0x1e6)]('✔\x20Found\x20'+_0xbb77f6[_0x461fa7(0x1e2)]+_0x461fa7(0x1f0)+(_0xbb77f6[_0x461fa7(0x1e2)]!==0x1?'s':''));const _0x5e7114=_0xbb77f6['map'](_0x5e2299=>{const _0x485c63=_0x461fa7;let _0x5bb7db;if(_0x5e2299['start_at']&&_0x5e2299[_0x485c63(0x201)]){const _0x22fcd6=new Date(_0x5e2299[_0x485c63(0x204)])[_0x485c63(0x1ed)](),_0x508ec5=new Date(_0x5e2299[_0x485c63(0x201)])[_0x485c63(0x1ed)]();_0x5bb7db=Math[_0x485c63(0x1f3)]((_0x508ec5-_0x22fcd6)/0x3e8);}return{'job_id':_0x5e2299['job_id'],'type':_0x5e2299[_0x485c63(0x1e3)],'status':_0x5e2299[_0x485c63(0x207)],'user_name':_0x5e2299['user_name'],'duration_sec':_0x5bb7db,'created_at':_0x5e2299[_0x485c63(0x1fe)],'started_at':_0x5e2299['start_at'],'end_at':_0x5e2299[_0x485c63(0x201)]};});return await handleSDKOutput(_0x5e7114,_0x30d8a9),0x0;}catch(_0x32bca7){if(_0x32bca7 instanceof SDKError)return console[_0x461fa7(0x1e6)](_0x461fa7(0x1e1)+_0x32bca7[_0x461fa7(0x1ea)]),_0x32bca7[_0x461fa7(0x1d1)]&&console['error'](_0x461fa7(0x1e4)+_0x32bca7[_0x461fa7(0x1d1)]),0x1;throw _0x32bca7;}}}function a24_0x4f4f(_0x33b1fc,_0x61380c){_0x33b1fc=_0x33b1fc-0x1bf;const _0x393266=a24_0x3932();let _0x4f4f5f=_0x393266[_0x33b1fc];return _0x4f4f5f;}export class JobShowCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1e8);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1cd);async[a24_0x4a821b(0x1bf)](_0x5bdd52){const _0x4aada3=a24_0x4a821b,{options:_0x37c61b,args:_0x11d76c,tdx:_0x3fea05}=_0x5bdd52,_0xf581ad=_0x11d76c[0x0];if(!_0xf581ad)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0x4aada3(0x1e6)](_0x4aada3(0x20b)),0x1;try{const _0x44a2c0=await withSpinner('Getting\x20job\x20details...',()=>_0x3fea05[_0x4aada3(0x1fb)]['show'](_0xf581ad),{'verbose':_0x37c61b['verbose']}),_0x49a3ed=_0x44a2c0['data'];let _0x2265e7;if(_0x49a3ed[_0x4aada3(0x204)]&&_0x49a3ed[_0x4aada3(0x201)]){const _0x3c35bd=new Date(_0x49a3ed[_0x4aada3(0x204)])[_0x4aada3(0x1ed)](),_0x37c771=new Date(_0x49a3ed[_0x4aada3(0x201)])[_0x4aada3(0x1ed)]();_0x2265e7=Math[_0x4aada3(0x1f3)]((_0x37c771-_0x3c35bd)/0x3e8);}const _0x3f2911={'job_id':_0x49a3ed[_0x4aada3(0x1dc)],'type':_0x49a3ed['type'],'status':_0x49a3ed[_0x4aada3(0x207)],..._0x49a3ed[_0x4aada3(0x1ce)]&&{'user_name':_0x49a3ed[_0x4aada3(0x1ce)]},..._0x2265e7!==undefined&&{'duration_sec':_0x2265e7},..._0x49a3ed[_0x4aada3(0x1fe)]&&{'created_at':_0x49a3ed[_0x4aada3(0x1fe)]},..._0x49a3ed[_0x4aada3(0x204)]&&{'started_at':_0x49a3ed[_0x4aada3(0x204)]},..._0x49a3ed[_0x4aada3(0x201)]&&{'end_at':_0x49a3ed[_0x4aada3(0x201)]},..._0x49a3ed[_0x4aada3(0x20d)]&&{'database':_0x49a3ed['database']},..._0x49a3ed[_0x4aada3(0x1ef)]!==undefined&&{'priority':_0x49a3ed[_0x4aada3(0x1ef)]},..._0x49a3ed['url']&&{'url':_0x49a3ed['url']},..._0x49a3ed[_0x4aada3(0x1f7)]&&{'query':_0x49a3ed[_0x4aada3(0x1f7)]},..._0x49a3ed['debug']&&{'debug':_0x49a3ed[_0x4aada3(0x1c1)]}};return await handleSingleObjectOutput(_0x3f2911,_0x37c61b),0x0;}catch(_0x148e57){if(_0x148e57 instanceof SDKError)return console[_0x4aada3(0x1e6)](_0x4aada3(0x1e1)+_0x148e57['message']),_0x148e57[_0x4aada3(0x1d1)]&&console[_0x4aada3(0x1e6)](_0x4aada3(0x1e4)+_0x148e57[_0x4aada3(0x1d1)]),0x1;throw _0x148e57;}}}export class JobKillCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1cb);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1c9);async[a24_0x4a821b(0x1bf)](_0x31b785){const _0x564724=a24_0x4a821b,{options:_0x133e0a,args:_0x1706ad,tdx:_0x332a99}=_0x31b785,_0x4292b7=_0x1706ad[0x0];if(!_0x4292b7)return console[_0x564724(0x1e6)](_0x564724(0x1de)),console[_0x564724(0x1e6)]('Usage:\x20job\x20kill\x20<job-id>'),0x1;try{if(!_0x133e0a['yes']){const _0x33206f=await confirm(_0x564724(0x1fa)+_0x4292b7+'?');if(!_0x33206f)return console['error'](_0x564724(0x1d7)),0x0;}return await withSpinner(_0x564724(0x1d9),()=>_0x332a99[_0x564724(0x1fb)][_0x564724(0x1f6)](_0x4292b7),{'verbose':_0x133e0a[_0x564724(0x203)]}),console[_0x564724(0x1e6)]('✔\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0x4292b7),console[_0x564724(0x1e6)](_0x564724(0x1e0)+_0x4292b7+_0x564724(0x1db)),0x0;}catch(_0x4eca4c){if(_0x4eca4c instanceof SDKError)return console[_0x564724(0x1e6)]('Error:\x20'+_0x4eca4c[_0x564724(0x1ea)]),_0x4eca4c[_0x564724(0x1d1)]&&console[_0x564724(0x1e6)](_0x564724(0x1e4)+_0x4eca4c[_0x564724(0x1d1)]),0x1;throw _0x4eca4c;}}}function a24_0x3932(){const _0x528722=['Error:\x20Job\x20ID\x20is\x20required','Submit\x20a\x20job','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Error:\x20','length','type','\x20\x20Cause:\x20','\x20row','error','✔\x20Job\x20submitted','job:show','76523238apSvAg','message','description','Submitting\x20job...','getTime','hive','priority','\x20job','55RuemZr','information_schema','round','jobType','Query:\x20','kill','query','Listing\x20jobs...','Getting\x20job\x20results...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','jobs','1969994YgAxpu','result','created_at','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','1698258GPTctk','end_at','trino','verbose','start_at','Database:\x20','list','status','5626314EQAziC','List\x20jobs','Job\x20type:\x20','Usage:\x20job\x20show\x20<job-id>','Error:\x20Query\x20is\x20required','database','execute','Usage:\x20job\x20result\x20<job-id>','debug','Get\x20job\x20results','685532BRXeDO','job:submit','submit','13093368oQcJaO','✔\x20Retrieved\x20','job:result','Kill\x20a\x20job','\x20jobs','job:kill','\x20\x20Job\x20ID:\x20','Show\x20job\x20details','user_name','7AHHeuR','1522518jkTgqT','cause','limit','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','file','substring','data','Cancelled','name','Submitting\x20kill\x20request...','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','\x27\x20to\x20verify\x20the\x20job\x20status','job_id','Status\x20filter:\x20'];a24_0x3932=function(){return _0x528722;};return a24_0x3932();}export class JobSubmitCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1c4);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1df);async[a24_0x4a821b(0x1bf)](_0x1b5a62){const _0x48c260=a24_0x4a821b,{options:_0x39988a,args:_0x14dc8d,tdx:_0x950484}=_0x1b5a62;try{const _0x4625f7=_0x39988a[_0x48c260(0x1f4)]||_0x48c260(0x202),_0x50b90b=_0x39988a[_0x48c260(0x1d4)],_0x2b724c=_0x39988a[_0x48c260(0x20d)]||_0x48c260(0x1f2);if(_0x4625f7!==_0x48c260(0x202)&&_0x4625f7!==_0x48c260(0x1ee))return console[_0x48c260(0x1e6)]('Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22'),0x1;let _0x5e1d7f;if(_0x50b90b){if(_0x14dc8d[0x0])return console['error'](_0x48c260(0x1d3)),0x1;const _0x5ddf19=readSqlStatementsFromFile(_0x50b90b);if(_0x5ddf19[_0x48c260(0x1e2)]===0x0)return console[_0x48c260(0x1e6)](_0x48c260(0x1ff)),0x1;if(_0x5ddf19[_0x48c260(0x1e2)]>0x1)return console[_0x48c260(0x1e6)](_0x48c260(0x1da)),0x1;_0x5e1d7f=_0x5ddf19[0x0];}else{if(!_0x14dc8d[0x0])return console[_0x48c260(0x1e6)](_0x48c260(0x20c)),console[_0x48c260(0x1e6)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x5e1d7f=_0x14dc8d[0x0];}_0x39988a['verbose']&&(console[_0x48c260(0x1e6)](_0x48c260(0x20a)+_0x4625f7),console[_0x48c260(0x1e6)](_0x48c260(0x205)+_0x2b724c),console[_0x48c260(0x1e6)](_0x48c260(0x1f5)+_0x5e1d7f[_0x48c260(0x1d5)](0x0,0x64)+(_0x5e1d7f[_0x48c260(0x1e2)]>0x64?'...':'')));const _0x2ed5dc=await withSpinner(_0x48c260(0x1ec),()=>_0x950484[_0x48c260(0x1fb)][_0x48c260(0x1c5)](_0x2b724c,_0x5e1d7f,_0x4625f7),{'verbose':_0x39988a[_0x48c260(0x203)]}),_0x18fc56=_0x2ed5dc[_0x48c260(0x1d6)];return console['error'](_0x48c260(0x1e7)),console[_0x48c260(0x1e6)](_0x48c260(0x1cc)+_0x18fc56['job_id']),await handleSDKOutput([_0x18fc56],_0x39988a),0x0;}catch(_0x3d3c68){if(_0x3d3c68 instanceof SDKError)return console['error']('Error:\x20'+_0x3d3c68['message']),_0x3d3c68[_0x48c260(0x1d1)]&&console[_0x48c260(0x1e6)](_0x48c260(0x1e4)+_0x3d3c68[_0x48c260(0x1d1)]),0x1;throw _0x3d3c68;}}}export class JobResultCommand extends BaseCommand{[a24_0x4a821b(0x1d8)]=a24_0x4a821b(0x1c8);[a24_0x4a821b(0x1eb)]=a24_0x4a821b(0x1c2);async[a24_0x4a821b(0x1bf)](_0x546ac3){const _0x2104a3=a24_0x4a821b,{options:_0x2d3a66,args:_0x48cc0d,tdx:_0x5af2f0}=_0x546ac3,_0x4d4112=_0x48cc0d[0x0];if(!_0x4d4112)return console[_0x2104a3(0x1e6)](_0x2104a3(0x1de)),console['error'](_0x2104a3(0x1c0)),0x1;try{const _0x274e68=await withSpinner(_0x2104a3(0x1f9),()=>_0x5af2f0[_0x2104a3(0x1fb)][_0x2104a3(0x1fd)](_0x4d4112),{'verbose':_0x2d3a66[_0x2104a3(0x203)]}),_0x13ca56=_0x274e68[_0x2104a3(0x1d6)];return console[_0x2104a3(0x1e6)](_0x2104a3(0x1c7)+_0x13ca56[_0x2104a3(0x1e2)]+_0x2104a3(0x1e5)+(_0x13ca56[_0x2104a3(0x1e2)]!==0x1?'s':'')),await handleSDKOutput(_0x13ca56,_0x2d3a66),0x0;}catch(_0x5a520d){if(_0x5a520d instanceof SDKError)return console['error'](_0x2104a3(0x1e1)+_0x5a520d[_0x2104a3(0x1ea)]),_0x5a520d[_0x2104a3(0x1d1)]&&console['error'](_0x2104a3(0x1e4)+_0x5a520d['cause']),0x1;throw _0x5a520d;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a25_0x29815f=a25_0x5e0b;(function(_0x7c520a,_0x230db0){const _0x32abd5=a25_0x5e0b,_0x39be2e=_0x7c520a();while(!![]){try{const _0x409e49=-parseInt(_0x32abd5(0x71))/0x1+-parseInt(_0x32abd5(0xc3))/0x2*(parseInt(_0x32abd5(0xd8))/0x3)+-parseInt(_0x32abd5(0x7a))/0x4*(parseInt(_0x32abd5(0xc7))/0x5)+-parseInt(_0x32abd5(0xda))/0x6+-parseInt(_0x32abd5(0xf2))/0x7*(-parseInt(_0x32abd5(0xe3))/0x8)+-parseInt(_0x32abd5(0xdb))/0x9+parseInt(_0x32abd5(0x9f))/0xa*(parseInt(_0x32abd5(0x8a))/0xb);if(_0x409e49===_0x230db0)break;else _0x39be2e['push'](_0x39be2e['shift']());}catch(_0x52fbd2){_0x39be2e['push'](_0x39be2e['shift']());}}}(a25_0x513f,0x40f3d));import a25_0x3e565e from'chalk';import a25_0x720d5a from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a25_0x5e0b(_0x31301e,_0xd2dc92){_0x31301e=_0x31301e-0x6e;const _0x513f28=a25_0x513f();let _0x5e0b53=_0x513f28[_0x31301e];return _0x5e0b53;}import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x400df4){const _0x1d6f5a=a25_0x5e0b;switch(_0x400df4){case _0x1d6f5a(0xfb):return a25_0x3e565e[_0x1d6f5a(0xcb)](_0x400df4);case _0x1d6f5a(0x92):return a25_0x3e565e[_0x1d6f5a(0xa8)](_0x400df4);case'archived':return a25_0x3e565e[_0x1d6f5a(0x9c)](_0x400df4);default:return _0x400df4;}}function formatJourneyItem(_0x65df57,_0x545828=''){const _0x2608b8=a25_0x5e0b,_0x39b35f=formatJourneyState(_0x65df57[_0x2608b8(0xcd)]),_0x1ffed9=_0x65df57['paused']?a25_0x3e565e[_0x2608b8(0xf4)](_0x2608b8(0xc2)):'';return _0x545828+'🗺️\x20'+_0x65df57[_0x2608b8(0x8e)]+'\x20('+_0x39b35f+')'+_0x1ffed9;}function escapeRegex(_0x2a87d5){const _0x495909=a25_0x5e0b;return _0x2a87d5[_0x495909(0x85)](/[.*+?^${}()|[\]\\]/g,_0x495909(0x7c));}function globToRegex(_0x2967ba){const _0x42c2ea=a25_0x5e0b,_0x5a1456=_0x2967ba[_0x42c2ea(0xf6)]('*')[_0x42c2ea(0xf9)](escapeRegex);return new RegExp(_0x5a1456[_0x42c2ea(0x83)]('.*'),'i');}function resolveJourneyTarget(_0x7e189a,_0x25428b,_0xc95f95){const _0x110dd9=a25_0x5e0b;if(isYamlFilePath(_0x7e189a))try{const _0x131d6f=resolveYamlFilePath(_0x7e189a);return _0xc95f95&&(console[_0x110dd9(0xab)](_0x110dd9(0xb7)+_0x7e189a),console[_0x110dd9(0xab)](_0x110dd9(0x100)+_0x131d6f[_0x110dd9(0xc9)]),console[_0x110dd9(0xab)](_0x110dd9(0x7b)+_0x131d6f[_0x110dd9(0xc6)]),console['error'](_0x110dd9(0xe6)+(_0x131d6f['folderPath']||_0x110dd9(0xee)))),{'journeyName':_0x131d6f[_0x110dd9(0xc6)],'parentSegment':_0x131d6f['parentSegment'],'resolved':_0x131d6f};}catch(_0x10a1ce){throw new SDKError(ErrorCode[_0x110dd9(0xb3)],_0x110dd9(0xa3)+_0x10a1ce[_0x110dd9(0xc8)]);}if(!_0x25428b)throw new SDKError(ErrorCode[_0x110dd9(0xb3)],_0x110dd9(0xc5));return{'journeyName':_0x7e189a,'parentSegment':_0x25428b};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x29815f(0xff);[a25_0x29815f(0x76)]=a25_0x29815f(0xec);async[a25_0x29815f(0xd4)](_0x545d5a){const _0x4728cf=a25_0x29815f,{options:_0x34a621,args:_0x4aa698,tdx:_0xf703ec}=_0x545d5a,_0x12b0c6=_0x4aa698[0x0],_0x473333=_0x34a621['parentSegment'];if(!_0x473333)return console[_0x4728cf(0xab)](_0x4728cf(0x103)),console['error']('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x2e82af=await withSpinner(_0x4728cf(0x7f),()=>_0xf703ec[_0x4728cf(0x72)][_0x4728cf(0x8b)](_0x473333),{'verbose':_0x34a621['verbose']}),_0x15ca74=_0x2e82af[_0x4728cf(0xe7)];_0x34a621['verbose']&&(console[_0x4728cf(0xab)](_0x4728cf(0x8c)+_0x473333+_0x4728cf(0xb6)+_0x15ca74+')'),_0x12b0c6&&console[_0x4728cf(0xab)]('Pattern:\x20'+_0x12b0c6));const [_0x1bcb48,_0x597764,_0x96cff0]=await Promise['all']([withSpinner('Fetching\x20parent\x20segment...',()=>_0xf703ec[_0x4728cf(0x72)]['getParentFull'](_0x15ca74),{'verbose':_0x34a621['verbose']}),withSpinner(_0x4728cf(0xd9),()=>_0xf703ec['segment']['listFolders'](_0x15ca74),{'verbose':_0x34a621[_0x4728cf(0x95)]}),withSpinner(_0x4728cf(0xfa),()=>_0xf703ec[_0x4728cf(0x73)][_0x4728cf(0xd7)](_0x15ca74),{'verbose':_0x34a621[_0x4728cf(0x95)]})]),_0x3aa19e=_0x1bcb48[_0x4728cf(0xe7)],_0x473643=_0x597764['data'];let _0x22f777=_0x96cff0['data'];const _0x4bb5e1=_0x3aa19e[_0x4728cf(0x89)],_0x2a6e04=new Map();for(const _0x49d0e3 of _0x473643){_0x2a6e04[_0x4728cf(0xac)](_0x49d0e3['id'],_0x49d0e3[_0x4728cf(0xba)]);}if(_0x12b0c6){const _0x2b77e6=globToRegex(_0x12b0c6);_0x22f777=_0x22f777['filter'](_0x3c24b5=>_0x2b77e6['test'](_0x3c24b5[_0x4728cf(0x8e)]));}console['error']('✔\x20Found\x20'+_0x22f777['length']+'\x20journey'+(_0x22f777[_0x4728cf(0xbb)]!==0x1?'s':''));if(_0x34a621['format']===_0x4728cf(0xe9))await handleSDKOutput(_0x22f777,_0x34a621);else{if(_0x34a621['format']===_0x4728cf(0x84))await handleSDKOutput(_0x22f777,_0x34a621);else{console[_0x4728cf(0x88)]('['+_0x473333+']');const _0x1f550c=new Map(),_0x4f3fd8=[];for(const _0x4dcb88 of _0x22f777){if(!_0x4dcb88['folderId']||_0x4dcb88['folderId']===_0x4bb5e1)_0x4f3fd8['push'](_0x4dcb88);else{const _0xd7ccf6=_0x1f550c[_0x4728cf(0xce)](_0x4dcb88[_0x4728cf(0xfe)])||[];_0xd7ccf6['push'](_0x4dcb88),_0x1f550c[_0x4728cf(0xac)](_0x4dcb88[_0x4728cf(0xfe)],_0xd7ccf6);}}for(const _0x484eff of _0x4f3fd8){console[_0x4728cf(0x88)](formatJourneyItem(_0x484eff));}for(const [_0x471bfb,_0x218851]of _0x1f550c){const _0x1ba974=_0x2a6e04[_0x4728cf(0xce)](_0x471bfb)||_0x471bfb;console[_0x4728cf(0x88)](_0x4728cf(0xc4)+_0x1ba974);for(const _0x1e8385 of _0x218851){console['log'](formatJourneyItem(_0x1e8385,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x29815f(0xba)]='journey:view';[a25_0x29815f(0x76)]=a25_0x29815f(0xbf);async['execute'](_0x206488){const _0x2517d6=a25_0x29815f,{options:_0x29ee3b,args:_0x21b823,tdx:_0x8db2e0}=_0x206488,_0x2953ad=_0x21b823[0x0];if(!_0x2953ad)return console[_0x2517d6(0xab)](_0x2517d6(0x97)),console[_0x2517d6(0xab)](_0x2517d6(0xa7)),0x1;_0x29ee3b[_0x2517d6(0x95)]&&console[_0x2517d6(0xab)](_0x2517d6(0x6e)+_0x2953ad);const _0x2790ee=resolveJourneyTarget(_0x2953ad,_0x29ee3b[_0x2517d6(0xc9)],_0x29ee3b[_0x2517d6(0x95)]),_0x293fca=await withSpinner(_0x2517d6(0x7f),()=>_0x8db2e0[_0x2517d6(0x72)][_0x2517d6(0x8b)](_0x2790ee[_0x2517d6(0xc9)]),{'verbose':_0x29ee3b[_0x2517d6(0x95)]}),_0x20e1e7=_0x293fca['data'],_0x409907=await withSpinner(_0x2517d6(0xfc),()=>_0x8db2e0[_0x2517d6(0x73)][_0x2517d6(0xaf)](_0x20e1e7,_0x2790ee[_0x2517d6(0x82)]),{'verbose':_0x29ee3b[_0x2517d6(0x95)]}),_0x1b083f=_0x409907[_0x2517d6(0xe7)],_0x35b506=await withSpinner(_0x2517d6(0xa6),()=>_0x8db2e0[_0x2517d6(0x73)]['getJourney'](_0x1b083f),{'verbose':_0x29ee3b[_0x2517d6(0x95)]}),_0x307dd3=_0x35b506[_0x2517d6(0xe7)],_0x5a5979=_0x29ee3b['includeStats'];let _0x4d0654;if(_0x5a5979)try{const _0x2cab2a=await withSpinner(_0x2517d6(0x93),()=>_0x8db2e0['journey'][_0x2517d6(0xb2)](_0x1b083f),{'verbose':_0x29ee3b[_0x2517d6(0x95)]});_0x4d0654=_0x2cab2a['data'];}catch{_0x29ee3b[_0x2517d6(0x95)]&&console[_0x2517d6(0xab)](_0x2517d6(0xd0));}const _0xb94414={'id':_0x307dd3['id'],'name':_0x307dd3[_0x2517d6(0x81)]['name'],'description':_0x307dd3[_0x2517d6(0x81)][_0x2517d6(0x76)],'state':_0x307dd3[_0x2517d6(0x81)][_0x2517d6(0xcd)],'paused':_0x307dd3[_0x2517d6(0x81)]['paused'],'reentry_mode':_0x307dd3[_0x2517d6(0x81)]['reentryMode'],'stages':_0x307dd3[_0x2517d6(0x81)][_0x2517d6(0xa9)]?.[_0x2517d6(0xbb)]||0x0,..._0x307dd3[_0x2517d6(0x81)]['goal']&&{'goal':_0x307dd3['attributes'][_0x2517d6(0x9d)]['name']},..._0x4d0654&&{'statistics':{'total_entered':_0x4d0654[_0x2517d6(0x87)],'goal_achieved':_0x4d0654[_0x2517d6(0x8d)],'goal_rate':_0x4d0654['goalRate'],'stages':_0x4d0654[_0x2517d6(0xed)]}}};return await handleSingleObjectOutput(_0xb94414,_0x29ee3b),0x0;}}export class JourneyStatsCommand extends BaseCommand{['name']='journey:stats';['description']=a25_0x29815f(0x8f);async[a25_0x29815f(0xd4)](_0x46e484){const _0x115020=a25_0x29815f,{options:_0x2de9df,args:_0xe2842e,tdx:_0x32dce2}=_0x46e484,_0xdfc9c5=_0xe2842e[0x0];if(!_0xdfc9c5)return console[_0x115020(0xab)](_0x115020(0x97)),console[_0x115020(0xab)](_0x115020(0xb4)),0x1;_0x2de9df['verbose']&&console[_0x115020(0xab)]('Input:\x20'+_0xdfc9c5);const _0x15be20=resolveJourneyTarget(_0xdfc9c5,_0x2de9df['parentSegment'],_0x2de9df['verbose']),_0x246ae0=await withSpinner(_0x115020(0x7f),()=>_0x32dce2[_0x115020(0x72)]['resolveParentId'](_0x15be20[_0x115020(0xc9)]),{'verbose':_0x2de9df[_0x115020(0x95)]}),_0x52694e=_0x246ae0[_0x115020(0xe7)],_0x4102d1=await withSpinner(_0x115020(0xfc),()=>_0x32dce2[_0x115020(0x73)]['resolveJourneyId'](_0x52694e,_0x15be20[_0x115020(0x82)]),{'verbose':_0x2de9df[_0x115020(0x95)]}),_0x5e9fa4=_0x4102d1[_0x115020(0xe7)],_0x4bc8e1=await withSpinner(_0x115020(0x93),()=>_0x32dce2[_0x115020(0x73)][_0x115020(0xb2)](_0x5e9fa4),{'verbose':_0x2de9df['verbose']}),_0x49a2b2=_0x4bc8e1['data'];if(!_0x49a2b2||_0x49a2b2[_0x115020(0x98)]===null)return console['error'](_0x115020(0xe5)+_0x15be20[_0x115020(0x82)]),console['error']('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x7a6652={'journey_id':_0x49a2b2[_0x115020(0x98)],'total_entered':_0x49a2b2[_0x115020(0x87)],'goal_achieved':_0x49a2b2[_0x115020(0x8d)],'goal_rate':_0x49a2b2[_0x115020(0xdc)],'stages':_0x49a2b2[_0x115020(0xed)]?.['map'](_0x5340ba=>({'name':_0x5340ba[_0x115020(0x102)],'population':_0x5340ba[_0x115020(0xe2)],'entered':_0x5340ba[_0x115020(0x99)],'exited':_0x5340ba[_0x115020(0xb1)],'conversion_rate':_0x5340ba[_0x115020(0x7d)]}))},_0x56acd0=_0x2de9df[_0x115020(0xcc)];if(_0x56acd0&&_0x49a2b2[_0x115020(0xed)]){const _0x47f707=_0x49a2b2[_0x115020(0xed)][_0x115020(0x80)](_0x455279=>_0x455279['stageName'][_0x115020(0xbc)]()===_0x56acd0[_0x115020(0xbc)]());if(_0x47f707)return await handleSingleObjectOutput({'stage_name':_0x47f707[_0x115020(0x102)],'population':_0x47f707[_0x115020(0xe2)],'entered':_0x47f707[_0x115020(0x99)],'exited':_0x47f707[_0x115020(0xb1)],'conversion_rate':_0x47f707[_0x115020(0x7d)]},_0x2de9df),0x0;console['error'](_0x115020(0xd2)+_0x56acd0+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x7a6652,_0x2de9df),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x29815f(0xba)]=a25_0x29815f(0xbd);[a25_0x29815f(0x76)]=a25_0x29815f(0xdf);async[a25_0x29815f(0xd4)](_0x22bec4){const _0x3ebfef=a25_0x29815f,{options:_0x326ff6,args:_0xbb1971,tdx:_0x5baf6f}=_0x22bec4,_0x2d9496=_0xbb1971[0x0];if(!_0x2d9496)return console[_0x3ebfef(0xab)](_0x3ebfef(0x97)),console[_0x3ebfef(0xab)](_0x3ebfef(0xe0)),0x1;_0x326ff6[_0x3ebfef(0x95)]&&console[_0x3ebfef(0xab)](_0x3ebfef(0x6e)+_0x2d9496);const _0x3a7ed8=resolveJourneyTarget(_0x2d9496,_0x326ff6[_0x3ebfef(0xc9)],_0x326ff6[_0x3ebfef(0x95)]),_0xb20f35=await withSpinner(_0x3ebfef(0x7f),()=>_0x5baf6f['segment'][_0x3ebfef(0x8b)](_0x3a7ed8[_0x3ebfef(0xc9)]),{'verbose':_0x326ff6['verbose']}),_0x41c0d3=_0xb20f35[_0x3ebfef(0xe7)],_0x1b2ad7=await withSpinner('Resolving\x20journey...',()=>_0x5baf6f[_0x3ebfef(0x73)][_0x3ebfef(0xaf)](_0x41c0d3,_0x3a7ed8['journeyName']),{'verbose':_0x326ff6[_0x3ebfef(0x95)]}),_0x3e143f=_0x1b2ad7[_0x3ebfef(0xe7)];if(!_0x326ff6[_0x3ebfef(0xcf)]){const _0x399f59=await confirm(_0x3ebfef(0x9a)+_0x3a7ed8[_0x3ebfef(0x82)]+'\x22?');if(!_0x399f59)return console[_0x3ebfef(0xab)](_0x3ebfef(0x78)),0x0;}const _0x4403aa=await withSpinner(_0x3ebfef(0x75),()=>_0x5baf6f['journey'][_0x3ebfef(0xf1)](_0x3e143f),{'verbose':_0x326ff6[_0x3ebfef(0x95)]}),_0x4e0718=_0x4403aa['data'];return console['error'](_0x3ebfef(0xf8)+_0x4e0718[_0x3ebfef(0x81)][_0x3ebfef(0xba)]+_0x3ebfef(0xd5)),0x0;}}function a25_0x513f(){const _0x104418=['set','\x22\x20resumed','\x20unchanged\x20files','resolveJourneyId','\x20\x20Target:\x20','exited','getStatistics','INVALID_ARGUMENT','Usage:\x20journey\x20stats\x20<name-or-path>','Found\x20existing\x20tdx.json\x20at:\x20','\x20(ID:\x20','Resolved\x20YAML\x20file:\x20','cyan','journey:resume','name','length','toLowerCase','journey:pause','✔\x20Pulled\x20','Show\x20journey\x20details','\x20journey\x20files\x20to\x20','audienceId','\x20(paused)','359702bkbvLg','📁\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','segmentName','83795DfFBPD','message','parentSegment','isNew','green','stage','state','get','yes','\x20\x20Statistics\x20not\x20available','filter','Warning:\x20Stage\x20\x22','utf-8','execute','\x22\x20paused','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','listJourneysFromParentSegment','3bMYstm','Fetching\x20folders...','468192QBAZRK','3169872qOgoio','goalRate','Parent\x20segment\x20context\x20not\x20set.\x0a','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Pause\x20a\x20running\x20journey','Usage:\x20journey\x20pause\x20<name-or-path>','Usage:\x20journey\x20resume\x20<name-or-path>','population','1903016dcGxLr','Resuming\x20journey...','No\x20statistics\x20available\x20for\x20journey:\x20','\x20\x20Folder\x20path:\x20','data','relativePath','table','\x20changed\x20files','push','List\x20journeys\x20in\x20current\x20context','stages','(root)','✔\x20All\x20files\x20are\x20up\x20to\x20date','dryRun','pause','7WwhbTd','Aborted.','yellow','Fetching\x20','split','getJourney','✔\x20Journey\x20\x22','map','Listing\x20journeys...','launched','Resolving\x20journey...','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','folderId','journey:list','\x20\x20Parent\x20segment:\x20','hasChanges','stageName','Error:\x20Parent\x20segment\x20context\x20required','Input:\x20','dirname','\x20journeys','479867vvCDUg','segment','journey','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Pausing\x20journey...','description','\x0aPull\x20summary:','Cancelled','resume','116NdOXYk','\x20\x20Name:\x20','\x5c$&','conversionRate','rule','Resolving\x20parent\x20segment...','find','attributes','journeyName','join','json','replace','relative','totalEntered','log','rootFolderId','1037971QVkWnM','resolveParentId','Parent\x20segment:\x20','totalGoalAchieved','journeyBundleName','Show\x20journey\x20statistics','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','diff','draft','Getting\x20journey\x20statistics...','repeat','verbose','No\x20journeys\x20found','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','journeyId','entered','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','cwd','dim','goal','Resume\x20a\x20paused\x20journey','170MdKhER','kind','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Error:\x20Journey\x20not\x20found:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Write\x20','\x20new\x20files','Getting\x20journey\x20details...','Usage:\x20journey\x20view\x20<name-or-path>','gray','journeyStages','content','error'];a25_0x513f=function(){return _0x104418;};return a25_0x513f();}export class JourneyResumeCommand extends BaseCommand{['name']=a25_0x29815f(0xb9);[a25_0x29815f(0x76)]=a25_0x29815f(0x9e);async['execute'](_0x28278d){const _0x170fa8=a25_0x29815f,{options:_0x108338,args:_0xda7ebd,tdx:_0x4a5540}=_0x28278d,_0x1578ef=_0xda7ebd[0x0];if(!_0x1578ef)return console[_0x170fa8(0xab)](_0x170fa8(0x97)),console['error'](_0x170fa8(0xe1)),0x1;_0x108338[_0x170fa8(0x95)]&&console[_0x170fa8(0xab)]('Input:\x20'+_0x1578ef);const _0x256d09=resolveJourneyTarget(_0x1578ef,_0x108338[_0x170fa8(0xc9)],_0x108338[_0x170fa8(0x95)]),_0x5e87b9=await withSpinner(_0x170fa8(0x7f),()=>_0x4a5540[_0x170fa8(0x72)][_0x170fa8(0x8b)](_0x256d09['parentSegment']),{'verbose':_0x108338['verbose']}),_0x2ff8d2=_0x5e87b9['data'],_0x115fd1=await withSpinner(_0x170fa8(0xfc),()=>_0x4a5540[_0x170fa8(0x73)][_0x170fa8(0xaf)](_0x2ff8d2,_0x256d09[_0x170fa8(0x82)]),{'verbose':_0x108338[_0x170fa8(0x95)]}),_0x21671a=_0x115fd1[_0x170fa8(0xe7)];if(!_0x108338['yes']){const _0x56592b=await confirm(_0x170fa8(0x90)+_0x256d09[_0x170fa8(0x82)]+'\x22?');if(!_0x56592b)return console[_0x170fa8(0xab)](_0x170fa8(0x78)),0x0;}const _0x2d148e=await withSpinner(_0x170fa8(0xe4),()=>_0x4a5540[_0x170fa8(0x73)][_0x170fa8(0x79)](_0x21671a),{'verbose':_0x108338['verbose']}),_0x4d4b6b=_0x2d148e['data'];return console[_0x170fa8(0xab)]('✔\x20Journey\x20\x22'+_0x4d4b6b[_0x170fa8(0x81)]['name']+_0x170fa8(0xad)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']='journey:pull';[a25_0x29815f(0x76)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a25_0x29815f(0xd4)](_0x564f36){const _0x147d50=a25_0x29815f,{options:_0x578e90,args:_0x2e25ce,tdx:_0x47a6b0}=_0x564f36,_0xf9d98c=_0x578e90,_0x59741e=_0x2e25ce[0x0],_0xe908a0=findTdxConfigPath();let _0x3af4d8,_0x3241bc;if(_0xe908a0){const _0x127dfb=loadTdxConfig(_0xe908a0);_0x3af4d8=_0x127dfb['parent_segment'],_0x3241bc=a25_0x720d5a[_0x147d50(0x83)](a25_0x720d5a[_0x147d50(0x6f)](_0xe908a0),'journeys'),_0xf9d98c[_0x147d50(0x95)]&&(console['error'](_0x147d50(0xb5)+_0xe908a0),console[_0x147d50(0xab)]('Using\x20parent\x20segment:\x20'+_0x3af4d8));}else{_0x3af4d8=_0x578e90[_0x147d50(0xc9)];if(!_0x3af4d8)return console['error'](a25_0x3e565e[_0x147d50(0xf4)](_0x147d50(0xdd))),console['error'](_0x147d50(0xfd)),console[_0x147d50(0xab)](_0x147d50(0xd6)),console[_0x147d50(0xab)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure'),0x1;_0x3241bc=a25_0x720d5a[_0x147d50(0x83)](getSegmentRootDir(sanitizeFileName(_0x3af4d8)),'journeys');}const _0x3819f0=await withSpinner(_0x147d50(0x7f),()=>_0x47a6b0[_0x147d50(0x72)]['resolveParentId'](_0x3af4d8),{'verbose':_0x578e90[_0x147d50(0x95)]}),_0x5a7b0e=_0x3819f0[_0x147d50(0xe7)],_0x16d7b9=await withSpinner(_0x147d50(0xfa),()=>_0x47a6b0[_0x147d50(0x73)][_0x147d50(0xd7)](_0x5a7b0e),{'verbose':_0x578e90[_0x147d50(0x95)]});let _0xd5f211=_0x16d7b9[_0x147d50(0xe7)];if(_0x59741e){const _0x551e52=_0xd5f211[_0x147d50(0xd1)](_0x4f9617=>_0x4f9617[_0x147d50(0x8e)]['toLowerCase']()===_0x59741e['toLowerCase']());if(_0x551e52[_0x147d50(0xbb)]===0x0)return console[_0x147d50(0xab)](_0x147d50(0xa2)+_0x59741e),console[_0x147d50(0xab)](_0x147d50(0x74)),0x1;_0xd5f211=_0x551e52;}if(_0xd5f211['length']===0x0)return console[_0x147d50(0xab)](_0x147d50(0x96)),0x0;const _0x6de1fe=[];for(const _0xd2186f of _0xd5f211){const _0x17cd12=await withSpinner(_0x147d50(0xf5)+_0xd2186f[_0x147d50(0x8e)]+'...',()=>_0x47a6b0['journey'][_0x147d50(0xf7)](_0xd2186f['id']),{'verbose':_0x578e90[_0x147d50(0x95)]}),_0x31c7f0=_0x17cd12[_0x147d50(0xe7)],_0x33dae4=_0x31c7f0[_0x147d50(0x81)]?.[_0x147d50(0xc1)],_0xc107f8={'resolveSegment':async _0x191c31=>{const _0x107308=_0x147d50;if(!_0x33dae4)return{'name':_0x191c31,'isJourneyLocal':![]};try{const _0x40d7b1=await _0x47a6b0['segment']['getSegment'](_0x33dae4,_0x191c31),_0x121ed2=_0x40d7b1[_0x107308(0xa0)]===SEGMENT_KIND_JOURNEY;let _0x1889a8;return _0x121ed2&&_0x40d7b1[_0x107308(0x7e)]&&(_0x1889a8={'description':_0x40d7b1[_0x107308(0x76)],'rule':apiRuleToYaml(_0x40d7b1[_0x107308(0x7e)])}),{'name':_0x40d7b1[_0x107308(0xba)],'isJourneyLocal':_0x121ed2,'definition':_0x1889a8};}catch(_0x5af7d3){return _0x578e90['verbose']&&console[_0x107308(0xab)](_0x107308(0xa1)+_0x191c31+':\x20'+_0x5af7d3[_0x107308(0xc8)]),{'name':_0x191c31,'isJourneyLocal':![]};}}},_0x3fda34=await apiToYamlAsync(_0x31c7f0,_0xc107f8),_0x11cd7e=toYamlString(_0x3fda34),_0x1e08b7=sanitizeFileName(_0xd2186f[_0x147d50(0x8e)]),_0x18eb0b=a25_0x720d5a[_0x147d50(0x83)](_0x3241bc,_0x1e08b7+'.yml'),_0x569ba2=a25_0x720d5a[_0x147d50(0x86)](process[_0x147d50(0x9b)](),_0x18eb0b);if(existsSync(_0x18eb0b)){const _0x24f95f=readFileSync(_0x18eb0b,_0x147d50(0xd3)),_0x119c51=generateDiff(_0x24f95f,_0x11cd7e),_0x1d4b71=hasChanges(_0x119c51);_0x6de1fe[_0x147d50(0xeb)]({'relativePath':_0x569ba2,'absolutePath':_0x18eb0b,'content':_0x11cd7e,'isNew':![],'hasChanges':_0x1d4b71,'diff':_0x1d4b71?formatDiffWithColors(_0x119c51):undefined});}else _0x6de1fe[_0x147d50(0xeb)]({'relativePath':_0x569ba2,'absolutePath':_0x18eb0b,'content':_0x11cd7e,'isNew':!![],'hasChanges':![]});}const _0x441ac9=_0x6de1fe[_0x147d50(0xd1)](_0x46eb6d=>_0x46eb6d['isNew']),_0x27870e=_0x6de1fe[_0x147d50(0xd1)](_0x274ad0=>!_0x274ad0[_0x147d50(0xca)]&&_0x274ad0['hasChanges']),_0x58a42e=_0x6de1fe['filter'](_0x44ef17=>!_0x44ef17['isNew']&&!_0x44ef17['hasChanges']);console['error'](_0x147d50(0x77)),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e[_0x147d50(0xb8)](_0xd5f211['length']+_0x147d50(0x70))),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e['green']('+\x20'+_0x441ac9[_0x147d50(0xbb)]+_0x147d50(0xa5))),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e['yellow']('~\x20'+_0x27870e[_0x147d50(0xbb)]+_0x147d50(0xea))),console[_0x147d50(0xab)]('\x20\x20'+a25_0x3e565e[_0x147d50(0x9c)]('=\x20'+_0x58a42e[_0x147d50(0xbb)]+_0x147d50(0xae))),console['error'](_0x147d50(0xb0)+a25_0x3e565e['cyan'](_0x3241bc)+'\x0a');if(_0x27870e[_0x147d50(0xbb)]>0x0)for(const _0x6056ef of _0x27870e){console[_0x147d50(0xab)]('\x0aChanges\x20to\x20\x27'+_0x6056ef[_0x147d50(0xe8)]+'\x27:'),console['error']('─'[_0x147d50(0x94)](0x3c)),console['error'](_0x6056ef[_0x147d50(0x91)]),console['error']('─'[_0x147d50(0x94)](0x3c));}if(_0xf9d98c[_0x147d50(0xf0)])return console['error'](a25_0x3e565e[_0x147d50(0xf4)](_0x147d50(0xde))),0x0;if(_0x441ac9[_0x147d50(0xbb)]===0x0&&_0x27870e[_0x147d50(0xbb)]===0x0)return console['error'](a25_0x3e565e['green'](_0x147d50(0xef))),0x0;if(!_0xf9d98c['yes']&&(_0x441ac9['length']>0x0||_0x27870e[_0x147d50(0xbb)]>0x0)){const _0x4f895f=await confirmKey(_0x147d50(0xa4)+(_0x441ac9['length']+_0x27870e[_0x147d50(0xbb)])+'\x20files?');if(!_0x4f895f)return console['error'](_0x147d50(0xf3)),0x1;}!existsSync(_0x3241bc)&&mkdirSync(_0x3241bc,{'recursive':!![]});for(const _0x1ee5b7 of _0x6de1fe){(_0x1ee5b7[_0x147d50(0xca)]||_0x1ee5b7[_0x147d50(0x101)])&&writeFileSync(_0x1ee5b7['absolutePath'],_0x1ee5b7[_0x147d50(0xaa)],_0x147d50(0xd3));}return console[_0x147d50(0xab)](a25_0x3e565e[_0x147d50(0xcb)](_0x147d50(0xbe)+(_0x441ac9[_0x147d50(0xbb)]+_0x27870e[_0x147d50(0xbb)])+_0x147d50(0xc0)+_0x3241bc)),0x0;}}
|
|
1
|
+
const a25_0x1e7db8=a25_0x34da;(function(_0x6a3012,_0x2eaf87){const _0xdd187=a25_0x34da,_0x5d1d1c=_0x6a3012();while(!![]){try{const _0x3a292e=parseInt(_0xdd187(0xcd))/0x1*(-parseInt(_0xdd187(0xec))/0x2)+-parseInt(_0xdd187(0x139))/0x3+-parseInt(_0xdd187(0x126))/0x4*(-parseInt(_0xdd187(0xbc))/0x5)+parseInt(_0xdd187(0xc8))/0x6*(parseInt(_0xdd187(0x132))/0x7)+parseInt(_0xdd187(0x13d))/0x8*(parseInt(_0xdd187(0x129))/0x9)+parseInt(_0xdd187(0xcf))/0xa*(-parseInt(_0xdd187(0x105))/0xb)+parseInt(_0xdd187(0x12e))/0xc*(-parseInt(_0xdd187(0xef))/0xd);if(_0x3a292e===_0x2eaf87)break;else _0x5d1d1c['push'](_0x5d1d1c['shift']());}catch(_0x2d909c){_0x5d1d1c['push'](_0x5d1d1c['shift']());}}}(a25_0x1cb3,0x33715));import a25_0x2a9a22 from'chalk';import a25_0x4ac36d from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a25_0x1cb3(){const _0x27e827=['getJourney','🗺️\x20','replace','map','\x20(paused)','📁\x20','\x20unchanged\x20files','Input:\x20','Resume\x20a\x20paused\x20journey','parent_segment','Write\x20','Resuming\x20journey...','all','\x20changed\x20files','187847mkKeiY','journey:pull','\x22\x20not\x20found','Listing\x20journeys...','rule','cyan','stages','json','stage','set','filter','totalGoalAchieved','push','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Usage:\x20journey\x20pause\x20<name-or-path>','entered','Usage:\x20journey\x20resume\x20<name-or-path>','\x20files?','execute','Cancelled','No\x20statistics\x20available\x20for\x20journey:\x20','Found\x20existing\x20tdx.json\x20at:\x20','\x22\x20resumed','segment','reentryMode','Fetching\x20parent\x20segment...','hasChanges','yes','rootFolderId','segmentName','Pausing\x20journey...','draft','state','4052RuFIjN','journey:pause','\x20\x20Folder\x20path:\x20','198657gtrEHl','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','parentSegment','name','journey:view','103932PwiXbD','\x20journey\x20files\x20to\x20','goal','error','1162147mLhqGA','...','\x0aChanges\x20to\x20\x27','repeat','dryRun','✔\x20Found\x20','get','45159mhuqzu','message','kind','Parent\x20segment:\x20','64eJXrxR','✔\x20Pulled\x20','goalRate','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','conversionRate','archived','listJourneysFromParentSegment','journey:stats','\x0aPull\x20summary:','diff','Using\x20parent\x20segment:\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Usage:\x20journey\x20view\x20<name-or-path>','.yml','✔\x20All\x20files\x20are\x20up\x20to\x20date','table','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','totalEntered','green','journeyName','Aborted.','yellow','gray','1865gOvRuS','folderId','population','journeys','log','resume','split','format','includeStats','isNew','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','6pcKNAR','Getting\x20journey\x20statistics...','data','Export\x20journey(s)\x20as\x20YAML\x20files','✔\x20Journey\x20\x22','175705SfpkCk','List\x20journeys\x20in\x20current\x20context','60oZkLSU','journey:list','resolveParentId','Usage:\x20journey\x20stats\x20<name-or-path>','relative','(root)','length','getStatistics','audienceId','Resolving\x20parent\x20segment...','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','listFolders','absolutePath','journey','journeyBundleName','toLowerCase','resolveJourneyId','Resolved\x20YAML\x20file:\x20','description','utf-8','dim','attributes','join','INVALID_ARGUMENT','paused','relativePath','stageName','\x20journey','Resolving\x20journey...','2lPFTJu','verbose','dirname','325PapsrL','\x20\x20Target:\x20','Show\x20journey\x20details','Warning:\x20Stage\x20\x22','\x5c$&','journeyId','folderPath','\x20journeys'];a25_0x1cb3=function(){return _0x27e827;};return a25_0x1cb3();}import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x209c0f){const _0x1ecb51=a25_0x34da;switch(_0x209c0f){case'launched':return a25_0x2a9a22['green'](_0x209c0f);case _0x1ecb51(0x124):return a25_0x2a9a22[_0x1ecb51(0xbb)](_0x209c0f);case _0x1ecb51(0x142):return a25_0x2a9a22[_0x1ecb51(0xe3)](_0x209c0f);default:return _0x209c0f;}}function formatJourneyItem(_0x567cae,_0x5906b7=''){const _0x4ada8e=a25_0x34da,_0x23cacc=formatJourneyState(_0x567cae[_0x4ada8e(0x125)]),_0x3f5eae=_0x567cae[_0x4ada8e(0xe7)]?a25_0x2a9a22[_0x4ada8e(0xba)](_0x4ada8e(0xfb)):'';return _0x5906b7+_0x4ada8e(0xf8)+_0x567cae['journeyBundleName']+'\x20('+_0x23cacc+')'+_0x3f5eae;}function escapeRegex(_0x34ed73){const _0x14ebc6=a25_0x34da;return _0x34ed73[_0x14ebc6(0xf9)](/[.*+?^${}()|[\]\\]/g,_0x14ebc6(0xf3));}function globToRegex(_0x3f923e){const _0x4e8c38=a25_0x34da,_0x2d0d53=_0x3f923e[_0x4e8c38(0xc2)]('*')[_0x4e8c38(0xfa)](escapeRegex);return new RegExp(_0x2d0d53[_0x4e8c38(0xe5)]('.*'),'i');}function a25_0x34da(_0x4309ed,_0x99acb8){_0x4309ed=_0x4309ed-0xb4;const _0x1cb34d=a25_0x1cb3();let _0x34da63=_0x1cb34d[_0x4309ed];return _0x34da63;}function resolveJourneyTarget(_0x25720c,_0x2bd230,_0xf091d4){const _0x37770a=a25_0x34da;if(isYamlFilePath(_0x25720c))try{const _0xd89cc0=resolveYamlFilePath(_0x25720c);return _0xf091d4&&(console['error'](_0x37770a(0xe0)+_0x25720c),console['error']('\x20\x20Parent\x20segment:\x20'+_0xd89cc0[_0x37770a(0x12b)]),console['error']('\x20\x20Name:\x20'+_0xd89cc0['segmentName']),console[_0x37770a(0x131)](_0x37770a(0x128)+(_0xd89cc0[_0x37770a(0xf5)]||_0x37770a(0xd4)))),{'journeyName':_0xd89cc0[_0x37770a(0x122)],'parentSegment':_0xd89cc0[_0x37770a(0x12b)],'resolved':_0xd89cc0};}catch(_0x299ccd){throw new SDKError(ErrorCode[_0x37770a(0xe6)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x299ccd[_0x37770a(0x13a)]);}if(!_0x2bd230)throw new SDKError(ErrorCode[_0x37770a(0xe6)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x25720c,'parentSegment':_0x2bd230};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x1e7db8(0xd0);['description']=a25_0x1e7db8(0xce);async[a25_0x1e7db8(0x117)](_0x3c80bb){const _0x1bad39=a25_0x1e7db8,{options:_0xa347d7,args:_0x244faf,tdx:_0x477824}=_0x3c80bb,_0x5e3cca=_0x244faf[0x0],_0x5b6b4a=_0xa347d7[_0x1bad39(0x12b)];if(!_0x5b6b4a)return console['error']('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x1bad39(0x131)](_0x1bad39(0xc6)),0x1;const _0x51f741=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x477824[_0x1bad39(0x11c)][_0x1bad39(0xd1)](_0x5b6b4a),{'verbose':_0xa347d7[_0x1bad39(0xed)]}),_0x44aae2=_0x51f741[_0x1bad39(0xca)];_0xa347d7[_0x1bad39(0xed)]&&(console[_0x1bad39(0x131)](_0x1bad39(0x13c)+_0x5b6b4a+'\x20(ID:\x20'+_0x44aae2+')'),_0x5e3cca&&console[_0x1bad39(0x131)]('Pattern:\x20'+_0x5e3cca));const [_0x3ee651,_0x3be8b1,_0xb84a41]=await Promise[_0x1bad39(0x103)]([withSpinner(_0x1bad39(0x11e),()=>_0x477824['segment']['getParentFull'](_0x44aae2),{'verbose':_0xa347d7[_0x1bad39(0xed)]}),withSpinner('Fetching\x20folders...',()=>_0x477824[_0x1bad39(0x11c)][_0x1bad39(0xda)](_0x44aae2),{'verbose':_0xa347d7[_0x1bad39(0xed)]}),withSpinner('Listing\x20journeys...',()=>_0x477824[_0x1bad39(0xdc)]['listJourneysFromParentSegment'](_0x44aae2),{'verbose':_0xa347d7[_0x1bad39(0xed)]})]),_0x3ab69b=_0x3ee651[_0x1bad39(0xca)],_0x3dcbc9=_0x3be8b1[_0x1bad39(0xca)];let _0x6f60a0=_0xb84a41['data'];const _0x25d1ac=_0x3ab69b[_0x1bad39(0x121)],_0x2a2540=new Map();for(const _0x1afe41 of _0x3dcbc9){_0x2a2540[_0x1bad39(0x10e)](_0x1afe41['id'],_0x1afe41[_0x1bad39(0x12c)]);}if(_0x5e3cca){const _0x28520c=globToRegex(_0x5e3cca);_0x6f60a0=_0x6f60a0['filter'](_0x59f6ab=>_0x28520c['test'](_0x59f6ab[_0x1bad39(0xdd)]));}console[_0x1bad39(0x131)](_0x1bad39(0x137)+_0x6f60a0[_0x1bad39(0xd5)]+_0x1bad39(0xea)+(_0x6f60a0[_0x1bad39(0xd5)]!==0x1?'s':''));if(_0xa347d7['format']===_0x1bad39(0xb4))await handleSDKOutput(_0x6f60a0,_0xa347d7);else{if(_0xa347d7[_0x1bad39(0xc3)]===_0x1bad39(0x10c))await handleSDKOutput(_0x6f60a0,_0xa347d7);else{console[_0x1bad39(0xc0)]('['+_0x5b6b4a+']');const _0x18040e=new Map(),_0x5887a1=[];for(const _0x54da4d of _0x6f60a0){if(!_0x54da4d[_0x1bad39(0xbd)]||_0x54da4d[_0x1bad39(0xbd)]===_0x25d1ac)_0x5887a1[_0x1bad39(0x111)](_0x54da4d);else{const _0x4ba4c4=_0x18040e[_0x1bad39(0x138)](_0x54da4d[_0x1bad39(0xbd)])||[];_0x4ba4c4[_0x1bad39(0x111)](_0x54da4d),_0x18040e['set'](_0x54da4d[_0x1bad39(0xbd)],_0x4ba4c4);}}for(const _0x353cd3 of _0x5887a1){console['log'](formatJourneyItem(_0x353cd3));}for(const [_0x3492b8,_0x5b2327]of _0x18040e){const _0xcec678=_0x2a2540[_0x1bad39(0x138)](_0x3492b8)||_0x3492b8;console['log'](_0x1bad39(0xfc)+_0xcec678);for(const _0x39fd4f of _0x5b2327){console[_0x1bad39(0xc0)](formatJourneyItem(_0x39fd4f,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x12d);[a25_0x1e7db8(0xe1)]=a25_0x1e7db8(0xf1);async['execute'](_0x1dabea){const _0x29349e=a25_0x1e7db8,{options:_0x10da56,args:_0x1b9e56,tdx:_0x2a6a2d}=_0x1dabea,_0x5f2bb9=_0x1b9e56[0x0];if(!_0x5f2bb9)return console[_0x29349e(0x131)](_0x29349e(0xb5)),console['error'](_0x29349e(0x14a)),0x1;_0x10da56[_0x29349e(0xed)]&&console[_0x29349e(0x131)](_0x29349e(0xfe)+_0x5f2bb9);const _0x121cbf=resolveJourneyTarget(_0x5f2bb9,_0x10da56[_0x29349e(0x12b)],_0x10da56[_0x29349e(0xed)]),_0x110769=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2a6a2d[_0x29349e(0x11c)][_0x29349e(0xd1)](_0x121cbf[_0x29349e(0x12b)]),{'verbose':_0x10da56[_0x29349e(0xed)]}),_0x5168b0=_0x110769[_0x29349e(0xca)],_0x4dcf2c=await withSpinner(_0x29349e(0xeb),()=>_0x2a6a2d['journey'][_0x29349e(0xdf)](_0x5168b0,_0x121cbf[_0x29349e(0xb8)]),{'verbose':_0x10da56[_0x29349e(0xed)]}),_0x12188a=_0x4dcf2c[_0x29349e(0xca)],_0x49272b=await withSpinner('Getting\x20journey\x20details...',()=>_0x2a6a2d[_0x29349e(0xdc)]['getJourney'](_0x12188a),{'verbose':_0x10da56['verbose']}),_0x311e08=_0x49272b[_0x29349e(0xca)],_0x150141=_0x10da56[_0x29349e(0xc4)];let _0x12e874;if(_0x150141)try{const _0x3cbb0f=await withSpinner(_0x29349e(0xc9),()=>_0x2a6a2d[_0x29349e(0xdc)][_0x29349e(0xd6)](_0x12188a),{'verbose':_0x10da56['verbose']});_0x12e874=_0x3cbb0f[_0x29349e(0xca)];}catch{_0x10da56['verbose']&&console['error']('\x20\x20Statistics\x20not\x20available');}const _0x48b4ae={'id':_0x311e08['id'],'name':_0x311e08['attributes']['name'],'description':_0x311e08['attributes'][_0x29349e(0xe1)],'state':_0x311e08['attributes'][_0x29349e(0x125)],'paused':_0x311e08[_0x29349e(0xe4)][_0x29349e(0xe7)],'reentry_mode':_0x311e08[_0x29349e(0xe4)][_0x29349e(0x11d)],'stages':_0x311e08[_0x29349e(0xe4)]['journeyStages']?.[_0x29349e(0xd5)]||0x0,..._0x311e08['attributes'][_0x29349e(0x130)]&&{'goal':_0x311e08[_0x29349e(0xe4)][_0x29349e(0x130)][_0x29349e(0x12c)]},..._0x12e874&&{'statistics':{'total_entered':_0x12e874[_0x29349e(0xb6)],'goal_achieved':_0x12e874[_0x29349e(0x110)],'goal_rate':_0x12e874[_0x29349e(0x13f)],'stages':_0x12e874[_0x29349e(0x10b)]}}};return await handleSingleObjectOutput(_0x48b4ae,_0x10da56),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x144);[a25_0x1e7db8(0xe1)]='Show\x20journey\x20statistics';async[a25_0x1e7db8(0x117)](_0xf85263){const _0x1f0d03=a25_0x1e7db8,{options:_0x1a5a29,args:_0x2eb0d1,tdx:_0x2fd0df}=_0xf85263,_0x43fe8e=_0x2eb0d1[0x0];if(!_0x43fe8e)return console[_0x1f0d03(0x131)](_0x1f0d03(0xb5)),console[_0x1f0d03(0x131)](_0x1f0d03(0xd2)),0x1;_0x1a5a29[_0x1f0d03(0xed)]&&console['error'](_0x1f0d03(0xfe)+_0x43fe8e);const _0x118df6=resolveJourneyTarget(_0x43fe8e,_0x1a5a29[_0x1f0d03(0x12b)],_0x1a5a29[_0x1f0d03(0xed)]),_0x3d3543=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2fd0df[_0x1f0d03(0x11c)][_0x1f0d03(0xd1)](_0x118df6[_0x1f0d03(0x12b)]),{'verbose':_0x1a5a29[_0x1f0d03(0xed)]}),_0x271e36=_0x3d3543[_0x1f0d03(0xca)],_0x8ab469=await withSpinner(_0x1f0d03(0xeb),()=>_0x2fd0df[_0x1f0d03(0xdc)][_0x1f0d03(0xdf)](_0x271e36,_0x118df6[_0x1f0d03(0xb8)]),{'verbose':_0x1a5a29['verbose']}),_0x27b297=_0x8ab469[_0x1f0d03(0xca)],_0x230d17=await withSpinner(_0x1f0d03(0xc9),()=>_0x2fd0df[_0x1f0d03(0xdc)][_0x1f0d03(0xd6)](_0x27b297),{'verbose':_0x1a5a29[_0x1f0d03(0xed)]}),_0x2801bc=_0x230d17[_0x1f0d03(0xca)];if(!_0x2801bc||_0x2801bc[_0x1f0d03(0xf4)]===null)return console['error'](_0x1f0d03(0x119)+_0x118df6[_0x1f0d03(0xb8)]),console[_0x1f0d03(0x131)](_0x1f0d03(0xd9)),0x0;const _0x589123={'journey_id':_0x2801bc[_0x1f0d03(0xf4)],'total_entered':_0x2801bc[_0x1f0d03(0xb6)],'goal_achieved':_0x2801bc[_0x1f0d03(0x110)],'goal_rate':_0x2801bc[_0x1f0d03(0x13f)],'stages':_0x2801bc[_0x1f0d03(0x10b)]?.['map'](_0x364abc=>({'name':_0x364abc[_0x1f0d03(0xe9)],'population':_0x364abc[_0x1f0d03(0xbe)],'entered':_0x364abc['entered'],'exited':_0x364abc['exited'],'conversion_rate':_0x364abc[_0x1f0d03(0x141)]}))},_0x3eada2=_0x1a5a29[_0x1f0d03(0x10d)];if(_0x3eada2&&_0x2801bc[_0x1f0d03(0x10b)]){const _0x2abe53=_0x2801bc[_0x1f0d03(0x10b)]['find'](_0x112f11=>_0x112f11[_0x1f0d03(0xe9)]['toLowerCase']()===_0x3eada2['toLowerCase']());if(_0x2abe53)return await handleSingleObjectOutput({'stage_name':_0x2abe53[_0x1f0d03(0xe9)],'population':_0x2abe53[_0x1f0d03(0xbe)],'entered':_0x2abe53[_0x1f0d03(0x114)],'exited':_0x2abe53['exited'],'conversion_rate':_0x2abe53[_0x1f0d03(0x141)]},_0x1a5a29),0x0;console[_0x1f0d03(0x131)](_0x1f0d03(0xf2)+_0x3eada2+_0x1f0d03(0x107));}return await handleSingleObjectOutput(_0x589123,_0x1a5a29),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x127);[a25_0x1e7db8(0xe1)]='Pause\x20a\x20running\x20journey';async[a25_0x1e7db8(0x117)](_0x5cc330){const _0x2d71a6=a25_0x1e7db8,{options:_0x247ebb,args:_0x5ed18b,tdx:_0x367c6d}=_0x5cc330,_0x25c390=_0x5ed18b[0x0];if(!_0x25c390)return console[_0x2d71a6(0x131)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x2d71a6(0x113)),0x1;_0x247ebb[_0x2d71a6(0xed)]&&console[_0x2d71a6(0x131)]('Input:\x20'+_0x25c390);const _0x354319=resolveJourneyTarget(_0x25c390,_0x247ebb[_0x2d71a6(0x12b)],_0x247ebb['verbose']),_0x18e1e7=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x367c6d[_0x2d71a6(0x11c)][_0x2d71a6(0xd1)](_0x354319[_0x2d71a6(0x12b)]),{'verbose':_0x247ebb['verbose']}),_0x4e0ffe=_0x18e1e7[_0x2d71a6(0xca)],_0x110ee6=await withSpinner('Resolving\x20journey...',()=>_0x367c6d[_0x2d71a6(0xdc)]['resolveJourneyId'](_0x4e0ffe,_0x354319['journeyName']),{'verbose':_0x247ebb[_0x2d71a6(0xed)]}),_0x846bdf=_0x110ee6[_0x2d71a6(0xca)];if(!_0x247ebb['yes']){const _0x27b413=await confirm(_0x2d71a6(0x12a)+_0x354319[_0x2d71a6(0xb8)]+'\x22?');if(!_0x27b413)return console['error']('Cancelled'),0x0;}const _0x5774b6=await withSpinner(_0x2d71a6(0x123),()=>_0x367c6d[_0x2d71a6(0xdc)]['pause'](_0x846bdf),{'verbose':_0x247ebb['verbose']}),_0x50632b=_0x5774b6[_0x2d71a6(0xca)];return console[_0x2d71a6(0x131)](_0x2d71a6(0xcc)+_0x50632b[_0x2d71a6(0xe4)][_0x2d71a6(0x12c)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]='journey:resume';[a25_0x1e7db8(0xe1)]=a25_0x1e7db8(0xff);async[a25_0x1e7db8(0x117)](_0x1c6e39){const _0x3367bb=a25_0x1e7db8,{options:_0x3d2002,args:_0x45a03a,tdx:_0x5d978e}=_0x1c6e39,_0x19c4d2=_0x45a03a[0x0];if(!_0x19c4d2)return console[_0x3367bb(0x131)](_0x3367bb(0xb5)),console['error'](_0x3367bb(0x115)),0x1;_0x3d2002['verbose']&&console[_0x3367bb(0x131)](_0x3367bb(0xfe)+_0x19c4d2);const _0x1d002a=resolveJourneyTarget(_0x19c4d2,_0x3d2002['parentSegment'],_0x3d2002[_0x3367bb(0xed)]),_0x5b6d7d=await withSpinner(_0x3367bb(0xd8),()=>_0x5d978e[_0x3367bb(0x11c)][_0x3367bb(0xd1)](_0x1d002a[_0x3367bb(0x12b)]),{'verbose':_0x3d2002['verbose']}),_0x584ed3=_0x5b6d7d['data'],_0xfe3ab8=await withSpinner(_0x3367bb(0xeb),()=>_0x5d978e[_0x3367bb(0xdc)][_0x3367bb(0xdf)](_0x584ed3,_0x1d002a['journeyName']),{'verbose':_0x3d2002['verbose']}),_0x426756=_0xfe3ab8[_0x3367bb(0xca)];if(!_0x3d2002[_0x3367bb(0x120)]){const _0x4f610a=await confirm(_0x3367bb(0xc7)+_0x1d002a['journeyName']+'\x22?');if(!_0x4f610a)return console[_0x3367bb(0x131)](_0x3367bb(0x118)),0x0;}const _0x29ee47=await withSpinner(_0x3367bb(0x102),()=>_0x5d978e[_0x3367bb(0xdc)][_0x3367bb(0xc1)](_0x426756),{'verbose':_0x3d2002[_0x3367bb(0xed)]}),_0x41f39a=_0x29ee47[_0x3367bb(0xca)];return console[_0x3367bb(0x131)](_0x3367bb(0xcc)+_0x41f39a[_0x3367bb(0xe4)][_0x3367bb(0x12c)]+_0x3367bb(0x11b)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a25_0x1e7db8(0x12c)]=a25_0x1e7db8(0x106);['description']=a25_0x1e7db8(0xcb);async['execute'](_0x761a51){const _0x27a0c9=a25_0x1e7db8,{options:_0x362f34,args:_0x5df538,tdx:_0x17c266}=_0x761a51,_0x44ff68=_0x362f34,_0x2c8d3a=_0x5df538[0x0],_0x47ac87=findTdxConfigPath();let _0x58c815,_0x2b0552;if(_0x47ac87){const _0x318485=loadTdxConfig(_0x47ac87);_0x58c815=_0x318485[_0x27a0c9(0x100)],_0x2b0552=a25_0x4ac36d[_0x27a0c9(0xe5)](a25_0x4ac36d[_0x27a0c9(0xee)](_0x47ac87),'journeys'),_0x44ff68[_0x27a0c9(0xed)]&&(console['error'](_0x27a0c9(0x11a)+_0x47ac87),console[_0x27a0c9(0x131)](_0x27a0c9(0x147)+_0x58c815));}else{_0x58c815=_0x362f34['parentSegment'];if(!_0x58c815)return console[_0x27a0c9(0x131)](a25_0x2a9a22[_0x27a0c9(0xba)]('Parent\x20segment\x20context\x20not\x20set.\x0a')),console[_0x27a0c9(0x131)](_0x27a0c9(0x140)),console[_0x27a0c9(0x131)](_0x27a0c9(0x112)),console[_0x27a0c9(0x131)](_0x27a0c9(0x149)),0x1;_0x2b0552=a25_0x4ac36d['join'](getSegmentRootDir(sanitizeFileName(_0x58c815)),_0x27a0c9(0xbf));}const _0x4438c9=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x17c266[_0x27a0c9(0x11c)][_0x27a0c9(0xd1)](_0x58c815),{'verbose':_0x362f34['verbose']}),_0x596a6b=_0x4438c9[_0x27a0c9(0xca)],_0x426a76=await withSpinner(_0x27a0c9(0x108),()=>_0x17c266['journey'][_0x27a0c9(0x143)](_0x596a6b),{'verbose':_0x362f34[_0x27a0c9(0xed)]});let _0x437f92=_0x426a76[_0x27a0c9(0xca)];if(_0x2c8d3a){const _0x150096=_0x437f92['filter'](_0x4dcdbb=>_0x4dcdbb[_0x27a0c9(0xdd)][_0x27a0c9(0xde)]()===_0x2c8d3a[_0x27a0c9(0xde)]());if(_0x150096['length']===0x0)return console[_0x27a0c9(0x131)]('Error:\x20Journey\x20not\x20found:\x20'+_0x2c8d3a),console[_0x27a0c9(0x131)]('Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys'),0x1;_0x437f92=_0x150096;}if(_0x437f92[_0x27a0c9(0xd5)]===0x0)return console[_0x27a0c9(0x131)]('No\x20journeys\x20found'),0x0;const _0x48c8fb=[];for(const _0x17e7e8 of _0x437f92){const _0x36f585=await withSpinner('Fetching\x20'+_0x17e7e8[_0x27a0c9(0xdd)]+_0x27a0c9(0x133),()=>_0x17c266[_0x27a0c9(0xdc)][_0x27a0c9(0xf7)](_0x17e7e8['id']),{'verbose':_0x362f34[_0x27a0c9(0xed)]}),_0x336975=_0x36f585['data'],_0x5b38de=_0x336975['attributes']?.[_0x27a0c9(0xd7)],_0x3be345={'resolveSegment':async _0x4bc563=>{const _0x467ae3=_0x27a0c9;if(!_0x5b38de)return{'name':_0x4bc563,'isJourneyLocal':![]};try{const _0xd54de1=await _0x17c266[_0x467ae3(0x11c)]['getSegment'](_0x5b38de,_0x4bc563),_0x230308=_0xd54de1[_0x467ae3(0x13b)]===SEGMENT_KIND_JOURNEY;let _0x12cc54;return _0x230308&&_0xd54de1[_0x467ae3(0x109)]&&(_0x12cc54={'description':_0xd54de1[_0x467ae3(0xe1)],'rule':apiRuleToYaml(_0xd54de1[_0x467ae3(0x109)])}),{'name':_0xd54de1[_0x467ae3(0x12c)],'isJourneyLocal':_0x230308,'definition':_0x12cc54};}catch(_0x3636a5){return _0x362f34[_0x467ae3(0xed)]&&console[_0x467ae3(0x131)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x4bc563+':\x20'+_0x3636a5[_0x467ae3(0x13a)]),{'name':_0x4bc563,'isJourneyLocal':![]};}}},_0x2b6078=await apiToYamlAsync(_0x336975,_0x3be345),_0x3dc59e=toYamlString(_0x2b6078),_0x41f86a=sanitizeFileName(_0x17e7e8[_0x27a0c9(0xdd)]),_0x541dd7=a25_0x4ac36d[_0x27a0c9(0xe5)](_0x2b0552,_0x41f86a+_0x27a0c9(0x14b)),_0x149597=a25_0x4ac36d[_0x27a0c9(0xd3)](process['cwd'](),_0x541dd7);if(existsSync(_0x541dd7)){const _0x3a22c1=readFileSync(_0x541dd7,_0x27a0c9(0xe2)),_0xd60928=generateDiff(_0x3a22c1,_0x3dc59e),_0x12f8ad=hasChanges(_0xd60928);_0x48c8fb[_0x27a0c9(0x111)]({'relativePath':_0x149597,'absolutePath':_0x541dd7,'content':_0x3dc59e,'isNew':![],'hasChanges':_0x12f8ad,'diff':_0x12f8ad?formatDiffWithColors(_0xd60928):undefined});}else _0x48c8fb[_0x27a0c9(0x111)]({'relativePath':_0x149597,'absolutePath':_0x541dd7,'content':_0x3dc59e,'isNew':!![],'hasChanges':![]});}const _0x6a36c4=_0x48c8fb[_0x27a0c9(0x10f)](_0x3105ed=>_0x3105ed['isNew']),_0x4a2090=_0x48c8fb[_0x27a0c9(0x10f)](_0x10229b=>!_0x10229b['isNew']&&_0x10229b[_0x27a0c9(0x11f)]),_0x4605ad=_0x48c8fb[_0x27a0c9(0x10f)](_0x453d2d=>!_0x453d2d[_0x27a0c9(0xc5)]&&!_0x453d2d['hasChanges']);console[_0x27a0c9(0x131)](_0x27a0c9(0x145)),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0x10a)](_0x437f92[_0x27a0c9(0xd5)]+_0x27a0c9(0xf6))),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0xb7)]('+\x20'+_0x6a36c4[_0x27a0c9(0xd5)]+'\x20new\x20files')),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0xba)]('~\x20'+_0x4a2090[_0x27a0c9(0xd5)]+_0x27a0c9(0x104))),console[_0x27a0c9(0x131)]('\x20\x20'+a25_0x2a9a22[_0x27a0c9(0xe3)]('=\x20'+_0x4605ad[_0x27a0c9(0xd5)]+_0x27a0c9(0xfd))),console['error'](_0x27a0c9(0xf0)+a25_0x2a9a22[_0x27a0c9(0x10a)](_0x2b0552)+'\x0a');if(_0x4a2090[_0x27a0c9(0xd5)]>0x0)for(const _0x226778 of _0x4a2090){console[_0x27a0c9(0x131)](_0x27a0c9(0x134)+_0x226778[_0x27a0c9(0xe8)]+'\x27:'),console[_0x27a0c9(0x131)]('─'[_0x27a0c9(0x135)](0x3c)),console[_0x27a0c9(0x131)](_0x226778[_0x27a0c9(0x146)]),console[_0x27a0c9(0x131)]('─'[_0x27a0c9(0x135)](0x3c));}if(_0x44ff68[_0x27a0c9(0x136)])return console[_0x27a0c9(0x131)](a25_0x2a9a22[_0x27a0c9(0xba)](_0x27a0c9(0x148))),0x0;if(_0x6a36c4[_0x27a0c9(0xd5)]===0x0&&_0x4a2090[_0x27a0c9(0xd5)]===0x0)return console['error'](a25_0x2a9a22[_0x27a0c9(0xb7)](_0x27a0c9(0x14c))),0x0;if(!_0x44ff68[_0x27a0c9(0x120)]&&(_0x6a36c4[_0x27a0c9(0xd5)]>0x0||_0x4a2090['length']>0x0)){const _0xc3bba8=await confirmKey(_0x27a0c9(0x101)+(_0x6a36c4[_0x27a0c9(0xd5)]+_0x4a2090[_0x27a0c9(0xd5)])+_0x27a0c9(0x116));if(!_0xc3bba8)return console['error'](_0x27a0c9(0xb9)),0x1;}!existsSync(_0x2b0552)&&mkdirSync(_0x2b0552,{'recursive':!![]});for(const _0x2b57f1 of _0x48c8fb){(_0x2b57f1[_0x27a0c9(0xc5)]||_0x2b57f1['hasChanges'])&&writeFileSync(_0x2b57f1[_0x27a0c9(0xdb)],_0x2b57f1['content'],'utf-8');}return console[_0x27a0c9(0x131)](a25_0x2a9a22[_0x27a0c9(0xb7)](_0x27a0c9(0x13e)+(_0x6a36c4[_0x27a0c9(0xd5)]+_0x4a2090[_0x27a0c9(0xd5)])+_0x27a0c9(0x12f)+_0x2b0552)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0xe05403=a26_0x102a;(function(_0x5f2a9a,_0x595f5e){const _0xfeaffe=a26_0x102a,_0x4a962a=_0x5f2a9a();while(!![]){try{const _0x520c06=-parseInt(_0xfeaffe(0xe9))/0x1*(-parseInt(_0xfeaffe(0xca))/0x2)+parseInt(_0xfeaffe(0x140))/0x3+-parseInt(_0xfeaffe(0xe1))/0x4*(parseInt(_0xfeaffe(0x156))/0x5)+parseInt(_0xfeaffe(0x13a))/0x6+parseInt(_0xfeaffe(0xda))/0x7*(-parseInt(_0xfeaffe(0xf1))/0x8)+-parseInt(_0xfeaffe(0x118))/0x9*(-parseInt(_0xfeaffe(0x10f))/0xa)+-parseInt(_0xfeaffe(0x111))/0xb;if(_0x520c06===_0x595f5e)break;else _0x4a962a['push'](_0x4a962a['shift']());}catch(_0x291f54){_0x4a962a['push'](_0x4a962a['shift']());}}}(a26_0x42b5,0xbd64d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0x488d53 from'node:fs';function a26_0x42b5(){const _0x9f705d=['log','createAgent','agents','67078wVfrnD','agent','table','description','Fetching\x20agents...','(no\x20message)','getCurrentProject','Error:\x20','3839056ZGSTZf','Backing\x20up\x20project\x20\x27','join','List\x20available\x20LLM\x20models','cause','claude-4.5-haiku','includes','Use\x20format:\x20project-name/agent-name','Fetching\x20available\x20models...','llm:agent:update','Backup\x20cancelled.','\x20\x20Prompts:\x20','Invalid\x20path\x20syntax:\x20','all','\x20\x20Knowledge\x20Bases:\x20','Checking\x20for\x20existing\x20projects...','Deleting\x20agent...','llm:agent:show','Error:\x20Project\x20name\x20is\x20required','length','json','Fetching\x20chat\x20sessions...','llm:agent:create','Creating\x20agent\x20\x27','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','Updating\x20agent...','Deleting\x20project\x20\x27','[image]\x20\x20','targetImageGenerator','Agent\x20updated:\x20','9730wjNHlX','Resolving\x20project\x20\x27','17427047HOurBP','rmSync','Analyzing\x20project\x20\x27','stack','dryRun','filter','Update\x20an\x20existing\x20agent','3573WMWDxN','dim','m\x20ago','entries','chatId','find','numeric','\x20--last','slice','setCurrentProject','targetKnowledgeBase','toLocaleDateString','No\x20messages\x20found\x20in\x20chat\x20history.','getOrCreateDefaultProject','backupProject','models','name','Project\x20deleted:\x20','Error:\x20Agent\x20name\x20is\x20required','Create\x20a\x20new\x20agent\x20in\x20current\x20project','\x20\x20Cause:\x20','magenta','Show\x20agent\x20details','\x27\x20already\x20exists.\x20Overwrite?','model','last','outputDir','\x20->\x20KB:','[content]','Project\x20backed\x20up\x20to:\x20','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','set','knowledgeBases','createdAt','6724446ZrlbtP','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','execute','Delete\x20an\x20agent','resolveAgentId','input','3499800iLudIh','content','substring','INVALID_ARGUMENT','image','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','[output]\x20','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','llm:use','keys','...','attributes','getTime','Resolving\x20agent\x20\x27','getBackupMetadata','green','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','systemPrompt','temperature','cyan','projectName','sourceSite','30bJQJEI','llm:models','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','message','llm:history','llmProject','Agent\x20deleted:\x20','[error]\x20\x20','verbose','llm:project:create','targetAgent','resolveProjectId','Fetching\x20chat\x20history\x20for\x20\x27','updateAgent','Fetching\x20most\x20recent\x20chat...','red','Setting\x20project\x20context\x20to\x20\x27','Select\x20a\x20chat\x20session:','[tool_call]','Set\x20current\x20project\x20context','d\x20ago','error','map','h\x20ago','maxToolIterations','prompt','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','blue','\x20→\x20chat:\x20','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Project\x20not\x20found:\x20','chats','floor','projects','\x20\x20Integrations:\x20','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','[unknown]','List\x20agents\x20in\x20current\x20project','get','Agent\x20created:\x20','select','history','llm:project:delete','starterMessage','deleteProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','jsonl','Validating\x20backup\x20from\x20\x27','format','prompts','output','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','integrations','Usage:\x20','Output\x20directory\x20\x27','llm','short','llm:agents','Error:\x20Backup\x20folder\x20path\x20is\x20required','Load\x20more...','Getting\x20default\x20project...','Restore\x20cancelled.','tdx\x20llm\x20history','stringify','counts','Project\x20context\x20set\x20to:\x20','30zMtpdD','limit','yes','llm:agent:delete','tool_call','toLowerCase','bold','[tool]\x20\x20\x20','LLM_PROJECT_NOT_FOUND','createProject','\x0aStack\x20trace:','targetWebSearchTool','agentId','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','string','Create\x20a\x20new\x20LLM\x20project','14KaSoer','updatedAt','.llm','\x27...','A\x20project\x20named\x20\x27','data','\x20\x20Agents:\x20','239996khEDrY','__load_more__','tdx\x20chats','split','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'];a26_0x42b5=function(){return _0x9f705d;};return a26_0x42b5();}function handleSDKError(_0x553ee3,_0x15da3b){const _0x41147c=a26_0x102a;if(_0x553ee3 instanceof SDKError)console[_0x41147c(0x16d)](_0x41147c(0xf0)+_0x553ee3[_0x41147c(0x15b)]),_0x15da3b[_0x41147c(0x160)]&&(_0x553ee3[_0x41147c(0xf5)]&&console[_0x41147c(0x16d)](_0x41147c(0x12c)+_0x553ee3[_0x41147c(0xf5)]),_0x553ee3[_0x41147c(0x114)]&&(console[_0x41147c(0x16d)](_0x41147c(0xd4)),console['error'](_0x553ee3[_0x41147c(0x114)])));else throw _0x553ee3;}function formatChatHistoryEntry(_0xbc5a44,_0x22c91e){const _0x583322=a26_0x102a,_0x5cf32a=getChalk(_0x22c91e),_0x3983ff=_0x5cf32a['dim'](_0xbc5a44['at']);if(_0x583322(0x13f)in _0xbc5a44){const _0x32b739=_0x5cf32a[_0x583322(0x153)]('[input]\x20\x20');return _0x3983ff+'\x20'+_0x32b739+':\x20'+_0xbc5a44[_0x583322(0x13f)];}if(_0x583322(0x141)in _0xbc5a44){const _0x10ea1c=_0x5cf32a[_0x583322(0x14f)](_0x583322(0x134));return _0x3983ff+'\x20'+_0x10ea1c+':\x20'+_0xbc5a44[_0x583322(0x141)];}if(_0x583322(0xce)in _0xbc5a44){const _0x36d316=_0x5cf32a['yellow'](_0x583322(0x16a)),{functionName:_0x618ce2,functionArguments:_0x2e3902,targetFunction:_0x79143b}=_0xbc5a44['tool_call'];let _0x508973=_0x3983ff+'\x20'+_0x36d316+':\x20'+_0x5cf32a['bold'](_0x618ce2);if(_0x2e3902&&Object[_0x583322(0x149)](_0x2e3902)[_0x583322(0x104)]>0x0){const _0x1a0b3a=Object[_0x583322(0x11b)](_0x2e3902)['map'](([_0x4134d4,_0x589a26])=>_0x4134d4+'='+JSON['stringify'](_0x589a26))[_0x583322(0xf3)](',\x20');_0x508973+='('+_0x1a0b3a+')';}_0x79143b&&(_0x508973+=_0x5cf32a[_0x583322(0x119)]('\x20['+_0x79143b+']'));let _0x289847='';if(_0xbc5a44[_0x583322(0xce)][_0x583322(0x122)])_0x289847=_0x583322(0x133)+_0xbc5a44['tool_call'][_0x583322(0x122)][_0x583322(0x128)];else{if(_0xbc5a44[_0x583322(0xce)][_0x583322(0x162)])_0x289847='\x20->\x20Agent:'+_0xbc5a44[_0x583322(0xce)]['targetAgent'][_0x583322(0x128)];else{if(_0xbc5a44[_0x583322(0xce)][_0x583322(0xd5)])_0x289847='\x20->\x20WebSearch:'+_0xbc5a44[_0x583322(0xce)]['targetWebSearchTool'][_0x583322(0x128)];else _0xbc5a44[_0x583322(0xce)]['targetImageGenerator']&&(_0x289847='\x20->\x20ImageGen:'+_0xbc5a44[_0x583322(0xce)][_0x583322(0x10d)]['name']);}}return _0x508973+_0x289847;}if('tool'in _0xbc5a44){const _0x2a9572=_0x5cf32a[_0x583322(0x12d)](_0x583322(0xd1)),{functionName:_0x4b3fde,functionArguments:_0x17a371,content:_0x4b12e0,newChat:_0x259d5c}=_0xbc5a44['tool'];let _0x46c4aa=_0x3983ff+'\x20'+_0x2a9572+':\x20'+_0x5cf32a[_0x583322(0xd0)](_0x4b3fde);if(_0x17a371){const _0x54fa8d=typeof _0x17a371===_0x583322(0xd8)?_0x17a371:JSON[_0x583322(0xc7)](_0x17a371);_0x46c4aa+='('+_0x54fa8d+')';}return _0x4b12e0&&(_0x46c4aa+='\x0a'+_0x5cf32a[_0x583322(0x119)](_0x4b12e0)),_0x259d5c&&(_0x46c4aa+=_0x5cf32a[_0x583322(0x119)](_0x583322(0x175)+_0x259d5c['id'])),_0x46c4aa;}if(_0x583322(0xba)in _0xbc5a44){const _0x5e67c5=_0x5cf32a[_0x583322(0x174)](_0x583322(0x146));return _0x3983ff+'\x20'+_0x5e67c5+':\x20'+_0xbc5a44['output'][_0x583322(0x128)]+'\x20('+_0xbc5a44[_0x583322(0xba)][_0x583322(0x141)][_0x583322(0x104)]+'\x20bytes)';}if('image'in _0xbc5a44){const _0x17d595=_0x5cf32a['blue'](_0x583322(0x10c)),{width:_0x2e0e1f,height:_0x5224e3,headerText:_0x3e05db}=_0xbc5a44[_0x583322(0x144)],_0xf83550=_0x3e05db?'\x20-\x20'+_0x3e05db:'';return _0x3983ff+'\x20'+_0x17d595+':\x20'+_0x2e0e1f+'x'+_0x5224e3+_0xf83550;}if(_0x583322(0x16d)in _0xbc5a44){const _0x2425c5=_0x5cf32a[_0x583322(0x167)](_0x583322(0x15f));return _0x3983ff+'\x20'+_0x2425c5+':\x20'+_0xbc5a44['error'];}return _0x3983ff+'\x20'+_0x5cf32a['dim'](_0x583322(0x17d))+':\x20'+JSON['stringify'](_0xbc5a44);}async function executeChatHistoryCommand(_0x55143c,_0x4baf52){const _0x11306f=a26_0x102a,{options:_0x337447,args:_0x399ab3,tdx:_0x5d4be1}=_0x55143c,_0x25042f=_0x399ab3[0x0],_0xa3db90=_0x337447,_0x154bd7=_0xa3db90[_0x11306f(0x131)];try{if(_0x154bd7&&_0x25042f)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x11306f(0x16d)](_0x11306f(0xbd)+_0x4baf52+_0x11306f(0x11f)),0x1;if(!_0x25042f&&!_0x154bd7&&_0x337447[_0x11306f(0xb8)]!==undefined){const _0x1fe035=resolveLimit(_0x337447[_0x11306f(0xcb)],DEFAULT_LLM_LIMIT),_0x218576=await withSpinner(_0x11306f(0x106),()=>_0x5d4be1[_0x11306f(0xbf)][_0x11306f(0x178)](_0x1fe035),{'verbose':_0x337447[_0x11306f(0x160)]});return await handleSDKOutput(_0x218576['data'],_0x337447),0x0;}const _0x489b8a=await getChatIdOrSelect(_0x5d4be1,_0x337447,_0x154bd7,_0x25042f);if(!_0x489b8a)return 0x0;return await displayChatHistory(_0x489b8a,_0x5d4be1,_0x337447),0x0;}catch(_0x486873){return handleSDKError(_0x486873,_0x337447),0x1;}}async function displayChatHistory(_0x5b1b04,_0x40e77e,_0x1c5b22){const _0x6ceab0=a26_0x102a,_0x54c617=await withSpinner(_0x6ceab0(0x164)+_0x5b1b04+'\x27...',()=>_0x40e77e[_0x6ceab0(0xbf)][_0x6ceab0(0xb1)](_0x5b1b04),{'verbose':_0x1c5b22[_0x6ceab0(0x160)]}),_0x4d644d=_0x54c617['data'][_0x6ceab0(0xdf)]??[];if(_0x4d644d['length']===0x0){console['log'](_0x6ceab0(0x124));return;}if(_0x1c5b22[_0x6ceab0(0xb8)]!==undefined)await handleSDKOutput(_0x4d644d,_0x1c5b22);else{const _0xa5ab10=_0x4d644d['map'](_0x356ab3=>formatChatHistoryEntry(_0x356ab3,_0x1c5b22)),_0x2c16b9=_0xa5ab10[_0x6ceab0(0xf3)]('\x0a');await writeOutput(_0x2c16b9,_0x1c5b22[_0x6ceab0(0xba)],_0x6ceab0(0xeb));}}async function getChatIdOrSelect(_0x30ae27,_0x22fa0d,_0xa96d65,_0xcd4b70){const _0x15458a=a26_0x102a;if(_0xcd4b70)return _0xcd4b70;if(_0xa96d65){const _0x1fd10c=await withSpinner(_0x15458a(0x166),()=>_0x30ae27[_0x15458a(0xbf)][_0x15458a(0x178)](0x1),{'verbose':_0x22fa0d[_0x15458a(0x160)]});if(_0x1fd10c[_0x15458a(0xdf)][_0x15458a(0x104)]===0x0)return console[_0x15458a(0xe6)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x1fd10c['data'][0x0]['id'];}const _0x26acb1=await selectChatInteractively(_0x30ae27,_0x22fa0d);if(!_0x26acb1)return console[_0x15458a(0xe6)]('\x0aCancelled'),undefined;return _0x26acb1;}async function getProjectIdOrDefault(_0x5bba1e){const _0x498779=a26_0x102a,{tdx:_0x38af8e,options:_0x3b3886}=_0x5bba1e,_0x13dc56=_0x3b3886[_0x498779(0x15d)];if(_0x13dc56){const _0x119f79=await withSpinner(_0x498779(0x110)+_0x13dc56+_0x498779(0xdd),()=>_0x38af8e[_0x498779(0xbf)]['resolveProjectId'](_0x13dc56),{'verbose':_0x3b3886['verbose']});return _0x119f79[_0x498779(0xdf)];}let _0x34e011=_0x38af8e['llm'][_0x498779(0xef)]();if(_0x34e011)return _0x34e011;const _0x506276=await withSpinner(_0x498779(0xc4),()=>_0x38af8e[_0x498779(0xbf)][_0x498779(0x125)](),{'verbose':_0x3b3886[_0x498779(0x160)]});return _0x506276[_0x498779(0xdf)]['id'];}function toLLMProjectInfo(_0x518fbf){const _0x3e13e8=a26_0x102a;return{'name':_0x518fbf[_0x3e13e8(0x14b)][_0x3e13e8(0x128)],'description':_0x518fbf[_0x3e13e8(0x14b)][_0x3e13e8(0xec)],'createdAt':_0x518fbf['attributes'][_0x3e13e8(0x139)],'updatedAt':_0x518fbf[_0x3e13e8(0x14b)]['updatedAt']};}function toAgentInfo(_0x19b4fa){const _0x7955a4=a26_0x102a;return{'name':_0x19b4fa[_0x7955a4(0x14b)]['name'],'description':_0x19b4fa['attributes'][_0x7955a4(0xec)],'prompt':truncatePrompt(_0x19b4fa['attributes']['prompt']),'createdAt':_0x19b4fa[_0x7955a4(0x14b)]['createdAt'],'updatedAt':_0x19b4fa[_0x7955a4(0x14b)][_0x7955a4(0xdb)]};}function truncatePrompt(_0x27f06d){const _0x11f8d1=a26_0x102a;if(!_0x27f06d)return undefined;const _0x506f07=0x64;if(_0x27f06d[_0x11f8d1(0x104)]<=_0x506f07)return _0x27f06d;return _0x27f06d['slice'](0x0,_0x506f07)+_0x11f8d1(0x14a);}export class LLMModelsCommand extends BaseCommand{['name']=a26_0xe05403(0x157);[a26_0xe05403(0xec)]=a26_0xe05403(0xf4);async['execute'](_0x575af5){const _0x62ccb=a26_0xe05403,{options:_0x49d99a,tdx:_0x4a622c}=_0x575af5;try{const _0xa9cb0c=await withSpinner(_0x62ccb(0xf9),()=>_0x4a622c[_0x62ccb(0xbf)][_0x62ccb(0x127)](),{'verbose':_0x49d99a['verbose']});return await handleSDKOutput(_0xa9cb0c[_0x62ccb(0xdf)],_0x49d99a),0x0;}catch(_0x536870){return handleSDKError(_0x536870,_0x49d99a),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0xe05403(0x128)]='llm:projects';[a26_0xe05403(0xec)]='List\x20all\x20LLM\x20projects';async[a26_0xe05403(0x13c)](_0x38d323){const _0x252db3=a26_0xe05403,{options:_0x66860b,args:_0x11b393,tdx:_0x511b02}=_0x38d323;try{const _0x2d198e=_0x11b393[0x0],_0x5dd498=resolveLimit(_0x66860b['limit'],DEFAULT_LLM_LIMIT),_0xd6c670=await withSpinner('Fetching\x20projects...',()=>_0x511b02[_0x252db3(0xbf)][_0x252db3(0x17a)](_0x5dd498),{'verbose':_0x66860b['verbose']});let _0x2877bd=_0xd6c670[_0x252db3(0xdf)];_0x2d198e&&(_0x2877bd=_0xd6c670[_0x252db3(0xdf)][_0x252db3(0x116)](_0x1576b3=>matchGlobPattern(_0x1576b3[_0x252db3(0x14b)][_0x252db3(0x128)],_0x2d198e)));const _0x176f5a=_0x2877bd[_0x252db3(0x16e)](toLLMProjectInfo);return await handleSDKOutput(_0x176f5a,_0x66860b),0x0;}catch(_0x3953f2){return handleSDKError(_0x3953f2,_0x66860b),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0xc1);[a26_0xe05403(0xec)]=a26_0xe05403(0xad);async[a26_0xe05403(0x13c)](_0x5b0862){const _0x409000=a26_0xe05403,{options:_0x110ee7,args:_0x26f99b,tdx:_0x67f667}=_0x5b0862;try{const _0x10a8a5=_0x26f99b[0x0];let _0x587747,_0x3dcc49=_0x10a8a5;if(_0x10a8a5&&_0x10a8a5['includes']('/')){const _0xfcab19=_0x10a8a5['split']('/');if(_0xfcab19[_0x409000(0x104)]===0x2){const [_0x19c938,_0x1b322e]=_0xfcab19,_0x3eb0ea=await _0x67f667[_0x409000(0xbf)][_0x409000(0x17a)](),_0x2e18f9=_0x3eb0ea['find'](_0x10ded2=>_0x10ded2[_0x409000(0x14b)][_0x409000(0x128)][_0x409000(0xcf)]()===_0x19c938[_0x409000(0xcf)]());if(!_0x2e18f9)throw new SDKError(ErrorCode[_0x409000(0xd2)],_0x409000(0x177)+_0x19c938,undefined,{'helpText':_0x409000(0xb5)});_0x587747=_0x2e18f9['id'],_0x3dcc49=_0x1b322e;}else throw new SDKError(ErrorCode[_0x409000(0x143)],_0x409000(0xfd)+_0x10a8a5,undefined,{'helpText':_0x409000(0xf8)});}else _0x587747=await getProjectIdOrDefault(_0x5b0862);const _0xe05d86=await withSpinner(_0x409000(0xed),()=>_0x67f667[_0x409000(0xbf)]['agents'](_0x587747),{'verbose':_0x110ee7[_0x409000(0x160)]});let _0x2905ed=_0xe05d86['data'];_0x3dcc49&&(_0x2905ed=_0xe05d86[_0x409000(0xdf)][_0x409000(0x116)](_0x2282e7=>matchGlobPattern(_0x2282e7[_0x409000(0x14b)][_0x409000(0x128)],_0x3dcc49)));const _0x2db707=_0x2905ed[_0x409000(0x16e)](toAgentInfo);return await handleSDKOutput(_0x2db707,_0x110ee7),0x0;}catch(_0x2fe913){return handleSDKError(_0x2fe913,_0x110ee7),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x102);['description']=a26_0xe05403(0x12e);async['execute'](_0xc265e9){const _0x31e2ff=a26_0xe05403,{options:_0x4eaa89,args:_0x57a5eb,tdx:_0x595e57}=_0xc265e9;if(_0x57a5eb[_0x31e2ff(0x104)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x31e2ff(0xe5)),0x1;const _0x836fa0=_0x57a5eb[0x0];try{const _0x1a9fd6=await getProjectIdOrDefault(_0xc265e9),_0x4f35ba=await withSpinner(_0x31e2ff(0x14d)+_0x836fa0+'\x27...',()=>_0x595e57['llm'][_0x31e2ff(0x13e)](_0x836fa0,_0x1a9fd6),{'verbose':_0x4eaa89['verbose']}),_0x3ffdf9=await withSpinner('Fetching\x20agent...',()=>_0x595e57[_0x31e2ff(0xbf)][_0x31e2ff(0xea)](_0x4f35ba['data']),{'verbose':_0x4eaa89[_0x31e2ff(0x160)]});return await handleSDKOutput([_0x3ffdf9[_0x31e2ff(0xdf)]],_0x4eaa89),0x0;}catch(_0x33939e){return handleSDKError(_0x33939e,_0x4eaa89),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x107);[a26_0xe05403(0xec)]=a26_0xe05403(0x12b);async[a26_0xe05403(0x13c)](_0x2a1889){const _0x1a653c=a26_0xe05403,{options:_0x4801fd,args:_0x252a91,tdx:_0x413352}=_0x2a1889;if(_0x252a91[_0x1a653c(0x104)]===0x0)return console[_0x1a653c(0x16d)](_0x1a653c(0x12a)),console[_0x1a653c(0x16d)](_0x1a653c(0x173)),console[_0x1a653c(0x16d)](_0x1a653c(0x15a)),0x1;const _0x7091eb=_0x252a91[0x0],_0x5c9441=_0x4801fd,_0x542de7=_0x5c9441[_0x1a653c(0x151)],_0x478f6a=_0x5c9441[_0x1a653c(0x130)]||_0x1a653c(0xf6),_0x2571b1=_0x5c9441[_0x1a653c(0xb3)],_0x400942=_0x5c9441[_0x1a653c(0x170)]?Number(_0x5c9441[_0x1a653c(0x170)]):undefined,_0x596a5a=_0x5c9441[_0x1a653c(0x152)]?Number(_0x5c9441[_0x1a653c(0x152)]):undefined;try{let _0x425ff2,_0x1a6e5f;if(_0x7091eb[_0x1a653c(0xf7)]('/')){const _0x1eda61=_0x7091eb[_0x1a653c(0xe4)]('/');if(_0x1eda61['length']===0x2){const [_0x2eb66c,_0x19e569]=_0x1eda61,_0x1d1e46=await withSpinner('Resolving\x20project\x20\x27'+_0x2eb66c+_0x1a653c(0xdd),()=>_0x413352[_0x1a653c(0xbf)][_0x1a653c(0x163)](_0x2eb66c),{'verbose':_0x4801fd[_0x1a653c(0x160)]});_0x425ff2=_0x1d1e46[_0x1a653c(0xdf)],_0x1a6e5f=_0x19e569;}else throw new SDKError(ErrorCode[_0x1a653c(0x143)],'Invalid\x20path\x20syntax:\x20'+_0x7091eb,undefined,{'helpText':_0x1a653c(0xf8)});}else _0x425ff2=await getProjectIdOrDefault(_0x2a1889),_0x1a6e5f=_0x7091eb;const _0x364513=await withSpinner(_0x1a653c(0x108)+_0x1a6e5f+_0x1a653c(0xdd),()=>_0x413352[_0x1a653c(0xbf)][_0x1a653c(0xe7)]({'name':_0x1a6e5f,'projectId':_0x425ff2,'modelType':_0x478f6a,'systemPrompt':_0x542de7,'starterMessage':_0x2571b1,'maxToolIterations':_0x400942,'temperature':_0x596a5a}),{'verbose':_0x4801fd['verbose']});return console[_0x1a653c(0xe6)](_0x1a653c(0xaf)+_0x364513['data']['id']),await handleSDKOutput([_0x364513[_0x1a653c(0xdf)]],_0x4801fd),0x0;}catch(_0x31d6a5){return handleSDKError(_0x31d6a5,_0x4801fd),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0xfa);['description']=a26_0xe05403(0x117);async[a26_0xe05403(0x13c)](_0x5339f5){const _0x3bf4f8=a26_0xe05403,{options:_0x27c290,args:_0xf510b6,tdx:_0x579d89}=_0x5339f5;if(_0xf510b6[_0x3bf4f8(0x104)]===0x0)return console[_0x3bf4f8(0x16d)](_0x3bf4f8(0x12a)),console[_0x3bf4f8(0x16d)]('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x5a4ef4=_0xf510b6[0x0],_0x1d6ab5=_0x27c290,_0x4489fd=_0x1d6ab5[_0x3bf4f8(0x128)],_0x44f242=_0x1d6ab5[_0x3bf4f8(0x171)],_0x559371=_0x1d6ab5[_0x3bf4f8(0xec)],_0x119191=_0x1d6ab5[_0x3bf4f8(0xb3)];if(!_0x4489fd&&!_0x44f242&&!_0x559371&&!_0x119191)return console['error'](_0x3bf4f8(0x150)),console[_0x3bf4f8(0x16d)](_0x3bf4f8(0x159)),0x1;try{const _0x57dc93=await getProjectIdOrDefault(_0x5339f5),_0x23abf3=await withSpinner(_0x3bf4f8(0x14d)+_0x5a4ef4+_0x3bf4f8(0xdd),()=>_0x579d89['llm'][_0x3bf4f8(0x13e)](_0x5a4ef4,_0x57dc93),{'verbose':_0x27c290['verbose']}),_0x1f6914=_0x23abf3[_0x3bf4f8(0xdf)],_0x260eab=await withSpinner(_0x3bf4f8(0x10a),()=>_0x579d89[_0x3bf4f8(0xbf)][_0x3bf4f8(0x165)](_0x1f6914,{'name':_0x4489fd,'prompt':_0x44f242,'description':_0x559371,'starterMessage':_0x119191}),{'verbose':_0x27c290['verbose']});return console[_0x3bf4f8(0xe6)](_0x3bf4f8(0x10e)+_0x260eab[_0x3bf4f8(0xdf)]['id']),await handleSDKOutput([_0x260eab[_0x3bf4f8(0xdf)]],_0x27c290),0x0;}catch(_0x53c568){return handleSDKError(_0x53c568,_0x27c290),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a26_0xe05403(0xcd);[a26_0xe05403(0xec)]=a26_0xe05403(0x13d);async[a26_0xe05403(0x13c)](_0x326f31){const _0x5efe16=a26_0xe05403,{options:_0x5ad07f,args:_0x2371bc,tdx:_0x53ca7d}=_0x326f31;if(_0x2371bc[_0x5efe16(0x104)]===0x0)return console[_0x5efe16(0x16d)](_0x5efe16(0x12a)),console[_0x5efe16(0x16d)](_0x5efe16(0xbb)),0x1;const _0x432b05=_0x2371bc[0x0];try{const _0x117b3b=await getProjectIdOrDefault(_0x326f31),_0x165641=await withSpinner(_0x5efe16(0x14d)+_0x432b05+_0x5efe16(0xdd),()=>_0x53ca7d[_0x5efe16(0xbf)][_0x5efe16(0x13e)](_0x432b05,_0x117b3b),{'verbose':_0x5ad07f[_0x5efe16(0x160)]}),_0x4734bb=_0x165641[_0x5efe16(0xdf)];return await withSpinner(_0x5efe16(0x101),()=>_0x53ca7d['llm']['deleteAgent'](_0x4734bb),{'verbose':_0x5ad07f['verbose']}),console['log'](_0x5efe16(0x15e)+_0x4734bb),0x0;}catch(_0x1acde7){return handleSDKError(_0x1acde7,_0x5ad07f),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x15c);['description']=a26_0xe05403(0xd7);async['execute'](_0x4bb7a3){const _0x37cbfa=a26_0xe05403;return executeChatHistoryCommand(_0x4bb7a3,_0x37cbfa(0xc6));}}export class LLMUseCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x148);[a26_0xe05403(0xec)]=a26_0xe05403(0x16b);async[a26_0xe05403(0x13c)](_0x3a83b2){const _0x5e9f0f=a26_0xe05403,{options:_0x4a0d70,args:_0x2f0c10,tdx:_0x58c2b7}=_0x3a83b2;if(_0x2f0c10['length']===0x0)return console['error'](_0x5e9f0f(0x103)),console[_0x5e9f0f(0x16d)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x315935=_0x2f0c10[0x0];try{return await withSpinner(_0x5e9f0f(0x168)+_0x315935+_0x5e9f0f(0xdd),()=>_0x58c2b7[_0x5e9f0f(0xbf)][_0x5e9f0f(0x121)](_0x315935),{'verbose':_0x4a0d70[_0x5e9f0f(0x160)]}),console[_0x5e9f0f(0xe6)](_0x5e9f0f(0xc9)+_0x315935),0x0;}catch(_0x53830e){return handleSDKError(_0x53830e,_0x4a0d70),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0x161);['description']=a26_0xe05403(0xd9);async[a26_0xe05403(0x13c)](_0x3677b2){const _0x4b83f3=a26_0xe05403,{options:_0x5ad8ad,args:_0x22b5ee,tdx:_0xe70738}=_0x3677b2;if(_0x22b5ee['length']===0x0)return console[_0x4b83f3(0x16d)](_0x4b83f3(0x103)),console[_0x4b83f3(0x16d)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0xa64978=_0x22b5ee[0x0],_0x1ef239=_0x5ad8ad,_0x1c4f6a=_0x1ef239['description'];try{const _0x4d2b77=await withSpinner('Creating\x20project\x20\x27'+_0xa64978+_0x4b83f3(0xdd),()=>_0xe70738[_0x4b83f3(0xbf)][_0x4b83f3(0xd3)]({'name':_0xa64978,'description':_0x1c4f6a}),{'verbose':_0x5ad8ad['verbose']});console[_0x4b83f3(0xe6)]('Project\x20created:\x20'+_0x4d2b77['data']['id']);const _0x4859e0=toLLMProjectInfo(_0x4d2b77[_0x4b83f3(0xdf)]);return await handleSDKOutput([_0x4859e0],_0x5ad8ad),0x0;}catch(_0xe466bf){return handleSDKError(_0xe466bf,_0x5ad8ad),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0xe05403(0x128)]=a26_0xe05403(0xb2);[a26_0xe05403(0xec)]='Delete\x20an\x20LLM\x20project';async[a26_0xe05403(0x13c)](_0x34711b){const _0x41bcf3=a26_0xe05403,{options:_0x43c9d4,args:_0x5c2b21,tdx:_0x254971}=_0x34711b;if(_0x5c2b21[_0x41bcf3(0x104)]===0x0)return console[_0x41bcf3(0x16d)](_0x41bcf3(0x103)),console[_0x41bcf3(0x16d)](_0x41bcf3(0x109)),0x1;const _0x2f4f64=_0x5c2b21[0x0];try{return await withSpinner(_0x41bcf3(0x10b)+_0x2f4f64+'\x27...',()=>_0x254971[_0x41bcf3(0xbf)][_0x41bcf3(0xb4)](_0x2f4f64),{'verbose':_0x43c9d4[_0x41bcf3(0x160)]}),console[_0x41bcf3(0xe6)](_0x41bcf3(0x129)+_0x2f4f64),0x0;}catch(_0x518a78){return handleSDKError(_0x518a78,_0x43c9d4),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']='llm:project:backup';[a26_0xe05403(0xec)]=a26_0xe05403(0x13b);async['execute'](_0x2a16a5){const _0x417560=a26_0xe05403,{options:_0x8a1315,args:_0x1ef9bb,tdx:_0x2b976c}=_0x2a16a5;if(_0x1ef9bb[_0x417560(0x104)]===0x0)return console[_0x417560(0x16d)](_0x417560(0x103)),console[_0x417560(0x16d)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0xf48d8d=_0x1ef9bb[0x0],_0x5555af=_0x8a1315,_0x481a79=_0x5555af[_0x417560(0xba)],_0x4a1ad7=_0x5555af[_0x417560(0x115)];try{const _0xd33c27=_0x481a79||_0xf48d8d+_0x417560(0xdc);if(a26_0x488d53['existsSync'](_0xd33c27)&&!_0x4a1ad7){if(!_0x8a1315[_0x417560(0xcc)]){const _0x345562=await confirm(_0x417560(0xbe)+_0xd33c27+_0x417560(0x12f));if(!_0x345562)return console[_0x417560(0xe6)](_0x417560(0xfb)),0x0;}a26_0x488d53[_0x417560(0x112)](_0xd33c27,{'recursive':!![]});}const _0xbf60d6=await withSpinner(_0x4a1ad7?_0x417560(0x113)+_0xf48d8d+_0x417560(0xdd):_0x417560(0xf2)+_0xf48d8d+_0x417560(0xdd),()=>_0x2b976c[_0x417560(0xbf)][_0x417560(0x126)](_0xf48d8d,_0x481a79,{'dryRun':_0x4a1ad7}),{'verbose':_0x8a1315['verbose']}),_0x13422a=_0xbf60d6[_0x417560(0xdf)];return _0x4a1ad7?console[_0x417560(0xe6)](_0x417560(0x145)+_0x13422a['outputDir']):console[_0x417560(0xe6)](_0x417560(0x135)+_0x13422a[_0x417560(0x132)]),console[_0x417560(0xe6)]('\x20\x20Agents:\x20'+_0x13422a['counts'][_0x417560(0xe8)]),console['log'](_0x417560(0xff)+_0x13422a['counts'][_0x417560(0x138)]),console[_0x417560(0xe6)]('\x20\x20Prompts:\x20'+_0x13422a[_0x417560(0xc8)][_0x417560(0xb9)]),console['log'](_0x417560(0x17b)+_0x13422a[_0x417560(0xc8)][_0x417560(0xbc)]),(_0x8a1315[_0x417560(0xb8)]===_0x417560(0x105)||_0x8a1315[_0x417560(0xb8)]===_0x417560(0xb6))&&await handleSDKOutput([_0x13422a],_0x8a1315),0x0;}catch(_0x1c60fd){return handleSDKError(_0x1c60fd,_0x8a1315),0x1;}}}function a26_0x102a(_0x3f80f9,_0x15dff4){_0x3f80f9=_0x3f80f9-0xad;const _0x42b567=a26_0x42b5();let _0x102a4e=_0x42b567[_0x3f80f9];return _0x102a4e;}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0xe05403(0x128)]='llm:project:restore';['description']=a26_0xe05403(0x158);async[a26_0xe05403(0x13c)](_0x462261){const _0x2c8ff7=a26_0xe05403,{options:_0x448006,args:_0x145d45,tdx:_0x5dfbdb}=_0x462261;if(_0x145d45[_0x2c8ff7(0x104)]===0x0)return console[_0x2c8ff7(0x16d)](_0x2c8ff7(0xc2)),console[_0x2c8ff7(0x16d)](_0x2c8ff7(0x17c)),0x1;const _0x179a23=_0x145d45[0x0],_0x3568ea=_0x448006,_0x3d8cc0=_0x3568ea[_0x2c8ff7(0x128)],_0x211c21=_0x3568ea['dryRun'];try{if(!_0x211c21){const _0x1772bd=_0x5dfbdb[_0x2c8ff7(0xbf)][_0x2c8ff7(0x14e)](_0x179a23),_0x44020e=_0x3d8cc0||_0x1772bd['exportedFrom'][_0x2c8ff7(0x154)],_0x2752c9=await withSpinner(_0x2c8ff7(0x100),()=>_0x5dfbdb[_0x2c8ff7(0xbf)][_0x2c8ff7(0x17a)](),{'verbose':_0x448006[_0x2c8ff7(0x160)]}),_0x472e5b=_0x2752c9[_0x2c8ff7(0xdf)][_0x2c8ff7(0x11d)](_0x5e83bf=>_0x5e83bf['attributes'][_0x2c8ff7(0x128)]===_0x44020e);if(_0x472e5b&&!_0x448006['yes']){const _0x29d557=await confirm(_0x2c8ff7(0xde)+_0x44020e+_0x2c8ff7(0x147));if(!_0x29d557)return console['log'](_0x2c8ff7(0xc5)),0x0;}}const _0x1cfab9=await withSpinner(_0x211c21?_0x2c8ff7(0xb7)+_0x179a23+'\x27...':'Restoring\x20project\x20from\x20\x27'+_0x179a23+_0x2c8ff7(0xdd),()=>_0x5dfbdb[_0x2c8ff7(0xbf)]['restoreProject'](_0x179a23,{'name':_0x3d8cc0,'dryRun':_0x211c21}),{'verbose':_0x448006[_0x2c8ff7(0x160)]}),_0x58aeda=_0x1cfab9[_0x2c8ff7(0xdf)];return _0x58aeda[_0x2c8ff7(0x155)]&&console['log'](_0x2c8ff7(0x176)+_0x58aeda[_0x2c8ff7(0x155)]+'\x27'),_0x211c21?console[_0x2c8ff7(0xe6)](_0x2c8ff7(0x172)+_0x58aeda[_0x2c8ff7(0x154)]):console[_0x2c8ff7(0xe6)]('Project\x20restored:\x20'+_0x58aeda[_0x2c8ff7(0x154)]+'\x20('+_0x58aeda['projectId']+')'),console[_0x2c8ff7(0xe6)](_0x2c8ff7(0xe0)+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0xe8)]),console[_0x2c8ff7(0xe6)]('\x20\x20Knowledge\x20Bases:\x20'+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0x138)]),console[_0x2c8ff7(0xe6)](_0x2c8ff7(0xfc)+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0xb9)]),console[_0x2c8ff7(0xe6)](_0x2c8ff7(0x17b)+_0x58aeda[_0x2c8ff7(0xc8)][_0x2c8ff7(0xbc)]),(_0x448006[_0x2c8ff7(0xb8)]===_0x2c8ff7(0x105)||_0x448006['format']===_0x2c8ff7(0xb6))&&await handleSDKOutput([_0x58aeda],_0x448006),0x0;}catch(_0x374cf5){return handleSDKError(_0x374cf5,_0x448006),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x4aa309,_0xda1fb8){const _0x11724f=a26_0xe05403,_0x590d98=_0xda1fb8[_0x11724f(0xcb)]||CHAT_SELECTOR_PAGE_SIZE;let _0x4d2f73=0x0,_0x4cf4f0=[];const _0x26c4e1=(await import(_0x11724f(0xb9)))['default'],_0x12149f=getChalk(_0xda1fb8);while(!![]){const _0x1e2a89=await withSpinner(_0x11724f(0x106),()=>_0x4aa309[_0x11724f(0xbf)][_0x11724f(0x178)](_0x590d98+_0x4d2f73),{'verbose':_0xda1fb8[_0x11724f(0x160)]});_0x4cf4f0=_0x1e2a89['data'];const _0x3dfb78=_0x4cf4f0[_0x11724f(0x120)](_0x4d2f73,_0x4d2f73+_0x590d98),_0x503539=_0x4cf4f0[_0x11724f(0x104)]>_0x4d2f73+_0x590d98,_0x14ea41=[...new Set(_0x3dfb78[_0x11724f(0x16e)](_0x1371ac=>_0x1371ac['attributes'][_0x11724f(0xd6)])[_0x11724f(0x116)](_0x13db22=>_0x13db22!==undefined))],_0x31a21c=new Map();await Promise[_0x11724f(0xfe)](_0x14ea41['map'](async _0x5e1dec=>{const _0x654de1=_0x11724f;try{const _0x160736=await _0x4aa309[_0x654de1(0xbf)][_0x654de1(0xea)](_0x5e1dec);_0x31a21c['set'](_0x5e1dec,_0x160736['attributes']['name']);}catch{_0x31a21c[_0x654de1(0x137)](_0x5e1dec,_0x5e1dec);}}));const _0x30ae08=_0x3dfb78[_0x11724f(0x16e)](_0x287e63=>{const _0x332694=_0x11724f,_0xded0f3=_0x287e63[_0x332694(0x14b)]['firstInputContent']||_0x332694(0xee),_0x19c5a3=_0xded0f3[_0x332694(0xe4)]('\x0a')[0x0],_0x3a54fb=_0x19c5a3[_0x332694(0x104)]>0x50?_0x19c5a3[_0x332694(0x142)](0x0,0x4d)+_0x332694(0x14a):_0x19c5a3,_0x5ae2b5=_0x287e63[_0x332694(0x14b)][_0x332694(0xd6)]?_0x31a21c[_0x332694(0xae)](_0x287e63['attributes']['agentId'])||_0x287e63[_0x332694(0x14b)][_0x332694(0xd6)]:'(no\x20agent)',_0xab6992=_0x287e63[_0x332694(0x14b)]['lastConversationAt']||_0x287e63[_0x332694(0x14b)]['updatedAt'],_0x39637d=new Date(_0xab6992),_0x125610=new Date(),_0x198a19=_0x125610[_0x332694(0x14c)]()-_0x39637d[_0x332694(0x14c)](),_0x10adc6=Math[_0x332694(0x179)](_0x198a19/0xea60),_0xe9b5ed=Math['floor'](_0x198a19/0x36ee80),_0x331fa4=Math[_0x332694(0x179)](_0x198a19/0x5265c00);let _0x10e789;if(_0x10adc6<0x1)_0x10e789='just\x20now';else{if(_0x10adc6<0x3c)_0x10e789=_0x10adc6+_0x332694(0x11a);else{if(_0xe9b5ed<0x18)_0x10e789=_0xe9b5ed+_0x332694(0x16f);else _0x331fa4<0x7?_0x10e789=_0x331fa4+_0x332694(0x16c):_0x10e789=_0x39637d[_0x332694(0x123)]('en-US',{'month':_0x332694(0xc0),'day':_0x332694(0x11e)});}}return{'title':_0x3a54fb+'\x20'+_0x12149f[_0x332694(0x119)]('['+_0x5ae2b5+']\x20'+_0x10e789),'value':_0x287e63['id']};});_0x503539&&_0x30ae08['push']({'title':_0x12149f[_0x11724f(0x153)](_0x11724f(0xc3)),'value':_0x11724f(0xe2)});const _0x38428b=await _0x26c4e1({'type':_0x11724f(0xb0),'name':'chatId','message':_0x11724f(0x169),'choices':_0x30ae08,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x38428b[_0x11724f(0x11c)])return undefined;if(_0x38428b[_0x11724f(0x11c)]===_0x11724f(0xe2)){_0x4d2f73+=_0x590d98;continue;}return _0x38428b[_0x11724f(0x11c)];}}export class ChatsCommand extends BaseCommand{[a26_0xe05403(0x128)]='chats';[a26_0xe05403(0xec)]=a26_0xe05403(0x136);async['execute'](_0x37bbf7){const _0xed5ec=a26_0xe05403;return executeChatHistoryCommand(_0x37bbf7,_0xed5ec(0xe3));}}
|
|
1
|
+
const a26_0x312a95=a26_0x229e;(function(_0x1a063b,_0x506ab1){const _0x25766a=a26_0x229e,_0x2bb6e9=_0x1a063b();while(!![]){try{const _0x3cf05b=parseInt(_0x25766a(0x219))/0x1*(-parseInt(_0x25766a(0x194))/0x2)+parseInt(_0x25766a(0x23f))/0x3*(-parseInt(_0x25766a(0x250))/0x4)+-parseInt(_0x25766a(0x1bc))/0x5+-parseInt(_0x25766a(0x222))/0x6+parseInt(_0x25766a(0x1ef))/0x7+-parseInt(_0x25766a(0x19a))/0x8*(parseInt(_0x25766a(0x1d3))/0x9)+parseInt(_0x25766a(0x217))/0xa*(parseInt(_0x25766a(0x253))/0xb);if(_0x3cf05b===_0x506ab1)break;else _0x2bb6e9['push'](_0x2bb6e9['shift']());}catch(_0x53d827){_0x2bb6e9['push'](_0x2bb6e9['shift']());}}}(a26_0x1dac,0x626f1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0xcd1495 from'node:fs';function handleSDKError(_0x2a1b10,_0x213a56){const _0x27b7c4=a26_0x229e;if(_0x2a1b10 instanceof SDKError)console['error'](_0x27b7c4(0x19c)+_0x2a1b10[_0x27b7c4(0x1ab)]),_0x213a56[_0x27b7c4(0x1d0)]&&(_0x2a1b10[_0x27b7c4(0x1c0)]&&console[_0x27b7c4(0x190)](_0x27b7c4(0x1a4)+_0x2a1b10['cause']),_0x2a1b10['stack']&&(console['error'](_0x27b7c4(0x22f)),console[_0x27b7c4(0x190)](_0x2a1b10[_0x27b7c4(0x246)])));else throw _0x2a1b10;}function formatChatHistoryEntry(_0x54270a,_0x4a6a20){const _0x59235f=a26_0x229e,_0x192ca9=getChalk(_0x4a6a20),_0x8274ae=_0x192ca9['dim'](_0x54270a['at']);if(_0x59235f(0x23d)in _0x54270a){const _0x2318f0=_0x192ca9[_0x59235f(0x247)]('[input]\x20\x20');return _0x8274ae+'\x20'+_0x2318f0+':\x20'+_0x54270a[_0x59235f(0x23d)];}if(_0x59235f(0x220)in _0x54270a){const _0x3e68c8=_0x192ca9[_0x59235f(0x1cc)]('[content]');return _0x8274ae+'\x20'+_0x3e68c8+':\x20'+_0x54270a['content'];}if('tool_call'in _0x54270a){const _0x25f91d=_0x192ca9[_0x59235f(0x1fe)]('[tool_call]'),{functionName:_0x314b4e,functionArguments:_0x382e85,targetFunction:_0x158a62}=_0x54270a['tool_call'];let _0x4e33a3=_0x8274ae+'\x20'+_0x25f91d+':\x20'+_0x192ca9[_0x59235f(0x245)](_0x314b4e);if(_0x382e85&&Object[_0x59235f(0x1a5)](_0x382e85)[_0x59235f(0x1f6)]>0x0){const _0x3f981f=Object[_0x59235f(0x224)](_0x382e85)['map'](([_0x386671,_0x3a9f4c])=>_0x386671+'='+JSON['stringify'](_0x3a9f4c))[_0x59235f(0x1bf)](',\x20');_0x4e33a3+='('+_0x3f981f+')';}_0x158a62&&(_0x4e33a3+=_0x192ca9[_0x59235f(0x1cd)]('\x20['+_0x158a62+']'));let _0x20be2a='';if(_0x54270a['tool_call'][_0x59235f(0x198)])_0x20be2a=_0x59235f(0x25d)+_0x54270a[_0x59235f(0x1fd)]['targetKnowledgeBase'][_0x59235f(0x1ee)];else{if(_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x227)])_0x20be2a=_0x59235f(0x21e)+_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x227)]['name'];else{if(_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x1a1)])_0x20be2a=_0x59235f(0x213)+_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x1a1)][_0x59235f(0x1ee)];else _0x54270a[_0x59235f(0x1fd)][_0x59235f(0x21a)]&&(_0x20be2a=_0x59235f(0x1ed)+_0x54270a[_0x59235f(0x1fd)][_0x59235f(0x21a)][_0x59235f(0x1ee)]);}}return _0x4e33a3+_0x20be2a;}if(_0x59235f(0x1dc)in _0x54270a){const _0x1fb689=_0x192ca9['magenta'](_0x59235f(0x1a8)),{functionName:_0x254449,functionArguments:_0x41190a,content:_0x17923a,newChat:_0x563046}=_0x54270a['tool'];let _0x6042c2=_0x8274ae+'\x20'+_0x1fb689+':\x20'+_0x192ca9[_0x59235f(0x245)](_0x254449);if(_0x41190a){const _0x379b0f=typeof _0x41190a===_0x59235f(0x235)?_0x41190a:JSON['stringify'](_0x41190a);_0x6042c2+='('+_0x379b0f+')';}return _0x17923a&&(_0x6042c2+='\x0a'+_0x192ca9[_0x59235f(0x1cd)](_0x17923a)),_0x563046&&(_0x6042c2+=_0x192ca9[_0x59235f(0x1cd)](_0x59235f(0x237)+_0x563046['id'])),_0x6042c2;}if(_0x59235f(0x1c2)in _0x54270a){const _0x508bf7=_0x192ca9['blue'](_0x59235f(0x1ca));return _0x8274ae+'\x20'+_0x508bf7+':\x20'+_0x54270a[_0x59235f(0x1c2)][_0x59235f(0x1ee)]+'\x20('+_0x54270a['output'][_0x59235f(0x220)]['length']+_0x59235f(0x244);}if(_0x59235f(0x1a6)in _0x54270a){const _0x2caadf=_0x192ca9[_0x59235f(0x21c)](_0x59235f(0x202)),{width:_0x4d9558,height:_0x4c9db7,headerText:_0x2103a9}=_0x54270a[_0x59235f(0x1a6)],_0x40aae3=_0x2103a9?_0x59235f(0x229)+_0x2103a9:'';return _0x8274ae+'\x20'+_0x2caadf+':\x20'+_0x4d9558+'x'+_0x4c9db7+_0x40aae3;}if(_0x59235f(0x190)in _0x54270a){const _0xca328b=_0x192ca9['red'](_0x59235f(0x255));return _0x8274ae+'\x20'+_0xca328b+':\x20'+_0x54270a[_0x59235f(0x190)];}return _0x8274ae+'\x20'+_0x192ca9['dim'](_0x59235f(0x1c6))+':\x20'+JSON['stringify'](_0x54270a);}async function executeChatHistoryCommand(_0x494fab,_0x44944c){const _0x34e5e3=a26_0x229e,{options:_0x5c6c05,args:_0x28ae0c,tdx:_0x33c26c}=_0x494fab,_0x17b97f=_0x28ae0c[0x0],_0x5c973d=_0x5c6c05,_0x3ef0bc=_0x5c973d[_0x34e5e3(0x242)];try{if(_0x3ef0bc&&_0x17b97f)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x34e5e3(0x190)](_0x34e5e3(0x192)+_0x44944c+_0x34e5e3(0x22b)),0x1;if(!_0x17b97f&&!_0x3ef0bc&&_0x5c6c05[_0x34e5e3(0x1f2)]!==undefined){const _0x2fa31a=resolveLimit(_0x5c6c05[_0x34e5e3(0x191)],DEFAULT_LLM_LIMIT),_0x27c3ef=await withSpinner(_0x34e5e3(0x1be),()=>_0x33c26c[_0x34e5e3(0x1b3)][_0x34e5e3(0x1cf)](_0x2fa31a),{'verbose':_0x5c6c05[_0x34e5e3(0x1d0)]});return await handleSDKOutput(_0x27c3ef[_0x34e5e3(0x203)],_0x5c6c05),0x0;}const _0x3bb055=await getChatIdOrSelect(_0x33c26c,_0x5c6c05,_0x3ef0bc,_0x17b97f);if(!_0x3bb055)return 0x0;return await displayChatHistory(_0x3bb055,_0x33c26c,_0x5c6c05),0x0;}catch(_0x34e8cf){return handleSDKError(_0x34e8cf,_0x5c6c05),0x1;}}async function displayChatHistory(_0x145aad,_0x50915e,_0x45c788){const _0x3b2932=a26_0x229e,_0x13b6b8=await withSpinner(_0x3b2932(0x1bd)+_0x145aad+_0x3b2932(0x251),()=>_0x50915e[_0x3b2932(0x1b3)][_0x3b2932(0x230)](_0x145aad),{'verbose':_0x45c788['verbose']}),_0x3ba974=_0x13b6b8[_0x3b2932(0x203)][_0x3b2932(0x203)]??[];if(_0x3ba974['length']===0x0){console['log'](_0x3b2932(0x1c5));return;}if(_0x45c788['format']!==undefined)await handleSDKOutput(_0x3ba974,_0x45c788);else{const _0x1a2a9e=_0x3ba974[_0x3b2932(0x207)](_0xffd6ca=>formatChatHistoryEntry(_0xffd6ca,_0x45c788)),_0x404ad4=_0x1a2a9e[_0x3b2932(0x1bf)]('\x0a');await writeOutput(_0x404ad4,_0x45c788[_0x3b2932(0x1c2)],_0x3b2932(0x1b1));}}async function getChatIdOrSelect(_0x2a62b0,_0x467d08,_0x40688c,_0x51f242){const _0x2d80fa=a26_0x229e;if(_0x51f242)return _0x51f242;if(_0x40688c){const _0x37db1a=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x2a62b0['llm']['chats'](0x1),{'verbose':_0x467d08[_0x2d80fa(0x1d0)]});if(_0x37db1a['data'][_0x2d80fa(0x1f6)]===0x0)return console[_0x2d80fa(0x216)](_0x2d80fa(0x25a)),undefined;return _0x37db1a[_0x2d80fa(0x203)][0x0]['id'];}const _0x552313=await selectChatInteractively(_0x2a62b0,_0x467d08);if(!_0x552313)return console[_0x2d80fa(0x216)](_0x2d80fa(0x1d4)),undefined;return _0x552313;}async function getProjectIdOrDefault(_0x34393a){const _0x4e5a48=a26_0x229e,{tdx:_0x2d646b,options:_0x1835fb}=_0x34393a,_0x5f43d2=_0x1835fb['llmProject'];if(_0x5f43d2){const _0x184286=await withSpinner('Resolving\x20project\x20\x27'+_0x5f43d2+_0x4e5a48(0x251),()=>_0x2d646b[_0x4e5a48(0x1b3)][_0x4e5a48(0x193)](_0x5f43d2),{'verbose':_0x1835fb['verbose']});return _0x184286[_0x4e5a48(0x203)];}let _0x282781=_0x2d646b[_0x4e5a48(0x1b3)][_0x4e5a48(0x209)]();if(_0x282781)return _0x282781;const _0x44c00b=await withSpinner(_0x4e5a48(0x25c),()=>_0x2d646b['llm'][_0x4e5a48(0x1c7)](),{'verbose':_0x1835fb['verbose']});return _0x44c00b[_0x4e5a48(0x203)]['id'];}function toLLMProjectInfo(_0xd3b6f3){const _0x502570=a26_0x229e;return{'name':_0xd3b6f3[_0x502570(0x1ec)][_0x502570(0x1ee)],'description':_0xd3b6f3[_0x502570(0x1ec)]['description'],'createdAt':_0xd3b6f3[_0x502570(0x1ec)][_0x502570(0x1b4)],'updatedAt':_0xd3b6f3['attributes'][_0x502570(0x24a)]};}function toAgentInfo(_0x134a55){const _0x4af6fc=a26_0x229e;return{'name':_0x134a55[_0x4af6fc(0x1ec)]['name'],'description':_0x134a55[_0x4af6fc(0x1ec)][_0x4af6fc(0x19e)],'prompt':truncatePrompt(_0x134a55[_0x4af6fc(0x1ec)][_0x4af6fc(0x233)]),'createdAt':_0x134a55['attributes'][_0x4af6fc(0x1b4)],'updatedAt':_0x134a55[_0x4af6fc(0x1ec)][_0x4af6fc(0x24a)]};}function truncatePrompt(_0x4e81cd){const _0x54a65f=a26_0x229e;if(!_0x4e81cd)return undefined;const _0x4405c9=0x64;if(_0x4e81cd[_0x54a65f(0x1f6)]<=_0x4405c9)return _0x4e81cd;return _0x4e81cd['slice'](0x0,_0x4405c9)+_0x54a65f(0x1e5);}export class LLMModelsCommand extends BaseCommand{[a26_0x312a95(0x1ee)]='llm:models';[a26_0x312a95(0x19e)]=a26_0x312a95(0x239);async['execute'](_0x55f829){const _0x19ce2d=a26_0x312a95,{options:_0x307dfe,tdx:_0x1a93b6}=_0x55f829;try{const _0x42058f=await withSpinner(_0x19ce2d(0x22a),()=>_0x1a93b6[_0x19ce2d(0x1b3)][_0x19ce2d(0x1da)](),{'verbose':_0x307dfe['verbose']});return await handleSDKOutput(_0x42058f[_0x19ce2d(0x203)],_0x307dfe),0x0;}catch(_0x312fbf){return handleSDKError(_0x312fbf,_0x307dfe),0x1;}}}export class LLMProjectsCommand extends BaseCommand{['name']=a26_0x312a95(0x1f3);[a26_0x312a95(0x19e)]='List\x20all\x20LLM\x20projects';async[a26_0x312a95(0x1e2)](_0x3d8fd4){const _0x107ce2=a26_0x312a95,{options:_0x498960,args:_0x127d71,tdx:_0x682f1f}=_0x3d8fd4;try{const _0x196356=_0x127d71[0x0],_0x3d2aa1=resolveLimit(_0x498960['limit'],DEFAULT_LLM_LIMIT),_0x418cff=await withSpinner(_0x107ce2(0x1b0),()=>_0x682f1f[_0x107ce2(0x1b3)][_0x107ce2(0x214)](_0x3d2aa1),{'verbose':_0x498960[_0x107ce2(0x1d0)]});let _0x395d5a=_0x418cff[_0x107ce2(0x203)];_0x196356&&(_0x395d5a=_0x418cff[_0x107ce2(0x203)][_0x107ce2(0x24f)](_0x323e82=>matchGlobPattern(_0x323e82['attributes'][_0x107ce2(0x1ee)],_0x196356)));const _0x39c1db=_0x395d5a[_0x107ce2(0x207)](toLLMProjectInfo);return await handleSDKOutput(_0x39c1db,_0x498960),0x0;}catch(_0xee9788){return handleSDKError(_0xee9788,_0x498960),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']='llm:agents';['description']=a26_0x312a95(0x1d9);async[a26_0x312a95(0x1e2)](_0xb4ba09){const _0x4623b6=a26_0x312a95,{options:_0x87b4d4,args:_0x4a3ea0,tdx:_0x132243}=_0xb4ba09;try{const _0x11b012=_0x4a3ea0[0x0];let _0xcb39f3,_0x37cec8=_0x11b012;if(_0x11b012&&_0x11b012[_0x4623b6(0x256)]('/')){const _0x48743f=_0x11b012[_0x4623b6(0x24e)]('/');if(_0x48743f[_0x4623b6(0x1f6)]===0x2){const [_0x1f9826,_0x43ebaa]=_0x48743f,_0x3cd2c0=await _0x132243['llm'][_0x4623b6(0x214)](),_0x13513d=_0x3cd2c0[_0x4623b6(0x21f)](_0x2b3872=>_0x2b3872[_0x4623b6(0x1ec)][_0x4623b6(0x1ee)][_0x4623b6(0x21d)]()===_0x1f9826['toLowerCase']());if(!_0x13513d)throw new SDKError(ErrorCode[_0x4623b6(0x231)],_0x4623b6(0x23c)+_0x1f9826,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0xcb39f3=_0x13513d['id'],_0x37cec8=_0x43ebaa;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4623b6(0x212)+_0x11b012,undefined,{'helpText':_0x4623b6(0x25b)});}else _0xcb39f3=await getProjectIdOrDefault(_0xb4ba09);const _0x572ec4=await withSpinner(_0x4623b6(0x1f0),()=>_0x132243[_0x4623b6(0x1b3)][_0x4623b6(0x20c)](_0xcb39f3),{'verbose':_0x87b4d4[_0x4623b6(0x1d0)]});let _0x16805d=_0x572ec4[_0x4623b6(0x203)];_0x37cec8&&(_0x16805d=_0x572ec4['data'][_0x4623b6(0x24f)](_0x4c8253=>matchGlobPattern(_0x4c8253[_0x4623b6(0x1ec)][_0x4623b6(0x1ee)],_0x37cec8)));const _0x5079aa=_0x16805d[_0x4623b6(0x207)](toAgentInfo);return await handleSDKOutput(_0x5079aa,_0x87b4d4),0x0;}catch(_0x2be878){return handleSDKError(_0x2be878,_0x87b4d4),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1dd);['description']='Show\x20agent\x20details';async['execute'](_0x1aa905){const _0x326ae9=a26_0x312a95,{options:_0x4f1ece,args:_0x5dc3d2,tdx:_0x32d947}=_0x1aa905;if(_0x5dc3d2['length']===0x0)return console[_0x326ae9(0x190)](_0x326ae9(0x197)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x1d30c7=_0x5dc3d2[0x0];try{const _0x397507=await getProjectIdOrDefault(_0x1aa905),_0x138885=await withSpinner(_0x326ae9(0x1df)+_0x1d30c7+_0x326ae9(0x251),()=>_0x32d947[_0x326ae9(0x1b3)][_0x326ae9(0x23e)](_0x1d30c7,_0x397507),{'verbose':_0x4f1ece[_0x326ae9(0x1d0)]}),_0x52c098=await withSpinner(_0x326ae9(0x1d8),()=>_0x32d947[_0x326ae9(0x1b3)][_0x326ae9(0x215)](_0x138885[_0x326ae9(0x203)]),{'verbose':_0x4f1ece[_0x326ae9(0x1d0)]});return await handleSDKOutput([_0x52c098[_0x326ae9(0x203)]],_0x4f1ece),0x0;}catch(_0x538963){return handleSDKError(_0x538963,_0x4f1ece),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x25e);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1ba);async[a26_0x312a95(0x1e2)](_0x21cedf){const _0x208edf=a26_0x312a95,{options:_0x1d0da6,args:_0x4544ae,tdx:_0x54fa74}=_0x21cedf;if(_0x4544ae[_0x208edf(0x1f6)]===0x0)return console[_0x208edf(0x190)](_0x208edf(0x197)),console[_0x208edf(0x190)](_0x208edf(0x20e)),console[_0x208edf(0x190)](_0x208edf(0x22e)),0x1;const _0x1ab656=_0x4544ae[0x0],_0x44bfbc=_0x1d0da6,_0x5d94f3=_0x44bfbc[_0x208edf(0x1e1)],_0xfcb4a2=_0x44bfbc[_0x208edf(0x1a9)]||_0x208edf(0x1b8),_0xdcf71b=_0x44bfbc[_0x208edf(0x1e9)],_0x5de387=_0x44bfbc['maxToolIterations']?Number(_0x44bfbc[_0x208edf(0x1c4)]):undefined,_0xeba110=_0x44bfbc[_0x208edf(0x199)]?Number(_0x44bfbc['temperature']):undefined;try{let _0x531fa9,_0x42dc63;if(_0x1ab656[_0x208edf(0x256)]('/')){const _0x14df5b=_0x1ab656[_0x208edf(0x24e)]('/');if(_0x14df5b[_0x208edf(0x1f6)]===0x2){const [_0x2a21cd,_0x4aeb57]=_0x14df5b,_0x406825=await withSpinner(_0x208edf(0x226)+_0x2a21cd+_0x208edf(0x251),()=>_0x54fa74[_0x208edf(0x1b3)][_0x208edf(0x193)](_0x2a21cd),{'verbose':_0x1d0da6['verbose']});_0x531fa9=_0x406825['data'],_0x42dc63=_0x4aeb57;}else throw new SDKError(ErrorCode[_0x208edf(0x195)],'Invalid\x20path\x20syntax:\x20'+_0x1ab656,undefined,{'helpText':_0x208edf(0x25b)});}else _0x531fa9=await getProjectIdOrDefault(_0x21cedf),_0x42dc63=_0x1ab656;const _0x1f7fe1=await withSpinner(_0x208edf(0x1e6)+_0x42dc63+_0x208edf(0x251),()=>_0x54fa74['llm'][_0x208edf(0x1d1)]({'name':_0x42dc63,'projectId':_0x531fa9,'modelType':_0xfcb4a2,'systemPrompt':_0x5d94f3,'starterMessage':_0xdcf71b,'maxToolIterations':_0x5de387,'temperature':_0xeba110}),{'verbose':_0x1d0da6['verbose']});return console[_0x208edf(0x216)](_0x208edf(0x225)+_0x1f7fe1['data']['id']),await handleSDKOutput([_0x1f7fe1['data']],_0x1d0da6),0x0;}catch(_0x27fb07){return handleSDKError(_0x27fb07,_0x1d0da6),0x1;}}}function a26_0x1dac(){const _0x545678=['getOrCreateDefaultProject','Delete\x20an\x20LLM\x20project','llm:project:create','[output]\x20','tdx\x20llm\x20history','green','dim','prompts','chats','verbose','createAgent','jsonl','989397ZcBWrL','\x0aCancelled','llm:history','firstInputContent','Creating\x20project\x20\x27','Fetching\x20agent...','List\x20agents\x20in\x20current\x20project','models','llm:use','tool','llm:agent:show','counts','Resolving\x20agent\x20\x27','\x20\x20Agents:\x20','systemPrompt','execute','\x20\x20Knowledge\x20Bases:\x20','Set\x20current\x20project\x20context','...','Creating\x20agent\x20\x27','Deleting\x20agent...','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','starterMessage','Update\x20an\x20existing\x20agent','setCurrentProject','attributes','\x20->\x20ImageGen:','name','1910720sWlDgh','Fetching\x20agents...','d\x20ago','format','llm:projects','getTime','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','length','agentId','restoreProject','select','Usage:\x20tdx\x20llm\x20use\x20<project-name>','lastConversationAt','Error:\x20Project\x20name\x20is\x20required','tool_call','yellow','Setting\x20project\x20context\x20to\x20\x27','Agent\x20deleted:\x20','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','[image]\x20\x20','data','existsSync','llm:agent:update','Project\x20backed\x20up\x20to:\x20','map','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','getCurrentProject','Create\x20a\x20new\x20LLM\x20project','get','agents','chatId','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Restore\x20cancelled.','deleteAgent','llm:project:backup','Invalid\x20path\x20syntax:\x20','\x20->\x20WebSearch:','projects','agent','log','660shMKRP','floor','8vxVVaJ','targetImageGenerator','all','blue','toLowerCase','\x20->\x20Agent:','find','content','outputDir','1420488ouJaQE','projectName','entries','Agent\x20created:\x20','Resolving\x20project\x20\x27','targetAgent','numeric','\x20-\x20','Fetching\x20available\x20models...','\x20--last','dryRun','Select\x20a\x20chat\x20session:','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','\x0aStack\x20trace:','history','LLM_PROJECT_NOT_FOUND','knowledgeBases','prompt','h\x20ago','string','Load\x20more...','\x20→\x20chat:\x20','backupProject','List\x20available\x20LLM\x20models','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Restoring\x20project\x20from\x20\x27','Project\x20not\x20found:\x20','input','resolveAgentId','1164JhcjST','Deleting\x20project\x20\x27','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','last','yes','\x20bytes)','bold','stack','cyan','llm:project:delete','(no\x20message)','updatedAt','llm:agent:delete','short','integrations','split','filter','1084NoySfQ','\x27...','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','172117ftqFQi','\x20\x20Prompts:\x20','[error]\x20\x20','includes','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','Project\x20context\x20set\x20to:\x20','(no\x20agent)','No\x20chat\x20sessions\x20found.','Use\x20format:\x20project-name/agent-name','Getting\x20default\x20project...','\x20->\x20KB:','llm:agent:create','substring','error','limit','Usage:\x20','resolveProjectId','103478lRrJyf','INVALID_ARGUMENT','default','Error:\x20Agent\x20name\x20is\x20required','targetKnowledgeBase','temperature','8WxFEYk','sourceSite','Error:\x20','createProject','description','\x20\x20Integrations:\x20','__load_more__','targetWebSearchTool','Analyzing\x20project\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','\x20\x20Cause:\x20','keys','image','rmSync','[tool]\x20\x20\x20','model','set','message','getBackupMetadata','deleteProject','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','.llm','Fetching\x20projects...','table','llm:project:restore','llm','createdAt','json','toLocaleDateString','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','claude-4.5-haiku','push','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','183680IvpqOJ','Fetching\x20chat\x20history\x20for\x20\x27','Fetching\x20chat\x20sessions...','join','cause','Output\x20directory\x20\x27','output','exportedFrom','maxToolIterations','No\x20messages\x20found\x20in\x20chat\x20history.','[unknown]'];a26_0x1dac=function(){return _0x545678;};return a26_0x1dac();}function a26_0x229e(_0x215add,_0x5b9009){_0x215add=_0x215add-0x190;const _0x1dac96=a26_0x1dac();let _0x229ef1=_0x1dac96[_0x215add];return _0x229ef1;}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x205);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1ea);async[a26_0x312a95(0x1e2)](_0x1b36db){const _0x34e174=a26_0x312a95,{options:_0x27a84a,args:_0x210a54,tdx:_0x42f5b1}=_0x1b36db;if(_0x210a54[_0x34e174(0x1f6)]===0x0)return console[_0x34e174(0x190)](_0x34e174(0x197)),console[_0x34e174(0x190)](_0x34e174(0x1bb)),0x1;const _0x50d8fd=_0x210a54[0x0],_0x3c709d=_0x27a84a,_0x55e3e7=_0x3c709d[_0x34e174(0x1ee)],_0x36f1df=_0x3c709d[_0x34e174(0x233)],_0x548185=_0x3c709d['description'],_0x10fbed=_0x3c709d[_0x34e174(0x1e9)];if(!_0x55e3e7&&!_0x36f1df&&!_0x548185&&!_0x10fbed)return console[_0x34e174(0x190)](_0x34e174(0x252)),console[_0x34e174(0x190)](_0x34e174(0x1b7)),0x1;try{const _0xd71e93=await getProjectIdOrDefault(_0x1b36db),_0x10d442=await withSpinner('Resolving\x20agent\x20\x27'+_0x50d8fd+_0x34e174(0x251),()=>_0x42f5b1[_0x34e174(0x1b3)]['resolveAgentId'](_0x50d8fd,_0xd71e93),{'verbose':_0x27a84a[_0x34e174(0x1d0)]}),_0x392d09=_0x10d442[_0x34e174(0x203)],_0x2a0539=await withSpinner('Updating\x20agent...',()=>_0x42f5b1[_0x34e174(0x1b3)]['updateAgent'](_0x392d09,{'name':_0x55e3e7,'prompt':_0x36f1df,'description':_0x548185,'starterMessage':_0x10fbed}),{'verbose':_0x27a84a[_0x34e174(0x1d0)]});return console['log']('Agent\x20updated:\x20'+_0x2a0539['data']['id']),await handleSDKOutput([_0x2a0539['data']],_0x27a84a),0x0;}catch(_0x31febd){return handleSDKError(_0x31febd,_0x27a84a),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x24b);[a26_0x312a95(0x19e)]='Delete\x20an\x20agent';async[a26_0x312a95(0x1e2)](_0x5778e1){const _0xc8d179=a26_0x312a95,{options:_0x4d1eb0,args:_0x59fd52,tdx:_0x193fe4}=_0x5778e1;if(_0x59fd52[_0xc8d179(0x1f6)]===0x0)return console[_0xc8d179(0x190)](_0xc8d179(0x197)),console[_0xc8d179(0x190)](_0xc8d179(0x1a3)),0x1;const _0x538c93=_0x59fd52[0x0];try{const _0x155ba1=await getProjectIdOrDefault(_0x5778e1),_0x451289=await withSpinner(_0xc8d179(0x1df)+_0x538c93+'\x27...',()=>_0x193fe4[_0xc8d179(0x1b3)][_0xc8d179(0x23e)](_0x538c93,_0x155ba1),{'verbose':_0x4d1eb0[_0xc8d179(0x1d0)]}),_0x3426df=_0x451289[_0xc8d179(0x203)];return await withSpinner(_0xc8d179(0x1e7),()=>_0x193fe4[_0xc8d179(0x1b3)][_0xc8d179(0x210)](_0x3426df),{'verbose':_0x4d1eb0['verbose']}),console[_0xc8d179(0x216)](_0xc8d179(0x200)+_0x3426df),0x0;}catch(_0x254bfe){return handleSDKError(_0x254bfe,_0x4d1eb0),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1d5);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1ae);async['execute'](_0x437d5f){const _0xdad2f5=a26_0x312a95;return executeChatHistoryCommand(_0x437d5f,_0xdad2f5(0x1cb));}}export class LLMUseCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1db);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1e4);async['execute'](_0x3ab0df){const _0x25349f=a26_0x312a95,{options:_0x23af16,args:_0x12b6cd,tdx:_0x344315}=_0x3ab0df;if(_0x12b6cd[_0x25349f(0x1f6)]===0x0)return console['error'](_0x25349f(0x1fc)),console[_0x25349f(0x190)](_0x25349f(0x1fa)),0x1;const _0x404b9b=_0x12b6cd[0x0];try{return await withSpinner(_0x25349f(0x1ff)+_0x404b9b+_0x25349f(0x251),()=>_0x344315[_0x25349f(0x1b3)][_0x25349f(0x1eb)](_0x404b9b),{'verbose':_0x23af16[_0x25349f(0x1d0)]}),console['log'](_0x25349f(0x258)+_0x404b9b),0x0;}catch(_0x54fe6f){return handleSDKError(_0x54fe6f,_0x23af16),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1c9);[a26_0x312a95(0x19e)]=a26_0x312a95(0x20a);async['execute'](_0x57cbef){const _0x1b9f4a=a26_0x312a95,{options:_0x53fb38,args:_0x42bbf1,tdx:_0x41eaad}=_0x57cbef;if(_0x42bbf1['length']===0x0)return console[_0x1b9f4a(0x190)]('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x1b9f4a(0x241)),0x1;const _0x31eec5=_0x42bbf1[0x0],_0x17ef11=_0x53fb38,_0x39d5fd=_0x17ef11[_0x1b9f4a(0x19e)];try{const _0x471fad=await withSpinner(_0x1b9f4a(0x1d7)+_0x31eec5+_0x1b9f4a(0x251),()=>_0x41eaad[_0x1b9f4a(0x1b3)][_0x1b9f4a(0x19d)]({'name':_0x31eec5,'description':_0x39d5fd}),{'verbose':_0x53fb38[_0x1b9f4a(0x1d0)]});console[_0x1b9f4a(0x216)]('Project\x20created:\x20'+_0x471fad[_0x1b9f4a(0x203)]['id']);const _0x1b74ad=toLLMProjectInfo(_0x471fad[_0x1b9f4a(0x203)]);return await handleSDKOutput([_0x1b74ad],_0x53fb38),0x0;}catch(_0x327f32){return handleSDKError(_0x327f32,_0x53fb38),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{['name']=a26_0x312a95(0x248);[a26_0x312a95(0x19e)]=a26_0x312a95(0x1c8);async['execute'](_0x520d09){const _0x54be90=a26_0x312a95,{options:_0x2b1c05,args:_0x11f8e9,tdx:_0x5d44d3}=_0x520d09;if(_0x11f8e9[_0x54be90(0x1f6)]===0x0)return console[_0x54be90(0x190)](_0x54be90(0x1fc)),console[_0x54be90(0x190)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x34b5da=_0x11f8e9[0x0];try{return await withSpinner(_0x54be90(0x240)+_0x34b5da+'\x27...',()=>_0x5d44d3[_0x54be90(0x1b3)][_0x54be90(0x1ad)](_0x34b5da),{'verbose':_0x2b1c05['verbose']}),console['log']('Project\x20deleted:\x20'+_0x34b5da),0x0;}catch(_0x1b579b){return handleSDKError(_0x1b579b,_0x2b1c05),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a26_0x312a95(0x211);[a26_0x312a95(0x19e)]='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder';async[a26_0x312a95(0x1e2)](_0x4bd974){const _0xd3f3f6=a26_0x312a95,{options:_0x5de120,args:_0x8c6812,tdx:_0x4241ae}=_0x4bd974;if(_0x8c6812[_0xd3f3f6(0x1f6)]===0x0)return console[_0xd3f3f6(0x190)](_0xd3f3f6(0x1fc)),console[_0xd3f3f6(0x190)](_0xd3f3f6(0x257)),0x1;const _0x3423cd=_0x8c6812[0x0],_0x1649ea=_0x5de120,_0x3466d0=_0x1649ea[_0xd3f3f6(0x1c2)],_0x1763f3=_0x1649ea[_0xd3f3f6(0x22c)];try{const _0x528c84=_0x3466d0||_0x3423cd+_0xd3f3f6(0x1af);if(a26_0xcd1495[_0xd3f3f6(0x204)](_0x528c84)&&!_0x1763f3){if(!_0x5de120[_0xd3f3f6(0x243)]){const _0xdffb30=await confirm(_0xd3f3f6(0x1c1)+_0x528c84+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0xdffb30)return console[_0xd3f3f6(0x216)]('Backup\x20cancelled.'),0x0;}a26_0xcd1495[_0xd3f3f6(0x1a7)](_0x528c84,{'recursive':!![]});}const _0x405e40=await withSpinner(_0x1763f3?_0xd3f3f6(0x1a2)+_0x3423cd+'\x27...':'Backing\x20up\x20project\x20\x27'+_0x3423cd+_0xd3f3f6(0x251),()=>_0x4241ae[_0xd3f3f6(0x1b3)][_0xd3f3f6(0x238)](_0x3423cd,_0x3466d0,{'dryRun':_0x1763f3}),{'verbose':_0x5de120['verbose']}),_0x7c5361=_0x405e40[_0xd3f3f6(0x203)];return _0x1763f3?console[_0xd3f3f6(0x216)](_0xd3f3f6(0x208)+_0x7c5361[_0xd3f3f6(0x221)]):console[_0xd3f3f6(0x216)](_0xd3f3f6(0x206)+_0x7c5361[_0xd3f3f6(0x221)]),console['log'](_0xd3f3f6(0x1e0)+_0x7c5361['counts'][_0xd3f3f6(0x20c)]),console[_0xd3f3f6(0x216)](_0xd3f3f6(0x1e3)+_0x7c5361[_0xd3f3f6(0x1de)]['knowledgeBases']),console[_0xd3f3f6(0x216)](_0xd3f3f6(0x254)+_0x7c5361[_0xd3f3f6(0x1de)][_0xd3f3f6(0x1ce)]),console[_0xd3f3f6(0x216)]('\x20\x20Integrations:\x20'+_0x7c5361[_0xd3f3f6(0x1de)][_0xd3f3f6(0x24d)]),(_0x5de120[_0xd3f3f6(0x1f2)]===_0xd3f3f6(0x1b5)||_0x5de120['format']===_0xd3f3f6(0x1d2))&&await handleSDKOutput([_0x7c5361],_0x5de120),0x0;}catch(_0x355c7b){return handleSDKError(_0x355c7b,_0x5de120),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1b2);[a26_0x312a95(0x19e)]=a26_0x312a95(0x201);async[a26_0x312a95(0x1e2)](_0x1df9ff){const _0xf7e623=a26_0x312a95,{options:_0x7df5ee,args:_0x49e650,tdx:_0x443637}=_0x1df9ff;if(_0x49e650['length']===0x0)return console[_0xf7e623(0x190)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0xf7e623(0x190)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x62c0=_0x49e650[0x0],_0x53ff06=_0x7df5ee,_0x48a201=_0x53ff06[_0xf7e623(0x1ee)],_0x4f75e9=_0x53ff06['dryRun'];try{if(!_0x4f75e9){const _0x159baf=_0x443637[_0xf7e623(0x1b3)][_0xf7e623(0x1ac)](_0x62c0),_0x31c772=_0x48a201||_0x159baf[_0xf7e623(0x1c3)]['projectName'],_0x299875=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x443637['llm'][_0xf7e623(0x214)](),{'verbose':_0x7df5ee[_0xf7e623(0x1d0)]}),_0x14dc84=_0x299875[_0xf7e623(0x203)][_0xf7e623(0x21f)](_0x413877=>_0x413877['attributes'][_0xf7e623(0x1ee)]===_0x31c772);if(_0x14dc84&&!_0x7df5ee[_0xf7e623(0x243)]){const _0x2672eb=await confirm('A\x20project\x20named\x20\x27'+_0x31c772+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x2672eb)return console[_0xf7e623(0x216)](_0xf7e623(0x20f)),0x0;}}const _0xbeaa27=await withSpinner(_0x4f75e9?'Validating\x20backup\x20from\x20\x27'+_0x62c0+_0xf7e623(0x251):_0xf7e623(0x23b)+_0x62c0+_0xf7e623(0x251),()=>_0x443637['llm'][_0xf7e623(0x1f8)](_0x62c0,{'name':_0x48a201,'dryRun':_0x4f75e9}),{'verbose':_0x7df5ee[_0xf7e623(0x1d0)]}),_0x287e1a=_0xbeaa27['data'];return _0x287e1a[_0xf7e623(0x19b)]&&console['log']('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x287e1a[_0xf7e623(0x19b)]+'\x27'),_0x4f75e9?console[_0xf7e623(0x216)](_0xf7e623(0x23a)+_0x287e1a[_0xf7e623(0x223)]):console[_0xf7e623(0x216)]('Project\x20restored:\x20'+_0x287e1a[_0xf7e623(0x223)]+'\x20('+_0x287e1a['projectId']+')'),console['log'](_0xf7e623(0x1e0)+_0x287e1a[_0xf7e623(0x1de)][_0xf7e623(0x20c)]),console[_0xf7e623(0x216)](_0xf7e623(0x1e3)+_0x287e1a['counts'][_0xf7e623(0x232)]),console[_0xf7e623(0x216)](_0xf7e623(0x254)+_0x287e1a[_0xf7e623(0x1de)]['prompts']),console[_0xf7e623(0x216)](_0xf7e623(0x19f)+_0x287e1a['counts'][_0xf7e623(0x24d)]),(_0x7df5ee[_0xf7e623(0x1f2)]===_0xf7e623(0x1b5)||_0x7df5ee[_0xf7e623(0x1f2)]===_0xf7e623(0x1d2))&&await handleSDKOutput([_0x287e1a],_0x7df5ee),0x0;}catch(_0xaa4e3a){return handleSDKError(_0xaa4e3a,_0x7df5ee),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x38b47a,_0x43fea6){const _0x5f2e07=a26_0x312a95,_0x10634a=_0x43fea6[_0x5f2e07(0x191)]||CHAT_SELECTOR_PAGE_SIZE;let _0x237f07=0x0,_0xaca990=[];const _0x39f699=(await import(_0x5f2e07(0x1ce)))[_0x5f2e07(0x196)],_0x41f1c2=getChalk(_0x43fea6);while(!![]){const _0x5b2236=await withSpinner(_0x5f2e07(0x1be),()=>_0x38b47a['llm'][_0x5f2e07(0x1cf)](_0x10634a+_0x237f07),{'verbose':_0x43fea6[_0x5f2e07(0x1d0)]});_0xaca990=_0x5b2236[_0x5f2e07(0x203)];const _0x821f6=_0xaca990['slice'](_0x237f07,_0x237f07+_0x10634a),_0xbcf536=_0xaca990[_0x5f2e07(0x1f6)]>_0x237f07+_0x10634a,_0x3fa27b=[...new Set(_0x821f6[_0x5f2e07(0x207)](_0x29632e=>_0x29632e[_0x5f2e07(0x1ec)][_0x5f2e07(0x1f7)])[_0x5f2e07(0x24f)](_0x56f7b6=>_0x56f7b6!==undefined))],_0x4ae1a9=new Map();await Promise[_0x5f2e07(0x21b)](_0x3fa27b['map'](async _0x52e1d1=>{const _0x15e64a=_0x5f2e07;try{const _0x32d538=await _0x38b47a['llm']['agent'](_0x52e1d1);_0x4ae1a9[_0x15e64a(0x1aa)](_0x52e1d1,_0x32d538[_0x15e64a(0x1ec)][_0x15e64a(0x1ee)]);}catch{_0x4ae1a9[_0x15e64a(0x1aa)](_0x52e1d1,_0x52e1d1);}}));const _0x1f62fe=_0x821f6[_0x5f2e07(0x207)](_0x48852f=>{const _0x4a0b44=_0x5f2e07,_0xeea4cc=_0x48852f[_0x4a0b44(0x1ec)][_0x4a0b44(0x1d6)]||_0x4a0b44(0x249),_0x493772=_0xeea4cc[_0x4a0b44(0x24e)]('\x0a')[0x0],_0x1705c7=_0x493772['length']>0x50?_0x493772[_0x4a0b44(0x25f)](0x0,0x4d)+_0x4a0b44(0x1e5):_0x493772,_0x580d41=_0x48852f[_0x4a0b44(0x1ec)]['agentId']?_0x4ae1a9[_0x4a0b44(0x20b)](_0x48852f[_0x4a0b44(0x1ec)]['agentId'])||_0x48852f[_0x4a0b44(0x1ec)][_0x4a0b44(0x1f7)]:_0x4a0b44(0x259),_0x1a8ec9=_0x48852f[_0x4a0b44(0x1ec)][_0x4a0b44(0x1fb)]||_0x48852f['attributes']['updatedAt'],_0x2029e8=new Date(_0x1a8ec9),_0x1d1005=new Date(),_0x28c303=_0x1d1005[_0x4a0b44(0x1f4)]()-_0x2029e8['getTime'](),_0xf95467=Math['floor'](_0x28c303/0xea60),_0x17ce9d=Math[_0x4a0b44(0x218)](_0x28c303/0x36ee80),_0x375628=Math[_0x4a0b44(0x218)](_0x28c303/0x5265c00);let _0x4beec8;if(_0xf95467<0x1)_0x4beec8='just\x20now';else{if(_0xf95467<0x3c)_0x4beec8=_0xf95467+'m\x20ago';else{if(_0x17ce9d<0x18)_0x4beec8=_0x17ce9d+_0x4a0b44(0x234);else _0x375628<0x7?_0x4beec8=_0x375628+_0x4a0b44(0x1f1):_0x4beec8=_0x2029e8[_0x4a0b44(0x1b6)]('en-US',{'month':_0x4a0b44(0x24c),'day':_0x4a0b44(0x228)});}}return{'title':_0x1705c7+'\x20'+_0x41f1c2[_0x4a0b44(0x1cd)]('['+_0x580d41+']\x20'+_0x4beec8),'value':_0x48852f['id']};});_0xbcf536&&_0x1f62fe[_0x5f2e07(0x1b9)]({'title':_0x41f1c2[_0x5f2e07(0x247)](_0x5f2e07(0x236)),'value':_0x5f2e07(0x1a0)});const _0x3253af=await _0x39f699({'type':_0x5f2e07(0x1f9),'name':_0x5f2e07(0x20d),'message':_0x5f2e07(0x22d),'choices':_0x1f62fe,'hint':_0x5f2e07(0x1f5)});if(!_0x3253af[_0x5f2e07(0x20d)])return undefined;if(_0x3253af[_0x5f2e07(0x20d)]==='__load_more__'){_0x237f07+=_0x10634a;continue;}return _0x3253af[_0x5f2e07(0x20d)];}}export class ChatsCommand extends BaseCommand{[a26_0x312a95(0x1ee)]=a26_0x312a95(0x1cf);['description']=a26_0x312a95(0x1e8);async[a26_0x312a95(0x1e2)](_0x11672b){return executeChatHistoryCommand(_0x11672b,'tdx\x20chats');}}
|