@treasuredata/tdx 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.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.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.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-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.js +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.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.d.ts +12 -0
- package/dist/types/endpoints.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/endpoints.js.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.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-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
|
-
function a39_0x304c(){const _0x6c7d13=['push','yes','isArray','6325704MQiHvx','10629353cRjgyp','sessionId','✔\x20Deleted\x20project\x20','workflow:workflows','workflow:retry','No\x20log\x20files\x20found\x20for\x20this\x20attempt','\x20\x20Cause:\x20','cause','verbose','cancelRequested','Getting\x20attempt\x20details...','Project\x20name:\x20','split','5707132fRELBX','Filter:\x20project=','Show\x20logs\x20for\x20a\x20workflow\x20attempt','select','✔\x20Found\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','fs/promises','format','Params:\x20','json','attempt:','Task\x20name:\x20','description','utf-8','stringify','Workflow:\x20','\x20\x20Attempt\x20ID:\x20','Show\x20tasks\x20for\x20an\x20attempt','data','List\x20all\x20workflow\x20projects','✔\x20Workflow\x20run\x20started','taskName','\x20workflow','execute','filesExtracted','workflow:attempt','attempt','session','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','workflow:download','retryAttemptName','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','run','logFiles','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','includeSubtasks','createdAt','3556880SXYBaO','workflow:run','Retrying\x20attempt...','✔\x20Pushed\x20','param','status','Select\x20a\x20task\x20to\x20view\x20logs:','\x20\x20Session\x20ID:\x20','includeRetried','revision','\x22?\x20This\x20cannot\x20be\x20undone.','projects','startsWith','substring','\x20attempt','Status:\x20','getTime','List\x20workflow\x20execution\x20sessions','Start\x20a\x20workflow\x20run','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','✔\x20Downloaded\x20','retrySession','\x20\x20Location:\x20','workflow:attempts','Error:\x20Attempt\x20ID\x20is\x20required','Getting\x20attempt\x20tasks...','\x20project','Pattern:\x20','finishedAt','\x20\x20Project\x20ID:\x20','Starting\x20workflow\x20run...','Resume\x20from:\x20','\x20\x20Project:\x20','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','projectName','round','isDirectory','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','276637wWmkmi','map','Retry\x20a\x20session\x20or\x20attempt','\x20\x20New\x20attempt\x20ID:\x20','workflow:sessions','List\x20workflow\x20attempts','name','running','Reason:\x20','session:','skipValidation','workflow:tasks','fileSize','workflow','delete','canceling','List\x20workflows','\x20\x20Revision:\x20','projectId','readFile','length','project','workflow:delete','Deleting\x20project\x20','Filter:\x20','Include\x20retried:\x20yes','Force:\x20yes','\x20\x20Workflow:\x20','index','Error:\x20Invalid\x20parameter\x20format:\x20','parse','Downloading\x20project\x20','keys','Revision:\x20','Project:\x20','✔\x20Retry\x20started','Pushing\x20workflow\x20project...','Show\x20specific\x20attempt\x20details','Target:\x20','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','error','success','reason','attempts','492132OupeQW','sessions','stat','Attempt\x20ID:\x20','Error:\x20Project\x20name\x20is\x20required','from','No\x20log\x20content\x20found','Cancelled','task','\x20task','sessionTime','force','62870AxMGyW','logs','workflow:push','Session\x20time:\x20','Parameters:\x20','Output\x20directory:\x20','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Usage:\x20workflow:delete\x20<project-name-or-id>','download','Including\x20subtasks:\x20yes','limit','workflow:kill','tasks','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Validation:\x20skipped','attemptId','params','Fetching\x20log\x20files...','\x20is\x20not\x20a\x20directory','Error:\x20','message','Retrying\x20session...','678hhhWQY'];a39_0x304c=function(){return _0x6c7d13;};return a39_0x304c();}const a39_0x187e55=a39_0x88b5;(function(_0x44a321,_0x234169){const _0x4f81b2=a39_0x88b5,_0x1ab361=_0x44a321();while(!![]){try{const _0x5c23ef=-parseInt(_0x4f81b2(0x127))/0x1+parseInt(_0x4f81b2(0x101))/0x2+parseInt(_0x4f81b2(0x153))/0x3+-parseInt(_0x4f81b2(0xdc))/0x4+parseInt(_0x4f81b2(0x15f))/0x5*(parseInt(_0x4f81b2(0xca))/0x6)+-parseInt(_0x4f81b2(0xcf))/0x7+parseInt(_0x4f81b2(0xce))/0x8;if(_0x5c23ef===_0x234169)break;else _0x1ab361['push'](_0x1ab361['shift']());}catch(_0x15746a){_0x1ab361['push'](_0x1ab361['shift']());}}}(a39_0x304c,0xe3940));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_0x22973d from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a39_0x187e55(0x12d)]='workflow:projects';[a39_0x187e55(0xe8)]=a39_0x187e55(0xef);async[a39_0x187e55(0xf3)](_0x16b4e7){const _0x5997db=a39_0x187e55,{options:_0x541da9,args:_0x2f0ece,tdx:_0x97b669}=_0x16b4e7,_0x18fe4d=_0x2f0ece[0x0];try{_0x541da9[_0x5997db(0xd7)]&&_0x18fe4d&&console[_0x5997db(0x14f)](_0x5997db(0x11c)+_0x18fe4d);const _0x1e5dcd=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x97b669[_0x5997db(0x134)][_0x5997db(0x10c)](_0x18fe4d,{'limit':_0x541da9[_0x5997db(0xbe)]}),{'verbose':_0x541da9[_0x5997db(0xd7)]}),_0xef1758=_0x1e5dcd[_0x5997db(0xee)];return console[_0x5997db(0x14f)](_0x5997db(0xe0)+_0xef1758[_0x5997db(0x13b)]+_0x5997db(0x11b)+(_0xef1758['length']!==0x1?'s':'')),await handleSDKOutput(_0xef1758,_0x541da9),0x0;}catch(_0x31f22a){if(_0x31f22a instanceof SDKError)return console[_0x5997db(0x14f)](_0x5997db(0xc7)+_0x31f22a[_0x5997db(0xc8)]),_0x31f22a['cause']&&console[_0x5997db(0x14f)]('\x20\x20Cause:\x20'+_0x31f22a[_0x5997db(0xd6)]),0x1;throw _0x31f22a;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0xd2);['description']=a39_0x187e55(0x137);async[a39_0x187e55(0xf3)](_0x45a254){const _0x47ad09=a39_0x187e55,{options:_0x5851bf,args:_0x22b44b,tdx:_0x39f671}=_0x45a254,_0x14a5a1=_0x22b44b[0x0];try{_0x5851bf[_0x47ad09(0xd7)]&&_0x14a5a1&&console[_0x47ad09(0x14f)]('Project\x20filter:\x20'+_0x14a5a1);const _0x4189fe=await withSpinner('Listing\x20workflows...',()=>_0x39f671[_0x47ad09(0x134)]['workflows'](_0x14a5a1,{'limit':_0x5851bf['limit']}),{'verbose':_0x5851bf[_0x47ad09(0xd7)]}),_0x2fff16=_0x4189fe['data'];return console[_0x47ad09(0x14f)]('✔\x20Found\x20'+_0x2fff16[_0x47ad09(0x13b)]+_0x47ad09(0xf2)+(_0x2fff16[_0x47ad09(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x2fff16,_0x5851bf),0x0;}catch(_0x3ae1bb){if(_0x3ae1bb instanceof SDKError)return console[_0x47ad09(0x14f)](_0x47ad09(0xc7)+_0x3ae1bb[_0x47ad09(0xc8)]),_0x3ae1bb[_0x47ad09(0xd6)]&&console['error'](_0x47ad09(0xd5)+_0x3ae1bb['cause']),0x1;throw _0x3ae1bb;}}}export class WorkflowSessionsCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x12b);['description']=a39_0x187e55(0x112);async['execute'](_0x3f6942){const _0x219ef4=a39_0x187e55,{options:_0x1dfe3d,args:_0x4b2877,tdx:_0x5a2e4d}=_0x3f6942;let _0x4b8823,_0x180ddd;if(_0x4b2877[0x0]){const _0x5fce0b=_0x4b2877[0x0][_0x219ef4(0xdb)]('.');if(_0x5fce0b[_0x219ef4(0x13b)]===0x1)_0x4b8823=_0x5fce0b[0x0];else{if(_0x5fce0b['length']===0x2)[_0x4b8823,_0x180ddd]=_0x5fce0b;else return console[_0x219ef4(0x14f)](_0x219ef4(0xfb)),0x1;}}try{if(_0x1dfe3d[_0x219ef4(0xd7)]){if(_0x4b8823&&_0x180ddd)console[_0x219ef4(0x14f)](_0x219ef4(0x13f)+_0x4b8823+'.'+_0x180ddd);else _0x4b8823&&console[_0x219ef4(0x14f)](_0x219ef4(0xdd)+_0x4b8823);const _0x139318=_0x1dfe3d[_0x219ef4(0x106)];_0x139318&&console['error'](_0x219ef4(0x110)+_0x139318);}const _0x5d4299=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x5a2e4d[_0x219ef4(0x134)][_0x219ef4(0x154)]({'projectName':_0x4b8823,'workflowName':_0x180ddd,'status':_0x1dfe3d[_0x219ef4(0x106)],'fromTime':_0x1dfe3d[_0x219ef4(0x158)],'toTime':_0x1dfe3d['to'],'limit':_0x1dfe3d[_0x219ef4(0xbe)]}),{'verbose':_0x1dfe3d[_0x219ef4(0xd7)]}),_0x5b7a7d=_0x5d4299[_0x219ef4(0xee)];return console[_0x219ef4(0x14f)](_0x219ef4(0xe0)+_0x5b7a7d[_0x219ef4(0x13b)]+'\x20session'+(_0x5b7a7d[_0x219ef4(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x5b7a7d,_0x1dfe3d),0x0;}catch(_0x46b58b){if(_0x46b58b instanceof SDKError)return console['error'](_0x219ef4(0xc7)+_0x46b58b['message']),_0x46b58b[_0x219ef4(0xd6)]&&console[_0x219ef4(0x14f)](_0x219ef4(0xd5)+_0x46b58b[_0x219ef4(0xd6)]),0x1;throw _0x46b58b;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x118);[a39_0x187e55(0xe8)]=a39_0x187e55(0x12c);async[a39_0x187e55(0xf3)](_0x474c9f){const _0x36ca5d=a39_0x187e55,{options:_0x1c8779,args:_0x409d6a,tdx:_0x23ef08}=_0x474c9f;let _0x5e4694,_0x598534;if(_0x409d6a[0x0]){const _0x614c64=_0x409d6a[0x0][_0x36ca5d(0xdb)]('.');if(_0x614c64[_0x36ca5d(0x13b)]===0x1)_0x5e4694=_0x614c64[0x0];else{if(_0x614c64[_0x36ca5d(0x13b)]===0x2)[_0x5e4694,_0x598534]=_0x614c64;else return console[_0x36ca5d(0x14f)](_0x36ca5d(0xfb)),0x1;}}try{const _0xab4382=_0x1c8779[_0x36ca5d(0x109)];if(_0x1c8779[_0x36ca5d(0xd7)]){if(_0x5e4694&&_0x598534)console['error']('Filter:\x20'+_0x5e4694+'.'+_0x598534);else _0x5e4694&&console[_0x36ca5d(0x14f)](_0x36ca5d(0xdd)+_0x5e4694);_0xab4382&&console[_0x36ca5d(0x14f)](_0x36ca5d(0x140));}const _0x4cb3cc=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x23ef08[_0x36ca5d(0x134)][_0x36ca5d(0x152)]({'projectName':_0x5e4694,'workflowName':_0x598534,'includeRetried':_0xab4382,'limit':_0x1c8779[_0x36ca5d(0xbe)]}),{'verbose':_0x1c8779[_0x36ca5d(0xd7)]}),_0x1e9bac=_0x4cb3cc[_0x36ca5d(0xee)];return console[_0x36ca5d(0x14f)](_0x36ca5d(0xe0)+_0x1e9bac[_0x36ca5d(0x13b)]+_0x36ca5d(0x10f)+(_0x1e9bac[_0x36ca5d(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x1e9bac,_0x1c8779),0x0;}catch(_0x45e796){if(_0x45e796 instanceof SDKError)return console[_0x36ca5d(0x14f)](_0x36ca5d(0xc7)+_0x45e796[_0x36ca5d(0xc8)]),_0x45e796[_0x36ca5d(0xd6)]&&console[_0x36ca5d(0x14f)](_0x36ca5d(0xd5)+_0x45e796[_0x36ca5d(0xd6)]),0x1;throw _0x45e796;}}}export class WorkflowAttemptCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0xf5);[a39_0x187e55(0xe8)]=a39_0x187e55(0x14c);async[a39_0x187e55(0xf3)](_0x13816d){const _0x64a1f=a39_0x187e55,{options:_0x4a9c0e,args:_0x325bc5,tdx:_0x480181}=_0x13816d,_0x2c24d2=_0x325bc5[0x0];if(!_0x2c24d2)return console['error'](_0x64a1f(0x119)),0x1;try{_0x4a9c0e['verbose']&&console[_0x64a1f(0x14f)](_0x64a1f(0x156)+_0x2c24d2);const _0x499ad4=await withSpinner(_0x64a1f(0xd9),()=>_0x480181[_0x64a1f(0x134)][_0x64a1f(0xf6)](_0x2c24d2),{'verbose':_0x4a9c0e['verbose']}),_0x229655=_0x499ad4[_0x64a1f(0xee)];let _0x4ae785;!_0x229655['done']?_0x4ae785=_0x229655[_0x64a1f(0xd8)]?_0x64a1f(0x136):_0x64a1f(0x12e):_0x4ae785=_0x229655[_0x64a1f(0x150)]?_0x64a1f(0x150):_0x64a1f(0x14f);let _0x3accf5;if(_0x229655[_0x64a1f(0x100)]&&_0x229655[_0x64a1f(0x11d)]){const _0x1b9e53=new Date(_0x229655['createdAt'])[_0x64a1f(0x111)](),_0x5795a2=new Date(_0x229655[_0x64a1f(0x11d)])['getTime']();_0x3accf5=Math[_0x64a1f(0x124)]((_0x5795a2-_0x1b9e53)/0x3e8);}const _0x42565c={'attempt_id':_0x229655['id'],'status':_0x4ae785,..._0x229655[_0x64a1f(0x143)]!==undefined&&{'index':_0x229655[_0x64a1f(0x143)]},..._0x229655[_0x64a1f(0x13c)]&&{'project':_0x229655[_0x64a1f(0x13c)][_0x64a1f(0x12d)]},..._0x229655[_0x64a1f(0x134)]&&{'workflow':_0x229655[_0x64a1f(0x134)]['name']},..._0x229655['sessionId']&&{'session_id':_0x229655[_0x64a1f(0xd0)]},..._0x229655[_0x64a1f(0x15d)]&&{'session_time':_0x229655['sessionTime']},..._0x229655['retryAttemptName']&&{'retry_attempt':_0x229655[_0x64a1f(0xfa)]},..._0x3accf5!==undefined&&{'duration_sec':_0x3accf5},..._0x229655[_0x64a1f(0x100)]&&{'created_at':_0x229655[_0x64a1f(0x100)]},..._0x229655[_0x64a1f(0x11d)]&&{'finished_at':_0x229655[_0x64a1f(0x11d)]},...Object['keys'](_0x229655[_0x64a1f(0xc4)])[_0x64a1f(0x13b)]>0x0&&{'params':_0x229655['params']}};return await handleSingleObjectOutput(_0x42565c,_0x4a9c0e),0x0;}catch(_0x501ec6){if(_0x501ec6 instanceof SDKError)return console['error'](_0x64a1f(0xc7)+_0x501ec6[_0x64a1f(0xc8)]),_0x501ec6[_0x64a1f(0xd6)]&&console[_0x64a1f(0x14f)](_0x64a1f(0xd5)+_0x501ec6[_0x64a1f(0xd6)]),0x1;throw _0x501ec6;}}}export class WorkflowTasksCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x132);[a39_0x187e55(0xe8)]=a39_0x187e55(0xed);async['execute'](_0x29060c){const _0x3f2507=a39_0x187e55,{options:_0x19e07f,args:_0x513fa4,tdx:_0x343850}=_0x29060c,_0x383bd0=_0x513fa4[0x0];if(!_0x383bd0)return console[_0x3f2507(0x14f)](_0x3f2507(0x119)),0x1;try{const _0x24782e=_0x19e07f[_0x3f2507(0xff)];_0x19e07f[_0x3f2507(0xd7)]&&(console['error'](_0x3f2507(0x156)+_0x383bd0),_0x24782e&&console[_0x3f2507(0x14f)](_0x3f2507(0xbd)));const _0x1f7afc=await withSpinner(_0x3f2507(0x11a),()=>_0x343850[_0x3f2507(0x134)][_0x3f2507(0xc0)](_0x383bd0,_0x24782e||![]),{'verbose':_0x19e07f[_0x3f2507(0xd7)]}),_0x40319d=_0x1f7afc[_0x3f2507(0xee)];return console['error']('✔\x20Found\x20'+_0x40319d[_0x3f2507(0x13b)]+_0x3f2507(0x15c)+(_0x40319d[_0x3f2507(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x40319d,_0x19e07f),0x0;}catch(_0x1a78d7){if(_0x1a78d7 instanceof SDKError)return console[_0x3f2507(0x14f)](_0x3f2507(0xc7)+_0x1a78d7[_0x3f2507(0xc8)]),_0x1a78d7[_0x3f2507(0xd6)]&&console[_0x3f2507(0x14f)]('\x20\x20Cause:\x20'+_0x1a78d7[_0x3f2507(0xd6)]),0x1;throw _0x1a78d7;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x187e55(0x12d)]='workflow:logs';[a39_0x187e55(0xe8)]=a39_0x187e55(0xde);async['execute'](_0x5d2e47){const _0x134b37=a39_0x187e55,{options:_0x4c2439,args:_0x21a864,tdx:_0x317db4}=_0x5d2e47,_0x445394=_0x21a864[0x0];let _0x490470=_0x21a864[0x1];if(!_0x445394)return console[_0x134b37(0x14f)](_0x134b37(0x119)),0x1;try{_0x4c2439[_0x134b37(0xd7)]&&(console[_0x134b37(0x14f)](_0x134b37(0x156)+_0x445394),_0x490470&&console[_0x134b37(0x14f)](_0x134b37(0xe7)+_0x490470));const _0x4b2f75=await withSpinner(_0x134b37(0xc5),()=>_0x317db4[_0x134b37(0x134)][_0x134b37(0xfd)](_0x445394,_0x490470),{'verbose':_0x4c2439[_0x134b37(0xd7)]}),_0x5df1a3=_0x4b2f75[_0x134b37(0xee)];if(_0x5df1a3[_0x134b37(0x13b)]===0x0)return console['error'](_0x134b37(0xd4)),0x0;if(!_0x490470&&(_0x4c2439[_0x134b37(0xe5)]||_0x4c2439[_0x134b37(0xe3)]))return await handleSDKOutput(_0x5df1a3,_0x4c2439),0x0;if(!_0x490470){const _0x19c3a2=_0x5df1a3[_0x134b37(0x128)](_0x3e1150=>({'title':_0x3e1150[_0x134b37(0xf1)]+'\x20('+formatBytes(_0x3e1150[_0x134b37(0x133)])+')','value':_0x3e1150[_0x134b37(0xf1)]})),_0x321064=await a39_0x22973d({'type':_0x134b37(0xdf),'name':'task','message':_0x134b37(0x107),'choices':_0x19c3a2});if(!_0x321064[_0x134b37(0x15b)])return console['error'](_0x134b37(0x15a)),0x0;_0x490470=_0x321064['task'];}const _0x13dd98=await withSpinner('Downloading\x20logs...',()=>_0x317db4[_0x134b37(0x134)][_0x134b37(0x160)](_0x445394,_0x490470),{'verbose':_0x4c2439[_0x134b37(0xd7)]}),_0x599b56=_0x13dd98[_0x134b37(0xee)];return _0x599b56?console['log'](_0x599b56):console[_0x134b37(0x14f)](_0x134b37(0x159)),0x0;}catch(_0x433126){if(_0x433126 instanceof SDKError)return console[_0x134b37(0x14f)]('Error:\x20'+_0x433126[_0x134b37(0xc8)]),_0x433126['cause']&&console[_0x134b37(0x14f)](_0x134b37(0xd5)+_0x433126['cause']),0x1;throw _0x433126;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a39_0x187e55(0xbf);[a39_0x187e55(0xe8)]='Kill\x20a\x20running\x20attempt';async[a39_0x187e55(0xf3)](_0x406392){const _0x16ef41=a39_0x187e55,{options:_0x3c5ee5,args:_0x48987c,tdx:_0x151bf7}=_0x406392,_0x1e1513=_0x48987c[0x0];if(!_0x1e1513)return console['error'](_0x16ef41(0x119)),0x1;try{const _0x47a58e=_0x3c5ee5[_0x16ef41(0x151)];_0x3c5ee5[_0x16ef41(0xd7)]&&(console['error']('Attempt\x20ID:\x20'+_0x1e1513),_0x47a58e&&console[_0x16ef41(0x14f)](_0x16ef41(0x12f)+_0x47a58e));if(!_0x3c5ee5['yes']){const _0x392cf4=await confirm(_0x16ef41(0xfe)+_0x1e1513+'?');if(!_0x392cf4)return console['error'](_0x16ef41(0x15a)),0x0;}const _0x3d4d97=await withSpinner('Killing\x20attempt...',()=>_0x151bf7[_0x16ef41(0x134)]['kill'](_0x1e1513,_0x47a58e),{'verbose':_0x3c5ee5['verbose']}),_0x2773b3=_0x3d4d97[_0x16ef41(0xee)];return console[_0x16ef41(0x14f)]('✔\x20'+_0x2773b3),0x0;}catch(_0x3ffff5){if(_0x3ffff5 instanceof SDKError)return console['error'](_0x16ef41(0xc7)+_0x3ffff5['message']),_0x3ffff5[_0x16ef41(0xd6)]&&console['error'](_0x16ef41(0xd5)+_0x3ffff5[_0x16ef41(0xd6)]),0x1;throw _0x3ffff5;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a39_0x187e55(0xd3);['description']=a39_0x187e55(0x129);async[a39_0x187e55(0xf3)](_0x2a464c){const _0x4db2d4=a39_0x187e55,{options:_0x467178,args:_0x2952d8,tdx:_0x27fd96}=_0x2a464c,_0x136367=_0x2952d8[0x0];if(!_0x136367)return console[_0x4db2d4(0x14f)](_0x4db2d4(0x14e)),console[_0x4db2d4(0x14f)](_0x4db2d4(0xe1)),0x1;let _0x466146=![],_0x1c6d25=_0x136367;if(_0x136367[_0x4db2d4(0x10d)](_0x4db2d4(0x130)))_0x466146=!![],_0x1c6d25=_0x136367[_0x4db2d4(0x10e)](0x8);else{if(_0x136367[_0x4db2d4(0x10d)](_0x4db2d4(0xe6)))_0x466146=![],_0x1c6d25=_0x136367[_0x4db2d4(0x10e)](0x8);else return console['error'](_0x4db2d4(0x122)),console[_0x4db2d4(0x14f)](_0x4db2d4(0xe1)),0x1;}try{const _0x52f276=_0x467178['fromTask'],_0x34d998=_0x467178['resumeFrom'],_0x4cd686=_0x467178[_0x4db2d4(0xc4)],_0x2b6995=_0x467178[_0x4db2d4(0x15e)];_0x467178['verbose']&&(console[_0x4db2d4(0x14f)](_0x4db2d4(0x14d)+(_0x466146?_0x4db2d4(0xf7):_0x4db2d4(0xf6))+'\x20'+_0x1c6d25),_0x52f276&&console[_0x4db2d4(0x14f)]('From\x20task:\x20'+_0x52f276),_0x34d998&&console[_0x4db2d4(0x14f)](_0x4db2d4(0x120)+_0x34d998),_0x4cd686&&console[_0x4db2d4(0x14f)](_0x4db2d4(0xe4)+_0x4cd686),_0x2b6995&&console[_0x4db2d4(0x14f)](_0x4db2d4(0x141)));let _0x3b45a2;if(_0x4cd686)try{if(_0x4cd686[_0x4db2d4(0x10d)]('@')){const _0x23e4bc=await import(_0x4db2d4(0xe2)),_0x2d6bff=_0x4cd686['substring'](0x1),_0x46927a=await _0x23e4bc[_0x4db2d4(0x13a)](_0x2d6bff,_0x4db2d4(0xe9));_0x3b45a2=JSON['parse'](_0x46927a);}else _0x3b45a2=JSON['parse'](_0x4cd686);}catch{return console['error']('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x467178[_0x4db2d4(0xcc)]){const _0x59e01f=await confirm(_0x4db2d4(0x114)+(_0x466146?_0x4db2d4(0xf7):'attempt')+'\x20'+_0x1c6d25+'?');if(!_0x59e01f)return console[_0x4db2d4(0x14f)](_0x4db2d4(0x15a)),0x0;}let _0x7a214c;_0x466146?_0x7a214c=await withSpinner(_0x4db2d4(0xc9),()=>_0x27fd96['workflow'][_0x4db2d4(0x116)](_0x1c6d25,{'fromTask':_0x52f276,'retryParams':_0x3b45a2}),{'verbose':_0x467178[_0x4db2d4(0xd7)]}):_0x7a214c=await withSpinner(_0x4db2d4(0x103),()=>_0x27fd96['workflow']['retryAttempt'](_0x1c6d25,{'resumeFrom':_0x34d998,'retryParams':_0x3b45a2,'force':_0x2b6995}),{'verbose':_0x467178[_0x4db2d4(0xd7)]});const _0x3b2a84=_0x7a214c[_0x4db2d4(0xee)];return console[_0x4db2d4(0x14f)](_0x4db2d4(0x14a)),console[_0x4db2d4(0x14f)](_0x4db2d4(0x12a)+_0x3b2a84[_0x4db2d4(0xc3)]),console[_0x4db2d4(0x14f)](_0x4db2d4(0x108)+_0x3b2a84[_0x4db2d4(0xd0)]),0x0;}catch(_0x54b5f2){if(_0x54b5f2 instanceof SDKError)return console[_0x4db2d4(0x14f)]('Error:\x20'+_0x54b5f2[_0x4db2d4(0xc8)]),_0x54b5f2[_0x4db2d4(0xd6)]&&console['error'](_0x4db2d4(0xd5)+_0x54b5f2[_0x4db2d4(0xd6)]),0x1;throw _0x54b5f2;}}}export class WorkflowRunCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x102);['description']=a39_0x187e55(0x113);async[a39_0x187e55(0xf3)](_0x3fb345){const _0x4f488d=a39_0x187e55,{options:_0x28c96d,args:_0x160bb3,tdx:_0xa03f42}=_0x3fb345,_0x1fd2e1=_0x160bb3[0x0];if(!_0x1fd2e1)return console[_0x4f488d(0x14f)]('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x4f488d(0x14f)](_0x4f488d(0xc1)),0x1;const _0x5b9d11=_0x28c96d[_0x4f488d(0x105)],_0x507d51=_0x28c96d[_0x4f488d(0x15d)],_0xa0ef8e={};if(_0x5b9d11&&Array[_0x4f488d(0xcd)](_0x5b9d11))for(const _0x434480 of _0x5b9d11){const _0x3ea520=_0x434480['indexOf']('=');if(_0x3ea520===-0x1)return console[_0x4f488d(0x14f)](_0x4f488d(0x144)+_0x434480),console[_0x4f488d(0x14f)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x1ddebe=_0x434480['substring'](0x0,_0x3ea520),_0x46d894=_0x434480[_0x4f488d(0x10e)](_0x3ea520+0x1);try{_0xa0ef8e[_0x1ddebe]=JSON[_0x4f488d(0x145)](_0x46d894);}catch{_0xa0ef8e[_0x1ddebe]=_0x46d894;}}_0x28c96d[_0x4f488d(0xd7)]&&(console['error'](_0x4f488d(0xeb)+_0x1fd2e1),Object[_0x4f488d(0x147)](_0xa0ef8e)[_0x4f488d(0x13b)]>0x0&&console[_0x4f488d(0x14f)](_0x4f488d(0xb8)+JSON[_0x4f488d(0xea)](_0xa0ef8e)),_0x507d51&&console[_0x4f488d(0x14f)](_0x4f488d(0xb7)+_0x507d51));const _0x2fb095=await withSpinner(_0x4f488d(0x11f),()=>_0xa03f42[_0x4f488d(0x134)][_0x4f488d(0xfc)](_0x1fd2e1,_0xa0ef8e,{'sessionTime':_0x507d51}),{'verbose':_0x28c96d[_0x4f488d(0xd7)]}),_0x59cf2c=_0x2fb095['data'];return console[_0x4f488d(0x14f)](_0x4f488d(0xf0)),console[_0x4f488d(0x14f)](_0x4f488d(0xec)+_0x59cf2c['id']),console[_0x4f488d(0x14f)]('\x20\x20Session\x20ID:\x20'+_0x59cf2c[_0x4f488d(0xd0)]),console[_0x4f488d(0x14f)](_0x4f488d(0x121)+_0x59cf2c[_0x4f488d(0x13c)]?.['name']),console[_0x4f488d(0x14f)](_0x4f488d(0x142)+_0x59cf2c[_0x4f488d(0x134)]?.[_0x4f488d(0x12d)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a39_0x187e55(0xf9);[a39_0x187e55(0xe8)]=a39_0x187e55(0xba);async[a39_0x187e55(0xf3)](_0x2acac8){const _0x14e607=a39_0x187e55,{options:_0x3b534f,args:_0x38a01d,tdx:_0x37f602}=_0x2acac8,_0xe5e907=_0x38a01d[0x0],_0x8222e6=_0x38a01d[0x1]||'.';if(!_0xe5e907)return console[_0x14e607(0x14f)](_0x14e607(0x157)),console[_0x14e607(0x14f)](_0x14e607(0x126)),0x1;const _0x4a30f5=_0x3b534f[_0x14e607(0x10a)];_0x3b534f[_0x14e607(0xd7)]&&(console['error'](_0x14e607(0x149)+_0xe5e907),console[_0x14e607(0x14f)](_0x14e607(0xb9)+_0x8222e6),_0x4a30f5&&console[_0x14e607(0x14f)]('Revision:\x20'+_0x4a30f5));const _0x3b0223=await withSpinner(_0x14e607(0x146)+_0xe5e907+'...',()=>_0x37f602[_0x14e607(0x134)][_0x14e607(0xbc)](_0xe5e907,_0x8222e6,{'revision':_0x4a30f5}),{'verbose':_0x3b534f[_0x14e607(0xd7)]}),_0x3e298e=_0x3b0223[_0x14e607(0xee)];return console[_0x14e607(0x14f)](_0x14e607(0x115)+_0x3e298e[_0x14e607(0x123)]),console[_0x14e607(0x14f)](_0x14e607(0x138)+_0x3e298e['revision']),console[_0x14e607(0x14f)]('\x20\x20Files\x20extracted:\x20'+_0x3e298e[_0x14e607(0xf4)]),console[_0x14e607(0x14f)](_0x14e607(0x117)+_0x8222e6+'/'+_0x3e298e[_0x14e607(0x123)]),0x0;}}function a39_0x88b5(_0x39b9e5,_0x30009f){const _0x304c38=a39_0x304c();return a39_0x88b5=function(_0x88b50e,_0x175186){_0x88b50e=_0x88b50e-0xb6;let _0xdfe212=_0x304c38[_0x88b50e];return _0xdfe212;},a39_0x88b5(_0x39b9e5,_0x30009f);}export class WorkflowPushCommand extends BaseCommand{['name']=a39_0x187e55(0xb6);[a39_0x187e55(0xe8)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async['execute'](_0x42bdb3){const _0x2f2dcf=a39_0x187e55,{options:_0x2803fe,args:_0x5806eb,tdx:_0x48347b}=_0x42bdb3;let _0x376f20='.',_0xb3256c=_0x2803fe[_0x2f2dcf(0x12d)];if(_0x5806eb[0x0]){const {promises:_0x135f01}=await import('fs');try{const _0x3d702e=await _0x135f01[_0x2f2dcf(0x155)](_0x5806eb[0x0]);if(_0x3d702e[_0x2f2dcf(0x125)]())_0x376f20=_0x5806eb[0x0];else return console[_0x2f2dcf(0x14f)](_0x2f2dcf(0xc7)+_0x5806eb[0x0]+_0x2f2dcf(0xc6)),0x1;}catch{_0xb3256c=_0x5806eb[0x0],_0x376f20='.';}}const _0x255e42=_0x2803fe[_0x2f2dcf(0x10a)],_0xde8c=_0x2803fe[_0x2f2dcf(0x131)];_0x2803fe[_0x2f2dcf(0xd7)]&&(console[_0x2f2dcf(0x14f)]('Project\x20directory:\x20'+_0x376f20),_0xb3256c&&console[_0x2f2dcf(0x14f)](_0x2f2dcf(0xda)+_0xb3256c),_0x255e42&&console[_0x2f2dcf(0x14f)](_0x2f2dcf(0x148)+_0x255e42),_0xde8c&&console['error'](_0x2f2dcf(0xc2)));const _0x54b48d=await withSpinner(_0x2f2dcf(0x14b),()=>_0x48347b[_0x2f2dcf(0x134)][_0x2f2dcf(0xcb)](_0x376f20,{'projectName':_0xb3256c,'revision':_0x255e42,'skipValidation':_0xde8c}),{'verbose':_0x2803fe[_0x2f2dcf(0xd7)]}),_0x140c7f=_0x54b48d[_0x2f2dcf(0xee)];return console['error'](_0x2f2dcf(0x104)+_0x140c7f[_0x2f2dcf(0x123)]),console[_0x2f2dcf(0x14f)](_0x2f2dcf(0x11e)+_0x140c7f[_0x2f2dcf(0x139)]),console[_0x2f2dcf(0x14f)](_0x2f2dcf(0x138)+_0x140c7f['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x13d);[a39_0x187e55(0xe8)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a39_0x187e55(0xf3)](_0x4979e4){const _0x18b525=a39_0x187e55,{options:_0x32eaba,args:_0x4d65bb,tdx:_0x4c70bd}=_0x4979e4,_0x47cf40=_0x4d65bb[0x0];if(!_0x47cf40)return console['error']('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x18b525(0xbb)),0x1;_0x32eaba[_0x18b525(0xd7)]&&console['error'](_0x18b525(0x149)+_0x47cf40);if(!_0x32eaba[_0x18b525(0xcc)]){const _0x713b56=await confirm(_0x18b525(0xf8)+_0x47cf40+_0x18b525(0x10b));if(!_0x713b56)return console['error'](_0x18b525(0x15a)),0x0;}const _0x3e1698=await withSpinner(_0x18b525(0x13e)+_0x47cf40+'...',()=>_0x4c70bd[_0x18b525(0x134)][_0x18b525(0x135)](_0x47cf40),{'verbose':_0x32eaba[_0x18b525(0xd7)]}),_0x26853d=_0x3e1698[_0x18b525(0xee)];return console['error'](_0x18b525(0xd1)+_0x26853d['projectName']),console[_0x18b525(0x14f)]('\x20\x20Project\x20ID:\x20'+_0x26853d[_0x18b525(0x139)]),0x0;}}
|
|
1
|
+
const a39_0x495444=a39_0x19fb;function a39_0x1e3f(){const _0x1f127a=['List\x20workflows','done','cause','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','delete','isDirectory','Retry\x20a\x20session\x20or\x20attempt','Resume\x20from:\x20','workflow:retry','Error:\x20Attempt\x20ID\x20is\x20required','6810Pntacd','Project\x20filter:\x20','Error:\x20','\x20\x20Attempt\x20ID:\x20','\x20\x20Location:\x20','session:','fileSize','from','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Show\x20specific\x20attempt\x20details','\x20\x20Project\x20ID:\x20','\x22?\x20This\x20cannot\x20be\x20undone.','success','error','keys','Status:\x20','tasks','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20\x20Cause:\x20','includeSubtasks','Project\x20directory:\x20','Select\x20a\x20task\x20to\x20view\x20logs:','12035647FqQjgF','295FwGXxC','\x20attempt','split','workflow','format','attemptId','12FMINEs','\x20\x20Project:\x20','param','force','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','workflow:push','fs/promises','Starting\x20workflow\x20run...','Revision:\x20','logFiles','✔\x20Found\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Validation:\x20skipped','320698sRNamn','\x20session','select','limit','stat','round','status','length','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Listing\x20workflows...','3022632MPdWak','1870wSYoBU','From\x20task:\x20','workflow:attempt','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','...','params','Listing\x20workflow\x20attempts...','Retrying\x20attempt...','Fetching\x20log\x20files...','Start\x20a\x20workflow\x20run','\x20\x20Revision:\x20','data','\x20\x20Files\x20extracted:\x20','Params:\x20','projects','List\x20workflow\x20attempts','List\x20all\x20workflow\x20projects','workflow:run','createdAt','session','Parameters:\x20','attempt','canceling','yes','✔\x20Deleted\x20project\x20','indexOf','download','sessionTime','execute','finishedAt','Reason:\x20','No\x20log\x20content\x20found','Target:\x20','Filter:\x20','6960384PlrFEf','\x20is\x20not\x20a\x20directory','filesExtracted','workflow:logs','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Downloading\x20logs...','retryAttemptName','description','index','Force:\x20yes','Workflow:\x20','Pattern:\x20','Getting\x20attempt\x20tasks...','18AKGUNT','\x20task','Killing\x20attempt...','Including\x20subtasks:\x20yes','List\x20workflow\x20execution\x20sessions','Kill\x20a\x20running\x20attempt','verbose','Filter:\x20project=','✔\x20Pushed\x20','\x20workflow','Downloading\x20project\x20','\x20\x20Session\x20ID:\x20','Cancelled','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','attempt:','Show\x20tasks\x20for\x20an\x20attempt','attempts','workflow:kill','isArray','workflow:download','Usage:\x20workflow:delete\x20<project-name-or-id>','kill','taskName','projectName','Pushing\x20workflow\x20project...','✔\x20Retry\x20started','push','getTime','Task\x20name:\x20','14YCvFrJ','Project:\x20','task','5870XBFGqI','2SXwWKT','Error:\x20Invalid\x20parameter\x20format:\x20','workflow:attempts','startsWith','includeRetried','substring','Attempt\x20ID:\x20','Output\x20directory:\x20','sessionId','157900UwfcSX','name','logs','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','sessions','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','revision','message','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','project','retryAttempt','Deleting\x20project\x20','workflow:projects','cancelRequested','json','retrySession','map','workflow:sessions','\x20\x20Workflow:\x20','Include\x20retried:\x20yes','parse','\x20\x20New\x20attempt\x20ID:\x20','skipValidation','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'];a39_0x1e3f=function(){return _0x1f127a;};return a39_0x1e3f();}(function(_0x55893f,_0x15f270){const _0x44af56=a39_0x19fb,_0x19989a=_0x55893f();while(!![]){try{const _0x2ced2f=-parseInt(_0x44af56(0x1a4))/0x1*(-parseInt(_0x44af56(0x14f))/0x2)+-parseInt(_0x44af56(0x12e))/0x3*(parseInt(_0x44af56(0x158))/0x4)+-parseInt(_0x44af56(0x191))/0x5*(parseInt(_0x44af56(0x17a))/0x6)+parseInt(_0x44af56(0x14b))/0x7*(parseInt(_0x44af56(0x1ae))/0x8)+parseInt(_0x44af56(0x121))/0x9+parseInt(_0x44af56(0x14e))/0xa*(parseInt(_0x44af56(0x1af))/0xb)+parseInt(_0x44af56(0x197))/0xc*(-parseInt(_0x44af56(0x190))/0xd);if(_0x2ced2f===_0x15f270)break;else _0x19989a['push'](_0x19989a['shift']());}catch(_0x2e8032){_0x19989a['push'](_0x19989a['shift']());}}}(a39_0x1e3f,0xafc10));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';function a39_0x19fb(_0x2130b4,_0x2f832){const _0x1e3ff1=a39_0x1e3f();return a39_0x19fb=function(_0x19fb4d,_0x964387){_0x19fb4d=_0x19fb4d-0x106;let _0x28c373=_0x1e3ff1[_0x19fb4d];return _0x28c373;},a39_0x19fb(_0x2130b4,_0x2f832);}import a39_0x48f917 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']=a39_0x495444(0x164);[a39_0x495444(0x128)]=a39_0x495444(0x10f);async[a39_0x495444(0x11b)](_0x4334d3){const _0x2ae912=a39_0x495444,{options:_0xa627ae,args:_0x5df83e,tdx:_0x2a07b9}=_0x4334d3,_0x4f3b6e=_0x5df83e[0x0];try{_0xa627ae[_0x2ae912(0x134)]&&_0x4f3b6e&&console[_0x2ae912(0x187)](_0x2ae912(0x12c)+_0x4f3b6e);const _0xc4e210=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x2a07b9[_0x2ae912(0x194)][_0x2ae912(0x10d)](_0x4f3b6e,{'limit':_0xa627ae[_0x2ae912(0x1a7)]}),{'verbose':_0xa627ae[_0x2ae912(0x134)]}),_0x2cb39a=_0xc4e210[_0x2ae912(0x10a)];return console[_0x2ae912(0x187)](_0x2ae912(0x1a1)+_0x2cb39a['length']+'\x20project'+(_0x2cb39a['length']!==0x1?'s':'')),await handleSDKOutput(_0x2cb39a,_0xa627ae),0x0;}catch(_0x5a9846){if(_0x5a9846 instanceof SDKError)return console[_0x2ae912(0x187)](_0x2ae912(0x17c)+_0x5a9846[_0x2ae912(0x15f)]),_0x5a9846['cause']&&console[_0x2ae912(0x187)](_0x2ae912(0x18c)+_0x5a9846[_0x2ae912(0x172)]),0x1;throw _0x5a9846;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']='workflow:workflows';[a39_0x495444(0x128)]=a39_0x495444(0x170);async[a39_0x495444(0x11b)](_0x570fb0){const _0x36eb8a=a39_0x495444,{options:_0x411b2f,args:_0x14be65,tdx:_0x21dd43}=_0x570fb0,_0x16e23e=_0x14be65[0x0];try{_0x411b2f[_0x36eb8a(0x134)]&&_0x16e23e&&console[_0x36eb8a(0x187)](_0x36eb8a(0x17b)+_0x16e23e);const _0x312c1a=await withSpinner(_0x36eb8a(0x1ad),()=>_0x21dd43['workflow']['workflows'](_0x16e23e,{'limit':_0x411b2f[_0x36eb8a(0x1a7)]}),{'verbose':_0x411b2f[_0x36eb8a(0x134)]}),_0x466f66=_0x312c1a[_0x36eb8a(0x10a)];return console[_0x36eb8a(0x187)](_0x36eb8a(0x1a1)+_0x466f66[_0x36eb8a(0x1ab)]+_0x36eb8a(0x137)+(_0x466f66[_0x36eb8a(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0x466f66,_0x411b2f),0x0;}catch(_0x488026){if(_0x488026 instanceof SDKError)return console['error'](_0x36eb8a(0x17c)+_0x488026['message']),_0x488026['cause']&&console[_0x36eb8a(0x187)](_0x36eb8a(0x18c)+_0x488026[_0x36eb8a(0x172)]),0x1;throw _0x488026;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a39_0x495444(0x169);[a39_0x495444(0x128)]=a39_0x495444(0x132);async['execute'](_0x3abce5){const _0x53cb17=a39_0x495444,{options:_0x4856e2,args:_0x224ddb,tdx:_0x48e1ce}=_0x3abce5;let _0xae9683,_0x16c0dd;if(_0x224ddb[0x0]){const _0x586a15=_0x224ddb[0x0]['split']('.');if(_0x586a15[_0x53cb17(0x1ab)]===0x1)_0xae9683=_0x586a15[0x0];else{if(_0x586a15['length']===0x2)[_0xae9683,_0x16c0dd]=_0x586a15;else return console[_0x53cb17(0x187)](_0x53cb17(0x19b)),0x1;}}try{if(_0x4856e2[_0x53cb17(0x134)]){if(_0xae9683&&_0x16c0dd)console[_0x53cb17(0x187)](_0x53cb17(0x120)+_0xae9683+'.'+_0x16c0dd);else _0xae9683&&console[_0x53cb17(0x187)](_0x53cb17(0x135)+_0xae9683);const _0x473008=_0x4856e2['status'];_0x473008&&console[_0x53cb17(0x187)](_0x53cb17(0x189)+_0x473008);}const _0x2ca966=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x48e1ce['workflow'][_0x53cb17(0x15c)]({'projectName':_0xae9683,'workflowName':_0x16c0dd,'status':_0x4856e2[_0x53cb17(0x1aa)],'fromTime':_0x4856e2[_0x53cb17(0x181)],'toTime':_0x4856e2['to'],'limit':_0x4856e2['limit']}),{'verbose':_0x4856e2['verbose']}),_0x20db0b=_0x2ca966[_0x53cb17(0x10a)];return console[_0x53cb17(0x187)](_0x53cb17(0x1a1)+_0x20db0b[_0x53cb17(0x1ab)]+_0x53cb17(0x1a5)+(_0x20db0b[_0x53cb17(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0x20db0b,_0x4856e2),0x0;}catch(_0x514111){if(_0x514111 instanceof SDKError)return console[_0x53cb17(0x187)](_0x53cb17(0x17c)+_0x514111['message']),_0x514111['cause']&&console[_0x53cb17(0x187)](_0x53cb17(0x18c)+_0x514111[_0x53cb17(0x172)]),0x1;throw _0x514111;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a39_0x495444(0x151);['description']=a39_0x495444(0x10e);async[a39_0x495444(0x11b)](_0xaaa802){const _0x5a2fa1=a39_0x495444,{options:_0x3bc8be,args:_0x4d2d8c,tdx:_0xc9ee8}=_0xaaa802;let _0x2d58d0,_0x705b3e;if(_0x4d2d8c[0x0]){const _0x5e9322=_0x4d2d8c[0x0][_0x5a2fa1(0x193)]('.');if(_0x5e9322[_0x5a2fa1(0x1ab)]===0x1)_0x2d58d0=_0x5e9322[0x0];else{if(_0x5e9322['length']===0x2)[_0x2d58d0,_0x705b3e]=_0x5e9322;else return console['error'](_0x5a2fa1(0x19b)),0x1;}}try{const _0x39213=_0x3bc8be[_0x5a2fa1(0x153)];if(_0x3bc8be['verbose']){if(_0x2d58d0&&_0x705b3e)console[_0x5a2fa1(0x187)](_0x5a2fa1(0x120)+_0x2d58d0+'.'+_0x705b3e);else _0x2d58d0&&console[_0x5a2fa1(0x187)](_0x5a2fa1(0x135)+_0x2d58d0);_0x39213&&console['error'](_0x5a2fa1(0x16b));}const _0x3f86b9=await withSpinner(_0x5a2fa1(0x1b5),()=>_0xc9ee8[_0x5a2fa1(0x194)][_0x5a2fa1(0x13e)]({'projectName':_0x2d58d0,'workflowName':_0x705b3e,'includeRetried':_0x39213,'limit':_0x3bc8be[_0x5a2fa1(0x1a7)]}),{'verbose':_0x3bc8be[_0x5a2fa1(0x134)]}),_0xa9155=_0x3f86b9[_0x5a2fa1(0x10a)];return console[_0x5a2fa1(0x187)]('✔\x20Found\x20'+_0xa9155[_0x5a2fa1(0x1ab)]+_0x5a2fa1(0x192)+(_0xa9155[_0x5a2fa1(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0xa9155,_0x3bc8be),0x0;}catch(_0x3e138e){if(_0x3e138e instanceof SDKError)return console[_0x5a2fa1(0x187)](_0x5a2fa1(0x17c)+_0x3e138e[_0x5a2fa1(0x15f)]),_0x3e138e[_0x5a2fa1(0x172)]&&console[_0x5a2fa1(0x187)](_0x5a2fa1(0x18c)+_0x3e138e[_0x5a2fa1(0x172)]),0x1;throw _0x3e138e;}}}export class WorkflowAttemptCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x1b1);[a39_0x495444(0x128)]=a39_0x495444(0x183);async[a39_0x495444(0x11b)](_0x247a79){const _0x3de7d4=a39_0x495444,{options:_0x42042d,args:_0x4b81c1,tdx:_0x51c19e}=_0x247a79,_0x3c9064=_0x4b81c1[0x0];if(!_0x3c9064)return console[_0x3de7d4(0x187)](_0x3de7d4(0x179)),0x1;try{_0x42042d[_0x3de7d4(0x134)]&&console[_0x3de7d4(0x187)]('Attempt\x20ID:\x20'+_0x3c9064);const _0x557778=await withSpinner('Getting\x20attempt\x20details...',()=>_0x51c19e['workflow'][_0x3de7d4(0x114)](_0x3c9064),{'verbose':_0x42042d[_0x3de7d4(0x134)]}),_0x4b6497=_0x557778['data'];let _0x30d747;!_0x4b6497[_0x3de7d4(0x171)]?_0x30d747=_0x4b6497[_0x3de7d4(0x165)]?_0x3de7d4(0x115):'running':_0x30d747=_0x4b6497[_0x3de7d4(0x186)]?_0x3de7d4(0x186):_0x3de7d4(0x187);let _0xeda6e6;if(_0x4b6497['createdAt']&&_0x4b6497['finishedAt']){const _0x4f15de=new Date(_0x4b6497[_0x3de7d4(0x111)])['getTime'](),_0x3eb38c=new Date(_0x4b6497[_0x3de7d4(0x11c)])[_0x3de7d4(0x149)]();_0xeda6e6=Math[_0x3de7d4(0x1a9)]((_0x3eb38c-_0x4f15de)/0x3e8);}const _0x2e5eff={'attempt_id':_0x4b6497['id'],'status':_0x30d747,..._0x4b6497[_0x3de7d4(0x129)]!==undefined&&{'index':_0x4b6497[_0x3de7d4(0x129)]},..._0x4b6497[_0x3de7d4(0x161)]&&{'project':_0x4b6497['project'][_0x3de7d4(0x159)]},..._0x4b6497[_0x3de7d4(0x194)]&&{'workflow':_0x4b6497[_0x3de7d4(0x194)][_0x3de7d4(0x159)]},..._0x4b6497['sessionId']&&{'session_id':_0x4b6497[_0x3de7d4(0x157)]},..._0x4b6497[_0x3de7d4(0x11a)]&&{'session_time':_0x4b6497[_0x3de7d4(0x11a)]},..._0x4b6497[_0x3de7d4(0x127)]&&{'retry_attempt':_0x4b6497[_0x3de7d4(0x127)]},..._0xeda6e6!==undefined&&{'duration_sec':_0xeda6e6},..._0x4b6497['createdAt']&&{'created_at':_0x4b6497['createdAt']},..._0x4b6497[_0x3de7d4(0x11c)]&&{'finished_at':_0x4b6497[_0x3de7d4(0x11c)]},...Object['keys'](_0x4b6497[_0x3de7d4(0x1b4)])[_0x3de7d4(0x1ab)]>0x0&&{'params':_0x4b6497[_0x3de7d4(0x1b4)]}};return await handleSingleObjectOutput(_0x2e5eff,_0x42042d),0x0;}catch(_0x30ef18){if(_0x30ef18 instanceof SDKError)return console[_0x3de7d4(0x187)]('Error:\x20'+_0x30ef18[_0x3de7d4(0x15f)]),_0x30ef18[_0x3de7d4(0x172)]&&console[_0x3de7d4(0x187)](_0x3de7d4(0x18c)+_0x30ef18[_0x3de7d4(0x172)]),0x1;throw _0x30ef18;}}}export class WorkflowTasksCommand extends BaseCommand{['name']='workflow:tasks';[a39_0x495444(0x128)]=a39_0x495444(0x13d);async[a39_0x495444(0x11b)](_0x373ca2){const _0x40091d=a39_0x495444,{options:_0x38a65c,args:_0x514865,tdx:_0x571867}=_0x373ca2,_0x25c613=_0x514865[0x0];if(!_0x25c613)return console['error'](_0x40091d(0x179)),0x1;try{const _0x313cd5=_0x38a65c[_0x40091d(0x18d)];_0x38a65c[_0x40091d(0x134)]&&(console[_0x40091d(0x187)](_0x40091d(0x155)+_0x25c613),_0x313cd5&&console['error'](_0x40091d(0x131)));const _0x3da60a=await withSpinner(_0x40091d(0x12d),()=>_0x571867[_0x40091d(0x194)][_0x40091d(0x18a)](_0x25c613,_0x313cd5||![]),{'verbose':_0x38a65c[_0x40091d(0x134)]}),_0x4660a6=_0x3da60a[_0x40091d(0x10a)];return console[_0x40091d(0x187)]('✔\x20Found\x20'+_0x4660a6[_0x40091d(0x1ab)]+_0x40091d(0x12f)+(_0x4660a6[_0x40091d(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0x4660a6,_0x38a65c),0x0;}catch(_0x169586){if(_0x169586 instanceof SDKError)return console[_0x40091d(0x187)](_0x40091d(0x17c)+_0x169586['message']),_0x169586[_0x40091d(0x172)]&&console[_0x40091d(0x187)]('\x20\x20Cause:\x20'+_0x169586[_0x40091d(0x172)]),0x1;throw _0x169586;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x124);[a39_0x495444(0x128)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a39_0x495444(0x11b)](_0x536d79){const _0x1b1692=a39_0x495444,{options:_0x30d966,args:_0xa256ae,tdx:_0x4dcb5b}=_0x536d79,_0x5a620d=_0xa256ae[0x0];let _0x1d5405=_0xa256ae[0x1];if(!_0x5a620d)return console[_0x1b1692(0x187)](_0x1b1692(0x179)),0x1;try{_0x30d966[_0x1b1692(0x134)]&&(console[_0x1b1692(0x187)](_0x1b1692(0x155)+_0x5a620d),_0x1d5405&&console[_0x1b1692(0x187)](_0x1b1692(0x14a)+_0x1d5405));const _0x5605ec=await withSpinner(_0x1b1692(0x107),()=>_0x4dcb5b['workflow'][_0x1b1692(0x1a0)](_0x5a620d,_0x1d5405),{'verbose':_0x30d966[_0x1b1692(0x134)]}),_0x19e187=_0x5605ec['data'];if(_0x19e187[_0x1b1692(0x1ab)]===0x0)return console[_0x1b1692(0x187)](_0x1b1692(0x125)),0x0;if(!_0x1d5405&&(_0x30d966[_0x1b1692(0x166)]||_0x30d966[_0x1b1692(0x195)]))return await handleSDKOutput(_0x19e187,_0x30d966),0x0;if(!_0x1d5405){const _0x1d81c3=_0x19e187[_0x1b1692(0x168)](_0x2ca0c8=>({'title':_0x2ca0c8[_0x1b1692(0x144)]+'\x20('+formatBytes(_0x2ca0c8[_0x1b1692(0x180)])+')','value':_0x2ca0c8[_0x1b1692(0x144)]})),_0x369248=await a39_0x48f917({'type':_0x1b1692(0x1a6),'name':_0x1b1692(0x14d),'message':_0x1b1692(0x18f),'choices':_0x1d81c3});if(!_0x369248['task'])return console[_0x1b1692(0x187)](_0x1b1692(0x13a)),0x0;_0x1d5405=_0x369248[_0x1b1692(0x14d)];}const _0x3d3bef=await withSpinner(_0x1b1692(0x126),()=>_0x4dcb5b[_0x1b1692(0x194)][_0x1b1692(0x15a)](_0x5a620d,_0x1d5405),{'verbose':_0x30d966[_0x1b1692(0x134)]}),_0x3a34cc=_0x3d3bef[_0x1b1692(0x10a)];return _0x3a34cc?console['log'](_0x3a34cc):console['error'](_0x1b1692(0x11e)),0x0;}catch(_0x34220b){if(_0x34220b instanceof SDKError)return console[_0x1b1692(0x187)](_0x1b1692(0x17c)+_0x34220b['message']),_0x34220b[_0x1b1692(0x172)]&&console['error'](_0x1b1692(0x18c)+_0x34220b[_0x1b1692(0x172)]),0x1;throw _0x34220b;}}}export class WorkflowKillCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x13f);['description']=a39_0x495444(0x133);async[a39_0x495444(0x11b)](_0x5efa1e){const _0x532bc7=a39_0x495444,{options:_0xb956fc,args:_0x350b50,tdx:_0x2f457e}=_0x5efa1e,_0x4814c9=_0x350b50[0x0];if(!_0x4814c9)return console[_0x532bc7(0x187)](_0x532bc7(0x179)),0x1;try{const _0x196a7a=_0xb956fc['reason'];_0xb956fc['verbose']&&(console[_0x532bc7(0x187)](_0x532bc7(0x155)+_0x4814c9),_0x196a7a&&console[_0x532bc7(0x187)](_0x532bc7(0x11d)+_0x196a7a));if(!_0xb956fc[_0x532bc7(0x116)]){const _0x26e06c=await confirm(_0x532bc7(0x173)+_0x4814c9+'?');if(!_0x26e06c)return console['error']('Cancelled'),0x0;}const _0xd59c0c=await withSpinner(_0x532bc7(0x130),()=>_0x2f457e['workflow'][_0x532bc7(0x143)](_0x4814c9,_0x196a7a),{'verbose':_0xb956fc['verbose']}),_0x115b28=_0xd59c0c[_0x532bc7(0x10a)];return console[_0x532bc7(0x187)]('✔\x20'+_0x115b28),0x0;}catch(_0x3b7b2b){if(_0x3b7b2b instanceof SDKError)return console[_0x532bc7(0x187)](_0x532bc7(0x17c)+_0x3b7b2b[_0x532bc7(0x15f)]),_0x3b7b2b[_0x532bc7(0x172)]&&console[_0x532bc7(0x187)]('\x20\x20Cause:\x20'+_0x3b7b2b[_0x532bc7(0x172)]),0x1;throw _0x3b7b2b;}}}export class WorkflowRetryCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x178);[a39_0x495444(0x128)]=a39_0x495444(0x176);async[a39_0x495444(0x11b)](_0x1e8ca4){const _0x38d13b=a39_0x495444,{options:_0x17c2c0,args:_0x331d2d,tdx:_0x5de683}=_0x1e8ca4,_0x2f03bf=_0x331d2d[0x0];if(!_0x2f03bf)return console[_0x38d13b(0x187)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x38d13b(0x187)](_0x38d13b(0x1a2)),0x1;let _0x33f8ae=![],_0x2b250c=_0x2f03bf;if(_0x2f03bf['startsWith'](_0x38d13b(0x17f)))_0x33f8ae=!![],_0x2b250c=_0x2f03bf[_0x38d13b(0x154)](0x8);else{if(_0x2f03bf[_0x38d13b(0x152)](_0x38d13b(0x13c)))_0x33f8ae=![],_0x2b250c=_0x2f03bf[_0x38d13b(0x154)](0x8);else return console[_0x38d13b(0x187)](_0x38d13b(0x182)),console['error'](_0x38d13b(0x1a2)),0x1;}try{const _0x140ea2=_0x17c2c0['fromTask'],_0x226090=_0x17c2c0['resumeFrom'],_0x22267e=_0x17c2c0[_0x38d13b(0x1b4)],_0xf37dac=_0x17c2c0[_0x38d13b(0x19a)];_0x17c2c0['verbose']&&(console['error'](_0x38d13b(0x11f)+(_0x33f8ae?_0x38d13b(0x112):_0x38d13b(0x114))+'\x20'+_0x2b250c),_0x140ea2&&console[_0x38d13b(0x187)](_0x38d13b(0x1b0)+_0x140ea2),_0x226090&&console[_0x38d13b(0x187)](_0x38d13b(0x177)+_0x226090),_0x22267e&&console[_0x38d13b(0x187)](_0x38d13b(0x10c)+_0x22267e),_0xf37dac&&console[_0x38d13b(0x187)](_0x38d13b(0x12a)));let _0x178731;if(_0x22267e)try{if(_0x22267e[_0x38d13b(0x152)]('@')){const _0x4eaa13=await import(_0x38d13b(0x19d)),_0x28e8c1=_0x22267e['substring'](0x1),_0x3c3fc6=await _0x4eaa13['readFile'](_0x28e8c1,'utf-8');_0x178731=JSON[_0x38d13b(0x16c)](_0x3c3fc6);}else _0x178731=JSON[_0x38d13b(0x16c)](_0x22267e);}catch{return console[_0x38d13b(0x187)](_0x38d13b(0x18b)),0x1;}if(!_0x17c2c0[_0x38d13b(0x116)]){const _0x4ef34c=await confirm(_0x38d13b(0x160)+(_0x33f8ae?_0x38d13b(0x112):_0x38d13b(0x114))+'\x20'+_0x2b250c+'?');if(!_0x4ef34c)return console[_0x38d13b(0x187)](_0x38d13b(0x13a)),0x0;}let _0x51fda8;_0x33f8ae?_0x51fda8=await withSpinner('Retrying\x20session...',()=>_0x5de683[_0x38d13b(0x194)][_0x38d13b(0x167)](_0x2b250c,{'fromTask':_0x140ea2,'retryParams':_0x178731}),{'verbose':_0x17c2c0[_0x38d13b(0x134)]}):_0x51fda8=await withSpinner(_0x38d13b(0x106),()=>_0x5de683['workflow'][_0x38d13b(0x162)](_0x2b250c,{'resumeFrom':_0x226090,'retryParams':_0x178731,'force':_0xf37dac}),{'verbose':_0x17c2c0[_0x38d13b(0x134)]});const _0x126a3e=_0x51fda8[_0x38d13b(0x10a)];return console['error'](_0x38d13b(0x147)),console['error'](_0x38d13b(0x16d)+_0x126a3e[_0x38d13b(0x196)]),console[_0x38d13b(0x187)](_0x38d13b(0x139)+_0x126a3e[_0x38d13b(0x157)]),0x0;}catch(_0x39f6af){if(_0x39f6af instanceof SDKError)return console[_0x38d13b(0x187)](_0x38d13b(0x17c)+_0x39f6af[_0x38d13b(0x15f)]),_0x39f6af[_0x38d13b(0x172)]&&console[_0x38d13b(0x187)]('\x20\x20Cause:\x20'+_0x39f6af[_0x38d13b(0x172)]),0x1;throw _0x39f6af;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a39_0x495444(0x110);[a39_0x495444(0x128)]=a39_0x495444(0x108);async[a39_0x495444(0x11b)](_0x5a5072){const _0x1d8ac0=a39_0x495444,{options:_0x3b1d14,args:_0x3c4dc2,tdx:_0x47b09e}=_0x5a5072,_0x26bcc8=_0x3c4dc2[0x0];if(!_0x26bcc8)return console[_0x1d8ac0(0x187)]('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x1d8ac0(0x187)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x302e80=_0x3b1d14[_0x1d8ac0(0x199)],_0xf9f836=_0x3b1d14['sessionTime'],_0x4ce36e={};if(_0x302e80&&Array[_0x1d8ac0(0x140)](_0x302e80))for(const _0xdaeac3 of _0x302e80){const _0xd3fc1=_0xdaeac3[_0x1d8ac0(0x118)]('=');if(_0xd3fc1===-0x1)return console[_0x1d8ac0(0x187)](_0x1d8ac0(0x150)+_0xdaeac3),console[_0x1d8ac0(0x187)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x64d7b1=_0xdaeac3[_0x1d8ac0(0x154)](0x0,_0xd3fc1),_0x553dc8=_0xdaeac3[_0x1d8ac0(0x154)](_0xd3fc1+0x1);try{_0x4ce36e[_0x64d7b1]=JSON[_0x1d8ac0(0x16c)](_0x553dc8);}catch{_0x4ce36e[_0x64d7b1]=_0x553dc8;}}_0x3b1d14[_0x1d8ac0(0x134)]&&(console['error'](_0x1d8ac0(0x12b)+_0x26bcc8),Object[_0x1d8ac0(0x188)](_0x4ce36e)[_0x1d8ac0(0x1ab)]>0x0&&console[_0x1d8ac0(0x187)](_0x1d8ac0(0x113)+JSON['stringify'](_0x4ce36e)),_0xf9f836&&console[_0x1d8ac0(0x187)]('Session\x20time:\x20'+_0xf9f836));const _0x2a12b3=await withSpinner(_0x1d8ac0(0x19e),()=>_0x47b09e[_0x1d8ac0(0x194)]['run'](_0x26bcc8,_0x4ce36e,{'sessionTime':_0xf9f836}),{'verbose':_0x3b1d14['verbose']}),_0x20a187=_0x2a12b3['data'];return console[_0x1d8ac0(0x187)]('✔\x20Workflow\x20run\x20started'),console[_0x1d8ac0(0x187)](_0x1d8ac0(0x17d)+_0x20a187['id']),console[_0x1d8ac0(0x187)](_0x1d8ac0(0x139)+_0x20a187[_0x1d8ac0(0x157)]),console['error'](_0x1d8ac0(0x198)+_0x20a187[_0x1d8ac0(0x161)]?.['name']),console[_0x1d8ac0(0x187)](_0x1d8ac0(0x16a)+_0x20a187['workflow']?.[_0x1d8ac0(0x159)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x141);[a39_0x495444(0x128)]=a39_0x495444(0x1b2);async[a39_0x495444(0x11b)](_0x318beb){const _0x5aa383=a39_0x495444,{options:_0x430ec9,args:_0x1408de,tdx:_0x59dda5}=_0x318beb,_0x399201=_0x1408de[0x0],_0x58192d=_0x1408de[0x1]||'.';if(!_0x399201)return console[_0x5aa383(0x187)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x5aa383(0x187)](_0x5aa383(0x16f)),0x1;const _0x495592=_0x430ec9[_0x5aa383(0x15e)];_0x430ec9[_0x5aa383(0x134)]&&(console[_0x5aa383(0x187)](_0x5aa383(0x14c)+_0x399201),console['error'](_0x5aa383(0x156)+_0x58192d),_0x495592&&console[_0x5aa383(0x187)](_0x5aa383(0x19f)+_0x495592));const _0xa6dfde=await withSpinner(_0x5aa383(0x138)+_0x399201+_0x5aa383(0x1b3),()=>_0x59dda5[_0x5aa383(0x194)][_0x5aa383(0x119)](_0x399201,_0x58192d,{'revision':_0x495592}),{'verbose':_0x430ec9[_0x5aa383(0x134)]}),_0x5d94b9=_0xa6dfde['data'];return console[_0x5aa383(0x187)]('✔\x20Downloaded\x20'+_0x5d94b9[_0x5aa383(0x145)]),console[_0x5aa383(0x187)](_0x5aa383(0x109)+_0x5d94b9[_0x5aa383(0x15e)]),console[_0x5aa383(0x187)](_0x5aa383(0x10b)+_0x5d94b9[_0x5aa383(0x123)]),console[_0x5aa383(0x187)](_0x5aa383(0x17e)+_0x58192d+'/'+_0x5d94b9[_0x5aa383(0x145)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x19c);[a39_0x495444(0x128)]=a39_0x495444(0x15b);async['execute'](_0x296c5f){const _0x304fdc=a39_0x495444,{options:_0x2b23f5,args:_0x259217,tdx:_0x5774ac}=_0x296c5f;let _0xa1ed3f='.',_0x544498=_0x2b23f5[_0x304fdc(0x159)];if(_0x259217[0x0]){const {promises:_0x1814b9}=await import('fs');try{const _0x8f6c3d=await _0x1814b9[_0x304fdc(0x1a8)](_0x259217[0x0]);if(_0x8f6c3d[_0x304fdc(0x175)]())_0xa1ed3f=_0x259217[0x0];else return console[_0x304fdc(0x187)]('Error:\x20'+_0x259217[0x0]+_0x304fdc(0x122)),0x1;}catch{_0x544498=_0x259217[0x0],_0xa1ed3f='.';}}const _0x44dfaa=_0x2b23f5[_0x304fdc(0x15e)],_0x3b34fd=_0x2b23f5[_0x304fdc(0x16e)];_0x2b23f5[_0x304fdc(0x134)]&&(console[_0x304fdc(0x187)](_0x304fdc(0x18e)+_0xa1ed3f),_0x544498&&console[_0x304fdc(0x187)]('Project\x20name:\x20'+_0x544498),_0x44dfaa&&console[_0x304fdc(0x187)](_0x304fdc(0x19f)+_0x44dfaa),_0x3b34fd&&console[_0x304fdc(0x187)](_0x304fdc(0x1a3)));const _0x237171=await withSpinner(_0x304fdc(0x146),()=>_0x5774ac['workflow'][_0x304fdc(0x148)](_0xa1ed3f,{'projectName':_0x544498,'revision':_0x44dfaa,'skipValidation':_0x3b34fd}),{'verbose':_0x2b23f5[_0x304fdc(0x134)]}),_0x501725=_0x237171[_0x304fdc(0x10a)];return console['error'](_0x304fdc(0x136)+_0x501725[_0x304fdc(0x145)]),console[_0x304fdc(0x187)](_0x304fdc(0x184)+_0x501725['projectId']),console[_0x304fdc(0x187)]('\x20\x20Revision:\x20'+_0x501725[_0x304fdc(0x15e)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a39_0x495444(0x159)]='workflow:delete';['description']=a39_0x495444(0x13b);async[a39_0x495444(0x11b)](_0x13c274){const _0x387f47=a39_0x495444,{options:_0x2b8cc2,args:_0x146990,tdx:_0x53aba9}=_0x13c274,_0x7f33dc=_0x146990[0x0];if(!_0x7f33dc)return console[_0x387f47(0x187)](_0x387f47(0x15d)),console[_0x387f47(0x187)](_0x387f47(0x142)),0x1;_0x2b8cc2[_0x387f47(0x134)]&&console[_0x387f47(0x187)](_0x387f47(0x14c)+_0x7f33dc);if(!_0x2b8cc2[_0x387f47(0x116)]){const _0x3ff1ec=await confirm(_0x387f47(0x1ac)+_0x7f33dc+_0x387f47(0x185));if(!_0x3ff1ec)return console['error'](_0x387f47(0x13a)),0x0;}const _0x4c3d4b=await withSpinner(_0x387f47(0x163)+_0x7f33dc+_0x387f47(0x1b3),()=>_0x53aba9[_0x387f47(0x194)][_0x387f47(0x174)](_0x7f33dc),{'verbose':_0x2b8cc2['verbose']}),_0x395671=_0x4c3d4b[_0x387f47(0x10a)];return console['error'](_0x387f47(0x117)+_0x395671[_0x387f47(0x145)]),console[_0x387f47(0x187)](_0x387f47(0x184)+_0x395671['projectId']),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5f1c02,_0x4db5ff){const _0xe75d86=a40_0x225d,_0x330b93=_0x5f1c02();while(!![]){try{const _0xb10d1a=-parseInt(_0xe75d86(0x1e8))/0x1*(-parseInt(_0xe75d86(0x1e1))/0x2)+-parseInt(_0xe75d86(0x1d7))/0x3*(-parseInt(_0xe75d86(0x1e7))/0x4)+-parseInt(_0xe75d86(0x1e2))/0x5+parseInt(_0xe75d86(0x1d6))/0x6*(parseInt(_0xe75d86(0x1da))/0x7)+parseInt(_0xe75d86(0x1df))/0x8+parseInt(_0xe75d86(0x1de))/0x9*(-parseInt(_0xe75d86(0x1d8))/0xa)+parseInt(_0xe75d86(0x1e3))/0xb;if(_0xb10d1a===_0x4db5ff)break;else _0x330b93['push'](_0x330b93['shift']());}catch(_0x1b7d7b){_0x330b93['push'](_0x330b93['shift']());}}}(a40_0x3999,0xeb783));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a40_0x3999(){const _0x3e35da=['891284khVIcx','1303669RQWxaL','entries','version','utf-8','TD1\x20','4795338RRnUVm','3EbMqtb','1860okkTec','tdx','7jrCTwi','url','parse','X-Trino-User','80451KxklNe','873832mfmMnw','tdx/','2qFwRVH','8086350dxHpQT','19904115AcfrDC','0.0.0','Authorization','length'];a40_0x3999=function(){return _0x3e35da;};return a40_0x3999();}function a40_0x225d(_0x4394f7,_0x4bf0b6){const _0x399963=a40_0x3999();return a40_0x225d=function(_0x225d64,_0x55e74e){_0x225d64=_0x225d64-0x1d4;let _0x3473f6=_0x399963[_0x225d64];return _0x3473f6;},a40_0x225d(_0x4394f7,_0x4bf0b6);}import{getAPIKey}from'./config.js';export function getVersion(){const _0x3eae75=a40_0x225d;try{const _0x36daba=fileURLToPath(import.meta[_0x3eae75(0x1db)]),_0x1bad25=dirname(_0x36daba),_0x4b0f14=join(_0x1bad25,'../../package.json'),_0x2fd6fb=JSON[_0x3eae75(0x1dc)](readFileSync(_0x4b0f14,_0x3eae75(0x1d4)));return _0x2fd6fb['version'];}catch{return _0x3eae75(0x1e4);}}export function getUserAgent(){const _0x2b4f00=a40_0x225d,_0x16f12c=getVersion(),_0x388d88=platform(),_0x268acd=process[_0x2b4f00(0x1ea)]['replace']('v','');return _0x2b4f00(0x1e0)+_0x16f12c+'\x20('+_0x388d88+';\x20node/'+_0x268acd+')';}export function getAuthHeaders(_0x18793b,_0x5c1f86){const _0x454614=a40_0x225d,_0x1dab17=getVersion(),_0x44c687={'User-Agent':getUserAgent(),'X-TD-Client':_0x454614(0x1d9),'X-TD-Client-Version':_0x1dab17};return _0x5c1f86&&(_0x44c687['Authorization']=_0x454614(0x1d5)+_0x5c1f86),_0x44c687;}export function toHeaderRecord(_0x3d10f3){const _0x202eda=a40_0x225d,_0x502982={};for(const [_0x511f1c,_0x3aa3d2]of Object[_0x202eda(0x1e9)](_0x3d10f3)){_0x3aa3d2!==undefined&&(_0x502982[_0x511f1c]=_0x3aa3d2);}return _0x502982;}export function getTrinoHeaders(_0x3e10cf,_0x118a02){const _0x363d25=a40_0x225d,_0x5db555=getAuthHeaders(_0x3e10cf,_0x118a02),_0x6c9857=toHeaderRecord(_0x5db555);return delete _0x6c9857[_0x363d25(0x1e5)],_0x118a02&&(_0x6c9857[_0x363d25(0x1dd)]=_0x118a02),_0x6c9857;}export function hasAPIKey(_0x2ab51a){const _0x163ad7=a40_0x225d,_0x35940d=getAPIKey(_0x2ab51a);return _0x35940d!==undefined&&_0x35940d[_0x163ad7(0x1e6)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x53f680,_0x4ccb06){const _0x473554=a41_0x326e,_0x149932=_0x53f680();while(!![]){try{const _0x12e199=parseInt(_0x473554(0x10b))/0x1+-parseInt(_0x473554(0x13d))/0x2*(parseInt(_0x473554(0x14e))/0x3)+-parseInt(_0x473554(0x14b))/0x4+parseInt(_0x473554(0x11f))/0x5+-parseInt(_0x473554(0x143))/0x6*(-parseInt(_0x473554(0x122))/0x7)+parseInt(_0x473554(0x130))/0x8+parseInt(_0x473554(0x133))/0x9*(-parseInt(_0x473554(0x13b))/0xa);if(_0x12e199===_0x4ccb06)break;else _0x149932['push'](_0x149932['shift']());}catch(_0xb058c7){_0x149932['push'](_0x149932['shift']());}}}(a41_0xba00,0x3d15b));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0x2c83f0 from'node:fs';import*as a41_0xd5b29e from'node:path';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_0x12b6e4 from'chalk';export function getConfigDir(){const _0x2238b5=a41_0x326e;return process['env']['TDX_CONFIG_DIR']||join(homedir(),_0x2238b5(0x11b),_0x2238b5(0x11d));}function a41_0xba00(){const _0x3456f7=['join','includes','readFileSync','.env.','entries','split','keychain','354944tBOWyy','stg-us01','match','1278705nmnRlO','warn','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','profiles','493864yMbdFR','toUpperCase','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','utf-8','us01','jp01','some','TD_API_KEY_','existsSync','yellow','string','replace','trim','stg-jp01','endsWith','dev-eu01','.config','source','tdx','\x20env\x20var','2404645unePTJ','ap02','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','1275477pbHKoz','map','ap03','eu01','env','TDX_API_KEY','TDX_CACHE_DIR','.env','startsWith','slice','legacy\x20.env\x20file\x20(profile:\x20','profile','tdx.json','Warning:\x20Unknown\x20site\x20\x27','3611864YMycow','parse','isDeprecated','200646dVdkJZ','keychain\x20(profile:\x20','TDX_API_KEY_','.cache','Warning:\x20Failed\x20to\x20load\x20','llm_default_project.','TDX_API_KEY_<PROFILE>','TDX_API_KEY\x20env\x20var','460TgCMar','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','2hHbcki','name','stg-ap03','Warning:\x20Failed\x20to\x20read\x20','filter','TD_API_KEY','12HGTflU'];a41_0xba00=function(){return _0x3456f7;};return a41_0xba00();}export function getConfigFile(){const _0x5ab437=a41_0x326e;return join(getConfigDir(),_0x5ab437(0x129));}export function getConfigFilePath(_0xc302e1){const _0x3940ea=a41_0x326e,_0x3a0920=getConfigDir();return _0xc302e1?a41_0xd5b29e[_0x3940ea(0x144)](_0x3a0920,'.env.'+_0xc302e1):getConfigFile();}export function getCacheDir(){const _0x433df8=a41_0x326e;return process[_0x433df8(0x126)][_0x433df8(0x128)]||join(homedir(),_0x433df8(0x136),_0x433df8(0x11d));}export function getLLMProjectCacheFile(_0x31d57c){const _0x369c46=a41_0x326e,_0x549ac4=_0x31d57c?_0x369c46(0x138)+_0x31d57c:'llm_default_project';return join(getCacheDir(),_0x549ac4);}export function readCachedLLMProject(_0xff0e70){const _0x2bb5ec=a41_0x326e;try{const _0xd9c1b4=getLLMProjectCacheFile(_0xff0e70);if(!existsSync(_0xd9c1b4))return null;const _0x449ab2=readFileSync(_0xd9c1b4,_0x2bb5ec(0x10e))[_0x2bb5ec(0x117)]();try{const _0x5cd033=JSON[_0x2bb5ec(0x131)](_0x449ab2);if(_0x5cd033&&typeof _0x5cd033['id']===_0x2bb5ec(0x115)&&typeof _0x5cd033[_0x2bb5ec(0x13e)]===_0x2bb5ec(0x115))return _0x5cd033;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x2e1c81,_0x2eaafa,_0x32fdd9){const _0x4d7c68=a41_0x326e;try{const _0x4a309b=getCacheDir(),_0x3ef088=getLLMProjectCacheFile(_0x32fdd9);!existsSync(_0x4a309b)&&mkdirSync(_0x4a309b,{'recursive':!![]});const _0x322b8b={'name':_0x2e1c81,'id':_0x2eaafa};writeFileSync(_0x3ef088,JSON['stringify'](_0x322b8b),_0x4d7c68(0x10e));}catch{}}export function parseEnvFile(_0x576166){const _0xf7fd64=a41_0x326e,_0x5e699a={};for(const _0x596bba of _0x576166[_0xf7fd64(0x149)]('\x0a')){const _0x4c46ae=_0x596bba[_0xf7fd64(0x117)]();if(!_0x4c46ae||_0x4c46ae[_0xf7fd64(0x12a)]('#'))continue;const _0x5539d5=_0x4c46ae[_0xf7fd64(0x14d)](/^([^=]+)=(.*)$/);if(_0x5539d5){const _0x3daff4=_0x5539d5[0x1][_0xf7fd64(0x117)]();let _0xc362f7=_0x5539d5[0x2]['trim']();(_0xc362f7[_0xf7fd64(0x12a)]('\x22')&&_0xc362f7[_0xf7fd64(0x119)]('\x22')||_0xc362f7[_0xf7fd64(0x12a)]('\x27')&&_0xc362f7[_0xf7fd64(0x119)]('\x27'))&&(_0xc362f7=_0xc362f7[_0xf7fd64(0x12b)](0x1,-0x1)),_0x5e699a[_0x3daff4]=_0xc362f7;}}return _0x5e699a;}export function readUserConfig(){const _0x4ae25f=a41_0x326e,_0x6fdf84=getConfigFile();if(!existsSync(_0x6fdf84))return{};try{const _0x3fe926=readFileSync(_0x6fdf84,_0x4ae25f(0x10e));return parseEnvFile(_0x3fe926);}catch(_0x3e1252){return console['warn'](_0x4ae25f(0x109)+_0x6fdf84+':',_0x3e1252),{};}}export function resolveSite(_0x174b97){const _0x60b93b=a41_0x326e,_0x1b8759=[_0x60b93b(0x10f),'jp01',_0x60b93b(0x125),_0x60b93b(0x120),_0x60b93b(0x124),'dev-us01',_0x60b93b(0x11a),_0x60b93b(0x14c),_0x60b93b(0x118),_0x60b93b(0x13f)];if(_0x1b8759[_0x60b93b(0x145)](_0x174b97))return _0x174b97;if(_0x174b97 in SITE_ALIASES)return SITE_ALIASES[_0x174b97];return console[_0x60b93b(0x14f)](_0x60b93b(0x12f)+_0x174b97+'\x27,\x20defaulting\x20to\x20us01'),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x5d3480,_0x4f1567){const _0xa26832=a41_0x326e,_0x126d21=_0x4f1567||getActiveProfileName();if(_0x126d21){const _0x575801=_0xa26832(0x135)+normalizeProfileForEnvVar(_0x126d21);if(process[_0xa26832(0x126)][_0x575801])return process[_0xa26832(0x126)][_0x575801];}if(process[_0xa26832(0x126)][_0xa26832(0x127)])return process[_0xa26832(0x126)][_0xa26832(0x127)];if(process['env'][_0xa26832(0x142)])return process['env']['TD_API_KEY'];const _0xdf00be=_0x5d3480[_0xa26832(0x10c)]()[_0xa26832(0x116)](/-/g,'_'),_0x2a0468=_0xa26832(0x112)+_0xdf00be;if(_0x126d21){const _0x334e13=loadProfileEnv(_0x126d21);if(_0x334e13){if(_0x334e13[_0x2a0468])return _0x334e13[_0x2a0468];if(_0x334e13[_0xa26832(0x142)])return _0x334e13[_0xa26832(0x142)];}}const _0x1a43ef=loadUserConfigOnce();if(_0x1a43ef[_0x2a0468])return _0x1a43ef[_0x2a0468];if(_0x1a43ef[_0xa26832(0x142)])return _0x1a43ef[_0xa26832(0x142)];return undefined;}export function normalizeProfileForEnvVar(_0x4ba555){const _0x59e78e=a41_0x326e;return _0x4ba555[_0x59e78e(0x10c)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3f8ff0,_0x148c4c){const _0x5aaed4=a41_0x326e,_0x1004e2=_0x148c4c||getActiveProfileName()||undefined;if(_0x1004e2){const _0x193ff2=_0x5aaed4(0x135)+normalizeProfileForEnvVar(_0x1004e2);if(process[_0x5aaed4(0x126)][_0x193ff2])return{'apiKey':process['env'][_0x193ff2],'source':_0x193ff2+_0x5aaed4(0x11e),'isDeprecated':![]};const _0x4e416c=getCachedCredential(_0x3f8ff0,_0x1004e2);if(_0x4e416c)return{'apiKey':_0x4e416c,'source':_0x5aaed4(0x134)+_0x1004e2+')','isDeprecated':![]};const _0x5d91f5=await getKeychainAPIKey(_0x1004e2);if(_0x5d91f5)return setCachedCredential(_0x5d91f5,_0x3f8ff0,_0x1004e2),{'apiKey':_0x5d91f5,'source':'keychain\x20(profile:\x20'+_0x1004e2+')','isDeprecated':![]};}if(process[_0x5aaed4(0x126)]['TDX_API_KEY'])return{'apiKey':process[_0x5aaed4(0x126)][_0x5aaed4(0x127)],'source':_0x5aaed4(0x13a),'isDeprecated':![]};if(!_0x1004e2){const _0x505aa9=getCachedCredential(_0x3f8ff0,undefined);if(_0x505aa9)return{'apiKey':_0x505aa9,'source':_0x5aaed4(0x14a),'isDeprecated':![]};const _0x3fa551=await getKeychainAPIKey(undefined);if(_0x3fa551)return setCachedCredential(_0x3fa551,_0x3f8ff0,undefined),{'apiKey':_0x3fa551,'source':_0x5aaed4(0x14a),'isDeprecated':![]};}if(process[_0x5aaed4(0x126)][_0x5aaed4(0x142)])return{'apiKey':process[_0x5aaed4(0x126)]['TD_API_KEY'],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x35a65e=getLegacyEnvAPIKey(_0x3f8ff0,_0x1004e2);if(_0x35a65e){const _0x1b1192=await isKeychainAvailable();if(_0x1b1192)try{await saveKeychainAPIKey(_0x35a65e,_0x1004e2),setCachedCredential(_0x35a65e,_0x3f8ff0,_0x1004e2);const _0x3905d9=getConfigFilePath(_0x1004e2);cleanupLegacyEnvFile(_0x3905d9)&&console[_0x5aaed4(0x14f)](a41_0x12b6e4[_0x5aaed4(0x114)](_0x5aaed4(0x10d)));}catch(_0x531222){console[_0x5aaed4(0x14f)](a41_0x12b6e4[_0x5aaed4(0x114)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x531222));}const _0x37580d=_0x1004e2?_0x5aaed4(0x12c)+_0x1004e2+')':'legacy\x20.env\x20file';return{'apiKey':_0x35a65e,'source':_0x37580d,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x23d775,_0x49bf1d,_0x4c2062=!![]){const _0x3ffe1d=a41_0x326e,_0x2f4e59=await resolveAPIKeyAsync(_0x23d775,_0x49bf1d);if(!_0x2f4e59)return undefined;if(_0x4c2062&&_0x2f4e59[_0x3ffe1d(0x132)]&&_0x2f4e59[_0x3ffe1d(0x11c)][_0x3ffe1d(0x145)](_0x3ffe1d(0x142))){const _0x5a1a9a=_0x49bf1d||getActiveProfileName()||undefined,_0x1ef869=_0x5a1a9a?_0x3ffe1d(0x135)+normalizeProfileForEnvVar(_0x5a1a9a):_0x3ffe1d(0x139);console[_0x3ffe1d(0x14f)](a41_0x12b6e4[_0x3ffe1d(0x114)]('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x3ffe1d(0x13c)+_0x1ef869+').')));}return _0x2f4e59['apiKey'];}function getLegacyEnvAPIKey(_0x500b5a,_0x496e0a){const _0x248e00=a41_0x326e,_0x564c56=_0x500b5a['toUpperCase']()[_0x248e00(0x116)](/-/g,'_'),_0x3ce839=_0x248e00(0x112)+_0x564c56;if(_0x496e0a){const _0x5a3243=loadProfileEnv(_0x496e0a);if(_0x5a3243){if(_0x5a3243[_0x3ce839])return _0x5a3243[_0x3ce839];if(_0x5a3243['TD_API_KEY'])return _0x5a3243['TD_API_KEY'];}}const _0x4f478f=loadUserConfigOnce();if(_0x4f478f[_0x3ce839])return _0x4f478f[_0x3ce839];if(_0x4f478f[_0x248e00(0x142)])return _0x4f478f[_0x248e00(0x142)];return undefined;}function cleanupLegacyEnvFile(_0x5e02f4){const _0x36fa36=a41_0x326e;if(!existsSync(_0x5e02f4))return![];try{const _0x251229=readFileSync(_0x5e02f4,_0x36fa36(0x10e)),_0x4b611a=_0x251229[_0x36fa36(0x149)]('\x0a'),_0x4ce4be=_0x4b611a[_0x36fa36(0x141)](_0x4d8843=>{const _0x345183=_0x36fa36,_0x1e97e6=_0x4d8843[_0x345183(0x117)]();if(!_0x1e97e6||_0x1e97e6[_0x345183(0x12a)]('#'))return!![];const [_0x2f99c4]=_0x1e97e6['split']('=');return!_0x2f99c4[_0x345183(0x12a)]('TD_API_KEY');}),_0x820665=_0x4ce4be[_0x36fa36(0x111)](_0x39dc1d=>{const _0xad6604=_0x36fa36,_0x15922f=_0x39dc1d[_0xad6604(0x117)]();return _0x15922f&&!_0x15922f[_0xad6604(0x12a)]('#');});if(!_0x820665)return unlinkSync(_0x5e02f4),!![];return writeFileSync(_0x5e02f4,_0x4ce4be['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a41_0x326e(_0x1ed9ab,_0x558672){const _0xba0034=a41_0xba00();return a41_0x326e=function(_0x326ea3,_0x221986){_0x326ea3=_0x326ea3-0x109;let _0x13a643=_0xba0034[_0x326ea3];return _0x13a643;},a41_0x326e(_0x1ed9ab,_0x558672);}function loadProfileEnv(_0xbcd298){const _0x4039c1=a41_0x326e,_0x4f0f12=a41_0xd5b29e[_0x4039c1(0x144)](getConfigDir(),_0x4039c1(0x147)+_0xbcd298);if(a41_0x2c83f0[_0x4039c1(0x113)](_0x4f0f12)){validateSecureFilePermissions(_0x4f0f12);try{const _0x3a4760=a41_0x2c83f0[_0x4039c1(0x146)](_0x4f0f12,'utf-8');return parseEnvFile(_0x3a4760);}catch(_0x5e18b3){console['warn'](_0x4039c1(0x137)+_0x4f0f12+':\x20'+_0x5e18b3);}}const _0x33c174=a41_0xd5b29e[_0x4039c1(0x144)](getConfigDir(),_0x4039c1(0x10a),_0xbcd298,_0x4039c1(0x129));if(a41_0x2c83f0[_0x4039c1(0x113)](_0x33c174)){validateSecureFilePermissions(_0x33c174);try{const _0x3f9668=a41_0x2c83f0[_0x4039c1(0x146)](_0x33c174,_0x4039c1(0x10e));return parseEnvFile(_0x3f9668);}catch(_0x3d7f21){return console['warn'](_0x4039c1(0x137)+_0x33c174+':\x20'+_0x3d7f21),null;}}return null;}function getActiveProfileName(){const _0x40668b=a41_0x326e,_0x3b7db1=a41_0xd5b29e['join'](getConfigDir(),_0x40668b(0x12e));if(!a41_0x2c83f0[_0x40668b(0x113)](_0x3b7db1))return null;try{const _0x38b7f4=a41_0x2c83f0[_0x40668b(0x146)](_0x3b7db1,_0x40668b(0x10e)),_0x2f1c00=JSON[_0x40668b(0x131)](_0x38b7f4);return _0x2f1c00[_0x40668b(0x12d)]||null;}catch{return null;}}export function saveAPIKey(_0x194ea6,_0x30d7b4,_0xa0a66c){const _0x29b0e2=a41_0x326e,_0x39e68b=getConfigDir(),_0x321fc6=getConfigFilePath(_0xa0a66c);!existsSync(_0x39e68b)&&mkdirSync(_0x39e68b,{'recursive':!![],'mode':0x1c0});let _0x12782e={};if(existsSync(_0x321fc6))try{const _0x50f0b9=readFileSync(_0x321fc6,_0x29b0e2(0x10e));_0x12782e=parseEnvFile(_0x50f0b9);}catch(_0xa6bcb4){console[_0x29b0e2(0x14f)](_0x29b0e2(0x140)+_0x321fc6+':',_0xa6bcb4);}const _0xc1cce9=_0x194ea6[_0x29b0e2(0x10c)]()[_0x29b0e2(0x116)](/-/g,'_');_0x12782e[_0x29b0e2(0x112)+_0xc1cce9]=_0x30d7b4;const _0x2e1a8e=Object[_0x29b0e2(0x148)](_0x12782e)[_0x29b0e2(0x123)](([_0x282417,_0x177e01])=>_0x282417+'='+_0x177e01);writeFileSync(_0x321fc6,_0x2e1a8e[_0x29b0e2(0x144)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x432f8e,_0x446030,_0x5ab93d){const _0x415835=a41_0x326e;await saveKeychainAPIKey(_0x432f8e,_0x5ab93d),setCachedCredential(_0x432f8e,_0x446030,_0x5ab93d);const _0x18edcc=getConfigFilePath(_0x5ab93d);cleanupLegacyEnvFile(_0x18edcc)&&console['warn'](a41_0x12b6e4['yellow'](_0x415835(0x121)));}export function loadConfig(){const _0x2a0952=a41_0x326e,_0x326178={'apiKeys':{},'defaultSite':_0x2a0952(0x10f)},_0x321e37=[_0x2a0952(0x10f),_0x2a0952(0x110),_0x2a0952(0x125),_0x2a0952(0x120),_0x2a0952(0x124),'dev-us01',_0x2a0952(0x11a),_0x2a0952(0x14c),'stg-jp01','stg-ap03'];for(const _0x4e6fda of _0x321e37){const _0x28c839=getAPIKey(_0x4e6fda);_0x28c839&&(_0x326178['apiKeys'][_0x4e6fda]=_0x28c839);}return _0x326178;}
|
|
1
|
+
(function(_0x54ed9f,_0x1a7c88){const _0x42b903=a41_0x833a,_0x1a8387=_0x54ed9f();while(!![]){try{const _0x3333c9=parseInt(_0x42b903(0xe2))/0x1+parseInt(_0x42b903(0xe1))/0x2+parseInt(_0x42b903(0xd8))/0x3+-parseInt(_0x42b903(0xe7))/0x4+-parseInt(_0x42b903(0xfd))/0x5+parseInt(_0x42b903(0x109))/0x6+-parseInt(_0x42b903(0xeb))/0x7;if(_0x3333c9===_0x1a7c88)break;else _0x1a8387['push'](_0x1a8387['shift']());}catch(_0x22c090){_0x1a8387['push'](_0x1a8387['shift']());}}}(a41_0x3883,0x1e1c5));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0x203c3e from'node:fs';import*as a41_0x5bfa4e from'node:path';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_0x400bbb from'chalk';export function getConfigDir(){const _0xa56b6d=a41_0x833a;return process[_0xa56b6d(0x118)][_0xa56b6d(0xf9)]||join(homedir(),_0xa56b6d(0xf2),_0xa56b6d(0xe8));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x48b245){const _0x58ad22=a41_0x833a,_0x553bea=getConfigDir();return _0x48b245?a41_0x5bfa4e[_0x58ad22(0xf8)](_0x553bea,_0x58ad22(0x110)+_0x48b245):getConfigFile();}export function getCacheDir(){const _0x7d2f7d=a41_0x833a;return process[_0x7d2f7d(0x118)][_0x7d2f7d(0x10f)]||join(homedir(),_0x7d2f7d(0xe4),_0x7d2f7d(0xe8));}export function getLLMProjectCacheFile(_0x535758){const _0x3cb794=a41_0x833a,_0x96ee97=_0x535758?_0x3cb794(0xde)+_0x535758:_0x3cb794(0xe9);return join(getCacheDir(),_0x96ee97);}export function readCachedLLMProject(_0x2a31ab){const _0x539f8c=a41_0x833a;try{const _0x4f3cf5=getLLMProjectCacheFile(_0x2a31ab);if(!existsSync(_0x4f3cf5))return null;const _0x50221b=readFileSync(_0x4f3cf5,_0x539f8c(0x116))[_0x539f8c(0xf4)]();try{const _0x2c6e43=JSON[_0x539f8c(0xdc)](_0x50221b);if(_0x2c6e43&&typeof _0x2c6e43['id']===_0x539f8c(0xef)&&typeof _0x2c6e43['name']===_0x539f8c(0xef))return _0x2c6e43;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x4931d0,_0x279047,_0x56ed59){const _0x5af5e6=a41_0x833a;try{const _0x549eb9=getCacheDir(),_0x276fb9=getLLMProjectCacheFile(_0x56ed59);!existsSync(_0x549eb9)&&mkdirSync(_0x549eb9,{'recursive':!![]});const _0x2f9a67={'name':_0x4931d0,'id':_0x279047};writeFileSync(_0x276fb9,JSON['stringify'](_0x2f9a67),_0x5af5e6(0x116));}catch{}}function a41_0x833a(_0x42da7e,_0x3188dc){const _0x3883ec=a41_0x3883();return a41_0x833a=function(_0x833a1e,_0x80b4e2){_0x833a1e=_0x833a1e-0xd7;let _0x136f3d=_0x3883ec[_0x833a1e];return _0x136f3d;},a41_0x833a(_0x42da7e,_0x3188dc);}export function parseEnvFile(_0x217744){const _0x2c1ec6=a41_0x833a,_0x393c8a={};for(const _0x5c3af6 of _0x217744[_0x2c1ec6(0x100)]('\x0a')){const _0x4e19e7=_0x5c3af6[_0x2c1ec6(0xf4)]();if(!_0x4e19e7||_0x4e19e7['startsWith']('#'))continue;const _0x3e877c=_0x4e19e7['match'](/^([^=]+)=(.*)$/);if(_0x3e877c){const _0x30e303=_0x3e877c[0x1][_0x2c1ec6(0xf4)]();let _0x3373e7=_0x3e877c[0x2][_0x2c1ec6(0xf4)]();(_0x3373e7[_0x2c1ec6(0x10c)]('\x22')&&_0x3373e7[_0x2c1ec6(0x101)]('\x22')||_0x3373e7['startsWith']('\x27')&&_0x3373e7[_0x2c1ec6(0x101)]('\x27'))&&(_0x3373e7=_0x3373e7[_0x2c1ec6(0x102)](0x1,-0x1)),_0x393c8a[_0x30e303]=_0x3373e7;}}return _0x393c8a;}export function readUserConfig(){const _0x171903=a41_0x833a,_0x1030aa=getConfigFile();if(!existsSync(_0x1030aa))return{};try{const _0x2aaf21=readFileSync(_0x1030aa,_0x171903(0x116));return parseEnvFile(_0x2aaf21);}catch(_0x1198ea){return console[_0x171903(0x107)](_0x171903(0xe5)+_0x1030aa+':',_0x1198ea),{};}}export function resolveSite(_0x57ecf0){const _0xbcd862=a41_0x833a,_0x3c218f=[_0xbcd862(0x111),'jp01','eu01',_0xbcd862(0xee),_0xbcd862(0xd7),_0xbcd862(0xea),_0xbcd862(0xfe),'stg-us01',_0xbcd862(0xf1),_0xbcd862(0xf6)];if(_0x3c218f['includes'](_0x57ecf0))return _0x57ecf0;if(_0x57ecf0 in SITE_ALIASES)return SITE_ALIASES[_0x57ecf0];return console[_0xbcd862(0x107)]('Warning:\x20Unknown\x20site\x20\x27'+_0x57ecf0+_0xbcd862(0x112)),_0xbcd862(0x111);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x12bf30,_0x232627){const _0x198e2d=a41_0x833a,_0x4629ab=_0x232627||getActiveProfileName();if(_0x4629ab){const _0x16d445='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x4629ab);if(process['env'][_0x16d445])return process[_0x198e2d(0x118)][_0x16d445];}if(process[_0x198e2d(0x118)][_0x198e2d(0x10d)])return process[_0x198e2d(0x118)][_0x198e2d(0x10d)];if(process[_0x198e2d(0x118)][_0x198e2d(0x119)])return process['env'][_0x198e2d(0x119)];const _0x595e6d=_0x12bf30[_0x198e2d(0xe6)]()['replace'](/-/g,'_'),_0x4d285f=_0x198e2d(0x103)+_0x595e6d;if(_0x4629ab){const _0xf57b66=loadProfileEnv(_0x4629ab);if(_0xf57b66){if(_0xf57b66[_0x4d285f])return _0xf57b66[_0x4d285f];if(_0xf57b66[_0x198e2d(0x119)])return _0xf57b66['TD_API_KEY'];}}const _0x4fe018=loadUserConfigOnce();if(_0x4fe018[_0x4d285f])return _0x4fe018[_0x4d285f];if(_0x4fe018[_0x198e2d(0x119)])return _0x4fe018[_0x198e2d(0x119)];return undefined;}export function normalizeProfileForEnvVar(_0x42c519){const _0x3d691f=a41_0x833a;return _0x42c519['toUpperCase']()[_0x3d691f(0xd9)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x43f8d9,_0x482fd1){const _0x8968e=a41_0x833a,_0x40bd8b=_0x482fd1||getActiveProfileName()||undefined;if(_0x40bd8b){const _0xf8c8af=_0x8968e(0xf3)+normalizeProfileForEnvVar(_0x40bd8b);if(process['env'][_0xf8c8af])return{'apiKey':process[_0x8968e(0x118)][_0xf8c8af],'source':_0xf8c8af+_0x8968e(0xf5),'isDeprecated':![]};const _0x369fa5=getCachedCredential(_0x43f8d9,_0x40bd8b);if(_0x369fa5)return{'apiKey':_0x369fa5,'source':'keychain\x20(profile:\x20'+_0x40bd8b+')','isDeprecated':![]};const _0x27a858=await getKeychainAPIKey(_0x40bd8b);if(_0x27a858)return setCachedCredential(_0x27a858,_0x43f8d9,_0x40bd8b),{'apiKey':_0x27a858,'source':_0x8968e(0x117)+_0x40bd8b+')','isDeprecated':![]};}if(process[_0x8968e(0x118)]['TDX_API_KEY'])return{'apiKey':process[_0x8968e(0x118)]['TDX_API_KEY'],'source':_0x8968e(0x104),'isDeprecated':![]};if(!_0x40bd8b){const _0x4ab35c=getCachedCredential(_0x43f8d9,undefined);if(_0x4ab35c)return{'apiKey':_0x4ab35c,'source':_0x8968e(0xf0),'isDeprecated':![]};const _0x22bf36=await getKeychainAPIKey(undefined);if(_0x22bf36)return setCachedCredential(_0x22bf36,_0x43f8d9,undefined),{'apiKey':_0x22bf36,'source':'keychain','isDeprecated':![]};}if(process['env'][_0x8968e(0x119)])return{'apiKey':process[_0x8968e(0x118)][_0x8968e(0x119)],'source':_0x8968e(0xdf),'isDeprecated':!![]};const _0x5d5714=getLegacyEnvAPIKey(_0x43f8d9,_0x40bd8b);if(_0x5d5714){const _0x3ea1d7=await isKeychainAvailable();if(_0x3ea1d7)try{await saveKeychainAPIKey(_0x5d5714,_0x40bd8b),setCachedCredential(_0x5d5714,_0x43f8d9,_0x40bd8b);const _0x5e7955=getConfigFilePath(_0x40bd8b);cleanupLegacyEnvFile(_0x5e7955)&&console[_0x8968e(0x107)](a41_0x400bbb[_0x8968e(0x114)](_0x8968e(0xe0)));}catch(_0x9d5035){console['warn'](a41_0x400bbb[_0x8968e(0x114)](_0x8968e(0x113)+_0x9d5035));}const _0x977d25=_0x40bd8b?_0x8968e(0xdd)+_0x40bd8b+')':'legacy\x20.env\x20file';return{'apiKey':_0x5d5714,'source':_0x977d25,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x5dea54,_0x485f6d,_0x4da6ea=!![]){const _0x269adf=a41_0x833a,_0x743aa6=await resolveAPIKeyAsync(_0x5dea54,_0x485f6d);if(!_0x743aa6)return undefined;if(_0x4da6ea&&_0x743aa6['isDeprecated']&&_0x743aa6[_0x269adf(0xfb)]['includes'](_0x269adf(0x119))){const _0xef2ef7=_0x485f6d||getActiveProfileName()||undefined,_0x55cdbe=_0xef2ef7?_0x269adf(0xf3)+normalizeProfileForEnvVar(_0xef2ef7):_0x269adf(0xf7);console[_0x269adf(0x107)](a41_0x400bbb[_0x269adf(0x114)]('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x269adf(0xda)+_0x55cdbe+').')));}return _0x743aa6[_0x269adf(0x10a)];}function getLegacyEnvAPIKey(_0x5c6a24,_0x288296){const _0xfe9b61=a41_0x833a,_0x1ad602=_0x5c6a24['toUpperCase']()[_0xfe9b61(0xd9)](/-/g,'_'),_0x2865aa=_0xfe9b61(0x103)+_0x1ad602;if(_0x288296){const _0x351f9b=loadProfileEnv(_0x288296);if(_0x351f9b){if(_0x351f9b[_0x2865aa])return _0x351f9b[_0x2865aa];if(_0x351f9b[_0xfe9b61(0x119)])return _0x351f9b[_0xfe9b61(0x119)];}}const _0x4b1778=loadUserConfigOnce();if(_0x4b1778[_0x2865aa])return _0x4b1778[_0x2865aa];if(_0x4b1778[_0xfe9b61(0x119)])return _0x4b1778[_0xfe9b61(0x119)];return undefined;}function cleanupLegacyEnvFile(_0x3ac9ca){const _0x320573=a41_0x833a;if(!existsSync(_0x3ac9ca))return![];try{const _0xe9a0e7=readFileSync(_0x3ac9ca,_0x320573(0x116)),_0x1d3602=_0xe9a0e7['split']('\x0a'),_0x200e96=_0x1d3602['filter'](_0x32a585=>{const _0x2526a4=_0x320573,_0xc9f365=_0x32a585[_0x2526a4(0xf4)]();if(!_0xc9f365||_0xc9f365[_0x2526a4(0x10c)]('#'))return!![];const [_0x5c37db]=_0xc9f365[_0x2526a4(0x100)]('=');return!_0x5c37db[_0x2526a4(0x10c)](_0x2526a4(0x119));}),_0x5d8a8e=_0x200e96['some'](_0x6e1be7=>{const _0x22bfdb=_0x320573,_0x163495=_0x6e1be7[_0x22bfdb(0xf4)]();return _0x163495&&!_0x163495['startsWith']('#');});if(!_0x5d8a8e)return unlinkSync(_0x3ac9ca),!![];return writeFileSync(_0x3ac9ca,_0x200e96[_0x320573(0xf8)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a41_0x3883(){const _0x20e7c4=['utf-8','keychain\x20(profile:\x20','env','TD_API_KEY','ap03','160212YUkcUF','replace','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','profile','parse','legacy\x20.env\x20file\x20(profile:\x20','llm_default_project.','TD_API_KEY\x20env\x20var\x20(deprecated)','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','184748qmnrrL','207095YiWXPA','entries','.cache','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','toUpperCase','248112PuhDDG','tdx','llm_default_project','dev-us01','1292172jDJHZb','Warning:\x20Failed\x20to\x20load\x20','.env','ap02','string','keychain','stg-jp01','.config','TDX_API_KEY_','trim','\x20env\x20var','stg-ap03','TDX_API_KEY_<PROFILE>','join','TDX_CONFIG_DIR','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','source','Warning:\x20Failed\x20to\x20read\x20','901520IxnrRR','dev-eu01','jp01','split','endsWith','slice','TD_API_KEY_','TDX_API_KEY\x20env\x20var','tdx.json','apiKeys','warn','readFileSync','1184328kPXerD','apiKey','existsSync','startsWith','TDX_API_KEY','eu01','TDX_CACHE_DIR','.env.','us01','\x27,\x20defaulting\x20to\x20us01','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','yellow','map'];a41_0x3883=function(){return _0x20e7c4;};return a41_0x3883();}function loadProfileEnv(_0x1dde30){const _0x2686b8=a41_0x833a,_0x26e18d=a41_0x5bfa4e['join'](getConfigDir(),_0x2686b8(0x110)+_0x1dde30);if(a41_0x203c3e[_0x2686b8(0x10b)](_0x26e18d)){validateSecureFilePermissions(_0x26e18d);try{const _0x1ce63f=a41_0x203c3e[_0x2686b8(0x108)](_0x26e18d,_0x2686b8(0x116));return parseEnvFile(_0x1ce63f);}catch(_0x22427e){console[_0x2686b8(0x107)](_0x2686b8(0xec)+_0x26e18d+':\x20'+_0x22427e);}}const _0x496fbf=a41_0x5bfa4e[_0x2686b8(0xf8)](getConfigDir(),'profiles',_0x1dde30,_0x2686b8(0xed));if(a41_0x203c3e['existsSync'](_0x496fbf)){validateSecureFilePermissions(_0x496fbf);try{const _0x558916=a41_0x203c3e['readFileSync'](_0x496fbf,_0x2686b8(0x116));return parseEnvFile(_0x558916);}catch(_0x9d157f){return console[_0x2686b8(0x107)]('Warning:\x20Failed\x20to\x20load\x20'+_0x496fbf+':\x20'+_0x9d157f),null;}}return null;}function getActiveProfileName(){const _0x2e87bc=a41_0x833a,_0x4fcd61=a41_0x5bfa4e['join'](getConfigDir(),_0x2e87bc(0x105));if(!a41_0x203c3e[_0x2e87bc(0x10b)](_0x4fcd61))return null;try{const _0x3e97c5=a41_0x203c3e[_0x2e87bc(0x108)](_0x4fcd61,_0x2e87bc(0x116)),_0x1f461f=JSON[_0x2e87bc(0xdc)](_0x3e97c5);return _0x1f461f[_0x2e87bc(0xdb)]||null;}catch{return null;}}export function saveAPIKey(_0x109c98,_0x1198a0,_0x226ade){const _0x15bca9=a41_0x833a,_0x260e14=getConfigDir(),_0x2e7fc3=getConfigFilePath(_0x226ade);!existsSync(_0x260e14)&&mkdirSync(_0x260e14,{'recursive':!![],'mode':0x1c0});let _0x38f6c6={};if(existsSync(_0x2e7fc3))try{const _0x222bb3=readFileSync(_0x2e7fc3,_0x15bca9(0x116));_0x38f6c6=parseEnvFile(_0x222bb3);}catch(_0x20e0c5){console[_0x15bca9(0x107)](_0x15bca9(0xfc)+_0x2e7fc3+':',_0x20e0c5);}const _0x484959=_0x109c98[_0x15bca9(0xe6)]()[_0x15bca9(0xd9)](/-/g,'_');_0x38f6c6['TD_API_KEY_'+_0x484959]=_0x1198a0;const _0x2e7cd5=Object[_0x15bca9(0xe3)](_0x38f6c6)[_0x15bca9(0x115)](([_0x574118,_0x10d285])=>_0x574118+'='+_0x10d285);writeFileSync(_0x2e7fc3,_0x2e7cd5[_0x15bca9(0xf8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x581870,_0x1f034d,_0x5702a7){const _0x2a39f9=a41_0x833a;await saveKeychainAPIKey(_0x581870,_0x5702a7),setCachedCredential(_0x581870,_0x1f034d,_0x5702a7);const _0x109bd4=getConfigFilePath(_0x5702a7);cleanupLegacyEnvFile(_0x109bd4)&&console[_0x2a39f9(0x107)](a41_0x400bbb[_0x2a39f9(0x114)](_0x2a39f9(0xfa)));}export function loadConfig(){const _0x532b28=a41_0x833a,_0x14f4b8={'apiKeys':{},'defaultSite':_0x532b28(0x111)},_0x1895a6=['us01',_0x532b28(0xff),_0x532b28(0x10e),_0x532b28(0xee),_0x532b28(0xd7),'dev-us01','dev-eu01','stg-us01','stg-jp01',_0x532b28(0xf6)];for(const _0xdb83c6 of _0x1895a6){const _0x5a1ad6=getAPIKey(_0xdb83c6);_0x5a1ad6&&(_0x14f4b8[_0x532b28(0x106)][_0xdb83c6]=_0x5a1ad6);}return _0x14f4b8;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x18dbb0,_0x1a4dd8){const _0x5aa6f0=a42_0x549c,_0x1335ac=_0x18dbb0();while(!![]){try{const _0x11a846=-parseInt(_0x5aa6f0(0xa6))/0x1*(-parseInt(_0x5aa6f0(0xad))/0x2)+-parseInt(_0x5aa6f0(0x9d))/0x3*(-parseInt(_0x5aa6f0(0xaf))/0x4)+-parseInt(_0x5aa6f0(0xac))/0x5*(-parseInt(_0x5aa6f0(0xa3))/0x6)+-parseInt(_0x5aa6f0(0x9e))/0x7*(parseInt(_0x5aa6f0(0xa1))/0x8)+parseInt(_0x5aa6f0(0xaa))/0x9*(-parseInt(_0x5aa6f0(0x9f))/0xa)+-parseInt(_0x5aa6f0(0xa2))/0xb*(parseInt(_0x5aa6f0(0xa7))/0xc)+parseInt(_0x5aa6f0(0xae))/0xd;if(_0x11a846===_0x1a4dd8)break;else _0x1335ac['push'](_0x1335ac['shift']());}catch(_0x3c22c9){_0x1335ac['push'](_0x1335ac['shift']());}}}(a42_0x5adb,0x5233d));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a42_0x549c(_0x462cc7,_0x5ea253){const _0x5adbe2=a42_0x5adb();return a42_0x549c=function(_0x549cdb,_0x1cad96){_0x549cdb=_0x549cdb-0x9d;let _0x555b66=_0x5adbe2[_0x549cdb];return _0x555b66;},a42_0x549c(_0x462cc7,_0x5ea253);}function getCacheKey(_0x315d48,_0x1997d6){const _0x177390=a42_0x549c,_0x8b9893=_0x315d48||_0x177390(0xa5),_0x3b6e66=_0x1997d6||'__default_profile__';return _0x8b9893+':'+_0x3b6e66;}function a42_0x5adb(){const _0x277a2f=['set','__default_site__','2tVMeGf','192000qTjaJi','delete','clear','198981WaXmkS','now','40aRvWoB','95908eSGvey','17288141fZBctc','776996XTozvq','apiKey','3WPCIgx','5628MrcPEd','250yXWlDP','loadedAt','3112KDjnGV','440KRYCWV','166626jOttoE'];a42_0x5adb=function(){return _0x277a2f;};return a42_0x5adb();}export function getCachedCredential(_0x9c4eed,_0x1e264a){const _0x1a6184=a42_0x549c,_0x4046db=getCacheKey(_0x9c4eed,_0x1e264a),_0x33e511=cache['get'](_0x4046db);if(!_0x33e511)return null;if(Date['now']()-_0x33e511[_0x1a6184(0xa0)]>CACHE_TTL_MS)return cache[_0x1a6184(0xa8)](_0x4046db),null;return _0x33e511[_0x1a6184(0xb0)];}export function setCachedCredential(_0x1b7a24,_0x3d228b,_0x479cea){const _0x570565=a42_0x549c,_0x319047=getCacheKey(_0x3d228b,_0x479cea);cache[_0x570565(0xa4)](_0x319047,{'apiKey':_0x1b7a24,'loadedAt':Date[_0x570565(0xab)]()});}export function clearCredentialCache(){const _0x38af3c=a42_0x549c;cache[_0x38af3c(0xa9)]();}export function clearCachedCredential(_0x157b23,_0x26012d){const _0x451bac=getCacheKey(_0x157b23,_0x26012d);cache['delete'](_0x451bac);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x411c6a=a43_0x1bad;(function(_0x171897,_0x2953d1){const _0xc4a310=a43_0x1bad,_0x4082e3=_0x171897();while(!![]){try{const _0x302b5f=parseInt(_0xc4a310(0x1be))/0x1+-parseInt(_0xc4a310(0x1e5))/0x2*(-parseInt(_0xc4a310(0x1c4))/0x3)+-parseInt(_0xc4a310(0x1b9))/0x4+-parseInt(_0xc4a310(0x1de))/0x5+parseInt(_0xc4a310(0x1e8))/0x6+parseInt(_0xc4a310(0x1c6))/0x7+parseInt(_0xc4a310(0x1f5))/0x8*(-parseInt(_0xc4a310(0x1bc))/0x9);if(_0x302b5f===_0x2953d1)break;else _0x4082e3['push'](_0x4082e3['shift']());}catch(_0x304300){_0x4082e3['push'](_0x4082e3['shift']());}}}(a43_0x4434,0xcc121));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a43_0x4434(){const _0x205540=['parse','Profile\x20Credentials','string','INFO','sessions','llmProject','5228730drJyjA','apiKey','Global','site','activeProfile','layers','injectIntoOptions','2302MwHwes','utf-8','profile:\x20','9485292XalTTR','log','Profile','join','configFiles','parentSegment','us01','.env','global','globalCredentials','parent_segment',':\x20none\x20(using\x20session:\x20','[context]','32jGnzOx','resolveAPIKeyAsync','displayWithSources','logLevel','segment_path','5105304QNcVcj','\x0a[configuration\x20files]','tdx.json','604161qfjopt','verbose','366189TDVOIZ','default','getParameters','sessionId','CLI\x20flag:\x20--','cliFlags','3435EpbxCS','database','1130465wiTGYZ','segmentPath','display','Global\x20Credentials','Project','session',':\x20none','llm_project','not\x20set','.json','profile','existsSync','profiles','Session','config','getSource','project','loadGlobalConfig'];a43_0x4434=function(){return _0x205540;};return a43_0x4434();}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a43_0x2607e3 from'node:fs';import*as a43_0x11240b from'node:path';function a43_0x1bad(_0x5eaa15,_0x3412bb){const _0x4434bb=a43_0x4434();return a43_0x1bad=function(_0x1bad4c,_0x40682d){_0x1bad4c=_0x1bad4c-0x1b7;let _0x433b72=_0x4434bb[_0x1bad4c];return _0x433b72;},a43_0x1bad(_0x5eaa15,_0x3412bb);}export class GlobalContext{[a43_0x411c6a(0x1e1)];[a43_0x411c6a(0x1c5)];[a43_0x411c6a(0x1f2)];[a43_0x411c6a(0x1b8)];[a43_0x411c6a(0x1cd)];['apiKey'];['verbose'];['logLevel'];['profile'];['layers'];['activeProfile'];[a43_0x411c6a(0x1c1)];[a43_0x411c6a(0x1ec)];constructor(_0x6d8463){const _0x76e227=a43_0x411c6a;this[_0x76e227(0x1c1)]=_0x6d8463['session']||getCurrentSessionPID()['toString']();const _0x318d75=loadSessionContext(_0x6d8463[_0x76e227(0x1cb)]),_0x10906e=loadProjectConfig(),_0xa9b2a9=this[_0x76e227(0x1d7)]();this[_0x76e227(0x1e2)]=_0x6d8463['profile']||_0x318d75?.[_0x76e227(0x1d0)]||_0xa9b2a9['profile']||getActiveProfile();const _0x442420=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x1961f9=_0x5bc80d=>{const _0x58991e=_0x76e227;if(!_0x5bc80d)return{};const _0x176fb6=_0x5bc80d,_0x42ad5b={};for(const [_0x1cce24,_0x241583]of Object['entries'](_0x176fb6)){typeof _0x241583===_0x58991e(0x1da)&&(_0x42ad5b[_0x1cce24]=_0x241583);}return _0x42ad5b;},_0x26b7a9={};if(_0x6d8463['site']&&_0x6d8463[_0x76e227(0x1e1)]!==_0x76e227(0x1ee))_0x26b7a9[_0x76e227(0x1e1)]=_0x6d8463[_0x76e227(0x1e1)];const _0x2c94b5=_0x318d75?.[_0x76e227(0x1c5)],_0x47e8cf=_0x10906e?.[_0x76e227(0x1c5)],_0x48945a=_0x442420?.['config']?.[_0x76e227(0x1c5)],_0x31284a=_0xa9b2a9[_0x76e227(0x1c5)];_0x6d8463['database']&&(_0x6d8463[_0x76e227(0x1c5)]!==_0x2c94b5&&_0x6d8463['database']!==_0x47e8cf&&_0x6d8463[_0x76e227(0x1c5)]!==_0x48945a&&_0x6d8463[_0x76e227(0x1c5)]!==_0x31284a)&&(_0x26b7a9[_0x76e227(0x1c5)]=_0x6d8463[_0x76e227(0x1c5)]);if(_0x6d8463[_0x76e227(0x1ed)])_0x26b7a9[_0x76e227(0x1f2)]=_0x6d8463[_0x76e227(0x1ed)];if(_0x6d8463['llmProject'])_0x26b7a9[_0x76e227(0x1cd)]=_0x6d8463[_0x76e227(0x1dd)];if(_0x6d8463[_0x76e227(0x1d0)])_0x26b7a9['profile']=_0x6d8463[_0x76e227(0x1d0)];this[_0x76e227(0x1e3)]={'cliFlags':_0x26b7a9,'session':_0x1961f9(_0x318d75),'project':_0x1961f9(_0x10906e),'profile':_0x1961f9(_0x442420?.[_0x76e227(0x1d4)]),'global':_0x1961f9(_0xa9b2a9)};const _0x48488b={...this[_0x76e227(0x1e3)][_0x76e227(0x1f0)],...this[_0x76e227(0x1e3)][_0x76e227(0x1d0)],...this[_0x76e227(0x1e3)]['project'],...this['layers'][_0x76e227(0x1cb)],...this['layers']['cliFlags']},_0x1848c5=_0x48488b['site']||_0x76e227(0x1ee);this['site']=resolveSite(_0x1848c5),this[_0x76e227(0x1c5)]=_0x48488b['database'],this[_0x76e227(0x1f2)]=_0x48488b[_0x76e227(0x1f2)],this[_0x76e227(0x1b8)]=_0x48488b['segment_path'],this[_0x76e227(0x1cd)]=_0x48488b[_0x76e227(0x1cd)],this[_0x76e227(0x1bd)]=_0x6d8463['verbose']||![],this[_0x76e227(0x1b7)]=_0x6d8463[_0x76e227(0x1b7)]??LogLevel[_0x76e227(0x1db)],this[_0x76e227(0x1d0)]=this[_0x76e227(0x1e2)]||undefined,this[_0x76e227(0x1df)]=getAPIKey(this[_0x76e227(0x1e1)],this[_0x76e227(0x1e2)]||undefined);const _0x29353d=getConfigDir(),_0x390e9c=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1dc),this[_0x76e227(0x1c1)]+_0x76e227(0x1cf)),_0x11f829=findProjectConfigPath(),_0x17563f=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1bb)),_0x2a3a45=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1ef));let _0x453b80=null,_0xa76b9=null;this['activeProfile']&&(_0x453b80=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1d2),this[_0x76e227(0x1e2)],'tdx.json'),_0xa76b9=a43_0x11240b['join'](_0x29353d,_0x76e227(0x1d2),this[_0x76e227(0x1e2)],_0x76e227(0x1ef))),this[_0x76e227(0x1ec)]={'session':a43_0x2607e3[_0x76e227(0x1d1)](_0x390e9c)?_0x390e9c:null,'project':_0x11f829,'profile':_0x453b80&&a43_0x2607e3[_0x76e227(0x1d1)](_0x453b80)?_0x453b80:null,'profileCredentials':_0xa76b9&&a43_0x2607e3[_0x76e227(0x1d1)](_0xa76b9)?_0xa76b9:null,'global':a43_0x2607e3['existsSync'](_0x17563f)?_0x17563f:null,'globalCredentials':a43_0x2607e3[_0x76e227(0x1d1)](_0x2a3a45)?_0x2a3a45:null};}[a43_0x411c6a(0x1d5)](_0x396ffb,_0x4e7781){const _0x205e3a=a43_0x411c6a;if(!_0x4e7781)return _0x205e3a(0x1ce);const _0x330278=_0x4e7781;if(this[_0x205e3a(0x1e3)][_0x205e3a(0x1c3)][_0x396ffb]===_0x330278){if(_0x396ffb===_0x205e3a(0x1e1)&&_0x330278===_0x205e3a(0x1ee)&&!this[_0x205e3a(0x1e3)][_0x205e3a(0x1cb)][_0x205e3a(0x1e1)]&&!this[_0x205e3a(0x1e3)][_0x205e3a(0x1d6)][_0x205e3a(0x1e1)]&&!this[_0x205e3a(0x1e3)]['profile'][_0x205e3a(0x1e1)]&&!this[_0x205e3a(0x1e3)][_0x205e3a(0x1f0)][_0x205e3a(0x1e1)])return _0x205e3a(0x1bf);return _0x205e3a(0x1c2)+_0x396ffb['replace'](/_/g,'-');}if(this[_0x205e3a(0x1e3)][_0x205e3a(0x1cb)][_0x396ffb]===_0x330278)return _0x205e3a(0x1cb);if(this['layers'][_0x205e3a(0x1d6)][_0x396ffb]===_0x330278)return _0x205e3a(0x1d6);if(this[_0x205e3a(0x1e3)][_0x205e3a(0x1d0)][_0x396ffb]===_0x330278)return _0x205e3a(0x1e7)+this[_0x205e3a(0x1e2)];if(this['layers']['global'][_0x396ffb]===_0x330278)return _0x205e3a(0x1f0);return _0x205e3a(0x1bf);}[a43_0x411c6a(0x1d7)](){const _0x5f5101=a43_0x411c6a,_0x594a36=a43_0x11240b[_0x5f5101(0x1eb)](getConfigDir(),_0x5f5101(0x1bb));if(!a43_0x2607e3[_0x5f5101(0x1d1)](_0x594a36))return{};try{const _0x463707=a43_0x2607e3['readFileSync'](_0x594a36,_0x5f5101(0x1e6));return JSON[_0x5f5101(0x1d8)](_0x463707);}catch{return{};}}[a43_0x411c6a(0x1e4)](_0x46ee1e){const _0x419983=a43_0x411c6a;_0x46ee1e['site']=this[_0x419983(0x1e1)],!_0x46ee1e[_0x419983(0x1c5)]&&this['database']&&(_0x46ee1e[_0x419983(0x1c5)]=this[_0x419983(0x1c5)]),!_0x46ee1e[_0x419983(0x1ed)]&&this[_0x419983(0x1f2)]&&(_0x46ee1e[_0x419983(0x1ed)]=this['parent_segment']),!_0x46ee1e[_0x419983(0x1c7)]&&this[_0x419983(0x1b8)]&&(_0x46ee1e[_0x419983(0x1c7)]=this[_0x419983(0x1b8)]),!_0x46ee1e[_0x419983(0x1dd)]&&this[_0x419983(0x1cd)]&&(_0x46ee1e['llmProject']=this[_0x419983(0x1cd)]);}[a43_0x411c6a(0x1c0)](){const _0x10e6fd=a43_0x411c6a;return[{'key':_0x10e6fd(0x1e1),'value':this['site']},{'key':_0x10e6fd(0x1c5),'value':this[_0x10e6fd(0x1c5)]},{'key':'parent_segment','value':this[_0x10e6fd(0x1f2)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x10e6fd(0x1cd),'value':this[_0x10e6fd(0x1cd)]},{'key':_0x10e6fd(0x1d0),'value':this[_0x10e6fd(0x1e2)]||undefined}];}[a43_0x411c6a(0x1c8)](){const _0x4a21f5=a43_0x411c6a;console[_0x4a21f5(0x1e9)]('[context]');for(const {key:_0x2f17a3,value:_0x35c336}of this[_0x4a21f5(0x1c0)]()){_0x35c336&&console['log'](_0x2f17a3+':\x20'+_0x35c336);}}[a43_0x411c6a(0x1f7)](){const _0x57ae04=a43_0x411c6a;console[_0x57ae04(0x1e9)](_0x57ae04(0x1f4));for(const {key:_0x2e25d5,value:_0xef4994}of this[_0x57ae04(0x1c0)]()){if(_0xef4994){const _0x2f4450=_0x2e25d5==='profile'?'(active)':'('+this['getSource'](_0x2e25d5,_0xef4994)+')';console[_0x57ae04(0x1e9)](_0x2e25d5+':\x20'+_0xef4994+'\x20'+_0x2f4450);}}console[_0x57ae04(0x1e9)](_0x57ae04(0x1ba));const _0x5658bf=[{'label':'Session','path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1cb)],'extra':'(session:\x20'+this[_0x57ae04(0x1c1)]+')'},{'label':'Project','path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1d6)]},{'label':_0x57ae04(0x1ea),'path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1d0)]},{'label':_0x57ae04(0x1d9),'path':this['configFiles']['profileCredentials']},{'label':_0x57ae04(0x1e0),'path':this[_0x57ae04(0x1ec)]['global']},{'label':_0x57ae04(0x1c9),'path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1f1)]}];for(const {label:_0x2a8807,path:_0x3cbf57,extra:_0x5e859c}of _0x5658bf){if(_0x3cbf57)console[_0x57ae04(0x1e9)](_0x2a8807+':\x20'+_0x3cbf57+'\x20✓'+(_0x5e859c?'\x20'+_0x5e859c:''));else{if(_0x2a8807===_0x57ae04(0x1d3))console[_0x57ae04(0x1e9)](_0x2a8807+_0x57ae04(0x1f3)+this[_0x57ae04(0x1c1)]+')');else(_0x2a8807===_0x57ae04(0x1ca)||_0x2a8807===_0x57ae04(0x1e0))&&console[_0x57ae04(0x1e9)](_0x2a8807+_0x57ae04(0x1cc));}}}async['resolveAPIKeyAsync'](){const _0x4dd2bc=a43_0x411c6a;return this[_0x4dd2bc(0x1df)]=await getAPIKeyAsync(this[_0x4dd2bc(0x1e1)],this[_0x4dd2bc(0x1e2)]||undefined),this[_0x4dd2bc(0x1df)];}static async['createAsync'](_0x52ade5){const _0x10a939=a43_0x411c6a,_0x29da27=new GlobalContext(_0x52ade5);return await _0x29da27[_0x10a939(0x1f6)](),_0x29da27;}}
|
|
1
|
+
function a43_0x4110(){const _0x394592=['parse','getSource','58670zYJBPJ','getParameters','project','tdx.json','728TxWRBh',':\x20none\x20(using\x20session:\x20','configFiles','6430176cpqsZj','layers','resolveAPIKeyAsync','(session:\x20','existsSync','globalCredentials','llm_project','INFO','default','log','Profile','loadGlobalConfig','profileCredentials','\x0a[configuration\x20files]','entries','4781RXIRfM','profile:\x20','global','Global\x20Credentials','parentSegment','.json','[context]','7047PjJTOK','cliFlags','config','injectIntoOptions','(active)','397426vGDRFf','174lQDfRt','882288fKEsQx','parent_segment','not\x20set','sessionId','join','25083230TgFBEz','readFileSync','.env','profiles','llmProject','replace','site','segment_path','logLevel','activeProfile','profile','Profile\x20Credentials','apiKey','session','us01','segmentPath','display','236FIfrtD','database','string','Session','Global','verbose','Project'];a43_0x4110=function(){return _0x394592;};return a43_0x4110();}const a43_0x6a9d13=a43_0x43c1;(function(_0x22f43e,_0x18327f){const _0xebfd00=a43_0x43c1,_0x350cf0=_0x22f43e();while(!![]){try{const _0xf8fa50=-parseInt(_0xebfd00(0x1f4))/0x1+-parseInt(_0xebfd00(0x1f5))/0x2*(parseInt(_0xebfd00(0x1ef))/0x3)+-parseInt(_0xebfd00(0x1c9))/0x4*(parseInt(_0xebfd00(0x1d2))/0x5)+-parseInt(_0xebfd00(0x1f6))/0x6+parseInt(_0xebfd00(0x1e8))/0x7*(parseInt(_0xebfd00(0x1d6))/0x8)+-parseInt(_0xebfd00(0x1d9))/0x9+parseInt(_0xebfd00(0x1b8))/0xa;if(_0xf8fa50===_0x18327f)break;else _0x350cf0['push'](_0x350cf0['shift']());}catch(_0x7b4ade){_0x350cf0['push'](_0x350cf0['shift']());}}}(a43_0x4110,0x65495));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a43_0x43c1(_0x982a51,_0x319e23){const _0x4110cf=a43_0x4110();return a43_0x43c1=function(_0x43c1fd,_0x2095b5){_0x43c1fd=_0x43c1fd-0x1b5;let _0x3a6641=_0x4110cf[_0x43c1fd];return _0x3a6641;},a43_0x43c1(_0x982a51,_0x319e23);}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_0x27884a from'node:fs';import*as a43_0x451732 from'node:path';export class GlobalContext{[a43_0x6a9d13(0x1be)];['database'];[a43_0x6a9d13(0x1f7)];[a43_0x6a9d13(0x1bf)];[a43_0x6a9d13(0x1df)];['apiKey'];[a43_0x6a9d13(0x1ce)];[a43_0x6a9d13(0x1c0)];['profile'];[a43_0x6a9d13(0x1da)];[a43_0x6a9d13(0x1c1)];[a43_0x6a9d13(0x1b6)];[a43_0x6a9d13(0x1d8)];constructor(_0x1e1309){const _0x402661=a43_0x6a9d13;this[_0x402661(0x1b6)]=_0x1e1309['session']||getCurrentSessionPID()['toString']();const _0x1bba40=loadSessionContext(_0x1e1309[_0x402661(0x1c5)]),_0x4aadbd=loadProjectConfig(),_0x4bfbbc=this[_0x402661(0x1e4)]();this[_0x402661(0x1c1)]=_0x1e1309[_0x402661(0x1c2)]||_0x1bba40?.[_0x402661(0x1c2)]||_0x4bfbbc[_0x402661(0x1c2)]||getActiveProfile();const _0x47cdce=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x22ca1e=_0x57cd28=>{const _0x331ce2=_0x402661;if(!_0x57cd28)return{};const _0x1afbf8=_0x57cd28,_0x40fdcc={};for(const [_0x586d2d,_0x1321f1]of Object[_0x331ce2(0x1e7)](_0x1afbf8)){typeof _0x1321f1===_0x331ce2(0x1cb)&&(_0x40fdcc[_0x586d2d]=_0x1321f1);}return _0x40fdcc;},_0x5e3c4a={};if(_0x1e1309[_0x402661(0x1be)]&&_0x1e1309[_0x402661(0x1be)]!==_0x402661(0x1c6))_0x5e3c4a[_0x402661(0x1be)]=_0x1e1309['site'];const _0x45c406=_0x1bba40?.[_0x402661(0x1ca)],_0x17a19d=_0x4aadbd?.[_0x402661(0x1ca)],_0x31b3c4=_0x47cdce?.['config']?.[_0x402661(0x1ca)],_0x449116=_0x4bfbbc[_0x402661(0x1ca)];_0x1e1309[_0x402661(0x1ca)]&&(_0x1e1309[_0x402661(0x1ca)]!==_0x45c406&&_0x1e1309['database']!==_0x17a19d&&_0x1e1309[_0x402661(0x1ca)]!==_0x31b3c4&&_0x1e1309[_0x402661(0x1ca)]!==_0x449116)&&(_0x5e3c4a[_0x402661(0x1ca)]=_0x1e1309[_0x402661(0x1ca)]);if(_0x1e1309['parentSegment'])_0x5e3c4a['parent_segment']=_0x1e1309[_0x402661(0x1ec)];if(_0x1e1309[_0x402661(0x1bc)])_0x5e3c4a['llm_project']=_0x1e1309['llmProject'];if(_0x1e1309[_0x402661(0x1c2)])_0x5e3c4a[_0x402661(0x1c2)]=_0x1e1309['profile'];this[_0x402661(0x1da)]={'cliFlags':_0x5e3c4a,'session':_0x22ca1e(_0x1bba40),'project':_0x22ca1e(_0x4aadbd),'profile':_0x22ca1e(_0x47cdce?.[_0x402661(0x1f1)]),'global':_0x22ca1e(_0x4bfbbc)};const _0x30abd3={...this[_0x402661(0x1da)][_0x402661(0x1ea)],...this[_0x402661(0x1da)]['profile'],...this[_0x402661(0x1da)][_0x402661(0x1d4)],...this[_0x402661(0x1da)][_0x402661(0x1c5)],...this[_0x402661(0x1da)][_0x402661(0x1f0)]},_0x4867e9=_0x30abd3[_0x402661(0x1be)]||_0x402661(0x1c6);this[_0x402661(0x1be)]=resolveSite(_0x4867e9),this[_0x402661(0x1ca)]=_0x30abd3[_0x402661(0x1ca)],this['parent_segment']=_0x30abd3[_0x402661(0x1f7)],this[_0x402661(0x1bf)]=_0x30abd3[_0x402661(0x1bf)],this[_0x402661(0x1df)]=_0x30abd3[_0x402661(0x1df)],this['verbose']=_0x1e1309[_0x402661(0x1ce)]||![],this[_0x402661(0x1c0)]=_0x1e1309['logLevel']??LogLevel[_0x402661(0x1e0)],this[_0x402661(0x1c2)]=this[_0x402661(0x1c1)]||undefined,this[_0x402661(0x1c4)]=getAPIKey(this[_0x402661(0x1be)],this[_0x402661(0x1c1)]||undefined);const _0x2009b3=getConfigDir(),_0x107407=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,'sessions',this['sessionId']+_0x402661(0x1ed)),_0x2a089e=findProjectConfigPath(),_0x2955da=a43_0x451732['join'](_0x2009b3,_0x402661(0x1d5)),_0xe244d2=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,_0x402661(0x1ba));let _0x2b4c99=null,_0x2360d0=null;this[_0x402661(0x1c1)]&&(_0x2b4c99=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,_0x402661(0x1bb),this[_0x402661(0x1c1)],_0x402661(0x1d5)),_0x2360d0=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,'profiles',this[_0x402661(0x1c1)],_0x402661(0x1ba))),this[_0x402661(0x1d8)]={'session':a43_0x27884a['existsSync'](_0x107407)?_0x107407:null,'project':_0x2a089e,'profile':_0x2b4c99&&a43_0x27884a[_0x402661(0x1dd)](_0x2b4c99)?_0x2b4c99:null,'profileCredentials':_0x2360d0&&a43_0x27884a[_0x402661(0x1dd)](_0x2360d0)?_0x2360d0:null,'global':a43_0x27884a[_0x402661(0x1dd)](_0x2955da)?_0x2955da:null,'globalCredentials':a43_0x27884a[_0x402661(0x1dd)](_0xe244d2)?_0xe244d2:null};}[a43_0x6a9d13(0x1d1)](_0x40a14c,_0x3f1519){const _0x29c543=a43_0x6a9d13;if(!_0x3f1519)return _0x29c543(0x1b5);const _0x3b9f2c=_0x3f1519;if(this[_0x29c543(0x1da)][_0x29c543(0x1f0)][_0x40a14c]===_0x3b9f2c){if(_0x40a14c==='site'&&_0x3b9f2c===_0x29c543(0x1c6)&&!this[_0x29c543(0x1da)][_0x29c543(0x1c5)]['site']&&!this[_0x29c543(0x1da)][_0x29c543(0x1d4)]['site']&&!this[_0x29c543(0x1da)][_0x29c543(0x1c2)]['site']&&!this[_0x29c543(0x1da)][_0x29c543(0x1ea)][_0x29c543(0x1be)])return _0x29c543(0x1e1);return'CLI\x20flag:\x20--'+_0x40a14c[_0x29c543(0x1bd)](/_/g,'-');}if(this['layers'][_0x29c543(0x1c5)][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1c5);if(this[_0x29c543(0x1da)]['project'][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1d4);if(this[_0x29c543(0x1da)][_0x29c543(0x1c2)][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1e9)+this[_0x29c543(0x1c1)];if(this[_0x29c543(0x1da)]['global'][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1ea);return _0x29c543(0x1e1);}[a43_0x6a9d13(0x1e4)](){const _0x238856=a43_0x6a9d13,_0x43d2b2=a43_0x451732[_0x238856(0x1b7)](getConfigDir(),_0x238856(0x1d5));if(!a43_0x27884a[_0x238856(0x1dd)](_0x43d2b2))return{};try{const _0x512de0=a43_0x27884a[_0x238856(0x1b9)](_0x43d2b2,'utf-8');return JSON[_0x238856(0x1d0)](_0x512de0);}catch{return{};}}[a43_0x6a9d13(0x1f2)](_0x4e3cbf){const _0x4a34fb=a43_0x6a9d13;_0x4e3cbf['site']=this[_0x4a34fb(0x1be)],!_0x4e3cbf['database']&&this[_0x4a34fb(0x1ca)]&&(_0x4e3cbf[_0x4a34fb(0x1ca)]=this[_0x4a34fb(0x1ca)]),!_0x4e3cbf['parentSegment']&&this[_0x4a34fb(0x1f7)]&&(_0x4e3cbf[_0x4a34fb(0x1ec)]=this[_0x4a34fb(0x1f7)]),!_0x4e3cbf[_0x4a34fb(0x1c7)]&&this[_0x4a34fb(0x1bf)]&&(_0x4e3cbf['segmentPath']=this[_0x4a34fb(0x1bf)]),!_0x4e3cbf[_0x4a34fb(0x1bc)]&&this[_0x4a34fb(0x1df)]&&(_0x4e3cbf[_0x4a34fb(0x1bc)]=this[_0x4a34fb(0x1df)]);}[a43_0x6a9d13(0x1d3)](){const _0xdc7488=a43_0x6a9d13;return[{'key':_0xdc7488(0x1be),'value':this['site']},{'key':_0xdc7488(0x1ca),'value':this[_0xdc7488(0x1ca)]},{'key':_0xdc7488(0x1f7),'value':this[_0xdc7488(0x1f7)]},{'key':_0xdc7488(0x1bf),'value':this['segment_path']},{'key':_0xdc7488(0x1df),'value':this[_0xdc7488(0x1df)]},{'key':'profile','value':this[_0xdc7488(0x1c1)]||undefined}];}[a43_0x6a9d13(0x1c8)](){const _0x567905=a43_0x6a9d13;console['log'](_0x567905(0x1ee));for(const {key:_0x40f4dd,value:_0xe296f0}of this[_0x567905(0x1d3)]()){_0xe296f0&&console[_0x567905(0x1e2)](_0x40f4dd+':\x20'+_0xe296f0);}}['displayWithSources'](){const _0x2cf765=a43_0x6a9d13;console['log']('[context]');for(const {key:_0x72c70a,value:_0xf4b04f}of this[_0x2cf765(0x1d3)]()){if(_0xf4b04f){const _0x13f98c=_0x72c70a===_0x2cf765(0x1c2)?_0x2cf765(0x1f3):'('+this[_0x2cf765(0x1d1)](_0x72c70a,_0xf4b04f)+')';console[_0x2cf765(0x1e2)](_0x72c70a+':\x20'+_0xf4b04f+'\x20'+_0x13f98c);}}console[_0x2cf765(0x1e2)](_0x2cf765(0x1e6));const _0x44e29f=[{'label':'Session','path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1c5)],'extra':_0x2cf765(0x1dc)+this['sessionId']+')'},{'label':_0x2cf765(0x1cf),'path':this['configFiles'][_0x2cf765(0x1d4)]},{'label':_0x2cf765(0x1e3),'path':this['configFiles'][_0x2cf765(0x1c2)]},{'label':_0x2cf765(0x1c3),'path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1e5)]},{'label':_0x2cf765(0x1cd),'path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1ea)]},{'label':_0x2cf765(0x1eb),'path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1de)]}];for(const {label:_0x55bd08,path:_0x2da4f8,extra:_0x52c35}of _0x44e29f){if(_0x2da4f8)console[_0x2cf765(0x1e2)](_0x55bd08+':\x20'+_0x2da4f8+'\x20✓'+(_0x52c35?'\x20'+_0x52c35:''));else{if(_0x55bd08===_0x2cf765(0x1cc))console[_0x2cf765(0x1e2)](_0x55bd08+_0x2cf765(0x1d7)+this[_0x2cf765(0x1b6)]+')');else(_0x55bd08===_0x2cf765(0x1cf)||_0x55bd08==='Global')&&console['log'](_0x55bd08+':\x20none');}}}async['resolveAPIKeyAsync'](){const _0x1ae939=a43_0x6a9d13;return this[_0x1ae939(0x1c4)]=await getAPIKeyAsync(this['site'],this[_0x1ae939(0x1c1)]||undefined),this['apiKey'];}static async['createAsync'](_0xc333b8){const _0x3c18cd=a43_0x6a9d13,_0xfbaa45=new GlobalContext(_0xc333b8);return await _0xfbaa45[_0x3c18cd(0x1db)](),_0xfbaa45;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a44_0x2d88bd=a44_0x2b9b;(function(_0x3a3e77,_0x1757db){const _0x32aa0f=a44_0x2b9b,_0x5101f5=_0x3a3e77();while(!![]){try{const _0x35a414=-parseInt(_0x32aa0f(0x97))/0x1*(-parseInt(_0x32aa0f(0xa8))/0x2)+parseInt(_0x32aa0f(0x9a))/0x3*(parseInt(_0x32aa0f(0x8e))/0x4)+parseInt(_0x32aa0f(0x94))/0x5*(-parseInt(_0x32aa0f(0xa1))/0x6)+parseInt(_0x32aa0f(0xa2))/0x7*(parseInt(_0x32aa0f(0x92))/0x8)+-parseInt(_0x32aa0f(0x87))/0x9*(parseInt(_0x32aa0f(0x99))/0xa)+parseInt(_0x32aa0f(0x89))/0xb+-parseInt(_0x32aa0f(0x9e))/0xc*(-parseInt(_0x32aa0f(0x90))/0xd);if(_0x35a414===_0x1757db)break;else _0x5101f5['push'](_0x5101f5['shift']());}catch(_0x11a71a){_0x5101f5['push'](_0x5101f5['shift']());}}}(a44_0x3c52,0x1cf47));const SERVICE_NAME=a44_0x2d88bd(0xa4);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x35b9d1=a44_0x2d88bd;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x575506=await import(_0x35b9d1(0x9b));return keyringModule=_0x575506[_0x35b9d1(0x8f)],keyringModule;}catch(_0x2c56b7){return keyringLoadError=_0x2c56b7 instanceof Error?_0x2c56b7:new Error(String(_0x2c56b7)),null;}}function getAccountName(_0x5dda63){const _0x2f17ed=a44_0x2d88bd,_0x7a7a9e=_0x5dda63||'';return _0x2f17ed(0xa0)+_0x7a7a9e+_0x2f17ed(0xa3);}function a44_0x3c52(){const _0x2a88f5=['unavailable','38249zStVBp','includes','130oaUGvd','3xvtkQe','@zowe/secrets-for-zowe-sdk','not\x20supported','Warning:\x20','3996rKcHqX','toLowerCase','profile:','366LRzarB','14vtLofc',':api_key','tdx','deletePassword','setPassword','message','6VlfDah','value','restricted','could\x20not\x20be\x20found','108873EnWbrA','cannot\x20find','872069wHaJDj','error','getPassword','success','access_denied','642244laLFFx','keyring','1950PeocoP','System\x20keychain\x20is\x20not\x20available','202408JkVFTb','-25300','14695xhEBND','access'];a44_0x3c52=function(){return _0x2a88f5;};return a44_0x3c52();}export async function getKeychainAPIKey(_0x5da976){const _0x156a8d=a44_0x2d88bd,_0x51cbec=await getKeychainAPIKeyWithStatus(_0x5da976);if(_0x51cbec[_0x156a8d(0x8c)])return _0x51cbec[_0x156a8d(0xa9)];return _0x51cbec['reason']===_0x156a8d(0x8d)&&console[_0x156a8d(0x8a)](_0x156a8d(0x9d)+_0x51cbec[_0x156a8d(0xa7)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3f1aaf){const _0x404aea=a44_0x2d88bd;try{const _0x195454=await getKeyring();if(!_0x195454)return{'success':![],'reason':_0x404aea(0x96)};const _0x38d523=getAccountName(_0x3f1aaf),_0x45c358=await _0x195454[_0x404aea(0x8b)](SERVICE_NAME,_0x38d523);if(_0x45c358)return{'success':!![],'value':_0x45c358};return{'success':![],'reason':'not_found'};}catch(_0x487df2){const _0xbd6164=_0x487df2 instanceof Error?_0x487df2[_0x404aea(0xa7)]:String(_0x487df2);if(_0xbd6164[_0x404aea(0x98)](_0x404aea(0x93))||_0xbd6164[_0x404aea(0x9f)]()['includes'](_0x404aea(0x86))||_0xbd6164[_0x404aea(0x9f)]()[_0x404aea(0x98)]('not\x20found'))return{'success':![],'reason':'not_found'};if(_0xbd6164[_0x404aea(0x98)]('-25293')||_0xbd6164[_0x404aea(0x9f)]()[_0x404aea(0x98)](_0x404aea(0x85))||_0xbd6164[_0x404aea(0x9f)]()['includes'](_0x404aea(0x95)))return{'success':![],'reason':_0x404aea(0x8d),'message':'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.'};return{'success':![],'reason':_0x404aea(0x96),'message':_0xbd6164};}}export async function saveKeychainAPIKey(_0xbc1e35,_0x5baf39){const _0x47fba7=a44_0x2d88bd,_0x409147=await getKeyring();if(!_0x409147)throw new Error(_0x47fba7(0x91));const _0x24e322=getAccountName(_0x5baf39);await _0x409147[_0x47fba7(0xa6)](SERVICE_NAME,_0x24e322,_0xbc1e35);}export async function deleteKeychainAPIKey(_0x3047ab){const _0x4627f4=a44_0x2d88bd;try{const _0x4ae2c7=await getKeyring();if(!_0x4ae2c7)return![];const _0x1d416a=getAccountName(_0x3047ab);return await _0x4ae2c7[_0x4627f4(0xa5)](SERVICE_NAME,_0x1d416a);}catch{return![];}}function a44_0x2b9b(_0x38bea0,_0x27b65b){const _0x3c52c3=a44_0x3c52();return a44_0x2b9b=function(_0x2b9b9f,_0x2bd699){_0x2b9b9f=_0x2b9b9f-0x85;let _0x41d950=_0x3c52c3[_0x2b9b9f];return _0x41d950;},a44_0x2b9b(_0x38bea0,_0x27b65b);}export async function isKeychainAvailable(){const _0x394302=a44_0x2d88bd;try{const _0x540d5c=await getKeyring();if(!_0x540d5c)return![];return await _0x540d5c[_0x394302(0x8b)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x109758){const _0xca3e5=_0x109758 instanceof Error?_0x109758[_0x394302(0xa7)][_0x394302(0x9f)]():'';if(_0xca3e5[_0x394302(0x98)]('not\x20available')||_0xca3e5[_0x394302(0x98)](_0x394302(0x9c))||_0xca3e5['includes'](_0x394302(0x88)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5608b9,_0x3ee7b8){const _0x352c77=a45_0x8328,_0x16b7b9=_0x5608b9();while(!![]){try{const _0x5a8f38=-parseInt(_0x352c77(0xbe))/0x1*(parseInt(_0x352c77(0xbc))/0x2)+-parseInt(_0x352c77(0xe0))/0x3+parseInt(_0x352c77(0xb1))/0x4*(parseInt(_0x352c77(0xa6))/0x5)+parseInt(_0x352c77(0xd8))/0x6+-parseInt(_0x352c77(0xce))/0x7*(parseInt(_0x352c77(0xad))/0x8)+-parseInt(_0x352c77(0xb5))/0x9+-parseInt(_0x352c77(0xaf))/0xa*(-parseInt(_0x352c77(0xc3))/0xb);if(_0x5a8f38===_0x3ee7b8)break;else _0x16b7b9['push'](_0x16b7b9['shift']());}catch(_0x29f068){_0x16b7b9['push'](_0x16b7b9['shift']());}}}(a45_0x5aea,0x28069));import*as a45_0x4b30ac from'node:fs';import*as a45_0x5a6d28 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';function a45_0x8328(_0x21dbbf,_0x7cd7aa){const _0x5aea3f=a45_0x5aea();return a45_0x8328=function(_0x83281e,_0x18334d){_0x83281e=_0x83281e-0xa6;let _0x2e2a9a=_0x5aea3f[_0x83281e];return _0x2e2a9a;},a45_0x8328(_0x21dbbf,_0x7cd7aa);}import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x949562){const _0x28e370=a45_0x8328,_0x2f6419={};if(!_0x949562)return _0x2f6419;for(const [_0xaf191a,_0x5479e9]of Object[_0x28e370(0xae)](_0x949562)){_0xaf191a!=='description'&&_0x5479e9!==undefined&&(_0x2f6419[_0xaf191a]=_0x5479e9);}return _0x2f6419;}export function getProfilesDir(){const _0x1973a8=a45_0x8328;return a45_0x5a6d28[_0x1973a8(0xd1)](getConfigDir(),_0x1973a8(0xe8));}function getProfileDir(_0x13a99f){const _0x5c769e=a45_0x8328;return a45_0x5a6d28[_0x5c769e(0xd1)](getProfilesDir(),_0x13a99f);}function getProfileConfigPath(_0x471467){const _0x17b9a5=a45_0x8328;return a45_0x5a6d28['join'](getProfileDir(_0x471467),_0x17b9a5(0xcf));}function getProfileEnvPath(_0x52e690){const _0x5c3dc7=a45_0x8328;return a45_0x5a6d28[_0x5c3dc7(0xd1)](getProfileDir(_0x52e690),_0x5c3dc7(0xab));}function getGlobalConfigPath(){const _0x4c505e=a45_0x8328;return a45_0x5a6d28['join'](getConfigDir(),_0x4c505e(0xcf));}function validateProfileName(_0x1bd230){const _0x160da5=a45_0x8328;if(!/^[a-zA-Z0-9_-]+$/[_0x160da5(0xec)](_0x1bd230))throw new Error('Invalid\x20profile\x20name:\x20'+_0x1bd230+_0x160da5(0xe7));}function validateProfileConfig(_0x44cbfb,_0x165e7c){const _0x33e12c=a45_0x8328;if(typeof _0x44cbfb!==_0x33e12c(0xa9)||_0x44cbfb===null)throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xb4));const _0x2fb859=['description',_0x33e12c(0xe2),'database',_0x33e12c(0xd4),_0x33e12c(0xee),_0x33e12c(0xb3)],_0x33dc84=_0x44cbfb;for(const _0x229d06 of Object[_0x33e12c(0xb7)](_0x33dc84)){!_0x2fb859['includes'](_0x229d06)&&console[_0x33e12c(0xcc)](_0x33e12c(0xc7)+_0x165e7c+_0x33e12c(0xb6)+_0x229d06+'\x27\x20will\x20be\x20ignored');}if(_0x33dc84[_0x33e12c(0xd6)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xd6)]!=='string')throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xea));if(_0x33dc84['site']!==undefined&&typeof _0x33dc84[_0x33e12c(0xe2)]!==_0x33e12c(0xd3))throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xef));if(_0x33dc84[_0x33e12c(0xe1)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xe1)]!=='string')throw new Error(_0x33e12c(0xbd)+_0x165e7c+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x33dc84[_0x33e12c(0xd4)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xd4)]!==_0x33e12c(0xd3))throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xbb));if(_0x33dc84[_0x33e12c(0xee)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xee)]!=='string')throw new Error(_0x33e12c(0xbd)+_0x165e7c+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x33dc84[_0x33e12c(0xb3)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xb3)]!==_0x33e12c(0xd3))throw new Error('Profile\x20\x27'+_0x165e7c+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x1b405e,_0x2879dc){const _0x43449a=a45_0x8328;if(!a45_0x4b30ac[_0x43449a(0xd0)](_0x1b405e))return[];try{const _0x50c677=a45_0x4b30ac[_0x43449a(0xc9)](_0x1b405e,_0x43449a(0xac)),_0xdd4862=JSON['parse'](_0x50c677);if(!_0xdd4862[_0x43449a(0xe8)]||typeof _0xdd4862['profiles']!==_0x43449a(0xa9))return[];const _0xa868f4=[];for(const [_0x3ac324,_0x1e6e25]of Object[_0x43449a(0xae)](_0xdd4862['profiles'])){try{validateProfileConfig(_0x1e6e25,_0x3ac324);const _0xf99518=getNewCredentialPath(_0x3ac324),_0xdd0611=getOldCredentialPath(_0x3ac324),_0x41a31c=a45_0x4b30ac[_0x43449a(0xd0)](_0xf99518)||a45_0x4b30ac[_0x43449a(0xd0)](_0xdd0611);_0xa868f4[_0x43449a(0xcb)]({'name':_0x3ac324,'config':_0x1e6e25,'metadata':{'name':_0x3ac324,'createdAt':new Date()[_0x43449a(0xde)]()},'hasCredentials':_0x41a31c,'scope':_0x2879dc});}catch(_0x84ab94){_0x84ab94 instanceof Error&&(console[_0x43449a(0xcc)](_0x43449a(0xdc)+_0x1b405e+':'),console[_0x43449a(0xcc)]('\x20\x20'+_0x84ab94[_0x43449a(0xdb)]+'\x0a'));}}return _0xa868f4;}catch(_0x137da5){return _0x137da5 instanceof SyntaxError?(console[_0x43449a(0xcc)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x1b405e+':\x20Invalid\x20JSON\x20syntax'),console[_0x43449a(0xcc)](_0x43449a(0xaa)+_0x137da5[_0x43449a(0xdb)]+'\x0a')):console[_0x43449a(0xcc)](_0x43449a(0xc8)+_0x1b405e+':\x20'+_0x137da5+'\x0a'),[];}}export function getNewCredentialPath(_0x3106a0){const _0x389ff6=a45_0x8328;return a45_0x5a6d28['join'](getConfigDir(),_0x389ff6(0xbf)+_0x3106a0);}function getOldCredentialPath(_0x155506){const _0xb9ac2b=a45_0x8328;return a45_0x5a6d28[_0xb9ac2b(0xd1)](getProfilesDir(),_0x155506,_0xb9ac2b(0xab));}function loadProfilesFromTdxJsonFiles(){const _0x13df82=a45_0x8328,_0x262820=[],_0x4334a9=findProjectConfigPath();_0x4334a9&&_0x262820['push'](...loadProfilesFromTdxJson(_0x4334a9,_0x13df82(0xc4)));const _0x2abb9b=a45_0x5a6d28[_0x13df82(0xd1)](getConfigDir(),_0x13df82(0xcf));return _0x262820[_0x13df82(0xcb)](...loadProfilesFromTdxJson(_0x2abb9b,_0x13df82(0xe3))),_0x262820;}function loadProfilesFromDirectories(){const _0x350e3f=a45_0x8328,_0x3e58ec=getProfilesDir();if(!a45_0x4b30ac['existsSync'](_0x3e58ec))return[];try{return a45_0x4b30ac[_0x350e3f(0xba)](_0x3e58ec,{'withFileTypes':!![]})['filter'](_0x52f1c7=>_0x52f1c7[_0x350e3f(0xa7)]())[_0x350e3f(0xe9)](_0x8edc3=>_0x8edc3[_0x350e3f(0xb9)])[_0x350e3f(0xed)](_0x5b9a9e=>{const _0x2ed0d8=_0x350e3f,_0x5f028e=getProfileConfigPath(_0x5b9a9e),_0x33c77d=getProfileEnvPath(_0x5b9a9e);return a45_0x4b30ac[_0x2ed0d8(0xd0)](_0x5f028e)||a45_0x4b30ac['existsSync'](_0x33c77d);})[_0x350e3f(0xe9)](_0xec5c03=>{const _0x1fabca=_0x350e3f,_0x1d2e19=loadProfileFromDirectory(_0xec5c03);if(_0x1d2e19)return{..._0x1d2e19,'scope':_0x1fabca(0xc5)};return null;})[_0x350e3f(0xed)](_0x23887c=>_0x23887c!==null);}catch{return[];}}function loadProfileFromDirectory(_0x1ed1d3){const _0x571135=a45_0x8328,_0x3d6023=getProfileConfigPath(_0x1ed1d3),_0x4fd914=getOldCredentialPath(_0x1ed1d3);if(!a45_0x4b30ac[_0x571135(0xd0)](_0x3d6023)&&!a45_0x4b30ac[_0x571135(0xd0)](_0x4fd914))return null;let _0x48e128={},_0x33a874={'name':_0x1ed1d3,'createdAt':new Date()['toISOString']()};if(a45_0x4b30ac[_0x571135(0xd0)](_0x3d6023))try{const _0x130c44=a45_0x4b30ac[_0x571135(0xc9)](_0x3d6023,_0x571135(0xac)),_0x193b1c=JSON[_0x571135(0xc0)](_0x130c44),{metadata:_0x21756d,..._0x336585}=_0x193b1c;_0x48e128=_0x336585,_0x21756d&&(_0x33a874=_0x21756d);}catch{}return{'name':_0x1ed1d3,'config':_0x48e128,'metadata':_0x33a874,'hasCredentials':a45_0x4b30ac['existsSync'](_0x4fd914),'scope':'directory'};}export function listProfiles(){const _0x4a7af5=a45_0x8328,_0x59abdf=loadProfilesFromTdxJsonFiles(),_0x5295d5=loadProfilesFromDirectories();if(_0x5295d5[_0x4a7af5(0xc1)]>0x0){const _0x42f72e=_0x5295d5[_0x4a7af5(0xe9)](_0x2cd7f1=>_0x2cd7f1['name'])[_0x4a7af5(0xd1)](',\x20'),_0x5a2f37=getConfigDir();console[_0x4a7af5(0xcc)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x42f72e),console[_0x4a7af5(0xcc)](_0x4a7af5(0xe6)),console[_0x4a7af5(0xcc)](_0x4a7af5(0xc6)+a45_0x5a6d28[_0x4a7af5(0xd1)](_0x5a2f37,_0x4a7af5(0xcf))),console[_0x4a7af5(0xcc)](_0x4a7af5(0xdd)),console[_0x4a7af5(0xcc)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x7a1a99=[..._0x59abdf,..._0x5295d5],_0x32c23e=new Map();for(const _0x5414b9 of _0x7a1a99){!_0x32c23e[_0x4a7af5(0xd7)](_0x5414b9[_0x4a7af5(0xb9)])&&_0x32c23e[_0x4a7af5(0xd2)](_0x5414b9[_0x4a7af5(0xb9)],_0x5414b9);}return Array['from'](_0x32c23e[_0x4a7af5(0xd9)]())['sort']((_0x807ca2,_0x11080a)=>_0x807ca2[_0x4a7af5(0xb9)][_0x4a7af5(0xdf)](_0x11080a[_0x4a7af5(0xb9)]));}export function profileExists(_0x5bc862){const _0x557576=a45_0x8328,_0x2dde5d=listProfiles();return _0x2dde5d[_0x557576(0xa8)](_0x50d1ba=>_0x50d1ba[_0x557576(0xb9)]===_0x5bc862);}export function loadProfile(_0x4753c8){const _0x40f599=a45_0x8328;validateProfileName(_0x4753c8);const _0xf82cad=listProfiles(),_0x4c8ac0=_0xf82cad[_0x40f599(0xd5)](_0x5da69c=>_0x5da69c['name']===_0x4753c8);return _0x4c8ac0||null;}export function saveProfile(_0x2398d0,_0x109c9c,_0x1c1b37=![]){saveProfileToUserConfig(_0x2398d0,_0x109c9c);}export function deleteProfile(_0xbf5120){const _0x587e1a=a45_0x8328;validateProfileName(_0xbf5120);const _0xf59109=getProfileDir(_0xbf5120);if(!a45_0x4b30ac['existsSync'](_0xf59109))throw new Error(_0x587e1a(0xe4)+_0xbf5120+_0x587e1a(0xb2));a45_0x4b30ac['rmSync'](_0xf59109,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x39f9e8,_0x27662b){const _0x512171=a45_0x8328;validateProfileName(_0x39f9e8);const _0x32661a=getGlobalConfigPath(),_0x5cefe6=getConfigDir();!a45_0x4b30ac[_0x512171(0xd0)](_0x5cefe6)&&createSecureDirectory(_0x5cefe6);let _0x144741={};if(a45_0x4b30ac[_0x512171(0xd0)](_0x32661a))try{const _0x6b22a7=a45_0x4b30ac['readFileSync'](_0x32661a,_0x512171(0xac));_0x144741=JSON['parse'](_0x6b22a7);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x32661a+_0x512171(0xb8));}!_0x144741[_0x512171(0xe8)]&&(_0x144741[_0x512171(0xe8)]={}),_0x144741['profiles'][_0x39f9e8]=_0x27662b,writeSecureFile(_0x32661a,JSON[_0x512171(0xda)](_0x144741,null,0x2));}export function getActiveProfile(){const _0x26936f=a45_0x8328,_0x35f5ba=loadSessionContext();if(_0x35f5ba?.['profile'])return _0x35f5ba['profile'];const _0x96b51a=getGlobalConfigPath();if(!a45_0x4b30ac[_0x26936f(0xd0)](_0x96b51a))return null;try{const _0x245ed4=a45_0x4b30ac['readFileSync'](_0x96b51a,_0x26936f(0xac)),_0x42b4e2=JSON[_0x26936f(0xc0)](_0x245ed4);return _0x42b4e2[_0x26936f(0xca)]||null;}catch{return null;}}export function createProfile(_0x547ccb,_0x250524){const _0x134733=a45_0x8328;validateProfileName(_0x547ccb);if(profileExists(_0x547ccb))throw new Error(_0x134733(0xe4)+_0x547ccb+_0x134733(0xb0));saveProfile(_0x547ccb,_0x250524);}function a45_0x5aea(){const _0x4f75a4=['\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','33140mOtSYE','isDirectory','some','object','Error:\x20','.env','utf-8','688starus','entries','60130kBEpCs','\x20already\x20exists','16CmdhcI','\x20does\x20not\x20exist','llm_agent','\x27:\x20config\x20must\x20be\x20an\x20object','659943tDddNI','\x27:\x20unknown\x20config\x20key\x20\x27','keys',',\x20creating\x20new\x20file','name','readdirSync','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','2GoUfyR','Profile\x20\x27','144322reDIWJ','.env.','parse','length','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','1375sxWHnE','local','directory','\x20\x201.\x20Edit:\x20','Warning:\x20Profile\x20\x27','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','readFileSync','profile','push','warn','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','24633DSAPnO','tdx.json','existsSync','join','set','string','parent_segment','find','description','has','625452afKkbJ','values','stringify','message','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','toISOString','localeCompare','594453iIdLeT','database','site','user','Profile\x20','\x22\x20\x22','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','profiles','map','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x20\x20mv\x20\x22','test','filter','llm_project'];a45_0x5aea=function(){return _0x4f75a4;};return a45_0x5aea();}export function saveProfileCredentials(_0x9ab8d,_0x618341){validateProfileName(_0x9ab8d);if(!profileExists(_0x9ab8d))throw new Error('Profile\x20'+_0x9ab8d+'\x20does\x20not\x20exist');const _0x470ace=getNewCredentialPath(_0x9ab8d);writeSecureFile(_0x470ace,_0x618341);}export function loadProfileCredentials(_0x343857){const _0xe89108=a45_0x8328;validateProfileName(_0x343857);const _0xcd975=getNewCredentialPath(_0x343857);if(a45_0x4b30ac[_0xe89108(0xd0)](_0xcd975))try{return a45_0x4b30ac[_0xe89108(0xc9)](_0xcd975,_0xe89108(0xac));}catch{}const _0x24a8dd=getOldCredentialPath(_0x343857);if(a45_0x4b30ac[_0xe89108(0xd0)](_0x24a8dd)){console['warn'](_0xe89108(0xc2)+_0x343857+'\x27'),console['warn']('To\x20migrate:'),console[_0xe89108(0xcc)](_0xe89108(0xeb)+_0x24a8dd+_0xe89108(0xe5)+_0xcd975+'\x22'),console[_0xe89108(0xcc)](_0xe89108(0xcd));try{return a45_0x4b30ac[_0xe89108(0xc9)](_0x24a8dd,_0xe89108(0xac));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x116b99,_0xb06e0c){const _0x1c8086=a45_0x5f24,_0x301124=_0x116b99();while(!![]){try{const _0x162777=-parseInt(_0x1c8086(0x1e1))/0x1+parseInt(_0x1c8086(0x1eb))/0x2*(-parseInt(_0x1c8086(0x1b7))/0x3)+-parseInt(_0x1c8086(0x1c9))/0x4*(parseInt(_0x1c8086(0x1c0))/0x5)+parseInt(_0x1c8086(0x1ed))/0x6*(parseInt(_0x1c8086(0x1f2))/0x7)+-parseInt(_0x1c8086(0x1cb))/0x8*(parseInt(_0x1c8086(0x1e6))/0x9)+-parseInt(_0x1c8086(0x1b4))/0xa+-parseInt(_0x1c8086(0x1b0))/0xb*(-parseInt(_0x1c8086(0x1e8))/0xc);if(_0x162777===_0xb06e0c)break;else _0x301124['push'](_0x301124['shift']());}catch(_0x3fe496){_0x301124['push'](_0x301124['shift']());}}}(a45_0x64b0,0xb408e));import*as a45_0x1266c2 from'node:fs';function a45_0x64b0(){const _0x1ba61a=['\x27:\x20unknown\x20config\x20key\x20\x27','local','612jgksgj','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','24bOgVUr','description','\x20already\x20exists','9780COrlaS','some','5793576dYLdQg','readdirSync','parent_segment','includes','\x22\x20\x22','7bPfdOV','keys','.env.','Invalid\x20profile\x20name:\x20','warn','length','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','llm_agent','profile','test','tdx.json','isDirectory','18278942NDEmwl','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','map','site','4621360qrYlFV','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','filter','237sEnjNh','\x20does\x20not\x20exist','user','join','has','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20','Profile\x20\x27','To\x20migrate:','466285imLKDJ','message','\x0aWarning:\x20Failed\x20to\x20parse\x20','values','\x20\x201.\x20Edit:\x20','push','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','object','60cWrzzd','toISOString','41368FGRzzX','string','entries','parse','profiles','directory','from','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','utf-8','name','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x27:\x20config\x20must\x20be\x20an\x20object','existsSync','Warning:\x20Failed\x20to\x20parse\x20','llm_project','sort','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','rmSync','find','readFileSync','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','952689lCJPRZ','database','localeCompare'];a45_0x64b0=function(){return _0x1ba61a;};return a45_0x64b0();}import*as a45_0x310dde 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(_0x431aab){const _0x3bc243=a45_0x5f24,_0x5a4dc9={};if(!_0x431aab)return _0x5a4dc9;for(const [_0x139641,_0x4275b7]of Object[_0x3bc243(0x1cd)](_0x431aab)){_0x139641!==_0x3bc243(0x1e9)&&_0x4275b7!==undefined&&(_0x5a4dc9[_0x139641]=_0x4275b7);}return _0x5a4dc9;}export function getProfilesDir(){const _0x431460=a45_0x5f24;return a45_0x310dde['join'](getConfigDir(),_0x431460(0x1cf));}function getProfileDir(_0x3b2bb1){const _0xe8cfbf=a45_0x5f24;return a45_0x310dde[_0xe8cfbf(0x1ba)](getProfilesDir(),_0x3b2bb1);}function getProfileConfigPath(_0x320aa7){const _0x4da96d=a45_0x5f24;return a45_0x310dde[_0x4da96d(0x1ba)](getProfileDir(_0x320aa7),_0x4da96d(0x1ae));}function getProfileEnvPath(_0x13c553){return a45_0x310dde['join'](getProfileDir(_0x13c553),'.env');}function getGlobalConfigPath(){return a45_0x310dde['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x450251){const _0x2b949c=a45_0x5f24;if(!/^[a-zA-Z0-9_-]+$/[_0x2b949c(0x1ad)](_0x450251))throw new Error(_0x2b949c(0x1f5)+_0x450251+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x5db447,_0x3cb0e0){const _0x502ec7=a45_0x5f24;if(typeof _0x5db447!==_0x502ec7(0x1c8)||_0x5db447===null)throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1d6));const _0x1c8667=[_0x502ec7(0x1e9),_0x502ec7(0x1b3),'database',_0x502ec7(0x1ef),_0x502ec7(0x1d9),_0x502ec7(0x1ab)],_0x5e91c0=_0x5db447;for(const _0x1fb3f5 of Object[_0x502ec7(0x1f3)](_0x5e91c0)){!_0x1c8667[_0x502ec7(0x1f0)](_0x1fb3f5)&&console[_0x502ec7(0x1f6)]('Warning:\x20Profile\x20\x27'+_0x3cb0e0+_0x502ec7(0x1e4)+_0x1fb3f5+'\x27\x20will\x20be\x20ignored');}if(_0x5e91c0[_0x502ec7(0x1e9)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1e9)]!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1d2));if(_0x5e91c0[_0x502ec7(0x1b3)]!==undefined&&typeof _0x5e91c0['site']!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1c7));if(_0x5e91c0[_0x502ec7(0x1e2)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1e2)]!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1b1));if(_0x5e91c0[_0x502ec7(0x1ef)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1ef)]!==_0x502ec7(0x1cc))throw new Error('Profile\x20\x27'+_0x3cb0e0+_0x502ec7(0x1e0));if(_0x5e91c0[_0x502ec7(0x1d9)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1d9)]!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1c6));if(_0x5e91c0[_0x502ec7(0x1ab)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1ab)]!=='string')throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1df));return!![];}function loadProfilesFromTdxJson(_0x54fa2a,_0x5d7079){const _0x3bf992=a45_0x5f24;if(!a45_0x1266c2[_0x3bf992(0x1d7)](_0x54fa2a))return[];try{const _0x17eaed=a45_0x1266c2[_0x3bf992(0x1de)](_0x54fa2a,_0x3bf992(0x1d3)),_0x30f2d0=JSON['parse'](_0x17eaed);if(!_0x30f2d0[_0x3bf992(0x1cf)]||typeof _0x30f2d0[_0x3bf992(0x1cf)]!=='object')return[];const _0x2f5ad0=[];for(const [_0x38df84,_0x2ad4e3]of Object[_0x3bf992(0x1cd)](_0x30f2d0[_0x3bf992(0x1cf)])){try{validateProfileConfig(_0x2ad4e3,_0x38df84);const _0x1500e5=getNewCredentialPath(_0x38df84),_0x45614c=getOldCredentialPath(_0x38df84),_0x57642c=a45_0x1266c2['existsSync'](_0x1500e5)||a45_0x1266c2['existsSync'](_0x45614c);_0x2f5ad0[_0x3bf992(0x1c5)]({'name':_0x38df84,'config':_0x2ad4e3,'metadata':{'name':_0x38df84,'createdAt':new Date()[_0x3bf992(0x1ca)]()},'hasCredentials':_0x57642c,'scope':_0x5d7079});}catch(_0x3669f6){_0x3669f6 instanceof Error&&(console[_0x3bf992(0x1f6)](_0x3bf992(0x1e7)+_0x54fa2a+':'),console[_0x3bf992(0x1f6)]('\x20\x20'+_0x3669f6[_0x3bf992(0x1c1)]+'\x0a'));}}return _0x2f5ad0;}catch(_0x364cd0){return _0x364cd0 instanceof SyntaxError?(console[_0x3bf992(0x1f6)](_0x3bf992(0x1c2)+_0x54fa2a+':\x20Invalid\x20JSON\x20syntax'),console[_0x3bf992(0x1f6)]('Error:\x20'+_0x364cd0['message']+'\x0a')):console[_0x3bf992(0x1f6)](_0x3bf992(0x1b5)+_0x54fa2a+':\x20'+_0x364cd0+'\x0a'),[];}}export function getNewCredentialPath(_0x4d1c79){const _0x232667=a45_0x5f24;return a45_0x310dde[_0x232667(0x1ba)](getConfigDir(),_0x232667(0x1f4)+_0x4d1c79);}function getOldCredentialPath(_0x233a22){return a45_0x310dde['join'](getProfilesDir(),_0x233a22,'.env');}function loadProfilesFromTdxJsonFiles(){const _0xc3bc75=a45_0x5f24,_0x5f03c8=[],_0x391e58=findProjectConfigPath();_0x391e58&&_0x5f03c8['push'](...loadProfilesFromTdxJson(_0x391e58,_0xc3bc75(0x1e5)));const _0x464e4c=a45_0x310dde['join'](getConfigDir(),_0xc3bc75(0x1ae));return _0x5f03c8[_0xc3bc75(0x1c5)](...loadProfilesFromTdxJson(_0x464e4c,_0xc3bc75(0x1b9))),_0x5f03c8;}function loadProfilesFromDirectories(){const _0x2bc44f=a45_0x5f24,_0x1b8702=getProfilesDir();if(!a45_0x1266c2[_0x2bc44f(0x1d7)](_0x1b8702))return[];try{return a45_0x1266c2[_0x2bc44f(0x1ee)](_0x1b8702,{'withFileTypes':!![]})[_0x2bc44f(0x1b6)](_0x17008d=>_0x17008d[_0x2bc44f(0x1af)]())[_0x2bc44f(0x1b2)](_0x110492=>_0x110492[_0x2bc44f(0x1d4)])[_0x2bc44f(0x1b6)](_0x2c17cf=>{const _0x3b117f=_0x2bc44f,_0x30c27c=getProfileConfigPath(_0x2c17cf),_0x374b4e=getProfileEnvPath(_0x2c17cf);return a45_0x1266c2[_0x3b117f(0x1d7)](_0x30c27c)||a45_0x1266c2['existsSync'](_0x374b4e);})[_0x2bc44f(0x1b2)](_0x1cc44c=>{const _0x4a55f4=_0x2bc44f,_0x4cd028=loadProfileFromDirectory(_0x1cc44c);if(_0x4cd028)return{..._0x4cd028,'scope':_0x4a55f4(0x1d0)};return null;})[_0x2bc44f(0x1b6)](_0x249fea=>_0x249fea!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4c263e){const _0x31ba60=a45_0x5f24,_0x52364b=getProfileConfigPath(_0x4c263e),_0x3e004e=getOldCredentialPath(_0x4c263e);if(!a45_0x1266c2[_0x31ba60(0x1d7)](_0x52364b)&&!a45_0x1266c2['existsSync'](_0x3e004e))return null;let _0x5ae9f7={},_0x402b7f={'name':_0x4c263e,'createdAt':new Date()[_0x31ba60(0x1ca)]()};if(a45_0x1266c2[_0x31ba60(0x1d7)](_0x52364b))try{const _0x307d53=a45_0x1266c2['readFileSync'](_0x52364b,_0x31ba60(0x1d3)),_0x240052=JSON[_0x31ba60(0x1ce)](_0x307d53),{metadata:_0x68d40b,..._0x18f0e2}=_0x240052;_0x5ae9f7=_0x18f0e2,_0x68d40b&&(_0x402b7f=_0x68d40b);}catch{}return{'name':_0x4c263e,'config':_0x5ae9f7,'metadata':_0x402b7f,'hasCredentials':a45_0x1266c2[_0x31ba60(0x1d7)](_0x3e004e),'scope':_0x31ba60(0x1d0)};}export function listProfiles(){const _0x3b5fa3=a45_0x5f24,_0x42aef7=loadProfilesFromTdxJsonFiles(),_0x3d2dd0=loadProfilesFromDirectories();if(_0x3d2dd0[_0x3b5fa3(0x1a9)]>0x0){const _0x525bf4=_0x3d2dd0[_0x3b5fa3(0x1b2)](_0x41ac81=>_0x41ac81[_0x3b5fa3(0x1d4)])[_0x3b5fa3(0x1ba)](',\x20'),_0x2e9285=getConfigDir();console[_0x3b5fa3(0x1f6)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x525bf4),console[_0x3b5fa3(0x1f6)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x3b5fa3(0x1f6)](_0x3b5fa3(0x1c4)+a45_0x310dde[_0x3b5fa3(0x1ba)](_0x2e9285,'tdx.json')),console[_0x3b5fa3(0x1f6)](_0x3b5fa3(0x1aa)),console['warn'](_0x3b5fa3(0x1db));}const _0x151d25=[..._0x42aef7,..._0x3d2dd0],_0x447850=new Map();for(const _0x33a5b4 of _0x151d25){!_0x447850[_0x3b5fa3(0x1bb)](_0x33a5b4['name'])&&_0x447850['set'](_0x33a5b4[_0x3b5fa3(0x1d4)],_0x33a5b4);}return Array[_0x3b5fa3(0x1d1)](_0x447850[_0x3b5fa3(0x1c3)]())[_0x3b5fa3(0x1da)]((_0xf17b16,_0x1eaae5)=>_0xf17b16[_0x3b5fa3(0x1d4)][_0x3b5fa3(0x1e3)](_0x1eaae5[_0x3b5fa3(0x1d4)]));}function a45_0x5f24(_0xe24dcd,_0x1ae726){const _0x64b0ca=a45_0x64b0();return a45_0x5f24=function(_0x5f249b,_0xcc54e3){_0x5f249b=_0x5f249b-0x1a9;let _0x3bb208=_0x64b0ca[_0x5f249b];return _0x3bb208;},a45_0x5f24(_0xe24dcd,_0x1ae726);}export function profileExists(_0x7f417a){const _0xd6b29b=a45_0x5f24,_0x233132=listProfiles();return _0x233132[_0xd6b29b(0x1ec)](_0x380afa=>_0x380afa[_0xd6b29b(0x1d4)]===_0x7f417a);}export function loadProfile(_0x13f5e9){const _0x18bd2d=a45_0x5f24;validateProfileName(_0x13f5e9);const _0x39e8e4=listProfiles(),_0x3ef7c8=_0x39e8e4[_0x18bd2d(0x1dd)](_0x1b79fa=>_0x1b79fa[_0x18bd2d(0x1d4)]===_0x13f5e9);return _0x3ef7c8||null;}export function saveProfile(_0x45c31d,_0x5a2c1a,_0xe05c1f=![]){saveProfileToUserConfig(_0x45c31d,_0x5a2c1a);}export function deleteProfile(_0x593805){const _0x59c577=a45_0x5f24;validateProfileName(_0x593805);const _0x54da83=getProfileDir(_0x593805);if(!a45_0x1266c2[_0x59c577(0x1d7)](_0x54da83))throw new Error(_0x59c577(0x1bd)+_0x593805+_0x59c577(0x1b8));a45_0x1266c2[_0x59c577(0x1dc)](_0x54da83,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0xccfd53,_0x51f90d){const _0x184183=a45_0x5f24;validateProfileName(_0xccfd53);const _0x2b6cda=getGlobalConfigPath(),_0x1441f8=getConfigDir();!a45_0x1266c2[_0x184183(0x1d7)](_0x1441f8)&&createSecureDirectory(_0x1441f8);let _0x5cfd6={};if(a45_0x1266c2['existsSync'](_0x2b6cda))try{const _0x3850c3=a45_0x1266c2[_0x184183(0x1de)](_0x2b6cda,'utf-8');_0x5cfd6=JSON['parse'](_0x3850c3);}catch{console['warn'](_0x184183(0x1d8)+_0x2b6cda+',\x20creating\x20new\x20file');}!_0x5cfd6[_0x184183(0x1cf)]&&(_0x5cfd6[_0x184183(0x1cf)]={}),_0x5cfd6[_0x184183(0x1cf)][_0xccfd53]=_0x51f90d,writeSecureFile(_0x2b6cda,JSON['stringify'](_0x5cfd6,null,0x2));}export function getActiveProfile(){const _0x5da870=a45_0x5f24,_0x154854=loadSessionContext();if(_0x154854?.['profile'])return _0x154854[_0x5da870(0x1ac)];const _0x50ac27=getGlobalConfigPath();if(!a45_0x1266c2['existsSync'](_0x50ac27))return null;try{const _0x5c62e4=a45_0x1266c2['readFileSync'](_0x50ac27,'utf-8'),_0x24ebcd=JSON[_0x5da870(0x1ce)](_0x5c62e4);return _0x24ebcd[_0x5da870(0x1ac)]||null;}catch{return null;}}export function createProfile(_0x1ec7f0,_0x2f330f){const _0x26129a=a45_0x5f24;validateProfileName(_0x1ec7f0);if(profileExists(_0x1ec7f0))throw new Error(_0x26129a(0x1bd)+_0x1ec7f0+_0x26129a(0x1ea));saveProfile(_0x1ec7f0,_0x2f330f);}export function saveProfileCredentials(_0x2805c0,_0x4f627d){const _0x3d9f55=a45_0x5f24;validateProfileName(_0x2805c0);if(!profileExists(_0x2805c0))throw new Error(_0x3d9f55(0x1bd)+_0x2805c0+_0x3d9f55(0x1b8));const _0x49ab94=getNewCredentialPath(_0x2805c0);writeSecureFile(_0x49ab94,_0x4f627d);}export function loadProfileCredentials(_0x471f63){const _0x3e8a3b=a45_0x5f24;validateProfileName(_0x471f63);const _0x52b729=getNewCredentialPath(_0x471f63);if(a45_0x1266c2[_0x3e8a3b(0x1d7)](_0x52b729))try{return a45_0x1266c2[_0x3e8a3b(0x1de)](_0x52b729,_0x3e8a3b(0x1d3));}catch{}const _0x1fd382=getOldCredentialPath(_0x471f63);if(a45_0x1266c2['existsSync'](_0x1fd382)){console[_0x3e8a3b(0x1f6)](_0x3e8a3b(0x1bc)+_0x471f63+'\x27'),console[_0x3e8a3b(0x1f6)](_0x3e8a3b(0x1bf)),console[_0x3e8a3b(0x1f6)]('\x20\x20mv\x20\x22'+_0x1fd382+_0x3e8a3b(0x1f1)+_0x52b729+'\x22'),console[_0x3e8a3b(0x1f6)](_0x3e8a3b(0x1d5));try{return a45_0x1266c2[_0x3e8a3b(0x1de)](_0x1fd382,_0x3e8a3b(0x1d3));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a46_0x4bc4(_0x19a3da,_0x222b1d){const _0x47f9d8=a46_0x47f9();return a46_0x4bc4=function(_0x4bc452,_0x182020){_0x4bc452=_0x4bc452-0xc5;let _0x26c82d=_0x47f9d8[_0x4bc452];return _0x26c82d;},a46_0x4bc4(_0x19a3da,_0x222b1d);}(function(_0x210d1e,_0x4e8cf9){const _0x5a0333=a46_0x4bc4,_0x1954cc=_0x210d1e();while(!![]){try{const _0x97668e=parseInt(_0x5a0333(0xc9))/0x1*(parseInt(_0x5a0333(0xdd))/0x2)+parseInt(_0x5a0333(0xdf))/0x3*(parseInt(_0x5a0333(0xce))/0x4)+parseInt(_0x5a0333(0xcd))/0x5+-parseInt(_0x5a0333(0xc6))/0x6+-parseInt(_0x5a0333(0xd7))/0x7+-parseInt(_0x5a0333(0xe2))/0x8*(parseInt(_0x5a0333(0xd3))/0x9)+parseInt(_0x5a0333(0xcb))/0xa;if(_0x97668e===_0x4e8cf9)break;else _0x1954cc['push'](_0x1954cc['shift']());}catch(_0x13e2e1){_0x1954cc['push'](_0x1954cc['shift']());}}}(a46_0x47f9,0x63e76));import*as a46_0x24272f from'node:fs';import*as a46_0x5bfd82 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x564371){const _0x3ea3f8=a46_0x4bc4;let _0x1a5c5d=_0x564371||process[_0x3ea3f8(0xc7)]();while(!![]){const _0x385970=a46_0x5bfd82[_0x3ea3f8(0xd9)](_0x1a5c5d,PROJECT_CONFIG_FILENAME);if(a46_0x24272f[_0x3ea3f8(0xc8)](_0x385970))return _0x385970;const _0x5144b9=a46_0x5bfd82['dirname'](_0x1a5c5d);if(_0x5144b9===_0x1a5c5d)return null;_0x1a5c5d=_0x5144b9;}}export function loadProjectConfig(_0x154dcf){const _0x24d2ab=a46_0x4bc4,_0x38eddd=findProjectConfigPath(_0x154dcf);if(!_0x38eddd)return null;try{const _0x33ae1e=a46_0x24272f[_0x24d2ab(0xdb)](_0x38eddd,_0x24d2ab(0xd1)),_0xc6367d=JSON[_0x24d2ab(0xdc)](_0x33ae1e),_0xeddab9=JSON[_0x24d2ab(0xc5)](_0xc6367d);if(_0xeddab9['includes']('TD_API_KEY')||_0xeddab9[_0x24d2ab(0xd2)](_0x24d2ab(0xe3))||_0xeddab9[_0x24d2ab(0xd2)]('api_key'))throw new Error(_0x24d2ab(0xd4)+_0x38eddd+_0x24d2ab(0xd5)+_0x24d2ab(0xe0));const {metadata:_0x57bfac,profile:_0x5d02b1,..._0x1f9550}=_0xc6367d;return _0x5d02b1&&console[_0x24d2ab(0xd8)](_0x24d2ab(0xd0)+_0x38eddd+'\x20is\x20ignored.\x20'+_0x24d2ab(0xe4)),_0x1f9550;}catch(_0x52547a){if(_0x52547a instanceof Error&&'code'in _0x52547a&&_0x52547a['code']===_0x24d2ab(0xe1))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x38eddd+':\x20'+_0x52547a);}}function a46_0x47f9(){const _0x3cdaf1=['utf-8','includes','18pKhFFj','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(',').\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','3098081swICRN','warn','join','dirname','readFileSync','parse','54206scIGdS','api_key','3iQJtjr','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','ENOENT','3185144IDmJeO','apiKey','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','stringify','3738018zcaMom','cwd','existsSync','1cMrwti','writeFileSync','10631160agwACL','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','3339630JycUCr','2051732xyemmi','profile','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a46_0x47f9=function(){return _0x3cdaf1;};return a46_0x47f9();}export function saveProjectConfig(_0x501dd7,_0x50db9e){const _0x37a004=a46_0x4bc4,_0x4d6f87=_0x50db9e||process['cwd'](),_0x12d702=a46_0x5bfd82[_0x37a004(0xd9)](_0x4d6f87,PROJECT_CONFIG_FILENAME),_0x53ee58=JSON[_0x37a004(0xc5)](_0x501dd7);if(_0x53ee58[_0x37a004(0xd2)]('TD_API_KEY')||_0x53ee58['includes'](_0x37a004(0xe3))||_0x53ee58[_0x37a004(0xd2)](_0x37a004(0xde)))throw new Error(_0x37a004(0xd6));if(_0x37a004(0xcf)in _0x501dd7)throw new Error(_0x37a004(0xcc));a46_0x24272f[_0x37a004(0xca)](_0x12d702,JSON[_0x37a004(0xc5)](_0x501dd7,null,0x2));}export function hasProjectConfig(_0xe1076a){return findProjectConfigPath(_0xe1076a)!==null;}export function getProjectRoot(_0x2ebc71){const _0x204ebe=a46_0x4bc4,_0x31ea71=findProjectConfigPath(_0x2ebc71);return _0x31ea71?a46_0x5bfd82[_0x204ebe(0xda)](_0x31ea71):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1e9ffd,_0x3ebab3){const _0x1091e0=a47_0x2e65,_0x1208b5=_0x1e9ffd();while(!![]){try{const _0x446e1c=-parseInt(_0x1091e0(0xbf))/0x1*(parseInt(_0x1091e0(0xcd))/0x2)+-parseInt(_0x1091e0(0xbd))/0x3*(parseInt(_0x1091e0(0xd9))/0x4)+parseInt(_0x1091e0(0xd6))/0x5*(parseInt(_0x1091e0(0xde))/0x6)+parseInt(_0x1091e0(0xc4))/0x7*(parseInt(_0x1091e0(0xb9))/0x8)+parseInt(_0x1091e0(0xc6))/0x9+parseInt(_0x1091e0(0xcc))/0xa+parseInt(_0x1091e0(0xcf))/0xb;if(_0x446e1c===_0x3ebab3)break;else _0x1208b5['push'](_0x1208b5['shift']());}catch(_0x2aabc8){_0x1208b5['push'](_0x1208b5['shift']());}}}(a47_0xbed6,0x97072));import*as a47_0x182350 from'node:fs';import*as a47_0x124b9f from'node:path';import*as a47_0x2edbf1 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 _0x28a192=a47_0x2e65,_0x43dfca=process[_0x28a192(0xbe)][_0x28a192(0xce)]||a47_0x124b9f['join'](a47_0x2edbf1[_0x28a192(0xe1)](),_0x28a192(0xdc),_0x28a192(0xc3));return a47_0x124b9f['join'](_0x43dfca,_0x28a192(0xd5));}function a47_0x2e65(_0x56eac7,_0x4ff2e2){const _0xbed633=a47_0xbed6();return a47_0x2e65=function(_0x2e659a,_0x2dfa13){_0x2e659a=_0x2e659a-0xb9;let _0x3cf2dc=_0xbed633[_0x2e659a];return _0x3cf2dc;},a47_0x2e65(_0x56eac7,_0x4ff2e2);}function getSessionPath(_0x1c82d7){const _0x231c03=a47_0x2e65;return a47_0x124b9f['join'](getSessionsDir(),_0x1c82d7+_0x231c03(0xd8));}export function getCurrentSessionPID(){return getPPID();}function a47_0xbed6(){const _0x35258a=['join','api_key','.\x20This\x20is\x20insecure.\x20Removing\x20session.','toString','now','sessions','5lnwMaw','getTime','.json','2948agHpcE','readdirSync','unlinkSync','.config','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','1985052OTNPJT','replace','createdAt','homedir','sort','8MhWtgu','apiKey','includes','writeFileSync','4470ErfZhz','env','1jyMrxG','toISOString','readFileSync','warn','tdx','1918539ebXyII','push','3630276snpeYG','stringify','test','parse','utf-8','existsSync','11093310atiIkO','1049186rPqmDQ','TDX_CONFIG_DIR','1360909FYHyEy'];a47_0xbed6=function(){return _0x35258a;};return a47_0xbed6();}export function getSessionID(_0x962d25){if(_0x962d25)return _0x962d25;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x19331a){const _0x396357=a47_0x2e65,_0x43baff=_0x19331a||getCurrentSessionPID()[_0x396357(0xd3)](),_0x5bad5a=/^\d+$/[_0x396357(0xc8)](_0x43baff)?parseInt(_0x43baff,0xa):null;return _0x5bad5a!==null?loadSessionContextByPID(_0x5bad5a):loadSessionContextByString(_0x43baff);}export function loadSessionContextByPID(_0x3fd59d){const _0x2334f8=a47_0x2e65,_0x53dab5=getSessionPath(_0x3fd59d);if(!a47_0x182350[_0x2334f8(0xcb)](_0x53dab5))return null;try{const _0x2d3938=a47_0x182350[_0x2334f8(0xc1)](_0x53dab5,_0x2334f8(0xca)),_0x38daf8=JSON[_0x2334f8(0xc9)](_0x2d3938),_0x1b9983=new Date(_0x38daf8[_0x2334f8(0xe0)])[_0x2334f8(0xd7)](),_0x5d866c=Date[_0x2334f8(0xd4)]();if(_0x5d866c-_0x1b9983>SESSION_EXPIRATION_MS)return a47_0x182350[_0x2334f8(0xdb)](_0x53dab5),null;const _0x51afdb=JSON[_0x2334f8(0xc7)](_0x38daf8);if(_0x51afdb[_0x2334f8(0xbb)]('TD_API_KEY')||_0x51afdb[_0x2334f8(0xbb)](_0x2334f8(0xba))||_0x51afdb[_0x2334f8(0xbb)](_0x2334f8(0xd1)))return console['warn'](_0x2334f8(0xdd)+_0x53dab5+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a47_0x182350[_0x2334f8(0xdb)](_0x53dab5),null;return _0x38daf8;}catch{try{a47_0x182350[_0x2334f8(0xdb)](_0x53dab5);}catch{}return null;}}function loadSessionContextByString(_0x65ea66){const _0x2839fe=a47_0x2e65,_0x257e73=a47_0x124b9f[_0x2839fe(0xd0)](getSessionsDir(),_0x65ea66+'.json');if(!a47_0x182350[_0x2839fe(0xcb)](_0x257e73))return null;try{const _0x1cceae=a47_0x182350[_0x2839fe(0xc1)](_0x257e73,_0x2839fe(0xca)),_0x2d556f=JSON[_0x2839fe(0xc9)](_0x1cceae),_0x365503=new Date(_0x2d556f[_0x2839fe(0xe0)])[_0x2839fe(0xd7)](),_0x19f785=Date[_0x2839fe(0xd4)]();if(_0x19f785-_0x365503>SESSION_EXPIRATION_MS)return a47_0x182350[_0x2839fe(0xdb)](_0x257e73),null;const _0x453553=JSON[_0x2839fe(0xc7)](_0x2d556f);if(_0x453553[_0x2839fe(0xbb)]('TD_API_KEY')||_0x453553['includes']('apiKey')||_0x453553[_0x2839fe(0xbb)](_0x2839fe(0xd1)))return console[_0x2839fe(0xc2)](_0x2839fe(0xdd)+_0x257e73+_0x2839fe(0xd2)),a47_0x182350[_0x2839fe(0xdb)](_0x257e73),null;return _0x2d556f;}catch{try{a47_0x182350[_0x2839fe(0xdb)](_0x257e73);}catch{}return null;}}export function saveSessionContext(_0x424332,_0x5c7e27){const _0x4c6b08=a47_0x2e65,_0x48d0f2=_0x5c7e27||getCurrentSessionPID()['toString'](),_0x42b312=/^\d+$/[_0x4c6b08(0xc8)](_0x48d0f2)?parseInt(_0x48d0f2,0xa):getCurrentSessionPID(),_0xf15978=a47_0x124b9f['join'](getSessionsDir(),_0x48d0f2+_0x4c6b08(0xd8)),_0x529d2f=getSessionsDir();createSecureDirectory(_0x529d2f);const _0x69b0df=JSON[_0x4c6b08(0xc7)](_0x424332);if(_0x69b0df[_0x4c6b08(0xbb)]('TD_API_KEY')||_0x69b0df[_0x4c6b08(0xbb)]('apiKey')||_0x69b0df[_0x4c6b08(0xbb)](_0x4c6b08(0xd1)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x392d48;const _0x28baae=/^\d+$/[_0x4c6b08(0xc8)](_0x48d0f2)?loadSessionContextByPID(parseInt(_0x48d0f2,0xa)):loadSessionContextByString(_0x48d0f2);_0x28baae?_0x392d48={..._0x28baae,..._0x424332,'pid':_0x42b312,'sessionId':_0x48d0f2!==_0x42b312[_0x4c6b08(0xd3)]()?_0x48d0f2:undefined,'updatedAt':new Date()[_0x4c6b08(0xc0)]()}:_0x392d48={'pid':_0x42b312,'sessionId':_0x48d0f2!==_0x42b312['toString']()?_0x48d0f2:undefined,..._0x424332,'createdAt':new Date()[_0x4c6b08(0xc0)](),'updatedAt':new Date()[_0x4c6b08(0xc0)]()},a47_0x182350[_0x4c6b08(0xbc)](_0xf15978,JSON[_0x4c6b08(0xc7)](_0x392d48,null,0x2));}export function clearSessionContext(_0x26fb02){const _0x221b3a=a47_0x2e65,_0x54481f=_0x26fb02||getCurrentSessionPID()[_0x221b3a(0xd3)](),_0xfa1766=a47_0x124b9f[_0x221b3a(0xd0)](getSessionsDir(),_0x54481f+_0x221b3a(0xd8));a47_0x182350[_0x221b3a(0xcb)](_0xfa1766)&&a47_0x182350['unlinkSync'](_0xfa1766);}export function cleanExpiredSessions(){const _0x261a46=a47_0x2e65,_0x12f26a=getSessionsDir();if(!a47_0x182350[_0x261a46(0xcb)](_0x12f26a))return 0x0;let _0x2f9868=0x0;const _0x5a5d50=Date[_0x261a46(0xd4)]();try{const _0x5c8e16=a47_0x182350['readdirSync'](_0x12f26a);for(const _0x396d14 of _0x5c8e16){if(!_0x396d14['endsWith']('.json'))continue;const _0x35b079=a47_0x124b9f[_0x261a46(0xd0)](_0x12f26a,_0x396d14),_0x50e8d2=_0x396d14[_0x261a46(0xdf)](_0x261a46(0xd8),''),_0x774ef=parseInt(_0x50e8d2,0xa),_0x538161=!isNaN(_0x774ef);if(_0x538161){if(!isProcessRunning(_0x774ef)){a47_0x182350[_0x261a46(0xdb)](_0x35b079),_0x2f9868++;continue;}}try{const _0x3127c4=a47_0x182350[_0x261a46(0xc1)](_0x35b079,'utf-8'),_0x1c0fe7=JSON['parse'](_0x3127c4),_0x301104=new Date(_0x1c0fe7[_0x261a46(0xe0)])[_0x261a46(0xd7)]();_0x5a5d50-_0x301104>SESSION_EXPIRATION_MS&&(a47_0x182350[_0x261a46(0xdb)](_0x35b079),_0x2f9868++);}catch{a47_0x182350[_0x261a46(0xdb)](_0x35b079),_0x2f9868++;}}}catch{}return _0x2f9868;}export function listActiveSessions(){const _0x2d5a3b=a47_0x2e65,_0xb5637e=getSessionsDir();if(!a47_0x182350[_0x2d5a3b(0xcb)](_0xb5637e))return[];try{const _0x16f8f5=a47_0x182350[_0x2d5a3b(0xda)](_0xb5637e),_0x215578=[];for(const _0x5ead24 of _0x16f8f5){if(!_0x5ead24['endsWith'](_0x2d5a3b(0xd8)))continue;const _0x288638=_0x5ead24[_0x2d5a3b(0xdf)]('.json',''),_0xf64c48=parseInt(_0x288638,0xa);!isNaN(_0xf64c48)&&isProcessRunning(_0xf64c48)&&_0x215578[_0x2d5a3b(0xc5)](_0xf64c48);}return _0x215578[_0x2d5a3b(0xe2)]((_0x44f600,_0xdea836)=>_0x44f600-_0xdea836);}catch{return[];}}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x43c4e1,_0x31323b){var _0xcffeca=a48_0x4c84,_0x4a811b=_0x43c4e1();while(!![]){try{var _0x4d80ec=-parseInt(_0xcffeca(0xca))/0x1*(parseInt(_0xcffeca(0xcf))/0x2)+parseInt(_0xcffeca(0xce))/0x3*(parseInt(_0xcffeca(0xcb))/0x4)+-parseInt(_0xcffeca(0xc6))/0x5+parseInt(_0xcffeca(0xcc))/0x6*(parseInt(_0xcffeca(0xc9))/0x7)+parseInt(_0xcffeca(0xc5))/0x8*(parseInt(_0xcffeca(0xcd))/0x9)+-parseInt(_0xcffeca(0xc4))/0xa*(parseInt(_0xcffeca(0xc8))/0xb)+-parseInt(_0xcffeca(0xd0))/0xc*(-parseInt(_0xcffeca(0xc7))/0xd);if(_0x4d80ec===_0x31323b)break;else _0x4a811b['push'](_0x4a811b['shift']());}catch(_0x1efe1f){_0x4a811b['push'](_0x4a811b['shift']());}}}(a48_0x3864,0x6fb36));export*from'./types/index.js';export*from'./core/config.js';function a48_0x3864(){var _0xce1b27=['1901695heMbEG','91jWSVxf','4385920oJZBgC','227122JgUnAC','9nQHyZw','52Joqbyh','66hsxpLW','18AuQsLt','115722eVDWzS','186374kgHKIn','1680072SWhOtL','10yXdHSB','947432tchlsi'];a48_0x3864=function(){return _0xce1b27;};return a48_0x3864();}export*from'./core/auth.js';function a48_0x4c84(_0x534aa6,_0x20ea06){var _0x38640b=a48_0x3864();return a48_0x4c84=function(_0x4c849b,_0x3ecec5){_0x4c849b=_0x4c849b-0xc4;var _0x376ec8=_0x38640b[_0x4c849b];return _0x376ec8;},a48_0x4c84(_0x534aa6,_0x20ea06);}export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';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';
|