@treasuredata/tdx 0.25.1 → 0.25.2
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 +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.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.js +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/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/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.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/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.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/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.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/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.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/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.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/spinner.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-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a17_0x23539e=a17_0x184f;function a17_0x184f(_0x5b7602,_0x4f0c82){_0x5b7602=_0x5b7602-0x95;const _0x3953c9=a17_0x3953();let _0x184fac=_0x3953c9[_0x5b7602];return _0x184fac;}(function(_0xfe74e1,_0x1dc05e){const _0x4516a9=a17_0x184f,_0x230b11=_0xfe74e1();while(!![]){try{const _0x5523fd=-parseInt(_0x4516a9(0xaf))/0x1+parseInt(_0x4516a9(0xd3))/0x2+-parseInt(_0x4516a9(0xc1))/0x3*(-parseInt(_0x4516a9(0xcb))/0x4)+parseInt(_0x4516a9(0xa7))/0x5*(parseInt(_0x4516a9(0xb1))/0x6)+-parseInt(_0x4516a9(0xd6))/0x7+-parseInt(_0x4516a9(0xcc))/0x8*(parseInt(_0x4516a9(0xc5))/0x9)+parseInt(_0x4516a9(0xdb))/0xa;if(_0x5523fd===_0x1dc05e)break;else _0x230b11['push'](_0x230b11['shift']());}catch(_0x4d6017){_0x230b11['push'](_0x230b11['shift']());}}}(a17_0x3953,0x514a1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x23539e(0xe0)]='jobs';['description']=a17_0x23539e(0x99);async[a17_0x23539e(0xd2)](_0xdc4efd){const _0x38c71a=a17_0x23539e,{options:_0x5c8675,tdx:_0x3f3a2a}=_0xdc4efd,_0x28998c=resolveLimit(_0x5c8675['limit'],DEFAULT_DISPLAY_LIMIT),_0x3ecd26=_0x5c8675[_0x38c71a(0xdd)];_0x5c8675[_0x38c71a(0xdc)]&&(console[_0x38c71a(0xd7)](_0x38c71a(0xa8)+_0x28998c+_0x38c71a(0xac)),_0x3ecd26&&console[_0x38c71a(0xd7)](_0x38c71a(0xce)+_0x3ecd26));const _0x9477f=await withSpinner(_0x38c71a(0xdf),()=>_0x3f3a2a[_0x38c71a(0xa2)][_0x38c71a(0xc2)]({'from':0x0,'to':_0x28998c-0x1,'status':_0x3ecd26}),{'verbose':_0x5c8675['verbose']}),_0x5ed301=_0x9477f[_0x38c71a(0x98)];console[_0x38c71a(0xd7)](_0x38c71a(0x9d)+_0x5ed301['length']+_0x38c71a(0xe3)+(_0x5ed301[_0x38c71a(0xaa)]!==0x1?'s':''));const _0x10214c=_0x5ed301[_0x38c71a(0xb7)](_0x5069ea=>{const _0x555a8c=_0x38c71a;let _0x3bc9a0;if(_0x5069ea['start_at']&&_0x5069ea[_0x555a8c(0xd1)]){const _0x5495e2=new Date(_0x5069ea[_0x555a8c(0x9f)])[_0x555a8c(0x97)](),_0xbfdd5=new Date(_0x5069ea['end_at'])['getTime']();_0x3bc9a0=Math[_0x555a8c(0xde)]((_0xbfdd5-_0x5495e2)/0x3e8);}return{'job_id':_0x5069ea[_0x555a8c(0xbf)],'type':_0x5069ea[_0x555a8c(0x9c)],'status':_0x5069ea['status'],'user_name':_0x5069ea['user_name'],'duration_sec':_0x3bc9a0,'created_at':_0x5069ea[_0x555a8c(0xa1)],'started_at':_0x5069ea['start_at'],'end_at':_0x5069ea['end_at']};});return await handleSDKOutput(_0x10214c,_0x5c8675),0x0;}}export class JobShowCommand extends BaseCommand{[a17_0x23539e(0xe0)]=a17_0x23539e(0xd8);['description']=a17_0x23539e(0xc7);[a17_0x23539e(0xab)](_0x455159){const _0x4573c3=a17_0x23539e,_0x3bbf03=_0x455159['args'][0x0];if(!_0x3bbf03)return _0x4573c3(0xc8);return undefined;}async['execute'](_0x2e7035){const _0x36dbca=a17_0x23539e,{options:_0x336436,args:_0x349648,tdx:_0x229d90}=_0x2e7035,_0x6ce574=_0x349648[0x0],_0x238d1c=await withSpinner(_0x36dbca(0xd0),()=>_0x229d90[_0x36dbca(0xa2)][_0x36dbca(0x96)](_0x6ce574),{'verbose':_0x336436[_0x36dbca(0xdc)]}),_0x435a78=_0x238d1c[_0x36dbca(0x98)];let _0x2df680;if(_0x435a78[_0x36dbca(0x9f)]&&_0x435a78['end_at']){const _0x288882=new Date(_0x435a78['start_at'])[_0x36dbca(0x97)](),_0x4b6af6=new Date(_0x435a78[_0x36dbca(0xd1)])[_0x36dbca(0x97)]();_0x2df680=Math['round']((_0x4b6af6-_0x288882)/0x3e8);}const _0x5f4cc5={'job_id':_0x435a78[_0x36dbca(0xbf)],'type':_0x435a78[_0x36dbca(0x9c)],'status':_0x435a78[_0x36dbca(0xdd)],..._0x435a78[_0x36dbca(0xa9)]&&{'user_name':_0x435a78['user_name']},..._0x2df680!==undefined&&{'duration_sec':_0x2df680},..._0x435a78[_0x36dbca(0xa1)]&&{'created_at':_0x435a78[_0x36dbca(0xa1)]},..._0x435a78['start_at']&&{'started_at':_0x435a78[_0x36dbca(0x9f)]},..._0x435a78[_0x36dbca(0xd1)]&&{'end_at':_0x435a78[_0x36dbca(0xd1)]},..._0x435a78[_0x36dbca(0xc6)]&&{'database':_0x435a78['database']},..._0x435a78[_0x36dbca(0xbe)]!==undefined&&{'priority':_0x435a78[_0x36dbca(0xbe)]},..._0x435a78[_0x36dbca(0xb5)]&&{'url':_0x435a78[_0x36dbca(0xb5)]},..._0x435a78[_0x36dbca(0xe2)]&&{'query':_0x435a78[_0x36dbca(0xe2)]},..._0x435a78['debug']&&{'debug':_0x435a78[_0x36dbca(0xd4)]}};return await handleSingleObjectOutput(_0x5f4cc5,_0x336436),0x0;}}export class JobKillCommand extends BaseCommand{[a17_0x23539e(0xe0)]=a17_0x23539e(0xc4);[a17_0x23539e(0xda)]=a17_0x23539e(0xbb);[a17_0x23539e(0xab)](_0x52dfd6){const _0x2218ca=a17_0x23539e,_0x2279fe=_0x52dfd6[_0x2218ca(0xae)][0x0];if(!_0x2279fe)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>';return undefined;}async[a17_0x23539e(0xd2)](_0x478e99){const _0x3a36dd=a17_0x23539e,{options:_0x21ac94,args:_0x9182c3,tdx:_0x5e3cf8}=_0x478e99,_0x406dd1=_0x9182c3[0x0];if(!_0x21ac94['yes']){const _0x2cf467=await confirm(_0x3a36dd(0x95)+_0x406dd1+'?');if(!_0x2cf467)return console[_0x3a36dd(0xd7)]('Cancelled'),0x0;}return await withSpinner(_0x3a36dd(0xa3),()=>_0x5e3cf8[_0x3a36dd(0xa2)][_0x3a36dd(0xb4)](_0x406dd1),{'verbose':_0x21ac94['verbose']}),console[_0x3a36dd(0xd7)](_0x3a36dd(0xb9)+_0x406dd1),console[_0x3a36dd(0xd7)](_0x3a36dd(0xb0)+_0x406dd1+_0x3a36dd(0x9b)),0x0;}}export class JobSubmitCommand extends BaseCommand{['name']=a17_0x23539e(0xbc);[a17_0x23539e(0xda)]='Submit\x20a\x20job';async[a17_0x23539e(0xd2)](_0x598506){const _0x295bf7=a17_0x23539e,{options:_0x140871,args:_0x1801b4,tdx:_0xb8916e}=_0x598506,_0x223d68=_0x140871[_0x295bf7(0xb3)]||_0x295bf7(0xad),_0x333487=_0x140871[_0x295bf7(0x9e)],_0x247fa5=_0x140871[_0x295bf7(0xc6)]||'information_schema';if(_0x223d68!=='trino'&&_0x223d68!==_0x295bf7(0xd9))throw new SDKError(ErrorCode[_0x295bf7(0xb8)],_0x295bf7(0xa5));let _0xb7a428;if(_0x333487){if(_0x1801b4[0x0])throw new SDKError(ErrorCode[_0x295bf7(0xb8)],_0x295bf7(0xc3));const _0x166696=readSqlStatementsFromFile(_0x333487);if(_0x166696[_0x295bf7(0xaa)]===0x0)throw new SDKError(ErrorCode[_0x295bf7(0xb8)],_0x295bf7(0xbd));if(_0x166696[_0x295bf7(0xaa)]>0x1)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x295bf7(0xc9));_0xb7a428=_0x166696[0x0];}else{if(!_0x1801b4[0x0])throw new SDKError(ErrorCode[_0x295bf7(0xb8)],_0x295bf7(0xa6));_0xb7a428=_0x1801b4[0x0];}_0x140871[_0x295bf7(0xdc)]&&(console[_0x295bf7(0xd7)](_0x295bf7(0xe4)+_0x223d68),console[_0x295bf7(0xd7)]('Database:\x20'+_0x247fa5),console['error'](_0x295bf7(0xa0)+_0xb7a428[_0x295bf7(0xb2)](0x0,0x64)+(_0xb7a428['length']>0x64?_0x295bf7(0xca):'')));const _0x53cfba=await withSpinner(_0x295bf7(0xb6),()=>_0xb8916e['jobs'][_0x295bf7(0xd5)](_0x247fa5,_0xb7a428,_0x223d68),{'verbose':_0x140871[_0x295bf7(0xdc)]}),_0x24bbcb=_0x53cfba[_0x295bf7(0x98)];return console[_0x295bf7(0xd7)](_0x295bf7(0xba)),console[_0x295bf7(0xd7)](_0x295bf7(0xcd)+_0x24bbcb[_0x295bf7(0xbf)]),await handleSDKOutput([_0x24bbcb],_0x140871),0x0;}}function a17_0x3953(){const _0x20acbd=['Kill\x20a\x20job','job:submit','No\x20SQL\x20statements\x20found\x20in\x20file','priority','job_id','\x20row','203436Aaxvja','list','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','job:kill','98883RVPPWK','database','Show\x20job\x20details','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','...','12MRSOnL','32nxrenX','\x20\x20Job\x20ID:\x20','Status\x20filter:\x20','result','Getting\x20job\x20details...','end_at','execute','972104HXhpDG','debug','submit','2662625xDqzwI','error','job:show','hive','description','1304690odCQea','verbose','status','round','Listing\x20jobs...','name','job:result','query','\x20job','Job\x20type:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','show','getTime','data','List\x20jobs','✔\x20Retrieved\x20','\x27\x20to\x20verify\x20the\x20job\x20status','type','✔\x20Found\x20','file','start_at','Query:\x20','created_at','jobs','Submitting\x20kill\x20request...','Getting\x20job\x20results...','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','95FNuyRL','Limit:\x20','user_name','length','validate','\x20jobs','trino','args','363367hRGDLX','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','94956DisdAQ','substring','jobType','kill','url','Submitting\x20job...','map','INVALID_ARGUMENT','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','✔\x20Job\x20submitted'];a17_0x3953=function(){return _0x20acbd;};return a17_0x3953();}export class JobResultCommand extends BaseCommand{['name']=a17_0x23539e(0xe1);[a17_0x23539e(0xda)]='Get\x20job\x20results';[a17_0x23539e(0xab)](_0x43a72a){const _0x1955e8=a17_0x23539e,_0x113b6d=_0x43a72a[_0x1955e8(0xae)][0x0];if(!_0x113b6d)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>';return undefined;}async['execute'](_0x4bf02f){const _0x483078=a17_0x23539e,{options:_0x3bcf70,args:_0x2a4c80,tdx:_0xe06448}=_0x4bf02f,_0xe8ba71=_0x2a4c80[0x0],_0x2ba4dc=await withSpinner(_0x483078(0xa4),()=>_0xe06448[_0x483078(0xa2)][_0x483078(0xcf)](_0xe8ba71),{'verbose':_0x3bcf70['verbose']}),_0xfe7dde=_0x2ba4dc['data'];return console[_0x483078(0xd7)](_0x483078(0x9a)+_0xfe7dde[_0x483078(0xaa)]+_0x483078(0xc0)+(_0xfe7dde[_0x483078(0xaa)]!==0x1?'s':'')),await handleSDKOutput(_0xfe7dde,_0x3bcf70),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a18_0x1ef748=a18_0x5933;(function(_0x561de4,_0x41ea49){const _0x16220b=a18_0x5933,_0x2e5cb2=_0x561de4();while(!![]){try{const _0x22d5e8=-parseInt(_0x16220b(0x1f1))/0x1+parseInt(_0x16220b(0x16d))/0x2+parseInt(_0x16220b(0x1b8))/0x3+parseInt(_0x16220b(0x170))/0x4+-parseInt(_0x16220b(0x1eb))/0x5*(-parseInt(_0x16220b(0x172))/0x6)+parseInt(_0x16220b(0x178))/0x7+-parseInt(_0x16220b(0x1a1))/0x8;if(_0x22d5e8===_0x41ea49)break;else _0x2e5cb2['push'](_0x2e5cb2['shift']());}catch(_0x1bfe57){_0x2e5cb2['push'](_0x2e5cb2['shift']());}}}(a18_0xea74,0x7966c));import a18_0x2bf388 from'chalk';import a18_0x4599c5 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a18_0xea74(){const _0x317163=['✔\x20Journey\x20\x22','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Getting\x20journey\x20statistics...','Usage:\x20journey\x20resume\x20<name-or-path>','(root)','json','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Listing\x20journeys...','Pause\x20a\x20running\x20journey','resume','session','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','folders','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','totalEntered','all','test','stage','\x22\x20paused','length','Fetching\x20','Parent\x20segment:\x20','Fetching\x20parent\x20segment...','file','diff','name','\x20Opening\x20','Input:\x20','Usage:\x20journey\x20stats\x20<name-or-path>','Resolving\x20parent\x20segment...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','parent_segment','19929208bEwNfq','options','map','Cancelled','resolveJourneyId','stringify','connector_config','includeStats','then','\x20journey\x20files\x20to\x20','hasChanges','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','yellow','getStatistics','/j/da/je','data','getJourney','get','draft','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','conversionRate','\x20(ID:\x20','2965677Bxbrtz','Error:\x20','(completed)','Resuming\x20journey...','✔\x20Context\x20set:\x20','journeyBundleId','\x0aError:','population','attributes','totalGoalAchieved','utf-8','user','execute','join','\x20new\x20files','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','reentryMode','listJourneysFromParentSegment','✔\x20All\x20files\x20are\x20up\x20to\x20date','getActivation','cyan','.yml','/app/ps/','\x20->\x20','rootFolderId','isNew','message','\x5c$&','journeyName','type','archived','cwd','parentSegment','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','parentName','no_parent','relativePath','\x20\x20-\x20','audienceId','entered','\x20unchanged\x20files','\x20changed\x20files','...','Folder\x20path:\x20','getSegment','Warning:\x20Stage\x20\x22','resolveParentId','Resolving\x20journey...','✔\x20Found\x20','resourceName','pause','145SmxjfR','Getting\x20journey\x20details...','\x0aChanges\x20to\x20\x27','filter','localeCompare','table','30653iBkBDj','getParentFull','Listing\x20folders...','\x22\x20not\x20found','journey:list','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','push','values','journey:view','Target\x20file:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','paused','description','Options:','sort','setPhase','\x20journey','versionNumber','find','journeys','repeat','Error:\x20Parent\x20segment\x20context\x20required','site','\x20\x20Target:\x20','error','listFolders','replace','(draft)','dim','goal','dryRun','yes','exited','🗺️\x20','has','toLowerCase','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)','Found\x20','Error:\x20Journey\x20not\x20found:\x20','entries','helpText','stages','folderId','activationParams','(running)','folderPath','-\x20no\x20files\x20written','Fetching\x20connections\x20for\x20name\x20resolution...','segmentName','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','split','\x20versions)','INVALID_ARGUMENT','buildIdToEmailMap','journey','green','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20\x20Name:\x20','set','journeyId','journeyBundleName','size','segmentPushCommand','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','log','stageName','journey:resume','listJourneysWithFolders','\x20=\x20','add','red','filePath','1738550OMBgUw','/e/','segments','322960kwMwfm','state','85938Mxriht','content','activation_','journey:push','Pausing\x20journey...','base','4655861RpjnAA','segment','launched','(paused)','kind','No\x20journeys\x20found','verbose','Export\x20journey(s)\x20as\x20YAML\x20files','rule'];a18_0xea74=function(){return _0x317163;};return a18_0xea74();}import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x2315d4){const _0x4648c7=a18_0x5933;switch(_0x2315d4){case _0x4648c7(0x17a):return a18_0x2bf388['green'](_0x4648c7(0x150));case _0x4648c7(0x1b3):return a18_0x2bf388[_0x4648c7(0x140)](_0x4648c7(0x13f));case _0x4648c7(0x1fc):return a18_0x2bf388['yellow'](_0x4648c7(0x17b));case'completed':return a18_0x2bf388['blue'](_0x4648c7(0x1ba));case _0x4648c7(0x1d6):return a18_0x2bf388[_0x4648c7(0x140)]('(archived)');default:return'('+_0x2315d4+')';}}function formatJourneyItem(_0x5079dc,_0x247493='',_0x585ab0){const _0x569e65=a18_0x5933,_0x8ea5=formatJourneyState(_0x5079dc[_0x569e65(0x171)]),_0x14ff1a=_0x585ab0?hyperlink(_0x5079dc[_0x569e65(0x160)],_0x585ab0):_0x5079dc[_0x569e65(0x160)];return _0x247493+_0x569e65(0x145)+_0x14ff1a+'\x20'+_0x8ea5;}function escapeRegex(_0x1a432f){const _0x4716eb=a18_0x5933;return _0x1a432f[_0x4716eb(0x13e)](/[.*+?^${}()|[\]\\]/g,_0x4716eb(0x1d3));}function a18_0x5933(_0x3b7f86,_0x2ba05e){_0x3b7f86=_0x3b7f86-0x137;const _0xea74ad=a18_0xea74();let _0x593331=_0xea74ad[_0x3b7f86];return _0x593331;}function globToRegex(_0x43daf1){const _0x1e4128=a18_0x5933,_0x42283e=_0x43daf1[_0x1e4128(0x156)]('*')[_0x1e4128(0x1a3)](escapeRegex);return new RegExp(_0x42283e[_0x1e4128(0x1c5)]('.*'),'i');}function buildRuleToNameMapping(_0x47c9a0){const _0x388051=a18_0x5933,_0x54e219=new Map();if(_0x47c9a0[_0x388051(0x16f)])for(const [_0x52c563,_0x13b9b2]of Object['entries'](_0x47c9a0[_0x388051(0x16f)])){if(_0x13b9b2[_0x388051(0x180)]){const _0x2bd39e=serializeRule(_0x13b9b2[_0x388051(0x180)]),_0x2d29e5=_0x54e219[_0x388051(0x1b2)](_0x2bd39e);_0x2d29e5?_0x2d29e5[_0x388051(0x1f7)](_0x52c563):_0x54e219[_0x388051(0x15e)](_0x2bd39e,[_0x52c563]);}}return _0x54e219;}async function resolveJourneyTarget(_0x1bf639,_0x25a17c,_0x297fec){const _0x2841d3=a18_0x5933;if(isYamlFilePath(_0x1bf639))try{const _0x2a5bd5=await resolveYamlFilePath(_0x1bf639);return _0x297fec&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x1bf639),console[_0x2841d3(0x13c)]('\x20\x20Parent\x20segment:\x20'+_0x2a5bd5[_0x2841d3(0x1d8)]),console['error'](_0x2841d3(0x15d)+_0x2a5bd5[_0x2841d3(0x154)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x2a5bd5[_0x2841d3(0x151)]||_0x2841d3(0x185)))),{'journeyName':_0x2a5bd5[_0x2841d3(0x154)],'parentSegment':_0x2a5bd5[_0x2841d3(0x1d8)],'resolved':_0x2a5bd5};}catch(_0x6cf881){throw new SDKError(ErrorCode[_0x2841d3(0x158)],_0x2841d3(0x18c)+_0x6cf881[_0x2841d3(0x1d2)]);}if(!_0x25a17c)throw new SDKError(ErrorCode[_0x2841d3(0x158)],_0x2841d3(0x1c7));return{'journeyName':_0x1bf639,'parentSegment':_0x25a17c};}export class JourneyListCommand extends BaseCommand{['name']=a18_0x1ef748(0x1f5);[a18_0x1ef748(0x1fd)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x2523ed){const _0x28a8b4=a18_0x1ef748,{options:_0x3f22c1,args:_0x5be06e,tdx:_0x422f08}=_0x2523ed,_0x3888c8=_0x5be06e[0x0],_0x1e1f9f=_0x3f22c1[_0x28a8b4(0x1d8)];if(!_0x1e1f9f)return console[_0x28a8b4(0x13c)](_0x28a8b4(0x139)),console[_0x28a8b4(0x13c)](_0x28a8b4(0x1d9)),0x1;const _0xf59f92=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x422f08['segment'][_0x28a8b4(0x1e6)](_0x1e1f9f),{'verbose':_0x3f22c1['verbose']}),_0x339d87=_0xf59f92['data'];_0x3f22c1[_0x28a8b4(0x17e)]&&(console[_0x28a8b4(0x13c)]('Parent\x20segment:\x20'+_0x1e1f9f+_0x28a8b4(0x1b7)+_0x339d87+')'),_0x3888c8&&console[_0x28a8b4(0x13c)]('Pattern:\x20'+_0x3888c8));const _0x3283ab=await withSpinner(_0x28a8b4(0x197),()=>_0x422f08[_0x28a8b4(0x179)][_0x28a8b4(0x1f2)](_0x339d87),{'verbose':_0x3f22c1[_0x28a8b4(0x17e)]}),_0x2a7d65=_0x3283ab[_0x28a8b4(0x1b0)],_0x7d1e54=_0x2a7d65[_0x28a8b4(0x1d0)],_0x5782d8=await withSpinner(_0x28a8b4(0x188),()=>_0x422f08[_0x28a8b4(0x15a)][_0x28a8b4(0x168)](_0x339d87,_0x7d1e54),{'verbose':_0x3f22c1[_0x28a8b4(0x17e)]});let _0x5994b2=_0x5782d8[_0x28a8b4(0x1b0)][_0x28a8b4(0x137)];const _0x1252db=_0x5782d8[_0x28a8b4(0x1b0)][_0x28a8b4(0x18d)],_0x1be3d3=new Map();for(const _0x7782fa of _0x1252db){_0x1be3d3['set'](_0x7782fa['id'],_0x7782fa[_0x28a8b4(0x19a)]);}if(_0x3888c8){const _0x28facd=globToRegex(_0x3888c8);_0x5994b2=_0x5994b2[_0x28a8b4(0x1ee)](_0x5ac78a=>_0x28facd[_0x28a8b4(0x191)](_0x5ac78a[_0x28a8b4(0x160)]));}console[_0x28a8b4(0x13c)](_0x28a8b4(0x1e8)+_0x5994b2[_0x28a8b4(0x194)]+_0x28a8b4(0x201)+(_0x5994b2['length']!==0x1?'s':''));const _0x533e62=_0x4385e4=>{const _0x1dfe42=_0x28a8b4;return getConsoleNextUrl(_0x3f22c1['site'],_0x1dfe42(0x1ce)+_0x339d87+_0x1dfe42(0x16e)+_0x4385e4+'/j/da');};if(_0x3f22c1['format']===_0x28a8b4(0x1f0))await handleSDKOutput(_0x5994b2,_0x3f22c1);else{if(_0x3f22c1['format']===_0x28a8b4(0x186)){const _0x2570d3=_0x5994b2[_0x28a8b4(0x1a3)](_0x43b956=>({..._0x43b956,'url':_0x533e62(_0x43b956['id'])}));await handleSDKOutput(_0x2570d3,_0x3f22c1);}else{console[_0x28a8b4(0x165)]('['+_0x1e1f9f+']');const _0x15fbfc=new Map(),_0x1140ca=[];for(const _0x29b6f7 of _0x5994b2){if(!_0x29b6f7['folderId']||_0x29b6f7[_0x28a8b4(0x14e)]===_0x7d1e54)_0x1140ca[_0x28a8b4(0x1f7)](_0x29b6f7);else{const _0x41c8b2=_0x15fbfc[_0x28a8b4(0x1b2)](_0x29b6f7['folderId'])||[];_0x41c8b2[_0x28a8b4(0x1f7)](_0x29b6f7),_0x15fbfc[_0x28a8b4(0x15e)](_0x29b6f7[_0x28a8b4(0x14e)],_0x41c8b2);}}const _0x23975b=(_0x52a442,_0x394051)=>_0x52a442[_0x28a8b4(0x160)]['localeCompare'](_0x394051[_0x28a8b4(0x160)],undefined,{'sensitivity':_0x28a8b4(0x177)});_0x1140ca[_0x28a8b4(0x1ff)](_0x23975b);for(const _0x2c89ab of _0x1140ca){console[_0x28a8b4(0x165)](formatJourneyItem(_0x2c89ab,'',_0x533e62(_0x2c89ab['id'])));}const _0x2973df=[..._0x15fbfc[_0x28a8b4(0x14b)]()][_0x28a8b4(0x1ff)]((_0x363e99,_0x367112)=>{const _0x1a1c68=_0x28a8b4,_0x31bc21=_0x1be3d3[_0x1a1c68(0x1b2)](_0x363e99[0x0])||_0x363e99[0x0],_0x14f226=_0x1be3d3[_0x1a1c68(0x1b2)](_0x367112[0x0])||_0x367112[0x0];return _0x31bc21[_0x1a1c68(0x1ef)](_0x14f226,undefined,{'sensitivity':'base'});});for(const [_0xb3fe1f,_0x18df1b]of _0x2973df){const _0x21cc0d=_0x1be3d3[_0x28a8b4(0x1b2)](_0xb3fe1f)||_0xb3fe1f;console[_0x28a8b4(0x165)]('📁\x20'+_0x21cc0d),_0x18df1b['sort'](_0x23975b);for(const _0x33deda of _0x18df1b){console[_0x28a8b4(0x165)](formatJourneyItem(_0x33deda,'\x20\x20',_0x533e62(_0x33deda['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x1ef748(0x19a)]=a18_0x1ef748(0x1f9);[a18_0x1ef748(0x1fd)]='Show\x20journey\x20details';async[a18_0x1ef748(0x1c4)](_0x46e486){const _0xde0cc3=a18_0x1ef748,{options:_0x2a3b8b,args:_0x575ac3,tdx:_0x7fb617}=_0x46e486,_0x387963=_0x575ac3[0x0];if(!_0x387963)return console['error'](_0xde0cc3(0x182)),console['error'](_0xde0cc3(0x164)),console[_0xde0cc3(0x13c)](_0xde0cc3(0x1fe)),console[_0xde0cc3(0x13c)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x2a3b8b['verbose']&&console['error'](_0xde0cc3(0x19c)+_0x387963);const _0x3b2a67=await resolveJourneyTarget(_0x387963,_0x2a3b8b['parentSegment'],_0x2a3b8b[_0xde0cc3(0x17e)]),_0x701330=await withSpinner(_0xde0cc3(0x19e),()=>_0x7fb617[_0xde0cc3(0x179)][_0xde0cc3(0x1e6)](_0x3b2a67[_0xde0cc3(0x1d8)]),{'verbose':_0x2a3b8b[_0xde0cc3(0x17e)]}),_0x5d3246=_0x701330[_0xde0cc3(0x1b0)],_0x5bef95=await withSpinner(_0xde0cc3(0x1e7),()=>_0x7fb617['journey'][_0xde0cc3(0x1a5)](_0x5d3246,_0x3b2a67[_0xde0cc3(0x1d4)]),{'verbose':_0x2a3b8b['verbose']}),_0x1bdf38=_0x5bef95[_0xde0cc3(0x1b0)];if(_0x2a3b8b['web']){const _0x7e2acf=getConsoleNextUrl(_0x2a3b8b['site'],'/app/ps/'+_0x5d3246+_0xde0cc3(0x16e)+_0x1bdf38+'/j/da/je');return console[_0xde0cc3(0x13c)](a18_0x2bf388[_0xde0cc3(0x15b)]('✔')+_0xde0cc3(0x19b)+a18_0x2bf388[_0xde0cc3(0x1cc)](_0x7e2acf)),openBrowser(_0x7e2acf),0x0;}const _0x52a645=await withSpinner(_0xde0cc3(0x1ec),()=>_0x7fb617[_0xde0cc3(0x15a)][_0xde0cc3(0x1b1)](_0x1bdf38),{'verbose':_0x2a3b8b[_0xde0cc3(0x17e)]}),_0x31a6b9=_0x52a645['data'],_0x358cd2=_0x2a3b8b[_0xde0cc3(0x1a8)];let _0xa8fdf2;if(_0x358cd2)try{const _0x3aacb0=await withSpinner(_0xde0cc3(0x183),()=>_0x7fb617['journey'][_0xde0cc3(0x1ae)](_0x1bdf38),{'verbose':_0x2a3b8b[_0xde0cc3(0x17e)]});_0xa8fdf2=_0x3aacb0[_0xde0cc3(0x1b0)];}catch{_0x2a3b8b[_0xde0cc3(0x17e)]&&console[_0xde0cc3(0x13c)]('\x20\x20Statistics\x20not\x20available');}const _0x147955=getConsoleNextUrl(_0x2a3b8b[_0xde0cc3(0x13a)],_0xde0cc3(0x1ce)+_0x5d3246+_0xde0cc3(0x16e)+_0x1bdf38+_0xde0cc3(0x1af)),_0x2d7adb={'id':_0x31a6b9['id'],'name':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x19a)],'description':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x1fd)],'state':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x171)],'paused':_0x31a6b9[_0xde0cc3(0x1c0)]['paused'],'reentry_mode':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x1c8)],'stages':_0x31a6b9[_0xde0cc3(0x1c0)]['journeyStages']?.[_0xde0cc3(0x194)]||0x0,..._0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x141)]&&{'goal':_0x31a6b9[_0xde0cc3(0x1c0)][_0xde0cc3(0x141)][_0xde0cc3(0x19a)]},..._0xa8fdf2&&{'statistics':{'total_entered':_0xa8fdf2[_0xde0cc3(0x18f)],'goal_achieved':_0xa8fdf2[_0xde0cc3(0x1c1)],'goal_rate':_0xa8fdf2['goalRate'],'stages':_0xa8fdf2[_0xde0cc3(0x14d)]}},'url':_0x147955};return await handleSingleObjectOutput(_0x2d7adb,_0x2a3b8b),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x1ef748(0x19a)]='journey:stats';[a18_0x1ef748(0x1fd)]='Show\x20journey\x20statistics';async[a18_0x1ef748(0x1c4)](_0x2b192b){const _0x12fba5=a18_0x1ef748,{options:_0x101306,args:_0x129312,tdx:_0x37db7a}=_0x2b192b,_0x400d2d=_0x129312[0x0];if(!_0x400d2d)return console['error'](_0x12fba5(0x182)),console['error'](_0x12fba5(0x19d)),0x1;_0x101306[_0x12fba5(0x17e)]&&console[_0x12fba5(0x13c)](_0x12fba5(0x19c)+_0x400d2d);const _0x5620b7=await resolveJourneyTarget(_0x400d2d,_0x101306[_0x12fba5(0x1d8)],_0x101306[_0x12fba5(0x17e)]),_0x4ab8e3=await withSpinner(_0x12fba5(0x19e),()=>_0x37db7a[_0x12fba5(0x179)][_0x12fba5(0x1e6)](_0x5620b7['parentSegment']),{'verbose':_0x101306['verbose']}),_0xc96807=_0x4ab8e3[_0x12fba5(0x1b0)],_0x1dc396=await withSpinner('Resolving\x20journey...',()=>_0x37db7a[_0x12fba5(0x15a)][_0x12fba5(0x1a5)](_0xc96807,_0x5620b7[_0x12fba5(0x1d4)]),{'verbose':_0x101306[_0x12fba5(0x17e)]}),_0x375c82=_0x1dc396[_0x12fba5(0x1b0)],_0x3e785e=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x37db7a['journey'][_0x12fba5(0x1ae)](_0x375c82),{'verbose':_0x101306['verbose']}),_0x3b3bb7=_0x3e785e['data'];if(!_0x3b3bb7||_0x3b3bb7[_0x12fba5(0x15f)]===null)return console[_0x12fba5(0x13c)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x5620b7[_0x12fba5(0x1d4)]),console[_0x12fba5(0x13c)](_0x12fba5(0x1f6)),0x0;const _0x4a4bb={'journey_id':_0x3b3bb7['journeyId'],'total_entered':_0x3b3bb7[_0x12fba5(0x18f)],'goal_achieved':_0x3b3bb7[_0x12fba5(0x1c1)],'goal_rate':_0x3b3bb7['goalRate'],'stages':_0x3b3bb7[_0x12fba5(0x14d)]?.[_0x12fba5(0x1a3)](_0x5650f2=>({'name':_0x5650f2['stageName'],'population':_0x5650f2[_0x12fba5(0x1bf)],'entered':_0x5650f2[_0x12fba5(0x1df)],'exited':_0x5650f2[_0x12fba5(0x144)],'conversion_rate':_0x5650f2['conversionRate']}))},_0x544b70=_0x101306[_0x12fba5(0x192)];if(_0x544b70&&_0x3b3bb7['stages']){const _0x524e12=_0x3b3bb7[_0x12fba5(0x14d)][_0x12fba5(0x203)](_0x28e4ee=>_0x28e4ee['stageName']['toLowerCase']()===_0x544b70[_0x12fba5(0x147)]());if(_0x524e12)return await handleSingleObjectOutput({'stage_name':_0x524e12[_0x12fba5(0x166)],'population':_0x524e12[_0x12fba5(0x1bf)],'entered':_0x524e12['entered'],'exited':_0x524e12[_0x12fba5(0x144)],'conversion_rate':_0x524e12[_0x12fba5(0x1b6)]},_0x101306),0x0;console[_0x12fba5(0x13c)](_0x12fba5(0x1e5)+_0x544b70+_0x12fba5(0x1f4));}return await handleSingleObjectOutput(_0x4a4bb,_0x101306),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']='journey:pause';[a18_0x1ef748(0x1fd)]=a18_0x1ef748(0x189);async['execute'](_0x3c4a38){const _0x421983=a18_0x1ef748,{options:_0xca8c,args:_0x199f00,tdx:_0x32aab7}=_0x3c4a38,_0x103aef=_0x199f00[0x0];if(!_0x103aef)return console['error'](_0x421983(0x182)),console[_0x421983(0x13c)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0xca8c[_0x421983(0x17e)]&&console['error'](_0x421983(0x19c)+_0x103aef);const _0x582ccf=await resolveJourneyTarget(_0x103aef,_0xca8c['parentSegment'],_0xca8c[_0x421983(0x17e)]),_0x2af3e5=await withSpinner(_0x421983(0x19e),()=>_0x32aab7[_0x421983(0x179)][_0x421983(0x1e6)](_0x582ccf[_0x421983(0x1d8)]),{'verbose':_0xca8c[_0x421983(0x17e)]}),_0x59f35f=_0x2af3e5[_0x421983(0x1b0)],_0x18be74=await withSpinner(_0x421983(0x1e7),()=>_0x32aab7[_0x421983(0x15a)][_0x421983(0x1a5)](_0x59f35f,_0x582ccf[_0x421983(0x1d4)]),{'verbose':_0xca8c[_0x421983(0x17e)]}),_0x1205d0=_0x18be74[_0x421983(0x1b0)];if(!_0xca8c[_0x421983(0x143)]){const _0x3e8b5f=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x582ccf['journeyName']+'\x22?');if(!_0x3e8b5f)return console[_0x421983(0x13c)](_0x421983(0x1a4)),0x0;}const _0x185512=await withSpinner(_0x421983(0x176),()=>_0x32aab7['journey'][_0x421983(0x1ea)](_0x1205d0),{'verbose':_0xca8c[_0x421983(0x17e)]}),_0x151975=_0x185512[_0x421983(0x1b0)];return console[_0x421983(0x13c)](_0x421983(0x181)+_0x151975[_0x421983(0x1c0)]['name']+_0x421983(0x193)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x1ef748(0x19a)]=a18_0x1ef748(0x167);['description']='Resume\x20a\x20paused\x20journey';async[a18_0x1ef748(0x1c4)](_0x49e2ab){const _0x4e6666=a18_0x1ef748,{options:_0x3223db,args:_0x26a7ea,tdx:_0x7b29bd}=_0x49e2ab,_0x384022=_0x26a7ea[0x0];if(!_0x384022)return console[_0x4e6666(0x13c)](_0x4e6666(0x182)),console['error'](_0x4e6666(0x184)),0x1;_0x3223db[_0x4e6666(0x17e)]&&console['error'](_0x4e6666(0x19c)+_0x384022);const _0x326072=await resolveJourneyTarget(_0x384022,_0x3223db[_0x4e6666(0x1d8)],_0x3223db[_0x4e6666(0x17e)]),_0x3005ea=await withSpinner(_0x4e6666(0x19e),()=>_0x7b29bd['segment'][_0x4e6666(0x1e6)](_0x326072[_0x4e6666(0x1d8)]),{'verbose':_0x3223db[_0x4e6666(0x17e)]}),_0x1e2e5f=_0x3005ea[_0x4e6666(0x1b0)],_0x11caa7=await withSpinner(_0x4e6666(0x1e7),()=>_0x7b29bd[_0x4e6666(0x15a)]['resolveJourneyId'](_0x1e2e5f,_0x326072[_0x4e6666(0x1d4)]),{'verbose':_0x3223db[_0x4e6666(0x17e)]}),_0x1c45bd=_0x11caa7[_0x4e6666(0x1b0)];if(!_0x3223db[_0x4e6666(0x143)]){const _0x415e48=await confirm(_0x4e6666(0x163)+_0x326072[_0x4e6666(0x1d4)]+'\x22?');if(!_0x415e48)return console['error'](_0x4e6666(0x1a4)),0x0;}const _0x40859a=await withSpinner(_0x4e6666(0x1bb),()=>_0x7b29bd[_0x4e6666(0x15a)][_0x4e6666(0x18a)](_0x1c45bd),{'verbose':_0x3223db[_0x4e6666(0x17e)]}),_0x10cd05=_0x40859a[_0x4e6666(0x1b0)];return console['error'](_0x4e6666(0x181)+_0x10cd05[_0x4e6666(0x1c0)]['name']+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x1ef748(0x19a)]='journey:pull';[a18_0x1ef748(0x1fd)]=a18_0x1ef748(0x17f);async[a18_0x1ef748(0x1c4)](_0x116899){const _0x34e112=a18_0x1ef748,{options:_0x27da0e,args:_0x59a5f7,tdx:_0x5a5c03}=_0x116899,_0x243f3d=_0x27da0e,_0x52265c=_0x59a5f7[0x0],_0x371e4c=_0x52265c&&isYamlFilePath(_0x52265c),_0x40ee01=await resolveTarget({'arg':_0x371e4c?_0x52265c:undefined,'contextParent':_0x27da0e['parentSegment'],'cwd':process[_0x34e112(0x1d7)]()});if(!isSuccessfulResolution(_0x40ee01))return _0x40ee01['errorCode']===_0x34e112(0x1db)?(console['error'](a18_0x2bf388[_0x34e112(0x1ad)](_0x34e112(0x15c))),console[_0x34e112(0x13c)](_0x34e112(0x148)),console[_0x34e112(0x13c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x34e112(0x13c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console['error'](_0x34e112(0x187))):(console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x16b)](_0x34e112(0x1b9)+_0x40ee01[_0x34e112(0x1d2)]+'\x0a')),_0x40ee01[_0x34e112(0x14c)]&&console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x1cc)](_0x40ee01[_0x34e112(0x14c)]))),0x1;let _0x2620eb=_0x371e4c?undefined:_0x52265c,_0x7800f1,_0xdda03d;_0x40ee01[_0x34e112(0x1d5)]===_0x34e112(0x198)&&(_0x2620eb=_0x40ee01[_0x34e112(0x1e9)],_0x7800f1=_0x40ee01[_0x34e112(0x16c)],_0xdda03d=_0x40ee01[_0x34e112(0x151)]);const _0x2017fa=_0x40ee01[_0x34e112(0x1da)],_0x4209b7=_0x40ee01['targetDir'];_0x243f3d[_0x34e112(0x17e)]&&(console[_0x34e112(0x13c)](_0x34e112(0x196)+_0x2017fa),console['error']('Target\x20directory:\x20'+_0x4209b7),_0x2620eb&&console['error']('Journey\x20name:\x20'+_0x2620eb),_0x7800f1&&console['error'](_0x34e112(0x1fa)+_0x7800f1),_0xdda03d&&console['error'](_0x34e112(0x1e3)+_0xdda03d));const _0x4c7368=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x5a5c03[_0x34e112(0x179)][_0x34e112(0x1e6)](_0x2017fa),{'verbose':_0x27da0e['verbose']}),_0x2b0168=_0x4c7368[_0x34e112(0x1b0)],[_0x3ff3ec,_0x4f5cb4]=await Promise[_0x34e112(0x190)]([withSpinner(_0x34e112(0x188),()=>_0x5a5c03[_0x34e112(0x15a)][_0x34e112(0x1c9)](_0x2b0168,undefined,{'includeAllVersions':!![]}),{'verbose':_0x27da0e[_0x34e112(0x17e)]}),withSpinner(_0x34e112(0x1f3),()=>_0x5a5c03['segment'][_0x34e112(0x13d)](_0x2b0168),{'verbose':_0x27da0e[_0x34e112(0x17e)]})]);let _0xf6b1b1=_0x3ff3ec[_0x34e112(0x1b0)];const _0x514915=_0x4f5cb4[_0x34e112(0x1b0)],_0x4a00b5=buildFolderIdToPathMap(_0x514915);if(_0x2620eb){const _0x24a657=_0xf6b1b1[_0x34e112(0x1ee)](_0x4b54ca=>_0x4b54ca[_0x34e112(0x160)][_0x34e112(0x147)]()===_0x2620eb['toLowerCase']());if(_0x24a657[_0x34e112(0x194)]===0x0)return console[_0x34e112(0x13c)](_0x34e112(0x14a)+_0x2620eb),console[_0x34e112(0x13c)](_0x34e112(0x155)),0x1;_0xf6b1b1=_0x24a657;}if(_0xdda03d!==undefined){const _0x16d3b1=_0xf6b1b1[_0x34e112(0x1ee)](_0x6c4ee2=>{const _0x32bd5f=_0x34e112,_0x350415=_0x6c4ee2[_0x32bd5f(0x14e)]?_0x4a00b5[_0x32bd5f(0x1b2)](_0x6c4ee2[_0x32bd5f(0x14e)])||'':'';return _0x350415===_0xdda03d;});if(_0x16d3b1[_0x34e112(0x194)]===0x0&&_0xf6b1b1[_0x34e112(0x194)]>0x0){console[_0x34e112(0x13c)]('Error:\x20Journey\x20\x27'+_0x2620eb+'\x27\x20not\x20found\x20in\x20'+(_0xdda03d||'root\x20folder')),console[_0x34e112(0x13c)](_0x34e112(0x1b5));for(const _0x219202 of _0xf6b1b1){const _0x143d87=_0x219202[_0x34e112(0x14e)]?_0x4a00b5['get'](_0x219202['folderId'])||'':'';console[_0x34e112(0x13c)](_0x34e112(0x1dd)+(_0x143d87||_0x34e112(0x185))+'/'+_0x219202['journeyBundleName']);}return 0x1;}_0xf6b1b1=_0x16d3b1;}if(_0xf6b1b1[_0x34e112(0x194)]===0x0)return console[_0x34e112(0x13c)](_0x34e112(0x17d)),0x0;const _0x343298=new Map();for(const _0xc9f5c6 of _0xf6b1b1){const _0x17012f=_0xc9f5c6[_0x34e112(0x1bd)];!_0x343298[_0x34e112(0x146)](_0x17012f)&&_0x343298[_0x34e112(0x15e)](_0x17012f,[]),_0x343298[_0x34e112(0x1b2)](_0x17012f)[_0x34e112(0x1f7)](_0xc9f5c6);}for(const _0x1acc78 of _0x343298[_0x34e112(0x1f8)]()){_0x1acc78[_0x34e112(0x1ff)]((_0x397aab,_0x80bb77)=>(_0x397aab['versionNumber']||0x0)-(_0x80bb77[_0x34e112(0x202)]||0x0));}const _0x559ca6=[],[_0x494ad3,_0x381f1e]=await Promise[_0x34e112(0x190)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x5a5c03[_0x34e112(0x1c3)][_0x34e112(0x159)](),{'verbose':_0x27da0e['verbose']})[_0x34e112(0x1a9)](_0x1348fa=>_0x1348fa[_0x34e112(0x1b0)]),withSpinner(_0x34e112(0x153),()=>_0x5a5c03['connection']['buildIdToNameMap'](),{'verbose':_0x27da0e[_0x34e112(0x17e)]})[_0x34e112(0x1a9)](_0xa3a08b=>_0xa3a08b['data'])]);for(const _0x455739 of _0x343298[_0x34e112(0x1f8)]()){const _0x4d781a=_0x455739[0x0][_0x34e112(0x160)],_0x1355bc=_0x455739[0x0][_0x34e112(0x14e)],_0x4e490e=_0x1355bc?_0x4a00b5[_0x34e112(0x1b2)](_0x1355bc)||'':'',_0x325713=_0x4e490e?a18_0x4599c5[_0x34e112(0x1c5)](_0x4209b7,_0x4e490e):_0x4209b7,_0x2b00a3=_0x7800f1||a18_0x4599c5[_0x34e112(0x1c5)](_0x325713,sanitizeFileName(_0x4d781a)+_0x34e112(0x1cd));let _0x34e8e3,_0x26e8c6;if(existsSync(_0x2b00a3))try{const _0x2bd9e8=readFileSync(_0x2b00a3,_0x34e112(0x1c2)),_0x181e77=parseYamlString(_0x2bd9e8);_0x26e8c6=_0x181e77,_0x34e8e3=buildRuleToNameMapping(_0x181e77),_0x243f3d[_0x34e112(0x17e)]&&_0x34e8e3['size']>0x0&&console['error'](_0x34e112(0x149)+_0x34e8e3[_0x34e112(0x161)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x4d781a);}catch(_0x5833d0){_0x243f3d[_0x34e112(0x17e)]&&console[_0x34e112(0x13c)](_0x34e112(0x1b4)+_0x5833d0[_0x34e112(0x1d2)]);}const _0x4fd528=[],_0x4ac925=new Set(),_0x141fbe=new Map(),_0x517bf0=new Map(),_0x35924f=new Set(),_0x37d2da=new Map(),_0x2918de=new Map(),_0x57e338=createJumpTargetCache();await withProgressSpinner(_0x34e112(0x195)+_0x4d781a+_0x34e112(0x1e2),async _0x5956ba=>{const _0x355513=_0x34e112;for(const _0x6624b2 of _0x455739){const _0x3b9160=_0x455739[_0x355513(0x194)]>0x1?_0x6624b2[_0x355513(0x160)]+'\x20v'+(_0x6624b2['versionNumber']||0x1):_0x6624b2[_0x355513(0x160)];_0x5956ba[_0x355513(0x200)](_0x355513(0x195)+_0x3b9160);const _0x2e0770=await _0x5a5c03[_0x355513(0x15a)]['getJourney'](_0x6624b2['id']),_0x3dda27=_0x2e0770[_0x355513(0x1c0)]?.[_0x355513(0x1de)],_0x298075={'resolveSegment':async _0x1f9f67=>{const _0x2337f6=_0x355513;if(!_0x3dda27)return{'name':_0x1f9f67,'isJourneyLocal':![]};const _0x44464f=_0x141fbe[_0x2337f6(0x1b2)](_0x1f9f67);if(_0x44464f)return _0x44464f;try{const _0x5b8d71=await _0x5a5c03[_0x2337f6(0x179)][_0x2337f6(0x1e4)](_0x3dda27,_0x1f9f67),_0x10c934=_0x5b8d71[_0x2337f6(0x17c)]===SEGMENT_KIND_JOURNEY;let _0x393bdf,_0x2f65d8=_0x5b8d71[_0x2337f6(0x19a)];if(_0x10c934&&_0x5b8d71[_0x2337f6(0x180)]){const _0x516d40=await segmentResponseToDef(_0x5b8d71,{'resolveSegmentName':async _0x5267e0=>{const _0x21bad2=_0x2337f6,_0x1e568=_0x141fbe[_0x21bad2(0x1b2)](_0x5267e0);if(_0x1e568)return _0x1e568[_0x21bad2(0x19a)];const _0x2e2458=await _0x298075['resolveSegment'](_0x5267e0);return _0x2e2458[_0x21bad2(0x19a)];}}),_0x59d081=_0x516d40['rule'];_0x393bdf={'description':_0x5b8d71['description'],'rule':_0x59d081};const _0x59ca15=serializeRule(_0x59d081),_0x4e1a5b=_0x517bf0[_0x2337f6(0x1b2)](_0x59ca15);if(_0x4e1a5b)_0x2f65d8=_0x4e1a5b,_0x393bdf=undefined,_0x243f3d[_0x2337f6(0x17e)]&&console[_0x2337f6(0x13c)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x5b8d71['name']+_0x2337f6(0x1cf)+_0x4e1a5b);else{let _0x5efb63=![];if(_0x34e8e3){const _0x1e3ef6=_0x34e8e3[_0x2337f6(0x1b2)](_0x59ca15);if(_0x1e3ef6){const _0x1f7cea=_0x1e3ef6[_0x2337f6(0x203)](_0x2083f9=>!_0x4ac925[_0x2337f6(0x146)](_0x2083f9));_0x1f7cea&&(_0x2f65d8=_0x1f7cea,_0x4ac925['add'](_0x1f7cea),_0x517bf0[_0x2337f6(0x15e)](_0x59ca15,_0x1f7cea),_0x5efb63=!![],_0x243f3d['verbose']&&console['error']('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x1f7cea+'\x20(rule\x20match)'));}}if(!_0x5efb63){const _0x5ccbdb=generateJourneyLocalName(_0x5b8d71['name']);_0x5ccbdb&&(_0x2f65d8=_0x5ccbdb);let _0xf17c20=_0x2f65d8,_0x3fab13=0x2;while(_0x4ac925[_0x2337f6(0x146)](_0xf17c20)){_0xf17c20=_0x2f65d8+'_'+_0x3fab13,_0x3fab13++;}_0x4ac925[_0x2337f6(0x16a)](_0xf17c20),_0x517bf0['set'](_0x59ca15,_0xf17c20),_0x2f65d8=_0xf17c20;}}}const _0x46f45e={'name':_0x2f65d8,'isJourneyLocal':_0x10c934,'definition':_0x393bdf};return _0x141fbe[_0x2337f6(0x15e)](_0x1f9f67,_0x46f45e),_0x46f45e;}catch(_0x17a013){return _0x27da0e[_0x2337f6(0x17e)]&&console[_0x2337f6(0x13c)](_0x2337f6(0x19f)+_0x1f9f67+':\x20'+_0x17a013[_0x2337f6(0x1d2)]),{'name':_0x1f9f67,'isJourneyLocal':![]};}},'resolveActivation':async _0x18db18=>{const _0x396abc=_0x355513,_0x55c31a=_0x37d2da[_0x396abc(0x1b2)](_0x18db18);if(_0x55c31a)return _0x55c31a;try{const _0x3a2473=await _0x5a5c03[_0x396abc(0x15a)][_0x396abc(0x1cb)](_0x6624b2['id'],_0x18db18),_0x5ecb6d=journeyActivationStepToYaml(_0x3a2473,_0x494ad3,_0x381f1e),_0x1fe4e6=JSON[_0x396abc(0x1a6)]({'name':_0x5ecb6d[_0x396abc(0x19a)],'connection':_0x5ecb6d['connection'],'connector_config':_0x5ecb6d[_0x396abc(0x1a7)]}),_0x95d2de=_0x2918de[_0x396abc(0x1b2)](_0x1fe4e6);if(_0x95d2de){const _0x501eaf={'name':_0x95d2de,'isJourneyLocal':!![],'definition':_0x5ecb6d};return _0x37d2da[_0x396abc(0x15e)](_0x18db18,_0x501eaf),_0x501eaf;}const _0x4cdcd4=_0x3a2473[_0x396abc(0x1c0)][_0x396abc(0x14f)][_0x396abc(0x19a)]||_0x18db18,_0x5c90a7=sanitizeYamlKey(_0x4cdcd4)||_0x396abc(0x174)+_0x18db18;let _0x2bb255=_0x5c90a7,_0x2357a1=0x2;while(_0x35924f['has'](_0x2bb255)){_0x2bb255=_0x5c90a7+'_'+_0x2357a1,_0x2357a1++;}_0x35924f[_0x396abc(0x16a)](_0x2bb255),_0x2918de[_0x396abc(0x15e)](_0x1fe4e6,_0x2bb255);const _0x2d77fb={'name':_0x2bb255,'isJourneyLocal':!![],'definition':_0x5ecb6d};return _0x37d2da[_0x396abc(0x15e)](_0x18db18,_0x2d77fb),_0x2d77fb;}catch(_0x5df163){return _0x27da0e[_0x396abc(0x17e)]&&console[_0x396abc(0x13c)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x18db18+':\x20'+_0x5df163[_0x396abc(0x1d2)]),{'name':_0x18db18,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x195611,_0x2cc82a)=>{const _0x2e64c6=_0x355513;return resolveJumpTarget(_0x195611,_0x2cc82a,_0x57e338,_0x1eb2bc=>_0x5a5c03[_0x2e64c6(0x15a)][_0x2e64c6(0x1b1)](_0x1eb2bc));}},_0x4c8a22=await journeyResponseToDef(_0x2e0770,_0x298075);_0x4fd528[_0x355513(0x1f7)]({'item':_0x6624b2,'yaml':_0x4c8a22});}},{'verbose':_0x27da0e[_0x34e112(0x17e)]});const _0x2c901c=buildMergedJourneyDef(_0x4fd528,_0x34e8e3),_0x40c375=normalizeJourneyDef(_0x2c901c,_0x26e8c6),_0x30d8d2=toYamlString(_0x40c375),_0x3977d5=_0x7800f1||a18_0x4599c5['join'](_0x325713,sanitizeFileName(_0x4d781a)+_0x34e112(0x1cd));!_0x7800f1&&_0x4e490e&&!existsSync(_0x325713)&&mkdirSync(_0x325713,{'recursive':!![]});const _0x203cd6=a18_0x4599c5['relative'](process[_0x34e112(0x1d7)](),_0x3977d5);if(existsSync(_0x3977d5)){const _0x2e2213=readFileSync(_0x3977d5,_0x34e112(0x1c2)),_0xc59ff1=generateDiff(_0x2e2213,_0x30d8d2),_0x588dfc=hasChanges(_0xc59ff1);_0x559ca6[_0x34e112(0x1f7)]({'relativePath':_0x203cd6,'absolutePath':_0x3977d5,'content':_0x30d8d2,'isNew':![],'hasChanges':_0x588dfc,'diff':_0x588dfc?formatDiffWithColors(_0xc59ff1):undefined});}else _0x559ca6[_0x34e112(0x1f7)]({'relativePath':_0x203cd6,'absolutePath':_0x3977d5,'content':_0x30d8d2,'isNew':!![],'hasChanges':![]});}const _0x3b439e=_0x559ca6[_0x34e112(0x1ee)](_0x54efc0=>_0x54efc0[_0x34e112(0x1d1)]),_0x50ac5a=_0x559ca6[_0x34e112(0x1ee)](_0x3d3a7d=>!_0x3d3a7d[_0x34e112(0x1d1)]&&_0x3d3a7d[_0x34e112(0x1ab)]),_0x3ae2fc=_0x559ca6[_0x34e112(0x1ee)](_0x33ec3f=>!_0x33ec3f['isNew']&&!_0x33ec3f[_0x34e112(0x1ab)]),_0x668e64=_0xf6b1b1[_0x34e112(0x194)],_0x31ff91=_0x343298[_0x34e112(0x161)],_0x267ff3=_0x668e64>_0x31ff91?'\x20('+_0x668e64+_0x34e112(0x157):'';console[_0x34e112(0x13c)]('\x0aPull\x20summary:'),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388[_0x34e112(0x1cc)](_0x31ff91+'\x20journeys')+a18_0x2bf388[_0x34e112(0x140)](_0x267ff3)),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388['green']('+\x20'+_0x3b439e['length']+_0x34e112(0x1c6))),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388[_0x34e112(0x1ad)]('~\x20'+_0x50ac5a['length']+_0x34e112(0x1e1))),console[_0x34e112(0x13c)]('\x20\x20'+a18_0x2bf388[_0x34e112(0x140)]('=\x20'+_0x3ae2fc[_0x34e112(0x194)]+_0x34e112(0x1e0))),console[_0x34e112(0x13c)](_0x34e112(0x13b)+a18_0x2bf388[_0x34e112(0x1cc)](_0x4209b7)+'\x0a');if(_0x50ac5a['length']>0x0)for(const _0x363286 of _0x50ac5a){console[_0x34e112(0x13c)](_0x34e112(0x1ed)+_0x363286[_0x34e112(0x1dc)]+'\x27:'),console[_0x34e112(0x13c)]('─'[_0x34e112(0x138)](0x3c)),console[_0x34e112(0x13c)](_0x363286[_0x34e112(0x199)]),console['error']('─'[_0x34e112(0x138)](0x3c));}if(_0x243f3d[_0x34e112(0x142)])return console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x1ad)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x3b439e[_0x34e112(0x194)]===0x0&&_0x50ac5a[_0x34e112(0x194)]===0x0)return console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x15b)](_0x34e112(0x1ca))),saveSessionContext({'parent_segment':_0x2017fa},_0x243f3d[_0x34e112(0x18b)]),console['error'](a18_0x2bf388[_0x34e112(0x15b)](_0x34e112(0x1bc)+a18_0x2bf388[_0x34e112(0x140)]('parent_segment')+_0x34e112(0x169)+a18_0x2bf388[_0x34e112(0x1cc)](_0x2017fa))),0x0;if(!_0x243f3d['yes']&&(_0x3b439e['length']>0x0||_0x50ac5a[_0x34e112(0x194)]>0x0)){if(!isInteractive())return console[_0x34e112(0x13c)](a18_0x2bf388['red'](_0x34e112(0x1be)),_0x34e112(0x1fb)),console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x140)](_0x34e112(0x18e))),0x1;const _0x2bed01=await confirmKey('Write\x20'+(_0x3b439e['length']+_0x50ac5a[_0x34e112(0x194)])+'\x20files?');if(!_0x2bed01)return console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x1ad)]('Aborted.'),_0x34e112(0x152)),0x1;}!existsSync(_0x4209b7)&&mkdirSync(_0x4209b7,{'recursive':!![]});for(const _0x170bc7 of _0x559ca6){(_0x170bc7[_0x34e112(0x1d1)]||_0x170bc7[_0x34e112(0x1ab)])&&writeFileSync(_0x170bc7['absolutePath'],_0x170bc7[_0x34e112(0x173)],_0x34e112(0x1c2));}return console[_0x34e112(0x13c)](a18_0x2bf388['green']('✔\x20Pulled\x20'+(_0x3b439e[_0x34e112(0x194)]+_0x50ac5a[_0x34e112(0x194)])+_0x34e112(0x1aa)+_0x4209b7)),saveSessionContext({'parent_segment':_0x2017fa},_0x243f3d[_0x34e112(0x18b)]),console[_0x34e112(0x13c)](a18_0x2bf388[_0x34e112(0x15b)](_0x34e112(0x1bc)+a18_0x2bf388[_0x34e112(0x140)](_0x34e112(0x1a0))+_0x34e112(0x169)+a18_0x2bf388[_0x34e112(0x1cc)](_0x2017fa))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x1ef748(0x19a)]=a18_0x1ef748(0x175);[a18_0x1ef748(0x1fd)]=a18_0x1ef748(0x1ac);[a18_0x1ef748(0x162)]=new SegmentPushCommand();async['execute'](_0x15f8fe){const _0x25773e=a18_0x1ef748,_0x3fd334=_0x15f8fe['args'][0x0];let _0x1e2de0;if(_0x3fd334){const _0x6d5d20=await resolveTarget({'arg':_0x3fd334,'contextParent':_0x15f8fe[_0x25773e(0x1a2)][_0x25773e(0x1d8)],'cwd':process[_0x25773e(0x1d7)]()});isSuccessfulResolution(_0x6d5d20)&&_0x6d5d20[_0x25773e(0x1d5)]===_0x25773e(0x198)&&(_0x1e2de0=_0x6d5d20[_0x25773e(0x16c)]);}const _0xb72102={..._0x15f8fe,'options':{..._0x15f8fe['options'],'journeysOnly':!![],..._0x1e2de0&&{'singleFilePath':_0x1e2de0}}};return this[_0x25773e(0x162)][_0x25773e(0x1c4)](_0xb72102);}}
|
|
1
|
+
const a18_0xef4941=a18_0xf45d;(function(_0x1affe6,_0x1b2355){const _0x3e5046=a18_0xf45d,_0x3166cc=_0x1affe6();while(!![]){try{const _0x3656e7=-parseInt(_0x3e5046(0x75))/0x1+parseInt(_0x3e5046(0x12e))/0x2*(-parseInt(_0x3e5046(0xf4))/0x3)+parseInt(_0x3e5046(0xc9))/0x4+parseInt(_0x3e5046(0x123))/0x5*(parseInt(_0x3e5046(0x133))/0x6)+parseInt(_0x3e5046(0xee))/0x7*(-parseInt(_0x3e5046(0x124))/0x8)+parseInt(_0x3e5046(0x149))/0x9+-parseInt(_0x3e5046(0xd3))/0xa;if(_0x3656e7===_0x1b2355)break;else _0x3166cc['push'](_0x3166cc['shift']());}catch(_0x31f51d){_0x3166cc['push'](_0x3166cc['shift']());}}}(a18_0x5847,0x20f5b));import a18_0x277403 from'chalk';function a18_0x5847(){const _0xdac4b4=['folderId','targetDir','folderPath','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','format','set','Listing\x20folders...','Fetching\x20connections\x20for\x20name\x20resolution...','type','journeyName','1263627wOXCNU','\x20journey\x20files\x20to\x20','journey:pause','dim','(root)','toLowerCase','resourceName','resolveParentId','(archived)','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Getting\x20journey\x20statistics...','Fetching\x20users\x20for\x20email\x20resolution...','Listing\x20journeys...','resolveSegment','186032ueMelH','args','Getting\x20journey\x20details...','(completed)','add','/j/da/je','segment','Resolving\x20parent\x20segment...','log','then','journey:list','Error:\x20Parent\x20segment\x20context\x20required','journey','\x20Opening\x20','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','resume','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','getParentFull','pause','No\x20journeys\x20found','web','parentSegment','attributes','Usage:\x20journey\x20resume\x20<name-or-path>','listJourneysWithFolders','\x20=\x20','connection','Parent\x20segment:\x20','user','buildIdToEmailMap','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','message','\x5c$&','audienceId','\x20\x20Folder\x20path:\x20','\x0aError:','Write\x20','kind','(draft)','segmentPushCommand','length','\x22\x20resumed','Options:','blue','site','Error:\x20Journey\x20\x27','Warning:\x20Could\x20not\x20resolve\x20segment\x20','relativePath','repeat','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Found\x20','push','Fetching\x20parent\x20segment...','/app/ps/','\x0aChanges\x20to\x20\x27','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','folders','Pattern:\x20','stageName','\x20\x20-\x20','listFolders','Aborted.','versionNumber','Fetching\x20','Pausing\x20journey...','✔\x20All\x20files\x20are\x20up\x20to\x20date','journeys','get','diff','file','map','has','getStatistics','paused','yellow','\x20changed\x20files','data','listJourneysFromParentSegment','options','sort','description','table','\x27\x20not\x20found\x20in\x20','✔\x20Journey\x20\x22','984548PkZhdU','/e/','Resolved\x20YAML\x20file:\x20','Resolving\x20journey...','segments','\x20(ID:\x20','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20\x20Statistics\x20not\x20available','journey:push','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','1146420sXuYeI','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20versions)','\x20\x20Consolidating\x20duplicate\x20segment:\x20','Usage:\x20journey\x20stats\x20<name-or-path>','cyan','Pause\x20a\x20running\x20journey','population','activationParams','find','localeCompare','size','Input:\x20','Resume\x20a\x20paused\x20journey','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','📁\x20','Resuming\x20journey...','activation_','filePath','journeyBundleId','journeyBundleName','hasChanges','stage','\x20->\x20','absolutePath','getJourney','join','142793swzKuZ','🗺️\x20','getActivation','✔\x20Pulled\x20','execute','goalRate','6iqAgqo','entries','base','segmentName','Error:\x20Journey\x20not\x20found:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','launched','exited','✔\x20Found\x20','cwd','green','resolveJourneyId','entered','goal','session','✔\x20Context\x20set:\x20','utf-8','test','Warning:\x20Could\x20not\x20resolve\x20activation\x20','verbose','name','conversionRate','Cancelled','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','values','Show\x20journey\x20statistics','\x20\x20Parent\x20segment:\x20','Folder\x20path:\x20','red','Error:\x20','connector_config','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','...','.yml','root\x20folder','stringify','error','(paused)','stages','all','dryRun','journey:stats','(running)','\x20files?','content','completed','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','820jfojHF','8geZSof','\x20journeys','journey:pull','filter','Journey\x20name:\x20','reentryMode','\x20unchanged\x20files','Target\x20file:\x20','journeyId','\x20new\x20files','141368JFcpgE','isNew','getSegment','journeyStages','\x20journey','7716kyLQix','rule','buildIdToNameMap','INVALID_ARGUMENT','\x0aPull\x20summary:','state','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','replace','Usage:\x20journey\x20pause\x20<name-or-path>','yes','\x20\x20Target:\x20'];a18_0x5847=function(){return _0xdac4b4;};return a18_0x5847();}function a18_0xf45d(_0x449d94,_0x5d46d7){_0x449d94=_0x449d94-0x6e;const _0x5847c5=a18_0x5847();let _0xf45d24=_0x5847c5[_0x449d94];return _0xf45d24;}import a18_0x1263e2 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'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x1a15fc){const _0x27dd17=a18_0xf45d;switch(_0x1a15fc){case _0x27dd17(0xfa):return a18_0x277403['green'](_0x27dd17(0x11e));case'draft':return a18_0x277403['dim'](_0x27dd17(0x9b));case'paused':return a18_0x277403['yellow'](_0x27dd17(0x119));case _0x27dd17(0x121):return a18_0x277403[_0x27dd17(0xa0)](_0x27dd17(0x78));case'archived':return a18_0x277403[_0x27dd17(0x14c)](_0x27dd17(0x6e));default:return'('+_0x1a15fc+')';}}function formatJourneyItem(_0x237346,_0x5081b5='',_0x574e5a){const _0x4ad850=a18_0xf45d,_0x1c7faf=formatJourneyState(_0x237346[_0x4ad850(0x138)]),_0x1794bb=_0x574e5a?hyperlink(_0x237346[_0x4ad850(0xe7)],_0x574e5a):_0x237346[_0x4ad850(0xe7)];return _0x5081b5+_0x4ad850(0xef)+_0x1794bb+'\x20'+_0x1c7faf;}function escapeRegex(_0x3a7328){const _0x371602=a18_0xf45d;return _0x3a7328[_0x371602(0x13b)](/[.*+?^${}()|[\]\\]/g,_0x371602(0x95));}function globToRegex(_0x4a58c7){const _0x384756=a18_0xf45d,_0x355b76=_0x4a58c7['split']('*')[_0x384756(0xbb)](escapeRegex);return new RegExp(_0x355b76[_0x384756(0xed)]('.*'),'i');}function buildRuleToNameMapping(_0x2956d9){const _0x45818d=a18_0xf45d,_0x31ef9e=new Map();if(_0x2956d9[_0x45818d(0xcd)])for(const [_0x41f186,_0xf45ff0]of Object[_0x45818d(0xf5)](_0x2956d9['segments'])){if(_0xf45ff0['rule']){const _0x5b4459=serializeRule(_0xf45ff0['rule']),_0x6c9bc6=_0x31ef9e[_0x45818d(0xb8)](_0x5b4459);_0x6c9bc6?_0x6c9bc6['push'](_0x41f186):_0x31ef9e[_0x45818d(0x144)](_0x5b4459,[_0x41f186]);}}return _0x31ef9e;}async function resolveJourneyTarget(_0x4ca9af,_0x129c63,_0x2daa59){const _0x2f85af=a18_0xf45d;if(isYamlFilePath(_0x4ca9af))try{const _0x549877=await resolveYamlFilePath(_0x4ca9af);return _0x2daa59&&(console[_0x2f85af(0x118)](_0x2f85af(0xcb)+_0x4ca9af),console[_0x2f85af(0x118)](_0x2f85af(0x10e)+_0x549877[_0x2f85af(0x8a)]),console[_0x2f85af(0x118)]('\x20\x20Name:\x20'+_0x549877[_0x2f85af(0xf7)]),console[_0x2f85af(0x118)](_0x2f85af(0x97)+(_0x549877['folderPath']||_0x2f85af(0x14d)))),{'journeyName':_0x549877[_0x2f85af(0xf7)],'parentSegment':_0x549877[_0x2f85af(0x8a)],'resolved':_0x549877};}catch(_0x3ee862){throw new SDKError(ErrorCode[_0x2f85af(0x136)],_0x2f85af(0xd4)+_0x3ee862[_0x2f85af(0x94)]);}if(!_0x129c63)throw new SDKError(ErrorCode[_0x2f85af(0x136)],_0x2f85af(0xf9));return{'journeyName':_0x4ca9af,'parentSegment':_0x129c63};}export class JourneyListCommand extends BaseCommand{[a18_0xef4941(0x108)]=a18_0xef4941(0x7f);[a18_0xef4941(0xc5)]='List\x20journeys\x20in\x20current\x20context';async[a18_0xef4941(0xf2)](_0x5078e5){const _0x19d84f=a18_0xef4941,{options:_0x2e99d9,args:_0x405961,tdx:_0x9654c1}=_0x5078e5,_0x5854d6=_0x405961[0x0],_0x108670=_0x2e99d9[_0x19d84f(0x8a)];if(!_0x108670)return console[_0x19d84f(0x118)](_0x19d84f(0x80)),console[_0x19d84f(0x118)](_0x19d84f(0x113)),0x1;const _0x260c6a=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x9654c1[_0x19d84f(0x7b)][_0x19d84f(0x150)](_0x108670),{'verbose':_0x2e99d9[_0x19d84f(0x107)]}),_0x21f647=_0x260c6a[_0x19d84f(0xc1)];_0x2e99d9[_0x19d84f(0x107)]&&(console['error'](_0x19d84f(0x90)+_0x108670+_0x19d84f(0xce)+_0x21f647+')'),_0x5854d6&&console[_0x19d84f(0x118)](_0x19d84f(0xae)+_0x5854d6));const _0x2cd53d=await withSpinner(_0x19d84f(0xa9),()=>_0x9654c1[_0x19d84f(0x7b)][_0x19d84f(0x86)](_0x21f647),{'verbose':_0x2e99d9[_0x19d84f(0x107)]}),_0x1ae557=_0x2cd53d[_0x19d84f(0xc1)],_0x58bc20=_0x1ae557['rootFolderId'],_0x1e4c80=await withSpinner(_0x19d84f(0x73),()=>_0x9654c1[_0x19d84f(0x81)][_0x19d84f(0x8d)](_0x21f647,_0x58bc20),{'verbose':_0x2e99d9[_0x19d84f(0x107)]});let _0x115fb7=_0x1e4c80[_0x19d84f(0xc1)][_0x19d84f(0xb7)];const _0x527f24=_0x1e4c80['data'][_0x19d84f(0xad)],_0x50f1c2=new Map();for(const _0x22352f of _0x527f24){_0x50f1c2[_0x19d84f(0x144)](_0x22352f['id'],_0x22352f['name']);}if(_0x5854d6){const _0x4e6a45=globToRegex(_0x5854d6);_0x115fb7=_0x115fb7[_0x19d84f(0x127)](_0x33ce73=>_0x4e6a45[_0x19d84f(0x105)](_0x33ce73[_0x19d84f(0xe7)]));}console[_0x19d84f(0x118)](_0x19d84f(0xfc)+_0x115fb7['length']+_0x19d84f(0x132)+(_0x115fb7[_0x19d84f(0x9d)]!==0x1?'s':''));const _0x32c855=_0x40306f=>{const _0x409003=_0x19d84f;return getConsoleNextUrl(_0x2e99d9[_0x409003(0xa1)],_0x409003(0xaa)+_0x21f647+_0x409003(0xca)+_0x40306f+'/j/da');};if(_0x2e99d9[_0x19d84f(0x143)]===_0x19d84f(0xc6))await handleSDKOutput(_0x115fb7,_0x2e99d9);else{if(_0x2e99d9['format']==='json'){const _0x4731b0=_0x115fb7['map'](_0x26f33f=>({..._0x26f33f,'url':_0x32c855(_0x26f33f['id'])}));await handleSDKOutput(_0x4731b0,_0x2e99d9);}else{console[_0x19d84f(0x7d)]('['+_0x108670+']');const _0x1123e6=new Map(),_0x5b5f83=[];for(const _0xfd5d19 of _0x115fb7){if(!_0xfd5d19[_0x19d84f(0x13f)]||_0xfd5d19['folderId']===_0x58bc20)_0x5b5f83['push'](_0xfd5d19);else{const _0x38205a=_0x1123e6[_0x19d84f(0xb8)](_0xfd5d19[_0x19d84f(0x13f)])||[];_0x38205a[_0x19d84f(0xa8)](_0xfd5d19),_0x1123e6[_0x19d84f(0x144)](_0xfd5d19[_0x19d84f(0x13f)],_0x38205a);}}const _0x21f505=(_0x4d1ee2,_0x5c6a97)=>_0x4d1ee2['journeyBundleName'][_0x19d84f(0xdd)](_0x5c6a97[_0x19d84f(0xe7)],undefined,{'sensitivity':_0x19d84f(0xf6)});_0x5b5f83[_0x19d84f(0xc4)](_0x21f505);for(const _0x31ef58 of _0x5b5f83){console[_0x19d84f(0x7d)](formatJourneyItem(_0x31ef58,'',_0x32c855(_0x31ef58['id'])));}const _0x1e1bcf=[..._0x1123e6[_0x19d84f(0xf5)]()][_0x19d84f(0xc4)]((_0x27a992,_0x382a0f)=>{const _0xe919a0=_0x19d84f,_0x49824e=_0x50f1c2['get'](_0x27a992[0x0])||_0x27a992[0x0],_0x29b7d7=_0x50f1c2[_0xe919a0(0xb8)](_0x382a0f[0x0])||_0x382a0f[0x0];return _0x49824e['localeCompare'](_0x29b7d7,undefined,{'sensitivity':_0xe919a0(0xf6)});});for(const [_0x482255,_0x16909f]of _0x1e1bcf){const _0x45a5d8=_0x50f1c2['get'](_0x482255)||_0x482255;console['log'](_0x19d84f(0xe2)+_0x45a5d8),_0x16909f[_0x19d84f(0xc4)](_0x21f505);for(const _0x2c7652 of _0x16909f){console[_0x19d84f(0x7d)](formatJourneyItem(_0x2c7652,'\x20\x20',_0x32c855(_0x2c7652['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0xef4941(0x108)]='journey:view';['description']='Show\x20journey\x20details';async[a18_0xef4941(0xf2)](_0x5ec73f){const _0x592ae9=a18_0xef4941,{options:_0x53e02a,args:_0x60adf0,tdx:_0x434bec}=_0x5ec73f,_0x571f10=_0x60adf0[0x0];if(!_0x571f10)return console['error'](_0x592ae9(0x6f)),console[_0x592ae9(0x118)](_0x592ae9(0x142)),console[_0x592ae9(0x118)](_0x592ae9(0x9f)),console[_0x592ae9(0x118)](_0x592ae9(0x13a)),0x1;_0x53e02a[_0x592ae9(0x107)]&&console[_0x592ae9(0x118)]('Input:\x20'+_0x571f10);const _0x51c894=await resolveJourneyTarget(_0x571f10,_0x53e02a[_0x592ae9(0x8a)],_0x53e02a[_0x592ae9(0x107)]),_0x110a03=await withSpinner(_0x592ae9(0x7c),()=>_0x434bec['segment'][_0x592ae9(0x150)](_0x51c894['parentSegment']),{'verbose':_0x53e02a[_0x592ae9(0x107)]}),_0xb4b0e8=_0x110a03[_0x592ae9(0xc1)],_0x5325b5=await withSpinner('Resolving\x20journey...',()=>_0x434bec[_0x592ae9(0x81)]['resolveJourneyId'](_0xb4b0e8,_0x51c894[_0x592ae9(0x148)]),{'verbose':_0x53e02a[_0x592ae9(0x107)]}),_0x135fa3=_0x5325b5['data'];if(_0x53e02a[_0x592ae9(0x89)]){const _0x3cc135=getConsoleNextUrl(_0x53e02a['site'],_0x592ae9(0xaa)+_0xb4b0e8+_0x592ae9(0xca)+_0x135fa3+'/j/da/je');return console[_0x592ae9(0x118)](a18_0x277403[_0x592ae9(0xfe)]('✔')+_0x592ae9(0x82)+a18_0x277403['cyan'](_0x3cc135)),openBrowser(_0x3cc135),0x0;}const _0x85a79c=await withSpinner(_0x592ae9(0x77),()=>_0x434bec['journey']['getJourney'](_0x135fa3),{'verbose':_0x53e02a['verbose']}),_0x10ac0d=_0x85a79c[_0x592ae9(0xc1)],_0x4cf07a=_0x53e02a['includeStats'];let _0x4162a7;if(_0x4cf07a)try{const _0x4c6590=await withSpinner(_0x592ae9(0x71),()=>_0x434bec[_0x592ae9(0x81)][_0x592ae9(0xbd)](_0x135fa3),{'verbose':_0x53e02a[_0x592ae9(0x107)]});_0x4162a7=_0x4c6590[_0x592ae9(0xc1)];}catch{_0x53e02a[_0x592ae9(0x107)]&&console[_0x592ae9(0x118)](_0x592ae9(0xd0));}const _0x3c6b84=getConsoleNextUrl(_0x53e02a[_0x592ae9(0xa1)],'/app/ps/'+_0xb4b0e8+'/e/'+_0x135fa3+_0x592ae9(0x7a)),_0x23d1ca={'id':_0x10ac0d['id'],'name':_0x10ac0d[_0x592ae9(0x8b)]['name'],'description':_0x10ac0d[_0x592ae9(0x8b)]['description'],'state':_0x10ac0d[_0x592ae9(0x8b)][_0x592ae9(0x138)],'paused':_0x10ac0d['attributes'][_0x592ae9(0xbe)],'reentry_mode':_0x10ac0d[_0x592ae9(0x8b)][_0x592ae9(0x129)],'stages':_0x10ac0d[_0x592ae9(0x8b)][_0x592ae9(0x131)]?.[_0x592ae9(0x9d)]||0x0,..._0x10ac0d[_0x592ae9(0x8b)][_0x592ae9(0x101)]&&{'goal':_0x10ac0d[_0x592ae9(0x8b)]['goal'][_0x592ae9(0x108)]},..._0x4162a7&&{'statistics':{'total_entered':_0x4162a7['totalEntered'],'goal_achieved':_0x4162a7['totalGoalAchieved'],'goal_rate':_0x4162a7[_0x592ae9(0xf3)],'stages':_0x4162a7[_0x592ae9(0x11a)]}},'url':_0x3c6b84};return await handleSingleObjectOutput(_0x23d1ca,_0x53e02a),0x0;}}export class JourneyStatsCommand extends BaseCommand{['name']=a18_0xef4941(0x11d);[a18_0xef4941(0xc5)]=a18_0xef4941(0x10d);async[a18_0xef4941(0xf2)](_0x5ac203){const _0x51e9ad=a18_0xef4941,{options:_0x14be1e,args:_0x1e2a23,tdx:_0x55a1a1}=_0x5ac203,_0x523ac6=_0x1e2a23[0x0];if(!_0x523ac6)return console[_0x51e9ad(0x118)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x51e9ad(0xd7)),0x1;_0x14be1e[_0x51e9ad(0x107)]&&console[_0x51e9ad(0x118)](_0x51e9ad(0xdf)+_0x523ac6);const _0x28d8ff=await resolveJourneyTarget(_0x523ac6,_0x14be1e['parentSegment'],_0x14be1e[_0x51e9ad(0x107)]),_0x41385b=await withSpinner(_0x51e9ad(0x7c),()=>_0x55a1a1[_0x51e9ad(0x7b)]['resolveParentId'](_0x28d8ff[_0x51e9ad(0x8a)]),{'verbose':_0x14be1e[_0x51e9ad(0x107)]}),_0x32a39f=_0x41385b[_0x51e9ad(0xc1)],_0x1b1f5a=await withSpinner('Resolving\x20journey...',()=>_0x55a1a1[_0x51e9ad(0x81)]['resolveJourneyId'](_0x32a39f,_0x28d8ff[_0x51e9ad(0x148)]),{'verbose':_0x14be1e[_0x51e9ad(0x107)]}),_0x54102e=_0x1b1f5a[_0x51e9ad(0xc1)],_0x46e65f=await withSpinner(_0x51e9ad(0x71),()=>_0x55a1a1[_0x51e9ad(0x81)][_0x51e9ad(0xbd)](_0x54102e),{'verbose':_0x14be1e[_0x51e9ad(0x107)]}),_0x37219c=_0x46e65f[_0x51e9ad(0xc1)];if(!_0x37219c||_0x37219c[_0x51e9ad(0x12c)]===null)return console[_0x51e9ad(0x118)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x28d8ff['journeyName']),console[_0x51e9ad(0x118)](_0x51e9ad(0x10b)),0x0;const _0x58fc34={'journey_id':_0x37219c[_0x51e9ad(0x12c)],'total_entered':_0x37219c['totalEntered'],'goal_achieved':_0x37219c['totalGoalAchieved'],'goal_rate':_0x37219c[_0x51e9ad(0xf3)],'stages':_0x37219c['stages']?.['map'](_0x3cd53e=>({'name':_0x3cd53e['stageName'],'population':_0x3cd53e[_0x51e9ad(0xda)],'entered':_0x3cd53e[_0x51e9ad(0x100)],'exited':_0x3cd53e[_0x51e9ad(0xfb)],'conversion_rate':_0x3cd53e[_0x51e9ad(0x109)]}))},_0x4fad14=_0x14be1e[_0x51e9ad(0xe9)];if(_0x4fad14&&_0x37219c[_0x51e9ad(0x11a)]){const _0x4a0337=_0x37219c[_0x51e9ad(0x11a)][_0x51e9ad(0xdc)](_0x1e7607=>_0x1e7607[_0x51e9ad(0xaf)]['toLowerCase']()===_0x4fad14['toLowerCase']());if(_0x4a0337)return await handleSingleObjectOutput({'stage_name':_0x4a0337[_0x51e9ad(0xaf)],'population':_0x4a0337[_0x51e9ad(0xda)],'entered':_0x4a0337[_0x51e9ad(0x100)],'exited':_0x4a0337[_0x51e9ad(0xfb)],'conversion_rate':_0x4a0337[_0x51e9ad(0x109)]},_0x14be1e),0x0;console[_0x51e9ad(0x118)]('Warning:\x20Stage\x20\x22'+_0x4fad14+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x58fc34,_0x14be1e),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0xef4941(0x108)]=a18_0xef4941(0x14b);[a18_0xef4941(0xc5)]=a18_0xef4941(0xd9);async[a18_0xef4941(0xf2)](_0x404330){const _0x23aa26=a18_0xef4941,{options:_0x4bcee2,args:_0x555538,tdx:_0x205bf7}=_0x404330,_0x498ccf=_0x555538[0x0];if(!_0x498ccf)return console[_0x23aa26(0x118)](_0x23aa26(0x6f)),console[_0x23aa26(0x118)](_0x23aa26(0x13c)),0x1;_0x4bcee2[_0x23aa26(0x107)]&&console[_0x23aa26(0x118)]('Input:\x20'+_0x498ccf);const _0x42d2e9=await resolveJourneyTarget(_0x498ccf,_0x4bcee2[_0x23aa26(0x8a)],_0x4bcee2[_0x23aa26(0x107)]),_0x43ccda=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x205bf7[_0x23aa26(0x7b)][_0x23aa26(0x150)](_0x42d2e9[_0x23aa26(0x8a)]),{'verbose':_0x4bcee2[_0x23aa26(0x107)]}),_0x45684b=_0x43ccda[_0x23aa26(0xc1)],_0x535c43=await withSpinner(_0x23aa26(0xcc),()=>_0x205bf7[_0x23aa26(0x81)][_0x23aa26(0xff)](_0x45684b,_0x42d2e9[_0x23aa26(0x148)]),{'verbose':_0x4bcee2[_0x23aa26(0x107)]}),_0xe937bf=_0x535c43[_0x23aa26(0xc1)];if(!_0x4bcee2[_0x23aa26(0x13d)]){const _0x5c51d3=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x42d2e9['journeyName']+'\x22?');if(!_0x5c51d3)return console[_0x23aa26(0x118)](_0x23aa26(0x10a)),0x0;}const _0x320424=await withSpinner(_0x23aa26(0xb5),()=>_0x205bf7[_0x23aa26(0x81)][_0x23aa26(0x87)](_0xe937bf),{'verbose':_0x4bcee2[_0x23aa26(0x107)]}),_0x1ad49c=_0x320424[_0x23aa26(0xc1)];return console[_0x23aa26(0x118)](_0x23aa26(0xc8)+_0x1ad49c[_0x23aa26(0x8b)]['name']+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']='journey:resume';['description']=a18_0xef4941(0xe0);async['execute'](_0x20a2fc){const _0x4bd228=a18_0xef4941,{options:_0xbf08fa,args:_0x4fad7f,tdx:_0x31d12b}=_0x20a2fc,_0x14a5f0=_0x4fad7f[0x0];if(!_0x14a5f0)return console[_0x4bd228(0x118)](_0x4bd228(0x6f)),console[_0x4bd228(0x118)](_0x4bd228(0x8c)),0x1;_0xbf08fa[_0x4bd228(0x107)]&&console[_0x4bd228(0x118)](_0x4bd228(0xdf)+_0x14a5f0);const _0x4ba86b=await resolveJourneyTarget(_0x14a5f0,_0xbf08fa[_0x4bd228(0x8a)],_0xbf08fa['verbose']),_0x537c49=await withSpinner(_0x4bd228(0x7c),()=>_0x31d12b[_0x4bd228(0x7b)]['resolveParentId'](_0x4ba86b[_0x4bd228(0x8a)]),{'verbose':_0xbf08fa[_0x4bd228(0x107)]}),_0xaf5e47=_0x537c49[_0x4bd228(0xc1)],_0x429a1e=await withSpinner(_0x4bd228(0xcc),()=>_0x31d12b['journey']['resolveJourneyId'](_0xaf5e47,_0x4ba86b[_0x4bd228(0x148)]),{'verbose':_0xbf08fa[_0x4bd228(0x107)]}),_0x4a993c=_0x429a1e[_0x4bd228(0xc1)];if(!_0xbf08fa[_0x4bd228(0x13d)]){const _0x2dac41=await confirm(_0x4bd228(0x122)+_0x4ba86b[_0x4bd228(0x148)]+'\x22?');if(!_0x2dac41)return console[_0x4bd228(0x118)]('Cancelled'),0x0;}const _0x4270fd=await withSpinner(_0x4bd228(0xe3),()=>_0x31d12b[_0x4bd228(0x81)][_0x4bd228(0x84)](_0x4a993c),{'verbose':_0xbf08fa[_0x4bd228(0x107)]}),_0x4345e7=_0x4270fd['data'];return console[_0x4bd228(0x118)](_0x4bd228(0xc8)+_0x4345e7['attributes'][_0x4bd228(0x108)]+_0x4bd228(0x9e)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0xef4941(0x108)]=a18_0xef4941(0x126);[a18_0xef4941(0xc5)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a18_0xef4941(0xf2)](_0xe409eb){const _0x380de6=a18_0xef4941,{options:_0xa2e860,args:_0x50e4a4,tdx:_0x505342}=_0xe409eb,_0x4f6d4e=_0xa2e860,_0x4ed7eb=_0x50e4a4[0x0],_0x1d6178=_0x4ed7eb&&isYamlFilePath(_0x4ed7eb),_0x5ea5a6=await resolveTarget({'arg':_0x1d6178?_0x4ed7eb:undefined,'contextParent':_0xa2e860[_0x380de6(0x8a)],'cwd':process[_0x380de6(0xfd)]()});if(!isSuccessfulResolution(_0x5ea5a6))return _0x5ea5a6['errorCode']==='no_parent'?(console['error'](a18_0x277403[_0x380de6(0xbf)](_0x380de6(0xa6))),console[_0x380de6(0x118)](_0x380de6(0x83)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x380de6(0x118)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x380de6(0x118)](_0x380de6(0x93))):(console[_0x380de6(0x118)](a18_0x277403[_0x380de6(0x110)](_0x380de6(0x111)+_0x5ea5a6[_0x380de6(0x94)]+'\x0a')),_0x5ea5a6['helpText']&&console['error'](a18_0x277403[_0x380de6(0xd8)](_0x5ea5a6['helpText']))),0x1;let _0x3c0e6a=_0x1d6178?undefined:_0x4ed7eb,_0xab12e6,_0x5ae46e;_0x5ea5a6['type']===_0x380de6(0xba)&&(_0x3c0e6a=_0x5ea5a6[_0x380de6(0x14f)],_0xab12e6=_0x5ea5a6['filePath'],_0x5ae46e=_0x5ea5a6[_0x380de6(0x141)]);const _0x5d1283=_0x5ea5a6['parentName'],_0xd3dacc=_0x5ea5a6[_0x380de6(0x140)];_0x4f6d4e['verbose']&&(console[_0x380de6(0x118)](_0x380de6(0x90)+_0x5d1283),console['error']('Target\x20directory:\x20'+_0xd3dacc),_0x3c0e6a&&console[_0x380de6(0x118)](_0x380de6(0x128)+_0x3c0e6a),_0xab12e6&&console[_0x380de6(0x118)](_0x380de6(0x12b)+_0xab12e6),_0x5ae46e&&console[_0x380de6(0x118)](_0x380de6(0x10f)+_0x5ae46e));const _0x46a975=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x505342['segment'][_0x380de6(0x150)](_0x5d1283),{'verbose':_0xa2e860[_0x380de6(0x107)]}),_0x39bd4e=_0x46a975[_0x380de6(0xc1)],[_0xb07879,_0x109ece]=await Promise[_0x380de6(0x11b)]([withSpinner(_0x380de6(0x73),()=>_0x505342['journey'][_0x380de6(0xc2)](_0x39bd4e,undefined,{'includeAllVersions':!![]}),{'verbose':_0xa2e860[_0x380de6(0x107)]}),withSpinner(_0x380de6(0x145),()=>_0x505342[_0x380de6(0x7b)][_0x380de6(0xb1)](_0x39bd4e),{'verbose':_0xa2e860[_0x380de6(0x107)]})]);let _0x2c2765=_0xb07879['data'];const _0x2abf5d=_0x109ece[_0x380de6(0xc1)],_0x487568=buildFolderIdToPathMap(_0x2abf5d);if(_0x3c0e6a){const _0x4ea754=_0x2c2765[_0x380de6(0x127)](_0x2aa5f1=>_0x2aa5f1['journeyBundleName']['toLowerCase']()===_0x3c0e6a[_0x380de6(0x14e)]());if(_0x4ea754[_0x380de6(0x9d)]===0x0)return console[_0x380de6(0x118)](_0x380de6(0xf8)+_0x3c0e6a),console[_0x380de6(0x118)](_0x380de6(0xcf)),0x1;_0x2c2765=_0x4ea754;}if(_0x5ae46e!==undefined){const _0x1b5f41=_0x2c2765['filter'](_0x4a63c7=>{const _0x56e4b3=_0x380de6,_0x54b176=_0x4a63c7[_0x56e4b3(0x13f)]?_0x487568[_0x56e4b3(0xb8)](_0x4a63c7[_0x56e4b3(0x13f)])||'':'';return _0x54b176===_0x5ae46e;});if(_0x1b5f41[_0x380de6(0x9d)]===0x0&&_0x2c2765[_0x380de6(0x9d)]>0x0){console[_0x380de6(0x118)](_0x380de6(0xa2)+_0x3c0e6a+_0x380de6(0xc7)+(_0x5ae46e||_0x380de6(0x116))),console[_0x380de6(0x118)](_0x380de6(0x85));for(const _0x372fbd of _0x2c2765){const _0x6f280a=_0x372fbd[_0x380de6(0x13f)]?_0x487568[_0x380de6(0xb8)](_0x372fbd[_0x380de6(0x13f)])||'':'';console['error'](_0x380de6(0xb0)+(_0x6f280a||_0x380de6(0x14d))+'/'+_0x372fbd[_0x380de6(0xe7)]);}return 0x1;}_0x2c2765=_0x1b5f41;}if(_0x2c2765[_0x380de6(0x9d)]===0x0)return console[_0x380de6(0x118)](_0x380de6(0x88)),0x0;const _0x11e341=new Map();for(const _0x37b1bd of _0x2c2765){const _0x5a3ba4=_0x37b1bd[_0x380de6(0xe6)];!_0x11e341[_0x380de6(0xbc)](_0x5a3ba4)&&_0x11e341[_0x380de6(0x144)](_0x5a3ba4,[]),_0x11e341[_0x380de6(0xb8)](_0x5a3ba4)[_0x380de6(0xa8)](_0x37b1bd);}for(const _0x598c72 of _0x11e341[_0x380de6(0x10c)]()){_0x598c72[_0x380de6(0xc4)]((_0x21780f,_0x42a7d5)=>(_0x21780f[_0x380de6(0xb3)]||0x0)-(_0x42a7d5[_0x380de6(0xb3)]||0x0));}const _0x351161=[],[_0x28c1ed,_0x413ec2]=await Promise[_0x380de6(0x11b)]([withSpinner(_0x380de6(0x72),()=>_0x505342[_0x380de6(0x91)][_0x380de6(0x92)](),{'verbose':_0xa2e860['verbose']})['then'](_0x19703e=>_0x19703e['data']),withSpinner(_0x380de6(0x146),()=>_0x505342[_0x380de6(0x8f)][_0x380de6(0x135)](),{'verbose':_0xa2e860[_0x380de6(0x107)]})[_0x380de6(0x7e)](_0x355459=>_0x355459[_0x380de6(0xc1)])]);for(const _0x4ab5f0 of _0x11e341[_0x380de6(0x10c)]()){const _0xa4cfa=_0x4ab5f0[0x0][_0x380de6(0xe7)],_0x47f6ca=_0x4ab5f0[0x0][_0x380de6(0x13f)],_0x7054e9=_0x47f6ca?_0x487568['get'](_0x47f6ca)||'':'',_0x4d13b7=_0x7054e9?a18_0x1263e2[_0x380de6(0xed)](_0xd3dacc,_0x7054e9):_0xd3dacc,_0x2d1b37=_0xab12e6||a18_0x1263e2[_0x380de6(0xed)](_0x4d13b7,sanitizeFileName(_0xa4cfa)+_0x380de6(0x115));let _0x39880f,_0x5c20cc;if(existsSync(_0x2d1b37))try{const _0x3d5364=readFileSync(_0x2d1b37,_0x380de6(0x104)),_0x7153a=parseYamlString(_0x3d5364);_0x5c20cc=_0x7153a,_0x39880f=buildRuleToNameMapping(_0x7153a),_0x4f6d4e['verbose']&&_0x39880f['size']>0x0&&console['error'](_0x380de6(0xa7)+_0x39880f[_0x380de6(0xde)]+_0x380de6(0xac)+_0xa4cfa);}catch(_0x1e7fb6){_0x4f6d4e['verbose']&&console[_0x380de6(0x118)](_0x380de6(0xd2)+_0x1e7fb6[_0x380de6(0x94)]);}const _0x47f908=[],_0x3e61c0=new Set(),_0x54a043=new Map(),_0x3d02f8=new Map(),_0x5157de=new Set(),_0x14898a=new Map(),_0x11955f=new Map(),_0x2c95cc=createJumpTargetCache();await withProgressSpinner(_0x380de6(0xb4)+_0xa4cfa+_0x380de6(0x114),async _0x552578=>{const _0x25d7e6=_0x380de6;for(const _0x4703c2 of _0x4ab5f0){const _0x169d99=_0x4ab5f0['length']>0x1?_0x4703c2[_0x25d7e6(0xe7)]+'\x20v'+(_0x4703c2[_0x25d7e6(0xb3)]||0x1):_0x4703c2[_0x25d7e6(0xe7)];_0x552578['setPhase']('Fetching\x20'+_0x169d99);const _0x3f14f1=await _0x505342[_0x25d7e6(0x81)][_0x25d7e6(0xec)](_0x4703c2['id']),_0x4138bf=_0x3f14f1['attributes']?.[_0x25d7e6(0x96)],_0x494f6a={'resolveSegment':async _0x597407=>{const _0x270582=_0x25d7e6;if(!_0x4138bf)return{'name':_0x597407,'isJourneyLocal':![]};const _0x25d5ac=_0x54a043['get'](_0x597407);if(_0x25d5ac)return _0x25d5ac;try{const _0x1adc1d=await _0x505342[_0x270582(0x7b)][_0x270582(0x130)](_0x4138bf,_0x597407),_0x346ca9=_0x1adc1d[_0x270582(0x9a)]===SEGMENT_KIND_JOURNEY;let _0x1bbfc6,_0x3d680f=_0x1adc1d[_0x270582(0x108)];if(_0x346ca9&&_0x1adc1d[_0x270582(0x134)]){const _0x416523=await segmentResponseToDef(_0x1adc1d,{'resolveSegmentName':async _0x43e734=>{const _0x161bd4=_0x270582,_0x1d2e91=_0x54a043[_0x161bd4(0xb8)](_0x43e734);if(_0x1d2e91)return _0x1d2e91[_0x161bd4(0x108)];const _0xda8fe8=await _0x494f6a[_0x161bd4(0x74)](_0x43e734);return _0xda8fe8[_0x161bd4(0x108)];}}),_0xd73bc=_0x416523[_0x270582(0x134)];_0x1bbfc6={'description':_0x1adc1d[_0x270582(0xc5)],'rule':_0xd73bc};const _0x257bd8=serializeRule(_0xd73bc),_0x10081f=_0x3d02f8[_0x270582(0xb8)](_0x257bd8);if(_0x10081f)_0x3d680f=_0x10081f,_0x1bbfc6=undefined,_0x4f6d4e['verbose']&&console[_0x270582(0x118)](_0x270582(0xd6)+_0x1adc1d['name']+_0x270582(0xea)+_0x10081f);else{let _0x212ad4=![];if(_0x39880f){const _0x14964d=_0x39880f['get'](_0x257bd8);if(_0x14964d){const _0x3a4a70=_0x14964d[_0x270582(0xdc)](_0x4c9447=>!_0x3e61c0[_0x270582(0xbc)](_0x4c9447));_0x3a4a70&&(_0x3d680f=_0x3a4a70,_0x3e61c0[_0x270582(0x79)](_0x3a4a70),_0x3d02f8[_0x270582(0x144)](_0x257bd8,_0x3a4a70),_0x212ad4=!![],_0x4f6d4e[_0x270582(0x107)]&&console[_0x270582(0x118)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x3a4a70+'\x20(rule\x20match)'));}}if(!_0x212ad4){const _0x5774ce=generateJourneyLocalName(_0x1adc1d[_0x270582(0x108)]);_0x5774ce&&(_0x3d680f=_0x5774ce);let _0x33b1c2=_0x3d680f,_0x56203b=0x2;while(_0x3e61c0['has'](_0x33b1c2)){_0x33b1c2=_0x3d680f+'_'+_0x56203b,_0x56203b++;}_0x3e61c0['add'](_0x33b1c2),_0x3d02f8[_0x270582(0x144)](_0x257bd8,_0x33b1c2),_0x3d680f=_0x33b1c2;}}}const _0x56082c={'name':_0x3d680f,'isJourneyLocal':_0x346ca9,'definition':_0x1bbfc6};return _0x54a043[_0x270582(0x144)](_0x597407,_0x56082c),_0x56082c;}catch(_0x1cfe82){return _0xa2e860['verbose']&&console[_0x270582(0x118)](_0x270582(0xa3)+_0x597407+':\x20'+_0x1cfe82[_0x270582(0x94)]),{'name':_0x597407,'isJourneyLocal':![]};}},'resolveActivation':async _0x28e014=>{const _0x51659e=_0x25d7e6,_0x412f90=_0x14898a[_0x51659e(0xb8)](_0x28e014);if(_0x412f90)return _0x412f90;try{const _0x58a3f1=await _0x505342['journey'][_0x51659e(0xf0)](_0x4703c2['id'],_0x28e014),_0x250052=journeyActivationStepToYaml(_0x58a3f1,_0x28c1ed,_0x413ec2),_0xcf16ce=JSON[_0x51659e(0x117)]({'name':_0x250052[_0x51659e(0x108)],'connection':_0x250052['connection'],'connector_config':_0x250052[_0x51659e(0x112)]}),_0x4e388c=_0x11955f['get'](_0xcf16ce);if(_0x4e388c){const _0x4ace8e={'name':_0x4e388c,'isJourneyLocal':!![],'definition':_0x250052};return _0x14898a['set'](_0x28e014,_0x4ace8e),_0x4ace8e;}const _0x5d35d1=_0x58a3f1[_0x51659e(0x8b)][_0x51659e(0xdb)]['name']||_0x28e014,_0x40abd4=sanitizeYamlKey(_0x5d35d1)||_0x51659e(0xe4)+_0x28e014;let _0x844b31=_0x40abd4,_0x23beb1=0x2;while(_0x5157de[_0x51659e(0xbc)](_0x844b31)){_0x844b31=_0x40abd4+'_'+_0x23beb1,_0x23beb1++;}_0x5157de['add'](_0x844b31),_0x11955f[_0x51659e(0x144)](_0xcf16ce,_0x844b31);const _0x593145={'name':_0x844b31,'isJourneyLocal':!![],'definition':_0x250052};return _0x14898a[_0x51659e(0x144)](_0x28e014,_0x593145),_0x593145;}catch(_0x2a5b94){return _0xa2e860[_0x51659e(0x107)]&&console[_0x51659e(0x118)](_0x51659e(0x106)+_0x28e014+':\x20'+_0x2a5b94['message']),{'name':_0x28e014,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x5b71fa,_0x4b0714)=>{const _0x2b2211=_0x25d7e6;return resolveJumpTarget(_0x5b71fa,_0x4b0714,_0x2c95cc,_0x443384=>_0x505342[_0x2b2211(0x81)][_0x2b2211(0xec)](_0x443384));}},_0x5b1786=await journeyResponseToDef(_0x3f14f1,_0x494f6a);_0x47f908['push']({'item':_0x4703c2,'yaml':_0x5b1786});}},{'verbose':_0xa2e860[_0x380de6(0x107)]});const _0x278403=buildMergedJourneyDef(_0x47f908,_0x39880f),_0x59f0a1=normalizeJourneyDef(_0x278403,_0x5c20cc),_0x52eec9=toYamlString(_0x59f0a1),_0x32e607=_0xab12e6||a18_0x1263e2['join'](_0x4d13b7,sanitizeFileName(_0xa4cfa)+_0x380de6(0x115));!_0xab12e6&&_0x7054e9&&!existsSync(_0x4d13b7)&&mkdirSync(_0x4d13b7,{'recursive':!![]});const _0x16a206=a18_0x1263e2['relative'](process['cwd'](),_0x32e607);if(existsSync(_0x32e607)){const _0x4c96df=readFileSync(_0x32e607,_0x380de6(0x104)),_0x476704=generateDiff(_0x4c96df,_0x52eec9),_0x39e212=hasChanges(_0x476704);_0x351161[_0x380de6(0xa8)]({'relativePath':_0x16a206,'absolutePath':_0x32e607,'content':_0x52eec9,'isNew':![],'hasChanges':_0x39e212,'diff':_0x39e212?formatDiffWithColors(_0x476704):undefined});}else _0x351161['push']({'relativePath':_0x16a206,'absolutePath':_0x32e607,'content':_0x52eec9,'isNew':!![],'hasChanges':![]});}const _0x4f6dff=_0x351161[_0x380de6(0x127)](_0x4f40c4=>_0x4f40c4[_0x380de6(0x12f)]),_0x3a1450=_0x351161[_0x380de6(0x127)](_0x25cc3d=>!_0x25cc3d[_0x380de6(0x12f)]&&_0x25cc3d[_0x380de6(0xe8)]),_0x3d0305=_0x351161[_0x380de6(0x127)](_0x1ad317=>!_0x1ad317[_0x380de6(0x12f)]&&!_0x1ad317[_0x380de6(0xe8)]),_0x47a5e7=_0x2c2765[_0x380de6(0x9d)],_0x1a5059=_0x11e341[_0x380de6(0xde)],_0x836c39=_0x47a5e7>_0x1a5059?'\x20('+_0x47a5e7+_0x380de6(0xd5):'';console[_0x380de6(0x118)](_0x380de6(0x137)),console[_0x380de6(0x118)]('\x20\x20'+a18_0x277403[_0x380de6(0xd8)](_0x1a5059+_0x380de6(0x125))+a18_0x277403['dim'](_0x836c39)),console[_0x380de6(0x118)]('\x20\x20'+a18_0x277403[_0x380de6(0xfe)]('+\x20'+_0x4f6dff[_0x380de6(0x9d)]+_0x380de6(0x12d))),console[_0x380de6(0x118)]('\x20\x20'+a18_0x277403['yellow']('~\x20'+_0x3a1450['length']+_0x380de6(0xc0))),console['error']('\x20\x20'+a18_0x277403[_0x380de6(0x14c)]('=\x20'+_0x3d0305[_0x380de6(0x9d)]+_0x380de6(0x12a))),console[_0x380de6(0x118)](_0x380de6(0x13e)+a18_0x277403['cyan'](_0xd3dacc)+'\x0a');if(_0x3a1450[_0x380de6(0x9d)]>0x0)for(const _0x102d4b of _0x3a1450){console[_0x380de6(0x118)](_0x380de6(0xab)+_0x102d4b[_0x380de6(0xa4)]+'\x27:'),console[_0x380de6(0x118)]('─'[_0x380de6(0xa5)](0x3c)),console['error'](_0x102d4b[_0x380de6(0xb9)]),console['error']('─'[_0x380de6(0xa5)](0x3c));}if(_0x4f6d4e[_0x380de6(0x11c)])return console['error'](a18_0x277403['yellow'](_0x380de6(0xe1))),0x0;if(_0x4f6dff[_0x380de6(0x9d)]===0x0&&_0x3a1450[_0x380de6(0x9d)]===0x0)return console[_0x380de6(0x118)](a18_0x277403[_0x380de6(0xfe)](_0x380de6(0xb6))),saveSessionContext({'parent_segment':_0x5d1283},_0x4f6d4e[_0x380de6(0x102)]),console['error'](a18_0x277403['green']('✔\x20Context\x20set:\x20'+a18_0x277403[_0x380de6(0x14c)]('parent_segment')+_0x380de6(0x8e)+a18_0x277403['cyan'](_0x5d1283))),0x0;if(!_0x4f6d4e['yes']&&(_0x4f6dff['length']>0x0||_0x3a1450[_0x380de6(0x9d)]>0x0)){if(!isInteractive())return console['error'](a18_0x277403['red'](_0x380de6(0x98)),_0x380de6(0x139)),console[_0x380de6(0x118)](a18_0x277403[_0x380de6(0x14c)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xecb18b=await confirmKey(_0x380de6(0x99)+(_0x4f6dff[_0x380de6(0x9d)]+_0x3a1450['length'])+_0x380de6(0x11f));if(!_0xecb18b)return console['error'](a18_0x277403[_0x380de6(0xbf)](_0x380de6(0xb2)),'-\x20no\x20files\x20written'),0x1;}!existsSync(_0xd3dacc)&&mkdirSync(_0xd3dacc,{'recursive':!![]});for(const _0x2f5db7 of _0x351161){(_0x2f5db7[_0x380de6(0x12f)]||_0x2f5db7[_0x380de6(0xe8)])&&writeFileSync(_0x2f5db7[_0x380de6(0xeb)],_0x2f5db7[_0x380de6(0x120)],_0x380de6(0x104));}return console['error'](a18_0x277403['green'](_0x380de6(0xf1)+(_0x4f6dff[_0x380de6(0x9d)]+_0x3a1450[_0x380de6(0x9d)])+_0x380de6(0x14a)+_0xd3dacc)),saveSessionContext({'parent_segment':_0x5d1283},_0x4f6d4e[_0x380de6(0x102)]),console[_0x380de6(0x118)](a18_0x277403[_0x380de6(0xfe)](_0x380de6(0x103)+a18_0x277403[_0x380de6(0x14c)]('parent_segment')+'\x20=\x20'+a18_0x277403[_0x380de6(0xd8)](_0x5d1283))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0xef4941(0x108)]=a18_0xef4941(0xd1);[a18_0xef4941(0xc5)]=a18_0xef4941(0x70);['segmentPushCommand']=new SegmentPushCommand();async[a18_0xef4941(0xf2)](_0x32d92e){const _0x2bc467=a18_0xef4941,_0x4f028e=_0x32d92e[_0x2bc467(0x76)][0x0];let _0x4257f4;if(_0x4f028e){const _0x3844f9=await resolveTarget({'arg':_0x4f028e,'contextParent':_0x32d92e[_0x2bc467(0xc3)]['parentSegment'],'cwd':process[_0x2bc467(0xfd)]()});isSuccessfulResolution(_0x3844f9)&&_0x3844f9[_0x2bc467(0x147)]==='file'&&(_0x4257f4=_0x3844f9[_0x2bc467(0xe5)]);}const _0x306a56={..._0x32d92e,'options':{..._0x32d92e[_0x2bc467(0xc3)],'journeysOnly':!![],..._0x4257f4&&{'singleFilePath':_0x4257f4}}};return this[_0x2bc467(0x9c)][_0x2bc467(0xf2)](_0x306a56);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a19_0x5a2b6c=a19_0xc535;(function(_0xf7d859,_0xc8e710){const _0x247f55=a19_0xc535,_0x28ef7a=_0xf7d859();while(!![]){try{const _0x15354a=-parseInt(_0x247f55(0xe9))/0x1*(parseInt(_0x247f55(0xe7))/0x2)+parseInt(_0x247f55(0xe3))/0x3+parseInt(_0x247f55(0xfd))/0x4+parseInt(_0x247f55(0xf5))/0x5*(-parseInt(_0x247f55(0xed))/0x6)+parseInt(_0x247f55(0xf0))/0x7*(parseInt(_0x247f55(0xce))/0x8)+parseInt(_0x247f55(0x102))/0x9*(-parseInt(_0x247f55(0xdf))/0xa)+parseInt(_0x247f55(0xe8))/0xb*(parseInt(_0x247f55(0x101))/0xc);if(_0x15354a===_0xc8e710)break;else _0x28ef7a['push'](_0x28ef7a['shift']());}catch(_0x4df233){_0x28ef7a['push'](_0x28ef7a['shift']());}}}(a19_0x1bf0,0x9ceaf));function a19_0x1bf0(){const _0xd69c24=['verbose','cyan','reason','endsWith','targetDir','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','.yaml','skippedCount','860thtCLL','\x20warning(s)\x20found','\x20journey(s)\x20valid','dim','1652121MSIHLw','yellow','valid','errors','28436DhtgTj','4686Xkhibd','1mefcFe','\x20(skipped:\x20','log','\x20journey(s)\x20with\x20errors,\x20','90AkTLtn','helpText','validCount','3255eewqQo','\x20segment\x20file(s)\x20skipped','green','\x20warning(s)','length','366920tgDaVB','no_parent','file','warnings','journey','Validation\x20failed:\x20','Error:\x20','relativePath','2482268GQnRrR','.yml','filter','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','18732YjstfY','104913uozIbJ','parentSegment','execute','message','invalidCount','hasErrors','red','filePath','15896JKJobf','warningCount','✔\x20All\x20','type','description','error','journey:validate','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','No\x20journey\x20YAML\x20files\x20found\x20in\x20'];a19_0x1bf0=function(){return _0xd69c24;};return a19_0x1bf0();}function a19_0xc535(_0xb51b7a,_0x1b5a1c){_0xb51b7a=_0xb51b7a-0xcc;const _0x1bf07d=a19_0x1bf0();let _0xc53527=_0x1bf07d[_0xb51b7a];return _0xc53527;}import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0xe9f748 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{['name']=a19_0x5a2b6c(0xd4);[a19_0x5a2b6c(0xd2)]='Validate\x20journey\x20YAML\x20files';async[a19_0x5a2b6c(0x104)](_0x1c708b){const _0x3f1d1f=a19_0x5a2b6c,{options:_0x880b82,args:_0x4a2c75}=_0x1c708b,_0xdc58f=_0x880b82,_0x1482cc=await resolveTarget({'arg':_0x4a2c75[0x0],'contextParent':_0x880b82[_0x3f1d1f(0x103)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x1482cc))return _0x1482cc['errorCode']===_0x3f1d1f(0xf6)?(console[_0x3f1d1f(0xd3)](a19_0xe9f748[_0x3f1d1f(0xe4)](_0x3f1d1f(0xdc))),console[_0x3f1d1f(0xd3)](_0x3f1d1f(0xd5)),console[_0x3f1d1f(0xd3)](_0x3f1d1f(0x100)),console[_0x3f1d1f(0xd3)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0x3f1d1f(0xd3)](a19_0xe9f748[_0x3f1d1f(0xcc)](_0x3f1d1f(0xfb)+_0x1482cc[_0x3f1d1f(0x105)]+'\x0a')),_0x1482cc['helpText']&&console['error'](a19_0xe9f748[_0x3f1d1f(0xd8)](_0x1482cc[_0x3f1d1f(0xee)]))),0x1;const _0x58cd81=_0x1482cc[_0x3f1d1f(0xdb)],_0x408525=_0x1482cc[_0x3f1d1f(0xd1)]===_0x3f1d1f(0xf7)?_0x1482cc[_0x3f1d1f(0xcd)]:undefined;if(!_0x408525&&!existsSync(_0x58cd81))return console[_0x3f1d1f(0xd3)](a19_0xe9f748[_0x3f1d1f(0xcc)]('Error:\x20Directory\x20not\x20found:\x20'+_0x58cd81+'\x0a')),0x1;let _0x52c841;if(_0x408525){if(!_0x408525[_0x3f1d1f(0xda)](_0x3f1d1f(0xfe))&&!_0x408525['endsWith'](_0x3f1d1f(0xdd)))return console['error'](a19_0xe9f748['red']('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x408525+'\x0a')),0x1;_0x52c841=[_0x408525];}else _0x52c841=findYamlFiles(_0x58cd81);if(_0x52c841[_0x3f1d1f(0xf4)]===0x0)return console[_0x3f1d1f(0xd3)](a19_0xe9f748['red']('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x58cd81+'\x0a')),0x1;const _0x325c46=validateYamlFiles(_0x52c841,_0x58cd81,{'filterType':_0x3f1d1f(0xf9)}),_0x320680=calculateSummary(_0x325c46),_0x421a4f=_0x325c46[_0x3f1d1f(0xff)](isValidationResult);if(_0x421a4f['length']===0x0)return console[_0x3f1d1f(0xd3)](a19_0xe9f748[_0x3f1d1f(0xe4)](_0x3f1d1f(0xd6)+_0x58cd81+'\x0a')),_0x320680[_0x3f1d1f(0xde)]>0x0&&console[_0x3f1d1f(0xd3)](a19_0xe9f748[_0x3f1d1f(0xe2)]('('+_0x320680[_0x3f1d1f(0xde)]+'\x20segment\x20file(s)\x20skipped)')),0x0;for(const _0x4d820e of _0x325c46){if(!isValidationResult(_0x4d820e)){_0xdc58f[_0x3f1d1f(0xd7)]&&console[_0x3f1d1f(0xeb)](a19_0xe9f748[_0x3f1d1f(0xe2)]('-\x20'+_0x4d820e[_0x3f1d1f(0xfc)]+_0x3f1d1f(0xea)+_0x4d820e[_0x3f1d1f(0xd9)]+')'));continue;}const {relativePath:_0x41d3d6,source:_0x1b5043,result:_0x5999bb}=_0x4d820e;if(_0x5999bb[_0x3f1d1f(0xe5)]&&_0x5999bb['warnings'][_0x3f1d1f(0xf4)]===0x0)_0xdc58f['verbose']&&console['log'](a19_0xe9f748[_0x3f1d1f(0xf2)]('✔\x20'+_0x41d3d6));else _0x5999bb[_0x3f1d1f(0xe5)]?(console[_0x3f1d1f(0xeb)](a19_0xe9f748['yellow']('⚠\x20'+_0x41d3d6+':\x20'+_0x5999bb[_0x3f1d1f(0xf8)][_0x3f1d1f(0xf4)]+_0x3f1d1f(0xf3))),console[_0x3f1d1f(0xeb)](formatValidationResult(_0x5999bb,_0x1b5043,_0x41d3d6))):(console['log'](a19_0xe9f748['red']('✖\x20'+_0x41d3d6+':\x20'+_0x5999bb[_0x3f1d1f(0xe6)][_0x3f1d1f(0xf4)]+'\x20error(s)')),console['log'](formatValidationResult(_0x5999bb,_0x1b5043,_0x41d3d6)));}return console[_0x3f1d1f(0xeb)](''),_0x320680[_0x3f1d1f(0x107)]?(console[_0x3f1d1f(0xeb)](a19_0xe9f748[_0x3f1d1f(0xcc)](_0x3f1d1f(0xfa)+_0x320680[_0x3f1d1f(0x106)]+_0x3f1d1f(0xec)+_0x320680[_0x3f1d1f(0xef)]+'\x20valid')),_0x320680[_0x3f1d1f(0xcf)]>0x0&&console[_0x3f1d1f(0xeb)](a19_0xe9f748[_0x3f1d1f(0xe4)](_0x320680[_0x3f1d1f(0xcf)]+_0x3f1d1f(0xe0))),_0x320680[_0x3f1d1f(0xde)]>0x0&&console[_0x3f1d1f(0xeb)](a19_0xe9f748[_0x3f1d1f(0xe2)](_0x320680['skippedCount']+_0x3f1d1f(0xf1))),0x1):(console[_0x3f1d1f(0xeb)](a19_0xe9f748[_0x3f1d1f(0xf2)](_0x3f1d1f(0xd0)+_0x320680['validCount']+_0x3f1d1f(0xe1))),_0x320680[_0x3f1d1f(0xcf)]>0x0&&console[_0x3f1d1f(0xeb)](a19_0xe9f748[_0x3f1d1f(0xe4)](_0x320680['warningCount']+_0x3f1d1f(0xe0))),_0x320680[_0x3f1d1f(0xde)]>0x0&&console[_0x3f1d1f(0xeb)](a19_0xe9f748['dim'](_0x320680[_0x3f1d1f(0xde)]+_0x3f1d1f(0xf1))),0x0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a20_0x72a90=a20_0x46b8;(function(_0x230b74,_0x71ddd5){const _0x1555a3=a20_0x46b8,_0x37c84d=_0x230b74();while(!![]){try{const _0x399686=-parseInt(_0x1555a3(0x20f))/0x1*(parseInt(_0x1555a3(0x18b))/0x2)+parseInt(_0x1555a3(0x1c5))/0x3+parseInt(_0x1555a3(0x172))/0x4*(parseInt(_0x1555a3(0x1b1))/0x5)+parseInt(_0x1555a3(0x236))/0x6+parseInt(_0x1555a3(0x1e0))/0x7+parseInt(_0x1555a3(0x20b))/0x8+parseInt(_0x1555a3(0x1fa))/0x9*(-parseInt(_0x1555a3(0x1e4))/0xa);if(_0x399686===_0x71ddd5)break;else _0x37c84d['push'](_0x37c84d['shift']());}catch(_0x76e140){_0x37c84d['push'](_0x37c84d['shift']());}}}(a20_0x41f2,0x68e7d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a20_0x46b8(_0x1cfc38,_0x3f33bd){_0x1cfc38=_0x1cfc38-0x168;const _0x41f277=a20_0x41f2();let _0x46b878=_0x41f277[_0x1cfc38];return _0x46b878;}import{handleSDKOutput,writeOutput}from'../core/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'../core/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a20_0x533684 from'node:fs';function handleSDKError(_0x1083af,_0x18d2cd){const _0x556e38=a20_0x46b8;if(_0x1083af instanceof SDKError)console['error'](_0x556e38(0x168)+_0x1083af[_0x556e38(0x17b)]),_0x18d2cd[_0x556e38(0x221)]&&(_0x1083af[_0x556e38(0x175)]&&console[_0x556e38(0x1ef)](_0x556e38(0x1d3)+_0x1083af[_0x556e38(0x175)]),_0x1083af['stack']&&(console[_0x556e38(0x1ef)](_0x556e38(0x18c)),console[_0x556e38(0x1ef)](_0x1083af[_0x556e38(0x1e9)])));else throw _0x1083af;}function formatChatHistoryEntry(_0x4c6cd3,_0x6f33b4){const _0x342e7b=a20_0x46b8,_0x3ba579=getChalk(_0x6f33b4),_0x1ce1a3=_0x3ba579['dim'](_0x4c6cd3['at']);if(_0x342e7b(0x1cd)in _0x4c6cd3){const _0xf5418c=_0x3ba579[_0x342e7b(0x1c4)](_0x342e7b(0x1f7));return _0x1ce1a3+'\x20'+_0xf5418c+':\x20'+_0x4c6cd3['input'];}if(_0x342e7b(0x209)in _0x4c6cd3){const _0xcd0c8=_0x3ba579[_0x342e7b(0x1d2)]('[content]');return _0x1ce1a3+'\x20'+_0xcd0c8+':\x20'+_0x4c6cd3[_0x342e7b(0x209)];}if(_0x342e7b(0x176)in _0x4c6cd3){const _0x5b2b5a=_0x3ba579[_0x342e7b(0x184)](_0x342e7b(0x204)),{functionName:_0x5ee7b5,functionArguments:_0x523416,targetFunction:_0x44c2d8}=_0x4c6cd3['tool_call'];let _0x20f226=_0x1ce1a3+'\x20'+_0x5b2b5a+':\x20'+_0x3ba579[_0x342e7b(0x1bd)](_0x5ee7b5);if(_0x523416&&Object[_0x342e7b(0x1ed)](_0x523416)[_0x342e7b(0x186)]>0x0){const _0x20eed5=Object['entries'](_0x523416)[_0x342e7b(0x1db)](([_0x123f23,_0x48a67e])=>_0x123f23+'='+JSON[_0x342e7b(0x239)](_0x48a67e))[_0x342e7b(0x241)](',\x20');_0x20f226+='('+_0x20eed5+')';}_0x44c2d8&&(_0x20f226+=_0x3ba579[_0x342e7b(0x180)]('\x20['+_0x44c2d8+']'));let _0x5762bd='';if(_0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x1b6)])_0x5762bd='\x20->\x20KB:'+_0x4c6cd3[_0x342e7b(0x176)]['targetKnowledgeBase'][_0x342e7b(0x223)];else{if(_0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x19f)])_0x5762bd='\x20->\x20Agent:'+_0x4c6cd3['tool_call'][_0x342e7b(0x19f)][_0x342e7b(0x223)];else{if(_0x4c6cd3[_0x342e7b(0x176)]['targetWebSearchTool'])_0x5762bd=_0x342e7b(0x233)+_0x4c6cd3[_0x342e7b(0x176)]['targetWebSearchTool'][_0x342e7b(0x223)];else _0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x16c)]&&(_0x5762bd=_0x342e7b(0x1fe)+_0x4c6cd3[_0x342e7b(0x176)][_0x342e7b(0x16c)][_0x342e7b(0x223)]);}}return _0x20f226+_0x5762bd;}if(_0x342e7b(0x1dc)in _0x4c6cd3){const _0x3da67e=_0x3ba579[_0x342e7b(0x234)]('[tool]\x20\x20\x20'),{functionName:_0x447688,functionArguments:_0x19c42c,content:_0x324282,newChat:_0x550157}=_0x4c6cd3[_0x342e7b(0x1dc)];let _0x49cc10=_0x1ce1a3+'\x20'+_0x3da67e+':\x20'+_0x3ba579[_0x342e7b(0x1bd)](_0x447688);if(_0x19c42c){const _0x38b941=typeof _0x19c42c===_0x342e7b(0x1f8)?_0x19c42c:JSON[_0x342e7b(0x239)](_0x19c42c);_0x49cc10+='('+_0x38b941+')';}return _0x324282&&(_0x49cc10+='\x0a'+_0x3ba579[_0x342e7b(0x180)](_0x324282)),_0x550157&&(_0x49cc10+=_0x3ba579['dim'](_0x342e7b(0x1ac)+_0x550157['id'])),_0x49cc10;}if(_0x342e7b(0x201)in _0x4c6cd3){const _0x4eba79=_0x3ba579[_0x342e7b(0x1f4)]('[output]\x20');return _0x1ce1a3+'\x20'+_0x4eba79+':\x20'+_0x4c6cd3[_0x342e7b(0x201)][_0x342e7b(0x223)]+'\x20('+_0x4c6cd3[_0x342e7b(0x201)][_0x342e7b(0x209)]['length']+_0x342e7b(0x22d);}if(_0x342e7b(0x231)in _0x4c6cd3){const _0x176055=_0x3ba579['blue']('[image]\x20\x20'),{width:_0x586a1c,height:_0x4f8e6a,headerText:_0x2410b5}=_0x4c6cd3[_0x342e7b(0x231)],_0x951163=_0x2410b5?_0x342e7b(0x1c9)+_0x2410b5:'';return _0x1ce1a3+'\x20'+_0x176055+':\x20'+_0x586a1c+'x'+_0x4f8e6a+_0x951163;}if('error'in _0x4c6cd3){const _0x4c966b=_0x3ba579[_0x342e7b(0x18d)](_0x342e7b(0x197));return _0x1ce1a3+'\x20'+_0x4c966b+':\x20'+_0x4c6cd3[_0x342e7b(0x1ef)];}return _0x1ce1a3+'\x20'+_0x3ba579[_0x342e7b(0x180)](_0x342e7b(0x17c))+':\x20'+JSON[_0x342e7b(0x239)](_0x4c6cd3);}async function executeChatHistoryCommand(_0xead02d,_0x7bb765){const _0x4f1d5a=a20_0x46b8,{options:_0x67b19c,args:_0xbaf815,tdx:_0x340832}=_0xead02d,_0x171855=_0xbaf815[0x0],_0x5c9268=_0x67b19c,_0x62faae=_0x5c9268[_0x4f1d5a(0x211)];try{if(_0x62faae&&_0x171855)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x4f1d5a(0x1ef)](_0x4f1d5a(0x225)+_0x7bb765+_0x4f1d5a(0x192)),0x1;if(!_0x171855&&!_0x62faae&&_0x67b19c[_0x4f1d5a(0x1ec)]!==undefined){const _0x43a187=resolveLimit(_0x67b19c[_0x4f1d5a(0x22c)],DEFAULT_LLM_LIMIT),_0x8385f9=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x340832[_0x4f1d5a(0x1c8)]['chats'](_0x43a187),{'verbose':_0x67b19c[_0x4f1d5a(0x221)]});return await handleSDKOutput(_0x8385f9[_0x4f1d5a(0x195)],_0x67b19c),0x0;}const _0x1aa4c0=await getChatIdOrSelect(_0x340832,_0x67b19c,_0x62faae,_0x171855);if(!_0x1aa4c0)return 0x0;return await displayChatHistory(_0x1aa4c0,_0x340832,_0x67b19c),0x0;}catch(_0x391fba){return handleSDKError(_0x391fba,_0x67b19c),0x1;}}async function displayChatHistory(_0x3751bd,_0xad89eb,_0x1a7c5e){const _0x3409f4=a20_0x46b8,_0x4fcb17=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x3751bd+'\x27...',()=>_0xad89eb[_0x3409f4(0x1c8)][_0x3409f4(0x17f)](_0x3751bd),{'verbose':_0x1a7c5e[_0x3409f4(0x221)]}),_0x3dbd93=_0x4fcb17[_0x3409f4(0x195)][_0x3409f4(0x195)]??[];if(_0x3dbd93['length']===0x0){console[_0x3409f4(0x1e2)](_0x3409f4(0x210));return;}if(_0x1a7c5e[_0x3409f4(0x1ec)]!==undefined)await handleSDKOutput(_0x3dbd93,_0x1a7c5e);else{const _0x3c71b6=_0x3dbd93[_0x3409f4(0x1db)](_0xf48952=>formatChatHistoryEntry(_0xf48952,_0x1a7c5e)),_0x2bdeb0=_0x3c71b6[_0x3409f4(0x241)]('\x0a');await writeOutput(_0x2bdeb0,_0x1a7c5e[_0x3409f4(0x201)],_0x3409f4(0x17a));}}async function getChatIdOrSelect(_0x2ecae5,_0x583d59,_0x128539,_0x5e2244){const _0x21c0c3=a20_0x46b8;if(_0x5e2244)return _0x5e2244;if(_0x128539){const _0x4ff665=await withSpinner(_0x21c0c3(0x200),()=>_0x2ecae5[_0x21c0c3(0x1c8)][_0x21c0c3(0x1fd)](0x1),{'verbose':_0x583d59[_0x21c0c3(0x221)]});if(_0x4ff665[_0x21c0c3(0x195)][_0x21c0c3(0x186)]===0x0)return console[_0x21c0c3(0x1e2)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x4ff665[_0x21c0c3(0x195)][0x0]['id'];}const _0x13baf8=await selectChatInteractively(_0x2ecae5,_0x583d59);if(!_0x13baf8)return console[_0x21c0c3(0x1e2)](_0x21c0c3(0x1c2)),undefined;return _0x13baf8;}async function getProjectIdOrDefault(_0x3565e2){const _0x1b02c4=await getProjectWithName(_0x3565e2);return _0x1b02c4['id'];}async function getProjectWithName(_0x251d47){const _0x2734ff=a20_0x46b8,{tdx:_0x1d59cd,options:_0x376201}=_0x251d47,_0x1340d4=_0x376201[_0x2734ff(0x1d1)];if(_0x1340d4){const _0x30b288=await withSpinner('Resolving\x20project\x20\x27'+_0x1340d4+_0x2734ff(0x1e6),()=>_0x1d59cd[_0x2734ff(0x1c8)]['resolveProjectId'](_0x1340d4),{'verbose':_0x376201['verbose']});return{'id':_0x30b288['data'],'name':_0x1340d4};}const _0x437085=_0x1d59cd[_0x2734ff(0x1c8)][_0x2734ff(0x1d4)]();if(_0x437085){const _0x5583e4=await _0x1d59cd['llm'][_0x2734ff(0x18e)](),_0x1baabb=_0x5583e4[_0x2734ff(0x207)](_0xf3df40=>_0xf3df40['id']===_0x437085);return{'id':_0x437085,'name':_0x1baabb?.[_0x2734ff(0x1c7)][_0x2734ff(0x223)]||_0x2734ff(0x1d0)};}const _0x1bd9cc=await withSpinner(_0x2734ff(0x178),()=>_0x1d59cd[_0x2734ff(0x1c8)][_0x2734ff(0x1e3)](),{'verbose':_0x376201['verbose']});return{'id':_0x1bd9cc['data']['id'],'name':_0x1bd9cc[_0x2734ff(0x195)][_0x2734ff(0x1c7)][_0x2734ff(0x223)]};}function toLLMProjectInfo(_0x3c5651){const _0x4bd004=a20_0x46b8;return{'name':_0x3c5651[_0x4bd004(0x1c7)]['name'],'description':_0x3c5651[_0x4bd004(0x1c7)][_0x4bd004(0x177)],'createdAt':_0x3c5651['attributes'][_0x4bd004(0x1b5)],'updatedAt':_0x3c5651[_0x4bd004(0x1c7)][_0x4bd004(0x1bb)]};}function toAgentInfo(_0x37bb2f){const _0xc03f7e=a20_0x46b8;return{'name':_0x37bb2f[_0xc03f7e(0x1c7)]['name'],'description':_0x37bb2f[_0xc03f7e(0x1c7)]['description'],'prompt':truncatePrompt(_0x37bb2f[_0xc03f7e(0x1c7)][_0xc03f7e(0x232)]),'createdAt':_0x37bb2f[_0xc03f7e(0x1c7)][_0xc03f7e(0x1b5)],'updatedAt':_0x37bb2f[_0xc03f7e(0x1c7)]['updatedAt']};}function truncatePrompt(_0x2bed6b){const _0x365f4d=a20_0x46b8;if(!_0x2bed6b)return undefined;const _0x426f75=0x64;if(_0x2bed6b[_0x365f4d(0x186)]<=_0x426f75)return _0x2bed6b;return _0x2bed6b['slice'](0x0,_0x426f75)+_0x365f4d(0x1e1);}export class LLMModelsCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x238);[a20_0x72a90(0x177)]=a20_0x72a90(0x1a7);async[a20_0x72a90(0x21b)](_0x4904b0){const _0x201960=a20_0x72a90,{options:_0x17f583,tdx:_0x49e194}=_0x4904b0;try{const _0x24129f=await withSpinner(_0x201960(0x17d),()=>_0x49e194['llm'][_0x201960(0x235)](),{'verbose':_0x17f583[_0x201960(0x221)]});return await handleSDKOutput(_0x24129f[_0x201960(0x195)],_0x17f583),0x0;}catch(_0x1b4e93){return handleSDKError(_0x1b4e93,_0x17f583),0x1;}}}function a20_0x41f2(){const _0x42033a=['\x20\x20Knowledge\x20Bases:\x20','setCurrentProject','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','\x20--last','counts','yes','data','Creating\x20project\x20\x27','[error]\x20\x20','agent','exportedFrom','Resolving\x20agent\x20\x27','temperature','Set\x20current\x20project\x20context','outputDir','model','targetAgent','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','\x20\x20\x20Examples:','Project\x20restored:\x20','Setting\x20project\x20context\x20to\x20\x27','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','chatId','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','List\x20available\x20LLM\x20models','numeric','A\x20project\x20named\x20\x27','projectName','Checking\x20for\x20existing\x20projects...','\x20→\x20chat:\x20','\x20\x20Prompts:\x20','m\x20ago','Delete\x20an\x20LLM\x20project','Create\x20a\x20new\x20LLM\x20project','2045vFyGkK','sort','⚒️\x20','\x20\x20Integrations:\x20','createdAt','targetKnowledgeBase','Fetching\x20projects...','Usage:\x20tdx\x20llm\x20use\x20<project-name>','INVALID_ARGUMENT','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','updatedAt','Deleting\x20project\x20\x27','bold','agents','push','getBackupMetadata','llm:project:backup','\x0aCancelled','sourceSite','cyan','1961892IHUMjX','site','attributes','llm','\x20-\x20','List\x20agents\x20in\x20current\x20project','Fetching\x20agents...','integrations','input','\x27\x20already\x20exists.\x20Overwrite?','__load_more__','Unknown','llmProject','green','\x20\x20Cause:\x20','getCurrentProject','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','localeCompare','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Show\x20chat\x20log','Validating\x20backup\x20from\x20\x27','Load\x20more...','map','tool','llm:agent:create','Output\x20directory\x20\x27','rmSync','2498328OODDLo','...','log','getOrCreateDefaultProject','4010gKjENH','Update\x20an\x20existing\x20agent','\x27...','Agent\x20updated:\x20','Project\x20not\x20found:\x20','stack','floor','get','format','keys','just\x20now','error','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','lastConversationAt','blue','llm:agents','Usage:\x20TDX_EXPERIMENTAL=true\x20tdx\x20llm\x20log\x20<chat-id>','[input]\x20\x20','string','dryRun','29844odENtv','\x20\x20Agents:\x20','toLowerCase','chats','\x20->\x20ImageGen:','Error:\x20Backup\x20folder\x20path\x20is\x20required','Fetching\x20most\x20recent\x20chat...','output','Backup\x20cancelled.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','[tool_call]','llm:history','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','find','Restore\x20cancelled.','content','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','899088zMakxA','knowledgeBases','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','maxToolIterations','23ceNJjA','No\x20messages\x20found\x20in\x20chat\x20history.','last','tsv','systemPrompt','(no\x20agent)','existsSync','Show\x20agent\x20details','llm:project:create','split','substring','filter','execute','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','No\x20projects\x20found','tdx\x20llm\x20history','Project\x20deleted:\x20','Resolving\x20project\x20\x27','verbose','Error:\x20Project\x20name\x20is\x20required','name','llm:project:delete','Usage:\x20','backupProject','starterMessage','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','Create\x20a\x20new\x20agent\x20in\x20current\x20project','\x20project(s)','Agent\x20deleted:\x20','limit','\x20bytes)','json','Project\x20context\x20set\x20to:\x20','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','image','prompt','\x20->\x20WebSearch:','magenta','models','4634556dEoaZv','agentId','llm:models','stringify','Agent\x20created:\x20','Deleting\x20agent...','Updating\x20agent...','Error:\x20chat-id\x20is\x20required','getChatLog','jsonl','resolveAgentId','join','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Error:\x20','Use\x20format:\x20project-name/agent-name','resolveProjectId','Error:\x20Agent\x20name\x20is\x20required','targetImageGenerator','getTime','set','en-US','Invalid\x20path\x20syntax:\x20','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','1432euwNbu','includes','updateAgent','cause','tool_call','description','Getting\x20default\x20project...','deleteProject','table','message','[unknown]','Fetching\x20available\x20models...','Fetching\x20chat\x20sessions...','history','dim','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','.llm','llm:log','yellow','d\x20ago','length','createAgent','prompts','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','🤖\x20','24582DwUXBg','\x0aStack\x20trace:','red','projects'];a20_0x41f2=function(){return _0x42033a;};return a20_0x41f2();}export class LLMProjectsCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:projects';[a20_0x72a90(0x177)]='List\x20all\x20LLM\x20projects';async['execute'](_0x4c2811){const _0x3e613b=a20_0x72a90,{options:_0x2dacf6,args:_0x50f3a7,tdx:_0x53c7f9}=_0x4c2811,_0x33c95=getChalk(_0x2dacf6),_0x1e0a4c=_0x2dacf6['site'];try{const _0x5e8751=_0x50f3a7[0x0],_0x17c72f=resolveLimit(_0x2dacf6[_0x3e613b(0x22c)],DEFAULT_LLM_LIMIT),_0x3dd9b7=await withSpinner(_0x3e613b(0x1b7),()=>_0x53c7f9[_0x3e613b(0x1c8)][_0x3e613b(0x18e)](_0x17c72f),{'verbose':_0x2dacf6[_0x3e613b(0x221)]});let _0x39d01f=_0x3dd9b7['data'];_0x5e8751&&(_0x39d01f=_0x3dd9b7['data'][_0x3e613b(0x21a)](_0x49d3a8=>matchGlobPattern(_0x49d3a8[_0x3e613b(0x1c7)][_0x3e613b(0x223)],_0x5e8751)));const _0x7cfc=_0x2dacf6[_0x3e613b(0x1ec)]===_0x3e613b(0x22e)||_0x2dacf6['format']===_0x3e613b(0x23f)||_0x2dacf6[_0x3e613b(0x1ec)]==='table'||_0x2dacf6[_0x3e613b(0x1ec)]===_0x3e613b(0x212);if(_0x7cfc){const _0x55af84=_0x39d01f[_0x3e613b(0x1db)](_0x3b9614=>({...toLLMProjectInfo(_0x3b9614),'url':getLLMProjectUrl(_0x1e0a4c,_0x3b9614['id'])}));await handleSDKOutput(_0x55af84,_0x2dacf6);}else{const _0x57112e=[];if(_0x39d01f[_0x3e613b(0x186)]===0x0)_0x57112e[_0x3e613b(0x1bf)](_0x33c95['dim'](_0x3e613b(0x21d)));else{const _0x2f8d3a=[..._0x39d01f][_0x3e613b(0x1b2)]((_0x3f30cc,_0x2dfe23)=>_0x3f30cc[_0x3e613b(0x1c7)][_0x3e613b(0x223)][_0x3e613b(0x1d6)](_0x2dfe23[_0x3e613b(0x1c7)]['name']));for(const _0x4e142c of _0x2f8d3a){const _0x20bd8f=getLLMProjectUrl(_0x1e0a4c,_0x4e142c['id']),_0x3084fb=hyperlink(_0x4e142c['attributes']['name'],_0x20bd8f);_0x57112e['push'](_0x3e613b(0x1b3)+_0x3084fb);}_0x57112e[_0x3e613b(0x1bf)](_0x33c95[_0x3e613b(0x180)](_0x39d01f['length']+_0x3e613b(0x22a)));}await writeOutput(_0x57112e['join']('\x0a'),_0x2dacf6[_0x3e613b(0x201)],_0x3e613b(0x17a));}return 0x0;}catch(_0x26863c){return handleSDKError(_0x26863c,_0x2dacf6),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1f5);[a20_0x72a90(0x177)]=a20_0x72a90(0x1ca);async[a20_0x72a90(0x21b)](_0x3978e2){const _0xeea4d9=a20_0x72a90,{options:_0x3f2d63,args:_0x4f639c,tdx:_0x4bc8ab}=_0x3978e2,_0x5b4ad9=getChalk(_0x3f2d63),_0x269c5f=_0x3f2d63[_0xeea4d9(0x1c6)];try{const _0x51edeb=_0x4f639c[0x0];let _0x3a2386=_0x51edeb,_0x115f96,_0x4b1f0d;if(_0x51edeb&&_0x51edeb[_0xeea4d9(0x173)]('/')){const _0xf99a39=_0x51edeb[_0xeea4d9(0x218)]('/');if(_0xf99a39[_0xeea4d9(0x186)]===0x2){const [_0x1f20b4,_0x53a05e]=_0xf99a39,_0x589bd6=await _0x4bc8ab[_0xeea4d9(0x1c8)]['projects'](),_0x3725bf=_0x589bd6[_0xeea4d9(0x207)](_0x2ba695=>_0x2ba695['attributes']['name']['toLowerCase']()===_0x1f20b4[_0xeea4d9(0x1fc)]());if(!_0x3725bf)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0xeea4d9(0x1e8)+_0x1f20b4,undefined,{'helpText':_0xeea4d9(0x203)});_0x115f96=_0x3725bf['id'],_0x4b1f0d=_0x3725bf[_0xeea4d9(0x1c7)][_0xeea4d9(0x223)],_0x3a2386=_0x53a05e;}else throw new SDKError(ErrorCode[_0xeea4d9(0x1b9)],_0xeea4d9(0x170)+_0x51edeb,undefined,{'helpText':_0xeea4d9(0x169)});}else{const _0x2843bc=await getProjectWithName(_0x3978e2);_0x115f96=_0x2843bc['id'],_0x4b1f0d=_0x2843bc[_0xeea4d9(0x223)];}const _0x37282c=await withSpinner(_0xeea4d9(0x1cb),()=>_0x4bc8ab[_0xeea4d9(0x1c8)][_0xeea4d9(0x1be)](_0x115f96),{'verbose':_0x3f2d63[_0xeea4d9(0x221)]});let _0x2cdf09=_0x37282c[_0xeea4d9(0x195)];_0x3a2386&&(_0x2cdf09=_0x37282c[_0xeea4d9(0x195)][_0xeea4d9(0x21a)](_0x12463a=>matchGlobPattern(_0x12463a[_0xeea4d9(0x1c7)][_0xeea4d9(0x223)],_0x3a2386)));const _0x5ef83e=_0x3f2d63[_0xeea4d9(0x1ec)]===_0xeea4d9(0x22e)||_0x3f2d63[_0xeea4d9(0x1ec)]==='jsonl'||_0x3f2d63[_0xeea4d9(0x1ec)]==='table'||_0x3f2d63[_0xeea4d9(0x1ec)]===_0xeea4d9(0x212);if(_0x5ef83e){const _0x10e89e=_0x2cdf09[_0xeea4d9(0x1db)](_0x14d4d4=>({...toAgentInfo(_0x14d4d4),'chatUrl':getLLMAgentChatUrl(_0x269c5f,_0x115f96,_0x14d4d4['id'])}));await handleSDKOutput(_0x10e89e,_0x3f2d63);}else{const _0x3e4144=[];_0x3e4144['push'](_0x5b4ad9[_0xeea4d9(0x180)]('['+_0x4b1f0d+']'));if(_0x2cdf09['length']===0x0)_0x3e4144['push'](_0x5b4ad9[_0xeea4d9(0x180)]('No\x20agents\x20found'));else{const _0x153ac2=[..._0x2cdf09][_0xeea4d9(0x1b2)]((_0x1e2255,_0x2fc647)=>_0x1e2255['attributes'][_0xeea4d9(0x223)][_0xeea4d9(0x1d6)](_0x2fc647[_0xeea4d9(0x1c7)][_0xeea4d9(0x223)]));for(const _0x1fa2b7 of _0x153ac2){const _0x50dfb1=getLLMAgentChatUrl(_0x269c5f,_0x115f96,_0x1fa2b7['id']),_0xd910=hyperlink(_0x1fa2b7['attributes'][_0xeea4d9(0x223)],_0x50dfb1);_0x3e4144['push'](_0xeea4d9(0x18a)+_0xd910);}_0x3e4144['push'](_0x5b4ad9[_0xeea4d9(0x180)](_0x2cdf09[_0xeea4d9(0x186)]+'\x20agent(s)'));}await writeOutput(_0x3e4144[_0xeea4d9(0x241)]('\x0a'),_0x3f2d63[_0xeea4d9(0x201)],_0xeea4d9(0x17a));}return 0x0;}catch(_0x45e399){return handleSDKError(_0x45e399,_0x3f2d63),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']='llm:agent:show';[a20_0x72a90(0x177)]=a20_0x72a90(0x216);async['execute'](_0x3a4512){const _0x1118e7=a20_0x72a90,{options:_0x2bcde6,args:_0x5a56cf,tdx:_0x4a0029}=_0x3a4512;if(_0x5a56cf[_0x1118e7(0x186)]===0x0)return console[_0x1118e7(0x1ef)](_0x1118e7(0x16b)),console[_0x1118e7(0x1ef)](_0x1118e7(0x21c)),0x1;const _0x4fd34d=_0x5a56cf[0x0];try{const _0x4f511f=await getProjectIdOrDefault(_0x3a4512),_0x4515ad=await withSpinner('Resolving\x20agent\x20\x27'+_0x4fd34d+_0x1118e7(0x1e6),()=>_0x4a0029['llm'][_0x1118e7(0x240)](_0x4fd34d,_0x4f511f),{'verbose':_0x2bcde6['verbose']}),_0x11dcd4=await withSpinner('Fetching\x20agent...',()=>_0x4a0029[_0x1118e7(0x1c8)][_0x1118e7(0x198)](_0x4515ad['data']),{'verbose':_0x2bcde6[_0x1118e7(0x221)]});return await handleSDKOutput([_0x11dcd4[_0x1118e7(0x195)]],_0x2bcde6),0x0;}catch(_0x4ef04e){return handleSDKError(_0x4ef04e,_0x2bcde6),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1dd);[a20_0x72a90(0x177)]=a20_0x72a90(0x229);async[a20_0x72a90(0x21b)](_0x489d16){const _0x32b9f1=a20_0x72a90,{options:_0xdffdc7,args:_0x387a38,tdx:_0x32ca7c}=_0x489d16;if(_0x387a38[_0x32b9f1(0x186)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console[_0x32b9f1(0x1ef)](_0x32b9f1(0x1f1)),console[_0x32b9f1(0x1ef)](_0x32b9f1(0x242)),0x1;const _0x43f935=_0x387a38[0x0],_0x2260a2=_0xdffdc7,_0x4fdeb0=_0x2260a2[_0x32b9f1(0x213)],_0x3e8b5f=_0x2260a2[_0x32b9f1(0x19e)]||'claude-4.5-haiku',_0x41f31a=_0x2260a2[_0x32b9f1(0x227)],_0xe59c03=_0x2260a2[_0x32b9f1(0x20e)]?Number(_0x2260a2[_0x32b9f1(0x20e)]):undefined,_0x4456d9=_0x2260a2[_0x32b9f1(0x19b)]?Number(_0x2260a2['temperature']):undefined;try{let _0x143a24,_0x1b5892;if(_0x43f935[_0x32b9f1(0x173)]('/')){const _0x256211=_0x43f935['split']('/');if(_0x256211[_0x32b9f1(0x186)]===0x2){const [_0x51a4fa,_0x4e947b]=_0x256211,_0x448b21=await withSpinner(_0x32b9f1(0x220)+_0x51a4fa+_0x32b9f1(0x1e6),()=>_0x32ca7c[_0x32b9f1(0x1c8)][_0x32b9f1(0x16a)](_0x51a4fa),{'verbose':_0xdffdc7[_0x32b9f1(0x221)]});_0x143a24=_0x448b21[_0x32b9f1(0x195)],_0x1b5892=_0x4e947b;}else throw new SDKError(ErrorCode[_0x32b9f1(0x1b9)],_0x32b9f1(0x170)+_0x43f935,undefined,{'helpText':_0x32b9f1(0x169)});}else _0x143a24=await getProjectIdOrDefault(_0x489d16),_0x1b5892=_0x43f935;const _0x5ebc62=await withSpinner('Creating\x20agent\x20\x27'+_0x1b5892+'\x27...',()=>_0x32ca7c[_0x32b9f1(0x1c8)][_0x32b9f1(0x187)]({'name':_0x1b5892,'projectId':_0x143a24,'modelType':_0x3e8b5f,'systemPrompt':_0x4fdeb0,'starterMessage':_0x41f31a,'maxToolIterations':_0xe59c03,'temperature':_0x4456d9}),{'verbose':_0xdffdc7['verbose']});return console['log'](_0x32b9f1(0x23a)+_0x5ebc62[_0x32b9f1(0x195)]['id']),await handleSDKOutput([_0x5ebc62[_0x32b9f1(0x195)]],_0xdffdc7),0x0;}catch(_0x46fd5c){return handleSDKError(_0x46fd5c,_0xdffdc7),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:agent:update';[a20_0x72a90(0x177)]=a20_0x72a90(0x1e5);async['execute'](_0xd098c7){const _0x48e6df=a20_0x72a90,{options:_0x94de06,args:_0xbc9e62,tdx:_0x39b337}=_0xd098c7;if(_0xbc9e62[_0x48e6df(0x186)]===0x0)return console[_0x48e6df(0x1ef)](_0x48e6df(0x16b)),console[_0x48e6df(0x1ef)](_0x48e6df(0x1a6)),0x1;const _0x407702=_0xbc9e62[0x0],_0x3c8080=_0x94de06,_0x40c489=_0x3c8080[_0x48e6df(0x223)],_0x49b9df=_0x3c8080['prompt'],_0x421d86=_0x3c8080['description'],_0x2b19d0=_0x3c8080[_0x48e6df(0x227)];if(!_0x40c489&&!_0x49b9df&&!_0x421d86&&!_0x2b19d0)return console[_0x48e6df(0x1ef)](_0x48e6df(0x1d7)),console[_0x48e6df(0x1ef)](_0x48e6df(0x1a4)),0x1;try{const _0x382a58=await getProjectIdOrDefault(_0xd098c7),_0x3cdeb1=await withSpinner('Resolving\x20agent\x20\x27'+_0x407702+_0x48e6df(0x1e6),()=>_0x39b337[_0x48e6df(0x1c8)][_0x48e6df(0x240)](_0x407702,_0x382a58),{'verbose':_0x94de06[_0x48e6df(0x221)]}),_0x3656a9=_0x3cdeb1[_0x48e6df(0x195)],_0x1634e2=await withSpinner(_0x48e6df(0x23c),()=>_0x39b337['llm'][_0x48e6df(0x174)](_0x3656a9,{'name':_0x40c489,'prompt':_0x49b9df,'description':_0x421d86,'starterMessage':_0x2b19d0}),{'verbose':_0x94de06[_0x48e6df(0x221)]});return console[_0x48e6df(0x1e2)](_0x48e6df(0x1e7)+_0x1634e2[_0x48e6df(0x195)]['id']),await handleSDKOutput([_0x1634e2[_0x48e6df(0x195)]],_0x94de06),0x0;}catch(_0x1aa6dc){return handleSDKError(_0x1aa6dc,_0x94de06),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:agent:delete';['description']='Delete\x20an\x20agent';async[a20_0x72a90(0x21b)](_0x474838){const _0xfa424e=a20_0x72a90,{options:_0x473a8b,args:_0x2150cc,tdx:_0x56669f}=_0x474838;if(_0x2150cc['length']===0x0)return console[_0xfa424e(0x1ef)](_0xfa424e(0x16b)),console[_0xfa424e(0x1ef)](_0xfa424e(0x1d5)),0x1;const _0x554894=_0x2150cc[0x0];try{const _0x3243b3=await getProjectIdOrDefault(_0x474838),_0x10b0fc=await withSpinner(_0xfa424e(0x19a)+_0x554894+'\x27...',()=>_0x56669f['llm'][_0xfa424e(0x240)](_0x554894,_0x3243b3),{'verbose':_0x473a8b[_0xfa424e(0x221)]}),_0x26729b=_0x10b0fc[_0xfa424e(0x195)];return await withSpinner(_0xfa424e(0x23b),()=>_0x56669f['llm']['deleteAgent'](_0x26729b),{'verbose':_0x473a8b[_0xfa424e(0x221)]}),console[_0xfa424e(0x1e2)](_0xfa424e(0x22b)+_0x26729b),0x0;}catch(_0x655dd4){return handleSDKError(_0x655dd4,_0x473a8b),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a20_0x72a90(0x205);[a20_0x72a90(0x177)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async[a20_0x72a90(0x21b)](_0x5e6044){const _0x270da0=a20_0x72a90;return executeChatHistoryCommand(_0x5e6044,_0x270da0(0x21e));}}export class LLMUseCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:use';['description']=a20_0x72a90(0x19c);async['execute'](_0x4831f4){const _0x5a58ef=a20_0x72a90,{options:_0x1603e0,args:_0x1c72d6,tdx:_0x52c6fd}=_0x4831f4;if(_0x1c72d6[_0x5a58ef(0x186)]===0x0)return console[_0x5a58ef(0x1ef)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x5a58ef(0x1ef)](_0x5a58ef(0x1b8)),0x1;const _0x5d438b=_0x1c72d6[0x0];try{return await withSpinner(_0x5a58ef(0x1a3)+_0x5d438b+_0x5a58ef(0x1e6),()=>_0x52c6fd[_0x5a58ef(0x1c8)][_0x5a58ef(0x190)](_0x5d438b),{'verbose':_0x1603e0[_0x5a58ef(0x221)]}),console[_0x5a58ef(0x1e2)](_0x5a58ef(0x22f)+_0x5d438b),0x0;}catch(_0x38ea1b){return handleSDKError(_0x38ea1b,_0x1603e0),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x217);[a20_0x72a90(0x177)]=a20_0x72a90(0x1b0);async[a20_0x72a90(0x21b)](_0x16b1d3){const _0x23e8a7=a20_0x72a90,{options:_0x3ba998,args:_0x237cf5,tdx:_0x22e922}=_0x16b1d3;if(_0x237cf5[_0x23e8a7(0x186)]===0x0)return console['error'](_0x23e8a7(0x222)),console[_0x23e8a7(0x1ef)](_0x23e8a7(0x1f0)),0x1;const _0x46de19=_0x237cf5[0x0],_0x5e1580=_0x3ba998,_0x57df8a=_0x5e1580[_0x23e8a7(0x177)];try{const _0x2d716e=await withSpinner(_0x23e8a7(0x196)+_0x46de19+_0x23e8a7(0x1e6),()=>_0x22e922[_0x23e8a7(0x1c8)]['createProject']({'name':_0x46de19,'description':_0x57df8a}),{'verbose':_0x3ba998[_0x23e8a7(0x221)]});console[_0x23e8a7(0x1e2)]('Project\x20created:\x20'+_0x2d716e[_0x23e8a7(0x195)]['id']);const _0x744990=toLLMProjectInfo(_0x2d716e['data']);return await handleSDKOutput([_0x744990],_0x3ba998),0x0;}catch(_0x4d38f8){return handleSDKError(_0x4d38f8,_0x3ba998),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x224);[a20_0x72a90(0x177)]=a20_0x72a90(0x1af);async[a20_0x72a90(0x21b)](_0x247b9a){const _0x3db83a=a20_0x72a90,{options:_0x506a1d,args:_0x597657,tdx:_0x1f59ac}=_0x247b9a;if(_0x597657[_0x3db83a(0x186)]===0x0)return console[_0x3db83a(0x1ef)](_0x3db83a(0x222)),console[_0x3db83a(0x1ef)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x4a774a=_0x597657[0x0];try{return await withSpinner(_0x3db83a(0x1bc)+_0x4a774a+_0x3db83a(0x1e6),()=>_0x1f59ac['llm'][_0x3db83a(0x179)](_0x4a774a),{'verbose':_0x506a1d[_0x3db83a(0x221)]}),console[_0x3db83a(0x1e2)](_0x3db83a(0x21f)+_0x4a774a),0x0;}catch(_0x3c0000){return handleSDKError(_0x3c0000,_0x506a1d),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1c1);[a20_0x72a90(0x177)]=a20_0x72a90(0x189);async[a20_0x72a90(0x21b)](_0x365243){const _0x4e5c31=a20_0x72a90,{options:_0x377787,args:_0x3c705c,tdx:_0x1c8d19}=_0x365243,_0x41bb57=getChalk(_0x377787);console[_0x4e5c31(0x1e2)](_0x41bb57[_0x4e5c31(0x184)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x4e5c31(0x1e2)](_0x41bb57['yellow'](_0x4e5c31(0x191))),console[_0x4e5c31(0x1e2)](_0x41bb57[_0x4e5c31(0x180)](_0x4e5c31(0x228))),console[_0x4e5c31(0x1e2)]();if(_0x3c705c[_0x4e5c31(0x186)]===0x0)return console['error'](_0x4e5c31(0x222)),console[_0x4e5c31(0x1ef)](_0x4e5c31(0x20d)),0x1;const _0x36023e=_0x3c705c[0x0],_0x1c8e50=_0x377787,_0x15f1bc=_0x1c8e50[_0x4e5c31(0x201)],_0x1ce334=_0x1c8e50[_0x4e5c31(0x1f9)];try{const _0x208f79=_0x15f1bc||_0x36023e+_0x4e5c31(0x182);if(a20_0x533684[_0x4e5c31(0x215)](_0x208f79)&&!_0x1ce334){if(!_0x377787[_0x4e5c31(0x194)]){const _0x1f5e01=await confirm(_0x4e5c31(0x1de)+_0x208f79+_0x4e5c31(0x1ce));if(!_0x1f5e01)return console['log'](_0x4e5c31(0x202)),0x0;}a20_0x533684[_0x4e5c31(0x1df)](_0x208f79,{'recursive':!![]});}const _0x5df4ef=await withSpinner(_0x1ce334?'Analyzing\x20project\x20\x27'+_0x36023e+_0x4e5c31(0x1e6):'Backing\x20up\x20project\x20\x27'+_0x36023e+_0x4e5c31(0x1e6),()=>_0x1c8d19[_0x4e5c31(0x1c8)][_0x4e5c31(0x226)](_0x36023e,_0x15f1bc,{'dryRun':_0x1ce334}),{'verbose':_0x377787[_0x4e5c31(0x221)]}),_0x2d9e87=_0x5df4ef['data'];return _0x1ce334?console[_0x4e5c31(0x1e2)](_0x4e5c31(0x1ba)+_0x2d9e87['outputDir']):console[_0x4e5c31(0x1e2)]('Project\x20backed\x20up\x20to:\x20'+_0x2d9e87[_0x4e5c31(0x19d)]),console[_0x4e5c31(0x1e2)](_0x4e5c31(0x1fb)+_0x2d9e87[_0x4e5c31(0x193)][_0x4e5c31(0x1be)]),console['log'](_0x4e5c31(0x18f)+_0x2d9e87[_0x4e5c31(0x193)][_0x4e5c31(0x20c)]),console['log'](_0x4e5c31(0x1ad)+_0x2d9e87[_0x4e5c31(0x193)]['prompts']),console[_0x4e5c31(0x1e2)](_0x4e5c31(0x1b4)+_0x2d9e87[_0x4e5c31(0x193)]['integrations']),(_0x377787[_0x4e5c31(0x1ec)]==='json'||_0x377787[_0x4e5c31(0x1ec)]===_0x4e5c31(0x23f))&&await handleSDKOutput([_0x2d9e87],_0x377787),0x0;}catch(_0x584c84){return handleSDKError(_0x584c84,_0x377787),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x72a90(0x223)]='llm:project:restore';['description']=a20_0x72a90(0x171);async[a20_0x72a90(0x21b)](_0x3db02c){const _0x25e9f4=a20_0x72a90,{options:_0x448fd8,args:_0x337054,tdx:_0x5a1984}=_0x3db02c,_0x337b05=getChalk(_0x448fd8);console[_0x25e9f4(0x1e2)](_0x337b05[_0x25e9f4(0x184)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console[_0x25e9f4(0x1e2)](_0x337b05[_0x25e9f4(0x184)]('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console['log'](_0x337b05[_0x25e9f4(0x180)](_0x25e9f4(0x1a1))),console['log'](_0x337b05[_0x25e9f4(0x180)](_0x25e9f4(0x1a0))),console[_0x25e9f4(0x1e2)](_0x337b05[_0x25e9f4(0x180)](_0x25e9f4(0x20a))),console[_0x25e9f4(0x1e2)]();if(_0x337054[_0x25e9f4(0x186)]===0x0)return console[_0x25e9f4(0x1ef)](_0x25e9f4(0x1ff)),console[_0x25e9f4(0x1ef)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x55f625=_0x337054[0x0],_0x2cc0bf=_0x448fd8,_0x26cb75=_0x2cc0bf['name'],_0x78635c=_0x2cc0bf['dryRun'];try{if(!_0x78635c){const _0x2e1266=_0x5a1984[_0x25e9f4(0x1c8)][_0x25e9f4(0x1c0)](_0x55f625),_0x565a23=_0x26cb75||_0x2e1266[_0x25e9f4(0x199)]['projectName'],_0x100548=await withSpinner(_0x25e9f4(0x1ab),()=>_0x5a1984[_0x25e9f4(0x1c8)]['projects'](),{'verbose':_0x448fd8['verbose']}),_0x43ee5c=_0x100548[_0x25e9f4(0x195)]['find'](_0x3c6778=>_0x3c6778['attributes'][_0x25e9f4(0x223)]===_0x565a23);if(_0x43ee5c&&!_0x448fd8['yes']){const _0x112baa=await confirm(_0x25e9f4(0x1a9)+_0x565a23+_0x25e9f4(0x181));if(!_0x112baa)return console[_0x25e9f4(0x1e2)](_0x25e9f4(0x208)),0x0;}}const _0x109ea9=await withSpinner(_0x78635c?_0x25e9f4(0x1d9)+_0x55f625+_0x25e9f4(0x1e6):'Restoring\x20project\x20from\x20\x27'+_0x55f625+_0x25e9f4(0x1e6),()=>_0x5a1984[_0x25e9f4(0x1c8)]['restoreProject'](_0x55f625,{'name':_0x26cb75,'dryRun':_0x78635c}),{'verbose':_0x448fd8[_0x25e9f4(0x221)]}),_0x542784=_0x109ea9[_0x25e9f4(0x195)];return _0x542784[_0x25e9f4(0x1c3)]&&console[_0x25e9f4(0x1e2)](_0x25e9f4(0x1f2)+_0x542784[_0x25e9f4(0x1c3)]+'\x27'),_0x78635c?console[_0x25e9f4(0x1e2)](_0x25e9f4(0x230)+_0x542784[_0x25e9f4(0x1aa)]):console[_0x25e9f4(0x1e2)](_0x25e9f4(0x1a2)+_0x542784[_0x25e9f4(0x1aa)]+'\x20('+_0x542784['projectId']+')'),console[_0x25e9f4(0x1e2)]('\x20\x20Agents:\x20'+_0x542784[_0x25e9f4(0x193)]['agents']),console['log'](_0x25e9f4(0x18f)+_0x542784['counts'][_0x25e9f4(0x20c)]),console[_0x25e9f4(0x1e2)]('\x20\x20Prompts:\x20'+_0x542784[_0x25e9f4(0x193)][_0x25e9f4(0x188)]),console[_0x25e9f4(0x1e2)](_0x25e9f4(0x1b4)+_0x542784['counts'][_0x25e9f4(0x1cc)]),(_0x448fd8['format']===_0x25e9f4(0x22e)||_0x448fd8['format']===_0x25e9f4(0x23f))&&await handleSDKOutput([_0x542784],_0x448fd8),0x0;}catch(_0x55f0be){return handleSDKError(_0x55f0be,_0x448fd8),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x154731,_0x4b314c){const _0x420b1b=a20_0x72a90,_0x3f9c11=_0x4b314c[_0x420b1b(0x22c)]||CHAT_SELECTOR_PAGE_SIZE;let _0x1b31fc=0x0,_0x4a99d1=[];const _0xa36137=(await import(_0x420b1b(0x188)))['default'],_0x406882=getChalk(_0x4b314c);while(!![]){const _0x5a98c9=await withSpinner(_0x420b1b(0x17e),()=>_0x154731[_0x420b1b(0x1c8)][_0x420b1b(0x1fd)](_0x3f9c11+_0x1b31fc),{'verbose':_0x4b314c['verbose']});_0x4a99d1=_0x5a98c9[_0x420b1b(0x195)];const _0x562168=_0x4a99d1['slice'](_0x1b31fc,_0x1b31fc+_0x3f9c11),_0x3921c5=_0x4a99d1['length']>_0x1b31fc+_0x3f9c11,_0x37693b=[...new Set(_0x562168[_0x420b1b(0x1db)](_0x5d8e3f=>_0x5d8e3f[_0x420b1b(0x1c7)][_0x420b1b(0x237)])[_0x420b1b(0x21a)](_0x2e45f8=>_0x2e45f8!==undefined))],_0x409b4f=new Map();await Promise['all'](_0x37693b[_0x420b1b(0x1db)](async _0x102a7e=>{const _0x433a19=_0x420b1b;try{const _0x301856=await _0x154731['llm'][_0x433a19(0x198)](_0x102a7e);_0x409b4f[_0x433a19(0x16e)](_0x102a7e,_0x301856[_0x433a19(0x1c7)][_0x433a19(0x223)]);}catch{_0x409b4f[_0x433a19(0x16e)](_0x102a7e,_0x102a7e);}}));const _0x5bedc7=_0x562168['map'](_0x304699=>{const _0x1a8444=_0x420b1b,_0x5c83f1=_0x304699[_0x1a8444(0x1c7)]['firstInputContent']||'(no\x20message)',_0x2f3599=_0x5c83f1['split']('\x0a')[0x0],_0x3224b7=_0x2f3599['length']>0x50?_0x2f3599[_0x1a8444(0x219)](0x0,0x4d)+'...':_0x2f3599,_0x2667c6=_0x304699[_0x1a8444(0x1c7)][_0x1a8444(0x237)]?_0x409b4f[_0x1a8444(0x1eb)](_0x304699['attributes'][_0x1a8444(0x237)])||_0x304699[_0x1a8444(0x1c7)][_0x1a8444(0x237)]:_0x1a8444(0x214),_0x515b3b=_0x304699[_0x1a8444(0x1c7)][_0x1a8444(0x1f3)]||_0x304699['attributes'][_0x1a8444(0x1bb)],_0x2a3131=new Date(_0x515b3b),_0x46f488=new Date(),_0x43b4a7=_0x46f488[_0x1a8444(0x16d)]()-_0x2a3131['getTime'](),_0x1867e4=Math[_0x1a8444(0x1ea)](_0x43b4a7/0xea60),_0x2c4954=Math[_0x1a8444(0x1ea)](_0x43b4a7/0x36ee80),_0x4bc496=Math[_0x1a8444(0x1ea)](_0x43b4a7/0x5265c00);let _0x5627bd;if(_0x1867e4<0x1)_0x5627bd=_0x1a8444(0x1ee);else{if(_0x1867e4<0x3c)_0x5627bd=_0x1867e4+_0x1a8444(0x1ae);else{if(_0x2c4954<0x18)_0x5627bd=_0x2c4954+'h\x20ago';else _0x4bc496<0x7?_0x5627bd=_0x4bc496+_0x1a8444(0x185):_0x5627bd=_0x2a3131['toLocaleDateString'](_0x1a8444(0x16f),{'month':'short','day':_0x1a8444(0x1a8)});}}return{'title':_0x3224b7+'\x20'+_0x406882[_0x1a8444(0x180)]('['+_0x2667c6+']\x20'+_0x5627bd),'value':_0x304699['id']};});_0x3921c5&&_0x5bedc7[_0x420b1b(0x1bf)]({'title':_0x406882['cyan'](_0x420b1b(0x1da)),'value':_0x420b1b(0x1cf)});const _0x29ae12=await _0xa36137({'type':'select','name':_0x420b1b(0x1a5),'message':'Select\x20a\x20chat\x20session:','choices':_0x5bedc7,'hint':_0x420b1b(0x206)});if(!_0x29ae12[_0x420b1b(0x1a5)])return undefined;if(_0x29ae12[_0x420b1b(0x1a5)]===_0x420b1b(0x1cf)){_0x1b31fc+=_0x3f9c11;continue;}return _0x29ae12['chatId'];}}export class ChatsCommand extends BaseCommand{[a20_0x72a90(0x223)]=a20_0x72a90(0x1fd);[a20_0x72a90(0x177)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a20_0x72a90(0x21b)](_0x361b8e){return executeChatHistoryCommand(_0x361b8e,'tdx\x20chats');}}export class LLMLogCommand extends BaseCommand{['name']=a20_0x72a90(0x183);[a20_0x72a90(0x177)]=a20_0x72a90(0x1d8);async['execute'](_0x6fd491){const _0xc9c475=a20_0x72a90,{options:_0x5d1742,args:_0x4b9322,tdx:_0x35bd79}=_0x6fd491,_0x16eed1=_0x4b9322[0x0];if(!_0x16eed1)return console[_0xc9c475(0x1ef)](_0xc9c475(0x23d)),console[_0xc9c475(0x1ef)](_0xc9c475(0x1f6)),0x1;const _0x288727=await withSpinner('Fetching\x20chat\x20log\x20for\x20\x27'+_0x16eed1+_0xc9c475(0x1e6),()=>_0x35bd79['llm'][_0xc9c475(0x23e)](_0x16eed1),{'verbose':_0x5d1742[_0xc9c475(0x221)]});return await handleSDKOutput(_0x288727[_0xc9c475(0x195)][_0xc9c475(0x195)],_0x5d1742),0x0;}}
|
|
1
|
+
const a20_0x5836c8=a20_0x5db2;(function(_0x1d357f,_0x346abd){const _0x157dea=a20_0x5db2,_0xede07=_0x1d357f();while(!![]){try{const _0x69adb6=-parseInt(_0x157dea(0x12c))/0x1+-parseInt(_0x157dea(0x1b0))/0x2+-parseInt(_0x157dea(0x1e4))/0x3*(-parseInt(_0x157dea(0x196))/0x4)+parseInt(_0x157dea(0x1a9))/0x5+-parseInt(_0x157dea(0x1a3))/0x6+parseInt(_0x157dea(0x176))/0x7*(-parseInt(_0x157dea(0x1ca))/0x8)+parseInt(_0x157dea(0x1da))/0x9*(parseInt(_0x157dea(0x1d0))/0xa);if(_0x69adb6===_0x346abd)break;else _0xede07['push'](_0xede07['shift']());}catch(_0x47cd5f){_0xede07['push'](_0xede07['shift']());}}}(a20_0x325d,0x60cdd));function a20_0x5db2(_0x14c715,_0x6d9860){_0x14c715=_0x14c715-0x126;const _0x325d3e=a20_0x325d();let _0x5db21d=_0x325d3e[_0x14c715];return _0x5db21d;}function a20_0x325d(){const _0x3db9d4=['4378110mFgKHA','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','sourceSite','llm:agent:create','prompts','error','3747770kDvzmN','resolveProjectId','magenta','m\x20ago','length','\x20bytes)','Resolving\x20project\x20\x27','375424AhUhsl','[error]\x20\x20','deleteAgent','output','\x20\x20Knowledge\x20Bases:\x20','Analyzing\x20project\x20\x27','Setting\x20project\x20context\x20to\x20\x27','toLowerCase','\x20→\x20chat:\x20','outputDir','List\x20available\x20LLM\x20models','(no\x20message)','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','message','format','attributes','setCurrentProject','Checking\x20for\x20existing\x20projects...','site','Project\x20not\x20found:\x20','yellow','Fetching\x20most\x20recent\x20chat...','Update\x20an\x20existing\x20agent','Fetching\x20available\x20models...','agents','104uLpDhn','exportedFrom','getCurrentProject','h\x20ago','llm:project:restore','Delete\x20an\x20LLM\x20project','3608610eyKDUY','\x20project(s)','...','description','\x20--last','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','agentId','Error:\x20','jsonl','history','9NAShMk','llm:project:delete','\x20\x20Prompts:\x20','A\x20project\x20named\x20\x27','last','slice','Error:\x20chat-id\x20is\x20required','[input]\x20\x20','Resolving\x20agent\x20\x27','cyan','327POkvtP','yes','image','Project\x20backed\x20up\x20to:\x20','tdx\x20chats','[tool]\x20\x20\x20','tool','createdAt','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','(no\x20agent)','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','createAgent','Use\x20format:\x20project-name/agent-name','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','chats','Fetching\x20projects...','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','entries','join','Fetching\x20agent...','toLocaleDateString','Unknown','sort','No\x20agents\x20found','d\x20ago','keys','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Error:\x20Backup\x20folder\x20path\x20is\x20required','llm:agent:update','map','filter','\x20\x20\x20Examples:','llm:project:backup','\x0aCancelled','[output]\x20','maxToolIterations','substring','Set\x20current\x20project\x20context','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','No\x20messages\x20found\x20in\x20chat\x20history.','models','Output\x20directory\x20\x27','Error:\x20Project\x20name\x20is\x20required','75257AphCib','claude-4.5-haiku','split','select','Fetching\x20chat\x20log\x20for\x20\x27','floor','set','Backup\x20cancelled.','Load\x20more...','getOrCreateDefaultProject','Deleting\x20agent...','projectName','updateAgent','log','stack','Fetching\x20agents...','content','agent','verbose','includes','__load_more__','llm:projects','Project\x20created:\x20','prompt','llm:agent:delete','push','localeCompare','Fetching\x20chat\x20sessions...','restoreProject','limit','knowledgeBases','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Create\x20a\x20new\x20agent\x20in\x20current\x20project','LLM_PROJECT_NOT_FOUND','data','\x20->\x20Agent:','\x27\x20already\x20exists.\x20Overwrite?','short','llm','table','updatedAt','backupProject','targetWebSearchTool','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','llm:models','\x20-\x20','Delete\x20an\x20agent','\x20\x20Agents:\x20','Project\x20restored:\x20','llm:log','tool_call','.llm','Creating\x20project\x20\x27','find','starterMessage','llm:agent:show','List\x20all\x20LLM\x20projects','\x20->\x20KB:','temperature','just\x20now','Agent\x20deleted:\x20','targetKnowledgeBase','\x20\x20Cause:\x20','\x20->\x20ImageGen:','bold','Error:\x20Agent\x20name\x20is\x20required','model','string','getTime','[image]\x20\x20','default','red','Usage:\x20TDX_EXPERIMENTAL=true\x20tdx\x20llm\x20log\x20<chat-id>','No\x20chat\x20sessions\x20found.','57617esOaar','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','INVALID_ARGUMENT','\x20\x20Integrations:\x20','projectId','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','llmProject','Getting\x20default\x20project...','List\x20agents\x20in\x20current\x20project','green','🤖\x20','existsSync','tsv','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','\x27...','numeric','rmSync','resolveAgentId','llm:project:create','targetAgent','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','execute','stringify','name','Usage:\x20','Agent\x20created:\x20','getBackupMetadata','Fetching\x20chat\x20history\x20for\x20\x27','targetImageGenerator','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','chatId','counts','14156bSYkCs','⚒️\x20','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','en-US','projects','llm:use','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','json','dim','lastConversationAt','all','blue'];a20_0x325d=function(){return _0x3db9d4;};return a20_0x325d();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/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'../core/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a20_0x467943 from'node:fs';function handleSDKError(_0x3fd2a4,_0x14129b){const _0x90758=a20_0x5db2;if(_0x3fd2a4 instanceof SDKError)console[_0x90758(0x1a8)](_0x90758(0x1d7)+_0x3fd2a4[_0x90758(0x1be)]),_0x14129b['verbose']&&(_0x3fd2a4['cause']&&console['error'](_0x90758(0x16a)+_0x3fd2a4['cause']),_0x3fd2a4[_0x90758(0x13a)]&&(console[_0x90758(0x1a8)]('\x0aStack\x20trace:'),console[_0x90758(0x1a8)](_0x3fd2a4[_0x90758(0x13a)])));else throw _0x3fd2a4;}function formatChatHistoryEntry(_0x174ed6,_0x1a63f2){const _0x1a9a22=a20_0x5db2,_0x2fb083=getChalk(_0x1a63f2),_0x5cbcc9=_0x2fb083['dim'](_0x174ed6['at']);if('input'in _0x174ed6){const _0x6ea59f=_0x2fb083['cyan'](_0x1a9a22(0x1e1));return _0x5cbcc9+'\x20'+_0x6ea59f+':\x20'+_0x174ed6['input'];}if(_0x1a9a22(0x13c)in _0x174ed6){const _0x17c66a=_0x2fb083[_0x1a9a22(0x17f)]('[content]');return _0x5cbcc9+'\x20'+_0x17c66a+':\x20'+_0x174ed6['content'];}if('tool_call'in _0x174ed6){const _0x4039e6=_0x2fb083[_0x1a9a22(0x1c5)]('[tool_call]'),{functionName:_0x31e9f3,functionArguments:_0x54522f,targetFunction:_0x5db945}=_0x174ed6[_0x1a9a22(0x15e)];let _0x5750ae=_0x5cbcc9+'\x20'+_0x4039e6+':\x20'+_0x2fb083[_0x1a9a22(0x16c)](_0x31e9f3);if(_0x54522f&&Object[_0x1a9a22(0x1fe)](_0x54522f)['length']>0x0){const _0x303137=Object[_0x1a9a22(0x1f6)](_0x54522f)[_0x1a9a22(0x202)](([_0x559c48,_0x129aac])=>_0x559c48+'='+JSON[_0x1a9a22(0x18c)](_0x129aac))[_0x1a9a22(0x1f7)](',\x20');_0x5750ae+='('+_0x303137+')';}_0x5db945&&(_0x5750ae+=_0x2fb083[_0x1a9a22(0x19f)]('\x20['+_0x5db945+']'));let _0x1094e1='';if(_0x174ed6[_0x1a9a22(0x15e)][_0x1a9a22(0x169)])_0x1094e1=_0x1a9a22(0x165)+_0x174ed6['tool_call']['targetKnowledgeBase'][_0x1a9a22(0x18d)];else{if(_0x174ed6[_0x1a9a22(0x15e)][_0x1a9a22(0x189)])_0x1094e1=_0x1a9a22(0x14f)+_0x174ed6[_0x1a9a22(0x15e)][_0x1a9a22(0x189)]['name'];else{if(_0x174ed6[_0x1a9a22(0x15e)][_0x1a9a22(0x156)])_0x1094e1='\x20->\x20WebSearch:'+_0x174ed6[_0x1a9a22(0x15e)][_0x1a9a22(0x156)][_0x1a9a22(0x18d)];else _0x174ed6['tool_call'][_0x1a9a22(0x192)]&&(_0x1094e1=_0x1a9a22(0x16b)+_0x174ed6[_0x1a9a22(0x15e)][_0x1a9a22(0x192)][_0x1a9a22(0x18d)]);}}return _0x5750ae+_0x1094e1;}if(_0x1a9a22(0x1ea)in _0x174ed6){const _0x48616d=_0x2fb083[_0x1a9a22(0x1ab)](_0x1a9a22(0x1e9)),{functionName:_0x3a5e49,functionArguments:_0x194b3e,content:_0x1a7a32,newChat:_0xa97d1e}=_0x174ed6[_0x1a9a22(0x1ea)];let _0x5f1275=_0x5cbcc9+'\x20'+_0x48616d+':\x20'+_0x2fb083[_0x1a9a22(0x16c)](_0x3a5e49);if(_0x194b3e){const _0x48c986=typeof _0x194b3e===_0x1a9a22(0x16f)?_0x194b3e:JSON[_0x1a9a22(0x18c)](_0x194b3e);_0x5f1275+='('+_0x48c986+')';}return _0x1a7a32&&(_0x5f1275+='\x0a'+_0x2fb083['dim'](_0x1a7a32)),_0xa97d1e&&(_0x5f1275+=_0x2fb083[_0x1a9a22(0x19f)](_0x1a9a22(0x1b8)+_0xa97d1e['id'])),_0x5f1275;}if('output'in _0x174ed6){const _0x2423b9=_0x2fb083[_0x1a9a22(0x1a2)](_0x1a9a22(0x207));return _0x5cbcc9+'\x20'+_0x2423b9+':\x20'+_0x174ed6['output'][_0x1a9a22(0x18d)]+'\x20('+_0x174ed6[_0x1a9a22(0x1b3)][_0x1a9a22(0x13c)]['length']+_0x1a9a22(0x1ae);}if(_0x1a9a22(0x1e6)in _0x174ed6){const _0x5f6fee=_0x2fb083[_0x1a9a22(0x1a2)](_0x1a9a22(0x171)),{width:_0x23780b,height:_0x379ec0,headerText:_0x16d9f1}=_0x174ed6[_0x1a9a22(0x1e6)],_0x141763=_0x16d9f1?_0x1a9a22(0x159)+_0x16d9f1:'';return _0x5cbcc9+'\x20'+_0x5f6fee+':\x20'+_0x23780b+'x'+_0x379ec0+_0x141763;}if(_0x1a9a22(0x1a8)in _0x174ed6){const _0x386530=_0x2fb083[_0x1a9a22(0x173)](_0x1a9a22(0x1b1));return _0x5cbcc9+'\x20'+_0x386530+':\x20'+_0x174ed6[_0x1a9a22(0x1a8)];}return _0x5cbcc9+'\x20'+_0x2fb083[_0x1a9a22(0x19f)]('[unknown]')+':\x20'+JSON[_0x1a9a22(0x18c)](_0x174ed6);}async function executeChatHistoryCommand(_0x4bd36f,_0x25f578){const _0x24bb80=a20_0x5db2,{options:_0x3d626d,args:_0x5828a8,tdx:_0x12f47e}=_0x4bd36f,_0x9d42cb=_0x5828a8[0x0],_0x587ade=_0x3d626d,_0x47f931=_0x587ade[_0x24bb80(0x1de)];try{if(_0x47f931&&_0x9d42cb)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console['error'](_0x24bb80(0x18e)+_0x25f578+_0x24bb80(0x1d4)),0x1;if(!_0x9d42cb&&!_0x47f931&&_0x3d626d[_0x24bb80(0x1bf)]!==undefined){const _0x3c9ff6=resolveLimit(_0x3d626d['limit'],DEFAULT_LLM_LIMIT),_0x3b84ed=await withSpinner(_0x24bb80(0x147),()=>_0x12f47e['llm'][_0x24bb80(0x1f3)](_0x3c9ff6),{'verbose':_0x3d626d[_0x24bb80(0x13e)]});return await handleSDKOutput(_0x3b84ed[_0x24bb80(0x14e)],_0x3d626d),0x0;}const _0x3bb20c=await getChatIdOrSelect(_0x12f47e,_0x3d626d,_0x47f931,_0x9d42cb);if(!_0x3bb20c)return 0x0;return await displayChatHistory(_0x3bb20c,_0x12f47e,_0x3d626d),0x0;}catch(_0xe94d18){return handleSDKError(_0xe94d18,_0x3d626d),0x1;}}async function displayChatHistory(_0x28738d,_0xb3c3d5,_0x1dab3b){const _0x567e07=a20_0x5db2,_0xea2ebd=await withSpinner(_0x567e07(0x191)+_0x28738d+'\x27...',()=>_0xb3c3d5['llm'][_0x567e07(0x1d9)](_0x28738d),{'verbose':_0x1dab3b[_0x567e07(0x13e)]}),_0x52c03b=_0xea2ebd[_0x567e07(0x14e)][_0x567e07(0x14e)]??[];if(_0x52c03b[_0x567e07(0x1ad)]===0x0){console[_0x567e07(0x139)](_0x567e07(0x128));return;}if(_0x1dab3b[_0x567e07(0x1bf)]!==undefined)await handleSDKOutput(_0x52c03b,_0x1dab3b);else{const _0x296ef6=_0x52c03b['map'](_0x4775e5=>formatChatHistoryEntry(_0x4775e5,_0x1dab3b)),_0x3beb61=_0x296ef6['join']('\x0a');await writeOutput(_0x3beb61,_0x1dab3b[_0x567e07(0x1b3)],_0x567e07(0x153));}}async function getChatIdOrSelect(_0x133c91,_0x108e00,_0x472f0f,_0x351d97){const _0x101106=a20_0x5db2;if(_0x351d97)return _0x351d97;if(_0x472f0f){const _0x26743f=await withSpinner(_0x101106(0x1c6),()=>_0x133c91['llm']['chats'](0x1),{'verbose':_0x108e00[_0x101106(0x13e)]});if(_0x26743f[_0x101106(0x14e)][_0x101106(0x1ad)]===0x0)return console[_0x101106(0x139)](_0x101106(0x175)),undefined;return _0x26743f[_0x101106(0x14e)][0x0]['id'];}const _0x5e82d8=await selectChatInteractively(_0x133c91,_0x108e00);if(!_0x5e82d8)return console['log'](_0x101106(0x206)),undefined;return _0x5e82d8;}async function getProjectIdOrDefault(_0x6f5fb1){const _0x1d0871=await getProjectWithName(_0x6f5fb1);return _0x1d0871['id'];}async function getProjectWithName(_0xa29cc9){const _0x321035=a20_0x5db2,{tdx:_0x222ec1,options:_0x4f1a49}=_0xa29cc9,_0x44f51f=_0x4f1a49[_0x321035(0x17c)];if(_0x44f51f){const _0x428a0e=await withSpinner(_0x321035(0x1af)+_0x44f51f+_0x321035(0x184),()=>_0x222ec1[_0x321035(0x152)]['resolveProjectId'](_0x44f51f),{'verbose':_0x4f1a49['verbose']});return{'id':_0x428a0e[_0x321035(0x14e)],'name':_0x44f51f};}const _0x40fc9c=_0x222ec1[_0x321035(0x152)][_0x321035(0x1cc)]();if(_0x40fc9c){const _0x1b7049=await _0x222ec1[_0x321035(0x152)][_0x321035(0x19a)](),_0x173a3c=_0x1b7049[_0x321035(0x161)](_0x674880=>_0x674880['id']===_0x40fc9c);return{'id':_0x40fc9c,'name':_0x173a3c?.[_0x321035(0x1c0)][_0x321035(0x18d)]||_0x321035(0x1fa)};}const _0x407ca0=await withSpinner(_0x321035(0x17d),()=>_0x222ec1['llm'][_0x321035(0x135)](),{'verbose':_0x4f1a49[_0x321035(0x13e)]});return{'id':_0x407ca0[_0x321035(0x14e)]['id'],'name':_0x407ca0[_0x321035(0x14e)]['attributes'][_0x321035(0x18d)]};}function toLLMProjectInfo(_0x1cd73e){const _0x5c30ca=a20_0x5db2;return{'name':_0x1cd73e[_0x5c30ca(0x1c0)][_0x5c30ca(0x18d)],'description':_0x1cd73e[_0x5c30ca(0x1c0)]['description'],'createdAt':_0x1cd73e[_0x5c30ca(0x1c0)][_0x5c30ca(0x1eb)],'updatedAt':_0x1cd73e[_0x5c30ca(0x1c0)][_0x5c30ca(0x154)]};}function toAgentInfo(_0x5e51a2){const _0x64b680=a20_0x5db2;return{'name':_0x5e51a2[_0x64b680(0x1c0)][_0x64b680(0x18d)],'description':_0x5e51a2[_0x64b680(0x1c0)]['description'],'prompt':truncatePrompt(_0x5e51a2[_0x64b680(0x1c0)]['prompt']),'createdAt':_0x5e51a2[_0x64b680(0x1c0)]['createdAt'],'updatedAt':_0x5e51a2['attributes'][_0x64b680(0x154)]};}function truncatePrompt(_0x32ad12){const _0x4ac472=a20_0x5db2;if(!_0x32ad12)return undefined;const _0x5a44c1=0x64;if(_0x32ad12[_0x4ac472(0x1ad)]<=_0x5a44c1)return _0x32ad12;return _0x32ad12[_0x4ac472(0x1df)](0x0,_0x5a44c1)+_0x4ac472(0x1d2);}export class LLMModelsCommand extends BaseCommand{['name']=a20_0x5836c8(0x158);['description']=a20_0x5836c8(0x1ba);async[a20_0x5836c8(0x18b)](_0x3eeb93){const _0x43a2c4=a20_0x5836c8,{options:_0x574944,tdx:_0x20a37e}=_0x3eeb93;try{const _0x1ad1a5=await withSpinner(_0x43a2c4(0x1c8),()=>_0x20a37e[_0x43a2c4(0x152)][_0x43a2c4(0x129)](),{'verbose':_0x574944[_0x43a2c4(0x13e)]});return await handleSDKOutput(_0x1ad1a5['data'],_0x574944),0x0;}catch(_0x532c0b){return handleSDKError(_0x532c0b,_0x574944),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x141);[a20_0x5836c8(0x1d3)]=a20_0x5836c8(0x164);async[a20_0x5836c8(0x18b)](_0x2211f6){const _0x515b12=a20_0x5836c8,{options:_0x5015da,args:_0x2c1628,tdx:_0x3b39cc}=_0x2211f6,_0x49f936=getChalk(_0x5015da),_0x2b7760=_0x5015da[_0x515b12(0x1c3)];try{const _0x392577=_0x2c1628[0x0],_0x562e8b=resolveLimit(_0x5015da[_0x515b12(0x149)],DEFAULT_LLM_LIMIT),_0x5b1239=await withSpinner(_0x515b12(0x1f4),()=>_0x3b39cc['llm'][_0x515b12(0x19a)](_0x562e8b),{'verbose':_0x5015da[_0x515b12(0x13e)]});let _0x56333a=_0x5b1239[_0x515b12(0x14e)];_0x392577&&(_0x56333a=_0x5b1239[_0x515b12(0x14e)][_0x515b12(0x203)](_0x47b740=>matchGlobPattern(_0x47b740[_0x515b12(0x1c0)][_0x515b12(0x18d)],_0x392577)));const _0x4591a9=_0x5015da[_0x515b12(0x1bf)]===_0x515b12(0x19e)||_0x5015da[_0x515b12(0x1bf)]===_0x515b12(0x1d8)||_0x5015da[_0x515b12(0x1bf)]===_0x515b12(0x153)||_0x5015da[_0x515b12(0x1bf)]===_0x515b12(0x182);if(_0x4591a9){const _0x2d1303=_0x56333a['map'](_0x12c743=>({...toLLMProjectInfo(_0x12c743),'url':getLLMProjectUrl(_0x2b7760,_0x12c743['id'])}));await handleSDKOutput(_0x2d1303,_0x5015da);}else{const _0x58f56f=[];if(_0x56333a['length']===0x0)_0x58f56f['push'](_0x49f936[_0x515b12(0x19f)]('No\x20projects\x20found'));else{const _0x3fc88a=[..._0x56333a]['sort']((_0xb2f8c3,_0x3ac55f)=>_0xb2f8c3[_0x515b12(0x1c0)][_0x515b12(0x18d)]['localeCompare'](_0x3ac55f[_0x515b12(0x1c0)][_0x515b12(0x18d)]));for(const _0x94111d of _0x3fc88a){const _0x5f098e=getLLMProjectUrl(_0x2b7760,_0x94111d['id']),_0x33e72c=hyperlink(_0x94111d[_0x515b12(0x1c0)][_0x515b12(0x18d)],_0x5f098e);_0x58f56f['push'](_0x515b12(0x197)+_0x33e72c);}_0x58f56f[_0x515b12(0x145)](_0x49f936[_0x515b12(0x19f)](_0x56333a[_0x515b12(0x1ad)]+_0x515b12(0x1d1)));}await writeOutput(_0x58f56f[_0x515b12(0x1f7)]('\x0a'),_0x5015da[_0x515b12(0x1b3)],_0x515b12(0x153));}return 0x0;}catch(_0x54465d){return handleSDKError(_0x54465d,_0x5015da),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x5836c8(0x18d)]='llm:agents';[a20_0x5836c8(0x1d3)]=a20_0x5836c8(0x17e);async['execute'](_0x4db187){const _0x54cfd0=a20_0x5836c8,{options:_0xd3bc08,args:_0x2527d4,tdx:_0x436c3e}=_0x4db187,_0x40fb10=getChalk(_0xd3bc08),_0x28e30d=_0xd3bc08['site'];try{const _0x3f601d=_0x2527d4[0x0];let _0x5b64b0=_0x3f601d,_0x48cf15,_0x1d6ac7;if(_0x3f601d&&_0x3f601d[_0x54cfd0(0x13f)]('/')){const _0x21de01=_0x3f601d[_0x54cfd0(0x12e)]('/');if(_0x21de01[_0x54cfd0(0x1ad)]===0x2){const [_0x374cb5,_0x38d89f]=_0x21de01,_0x25e5f3=await _0x436c3e['llm'][_0x54cfd0(0x19a)](),_0x290df9=_0x25e5f3[_0x54cfd0(0x161)](_0x55f1a5=>_0x55f1a5[_0x54cfd0(0x1c0)][_0x54cfd0(0x18d)]['toLowerCase']()===_0x374cb5[_0x54cfd0(0x1b7)]());if(!_0x290df9)throw new SDKError(ErrorCode[_0x54cfd0(0x14d)],_0x54cfd0(0x1c4)+_0x374cb5,undefined,{'helpText':_0x54cfd0(0x1f5)});_0x48cf15=_0x290df9['id'],_0x1d6ac7=_0x290df9['attributes'][_0x54cfd0(0x18d)],_0x5b64b0=_0x38d89f;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0x3f601d,undefined,{'helpText':_0x54cfd0(0x1f1)});}else{const _0x53df15=await getProjectWithName(_0x4db187);_0x48cf15=_0x53df15['id'],_0x1d6ac7=_0x53df15[_0x54cfd0(0x18d)];}const _0x58d5d8=await withSpinner(_0x54cfd0(0x13b),()=>_0x436c3e[_0x54cfd0(0x152)][_0x54cfd0(0x1c9)](_0x48cf15),{'verbose':_0xd3bc08[_0x54cfd0(0x13e)]});let _0x510088=_0x58d5d8[_0x54cfd0(0x14e)];_0x5b64b0&&(_0x510088=_0x58d5d8[_0x54cfd0(0x14e)][_0x54cfd0(0x203)](_0x58c101=>matchGlobPattern(_0x58c101[_0x54cfd0(0x1c0)][_0x54cfd0(0x18d)],_0x5b64b0)));const _0x5cf4e7=_0xd3bc08[_0x54cfd0(0x1bf)]===_0x54cfd0(0x19e)||_0xd3bc08[_0x54cfd0(0x1bf)]===_0x54cfd0(0x1d8)||_0xd3bc08[_0x54cfd0(0x1bf)]===_0x54cfd0(0x153)||_0xd3bc08[_0x54cfd0(0x1bf)]===_0x54cfd0(0x182);if(_0x5cf4e7){const _0x44751c=_0x510088[_0x54cfd0(0x202)](_0x17a7f0=>({...toAgentInfo(_0x17a7f0),'chatUrl':getLLMAgentChatUrl(_0x28e30d,_0x48cf15,_0x17a7f0['id'])}));await handleSDKOutput(_0x44751c,_0xd3bc08);}else{const _0x3ae694=[];_0x3ae694[_0x54cfd0(0x145)](_0x40fb10[_0x54cfd0(0x19f)]('['+_0x1d6ac7+']'));if(_0x510088[_0x54cfd0(0x1ad)]===0x0)_0x3ae694[_0x54cfd0(0x145)](_0x40fb10[_0x54cfd0(0x19f)](_0x54cfd0(0x1fc)));else{const _0x42c4ba=[..._0x510088][_0x54cfd0(0x1fb)]((_0x45eff6,_0xea5f05)=>_0x45eff6['attributes']['name'][_0x54cfd0(0x146)](_0xea5f05['attributes'][_0x54cfd0(0x18d)]));for(const _0x5cdeed of _0x42c4ba){const _0x11164f=getLLMAgentChatUrl(_0x28e30d,_0x48cf15,_0x5cdeed['id']),_0x3cb020=hyperlink(_0x5cdeed['attributes'][_0x54cfd0(0x18d)],_0x11164f);_0x3ae694[_0x54cfd0(0x145)](_0x54cfd0(0x180)+_0x3cb020);}_0x3ae694['push'](_0x40fb10[_0x54cfd0(0x19f)](_0x510088[_0x54cfd0(0x1ad)]+'\x20agent(s)'));}await writeOutput(_0x3ae694['join']('\x0a'),_0xd3bc08[_0x54cfd0(0x1b3)],_0x54cfd0(0x153));}return 0x0;}catch(_0x34943f){return handleSDKError(_0x34943f,_0xd3bc08),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x163);[a20_0x5836c8(0x1d3)]='Show\x20agent\x20details';async[a20_0x5836c8(0x18b)](_0x522aef){const _0x38017b=a20_0x5836c8,{options:_0x2e00d0,args:_0x3567e2,tdx:_0x299060}=_0x522aef;if(_0x3567e2[_0x38017b(0x1ad)]===0x0)return console[_0x38017b(0x1a8)](_0x38017b(0x16d)),console[_0x38017b(0x1a8)](_0x38017b(0x1bd)),0x1;const _0xe13850=_0x3567e2[0x0];try{const _0x117411=await getProjectIdOrDefault(_0x522aef),_0x35a191=await withSpinner(_0x38017b(0x1e2)+_0xe13850+'\x27...',()=>_0x299060[_0x38017b(0x152)][_0x38017b(0x187)](_0xe13850,_0x117411),{'verbose':_0x2e00d0['verbose']}),_0x2a75a3=await withSpinner(_0x38017b(0x1f8),()=>_0x299060[_0x38017b(0x152)][_0x38017b(0x13d)](_0x35a191[_0x38017b(0x14e)]),{'verbose':_0x2e00d0[_0x38017b(0x13e)]});return await handleSDKOutput([_0x2a75a3['data']],_0x2e00d0),0x0;}catch(_0x557236){return handleSDKError(_0x557236,_0x2e00d0),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x1a6);['description']=a20_0x5836c8(0x14c);async[a20_0x5836c8(0x18b)](_0x51b566){const _0x41739c=a20_0x5836c8,{options:_0x3192a4,args:_0x38bdf6,tdx:_0x18b58c}=_0x51b566;if(_0x38bdf6[_0x41739c(0x1ad)]===0x0)return console[_0x41739c(0x1a8)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x41739c(0x1a8)](_0x41739c(0x193)),console[_0x41739c(0x1a8)](_0x41739c(0x14b)),0x1;const _0x143b1a=_0x38bdf6[0x0],_0x405e48=_0x3192a4,_0x8a5b1f=_0x405e48['systemPrompt'],_0x243761=_0x405e48[_0x41739c(0x16e)]||_0x41739c(0x12d),_0x5f25ca=_0x405e48[_0x41739c(0x162)],_0x5839ab=_0x405e48[_0x41739c(0x208)]?Number(_0x405e48[_0x41739c(0x208)]):undefined,_0x5a74d3=_0x405e48[_0x41739c(0x166)]?Number(_0x405e48[_0x41739c(0x166)]):undefined;try{let _0xbef41d,_0x3fc877;if(_0x143b1a[_0x41739c(0x13f)]('/')){const _0x341636=_0x143b1a[_0x41739c(0x12e)]('/');if(_0x341636[_0x41739c(0x1ad)]===0x2){const [_0x1ced54,_0x3d896a]=_0x341636,_0x4e4c52=await withSpinner(_0x41739c(0x1af)+_0x1ced54+'\x27...',()=>_0x18b58c['llm'][_0x41739c(0x1aa)](_0x1ced54),{'verbose':_0x3192a4['verbose']});_0xbef41d=_0x4e4c52[_0x41739c(0x14e)],_0x3fc877=_0x3d896a;}else throw new SDKError(ErrorCode[_0x41739c(0x178)],'Invalid\x20path\x20syntax:\x20'+_0x143b1a,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0xbef41d=await getProjectIdOrDefault(_0x51b566),_0x3fc877=_0x143b1a;const _0x4d6d45=await withSpinner('Creating\x20agent\x20\x27'+_0x3fc877+_0x41739c(0x184),()=>_0x18b58c[_0x41739c(0x152)][_0x41739c(0x1f0)]({'name':_0x3fc877,'projectId':_0xbef41d,'modelType':_0x243761,'systemPrompt':_0x8a5b1f,'starterMessage':_0x5f25ca,'maxToolIterations':_0x5839ab,'temperature':_0x5a74d3}),{'verbose':_0x3192a4[_0x41739c(0x13e)]});return console[_0x41739c(0x139)](_0x41739c(0x18f)+_0x4d6d45['data']['id']),await handleSDKOutput([_0x4d6d45[_0x41739c(0x14e)]],_0x3192a4),0x0;}catch(_0xd37986){return handleSDKError(_0xd37986,_0x3192a4),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x201);[a20_0x5836c8(0x1d3)]=a20_0x5836c8(0x1c7);async['execute'](_0x1a81a5){const _0x1eb3d7=a20_0x5836c8,{options:_0x481b24,args:_0x16083d,tdx:_0x151307}=_0x1a81a5;if(_0x16083d['length']===0x0)return console[_0x1eb3d7(0x1a8)](_0x1eb3d7(0x16d)),console[_0x1eb3d7(0x1a8)](_0x1eb3d7(0x1f2)),0x1;const _0x22e8aa=_0x16083d[0x0],_0x46f7bc=_0x481b24,_0x5d49d1=_0x46f7bc[_0x1eb3d7(0x18d)],_0x30f838=_0x46f7bc[_0x1eb3d7(0x143)],_0x12a70a=_0x46f7bc[_0x1eb3d7(0x1d3)],_0x13d97a=_0x46f7bc[_0x1eb3d7(0x162)];if(!_0x5d49d1&&!_0x30f838&&!_0x12a70a&&!_0x13d97a)return console[_0x1eb3d7(0x1a8)]('Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required'),console[_0x1eb3d7(0x1a8)]('Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message'),0x1;try{const _0x37de60=await getProjectIdOrDefault(_0x1a81a5),_0x93bb9a=await withSpinner(_0x1eb3d7(0x1e2)+_0x22e8aa+_0x1eb3d7(0x184),()=>_0x151307[_0x1eb3d7(0x152)]['resolveAgentId'](_0x22e8aa,_0x37de60),{'verbose':_0x481b24['verbose']}),_0x1c49b6=_0x93bb9a['data'],_0x2127e5=await withSpinner('Updating\x20agent...',()=>_0x151307['llm'][_0x1eb3d7(0x138)](_0x1c49b6,{'name':_0x5d49d1,'prompt':_0x30f838,'description':_0x12a70a,'starterMessage':_0x13d97a}),{'verbose':_0x481b24[_0x1eb3d7(0x13e)]});return console['log']('Agent\x20updated:\x20'+_0x2127e5[_0x1eb3d7(0x14e)]['id']),await handleSDKOutput([_0x2127e5[_0x1eb3d7(0x14e)]],_0x481b24),0x0;}catch(_0xe27c9e){return handleSDKError(_0xe27c9e,_0x481b24),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x144);['description']=a20_0x5836c8(0x15a);async[a20_0x5836c8(0x18b)](_0x542bee){const _0x388a7e=a20_0x5836c8,{options:_0x467716,args:_0x5526b8,tdx:_0x281a3f}=_0x542bee;if(_0x5526b8['length']===0x0)return console['error'](_0x388a7e(0x16d)),console[_0x388a7e(0x1a8)](_0x388a7e(0x17b)),0x1;const _0x538b92=_0x5526b8[0x0];try{const _0x404cf3=await getProjectIdOrDefault(_0x542bee),_0x177a8f=await withSpinner(_0x388a7e(0x1e2)+_0x538b92+'\x27...',()=>_0x281a3f[_0x388a7e(0x152)][_0x388a7e(0x187)](_0x538b92,_0x404cf3),{'verbose':_0x467716['verbose']}),_0xc2d032=_0x177a8f['data'];return await withSpinner(_0x388a7e(0x136),()=>_0x281a3f[_0x388a7e(0x152)][_0x388a7e(0x1b2)](_0xc2d032),{'verbose':_0x467716['verbose']}),console[_0x388a7e(0x139)](_0x388a7e(0x168)+_0xc2d032),0x0;}catch(_0x49a729){return handleSDKError(_0x49a729,_0x467716),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']='llm:history';[a20_0x5836c8(0x1d3)]=a20_0x5836c8(0x1a4);async['execute'](_0xb0872c){return executeChatHistoryCommand(_0xb0872c,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{['name']=a20_0x5836c8(0x19b);[a20_0x5836c8(0x1d3)]=a20_0x5836c8(0x20a);async[a20_0x5836c8(0x18b)](_0x2fcdaa){const _0x5d8cb6=a20_0x5836c8,{options:_0x4feb8e,args:_0x5a5b2f,tdx:_0x447f32}=_0x2fcdaa;if(_0x5a5b2f[_0x5d8cb6(0x1ad)]===0x0)return console['error'](_0x5d8cb6(0x12b)),console[_0x5d8cb6(0x1a8)](_0x5d8cb6(0x1ff)),0x1;const _0x39c12c=_0x5a5b2f[0x0];try{return await withSpinner(_0x5d8cb6(0x1b6)+_0x39c12c+_0x5d8cb6(0x184),()=>_0x447f32['llm'][_0x5d8cb6(0x1c1)](_0x39c12c),{'verbose':_0x4feb8e[_0x5d8cb6(0x13e)]}),console[_0x5d8cb6(0x139)]('Project\x20context\x20set\x20to:\x20'+_0x39c12c),0x0;}catch(_0x91b92c){return handleSDKError(_0x91b92c,_0x4feb8e),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x188);[a20_0x5836c8(0x1d3)]='Create\x20a\x20new\x20LLM\x20project';async['execute'](_0x5af631){const _0x1e39c4=a20_0x5836c8,{options:_0xb8f583,args:_0xbe6009,tdx:_0x1412cc}=_0x5af631;if(_0xbe6009[_0x1e39c4(0x1ad)]===0x0)return console[_0x1e39c4(0x1a8)](_0x1e39c4(0x12b)),console['error']('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0xaa8d66=_0xbe6009[0x0],_0x1894ef=_0xb8f583,_0xa20fcc=_0x1894ef[_0x1e39c4(0x1d3)];try{const _0x4ddfca=await withSpinner(_0x1e39c4(0x160)+_0xaa8d66+_0x1e39c4(0x184),()=>_0x1412cc[_0x1e39c4(0x152)]['createProject']({'name':_0xaa8d66,'description':_0xa20fcc}),{'verbose':_0xb8f583[_0x1e39c4(0x13e)]});console[_0x1e39c4(0x139)](_0x1e39c4(0x142)+_0x4ddfca['data']['id']);const _0x5b8c56=toLLMProjectInfo(_0x4ddfca[_0x1e39c4(0x14e)]);return await handleSDKOutput([_0x5b8c56],_0xb8f583),0x0;}catch(_0x26527a){return handleSDKError(_0x26527a,_0xb8f583),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{['name']=a20_0x5836c8(0x1db);[a20_0x5836c8(0x1d3)]=a20_0x5836c8(0x1cf);async[a20_0x5836c8(0x18b)](_0x42e76f){const _0x2413f8=a20_0x5836c8,{options:_0x392d78,args:_0x252e2c,tdx:_0x31ce91}=_0x42e76f;if(_0x252e2c['length']===0x0)return console[_0x2413f8(0x1a8)](_0x2413f8(0x12b)),console[_0x2413f8(0x1a8)](_0x2413f8(0x1d5)),0x1;const _0x4019bd=_0x252e2c[0x0];try{return await withSpinner('Deleting\x20project\x20\x27'+_0x4019bd+'\x27...',()=>_0x31ce91[_0x2413f8(0x152)]['deleteProject'](_0x4019bd),{'verbose':_0x392d78[_0x2413f8(0x13e)]}),console[_0x2413f8(0x139)]('Project\x20deleted:\x20'+_0x4019bd),0x0;}catch(_0x45cb25){return handleSDKError(_0x45cb25,_0x392d78),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x205);[a20_0x5836c8(0x1d3)]='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)';async[a20_0x5836c8(0x18b)](_0x26d226){const _0x31457a=a20_0x5836c8,{options:_0x21461d,args:_0x2feae1,tdx:_0x45cada}=_0x26d226,_0x1e1c48=getChalk(_0x21461d);console[_0x31457a(0x139)](_0x1e1c48[_0x31457a(0x1c5)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x31457a(0x139)](_0x1e1c48[_0x31457a(0x1c5)](_0x31457a(0x177))),console[_0x31457a(0x139)](_0x1e1c48['dim'](_0x31457a(0x1ee))),console[_0x31457a(0x139)]();if(_0x2feae1[_0x31457a(0x1ad)]===0x0)return console[_0x31457a(0x1a8)](_0x31457a(0x12b)),console[_0x31457a(0x1a8)](_0x31457a(0x1ec)),0x1;const _0x384843=_0x2feae1[0x0],_0x40142c=_0x21461d,_0x136d27=_0x40142c[_0x31457a(0x1b3)],_0x14f346=_0x40142c['dryRun'];try{const _0x228961=_0x136d27||_0x384843+_0x31457a(0x15f);if(a20_0x467943[_0x31457a(0x181)](_0x228961)&&!_0x14f346){if(!_0x21461d[_0x31457a(0x1e5)]){const _0x28ff1e=await confirm(_0x31457a(0x12a)+_0x228961+_0x31457a(0x150));if(!_0x28ff1e)return console[_0x31457a(0x139)](_0x31457a(0x133)),0x0;}a20_0x467943[_0x31457a(0x186)](_0x228961,{'recursive':!![]});}const _0x251e5d=await withSpinner(_0x14f346?_0x31457a(0x1b5)+_0x384843+_0x31457a(0x184):'Backing\x20up\x20project\x20\x27'+_0x384843+_0x31457a(0x184),()=>_0x45cada[_0x31457a(0x152)][_0x31457a(0x155)](_0x384843,_0x136d27,{'dryRun':_0x14f346}),{'verbose':_0x21461d[_0x31457a(0x13e)]}),_0x5973b1=_0x251e5d['data'];return _0x14f346?console['log'](_0x31457a(0x157)+_0x5973b1[_0x31457a(0x1b9)]):console['log'](_0x31457a(0x1e7)+_0x5973b1[_0x31457a(0x1b9)]),console[_0x31457a(0x139)]('\x20\x20Agents:\x20'+_0x5973b1['counts'][_0x31457a(0x1c9)]),console[_0x31457a(0x139)](_0x31457a(0x1b4)+_0x5973b1[_0x31457a(0x195)][_0x31457a(0x14a)]),console['log'](_0x31457a(0x1dc)+_0x5973b1['counts'][_0x31457a(0x1a7)]),console[_0x31457a(0x139)](_0x31457a(0x179)+_0x5973b1[_0x31457a(0x195)]['integrations']),(_0x21461d[_0x31457a(0x1bf)]==='json'||_0x21461d[_0x31457a(0x1bf)]===_0x31457a(0x1d8))&&await handleSDKOutput([_0x5973b1],_0x21461d),0x0;}catch(_0x2f2fff){return handleSDKError(_0x2f2fff,_0x21461d),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x5836c8(0x18d)]=a20_0x5836c8(0x1ce);[a20_0x5836c8(0x1d3)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a20_0x5836c8(0x18b)](_0xeb2b9){const _0x5060d4=a20_0x5836c8,{options:_0x199389,args:_0x27e357,tdx:_0x127f96}=_0xeb2b9,_0x18b001=getChalk(_0x199389);console['log'](_0x18b001[_0x5060d4(0x1c5)](_0x5060d4(0x18a))),console['log'](_0x18b001[_0x5060d4(0x1c5)](_0x5060d4(0x198))),console[_0x5060d4(0x139)](_0x18b001['dim'](_0x5060d4(0x204))),console['log'](_0x18b001[_0x5060d4(0x19f)]('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console[_0x5060d4(0x139)](_0x18b001[_0x5060d4(0x19f)](_0x5060d4(0x19d))),console['log']();if(_0x27e357[_0x5060d4(0x1ad)]===0x0)return console[_0x5060d4(0x1a8)](_0x5060d4(0x200)),console[_0x5060d4(0x1a8)](_0x5060d4(0x127)),0x1;const _0xeab158=_0x27e357[0x0],_0x598a69=_0x199389,_0xbfae93=_0x598a69['name'],_0x259354=_0x598a69['dryRun'];try{if(!_0x259354){const _0x264dbf=_0x127f96[_0x5060d4(0x152)][_0x5060d4(0x190)](_0xeab158),_0x456bbd=_0xbfae93||_0x264dbf[_0x5060d4(0x1cb)][_0x5060d4(0x137)],_0x18114d=await withSpinner(_0x5060d4(0x1c2),()=>_0x127f96[_0x5060d4(0x152)][_0x5060d4(0x19a)](),{'verbose':_0x199389['verbose']}),_0x1ac556=_0x18114d[_0x5060d4(0x14e)][_0x5060d4(0x161)](_0xa7afb=>_0xa7afb[_0x5060d4(0x1c0)][_0x5060d4(0x18d)]===_0x456bbd);if(_0x1ac556&&!_0x199389[_0x5060d4(0x1e5)]){const _0x218551=await confirm(_0x5060d4(0x1dd)+_0x456bbd+_0x5060d4(0x1bc));if(!_0x218551)return console[_0x5060d4(0x139)]('Restore\x20cancelled.'),0x0;}}const _0x49a660=await withSpinner(_0x259354?'Validating\x20backup\x20from\x20\x27'+_0xeab158+_0x5060d4(0x184):'Restoring\x20project\x20from\x20\x27'+_0xeab158+_0x5060d4(0x184),()=>_0x127f96[_0x5060d4(0x152)][_0x5060d4(0x148)](_0xeab158,{'name':_0xbfae93,'dryRun':_0x259354}),{'verbose':_0x199389['verbose']}),_0x3df933=_0x49a660['data'];return _0x3df933['sourceSite']&&console[_0x5060d4(0x139)](_0x5060d4(0x126)+_0x3df933[_0x5060d4(0x1a5)]+'\x27'),_0x259354?console[_0x5060d4(0x139)](_0x5060d4(0x183)+_0x3df933[_0x5060d4(0x137)]):console[_0x5060d4(0x139)](_0x5060d4(0x15c)+_0x3df933[_0x5060d4(0x137)]+'\x20('+_0x3df933[_0x5060d4(0x17a)]+')'),console[_0x5060d4(0x139)](_0x5060d4(0x15b)+_0x3df933[_0x5060d4(0x195)]['agents']),console[_0x5060d4(0x139)](_0x5060d4(0x1b4)+_0x3df933[_0x5060d4(0x195)][_0x5060d4(0x14a)]),console['log'](_0x5060d4(0x1dc)+_0x3df933[_0x5060d4(0x195)][_0x5060d4(0x1a7)]),console['log'](_0x5060d4(0x179)+_0x3df933['counts']['integrations']),(_0x199389['format']==='json'||_0x199389['format']===_0x5060d4(0x1d8))&&await handleSDKOutput([_0x3df933],_0x199389),0x0;}catch(_0x1dd153){return handleSDKError(_0x1dd153,_0x199389),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x40ec51,_0xaec360){const _0x3a9f93=a20_0x5836c8,_0x4a983b=_0xaec360['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x3df0bb=0x0,_0x494595=[];const _0x6df00b=(await import(_0x3a9f93(0x1a7)))[_0x3a9f93(0x172)],_0x1b25e0=getChalk(_0xaec360);while(!![]){const _0x5f08cd=await withSpinner(_0x3a9f93(0x147),()=>_0x40ec51[_0x3a9f93(0x152)][_0x3a9f93(0x1f3)](_0x4a983b+_0x3df0bb),{'verbose':_0xaec360[_0x3a9f93(0x13e)]});_0x494595=_0x5f08cd[_0x3a9f93(0x14e)];const _0x5c578d=_0x494595['slice'](_0x3df0bb,_0x3df0bb+_0x4a983b),_0xc25cce=_0x494595[_0x3a9f93(0x1ad)]>_0x3df0bb+_0x4a983b,_0x4fe191=[...new Set(_0x5c578d[_0x3a9f93(0x202)](_0x1239b4=>_0x1239b4[_0x3a9f93(0x1c0)]['agentId'])['filter'](_0x139b0e=>_0x139b0e!==undefined))],_0x5c9f62=new Map();await Promise[_0x3a9f93(0x1a1)](_0x4fe191[_0x3a9f93(0x202)](async _0x5175c4=>{const _0xa3ca35=_0x3a9f93;try{const _0x288bfc=await _0x40ec51['llm'][_0xa3ca35(0x13d)](_0x5175c4);_0x5c9f62[_0xa3ca35(0x132)](_0x5175c4,_0x288bfc[_0xa3ca35(0x1c0)][_0xa3ca35(0x18d)]);}catch{_0x5c9f62[_0xa3ca35(0x132)](_0x5175c4,_0x5175c4);}}));const _0x26ddca=_0x5c578d[_0x3a9f93(0x202)](_0x56484c=>{const _0x38d4c3=_0x3a9f93,_0x25fd7e=_0x56484c['attributes']['firstInputContent']||_0x38d4c3(0x1bb),_0x157701=_0x25fd7e['split']('\x0a')[0x0],_0x8e331=_0x157701[_0x38d4c3(0x1ad)]>0x50?_0x157701[_0x38d4c3(0x209)](0x0,0x4d)+_0x38d4c3(0x1d2):_0x157701,_0x2f7411=_0x56484c[_0x38d4c3(0x1c0)]['agentId']?_0x5c9f62['get'](_0x56484c[_0x38d4c3(0x1c0)][_0x38d4c3(0x1d6)])||_0x56484c[_0x38d4c3(0x1c0)][_0x38d4c3(0x1d6)]:_0x38d4c3(0x1ed),_0x51e68f=_0x56484c[_0x38d4c3(0x1c0)][_0x38d4c3(0x1a0)]||_0x56484c['attributes'][_0x38d4c3(0x154)],_0x292257=new Date(_0x51e68f),_0x234a98=new Date(),_0x220270=_0x234a98['getTime']()-_0x292257[_0x38d4c3(0x170)](),_0x13c1f3=Math[_0x38d4c3(0x131)](_0x220270/0xea60),_0x2f6b6a=Math[_0x38d4c3(0x131)](_0x220270/0x36ee80),_0x5d1165=Math[_0x38d4c3(0x131)](_0x220270/0x5265c00);let _0x329c9c;if(_0x13c1f3<0x1)_0x329c9c=_0x38d4c3(0x167);else{if(_0x13c1f3<0x3c)_0x329c9c=_0x13c1f3+_0x38d4c3(0x1ac);else{if(_0x2f6b6a<0x18)_0x329c9c=_0x2f6b6a+_0x38d4c3(0x1cd);else _0x5d1165<0x7?_0x329c9c=_0x5d1165+_0x38d4c3(0x1fd):_0x329c9c=_0x292257[_0x38d4c3(0x1f9)](_0x38d4c3(0x199),{'month':_0x38d4c3(0x151),'day':_0x38d4c3(0x185)});}}return{'title':_0x8e331+'\x20'+_0x1b25e0[_0x38d4c3(0x19f)]('['+_0x2f7411+']\x20'+_0x329c9c),'value':_0x56484c['id']};});_0xc25cce&&_0x26ddca['push']({'title':_0x1b25e0[_0x3a9f93(0x1e3)](_0x3a9f93(0x134)),'value':_0x3a9f93(0x140)});const _0x59b0cc=await _0x6df00b({'type':_0x3a9f93(0x12f),'name':_0x3a9f93(0x194),'message':'Select\x20a\x20chat\x20session:','choices':_0x26ddca,'hint':_0x3a9f93(0x19c)});if(!_0x59b0cc[_0x3a9f93(0x194)])return undefined;if(_0x59b0cc[_0x3a9f93(0x194)]==='__load_more__'){_0x3df0bb+=_0x4a983b;continue;}return _0x59b0cc['chatId'];}}export class ChatsCommand extends BaseCommand{['name']='chats';['description']=a20_0x5836c8(0x1ef);async[a20_0x5836c8(0x18b)](_0x52e7c9){const _0x2f95ec=a20_0x5836c8;return executeChatHistoryCommand(_0x52e7c9,_0x2f95ec(0x1e8));}}export class LLMLogCommand extends BaseCommand{['name']=a20_0x5836c8(0x15d);[a20_0x5836c8(0x1d3)]='Show\x20chat\x20log';async[a20_0x5836c8(0x18b)](_0x388f63){const _0x9a245a=a20_0x5836c8,{options:_0x5c7c83,args:_0x32ee8c,tdx:_0x37b14a}=_0x388f63,_0x5be604=_0x32ee8c[0x0];if(!_0x5be604)return console['error'](_0x9a245a(0x1e0)),console['error'](_0x9a245a(0x174)),0x1;const _0x41c7ca=await withSpinner(_0x9a245a(0x130)+_0x5be604+'\x27...',()=>_0x37b14a[_0x9a245a(0x152)]['getChatLog'](_0x5be604),{'verbose':_0x5c7c83[_0x9a245a(0x13e)]});return await handleSDKOutput(_0x41c7ca['data']['data'],_0x5c7c83),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a21_0x440f(){const _0x49b0cb=['TDX_API_KEY','profile','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','execute','123297VlseTR','4492720LNFTKC','context','mcp','933969OjoUcb','site','1599644hAaWNH','TDX_SITE','MCP\x20server\x20error:\x20','name','../mcp/server.js','960dfEpqB','8MpFtjO','2827485BzaHdu','TDX_PROFILE','32711cctLrz','description','2612160PnvujC','apiKey'];a21_0x440f=function(){return _0x49b0cb;};return a21_0x440f();}const a21_0x1d9352=a21_0x54e7;(function(_0x3092a3,_0x20e3eb){const _0x1e79f8=a21_0x54e7,_0xd55d3f=_0x3092a3();while(!![]){try{const _0x38259c=-parseInt(_0x1e79f8(0x89))/0x1+-parseInt(_0x1e79f8(0x8f))/0x2+-parseInt(_0x1e79f8(0x8d))/0x3*(-parseInt(_0x1e79f8(0x7e))/0x4)+parseInt(_0x1e79f8(0x8a))/0x5+parseInt(_0x1e79f8(0x7d))/0x6*(-parseInt(_0x1e79f8(0x81))/0x7)+parseInt(_0x1e79f8(0x83))/0x8+parseInt(_0x1e79f8(0x7f))/0x9;if(_0x38259c===_0x20e3eb)break;else _0xd55d3f['push'](_0xd55d3f['shift']());}catch(_0x3f52f5){_0xd55d3f['push'](_0xd55d3f['shift']());}}}(a21_0x440f,0x77e44));import{BaseCommand}from'./command.js';function a21_0x54e7(_0x2d4783,_0xc0fb7b){_0x2d4783=_0x2d4783-0x7d;const _0x440fde=a21_0x440f();let _0x54e77b=_0x440fde[_0x2d4783];return _0x54e77b;}export class MCPCommand extends BaseCommand{[a21_0x1d9352(0x92)]=a21_0x1d9352(0x8c);[a21_0x1d9352(0x82)]=a21_0x1d9352(0x87);async[a21_0x1d9352(0x88)](_0xac6547){const _0x1c2c05=a21_0x1d9352,{tdx:_0x585aad}=_0xac6547,_0x36fac4={};if(process.env.TDX_PROFILE)_0x36fac4[_0x1c2c05(0x80)]=process.env.TDX_PROFILE;else{if(process.env.TDX_API_KEY)_0x36fac4[_0x1c2c05(0x85)]=process.env.TDX_API_KEY,process.env.TDX_SITE&&(_0x36fac4[_0x1c2c05(0x90)]=process.env.TDX_SITE);else _0x585aad['context'][_0x1c2c05(0x84)]&&(_0x36fac4[_0x1c2c05(0x85)]=_0x585aad[_0x1c2c05(0x8b)][_0x1c2c05(0x84)],_0x36fac4[_0x1c2c05(0x90)]=_0x585aad[_0x1c2c05(0x8b)][_0x1c2c05(0x8e)]);}_0x585aad['context'][_0x1c2c05(0x86)]&&(_0x36fac4[_0x1c2c05(0x80)]=_0x585aad[_0x1c2c05(0x8b)][_0x1c2c05(0x86)]);try{const {startMCPServer:_0xba4f31}=await import(_0x1c2c05(0x93));return await _0xba4f31({'env':_0x36fac4}),0x0;}catch(_0x1007f8){const _0x375e64=_0x1007f8 instanceof Error?_0x1007f8['message']:String(_0x1007f8);return console['error'](_0x1c2c05(0x91)+_0x375e64),0x1;}}}
|