@treasuredata/tdx 0.12.1 → 0.13.0
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.d.ts +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.d.ts.map +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-command.js.map +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/engage-command.js.map +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/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.d.ts +50 -0
- package/dist/commands/profile-command.d.ts.map +1 -0
- package/dist/commands/profile-command.js +1 -0
- package/dist/commands/profile-command.js.map +1 -0
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-use-command.js.map +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/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.d.ts.map +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/commands/workflow-command.js.map +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/command-output.js.map +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.d.ts +7 -0
- package/dist/core/profile.d.ts.map +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/profile.js.map +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/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/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/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.d.ts +19 -0
- package/dist/sdk/client/endpoints.d.ts.map +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/endpoints.js.map +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.d.ts.map +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/client/workflow-client.js.map +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-aliases.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/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/types/workflow.d.ts +6 -0
- package/dist/sdk/types/workflow.d.ts.map +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.d.ts +11 -0
- package/dist/sdk/util/formatters.d.ts.map +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/formatters.js.map +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.d.ts.map +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/index.js.map +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/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/json-loader.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 +2 -3
- package/LICENSE +0 -190
- package/dist/commands/context-command.d.ts +0 -15
- package/dist/commands/context-command.d.ts.map +0 -1
- package/dist/commands/context-command.js +0 -1
- package/dist/commands/context-command.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a17_0xbf8c15=a17_0x440a;(function(_0x20f769,_0x53f328){const _0xfd4cb2=a17_0x440a,_0x32d3a7=_0x20f769();while(!![]){try{const _0x31a12d=parseInt(_0xfd4cb2(0x1f2))/0x1*(parseInt(_0xfd4cb2(0x200))/0x2)+parseInt(_0xfd4cb2(0x1f1))/0x3+parseInt(_0xfd4cb2(0x1f8))/0x4*(parseInt(_0xfd4cb2(0x1b3))/0x5)+parseInt(_0xfd4cb2(0x1b9))/0x6*(parseInt(_0xfd4cb2(0x1dd))/0x7)+parseInt(_0xfd4cb2(0x1c5))/0x8*(parseInt(_0xfd4cb2(0x1d0))/0x9)+-parseInt(_0xfd4cb2(0x1e6))/0xa*(-parseInt(_0xfd4cb2(0x1cf))/0xb)+-parseInt(_0xfd4cb2(0x1d4))/0xc;if(_0x31a12d===_0x53f328)break;else _0x32d3a7['push'](_0x32d3a7['shift']());}catch(_0x47a981){_0x32d3a7['push'](_0x32d3a7['shift']());}}}(a17_0x2730,0xefeaf));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';function a17_0x2730(){const _0x443d31=['Error:\x20Job\x20ID\x20is\x20required','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','start_at','Database:\x20','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','2989455neGxoM','89srKDFz','cause','jobs','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','\x20\x20Cause:\x20','Usage:\x20job\x20result\x20<job-id>','22028KkTppR','status','Kill\x20a\x20job','created_at','Query:\x20','query','yes','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','41286bCLfnP','end_at','kill','information_schema','getTime','1115rrKBMI','Job\x20type:\x20','execute','Error:\x20','\x20jobs','database','6AiWXMr','job:submit','data','Submitting\x20job...','Getting\x20job\x20results...','message','Getting\x20job\x20details...','\x27\x20to\x20verify\x20the\x20job\x20status','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Listing\x20jobs...','trino','Get\x20job\x20results','24VlDyFo','job_id','description','jobType','limit','round','hive','Limit:\x20','job:show','name','1939619KzeDrw','962487rYCcpx','error','type','\x20job','66055248UZqoyk','Submitting\x20kill\x20request...','Usage:\x20job\x20kill\x20<job-id>','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','map','verbose','submit','✔\x20Found\x20','List\x20jobs','3624208EmrxnZ','length','\x20row','Error:\x20Query\x20is\x20required','debug','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','show','job:result','Cancelled','90wYGqjH','user_name','job:kill','url','result','priority'];a17_0x2730=function(){return _0x443d31;};return a17_0x2730();}function a17_0x440a(_0x527a68,_0x2d67e5){_0x527a68=_0x527a68-0x1af;const _0x273089=a17_0x2730();let _0x440aa6=_0x273089[_0x527a68];return _0x440aa6;}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_0xbf8c15(0x1ce)]='jobs';[a17_0xbf8c15(0x1c7)]=a17_0xbf8c15(0x1dc);async[a17_0xbf8c15(0x1b5)](_0x181ae4){const _0x5eafee=a17_0xbf8c15,{options:_0x55463a,tdx:_0x10a4b2}=_0x181ae4;try{const _0x4fe98a=resolveLimit(_0x55463a[_0x5eafee(0x1c9)],DEFAULT_DISPLAY_LIMIT),_0x2aa79c=_0x55463a[_0x5eafee(0x1f9)];_0x55463a[_0x5eafee(0x1d9)]&&(console[_0x5eafee(0x1d1)](_0x5eafee(0x1cc)+_0x4fe98a+_0x5eafee(0x1b7)),_0x2aa79c&&console[_0x5eafee(0x1d1)]('Status\x20filter:\x20'+_0x2aa79c));const _0x5abce7=await withSpinner(_0x5eafee(0x1c2),()=>_0x10a4b2[_0x5eafee(0x1f4)]['list']({'from':0x0,'to':_0x4fe98a-0x1,'status':_0x2aa79c}),{'verbose':_0x55463a['verbose']}),_0x2e0566=_0x5abce7[_0x5eafee(0x1bb)];console[_0x5eafee(0x1d1)](_0x5eafee(0x1db)+_0x2e0566[_0x5eafee(0x1de)]+_0x5eafee(0x1d3)+(_0x2e0566[_0x5eafee(0x1de)]!==0x1?'s':''));const _0x5341ce=_0x2e0566[_0x5eafee(0x1d8)](_0xefae4a=>{const _0x2e0521=_0x5eafee;let _0x2a9201;if(_0xefae4a[_0x2e0521(0x1ee)]&&_0xefae4a[_0x2e0521(0x1af)]){const _0x3629ae=new Date(_0xefae4a[_0x2e0521(0x1ee)])[_0x2e0521(0x1b2)](),_0xa0fd96=new Date(_0xefae4a['end_at'])['getTime']();_0x2a9201=Math[_0x2e0521(0x1ca)]((_0xa0fd96-_0x3629ae)/0x3e8);}return{'job_id':_0xefae4a['job_id'],'type':_0xefae4a[_0x2e0521(0x1d2)],'status':_0xefae4a[_0x2e0521(0x1f9)],'user_name':_0xefae4a[_0x2e0521(0x1e7)],'duration_sec':_0x2a9201,'created_at':_0xefae4a[_0x2e0521(0x1fb)],'started_at':_0xefae4a[_0x2e0521(0x1ee)],'end_at':_0xefae4a[_0x2e0521(0x1af)]};});return await handleSDKOutput(_0x5341ce,_0x55463a),0x0;}catch(_0x4cdfcf){if(_0x4cdfcf instanceof SDKError)return console[_0x5eafee(0x1d1)]('Error:\x20'+_0x4cdfcf[_0x5eafee(0x1be)]),_0x4cdfcf['cause']&&console[_0x5eafee(0x1d1)]('\x20\x20Cause:\x20'+_0x4cdfcf[_0x5eafee(0x1f3)]),0x1;throw _0x4cdfcf;}}}export class JobShowCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]=a17_0xbf8c15(0x1cd);[a17_0xbf8c15(0x1c7)]='Show\x20job\x20details';async[a17_0xbf8c15(0x1b5)](_0x2036c5){const _0x2aaf08=a17_0xbf8c15,{options:_0x7b710a,args:_0x129dd1,tdx:_0x2ecfb4}=_0x2036c5,_0x1a70bd=_0x129dd1[0x0];if(!_0x1a70bd)return console['error'](_0x2aaf08(0x1ec)),console[_0x2aaf08(0x1d1)]('Usage:\x20job\x20show\x20<job-id>'),0x1;try{const _0x1a1ec6=await withSpinner(_0x2aaf08(0x1bf),()=>_0x2ecfb4[_0x2aaf08(0x1f4)][_0x2aaf08(0x1e3)](_0x1a70bd),{'verbose':_0x7b710a['verbose']}),_0x2dc9bf=_0x1a1ec6[_0x2aaf08(0x1bb)];let _0x2994ed;if(_0x2dc9bf[_0x2aaf08(0x1ee)]&&_0x2dc9bf[_0x2aaf08(0x1af)]){const _0x1d522a=new Date(_0x2dc9bf[_0x2aaf08(0x1ee)])['getTime'](),_0x213a01=new Date(_0x2dc9bf[_0x2aaf08(0x1af)])[_0x2aaf08(0x1b2)]();_0x2994ed=Math[_0x2aaf08(0x1ca)]((_0x213a01-_0x1d522a)/0x3e8);}const _0x312af2={'job_id':_0x2dc9bf[_0x2aaf08(0x1c6)],'type':_0x2dc9bf[_0x2aaf08(0x1d2)],'status':_0x2dc9bf[_0x2aaf08(0x1f9)],..._0x2dc9bf['user_name']&&{'user_name':_0x2dc9bf['user_name']},..._0x2994ed!==undefined&&{'duration_sec':_0x2994ed},..._0x2dc9bf[_0x2aaf08(0x1fb)]&&{'created_at':_0x2dc9bf[_0x2aaf08(0x1fb)]},..._0x2dc9bf['start_at']&&{'started_at':_0x2dc9bf[_0x2aaf08(0x1ee)]},..._0x2dc9bf[_0x2aaf08(0x1af)]&&{'end_at':_0x2dc9bf['end_at']},..._0x2dc9bf[_0x2aaf08(0x1b8)]&&{'database':_0x2dc9bf[_0x2aaf08(0x1b8)]},..._0x2dc9bf[_0x2aaf08(0x1eb)]!==undefined&&{'priority':_0x2dc9bf[_0x2aaf08(0x1eb)]},..._0x2dc9bf[_0x2aaf08(0x1e9)]&&{'url':_0x2dc9bf[_0x2aaf08(0x1e9)]},..._0x2dc9bf[_0x2aaf08(0x1fd)]&&{'query':_0x2dc9bf[_0x2aaf08(0x1fd)]},..._0x2dc9bf[_0x2aaf08(0x1e1)]&&{'debug':_0x2dc9bf['debug']}};return await handleSingleObjectOutput(_0x312af2,_0x7b710a),0x0;}catch(_0x2ab33c){if(_0x2ab33c instanceof SDKError)return console['error']('Error:\x20'+_0x2ab33c[_0x2aaf08(0x1be)]),_0x2ab33c[_0x2aaf08(0x1f3)]&&console[_0x2aaf08(0x1d1)](_0x2aaf08(0x1f6)+_0x2ab33c[_0x2aaf08(0x1f3)]),0x1;throw _0x2ab33c;}}}export class JobKillCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]=a17_0xbf8c15(0x1e8);['description']=a17_0xbf8c15(0x1fa);async[a17_0xbf8c15(0x1b5)](_0x1e19b9){const _0x431d87=a17_0xbf8c15,{options:_0x4db594,args:_0x11e838,tdx:_0x2d2c91}=_0x1e19b9,_0x3511e7=_0x11e838[0x0];if(!_0x3511e7)return console[_0x431d87(0x1d1)](_0x431d87(0x1ec)),console[_0x431d87(0x1d1)](_0x431d87(0x1d6)),0x1;try{if(!_0x4db594[_0x431d87(0x1fe)]){const _0x4130d2=await confirm(_0x431d87(0x1f5)+_0x3511e7+'?');if(!_0x4130d2)return console['error'](_0x431d87(0x1e5)),0x0;}return await withSpinner(_0x431d87(0x1d5),()=>_0x2d2c91[_0x431d87(0x1f4)][_0x431d87(0x1b0)](_0x3511e7),{'verbose':_0x4db594[_0x431d87(0x1d9)]}),console[_0x431d87(0x1d1)](_0x431d87(0x1e2)+_0x3511e7),console[_0x431d87(0x1d1)]('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x3511e7+_0x431d87(0x1c0)),0x0;}catch(_0x4b5a34){if(_0x4b5a34 instanceof SDKError)return console[_0x431d87(0x1d1)](_0x431d87(0x1b6)+_0x4b5a34[_0x431d87(0x1be)]),_0x4b5a34['cause']&&console[_0x431d87(0x1d1)](_0x431d87(0x1f6)+_0x4b5a34[_0x431d87(0x1f3)]),0x1;throw _0x4b5a34;}}}export class JobSubmitCommand extends BaseCommand{['name']=a17_0xbf8c15(0x1ba);[a17_0xbf8c15(0x1c7)]='Submit\x20a\x20job';async[a17_0xbf8c15(0x1b5)](_0x34dc83){const _0x239c4e=a17_0xbf8c15,{options:_0x5eb626,args:_0x335e5d,tdx:_0x3cd503}=_0x34dc83;try{const _0x3e8c61=_0x5eb626[_0x239c4e(0x1c8)]||_0x239c4e(0x1c3),_0x3f4ab0=_0x5eb626['file'],_0x55e2e9=_0x5eb626[_0x239c4e(0x1b8)]||_0x239c4e(0x1b1);if(_0x3e8c61!==_0x239c4e(0x1c3)&&_0x3e8c61!==_0x239c4e(0x1cb))return console[_0x239c4e(0x1d1)](_0x239c4e(0x1f0)),0x1;let _0x128a8f;if(_0x3f4ab0){if(_0x335e5d[0x0])return console[_0x239c4e(0x1d1)](_0x239c4e(0x1c1)),0x1;const _0x577b32=readSqlStatementsFromFile(_0x3f4ab0);if(_0x577b32[_0x239c4e(0x1de)]===0x0)return console[_0x239c4e(0x1d1)](_0x239c4e(0x1ed)),0x1;if(_0x577b32['length']>0x1)return console[_0x239c4e(0x1d1)](_0x239c4e(0x1ff)),0x1;_0x128a8f=_0x577b32[0x0];}else{if(!_0x335e5d[0x0])return console['error'](_0x239c4e(0x1e0)),console['error'](_0x239c4e(0x1d7)),0x1;_0x128a8f=_0x335e5d[0x0];}_0x5eb626[_0x239c4e(0x1d9)]&&(console['error'](_0x239c4e(0x1b4)+_0x3e8c61),console[_0x239c4e(0x1d1)](_0x239c4e(0x1ef)+_0x55e2e9),console[_0x239c4e(0x1d1)](_0x239c4e(0x1fc)+_0x128a8f['substring'](0x0,0x64)+(_0x128a8f[_0x239c4e(0x1de)]>0x64?'...':'')));const _0x129ac9=await withSpinner(_0x239c4e(0x1bc),()=>_0x3cd503[_0x239c4e(0x1f4)][_0x239c4e(0x1da)](_0x55e2e9,_0x128a8f,_0x3e8c61),{'verbose':_0x5eb626[_0x239c4e(0x1d9)]}),_0x1e61ff=_0x129ac9[_0x239c4e(0x1bb)];return console[_0x239c4e(0x1d1)]('✔\x20Job\x20submitted'),console['error']('\x20\x20Job\x20ID:\x20'+_0x1e61ff[_0x239c4e(0x1c6)]),await handleSDKOutput([_0x1e61ff],_0x5eb626),0x0;}catch(_0x331c86){if(_0x331c86 instanceof SDKError)return console['error']('Error:\x20'+_0x331c86[_0x239c4e(0x1be)]),_0x331c86[_0x239c4e(0x1f3)]&&console[_0x239c4e(0x1d1)](_0x239c4e(0x1f6)+_0x331c86[_0x239c4e(0x1f3)]),0x1;throw _0x331c86;}}}export class JobResultCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]=a17_0xbf8c15(0x1e4);['description']=a17_0xbf8c15(0x1c4);async[a17_0xbf8c15(0x1b5)](_0x58603f){const _0x241132=a17_0xbf8c15,{options:_0x3e5577,args:_0x3511b8,tdx:_0x358696}=_0x58603f,_0x50f568=_0x3511b8[0x0];if(!_0x50f568)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0x241132(0x1d1)](_0x241132(0x1f7)),0x1;try{const _0x521b6f=await withSpinner(_0x241132(0x1bd),()=>_0x358696[_0x241132(0x1f4)][_0x241132(0x1ea)](_0x50f568),{'verbose':_0x3e5577[_0x241132(0x1d9)]}),_0x323432=_0x521b6f[_0x241132(0x1bb)];return console['error']('✔\x20Retrieved\x20'+_0x323432[_0x241132(0x1de)]+_0x241132(0x1df)+(_0x323432[_0x241132(0x1de)]!==0x1?'s':'')),await handleSDKOutput(_0x323432,_0x3e5577),0x0;}catch(_0x4491f8){if(_0x4491f8 instanceof SDKError)return console[_0x241132(0x1d1)](_0x241132(0x1b6)+_0x4491f8[_0x241132(0x1be)]),_0x4491f8[_0x241132(0x1f3)]&&console[_0x241132(0x1d1)]('\x20\x20Cause:\x20'+_0x4491f8[_0x241132(0x1f3)]),0x1;throw _0x4491f8;}}}
|
|
1
|
+
const a16_0x194439=a16_0x4184;(function(_0x5c68af,_0x20d41b){const _0x5bfe1f=a16_0x4184,_0xe342f1=_0x5c68af();while(!![]){try{const _0x14e118=-parseInt(_0x5bfe1f(0x1d7))/0x1+parseInt(_0x5bfe1f(0x1c6))/0x2+-parseInt(_0x5bfe1f(0x1f0))/0x3*(-parseInt(_0x5bfe1f(0x1b6))/0x4)+parseInt(_0x5bfe1f(0x1f6))/0x5+parseInt(_0x5bfe1f(0x1e2))/0x6*(-parseInt(_0x5bfe1f(0x1e1))/0x7)+-parseInt(_0x5bfe1f(0x1ff))/0x8*(parseInt(_0x5bfe1f(0x1ee))/0x9)+-parseInt(_0x5bfe1f(0x1f3))/0xa*(-parseInt(_0x5bfe1f(0x1e3))/0xb);if(_0x14e118===_0x20d41b)break;else _0xe342f1['push'](_0xe342f1['shift']());}catch(_0x5da5a3){_0xe342f1['push'](_0xe342f1['shift']());}}}(a16_0x3fb7,0x335b5));import{BaseCommand}from'./command.js';import{SDKError}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';function a16_0x4184(_0x1a6660,_0x52dc90){_0x1a6660=_0x1a6660-0x1b5;const _0x3fb78b=a16_0x3fb7();let _0x4184b2=_0x3fb78b[_0x1a6660];return _0x4184b2;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a16_0x194439(0x1b7)]=a16_0x194439(0x1bc);[a16_0x194439(0x1c9)]=a16_0x194439(0x1d9);async['execute'](_0xff1285){const _0x3062ab=a16_0x194439,{options:_0x2ed582,tdx:_0x2cb969}=_0xff1285;try{const _0x267a63=resolveLimit(_0x2ed582['limit'],DEFAULT_DISPLAY_LIMIT),_0x1110b6=_0x2ed582['status'];_0x2ed582[_0x3062ab(0x1c3)]&&(console[_0x3062ab(0x1db)](_0x3062ab(0x1e5)+_0x267a63+'\x20jobs'),_0x1110b6&&console[_0x3062ab(0x1db)](_0x3062ab(0x1bb)+_0x1110b6));const _0x603be1=await withSpinner(_0x3062ab(0x1ba),()=>_0x2cb969[_0x3062ab(0x1bc)]['list']({'from':0x0,'to':_0x267a63-0x1,'status':_0x1110b6}),{'verbose':_0x2ed582['verbose']}),_0x33bbc7=_0x603be1['data'];console[_0x3062ab(0x1db)](_0x3062ab(0x1e0)+_0x33bbc7['length']+_0x3062ab(0x1eb)+(_0x33bbc7[_0x3062ab(0x1ef)]!==0x1?'s':''));const _0x4a1641=_0x33bbc7[_0x3062ab(0x1fe)](_0x551116=>{const _0x3f09ad=_0x3062ab;let _0x4beecc;if(_0x551116[_0x3f09ad(0x1d1)]&&_0x551116['end_at']){const _0x2acb4b=new Date(_0x551116[_0x3f09ad(0x1d1)])['getTime'](),_0x1ff98f=new Date(_0x551116[_0x3f09ad(0x1cc)])[_0x3f09ad(0x1e6)]();_0x4beecc=Math[_0x3f09ad(0x1be)]((_0x1ff98f-_0x2acb4b)/0x3e8);}return{'job_id':_0x551116[_0x3f09ad(0x1e7)],'type':_0x551116['type'],'status':_0x551116[_0x3f09ad(0x1fa)],'user_name':_0x551116[_0x3f09ad(0x1da)],'duration_sec':_0x4beecc,'created_at':_0x551116['created_at'],'started_at':_0x551116[_0x3f09ad(0x1d1)],'end_at':_0x551116[_0x3f09ad(0x1cc)]};});return await handleSDKOutput(_0x4a1641,_0x2ed582),0x0;}catch(_0x39ed05){if(_0x39ed05 instanceof SDKError)return console[_0x3062ab(0x1db)](_0x3062ab(0x1e8)+_0x39ed05[_0x3062ab(0x1bf)]),_0x39ed05[_0x3062ab(0x1c4)]&&console['error'](_0x3062ab(0x1c1)+_0x39ed05[_0x3062ab(0x1c4)]),0x1;throw _0x39ed05;}}}function a16_0x3fb7(){const _0x2fe126=['Error:\x20Job\x20ID\x20is\x20required','Usage:\x20job\x20show\x20<job-id>','yes','job:submit','302424xpiRmh','query','List\x20jobs','user_name','error','Database:\x20','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','execute','substring','✔\x20Found\x20','77WaDOOT','122394hkJrUG','242zGDpsa','debug','Limit:\x20','getTime','job_id','Error:\x20','Submitting\x20job...','url','\x20job','Submit\x20a\x20job','data','9wYvQfW','length','5685YYgzED','✔\x20Job\x20submitted','submit','118930FhvgCq','Getting\x20job\x20results...','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','1034260FpOhpI','job:kill','Usage:\x20job\x20kill\x20<job-id>','Get\x20job\x20results','status','Job\x20type:\x20','✔\x20Retrieved\x20','\x20row','map','1413200BJpojg','trino','788kDjXnK','name','hive','priority','Listing\x20jobs...','Status\x20filter:\x20','jobs','job:show','round','message','Cancelled','\x20\x20Cause:\x20','database','verbose','cause','\x20\x20Job\x20ID:\x20','144014KCLObF','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','description','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Getting\x20job\x20details...','end_at','kill','\x27\x20to\x20verify\x20the\x20job\x20status','created_at','Show\x20job\x20details','start_at','result'];a16_0x3fb7=function(){return _0x2fe126;};return a16_0x3fb7();}export class JobShowCommand extends BaseCommand{[a16_0x194439(0x1b7)]=a16_0x194439(0x1bd);[a16_0x194439(0x1c9)]=a16_0x194439(0x1d0);async[a16_0x194439(0x1de)](_0x725d9d){const _0x2b8c82=a16_0x194439,{options:_0x16c6af,args:_0x3bf19d,tdx:_0x256def}=_0x725d9d,_0x3538ae=_0x3bf19d[0x0];if(!_0x3538ae)return console[_0x2b8c82(0x1db)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x2b8c82(0x1db)](_0x2b8c82(0x1d4)),0x1;try{const _0xc65763=await withSpinner(_0x2b8c82(0x1cb),()=>_0x256def[_0x2b8c82(0x1bc)]['show'](_0x3538ae),{'verbose':_0x16c6af['verbose']}),_0x7f44b4=_0xc65763[_0x2b8c82(0x1ed)];let _0x2beee5;if(_0x7f44b4[_0x2b8c82(0x1d1)]&&_0x7f44b4[_0x2b8c82(0x1cc)]){const _0x490905=new Date(_0x7f44b4[_0x2b8c82(0x1d1)])['getTime'](),_0x12f433=new Date(_0x7f44b4[_0x2b8c82(0x1cc)])['getTime']();_0x2beee5=Math[_0x2b8c82(0x1be)]((_0x12f433-_0x490905)/0x3e8);}const _0x8434e6={'job_id':_0x7f44b4['job_id'],'type':_0x7f44b4['type'],'status':_0x7f44b4[_0x2b8c82(0x1fa)],..._0x7f44b4[_0x2b8c82(0x1da)]&&{'user_name':_0x7f44b4[_0x2b8c82(0x1da)]},..._0x2beee5!==undefined&&{'duration_sec':_0x2beee5},..._0x7f44b4[_0x2b8c82(0x1cf)]&&{'created_at':_0x7f44b4[_0x2b8c82(0x1cf)]},..._0x7f44b4['start_at']&&{'started_at':_0x7f44b4[_0x2b8c82(0x1d1)]},..._0x7f44b4['end_at']&&{'end_at':_0x7f44b4['end_at']},..._0x7f44b4[_0x2b8c82(0x1c2)]&&{'database':_0x7f44b4[_0x2b8c82(0x1c2)]},..._0x7f44b4[_0x2b8c82(0x1b9)]!==undefined&&{'priority':_0x7f44b4[_0x2b8c82(0x1b9)]},..._0x7f44b4[_0x2b8c82(0x1ea)]&&{'url':_0x7f44b4[_0x2b8c82(0x1ea)]},..._0x7f44b4['query']&&{'query':_0x7f44b4[_0x2b8c82(0x1d8)]},..._0x7f44b4[_0x2b8c82(0x1e4)]&&{'debug':_0x7f44b4['debug']}};return await handleSingleObjectOutput(_0x8434e6,_0x16c6af),0x0;}catch(_0x1da9f3){if(_0x1da9f3 instanceof SDKError)return console[_0x2b8c82(0x1db)]('Error:\x20'+_0x1da9f3[_0x2b8c82(0x1bf)]),_0x1da9f3[_0x2b8c82(0x1c4)]&&console[_0x2b8c82(0x1db)](_0x2b8c82(0x1c1)+_0x1da9f3[_0x2b8c82(0x1c4)]),0x1;throw _0x1da9f3;}}}export class JobKillCommand extends BaseCommand{[a16_0x194439(0x1b7)]=a16_0x194439(0x1f7);[a16_0x194439(0x1c9)]='Kill\x20a\x20job';async[a16_0x194439(0x1de)](_0x4f91a5){const _0x2fcfbe=a16_0x194439,{options:_0x46d1a8,args:_0x44021b,tdx:_0x10a111}=_0x4f91a5,_0x882b06=_0x44021b[0x0];if(!_0x882b06)return console[_0x2fcfbe(0x1db)](_0x2fcfbe(0x1d3)),console[_0x2fcfbe(0x1db)](_0x2fcfbe(0x1f8)),0x1;try{if(!_0x46d1a8[_0x2fcfbe(0x1d5)]){const _0x44333e=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x882b06+'?');if(!_0x44333e)return console[_0x2fcfbe(0x1db)](_0x2fcfbe(0x1c0)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x10a111[_0x2fcfbe(0x1bc)][_0x2fcfbe(0x1cd)](_0x882b06),{'verbose':_0x46d1a8['verbose']}),console['error'](_0x2fcfbe(0x1c7)+_0x882b06),console[_0x2fcfbe(0x1db)](_0x2fcfbe(0x1f5)+_0x882b06+_0x2fcfbe(0x1ce)),0x0;}catch(_0x13cb05){if(_0x13cb05 instanceof SDKError)return console[_0x2fcfbe(0x1db)](_0x2fcfbe(0x1e8)+_0x13cb05['message']),_0x13cb05[_0x2fcfbe(0x1c4)]&&console[_0x2fcfbe(0x1db)](_0x2fcfbe(0x1c1)+_0x13cb05[_0x2fcfbe(0x1c4)]),0x1;throw _0x13cb05;}}}export class JobSubmitCommand extends BaseCommand{[a16_0x194439(0x1b7)]=a16_0x194439(0x1d6);[a16_0x194439(0x1c9)]=a16_0x194439(0x1ec);async['execute'](_0x369e4f){const _0x5724d8=a16_0x194439,{options:_0x3e92e2,args:_0x164fc2,tdx:_0x274c90}=_0x369e4f;try{const _0x1f3e07=_0x3e92e2['jobType']||_0x5724d8(0x1b5),_0x34df4d=_0x3e92e2['file'],_0x461741=_0x3e92e2['database']||'information_schema';if(_0x1f3e07!==_0x5724d8(0x1b5)&&_0x1f3e07!==_0x5724d8(0x1b8))return console[_0x5724d8(0x1db)]('Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22'),0x1;let _0x5d89da;if(_0x34df4d){if(_0x164fc2[0x0])return console[_0x5724d8(0x1db)]('Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option'),0x1;const _0x3a58f2=readSqlStatementsFromFile(_0x34df4d);if(_0x3a58f2['length']===0x0)return console['error'](_0x5724d8(0x1ca)),0x1;if(_0x3a58f2[_0x5724d8(0x1ef)]>0x1)return console['error'](_0x5724d8(0x1c8)),0x1;_0x5d89da=_0x3a58f2[0x0];}else{if(!_0x164fc2[0x0])return console[_0x5724d8(0x1db)]('Error:\x20Query\x20is\x20required'),console['error'](_0x5724d8(0x1dd)),0x1;_0x5d89da=_0x164fc2[0x0];}_0x3e92e2[_0x5724d8(0x1c3)]&&(console[_0x5724d8(0x1db)](_0x5724d8(0x1fb)+_0x1f3e07),console['error'](_0x5724d8(0x1dc)+_0x461741),console[_0x5724d8(0x1db)]('Query:\x20'+_0x5d89da[_0x5724d8(0x1df)](0x0,0x64)+(_0x5d89da[_0x5724d8(0x1ef)]>0x64?'...':'')));const _0x2ed6e7=await withSpinner(_0x5724d8(0x1e9),()=>_0x274c90[_0x5724d8(0x1bc)][_0x5724d8(0x1f2)](_0x461741,_0x5d89da,_0x1f3e07),{'verbose':_0x3e92e2['verbose']}),_0x1f523d=_0x2ed6e7[_0x5724d8(0x1ed)];return console['error'](_0x5724d8(0x1f1)),console[_0x5724d8(0x1db)](_0x5724d8(0x1c5)+_0x1f523d[_0x5724d8(0x1e7)]),await handleSDKOutput([_0x1f523d],_0x3e92e2),0x0;}catch(_0x1d4d17){if(_0x1d4d17 instanceof SDKError)return console[_0x5724d8(0x1db)](_0x5724d8(0x1e8)+_0x1d4d17[_0x5724d8(0x1bf)]),_0x1d4d17[_0x5724d8(0x1c4)]&&console['error'](_0x5724d8(0x1c1)+_0x1d4d17[_0x5724d8(0x1c4)]),0x1;throw _0x1d4d17;}}}export class JobResultCommand extends BaseCommand{[a16_0x194439(0x1b7)]='job:result';[a16_0x194439(0x1c9)]=a16_0x194439(0x1f9);async[a16_0x194439(0x1de)](_0x33ad7a){const _0x36863b=a16_0x194439,{options:_0x2702d3,args:_0x21b4b2,tdx:_0x9ddbb9}=_0x33ad7a,_0x40df7c=_0x21b4b2[0x0];if(!_0x40df7c)return console['error'](_0x36863b(0x1d3)),console[_0x36863b(0x1db)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x277645=await withSpinner(_0x36863b(0x1f4),()=>_0x9ddbb9[_0x36863b(0x1bc)][_0x36863b(0x1d2)](_0x40df7c),{'verbose':_0x2702d3[_0x36863b(0x1c3)]}),_0x41dc20=_0x277645[_0x36863b(0x1ed)];return console[_0x36863b(0x1db)](_0x36863b(0x1fc)+_0x41dc20[_0x36863b(0x1ef)]+_0x36863b(0x1fd)+(_0x41dc20[_0x36863b(0x1ef)]!==0x1?'s':'')),await handleSDKOutput(_0x41dc20,_0x2702d3),0x0;}catch(_0x224b17){if(_0x224b17 instanceof SDKError)return console[_0x36863b(0x1db)](_0x36863b(0x1e8)+_0x224b17[_0x36863b(0x1bf)]),_0x224b17[_0x36863b(0x1c4)]&&console[_0x36863b(0x1db)]('\x20\x20Cause:\x20'+_0x224b17[_0x36863b(0x1c4)]),0x1;throw _0x224b17;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a18_0xc8fd7f=a18_0x2148;(function(_0x589bfb,_0x17a8a6){const _0x315c02=a18_0x2148,_0x2d34e3=_0x589bfb();while(!![]){try{const _0x5d6075=parseInt(_0x315c02(0x1c5))/0x1+parseInt(_0x315c02(0x190))/0x2*(parseInt(_0x315c02(0x12b))/0x3)+parseInt(_0x315c02(0x171))/0x4*(parseInt(_0x315c02(0x1ae))/0x5)+parseInt(_0x315c02(0x1b4))/0x6+-parseInt(_0x315c02(0x174))/0x7+-parseInt(_0x315c02(0x1e8))/0x8+-parseInt(_0x315c02(0x15b))/0x9*(parseInt(_0x315c02(0x120))/0xa);if(_0x5d6075===_0x17a8a6)break;else _0x2d34e3['push'](_0x2d34e3['shift']());}catch(_0x4156eb){_0x2d34e3['push'](_0x2d34e3['shift']());}}}(a18_0x30cf,0x2877a));import a18_0x4f3c23 from'chalk';import a18_0xd5d9ec 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';function a18_0x30cf(){const _0x37e49c=['parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Folder\x20path:\x20','population','dim','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','root\x20folder','web','parentSegment','toLowerCase','rule','map','journey:pause','file','errorCode','setPhase','Getting\x20journey\x20details...','segmentName','/j/da/je','parentName','274xSpMYe','find','journey:pull','Warning:\x20Could\x20not\x20resolve\x20activation\x20','verbose','helpText','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','add','red','Fetching\x20folders...','Fetching\x20connections\x20for\x20name\x20resolution...','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','replace','Fetching\x20','Write\x20','green','Target\x20directory:\x20','\x20unchanged\x20files','archived','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Resolving\x20parent\x20segment...','content','execute','utf-8','\x27\x20not\x20found\x20in\x20','versionNumber','journeyName','includeStats','push','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','507865kQksve','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Export\x20journey(s)\x20as\x20YAML\x20files','(root)','activation_','\x0aPull\x20summary:','1722930KPLxxq','Journey\x20name:\x20','test','segments','journey:resume','no_parent','journeyBundleName','repeat','listFolders','Resuming\x20journey...','connection','Found\x20','\x20\x20Statistics\x20not\x20available','folderId','attributes','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','size','187287IImlZS','Warning:\x20Could\x20not\x20resolve\x20segment\x20','paused','✔\x20Found\x20','\x20journeys','cyan','activationParams','relative','sort','Usage:\x20journey\x20pause\x20<name-or-path>','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','set','all','targetDir','conversionRate','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','\x20(paused)','Error:\x20Journey\x20\x27','No\x20journeys\x20found','Error:\x20Parent\x20segment\x20context\x20required','Cancelled','state','Show\x20journey\x20statistics','user','yes','totalEntered','INVALID_ARGUMENT','site','hasChanges','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Options:','\x5c$&','session','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','256960FtVtir','Aborted.','absolutePath','goal','1404680iDnqYE','\x20\x20Preserving\x20local\x20segment\x20name:\x20','goalRate','journeyStages','✔\x20Context\x20set:\x20','getSegment','join','\x22\x20resumed','Resolved\x20YAML\x20file:\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Pausing\x20journey...','6927QeSnbI','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','buildIdToEmailMap','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','\x20new\x20files','resume','Pause\x20a\x20running\x20journey','segmentPushCommand','getStatistics','Pattern:\x20','Resolving\x20journey...','\x22\x20not\x20found','isNew','resolveJourneyId','Listing\x20journeys...','✔\x20Journey\x20\x22','Listing\x20folders...','journeyBundleId','\x20files?','draft','🗺️\x20','journey:list','\x20\x20Parent\x20segment:\x20','get','entered','then','\x20versions)','getJourney','journey','stage','yellow','getActivation','Show\x20journey\x20details','Fetching\x20parent\x20segment...','/e/','diff','parent_segment','\x20\x20Folder\x20path:\x20','filePath','\x22\x20paused','entries','resolveSegment','values','Parent\x20segment:\x20','Fetching\x20users\x20for\x20email\x20resolution...','totalGoalAchieved','resolveParentId','name','27fpSElK','Usage:\x20journey\x20resume\x20<name-or-path>','Getting\x20journey\x20statistics...','filter','message','/app/ps/','Warning:\x20Stage\x20\x22','\x20=\x20','journeyId','relativePath','format','listJourneysFromParentSegment','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)','folderPath','segment','journey:view','\x20->\x20','description','journey:stats','stages','stageName','data','4AZaSbE','log','Usage:\x20journey\x20stats\x20<name-or-path>','1911490PoIQGr','length','\x20Opening\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','error','has','exited','\x20journey\x20files\x20to\x20','Input:\x20'];a18_0x30cf=function(){return _0x37e49c;};return a18_0x30cf();}function a18_0x2148(_0x1216f1,_0x5d53fe){_0x1216f1=_0x1216f1-0x11e;const _0x30cf5a=a18_0x30cf();let _0x2148d9=_0x30cf5a[_0x1216f1];return _0x2148d9;}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}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';function formatJourneyState(_0x228ddf){const _0x4c8d46=a18_0x2148;switch(_0x228ddf){case'launched':return a18_0x4f3c23[_0x4c8d46(0x19f)](_0x228ddf);case _0x4c8d46(0x13e):return a18_0x4f3c23['gray'](_0x228ddf);case _0x4c8d46(0x1a2):return a18_0x4f3c23[_0x4c8d46(0x180)](_0x228ddf);default:return _0x228ddf;}}function formatJourneyItem(_0x3e472d,_0x5880b4='',_0x1a1a6a){const _0x215551=a18_0x2148,_0x38399e=formatJourneyState(_0x3e472d[_0x215551(0x1db)]),_0x1c4c94=_0x3e472d[_0x215551(0x1c7)]?a18_0x4f3c23['yellow'](_0x215551(0x1d6)):'',_0x1edc11=_0x1a1a6a?'\x20'+a18_0x4f3c23['cyan'](_0x1a1a6a):'';return _0x5880b4+_0x215551(0x13f)+_0x3e472d['journeyBundleName']+'\x20('+_0x38399e+')'+_0x1c4c94+_0x1edc11;}function escapeRegex(_0x9d1a90){const _0x556278=a18_0x2148;return _0x9d1a90[_0x556278(0x19c)](/[.*+?^${}()|[\]\\]/g,_0x556278(0x1e5));}function globToRegex(_0x2f6956){const _0x730fa0=a18_0x2148,_0x1b4382=_0x2f6956['split']('*')[_0x730fa0(0x187)](escapeRegex);return new RegExp(_0x1b4382['join']('.*'),'i');}function buildRuleToNameMapping(_0x3c4421){const _0x54f939=a18_0x2148,_0x23a511=new Map();if(_0x3c4421[_0x54f939(0x1b7)])for(const [_0xe8a18e,_0x26446d]of Object[_0x54f939(0x153)](_0x3c4421[_0x54f939(0x1b7)])){if(_0x26446d[_0x54f939(0x186)]){const _0x1a0d88=serializeRule(_0x26446d[_0x54f939(0x186)]),_0x12d7b6=_0x23a511['get'](_0x1a0d88);_0x12d7b6?_0x12d7b6[_0x54f939(0x1ac)](_0xe8a18e):_0x23a511['set'](_0x1a0d88,[_0xe8a18e]);}}return _0x23a511;}async function resolveJourneyTarget(_0x3f66ee,_0xe03783,_0x1dcf11){const _0x3b1657=a18_0x2148;if(isYamlFilePath(_0x3f66ee))try{const _0x1a0951=await resolveYamlFilePath(_0x3f66ee);return _0x1dcf11&&(console[_0x3b1657(0x178)](_0x3b1657(0x128)+_0x3f66ee),console[_0x3b1657(0x178)](_0x3b1657(0x141)+_0x1a0951['parentSegment']),console[_0x3b1657(0x178)]('\x20\x20Name:\x20'+_0x1a0951[_0x3b1657(0x18d)]),console[_0x3b1657(0x178)](_0x3b1657(0x150)+(_0x1a0951[_0x3b1657(0x168)]||'(root)'))),{'journeyName':_0x1a0951[_0x3b1657(0x18d)],'parentSegment':_0x1a0951[_0x3b1657(0x184)],'resolved':_0x1a0951};}catch(_0x685399){throw new SDKError(ErrorCode[_0x3b1657(0x1e0)],_0x3b1657(0x1ad)+_0x685399[_0x3b1657(0x15f)]);}if(!_0xe03783)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3b1657(0x196));return{'journeyName':_0x3f66ee,'parentSegment':_0xe03783};}export class JourneyListCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x140);[a18_0xc8fd7f(0x16c)]='List\x20journeys\x20in\x20current\x20context';async[a18_0xc8fd7f(0x1a6)](_0x2eac97){const _0x4c0864=a18_0xc8fd7f,{options:_0x3f793e,args:_0x4b79b1,tdx:_0x3c5ac7}=_0x2eac97,_0x1a6d8a=_0x4b79b1[0x0],_0x53d0c8=_0x3f793e[_0x4c0864(0x183)],_0xe70c5e=_0x3f793e[_0x4c0864(0x184)];if(!_0xe70c5e)return console[_0x4c0864(0x178)](_0x4c0864(0x1d9)),console[_0x4c0864(0x178)](_0x4c0864(0x181)),0x1;const _0x1f17f3=await withSpinner(_0x4c0864(0x1a4),()=>_0x3c5ac7['segment']['resolveParentId'](_0xe70c5e),{'verbose':_0x3f793e['verbose']}),_0x5ab118=_0x1f17f3[_0x4c0864(0x170)];_0x3f793e['verbose']&&(console[_0x4c0864(0x178)]('Parent\x20segment:\x20'+_0xe70c5e+'\x20(ID:\x20'+_0x5ab118+')'),_0x1a6d8a&&console['error'](_0x4c0864(0x134)+_0x1a6d8a));const [_0x13b6a4,_0xa25a3c,_0x2a8e2b]=await Promise[_0x4c0864(0x1d1)]([withSpinner(_0x4c0864(0x14c),()=>_0x3c5ac7[_0x4c0864(0x169)]['getParentFull'](_0x5ab118),{'verbose':_0x3f793e[_0x4c0864(0x194)]}),withSpinner(_0x4c0864(0x199),()=>_0x3c5ac7[_0x4c0864(0x169)][_0x4c0864(0x1bc)](_0x5ab118),{'verbose':_0x3f793e[_0x4c0864(0x194)]}),withSpinner(_0x4c0864(0x139),()=>_0x3c5ac7[_0x4c0864(0x147)][_0x4c0864(0x166)](_0x5ab118),{'verbose':_0x3f793e['verbose']})]),_0x22e0fe=_0x13b6a4['data'],_0x5364cf=_0xa25a3c[_0x4c0864(0x170)];let _0x401b79=_0x2a8e2b[_0x4c0864(0x170)];const _0x4308e2=_0x22e0fe['rootFolderId'],_0xa43716=new Map();for(const _0x225833 of _0x5364cf){_0xa43716['set'](_0x225833['id'],_0x225833[_0x4c0864(0x15a)]);}if(_0x1a6d8a){const _0x382005=globToRegex(_0x1a6d8a);_0x401b79=_0x401b79[_0x4c0864(0x15e)](_0x232f6d=>_0x382005[_0x4c0864(0x1b6)](_0x232f6d[_0x4c0864(0x1ba)]));}console['error'](_0x4c0864(0x1c8)+_0x401b79[_0x4c0864(0x175)]+'\x20journey'+(_0x401b79[_0x4c0864(0x175)]!==0x1?'s':''));const _0x3aa532=_0x4a8915=>{const _0x39f1d5=_0x4c0864;return getConsoleNextUrl(_0x3f793e[_0x39f1d5(0x1e1)],'/app/ps/'+_0x5ab118+'/e/'+_0x4a8915+'/j/da');};if(_0x3f793e['format']==='table')await handleSDKOutput(_0x401b79,_0x3f793e);else{if(_0x3f793e[_0x4c0864(0x165)]==='json'){const _0x1844d7=_0x401b79['map'](_0x4ead5b=>({..._0x4ead5b,'url':_0x3aa532(_0x4ead5b['id'])}));await handleSDKOutput(_0x1844d7,_0x3f793e);}else{console[_0x4c0864(0x172)]('['+_0xe70c5e+']');const _0x249214=new Map(),_0x1adcb7=[];for(const _0x1d8e4b of _0x401b79){if(!_0x1d8e4b[_0x4c0864(0x1c1)]||_0x1d8e4b[_0x4c0864(0x1c1)]===_0x4308e2)_0x1adcb7[_0x4c0864(0x1ac)](_0x1d8e4b);else{const _0x2980ef=_0x249214[_0x4c0864(0x142)](_0x1d8e4b[_0x4c0864(0x1c1)])||[];_0x2980ef[_0x4c0864(0x1ac)](_0x1d8e4b),_0x249214[_0x4c0864(0x1d0)](_0x1d8e4b[_0x4c0864(0x1c1)],_0x2980ef);}}for(const _0x2246d2 of _0x1adcb7){const _0x232ece=_0x53d0c8?_0x3aa532(_0x2246d2['id']):undefined;console['log'](formatJourneyItem(_0x2246d2,'',_0x232ece));}for(const [_0x333b4e,_0x965b5]of _0x249214){const _0x50d4eb=_0xa43716['get'](_0x333b4e)||_0x333b4e;console['log']('📁\x20'+_0x50d4eb);for(const _0x128047 of _0x965b5){const _0xef9b0d=_0x53d0c8?_0x3aa532(_0x128047['id']):undefined;console['log'](formatJourneyItem(_0x128047,'\x20\x20',_0xef9b0d));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x16a);[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x14b);async['execute'](_0x81d6ba){const _0x2e5495=a18_0xc8fd7f,{options:_0x1eb990,args:_0xeba669,tdx:_0x4b2bcf}=_0x81d6ba,_0x41661e=_0xeba669[0x0];if(!_0x41661e)return console[_0x2e5495(0x178)](_0x2e5495(0x129)),console[_0x2e5495(0x178)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x2e5495(0x178)](_0x2e5495(0x1e4)),console[_0x2e5495(0x178)](_0x2e5495(0x12c)),0x1;_0x1eb990[_0x2e5495(0x194)]&&console[_0x2e5495(0x178)](_0x2e5495(0x17c)+_0x41661e);const _0x50f7ba=await resolveJourneyTarget(_0x41661e,_0x1eb990[_0x2e5495(0x184)],_0x1eb990[_0x2e5495(0x194)]),_0x98c4c3=await withSpinner(_0x2e5495(0x1a4),()=>_0x4b2bcf[_0x2e5495(0x169)][_0x2e5495(0x159)](_0x50f7ba[_0x2e5495(0x184)]),{'verbose':_0x1eb990[_0x2e5495(0x194)]}),_0x5ef47a=_0x98c4c3[_0x2e5495(0x170)],_0xb4ba52=await withSpinner(_0x2e5495(0x135),()=>_0x4b2bcf['journey']['resolveJourneyId'](_0x5ef47a,_0x50f7ba[_0x2e5495(0x1aa)]),{'verbose':_0x1eb990[_0x2e5495(0x194)]}),_0x5b051f=_0xb4ba52[_0x2e5495(0x170)];if(_0x1eb990[_0x2e5495(0x183)]){const _0x1afdda=getConsoleNextUrl(_0x1eb990[_0x2e5495(0x1e1)],_0x2e5495(0x160)+_0x5ef47a+_0x2e5495(0x14d)+_0x5b051f+_0x2e5495(0x18e));return console['error'](a18_0x4f3c23[_0x2e5495(0x19f)]('✔')+_0x2e5495(0x176)+a18_0x4f3c23[_0x2e5495(0x1ca)](_0x1afdda)),openBrowser(_0x1afdda),0x0;}const _0x3721a6=await withSpinner(_0x2e5495(0x18c),()=>_0x4b2bcf[_0x2e5495(0x147)][_0x2e5495(0x146)](_0x5b051f),{'verbose':_0x1eb990[_0x2e5495(0x194)]}),_0x40b9fb=_0x3721a6['data'],_0x595bc6=_0x1eb990[_0x2e5495(0x1ab)];let _0x5aeb62;if(_0x595bc6)try{const _0x3cc0fe=await withSpinner(_0x2e5495(0x15d),()=>_0x4b2bcf[_0x2e5495(0x147)]['getStatistics'](_0x5b051f),{'verbose':_0x1eb990[_0x2e5495(0x194)]});_0x5aeb62=_0x3cc0fe[_0x2e5495(0x170)];}catch{_0x1eb990[_0x2e5495(0x194)]&&console[_0x2e5495(0x178)](_0x2e5495(0x1c0));}const _0x4c699f=getConsoleNextUrl(_0x1eb990['site'],'/app/ps/'+_0x5ef47a+_0x2e5495(0x14d)+_0x5b051f+_0x2e5495(0x18e)),_0x20c151={'id':_0x40b9fb['id'],'name':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x15a)],'description':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x16c)],'state':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x1db)],'paused':_0x40b9fb['attributes']['paused'],'reentry_mode':_0x40b9fb['attributes']['reentryMode'],'stages':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x123)]?.[_0x2e5495(0x175)]||0x0,..._0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x11f)]&&{'goal':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x11f)][_0x2e5495(0x15a)]},..._0x5aeb62&&{'statistics':{'total_entered':_0x5aeb62[_0x2e5495(0x1df)],'goal_achieved':_0x5aeb62[_0x2e5495(0x158)],'goal_rate':_0x5aeb62[_0x2e5495(0x122)],'stages':_0x5aeb62[_0x2e5495(0x16e)]}},'url':_0x4c699f};return await handleSingleObjectOutput(_0x20c151,_0x1eb990),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x16d);[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x1dc);async['execute'](_0x1ab3f0){const _0x1fe5f5=a18_0xc8fd7f,{options:_0x2c2807,args:_0x525b76,tdx:_0x350ef1}=_0x1ab3f0,_0x2cf099=_0x525b76[0x0];if(!_0x2cf099)return console['error'](_0x1fe5f5(0x129)),console[_0x1fe5f5(0x178)](_0x1fe5f5(0x173)),0x1;_0x2c2807[_0x1fe5f5(0x194)]&&console[_0x1fe5f5(0x178)]('Input:\x20'+_0x2cf099);const _0x1f5008=await resolveJourneyTarget(_0x2cf099,_0x2c2807[_0x1fe5f5(0x184)],_0x2c2807[_0x1fe5f5(0x194)]),_0x5cadb8=await withSpinner(_0x1fe5f5(0x1a4),()=>_0x350ef1[_0x1fe5f5(0x169)][_0x1fe5f5(0x159)](_0x1f5008[_0x1fe5f5(0x184)]),{'verbose':_0x2c2807['verbose']}),_0x12af01=_0x5cadb8['data'],_0x5421cf=await withSpinner(_0x1fe5f5(0x135),()=>_0x350ef1[_0x1fe5f5(0x147)][_0x1fe5f5(0x138)](_0x12af01,_0x1f5008[_0x1fe5f5(0x1aa)]),{'verbose':_0x2c2807['verbose']}),_0xdee2c7=_0x5421cf[_0x1fe5f5(0x170)],_0x26db98=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x350ef1[_0x1fe5f5(0x147)][_0x1fe5f5(0x133)](_0xdee2c7),{'verbose':_0x2c2807['verbose']}),_0x3a4aa1=_0x26db98[_0x1fe5f5(0x170)];if(!_0x3a4aa1||_0x3a4aa1[_0x1fe5f5(0x163)]===null)return console[_0x1fe5f5(0x178)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x1f5008[_0x1fe5f5(0x1aa)]),console[_0x1fe5f5(0x178)](_0x1fe5f5(0x1e7)),0x0;const _0x33ecc5={'journey_id':_0x3a4aa1[_0x1fe5f5(0x163)],'total_entered':_0x3a4aa1[_0x1fe5f5(0x1df)],'goal_achieved':_0x3a4aa1[_0x1fe5f5(0x158)],'goal_rate':_0x3a4aa1[_0x1fe5f5(0x122)],'stages':_0x3a4aa1[_0x1fe5f5(0x16e)]?.[_0x1fe5f5(0x187)](_0x3ec386=>({'name':_0x3ec386['stageName'],'population':_0x3ec386[_0x1fe5f5(0x17f)],'entered':_0x3ec386[_0x1fe5f5(0x143)],'exited':_0x3ec386[_0x1fe5f5(0x17a)],'conversion_rate':_0x3ec386[_0x1fe5f5(0x1d3)]}))},_0x826661=_0x2c2807[_0x1fe5f5(0x148)];if(_0x826661&&_0x3a4aa1[_0x1fe5f5(0x16e)]){const _0x200180=_0x3a4aa1[_0x1fe5f5(0x16e)]['find'](_0x5a6cad=>_0x5a6cad['stageName'][_0x1fe5f5(0x185)]()===_0x826661[_0x1fe5f5(0x185)]());if(_0x200180)return await handleSingleObjectOutput({'stage_name':_0x200180[_0x1fe5f5(0x16f)],'population':_0x200180['population'],'entered':_0x200180[_0x1fe5f5(0x143)],'exited':_0x200180[_0x1fe5f5(0x17a)],'conversion_rate':_0x200180[_0x1fe5f5(0x1d3)]},_0x2c2807),0x0;console[_0x1fe5f5(0x178)](_0x1fe5f5(0x161)+_0x826661+_0x1fe5f5(0x136));}return await handleSingleObjectOutput(_0x33ecc5,_0x2c2807),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x188);[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x131);async[a18_0xc8fd7f(0x1a6)](_0x491032){const _0xccf05c=a18_0xc8fd7f,{options:_0x36d2f1,args:_0x5b74ec,tdx:_0x460eec}=_0x491032,_0x2438f1=_0x5b74ec[0x0];if(!_0x2438f1)return console[_0xccf05c(0x178)](_0xccf05c(0x129)),console[_0xccf05c(0x178)](_0xccf05c(0x1ce)),0x1;_0x36d2f1[_0xccf05c(0x194)]&&console[_0xccf05c(0x178)](_0xccf05c(0x17c)+_0x2438f1);const _0x376614=await resolveJourneyTarget(_0x2438f1,_0x36d2f1[_0xccf05c(0x184)],_0x36d2f1[_0xccf05c(0x194)]),_0x49105b=await withSpinner(_0xccf05c(0x1a4),()=>_0x460eec[_0xccf05c(0x169)]['resolveParentId'](_0x376614[_0xccf05c(0x184)]),{'verbose':_0x36d2f1[_0xccf05c(0x194)]}),_0x34628f=_0x49105b[_0xccf05c(0x170)],_0x35081d=await withSpinner('Resolving\x20journey...',()=>_0x460eec['journey']['resolveJourneyId'](_0x34628f,_0x376614[_0xccf05c(0x1aa)]),{'verbose':_0x36d2f1['verbose']}),_0x110ffd=_0x35081d[_0xccf05c(0x170)];if(!_0x36d2f1[_0xccf05c(0x1de)]){const _0x5b4414=await confirm(_0xccf05c(0x1d5)+_0x376614[_0xccf05c(0x1aa)]+'\x22?');if(!_0x5b4414)return console['error'](_0xccf05c(0x1da)),0x0;}const _0x20077b=await withSpinner(_0xccf05c(0x12a),()=>_0x460eec[_0xccf05c(0x147)]['pause'](_0x110ffd),{'verbose':_0x36d2f1['verbose']}),_0x47df70=_0x20077b[_0xccf05c(0x170)];return console[_0xccf05c(0x178)](_0xccf05c(0x13a)+_0x47df70[_0xccf05c(0x1c2)][_0xccf05c(0x15a)]+_0xccf05c(0x152)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x1b8);[a18_0xc8fd7f(0x16c)]='Resume\x20a\x20paused\x20journey';async[a18_0xc8fd7f(0x1a6)](_0x50a7d3){const _0x5cf2a1=a18_0xc8fd7f,{options:_0x8e1cbe,args:_0x1b4629,tdx:_0x137d82}=_0x50a7d3,_0xcf92fb=_0x1b4629[0x0];if(!_0xcf92fb)return console['error'](_0x5cf2a1(0x129)),console['error'](_0x5cf2a1(0x15c)),0x1;_0x8e1cbe[_0x5cf2a1(0x194)]&&console[_0x5cf2a1(0x178)](_0x5cf2a1(0x17c)+_0xcf92fb);const _0x2a4b89=await resolveJourneyTarget(_0xcf92fb,_0x8e1cbe['parentSegment'],_0x8e1cbe['verbose']),_0x12c4e6=await withSpinner(_0x5cf2a1(0x1a4),()=>_0x137d82['segment'][_0x5cf2a1(0x159)](_0x2a4b89['parentSegment']),{'verbose':_0x8e1cbe['verbose']}),_0x5b4eeb=_0x12c4e6[_0x5cf2a1(0x170)],_0x515f09=await withSpinner(_0x5cf2a1(0x135),()=>_0x137d82[_0x5cf2a1(0x147)]['resolveJourneyId'](_0x5b4eeb,_0x2a4b89['journeyName']),{'verbose':_0x8e1cbe['verbose']}),_0xc9cff0=_0x515f09['data'];if(!_0x8e1cbe[_0x5cf2a1(0x1de)]){const _0x199ff9=await confirm(_0x5cf2a1(0x1d4)+_0x2a4b89[_0x5cf2a1(0x1aa)]+'\x22?');if(!_0x199ff9)return console['error']('Cancelled'),0x0;}const _0x247b36=await withSpinner(_0x5cf2a1(0x1bd),()=>_0x137d82[_0x5cf2a1(0x147)][_0x5cf2a1(0x130)](_0xc9cff0),{'verbose':_0x8e1cbe[_0x5cf2a1(0x194)]}),_0x51cd56=_0x247b36[_0x5cf2a1(0x170)];return console[_0x5cf2a1(0x178)](_0x5cf2a1(0x13a)+_0x51cd56[_0x5cf2a1(0x1c2)]['name']+_0x5cf2a1(0x127)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a18_0xc8fd7f(0x192);['description']=a18_0xc8fd7f(0x1b0);async['execute'](_0x1adf71){const _0x49c479=a18_0xc8fd7f,{options:_0x3d0954,args:_0x112a28,tdx:_0x32cc23}=_0x1adf71,_0x2f0d5b=_0x3d0954,_0x3af8d7=_0x112a28[0x0],_0x1715d9=_0x3af8d7&&isYamlFilePath(_0x3af8d7),_0x16891e=await resolveTarget({'arg':_0x1715d9?_0x3af8d7:undefined,'contextParent':_0x3d0954['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x16891e))return _0x16891e[_0x49c479(0x18a)]===_0x49c479(0x1b9)?(console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x149)](_0x49c479(0x17d))),console['error'](_0x49c479(0x167)),console[_0x49c479(0x178)](_0x49c479(0x177)),console[_0x49c479(0x178)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x49c479(0x178)](_0x49c479(0x1cf))):(console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x198)]('Error:\x20'+_0x16891e[_0x49c479(0x15f)]+'\x0a')),_0x16891e[_0x49c479(0x195)]&&console[_0x49c479(0x178)](a18_0x4f3c23['cyan'](_0x16891e[_0x49c479(0x195)]))),0x1;let _0x46caea=_0x1715d9?undefined:_0x3af8d7,_0x443a22,_0x16ac22;_0x16891e['type']===_0x49c479(0x189)&&(_0x46caea=_0x16891e['resourceName'],_0x443a22=_0x16891e[_0x49c479(0x151)],_0x16ac22=_0x16891e[_0x49c479(0x168)]);const _0x5a581a=_0x16891e[_0x49c479(0x18f)],_0x337ad1=_0x16891e[_0x49c479(0x1d2)];_0x2f0d5b[_0x49c479(0x194)]&&(console['error'](_0x49c479(0x156)+_0x5a581a),console[_0x49c479(0x178)](_0x49c479(0x1a0)+_0x337ad1),_0x46caea&&console[_0x49c479(0x178)](_0x49c479(0x1b5)+_0x46caea),_0x443a22&&console[_0x49c479(0x178)]('Target\x20file:\x20'+_0x443a22),_0x16ac22&&console[_0x49c479(0x178)](_0x49c479(0x17e)+_0x16ac22));const _0x3c6003=await withSpinner(_0x49c479(0x1a4),()=>_0x32cc23[_0x49c479(0x169)][_0x49c479(0x159)](_0x5a581a),{'verbose':_0x3d0954[_0x49c479(0x194)]}),_0x2390de=_0x3c6003[_0x49c479(0x170)],[_0xc56658,_0x3ff410]=await Promise[_0x49c479(0x1d1)]([withSpinner(_0x49c479(0x139),()=>_0x32cc23[_0x49c479(0x147)][_0x49c479(0x166)](_0x2390de),{'verbose':_0x3d0954[_0x49c479(0x194)]}),withSpinner(_0x49c479(0x13b),()=>_0x32cc23['segment'][_0x49c479(0x1bc)](_0x2390de),{'verbose':_0x3d0954[_0x49c479(0x194)]})]);let _0x8fcf3=_0xc56658[_0x49c479(0x170)];const _0x1274d=_0x3ff410[_0x49c479(0x170)],_0x23d5b6=buildFolderIdToPathMap(_0x1274d);if(_0x46caea){const _0x4ec089=_0x8fcf3['filter'](_0xe347ba=>_0xe347ba[_0x49c479(0x1ba)][_0x49c479(0x185)]()===_0x46caea[_0x49c479(0x185)]());if(_0x4ec089[_0x49c479(0x175)]===0x0)return console[_0x49c479(0x178)]('Error:\x20Journey\x20not\x20found:\x20'+_0x46caea),console[_0x49c479(0x178)](_0x49c479(0x1af)),0x1;_0x8fcf3=_0x4ec089;}if(_0x16ac22!==undefined){const _0x2d1520=_0x8fcf3[_0x49c479(0x15e)](_0x131b02=>{const _0x1f7b85=_0x49c479,_0x535d19=_0x131b02[_0x1f7b85(0x1c1)]?_0x23d5b6[_0x1f7b85(0x142)](_0x131b02[_0x1f7b85(0x1c1)])||'':'';return _0x535d19===_0x16ac22;});if(_0x2d1520[_0x49c479(0x175)]===0x0&&_0x8fcf3[_0x49c479(0x175)]>0x0){console[_0x49c479(0x178)](_0x49c479(0x1d7)+_0x46caea+_0x49c479(0x1a8)+(_0x16ac22||_0x49c479(0x182))),console[_0x49c479(0x178)](_0x49c479(0x1c3));for(const _0x4e7ff0 of _0x8fcf3){const _0x57c240=_0x4e7ff0[_0x49c479(0x1c1)]?_0x23d5b6[_0x49c479(0x142)](_0x4e7ff0[_0x49c479(0x1c1)])||'':'';console[_0x49c479(0x178)]('\x20\x20-\x20'+(_0x57c240||_0x49c479(0x1b1))+'/'+_0x4e7ff0['journeyBundleName']);}return 0x1;}_0x8fcf3=_0x2d1520;}if(_0x8fcf3[_0x49c479(0x175)]===0x0)return console[_0x49c479(0x178)](_0x49c479(0x1d8)),0x0;const _0xdc833d=new Map();for(const _0x481ae7 of _0x8fcf3){const _0x5ecbf7=_0x481ae7[_0x49c479(0x13c)];!_0xdc833d['has'](_0x5ecbf7)&&_0xdc833d[_0x49c479(0x1d0)](_0x5ecbf7,[]),_0xdc833d['get'](_0x5ecbf7)[_0x49c479(0x1ac)](_0x481ae7);}for(const _0x231444 of _0xdc833d[_0x49c479(0x155)]()){_0x231444[_0x49c479(0x1cd)]((_0x2c3042,_0x31f888)=>(_0x2c3042['versionNumber']||0x0)-(_0x31f888[_0x49c479(0x1a9)]||0x0));}const _0x4f0579=[],[_0x5aac61,_0x1edca9]=await Promise['all']([withSpinner(_0x49c479(0x157),()=>_0x32cc23[_0x49c479(0x1dd)][_0x49c479(0x12d)](),{'verbose':_0x3d0954[_0x49c479(0x194)]})[_0x49c479(0x144)](_0xe10073=>_0xe10073['data']),withSpinner(_0x49c479(0x19a),()=>_0x32cc23[_0x49c479(0x1be)]['buildIdToNameMap'](),{'verbose':_0x3d0954[_0x49c479(0x194)]})[_0x49c479(0x144)](_0x188084=>_0x188084[_0x49c479(0x170)])]);for(const _0x1b14a7 of _0xdc833d['values']()){const _0x27ca0a=_0x1b14a7[0x0][_0x49c479(0x1ba)],_0x5b15a0=_0x1b14a7[0x0][_0x49c479(0x1c1)],_0x41511c=_0x5b15a0?_0x23d5b6['get'](_0x5b15a0)||'':'',_0x53fa54=_0x41511c?a18_0xd5d9ec['join'](_0x337ad1,_0x41511c):_0x337ad1,_0x3abd03=_0x443a22||a18_0xd5d9ec['join'](_0x53fa54,sanitizeFileName(_0x27ca0a)+'.yml');let _0x508d7e,_0x2dd577;if(existsSync(_0x3abd03))try{const _0x43d182=readFileSync(_0x3abd03,_0x49c479(0x1a7)),_0x249e7b=parseYamlString(_0x43d182);_0x2dd577=_0x249e7b,_0x508d7e=buildRuleToNameMapping(_0x249e7b),_0x2f0d5b['verbose']&&_0x508d7e[_0x49c479(0x1c4)]>0x0&&console[_0x49c479(0x178)](_0x49c479(0x1bf)+_0x508d7e[_0x49c479(0x1c4)]+_0x49c479(0x1e3)+_0x27ca0a);}catch(_0x30e33c){_0x2f0d5b[_0x49c479(0x194)]&&console[_0x49c479(0x178)](_0x49c479(0x12e)+_0x30e33c[_0x49c479(0x15f)]);}const _0x3927e2=[],_0x1d78e4=new Set(),_0x29745f=new Map(),_0x1380c8=new Map(),_0x2f825c=new Set(),_0x3f6cab=new Map(),_0x29d700=new Map(),_0x5e019c=createJumpTargetCache();await withProgressSpinner(_0x49c479(0x19d)+_0x27ca0a+'...',async _0x349743=>{const _0x3e6bf1=_0x49c479;for(const _0x20c0f5 of _0x1b14a7){const _0x4894fa=_0x1b14a7[_0x3e6bf1(0x175)]>0x1?_0x20c0f5['journeyBundleName']+'\x20v'+(_0x20c0f5[_0x3e6bf1(0x1a9)]||0x1):_0x20c0f5[_0x3e6bf1(0x1ba)];_0x349743[_0x3e6bf1(0x18b)](_0x3e6bf1(0x19d)+_0x4894fa);const _0x4d8b2b=await _0x32cc23[_0x3e6bf1(0x147)][_0x3e6bf1(0x146)](_0x20c0f5['id']),_0x1624a0=_0x4d8b2b[_0x3e6bf1(0x1c2)]?.['audienceId'],_0x105d44={'resolveSegment':async _0x3c534d=>{const _0x3425ca=_0x3e6bf1;if(!_0x1624a0)return{'name':_0x3c534d,'isJourneyLocal':![]};const _0x2937e4=_0x29745f[_0x3425ca(0x142)](_0x3c534d);if(_0x2937e4)return _0x2937e4;try{const _0x42c2cf=await _0x32cc23[_0x3425ca(0x169)][_0x3425ca(0x125)](_0x1624a0,_0x3c534d),_0x41b948=_0x42c2cf['kind']===SEGMENT_KIND_JOURNEY;let _0x29e0ab,_0x429619=_0x42c2cf['name'];if(_0x41b948&&_0x42c2cf['rule']){const _0xe770ea=await segmentResponseToDef(_0x42c2cf,{'resolveSegmentName':async _0x2d9196=>{const _0x4a43e3=_0x3425ca,_0x52c4de=_0x29745f['get'](_0x2d9196);if(_0x52c4de)return _0x52c4de[_0x4a43e3(0x15a)];const _0x260779=await _0x105d44[_0x4a43e3(0x154)](_0x2d9196);return _0x260779[_0x4a43e3(0x15a)];}}),_0x55d93c=_0xe770ea[_0x3425ca(0x186)];_0x29e0ab={'description':_0x42c2cf['description'],'rule':_0x55d93c};const _0x2056ac=serializeRule(_0x55d93c),_0x1720f4=_0x1380c8[_0x3425ca(0x142)](_0x2056ac);if(_0x1720f4)_0x429619=_0x1720f4,_0x29e0ab=undefined,_0x2f0d5b[_0x3425ca(0x194)]&&console[_0x3425ca(0x178)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x42c2cf[_0x3425ca(0x15a)]+_0x3425ca(0x16b)+_0x1720f4);else{let _0x265520=![];if(_0x508d7e){const _0x1723aa=_0x508d7e[_0x3425ca(0x142)](_0x2056ac);if(_0x1723aa){const _0x4bd9f8=_0x1723aa[_0x3425ca(0x191)](_0x1ff80a=>!_0x1d78e4[_0x3425ca(0x179)](_0x1ff80a));_0x4bd9f8&&(_0x429619=_0x4bd9f8,_0x1d78e4[_0x3425ca(0x197)](_0x4bd9f8),_0x1380c8[_0x3425ca(0x1d0)](_0x2056ac,_0x4bd9f8),_0x265520=!![],_0x2f0d5b['verbose']&&console[_0x3425ca(0x178)](_0x3425ca(0x121)+_0x4bd9f8+'\x20(rule\x20match)'));}}if(!_0x265520){const _0x2b8c6a=generateJourneyLocalName(_0x42c2cf['name']);_0x2b8c6a&&(_0x429619=_0x2b8c6a);let _0x17243c=_0x429619,_0x55e542=0x2;while(_0x1d78e4[_0x3425ca(0x179)](_0x17243c)){_0x17243c=_0x429619+'_'+_0x55e542,_0x55e542++;}_0x1d78e4[_0x3425ca(0x197)](_0x17243c),_0x1380c8[_0x3425ca(0x1d0)](_0x2056ac,_0x17243c),_0x429619=_0x17243c;}}}const _0x5b584f={'name':_0x429619,'isJourneyLocal':_0x41b948,'definition':_0x29e0ab};return _0x29745f[_0x3425ca(0x1d0)](_0x3c534d,_0x5b584f),_0x5b584f;}catch(_0x2d053b){return _0x3d0954[_0x3425ca(0x194)]&&console[_0x3425ca(0x178)](_0x3425ca(0x1c6)+_0x3c534d+':\x20'+_0x2d053b[_0x3425ca(0x15f)]),{'name':_0x3c534d,'isJourneyLocal':![]};}},'resolveActivation':async _0x3a3137=>{const _0x52886e=_0x3e6bf1,_0x34592a=_0x3f6cab[_0x52886e(0x142)](_0x3a3137);if(_0x34592a)return _0x34592a;try{const _0x295f76=await _0x32cc23['journey'][_0x52886e(0x14a)](_0x20c0f5['id'],_0x3a3137),_0x4d3aba=journeyActivationStepToYaml(_0x295f76,_0x5aac61,_0x1edca9),_0x416659=JSON['stringify']({'name':_0x4d3aba[_0x52886e(0x15a)],'connection':_0x4d3aba[_0x52886e(0x1be)],'connector_config':_0x4d3aba['connector_config']}),_0x7e6c64=_0x29d700[_0x52886e(0x142)](_0x416659);if(_0x7e6c64){const _0x2626fd={'name':_0x7e6c64,'isJourneyLocal':!![],'definition':_0x4d3aba};return _0x3f6cab[_0x52886e(0x1d0)](_0x3a3137,_0x2626fd),_0x2626fd;}const _0x1be31e=_0x295f76[_0x52886e(0x1c2)][_0x52886e(0x1cb)][_0x52886e(0x15a)]||_0x3a3137,_0x4ce10b=sanitizeYamlKey(_0x1be31e)||_0x52886e(0x1b2)+_0x3a3137;let _0x1785a7=_0x4ce10b,_0x5540c8=0x2;while(_0x2f825c[_0x52886e(0x179)](_0x1785a7)){_0x1785a7=_0x4ce10b+'_'+_0x5540c8,_0x5540c8++;}_0x2f825c[_0x52886e(0x197)](_0x1785a7),_0x29d700[_0x52886e(0x1d0)](_0x416659,_0x1785a7);const _0x3226c9={'name':_0x1785a7,'isJourneyLocal':!![],'definition':_0x4d3aba};return _0x3f6cab[_0x52886e(0x1d0)](_0x3a3137,_0x3226c9),_0x3226c9;}catch(_0x1d4a5e){return _0x3d0954[_0x52886e(0x194)]&&console[_0x52886e(0x178)](_0x52886e(0x193)+_0x3a3137+':\x20'+_0x1d4a5e[_0x52886e(0x15f)]),{'name':_0x3a3137,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x46371f,_0x43fa91)=>{const _0x5be12d=_0x3e6bf1;return resolveJumpTarget(_0x46371f,_0x43fa91,_0x5e019c,_0x20ff8c=>_0x32cc23[_0x5be12d(0x147)]['getJourney'](_0x20ff8c));}},_0x22e07f=await journeyResponseToDef(_0x4d8b2b,_0x105d44);_0x3927e2[_0x3e6bf1(0x1ac)]({'item':_0x20c0f5,'yaml':_0x22e07f});}},{'verbose':_0x3d0954['verbose']});const _0x11beb7=buildMergedJourneyDef(_0x3927e2,_0x508d7e),_0x5c6f45=normalizeJourneyDef(_0x11beb7,_0x2dd577),_0xe044fd=toYamlString(_0x5c6f45),_0x256f28=_0x443a22||a18_0xd5d9ec[_0x49c479(0x126)](_0x53fa54,sanitizeFileName(_0x27ca0a)+'.yml');!_0x443a22&&_0x41511c&&!existsSync(_0x53fa54)&&mkdirSync(_0x53fa54,{'recursive':!![]});const _0x41ea90=a18_0xd5d9ec[_0x49c479(0x1cc)](process['cwd'](),_0x256f28);if(existsSync(_0x256f28)){const _0x24a68d=readFileSync(_0x256f28,_0x49c479(0x1a7)),_0x5b4cec=generateDiff(_0x24a68d,_0xe044fd),_0x6d0ec6=hasChanges(_0x5b4cec);_0x4f0579['push']({'relativePath':_0x41ea90,'absolutePath':_0x256f28,'content':_0xe044fd,'isNew':![],'hasChanges':_0x6d0ec6,'diff':_0x6d0ec6?formatDiffWithColors(_0x5b4cec):undefined});}else _0x4f0579[_0x49c479(0x1ac)]({'relativePath':_0x41ea90,'absolutePath':_0x256f28,'content':_0xe044fd,'isNew':!![],'hasChanges':![]});}const _0x249d31=_0x4f0579['filter'](_0x18a5f9=>_0x18a5f9['isNew']),_0x504ef7=_0x4f0579[_0x49c479(0x15e)](_0x47a5f6=>!_0x47a5f6[_0x49c479(0x137)]&&_0x47a5f6[_0x49c479(0x1e2)]),_0xed7be7=_0x4f0579[_0x49c479(0x15e)](_0x487b03=>!_0x487b03[_0x49c479(0x137)]&&!_0x487b03[_0x49c479(0x1e2)]),_0x34320c=_0x8fcf3[_0x49c479(0x175)],_0x275d9e=_0xdc833d[_0x49c479(0x1c4)],_0xac81f6=_0x34320c>_0x275d9e?'\x20('+_0x34320c+_0x49c479(0x145):'';console[_0x49c479(0x178)](_0x49c479(0x1b3)),console['error']('\x20\x20'+a18_0x4f3c23['cyan'](_0x275d9e+_0x49c479(0x1c9))+a18_0x4f3c23[_0x49c479(0x180)](_0xac81f6)),console['error']('\x20\x20'+a18_0x4f3c23[_0x49c479(0x19f)]('+\x20'+_0x249d31[_0x49c479(0x175)]+_0x49c479(0x12f))),console[_0x49c479(0x178)]('\x20\x20'+a18_0x4f3c23[_0x49c479(0x149)]('~\x20'+_0x504ef7[_0x49c479(0x175)]+'\x20changed\x20files')),console[_0x49c479(0x178)]('\x20\x20'+a18_0x4f3c23[_0x49c479(0x180)]('=\x20'+_0xed7be7[_0x49c479(0x175)]+_0x49c479(0x1a1))),console[_0x49c479(0x178)]('\x20\x20Target:\x20'+a18_0x4f3c23[_0x49c479(0x1ca)](_0x337ad1)+'\x0a');if(_0x504ef7[_0x49c479(0x175)]>0x0)for(const _0x4c726c of _0x504ef7){console[_0x49c479(0x178)]('\x0aChanges\x20to\x20\x27'+_0x4c726c[_0x49c479(0x164)]+'\x27:'),console[_0x49c479(0x178)]('─'[_0x49c479(0x1bb)](0x3c)),console[_0x49c479(0x178)](_0x4c726c[_0x49c479(0x14e)]),console[_0x49c479(0x178)]('─'['repeat'](0x3c));}if(_0x2f0d5b['dryRun'])return console[_0x49c479(0x178)](a18_0x4f3c23['yellow'](_0x49c479(0x19b))),0x0;if(_0x249d31[_0x49c479(0x175)]===0x0&&_0x504ef7['length']===0x0)return console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x19f)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x5a581a},_0x2f0d5b[_0x49c479(0x1e6)]),console['error'](a18_0x4f3c23[_0x49c479(0x19f)](_0x49c479(0x124)+a18_0x4f3c23[_0x49c479(0x180)](_0x49c479(0x14f))+_0x49c479(0x162)+a18_0x4f3c23[_0x49c479(0x1ca)](_0x5a581a))),0x0;if(!_0x2f0d5b['yes']&&(_0x249d31[_0x49c479(0x175)]>0x0||_0x504ef7[_0x49c479(0x175)]>0x0)){const _0x1e639d=await confirmKey(_0x49c479(0x19e)+(_0x249d31[_0x49c479(0x175)]+_0x504ef7[_0x49c479(0x175)])+_0x49c479(0x13d));if(!_0x1e639d)return console[_0x49c479(0x178)](_0x49c479(0x1e9)),0x1;}!existsSync(_0x337ad1)&&mkdirSync(_0x337ad1,{'recursive':!![]});for(const _0x3cd34f of _0x4f0579){(_0x3cd34f[_0x49c479(0x137)]||_0x3cd34f['hasChanges'])&&writeFileSync(_0x3cd34f[_0x49c479(0x11e)],_0x3cd34f[_0x49c479(0x1a5)],_0x49c479(0x1a7));}return console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x19f)]('✔\x20Pulled\x20'+(_0x249d31[_0x49c479(0x175)]+_0x504ef7[_0x49c479(0x175)])+_0x49c479(0x17b)+_0x337ad1)),saveSessionContext({'parent_segment':_0x5a581a},_0x2f0d5b[_0x49c479(0x1e6)]),console['error'](a18_0x4f3c23[_0x49c479(0x19f)](_0x49c479(0x124)+a18_0x4f3c23['dim'](_0x49c479(0x14f))+'\x20=\x20'+a18_0x4f3c23['cyan'](_0x5a581a))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]='journey:push';[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x1a3);[a18_0xc8fd7f(0x132)]=new SegmentPushCommand();async[a18_0xc8fd7f(0x1a6)](_0x5cfd35){const _0x1dae49=a18_0xc8fd7f,_0x295eb4={..._0x5cfd35,'options':{..._0x5cfd35['options'],'journeysOnly':!![]}};return this[_0x1dae49(0x132)][_0x1dae49(0x1a6)](_0x295eb4);}}
|
|
1
|
+
const a17_0x713533=a17_0x3a53;(function(_0x334b48,_0x48d015){const _0x2562f8=a17_0x3a53,_0x304b98=_0x334b48();while(!![]){try{const _0x570517=parseInt(_0x2562f8(0x13b))/0x1+-parseInt(_0x2562f8(0x103))/0x2+-parseInt(_0x2562f8(0xa5))/0x3*(-parseInt(_0x2562f8(0x8d))/0x4)+parseInt(_0x2562f8(0xfd))/0x5*(-parseInt(_0x2562f8(0x148))/0x6)+-parseInt(_0x2562f8(0x136))/0x7*(parseInt(_0x2562f8(0xf8))/0x8)+parseInt(_0x2562f8(0x92))/0x9+-parseInt(_0x2562f8(0x141))/0xa;if(_0x570517===_0x48d015)break;else _0x304b98['push'](_0x304b98['shift']());}catch(_0x1cd6cb){_0x304b98['push'](_0x304b98['shift']());}}}(a17_0x28e7,0xf0d7c));import a17_0x4e56a9 from'chalk';import a17_0x6d6377 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}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';function a17_0x3a53(_0x225081,_0x137d25){_0x225081=_0x225081-0x8b;const _0x28e75e=a17_0x28e7();let _0x3a5300=_0x28e75e[_0x225081];return _0x3a5300;}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';function formatJourneyState(_0x52a7e1){const _0x384c03=a17_0x3a53;switch(_0x52a7e1){case'launched':return a17_0x4e56a9[_0x384c03(0xeb)](_0x52a7e1);case'draft':return a17_0x4e56a9[_0x384c03(0x139)](_0x52a7e1);case _0x384c03(0xd6):return a17_0x4e56a9[_0x384c03(0x115)](_0x52a7e1);default:return _0x52a7e1;}}function formatJourneyItem(_0x11d2e0,_0x55b651='',_0x400717){const _0x2fdb65=a17_0x3a53,_0x26ffe9=formatJourneyState(_0x11d2e0[_0x2fdb65(0xa8)]),_0x480c73=_0x11d2e0[_0x2fdb65(0x140)]?a17_0x4e56a9[_0x2fdb65(0xc6)]('\x20(paused)'):'',_0x407d83=_0x400717?'\x20'+a17_0x4e56a9[_0x2fdb65(0x90)](_0x400717):'';return _0x55b651+_0x2fdb65(0x12a)+_0x11d2e0[_0x2fdb65(0x10c)]+'\x20('+_0x26ffe9+')'+_0x480c73+_0x407d83;}function escapeRegex(_0x4e1af5){const _0x4ede91=a17_0x3a53;return _0x4e1af5['replace'](/[.*+?^${}()|[\]\\]/g,_0x4ede91(0xa9));}function a17_0x28e7(){const _0x5aab31=['population','attributes','resolveParentId','goalRate','getStatistics','green','\x20\x20Preserving\x20local\x20segment\x20name:\x20','log','Parent\x20segment:\x20','dryRun','parentSegment','rule','/j/da/je','errorCode','Fetching\x20connections\x20for\x20name\x20resolution...','rootFolderId','\x20(rule\x20match)','filePath','200hXFCmG','journey:view','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)','format','No\x20statistics\x20available\x20for\x20journey:\x20','20pPdEVW','absolutePath','Write\x20','repeat','\x20\x20Statistics\x20not\x20available','resolveSegment','45302ylnbrt','json','filter','versionNumber','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','kind','segmentPushCommand','stages','Target\x20file:\x20','journeyBundleName','journeyStages','Resolving\x20parent\x20segment...','stringify','Getting\x20journey\x20details...','Resolved\x20YAML\x20file:\x20','Resuming\x20journey...','Export\x20journey(s)\x20as\x20YAML\x20files','parent_segment','dim','yes','type','getJourney','verbose','activationParams','parentName','\x20\x20Name:\x20','stageName','journeyId','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','name','site','getSegment','\x20Opening\x20','Usage:\x20journey\x20resume\x20<name-or-path>','Error:\x20','red','✔\x20Pulled\x20','entries','table','🗺️\x20','folderId','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Pause\x20a\x20running\x20journey','message','journey','Resume\x20a\x20paused\x20journey','cwd','get','Input:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','folderPath','460355bNDaUG','No\x20journeys\x20found','Listing\x20journeys...','gray','getActivation','1788833IBSulh','📁\x20','helpText','\x20journey\x20files\x20to\x20','Fetching\x20','paused','5113170fxPivd','data','isNew','diff','\x20->\x20','entered','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','1139748aOrYpx','Listing\x20folders...','conversionRate','add','split','push','values','setPhase','/e/','\x20(ID:\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','resourceName','session','hasChanges','Fetching\x20folders...','error','journey:resume','audienceId','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','resolveJourneyId','pause','Target\x20directory:\x20','execute','4EuZYKA','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','web','cyan','...','7736733msVFmt','\x20unchanged\x20files','INVALID_ARGUMENT','Error:\x20Journey\x20not\x20found:\x20','buildIdToEmailMap','Journey\x20name:\x20','List\x20journeys\x20in\x20current\x20context','Warning:\x20Stage\x20\x22','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','test','.yml','Cancelled','stage','toLowerCase','Resolving\x20journey...','Error:\x20Parent\x20segment\x20context\x20required','resume','listFolders','listJourneysFromParentSegment','3827841jftmrv','totalEntered','has','state','\x5c$&','\x22\x20paused','Fetching\x20users\x20for\x20email\x20resolution...','Found\x20','journey:pause','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Show\x20journey\x20statistics','\x22\x20not\x20found','map','/app/ps/','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Warning:\x20Could\x20not\x20resolve\x20segment\x20','file','journeyBundleId','Usage:\x20journey\x20pause\x20<name-or-path>','Folder\x20path:\x20','✔\x20Journey\x20\x22','join','relative','set','description','reentryMode','\x20\x20Parent\x20segment:\x20','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','totalGoalAchieved','length','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','connector_config','\x20=\x20','yellow','Pausing\x20journey...','find','buildIdToNameMap','segment','root\x20folder','(root)','journeyName','\x20\x20-\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','exited','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','segmentName','Usage:\x20journey\x20stats\x20<name-or-path>','goal','/j/da','archived','size','activation_','\x0aChanges\x20to\x20\x27','\x20\x20Folder\x20path:\x20','relativePath','segments','connection','\x0aPull\x20summary:','options','utf-8','\x20new\x20files','✔\x20Context\x20set:\x20','\x20\x20Consolidating\x20duplicate\x20segment:\x20','\x20journeys','✔\x20All\x20files\x20are\x20up\x20to\x20date'];a17_0x28e7=function(){return _0x5aab31;};return a17_0x28e7();}function globToRegex(_0x1acd2f){const _0x53e711=a17_0x3a53,_0xf6b235=_0x1acd2f[_0x53e711(0x14c)]('*')['map'](escapeRegex);return new RegExp(_0xf6b235[_0x53e711(0xba)]('.*'),'i');}function buildRuleToNameMapping(_0x2bad66){const _0x1acc3a=a17_0x3a53,_0x4a8d2b=new Map();if(_0x2bad66[_0x1acc3a(0xdc)])for(const [_0x40afad,_0x47873f]of Object[_0x1acc3a(0x128)](_0x2bad66[_0x1acc3a(0xdc)])){if(_0x47873f[_0x1acc3a(0xf1)]){const _0x18ee08=serializeRule(_0x47873f[_0x1acc3a(0xf1)]),_0x150d2e=_0x4a8d2b['get'](_0x18ee08);_0x150d2e?_0x150d2e[_0x1acc3a(0x14d)](_0x40afad):_0x4a8d2b[_0x1acc3a(0xbc)](_0x18ee08,[_0x40afad]);}}return _0x4a8d2b;}async function resolveJourneyTarget(_0xa80855,_0x5e617d,_0x55fe90){const _0x3957f5=a17_0x3a53;if(isYamlFilePath(_0xa80855))try{const _0x533506=await resolveYamlFilePath(_0xa80855);return _0x55fe90&&(console[_0x3957f5(0x157)](_0x3957f5(0x111)+_0xa80855),console[_0x3957f5(0x157)](_0x3957f5(0xbf)+_0x533506[_0x3957f5(0xf0)]),console[_0x3957f5(0x157)](_0x3957f5(0x11c)+_0x533506[_0x3957f5(0xd2)]),console[_0x3957f5(0x157)](_0x3957f5(0xda)+(_0x533506[_0x3957f5(0x135)]||_0x3957f5(0xcc)))),{'journeyName':_0x533506[_0x3957f5(0xd2)],'parentSegment':_0x533506[_0x3957f5(0xf0)],'resolved':_0x533506};}catch(_0x48731d){throw new SDKError(ErrorCode[_0x3957f5(0x94)],_0x3957f5(0x11f)+_0x48731d[_0x3957f5(0x12e)]);}if(!_0x5e617d)throw new SDKError(ErrorCode[_0x3957f5(0x94)],_0x3957f5(0xae));return{'journeyName':_0xa80855,'parentSegment':_0x5e617d};}export class JourneyListCommand extends BaseCommand{[a17_0x713533(0x120)]='journey:list';[a17_0x713533(0xbd)]=a17_0x713533(0x98);async[a17_0x713533(0x8c)](_0x189efd){const _0x478630=a17_0x713533,{options:_0x18fbb5,args:_0x398a54,tdx:_0x5dbd0e}=_0x189efd,_0x1aa288=_0x398a54[0x0],_0x221797=_0x18fbb5[_0x478630(0x8f)],_0x26c94b=_0x18fbb5[_0x478630(0xf0)];if(!_0x26c94b)return console[_0x478630(0x157)](_0x478630(0xa1)),console['error'](_0x478630(0x8e)),0x1;const _0x313f5b=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x5dbd0e['segment'][_0x478630(0xe8)](_0x26c94b),{'verbose':_0x18fbb5['verbose']}),_0x3e89f6=_0x313f5b[_0x478630(0x142)];_0x18fbb5[_0x478630(0x119)]&&(console['error'](_0x478630(0xee)+_0x26c94b+_0x478630(0x151)+_0x3e89f6+')'),_0x1aa288&&console['error']('Pattern:\x20'+_0x1aa288));const [_0x5c0575,_0x3da242,_0x2dad50]=await Promise['all']([withSpinner('Fetching\x20parent\x20segment...',()=>_0x5dbd0e[_0x478630(0xca)]['getParentFull'](_0x3e89f6),{'verbose':_0x18fbb5[_0x478630(0x119)]}),withSpinner(_0x478630(0x156),()=>_0x5dbd0e['segment'][_0x478630(0xa3)](_0x3e89f6),{'verbose':_0x18fbb5[_0x478630(0x119)]}),withSpinner(_0x478630(0x138),()=>_0x5dbd0e['journey'][_0x478630(0xa4)](_0x3e89f6),{'verbose':_0x18fbb5['verbose']})]),_0x29421e=_0x5c0575[_0x478630(0x142)],_0x2003da=_0x3da242[_0x478630(0x142)];let _0x1a044a=_0x2dad50[_0x478630(0x142)];const _0x3bf517=_0x29421e[_0x478630(0xf5)],_0x5ae757=new Map();for(const _0x1b26c6 of _0x2003da){_0x5ae757[_0x478630(0xbc)](_0x1b26c6['id'],_0x1b26c6[_0x478630(0x120)]);}if(_0x1aa288){const _0xcfdeb1=globToRegex(_0x1aa288);_0x1a044a=_0x1a044a[_0x478630(0x105)](_0x43ff01=>_0xcfdeb1[_0x478630(0x9b)](_0x43ff01[_0x478630(0x10c)]));}console[_0x478630(0x157)]('✔\x20Found\x20'+_0x1a044a[_0x478630(0xc2)]+'\x20journey'+(_0x1a044a[_0x478630(0xc2)]!==0x1?'s':''));const _0x34cdae=_0x42367d=>{const _0x1ba4f7=_0x478630;return getConsoleNextUrl(_0x18fbb5[_0x1ba4f7(0x121)],_0x1ba4f7(0xb2)+_0x3e89f6+'/e/'+_0x42367d+_0x1ba4f7(0xd5));};if(_0x18fbb5['format']===_0x478630(0x129))await handleSDKOutput(_0x1a044a,_0x18fbb5);else{if(_0x18fbb5[_0x478630(0xfb)]===_0x478630(0x104)){const _0x297b62=_0x1a044a[_0x478630(0xb1)](_0x4ad95b=>({..._0x4ad95b,'url':_0x34cdae(_0x4ad95b['id'])}));await handleSDKOutput(_0x297b62,_0x18fbb5);}else{console[_0x478630(0xed)]('['+_0x26c94b+']');const _0x521903=new Map(),_0x1e9882=[];for(const _0x42a151 of _0x1a044a){if(!_0x42a151[_0x478630(0x12b)]||_0x42a151[_0x478630(0x12b)]===_0x3bf517)_0x1e9882[_0x478630(0x14d)](_0x42a151);else{const _0x3a19b0=_0x521903[_0x478630(0x132)](_0x42a151[_0x478630(0x12b)])||[];_0x3a19b0[_0x478630(0x14d)](_0x42a151),_0x521903[_0x478630(0xbc)](_0x42a151[_0x478630(0x12b)],_0x3a19b0);}}for(const _0x42ef92 of _0x1e9882){const _0x2b3082=_0x221797?_0x34cdae(_0x42ef92['id']):undefined;console[_0x478630(0xed)](formatJourneyItem(_0x42ef92,'',_0x2b3082));}for(const [_0x2d7408,_0x3fb320]of _0x521903){const _0x18ad7e=_0x5ae757[_0x478630(0x132)](_0x2d7408)||_0x2d7408;console[_0x478630(0xed)](_0x478630(0x13c)+_0x18ad7e);for(const _0x28f79f of _0x3fb320){const _0x14bd69=_0x221797?_0x34cdae(_0x28f79f['id']):undefined;console[_0x478630(0xed)](formatJourneyItem(_0x28f79f,'\x20\x20',_0x14bd69));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a17_0x713533(0x120)]=a17_0x713533(0xf9);[a17_0x713533(0xbd)]='Show\x20journey\x20details';async[a17_0x713533(0x8c)](_0x3b8bda){const _0x46aa14=a17_0x713533,{options:_0x5b25c9,args:_0x1cf339,tdx:_0xbc9452}=_0x3b8bda,_0x49e6fc=_0x1cf339[0x0];if(!_0x49e6fc)return console[_0x46aa14(0x157)](_0x46aa14(0xd1)),console[_0x46aa14(0x157)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x46aa14(0x157)]('Options:'),console[_0x46aa14(0x157)](_0x46aa14(0x134)),0x1;_0x5b25c9[_0x46aa14(0x119)]&&console[_0x46aa14(0x157)](_0x46aa14(0x133)+_0x49e6fc);const _0x3f45c7=await resolveJourneyTarget(_0x49e6fc,_0x5b25c9[_0x46aa14(0xf0)],_0x5b25c9['verbose']),_0x2c6a3a=await withSpinner(_0x46aa14(0x10e),()=>_0xbc9452[_0x46aa14(0xca)]['resolveParentId'](_0x3f45c7['parentSegment']),{'verbose':_0x5b25c9[_0x46aa14(0x119)]}),_0x5bf565=_0x2c6a3a[_0x46aa14(0x142)],_0x153932=await withSpinner(_0x46aa14(0xa0),()=>_0xbc9452[_0x46aa14(0x12f)][_0x46aa14(0x15b)](_0x5bf565,_0x3f45c7[_0x46aa14(0xcd)]),{'verbose':_0x5b25c9['verbose']}),_0x242424=_0x153932[_0x46aa14(0x142)];if(_0x5b25c9[_0x46aa14(0x8f)]){const _0x314578=getConsoleNextUrl(_0x5b25c9['site'],_0x46aa14(0xb2)+_0x5bf565+_0x46aa14(0x150)+_0x242424+_0x46aa14(0xf2));return console['error'](a17_0x4e56a9[_0x46aa14(0xeb)]('✔')+_0x46aa14(0x123)+a17_0x4e56a9['cyan'](_0x314578)),openBrowser(_0x314578),0x0;}const _0x56c10a=await withSpinner(_0x46aa14(0x110),()=>_0xbc9452['journey'][_0x46aa14(0x118)](_0x242424),{'verbose':_0x5b25c9['verbose']}),_0x21a567=_0x56c10a[_0x46aa14(0x142)],_0x385b0a=_0x5b25c9['includeStats'];let _0x1076f8;if(_0x385b0a)try{const _0x22e63d=await withSpinner('Getting\x20journey\x20statistics...',()=>_0xbc9452['journey'][_0x46aa14(0xea)](_0x242424),{'verbose':_0x5b25c9[_0x46aa14(0x119)]});_0x1076f8=_0x22e63d[_0x46aa14(0x142)];}catch{_0x5b25c9['verbose']&&console[_0x46aa14(0x157)](_0x46aa14(0x101));}const _0x25f374=getConsoleNextUrl(_0x5b25c9['site'],_0x46aa14(0xb2)+_0x5bf565+_0x46aa14(0x150)+_0x242424+_0x46aa14(0xf2)),_0x2636c9={'id':_0x21a567['id'],'name':_0x21a567[_0x46aa14(0xe7)][_0x46aa14(0x120)],'description':_0x21a567[_0x46aa14(0xe7)][_0x46aa14(0xbd)],'state':_0x21a567[_0x46aa14(0xe7)][_0x46aa14(0xa8)],'paused':_0x21a567[_0x46aa14(0xe7)]['paused'],'reentry_mode':_0x21a567[_0x46aa14(0xe7)][_0x46aa14(0xbe)],'stages':_0x21a567[_0x46aa14(0xe7)][_0x46aa14(0x10d)]?.[_0x46aa14(0xc2)]||0x0,..._0x21a567[_0x46aa14(0xe7)][_0x46aa14(0xd4)]&&{'goal':_0x21a567[_0x46aa14(0xe7)][_0x46aa14(0xd4)][_0x46aa14(0x120)]},..._0x1076f8&&{'statistics':{'total_entered':_0x1076f8['totalEntered'],'goal_achieved':_0x1076f8[_0x46aa14(0xc1)],'goal_rate':_0x1076f8[_0x46aa14(0xe9)],'stages':_0x1076f8[_0x46aa14(0x10a)]}},'url':_0x25f374};return await handleSingleObjectOutput(_0x2636c9,_0x5b25c9),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a17_0x713533(0x120)]='journey:stats';['description']=a17_0x713533(0xaf);async[a17_0x713533(0x8c)](_0x529dbc){const _0x72e015=a17_0x713533,{options:_0x55e364,args:_0xd6a606,tdx:_0x3b8fd8}=_0x529dbc,_0x29eb12=_0xd6a606[0x0];if(!_0x29eb12)return console[_0x72e015(0x157)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x72e015(0xd3)),0x1;_0x55e364[_0x72e015(0x119)]&&console[_0x72e015(0x157)](_0x72e015(0x133)+_0x29eb12);const _0x41c434=await resolveJourneyTarget(_0x29eb12,_0x55e364[_0x72e015(0xf0)],_0x55e364[_0x72e015(0x119)]),_0x51e627=await withSpinner(_0x72e015(0x10e),()=>_0x3b8fd8['segment'][_0x72e015(0xe8)](_0x41c434['parentSegment']),{'verbose':_0x55e364[_0x72e015(0x119)]}),_0xa3543c=_0x51e627[_0x72e015(0x142)],_0x2e013e=await withSpinner(_0x72e015(0xa0),()=>_0x3b8fd8[_0x72e015(0x12f)][_0x72e015(0x15b)](_0xa3543c,_0x41c434[_0x72e015(0xcd)]),{'verbose':_0x55e364[_0x72e015(0x119)]}),_0x1a0028=_0x2e013e['data'],_0x5ea266=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x3b8fd8[_0x72e015(0x12f)][_0x72e015(0xea)](_0x1a0028),{'verbose':_0x55e364[_0x72e015(0x119)]}),_0x7e8d15=_0x5ea266[_0x72e015(0x142)];if(!_0x7e8d15||_0x7e8d15[_0x72e015(0x11e)]===null)return console[_0x72e015(0x157)](_0x72e015(0xfc)+_0x41c434['journeyName']),console[_0x72e015(0x157)](_0x72e015(0xc0)),0x0;const _0x2dc413={'journey_id':_0x7e8d15[_0x72e015(0x11e)],'total_entered':_0x7e8d15[_0x72e015(0xa6)],'goal_achieved':_0x7e8d15[_0x72e015(0xc1)],'goal_rate':_0x7e8d15[_0x72e015(0xe9)],'stages':_0x7e8d15[_0x72e015(0x10a)]?.[_0x72e015(0xb1)](_0x39be7f=>({'name':_0x39be7f[_0x72e015(0x11d)],'population':_0x39be7f['population'],'entered':_0x39be7f[_0x72e015(0x146)],'exited':_0x39be7f['exited'],'conversion_rate':_0x39be7f[_0x72e015(0x14a)]}))},_0x2757f8=_0x55e364[_0x72e015(0x9e)];if(_0x2757f8&&_0x7e8d15[_0x72e015(0x10a)]){const _0x421350=_0x7e8d15['stages'][_0x72e015(0xc8)](_0x47c803=>_0x47c803['stageName'][_0x72e015(0x9f)]()===_0x2757f8[_0x72e015(0x9f)]());if(_0x421350)return await handleSingleObjectOutput({'stage_name':_0x421350[_0x72e015(0x11d)],'population':_0x421350[_0x72e015(0xe6)],'entered':_0x421350[_0x72e015(0x146)],'exited':_0x421350[_0x72e015(0xd0)],'conversion_rate':_0x421350['conversionRate']},_0x55e364),0x0;console[_0x72e015(0x157)](_0x72e015(0x99)+_0x2757f8+_0x72e015(0xb0));}return await handleSingleObjectOutput(_0x2dc413,_0x55e364),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a17_0x713533(0x120)]=a17_0x713533(0xad);[a17_0x713533(0xbd)]=a17_0x713533(0x12d);async[a17_0x713533(0x8c)](_0x3e2298){const _0x3eaaee=a17_0x713533,{options:_0x54aab1,args:_0x1747bf,tdx:_0x6b00d0}=_0x3e2298,_0x16ad88=_0x1747bf[0x0];if(!_0x16ad88)return console[_0x3eaaee(0x157)](_0x3eaaee(0xd1)),console[_0x3eaaee(0x157)](_0x3eaaee(0xb7)),0x1;_0x54aab1[_0x3eaaee(0x119)]&&console[_0x3eaaee(0x157)]('Input:\x20'+_0x16ad88);const _0x5a180d=await resolveJourneyTarget(_0x16ad88,_0x54aab1[_0x3eaaee(0xf0)],_0x54aab1[_0x3eaaee(0x119)]),_0x2f14f7=await withSpinner(_0x3eaaee(0x10e),()=>_0x6b00d0[_0x3eaaee(0xca)][_0x3eaaee(0xe8)](_0x5a180d[_0x3eaaee(0xf0)]),{'verbose':_0x54aab1[_0x3eaaee(0x119)]}),_0x3b2cac=_0x2f14f7[_0x3eaaee(0x142)],_0x3d0510=await withSpinner('Resolving\x20journey...',()=>_0x6b00d0[_0x3eaaee(0x12f)]['resolveJourneyId'](_0x3b2cac,_0x5a180d['journeyName']),{'verbose':_0x54aab1[_0x3eaaee(0x119)]}),_0x342a15=_0x3d0510[_0x3eaaee(0x142)];if(!_0x54aab1['yes']){const _0xc0eb35=await confirm(_0x3eaaee(0xc3)+_0x5a180d[_0x3eaaee(0xcd)]+'\x22?');if(!_0xc0eb35)return console[_0x3eaaee(0x157)]('Cancelled'),0x0;}const _0x80bf5c=await withSpinner(_0x3eaaee(0xc7),()=>_0x6b00d0[_0x3eaaee(0x12f)][_0x3eaaee(0x15c)](_0x342a15),{'verbose':_0x54aab1['verbose']}),_0x1b49ed=_0x80bf5c[_0x3eaaee(0x142)];return console[_0x3eaaee(0x157)](_0x3eaaee(0xb9)+_0x1b49ed[_0x3eaaee(0xe7)][_0x3eaaee(0x120)]+_0x3eaaee(0xaa)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a17_0x713533(0x120)]=a17_0x713533(0x158);['description']=a17_0x713533(0x130);async[a17_0x713533(0x8c)](_0x24a311){const _0x5610da=a17_0x713533,{options:_0x117533,args:_0x35c9e1,tdx:_0x12e4b8}=_0x24a311,_0x263a3b=_0x35c9e1[0x0];if(!_0x263a3b)return console[_0x5610da(0x157)](_0x5610da(0xd1)),console[_0x5610da(0x157)](_0x5610da(0x124)),0x1;_0x117533['verbose']&&console[_0x5610da(0x157)](_0x5610da(0x133)+_0x263a3b);const _0x5a4e75=await resolveJourneyTarget(_0x263a3b,_0x117533[_0x5610da(0xf0)],_0x117533[_0x5610da(0x119)]),_0x5dc24b=await withSpinner(_0x5610da(0x10e),()=>_0x12e4b8[_0x5610da(0xca)][_0x5610da(0xe8)](_0x5a4e75[_0x5610da(0xf0)]),{'verbose':_0x117533[_0x5610da(0x119)]}),_0x5d9748=_0x5dc24b[_0x5610da(0x142)],_0x1d9302=await withSpinner(_0x5610da(0xa0),()=>_0x12e4b8[_0x5610da(0x12f)][_0x5610da(0x15b)](_0x5d9748,_0x5a4e75['journeyName']),{'verbose':_0x117533[_0x5610da(0x119)]}),_0x23caf3=_0x1d9302['data'];if(!_0x117533['yes']){const _0x44426c=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x5a4e75[_0x5610da(0xcd)]+'\x22?');if(!_0x44426c)return console[_0x5610da(0x157)](_0x5610da(0x9d)),0x0;}const _0x4abe72=await withSpinner(_0x5610da(0x112),()=>_0x12e4b8[_0x5610da(0x12f)][_0x5610da(0xa2)](_0x23caf3),{'verbose':_0x117533[_0x5610da(0x119)]}),_0x160aab=_0x4abe72[_0x5610da(0x142)];return console[_0x5610da(0x157)](_0x5610da(0xb9)+_0x160aab[_0x5610da(0xe7)][_0x5610da(0x120)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a17_0x713533(0x120)]='journey:pull';[a17_0x713533(0xbd)]=a17_0x713533(0x113);async[a17_0x713533(0x8c)](_0x2d990e){const _0x39c59e=a17_0x713533,{options:_0x18d75e,args:_0x5b0150,tdx:_0x2cbad4}=_0x2d990e,_0x5214d6=_0x18d75e,_0x38e270=_0x5b0150[0x0],_0x1f7738=_0x38e270&&isYamlFilePath(_0x38e270),_0x25df82=await resolveTarget({'arg':_0x1f7738?_0x38e270:undefined,'contextParent':_0x18d75e[_0x39c59e(0xf0)],'cwd':process[_0x39c59e(0x131)]()});if(!isSuccessfulResolution(_0x25df82))return _0x25df82[_0x39c59e(0xf3)]==='no_parent'?(console[_0x39c59e(0x157)](a17_0x4e56a9['yellow'](_0x39c59e(0x12c))),console['error'](_0x39c59e(0xfa)),console[_0x39c59e(0x157)](_0x39c59e(0xb3)),console['error'](_0x39c59e(0xcf)),console[_0x39c59e(0x157)](_0x39c59e(0x147))):(console['error'](a17_0x4e56a9[_0x39c59e(0x126)](_0x39c59e(0x125)+_0x25df82[_0x39c59e(0x12e)]+'\x0a')),_0x25df82[_0x39c59e(0x13d)]&&console[_0x39c59e(0x157)](a17_0x4e56a9[_0x39c59e(0x90)](_0x25df82[_0x39c59e(0x13d)]))),0x1;let _0x2a9b06=_0x1f7738?undefined:_0x38e270,_0x18f89e,_0x429c27;_0x25df82[_0x39c59e(0x117)]===_0x39c59e(0xb5)&&(_0x2a9b06=_0x25df82[_0x39c59e(0x153)],_0x18f89e=_0x25df82[_0x39c59e(0xf7)],_0x429c27=_0x25df82[_0x39c59e(0x135)]);const _0x1efdc5=_0x25df82[_0x39c59e(0x11b)],_0x463772=_0x25df82['targetDir'];_0x5214d6['verbose']&&(console[_0x39c59e(0x157)]('Parent\x20segment:\x20'+_0x1efdc5),console[_0x39c59e(0x157)](_0x39c59e(0x8b)+_0x463772),_0x2a9b06&&console[_0x39c59e(0x157)](_0x39c59e(0x97)+_0x2a9b06),_0x18f89e&&console[_0x39c59e(0x157)](_0x39c59e(0x10b)+_0x18f89e),_0x429c27&&console['error'](_0x39c59e(0xb8)+_0x429c27));const _0x374e51=await withSpinner(_0x39c59e(0x10e),()=>_0x2cbad4[_0x39c59e(0xca)][_0x39c59e(0xe8)](_0x1efdc5),{'verbose':_0x18d75e[_0x39c59e(0x119)]}),_0x2435d0=_0x374e51[_0x39c59e(0x142)],[_0x167060,_0x424c2b]=await Promise['all']([withSpinner(_0x39c59e(0x138),()=>_0x2cbad4['journey'][_0x39c59e(0xa4)](_0x2435d0),{'verbose':_0x18d75e[_0x39c59e(0x119)]}),withSpinner(_0x39c59e(0x149),()=>_0x2cbad4[_0x39c59e(0xca)][_0x39c59e(0xa3)](_0x2435d0),{'verbose':_0x18d75e['verbose']})]);let _0x167a02=_0x167060['data'];const _0xce31b7=_0x424c2b[_0x39c59e(0x142)],_0x4aa830=buildFolderIdToPathMap(_0xce31b7);if(_0x2a9b06){const _0x580ce7=_0x167a02[_0x39c59e(0x105)](_0xf3d2d6=>_0xf3d2d6[_0x39c59e(0x10c)][_0x39c59e(0x9f)]()===_0x2a9b06[_0x39c59e(0x9f)]());if(_0x580ce7[_0x39c59e(0xc2)]===0x0)return console[_0x39c59e(0x157)](_0x39c59e(0x95)+_0x2a9b06),console[_0x39c59e(0x157)](_0x39c59e(0x9a)),0x1;_0x167a02=_0x580ce7;}if(_0x429c27!==undefined){const _0x25d732=_0x167a02[_0x39c59e(0x105)](_0x2f47a9=>{const _0x2e7e43=_0x39c59e,_0x2740da=_0x2f47a9[_0x2e7e43(0x12b)]?_0x4aa830['get'](_0x2f47a9[_0x2e7e43(0x12b)])||'':'';return _0x2740da===_0x429c27;});if(_0x25d732[_0x39c59e(0xc2)]===0x0&&_0x167a02[_0x39c59e(0xc2)]>0x0){console[_0x39c59e(0x157)]('Error:\x20Journey\x20\x27'+_0x2a9b06+'\x27\x20not\x20found\x20in\x20'+(_0x429c27||_0x39c59e(0xcb))),console[_0x39c59e(0x157)](_0x39c59e(0x107));for(const _0x1e6e36 of _0x167a02){const _0xede03a=_0x1e6e36[_0x39c59e(0x12b)]?_0x4aa830['get'](_0x1e6e36[_0x39c59e(0x12b)])||'':'';console[_0x39c59e(0x157)](_0x39c59e(0xce)+(_0xede03a||_0x39c59e(0xcc))+'/'+_0x1e6e36[_0x39c59e(0x10c)]);}return 0x1;}_0x167a02=_0x25d732;}if(_0x167a02[_0x39c59e(0xc2)]===0x0)return console[_0x39c59e(0x157)](_0x39c59e(0x137)),0x0;const _0x1d1c06=new Map();for(const _0x142657 of _0x167a02){const _0x4e573d=_0x142657[_0x39c59e(0xb6)];!_0x1d1c06['has'](_0x4e573d)&&_0x1d1c06[_0x39c59e(0xbc)](_0x4e573d,[]),_0x1d1c06['get'](_0x4e573d)[_0x39c59e(0x14d)](_0x142657);}for(const _0x1ea95e of _0x1d1c06[_0x39c59e(0x14e)]()){_0x1ea95e['sort']((_0x842572,_0x2c24da)=>(_0x842572[_0x39c59e(0x106)]||0x0)-(_0x2c24da[_0x39c59e(0x106)]||0x0));}const _0x5e1a02=[],[_0x2afdff,_0x3e7223]=await Promise['all']([withSpinner(_0x39c59e(0xab),()=>_0x2cbad4['user'][_0x39c59e(0x96)](),{'verbose':_0x18d75e[_0x39c59e(0x119)]})['then'](_0x33e34a=>_0x33e34a['data']),withSpinner(_0x39c59e(0xf4),()=>_0x2cbad4[_0x39c59e(0xdd)][_0x39c59e(0xc9)](),{'verbose':_0x18d75e[_0x39c59e(0x119)]})['then'](_0x113123=>_0x113123['data'])]);for(const _0x16da32 of _0x1d1c06[_0x39c59e(0x14e)]()){const _0x10111b=_0x16da32[0x0][_0x39c59e(0x10c)],_0x243b77=_0x16da32[0x0][_0x39c59e(0x12b)],_0x365883=_0x243b77?_0x4aa830[_0x39c59e(0x132)](_0x243b77)||'':'',_0x24aa23=_0x365883?a17_0x6d6377[_0x39c59e(0xba)](_0x463772,_0x365883):_0x463772,_0x2de9a8=_0x18f89e||a17_0x6d6377['join'](_0x24aa23,sanitizeFileName(_0x10111b)+_0x39c59e(0x9c));let _0x4b4eb2,_0x3fc805;if(existsSync(_0x2de9a8))try{const _0x381f3e=readFileSync(_0x2de9a8,_0x39c59e(0xe0)),_0x3ba92e=parseYamlString(_0x381f3e);_0x3fc805=_0x3ba92e,_0x4b4eb2=buildRuleToNameMapping(_0x3ba92e),_0x5214d6['verbose']&&_0x4b4eb2[_0x39c59e(0xd7)]>0x0&&console['error'](_0x39c59e(0xac)+_0x4b4eb2[_0x39c59e(0xd7)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x10111b);}catch(_0x43dd79){_0x5214d6[_0x39c59e(0x119)]&&console[_0x39c59e(0x157)]('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x43dd79[_0x39c59e(0x12e)]);}const _0xb76996=[],_0x191660=new Set(),_0x43bdaf=new Map(),_0x1746eb=new Map(),_0x58a1bf=new Set(),_0x225c39=new Map(),_0x52daa9=new Map(),_0x4ccc34=createJumpTargetCache();await withProgressSpinner(_0x39c59e(0x13f)+_0x10111b+_0x39c59e(0x91),async _0x450492=>{const _0x38425e=_0x39c59e;for(const _0x4d8d75 of _0x16da32){const _0x2c2830=_0x16da32[_0x38425e(0xc2)]>0x1?_0x4d8d75['journeyBundleName']+'\x20v'+(_0x4d8d75[_0x38425e(0x106)]||0x1):_0x4d8d75['journeyBundleName'];_0x450492[_0x38425e(0x14f)]('Fetching\x20'+_0x2c2830);const _0x1985a4=await _0x2cbad4['journey']['getJourney'](_0x4d8d75['id']),_0x5d8462=_0x1985a4[_0x38425e(0xe7)]?.[_0x38425e(0x159)],_0x408baa={'resolveSegment':async _0x206a0d=>{const _0x31f1b8=_0x38425e;if(!_0x5d8462)return{'name':_0x206a0d,'isJourneyLocal':![]};const _0x3f1460=_0x43bdaf[_0x31f1b8(0x132)](_0x206a0d);if(_0x3f1460)return _0x3f1460;try{const _0x12dddd=await _0x2cbad4['segment'][_0x31f1b8(0x122)](_0x5d8462,_0x206a0d),_0x23d31b=_0x12dddd[_0x31f1b8(0x108)]===SEGMENT_KIND_JOURNEY;let _0x56fd56,_0x2c838d=_0x12dddd['name'];if(_0x23d31b&&_0x12dddd[_0x31f1b8(0xf1)]){const _0x3ea294=await segmentResponseToDef(_0x12dddd,{'resolveSegmentName':async _0x3ba078=>{const _0x4838ad=_0x31f1b8,_0x25163c=_0x43bdaf['get'](_0x3ba078);if(_0x25163c)return _0x25163c[_0x4838ad(0x120)];const _0x192ee4=await _0x408baa[_0x4838ad(0x102)](_0x3ba078);return _0x192ee4['name'];}}),_0x10f16b=_0x3ea294[_0x31f1b8(0xf1)];_0x56fd56={'description':_0x12dddd[_0x31f1b8(0xbd)],'rule':_0x10f16b};const _0x5b2145=serializeRule(_0x10f16b),_0x4cd44a=_0x1746eb[_0x31f1b8(0x132)](_0x5b2145);if(_0x4cd44a)_0x2c838d=_0x4cd44a,_0x56fd56=undefined,_0x5214d6[_0x31f1b8(0x119)]&&console[_0x31f1b8(0x157)](_0x31f1b8(0xe3)+_0x12dddd[_0x31f1b8(0x120)]+_0x31f1b8(0x145)+_0x4cd44a);else{let _0x237760=![];if(_0x4b4eb2){const _0x286a7a=_0x4b4eb2['get'](_0x5b2145);if(_0x286a7a){const _0x2bc060=_0x286a7a[_0x31f1b8(0xc8)](_0x33ef66=>!_0x191660['has'](_0x33ef66));_0x2bc060&&(_0x2c838d=_0x2bc060,_0x191660[_0x31f1b8(0x14b)](_0x2bc060),_0x1746eb['set'](_0x5b2145,_0x2bc060),_0x237760=!![],_0x5214d6[_0x31f1b8(0x119)]&&console['error'](_0x31f1b8(0xec)+_0x2bc060+_0x31f1b8(0xf6)));}}if(!_0x237760){const _0x1aedf4=generateJourneyLocalName(_0x12dddd[_0x31f1b8(0x120)]);_0x1aedf4&&(_0x2c838d=_0x1aedf4);let _0xbfe64d=_0x2c838d,_0xe29d8b=0x2;while(_0x191660[_0x31f1b8(0xa7)](_0xbfe64d)){_0xbfe64d=_0x2c838d+'_'+_0xe29d8b,_0xe29d8b++;}_0x191660['add'](_0xbfe64d),_0x1746eb[_0x31f1b8(0xbc)](_0x5b2145,_0xbfe64d),_0x2c838d=_0xbfe64d;}}}const _0x567132={'name':_0x2c838d,'isJourneyLocal':_0x23d31b,'definition':_0x56fd56};return _0x43bdaf[_0x31f1b8(0xbc)](_0x206a0d,_0x567132),_0x567132;}catch(_0x576884){return _0x18d75e['verbose']&&console[_0x31f1b8(0x157)](_0x31f1b8(0xb4)+_0x206a0d+':\x20'+_0x576884[_0x31f1b8(0x12e)]),{'name':_0x206a0d,'isJourneyLocal':![]};}},'resolveActivation':async _0x539b08=>{const _0x291b6c=_0x38425e,_0x1627d2=_0x225c39[_0x291b6c(0x132)](_0x539b08);if(_0x1627d2)return _0x1627d2;try{const _0x543184=await _0x2cbad4[_0x291b6c(0x12f)][_0x291b6c(0x13a)](_0x4d8d75['id'],_0x539b08),_0x545f0d=journeyActivationStepToYaml(_0x543184,_0x2afdff,_0x3e7223),_0x2cb611=JSON[_0x291b6c(0x10f)]({'name':_0x545f0d[_0x291b6c(0x120)],'connection':_0x545f0d[_0x291b6c(0xdd)],'connector_config':_0x545f0d[_0x291b6c(0xc4)]}),_0x568143=_0x52daa9[_0x291b6c(0x132)](_0x2cb611);if(_0x568143){const _0x451f73={'name':_0x568143,'isJourneyLocal':!![],'definition':_0x545f0d};return _0x225c39['set'](_0x539b08,_0x451f73),_0x451f73;}const _0x39484c=_0x543184[_0x291b6c(0xe7)][_0x291b6c(0x11a)][_0x291b6c(0x120)]||_0x539b08,_0x5f3108=sanitizeYamlKey(_0x39484c)||_0x291b6c(0xd8)+_0x539b08;let _0x5596ce=_0x5f3108,_0x8ea28f=0x2;while(_0x58a1bf['has'](_0x5596ce)){_0x5596ce=_0x5f3108+'_'+_0x8ea28f,_0x8ea28f++;}_0x58a1bf['add'](_0x5596ce),_0x52daa9[_0x291b6c(0xbc)](_0x2cb611,_0x5596ce);const _0x496ecc={'name':_0x5596ce,'isJourneyLocal':!![],'definition':_0x545f0d};return _0x225c39[_0x291b6c(0xbc)](_0x539b08,_0x496ecc),_0x496ecc;}catch(_0x4b3982){return _0x18d75e[_0x291b6c(0x119)]&&console['error'](_0x291b6c(0x152)+_0x539b08+':\x20'+_0x4b3982[_0x291b6c(0x12e)]),{'name':_0x539b08,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x5967ae,_0x5475d1)=>{const _0xe2315b=_0x38425e;return resolveJumpTarget(_0x5967ae,_0x5475d1,_0x4ccc34,_0x2a45d5=>_0x2cbad4[_0xe2315b(0x12f)]['getJourney'](_0x2a45d5));}},_0x1df13c=await journeyResponseToDef(_0x1985a4,_0x408baa);_0xb76996['push']({'item':_0x4d8d75,'yaml':_0x1df13c});}},{'verbose':_0x18d75e[_0x39c59e(0x119)]});const _0x459125=buildMergedJourneyDef(_0xb76996,_0x4b4eb2),_0x5e0d14=normalizeJourneyDef(_0x459125,_0x3fc805),_0xa221c=toYamlString(_0x5e0d14),_0x339bf8=_0x18f89e||a17_0x6d6377['join'](_0x24aa23,sanitizeFileName(_0x10111b)+_0x39c59e(0x9c));!_0x18f89e&&_0x365883&&!existsSync(_0x24aa23)&&mkdirSync(_0x24aa23,{'recursive':!![]});const _0x30b960=a17_0x6d6377[_0x39c59e(0xbb)](process[_0x39c59e(0x131)](),_0x339bf8);if(existsSync(_0x339bf8)){const _0x3a58f5=readFileSync(_0x339bf8,_0x39c59e(0xe0)),_0x3af122=generateDiff(_0x3a58f5,_0xa221c),_0x3afa00=hasChanges(_0x3af122);_0x5e1a02[_0x39c59e(0x14d)]({'relativePath':_0x30b960,'absolutePath':_0x339bf8,'content':_0xa221c,'isNew':![],'hasChanges':_0x3afa00,'diff':_0x3afa00?formatDiffWithColors(_0x3af122):undefined});}else _0x5e1a02[_0x39c59e(0x14d)]({'relativePath':_0x30b960,'absolutePath':_0x339bf8,'content':_0xa221c,'isNew':!![],'hasChanges':![]});}const _0x63e8f3=_0x5e1a02[_0x39c59e(0x105)](_0x3c4145=>_0x3c4145[_0x39c59e(0x143)]),_0x649c87=_0x5e1a02[_0x39c59e(0x105)](_0x4f614d=>!_0x4f614d[_0x39c59e(0x143)]&&_0x4f614d[_0x39c59e(0x155)]),_0x14778d=_0x5e1a02[_0x39c59e(0x105)](_0x1d5dda=>!_0x1d5dda[_0x39c59e(0x143)]&&!_0x1d5dda[_0x39c59e(0x155)]),_0x53d975=_0x167a02[_0x39c59e(0xc2)],_0x21d32d=_0x1d1c06[_0x39c59e(0xd7)],_0x2d71da=_0x53d975>_0x21d32d?'\x20('+_0x53d975+'\x20versions)':'';console['error'](_0x39c59e(0xde)),console[_0x39c59e(0x157)]('\x20\x20'+a17_0x4e56a9[_0x39c59e(0x90)](_0x21d32d+_0x39c59e(0xe4))+a17_0x4e56a9['dim'](_0x2d71da)),console['error']('\x20\x20'+a17_0x4e56a9[_0x39c59e(0xeb)]('+\x20'+_0x63e8f3[_0x39c59e(0xc2)]+_0x39c59e(0xe1))),console[_0x39c59e(0x157)]('\x20\x20'+a17_0x4e56a9['yellow']('~\x20'+_0x649c87['length']+'\x20changed\x20files')),console[_0x39c59e(0x157)]('\x20\x20'+a17_0x4e56a9[_0x39c59e(0x115)]('=\x20'+_0x14778d[_0x39c59e(0xc2)]+_0x39c59e(0x93))),console[_0x39c59e(0x157)]('\x20\x20Target:\x20'+a17_0x4e56a9[_0x39c59e(0x90)](_0x463772)+'\x0a');if(_0x649c87[_0x39c59e(0xc2)]>0x0)for(const _0x33c6f4 of _0x649c87){console[_0x39c59e(0x157)](_0x39c59e(0xd9)+_0x33c6f4[_0x39c59e(0xdb)]+'\x27:'),console[_0x39c59e(0x157)]('─'[_0x39c59e(0x100)](0x3c)),console[_0x39c59e(0x157)](_0x33c6f4[_0x39c59e(0x144)]),console['error']('─'[_0x39c59e(0x100)](0x3c));}if(_0x5214d6[_0x39c59e(0xef)])return console[_0x39c59e(0x157)](a17_0x4e56a9[_0x39c59e(0xc6)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x63e8f3['length']===0x0&&_0x649c87[_0x39c59e(0xc2)]===0x0)return console[_0x39c59e(0x157)](a17_0x4e56a9[_0x39c59e(0xeb)](_0x39c59e(0xe5))),saveSessionContext({'parent_segment':_0x1efdc5},_0x5214d6[_0x39c59e(0x154)]),console['error'](a17_0x4e56a9[_0x39c59e(0xeb)](_0x39c59e(0xe2)+a17_0x4e56a9['dim'](_0x39c59e(0x114))+_0x39c59e(0xc5)+a17_0x4e56a9[_0x39c59e(0x90)](_0x1efdc5))),0x0;if(!_0x5214d6[_0x39c59e(0x116)]&&(_0x63e8f3[_0x39c59e(0xc2)]>0x0||_0x649c87['length']>0x0)){const _0x253d85=await confirmKey(_0x39c59e(0xff)+(_0x63e8f3[_0x39c59e(0xc2)]+_0x649c87[_0x39c59e(0xc2)])+'\x20files?');if(!_0x253d85)return console[_0x39c59e(0x157)]('Aborted.'),0x1;}!existsSync(_0x463772)&&mkdirSync(_0x463772,{'recursive':!![]});for(const _0x5ce14f of _0x5e1a02){(_0x5ce14f[_0x39c59e(0x143)]||_0x5ce14f[_0x39c59e(0x155)])&&writeFileSync(_0x5ce14f[_0x39c59e(0xfe)],_0x5ce14f['content'],_0x39c59e(0xe0));}return console['error'](a17_0x4e56a9[_0x39c59e(0xeb)](_0x39c59e(0x127)+(_0x63e8f3['length']+_0x649c87[_0x39c59e(0xc2)])+_0x39c59e(0x13e)+_0x463772)),saveSessionContext({'parent_segment':_0x1efdc5},_0x5214d6['session']),console[_0x39c59e(0x157)](a17_0x4e56a9[_0x39c59e(0xeb)](_0x39c59e(0xe2)+a17_0x4e56a9[_0x39c59e(0x115)](_0x39c59e(0x114))+_0x39c59e(0xc5)+a17_0x4e56a9['cyan'](_0x1efdc5))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a17_0x713533(0x120)]='journey:push';[a17_0x713533(0xbd)]=a17_0x713533(0x15a);['segmentPushCommand']=new SegmentPushCommand();async[a17_0x713533(0x8c)](_0x485869){const _0x4ba993=a17_0x713533,_0x3e0f40={..._0x485869,'options':{..._0x485869[_0x4ba993(0xdf)],'journeysOnly':!![]}};return this[_0x4ba993(0x109)][_0x4ba993(0x8c)](_0x3e0f40);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a18_0x5de00c=a18_0x1b6f;function a18_0x1b6f(_0x3a9122,_0x465efd){_0x3a9122=_0x3a9122-0x105;const _0x3f80d8=a18_0x3f80();let _0x1b6fcd=_0x3f80d8[_0x3a9122];return _0x1b6fcd;}(function(_0x28c674,_0x5c6658){const _0x171346=a18_0x1b6f,_0x5e43d6=_0x28c674();while(!![]){try{const _0x53a0cb=-parseInt(_0x171346(0x120))/0x1*(-parseInt(_0x171346(0x119))/0x2)+-parseInt(_0x171346(0x122))/0x3+parseInt(_0x171346(0x105))/0x4+parseInt(_0x171346(0x11f))/0x5*(parseInt(_0x171346(0x135))/0x6)+parseInt(_0x171346(0x123))/0x7*(-parseInt(_0x171346(0x10f))/0x8)+-parseInt(_0x171346(0x10a))/0x9+parseInt(_0x171346(0x126))/0xa;if(_0x53a0cb===_0x5c6658)break;else _0x5e43d6['push'](_0x5e43d6['shift']());}catch(_0x20a3ac){_0x5e43d6['push'](_0x5e43d6['shift']());}}}(a18_0x3f80,0x60c9f));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a18_0x3f80(){const _0x3443cb=['No\x20journey\x20YAML\x20files\x20found\x20in\x20','skippedCount','journey','dim','976Ckdbmp','warningCount','filter','verbose','helpText','length','.yaml','type','targetDir','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','249510NnxuEd','cwd','red','\x20journey(s)\x20with\x20errors,\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','hasErrors','5945XJzhPy','1vVdPNi','reason','1935924xrwrgn','40558TPpemf','errors','errorCode','10008690AJScMx','parentSegment','warnings','endsWith','valid','validCount','error','yellow','✔\x20All\x20','green','Error:\x20','\x20segment\x20file(s)\x20skipped','journey:validate','no_parent','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','834mCTvxW','message','cyan','.yml','\x20journey(s)\x20valid','invalidCount','\x20(skipped:\x20','2345268GYctPj','log','name','\x20warning(s)','\x20error(s)','1157301pbqARF'];a18_0x3f80=function(){return _0x3443cb;};return a18_0x3f80();}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a18_0x363c47 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{[a18_0x5de00c(0x107)]=a18_0x5de00c(0x132);['description']='Validate\x20journey\x20YAML\x20files';async['execute'](_0x96715e){const _0xa9a661=a18_0x5de00c,{options:_0xe7a8e7,args:_0x24ef8b}=_0x96715e,_0xaddb5b=_0xe7a8e7,_0x2ab678=await resolveTarget({'arg':_0x24ef8b[0x0],'contextParent':_0xe7a8e7[_0xa9a661(0x127)],'cwd':process[_0xa9a661(0x11a)]()});if(!isSuccessfulResolution(_0x2ab678))return _0x2ab678[_0xa9a661(0x125)]===_0xa9a661(0x133)?(console['error'](a18_0x363c47[_0xa9a661(0x12d)](_0xa9a661(0x134))),console[_0xa9a661(0x12c)](_0xa9a661(0x118)),console[_0xa9a661(0x12c)]('\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'),console[_0xa9a661(0x12c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0xa9a661(0x12c)](a18_0x363c47[_0xa9a661(0x11b)](_0xa9a661(0x130)+_0x2ab678[_0xa9a661(0x136)]+'\x0a')),_0x2ab678[_0xa9a661(0x113)]&&console[_0xa9a661(0x12c)](a18_0x363c47[_0xa9a661(0x137)](_0x2ab678[_0xa9a661(0x113)]))),0x1;const _0x18c4be=_0x2ab678[_0xa9a661(0x117)],_0x12b757=_0x2ab678[_0xa9a661(0x116)]==='file'?_0x2ab678['filePath']:undefined;if(!_0x12b757&&!existsSync(_0x18c4be))return console[_0xa9a661(0x12c)](a18_0x363c47['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x18c4be+'\x0a')),0x1;let _0x2cd1ca;if(_0x12b757){if(!_0x12b757[_0xa9a661(0x129)](_0xa9a661(0x138))&&!_0x12b757['endsWith'](_0xa9a661(0x115)))return console[_0xa9a661(0x12c)](a18_0x363c47[_0xa9a661(0x11b)](_0xa9a661(0x11d)+_0x12b757+'\x0a')),0x1;_0x2cd1ca=[_0x12b757];}else _0x2cd1ca=findYamlFiles(_0x18c4be);if(_0x2cd1ca['length']===0x0)return console[_0xa9a661(0x12c)](a18_0x363c47[_0xa9a661(0x11b)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x18c4be+'\x0a')),0x1;const _0x1bb6c7=validateYamlFiles(_0x2cd1ca,_0x18c4be,{'filterType':_0xa9a661(0x10d)}),_0x4c3767=calculateSummary(_0x1bb6c7),_0x55ff06=_0x1bb6c7[_0xa9a661(0x111)](isValidationResult);if(_0x55ff06[_0xa9a661(0x114)]===0x0)return console[_0xa9a661(0x12c)](a18_0x363c47['yellow'](_0xa9a661(0x10b)+_0x18c4be+'\x0a')),_0x4c3767['skippedCount']>0x0&&console[_0xa9a661(0x12c)](a18_0x363c47['dim']('('+_0x4c3767[_0xa9a661(0x10c)]+'\x20segment\x20file(s)\x20skipped)')),0x0;for(const _0x5a8398 of _0x1bb6c7){if(!isValidationResult(_0x5a8398)){_0xaddb5b[_0xa9a661(0x112)]&&console[_0xa9a661(0x106)](a18_0x363c47[_0xa9a661(0x10e)]('-\x20'+_0x5a8398['relativePath']+_0xa9a661(0x13b)+_0x5a8398[_0xa9a661(0x121)]+')'));continue;}const {relativePath:_0x16dd75,source:_0x373e8d,result:_0x13d1f4}=_0x5a8398;if(_0x13d1f4[_0xa9a661(0x12a)]&&_0x13d1f4[_0xa9a661(0x128)][_0xa9a661(0x114)]===0x0)_0xaddb5b[_0xa9a661(0x112)]&&console['log'](a18_0x363c47['green']('✔\x20'+_0x16dd75));else _0x13d1f4['valid']?(console[_0xa9a661(0x106)](a18_0x363c47[_0xa9a661(0x12d)]('⚠\x20'+_0x16dd75+':\x20'+_0x13d1f4[_0xa9a661(0x128)][_0xa9a661(0x114)]+_0xa9a661(0x108))),console['log'](formatValidationResult(_0x13d1f4,_0x373e8d,_0x16dd75))):(console[_0xa9a661(0x106)](a18_0x363c47[_0xa9a661(0x11b)]('✖\x20'+_0x16dd75+':\x20'+_0x13d1f4[_0xa9a661(0x124)][_0xa9a661(0x114)]+_0xa9a661(0x109))),console['log'](formatValidationResult(_0x13d1f4,_0x373e8d,_0x16dd75)));}return console[_0xa9a661(0x106)](''),_0x4c3767[_0xa9a661(0x11e)]?(console['log'](a18_0x363c47['red']('Validation\x20failed:\x20'+_0x4c3767[_0xa9a661(0x13a)]+_0xa9a661(0x11c)+_0x4c3767[_0xa9a661(0x12b)]+'\x20valid')),_0x4c3767[_0xa9a661(0x110)]>0x0&&console[_0xa9a661(0x106)](a18_0x363c47['yellow'](_0x4c3767['warningCount']+'\x20warning(s)\x20found')),_0x4c3767[_0xa9a661(0x10c)]>0x0&&console[_0xa9a661(0x106)](a18_0x363c47[_0xa9a661(0x10e)](_0x4c3767[_0xa9a661(0x10c)]+_0xa9a661(0x131))),0x1):(console['log'](a18_0x363c47[_0xa9a661(0x12f)](_0xa9a661(0x12e)+_0x4c3767[_0xa9a661(0x12b)]+_0xa9a661(0x139))),_0x4c3767[_0xa9a661(0x110)]>0x0&&console[_0xa9a661(0x106)](a18_0x363c47[_0xa9a661(0x12d)](_0x4c3767[_0xa9a661(0x110)]+'\x20warning(s)\x20found')),_0x4c3767[_0xa9a661(0x10c)]>0x0&&console[_0xa9a661(0x106)](a18_0x363c47[_0xa9a661(0x10e)](_0x4c3767['skippedCount']+_0xa9a661(0x131))),0x0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a20_0x4b3ec7=a20_0x1da8;(function(_0x260039,_0x39df1b){const _0xd49b61=a20_0x1da8,_0x5a2b51=_0x260039();while(!![]){try{const _0x92728=parseInt(_0xd49b61(0x1f5))/0x1*(-parseInt(_0xd49b61(0x1e5))/0x2)+parseInt(_0xd49b61(0x21a))/0x3*(parseInt(_0xd49b61(0x1ae))/0x4)+parseInt(_0xd49b61(0x234))/0x5+-parseInt(_0xd49b61(0x1cd))/0x6*(-parseInt(_0xd49b61(0x1fb))/0x7)+parseInt(_0xd49b61(0x22b))/0x8+parseInt(_0xd49b61(0x1e6))/0x9*(-parseInt(_0xd49b61(0x1b2))/0xa)+-parseInt(_0xd49b61(0x277))/0xb*(parseInt(_0xd49b61(0x1e2))/0xc);if(_0x92728===_0x39df1b)break;else _0x5a2b51['push'](_0x5a2b51['shift']());}catch(_0x373812){_0x5a2b51['push'](_0x5a2b51['shift']());}}}(a20_0x4810,0x2c358));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*as a20_0x538975 from'node:fs';function handleSDKError(_0x533718,_0x531877){const _0x5bbc71=a20_0x1da8;if(_0x533718 instanceof SDKError)console[_0x5bbc71(0x25c)](_0x5bbc71(0x1c3)+_0x533718[_0x5bbc71(0x228)]),_0x531877['verbose']&&(_0x533718[_0x5bbc71(0x1fd)]&&console[_0x5bbc71(0x25c)](_0x5bbc71(0x217)+_0x533718[_0x5bbc71(0x1fd)]),_0x533718[_0x5bbc71(0x23f)]&&(console[_0x5bbc71(0x25c)](_0x5bbc71(0x1f4)),console[_0x5bbc71(0x25c)](_0x533718[_0x5bbc71(0x23f)])));else throw _0x533718;}function formatChatHistoryEntry(_0x425220,_0x1e703c){const _0x46be5c=a20_0x1da8,_0x4546f9=getChalk(_0x1e703c),_0x460999=_0x4546f9[_0x46be5c(0x1f0)](_0x425220['at']);if(_0x46be5c(0x26e)in _0x425220){const _0x57b803=_0x4546f9[_0x46be5c(0x262)]('[input]\x20\x20');return _0x460999+'\x20'+_0x57b803+':\x20'+_0x425220[_0x46be5c(0x26e)];}if('content'in _0x425220){const _0x2424ad=_0x4546f9[_0x46be5c(0x227)](_0x46be5c(0x22f));return _0x460999+'\x20'+_0x2424ad+':\x20'+_0x425220[_0x46be5c(0x253)];}if(_0x46be5c(0x1ca)in _0x425220){const _0x392230=_0x4546f9[_0x46be5c(0x231)](_0x46be5c(0x275)),{functionName:_0x5a8154,functionArguments:_0x591566,targetFunction:_0x502505}=_0x425220['tool_call'];let _0x37a5b4=_0x460999+'\x20'+_0x392230+':\x20'+_0x4546f9[_0x46be5c(0x26f)](_0x5a8154);if(_0x591566&&Object[_0x46be5c(0x20a)](_0x591566)['length']>0x0){const _0xa00c09=Object['entries'](_0x591566)[_0x46be5c(0x1f3)](([_0x28abc8,_0x4d2907])=>_0x28abc8+'='+JSON[_0x46be5c(0x207)](_0x4d2907))[_0x46be5c(0x1d4)](',\x20');_0x37a5b4+='('+_0xa00c09+')';}_0x502505&&(_0x37a5b4+=_0x4546f9['dim']('\x20['+_0x502505+']'));let _0x3cdc29='';if(_0x425220[_0x46be5c(0x1ca)][_0x46be5c(0x25a)])_0x3cdc29='\x20->\x20KB:'+_0x425220[_0x46be5c(0x1ca)][_0x46be5c(0x25a)][_0x46be5c(0x1d7)];else{if(_0x425220[_0x46be5c(0x1ca)][_0x46be5c(0x1cb)])_0x3cdc29=_0x46be5c(0x27b)+_0x425220[_0x46be5c(0x1ca)][_0x46be5c(0x1cb)][_0x46be5c(0x1d7)];else{if(_0x425220[_0x46be5c(0x1ca)][_0x46be5c(0x210)])_0x3cdc29='\x20->\x20WebSearch:'+_0x425220[_0x46be5c(0x1ca)]['targetWebSearchTool'][_0x46be5c(0x1d7)];else _0x425220[_0x46be5c(0x1ca)][_0x46be5c(0x220)]&&(_0x3cdc29=_0x46be5c(0x213)+_0x425220['tool_call']['targetImageGenerator'][_0x46be5c(0x1d7)]);}}return _0x37a5b4+_0x3cdc29;}if('tool'in _0x425220){const _0x3d040a=_0x4546f9[_0x46be5c(0x1be)](_0x46be5c(0x1f7)),{functionName:_0x40d6bc,functionArguments:_0x1eb911,content:_0x2f6238,newChat:_0x2295df}=_0x425220[_0x46be5c(0x1e1)];let _0x244d44=_0x460999+'\x20'+_0x3d040a+':\x20'+_0x4546f9['bold'](_0x40d6bc);if(_0x1eb911){const _0x390bc3=typeof _0x1eb911===_0x46be5c(0x1aa)?_0x1eb911:JSON[_0x46be5c(0x207)](_0x1eb911);_0x244d44+='('+_0x390bc3+')';}return _0x2f6238&&(_0x244d44+='\x0a'+_0x4546f9[_0x46be5c(0x1f0)](_0x2f6238)),_0x2295df&&(_0x244d44+=_0x4546f9['dim'](_0x46be5c(0x205)+_0x2295df['id'])),_0x244d44;}if(_0x46be5c(0x1d2)in _0x425220){const _0x41aee5=_0x4546f9[_0x46be5c(0x261)]('[output]\x20');return _0x460999+'\x20'+_0x41aee5+':\x20'+_0x425220[_0x46be5c(0x1d2)][_0x46be5c(0x1d7)]+'\x20('+_0x425220[_0x46be5c(0x1d2)]['content'][_0x46be5c(0x273)]+_0x46be5c(0x1b9);}if('image'in _0x425220){const _0x11140d=_0x4546f9['blue'](_0x46be5c(0x1d8)),{width:_0x24a114,height:_0x30f102,headerText:_0x22bd6d}=_0x425220['image'],_0x808665=_0x22bd6d?_0x46be5c(0x230)+_0x22bd6d:'';return _0x460999+'\x20'+_0x11140d+':\x20'+_0x24a114+'x'+_0x30f102+_0x808665;}if(_0x46be5c(0x25c)in _0x425220){const _0x33b458=_0x4546f9['red']('[error]\x20\x20');return _0x460999+'\x20'+_0x33b458+':\x20'+_0x425220[_0x46be5c(0x25c)];}return _0x460999+'\x20'+_0x4546f9['dim'](_0x46be5c(0x254))+':\x20'+JSON[_0x46be5c(0x207)](_0x425220);}async function executeChatHistoryCommand(_0x1ff4fa,_0x6bb902){const _0x16f35=a20_0x1da8,{options:_0x37e386,args:_0xc96ec6,tdx:_0x40d45b}=_0x1ff4fa,_0x42d65d=_0xc96ec6[0x0],_0x4053b1=_0x37e386,_0x420afd=_0x4053b1['last'];try{if(_0x420afd&&_0x42d65d)return console[_0x16f35(0x25c)](_0x16f35(0x281)),console[_0x16f35(0x25c)]('Usage:\x20'+_0x6bb902+_0x16f35(0x238)),0x1;if(!_0x42d65d&&!_0x420afd&&_0x37e386['format']!==undefined){const _0x598386=resolveLimit(_0x37e386[_0x16f35(0x23b)],DEFAULT_LLM_LIMIT),_0x1c03a5=await withSpinner(_0x16f35(0x25b),()=>_0x40d45b[_0x16f35(0x24e)][_0x16f35(0x266)](_0x598386),{'verbose':_0x37e386['verbose']});return await handleSDKOutput(_0x1c03a5[_0x16f35(0x216)],_0x37e386),0x0;}const _0x3c2c6f=await getChatIdOrSelect(_0x40d45b,_0x37e386,_0x420afd,_0x42d65d);if(!_0x3c2c6f)return 0x0;return await displayChatHistory(_0x3c2c6f,_0x40d45b,_0x37e386),0x0;}catch(_0x14cc13){return handleSDKError(_0x14cc13,_0x37e386),0x1;}}async function displayChatHistory(_0x443a72,_0x3ece5f,_0x288982){const _0x423f0c=a20_0x1da8,_0x33e896=await withSpinner(_0x423f0c(0x1b8)+_0x443a72+'\x27...',()=>_0x3ece5f[_0x423f0c(0x24e)][_0x423f0c(0x1f1)](_0x443a72),{'verbose':_0x288982[_0x423f0c(0x249)]}),_0x40611c=_0x33e896[_0x423f0c(0x216)]['data']??[];if(_0x40611c[_0x423f0c(0x273)]===0x0){console['log']('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x288982['format']!==undefined)await handleSDKOutput(_0x40611c,_0x288982);else{const _0x11842b=_0x40611c['map'](_0x14eaaa=>formatChatHistoryEntry(_0x14eaaa,_0x288982)),_0x321d97=_0x11842b[_0x423f0c(0x1d4)]('\x0a');await writeOutput(_0x321d97,_0x288982[_0x423f0c(0x1d2)],_0x423f0c(0x27a));}}async function getChatIdOrSelect(_0x1fcbee,_0x359a29,_0x24fbc7,_0x2793f6){const _0x286172=a20_0x1da8;if(_0x2793f6)return _0x2793f6;if(_0x24fbc7){const _0x5957fd=await withSpinner(_0x286172(0x1b7),()=>_0x1fcbee[_0x286172(0x24e)][_0x286172(0x266)](0x1),{'verbose':_0x359a29[_0x286172(0x249)]});if(_0x5957fd[_0x286172(0x216)]['length']===0x0)return console['log'](_0x286172(0x263)),undefined;return _0x5957fd['data'][0x0]['id'];}const _0x288902=await selectChatInteractively(_0x1fcbee,_0x359a29);if(!_0x288902)return console[_0x286172(0x23c)](_0x286172(0x26a)),undefined;return _0x288902;}async function getProjectIdOrDefault(_0x4ae145){const _0x5aa6e4=await getProjectWithName(_0x4ae145);return _0x5aa6e4['id'];}async function getProjectWithName(_0x401732){const _0xc2fa95=a20_0x1da8,{tdx:_0x129e71,options:_0x40c7fa}=_0x401732,_0x1c5852=_0x40c7fa[_0xc2fa95(0x1f8)];if(_0x1c5852){const _0x1018d5=await withSpinner(_0xc2fa95(0x1df)+_0x1c5852+_0xc2fa95(0x286),()=>_0x129e71[_0xc2fa95(0x24e)][_0xc2fa95(0x1c8)](_0x1c5852),{'verbose':_0x40c7fa[_0xc2fa95(0x249)]});return{'id':_0x1018d5[_0xc2fa95(0x216)],'name':_0x1c5852};}const _0x3fb57b=_0x129e71[_0xc2fa95(0x24e)]['getCurrentProject']();if(_0x3fb57b){const _0x110cbb=await _0x129e71[_0xc2fa95(0x24e)][_0xc2fa95(0x1bb)](),_0x135c2e=_0x110cbb[_0xc2fa95(0x229)](_0x153fd9=>_0x153fd9['id']===_0x3fb57b);return{'id':_0x3fb57b,'name':_0x135c2e?.['attributes'][_0xc2fa95(0x1d7)]||_0xc2fa95(0x21d)};}const _0x209330=await withSpinner(_0xc2fa95(0x1e9),()=>_0x129e71[_0xc2fa95(0x24e)][_0xc2fa95(0x245)](),{'verbose':_0x40c7fa[_0xc2fa95(0x249)]});return{'id':_0x209330[_0xc2fa95(0x216)]['id'],'name':_0x209330[_0xc2fa95(0x216)][_0xc2fa95(0x20c)][_0xc2fa95(0x1d7)]};}function a20_0x1da8(_0x4439a6,_0x106042){_0x4439a6=_0x4439a6-0x1aa;const _0x481078=a20_0x4810();let _0x1da84a=_0x481078[_0x4439a6];return _0x1da84a;}function toLLMProjectInfo(_0x5f39dc){const _0x41f6fe=a20_0x1da8;return{'name':_0x5f39dc[_0x41f6fe(0x20c)][_0x41f6fe(0x1d7)],'description':_0x5f39dc[_0x41f6fe(0x20c)][_0x41f6fe(0x27f)],'createdAt':_0x5f39dc[_0x41f6fe(0x20c)][_0x41f6fe(0x1c1)],'updatedAt':_0x5f39dc[_0x41f6fe(0x20c)][_0x41f6fe(0x1fe)]};}function toAgentInfo(_0xe9911){const _0x3c6009=a20_0x1da8;return{'name':_0xe9911[_0x3c6009(0x20c)][_0x3c6009(0x1d7)],'description':_0xe9911[_0x3c6009(0x20c)][_0x3c6009(0x27f)],'prompt':truncatePrompt(_0xe9911[_0x3c6009(0x20c)][_0x3c6009(0x208)]),'createdAt':_0xe9911[_0x3c6009(0x20c)]['createdAt'],'updatedAt':_0xe9911[_0x3c6009(0x20c)]['updatedAt']};}function truncatePrompt(_0x68b99b){const _0x5d12f8=a20_0x1da8;if(!_0x68b99b)return undefined;const _0x2e041e=0x64;if(_0x68b99b['length']<=_0x2e041e)return _0x68b99b;return _0x68b99b[_0x5d12f8(0x202)](0x0,_0x2e041e)+_0x5d12f8(0x282);}export class LLMModelsCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]='llm:models';[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x1fc);async[a20_0x4b3ec7(0x239)](_0x57947a){const _0x5be5e9=a20_0x4b3ec7,{options:_0x479591,tdx:_0x169afb}=_0x57947a;try{const _0x4b8845=await withSpinner(_0x5be5e9(0x1d3),()=>_0x169afb[_0x5be5e9(0x24e)][_0x5be5e9(0x242)](),{'verbose':_0x479591[_0x5be5e9(0x249)]});return await handleSDKOutput(_0x4b8845[_0x5be5e9(0x216)],_0x479591),0x0;}catch(_0x1779be){return handleSDKError(_0x1779be,_0x479591),0x1;}}}export class LLMProjectsCommand extends BaseCommand{['name']=a20_0x4b3ec7(0x256);[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x24a);async[a20_0x4b3ec7(0x239)](_0x513859){const _0x2f7216=a20_0x4b3ec7,{options:_0x5ee332,args:_0x2311d9,tdx:_0x36e54b}=_0x513859,_0x4565fd=getChalk(_0x5ee332),_0x113f08=_0x5ee332[_0x2f7216(0x278)],_0x5499d5=_0x5ee332[_0x2f7216(0x22d)];try{const _0x305288=_0x2311d9[0x0],_0x2dcbf7=resolveLimit(_0x5ee332[_0x2f7216(0x23b)],DEFAULT_LLM_LIMIT),_0x138f21=await withSpinner('Fetching\x20projects...',()=>_0x36e54b[_0x2f7216(0x24e)]['projects'](_0x2dcbf7),{'verbose':_0x5ee332['verbose']});let _0x5448=_0x138f21[_0x2f7216(0x216)];_0x305288&&(_0x5448=_0x138f21[_0x2f7216(0x216)][_0x2f7216(0x248)](_0x4b1181=>matchGlobPattern(_0x4b1181['attributes'][_0x2f7216(0x1d7)],_0x305288)));const _0x42a650=_0x5ee332['format']===_0x2f7216(0x1d0)||_0x5ee332[_0x2f7216(0x222)]==='jsonl'||_0x5ee332[_0x2f7216(0x222)]===_0x2f7216(0x27a)||_0x5ee332[_0x2f7216(0x222)]===_0x2f7216(0x25d);if(_0x42a650){const _0x4b1644=_0x5448[_0x2f7216(0x1f3)](_0x6f07ad=>({...toLLMProjectInfo(_0x6f07ad),..._0x113f08?{'url':getLLMProjectUrl(_0x5499d5,_0x6f07ad['id'])}:{}}));await handleSDKOutput(_0x4b1644,_0x5ee332);}else{const _0x3c6472=[];if(_0x5448[_0x2f7216(0x273)]===0x0)_0x3c6472[_0x2f7216(0x1e7)](_0x4565fd[_0x2f7216(0x1f0)](_0x2f7216(0x1b6)));else{const _0x139881=[..._0x5448]['sort']((_0x20abff,_0x11814c)=>_0x20abff[_0x2f7216(0x20c)][_0x2f7216(0x1d7)]['localeCompare'](_0x11814c[_0x2f7216(0x20c)]['name']));for(const _0xa19fbe of _0x139881){if(_0x113f08){const _0x378af8=getLLMProjectUrl(_0x5499d5,_0xa19fbe['id']);_0x3c6472[_0x2f7216(0x1e7)]('⚒️\x20'+_0xa19fbe[_0x2f7216(0x20c)]['name']+'\x20\x20'+_0x4565fd['dim'](_0x378af8));}else _0x3c6472[_0x2f7216(0x1e7)]('⚒️\x20'+_0xa19fbe[_0x2f7216(0x20c)]['name']);}_0x3c6472[_0x2f7216(0x1e7)](_0x4565fd['dim'](_0x5448['length']+_0x2f7216(0x255)));}await writeOutput(_0x3c6472[_0x2f7216(0x1d4)]('\x0a'),_0x5ee332['output'],_0x2f7216(0x27a));}return 0x0;}catch(_0x89a319){return handleSDKError(_0x89a319,_0x5ee332),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]=a20_0x4b3ec7(0x23a);[a20_0x4b3ec7(0x27f)]='List\x20agents\x20in\x20current\x20project';async['execute'](_0x1fb878){const _0x3efba6=a20_0x4b3ec7,{options:_0x54dbf0,args:_0x4b65f3,tdx:_0x2842bf}=_0x1fb878,_0x17771e=getChalk(_0x54dbf0),_0x33668b=_0x54dbf0[_0x3efba6(0x278)],_0x531b88=_0x54dbf0[_0x3efba6(0x22d)];try{const _0x53b5a8=_0x4b65f3[0x0];let _0x3955a2=_0x53b5a8,_0x4c82f2,_0x25e8bd;if(_0x53b5a8&&_0x53b5a8[_0x3efba6(0x1ef)]('/')){const _0x30d968=_0x53b5a8[_0x3efba6(0x24b)]('/');if(_0x30d968[_0x3efba6(0x273)]===0x2){const [_0x4e9e9d,_0x3d7b29]=_0x30d968,_0xcba13f=await _0x2842bf[_0x3efba6(0x24e)][_0x3efba6(0x1bb)](),_0x1a9d55=_0xcba13f[_0x3efba6(0x229)](_0xc24553=>_0xc24553[_0x3efba6(0x20c)]['name'][_0x3efba6(0x27d)]()===_0x4e9e9d[_0x3efba6(0x27d)]());if(!_0x1a9d55)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x3efba6(0x1d1)+_0x4e9e9d,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x4c82f2=_0x1a9d55['id'],_0x25e8bd=_0x1a9d55[_0x3efba6(0x20c)][_0x3efba6(0x1d7)],_0x3955a2=_0x3d7b29;}else throw new SDKError(ErrorCode[_0x3efba6(0x223)],_0x3efba6(0x21b)+_0x53b5a8,undefined,{'helpText':_0x3efba6(0x1b0)});}else{const _0x32a924=await getProjectWithName(_0x1fb878);_0x4c82f2=_0x32a924['id'],_0x25e8bd=_0x32a924[_0x3efba6(0x1d7)];}const _0x222483=await withSpinner(_0x3efba6(0x1de),()=>_0x2842bf['llm'][_0x3efba6(0x243)](_0x4c82f2),{'verbose':_0x54dbf0['verbose']});let _0x10f8f5=_0x222483[_0x3efba6(0x216)];_0x3955a2&&(_0x10f8f5=_0x222483[_0x3efba6(0x216)][_0x3efba6(0x248)](_0x447c6c=>matchGlobPattern(_0x447c6c[_0x3efba6(0x20c)]['name'],_0x3955a2)));const _0x28b45b=_0x54dbf0[_0x3efba6(0x222)]===_0x3efba6(0x1d0)||_0x54dbf0['format']===_0x3efba6(0x240)||_0x54dbf0['format']===_0x3efba6(0x27a)||_0x54dbf0[_0x3efba6(0x222)]===_0x3efba6(0x25d);if(_0x28b45b){const _0x4db509=_0x10f8f5['map'](_0x2c23a9=>({...toAgentInfo(_0x2c23a9),..._0x33668b?{'chatUrl':getLLMAgentChatUrl(_0x531b88,_0x4c82f2,_0x2c23a9['id'])}:{}}));await handleSDKOutput(_0x4db509,_0x54dbf0);}else{const _0x205e2=[];_0x205e2[_0x3efba6(0x1e7)](_0x17771e[_0x3efba6(0x1f0)]('['+_0x25e8bd+']'));if(_0x10f8f5[_0x3efba6(0x273)]===0x0)_0x205e2[_0x3efba6(0x1e7)](_0x17771e['dim'](_0x3efba6(0x1ea)));else{const _0x34810a=[..._0x10f8f5][_0x3efba6(0x226)]((_0x5c4fd6,_0x55af94)=>_0x5c4fd6[_0x3efba6(0x20c)][_0x3efba6(0x1d7)][_0x3efba6(0x232)](_0x55af94[_0x3efba6(0x20c)][_0x3efba6(0x1d7)]));for(const _0x480b8d of _0x34810a){if(_0x33668b){const _0x15b7f1=getLLMAgentChatUrl(_0x531b88,_0x4c82f2,_0x480b8d['id']);_0x205e2[_0x3efba6(0x1e7)](_0x3efba6(0x237)+_0x480b8d[_0x3efba6(0x20c)]['name']+'\x20\x20'+_0x17771e[_0x3efba6(0x1f0)](_0x15b7f1));}else _0x205e2['push'](_0x3efba6(0x237)+_0x480b8d[_0x3efba6(0x20c)][_0x3efba6(0x1d7)]);}_0x205e2[_0x3efba6(0x1e7)](_0x17771e['dim'](_0x10f8f5[_0x3efba6(0x273)]+_0x3efba6(0x1d5)));}await writeOutput(_0x205e2[_0x3efba6(0x1d4)]('\x0a'),_0x54dbf0['output'],_0x3efba6(0x27a));}return 0x0;}catch(_0x5e35e3){return handleSDKError(_0x5e35e3,_0x54dbf0),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]='llm:agent:show';[a20_0x4b3ec7(0x27f)]='Show\x20agent\x20details';async[a20_0x4b3ec7(0x239)](_0x3e9645){const _0x53c223=a20_0x4b3ec7,{options:_0x29b4e4,args:_0x351fcb,tdx:_0x191742}=_0x3e9645;if(_0x351fcb['length']===0x0)return console[_0x53c223(0x25c)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x53c223(0x25c)](_0x53c223(0x26d)),0x1;const _0x5e5749=_0x351fcb[0x0];try{const _0x58d0a4=await getProjectIdOrDefault(_0x3e9645),_0x4d5345=await withSpinner(_0x53c223(0x1bc)+_0x5e5749+_0x53c223(0x286),()=>_0x191742[_0x53c223(0x24e)][_0x53c223(0x23e)](_0x5e5749,_0x58d0a4),{'verbose':_0x29b4e4[_0x53c223(0x249)]}),_0x13a038=await withSpinner(_0x53c223(0x22a),()=>_0x191742[_0x53c223(0x24e)][_0x53c223(0x269)](_0x4d5345[_0x53c223(0x216)]),{'verbose':_0x29b4e4[_0x53c223(0x249)]});return await handleSDKOutput([_0x13a038[_0x53c223(0x216)]],_0x29b4e4),0x0;}catch(_0x4d2725){return handleSDKError(_0x4d2725,_0x29b4e4),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']=a20_0x4b3ec7(0x214);[a20_0x4b3ec7(0x27f)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a20_0x4b3ec7(0x239)](_0x3af719){const _0x5e2ab9=a20_0x4b3ec7,{options:_0x30e877,args:_0x31747a,tdx:_0x25b415}=_0x3af719;if(_0x31747a[_0x5e2ab9(0x273)]===0x0)return console['error'](_0x5e2ab9(0x1dc)),console[_0x5e2ab9(0x25c)](_0x5e2ab9(0x1c7)),console[_0x5e2ab9(0x25c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x3457=_0x31747a[0x0],_0x4417a3=_0x30e877,_0x5220c4=_0x4417a3[_0x5e2ab9(0x1c9)],_0x424e7e=_0x4417a3[_0x5e2ab9(0x21f)]||_0x5e2ab9(0x24c),_0x43ca80=_0x4417a3[_0x5e2ab9(0x1dd)],_0x44850d=_0x4417a3[_0x5e2ab9(0x212)]?Number(_0x4417a3[_0x5e2ab9(0x212)]):undefined,_0x4de357=_0x4417a3[_0x5e2ab9(0x1ed)]?Number(_0x4417a3['temperature']):undefined;try{let _0x35b045,_0x13e5bd;if(_0x3457['includes']('/')){const _0x43dcb0=_0x3457[_0x5e2ab9(0x24b)]('/');if(_0x43dcb0['length']===0x2){const [_0x57c23c,_0x349e83]=_0x43dcb0,_0x27eb50=await withSpinner(_0x5e2ab9(0x1df)+_0x57c23c+_0x5e2ab9(0x286),()=>_0x25b415[_0x5e2ab9(0x24e)]['resolveProjectId'](_0x57c23c),{'verbose':_0x30e877[_0x5e2ab9(0x249)]});_0x35b045=_0x27eb50[_0x5e2ab9(0x216)],_0x13e5bd=_0x349e83;}else throw new SDKError(ErrorCode[_0x5e2ab9(0x223)],'Invalid\x20path\x20syntax:\x20'+_0x3457,undefined,{'helpText':_0x5e2ab9(0x1b0)});}else _0x35b045=await getProjectIdOrDefault(_0x3af719),_0x13e5bd=_0x3457;const _0x229617=await withSpinner(_0x5e2ab9(0x1e4)+_0x13e5bd+_0x5e2ab9(0x286),()=>_0x25b415['llm'][_0x5e2ab9(0x218)]({'name':_0x13e5bd,'projectId':_0x35b045,'modelType':_0x424e7e,'systemPrompt':_0x5220c4,'starterMessage':_0x43ca80,'maxToolIterations':_0x44850d,'temperature':_0x4de357}),{'verbose':_0x30e877[_0x5e2ab9(0x249)]});return console['log']('Agent\x20created:\x20'+_0x229617['data']['id']),await handleSDKOutput([_0x229617[_0x5e2ab9(0x216)]],_0x30e877),0x0;}catch(_0x192240){return handleSDKError(_0x192240,_0x30e877),0x1;}}}function a20_0x4810(){const _0x14c75a=['\x20→\x20chat:\x20','Load\x20more...','stringify','prompt','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','keys','Project\x20created:\x20','attributes','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','yes','llm:project:restore','targetWebSearchTool','existsSync','maxToolIterations','\x20->\x20ImageGen:','llm:agent:create','select','data','\x20\x20Cause:\x20','createAgent','Backup\x20cancelled.','708whXKXG','Invalid\x20path\x20syntax:\x20','knowledgeBases','Unknown','chatId','model','targetImageGenerator','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','format','INVALID_ARGUMENT','(no\x20agent)','restoreProject','sort','green','message','find','Fetching\x20agent...','2415896VYeLlk','h\x20ago','site','\x20\x20Agents:\x20','[content]','\x20-\x20','yellow','localeCompare','outputDir','825020itDspi','\x20\x20Integrations:\x20','rmSync','🤖\x20','\x20--last','execute','llm:agents','limit','log','\x20\x20Knowledge\x20Bases:\x20','resolveAgentId','stack','jsonl','dryRun','models','agents','Setting\x20project\x20context\x20to\x20\x27','getOrCreateDefaultProject','llm:use','createProject','filter','verbose','List\x20all\x20LLM\x20projects','split','claude-4.5-haiku','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','llm','exportedFrom','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','short','Analyzing\x20project\x20\x27','content','[unknown]','\x20project(s)','llm:projects','counts','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','getTime','targetKnowledgeBase','Fetching\x20chat\x20sessions...','error','tsv','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','Delete\x20an\x20LLM\x20project','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','blue','cyan','No\x20chat\x20sessions\x20found.','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','Agent\x20updated:\x20','chats','Checking\x20for\x20existing\x20projects...','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','agent','\x0aCancelled','Error:\x20Project\x20name\x20is\x20required','m\x20ago','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','input','bold','llm:project:backup','llm:agent:delete','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','length','prompts','[tool_call]','firstInputContent','11kXeXpJ','web','updateAgent','table','\x20->\x20Agent:','Updating\x20agent...','toLowerCase','Validating\x20backup\x20from\x20\x27','description','en-US','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','...','\x20\x20Prompts:\x20','agentId','Select\x20a\x20chat\x20session:','\x27...','string','floor','Project\x20deleted:\x20','Create\x20a\x20new\x20LLM\x20project','2876IXGsOw','default','Use\x20format:\x20project-name/agent-name','set','10jNgfLM','Deleting\x20project\x20\x27','sourceSite','numeric','No\x20projects\x20found','Fetching\x20most\x20recent\x20chat...','Fetching\x20chat\x20history\x20for\x20\x27','\x20bytes)','substring','projects','Resolving\x20agent\x20\x27','Project\x20context\x20set\x20to:\x20','magenta','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','integrations','createdAt','toLocaleDateString','Error:\x20','\x27\x20already\x20exists.\x20Overwrite?','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','Restore\x20cancelled.','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','resolveProjectId','systemPrompt','tool_call','targetAgent','tdx\x20chats','6QHWkMo','getBackupMetadata','Update\x20an\x20existing\x20agent','json','Project\x20not\x20found:\x20','output','Fetching\x20available\x20models...','join','\x20agent(s)','Deleting\x20agent...','name','[image]\x20\x20','llm:agent:update','projectId','llm:project:create','Error:\x20Agent\x20name\x20is\x20required','starterMessage','Fetching\x20agents...','Resolving\x20project\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','tool','2714928LKeOMZ','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','Creating\x20agent\x20\x27','8LVRXPE','2944764ALbpTq','push','llm:history','Getting\x20default\x20project...','No\x20agents\x20found','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','projectName','temperature','Output\x20directory\x20\x27','includes','dim','history','Set\x20current\x20project\x20context','map','\x0aStack\x20trace:','64217DBDcXE','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','[tool]\x20\x20\x20','llmProject','deleteProject','llm:project:delete','2482991QOeFfq','List\x20available\x20LLM\x20models','cause','updatedAt','__load_more__','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','Usage:\x20tdx\x20llm\x20use\x20<project-name>','slice','Agent\x20deleted:\x20','Project\x20backed\x20up\x20to:\x20'];a20_0x4810=function(){return _0x14c75a;};return a20_0x4810();}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]=a20_0x4b3ec7(0x1d9);[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x1cf);async['execute'](_0x10fc0d){const _0x567109=a20_0x4b3ec7,{options:_0x5e6053,args:_0x578cd4,tdx:_0x2ab6e4}=_0x10fc0d;if(_0x578cd4['length']===0x0)return console[_0x567109(0x25c)](_0x567109(0x1dc)),console[_0x567109(0x25c)](_0x567109(0x1e0)),0x1;const _0x59e832=_0x578cd4[0x0],_0x5c47c0=_0x5e6053,_0x31b47b=_0x5c47c0['name'],_0x165b49=_0x5c47c0[_0x567109(0x208)],_0x2f893c=_0x5c47c0['description'],_0x14022=_0x5c47c0['starterMessage'];if(!_0x31b47b&&!_0x165b49&&!_0x2f893c&&!_0x14022)return console[_0x567109(0x25c)](_0x567109(0x20d)),console[_0x567109(0x25c)](_0x567109(0x1f6)),0x1;try{const _0x348e64=await getProjectIdOrDefault(_0x10fc0d),_0x2b61b8=await withSpinner('Resolving\x20agent\x20\x27'+_0x59e832+_0x567109(0x286),()=>_0x2ab6e4[_0x567109(0x24e)]['resolveAgentId'](_0x59e832,_0x348e64),{'verbose':_0x5e6053[_0x567109(0x249)]}),_0x3886b8=_0x2b61b8[_0x567109(0x216)],_0x5269ab=await withSpinner(_0x567109(0x27c),()=>_0x2ab6e4[_0x567109(0x24e)][_0x567109(0x279)](_0x3886b8,{'name':_0x31b47b,'prompt':_0x165b49,'description':_0x2f893c,'starterMessage':_0x14022}),{'verbose':_0x5e6053[_0x567109(0x249)]});return console[_0x567109(0x23c)](_0x567109(0x265)+_0x5269ab[_0x567109(0x216)]['id']),await handleSDKOutput([_0x5269ab[_0x567109(0x216)]],_0x5e6053),0x0;}catch(_0x319b06){return handleSDKError(_0x319b06,_0x5e6053),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]=a20_0x4b3ec7(0x271);['description']='Delete\x20an\x20agent';async['execute'](_0x8be5ed){const _0x2b9524=a20_0x4b3ec7,{options:_0x1c62fd,args:_0x5edf51,tdx:_0x384398}=_0x8be5ed;if(_0x5edf51[_0x2b9524(0x273)]===0x0)return console[_0x2b9524(0x25c)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x2b9524(0x25c)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x2d4838=_0x5edf51[0x0];try{const _0x4aa0e7=await getProjectIdOrDefault(_0x8be5ed),_0x1ae58e=await withSpinner(_0x2b9524(0x1bc)+_0x2d4838+'\x27...',()=>_0x384398[_0x2b9524(0x24e)][_0x2b9524(0x23e)](_0x2d4838,_0x4aa0e7),{'verbose':_0x1c62fd[_0x2b9524(0x249)]}),_0x375616=_0x1ae58e[_0x2b9524(0x216)];return await withSpinner(_0x2b9524(0x1d6),()=>_0x384398[_0x2b9524(0x24e)]['deleteAgent'](_0x375616),{'verbose':_0x1c62fd[_0x2b9524(0x249)]}),console[_0x2b9524(0x23c)](_0x2b9524(0x203)+_0x375616),0x0;}catch(_0xa3b047){return handleSDKError(_0xa3b047,_0x1c62fd),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a20_0x4b3ec7(0x1e8);['description']='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async[a20_0x4b3ec7(0x239)](_0x4c510e){return executeChatHistoryCommand(_0x4c510e,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]=a20_0x4b3ec7(0x246);[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x1f2);async['execute'](_0x296ce2){const _0x2b4615=a20_0x4b3ec7,{options:_0x403849,args:_0x9c62e2,tdx:_0x2ace31}=_0x296ce2;if(_0x9c62e2[_0x2b4615(0x273)]===0x0)return console['error'](_0x2b4615(0x26b)),console[_0x2b4615(0x25c)](_0x2b4615(0x201)),0x1;const _0x27b45c=_0x9c62e2[0x0];try{return await withSpinner(_0x2b4615(0x244)+_0x27b45c+'\x27...',()=>_0x2ace31[_0x2b4615(0x24e)]['setCurrentProject'](_0x27b45c),{'verbose':_0x403849['verbose']}),console[_0x2b4615(0x23c)](_0x2b4615(0x1bd)+_0x27b45c),0x0;}catch(_0x5b26b6){return handleSDKError(_0x5b26b6,_0x403849),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]=a20_0x4b3ec7(0x1db);[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x1ad);async[a20_0x4b3ec7(0x239)](_0x21fe8c){const _0x799cb3=a20_0x4b3ec7,{options:_0x9be630,args:_0x56032f,tdx:_0x41e402}=_0x21fe8c;if(_0x56032f[_0x799cb3(0x273)]===0x0)return console['error'](_0x799cb3(0x26b)),console[_0x799cb3(0x25c)](_0x799cb3(0x1eb)),0x1;const _0x557bc2=_0x56032f[0x0],_0x1bd07e=_0x9be630,_0x52c49c=_0x1bd07e[_0x799cb3(0x27f)];try{const _0x2d994e=await withSpinner('Creating\x20project\x20\x27'+_0x557bc2+_0x799cb3(0x286),()=>_0x41e402[_0x799cb3(0x24e)][_0x799cb3(0x247)]({'name':_0x557bc2,'description':_0x52c49c}),{'verbose':_0x9be630[_0x799cb3(0x249)]});console[_0x799cb3(0x23c)](_0x799cb3(0x20b)+_0x2d994e['data']['id']);const _0x4d998c=toLLMProjectInfo(_0x2d994e['data']);return await handleSDKOutput([_0x4d998c],_0x9be630),0x0;}catch(_0x3cb3a8){return handleSDKError(_0x3cb3a8,_0x9be630),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x4b3ec7(0x1d7)]=a20_0x4b3ec7(0x1fa);[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x25f);async['execute'](_0x41d713){const _0x155c01=a20_0x4b3ec7,{options:_0x1b2dbb,args:_0x245a47,tdx:_0x442e76}=_0x41d713;if(_0x245a47[_0x155c01(0x273)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x155c01(0x25e)),0x1;const _0x491f34=_0x245a47[0x0];try{return await withSpinner(_0x155c01(0x1b3)+_0x491f34+_0x155c01(0x286),()=>_0x442e76[_0x155c01(0x24e)][_0x155c01(0x1f9)](_0x491f34),{'verbose':_0x1b2dbb[_0x155c01(0x249)]}),console[_0x155c01(0x23c)](_0x155c01(0x1ac)+_0x491f34),0x0;}catch(_0x205b3d){return handleSDKError(_0x205b3d,_0x1b2dbb),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a20_0x4b3ec7(0x270);[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x24d);async['execute'](_0xea3fed){const _0xe12bb5=a20_0x4b3ec7,{options:_0x52fc4c,args:_0x305beb,tdx:_0x1e992b}=_0xea3fed,_0x48290f=getChalk(_0x52fc4c);console[_0xe12bb5(0x23c)](_0x48290f[_0xe12bb5(0x231)](_0xe12bb5(0x200))),console[_0xe12bb5(0x23c)](_0x48290f[_0xe12bb5(0x231)]('\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.')),console[_0xe12bb5(0x23c)](_0x48290f[_0xe12bb5(0x1f0)](_0xe12bb5(0x268))),console[_0xe12bb5(0x23c)]();if(_0x305beb[_0xe12bb5(0x273)]===0x0)return console[_0xe12bb5(0x25c)](_0xe12bb5(0x26b)),console[_0xe12bb5(0x25c)](_0xe12bb5(0x1bf)),0x1;const _0x5275c2=_0x305beb[0x0],_0x49f008=_0x52fc4c,_0x3ce908=_0x49f008[_0xe12bb5(0x1d2)],_0x21e81b=_0x49f008[_0xe12bb5(0x241)];try{const _0x2612a0=_0x3ce908||_0x5275c2+'.llm';if(a20_0x538975[_0xe12bb5(0x211)](_0x2612a0)&&!_0x21e81b){if(!_0x52fc4c[_0xe12bb5(0x20e)]){const _0x357167=await confirm(_0xe12bb5(0x1ee)+_0x2612a0+_0xe12bb5(0x1c4));if(!_0x357167)return console[_0xe12bb5(0x23c)](_0xe12bb5(0x219)),0x0;}a20_0x538975[_0xe12bb5(0x236)](_0x2612a0,{'recursive':!![]});}const _0xa4e341=await withSpinner(_0x21e81b?_0xe12bb5(0x252)+_0x5275c2+'\x27...':'Backing\x20up\x20project\x20\x27'+_0x5275c2+_0xe12bb5(0x286),()=>_0x1e992b[_0xe12bb5(0x24e)]['backupProject'](_0x5275c2,_0x3ce908,{'dryRun':_0x21e81b}),{'verbose':_0x52fc4c['verbose']}),_0x3c6924=_0xa4e341[_0xe12bb5(0x216)];return _0x21e81b?console['log'](_0xe12bb5(0x1c5)+_0x3c6924[_0xe12bb5(0x233)]):console['log'](_0xe12bb5(0x204)+_0x3c6924[_0xe12bb5(0x233)]),console[_0xe12bb5(0x23c)](_0xe12bb5(0x22e)+_0x3c6924['counts'][_0xe12bb5(0x243)]),console['log'](_0xe12bb5(0x23d)+_0x3c6924[_0xe12bb5(0x257)][_0xe12bb5(0x21c)]),console[_0xe12bb5(0x23c)](_0xe12bb5(0x283)+_0x3c6924[_0xe12bb5(0x257)][_0xe12bb5(0x274)]),console[_0xe12bb5(0x23c)](_0xe12bb5(0x235)+_0x3c6924[_0xe12bb5(0x257)][_0xe12bb5(0x1c0)]),(_0x52fc4c['format']===_0xe12bb5(0x1d0)||_0x52fc4c[_0xe12bb5(0x222)]===_0xe12bb5(0x240))&&await handleSDKOutput([_0x3c6924],_0x52fc4c),0x0;}catch(_0x4a3f12){return handleSDKError(_0x4a3f12,_0x52fc4c),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']=a20_0x4b3ec7(0x20f);[a20_0x4b3ec7(0x27f)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a20_0x4b3ec7(0x239)](_0x4fd26b){const _0x35ab93=a20_0x4b3ec7,{options:_0x1528f6,args:_0x519860,tdx:_0x90d935}=_0x4fd26b,_0x1cf780=getChalk(_0x1528f6);console[_0x35ab93(0x23c)](_0x1cf780[_0x35ab93(0x231)](_0x35ab93(0x221))),console[_0x35ab93(0x23c)](_0x1cf780[_0x35ab93(0x231)](_0x35ab93(0x1e3))),console[_0x35ab93(0x23c)](_0x1cf780['dim']('\x20\x20\x20Examples:')),console['log'](_0x1cf780[_0x35ab93(0x1f0)](_0x35ab93(0x264))),console[_0x35ab93(0x23c)](_0x1cf780['dim'](_0x35ab93(0x250))),console[_0x35ab93(0x23c)]();if(_0x519860[_0x35ab93(0x273)]===0x0)return console[_0x35ab93(0x25c)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x35ab93(0x25c)](_0x35ab93(0x258)),0x1;const _0x41be75=_0x519860[0x0],_0x4fbcad=_0x1528f6,_0x1bf583=_0x4fbcad[_0x35ab93(0x1d7)],_0xee201a=_0x4fbcad['dryRun'];try{if(!_0xee201a){const _0x2b57fc=_0x90d935[_0x35ab93(0x24e)][_0x35ab93(0x1ce)](_0x41be75),_0x24a77d=_0x1bf583||_0x2b57fc[_0x35ab93(0x24f)][_0x35ab93(0x1ec)],_0x45eb49=await withSpinner(_0x35ab93(0x267),()=>_0x90d935[_0x35ab93(0x24e)][_0x35ab93(0x1bb)](),{'verbose':_0x1528f6[_0x35ab93(0x249)]}),_0x285bba=_0x45eb49[_0x35ab93(0x216)][_0x35ab93(0x229)](_0x245d6e=>_0x245d6e['attributes'][_0x35ab93(0x1d7)]===_0x24a77d);if(_0x285bba&&!_0x1528f6['yes']){const _0xc28761=await confirm('A\x20project\x20named\x20\x27'+_0x24a77d+_0x35ab93(0x260));if(!_0xc28761)return console[_0x35ab93(0x23c)](_0x35ab93(0x1c6)),0x0;}}const _0x28e5b3=await withSpinner(_0xee201a?_0x35ab93(0x27e)+_0x41be75+'\x27...':'Restoring\x20project\x20from\x20\x27'+_0x41be75+'\x27...',()=>_0x90d935[_0x35ab93(0x24e)][_0x35ab93(0x225)](_0x41be75,{'name':_0x1bf583,'dryRun':_0xee201a}),{'verbose':_0x1528f6[_0x35ab93(0x249)]}),_0x4feed6=_0x28e5b3[_0x35ab93(0x216)];return _0x4feed6[_0x35ab93(0x1b4)]&&console[_0x35ab93(0x23c)](_0x35ab93(0x209)+_0x4feed6['sourceSite']+'\x27'),_0xee201a?console['log']('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x4feed6['projectName']):console[_0x35ab93(0x23c)]('Project\x20restored:\x20'+_0x4feed6['projectName']+'\x20('+_0x4feed6[_0x35ab93(0x1da)]+')'),console[_0x35ab93(0x23c)](_0x35ab93(0x22e)+_0x4feed6[_0x35ab93(0x257)][_0x35ab93(0x243)]),console[_0x35ab93(0x23c)](_0x35ab93(0x23d)+_0x4feed6[_0x35ab93(0x257)][_0x35ab93(0x21c)]),console[_0x35ab93(0x23c)]('\x20\x20Prompts:\x20'+_0x4feed6[_0x35ab93(0x257)][_0x35ab93(0x274)]),console[_0x35ab93(0x23c)](_0x35ab93(0x235)+_0x4feed6[_0x35ab93(0x257)][_0x35ab93(0x1c0)]),(_0x1528f6[_0x35ab93(0x222)]==='json'||_0x1528f6[_0x35ab93(0x222)]===_0x35ab93(0x240))&&await handleSDKOutput([_0x4feed6],_0x1528f6),0x0;}catch(_0x3fa08f){return handleSDKError(_0x3fa08f,_0x1528f6),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x1f581c,_0x3d79bd){const _0x49824d=a20_0x4b3ec7,_0x4d1186=_0x3d79bd[_0x49824d(0x23b)]||CHAT_SELECTOR_PAGE_SIZE;let _0x4b8503=0x0,_0x474c7b=[];const _0xf5da4e=(await import(_0x49824d(0x274)))[_0x49824d(0x1af)],_0x25b047=getChalk(_0x3d79bd);while(!![]){const _0x4d2817=await withSpinner(_0x49824d(0x25b),()=>_0x1f581c[_0x49824d(0x24e)][_0x49824d(0x266)](_0x4d1186+_0x4b8503),{'verbose':_0x3d79bd[_0x49824d(0x249)]});_0x474c7b=_0x4d2817[_0x49824d(0x216)];const _0x43f816=_0x474c7b['slice'](_0x4b8503,_0x4b8503+_0x4d1186),_0x125ed8=_0x474c7b[_0x49824d(0x273)]>_0x4b8503+_0x4d1186,_0x3c6223=[...new Set(_0x43f816[_0x49824d(0x1f3)](_0x34b9ba=>_0x34b9ba[_0x49824d(0x20c)]['agentId'])[_0x49824d(0x248)](_0x1e248d=>_0x1e248d!==undefined))],_0x5a417d=new Map();await Promise['all'](_0x3c6223[_0x49824d(0x1f3)](async _0x13dbf2=>{const _0x343f77=_0x49824d;try{const _0x18aaa5=await _0x1f581c[_0x343f77(0x24e)]['agent'](_0x13dbf2);_0x5a417d['set'](_0x13dbf2,_0x18aaa5[_0x343f77(0x20c)][_0x343f77(0x1d7)]);}catch{_0x5a417d[_0x343f77(0x1b1)](_0x13dbf2,_0x13dbf2);}}));const _0x41ac81=_0x43f816['map'](_0x21183e=>{const _0x16f50a=_0x49824d,_0x30bb60=_0x21183e[_0x16f50a(0x20c)][_0x16f50a(0x276)]||'(no\x20message)',_0x1e6892=_0x30bb60[_0x16f50a(0x24b)]('\x0a')[0x0],_0x920f55=_0x1e6892[_0x16f50a(0x273)]>0x50?_0x1e6892[_0x16f50a(0x1ba)](0x0,0x4d)+_0x16f50a(0x282):_0x1e6892,_0x33080c=_0x21183e['attributes'][_0x16f50a(0x284)]?_0x5a417d['get'](_0x21183e[_0x16f50a(0x20c)][_0x16f50a(0x284)])||_0x21183e[_0x16f50a(0x20c)][_0x16f50a(0x284)]:_0x16f50a(0x224),_0xfe5d4=_0x21183e[_0x16f50a(0x20c)]['lastConversationAt']||_0x21183e[_0x16f50a(0x20c)][_0x16f50a(0x1fe)],_0x2a7312=new Date(_0xfe5d4),_0x179efc=new Date(),_0x29f776=_0x179efc[_0x16f50a(0x259)]()-_0x2a7312[_0x16f50a(0x259)](),_0x535116=Math['floor'](_0x29f776/0xea60),_0x1cdacf=Math[_0x16f50a(0x1ab)](_0x29f776/0x36ee80),_0x1fe1ec=Math[_0x16f50a(0x1ab)](_0x29f776/0x5265c00);let _0x23ce12;if(_0x535116<0x1)_0x23ce12='just\x20now';else{if(_0x535116<0x3c)_0x23ce12=_0x535116+_0x16f50a(0x26c);else{if(_0x1cdacf<0x18)_0x23ce12=_0x1cdacf+_0x16f50a(0x22c);else _0x1fe1ec<0x7?_0x23ce12=_0x1fe1ec+'d\x20ago':_0x23ce12=_0x2a7312[_0x16f50a(0x1c2)](_0x16f50a(0x280),{'month':_0x16f50a(0x251),'day':_0x16f50a(0x1b5)});}}return{'title':_0x920f55+'\x20'+_0x25b047[_0x16f50a(0x1f0)]('['+_0x33080c+']\x20'+_0x23ce12),'value':_0x21183e['id']};});_0x125ed8&&_0x41ac81[_0x49824d(0x1e7)]({'title':_0x25b047[_0x49824d(0x262)](_0x49824d(0x206)),'value':_0x49824d(0x1ff)});const _0x431fe8=await _0xf5da4e({'type':_0x49824d(0x215),'name':'chatId','message':_0x49824d(0x285),'choices':_0x41ac81,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x431fe8[_0x49824d(0x21e)])return undefined;if(_0x431fe8[_0x49824d(0x21e)]==='__load_more__'){_0x4b8503+=_0x4d1186;continue;}return _0x431fe8[_0x49824d(0x21e)];}}export class ChatsCommand extends BaseCommand{['name']='chats';[a20_0x4b3ec7(0x27f)]=a20_0x4b3ec7(0x272);async[a20_0x4b3ec7(0x239)](_0x4d1086){const _0x491fe4=a20_0x4b3ec7;return executeChatHistoryCommand(_0x4d1086,_0x491fe4(0x1cc));}}
|
|
1
|
+
const a19_0x1eebd6=a19_0x439f;(function(_0x56dbbe,_0x38201b){const _0x59bc80=a19_0x439f,_0x2bbd93=_0x56dbbe();while(!![]){try{const _0x411d4c=parseInt(_0x59bc80(0x12f))/0x1*(-parseInt(_0x59bc80(0x11b))/0x2)+parseInt(_0x59bc80(0x154))/0x3*(-parseInt(_0x59bc80(0x149))/0x4)+-parseInt(_0x59bc80(0xeb))/0x5+parseInt(_0x59bc80(0x143))/0x6+parseInt(_0x59bc80(0x19c))/0x7*(-parseInt(_0x59bc80(0x111))/0x8)+parseInt(_0x59bc80(0x16c))/0x9+parseInt(_0x59bc80(0x18a))/0xa;if(_0x411d4c===_0x38201b)break;else _0x2bbd93['push'](_0x2bbd93['shift']());}catch(_0x1c0c0c){_0x2bbd93['push'](_0x2bbd93['shift']());}}}(a19_0x106c,0x4e028));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';function a19_0x439f(_0x1c5cb6,_0x4f3c31){_0x1c5cb6=_0x1c5cb6-0xe5;const _0x106c81=a19_0x106c();let _0x439f1b=_0x106c81[_0x1c5cb6];return _0x439f1b;}import*as a19_0x35fdb3 from'node:fs';function handleSDKError(_0x3a5ca2,_0x5b76ec){const _0x994f4=a19_0x439f;if(_0x3a5ca2 instanceof SDKError)console[_0x994f4(0x158)](_0x994f4(0x1b8)+_0x3a5ca2[_0x994f4(0x13e)]),_0x5b76ec[_0x994f4(0x1a2)]&&(_0x3a5ca2['cause']&&console[_0x994f4(0x158)](_0x994f4(0xf1)+_0x3a5ca2[_0x994f4(0x1c6)]),_0x3a5ca2[_0x994f4(0xfd)]&&(console[_0x994f4(0x158)](_0x994f4(0xfc)),console[_0x994f4(0x158)](_0x3a5ca2[_0x994f4(0xfd)])));else throw _0x3a5ca2;}function formatChatHistoryEntry(_0x5dce99,_0x373992){const _0x57ced2=a19_0x439f,_0x3e5028=getChalk(_0x373992),_0xe8a724=_0x3e5028['dim'](_0x5dce99['at']);if(_0x57ced2(0x115)in _0x5dce99){const _0x4356ae=_0x3e5028[_0x57ced2(0x128)](_0x57ced2(0x12c));return _0xe8a724+'\x20'+_0x4356ae+':\x20'+_0x5dce99[_0x57ced2(0x115)];}if(_0x57ced2(0x1c5)in _0x5dce99){const _0x19336f=_0x3e5028[_0x57ced2(0x1b2)](_0x57ced2(0x146));return _0xe8a724+'\x20'+_0x19336f+':\x20'+_0x5dce99[_0x57ced2(0x1c5)];}if(_0x57ced2(0x106)in _0x5dce99){const _0x11ae66=_0x3e5028['yellow']('[tool_call]'),{functionName:_0x40385e,functionArguments:_0x8ff6df,targetFunction:_0x4c9182}=_0x5dce99[_0x57ced2(0x106)];let _0x2c978a=_0xe8a724+'\x20'+_0x11ae66+':\x20'+_0x3e5028[_0x57ced2(0x1a4)](_0x40385e);if(_0x8ff6df&&Object[_0x57ced2(0xfa)](_0x8ff6df)[_0x57ced2(0x123)]>0x0){const _0x8ede3d=Object[_0x57ced2(0x125)](_0x8ff6df)[_0x57ced2(0xef)](([_0x298f9f,_0x37170b])=>_0x298f9f+'='+JSON[_0x57ced2(0x14c)](_0x37170b))['join'](',\x20');_0x2c978a+='('+_0x8ede3d+')';}_0x4c9182&&(_0x2c978a+=_0x3e5028[_0x57ced2(0x1c2)]('\x20['+_0x4c9182+']'));let _0x3dec4f='';if(_0x5dce99[_0x57ced2(0x106)][_0x57ced2(0x188)])_0x3dec4f=_0x57ced2(0x177)+_0x5dce99[_0x57ced2(0x106)]['targetKnowledgeBase']['name'];else{if(_0x5dce99['tool_call'][_0x57ced2(0x194)])_0x3dec4f='\x20->\x20Agent:'+_0x5dce99[_0x57ced2(0x106)][_0x57ced2(0x194)]['name'];else{if(_0x5dce99['tool_call'][_0x57ced2(0x101)])_0x3dec4f='\x20->\x20WebSearch:'+_0x5dce99[_0x57ced2(0x106)]['targetWebSearchTool']['name'];else _0x5dce99[_0x57ced2(0x106)][_0x57ced2(0x127)]&&(_0x3dec4f=_0x57ced2(0x182)+_0x5dce99[_0x57ced2(0x106)][_0x57ced2(0x127)][_0x57ced2(0x1af)]);}}return _0x2c978a+_0x3dec4f;}if('tool'in _0x5dce99){const _0x124e14=_0x3e5028[_0x57ced2(0x139)](_0x57ced2(0xe9)),{functionName:_0x43f68c,functionArguments:_0x3c5aa7,content:_0x506384,newChat:_0x48da2b}=_0x5dce99['tool'];let _0xe5526=_0xe8a724+'\x20'+_0x124e14+':\x20'+_0x3e5028['bold'](_0x43f68c);if(_0x3c5aa7){const _0x5081=typeof _0x3c5aa7===_0x57ced2(0x13f)?_0x3c5aa7:JSON['stringify'](_0x3c5aa7);_0xe5526+='('+_0x5081+')';}return _0x506384&&(_0xe5526+='\x0a'+_0x3e5028[_0x57ced2(0x1c2)](_0x506384)),_0x48da2b&&(_0xe5526+=_0x3e5028['dim'](_0x57ced2(0x156)+_0x48da2b['id'])),_0xe5526;}if('output'in _0x5dce99){const _0x54ae1e=_0x3e5028['blue']('[output]\x20');return _0xe8a724+'\x20'+_0x54ae1e+':\x20'+_0x5dce99[_0x57ced2(0xec)]['name']+'\x20('+_0x5dce99[_0x57ced2(0xec)][_0x57ced2(0x1c5)][_0x57ced2(0x123)]+_0x57ced2(0x10b);}if(_0x57ced2(0x126)in _0x5dce99){const _0xbbf84=_0x3e5028[_0x57ced2(0x17f)](_0x57ced2(0x193)),{width:_0x18b329,height:_0xf59f26,headerText:_0x94ac3e}=_0x5dce99[_0x57ced2(0x126)],_0x5d6c10=_0x94ac3e?'\x20-\x20'+_0x94ac3e:'';return _0xe8a724+'\x20'+_0xbbf84+':\x20'+_0x18b329+'x'+_0xf59f26+_0x5d6c10;}if('error'in _0x5dce99){const _0x5386f7=_0x3e5028[_0x57ced2(0x141)](_0x57ced2(0x103));return _0xe8a724+'\x20'+_0x5386f7+':\x20'+_0x5dce99['error'];}return _0xe8a724+'\x20'+_0x3e5028[_0x57ced2(0x1c2)]('[unknown]')+':\x20'+JSON[_0x57ced2(0x14c)](_0x5dce99);}async function executeChatHistoryCommand(_0x49524c,_0x32888f){const _0x660c35=a19_0x439f,{options:_0x4255a6,args:_0x325dea,tdx:_0x48e539}=_0x49524c,_0x247055=_0x325dea[0x0],_0x3f5fb1=_0x4255a6,_0x29d9df=_0x3f5fb1[_0x660c35(0x15a)];try{if(_0x29d9df&&_0x247055)return console['error'](_0x660c35(0x16d)),console['error'](_0x660c35(0x144)+_0x32888f+'\x20--last'),0x1;if(!_0x247055&&!_0x29d9df&&_0x4255a6[_0x660c35(0x15b)]!==undefined){const _0x256925=resolveLimit(_0x4255a6[_0x660c35(0x118)],DEFAULT_LLM_LIMIT),_0x45803a=await withSpinner(_0x660c35(0x175),()=>_0x48e539[_0x660c35(0x10c)][_0x660c35(0x189)](_0x256925),{'verbose':_0x4255a6['verbose']});return await handleSDKOutput(_0x45803a[_0x660c35(0xfb)],_0x4255a6),0x0;}const _0x31fef4=await getChatIdOrSelect(_0x48e539,_0x4255a6,_0x29d9df,_0x247055);if(!_0x31fef4)return 0x0;return await displayChatHistory(_0x31fef4,_0x48e539,_0x4255a6),0x0;}catch(_0x39e261){return handleSDKError(_0x39e261,_0x4255a6),0x1;}}async function displayChatHistory(_0x2060aa,_0x2290bc,_0x37006d){const _0x294ec3=a19_0x439f,_0x2b7bd2=await withSpinner(_0x294ec3(0xed)+_0x2060aa+'\x27...',()=>_0x2290bc[_0x294ec3(0x10c)]['history'](_0x2060aa),{'verbose':_0x37006d[_0x294ec3(0x1a2)]}),_0x2dbb1b=_0x2b7bd2[_0x294ec3(0xfb)][_0x294ec3(0xfb)]??[];if(_0x2dbb1b[_0x294ec3(0x123)]===0x0){console['log'](_0x294ec3(0x17d));return;}if(_0x37006d[_0x294ec3(0x15b)]!==undefined)await handleSDKOutput(_0x2dbb1b,_0x37006d);else{const _0x535e73=_0x2dbb1b['map'](_0x27c913=>formatChatHistoryEntry(_0x27c913,_0x37006d)),_0x111837=_0x535e73[_0x294ec3(0x112)]('\x0a');await writeOutput(_0x111837,_0x37006d[_0x294ec3(0xec)],_0x294ec3(0x102));}}async function getChatIdOrSelect(_0x240e96,_0x448c92,_0x257e70,_0x259dff){const _0x3e9c20=a19_0x439f;if(_0x259dff)return _0x259dff;if(_0x257e70){const _0x531861=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x240e96['llm'][_0x3e9c20(0x189)](0x1),{'verbose':_0x448c92[_0x3e9c20(0x1a2)]});if(_0x531861[_0x3e9c20(0xfb)][_0x3e9c20(0x123)]===0x0)return console[_0x3e9c20(0x16b)](_0x3e9c20(0x152)),undefined;return _0x531861[_0x3e9c20(0xfb)][0x0]['id'];}const _0x44fe22=await selectChatInteractively(_0x240e96,_0x448c92);if(!_0x44fe22)return console[_0x3e9c20(0x16b)](_0x3e9c20(0x165)),undefined;return _0x44fe22;}async function getProjectIdOrDefault(_0x3e4bd9){const _0x102092=await getProjectWithName(_0x3e4bd9);return _0x102092['id'];}async function getProjectWithName(_0x48d9db){const _0x2ca132=a19_0x439f,{tdx:_0x5db0f7,options:_0x33eed0}=_0x48d9db,_0x4e9292=_0x33eed0[_0x2ca132(0x12e)];if(_0x4e9292){const _0x20cf01=await withSpinner(_0x2ca132(0xf3)+_0x4e9292+_0x2ca132(0x1c0),()=>_0x5db0f7[_0x2ca132(0x10c)]['resolveProjectId'](_0x4e9292),{'verbose':_0x33eed0[_0x2ca132(0x1a2)]});return{'id':_0x20cf01[_0x2ca132(0xfb)],'name':_0x4e9292};}const _0x2491df=_0x5db0f7[_0x2ca132(0x10c)][_0x2ca132(0xf9)]();if(_0x2491df){const _0x2eeb53=await _0x5db0f7['llm'][_0x2ca132(0x13b)](),_0x391f82=_0x2eeb53['find'](_0x5aa477=>_0x5aa477['id']===_0x2491df);return{'id':_0x2491df,'name':_0x391f82?.[_0x2ca132(0x105)]['name']||'Unknown'};}const _0x10a58d=await withSpinner(_0x2ca132(0x135),()=>_0x5db0f7[_0x2ca132(0x10c)][_0x2ca132(0x104)](),{'verbose':_0x33eed0['verbose']});return{'id':_0x10a58d[_0x2ca132(0xfb)]['id'],'name':_0x10a58d[_0x2ca132(0xfb)][_0x2ca132(0x105)][_0x2ca132(0x1af)]};}function toLLMProjectInfo(_0x1224b5){const _0x34f07a=a19_0x439f;return{'name':_0x1224b5['attributes']['name'],'description':_0x1224b5[_0x34f07a(0x105)][_0x34f07a(0x136)],'createdAt':_0x1224b5[_0x34f07a(0x105)]['createdAt'],'updatedAt':_0x1224b5['attributes'][_0x34f07a(0x17e)]};}function toAgentInfo(_0x45fdbd){const _0x346f44=a19_0x439f;return{'name':_0x45fdbd[_0x346f44(0x105)]['name'],'description':_0x45fdbd[_0x346f44(0x105)][_0x346f44(0x136)],'prompt':truncatePrompt(_0x45fdbd[_0x346f44(0x105)][_0x346f44(0x1c7)]),'createdAt':_0x45fdbd[_0x346f44(0x105)][_0x346f44(0x18e)],'updatedAt':_0x45fdbd[_0x346f44(0x105)]['updatedAt']};}function truncatePrompt(_0x3e9007){const _0x4a69f2=a19_0x439f;if(!_0x3e9007)return undefined;const _0x536295=0x64;if(_0x3e9007[_0x4a69f2(0x123)]<=_0x536295)return _0x3e9007;return _0x3e9007[_0x4a69f2(0x17c)](0x0,_0x536295)+'...';}export class LLMModelsCommand extends BaseCommand{['name']=a19_0x1eebd6(0x145);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x1a3);async[a19_0x1eebd6(0x1a7)](_0x1ba71d){const _0x184e7e=a19_0x1eebd6,{options:_0x516a0c,tdx:_0xaa9c9c}=_0x1ba71d;try{const _0x3e1a19=await withSpinner(_0x184e7e(0x117),()=>_0xaa9c9c['llm'][_0x184e7e(0x10d)](),{'verbose':_0x516a0c[_0x184e7e(0x1a2)]});return await handleSDKOutput(_0x3e1a19[_0x184e7e(0xfb)],_0x516a0c),0x0;}catch(_0x34b945){return handleSDKError(_0x34b945,_0x516a0c),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]='llm:projects';[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x1ae);async['execute'](_0x4e5f3f){const _0x3d0aaf=a19_0x1eebd6,{options:_0x228b1c,args:_0x28e82a,tdx:_0x41f18e}=_0x4e5f3f,_0x4036c0=getChalk(_0x228b1c),_0x4aaf74=_0x228b1c['web'],_0x5dae82=_0x228b1c[_0x3d0aaf(0x155)];try{const _0x14b139=_0x28e82a[0x0],_0x3f37e0=resolveLimit(_0x228b1c[_0x3d0aaf(0x118)],DEFAULT_LLM_LIMIT),_0x123901=await withSpinner('Fetching\x20projects...',()=>_0x41f18e[_0x3d0aaf(0x10c)][_0x3d0aaf(0x13b)](_0x3f37e0),{'verbose':_0x228b1c['verbose']});let _0x56ef73=_0x123901[_0x3d0aaf(0xfb)];_0x14b139&&(_0x56ef73=_0x123901[_0x3d0aaf(0xfb)][_0x3d0aaf(0xff)](_0x78d7f6=>matchGlobPattern(_0x78d7f6[_0x3d0aaf(0x105)][_0x3d0aaf(0x1af)],_0x14b139)));const _0x52169a=_0x228b1c[_0x3d0aaf(0x15b)]==='json'||_0x228b1c[_0x3d0aaf(0x15b)]===_0x3d0aaf(0x1a1)||_0x228b1c['format']===_0x3d0aaf(0x102)||_0x228b1c[_0x3d0aaf(0x15b)]==='tsv';if(_0x52169a){const _0x479b8f=_0x56ef73[_0x3d0aaf(0xef)](_0xecc154=>({...toLLMProjectInfo(_0xecc154),..._0x4aaf74?{'url':getLLMProjectUrl(_0x5dae82,_0xecc154['id'])}:{}}));await handleSDKOutput(_0x479b8f,_0x228b1c);}else{const _0x83d531=[];if(_0x56ef73['length']===0x0)_0x83d531[_0x3d0aaf(0x116)](_0x4036c0['dim'](_0x3d0aaf(0x1bc)));else{const _0x49834e=[..._0x56ef73][_0x3d0aaf(0x187)]((_0x26331e,_0x21365d)=>_0x26331e[_0x3d0aaf(0x105)][_0x3d0aaf(0x1af)][_0x3d0aaf(0x150)](_0x21365d[_0x3d0aaf(0x105)][_0x3d0aaf(0x1af)]));for(const _0x83f771 of _0x49834e){if(_0x4aaf74){const _0x3234d6=getLLMProjectUrl(_0x5dae82,_0x83f771['id']);_0x83d531['push'](_0x3d0aaf(0x13d)+_0x83f771[_0x3d0aaf(0x105)][_0x3d0aaf(0x1af)]+'\x20\x20'+_0x4036c0[_0x3d0aaf(0x1c2)](_0x3234d6));}else _0x83d531[_0x3d0aaf(0x116)](_0x3d0aaf(0x13d)+_0x83f771[_0x3d0aaf(0x105)][_0x3d0aaf(0x1af)]);}_0x83d531[_0x3d0aaf(0x116)](_0x4036c0[_0x3d0aaf(0x1c2)](_0x56ef73[_0x3d0aaf(0x123)]+_0x3d0aaf(0x18c)));}await writeOutput(_0x83d531[_0x3d0aaf(0x112)]('\x0a'),_0x228b1c['output'],_0x3d0aaf(0x102));}return 0x0;}catch(_0x15d2bd){return handleSDKError(_0x15d2bd,_0x228b1c),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x169);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x12b);async['execute'](_0x1713ac){const _0x20c633=a19_0x1eebd6,{options:_0x37884c,args:_0x48dab7,tdx:_0x4705b9}=_0x1713ac,_0x1abdfd=getChalk(_0x37884c),_0x1dc8fc=_0x37884c['web'],_0x4a2539=_0x37884c[_0x20c633(0x155)];try{const _0x54983e=_0x48dab7[0x0];let _0x455da1=_0x54983e,_0x40cba2,_0x5809d5;if(_0x54983e&&_0x54983e['includes']('/')){const _0x55ce9d=_0x54983e[_0x20c633(0x176)]('/');if(_0x55ce9d[_0x20c633(0x123)]===0x2){const [_0x53d014,_0x100e72]=_0x55ce9d,_0x3d50ec=await _0x4705b9['llm'][_0x20c633(0x13b)](),_0x2ea130=_0x3d50ec[_0x20c633(0x113)](_0x38efcb=>_0x38efcb[_0x20c633(0x105)][_0x20c633(0x1af)][_0x20c633(0xe7)]()===_0x53d014['toLowerCase']());if(!_0x2ea130)throw new SDKError(ErrorCode[_0x20c633(0x181)],_0x20c633(0x186)+_0x53d014,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x40cba2=_0x2ea130['id'],_0x5809d5=_0x2ea130[_0x20c633(0x105)][_0x20c633(0x1af)],_0x455da1=_0x100e72;}else throw new SDKError(ErrorCode[_0x20c633(0x15f)],'Invalid\x20path\x20syntax:\x20'+_0x54983e,undefined,{'helpText':_0x20c633(0x171)});}else{const _0x111288=await getProjectWithName(_0x1713ac);_0x40cba2=_0x111288['id'],_0x5809d5=_0x111288['name'];}const _0x25ec7e=await withSpinner(_0x20c633(0x174),()=>_0x4705b9[_0x20c633(0x10c)][_0x20c633(0x110)](_0x40cba2),{'verbose':_0x37884c[_0x20c633(0x1a2)]});let _0x671384=_0x25ec7e[_0x20c633(0xfb)];_0x455da1&&(_0x671384=_0x25ec7e[_0x20c633(0xfb)][_0x20c633(0xff)](_0x5d69d8=>matchGlobPattern(_0x5d69d8['attributes'][_0x20c633(0x1af)],_0x455da1)));const _0x12b519=_0x37884c[_0x20c633(0x15b)]===_0x20c633(0x192)||_0x37884c[_0x20c633(0x15b)]===_0x20c633(0x1a1)||_0x37884c[_0x20c633(0x15b)]===_0x20c633(0x102)||_0x37884c[_0x20c633(0x15b)]===_0x20c633(0x119);if(_0x12b519){const _0x28063a=_0x671384[_0x20c633(0xef)](_0x1d9f8f=>({...toAgentInfo(_0x1d9f8f),..._0x1dc8fc?{'chatUrl':getLLMAgentChatUrl(_0x4a2539,_0x40cba2,_0x1d9f8f['id'])}:{}}));await handleSDKOutput(_0x28063a,_0x37884c);}else{const _0x911068=[];_0x911068[_0x20c633(0x116)](_0x1abdfd[_0x20c633(0x1c2)]('['+_0x5809d5+']'));if(_0x671384[_0x20c633(0x123)]===0x0)_0x911068[_0x20c633(0x116)](_0x1abdfd['dim'](_0x20c633(0x167)));else{const _0x38f7e0=[..._0x671384]['sort']((_0x31643b,_0xd93830)=>_0x31643b[_0x20c633(0x105)][_0x20c633(0x1af)][_0x20c633(0x150)](_0xd93830[_0x20c633(0x105)]['name']));for(const _0x494308 of _0x38f7e0){if(_0x1dc8fc){const _0x191016=getLLMAgentChatUrl(_0x4a2539,_0x40cba2,_0x494308['id']);_0x911068['push'](_0x20c633(0xf0)+_0x494308[_0x20c633(0x105)][_0x20c633(0x1af)]+'\x20\x20'+_0x1abdfd[_0x20c633(0x1c2)](_0x191016));}else _0x911068[_0x20c633(0x116)](_0x20c633(0xf0)+_0x494308['attributes'][_0x20c633(0x1af)]);}_0x911068[_0x20c633(0x116)](_0x1abdfd[_0x20c633(0x1c2)](_0x671384[_0x20c633(0x123)]+'\x20agent(s)'));}await writeOutput(_0x911068[_0x20c633(0x112)]('\x0a'),_0x37884c[_0x20c633(0xec)],'table');}return 0x0;}catch(_0x1d818f){return handleSDKError(_0x1d818f,_0x37884c),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x14e);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x12d);async[a19_0x1eebd6(0x1a7)](_0x51c3ab){const _0x529fc2=a19_0x1eebd6,{options:_0x402dcb,args:_0x154c91,tdx:_0x39bab9}=_0x51c3ab;if(_0x154c91['length']===0x0)return console['error'](_0x529fc2(0x11a)),console['error'](_0x529fc2(0x137)),0x1;const _0x1fdfdd=_0x154c91[0x0];try{const _0x41d1c2=await getProjectIdOrDefault(_0x51c3ab),_0x91e46b=await withSpinner('Resolving\x20agent\x20\x27'+_0x1fdfdd+'\x27...',()=>_0x39bab9['llm'][_0x529fc2(0x19d)](_0x1fdfdd,_0x41d1c2),{'verbose':_0x402dcb[_0x529fc2(0x1a2)]}),_0x3970c0=await withSpinner(_0x529fc2(0x168),()=>_0x39bab9[_0x529fc2(0x10c)][_0x529fc2(0x11e)](_0x91e46b['data']),{'verbose':_0x402dcb['verbose']});return await handleSDKOutput([_0x3970c0[_0x529fc2(0xfb)]],_0x402dcb),0x0;}catch(_0x24f2fa){return handleSDKError(_0x24f2fa,_0x402dcb),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x1a9);['description']=a19_0x1eebd6(0x18d);async[a19_0x1eebd6(0x1a7)](_0x46927b){const _0x1daa43=a19_0x1eebd6,{options:_0x53c866,args:_0x11d41c,tdx:_0xc885be}=_0x46927b;if(_0x11d41c[_0x1daa43(0x123)]===0x0)return console[_0x1daa43(0x158)]('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x1daa43(0x191)),console[_0x1daa43(0x158)](_0x1daa43(0x1b1)),0x1;const _0x4a4511=_0x11d41c[0x0],_0x1a2e3c=_0x53c866,_0xb19b05=_0x1a2e3c[_0x1daa43(0x1bb)],_0x5862c3=_0x1a2e3c[_0x1daa43(0x114)]||_0x1daa43(0x1b4),_0x545f20=_0x1a2e3c[_0x1daa43(0x1aa)],_0x4a989d=_0x1a2e3c[_0x1daa43(0x180)]?Number(_0x1a2e3c[_0x1daa43(0x180)]):undefined,_0x35f64b=_0x1a2e3c['temperature']?Number(_0x1a2e3c[_0x1daa43(0xe8)]):undefined;try{let _0x8b8493,_0x350d0a;if(_0x4a4511[_0x1daa43(0xf6)]('/')){const _0x567523=_0x4a4511[_0x1daa43(0x176)]('/');if(_0x567523[_0x1daa43(0x123)]===0x2){const [_0x2b8baf,_0x4848d7]=_0x567523,_0xf07c15=await withSpinner(_0x1daa43(0xf3)+_0x2b8baf+_0x1daa43(0x1c0),()=>_0xc885be[_0x1daa43(0x10c)][_0x1daa43(0x151)](_0x2b8baf),{'verbose':_0x53c866[_0x1daa43(0x1a2)]});_0x8b8493=_0xf07c15[_0x1daa43(0xfb)],_0x350d0a=_0x4848d7;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1daa43(0x153)+_0x4a4511,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x8b8493=await getProjectIdOrDefault(_0x46927b),_0x350d0a=_0x4a4511;const _0x29db19=await withSpinner(_0x1daa43(0x147)+_0x350d0a+_0x1daa43(0x1c0),()=>_0xc885be['llm'][_0x1daa43(0x14f)]({'name':_0x350d0a,'projectId':_0x8b8493,'modelType':_0x5862c3,'systemPrompt':_0xb19b05,'starterMessage':_0x545f20,'maxToolIterations':_0x4a989d,'temperature':_0x35f64b}),{'verbose':_0x53c866[_0x1daa43(0x1a2)]});return console[_0x1daa43(0x16b)](_0x1daa43(0xfe)+_0x29db19[_0x1daa43(0xfb)]['id']),await handleSDKOutput([_0x29db19[_0x1daa43(0xfb)]],_0x53c866),0x0;}catch(_0x4740bf){return handleSDKError(_0x4740bf,_0x53c866),0x1;}}}function a19_0x106c(){const _0x30480e=['Agent\x20deleted:\x20','llm:agent:create','starterMessage','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','getTime','List\x20all\x20LLM\x20projects','name','.llm','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','green','substring','claude-4.5-haiku','(no\x20agent)','llm:project:backup','\x20\x20Integrations:\x20','Error:\x20','createProject','projectId','systemPrompt','No\x20projects\x20found','knowledgeBases','llm:history','Resolving\x20agent\x20\x27','\x27...','floor','dim','chatId','dryRun','content','cause','prompt','sourceSite','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Project\x20backed\x20up\x20to:\x20','m\x20ago','toLowerCase','temperature','[tool]\x20\x20\x20','rmSync','396015LFdfRE','output','Fetching\x20chat\x20history\x20for\x20\x27','existsSync','map','🤖\x20','\x20\x20Cause:\x20','short','Resolving\x20project\x20\x27','llm:project:create','\x20\x20Prompts:\x20','includes','deleteProject','default','getCurrentProject','keys','data','\x0aStack\x20trace:','stack','Agent\x20created:\x20','filter','counts','targetWebSearchTool','table','[error]\x20\x20','getOrCreateDefaultProject','attributes','tool_call','Set\x20current\x20project\x20context','tdx\x20llm\x20history','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Create\x20a\x20new\x20LLM\x20project','\x20bytes)','llm','models','h\x20ago','agentId','agents','24GajYwr','join','find','model','input','push','Fetching\x20available\x20models...','limit','tsv','Error:\x20Agent\x20name\x20is\x20required','36682AECiGu','\x20\x20Agents:\x20','Creating\x20project\x20\x27','agent','Setting\x20project\x20context\x20to\x20\x27','Validating\x20backup\x20from\x20\x27','Select\x20a\x20chat\x20session:','d\x20ago','length','numeric','entries','image','targetImageGenerator','cyan','\x20\x20Knowledge\x20Bases:\x20','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','List\x20agents\x20in\x20current\x20project','[input]\x20\x20','Show\x20agent\x20details','llmProject','14UYOwrQ','Error:\x20Project\x20name\x20is\x20required','llm:project:restore','llm:agent:update','Project\x20restored:\x20','set','Getting\x20default\x20project...','description','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Output\x20directory\x20\x27','magenta','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','projects','llm:project:delete','⚒️\x20','message','string','projectName','red','A\x20project\x20named\x20\x27','2859624DuDGnV','Usage:\x20','llm:models','[content]','Creating\x20agent\x20\x27','Error:\x20Backup\x20folder\x20path\x20is\x20required','20156XmuDOA','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','llm:use','stringify','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','llm:agent:show','createAgent','localeCompare','resolveProjectId','No\x20chat\x20sessions\x20found.','Invalid\x20path\x20syntax:\x20','87cjpUpq','site','\x20→\x20chat:\x20','integrations','error','setCurrentProject','last','format','Project\x20deleted:\x20','Deleting\x20project\x20\x27','Usage:\x20tdx\x20llm\x20use\x20<project-name>','INVALID_ARGUMENT','__load_more__','(no\x20message)','getBackupMetadata','Agent\x20updated:\x20','Analyzing\x20project\x20\x27','\x0aCancelled','outputDir','No\x20agents\x20found','Fetching\x20agent...','llm:agents','lastConversationAt','log','3548241HlsTPY','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','tdx\x20chats','Backup\x20cancelled.','toLocaleDateString','Use\x20format:\x20project-name/agent-name','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','Fetching\x20agents...','Fetching\x20chat\x20sessions...','split','\x20->\x20KB:','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','exportedFrom','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','slice','No\x20messages\x20found\x20in\x20chat\x20history.','updatedAt','blue','maxToolIterations','LLM_PROJECT_NOT_FOUND','\x20->\x20ImageGen:','prompts','Delete\x20an\x20agent','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Project\x20not\x20found:\x20','sort','targetKnowledgeBase','chats','3809540PwFIIv','Deleting\x20agent...','\x20project(s)','Create\x20a\x20new\x20agent\x20in\x20current\x20project','createdAt','Delete\x20an\x20LLM\x20project','select','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','json','[image]\x20\x20','targetAgent','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','updateAgent','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','Project\x20created:\x20','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','yes','Restore\x20cancelled.','1050399BpeWFY','resolveAgentId','yellow','deleteAgent','Update\x20an\x20existing\x20agent','jsonl','verbose','List\x20available\x20LLM\x20models','bold','\x20\x20\x20Examples:','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','execute'];a19_0x106c=function(){return _0x30480e;};return a19_0x106c();}export class LLMAgentUpdateCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x132);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x1a0);async[a19_0x1eebd6(0x1a7)](_0x104598){const _0x905f60=a19_0x1eebd6,{options:_0xec0565,args:_0x40ed41,tdx:_0x104aac}=_0x104598;if(_0x40ed41[_0x905f60(0x123)]===0x0)return console[_0x905f60(0x158)](_0x905f60(0x11a)),console['error'](_0x905f60(0x195)),0x1;const _0x27520c=_0x40ed41[0x0],_0xb7b6e5=_0xec0565,_0x3dbb39=_0xb7b6e5[_0x905f60(0x1af)],_0x51681d=_0xb7b6e5[_0x905f60(0x1c7)],_0x2908bb=_0xb7b6e5['description'],_0x392ac9=_0xb7b6e5[_0x905f60(0x1aa)];if(!_0x3dbb39&&!_0x51681d&&!_0x2908bb&&!_0x392ac9)return console[_0x905f60(0x158)](_0x905f60(0x1c9)),console[_0x905f60(0x158)](_0x905f60(0x178)),0x1;try{const _0x24840e=await getProjectIdOrDefault(_0x104598),_0x49d1b6=await withSpinner(_0x905f60(0x1bf)+_0x27520c+'\x27...',()=>_0x104aac['llm'][_0x905f60(0x19d)](_0x27520c,_0x24840e),{'verbose':_0xec0565[_0x905f60(0x1a2)]}),_0x2e2344=_0x49d1b6['data'],_0x3944e8=await withSpinner('Updating\x20agent...',()=>_0x104aac[_0x905f60(0x10c)][_0x905f60(0x196)](_0x2e2344,{'name':_0x3dbb39,'prompt':_0x51681d,'description':_0x2908bb,'starterMessage':_0x392ac9}),{'verbose':_0xec0565[_0x905f60(0x1a2)]});return console[_0x905f60(0x16b)](_0x905f60(0x163)+_0x3944e8['data']['id']),await handleSDKOutput([_0x3944e8['data']],_0xec0565),0x0;}catch(_0x13029c){return handleSDKError(_0x13029c,_0xec0565),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']='llm:agent:delete';[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x184);async[a19_0x1eebd6(0x1a7)](_0x207895){const _0x1817c3=a19_0x1eebd6,{options:_0x2df641,args:_0x521afb,tdx:_0x5a71fd}=_0x207895;if(_0x521afb[_0x1817c3(0x123)]===0x0)return console[_0x1817c3(0x158)](_0x1817c3(0x11a)),console[_0x1817c3(0x158)](_0x1817c3(0x12a)),0x1;const _0x5ef213=_0x521afb[0x0];try{const _0x74aa36=await getProjectIdOrDefault(_0x207895),_0x4a86e0=await withSpinner('Resolving\x20agent\x20\x27'+_0x5ef213+_0x1817c3(0x1c0),()=>_0x5a71fd['llm']['resolveAgentId'](_0x5ef213,_0x74aa36),{'verbose':_0x2df641[_0x1817c3(0x1a2)]}),_0x10162b=_0x4a86e0[_0x1817c3(0xfb)];return await withSpinner(_0x1817c3(0x18b),()=>_0x5a71fd['llm'][_0x1817c3(0x19f)](_0x10162b),{'verbose':_0x2df641['verbose']}),console[_0x1817c3(0x16b)](_0x1817c3(0x1a8)+_0x10162b),0x0;}catch(_0x2595ba){return handleSDKError(_0x2595ba,_0x2df641),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x1be);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x185);async[a19_0x1eebd6(0x1a7)](_0x5d0069){const _0x56d94d=a19_0x1eebd6;return executeChatHistoryCommand(_0x5d0069,_0x56d94d(0x108));}}export class LLMUseCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x14b);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x107);async[a19_0x1eebd6(0x1a7)](_0xbf775d){const _0x1391e1=a19_0x1eebd6,{options:_0x32b4bd,args:_0x119579,tdx:_0x2fa6f2}=_0xbf775d;if(_0x119579[_0x1391e1(0x123)]===0x0)return console[_0x1391e1(0x158)](_0x1391e1(0x130)),console[_0x1391e1(0x158)](_0x1391e1(0x15e)),0x1;const _0x49a353=_0x119579[0x0];try{return await withSpinner(_0x1391e1(0x11f)+_0x49a353+_0x1391e1(0x1c0),()=>_0x2fa6f2[_0x1391e1(0x10c)][_0x1391e1(0x159)](_0x49a353),{'verbose':_0x32b4bd[_0x1391e1(0x1a2)]}),console[_0x1391e1(0x16b)]('Project\x20context\x20set\x20to:\x20'+_0x49a353),0x0;}catch(_0xf29e01){return handleSDKError(_0xf29e01,_0x32b4bd),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0xf4);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x10a);async['execute'](_0x164910){const _0x1e9bef=a19_0x1eebd6,{options:_0x4183a3,args:_0x18cf21,tdx:_0x29e353}=_0x164910;if(_0x18cf21[_0x1e9bef(0x123)]===0x0)return console[_0x1e9bef(0x158)](_0x1e9bef(0x130)),console[_0x1e9bef(0x158)](_0x1e9bef(0x199)),0x1;const _0x5e2a46=_0x18cf21[0x0],_0x4f8413=_0x4183a3,_0x2461e3=_0x4f8413['description'];try{const _0x30c9f5=await withSpinner(_0x1e9bef(0x11d)+_0x5e2a46+_0x1e9bef(0x1c0),()=>_0x29e353['llm'][_0x1e9bef(0x1b9)]({'name':_0x5e2a46,'description':_0x2461e3}),{'verbose':_0x4183a3[_0x1e9bef(0x1a2)]});console['log'](_0x1e9bef(0x198)+_0x30c9f5['data']['id']);const _0x593040=toLLMProjectInfo(_0x30c9f5[_0x1e9bef(0xfb)]);return await handleSDKOutput([_0x593040],_0x4183a3),0x0;}catch(_0x1f1ba9){return handleSDKError(_0x1f1ba9,_0x4183a3),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x13c);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x18f);async[a19_0x1eebd6(0x1a7)](_0x7f8ff0){const _0x4972af=a19_0x1eebd6,{options:_0x56c0e6,args:_0x5ee937,tdx:_0x16e53b}=_0x7f8ff0;if(_0x5ee937[_0x4972af(0x123)]===0x0)return console['error'](_0x4972af(0x130)),console['error'](_0x4972af(0x197)),0x1;const _0x58236e=_0x5ee937[0x0];try{return await withSpinner(_0x4972af(0x15d)+_0x58236e+_0x4972af(0x1c0),()=>_0x16e53b[_0x4972af(0x10c)][_0x4972af(0xf7)](_0x58236e),{'verbose':_0x56c0e6[_0x4972af(0x1a2)]}),console[_0x4972af(0x16b)](_0x4972af(0x15c)+_0x58236e),0x0;}catch(_0x1e9660){return handleSDKError(_0x1e9660,_0x56c0e6),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x1b6);[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x17a);async['execute'](_0x4abb5b){const _0x33b8b2=a19_0x1eebd6,{options:_0x22f394,args:_0x49a85c,tdx:_0x3ed3ea}=_0x4abb5b,_0x4c2131=getChalk(_0x22f394);console[_0x33b8b2(0x16b)](_0x4c2131[_0x33b8b2(0x19e)](_0x33b8b2(0x14d))),console[_0x33b8b2(0x16b)](_0x4c2131[_0x33b8b2(0x19e)](_0x33b8b2(0x17b))),console[_0x33b8b2(0x16b)](_0x4c2131[_0x33b8b2(0x1c2)](_0x33b8b2(0x173))),console[_0x33b8b2(0x16b)]();if(_0x49a85c[_0x33b8b2(0x123)]===0x0)return console['error'](_0x33b8b2(0x130)),console[_0x33b8b2(0x158)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x4de3e0=_0x49a85c[0x0],_0x4129ff=_0x22f394,_0x58bf0d=_0x4129ff[_0x33b8b2(0xec)],_0x44adde=_0x4129ff[_0x33b8b2(0x1c4)];try{const _0x1c334b=_0x58bf0d||_0x4de3e0+_0x33b8b2(0x1b0);if(a19_0x35fdb3[_0x33b8b2(0xee)](_0x1c334b)&&!_0x44adde){if(!_0x22f394[_0x33b8b2(0x19a)]){const _0x49c4da=await confirm(_0x33b8b2(0x138)+_0x1c334b+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x49c4da)return console[_0x33b8b2(0x16b)](_0x33b8b2(0x16f)),0x0;}a19_0x35fdb3[_0x33b8b2(0xea)](_0x1c334b,{'recursive':!![]});}const _0x26cc99=await withSpinner(_0x44adde?_0x33b8b2(0x164)+_0x4de3e0+_0x33b8b2(0x1c0):'Backing\x20up\x20project\x20\x27'+_0x4de3e0+_0x33b8b2(0x1c0),()=>_0x3ed3ea[_0x33b8b2(0x10c)]['backupProject'](_0x4de3e0,_0x58bf0d,{'dryRun':_0x44adde}),{'verbose':_0x22f394[_0x33b8b2(0x1a2)]}),_0x2a5e51=_0x26cc99[_0x33b8b2(0xfb)];return _0x44adde?console[_0x33b8b2(0x16b)]('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x2a5e51[_0x33b8b2(0x166)]):console['log'](_0x33b8b2(0xe5)+_0x2a5e51[_0x33b8b2(0x166)]),console[_0x33b8b2(0x16b)](_0x33b8b2(0x11c)+_0x2a5e51['counts'][_0x33b8b2(0x110)]),console[_0x33b8b2(0x16b)]('\x20\x20Knowledge\x20Bases:\x20'+_0x2a5e51[_0x33b8b2(0x100)][_0x33b8b2(0x1bd)]),console[_0x33b8b2(0x16b)](_0x33b8b2(0xf5)+_0x2a5e51[_0x33b8b2(0x100)][_0x33b8b2(0x183)]),console['log'](_0x33b8b2(0x1b7)+_0x2a5e51[_0x33b8b2(0x100)][_0x33b8b2(0x157)]),(_0x22f394['format']===_0x33b8b2(0x192)||_0x22f394[_0x33b8b2(0x15b)]==='jsonl')&&await handleSDKOutput([_0x2a5e51],_0x22f394),0x0;}catch(_0x54e1bf){return handleSDKError(_0x54e1bf,_0x22f394),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a19_0x1eebd6(0x1af)]=a19_0x1eebd6(0x131);['description']=a19_0x1eebd6(0x172);async[a19_0x1eebd6(0x1a7)](_0x1d6f30){const _0x2cc524=a19_0x1eebd6,{options:_0x447bd5,args:_0x25cb28,tdx:_0x3489db}=_0x1d6f30,_0x4524e6=getChalk(_0x447bd5);console[_0x2cc524(0x16b)](_0x4524e6[_0x2cc524(0x19e)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console[_0x2cc524(0x16b)](_0x4524e6['yellow']('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console[_0x2cc524(0x16b)](_0x4524e6['dim'](_0x2cc524(0x1a5))),console[_0x2cc524(0x16b)](_0x4524e6[_0x2cc524(0x1c2)](_0x2cc524(0x14a))),console[_0x2cc524(0x16b)](_0x4524e6[_0x2cc524(0x1c2)](_0x2cc524(0x1ab))),console[_0x2cc524(0x16b)]();if(_0x25cb28[_0x2cc524(0x123)]===0x0)return console[_0x2cc524(0x158)](_0x2cc524(0x148)),console[_0x2cc524(0x158)](_0x2cc524(0x13a)),0x1;const _0x53e7b4=_0x25cb28[0x0],_0x8af320=_0x447bd5,_0x467b56=_0x8af320[_0x2cc524(0x1af)],_0x229cb9=_0x8af320[_0x2cc524(0x1c4)];try{if(!_0x229cb9){const _0x14e9e3=_0x3489db[_0x2cc524(0x10c)][_0x2cc524(0x162)](_0x53e7b4),_0x2b7108=_0x467b56||_0x14e9e3[_0x2cc524(0x179)][_0x2cc524(0x140)],_0x5cd0b4=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x3489db[_0x2cc524(0x10c)]['projects'](),{'verbose':_0x447bd5[_0x2cc524(0x1a2)]}),_0x1da18b=_0x5cd0b4['data']['find'](_0x48c6b8=>_0x48c6b8[_0x2cc524(0x105)][_0x2cc524(0x1af)]===_0x2b7108);if(_0x1da18b&&!_0x447bd5[_0x2cc524(0x19a)]){const _0x38620a=await confirm(_0x2cc524(0x142)+_0x2b7108+_0x2cc524(0x1ac));if(!_0x38620a)return console[_0x2cc524(0x16b)](_0x2cc524(0x19b)),0x0;}}const _0x4b8ec0=await withSpinner(_0x229cb9?_0x2cc524(0x120)+_0x53e7b4+'\x27...':'Restoring\x20project\x20from\x20\x27'+_0x53e7b4+_0x2cc524(0x1c0),()=>_0x3489db['llm']['restoreProject'](_0x53e7b4,{'name':_0x467b56,'dryRun':_0x229cb9}),{'verbose':_0x447bd5[_0x2cc524(0x1a2)]}),_0x54db54=_0x4b8ec0[_0x2cc524(0xfb)];return _0x54db54[_0x2cc524(0x1c8)]&&console[_0x2cc524(0x16b)]('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x54db54[_0x2cc524(0x1c8)]+'\x27'),_0x229cb9?console[_0x2cc524(0x16b)](_0x2cc524(0x109)+_0x54db54[_0x2cc524(0x140)]):console[_0x2cc524(0x16b)](_0x2cc524(0x133)+_0x54db54['projectName']+'\x20('+_0x54db54[_0x2cc524(0x1ba)]+')'),console[_0x2cc524(0x16b)](_0x2cc524(0x11c)+_0x54db54['counts'][_0x2cc524(0x110)]),console[_0x2cc524(0x16b)](_0x2cc524(0x129)+_0x54db54[_0x2cc524(0x100)][_0x2cc524(0x1bd)]),console[_0x2cc524(0x16b)](_0x2cc524(0xf5)+_0x54db54[_0x2cc524(0x100)]['prompts']),console['log'](_0x2cc524(0x1b7)+_0x54db54['counts'][_0x2cc524(0x157)]),(_0x447bd5[_0x2cc524(0x15b)]===_0x2cc524(0x192)||_0x447bd5['format']===_0x2cc524(0x1a1))&&await handleSDKOutput([_0x54db54],_0x447bd5),0x0;}catch(_0x9d5e1a){return handleSDKError(_0x9d5e1a,_0x447bd5),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x428db2,_0x378027){const _0x2d133c=a19_0x1eebd6,_0x248cb3=_0x378027[_0x2d133c(0x118)]||CHAT_SELECTOR_PAGE_SIZE;let _0x281bdb=0x0,_0x3a14e9=[];const _0x4c9929=(await import(_0x2d133c(0x183)))[_0x2d133c(0xf8)],_0x58c080=getChalk(_0x378027);while(!![]){const _0x53fd25=await withSpinner(_0x2d133c(0x175),()=>_0x428db2[_0x2d133c(0x10c)][_0x2d133c(0x189)](_0x248cb3+_0x281bdb),{'verbose':_0x378027['verbose']});_0x3a14e9=_0x53fd25[_0x2d133c(0xfb)];const _0x3cbcb4=_0x3a14e9[_0x2d133c(0x17c)](_0x281bdb,_0x281bdb+_0x248cb3),_0x5b6dea=_0x3a14e9[_0x2d133c(0x123)]>_0x281bdb+_0x248cb3,_0xdebeaa=[...new Set(_0x3cbcb4[_0x2d133c(0xef)](_0x4d5931=>_0x4d5931[_0x2d133c(0x105)][_0x2d133c(0x10f)])[_0x2d133c(0xff)](_0xd6bfde=>_0xd6bfde!==undefined))],_0xa269b=new Map();await Promise['all'](_0xdebeaa['map'](async _0x34cdb8=>{const _0x2ff474=_0x2d133c;try{const _0x55092e=await _0x428db2[_0x2ff474(0x10c)][_0x2ff474(0x11e)](_0x34cdb8);_0xa269b[_0x2ff474(0x134)](_0x34cdb8,_0x55092e['attributes'][_0x2ff474(0x1af)]);}catch{_0xa269b['set'](_0x34cdb8,_0x34cdb8);}}));const _0x1fead3=_0x3cbcb4[_0x2d133c(0xef)](_0x2180d4=>{const _0x2b2afc=_0x2d133c,_0x413034=_0x2180d4[_0x2b2afc(0x105)]['firstInputContent']||_0x2b2afc(0x161),_0x5e6896=_0x413034['split']('\x0a')[0x0],_0x467a55=_0x5e6896[_0x2b2afc(0x123)]>0x50?_0x5e6896[_0x2b2afc(0x1b3)](0x0,0x4d)+'...':_0x5e6896,_0x87f4d6=_0x2180d4[_0x2b2afc(0x105)][_0x2b2afc(0x10f)]?_0xa269b['get'](_0x2180d4[_0x2b2afc(0x105)]['agentId'])||_0x2180d4[_0x2b2afc(0x105)][_0x2b2afc(0x10f)]:_0x2b2afc(0x1b5),_0x204d6e=_0x2180d4['attributes'][_0x2b2afc(0x16a)]||_0x2180d4['attributes'][_0x2b2afc(0x17e)],_0x26ae9b=new Date(_0x204d6e),_0x4c73b3=new Date(),_0x44a338=_0x4c73b3['getTime']()-_0x26ae9b[_0x2b2afc(0x1ad)](),_0xb68dc4=Math[_0x2b2afc(0x1c1)](_0x44a338/0xea60),_0x38f35c=Math[_0x2b2afc(0x1c1)](_0x44a338/0x36ee80),_0x53d55e=Math[_0x2b2afc(0x1c1)](_0x44a338/0x5265c00);let _0x47747c;if(_0xb68dc4<0x1)_0x47747c='just\x20now';else{if(_0xb68dc4<0x3c)_0x47747c=_0xb68dc4+_0x2b2afc(0xe6);else{if(_0x38f35c<0x18)_0x47747c=_0x38f35c+_0x2b2afc(0x10e);else _0x53d55e<0x7?_0x47747c=_0x53d55e+_0x2b2afc(0x122):_0x47747c=_0x26ae9b[_0x2b2afc(0x170)]('en-US',{'month':_0x2b2afc(0xf2),'day':_0x2b2afc(0x124)});}}return{'title':_0x467a55+'\x20'+_0x58c080['dim']('['+_0x87f4d6+']\x20'+_0x47747c),'value':_0x2180d4['id']};});_0x5b6dea&&_0x1fead3[_0x2d133c(0x116)]({'title':_0x58c080['cyan']('Load\x20more...'),'value':'__load_more__'});const _0x2aa403=await _0x4c9929({'type':_0x2d133c(0x190),'name':_0x2d133c(0x1c3),'message':_0x2d133c(0x121),'choices':_0x1fead3,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x2aa403['chatId'])return undefined;if(_0x2aa403['chatId']===_0x2d133c(0x160)){_0x281bdb+=_0x248cb3;continue;}return _0x2aa403[_0x2d133c(0x1c3)];}}export class ChatsCommand extends BaseCommand{['name']='chats';[a19_0x1eebd6(0x136)]=a19_0x1eebd6(0x1a6);async[a19_0x1eebd6(0x1a7)](_0x424c9f){const _0x1a2d31=a19_0x1eebd6;return executeChatHistoryCommand(_0x424c9f,_0x1a2d31(0x16e));}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a20_0x3dc8d0=a20_0x5355;function a20_0x5355(_0x15d3e6,_0x1317e6){_0x15d3e6=_0x15d3e6-0x1c9;const _0x7196bd=a20_0x7196();let _0x5355ec=_0x7196bd[_0x15d3e6];return _0x5355ec;}(function(_0x1bb717,_0xeec45c){const _0x4e44da=a20_0x5355,_0x401e21=_0x1bb717();while(!![]){try{const _0xfd67=-parseInt(_0x4e44da(0x1ca))/0x1+-parseInt(_0x4e44da(0x1dd))/0x2*(-parseInt(_0x4e44da(0x1cd))/0x3)+parseInt(_0x4e44da(0x1e8))/0x4+parseInt(_0x4e44da(0x1d2))/0x5+parseInt(_0x4e44da(0x1fb))/0x6+parseInt(_0x4e44da(0x1dc))/0x7*(-parseInt(_0x4e44da(0x206))/0x8)+-parseInt(_0x4e44da(0x200))/0x9;if(_0xfd67===_0xeec45c)break;else _0x401e21['push'](_0x401e21['shift']());}catch(_0x301e53){_0x401e21['push'](_0x401e21['shift']());}}}(a20_0x7196,0x600ff));import a20_0xaf3d89 from'chalk';import{BaseCommand}from'./command.js';function a20_0x7196(){const _0x1130eb=['\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','SIGTERM','201694GuHjbK','cyan','server','42RdOLzr','name','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20is\x20unavailable,\x20using\x20port\x20','\x20\x20Project:','3072170SRFSQD','http://0.0.0.0:','Project\x20\x27','projects','\x27\x20not\x20found','find','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x0a\x0aShutting\x20down\x20proxy\x20server...','close','exit','4578021qcFUfl','64736kFbxNv','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','NOT_FOUND','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','llm','port','stop','white','\x20\x20}','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','2962224PqbvDA','yellow','execute','logLevel','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','Server\x20Configuration:','attributes','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x20\x20Agents:','logger','log','created\x20on-demand\x20per\x20model','site','dim','getOrCreateDefaultProject','init','\x20\x20{','3023820CmHXqE','bold','\x20\x20\x20\x20\x22env\x22:\x20{','Resolving\x20project...','✓\x20Proxy\x20server\x20stopped','9566496rHCjAO','llmProject','description','green','\x0aTesting\x20with\x20Agent\x20SDK:','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','8FlCzlX'];a20_0x7196=function(){return _0x1130eb;};return a20_0x7196();}import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x5b19e9,_0x34c750){const _0x2eb3eb=a20_0x5355,{tdx:_0x5ebe97,options:_0x2cd9ac}=_0x5b19e9,_0x36ae51=_0x34c750||_0x2cd9ac[_0x2eb3eb(0x201)];if(_0x36ae51){const _0x49cdd9=await _0x5ebe97[_0x2eb3eb(0x1e2)][_0x2eb3eb(0x1d5)](),_0x3c2982=_0x49cdd9[_0x2eb3eb(0x1d7)](_0xdeec33=>_0xdeec33[_0x2eb3eb(0x1f0)][_0x2eb3eb(0x1ce)]===_0x36ae51);if(!_0x3c2982)throw new SDKError(ErrorCode[_0x2eb3eb(0x1e0)],_0x2eb3eb(0x1d4)+_0x36ae51+_0x2eb3eb(0x1d6),undefined,{'helpText':_0x2eb3eb(0x205)});return _0x3c2982['id'];}const _0x1832fe=await _0x5ebe97['llm'][_0x2eb3eb(0x1f8)]();return _0x1832fe['id'];}export class LLMProxyCommand extends BaseCommand{[a20_0x3dc8d0(0x1ce)]='llm:proxy';[a20_0x3dc8d0(0x202)]=a20_0x3dc8d0(0x1e1);[a20_0x3dc8d0(0x1cc)];['logger'];async[a20_0x3dc8d0(0x1ea)](_0x3d0c92){const _0xed2e4=a20_0x3dc8d0,{tdx:_0x25797b,options:_0xb9c3cb}=_0x3d0c92;try{const _0x5c611f=_0xb9c3cb,_0x188943=_0x5c611f[_0xed2e4(0x1e3)]||0xfa0,_0x88db04=_0x5c611f['project'],_0x5bf750=await findAvailablePort(_0x188943);console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1f7)](_0xed2e4(0x1fe)));const _0x7bd1c4=await getProjectIdOrDefault(_0x3d0c92,_0x88db04),_0x406073=await _0x25797b[_0xed2e4(0x1e2)][_0xed2e4(0x1d5)](),_0x575ae2=_0x406073[_0xed2e4(0x1d7)](_0x3d9f91=>_0x3d9f91['id']===_0x7bd1c4);this[_0xed2e4(0x1f3)]=new TDXLogger(_0xb9c3cb[_0xed2e4(0x1eb)]),await this[_0xed2e4(0x1f3)][_0xed2e4(0x1f9)](),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1f7)]('Starting\x20proxy\x20server...'));_0x5bf750!==_0x188943&&console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e9)]('Port\x20'+_0x188943+_0xed2e4(0x1d0)+_0x5bf750));this[_0xed2e4(0x1cc)]=new ProxyServer({'port':_0x5bf750,'projectId':_0x7bd1c4,'tdx':_0x25797b,'logger':this['logger'],'site':_0xb9c3cb[_0xed2e4(0x1f6)]}),await this[_0xed2e4(0x1cc)]['start'](),console[_0xed2e4(0x1f4)](a20_0xaf3d89['yellow'][_0xed2e4(0x1fc)](_0xed2e4(0x1d8))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e9)](_0xed2e4(0x1f1))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e9)]('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x203)]['bold'](_0xed2e4(0x1ed))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1cb)](_0xed2e4(0x1ef))),console['log'](a20_0xaf3d89[_0xed2e4(0x1f7)]('\x20\x20Address:'),a20_0xaf3d89[_0xed2e4(0x1e5)](_0xed2e4(0x1d3)+_0x5bf750)),console['log'](a20_0xaf3d89[_0xed2e4(0x1f7)](_0xed2e4(0x1d1)),a20_0xaf3d89[_0xed2e4(0x1e5)](_0x575ae2?.[_0xed2e4(0x1f0)][_0xed2e4(0x1ce)]||_0x7bd1c4)),console[_0xed2e4(0x1f4)](a20_0xaf3d89['dim'](_0xed2e4(0x1f2)),a20_0xaf3d89[_0xed2e4(0x1e5)](_0xed2e4(0x1f5))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1f7)]('\x20\x20Site:'),a20_0xaf3d89['white'](_0xb9c3cb['site'])),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1cb)]('\x0aClaude\x20Code\x20Configuration:')),console['log'](a20_0xaf3d89[_0xed2e4(0x1f7)](_0xed2e4(0x1cf))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e5)](_0xed2e4(0x1fa))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e5)](_0xed2e4(0x1fd))),console['log'](a20_0xaf3d89['white'](_0xed2e4(0x1e7)+_0x5bf750+'\x22,')),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e5)](_0xed2e4(0x1df))),console['log'](a20_0xaf3d89['white'](_0xed2e4(0x1ec))),console['log'](a20_0xaf3d89['white']('\x20\x20\x20\x20}')),console[_0xed2e4(0x1f4)](a20_0xaf3d89['white'](_0xed2e4(0x1e6))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1cb)](_0xed2e4(0x204))),console['log'](a20_0xaf3d89[_0xed2e4(0x1f7)]('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1f7)](_0xed2e4(0x207))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1f7)](_0xed2e4(0x1ee))),console[_0xed2e4(0x1f4)](a20_0xaf3d89[_0xed2e4(0x1e9)](_0xed2e4(0x1de)));const _0x29b354=async()=>{const _0x1a7ae3=_0xed2e4;console['log'](a20_0xaf3d89[_0x1a7ae3(0x1f7)](_0x1a7ae3(0x1d9))),this[_0x1a7ae3(0x1cc)]&&await this['server'][_0x1a7ae3(0x1e4)](),this[_0x1a7ae3(0x1f3)]&&await this['logger'][_0x1a7ae3(0x1da)](),console[_0x1a7ae3(0x1f4)](a20_0xaf3d89['green'](_0x1a7ae3(0x1ff))),process[_0x1a7ae3(0x1db)](0x0);};return process['on']('SIGINT',_0x29b354),process['on'](_0xed2e4(0x1c9),_0x29b354),await new Promise(()=>{}),0x0;}catch(_0x1e7065){this[_0xed2e4(0x1cc)]&&await this['server'][_0xed2e4(0x1e4)]();this[_0xed2e4(0x1f3)]&&await this[_0xed2e4(0x1f3)][_0xed2e4(0x1da)]();throw _0x1e7065;}}}
|