@treasuredata/tdx 0.6.0 → 0.7.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 +2 -2
- 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/client/cdp-api-client.d.ts +8 -1
- package/dist/client/cdp-api-client.d.ts.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/cdp-api-client.js.map +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.d.ts +4 -0
- package/dist/client/http-client.d.ts.map +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/http-client.js.map +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.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/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.d.ts +149 -4
- package/dist/commands/parent-segment-command.d.ts.map +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/parent-segment-command.js.map +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.d.ts +24 -0
- package/dist/commands/segment-command.d.ts.map +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-command.js.map +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.d.ts.map +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-fields-command.js.map +1 -1
- package/dist/commands/segment-pwd-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.d.ts +187 -0
- package/dist/sdk/segment/parent-segment-preview.d.ts.map +1 -0
- package/dist/sdk/segment/parent-segment-preview.js +1 -0
- package/dist/sdk/segment/parent-segment-preview.js.map +1 -0
- package/dist/sdk/segment/parent-segment-yaml.d.ts +246 -0
- package/dist/sdk/segment/parent-segment-yaml.d.ts.map +1 -0
- package/dist/sdk/segment/parent-segment-yaml.js +1 -0
- package/dist/sdk/segment/parent-segment-yaml.js.map +1 -0
- package/dist/sdk/segment.d.ts +98 -1
- package/dist/sdk/segment.d.ts.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/segment.js.map +1 -1
- package/dist/sdk/workflow.d.ts.map +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/sdk/workflow.js.map +1 -1
- package/dist/types/cdp.d.ts +21 -0
- package/dist/types/cdp.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.d.ts +26 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +1 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/fields-display.d.ts +31 -0
- package/dist/utils/fields-display.d.ts.map +1 -0
- package/dist/utils/fields-display.js +1 -0
- package/dist/utils/fields-display.js.map +1 -0
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.d.ts +9 -1
- package/dist/utils/prompt.d.ts.map +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/prompt.js.map +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a39_0x1cfa1b=a39_0x162c;(function(_0x4a52bd,_0x33c10f){const _0x2434a9=a39_0x162c,_0x3f497a=_0x4a52bd();while(!![]){try{const _0x2efe78=parseInt(_0x2434a9(0xc6))/0x1*(parseInt(_0x2434a9(0x7c))/0x2)+-parseInt(_0x2434a9(0xf0))/0x3+-parseInt(_0x2434a9(0xb2))/0x4+parseInt(_0x2434a9(0xfb))/0x5*(-parseInt(_0x2434a9(0xd5))/0x6)+parseInt(_0x2434a9(0xf8))/0x7+parseInt(_0x2434a9(0x90))/0x8+-parseInt(_0x2434a9(0xe7))/0x9;if(_0x2efe78===_0x33c10f)break;else _0x3f497a['push'](_0x3f497a['shift']());}catch(_0x50c92f){_0x3f497a['push'](_0x3f497a['shift']());}}}(a39_0x74fa,0x85db9));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a39_0x5c9109 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0xc4);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xf4);async[a39_0x1cfa1b(0x6c)](_0x4d7f73){const _0xec089=a39_0x1cfa1b,{options:_0x1c99b4,args:_0x4488f7,tdx:_0x20a615}=_0x4d7f73,_0x3895e8=_0x4488f7[0x0];try{_0x1c99b4['verbose']&&_0x3895e8&&console[_0xec089(0xd0)](_0xec089(0x92)+_0x3895e8);const _0x4da450=await withSpinner(_0xec089(0x98),()=>_0x20a615[_0xec089(0x8d)]['projects'](_0x3895e8,{'limit':_0x1c99b4['limit']}),{'verbose':_0x1c99b4[_0xec089(0xd1)]}),_0x3d5ee0=_0x4da450[_0xec089(0xbf)];return console['error'](_0xec089(0xc3)+_0x3d5ee0[_0xec089(0x8e)]+_0xec089(0x8f)+(_0x3d5ee0['length']!==0x1?'s':'')),await handleSDKOutput(_0x3d5ee0,_0x1c99b4),0x0;}catch(_0x1e537b){if(_0x1e537b instanceof SDKError)return console[_0xec089(0xd0)](_0xec089(0xd9)+_0x1e537b[_0xec089(0xa3)]),_0x1e537b[_0xec089(0xe5)]&&console[_0xec089(0xd0)](_0xec089(0xa6)+_0x1e537b[_0xec089(0xe5)]),0x1;throw _0x1e537b;}}}function a39_0x162c(_0x4c449b,_0x308d06){const _0x74fa40=a39_0x74fa();return a39_0x162c=function(_0x162c06,_0x3e4ef0){_0x162c06=_0x162c06-0x6c;let _0x22e6f7=_0x74fa40[_0x162c06];return _0x22e6f7;},a39_0x162c(_0x4c449b,_0x308d06);}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xe8);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xab);async['execute'](_0x354bb2){const _0x27f291=a39_0x1cfa1b,{options:_0x3dd62c,args:_0x37b027,tdx:_0x268dec}=_0x354bb2,_0x4ecda5=_0x37b027[0x0];try{_0x3dd62c['verbose']&&_0x4ecda5&&console[_0x27f291(0xd0)](_0x27f291(0x86)+_0x4ecda5);const _0x33da69=await withSpinner(_0x27f291(0xf1),()=>_0x268dec[_0x27f291(0x8d)][_0x27f291(0xc2)](_0x4ecda5,{'limit':_0x3dd62c['limit']}),{'verbose':_0x3dd62c[_0x27f291(0xd1)]}),_0x2e10d0=_0x33da69[_0x27f291(0xbf)];return console[_0x27f291(0xd0)](_0x27f291(0xc3)+_0x2e10d0[_0x27f291(0x8e)]+_0x27f291(0x77)+(_0x2e10d0[_0x27f291(0x8e)]!==0x1?'s':'')),await handleSDKOutput(_0x2e10d0,_0x3dd62c),0x0;}catch(_0x42fb63){if(_0x42fb63 instanceof SDKError)return console['error']('Error:\x20'+_0x42fb63['message']),_0x42fb63[_0x27f291(0xe5)]&&console[_0x27f291(0xd0)](_0x27f291(0xa6)+_0x42fb63['cause']),0x1;throw _0x42fb63;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xa2);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xac);async[a39_0x1cfa1b(0x6c)](_0x819cd0){const _0x3b6420=a39_0x1cfa1b,{options:_0x145b87,args:_0x5b5c43,tdx:_0x3a0743}=_0x819cd0;let _0x393b5c,_0x19649c;if(_0x5b5c43[0x0]){const _0x474aac=_0x5b5c43[0x0][_0x3b6420(0xe9)]('.');if(_0x474aac[_0x3b6420(0x8e)]===0x1)_0x393b5c=_0x474aac[0x0];else{if(_0x474aac['length']===0x2)[_0x393b5c,_0x19649c]=_0x474aac;else return console[_0x3b6420(0xd0)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x145b87['verbose']){if(_0x393b5c&&_0x19649c)console[_0x3b6420(0xd0)](_0x3b6420(0xeb)+_0x393b5c+'.'+_0x19649c);else _0x393b5c&&console[_0x3b6420(0xd0)](_0x3b6420(0x83)+_0x393b5c);const _0x36f2af=_0x145b87['status'];_0x36f2af&&console[_0x3b6420(0xd0)](_0x3b6420(0xbd)+_0x36f2af);}const _0x1fc51a=await withSpinner(_0x3b6420(0xcc),()=>_0x3a0743['workflow']['sessions']({'projectName':_0x393b5c,'workflowName':_0x19649c,'status':_0x145b87['status'],'fromTime':_0x145b87['from'],'toTime':_0x145b87['to'],'limit':_0x145b87[_0x3b6420(0xe4)]}),{'verbose':_0x145b87[_0x3b6420(0xd1)]}),_0x1fa401=_0x1fc51a[_0x3b6420(0xbf)];return console['error'](_0x3b6420(0xc3)+_0x1fa401[_0x3b6420(0x8e)]+_0x3b6420(0x93)+(_0x1fa401[_0x3b6420(0x8e)]!==0x1?'s':'')),await handleSDKOutput(_0x1fa401,_0x145b87),0x0;}catch(_0x524569){if(_0x524569 instanceof SDKError)return console['error'](_0x3b6420(0xd9)+_0x524569['message']),_0x524569['cause']&&console['error'](_0x3b6420(0xa6)+_0x524569[_0x3b6420(0xe5)]),0x1;throw _0x524569;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:attempts';[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xb6);async['execute'](_0x22cb79){const _0x1a8ed3=a39_0x1cfa1b,{options:_0xde39d6,args:_0x1ac037,tdx:_0x26fe0b}=_0x22cb79;let _0x5bbebb,_0x176cc0;if(_0x1ac037[0x0]){const _0x44124e=_0x1ac037[0x0][_0x1a8ed3(0xe9)]('.');if(_0x44124e[_0x1a8ed3(0x8e)]===0x1)_0x5bbebb=_0x44124e[0x0];else{if(_0x44124e['length']===0x2)[_0x5bbebb,_0x176cc0]=_0x44124e;else return console['error'](_0x1a8ed3(0xee)),0x1;}}try{const _0x33a5b6=_0xde39d6['includeRetried'];if(_0xde39d6[_0x1a8ed3(0xd1)]){if(_0x5bbebb&&_0x176cc0)console['error'](_0x1a8ed3(0xeb)+_0x5bbebb+'.'+_0x176cc0);else _0x5bbebb&&console[_0x1a8ed3(0xd0)]('Filter:\x20project='+_0x5bbebb);_0x33a5b6&&console[_0x1a8ed3(0xd0)](_0x1a8ed3(0xc5));}const _0x222b45=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x26fe0b[_0x1a8ed3(0x8d)][_0x1a8ed3(0xb8)]({'projectName':_0x5bbebb,'workflowName':_0x176cc0,'includeRetried':_0x33a5b6,'limit':_0xde39d6[_0x1a8ed3(0xe4)]}),{'verbose':_0xde39d6[_0x1a8ed3(0xd1)]}),_0x31898e=_0x222b45[_0x1a8ed3(0xbf)];return console['error'](_0x1a8ed3(0xc3)+_0x31898e[_0x1a8ed3(0x8e)]+_0x1a8ed3(0xdf)+(_0x31898e['length']!==0x1?'s':'')),await handleSDKOutput(_0x31898e,_0xde39d6),0x0;}catch(_0x16fcc1){if(_0x16fcc1 instanceof SDKError)return console[_0x1a8ed3(0xd0)](_0x1a8ed3(0xd9)+_0x16fcc1[_0x1a8ed3(0xa3)]),_0x16fcc1[_0x1a8ed3(0xe5)]&&console[_0x1a8ed3(0xd0)](_0x1a8ed3(0xa6)+_0x16fcc1['cause']),0x1;throw _0x16fcc1;}}}export class WorkflowAttemptCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:attempt';[a39_0x1cfa1b(0x8b)]='Show\x20specific\x20attempt\x20details';async[a39_0x1cfa1b(0x6c)](_0x4c3fe1){const _0x302e32=a39_0x1cfa1b,{options:_0xa67dce,args:_0x3216db,tdx:_0x58ecf8}=_0x4c3fe1,_0x1055b8=_0x3216db[0x0];if(!_0x1055b8)return console['error'](_0x302e32(0xf9)),0x1;try{_0xa67dce[_0x302e32(0xd1)]&&console[_0x302e32(0xd0)]('Attempt\x20ID:\x20'+_0x1055b8);const _0x36d313=await withSpinner(_0x302e32(0xdb),()=>_0x58ecf8['workflow'][_0x302e32(0xa8)](_0x1055b8),{'verbose':_0xa67dce[_0x302e32(0xd1)]}),_0x5a4fb8=_0x36d313['data'];let _0x237273;!_0x5a4fb8[_0x302e32(0xb9)]?_0x237273=_0x5a4fb8[_0x302e32(0x95)]?_0x302e32(0x9e):'running':_0x237273=_0x5a4fb8[_0x302e32(0xe3)]?'success':_0x302e32(0xd0);let _0x2c7d87;if(_0x5a4fb8[_0x302e32(0x79)]&&_0x5a4fb8[_0x302e32(0x94)]){const _0x5c050=new Date(_0x5a4fb8[_0x302e32(0x79)])['getTime'](),_0x255570=new Date(_0x5a4fb8[_0x302e32(0x94)])[_0x302e32(0x96)]();_0x2c7d87=Math['round']((_0x255570-_0x5c050)/0x3e8);}const _0x49d4bf={'attempt_id':_0x5a4fb8['id'],'status':_0x237273,..._0x5a4fb8[_0x302e32(0x88)]!==undefined&&{'index':_0x5a4fb8['index']},..._0x5a4fb8[_0x302e32(0xe2)]&&{'project':_0x5a4fb8[_0x302e32(0xe2)]['name']},..._0x5a4fb8[_0x302e32(0x8d)]&&{'workflow':_0x5a4fb8[_0x302e32(0x8d)][_0x302e32(0xae)]},..._0x5a4fb8[_0x302e32(0xd7)]&&{'session_id':_0x5a4fb8[_0x302e32(0xd7)]},..._0x5a4fb8[_0x302e32(0xf5)]&&{'session_time':_0x5a4fb8['sessionTime']},..._0x5a4fb8[_0x302e32(0x10c)]&&{'retry_attempt':_0x5a4fb8[_0x302e32(0x10c)]},..._0x2c7d87!==undefined&&{'duration_sec':_0x2c7d87},..._0x5a4fb8[_0x302e32(0x79)]&&{'created_at':_0x5a4fb8['createdAt']},..._0x5a4fb8['finishedAt']&&{'finished_at':_0x5a4fb8[_0x302e32(0x94)]},...Object[_0x302e32(0x82)](_0x5a4fb8[_0x302e32(0xc7)])['length']>0x0&&{'params':_0x5a4fb8[_0x302e32(0xc7)]}};return await handleSingleObjectOutput(_0x49d4bf,_0xa67dce),0x0;}catch(_0x55a47f){if(_0x55a47f instanceof SDKError)return console[_0x302e32(0xd0)](_0x302e32(0xd9)+_0x55a47f['message']),_0x55a47f['cause']&&console[_0x302e32(0xd0)](_0x302e32(0xa6)+_0x55a47f['cause']),0x1;throw _0x55a47f;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xc8);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x10a);async['execute'](_0x2fa61b){const _0xea7804=a39_0x1cfa1b,{options:_0x128b47,args:_0x1e9160,tdx:_0x84ca62}=_0x2fa61b,_0x29e2f4=_0x1e9160[0x0];if(!_0x29e2f4)return console[_0xea7804(0xd0)](_0xea7804(0xf9)),0x1;try{const _0x3dc862=_0x128b47[_0xea7804(0x6f)];_0x128b47[_0xea7804(0xd1)]&&(console[_0xea7804(0xd0)](_0xea7804(0xef)+_0x29e2f4),_0x3dc862&&console['error'](_0xea7804(0xc0)));const _0x4a6bc2=await withSpinner(_0xea7804(0xa4),()=>_0x84ca62['workflow'][_0xea7804(0x87)](_0x29e2f4,_0x3dc862||![]),{'verbose':_0x128b47[_0xea7804(0xd1)]}),_0x15428d=_0x4a6bc2[_0xea7804(0xbf)];return console[_0xea7804(0xd0)]('✔\x20Found\x20'+_0x15428d[_0xea7804(0x8e)]+_0xea7804(0xe0)+(_0x15428d['length']!==0x1?'s':'')),await handleSDKOutput(_0x15428d,_0x128b47),0x0;}catch(_0x47055a){if(_0x47055a instanceof SDKError)return console['error']('Error:\x20'+_0x47055a[_0xea7804(0xa3)]),_0x47055a[_0xea7804(0xe5)]&&console[_0xea7804(0xd0)]('\x20\x20Cause:\x20'+_0x47055a['cause']),0x1;throw _0x47055a;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0x10d);[a39_0x1cfa1b(0x8b)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a39_0x1cfa1b(0x6c)](_0x35d439){const _0x1a5bcc=a39_0x1cfa1b,{options:_0x3c0fd2,args:_0x20310c,tdx:_0x32a0ba}=_0x35d439,_0xa3ed96=_0x20310c[0x0];let _0x258481=_0x20310c[0x1];if(!_0xa3ed96)return console[_0x1a5bcc(0xd0)](_0x1a5bcc(0xf9)),0x1;try{_0x3c0fd2['verbose']&&(console[_0x1a5bcc(0xd0)]('Attempt\x20ID:\x20'+_0xa3ed96),_0x258481&&console['error'](_0x1a5bcc(0x8c)+_0x258481));const _0x457ef5=await withSpinner(_0x1a5bcc(0x71),()=>_0x32a0ba['workflow']['logFiles'](_0xa3ed96,_0x258481),{'verbose':_0x3c0fd2[_0x1a5bcc(0xd1)]}),_0x1c9d7f=_0x457ef5[_0x1a5bcc(0xbf)];if(_0x1c9d7f['length']===0x0)return console['error'](_0x1a5bcc(0xda)),0x0;if(!_0x258481&&(_0x3c0fd2['json']||_0x3c0fd2[_0x1a5bcc(0x100)]))return await handleSDKOutput(_0x1c9d7f,_0x3c0fd2),0x0;if(!_0x258481){const _0x5cfd74=_0x1c9d7f[_0x1a5bcc(0xfa)](_0x35c857=>({'title':_0x35c857[_0x1a5bcc(0x85)]+'\x20('+formatBytes(_0x35c857[_0x1a5bcc(0xb4)])+')','value':_0x35c857['taskName']})),_0x2b3aff=await a39_0x5c9109({'type':_0x1a5bcc(0xa0),'name':_0x1a5bcc(0x9b),'message':_0x1a5bcc(0x103),'choices':_0x5cfd74});if(!_0x2b3aff[_0x1a5bcc(0x9b)])return console[_0x1a5bcc(0xd0)](_0x1a5bcc(0x104)),0x0;_0x258481=_0x2b3aff[_0x1a5bcc(0x9b)];}const _0x4ab8bc=await withSpinner(_0x1a5bcc(0x9a),()=>_0x32a0ba[_0x1a5bcc(0x8d)]['logs'](_0xa3ed96,_0x258481),{'verbose':_0x3c0fd2[_0x1a5bcc(0xd1)]}),_0x5d9f64=_0x4ab8bc['data'];return _0x5d9f64?console[_0x1a5bcc(0xd2)](_0x5d9f64):console[_0x1a5bcc(0xd0)](_0x1a5bcc(0xde)),0x0;}catch(_0x28f4ce){if(_0x28f4ce instanceof SDKError)return console[_0x1a5bcc(0xd0)]('Error:\x20'+_0x28f4ce[_0x1a5bcc(0xa3)]),_0x28f4ce['cause']&&console[_0x1a5bcc(0xd0)](_0x1a5bcc(0xa6)+_0x28f4ce['cause']),0x1;throw _0x28f4ce;}}}function a39_0x74fa(){const _0x537e27=['2012169NFhseR','Listing\x20workflows...','...','reason','List\x20all\x20workflow\x20projects','sessionTime','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20Invalid\x20parameter\x20format:\x20','4292302UkVJVc','Error:\x20Attempt\x20ID\x20is\x20required','map','6005IJMjas','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Kill\x20a\x20running\x20attempt','param','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','format','session:','attemptId','Select\x20a\x20task\x20to\x20view\x20logs:','Cancelled','Starting\x20workflow\x20run...','stringify','readFile','resumeFrom','Target:\x20','Show\x20tasks\x20for\x20an\x20attempt','Error:\x20Invalid\x20JSON\x20in\x20--params','retryAttemptName','workflow:logs','isArray','session','execute','retrySession','\x22?\x20This\x20cannot\x20be\x20undone.','includeSubtasks','Pushing\x20workflow\x20project...','Fetching\x20log\x20files...','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','utf-8','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','\x20\x20New\x20attempt\x20ID:\x20','Project\x20name:\x20','\x20workflow','\x20\x20Session\x20ID:\x20','createdAt','Deleting\x20project\x20','\x20is\x20not\x20a\x20directory','596iegKWk','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','kill','Workflow:\x20','Retry\x20a\x20session\x20or\x20attempt','retryAttempt','keys','Filter:\x20project=','projectName','taskName','Project\x20filter:\x20','tasks','index','indexOf','revision','description','Task\x20name:\x20','workflow','length','\x20project','8557872RbccSt','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Pattern:\x20','\x20session','finishedAt','cancelRequested','getTime','Retrying\x20session...','Listing\x20workflow\x20projects...','From\x20task:\x20','Downloading\x20logs...','task','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','\x20\x20Revision:\x20','canceling','Expected\x20format:\x20--param\x20key=value','select','workflow:kill','workflow:sessions','message','Getting\x20attempt\x20tasks...','\x20\x20Project\x20ID:\x20','\x20\x20Cause:\x20','Output\x20directory:\x20','attempt','Parameters:\x20','substring','List\x20workflows','List\x20workflow\x20execution\x20sessions','push','name','parse','\x20\x20Project:\x20','✔\x20Downloaded\x20','163848GjgiWF','fromTask','fileSize','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','List\x20workflow\x20attempts','\x20\x20Workflow:\x20','attempts','done','Usage:\x20workflow:delete\x20<project-name-or-id>','Killing\x20attempt...','✔\x20Deleted\x20project\x20','Status:\x20','delete','data','Including\x20subtasks:\x20yes','workflow:download','workflows','✔\x20Found\x20','workflow:projects','Include\x20retried:\x20yes','3019apJQLl','params','workflow:tasks','filesExtracted','stat','yes','Listing\x20workflow\x20sessions...','isDirectory','skipValidation','workflow:delete','error','verbose','log','Project:\x20','Validation:\x20skipped','2982mzABoP','Resume\x20from:\x20','sessionId','startsWith','Error:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Getting\x20attempt\x20details...','Project\x20directory:\x20','projectId','No\x20log\x20content\x20found','\x20attempt','\x20task','✔\x20Pushed\x20','project','success','limit','cause','✔\x20Retry\x20started','6531471WCYNZn','workflow:workflows','split','Error:\x20Workflow\x20identifier\x20is\x20required','Filter:\x20','run','Params:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Attempt\x20ID:\x20'];a39_0x74fa=function(){return _0x537e27;};return a39_0x74fa();}export class WorkflowKillCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0xa1);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xfd);async[a39_0x1cfa1b(0x6c)](_0x332c26){const _0x24dbfb=a39_0x1cfa1b,{options:_0xf0eee5,args:_0x1736d4,tdx:_0x14ce6a}=_0x332c26,_0x2b6801=_0x1736d4[0x0];if(!_0x2b6801)return console[_0x24dbfb(0xd0)](_0x24dbfb(0xf9)),0x1;try{const _0x4e9071=_0xf0eee5[_0x24dbfb(0xf3)];_0xf0eee5['verbose']&&(console[_0x24dbfb(0xd0)](_0x24dbfb(0xef)+_0x2b6801),_0x4e9071&&console[_0x24dbfb(0xd0)]('Reason:\x20'+_0x4e9071));if(!_0xf0eee5[_0x24dbfb(0xcb)]){const _0x31bd6a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x2b6801+'?');if(!_0x31bd6a)return console[_0x24dbfb(0xd0)]('Cancelled'),0x0;}const _0x1f9034=await withSpinner(_0x24dbfb(0xbb),()=>_0x14ce6a[_0x24dbfb(0x8d)][_0x24dbfb(0x7e)](_0x2b6801,_0x4e9071),{'verbose':_0xf0eee5['verbose']}),_0x2f8d05=_0x1f9034['data'];return console['error']('✔\x20'+_0x2f8d05),0x0;}catch(_0x491d5f){if(_0x491d5f instanceof SDKError)return console[_0x24dbfb(0xd0)](_0x24dbfb(0xd9)+_0x491d5f[_0x24dbfb(0xa3)]),_0x491d5f[_0x24dbfb(0xe5)]&&console['error']('\x20\x20Cause:\x20'+_0x491d5f[_0x24dbfb(0xe5)]),0x1;throw _0x491d5f;}}}export class WorkflowRetryCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:retry';[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x80);async['execute'](_0xfadd89){const _0x1422e2=a39_0x1cfa1b,{options:_0x6a1cda,args:_0x598469,tdx:_0x13749f}=_0xfadd89,_0x563b11=_0x598469[0x0];if(!_0x563b11)return console[_0x1422e2(0xd0)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x1422e2(0xd0)](_0x1422e2(0xf6)),0x1;let _0x15fc1e=![],_0x1c2af3=_0x563b11;if(_0x563b11[_0x1422e2(0xd8)](_0x1422e2(0x101)))_0x15fc1e=!![],_0x1c2af3=_0x563b11[_0x1422e2(0xaa)](0x8);else{if(_0x563b11['startsWith']('attempt:'))_0x15fc1e=![],_0x1c2af3=_0x563b11[_0x1422e2(0xaa)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x1422e2(0xd0)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;}try{const _0x315025=_0x6a1cda[_0x1422e2(0xb3)],_0x32a679=_0x6a1cda[_0x1422e2(0x108)],_0xedf111=_0x6a1cda[_0x1422e2(0xc7)],_0x32dd33=_0x6a1cda['force'];_0x6a1cda[_0x1422e2(0xd1)]&&(console[_0x1422e2(0xd0)](_0x1422e2(0x109)+(_0x15fc1e?'session':_0x1422e2(0xa8))+'\x20'+_0x1c2af3),_0x315025&&console['error'](_0x1422e2(0x99)+_0x315025),_0x32a679&&console[_0x1422e2(0xd0)](_0x1422e2(0xd6)+_0x32a679),_0xedf111&&console[_0x1422e2(0xd0)](_0x1422e2(0xed)+_0xedf111),_0x32dd33&&console[_0x1422e2(0xd0)]('Force:\x20yes'));let _0x3b1514;if(_0xedf111)try{if(_0xedf111[_0x1422e2(0xd8)]('@')){const _0x3d2430=await import('fs/promises'),_0x1d6825=_0xedf111[_0x1422e2(0xaa)](0x1),_0x385e66=await _0x3d2430[_0x1422e2(0x107)](_0x1d6825,_0x1422e2(0x73));_0x3b1514=JSON[_0x1422e2(0xaf)](_0x385e66);}else _0x3b1514=JSON[_0x1422e2(0xaf)](_0xedf111);}catch{return console['error'](_0x1422e2(0x10b)),0x1;}if(!_0x6a1cda[_0x1422e2(0xcb)]){const _0x133c9e=await confirm(_0x1422e2(0x9c)+(_0x15fc1e?_0x1422e2(0x10f):_0x1422e2(0xa8))+'\x20'+_0x1c2af3+'?');if(!_0x133c9e)return console[_0x1422e2(0xd0)](_0x1422e2(0x104)),0x0;}let _0x5b5eb9;_0x15fc1e?_0x5b5eb9=await withSpinner(_0x1422e2(0x97),()=>_0x13749f['workflow'][_0x1422e2(0x6d)](_0x1c2af3,{'fromTask':_0x315025,'retryParams':_0x3b1514}),{'verbose':_0x6a1cda['verbose']}):_0x5b5eb9=await withSpinner('Retrying\x20attempt...',()=>_0x13749f['workflow'][_0x1422e2(0x81)](_0x1c2af3,{'resumeFrom':_0x32a679,'retryParams':_0x3b1514,'force':_0x32dd33}),{'verbose':_0x6a1cda['verbose']});const _0x5e1ad1=_0x5b5eb9[_0x1422e2(0xbf)];return console[_0x1422e2(0xd0)](_0x1422e2(0xe6)),console[_0x1422e2(0xd0)](_0x1422e2(0x75)+_0x5e1ad1[_0x1422e2(0x102)]),console[_0x1422e2(0xd0)](_0x1422e2(0x78)+_0x5e1ad1['sessionId']),0x0;}catch(_0x389905){if(_0x389905 instanceof SDKError)return console[_0x1422e2(0xd0)](_0x1422e2(0xd9)+_0x389905[_0x1422e2(0xa3)]),_0x389905[_0x1422e2(0xe5)]&&console[_0x1422e2(0xd0)]('\x20\x20Cause:\x20'+_0x389905['cause']),0x1;throw _0x389905;}}}export class WorkflowRunCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:run';[a39_0x1cfa1b(0x8b)]='Start\x20a\x20workflow\x20run';async[a39_0x1cfa1b(0x6c)](_0x85e53f){const _0x4aae77=a39_0x1cfa1b,{options:_0x14a041,args:_0x2b2794,tdx:_0x438ea1}=_0x85e53f,_0x3b692f=_0x2b2794[0x0];if(!_0x3b692f)return console[_0x4aae77(0xd0)](_0x4aae77(0xea)),console['error'](_0x4aae77(0xff)),0x1;const _0x2ac0c7=_0x14a041[_0x4aae77(0xfe)],_0x2728a2=_0x14a041[_0x4aae77(0xf5)],_0x7381cf={};if(_0x2ac0c7&&Array[_0x4aae77(0x10e)](_0x2ac0c7))for(const _0x311096 of _0x2ac0c7){const _0xba45ef=_0x311096[_0x4aae77(0x89)]('=');if(_0xba45ef===-0x1)return console[_0x4aae77(0xd0)](_0x4aae77(0xf7)+_0x311096),console[_0x4aae77(0xd0)](_0x4aae77(0x9f)),0x1;const _0x32f107=_0x311096[_0x4aae77(0xaa)](0x0,_0xba45ef),_0x287a57=_0x311096[_0x4aae77(0xaa)](_0xba45ef+0x1);try{_0x7381cf[_0x32f107]=JSON[_0x4aae77(0xaf)](_0x287a57);}catch{_0x7381cf[_0x32f107]=_0x287a57;}}_0x14a041[_0x4aae77(0xd1)]&&(console[_0x4aae77(0xd0)](_0x4aae77(0x7f)+_0x3b692f),Object[_0x4aae77(0x82)](_0x7381cf)[_0x4aae77(0x8e)]>0x0&&console[_0x4aae77(0xd0)](_0x4aae77(0xa9)+JSON[_0x4aae77(0x106)](_0x7381cf)),_0x2728a2&&console[_0x4aae77(0xd0)]('Session\x20time:\x20'+_0x2728a2));const _0x2b5d0c=await withSpinner(_0x4aae77(0x105),()=>_0x438ea1['workflow'][_0x4aae77(0xec)](_0x3b692f,_0x7381cf,{'sessionTime':_0x2728a2}),{'verbose':_0x14a041[_0x4aae77(0xd1)]}),_0x325e44=_0x2b5d0c[_0x4aae77(0xbf)];return console[_0x4aae77(0xd0)]('✔\x20Workflow\x20run\x20started'),console[_0x4aae77(0xd0)]('\x20\x20Attempt\x20ID:\x20'+_0x325e44['id']),console[_0x4aae77(0xd0)]('\x20\x20Session\x20ID:\x20'+_0x325e44[_0x4aae77(0xd7)]),console[_0x4aae77(0xd0)](_0x4aae77(0xb0)+_0x325e44[_0x4aae77(0xe2)]?.[_0x4aae77(0xae)]),console['error'](_0x4aae77(0xb7)+_0x325e44[_0x4aae77(0x8d)]?.[_0x4aae77(0xae)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xc1);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x91);async[a39_0x1cfa1b(0x6c)](_0x46d27c){const _0x19e9bc=a39_0x1cfa1b,{options:_0x43f42d,args:_0x3d4ed4,tdx:_0x1c2705}=_0x46d27c,_0x3182be=_0x3d4ed4[0x0],_0x4e6c5f=_0x3d4ed4[0x1]||'.';if(!_0x3182be)return console[_0x19e9bc(0xd0)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x19e9bc(0xd0)](_0x19e9bc(0xb5)),0x1;const _0xa82d2e=_0x43f42d[_0x19e9bc(0x8a)];_0x43f42d['verbose']&&(console[_0x19e9bc(0xd0)](_0x19e9bc(0xd3)+_0x3182be),console[_0x19e9bc(0xd0)](_0x19e9bc(0xa7)+_0x4e6c5f),_0xa82d2e&&console[_0x19e9bc(0xd0)]('Revision:\x20'+_0xa82d2e));const _0x20b1a3=await withSpinner('Downloading\x20project\x20'+_0x3182be+_0x19e9bc(0xf2),()=>_0x1c2705[_0x19e9bc(0x8d)]['download'](_0x3182be,_0x4e6c5f,{'revision':_0xa82d2e}),{'verbose':_0x43f42d[_0x19e9bc(0xd1)]}),_0x5dbc66=_0x20b1a3['data'];return console['error'](_0x19e9bc(0xb1)+_0x5dbc66[_0x19e9bc(0x84)]),console['error'](_0x19e9bc(0x9d)+_0x5dbc66[_0x19e9bc(0x8a)]),console[_0x19e9bc(0xd0)]('\x20\x20Files\x20extracted:\x20'+_0x5dbc66[_0x19e9bc(0xc9)]),console['error']('\x20\x20Location:\x20'+_0x4e6c5f+'/'+_0x5dbc66[_0x19e9bc(0x84)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']='workflow:push';[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x72);async[a39_0x1cfa1b(0x6c)](_0xc29135){const _0xcbc79b=a39_0x1cfa1b,{options:_0x6833ba,args:_0x353580,tdx:_0xf3e083}=_0xc29135;let _0x20f515='.',_0x5ac5a8=_0x6833ba[_0xcbc79b(0xae)];if(_0x353580[0x0]){const {promises:_0x2f1c0f}=await import('fs');try{const _0x2e7bed=await _0x2f1c0f[_0xcbc79b(0xca)](_0x353580[0x0]);if(_0x2e7bed[_0xcbc79b(0xcd)]())_0x20f515=_0x353580[0x0];else return console[_0xcbc79b(0xd0)](_0xcbc79b(0xd9)+_0x353580[0x0]+_0xcbc79b(0x7b)),0x1;}catch{_0x5ac5a8=_0x353580[0x0],_0x20f515='.';}}const _0x4e5b91=_0x6833ba['revision'],_0x22d39c=_0x6833ba[_0xcbc79b(0xce)];_0x6833ba['verbose']&&(console[_0xcbc79b(0xd0)](_0xcbc79b(0xdc)+_0x20f515),_0x5ac5a8&&console['error'](_0xcbc79b(0x76)+_0x5ac5a8),_0x4e5b91&&console[_0xcbc79b(0xd0)]('Revision:\x20'+_0x4e5b91),_0x22d39c&&console[_0xcbc79b(0xd0)](_0xcbc79b(0xd4)));const _0x259373=await withSpinner(_0xcbc79b(0x70),()=>_0xf3e083[_0xcbc79b(0x8d)][_0xcbc79b(0xad)](_0x20f515,{'projectName':_0x5ac5a8,'revision':_0x4e5b91,'skipValidation':_0x22d39c}),{'verbose':_0x6833ba[_0xcbc79b(0xd1)]}),_0x1b38cc=_0x259373[_0xcbc79b(0xbf)];return console[_0xcbc79b(0xd0)](_0xcbc79b(0xe1)+_0x1b38cc[_0xcbc79b(0x84)]),console[_0xcbc79b(0xd0)](_0xcbc79b(0xa5)+_0x1b38cc[_0xcbc79b(0xdd)]),console[_0xcbc79b(0xd0)](_0xcbc79b(0x9d)+_0x1b38cc[_0xcbc79b(0x8a)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0xcf);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x7d);async[a39_0x1cfa1b(0x6c)](_0x458d4c){const _0x47c610=a39_0x1cfa1b,{options:_0x53bc43,args:_0x5c42a1,tdx:_0x40e319}=_0x458d4c,_0x59c09d=_0x5c42a1[0x0];if(!_0x59c09d)return console[_0x47c610(0xd0)](_0x47c610(0x74)),console[_0x47c610(0xd0)](_0x47c610(0xba)),0x1;_0x53bc43[_0x47c610(0xd1)]&&console['error'](_0x47c610(0xd3)+_0x59c09d);if(!_0x53bc43[_0x47c610(0xcb)]){const _0x389325=await confirm(_0x47c610(0xfc)+_0x59c09d+_0x47c610(0x6e));if(!_0x389325)return console[_0x47c610(0xd0)](_0x47c610(0x104)),0x0;}const _0x3cf246=await withSpinner(_0x47c610(0x7a)+_0x59c09d+_0x47c610(0xf2),()=>_0x40e319[_0x47c610(0x8d)][_0x47c610(0xbe)](_0x59c09d),{'verbose':_0x53bc43[_0x47c610(0xd1)]}),_0x361492=_0x3cf246['data'];return console[_0x47c610(0xd0)](_0x47c610(0xbc)+_0x361492['projectName']),console['error'](_0x47c610(0xa5)+_0x361492[_0x47c610(0xdd)]),0x0;}}
|
|
1
|
+
const a39_0x538516=a39_0x5249;(function(_0x2f062b,_0x4c8a7e){const _0x44a421=a39_0x5249,_0xf9cab5=_0x2f062b();while(!![]){try{const _0x55093b=parseInt(_0x44a421(0x17b))/0x1+-parseInt(_0x44a421(0x1c8))/0x2+-parseInt(_0x44a421(0x1de))/0x3*(parseInt(_0x44a421(0x176))/0x4)+parseInt(_0x44a421(0x1d4))/0x5+-parseInt(_0x44a421(0x1a0))/0x6*(parseInt(_0x44a421(0x1b9))/0x7)+parseInt(_0x44a421(0x1e0))/0x8*(-parseInt(_0x44a421(0x155))/0x9)+-parseInt(_0x44a421(0x16f))/0xa*(-parseInt(_0x44a421(0x1ae))/0xb);if(_0x55093b===_0x4c8a7e)break;else _0xf9cab5['push'](_0xf9cab5['shift']());}catch(_0x114b81){_0xf9cab5['push'](_0xf9cab5['shift']());}}}(a39_0x50ba,0x4c5ce));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a39_0x5249(_0x53d0f4,_0x187c0b){const _0x50ba1f=a39_0x50ba();return a39_0x5249=function(_0x52496c,_0x5972b3){_0x52496c=_0x52496c-0x14f;let _0x3b1c45=_0x50ba1f[_0x52496c];return _0x3b1c45;},a39_0x5249(_0x53d0f4,_0x187c0b);}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a39_0x50ba(){const _0x3e4fac=['keys','Fetching\x20log\x20files...','session:','kill','params','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Error:\x20Attempt\x20ID\x20is\x20required','List\x20workflow\x20attempts','Filter:\x20project=','workflow:kill','\x20\x20Session\x20ID:\x20','format','running','getTime','indexOf','...','Session\x20time:\x20','includeSubtasks','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Expected\x20format:\x20--param\x20key=value','workflow','10QxSasy','canceling','push','length','Error:\x20Invalid\x20JSON\x20in\x20--params','Revision:\x20','Start\x20a\x20workflow\x20run','4AOaxnL','sessionId','\x20\x20New\x20attempt\x20ID:\x20','workflow:workflows','workflow:delete','91584zppEhd','\x22?\x20This\x20cannot\x20be\x20undone.','project','retryAttemptName','projectName','List\x20all\x20workflow\x20projects','Output\x20directory:\x20','Project\x20directory:\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Filter:\x20','sessionTime','param','workflow:tasks','resumeFrom','message','\x20attempt','Resume\x20from:\x20','stringify','createdAt','\x20\x20Cause:\x20','workflows','limit','Including\x20subtasks:\x20yes','retrySession','Project\x20name:\x20','filesExtracted','done','delete','Pushing\x20workflow\x20project...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','substring','Killing\x20attempt...','startsWith','Listing\x20workflow\x20projects...','logFiles','success','fromTask','696XIANsS','isArray','status','Project\x20filter:\x20','Show\x20specific\x20attempt\x20details','execute','Show\x20tasks\x20for\x20an\x20attempt','data','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','workflow:logs','Retrying\x20session...','workflow:download','\x20\x20Project\x20ID:\x20','projects','9849543Edsgmm','workflow:projects','run','Kill\x20a\x20running\x20attempt','Attempt\x20ID:\x20','cause','workflow:run','force','task','\x20\x20Location:\x20','\x20project','19341KHZbPS','skipValidation','Parameters:\x20','Target:\x20','✔\x20Found\x20','download','projectId','workflow:attempts','Getting\x20attempt\x20tasks...','error','\x20is\x20not\x20a\x20directory','index','fs/promises','description','\x20\x20Files\x20extracted:\x20','91888xINelX','parse','taskName','Force:\x20yes','✔\x20Deleted\x20project\x20','workflow:sessions','Status:\x20','session','isDirectory','stat','\x20\x20Revision:\x20','cancelRequested','2093565eCQpaq','name','logs','fileSize','select','attemptId','json','Deleting\x20project\x20','tasks','revision','1682139kKNlrl','workflow:push','102008mHpXPj','Cancelled','Task\x20name:\x20','attempt','yes','readFile','Listing\x20workflow\x20sessions...','Project:\x20','Params:\x20','verbose','Starting\x20workflow\x20run...','✔\x20Retry\x20started','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','List\x20workflows','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','attempts','includeRetried','split','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Error:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Downloading\x20project\x20','Error:\x20Workflow\x20identifier\x20is\x20required','finishedAt','utf-8','workflow:attempt','Listing\x20workflows...','117WPcewr','Error:\x20Invalid\x20parameter\x20format:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Retry\x20a\x20session\x20or\x20attempt'];a39_0x50ba=function(){return _0x3e4fac;};return a39_0x50ba();}import{formatBytes}from'../utils/formatters.js';import a39_0x25e3c6 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1af);[a39_0x538516(0x1c6)]=a39_0x538516(0x180);async[a39_0x538516(0x1a5)](_0x278940){const _0x31b258=a39_0x538516,{options:_0x529fc3,args:_0x4e3e9c,tdx:_0x3c310b}=_0x278940,_0x7f1a89=_0x4e3e9c[0x0];try{_0x529fc3[_0x31b258(0x1e9)]&&_0x7f1a89&&console[_0x31b258(0x1c2)]('Pattern:\x20'+_0x7f1a89);const _0x1123e4=await withSpinner(_0x31b258(0x19c),()=>_0x3c310b['workflow'][_0x31b258(0x1ad)](_0x7f1a89,{'limit':_0x529fc3['limit']}),{'verbose':_0x529fc3[_0x31b258(0x1e9)]}),_0x3c6c60=_0x1123e4[_0x31b258(0x1a7)];return console[_0x31b258(0x1c2)](_0x31b258(0x1bd)+_0x3c6c60[_0x31b258(0x172)]+_0x31b258(0x1b8)+(_0x3c6c60[_0x31b258(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x3c6c60,_0x529fc3),0x0;}catch(_0x1c80b5){if(_0x1c80b5 instanceof SDKError)return console[_0x31b258(0x1c2)]('Error:\x20'+_0x1c80b5[_0x31b258(0x189)]),_0x1c80b5[_0x31b258(0x1b3)]&&console[_0x31b258(0x1c2)](_0x31b258(0x18e)+_0x1c80b5[_0x31b258(0x1b3)]),0x1;throw _0x1c80b5;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a39_0x538516(0x179);[a39_0x538516(0x1c6)]=a39_0x538516(0x1ed);async[a39_0x538516(0x1a5)](_0x553249){const _0x1e78fa=a39_0x538516,{options:_0x199020,args:_0x10826a,tdx:_0x127870}=_0x553249,_0x5dbbe4=_0x10826a[0x0];try{_0x199020[_0x1e78fa(0x1e9)]&&_0x5dbbe4&&console[_0x1e78fa(0x1c2)](_0x1e78fa(0x1a3)+_0x5dbbe4);const _0x104f19=await withSpinner(_0x1e78fa(0x154),()=>_0x127870[_0x1e78fa(0x16e)][_0x1e78fa(0x18f)](_0x5dbbe4,{'limit':_0x199020[_0x1e78fa(0x190)]}),{'verbose':_0x199020[_0x1e78fa(0x1e9)]}),_0x3bfc8b=_0x104f19[_0x1e78fa(0x1a7)];return console[_0x1e78fa(0x1c2)](_0x1e78fa(0x1bd)+_0x3bfc8b[_0x1e78fa(0x172)]+'\x20workflow'+(_0x3bfc8b[_0x1e78fa(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x3bfc8b,_0x199020),0x0;}catch(_0x142212){if(_0x142212 instanceof SDKError)return console[_0x1e78fa(0x1c2)](_0x1e78fa(0x1f3)+_0x142212['message']),_0x142212['cause']&&console[_0x1e78fa(0x1c2)](_0x1e78fa(0x18e)+_0x142212[_0x1e78fa(0x1b3)]),0x1;throw _0x142212;}}}export class WorkflowSessionsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1cd);[a39_0x538516(0x1c6)]='List\x20workflow\x20execution\x20sessions';async['execute'](_0x2c2cc5){const _0x22f99e=a39_0x538516,{options:_0x29f818,args:_0x307a51,tdx:_0x3bb705}=_0x2c2cc5;let _0x1adfc1,_0x482741;if(_0x307a51[0x0]){const _0x5d530b=_0x307a51[0x0][_0x22f99e(0x1f1)]('.');if(_0x5d530b[_0x22f99e(0x172)]===0x1)_0x1adfc1=_0x5d530b[0x0];else{if(_0x5d530b[_0x22f99e(0x172)]===0x2)[_0x1adfc1,_0x482741]=_0x5d530b;else return console[_0x22f99e(0x1c2)](_0x22f99e(0x1f4)),0x1;}}try{if(_0x29f818[_0x22f99e(0x1e9)]){if(_0x1adfc1&&_0x482741)console[_0x22f99e(0x1c2)](_0x22f99e(0x184)+_0x1adfc1+'.'+_0x482741);else _0x1adfc1&&console['error'](_0x22f99e(0x162)+_0x1adfc1);const _0x2a2741=_0x29f818[_0x22f99e(0x1a2)];_0x2a2741&&console[_0x22f99e(0x1c2)](_0x22f99e(0x1ce)+_0x2a2741);}const _0xd8c412=await withSpinner(_0x22f99e(0x1e6),()=>_0x3bb705[_0x22f99e(0x16e)]['sessions']({'projectName':_0x1adfc1,'workflowName':_0x482741,'status':_0x29f818[_0x22f99e(0x1a2)],'fromTime':_0x29f818['from'],'toTime':_0x29f818['to'],'limit':_0x29f818['limit']}),{'verbose':_0x29f818['verbose']}),_0x19f426=_0xd8c412[_0x22f99e(0x1a7)];return console[_0x22f99e(0x1c2)](_0x22f99e(0x1bd)+_0x19f426['length']+'\x20session'+(_0x19f426[_0x22f99e(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x19f426,_0x29f818),0x0;}catch(_0xbac069){if(_0xbac069 instanceof SDKError)return console[_0x22f99e(0x1c2)]('Error:\x20'+_0xbac069['message']),_0xbac069[_0x22f99e(0x1b3)]&&console[_0x22f99e(0x1c2)](_0x22f99e(0x18e)+_0xbac069['cause']),0x1;throw _0xbac069;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1c0);['description']=a39_0x538516(0x161);async['execute'](_0x41897c){const _0x373855=a39_0x538516,{options:_0xd62223,args:_0x1d27c9,tdx:_0x1adcd2}=_0x41897c;let _0x50c410,_0x4c3fd1;if(_0x1d27c9[0x0]){const _0x2803ce=_0x1d27c9[0x0][_0x373855(0x1f1)]('.');if(_0x2803ce['length']===0x1)_0x50c410=_0x2803ce[0x0];else{if(_0x2803ce['length']===0x2)[_0x50c410,_0x4c3fd1]=_0x2803ce;else return console[_0x373855(0x1c2)](_0x373855(0x1f4)),0x1;}}try{const _0x4db326=_0xd62223[_0x373855(0x1f0)];if(_0xd62223[_0x373855(0x1e9)]){if(_0x50c410&&_0x4c3fd1)console[_0x373855(0x1c2)](_0x373855(0x184)+_0x50c410+'.'+_0x4c3fd1);else _0x50c410&&console['error']('Filter:\x20project='+_0x50c410);_0x4db326&&console['error']('Include\x20retried:\x20yes');}const _0x480620=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x1adcd2[_0x373855(0x16e)][_0x373855(0x1ef)]({'projectName':_0x50c410,'workflowName':_0x4c3fd1,'includeRetried':_0x4db326,'limit':_0xd62223['limit']}),{'verbose':_0xd62223[_0x373855(0x1e9)]}),_0x53f0a0=_0x480620[_0x373855(0x1a7)];return console['error'](_0x373855(0x1bd)+_0x53f0a0[_0x373855(0x172)]+_0x373855(0x18a)+(_0x53f0a0[_0x373855(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x53f0a0,_0xd62223),0x0;}catch(_0x25d6fb){if(_0x25d6fb instanceof SDKError)return console[_0x373855(0x1c2)]('Error:\x20'+_0x25d6fb[_0x373855(0x189)]),_0x25d6fb[_0x373855(0x1b3)]&&console[_0x373855(0x1c2)](_0x373855(0x18e)+_0x25d6fb[_0x373855(0x1b3)]),0x1;throw _0x25d6fb;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a39_0x538516(0x153);[a39_0x538516(0x1c6)]=a39_0x538516(0x1a4);async[a39_0x538516(0x1a5)](_0x4cf634){const _0x1ad952=a39_0x538516,{options:_0x33e1fa,args:_0xb22cf1,tdx:_0x541dd1}=_0x4cf634,_0x48cc92=_0xb22cf1[0x0];if(!_0x48cc92)return console['error'](_0x1ad952(0x160)),0x1;try{_0x33e1fa['verbose']&&console[_0x1ad952(0x1c2)](_0x1ad952(0x1b2)+_0x48cc92);const _0x45fb89=await withSpinner('Getting\x20attempt\x20details...',()=>_0x541dd1[_0x1ad952(0x16e)][_0x1ad952(0x1e3)](_0x48cc92),{'verbose':_0x33e1fa[_0x1ad952(0x1e9)]}),_0x32240f=_0x45fb89[_0x1ad952(0x1a7)];let _0x586158;!_0x32240f[_0x1ad952(0x195)]?_0x586158=_0x32240f[_0x1ad952(0x1d3)]?_0x1ad952(0x170):_0x1ad952(0x166):_0x586158=_0x32240f[_0x1ad952(0x19e)]?_0x1ad952(0x19e):_0x1ad952(0x1c2);let _0x2dd59a;if(_0x32240f[_0x1ad952(0x18d)]&&_0x32240f[_0x1ad952(0x151)]){const _0x56bbe6=new Date(_0x32240f[_0x1ad952(0x18d)])[_0x1ad952(0x167)](),_0x1fb837=new Date(_0x32240f['finishedAt'])['getTime']();_0x2dd59a=Math['round']((_0x1fb837-_0x56bbe6)/0x3e8);}const _0x1d2dd5={'attempt_id':_0x32240f['id'],'status':_0x586158,..._0x32240f[_0x1ad952(0x1c4)]!==undefined&&{'index':_0x32240f[_0x1ad952(0x1c4)]},..._0x32240f[_0x1ad952(0x17d)]&&{'project':_0x32240f[_0x1ad952(0x17d)][_0x1ad952(0x1d5)]},..._0x32240f[_0x1ad952(0x16e)]&&{'workflow':_0x32240f[_0x1ad952(0x16e)]['name']},..._0x32240f['sessionId']&&{'session_id':_0x32240f[_0x1ad952(0x177)]},..._0x32240f[_0x1ad952(0x185)]&&{'session_time':_0x32240f[_0x1ad952(0x185)]},..._0x32240f['retryAttemptName']&&{'retry_attempt':_0x32240f[_0x1ad952(0x17e)]},..._0x2dd59a!==undefined&&{'duration_sec':_0x2dd59a},..._0x32240f[_0x1ad952(0x18d)]&&{'created_at':_0x32240f[_0x1ad952(0x18d)]},..._0x32240f[_0x1ad952(0x151)]&&{'finished_at':_0x32240f[_0x1ad952(0x151)]},...Object[_0x1ad952(0x15a)](_0x32240f[_0x1ad952(0x15e)])[_0x1ad952(0x172)]>0x0&&{'params':_0x32240f['params']}};return await handleSingleObjectOutput(_0x1d2dd5,_0x33e1fa),0x0;}catch(_0x46b175){if(_0x46b175 instanceof SDKError)return console['error'](_0x1ad952(0x1f3)+_0x46b175[_0x1ad952(0x189)]),_0x46b175[_0x1ad952(0x1b3)]&&console[_0x1ad952(0x1c2)](_0x1ad952(0x18e)+_0x46b175[_0x1ad952(0x1b3)]),0x1;throw _0x46b175;}}}export class WorkflowTasksCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x187);[a39_0x538516(0x1c6)]=a39_0x538516(0x1a6);async[a39_0x538516(0x1a5)](_0x5abca8){const _0x135a4d=a39_0x538516,{options:_0x1c9796,args:_0x53141c,tdx:_0x32c7d5}=_0x5abca8,_0x272898=_0x53141c[0x0];if(!_0x272898)return console[_0x135a4d(0x1c2)](_0x135a4d(0x160)),0x1;try{const _0x403903=_0x1c9796[_0x135a4d(0x16b)];_0x1c9796[_0x135a4d(0x1e9)]&&(console['error'](_0x135a4d(0x1b2)+_0x272898),_0x403903&&console[_0x135a4d(0x1c2)](_0x135a4d(0x191)));const _0x3149b1=await withSpinner(_0x135a4d(0x1c1),()=>_0x32c7d5['workflow'][_0x135a4d(0x1dc)](_0x272898,_0x403903||![]),{'verbose':_0x1c9796[_0x135a4d(0x1e9)]}),_0x290714=_0x3149b1[_0x135a4d(0x1a7)];return console[_0x135a4d(0x1c2)](_0x135a4d(0x1bd)+_0x290714[_0x135a4d(0x172)]+'\x20task'+(_0x290714[_0x135a4d(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x290714,_0x1c9796),0x0;}catch(_0x381827){if(_0x381827 instanceof SDKError)return console[_0x135a4d(0x1c2)](_0x135a4d(0x1f3)+_0x381827['message']),_0x381827[_0x135a4d(0x1b3)]&&console[_0x135a4d(0x1c2)]('\x20\x20Cause:\x20'+_0x381827[_0x135a4d(0x1b3)]),0x1;throw _0x381827;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1a9);[a39_0x538516(0x1c6)]=a39_0x538516(0x183);async[a39_0x538516(0x1a5)](_0x147d72){const _0x533273=a39_0x538516,{options:_0x195adf,args:_0x3d0782,tdx:_0x478a98}=_0x147d72,_0xc6a36e=_0x3d0782[0x0];let _0x4a2679=_0x3d0782[0x1];if(!_0xc6a36e)return console[_0x533273(0x1c2)](_0x533273(0x160)),0x1;try{_0x195adf[_0x533273(0x1e9)]&&(console[_0x533273(0x1c2)](_0x533273(0x1b2)+_0xc6a36e),_0x4a2679&&console[_0x533273(0x1c2)](_0x533273(0x1e2)+_0x4a2679));const _0xb011fc=await withSpinner(_0x533273(0x15b),()=>_0x478a98[_0x533273(0x16e)][_0x533273(0x19d)](_0xc6a36e,_0x4a2679),{'verbose':_0x195adf[_0x533273(0x1e9)]}),_0x1fa1e5=_0xb011fc[_0x533273(0x1a7)];if(_0x1fa1e5[_0x533273(0x172)]===0x0)return console[_0x533273(0x1c2)](_0x533273(0x16c)),0x0;if(!_0x4a2679&&(_0x195adf[_0x533273(0x1da)]||_0x195adf[_0x533273(0x165)]))return await handleSDKOutput(_0x1fa1e5,_0x195adf),0x0;if(!_0x4a2679){const _0x29ea35=_0x1fa1e5['map'](_0x594603=>({'title':_0x594603['taskName']+'\x20('+formatBytes(_0x594603[_0x533273(0x1d7)])+')','value':_0x594603[_0x533273(0x1ca)]})),_0xbf106c=await a39_0x25e3c6({'type':_0x533273(0x1d8),'name':_0x533273(0x1b6),'message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x29ea35});if(!_0xbf106c[_0x533273(0x1b6)])return console[_0x533273(0x1c2)](_0x533273(0x1e1)),0x0;_0x4a2679=_0xbf106c['task'];}const _0x43bc31=await withSpinner('Downloading\x20logs...',()=>_0x478a98['workflow'][_0x533273(0x1d6)](_0xc6a36e,_0x4a2679),{'verbose':_0x195adf[_0x533273(0x1e9)]}),_0x4e90e7=_0x43bc31[_0x533273(0x1a7)];return _0x4e90e7?console['log'](_0x4e90e7):console[_0x533273(0x1c2)]('No\x20log\x20content\x20found'),0x0;}catch(_0x1523b5){if(_0x1523b5 instanceof SDKError)return console[_0x533273(0x1c2)]('Error:\x20'+_0x1523b5[_0x533273(0x189)]),_0x1523b5[_0x533273(0x1b3)]&&console['error']('\x20\x20Cause:\x20'+_0x1523b5[_0x533273(0x1b3)]),0x1;throw _0x1523b5;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a39_0x538516(0x163);['description']=a39_0x538516(0x1b1);async[a39_0x538516(0x1a5)](_0x182956){const _0x14db4d=a39_0x538516,{options:_0x4d7aee,args:_0xcae1b4,tdx:_0x2475af}=_0x182956,_0x55ada8=_0xcae1b4[0x0];if(!_0x55ada8)return console[_0x14db4d(0x1c2)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x41bfe2=_0x4d7aee['reason'];_0x4d7aee[_0x14db4d(0x1e9)]&&(console[_0x14db4d(0x1c2)](_0x14db4d(0x1b2)+_0x55ada8),_0x41bfe2&&console[_0x14db4d(0x1c2)]('Reason:\x20'+_0x41bfe2));if(!_0x4d7aee[_0x14db4d(0x1e4)]){const _0xed0dd6=await confirm(_0x14db4d(0x1f2)+_0x55ada8+'?');if(!_0xed0dd6)return console[_0x14db4d(0x1c2)]('Cancelled'),0x0;}const _0x6a7a7f=await withSpinner(_0x14db4d(0x19a),()=>_0x2475af[_0x14db4d(0x16e)][_0x14db4d(0x15d)](_0x55ada8,_0x41bfe2),{'verbose':_0x4d7aee['verbose']}),_0x283835=_0x6a7a7f[_0x14db4d(0x1a7)];return console[_0x14db4d(0x1c2)]('✔\x20'+_0x283835),0x0;}catch(_0x42531d){if(_0x42531d instanceof SDKError)return console[_0x14db4d(0x1c2)]('Error:\x20'+_0x42531d[_0x14db4d(0x189)]),_0x42531d[_0x14db4d(0x1b3)]&&console['error'](_0x14db4d(0x18e)+_0x42531d[_0x14db4d(0x1b3)]),0x1;throw _0x42531d;}}}export class WorkflowRetryCommand extends BaseCommand{['name']='workflow:retry';[a39_0x538516(0x1c6)]=a39_0x538516(0x159);async[a39_0x538516(0x1a5)](_0x4a02ad){const _0xd164e3=a39_0x538516,{options:_0x2acc5b,args:_0x5dfe03,tdx:_0x256fec}=_0x4a02ad,_0x3bb55a=_0x5dfe03[0x0];if(!_0x3bb55a)return console[_0xd164e3(0x1c2)](_0xd164e3(0x1ec)),console[_0xd164e3(0x1c2)](_0xd164e3(0x1a8)),0x1;let _0x1ca7ce=![],_0x3fc516=_0x3bb55a;if(_0x3bb55a[_0xd164e3(0x19b)](_0xd164e3(0x15c)))_0x1ca7ce=!![],_0x3fc516=_0x3bb55a['substring'](0x8);else{if(_0x3bb55a[_0xd164e3(0x19b)]('attempt:'))_0x1ca7ce=![],_0x3fc516=_0x3bb55a[_0xd164e3(0x199)](0x8);else return console['error'](_0xd164e3(0x1ee)),console[_0xd164e3(0x1c2)](_0xd164e3(0x1a8)),0x1;}try{const _0x18d762=_0x2acc5b[_0xd164e3(0x19f)],_0x2f6020=_0x2acc5b[_0xd164e3(0x188)],_0x417393=_0x2acc5b[_0xd164e3(0x15e)],_0x39dae5=_0x2acc5b[_0xd164e3(0x1b5)];_0x2acc5b[_0xd164e3(0x1e9)]&&(console[_0xd164e3(0x1c2)](_0xd164e3(0x1bc)+(_0x1ca7ce?_0xd164e3(0x1cf):_0xd164e3(0x1e3))+'\x20'+_0x3fc516),_0x18d762&&console[_0xd164e3(0x1c2)]('From\x20task:\x20'+_0x18d762),_0x2f6020&&console[_0xd164e3(0x1c2)](_0xd164e3(0x18b)+_0x2f6020),_0x417393&&console[_0xd164e3(0x1c2)](_0xd164e3(0x1e8)+_0x417393),_0x39dae5&&console[_0xd164e3(0x1c2)](_0xd164e3(0x1cb)));let _0x208fbd;if(_0x417393)try{if(_0x417393[_0xd164e3(0x19b)]('@')){const _0x5e38b2=await import(_0xd164e3(0x1c5)),_0x541296=_0x417393[_0xd164e3(0x199)](0x1),_0x3b5aa7=await _0x5e38b2[_0xd164e3(0x1e5)](_0x541296,_0xd164e3(0x152));_0x208fbd=JSON[_0xd164e3(0x1c9)](_0x3b5aa7);}else _0x208fbd=JSON[_0xd164e3(0x1c9)](_0x417393);}catch{return console[_0xd164e3(0x1c2)](_0xd164e3(0x173)),0x1;}if(!_0x2acc5b[_0xd164e3(0x1e4)]){const _0x4a0a9a=await confirm(_0xd164e3(0x15f)+(_0x1ca7ce?'session':'attempt')+'\x20'+_0x3fc516+'?');if(!_0x4a0a9a)return console[_0xd164e3(0x1c2)](_0xd164e3(0x1e1)),0x0;}let _0x43d683;_0x1ca7ce?_0x43d683=await withSpinner(_0xd164e3(0x1aa),()=>_0x256fec[_0xd164e3(0x16e)][_0xd164e3(0x192)](_0x3fc516,{'fromTask':_0x18d762,'retryParams':_0x208fbd}),{'verbose':_0x2acc5b[_0xd164e3(0x1e9)]}):_0x43d683=await withSpinner('Retrying\x20attempt...',()=>_0x256fec[_0xd164e3(0x16e)]['retryAttempt'](_0x3fc516,{'resumeFrom':_0x2f6020,'retryParams':_0x208fbd,'force':_0x39dae5}),{'verbose':_0x2acc5b[_0xd164e3(0x1e9)]});const _0x4bc95d=_0x43d683[_0xd164e3(0x1a7)];return console[_0xd164e3(0x1c2)](_0xd164e3(0x1eb)),console[_0xd164e3(0x1c2)](_0xd164e3(0x178)+_0x4bc95d[_0xd164e3(0x1d9)]),console[_0xd164e3(0x1c2)]('\x20\x20Session\x20ID:\x20'+_0x4bc95d['sessionId']),0x0;}catch(_0x1411c8){if(_0x1411c8 instanceof SDKError)return console[_0xd164e3(0x1c2)](_0xd164e3(0x1f3)+_0x1411c8['message']),_0x1411c8[_0xd164e3(0x1b3)]&&console[_0xd164e3(0x1c2)]('\x20\x20Cause:\x20'+_0x1411c8[_0xd164e3(0x1b3)]),0x1;throw _0x1411c8;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a39_0x538516(0x1b4);[a39_0x538516(0x1c6)]=a39_0x538516(0x175);async[a39_0x538516(0x1a5)](_0x4f31cb){const _0x5f046b=a39_0x538516,{options:_0x4c1fb1,args:_0x3cbe3c,tdx:_0x58ad47}=_0x4f31cb,_0x4ff70e=_0x3cbe3c[0x0];if(!_0x4ff70e)return console[_0x5f046b(0x1c2)](_0x5f046b(0x150)),console[_0x5f046b(0x1c2)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x5b253=_0x4c1fb1[_0x5f046b(0x186)],_0x44bbfe=_0x4c1fb1[_0x5f046b(0x185)],_0x2c9bf3={};if(_0x5b253&&Array[_0x5f046b(0x1a1)](_0x5b253))for(const _0x386d35 of _0x5b253){const _0x508079=_0x386d35[_0x5f046b(0x168)]('=');if(_0x508079===-0x1)return console['error'](_0x5f046b(0x156)+_0x386d35),console['error'](_0x5f046b(0x16d)),0x1;const _0x209b48=_0x386d35[_0x5f046b(0x199)](0x0,_0x508079),_0x498664=_0x386d35[_0x5f046b(0x199)](_0x508079+0x1);try{_0x2c9bf3[_0x209b48]=JSON['parse'](_0x498664);}catch{_0x2c9bf3[_0x209b48]=_0x498664;}}_0x4c1fb1['verbose']&&(console[_0x5f046b(0x1c2)]('Workflow:\x20'+_0x4ff70e),Object['keys'](_0x2c9bf3)[_0x5f046b(0x172)]>0x0&&console[_0x5f046b(0x1c2)](_0x5f046b(0x1bb)+JSON[_0x5f046b(0x18c)](_0x2c9bf3)),_0x44bbfe&&console[_0x5f046b(0x1c2)](_0x5f046b(0x16a)+_0x44bbfe));const _0x33de97=await withSpinner(_0x5f046b(0x1ea),()=>_0x58ad47[_0x5f046b(0x16e)][_0x5f046b(0x1b0)](_0x4ff70e,_0x2c9bf3,{'sessionTime':_0x44bbfe}),{'verbose':_0x4c1fb1['verbose']}),_0x137259=_0x33de97['data'];return console[_0x5f046b(0x1c2)]('✔\x20Workflow\x20run\x20started'),console[_0x5f046b(0x1c2)]('\x20\x20Attempt\x20ID:\x20'+_0x137259['id']),console['error'](_0x5f046b(0x164)+_0x137259['sessionId']),console[_0x5f046b(0x1c2)]('\x20\x20Project:\x20'+_0x137259[_0x5f046b(0x17d)]?.[_0x5f046b(0x1d5)]),console[_0x5f046b(0x1c2)]('\x20\x20Workflow:\x20'+_0x137259['workflow']?.[_0x5f046b(0x1d5)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1ab);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a39_0x538516(0x1a5)](_0x40dddb){const _0x24595c=a39_0x538516,{options:_0x161cee,args:_0x3d0e83,tdx:_0x200736}=_0x40dddb,_0xe1935c=_0x3d0e83[0x0],_0x15ae94=_0x3d0e83[0x1]||'.';if(!_0xe1935c)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x24595c(0x198)),0x1;const _0x38e468=_0x161cee[_0x24595c(0x1dd)];_0x161cee[_0x24595c(0x1e9)]&&(console[_0x24595c(0x1c2)]('Project:\x20'+_0xe1935c),console[_0x24595c(0x1c2)](_0x24595c(0x181)+_0x15ae94),_0x38e468&&console[_0x24595c(0x1c2)](_0x24595c(0x174)+_0x38e468));const _0x4a1879=await withSpinner(_0x24595c(0x14f)+_0xe1935c+_0x24595c(0x169),()=>_0x200736[_0x24595c(0x16e)][_0x24595c(0x1be)](_0xe1935c,_0x15ae94,{'revision':_0x38e468}),{'verbose':_0x161cee[_0x24595c(0x1e9)]}),_0x472c48=_0x4a1879[_0x24595c(0x1a7)];return console[_0x24595c(0x1c2)]('✔\x20Downloaded\x20'+_0x472c48[_0x24595c(0x17f)]),console[_0x24595c(0x1c2)](_0x24595c(0x1d2)+_0x472c48[_0x24595c(0x1dd)]),console[_0x24595c(0x1c2)](_0x24595c(0x1c7)+_0x472c48[_0x24595c(0x194)]),console[_0x24595c(0x1c2)](_0x24595c(0x1b7)+_0x15ae94+'/'+_0x472c48[_0x24595c(0x17f)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1df);[a39_0x538516(0x1c6)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a39_0x538516(0x1a5)](_0x41615f){const _0x2952ef=a39_0x538516,{options:_0x1452e2,args:_0x1ce44f,tdx:_0x3778ee}=_0x41615f;let _0x3ac488='.',_0x48da12=_0x1452e2['name'];if(_0x1ce44f[0x0]){const {promises:_0x86ca03}=await import('fs');try{const _0x98919b=await _0x86ca03[_0x2952ef(0x1d1)](_0x1ce44f[0x0]);if(_0x98919b[_0x2952ef(0x1d0)]())_0x3ac488=_0x1ce44f[0x0];else return console[_0x2952ef(0x1c2)]('Error:\x20'+_0x1ce44f[0x0]+_0x2952ef(0x1c3)),0x1;}catch{_0x48da12=_0x1ce44f[0x0],_0x3ac488='.';}}const _0x4b9f51=_0x1452e2['revision'],_0x333a97=_0x1452e2[_0x2952ef(0x1ba)];_0x1452e2[_0x2952ef(0x1e9)]&&(console[_0x2952ef(0x1c2)](_0x2952ef(0x182)+_0x3ac488),_0x48da12&&console[_0x2952ef(0x1c2)](_0x2952ef(0x193)+_0x48da12),_0x4b9f51&&console['error'](_0x2952ef(0x174)+_0x4b9f51),_0x333a97&&console[_0x2952ef(0x1c2)]('Validation:\x20skipped'));const _0xd2c8c7=await withSpinner(_0x2952ef(0x197),()=>_0x3778ee[_0x2952ef(0x16e)][_0x2952ef(0x171)](_0x3ac488,{'projectName':_0x48da12,'revision':_0x4b9f51,'skipValidation':_0x333a97}),{'verbose':_0x1452e2[_0x2952ef(0x1e9)]}),_0x141ee6=_0xd2c8c7[_0x2952ef(0x1a7)];return console[_0x2952ef(0x1c2)]('✔\x20Pushed\x20'+_0x141ee6['projectName']),console['error'](_0x2952ef(0x1ac)+_0x141ee6[_0x2952ef(0x1bf)]),console['error']('\x20\x20Revision:\x20'+_0x141ee6[_0x2952ef(0x1dd)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a39_0x538516(0x17a);['description']='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a39_0x538516(0x1a5)](_0x5747a1){const _0x527ce3=a39_0x538516,{options:_0x563b16,args:_0x213a1b,tdx:_0x48ad9f}=_0x5747a1,_0xccb6ad=_0x213a1b[0x0];if(!_0xccb6ad)return console['error']('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console[_0x527ce3(0x1c2)](_0x527ce3(0x157)),0x1;_0x563b16[_0x527ce3(0x1e9)]&&console['error'](_0x527ce3(0x1e7)+_0xccb6ad);if(!_0x563b16['yes']){const _0x422cae=await confirm(_0x527ce3(0x158)+_0xccb6ad+_0x527ce3(0x17c));if(!_0x422cae)return console['error']('Cancelled'),0x0;}const _0x400552=await withSpinner(_0x527ce3(0x1db)+_0xccb6ad+'...',()=>_0x48ad9f['workflow'][_0x527ce3(0x196)](_0xccb6ad),{'verbose':_0x563b16['verbose']}),_0x2d8803=_0x400552[_0x527ce3(0x1a7)];return console[_0x527ce3(0x1c2)](_0x527ce3(0x1cc)+_0x2d8803[_0x527ce3(0x17f)]),console[_0x527ce3(0x1c2)](_0x527ce3(0x1ac)+_0x2d8803[_0x527ce3(0x1bf)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a40_0x2e11(_0xaf98f4,_0x5b5d8d){const _0x599458=a40_0x5994();return a40_0x2e11=function(_0x2e1159,_0x4b21df){_0x2e1159=_0x2e1159-0xfc;let _0x1dc9a9=_0x599458[_0x2e1159];return _0x1dc9a9;},a40_0x2e11(_0xaf98f4,_0x5b5d8d);}(function(_0x467cfd,_0x4ef269){const _0x4f31d9=a40_0x2e11,_0x2b722d=_0x467cfd();while(!![]){try{const _0x195307=-parseInt(_0x4f31d9(0x10f))/0x1+-parseInt(_0x4f31d9(0x100))/0x2*(-parseInt(_0x4f31d9(0x108))/0x3)+parseInt(_0x4f31d9(0xfd))/0x4+parseInt(_0x4f31d9(0x112))/0x5*(parseInt(_0x4f31d9(0x110))/0x6)+parseInt(_0x4f31d9(0x111))/0x7*(-parseInt(_0x4f31d9(0x113))/0x8)+-parseInt(_0x4f31d9(0xfc))/0x9+parseInt(_0x4f31d9(0x103))/0xa*(-parseInt(_0x4f31d9(0x101))/0xb);if(_0x195307===_0x4ef269)break;else _0x2b722d['push'](_0x2b722d['shift']());}catch(_0x272b1d){_0x2b722d['push'](_0x2b722d['shift']());}}}(a40_0x5994,0x4a613));import{platform}from'os';function a40_0x5994(){const _0x9dd563=['TD1\x20','8087izvYtH','1394478bhIiFp','56joXRFN','10IcVoKT','434528XkzxEw','1922697QDDvBq','1806640NOfAjq','tdx/','version','194926AjobuW','22LPQOct','url','265210WoEetK','parse','length','X-Trino-User','entries','3AMwISh','utf-8','tdx','Authorization','0.0.0','../../package.json'];a40_0x5994=function(){return _0x9dd563;};return a40_0x5994();}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x520cd1=a40_0x2e11;try{const _0x54cffe=fileURLToPath(import.meta[_0x520cd1(0x102)]),_0x24cae4=dirname(_0x54cffe),_0x106fce=join(_0x24cae4,_0x520cd1(0x10d)),_0x1b0c3a=JSON[_0x520cd1(0x104)](readFileSync(_0x106fce,_0x520cd1(0x109)));return _0x1b0c3a[_0x520cd1(0xff)];}catch{return _0x520cd1(0x10c);}}export function getUserAgent(){const _0x13723c=a40_0x2e11,_0x1bfa95=getVersion(),_0x5052f1=platform(),_0x2457bf=process[_0x13723c(0xff)]['replace']('v','');return _0x13723c(0xfe)+_0x1bfa95+'\x20('+_0x5052f1+';\x20node/'+_0x2457bf+')';}export function getAuthHeaders(_0x22829b,_0x42c24b){const _0xe985ac=a40_0x2e11,_0x5454ef=getVersion(),_0xd335d={'User-Agent':getUserAgent(),'X-TD-Client':_0xe985ac(0x10a),'X-TD-Client-Version':_0x5454ef};return _0x42c24b&&(_0xd335d[_0xe985ac(0x10b)]=_0xe985ac(0x10e)+_0x42c24b),_0xd335d;}export function toHeaderRecord(_0x5f423b){const _0x9c0826=a40_0x2e11,_0x2c3164={};for(const [_0x5a092b,_0x54beab]of Object[_0x9c0826(0x107)](_0x5f423b)){_0x54beab!==undefined&&(_0x2c3164[_0x5a092b]=_0x54beab);}return _0x2c3164;}export function getTrinoHeaders(_0x1026d3,_0x8846ce){const _0x33f01c=a40_0x2e11,_0x257439=getAuthHeaders(_0x1026d3,_0x8846ce),_0x3cad81=toHeaderRecord(_0x257439);return delete _0x3cad81[_0x33f01c(0x10b)],_0x8846ce&&(_0x3cad81[_0x33f01c(0x106)]=_0x8846ce),_0x3cad81;}export function hasAPIKey(_0x4aa1d1){const _0x2aeabf=a40_0x2e11,_0x1f7d8c=getAPIKey(_0x4aa1d1);return _0x1f7d8c!==undefined&&_0x1f7d8c[_0x2aeabf(0x105)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x23a133,_0x21b2b5){const _0x46e482=a41_0x5a32,_0x446bd2=_0x23a133();while(!![]){try{const _0x437a82=parseInt(_0x46e482(0x14a))/0x1+-parseInt(_0x46e482(0x183))/0x2+-parseInt(_0x46e482(0x144))/0x3*(-parseInt(_0x46e482(0x187))/0x4)+-parseInt(_0x46e482(0x185))/0x5*(parseInt(_0x46e482(0x147))/0x6)+-parseInt(_0x46e482(0x186))/0x7+-parseInt(_0x46e482(0x15a))/0x8+parseInt(_0x46e482(0x150))/0x9;if(_0x437a82===_0x21b2b5)break;else _0x446bd2['push'](_0x446bd2['shift']());}catch(_0x49e25f){_0x446bd2['push'](_0x446bd2['shift']());}}}(a41_0x47aa,0xee646));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0x1ee9a2 from'node:fs';import*as a41_0x730837 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a41_0x47aa(){const _0x6b63d6=['605195xjDQAr','some','warn','readFileSync','string','dev-us01','12451176asFWkb','.env','yellow','TDX_API_KEY_','profile','TD_API_KEY_','toUpperCase','dev-eu01','llm_default_project.','TDX_API_KEY','1911400DJNebn','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','legacy\x20.env\x20file\x20(profile:\x20','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','match','llm_default_project','apiKey','eu01','Warning:\x20Failed\x20to\x20read\x20','\x27,\x20defaulting\x20to\x20us01','env','TD_API_KEY','TDX_CACHE_DIR','name','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','map','Warning:\x20Failed\x20to\x20load\x20','legacy\x20.env\x20file','keychain\x20(profile:\x20','jp01','includes','ap02','split','parse','stringify','us01','.cache','slice','endsWith','filter','TDX_CONFIG_DIR','source','TDX_API_KEY_<PROFILE>','profiles','isDeprecated','keychain','stg-us01','ap03','stg-jp01','join','replace','1311524TLgbIK','apiKeys','3921185VJavef','5393759ezOAYS','1437256lUHFZw','tdx','existsSync','entries','TDX_API_KEY\x20env\x20var','startsWith','.env.','12BnJDMi','trim','utf-8','6KdQTZE','.config','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'];a41_0x47aa=function(){return _0x6b63d6;};return a41_0x47aa();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a41_0x2af68b from'chalk';export function getConfigDir(){const _0x4ed10e=a41_0x5a32;return process['env'][_0x4ed10e(0x178)]||join(homedir(),_0x4ed10e(0x148),_0x4ed10e(0x188));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x52aeea){const _0x324c53=a41_0x5a32,_0xcaaf84=getConfigDir();return _0x52aeea?a41_0x730837[_0x324c53(0x181)](_0xcaaf84,_0x324c53(0x143)+_0x52aeea):getConfigFile();}export function getCacheDir(){const _0x534cc3=a41_0x5a32;return process[_0x534cc3(0x164)][_0x534cc3(0x166)]||join(homedir(),_0x534cc3(0x174),_0x534cc3(0x188));}export function getLLMProjectCacheFile(_0x3098d8){const _0x139d82=a41_0x5a32,_0x1c842e=_0x3098d8?_0x139d82(0x158)+_0x3098d8:_0x139d82(0x15f);return join(getCacheDir(),_0x1c842e);}export function readCachedLLMProject(_0x42f970){const _0x1aa5b1=a41_0x5a32;try{const _0x545c19=getLLMProjectCacheFile(_0x42f970);if(!existsSync(_0x545c19))return null;const _0xad4a0a=readFileSync(_0x545c19,_0x1aa5b1(0x146))[_0x1aa5b1(0x145)]();try{const _0xea156a=JSON['parse'](_0xad4a0a);if(_0xea156a&&typeof _0xea156a['id']===_0x1aa5b1(0x14e)&&typeof _0xea156a[_0x1aa5b1(0x167)]==='string')return _0xea156a;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x67f3e,_0xbf0994,_0x5262c6){const _0x203338=a41_0x5a32;try{const _0x5b7ce9=getCacheDir(),_0x46b517=getLLMProjectCacheFile(_0x5262c6);!existsSync(_0x5b7ce9)&&mkdirSync(_0x5b7ce9,{'recursive':!![]});const _0x9a41ce={'name':_0x67f3e,'id':_0xbf0994};writeFileSync(_0x46b517,JSON[_0x203338(0x172)](_0x9a41ce),_0x203338(0x146));}catch{}}export function parseEnvFile(_0x2d874a){const _0x343ab3=a41_0x5a32,_0x1e5556={};for(const _0x48eec6 of _0x2d874a[_0x343ab3(0x170)]('\x0a')){const _0x27392d=_0x48eec6[_0x343ab3(0x145)]();if(!_0x27392d||_0x27392d[_0x343ab3(0x142)]('#'))continue;const _0x1b1e05=_0x27392d[_0x343ab3(0x15e)](/^([^=]+)=(.*)$/);if(_0x1b1e05){const _0xa889fd=_0x1b1e05[0x1][_0x343ab3(0x145)]();let _0x2eb753=_0x1b1e05[0x2][_0x343ab3(0x145)]();(_0x2eb753['startsWith']('\x22')&&_0x2eb753[_0x343ab3(0x176)]('\x22')||_0x2eb753[_0x343ab3(0x142)]('\x27')&&_0x2eb753[_0x343ab3(0x176)]('\x27'))&&(_0x2eb753=_0x2eb753[_0x343ab3(0x175)](0x1,-0x1)),_0x1e5556[_0xa889fd]=_0x2eb753;}}return _0x1e5556;}export function readUserConfig(){const _0x506271=a41_0x5a32,_0x366766=getConfigFile();if(!existsSync(_0x366766))return{};try{const _0x193aea=readFileSync(_0x366766,_0x506271(0x146));return parseEnvFile(_0x193aea);}catch(_0x1276b0){return console[_0x506271(0x14c)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x366766+':',_0x1276b0),{};}}function a41_0x5a32(_0x2d1835,_0x34dfab){const _0x47aac8=a41_0x47aa();return a41_0x5a32=function(_0x5a32d3,_0x3cde39){_0x5a32d3=_0x5a32d3-0x141;let _0x4ac2f4=_0x47aac8[_0x5a32d3];return _0x4ac2f4;},a41_0x5a32(_0x2d1835,_0x34dfab);}export function resolveSite(_0x18169d){const _0x1175f3=a41_0x5a32,_0x4aafbd=[_0x1175f3(0x173),_0x1175f3(0x16d),_0x1175f3(0x161),_0x1175f3(0x16f),_0x1175f3(0x17f),_0x1175f3(0x14f),'dev-eu01',_0x1175f3(0x17e),_0x1175f3(0x180),'stg-ap03'];if(_0x4aafbd[_0x1175f3(0x16e)](_0x18169d))return _0x18169d;if(_0x18169d in SITE_ALIASES)return SITE_ALIASES[_0x18169d];return console[_0x1175f3(0x14c)]('Warning:\x20Unknown\x20site\x20\x27'+_0x18169d+_0x1175f3(0x163)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x1bf059,_0x52c44c){const _0x316392=a41_0x5a32,_0x4e1de2=_0x52c44c||getActiveProfileName();if(_0x4e1de2){const _0x43f06b=_0x316392(0x153)+normalizeProfileForEnvVar(_0x4e1de2);if(process['env'][_0x43f06b])return process[_0x316392(0x164)][_0x43f06b];}if(process['env'][_0x316392(0x159)])return process[_0x316392(0x164)]['TDX_API_KEY'];if(process[_0x316392(0x164)]['TD_API_KEY'])return process['env'][_0x316392(0x165)];const _0x401cbc=_0x1bf059[_0x316392(0x156)]()[_0x316392(0x182)](/-/g,'_'),_0x479911=_0x316392(0x155)+_0x401cbc;if(_0x4e1de2){const _0x2eb9f0=loadProfileEnv(_0x4e1de2);if(_0x2eb9f0){if(_0x2eb9f0[_0x479911])return _0x2eb9f0[_0x479911];if(_0x2eb9f0[_0x316392(0x165)])return _0x2eb9f0[_0x316392(0x165)];}}const _0x5e34c9=loadUserConfigOnce();if(_0x5e34c9[_0x479911])return _0x5e34c9[_0x479911];if(_0x5e34c9[_0x316392(0x165)])return _0x5e34c9[_0x316392(0x165)];return undefined;}export function normalizeProfileForEnvVar(_0x403003){return _0x403003['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x58edd5,_0x1f130d){const _0x3a9a27=a41_0x5a32,_0x506a64=_0x1f130d||getActiveProfileName()||undefined;if(_0x506a64){const _0xfb12be=_0x3a9a27(0x153)+normalizeProfileForEnvVar(_0x506a64);if(process[_0x3a9a27(0x164)][_0xfb12be])return{'apiKey':process[_0x3a9a27(0x164)][_0xfb12be],'source':_0xfb12be+'\x20env\x20var','isDeprecated':![]};const _0x5aa2fb=getCachedCredential(_0x58edd5,_0x506a64);if(_0x5aa2fb)return{'apiKey':_0x5aa2fb,'source':_0x3a9a27(0x16c)+_0x506a64+')','isDeprecated':![]};const _0x344c40=await getKeychainAPIKey(_0x506a64);if(_0x344c40)return setCachedCredential(_0x344c40,_0x58edd5,_0x506a64),{'apiKey':_0x344c40,'source':'keychain\x20(profile:\x20'+_0x506a64+')','isDeprecated':![]};}if(process[_0x3a9a27(0x164)][_0x3a9a27(0x159)])return{'apiKey':process[_0x3a9a27(0x164)][_0x3a9a27(0x159)],'source':_0x3a9a27(0x141),'isDeprecated':![]};if(!_0x506a64){const _0x4970b0=getCachedCredential(_0x58edd5,undefined);if(_0x4970b0)return{'apiKey':_0x4970b0,'source':_0x3a9a27(0x17d),'isDeprecated':![]};const _0xb93fe5=await getKeychainAPIKey(undefined);if(_0xb93fe5)return setCachedCredential(_0xb93fe5,_0x58edd5,undefined),{'apiKey':_0xb93fe5,'source':_0x3a9a27(0x17d),'isDeprecated':![]};}if(process[_0x3a9a27(0x164)][_0x3a9a27(0x165)])return{'apiKey':process[_0x3a9a27(0x164)]['TD_API_KEY'],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x55f7d5=getLegacyEnvAPIKey(_0x58edd5,_0x506a64);if(_0x55f7d5){const _0x51f920=await isKeychainAvailable();if(_0x51f920)try{await saveKeychainAPIKey(_0x55f7d5,_0x506a64),setCachedCredential(_0x55f7d5,_0x58edd5,_0x506a64);const _0x15a5a7=getConfigFilePath(_0x506a64);cleanupLegacyEnvFile(_0x15a5a7)&&console[_0x3a9a27(0x14c)](a41_0x2af68b[_0x3a9a27(0x152)](_0x3a9a27(0x15b)));}catch(_0x2d3d86){console[_0x3a9a27(0x14c)](a41_0x2af68b['yellow'](_0x3a9a27(0x15d)+_0x2d3d86));}const _0x58b097=_0x506a64?_0x3a9a27(0x15c)+_0x506a64+')':_0x3a9a27(0x16b);return{'apiKey':_0x55f7d5,'source':_0x58b097,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x1a54a0,_0x4c7f88,_0x31545b=!![]){const _0x58f087=a41_0x5a32,_0x52a1d9=await resolveAPIKeyAsync(_0x1a54a0,_0x4c7f88);if(!_0x52a1d9)return undefined;if(_0x31545b&&_0x52a1d9[_0x58f087(0x17c)]&&_0x52a1d9[_0x58f087(0x179)]['includes'](_0x58f087(0x165))){const _0x482f88=_0x4c7f88||getActiveProfileName()||undefined,_0x49436b=_0x482f88?_0x58f087(0x153)+normalizeProfileForEnvVar(_0x482f88):_0x58f087(0x17a);console[_0x58f087(0x14c)](a41_0x2af68b['yellow'](_0x58f087(0x168)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x49436b+').')));}return _0x52a1d9[_0x58f087(0x160)];}function getLegacyEnvAPIKey(_0x515c85,_0x4e3661){const _0xb89dce=a41_0x5a32,_0x3229e9=_0x515c85['toUpperCase']()['replace'](/-/g,'_'),_0x4bddf6='TD_API_KEY_'+_0x3229e9;if(_0x4e3661){const _0x2d03ac=loadProfileEnv(_0x4e3661);if(_0x2d03ac){if(_0x2d03ac[_0x4bddf6])return _0x2d03ac[_0x4bddf6];if(_0x2d03ac[_0xb89dce(0x165)])return _0x2d03ac[_0xb89dce(0x165)];}}const _0x175d6a=loadUserConfigOnce();if(_0x175d6a[_0x4bddf6])return _0x175d6a[_0x4bddf6];if(_0x175d6a[_0xb89dce(0x165)])return _0x175d6a[_0xb89dce(0x165)];return undefined;}function cleanupLegacyEnvFile(_0x3a2fad){const _0x144ea4=a41_0x5a32;if(!existsSync(_0x3a2fad))return![];try{const _0x528233=readFileSync(_0x3a2fad,_0x144ea4(0x146)),_0x338b0e=_0x528233['split']('\x0a'),_0x4dd6a7=_0x338b0e[_0x144ea4(0x177)](_0x1b4b72=>{const _0xf1e175=_0x144ea4,_0x45b8bc=_0x1b4b72[_0xf1e175(0x145)]();if(!_0x45b8bc||_0x45b8bc[_0xf1e175(0x142)]('#'))return!![];const [_0x4dab8f]=_0x45b8bc['split']('=');return!_0x4dab8f[_0xf1e175(0x142)](_0xf1e175(0x165));}),_0x5cc054=_0x4dd6a7[_0x144ea4(0x14b)](_0x4c0076=>{const _0x94763c=_0x144ea4,_0x3ee666=_0x4c0076['trim']();return _0x3ee666&&!_0x3ee666[_0x94763c(0x142)]('#');});if(!_0x5cc054)return unlinkSync(_0x3a2fad),!![];return writeFileSync(_0x3a2fad,_0x4dd6a7[_0x144ea4(0x181)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x3635f9){const _0xa78284=a41_0x5a32,_0x435b7c=a41_0x730837[_0xa78284(0x181)](getConfigDir(),_0xa78284(0x143)+_0x3635f9);if(a41_0x1ee9a2[_0xa78284(0x189)](_0x435b7c)){validateSecureFilePermissions(_0x435b7c);try{const _0xbe9555=a41_0x1ee9a2[_0xa78284(0x14d)](_0x435b7c,_0xa78284(0x146));return parseEnvFile(_0xbe9555);}catch(_0x30f405){console['warn'](_0xa78284(0x16a)+_0x435b7c+':\x20'+_0x30f405);}}const _0x424822=a41_0x730837[_0xa78284(0x181)](getConfigDir(),_0xa78284(0x17b),_0x3635f9,_0xa78284(0x151));if(a41_0x1ee9a2[_0xa78284(0x189)](_0x424822)){validateSecureFilePermissions(_0x424822);try{const _0x42da41=a41_0x1ee9a2[_0xa78284(0x14d)](_0x424822,'utf-8');return parseEnvFile(_0x42da41);}catch(_0xe9c11e){return console[_0xa78284(0x14c)](_0xa78284(0x16a)+_0x424822+':\x20'+_0xe9c11e),null;}}return null;}function getActiveProfileName(){const _0x4e9e38=a41_0x5a32,_0x13b64d=a41_0x730837[_0x4e9e38(0x181)](getConfigDir(),'tdx.json');if(!a41_0x1ee9a2[_0x4e9e38(0x189)](_0x13b64d))return null;try{const _0x171788=a41_0x1ee9a2[_0x4e9e38(0x14d)](_0x13b64d,_0x4e9e38(0x146)),_0x1df888=JSON[_0x4e9e38(0x171)](_0x171788);return _0x1df888[_0x4e9e38(0x154)]||null;}catch{return null;}}export function saveAPIKey(_0x147e9c,_0x225ba9,_0x140c8a){const _0x4ed5d9=a41_0x5a32,_0x29f74c=getConfigDir(),_0x1db1fb=getConfigFilePath(_0x140c8a);!existsSync(_0x29f74c)&&mkdirSync(_0x29f74c,{'recursive':!![],'mode':0x1c0});let _0x4a9518={};if(existsSync(_0x1db1fb))try{const _0xfc0a0=readFileSync(_0x1db1fb,_0x4ed5d9(0x146));_0x4a9518=parseEnvFile(_0xfc0a0);}catch(_0x2516b1){console[_0x4ed5d9(0x14c)](_0x4ed5d9(0x162)+_0x1db1fb+':',_0x2516b1);}const _0x15f6aa=_0x147e9c[_0x4ed5d9(0x156)]()[_0x4ed5d9(0x182)](/-/g,'_');_0x4a9518['TD_API_KEY_'+_0x15f6aa]=_0x225ba9;const _0x44aeec=Object[_0x4ed5d9(0x18a)](_0x4a9518)[_0x4ed5d9(0x169)](([_0x48d25a,_0x302174])=>_0x48d25a+'='+_0x302174);writeFileSync(_0x1db1fb,_0x44aeec[_0x4ed5d9(0x181)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5789b7,_0x52e7bf,_0x3e06be){const _0x437942=a41_0x5a32;await saveKeychainAPIKey(_0x5789b7,_0x3e06be),setCachedCredential(_0x5789b7,_0x52e7bf,_0x3e06be);const _0x58a175=getConfigFilePath(_0x3e06be);cleanupLegacyEnvFile(_0x58a175)&&console['warn'](a41_0x2af68b['yellow'](_0x437942(0x149)));}export function loadConfig(){const _0x86dcd5=a41_0x5a32,_0x5e2679={'apiKeys':{},'defaultSite':'us01'},_0x227ca9=['us01',_0x86dcd5(0x16d),_0x86dcd5(0x161),_0x86dcd5(0x16f),'ap03',_0x86dcd5(0x14f),_0x86dcd5(0x157),'stg-us01',_0x86dcd5(0x180),'stg-ap03'];for(const _0x22b69f of _0x227ca9){const _0xce1f19=getAPIKey(_0x22b69f);_0xce1f19&&(_0x5e2679[_0x86dcd5(0x184)][_0x22b69f]=_0xce1f19);}return _0x5e2679;}
|
|
1
|
+
(function(_0x2bfcbd,_0x4d28db){const _0x35d0b7=a41_0x47a9,_0x26fc57=_0x2bfcbd();while(!![]){try{const _0x47f09d=parseInt(_0x35d0b7(0xba))/0x1*(parseInt(_0x35d0b7(0xa6))/0x2)+parseInt(_0x35d0b7(0x6f))/0x3+parseInt(_0x35d0b7(0x82))/0x4*(-parseInt(_0x35d0b7(0x83))/0x5)+parseInt(_0x35d0b7(0xb2))/0x6*(-parseInt(_0x35d0b7(0x8a))/0x7)+parseInt(_0x35d0b7(0x9f))/0x8*(parseInt(_0x35d0b7(0x7e))/0x9)+parseInt(_0x35d0b7(0xa7))/0xa+-parseInt(_0x35d0b7(0x7c))/0xb*(parseInt(_0x35d0b7(0x97))/0xc);if(_0x47f09d===_0x4d28db)break;else _0x26fc57['push'](_0x26fc57['shift']());}catch(_0x1a1130){_0x26fc57['push'](_0x26fc57['shift']());}}}(a41_0x1c74,0x536a5));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0xf5646e from'node:fs';import*as a41_0x4b0c97 from'node:path';function a41_0x1c74(){const _0x78989e=['profiles','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','tdx.json','20916OtyNZW','keychain\x20(profile:\x20','stg-jp01','profile','startsWith','stg-ap03','dev-eu01','slice','224hUDTkq','dev-us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','us01','map','Warning:\x20Unknown\x20site\x20\x27','join','4mvlDDw','1393950TpZFNt','trim','TD_API_KEY\x20env\x20var\x20(deprecated)','name','TDX_API_KEY_<PROFILE>','source','llm_default_project.','string','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','TD_API_KEY','.config','1880322rEQNlc','TDX_CONFIG_DIR','toUpperCase','tdx','TDX_API_KEY_','keychain','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','eu01','326726PawTjG','TDX_API_KEY\x20env\x20var','1916217ZMkXiZ','replace','TDX_CACHE_DIR','utf-8','\x27,\x20defaulting\x20to\x20us01','readFileSync','apiKey','legacy\x20.env\x20file\x20(profile:\x20','split','stringify','match','ap03','ap02','5797cbsIZc','TD_API_KEY_','199152Ylxghi','warn','env','Warning:\x20Failed\x20to\x20load\x20','4LgbTCe','2387765tlkkGq','TDX_API_KEY','existsSync','legacy\x20.env\x20file','endsWith','stg-us01','yellow','7OxQNVJ','jp01','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','\x20env\x20var','.cache','includes','.env.','.env','some','parse'];a41_0x1c74=function(){return _0x78989e;};return a41_0x1c74();}import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a41_0x2c3cae from'chalk';export function getConfigDir(){const _0x225b55=a41_0x47a9;return process[_0x225b55(0x80)][_0x225b55(0xb3)]||join(homedir(),_0x225b55(0xb1),_0x225b55(0xb5));}export function getConfigFile(){const _0x2f9f94=a41_0x47a9;return join(getConfigDir(),_0x2f9f94(0x91));}function a41_0x47a9(_0x5f51b8,_0xbb8312){const _0x1c74e3=a41_0x1c74();return a41_0x47a9=function(_0x47a953,_0x22b274){_0x47a953=_0x47a953-0x6f;let _0x2fcc8e=_0x1c74e3[_0x47a953];return _0x2fcc8e;},a41_0x47a9(_0x5f51b8,_0xbb8312);}export function getConfigFilePath(_0x43f0fe){const _0x585647=a41_0x47a9,_0x148779=getConfigDir();return _0x43f0fe?a41_0x4b0c97[_0x585647(0xa5)](_0x148779,_0x585647(0x90)+_0x43f0fe):getConfigFile();}export function getCacheDir(){const _0x2b63a4=a41_0x47a9;return process[_0x2b63a4(0x80)][_0x2b63a4(0x71)]||join(homedir(),_0x2b63a4(0x8e),'tdx');}export function getLLMProjectCacheFile(_0x440016){const _0x38d98f=a41_0x47a9,_0x3b6be6=_0x440016?_0x38d98f(0xad)+_0x440016:'llm_default_project';return join(getCacheDir(),_0x3b6be6);}export function readCachedLLMProject(_0x47e913){const _0x515a5b=a41_0x47a9;try{const _0x36adf0=getLLMProjectCacheFile(_0x47e913);if(!existsSync(_0x36adf0))return null;const _0x4c2f56=readFileSync(_0x36adf0,_0x515a5b(0x72))[_0x515a5b(0xa8)]();try{const _0x470927=JSON[_0x515a5b(0x93)](_0x4c2f56);if(_0x470927&&typeof _0x470927['id']===_0x515a5b(0xae)&&typeof _0x470927[_0x515a5b(0xaa)]==='string')return _0x470927;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x1621e1,_0x1eaee6,_0x2697ab){const _0x5da09e=a41_0x47a9;try{const _0x341d98=getCacheDir(),_0x30f38e=getLLMProjectCacheFile(_0x2697ab);!existsSync(_0x341d98)&&mkdirSync(_0x341d98,{'recursive':!![]});const _0x4834b5={'name':_0x1621e1,'id':_0x1eaee6};writeFileSync(_0x30f38e,JSON[_0x5da09e(0x78)](_0x4834b5),_0x5da09e(0x72));}catch{}}export function parseEnvFile(_0x41fec6){const _0x535e47=a41_0x47a9,_0x5768f0={};for(const _0x22704a of _0x41fec6[_0x535e47(0x77)]('\x0a')){const _0x59bacc=_0x22704a['trim']();if(!_0x59bacc||_0x59bacc['startsWith']('#'))continue;const _0x3094a8=_0x59bacc[_0x535e47(0x79)](/^([^=]+)=(.*)$/);if(_0x3094a8){const _0x91385=_0x3094a8[0x1][_0x535e47(0xa8)]();let _0x75c532=_0x3094a8[0x2]['trim']();(_0x75c532[_0x535e47(0x9b)]('\x22')&&_0x75c532[_0x535e47(0x87)]('\x22')||_0x75c532[_0x535e47(0x9b)]('\x27')&&_0x75c532[_0x535e47(0x87)]('\x27'))&&(_0x75c532=_0x75c532[_0x535e47(0x9e)](0x1,-0x1)),_0x5768f0[_0x91385]=_0x75c532;}}return _0x5768f0;}export function readUserConfig(){const _0x3ea3c1=a41_0x47a9,_0x334775=getConfigFile();if(!existsSync(_0x334775))return{};try{const _0x4f18cd=readFileSync(_0x334775,'utf-8');return parseEnvFile(_0x4f18cd);}catch(_0x382720){return console['warn'](_0x3ea3c1(0xa1)+_0x334775+':',_0x382720),{};}}export function resolveSite(_0x2b56fa){const _0x474a10=a41_0x47a9,_0x6edf3=[_0x474a10(0xa2),_0x474a10(0x8b),_0x474a10(0xb9),_0x474a10(0x7b),'ap03','dev-us01',_0x474a10(0x9d),'stg-us01',_0x474a10(0x99),'stg-ap03'];if(_0x6edf3[_0x474a10(0x8f)](_0x2b56fa))return _0x2b56fa;if(_0x2b56fa in SITE_ALIASES)return SITE_ALIASES[_0x2b56fa];return console['warn'](_0x474a10(0xa4)+_0x2b56fa+_0x474a10(0x73)),_0x474a10(0xa2);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xbb49e0,_0x55ec41){const _0x9b1842=a41_0x47a9,_0x256d77=_0x55ec41||getActiveProfileName();if(_0x256d77){const _0x21005c=_0x9b1842(0xb6)+normalizeProfileForEnvVar(_0x256d77);if(process[_0x9b1842(0x80)][_0x21005c])return process[_0x9b1842(0x80)][_0x21005c];}if(process['env'][_0x9b1842(0x84)])return process[_0x9b1842(0x80)]['TDX_API_KEY'];if(process[_0x9b1842(0x80)][_0x9b1842(0xb0)])return process['env']['TD_API_KEY'];const _0x311bed=_0xbb49e0['toUpperCase']()['replace'](/-/g,'_'),_0x19d156=_0x9b1842(0x7d)+_0x311bed;if(_0x256d77){const _0x49fad8=loadProfileEnv(_0x256d77);if(_0x49fad8){if(_0x49fad8[_0x19d156])return _0x49fad8[_0x19d156];if(_0x49fad8[_0x9b1842(0xb0)])return _0x49fad8[_0x9b1842(0xb0)];}}const _0x57623f=loadUserConfigOnce();if(_0x57623f[_0x19d156])return _0x57623f[_0x19d156];if(_0x57623f['TD_API_KEY'])return _0x57623f[_0x9b1842(0xb0)];return undefined;}export function normalizeProfileForEnvVar(_0x2c7bae){const _0x2285d8=a41_0x47a9;return _0x2c7bae[_0x2285d8(0xb4)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x296286,_0x537bbe){const _0x246283=a41_0x47a9,_0x40795c=_0x537bbe||getActiveProfileName()||undefined;if(_0x40795c){const _0x34cae4='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x40795c);if(process[_0x246283(0x80)][_0x34cae4])return{'apiKey':process['env'][_0x34cae4],'source':_0x34cae4+_0x246283(0x8d),'isDeprecated':![]};const _0x3699b4=getCachedCredential(_0x296286,_0x40795c);if(_0x3699b4)return{'apiKey':_0x3699b4,'source':'keychain\x20(profile:\x20'+_0x40795c+')','isDeprecated':![]};const _0x3bf0a3=await getKeychainAPIKey(_0x40795c);if(_0x3bf0a3)return setCachedCredential(_0x3bf0a3,_0x296286,_0x40795c),{'apiKey':_0x3bf0a3,'source':_0x246283(0x98)+_0x40795c+')','isDeprecated':![]};}if(process[_0x246283(0x80)][_0x246283(0x84)])return{'apiKey':process[_0x246283(0x80)][_0x246283(0x84)],'source':_0x246283(0xbb),'isDeprecated':![]};if(!_0x40795c){const _0x2fbd9d=getCachedCredential(_0x296286,undefined);if(_0x2fbd9d)return{'apiKey':_0x2fbd9d,'source':_0x246283(0xb7),'isDeprecated':![]};const _0x3be3a4=await getKeychainAPIKey(undefined);if(_0x3be3a4)return setCachedCredential(_0x3be3a4,_0x296286,undefined),{'apiKey':_0x3be3a4,'source':_0x246283(0xb7),'isDeprecated':![]};}if(process[_0x246283(0x80)][_0x246283(0xb0)])return{'apiKey':process['env'][_0x246283(0xb0)],'source':_0x246283(0xa9),'isDeprecated':!![]};const _0x1bc149=getLegacyEnvAPIKey(_0x296286,_0x40795c);if(_0x1bc149){const _0x4e8a8e=await isKeychainAvailable();if(_0x4e8a8e)try{await saveKeychainAPIKey(_0x1bc149,_0x40795c),setCachedCredential(_0x1bc149,_0x296286,_0x40795c);const _0x5a3461=getConfigFilePath(_0x40795c);cleanupLegacyEnvFile(_0x5a3461)&&console[_0x246283(0x7f)](a41_0x2c3cae[_0x246283(0x89)](_0x246283(0x95)));}catch(_0x1b8f7e){console[_0x246283(0x7f)](a41_0x2c3cae[_0x246283(0x89)](_0x246283(0xb8)+_0x1b8f7e));}const _0x5bb90c=_0x40795c?_0x246283(0x76)+_0x40795c+')':_0x246283(0x86);return{'apiKey':_0x1bc149,'source':_0x5bb90c,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2f743e,_0x5354b8,_0x36efb5=!![]){const _0x3f03b5=a41_0x47a9,_0x4fbfbc=await resolveAPIKeyAsync(_0x2f743e,_0x5354b8);if(!_0x4fbfbc)return undefined;if(_0x36efb5&&_0x4fbfbc['isDeprecated']&&_0x4fbfbc[_0x3f03b5(0xac)][_0x3f03b5(0x8f)](_0x3f03b5(0xb0))){const _0x341b1c=_0x5354b8||getActiveProfileName()||undefined,_0x4278b5=_0x341b1c?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x341b1c):_0x3f03b5(0xab);console[_0x3f03b5(0x7f)](a41_0x2c3cae['yellow'](_0x3f03b5(0xaf)+(_0x3f03b5(0x8c)+_0x4278b5+').')));}return _0x4fbfbc[_0x3f03b5(0x75)];}function getLegacyEnvAPIKey(_0x48beab,_0x55f275){const _0x44e02e=a41_0x47a9,_0x3f79cf=_0x48beab[_0x44e02e(0xb4)]()[_0x44e02e(0x70)](/-/g,'_'),_0x429e27=_0x44e02e(0x7d)+_0x3f79cf;if(_0x55f275){const _0x5aac65=loadProfileEnv(_0x55f275);if(_0x5aac65){if(_0x5aac65[_0x429e27])return _0x5aac65[_0x429e27];if(_0x5aac65[_0x44e02e(0xb0)])return _0x5aac65[_0x44e02e(0xb0)];}}const _0x5dde3b=loadUserConfigOnce();if(_0x5dde3b[_0x429e27])return _0x5dde3b[_0x429e27];if(_0x5dde3b[_0x44e02e(0xb0)])return _0x5dde3b[_0x44e02e(0xb0)];return undefined;}function cleanupLegacyEnvFile(_0x54daec){const _0x1a9d37=a41_0x47a9;if(!existsSync(_0x54daec))return![];try{const _0x228a01=readFileSync(_0x54daec,_0x1a9d37(0x72)),_0x58f353=_0x228a01[_0x1a9d37(0x77)]('\x0a'),_0x381f94=_0x58f353['filter'](_0x51c04e=>{const _0x3cb5e2=_0x1a9d37,_0x41bd3f=_0x51c04e[_0x3cb5e2(0xa8)]();if(!_0x41bd3f||_0x41bd3f[_0x3cb5e2(0x9b)]('#'))return!![];const [_0x54a24f]=_0x41bd3f[_0x3cb5e2(0x77)]('=');return!_0x54a24f[_0x3cb5e2(0x9b)](_0x3cb5e2(0xb0));}),_0x377851=_0x381f94[_0x1a9d37(0x92)](_0x545b30=>{const _0x347c12=_0x1a9d37,_0x1e13c1=_0x545b30['trim']();return _0x1e13c1&&!_0x1e13c1[_0x347c12(0x9b)]('#');});if(!_0x377851)return unlinkSync(_0x54daec),!![];return writeFileSync(_0x54daec,_0x381f94['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5d3c41){const _0x372624=a41_0x47a9,_0x4c5a9f=a41_0x4b0c97[_0x372624(0xa5)](getConfigDir(),'.env.'+_0x5d3c41);if(a41_0xf5646e[_0x372624(0x85)](_0x4c5a9f)){validateSecureFilePermissions(_0x4c5a9f);try{const _0x32150a=a41_0xf5646e[_0x372624(0x74)](_0x4c5a9f,_0x372624(0x72));return parseEnvFile(_0x32150a);}catch(_0x55bdd7){console['warn'](_0x372624(0x81)+_0x4c5a9f+':\x20'+_0x55bdd7);}}const _0x3dcc60=a41_0x4b0c97[_0x372624(0xa5)](getConfigDir(),_0x372624(0x94),_0x5d3c41,_0x372624(0x91));if(a41_0xf5646e[_0x372624(0x85)](_0x3dcc60)){validateSecureFilePermissions(_0x3dcc60);try{const _0x185045=a41_0xf5646e['readFileSync'](_0x3dcc60,_0x372624(0x72));return parseEnvFile(_0x185045);}catch(_0x13c154){return console[_0x372624(0x7f)](_0x372624(0x81)+_0x3dcc60+':\x20'+_0x13c154),null;}}return null;}function getActiveProfileName(){const _0x402edd=a41_0x47a9,_0x27f85b=a41_0x4b0c97[_0x402edd(0xa5)](getConfigDir(),_0x402edd(0x96));if(!a41_0xf5646e[_0x402edd(0x85)](_0x27f85b))return null;try{const _0x419738=a41_0xf5646e[_0x402edd(0x74)](_0x27f85b,_0x402edd(0x72)),_0x9afbbb=JSON[_0x402edd(0x93)](_0x419738);return _0x9afbbb[_0x402edd(0x9a)]||null;}catch{return null;}}export function saveAPIKey(_0x2f8cf2,_0x5ee389,_0x4143ea){const _0x1f64ac=a41_0x47a9,_0x390182=getConfigDir(),_0x84d306=getConfigFilePath(_0x4143ea);!existsSync(_0x390182)&&mkdirSync(_0x390182,{'recursive':!![],'mode':0x1c0});let _0x1d7284={};if(existsSync(_0x84d306))try{const _0x1f2faf=readFileSync(_0x84d306,'utf-8');_0x1d7284=parseEnvFile(_0x1f2faf);}catch(_0x280a37){console[_0x1f64ac(0x7f)]('Warning:\x20Failed\x20to\x20read\x20'+_0x84d306+':',_0x280a37);}const _0x1cafc4=_0x2f8cf2[_0x1f64ac(0xb4)]()[_0x1f64ac(0x70)](/-/g,'_');_0x1d7284[_0x1f64ac(0x7d)+_0x1cafc4]=_0x5ee389;const _0x353a1e=Object['entries'](_0x1d7284)[_0x1f64ac(0xa3)](([_0x3d9e47,_0x320eef])=>_0x3d9e47+'='+_0x320eef);writeFileSync(_0x84d306,_0x353a1e[_0x1f64ac(0xa5)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5bb353,_0x2959ea,_0x6a7ede){const _0x355bc8=a41_0x47a9;await saveKeychainAPIKey(_0x5bb353,_0x6a7ede),setCachedCredential(_0x5bb353,_0x2959ea,_0x6a7ede);const _0x30556f=getConfigFilePath(_0x6a7ede);cleanupLegacyEnvFile(_0x30556f)&&console[_0x355bc8(0x7f)](a41_0x2c3cae[_0x355bc8(0x89)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x1eb887=a41_0x47a9,_0x5a320d={'apiKeys':{},'defaultSite':_0x1eb887(0xa2)},_0x100679=['us01',_0x1eb887(0x8b),_0x1eb887(0xb9),_0x1eb887(0x7b),_0x1eb887(0x7a),_0x1eb887(0xa0),_0x1eb887(0x9d),_0x1eb887(0x88),_0x1eb887(0x99),_0x1eb887(0x9c)];for(const _0x5af6f3 of _0x100679){const _0x1d0a21=getAPIKey(_0x5af6f3);_0x1d0a21&&(_0x5a320d['apiKeys'][_0x5af6f3]=_0x1d0a21);}return _0x5a320d;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a42_0x48b1(){const _0x46e260=['__default_profile__','loadedAt','270MpMlaX','clear','now','2311820xgTqKL','5733870ztWJzF','685986qOnqHd','get','8gKQISZ','set','550808WymUZl','apiKey','delete','65906UlqMpL','2XPHmIC','5709663TKRCbU','39365uUjUQa'];a42_0x48b1=function(){return _0x46e260;};return a42_0x48b1();}(function(_0x5dd49c,_0x140560){const _0x1dbb30=a42_0xc878,_0x44a84c=_0x5dd49c();while(!![]){try{const _0x5cf285=-parseInt(_0x1dbb30(0x93))/0x1*(-parseInt(_0x1dbb30(0x94))/0x2)+parseInt(_0x1dbb30(0x9e))/0x3+parseInt(_0x1dbb30(0x90))/0x4+-parseInt(_0x1dbb30(0x96))/0x5*(parseInt(_0x1dbb30(0x99))/0x6)+parseInt(_0x1dbb30(0x9c))/0x7+-parseInt(_0x1dbb30(0xa0))/0x8*(parseInt(_0x1dbb30(0x95))/0x9)+parseInt(_0x1dbb30(0x9d))/0xa;if(_0x5cf285===_0x140560)break;else _0x44a84c['push'](_0x44a84c['shift']());}catch(_0x5ebc46){_0x44a84c['push'](_0x44a84c['shift']());}}}(a42_0x48b1,0x54c59));function a42_0xc878(_0x422824,_0x14fc96){const _0x48b1fb=a42_0x48b1();return a42_0xc878=function(_0xc8786d,_0x40d1d6){_0xc8786d=_0xc8786d-0x90;let _0x143d30=_0x48b1fb[_0xc8786d];return _0x143d30;},a42_0xc878(_0x422824,_0x14fc96);}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5a4a15,_0x27c80d){const _0x40ef14=a42_0xc878,_0x2d97be=_0x5a4a15||'__default_site__',_0x5410db=_0x27c80d||_0x40ef14(0x97);return _0x2d97be+':'+_0x5410db;}export function getCachedCredential(_0x1c46a1,_0x7c24ce){const _0x1dce90=a42_0xc878,_0x513370=getCacheKey(_0x1c46a1,_0x7c24ce),_0x428b03=cache[_0x1dce90(0x9f)](_0x513370);if(!_0x428b03)return null;if(Date[_0x1dce90(0x9b)]()-_0x428b03[_0x1dce90(0x98)]>CACHE_TTL_MS)return cache[_0x1dce90(0x92)](_0x513370),null;return _0x428b03[_0x1dce90(0x91)];}export function setCachedCredential(_0x4b424a,_0x56fba2,_0x1f4d6f){const _0x24bbae=a42_0xc878,_0x4b6cc4=getCacheKey(_0x56fba2,_0x1f4d6f);cache[_0x24bbae(0xa1)](_0x4b6cc4,{'apiKey':_0x4b424a,'loadedAt':Date[_0x24bbae(0x9b)]()});}export function clearCredentialCache(){const _0x17edd7=a42_0xc878;cache[_0x17edd7(0x9a)]();}export function clearCachedCredential(_0x3cb46b,_0x15fd4a){const _0x2c147b=getCacheKey(_0x3cb46b,_0x15fd4a);cache['delete'](_0x2c147b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a43_0x35e183=a43_0x4502;(function(_0xb67bd6,_0x187351){const _0x1a55b4=a43_0x4502,_0x36e592=_0xb67bd6();while(!![]){try{const _0x429e39=-parseInt(_0x1a55b4(0x152))/0x1+-parseInt(_0x1a55b4(0x15d))/0x2*(-parseInt(_0x1a55b4(0x140))/0x3)+-parseInt(_0x1a55b4(0x157))/0x4*(-parseInt(_0x1a55b4(0x147))/0x5)+parseInt(_0x1a55b4(0x158))/0x6+parseInt(_0x1a55b4(0x13a))/0x7*(-parseInt(_0x1a55b4(0x13f))/0x8)+parseInt(_0x1a55b4(0x14f))/0x9+parseInt(_0x1a55b4(0x137))/0xa*(parseInt(_0x1a55b4(0x151))/0xb);if(_0x429e39===_0x187351)break;else _0x36e592['push'](_0x36e592['shift']());}catch(_0x4f2c0e){_0x36e592['push'](_0x36e592['shift']());}}}(a43_0x383b,0x4790e));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a43_0x21bd06 from'node:fs';function a43_0x4502(_0x2ef1a4,_0x4ab257){const _0x383bcb=a43_0x383b();return a43_0x4502=function(_0x45024b,_0x51a963){_0x45024b=_0x45024b-0x137;let _0x15c3ce=_0x383bcb[_0x45024b];return _0x15c3ce;},a43_0x4502(_0x2ef1a4,_0x4ab257);}import*as a43_0x1425b0 from'node:path';function a43_0x383b(){const _0x58c71e=['logLevel','21450HFIIPT','llmProject','activeProfile','21GwyIwx','toString','(active)','.json','global','469624SdhYvV','276qohYQN','log','createAsync','segmentPath','config','[context]','CLI\x20flag:\x20--','305IiAFGi','INFO','resolveAPIKeyAsync','profile:\x20','verbose','Project','loadGlobalConfig','entries','94662mvEjRI','llm_project','1529HPRIld','540588MYREpc','string','Session','tdx.json','apiKey','13732VQSmWR','2216862giWDUc','parentSegment','sessionId','Profile','existsSync','2658hqcoUF','session','project',':\x20none','.env','injectIntoOptions','displayWithSources','cliFlags','utf-8','profile','Global\x20Credentials','configFiles','parent_segment','default','not\x20set','layers','join','profiles','site','Global','segment_path','Profile\x20Credentials','sessions','getParameters','database'];a43_0x383b=function(){return _0x58c71e;};return a43_0x383b();}export class GlobalContext{[a43_0x35e183(0x16f)];[a43_0x35e183(0x175)];[a43_0x35e183(0x169)];[a43_0x35e183(0x171)];['llm_project'];[a43_0x35e183(0x156)];[a43_0x35e183(0x14b)];[a43_0x35e183(0x176)];['profile'];['layers'];[a43_0x35e183(0x139)];[a43_0x35e183(0x15a)];[a43_0x35e183(0x168)];constructor(_0x2f4b0c){const _0x5f29cc=a43_0x35e183;this[_0x5f29cc(0x15a)]=_0x2f4b0c[_0x5f29cc(0x15e)]||getCurrentSessionPID()[_0x5f29cc(0x13b)]();const _0x3d6148=loadSessionContext(_0x2f4b0c[_0x5f29cc(0x15e)]),_0x186d72=loadProjectConfig(),_0x10ef9c=this[_0x5f29cc(0x14d)]();this['activeProfile']=_0x2f4b0c[_0x5f29cc(0x166)]||_0x3d6148?.[_0x5f29cc(0x166)]||_0x10ef9c[_0x5f29cc(0x166)]||getActiveProfile();const _0x3f6b97=this[_0x5f29cc(0x139)]?loadProfile(this[_0x5f29cc(0x139)]):null,_0x565912=_0x1fc425=>{const _0x39c14b=_0x5f29cc;if(!_0x1fc425)return{};const _0x5c3837=_0x1fc425,_0x3bf2f0={};for(const [_0x5d34d7,_0x33d592]of Object[_0x39c14b(0x14e)](_0x5c3837)){typeof _0x33d592===_0x39c14b(0x153)&&(_0x3bf2f0[_0x5d34d7]=_0x33d592);}return _0x3bf2f0;},_0x214e10={};if(_0x2f4b0c[_0x5f29cc(0x16f)]&&_0x2f4b0c['site']!=='us01')_0x214e10[_0x5f29cc(0x16f)]=_0x2f4b0c['site'];const _0x381a1d=_0x3d6148?.[_0x5f29cc(0x175)],_0x92bd28=_0x186d72?.[_0x5f29cc(0x175)],_0x27978c=_0x3f6b97?.['config']?.[_0x5f29cc(0x175)],_0x39a670=_0x10ef9c[_0x5f29cc(0x175)];_0x2f4b0c['database']&&(_0x2f4b0c['database']!==_0x381a1d&&_0x2f4b0c['database']!==_0x92bd28&&_0x2f4b0c[_0x5f29cc(0x175)]!==_0x27978c&&_0x2f4b0c[_0x5f29cc(0x175)]!==_0x39a670)&&(_0x214e10[_0x5f29cc(0x175)]=_0x2f4b0c['database']);if(_0x2f4b0c['parentSegment'])_0x214e10['parent_segment']=_0x2f4b0c[_0x5f29cc(0x159)];if(_0x2f4b0c[_0x5f29cc(0x138)])_0x214e10[_0x5f29cc(0x150)]=_0x2f4b0c[_0x5f29cc(0x138)];if(_0x2f4b0c[_0x5f29cc(0x166)])_0x214e10[_0x5f29cc(0x166)]=_0x2f4b0c[_0x5f29cc(0x166)];this['layers']={'cliFlags':_0x214e10,'session':_0x565912(_0x3d6148),'project':_0x565912(_0x186d72),'profile':_0x565912(_0x3f6b97?.[_0x5f29cc(0x144)]),'global':_0x565912(_0x10ef9c)};const _0x3c5bc0={...this[_0x5f29cc(0x16c)][_0x5f29cc(0x13e)],...this['layers'][_0x5f29cc(0x166)],...this['layers'][_0x5f29cc(0x15f)],...this[_0x5f29cc(0x16c)][_0x5f29cc(0x15e)],...this['layers'][_0x5f29cc(0x164)]},_0x19042a=_0x3c5bc0['site']||'us01';this['site']=resolveSite(_0x19042a),this[_0x5f29cc(0x175)]=_0x3c5bc0['database'],this['parent_segment']=_0x3c5bc0[_0x5f29cc(0x169)],this[_0x5f29cc(0x171)]=_0x3c5bc0['segment_path'],this['llm_project']=_0x3c5bc0[_0x5f29cc(0x150)],this[_0x5f29cc(0x14b)]=_0x2f4b0c[_0x5f29cc(0x14b)]||![],this[_0x5f29cc(0x176)]=_0x2f4b0c[_0x5f29cc(0x176)]??LogLevel[_0x5f29cc(0x148)],this[_0x5f29cc(0x166)]=this['activeProfile']||undefined,this['apiKey']=getAPIKey(this[_0x5f29cc(0x16f)],this[_0x5f29cc(0x139)]||undefined);const _0x1bb8e2=getConfigDir(),_0x59ed0c=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,_0x5f29cc(0x173),this[_0x5f29cc(0x15a)]+_0x5f29cc(0x13d)),_0x46adfc=findProjectConfigPath(),_0x31f70c=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,'tdx.json'),_0x562252=a43_0x1425b0['join'](_0x1bb8e2,_0x5f29cc(0x161));let _0x261d68=null,_0xa24258=null;this['activeProfile']&&(_0x261d68=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,_0x5f29cc(0x16e),this[_0x5f29cc(0x139)],'tdx.json'),_0xa24258=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,_0x5f29cc(0x16e),this[_0x5f29cc(0x139)],_0x5f29cc(0x161))),this[_0x5f29cc(0x168)]={'session':a43_0x21bd06[_0x5f29cc(0x15c)](_0x59ed0c)?_0x59ed0c:null,'project':_0x46adfc,'profile':_0x261d68&&a43_0x21bd06['existsSync'](_0x261d68)?_0x261d68:null,'profileCredentials':_0xa24258&&a43_0x21bd06[_0x5f29cc(0x15c)](_0xa24258)?_0xa24258:null,'global':a43_0x21bd06[_0x5f29cc(0x15c)](_0x31f70c)?_0x31f70c:null,'globalCredentials':a43_0x21bd06[_0x5f29cc(0x15c)](_0x562252)?_0x562252:null};}['getSource'](_0x581eae,_0x44babd){const _0x5b4610=a43_0x35e183;if(!_0x44babd)return _0x5b4610(0x16b);const _0x2a609e=_0x44babd;if(this['layers'][_0x5b4610(0x164)][_0x581eae]===_0x2a609e){if(_0x581eae===_0x5b4610(0x16f)&&_0x2a609e==='us01'&&!this[_0x5b4610(0x16c)][_0x5b4610(0x15e)][_0x5b4610(0x16f)]&&!this[_0x5b4610(0x16c)][_0x5b4610(0x15f)][_0x5b4610(0x16f)]&&!this[_0x5b4610(0x16c)][_0x5b4610(0x166)]['site']&&!this[_0x5b4610(0x16c)][_0x5b4610(0x13e)]['site'])return _0x5b4610(0x16a);return _0x5b4610(0x146)+_0x581eae['replace'](/_/g,'-');}if(this['layers'][_0x5b4610(0x15e)][_0x581eae]===_0x2a609e)return _0x5b4610(0x15e);if(this['layers'][_0x5b4610(0x15f)][_0x581eae]===_0x2a609e)return'project';if(this['layers'][_0x5b4610(0x166)][_0x581eae]===_0x2a609e)return _0x5b4610(0x14a)+this[_0x5b4610(0x139)];if(this['layers'][_0x5b4610(0x13e)][_0x581eae]===_0x2a609e)return _0x5b4610(0x13e);return _0x5b4610(0x16a);}[a43_0x35e183(0x14d)](){const _0x3bf12e=a43_0x35e183,_0x2ff4cc=a43_0x1425b0[_0x3bf12e(0x16d)](getConfigDir(),_0x3bf12e(0x155));if(!a43_0x21bd06[_0x3bf12e(0x15c)](_0x2ff4cc))return{};try{const _0x5d2190=a43_0x21bd06['readFileSync'](_0x2ff4cc,_0x3bf12e(0x165));return JSON['parse'](_0x5d2190);}catch{return{};}}[a43_0x35e183(0x162)](_0x48ee1a){const _0x45b153=a43_0x35e183;_0x48ee1a[_0x45b153(0x16f)]=this['site'],!_0x48ee1a[_0x45b153(0x175)]&&this[_0x45b153(0x175)]&&(_0x48ee1a[_0x45b153(0x175)]=this[_0x45b153(0x175)]),!_0x48ee1a[_0x45b153(0x159)]&&this[_0x45b153(0x169)]&&(_0x48ee1a[_0x45b153(0x159)]=this[_0x45b153(0x169)]),!_0x48ee1a[_0x45b153(0x143)]&&this[_0x45b153(0x171)]&&(_0x48ee1a[_0x45b153(0x143)]=this[_0x45b153(0x171)]),!_0x48ee1a[_0x45b153(0x138)]&&this[_0x45b153(0x150)]&&(_0x48ee1a[_0x45b153(0x138)]=this[_0x45b153(0x150)]);}[a43_0x35e183(0x174)](){const _0x4f4f89=a43_0x35e183;return[{'key':_0x4f4f89(0x16f),'value':this['site']},{'key':_0x4f4f89(0x175),'value':this[_0x4f4f89(0x175)]},{'key':_0x4f4f89(0x169),'value':this[_0x4f4f89(0x169)]},{'key':_0x4f4f89(0x171),'value':this[_0x4f4f89(0x171)]},{'key':_0x4f4f89(0x150),'value':this[_0x4f4f89(0x150)]},{'key':_0x4f4f89(0x166),'value':this['activeProfile']||undefined}];}['display'](){const _0x940f74=a43_0x35e183;console[_0x940f74(0x141)](_0x940f74(0x145));for(const {key:_0x193c60,value:_0x208c85}of this[_0x940f74(0x174)]()){_0x208c85&&console['log'](_0x193c60+':\x20'+_0x208c85);}}[a43_0x35e183(0x163)](){const _0x2fd288=a43_0x35e183;console[_0x2fd288(0x141)](_0x2fd288(0x145));for(const {key:_0x5575a9,value:_0x1e5042}of this[_0x2fd288(0x174)]()){if(_0x1e5042){const _0x4eb325=_0x5575a9===_0x2fd288(0x166)?_0x2fd288(0x13c):'('+this['getSource'](_0x5575a9,_0x1e5042)+')';console['log'](_0x5575a9+':\x20'+_0x1e5042+'\x20'+_0x4eb325);}}console[_0x2fd288(0x141)]('\x0a[configuration\x20files]');const _0x3cff14=[{'label':'Session','path':this[_0x2fd288(0x168)][_0x2fd288(0x15e)],'extra':'(session:\x20'+this[_0x2fd288(0x15a)]+')'},{'label':'Project','path':this[_0x2fd288(0x168)][_0x2fd288(0x15f)]},{'label':_0x2fd288(0x15b),'path':this[_0x2fd288(0x168)][_0x2fd288(0x166)]},{'label':_0x2fd288(0x172),'path':this['configFiles']['profileCredentials']},{'label':_0x2fd288(0x170),'path':this[_0x2fd288(0x168)]['global']},{'label':_0x2fd288(0x167),'path':this[_0x2fd288(0x168)]['globalCredentials']}];for(const {label:_0x5bc025,path:_0x5f0039,extra:_0x2f41f3}of _0x3cff14){if(_0x5f0039)console[_0x2fd288(0x141)](_0x5bc025+':\x20'+_0x5f0039+'\x20✓'+(_0x2f41f3?'\x20'+_0x2f41f3:''));else{if(_0x5bc025===_0x2fd288(0x154))console[_0x2fd288(0x141)](_0x5bc025+':\x20none\x20(using\x20session:\x20'+this[_0x2fd288(0x15a)]+')');else(_0x5bc025===_0x2fd288(0x14c)||_0x5bc025==='Global')&&console['log'](_0x5bc025+_0x2fd288(0x160));}}}async[a43_0x35e183(0x149)](){const _0x4b16ba=a43_0x35e183;return this[_0x4b16ba(0x156)]=await getAPIKeyAsync(this[_0x4b16ba(0x16f)],this['activeProfile']||undefined),this[_0x4b16ba(0x156)];}static async[a43_0x35e183(0x142)](_0xc45d30){const _0x2d716e=a43_0x35e183,_0x182ecf=new GlobalContext(_0xc45d30);return await _0x182ecf[_0x2d716e(0x149)](),_0x182ecf;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a44_0x5ec3b1=a44_0x5f16;(function(_0x448942,_0x1ff78c){const _0x153795=a44_0x5f16,_0x5b0227=_0x448942();while(!![]){try{const _0x28c676=-parseInt(_0x153795(0x131))/0x1*(parseInt(_0x153795(0x130))/0x2)+parseInt(_0x153795(0x12e))/0x3+parseInt(_0x153795(0x12f))/0x4*(parseInt(_0x153795(0x127))/0x5)+parseInt(_0x153795(0x11f))/0x6*(-parseInt(_0x153795(0x13d))/0x7)+-parseInt(_0x153795(0x129))/0x8*(parseInt(_0x153795(0x122))/0x9)+parseInt(_0x153795(0x12a))/0xa+-parseInt(_0x153795(0x124))/0xb*(-parseInt(_0x153795(0x135))/0xc);if(_0x28c676===_0x1ff78c)break;else _0x5b0227['push'](_0x5b0227['shift']());}catch(_0xd49f6d){_0x5b0227['push'](_0x5b0227['shift']());}}}(a44_0x3cc1,0xe6ae9));const SERVICE_NAME=a44_0x5ec3b1(0x133);function a44_0x5f16(_0x25c075,_0x4b3889){const _0x3cc12a=a44_0x3cc1();return a44_0x5f16=function(_0x5f1688,_0x3f7bd1){_0x5f1688=_0x5f1688-0x11f;let _0x49e6aa=_0x3cc12a[_0x5f1688];return _0x49e6aa;},a44_0x5f16(_0x25c075,_0x4b3889);}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x3ab657=a44_0x5ec3b1;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x2276a8=await import(_0x3ab657(0x121));return keyringModule=_0x2276a8['keyring'],keyringModule;}catch(_0x458eba){return keyringLoadError=_0x458eba instanceof Error?_0x458eba:new Error(String(_0x458eba)),null;}}function getAccountName(_0xaaefc){const _0xc1be86=a44_0x5ec3b1,_0x4f7ad7=_0xaaefc||'';return _0xc1be86(0x136)+_0x4f7ad7+':api_key';}function a44_0x3cc1(){const _0x4e0440=['425208qovbUh','12eWjqCf','158714tsCSXZ','17VqqQUk','success','tdx','not\x20found','348iKefQs','profile:','toLowerCase','-25300','cannot\x20find','deletePassword','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','includes','7VXltvj','message','-25293','setPassword','4050672Irnagc','unavailable','@zowe/secrets-for-zowe-sdk','289908aBicUY','System\x20keychain\x20is\x20not\x20available','1127544vVOVwY','reason','not_found','253480MWfmmS','Warning:\x20','208ajpzGr','5401260BBVbHS','access','getPassword','not\x20supported'];a44_0x3cc1=function(){return _0x4e0440;};return a44_0x3cc1();}export async function getKeychainAPIKey(_0x1a95e6){const _0x45b52f=a44_0x5ec3b1,_0x1411b5=await getKeychainAPIKeyWithStatus(_0x1a95e6);if(_0x1411b5[_0x45b52f(0x132)])return _0x1411b5['value'];return _0x1411b5[_0x45b52f(0x125)]==='access_denied'&&console['error'](_0x45b52f(0x128)+_0x1411b5[_0x45b52f(0x13e)]),null;}export async function getKeychainAPIKeyWithStatus(_0x4b6bfa){const _0x1e6925=a44_0x5ec3b1;try{const _0x3bcf1a=await getKeyring();if(!_0x3bcf1a)return{'success':![],'reason':_0x1e6925(0x120)};const _0x49833a=getAccountName(_0x4b6bfa),_0x4234e1=await _0x3bcf1a[_0x1e6925(0x12c)](SERVICE_NAME,_0x49833a);if(_0x4234e1)return{'success':!![],'value':_0x4234e1};return{'success':![],'reason':'not_found'};}catch(_0x334997){const _0x253275=_0x334997 instanceof Error?_0x334997[_0x1e6925(0x13e)]:String(_0x334997);if(_0x253275[_0x1e6925(0x13c)](_0x1e6925(0x138))||_0x253275[_0x1e6925(0x137)]()['includes']('could\x20not\x20be\x20found')||_0x253275[_0x1e6925(0x137)]()[_0x1e6925(0x13c)](_0x1e6925(0x134)))return{'success':![],'reason':_0x1e6925(0x126)};if(_0x253275[_0x1e6925(0x13c)](_0x1e6925(0x13f))||_0x253275[_0x1e6925(0x137)]()[_0x1e6925(0x13c)]('restricted')||_0x253275[_0x1e6925(0x137)]()[_0x1e6925(0x13c)](_0x1e6925(0x12b)))return{'success':![],'reason':'access_denied','message':_0x1e6925(0x13b)};return{'success':![],'reason':'unavailable','message':_0x253275};}}export async function saveKeychainAPIKey(_0x181566,_0x19636c){const _0x3fa973=a44_0x5ec3b1,_0x38ff89=await getKeyring();if(!_0x38ff89)throw new Error(_0x3fa973(0x123));const _0x18830c=getAccountName(_0x19636c);await _0x38ff89[_0x3fa973(0x140)](SERVICE_NAME,_0x18830c,_0x181566);}export async function deleteKeychainAPIKey(_0xf8d4f0){const _0x133a06=a44_0x5ec3b1;try{const _0x11f108=await getKeyring();if(!_0x11f108)return![];const _0x36d1d9=getAccountName(_0xf8d4f0);return await _0x11f108[_0x133a06(0x13a)](SERVICE_NAME,_0x36d1d9);}catch{return![];}}export async function isKeychainAvailable(){const _0xfdd3c1=a44_0x5ec3b1;try{const _0x392bc6=await getKeyring();if(!_0x392bc6)return![];return await _0x392bc6['getPassword'](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x3bf822){const _0x41e550=_0x3bf822 instanceof Error?_0x3bf822[_0xfdd3c1(0x13e)][_0xfdd3c1(0x137)]():'';if(_0x41e550[_0xfdd3c1(0x13c)]('not\x20available')||_0x41e550[_0xfdd3c1(0x13c)](_0xfdd3c1(0x12d))||_0x41e550[_0xfdd3c1(0x13c)](_0xfdd3c1(0x139)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5bd1d3,_0x2ef869){const _0x1298fe=a45_0x5821,_0x1ee5ae=_0x5bd1d3();while(!![]){try{const _0x4c5725=-parseInt(_0x1298fe(0x17b))/0x1*(parseInt(_0x1298fe(0x19d))/0x2)+-parseInt(_0x1298fe(0x1a3))/0x3*(-parseInt(_0x1298fe(0x18c))/0x4)+-parseInt(_0x1298fe(0x184))/0x5+-parseInt(_0x1298fe(0x175))/0x6*(-parseInt(_0x1298fe(0x1b5))/0x7)+parseInt(_0x1298fe(0x196))/0x8*(-parseInt(_0x1298fe(0x17a))/0x9)+-parseInt(_0x1298fe(0x1b7))/0xa*(-parseInt(_0x1298fe(0x178))/0xb)+parseInt(_0x1298fe(0x1b6))/0xc;if(_0x4c5725===_0x2ef869)break;else _0x1ee5ae['push'](_0x1ee5ae['shift']());}catch(_0x278e0b){_0x1ee5ae['push'](_0x1ee5ae['shift']());}}}(a45_0x3713,0x1e989));function a45_0x3713(){const _0x18a6ed=['.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','some',',\x20creating\x20new\x20file','Error:\x20','map','join','llm_agent','Warning:\x20Profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','site','.env','419370FtjCip','isDirectory','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','33vsDmVM','string','579015QmCUax','43456iVzspY','Profile\x20\x27','\x20\x20mv\x20\x22','local','from','stringify','object','\x22\x20\x22','parse','1191930ylyvNb','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','user','llm_project','find','description','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','entries','320QQkIsX','push','test','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x20does\x20not\x20exist','tdx.json','readdirSync','filter','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','16sQDHFF','localeCompare','toISOString','parent_segment','profiles','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','warn','10bczOOI','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','Invalid\x20profile\x20name:\x20','database','length','existsSync','546RVdwhJ','.env.','set','includes','readFileSync','keys','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:',':\x20Invalid\x20JSON\x20syntax','Warning:\x20Failed\x20to\x20parse\x20','name','message','Profile\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','utf-8','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','sort','\x20already\x20exists','21YbbJAy','3072312DbWiQI','764620UKViHp','profile'];a45_0x3713=function(){return _0x18a6ed;};return a45_0x3713();}import*as a45_0x1ba69a from'node:fs';import*as a45_0x3ed62b from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x365ba9){const _0x29b75d=a45_0x5821,_0x25d786={};if(!_0x365ba9)return _0x25d786;for(const [_0x134612,_0x3123a8]of Object[_0x29b75d(0x18b)](_0x365ba9)){_0x134612!==_0x29b75d(0x189)&&_0x3123a8!==undefined&&(_0x25d786[_0x134612]=_0x3123a8);}return _0x25d786;}export function getProfilesDir(){const _0x5783c5=a45_0x5821;return a45_0x3ed62b[_0x5783c5(0x1be)](getConfigDir(),_0x5783c5(0x19a));}function getProfileDir(_0x279e9c){const _0x290ebe=a45_0x5821;return a45_0x3ed62b[_0x290ebe(0x1be)](getProfilesDir(),_0x279e9c);}function getProfileConfigPath(_0xed2dd3){const _0x19c7d1=a45_0x5821;return a45_0x3ed62b[_0x19c7d1(0x1be)](getProfileDir(_0xed2dd3),_0x19c7d1(0x191));}function getProfileEnvPath(_0x3f0822){const _0xead6dc=a45_0x5821;return a45_0x3ed62b[_0xead6dc(0x1be)](getProfileDir(_0x3f0822),_0xead6dc(0x174));}function a45_0x5821(_0x1662cf,_0x3c5849){const _0x371325=a45_0x3713();return a45_0x5821=function(_0x5821c8,_0x105803){_0x5821c8=_0x5821c8-0x170;let _0x36949b=_0x371325[_0x5821c8];return _0x36949b;},a45_0x5821(_0x1662cf,_0x3c5849);}function getGlobalConfigPath(){const _0x130d96=a45_0x5821;return a45_0x3ed62b[_0x130d96(0x1be)](getConfigDir(),'tdx.json');}function validateProfileName(_0x1ab5a2){const _0x1a9380=a45_0x5821;if(!/^[a-zA-Z0-9_-]+$/[_0x1a9380(0x18e)](_0x1ab5a2))throw new Error(_0x1a9380(0x19f)+_0x1ab5a2+_0x1a9380(0x1b9));}function validateProfileConfig(_0x5b3a12,_0x3aa6dc){const _0x2361da=a45_0x5821;if(typeof _0x5b3a12!==_0x2361da(0x181)||_0x5b3a12===null)throw new Error('Profile\x20\x27'+_0x3aa6dc+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x21b6b1=['description','site','database',_0x2361da(0x199),_0x2361da(0x187),_0x2361da(0x170)],_0x10f7c6=_0x5b3a12;for(const _0x18b03e of Object[_0x2361da(0x1a8)](_0x10f7c6)){!_0x21b6b1[_0x2361da(0x1a6)](_0x18b03e)&&console['warn'](_0x2361da(0x171)+_0x3aa6dc+_0x2361da(0x1b1)+_0x18b03e+'\x27\x20will\x20be\x20ignored');}if(_0x10f7c6[_0x2361da(0x189)]!==undefined&&typeof _0x10f7c6['description']!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+_0x2361da(0x185));if(_0x10f7c6[_0x2361da(0x173)]!==undefined&&typeof _0x10f7c6[_0x2361da(0x173)]!=='string')throw new Error('Profile\x20\x27'+_0x3aa6dc+_0x2361da(0x172));if(_0x10f7c6[_0x2361da(0x1a0)]!==undefined&&typeof _0x10f7c6[_0x2361da(0x1a0)]!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x10f7c6[_0x2361da(0x199)]!==undefined&&typeof _0x10f7c6['parent_segment']!=='string')throw new Error(_0x2361da(0x17c)+_0x3aa6dc+_0x2361da(0x194));if(_0x10f7c6['llm_project']!==undefined&&typeof _0x10f7c6[_0x2361da(0x187)]!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+_0x2361da(0x19e));if(_0x10f7c6[_0x2361da(0x170)]!==undefined&&typeof _0x10f7c6[_0x2361da(0x170)]!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x2dc6c4,_0x3cf89f){const _0x525d86=a45_0x5821;if(!a45_0x1ba69a[_0x525d86(0x1a2)](_0x2dc6c4))return[];try{const _0x14627c=a45_0x1ba69a['readFileSync'](_0x2dc6c4,_0x525d86(0x1b0)),_0x58f97f=JSON['parse'](_0x14627c);if(!_0x58f97f[_0x525d86(0x19a)]||typeof _0x58f97f['profiles']!=='object')return[];const _0x58c078=[];for(const [_0x2cbead,_0x385d37]of Object[_0x525d86(0x18b)](_0x58f97f['profiles'])){try{validateProfileConfig(_0x385d37,_0x2cbead);const _0x3f9518=getNewCredentialPath(_0x2cbead),_0x286439=getOldCredentialPath(_0x2cbead),_0x44ff7e=a45_0x1ba69a[_0x525d86(0x1a2)](_0x3f9518)||a45_0x1ba69a[_0x525d86(0x1a2)](_0x286439);_0x58c078[_0x525d86(0x18d)]({'name':_0x2cbead,'config':_0x385d37,'metadata':{'name':_0x2cbead,'createdAt':new Date()[_0x525d86(0x198)]()},'hasCredentials':_0x44ff7e,'scope':_0x3cf89f});}catch(_0x178aa9){_0x178aa9 instanceof Error&&(console[_0x525d86(0x19c)](_0x525d86(0x18a)+_0x2dc6c4+':'),console['warn']('\x20\x20'+_0x178aa9[_0x525d86(0x1ad)]+'\x0a'));}}return _0x58c078;}catch(_0x367ead){return _0x367ead instanceof SyntaxError?(console[_0x525d86(0x19c)](_0x525d86(0x195)+_0x2dc6c4+_0x525d86(0x1aa)),console[_0x525d86(0x19c)](_0x525d86(0x1bc)+_0x367ead[_0x525d86(0x1ad)]+'\x0a')):console['warn'](_0x525d86(0x177)+_0x2dc6c4+':\x20'+_0x367ead+'\x0a'),[];}}export function getNewCredentialPath(_0x5868d2){const _0x1a9e7f=a45_0x5821;return a45_0x3ed62b[_0x1a9e7f(0x1be)](getConfigDir(),_0x1a9e7f(0x1a4)+_0x5868d2);}function getOldCredentialPath(_0x329d3a){const _0x4ca7f4=a45_0x5821;return a45_0x3ed62b['join'](getProfilesDir(),_0x329d3a,_0x4ca7f4(0x174));}function loadProfilesFromTdxJsonFiles(){const _0x35dc9=a45_0x5821,_0x28d64f=[],_0x4ce7d4=findProjectConfigPath();_0x4ce7d4&&_0x28d64f[_0x35dc9(0x18d)](...loadProfilesFromTdxJson(_0x4ce7d4,_0x35dc9(0x17e)));const _0x5556f0=a45_0x3ed62b[_0x35dc9(0x1be)](getConfigDir(),'tdx.json');return _0x28d64f[_0x35dc9(0x18d)](...loadProfilesFromTdxJson(_0x5556f0,_0x35dc9(0x186))),_0x28d64f;}function loadProfilesFromDirectories(){const _0x20c168=a45_0x5821,_0x12cb06=getProfilesDir();if(!a45_0x1ba69a[_0x20c168(0x1a2)](_0x12cb06))return[];try{return a45_0x1ba69a[_0x20c168(0x192)](_0x12cb06,{'withFileTypes':!![]})[_0x20c168(0x193)](_0x204297=>_0x204297[_0x20c168(0x176)]())[_0x20c168(0x1bd)](_0x31fcf6=>_0x31fcf6[_0x20c168(0x1ac)])[_0x20c168(0x193)](_0x41a9b6=>{const _0x19e1ba=_0x20c168,_0x49cda0=getProfileConfigPath(_0x41a9b6),_0x39f21a=getProfileEnvPath(_0x41a9b6);return a45_0x1ba69a['existsSync'](_0x49cda0)||a45_0x1ba69a[_0x19e1ba(0x1a2)](_0x39f21a);})[_0x20c168(0x1bd)](_0x4a9c6d=>{const _0x3f292b=loadProfileFromDirectory(_0x4a9c6d);if(_0x3f292b)return{..._0x3f292b,'scope':'directory'};return null;})['filter'](_0x498699=>_0x498699!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2c3cc6){const _0x5a6c92=a45_0x5821,_0x33bf64=getProfileConfigPath(_0x2c3cc6),_0x3e2a99=getOldCredentialPath(_0x2c3cc6);if(!a45_0x1ba69a[_0x5a6c92(0x1a2)](_0x33bf64)&&!a45_0x1ba69a[_0x5a6c92(0x1a2)](_0x3e2a99))return null;let _0x5adce9={},_0x4a42b8={'name':_0x2c3cc6,'createdAt':new Date()[_0x5a6c92(0x198)]()};if(a45_0x1ba69a['existsSync'](_0x33bf64))try{const _0x2e0a7f=a45_0x1ba69a[_0x5a6c92(0x1a7)](_0x33bf64,_0x5a6c92(0x1b0)),_0x6178bb=JSON[_0x5a6c92(0x183)](_0x2e0a7f),{metadata:_0x5ca74c,..._0x514e3c}=_0x6178bb;_0x5adce9=_0x514e3c,_0x5ca74c&&(_0x4a42b8=_0x5ca74c);}catch{}return{'name':_0x2c3cc6,'config':_0x5adce9,'metadata':_0x4a42b8,'hasCredentials':a45_0x1ba69a['existsSync'](_0x3e2a99),'scope':'directory'};}export function listProfiles(){const _0x10aa1f=a45_0x5821,_0x41a446=loadProfilesFromTdxJsonFiles(),_0xa41919=loadProfilesFromDirectories();if(_0xa41919[_0x10aa1f(0x1a1)]>0x0){const _0x5b1a3a=_0xa41919['map'](_0x1b0318=>_0x1b0318[_0x10aa1f(0x1ac)])[_0x10aa1f(0x1be)](',\x20'),_0x5844fb=getConfigDir();console[_0x10aa1f(0x19c)](_0x10aa1f(0x1b2)+_0x5b1a3a),console[_0x10aa1f(0x19c)](_0x10aa1f(0x1a9)),console[_0x10aa1f(0x19c)]('\x20\x201.\x20Edit:\x20'+a45_0x3ed62b[_0x10aa1f(0x1be)](_0x5844fb,_0x10aa1f(0x191))),console['warn'](_0x10aa1f(0x1af)),console[_0x10aa1f(0x19c)](_0x10aa1f(0x19b));}const _0x1ea649=[..._0x41a446,..._0xa41919],_0x53231a=new Map();for(const _0x54a209 of _0x1ea649){!_0x53231a['has'](_0x54a209[_0x10aa1f(0x1ac)])&&_0x53231a[_0x10aa1f(0x1a5)](_0x54a209[_0x10aa1f(0x1ac)],_0x54a209);}return Array[_0x10aa1f(0x17f)](_0x53231a['values']())[_0x10aa1f(0x1b3)]((_0x573ace,_0x13fabc)=>_0x573ace['name'][_0x10aa1f(0x197)](_0x13fabc[_0x10aa1f(0x1ac)]));}export function profileExists(_0x330de9){const _0x5dc700=a45_0x5821,_0x171122=listProfiles();return _0x171122[_0x5dc700(0x1ba)](_0x49f898=>_0x49f898[_0x5dc700(0x1ac)]===_0x330de9);}export function loadProfile(_0x1ddcac){const _0x359dc8=a45_0x5821;validateProfileName(_0x1ddcac);const _0x335923=listProfiles(),_0x19bef8=_0x335923[_0x359dc8(0x188)](_0x5bf56e=>_0x5bf56e[_0x359dc8(0x1ac)]===_0x1ddcac);return _0x19bef8||null;}export function saveProfile(_0x31ddad,_0x3bef50,_0x233ae1=![]){saveProfileToUserConfig(_0x31ddad,_0x3bef50);}export function deleteProfile(_0x2fb975){const _0x488cf4=a45_0x5821;validateProfileName(_0x2fb975);const _0x4fa2ed=getProfileDir(_0x2fb975);if(!a45_0x1ba69a[_0x488cf4(0x1a2)](_0x4fa2ed))throw new Error(_0x488cf4(0x1ae)+_0x2fb975+_0x488cf4(0x190));a45_0x1ba69a['rmSync'](_0x4fa2ed,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3ed96f,_0x4cbab4){const _0x1d73a2=a45_0x5821;validateProfileName(_0x3ed96f);const _0xc6f87e=getGlobalConfigPath(),_0x89f11e=getConfigDir();!a45_0x1ba69a[_0x1d73a2(0x1a2)](_0x89f11e)&&createSecureDirectory(_0x89f11e);let _0x22adc2={};if(a45_0x1ba69a['existsSync'](_0xc6f87e))try{const _0x252da0=a45_0x1ba69a[_0x1d73a2(0x1a7)](_0xc6f87e,_0x1d73a2(0x1b0));_0x22adc2=JSON[_0x1d73a2(0x183)](_0x252da0);}catch{console[_0x1d73a2(0x19c)](_0x1d73a2(0x1ab)+_0xc6f87e+_0x1d73a2(0x1bb));}!_0x22adc2['profiles']&&(_0x22adc2['profiles']={}),_0x22adc2[_0x1d73a2(0x19a)][_0x3ed96f]=_0x4cbab4,writeSecureFile(_0xc6f87e,JSON[_0x1d73a2(0x180)](_0x22adc2,null,0x2));}export function getActiveProfile(){const _0x42f5eb=a45_0x5821,_0x51fa11=loadSessionContext();if(_0x51fa11?.['profile'])return _0x51fa11[_0x42f5eb(0x1b8)];const _0x1f104a=getGlobalConfigPath();if(!a45_0x1ba69a[_0x42f5eb(0x1a2)](_0x1f104a))return null;try{const _0x45d903=a45_0x1ba69a[_0x42f5eb(0x1a7)](_0x1f104a,_0x42f5eb(0x1b0)),_0x19788c=JSON[_0x42f5eb(0x183)](_0x45d903);return _0x19788c[_0x42f5eb(0x1b8)]||null;}catch{return null;}}export function createProfile(_0x402418,_0x12de3e){const _0x784863=a45_0x5821;validateProfileName(_0x402418);if(profileExists(_0x402418))throw new Error(_0x784863(0x1ae)+_0x402418+_0x784863(0x1b4));saveProfile(_0x402418,_0x12de3e);}export function saveProfileCredentials(_0x25a869,_0x12261c){const _0xbe74f1=a45_0x5821;validateProfileName(_0x25a869);if(!profileExists(_0x25a869))throw new Error(_0xbe74f1(0x1ae)+_0x25a869+_0xbe74f1(0x190));const _0x449d56=getNewCredentialPath(_0x25a869);writeSecureFile(_0x449d56,_0x12261c);}export function loadProfileCredentials(_0x282c8d){const _0x51ecff=a45_0x5821;validateProfileName(_0x282c8d);const _0x52e388=getNewCredentialPath(_0x282c8d);if(a45_0x1ba69a[_0x51ecff(0x1a2)](_0x52e388))try{return a45_0x1ba69a[_0x51ecff(0x1a7)](_0x52e388,_0x51ecff(0x1b0));}catch{}const _0x3d6369=getOldCredentialPath(_0x282c8d);if(a45_0x1ba69a[_0x51ecff(0x1a2)](_0x3d6369)){console[_0x51ecff(0x19c)](_0x51ecff(0x18f)+_0x282c8d+'\x27'),console[_0x51ecff(0x19c)]('To\x20migrate:'),console['warn'](_0x51ecff(0x17d)+_0x3d6369+_0x51ecff(0x182)+_0x52e388+'\x22'),console[_0x51ecff(0x19c)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a45_0x1ba69a['readFileSync'](_0x3d6369,_0x51ecff(0x1b0));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x4dee6a,_0xcbf1dd){const _0x1acead=a45_0x1e45,_0x3a1c11=_0x4dee6a();while(!![]){try{const _0x44e62e=parseInt(_0x1acead(0x1cb))/0x1*(parseInt(_0x1acead(0x1c8))/0x2)+-parseInt(_0x1acead(0x1db))/0x3+parseInt(_0x1acead(0x1e8))/0x4+parseInt(_0x1acead(0x1df))/0x5*(-parseInt(_0x1acead(0x1cc))/0x6)+parseInt(_0x1acead(0x1aa))/0x7+-parseInt(_0x1acead(0x1d7))/0x8+parseInt(_0x1acead(0x1de))/0x9;if(_0x44e62e===_0xcbf1dd)break;else _0x3a1c11['push'](_0x3a1c11['shift']());}catch(_0x3140ca){_0x3a1c11['push'](_0x3a1c11['shift']());}}}(a45_0x5de1,0xcfd87));import*as a45_0x545922 from'node:fs';import*as a45_0x525f79 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a45_0x1e45(_0x4ab8c9,_0x6e7716){const _0x5de197=a45_0x5de1();return a45_0x1e45=function(_0x1e4536,_0x120ccf){_0x1e4536=_0x1e4536-0x19b;let _0x3c6c97=_0x5de197[_0x1e4536];return _0x3c6c97;},a45_0x1e45(_0x4ab8c9,_0x6e7716);}export function getProfileParams(_0xc308f1){const _0x220654=a45_0x1e45,_0x2ebc34={};if(!_0xc308f1)return _0x2ebc34;for(const [_0x110739,_0x422157]of Object['entries'](_0xc308f1)){_0x110739!==_0x220654(0x1c5)&&_0x422157!==undefined&&(_0x2ebc34[_0x110739]=_0x422157);}return _0x2ebc34;}function a45_0x5de1(){const _0x4954c0=['some','from','\x20\x20mv\x20\x22','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','Warning:\x20Profile\x20\x27','readdirSync','description','warn','test','2IQAlYT','parent_segment','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','574423SbvYyY','1374pUQjHa','user','Profile\x20','length','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','string','\x20already\x20exists','existsSync','set','map','.env.','13192792rHXZVM','database','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','3199848htUToo','\x27:\x20unknown\x20config\x20key\x20\x27','llm_project','14425434NRBAlz','29875GnRtAn','directory','.env','local','join','toISOString','tdx.json','entries','message','5496308bLxLXI','rmSync','parse','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x27:\x20config\x20must\x20be\x20an\x20object','find','keys','stringify','llm_agent','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','profiles','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x20\x201.\x20Edit:\x20','push','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','9687993XCcXfr','profile','Error:\x20','To\x20migrate:','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','readFileSync','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x20does\x20not\x20exist','includes','values','\x27\x20will\x20be\x20ignored','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','Invalid\x20profile\x20name:\x20','name','utf-8','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','filter'];a45_0x5de1=function(){return _0x4954c0;};return a45_0x5de1();}export function getProfilesDir(){const _0x48f9bd=a45_0x1e45;return a45_0x525f79[_0x48f9bd(0x1e3)](getConfigDir(),_0x48f9bd(0x1a5));}function getProfileDir(_0x21c92c){const _0x5bafb0=a45_0x1e45;return a45_0x525f79[_0x5bafb0(0x1e3)](getProfilesDir(),_0x21c92c);}function getProfileConfigPath(_0x179924){const _0x437b94=a45_0x1e45;return a45_0x525f79[_0x437b94(0x1e3)](getProfileDir(_0x179924),_0x437b94(0x1e5));}function getProfileEnvPath(_0x1d9877){const _0x5217d4=a45_0x1e45;return a45_0x525f79[_0x5217d4(0x1e3)](getProfileDir(_0x1d9877),_0x5217d4(0x1e1));}function getGlobalConfigPath(){const _0x1d38c2=a45_0x1e45;return a45_0x525f79[_0x1d38c2(0x1e3)](getConfigDir(),_0x1d38c2(0x1e5));}function validateProfileName(_0x35746b){const _0x128691=a45_0x1e45;if(!/^[a-zA-Z0-9_-]+$/[_0x128691(0x1c7)](_0x35746b))throw new Error(_0x128691(0x1b9)+_0x35746b+_0x128691(0x1da));}function validateProfileConfig(_0xac7825,_0x257ece){const _0x284040=a45_0x1e45;if(typeof _0xac7825!=='object'||_0xac7825===null)throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x19e));const _0x32024d=[_0x284040(0x1c5),'site',_0x284040(0x1d8),_0x284040(0x1c9),_0x284040(0x1dd),'llm_agent'],_0x406729=_0xac7825;for(const _0xa3caae of Object[_0x284040(0x1a0)](_0x406729)){!_0x32024d[_0x284040(0x1b2)](_0xa3caae)&&console[_0x284040(0x1c6)](_0x284040(0x1c3)+_0x257ece+_0x284040(0x1dc)+_0xa3caae+_0x284040(0x1b4));}if(_0x406729['description']!==undefined&&typeof _0x406729[_0x284040(0x1c5)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1a3));if(_0x406729[_0x284040(0x1d9)]!==undefined&&typeof _0x406729[_0x284040(0x1d9)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x406729['database']!==undefined&&typeof _0x406729[_0x284040(0x1d8)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1b5));if(_0x406729['parent_segment']!==undefined&&typeof _0x406729[_0x284040(0x1c9)]!=='string')throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1ae));if(_0x406729['llm_project']!==undefined&&typeof _0x406729[_0x284040(0x1dd)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1d0));if(_0x406729[_0x284040(0x1a2)]!==undefined&&typeof _0x406729[_0x284040(0x1a2)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1bc));return!![];}function loadProfilesFromTdxJson(_0x5cab48,_0x856291){const _0x477676=a45_0x1e45;if(!a45_0x545922[_0x477676(0x1d3)](_0x5cab48))return[];try{const _0x1f2af8=a45_0x545922[_0x477676(0x1af)](_0x5cab48,_0x477676(0x1bb)),_0x24ad8f=JSON['parse'](_0x1f2af8);if(!_0x24ad8f[_0x477676(0x1a5)]||typeof _0x24ad8f[_0x477676(0x1a5)]!=='object')return[];const _0x2e5881=[];for(const [_0x13a9ff,_0x53c745]of Object[_0x477676(0x1e6)](_0x24ad8f['profiles'])){try{validateProfileConfig(_0x53c745,_0x13a9ff);const _0x22c6a1=getNewCredentialPath(_0x13a9ff),_0x30df9a=getOldCredentialPath(_0x13a9ff),_0x3a2e51=a45_0x545922[_0x477676(0x1d3)](_0x22c6a1)||a45_0x545922[_0x477676(0x1d3)](_0x30df9a);_0x2e5881[_0x477676(0x1a8)]({'name':_0x13a9ff,'config':_0x53c745,'metadata':{'name':_0x13a9ff,'createdAt':new Date()[_0x477676(0x1e4)]()},'hasCredentials':_0x3a2e51,'scope':_0x856291});}catch(_0x142032){_0x142032 instanceof Error&&(console[_0x477676(0x1c6)](_0x477676(0x1b0)+_0x5cab48+':'),console[_0x477676(0x1c6)]('\x20\x20'+_0x142032[_0x477676(0x1e7)]+'\x0a'));}}return _0x2e5881;}catch(_0x45840b){return _0x45840b instanceof SyntaxError?(console[_0x477676(0x1c6)](_0x477676(0x19d)+_0x5cab48+':\x20Invalid\x20JSON\x20syntax'),console[_0x477676(0x1c6)](_0x477676(0x1ac)+_0x45840b[_0x477676(0x1e7)]+'\x0a')):console[_0x477676(0x1c6)](_0x477676(0x1a9)+_0x5cab48+':\x20'+_0x45840b+'\x0a'),[];}}export function getNewCredentialPath(_0x146a41){const _0x47b199=a45_0x1e45;return a45_0x525f79[_0x47b199(0x1e3)](getConfigDir(),_0x47b199(0x1d6)+_0x146a41);}function getOldCredentialPath(_0x3090f9){const _0xfda1b5=a45_0x1e45;return a45_0x525f79['join'](getProfilesDir(),_0x3090f9,_0xfda1b5(0x1e1));}function loadProfilesFromTdxJsonFiles(){const _0xa4cde9=a45_0x1e45,_0x3bdff0=[],_0x5af367=findProjectConfigPath();_0x5af367&&_0x3bdff0[_0xa4cde9(0x1a8)](...loadProfilesFromTdxJson(_0x5af367,_0xa4cde9(0x1e2)));const _0x18e7f4=a45_0x525f79[_0xa4cde9(0x1e3)](getConfigDir(),_0xa4cde9(0x1e5));return _0x3bdff0['push'](...loadProfilesFromTdxJson(_0x18e7f4,_0xa4cde9(0x1cd))),_0x3bdff0;}function loadProfilesFromDirectories(){const _0x390c9c=a45_0x1e45,_0x16b7cb=getProfilesDir();if(!a45_0x545922['existsSync'](_0x16b7cb))return[];try{return a45_0x545922[_0x390c9c(0x1c4)](_0x16b7cb,{'withFileTypes':!![]})['filter'](_0x5ecc38=>_0x5ecc38['isDirectory']())[_0x390c9c(0x1d5)](_0x1d2f6f=>_0x1d2f6f['name'])[_0x390c9c(0x1bd)](_0x2a0592=>{const _0x5d2050=_0x390c9c,_0x1a3e2e=getProfileConfigPath(_0x2a0592),_0x19c3a9=getProfileEnvPath(_0x2a0592);return a45_0x545922['existsSync'](_0x1a3e2e)||a45_0x545922[_0x5d2050(0x1d3)](_0x19c3a9);})[_0x390c9c(0x1d5)](_0x370090=>{const _0x33b7d5=loadProfileFromDirectory(_0x370090);if(_0x33b7d5)return{..._0x33b7d5,'scope':'directory'};return null;})['filter'](_0x428809=>_0x428809!==null);}catch{return[];}}function loadProfileFromDirectory(_0x107bb3){const _0x4a77d7=a45_0x1e45,_0x2b4cb4=getProfileConfigPath(_0x107bb3),_0x2191aa=getOldCredentialPath(_0x107bb3);if(!a45_0x545922[_0x4a77d7(0x1d3)](_0x2b4cb4)&&!a45_0x545922[_0x4a77d7(0x1d3)](_0x2191aa))return null;let _0xcf798={},_0x3fbf5c={'name':_0x107bb3,'createdAt':new Date()[_0x4a77d7(0x1e4)]()};if(a45_0x545922[_0x4a77d7(0x1d3)](_0x2b4cb4))try{const _0x56fb3a=a45_0x545922[_0x4a77d7(0x1af)](_0x2b4cb4,'utf-8'),_0x3f0a00=JSON[_0x4a77d7(0x19c)](_0x56fb3a),{metadata:_0x532f1a,..._0x163a6a}=_0x3f0a00;_0xcf798=_0x163a6a,_0x532f1a&&(_0x3fbf5c=_0x532f1a);}catch{}return{'name':_0x107bb3,'config':_0xcf798,'metadata':_0x3fbf5c,'hasCredentials':a45_0x545922[_0x4a77d7(0x1d3)](_0x2191aa),'scope':_0x4a77d7(0x1e0)};}export function listProfiles(){const _0x3ae13d=a45_0x1e45,_0x548b9c=loadProfilesFromTdxJsonFiles(),_0x54b7e0=loadProfilesFromDirectories();if(_0x54b7e0[_0x3ae13d(0x1cf)]>0x0){const _0x51c954=_0x54b7e0[_0x3ae13d(0x1d5)](_0x2f8885=>_0x2f8885['name'])[_0x3ae13d(0x1e3)](',\x20'),_0x40e947=getConfigDir();console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1b7)+_0x51c954),console[_0x3ae13d(0x1c6)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1a7)+a45_0x525f79[_0x3ae13d(0x1e3)](_0x40e947,_0x3ae13d(0x1e5))),console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1c1)),console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1a6));}const _0x5cdbbc=[..._0x548b9c,..._0x54b7e0],_0xaa2b06=new Map();for(const _0x5f032c of _0x5cdbbc){!_0xaa2b06['has'](_0x5f032c[_0x3ae13d(0x1ba)])&&_0xaa2b06[_0x3ae13d(0x1d4)](_0x5f032c[_0x3ae13d(0x1ba)],_0x5f032c);}return Array[_0x3ae13d(0x1bf)](_0xaa2b06[_0x3ae13d(0x1b3)]())['sort']((_0xd9cb93,_0xa302fa)=>_0xd9cb93[_0x3ae13d(0x1ba)][_0x3ae13d(0x1c2)](_0xa302fa[_0x3ae13d(0x1ba)]));}export function profileExists(_0x4bd45d){const _0x169442=a45_0x1e45,_0x3df0b5=listProfiles();return _0x3df0b5[_0x169442(0x1be)](_0x17204b=>_0x17204b[_0x169442(0x1ba)]===_0x4bd45d);}export function loadProfile(_0x1e6ab1){const _0x5b1111=a45_0x1e45;validateProfileName(_0x1e6ab1);const _0x44eab2=listProfiles(),_0x50d4e0=_0x44eab2[_0x5b1111(0x19f)](_0xe66009=>_0xe66009[_0x5b1111(0x1ba)]===_0x1e6ab1);return _0x50d4e0||null;}export function saveProfile(_0x42e48f,_0x2e4245,_0x8c869=![]){saveProfileToUserConfig(_0x42e48f,_0x2e4245);}export function deleteProfile(_0x531e74){const _0xb7b1a1=a45_0x1e45;validateProfileName(_0x531e74);const _0x38a9f6=getProfileDir(_0x531e74);if(!a45_0x545922[_0xb7b1a1(0x1d3)](_0x38a9f6))throw new Error('Profile\x20'+_0x531e74+_0xb7b1a1(0x1b1));a45_0x545922[_0xb7b1a1(0x19b)](_0x38a9f6,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x26d71b,_0x52db55){const _0x28f1a6=a45_0x1e45;validateProfileName(_0x26d71b);const _0x480c81=getGlobalConfigPath(),_0xf461db=getConfigDir();!a45_0x545922['existsSync'](_0xf461db)&&createSecureDirectory(_0xf461db);let _0x5c348e={};if(a45_0x545922[_0x28f1a6(0x1d3)](_0x480c81))try{const _0x24f564=a45_0x545922[_0x28f1a6(0x1af)](_0x480c81,_0x28f1a6(0x1bb));_0x5c348e=JSON[_0x28f1a6(0x19c)](_0x24f564);}catch{console[_0x28f1a6(0x1c6)](_0x28f1a6(0x1b6)+_0x480c81+',\x20creating\x20new\x20file');}!_0x5c348e['profiles']&&(_0x5c348e[_0x28f1a6(0x1a5)]={}),_0x5c348e['profiles'][_0x26d71b]=_0x52db55,writeSecureFile(_0x480c81,JSON[_0x28f1a6(0x1a1)](_0x5c348e,null,0x2));}export function getActiveProfile(){const _0xc6e4c9=a45_0x1e45,_0x29cddd=loadSessionContext();if(_0x29cddd?.['profile'])return _0x29cddd[_0xc6e4c9(0x1ab)];const _0x522841=getGlobalConfigPath();if(!a45_0x545922['existsSync'](_0x522841))return null;try{const _0x518187=a45_0x545922['readFileSync'](_0x522841,_0xc6e4c9(0x1bb)),_0x405116=JSON[_0xc6e4c9(0x19c)](_0x518187);return _0x405116[_0xc6e4c9(0x1ab)]||null;}catch{return null;}}export function createProfile(_0x50f7bb,_0x4b348c){const _0x4251c5=a45_0x1e45;validateProfileName(_0x50f7bb);if(profileExists(_0x50f7bb))throw new Error('Profile\x20'+_0x50f7bb+_0x4251c5(0x1d2));saveProfile(_0x50f7bb,_0x4b348c);}export function saveProfileCredentials(_0x288c0e,_0x551d0f){const _0x501e0b=a45_0x1e45;validateProfileName(_0x288c0e);if(!profileExists(_0x288c0e))throw new Error(_0x501e0b(0x1ce)+_0x288c0e+_0x501e0b(0x1b1));const _0x4f5fc7=getNewCredentialPath(_0x288c0e);writeSecureFile(_0x4f5fc7,_0x551d0f);}export function loadProfileCredentials(_0x42a84c){const _0x19bdca=a45_0x1e45;validateProfileName(_0x42a84c);const _0x3b6606=getNewCredentialPath(_0x42a84c);if(a45_0x545922[_0x19bdca(0x1d3)](_0x3b6606))try{return a45_0x545922['readFileSync'](_0x3b6606,_0x19bdca(0x1bb));}catch{}const _0x5c29bd=getOldCredentialPath(_0x42a84c);if(a45_0x545922['existsSync'](_0x5c29bd)){console[_0x19bdca(0x1c6)](_0x19bdca(0x1ca)+_0x42a84c+'\x27'),console[_0x19bdca(0x1c6)](_0x19bdca(0x1ad)),console[_0x19bdca(0x1c6)](_0x19bdca(0x1c0)+_0x5c29bd+'\x22\x20\x22'+_0x3b6606+'\x22'),console['warn'](_0x19bdca(0x1b8));try{return a45_0x545922['readFileSync'](_0x5c29bd,'utf-8');}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a46_0x1dcd(){const _0x3e28e4=['4987436ksxSaJ','Warning:\x20\x27profile\x27\x20field\x20in\x20','TD_API_KEY','api_key','3331071pGFwzb','2355510cyqPap',').\x20','join','includes','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','cwd','492865rKoRkm','stringify','430086HbFhsG','2fLmDwA','\x20is\x20ignored.\x20','tdx.json','parse','writeFileSync','Failed\x20to\x20load\x20project\x20config\x20from\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','dirname','apiKey','profile','5070400XGwGcp','code','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','utf-8','224PqkLYZ','19080LZynwI','35StHjFn','readFileSync','warn','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'];a46_0x1dcd=function(){return _0x3e28e4;};return a46_0x1dcd();}const a46_0x924d9c=a46_0x115f;(function(_0x430779,_0x596e12){const _0x5ac1ab=a46_0x115f,_0x2bdb9b=_0x430779();while(!![]){try{const _0x115cc7=-parseInt(_0x5ac1ab(0xb0))/0x1*(-parseInt(_0x5ac1ab(0xb3))/0x2)+parseInt(_0x5ac1ab(0xa9))/0x3+-parseInt(_0x5ac1ab(0xa5))/0x4+parseInt(_0x5ac1ab(0xbd))/0x5+parseInt(_0x5ac1ab(0xb2))/0x6*(-parseInt(_0x5ac1ab(0xa1))/0x7)+-parseInt(_0x5ac1ab(0xc1))/0x8*(parseInt(_0x5ac1ab(0xc2))/0x9)+-parseInt(_0x5ac1ab(0xaa))/0xa;if(_0x115cc7===_0x596e12)break;else _0x2bdb9b['push'](_0x2bdb9b['shift']());}catch(_0x30ab4e){_0x2bdb9b['push'](_0x2bdb9b['shift']());}}}(a46_0x1dcd,0xaf147));import*as a46_0x4374f1 from'node:fs';function a46_0x115f(_0x5473e6,_0xd69f63){const _0x1dcdcb=a46_0x1dcd();return a46_0x115f=function(_0x115f9c,_0x3735a3){_0x115f9c=_0x115f9c-0xa1;let _0x3eacbd=_0x1dcdcb[_0x115f9c];return _0x3eacbd;},a46_0x115f(_0x5473e6,_0xd69f63);}import*as a46_0x1b9fcc from'node:path';const PROJECT_CONFIG_FILENAME=a46_0x924d9c(0xb5);export function findProjectConfigPath(_0x3d7a20){const _0x52f9b5=a46_0x924d9c;let _0x15ce7d=_0x3d7a20||process[_0x52f9b5(0xaf)]();while(!![]){const _0x27e7a8=a46_0x1b9fcc[_0x52f9b5(0xac)](_0x15ce7d,PROJECT_CONFIG_FILENAME);if(a46_0x4374f1['existsSync'](_0x27e7a8))return _0x27e7a8;const _0x49831b=a46_0x1b9fcc[_0x52f9b5(0xba)](_0x15ce7d);if(_0x49831b===_0x15ce7d)return null;_0x15ce7d=_0x49831b;}}export function loadProjectConfig(_0x14ba9f){const _0x58ac35=a46_0x924d9c,_0x48a83a=findProjectConfigPath(_0x14ba9f);if(!_0x48a83a)return null;try{const _0x314a87=a46_0x4374f1[_0x58ac35(0xa2)](_0x48a83a,_0x58ac35(0xc0)),_0xe0a38f=JSON[_0x58ac35(0xb6)](_0x314a87),_0x4df231=JSON['stringify'](_0xe0a38f);if(_0x4df231[_0x58ac35(0xad)](_0x58ac35(0xa7))||_0x4df231['includes'](_0x58ac35(0xbb))||_0x4df231[_0x58ac35(0xad)](_0x58ac35(0xa8)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x48a83a+_0x58ac35(0xab)+_0x58ac35(0xbf));const {metadata:_0x3d798e,profile:_0x59bc05,..._0x104fe5}=_0xe0a38f;return _0x59bc05&&console[_0x58ac35(0xa3)](_0x58ac35(0xa6)+_0x48a83a+_0x58ac35(0xb4)+_0x58ac35(0xa4)),_0x104fe5;}catch(_0x4bb0a8){if(_0x4bb0a8 instanceof Error&&_0x58ac35(0xbe)in _0x4bb0a8&&_0x4bb0a8['code']==='ENOENT')return null;throw new Error(_0x58ac35(0xb8)+_0x48a83a+':\x20'+_0x4bb0a8);}}export function saveProjectConfig(_0x5d1c36,_0xbc3b3c){const _0x146d99=a46_0x924d9c,_0x4a4db0=_0xbc3b3c||process['cwd'](),_0x4f6714=a46_0x1b9fcc[_0x146d99(0xac)](_0x4a4db0,PROJECT_CONFIG_FILENAME),_0x5d4a54=JSON[_0x146d99(0xb1)](_0x5d1c36);if(_0x5d4a54[_0x146d99(0xad)](_0x146d99(0xa7))||_0x5d4a54[_0x146d99(0xad)]('apiKey')||_0x5d4a54[_0x146d99(0xad)](_0x146d99(0xa8)))throw new Error(_0x146d99(0xb9));if(_0x146d99(0xbc)in _0x5d1c36)throw new Error(_0x146d99(0xae));a46_0x4374f1[_0x146d99(0xb7)](_0x4f6714,JSON[_0x146d99(0xb1)](_0x5d1c36,null,0x2));}export function hasProjectConfig(_0x120143){return findProjectConfigPath(_0x120143)!==null;}export function getProjectRoot(_0x57d3c0){const _0x25d1e9=a46_0x924d9c,_0x199ef6=findProjectConfigPath(_0x57d3c0);return _0x199ef6?a46_0x1b9fcc[_0x25d1e9(0xba)](_0x199ef6):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x51d9f6,_0x6a77cf){const _0x39e3a6=a47_0x4c01,_0x186d3d=_0x51d9f6();while(!![]){try{const _0x445e6a=parseInt(_0x39e3a6(0x207))/0x1+parseInt(_0x39e3a6(0x1e9))/0x2+-parseInt(_0x39e3a6(0x1fc))/0x3*(-parseInt(_0x39e3a6(0x1f0))/0x4)+parseInt(_0x39e3a6(0x1f4))/0x5*(parseInt(_0x39e3a6(0x203))/0x6)+-parseInt(_0x39e3a6(0x1f6))/0x7+parseInt(_0x39e3a6(0x1fb))/0x8*(parseInt(_0x39e3a6(0x1f2))/0x9)+-parseInt(_0x39e3a6(0x206))/0xa*(parseInt(_0x39e3a6(0x1f7))/0xb);if(_0x445e6a===_0x6a77cf)break;else _0x186d3d['push'](_0x186d3d['shift']());}catch(_0x4034ea){_0x186d3d['push'](_0x186d3d['shift']());}}}(a47_0x1b51,0x3b15c));import*as a47_0x237723 from'node:fs';import*as a47_0x59feeb from'node:path';import*as a47_0x85e1bc from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x5b05ec=a47_0x4c01,_0x476b5b=process['env'][_0x5b05ec(0x205)]||a47_0x59feeb[_0x5b05ec(0x1ef)](a47_0x85e1bc[_0x5b05ec(0x1ea)](),_0x5b05ec(0x20a),_0x5b05ec(0x1fd));return a47_0x59feeb['join'](_0x476b5b,_0x5b05ec(0x204));}function getSessionPath(_0x3a41f0){const _0x4c593d=a47_0x4c01;return a47_0x59feeb[_0x4c593d(0x1ef)](getSessionsDir(),_0x3a41f0+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x575d22){if(_0x575d22)return _0x575d22;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x1e041e){const _0x15d3d3=a47_0x4c01,_0x24be93=_0x1e041e||getCurrentSessionPID()[_0x15d3d3(0x1fa)](),_0x4a9c68=/^\d+$/[_0x15d3d3(0x209)](_0x24be93)?parseInt(_0x24be93,0xa):null;return _0x4a9c68!==null?loadSessionContextByPID(_0x4a9c68):loadSessionContextByString(_0x24be93);}function a47_0x4c01(_0x381224,_0x41a9a4){const _0x1b514a=a47_0x1b51();return a47_0x4c01=function(_0x4c013f,_0x173ae0){_0x4c013f=_0x4c013f-0x1e4;let _0x40e3ef=_0x1b514a[_0x4c013f];return _0x40e3ef;},a47_0x4c01(_0x381224,_0x41a9a4);}function a47_0x1b51(){const _0x449098=['TD_API_KEY','564284ezfBLG','5170jcvOxK','unlinkSync','createdAt','toString','904xqXQwN','12PaWVrI','tdx','replace','warn','apiKey','readdirSync','endsWith','162hQPzbd','sessions','TDX_CONFIG_DIR','18060fuSRqU','188961IdETLr','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','test','.config','includes','sort','api_key','.\x20This\x20is\x20insecure.\x20Removing\x20session.','parse','toISOString','readFileSync','622266otRkIY','homedir','existsSync','getTime','utf-8','.json','join','448664proKmv','stringify','17235SxhJeA','now','1165jFskMj'];a47_0x1b51=function(){return _0x449098;};return a47_0x1b51();}export function loadSessionContextByPID(_0x1eecbc){const _0x1f0092=a47_0x4c01,_0x5bf975=getSessionPath(_0x1eecbc);if(!a47_0x237723[_0x1f0092(0x1eb)](_0x5bf975))return null;try{const _0x3c9180=a47_0x237723[_0x1f0092(0x1e8)](_0x5bf975,_0x1f0092(0x1ed)),_0x433633=JSON[_0x1f0092(0x1e6)](_0x3c9180),_0x4f7fb6=new Date(_0x433633[_0x1f0092(0x1f9)])[_0x1f0092(0x1ec)](),_0x238587=Date[_0x1f0092(0x1f3)]();if(_0x238587-_0x4f7fb6>SESSION_EXPIRATION_MS)return a47_0x237723[_0x1f0092(0x1f8)](_0x5bf975),null;const _0x368541=JSON[_0x1f0092(0x1f1)](_0x433633);if(_0x368541[_0x1f0092(0x20b)](_0x1f0092(0x1f5))||_0x368541[_0x1f0092(0x20b)](_0x1f0092(0x200))||_0x368541[_0x1f0092(0x20b)]('api_key'))return console['warn'](_0x1f0092(0x208)+_0x5bf975+_0x1f0092(0x1e5)),a47_0x237723[_0x1f0092(0x1f8)](_0x5bf975),null;return _0x433633;}catch{try{a47_0x237723[_0x1f0092(0x1f8)](_0x5bf975);}catch{}return null;}}function loadSessionContextByString(_0x2e9131){const _0x5b023e=a47_0x4c01,_0x41633e=a47_0x59feeb['join'](getSessionsDir(),_0x2e9131+_0x5b023e(0x1ee));if(!a47_0x237723['existsSync'](_0x41633e))return null;try{const _0x1ff8a9=a47_0x237723[_0x5b023e(0x1e8)](_0x41633e,_0x5b023e(0x1ed)),_0x49c4cb=JSON[_0x5b023e(0x1e6)](_0x1ff8a9),_0x56d547=new Date(_0x49c4cb['createdAt'])[_0x5b023e(0x1ec)](),_0x39a1d0=Date[_0x5b023e(0x1f3)]();if(_0x39a1d0-_0x56d547>SESSION_EXPIRATION_MS)return a47_0x237723[_0x5b023e(0x1f8)](_0x41633e),null;const _0x42856a=JSON[_0x5b023e(0x1f1)](_0x49c4cb);if(_0x42856a['includes'](_0x5b023e(0x1f5))||_0x42856a[_0x5b023e(0x20b)](_0x5b023e(0x200))||_0x42856a[_0x5b023e(0x20b)](_0x5b023e(0x1e4)))return console[_0x5b023e(0x1ff)](_0x5b023e(0x208)+_0x41633e+_0x5b023e(0x1e5)),a47_0x237723['unlinkSync'](_0x41633e),null;return _0x49c4cb;}catch{try{a47_0x237723[_0x5b023e(0x1f8)](_0x41633e);}catch{}return null;}}export function saveSessionContext(_0x5f0608,_0xc4053){const _0x3c7073=a47_0x4c01,_0xb5dd8=_0xc4053||getCurrentSessionPID()[_0x3c7073(0x1fa)](),_0x1d78dc=/^\d+$/[_0x3c7073(0x209)](_0xb5dd8)?parseInt(_0xb5dd8,0xa):getCurrentSessionPID(),_0x35942a=a47_0x59feeb[_0x3c7073(0x1ef)](getSessionsDir(),_0xb5dd8+_0x3c7073(0x1ee)),_0x16f847=getSessionsDir();createSecureDirectory(_0x16f847);const _0x890a2e=JSON['stringify'](_0x5f0608);if(_0x890a2e[_0x3c7073(0x20b)](_0x3c7073(0x1f5))||_0x890a2e[_0x3c7073(0x20b)](_0x3c7073(0x200))||_0x890a2e[_0x3c7073(0x20b)](_0x3c7073(0x1e4)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x15b679;const _0xdb4ad1=/^\d+$/[_0x3c7073(0x209)](_0xb5dd8)?loadSessionContextByPID(parseInt(_0xb5dd8,0xa)):loadSessionContextByString(_0xb5dd8);_0xdb4ad1?_0x15b679={..._0xdb4ad1,..._0x5f0608,'pid':_0x1d78dc,'sessionId':_0xb5dd8!==_0x1d78dc[_0x3c7073(0x1fa)]()?_0xb5dd8:undefined,'updatedAt':new Date()['toISOString']()}:_0x15b679={'pid':_0x1d78dc,'sessionId':_0xb5dd8!==_0x1d78dc['toString']()?_0xb5dd8:undefined,..._0x5f0608,'createdAt':new Date()[_0x3c7073(0x1e7)](),'updatedAt':new Date()[_0x3c7073(0x1e7)]()},a47_0x237723['writeFileSync'](_0x35942a,JSON['stringify'](_0x15b679,null,0x2));}export function clearSessionContext(_0x293e9d){const _0x50ad6a=a47_0x4c01,_0x28bf3c=_0x293e9d||getCurrentSessionPID()[_0x50ad6a(0x1fa)](),_0x51f373=a47_0x59feeb['join'](getSessionsDir(),_0x28bf3c+_0x50ad6a(0x1ee));a47_0x237723[_0x50ad6a(0x1eb)](_0x51f373)&&a47_0x237723[_0x50ad6a(0x1f8)](_0x51f373);}export function cleanExpiredSessions(){const _0x53408f=a47_0x4c01,_0x48d63d=getSessionsDir();if(!a47_0x237723['existsSync'](_0x48d63d))return 0x0;let _0x943183=0x0;const _0x2f25ac=Date[_0x53408f(0x1f3)]();try{const _0x3b818b=a47_0x237723[_0x53408f(0x201)](_0x48d63d);for(const _0x240216 of _0x3b818b){if(!_0x240216[_0x53408f(0x202)](_0x53408f(0x1ee)))continue;const _0x2893e7=a47_0x59feeb[_0x53408f(0x1ef)](_0x48d63d,_0x240216),_0x2097d8=_0x240216[_0x53408f(0x1fe)]('.json',''),_0x37991c=parseInt(_0x2097d8,0xa),_0x215b26=!isNaN(_0x37991c);if(_0x215b26){if(!isProcessRunning(_0x37991c)){a47_0x237723[_0x53408f(0x1f8)](_0x2893e7),_0x943183++;continue;}}try{const _0x50dde1=a47_0x237723['readFileSync'](_0x2893e7,_0x53408f(0x1ed)),_0x3ea124=JSON[_0x53408f(0x1e6)](_0x50dde1),_0x4eef7f=new Date(_0x3ea124[_0x53408f(0x1f9)])[_0x53408f(0x1ec)]();_0x2f25ac-_0x4eef7f>SESSION_EXPIRATION_MS&&(a47_0x237723[_0x53408f(0x1f8)](_0x2893e7),_0x943183++);}catch{a47_0x237723[_0x53408f(0x1f8)](_0x2893e7),_0x943183++;}}}catch{}return _0x943183;}export function listActiveSessions(){const _0x8b243e=a47_0x4c01,_0x428c58=getSessionsDir();if(!a47_0x237723[_0x8b243e(0x1eb)](_0x428c58))return[];try{const _0x52d795=a47_0x237723[_0x8b243e(0x201)](_0x428c58),_0x23d731=[];for(const _0x53481d of _0x52d795){if(!_0x53481d['endsWith'](_0x8b243e(0x1ee)))continue;const _0x59d61c=_0x53481d['replace'](_0x8b243e(0x1ee),''),_0x476a5e=parseInt(_0x59d61c,0xa);!isNaN(_0x476a5e)&&isProcessRunning(_0x476a5e)&&_0x23d731['push'](_0x476a5e);}return _0x23d731[_0x8b243e(0x20c)]((_0x1d2388,_0x12edad)=>_0x1d2388-_0x12edad);}catch{return[];}}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f0dee,_0x15c831){var _0x42c18b=a48_0x3915,_0x21a2a4=_0x1f0dee();while(!![]){try{var _0x4c4aeb=-parseInt(_0x42c18b(0x1d5))/0x1*(-parseInt(_0x42c18b(0x1da))/0x2)+parseInt(_0x42c18b(0x1d6))/0x3+-parseInt(_0x42c18b(0x1d8))/0x4+-parseInt(_0x42c18b(0x1d4))/0x5*(parseInt(_0x42c18b(0x1d9))/0x6)+parseInt(_0x42c18b(0x1d7))/0x7*(-parseInt(_0x42c18b(0x1db))/0x8)+parseInt(_0x42c18b(0x1dd))/0x9+-parseInt(_0x42c18b(0x1dc))/0xa*(parseInt(_0x42c18b(0x1de))/0xb);if(_0x4c4aeb===_0x15c831)break;else _0x21a2a4['push'](_0x21a2a4['shift']());}catch(_0x3d429b){_0x21a2a4['push'](_0x21a2a4['shift']());}}}(a48_0x2661,0x4ee9d));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';function a48_0x3915(_0x2509cb,_0x5a4e32){var _0x2661a4=a48_0x2661();return a48_0x3915=function(_0x39157c,_0x74bdbc){_0x39157c=_0x39157c-0x1d4;var _0x37615f=_0x2661a4[_0x39157c];return _0x37615f;},a48_0x3915(_0x2509cb,_0x5a4e32);}function a48_0x2661(){var _0x242731=['2GJWAeQ','8QfEhYl','3039570FCwOiA','801846zwXHHx','11KDTtmF','10qDINZW','625377rGBpTE','480468rkNzkJ','311633PGuAVA','461736ZdwFaN','262464QwQYAQ'];a48_0x2661=function(){return _0x242731;};return a48_0x2661();}export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
|